@spaceandtimelabs/makeinfinite-ui 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- (function(Re,re){typeof exports=="object"&&typeof module<"u"?re(exports,require("react"),require("@babel/standalone"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@babel/standalone","react-dom"],re):(Re=typeof globalThis<"u"?globalThis:Re||self,re(Re.MakeInfinite={},Re.React,Re.Babel,Re.ReactDOM))})(this,function(Re,re,mh,hc){"use strict";function wh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const pc=wh(mh);var Ci=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Za(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var gh=yh;function yh(e){var t,r;if(typeof e!="function")throw new Error("expected a function but got "+e);return function(){return t||(t=!0,r=e.apply(this,arguments)),r}}(function(e){function t(b,_){var k;return b instanceof Buffer?k=b:k=Buffer.from(b.buffer,b.byteOffset,b.byteLength),k.toString(_)}var r=function(b){return Buffer.from(b)};function n(b){for(var _=0,k=Math.min(256*256,b.length+1),S=new Uint16Array(k),y=[],C=0;;){var O=_<b.length;if(!O||C>=k-1){var R=S.subarray(0,C),A=R;if(y.push(String.fromCharCode.apply(null,A)),!O)return y.join("");b=b.subarray(_),_=0,C=0}var D=b[_++];if(!(D&128))S[C++]=D;else if((D&224)===192){var j=b[_++]&63;S[C++]=(D&31)<<6|j}else if((D&240)===224){var j=b[_++]&63,M=b[_++]&63;S[C++]=(D&31)<<12|j<<6|M}else if((D&248)===240){var j=b[_++]&63,M=b[_++]&63,U=b[_++]&63,Z=(D&7)<<18|j<<12|M<<6|U;Z>65535&&(Z-=65536,S[C++]=Z>>>10&1023|55296,Z=56320|Z&1023),S[C++]=Z}}}function i(b){for(var _=0,k=b.length,S=0,y=Math.max(32,k+(k>>>1)+7),C=new Uint8Array(y>>>3<<3);_<k;){var O=b.charCodeAt(_++);if(O>=55296&&O<=56319){if(_<k){var R=b.charCodeAt(_);(R&64512)===56320&&(++_,O=((O&1023)<<10)+(R&1023)+65536)}if(O>=55296&&O<=56319)continue}if(S+4>C.length){y+=8,y*=1+_/b.length*2,y=y>>>3<<3;var A=new Uint8Array(y);A.set(C),C=A}if(O&4294967168)if(!(O&4294965248))C[S++]=O>>>6&31|192;else if(!(O&4294901760))C[S++]=O>>>12&15|224,C[S++]=O>>>6&63|128;else if(!(O&4292870144))C[S++]=O>>>18&7|240,C[S++]=O>>>12&63|128,C[S++]=O>>>6&63|128;else continue;else{C[S++]=O;continue}C[S++]=O&63|128}return C.slice?C.slice(0,S):C.subarray(0,S)}var a="Failed to ",o=function(b,_,k){if(b)throw new Error("".concat(a).concat(_,": the '").concat(k,"' option is unsupported."))},s=typeof Buffer=="function"&&Buffer.from,l=s?r:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(b,_){return o(_&&_.stream,"encode","stream"),l(b)};function u(b){var _;try{var k=new Blob([b],{type:"text/plain;charset=UTF-8"});_=URL.createObjectURL(k);var S=new XMLHttpRequest;return S.open("GET",_,!1),S.send(),S.responseText}finally{_&&URL.revokeObjectURL(_)}}var d=!s&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",p=["utf-8","utf8","unicode-1-1-utf-8"],m=n;s?m=t:d&&(m=function(b){try{return u(b)}catch{return n(b)}});var g="construct 'TextDecoder'",v="".concat(a," ").concat(g,": the ");function x(b,_){o(_&&_.fatal,g,"fatal"),b=b||"utf-8";var k;if(s?k=Buffer.isEncoding(b):k=p.indexOf(b.toLowerCase())!==-1,!k)throw new RangeError("".concat(v," encoding label provided ('").concat(b,"') is invalid."));this.encoding=b,this.fatal=!1,this.ignoreBOM=!1}x.prototype.decode=function(b,_){o(_&&_.stream,"decode","stream");var k;return b instanceof Uint8Array?k=b:b.buffer instanceof ArrayBuffer?k=new Uint8Array(b.buffer):k=new Uint8Array(b),m(k,this.encoding)},e.TextEncoder=e.TextEncoder||c,e.TextDecoder=e.TextDecoder||x})(typeof window<"u"?window:Ci);var bh={encode:e=>new TextEncoder().encode(e),decode:e=>new TextDecoder().decode(e)},vh=_h;function _h(e,t,r){var n;return function(){if(!t)return e.apply(this,arguments);var i=this,a=arguments,o=r&&!n;if(clearTimeout(n),n=setTimeout(function(){if(n=null,!o)return e.apply(i,a)},t),o)return e.apply(this,arguments)}}function mc(e){if(e.length===0)return".";let t=wc(e);return t=t.reduce(kh,[]),Xa(...t)}function xh(...e){let t="";for(let r of e)r.startsWith("/")?t=r:t=mc(Xa(t,r));return t}function Xa(...e){if(e.length===0)return"";let t=e.join("/");return t=t.replace(/\/{2,}/g,"/"),t}function wc(e){if(e.length===0)return[];if(e==="/")return["/"];let t=e.split("/");return t[t.length-1]===""&&t.pop(),e[0]==="/"?t[0]="/":t[0]!=="."&&t.unshift("."),t}function Eh(e){const t=e.lastIndexOf("/");if(t===-1)throw new Error(`Cannot get dirname of "${e}"`);return t===0?"/":e.slice(0,t)}function Sh(e){if(e==="/")throw new Error(`Cannot get basename of "${e}"`);const t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function kh(e,t){if(e.length===0)return e.push(t),e;if(t===".")return e;if(t===".."){if(e.length===1){if(e[0]==="/")throw new Error("Unable to normalize path - traverses above root directory");if(e[0]===".")return e.push(t),e}return e[e.length-1]===".."?(e.push(".."),e):(e.pop(),e)}return e.push(t),e}var Va={join:Xa,normalize:mc,split:wc,basename:Sh,dirname:Eh,resolve:xh};function On(e){return class extends Error{constructor(...t){super(...t),this.code=e,this.message?this.message=e+": "+this.message:this.message=e}}}const Rh=On("EEXIST"),Oh=On("ENOENT"),Ch=On("ENOTDIR"),Ph=On("ENOTEMPTY"),Th=On("ETIMEDOUT");var gc={EEXIST:Rh,ENOENT:Oh,ENOTDIR:Ch,ENOTEMPTY:Ph,ETIMEDOUT:Th};const et=Va,{EEXIST:yc,ENOENT:Ah,ENOTDIR:bc,ENOTEMPTY:Dh}=gc,Ze=0;var $h=class{constructor(){}_makeRoot(t=new Map){return t.set(Ze,{mode:511,type:"dir",size:0,ino:0,mtimeMs:Date.now()}),t}activate(t=null){t===null?this._root=new Map([["/",this._makeRoot()]]):typeof t=="string"?this._root=new Map([["/",this._makeRoot(this.parse(t))]]):this._root=t}get activated(){return!!this._root}deactivate(){this._root=void 0}size(){return this._countInodes(this._root.get("/"))-1}_countInodes(t){let r=1;for(let[n,i]of t)n!==Ze&&(r+=this._countInodes(i));return r}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(t){let r=t.get(Ze).ino;for(let[n,i]of t)n!==Ze&&(r=Math.max(r,this._maxInode(i)));return r}print(t=this._root.get("/")){let r="";const n=(i,a)=>{for(let[o,s]of i){if(o===0)continue;let l=s.get(Ze),c=l.mode.toString(8);r+=`${" ".repeat(a)}${o} ${c}`,l.type==="file"?r+=` ${l.size} ${l.mtimeMs}
1
+ (function(_e,Q){typeof exports=="object"&&typeof module<"u"?Q(exports,require("react"),require("@babel/standalone"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@babel/standalone","react-dom"],Q):(_e=typeof globalThis<"u"?globalThis:_e||self,Q(_e.MakeInfinite={},_e.React,_e.Babel,_e.ReactDOM))})(this,function(_e,Q,mh,pc){"use strict";function wh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const mc=wh(mh);var Ci=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Za(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var gh=yh;function yh(e){var t,r;if(typeof e!="function")throw new Error("expected a function but got "+e);return function(){return t||(t=!0,r=e.apply(this,arguments)),r}}(function(e){function t(y,_){var R;return y instanceof Buffer?R=y:R=Buffer.from(y.buffer,y.byteOffset,y.byteLength),R.toString(_)}var r=function(y){return Buffer.from(y)};function n(y){for(var _=0,R=Math.min(256*256,y.length+1),C=new Uint16Array(R),x=[],O=0;;){var k=_<y.length;if(!k||O>=R-1){var S=C.subarray(0,O),A=S;if(x.push(String.fromCharCode.apply(null,A)),!k)return x.join("");y=y.subarray(_),_=0,O=0}var D=y[_++];if(!(D&128))C[O++]=D;else if((D&224)===192){var B=y[_++]&63;C[O++]=(D&31)<<6|B}else if((D&240)===224){var B=y[_++]&63,M=y[_++]&63;C[O++]=(D&31)<<12|B<<6|M}else if((D&248)===240){var B=y[_++]&63,M=y[_++]&63,U=y[_++]&63,Z=(D&7)<<18|B<<12|M<<6|U;Z>65535&&(Z-=65536,C[O++]=Z>>>10&1023|55296,Z=56320|Z&1023),C[O++]=Z}}}function i(y){for(var _=0,R=y.length,C=0,x=Math.max(32,R+(R>>>1)+7),O=new Uint8Array(x>>>3<<3);_<R;){var k=y.charCodeAt(_++);if(k>=55296&&k<=56319){if(_<R){var S=y.charCodeAt(_);(S&64512)===56320&&(++_,k=((k&1023)<<10)+(S&1023)+65536)}if(k>=55296&&k<=56319)continue}if(C+4>O.length){x+=8,x*=1+_/y.length*2,x=x>>>3<<3;var A=new Uint8Array(x);A.set(O),O=A}if(k&4294967168)if(!(k&4294965248))O[C++]=k>>>6&31|192;else if(!(k&4294901760))O[C++]=k>>>12&15|224,O[C++]=k>>>6&63|128;else if(!(k&4292870144))O[C++]=k>>>18&7|240,O[C++]=k>>>12&63|128,O[C++]=k>>>6&63|128;else continue;else{O[C++]=k;continue}O[C++]=k&63|128}return O.slice?O.slice(0,C):O.subarray(0,C)}var a="Failed to ",o=function(y,_,R){if(y)throw new Error("".concat(a).concat(_,": the '").concat(R,"' option is unsupported."))},s=typeof Buffer=="function"&&Buffer.from,l=s?r:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(y,_){return o(_&&_.stream,"encode","stream"),l(y)};function u(y){var _;try{var R=new Blob([y],{type:"text/plain;charset=UTF-8"});_=URL.createObjectURL(R);var C=new XMLHttpRequest;return C.open("GET",_,!1),C.send(),C.responseText}finally{_&&URL.revokeObjectURL(_)}}var d=!s&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",p=["utf-8","utf8","unicode-1-1-utf-8"],m=n;s?m=t:d&&(m=function(y){try{return u(y)}catch{return n(y)}});var g="construct 'TextDecoder'",b="".concat(a," ").concat(g,": the ");function v(y,_){o(_&&_.fatal,g,"fatal"),y=y||"utf-8";var R;if(s?R=Buffer.isEncoding(y):R=p.indexOf(y.toLowerCase())!==-1,!R)throw new RangeError("".concat(b," encoding label provided ('").concat(y,"') is invalid."));this.encoding=y,this.fatal=!1,this.ignoreBOM=!1}v.prototype.decode=function(y,_){o(_&&_.stream,"decode","stream");var R;return y instanceof Uint8Array?R=y:y.buffer instanceof ArrayBuffer?R=new Uint8Array(y.buffer):R=new Uint8Array(y),m(R,this.encoding)},e.TextEncoder=e.TextEncoder||c,e.TextDecoder=e.TextDecoder||v})(typeof window<"u"?window:Ci);var bh={encode:e=>new TextEncoder().encode(e),decode:e=>new TextDecoder().decode(e)},_h=vh;function vh(e,t,r){var n;return function(){if(!t)return e.apply(this,arguments);var i=this,a=arguments,o=r&&!n;if(clearTimeout(n),n=setTimeout(function(){if(n=null,!o)return e.apply(i,a)},t),o)return e.apply(this,arguments)}}function wc(e){if(e.length===0)return".";let t=gc(e);return t=t.reduce(kh,[]),Xa(...t)}function xh(...e){let t="";for(let r of e)r.startsWith("/")?t=r:t=wc(Xa(t,r));return t}function Xa(...e){if(e.length===0)return"";let t=e.join("/");return t=t.replace(/\/{2,}/g,"/"),t}function gc(e){if(e.length===0)return[];if(e==="/")return["/"];let t=e.split("/");return t[t.length-1]===""&&t.pop(),e[0]==="/"?t[0]="/":t[0]!=="."&&t.unshift("."),t}function Eh(e){const t=e.lastIndexOf("/");if(t===-1)throw new Error(`Cannot get dirname of "${e}"`);return t===0?"/":e.slice(0,t)}function Sh(e){if(e==="/")throw new Error(`Cannot get basename of "${e}"`);const t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function kh(e,t){if(e.length===0)return e.push(t),e;if(t===".")return e;if(t===".."){if(e.length===1){if(e[0]==="/")throw new Error("Unable to normalize path - traverses above root directory");if(e[0]===".")return e.push(t),e}return e[e.length-1]===".."?(e.push(".."),e):(e.pop(),e)}return e.push(t),e}var Va={join:Xa,normalize:wc,split:gc,basename:Sh,dirname:Eh,resolve:xh};function On(e){return class extends Error{constructor(...t){super(...t),this.code=e,this.message?this.message=e+": "+this.message:this.message=e}}}const Rh=On("EEXIST"),Oh=On("ENOENT"),Ch=On("ENOTDIR"),Ph=On("ENOTEMPTY"),Th=On("ETIMEDOUT");var yc={EEXIST:Rh,ENOENT:Oh,ENOTDIR:Ch,ENOTEMPTY:Ph,ETIMEDOUT:Th};const et=Va,{EEXIST:bc,ENOENT:Ah,ENOTDIR:_c,ENOTEMPTY:Dh}=yc,Ze=0;var $h=class{constructor(){}_makeRoot(t=new Map){return t.set(Ze,{mode:511,type:"dir",size:0,ino:0,mtimeMs:Date.now()}),t}activate(t=null){t===null?this._root=new Map([["/",this._makeRoot()]]):typeof t=="string"?this._root=new Map([["/",this._makeRoot(this.parse(t))]]):this._root=t}get activated(){return!!this._root}deactivate(){this._root=void 0}size(){return this._countInodes(this._root.get("/"))-1}_countInodes(t){let r=1;for(let[n,i]of t)n!==Ze&&(r+=this._countInodes(i));return r}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(t){let r=t.get(Ze).ino;for(let[n,i]of t)n!==Ze&&(r=Math.max(r,this._maxInode(i)));return r}print(t=this._root.get("/")){let r="";const n=(i,a)=>{for(let[o,s]of i){if(o===0)continue;let l=s.get(Ze),c=l.mode.toString(8);r+=`${" ".repeat(a)}${o} ${c}`,l.type==="file"?r+=` ${l.size} ${l.mtimeMs}
2
2
  `:(r+=`
3
3
  `,n(s,a+1))}};return n(t,0),r}parse(t){let r=0;function n(s){const l=++r,c=s.length===1?"dir":"file";let[u,d,p]=s;return u=parseInt(u,8),d=d?parseInt(d):0,p=p?parseInt(p):Date.now(),new Map([[Ze,{mode:u,type:c,size:d,mtimeMs:p,ino:l}]])}let i=t.trim().split(`
4
- `),a=this._makeRoot(),o=[{indent:-1,node:a},{indent:0,node:null}];for(let s of i){let c=s.match(/^\t*/)[0].length;s=s.slice(c);let[u,...d]=s.split(" "),p=n(d);if(c<=o[o.length-1].indent)for(;c<=o[o.length-1].indent;)o.pop();o.push({indent:c,node:p}),o[o.length-2].node.set(u,p)}return a}_lookup(t,r=!0){let n=this._root,i="/",a=et.split(t);for(let o=0;o<a.length;++o){let s=a[o];if(n=n.get(s),!n)throw new Ah(t);if(r||o<a.length-1){const l=n.get(Ze);if(l.type==="symlink"){let c=et.resolve(i,l.target);n=this._lookup(c)}i?i=et.join(i,s):i=s}}return n}mkdir(t,{mode:r}){if(t==="/")throw new yc;let n=this._lookup(et.dirname(t)),i=et.basename(t);if(n.has(i))throw new yc;let a=new Map,o={mode:r,type:"dir",size:0,mtimeMs:Date.now(),ino:this.autoinc()};a.set(Ze,o),n.set(i,a)}rmdir(t){let r=this._lookup(t);if(r.get(Ze).type!=="dir")throw new bc;if(r.size>1)throw new Dh;let n=this._lookup(et.dirname(t)),i=et.basename(t);n.delete(i)}readdir(t){let r=this._lookup(t);if(r.get(Ze).type!=="dir")throw new bc;return[...r.keys()].filter(n=>typeof n=="string")}writeStat(t,r,{mode:n}){let i;try{let c=this.stat(t);n==null&&(n=c.mode),i=c.ino}catch{}n==null&&(n=438),i==null&&(i=this.autoinc());let a=this._lookup(et.dirname(t)),o=et.basename(t),s={mode:n,type:"file",size:r,mtimeMs:Date.now(),ino:i},l=new Map;return l.set(Ze,s),a.set(o,l),s}unlink(t){let r=this._lookup(et.dirname(t)),n=et.basename(t);r.delete(n)}rename(t,r){let n=et.basename(r),i=this._lookup(t);this._lookup(et.dirname(r)).set(n,i),this.unlink(t)}stat(t){return this._lookup(t).get(Ze)}lstat(t){return this._lookup(t,!1).get(Ze)}readlink(t){return this._lookup(t,!1).get(Ze).target}symlink(t,r){let n,i;try{let c=this.stat(r);i===null&&(i=c.mode),n=c.ino}catch{}i==null&&(i=40960),n==null&&(n=this.autoinc());let a=this._lookup(et.dirname(r)),o=et.basename(r),s={mode:i,type:"symlink",target:t,size:0,mtimeMs:Date.now(),ino:n},l=new Map;return l.set(Ze,s),a.set(o,l),s}_du(t){let r=0;for(const[n,i]of t.entries())n===Ze?r+=i.size:r+=this._du(i);return r}du(t){let r=this._lookup(t);return this._du(r)}};class vc{constructor(t="keyval-store",r="keyval"){this.storeName=r,this._dbName=t,this._storeName=r,this._init()}_init(){this._dbp||(this._dbp=new Promise((t,r)=>{const n=indexedDB.open(this._dbName);n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result),n.onupgradeneeded=()=>{n.result.createObjectStore(this._storeName)}}))}_withIDBStore(t,r){return this._init(),this._dbp.then(n=>new Promise((i,a)=>{const o=n.transaction(this.storeName,t);o.oncomplete=()=>i(),o.onabort=o.onerror=()=>a(o.error),r(o.objectStore(this.storeName))}))}_close(){return this._init(),this._dbp.then(t=>{t.close(),this._dbp=void 0})}}let Ka;function _r(){return Ka||(Ka=new vc),Ka}function Ih(e,t=_r()){let r;return t._withIDBStore("readwrite",n=>{r=n.get(e)}).then(()=>r.result)}function Bh(e,t,r=_r()){return r._withIDBStore("readwrite",n=>{n.put(t,e)})}function jh(e,t,r=_r()){return r._withIDBStore("readwrite",n=>{const i=n.get(e);i.onsuccess=()=>{n.put(t(i.result),e)}})}function zh(e,t=_r()){return t._withIDBStore("readwrite",r=>{r.delete(e)})}function Nh(e=_r()){return e._withIDBStore("readwrite",t=>{t.clear()})}function Mh(e=_r()){const t=[];return e._withIDBStore("readwrite",r=>{(r.openKeyCursor||r.openCursor).call(r).onsuccess=function(){this.result&&(t.push(this.result.key),this.result.continue())}}).then(()=>t)}function Lh(e=_r()){return e._close()}const _c=Za(Object.freeze(Object.defineProperty({__proto__:null,Store:vc,clear:Nh,close:Lh,del:zh,get:Ih,keys:Mh,set:Bh,update:jh},Symbol.toStringTag,{value:"Module"}))),tr=_c;var Fh=class{constructor(t,r){this._database=t,this._storename=r,this._store=new tr.Store(this._database,this._storename)}saveSuperblock(t){return tr.set("!root",t,this._store)}loadSuperblock(){return tr.get("!root",this._store)}readFile(t){return tr.get(t,this._store)}writeFile(t,r){return tr.set(t,r,this._store)}unlink(t){return tr.del(t,this._store)}wipe(){return tr.clear(this._store)}close(){return tr.close(this._store)}},Uh=class{constructor(t){this._url=t}loadSuperblock(){return fetch(this._url+"/.superblock.txt").then(t=>t.ok?t.text():null)}async readFile(t){const r=await fetch(this._url+t);if(r.status===200)return r.arrayBuffer();throw new Error("ENOENT")}async sizeFile(t){const r=await fetch(this._url+t,{method:"HEAD"});if(r.status===200)return r.headers.get("content-length");throw new Error("ENOENT")}};const Cn=_c,Hh=e=>new Promise(t=>setTimeout(t,e));var Wh=class{constructor(t,r){this._id=Math.random(),this._database=t,this._storename=r,this._store=new Cn.Store(this._database,this._storename),this._lock=null}async has({margin:t=2e3}={}){if(this._lock&&this._lock.holder===this._id){const r=Date.now();return this._lock.expires>r+t?!0:await this.renew()}else return!1}async renew({ttl:t=5e3}={}){let r;return await Cn.update("lock",n=>{const a=Date.now()+t;return r=n&&n.holder===this._id,this._lock=r?{holder:this._id,expires:a}:n,this._lock},this._store),r}async acquire({ttl:t=5e3}={}){let r,n,i;if(await Cn.update("lock",a=>{const o=Date.now(),s=o+t;return n=a&&a.expires<o,r=a===void 0||n,i=a&&a.holder===this._id,this._lock=r?{holder:this._id,expires:s}:a,this._lock},this._store),i)throw new Error("Mutex double-locked");return r}async wait({interval:t=100,limit:r=6e3,ttl:n}={}){for(;r--;){if(await this.acquire({ttl:n}))return!0;await Hh(t)}throw new Error("Mutex timeout")}async release({force:t=!1}={}){let r,n,i;if(await Cn.update("lock",a=>(r=t||a&&a.holder===this._id,n=a===void 0,i=a&&a.holder!==this._id,this._lock=r?void 0:a,this._lock),this._store),await Cn.close(this._store),!r&&!t){if(n)throw new Error("Mutex double-freed");if(i)throw new Error("Mutex lost ownership")}return r}},qh=class{constructor(t){this._id=Math.random(),this._database=t,this._has=!1,this._release=null}async has(){return this._has}async acquire(){return new Promise(t=>{navigator.locks.request(this._database+"_lock",{ifAvailable:!0},r=>(this._has=!!r,t(!!r),new Promise(n=>{this._release=n})))})}async wait({timeout:t=6e5}={}){return new Promise((r,n)=>{const i=new AbortController;setTimeout(()=>{i.abort(),n(new Error("Mutex timeout"))},t),navigator.locks.request(this._database+"_lock",{signal:i.signal},a=>(this._has=!!a,r(!!a),new Promise(o=>{this._release=o})))})}async release({force:t=!1}={}){this._has=!1,this._release?this._release():t&&navigator.locks.request(this._database+"_lock",{steal:!0},r=>!0)}};const{encode:Gh,decode:xc}=bh,Yh=vh,Zh=$h,{ENOENT:Xh,ENOTEMPTY:Vh,ETIMEDOUT:Kh}=gc,Jh=Fh,Qh=Uh,ep=Wh,tp=qh,Pn=Va;var rp=class{constructor(){this.saveSuperblock=Yh(()=>{this.flush()},500)}async init(t,{wipe:r,url:n,urlauto:i,fileDbName:a=t,db:o=null,fileStoreName:s=t+"_files",lockDbName:l=t+"_lock",lockStoreName:c=t+"_lock"}={}){this._name=t,this._idb=o||new Jh(a,s),this._mutex=navigator.locks?new tp(t):new ep(l,c),this._cache=new Zh(t),this._opts={wipe:r,url:n},this._needsWipe=!!r,n&&(this._http=new Qh(n),this._urlauto=!!i)}async activate(){if(this._cache.activated)return;this._needsWipe&&(this._needsWipe=!1,await this._idb.wipe(),await this._mutex.release({force:!0})),await this._mutex.has()||await this._mutex.wait();const t=await this._idb.loadSuperblock();if(t)this._cache.activate(t);else if(this._http){const r=await this._http.loadSuperblock();this._cache.activate(r),await this._saveSuperblock()}else this._cache.activate();if(!await this._mutex.has())throw new Kh}async deactivate(){await this._mutex.has()&&await this._saveSuperblock(),this._cache.deactivate();try{await this._mutex.release()}catch(t){console.log(t)}await this._idb.close()}async _saveSuperblock(){this._cache.activated&&(this._lastSavedAt=Date.now(),await this._idb.saveSuperblock(this._cache._root))}_writeStat(t,r,n){let i=Pn.split(Pn.dirname(t)),a=i.shift();for(let o of i){a=Pn.join(a,o);try{this._cache.mkdir(a,{mode:511})}catch{}}return this._cache.writeStat(t,r,n)}async readFile(t,r){const{encoding:n}=r;if(n&&n!=="utf8")throw new Error('Only "utf8" encoding is supported in readFile');let i=null,a=null;try{a=this._cache.stat(t),i=await this._idb.readFile(a.ino)}catch(o){if(!this._urlauto)throw o}if(!i&&this._http){let o=this._cache.lstat(t);for(;o.type==="symlink";)t=Pn.resolve(Pn.dirname(t),o.target),o=this._cache.lstat(t);i=await this._http.readFile(t)}if(i&&((!a||a.size!=i.byteLength)&&(a=await this._writeStat(t,i.byteLength,{mode:a?a.mode:438}),this.saveSuperblock()),n==="utf8"?i=xc(i):i.toString=()=>xc(i)),!a)throw new Xh(t);return i}async writeFile(t,r,n){const{mode:i,encoding:a="utf8"}=n;if(typeof r=="string"){if(a!=="utf8")throw new Error('Only "utf8" encoding is supported in writeFile');r=Gh(r)}const o=await this._cache.writeStat(t,r.byteLength,{mode:i});await this._idb.writeFile(o.ino,r)}async unlink(t,r){const n=this._cache.lstat(t);this._cache.unlink(t),n.type!=="symlink"&&await this._idb.unlink(n.ino)}readdir(t,r){return this._cache.readdir(t)}mkdir(t,r){const{mode:n=511}=r;this._cache.mkdir(t,{mode:n})}rmdir(t,r){if(t==="/")throw new Vh;this._cache.rmdir(t)}rename(t,r){this._cache.rename(t,r)}stat(t,r){return this._cache.stat(t)}lstat(t,r){return this._cache.lstat(t)}readlink(t,r){return this._cache.readlink(t)}symlink(t,r){this._cache.symlink(t,r)}async backFile(t,r){let n=await this._http.sizeFile(t);await this._writeStat(t,n,r)}du(t){return this._cache.du(t)}flush(){return this._saveSuperblock()}},np=class{constructor(t){this.type=t.type,this.mode=t.mode,this.size=t.size,this.ino=t.ino,this.mtimeMs=t.mtimeMs,this.ctimeMs=t.ctimeMs||t.mtimeMs,this.uid=1,this.gid=1,this.dev=1}isFile(){return this.type==="file"}isDirectory(){return this.type==="dir"}isSymbolicLink(){return this.type==="symlink"}};const ip=rp,Ec=np,Pi=Va;function Tt(e,t,...r){return e=Pi.normalize(e),(typeof t>"u"||typeof t=="function")&&(t={}),typeof t=="string"&&(t={encoding:t}),[e,t,...r]}function ap(e,t,r,...n){return e=Pi.normalize(e),(typeof r>"u"||typeof r=="function")&&(r={}),typeof r=="string"&&(r={encoding:r}),[e,t,r,...n]}function Sc(e,t,...r){return[Pi.normalize(e),Pi.normalize(t),...r]}var op=class{constructor(t,r={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,Tt,!1),this.writeFile=this._wrap(this.writeFile,ap,!0),this.unlink=this._wrap(this.unlink,Tt,!0),this.readdir=this._wrap(this.readdir,Tt,!1),this.mkdir=this._wrap(this.mkdir,Tt,!0),this.rmdir=this._wrap(this.rmdir,Tt,!0),this.rename=this._wrap(this.rename,Sc,!0),this.stat=this._wrap(this.stat,Tt,!1),this.lstat=this._wrap(this.lstat,Tt,!1),this.readlink=this._wrap(this.readlink,Tt,!1),this.symlink=this._wrap(this.symlink,Sc,!0),this.backFile=this._wrap(this.backFile,Tt,!0),this.du=this._wrap(this.du,Tt,!1),this._deactivationPromise=null,this._deactivationTimeout=null,this._activationPromise=null,this._operations=new Set,t&&this.init(t,r)}async init(...t){return this._initPromiseResolve&&await this._initPromise,this._initPromise=this._init(...t),this._initPromise}async _init(t,r={}){await this._gracefulShutdown(),this._activationPromise&&await this._deactivate(),this._backend&&this._backend.destroy&&await this._backend.destroy(),this._backend=r.backend||new ip,this._backend.init&&await this._backend.init(t,r),this._initPromiseResolve&&(this._initPromiseResolve(),this._initPromiseResolve=null),r.defer||this.stat("/")}async _gracefulShutdown(){this._operations.size>0&&(this._isShuttingDown=!0,await new Promise(t=>this._gracefulShutdownResolve=t),this._isShuttingDown=!1,this._gracefulShutdownResolve=null)}_wrap(t,r,n){return async(...i)=>{i=r(...i);let a={name:t.name,args:i};this._operations.add(a);try{return await this._activate(),await t.apply(this,i)}finally{this._operations.delete(a),n&&this._backend.saveSuperblock(),this._operations.size===0&&(this._deactivationTimeout||clearTimeout(this._deactivationTimeout),this._deactivationTimeout=setTimeout(this._deactivate.bind(this),500))}}}async _activate(){this._initPromise||console.warn(new Error(`Attempted to use LightningFS ${this._name} before it was initialized.`)),await this._initPromise,this._deactivationTimeout&&(clearTimeout(this._deactivationTimeout),this._deactivationTimeout=null),this._deactivationPromise&&await this._deactivationPromise,this._deactivationPromise=null,this._activationPromise||(this._activationPromise=this._backend.activate?this._backend.activate():Promise.resolve()),await this._activationPromise}async _deactivate(){return this._activationPromise&&await this._activationPromise,this._deactivationPromise||(this._deactivationPromise=this._backend.deactivate?this._backend.deactivate():Promise.resolve()),this._activationPromise=null,this._gracefulShutdownResolve&&this._gracefulShutdownResolve(),this._deactivationPromise}async readFile(t,r){return this._backend.readFile(t,r)}async writeFile(t,r,n){return await this._backend.writeFile(t,r,n),null}async unlink(t,r){return await this._backend.unlink(t,r),null}async readdir(t,r){return this._backend.readdir(t,r)}async mkdir(t,r){return await this._backend.mkdir(t,r),null}async rmdir(t,r){return await this._backend.rmdir(t,r),null}async rename(t,r){return await this._backend.rename(t,r),null}async stat(t,r){const n=await this._backend.stat(t,r);return new Ec(n)}async lstat(t,r){const n=await this._backend.lstat(t,r);return new Ec(n)}async readlink(t,r){return this._backend.readlink(t,r)}async symlink(t,r){return await this._backend.symlink(t,r),null}async backFile(t,r){return await this._backend.backFile(t,r),null}async du(t){return this._backend.du(t)}async flush(){return this._backend.flush()}};const sp=gh,cp=op;function at(e,t){return typeof e=="function"&&(t=e),t=sp(t),[(...n)=>t(null,...n),t]}var lp=class{constructor(...t){this.promises=new cp(...t),this.init=this.init.bind(this),this.readFile=this.readFile.bind(this),this.writeFile=this.writeFile.bind(this),this.unlink=this.unlink.bind(this),this.readdir=this.readdir.bind(this),this.mkdir=this.mkdir.bind(this),this.rmdir=this.rmdir.bind(this),this.rename=this.rename.bind(this),this.stat=this.stat.bind(this),this.lstat=this.lstat.bind(this),this.readlink=this.readlink.bind(this),this.symlink=this.symlink.bind(this),this.backFile=this.backFile.bind(this),this.du=this.du.bind(this),this.flush=this.flush.bind(this)}init(t,r){return this.promises.init(t,r)}readFile(t,r,n){const[i,a]=at(r,n);this.promises.readFile(t,r).then(i).catch(a)}writeFile(t,r,n,i){const[a,o]=at(n,i);this.promises.writeFile(t,r,n).then(a).catch(o)}unlink(t,r,n){const[i,a]=at(r,n);this.promises.unlink(t,r).then(i).catch(a)}readdir(t,r,n){const[i,a]=at(r,n);this.promises.readdir(t,r).then(i).catch(a)}mkdir(t,r,n){const[i,a]=at(r,n);this.promises.mkdir(t,r).then(i).catch(a)}rmdir(t,r,n){const[i,a]=at(r,n);this.promises.rmdir(t,r).then(i).catch(a)}rename(t,r,n){const[i,a]=at(n);this.promises.rename(t,r).then(i).catch(a)}stat(t,r,n){const[i,a]=at(r,n);this.promises.stat(t).then(i).catch(a)}lstat(t,r,n){const[i,a]=at(r,n);this.promises.lstat(t).then(i).catch(a)}readlink(t,r,n){const[i,a]=at(r,n);this.promises.readlink(t).then(i).catch(a)}symlink(t,r,n){const[i,a]=at(n);this.promises.symlink(t,r).then(i).catch(a)}backFile(t,r,n){const[i,a]=at(r,n);this.promises.backFile(t,r).then(i).catch(a)}du(t,r){const[n,i]=at(r);this.promises.du(t).then(n).catch(i)}flush(t){const[r,n]=at(t);this.promises.flush().then(r).catch(n)}};const up=St(lp);var Ja={},Ti={};Ti.byteLength=hp,Ti.toByteArray=mp,Ti.fromByteArray=yp;for(var At=[],yt=[],fp=typeof Uint8Array<"u"?Uint8Array:Array,Qa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=0,dp=Qa.length;Ur<dp;++Ur)At[Ur]=Qa[Ur],yt[Qa.charCodeAt(Ur)]=Ur;yt[45]=62,yt[95]=63;function kc(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function hp(e){var t=kc(e),r=t[0],n=t[1];return(r+n)*3/4-n}function pp(e,t,r){return(t+r)*3/4-r}function mp(e){var t,r=kc(e),n=r[0],i=r[1],a=new fp(pp(e,n,i)),o=0,s=i>0?n-4:n,l;for(l=0;l<s;l+=4)t=yt[e.charCodeAt(l)]<<18|yt[e.charCodeAt(l+1)]<<12|yt[e.charCodeAt(l+2)]<<6|yt[e.charCodeAt(l+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=yt[e.charCodeAt(l)]<<2|yt[e.charCodeAt(l+1)]>>4,a[o++]=t&255),i===1&&(t=yt[e.charCodeAt(l)]<<10|yt[e.charCodeAt(l+1)]<<4|yt[e.charCodeAt(l+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function wp(e){return At[e>>18&63]+At[e>>12&63]+At[e>>6&63]+At[e&63]}function gp(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(wp(n));return i.join("")}function yp(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(gp(e,o,o+a>s?s:o+a));return n===1?(t=e[r-1],i.push(At[t>>2]+At[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(At[t>>10]+At[t>>4&63]+At[t<<2&63]+"=")),i.join("")}var eo={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */eo.read=function(e,t,r,n,i){var a,o,s=i*8-n-1,l=(1<<s)-1,c=l>>1,u=-7,d=r?i-1:0,p=r?-1:1,m=e[t+d];for(d+=p,a=m&(1<<-u)-1,m>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=p,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=o*256+e[t+d],d+=p,u-=8);if(a===0)a=1-c;else{if(a===l)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-c}return(m?-1:1)*o*Math.pow(2,a-n)},eo.write=function(e,t,r,n,i,a){var o,s,l,c=a*8-i-1,u=(1<<c)-1,d=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:a-1,g=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=p/l:t+=p*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o=o+d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+m]=s&255,m+=g,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+m]=o&255,m+=g,o/=256,c-=8);e[r+m-g]|=v*128};/*!
4
+ `),a=this._makeRoot(),o=[{indent:-1,node:a},{indent:0,node:null}];for(let s of i){let c=s.match(/^\t*/)[0].length;s=s.slice(c);let[u,...d]=s.split(" "),p=n(d);if(c<=o[o.length-1].indent)for(;c<=o[o.length-1].indent;)o.pop();o.push({indent:c,node:p}),o[o.length-2].node.set(u,p)}return a}_lookup(t,r=!0){let n=this._root,i="/",a=et.split(t);for(let o=0;o<a.length;++o){let s=a[o];if(n=n.get(s),!n)throw new Ah(t);if(r||o<a.length-1){const l=n.get(Ze);if(l.type==="symlink"){let c=et.resolve(i,l.target);n=this._lookup(c)}i?i=et.join(i,s):i=s}}return n}mkdir(t,{mode:r}){if(t==="/")throw new bc;let n=this._lookup(et.dirname(t)),i=et.basename(t);if(n.has(i))throw new bc;let a=new Map,o={mode:r,type:"dir",size:0,mtimeMs:Date.now(),ino:this.autoinc()};a.set(Ze,o),n.set(i,a)}rmdir(t){let r=this._lookup(t);if(r.get(Ze).type!=="dir")throw new _c;if(r.size>1)throw new Dh;let n=this._lookup(et.dirname(t)),i=et.basename(t);n.delete(i)}readdir(t){let r=this._lookup(t);if(r.get(Ze).type!=="dir")throw new _c;return[...r.keys()].filter(n=>typeof n=="string")}writeStat(t,r,{mode:n}){let i;try{let c=this.stat(t);n==null&&(n=c.mode),i=c.ino}catch{}n==null&&(n=438),i==null&&(i=this.autoinc());let a=this._lookup(et.dirname(t)),o=et.basename(t),s={mode:n,type:"file",size:r,mtimeMs:Date.now(),ino:i},l=new Map;return l.set(Ze,s),a.set(o,l),s}unlink(t){let r=this._lookup(et.dirname(t)),n=et.basename(t);r.delete(n)}rename(t,r){let n=et.basename(r),i=this._lookup(t);this._lookup(et.dirname(r)).set(n,i),this.unlink(t)}stat(t){return this._lookup(t).get(Ze)}lstat(t){return this._lookup(t,!1).get(Ze)}readlink(t){return this._lookup(t,!1).get(Ze).target}symlink(t,r){let n,i;try{let c=this.stat(r);i===null&&(i=c.mode),n=c.ino}catch{}i==null&&(i=40960),n==null&&(n=this.autoinc());let a=this._lookup(et.dirname(r)),o=et.basename(r),s={mode:i,type:"symlink",target:t,size:0,mtimeMs:Date.now(),ino:n},l=new Map;return l.set(Ze,s),a.set(o,l),s}_du(t){let r=0;for(const[n,i]of t.entries())n===Ze?r+=i.size:r+=this._du(i);return r}du(t){let r=this._lookup(t);return this._du(r)}};class vc{constructor(t="keyval-store",r="keyval"){this.storeName=r,this._dbName=t,this._storeName=r,this._init()}_init(){this._dbp||(this._dbp=new Promise((t,r)=>{const n=indexedDB.open(this._dbName);n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result),n.onupgradeneeded=()=>{n.result.createObjectStore(this._storeName)}}))}_withIDBStore(t,r){return this._init(),this._dbp.then(n=>new Promise((i,a)=>{const o=n.transaction(this.storeName,t);o.oncomplete=()=>i(),o.onabort=o.onerror=()=>a(o.error),r(o.objectStore(this.storeName))}))}_close(){return this._init(),this._dbp.then(t=>{t.close(),this._dbp=void 0})}}let Ka;function vr(){return Ka||(Ka=new vc),Ka}function Ih(e,t=vr()){let r;return t._withIDBStore("readwrite",n=>{r=n.get(e)}).then(()=>r.result)}function jh(e,t,r=vr()){return r._withIDBStore("readwrite",n=>{n.put(t,e)})}function Bh(e,t,r=vr()){return r._withIDBStore("readwrite",n=>{const i=n.get(e);i.onsuccess=()=>{n.put(t(i.result),e)}})}function zh(e,t=vr()){return t._withIDBStore("readwrite",r=>{r.delete(e)})}function Nh(e=vr()){return e._withIDBStore("readwrite",t=>{t.clear()})}function Mh(e=vr()){const t=[];return e._withIDBStore("readwrite",r=>{(r.openKeyCursor||r.openCursor).call(r).onsuccess=function(){this.result&&(t.push(this.result.key),this.result.continue())}}).then(()=>t)}function Lh(e=vr()){return e._close()}const xc=Za(Object.freeze(Object.defineProperty({__proto__:null,Store:vc,clear:Nh,close:Lh,del:zh,get:Ih,keys:Mh,set:jh,update:Bh},Symbol.toStringTag,{value:"Module"}))),tr=xc;var Fh=class{constructor(t,r){this._database=t,this._storename=r,this._store=new tr.Store(this._database,this._storename)}saveSuperblock(t){return tr.set("!root",t,this._store)}loadSuperblock(){return tr.get("!root",this._store)}readFile(t){return tr.get(t,this._store)}writeFile(t,r){return tr.set(t,r,this._store)}unlink(t){return tr.del(t,this._store)}wipe(){return tr.clear(this._store)}close(){return tr.close(this._store)}},Uh=class{constructor(t){this._url=t}loadSuperblock(){return fetch(this._url+"/.superblock.txt").then(t=>t.ok?t.text():null)}async readFile(t){const r=await fetch(this._url+t);if(r.status===200)return r.arrayBuffer();throw new Error("ENOENT")}async sizeFile(t){const r=await fetch(this._url+t,{method:"HEAD"});if(r.status===200)return r.headers.get("content-length");throw new Error("ENOENT")}};const Cn=xc,Hh=e=>new Promise(t=>setTimeout(t,e));var Wh=class{constructor(t,r){this._id=Math.random(),this._database=t,this._storename=r,this._store=new Cn.Store(this._database,this._storename),this._lock=null}async has({margin:t=2e3}={}){if(this._lock&&this._lock.holder===this._id){const r=Date.now();return this._lock.expires>r+t?!0:await this.renew()}else return!1}async renew({ttl:t=5e3}={}){let r;return await Cn.update("lock",n=>{const a=Date.now()+t;return r=n&&n.holder===this._id,this._lock=r?{holder:this._id,expires:a}:n,this._lock},this._store),r}async acquire({ttl:t=5e3}={}){let r,n,i;if(await Cn.update("lock",a=>{const o=Date.now(),s=o+t;return n=a&&a.expires<o,r=a===void 0||n,i=a&&a.holder===this._id,this._lock=r?{holder:this._id,expires:s}:a,this._lock},this._store),i)throw new Error("Mutex double-locked");return r}async wait({interval:t=100,limit:r=6e3,ttl:n}={}){for(;r--;){if(await this.acquire({ttl:n}))return!0;await Hh(t)}throw new Error("Mutex timeout")}async release({force:t=!1}={}){let r,n,i;if(await Cn.update("lock",a=>(r=t||a&&a.holder===this._id,n=a===void 0,i=a&&a.holder!==this._id,this._lock=r?void 0:a,this._lock),this._store),await Cn.close(this._store),!r&&!t){if(n)throw new Error("Mutex double-freed");if(i)throw new Error("Mutex lost ownership")}return r}},qh=class{constructor(t){this._id=Math.random(),this._database=t,this._has=!1,this._release=null}async has(){return this._has}async acquire(){return new Promise(t=>{navigator.locks.request(this._database+"_lock",{ifAvailable:!0},r=>(this._has=!!r,t(!!r),new Promise(n=>{this._release=n})))})}async wait({timeout:t=6e5}={}){return new Promise((r,n)=>{const i=new AbortController;setTimeout(()=>{i.abort(),n(new Error("Mutex timeout"))},t),navigator.locks.request(this._database+"_lock",{signal:i.signal},a=>(this._has=!!a,r(!!a),new Promise(o=>{this._release=o})))})}async release({force:t=!1}={}){this._has=!1,this._release?this._release():t&&navigator.locks.request(this._database+"_lock",{steal:!0},r=>!0)}};const{encode:Gh,decode:Ec}=bh,Yh=_h,Zh=$h,{ENOENT:Xh,ENOTEMPTY:Vh,ETIMEDOUT:Kh}=yc,Jh=Fh,Qh=Uh,ep=Wh,tp=qh,Pn=Va;var rp=class{constructor(){this.saveSuperblock=Yh(()=>{this.flush()},500)}async init(t,{wipe:r,url:n,urlauto:i,fileDbName:a=t,db:o=null,fileStoreName:s=t+"_files",lockDbName:l=t+"_lock",lockStoreName:c=t+"_lock"}={}){this._name=t,this._idb=o||new Jh(a,s),this._mutex=navigator.locks?new tp(t):new ep(l,c),this._cache=new Zh(t),this._opts={wipe:r,url:n},this._needsWipe=!!r,n&&(this._http=new Qh(n),this._urlauto=!!i)}async activate(){if(this._cache.activated)return;this._needsWipe&&(this._needsWipe=!1,await this._idb.wipe(),await this._mutex.release({force:!0})),await this._mutex.has()||await this._mutex.wait();const t=await this._idb.loadSuperblock();if(t)this._cache.activate(t);else if(this._http){const r=await this._http.loadSuperblock();this._cache.activate(r),await this._saveSuperblock()}else this._cache.activate();if(!await this._mutex.has())throw new Kh}async deactivate(){await this._mutex.has()&&await this._saveSuperblock(),this._cache.deactivate();try{await this._mutex.release()}catch(t){console.log(t)}await this._idb.close()}async _saveSuperblock(){this._cache.activated&&(this._lastSavedAt=Date.now(),await this._idb.saveSuperblock(this._cache._root))}_writeStat(t,r,n){let i=Pn.split(Pn.dirname(t)),a=i.shift();for(let o of i){a=Pn.join(a,o);try{this._cache.mkdir(a,{mode:511})}catch{}}return this._cache.writeStat(t,r,n)}async readFile(t,r){const{encoding:n}=r;if(n&&n!=="utf8")throw new Error('Only "utf8" encoding is supported in readFile');let i=null,a=null;try{a=this._cache.stat(t),i=await this._idb.readFile(a.ino)}catch(o){if(!this._urlauto)throw o}if(!i&&this._http){let o=this._cache.lstat(t);for(;o.type==="symlink";)t=Pn.resolve(Pn.dirname(t),o.target),o=this._cache.lstat(t);i=await this._http.readFile(t)}if(i&&((!a||a.size!=i.byteLength)&&(a=await this._writeStat(t,i.byteLength,{mode:a?a.mode:438}),this.saveSuperblock()),n==="utf8"?i=Ec(i):i.toString=()=>Ec(i)),!a)throw new Xh(t);return i}async writeFile(t,r,n){const{mode:i,encoding:a="utf8"}=n;if(typeof r=="string"){if(a!=="utf8")throw new Error('Only "utf8" encoding is supported in writeFile');r=Gh(r)}const o=await this._cache.writeStat(t,r.byteLength,{mode:i});await this._idb.writeFile(o.ino,r)}async unlink(t,r){const n=this._cache.lstat(t);this._cache.unlink(t),n.type!=="symlink"&&await this._idb.unlink(n.ino)}readdir(t,r){return this._cache.readdir(t)}mkdir(t,r){const{mode:n=511}=r;this._cache.mkdir(t,{mode:n})}rmdir(t,r){if(t==="/")throw new Vh;this._cache.rmdir(t)}rename(t,r){this._cache.rename(t,r)}stat(t,r){return this._cache.stat(t)}lstat(t,r){return this._cache.lstat(t)}readlink(t,r){return this._cache.readlink(t)}symlink(t,r){this._cache.symlink(t,r)}async backFile(t,r){let n=await this._http.sizeFile(t);await this._writeStat(t,n,r)}du(t){return this._cache.du(t)}flush(){return this._saveSuperblock()}},np=class{constructor(t){this.type=t.type,this.mode=t.mode,this.size=t.size,this.ino=t.ino,this.mtimeMs=t.mtimeMs,this.ctimeMs=t.ctimeMs||t.mtimeMs,this.uid=1,this.gid=1,this.dev=1}isFile(){return this.type==="file"}isDirectory(){return this.type==="dir"}isSymbolicLink(){return this.type==="symlink"}};const ip=rp,Sc=np,Pi=Va;function Tt(e,t,...r){return e=Pi.normalize(e),(typeof t>"u"||typeof t=="function")&&(t={}),typeof t=="string"&&(t={encoding:t}),[e,t,...r]}function ap(e,t,r,...n){return e=Pi.normalize(e),(typeof r>"u"||typeof r=="function")&&(r={}),typeof r=="string"&&(r={encoding:r}),[e,t,r,...n]}function kc(e,t,...r){return[Pi.normalize(e),Pi.normalize(t),...r]}var op=class{constructor(t,r={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,Tt,!1),this.writeFile=this._wrap(this.writeFile,ap,!0),this.unlink=this._wrap(this.unlink,Tt,!0),this.readdir=this._wrap(this.readdir,Tt,!1),this.mkdir=this._wrap(this.mkdir,Tt,!0),this.rmdir=this._wrap(this.rmdir,Tt,!0),this.rename=this._wrap(this.rename,kc,!0),this.stat=this._wrap(this.stat,Tt,!1),this.lstat=this._wrap(this.lstat,Tt,!1),this.readlink=this._wrap(this.readlink,Tt,!1),this.symlink=this._wrap(this.symlink,kc,!0),this.backFile=this._wrap(this.backFile,Tt,!0),this.du=this._wrap(this.du,Tt,!1),this._deactivationPromise=null,this._deactivationTimeout=null,this._activationPromise=null,this._operations=new Set,t&&this.init(t,r)}async init(...t){return this._initPromiseResolve&&await this._initPromise,this._initPromise=this._init(...t),this._initPromise}async _init(t,r={}){await this._gracefulShutdown(),this._activationPromise&&await this._deactivate(),this._backend&&this._backend.destroy&&await this._backend.destroy(),this._backend=r.backend||new ip,this._backend.init&&await this._backend.init(t,r),this._initPromiseResolve&&(this._initPromiseResolve(),this._initPromiseResolve=null),r.defer||this.stat("/")}async _gracefulShutdown(){this._operations.size>0&&(this._isShuttingDown=!0,await new Promise(t=>this._gracefulShutdownResolve=t),this._isShuttingDown=!1,this._gracefulShutdownResolve=null)}_wrap(t,r,n){return async(...i)=>{i=r(...i);let a={name:t.name,args:i};this._operations.add(a);try{return await this._activate(),await t.apply(this,i)}finally{this._operations.delete(a),n&&this._backend.saveSuperblock(),this._operations.size===0&&(this._deactivationTimeout||clearTimeout(this._deactivationTimeout),this._deactivationTimeout=setTimeout(this._deactivate.bind(this),500))}}}async _activate(){this._initPromise||console.warn(new Error(`Attempted to use LightningFS ${this._name} before it was initialized.`)),await this._initPromise,this._deactivationTimeout&&(clearTimeout(this._deactivationTimeout),this._deactivationTimeout=null),this._deactivationPromise&&await this._deactivationPromise,this._deactivationPromise=null,this._activationPromise||(this._activationPromise=this._backend.activate?this._backend.activate():Promise.resolve()),await this._activationPromise}async _deactivate(){return this._activationPromise&&await this._activationPromise,this._deactivationPromise||(this._deactivationPromise=this._backend.deactivate?this._backend.deactivate():Promise.resolve()),this._activationPromise=null,this._gracefulShutdownResolve&&this._gracefulShutdownResolve(),this._deactivationPromise}async readFile(t,r){return this._backend.readFile(t,r)}async writeFile(t,r,n){return await this._backend.writeFile(t,r,n),null}async unlink(t,r){return await this._backend.unlink(t,r),null}async readdir(t,r){return this._backend.readdir(t,r)}async mkdir(t,r){return await this._backend.mkdir(t,r),null}async rmdir(t,r){return await this._backend.rmdir(t,r),null}async rename(t,r){return await this._backend.rename(t,r),null}async stat(t,r){const n=await this._backend.stat(t,r);return new Sc(n)}async lstat(t,r){const n=await this._backend.lstat(t,r);return new Sc(n)}async readlink(t,r){return this._backend.readlink(t,r)}async symlink(t,r){return await this._backend.symlink(t,r),null}async backFile(t,r){return await this._backend.backFile(t,r),null}async du(t){return this._backend.du(t)}async flush(){return this._backend.flush()}};const sp=gh,cp=op;function ot(e,t){return typeof e=="function"&&(t=e),t=sp(t),[(...n)=>t(null,...n),t]}var lp=class{constructor(...t){this.promises=new cp(...t),this.init=this.init.bind(this),this.readFile=this.readFile.bind(this),this.writeFile=this.writeFile.bind(this),this.unlink=this.unlink.bind(this),this.readdir=this.readdir.bind(this),this.mkdir=this.mkdir.bind(this),this.rmdir=this.rmdir.bind(this),this.rename=this.rename.bind(this),this.stat=this.stat.bind(this),this.lstat=this.lstat.bind(this),this.readlink=this.readlink.bind(this),this.symlink=this.symlink.bind(this),this.backFile=this.backFile.bind(this),this.du=this.du.bind(this),this.flush=this.flush.bind(this)}init(t,r){return this.promises.init(t,r)}readFile(t,r,n){const[i,a]=ot(r,n);this.promises.readFile(t,r).then(i).catch(a)}writeFile(t,r,n,i){const[a,o]=ot(n,i);this.promises.writeFile(t,r,n).then(a).catch(o)}unlink(t,r,n){const[i,a]=ot(r,n);this.promises.unlink(t,r).then(i).catch(a)}readdir(t,r,n){const[i,a]=ot(r,n);this.promises.readdir(t,r).then(i).catch(a)}mkdir(t,r,n){const[i,a]=ot(r,n);this.promises.mkdir(t,r).then(i).catch(a)}rmdir(t,r,n){const[i,a]=ot(r,n);this.promises.rmdir(t,r).then(i).catch(a)}rename(t,r,n){const[i,a]=ot(n);this.promises.rename(t,r).then(i).catch(a)}stat(t,r,n){const[i,a]=ot(r,n);this.promises.stat(t).then(i).catch(a)}lstat(t,r,n){const[i,a]=ot(r,n);this.promises.lstat(t).then(i).catch(a)}readlink(t,r,n){const[i,a]=ot(r,n);this.promises.readlink(t).then(i).catch(a)}symlink(t,r,n){const[i,a]=ot(n);this.promises.symlink(t,r).then(i).catch(a)}backFile(t,r,n){const[i,a]=ot(r,n);this.promises.backFile(t,r).then(i).catch(a)}du(t,r){const[n,i]=ot(r);this.promises.du(t).then(n).catch(i)}flush(t){const[r,n]=ot(t);this.promises.flush().then(r).catch(n)}};const up=St(lp);var Ja={},Ti={};Ti.byteLength=hp,Ti.toByteArray=mp,Ti.fromByteArray=yp;for(var At=[],yt=[],fp=typeof Uint8Array<"u"?Uint8Array:Array,Qa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=0,dp=Qa.length;Ur<dp;++Ur)At[Ur]=Qa[Ur],yt[Qa.charCodeAt(Ur)]=Ur;yt[45]=62,yt[95]=63;function Rc(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function hp(e){var t=Rc(e),r=t[0],n=t[1];return(r+n)*3/4-n}function pp(e,t,r){return(t+r)*3/4-r}function mp(e){var t,r=Rc(e),n=r[0],i=r[1],a=new fp(pp(e,n,i)),o=0,s=i>0?n-4:n,l;for(l=0;l<s;l+=4)t=yt[e.charCodeAt(l)]<<18|yt[e.charCodeAt(l+1)]<<12|yt[e.charCodeAt(l+2)]<<6|yt[e.charCodeAt(l+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=yt[e.charCodeAt(l)]<<2|yt[e.charCodeAt(l+1)]>>4,a[o++]=t&255),i===1&&(t=yt[e.charCodeAt(l)]<<10|yt[e.charCodeAt(l+1)]<<4|yt[e.charCodeAt(l+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function wp(e){return At[e>>18&63]+At[e>>12&63]+At[e>>6&63]+At[e&63]}function gp(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(wp(n));return i.join("")}function yp(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(gp(e,o,o+a>s?s:o+a));return n===1?(t=e[r-1],i.push(At[t>>2]+At[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(At[t>>10]+At[t>>4&63]+At[t<<2&63]+"=")),i.join("")}var eo={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */eo.read=function(e,t,r,n,i){var a,o,s=i*8-n-1,l=(1<<s)-1,c=l>>1,u=-7,d=r?i-1:0,p=r?-1:1,m=e[t+d];for(d+=p,a=m&(1<<-u)-1,m>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=p,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=o*256+e[t+d],d+=p,u-=8);if(a===0)a=1-c;else{if(a===l)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-c}return(m?-1:1)*o*Math.pow(2,a-n)},eo.write=function(e,t,r,n,i,a){var o,s,l,c=a*8-i-1,u=(1<<c)-1,d=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:a-1,g=n?1:-1,b=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=p/l:t+=p*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o=o+d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+m]=s&255,m+=g,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+m]=o&255,m+=g,o/=256,c-=8);e[r+m-g]|=b*128};/*!
5
5
  * The buffer module from node.js, for the browser.
6
6
  *
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
- */(function(e){const t=Ti,r=eo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=_,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&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 a(){try{const w=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(w,f),w.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(w){if(w>i)throw new RangeError('The value "'+w+'" is invalid for option "size"');const f=new Uint8Array(w);return Object.setPrototypeOf(f,s.prototype),f}function s(w,f,h){if(typeof w=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(w)}return l(w,f,h)}s.poolSize=8192;function l(w,f,h){if(typeof w=="string")return p(w,f);if(ArrayBuffer.isView(w))return g(w);if(w==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof w);if(Ue(w,ArrayBuffer)||w&&Ue(w.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ue(w,SharedArrayBuffer)||w&&Ue(w.buffer,SharedArrayBuffer)))return v(w,f,h);if(typeof w=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const E=w.valueOf&&w.valueOf();if(E!=null&&E!==w)return s.from(E,f,h);const T=x(w);if(T)return T;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof w[Symbol.toPrimitive]=="function")return s.from(w[Symbol.toPrimitive]("string"),f,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof w)}s.from=function(w,f,h){return l(w,f,h)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(w){if(typeof w!="number")throw new TypeError('"size" argument must be of type number');if(w<0)throw new RangeError('The value "'+w+'" is invalid for option "size"')}function u(w,f,h){return c(w),w<=0?o(w):f!==void 0?typeof h=="string"?o(w).fill(f,h):o(w).fill(f):o(w)}s.alloc=function(w,f,h){return u(w,f,h)};function d(w){return c(w),o(w<0?0:b(w)|0)}s.allocUnsafe=function(w){return d(w)},s.allocUnsafeSlow=function(w){return d(w)};function p(w,f){if((typeof f!="string"||f==="")&&(f="utf8"),!s.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const h=k(w,f)|0;let E=o(h);const T=E.write(w,f);return T!==h&&(E=E.slice(0,T)),E}function m(w){const f=w.length<0?0:b(w.length)|0,h=o(f);for(let E=0;E<f;E+=1)h[E]=w[E]&255;return h}function g(w){if(Ue(w,Uint8Array)){const f=new Uint8Array(w);return v(f.buffer,f.byteOffset,f.byteLength)}return m(w)}function v(w,f,h){if(f<0||w.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(w.byteLength<f+(h||0))throw new RangeError('"length" is outside of buffer bounds');let E;return f===void 0&&h===void 0?E=new Uint8Array(w):h===void 0?E=new Uint8Array(w,f):E=new Uint8Array(w,f,h),Object.setPrototypeOf(E,s.prototype),E}function x(w){if(s.isBuffer(w)){const f=b(w.length)|0,h=o(f);return h.length===0||w.copy(h,0,0,f),h}if(w.length!==void 0)return typeof w.length!="number"||Pe(w.length)?o(0):m(w);if(w.type==="Buffer"&&Array.isArray(w.data))return m(w.data)}function b(w){if(w>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return w|0}function _(w){return+w!=w&&(w=0),s.alloc(+w)}s.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==s.prototype},s.compare=function(f,h){if(Ue(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),Ue(h,Uint8Array)&&(h=s.from(h,h.offset,h.byteLength)),!s.isBuffer(f)||!s.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===h)return 0;let E=f.length,T=h.length;for(let B=0,z=Math.min(E,T);B<z;++B)if(f[B]!==h[B]){E=f[B],T=h[B];break}return E<T?-1:T<E?1:0},s.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(f,h){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return s.alloc(0);let E;if(h===void 0)for(h=0,E=0;E<f.length;++E)h+=f[E].length;const T=s.allocUnsafe(h);let B=0;for(E=0;E<f.length;++E){let z=f[E];if(Ue(z,Uint8Array))B+z.length>T.length?(s.isBuffer(z)||(z=s.from(z)),z.copy(T,B)):Uint8Array.prototype.set.call(T,z,B);else if(s.isBuffer(z))z.copy(T,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=z.length}return T};function k(w,f){if(s.isBuffer(w))return w.length;if(ArrayBuffer.isView(w)||Ue(w,ArrayBuffer))return w.byteLength;if(typeof w!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof w);const h=w.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&h===0)return 0;let T=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return ne(w).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return xe(w).length;default:if(T)return E?-1:ne(w).length;f=(""+f).toLowerCase(),T=!0}}s.byteLength=k;function S(w,f,h){let E=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,f>>>=0,h<=f))return"";for(w||(w="utf8");;)switch(w){case"hex":return Je(this,f,h);case"utf8":case"utf-8":return Z(this,f,h);case"ascii":return ge(this,f,h);case"latin1":case"binary":return _e(this,f,h);case"base64":return U(this,f,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qe(this,f,h);default:if(E)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),E=!0}}s.prototype._isBuffer=!0;function y(w,f,h){const E=w[f];w[f]=w[h],w[h]=E}s.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let h=0;h<f;h+=2)y(this,h,h+1);return this},s.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let h=0;h<f;h+=4)y(this,h,h+3),y(this,h+1,h+2);return this},s.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let h=0;h<f;h+=8)y(this,h,h+7),y(this,h+1,h+6),y(this,h+2,h+5),y(this,h+3,h+4);return this},s.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?Z(this,0,f):S.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(f){if(!s.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:s.compare(this,f)===0},s.prototype.inspect=function(){let f="";const h=e.INSPECT_MAX_BYTES;return f=this.toString("hex",0,h).replace(/(.{2})/g,"$1 ").trim(),this.length>h&&(f+=" ... "),"<Buffer "+f+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(f,h,E,T,B){if(Ue(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(h===void 0&&(h=0),E===void 0&&(E=f?f.length:0),T===void 0&&(T=0),B===void 0&&(B=this.length),h<0||E>f.length||T<0||B>this.length)throw new RangeError("out of range index");if(T>=B&&h>=E)return 0;if(T>=B)return-1;if(h>=E)return 1;if(h>>>=0,E>>>=0,T>>>=0,B>>>=0,this===f)return 0;let z=B-T,pe=E-h;const je=Math.min(z,pe),Ie=this.slice(T,B),ze=f.slice(h,E);for(let Ce=0;Ce<je;++Ce)if(Ie[Ce]!==ze[Ce]){z=Ie[Ce],pe=ze[Ce];break}return z<pe?-1:pe<z?1:0};function C(w,f,h,E,T){if(w.length===0)return-1;if(typeof h=="string"?(E=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Pe(h)&&(h=T?0:w.length-1),h<0&&(h=w.length+h),h>=w.length){if(T)return-1;h=w.length-1}else if(h<0)if(T)h=0;else return-1;if(typeof f=="string"&&(f=s.from(f,E)),s.isBuffer(f))return f.length===0?-1:O(w,f,h,E,T);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?T?Uint8Array.prototype.indexOf.call(w,f,h):Uint8Array.prototype.lastIndexOf.call(w,f,h):O(w,[f],h,E,T);throw new TypeError("val must be string, number or Buffer")}function O(w,f,h,E,T){let B=1,z=w.length,pe=f.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(w.length<2||f.length<2)return-1;B=2,z/=2,pe/=2,h/=2}function je(ze,Ce){return B===1?ze[Ce]:ze.readUInt16BE(Ce*B)}let Ie;if(T){let ze=-1;for(Ie=h;Ie<z;Ie++)if(je(w,Ie)===je(f,ze===-1?0:Ie-ze)){if(ze===-1&&(ze=Ie),Ie-ze+1===pe)return ze*B}else ze!==-1&&(Ie-=Ie-ze),ze=-1}else for(h+pe>z&&(h=z-pe),Ie=h;Ie>=0;Ie--){let ze=!0;for(let Ce=0;Ce<pe;Ce++)if(je(w,Ie+Ce)!==je(f,Ce)){ze=!1;break}if(ze)return Ie}return-1}s.prototype.includes=function(f,h,E){return this.indexOf(f,h,E)!==-1},s.prototype.indexOf=function(f,h,E){return C(this,f,h,E,!0)},s.prototype.lastIndexOf=function(f,h,E){return C(this,f,h,E,!1)};function R(w,f,h,E){h=Number(h)||0;const T=w.length-h;E?(E=Number(E),E>T&&(E=T)):E=T;const B=f.length;E>B/2&&(E=B/2);let z;for(z=0;z<E;++z){const pe=parseInt(f.substr(z*2,2),16);if(Pe(pe))return z;w[h+z]=pe}return z}function A(w,f,h,E){return Et(ne(f,w.length-h),w,h,E)}function D(w,f,h,E){return Et(ie(f),w,h,E)}function j(w,f,h,E){return Et(xe(f),w,h,E)}function M(w,f,h,E){return Et(ke(f,w.length-h),w,h,E)}s.prototype.write=function(f,h,E,T){if(h===void 0)T="utf8",E=this.length,h=0;else if(E===void 0&&typeof h=="string")T=h,E=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(E)?(E=E>>>0,T===void 0&&(T="utf8")):(T=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const B=this.length-h;if((E===void 0||E>B)&&(E=B),f.length>0&&(E<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let z=!1;for(;;)switch(T){case"hex":return R(this,f,h,E);case"utf8":case"utf-8":return A(this,f,h,E);case"ascii":case"latin1":case"binary":return D(this,f,h,E);case"base64":return j(this,f,h,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,f,h,E);default:if(z)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),z=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function U(w,f,h){return f===0&&h===w.length?t.fromByteArray(w):t.fromByteArray(w.slice(f,h))}function Z(w,f,h){h=Math.min(w.length,h);const E=[];let T=f;for(;T<h;){const B=w[T];let z=null,pe=B>239?4:B>223?3:B>191?2:1;if(T+pe<=h){let je,Ie,ze,Ce;switch(pe){case 1:B<128&&(z=B);break;case 2:je=w[T+1],(je&192)===128&&(Ce=(B&31)<<6|je&63,Ce>127&&(z=Ce));break;case 3:je=w[T+1],Ie=w[T+2],(je&192)===128&&(Ie&192)===128&&(Ce=(B&15)<<12|(je&63)<<6|Ie&63,Ce>2047&&(Ce<55296||Ce>57343)&&(z=Ce));break;case 4:je=w[T+1],Ie=w[T+2],ze=w[T+3],(je&192)===128&&(Ie&192)===128&&(ze&192)===128&&(Ce=(B&15)<<18|(je&63)<<12|(Ie&63)<<6|ze&63,Ce>65535&&Ce<1114112&&(z=Ce))}}z===null?(z=65533,pe=1):z>65535&&(z-=65536,E.push(z>>>10&1023|55296),z=56320|z&1023),E.push(z),T+=pe}return $e(E)}const de=4096;function $e(w){const f=w.length;if(f<=de)return String.fromCharCode.apply(String,w);let h="",E=0;for(;E<f;)h+=String.fromCharCode.apply(String,w.slice(E,E+=de));return h}function ge(w,f,h){let E="";h=Math.min(w.length,h);for(let T=f;T<h;++T)E+=String.fromCharCode(w[T]&127);return E}function _e(w,f,h){let E="";h=Math.min(w.length,h);for(let T=f;T<h;++T)E+=String.fromCharCode(w[T]);return E}function Je(w,f,h){const E=w.length;(!f||f<0)&&(f=0),(!h||h<0||h>E)&&(h=E);let T="";for(let B=f;B<h;++B)T+=oe[w[B]];return T}function Qe(w,f,h){const E=w.slice(f,h);let T="";for(let B=0;B<E.length-1;B+=2)T+=String.fromCharCode(E[B]+E[B+1]*256);return T}s.prototype.slice=function(f,h){const E=this.length;f=~~f,h=h===void 0?E:~~h,f<0?(f+=E,f<0&&(f=0)):f>E&&(f=E),h<0?(h+=E,h<0&&(h=0)):h>E&&(h=E),h<f&&(h=f);const T=this.subarray(f,h);return Object.setPrototypeOf(T,s.prototype),T};function fe(w,f,h){if(w%1!==0||w<0)throw new RangeError("offset is not uint");if(w+f>h)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=this[f],B=1,z=0;for(;++z<h&&(B*=256);)T+=this[f+z]*B;return T},s.prototype.readUintBE=s.prototype.readUIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=this[f+--h],B=1;for(;h>0&&(B*=256);)T+=this[f+--h]*B;return T},s.prototype.readUint8=s.prototype.readUInt8=function(f,h){return f=f>>>0,h||fe(f,1,this.length),this[f]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(f,h){return f=f>>>0,h||fe(f,2,this.length),this[f]|this[f+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(f,h){return f=f>>>0,h||fe(f,2,this.length),this[f]<<8|this[f+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},s.prototype.readBigUInt64LE=Ee(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&te(f,this.length-8);const T=h+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,B=this[++f]+this[++f]*2**8+this[++f]*2**16+E*2**24;return BigInt(T)+(BigInt(B)<<BigInt(32))}),s.prototype.readBigUInt64BE=Ee(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&te(f,this.length-8);const T=h*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],B=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+E;return(BigInt(T)<<BigInt(32))+BigInt(B)}),s.prototype.readIntLE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=this[f],B=1,z=0;for(;++z<h&&(B*=256);)T+=this[f+z]*B;return B*=128,T>=B&&(T-=Math.pow(2,8*h)),T},s.prototype.readIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=h,B=1,z=this[f+--T];for(;T>0&&(B*=256);)z+=this[f+--T]*B;return B*=128,z>=B&&(z-=Math.pow(2,8*h)),z},s.prototype.readInt8=function(f,h){return f=f>>>0,h||fe(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},s.prototype.readInt16LE=function(f,h){f=f>>>0,h||fe(f,2,this.length);const E=this[f]|this[f+1]<<8;return E&32768?E|4294901760:E},s.prototype.readInt16BE=function(f,h){f=f>>>0,h||fe(f,2,this.length);const E=this[f+1]|this[f]<<8;return E&32768?E|4294901760:E},s.prototype.readInt32LE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},s.prototype.readInt32BE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},s.prototype.readBigInt64LE=Ee(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&te(f,this.length-8);const T=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(E<<24);return(BigInt(T)<<BigInt(32))+BigInt(h+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),s.prototype.readBigInt64BE=Ee(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&te(f,this.length-8);const T=(h<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(T)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+E)}),s.prototype.readFloatLE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),r.read(this,f,!0,23,4)},s.prototype.readFloatBE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),r.read(this,f,!1,23,4)},s.prototype.readDoubleLE=function(f,h){return f=f>>>0,h||fe(f,8,this.length),r.read(this,f,!0,52,8)},s.prototype.readDoubleBE=function(f,h){return f=f>>>0,h||fe(f,8,this.length),r.read(this,f,!1,52,8)};function F(w,f,h,E,T,B){if(!s.isBuffer(w))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>T||f<B)throw new RangeError('"value" argument is out of bounds');if(h+E>w.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(f,h,E,T){if(f=+f,h=h>>>0,E=E>>>0,!T){const pe=Math.pow(2,8*E)-1;F(this,f,h,E,pe,0)}let B=1,z=0;for(this[h]=f&255;++z<E&&(B*=256);)this[h+z]=f/B&255;return h+E},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(f,h,E,T){if(f=+f,h=h>>>0,E=E>>>0,!T){const pe=Math.pow(2,8*E)-1;F(this,f,h,E,pe,0)}let B=E-1,z=1;for(this[h+B]=f&255;--B>=0&&(z*=256);)this[h+B]=f/z&255;return h+E},s.prototype.writeUint8=s.prototype.writeUInt8=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,1,255,0),this[h]=f&255,h+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,65535,0),this[h]=f&255,this[h+1]=f>>>8,h+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,65535,0),this[h]=f>>>8,this[h+1]=f&255,h+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,4294967295,0),this[h+3]=f>>>24,this[h+2]=f>>>16,this[h+1]=f>>>8,this[h]=f&255,h+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,4294967295,0),this[h]=f>>>24,this[h+1]=f>>>16,this[h+2]=f>>>8,this[h+3]=f&255,h+4};function q(w,f,h,E,T){L(f,E,T,w,h,7);let B=Number(f&BigInt(4294967295));w[h++]=B,B=B>>8,w[h++]=B,B=B>>8,w[h++]=B,B=B>>8,w[h++]=B;let z=Number(f>>BigInt(32)&BigInt(4294967295));return w[h++]=z,z=z>>8,w[h++]=z,z=z>>8,w[h++]=z,z=z>>8,w[h++]=z,h}function W(w,f,h,E,T){L(f,E,T,w,h,7);let B=Number(f&BigInt(4294967295));w[h+7]=B,B=B>>8,w[h+6]=B,B=B>>8,w[h+5]=B,B=B>>8,w[h+4]=B;let z=Number(f>>BigInt(32)&BigInt(4294967295));return w[h+3]=z,z=z>>8,w[h+2]=z,z=z>>8,w[h+1]=z,z=z>>8,w[h]=z,h+8}s.prototype.writeBigUInt64LE=Ee(function(f,h=0){return q(this,f,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Ee(function(f,h=0){return W(this,f,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(f,h,E,T){if(f=+f,h=h>>>0,!T){const je=Math.pow(2,8*E-1);F(this,f,h,E,je-1,-je)}let B=0,z=1,pe=0;for(this[h]=f&255;++B<E&&(z*=256);)f<0&&pe===0&&this[h+B-1]!==0&&(pe=1),this[h+B]=(f/z>>0)-pe&255;return h+E},s.prototype.writeIntBE=function(f,h,E,T){if(f=+f,h=h>>>0,!T){const je=Math.pow(2,8*E-1);F(this,f,h,E,je-1,-je)}let B=E-1,z=1,pe=0;for(this[h+B]=f&255;--B>=0&&(z*=256);)f<0&&pe===0&&this[h+B+1]!==0&&(pe=1),this[h+B]=(f/z>>0)-pe&255;return h+E},s.prototype.writeInt8=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,1,127,-128),f<0&&(f=255+f+1),this[h]=f&255,h+1},s.prototype.writeInt16LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,32767,-32768),this[h]=f&255,this[h+1]=f>>>8,h+2},s.prototype.writeInt16BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,32767,-32768),this[h]=f>>>8,this[h+1]=f&255,h+2},s.prototype.writeInt32LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,2147483647,-2147483648),this[h]=f&255,this[h+1]=f>>>8,this[h+2]=f>>>16,this[h+3]=f>>>24,h+4},s.prototype.writeInt32BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[h]=f>>>24,this[h+1]=f>>>16,this[h+2]=f>>>8,this[h+3]=f&255,h+4},s.prototype.writeBigInt64LE=Ee(function(f,h=0){return q(this,f,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Ee(function(f,h=0){return W(this,f,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ee(w,f,h,E,T,B){if(h+E>w.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}function I(w,f,h,E,T){return f=+f,h=h>>>0,T||ee(w,f,h,4),r.write(w,f,h,E,23,4),h+4}s.prototype.writeFloatLE=function(f,h,E){return I(this,f,h,!0,E)},s.prototype.writeFloatBE=function(f,h,E){return I(this,f,h,!1,E)};function Q(w,f,h,E,T){return f=+f,h=h>>>0,T||ee(w,f,h,8),r.write(w,f,h,E,52,8),h+8}s.prototype.writeDoubleLE=function(f,h,E){return Q(this,f,h,!0,E)},s.prototype.writeDoubleBE=function(f,h,E){return Q(this,f,h,!1,E)},s.prototype.copy=function(f,h,E,T){if(!s.isBuffer(f))throw new TypeError("argument should be a Buffer");if(E||(E=0),!T&&T!==0&&(T=this.length),h>=f.length&&(h=f.length),h||(h=0),T>0&&T<E&&(T=E),T===E||f.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),f.length-h<T-E&&(T=f.length-h+E);const B=T-E;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(h,E,T):Uint8Array.prototype.set.call(f,this.subarray(E,T),h),B},s.prototype.fill=function(f,h,E,T){if(typeof f=="string"){if(typeof h=="string"?(T=h,h=0,E=this.length):typeof E=="string"&&(T=E,E=this.length),T!==void 0&&typeof T!="string")throw new TypeError("encoding must be a string");if(typeof T=="string"&&!s.isEncoding(T))throw new TypeError("Unknown encoding: "+T);if(f.length===1){const z=f.charCodeAt(0);(T==="utf8"&&z<128||T==="latin1")&&(f=z)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(h<0||this.length<h||this.length<E)throw new RangeError("Out of range index");if(E<=h)return this;h=h>>>0,E=E===void 0?this.length:E>>>0,f||(f=0);let B;if(typeof f=="number")for(B=h;B<E;++B)this[B]=f;else{const z=s.isBuffer(f)?f:s.from(f,T),pe=z.length;if(pe===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<E-h;++B)this[B+h]=z[B%pe]}return this};const $={};function G(w,f,h){$[w]=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${w}]`,this.stack,delete this.name}get code(){return w}set code(T){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:T,writable:!0})}toString(){return`${this.name} [${w}]: ${this.message}`}}}G("ERR_BUFFER_OUT_OF_BOUNDS",function(w){return w?`${w} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(w,f){return`The "${w}" argument must be of type number. Received type ${typeof f}`},TypeError),G("ERR_OUT_OF_RANGE",function(w,f,h){let E=`The value of "${w}" is out of range.`,T=h;return Number.isInteger(h)&&Math.abs(h)>2**32?T=X(String(h)):typeof h=="bigint"&&(T=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(T=X(T)),T+="n"),E+=` It must be ${f}. Received ${T}`,E},RangeError);function X(w){let f="",h=w.length;const E=w[0]==="-"?1:0;for(;h>=E+4;h-=3)f=`_${w.slice(h-3,h)}${f}`;return`${w.slice(0,h)}${f}`}function Y(w,f,h){V(f,"offset"),(w[f]===void 0||w[f+h]===void 0)&&te(f,w.length-(h+1))}function L(w,f,h,E,T,B){if(w>h||w<f){const z=typeof f=="bigint"?"n":"";let pe;throw f===0||f===BigInt(0)?pe=`>= 0${z} and < 2${z} ** ${(B+1)*8}${z}`:pe=`>= -(2${z} ** ${(B+1)*8-1}${z}) and < 2 ** ${(B+1)*8-1}${z}`,new $.ERR_OUT_OF_RANGE("value",pe,w)}Y(E,T,B)}function V(w,f){if(typeof w!="number")throw new $.ERR_INVALID_ARG_TYPE(f,"number",w)}function te(w,f,h){throw Math.floor(w)!==w?(V(w,h),new $.ERR_OUT_OF_RANGE("offset","an integer",w)):f<0?new $.ERR_BUFFER_OUT_OF_BOUNDS:new $.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,w)}const J=/[^+/0-9A-Za-z-_]/g;function ce(w){if(w=w.split("=")[0],w=w.trim().replace(J,""),w.length<2)return"";for(;w.length%4!==0;)w=w+"=";return w}function ne(w,f){f=f||1/0;let h;const E=w.length;let T=null;const B=[];for(let z=0;z<E;++z){if(h=w.charCodeAt(z),h>55295&&h<57344){if(!T){if(h>56319){(f-=3)>-1&&B.push(239,191,189);continue}else if(z+1===E){(f-=3)>-1&&B.push(239,191,189);continue}T=h;continue}if(h<56320){(f-=3)>-1&&B.push(239,191,189),T=h;continue}h=(T-55296<<10|h-56320)+65536}else T&&(f-=3)>-1&&B.push(239,191,189);if(T=null,h<128){if((f-=1)<0)break;B.push(h)}else if(h<2048){if((f-=2)<0)break;B.push(h>>6|192,h&63|128)}else if(h<65536){if((f-=3)<0)break;B.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((f-=4)<0)break;B.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return B}function ie(w){const f=[];for(let h=0;h<w.length;++h)f.push(w.charCodeAt(h)&255);return f}function ke(w,f){let h,E,T;const B=[];for(let z=0;z<w.length&&!((f-=2)<0);++z)h=w.charCodeAt(z),E=h>>8,T=h%256,B.push(T),B.push(E);return B}function xe(w){return t.toByteArray(ce(w))}function Et(w,f,h,E){let T;for(T=0;T<E&&!(T+h>=f.length||T>=w.length);++T)f[T+h]=w[T];return T}function Ue(w,f){return w instanceof f||w!=null&&w.constructor!=null&&w.constructor.name!=null&&w.constructor.name===f.name}function Pe(w){return w!==w}const oe=function(){const w="0123456789abcdef",f=new Array(256);for(let h=0;h<16;++h){const E=h*16;for(let T=0;T<16;++T)f[E+T]=w[h]+w[T]}return f}();function Ee(w){return typeof BigInt>"u"?Oi:w}function Oi(){throw new Error("BigInt not supported")}})(Ja);function bp(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function vp(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:bp(e)}async function _p(e,t){const r=vp(e);for(;;){const{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function xp(e){let t=0;const r=[];await _p(e,a=>{r.push(a),t+=a.byteLength});const n=new Uint8Array(t);let i=0;for(const a of r)n.set(a,i),i+=a.byteLength;return n}function Ep(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}async function Sp({onProgress:e,url:t,method:r="GET",headers:n={},body:i}){i&&(i=await xp(i));const a=await fetch(t,{method:r,headers:n,body:i}),o=a.body&&a.body.getReader?Ep(a.body):[new Uint8Array(await a.arrayBuffer())];n={};for(const[s,l]of a.headers.entries())n[s]=l;return{url:a.url,method:a.method,statusCode:a.status,statusMessage:a.statusText,body:o,headers:n}}var to={request:Sp},ht=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||ht.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||ht.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||ht.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=ht.DEFAULT_MAX_PENDING};ht.DEFAULT_TIMEOUT=0,ht.DEFAULT_MAX_OCCUPATION_TIME=0,ht.DEFAULT_MAX_EXECUTION_TIME=0,ht.DEFAULT_MAX_PENDING=1e3,ht.prototype.acquire=function(e,t,r,n){if(Array.isArray(e))return this._acquireBatch(e,t,r,n);if(typeof t!="function")throw new Error("You must pass a function to execute");var i=null,a=null,o=null;typeof r!="function"&&(n=r,r=null,o=new this.Promise(function(_,k){i=_,a=k})),n=n||{};var s=!1,l=null,c=null,u=null,d=this,p=function(_,k,S){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),_&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||(o?k?a(k):i(S):typeof r=="function"&&r(k,S),s=!0),_&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},m=function(_){if(s)return p(_);l&&(clearTimeout(l),l=null),d.domainReentrant&&_&&(d.domains[e]=process.domain);var k=n.maxExecutionTime||d.maxExecutionTime;if(k&&(u=setTimeout(function(){d.queues[e]&&p(_,new Error("Maximum execution time is exceeded "+e))},k)),t.length===1){var S=!1;try{t(function(y,C){S||(S=!0,p(_,y,C))})}catch(y){S||(S=!0,p(_,y))}}else d._promiseTry(function(){return t()}).then(function(y){p(_,void 0,y)},function(y){p(_,y)})};d.domainReentrant&&process.domain&&(m=process.domain.bind(m));var g=n.maxPending||d.maxPending;if(!d.queues[e])d.queues[e]=[],m(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[e])m(!1);else if(d.queues[e].length>=g)p(!1,new Error("Too many pending tasks in queue "+e));else{var v=function(){m(!0)};n.skipQueue?d.queues[e].unshift(v):d.queues[e].push(v);var x=n.timeout||d.timeout;x&&(l=setTimeout(function(){l=null,p(!1,new Error("async-lock timed out in queue "+e))},x))}var b=n.maxOccupationTime||d.maxOccupationTime;if(b&&(c=setTimeout(function(){d.queues[e]&&p(!1,new Error("Maximum occupation time is exceeded in queue "+e))},b)),o)return o},ht.prototype._acquireBatch=function(e,t,r,n){typeof r!="function"&&(n=r,r=null);var i=this,a=function(s,l){return function(c){i.acquire(s,l,c,n)}},o=e.reduceRight(function(s,l){return a(l,s)},t);if(typeof r=="function")o(r);else return new this.Promise(function(s,l){o.length===1?o(function(c,u){c?l(c):s(u)}):s(o())})},ht.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},ht.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(t){return this.Promise.reject(t)}};var kp=ht,Rp=kp;const Tn=St(Rp);var ro={exports:{}};typeof Object.create=="function"?ro.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ro.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}};var Op=ro.exports,no={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var r=Ja,n=r.Buffer;function i(o,s){for(var l in o)s[l]=o[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a);function a(o,s,l){return n(o,s,l)}a.prototype=Object.create(n.prototype),i(n,a),a.from=function(o,s,l){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,s,l)},a.alloc=function(o,s,l){if(typeof o!="number")throw new TypeError("Argument must be a number");var c=n(o);return s!==void 0?typeof l=="string"?c.fill(s,l):c.fill(s):c.fill(0),c},a.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},a.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(no,no.exports);var Rc=no.exports,Oc=Rc.Buffer;function Ai(e,t){this._block=Oc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Ai.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=Oc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,a=this._len,o=0;o<i;){for(var s=a%n,l=Math.min(i-o,n-s),c=0;c<l;c++)r[s+c]=e[o+c];a+=l,o+=l,a%n===0&&this._update(r)}return this._len+=i,this},Ai.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},Ai.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Cp=Ai,Pp=Op,Cc=Cp,Tp=Rc.Buffer,Ap=[1518500249,1859775393,-1894007588,-899497514],Dp=new Array(80);function An(){this.init(),this._w=Dp,Cc.call(this,64,56)}Pp(An,Cc),An.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function $p(e){return e<<1|e>>>31}function Ip(e){return e<<5|e>>>27}function Bp(e){return e<<30|e>>>2}function jp(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}An.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,a=this._d|0,o=this._e|0,s=0;s<16;++s)t[s]=e.readInt32BE(s*4);for(;s<80;++s)t[s]=$p(t[s-3]^t[s-8]^t[s-14]^t[s-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=Ip(r)+jp(c,n,i,a)+o+t[l]+Ap[c]|0;o=a,a=i,i=Bp(n),n=r,r=u}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=o+this._e|0},An.prototype._hash=function(){var e=Tp.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var zp=An;const Pc=St(zp);function Dt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function Tc(e,t){for(var r="",n=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=s,a=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=s,a=0;continue}}t&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+e.slice(i+1,s):r=e.slice(i+1,s),n=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return r}function Np(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}var Hr={resolve:function(){for(var t="",r=!1,n,i=arguments.length-1;i>=-1&&!r;i--){var a;i>=0?a=arguments[i]:(n===void 0&&(n=process.cwd()),a=n),Dt(a),a.length!==0&&(t=a+"/"+t,r=a.charCodeAt(0)===47)}return t=Tc(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if(Dt(t),t.length===0)return".";var r=t.charCodeAt(0)===47,n=t.charCodeAt(t.length-1)===47;return t=Tc(t,!r),t.length===0&&!r&&(t="."),t.length>0&&n&&(t+="/"),r?"/"+t:t},isAbsolute:function(t){return Dt(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,r=0;r<arguments.length;++r){var n=arguments[r];Dt(n),n.length>0&&(t===void 0?t=n:t+="/"+n)}return t===void 0?".":Hr.normalize(t)},relative:function(t,r){if(Dt(t),Dt(r),t===r||(t=Hr.resolve(t),r=Hr.resolve(r),t===r))return"";for(var n=1;n<t.length&&t.charCodeAt(n)===47;++n);for(var i=t.length,a=i-n,o=1;o<r.length&&r.charCodeAt(o)===47;++o);for(var s=r.length,l=s-o,c=a<l?a:l,u=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(r.charCodeAt(o+d)===47)return r.slice(o+d+1);if(d===0)return r.slice(o+d)}else a>c&&(t.charCodeAt(n+d)===47?u=d:d===0&&(u=0));break}var p=t.charCodeAt(n+d),m=r.charCodeAt(o+d);if(p!==m)break;p===47&&(u=d)}var g="";for(d=n+u+1;d<=i;++d)(d===i||t.charCodeAt(d)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+r.slice(o+u):(o+=u,r.charCodeAt(o)===47&&++o,r.slice(o))},_makeLong:function(t){return t},dirname:function(t){if(Dt(t),t.length===0)return".";for(var r=t.charCodeAt(0),n=r===47,i=-1,a=!0,o=t.length-1;o>=1;--o)if(r=t.charCodeAt(o),r===47){if(!a){i=o;break}}else a=!1;return i===-1?n?"/":".":n&&i===1?"//":t.slice(0,i)},basename:function(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Dt(t);var n=0,i=-1,a=!0,o;if(r!==void 0&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var s=r.length-1,l=-1;for(o=t.length-1;o>=0;--o){var c=t.charCodeAt(o);if(c===47){if(!a){n=o+1;break}}else l===-1&&(a=!1,l=o+1),s>=0&&(c===r.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=l))}return n===i?i=l:i===-1&&(i=t.length),t.slice(n,i)}else{for(o=t.length-1;o>=0;--o)if(t.charCodeAt(o)===47){if(!a){n=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?"":t.slice(n,i)}},extname:function(t){Dt(t);for(var r=-1,n=0,i=-1,a=!0,o=0,s=t.length-1;s>=0;--s){var l=t.charCodeAt(s);if(l===47){if(!a){n=s+1;break}continue}i===-1&&(a=!1,i=s+1),l===46?r===-1?r=s:o!==1&&(o=1):r!==-1&&(o=-1)}return r===-1||i===-1||o===0||o===1&&r===i-1&&r===n+1?"":t.slice(r,i)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return Np("/",t)},parse:function(t){Dt(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return r;var n=t.charCodeAt(0),i=n===47,a;i?(r.root="/",a=1):a=0;for(var o=-1,s=0,l=-1,c=!0,u=t.length-1,d=0;u>=a;--u){if(n=t.charCodeAt(u),n===47){if(!c){s=u+1;break}continue}l===-1&&(c=!1,l=u+1),n===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1)}return o===-1||l===-1||d===0||d===1&&o===l-1&&o===s+1?l!==-1&&(s===0&&i?r.base=r.name=t.slice(1,l):r.base=r.name=t.slice(s,l)):(s===0&&i?(r.name=t.slice(1,o),r.base=t.slice(1,l)):(r.name=t.slice(s,o),r.base=t.slice(s,l)),r.ext=t.slice(o,l)),s>0?r.dir=t.slice(0,s-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};Hr.posix=Hr;var N=Hr,Ac={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */(function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="1.2.2";function r(){for(var R=0,A=new Array(256),D=0;D!=256;++D)R=D,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,R=R&1?-306674912^R>>>1:R>>>1,A[D]=R;return typeof Int32Array<"u"?new Int32Array(A):A}var n=r();function i(R){var A=0,D=0,j=0,M=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(j=0;j!=256;++j)M[j]=R[j];for(j=0;j!=256;++j)for(D=R[j],A=256+j;A<4096;A+=256)D=M[A]=D>>>8^R[D&255];var U=[];for(j=1;j!=16;++j)U[j-1]=typeof Int32Array<"u"?M.subarray(j*256,j*256+256):M.slice(j*256,j*256+256);return U}var a=i(n),o=a[0],s=a[1],l=a[2],c=a[3],u=a[4],d=a[5],p=a[6],m=a[7],g=a[8],v=a[9],x=a[10],b=a[11],_=a[12],k=a[13],S=a[14];function y(R,A){for(var D=A^-1,j=0,M=R.length;j<M;)D=D>>>8^n[(D^R.charCodeAt(j++))&255];return~D}function C(R,A){for(var D=A^-1,j=R.length-15,M=0;M<j;)D=S[R[M++]^D&255]^k[R[M++]^D>>8&255]^_[R[M++]^D>>16&255]^b[R[M++]^D>>>24]^x[R[M++]]^v[R[M++]]^g[R[M++]]^m[R[M++]]^p[R[M++]]^d[R[M++]]^u[R[M++]]^c[R[M++]]^l[R[M++]]^s[R[M++]]^o[R[M++]]^n[R[M++]];for(j+=15;M<j;)D=D>>>8^n[(D^R[M++])&255];return~D}function O(R,A){for(var D=A^-1,j=0,M=R.length,U=0,Z=0;j<M;)U=R.charCodeAt(j++),U<128?D=D>>>8^n[(D^U)&255]:U<2048?(D=D>>>8^n[(D^(192|U>>6&31))&255],D=D>>>8^n[(D^(128|U&63))&255]):U>=55296&&U<57344?(U=(U&1023)+64,Z=R.charCodeAt(j++)&1023,D=D>>>8^n[(D^(240|U>>8&7))&255],D=D>>>8^n[(D^(128|U>>2&63))&255],D=D>>>8^n[(D^(128|Z>>6&15|(U&3)<<4))&255],D=D>>>8^n[(D^(128|Z&63))&255]):(D=D>>>8^n[(D^(224|U>>12&15))&255],D=D>>>8^n[(D^(128|U>>6&63))&255],D=D>>>8^n[(D^(128|U&63))&255]);return~D}t.table=n,t.bstr=y,t.buf=C,t.str=O})})(Ac);const Mp=St(Ac);var Gt={};(function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function r(a,o){return Object.prototype.hasOwnProperty.call(a,o)}e.assign=function(a){for(var o=Array.prototype.slice.call(arguments,1);o.length;){var s=o.shift();if(s){if(typeof s!="object")throw new TypeError(s+"must be non-object");for(var l in s)r(s,l)&&(a[l]=s[l])}}return a},e.shrinkBuf=function(a,o){return a.length===o?a:a.subarray?a.subarray(0,o):(a.length=o,a)};var n={arraySet:function(a,o,s,l,c){if(o.subarray&&a.subarray){a.set(o.subarray(s,s+l),c);return}for(var u=0;u<l;u++)a[c+u]=o[s+u]},flattenChunks:function(a){var o,s,l,c,u,d;for(l=0,o=0,s=a.length;o<s;o++)l+=a[o].length;for(d=new Uint8Array(l),c=0,o=0,s=a.length;o<s;o++)u=a[o],d.set(u,c),c+=u.length;return d}},i={arraySet:function(a,o,s,l,c){for(var u=0;u<l;u++)a[c+u]=o[s+u]},flattenChunks:function(a){return[].concat.apply([],a)}};e.setTyped=function(a){a?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)})(Gt);var Dn={},$t={},Wr={},Lp=Gt,Fp=4,Dc=0,$c=1,Up=2;function qr(e){for(var t=e.length;--t>=0;)e[t]=0}var Hp=0,Ic=1,Wp=2,qp=3,Gp=258,io=29,$n=256,In=$n+1+io,Gr=30,ao=19,Bc=2*In+1,xr=15,oo=16,Yp=7,so=256,jc=16,zc=17,Nc=18,co=[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],Di=[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],Zp=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Mc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Xp=512,Yt=new Array((In+2)*2);qr(Yt);var Bn=new Array(Gr*2);qr(Bn);var jn=new Array(Xp);qr(jn);var zn=new Array(Gp-qp+1);qr(zn);var lo=new Array(io);qr(lo);var $i=new Array(Gr);qr($i);function uo(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var Lc,Fc,Uc;function fo(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Hc(e){return e<256?jn[e]:jn[256+(e>>>7)]}function Nn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function ot(e,t,r){e.bi_valid>oo-r?(e.bi_buf|=t<<e.bi_valid&65535,Nn(e,e.bi_buf),e.bi_buf=t>>oo-e.bi_valid,e.bi_valid+=r-oo):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function It(e,t,r){ot(e,r[t*2],r[t*2+1])}function Wc(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Vp(e){e.bi_valid===16?(Nn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Kp(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,u,d,p,m,g,v=0;for(p=0;p<=xr;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<Bc;c++)u=e.heap[c],p=r[r[u*2+1]*2+1]+1,p>l&&(p=l,v++),r[u*2+1]=p,!(u>n)&&(e.bl_count[p]++,m=0,u>=s&&(m=o[u-s]),g=r[u*2],e.opt_len+=g*(p+m),a&&(e.static_len+=g*(i[u*2+1]+m)));if(v!==0){do{for(p=l-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,v-=2}while(v>0);for(p=l;p!==0;p--)for(u=e.bl_count[p];u!==0;)d=e.heap[--c],!(d>n)&&(r[d*2+1]!==p&&(e.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),u--)}}function qc(e,t,r){var n=new Array(xr+1),i=0,a,o;for(a=1;a<=xr;a++)n[a]=i=i+r[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=Wc(n[s]++,s))}}function Jp(){var e,t,r,n,i,a=new Array(xr+1);for(r=0,n=0;n<io-1;n++)for(lo[n]=r,e=0;e<1<<co[n];e++)zn[r++]=n;for(zn[r-1]=n,i=0,n=0;n<16;n++)for($i[n]=i,e=0;e<1<<Di[n];e++)jn[i++]=n;for(i>>=7;n<Gr;n++)for($i[n]=i<<7,e=0;e<1<<Di[n]-7;e++)jn[256+i++]=n;for(t=0;t<=xr;t++)a[t]=0;for(e=0;e<=143;)Yt[e*2+1]=8,e++,a[8]++;for(;e<=255;)Yt[e*2+1]=9,e++,a[9]++;for(;e<=279;)Yt[e*2+1]=7,e++,a[7]++;for(;e<=287;)Yt[e*2+1]=8,e++,a[8]++;for(qc(Yt,In+1,a),e=0;e<Gr;e++)Bn[e*2+1]=5,Bn[e*2]=Wc(e,5);Lc=new uo(Yt,co,$n+1,In,xr),Fc=new uo(Bn,Di,0,Gr,xr),Uc=new uo(new Array(0),Zp,0,ao,Yp)}function Gc(e){var t;for(t=0;t<In;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Gr;t++)e.dyn_dtree[t*2]=0;for(t=0;t<ao;t++)e.bl_tree[t*2]=0;e.dyn_ltree[so*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Yc(e){e.bi_valid>8?Nn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Qp(e,t,r,n){Yc(e),Nn(e,r),Nn(e,~r),Lp.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Zc(e,t,r,n){var i=t*2,a=r*2;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function ho(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Zc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Zc(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Xc(e,t,r){var n,i,a=0,o,s;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,n===0?It(e,i,t):(o=zn[i],It(e,o+$n+1,t),s=co[o],s!==0&&(i-=lo[o],ot(e,i,s)),n--,o=Hc(n),It(e,o,r),s=Di[o],s!==0&&(n-=$i[o],ot(e,n,s)));while(a<e.last_lit);It(e,so,t)}function po(e,t){var r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,l=-1,c;for(e.heap_len=0,e.heap_max=Bc,o=0;o<a;o++)r[o*2]!==0?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,r[c*2]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[c*2+1]);for(t.max_code=l,o=e.heap_len>>1;o>=1;o--)ho(e,r,o);c=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ho(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,r[c*2]=r[o*2]+r[s*2],e.depth[c]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,r[o*2+1]=r[s*2+1]=c,e.heap[1]=c++,ho(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Kp(e,t),qc(r,l,e.bl_count)}function Vc(e,t,r){var n,i=-1,a,o=t[0*2+1],s=0,l=7,c=4;for(o===0&&(l=138,c=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=t[(n+1)*2+1],!(++s<l&&a===o)&&(s<c?e.bl_tree[a*2]+=s:a!==0?(a!==i&&e.bl_tree[a*2]++,e.bl_tree[jc*2]++):s<=10?e.bl_tree[zc*2]++:e.bl_tree[Nc*2]++,s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4))}function Kc(e,t,r){var n,i=-1,a,o=t[0*2+1],s=0,l=7,c=4;for(o===0&&(l=138,c=3),n=0;n<=r;n++)if(a=o,o=t[(n+1)*2+1],!(++s<l&&a===o)){if(s<c)do It(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==i&&(It(e,a,e.bl_tree),s--),It(e,jc,e.bl_tree),ot(e,s-3,2)):s<=10?(It(e,zc,e.bl_tree),ot(e,s-3,3)):(It(e,Nc,e.bl_tree),ot(e,s-11,7));s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4)}}function e0(e){var t;for(Vc(e,e.dyn_ltree,e.l_desc.max_code),Vc(e,e.dyn_dtree,e.d_desc.max_code),po(e,e.bl_desc),t=ao-1;t>=3&&e.bl_tree[Mc[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function t0(e,t,r,n){var i;for(ot(e,t-257,5),ot(e,r-1,5),ot(e,n-4,4),i=0;i<n;i++)ot(e,e.bl_tree[Mc[i]*2+1],3);Kc(e,e.dyn_ltree,t-1),Kc(e,e.dyn_dtree,r-1)}function r0(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return Dc;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return $c;for(r=32;r<$n;r++)if(e.dyn_ltree[r*2]!==0)return $c;return Dc}var Jc=!1;function n0(e){Jc||(Jp(),Jc=!0),e.l_desc=new fo(e.dyn_ltree,Lc),e.d_desc=new fo(e.dyn_dtree,Fc),e.bl_desc=new fo(e.bl_tree,Uc),e.bi_buf=0,e.bi_valid=0,Gc(e)}function Qc(e,t,r,n){ot(e,(Hp<<1)+(n?1:0),3),Qp(e,t,r)}function i0(e){ot(e,Ic<<1,3),It(e,so,Yt),Vp(e)}function a0(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===Up&&(e.strm.data_type=r0(e)),po(e,e.l_desc),po(e,e.d_desc),o=e0(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?Qc(e,t,r,n):e.strategy===Fp||a===i?(ot(e,(Ic<<1)+(n?1:0),3),Xc(e,Yt,Bn)):(ot(e,(Wp<<1)+(n?1:0),3),t0(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Xc(e,e.dyn_ltree,e.dyn_dtree)),Gc(e),n&&Yc(e)}function o0(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(zn[r]+$n+1)*2]++,e.dyn_dtree[Hc(t)*2]++),e.last_lit===e.lit_bufsize-1}Wr._tr_init=n0,Wr._tr_stored_block=Qc,Wr._tr_flush_block=a0,Wr._tr_tally=o0,Wr._tr_align=i0;function s0(e,t,r,n){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}var el=s0;function c0(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var l0=c0();function u0(e,t,r,n){var i=l0,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}var tl=u0,mo={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"},tt=Gt,bt=Wr,rl=el,rr=tl,f0=mo,Er=0,d0=1,h0=3,nr=4,nl=5,Bt=0,il=1,vt=-2,p0=-3,wo=-5,m0=-1,w0=1,Ii=2,g0=3,y0=4,b0=0,v0=2,Bi=8,_0=9,x0=15,E0=8,S0=29,k0=256,go=k0+1+S0,R0=30,O0=19,C0=2*go+1,P0=15,me=3,ir=258,kt=ir+me+1,T0=32,ji=42,yo=69,zi=73,Ni=91,Mi=103,Sr=113,Mn=666,Fe=1,Ln=2,kr=3,Yr=4,A0=3;function ar(e,t){return e.msg=f0[t],t}function al(e){return(e<<1)-(e>4?9:0)}function or(e){for(var t=e.length;--t>=0;)e[t]=0}function sr(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(tt.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function qe(e,t){bt._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,sr(e.strm)}function be(e,t){e.pending_buf[e.pending++]=t}function Fn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function D0(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,tt.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=rl(e.adler,t,i,r):e.state.wrap===2&&(e.adler=rr(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function ol(e,t){var r=e.max_chain_length,n=e.strstart,i,a,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-kt?e.strstart-(e.w_size-kt):0,c=e.window,u=e.w_mask,d=e.prev,p=e.strstart+ir,m=c[n+o-1],g=c[n+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(c[i+o]!==g||c[i+o-1]!==m||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&n<p);if(a=ir-(p-n),n=p-ir,a>o){if(e.match_start=t,o=a,a>=s)break;m=c[n+o-1],g=c[n+o]}}while((t=d[t&u])>l&&--r!==0);return o<=e.lookahead?o:e.lookahead}function Rr(e){var t=e.w_size,r,n,i,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-kt)){tt.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=D0(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=me)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+me-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<me)););}while(e.lookahead<kt&&e.strm.avail_in!==0)}function $0(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Rr(e),e.lookahead===0&&t===Er)return Fe;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,qe(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-kt&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=0,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):(e.strstart>e.block_start&&(qe(e,!1),e.strm.avail_out===0),Fe)}function bo(e,t){for(var r,n;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return Fe;if(e.lookahead===0)break}if(r=0,e.lookahead>=me&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-kt&&(e.match_length=ol(e,r)),e.match_length>=me)if(n=bt._tr_tally(e,e.strstart-e.match_start,e.match_length-me),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=me){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=e.strstart<me-1?e.strstart:me-1,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function Zr(e,t){for(var r,n,i;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return Fe;if(e.lookahead===0)break}if(r=0,e.lookahead>=me&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=me-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-kt&&(e.match_length=ol(e,r),e.match_length<=5&&(e.strategy===w0||e.match_length===me&&e.strstart-e.match_start>4096)&&(e.match_length=me-1)),e.prev_length>=me&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-me,n=bt._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-me),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=me-1,e.strstart++,n&&(qe(e,!1),e.strm.avail_out===0))return Fe}else if(e.match_available){if(n=bt._tr_tally(e,0,e.window[e.strstart-1]),n&&qe(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Fe}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=bt._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<me-1?e.strstart:me-1,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function I0(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=ir){if(Rr(e),e.lookahead<=ir&&t===Er)return Fe;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=me&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=e.strstart+ir;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);e.match_length=ir-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=me?(r=bt._tr_tally(e,1,e.match_length-me),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=0,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function B0(e,t){for(var r;;){if(e.lookahead===0&&(Rr(e),e.lookahead===0)){if(t===Er)return Fe;break}if(e.match_length=0,r=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=0,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function jt(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var Xr;Xr=[new jt(0,0,0,0,$0),new jt(4,4,8,4,bo),new jt(4,5,16,8,bo),new jt(4,6,32,32,bo),new jt(4,4,16,16,Zr),new jt(8,16,32,32,Zr),new jt(8,16,128,128,Zr),new jt(8,32,128,256,Zr),new jt(32,128,258,1024,Zr),new jt(32,258,258,4096,Zr)];function j0(e){e.window_size=2*e.w_size,or(e.head),e.max_lazy_match=Xr[e.level].max_lazy,e.good_match=Xr[e.level].good_length,e.nice_match=Xr[e.level].nice_length,e.max_chain_length=Xr[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=me-1,e.match_available=0,e.ins_h=0}function z0(){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=Bi,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 tt.Buf16(C0*2),this.dyn_dtree=new tt.Buf16((2*R0+1)*2),this.bl_tree=new tt.Buf16((2*O0+1)*2),or(this.dyn_ltree),or(this.dyn_dtree),or(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new tt.Buf16(P0+1),this.heap=new tt.Buf16(2*go+1),or(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new tt.Buf16(2*go+1),or(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 sl(e){var t;return!e||!e.state?ar(e,vt):(e.total_in=e.total_out=0,e.data_type=v0,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?ji:Sr,e.adler=t.wrap===2?0:1,t.last_flush=Er,bt._tr_init(t),Bt)}function cl(e){var t=sl(e);return t===Bt&&j0(e.state),t}function N0(e,t){return!e||!e.state||e.state.wrap!==2?vt:(e.state.gzhead=t,Bt)}function ll(e,t,r,n,i,a){if(!e)return vt;var o=1;if(t===m0&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>_0||r!==Bi||n<8||n>15||t<0||t>9||a<0||a>y0)return ar(e,vt);n===8&&(n=9);var s=new z0;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+me-1)/me),s.window=new tt.Buf8(s.w_size*2),s.head=new tt.Buf16(s.hash_size),s.prev=new tt.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new tt.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=r,cl(e)}function M0(e,t){return ll(e,t,Bi,x0,E0,b0)}function L0(e,t){var r,n,i,a;if(!e||!e.state||t>nl||t<0)return e?ar(e,vt):vt;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Mn&&t!==nr)return ar(e,e.avail_out===0?wo:vt);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===ji)if(n.wrap===2)e.adler=0,be(n,31),be(n,139),be(n,8),n.gzhead?(be(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),be(n,n.gzhead.time&255),be(n,n.gzhead.time>>8&255),be(n,n.gzhead.time>>16&255),be(n,n.gzhead.time>>24&255),be(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),be(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(be(n,n.gzhead.extra.length&255),be(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=rr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=yo):(be(n,0),be(n,0),be(n,0),be(n,0),be(n,0),be(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),be(n,A0),n.status=Sr);else{var o=Bi+(n.w_bits-8<<4)<<8,s=-1;n.strategy>=Ii||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,o|=s<<6,n.strstart!==0&&(o|=T0),o+=31-o%31,n.status=Sr,Fn(n,o),n.strstart!==0&&(Fn(n,e.adler>>>16),Fn(n,e.adler&65535)),e.adler=1}if(n.status===yo)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),sr(e),i=n.pending,n.pending===n.pending_buf_size));)be(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=zi)}else n.status=zi;if(n.status===zi)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),sr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,be(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Ni)}else n.status=Ni;if(n.status===Ni)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),sr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,be(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=Mi)}else n.status=Mi;if(n.status===Mi&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&sr(e),n.pending+2<=n.pending_buf_size&&(be(n,e.adler&255),be(n,e.adler>>8&255),e.adler=0,n.status=Sr)):n.status=Sr),n.pending!==0){if(sr(e),e.avail_out===0)return n.last_flush=-1,Bt}else if(e.avail_in===0&&al(t)<=al(r)&&t!==nr)return ar(e,wo);if(n.status===Mn&&e.avail_in!==0)return ar(e,wo);if(e.avail_in!==0||n.lookahead!==0||t!==Er&&n.status!==Mn){var l=n.strategy===Ii?B0(n,t):n.strategy===g0?I0(n,t):Xr[n.level].func(n,t);if((l===kr||l===Yr)&&(n.status=Mn),l===Fe||l===kr)return e.avail_out===0&&(n.last_flush=-1),Bt;if(l===Ln&&(t===d0?bt._tr_align(n):t!==nl&&(bt._tr_stored_block(n,0,0,!1),t===h0&&(or(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),sr(e),e.avail_out===0))return n.last_flush=-1,Bt}return t!==nr?Bt:n.wrap<=0?il:(n.wrap===2?(be(n,e.adler&255),be(n,e.adler>>8&255),be(n,e.adler>>16&255),be(n,e.adler>>24&255),be(n,e.total_in&255),be(n,e.total_in>>8&255),be(n,e.total_in>>16&255),be(n,e.total_in>>24&255)):(Fn(n,e.adler>>>16),Fn(n,e.adler&65535)),sr(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Bt:il)}function F0(e){var t;return!e||!e.state?vt:(t=e.state.status,t!==ji&&t!==yo&&t!==zi&&t!==Ni&&t!==Mi&&t!==Sr&&t!==Mn?ar(e,vt):(e.state=null,t===Sr?ar(e,p0):Bt))}function U0(e,t){var r=t.length,n,i,a,o,s,l,c,u;if(!e||!e.state||(n=e.state,o=n.wrap,o===2||o===1&&n.status!==ji||n.lookahead))return vt;for(o===1&&(e.adler=rl(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(o===0&&(or(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new tt.Buf8(n.w_size),tt.arraySet(u,t,r-n.w_size,n.w_size,0),t=u,r=n.w_size),s=e.avail_in,l=e.next_in,c=e.input,e.avail_in=r,e.next_in=0,e.input=t,Rr(n);n.lookahead>=me;){i=n.strstart,a=n.lookahead-(me-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+me-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--a);n.strstart=i,n.lookahead=me-1,Rr(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=me-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=s,n.wrap=o,Bt}$t.deflateInit=M0,$t.deflateInit2=ll,$t.deflateReset=cl,$t.deflateResetKeep=sl,$t.deflateSetHeader=N0,$t.deflate=L0,$t.deflateEnd=F0,$t.deflateSetDictionary=U0,$t.deflateInfo="pako deflate (from Nodeca project)";var Or={},Li=Gt,ul=!0,fl=!0;try{String.fromCharCode.apply(null,[0])}catch{ul=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{fl=!1}for(var Un=new Li.Buf8(256),cr=0;cr<256;cr++)Un[cr]=cr>=252?6:cr>=248?5:cr>=240?4:cr>=224?3:cr>=192?2:1;Un[254]=Un[254]=1,Or.string2buf=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Li.Buf8(s),a=0,i=0;a<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};function dl(e,t){if(t<65534&&(e.subarray&&fl||!e.subarray&&ul))return String.fromCharCode.apply(null,Li.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Or.buf2binstring=function(e){return dl(e,e.length)},Or.binstring2buf=function(e){for(var t=new Li.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},Or.buf2string=function(e,t){var r,n,i,a,o=t||e.length,s=new Array(o*2);for(n=0,r=0;r<o;){if(i=e[r++],i<128){s[n++]=i;continue}if(a=Un[i],a>4){s[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r<o;)i=i<<6|e[r++]&63,a--;if(a>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return dl(s,n)},Or.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Un[e[r]]>t?r:t};function H0(){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}var hl=H0,Hn=$t,Wn=Gt,vo=Or,_o=mo,W0=hl,pl=Object.prototype.toString,q0=0,xo=4,Vr=0,ml=1,wl=2,G0=-1,Y0=0,Z0=8;function Cr(e){if(!(this instanceof Cr))return new Cr(e);this.options=Wn.assign({level:G0,method:Z0,chunkSize:16384,windowBits:15,memLevel:8,strategy:Y0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new W0,this.strm.avail_out=0;var r=Hn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Vr)throw new Error(_o[r]);if(t.header&&Hn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=vo.string2buf(t.dictionary):pl.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Hn.deflateSetDictionary(this.strm,n),r!==Vr)throw new Error(_o[r]);this._dict_set=!0}}Cr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=t===~~t?t:t===!0?xo:q0,typeof e=="string"?r.input=vo.string2buf(e):pl.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Wn.Buf8(n),r.next_out=0,r.avail_out=n),i=Hn.deflate(r,a),i!==ml&&i!==Vr)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===xo||a===wl))&&(this.options.to==="string"?this.onData(vo.buf2binstring(Wn.shrinkBuf(r.output,r.next_out))):this.onData(Wn.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==ml);return a===xo?(i=Hn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Vr):(a===wl&&(this.onEnd(Vr),r.avail_out=0),!0)},Cr.prototype.onData=function(e){this.chunks.push(e)},Cr.prototype.onEnd=function(e){e===Vr&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Eo(e,t){var r=new Cr(t);if(r.push(e,!0),r.err)throw r.msg||_o[r.err];return r.result}function X0(e,t){return t=t||{},t.raw=!0,Eo(e,t)}function V0(e,t){return t=t||{},t.gzip=!0,Eo(e,t)}Dn.Deflate=Cr,Dn.deflate=Eo,Dn.deflateRaw=X0,Dn.gzip=V0;var qn={},Rt={},Fi=30,K0=12,J0=function(t,r){var n,i,a,o,s,l,c,u,d,p,m,g,v,x,b,_,k,S,y,C,O,R,A,D,j;n=t.state,i=t.next_in,D=t.input,a=i+(t.avail_in-5),o=t.next_out,j=t.output,s=o-(r-t.avail_out),l=o+(t.avail_out-257),c=n.dmax,u=n.wsize,d=n.whave,p=n.wnext,m=n.window,g=n.hold,v=n.bits,x=n.lencode,b=n.distcode,_=(1<<n.lenbits)-1,k=(1<<n.distbits)-1;e:do{v<15&&(g+=D[i++]<<v,v+=8,g+=D[i++]<<v,v+=8),S=x[g&_];t:for(;;){if(y=S>>>24,g>>>=y,v-=y,y=S>>>16&255,y===0)j[o++]=S&65535;else if(y&16){C=S&65535,y&=15,y&&(v<y&&(g+=D[i++]<<v,v+=8),C+=g&(1<<y)-1,g>>>=y,v-=y),v<15&&(g+=D[i++]<<v,v+=8,g+=D[i++]<<v,v+=8),S=b[g&k];r:for(;;){if(y=S>>>24,g>>>=y,v-=y,y=S>>>16&255,y&16){if(O=S&65535,y&=15,v<y&&(g+=D[i++]<<v,v+=8,v<y&&(g+=D[i++]<<v,v+=8)),O+=g&(1<<y)-1,O>c){t.msg="invalid distance too far back",n.mode=Fi;break e}if(g>>>=y,v-=y,y=o-s,O>y){if(y=O-y,y>d&&n.sane){t.msg="invalid distance too far back",n.mode=Fi;break e}if(R=0,A=m,p===0){if(R+=u-y,y<C){C-=y;do j[o++]=m[R++];while(--y);R=o-O,A=j}}else if(p<y){if(R+=u+p-y,y-=p,y<C){C-=y;do j[o++]=m[R++];while(--y);if(R=0,p<C){y=p,C-=y;do j[o++]=m[R++];while(--y);R=o-O,A=j}}}else if(R+=p-y,y<C){C-=y;do j[o++]=m[R++];while(--y);R=o-O,A=j}for(;C>2;)j[o++]=A[R++],j[o++]=A[R++],j[o++]=A[R++],C-=3;C&&(j[o++]=A[R++],C>1&&(j[o++]=A[R++]))}else{R=o-O;do j[o++]=j[R++],j[o++]=j[R++],j[o++]=j[R++],C-=3;while(C>2);C&&(j[o++]=j[R++],C>1&&(j[o++]=j[R++]))}}else if(y&64){t.msg="invalid distance code",n.mode=Fi;break e}else{S=b[(S&65535)+(g&(1<<y)-1)];continue r}break}}else if(y&64)if(y&32){n.mode=K0;break e}else{t.msg="invalid literal/length code",n.mode=Fi;break e}else{S=x[(S&65535)+(g&(1<<y)-1)];continue t}break}}while(i<a&&o<l);C=v>>3,i-=C,v-=C<<3,g&=(1<<v)-1,t.next_in=i,t.next_out=o,t.avail_in=i<a?5+(a-i):5-(i-a),t.avail_out=o<l?257+(l-o):257-(o-l),n.hold=g,n.bits=v},gl=Gt,Kr=15,yl=852,bl=592,vl=0,So=1,_l=2,Q0=[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],em=[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],tm=[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],rm=[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],nm=function(t,r,n,i,a,o,s,l){var c=l.bits,u=0,d=0,p=0,m=0,g=0,v=0,x=0,b=0,_=0,k=0,S,y,C,O,R,A=null,D=0,j,M=new gl.Buf16(Kr+1),U=new gl.Buf16(Kr+1),Z=null,de=0,$e,ge,_e;for(u=0;u<=Kr;u++)M[u]=0;for(d=0;d<i;d++)M[r[n+d]]++;for(g=c,m=Kr;m>=1&&M[m]===0;m--);if(g>m&&(g=m),m===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,l.bits=1,0;for(p=1;p<m&&M[p]===0;p++);for(g<p&&(g=p),b=1,u=1;u<=Kr;u++)if(b<<=1,b-=M[u],b<0)return-1;if(b>0&&(t===vl||m!==1))return-1;for(U[1]=0,u=1;u<Kr;u++)U[u+1]=U[u]+M[u];for(d=0;d<i;d++)r[n+d]!==0&&(s[U[r[n+d]]++]=d);if(t===vl?(A=Z=s,j=19):t===So?(A=Q0,D-=257,Z=em,de-=257,j=256):(A=tm,Z=rm,j=-1),k=0,d=0,u=p,R=o,v=g,x=0,C=-1,_=1<<g,O=_-1,t===So&&_>yl||t===_l&&_>bl)return 1;for(;;){$e=u-x,s[d]<j?(ge=0,_e=s[d]):s[d]>j?(ge=Z[de+s[d]],_e=A[D+s[d]]):(ge=96,_e=0),S=1<<u-x,y=1<<v,p=y;do y-=S,a[R+(k>>x)+y]=$e<<24|ge<<16|_e|0;while(y!==0);for(S=1<<u-1;k&S;)S>>=1;if(S!==0?(k&=S-1,k+=S):k=0,d++,--M[u]===0){if(u===m)break;u=r[n+s[d]]}if(u>g&&(k&O)!==C){for(x===0&&(x=g),R+=p,v=u-x,b=1<<v;v+x<m&&(b-=M[v+x],!(b<=0));)v++,b<<=1;if(_+=1<<v,t===So&&_>yl||t===_l&&_>bl)return 1;C=k&O,a[C]=g<<24|v<<16|R-o|0}}return k!==0&&(a[R+k]=u-x<<24|64<<16|0),l.bits=g,0},pt=Gt,ko=el,zt=tl,im=J0,Gn=nm,am=0,xl=1,El=2,Sl=4,om=5,Ui=6,Pr=0,sm=1,cm=2,_t=-2,kl=-3,Rl=-4,lm=-5,Ol=8,Cl=1,Pl=2,Tl=3,Al=4,Dl=5,$l=6,Il=7,Bl=8,jl=9,zl=10,Hi=11,Zt=12,Ro=13,Nl=14,Oo=15,Ml=16,Ll=17,Fl=18,Ul=19,Wi=20,qi=21,Hl=22,Wl=23,ql=24,Gl=25,Yl=26,Co=27,Zl=28,Xl=29,Te=30,Vl=31,um=32,fm=852,dm=592,hm=15,pm=hm;function Kl(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function mm(){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 pt.Buf16(320),this.work=new pt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Jl(e){var t;return!e||!e.state?_t:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Cl,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new pt.Buf32(fm),t.distcode=t.distdyn=new pt.Buf32(dm),t.sane=1,t.back=-1,Pr)}function Ql(e){var t;return!e||!e.state?_t:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Jl(e))}function eu(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?_t:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Ql(e))}function tu(e,t){var r,n;return e?(n=new mm,e.state=n,n.window=null,r=eu(e,t),r!==Pr&&(e.state=null),r):_t}function wm(e){return tu(e,pm)}var ru=!0,Po,To;function gm(e){if(ru){var t;for(Po=new pt.Buf32(512),To=new pt.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Gn(xl,e.lens,0,288,Po,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Gn(El,e.lens,0,32,To,0,e.work,{bits:5}),ru=!1}e.lencode=Po,e.lenbits=9,e.distcode=To,e.distbits=5}function nu(e,t,r,n){var i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new pt.Buf8(a.wsize)),n>=a.wsize?(pt.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),pt.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(pt.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function ym(e,t){var r,n,i,a,o,s,l,c,u,d,p,m,g,v,x=0,b,_,k,S,y,C,O,R,A=new pt.Buf8(4),D,j,M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return _t;r=e.state,r.mode===Zt&&(r.mode=Ro),o=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,c=r.hold,u=r.bits,d=s,p=l,R=Pr;e:for(;;)switch(r.mode){case Cl:if(r.wrap===0){r.mode=Ro;break}for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.wrap&2&&c===35615){r.check=0,A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0),c=0,u=0,r.mode=Pl;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=Te;break}if((c&15)!==Ol){e.msg="unknown compression method",r.mode=Te;break}if(c>>>=4,u-=4,O=(c&15)+8,r.wbits===0)r.wbits=O;else if(O>r.wbits){e.msg="invalid window size",r.mode=Te;break}r.dmax=1<<O,e.adler=r.check=1,r.mode=c&512?zl:Zt,c=0,u=0;break;case Pl:for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.flags=c,(r.flags&255)!==Ol){e.msg="unknown compression method",r.mode=Te;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Te;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0)),c=0,u=0,r.mode=Tl;case Tl:for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.head&&(r.head.time=c),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,r.check=zt(r.check,A,4,0)),c=0,u=0,r.mode=Al;case Al:for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0)),c=0,u=0,r.mode=Dl;case Dl:if(r.flags&1024){for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=$l;case $l:if(r.flags&1024&&(m=r.length,m>s&&(m=s),m&&(r.head&&(O=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),pt.arraySet(r.head.extra,n,a,m,O)),r.flags&512&&(r.check=zt(r.check,n,m,a)),s-=m,a+=m,r.length-=m),r.length))break e;r.length=0,r.mode=Il;case Il:if(r.flags&2048){if(s===0)break e;m=0;do O=n[a+m++],r.head&&O&&r.length<65536&&(r.head.name+=String.fromCharCode(O));while(O&&m<s);if(r.flags&512&&(r.check=zt(r.check,n,m,a)),s-=m,a+=m,O)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Bl;case Bl:if(r.flags&4096){if(s===0)break e;m=0;do O=n[a+m++],r.head&&O&&r.length<65536&&(r.head.comment+=String.fromCharCode(O));while(O&&m<s);if(r.flags&512&&(r.check=zt(r.check,n,m,a)),s-=m,a+=m,O)break e}else r.head&&(r.head.comment=null);r.mode=jl;case jl:if(r.flags&512){for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(c!==(r.check&65535)){e.msg="header crc mismatch",r.mode=Te;break}c=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Zt;break;case zl:for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}e.adler=r.check=Kl(c),c=0,u=0,r.mode=Hi;case Hi:if(r.havedict===0)return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,r.hold=c,r.bits=u,cm;e.adler=r.check=1,r.mode=Zt;case Zt:if(t===om||t===Ui)break e;case Ro:if(r.last){c>>>=u&7,u-=u&7,r.mode=Co;break}for(;u<3;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}switch(r.last=c&1,c>>>=1,u-=1,c&3){case 0:r.mode=Nl;break;case 1:if(gm(r),r.mode=Wi,t===Ui){c>>>=2,u-=2;break e}break;case 2:r.mode=Ll;break;case 3:e.msg="invalid block type",r.mode=Te}c>>>=2,u-=2;break;case Nl:for(c>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Te;break}if(r.length=c&65535,c=0,u=0,r.mode=Oo,t===Ui)break e;case Oo:r.mode=Ml;case Ml:if(m=r.length,m){if(m>s&&(m=s),m>l&&(m=l),m===0)break e;pt.arraySet(i,n,a,m,o),s-=m,a+=m,l-=m,o+=m,r.length-=m;break}r.mode=Zt;break;case Ll:for(;u<14;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.nlen=(c&31)+257,c>>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Te;break}r.have=0,r.mode=Fl;case Fl:for(;r.have<r.ncode;){for(;u<3;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.lens[M[r.have++]]=c&7,c>>>=3,u-=3}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},R=Gn(am,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,R){e.msg="invalid code lengths set",r.mode=Te;break}r.have=0,r.mode=Ul;case Ul:for(;r.have<r.nlen+r.ndist;){for(;x=r.lencode[c&(1<<r.lenbits)-1],b=x>>>24,_=x>>>16&255,k=x&65535,!(b<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(k<16)c>>>=b,u-=b,r.lens[r.have++]=k;else{if(k===16){for(j=b+2;u<j;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(c>>>=b,u-=b,r.have===0){e.msg="invalid bit length repeat",r.mode=Te;break}O=r.lens[r.have-1],m=3+(c&3),c>>>=2,u-=2}else if(k===17){for(j=b+3;u<j;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=b,u-=b,O=0,m=3+(c&7),c>>>=3,u-=3}else{for(j=b+7;u<j;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=b,u-=b,O=0,m=11+(c&127),c>>>=7,u-=7}if(r.have+m>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Te;break}for(;m--;)r.lens[r.have++]=O}}if(r.mode===Te)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Te;break}if(r.lenbits=9,D={bits:r.lenbits},R=Gn(xl,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,R){e.msg="invalid literal/lengths set",r.mode=Te;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},R=Gn(El,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,R){e.msg="invalid distances set",r.mode=Te;break}if(r.mode=Wi,t===Ui)break e;case Wi:r.mode=qi;case qi:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,r.hold=c,r.bits=u,im(e,p),o=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,c=r.hold,u=r.bits,r.mode===Zt&&(r.back=-1);break}for(r.back=0;x=r.lencode[c&(1<<r.lenbits)-1],b=x>>>24,_=x>>>16&255,k=x&65535,!(b<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(_&&!(_&240)){for(S=b,y=_,C=k;x=r.lencode[C+((c&(1<<S+y)-1)>>S)],b=x>>>24,_=x>>>16&255,k=x&65535,!(S+b<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=S,u-=S,r.back+=S}if(c>>>=b,u-=b,r.back+=b,r.length=k,_===0){r.mode=Yl;break}if(_&32){r.back=-1,r.mode=Zt;break}if(_&64){e.msg="invalid literal/length code",r.mode=Te;break}r.extra=_&15,r.mode=Hl;case Hl:if(r.extra){for(j=r.extra;u<j;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Wl;case Wl:for(;x=r.distcode[c&(1<<r.distbits)-1],b=x>>>24,_=x>>>16&255,k=x&65535,!(b<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(!(_&240)){for(S=b,y=_,C=k;x=r.distcode[C+((c&(1<<S+y)-1)>>S)],b=x>>>24,_=x>>>16&255,k=x&65535,!(S+b<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=S,u-=S,r.back+=S}if(c>>>=b,u-=b,r.back+=b,_&64){e.msg="invalid distance code",r.mode=Te;break}r.offset=k,r.extra=_&15,r.mode=ql;case ql:if(r.extra){for(j=r.extra;u<j;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Te;break}r.mode=Gl;case Gl:if(l===0)break e;if(m=p-l,r.offset>m){if(m=r.offset-m,m>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Te;break}m>r.wnext?(m-=r.wnext,g=r.wsize-m):g=r.wnext-m,m>r.length&&(m=r.length),v=r.window}else v=i,g=o-r.offset,m=r.length;m>l&&(m=l),l-=m,r.length-=m;do i[o++]=v[g++];while(--m);r.length===0&&(r.mode=qi);break;case Yl:if(l===0)break e;i[o++]=r.length,l--,r.mode=qi;break;case Co:if(r.wrap){for(;u<32;){if(s===0)break e;s--,c|=n[a++]<<u,u+=8}if(p-=l,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?zt(r.check,i,p,o-p):ko(r.check,i,p,o-p)),p=l,(r.flags?c:Kl(c))!==r.check){e.msg="incorrect data check",r.mode=Te;break}c=0,u=0}r.mode=Zl;case Zl:if(r.wrap&&r.flags){for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(c!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=Te;break}c=0,u=0}r.mode=Xl;case Xl:R=sm;break e;case Te:R=kl;break e;case Vl:return Rl;case um:default:return _t}return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,r.hold=c,r.bits=u,(r.wsize||p!==e.avail_out&&r.mode<Te&&(r.mode<Co||t!==Sl))&&nu(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?zt(r.check,i,p,e.next_out-p):ko(r.check,i,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Zt?128:0)+(r.mode===Wi||r.mode===Oo?256:0),(d===0&&p===0||t===Sl)&&R===Pr&&(R=lm),R}function bm(e){if(!e||!e.state)return _t;var t=e.state;return t.window&&(t.window=null),e.state=null,Pr}function vm(e,t){var r;return!e||!e.state||(r=e.state,!(r.wrap&2))?_t:(r.head=t,t.done=!1,Pr)}function _m(e,t){var r=t.length,n,i,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Hi)?_t:n.mode===Hi&&(i=1,i=ko(i,t,r,0),i!==n.check)?kl:(a=nu(e,t,r,r),a?(n.mode=Vl,Rl):(n.havedict=1,Pr))}Rt.inflateReset=Ql,Rt.inflateReset2=eu,Rt.inflateResetKeep=Jl,Rt.inflateInit=wm,Rt.inflateInit2=tu,Rt.inflate=ym,Rt.inflateEnd=bm,Rt.inflateGetHeader=vm,Rt.inflateSetDictionary=_m,Rt.inflateInfo="pako inflate (from Nodeca project)";var iu={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};function xm(){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}var Em=xm,Jr=Rt,Yn=Gt,Gi=Or,Ne=iu,Ao=mo,Sm=hl,km=Em,au=Object.prototype.toString;function Tr(e){if(!(this instanceof Tr))return new Tr(e);this.options=Yn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Sm,this.strm.avail_out=0;var r=Jr.inflateInit2(this.strm,t.windowBits);if(r!==Ne.Z_OK)throw new Error(Ao[r]);if(this.header=new km,Jr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Gi.string2buf(t.dictionary):au.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Jr.inflateSetDictionary(this.strm,t.dictionary),r!==Ne.Z_OK)))throw new Error(Ao[r])}Tr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s,l,c,u=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?Ne.Z_FINISH:Ne.Z_NO_FLUSH,typeof e=="string"?r.input=Gi.binstring2buf(e):au.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Yn.Buf8(n),r.next_out=0,r.avail_out=n),a=Jr.inflate(r,Ne.Z_NO_FLUSH),a===Ne.Z_NEED_DICT&&i&&(a=Jr.inflateSetDictionary(this.strm,i)),a===Ne.Z_BUF_ERROR&&u===!0&&(a=Ne.Z_OK,u=!1),a!==Ne.Z_STREAM_END&&a!==Ne.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===Ne.Z_STREAM_END||r.avail_in===0&&(o===Ne.Z_FINISH||o===Ne.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=Gi.utf8border(r.output,r.next_out),l=r.next_out-s,c=Gi.buf2string(r.output,s),r.next_out=l,r.avail_out=n-l,l&&Yn.arraySet(r.output,r.output,s,l,0),this.onData(c)):this.onData(Yn.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==Ne.Z_STREAM_END);return a===Ne.Z_STREAM_END&&(o=Ne.Z_FINISH),o===Ne.Z_FINISH?(a=Jr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ne.Z_OK):(o===Ne.Z_SYNC_FLUSH&&(this.onEnd(Ne.Z_OK),r.avail_out=0),!0)},Tr.prototype.onData=function(e){this.chunks.push(e)},Tr.prototype.onEnd=function(e){e===Ne.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Yn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Do(e,t){var r=new Tr(t);if(r.push(e,!0),r.err)throw r.msg||Ao[r.err];return r.result}function Rm(e,t){return t=t||{},t.raw=!0,Do(e,t)}qn.Inflate=Tr,qn.inflate=Do,qn.inflateRaw=Rm,qn.ungzip=Do;var Om=Gt.assign,Cm=Dn,Pm=qn,Tm=iu,ou={};Om(ou,Cm,Pm,Tm);var Am=ou;const $o=St(Am),su=(e,t)=>function(...r){const n=t.promiseModule;return new n((i,a)=>{t.multiArgs?r.push((...o)=>{t.errorFirst?o[0]?a(o):(o.shift(),i(o)):i(o)}):t.errorFirst?r.push((o,s)=>{o?a(o):i(s)}):r.push(i),e.apply(this,r)})};var Dm=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=typeof e;if(!(e!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?"null":r}\``);const n=a=>{const o=s=>typeof s=="string"?a===s:s.test(a);return t.include?t.include.some(o):!t.exclude.some(o)};let i;r==="function"?i=function(...a){return t.excludeMain?e(...a):su(e,t).apply(this,a)}:i=Object.create(Object.getPrototypeOf(e));for(const a in e){const o=e[a];i[a]=typeof o=="function"&&n(a)?su(o,t):o}return i};const Io=St(Dm);function cu(e){return Array.isArray(e)?e:[e]}const Bo="",lu=" ",jo="\\",$m=/^\s+$/,Im=/(?:[^\\]|^)\\$/,Bm=/^\\!/,jm=/^\\#/,zm=/\r?\n/g,Nm=/^\.*\/|^\.+$/,zo="/";let uu="node-ignore";typeof Symbol<"u"&&(uu=Symbol.for("node-ignore"));const fu=uu,Mm=(e,t,r)=>Object.defineProperty(e,t,{value:r}),Lm=/([0-z])-([0-z])/g,du=()=>!1,Fm=e=>e.replace(Lm,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:Bo),Um=e=>{const{length:t}=e;return e.slice(0,t-t%2)},Hm=[[/^\uFEFF/,()=>Bo],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?lu:Bo)],[/(\\+?)\s/g,(e,t)=>{const{length:r}=t;return t.slice(0,r-r%2)+lu}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,r)=>{const n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>jo],[/\\\\/g,()=>jo],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,i)=>t===jo?`\\[${r}${Um(n)}${i}`:i==="]"&&n.length%2===0?`[${Fm(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],hu=Object.create(null),Wm=(e,t)=>{let r=hu[e];return r||(r=Hm.reduce((n,[i,a])=>n.replace(i,a.bind(e)),e),hu[e]=r),t?new RegExp(r,"i"):new RegExp(r)},No=e=>typeof e=="string",qm=e=>e&&No(e)&&!$m.test(e)&&!Im.test(e)&&e.indexOf("#")!==0,Gm=e=>e.split(zm);class Ym{constructor(t,r,n,i){this.origin=t,this.pattern=r,this.negative=n,this.regex=i}}const Zm=(e,t)=>{const r=e;let n=!1;e.indexOf("!")===0&&(n=!0,e=e.substr(1)),e=e.replace(Bm,"!").replace(jm,"#");const i=Wm(e,t);return new Ym(r,e,n,i)},Xm=(e,t)=>{throw new t(e)},Xt=(e,t,r)=>No(e)?e?Xt.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),pu=e=>Nm.test(e);Xt.isNotRelative=pu,Xt.convert=e=>e;class Vm{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){Mm(this,fu,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[fu]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(qm(t)){const r=Zm(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,cu(No(t)?Gm(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,r){let n=!1,i=!1;return this._rules.forEach(a=>{const{negative:o}=a;if(i===o&&n!==i||o&&!n&&!i&&!r)return;a.regex.test(t)&&(n=!o,i=o)}),{ignored:n,unignored:i}}_test(t,r,n,i){const a=t&&Xt.convert(t);return Xt(a,t,this._allowRelativePaths?du:Xm),this._t(a,r,n,i)}_t(t,r,n,i){if(t in r)return r[t];if(i||(i=t.split(zo)),i.pop(),!i.length)return r[t]=this._testOne(t,n);const a=this._t(i.join(zo)+zo,r,n,i);return r[t]=a.ignored?a:this._testOne(t,n)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return cu(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}}const Yi=e=>new Vm(e),Km=e=>Xt(e&&Xt.convert(e),e,du);Yi.isPathValid=Km,Yi.default=Yi;var Jm=Yi;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Xt.convert=e;const t=/^[a-z]:\//i;Xt.isNotRelative=r=>t.test(r)||pu(r)}const Qm=St(Jm);function ew(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nt(e,t,r){return t=t instanceof RegExp?t:new RegExp(ew(t),"g"),e.replace(t,r)}var tw={clean:function(t){if(typeof t!="string")throw new Error("Expected a string, received: "+t);return t=Nt(t,"./","/"),t=Nt(t,"..","."),t=Nt(t," ","-"),t=Nt(t,/^[~^:?*\\\-]/g,""),t=Nt(t,/[~^:?*\\]/g,"-"),t=Nt(t,/[~^:?*\\\-]$/g,""),t=Nt(t,"@{","-"),t=Nt(t,/\.$/g,""),t=Nt(t,/\/$/g,""),t=Nt(t,/\.lock$/g,""),t}},rw=tw;const Mt=St(rw);var nw=function(e,t){var r=e,n=t,i=r.length,a=n.length,o=!1,s=null,l=i+1,c=[],u=[],d=[],p="",m=-1,g=0,v=1,x,b,_=function(){i>=a&&(x=r,b=i,r=n,n=x,i=a,a=b,o=!0,l=i+1)},k=function(O,R,A){return{x:O,y:R,k:A}},S=function(O,R){return{elem:O,t:R}},y=function(O,R,A){var D,j,M;for(R>A?D=c[O-1+l]:D=c[O+1+l],M=Math.max(R,A),j=M-O;j<i&&M<a&&r[j]===n[M];)++j,++M;return c[O+l]=u.length,u[u.length]=new k(j,M,D),M},C=function(O){var R,A,D;for(R=A=0,D=O.length-1;D>=0;--D)for(;R<O[D].x||A<O[D].y;)O[D].y-O[D].x>A-R?(o?d[d.length]=new S(n[A],m):d[d.length]=new S(n[A],v),++A):O[D].y-O[D].x<A-R?(o?d[d.length]=new S(r[R],v):d[d.length]=new S(r[R],m),++R):(d[d.length]=new S(r[R],g),p+=r[R],++R,++A)};return _(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return s},getlcs:function(){return p},getses:function(){return d},compose:function(){var O,R,A,D,j,M,U,Z;for(O=a-i,R=i+a+3,A={},U=0;U<R;++U)A[U]=-1,c[U]=-1;D=-1;do{for(++D,Z=-D;Z<=O-1;++Z)A[Z+l]=y(Z,A[Z-1+l]+1,A[Z+1+l]);for(Z=O+D;Z>=O+1;--Z)A[Z+l]=y(Z,A[Z-1+l]+1,A[Z+1+l]);A[O+l]=y(O,A[O-1+l]+1,A[O+1+l])}while(A[O+l]!==a);for(s=O+2*D,j=c[O+l],M=[];j!==-1;)M[M.length]=new k(u[j].x,u[j].y,null),j=u[j].k;C(M)}}},iw=nw;function aw(e,t){var r=new iw(e,t);r.compose();for(var n=r.getses(),i,a,o=e.length-1,s=t.length-1,l=n.length-1;l>=0;--l)n[l].t===r.SES_COMMON?(a?(a.chain={file1index:o,file2index:s,chain:null},a=a.chain):(i={file1index:o,file2index:s,chain:null},a=i),o--,s--):n[l].t===r.SES_DELETE?o--:n[l].t===r.SES_ADD&&s--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function mu(e,t){for(var r=[],n=e.length,i=t.length,a=aw(e,t);a!==null;a=a.chain){var o=n-a.file1index-1,s=i-a.file2index-1;n=a.file1index,i=a.file2index,(o||s)&&r.push({file1:[n+1,o],file2:[i+1,s]})}return r.reverse(),r}function ow(e,t,r){var n,i=mu(t,e),a=mu(t,r),o=[];function s(U,Z){o.push([U.file1[0],Z,U.file1[1],U.file2[0],U.file2[1]])}for(n=0;n<i.length;n++)s(i[n],0);for(n=0;n<a.length;n++)s(a[n],2);o.sort(function(U,Z){return U[0]-Z[0]});var l=[],c=0;function u(U){U>c&&(l.push([1,c,U-c]),c=U)}for(var d=0;d<o.length;d++){for(var p=d,m=o[d],g=m[0],v=g+m[2];d<o.length-1;){var x=o[d+1],b=x[0];if(b>v)break;v=Math.max(v,b+x[2]),d++}if(u(g),p==d)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var _={0:[e.length,-1,t.length,-1],2:[r.length,-1,t.length,-1]};for(n=p;n<=d;n++){m=o[n];var k=m[1],S=_[k],y=m[0],C=y+m[2],O=m[3],R=O+m[4];S[0]=Math.min(O,S[0]),S[1]=Math.max(R,S[1]),S[2]=Math.min(y,S[2]),S[3]=Math.max(C,S[3])}var A=_[0][0]+(g-_[0][2]),D=_[0][1]+(v-_[0][3]),j=_[2][0]+(g-_[2][2]),M=_[2][1]+(v-_[2][3]);l.push([-1,A,D-A,g,v-g,j,M-j])}c=v}return u(t.length),l}function sw(e,t,r){var n=[],i=[e,t,r],a=ow(e,t,r),o=[];function s(){o.length&&n.push({ok:o}),o=[]}function l(m){for(var g=0;g<m.length;g++)o.push(m[g])}function c(m){if(m[2]!=m[6])return!0;for(var g=m[1],v=m[5],x=0;x<m[2];x++)if(e[x+g]!=r[x+v])return!0;return!1}for(var u=0;u<a.length;u++){var d=a[u],p=d[0];p==-1?c(d)?(s(),n.push({conflict:{a:e.slice(d[1],d[1]+d[2]),aIndex:d[1],o:t.slice(d[3],d[3]+d[4]),oIndex:d[3],b:r.slice(d[5],d[5]+d[6]),bIndex:d[5]}})):l(i[0].slice(d[1],d[1]+d[2])):l(i[p].slice(d[1],d[1]+d[2]))}return s(),n}var cw=sw;const lw=St(cw);class we extends Error{constructor(t){super(t),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){const r=new we(t.message);return r.code=t.code,r.data=t.data,r.caller=t.caller,r.stack=t.stack,r}get isIsomorphicGitError(){return!0}}class Zn extends we{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.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=Zn.code,this.data={filepaths:t}}}Zn.code="UnmergedPathsError";class se extends we{constructor(t){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: ${t}`),this.code=this.name=se.code,this.data={message:t}}}se.code="InternalError";class Qr extends we{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=Qr.code,this.data={filepath:t}}}Qr.code="UnsafeFilepathError";class Lt{constructor(t){this.buffer=t,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(t){this._start=t}slice(t){const r=this.buffer.slice(this._start,this._start+t);return this._start+=t,r}toString(t,r){const n=this.buffer.toString(t,this._start,this._start+r);return this._start+=r,n}write(t,r,n){const i=this.buffer.write(t,this._start,r,n);return this._start+=r,i}copy(t,r,n){const i=t.copy(this.buffer,this._start,r,n);return this._start+=i,i}readUInt8(){const t=this.buffer.readUInt8(this._start);return this._start+=1,t}writeUInt8(t){const r=this.buffer.writeUInt8(t,this._start);return this._start+=1,r}readUInt16BE(){const t=this.buffer.readUInt16BE(this._start);return this._start+=2,t}writeUInt16BE(t){const r=this.buffer.writeUInt16BE(t,this._start);return this._start+=2,r}readUInt32BE(){const t=this.buffer.readUInt32BE(this._start);return this._start+=4,t}writeUInt32BE(t){const r=this.buffer.writeUInt32BE(t,this._start);return this._start+=4,r}}function Zi(e,t){return-(e<t)||+(e>t)}function wu(e,t){return Zi(e.path,t.path)}function gu(e){let t=e>0?e>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let r=e&511;return r&73?r=493:r=420,t!==8&&(r=0),(t<<12)+r}const Ft=2**32;function yu(e,t,r,n){if(e!==void 0&&t!==void 0)return[e,t];r===void 0&&(r=n.valueOf());const i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function en(e){const[t,r]=yu(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[n,i]=yu(e.mtimeSeconds,e.mtimeNanoseconds,e.mtimeMs,e.mtime);return{ctimeSeconds:t%Ft,ctimeNanoseconds:r%Ft,mtimeSeconds:n%Ft,mtimeNanoseconds:i%Ft,dev:e.dev%Ft,ino:e.ino%Ft,mode:gu(e.mode%Ft),uid:e.uid%Ft,gid:e.gid%Ft,size:e.size>-1?e.size%Ft:0}}function uw(e){let t="";for(const r of new Uint8Array(e))r<16&&(t+="0"),t+=r.toString(16);return t}let Mo=null;async function Vt(e){return Mo===null&&(Mo=await dw()),Mo?bu(e):fw(e)}function fw(e){return new Pc().update(e).digest("hex")}async function bu(e){const t=await crypto.subtle.digest("SHA-1",e);return uw(t)}async function dw(){try{if(await bu(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function hw(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function pw(e){const t=e.flags;return t.extended=!1,t.nameLength=Math.min(Buffer.from(e.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}class Ar{constructor(t,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=t||new Map}_addEntry(t){if(t.flags.stage===0)t.stages=[t],this._entries.set(t.path,t),this._unmergedPaths.delete(t.path);else{let r=this._entries.get(t.path);r||(this._entries.set(t.path,t),r=t),r.stages[t.flags.stage]=t,this._unmergedPaths.add(t.path)}}static async from(t){if(Buffer.isBuffer(t))return Ar.fromBuffer(t);if(t===null)return new Ar(null);throw new se("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(t.length===0)throw new se("Index file is empty (.git/index)");const r=new Ar,n=new Lt(t),i=n.toString("utf8",4);if(i!=="DIRC")throw new se(`Invalid dircache magic file number: ${i}`);const a=await Vt(t.slice(0,-20)),o=t.slice(-20).toString("hex");if(o!==a)throw new se(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);const s=n.readUInt32BE();if(s!==2)throw new se(`Unsupported dircache version: ${s}`);const l=n.readUInt32BE();let c=0;for(;!n.eof()&&c<l;){const u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");const d=n.readUInt16BE();u.flags=hw(d);const p=t.indexOf(0,n.tell()+1)-n.tell();if(p<1)throw new se(`Got a path length of: ${p}`);if(u.path=n.toString("utf8",p),u.path.includes("..\\")||u.path.includes("../"))throw new Qr(u.path);let m=8-(n.tell()-12)%8;for(m===0&&(m=8);m--;){const g=n.readUInt8();if(g!==0)throw new se(`Expected 1-8 null characters but got '${g}' after ${u.path}`);if(n.eof())throw new se("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(wu)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(t=>t.stages.length>1?t.stages.filter(r=>r):t)}*[Symbol.iterator](){for(const t of this.entries)yield t}insert({filepath:t,stats:r,oid:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=en(r);const a=Buffer.from(t),o={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:t,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:t}){if(this._entries.has(t))this._entries.delete(t);else for(const r of this._entries.keys())r.startsWith(t+"/")&&this._entries.delete(r);this._unmergedPaths.has(t)&&this._unmergedPaths.delete(t),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:t}){return this._entries.has(t)}render(){return this.entries.map(t=>`${t.mode.toString(8)} ${t.oid} ${t.path}`).join(`
9
+ */(function(e){const t=Ti,r=eo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=_,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&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 a(){try{const w=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(w,f),w.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(w){if(w>i)throw new RangeError('The value "'+w+'" is invalid for option "size"');const f=new Uint8Array(w);return Object.setPrototypeOf(f,s.prototype),f}function s(w,f,h){if(typeof w=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(w)}return l(w,f,h)}s.poolSize=8192;function l(w,f,h){if(typeof w=="string")return p(w,f);if(ArrayBuffer.isView(w))return g(w);if(w==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof w);if(Ue(w,ArrayBuffer)||w&&Ue(w.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ue(w,SharedArrayBuffer)||w&&Ue(w.buffer,SharedArrayBuffer)))return b(w,f,h);if(typeof w=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const E=w.valueOf&&w.valueOf();if(E!=null&&E!==w)return s.from(E,f,h);const T=v(w);if(T)return T;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof w[Symbol.toPrimitive]=="function")return s.from(w[Symbol.toPrimitive]("string"),f,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof w)}s.from=function(w,f,h){return l(w,f,h)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(w){if(typeof w!="number")throw new TypeError('"size" argument must be of type number');if(w<0)throw new RangeError('The value "'+w+'" is invalid for option "size"')}function u(w,f,h){return c(w),w<=0?o(w):f!==void 0?typeof h=="string"?o(w).fill(f,h):o(w).fill(f):o(w)}s.alloc=function(w,f,h){return u(w,f,h)};function d(w){return c(w),o(w<0?0:y(w)|0)}s.allocUnsafe=function(w){return d(w)},s.allocUnsafeSlow=function(w){return d(w)};function p(w,f){if((typeof f!="string"||f==="")&&(f="utf8"),!s.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const h=R(w,f)|0;let E=o(h);const T=E.write(w,f);return T!==h&&(E=E.slice(0,T)),E}function m(w){const f=w.length<0?0:y(w.length)|0,h=o(f);for(let E=0;E<f;E+=1)h[E]=w[E]&255;return h}function g(w){if(Ue(w,Uint8Array)){const f=new Uint8Array(w);return b(f.buffer,f.byteOffset,f.byteLength)}return m(w)}function b(w,f,h){if(f<0||w.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(w.byteLength<f+(h||0))throw new RangeError('"length" is outside of buffer bounds');let E;return f===void 0&&h===void 0?E=new Uint8Array(w):h===void 0?E=new Uint8Array(w,f):E=new Uint8Array(w,f,h),Object.setPrototypeOf(E,s.prototype),E}function v(w){if(s.isBuffer(w)){const f=y(w.length)|0,h=o(f);return h.length===0||w.copy(h,0,0,f),h}if(w.length!==void 0)return typeof w.length!="number"||Pe(w.length)?o(0):m(w);if(w.type==="Buffer"&&Array.isArray(w.data))return m(w.data)}function y(w){if(w>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return w|0}function _(w){return+w!=w&&(w=0),s.alloc(+w)}s.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==s.prototype},s.compare=function(f,h){if(Ue(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),Ue(h,Uint8Array)&&(h=s.from(h,h.offset,h.byteLength)),!s.isBuffer(f)||!s.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===h)return 0;let E=f.length,T=h.length;for(let j=0,z=Math.min(E,T);j<z;++j)if(f[j]!==h[j]){E=f[j],T=h[j];break}return E<T?-1:T<E?1:0},s.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(f,h){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return s.alloc(0);let E;if(h===void 0)for(h=0,E=0;E<f.length;++E)h+=f[E].length;const T=s.allocUnsafe(h);let j=0;for(E=0;E<f.length;++E){let z=f[E];if(Ue(z,Uint8Array))j+z.length>T.length?(s.isBuffer(z)||(z=s.from(z)),z.copy(T,j)):Uint8Array.prototype.set.call(T,z,j);else if(s.isBuffer(z))z.copy(T,j);else throw new TypeError('"list" argument must be an Array of Buffers');j+=z.length}return T};function R(w,f){if(s.isBuffer(w))return w.length;if(ArrayBuffer.isView(w)||Ue(w,ArrayBuffer))return w.byteLength;if(typeof w!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof w);const h=w.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&h===0)return 0;let T=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return ne(w).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return Ee(w).length;default:if(T)return E?-1:ne(w).length;f=(""+f).toLowerCase(),T=!0}}s.byteLength=R;function C(w,f,h){let E=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,f>>>=0,h<=f))return"";for(w||(w="utf8");;)switch(w){case"hex":return Je(this,f,h);case"utf8":case"utf-8":return Z(this,f,h);case"ascii":return ge(this,f,h);case"latin1":case"binary":return xe(this,f,h);case"base64":return U(this,f,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qe(this,f,h);default:if(E)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),E=!0}}s.prototype._isBuffer=!0;function x(w,f,h){const E=w[f];w[f]=w[h],w[h]=E}s.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let h=0;h<f;h+=2)x(this,h,h+1);return this},s.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let h=0;h<f;h+=4)x(this,h,h+3),x(this,h+1,h+2);return this},s.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let h=0;h<f;h+=8)x(this,h,h+7),x(this,h+1,h+6),x(this,h+2,h+5),x(this,h+3,h+4);return this},s.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?Z(this,0,f):C.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(f){if(!s.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:s.compare(this,f)===0},s.prototype.inspect=function(){let f="";const h=e.INSPECT_MAX_BYTES;return f=this.toString("hex",0,h).replace(/(.{2})/g,"$1 ").trim(),this.length>h&&(f+=" ... "),"<Buffer "+f+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(f,h,E,T,j){if(Ue(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(h===void 0&&(h=0),E===void 0&&(E=f?f.length:0),T===void 0&&(T=0),j===void 0&&(j=this.length),h<0||E>f.length||T<0||j>this.length)throw new RangeError("out of range index");if(T>=j&&h>=E)return 0;if(T>=j)return-1;if(h>=E)return 1;if(h>>>=0,E>>>=0,T>>>=0,j>>>=0,this===f)return 0;let z=j-T,pe=E-h;const Be=Math.min(z,pe),Ie=this.slice(T,j),ze=f.slice(h,E);for(let Ce=0;Ce<Be;++Ce)if(Ie[Ce]!==ze[Ce]){z=Ie[Ce],pe=ze[Ce];break}return z<pe?-1:pe<z?1:0};function O(w,f,h,E,T){if(w.length===0)return-1;if(typeof h=="string"?(E=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Pe(h)&&(h=T?0:w.length-1),h<0&&(h=w.length+h),h>=w.length){if(T)return-1;h=w.length-1}else if(h<0)if(T)h=0;else return-1;if(typeof f=="string"&&(f=s.from(f,E)),s.isBuffer(f))return f.length===0?-1:k(w,f,h,E,T);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?T?Uint8Array.prototype.indexOf.call(w,f,h):Uint8Array.prototype.lastIndexOf.call(w,f,h):k(w,[f],h,E,T);throw new TypeError("val must be string, number or Buffer")}function k(w,f,h,E,T){let j=1,z=w.length,pe=f.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(w.length<2||f.length<2)return-1;j=2,z/=2,pe/=2,h/=2}function Be(ze,Ce){return j===1?ze[Ce]:ze.readUInt16BE(Ce*j)}let Ie;if(T){let ze=-1;for(Ie=h;Ie<z;Ie++)if(Be(w,Ie)===Be(f,ze===-1?0:Ie-ze)){if(ze===-1&&(ze=Ie),Ie-ze+1===pe)return ze*j}else ze!==-1&&(Ie-=Ie-ze),ze=-1}else for(h+pe>z&&(h=z-pe),Ie=h;Ie>=0;Ie--){let ze=!0;for(let Ce=0;Ce<pe;Ce++)if(Be(w,Ie+Ce)!==Be(f,Ce)){ze=!1;break}if(ze)return Ie}return-1}s.prototype.includes=function(f,h,E){return this.indexOf(f,h,E)!==-1},s.prototype.indexOf=function(f,h,E){return O(this,f,h,E,!0)},s.prototype.lastIndexOf=function(f,h,E){return O(this,f,h,E,!1)};function S(w,f,h,E){h=Number(h)||0;const T=w.length-h;E?(E=Number(E),E>T&&(E=T)):E=T;const j=f.length;E>j/2&&(E=j/2);let z;for(z=0;z<E;++z){const pe=parseInt(f.substr(z*2,2),16);if(Pe(pe))return z;w[h+z]=pe}return z}function A(w,f,h,E){return Et(ne(f,w.length-h),w,h,E)}function D(w,f,h,E){return Et(ie(f),w,h,E)}function B(w,f,h,E){return Et(Ee(f),w,h,E)}function M(w,f,h,E){return Et(Re(f,w.length-h),w,h,E)}s.prototype.write=function(f,h,E,T){if(h===void 0)T="utf8",E=this.length,h=0;else if(E===void 0&&typeof h=="string")T=h,E=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(E)?(E=E>>>0,T===void 0&&(T="utf8")):(T=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const j=this.length-h;if((E===void 0||E>j)&&(E=j),f.length>0&&(E<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let z=!1;for(;;)switch(T){case"hex":return S(this,f,h,E);case"utf8":case"utf-8":return A(this,f,h,E);case"ascii":case"latin1":case"binary":return D(this,f,h,E);case"base64":return B(this,f,h,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,f,h,E);default:if(z)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),z=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function U(w,f,h){return f===0&&h===w.length?t.fromByteArray(w):t.fromByteArray(w.slice(f,h))}function Z(w,f,h){h=Math.min(w.length,h);const E=[];let T=f;for(;T<h;){const j=w[T];let z=null,pe=j>239?4:j>223?3:j>191?2:1;if(T+pe<=h){let Be,Ie,ze,Ce;switch(pe){case 1:j<128&&(z=j);break;case 2:Be=w[T+1],(Be&192)===128&&(Ce=(j&31)<<6|Be&63,Ce>127&&(z=Ce));break;case 3:Be=w[T+1],Ie=w[T+2],(Be&192)===128&&(Ie&192)===128&&(Ce=(j&15)<<12|(Be&63)<<6|Ie&63,Ce>2047&&(Ce<55296||Ce>57343)&&(z=Ce));break;case 4:Be=w[T+1],Ie=w[T+2],ze=w[T+3],(Be&192)===128&&(Ie&192)===128&&(ze&192)===128&&(Ce=(j&15)<<18|(Be&63)<<12|(Ie&63)<<6|ze&63,Ce>65535&&Ce<1114112&&(z=Ce))}}z===null?(z=65533,pe=1):z>65535&&(z-=65536,E.push(z>>>10&1023|55296),z=56320|z&1023),E.push(z),T+=pe}return $e(E)}const de=4096;function $e(w){const f=w.length;if(f<=de)return String.fromCharCode.apply(String,w);let h="",E=0;for(;E<f;)h+=String.fromCharCode.apply(String,w.slice(E,E+=de));return h}function ge(w,f,h){let E="";h=Math.min(w.length,h);for(let T=f;T<h;++T)E+=String.fromCharCode(w[T]&127);return E}function xe(w,f,h){let E="";h=Math.min(w.length,h);for(let T=f;T<h;++T)E+=String.fromCharCode(w[T]);return E}function Je(w,f,h){const E=w.length;(!f||f<0)&&(f=0),(!h||h<0||h>E)&&(h=E);let T="";for(let j=f;j<h;++j)T+=oe[w[j]];return T}function Qe(w,f,h){const E=w.slice(f,h);let T="";for(let j=0;j<E.length-1;j+=2)T+=String.fromCharCode(E[j]+E[j+1]*256);return T}s.prototype.slice=function(f,h){const E=this.length;f=~~f,h=h===void 0?E:~~h,f<0?(f+=E,f<0&&(f=0)):f>E&&(f=E),h<0?(h+=E,h<0&&(h=0)):h>E&&(h=E),h<f&&(h=f);const T=this.subarray(f,h);return Object.setPrototypeOf(T,s.prototype),T};function fe(w,f,h){if(w%1!==0||w<0)throw new RangeError("offset is not uint");if(w+f>h)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=this[f],j=1,z=0;for(;++z<h&&(j*=256);)T+=this[f+z]*j;return T},s.prototype.readUintBE=s.prototype.readUIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=this[f+--h],j=1;for(;h>0&&(j*=256);)T+=this[f+--h]*j;return T},s.prototype.readUint8=s.prototype.readUInt8=function(f,h){return f=f>>>0,h||fe(f,1,this.length),this[f]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(f,h){return f=f>>>0,h||fe(f,2,this.length),this[f]|this[f+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(f,h){return f=f>>>0,h||fe(f,2,this.length),this[f]<<8|this[f+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},s.prototype.readBigUInt64LE=Se(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&re(f,this.length-8);const T=h+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,j=this[++f]+this[++f]*2**8+this[++f]*2**16+E*2**24;return BigInt(T)+(BigInt(j)<<BigInt(32))}),s.prototype.readBigUInt64BE=Se(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&re(f,this.length-8);const T=h*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],j=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+E;return(BigInt(T)<<BigInt(32))+BigInt(j)}),s.prototype.readIntLE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=this[f],j=1,z=0;for(;++z<h&&(j*=256);)T+=this[f+z]*j;return j*=128,T>=j&&(T-=Math.pow(2,8*h)),T},s.prototype.readIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||fe(f,h,this.length);let T=h,j=1,z=this[f+--T];for(;T>0&&(j*=256);)z+=this[f+--T]*j;return j*=128,z>=j&&(z-=Math.pow(2,8*h)),z},s.prototype.readInt8=function(f,h){return f=f>>>0,h||fe(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},s.prototype.readInt16LE=function(f,h){f=f>>>0,h||fe(f,2,this.length);const E=this[f]|this[f+1]<<8;return E&32768?E|4294901760:E},s.prototype.readInt16BE=function(f,h){f=f>>>0,h||fe(f,2,this.length);const E=this[f+1]|this[f]<<8;return E&32768?E|4294901760:E},s.prototype.readInt32LE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},s.prototype.readInt32BE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},s.prototype.readBigInt64LE=Se(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&re(f,this.length-8);const T=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(E<<24);return(BigInt(T)<<BigInt(32))+BigInt(h+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),s.prototype.readBigInt64BE=Se(function(f){f=f>>>0,V(f,"offset");const h=this[f],E=this[f+7];(h===void 0||E===void 0)&&re(f,this.length-8);const T=(h<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(T)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+E)}),s.prototype.readFloatLE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),r.read(this,f,!0,23,4)},s.prototype.readFloatBE=function(f,h){return f=f>>>0,h||fe(f,4,this.length),r.read(this,f,!1,23,4)},s.prototype.readDoubleLE=function(f,h){return f=f>>>0,h||fe(f,8,this.length),r.read(this,f,!0,52,8)},s.prototype.readDoubleBE=function(f,h){return f=f>>>0,h||fe(f,8,this.length),r.read(this,f,!1,52,8)};function F(w,f,h,E,T,j){if(!s.isBuffer(w))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>T||f<j)throw new RangeError('"value" argument is out of bounds');if(h+E>w.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(f,h,E,T){if(f=+f,h=h>>>0,E=E>>>0,!T){const pe=Math.pow(2,8*E)-1;F(this,f,h,E,pe,0)}let j=1,z=0;for(this[h]=f&255;++z<E&&(j*=256);)this[h+z]=f/j&255;return h+E},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(f,h,E,T){if(f=+f,h=h>>>0,E=E>>>0,!T){const pe=Math.pow(2,8*E)-1;F(this,f,h,E,pe,0)}let j=E-1,z=1;for(this[h+j]=f&255;--j>=0&&(z*=256);)this[h+j]=f/z&255;return h+E},s.prototype.writeUint8=s.prototype.writeUInt8=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,1,255,0),this[h]=f&255,h+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,65535,0),this[h]=f&255,this[h+1]=f>>>8,h+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,65535,0),this[h]=f>>>8,this[h+1]=f&255,h+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,4294967295,0),this[h+3]=f>>>24,this[h+2]=f>>>16,this[h+1]=f>>>8,this[h]=f&255,h+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,4294967295,0),this[h]=f>>>24,this[h+1]=f>>>16,this[h+2]=f>>>8,this[h+3]=f&255,h+4};function q(w,f,h,E,T){L(f,E,T,w,h,7);let j=Number(f&BigInt(4294967295));w[h++]=j,j=j>>8,w[h++]=j,j=j>>8,w[h++]=j,j=j>>8,w[h++]=j;let z=Number(f>>BigInt(32)&BigInt(4294967295));return w[h++]=z,z=z>>8,w[h++]=z,z=z>>8,w[h++]=z,z=z>>8,w[h++]=z,h}function W(w,f,h,E,T){L(f,E,T,w,h,7);let j=Number(f&BigInt(4294967295));w[h+7]=j,j=j>>8,w[h+6]=j,j=j>>8,w[h+5]=j,j=j>>8,w[h+4]=j;let z=Number(f>>BigInt(32)&BigInt(4294967295));return w[h+3]=z,z=z>>8,w[h+2]=z,z=z>>8,w[h+1]=z,z=z>>8,w[h]=z,h+8}s.prototype.writeBigUInt64LE=Se(function(f,h=0){return q(this,f,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Se(function(f,h=0){return W(this,f,h,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(f,h,E,T){if(f=+f,h=h>>>0,!T){const Be=Math.pow(2,8*E-1);F(this,f,h,E,Be-1,-Be)}let j=0,z=1,pe=0;for(this[h]=f&255;++j<E&&(z*=256);)f<0&&pe===0&&this[h+j-1]!==0&&(pe=1),this[h+j]=(f/z>>0)-pe&255;return h+E},s.prototype.writeIntBE=function(f,h,E,T){if(f=+f,h=h>>>0,!T){const Be=Math.pow(2,8*E-1);F(this,f,h,E,Be-1,-Be)}let j=E-1,z=1,pe=0;for(this[h+j]=f&255;--j>=0&&(z*=256);)f<0&&pe===0&&this[h+j+1]!==0&&(pe=1),this[h+j]=(f/z>>0)-pe&255;return h+E},s.prototype.writeInt8=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,1,127,-128),f<0&&(f=255+f+1),this[h]=f&255,h+1},s.prototype.writeInt16LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,32767,-32768),this[h]=f&255,this[h+1]=f>>>8,h+2},s.prototype.writeInt16BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,2,32767,-32768),this[h]=f>>>8,this[h+1]=f&255,h+2},s.prototype.writeInt32LE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,2147483647,-2147483648),this[h]=f&255,this[h+1]=f>>>8,this[h+2]=f>>>16,this[h+3]=f>>>24,h+4},s.prototype.writeInt32BE=function(f,h,E){return f=+f,h=h>>>0,E||F(this,f,h,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[h]=f>>>24,this[h+1]=f>>>16,this[h+2]=f>>>8,this[h+3]=f&255,h+4},s.prototype.writeBigInt64LE=Se(function(f,h=0){return q(this,f,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Se(function(f,h=0){return W(this,f,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function te(w,f,h,E,T,j){if(h+E>w.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}function I(w,f,h,E,T){return f=+f,h=h>>>0,T||te(w,f,h,4),r.write(w,f,h,E,23,4),h+4}s.prototype.writeFloatLE=function(f,h,E){return I(this,f,h,!0,E)},s.prototype.writeFloatBE=function(f,h,E){return I(this,f,h,!1,E)};function ee(w,f,h,E,T){return f=+f,h=h>>>0,T||te(w,f,h,8),r.write(w,f,h,E,52,8),h+8}s.prototype.writeDoubleLE=function(f,h,E){return ee(this,f,h,!0,E)},s.prototype.writeDoubleBE=function(f,h,E){return ee(this,f,h,!1,E)},s.prototype.copy=function(f,h,E,T){if(!s.isBuffer(f))throw new TypeError("argument should be a Buffer");if(E||(E=0),!T&&T!==0&&(T=this.length),h>=f.length&&(h=f.length),h||(h=0),T>0&&T<E&&(T=E),T===E||f.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),f.length-h<T-E&&(T=f.length-h+E);const j=T-E;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(h,E,T):Uint8Array.prototype.set.call(f,this.subarray(E,T),h),j},s.prototype.fill=function(f,h,E,T){if(typeof f=="string"){if(typeof h=="string"?(T=h,h=0,E=this.length):typeof E=="string"&&(T=E,E=this.length),T!==void 0&&typeof T!="string")throw new TypeError("encoding must be a string");if(typeof T=="string"&&!s.isEncoding(T))throw new TypeError("Unknown encoding: "+T);if(f.length===1){const z=f.charCodeAt(0);(T==="utf8"&&z<128||T==="latin1")&&(f=z)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(h<0||this.length<h||this.length<E)throw new RangeError("Out of range index");if(E<=h)return this;h=h>>>0,E=E===void 0?this.length:E>>>0,f||(f=0);let j;if(typeof f=="number")for(j=h;j<E;++j)this[j]=f;else{const z=s.isBuffer(f)?f:s.from(f,T),pe=z.length;if(pe===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(j=0;j<E-h;++j)this[j+h]=z[j%pe]}return this};const $={};function G(w,f,h){$[w]=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${w}]`,this.stack,delete this.name}get code(){return w}set code(T){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:T,writable:!0})}toString(){return`${this.name} [${w}]: ${this.message}`}}}G("ERR_BUFFER_OUT_OF_BOUNDS",function(w){return w?`${w} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(w,f){return`The "${w}" argument must be of type number. Received type ${typeof f}`},TypeError),G("ERR_OUT_OF_RANGE",function(w,f,h){let E=`The value of "${w}" is out of range.`,T=h;return Number.isInteger(h)&&Math.abs(h)>2**32?T=X(String(h)):typeof h=="bigint"&&(T=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(T=X(T)),T+="n"),E+=` It must be ${f}. Received ${T}`,E},RangeError);function X(w){let f="",h=w.length;const E=w[0]==="-"?1:0;for(;h>=E+4;h-=3)f=`_${w.slice(h-3,h)}${f}`;return`${w.slice(0,h)}${f}`}function Y(w,f,h){V(f,"offset"),(w[f]===void 0||w[f+h]===void 0)&&re(f,w.length-(h+1))}function L(w,f,h,E,T,j){if(w>h||w<f){const z=typeof f=="bigint"?"n":"";let pe;throw f===0||f===BigInt(0)?pe=`>= 0${z} and < 2${z} ** ${(j+1)*8}${z}`:pe=`>= -(2${z} ** ${(j+1)*8-1}${z}) and < 2 ** ${(j+1)*8-1}${z}`,new $.ERR_OUT_OF_RANGE("value",pe,w)}Y(E,T,j)}function V(w,f){if(typeof w!="number")throw new $.ERR_INVALID_ARG_TYPE(f,"number",w)}function re(w,f,h){throw Math.floor(w)!==w?(V(w,h),new $.ERR_OUT_OF_RANGE("offset","an integer",w)):f<0?new $.ERR_BUFFER_OUT_OF_BOUNDS:new $.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,w)}const J=/[^+/0-9A-Za-z-_]/g;function ce(w){if(w=w.split("=")[0],w=w.trim().replace(J,""),w.length<2)return"";for(;w.length%4!==0;)w=w+"=";return w}function ne(w,f){f=f||1/0;let h;const E=w.length;let T=null;const j=[];for(let z=0;z<E;++z){if(h=w.charCodeAt(z),h>55295&&h<57344){if(!T){if(h>56319){(f-=3)>-1&&j.push(239,191,189);continue}else if(z+1===E){(f-=3)>-1&&j.push(239,191,189);continue}T=h;continue}if(h<56320){(f-=3)>-1&&j.push(239,191,189),T=h;continue}h=(T-55296<<10|h-56320)+65536}else T&&(f-=3)>-1&&j.push(239,191,189);if(T=null,h<128){if((f-=1)<0)break;j.push(h)}else if(h<2048){if((f-=2)<0)break;j.push(h>>6|192,h&63|128)}else if(h<65536){if((f-=3)<0)break;j.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((f-=4)<0)break;j.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return j}function ie(w){const f=[];for(let h=0;h<w.length;++h)f.push(w.charCodeAt(h)&255);return f}function Re(w,f){let h,E,T;const j=[];for(let z=0;z<w.length&&!((f-=2)<0);++z)h=w.charCodeAt(z),E=h>>8,T=h%256,j.push(T),j.push(E);return j}function Ee(w){return t.toByteArray(ce(w))}function Et(w,f,h,E){let T;for(T=0;T<E&&!(T+h>=f.length||T>=w.length);++T)f[T+h]=w[T];return T}function Ue(w,f){return w instanceof f||w!=null&&w.constructor!=null&&w.constructor.name!=null&&w.constructor.name===f.name}function Pe(w){return w!==w}const oe=function(){const w="0123456789abcdef",f=new Array(256);for(let h=0;h<16;++h){const E=h*16;for(let T=0;T<16;++T)f[E+T]=w[h]+w[T]}return f}();function Se(w){return typeof BigInt>"u"?Oi:w}function Oi(){throw new Error("BigInt not supported")}})(Ja);function bp(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function _p(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:bp(e)}async function vp(e,t){const r=_p(e);for(;;){const{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function xp(e){let t=0;const r=[];await vp(e,a=>{r.push(a),t+=a.byteLength});const n=new Uint8Array(t);let i=0;for(const a of r)n.set(a,i),i+=a.byteLength;return n}function Ep(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}async function Sp({onProgress:e,url:t,method:r="GET",headers:n={},body:i}){i&&(i=await xp(i));const a=await fetch(t,{method:r,headers:n,body:i}),o=a.body&&a.body.getReader?Ep(a.body):[new Uint8Array(await a.arrayBuffer())];n={};for(const[s,l]of a.headers.entries())n[s]=l;return{url:a.url,method:a.method,statusCode:a.status,statusMessage:a.statusText,body:o,headers:n}}var to={request:Sp},ht=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||ht.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||ht.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||ht.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=ht.DEFAULT_MAX_PENDING};ht.DEFAULT_TIMEOUT=0,ht.DEFAULT_MAX_OCCUPATION_TIME=0,ht.DEFAULT_MAX_EXECUTION_TIME=0,ht.DEFAULT_MAX_PENDING=1e3,ht.prototype.acquire=function(e,t,r,n){if(Array.isArray(e))return this._acquireBatch(e,t,r,n);if(typeof t!="function")throw new Error("You must pass a function to execute");var i=null,a=null,o=null;typeof r!="function"&&(n=r,r=null,o=new this.Promise(function(_,R){i=_,a=R})),n=n||{};var s=!1,l=null,c=null,u=null,d=this,p=function(_,R,C){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),_&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||(o?R?a(R):i(C):typeof r=="function"&&r(R,C),s=!0),_&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},m=function(_){if(s)return p(_);l&&(clearTimeout(l),l=null),d.domainReentrant&&_&&(d.domains[e]=process.domain);var R=n.maxExecutionTime||d.maxExecutionTime;if(R&&(u=setTimeout(function(){d.queues[e]&&p(_,new Error("Maximum execution time is exceeded "+e))},R)),t.length===1){var C=!1;try{t(function(x,O){C||(C=!0,p(_,x,O))})}catch(x){C||(C=!0,p(_,x))}}else d._promiseTry(function(){return t()}).then(function(x){p(_,void 0,x)},function(x){p(_,x)})};d.domainReentrant&&process.domain&&(m=process.domain.bind(m));var g=n.maxPending||d.maxPending;if(!d.queues[e])d.queues[e]=[],m(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[e])m(!1);else if(d.queues[e].length>=g)p(!1,new Error("Too many pending tasks in queue "+e));else{var b=function(){m(!0)};n.skipQueue?d.queues[e].unshift(b):d.queues[e].push(b);var v=n.timeout||d.timeout;v&&(l=setTimeout(function(){l=null,p(!1,new Error("async-lock timed out in queue "+e))},v))}var y=n.maxOccupationTime||d.maxOccupationTime;if(y&&(c=setTimeout(function(){d.queues[e]&&p(!1,new Error("Maximum occupation time is exceeded in queue "+e))},y)),o)return o},ht.prototype._acquireBatch=function(e,t,r,n){typeof r!="function"&&(n=r,r=null);var i=this,a=function(s,l){return function(c){i.acquire(s,l,c,n)}},o=e.reduceRight(function(s,l){return a(l,s)},t);if(typeof r=="function")o(r);else return new this.Promise(function(s,l){o.length===1?o(function(c,u){c?l(c):s(u)}):s(o())})},ht.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},ht.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(t){return this.Promise.reject(t)}};var kp=ht,Rp=kp;const Tn=St(Rp);var ro={exports:{}};typeof Object.create=="function"?ro.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ro.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}};var Op=ro.exports,no={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var r=Ja,n=r.Buffer;function i(o,s){for(var l in o)s[l]=o[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a);function a(o,s,l){return n(o,s,l)}a.prototype=Object.create(n.prototype),i(n,a),a.from=function(o,s,l){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,s,l)},a.alloc=function(o,s,l){if(typeof o!="number")throw new TypeError("Argument must be a number");var c=n(o);return s!==void 0?typeof l=="string"?c.fill(s,l):c.fill(s):c.fill(0),c},a.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},a.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(no,no.exports);var Oc=no.exports,Cc=Oc.Buffer;function Ai(e,t){this._block=Cc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Ai.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=Cc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,a=this._len,o=0;o<i;){for(var s=a%n,l=Math.min(i-o,n-s),c=0;c<l;c++)r[s+c]=e[o+c];a+=l,o+=l,a%n===0&&this._update(r)}return this._len+=i,this},Ai.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},Ai.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Cp=Ai,Pp=Op,Pc=Cp,Tp=Oc.Buffer,Ap=[1518500249,1859775393,-1894007588,-899497514],Dp=new Array(80);function An(){this.init(),this._w=Dp,Pc.call(this,64,56)}Pp(An,Pc),An.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function $p(e){return e<<1|e>>>31}function Ip(e){return e<<5|e>>>27}function jp(e){return e<<30|e>>>2}function Bp(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}An.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,a=this._d|0,o=this._e|0,s=0;s<16;++s)t[s]=e.readInt32BE(s*4);for(;s<80;++s)t[s]=$p(t[s-3]^t[s-8]^t[s-14]^t[s-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=Ip(r)+Bp(c,n,i,a)+o+t[l]+Ap[c]|0;o=a,a=i,i=jp(n),n=r,r=u}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=o+this._e|0},An.prototype._hash=function(){var e=Tp.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var zp=An;const Tc=St(zp);function Dt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function Ac(e,t){for(var r="",n=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=s,a=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=s,a=0;continue}}t&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+e.slice(i+1,s):r=e.slice(i+1,s),n=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return r}function Np(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}var Hr={resolve:function(){for(var t="",r=!1,n,i=arguments.length-1;i>=-1&&!r;i--){var a;i>=0?a=arguments[i]:(n===void 0&&(n=process.cwd()),a=n),Dt(a),a.length!==0&&(t=a+"/"+t,r=a.charCodeAt(0)===47)}return t=Ac(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if(Dt(t),t.length===0)return".";var r=t.charCodeAt(0)===47,n=t.charCodeAt(t.length-1)===47;return t=Ac(t,!r),t.length===0&&!r&&(t="."),t.length>0&&n&&(t+="/"),r?"/"+t:t},isAbsolute:function(t){return Dt(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,r=0;r<arguments.length;++r){var n=arguments[r];Dt(n),n.length>0&&(t===void 0?t=n:t+="/"+n)}return t===void 0?".":Hr.normalize(t)},relative:function(t,r){if(Dt(t),Dt(r),t===r||(t=Hr.resolve(t),r=Hr.resolve(r),t===r))return"";for(var n=1;n<t.length&&t.charCodeAt(n)===47;++n);for(var i=t.length,a=i-n,o=1;o<r.length&&r.charCodeAt(o)===47;++o);for(var s=r.length,l=s-o,c=a<l?a:l,u=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(r.charCodeAt(o+d)===47)return r.slice(o+d+1);if(d===0)return r.slice(o+d)}else a>c&&(t.charCodeAt(n+d)===47?u=d:d===0&&(u=0));break}var p=t.charCodeAt(n+d),m=r.charCodeAt(o+d);if(p!==m)break;p===47&&(u=d)}var g="";for(d=n+u+1;d<=i;++d)(d===i||t.charCodeAt(d)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+r.slice(o+u):(o+=u,r.charCodeAt(o)===47&&++o,r.slice(o))},_makeLong:function(t){return t},dirname:function(t){if(Dt(t),t.length===0)return".";for(var r=t.charCodeAt(0),n=r===47,i=-1,a=!0,o=t.length-1;o>=1;--o)if(r=t.charCodeAt(o),r===47){if(!a){i=o;break}}else a=!1;return i===-1?n?"/":".":n&&i===1?"//":t.slice(0,i)},basename:function(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Dt(t);var n=0,i=-1,a=!0,o;if(r!==void 0&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var s=r.length-1,l=-1;for(o=t.length-1;o>=0;--o){var c=t.charCodeAt(o);if(c===47){if(!a){n=o+1;break}}else l===-1&&(a=!1,l=o+1),s>=0&&(c===r.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=l))}return n===i?i=l:i===-1&&(i=t.length),t.slice(n,i)}else{for(o=t.length-1;o>=0;--o)if(t.charCodeAt(o)===47){if(!a){n=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?"":t.slice(n,i)}},extname:function(t){Dt(t);for(var r=-1,n=0,i=-1,a=!0,o=0,s=t.length-1;s>=0;--s){var l=t.charCodeAt(s);if(l===47){if(!a){n=s+1;break}continue}i===-1&&(a=!1,i=s+1),l===46?r===-1?r=s:o!==1&&(o=1):r!==-1&&(o=-1)}return r===-1||i===-1||o===0||o===1&&r===i-1&&r===n+1?"":t.slice(r,i)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return Np("/",t)},parse:function(t){Dt(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return r;var n=t.charCodeAt(0),i=n===47,a;i?(r.root="/",a=1):a=0;for(var o=-1,s=0,l=-1,c=!0,u=t.length-1,d=0;u>=a;--u){if(n=t.charCodeAt(u),n===47){if(!c){s=u+1;break}continue}l===-1&&(c=!1,l=u+1),n===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1)}return o===-1||l===-1||d===0||d===1&&o===l-1&&o===s+1?l!==-1&&(s===0&&i?r.base=r.name=t.slice(1,l):r.base=r.name=t.slice(s,l)):(s===0&&i?(r.name=t.slice(1,o),r.base=t.slice(1,l)):(r.name=t.slice(s,o),r.base=t.slice(s,l)),r.ext=t.slice(o,l)),s>0?r.dir=t.slice(0,s-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};Hr.posix=Hr;var N=Hr,Dc={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */(function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="1.2.2";function r(){for(var S=0,A=new Array(256),D=0;D!=256;++D)S=D,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,A[D]=S;return typeof Int32Array<"u"?new Int32Array(A):A}var n=r();function i(S){var A=0,D=0,B=0,M=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(B=0;B!=256;++B)M[B]=S[B];for(B=0;B!=256;++B)for(D=S[B],A=256+B;A<4096;A+=256)D=M[A]=D>>>8^S[D&255];var U=[];for(B=1;B!=16;++B)U[B-1]=typeof Int32Array<"u"?M.subarray(B*256,B*256+256):M.slice(B*256,B*256+256);return U}var a=i(n),o=a[0],s=a[1],l=a[2],c=a[3],u=a[4],d=a[5],p=a[6],m=a[7],g=a[8],b=a[9],v=a[10],y=a[11],_=a[12],R=a[13],C=a[14];function x(S,A){for(var D=A^-1,B=0,M=S.length;B<M;)D=D>>>8^n[(D^S.charCodeAt(B++))&255];return~D}function O(S,A){for(var D=A^-1,B=S.length-15,M=0;M<B;)D=C[S[M++]^D&255]^R[S[M++]^D>>8&255]^_[S[M++]^D>>16&255]^y[S[M++]^D>>>24]^v[S[M++]]^b[S[M++]]^g[S[M++]]^m[S[M++]]^p[S[M++]]^d[S[M++]]^u[S[M++]]^c[S[M++]]^l[S[M++]]^s[S[M++]]^o[S[M++]]^n[S[M++]];for(B+=15;M<B;)D=D>>>8^n[(D^S[M++])&255];return~D}function k(S,A){for(var D=A^-1,B=0,M=S.length,U=0,Z=0;B<M;)U=S.charCodeAt(B++),U<128?D=D>>>8^n[(D^U)&255]:U<2048?(D=D>>>8^n[(D^(192|U>>6&31))&255],D=D>>>8^n[(D^(128|U&63))&255]):U>=55296&&U<57344?(U=(U&1023)+64,Z=S.charCodeAt(B++)&1023,D=D>>>8^n[(D^(240|U>>8&7))&255],D=D>>>8^n[(D^(128|U>>2&63))&255],D=D>>>8^n[(D^(128|Z>>6&15|(U&3)<<4))&255],D=D>>>8^n[(D^(128|Z&63))&255]):(D=D>>>8^n[(D^(224|U>>12&15))&255],D=D>>>8^n[(D^(128|U>>6&63))&255],D=D>>>8^n[(D^(128|U&63))&255]);return~D}t.table=n,t.bstr=x,t.buf=O,t.str=k})})(Dc);const Mp=St(Dc);var Gt={};(function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function r(a,o){return Object.prototype.hasOwnProperty.call(a,o)}e.assign=function(a){for(var o=Array.prototype.slice.call(arguments,1);o.length;){var s=o.shift();if(s){if(typeof s!="object")throw new TypeError(s+"must be non-object");for(var l in s)r(s,l)&&(a[l]=s[l])}}return a},e.shrinkBuf=function(a,o){return a.length===o?a:a.subarray?a.subarray(0,o):(a.length=o,a)};var n={arraySet:function(a,o,s,l,c){if(o.subarray&&a.subarray){a.set(o.subarray(s,s+l),c);return}for(var u=0;u<l;u++)a[c+u]=o[s+u]},flattenChunks:function(a){var o,s,l,c,u,d;for(l=0,o=0,s=a.length;o<s;o++)l+=a[o].length;for(d=new Uint8Array(l),c=0,o=0,s=a.length;o<s;o++)u=a[o],d.set(u,c),c+=u.length;return d}},i={arraySet:function(a,o,s,l,c){for(var u=0;u<l;u++)a[c+u]=o[s+u]},flattenChunks:function(a){return[].concat.apply([],a)}};e.setTyped=function(a){a?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)})(Gt);var Dn={},$t={},Wr={},Lp=Gt,Fp=4,$c=0,Ic=1,Up=2;function qr(e){for(var t=e.length;--t>=0;)e[t]=0}var Hp=0,jc=1,Wp=2,qp=3,Gp=258,io=29,$n=256,In=$n+1+io,Gr=30,ao=19,Bc=2*In+1,xr=15,oo=16,Yp=7,so=256,zc=16,Nc=17,Mc=18,co=[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],Di=[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],Zp=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Lc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Xp=512,Yt=new Array((In+2)*2);qr(Yt);var jn=new Array(Gr*2);qr(jn);var Bn=new Array(Xp);qr(Bn);var zn=new Array(Gp-qp+1);qr(zn);var lo=new Array(io);qr(lo);var $i=new Array(Gr);qr($i);function uo(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var Fc,Uc,Hc;function fo(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Wc(e){return e<256?Bn[e]:Bn[256+(e>>>7)]}function Nn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function st(e,t,r){e.bi_valid>oo-r?(e.bi_buf|=t<<e.bi_valid&65535,Nn(e,e.bi_buf),e.bi_buf=t>>oo-e.bi_valid,e.bi_valid+=r-oo):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function It(e,t,r){st(e,r[t*2],r[t*2+1])}function qc(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Vp(e){e.bi_valid===16?(Nn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Kp(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,u,d,p,m,g,b=0;for(p=0;p<=xr;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<Bc;c++)u=e.heap[c],p=r[r[u*2+1]*2+1]+1,p>l&&(p=l,b++),r[u*2+1]=p,!(u>n)&&(e.bl_count[p]++,m=0,u>=s&&(m=o[u-s]),g=r[u*2],e.opt_len+=g*(p+m),a&&(e.static_len+=g*(i[u*2+1]+m)));if(b!==0){do{for(p=l-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,b-=2}while(b>0);for(p=l;p!==0;p--)for(u=e.bl_count[p];u!==0;)d=e.heap[--c],!(d>n)&&(r[d*2+1]!==p&&(e.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),u--)}}function Gc(e,t,r){var n=new Array(xr+1),i=0,a,o;for(a=1;a<=xr;a++)n[a]=i=i+r[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=qc(n[s]++,s))}}function Jp(){var e,t,r,n,i,a=new Array(xr+1);for(r=0,n=0;n<io-1;n++)for(lo[n]=r,e=0;e<1<<co[n];e++)zn[r++]=n;for(zn[r-1]=n,i=0,n=0;n<16;n++)for($i[n]=i,e=0;e<1<<Di[n];e++)Bn[i++]=n;for(i>>=7;n<Gr;n++)for($i[n]=i<<7,e=0;e<1<<Di[n]-7;e++)Bn[256+i++]=n;for(t=0;t<=xr;t++)a[t]=0;for(e=0;e<=143;)Yt[e*2+1]=8,e++,a[8]++;for(;e<=255;)Yt[e*2+1]=9,e++,a[9]++;for(;e<=279;)Yt[e*2+1]=7,e++,a[7]++;for(;e<=287;)Yt[e*2+1]=8,e++,a[8]++;for(Gc(Yt,In+1,a),e=0;e<Gr;e++)jn[e*2+1]=5,jn[e*2]=qc(e,5);Fc=new uo(Yt,co,$n+1,In,xr),Uc=new uo(jn,Di,0,Gr,xr),Hc=new uo(new Array(0),Zp,0,ao,Yp)}function Yc(e){var t;for(t=0;t<In;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Gr;t++)e.dyn_dtree[t*2]=0;for(t=0;t<ao;t++)e.bl_tree[t*2]=0;e.dyn_ltree[so*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Zc(e){e.bi_valid>8?Nn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Qp(e,t,r,n){Zc(e),Nn(e,r),Nn(e,~r),Lp.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Xc(e,t,r,n){var i=t*2,a=r*2;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function ho(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Xc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Xc(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Vc(e,t,r){var n,i,a=0,o,s;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,n===0?It(e,i,t):(o=zn[i],It(e,o+$n+1,t),s=co[o],s!==0&&(i-=lo[o],st(e,i,s)),n--,o=Wc(n),It(e,o,r),s=Di[o],s!==0&&(n-=$i[o],st(e,n,s)));while(a<e.last_lit);It(e,so,t)}function po(e,t){var r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,l=-1,c;for(e.heap_len=0,e.heap_max=Bc,o=0;o<a;o++)r[o*2]!==0?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,r[c*2]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[c*2+1]);for(t.max_code=l,o=e.heap_len>>1;o>=1;o--)ho(e,r,o);c=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ho(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,r[c*2]=r[o*2]+r[s*2],e.depth[c]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,r[o*2+1]=r[s*2+1]=c,e.heap[1]=c++,ho(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Kp(e,t),Gc(r,l,e.bl_count)}function Kc(e,t,r){var n,i=-1,a,o=t[0*2+1],s=0,l=7,c=4;for(o===0&&(l=138,c=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=t[(n+1)*2+1],!(++s<l&&a===o)&&(s<c?e.bl_tree[a*2]+=s:a!==0?(a!==i&&e.bl_tree[a*2]++,e.bl_tree[zc*2]++):s<=10?e.bl_tree[Nc*2]++:e.bl_tree[Mc*2]++,s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4))}function Jc(e,t,r){var n,i=-1,a,o=t[0*2+1],s=0,l=7,c=4;for(o===0&&(l=138,c=3),n=0;n<=r;n++)if(a=o,o=t[(n+1)*2+1],!(++s<l&&a===o)){if(s<c)do It(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==i&&(It(e,a,e.bl_tree),s--),It(e,zc,e.bl_tree),st(e,s-3,2)):s<=10?(It(e,Nc,e.bl_tree),st(e,s-3,3)):(It(e,Mc,e.bl_tree),st(e,s-11,7));s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4)}}function em(e){var t;for(Kc(e,e.dyn_ltree,e.l_desc.max_code),Kc(e,e.dyn_dtree,e.d_desc.max_code),po(e,e.bl_desc),t=ao-1;t>=3&&e.bl_tree[Lc[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function tm(e,t,r,n){var i;for(st(e,t-257,5),st(e,r-1,5),st(e,n-4,4),i=0;i<n;i++)st(e,e.bl_tree[Lc[i]*2+1],3);Jc(e,e.dyn_ltree,t-1),Jc(e,e.dyn_dtree,r-1)}function rm(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return $c;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Ic;for(r=32;r<$n;r++)if(e.dyn_ltree[r*2]!==0)return Ic;return $c}var Qc=!1;function nm(e){Qc||(Jp(),Qc=!0),e.l_desc=new fo(e.dyn_ltree,Fc),e.d_desc=new fo(e.dyn_dtree,Uc),e.bl_desc=new fo(e.bl_tree,Hc),e.bi_buf=0,e.bi_valid=0,Yc(e)}function el(e,t,r,n){st(e,(Hp<<1)+(n?1:0),3),Qp(e,t,r)}function im(e){st(e,jc<<1,3),It(e,so,Yt),Vp(e)}function am(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===Up&&(e.strm.data_type=rm(e)),po(e,e.l_desc),po(e,e.d_desc),o=em(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?el(e,t,r,n):e.strategy===Fp||a===i?(st(e,(jc<<1)+(n?1:0),3),Vc(e,Yt,jn)):(st(e,(Wp<<1)+(n?1:0),3),tm(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Vc(e,e.dyn_ltree,e.dyn_dtree)),Yc(e),n&&Zc(e)}function om(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(zn[r]+$n+1)*2]++,e.dyn_dtree[Wc(t)*2]++),e.last_lit===e.lit_bufsize-1}Wr._tr_init=nm,Wr._tr_stored_block=el,Wr._tr_flush_block=am,Wr._tr_tally=om,Wr._tr_align=im;function sm(e,t,r,n){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}var tl=sm;function cm(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var lm=cm();function um(e,t,r,n){var i=lm,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}var rl=um,mo={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"},tt=Gt,bt=Wr,nl=tl,rr=rl,fm=mo,Er=0,dm=1,hm=3,nr=4,il=5,jt=0,al=1,_t=-2,pm=-3,wo=-5,mm=-1,wm=1,Ii=2,gm=3,ym=4,bm=0,_m=2,ji=8,vm=9,xm=15,Em=8,Sm=29,km=256,go=km+1+Sm,Rm=30,Om=19,Cm=2*go+1,Pm=15,me=3,ir=258,kt=ir+me+1,Tm=32,Bi=42,yo=69,zi=73,Ni=91,Mi=103,Sr=113,Mn=666,Fe=1,Ln=2,kr=3,Yr=4,Am=3;function ar(e,t){return e.msg=fm[t],t}function ol(e){return(e<<1)-(e>4?9:0)}function or(e){for(var t=e.length;--t>=0;)e[t]=0}function sr(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(tt.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function qe(e,t){bt._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,sr(e.strm)}function be(e,t){e.pending_buf[e.pending++]=t}function Fn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Dm(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,tt.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=nl(e.adler,t,i,r):e.state.wrap===2&&(e.adler=rr(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function sl(e,t){var r=e.max_chain_length,n=e.strstart,i,a,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-kt?e.strstart-(e.w_size-kt):0,c=e.window,u=e.w_mask,d=e.prev,p=e.strstart+ir,m=c[n+o-1],g=c[n+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(c[i+o]!==g||c[i+o-1]!==m||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&c[++n]===c[++i]&&n<p);if(a=ir-(p-n),n=p-ir,a>o){if(e.match_start=t,o=a,a>=s)break;m=c[n+o-1],g=c[n+o]}}while((t=d[t&u])>l&&--r!==0);return o<=e.lookahead?o:e.lookahead}function Rr(e){var t=e.w_size,r,n,i,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-kt)){tt.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=Dm(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=me)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+me-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<me)););}while(e.lookahead<kt&&e.strm.avail_in!==0)}function $m(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Rr(e),e.lookahead===0&&t===Er)return Fe;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,qe(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-kt&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=0,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):(e.strstart>e.block_start&&(qe(e,!1),e.strm.avail_out===0),Fe)}function bo(e,t){for(var r,n;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return Fe;if(e.lookahead===0)break}if(r=0,e.lookahead>=me&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-kt&&(e.match_length=sl(e,r)),e.match_length>=me)if(n=bt._tr_tally(e,e.strstart-e.match_start,e.match_length-me),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=me){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=e.strstart<me-1?e.strstart:me-1,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function Zr(e,t){for(var r,n,i;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return Fe;if(e.lookahead===0)break}if(r=0,e.lookahead>=me&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=me-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-kt&&(e.match_length=sl(e,r),e.match_length<=5&&(e.strategy===wm||e.match_length===me&&e.strstart-e.match_start>4096)&&(e.match_length=me-1)),e.prev_length>=me&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-me,n=bt._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-me),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+me-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=me-1,e.strstart++,n&&(qe(e,!1),e.strm.avail_out===0))return Fe}else if(e.match_available){if(n=bt._tr_tally(e,0,e.window[e.strstart-1]),n&&qe(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Fe}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=bt._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<me-1?e.strstart:me-1,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function Im(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=ir){if(Rr(e),e.lookahead<=ir&&t===Er)return Fe;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=me&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=e.strstart+ir;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);e.match_length=ir-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=me?(r=bt._tr_tally(e,1,e.match_length-me),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=0,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function jm(e,t){for(var r;;){if(e.lookahead===0&&(Rr(e),e.lookahead===0)){if(t===Er)return Fe;break}if(e.match_length=0,r=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(qe(e,!1),e.strm.avail_out===0))return Fe}return e.insert=0,t===nr?(qe(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(qe(e,!1),e.strm.avail_out===0)?Fe:Ln}function Bt(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var Xr;Xr=[new Bt(0,0,0,0,$m),new Bt(4,4,8,4,bo),new Bt(4,5,16,8,bo),new Bt(4,6,32,32,bo),new Bt(4,4,16,16,Zr),new Bt(8,16,32,32,Zr),new Bt(8,16,128,128,Zr),new Bt(8,32,128,256,Zr),new Bt(32,128,258,1024,Zr),new Bt(32,258,258,4096,Zr)];function Bm(e){e.window_size=2*e.w_size,or(e.head),e.max_lazy_match=Xr[e.level].max_lazy,e.good_match=Xr[e.level].good_length,e.nice_match=Xr[e.level].nice_length,e.max_chain_length=Xr[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=me-1,e.match_available=0,e.ins_h=0}function zm(){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=ji,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 tt.Buf16(Cm*2),this.dyn_dtree=new tt.Buf16((2*Rm+1)*2),this.bl_tree=new tt.Buf16((2*Om+1)*2),or(this.dyn_ltree),or(this.dyn_dtree),or(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new tt.Buf16(Pm+1),this.heap=new tt.Buf16(2*go+1),or(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new tt.Buf16(2*go+1),or(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 cl(e){var t;return!e||!e.state?ar(e,_t):(e.total_in=e.total_out=0,e.data_type=_m,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Bi:Sr,e.adler=t.wrap===2?0:1,t.last_flush=Er,bt._tr_init(t),jt)}function ll(e){var t=cl(e);return t===jt&&Bm(e.state),t}function Nm(e,t){return!e||!e.state||e.state.wrap!==2?_t:(e.state.gzhead=t,jt)}function ul(e,t,r,n,i,a){if(!e)return _t;var o=1;if(t===mm&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>vm||r!==ji||n<8||n>15||t<0||t>9||a<0||a>ym)return ar(e,_t);n===8&&(n=9);var s=new zm;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+me-1)/me),s.window=new tt.Buf8(s.w_size*2),s.head=new tt.Buf16(s.hash_size),s.prev=new tt.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new tt.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=r,ll(e)}function Mm(e,t){return ul(e,t,ji,xm,Em,bm)}function Lm(e,t){var r,n,i,a;if(!e||!e.state||t>il||t<0)return e?ar(e,_t):_t;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Mn&&t!==nr)return ar(e,e.avail_out===0?wo:_t);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Bi)if(n.wrap===2)e.adler=0,be(n,31),be(n,139),be(n,8),n.gzhead?(be(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),be(n,n.gzhead.time&255),be(n,n.gzhead.time>>8&255),be(n,n.gzhead.time>>16&255),be(n,n.gzhead.time>>24&255),be(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),be(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(be(n,n.gzhead.extra.length&255),be(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=rr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=yo):(be(n,0),be(n,0),be(n,0),be(n,0),be(n,0),be(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),be(n,Am),n.status=Sr);else{var o=ji+(n.w_bits-8<<4)<<8,s=-1;n.strategy>=Ii||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,o|=s<<6,n.strstart!==0&&(o|=Tm),o+=31-o%31,n.status=Sr,Fn(n,o),n.strstart!==0&&(Fn(n,e.adler>>>16),Fn(n,e.adler&65535)),e.adler=1}if(n.status===yo)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),sr(e),i=n.pending,n.pending===n.pending_buf_size));)be(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=zi)}else n.status=zi;if(n.status===zi)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),sr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,be(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Ni)}else n.status=Ni;if(n.status===Ni)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),sr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,be(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=rr(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=Mi)}else n.status=Mi;if(n.status===Mi&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&sr(e),n.pending+2<=n.pending_buf_size&&(be(n,e.adler&255),be(n,e.adler>>8&255),e.adler=0,n.status=Sr)):n.status=Sr),n.pending!==0){if(sr(e),e.avail_out===0)return n.last_flush=-1,jt}else if(e.avail_in===0&&ol(t)<=ol(r)&&t!==nr)return ar(e,wo);if(n.status===Mn&&e.avail_in!==0)return ar(e,wo);if(e.avail_in!==0||n.lookahead!==0||t!==Er&&n.status!==Mn){var l=n.strategy===Ii?jm(n,t):n.strategy===gm?Im(n,t):Xr[n.level].func(n,t);if((l===kr||l===Yr)&&(n.status=Mn),l===Fe||l===kr)return e.avail_out===0&&(n.last_flush=-1),jt;if(l===Ln&&(t===dm?bt._tr_align(n):t!==il&&(bt._tr_stored_block(n,0,0,!1),t===hm&&(or(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),sr(e),e.avail_out===0))return n.last_flush=-1,jt}return t!==nr?jt:n.wrap<=0?al:(n.wrap===2?(be(n,e.adler&255),be(n,e.adler>>8&255),be(n,e.adler>>16&255),be(n,e.adler>>24&255),be(n,e.total_in&255),be(n,e.total_in>>8&255),be(n,e.total_in>>16&255),be(n,e.total_in>>24&255)):(Fn(n,e.adler>>>16),Fn(n,e.adler&65535)),sr(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?jt:al)}function Fm(e){var t;return!e||!e.state?_t:(t=e.state.status,t!==Bi&&t!==yo&&t!==zi&&t!==Ni&&t!==Mi&&t!==Sr&&t!==Mn?ar(e,_t):(e.state=null,t===Sr?ar(e,pm):jt))}function Um(e,t){var r=t.length,n,i,a,o,s,l,c,u;if(!e||!e.state||(n=e.state,o=n.wrap,o===2||o===1&&n.status!==Bi||n.lookahead))return _t;for(o===1&&(e.adler=nl(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(o===0&&(or(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new tt.Buf8(n.w_size),tt.arraySet(u,t,r-n.w_size,n.w_size,0),t=u,r=n.w_size),s=e.avail_in,l=e.next_in,c=e.input,e.avail_in=r,e.next_in=0,e.input=t,Rr(n);n.lookahead>=me;){i=n.strstart,a=n.lookahead-(me-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+me-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--a);n.strstart=i,n.lookahead=me-1,Rr(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=me-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=s,n.wrap=o,jt}$t.deflateInit=Mm,$t.deflateInit2=ul,$t.deflateReset=ll,$t.deflateResetKeep=cl,$t.deflateSetHeader=Nm,$t.deflate=Lm,$t.deflateEnd=Fm,$t.deflateSetDictionary=Um,$t.deflateInfo="pako deflate (from Nodeca project)";var Or={},Li=Gt,fl=!0,dl=!0;try{String.fromCharCode.apply(null,[0])}catch{fl=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{dl=!1}for(var Un=new Li.Buf8(256),cr=0;cr<256;cr++)Un[cr]=cr>=252?6:cr>=248?5:cr>=240?4:cr>=224?3:cr>=192?2:1;Un[254]=Un[254]=1,Or.string2buf=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Li.Buf8(s),a=0,i=0;a<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};function hl(e,t){if(t<65534&&(e.subarray&&dl||!e.subarray&&fl))return String.fromCharCode.apply(null,Li.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Or.buf2binstring=function(e){return hl(e,e.length)},Or.binstring2buf=function(e){for(var t=new Li.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},Or.buf2string=function(e,t){var r,n,i,a,o=t||e.length,s=new Array(o*2);for(n=0,r=0;r<o;){if(i=e[r++],i<128){s[n++]=i;continue}if(a=Un[i],a>4){s[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r<o;)i=i<<6|e[r++]&63,a--;if(a>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return hl(s,n)},Or.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Un[e[r]]>t?r:t};function Hm(){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}var pl=Hm,Hn=$t,Wn=Gt,_o=Or,vo=mo,Wm=pl,ml=Object.prototype.toString,qm=0,xo=4,Vr=0,wl=1,gl=2,Gm=-1,Ym=0,Zm=8;function Cr(e){if(!(this instanceof Cr))return new Cr(e);this.options=Wn.assign({level:Gm,method:Zm,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ym,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Wm,this.strm.avail_out=0;var r=Hn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Vr)throw new Error(vo[r]);if(t.header&&Hn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=_o.string2buf(t.dictionary):ml.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Hn.deflateSetDictionary(this.strm,n),r!==Vr)throw new Error(vo[r]);this._dict_set=!0}}Cr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=t===~~t?t:t===!0?xo:qm,typeof e=="string"?r.input=_o.string2buf(e):ml.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Wn.Buf8(n),r.next_out=0,r.avail_out=n),i=Hn.deflate(r,a),i!==wl&&i!==Vr)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===xo||a===gl))&&(this.options.to==="string"?this.onData(_o.buf2binstring(Wn.shrinkBuf(r.output,r.next_out))):this.onData(Wn.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==wl);return a===xo?(i=Hn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Vr):(a===gl&&(this.onEnd(Vr),r.avail_out=0),!0)},Cr.prototype.onData=function(e){this.chunks.push(e)},Cr.prototype.onEnd=function(e){e===Vr&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Eo(e,t){var r=new Cr(t);if(r.push(e,!0),r.err)throw r.msg||vo[r.err];return r.result}function Xm(e,t){return t=t||{},t.raw=!0,Eo(e,t)}function Vm(e,t){return t=t||{},t.gzip=!0,Eo(e,t)}Dn.Deflate=Cr,Dn.deflate=Eo,Dn.deflateRaw=Xm,Dn.gzip=Vm;var qn={},Rt={},Fi=30,Km=12,Jm=function(t,r){var n,i,a,o,s,l,c,u,d,p,m,g,b,v,y,_,R,C,x,O,k,S,A,D,B;n=t.state,i=t.next_in,D=t.input,a=i+(t.avail_in-5),o=t.next_out,B=t.output,s=o-(r-t.avail_out),l=o+(t.avail_out-257),c=n.dmax,u=n.wsize,d=n.whave,p=n.wnext,m=n.window,g=n.hold,b=n.bits,v=n.lencode,y=n.distcode,_=(1<<n.lenbits)-1,R=(1<<n.distbits)-1;e:do{b<15&&(g+=D[i++]<<b,b+=8,g+=D[i++]<<b,b+=8),C=v[g&_];t:for(;;){if(x=C>>>24,g>>>=x,b-=x,x=C>>>16&255,x===0)B[o++]=C&65535;else if(x&16){O=C&65535,x&=15,x&&(b<x&&(g+=D[i++]<<b,b+=8),O+=g&(1<<x)-1,g>>>=x,b-=x),b<15&&(g+=D[i++]<<b,b+=8,g+=D[i++]<<b,b+=8),C=y[g&R];r:for(;;){if(x=C>>>24,g>>>=x,b-=x,x=C>>>16&255,x&16){if(k=C&65535,x&=15,b<x&&(g+=D[i++]<<b,b+=8,b<x&&(g+=D[i++]<<b,b+=8)),k+=g&(1<<x)-1,k>c){t.msg="invalid distance too far back",n.mode=Fi;break e}if(g>>>=x,b-=x,x=o-s,k>x){if(x=k-x,x>d&&n.sane){t.msg="invalid distance too far back",n.mode=Fi;break e}if(S=0,A=m,p===0){if(S+=u-x,x<O){O-=x;do B[o++]=m[S++];while(--x);S=o-k,A=B}}else if(p<x){if(S+=u+p-x,x-=p,x<O){O-=x;do B[o++]=m[S++];while(--x);if(S=0,p<O){x=p,O-=x;do B[o++]=m[S++];while(--x);S=o-k,A=B}}}else if(S+=p-x,x<O){O-=x;do B[o++]=m[S++];while(--x);S=o-k,A=B}for(;O>2;)B[o++]=A[S++],B[o++]=A[S++],B[o++]=A[S++],O-=3;O&&(B[o++]=A[S++],O>1&&(B[o++]=A[S++]))}else{S=o-k;do B[o++]=B[S++],B[o++]=B[S++],B[o++]=B[S++],O-=3;while(O>2);O&&(B[o++]=B[S++],O>1&&(B[o++]=B[S++]))}}else if(x&64){t.msg="invalid distance code",n.mode=Fi;break e}else{C=y[(C&65535)+(g&(1<<x)-1)];continue r}break}}else if(x&64)if(x&32){n.mode=Km;break e}else{t.msg="invalid literal/length code",n.mode=Fi;break e}else{C=v[(C&65535)+(g&(1<<x)-1)];continue t}break}}while(i<a&&o<l);O=b>>3,i-=O,b-=O<<3,g&=(1<<b)-1,t.next_in=i,t.next_out=o,t.avail_in=i<a?5+(a-i):5-(i-a),t.avail_out=o<l?257+(l-o):257-(o-l),n.hold=g,n.bits=b},yl=Gt,Kr=15,bl=852,_l=592,vl=0,So=1,xl=2,Qm=[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],e0=[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],t0=[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],r0=[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],n0=function(t,r,n,i,a,o,s,l){var c=l.bits,u=0,d=0,p=0,m=0,g=0,b=0,v=0,y=0,_=0,R=0,C,x,O,k,S,A=null,D=0,B,M=new yl.Buf16(Kr+1),U=new yl.Buf16(Kr+1),Z=null,de=0,$e,ge,xe;for(u=0;u<=Kr;u++)M[u]=0;for(d=0;d<i;d++)M[r[n+d]]++;for(g=c,m=Kr;m>=1&&M[m]===0;m--);if(g>m&&(g=m),m===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,l.bits=1,0;for(p=1;p<m&&M[p]===0;p++);for(g<p&&(g=p),y=1,u=1;u<=Kr;u++)if(y<<=1,y-=M[u],y<0)return-1;if(y>0&&(t===vl||m!==1))return-1;for(U[1]=0,u=1;u<Kr;u++)U[u+1]=U[u]+M[u];for(d=0;d<i;d++)r[n+d]!==0&&(s[U[r[n+d]]++]=d);if(t===vl?(A=Z=s,B=19):t===So?(A=Qm,D-=257,Z=e0,de-=257,B=256):(A=t0,Z=r0,B=-1),R=0,d=0,u=p,S=o,b=g,v=0,O=-1,_=1<<g,k=_-1,t===So&&_>bl||t===xl&&_>_l)return 1;for(;;){$e=u-v,s[d]<B?(ge=0,xe=s[d]):s[d]>B?(ge=Z[de+s[d]],xe=A[D+s[d]]):(ge=96,xe=0),C=1<<u-v,x=1<<b,p=x;do x-=C,a[S+(R>>v)+x]=$e<<24|ge<<16|xe|0;while(x!==0);for(C=1<<u-1;R&C;)C>>=1;if(C!==0?(R&=C-1,R+=C):R=0,d++,--M[u]===0){if(u===m)break;u=r[n+s[d]]}if(u>g&&(R&k)!==O){for(v===0&&(v=g),S+=p,b=u-v,y=1<<b;b+v<m&&(y-=M[b+v],!(y<=0));)b++,y<<=1;if(_+=1<<b,t===So&&_>bl||t===xl&&_>_l)return 1;O=R&k,a[O]=g<<24|b<<16|S-o|0}}return R!==0&&(a[S+R]=u-v<<24|64<<16|0),l.bits=g,0},pt=Gt,ko=tl,zt=rl,i0=Jm,Gn=n0,a0=0,El=1,Sl=2,kl=4,o0=5,Ui=6,Pr=0,s0=1,c0=2,vt=-2,Rl=-3,Ol=-4,l0=-5,Cl=8,Pl=1,Tl=2,Al=3,Dl=4,$l=5,Il=6,jl=7,Bl=8,zl=9,Nl=10,Hi=11,Zt=12,Ro=13,Ml=14,Oo=15,Ll=16,Fl=17,Ul=18,Hl=19,Wi=20,qi=21,Wl=22,ql=23,Gl=24,Yl=25,Zl=26,Co=27,Xl=28,Vl=29,Te=30,Kl=31,u0=32,f0=852,d0=592,h0=15,p0=h0;function Jl(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function m0(){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 pt.Buf16(320),this.work=new pt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Ql(e){var t;return!e||!e.state?vt:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Pl,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new pt.Buf32(f0),t.distcode=t.distdyn=new pt.Buf32(d0),t.sane=1,t.back=-1,Pr)}function eu(e){var t;return!e||!e.state?vt:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Ql(e))}function tu(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?vt:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,eu(e))}function ru(e,t){var r,n;return e?(n=new m0,e.state=n,n.window=null,r=tu(e,t),r!==Pr&&(e.state=null),r):vt}function w0(e){return ru(e,p0)}var nu=!0,Po,To;function g0(e){if(nu){var t;for(Po=new pt.Buf32(512),To=new pt.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Gn(El,e.lens,0,288,Po,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Gn(Sl,e.lens,0,32,To,0,e.work,{bits:5}),nu=!1}e.lencode=Po,e.lenbits=9,e.distcode=To,e.distbits=5}function iu(e,t,r,n){var i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new pt.Buf8(a.wsize)),n>=a.wsize?(pt.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),pt.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(pt.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function y0(e,t){var r,n,i,a,o,s,l,c,u,d,p,m,g,b,v=0,y,_,R,C,x,O,k,S,A=new pt.Buf8(4),D,B,M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return vt;r=e.state,r.mode===Zt&&(r.mode=Ro),o=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,c=r.hold,u=r.bits,d=s,p=l,S=Pr;e:for(;;)switch(r.mode){case Pl:if(r.wrap===0){r.mode=Ro;break}for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.wrap&2&&c===35615){r.check=0,A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0),c=0,u=0,r.mode=Tl;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=Te;break}if((c&15)!==Cl){e.msg="unknown compression method",r.mode=Te;break}if(c>>>=4,u-=4,k=(c&15)+8,r.wbits===0)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=Te;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=c&512?Nl:Zt,c=0,u=0;break;case Tl:for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.flags=c,(r.flags&255)!==Cl){e.msg="unknown compression method",r.mode=Te;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Te;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0)),c=0,u=0,r.mode=Al;case Al:for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.head&&(r.head.time=c),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,r.check=zt(r.check,A,4,0)),c=0,u=0,r.mode=Dl;case Dl:for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0)),c=0,u=0,r.mode=$l;case $l:if(r.flags&1024){for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&(A[0]=c&255,A[1]=c>>>8&255,r.check=zt(r.check,A,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=Il;case Il:if(r.flags&1024&&(m=r.length,m>s&&(m=s),m&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),pt.arraySet(r.head.extra,n,a,m,k)),r.flags&512&&(r.check=zt(r.check,n,m,a)),s-=m,a+=m,r.length-=m),r.length))break e;r.length=0,r.mode=jl;case jl:if(r.flags&2048){if(s===0)break e;m=0;do k=n[a+m++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k));while(k&&m<s);if(r.flags&512&&(r.check=zt(r.check,n,m,a)),s-=m,a+=m,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Bl;case Bl:if(r.flags&4096){if(s===0)break e;m=0;do k=n[a+m++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k));while(k&&m<s);if(r.flags&512&&(r.check=zt(r.check,n,m,a)),s-=m,a+=m,k)break e}else r.head&&(r.head.comment=null);r.mode=zl;case zl:if(r.flags&512){for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(c!==(r.check&65535)){e.msg="header crc mismatch",r.mode=Te;break}c=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Zt;break;case Nl:for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}e.adler=r.check=Jl(c),c=0,u=0,r.mode=Hi;case Hi:if(r.havedict===0)return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,r.hold=c,r.bits=u,c0;e.adler=r.check=1,r.mode=Zt;case Zt:if(t===o0||t===Ui)break e;case Ro:if(r.last){c>>>=u&7,u-=u&7,r.mode=Co;break}for(;u<3;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}switch(r.last=c&1,c>>>=1,u-=1,c&3){case 0:r.mode=Ml;break;case 1:if(g0(r),r.mode=Wi,t===Ui){c>>>=2,u-=2;break e}break;case 2:r.mode=Fl;break;case 3:e.msg="invalid block type",r.mode=Te}c>>>=2,u-=2;break;case Ml:for(c>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Te;break}if(r.length=c&65535,c=0,u=0,r.mode=Oo,t===Ui)break e;case Oo:r.mode=Ll;case Ll:if(m=r.length,m){if(m>s&&(m=s),m>l&&(m=l),m===0)break e;pt.arraySet(i,n,a,m,o),s-=m,a+=m,l-=m,o+=m,r.length-=m;break}r.mode=Zt;break;case Fl:for(;u<14;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.nlen=(c&31)+257,c>>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Te;break}r.have=0,r.mode=Ul;case Ul:for(;r.have<r.ncode;){for(;u<3;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.lens[M[r.have++]]=c&7,c>>>=3,u-=3}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},S=Gn(a0,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,S){e.msg="invalid code lengths set",r.mode=Te;break}r.have=0,r.mode=Hl;case Hl:for(;r.have<r.nlen+r.ndist;){for(;v=r.lencode[c&(1<<r.lenbits)-1],y=v>>>24,_=v>>>16&255,R=v&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(R<16)c>>>=y,u-=y,r.lens[r.have++]=R;else{if(R===16){for(B=y+2;u<B;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(c>>>=y,u-=y,r.have===0){e.msg="invalid bit length repeat",r.mode=Te;break}k=r.lens[r.have-1],m=3+(c&3),c>>>=2,u-=2}else if(R===17){for(B=y+3;u<B;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=y,u-=y,k=0,m=3+(c&7),c>>>=3,u-=3}else{for(B=y+7;u<B;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=y,u-=y,k=0,m=11+(c&127),c>>>=7,u-=7}if(r.have+m>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Te;break}for(;m--;)r.lens[r.have++]=k}}if(r.mode===Te)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Te;break}if(r.lenbits=9,D={bits:r.lenbits},S=Gn(El,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,S){e.msg="invalid literal/lengths set",r.mode=Te;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},S=Gn(Sl,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,S){e.msg="invalid distances set",r.mode=Te;break}if(r.mode=Wi,t===Ui)break e;case Wi:r.mode=qi;case qi:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,r.hold=c,r.bits=u,i0(e,p),o=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,c=r.hold,u=r.bits,r.mode===Zt&&(r.back=-1);break}for(r.back=0;v=r.lencode[c&(1<<r.lenbits)-1],y=v>>>24,_=v>>>16&255,R=v&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(_&&!(_&240)){for(C=y,x=_,O=R;v=r.lencode[O+((c&(1<<C+x)-1)>>C)],y=v>>>24,_=v>>>16&255,R=v&65535,!(C+y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=C,u-=C,r.back+=C}if(c>>>=y,u-=y,r.back+=y,r.length=R,_===0){r.mode=Zl;break}if(_&32){r.back=-1,r.mode=Zt;break}if(_&64){e.msg="invalid literal/length code",r.mode=Te;break}r.extra=_&15,r.mode=Wl;case Wl:if(r.extra){for(B=r.extra;u<B;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=ql;case ql:for(;v=r.distcode[c&(1<<r.distbits)-1],y=v>>>24,_=v>>>16&255,R=v&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(!(_&240)){for(C=y,x=_,O=R;v=r.distcode[O+((c&(1<<C+x)-1)>>C)],y=v>>>24,_=v>>>16&255,R=v&65535,!(C+y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=C,u-=C,r.back+=C}if(c>>>=y,u-=y,r.back+=y,_&64){e.msg="invalid distance code",r.mode=Te;break}r.offset=R,r.extra=_&15,r.mode=Gl;case Gl:if(r.extra){for(B=r.extra;u<B;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Te;break}r.mode=Yl;case Yl:if(l===0)break e;if(m=p-l,r.offset>m){if(m=r.offset-m,m>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Te;break}m>r.wnext?(m-=r.wnext,g=r.wsize-m):g=r.wnext-m,m>r.length&&(m=r.length),b=r.window}else b=i,g=o-r.offset,m=r.length;m>l&&(m=l),l-=m,r.length-=m;do i[o++]=b[g++];while(--m);r.length===0&&(r.mode=qi);break;case Zl:if(l===0)break e;i[o++]=r.length,l--,r.mode=qi;break;case Co:if(r.wrap){for(;u<32;){if(s===0)break e;s--,c|=n[a++]<<u,u+=8}if(p-=l,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?zt(r.check,i,p,o-p):ko(r.check,i,p,o-p)),p=l,(r.flags?c:Jl(c))!==r.check){e.msg="incorrect data check",r.mode=Te;break}c=0,u=0}r.mode=Xl;case Xl:if(r.wrap&&r.flags){for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(c!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=Te;break}c=0,u=0}r.mode=Vl;case Vl:S=s0;break e;case Te:S=Rl;break e;case Kl:return Ol;case u0:default:return vt}return e.next_out=o,e.avail_out=l,e.next_in=a,e.avail_in=s,r.hold=c,r.bits=u,(r.wsize||p!==e.avail_out&&r.mode<Te&&(r.mode<Co||t!==kl))&&iu(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?zt(r.check,i,p,e.next_out-p):ko(r.check,i,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Zt?128:0)+(r.mode===Wi||r.mode===Oo?256:0),(d===0&&p===0||t===kl)&&S===Pr&&(S=l0),S}function b0(e){if(!e||!e.state)return vt;var t=e.state;return t.window&&(t.window=null),e.state=null,Pr}function _0(e,t){var r;return!e||!e.state||(r=e.state,!(r.wrap&2))?vt:(r.head=t,t.done=!1,Pr)}function v0(e,t){var r=t.length,n,i,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Hi)?vt:n.mode===Hi&&(i=1,i=ko(i,t,r,0),i!==n.check)?Rl:(a=iu(e,t,r,r),a?(n.mode=Kl,Ol):(n.havedict=1,Pr))}Rt.inflateReset=eu,Rt.inflateReset2=tu,Rt.inflateResetKeep=Ql,Rt.inflateInit=w0,Rt.inflateInit2=ru,Rt.inflate=y0,Rt.inflateEnd=b0,Rt.inflateGetHeader=_0,Rt.inflateSetDictionary=v0,Rt.inflateInfo="pako inflate (from Nodeca project)";var au={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};function x0(){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}var E0=x0,Jr=Rt,Yn=Gt,Gi=Or,Ne=au,Ao=mo,S0=pl,k0=E0,ou=Object.prototype.toString;function Tr(e){if(!(this instanceof Tr))return new Tr(e);this.options=Yn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new S0,this.strm.avail_out=0;var r=Jr.inflateInit2(this.strm,t.windowBits);if(r!==Ne.Z_OK)throw new Error(Ao[r]);if(this.header=new k0,Jr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Gi.string2buf(t.dictionary):ou.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Jr.inflateSetDictionary(this.strm,t.dictionary),r!==Ne.Z_OK)))throw new Error(Ao[r])}Tr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s,l,c,u=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?Ne.Z_FINISH:Ne.Z_NO_FLUSH,typeof e=="string"?r.input=Gi.binstring2buf(e):ou.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Yn.Buf8(n),r.next_out=0,r.avail_out=n),a=Jr.inflate(r,Ne.Z_NO_FLUSH),a===Ne.Z_NEED_DICT&&i&&(a=Jr.inflateSetDictionary(this.strm,i)),a===Ne.Z_BUF_ERROR&&u===!0&&(a=Ne.Z_OK,u=!1),a!==Ne.Z_STREAM_END&&a!==Ne.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===Ne.Z_STREAM_END||r.avail_in===0&&(o===Ne.Z_FINISH||o===Ne.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=Gi.utf8border(r.output,r.next_out),l=r.next_out-s,c=Gi.buf2string(r.output,s),r.next_out=l,r.avail_out=n-l,l&&Yn.arraySet(r.output,r.output,s,l,0),this.onData(c)):this.onData(Yn.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==Ne.Z_STREAM_END);return a===Ne.Z_STREAM_END&&(o=Ne.Z_FINISH),o===Ne.Z_FINISH?(a=Jr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ne.Z_OK):(o===Ne.Z_SYNC_FLUSH&&(this.onEnd(Ne.Z_OK),r.avail_out=0),!0)},Tr.prototype.onData=function(e){this.chunks.push(e)},Tr.prototype.onEnd=function(e){e===Ne.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Yn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Do(e,t){var r=new Tr(t);if(r.push(e,!0),r.err)throw r.msg||Ao[r.err];return r.result}function R0(e,t){return t=t||{},t.raw=!0,Do(e,t)}qn.Inflate=Tr,qn.inflate=Do,qn.inflateRaw=R0,qn.ungzip=Do;var O0=Gt.assign,C0=Dn,P0=qn,T0=au,su={};O0(su,C0,P0,T0);var A0=su;const $o=St(A0),cu=(e,t)=>function(...r){const n=t.promiseModule;return new n((i,a)=>{t.multiArgs?r.push((...o)=>{t.errorFirst?o[0]?a(o):(o.shift(),i(o)):i(o)}):t.errorFirst?r.push((o,s)=>{o?a(o):i(s)}):r.push(i),e.apply(this,r)})};var D0=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=typeof e;if(!(e!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?"null":r}\``);const n=a=>{const o=s=>typeof s=="string"?a===s:s.test(a);return t.include?t.include.some(o):!t.exclude.some(o)};let i;r==="function"?i=function(...a){return t.excludeMain?e(...a):cu(e,t).apply(this,a)}:i=Object.create(Object.getPrototypeOf(e));for(const a in e){const o=e[a];i[a]=typeof o=="function"&&n(a)?cu(o,t):o}return i};const Io=St(D0);function lu(e){return Array.isArray(e)?e:[e]}const jo="",uu=" ",Bo="\\",$0=/^\s+$/,I0=/(?:[^\\]|^)\\$/,j0=/^\\!/,B0=/^\\#/,z0=/\r?\n/g,N0=/^\.*\/|^\.+$/,zo="/";let fu="node-ignore";typeof Symbol<"u"&&(fu=Symbol.for("node-ignore"));const du=fu,M0=(e,t,r)=>Object.defineProperty(e,t,{value:r}),L0=/([0-z])-([0-z])/g,hu=()=>!1,F0=e=>e.replace(L0,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:jo),U0=e=>{const{length:t}=e;return e.slice(0,t-t%2)},H0=[[/^\uFEFF/,()=>jo],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?uu:jo)],[/(\\+?)\s/g,(e,t)=>{const{length:r}=t;return t.slice(0,r-r%2)+uu}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,r)=>{const n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Bo],[/\\\\/g,()=>Bo],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,i)=>t===Bo?`\\[${r}${U0(n)}${i}`:i==="]"&&n.length%2===0?`[${F0(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],pu=Object.create(null),W0=(e,t)=>{let r=pu[e];return r||(r=H0.reduce((n,[i,a])=>n.replace(i,a.bind(e)),e),pu[e]=r),t?new RegExp(r,"i"):new RegExp(r)},No=e=>typeof e=="string",q0=e=>e&&No(e)&&!$0.test(e)&&!I0.test(e)&&e.indexOf("#")!==0,G0=e=>e.split(z0);class Y0{constructor(t,r,n,i){this.origin=t,this.pattern=r,this.negative=n,this.regex=i}}const Z0=(e,t)=>{const r=e;let n=!1;e.indexOf("!")===0&&(n=!0,e=e.substr(1)),e=e.replace(j0,"!").replace(B0,"#");const i=W0(e,t);return new Y0(r,e,n,i)},X0=(e,t)=>{throw new t(e)},Xt=(e,t,r)=>No(e)?e?Xt.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),mu=e=>N0.test(e);Xt.isNotRelative=mu,Xt.convert=e=>e;class V0{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){M0(this,du,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[du]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(q0(t)){const r=Z0(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,lu(No(t)?G0(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,r){let n=!1,i=!1;return this._rules.forEach(a=>{const{negative:o}=a;if(i===o&&n!==i||o&&!n&&!i&&!r)return;a.regex.test(t)&&(n=!o,i=o)}),{ignored:n,unignored:i}}_test(t,r,n,i){const a=t&&Xt.convert(t);return Xt(a,t,this._allowRelativePaths?hu:X0),this._t(a,r,n,i)}_t(t,r,n,i){if(t in r)return r[t];if(i||(i=t.split(zo)),i.pop(),!i.length)return r[t]=this._testOne(t,n);const a=this._t(i.join(zo)+zo,r,n,i);return r[t]=a.ignored?a:this._testOne(t,n)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return lu(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}}const Yi=e=>new V0(e),K0=e=>Xt(e&&Xt.convert(e),e,hu);Yi.isPathValid=K0,Yi.default=Yi;var J0=Yi;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Xt.convert=e;const t=/^[a-z]:\//i;Xt.isNotRelative=r=>t.test(r)||mu(r)}const Q0=St(J0);function ew(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nt(e,t,r){return t=t instanceof RegExp?t:new RegExp(ew(t),"g"),e.replace(t,r)}var tw={clean:function(t){if(typeof t!="string")throw new Error("Expected a string, received: "+t);return t=Nt(t,"./","/"),t=Nt(t,"..","."),t=Nt(t," ","-"),t=Nt(t,/^[~^:?*\\\-]/g,""),t=Nt(t,/[~^:?*\\]/g,"-"),t=Nt(t,/[~^:?*\\\-]$/g,""),t=Nt(t,"@{","-"),t=Nt(t,/\.$/g,""),t=Nt(t,/\/$/g,""),t=Nt(t,/\.lock$/g,""),t}},rw=tw;const Mt=St(rw);var nw=function(e,t){var r=e,n=t,i=r.length,a=n.length,o=!1,s=null,l=i+1,c=[],u=[],d=[],p="",m=-1,g=0,b=1,v,y,_=function(){i>=a&&(v=r,y=i,r=n,n=v,i=a,a=y,o=!0,l=i+1)},R=function(k,S,A){return{x:k,y:S,k:A}},C=function(k,S){return{elem:k,t:S}},x=function(k,S,A){var D,B,M;for(S>A?D=c[k-1+l]:D=c[k+1+l],M=Math.max(S,A),B=M-k;B<i&&M<a&&r[B]===n[M];)++B,++M;return c[k+l]=u.length,u[u.length]=new R(B,M,D),M},O=function(k){var S,A,D;for(S=A=0,D=k.length-1;D>=0;--D)for(;S<k[D].x||A<k[D].y;)k[D].y-k[D].x>A-S?(o?d[d.length]=new C(n[A],m):d[d.length]=new C(n[A],b),++A):k[D].y-k[D].x<A-S?(o?d[d.length]=new C(r[S],b):d[d.length]=new C(r[S],m),++S):(d[d.length]=new C(r[S],g),p+=r[S],++S,++A)};return _(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return s},getlcs:function(){return p},getses:function(){return d},compose:function(){var k,S,A,D,B,M,U,Z;for(k=a-i,S=i+a+3,A={},U=0;U<S;++U)A[U]=-1,c[U]=-1;D=-1;do{for(++D,Z=-D;Z<=k-1;++Z)A[Z+l]=x(Z,A[Z-1+l]+1,A[Z+1+l]);for(Z=k+D;Z>=k+1;--Z)A[Z+l]=x(Z,A[Z-1+l]+1,A[Z+1+l]);A[k+l]=x(k,A[k-1+l]+1,A[k+1+l])}while(A[k+l]!==a);for(s=k+2*D,B=c[k+l],M=[];B!==-1;)M[M.length]=new R(u[B].x,u[B].y,null),B=u[B].k;O(M)}}},iw=nw;function aw(e,t){var r=new iw(e,t);r.compose();for(var n=r.getses(),i,a,o=e.length-1,s=t.length-1,l=n.length-1;l>=0;--l)n[l].t===r.SES_COMMON?(a?(a.chain={file1index:o,file2index:s,chain:null},a=a.chain):(i={file1index:o,file2index:s,chain:null},a=i),o--,s--):n[l].t===r.SES_DELETE?o--:n[l].t===r.SES_ADD&&s--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function wu(e,t){for(var r=[],n=e.length,i=t.length,a=aw(e,t);a!==null;a=a.chain){var o=n-a.file1index-1,s=i-a.file2index-1;n=a.file1index,i=a.file2index,(o||s)&&r.push({file1:[n+1,o],file2:[i+1,s]})}return r.reverse(),r}function ow(e,t,r){var n,i=wu(t,e),a=wu(t,r),o=[];function s(U,Z){o.push([U.file1[0],Z,U.file1[1],U.file2[0],U.file2[1]])}for(n=0;n<i.length;n++)s(i[n],0);for(n=0;n<a.length;n++)s(a[n],2);o.sort(function(U,Z){return U[0]-Z[0]});var l=[],c=0;function u(U){U>c&&(l.push([1,c,U-c]),c=U)}for(var d=0;d<o.length;d++){for(var p=d,m=o[d],g=m[0],b=g+m[2];d<o.length-1;){var v=o[d+1],y=v[0];if(y>b)break;b=Math.max(b,y+v[2]),d++}if(u(g),p==d)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var _={0:[e.length,-1,t.length,-1],2:[r.length,-1,t.length,-1]};for(n=p;n<=d;n++){m=o[n];var R=m[1],C=_[R],x=m[0],O=x+m[2],k=m[3],S=k+m[4];C[0]=Math.min(k,C[0]),C[1]=Math.max(S,C[1]),C[2]=Math.min(x,C[2]),C[3]=Math.max(O,C[3])}var A=_[0][0]+(g-_[0][2]),D=_[0][1]+(b-_[0][3]),B=_[2][0]+(g-_[2][2]),M=_[2][1]+(b-_[2][3]);l.push([-1,A,D-A,g,b-g,B,M-B])}c=b}return u(t.length),l}function sw(e,t,r){var n=[],i=[e,t,r],a=ow(e,t,r),o=[];function s(){o.length&&n.push({ok:o}),o=[]}function l(m){for(var g=0;g<m.length;g++)o.push(m[g])}function c(m){if(m[2]!=m[6])return!0;for(var g=m[1],b=m[5],v=0;v<m[2];v++)if(e[v+g]!=r[v+b])return!0;return!1}for(var u=0;u<a.length;u++){var d=a[u],p=d[0];p==-1?c(d)?(s(),n.push({conflict:{a:e.slice(d[1],d[1]+d[2]),aIndex:d[1],o:t.slice(d[3],d[3]+d[4]),oIndex:d[3],b:r.slice(d[5],d[5]+d[6]),bIndex:d[5]}})):l(i[0].slice(d[1],d[1]+d[2])):l(i[p].slice(d[1],d[1]+d[2]))}return s(),n}var cw=sw;const lw=St(cw);class we extends Error{constructor(t){super(t),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){const r=new we(t.message);return r.code=t.code,r.data=t.data,r.caller=t.caller,r.stack=t.stack,r}get isIsomorphicGitError(){return!0}}class Zn extends we{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.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=Zn.code,this.data={filepaths:t}}}Zn.code="UnmergedPathsError";class se extends we{constructor(t){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: ${t}`),this.code=this.name=se.code,this.data={message:t}}}se.code="InternalError";class Qr extends we{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=Qr.code,this.data={filepath:t}}}Qr.code="UnsafeFilepathError";class Lt{constructor(t){this.buffer=t,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(t){this._start=t}slice(t){const r=this.buffer.slice(this._start,this._start+t);return this._start+=t,r}toString(t,r){const n=this.buffer.toString(t,this._start,this._start+r);return this._start+=r,n}write(t,r,n){const i=this.buffer.write(t,this._start,r,n);return this._start+=r,i}copy(t,r,n){const i=t.copy(this.buffer,this._start,r,n);return this._start+=i,i}readUInt8(){const t=this.buffer.readUInt8(this._start);return this._start+=1,t}writeUInt8(t){const r=this.buffer.writeUInt8(t,this._start);return this._start+=1,r}readUInt16BE(){const t=this.buffer.readUInt16BE(this._start);return this._start+=2,t}writeUInt16BE(t){const r=this.buffer.writeUInt16BE(t,this._start);return this._start+=2,r}readUInt32BE(){const t=this.buffer.readUInt32BE(this._start);return this._start+=4,t}writeUInt32BE(t){const r=this.buffer.writeUInt32BE(t,this._start);return this._start+=4,r}}function Zi(e,t){return-(e<t)||+(e>t)}function gu(e,t){return Zi(e.path,t.path)}function yu(e){let t=e>0?e>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let r=e&511;return r&73?r=493:r=420,t!==8&&(r=0),(t<<12)+r}const Ft=2**32;function bu(e,t,r,n){if(e!==void 0&&t!==void 0)return[e,t];r===void 0&&(r=n.valueOf());const i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function en(e){const[t,r]=bu(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[n,i]=bu(e.mtimeSeconds,e.mtimeNanoseconds,e.mtimeMs,e.mtime);return{ctimeSeconds:t%Ft,ctimeNanoseconds:r%Ft,mtimeSeconds:n%Ft,mtimeNanoseconds:i%Ft,dev:e.dev%Ft,ino:e.ino%Ft,mode:yu(e.mode%Ft),uid:e.uid%Ft,gid:e.gid%Ft,size:e.size>-1?e.size%Ft:0}}function uw(e){let t="";for(const r of new Uint8Array(e))r<16&&(t+="0"),t+=r.toString(16);return t}let Mo=null;async function Vt(e){return Mo===null&&(Mo=await dw()),Mo?_u(e):fw(e)}function fw(e){return new Tc().update(e).digest("hex")}async function _u(e){const t=await crypto.subtle.digest("SHA-1",e);return uw(t)}async function dw(){try{if(await _u(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function hw(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function pw(e){const t=e.flags;return t.extended=!1,t.nameLength=Math.min(Buffer.from(e.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}class Ar{constructor(t,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=t||new Map}_addEntry(t){if(t.flags.stage===0)t.stages=[t],this._entries.set(t.path,t),this._unmergedPaths.delete(t.path);else{let r=this._entries.get(t.path);r||(this._entries.set(t.path,t),r=t),r.stages[t.flags.stage]=t,this._unmergedPaths.add(t.path)}}static async from(t){if(Buffer.isBuffer(t))return Ar.fromBuffer(t);if(t===null)return new Ar(null);throw new se("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(t.length===0)throw new se("Index file is empty (.git/index)");const r=new Ar,n=new Lt(t),i=n.toString("utf8",4);if(i!=="DIRC")throw new se(`Invalid dircache magic file number: ${i}`);const a=await Vt(t.slice(0,-20)),o=t.slice(-20).toString("hex");if(o!==a)throw new se(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);const s=n.readUInt32BE();if(s!==2)throw new se(`Unsupported dircache version: ${s}`);const l=n.readUInt32BE();let c=0;for(;!n.eof()&&c<l;){const u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");const d=n.readUInt16BE();u.flags=hw(d);const p=t.indexOf(0,n.tell()+1)-n.tell();if(p<1)throw new se(`Got a path length of: ${p}`);if(u.path=n.toString("utf8",p),u.path.includes("..\\")||u.path.includes("../"))throw new Qr(u.path);let m=8-(n.tell()-12)%8;for(m===0&&(m=8);m--;){const g=n.readUInt8();if(g!==0)throw new se(`Expected 1-8 null characters but got '${g}' after ${u.path}`);if(n.eof())throw new se("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(gu)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(t=>t.stages.length>1?t.stages.filter(r=>r):t)}*[Symbol.iterator](){for(const t of this.entries)yield t}insert({filepath:t,stats:r,oid:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=en(r);const a=Buffer.from(t),o={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:t,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:t}){if(this._entries.has(t))this._entries.delete(t);else for(const r of this._entries.keys())r.startsWith(t+"/")&&this._entries.delete(r);this._unmergedPaths.has(t)&&this._unmergedPaths.delete(t),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:t}){return this._entries.has(t)}render(){return this.entries.map(t=>`${t.mode.toString(8)} ${t.oid} ${t.path}`).join(`
10
10
  `)}static async _entryToBuffer(t){const r=Buffer.from(t.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Lt(i),o=en(t);return a.writeUInt32BE(o.ctimeSeconds),a.writeUInt32BE(o.ctimeNanoseconds),a.writeUInt32BE(o.mtimeSeconds),a.writeUInt32BE(o.mtimeNanoseconds),a.writeUInt32BE(o.dev),a.writeUInt32BE(o.ino),a.writeUInt32BE(o.mode),a.writeUInt32BE(o.uid),a.writeUInt32BE(o.gid),a.writeUInt32BE(o.size),a.write(t.oid,20,"hex"),a.writeUInt16BE(pw(t)),a.write(t.path,r.length,"utf8"),i}async toObject(){const t=Buffer.alloc(12),r=new Lt(t);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(const s of this.entries)if(n.push(Ar._entryToBuffer(s)),s.stages.length>1)for(const l of s.stages)l&&l!==s&&n.push(Ar._entryToBuffer(l));n=await Promise.all(n);const i=Buffer.concat(n),a=Buffer.concat([t,i]),o=await Vt(a);return Buffer.concat([a,Buffer.from(o,"hex")])}}function Xi(e,t,r=!0,n=!0){const i=en(e),a=en(t);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size}let Lo=null;const tn=Symbol("IndexCache");function mw(){return{map:new Map,stats:new Map}}async function ww(e,t,r){const n=await e.lstat(t),i=await e.read(t),a=await Ar.from(i);r.map.set(t,a),r.stats.set(t,n)}async function gw(e,t,r){const n=r.stats.get(t);if(n===void 0)return!0;const i=await e.lstat(t);return n===null||i===null?!1:Xi(n,i)}class He{static async acquire({fs:t,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[tn]||(n[tn]=mw());const o=`${r}/index`;Lo===null&&(Lo=new Tn({maxPending:1/0}));let s,l=[];return await Lo.acquire(o,async()=>{await gw(t,o,n[tn])&&await ww(t,o,n[tn]);const c=n[tn].map.get(o);if(l=c.unmergedPaths,l.length&&!i)throw new Zn(l);if(s=await a(c),c._dirty){const u=await c.toObject();await t.write(o,u),n[tn].stats.set(o,await t.lstat(o)),c._dirty=!1}}),s}}function Vi(e){const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>-1&&(e=e.slice(t+1)),e}function rn(e){const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?".":t===0?"/":e.slice(0,t)}function vu(e){const t=new Map,r=function(i){if(!t.has(i)){const a={type:"tree",fullpath:i,basename:Vi(i),metadata:{},children:[]};t.set(i,a),a.parent=r(rn(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return t.get(i)},n=function(i,a){if(!t.has(i)){const o={type:"blob",fullpath:i,basename:Vi(i),metadata:a,parent:r(rn(i)),children:[]};o.parent&&o.parent.children.push(o),t.set(i,o)}return t.get(i)};r(".");for(const i of e)n(i.path,i);return t}function yw(e){switch(e){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new se(`Unexpected GitTree entry mode: ${e.toString(8)}`)}class bw{constructor({fs:t,gitdir:r,cache:n}){this.treePromise=He.acquire({fs:t,gitdir:r,cache:n},async function(a){return vu(a.entries)});const i=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(t){const r=t._fullpath,i=(await this.treePromise).get(r);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);const a=i.children.map(o=>o.fullpath);return a.sort(Zi),a}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){const n=(await this.treePromise).get(t._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);const i=n.type==="tree"?{}:en(n.metadata);t._type=n.type==="tree"?"tree":yw(i.mode),t._mode=i.mode,n.type==="tree"?t._stat=void 0:t._stat=i}return t._stat}async content(t){}async oid(t){if(t._oid===!1){const n=(await this.treePromise).get(t._fullpath);t._oid=n.metadata.oid}return t._oid}}const Ki=Symbol("GitWalkSymbol");function nn(){const e=Object.create(null);return Object.defineProperty(e,Ki,{value:function({fs:t,gitdir:r,cache:n}){return new bw({fs:t,gitdir:r,cache:n})}}),Object.freeze(e),e}class Oe extends we{constructor(t){super(`Could not find ${t}.`),this.code=this.name=Oe.code,this.data={what:t}}}Oe.code="NotFoundError";class rt extends we{constructor(t,r,n,i){super(`Object ${t} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=rt.code,this.data={oid:t,actual:r,expected:n,filepath:i}}}rt.code="ObjectTypeError";class lr extends we{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=lr.code,this.data={value:t}}}lr.code="InvalidOidError";class Xn extends we{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:
11
11
  [remote "${t}"]
12
12
  fetch = +refs/heads/*:refs/remotes/origin/*
13
13
  `),this.code=this.name=Xn.code,this.data={remote:t}}}Xn.code="NoRefspecError";class Ji{constructor(t){if(this.refs=new Map,this.parsedConfig=[],t){let r=null;this.parsedConfig=t.trim().split(`
14
14
  `).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};const i=n.indexOf(" ");if(n.startsWith("^")){const a=n.slice(1);return this.refs.set(r+"^{}",a),{line:n,ref:r,peeled:a}}else{const a=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,a),{line:n,ref:r,oid:a}}})}return this}static from(t){return new Ji(t)}delete(t){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==t),this.refs.delete(t)}toString(){return this.parsedConfig.map(({line:t})=>t).join(`
15
15
  `)+`
16
- `}}class Qi{constructor({remotePath:t,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:t,localPath:r,force:n,matchPrefix:i})}static from(t){const[r,n,i,a,o]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s=r==="+",l=i==="*";if(l!==(o==="*"))throw new se("Invalid refspec");return new Qi({remotePath:n,localPath:a,force:s,matchPrefix:l})}translate(t){if(this.matchPrefix){if(t.startsWith(this.remotePath))return this.localPath+t.replace(this.remotePath,"")}else if(t===this.remotePath)return this.localPath;return null}reverseTranslate(t){if(this.matchPrefix){if(t.startsWith(this.localPath))return this.remotePath+t.replace(this.localPath,"")}else if(t===this.localPath)return this.remotePath;return null}}class Fo{constructor(t=[]){this.rules=t}static from(t){const r=[];for(const n of t)r.push(Qi.from(n));return new Fo(r)}add(t){const r=Qi.from(t);this.rules.push(r)}translate(t){const r=[];for(const n of this.rules)for(const i of t){const a=n.translate(i);a&&r.push([i,a])}return r}translateOne(t){let r=null;for(const n of this.rules){const i=n.translate(t);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(t=>t.matchPrefix).map(t=>t.localPath.replace(/\/$/,""))}}function vw(e,t){const r=e.replace(/\^\{\}$/,""),n=t.replace(/\^\{\}$/,""),i=-(r<n)||+(r>n);return i===0?e.endsWith("^{}")?1:-1:i}const _w=e=>{e=e.toLowerCase();let t=parseInt(e);return e.endsWith("k")&&(t*=1024),e.endsWith("m")&&(t*=1024*1024),e.endsWith("g")&&(t*=1024*1024*1024),t},Vn=e=>{if(e=e.trim().toLowerCase(),e==="true"||e==="yes"||e==="on")return!0;if(e==="false"||e==="no"||e==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${e}`)},_u={core:{filemode:Vn,bare:Vn,logallrefupdates:Vn,symlinks:Vn,ignorecase:Vn,bigFileThreshold:_w}},xw=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,Ew=/^[A-Za-z0-9-.]+$/,Sw=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,kw=/^[A-Za-z][A-Za-z-]*$/,Rw=/^(.*?)( *[#;].*)$/,Ow=e=>{const t=xw.exec(e);if(t!=null){const[r,n]=t.slice(1);return[r,n]}return null},Cw=e=>{const t=Sw.exec(e);if(t!=null){const[r,n="true"]=t.slice(1),i=Pw(n),a=Tw(i);return[r,a]}return null},Pw=e=>{const t=Rw.exec(e);if(t==null)return e;const[r,n]=t.slice(1);return xu(r)&&xu(n)?`${r}${n}`:r},xu=e=>(e.match(/(?:^|[^\\])"/g)||[]).length%2!==0,Tw=e=>e.split("").reduce((t,r,n,i)=>{const a=r==='"'&&i[n-1]!=="\\",o=r==="\\"&&i[n+1]==='"';return a||o?t:t+r},""),Eu=e=>e!=null?e.toLowerCase():null,Uo=(e,t,r)=>[Eu(e),t,Eu(r)].filter(n=>n!=null).join("."),Su=e=>{const t=e.split("."),r=t.shift(),n=t.pop(),i=t.length?t.join("."):void 0;return{section:r,subsection:i,name:n,path:Uo(r,i,n),sectionPath:Uo(r,i,null)}},Aw=(e,t)=>e.reduce((r,n,i)=>t(n)?i:r,-1);class Ho{constructor(t){let r=null,n=null;this.parsedConfig=t?t.split(`
17
- `).map(i=>{let a=null,o=null;const s=i.trim(),l=Ow(s),c=l!=null;if(c)[r,n]=l;else{const d=Cw(s);d!=null&&([a,o]=d)}const u=Uo(r,n,a);return{line:i,isSection:c,section:r,subsection:n,name:a,value:o,path:u}}):[]}static from(t){return new Ho(t)}async get(t,r=!1){const n=Su(t).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:o,value:s})=>{const l=_u[a]&&_u[a][o];return l?l(s):s});return r?i:i.pop()}async getall(t){return this.get(t,!0)}async getSubsections(t){return this.parsedConfig.filter(r=>r.section===t&&r.isSection).map(r=>r.subsection)}async deleteSection(t,r){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===t&&n.subsection===r))}async append(t,r){return this.set(t,r,!0)}async set(t,r,n=!1){const{section:i,subsection:a,name:o,path:s,sectionPath:l}=Su(t),c=Aw(this.parsedConfig,u=>u.path===s);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){const u=this.parsedConfig[c],d=Object.assign({},u,{name:o,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,d):this.parsedConfig[c]=d}else{const u=this.parsedConfig.findIndex(p=>p.path===l),d={section:i,subsection:a,name:o,value:r,modified:!0,path:s};if(Ew.test(i)&&kw.test(o))if(u>=0)this.parsedConfig.splice(u+1,0,d);else{const p={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(p,d)}}}toString(){return this.parsedConfig.map(({line:t,section:r,subsection:n,name:i,value:a,modified:o=!1})=>o?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:n!=null?`[${r} "${n}"]`:`[${r}]`:t).join(`
18
- `)}}class Me{static async get({fs:t,gitdir:r}){const n=await t.read(`${r}/config`,{encoding:"utf8"});return Ho.from(n)}static async save({fs:t,gitdir:r,config:n}){await t.write(`${r}/config`,n.toString(),{encoding:"utf8"})}}const ea=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],Dw=["config","description","index","shallow","commondir"];let Wo;async function ur(e,t){return Wo===void 0&&(Wo=new Tn),Wo.acquire(e,t)}class H{static async updateRemoteRefs({fs:t,gitdir:r,remote:n,refs:i,symrefs:a,tags:o,refspecs:s=void 0,prune:l=!1,pruneTags:c=!1}){for(const x of i.values())if(!x.match(/[0-9a-f]{40}/))throw new lr(x);const u=await Me.get({fs:t,gitdir:r});if(!s){if(s=await u.getall(`remote.${n}.fetch`),s.length===0)throw new Xn(n);s.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}const d=Fo.from(s),p=new Map;if(c){const x=await H.listRefs({fs:t,gitdir:r,filepath:"refs/tags"});await H.deleteRefs({fs:t,gitdir:r,refs:x.map(b=>`refs/tags/${b}`)})}if(o){for(const x of i.keys())if(x.startsWith("refs/tags")&&!x.endsWith("^{}")&&!await H.exists({fs:t,gitdir:r,ref:x})){const b=i.get(x);p.set(x,b)}}const m=d.translate([...i.keys()]);for(const[x,b]of m){const _=i.get(x);p.set(b,_)}const g=d.translate([...a.keys()]);for(const[x,b]of g){const _=a.get(x),k=d.translateOne(_);k&&p.set(b,`ref: ${k}`)}const v=[];if(l){for(const x of d.localNamespaces()){const b=(await H.listRefs({fs:t,gitdir:r,filepath:x})).map(_=>`${x}/${_}`);for(const _ of b)p.has(_)||v.push(_)}v.length>0&&await H.deleteRefs({fs:t,gitdir:r,refs:v})}for(const[x,b]of p)await ur(x,async()=>t.write(N.join(r,x),`${b.trim()}
19
- `,"utf8"));return{pruned:v}}static async writeRef({fs:t,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new lr(i);await ur(n,async()=>t.write(N.join(r,n),`${i.trim()}
16
+ `}}class Qi{constructor({remotePath:t,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:t,localPath:r,force:n,matchPrefix:i})}static from(t){const[r,n,i,a,o]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s=r==="+",l=i==="*";if(l!==(o==="*"))throw new se("Invalid refspec");return new Qi({remotePath:n,localPath:a,force:s,matchPrefix:l})}translate(t){if(this.matchPrefix){if(t.startsWith(this.remotePath))return this.localPath+t.replace(this.remotePath,"")}else if(t===this.remotePath)return this.localPath;return null}reverseTranslate(t){if(this.matchPrefix){if(t.startsWith(this.localPath))return this.remotePath+t.replace(this.localPath,"")}else if(t===this.localPath)return this.remotePath;return null}}class Fo{constructor(t=[]){this.rules=t}static from(t){const r=[];for(const n of t)r.push(Qi.from(n));return new Fo(r)}add(t){const r=Qi.from(t);this.rules.push(r)}translate(t){const r=[];for(const n of this.rules)for(const i of t){const a=n.translate(i);a&&r.push([i,a])}return r}translateOne(t){let r=null;for(const n of this.rules){const i=n.translate(t);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(t=>t.matchPrefix).map(t=>t.localPath.replace(/\/$/,""))}}function _w(e,t){const r=e.replace(/\^\{\}$/,""),n=t.replace(/\^\{\}$/,""),i=-(r<n)||+(r>n);return i===0?e.endsWith("^{}")?1:-1:i}const vw=e=>{e=e.toLowerCase();let t=parseInt(e);return e.endsWith("k")&&(t*=1024),e.endsWith("m")&&(t*=1024*1024),e.endsWith("g")&&(t*=1024*1024*1024),t},Vn=e=>{if(e=e.trim().toLowerCase(),e==="true"||e==="yes"||e==="on")return!0;if(e==="false"||e==="no"||e==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${e}`)},xu={core:{filemode:Vn,bare:Vn,logallrefupdates:Vn,symlinks:Vn,ignorecase:Vn,bigFileThreshold:vw}},xw=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,Ew=/^[A-Za-z0-9-.]+$/,Sw=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,kw=/^[A-Za-z][A-Za-z-]*$/,Rw=/^(.*?)( *[#;].*)$/,Ow=e=>{const t=xw.exec(e);if(t!=null){const[r,n]=t.slice(1);return[r,n]}return null},Cw=e=>{const t=Sw.exec(e);if(t!=null){const[r,n="true"]=t.slice(1),i=Pw(n),a=Tw(i);return[r,a]}return null},Pw=e=>{const t=Rw.exec(e);if(t==null)return e;const[r,n]=t.slice(1);return Eu(r)&&Eu(n)?`${r}${n}`:r},Eu=e=>(e.match(/(?:^|[^\\])"/g)||[]).length%2!==0,Tw=e=>e.split("").reduce((t,r,n,i)=>{const a=r==='"'&&i[n-1]!=="\\",o=r==="\\"&&i[n+1]==='"';return a||o?t:t+r},""),Su=e=>e!=null?e.toLowerCase():null,Uo=(e,t,r)=>[Su(e),t,Su(r)].filter(n=>n!=null).join("."),ku=e=>{const t=e.split("."),r=t.shift(),n=t.pop(),i=t.length?t.join("."):void 0;return{section:r,subsection:i,name:n,path:Uo(r,i,n),sectionPath:Uo(r,i,null)}},Aw=(e,t)=>e.reduce((r,n,i)=>t(n)?i:r,-1);class Ho{constructor(t){let r=null,n=null;this.parsedConfig=t?t.split(`
17
+ `).map(i=>{let a=null,o=null;const s=i.trim(),l=Ow(s),c=l!=null;if(c)[r,n]=l;else{const d=Cw(s);d!=null&&([a,o]=d)}const u=Uo(r,n,a);return{line:i,isSection:c,section:r,subsection:n,name:a,value:o,path:u}}):[]}static from(t){return new Ho(t)}async get(t,r=!1){const n=ku(t).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:o,value:s})=>{const l=xu[a]&&xu[a][o];return l?l(s):s});return r?i:i.pop()}async getall(t){return this.get(t,!0)}async getSubsections(t){return this.parsedConfig.filter(r=>r.section===t&&r.isSection).map(r=>r.subsection)}async deleteSection(t,r){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===t&&n.subsection===r))}async append(t,r){return this.set(t,r,!0)}async set(t,r,n=!1){const{section:i,subsection:a,name:o,path:s,sectionPath:l}=ku(t),c=Aw(this.parsedConfig,u=>u.path===s);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){const u=this.parsedConfig[c],d=Object.assign({},u,{name:o,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,d):this.parsedConfig[c]=d}else{const u=this.parsedConfig.findIndex(p=>p.path===l),d={section:i,subsection:a,name:o,value:r,modified:!0,path:s};if(Ew.test(i)&&kw.test(o))if(u>=0)this.parsedConfig.splice(u+1,0,d);else{const p={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(p,d)}}}toString(){return this.parsedConfig.map(({line:t,section:r,subsection:n,name:i,value:a,modified:o=!1})=>o?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:n!=null?`[${r} "${n}"]`:`[${r}]`:t).join(`
18
+ `)}}class Me{static async get({fs:t,gitdir:r}){const n=await t.read(`${r}/config`,{encoding:"utf8"});return Ho.from(n)}static async save({fs:t,gitdir:r,config:n}){await t.write(`${r}/config`,n.toString(),{encoding:"utf8"})}}const ea=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],Dw=["config","description","index","shallow","commondir"];let Wo;async function ur(e,t){return Wo===void 0&&(Wo=new Tn),Wo.acquire(e,t)}class H{static async updateRemoteRefs({fs:t,gitdir:r,remote:n,refs:i,symrefs:a,tags:o,refspecs:s=void 0,prune:l=!1,pruneTags:c=!1}){for(const v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new lr(v);const u=await Me.get({fs:t,gitdir:r});if(!s){if(s=await u.getall(`remote.${n}.fetch`),s.length===0)throw new Xn(n);s.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}const d=Fo.from(s),p=new Map;if(c){const v=await H.listRefs({fs:t,gitdir:r,filepath:"refs/tags"});await H.deleteRefs({fs:t,gitdir:r,refs:v.map(y=>`refs/tags/${y}`)})}if(o){for(const v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await H.exists({fs:t,gitdir:r,ref:v})){const y=i.get(v);p.set(v,y)}}const m=d.translate([...i.keys()]);for(const[v,y]of m){const _=i.get(v);p.set(y,_)}const g=d.translate([...a.keys()]);for(const[v,y]of g){const _=a.get(v),R=d.translateOne(_);R&&p.set(y,`ref: ${R}`)}const b=[];if(l){for(const v of d.localNamespaces()){const y=(await H.listRefs({fs:t,gitdir:r,filepath:v})).map(_=>`${v}/${_}`);for(const _ of y)p.has(_)||b.push(_)}b.length>0&&await H.deleteRefs({fs:t,gitdir:r,refs:b})}for(const[v,y]of p)await ur(v,async()=>t.write(N.join(r,v),`${y.trim()}
19
+ `,"utf8"));return{pruned:b}}static async writeRef({fs:t,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new lr(i);await ur(n,async()=>t.write(N.join(r,n),`${i.trim()}
20
20
  `,"utf8"))}static async writeSymbolicRef({fs:t,gitdir:r,ref:n,value:i}){await ur(n,async()=>t.write(N.join(r,n),`ref: ${i.trim()}
21
- `,"utf8"))}static async deleteRef({fs:t,gitdir:r,ref:n}){return H.deleteRefs({fs:t,gitdir:r,refs:[n]})}static async deleteRefs({fs:t,gitdir:r,refs:n}){await Promise.all(n.map(s=>t.rm(N.join(r,s))));let i=await ur("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"}));const a=Ji.from(i),o=a.refs.size;for(const s of n)a.refs.has(s)&&a.delete(s);a.refs.size<o&&(i=a.toString(),await ur("packed-refs",async()=>t.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:t,gitdir:r,ref:n,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),H.resolve({fs:t,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;const a=await H.packedRefs({fs:t,gitdir:r}),o=ea(n).filter(s=>!Dw.includes(s));for(const s of o){const l=await ur(s,async()=>await t.read(`${r}/${s}`,{encoding:"utf8"})||a.get(s));if(l)return H.resolve({fs:t,gitdir:r,ref:l.trim(),depth:i})}throw new Oe(n)}static async exists({fs:t,gitdir:r,ref:n}){try{return await H.expand({fs:t,gitdir:r,ref:n}),!0}catch{return!1}}static async expand({fs:t,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;const i=await H.packedRefs({fs:t,gitdir:r}),a=ea(n);for(const o of a)if(await ur(o,async()=>t.exists(`${r}/${o}`))||i.has(o))return o;throw new Oe(n)}static async expandAgainstMap({ref:t,map:r}){const n=ea(t);for(const i of n)if(await r.has(i))return i;throw new Oe(t)}static resolveAgainstMap({ref:t,fullref:r=t,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:t};if(t.startsWith("ref: "))return t=t.slice(5),H.resolveAgainstMap({ref:t,fullref:r,depth:n,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:r,oid:t};const a=ea(t);for(const o of a){const s=i.get(o);if(s)return H.resolveAgainstMap({ref:s.trim(),fullref:o,depth:n,map:i})}throw new Oe(t)}static async packedRefs({fs:t,gitdir:r}){const n=await ur("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"}));return Ji.from(n).refs}static async listRefs({fs:t,gitdir:r,filepath:n}){const i=H.packedRefs({fs:t,gitdir:r});let a=null;try{a=await t.readdirDeep(`${r}/${n}`),a=a.map(o=>o.replace(`${r}/${n}/`,""))}catch{a=[]}for(let o of(await i).keys())o.startsWith(n)&&(o=o.replace(n+"/",""),a.includes(o)||a.push(o));return a.sort(vw),a}static async listBranches({fs:t,gitdir:r,remote:n}){return n?H.listRefs({fs:t,gitdir:r,filepath:`refs/remotes/${n}`}):H.listRefs({fs:t,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:r}){return(await H.listRefs({fs:t,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}}function $w(e,t){return Zi(ku(e),ku(t))}function ku(e){return e.mode==="040000"?e.path+"/":e.path}function Ru(e){switch(e){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new se(`Unexpected GitTree entry mode: ${e}`)}function Iw(e){const t=[];let r=0;for(;r<e.length;){const n=e.indexOf(32,r);if(n===-1)throw new se(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);const i=e.indexOf(0,r);if(i===-1)throw new se(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let a=e.slice(r,n).toString("utf8");a==="40000"&&(a="040000");const o=Ru(a),s=e.slice(n+1,i).toString("utf8");if(s.includes("\\")||s.includes("/"))throw new Qr(s);const l=e.slice(i+1,i+21).toString("hex");r=i+21,t.push({mode:a,path:s,oid:l,type:o})}return t}function Bw(e){if(typeof e=="number"&&(e=e.toString(8)),e.match(/^0?4.*/))return"040000";if(e.match(/^1006.*/))return"100644";if(e.match(/^1007.*/))return"100755";if(e.match(/^120.*/))return"120000";if(e.match(/^160.*/))return"160000";throw new se(`Could not understand file mode: ${e}`)}function jw(e){return!e.oid&&e.sha&&(e.oid=e.sha),e.mode=Bw(e.mode),e.type||(e.type=Ru(e.mode)),e}class st{constructor(t){if(Buffer.isBuffer(t))this._entries=Iw(t);else if(Array.isArray(t))this._entries=t.map(jw);else throw new se("invalid type passed to GitTree constructor");this._entries.sort(wu)}static from(t){return new st(t)}render(){return this._entries.map(t=>`${t.mode} ${t.type} ${t.oid} ${t.path}`).join(`
22
- `)}toObject(){const t=[...this._entries];return t.sort($w),Buffer.concat(t.map(r=>{const n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),o=Buffer.from([0]),s=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,o,s])}))}entries(){return this._entries}*[Symbol.iterator](){for(const t of this._entries)yield t}}class an{static wrap({type:t,object:r}){return Buffer.concat([Buffer.from(`${t} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(t){const r=t.indexOf(32),n=t.indexOf(0),i=t.slice(0,r).toString("utf8"),a=t.slice(r+1,n).toString("utf8"),o=t.length-(n+1);if(parseInt(a)!==o)throw new se(`Length mismatch: expected ${a} bytes but got ${o} instead.`);return{type:i,object:Buffer.from(t.slice(n+1))}}}async function Ou({fs:e,gitdir:t,oid:r}){const n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await e.read(`${t}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function zw(e,t){const r=new Lt(e),n=Cu(r);if(n!==t.byteLength)throw new se(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${t.length} bytes`);const i=Cu(r);let a;const o=Tu(r,t);if(o.byteLength===i)a=o;else{a=Buffer.alloc(i);const s=new Lt(a);for(s.copy(o);!r.eof();)s.copy(Tu(r,t));const l=s.tell();if(i!==l)throw new se(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function Cu(e){let t=0,r=0,n=null;do n=e.readUInt8(),t|=(n&127)<<r,r+=7;while(n&128);return t}function Pu(e,t,r){let n=0,i=0;for(;r--;)t&1&&(n|=e.readUInt8()<<i),t>>=1,i+=8;return n}function Tu(e,t){const r=e.readUInt8(),n=128,i=15,a=112;if(r&n){const o=Pu(e,r&i,4);let s=Pu(e,(r&a)>>4,3);return s===0&&(s=65536),t.slice(o,o+s)}else return e.slice(r)}function Nw(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function Au(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:Nw(e)}class Du{constructor(t){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=Au(t),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(t){if(!this.eof())return this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t),this.buffer.slice(this.undoCursor,this.cursor)}async skip(t){this.eof()||(this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:t,value:r}=await this.stream.next();return t&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(t){this.undoCursor=this.cursor,this.cursor+=t,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(t){if(this._ended)return;const r=[this.buffer];for(;this.cursor+t>Mw(r);){const n=await this._next();if(this._ended)break;r.push(n)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}}function Mw(e){return e.reduce((t,r)=>t+r.length,0)}async function Lw(e,t){const r=new Du(e);let n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new se(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new se(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){const o=r.tell(),{type:s,length:l,ofs:c,reference:u}=await Fw(r),d=new $o.Inflate;for(;!d.result;){const p=await r.chunk();if(!p)break;if(d.push(p,!1),d.err)throw new se(`Pako error: ${d.msg}`);if(d.result){if(d.result.length!==l)throw new se("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(p.length-d.strm.avail_in);const m=r.tell();await t({data:d.result,type:s,num:a,offset:o,end:m,reference:u,ofs:c})}}}}async function Fw(e){let t=await e.byte();const r=t>>4&7;let n=t&15;if(t&128){let o=4;do t=await e.byte(),n|=(t&127)<<o,o+=7;while(t&128)}let i,a;if(r===6){let o=0;i=0;const s=[];do t=await e.byte(),i|=(t&127)<<o,o+=7,s.push(t);while(t&128);a=Buffer.from(s)}return r===7&&(a=await e.read(20)),{type:r,length:n,ofs:i,reference:a}}async function $u(e){return $o.inflate(e)}function Uw(e){const t=[];let r=0,n=0;do{r=e.readUInt8();const i=r&127;t.push(i),n=r&128}while(n);return t.reduce((i,a)=>i+1<<7|a,-1)}function Hw(e,t){let r=t,n=4,i=null;do i=e.readUInt8(),r|=(i&127)<<n,n+=7;while(i&128);return r}class on{constructor(t){Object.assign(this,t),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:r}){const n=new Lt(t);if(n.slice(4).toString("hex")!=="ff744f63")return;const a=n.readUInt32BE();if(a!==2)throw new se(`Unable to read version ${a} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new se("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+4*255);const o=n.readUInt32BE(),s=[];for(let u=0;u<o;u++){const d=n.slice(20).toString("hex");s[u]=d}n.seek(n.tell()+4*o);const l=new Map;for(let u=0;u<o;u++)l.set(s[u],n.readUInt32BE());const c=n.slice(20).toString("hex");return new on({hashes:s,crcs:{},offsets:l,packfileSha:c,getExternalRefDelta:r})}static async fromPack({pack:t,getExternalRefDelta:r,onProgress:n}){const i={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},a={},o=t.slice(-20).toString("hex"),s=[],l={},c=new Map;let u=null,d=null;await Lw([t],async({data:x,type:b,reference:_,offset:k,num:S})=>{u===null&&(u=S);const y=Math.floor((u-S)*100/u);y!==d&&n&&await n({phase:"Receiving objects",loaded:u-S,total:u}),d=y,b=i[b],["commit","tree","blob","tag"].includes(b)?a[k]={type:b,offset:k}:b==="ofs-delta"?a[k]={type:b,offset:k}:b==="ref-delta"&&(a[k]={type:b,offset:k})});const p=Object.keys(a).map(Number);for(const[x,b]of p.entries()){const _=x+1===p.length?t.byteLength-20:p[x+1],k=a[b],S=Mp.buf(t.slice(b,_))>>>0;k.end=_,k.crc=S}const m=new on({pack:Promise.resolve(t),packfileSha:o,crcs:l,hashes:s,offsets:c,getExternalRefDelta:r});d=null;let g=0;const v=[0,0,0,0,0,0,0,0,0,0,0,0];for(let x in a){x=Number(x);const b=Math.floor(g*100/u);b!==d&&n&&await n({phase:"Resolving deltas",loaded:g,total:u}),g++,d=b;const _=a[x];if(!_.oid)try{m.readDepth=0,m.externalReadDepth=0;const{type:k,object:S}=await m.readSlice({start:x});v[m.readDepth]+=1;const y=await Vt(an.wrap({type:k,object:S}));_.oid=y,s.push(y),c.set(y,x),l[y]=_.crc}catch{continue}}return s.sort(),m}async toBuffer(){const t=[],r=(c,u)=>{t.push(Buffer.from(c,u))};r("ff744f63","hex"),r("00000002","hex");const n=new Lt(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(const d of this.hashes)parseInt(d.slice(0,2),16)<=c&&u++;n.writeUInt32BE(u)}t.push(n.buffer);for(const c of this.hashes)r(c,"hex");const i=new Lt(Buffer.alloc(this.hashes.length*4));for(const c of this.hashes)i.writeUInt32BE(this.crcs[c]);t.push(i.buffer);const a=new Lt(Buffer.alloc(this.hashes.length*4));for(const c of this.hashes)a.writeUInt32BE(this.offsets.get(c));t.push(a.buffer),r(this.packfileSha,"hex");const o=Buffer.concat(t),s=await Vt(o),l=Buffer.alloc(20);return l.write(s,"hex"),Buffer.concat([o,l])}async load({pack:t}){this.pack=t}async unload(){this.pack=null}async read({oid:t}){if(!this.offsets.get(t)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(t);throw new se(`Could not read object ${t} from packfile`)}const r=this.offsets.get(t);return this.readSlice({start:r})}async readSlice({start:t}){if(this.offsetCache[t])return Object.assign({},this.offsetCache[t]);this.readDepth++;const r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new se("Tried to read from a GitPackIndex with no packfile loaded into memory");const n=(await this.pack).slice(t),i=new Lt(n),a=i.readUInt8(),o=a&112;let s=r[o];if(s===void 0)throw new se("Unrecognized type: 0b"+o.toString(2));const l=a&15;let c=l;a&128&&(c=Hw(i,l));let d=null,p=null;if(s==="ofs_delta"){const g=Uw(i),v=t-g;({object:d,type:s}=await this.readSlice({start:v}))}if(s==="ref_delta"){const g=i.slice(20).toString("hex");({object:d,type:s}=await this.read({oid:g}))}const m=n.slice(i.tell());if(p=Buffer.from(await $u(m)),p.byteLength!==c)throw new se(`Packfile told us object would have length ${c} but it had length ${p.byteLength}`);return d&&(p=Buffer.from(zw(p,d))),this.readDepth>3&&(this.offsetCache[t]={type:s,object:p}),{type:s,format:"content",object:p}}}const ta=Symbol("PackfileCache");async function Ww({fs:e,filename:t,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){const a=await e.read(t);return on.fromIdx({idx:a,getExternalRefDelta:r})}function qo({fs:e,cache:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}){t[ta]||(t[ta]=new Map);let o=t[ta].get(r);return o||(o=Ww({fs:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}),t[ta].set(r,o)),o}async function qw({fs:e,cache:t,gitdir:r,oid:n,format:i="content",getExternalRefDelta:a}){let o=await e.readdir(N.join(r,"objects/pack"));o=o.filter(s=>s.endsWith(".idx"));for(const s of o){const l=`${r}/objects/pack/${s}`,c=await qo({fs:e,cache:t,filename:l,getExternalRefDelta:a});if(c.error)throw new se(c.error);if(c.offsets.has(n)){if(!c.pack){const d=l.replace(/idx$/,"pack");c.pack=e.read(d)}const u=await c.read({oid:n,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${s.replace(/idx$/,"pack")}`,u}}return null}async function Ae({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=u=>Ae({fs:e,cache:t,gitdir:r,oid:u});let o;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:Buffer.from("tree 0\0")}),o||(o=await Ou({fs:e,gitdir:r,oid:n})),!o){if(o=await qw({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a}),!o)throw new Oe(n);return o}if(i==="deflated"||(o.format==="deflated"&&(o.object=Buffer.from(await $u(o.object)),o.format="wrapped"),i==="wrapped"))return o;const s=await Vt(o.object);if(s!==n)throw new se(`SHA check failed! Expected ${n}, computed ${s}`);const{object:l,type:c}=an.unwrap(o.object);if(o.type=c,o.object=l,o.format="content",i==="content")return o;throw new se(`invalid requested format "${i}"`)}class Ot extends we{constructor(t,r,n=!0){super(`Failed to create ${t} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:""}`),this.code=this.name=Ot.code,this.data={noun:t,where:r,canForce:n}}}Ot.code="AlreadyExistsError";class Kn extends we{constructor(t,r,n){super(`Found multiple ${t} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=Kn.code,this.data={nouns:t,short:r,matches:n}}}Kn.code="AmbiguousError";class Jn extends we{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(", ")}`),this.code=this.name=Jn.code,this.data={filepaths:t}}}Jn.code="CheckoutConflictError";class Qn extends we{constructor(t,r){super(`Failed to checkout "${t}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=Qn.code,this.data={ref:t,oid:r}}}Qn.code="CommitNotFetchedError";class ei extends we{constructor(){super("Empty response from git server."),this.code=this.name=ei.code,this.data={}}}ei.code="EmptyServerResponseError";class ti extends we{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=ti.code,this.data={}}}ti.code="FastForwardError";class ri extends we{constructor(t,r){super(`One or more branches were not updated: ${t}`),this.code=this.name=ri.code,this.data={prettyDetails:t,result:r}}}ri.code="GitPushError";class sn extends we{constructor(t,r,n){super(`HTTP Error: ${t} ${r}`),this.code=this.name=sn.code,this.data={statusCode:t,statusMessage:r,response:n}}}sn.code="HttpError";class fr extends we{constructor(t){let r="invalid filepath";t==="leading-slash"||t==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':t==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=fr.code,this.data={reason:t}}}fr.code="InvalidFilepathError";class Ct extends we{constructor(t,r){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=Ct.code,this.data={ref:t,suggestion:r}}}Ct.code="InvalidRefNameError";class ni extends we{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=ni.code,this.data={depth:t}}}ni.code="MaxDepthError";class cn extends we{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=cn.code,this.data={}}}cn.code="MergeNotSupportedError";class ln extends we{constructor(t,r,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=ln.code,this.data={filepaths:t,bothModified:r,deleteByUs:n,deleteByTheirs:i}}}ln.code="MergeConflictError";class Xe extends we{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=Xe.code,this.data={role:t}}}Xe.code="MissingNameError";class ct extends we{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=ct.code,this.data={parameter:t}}}ct.code="MissingParameterError";class ii extends we{constructor(t){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=ii.code,this.data={errors:t},this.errors=t}}ii.code="MultipleGitError";class Dr extends we{constructor(t,r){super(`Expected "${t}" but received "${r}".`),this.code=this.name=Dr.code,this.data={expected:t,actual:r}}}Dr.code="ParseError";class un extends we{constructor(t){let r="";t==="not-fast-forward"?r=" because it was not a simple fast-forward":t==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=un.code,this.data={reason:t}}}un.code="PushRejectedError";class dr extends we{constructor(t,r){super(`Remote does not support the "${t}" so the "${r}" parameter cannot be used.`),this.code=this.name=dr.code,this.data={capability:t,parameter:r}}}dr.code="RemoteCapabilityError";class ai extends we{constructor(t,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=ai.code,this.data={preview:t,response:r}}}ai.code="SmartHttpError";class oi extends we{constructor(t,r,n){super(`Git remote "${t}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=oi.code,this.data={url:t,transport:r,suggestion:n}}}oi.code="UnknownTransportError";class si extends we{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=si.code,this.data={url:t}}}si.code="UrlParseError";class fn extends we{constructor(){super("The operation was canceled."),this.code=this.name=fn.code,this.data={}}}fn.code="UserCanceledError";class ci extends we{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=ci.code,this.data={filepath:t}}}ci.code="IndexResetError";class li extends we{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=li.code,this.data={ref:t}}}li.code="NoCommitError";var Gw=Object.freeze({__proto__:null,AlreadyExistsError:Ot,AmbiguousError:Kn,CheckoutConflictError:Jn,CommitNotFetchedError:Qn,EmptyServerResponseError:ei,FastForwardError:ti,GitPushError:ri,HttpError:sn,InternalError:se,InvalidFilepathError:fr,InvalidOidError:lr,InvalidRefNameError:Ct,MaxDepthError:ni,MergeNotSupportedError:cn,MergeConflictError:ln,MissingNameError:Xe,MissingParameterError:ct,MultipleGitError:ii,NoRefspecError:Xn,NotFoundError:Oe,ObjectTypeError:rt,ParseError:Dr,PushRejectedError:un,RemoteCapabilityError:dr,SmartHttpError:ai,UnknownTransportError:oi,UnsafeFilepathError:Qr,UrlParseError:si,UserCanceledError:fn,UnmergedPathsError:Zn,IndexResetError:ci,NoCommitError:li});function Go({name:e,email:t,timestamp:r,timezoneOffset:n}){return n=Yw(n),`${e} <${t}> ${r} ${n}`}function Yw(e){const t=Zw(Xw(e));e=Math.abs(e);const r=Math.floor(e/60);e-=r*60;let n=String(r),i=String(e);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(t===-1?"-":"+")+n+i}function Zw(e){return Math.sign(e)||(Object.is(e,-0)?-1:1)}function Xw(e){return e===0?e:-e}function Kt(e){return e=e.replace(/\r/g,""),e=e.replace(/^\n+/,""),e=e.replace(/\n+$/,"")+`
21
+ `,"utf8"))}static async deleteRef({fs:t,gitdir:r,ref:n}){return H.deleteRefs({fs:t,gitdir:r,refs:[n]})}static async deleteRefs({fs:t,gitdir:r,refs:n}){await Promise.all(n.map(s=>t.rm(N.join(r,s))));let i=await ur("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"}));const a=Ji.from(i),o=a.refs.size;for(const s of n)a.refs.has(s)&&a.delete(s);a.refs.size<o&&(i=a.toString(),await ur("packed-refs",async()=>t.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:t,gitdir:r,ref:n,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),H.resolve({fs:t,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;const a=await H.packedRefs({fs:t,gitdir:r}),o=ea(n).filter(s=>!Dw.includes(s));for(const s of o){const l=await ur(s,async()=>await t.read(`${r}/${s}`,{encoding:"utf8"})||a.get(s));if(l)return H.resolve({fs:t,gitdir:r,ref:l.trim(),depth:i})}throw new Oe(n)}static async exists({fs:t,gitdir:r,ref:n}){try{return await H.expand({fs:t,gitdir:r,ref:n}),!0}catch{return!1}}static async expand({fs:t,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;const i=await H.packedRefs({fs:t,gitdir:r}),a=ea(n);for(const o of a)if(await ur(o,async()=>t.exists(`${r}/${o}`))||i.has(o))return o;throw new Oe(n)}static async expandAgainstMap({ref:t,map:r}){const n=ea(t);for(const i of n)if(await r.has(i))return i;throw new Oe(t)}static resolveAgainstMap({ref:t,fullref:r=t,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:t};if(t.startsWith("ref: "))return t=t.slice(5),H.resolveAgainstMap({ref:t,fullref:r,depth:n,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:r,oid:t};const a=ea(t);for(const o of a){const s=i.get(o);if(s)return H.resolveAgainstMap({ref:s.trim(),fullref:o,depth:n,map:i})}throw new Oe(t)}static async packedRefs({fs:t,gitdir:r}){const n=await ur("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"}));return Ji.from(n).refs}static async listRefs({fs:t,gitdir:r,filepath:n}){const i=H.packedRefs({fs:t,gitdir:r});let a=null;try{a=await t.readdirDeep(`${r}/${n}`),a=a.map(o=>o.replace(`${r}/${n}/`,""))}catch{a=[]}for(let o of(await i).keys())o.startsWith(n)&&(o=o.replace(n+"/",""),a.includes(o)||a.push(o));return a.sort(_w),a}static async listBranches({fs:t,gitdir:r,remote:n}){return n?H.listRefs({fs:t,gitdir:r,filepath:`refs/remotes/${n}`}):H.listRefs({fs:t,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:r}){return(await H.listRefs({fs:t,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}}function $w(e,t){return Zi(Ru(e),Ru(t))}function Ru(e){return e.mode==="040000"?e.path+"/":e.path}function Ou(e){switch(e){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new se(`Unexpected GitTree entry mode: ${e}`)}function Iw(e){const t=[];let r=0;for(;r<e.length;){const n=e.indexOf(32,r);if(n===-1)throw new se(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);const i=e.indexOf(0,r);if(i===-1)throw new se(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let a=e.slice(r,n).toString("utf8");a==="40000"&&(a="040000");const o=Ou(a),s=e.slice(n+1,i).toString("utf8");if(s.includes("\\")||s.includes("/"))throw new Qr(s);const l=e.slice(i+1,i+21).toString("hex");r=i+21,t.push({mode:a,path:s,oid:l,type:o})}return t}function jw(e){if(typeof e=="number"&&(e=e.toString(8)),e.match(/^0?4.*/))return"040000";if(e.match(/^1006.*/))return"100644";if(e.match(/^1007.*/))return"100755";if(e.match(/^120.*/))return"120000";if(e.match(/^160.*/))return"160000";throw new se(`Could not understand file mode: ${e}`)}function Bw(e){return!e.oid&&e.sha&&(e.oid=e.sha),e.mode=jw(e.mode),e.type||(e.type=Ou(e.mode)),e}class ct{constructor(t){if(Buffer.isBuffer(t))this._entries=Iw(t);else if(Array.isArray(t))this._entries=t.map(Bw);else throw new se("invalid type passed to GitTree constructor");this._entries.sort(gu)}static from(t){return new ct(t)}render(){return this._entries.map(t=>`${t.mode} ${t.type} ${t.oid} ${t.path}`).join(`
22
+ `)}toObject(){const t=[...this._entries];return t.sort($w),Buffer.concat(t.map(r=>{const n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),o=Buffer.from([0]),s=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,o,s])}))}entries(){return this._entries}*[Symbol.iterator](){for(const t of this._entries)yield t}}class an{static wrap({type:t,object:r}){return Buffer.concat([Buffer.from(`${t} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(t){const r=t.indexOf(32),n=t.indexOf(0),i=t.slice(0,r).toString("utf8"),a=t.slice(r+1,n).toString("utf8"),o=t.length-(n+1);if(parseInt(a)!==o)throw new se(`Length mismatch: expected ${a} bytes but got ${o} instead.`);return{type:i,object:Buffer.from(t.slice(n+1))}}}async function Cu({fs:e,gitdir:t,oid:r}){const n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await e.read(`${t}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function zw(e,t){const r=new Lt(e),n=Pu(r);if(n!==t.byteLength)throw new se(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${t.length} bytes`);const i=Pu(r);let a;const o=Au(r,t);if(o.byteLength===i)a=o;else{a=Buffer.alloc(i);const s=new Lt(a);for(s.copy(o);!r.eof();)s.copy(Au(r,t));const l=s.tell();if(i!==l)throw new se(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function Pu(e){let t=0,r=0,n=null;do n=e.readUInt8(),t|=(n&127)<<r,r+=7;while(n&128);return t}function Tu(e,t,r){let n=0,i=0;for(;r--;)t&1&&(n|=e.readUInt8()<<i),t>>=1,i+=8;return n}function Au(e,t){const r=e.readUInt8(),n=128,i=15,a=112;if(r&n){const o=Tu(e,r&i,4);let s=Tu(e,(r&a)>>4,3);return s===0&&(s=65536),t.slice(o,o+s)}else return e.slice(r)}function Nw(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function Du(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:Nw(e)}class $u{constructor(t){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=Du(t),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(t){if(!this.eof())return this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t),this.buffer.slice(this.undoCursor,this.cursor)}async skip(t){this.eof()||(this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:t,value:r}=await this.stream.next();return t&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(t){this.undoCursor=this.cursor,this.cursor+=t,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(t){if(this._ended)return;const r=[this.buffer];for(;this.cursor+t>Mw(r);){const n=await this._next();if(this._ended)break;r.push(n)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}}function Mw(e){return e.reduce((t,r)=>t+r.length,0)}async function Lw(e,t){const r=new $u(e);let n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new se(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new se(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){const o=r.tell(),{type:s,length:l,ofs:c,reference:u}=await Fw(r),d=new $o.Inflate;for(;!d.result;){const p=await r.chunk();if(!p)break;if(d.push(p,!1),d.err)throw new se(`Pako error: ${d.msg}`);if(d.result){if(d.result.length!==l)throw new se("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(p.length-d.strm.avail_in);const m=r.tell();await t({data:d.result,type:s,num:a,offset:o,end:m,reference:u,ofs:c})}}}}async function Fw(e){let t=await e.byte();const r=t>>4&7;let n=t&15;if(t&128){let o=4;do t=await e.byte(),n|=(t&127)<<o,o+=7;while(t&128)}let i,a;if(r===6){let o=0;i=0;const s=[];do t=await e.byte(),i|=(t&127)<<o,o+=7,s.push(t);while(t&128);a=Buffer.from(s)}return r===7&&(a=await e.read(20)),{type:r,length:n,ofs:i,reference:a}}async function Iu(e){return $o.inflate(e)}function Uw(e){const t=[];let r=0,n=0;do{r=e.readUInt8();const i=r&127;t.push(i),n=r&128}while(n);return t.reduce((i,a)=>i+1<<7|a,-1)}function Hw(e,t){let r=t,n=4,i=null;do i=e.readUInt8(),r|=(i&127)<<n,n+=7;while(i&128);return r}class on{constructor(t){Object.assign(this,t),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:r}){const n=new Lt(t);if(n.slice(4).toString("hex")!=="ff744f63")return;const a=n.readUInt32BE();if(a!==2)throw new se(`Unable to read version ${a} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new se("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+4*255);const o=n.readUInt32BE(),s=[];for(let u=0;u<o;u++){const d=n.slice(20).toString("hex");s[u]=d}n.seek(n.tell()+4*o);const l=new Map;for(let u=0;u<o;u++)l.set(s[u],n.readUInt32BE());const c=n.slice(20).toString("hex");return new on({hashes:s,crcs:{},offsets:l,packfileSha:c,getExternalRefDelta:r})}static async fromPack({pack:t,getExternalRefDelta:r,onProgress:n}){const i={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},a={},o=t.slice(-20).toString("hex"),s=[],l={},c=new Map;let u=null,d=null;await Lw([t],async({data:v,type:y,reference:_,offset:R,num:C})=>{u===null&&(u=C);const x=Math.floor((u-C)*100/u);x!==d&&n&&await n({phase:"Receiving objects",loaded:u-C,total:u}),d=x,y=i[y],["commit","tree","blob","tag"].includes(y)?a[R]={type:y,offset:R}:y==="ofs-delta"?a[R]={type:y,offset:R}:y==="ref-delta"&&(a[R]={type:y,offset:R})});const p=Object.keys(a).map(Number);for(const[v,y]of p.entries()){const _=v+1===p.length?t.byteLength-20:p[v+1],R=a[y],C=Mp.buf(t.slice(y,_))>>>0;R.end=_,R.crc=C}const m=new on({pack:Promise.resolve(t),packfileSha:o,crcs:l,hashes:s,offsets:c,getExternalRefDelta:r});d=null;let g=0;const b=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in a){v=Number(v);const y=Math.floor(g*100/u);y!==d&&n&&await n({phase:"Resolving deltas",loaded:g,total:u}),g++,d=y;const _=a[v];if(!_.oid)try{m.readDepth=0,m.externalReadDepth=0;const{type:R,object:C}=await m.readSlice({start:v});b[m.readDepth]+=1;const x=await Vt(an.wrap({type:R,object:C}));_.oid=x,s.push(x),c.set(x,v),l[x]=_.crc}catch{continue}}return s.sort(),m}async toBuffer(){const t=[],r=(c,u)=>{t.push(Buffer.from(c,u))};r("ff744f63","hex"),r("00000002","hex");const n=new Lt(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(const d of this.hashes)parseInt(d.slice(0,2),16)<=c&&u++;n.writeUInt32BE(u)}t.push(n.buffer);for(const c of this.hashes)r(c,"hex");const i=new Lt(Buffer.alloc(this.hashes.length*4));for(const c of this.hashes)i.writeUInt32BE(this.crcs[c]);t.push(i.buffer);const a=new Lt(Buffer.alloc(this.hashes.length*4));for(const c of this.hashes)a.writeUInt32BE(this.offsets.get(c));t.push(a.buffer),r(this.packfileSha,"hex");const o=Buffer.concat(t),s=await Vt(o),l=Buffer.alloc(20);return l.write(s,"hex"),Buffer.concat([o,l])}async load({pack:t}){this.pack=t}async unload(){this.pack=null}async read({oid:t}){if(!this.offsets.get(t)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(t);throw new se(`Could not read object ${t} from packfile`)}const r=this.offsets.get(t);return this.readSlice({start:r})}async readSlice({start:t}){if(this.offsetCache[t])return Object.assign({},this.offsetCache[t]);this.readDepth++;const r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new se("Tried to read from a GitPackIndex with no packfile loaded into memory");const n=(await this.pack).slice(t),i=new Lt(n),a=i.readUInt8(),o=a&112;let s=r[o];if(s===void 0)throw new se("Unrecognized type: 0b"+o.toString(2));const l=a&15;let c=l;a&128&&(c=Hw(i,l));let d=null,p=null;if(s==="ofs_delta"){const g=Uw(i),b=t-g;({object:d,type:s}=await this.readSlice({start:b}))}if(s==="ref_delta"){const g=i.slice(20).toString("hex");({object:d,type:s}=await this.read({oid:g}))}const m=n.slice(i.tell());if(p=Buffer.from(await Iu(m)),p.byteLength!==c)throw new se(`Packfile told us object would have length ${c} but it had length ${p.byteLength}`);return d&&(p=Buffer.from(zw(p,d))),this.readDepth>3&&(this.offsetCache[t]={type:s,object:p}),{type:s,format:"content",object:p}}}const ta=Symbol("PackfileCache");async function Ww({fs:e,filename:t,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){const a=await e.read(t);return on.fromIdx({idx:a,getExternalRefDelta:r})}function qo({fs:e,cache:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}){t[ta]||(t[ta]=new Map);let o=t[ta].get(r);return o||(o=Ww({fs:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}),t[ta].set(r,o)),o}async function qw({fs:e,cache:t,gitdir:r,oid:n,format:i="content",getExternalRefDelta:a}){let o=await e.readdir(N.join(r,"objects/pack"));o=o.filter(s=>s.endsWith(".idx"));for(const s of o){const l=`${r}/objects/pack/${s}`,c=await qo({fs:e,cache:t,filename:l,getExternalRefDelta:a});if(c.error)throw new se(c.error);if(c.offsets.has(n)){if(!c.pack){const d=l.replace(/idx$/,"pack");c.pack=e.read(d)}const u=await c.read({oid:n,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${s.replace(/idx$/,"pack")}`,u}}return null}async function Ae({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=u=>Ae({fs:e,cache:t,gitdir:r,oid:u});let o;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:Buffer.from("tree 0\0")}),o||(o=await Cu({fs:e,gitdir:r,oid:n})),!o){if(o=await qw({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a}),!o)throw new Oe(n);return o}if(i==="deflated"||(o.format==="deflated"&&(o.object=Buffer.from(await Iu(o.object)),o.format="wrapped"),i==="wrapped"))return o;const s=await Vt(o.object);if(s!==n)throw new se(`SHA check failed! Expected ${n}, computed ${s}`);const{object:l,type:c}=an.unwrap(o.object);if(o.type=c,o.object=l,o.format="content",i==="content")return o;throw new se(`invalid requested format "${i}"`)}class Ot extends we{constructor(t,r,n=!0){super(`Failed to create ${t} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:""}`),this.code=this.name=Ot.code,this.data={noun:t,where:r,canForce:n}}}Ot.code="AlreadyExistsError";class Kn extends we{constructor(t,r,n){super(`Found multiple ${t} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=Kn.code,this.data={nouns:t,short:r,matches:n}}}Kn.code="AmbiguousError";class Jn extends we{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(", ")}`),this.code=this.name=Jn.code,this.data={filepaths:t}}}Jn.code="CheckoutConflictError";class Qn extends we{constructor(t,r){super(`Failed to checkout "${t}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=Qn.code,this.data={ref:t,oid:r}}}Qn.code="CommitNotFetchedError";class ei extends we{constructor(){super("Empty response from git server."),this.code=this.name=ei.code,this.data={}}}ei.code="EmptyServerResponseError";class ti extends we{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=ti.code,this.data={}}}ti.code="FastForwardError";class ri extends we{constructor(t,r){super(`One or more branches were not updated: ${t}`),this.code=this.name=ri.code,this.data={prettyDetails:t,result:r}}}ri.code="GitPushError";class sn extends we{constructor(t,r,n){super(`HTTP Error: ${t} ${r}`),this.code=this.name=sn.code,this.data={statusCode:t,statusMessage:r,response:n}}}sn.code="HttpError";class fr extends we{constructor(t){let r="invalid filepath";t==="leading-slash"||t==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':t==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=fr.code,this.data={reason:t}}}fr.code="InvalidFilepathError";class Ct extends we{constructor(t,r){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=Ct.code,this.data={ref:t,suggestion:r}}}Ct.code="InvalidRefNameError";class ni extends we{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=ni.code,this.data={depth:t}}}ni.code="MaxDepthError";class cn extends we{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=cn.code,this.data={}}}cn.code="MergeNotSupportedError";class ln extends we{constructor(t,r,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=ln.code,this.data={filepaths:t,bothModified:r,deleteByUs:n,deleteByTheirs:i}}}ln.code="MergeConflictError";class Xe extends we{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=Xe.code,this.data={role:t}}}Xe.code="MissingNameError";class lt extends we{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=lt.code,this.data={parameter:t}}}lt.code="MissingParameterError";class ii extends we{constructor(t){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=ii.code,this.data={errors:t},this.errors=t}}ii.code="MultipleGitError";class Dr extends we{constructor(t,r){super(`Expected "${t}" but received "${r}".`),this.code=this.name=Dr.code,this.data={expected:t,actual:r}}}Dr.code="ParseError";class un extends we{constructor(t){let r="";t==="not-fast-forward"?r=" because it was not a simple fast-forward":t==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=un.code,this.data={reason:t}}}un.code="PushRejectedError";class dr extends we{constructor(t,r){super(`Remote does not support the "${t}" so the "${r}" parameter cannot be used.`),this.code=this.name=dr.code,this.data={capability:t,parameter:r}}}dr.code="RemoteCapabilityError";class ai extends we{constructor(t,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=ai.code,this.data={preview:t,response:r}}}ai.code="SmartHttpError";class oi extends we{constructor(t,r,n){super(`Git remote "${t}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=oi.code,this.data={url:t,transport:r,suggestion:n}}}oi.code="UnknownTransportError";class si extends we{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=si.code,this.data={url:t}}}si.code="UrlParseError";class fn extends we{constructor(){super("The operation was canceled."),this.code=this.name=fn.code,this.data={}}}fn.code="UserCanceledError";class ci extends we{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=ci.code,this.data={filepath:t}}}ci.code="IndexResetError";class li extends we{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=li.code,this.data={ref:t}}}li.code="NoCommitError";var Gw=Object.freeze({__proto__:null,AlreadyExistsError:Ot,AmbiguousError:Kn,CheckoutConflictError:Jn,CommitNotFetchedError:Qn,EmptyServerResponseError:ei,FastForwardError:ti,GitPushError:ri,HttpError:sn,InternalError:se,InvalidFilepathError:fr,InvalidOidError:lr,InvalidRefNameError:Ct,MaxDepthError:ni,MergeNotSupportedError:cn,MergeConflictError:ln,MissingNameError:Xe,MissingParameterError:lt,MultipleGitError:ii,NoRefspecError:Xn,NotFoundError:Oe,ObjectTypeError:rt,ParseError:Dr,PushRejectedError:un,RemoteCapabilityError:dr,SmartHttpError:ai,UnknownTransportError:oi,UnsafeFilepathError:Qr,UrlParseError:si,UserCanceledError:fn,UnmergedPathsError:Zn,IndexResetError:ci,NoCommitError:li});function Go({name:e,email:t,timestamp:r,timezoneOffset:n}){return n=Yw(n),`${e} <${t}> ${r} ${n}`}function Yw(e){const t=Zw(Xw(e));e=Math.abs(e);const r=Math.floor(e/60);e-=r*60;let n=String(r),i=String(e);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(t===-1?"-":"+")+n+i}function Zw(e){return Math.sign(e)||(Object.is(e,-0)?-1:1)}function Xw(e){return e===0?e:-e}function Kt(e){return e=e.replace(/\r/g,""),e=e.replace(/^\n+/,""),e=e.replace(/\n+$/,"")+`
23
23
  `,e}function ra(e){const[,t,r,n,i]=e.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:r,timestamp:Number(n),timezoneOffset:Vw(i)}}function Vw(e){let[,t,r,n]=e.match(/(\+|-)(\d\d)(\d\d)/);return n=(t==="+"?1:-1)*(Number(r)*60+Number(n)),Kw(n)}function Kw(e){return e===0?e:-e}class nt{constructor(t){if(typeof t=="string")this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString("utf8");else if(typeof t=="object")this._tag=nt.render(t);else throw new se("invalid type passed to GitAnnotatedTag constructor")}static from(t){return new nt(t)}static render(t){return`object ${t.object}
24
24
  type ${t.type}
25
25
  tag ${t.tag}
@@ -61,20 +61,20 @@ gpgsig`)),n=t.slice(t.indexOf(`-----END PGP SIGNATURE-----
61
61
  `)+28);return Kt(r+`
62
62
  `+n)}isolateSignature(){const t=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return Jw(t)}static async sign(t,r,n){const i=t.withoutSignature(),a=De.justMessage(t._commit);let{signature:o}=await r({payload:i,secretKey:n});o=Kt(o);const l=De.justHeaders(t._commit)+`
63
63
  gpgsig`+Yo(o)+`
64
- `+a;return De.from(l)}}async function dn({fs:e,cache:t,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:st.from([]),oid:n};const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,dn({fs:e,cache:t,gitdir:r,oid:n});if(i==="commit")return n=De.from(a).parse().tree,dn({fs:e,cache:t,gitdir:r,oid:n});if(i!=="tree")throw new rt(n,i,"tree");return{tree:st.from(a),oid:n}}class Qw{constructor({fs:t,gitdir:r,ref:n,cache:i}){this.fs=t,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{const o=new Map;let s;try{s=await H.resolve({fs:t,gitdir:r,ref:n})}catch(c){c instanceof Oe&&(s="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}const l=await dn({fs:t,cache:this.cache,gitdir:r,oid:s});return l.type="tree",l.mode="40000",o.set(".",l),o})();const a=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,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(t){const r=t._fullpath,{fs:n,cache:i,gitdir:a}=this,o=await this.mapPromise,s=o.get(r);if(!s)throw new Error(`No obj for ${r}`);const l=s.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(s)}`);if(s.type!=="tree")return null;const{type:c,object:u}=await Ae({fs:n,cache:i,gitdir:a,oid:l});if(c!==s.type)throw new rt(l,c,s.type);const d=st.from(u);for(const p of d)o.set(N.join(r,p.path),p);return d.entries().map(p=>N.join(r,p.path))}async type(t){if(t._type===!1){const r=await this.mapPromise,{type:n}=r.get(t._fullpath);t._type=n}return t._type}async mode(t){if(t._mode===!1){const r=await this.mapPromise,{mode:n}=r.get(t._fullpath);t._mode=gu(parseInt(n,8))}return t._mode}async stat(t){}async content(t){if(t._content===!1){const r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,s=r.get(t._fullpath).oid,{type:l,object:c}=await Ae({fs:n,cache:i,gitdir:a,oid:s});l!=="blob"?t._content=void 0:t._content=new Uint8Array(c)}return t._content}async oid(t){if(t._oid===!1){const n=(await this.mapPromise).get(t._fullpath);t._oid=n.oid}return t._oid}}function xt({ref:e="HEAD"}={}){const t=Object.create(null);return Object.defineProperty(t,Ki,{value:function({fs:r,gitdir:n,cache:i}){return new Qw({fs:r,gitdir:n,ref:e,cache:i})}}),Object.freeze(t),t}class eg{constructor({fs:t,dir:r,gitdir:n,cache:i}){this.fs=t,this.cache=i,this.dir=r,this.gitdir=n;const a=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,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(t){const r=t._fullpath,{fs:n,dir:i}=this,a=await n.readdir(N.join(i,r));return a===null?null:a.map(o=>N.join(r,o))}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){const{fs:r,dir:n}=this;let i=await r.lstat(`${n}/${t._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),t._type=a,i=en(i),t._mode=i.mode,i.size===-1&&t._actualSize&&(i.size=t._actualSize),t._stat=i}return t._stat}async content(t){if(t._content===!1){const{fs:r,dir:n,gitdir:i}=this;if(await t.type()==="tree")t._content=void 0;else{const o=await(await Me.get({fs:r,gitdir:i})).get("core.autocrlf"),s=await r.read(`${n}/${t._fullpath}`,{autocrlf:o});t._actualSize=s.length,t._stat&&t._stat.size===-1&&(t._stat.size=t._actualSize),t._content=new Uint8Array(s)}}return t._content}async oid(t){if(t._oid===!1){const{fs:r,gitdir:n,cache:i}=this;let a;await He.acquire({fs:r,gitdir:n,cache:i},async function(o){const s=o.entriesMap.get(t._fullpath),l=await t.stat(),u=await(await Me.get({fs:r,gitdir:n})).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;!s||Xi(l,s,u,d)?await t.content()===void 0?a=void 0:(a=await Vt(an.wrap({type:"blob",object:await t.content()})),s&&a===s.oid&&(!u||l.mode===s.mode)&&Xi(l,s,u,d)&&o.insert({filepath:t._fullpath,stats:l,oid:a})):a=s.oid}),t._oid=a}return t._oid}}function ui(){const e=Object.create(null);return Object.defineProperty(e,Ki,{value:function({fs:t,dir:r,gitdir:n,cache:i}){return new eg({fs:t,dir:r,gitdir:n,cache:i})}}),Object.freeze(e),e}function tg(e,t){const r=t-e;return Array.from({length:r},(n,i)=>e+i)}const Iu=typeof Array.prototype.flat>"u"?e=>e.reduce((t,r)=>t.concat(r),[]):e=>e.flat();class rg{constructor(){this.value=null}consider(t){t!=null&&(this.value===null?this.value=t:t<this.value&&(this.value=t))}reset(){this.value=null}}function*ng(e){const t=new rg;let r;const n=[],i=e.length;for(let a=0;a<i;a++)n[a]=e[a].next().value,n[a]!==void 0&&t.consider(n[a]);if(t.value!==null)for(;;){const a=[];r=t.value,t.reset();for(let o=0;o<i;o++)n[o]!==void 0&&n[o]===r?(a[o]=n[o],n[o]=e[o].next().value):a[o]=null,n[o]!==void 0&&t.consider(n[o]);if(yield a,t.value===null)return}}async function hr({fs:e,cache:t,dir:r,gitdir:n,trees:i,map:a=async(l,c)=>c,reduce:o=async(l,c)=>{const u=Iu(c);return l!==void 0&&u.unshift(l),u},iterate:s=(l,c)=>Promise.all([...c].map(l))}){const l=i.map(m=>m[Ki]({fs:e,dir:r,gitdir:n,cache:t})),c=new Array(l.length).fill("."),u=tg(0,l.length),d=async m=>{u.map(x=>{m[x]=m[x]&&new l[x].ConstructEntry(m[x])});const v=(await Promise.all(u.map(x=>m[x]?l[x].readdir(m[x]):[]))).map(x=>x===null?[]:x).map(x=>x[Symbol.iterator]());return{entries:m,children:ng(v)}},p=async m=>{const{entries:g,children:v}=await d(m),x=g.find(_=>_&&_._fullpath)._fullpath,b=await a(x,g);if(b!==null){let _=await s(p,v);return _=_.filter(k=>k!==void 0),o(b,_)}};return p(c)}async function Zo(e,t){const r=await e.readdir(t);r==null?await e.rm(t):r.length?await Promise.all(r.map(n=>{const i=N.join(t,n);return e.lstat(i).then(a=>{if(a)return a.isDirectory()?Zo(e,i):e.rm(i)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function ig(e){return ag(e)&&Bu(e.then)&&Bu(e.catch)}function ag(e){return e&&typeof e=="object"}function Bu(e){return typeof e=="function"}function ju(e){return ig((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(e))}const zu=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function Nu(e,t){if(ju(t))for(const r of zu)e[`_${r}`]=t[r].bind(t);else for(const r of zu)e[`_${r}`]=Io(t[r].bind(t));ju(t)?t.rm?e._rm=t.rm.bind(t):t.rmdir.length>1?e._rm=t.rmdir.bind(t):e._rm=Zo.bind(null,e):t.rm?e._rm=Io(t.rm.bind(t)):t.rmdir.length>2?e._rm=Io(t.rmdir.bind(t)):e._rm=Zo.bind(null,e)}class K{constructor(t){if(typeof t._original_unwrapped_fs<"u")return t;const r=Object.getOwnPropertyDescriptor(t,"promises");r&&r.enumerable?Nu(this,t.promises):Nu(this,t),this._original_unwrapped_fs=t}async exists(t,r={}){try{return await this._stat(t),!0}catch(n){if(n.code==="ENOENT"||n.code==="ENOTDIR"||(n.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(t,r={}){try{let n=await this._readFile(t,r);if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
65
- `),n=new TextEncoder().encode(n)}catch{}return typeof n!="string"&&(n=Buffer.from(n)),n}catch{return null}}async write(t,r,n={}){try{await this._writeFile(t,r,n);return}catch{await this.mkdir(rn(t)),await this._writeFile(t,r,n)}}async mkdir(t,r=!1){try{await this._mkdir(t);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){const i=rn(t);if(i==="."||i==="/"||i===t)throw n;await this.mkdir(i),await this.mkdir(t,!0)}}}async rm(t){try{await this._unlink(t)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(t,r){try{r&&r.recursive?await this._rm(t,r):await this._rmdir(t)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(t){try{const r=await this._readdir(t);return r.sort(Zi),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(t){const r=await this._readdir(t);return(await Promise.all(r.map(async i=>{const a=t+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(t){try{return await this._lstat(t)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(t,r={encoding:"buffer"}){try{const n=await this._readlink(t,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(t,r){return this._symlink(r.toString("utf8"),t)}}function P(e,t){if(t===void 0)throw new ct(e)}async function na(e,t){return!e&&!t?!1:e&&!t||!e&&t?!0:!(await e.type()==="tree"&&await t.type()==="tree"||await e.type()===await t.type()&&await e.mode()===await t.mode()&&await e.oid()===await t.oid())}async function og({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n="HEAD",cache:i={}}){try{P("fs",e),P("dir",t),P("gitdir",r);const a=new K(e),o=[xt({ref:n}),ui(),nn()];let s=[];await He.acquire({fs:a,gitdir:r,cache:i},async function(c){s=c.unmergedPaths});const l=await hr({fs:a,cache:i,dir:t,gitdir:r,trees:o,map:async function(c,[u,d,p]){const m=!await na(d,p),g=s.includes(c),v=!await na(p,u);if(m||g)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(v)return!1;throw new ci(c)}});await He.acquire({fs:a,gitdir:r,cache:i},async function(c){for(const u of l)if(u!==!1){if(!u){await a.rmdir(`${t}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){const d=new TextDecoder().decode(u.content);await a.write(`${t}/${u.path}`,d,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}class hn{static async isIgnored({fs:t,dir:r,gitdir:n=N.join(r,".git"),filepath:i}){if(Vi(i)===".git")return!0;if(i===".")return!1;let a="";const o=N.join(n,"info","exclude");await t.exists(o)&&(a=await t.read(o,"utf8"));const s=[{gitignore:N.join(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){const d=l.slice(0,u).join("/"),p=l.slice(u).join("/");s.push({gitignore:N.join(r,d,".gitignore"),filepath:p})}let c=!1;for(const u of s){let d;try{d=await t.read(u.gitignore,"utf8")}catch(g){if(g.code==="NOENT")continue}const p=Qm().add(a);p.add(d);const m=rn(u.filepath);if(m!=="."&&p.ignores(m))return!0;c?c=!p.test(u.filepath).unignored:c=p.test(u.filepath).ignored}return c}}async function sg({fs:e,gitdir:t,object:r,format:n,oid:i}){if(n!=="deflated")throw new se("GitObjectStoreLoose expects objects to write to be in deflated format");const a=`objects/${i.slice(0,2)}/${i.slice(2)}`,o=`${t}/${a}`;await e.exists(o)||await e.write(o,r)}let Xo=null;async function Mu(e){return Xo===null&&(Xo=lg()),Xo?cg(e):$o.deflate(e)}async function cg(e){const t=new CompressionStream("deflate"),r=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}function lg(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function lt({fs:e,gitdir:t,type:r,object:n,format:i="content",oid:a=void 0,dryRun:o=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=an.wrap({type:r,object:n})),a=await Vt(n),n=Buffer.from(await Mu(n))),o||await sg({fs:e,gitdir:t,object:n,format:"deflated",oid:a}),a}function Lu(e){let t;for(;~(t=e.indexOf(92));)e[t]=47;return e}async function ug({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={},force:a=!1,parallel:o=!0}){try{P("fs",e),P("dir",t),P("gitdir",r),P("filepath",n);const s=new K(e);await He.acquire({fs:s,gitdir:r,cache:i},async l=>Vo({dir:t,gitdir:r,fs:s,filepath:n,index:l,force:a,parallel:o}))}catch(s){throw s.caller="git.add",s}}async function Vo({dir:e,gitdir:t,fs:r,filepath:n,index:i,force:a,parallel:o}){n=Array.isArray(n)?n:[n];const s=n.map(async d=>{if(!a&&await hn.isIgnored({fs:r,dir:e,gitdir:t,filepath:d}))return;const p=await r.lstat(N.join(e,d));if(!p)throw new Oe(d);if(p.isDirectory()){const m=await r.readdir(N.join(e,d));if(o){const g=m.map(v=>Vo({dir:e,gitdir:t,fs:r,filepath:[N.join(d,v)],index:i,force:a,parallel:o}));await Promise.all(g)}else for(const g of m)await Vo({dir:e,gitdir:t,fs:r,filepath:[N.join(d,g)],index:i,force:a,parallel:o})}else{const g=await(await Me.get({fs:r,gitdir:t})).get("core.autocrlf"),v=p.isSymbolicLink()?await r.readlink(N.join(e,d)).then(Lu):await r.read(N.join(e,d),{autocrlf:g});if(v===null)throw new Oe(d);const x=await lt({fs:r,gitdir:t,type:"blob",object:v});i.insert({filepath:d,stats:p,oid:x})}}),l=await Promise.allSettled(s),c=l.filter(d=>d.status==="rejected").map(d=>d.reason);if(c.length>1)throw new ii(c);if(c.length===1)throw c[0];return l.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function fi({fs:e,gitdir:t,path:r}){return(await Me.get({fs:e,gitdir:t})).get(r)}function Fu(e,...t){for(const r of t)if(r)for(const n of Object.keys(r)){const i=r[n];i!==void 0&&(e[n]=i)}return e}async function pr({fs:e,gitdir:t,author:r,commit:n}){const i=Math.floor(Date.now()/1e3),a={name:await fi({fs:e,gitdir:t,path:"user.name"}),email:await fi({fs:e,gitdir:t,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},o=Fu({},a,n?n.author:void 0,r);if(o.name!==void 0)return o}async function pn({fs:e,gitdir:t,author:r,committer:n,commit:i}){const a=Math.floor(Date.now()/1e3),o={name:await fi({fs:e,gitdir:t,path:"user.name"}),email:await fi({fs:e,gitdir:t,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},s=Fu({},o,i?i.committer:void 0,r,n);if(s.name!==void 0)return s}async function Uu({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,Uu({fs:e,cache:t,gitdir:r,oid:n});if(i!=="commit")throw new rt(n,i,"commit");return{commit:De.from(a),oid:n}}async function mn({fs:e,cache:t,gitdir:r,oid:n}){const{commit:i,oid:a}=await Uu({fs:e,cache:t,gitdir:r,oid:n});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function ia({fs:e,cache:t,onSign:r,gitdir:n,message:i,author:a,committer:o,signingKey:s,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:d,parent:p,tree:m}){let g=!1;d||(d=await H.resolve({fs:e,gitdir:n,ref:"HEAD",depth:2}));let v,x;try{v=await H.resolve({fs:e,gitdir:n,ref:d}),x=await mn({fs:e,gitdir:n,oid:v,cache:{}})}catch{g=!0}if(l&&g)throw new li(d);const b=l?await pr({fs:e,gitdir:n,author:a,commit:x.commit}):await pr({fs:e,gitdir:n,author:a});if(!b)throw new Xe("author");const _=l?await pn({fs:e,gitdir:n,author:b,committer:o,commit:x.commit}):await pn({fs:e,gitdir:n,author:b,committer:o});if(!_)throw new Xe("committer");return He.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async function(k){const y=vu(k.entries).get(".");if(m||(m=await Hu({fs:e,gitdir:n,inode:y,dryRun:c})),p?p=await Promise.all(p.map(R=>H.resolve({fs:e,gitdir:n,ref:R}))):l?p=x.commit.parent:p=v?[v]:[],!i)if(l)i=x.commit.message;else throw new ct("message");let C=De.from({tree:m,parent:p,author:b,committer:_,message:i});s&&(C=await De.sign(C,r,s));const O=await lt({fs:e,gitdir:n,type:"commit",object:C.toObject(),dryRun:c});return!u&&!c&&await H.writeRef({fs:e,gitdir:n,ref:d,value:O}),O})}async function Hu({fs:e,gitdir:t,inode:r,dryRun:n}){const i=r.children;for(const l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await Hu({fs:e,gitdir:t,inode:l,dryRun:n}));const a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),o=st.from(a);return await lt({fs:e,gitdir:t,type:"tree",object:o.toObject(),dryRun:n})}async function di({fs:e,cache:t,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new fr("leading-slash");if(i.endsWith("/"))throw new fr("trailing-slash");const a=n,o=await dn({fs:e,cache:t,gitdir:r,oid:n}),s=o.tree;if(i==="")n=o.oid;else{const l=i.split("/");n=await Wu({fs:e,cache:t,gitdir:r,tree:s,pathArray:l,oid:a,filepath:i})}return n}async function Wu({fs:e,cache:t,gitdir:r,tree:n,pathArray:i,oid:a,filepath:o}){const s=i.shift();for(const l of n)if(l.path===s){if(i.length===0)return l.oid;{const{type:c,object:u}=await Ae({fs:e,cache:t,gitdir:r,oid:l.oid});if(c!=="tree")throw new rt(a,c,"tree",o);return n=st.from(u),Wu({fs:e,cache:t,gitdir:r,tree:n,pathArray:i,oid:a,filepath:o})}}throw new Oe(`file or directory found at "${a}:${o}"`)}async function wn({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await di({fs:e,cache:t,gitdir:r,oid:n,filepath:i}));const{tree:a,oid:o}=await dn({fs:e,cache:t,gitdir:r,oid:n});return{oid:o,tree:a.entries()}}async function hi({fs:e,gitdir:t,tree:r}){const n=st.from(r).toObject();return await lt({fs:e,gitdir:t,type:"tree",object:n,format:"content"})}async function fg({fs:e,cache:t,onSign:r,gitdir:n,ref:i,oid:a,note:o,force:s,author:l,committer:c,signingKey:u}){let d;try{d=await H.resolve({gitdir:n,fs:e,ref:i})}catch(b){if(!(b instanceof Oe))throw b}let m=(await wn({fs:e,cache:t,gitdir:n,oid:d||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(s)m=m.filter(b=>b.path!==a);else for(const b of m)if(b.path===a)throw new Ot("note",a);typeof o=="string"&&(o=Buffer.from(o,"utf8"));const g=await lt({fs:e,gitdir:n,type:"blob",object:o,format:"content"});m.push({mode:"100644",path:a,oid:g,type:"blob"});const v=await hi({fs:e,gitdir:n,tree:m});return await ia({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:v,parent:d&&[d],message:`Note added by 'isomorphic-git addNote'
66
- `,author:l,committer:c,signingKey:u})}async function dg({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ref:i="refs/notes/commits",oid:a,note:o,force:s,author:l,committer:c,signingKey:u,cache:d={}}){try{P("fs",e),P("gitdir",n),P("oid",a),P("note",o),u&&P("onSign",t);const p=new K(e),m=await pr({fs:p,gitdir:n,author:l});if(!m)throw new Xe("author");const g=await pn({fs:p,gitdir:n,author:m,committer:c});if(!g)throw new Xe("committer");return await fg({fs:new K(p),cache:d,onSign:t,gitdir:n,ref:i,oid:a,note:o,force:s,author:m,committer:g,signingKey:u})}catch(p){throw p.caller="git.addNote",p}}async function qu({fs:e,gitdir:t,remote:r,url:n,force:i}){if(r!==Mt.clean(r))throw new Ct(r,Mt.clean(r));const a=await Me.get({fs:e,gitdir:t});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new Ot("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Me.save({fs:e,gitdir:t,config:a})}async function hg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n,url:i,force:a=!1}){try{return P("fs",e),P("gitdir",r),P("remote",n),P("url",i),await qu({fs:new K(e),gitdir:r,remote:n,url:i,force:a})}catch(o){throw o.caller="git.addRemote",o}}async function pg({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tagger:a,message:o=i,gpgsig:s,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await H.exists({fs:e,gitdir:n,ref:i}))throw new Ot("tag",i);const d=await H.resolve({fs:e,gitdir:n,ref:l||"HEAD"}),{type:p}=await Ae({fs:e,cache:t,gitdir:n,oid:d});let m=nt.from({object:d,type:p,tag:i.replace("refs/tags/",""),tagger:a,message:o,gpgsig:s});c&&(m=await nt.sign(m,r,c));const g=await lt({fs:e,gitdir:n,type:"tag",object:m.toObject()});await H.writeRef({fs:e,gitdir:n,ref:i,value:g})}async function mg({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ref:i,tagger:a,message:o=i,gpgsig:s,object:l,signingKey:c,force:u=!1,cache:d={}}){try{P("fs",e),P("gitdir",n),P("ref",i),c&&P("onSign",t);const p=new K(e),m=await pr({fs:p,gitdir:n,author:a});if(!m)throw new Xe("tagger");return await pg({fs:p,cache:d,onSign:t,gitdir:n,ref:i,tagger:m,message:o,gpgsig:s,object:l,signingKey:c,force:u})}catch(p){throw p.caller="git.annotatedTag",p}}async function wg({fs:e,gitdir:t,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Mt.clean(r))throw new Ct(r,Mt.clean(r));const o=`refs/heads/${r}`;if(!a&&await H.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",r,!1);let s;try{s=await H.resolve({fs:e,gitdir:t,ref:n||"HEAD"})}catch{}s&&await H.writeRef({fs:e,gitdir:t,ref:o,value:s}),i&&await H.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function gg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,checkout:a=!1,force:o=!1}){try{return P("fs",e),P("gitdir",r),P("ref",n),await wg({fs:new K(e),gitdir:r,ref:n,object:i,checkout:a,force:o})}catch(s){throw s.caller="git.branch",s}}const Gu=(e,t)=>e==="."||t==null||t.length===0||t==="."?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);async function Ko({fs:e,cache:t,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:o,ref:s,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:d,force:p,track:m=!0}){let g;if(n)try{g=await H.resolve({fs:e,gitdir:a,ref:"HEAD"})}catch{g="0000000000000000000000000000000000000000"}let v;try{v=await H.resolve({fs:e,gitdir:a,ref:s})}catch(x){if(s==="HEAD")throw x;const b=`${o}/${s}`;if(v=await H.resolve({fs:e,gitdir:a,ref:b}),m){const _=await Me.get({fs:e,gitdir:a});await _.set(`branch.${s}.remote`,o),await _.set(`branch.${s}.merge`,`refs/heads/${s}`),await Me.save({fs:e,gitdir:a,config:_})}await H.writeRef({fs:e,gitdir:a,ref:`refs/heads/${s}`,value:v})}if(!c){let x;try{x=await yg({fs:e,cache:t,onProgress:r,dir:i,gitdir:a,ref:s,force:p,filepaths:l})}catch(y){throw y instanceof Oe&&y.data.what===v?new Qn(s,v):y}const b=x.filter(([y])=>y==="conflict").map(([y,C])=>C);if(b.length>0)throw new Jn(b);const _=x.filter(([y])=>y==="error").map(([y,C])=>C);if(_.length>0)throw new se(_.join(", "));if(d){n&&await n({previousHead:g,newHead:v,type:l!=null&&l.length>0?"file":"branch"});return}let k=0;const S=x.length;await He.acquire({fs:e,gitdir:a,cache:t},async function(y){await Promise.all(x.filter(([C])=>C==="delete"||C==="delete-index").map(async function([C,O]){const R=`${i}/${O}`;C==="delete"&&await e.rm(R),y.delete({filepath:O}),r&&await r({phase:"Updating workdir",loaded:++k,total:S})}))}),await He.acquire({fs:e,gitdir:a,cache:t},async function(y){for(const[C,O]of x)if(C==="rmdir"||C==="rmdir-index"){const R=`${i}/${O}`;try{C==="rmdir-index"&&y.delete({filepath:O}),await e.rmdir(R),r&&await r({phase:"Updating workdir",loaded:++k,total:S})}catch(A){if(A.code==="ENOTEMPTY")console.log(`Did not delete ${O} because directory is not empty`);else throw A}}}),await Promise.all(x.filter(([y])=>y==="mkdir"||y==="mkdir-index").map(async function([y,C]){const O=`${i}/${C}`;await e.mkdir(O),r&&await r({phase:"Updating workdir",loaded:++k,total:S})})),await He.acquire({fs:e,gitdir:a,cache:t},async function(y){await Promise.all(x.filter(([C])=>C==="create"||C==="create-index"||C==="update"||C==="mkdir-index").map(async function([C,O,R,A,D]){const j=`${i}/${O}`;try{if(C!=="create-index"&&C!=="mkdir-index"){const{object:U}=await Ae({fs:e,cache:t,gitdir:a,oid:R});if(D&&await e.rm(j),A===33188)await e.write(j,U);else if(A===33261)await e.write(j,U,{mode:511});else if(A===40960)await e.writelink(j,U);else throw new se(`Invalid mode 0o${A.toString(8)} detected in blob ${R}`)}const M=await e.lstat(j);A===33261&&(M.mode=493),C==="mkdir-index"&&(M.mode=57344),y.insert({filepath:O,stats:M,oid:R}),r&&await r({phase:"Updating workdir",loaded:++k,total:S})}catch(M){console.log(M)}}))}),n&&await n({previousHead:g,newHead:v,type:l!=null&&l.length>0?"file":"branch"})}if(!u){const x=await H.expand({fs:e,gitdir:a,ref:s});x.startsWith("refs/heads")?await H.writeSymbolicRef({fs:e,gitdir:a,ref:"HEAD",value:x}):await H.writeRef({fs:e,gitdir:a,ref:"HEAD",value:v})}}async function yg({fs:e,cache:t,onProgress:r,dir:n,gitdir:i,ref:a,force:o,filepaths:s}){let l=0;return hr({fs:e,cache:t,dir:n,gitdir:i,trees:[xt({ref:a}),ui(),nn()],map:async function(c,[u,d,p]){if(c===".")return;if(s&&!s.some(g=>Gu(c,g)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!p,!!u,!!d].map(Number).join("")){case"000":return;case"001":return o&&s&&s.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 d.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await d.oid()?o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()]:["conflict",c]:await u.mode()!==await d.mode()?o?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await p.type()){case"tree":return["rmdir",c];case"blob":return await p.oid()!==await d.oid()?o?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await p.type()}`]}case"110":case"111":switch(`${await p.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await p.oid()===await u.oid()&&await p.mode()===await u.mode()&&!o)return;if(d){if(await d.oid()!==await p.oid()&&await d.oid()!==await u.oid())return o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()]:["conflict",c]}else if(o)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await p.mode()];return await u.mode()!==await p.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await p.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 p.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=Iu(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function Yu({fs:e,onProgress:t,onPostCheckout:r,dir:n,gitdir:i=N.join(n,".git"),remote:a="origin",ref:o,filepaths:s,noCheckout:l=!1,noUpdateHead:c=o===void 0,dryRun:u=!1,force:d=!1,track:p=!0,cache:m={}}){try{P("fs",e),P("dir",n),P("gitdir",i);const g=o||"HEAD";return await Ko({fs:new K(e),cache:m,onProgress:t,onPostCheckout:r,dir:n,gitdir:i,remote:a,ref:g,filepaths:s,noCheckout:l,noUpdateHead:c,dryRun:u,force:d,track:p})}catch(g){throw g.caller="git.checkout",g}}const bg=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function $r(e){const t=bg.exec(e);return t?t[1]==="remotes/"&&e.endsWith("/HEAD")?t[2].slice(0,-5):t[2]:e}async function mr({fs:e,gitdir:t,fullname:r=!1,test:n=!1}){const i=await H.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2});if(n)try{await H.resolve({fs:e,gitdir:t,ref:i})}catch{return}if(i.startsWith("refs/"))return r?i:$r(i)}function vg(e){return e=e.replace(/^git@([^:]+):/,"https://$1/"),e=e.replace(/^ssh:\/\//,"https://"),e}function Zu({username:e="",password:t=""}){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}async function pi(e,t){const r=Au(e);for(;;){const{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function aa(e){let t=0;const r=[];await pi(e,a=>{r.push(a),t+=a.byteLength});const n=new Uint8Array(t);let i=0;for(const a of r)n.set(a,i),i+=a.byteLength;return n}function Xu(e){let t=e.match(/^https?:\/\/([^/]+)@/);if(t==null)return{url:e,auth:{}};t=t[1];const[r,n]=t.split(":");return e=e.replace(`${t}@`,""),{url:e,auth:{username:r,password:n}}}function Jo(e,t){const r=t.toString(16);return"0".repeat(e-r.length)+r}class Le{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(t){typeof t=="string"&&(t=Buffer.from(t));const r=t.length+4,n=Jo(4,r);return Buffer.concat([Buffer.from(n,"utf8"),t])}static streamReader(t){const r=new Du(t);return async function(){try{let i=await r.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;const a=await r.read(i-4);return a??!0}catch(i){return t.error=i,!0}}}}async function Vu(e){const t={};let r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");const n=r.indexOf("=");if(n>-1){const i=r.slice(0,n),a=r.slice(n+1);t[i]=a}else t[r]=!0}return{protocolVersion:2,capabilities2:t}}async function Ku(e,{service:t}){const r=new Set,n=new Map,i=new Map,a=Le.streamReader(e);let o=await a();for(;o===null;)o=await a();if(o===!0)throw new ei;if(o.includes("version 2"))return Vu(a);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${t}`)throw new Dr(`# service=${t}\\n`,o.toString("utf8"));let s=await a();for(;s===null;)s=await a();if(s===!0)return{capabilities:r,refs:n,symrefs:i};if(s=s.toString("utf8"),s.includes("version 2"))return Vu(a);const[l,c]=Qo(s,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){const[u,d]=Qo(l," "," ");for(n.set(d,u);;){const p=await a();if(p===!0)break;if(p!==null){const[m,g]=Qo(p.toString("utf8")," "," ");n.set(g,m)}}}for(const u of r)if(u.startsWith("symref=")){const d=u.match(/symref=([^:]+):(.*)/);d.length===3&&i.set(d[1],d[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function Qo(e,t,r){const n=e.trim().split(t);if(n.length!==2)throw new Dr(`Two strings separated by '${r}'`,e.toString("utf8"));return n}const Ju=(e,t)=>e.endsWith("?")?`${e}${t}`:`${e}/${t.replace(/^https?:\/\//,"")}`,Qu=(e,t)=>{(t.username||t.password)&&(e.Authorization=Zu(t)),t.headers&&Object.assign(e,t.headers)},es=async e=>{try{const t=Buffer.from(await aa(e.body)),r=t.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:t}}catch{return{}}};class oa{static async capabilities(){return["discover","connect"]}static async discover({http:t,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:a,corsProxy:o,service:s,url:l,headers:c,protocolVersion:u}){let{url:d,auth:p}=Xu(l);const m=o?Ju(o,d):d;(p.username||p.password)&&(c.Authorization=Zu(p)),u===2&&(c["Git-Protocol"]="version=2");let g,v,x=!1;do if(g=await t.request({onProgress:r,method:"GET",url:`${m}/info/refs?service=${s}`,headers:c}),v=!1,g.statusCode===401||g.statusCode===203){const b=x?a:n;if(b){if(p=await b(d,{...p,headers:{...c}}),p&&p.cancel)throw new fn;p&&(Qu(c,p),x=!0,v=!0)}}else g.statusCode===200&&x&&i&&await i(d,p);while(v);if(g.statusCode!==200){const{response:b}=await es(g);throw new sn(g.statusCode,g.statusMessage,b)}if(g.headers["content-type"]===`application/x-${s}-advertisement`){const b=await Ku(g.body,{service:s});return b.auth=p,b}else{const{preview:b,response:_,data:k}=await es(g);try{const S=await Ku([k],{service:s});return S.auth=p,S}catch{throw new ai(b,_)}}}static async connect({http:t,onProgress:r,corsProxy:n,service:i,url:a,auth:o,body:s,headers:l}){const c=Xu(a);c&&(a=c.url),n&&(a=Ju(n,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,Qu(l,o);const u=await t.request({onProgress:r,method:"POST",url:`${a}/${i}`,body:s,headers:l});if(u.statusCode!==200){const{response:d}=es(u);throw new sn(u.statusCode,u.statusMessage,d)}return u}}function _g({url:e}){if(e.startsWith("git@"))return{transport:"ssh",address:e};const t=e.match(/(\w+)(:\/\/|::)(.*)/);if(t!==null){if(t[2]==="://")return{transport:t[1],address:t[0]};if(t[2]==="::")return{transport:t[1],address:t[3]}}}class sa{static getRemoteHelperFor({url:t}){const r=new Map;r.set("http",oa),r.set("https",oa);const n=_g({url:t});if(!n)throw new si(t);if(r.has(n.transport))return r.get(n.transport);throw new oi(t,n.transport,n.transport==="ssh"?vg(t):void 0)}}let Ir=null;class mi{static async read({fs:t,gitdir:r}){Ir===null&&(Ir=new Tn);const n=N.join(r,"shallow"),i=new Set;return await Ir.acquire(n,async function(){const a=await t.read(n,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(`
64
+ `+a;return De.from(l)}}async function dn({fs:e,cache:t,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:ct.from([]),oid:n};const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,dn({fs:e,cache:t,gitdir:r,oid:n});if(i==="commit")return n=De.from(a).parse().tree,dn({fs:e,cache:t,gitdir:r,oid:n});if(i!=="tree")throw new rt(n,i,"tree");return{tree:ct.from(a),oid:n}}class Qw{constructor({fs:t,gitdir:r,ref:n,cache:i}){this.fs=t,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{const o=new Map;let s;try{s=await H.resolve({fs:t,gitdir:r,ref:n})}catch(c){c instanceof Oe&&(s="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}const l=await dn({fs:t,cache:this.cache,gitdir:r,oid:s});return l.type="tree",l.mode="40000",o.set(".",l),o})();const a=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,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(t){const r=t._fullpath,{fs:n,cache:i,gitdir:a}=this,o=await this.mapPromise,s=o.get(r);if(!s)throw new Error(`No obj for ${r}`);const l=s.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(s)}`);if(s.type!=="tree")return null;const{type:c,object:u}=await Ae({fs:n,cache:i,gitdir:a,oid:l});if(c!==s.type)throw new rt(l,c,s.type);const d=ct.from(u);for(const p of d)o.set(N.join(r,p.path),p);return d.entries().map(p=>N.join(r,p.path))}async type(t){if(t._type===!1){const r=await this.mapPromise,{type:n}=r.get(t._fullpath);t._type=n}return t._type}async mode(t){if(t._mode===!1){const r=await this.mapPromise,{mode:n}=r.get(t._fullpath);t._mode=yu(parseInt(n,8))}return t._mode}async stat(t){}async content(t){if(t._content===!1){const r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,s=r.get(t._fullpath).oid,{type:l,object:c}=await Ae({fs:n,cache:i,gitdir:a,oid:s});l!=="blob"?t._content=void 0:t._content=new Uint8Array(c)}return t._content}async oid(t){if(t._oid===!1){const n=(await this.mapPromise).get(t._fullpath);t._oid=n.oid}return t._oid}}function xt({ref:e="HEAD"}={}){const t=Object.create(null);return Object.defineProperty(t,Ki,{value:function({fs:r,gitdir:n,cache:i}){return new Qw({fs:r,gitdir:n,ref:e,cache:i})}}),Object.freeze(t),t}class eg{constructor({fs:t,dir:r,gitdir:n,cache:i}){this.fs=t,this.cache=i,this.dir=r,this.gitdir=n;const a=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,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(t){const r=t._fullpath,{fs:n,dir:i}=this,a=await n.readdir(N.join(i,r));return a===null?null:a.map(o=>N.join(r,o))}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){const{fs:r,dir:n}=this;let i=await r.lstat(`${n}/${t._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),t._type=a,i=en(i),t._mode=i.mode,i.size===-1&&t._actualSize&&(i.size=t._actualSize),t._stat=i}return t._stat}async content(t){if(t._content===!1){const{fs:r,dir:n,gitdir:i}=this;if(await t.type()==="tree")t._content=void 0;else{const o=await(await Me.get({fs:r,gitdir:i})).get("core.autocrlf"),s=await r.read(`${n}/${t._fullpath}`,{autocrlf:o});t._actualSize=s.length,t._stat&&t._stat.size===-1&&(t._stat.size=t._actualSize),t._content=new Uint8Array(s)}}return t._content}async oid(t){if(t._oid===!1){const{fs:r,gitdir:n,cache:i}=this;let a;await He.acquire({fs:r,gitdir:n,cache:i},async function(o){const s=o.entriesMap.get(t._fullpath),l=await t.stat(),u=await(await Me.get({fs:r,gitdir:n})).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;!s||Xi(l,s,u,d)?await t.content()===void 0?a=void 0:(a=await Vt(an.wrap({type:"blob",object:await t.content()})),s&&a===s.oid&&(!u||l.mode===s.mode)&&Xi(l,s,u,d)&&o.insert({filepath:t._fullpath,stats:l,oid:a})):a=s.oid}),t._oid=a}return t._oid}}function ui(){const e=Object.create(null);return Object.defineProperty(e,Ki,{value:function({fs:t,dir:r,gitdir:n,cache:i}){return new eg({fs:t,dir:r,gitdir:n,cache:i})}}),Object.freeze(e),e}function tg(e,t){const r=t-e;return Array.from({length:r},(n,i)=>e+i)}const ju=typeof Array.prototype.flat>"u"?e=>e.reduce((t,r)=>t.concat(r),[]):e=>e.flat();class rg{constructor(){this.value=null}consider(t){t!=null&&(this.value===null?this.value=t:t<this.value&&(this.value=t))}reset(){this.value=null}}function*ng(e){const t=new rg;let r;const n=[],i=e.length;for(let a=0;a<i;a++)n[a]=e[a].next().value,n[a]!==void 0&&t.consider(n[a]);if(t.value!==null)for(;;){const a=[];r=t.value,t.reset();for(let o=0;o<i;o++)n[o]!==void 0&&n[o]===r?(a[o]=n[o],n[o]=e[o].next().value):a[o]=null,n[o]!==void 0&&t.consider(n[o]);if(yield a,t.value===null)return}}async function hr({fs:e,cache:t,dir:r,gitdir:n,trees:i,map:a=async(l,c)=>c,reduce:o=async(l,c)=>{const u=ju(c);return l!==void 0&&u.unshift(l),u},iterate:s=(l,c)=>Promise.all([...c].map(l))}){const l=i.map(m=>m[Ki]({fs:e,dir:r,gitdir:n,cache:t})),c=new Array(l.length).fill("."),u=tg(0,l.length),d=async m=>{u.map(v=>{m[v]=m[v]&&new l[v].ConstructEntry(m[v])});const b=(await Promise.all(u.map(v=>m[v]?l[v].readdir(m[v]):[]))).map(v=>v===null?[]:v).map(v=>v[Symbol.iterator]());return{entries:m,children:ng(b)}},p=async m=>{const{entries:g,children:b}=await d(m),v=g.find(_=>_&&_._fullpath)._fullpath,y=await a(v,g);if(y!==null){let _=await s(p,b);return _=_.filter(R=>R!==void 0),o(y,_)}};return p(c)}async function Zo(e,t){const r=await e.readdir(t);r==null?await e.rm(t):r.length?await Promise.all(r.map(n=>{const i=N.join(t,n);return e.lstat(i).then(a=>{if(a)return a.isDirectory()?Zo(e,i):e.rm(i)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function ig(e){return ag(e)&&Bu(e.then)&&Bu(e.catch)}function ag(e){return e&&typeof e=="object"}function Bu(e){return typeof e=="function"}function zu(e){return ig((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(e))}const Nu=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function Mu(e,t){if(zu(t))for(const r of Nu)e[`_${r}`]=t[r].bind(t);else for(const r of Nu)e[`_${r}`]=Io(t[r].bind(t));zu(t)?t.rm?e._rm=t.rm.bind(t):t.rmdir.length>1?e._rm=t.rmdir.bind(t):e._rm=Zo.bind(null,e):t.rm?e._rm=Io(t.rm.bind(t)):t.rmdir.length>2?e._rm=Io(t.rmdir.bind(t)):e._rm=Zo.bind(null,e)}class K{constructor(t){if(typeof t._original_unwrapped_fs<"u")return t;const r=Object.getOwnPropertyDescriptor(t,"promises");r&&r.enumerable?Mu(this,t.promises):Mu(this,t),this._original_unwrapped_fs=t}async exists(t,r={}){try{return await this._stat(t),!0}catch(n){if(n.code==="ENOENT"||n.code==="ENOTDIR"||(n.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(t,r={}){try{let n=await this._readFile(t,r);if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
65
+ `),n=new TextEncoder().encode(n)}catch{}return typeof n!="string"&&(n=Buffer.from(n)),n}catch{return null}}async write(t,r,n={}){try{await this._writeFile(t,r,n);return}catch{await this.mkdir(rn(t)),await this._writeFile(t,r,n)}}async mkdir(t,r=!1){try{await this._mkdir(t);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){const i=rn(t);if(i==="."||i==="/"||i===t)throw n;await this.mkdir(i),await this.mkdir(t,!0)}}}async rm(t){try{await this._unlink(t)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(t,r){try{r&&r.recursive?await this._rm(t,r):await this._rmdir(t)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(t){try{const r=await this._readdir(t);return r.sort(Zi),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(t){const r=await this._readdir(t);return(await Promise.all(r.map(async i=>{const a=t+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(t){try{return await this._lstat(t)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(t,r={encoding:"buffer"}){try{const n=await this._readlink(t,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(t,r){return this._symlink(r.toString("utf8"),t)}}function P(e,t){if(t===void 0)throw new lt(e)}async function na(e,t){return!e&&!t?!1:e&&!t||!e&&t?!0:!(await e.type()==="tree"&&await t.type()==="tree"||await e.type()===await t.type()&&await e.mode()===await t.mode()&&await e.oid()===await t.oid())}async function og({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n="HEAD",cache:i={}}){try{P("fs",e),P("dir",t),P("gitdir",r);const a=new K(e),o=[xt({ref:n}),ui(),nn()];let s=[];await He.acquire({fs:a,gitdir:r,cache:i},async function(c){s=c.unmergedPaths});const l=await hr({fs:a,cache:i,dir:t,gitdir:r,trees:o,map:async function(c,[u,d,p]){const m=!await na(d,p),g=s.includes(c),b=!await na(p,u);if(m||g)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(b)return!1;throw new ci(c)}});await He.acquire({fs:a,gitdir:r,cache:i},async function(c){for(const u of l)if(u!==!1){if(!u){await a.rmdir(`${t}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){const d=new TextDecoder().decode(u.content);await a.write(`${t}/${u.path}`,d,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}class hn{static async isIgnored({fs:t,dir:r,gitdir:n=N.join(r,".git"),filepath:i}){if(Vi(i)===".git")return!0;if(i===".")return!1;let a="";const o=N.join(n,"info","exclude");await t.exists(o)&&(a=await t.read(o,"utf8"));const s=[{gitignore:N.join(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){const d=l.slice(0,u).join("/"),p=l.slice(u).join("/");s.push({gitignore:N.join(r,d,".gitignore"),filepath:p})}let c=!1;for(const u of s){let d;try{d=await t.read(u.gitignore,"utf8")}catch(g){if(g.code==="NOENT")continue}const p=Q0().add(a);p.add(d);const m=rn(u.filepath);if(m!=="."&&p.ignores(m))return!0;c?c=!p.test(u.filepath).unignored:c=p.test(u.filepath).ignored}return c}}async function sg({fs:e,gitdir:t,object:r,format:n,oid:i}){if(n!=="deflated")throw new se("GitObjectStoreLoose expects objects to write to be in deflated format");const a=`objects/${i.slice(0,2)}/${i.slice(2)}`,o=`${t}/${a}`;await e.exists(o)||await e.write(o,r)}let Xo=null;async function Lu(e){return Xo===null&&(Xo=lg()),Xo?cg(e):$o.deflate(e)}async function cg(e){const t=new CompressionStream("deflate"),r=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}function lg(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function ut({fs:e,gitdir:t,type:r,object:n,format:i="content",oid:a=void 0,dryRun:o=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=an.wrap({type:r,object:n})),a=await Vt(n),n=Buffer.from(await Lu(n))),o||await sg({fs:e,gitdir:t,object:n,format:"deflated",oid:a}),a}function Fu(e){let t;for(;~(t=e.indexOf(92));)e[t]=47;return e}async function ug({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={},force:a=!1,parallel:o=!0}){try{P("fs",e),P("dir",t),P("gitdir",r),P("filepath",n);const s=new K(e);await He.acquire({fs:s,gitdir:r,cache:i},async l=>Vo({dir:t,gitdir:r,fs:s,filepath:n,index:l,force:a,parallel:o}))}catch(s){throw s.caller="git.add",s}}async function Vo({dir:e,gitdir:t,fs:r,filepath:n,index:i,force:a,parallel:o}){n=Array.isArray(n)?n:[n];const s=n.map(async d=>{if(!a&&await hn.isIgnored({fs:r,dir:e,gitdir:t,filepath:d}))return;const p=await r.lstat(N.join(e,d));if(!p)throw new Oe(d);if(p.isDirectory()){const m=await r.readdir(N.join(e,d));if(o){const g=m.map(b=>Vo({dir:e,gitdir:t,fs:r,filepath:[N.join(d,b)],index:i,force:a,parallel:o}));await Promise.all(g)}else for(const g of m)await Vo({dir:e,gitdir:t,fs:r,filepath:[N.join(d,g)],index:i,force:a,parallel:o})}else{const g=await(await Me.get({fs:r,gitdir:t})).get("core.autocrlf"),b=p.isSymbolicLink()?await r.readlink(N.join(e,d)).then(Fu):await r.read(N.join(e,d),{autocrlf:g});if(b===null)throw new Oe(d);const v=await ut({fs:r,gitdir:t,type:"blob",object:b});i.insert({filepath:d,stats:p,oid:v})}}),l=await Promise.allSettled(s),c=l.filter(d=>d.status==="rejected").map(d=>d.reason);if(c.length>1)throw new ii(c);if(c.length===1)throw c[0];return l.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function fi({fs:e,gitdir:t,path:r}){return(await Me.get({fs:e,gitdir:t})).get(r)}function Uu(e,...t){for(const r of t)if(r)for(const n of Object.keys(r)){const i=r[n];i!==void 0&&(e[n]=i)}return e}async function pr({fs:e,gitdir:t,author:r,commit:n}){const i=Math.floor(Date.now()/1e3),a={name:await fi({fs:e,gitdir:t,path:"user.name"}),email:await fi({fs:e,gitdir:t,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},o=Uu({},a,n?n.author:void 0,r);if(o.name!==void 0)return o}async function pn({fs:e,gitdir:t,author:r,committer:n,commit:i}){const a=Math.floor(Date.now()/1e3),o={name:await fi({fs:e,gitdir:t,path:"user.name"}),email:await fi({fs:e,gitdir:t,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},s=Uu({},o,i?i.committer:void 0,r,n);if(s.name!==void 0)return s}async function Hu({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,Hu({fs:e,cache:t,gitdir:r,oid:n});if(i!=="commit")throw new rt(n,i,"commit");return{commit:De.from(a),oid:n}}async function mn({fs:e,cache:t,gitdir:r,oid:n}){const{commit:i,oid:a}=await Hu({fs:e,cache:t,gitdir:r,oid:n});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function ia({fs:e,cache:t,onSign:r,gitdir:n,message:i,author:a,committer:o,signingKey:s,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:d,parent:p,tree:m}){let g=!1;d||(d=await H.resolve({fs:e,gitdir:n,ref:"HEAD",depth:2}));let b,v;try{b=await H.resolve({fs:e,gitdir:n,ref:d}),v=await mn({fs:e,gitdir:n,oid:b,cache:{}})}catch{g=!0}if(l&&g)throw new li(d);const y=l?await pr({fs:e,gitdir:n,author:a,commit:v.commit}):await pr({fs:e,gitdir:n,author:a});if(!y)throw new Xe("author");const _=l?await pn({fs:e,gitdir:n,author:y,committer:o,commit:v.commit}):await pn({fs:e,gitdir:n,author:y,committer:o});if(!_)throw new Xe("committer");return He.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async function(R){const x=vu(R.entries).get(".");if(m||(m=await Wu({fs:e,gitdir:n,inode:x,dryRun:c})),p?p=await Promise.all(p.map(S=>H.resolve({fs:e,gitdir:n,ref:S}))):l?p=v.commit.parent:p=b?[b]:[],!i)if(l)i=v.commit.message;else throw new lt("message");let O=De.from({tree:m,parent:p,author:y,committer:_,message:i});s&&(O=await De.sign(O,r,s));const k=await ut({fs:e,gitdir:n,type:"commit",object:O.toObject(),dryRun:c});return!u&&!c&&await H.writeRef({fs:e,gitdir:n,ref:d,value:k}),k})}async function Wu({fs:e,gitdir:t,inode:r,dryRun:n}){const i=r.children;for(const l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await Wu({fs:e,gitdir:t,inode:l,dryRun:n}));const a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),o=ct.from(a);return await ut({fs:e,gitdir:t,type:"tree",object:o.toObject(),dryRun:n})}async function di({fs:e,cache:t,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new fr("leading-slash");if(i.endsWith("/"))throw new fr("trailing-slash");const a=n,o=await dn({fs:e,cache:t,gitdir:r,oid:n}),s=o.tree;if(i==="")n=o.oid;else{const l=i.split("/");n=await qu({fs:e,cache:t,gitdir:r,tree:s,pathArray:l,oid:a,filepath:i})}return n}async function qu({fs:e,cache:t,gitdir:r,tree:n,pathArray:i,oid:a,filepath:o}){const s=i.shift();for(const l of n)if(l.path===s){if(i.length===0)return l.oid;{const{type:c,object:u}=await Ae({fs:e,cache:t,gitdir:r,oid:l.oid});if(c!=="tree")throw new rt(a,c,"tree",o);return n=ct.from(u),qu({fs:e,cache:t,gitdir:r,tree:n,pathArray:i,oid:a,filepath:o})}}throw new Oe(`file or directory found at "${a}:${o}"`)}async function wn({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await di({fs:e,cache:t,gitdir:r,oid:n,filepath:i}));const{tree:a,oid:o}=await dn({fs:e,cache:t,gitdir:r,oid:n});return{oid:o,tree:a.entries()}}async function hi({fs:e,gitdir:t,tree:r}){const n=ct.from(r).toObject();return await ut({fs:e,gitdir:t,type:"tree",object:n,format:"content"})}async function fg({fs:e,cache:t,onSign:r,gitdir:n,ref:i,oid:a,note:o,force:s,author:l,committer:c,signingKey:u}){let d;try{d=await H.resolve({gitdir:n,fs:e,ref:i})}catch(y){if(!(y instanceof Oe))throw y}let m=(await wn({fs:e,cache:t,gitdir:n,oid:d||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(s)m=m.filter(y=>y.path!==a);else for(const y of m)if(y.path===a)throw new Ot("note",a);typeof o=="string"&&(o=Buffer.from(o,"utf8"));const g=await ut({fs:e,gitdir:n,type:"blob",object:o,format:"content"});m.push({mode:"100644",path:a,oid:g,type:"blob"});const b=await hi({fs:e,gitdir:n,tree:m});return await ia({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:b,parent:d&&[d],message:`Note added by 'isomorphic-git addNote'
66
+ `,author:l,committer:c,signingKey:u})}async function dg({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ref:i="refs/notes/commits",oid:a,note:o,force:s,author:l,committer:c,signingKey:u,cache:d={}}){try{P("fs",e),P("gitdir",n),P("oid",a),P("note",o),u&&P("onSign",t);const p=new K(e),m=await pr({fs:p,gitdir:n,author:l});if(!m)throw new Xe("author");const g=await pn({fs:p,gitdir:n,author:m,committer:c});if(!g)throw new Xe("committer");return await fg({fs:new K(p),cache:d,onSign:t,gitdir:n,ref:i,oid:a,note:o,force:s,author:m,committer:g,signingKey:u})}catch(p){throw p.caller="git.addNote",p}}async function Gu({fs:e,gitdir:t,remote:r,url:n,force:i}){if(r!==Mt.clean(r))throw new Ct(r,Mt.clean(r));const a=await Me.get({fs:e,gitdir:t});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new Ot("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Me.save({fs:e,gitdir:t,config:a})}async function hg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n,url:i,force:a=!1}){try{return P("fs",e),P("gitdir",r),P("remote",n),P("url",i),await Gu({fs:new K(e),gitdir:r,remote:n,url:i,force:a})}catch(o){throw o.caller="git.addRemote",o}}async function pg({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tagger:a,message:o=i,gpgsig:s,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await H.exists({fs:e,gitdir:n,ref:i}))throw new Ot("tag",i);const d=await H.resolve({fs:e,gitdir:n,ref:l||"HEAD"}),{type:p}=await Ae({fs:e,cache:t,gitdir:n,oid:d});let m=nt.from({object:d,type:p,tag:i.replace("refs/tags/",""),tagger:a,message:o,gpgsig:s});c&&(m=await nt.sign(m,r,c));const g=await ut({fs:e,gitdir:n,type:"tag",object:m.toObject()});await H.writeRef({fs:e,gitdir:n,ref:i,value:g})}async function mg({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ref:i,tagger:a,message:o=i,gpgsig:s,object:l,signingKey:c,force:u=!1,cache:d={}}){try{P("fs",e),P("gitdir",n),P("ref",i),c&&P("onSign",t);const p=new K(e),m=await pr({fs:p,gitdir:n,author:a});if(!m)throw new Xe("tagger");return await pg({fs:p,cache:d,onSign:t,gitdir:n,ref:i,tagger:m,message:o,gpgsig:s,object:l,signingKey:c,force:u})}catch(p){throw p.caller="git.annotatedTag",p}}async function wg({fs:e,gitdir:t,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Mt.clean(r))throw new Ct(r,Mt.clean(r));const o=`refs/heads/${r}`;if(!a&&await H.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",r,!1);let s;try{s=await H.resolve({fs:e,gitdir:t,ref:n||"HEAD"})}catch{}s&&await H.writeRef({fs:e,gitdir:t,ref:o,value:s}),i&&await H.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function gg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,checkout:a=!1,force:o=!1}){try{return P("fs",e),P("gitdir",r),P("ref",n),await wg({fs:new K(e),gitdir:r,ref:n,object:i,checkout:a,force:o})}catch(s){throw s.caller="git.branch",s}}const Yu=(e,t)=>e==="."||t==null||t.length===0||t==="."?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);async function Ko({fs:e,cache:t,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:o,ref:s,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:d,force:p,track:m=!0}){let g;if(n)try{g=await H.resolve({fs:e,gitdir:a,ref:"HEAD"})}catch{g="0000000000000000000000000000000000000000"}let b;try{b=await H.resolve({fs:e,gitdir:a,ref:s})}catch(v){if(s==="HEAD")throw v;const y=`${o}/${s}`;if(b=await H.resolve({fs:e,gitdir:a,ref:y}),m){const _=await Me.get({fs:e,gitdir:a});await _.set(`branch.${s}.remote`,o),await _.set(`branch.${s}.merge`,`refs/heads/${s}`),await Me.save({fs:e,gitdir:a,config:_})}await H.writeRef({fs:e,gitdir:a,ref:`refs/heads/${s}`,value:b})}if(!c){let v;try{v=await yg({fs:e,cache:t,onProgress:r,dir:i,gitdir:a,ref:s,force:p,filepaths:l})}catch(x){throw x instanceof Oe&&x.data.what===b?new Qn(s,b):x}const y=v.filter(([x])=>x==="conflict").map(([x,O])=>O);if(y.length>0)throw new Jn(y);const _=v.filter(([x])=>x==="error").map(([x,O])=>O);if(_.length>0)throw new se(_.join(", "));if(d){n&&await n({previousHead:g,newHead:b,type:l!=null&&l.length>0?"file":"branch"});return}let R=0;const C=v.length;await He.acquire({fs:e,gitdir:a,cache:t},async function(x){await Promise.all(v.filter(([O])=>O==="delete"||O==="delete-index").map(async function([O,k]){const S=`${i}/${k}`;O==="delete"&&await e.rm(S),x.delete({filepath:k}),r&&await r({phase:"Updating workdir",loaded:++R,total:C})}))}),await He.acquire({fs:e,gitdir:a,cache:t},async function(x){for(const[O,k]of v)if(O==="rmdir"||O==="rmdir-index"){const S=`${i}/${k}`;try{O==="rmdir-index"&&x.delete({filepath:k}),await e.rmdir(S),r&&await r({phase:"Updating workdir",loaded:++R,total:C})}catch(A){if(A.code==="ENOTEMPTY")console.log(`Did not delete ${k} because directory is not empty`);else throw A}}}),await Promise.all(v.filter(([x])=>x==="mkdir"||x==="mkdir-index").map(async function([x,O]){const k=`${i}/${O}`;await e.mkdir(k),r&&await r({phase:"Updating workdir",loaded:++R,total:C})})),await He.acquire({fs:e,gitdir:a,cache:t},async function(x){await Promise.all(v.filter(([O])=>O==="create"||O==="create-index"||O==="update"||O==="mkdir-index").map(async function([O,k,S,A,D]){const B=`${i}/${k}`;try{if(O!=="create-index"&&O!=="mkdir-index"){const{object:U}=await Ae({fs:e,cache:t,gitdir:a,oid:S});if(D&&await e.rm(B),A===33188)await e.write(B,U);else if(A===33261)await e.write(B,U,{mode:511});else if(A===40960)await e.writelink(B,U);else throw new se(`Invalid mode 0o${A.toString(8)} detected in blob ${S}`)}const M=await e.lstat(B);A===33261&&(M.mode=493),O==="mkdir-index"&&(M.mode=57344),x.insert({filepath:k,stats:M,oid:S}),r&&await r({phase:"Updating workdir",loaded:++R,total:C})}catch(M){console.log(M)}}))}),n&&await n({previousHead:g,newHead:b,type:l!=null&&l.length>0?"file":"branch"})}if(!u){const v=await H.expand({fs:e,gitdir:a,ref:s});v.startsWith("refs/heads")?await H.writeSymbolicRef({fs:e,gitdir:a,ref:"HEAD",value:v}):await H.writeRef({fs:e,gitdir:a,ref:"HEAD",value:b})}}async function yg({fs:e,cache:t,onProgress:r,dir:n,gitdir:i,ref:a,force:o,filepaths:s}){let l=0;return hr({fs:e,cache:t,dir:n,gitdir:i,trees:[xt({ref:a}),ui(),nn()],map:async function(c,[u,d,p]){if(c===".")return;if(s&&!s.some(g=>Yu(c,g)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!p,!!u,!!d].map(Number).join("")){case"000":return;case"001":return o&&s&&s.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 d.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await d.oid()?o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()]:["conflict",c]:await u.mode()!==await d.mode()?o?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await p.type()){case"tree":return["rmdir",c];case"blob":return await p.oid()!==await d.oid()?o?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await p.type()}`]}case"110":case"111":switch(`${await p.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await p.oid()===await u.oid()&&await p.mode()===await u.mode()&&!o)return;if(d){if(await d.oid()!==await p.oid()&&await d.oid()!==await u.oid())return o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()]:["conflict",c]}else if(o)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await p.mode()];return await u.mode()!==await p.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await p.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 p.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=ju(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function Zu({fs:e,onProgress:t,onPostCheckout:r,dir:n,gitdir:i=N.join(n,".git"),remote:a="origin",ref:o,filepaths:s,noCheckout:l=!1,noUpdateHead:c=o===void 0,dryRun:u=!1,force:d=!1,track:p=!0,cache:m={}}){try{P("fs",e),P("dir",n),P("gitdir",i);const g=o||"HEAD";return await Ko({fs:new K(e),cache:m,onProgress:t,onPostCheckout:r,dir:n,gitdir:i,remote:a,ref:g,filepaths:s,noCheckout:l,noUpdateHead:c,dryRun:u,force:d,track:p})}catch(g){throw g.caller="git.checkout",g}}const bg=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function $r(e){const t=bg.exec(e);return t?t[1]==="remotes/"&&e.endsWith("/HEAD")?t[2].slice(0,-5):t[2]:e}async function mr({fs:e,gitdir:t,fullname:r=!1,test:n=!1}){const i=await H.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2});if(n)try{await H.resolve({fs:e,gitdir:t,ref:i})}catch{return}if(i.startsWith("refs/"))return r?i:$r(i)}function _g(e){return e=e.replace(/^git@([^:]+):/,"https://$1/"),e=e.replace(/^ssh:\/\//,"https://"),e}function Xu({username:e="",password:t=""}){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}async function pi(e,t){const r=Du(e);for(;;){const{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function aa(e){let t=0;const r=[];await pi(e,a=>{r.push(a),t+=a.byteLength});const n=new Uint8Array(t);let i=0;for(const a of r)n.set(a,i),i+=a.byteLength;return n}function Vu(e){let t=e.match(/^https?:\/\/([^/]+)@/);if(t==null)return{url:e,auth:{}};t=t[1];const[r,n]=t.split(":");return e=e.replace(`${t}@`,""),{url:e,auth:{username:r,password:n}}}function Jo(e,t){const r=t.toString(16);return"0".repeat(e-r.length)+r}class Le{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(t){typeof t=="string"&&(t=Buffer.from(t));const r=t.length+4,n=Jo(4,r);return Buffer.concat([Buffer.from(n,"utf8"),t])}static streamReader(t){const r=new $u(t);return async function(){try{let i=await r.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;const a=await r.read(i-4);return a??!0}catch(i){return t.error=i,!0}}}}async function Ku(e){const t={};let r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");const n=r.indexOf("=");if(n>-1){const i=r.slice(0,n),a=r.slice(n+1);t[i]=a}else t[r]=!0}return{protocolVersion:2,capabilities2:t}}async function Ju(e,{service:t}){const r=new Set,n=new Map,i=new Map,a=Le.streamReader(e);let o=await a();for(;o===null;)o=await a();if(o===!0)throw new ei;if(o.includes("version 2"))return Ku(a);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${t}`)throw new Dr(`# service=${t}\\n`,o.toString("utf8"));let s=await a();for(;s===null;)s=await a();if(s===!0)return{capabilities:r,refs:n,symrefs:i};if(s=s.toString("utf8"),s.includes("version 2"))return Ku(a);const[l,c]=Qo(s,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){const[u,d]=Qo(l," "," ");for(n.set(d,u);;){const p=await a();if(p===!0)break;if(p!==null){const[m,g]=Qo(p.toString("utf8")," "," ");n.set(g,m)}}}for(const u of r)if(u.startsWith("symref=")){const d=u.match(/symref=([^:]+):(.*)/);d.length===3&&i.set(d[1],d[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function Qo(e,t,r){const n=e.trim().split(t);if(n.length!==2)throw new Dr(`Two strings separated by '${r}'`,e.toString("utf8"));return n}const Qu=(e,t)=>e.endsWith("?")?`${e}${t}`:`${e}/${t.replace(/^https?:\/\//,"")}`,ef=(e,t)=>{(t.username||t.password)&&(e.Authorization=Xu(t)),t.headers&&Object.assign(e,t.headers)},es=async e=>{try{const t=Buffer.from(await aa(e.body)),r=t.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:t}}catch{return{}}};class oa{static async capabilities(){return["discover","connect"]}static async discover({http:t,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:a,corsProxy:o,service:s,url:l,headers:c,protocolVersion:u}){let{url:d,auth:p}=Vu(l);const m=o?Qu(o,d):d;(p.username||p.password)&&(c.Authorization=Xu(p)),u===2&&(c["Git-Protocol"]="version=2");let g,b,v=!1;do if(g=await t.request({onProgress:r,method:"GET",url:`${m}/info/refs?service=${s}`,headers:c}),b=!1,g.statusCode===401||g.statusCode===203){const y=v?a:n;if(y){if(p=await y(d,{...p,headers:{...c}}),p&&p.cancel)throw new fn;p&&(ef(c,p),v=!0,b=!0)}}else g.statusCode===200&&v&&i&&await i(d,p);while(b);if(g.statusCode!==200){const{response:y}=await es(g);throw new sn(g.statusCode,g.statusMessage,y)}if(g.headers["content-type"]===`application/x-${s}-advertisement`){const y=await Ju(g.body,{service:s});return y.auth=p,y}else{const{preview:y,response:_,data:R}=await es(g);try{const C=await Ju([R],{service:s});return C.auth=p,C}catch{throw new ai(y,_)}}}static async connect({http:t,onProgress:r,corsProxy:n,service:i,url:a,auth:o,body:s,headers:l}){const c=Vu(a);c&&(a=c.url),n&&(a=Qu(n,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,ef(l,o);const u=await t.request({onProgress:r,method:"POST",url:`${a}/${i}`,body:s,headers:l});if(u.statusCode!==200){const{response:d}=es(u);throw new sn(u.statusCode,u.statusMessage,d)}return u}}function vg({url:e}){if(e.startsWith("git@"))return{transport:"ssh",address:e};const t=e.match(/(\w+)(:\/\/|::)(.*)/);if(t!==null){if(t[2]==="://")return{transport:t[1],address:t[0]};if(t[2]==="::")return{transport:t[1],address:t[3]}}}class sa{static getRemoteHelperFor({url:t}){const r=new Map;r.set("http",oa),r.set("https",oa);const n=vg({url:t});if(!n)throw new si(t);if(r.has(n.transport))return r.get(n.transport);throw new oi(t,n.transport,n.transport==="ssh"?_g(t):void 0)}}let Ir=null;class mi{static async read({fs:t,gitdir:r}){Ir===null&&(Ir=new Tn);const n=N.join(r,"shallow"),i=new Set;return await Ir.acquire(n,async function(){const a=await t.read(n,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(`
67
67
  `).map(o=>i.add(o))}),i}static async write({fs:t,gitdir:r,oids:n}){Ir===null&&(Ir=new Tn);const i=N.join(r,"shallow");if(n.size>0){const a=[...n].join(`
68
68
  `)+`
69
- `;await Ir.acquire(i,async function(){await t.write(i,a,{encoding:"utf8"})})}else await Ir.acquire(i,async function(){await t.rm(i)})}}async function xg({fs:e,gitdir:t,oid:r}){const n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return e.exists(`${t}/${n}`)}async function Eg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await e.readdir(N.join(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(const o of a){const s=`${r}/objects/pack/${o}`,l=await qo({fs:e,cache:t,filename:s,getExternalRefDelta:i});if(l.error)throw new se(l.error);if(l.offsets.has(n))return!0}return!1}async function ef({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=s=>Ae({fs:e,cache:t,gitdir:r,oid:s});let o=await xg({fs:e,gitdir:r,oid:n});return o||(o=await Eg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a})),o}function Sg(e){const i="5041434b"+"00000002"+"00000000";return e.slice(0,12).toString("hex")===i}function tf(e,t){const r=e.map(n=>n.split("=",1)[0]);return t.filter(n=>{const i=n.split("=",1)[0];return r.includes(i)})}const ca={name:"isomorphic-git",version:"1.29.0",agent:"git/isomorphic-git@1.29.0"};class la{constructor(){this._queue=[]}write(t){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){const r=this._waiting;this._waiting=null,r({value:t})}else this._queue.push(t)}end(){if(this._ended=!0,this._waiting){const t=this._waiting;this._waiting=null,t({done:!0})}}destroy(t){this.error=t,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(t=>{this._waiting=t})}}function kg(e){const t=e.indexOf("\r"),r=e.indexOf(`
70
- `);return t===-1&&r===-1?-1:t===-1?r+1:r===-1?t+1:r===t+1?r+1:Math.min(t,r)+1}function rf(e){const t=new la;let r="";return(async()=>(await pi(e,n=>{for(n=n.toString("utf8"),r+=n;;){const i=kg(r);if(i===-1)break;t.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&t.write(r),t.end()))(),t}class nf{static demux(t){const r=Le.streamReader(t),n=new la,i=new la,a=new la,o=async function(){const s=await r();if(s===null)return o();if(s===!0){n.end(),a.end(),t.error?i.destroy(t.error):i.end();return}switch(s[0]){case 1:{i.write(s.slice(1));break}case 2:{a.write(s.slice(1));break}case 3:{const l=s.slice(1);a.write(l),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(s)}o()};return o(),{packetlines:n,packfile:i,progress:a}}}async function Rg(e){const{packetlines:t,packfile:r,progress:n}=nf.demux(e),i=[],a=[],o=[];let s=!1,l=!1;return new Promise((c,u)=>{pi(t,d=>{const p=d.toString("utf8").trim();if(p.startsWith("shallow")){const m=p.slice(-41).trim();m.length!==40&&u(new lr(m)),i.push(m)}else if(p.startsWith("unshallow")){const m=p.slice(-41).trim();m.length!==40&&u(new lr(m)),a.push(m)}else if(p.startsWith("ACK")){const[,m,g]=p.split(" ");o.push({oid:m,status:g}),g||(l=!0)}else p.startsWith("NAK")?(s=!0,l=!0):(l=!0,s=!0);l&&(e.error?u(e.error):c({shallows:i,unshallows:a,acks:o,nak:s,packfile:r,progress:n}))}).finally(()=>{l||(e.error?u(e.error):c({shallows:i,unshallows:a,acks:o,nak:s,packfile:r,progress:n}))})})}function Og({capabilities:e=[],wants:t=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:o=[]}){const s=[];t=[...new Set(t)];let l=` ${e.join(" ")}`;for(const c of t)s.push(Le.encode(`want ${c}${l}
69
+ `;await Ir.acquire(i,async function(){await t.write(i,a,{encoding:"utf8"})})}else await Ir.acquire(i,async function(){await t.rm(i)})}}async function xg({fs:e,gitdir:t,oid:r}){const n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return e.exists(`${t}/${n}`)}async function Eg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await e.readdir(N.join(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(const o of a){const s=`${r}/objects/pack/${o}`,l=await qo({fs:e,cache:t,filename:s,getExternalRefDelta:i});if(l.error)throw new se(l.error);if(l.offsets.has(n))return!0}return!1}async function tf({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=s=>Ae({fs:e,cache:t,gitdir:r,oid:s});let o=await xg({fs:e,gitdir:r,oid:n});return o||(o=await Eg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a})),o}function Sg(e){const i="5041434b"+"00000002"+"00000000";return e.slice(0,12).toString("hex")===i}function rf(e,t){const r=e.map(n=>n.split("=",1)[0]);return t.filter(n=>{const i=n.split("=",1)[0];return r.includes(i)})}const ca={name:"isomorphic-git",version:"1.29.0",agent:"git/isomorphic-git@1.29.0"};class la{constructor(){this._queue=[]}write(t){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){const r=this._waiting;this._waiting=null,r({value:t})}else this._queue.push(t)}end(){if(this._ended=!0,this._waiting){const t=this._waiting;this._waiting=null,t({done:!0})}}destroy(t){this.error=t,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(t=>{this._waiting=t})}}function kg(e){const t=e.indexOf("\r"),r=e.indexOf(`
70
+ `);return t===-1&&r===-1?-1:t===-1?r+1:r===-1?t+1:r===t+1?r+1:Math.min(t,r)+1}function nf(e){const t=new la;let r="";return(async()=>(await pi(e,n=>{for(n=n.toString("utf8"),r+=n;;){const i=kg(r);if(i===-1)break;t.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&t.write(r),t.end()))(),t}class af{static demux(t){const r=Le.streamReader(t),n=new la,i=new la,a=new la,o=async function(){const s=await r();if(s===null)return o();if(s===!0){n.end(),a.end(),t.error?i.destroy(t.error):i.end();return}switch(s[0]){case 1:{i.write(s.slice(1));break}case 2:{a.write(s.slice(1));break}case 3:{const l=s.slice(1);a.write(l),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(s)}o()};return o(),{packetlines:n,packfile:i,progress:a}}}async function Rg(e){const{packetlines:t,packfile:r,progress:n}=af.demux(e),i=[],a=[],o=[];let s=!1,l=!1;return new Promise((c,u)=>{pi(t,d=>{const p=d.toString("utf8").trim();if(p.startsWith("shallow")){const m=p.slice(-41).trim();m.length!==40&&u(new lr(m)),i.push(m)}else if(p.startsWith("unshallow")){const m=p.slice(-41).trim();m.length!==40&&u(new lr(m)),a.push(m)}else if(p.startsWith("ACK")){const[,m,g]=p.split(" ");o.push({oid:m,status:g}),g||(l=!0)}else p.startsWith("NAK")?(s=!0,l=!0):(l=!0,s=!0);l&&(e.error?u(e.error):c({shallows:i,unshallows:a,acks:o,nak:s,packfile:r,progress:n}))}).finally(()=>{l||(e.error?u(e.error):c({shallows:i,unshallows:a,acks:o,nak:s,packfile:r,progress:n}))})})}function Og({capabilities:e=[],wants:t=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:o=[]}){const s=[];t=[...new Set(t)];let l=` ${e.join(" ")}`;for(const c of t)s.push(Le.encode(`want ${c}${l}
71
71
  `)),l="";for(const c of n)s.push(Le.encode(`shallow ${c}
72
72
  `));i!==null&&s.push(Le.encode(`deepen ${i}
73
73
  `)),a!==null&&s.push(Le.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}
74
74
  `));for(const c of o)s.push(Le.encode(`deepen-not ${c}
75
75
  `));s.push(Le.flush());for(const c of r)s.push(Le.encode(`have ${c}
76
76
  `));return s.push(Le.encode(`done
77
- `)),s}async function ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:l,ref:c,remoteRef:u,remote:d,url:p,corsProxy:m,depth:g=null,since:v=null,exclude:x=[],relative:b=!1,tags:_=!1,singleBranch:k=!1,headers:S={},prune:y=!1,pruneTags:C=!1}){const O=c||await mr({fs:e,gitdir:l,test:!0}),R=await Me.get({fs:e,gitdir:l}),A=d||O&&await R.get(`branch.${O}.remote`)||"origin",D=p||await R.get(`remote.${A}.url`);if(typeof D>"u")throw new ct("remote OR url");const j=u||O&&await R.get(`branch.${O}.merge`)||c||"HEAD";m===void 0&&(m=await R.get("http.corsProxy"));const M=sa.getRemoteHelperFor({url:D}),U=await M.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:m,service:"git-upload-pack",url:D,headers:S,protocolVersion:1}),Z=U.auth,de=U.refs;if(de.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(g!==null&&!U.capabilities.has("shallow"))throw new dr("shallow","depth");if(v!==null&&!U.capabilities.has("deepen-since"))throw new dr("deepen-since","since");if(x.length>0&&!U.capabilities.has("deepen-not"))throw new dr("deepen-not","exclude");if(b===!0&&!U.capabilities.has("deepen-relative"))throw new dr("deepen-relative","relative");const{oid:$e,fullref:ge}=H.resolveAgainstMap({ref:j,map:de});for(const L of de.keys())L===ge||L==="HEAD"||L.startsWith("refs/heads/")||_&&L.startsWith("refs/tags/")||de.delete(L);const _e=tf([...U.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${ca.agent}`]);b&&_e.push("deepen-relative");const Je=k?[$e]:de.values(),Qe=k?[O]:await H.listRefs({fs:e,gitdir:l,filepath:"refs"});let fe=[];for(let L of Qe)try{L=await H.expand({fs:e,gitdir:l,ref:L});const V=await H.resolve({fs:e,gitdir:l,ref:L});await ef({fs:e,cache:t,gitdir:l,oid:V})&&fe.push(V)}catch{}fe=[...new Set(fe)];const F=await mi.read({fs:e,gitdir:l}),q=U.capabilities.has("shallow")?[...F]:[],W=Og({capabilities:_e,wants:Je,haves:fe,shallows:q,depth:g,since:v,exclude:x}),ee=Buffer.from(await aa(W)),I=await M.connect({http:r,onProgress:n,corsProxy:m,service:"git-upload-pack",url:D,auth:Z,body:[ee],headers:S}),Q=await Rg(I.body);I.headers&&(Q.headers=I.headers);for(const L of Q.shallows)if(!F.has(L))try{const{object:V}=await Ae({fs:e,cache:t,gitdir:l,oid:L}),te=new De(V),J=await Promise.all(te.headers().parent.map(ne=>ef({fs:e,cache:t,gitdir:l,oid:ne})));J.length===0||J.every(ne=>ne)||F.add(L)}catch{F.add(L)}for(const L of Q.unshallows)F.delete(L);if(await mi.write({fs:e,gitdir:l,oids:F}),k){const L=new Map([[ge,$e]]),V=new Map;let te=10,J=ge;for(;te--;){const ie=U.symrefs.get(J);if(ie===void 0)break;V.set(J,ie),J=ie}const ce=de.get(J);ce&&L.set(J,ce);const{pruned:ne}=await H.updateRemoteRefs({fs:e,gitdir:l,remote:A,refs:L,symrefs:V,tags:_,prune:y});y&&(Q.pruned=ne)}else{const{pruned:L}=await H.updateRemoteRefs({fs:e,gitdir:l,remote:A,refs:de,symrefs:U.symrefs,tags:_,prune:y,pruneTags:C});y&&(Q.pruned=L)}if(Q.HEAD=U.symrefs.get("HEAD"),Q.HEAD===void 0){const{oid:L}=H.resolveAgainstMap({ref:"HEAD",map:de});for(const[V,te]of de.entries())if(V!=="HEAD"&&te===L){Q.HEAD=V;break}}const $=ge.startsWith("refs/tags")?"tag":"branch";if(Q.FETCH_HEAD={oid:$e,description:`${$} '${$r(ge)}' of ${D}`},n||i){const L=rf(Q.progress);pi(L,async V=>{if(i&&await i(V),n){const te=V.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);te&&await n({phase:te[1].trim(),loaded:parseInt(te[2],10),total:parseInt(te[3],10)})}})}const G=Buffer.from(await aa(Q.packfile));if(I.body.error)throw I.body.error;const X=G.slice(-20).toString("hex"),Y={defaultBranch:Q.HEAD,fetchHead:Q.FETCH_HEAD.oid,fetchHeadDescription:Q.FETCH_HEAD.description};if(Q.headers&&(Y.headers=Q.headers),y&&(Y.pruned=Q.pruned),X!==""&&!Sg(G)){Y.packfile=`objects/pack/pack-${X}.pack`;const L=N.join(l,Y.packfile);await e.write(L,G);const V=J=>Ae({fs:e,cache:t,gitdir:l,oid:J}),te=await on.fromPack({pack:G,getExternalRefDelta:V,onProgress:n});await e.write(L.replace(/\.pack$/,".idx"),await te.toBuffer())}return Y}async function af({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:N.join(r,".git"),defaultBranch:i="master"}){if(await e.exists(n+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(o=>n+"/"+o);for(const o of a)await e.mkdir(o);await e.write(n+"/config",`[core]
77
+ `)),s}async function ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:l,ref:c,remoteRef:u,remote:d,url:p,corsProxy:m,depth:g=null,since:b=null,exclude:v=[],relative:y=!1,tags:_=!1,singleBranch:R=!1,headers:C={},prune:x=!1,pruneTags:O=!1}){const k=c||await mr({fs:e,gitdir:l,test:!0}),S=await Me.get({fs:e,gitdir:l}),A=d||k&&await S.get(`branch.${k}.remote`)||"origin",D=p||await S.get(`remote.${A}.url`);if(typeof D>"u")throw new lt("remote OR url");const B=u||k&&await S.get(`branch.${k}.merge`)||c||"HEAD";m===void 0&&(m=await S.get("http.corsProxy"));const M=sa.getRemoteHelperFor({url:D}),U=await M.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:m,service:"git-upload-pack",url:D,headers:C,protocolVersion:1}),Z=U.auth,de=U.refs;if(de.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(g!==null&&!U.capabilities.has("shallow"))throw new dr("shallow","depth");if(b!==null&&!U.capabilities.has("deepen-since"))throw new dr("deepen-since","since");if(v.length>0&&!U.capabilities.has("deepen-not"))throw new dr("deepen-not","exclude");if(y===!0&&!U.capabilities.has("deepen-relative"))throw new dr("deepen-relative","relative");const{oid:$e,fullref:ge}=H.resolveAgainstMap({ref:B,map:de});for(const L of de.keys())L===ge||L==="HEAD"||L.startsWith("refs/heads/")||_&&L.startsWith("refs/tags/")||de.delete(L);const xe=rf([...U.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${ca.agent}`]);y&&xe.push("deepen-relative");const Je=R?[$e]:de.values(),Qe=R?[k]:await H.listRefs({fs:e,gitdir:l,filepath:"refs"});let fe=[];for(let L of Qe)try{L=await H.expand({fs:e,gitdir:l,ref:L});const V=await H.resolve({fs:e,gitdir:l,ref:L});await tf({fs:e,cache:t,gitdir:l,oid:V})&&fe.push(V)}catch{}fe=[...new Set(fe)];const F=await mi.read({fs:e,gitdir:l}),q=U.capabilities.has("shallow")?[...F]:[],W=Og({capabilities:xe,wants:Je,haves:fe,shallows:q,depth:g,since:b,exclude:v}),te=Buffer.from(await aa(W)),I=await M.connect({http:r,onProgress:n,corsProxy:m,service:"git-upload-pack",url:D,auth:Z,body:[te],headers:C}),ee=await Rg(I.body);I.headers&&(ee.headers=I.headers);for(const L of ee.shallows)if(!F.has(L))try{const{object:V}=await Ae({fs:e,cache:t,gitdir:l,oid:L}),re=new De(V),J=await Promise.all(re.headers().parent.map(ne=>tf({fs:e,cache:t,gitdir:l,oid:ne})));J.length===0||J.every(ne=>ne)||F.add(L)}catch{F.add(L)}for(const L of ee.unshallows)F.delete(L);if(await mi.write({fs:e,gitdir:l,oids:F}),R){const L=new Map([[ge,$e]]),V=new Map;let re=10,J=ge;for(;re--;){const ie=U.symrefs.get(J);if(ie===void 0)break;V.set(J,ie),J=ie}const ce=de.get(J);ce&&L.set(J,ce);const{pruned:ne}=await H.updateRemoteRefs({fs:e,gitdir:l,remote:A,refs:L,symrefs:V,tags:_,prune:x});x&&(ee.pruned=ne)}else{const{pruned:L}=await H.updateRemoteRefs({fs:e,gitdir:l,remote:A,refs:de,symrefs:U.symrefs,tags:_,prune:x,pruneTags:O});x&&(ee.pruned=L)}if(ee.HEAD=U.symrefs.get("HEAD"),ee.HEAD===void 0){const{oid:L}=H.resolveAgainstMap({ref:"HEAD",map:de});for(const[V,re]of de.entries())if(V!=="HEAD"&&re===L){ee.HEAD=V;break}}const $=ge.startsWith("refs/tags")?"tag":"branch";if(ee.FETCH_HEAD={oid:$e,description:`${$} '${$r(ge)}' of ${D}`},n||i){const L=nf(ee.progress);pi(L,async V=>{if(i&&await i(V),n){const re=V.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);re&&await n({phase:re[1].trim(),loaded:parseInt(re[2],10),total:parseInt(re[3],10)})}})}const G=Buffer.from(await aa(ee.packfile));if(I.body.error)throw I.body.error;const X=G.slice(-20).toString("hex"),Y={defaultBranch:ee.HEAD,fetchHead:ee.FETCH_HEAD.oid,fetchHeadDescription:ee.FETCH_HEAD.description};if(ee.headers&&(Y.headers=ee.headers),x&&(Y.pruned=ee.pruned),X!==""&&!Sg(G)){Y.packfile=`objects/pack/pack-${X}.pack`;const L=N.join(l,Y.packfile);await e.write(L,G);const V=J=>Ae({fs:e,cache:t,gitdir:l,oid:J}),re=await on.fromPack({pack:G,getExternalRefDelta:V,onProgress:n});await e.write(L.replace(/\.pack$/,".idx"),await re.toBuffer())}return Y}async function of({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:N.join(r,".git"),defaultBranch:i="master"}){if(await e.exists(n+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(o=>n+"/"+o);for(const o of a)await e.mkdir(o);await e.write(n+"/config",`[core]
78
78
  repositoryformatversion = 0
79
79
  filemode = false
80
80
  bare = ${t}
@@ -82,21 +82,21 @@ gpgsig`+Yo(o)+`
82
82
  `)+` symlinks = false
83
83
  ignorecase = true
84
84
  `),await e.write(n+"/HEAD",`ref: refs/heads/${i}
85
- `)}async function Cg({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPostCheckout:l,dir:c,gitdir:u,url:d,corsProxy:p,ref:m,remote:g,depth:v,since:x,exclude:b,relative:_,singleBranch:k,noCheckout:S,noTags:y,headers:C}){try{if(await af({fs:e,gitdir:u}),await qu({fs:e,gitdir:u,remote:g,url:d,force:!1}),p){const A=await Me.get({fs:e,gitdir:u});await A.set("http.corsProxy",p),await Me.save({fs:e,gitdir:u,config:A})}const{defaultBranch:O,fetchHead:R}=await ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:u,ref:m,remote:g,corsProxy:p,depth:v,since:x,exclude:b,relative:_,singleBranch:k,headers:C,tags:!y});if(R===null)return;m=m||O,m=m.replace("refs/heads/",""),await Ko({fs:e,cache:t,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:m,remote:g,noCheckout:S})}catch(O){throw await e.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),O}}async function Pg({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:l,gitdir:c=N.join(l,".git"),url:u,corsProxy:d=void 0,ref:p=void 0,remote:m="origin",depth:g=void 0,since:v=void 0,exclude:x=[],relative:b=!1,singleBranch:_=!1,noCheckout:k=!1,noTags:S=!1,headers:y={},cache:C={}}){try{return P("fs",e),P("http",t),P("gitdir",c),k||P("dir",l),P("url",u),await Cg({fs:new K(e),cache:C,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:l,gitdir:c,url:u,corsProxy:d,ref:p,remote:m,depth:g,since:v,exclude:x,relative:b,singleBranch:_,noCheckout:k,noTags:S,headers:y})}catch(O){throw O.caller="git.clone",O}}async function Tg({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),message:i,author:a,committer:o,signingKey:s,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:d,parent:p,tree:m,cache:g={}}){try{P("fs",e),l||P("message",i),s&&P("onSign",t);const v=new K(e);return await ia({fs:v,cache:g,onSign:t,gitdir:n,message:i,author:a,committer:o,signingKey:s,amend:l,dryRun:c,noUpdateBranch:u,ref:d,parent:p,tree:m})}catch(v){throw v.caller="git.commit",v}}async function Ag({fs:e,dir:t,gitdir:r=N.join(t,".git"),fullname:n=!1,test:i=!1}){try{return P("fs",e),P("gitdir",r),await mr({fs:new K(e),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function Dg({fs:e,gitdir:t,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await H.exists({fs:e,gitdir:t,ref:r}))throw new Oe(r);const i=await H.expand({fs:e,gitdir:t,ref:r}),a=await mr({fs:e,gitdir:t,fullname:!0});if(i===a){const l=await H.resolve({fs:e,gitdir:t,ref:i});await H.writeRef({fs:e,gitdir:t,ref:"HEAD",value:l})}await H.deleteRef({fs:e,gitdir:t,ref:i});const o=$r(r),s=await Me.get({fs:e,gitdir:t});await s.deleteSection("branch",o),await Me.save({fs:e,gitdir:t,config:s})}async function $g({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return P("fs",e),P("ref",n),await Dg({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function Ig({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{P("fs",e),P("ref",n),await H.deleteRef({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function Bg({fs:e,gitdir:t,remote:r}){const n=await Me.get({fs:e,gitdir:t});await n.deleteSection("remote",r),await Me.save({fs:e,gitdir:t,config:n})}async function jg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return P("fs",e),P("remote",n),await Bg({fs:new K(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function zg({fs:e,gitdir:t,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await H.deleteRef({fs:e,gitdir:t,ref:r})}async function Ng({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return P("fs",e),P("ref",n),await zg({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function Mg({fs:e,gitdir:t,oid:r}){const n=r.slice(0,2);return(await e.readdir(`${t}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function Lg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){const a=[];let o=await e.readdir(N.join(r,"objects/pack"));o=o.filter(s=>s.endsWith(".idx"));for(const s of o){const l=`${r}/objects/pack/${s}`,c=await qo({fs:e,cache:t,filename:l,getExternalRefDelta:i});if(c.error)throw new se(c.error);for(const u of c.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function Fg({fs:e,cache:t,gitdir:r,oid:n}){const i=s=>Ae({fs:e,cache:t,gitdir:r,oid:s}),a=await Mg({fs:e,gitdir:r,oid:n}),o=await Lg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i});for(const s of o)a.indexOf(s)===-1&&a.push(s);if(a.length===1)return a[0];throw a.length>1?new Kn("oids",n,a):new Oe(`an object matching "${n}"`)}async function Ug({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await Fg({fs:new K(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function Hg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return P("fs",e),P("gitdir",r),P("ref",n),await H.expand({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function rs({fs:e,cache:t,gitdir:r,oids:n}){const i={},a=n.length;let o=n.map((s,l)=>({index:l,oid:s}));for(;o.length;){const s=new Set;for(const{oid:c,index:u}of o)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&s.add(c);if(s.size>0)return[...s];const l=new Map;for(const{oid:c,index:u}of o)try{const{object:d}=await Ae({fs:e,cache:t,gitdir:r,oid:c}),p=De.from(d),{parent:m}=p.parseHeaders();for(const g of m)(!i[g]||!i[g].has(u))&&l.set(g+":"+u,{oid:g,index:u})}catch{}o=Array.from(l.values())}return[]}const ns=/^.*(\r?\n|$)/gm;function Wg({branches:e,contents:t}){const r=e[1],n=e[2],i=t[0],a=t[1],o=t[2],s=a.match(ns),l=i.match(ns),c=o.match(ns),u=lw(s,l,c),d=7;let p="",m=!0;for(const g of u)g.ok&&(p+=g.ok.join("")),g.conflict&&(m=!1,p+=`${"<".repeat(d)} ${r}
85
+ `)}async function Cg({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPostCheckout:l,dir:c,gitdir:u,url:d,corsProxy:p,ref:m,remote:g,depth:b,since:v,exclude:y,relative:_,singleBranch:R,noCheckout:C,noTags:x,headers:O}){try{if(await of({fs:e,gitdir:u}),await Gu({fs:e,gitdir:u,remote:g,url:d,force:!1}),p){const A=await Me.get({fs:e,gitdir:u});await A.set("http.corsProxy",p),await Me.save({fs:e,gitdir:u,config:A})}const{defaultBranch:k,fetchHead:S}=await ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:u,ref:m,remote:g,corsProxy:p,depth:b,since:v,exclude:y,relative:_,singleBranch:R,headers:O,tags:!x});if(S===null)return;m=m||k,m=m.replace("refs/heads/",""),await Ko({fs:e,cache:t,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:m,remote:g,noCheckout:C})}catch(k){throw await e.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),k}}async function Pg({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:l,gitdir:c=N.join(l,".git"),url:u,corsProxy:d=void 0,ref:p=void 0,remote:m="origin",depth:g=void 0,since:b=void 0,exclude:v=[],relative:y=!1,singleBranch:_=!1,noCheckout:R=!1,noTags:C=!1,headers:x={},cache:O={}}){try{return P("fs",e),P("http",t),P("gitdir",c),R||P("dir",l),P("url",u),await Cg({fs:new K(e),cache:O,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:l,gitdir:c,url:u,corsProxy:d,ref:p,remote:m,depth:g,since:b,exclude:v,relative:y,singleBranch:_,noCheckout:R,noTags:C,headers:x})}catch(k){throw k.caller="git.clone",k}}async function Tg({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),message:i,author:a,committer:o,signingKey:s,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:d,parent:p,tree:m,cache:g={}}){try{P("fs",e),l||P("message",i),s&&P("onSign",t);const b=new K(e);return await ia({fs:b,cache:g,onSign:t,gitdir:n,message:i,author:a,committer:o,signingKey:s,amend:l,dryRun:c,noUpdateBranch:u,ref:d,parent:p,tree:m})}catch(b){throw b.caller="git.commit",b}}async function Ag({fs:e,dir:t,gitdir:r=N.join(t,".git"),fullname:n=!1,test:i=!1}){try{return P("fs",e),P("gitdir",r),await mr({fs:new K(e),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function Dg({fs:e,gitdir:t,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await H.exists({fs:e,gitdir:t,ref:r}))throw new Oe(r);const i=await H.expand({fs:e,gitdir:t,ref:r}),a=await mr({fs:e,gitdir:t,fullname:!0});if(i===a){const l=await H.resolve({fs:e,gitdir:t,ref:i});await H.writeRef({fs:e,gitdir:t,ref:"HEAD",value:l})}await H.deleteRef({fs:e,gitdir:t,ref:i});const o=$r(r),s=await Me.get({fs:e,gitdir:t});await s.deleteSection("branch",o),await Me.save({fs:e,gitdir:t,config:s})}async function $g({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return P("fs",e),P("ref",n),await Dg({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function Ig({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{P("fs",e),P("ref",n),await H.deleteRef({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function jg({fs:e,gitdir:t,remote:r}){const n=await Me.get({fs:e,gitdir:t});await n.deleteSection("remote",r),await Me.save({fs:e,gitdir:t,config:n})}async function Bg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return P("fs",e),P("remote",n),await jg({fs:new K(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function zg({fs:e,gitdir:t,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await H.deleteRef({fs:e,gitdir:t,ref:r})}async function Ng({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return P("fs",e),P("ref",n),await zg({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function Mg({fs:e,gitdir:t,oid:r}){const n=r.slice(0,2);return(await e.readdir(`${t}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function Lg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){const a=[];let o=await e.readdir(N.join(r,"objects/pack"));o=o.filter(s=>s.endsWith(".idx"));for(const s of o){const l=`${r}/objects/pack/${s}`,c=await qo({fs:e,cache:t,filename:l,getExternalRefDelta:i});if(c.error)throw new se(c.error);for(const u of c.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function Fg({fs:e,cache:t,gitdir:r,oid:n}){const i=s=>Ae({fs:e,cache:t,gitdir:r,oid:s}),a=await Mg({fs:e,gitdir:r,oid:n}),o=await Lg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i});for(const s of o)a.indexOf(s)===-1&&a.push(s);if(a.length===1)return a[0];throw a.length>1?new Kn("oids",n,a):new Oe(`an object matching "${n}"`)}async function Ug({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await Fg({fs:new K(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function Hg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return P("fs",e),P("gitdir",r),P("ref",n),await H.expand({fs:new K(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function rs({fs:e,cache:t,gitdir:r,oids:n}){const i={},a=n.length;let o=n.map((s,l)=>({index:l,oid:s}));for(;o.length;){const s=new Set;for(const{oid:c,index:u}of o)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&s.add(c);if(s.size>0)return[...s];const l=new Map;for(const{oid:c,index:u}of o)try{const{object:d}=await Ae({fs:e,cache:t,gitdir:r,oid:c}),p=De.from(d),{parent:m}=p.parseHeaders();for(const g of m)(!i[g]||!i[g].has(u))&&l.set(g+":"+u,{oid:g,index:u})}catch{}o=Array.from(l.values())}return[]}const ns=/^.*(\r?\n|$)/gm;function Wg({branches:e,contents:t}){const r=e[1],n=e[2],i=t[0],a=t[1],o=t[2],s=a.match(ns),l=i.match(ns),c=o.match(ns),u=lw(s,l,c),d=7;let p="",m=!0;for(const g of u)g.ok&&(p+=g.ok.join("")),g.conflict&&(m=!1,p+=`${"<".repeat(d)} ${r}
86
86
  `,p+=g.conflict.a.join(""),p+=`${"=".repeat(d)}
87
87
  `,p+=g.conflict.b.join(""),p+=`${">".repeat(d)} ${n}
88
- `);return{cleanMerge:m,mergedText:p}}async function qg({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),index:i,ourOid:a,baseOid:o,theirOid:s,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:d=!1,abortOnConflict:p=!0,mergeDriver:m}){const g=xt({ref:a}),v=xt({ref:o}),x=xt({ref:s}),b=[],_=[],k=[],S=[],y=await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[g,v,x],map:async function(C,[O,R,A]){const D=Vi(C),j=await na(O,R),M=await na(A,R);switch(`${j}-${M}`){case"false-false":return{mode:await R.mode(),path:D,oid:await R.oid(),type:await R.type()};case"false-true":return A?{mode:await A.mode(),path:D,oid:await A.oid(),type:await A.type()}:void 0;case"true-false":return O?{mode:await O.mode(),path:D,oid:await O.oid(),type:await O.type()}:void 0;case"true-true":{if(O&&R&&A&&await O.type()==="blob"&&await R.type()==="blob"&&await A.type()==="blob")return Gg({fs:e,gitdir:n,path:D,ours:O,base:R,theirs:A,ourName:l,baseName:c,theirName:u,mergeDriver:m}).then(async U=>{if(U.cleanMerge)p||i.insert({filepath:C,oid:U.mergeResult.oid,stage:0});else if(b.push(C),_.push(C),!p){const Z=await R.oid(),de=await O.oid(),$e=await A.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:Z,stage:1}),i.insert({filepath:C,oid:de,stage:2}),i.insert({filepath:C,oid:$e,stage:3})}return U.mergeResult});if(R&&!O&&A&&await R.type()==="blob"&&await A.type()==="blob"){if(b.push(C),k.push(C),!p){const U=await R.oid(),Z=await A.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:U,stage:1}),i.insert({filepath:C,oid:Z,stage:3})}return{mode:await A.mode(),oid:await A.oid(),type:"blob",path:D}}if(R&&O&&!A&&await R.type()==="blob"&&await O.type()==="blob"){if(b.push(C),S.push(C),!p){const U=await R.oid(),Z=await O.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:U,stage:1}),i.insert({filepath:C,oid:Z,stage:2})}return{mode:await O.mode(),oid:await O.oid(),type:"blob",path:D}}if(R&&!O&&!A&&await R.type()==="blob")return;throw new cn}}},reduce:b.length!==0&&(!r||p)?void 0:async(C,O)=>{const R=O.filter(Boolean);if(C&&!(C&&C.type==="tree"&&R.length===0)){if(R.length>0){const D=new st(R).toObject(),j=await lt({fs:e,gitdir:n,type:"tree",object:D,dryRun:d});C.oid=j}return C}}});return b.length!==0?(r&&!p&&await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[xt({ref:y.oid})],map:async function(C,[O]){const R=`${r}/${C}`;if(await O.type()==="blob"){const A=await O.mode(),D=new TextDecoder().decode(await O.content());await e.write(R,D,{mode:A})}return!0}}),new ln(b,_,k,S)):y.oid}async function Gg({fs:e,gitdir:t,path:r,ours:n,base:i,theirs:a,ourName:o,theirName:s,baseName:l,dryRun:c,mergeDriver:u=Wg}){const d="blob",p=await i.mode()===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:p,path:r,oid:await n.oid(),type:d}};if(await n.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:p,path:r,oid:await a.oid(),type:d}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:p,path:r,oid:await n.oid(),type:d}};const m=Buffer.from(await n.content()).toString("utf8"),g=Buffer.from(await i.content()).toString("utf8"),v=Buffer.from(await a.content()).toString("utf8"),{mergedText:x,cleanMerge:b}=await u({branches:[l,o,s],contents:[g,m,v],path:r}),_=await lt({fs:e,gitdir:t,type:"blob",object:Buffer.from(x,"utf8"),dryRun:c});return{cleanMerge:b,mergeResult:{mode:p,path:r,oid:_,type:d}}}async function of({fs:e,cache:t,dir:r,gitdir:n,ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:d,author:p,committer:m,signingKey:g,onSign:v,mergeDriver:x}){i===void 0&&(i=await mr({fs:e,gitdir:n,fullname:!0})),i=await H.expand({fs:e,gitdir:n,ref:i}),a=await H.expand({fs:e,gitdir:n,ref:a});const b=await H.resolve({fs:e,gitdir:n,ref:i}),_=await H.resolve({fs:e,gitdir:n,ref:a}),k=await rs({fs:e,cache:t,gitdir:n,oids:[b,_]});if(k.length!==1)throw new cn;const S=k[0];if(S===_)return{oid:b,alreadyMerged:!0};if(o&&S===b)return!l&&!c&&await H.writeRef({fs:e,gitdir:n,ref:i,value:_}),{oid:_,fastForward:!0};{if(s)throw new ti;const y=await He.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async O=>qg({fs:e,cache:t,dir:r,gitdir:n,index:O,ourOid:b,theirOid:_,baseOid:S,ourName:$r(i),baseName:"base",theirName:$r(a),dryRun:l,abortOnConflict:u,mergeDriver:x}));if(y instanceof ln)throw y;return d||(d=`Merge branch '${$r(a)}' into ${$r(i)}`),{oid:await ia({fs:e,cache:t,gitdir:n,message:d,ref:i,tree:y,parent:[b,_],author:p,committer:m,signingKey:g,onSign:v,dryRun:l,noUpdateBranch:c}),tree:y,mergeCommit:!0}}}async function sf({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,dir:l,gitdir:c,ref:u,url:d,remote:p,remoteRef:m,prune:g,pruneTags:v,fastForward:x,fastForwardOnly:b,corsProxy:_,singleBranch:k,headers:S,author:y,committer:C,signingKey:O}){try{if(!u){const D=await mr({fs:e,gitdir:c});if(!D)throw new ct("ref");u=D}const{fetchHead:R,fetchHeadDescription:A}=await ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:c,corsProxy:_,ref:u,url:d,remote:p,remoteRef:m,singleBranch:k,headers:S,prune:g,pruneTags:v});await of({fs:e,cache:t,gitdir:c,ours:u,theirs:R,fastForward:x,fastForwardOnly:b,message:`Merge ${A}`,author:y,committer:C,signingKey:O,dryRun:!1,noUpdateBranch:!1}),await Ko({fs:e,cache:t,onProgress:n,dir:l,gitdir:c,ref:u,remote:p,noCheckout:!1})}catch(R){throw R.caller="git.pull",R}}async function Yg({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l=N.join(s,".git"),ref:c,url:u,remote:d,remoteRef:p,corsProxy:m,singleBranch:g,headers:v={},cache:x={}}){try{P("fs",e),P("http",t),P("gitdir",l);const b={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await sf({fs:new K(e),cache:x,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l,ref:c,url:u,remote:d,remoteRef:p,fastForwardOnly:!0,corsProxy:m,singleBranch:g,headers:v,author:b,committer:b})}catch(b){throw b.caller="git.fastForward",b}}async function Zg({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l=N.join(s,".git"),ref:c,remote:u,remoteRef:d,url:p,corsProxy:m,depth:g=null,since:v=null,exclude:x=[],relative:b=!1,tags:_=!1,singleBranch:k=!1,headers:S={},prune:y=!1,pruneTags:C=!1,cache:O={}}){try{return P("fs",e),P("http",t),P("gitdir",l),await ts({fs:new K(e),cache:O,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remote:u,remoteRef:d,url:p,corsProxy:m,depth:g,since:v,exclude:x,relative:b,tags:_,singleBranch:k,headers:S,prune:y,pruneTags:C})}catch(R){throw R.caller="git.fetch",R}}async function Xg({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oids",n),await rs({fs:new K(e),cache:i,gitdir:r,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function cf({fs:e,filepath:t}){if(await e.exists(N.join(t,".git")))return t;{const r=rn(t);if(r===t)throw new Oe(`git root for ${t}`);return cf({fs:e,filepath:r})}}async function Vg({fs:e,filepath:t}){try{return P("fs",e),P("filepath",t),await cf({fs:new K(e),filepath:t})}catch(r){throw r.caller="git.findRoot",r}}async function Kg({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return P("fs",e),P("gitdir",r),P("path",n),await fi({fs:new K(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function Jg({fs:e,gitdir:t,path:r}){return(await Me.get({fs:e,gitdir:t})).getall(r)}async function Qg({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return P("fs",e),P("gitdir",r),P("path",n),await Jg({fs:new K(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function ey({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1}){try{P("http",e),P("url",a);const c=await sa.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,headers:o,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(const[d,p]of c.refs){const m=d.split("/"),g=m.pop();let v=u;for(const x of m)v[x]=v[x]||{},v=v[x];v[g]=p}for(const[d,p]of c.symrefs){const m=d.split("/"),g=m.pop();let v=u;for(const x of m)v[x]=v[x]||{},v=v[x];v[g]=p}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function lf(e,t,r,n){const i=[];for(const[a,o]of e.refs){if(t&&!a.startsWith(t))continue;if(a.endsWith("^{}")){if(n){const l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(d=>d.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=o}continue}const s={ref:a,oid:o};r&&e.symrefs.has(a)&&(s.target=e.symrefs.get(a)),i.push(s)}return i}async function ty({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:l=2}){try{P("http",e),P("url",a);const u=await sa.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,headers:o,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};const d={};for(const p of u.capabilities){const[m,g]=p.split("=");g?d[m]=g:d[m]=!0}return{protocolVersion:1,capabilities:d,refs:lf(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function ry({type:e,object:t,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(t=an.wrap({type:e,object:t})),n=await Vt(t)),{oid:n,object:t}}async function ny({object:e}){try{P("object",e),typeof e=="string"?e=Buffer.from(e,"utf8"):e=Buffer.from(e);const t="blob",{oid:r,object:n}=await ry({type:"blob",format:"content",object:e});return{oid:r,type:t,object:new Uint8Array(n),format:"wrapped"}}catch(t){throw t.caller="git.hashBlob",t}}async function iy({fs:e,cache:t,onProgress:r,dir:n,gitdir:i,filepath:a}){try{a=N.join(n,a);const o=await e.read(a),s=c=>Ae({fs:e,cache:t,gitdir:i,oid:c}),l=await on.fromPack({pack:o,getExternalRefDelta:s,onProgress:r});return await e.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(o){throw o.caller="git.indexPack",o}}async function ay({fs:e,onProgress:t,dir:r,gitdir:n=N.join(r,".git"),filepath:i,cache:a={}}){try{return P("fs",e),P("dir",r),P("gitdir",r),P("filepath",i),await iy({fs:new K(e),cache:a,onProgress:t,dir:r,gitdir:n,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function oy({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:N.join(r,".git"),defaultBranch:i="master"}){try{return P("fs",e),P("gitdir",n),t||P("dir",r),await af({fs:new K(e),bare:t,dir:r,gitdir:n,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function uf({fs:e,cache:t,gitdir:r,oid:n,ancestor:i,depth:a}){const o=await mi.read({fs:e,gitdir:r});if(!n)throw new ct("oid");if(!i)throw new ct("ancestor");if(n===i)return!1;const s=[n],l=new Set;let c=0;for(;s.length;){if(c++===a)throw new ni(a);const u=s.shift(),{type:d,object:p}=await Ae({fs:e,cache:t,gitdir:r,oid:u});if(d!=="commit")throw new rt(u,d,"commit");const m=De.from(p).parse();for(const g of m.parent)if(g===i)return!0;if(!o.has(u))for(const g of m.parent)l.has(g)||(s.push(g),l.add(g))}return!1}async function sy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,ancestor:i,depth:a=-1,cache:o={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),P("ancestor",i),await uf({fs:new K(e),cache:o,gitdir:r,oid:n,ancestor:i,depth:a})}catch(s){throw s.caller="git.isDescendent",s}}async function cy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return P("fs",e),P("dir",t),P("gitdir",r),P("filepath",n),hn.isIgnored({fs:new K(e),dir:t,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function ly({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return P("fs",e),P("gitdir",r),H.listBranches({fs:new K(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function uy({fs:e,gitdir:t,ref:r,cache:n}){if(r){const i=await H.resolve({gitdir:t,fs:e,ref:r}),a=[];return await ff({fs:e,cache:n,gitdir:t,oid:i,filenames:a,prefix:""}),a}else return He.acquire({fs:e,gitdir:t,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function ff({fs:e,cache:t,gitdir:r,oid:n,filenames:i,prefix:a}){const{tree:o}=await wn({fs:e,cache:t,gitdir:r,oid:n});for(const s of o)s.type==="tree"?await ff({fs:e,cache:t,gitdir:r,oid:s.oid,filenames:i,prefix:N.join(a,s.path)}):i.push(N.join(a,s.path))}async function fy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),await uy({fs:new K(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function dy({fs:e,cache:t,gitdir:r,ref:n}){let i;try{i=await H.resolve({gitdir:r,fs:e,ref:n})}catch(s){if(s instanceof Oe)return[]}return(await wn({fs:e,cache:t,gitdir:r,oid:i})).tree.map(s=>({target:s.path,note:s.oid}))}async function hy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return P("fs",e),P("gitdir",r),P("ref",n),await dy({fs:new K(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function py({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return P("fs",e),P("gitdir",r),H.listRefs({fs:new K(e),gitdir:r,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function my({fs:e,gitdir:t}){const r=await Me.get({fs:e,gitdir:t}),n=await r.getSubsections("remote");return Promise.all(n.map(async a=>{const o=await r.get(`remote.${a}.url`);return{remote:a,url:o}}))}async function wy({fs:e,dir:t,gitdir:r=N.join(t,".git")}){try{return P("fs",e),P("gitdir",r),await my({fs:new K(e),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function gy(e){const t=Le.streamReader(e),r=[];let n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");const[i,a,...o]=n.split(" "),s={ref:a,oid:i};for(const l of o){const[c,u]=l.split(":");c==="symref-target"?s.target=u:c==="peeled"&&(s.peeled=u)}r.push(s)}return r}async function yy({prefix:e,symrefs:t,peelTags:r}){const n=[];return n.push(Le.encode(`command=ls-refs
88
+ `);return{cleanMerge:m,mergedText:p}}async function qg({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),index:i,ourOid:a,baseOid:o,theirOid:s,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:d=!1,abortOnConflict:p=!0,mergeDriver:m}){const g=xt({ref:a}),b=xt({ref:o}),v=xt({ref:s}),y=[],_=[],R=[],C=[],x=await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[g,b,v],map:async function(O,[k,S,A]){const D=Vi(O),B=await na(k,S),M=await na(A,S);switch(`${B}-${M}`){case"false-false":return{mode:await S.mode(),path:D,oid:await S.oid(),type:await S.type()};case"false-true":return A?{mode:await A.mode(),path:D,oid:await A.oid(),type:await A.type()}:void 0;case"true-false":return k?{mode:await k.mode(),path:D,oid:await k.oid(),type:await k.type()}:void 0;case"true-true":{if(k&&S&&A&&await k.type()==="blob"&&await S.type()==="blob"&&await A.type()==="blob")return Gg({fs:e,gitdir:n,path:D,ours:k,base:S,theirs:A,ourName:l,baseName:c,theirName:u,mergeDriver:m}).then(async U=>{if(U.cleanMerge)p||i.insert({filepath:O,oid:U.mergeResult.oid,stage:0});else if(y.push(O),_.push(O),!p){const Z=await S.oid(),de=await k.oid(),$e=await A.oid();i.delete({filepath:O}),i.insert({filepath:O,oid:Z,stage:1}),i.insert({filepath:O,oid:de,stage:2}),i.insert({filepath:O,oid:$e,stage:3})}return U.mergeResult});if(S&&!k&&A&&await S.type()==="blob"&&await A.type()==="blob"){if(y.push(O),R.push(O),!p){const U=await S.oid(),Z=await A.oid();i.delete({filepath:O}),i.insert({filepath:O,oid:U,stage:1}),i.insert({filepath:O,oid:Z,stage:3})}return{mode:await A.mode(),oid:await A.oid(),type:"blob",path:D}}if(S&&k&&!A&&await S.type()==="blob"&&await k.type()==="blob"){if(y.push(O),C.push(O),!p){const U=await S.oid(),Z=await k.oid();i.delete({filepath:O}),i.insert({filepath:O,oid:U,stage:1}),i.insert({filepath:O,oid:Z,stage:2})}return{mode:await k.mode(),oid:await k.oid(),type:"blob",path:D}}if(S&&!k&&!A&&await S.type()==="blob")return;throw new cn}}},reduce:y.length!==0&&(!r||p)?void 0:async(O,k)=>{const S=k.filter(Boolean);if(O&&!(O&&O.type==="tree"&&S.length===0)){if(S.length>0){const D=new ct(S).toObject(),B=await ut({fs:e,gitdir:n,type:"tree",object:D,dryRun:d});O.oid=B}return O}}});return y.length!==0?(r&&!p&&await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[xt({ref:x.oid})],map:async function(O,[k]){const S=`${r}/${O}`;if(await k.type()==="blob"){const A=await k.mode(),D=new TextDecoder().decode(await k.content());await e.write(S,D,{mode:A})}return!0}}),new ln(y,_,R,C)):x.oid}async function Gg({fs:e,gitdir:t,path:r,ours:n,base:i,theirs:a,ourName:o,theirName:s,baseName:l,dryRun:c,mergeDriver:u=Wg}){const d="blob",p=await i.mode()===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:p,path:r,oid:await n.oid(),type:d}};if(await n.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:p,path:r,oid:await a.oid(),type:d}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:p,path:r,oid:await n.oid(),type:d}};const m=Buffer.from(await n.content()).toString("utf8"),g=Buffer.from(await i.content()).toString("utf8"),b=Buffer.from(await a.content()).toString("utf8"),{mergedText:v,cleanMerge:y}=await u({branches:[l,o,s],contents:[g,m,b],path:r}),_=await ut({fs:e,gitdir:t,type:"blob",object:Buffer.from(v,"utf8"),dryRun:c});return{cleanMerge:y,mergeResult:{mode:p,path:r,oid:_,type:d}}}async function sf({fs:e,cache:t,dir:r,gitdir:n,ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:d,author:p,committer:m,signingKey:g,onSign:b,mergeDriver:v}){i===void 0&&(i=await mr({fs:e,gitdir:n,fullname:!0})),i=await H.expand({fs:e,gitdir:n,ref:i}),a=await H.expand({fs:e,gitdir:n,ref:a});const y=await H.resolve({fs:e,gitdir:n,ref:i}),_=await H.resolve({fs:e,gitdir:n,ref:a}),R=await rs({fs:e,cache:t,gitdir:n,oids:[y,_]});if(R.length!==1)throw new cn;const C=R[0];if(C===_)return{oid:y,alreadyMerged:!0};if(o&&C===y)return!l&&!c&&await H.writeRef({fs:e,gitdir:n,ref:i,value:_}),{oid:_,fastForward:!0};{if(s)throw new ti;const x=await He.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async k=>qg({fs:e,cache:t,dir:r,gitdir:n,index:k,ourOid:y,theirOid:_,baseOid:C,ourName:$r(i),baseName:"base",theirName:$r(a),dryRun:l,abortOnConflict:u,mergeDriver:v}));if(x instanceof ln)throw x;return d||(d=`Merge branch '${$r(a)}' into ${$r(i)}`),{oid:await ia({fs:e,cache:t,gitdir:n,message:d,ref:i,tree:x,parent:[y,_],author:p,committer:m,signingKey:g,onSign:b,dryRun:l,noUpdateBranch:c}),tree:x,mergeCommit:!0}}}async function cf({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,dir:l,gitdir:c,ref:u,url:d,remote:p,remoteRef:m,prune:g,pruneTags:b,fastForward:v,fastForwardOnly:y,corsProxy:_,singleBranch:R,headers:C,author:x,committer:O,signingKey:k}){try{if(!u){const D=await mr({fs:e,gitdir:c});if(!D)throw new lt("ref");u=D}const{fetchHead:S,fetchHeadDescription:A}=await ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:c,corsProxy:_,ref:u,url:d,remote:p,remoteRef:m,singleBranch:R,headers:C,prune:g,pruneTags:b});await sf({fs:e,cache:t,gitdir:c,ours:u,theirs:S,fastForward:v,fastForwardOnly:y,message:`Merge ${A}`,author:x,committer:O,signingKey:k,dryRun:!1,noUpdateBranch:!1}),await Ko({fs:e,cache:t,onProgress:n,dir:l,gitdir:c,ref:u,remote:p,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function Yg({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l=N.join(s,".git"),ref:c,url:u,remote:d,remoteRef:p,corsProxy:m,singleBranch:g,headers:b={},cache:v={}}){try{P("fs",e),P("http",t),P("gitdir",l);const y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await cf({fs:new K(e),cache:v,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l,ref:c,url:u,remote:d,remoteRef:p,fastForwardOnly:!0,corsProxy:m,singleBranch:g,headers:b,author:y,committer:y})}catch(y){throw y.caller="git.fastForward",y}}async function Zg({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l=N.join(s,".git"),ref:c,remote:u,remoteRef:d,url:p,corsProxy:m,depth:g=null,since:b=null,exclude:v=[],relative:y=!1,tags:_=!1,singleBranch:R=!1,headers:C={},prune:x=!1,pruneTags:O=!1,cache:k={}}){try{return P("fs",e),P("http",t),P("gitdir",l),await ts({fs:new K(e),cache:k,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remote:u,remoteRef:d,url:p,corsProxy:m,depth:g,since:b,exclude:v,relative:y,tags:_,singleBranch:R,headers:C,prune:x,pruneTags:O})}catch(S){throw S.caller="git.fetch",S}}async function Xg({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oids",n),await rs({fs:new K(e),cache:i,gitdir:r,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function lf({fs:e,filepath:t}){if(await e.exists(N.join(t,".git")))return t;{const r=rn(t);if(r===t)throw new Oe(`git root for ${t}`);return lf({fs:e,filepath:r})}}async function Vg({fs:e,filepath:t}){try{return P("fs",e),P("filepath",t),await lf({fs:new K(e),filepath:t})}catch(r){throw r.caller="git.findRoot",r}}async function Kg({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return P("fs",e),P("gitdir",r),P("path",n),await fi({fs:new K(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function Jg({fs:e,gitdir:t,path:r}){return(await Me.get({fs:e,gitdir:t})).getall(r)}async function Qg({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return P("fs",e),P("gitdir",r),P("path",n),await Jg({fs:new K(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function ey({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1}){try{P("http",e),P("url",a);const c=await sa.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,headers:o,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(const[d,p]of c.refs){const m=d.split("/"),g=m.pop();let b=u;for(const v of m)b[v]=b[v]||{},b=b[v];b[g]=p}for(const[d,p]of c.symrefs){const m=d.split("/"),g=m.pop();let b=u;for(const v of m)b[v]=b[v]||{},b=b[v];b[g]=p}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function uf(e,t,r,n){const i=[];for(const[a,o]of e.refs){if(t&&!a.startsWith(t))continue;if(a.endsWith("^{}")){if(n){const l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(d=>d.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=o}continue}const s={ref:a,oid:o};r&&e.symrefs.has(a)&&(s.target=e.symrefs.get(a)),i.push(s)}return i}async function ty({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:l=2}){try{P("http",e),P("url",a);const u=await sa.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,headers:o,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};const d={};for(const p of u.capabilities){const[m,g]=p.split("=");g?d[m]=g:d[m]=!0}return{protocolVersion:1,capabilities:d,refs:uf(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function ry({type:e,object:t,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(t=an.wrap({type:e,object:t})),n=await Vt(t)),{oid:n,object:t}}async function ny({object:e}){try{P("object",e),typeof e=="string"?e=Buffer.from(e,"utf8"):e=Buffer.from(e);const t="blob",{oid:r,object:n}=await ry({type:"blob",format:"content",object:e});return{oid:r,type:t,object:new Uint8Array(n),format:"wrapped"}}catch(t){throw t.caller="git.hashBlob",t}}async function iy({fs:e,cache:t,onProgress:r,dir:n,gitdir:i,filepath:a}){try{a=N.join(n,a);const o=await e.read(a),s=c=>Ae({fs:e,cache:t,gitdir:i,oid:c}),l=await on.fromPack({pack:o,getExternalRefDelta:s,onProgress:r});return await e.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(o){throw o.caller="git.indexPack",o}}async function ay({fs:e,onProgress:t,dir:r,gitdir:n=N.join(r,".git"),filepath:i,cache:a={}}){try{return P("fs",e),P("dir",r),P("gitdir",r),P("filepath",i),await iy({fs:new K(e),cache:a,onProgress:t,dir:r,gitdir:n,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function oy({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:N.join(r,".git"),defaultBranch:i="master"}){try{return P("fs",e),P("gitdir",n),t||P("dir",r),await of({fs:new K(e),bare:t,dir:r,gitdir:n,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function ff({fs:e,cache:t,gitdir:r,oid:n,ancestor:i,depth:a}){const o=await mi.read({fs:e,gitdir:r});if(!n)throw new lt("oid");if(!i)throw new lt("ancestor");if(n===i)return!1;const s=[n],l=new Set;let c=0;for(;s.length;){if(c++===a)throw new ni(a);const u=s.shift(),{type:d,object:p}=await Ae({fs:e,cache:t,gitdir:r,oid:u});if(d!=="commit")throw new rt(u,d,"commit");const m=De.from(p).parse();for(const g of m.parent)if(g===i)return!0;if(!o.has(u))for(const g of m.parent)l.has(g)||(s.push(g),l.add(g))}return!1}async function sy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,ancestor:i,depth:a=-1,cache:o={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),P("ancestor",i),await ff({fs:new K(e),cache:o,gitdir:r,oid:n,ancestor:i,depth:a})}catch(s){throw s.caller="git.isDescendent",s}}async function cy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return P("fs",e),P("dir",t),P("gitdir",r),P("filepath",n),hn.isIgnored({fs:new K(e),dir:t,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function ly({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return P("fs",e),P("gitdir",r),H.listBranches({fs:new K(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function uy({fs:e,gitdir:t,ref:r,cache:n}){if(r){const i=await H.resolve({gitdir:t,fs:e,ref:r}),a=[];return await df({fs:e,cache:n,gitdir:t,oid:i,filenames:a,prefix:""}),a}else return He.acquire({fs:e,gitdir:t,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function df({fs:e,cache:t,gitdir:r,oid:n,filenames:i,prefix:a}){const{tree:o}=await wn({fs:e,cache:t,gitdir:r,oid:n});for(const s of o)s.type==="tree"?await df({fs:e,cache:t,gitdir:r,oid:s.oid,filenames:i,prefix:N.join(a,s.path)}):i.push(N.join(a,s.path))}async function fy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),await uy({fs:new K(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function dy({fs:e,cache:t,gitdir:r,ref:n}){let i;try{i=await H.resolve({gitdir:r,fs:e,ref:n})}catch(s){if(s instanceof Oe)return[]}return(await wn({fs:e,cache:t,gitdir:r,oid:i})).tree.map(s=>({target:s.path,note:s.oid}))}async function hy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return P("fs",e),P("gitdir",r),P("ref",n),await dy({fs:new K(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function py({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return P("fs",e),P("gitdir",r),H.listRefs({fs:new K(e),gitdir:r,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function my({fs:e,gitdir:t}){const r=await Me.get({fs:e,gitdir:t}),n=await r.getSubsections("remote");return Promise.all(n.map(async a=>{const o=await r.get(`remote.${a}.url`);return{remote:a,url:o}}))}async function wy({fs:e,dir:t,gitdir:r=N.join(t,".git")}){try{return P("fs",e),P("gitdir",r),await my({fs:new K(e),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function gy(e){const t=Le.streamReader(e),r=[];let n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");const[i,a,...o]=n.split(" "),s={ref:a,oid:i};for(const l of o){const[c,u]=l.split(":");c==="symref-target"?s.target=u:c==="peeled"&&(s.peeled=u)}r.push(s)}return r}async function yy({prefix:e,symrefs:t,peelTags:r}){const n=[];return n.push(Le.encode(`command=ls-refs
89
89
  `)),n.push(Le.encode(`agent=${ca.agent}
90
- `)),(r||t||e)&&n.push(Le.delim()),r&&n.push(Le.encode("peel")),t&&n.push(Le.encode("symrefs")),e&&n.push(Le.encode(`ref-prefix ${e}`)),n.push(Le.flush()),n}async function by({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:d}){try{P("http",e),P("url",a);const p=await oa.discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,headers:o,protocolVersion:l});if(p.protocolVersion===1)return lf(p,c,u,d);const m=await yy({prefix:c,symrefs:u,peelTags:d}),g=await oa.connect({http:e,auth:p.auth,headers:o,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,body:m});return gy(g.body)}catch(p){throw p.caller="git.listServerRefs",p}}async function vy({fs:e,dir:t,gitdir:r=N.join(t,".git")}){try{return P("fs",e),P("gitdir",r),H.listTags({fs:new K(e),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function _y(e,t){return e.committer.timestamp-t.committer.timestamp}const xy="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function df({fs:e,cache:t,gitdir:r,oid:n,fileId:i}){if(i===xy)return;const a=n;let o;const s=await dn({fs:e,cache:t,gitdir:r,oid:n}),l=s.tree;return i===s.oid?o=s.path:(o=await hf({fs:e,cache:t,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function hf({fs:e,cache:t,gitdir:r,tree:n,fileId:i,oid:a,filepaths:o=[],parentPath:s=""}){const l=n.entries().map(function(c){let u;return c.oid===i?(u=N.join(s,c.path),o.push(u)):c.type==="tree"&&(u=Ae({fs:e,cache:t,gitdir:r,oid:c.oid}).then(function({object:d}){return hf({fs:e,cache:t,gitdir:r,tree:st.from(d),fileId:i,oid:a,filepaths:o,parentPath:N.join(s,c.path)})})),u});return await Promise.all(l),o}async function Ey({fs:e,cache:t,gitdir:r,filepath:n,ref:i,depth:a,since:o,force:s,follow:l}){const c=typeof o>"u"?void 0:Math.floor(o.valueOf()/1e3),u=[],d=await mi.read({fs:e,gitdir:r}),p=await H.resolve({fs:e,gitdir:r,ref:i}),m=[await mn({fs:e,cache:t,gitdir:r,oid:p})];let g,v,x;function b(_){x&&n&&u.push(_)}for(;m.length>0;){const _=m.pop();if(c!==void 0&&_.commit.committer.timestamp<=c)break;if(n){let k;try{k=await di({fs:e,cache:t,gitdir:r,oid:_.commit.tree,filepath:n}),v&&g!==k&&u.push(v),g=k,v=_,x=!0}catch(S){if(S instanceof Oe){let y=l&&g;if(y&&(y=await df({fs:e,cache:t,gitdir:r,oid:_.commit.tree,fileId:g}),y))if(Array.isArray(y)){if(v){const C=await df({fs:e,cache:t,gitdir:r,oid:v.commit.tree,fileId:g});if(Array.isArray(C))if(y=y.filter(O=>C.indexOf(O)===-1),y.length===1)y=y[0],n=y,v&&u.push(v);else{y=!1,v&&u.push(v);break}}}else n=y,v&&u.push(v);if(!y){if(x&&g&&(u.push(v),!s))break;if(!s&&!l)throw S}v=_,x=!1}else throw S}}else u.push(_);if(a!==void 0&&u.length===a){b(_);break}if(!d.has(_.oid))for(const k of _.commit.parent){const S=await mn({fs:e,cache:t,gitdir:r,oid:k});m.map(y=>y.oid).includes(S.oid)||m.push(S)}m.length===0&&b(_),m.sort((k,S)=>_y(k.commit,S.commit))}return u}async function Sy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,ref:i="HEAD",depth:a,since:o,force:s,follow:l,cache:c={}}){try{return P("fs",e),P("gitdir",r),P("ref",i),await Ey({fs:new K(e),cache:c,gitdir:r,filepath:n,ref:i,depth:a,since:o,force:s,follow:l})}catch(u){throw u.caller="git.log",u}}async function ky({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:d,author:p,committer:m,signingKey:g,cache:v={},mergeDriver:x}){try{P("fs",e),g&&P("onSign",t);const b=new K(e),_=await pr({fs:b,gitdir:n,author:p});if(!_&&(!s||!o))throw new Xe("author");const k=await pn({fs:b,gitdir:n,author:_,committer:m});if(!k&&(!s||!o))throw new Xe("committer");return await of({fs:b,cache:v,dir:r,gitdir:n,ours:i,theirs:a,fastForward:o,fastForwardOnly:s,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:d,author:_,committer:k,signingKey:g,onSign:t,mergeDriver:x})}catch(b){throw b.caller="git.merge",b}}const Ry={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function pf({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),oids:i}){const a=new Pc,o=[];function s(u,d){const p=Buffer.from(u,d);o.push(p),a.update(p)}async function l({stype:u,object:d}){const p=Ry[u];let m=d.length,g=m>15?128:0;const v=m&15;m=m>>>4;let x=(g|p|v).toString(16);for(s(x,"hex");g;)g=m>127?128:0,x=g|m&127,s(Jo(2,x),"hex"),m=m>>>7;s(Buffer.from(await Mu(d)))}s("PACK"),s("00000002","hex"),s(Jo(8,i.length),"hex");for(const u of i){const{type:d,object:p}=await Ae({fs:e,cache:t,gitdir:n,oid:u});await l({write:s,object:p,stype:d})}const c=a.digest();return o.push(c),o}async function Oy({fs:e,cache:t,gitdir:r,oids:n,write:i}){const a=await pf({fs:e,cache:t,gitdir:r,oids:n}),o=Buffer.from(await aa(a)),l=`pack-${o.slice(-20).toString("hex")}.pack`;return i?(await e.write(N.join(r,`objects/pack/${l}`),o),{filename:l}):{filename:l,packfile:new Uint8Array(o)}}async function Cy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,write:i=!1,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("oids",n),await Oy({fs:new K(e),cache:a,gitdir:r,oids:n,write:i})}catch(o){throw o.caller="git.packObjects",o}}async function Py({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l=N.join(s,".git"),ref:c,url:u,remote:d,remoteRef:p,prune:m=!1,pruneTags:g=!1,fastForward:v=!0,fastForwardOnly:x=!1,corsProxy:b,singleBranch:_,headers:k={},author:S,committer:y,signingKey:C,cache:O={}}){try{P("fs",e),P("gitdir",l);const R=new K(e),A=await pr({fs:R,gitdir:l,author:S});if(!A)throw new Xe("author");const D=await pn({fs:R,gitdir:l,author:A,committer:y});if(!D)throw new Xe("committer");return await sf({fs:R,cache:O,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l,ref:c,url:u,remote:d,remoteRef:p,fastForward:v,fastForwardOnly:x,corsProxy:b,singleBranch:_,headers:k,author:A,committer:D,signingKey:C,prune:m,pruneTags:g})}catch(R){throw R.caller="git.pull",R}}async function Ty({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),start:i,finish:a}){const o=await mi.read({fs:e,gitdir:n}),s=new Set,l=new Set;for(const d of i)s.add(await H.resolve({fs:e,gitdir:n,ref:d}));for(const d of a)try{const p=await H.resolve({fs:e,gitdir:n,ref:d});l.add(p)}catch{}const c=new Set;async function u(d){c.add(d);const{type:p,object:m}=await Ae({fs:e,cache:t,gitdir:n,oid:d});if(p==="tag"){const v=nt.from(m).headers().object;return u(v)}if(p!=="commit")throw new rt(d,p,"commit");if(!o.has(d)){const v=De.from(m).headers().parent;for(d of v)!l.has(d)&&!c.has(d)&&await u(d)}}for(const d of s)await u(d);return c}async function is({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),oids:i}){const a=new Set;async function o(s){if(a.has(s))return;a.add(s);const{type:l,object:c}=await Ae({fs:e,cache:t,gitdir:n,oid:s});if(l==="tag"){const d=nt.from(c).headers().object;await o(d)}else if(l==="commit"){const d=De.from(c).headers().tree;await o(d)}else if(l==="tree"){const u=st.from(c);for(const d of u)d.type==="blob"&&a.add(d.oid),d.type==="tree"&&await o(d.oid)}}for(const s of i)await o(s);return a}async function Ay(e){const t={};let r="";const n=Le.streamReader(e);let i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+`
90
+ `)),(r||t||e)&&n.push(Le.delim()),r&&n.push(Le.encode("peel")),t&&n.push(Le.encode("symrefs")),e&&n.push(Le.encode(`ref-prefix ${e}`)),n.push(Le.flush()),n}async function by({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:d}){try{P("http",e),P("url",a);const p=await oa.discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,headers:o,protocolVersion:l});if(p.protocolVersion===1)return uf(p,c,u,d);const m=await yy({prefix:c,symrefs:u,peelTags:d}),g=await oa.connect({http:e,auth:p.auth,headers:o,corsProxy:i,service:s?"git-receive-pack":"git-upload-pack",url:a,body:m});return gy(g.body)}catch(p){throw p.caller="git.listServerRefs",p}}async function _y({fs:e,dir:t,gitdir:r=N.join(t,".git")}){try{return P("fs",e),P("gitdir",r),H.listTags({fs:new K(e),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function vy(e,t){return e.committer.timestamp-t.committer.timestamp}const xy="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function hf({fs:e,cache:t,gitdir:r,oid:n,fileId:i}){if(i===xy)return;const a=n;let o;const s=await dn({fs:e,cache:t,gitdir:r,oid:n}),l=s.tree;return i===s.oid?o=s.path:(o=await pf({fs:e,cache:t,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function pf({fs:e,cache:t,gitdir:r,tree:n,fileId:i,oid:a,filepaths:o=[],parentPath:s=""}){const l=n.entries().map(function(c){let u;return c.oid===i?(u=N.join(s,c.path),o.push(u)):c.type==="tree"&&(u=Ae({fs:e,cache:t,gitdir:r,oid:c.oid}).then(function({object:d}){return pf({fs:e,cache:t,gitdir:r,tree:ct.from(d),fileId:i,oid:a,filepaths:o,parentPath:N.join(s,c.path)})})),u});return await Promise.all(l),o}async function Ey({fs:e,cache:t,gitdir:r,filepath:n,ref:i,depth:a,since:o,force:s,follow:l}){const c=typeof o>"u"?void 0:Math.floor(o.valueOf()/1e3),u=[],d=await mi.read({fs:e,gitdir:r}),p=await H.resolve({fs:e,gitdir:r,ref:i}),m=[await mn({fs:e,cache:t,gitdir:r,oid:p})];let g,b,v;function y(_){v&&n&&u.push(_)}for(;m.length>0;){const _=m.pop();if(c!==void 0&&_.commit.committer.timestamp<=c)break;if(n){let R;try{R=await di({fs:e,cache:t,gitdir:r,oid:_.commit.tree,filepath:n}),b&&g!==R&&u.push(b),g=R,b=_,v=!0}catch(C){if(C instanceof Oe){let x=l&&g;if(x&&(x=await hf({fs:e,cache:t,gitdir:r,oid:_.commit.tree,fileId:g}),x))if(Array.isArray(x)){if(b){const O=await hf({fs:e,cache:t,gitdir:r,oid:b.commit.tree,fileId:g});if(Array.isArray(O))if(x=x.filter(k=>O.indexOf(k)===-1),x.length===1)x=x[0],n=x,b&&u.push(b);else{x=!1,b&&u.push(b);break}}}else n=x,b&&u.push(b);if(!x){if(v&&g&&(u.push(b),!s))break;if(!s&&!l)throw C}b=_,v=!1}else throw C}}else u.push(_);if(a!==void 0&&u.length===a){y(_);break}if(!d.has(_.oid))for(const R of _.commit.parent){const C=await mn({fs:e,cache:t,gitdir:r,oid:R});m.map(x=>x.oid).includes(C.oid)||m.push(C)}m.length===0&&y(_),m.sort((R,C)=>vy(R.commit,C.commit))}return u}async function Sy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,ref:i="HEAD",depth:a,since:o,force:s,follow:l,cache:c={}}){try{return P("fs",e),P("gitdir",r),P("ref",i),await Ey({fs:new K(e),cache:c,gitdir:r,filepath:n,ref:i,depth:a,since:o,force:s,follow:l})}catch(u){throw u.caller="git.log",u}}async function ky({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:d,author:p,committer:m,signingKey:g,cache:b={},mergeDriver:v}){try{P("fs",e),g&&P("onSign",t);const y=new K(e),_=await pr({fs:y,gitdir:n,author:p});if(!_&&(!s||!o))throw new Xe("author");const R=await pn({fs:y,gitdir:n,author:_,committer:m});if(!R&&(!s||!o))throw new Xe("committer");return await sf({fs:y,cache:b,dir:r,gitdir:n,ours:i,theirs:a,fastForward:o,fastForwardOnly:s,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:d,author:_,committer:R,signingKey:g,onSign:t,mergeDriver:v})}catch(y){throw y.caller="git.merge",y}}const Ry={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function mf({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),oids:i}){const a=new Tc,o=[];function s(u,d){const p=Buffer.from(u,d);o.push(p),a.update(p)}async function l({stype:u,object:d}){const p=Ry[u];let m=d.length,g=m>15?128:0;const b=m&15;m=m>>>4;let v=(g|p|b).toString(16);for(s(v,"hex");g;)g=m>127?128:0,v=g|m&127,s(Jo(2,v),"hex"),m=m>>>7;s(Buffer.from(await Lu(d)))}s("PACK"),s("00000002","hex"),s(Jo(8,i.length),"hex");for(const u of i){const{type:d,object:p}=await Ae({fs:e,cache:t,gitdir:n,oid:u});await l({write:s,object:p,stype:d})}const c=a.digest();return o.push(c),o}async function Oy({fs:e,cache:t,gitdir:r,oids:n,write:i}){const a=await mf({fs:e,cache:t,gitdir:r,oids:n}),o=Buffer.from(await aa(a)),l=`pack-${o.slice(-20).toString("hex")}.pack`;return i?(await e.write(N.join(r,`objects/pack/${l}`),o),{filename:l}):{filename:l,packfile:new Uint8Array(o)}}async function Cy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,write:i=!1,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("oids",n),await Oy({fs:new K(e),cache:a,gitdir:r,oids:n,write:i})}catch(o){throw o.caller="git.packObjects",o}}async function Py({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l=N.join(s,".git"),ref:c,url:u,remote:d,remoteRef:p,prune:m=!1,pruneTags:g=!1,fastForward:b=!0,fastForwardOnly:v=!1,corsProxy:y,singleBranch:_,headers:R={},author:C,committer:x,signingKey:O,cache:k={}}){try{P("fs",e),P("gitdir",l);const S=new K(e),A=await pr({fs:S,gitdir:l,author:C});if(!A)throw new Xe("author");const D=await pn({fs:S,gitdir:l,author:A,committer:x});if(!D)throw new Xe("committer");return await cf({fs:S,cache:k,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:l,ref:c,url:u,remote:d,remoteRef:p,fastForward:b,fastForwardOnly:v,corsProxy:y,singleBranch:_,headers:R,author:A,committer:D,signingKey:O,prune:m,pruneTags:g})}catch(S){throw S.caller="git.pull",S}}async function Ty({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),start:i,finish:a}){const o=await mi.read({fs:e,gitdir:n}),s=new Set,l=new Set;for(const d of i)s.add(await H.resolve({fs:e,gitdir:n,ref:d}));for(const d of a)try{const p=await H.resolve({fs:e,gitdir:n,ref:d});l.add(p)}catch{}const c=new Set;async function u(d){c.add(d);const{type:p,object:m}=await Ae({fs:e,cache:t,gitdir:n,oid:d});if(p==="tag"){const b=nt.from(m).headers().object;return u(b)}if(p!=="commit")throw new rt(d,p,"commit");if(!o.has(d)){const b=De.from(m).headers().parent;for(d of b)!l.has(d)&&!c.has(d)&&await u(d)}}for(const d of s)await u(d);return c}async function is({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),oids:i}){const a=new Set;async function o(s){if(a.has(s))return;a.add(s);const{type:l,object:c}=await Ae({fs:e,cache:t,gitdir:n,oid:s});if(l==="tag"){const d=nt.from(c).headers().object;await o(d)}else if(l==="commit"){const d=De.from(c).headers().tree;await o(d)}else if(l==="tree"){const u=ct.from(c);for(const d of u)d.type==="blob"&&a.add(d.oid),d.type==="tree"&&await o(d.oid)}}for(const s of i)await o(s);return a}async function Ay(e){const t={};let r="";const n=Le.streamReader(e);let i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+`
91
91
  `),i=await n();const a=r.toString("utf8").split(`
92
92
  `);if(i=a.shift(),!i.startsWith("unpack "))throw new Dr('unpack ok" or "unpack [error message]',i);t.ok=i==="unpack ok",t.ok||(t.error=i.slice(7)),t.refs={};for(const o of a){if(o.trim()==="")continue;const s=o.slice(0,2),l=o.slice(3);let c=l.indexOf(" ");c===-1&&(c=l.length);const u=l.slice(0,c),d=l.slice(c+1);t.refs[u]={ok:s==="ok",error:d}}return t}async function Dy({capabilities:e=[],triplets:t=[]}){const r=[];let n=`\0 ${e.join(" ")}`;for(const i of t)r.push(Le.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
93
- `)),n="";return r.push(Le.flush()),r}async function $y({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPrePush:l,gitdir:c,ref:u,remoteRef:d,remote:p,url:m,force:g=!1,delete:v=!1,corsProxy:x,headers:b={}}){const _=u||await mr({fs:e,gitdir:c});if(typeof _>"u")throw new ct("ref");const k=await Me.get({fs:e,gitdir:c});p=p||await k.get(`branch.${_}.pushRemote`)||await k.get("remote.pushDefault")||await k.get(`branch.${_}.remote`)||"origin";const S=m||await k.get(`remote.${p}.pushurl`)||await k.get(`remote.${p}.url`);if(typeof S>"u")throw new ct("remote OR url");const y=d||await k.get(`branch.${_}.merge`);if(typeof S>"u")throw new ct("remoteRef");x===void 0&&(x=await k.get("http.corsProxy"));const C=await H.expand({fs:e,gitdir:c,ref:_}),O=v?"0000000000000000000000000000000000000000":await H.resolve({fs:e,gitdir:c,ref:C}),R=sa.getRemoteHelperFor({url:S}),A=await R.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:x,service:"git-receive-pack",url:S,headers:b,protocolVersion:1}),D=A.auth;let j;if(!y)j=C;else try{j=await H.expandAgainstMap({ref:y,map:A.refs})}catch(F){if(F instanceof Oe)j=y.startsWith("refs/")?y:`refs/heads/${y}`;else throw F}const M=A.refs.get(j)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:p,url:S,localRef:{ref:v?"(delete)":C,oid:O},remoteRef:{ref:j,oid:M}}))throw new fn;const U=!A.capabilities.has("no-thin");let Z=new Set;if(!v){const F=[...A.refs.values()];let q=new Set;if(M!=="0000000000000000000000000000000000000000"){const W=await rs({fs:e,cache:t,gitdir:c,oids:[O,M]});for(const ee of W)F.push(ee);U&&(q=await is({fs:e,cache:t,gitdir:c,oids:W}))}if(!F.includes(O)){const W=await Ty({fs:e,cache:t,gitdir:c,start:[O],finish:F});Z=await is({fs:e,cache:t,gitdir:c,oids:W})}if(U){try{const W=await H.resolve({fs:e,gitdir:c,ref:`refs/remotes/${p}/HEAD`,depth:2}),{oid:ee}=await H.resolveAgainstMap({ref:W.replace(`refs/remotes/${p}/`,""),fullref:W,map:A.refs}),I=[ee];for(const Q of await is({fs:e,cache:t,gitdir:c,oids:I}))q.add(Q)}catch{}for(const W of q)Z.delete(W)}if(O===M&&(g=!0),!g){if(C.startsWith("refs/tags")&&M!=="0000000000000000000000000000000000000000")throw new un("tag-exists");if(O!=="0000000000000000000000000000000000000000"&&M!=="0000000000000000000000000000000000000000"&&!await uf({fs:e,cache:t,gitdir:c,oid:O,ancestor:M,depth:-1}))throw new un("not-fast-forward")}}const de=tf([...A.capabilities],["report-status","side-band-64k",`agent=${ca.agent}`]),$e=await Dy({capabilities:de,triplets:[{oldoid:M,oid:O,fullRef:j}]}),ge=v?[]:await pf({fs:e,cache:t,gitdir:c,oids:[...Z]}),_e=await R.connect({http:r,onProgress:n,corsProxy:x,service:"git-receive-pack",url:S,auth:D,headers:b,body:[...$e,...ge]}),{packfile:Je,progress:Qe}=await nf.demux(_e.body);if(i){const F=rf(Qe);pi(F,async q=>{await i(q)})}const fe=await Ay(Je);if(_e.headers&&(fe.headers=_e.headers),p&&fe.ok&&fe.refs[j].ok&&!C.startsWith("refs/tags")){const F=`refs/remotes/${p}/${j.replace("refs/heads","")}`;v?await H.deleteRef({fs:e,gitdir:c,ref:F}):await H.writeRef({fs:e,gitdir:c,ref:F,value:O})}if(fe.ok&&Object.values(fe.refs).every(F=>F.ok))return fe;{const F=Object.entries(fe.refs).filter(([q,W])=>!W.ok).map(([q,W])=>`
94
- - ${q}: ${W.error}`).join("");throw new ri(F,fe)}}async function Iy({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPrePush:s,dir:l,gitdir:c=N.join(l,".git"),ref:u,remoteRef:d,remote:p="origin",url:m,force:g=!1,delete:v=!1,corsProxy:x,headers:b={},cache:_={}}){try{return P("fs",e),P("http",t),P("gitdir",c),await $y({fs:new K(e),cache:_,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPrePush:s,gitdir:c,ref:u,remoteRef:d,remote:p,url:m,force:g,delete:v,corsProxy:x,headers:b})}catch(k){throw k.caller="git.push",k}}async function mf({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,mf({fs:e,cache:t,gitdir:r,oid:n});if(i!=="blob")throw new rt(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function wf({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await di({fs:e,cache:t,gitdir:r,oid:n,filepath:i})),await mf({fs:e,cache:t,gitdir:r,oid:n})}async function By({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await wf({fs:new K(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function gf({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await mn({fs:new K(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function jy({fs:e,cache:t,gitdir:r,ref:n="refs/notes/commits",oid:i}){const a=await H.resolve({gitdir:r,fs:e,ref:n}),{blob:o}=await wf({fs:e,cache:t,gitdir:r,oid:a,filepath:i});return o}async function zy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("ref",n),P("oid",i),await jy({fs:new K(e),cache:a,gitdir:r,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function Ny({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:o=void 0,cache:s={}}){try{P("fs",e),P("gitdir",r),P("oid",n);const l=new K(e);a!==void 0&&(n=await di({fs:l,cache:s,gitdir:r,oid:n,filepath:a}));const u=await Ae({fs:l,cache:s,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(u.oid=n,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=De.from(u.object).parse();break;case"tree":u.object=st.from(u.object).entries();break;case"blob":o?u.object=u.object.toString(o):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=nt.from(u.object).parse();break;default:throw new rt(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 My({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new rt(n,i,"tag");const o=nt.from(a);return{oid:n,tag:o.parse(),payload:o.payload()}}async function Ly({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await My({fs:new K(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function Fy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await wn({fs:new K(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function Uy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{P("fs",e),P("gitdir",r),P("filepath",n),await He.acquire({fs:new K(e),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function Hy({fs:e,cache:t,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:o,committer:s,signingKey:l}){let c;try{c=await H.resolve({gitdir:n,fs:e,ref:i})}catch(g){if(!(g instanceof Oe))throw g}let d=(await wn({fs:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;d=d.filter(g=>g.path!==a);const p=await hi({fs:e,gitdir:n,tree:d});return await ia({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:p,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
95
- `,author:o,committer:s,signingKey:l})}async function Wy({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ref:i="refs/notes/commits",oid:a,author:o,committer:s,signingKey:l,cache:c={}}){try{P("fs",e),P("gitdir",n),P("oid",a);const u=new K(e),d=await pr({fs:u,gitdir:n,author:o});if(!d)throw new Xe("author");const p=await pn({fs:u,gitdir:n,author:d,committer:s});if(!p)throw new Xe("committer");return await Hy({fs:u,cache:c,onSign:t,gitdir:n,ref:i,oid:a,author:d,committer:p,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function qy({fs:e,gitdir:t,oldref:r,ref:n,checkout:i=!1}){if(n!==Mt.clean(n))throw new Ct(n,Mt.clean(n));if(r!==Mt.clean(r))throw new Ct(r,Mt.clean(r));const a=`refs/heads/${r}`,o=`refs/heads/${n}`;if(await H.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",n,!1);const l=await H.resolve({fs:e,gitdir:t,ref:a,depth:1});await H.writeRef({fs:e,gitdir:t,ref:o,value:l}),await H.deleteRef({fs:e,gitdir:t,ref:a});const u=await mr({fs:e,gitdir:t,fullname:!0})===a;(i||u)&&await H.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function Gy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,oldref:i,checkout:a=!1}){try{return P("fs",e),P("gitdir",r),P("ref",n),P("oldref",i),await qy({fs:new K(e),gitdir:r,ref:n,oldref:i,checkout:a})}catch(o){throw o.caller="git.renameBranch",o}}async function yf({gitdir:e,type:t,object:r}){return Vt(an.wrap({type:t,object:r}))}async function Yy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,ref:i,cache:a={}}){try{P("fs",e),P("gitdir",r),P("filepath",n);const o=new K(e);let s,l;try{s=await H.resolve({fs:o,gitdir:r,ref:i||"HEAD"})}catch(d){if(i)throw d}if(s)try{s=await di({fs:o,cache:a,gitdir:r,oid:s,filepath:n})}catch{s=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0};const u=t&&await o.read(N.join(t,n));u&&(l=await yf({gitdir:r,type:"blob",object:u}),s===l&&(c=await o.lstat(N.join(t,n)))),await He.acquire({fs:o,gitdir:r,cache:a},async function(d){d.delete({filepath:n}),s&&d.insert({filepath:n,stats:c,oid:s})})}catch(o){throw o.caller="git.reset",o}}async function Zy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,depth:i}){try{return P("fs",e),P("gitdir",r),P("ref",n),await H.resolve({fs:new K(e),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Xy({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n,value:i,append:a=!1}){try{P("fs",e),P("gitdir",r),P("path",n);const o=new K(e),s=await Me.get({fs:o,gitdir:r});a?await s.append(n,i):await s.set(n,i),await Me.save({fs:o,gitdir:r,config:s})}catch(o){throw o.caller="git.setConfig",o}}async function bf({fs:e,gitdir:t,commit:r}){const n=De.from(r).toObject();return await lt({fs:e,gitdir:t,type:"commit",object:n,format:"content"})}class ua{static get timezoneOffsetForRefLogEntry(){const t=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(t/60)),n=Math.abs(t%60).toString().padStart(2,"0");return`${t>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(t,r,n){const i=t.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),s=ua.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${t.email} ${o} ${s} ${n}
93
+ `)),n="";return r.push(Le.flush()),r}async function $y({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPrePush:l,gitdir:c,ref:u,remoteRef:d,remote:p,url:m,force:g=!1,delete:b=!1,corsProxy:v,headers:y={}}){const _=u||await mr({fs:e,gitdir:c});if(typeof _>"u")throw new lt("ref");const R=await Me.get({fs:e,gitdir:c});p=p||await R.get(`branch.${_}.pushRemote`)||await R.get("remote.pushDefault")||await R.get(`branch.${_}.remote`)||"origin";const C=m||await R.get(`remote.${p}.pushurl`)||await R.get(`remote.${p}.url`);if(typeof C>"u")throw new lt("remote OR url");const x=d||await R.get(`branch.${_}.merge`);if(typeof C>"u")throw new lt("remoteRef");v===void 0&&(v=await R.get("http.corsProxy"));const O=await H.expand({fs:e,gitdir:c,ref:_}),k=b?"0000000000000000000000000000000000000000":await H.resolve({fs:e,gitdir:c,ref:O}),S=sa.getRemoteHelperFor({url:C}),A=await S.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:v,service:"git-receive-pack",url:C,headers:y,protocolVersion:1}),D=A.auth;let B;if(!x)B=O;else try{B=await H.expandAgainstMap({ref:x,map:A.refs})}catch(F){if(F instanceof Oe)B=x.startsWith("refs/")?x:`refs/heads/${x}`;else throw F}const M=A.refs.get(B)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:p,url:C,localRef:{ref:b?"(delete)":O,oid:k},remoteRef:{ref:B,oid:M}}))throw new fn;const U=!A.capabilities.has("no-thin");let Z=new Set;if(!b){const F=[...A.refs.values()];let q=new Set;if(M!=="0000000000000000000000000000000000000000"){const W=await rs({fs:e,cache:t,gitdir:c,oids:[k,M]});for(const te of W)F.push(te);U&&(q=await is({fs:e,cache:t,gitdir:c,oids:W}))}if(!F.includes(k)){const W=await Ty({fs:e,cache:t,gitdir:c,start:[k],finish:F});Z=await is({fs:e,cache:t,gitdir:c,oids:W})}if(U){try{const W=await H.resolve({fs:e,gitdir:c,ref:`refs/remotes/${p}/HEAD`,depth:2}),{oid:te}=await H.resolveAgainstMap({ref:W.replace(`refs/remotes/${p}/`,""),fullref:W,map:A.refs}),I=[te];for(const ee of await is({fs:e,cache:t,gitdir:c,oids:I}))q.add(ee)}catch{}for(const W of q)Z.delete(W)}if(k===M&&(g=!0),!g){if(O.startsWith("refs/tags")&&M!=="0000000000000000000000000000000000000000")throw new un("tag-exists");if(k!=="0000000000000000000000000000000000000000"&&M!=="0000000000000000000000000000000000000000"&&!await ff({fs:e,cache:t,gitdir:c,oid:k,ancestor:M,depth:-1}))throw new un("not-fast-forward")}}const de=rf([...A.capabilities],["report-status","side-band-64k",`agent=${ca.agent}`]),$e=await Dy({capabilities:de,triplets:[{oldoid:M,oid:k,fullRef:B}]}),ge=b?[]:await mf({fs:e,cache:t,gitdir:c,oids:[...Z]}),xe=await S.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:C,auth:D,headers:y,body:[...$e,...ge]}),{packfile:Je,progress:Qe}=await af.demux(xe.body);if(i){const F=nf(Qe);pi(F,async q=>{await i(q)})}const fe=await Ay(Je);if(xe.headers&&(fe.headers=xe.headers),p&&fe.ok&&fe.refs[B].ok&&!O.startsWith("refs/tags")){const F=`refs/remotes/${p}/${B.replace("refs/heads","")}`;b?await H.deleteRef({fs:e,gitdir:c,ref:F}):await H.writeRef({fs:e,gitdir:c,ref:F,value:k})}if(fe.ok&&Object.values(fe.refs).every(F=>F.ok))return fe;{const F=Object.entries(fe.refs).filter(([q,W])=>!W.ok).map(([q,W])=>`
94
+ - ${q}: ${W.error}`).join("");throw new ri(F,fe)}}async function Iy({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPrePush:s,dir:l,gitdir:c=N.join(l,".git"),ref:u,remoteRef:d,remote:p="origin",url:m,force:g=!1,delete:b=!1,corsProxy:v,headers:y={},cache:_={}}){try{return P("fs",e),P("http",t),P("gitdir",c),await $y({fs:new K(e),cache:_,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPrePush:s,gitdir:c,ref:u,remoteRef:d,remote:p,url:m,force:g,delete:b,corsProxy:v,headers:y})}catch(R){throw R.caller="git.push",R}}async function wf({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,wf({fs:e,cache:t,gitdir:r,oid:n});if(i!=="blob")throw new rt(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function gf({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await di({fs:e,cache:t,gitdir:r,oid:n,filepath:i})),await wf({fs:e,cache:t,gitdir:r,oid:n})}async function jy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await gf({fs:new K(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function yf({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await mn({fs:new K(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function By({fs:e,cache:t,gitdir:r,ref:n="refs/notes/commits",oid:i}){const a=await H.resolve({gitdir:r,fs:e,ref:n}),{blob:o}=await gf({fs:e,cache:t,gitdir:r,oid:a,filepath:i});return o}async function zy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("ref",n),P("oid",i),await By({fs:new K(e),cache:a,gitdir:r,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function Ny({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:o=void 0,cache:s={}}){try{P("fs",e),P("gitdir",r),P("oid",n);const l=new K(e);a!==void 0&&(n=await di({fs:l,cache:s,gitdir:r,oid:n,filepath:a}));const u=await Ae({fs:l,cache:s,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(u.oid=n,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=De.from(u.object).parse();break;case"tree":u.object=ct.from(u.object).entries();break;case"blob":o?u.object=u.object.toString(o):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=nt.from(u.object).parse();break;default:throw new rt(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 My({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await Ae({fs:e,cache:t,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new rt(n,i,"tag");const o=nt.from(a);return{oid:n,tag:o.parse(),payload:o.payload()}}async function Ly({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await My({fs:new K(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function Fy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return P("fs",e),P("gitdir",r),P("oid",n),await wn({fs:new K(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function Uy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{P("fs",e),P("gitdir",r),P("filepath",n),await He.acquire({fs:new K(e),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function Hy({fs:e,cache:t,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:o,committer:s,signingKey:l}){let c;try{c=await H.resolve({gitdir:n,fs:e,ref:i})}catch(g){if(!(g instanceof Oe))throw g}let d=(await wn({fs:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;d=d.filter(g=>g.path!==a);const p=await hi({fs:e,gitdir:n,tree:d});return await ia({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:p,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
95
+ `,author:o,committer:s,signingKey:l})}async function Wy({fs:e,onSign:t,dir:r,gitdir:n=N.join(r,".git"),ref:i="refs/notes/commits",oid:a,author:o,committer:s,signingKey:l,cache:c={}}){try{P("fs",e),P("gitdir",n),P("oid",a);const u=new K(e),d=await pr({fs:u,gitdir:n,author:o});if(!d)throw new Xe("author");const p=await pn({fs:u,gitdir:n,author:d,committer:s});if(!p)throw new Xe("committer");return await Hy({fs:u,cache:c,onSign:t,gitdir:n,ref:i,oid:a,author:d,committer:p,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function qy({fs:e,gitdir:t,oldref:r,ref:n,checkout:i=!1}){if(n!==Mt.clean(n))throw new Ct(n,Mt.clean(n));if(r!==Mt.clean(r))throw new Ct(r,Mt.clean(r));const a=`refs/heads/${r}`,o=`refs/heads/${n}`;if(await H.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",n,!1);const l=await H.resolve({fs:e,gitdir:t,ref:a,depth:1});await H.writeRef({fs:e,gitdir:t,ref:o,value:l}),await H.deleteRef({fs:e,gitdir:t,ref:a});const u=await mr({fs:e,gitdir:t,fullname:!0})===a;(i||u)&&await H.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function Gy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,oldref:i,checkout:a=!1}){try{return P("fs",e),P("gitdir",r),P("ref",n),P("oldref",i),await qy({fs:new K(e),gitdir:r,ref:n,oldref:i,checkout:a})}catch(o){throw o.caller="git.renameBranch",o}}async function bf({gitdir:e,type:t,object:r}){return Vt(an.wrap({type:t,object:r}))}async function Yy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,ref:i,cache:a={}}){try{P("fs",e),P("gitdir",r),P("filepath",n);const o=new K(e);let s,l;try{s=await H.resolve({fs:o,gitdir:r,ref:i||"HEAD"})}catch(d){if(i)throw d}if(s)try{s=await di({fs:o,cache:a,gitdir:r,oid:s,filepath:n})}catch{s=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0};const u=t&&await o.read(N.join(t,n));u&&(l=await bf({gitdir:r,type:"blob",object:u}),s===l&&(c=await o.lstat(N.join(t,n)))),await He.acquire({fs:o,gitdir:r,cache:a},async function(d){d.delete({filepath:n}),s&&d.insert({filepath:n,stats:c,oid:s})})}catch(o){throw o.caller="git.reset",o}}async function Zy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,depth:i}){try{return P("fs",e),P("gitdir",r),P("ref",n),await H.resolve({fs:new K(e),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Xy({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n,value:i,append:a=!1}){try{P("fs",e),P("gitdir",r),P("path",n);const o=new K(e),s=await Me.get({fs:o,gitdir:r});a?await s.append(n,i):await s.set(n,i),await Me.save({fs:o,gitdir:r,config:s})}catch(o){throw o.caller="git.setConfig",o}}async function _f({fs:e,gitdir:t,commit:r}){const n=De.from(r).toObject();return await ut({fs:e,gitdir:t,type:"commit",object:n,format:"content"})}class ua{static get timezoneOffsetForRefLogEntry(){const t=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(t/60)),n=Math.abs(t%60).toString().padStart(2,"0");return`${t>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(t,r,n){const i=t.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),s=ua.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${t.email} ${o} ${s} ${n}
96
96
  `}static getStashReflogEntry(t,r=!1){return t.split(`
97
- `).filter(a=>a).reverse().map((a,o)=>r?`stash@{${o}}: ${a.split(" ")[1]}`:a)}}const Vy={stage:nn,workdir:ui};let as;async function gn(e,t){return as===void 0&&(as=new Tn),as.acquire(e,t)}async function Ky(e,t,r,n,i=null){const a=N.join(r,n),o=await e.lstat(a);if(!o)throw new Oe(a);if(o.isDirectory())throw new se(`${a}: file expected, but found directory`);const s=i?await Ou({fs:e,gitdir:t,oid:i}):void 0;let l=s?i:void 0;return s||await gn({fs:e,gitdir:t,currentFilepath:a},async()=>{const c=o.isSymbolicLink()?await e.readlink(a).then(Lu):await e.read(a);if(c===null)throw new Oe(a);l=await lt({fs:e,gitdir:t,type:"blob",object:c})}),l}async function Jy({fs:e,dir:t,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){const o=await Promise.all(a.children.map(i));a.oid=await hi({fs:e,gitdir:r,tree:o}),a.mode=16384}}else a.type==="blob"&&(a.oid=await Ky(e,r,t,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function vf({fs:e,dir:t,gitdir:r,treePair:n}){const i=n[1]==="stage",a=n.map(m=>typeof m=="string"?Vy[m]():m),o=[],u=await hr({fs:e,cache:{},dir:t,gitdir:r,trees:a,map:async(m,[g,v])=>{if(!(m==="."||await hn.isIgnored({fs:e,dir:t,gitdir:r,filepath:m}))&&v)return(!g||await g.oid()!==await v.oid()&&await v.oid()!==void 0)&&o.push([g,v]),{mode:await v.mode(),path:m,oid:await v.oid(),type:await v.type()}},reduce:async(m,g)=>(g=g.filter(Boolean),m?(m.children=g,m):g.length>0?g:void 0),iterate:async(m,g)=>{const v=[];for(const x of g){const[b,_]=x;i?_&&(await e.exists(`${t}/${_.toString()}`)?v.push(x):o.push([null,_])):b&&(_?v.push(x):o.push([b,null]))}return v.length?Promise.all(v.map(m)):[]}});if(o.length===0||u.length===0)return null;const p=(await Jy({fs:e,dir:t,gitdir:r,entries:u})).filter(Boolean).map(m=>({mode:m.mode,path:m.path,oid:m.oid,type:m.type}));return hi({fs:e,gitdir:r,tree:p})}async function Qy({fs:e,dir:t,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){const o=[],s=[],l=await hr({fs:e,cache:{},dir:t,gitdir:r,trees:[xt({ref:i}),xt({ref:n})],map:async(c,[u,d])=>{if(c==="."||await hn.isIgnored({fs:e,dir:t,gitdir:r,filepath:c}))return;const p=d?await d.type():await u.type();if(p!=="tree"&&p!=="blob")return;if(!d&&u){const g=p==="tree"?"rmdir":"rm";return p==="tree"&&o.push(c),p==="blob"&&a&&s.push({filepath:c,oid:await u.oid()}),{method:g,filepath:c}}const m=await d.oid();if(!u||await u.oid()!==m)return p==="tree"?{method:"mkdir",filepath:c}:(a&&s.push({filepath:c,oid:m,stats:await e.lstat(N.join(t,c))}),{method:"write",filepath:c,oid:m})}});await gn({fs:e,gitdir:r,dirRemoved:o,ops:l},async()=>{for(const c of l){const u=N.join(t,c.filepath);switch(c.method){case"rmdir":await e.rmdir(u);break;case"mkdir":await e.mkdir(u);break;case"rm":await e.rm(u);break;case"write":if(!o.some(d=>u.startsWith(d))){const{object:d}=await Ae({fs:e,cache:{},gitdir:r,oid:c.oid});await e.exists(u)&&await e.rm(u),await e.write(u,d)}break}}}),await He.acquire({fs:e,gitdir:r,cache:{}},async c=>{s.forEach(({filepath:u,stats:d,oid:p})=>{c.insert({filepath:u,stats:d,oid:p})})})}class Jt{constructor({fs:t,dir:r,gitdir:n=N.join(r,".git")}){Object.assign(this,{fs:t,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return N.join(this.gitdir,Jt.refStash)}get refLogsStashPath(){return N.join(this.gitdir,Jt.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await pr({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Xe("author");return this._author}async getStashSHA(t,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[t].split(" ")[1]:null}async writeStashCommit({message:t,tree:r,parent:n}){return bf({fs:this.fs,gitdir:this.gitdir,commit:{message:t,tree:r,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(t){const r=await this.readStashReflogs({parsed:!1});if(t!==0&&(t<0||t>r.length-1))throw new Ct(`stash@${t}`,"number that is in range of [0, num of stash pushed]");const n=await this.getStashSHA(t,r);return n?mn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(t){return H.writeRef({fs:this.fs,gitdir:this.gitdir,ref:Jt.refStash,value:t})}async writeStashReflogEntry({stashCommit:t,message:r}){const n=await this.getAuthor(),i=ua.createStashReflogEntry(n,t,r),a=this.refLogsStashPath;await gn({filepath:a,entry:i},async()=>{const o=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,o+i,"utf8")})}async readStashReflogs({parsed:t=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];const n=(await this.fs.read(this.refLogsStashPath)).toString();return ua.getStashReflogEntry(n,t)}}async function eb({fs:e,dir:t,gitdir:r,message:n=""}){const i=new Jt({fs:e,dir:t,gitdir:r});await i.getAuthor();const a=await mr({fs:e,gitdir:r,fullname:!1}),o=await H.resolve({fs:e,gitdir:r,ref:"HEAD"}),l=(await gf({fs:e,dir:t,gitdir:r,oid:o})).commit.message,c=[o];let u=null,d=xt({ref:"HEAD"});const p=await vf({fs:e,dir:t,gitdir:r,treePair:[xt({ref:"HEAD"}),"stage"]});if(p){const x=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:p,parent:c});c.push(x),u=p,d=nn()}const m=await vf({fs:e,dir:t,gitdir:r,treePair:[d,"workdir"]});if(m){const x=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:m,parent:[c[c.length-1]]});c.push(x),u=m}if(!u||!p&&!m)throw new Oe("changes, nothing to stash");const g=(n.trim()||`WIP on ${a}`)+`: ${o.substring(0,7)} ${l}`,v=await i.writeStashCommit({message:g,tree:u,parent:c});return await i.writeStashRef(v),await i.writeStashReflogEntry({stashCommit:v,message:g}),await Yu({fs:e,dir:t,gitdir:r,ref:a,track:!1,force:!0}),v}async function _f({fs:e,dir:t,gitdir:r,refIdx:n=0}){const a=await new Jt({fs:e,dir:t,gitdir:r}).readStashCommit(n),{parent:o=null}=a.commit?a.commit:{};if(!(!o||!Array.isArray(o)))for(let s=0;s<o.length-1;s++){const c=(await mn({fs:e,cache:{},gitdir:r,oid:o[s+1]})).commit.message.startsWith("stash-Index");await Qy({fs:e,dir:t,gitdir:r,stashCommit:o[s+1],parentCommit:o[s],wasStaged:c})}}async function xf({fs:e,dir:t,gitdir:r,refIdx:n=0}){const i=new Jt({fs:e,dir:t,gitdir:r});if(!(await i.readStashCommit(n)).commit)return;const o=i.refStashPath;await gn(o,async()=>{await e.exists(o)&&await e.rm(o)});const s=await i.readStashReflogs({parsed:!1});if(!s.length)return;s.splice(n,1);const l=i.refLogsStashPath;await gn({reflogEntries:s,stashReflogPath:l,stashMgr:i},async()=>{if(s.length){await e.write(l,s.join(`
98
- `),"utf8");const c=s[s.length-1].split(" ")[1];await i.writeStashRef(c)}else await e.rm(l)})}async function tb({fs:e,dir:t,gitdir:r}){return new Jt({fs:e,dir:t,gitdir:r}).readStashReflogs({parsed:!0})}async function rb({fs:e,dir:t,gitdir:r}){const n=new Jt({fs:e,dir:t,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await gn(i,async()=>{await Promise.all(i.map(async a=>{if(await e.exists(a))return e.rm(a)}))})}async function nb({fs:e,dir:t,gitdir:r,refIdx:n=0}){await _f({fs:e,dir:t,gitdir:r,refIdx:n}),await xf({fs:e,dir:t,gitdir:r,refIdx:n})}async function ib({fs:e,dir:t,gitdir:r=N.join(t,".git"),op:n="push",message:i="",refIdx:a=0}){P("fs",e),P("dir",t),P("gitdir",r),P("op",n);const o={push:eb,apply:_f,drop:xf,list:tb,clear:rb,pop:nb},s=["apply","drop","pop"];try{const l=new K(e);["refs","logs","logs/refs"].map(d=>N.join(r,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});const u=o[n];if(u){if(s.includes(n)&&a<0)throw new Ct(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await u({fs:l,dir:t,gitdir:r,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function ab({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{P("fs",e),P("gitdir",r),P("filepath",n);const a=new K(e);if(await hn.isIgnored({fs:a,gitdir:r,dir:t,filepath:n}))return"ignored";const s=await ob({fs:a,cache:i,gitdir:r}),l=await Ef({fs:a,cache:i,gitdir:r,tree:s,path:n}),c=await He.acquire({fs:a,gitdir:r,cache:i},async function(v){for(const x of v)if(x.path===n)return x;return null}),u=await a.lstat(N.join(t,n)),d=l!==null,p=c!==null,m=u!==null,g=async()=>{if(p&&!Xi(c,u))return c.oid;{const v=await a.read(N.join(t,n)),x=await yf({gitdir:r,type:"blob",object:v});return p&&c.oid===x&&u.size!==-1&&He.acquire({fs:a,gitdir:r,cache:i},async function(b){b.insert({filepath:n,stats:u,oid:x})}),x}};if(!d&&!m&&!p)return"absent";if(!d&&!m&&p)return"*absent";if(!d&&m&&!p)return"*added";if(!d&&m&&p)return await g()===c.oid?"added":"*added";if(d&&!m&&!p)return"deleted";if(d&&!m&&p)return l===c.oid,"*deleted";if(d&&m&&!p)return await g()===l?"*undeleted":"*undeletemodified";if(d&&m&&p){const v=await g();return v===l?v===c.oid?"unmodified":"*unmodified":v===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function Ef({fs:e,cache:t,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));const a=i.shift();for(const o of n)if(o.path===a){if(i.length===0)return o.oid;const{type:s,object:l}=await Ae({fs:e,cache:t,gitdir:r,oid:o.oid});if(s==="tree"){const c=st.from(l);return Ef({fs:e,cache:t,gitdir:r,tree:c,path:i})}if(s==="blob")throw new rt(o.oid,s,"blob",i.join("/"))}return null}async function ob({fs:e,cache:t,gitdir:r}){let n;try{n=await H.resolve({fs:e,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Oe)return[]}const{tree:i}=await wn({fs:e,cache:t,gitdir:r,oid:n});return i}async function sb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:o={},ignored:s=!1}){try{P("fs",e),P("gitdir",r),P("ref",n);const l=new K(e);return await hr({fs:l,cache:o,dir:t,gitdir:r,trees:[xt({ref:n}),ui(),nn()],map:async function(c,[u,d,p]){if(!u&&!p&&d&&!s&&await hn.isIgnored({fs:l,dir:t,filepath:c})||!i.some(C=>Gu(c,C)))return null;if(a&&!a(c))return;const[m,g,v]=await Promise.all([u&&u.type(),d&&d.type(),p&&p.type()]),x=[m,g,v].includes("blob");if((m==="tree"||m==="special")&&!x)return;if(m==="commit")return null;if((g==="tree"||g==="special")&&!x)return;if(v==="commit")return null;if((v==="tree"||v==="special")&&!x)return;const b=m==="blob"?await u.oid():void 0,_=v==="blob"?await p.oid():void 0;let k;m!=="blob"&&g==="blob"&&v!=="blob"?k="42":g==="blob"&&(k=await d.oid());const S=[void 0,b,k,_],y=S.map(C=>S.indexOf(C));return y.shift(),[c,...y]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function cb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,force:a=!1}){try{P("fs",e),P("gitdir",r),P("ref",n);const o=new K(e);if(n===void 0)throw new ct("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;const s=await H.resolve({fs:o,gitdir:r,ref:i||"HEAD"});if(!a&&await H.exists({fs:o,gitdir:r,ref:n}))throw new Ot("tag",n);await H.writeRef({fs:o,gitdir:r,ref:n,value:s})}catch(o){throw o.caller="git.tag",o}}async function lb({fs:e,dir:t,gitdir:r=N.join(t,".git"),cache:n={},filepath:i,oid:a,mode:o,add:s,remove:l,force:c}){try{P("fs",e),P("gitdir",r),P("filepath",i);const u=new K(e);if(l)return await He.acquire({fs:u,gitdir:r,cache:n},async function(p){let m;if(!c&&(m=await u.lstat(N.join(t,i)),m)){if(m.isDirectory())throw new fr("directory");return}p.has({filepath:i})&&p.delete({filepath:i})});let d;if(!a){if(d=await u.lstat(N.join(t,i)),!d)throw new Oe(`file at "${i}" on disk and "remove" not set`);if(d.isDirectory())throw new fr("directory")}return await He.acquire({fs:u,gitdir:r,cache:n},async function(p){if(!s&&!p.has({filepath:i}))throw new Oe(`file at "${i}" in index and "add" not set`);let m={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};if(!a){m=d;const g=m.isSymbolicLink()?await u.readlink(N.join(t,i)):await u.read(N.join(t,i));a=await lt({fs:u,gitdir:r,type:"blob",format:"content",object:g})}return p.insert({filepath:i,oid:a,stats:m}),a})}catch(u){throw u.caller="git.updateIndex",u}}function ub(){try{return ca.version}catch(e){throw e.caller="git.version",e}}async function fb({fs:e,dir:t,gitdir:r=N.join(t,".git"),trees:n,map:i,reduce:a,iterate:o,cache:s={}}){try{return P("fs",e),P("gitdir",r),P("trees",n),await hr({fs:new K(e),cache:s,dir:t,gitdir:r,trees:n,map:i,reduce:a,iterate:o})}catch(l){throw l.caller="git.walk",l}}async function db({fs:e,dir:t,gitdir:r=N.join(t,".git"),blob:n}){try{return P("fs",e),P("gitdir",r),P("blob",n),await lt({fs:new K(e),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function hb({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n}){try{return P("fs",e),P("gitdir",r),P("commit",n),await bf({fs:new K(e),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function pb({fs:e,dir:t,gitdir:r=N.join(t,".git"),type:n,object:i,format:a="parsed",oid:o,encoding:s=void 0}){try{const l=new K(e);if(a==="parsed"){switch(n){case"commit":i=De.from(i).toObject();break;case"tree":i=st.from(i).toObject();break;case"blob":i=Buffer.from(i,s);break;case"tag":i=nt.from(i).toObject();break;default:throw new rt(o||"",n,"blob|commit|tag|tree")}a="content"}return o=await lt({fs:l,gitdir:r,type:n,object:i,oid:o,format:a}),o}catch(l){throw l.caller="git.writeObject",l}}async function mb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,value:i,force:a=!1,symbolic:o=!1}){try{P("fs",e),P("gitdir",r),P("ref",n),P("value",i);const s=new K(e);if(n!==Mt.clean(n))throw new Ct(n,Mt.clean(n));if(!a&&await H.exists({fs:s,gitdir:r,ref:n}))throw new Ot("ref",n);o?await H.writeSymbolicRef({fs:s,gitdir:r,ref:n,value:i}):(i=await H.resolve({fs:s,gitdir:r,ref:i}),await H.writeRef({fs:s,gitdir:r,ref:n,value:i}))}catch(s){throw s.caller="git.writeRef",s}}async function wb({fs:e,gitdir:t,tag:r}){const n=nt.from(r).toObject();return await lt({fs:e,gitdir:t,type:"tag",object:n,format:"content"})}async function gb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tag:n}){try{return P("fs",e),P("gitdir",r),P("tag",n),await wb({fs:new K(e),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function yb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tree:n}){try{return P("fs",e),P("gitdir",r),P("tree",n),await hi({fs:new K(e),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var ut={Errors:Gw,STAGE:nn,TREE:xt,WORKDIR:ui,add:ug,abortMerge:og,addNote:dg,addRemote:hg,annotatedTag:mg,branch:gg,checkout:Yu,clone:Pg,commit:Tg,getConfig:Kg,getConfigAll:Qg,setConfig:Xy,currentBranch:Ag,deleteBranch:$g,deleteRef:Ig,deleteRemote:jg,deleteTag:Ng,expandOid:Ug,expandRef:Hg,fastForward:Yg,fetch:Zg,findMergeBase:Xg,findRoot:Vg,getRemoteInfo:ey,getRemoteInfo2:ty,hashBlob:ny,indexPack:ay,init:oy,isDescendent:sy,isIgnored:cy,listBranches:ly,listFiles:fy,listNotes:hy,listRefs:py,listRemotes:wy,listServerRefs:by,listTags:vy,log:Sy,merge:ky,packObjects:Cy,pull:Py,push:Iy,readBlob:By,readCommit:gf,readNote:zy,readObject:Ny,readTag:Ly,readTree:Fy,remove:Uy,removeNote:Wy,renameBranch:Gy,resetIndex:Yy,updateIndex:lb,resolveRef:Zy,status:ab,statusMatrix:sb,tag:cb,version:ub,walk:fb,writeBlob:db,writeCommit:hb,writeObject:pb,writeRef:mb,writeTag:gb,writeTree:yb,stash:ib};const bb=async e=>{try{return await(await window.pfs.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}},Sf=async e=>await window.pfs.readdir(e),kf=async e=>{let t=window.pfs,r;try{r=await t.stat(e)}catch(n){console.debug("recursiveRm: Path does not exist",n);return}if(r.type==="file")await t.unlink(e),console.debug(`recursiveRm: Deleted file: ${e}`);else if(r.type==="dir"){const n=await t.readdir(e);for(const i of n)await kf(`${e}/${i}`);await t.rmdir(e),console.debug(`recursiveRm: Deleted directory: ${e}`)}},vb=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`,n="makeinfinite_client",i="makeinfinite_client@spaceandtime.io";await ut.setConfig({fs:t,dir:r,path:"user.name",value:n}),await ut.setConfig({fs:t,dir:r,path:"user.email",value:i})},_b=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await ut.clone({fs:r,http:to,dir:n,url:t,ref:"main"}),await vb(e)},xb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await ut.pull({fs:r,http:to,dir:n,url:t,ref:"main"})},Eb=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`,n=await ut.resolveRef({fs:t,dir:r,ref:"refs/tags/published"});await ut.checkout({fs:t,dir:r,ref:n})},Sb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await ut.fetch({fs:r,http:to,dir:n,url:t,ref:"main",tags:!0,pruneTags:!0})};class kb{constructor(t,r,n){this.targetRef=t,this.sourceRef=r,this.opType=n}}const os=e=>{var o,s;const t=e.commit.message.trim().split(`
99
- `),r=t.find(l=>l.startsWith("Git Ref: ")),n=t.find(l=>l.startsWith("Extra Metadata: "));if(!r||!n)return null;const i=(o=r.split("Git Ref: ")[1])==null?void 0:o.trim(),a=JSON.parse(((s=n.split("Extra Metadata: ")[1])==null?void 0:s.trim())||"{}");return!i||!a?null:new kb(i,a.sourceRef,a.opType)},Rb=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`;return await ut.resolveRef({fs:t,dir:r,ref:"HEAD"})},Rf=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`,i={fs:r,dir:n,ref:"HEAD",depth:1,filepath:t},a=(await ut.log(i))[0];if(!a)throw new Error("No commit found");return a.oid},fa=async(e,t,r,n,i=new Set,a=1e3)=>{if(a<=0)throw new Error(`Maximum recursion depth reached while resolving commit: ${r}`);const o=window.pfs,s=`${window.miDir}/${e}`,l={fs:o,dir:s,ref:r,depth:1,filepath:t},c=(await ut.log(l))[0];if(!c)throw new Error("No commit found");if(i.has(c.oid))throw new Error(`Circular reference detected: ${c.oid} has already been seen`);i.add(c.oid);const u=os(c);if(u&&u.opType==n)return fa(e,t,u.targetRef,n,i,a-1);if(c.commit.parent.length>1){const d=c.commit.parent[0];if(!d)throw new Error("No parent found");return fa(e,t,d,n,i,a-1)}return c},Ob=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`,i=await Rf(e,t),a=await fa(e,t,i,"UNDO"),o=os(a);if(o)return[i,o.sourceRef];{let s=a.oid;const l={fs:r,dir:n,ref:s,depth:2,filepath:t},c=await ut.log(l);if(!c[1])throw new Error("No previous commit found");const u=c[1].oid;return[i,u]}},Cb=async(e,t)=>{const r=await Rf(e,t),n=await fa(e,t,r,"REDO"),i=os(n);if(!i)throw new Error("No undos to redo");return[r,i.sourceRef]},Pb=async(e,t)=>{await bb(`${window.miDir}/${e}`)||await _b(e,t);try{await xb(e,t)}catch(n){throw await kf(`${window.miDir}/${e}`).catch(i=>console.log(`recursiveRm error: ${i}`)),n}},Of=async(e,t)=>{let r=0;const n=5;for(;r<=n;)try{await Pb(e||"",t||"");break}catch(i){if(r++,console.log(`Retrying syncGitSource (Attempt ${r})`),r>n)throw console.error(`syncGitSource failed after ${r} attempts:`,i),i}},Cf=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await Sb(e,t);const i=await ut.listTags({fs:r,dir:n});return await Promise.all(i.map(async o=>{const s=await ut.resolveRef({fs:r,dir:n,ref:`refs/tags/${o}`}),{commit:l}=await ut.readCommit({fs:r,dir:n,oid:s});return{tag:o,timestamp:l.committer.timestamp,ref:`refs/tags/${o}`}}))};var Pf={exports:{}},wi={};/*
97
+ `).filter(a=>a).reverse().map((a,o)=>r?`stash@{${o}}: ${a.split(" ")[1]}`:a)}}const Vy={stage:nn,workdir:ui};let as;async function gn(e,t){return as===void 0&&(as=new Tn),as.acquire(e,t)}async function Ky(e,t,r,n,i=null){const a=N.join(r,n),o=await e.lstat(a);if(!o)throw new Oe(a);if(o.isDirectory())throw new se(`${a}: file expected, but found directory`);const s=i?await Cu({fs:e,gitdir:t,oid:i}):void 0;let l=s?i:void 0;return s||await gn({fs:e,gitdir:t,currentFilepath:a},async()=>{const c=o.isSymbolicLink()?await e.readlink(a).then(Fu):await e.read(a);if(c===null)throw new Oe(a);l=await ut({fs:e,gitdir:t,type:"blob",object:c})}),l}async function Jy({fs:e,dir:t,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){const o=await Promise.all(a.children.map(i));a.oid=await hi({fs:e,gitdir:r,tree:o}),a.mode=16384}}else a.type==="blob"&&(a.oid=await Ky(e,r,t,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function vf({fs:e,dir:t,gitdir:r,treePair:n}){const i=n[1]==="stage",a=n.map(m=>typeof m=="string"?Vy[m]():m),o=[],u=await hr({fs:e,cache:{},dir:t,gitdir:r,trees:a,map:async(m,[g,b])=>{if(!(m==="."||await hn.isIgnored({fs:e,dir:t,gitdir:r,filepath:m}))&&b)return(!g||await g.oid()!==await b.oid()&&await b.oid()!==void 0)&&o.push([g,b]),{mode:await b.mode(),path:m,oid:await b.oid(),type:await b.type()}},reduce:async(m,g)=>(g=g.filter(Boolean),m?(m.children=g,m):g.length>0?g:void 0),iterate:async(m,g)=>{const b=[];for(const v of g){const[y,_]=v;i?_&&(await e.exists(`${t}/${_.toString()}`)?b.push(v):o.push([null,_])):y&&(_?b.push(v):o.push([y,null]))}return b.length?Promise.all(b.map(m)):[]}});if(o.length===0||u.length===0)return null;const p=(await Jy({fs:e,dir:t,gitdir:r,entries:u})).filter(Boolean).map(m=>({mode:m.mode,path:m.path,oid:m.oid,type:m.type}));return hi({fs:e,gitdir:r,tree:p})}async function Qy({fs:e,dir:t,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){const o=[],s=[],l=await hr({fs:e,cache:{},dir:t,gitdir:r,trees:[xt({ref:i}),xt({ref:n})],map:async(c,[u,d])=>{if(c==="."||await hn.isIgnored({fs:e,dir:t,gitdir:r,filepath:c}))return;const p=d?await d.type():await u.type();if(p!=="tree"&&p!=="blob")return;if(!d&&u){const g=p==="tree"?"rmdir":"rm";return p==="tree"&&o.push(c),p==="blob"&&a&&s.push({filepath:c,oid:await u.oid()}),{method:g,filepath:c}}const m=await d.oid();if(!u||await u.oid()!==m)return p==="tree"?{method:"mkdir",filepath:c}:(a&&s.push({filepath:c,oid:m,stats:await e.lstat(N.join(t,c))}),{method:"write",filepath:c,oid:m})}});await gn({fs:e,gitdir:r,dirRemoved:o,ops:l},async()=>{for(const c of l){const u=N.join(t,c.filepath);switch(c.method){case"rmdir":await e.rmdir(u);break;case"mkdir":await e.mkdir(u);break;case"rm":await e.rm(u);break;case"write":if(!o.some(d=>u.startsWith(d))){const{object:d}=await Ae({fs:e,cache:{},gitdir:r,oid:c.oid});await e.exists(u)&&await e.rm(u),await e.write(u,d)}break}}}),await He.acquire({fs:e,gitdir:r,cache:{}},async c=>{s.forEach(({filepath:u,stats:d,oid:p})=>{c.insert({filepath:u,stats:d,oid:p})})})}class Jt{constructor({fs:t,dir:r,gitdir:n=N.join(r,".git")}){Object.assign(this,{fs:t,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return N.join(this.gitdir,Jt.refStash)}get refLogsStashPath(){return N.join(this.gitdir,Jt.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await pr({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Xe("author");return this._author}async getStashSHA(t,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[t].split(" ")[1]:null}async writeStashCommit({message:t,tree:r,parent:n}){return _f({fs:this.fs,gitdir:this.gitdir,commit:{message:t,tree:r,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(t){const r=await this.readStashReflogs({parsed:!1});if(t!==0&&(t<0||t>r.length-1))throw new Ct(`stash@${t}`,"number that is in range of [0, num of stash pushed]");const n=await this.getStashSHA(t,r);return n?mn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(t){return H.writeRef({fs:this.fs,gitdir:this.gitdir,ref:Jt.refStash,value:t})}async writeStashReflogEntry({stashCommit:t,message:r}){const n=await this.getAuthor(),i=ua.createStashReflogEntry(n,t,r),a=this.refLogsStashPath;await gn({filepath:a,entry:i},async()=>{const o=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,o+i,"utf8")})}async readStashReflogs({parsed:t=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];const n=(await this.fs.read(this.refLogsStashPath)).toString();return ua.getStashReflogEntry(n,t)}}async function eb({fs:e,dir:t,gitdir:r,message:n=""}){const i=new Jt({fs:e,dir:t,gitdir:r});await i.getAuthor();const a=await mr({fs:e,gitdir:r,fullname:!1}),o=await H.resolve({fs:e,gitdir:r,ref:"HEAD"}),l=(await yf({fs:e,dir:t,gitdir:r,oid:o})).commit.message,c=[o];let u=null,d=xt({ref:"HEAD"});const p=await vf({fs:e,dir:t,gitdir:r,treePair:[xt({ref:"HEAD"}),"stage"]});if(p){const v=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:p,parent:c});c.push(v),u=p,d=nn()}const m=await vf({fs:e,dir:t,gitdir:r,treePair:[d,"workdir"]});if(m){const v=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:m,parent:[c[c.length-1]]});c.push(v),u=m}if(!u||!p&&!m)throw new Oe("changes, nothing to stash");const g=(n.trim()||`WIP on ${a}`)+`: ${o.substring(0,7)} ${l}`,b=await i.writeStashCommit({message:g,tree:u,parent:c});return await i.writeStashRef(b),await i.writeStashReflogEntry({stashCommit:b,message:g}),await Zu({fs:e,dir:t,gitdir:r,ref:a,track:!1,force:!0}),b}async function xf({fs:e,dir:t,gitdir:r,refIdx:n=0}){const a=await new Jt({fs:e,dir:t,gitdir:r}).readStashCommit(n),{parent:o=null}=a.commit?a.commit:{};if(!(!o||!Array.isArray(o)))for(let s=0;s<o.length-1;s++){const c=(await mn({fs:e,cache:{},gitdir:r,oid:o[s+1]})).commit.message.startsWith("stash-Index");await Qy({fs:e,dir:t,gitdir:r,stashCommit:o[s+1],parentCommit:o[s],wasStaged:c})}}async function Ef({fs:e,dir:t,gitdir:r,refIdx:n=0}){const i=new Jt({fs:e,dir:t,gitdir:r});if(!(await i.readStashCommit(n)).commit)return;const o=i.refStashPath;await gn(o,async()=>{await e.exists(o)&&await e.rm(o)});const s=await i.readStashReflogs({parsed:!1});if(!s.length)return;s.splice(n,1);const l=i.refLogsStashPath;await gn({reflogEntries:s,stashReflogPath:l,stashMgr:i},async()=>{if(s.length){await e.write(l,s.join(`
98
+ `),"utf8");const c=s[s.length-1].split(" ")[1];await i.writeStashRef(c)}else await e.rm(l)})}async function tb({fs:e,dir:t,gitdir:r}){return new Jt({fs:e,dir:t,gitdir:r}).readStashReflogs({parsed:!0})}async function rb({fs:e,dir:t,gitdir:r}){const n=new Jt({fs:e,dir:t,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await gn(i,async()=>{await Promise.all(i.map(async a=>{if(await e.exists(a))return e.rm(a)}))})}async function nb({fs:e,dir:t,gitdir:r,refIdx:n=0}){await xf({fs:e,dir:t,gitdir:r,refIdx:n}),await Ef({fs:e,dir:t,gitdir:r,refIdx:n})}async function ib({fs:e,dir:t,gitdir:r=N.join(t,".git"),op:n="push",message:i="",refIdx:a=0}){P("fs",e),P("dir",t),P("gitdir",r),P("op",n);const o={push:eb,apply:xf,drop:Ef,list:tb,clear:rb,pop:nb},s=["apply","drop","pop"];try{const l=new K(e);["refs","logs","logs/refs"].map(d=>N.join(r,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});const u=o[n];if(u){if(s.includes(n)&&a<0)throw new Ct(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await u({fs:l,dir:t,gitdir:r,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function ab({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{P("fs",e),P("gitdir",r),P("filepath",n);const a=new K(e);if(await hn.isIgnored({fs:a,gitdir:r,dir:t,filepath:n}))return"ignored";const s=await ob({fs:a,cache:i,gitdir:r}),l=await Sf({fs:a,cache:i,gitdir:r,tree:s,path:n}),c=await He.acquire({fs:a,gitdir:r,cache:i},async function(b){for(const v of b)if(v.path===n)return v;return null}),u=await a.lstat(N.join(t,n)),d=l!==null,p=c!==null,m=u!==null,g=async()=>{if(p&&!Xi(c,u))return c.oid;{const b=await a.read(N.join(t,n)),v=await bf({gitdir:r,type:"blob",object:b});return p&&c.oid===v&&u.size!==-1&&He.acquire({fs:a,gitdir:r,cache:i},async function(y){y.insert({filepath:n,stats:u,oid:v})}),v}};if(!d&&!m&&!p)return"absent";if(!d&&!m&&p)return"*absent";if(!d&&m&&!p)return"*added";if(!d&&m&&p)return await g()===c.oid?"added":"*added";if(d&&!m&&!p)return"deleted";if(d&&!m&&p)return l===c.oid,"*deleted";if(d&&m&&!p)return await g()===l?"*undeleted":"*undeletemodified";if(d&&m&&p){const b=await g();return b===l?b===c.oid?"unmodified":"*unmodified":b===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function Sf({fs:e,cache:t,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));const a=i.shift();for(const o of n)if(o.path===a){if(i.length===0)return o.oid;const{type:s,object:l}=await Ae({fs:e,cache:t,gitdir:r,oid:o.oid});if(s==="tree"){const c=ct.from(l);return Sf({fs:e,cache:t,gitdir:r,tree:c,path:i})}if(s==="blob")throw new rt(o.oid,s,"blob",i.join("/"))}return null}async function ob({fs:e,cache:t,gitdir:r}){let n;try{n=await H.resolve({fs:e,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Oe)return[]}const{tree:i}=await wn({fs:e,cache:t,gitdir:r,oid:n});return i}async function sb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:o={},ignored:s=!1}){try{P("fs",e),P("gitdir",r),P("ref",n);const l=new K(e);return await hr({fs:l,cache:o,dir:t,gitdir:r,trees:[xt({ref:n}),ui(),nn()],map:async function(c,[u,d,p]){if(!u&&!p&&d&&!s&&await hn.isIgnored({fs:l,dir:t,filepath:c})||!i.some(O=>Yu(c,O)))return null;if(a&&!a(c))return;const[m,g,b]=await Promise.all([u&&u.type(),d&&d.type(),p&&p.type()]),v=[m,g,b].includes("blob");if((m==="tree"||m==="special")&&!v)return;if(m==="commit")return null;if((g==="tree"||g==="special")&&!v)return;if(b==="commit")return null;if((b==="tree"||b==="special")&&!v)return;const y=m==="blob"?await u.oid():void 0,_=b==="blob"?await p.oid():void 0;let R;m!=="blob"&&g==="blob"&&b!=="blob"?R="42":g==="blob"&&(R=await d.oid());const C=[void 0,y,R,_],x=C.map(O=>C.indexOf(O));return x.shift(),[c,...x]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function cb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,force:a=!1}){try{P("fs",e),P("gitdir",r),P("ref",n);const o=new K(e);if(n===void 0)throw new lt("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;const s=await H.resolve({fs:o,gitdir:r,ref:i||"HEAD"});if(!a&&await H.exists({fs:o,gitdir:r,ref:n}))throw new Ot("tag",n);await H.writeRef({fs:o,gitdir:r,ref:n,value:s})}catch(o){throw o.caller="git.tag",o}}async function lb({fs:e,dir:t,gitdir:r=N.join(t,".git"),cache:n={},filepath:i,oid:a,mode:o,add:s,remove:l,force:c}){try{P("fs",e),P("gitdir",r),P("filepath",i);const u=new K(e);if(l)return await He.acquire({fs:u,gitdir:r,cache:n},async function(p){let m;if(!c&&(m=await u.lstat(N.join(t,i)),m)){if(m.isDirectory())throw new fr("directory");return}p.has({filepath:i})&&p.delete({filepath:i})});let d;if(!a){if(d=await u.lstat(N.join(t,i)),!d)throw new Oe(`file at "${i}" on disk and "remove" not set`);if(d.isDirectory())throw new fr("directory")}return await He.acquire({fs:u,gitdir:r,cache:n},async function(p){if(!s&&!p.has({filepath:i}))throw new Oe(`file at "${i}" in index and "add" not set`);let m={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};if(!a){m=d;const g=m.isSymbolicLink()?await u.readlink(N.join(t,i)):await u.read(N.join(t,i));a=await ut({fs:u,gitdir:r,type:"blob",format:"content",object:g})}return p.insert({filepath:i,oid:a,stats:m}),a})}catch(u){throw u.caller="git.updateIndex",u}}function ub(){try{return ca.version}catch(e){throw e.caller="git.version",e}}async function fb({fs:e,dir:t,gitdir:r=N.join(t,".git"),trees:n,map:i,reduce:a,iterate:o,cache:s={}}){try{return P("fs",e),P("gitdir",r),P("trees",n),await hr({fs:new K(e),cache:s,dir:t,gitdir:r,trees:n,map:i,reduce:a,iterate:o})}catch(l){throw l.caller="git.walk",l}}async function db({fs:e,dir:t,gitdir:r=N.join(t,".git"),blob:n}){try{return P("fs",e),P("gitdir",r),P("blob",n),await ut({fs:new K(e),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function hb({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n}){try{return P("fs",e),P("gitdir",r),P("commit",n),await _f({fs:new K(e),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function pb({fs:e,dir:t,gitdir:r=N.join(t,".git"),type:n,object:i,format:a="parsed",oid:o,encoding:s=void 0}){try{const l=new K(e);if(a==="parsed"){switch(n){case"commit":i=De.from(i).toObject();break;case"tree":i=ct.from(i).toObject();break;case"blob":i=Buffer.from(i,s);break;case"tag":i=nt.from(i).toObject();break;default:throw new rt(o||"",n,"blob|commit|tag|tree")}a="content"}return o=await ut({fs:l,gitdir:r,type:n,object:i,oid:o,format:a}),o}catch(l){throw l.caller="git.writeObject",l}}async function mb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,value:i,force:a=!1,symbolic:o=!1}){try{P("fs",e),P("gitdir",r),P("ref",n),P("value",i);const s=new K(e);if(n!==Mt.clean(n))throw new Ct(n,Mt.clean(n));if(!a&&await H.exists({fs:s,gitdir:r,ref:n}))throw new Ot("ref",n);o?await H.writeSymbolicRef({fs:s,gitdir:r,ref:n,value:i}):(i=await H.resolve({fs:s,gitdir:r,ref:i}),await H.writeRef({fs:s,gitdir:r,ref:n,value:i}))}catch(s){throw s.caller="git.writeRef",s}}async function wb({fs:e,gitdir:t,tag:r}){const n=nt.from(r).toObject();return await ut({fs:e,gitdir:t,type:"tag",object:n,format:"content"})}async function gb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tag:n}){try{return P("fs",e),P("gitdir",r),P("tag",n),await wb({fs:new K(e),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function yb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tree:n}){try{return P("fs",e),P("gitdir",r),P("tree",n),await hi({fs:new K(e),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var it={Errors:Gw,STAGE:nn,TREE:xt,WORKDIR:ui,add:ug,abortMerge:og,addNote:dg,addRemote:hg,annotatedTag:mg,branch:gg,checkout:Zu,clone:Pg,commit:Tg,getConfig:Kg,getConfigAll:Qg,setConfig:Xy,currentBranch:Ag,deleteBranch:$g,deleteRef:Ig,deleteRemote:Bg,deleteTag:Ng,expandOid:Ug,expandRef:Hg,fastForward:Yg,fetch:Zg,findMergeBase:Xg,findRoot:Vg,getRemoteInfo:ey,getRemoteInfo2:ty,hashBlob:ny,indexPack:ay,init:oy,isDescendent:sy,isIgnored:cy,listBranches:ly,listFiles:fy,listNotes:hy,listRefs:py,listRemotes:wy,listServerRefs:by,listTags:_y,log:Sy,merge:ky,packObjects:Cy,pull:Py,push:Iy,readBlob:jy,readCommit:yf,readNote:zy,readObject:Ny,readTag:Ly,readTree:Fy,remove:Uy,removeNote:Wy,renameBranch:Gy,resetIndex:Yy,updateIndex:lb,resolveRef:Zy,status:ab,statusMatrix:sb,tag:cb,version:ub,walk:fb,writeBlob:db,writeCommit:hb,writeObject:pb,writeRef:mb,writeTag:gb,writeTree:yb,stash:ib};const bb=async e=>{try{return await(await window.pfs.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}},kf=async e=>await window.pfs.readdir(e),Rf=async e=>{let t=window.pfs,r;try{r=await t.stat(e)}catch(n){console.debug("recursiveRm: Path does not exist",n);return}if(r.type==="file")await t.unlink(e),console.debug(`recursiveRm: Deleted file: ${e}`);else if(r.type==="dir"){const n=await t.readdir(e);for(const i of n)await Rf(`${e}/${i}`);await t.rmdir(e),console.debug(`recursiveRm: Deleted directory: ${e}`)}},_b=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`,n="makeinfinite_client",i="makeinfinite_client@spaceandtime.io";await it.setConfig({fs:t,dir:r,path:"user.name",value:n}),await it.setConfig({fs:t,dir:r,path:"user.email",value:i})},vb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await it.clone({fs:r,http:to,dir:n,url:t,ref:"main"}),await _b(e)},xb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await it.pull({fs:r,http:to,dir:n,url:t,ref:"main"})},Eb=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`,n=await it.resolveRef({fs:t,dir:r,ref:"refs/tags/published"});await it.checkout({fs:t,dir:r,ref:n})},Sb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await it.fetch({fs:r,http:to,dir:n,url:t,ref:"main",tags:!0,pruneTags:!0})};class kb{constructor(t,r,n){this.targetRef=t,this.sourceRef=r,this.opType=n}}const os=e=>{var o,s;const t=e.commit.message.trim().split(`
99
+ `),r=t.find(l=>l.startsWith("Git Ref: ")),n=t.find(l=>l.startsWith("Extra Metadata: "));if(!r||!n)return null;const i=(o=r.split("Git Ref: ")[1])==null?void 0:o.trim(),a=JSON.parse(((s=n.split("Extra Metadata: ")[1])==null?void 0:s.trim())||"{}");return!i||!a?null:new kb(i,a.sourceRef,a.opType)},Rb=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`;return await it.resolveRef({fs:t,dir:r,ref:"HEAD"})},Of=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`,i={fs:r,dir:n,ref:"HEAD",depth:1,filepath:t},a=(await it.log(i))[0];if(!a)throw new Error("No commit found");return a.oid},fa=async(e,t,r,n,i=new Set,a=1e3)=>{if(a<=0)throw new Error(`Maximum recursion depth reached while resolving commit: ${r}`);const o=window.pfs,s=`${window.miDir}/${e}`,l={fs:o,dir:s,ref:r,depth:1,filepath:t},c=(await it.log(l))[0];if(!c)throw new Error("No commit found");if(i.has(c.oid))throw new Error(`Circular reference detected: ${c.oid} has already been seen`);i.add(c.oid);const u=os(c);if(u&&u.opType==n)return fa(e,t,u.targetRef,n,i,a-1);if(c.commit.parent.length>1){const d=c.commit.parent[0];if(!d)throw new Error("No parent found");return fa(e,t,d,n,i,a-1)}return c},Ob=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`,i=await Of(e,t),a=await fa(e,t,i,"UNDO"),o=os(a);if(o)return[i,o.sourceRef];{let s=a.oid;const l={fs:r,dir:n,ref:s,depth:2,filepath:t},c=await it.log(l);if(!c[1])throw new Error("No previous commit found");const u=c[1].oid;return[i,u]}},Cb=async(e,t)=>{const r=await Of(e,t),n=await fa(e,t,r,"REDO"),i=os(n);if(!i)throw new Error("No undos to redo");return[r,i.sourceRef]},Pb=async(e,t)=>{await bb(`${window.miDir}/${e}`)||await vb(e,t);try{await xb(e,t)}catch(n){throw await Rf(`${window.miDir}/${e}`).catch(i=>console.log(`recursiveRm error: ${i}`)),n}},Cf=async(e,t)=>{let r=0;const n=5;for(;r<=n;)try{await Pb(e||"",t||"");break}catch(i){if(r++,console.log(`Retrying syncGitSource (Attempt ${r})`),r>n)throw console.error(`syncGitSource failed after ${r} attempts:`,i),i}},ss=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await Sb(e,t);const i=await it.listTags({fs:r,dir:n});return await Promise.all(i.map(async o=>{const s=await it.resolveRef({fs:r,dir:n,ref:`refs/tags/${o}`});let l=null;try{l=(await it.readTag({fs:r,dir:n,oid:s})).tag.object}catch{l=s}const{commit:c}=await it.readCommit({fs:r,dir:n,oid:s});return{tag:o,targetCommitTimestamp:c.committer.timestamp,targetCommit:l,ref:`refs/tags/${o}`}}))};var Pf={exports:{}},wi={};/*
100
100
  object-assign
101
101
  (c) Sindre Sorhus
102
102
  @license MIT
@@ -107,17 +107,17 @@ object-assign
107
107
  *
108
108
  * This source code is licensed under the MIT license found in the
109
109
  * LICENSE file in the root directory of this source tree.
110
- */var Ib=re,Af=60103;if(wi.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var Df=Symbol.for;Af=Df("react.element"),wi.Fragment=Df("react.fragment")}var Bb=Ib.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,jb=Object.prototype.hasOwnProperty,zb={key:!0,ref:!0,__self:!0,__source:!0};function $f(e,t,r){var n,i={},a=null,o=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)jb.call(t,n)&&!zb.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:Af,type:e,key:a,ref:o,props:i,_owner:Bb.current}}wi.jsx=$f,wi.jsxs=$f,Pf.exports=wi;var ye=Pf.exports,If={exports:{}},Se={};/** @license React v16.13.1
110
+ */var Ib=Q,Af=60103;if(wi.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var Df=Symbol.for;Af=Df("react.element"),wi.Fragment=Df("react.fragment")}var jb=Ib.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Bb=Object.prototype.hasOwnProperty,zb={key:!0,ref:!0,__self:!0,__source:!0};function $f(e,t,r){var n,i={},a=null,o=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)Bb.call(t,n)&&!zb.hasOwnProperty(n)&&(i[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)i[n]===void 0&&(i[n]=t[n]);return{$$typeof:Af,type:e,key:a,ref:o,props:i,_owner:jb.current}}wi.jsx=$f,wi.jsxs=$f,Pf.exports=wi;var ye=Pf.exports,If={exports:{}},ke={};/** @license React v16.13.1
111
111
  * react-is.production.min.js
112
112
  *
113
113
  * Copyright (c) Facebook, Inc. and its affiliates.
114
114
  *
115
115
  * This source code is licensed under the MIT license found in the
116
116
  * LICENSE file in the root directory of this source tree.
117
- */var We=typeof Symbol=="function"&&Symbol.for,ss=We?Symbol.for("react.element"):60103,cs=We?Symbol.for("react.portal"):60106,da=We?Symbol.for("react.fragment"):60107,ha=We?Symbol.for("react.strict_mode"):60108,pa=We?Symbol.for("react.profiler"):60114,ma=We?Symbol.for("react.provider"):60109,wa=We?Symbol.for("react.context"):60110,ls=We?Symbol.for("react.async_mode"):60111,ga=We?Symbol.for("react.concurrent_mode"):60111,ya=We?Symbol.for("react.forward_ref"):60112,ba=We?Symbol.for("react.suspense"):60113,Nb=We?Symbol.for("react.suspense_list"):60120,va=We?Symbol.for("react.memo"):60115,_a=We?Symbol.for("react.lazy"):60116,Mb=We?Symbol.for("react.block"):60121,Lb=We?Symbol.for("react.fundamental"):60117,Fb=We?Symbol.for("react.responder"):60118,Ub=We?Symbol.for("react.scope"):60119;function mt(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case ss:switch(e=e.type,e){case ls:case ga:case da:case pa:case ha:case ba:return e;default:switch(e=e&&e.$$typeof,e){case wa:case ya:case _a:case va:case ma:return e;default:return t}}case cs:return t}}}function Bf(e){return mt(e)===ga}Se.AsyncMode=ls,Se.ConcurrentMode=ga,Se.ContextConsumer=wa,Se.ContextProvider=ma,Se.Element=ss,Se.ForwardRef=ya,Se.Fragment=da,Se.Lazy=_a,Se.Memo=va,Se.Portal=cs,Se.Profiler=pa,Se.StrictMode=ha,Se.Suspense=ba,Se.isAsyncMode=function(e){return Bf(e)||mt(e)===ls},Se.isConcurrentMode=Bf,Se.isContextConsumer=function(e){return mt(e)===wa},Se.isContextProvider=function(e){return mt(e)===ma},Se.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===ss},Se.isForwardRef=function(e){return mt(e)===ya},Se.isFragment=function(e){return mt(e)===da},Se.isLazy=function(e){return mt(e)===_a},Se.isMemo=function(e){return mt(e)===va},Se.isPortal=function(e){return mt(e)===cs},Se.isProfiler=function(e){return mt(e)===pa},Se.isStrictMode=function(e){return mt(e)===ha},Se.isSuspense=function(e){return mt(e)===ba},Se.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===da||e===ga||e===pa||e===ha||e===ba||e===Nb||typeof e=="object"&&e!==null&&(e.$$typeof===_a||e.$$typeof===va||e.$$typeof===ma||e.$$typeof===wa||e.$$typeof===ya||e.$$typeof===Lb||e.$$typeof===Fb||e.$$typeof===Ub||e.$$typeof===Mb)},Se.typeOf=mt,If.exports=Se;var us=If.exports;function Hb(e){function t(F,q,W,ee,I){for(var Q=0,$=0,G=0,X=0,Y,L,V=0,te=0,J,ce=J=Y=0,ne=0,ie=0,ke=0,xe=0,Et=W.length,Ue=Et-1,Pe,oe="",Ee="",Oi="",w="",f;ne<Et;){if(L=W.charCodeAt(ne),ne===Ue&&$+X+G+Q!==0&&($!==0&&(L=$===47?10:47),X=G=Q=0,Et++,Ue++),$+X+G+Q===0){if(ne===Ue&&(0<ie&&(oe=oe.replace(p,"")),0<oe.trim().length)){switch(L){case 32:case 9:case 59:case 13:case 10:break;default:oe+=W.charAt(ne)}L=59}switch(L){case 123:for(oe=oe.trim(),Y=oe.charCodeAt(0),J=1,xe=++ne;ne<Et;){switch(L=W.charCodeAt(ne)){case 123:J++;break;case 125:J--;break;case 47:switch(L=W.charCodeAt(ne+1)){case 42:case 47:e:{for(ce=ne+1;ce<Ue;++ce)switch(W.charCodeAt(ce)){case 47:if(L===42&&W.charCodeAt(ce-1)===42&&ne+2!==ce){ne=ce+1;break e}break;case 10:if(L===47){ne=ce+1;break e}}ne=ce}}break;case 91:L++;case 40:L++;case 34:case 39:for(;ne++<Ue&&W.charCodeAt(ne)!==L;);}if(J===0)break;ne++}switch(J=W.substring(xe,ne),Y===0&&(Y=(oe=oe.replace(d,"").trim()).charCodeAt(0)),Y){case 64:switch(0<ie&&(oe=oe.replace(p,"")),L=oe.charCodeAt(1),L){case 100:case 109:case 115:case 45:ie=q;break;default:ie=$e}if(J=t(q,ie,J,L,I+1),xe=J.length,0<_e&&(ie=r($e,oe,ke),f=s(3,J,ie,q,U,M,xe,L,I,ee),oe=ie.join(""),f!==void 0&&(xe=(J=f.trim()).length)===0&&(L=0,J="")),0<xe)switch(L){case 115:oe=oe.replace(C,o);case 100:case 109:case 45:J=oe+"{"+J+"}";break;case 107:oe=oe.replace(_,"$1 $2"),J=oe+"{"+J+"}",J=de===1||de===2&&a("@"+J,3)?"@-webkit-"+J+"@"+J:"@"+J;break;default:J=oe+J,ee===112&&(J=(Ee+=J,""))}else J="";break;default:J=t(q,r(q,oe,ke),J,ee,I+1)}Oi+=J,J=ke=ie=ce=Y=0,oe="",L=W.charCodeAt(++ne);break;case 125:case 59:if(oe=(0<ie?oe.replace(p,""):oe).trim(),1<(xe=oe.length))switch(ce===0&&(Y=oe.charCodeAt(0),Y===45||96<Y&&123>Y)&&(xe=(oe=oe.replace(" ",":")).length),0<_e&&(f=s(1,oe,q,F,U,M,Ee.length,ee,I,ee))!==void 0&&(xe=(oe=f.trim()).length)===0&&(oe="\0\0"),Y=oe.charCodeAt(0),L=oe.charCodeAt(1),Y){case 0:break;case 64:if(L===105||L===99){w+=oe+W.charAt(ne);break}default:oe.charCodeAt(xe-1)!==58&&(Ee+=i(oe,Y,L,oe.charCodeAt(2)))}ke=ie=ce=Y=0,oe="",L=W.charCodeAt(++ne)}}switch(L){case 13:case 10:$===47?$=0:1+Y===0&&ee!==107&&0<oe.length&&(ie=1,oe+="\0"),0<_e*Qe&&s(0,oe,q,F,U,M,Ee.length,ee,I,ee),M=1,U++;break;case 59:case 125:if($+X+G+Q===0){M++;break}default:switch(M++,Pe=W.charAt(ne),L){case 9:case 32:if(X+Q+$===0)switch(V){case 44:case 58:case 9:case 32:Pe="";break;default:L!==32&&(Pe=" ")}break;case 0:Pe="\\0";break;case 12:Pe="\\f";break;case 11:Pe="\\v";break;case 38:X+$+Q===0&&(ie=ke=1,Pe="\f"+Pe);break;case 108:if(X+$+Q+Z===0&&0<ce)switch(ne-ce){case 2:V===112&&W.charCodeAt(ne-3)===58&&(Z=V);case 8:te===111&&(Z=te)}break;case 58:X+$+Q===0&&(ce=ne);break;case 44:$+G+X+Q===0&&(ie=1,Pe+="\r");break;case 34:case 39:$===0&&(X=X===L?0:X===0?L:X);break;case 91:X+$+G===0&&Q++;break;case 93:X+$+G===0&&Q--;break;case 41:X+$+Q===0&&G--;break;case 40:if(X+$+Q===0){if(Y===0)switch(2*V+3*te){case 533:break;default:Y=1}G++}break;case 64:$+G+X+Q+ce+J===0&&(J=1);break;case 42:case 47:if(!(0<X+Q+G))switch($){case 0:switch(2*L+3*W.charCodeAt(ne+1)){case 235:$=47;break;case 220:xe=ne,$=42}break;case 42:L===47&&V===42&&xe+2!==ne&&(W.charCodeAt(xe+2)===33&&(Ee+=W.substring(xe,ne+1)),Pe="",$=0)}}$===0&&(oe+=Pe)}te=V,V=L,ne++}if(xe=Ee.length,0<xe){if(ie=q,0<_e&&(f=s(2,Ee,ie,F,U,M,xe,ee,I,ee),f!==void 0&&(Ee=f).length===0))return w+Ee+Oi;if(Ee=ie.join(",")+"{"+Ee+"}",de*Z!==0){switch(de!==2||a(Ee,2)||(Z=0),Z){case 111:Ee=Ee.replace(S,":-moz-$1")+Ee;break;case 112:Ee=Ee.replace(k,"::-webkit-input-$1")+Ee.replace(k,"::-moz-$1")+Ee.replace(k,":-ms-input-$1")+Ee}Z=0}}return w+Ee+Oi}function r(F,q,W){var ee=q.trim().split(x);q=ee;var I=ee.length,Q=F.length;switch(Q){case 0:case 1:var $=0;for(F=Q===0?"":F[0]+" ";$<I;++$)q[$]=n(F,q[$],W).trim();break;default:var G=$=0;for(q=[];$<I;++$)for(var X=0;X<Q;++X)q[G++]=n(F[X]+" ",ee[$],W).trim()}return q}function n(F,q,W){var ee=q.charCodeAt(0);switch(33>ee&&(ee=(q=q.trim()).charCodeAt(0)),ee){case 38:return q.replace(b,"$1"+F.trim());case 58:return F.trim()+q.replace(b,"$1"+F.trim());default:if(0<1*W&&0<q.indexOf("\f"))return q.replace(b,(F.charCodeAt(0)===58?"":"$1")+F.trim())}return F+q}function i(F,q,W,ee){var I=F+";",Q=2*q+3*W+4*ee;if(Q===944){F=I.indexOf(":",9)+1;var $=I.substring(F,I.length-1).trim();return $=I.substring(0,F).trim()+$+";",de===1||de===2&&a($,1)?"-webkit-"+$+$:$}if(de===0||de===2&&!a(I,1))return I;switch(Q){case 1015:return I.charCodeAt(10)===97?"-webkit-"+I+I:I;case 951:return I.charCodeAt(3)===116?"-webkit-"+I+I:I;case 963:return I.charCodeAt(5)===110?"-webkit-"+I+I:I;case 1009:if(I.charCodeAt(4)!==100)break;case 969:case 942:return"-webkit-"+I+I;case 978:return"-webkit-"+I+"-moz-"+I+I;case 1019:case 983:return"-webkit-"+I+"-moz-"+I+"-ms-"+I+I;case 883:if(I.charCodeAt(8)===45)return"-webkit-"+I+I;if(0<I.indexOf("image-set(",11))return I.replace(j,"$1-webkit-$2")+I;break;case 932:if(I.charCodeAt(4)===45)switch(I.charCodeAt(5)){case 103:return"-webkit-box-"+I.replace("-grow","")+"-webkit-"+I+"-ms-"+I.replace("grow","positive")+I;case 115:return"-webkit-"+I+"-ms-"+I.replace("shrink","negative")+I;case 98:return"-webkit-"+I+"-ms-"+I.replace("basis","preferred-size")+I}return"-webkit-"+I+"-ms-"+I+I;case 964:return"-webkit-"+I+"-ms-flex-"+I+I;case 1023:if(I.charCodeAt(8)!==99)break;return $=I.substring(I.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+$+"-webkit-"+I+"-ms-flex-pack"+$+I;case 1005:return g.test(I)?I.replace(m,":-webkit-")+I.replace(m,":-moz-")+I:I;case 1e3:switch($=I.substring(13).trim(),q=$.indexOf("-")+1,$.charCodeAt(0)+$.charCodeAt(q)){case 226:$=I.replace(y,"tb");break;case 232:$=I.replace(y,"tb-rl");break;case 220:$=I.replace(y,"lr");break;default:return I}return"-webkit-"+I+"-ms-"+$+I;case 1017:if(I.indexOf("sticky",9)===-1)break;case 975:switch(q=(I=F).length-10,$=(I.charCodeAt(q)===33?I.substring(0,q):I).substring(F.indexOf(":",7)+1).trim(),Q=$.charCodeAt(0)+($.charCodeAt(7)|0)){case 203:if(111>$.charCodeAt(8))break;case 115:I=I.replace($,"-webkit-"+$)+";"+I;break;case 207:case 102:I=I.replace($,"-webkit-"+(102<Q?"inline-":"")+"box")+";"+I.replace($,"-webkit-"+$)+";"+I.replace($,"-ms-"+$+"box")+";"+I}return I+";";case 938:if(I.charCodeAt(5)===45)switch(I.charCodeAt(6)){case 105:return $=I.replace("-items",""),"-webkit-"+I+"-webkit-box-"+$+"-ms-flex-"+$+I;case 115:return"-webkit-"+I+"-ms-flex-item-"+I.replace(R,"")+I;default:return"-webkit-"+I+"-ms-flex-line-pack"+I.replace("align-content","").replace(R,"")+I}break;case 973:case 989:if(I.charCodeAt(3)!==45||I.charCodeAt(4)===122)break;case 931:case 953:if(D.test(F)===!0)return($=F.substring(F.indexOf(":")+1)).charCodeAt(0)===115?i(F.replace("stretch","fill-available"),q,W,ee).replace(":fill-available",":stretch"):I.replace($,"-webkit-"+$)+I.replace($,"-moz-"+$.replace("fill-",""))+I;break;case 962:if(I="-webkit-"+I+(I.charCodeAt(5)===102?"-ms-"+I:"")+I,W+ee===211&&I.charCodeAt(13)===105&&0<I.indexOf("transform",10))return I.substring(0,I.indexOf(";",27)+1).replace(v,"$1-webkit-$2")+I}return I}function a(F,q){var W=F.indexOf(q===1?":":"{"),ee=F.substring(0,q!==3?W:10);return W=F.substring(W+1,F.length-1),Je(q!==2?ee:ee.replace(A,"$1"),W,q)}function o(F,q){var W=i(q,q.charCodeAt(0),q.charCodeAt(1),q.charCodeAt(2));return W!==q+";"?W.replace(O," or ($1)").substring(4):"("+q+")"}function s(F,q,W,ee,I,Q,$,G,X,Y){for(var L=0,V=q,te;L<_e;++L)switch(te=ge[L].call(u,F,V,W,ee,I,Q,$,G,X,Y)){case void 0:case!1:case!0:case null:break;default:V=te}if(V!==q)return V}function l(F){switch(F){case void 0:case null:_e=ge.length=0;break;default:if(typeof F=="function")ge[_e++]=F;else if(typeof F=="object")for(var q=0,W=F.length;q<W;++q)l(F[q]);else Qe=!!F|0}return l}function c(F){return F=F.prefix,F!==void 0&&(Je=null,F?typeof F!="function"?de=1:(de=2,Je=F):de=0),c}function u(F,q){var W=F;if(33>W.charCodeAt(0)&&(W=W.trim()),fe=W,W=[fe],0<_e){var ee=s(-1,q,W,W,U,M,0,0,0,0);ee!==void 0&&typeof ee=="string"&&(q=ee)}var I=t($e,W,q,0,0);return 0<_e&&(ee=s(-2,I,W,W,U,M,I.length,0,0,0),ee!==void 0&&(I=ee)),fe="",Z=0,M=U=1,I}var d=/^\0+/g,p=/[\0\r\f]/g,m=/: */g,g=/zoo|gra/,v=/([,: ])(transform)/g,x=/,\r+?/g,b=/([\t\r\n ])*\f?&/g,_=/@(k\w+)\s*(\S*)\s*/,k=/::(place)/g,S=/:(read-only)/g,y=/[svh]\w+-[tblr]{2}/,C=/\(\s*(.*)\s*\)/g,O=/([\s\S]*?);/g,R=/-self|flex-/g,A=/[^]*?(:[rp][el]a[\w-]+)[^]*/,D=/stretch|:\s*\w+\-(?:conte|avail)/,j=/([^-])(image-set\()/,M=1,U=1,Z=0,de=1,$e=[],ge=[],_e=0,Je=null,Qe=0,fe="";return u.use=l,u.set=c,e!==void 0&&c(e),u}var Wb={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function qb(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Gb=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,jf=qb(function(e){return Gb.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),fs=us,Yb={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Zb={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Xb={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},zf={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},ds={};ds[fs.ForwardRef]=Xb,ds[fs.Memo]=zf;function Nf(e){return fs.isMemo(e)?zf:ds[e.$$typeof]||Yb}var Vb=Object.defineProperty,Kb=Object.getOwnPropertyNames,Mf=Object.getOwnPropertySymbols,Jb=Object.getOwnPropertyDescriptor,Qb=Object.getPrototypeOf,Lf=Object.prototype;function Ff(e,t,r){if(typeof t!="string"){if(Lf){var n=Qb(t);n&&n!==Lf&&Ff(e,n,r)}var i=Kb(t);Mf&&(i=i.concat(Mf(t)));for(var a=Nf(e),o=Nf(t),s=0;s<i.length;++s){var l=i[s];if(!Zb[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var c=Jb(t,l);try{Vb(e,l,c)}catch{}}}}return e}var ev=Ff;const tv=St(ev);function Qt(){return(Qt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var Uf=function(e,t){for(var r=[e[0]],n=0,i=t.length;n<i;n+=1)r.push(t[n],e[n+1]);return r},hs=function(e){return e!==null&&typeof e=="object"&&(e.toString?e.toString():Object.prototype.toString.call(e))==="[object Object]"&&!us.typeOf(e)},xa=Object.freeze([]),wr=Object.freeze({});function gi(e){return typeof e=="function"}function Hf(e){return e.displayName||e.name||"Component"}function ps(e){return e&&typeof e.styledComponentId=="string"}var yn=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",ms=typeof window<"u"&&"HTMLElement"in window,rv=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""&&process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY));function yi(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw new Error("An error occurred. See https://git.io/JUIaE#"+e+" for more information."+(r.length>0?" Args: "+r.join(", "):""))}var nv=function(){function e(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r}var t=e.prototype;return t.indexOfGroup=function(r){for(var n=0,i=0;i<r;i++)n+=this.groupSizes[i];return n},t.insertRules=function(r,n){if(r>=this.groupSizes.length){for(var i=this.groupSizes,a=i.length,o=a;r>=o;)(o<<=1)<0&&yi(16,""+r);this.groupSizes=new Uint32Array(o),this.groupSizes.set(i),this.length=o;for(var s=a;s<o;s++)this.groupSizes[s]=0}for(var l=this.indexOfGroup(r+1),c=0,u=n.length;c<u;c++)this.tag.insertRule(l,n[c])&&(this.groupSizes[r]++,l++)},t.clearGroup=function(r){if(r<this.length){var n=this.groupSizes[r],i=this.indexOfGroup(r),a=i+n;this.groupSizes[r]=0;for(var o=i;o<a;o++)this.tag.deleteRule(i)}},t.getGroup=function(r){var n="";if(r>=this.length||this.groupSizes[r]===0)return n;for(var i=this.groupSizes[r],a=this.indexOfGroup(r),o=a+i,s=a;s<o;s++)n+=this.tag.getRule(s)+`/*!sc*/
118
- `;return n},e}(),Ea=new Map,Sa=new Map,bi=1,ka=function(e){if(Ea.has(e))return Ea.get(e);for(;Sa.has(bi);)bi++;var t=bi++;return Ea.set(e,t),Sa.set(t,e),t},iv=function(e){return Sa.get(e)},av=function(e,t){t>=bi&&(bi=t+1),Ea.set(e,t),Sa.set(t,e)},ov="style["+yn+'][data-styled-version="5.3.11"]',sv=new RegExp("^"+yn+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),cv=function(e,t,r){for(var n,i=r.split(","),a=0,o=i.length;a<o;a++)(n=i[a])&&e.registerName(t,n)},lv=function(e,t){for(var r=(t.textContent||"").split(`/*!sc*/
119
- `),n=[],i=0,a=r.length;i<a;i++){var o=r[i].trim();if(o){var s=o.match(sv);if(s){var l=0|parseInt(s[1],10),c=s[2];l!==0&&(av(c,l),cv(e,c,s[3]),e.getTag().insertRules(l,n)),n.length=0}else n.push(o)}}},uv=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null},Wf=function(e){var t=document.head,r=e||t,n=document.createElement("style"),i=function(s){for(var l=s.childNodes,c=l.length;c>=0;c--){var u=l[c];if(u&&u.nodeType===1&&u.hasAttribute(yn))return u}}(r),a=i!==void 0?i.nextSibling:null;n.setAttribute(yn,"active"),n.setAttribute("data-styled-version","5.3.11");var o=uv();return o&&n.setAttribute("nonce",o),r.insertBefore(n,a),n},fv=function(){function e(r){var n=this.element=Wf(r);n.appendChild(document.createTextNode("")),this.sheet=function(i){if(i.sheet)return i.sheet;for(var a=document.styleSheets,o=0,s=a.length;o<s;o++){var l=a[o];if(l.ownerNode===i)return l}yi(17)}(n),this.length=0}var t=e.prototype;return t.insertRule=function(r,n){try{return this.sheet.insertRule(n,r),this.length++,!0}catch{return!1}},t.deleteRule=function(r){this.sheet.deleteRule(r),this.length--},t.getRule=function(r){var n=this.sheet.cssRules[r];return n!==void 0&&typeof n.cssText=="string"?n.cssText:""},e}(),dv=function(){function e(r){var n=this.element=Wf(r);this.nodes=n.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(r,n){if(r<=this.length&&r>=0){var i=document.createTextNode(n),a=this.nodes[r];return this.element.insertBefore(i,a||null),this.length++,!0}return!1},t.deleteRule=function(r){this.element.removeChild(this.nodes[r]),this.length--},t.getRule=function(r){return r<this.length?this.nodes[r].textContent:""},e}(),hv=function(){function e(r){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(r,n){return r<=this.length&&(this.rules.splice(r,0,n),this.length++,!0)},t.deleteRule=function(r){this.rules.splice(r,1),this.length--},t.getRule=function(r){return r<this.length?this.rules[r]:""},e}(),qf=ms,pv={isServer:!ms,useCSSOMInjection:!rv},Gf=function(){function e(r,n,i){r===void 0&&(r=wr),n===void 0&&(n={}),this.options=Qt({},pv,{},r),this.gs=n,this.names=new Map(i),this.server=!!r.isServer,!this.server&&ms&&qf&&(qf=!1,function(a){for(var o=document.querySelectorAll(ov),s=0,l=o.length;s<l;s++){var c=o[s];c&&c.getAttribute(yn)!=="active"&&(lv(a,c),c.parentNode&&c.parentNode.removeChild(c))}}(this))}e.registerId=function(r){return ka(r)};var t=e.prototype;return t.reconstructWithOptions=function(r,n){return n===void 0&&(n=!0),new e(Qt({},this.options,{},r),this.gs,n&&this.names||void 0)},t.allocateGSInstance=function(r){return this.gs[r]=(this.gs[r]||0)+1},t.getTag=function(){return this.tag||(this.tag=(i=(n=this.options).isServer,a=n.useCSSOMInjection,o=n.target,r=i?new hv(o):a?new fv(o):new dv(o),new nv(r)));var r,n,i,a,o},t.hasNameForId=function(r,n){return this.names.has(r)&&this.names.get(r).has(n)},t.registerName=function(r,n){if(ka(r),this.names.has(r))this.names.get(r).add(n);else{var i=new Set;i.add(n),this.names.set(r,i)}},t.insertRules=function(r,n,i){this.registerName(r,n),this.getTag().insertRules(ka(r),i)},t.clearNames=function(r){this.names.has(r)&&this.names.get(r).clear()},t.clearRules=function(r){this.getTag().clearGroup(ka(r)),this.clearNames(r)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(r){for(var n=r.getTag(),i=n.length,a="",o=0;o<i;o++){var s=iv(o);if(s!==void 0){var l=r.names.get(s),c=n.getGroup(o);if(l&&c&&l.size){var u=yn+".g"+o+'[id="'+s+'"]',d="";l!==void 0&&l.forEach(function(p){p.length>0&&(d+=p+",")}),a+=""+c+u+'{content:"'+d+`"}/*!sc*/
120
- `}}}return a}(this)},e}(),mv=/(a)(d)/gi,Yf=function(e){return String.fromCharCode(e+(e>25?39:97))};function ws(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=Yf(t%52)+r;return(Yf(t%52)+r).replace(mv,"$1-$2")}var bn=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Zf=function(e){return bn(5381,e)};function wv(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(gi(r)&&!ps(r))return!1}return!0}var gv=Zf("5.3.11"),yv=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&wv(t),this.componentId=r,this.baseHash=bn(gv,r),this.baseStyle=n,Gf.registerId(r)}return e.prototype.generateAndInjectStyles=function(t,r,n){var i=this.componentId,a=[];if(this.baseStyle&&a.push(this.baseStyle.generateAndInjectStyles(t,r,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&r.hasNameForId(i,this.staticRulesId))a.push(this.staticRulesId);else{var o=vn(this.rules,t,r,n).join(""),s=ws(bn(this.baseHash,o)>>>0);if(!r.hasNameForId(i,s)){var l=n(o,"."+s,void 0,i);r.insertRules(i,s,l)}a.push(s),this.staticRulesId=s}else{for(var c=this.rules.length,u=bn(this.baseHash,n.hash),d="",p=0;p<c;p++){var m=this.rules[p];if(typeof m=="string")d+=m;else if(m){var g=vn(m,t,r,n),v=Array.isArray(g)?g.join(""):g;u=bn(u,v+p),d+=v}}if(d){var x=ws(u>>>0);if(!r.hasNameForId(i,x)){var b=n(d,"."+x,void 0,i);r.insertRules(i,x,b)}a.push(x)}}return a.join(" ")},e}(),bv=/^\s*\/\/.*$/gm,vv=[":","[",".","#"];function _v(e){var t,r,n,i,a=wr,o=a.options,s=o===void 0?wr:o,l=a.plugins,c=l===void 0?xa:l,u=new Hb(s),d=[],p=function(v){function x(b){if(b)try{v(b+"}")}catch{}}return function(b,_,k,S,y,C,O,R,A,D){switch(b){case 1:if(A===0&&_.charCodeAt(0)===64)return v(_+";"),"";break;case 2:if(R===0)return _+"/*|*/";break;case 3:switch(R){case 102:case 112:return v(k[0]+_),"";default:return _+(D===0?"/*|*/":"")}case-2:_.split("/*|*/}").forEach(x)}}}(function(v){d.push(v)}),m=function(v,x,b){return x===0&&vv.indexOf(b[r.length])!==-1||b.match(i)?v:"."+t};function g(v,x,b,_){_===void 0&&(_="&");var k=v.replace(bv,""),S=x&&b?b+" "+x+" { "+k+" }":k;return t=_,r=x,n=new RegExp("\\"+r+"\\b","g"),i=new RegExp("(\\"+r+"\\b){2,}"),u(b||!x?"":x,S)}return u.use([].concat(c,[function(v,x,b){v===2&&b.length&&b[0].lastIndexOf(r)>0&&(b[0]=b[0].replace(n,m))},p,function(v){if(v===-2){var x=d;return d=[],x}}])),g.hash=c.length?c.reduce(function(v,x){return x.name||yi(15),bn(v,x.name)},5381).toString():"",g}var Xf=re.createContext();Xf.Consumer;var Vf=re.createContext(),xv=(Vf.Consumer,new Gf),gs=_v();function Ev(){return re.useContext(Xf)||xv}function Sv(){return re.useContext(Vf)||gs}var kv=function(){function e(t,r){var n=this;this.inject=function(i,a){a===void 0&&(a=gs);var o=n.name+a.hash;i.hasNameForId(n.id,o)||i.insertRules(n.id,o,a(n.rules,o,"@keyframes"))},this.toString=function(){return yi(12,String(n.name))},this.name=t,this.id="sc-keyframes-"+t,this.rules=r}return e.prototype.getName=function(t){return t===void 0&&(t=gs),this.name+t.hash},e}(),Rv=/([A-Z])/,Ov=/([A-Z])/g,Cv=/^ms-/,Pv=function(e){return"-"+e.toLowerCase()};function Kf(e){return Rv.test(e)?e.replace(Ov,Pv).replace(Cv,"-ms-"):e}var Jf=function(e){return e==null||e===!1||e===""};function vn(e,t,r,n){if(Array.isArray(e)){for(var i,a=[],o=0,s=e.length;o<s;o+=1)(i=vn(e[o],t,r,n))!==""&&(Array.isArray(i)?a.push.apply(a,i):a.push(i));return a}if(Jf(e))return"";if(ps(e))return"."+e.styledComponentId;if(gi(e)){if(typeof(c=e)!="function"||c.prototype&&c.prototype.isReactComponent||!t)return e;var l=e(t);return vn(l,t,r,n)}var c;return e instanceof kv?r?(e.inject(r,n),e.getName(n)):e:hs(e)?function u(d,p){var m,g,v=[];for(var x in d)d.hasOwnProperty(x)&&!Jf(d[x])&&(Array.isArray(d[x])&&d[x].isCss||gi(d[x])?v.push(Kf(x)+":",d[x],";"):hs(d[x])?v.push.apply(v,u(d[x],x)):v.push(Kf(x)+": "+(m=x,(g=d[x])==null||typeof g=="boolean"||g===""?"":typeof g!="number"||g===0||m in Wb||m.startsWith("--")?String(g).trim():g+"px")+";"));return p?[p+" {"].concat(v,["}"]):v}(e):e.toString()}var Qf=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function Tv(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return gi(e)||hs(e)?Qf(vn(Uf(xa,[e].concat(r)))):r.length===0&&e.length===1&&typeof e[0]=="string"?e:Qf(vn(Uf(e,r)))}var Av=function(e,t,r){return r===void 0&&(r=wr),e.theme!==r.theme&&e.theme||t||r.theme},Dv=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,$v=/(^-|-$)/g;function ys(e){return e.replace(Dv,"-").replace($v,"")}var Iv=function(e){return ws(Zf(e)>>>0)};function Ra(e){return typeof e=="string"&&!0}var bs=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},Bv=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function jv(e,t,r){var n=e[r];bs(t)&&bs(n)?ed(n,t):e[r]=t}function ed(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0,a=r;i<a.length;i++){var o=a[i];if(bs(o))for(var s in o)Bv(s)&&jv(e,o[s],s)}return e}var td=re.createContext();td.Consumer;var vs={};function rd(e,t,r){var n=ps(e),i=!Ra(e),a=t.attrs,o=a===void 0?xa:a,s=t.componentId,l=s===void 0?function(_,k){var S=typeof _!="string"?"sc":ys(_);vs[S]=(vs[S]||0)+1;var y=S+"-"+Iv("5.3.11"+S+vs[S]);return k?k+"-"+y:y}(t.displayName,t.parentComponentId):s,c=t.displayName,u=c===void 0?function(_){return Ra(_)?"styled."+_:"Styled("+Hf(_)+")"}(e):c,d=t.displayName&&t.componentId?ys(t.displayName)+"-"+t.componentId:t.componentId||l,p=n&&e.attrs?Array.prototype.concat(e.attrs,o).filter(Boolean):o,m=t.shouldForwardProp;n&&e.shouldForwardProp&&(m=t.shouldForwardProp?function(_,k,S){return e.shouldForwardProp(_,k,S)&&t.shouldForwardProp(_,k,S)}:e.shouldForwardProp);var g,v=new yv(r,d,n?e.componentStyle:void 0),x=v.isStatic&&o.length===0,b=function(_,k){return function(S,y,C,O){var R=S.attrs,A=S.componentStyle,D=S.defaultProps,j=S.foldedComponentIds,M=S.shouldForwardProp,U=S.styledComponentId,Z=S.target,de=function(ee,I,Q){ee===void 0&&(ee=wr);var $=Qt({},I,{theme:ee}),G={};return Q.forEach(function(X){var Y,L,V,te=X;for(Y in gi(te)&&(te=te($)),te)$[Y]=G[Y]=Y==="className"?(L=G[Y],V=te[Y],L&&V?L+" "+V:L||V):te[Y]}),[$,G]}(Av(y,re.useContext(td),D)||wr,y,R),$e=de[0],ge=de[1],_e=function(ee,I,Q,$){var G=Ev(),X=Sv(),Y=I?ee.generateAndInjectStyles(wr,G,X):ee.generateAndInjectStyles(Q,G,X);return Y}(A,O,$e),Je=C,Qe=ge.$as||y.$as||ge.as||y.as||Z,fe=Ra(Qe),F=ge!==y?Qt({},y,{},ge):y,q={};for(var W in F)W[0]!=="$"&&W!=="as"&&(W==="forwardedAs"?q.as=F[W]:(M?M(W,jf,Qe):!fe||jf(W))&&(q[W]=F[W]));return y.style&&ge.style!==y.style&&(q.style=Qt({},y.style,{},ge.style)),q.className=Array.prototype.concat(j,U,_e!==U?_e:null,y.className,ge.className).filter(Boolean).join(" "),q.ref=Je,re.createElement(Qe,q)}(g,_,k,x)};return b.displayName=u,(g=re.forwardRef(b)).attrs=p,g.componentStyle=v,g.displayName=u,g.shouldForwardProp=m,g.foldedComponentIds=n?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):xa,g.styledComponentId=d,g.target=n?e.target:e,g.withComponent=function(_){var k=t.componentId,S=function(C,O){if(C==null)return{};var R,A,D={},j=Object.keys(C);for(A=0;A<j.length;A++)R=j[A],O.indexOf(R)>=0||(D[R]=C[R]);return D}(t,["componentId"]),y=k&&k+"-"+(Ra(_)?_:ys(Hf(_)));return rd(_,Qt({},S,{attrs:p,componentId:y}),r)},Object.defineProperty(g,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=n?ed({},e.defaultProps,_):_}}),Object.defineProperty(g,"toString",{value:function(){return"."+g.styledComponentId}}),i&&tv(g,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),g}var gr=function(e){return function t(r,n,i){if(i===void 0&&(i=wr),!us.isValidElementType(n))return yi(1,String(n));var a=function(){return r(n,i,Tv.apply(void 0,arguments))};return a.withConfig=function(o){return t(r,n,Qt({},i,{},o))},a.attrs=function(o){return t(r,n,Qt({},i,{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},a}(rd,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){gr[e]=gr(e)});const zv=gr.div`
117
+ */var We=typeof Symbol=="function"&&Symbol.for,cs=We?Symbol.for("react.element"):60103,ls=We?Symbol.for("react.portal"):60106,da=We?Symbol.for("react.fragment"):60107,ha=We?Symbol.for("react.strict_mode"):60108,pa=We?Symbol.for("react.profiler"):60114,ma=We?Symbol.for("react.provider"):60109,wa=We?Symbol.for("react.context"):60110,us=We?Symbol.for("react.async_mode"):60111,ga=We?Symbol.for("react.concurrent_mode"):60111,ya=We?Symbol.for("react.forward_ref"):60112,ba=We?Symbol.for("react.suspense"):60113,Nb=We?Symbol.for("react.suspense_list"):60120,_a=We?Symbol.for("react.memo"):60115,va=We?Symbol.for("react.lazy"):60116,Mb=We?Symbol.for("react.block"):60121,Lb=We?Symbol.for("react.fundamental"):60117,Fb=We?Symbol.for("react.responder"):60118,Ub=We?Symbol.for("react.scope"):60119;function mt(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case cs:switch(e=e.type,e){case us:case ga:case da:case pa:case ha:case ba:return e;default:switch(e=e&&e.$$typeof,e){case wa:case ya:case va:case _a:case ma:return e;default:return t}}case ls:return t}}}function jf(e){return mt(e)===ga}ke.AsyncMode=us,ke.ConcurrentMode=ga,ke.ContextConsumer=wa,ke.ContextProvider=ma,ke.Element=cs,ke.ForwardRef=ya,ke.Fragment=da,ke.Lazy=va,ke.Memo=_a,ke.Portal=ls,ke.Profiler=pa,ke.StrictMode=ha,ke.Suspense=ba,ke.isAsyncMode=function(e){return jf(e)||mt(e)===us},ke.isConcurrentMode=jf,ke.isContextConsumer=function(e){return mt(e)===wa},ke.isContextProvider=function(e){return mt(e)===ma},ke.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===cs},ke.isForwardRef=function(e){return mt(e)===ya},ke.isFragment=function(e){return mt(e)===da},ke.isLazy=function(e){return mt(e)===va},ke.isMemo=function(e){return mt(e)===_a},ke.isPortal=function(e){return mt(e)===ls},ke.isProfiler=function(e){return mt(e)===pa},ke.isStrictMode=function(e){return mt(e)===ha},ke.isSuspense=function(e){return mt(e)===ba},ke.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===da||e===ga||e===pa||e===ha||e===ba||e===Nb||typeof e=="object"&&e!==null&&(e.$$typeof===va||e.$$typeof===_a||e.$$typeof===ma||e.$$typeof===wa||e.$$typeof===ya||e.$$typeof===Lb||e.$$typeof===Fb||e.$$typeof===Ub||e.$$typeof===Mb)},ke.typeOf=mt,If.exports=ke;var fs=If.exports;function Hb(e){function t(F,q,W,te,I){for(var ee=0,$=0,G=0,X=0,Y,L,V=0,re=0,J,ce=J=Y=0,ne=0,ie=0,Re=0,Ee=0,Et=W.length,Ue=Et-1,Pe,oe="",Se="",Oi="",w="",f;ne<Et;){if(L=W.charCodeAt(ne),ne===Ue&&$+X+G+ee!==0&&($!==0&&(L=$===47?10:47),X=G=ee=0,Et++,Ue++),$+X+G+ee===0){if(ne===Ue&&(0<ie&&(oe=oe.replace(p,"")),0<oe.trim().length)){switch(L){case 32:case 9:case 59:case 13:case 10:break;default:oe+=W.charAt(ne)}L=59}switch(L){case 123:for(oe=oe.trim(),Y=oe.charCodeAt(0),J=1,Ee=++ne;ne<Et;){switch(L=W.charCodeAt(ne)){case 123:J++;break;case 125:J--;break;case 47:switch(L=W.charCodeAt(ne+1)){case 42:case 47:e:{for(ce=ne+1;ce<Ue;++ce)switch(W.charCodeAt(ce)){case 47:if(L===42&&W.charCodeAt(ce-1)===42&&ne+2!==ce){ne=ce+1;break e}break;case 10:if(L===47){ne=ce+1;break e}}ne=ce}}break;case 91:L++;case 40:L++;case 34:case 39:for(;ne++<Ue&&W.charCodeAt(ne)!==L;);}if(J===0)break;ne++}switch(J=W.substring(Ee,ne),Y===0&&(Y=(oe=oe.replace(d,"").trim()).charCodeAt(0)),Y){case 64:switch(0<ie&&(oe=oe.replace(p,"")),L=oe.charCodeAt(1),L){case 100:case 109:case 115:case 45:ie=q;break;default:ie=$e}if(J=t(q,ie,J,L,I+1),Ee=J.length,0<xe&&(ie=r($e,oe,Re),f=s(3,J,ie,q,U,M,Ee,L,I,te),oe=ie.join(""),f!==void 0&&(Ee=(J=f.trim()).length)===0&&(L=0,J="")),0<Ee)switch(L){case 115:oe=oe.replace(O,o);case 100:case 109:case 45:J=oe+"{"+J+"}";break;case 107:oe=oe.replace(_,"$1 $2"),J=oe+"{"+J+"}",J=de===1||de===2&&a("@"+J,3)?"@-webkit-"+J+"@"+J:"@"+J;break;default:J=oe+J,te===112&&(J=(Se+=J,""))}else J="";break;default:J=t(q,r(q,oe,Re),J,te,I+1)}Oi+=J,J=Re=ie=ce=Y=0,oe="",L=W.charCodeAt(++ne);break;case 125:case 59:if(oe=(0<ie?oe.replace(p,""):oe).trim(),1<(Ee=oe.length))switch(ce===0&&(Y=oe.charCodeAt(0),Y===45||96<Y&&123>Y)&&(Ee=(oe=oe.replace(" ",":")).length),0<xe&&(f=s(1,oe,q,F,U,M,Se.length,te,I,te))!==void 0&&(Ee=(oe=f.trim()).length)===0&&(oe="\0\0"),Y=oe.charCodeAt(0),L=oe.charCodeAt(1),Y){case 0:break;case 64:if(L===105||L===99){w+=oe+W.charAt(ne);break}default:oe.charCodeAt(Ee-1)!==58&&(Se+=i(oe,Y,L,oe.charCodeAt(2)))}Re=ie=ce=Y=0,oe="",L=W.charCodeAt(++ne)}}switch(L){case 13:case 10:$===47?$=0:1+Y===0&&te!==107&&0<oe.length&&(ie=1,oe+="\0"),0<xe*Qe&&s(0,oe,q,F,U,M,Se.length,te,I,te),M=1,U++;break;case 59:case 125:if($+X+G+ee===0){M++;break}default:switch(M++,Pe=W.charAt(ne),L){case 9:case 32:if(X+ee+$===0)switch(V){case 44:case 58:case 9:case 32:Pe="";break;default:L!==32&&(Pe=" ")}break;case 0:Pe="\\0";break;case 12:Pe="\\f";break;case 11:Pe="\\v";break;case 38:X+$+ee===0&&(ie=Re=1,Pe="\f"+Pe);break;case 108:if(X+$+ee+Z===0&&0<ce)switch(ne-ce){case 2:V===112&&W.charCodeAt(ne-3)===58&&(Z=V);case 8:re===111&&(Z=re)}break;case 58:X+$+ee===0&&(ce=ne);break;case 44:$+G+X+ee===0&&(ie=1,Pe+="\r");break;case 34:case 39:$===0&&(X=X===L?0:X===0?L:X);break;case 91:X+$+G===0&&ee++;break;case 93:X+$+G===0&&ee--;break;case 41:X+$+ee===0&&G--;break;case 40:if(X+$+ee===0){if(Y===0)switch(2*V+3*re){case 533:break;default:Y=1}G++}break;case 64:$+G+X+ee+ce+J===0&&(J=1);break;case 42:case 47:if(!(0<X+ee+G))switch($){case 0:switch(2*L+3*W.charCodeAt(ne+1)){case 235:$=47;break;case 220:Ee=ne,$=42}break;case 42:L===47&&V===42&&Ee+2!==ne&&(W.charCodeAt(Ee+2)===33&&(Se+=W.substring(Ee,ne+1)),Pe="",$=0)}}$===0&&(oe+=Pe)}re=V,V=L,ne++}if(Ee=Se.length,0<Ee){if(ie=q,0<xe&&(f=s(2,Se,ie,F,U,M,Ee,te,I,te),f!==void 0&&(Se=f).length===0))return w+Se+Oi;if(Se=ie.join(",")+"{"+Se+"}",de*Z!==0){switch(de!==2||a(Se,2)||(Z=0),Z){case 111:Se=Se.replace(C,":-moz-$1")+Se;break;case 112:Se=Se.replace(R,"::-webkit-input-$1")+Se.replace(R,"::-moz-$1")+Se.replace(R,":-ms-input-$1")+Se}Z=0}}return w+Se+Oi}function r(F,q,W){var te=q.trim().split(v);q=te;var I=te.length,ee=F.length;switch(ee){case 0:case 1:var $=0;for(F=ee===0?"":F[0]+" ";$<I;++$)q[$]=n(F,q[$],W).trim();break;default:var G=$=0;for(q=[];$<I;++$)for(var X=0;X<ee;++X)q[G++]=n(F[X]+" ",te[$],W).trim()}return q}function n(F,q,W){var te=q.charCodeAt(0);switch(33>te&&(te=(q=q.trim()).charCodeAt(0)),te){case 38:return q.replace(y,"$1"+F.trim());case 58:return F.trim()+q.replace(y,"$1"+F.trim());default:if(0<1*W&&0<q.indexOf("\f"))return q.replace(y,(F.charCodeAt(0)===58?"":"$1")+F.trim())}return F+q}function i(F,q,W,te){var I=F+";",ee=2*q+3*W+4*te;if(ee===944){F=I.indexOf(":",9)+1;var $=I.substring(F,I.length-1).trim();return $=I.substring(0,F).trim()+$+";",de===1||de===2&&a($,1)?"-webkit-"+$+$:$}if(de===0||de===2&&!a(I,1))return I;switch(ee){case 1015:return I.charCodeAt(10)===97?"-webkit-"+I+I:I;case 951:return I.charCodeAt(3)===116?"-webkit-"+I+I:I;case 963:return I.charCodeAt(5)===110?"-webkit-"+I+I:I;case 1009:if(I.charCodeAt(4)!==100)break;case 969:case 942:return"-webkit-"+I+I;case 978:return"-webkit-"+I+"-moz-"+I+I;case 1019:case 983:return"-webkit-"+I+"-moz-"+I+"-ms-"+I+I;case 883:if(I.charCodeAt(8)===45)return"-webkit-"+I+I;if(0<I.indexOf("image-set(",11))return I.replace(B,"$1-webkit-$2")+I;break;case 932:if(I.charCodeAt(4)===45)switch(I.charCodeAt(5)){case 103:return"-webkit-box-"+I.replace("-grow","")+"-webkit-"+I+"-ms-"+I.replace("grow","positive")+I;case 115:return"-webkit-"+I+"-ms-"+I.replace("shrink","negative")+I;case 98:return"-webkit-"+I+"-ms-"+I.replace("basis","preferred-size")+I}return"-webkit-"+I+"-ms-"+I+I;case 964:return"-webkit-"+I+"-ms-flex-"+I+I;case 1023:if(I.charCodeAt(8)!==99)break;return $=I.substring(I.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+$+"-webkit-"+I+"-ms-flex-pack"+$+I;case 1005:return g.test(I)?I.replace(m,":-webkit-")+I.replace(m,":-moz-")+I:I;case 1e3:switch($=I.substring(13).trim(),q=$.indexOf("-")+1,$.charCodeAt(0)+$.charCodeAt(q)){case 226:$=I.replace(x,"tb");break;case 232:$=I.replace(x,"tb-rl");break;case 220:$=I.replace(x,"lr");break;default:return I}return"-webkit-"+I+"-ms-"+$+I;case 1017:if(I.indexOf("sticky",9)===-1)break;case 975:switch(q=(I=F).length-10,$=(I.charCodeAt(q)===33?I.substring(0,q):I).substring(F.indexOf(":",7)+1).trim(),ee=$.charCodeAt(0)+($.charCodeAt(7)|0)){case 203:if(111>$.charCodeAt(8))break;case 115:I=I.replace($,"-webkit-"+$)+";"+I;break;case 207:case 102:I=I.replace($,"-webkit-"+(102<ee?"inline-":"")+"box")+";"+I.replace($,"-webkit-"+$)+";"+I.replace($,"-ms-"+$+"box")+";"+I}return I+";";case 938:if(I.charCodeAt(5)===45)switch(I.charCodeAt(6)){case 105:return $=I.replace("-items",""),"-webkit-"+I+"-webkit-box-"+$+"-ms-flex-"+$+I;case 115:return"-webkit-"+I+"-ms-flex-item-"+I.replace(S,"")+I;default:return"-webkit-"+I+"-ms-flex-line-pack"+I.replace("align-content","").replace(S,"")+I}break;case 973:case 989:if(I.charCodeAt(3)!==45||I.charCodeAt(4)===122)break;case 931:case 953:if(D.test(F)===!0)return($=F.substring(F.indexOf(":")+1)).charCodeAt(0)===115?i(F.replace("stretch","fill-available"),q,W,te).replace(":fill-available",":stretch"):I.replace($,"-webkit-"+$)+I.replace($,"-moz-"+$.replace("fill-",""))+I;break;case 962:if(I="-webkit-"+I+(I.charCodeAt(5)===102?"-ms-"+I:"")+I,W+te===211&&I.charCodeAt(13)===105&&0<I.indexOf("transform",10))return I.substring(0,I.indexOf(";",27)+1).replace(b,"$1-webkit-$2")+I}return I}function a(F,q){var W=F.indexOf(q===1?":":"{"),te=F.substring(0,q!==3?W:10);return W=F.substring(W+1,F.length-1),Je(q!==2?te:te.replace(A,"$1"),W,q)}function o(F,q){var W=i(q,q.charCodeAt(0),q.charCodeAt(1),q.charCodeAt(2));return W!==q+";"?W.replace(k," or ($1)").substring(4):"("+q+")"}function s(F,q,W,te,I,ee,$,G,X,Y){for(var L=0,V=q,re;L<xe;++L)switch(re=ge[L].call(u,F,V,W,te,I,ee,$,G,X,Y)){case void 0:case!1:case!0:case null:break;default:V=re}if(V!==q)return V}function l(F){switch(F){case void 0:case null:xe=ge.length=0;break;default:if(typeof F=="function")ge[xe++]=F;else if(typeof F=="object")for(var q=0,W=F.length;q<W;++q)l(F[q]);else Qe=!!F|0}return l}function c(F){return F=F.prefix,F!==void 0&&(Je=null,F?typeof F!="function"?de=1:(de=2,Je=F):de=0),c}function u(F,q){var W=F;if(33>W.charCodeAt(0)&&(W=W.trim()),fe=W,W=[fe],0<xe){var te=s(-1,q,W,W,U,M,0,0,0,0);te!==void 0&&typeof te=="string"&&(q=te)}var I=t($e,W,q,0,0);return 0<xe&&(te=s(-2,I,W,W,U,M,I.length,0,0,0),te!==void 0&&(I=te)),fe="",Z=0,M=U=1,I}var d=/^\0+/g,p=/[\0\r\f]/g,m=/: */g,g=/zoo|gra/,b=/([,: ])(transform)/g,v=/,\r+?/g,y=/([\t\r\n ])*\f?&/g,_=/@(k\w+)\s*(\S*)\s*/,R=/::(place)/g,C=/:(read-only)/g,x=/[svh]\w+-[tblr]{2}/,O=/\(\s*(.*)\s*\)/g,k=/([\s\S]*?);/g,S=/-self|flex-/g,A=/[^]*?(:[rp][el]a[\w-]+)[^]*/,D=/stretch|:\s*\w+\-(?:conte|avail)/,B=/([^-])(image-set\()/,M=1,U=1,Z=0,de=1,$e=[],ge=[],xe=0,Je=null,Qe=0,fe="";return u.use=l,u.set=c,e!==void 0&&c(e),u}var Wb={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function qb(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Gb=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Bf=qb(function(e){return Gb.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),ds=fs,Yb={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Zb={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Xb={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},zf={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},hs={};hs[ds.ForwardRef]=Xb,hs[ds.Memo]=zf;function Nf(e){return ds.isMemo(e)?zf:hs[e.$$typeof]||Yb}var Vb=Object.defineProperty,Kb=Object.getOwnPropertyNames,Mf=Object.getOwnPropertySymbols,Jb=Object.getOwnPropertyDescriptor,Qb=Object.getPrototypeOf,Lf=Object.prototype;function Ff(e,t,r){if(typeof t!="string"){if(Lf){var n=Qb(t);n&&n!==Lf&&Ff(e,n,r)}var i=Kb(t);Mf&&(i=i.concat(Mf(t)));for(var a=Nf(e),o=Nf(t),s=0;s<i.length;++s){var l=i[s];if(!Zb[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var c=Jb(t,l);try{Vb(e,l,c)}catch{}}}}return e}var e_=Ff;const t_=St(e_);function Qt(){return(Qt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var Uf=function(e,t){for(var r=[e[0]],n=0,i=t.length;n<i;n+=1)r.push(t[n],e[n+1]);return r},ps=function(e){return e!==null&&typeof e=="object"&&(e.toString?e.toString():Object.prototype.toString.call(e))==="[object Object]"&&!fs.typeOf(e)},xa=Object.freeze([]),wr=Object.freeze({});function gi(e){return typeof e=="function"}function Hf(e){return e.displayName||e.name||"Component"}function ms(e){return e&&typeof e.styledComponentId=="string"}var yn=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",ws=typeof window<"u"&&"HTMLElement"in window,r_=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""&&process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY));function yi(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw new Error("An error occurred. See https://git.io/JUIaE#"+e+" for more information."+(r.length>0?" Args: "+r.join(", "):""))}var n_=function(){function e(r){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=r}var t=e.prototype;return t.indexOfGroup=function(r){for(var n=0,i=0;i<r;i++)n+=this.groupSizes[i];return n},t.insertRules=function(r,n){if(r>=this.groupSizes.length){for(var i=this.groupSizes,a=i.length,o=a;r>=o;)(o<<=1)<0&&yi(16,""+r);this.groupSizes=new Uint32Array(o),this.groupSizes.set(i),this.length=o;for(var s=a;s<o;s++)this.groupSizes[s]=0}for(var l=this.indexOfGroup(r+1),c=0,u=n.length;c<u;c++)this.tag.insertRule(l,n[c])&&(this.groupSizes[r]++,l++)},t.clearGroup=function(r){if(r<this.length){var n=this.groupSizes[r],i=this.indexOfGroup(r),a=i+n;this.groupSizes[r]=0;for(var o=i;o<a;o++)this.tag.deleteRule(i)}},t.getGroup=function(r){var n="";if(r>=this.length||this.groupSizes[r]===0)return n;for(var i=this.groupSizes[r],a=this.indexOfGroup(r),o=a+i,s=a;s<o;s++)n+=this.tag.getRule(s)+`/*!sc*/
118
+ `;return n},e}(),Ea=new Map,Sa=new Map,bi=1,ka=function(e){if(Ea.has(e))return Ea.get(e);for(;Sa.has(bi);)bi++;var t=bi++;return Ea.set(e,t),Sa.set(t,e),t},i_=function(e){return Sa.get(e)},a_=function(e,t){t>=bi&&(bi=t+1),Ea.set(e,t),Sa.set(t,e)},o_="style["+yn+'][data-styled-version="5.3.11"]',s_=new RegExp("^"+yn+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),c_=function(e,t,r){for(var n,i=r.split(","),a=0,o=i.length;a<o;a++)(n=i[a])&&e.registerName(t,n)},l_=function(e,t){for(var r=(t.textContent||"").split(`/*!sc*/
119
+ `),n=[],i=0,a=r.length;i<a;i++){var o=r[i].trim();if(o){var s=o.match(s_);if(s){var l=0|parseInt(s[1],10),c=s[2];l!==0&&(a_(c,l),c_(e,c,s[3]),e.getTag().insertRules(l,n)),n.length=0}else n.push(o)}}},u_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null},Wf=function(e){var t=document.head,r=e||t,n=document.createElement("style"),i=function(s){for(var l=s.childNodes,c=l.length;c>=0;c--){var u=l[c];if(u&&u.nodeType===1&&u.hasAttribute(yn))return u}}(r),a=i!==void 0?i.nextSibling:null;n.setAttribute(yn,"active"),n.setAttribute("data-styled-version","5.3.11");var o=u_();return o&&n.setAttribute("nonce",o),r.insertBefore(n,a),n},f_=function(){function e(r){var n=this.element=Wf(r);n.appendChild(document.createTextNode("")),this.sheet=function(i){if(i.sheet)return i.sheet;for(var a=document.styleSheets,o=0,s=a.length;o<s;o++){var l=a[o];if(l.ownerNode===i)return l}yi(17)}(n),this.length=0}var t=e.prototype;return t.insertRule=function(r,n){try{return this.sheet.insertRule(n,r),this.length++,!0}catch{return!1}},t.deleteRule=function(r){this.sheet.deleteRule(r),this.length--},t.getRule=function(r){var n=this.sheet.cssRules[r];return n!==void 0&&typeof n.cssText=="string"?n.cssText:""},e}(),d_=function(){function e(r){var n=this.element=Wf(r);this.nodes=n.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(r,n){if(r<=this.length&&r>=0){var i=document.createTextNode(n),a=this.nodes[r];return this.element.insertBefore(i,a||null),this.length++,!0}return!1},t.deleteRule=function(r){this.element.removeChild(this.nodes[r]),this.length--},t.getRule=function(r){return r<this.length?this.nodes[r].textContent:""},e}(),h_=function(){function e(r){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(r,n){return r<=this.length&&(this.rules.splice(r,0,n),this.length++,!0)},t.deleteRule=function(r){this.rules.splice(r,1),this.length--},t.getRule=function(r){return r<this.length?this.rules[r]:""},e}(),qf=ws,p_={isServer:!ws,useCSSOMInjection:!r_},Gf=function(){function e(r,n,i){r===void 0&&(r=wr),n===void 0&&(n={}),this.options=Qt({},p_,{},r),this.gs=n,this.names=new Map(i),this.server=!!r.isServer,!this.server&&ws&&qf&&(qf=!1,function(a){for(var o=document.querySelectorAll(o_),s=0,l=o.length;s<l;s++){var c=o[s];c&&c.getAttribute(yn)!=="active"&&(l_(a,c),c.parentNode&&c.parentNode.removeChild(c))}}(this))}e.registerId=function(r){return ka(r)};var t=e.prototype;return t.reconstructWithOptions=function(r,n){return n===void 0&&(n=!0),new e(Qt({},this.options,{},r),this.gs,n&&this.names||void 0)},t.allocateGSInstance=function(r){return this.gs[r]=(this.gs[r]||0)+1},t.getTag=function(){return this.tag||(this.tag=(i=(n=this.options).isServer,a=n.useCSSOMInjection,o=n.target,r=i?new h_(o):a?new f_(o):new d_(o),new n_(r)));var r,n,i,a,o},t.hasNameForId=function(r,n){return this.names.has(r)&&this.names.get(r).has(n)},t.registerName=function(r,n){if(ka(r),this.names.has(r))this.names.get(r).add(n);else{var i=new Set;i.add(n),this.names.set(r,i)}},t.insertRules=function(r,n,i){this.registerName(r,n),this.getTag().insertRules(ka(r),i)},t.clearNames=function(r){this.names.has(r)&&this.names.get(r).clear()},t.clearRules=function(r){this.getTag().clearGroup(ka(r)),this.clearNames(r)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(r){for(var n=r.getTag(),i=n.length,a="",o=0;o<i;o++){var s=i_(o);if(s!==void 0){var l=r.names.get(s),c=n.getGroup(o);if(l&&c&&l.size){var u=yn+".g"+o+'[id="'+s+'"]',d="";l!==void 0&&l.forEach(function(p){p.length>0&&(d+=p+",")}),a+=""+c+u+'{content:"'+d+`"}/*!sc*/
120
+ `}}}return a}(this)},e}(),m_=/(a)(d)/gi,Yf=function(e){return String.fromCharCode(e+(e>25?39:97))};function gs(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=Yf(t%52)+r;return(Yf(t%52)+r).replace(m_,"$1-$2")}var bn=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Zf=function(e){return bn(5381,e)};function w_(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(gi(r)&&!ms(r))return!1}return!0}var g_=Zf("5.3.11"),y_=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&w_(t),this.componentId=r,this.baseHash=bn(g_,r),this.baseStyle=n,Gf.registerId(r)}return e.prototype.generateAndInjectStyles=function(t,r,n){var i=this.componentId,a=[];if(this.baseStyle&&a.push(this.baseStyle.generateAndInjectStyles(t,r,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&r.hasNameForId(i,this.staticRulesId))a.push(this.staticRulesId);else{var o=_n(this.rules,t,r,n).join(""),s=gs(bn(this.baseHash,o)>>>0);if(!r.hasNameForId(i,s)){var l=n(o,"."+s,void 0,i);r.insertRules(i,s,l)}a.push(s),this.staticRulesId=s}else{for(var c=this.rules.length,u=bn(this.baseHash,n.hash),d="",p=0;p<c;p++){var m=this.rules[p];if(typeof m=="string")d+=m;else if(m){var g=_n(m,t,r,n),b=Array.isArray(g)?g.join(""):g;u=bn(u,b+p),d+=b}}if(d){var v=gs(u>>>0);if(!r.hasNameForId(i,v)){var y=n(d,"."+v,void 0,i);r.insertRules(i,v,y)}a.push(v)}}return a.join(" ")},e}(),b_=/^\s*\/\/.*$/gm,__=[":","[",".","#"];function v_(e){var t,r,n,i,a=wr,o=a.options,s=o===void 0?wr:o,l=a.plugins,c=l===void 0?xa:l,u=new Hb(s),d=[],p=function(b){function v(y){if(y)try{b(y+"}")}catch{}}return function(y,_,R,C,x,O,k,S,A,D){switch(y){case 1:if(A===0&&_.charCodeAt(0)===64)return b(_+";"),"";break;case 2:if(S===0)return _+"/*|*/";break;case 3:switch(S){case 102:case 112:return b(R[0]+_),"";default:return _+(D===0?"/*|*/":"")}case-2:_.split("/*|*/}").forEach(v)}}}(function(b){d.push(b)}),m=function(b,v,y){return v===0&&__.indexOf(y[r.length])!==-1||y.match(i)?b:"."+t};function g(b,v,y,_){_===void 0&&(_="&");var R=b.replace(b_,""),C=v&&y?y+" "+v+" { "+R+" }":R;return t=_,r=v,n=new RegExp("\\"+r+"\\b","g"),i=new RegExp("(\\"+r+"\\b){2,}"),u(y||!v?"":v,C)}return u.use([].concat(c,[function(b,v,y){b===2&&y.length&&y[0].lastIndexOf(r)>0&&(y[0]=y[0].replace(n,m))},p,function(b){if(b===-2){var v=d;return d=[],v}}])),g.hash=c.length?c.reduce(function(b,v){return v.name||yi(15),bn(b,v.name)},5381).toString():"",g}var Xf=Q.createContext();Xf.Consumer;var Vf=Q.createContext(),x_=(Vf.Consumer,new Gf),ys=v_();function E_(){return Q.useContext(Xf)||x_}function S_(){return Q.useContext(Vf)||ys}var k_=function(){function e(t,r){var n=this;this.inject=function(i,a){a===void 0&&(a=ys);var o=n.name+a.hash;i.hasNameForId(n.id,o)||i.insertRules(n.id,o,a(n.rules,o,"@keyframes"))},this.toString=function(){return yi(12,String(n.name))},this.name=t,this.id="sc-keyframes-"+t,this.rules=r}return e.prototype.getName=function(t){return t===void 0&&(t=ys),this.name+t.hash},e}(),R_=/([A-Z])/,O_=/([A-Z])/g,C_=/^ms-/,P_=function(e){return"-"+e.toLowerCase()};function Kf(e){return R_.test(e)?e.replace(O_,P_).replace(C_,"-ms-"):e}var Jf=function(e){return e==null||e===!1||e===""};function _n(e,t,r,n){if(Array.isArray(e)){for(var i,a=[],o=0,s=e.length;o<s;o+=1)(i=_n(e[o],t,r,n))!==""&&(Array.isArray(i)?a.push.apply(a,i):a.push(i));return a}if(Jf(e))return"";if(ms(e))return"."+e.styledComponentId;if(gi(e)){if(typeof(c=e)!="function"||c.prototype&&c.prototype.isReactComponent||!t)return e;var l=e(t);return _n(l,t,r,n)}var c;return e instanceof k_?r?(e.inject(r,n),e.getName(n)):e:ps(e)?function u(d,p){var m,g,b=[];for(var v in d)d.hasOwnProperty(v)&&!Jf(d[v])&&(Array.isArray(d[v])&&d[v].isCss||gi(d[v])?b.push(Kf(v)+":",d[v],";"):ps(d[v])?b.push.apply(b,u(d[v],v)):b.push(Kf(v)+": "+(m=v,(g=d[v])==null||typeof g=="boolean"||g===""?"":typeof g!="number"||g===0||m in Wb||m.startsWith("--")?String(g).trim():g+"px")+";"));return p?[p+" {"].concat(b,["}"]):b}(e):e.toString()}var Qf=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function T_(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return gi(e)||ps(e)?Qf(_n(Uf(xa,[e].concat(r)))):r.length===0&&e.length===1&&typeof e[0]=="string"?e:Qf(_n(Uf(e,r)))}var A_=function(e,t,r){return r===void 0&&(r=wr),e.theme!==r.theme&&e.theme||t||r.theme},D_=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,$_=/(^-|-$)/g;function bs(e){return e.replace(D_,"-").replace($_,"")}var I_=function(e){return gs(Zf(e)>>>0)};function Ra(e){return typeof e=="string"&&!0}var _s=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},j_=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function B_(e,t,r){var n=e[r];_s(t)&&_s(n)?ed(n,t):e[r]=t}function ed(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0,a=r;i<a.length;i++){var o=a[i];if(_s(o))for(var s in o)j_(s)&&B_(e,o[s],s)}return e}var td=Q.createContext();td.Consumer;var vs={};function rd(e,t,r){var n=ms(e),i=!Ra(e),a=t.attrs,o=a===void 0?xa:a,s=t.componentId,l=s===void 0?function(_,R){var C=typeof _!="string"?"sc":bs(_);vs[C]=(vs[C]||0)+1;var x=C+"-"+I_("5.3.11"+C+vs[C]);return R?R+"-"+x:x}(t.displayName,t.parentComponentId):s,c=t.displayName,u=c===void 0?function(_){return Ra(_)?"styled."+_:"Styled("+Hf(_)+")"}(e):c,d=t.displayName&&t.componentId?bs(t.displayName)+"-"+t.componentId:t.componentId||l,p=n&&e.attrs?Array.prototype.concat(e.attrs,o).filter(Boolean):o,m=t.shouldForwardProp;n&&e.shouldForwardProp&&(m=t.shouldForwardProp?function(_,R,C){return e.shouldForwardProp(_,R,C)&&t.shouldForwardProp(_,R,C)}:e.shouldForwardProp);var g,b=new y_(r,d,n?e.componentStyle:void 0),v=b.isStatic&&o.length===0,y=function(_,R){return function(C,x,O,k){var S=C.attrs,A=C.componentStyle,D=C.defaultProps,B=C.foldedComponentIds,M=C.shouldForwardProp,U=C.styledComponentId,Z=C.target,de=function(te,I,ee){te===void 0&&(te=wr);var $=Qt({},I,{theme:te}),G={};return ee.forEach(function(X){var Y,L,V,re=X;for(Y in gi(re)&&(re=re($)),re)$[Y]=G[Y]=Y==="className"?(L=G[Y],V=re[Y],L&&V?L+" "+V:L||V):re[Y]}),[$,G]}(A_(x,Q.useContext(td),D)||wr,x,S),$e=de[0],ge=de[1],xe=function(te,I,ee,$){var G=E_(),X=S_(),Y=I?te.generateAndInjectStyles(wr,G,X):te.generateAndInjectStyles(ee,G,X);return Y}(A,k,$e),Je=O,Qe=ge.$as||x.$as||ge.as||x.as||Z,fe=Ra(Qe),F=ge!==x?Qt({},x,{},ge):x,q={};for(var W in F)W[0]!=="$"&&W!=="as"&&(W==="forwardedAs"?q.as=F[W]:(M?M(W,Bf,Qe):!fe||Bf(W))&&(q[W]=F[W]));return x.style&&ge.style!==x.style&&(q.style=Qt({},x.style,{},ge.style)),q.className=Array.prototype.concat(B,U,xe!==U?xe:null,x.className,ge.className).filter(Boolean).join(" "),q.ref=Je,Q.createElement(Qe,q)}(g,_,R,v)};return y.displayName=u,(g=Q.forwardRef(y)).attrs=p,g.componentStyle=b,g.displayName=u,g.shouldForwardProp=m,g.foldedComponentIds=n?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):xa,g.styledComponentId=d,g.target=n?e.target:e,g.withComponent=function(_){var R=t.componentId,C=function(O,k){if(O==null)return{};var S,A,D={},B=Object.keys(O);for(A=0;A<B.length;A++)S=B[A],k.indexOf(S)>=0||(D[S]=O[S]);return D}(t,["componentId"]),x=R&&R+"-"+(Ra(_)?_:bs(Hf(_)));return rd(_,Qt({},C,{attrs:p,componentId:x}),r)},Object.defineProperty(g,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=n?ed({},e.defaultProps,_):_}}),Object.defineProperty(g,"toString",{value:function(){return"."+g.styledComponentId}}),i&&t_(g,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),g}var gr=function(e){return function t(r,n,i){if(i===void 0&&(i=wr),!fs.isValidElementType(n))return yi(1,String(n));var a=function(){return r(n,i,T_.apply(void 0,arguments))};return a.withConfig=function(o){return t(r,n,Qt({},i,{},o))},a.attrs=function(o){return t(r,n,Qt({},i,{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},a}(rd,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){gr[e]=gr(e)});const z_=gr.div`
121
121
  position: fixed;
122
122
  top: 0;
123
123
  left: 0;
@@ -128,7 +128,7 @@ object-assign
128
128
  justify-content: center;
129
129
  align-items: center;
130
130
  z-index: 10000; /* Increased z-index to be higher than all other components (others use 9999) */
131
- `,Nv=gr.div`
131
+ `,N_=gr.div`
132
132
  border: 4px solid rgba(255, 255, 255, 0.3);
133
133
  border-top: 4px solid white;
134
134
  border-radius: 50%;
@@ -144,9 +144,9 @@ object-assign
144
144
  transform: rotate(360deg);
145
145
  }
146
146
  }
147
- `,nd=({isVisible:e})=>e?ye.jsx(zv,{children:ye.jsx(Nv,{})}):null,id=re.createContext(null),ad=()=>{const e=re.useContext(id);if(!e)throw new Error("useAPI must be used within an APIProvider");return e},Mv=({children:e})=>{const[t,r]=re.useState(0),n=re.useCallback(async a=>{r(o=>o+1);try{return await a}finally{r(o=>Math.max(0,o-1))}},[]),i=re.useCallback(async(a,o)=>(r(s=>s+1),new Promise((s,l)=>{const c=a(),u=()=>{r(d=>Math.max(0,d-1))};c.addEventListener("load",()=>{if(u(),c.status>=200&&c.status<300)try{const d=o(c);s(d)}catch(d){l(d)}else l(new Error(`Request failed with status ${c.status}`))}),c.addEventListener("error",()=>{u(),l(new Error("Network error occurred"))}),c.addEventListener("abort",()=>{u(),l(new Error("Request cancelled"))})})),[]);return ye.jsxs(id.Provider,{value:{isLoading:t>0,wrapAPICall:n,wrapXHRCall:i},children:[ye.jsx(nd,{isVisible:t>0}),e]})},od=e=>{const t=e;return{createProject:async(S,y)=>{const C={description:S,component_namespace:y};return await fetch(`${t}/create_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})},getProjects:async()=>await fetch(`${t}/fetch_projects`,{method:"GET",headers:{"Content-Type":"application/json"}}),getSubdomains:async S=>await fetch(`${t}/subdomains?project_name=${S}`,{method:"GET",headers:{"Content-Type":"application/json"}}),allocateSubdomain:async(S,y)=>{const C={project_name:S,subdomain:y};return await fetch(`${t}/allocate_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})},releaseSubdomain:async(S,y)=>{const C={project_name:S,subdomain:y};return await fetch(`${t}/release_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})},publishProject:async(S,y)=>{const C={project_name:S,git_ref:y};return await fetch(`${t}/publish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})},unpublishProject:async S=>{const y={project_name:S};return await fetch(`${t}/unpublish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)})},tagCommit:async(S,y,C)=>{const O={project_name:S,commit_hash:y,tag_name:C};return await fetch(`${t}/tag_project_commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})},getComponentLibrary:async()=>await fetch(`${t}/library_components?namespaces=example`,{method:"GET",headers:{"Content-Type":"application/json"}}),addProjectComponent:async(S,y,C,O)=>{const R={project_name:S,component_namespace:y,component_name:C,layout_metadata:O};return await fetch(`${t}/add_project_component`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)})},addProjectChart:async(S,y,C)=>{const O={project_name:S,visual_id:y,layout_metadata:C};return await fetch(`${t}/add_project_chart`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})},updateProjectComponentLayoutMetadata:async(S,y,C)=>{const O={project_name:S,component_id:y,layout_metadata:C};return await fetch(`${t}/update_project_component_layout_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})},updateProjectComponentSourceCode:async(S,y,C)=>{const O={project_name:S,component_id:y,source_code:C};return await fetch(`${t}/update_project_component_source_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})},deleteProjectFile:async(S,y)=>{const C={project_name:S,file_path:y};return await fetch(`${t}/delete_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})},resetProjectFile:async(S,y,C,O,R)=>{let A={project_name:S,file_path:y,git_ref:C};return O&&(A.prune=O),R&&(A.extra_metadata=R),await fetch(`${t}/reset_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})},deleteProject:async S=>{const y={projects:[S]};return await fetch(`${t}/delete_projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)})},requestErrorCorrection:async(S,y,C)=>{const O={project_name:S,component_id:y,error_message:C};return await fetch(`${t}/error_correction`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})},addImage:async S=>await fetch(`${t}/add_image`,{method:"POST",body:S})}},sd=e=>{const t=e;return{getQueryContent:async a=>await fetch(`${t}/v1/public/sql/content-queries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({queryId:a,biscuits:[]})}),getView:async(a,o,s={})=>await fetch(`${t}/v1/sql/view/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parameters:s,viewId:`${a}.${o}`})}),getVisuals:async(a,o,s,l,c,u,d,p)=>{const m=new URLSearchParams({pageNo:a.toString(),pageSize:o.toString(),scope:s,searchPattern:l,sortBy:c,sortOrder:u,visibility:d,visualType:p}).toString();return await fetch(`${t}/v2/content/visuals?${m}`,{method:"GET",headers:{"Content-Type":"application/json"}})}}};for(var Ge=[],_s=0;_s<256;++_s)Ge.push((_s+256).toString(16).slice(1));function Lv(e,t=0){return(Ge[e[t+0]]+Ge[e[t+1]]+Ge[e[t+2]]+Ge[e[t+3]]+"-"+Ge[e[t+4]]+Ge[e[t+5]]+"-"+Ge[e[t+6]]+Ge[e[t+7]]+"-"+Ge[e[t+8]]+Ge[e[t+9]]+"-"+Ge[e[t+10]]+Ge[e[t+11]]+Ge[e[t+12]]+Ge[e[t+13]]+Ge[e[t+14]]+Ge[e[t+15]]).toLowerCase()}var Oa,Fv=new Uint8Array(16);function Uv(){if(!Oa&&(Oa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Oa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oa(Fv)}var Hv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const cd={randomUUID:Hv};function ld(e,t,r){if(cd.randomUUID&&!e)return cd.randomUUID();e=e||{};var n=e.random||(e.rng||Uv)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Lv(n)}function Wv(e){return typeof e=="function"}const qv=e=>{const{wrapAPICall:t}=ad(),r=od(e);return new Proxy(r,{get:(i,a)=>{const o=i[a];return Wv(o)?(...s)=>t(o.apply(i,s)):o}})},xs=re.createContext(null);xs.Consumer;const Gv=e=>{const[t,r]=re.useState({projectName:null,projectURL:null}),[n,i]=re.useState({API_BASE_URL:null,WS_BASE_URL:null,GW_BASE_URL:null}),[a,o]=re.useState(()=>sd(e.config.GW_BASE_URL)),[s,l]=re.useState(""),[c,u]=re.useState(""),[d,p]=re.useState(""),[m,g]=re.useState(ld()),v=qv(e.config.API_BASE_URL),x=od(e.config.API_BASE_URL),b=v||x,[_,k]=re.useState(),[S,y]=re.useState(!1),C=()=>{g(ld())},O=(R,A)=>{if(!R)return;_&&(_.close(),y(!1));const D=localStorage.getItem("accessToken")||"",j=`${n.WS_BASE_URL}/ws/chat/${R}?token=${D}`;if(!j.startsWith("ws://")&&!j.startsWith("wss://")){A.onerror({customWebsocketError:"INVALID_URL"});return}const M=new WebSocket(j);M.onopen=()=>{y(!0),A.onopen()},M.onclose=U=>{y(!1),A.onclose(U)},M.onerror=U=>{A.onerror(U)},M.onmessage=U=>{A.onmessage(U)},k(M)};return re.useEffect(()=>(i(e.config),o(sd(e.config.GW_BASE_URL)),e.metadata&&r(e.metadata),()=>{_&&_.close()}),[e.config]),ye.jsx(xs.Provider,{value:{config:n,projectMetadata:t,setProjectMetadata:r,syncToken:m,setSyncToken:C,selectedComponentId:s,setSelectedComponentId:l,selectedComponentXPath:c,setSelectedComponentXPath:u,selectedComponentHTML:d,setSelectedComponentHTML:p,APIHandler:b,gwAPIHandler:a,startChatbot:O,chatbotWebsocket:_,chatbotWebsocketConnected:S},children:e.children})},Yv=e=>ye.jsx(Mv,{children:ye.jsx(Gv,{...e})}),Es=()=>{const e=re.useContext(xs);if(e===null)throw new Error("Invalid project context.");return{...e}},Zv=async e=>{let t=null,r=null;try{const n=e.replace(/import.*?;\n/g,""),i=pc.transform(n,{presets:["react","typescript"],filename:"file.tsx"}).code,a=new Blob([i],{type:"text/javascript"});t=(await import(URL.createObjectURL(a))).component}catch(n){t=null,r=n.stack}return{compileError:r,compiledComponent:t}},Xv=async e=>{let t=[];const r=await e.getComponentLibrary();if(r.status!==200)throw new Error("Could not load library components");let n=(await r.json()).components;for(const i in n)if(i==="example")for(const a of n[i]){let o=a.content["component.tsx"];o=o.replace(/import.*?;\n/g,"");let s=a.content["layout.json"];const l=pc.transform(o,{presets:["react","typescript"],filename:"file.tsx"}).code,c=new Blob([l],{type:"text/javascript"}),p=(await import(URL.createObjectURL(c))).component;t.push({class:a.name,layout:JSON.parse(s),component:ye.jsx(p,{})})}return t},ud=async e=>{let t=[],r=[];const n=`${window.miDir}/${e}`,i="src/ProjectComponents";let a=await Sf(`${n}/${i}`);a=a.filter(o=>!(o.includes(".gitkeep")||o.includes("index.ts")));for(const o of a){let s=`${o.replace(i,"")}`,l=`${s}/component.tsx`,c=await window.pfs.readFile(`${n}/${i}/${l}`,"utf8");const{compileError:u,compiledComponent:d}=await Zv(c);let p=`${s}/layout.json`;const m=await window.pfs.readFile(`${n}/${i}/${p}`,"utf8");let g={id:o,component:null};if(u){g={...g,overrides:{compileError:{message:u}}},t.push(g),r.push({...JSON.parse(m),i:o});continue}if(s.includes("Chart")){let v=`${s}/chart_config.json`;const x=await window.pfs.readFile(`${n}/${i}/${v}`,"utf8"),b=JSON.parse(x),_=d;g.component=ye.jsx(_,{chartConfig:b})}else{const v=d;g.component=ye.jsx(v,{})}t.push(g),r.push({...JSON.parse(m),i:o})}return{components:t,layout:r}},Vv=async(e,t)=>{var u;const r={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp"},i=(await window.pfs.readdir(window.miDir)).find(d=>d.toLowerCase()===e.toLowerCase());if(!i)throw new Error(`Project "${e}" not found`);const a=`${window.miDir}/${i}/src/assets/images/${t}`,o=await window.pfs.readFile(a),s=Buffer.from(o).toString("base64"),l=((u=t.split(".").pop())==null?void 0:u.toLowerCase())||"";return`data:${r[l]??"image/jpeg"};base64,${s}`},Kv=e=>{if(window.tailwind)window.tailwind.config=e;else throw new Error("Could not load tailwind theme: missing tailwind global.")},Jv=(e,t)=>{const[r,n]=re.useState("");return re.useEffect(()=>{(async()=>{try{const a=await Vv(e,t);n(a)}catch(a){console.error("Error fetching background image URL:",a)}})()},[e,t]),r};var fd={exports:{}},vi={},Ss={exports:{}};(function(e,t){(function(r,n){n(t)})(Ci,function(r){function n($){return function(X,Y,L,V,te,J,ce){return $(X,Y,ce)}}function i($){return function(X,Y,L,V){if(!X||!Y||typeof X!="object"||typeof Y!="object")return $(X,Y,L,V);var te=V.get(X),J=V.get(Y);if(te&&J)return te===Y&&J===X;V.set(X,Y),V.set(Y,X);var ce=$(X,Y,L,V);return V.delete(X),V.delete(Y),ce}}function a($,G){var X={};for(var Y in $)X[Y]=$[Y];for(var Y in G)X[Y]=G[Y];return X}function o($){return $.constructor===Object||$.constructor==null}function s($){return typeof $.then=="function"}function l($,G){return $===G||$!==$&&G!==G}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",m="[object Map]",g="[object Number]",v="[object Object]",x="[object Set]",b="[object String]",_=Object.prototype.toString;function k($){var G=$.areArraysEqual,X=$.areDatesEqual,Y=$.areMapsEqual,L=$.areObjectsEqual,V=$.areRegExpsEqual,te=$.areSetsEqual,J=$.createIsNestedEqual,ce=J(ne);function ne(ie,ke,xe){if(ie===ke)return!0;if(!ie||!ke||typeof ie!="object"||typeof ke!="object")return ie!==ie&&ke!==ke;if(o(ie)&&o(ke))return L(ie,ke,ce,xe);var Et=Array.isArray(ie),Ue=Array.isArray(ke);if(Et||Ue)return Et===Ue&&G(ie,ke,ce,xe);var Pe=_.call(ie);return Pe!==_.call(ke)?!1:Pe===d?X(ie,ke,ce,xe):Pe===p?V(ie,ke,ce,xe):Pe===m?Y(ie,ke,ce,xe):Pe===x?te(ie,ke,ce,xe):Pe===v||Pe===c?s(ie)||s(ke)?!1:L(ie,ke,ce,xe):Pe===u||Pe===g||Pe===b?l(ie.valueOf(),ke.valueOf()):!1}return ne}function S($,G,X,Y){var L=$.length;if(G.length!==L)return!1;for(;L-- >0;)if(!X($[L],G[L],L,L,$,G,Y))return!1;return!0}var y=i(S);function C($,G){return l($.valueOf(),G.valueOf())}function O($,G,X,Y){var L=$.size===G.size;if(!L)return!1;if(!$.size)return!0;var V={},te=0;return $.forEach(function(J,ce){if(L){var ne=!1,ie=0;G.forEach(function(ke,xe){!ne&&!V[ie]&&(ne=X(ce,xe,te,ie,$,G,Y)&&X(J,ke,ce,xe,$,G,Y))&&(V[ie]=!0),ie++}),te++,L=ne}}),L}var R=i(O),A="_owner",D=Object.prototype.hasOwnProperty;function j($,G,X,Y){var L=Object.keys($),V=L.length;if(Object.keys(G).length!==V)return!1;for(var te;V-- >0;){if(te=L[V],te===A){var J=!!$.$$typeof,ce=!!G.$$typeof;if((J||ce)&&J!==ce)return!1}if(!D.call(G,te)||!X($[te],G[te],te,te,$,G,Y))return!1}return!0}var M=i(j);function U($,G){return $.source===G.source&&$.flags===G.flags}function Z($,G,X,Y){var L=$.size===G.size;if(!L)return!1;if(!$.size)return!0;var V={};return $.forEach(function(te,J){if(L){var ce=!1,ne=0;G.forEach(function(ie,ke){!ce&&!V[ne]&&(ce=X(te,ie,J,ke,$,G,Y))&&(V[ne]=!0),ne++}),L=ce}}),L}var de=i(Z),$e=Object.freeze({areArraysEqual:S,areDatesEqual:C,areMapsEqual:O,areObjectsEqual:j,areRegExpsEqual:U,areSetsEqual:Z,createIsNestedEqual:n}),ge=Object.freeze({areArraysEqual:y,areDatesEqual:C,areMapsEqual:R,areObjectsEqual:M,areRegExpsEqual:U,areSetsEqual:de,createIsNestedEqual:n}),_e=k($e);function Je($,G){return _e($,G,void 0)}var Qe=k(a($e,{createIsNestedEqual:function(){return l}}));function fe($,G){return Qe($,G,void 0)}var F=k(ge);function q($,G){return F($,G,new WeakMap)}var W=k(a(ge,{createIsNestedEqual:function(){return l}}));function ee($,G){return W($,G,new WeakMap)}function I($){return k(a($e,$($e)))}function Q($){var G=k(a(ge,$(ge)));return function(X,Y,L){return L===void 0&&(L=new WeakMap),G(X,Y,L)}}r.circularDeepEqual=q,r.circularShallowEqual=ee,r.createCustomCircularEqual=Q,r.createCustomEqual=I,r.deepEqual=Je,r.sameValueZeroEqual=l,r.shallowEqual=fe,Object.defineProperty(r,"__esModule",{value:!0})})})(Ss,Ss.exports);var ks=Ss.exports,Rs={exports:{}};function dd(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=dd(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function hd(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=dd(e))&&(n&&(n+=" "),n+=t);return n}Rs.exports=hd,Rs.exports.clsx=hd;var Os=Rs.exports,he={},Qv=function(t,r,n){return t===r?!0:t.className===r.className&&n(t.style,r.style)&&t.width===r.width&&t.autoSize===r.autoSize&&t.cols===r.cols&&t.draggableCancel===r.draggableCancel&&t.draggableHandle===r.draggableHandle&&n(t.verticalCompact,r.verticalCompact)&&n(t.compactType,r.compactType)&&n(t.layout,r.layout)&&n(t.margin,r.margin)&&n(t.containerPadding,r.containerPadding)&&t.rowHeight===r.rowHeight&&t.maxRows===r.maxRows&&t.isBounded===r.isBounded&&t.isDraggable===r.isDraggable&&t.isResizable===r.isResizable&&t.allowOverlap===r.allowOverlap&&t.preventCollision===r.preventCollision&&t.useCSSTransforms===r.useCSSTransforms&&t.transformScale===r.transformScale&&t.isDroppable===r.isDroppable&&n(t.resizeHandles,r.resizeHandles)&&n(t.resizeHandle,r.resizeHandle)&&t.onLayoutChange===r.onLayoutChange&&t.onDragStart===r.onDragStart&&t.onDrag===r.onDrag&&t.onDragStop===r.onDragStop&&t.onResizeStart===r.onResizeStart&&t.onResize===r.onResize&&t.onResizeStop===r.onResizeStop&&t.onDrop===r.onDrop&&n(t.droppingItem,r.droppingItem)&&n(t.innerRef,r.innerRef)};Object.defineProperty(he,"__esModule",{value:!0}),he.bottom=Cs,he.childrenEqual=r_,he.cloneLayout=md,he.cloneLayoutItem=Br,he.collides=Ca,he.compact=gd,he.compactItem=yd,he.compactType=d_,he.correctBounds=bd,he.fastPositionEqual=n_,he.fastRGLPropsEqual=void 0,he.getAllCollisions=vd,he.getFirstCollision=jr,he.getLayoutItem=Ts,he.getStatics=As,he.modifyLayout=wd,he.moveElement=xi,he.moveElementAwayFromCollision=Ds,he.noop=void 0,he.perc=a_,he.resizeItemInDirection=s_,he.setTopLeft=l_,he.setTransform=c_,he.sortLayoutItems=Ns,he.sortLayoutItemsByColRow=kd,he.sortLayoutItemsByRowCol=Sd,he.synchronizeLayoutWithChildren=u_,he.validateLayout=f_,he.withLayoutItem=t_;var pd=ks,_i=e_(re);function e_(e){return e&&e.__esModule?e:{default:e}}function Cs(e){let t=0,r;for(let n=0,i=e.length;n<i;n++)r=e[n].y+e[n].h,r>t&&(t=r);return t}function md(e){const t=Array(e.length);for(let r=0,n=e.length;r<n;r++)t[r]=Br(e[r]);return t}function wd(e,t){const r=Array(e.length);for(let n=0,i=e.length;n<i;n++)t.i===e[n].i?r[n]=t:r[n]=e[n];return r}function t_(e,t,r){let n=Ts(e,t);return n?(n=r(Br(n)),e=wd(e,n),[e,n]):[e,null]}function Br(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function r_(e,t){return(0,pd.deepEqual)(_i.default.Children.map(e,r=>r==null?void 0:r.key),_i.default.Children.map(t,r=>r==null?void 0:r.key))&&(0,pd.deepEqual)(_i.default.Children.map(e,r=>r==null?void 0:r.props["data-grid"]),_i.default.Children.map(t,r=>r==null?void 0:r.props["data-grid"]))}he.fastRGLPropsEqual=Qv;function n_(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Ca(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function gd(e,t,r,n){const i=As(e),a=Ns(e,t),o=Array(e.length);for(let s=0,l=a.length;s<l;s++){let c=Br(a[s]);c.static||(c=yd(i,c,t,r,a,n),i.push(c)),o[e.indexOf(a[s])]=c,c.moved=!1}return o}const i_={x:"w",y:"h"};function Ps(e,t,r,n){const i=i_[n];t[n]+=1;const a=e.map(o=>o.i).indexOf(t.i);for(let o=a+1;o<e.length;o++){const s=e[o];if(!s.static){if(s.y>t.y+t.h)break;Ca(t,s)&&Ps(e,s,r+t[i],n)}}t[n]=r}function yd(e,t,r,n,i,a){const o=r==="vertical",s=r==="horizontal";if(o)for(t.y=Math.min(Cs(e),t.y);t.y>0&&!jr(e,t);)t.y--;else if(s)for(;t.x>0&&!jr(e,t);)t.x--;let l;for(;(l=jr(e,t))&&!(r===null&&a);)if(s?Ps(i,t,l.x+l.w,"x"):Ps(i,t,l.y+l.h,"y"),s&&t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!jr(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function bd(e,t){const r=As(e);for(let n=0,i=e.length;n<i;n++){const a=e[n];if(a.x+a.w>t.cols&&(a.x=t.cols-a.w),a.x<0&&(a.x=0,a.w=t.cols),!a.static)r.push(a);else for(;jr(r,a);)a.y++}return e}function Ts(e,t){for(let r=0,n=e.length;r<n;r++)if(e[r].i===t)return e[r]}function jr(e,t){for(let r=0,n=e.length;r<n;r++)if(Ca(e[r],t))return e[r]}function vd(e,t){return e.filter(r=>Ca(r,t))}function As(e){return e.filter(t=>t.static)}function xi(e,t,r,n,i,a,o,s,l){if(t.static&&t.isDraggable!==!0||t.y===n&&t.x===r)return e;`${t.i}${String(r)}${String(n)}${t.x}${t.y}`;const c=t.x,u=t.y;typeof r=="number"&&(t.x=r),typeof n=="number"&&(t.y=n),t.moved=!0;let d=Ns(e,o);(o==="vertical"&&typeof n=="number"?u>=n:o==="horizontal"&&typeof r=="number"?c>=r:!1)&&(d=d.reverse());const m=vd(d,t),g=m.length>0;if(g&&l)return md(e);if(g&&a)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let v=0,x=m.length;v<x;v++){const b=m[v];`${t.i}${t.x}${t.y}${b.i}${b.x}${b.y}`,!b.moved&&(b.static?e=Ds(e,b,t,i,o):e=Ds(e,t,b,i,o))}return e}function Ds(e,t,r,n,i,a){const o=i==="horizontal",s=i==="vertical",l=t.static;if(n){n=!1;const d={x:o?Math.max(t.x-r.w,0):r.x,y:s?Math.max(t.y-r.h,0):r.y,w:r.w,h:r.h,i:"-1"},p=jr(e,d),m=p&&p.y+p.h>t.y,g=p&&t.x+t.w>p.x;if(p){if(m&&s)return xi(e,r,void 0,t.y+1,n,l,i);if(m&&i==null)return t.y=r.y,r.y=r.y+r.h,e;if(g&&o)return xi(e,t,r.x,void 0,n,l,i)}else return`${r.i}${d.x}${d.y}`,xi(e,r,o?d.x:void 0,s?d.y:void 0,n,l,i)}const c=o?r.x+1:void 0,u=s?r.y+1:void 0;return c==null&&u==null?e:xi(e,r,o?r.x+1:void 0,s?r.y+1:void 0,n,l,i)}function a_(e){return e*100+"%"}const _d=(e,t,r,n)=>e+r>n?t:r,xd=(e,t,r)=>e<0?t:r,Ed=e=>Math.max(0,e),$s=e=>Math.max(0,e),Is=(e,t,r)=>{let{left:n,height:i,width:a}=t;const o=e.top-(i-e.height);return{left:n,width:a,height:xd(o,e.height,i),top:$s(o)}},Bs=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{top:n,height:a,width:_d(e.left,e.width,o,r),left:Ed(i)}},js=(e,t,r)=>{let{top:n,height:i,width:a}=t;const o=e.left-(a-e.width);return{height:i,width:o<0?e.width:_d(e.left,e.width,a,r),top:$s(n),left:Ed(o)}},zs=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{width:o,left:i,height:xd(n,e.height,a),top:$s(n)}},o_={n:Is,ne:function(){return Is(arguments.length<=0?void 0:arguments[0],Bs(...arguments))},e:Bs,se:function(){return zs(arguments.length<=0?void 0:arguments[0],Bs(...arguments))},s:zs,sw:function(){return zs(arguments.length<=0?void 0:arguments[0],js(...arguments))},w:js,nw:function(){return Is(arguments.length<=0?void 0:arguments[0],js(...arguments))}};function s_(e,t,r,n){const i=o_[e];return i?i(t,{...t,...r},n):r}function c_(e){let{top:t,left:r,width:n,height:i}=e;const a=`translate(${r}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${n}px`,height:`${i}px`,position:"absolute"}}function l_(e){let{top:t,left:r,width:n,height:i}=e;return{top:`${t}px`,left:`${r}px`,width:`${n}px`,height:`${i}px`,position:"absolute"}}function Ns(e,t){return t==="horizontal"?kd(e):t==="vertical"?Sd(e):e}function Sd(e){return e.slice(0).sort(function(t,r){return t.y>r.y||t.y===r.y&&t.x>r.x?1:t.y===r.y&&t.x===r.x?0:-1})}function kd(e){return e.slice(0).sort(function(t,r){return t.x>r.x||t.x===r.x&&t.y>r.y?1:-1})}function u_(e,t,r,n,i){e=e||[];const a=[];_i.default.Children.forEach(t,s=>{if((s==null?void 0:s.key)==null)return;const l=Ts(e,String(s.key)),c=s.props["data-grid"];l&&c==null?a.push(Br(l)):c?a.push(Br({...c,i:s.key})):a.push(Br({w:1,h:1,x:0,y:Cs(a),i:String(s.key)}))});const o=bd(a,{cols:r});return i?o:gd(o,n,r)}function f_(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const r=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let n=0,i=e.length;n<i;n++){const a=e[n];for(let o=0;o<r.length;o++){const s=r[o],l=a[s];if(typeof l!="number"||Number.isNaN(l))throw new Error(`ReactGridLayout: ${t}[${n}].${s} must be a number! Received: ${l} (${typeof l})`)}if(typeof a.i<"u"&&typeof a.i!="string")throw new Error(`ReactGridLayout: ${t}[${n}].i must be a string! Received: ${a.i} (${typeof a.i})`)}}function d_(e){const{verticalCompact:t,compactType:r}=e||{};return t===!1?null:r}function Wx(){}const h_=()=>{};he.noop=h_;var Ut={};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.calcGridColWidth=Pa,Ut.calcGridItemPosition=p_,Ut.calcGridItemWHPx=Ms,Ut.calcWH=w_,Ut.calcXY=m_,Ut.clamp=zr;function Pa(e){const{margin:t,containerPadding:r,containerWidth:n,cols:i}=e;return(n-t[0]*(i-1)-r[0]*2)/i}function Ms(e,t,r){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*r):e}function p_(e,t,r,n,i,a){const{margin:o,containerPadding:s,rowHeight:l}=e,c=Pa(e),u={};return a&&a.resizing?(u.width=Math.round(a.resizing.width),u.height=Math.round(a.resizing.height)):(u.width=Ms(n,c,o[0]),u.height=Ms(i,l,o[1])),a&&a.dragging?(u.top=Math.round(a.dragging.top),u.left=Math.round(a.dragging.left)):a&&a.resizing&&typeof a.resizing.top=="number"&&typeof a.resizing.left=="number"?(u.top=Math.round(a.resizing.top),u.left=Math.round(a.resizing.left)):(u.top=Math.round((l+o[1])*r+s[1]),u.left=Math.round((c+o[0])*t+s[0])),u}function m_(e,t,r,n,i){const{margin:a,containerPadding:o,cols:s,rowHeight:l,maxRows:c}=e,u=Pa(e);let d=Math.round((r-o[0])/(u+a[0])),p=Math.round((t-o[1])/(l+a[1]));return d=zr(d,0,s-n),p=zr(p,0,c-i),{x:d,y:p}}function w_(e,t,r,n,i,a){const{margin:o,maxRows:s,cols:l,rowHeight:c}=e,u=Pa(e);let d=Math.round((t+o[0])/(u+o[0])),p=Math.round((r+o[1])/(c+o[1])),m=zr(d,0,l-n),g=zr(p,0,s-i);return["sw","w","nw"].indexOf(a)!==-1&&(m=zr(d,0,l)),["nw","n","ne"].indexOf(a)!==-1&&(g=zr(p,0,s)),{w:m,h:g}}function zr(e,t,r){return Math.max(Math.min(e,r),t)}var Ta={},Rd={exports:{}},g_="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",y_=g_,b_=y_;function Od(){}function Cd(){}Cd.resetWarningCache=Od;var v_=function(){function e(n,i,a,o,s,l){if(l!==b_){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Cd,resetWarningCache:Od};return r.PropTypes=r,r};Rd.exports=v_();var yr=Rd.exports,Aa={exports:{}},Pd={};function Td(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Td(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Ad(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Td(e))&&(n&&(n+=" "),n+=t);return n}const __=Za(Object.freeze(Object.defineProperty({__proto__:null,clsx:Ad,default:Ad},Symbol.toStringTag,{value:"Module"})));var Be={},Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.dontSetMe=R_,Ht.findInArray=x_,Ht.int=k_,Ht.isFunction=E_,Ht.isNum=S_;function x_(e,t){for(let r=0,n=e.length;r<n;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function E_(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function S_(e){return typeof e=="number"&&!isNaN(e)}function k_(e){return parseInt(e,10)}function R_(e,t,r){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(r," - do not set this, set it on the child."))}var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.browserPrefixToKey=$d,Nr.browserPrefixToStyle=O_,Nr.default=void 0,Nr.getPrefix=Dd;const Ls=["Moz","Webkit","O","ms"];function Dd(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!r||t in r)return"";for(let n=0;n<Ls.length;n++)if($d(t,Ls[n])in r)return Ls[n];return""}function $d(e,t){return t?"".concat(t).concat(C_(e)):e}function O_(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function C_(e){let t="",r=!0;for(let n=0;n<e.length;n++)r?(t+=e[n].toUpperCase(),r=!1):e[n]==="-"?r=!0:t+=e[n];return t}Nr.default=Dd(),Object.defineProperty(Be,"__esModule",{value:!0}),Be.addClassName=zd,Be.addEvent=A_,Be.addUserSelectStyles=U_,Be.createCSSTransform=N_,Be.createSVGTransform=M_,Be.getTouch=L_,Be.getTouchIdentifier=F_,Be.getTranslation=Fs,Be.innerHeight=B_,Be.innerWidth=j_,Be.matchesSelector=jd,Be.matchesSelectorAndParentsTo=T_,Be.offsetXYFromParent=z_,Be.outerHeight=$_,Be.outerWidth=I_,Be.removeClassName=Nd,Be.removeEvent=D_,Be.removeUserSelectStyles=H_;var wt=Ht,Id=P_(Nr);function Bd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Bd=function(n){return n?r:t})(e)}function P_(e,t){if(e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Bd(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}let Da="";function jd(e,t){return Da||(Da=(0,wt.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,wt.isFunction)(e[r])})),(0,wt.isFunction)(e[Da])?e[Da](t):!1}function T_(e,t,r){let n=e;do{if(jd(n,t))return!0;if(n===r)return!1;n=n.parentNode}while(n);return!1}function A_(e,t,r,n){if(!e)return;const i={capture:!0,...n};e.addEventListener?e.addEventListener(t,r,i):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r}function D_(e,t,r,n){if(!e)return;const i={capture:!0,...n};e.removeEventListener?e.removeEventListener(t,r,i):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=null}function $_(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,wt.int)(r.borderTopWidth),t+=(0,wt.int)(r.borderBottomWidth),t}function I_(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,wt.int)(r.borderLeftWidth),t+=(0,wt.int)(r.borderRightWidth),t}function B_(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,wt.int)(r.paddingTop),t-=(0,wt.int)(r.paddingBottom),t}function j_(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,wt.int)(r.paddingLeft),t-=(0,wt.int)(r.paddingRight),t}function z_(e,t,r){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),a=(e.clientX+t.scrollLeft-i.left)/r,o=(e.clientY+t.scrollTop-i.top)/r;return{x:a,y:o}}function N_(e,t){const r=Fs(e,t,"px");return{[(0,Id.browserPrefixToKey)("transform",Id.default)]:r}}function M_(e,t){return Fs(e,t,"")}function Fs(e,t,r){let{x:n,y:i}=e,a="translate(".concat(n).concat(r,",").concat(i).concat(r,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+r),s="".concat(typeof t.y=="string"?t.y:t.y+r);a="translate(".concat(o,", ").concat(s,")")+a}return a}function L_(e,t){return e.targetTouches&&(0,wt.findInArray)(e.targetTouches,r=>t===r.identifier)||e.changedTouches&&(0,wt.findInArray)(e.changedTouches,r=>t===r.identifier)}function F_(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function U_(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
147
+ `,nd=({isVisible:e})=>e?ye.jsx(z_,{children:ye.jsx(N_,{})}):null,id=Q.createContext(null),ad=()=>{const e=Q.useContext(id);if(!e)throw new Error("useAPI must be used within an APIProvider");return e},M_=({children:e})=>{const[t,r]=Q.useState(0),n=Q.useCallback(async a=>{r(o=>o+1);try{return await a}finally{r(o=>Math.max(0,o-1))}},[]),i=Q.useCallback(async(a,o)=>(r(s=>s+1),new Promise((s,l)=>{const c=a(),u=()=>{r(d=>Math.max(0,d-1))};c.addEventListener("load",()=>{if(u(),c.status>=200&&c.status<300)try{const d=o(c);s(d)}catch(d){l(d)}else l(new Error(`Request failed with status ${c.status}`))}),c.addEventListener("error",()=>{u(),l(new Error("Network error occurred"))}),c.addEventListener("abort",()=>{u(),l(new Error("Request cancelled"))})})),[]);return ye.jsxs(id.Provider,{value:{isLoading:t>0,wrapAPICall:n,wrapXHRCall:i},children:[ye.jsx(nd,{isVisible:t>0}),e]})},od=e=>{const t=e;return{createProject:async(O,k)=>{const S={description:O,component_namespace:k};return await fetch(`${t}/create_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},getProjects:async()=>await fetch(`${t}/fetch_projects`,{method:"GET",headers:{"Content-Type":"application/json"}}),getSubdomains:async O=>await fetch(`${t}/subdomains?project_name=${O}`,{method:"GET",headers:{"Content-Type":"application/json"}}),allocateSubdomain:async(O,k)=>{const S={project_name:O,subdomain:k};return await fetch(`${t}/allocate_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},releaseSubdomain:async(O,k)=>{const S={project_name:O,subdomain:k};return await fetch(`${t}/release_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},publishProject:async(O,k)=>{const S={project_name:O,git_ref:k};return await fetch(`${t}/publish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},unpublishProject:async O=>{const k={project_name:O};return await fetch(`${t}/unpublish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)})},tagCommit:async(O,k,S)=>{const A={project_name:O,commit_hash:k,tag_name:S};return await fetch(`${t}/tag_project_commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})},getComponentLibrary:async()=>await fetch(`${t}/library_components?namespaces=example`,{method:"GET",headers:{"Content-Type":"application/json"}}),addProjectComponent:async(O,k,S,A)=>{const D={project_name:O,component_namespace:k,component_name:S,layout_metadata:A};return await fetch(`${t}/add_project_component`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)})},addProjectChart:async(O,k,S)=>{const A={project_name:O,visual_id:k,layout_metadata:S};return await fetch(`${t}/add_project_chart`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})},updateProjectComponentLayoutMetadata:async(O,k,S)=>{const A={project_name:O,component_id:k,layout_metadata:S};return await fetch(`${t}/update_project_component_layout_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})},updateProjectComponentSourceCode:async(O,k,S)=>{const A={project_name:O,component_id:k,source_code:S};return await fetch(`${t}/update_project_component_source_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})},updateApplicationMetadata:async(O,k,S,A)=>{const D={project_name:O,application_name:k,application_description:S,application_category:A};return await fetch(`${t}/update_application_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)})},updateApplicationSettings:async(O,k)=>{const S={project_name:O,application_login_enabled:k};return await fetch(`${t}/update_application_settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},deleteProjectFile:async(O,k)=>{const S={project_name:O,file_path:k};return await fetch(`${t}/delete_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},resetProjectFile:async(O,k,S,A,D)=>{let B={project_name:O,file_path:k,git_ref:S};return A&&(B.prune=A),D&&(B.extra_metadata=D),await fetch(`${t}/reset_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)})},deleteProject:async O=>{const k={projects:[O]};return await fetch(`${t}/delete_projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)})},requestErrorCorrection:async(O,k,S)=>{const A={project_name:O,component_id:k,error_message:S};return await fetch(`${t}/error_correction`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})},addImage:async O=>await fetch(`${t}/add_image`,{method:"POST",body:O})}},sd=e=>{const t=e;return{getQueryContent:async o=>await fetch(`${t}/v1/public/sql/content-queries`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({queryId:o,biscuits:[]})}),getView:async(o,s,l={})=>await fetch(`${t}/v1/sql/view/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parameters:l,viewId:`${o}.${s}`})}),getVisuals:async(o,s,l,c,u,d,p,m)=>{const g=new URLSearchParams({pageNo:o.toString(),pageSize:s.toString(),scope:l,searchPattern:c,sortBy:u,sortOrder:d,visibility:p,visualType:m}).toString();return await fetch(`${t}/v2/content/visuals?${g}`,{method:"GET",headers:{"Content-Type":"application/json"}})},getSubscription:async()=>await fetch(`${t}/v1/subscription`,{method:"GET",headers:{"Content-Type":"application/json"}})}};for(var Ge=[],xs=0;xs<256;++xs)Ge.push((xs+256).toString(16).slice(1));function L_(e,t=0){return(Ge[e[t+0]]+Ge[e[t+1]]+Ge[e[t+2]]+Ge[e[t+3]]+"-"+Ge[e[t+4]]+Ge[e[t+5]]+"-"+Ge[e[t+6]]+Ge[e[t+7]]+"-"+Ge[e[t+8]]+Ge[e[t+9]]+"-"+Ge[e[t+10]]+Ge[e[t+11]]+Ge[e[t+12]]+Ge[e[t+13]]+Ge[e[t+14]]+Ge[e[t+15]]).toLowerCase()}var Oa,F_=new Uint8Array(16);function U_(){if(!Oa&&(Oa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Oa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oa(F_)}var H_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const cd={randomUUID:H_};function ld(e,t,r){if(cd.randomUUID&&!e)return cd.randomUUID();e=e||{};var n=e.random||(e.rng||U_)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,L_(n)}function W_(e){return typeof e=="function"}const q_=e=>{const{wrapAPICall:t}=ad(),r=od(e);return new Proxy(r,{get:(i,a)=>{const o=i[a];return W_(o)?(...s)=>t(o.apply(i,s)):o}})},Es=Q.createContext(null);Es.Consumer;const G_=e=>{const[t,r]=Q.useState({projectName:null,projectURL:null}),[n,i]=Q.useState({API_BASE_URL:null,WS_BASE_URL:null,GW_BASE_URL:null}),[a,o]=Q.useState(()=>sd(e.config.GW_BASE_URL)),[s,l]=Q.useState(""),[c,u]=Q.useState(""),[d,p]=Q.useState(""),[m,g]=Q.useState(ld()),b=q_(e.config.API_BASE_URL),v=od(e.config.API_BASE_URL),y=b||v,[_,R]=Q.useState(),[C,x]=Q.useState(!1),O=()=>{g(ld())},k=(S,A)=>{if(!S)return;_&&(_.close(),x(!1));const D=localStorage.getItem("accessToken")||"",B=`${n.WS_BASE_URL}/ws/chat/${S}?token=${D}`;if(!B.startsWith("ws://")&&!B.startsWith("wss://")){A.onerror({customWebsocketError:"INVALID_URL"});return}const M=new WebSocket(B);M.onopen=()=>{x(!0),A.onopen()},M.onclose=U=>{x(!1),A.onclose(U)},M.onerror=U=>{A.onerror(U)},M.onmessage=U=>{A.onmessage(U)},R(M)};return Q.useEffect(()=>(i(e.config),o(sd(e.config.GW_BASE_URL)),e.metadata&&r(e.metadata),()=>{_&&_.close()}),[e.config]),ye.jsx(Es.Provider,{value:{config:n,projectMetadata:t,setProjectMetadata:r,syncToken:m,setSyncToken:O,selectedComponentId:s,setSelectedComponentId:l,selectedComponentXPath:c,setSelectedComponentXPath:u,selectedComponentHTML:d,setSelectedComponentHTML:p,APIHandler:y,gwAPIHandler:a,startChatbot:k,chatbotWebsocket:_,chatbotWebsocketConnected:C},children:e.children})},Y_=e=>ye.jsx(M_,{children:ye.jsx(G_,{...e})}),Ss=()=>{const e=Q.useContext(Es);if(e===null)throw new Error("Invalid project context.");return{...e}},Z_=async e=>{let t=null,r=null;try{const n=e.replace(/import.*?;\n/g,""),i=mc.transform(n,{presets:["react","typescript"],filename:"file.tsx"}).code,a=new Blob([i],{type:"text/javascript"});t=(await import(URL.createObjectURL(a))).component}catch(n){t=null,r=n.stack}return{compileError:r,compiledComponent:t}},X_=async e=>{let t=[];const r=await e.getComponentLibrary();if(r.status!==200)throw new Error("Could not load library components");let n=(await r.json()).components;for(const i in n)if(i==="example")for(const a of n[i]){let o=a.content["component.tsx"];o=o.replace(/import.*?;\n/g,"");let s=a.content["layout.json"];const l=mc.transform(o,{presets:["react","typescript"],filename:"file.tsx"}).code,c=new Blob([l],{type:"text/javascript"}),p=(await import(URL.createObjectURL(c))).component;t.push({class:a.name,layout:JSON.parse(s),component:ye.jsx(p,{})})}return t},ud=async e=>{let t=[],r=[];const n=`${window.miDir}/${e}`,i="src/ProjectComponents";let a=await kf(`${n}/${i}`);a=a.filter(o=>!(o.includes(".gitkeep")||o.includes("index.ts")));for(const o of a){let s=`${o.replace(i,"")}`,l=`${s}/component.tsx`,c=await window.pfs.readFile(`${n}/${i}/${l}`,"utf8");const{compileError:u,compiledComponent:d}=await Z_(c);let p=`${s}/layout.json`;const m=await window.pfs.readFile(`${n}/${i}/${p}`,"utf8");let g={id:o,component:null};if(u){g={...g,overrides:{compileError:{message:u}}},t.push(g),r.push({...JSON.parse(m),i:o});continue}if(s.includes("Chart")){let b=`${s}/chart_config.json`;const v=await window.pfs.readFile(`${n}/${i}/${b}`,"utf8"),y=JSON.parse(v),_=d;g.component=ye.jsx(_,{chartConfig:y})}else{const b=d;g.component=ye.jsx(b,{})}t.push(g),r.push({...JSON.parse(m),i:o})}return{components:t,layout:r}},V_=async(e,t)=>{var u;const r={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp"},i=(await window.pfs.readdir(window.miDir)).find(d=>d.toLowerCase()===e.toLowerCase());if(!i)throw new Error(`Project "${e}" not found`);const a=`${window.miDir}/${i}/src/assets/images/${t}`,o=await window.pfs.readFile(a),s=Buffer.from(o).toString("base64"),l=((u=t.split(".").pop())==null?void 0:u.toLowerCase())||"";return`data:${r[l]??"image/jpeg"};base64,${s}`},K_=e=>{if(window.tailwind)window.tailwind.config=e;else throw new Error("Could not load tailwind theme: missing tailwind global.")},J_=(e,t)=>{const[r,n]=Q.useState("");return Q.useEffect(()=>{(async()=>{try{const a=await V_(e,t);n(a)}catch(a){console.error("Error fetching background image URL:",a)}})()},[e,t]),r},Q_=(e,t=[])=>{const[r,n]=Q.useState(null);return Q.useEffect(()=>{(async()=>{n(null);try{const a=`${window.miDir}/${e}/metadata.json`;await window.pfs.readFile(a,"utf8").then(o=>{if(o instanceof Uint8Array)throw new Error("Expected string but received buffer (Uint8Array)");n(JSON.parse(o))})}catch(a){throw console.log("Error: can not read app metadata file."),a}})()},[e,...t]),r},ev=(e,t=[])=>{const[r,n]=Q.useState(null);return Q.useEffect(()=>{(async()=>{n(null);try{const a=`${window.miDir}/${e}/settings.json`;await window.pfs.readFile(a,"utf8").then(o=>{if(o instanceof Uint8Array)throw new Error("Expected string but received buffer (Uint8Array)");n(JSON.parse(o))})}catch(a){throw console.log("Error: can not read app settings file."),a}})()},[e,...t]),r},tv=(e,t,r=[])=>{const[n,i]=Q.useState(null);return Q.useEffect(()=>{(async()=>{i(null);const o=await ss(e,t);if(o){const s=o.filter(c=>c.tag==="published"),l=o.filter(c=>c.tag!=="published");i({publishedVersion:s.length?s[0]:null,versions:l})}})()},[e,t,...r]),n};var fd={exports:{}},_i={},ks={exports:{}};(function(e,t){(function(r,n){n(t)})(Ci,function(r){function n($){return function(X,Y,L,V,re,J,ce){return $(X,Y,ce)}}function i($){return function(X,Y,L,V){if(!X||!Y||typeof X!="object"||typeof Y!="object")return $(X,Y,L,V);var re=V.get(X),J=V.get(Y);if(re&&J)return re===Y&&J===X;V.set(X,Y),V.set(Y,X);var ce=$(X,Y,L,V);return V.delete(X),V.delete(Y),ce}}function a($,G){var X={};for(var Y in $)X[Y]=$[Y];for(var Y in G)X[Y]=G[Y];return X}function o($){return $.constructor===Object||$.constructor==null}function s($){return typeof $.then=="function"}function l($,G){return $===G||$!==$&&G!==G}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",m="[object Map]",g="[object Number]",b="[object Object]",v="[object Set]",y="[object String]",_=Object.prototype.toString;function R($){var G=$.areArraysEqual,X=$.areDatesEqual,Y=$.areMapsEqual,L=$.areObjectsEqual,V=$.areRegExpsEqual,re=$.areSetsEqual,J=$.createIsNestedEqual,ce=J(ne);function ne(ie,Re,Ee){if(ie===Re)return!0;if(!ie||!Re||typeof ie!="object"||typeof Re!="object")return ie!==ie&&Re!==Re;if(o(ie)&&o(Re))return L(ie,Re,ce,Ee);var Et=Array.isArray(ie),Ue=Array.isArray(Re);if(Et||Ue)return Et===Ue&&G(ie,Re,ce,Ee);var Pe=_.call(ie);return Pe!==_.call(Re)?!1:Pe===d?X(ie,Re,ce,Ee):Pe===p?V(ie,Re,ce,Ee):Pe===m?Y(ie,Re,ce,Ee):Pe===v?re(ie,Re,ce,Ee):Pe===b||Pe===c?s(ie)||s(Re)?!1:L(ie,Re,ce,Ee):Pe===u||Pe===g||Pe===y?l(ie.valueOf(),Re.valueOf()):!1}return ne}function C($,G,X,Y){var L=$.length;if(G.length!==L)return!1;for(;L-- >0;)if(!X($[L],G[L],L,L,$,G,Y))return!1;return!0}var x=i(C);function O($,G){return l($.valueOf(),G.valueOf())}function k($,G,X,Y){var L=$.size===G.size;if(!L)return!1;if(!$.size)return!0;var V={},re=0;return $.forEach(function(J,ce){if(L){var ne=!1,ie=0;G.forEach(function(Re,Ee){!ne&&!V[ie]&&(ne=X(ce,Ee,re,ie,$,G,Y)&&X(J,Re,ce,Ee,$,G,Y))&&(V[ie]=!0),ie++}),re++,L=ne}}),L}var S=i(k),A="_owner",D=Object.prototype.hasOwnProperty;function B($,G,X,Y){var L=Object.keys($),V=L.length;if(Object.keys(G).length!==V)return!1;for(var re;V-- >0;){if(re=L[V],re===A){var J=!!$.$$typeof,ce=!!G.$$typeof;if((J||ce)&&J!==ce)return!1}if(!D.call(G,re)||!X($[re],G[re],re,re,$,G,Y))return!1}return!0}var M=i(B);function U($,G){return $.source===G.source&&$.flags===G.flags}function Z($,G,X,Y){var L=$.size===G.size;if(!L)return!1;if(!$.size)return!0;var V={};return $.forEach(function(re,J){if(L){var ce=!1,ne=0;G.forEach(function(ie,Re){!ce&&!V[ne]&&(ce=X(re,ie,J,Re,$,G,Y))&&(V[ne]=!0),ne++}),L=ce}}),L}var de=i(Z),$e=Object.freeze({areArraysEqual:C,areDatesEqual:O,areMapsEqual:k,areObjectsEqual:B,areRegExpsEqual:U,areSetsEqual:Z,createIsNestedEqual:n}),ge=Object.freeze({areArraysEqual:x,areDatesEqual:O,areMapsEqual:S,areObjectsEqual:M,areRegExpsEqual:U,areSetsEqual:de,createIsNestedEqual:n}),xe=R($e);function Je($,G){return xe($,G,void 0)}var Qe=R(a($e,{createIsNestedEqual:function(){return l}}));function fe($,G){return Qe($,G,void 0)}var F=R(ge);function q($,G){return F($,G,new WeakMap)}var W=R(a(ge,{createIsNestedEqual:function(){return l}}));function te($,G){return W($,G,new WeakMap)}function I($){return R(a($e,$($e)))}function ee($){var G=R(a(ge,$(ge)));return function(X,Y,L){return L===void 0&&(L=new WeakMap),G(X,Y,L)}}r.circularDeepEqual=q,r.circularShallowEqual=te,r.createCustomCircularEqual=ee,r.createCustomEqual=I,r.deepEqual=Je,r.sameValueZeroEqual=l,r.shallowEqual=fe,Object.defineProperty(r,"__esModule",{value:!0})})})(ks,ks.exports);var Rs=ks.exports,Os={exports:{}};function dd(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=dd(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function hd(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=dd(e))&&(n&&(n+=" "),n+=t);return n}Os.exports=hd,Os.exports.clsx=hd;var Cs=Os.exports,he={},rv=function(t,r,n){return t===r?!0:t.className===r.className&&n(t.style,r.style)&&t.width===r.width&&t.autoSize===r.autoSize&&t.cols===r.cols&&t.draggableCancel===r.draggableCancel&&t.draggableHandle===r.draggableHandle&&n(t.verticalCompact,r.verticalCompact)&&n(t.compactType,r.compactType)&&n(t.layout,r.layout)&&n(t.margin,r.margin)&&n(t.containerPadding,r.containerPadding)&&t.rowHeight===r.rowHeight&&t.maxRows===r.maxRows&&t.isBounded===r.isBounded&&t.isDraggable===r.isDraggable&&t.isResizable===r.isResizable&&t.allowOverlap===r.allowOverlap&&t.preventCollision===r.preventCollision&&t.useCSSTransforms===r.useCSSTransforms&&t.transformScale===r.transformScale&&t.isDroppable===r.isDroppable&&n(t.resizeHandles,r.resizeHandles)&&n(t.resizeHandle,r.resizeHandle)&&t.onLayoutChange===r.onLayoutChange&&t.onDragStart===r.onDragStart&&t.onDrag===r.onDrag&&t.onDragStop===r.onDragStop&&t.onResizeStart===r.onResizeStart&&t.onResize===r.onResize&&t.onResizeStop===r.onResizeStop&&t.onDrop===r.onDrop&&n(t.droppingItem,r.droppingItem)&&n(t.innerRef,r.innerRef)};Object.defineProperty(he,"__esModule",{value:!0}),he.bottom=Ps,he.childrenEqual=av,he.cloneLayout=md,he.cloneLayoutItem=jr,he.collides=Ca,he.compact=gd,he.compactItem=yd,he.compactType=mv,he.correctBounds=bd,he.fastPositionEqual=ov,he.fastRGLPropsEqual=void 0,he.getAllCollisions=_d,he.getFirstCollision=Br,he.getLayoutItem=As,he.getStatics=Ds,he.modifyLayout=wd,he.moveElement=xi,he.moveElementAwayFromCollision=$s,he.noop=void 0,he.perc=cv,he.resizeItemInDirection=uv,he.setTopLeft=dv,he.setTransform=fv,he.sortLayoutItems=Ms,he.sortLayoutItemsByColRow=kd,he.sortLayoutItemsByRowCol=Sd,he.synchronizeLayoutWithChildren=hv,he.validateLayout=pv,he.withLayoutItem=iv;var pd=Rs,vi=nv(Q);function nv(e){return e&&e.__esModule?e:{default:e}}function Ps(e){let t=0,r;for(let n=0,i=e.length;n<i;n++)r=e[n].y+e[n].h,r>t&&(t=r);return t}function md(e){const t=Array(e.length);for(let r=0,n=e.length;r<n;r++)t[r]=jr(e[r]);return t}function wd(e,t){const r=Array(e.length);for(let n=0,i=e.length;n<i;n++)t.i===e[n].i?r[n]=t:r[n]=e[n];return r}function iv(e,t,r){let n=As(e,t);return n?(n=r(jr(n)),e=wd(e,n),[e,n]):[e,null]}function jr(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function av(e,t){return(0,pd.deepEqual)(vi.default.Children.map(e,r=>r==null?void 0:r.key),vi.default.Children.map(t,r=>r==null?void 0:r.key))&&(0,pd.deepEqual)(vi.default.Children.map(e,r=>r==null?void 0:r.props["data-grid"]),vi.default.Children.map(t,r=>r==null?void 0:r.props["data-grid"]))}he.fastRGLPropsEqual=rv;function ov(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Ca(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function gd(e,t,r,n){const i=Ds(e),a=Ms(e,t),o=Array(e.length);for(let s=0,l=a.length;s<l;s++){let c=jr(a[s]);c.static||(c=yd(i,c,t,r,a,n),i.push(c)),o[e.indexOf(a[s])]=c,c.moved=!1}return o}const sv={x:"w",y:"h"};function Ts(e,t,r,n){const i=sv[n];t[n]+=1;const a=e.map(o=>o.i).indexOf(t.i);for(let o=a+1;o<e.length;o++){const s=e[o];if(!s.static){if(s.y>t.y+t.h)break;Ca(t,s)&&Ts(e,s,r+t[i],n)}}t[n]=r}function yd(e,t,r,n,i,a){const o=r==="vertical",s=r==="horizontal";if(o)for(t.y=Math.min(Ps(e),t.y);t.y>0&&!Br(e,t);)t.y--;else if(s)for(;t.x>0&&!Br(e,t);)t.x--;let l;for(;(l=Br(e,t))&&!(r===null&&a);)if(s?Ts(i,t,l.x+l.w,"x"):Ts(i,t,l.y+l.h,"y"),s&&t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Br(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function bd(e,t){const r=Ds(e);for(let n=0,i=e.length;n<i;n++){const a=e[n];if(a.x+a.w>t.cols&&(a.x=t.cols-a.w),a.x<0&&(a.x=0,a.w=t.cols),!a.static)r.push(a);else for(;Br(r,a);)a.y++}return e}function As(e,t){for(let r=0,n=e.length;r<n;r++)if(e[r].i===t)return e[r]}function Br(e,t){for(let r=0,n=e.length;r<n;r++)if(Ca(e[r],t))return e[r]}function _d(e,t){return e.filter(r=>Ca(r,t))}function Ds(e){return e.filter(t=>t.static)}function xi(e,t,r,n,i,a,o,s,l){if(t.static&&t.isDraggable!==!0||t.y===n&&t.x===r)return e;`${t.i}${String(r)}${String(n)}${t.x}${t.y}`;const c=t.x,u=t.y;typeof r=="number"&&(t.x=r),typeof n=="number"&&(t.y=n),t.moved=!0;let d=Ms(e,o);(o==="vertical"&&typeof n=="number"?u>=n:o==="horizontal"&&typeof r=="number"?c>=r:!1)&&(d=d.reverse());const m=_d(d,t),g=m.length>0;if(g&&l)return md(e);if(g&&a)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let b=0,v=m.length;b<v;b++){const y=m[b];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=$s(e,y,t,i,o):e=$s(e,t,y,i,o))}return e}function $s(e,t,r,n,i,a){const o=i==="horizontal",s=i==="vertical",l=t.static;if(n){n=!1;const d={x:o?Math.max(t.x-r.w,0):r.x,y:s?Math.max(t.y-r.h,0):r.y,w:r.w,h:r.h,i:"-1"},p=Br(e,d),m=p&&p.y+p.h>t.y,g=p&&t.x+t.w>p.x;if(p){if(m&&s)return xi(e,r,void 0,t.y+1,n,l,i);if(m&&i==null)return t.y=r.y,r.y=r.y+r.h,e;if(g&&o)return xi(e,t,r.x,void 0,n,l,i)}else return`${r.i}${d.x}${d.y}`,xi(e,r,o?d.x:void 0,s?d.y:void 0,n,l,i)}const c=o?r.x+1:void 0,u=s?r.y+1:void 0;return c==null&&u==null?e:xi(e,r,o?r.x+1:void 0,s?r.y+1:void 0,n,l,i)}function cv(e){return e*100+"%"}const vd=(e,t,r,n)=>e+r>n?t:r,xd=(e,t,r)=>e<0?t:r,Ed=e=>Math.max(0,e),Is=e=>Math.max(0,e),js=(e,t,r)=>{let{left:n,height:i,width:a}=t;const o=e.top-(i-e.height);return{left:n,width:a,height:xd(o,e.height,i),top:Is(o)}},Bs=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{top:n,height:a,width:vd(e.left,e.width,o,r),left:Ed(i)}},zs=(e,t,r)=>{let{top:n,height:i,width:a}=t;const o=e.left-(a-e.width);return{height:i,width:o<0?e.width:vd(e.left,e.width,a,r),top:Is(n),left:Ed(o)}},Ns=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{width:o,left:i,height:xd(n,e.height,a),top:Is(n)}},lv={n:js,ne:function(){return js(arguments.length<=0?void 0:arguments[0],Bs(...arguments))},e:Bs,se:function(){return Ns(arguments.length<=0?void 0:arguments[0],Bs(...arguments))},s:Ns,sw:function(){return Ns(arguments.length<=0?void 0:arguments[0],zs(...arguments))},w:zs,nw:function(){return js(arguments.length<=0?void 0:arguments[0],zs(...arguments))}};function uv(e,t,r,n){const i=lv[e];return i?i(t,{...t,...r},n):r}function fv(e){let{top:t,left:r,width:n,height:i}=e;const a=`translate(${r}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${n}px`,height:`${i}px`,position:"absolute"}}function dv(e){let{top:t,left:r,width:n,height:i}=e;return{top:`${t}px`,left:`${r}px`,width:`${n}px`,height:`${i}px`,position:"absolute"}}function Ms(e,t){return t==="horizontal"?kd(e):t==="vertical"?Sd(e):e}function Sd(e){return e.slice(0).sort(function(t,r){return t.y>r.y||t.y===r.y&&t.x>r.x?1:t.y===r.y&&t.x===r.x?0:-1})}function kd(e){return e.slice(0).sort(function(t,r){return t.x>r.x||t.x===r.x&&t.y>r.y?1:-1})}function hv(e,t,r,n,i){e=e||[];const a=[];vi.default.Children.forEach(t,s=>{if((s==null?void 0:s.key)==null)return;const l=As(e,String(s.key)),c=s.props["data-grid"];l&&c==null?a.push(jr(l)):c?a.push(jr({...c,i:s.key})):a.push(jr({w:1,h:1,x:0,y:Ps(a),i:String(s.key)}))});const o=bd(a,{cols:r});return i?o:gd(o,n,r)}function pv(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const r=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let n=0,i=e.length;n<i;n++){const a=e[n];for(let o=0;o<r.length;o++){const s=r[o],l=a[s];if(typeof l!="number"||Number.isNaN(l))throw new Error(`ReactGridLayout: ${t}[${n}].${s} must be a number! Received: ${l} (${typeof l})`)}if(typeof a.i<"u"&&typeof a.i!="string")throw new Error(`ReactGridLayout: ${t}[${n}].i must be a string! Received: ${a.i} (${typeof a.i})`)}}function mv(e){const{verticalCompact:t,compactType:r}=e||{};return t===!1?null:r}function Yx(){}const wv=()=>{};he.noop=wv;var Ut={};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.calcGridColWidth=Pa,Ut.calcGridItemPosition=gv,Ut.calcGridItemWHPx=Ls,Ut.calcWH=bv,Ut.calcXY=yv,Ut.clamp=zr;function Pa(e){const{margin:t,containerPadding:r,containerWidth:n,cols:i}=e;return(n-t[0]*(i-1)-r[0]*2)/i}function Ls(e,t,r){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*r):e}function gv(e,t,r,n,i,a){const{margin:o,containerPadding:s,rowHeight:l}=e,c=Pa(e),u={};return a&&a.resizing?(u.width=Math.round(a.resizing.width),u.height=Math.round(a.resizing.height)):(u.width=Ls(n,c,o[0]),u.height=Ls(i,l,o[1])),a&&a.dragging?(u.top=Math.round(a.dragging.top),u.left=Math.round(a.dragging.left)):a&&a.resizing&&typeof a.resizing.top=="number"&&typeof a.resizing.left=="number"?(u.top=Math.round(a.resizing.top),u.left=Math.round(a.resizing.left)):(u.top=Math.round((l+o[1])*r+s[1]),u.left=Math.round((c+o[0])*t+s[0])),u}function yv(e,t,r,n,i){const{margin:a,containerPadding:o,cols:s,rowHeight:l,maxRows:c}=e,u=Pa(e);let d=Math.round((r-o[0])/(u+a[0])),p=Math.round((t-o[1])/(l+a[1]));return d=zr(d,0,s-n),p=zr(p,0,c-i),{x:d,y:p}}function bv(e,t,r,n,i,a){const{margin:o,maxRows:s,cols:l,rowHeight:c}=e,u=Pa(e);let d=Math.round((t+o[0])/(u+o[0])),p=Math.round((r+o[1])/(c+o[1])),m=zr(d,0,l-n),g=zr(p,0,s-i);return["sw","w","nw"].indexOf(a)!==-1&&(m=zr(d,0,l)),["nw","n","ne"].indexOf(a)!==-1&&(g=zr(p,0,s)),{w:m,h:g}}function zr(e,t,r){return Math.max(Math.min(e,r),t)}var Ta={},Rd={exports:{}},_v="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",vv=_v,xv=vv;function Od(){}function Cd(){}Cd.resetWarningCache=Od;var Ev=function(){function e(n,i,a,o,s,l){if(l!==xv){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Cd,resetWarningCache:Od};return r.PropTypes=r,r};Rd.exports=Ev();var yr=Rd.exports,Aa={exports:{}},Pd={};function Td(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Td(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Ad(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Td(e))&&(n&&(n+=" "),n+=t);return n}const Sv=Za(Object.freeze(Object.defineProperty({__proto__:null,clsx:Ad,default:Ad},Symbol.toStringTag,{value:"Module"})));var je={},Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.dontSetMe=Pv,Ht.findInArray=kv,Ht.int=Cv,Ht.isFunction=Rv,Ht.isNum=Ov;function kv(e,t){for(let r=0,n=e.length;r<n;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function Rv(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Ov(e){return typeof e=="number"&&!isNaN(e)}function Cv(e){return parseInt(e,10)}function Pv(e,t,r){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(r," - do not set this, set it on the child."))}var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.browserPrefixToKey=$d,Nr.browserPrefixToStyle=Tv,Nr.default=void 0,Nr.getPrefix=Dd;const Fs=["Moz","Webkit","O","ms"];function Dd(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!r||t in r)return"";for(let n=0;n<Fs.length;n++)if($d(t,Fs[n])in r)return Fs[n];return""}function $d(e,t){return t?"".concat(t).concat(Av(e)):e}function Tv(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Av(e){let t="",r=!0;for(let n=0;n<e.length;n++)r?(t+=e[n].toUpperCase(),r=!1):e[n]==="-"?r=!0:t+=e[n];return t}Nr.default=Dd(),Object.defineProperty(je,"__esModule",{value:!0}),je.addClassName=zd,je.addEvent=Iv,je.addUserSelectStyles=qv,je.createCSSTransform=Fv,je.createSVGTransform=Uv,je.getTouch=Hv,je.getTouchIdentifier=Wv,je.getTranslation=Us,je.innerHeight=Nv,je.innerWidth=Mv,je.matchesSelector=Bd,je.matchesSelectorAndParentsTo=$v,je.offsetXYFromParent=Lv,je.outerHeight=Bv,je.outerWidth=zv,je.removeClassName=Nd,je.removeEvent=jv,je.removeUserSelectStyles=Gv;var wt=Ht,Id=Dv(Nr);function jd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(jd=function(n){return n?r:t})(e)}function Dv(e,t){if(e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=jd(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}let Da="";function Bd(e,t){return Da||(Da=(0,wt.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,wt.isFunction)(e[r])})),(0,wt.isFunction)(e[Da])?e[Da](t):!1}function $v(e,t,r){let n=e;do{if(Bd(n,t))return!0;if(n===r)return!1;n=n.parentNode}while(n);return!1}function Iv(e,t,r,n){if(!e)return;const i={capture:!0,...n};e.addEventListener?e.addEventListener(t,r,i):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r}function jv(e,t,r,n){if(!e)return;const i={capture:!0,...n};e.removeEventListener?e.removeEventListener(t,r,i):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=null}function Bv(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,wt.int)(r.borderTopWidth),t+=(0,wt.int)(r.borderBottomWidth),t}function zv(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,wt.int)(r.borderLeftWidth),t+=(0,wt.int)(r.borderRightWidth),t}function Nv(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,wt.int)(r.paddingTop),t-=(0,wt.int)(r.paddingBottom),t}function Mv(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,wt.int)(r.paddingLeft),t-=(0,wt.int)(r.paddingRight),t}function Lv(e,t,r){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),a=(e.clientX+t.scrollLeft-i.left)/r,o=(e.clientY+t.scrollTop-i.top)/r;return{x:a,y:o}}function Fv(e,t){const r=Us(e,t,"px");return{[(0,Id.browserPrefixToKey)("transform",Id.default)]:r}}function Uv(e,t){return Us(e,t,"")}function Us(e,t,r){let{x:n,y:i}=e,a="translate(".concat(n).concat(r,",").concat(i).concat(r,")");if(t){const o="".concat(typeof t.x=="string"?t.x:t.x+r),s="".concat(typeof t.y=="string"?t.y:t.y+r);a="translate(".concat(o,", ").concat(s,")")+a}return a}function Hv(e,t){return e.targetTouches&&(0,wt.findInArray)(e.targetTouches,r=>t===r.identifier)||e.changedTouches&&(0,wt.findInArray)(e.changedTouches,r=>t===r.identifier)}function Wv(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function qv(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
148
148
  `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
149
- `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&zd(e.body,"react-draggable-transparent-selection")}function H_(e){if(e)try{if(e.body&&Nd(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function zd(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Nd(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.canDragX=G_,Wt.canDragY=Y_,Wt.createCoreData=X_,Wt.createDraggableData=V_,Wt.getBoundPosition=W_,Wt.getControlPosition=Z_,Wt.snapToGrid=q_;var gt=Ht,_n=Be;function W_(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:n}=e.props;n=typeof n=="string"?n:K_(n);const i=Us(e);if(typeof n=="string"){const{ownerDocument:a}=i,o=a.defaultView;let s;if(n==="parent"?s=i.parentNode:s=a.querySelector(n),!(s instanceof o.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const l=s,c=o.getComputedStyle(i),u=o.getComputedStyle(l);n={left:-i.offsetLeft+(0,gt.int)(u.paddingLeft)+(0,gt.int)(c.marginLeft),top:-i.offsetTop+(0,gt.int)(u.paddingTop)+(0,gt.int)(c.marginTop),right:(0,_n.innerWidth)(l)-(0,_n.outerWidth)(i)-i.offsetLeft+(0,gt.int)(u.paddingRight)-(0,gt.int)(c.marginRight),bottom:(0,_n.innerHeight)(l)-(0,_n.outerHeight)(i)-i.offsetTop+(0,gt.int)(u.paddingBottom)-(0,gt.int)(c.marginBottom)}}return(0,gt.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,gt.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,gt.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,gt.isNum)(n.top)&&(r=Math.max(r,n.top)),[t,r]}function q_(e,t,r){const n=Math.round(t/e[0])*e[0],i=Math.round(r/e[1])*e[1];return[n,i]}function G_(e){return e.props.axis==="both"||e.props.axis==="x"}function Y_(e){return e.props.axis==="both"||e.props.axis==="y"}function Z_(e,t,r){const n=typeof t=="number"?(0,_n.getTouch)(e,t):null;if(typeof t=="number"&&!n)return null;const i=Us(r),a=r.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,_n.offsetXYFromParent)(n||e,a,r.props.scale)}function X_(e,t,r){const n=!(0,gt.isNum)(e.lastX),i=Us(e);return n?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:r,x:t,y:r}:{node:i,deltaX:t-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:r}}function V_(e,t){const r=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/r,y:e.state.y+t.deltaY/r,deltaX:t.deltaX/r,deltaY:t.deltaY/r,lastX:e.state.x,lastY:e.state.y}}function K_(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Us(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var $a={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.default=J_;function J_(){}Object.defineProperty($a,"__esModule",{value:!0}),$a.default=void 0;var Hs=e1(re),ft=qs(yr),Q_=qs(hc),Ve=Be,br=Wt,Ws=Ht,Ei=qs(Ia);function qs(e){return e&&e.__esModule?e:{default:e}}function Md(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Md=function(n){return n?r:t})(e)}function e1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Md(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function it(e,t,r){return t=t1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t1(e){var t=r1(e,"string");return typeof t=="symbol"?t:String(t)}function r1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Pt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let vr=Pt.mouse,Ba=class extends Hs.Component{constructor(){super(...arguments),it(this,"dragging",!1),it(this,"lastX",NaN),it(this,"lastY",NaN),it(this,"touchIdentifier",null),it(this,"mounted",!1),it(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=r;if(this.props.disabled||!(t.target instanceof n.defaultView.Node)||this.props.handle&&!(0,Ve.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,Ve.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const i=(0,Ve.getTouchIdentifier)(t);this.touchIdentifier=i;const a=(0,br.getControlPosition)(t,i,this);if(a==null)return;const{x:o,y:s}=a,l=(0,br.createCoreData)(this,o,s);(0,Ei.default)("DraggableCore: handleDragStart: %j",l),(0,Ei.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Ve.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=s,(0,Ve.addEvent)(n,vr.move,this.handleDrag),(0,Ve.addEvent)(n,vr.stop,this.handleDragStop))}),it(this,"handleDrag",t=>{const r=(0,br.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let s=n-this.lastX,l=i-this.lastY;if([s,l]=(0,br.snapToGrid)(this.props.grid,s,l),!s&&!l)return;n=this.lastX+s,i=this.lastY+l}const a=(0,br.createCoreData)(this,n,i);if((0,Ei.default)("DraggableCore: handleDrag: %j",a),this.props.onDrag(t,a)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=n,this.lastY=i}),it(this,"handleDragStop",t=>{if(!this.dragging)return;const r=(0,br.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let l=n-this.lastX||0,c=i-this.lastY||0;[l,c]=(0,br.snapToGrid)(this.props.grid,l,c),n=this.lastX+l,i=this.lastY+c}const a=(0,br.createCoreData)(this,n,i);if(this.props.onStop(t,a)===!1||this.mounted===!1)return!1;const s=this.findDOMNode();s&&this.props.enableUserSelectHack&&(0,Ve.removeUserSelectStyles)(s.ownerDocument),(0,Ei.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,s&&((0,Ei.default)("DraggableCore: Removing handlers"),(0,Ve.removeEvent)(s.ownerDocument,vr.move,this.handleDrag),(0,Ve.removeEvent)(s.ownerDocument,vr.stop,this.handleDragStop))}),it(this,"onMouseDown",t=>(vr=Pt.mouse,this.handleDragStart(t))),it(this,"onMouseUp",t=>(vr=Pt.mouse,this.handleDragStop(t))),it(this,"onTouchStart",t=>(vr=Pt.touch,this.handleDragStart(t))),it(this,"onTouchEnd",t=>(vr=Pt.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,Ve.addEvent)(t,Pt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,Ve.removeEvent)(r,Pt.mouse.move,this.handleDrag),(0,Ve.removeEvent)(r,Pt.touch.move,this.handleDrag),(0,Ve.removeEvent)(r,Pt.mouse.stop,this.handleDragStop),(0,Ve.removeEvent)(r,Pt.touch.stop,this.handleDragStop),(0,Ve.removeEvent)(t,Pt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Ve.removeUserSelectStyles)(r)}}findDOMNode(){var t,r;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:Q_.default.findDOMNode(this)}render(){return Hs.cloneElement(Hs.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};$a.default=Ba,it(Ba,"displayName","DraggableCore"),it(Ba,"propTypes",{allowAnyClick:ft.default.bool,children:ft.default.node.isRequired,disabled:ft.default.bool,enableUserSelectHack:ft.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:ft.default.arrayOf(ft.default.number),handle:ft.default.string,cancel:ft.default.string,nodeRef:ft.default.object,onStart:ft.default.func,onDrag:ft.default.func,onStop:ft.default.func,onMouseDown:ft.default.func,scale:ft.default.number,className:Ws.dontSetMe,style:Ws.dontSetMe,transform:Ws.dontSetMe}),it(Ba,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=p(re),r=u(yr),n=u(hc),i=u(__),a=Be,o=Wt,s=Ht,l=u($a),c=u(Ia);function u(_){return _&&_.__esModule?_:{default:_}}function d(_){if(typeof WeakMap!="function")return null;var k=new WeakMap,S=new WeakMap;return(d=function(y){return y?S:k})(_)}function p(_,k){if(_&&_.__esModule)return _;if(_===null||typeof _!="object"&&typeof _!="function")return{default:_};var S=d(k);if(S&&S.has(_))return S.get(_);var y={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in _)if(O!=="default"&&Object.prototype.hasOwnProperty.call(_,O)){var R=C?Object.getOwnPropertyDescriptor(_,O):null;R&&(R.get||R.set)?Object.defineProperty(y,O,R):y[O]=_[O]}return y.default=_,S&&S.set(_,y),y}function m(){return m=Object.assign?Object.assign.bind():function(_){for(var k=1;k<arguments.length;k++){var S=arguments[k];for(var y in S)Object.prototype.hasOwnProperty.call(S,y)&&(_[y]=S[y])}return _},m.apply(this,arguments)}function g(_,k,S){return k=v(k),k in _?Object.defineProperty(_,k,{value:S,enumerable:!0,configurable:!0,writable:!0}):_[k]=S,_}function v(_){var k=x(_,"string");return typeof k=="symbol"?k:String(k)}function x(_,k){if(typeof _!="object"||_===null)return _;var S=_[Symbol.toPrimitive];if(S!==void 0){var y=S.call(_,k||"default");if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(_)}class b extends t.Component{static getDerivedStateFromProps(k,S){let{position:y}=k,{prevPropsPosition:C}=S;return y&&(!C||y.x!==C.x||y.y!==C.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:y,prevPropsPosition:C}),{x:y.x,y:y.y,prevPropsPosition:{...y}}):null}constructor(k){super(k),g(this,"onDragStart",(S,y)=>{if((0,c.default)("Draggable: onDragStart: %j",y),this.props.onStart(S,(0,o.createDraggableData)(this,y))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(S,y)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",y);const C=(0,o.createDraggableData)(this,y),O={x:C.x,y:C.y,slackX:0,slackY:0};if(this.props.bounds){const{x:A,y:D}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[j,M]=(0,o.getBoundPosition)(this,O.x,O.y);O.x=j,O.y=M,O.slackX=this.state.slackX+(A-O.x),O.slackY=this.state.slackY+(D-O.y),C.x=O.x,C.y=O.y,C.deltaX=O.x-this.state.x,C.deltaY=O.y-this.state.y}if(this.props.onDrag(S,C)===!1)return!1;this.setState(O)}),g(this,"onDragStop",(S,y)=>{if(!this.state.dragging||this.props.onStop(S,(0,o.createDraggableData)(this,y))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",y);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:A,y:D}=this.props.position;O.x=A,O.y=D}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:k.position?k.position.x:k.defaultPosition.x,y:k.position?k.position.y:k.defaultPosition.y,prevPropsPosition:{...k.position},slackX:0,slackY:0,isElementSVG:!1},k.position&&!(k.onDrag||k.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var k,S;return(k=(S=this.props)===null||S===void 0||(S=S.nodeRef)===null||S===void 0?void 0:S.current)!==null&&k!==void 0?k:n.default.findDOMNode(this)}render(){const{axis:k,bounds:S,children:y,defaultPosition:C,defaultClassName:O,defaultClassNameDragging:R,defaultClassNameDragged:A,position:D,positionOffset:j,scale:M,...U}=this.props;let Z={},de=null;const ge=!!!D||this.state.dragging,_e=D||C,Je={x:(0,o.canDragX)(this)&&ge?this.state.x:_e.x,y:(0,o.canDragY)(this)&&ge?this.state.y:_e.y};this.state.isElementSVG?de=(0,a.createSVGTransform)(Je,j):Z=(0,a.createCSSTransform)(Je,j);const Qe=(0,i.default)(y.props.className||"",O,{[R]:this.state.dragging,[A]:this.state.dragged});return t.createElement(l.default,m({},U,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(y),{className:Qe,style:{...y.props.style,...Z},transform:de}))}}e.default=b,g(b,"displayName","Draggable"),g(b,"propTypes",{...l.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),g(b,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(Pd);const{default:Ld,DraggableCore:n1}=Pd;Aa.exports=Ld,Aa.exports.default=Ld,Aa.exports.DraggableCore=n1;var Fd=Aa.exports,ja={exports:{}},Si={},Gs={};Gs.__esModule=!0,Gs.cloneElement=l1;var i1=a1(re);function a1(e){return e&&e.__esModule?e:{default:e}}function Ud(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Hd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ud(Object(r),!0).forEach(function(n){o1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ud(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function o1(e,t,r){return t=s1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s1(e){var t=c1(e,"string");return typeof t=="symbol"?t:String(t)}function c1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function l1(e,t){return t.style&&e.props.style&&(t.style=Hd(Hd({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),i1.default.cloneElement(e,t)}var ki={};ki.__esModule=!0,ki.resizableProps=void 0;var le=u1(yr);function u1(e){return e&&e.__esModule?e:{default:e}}var f1={axis:le.default.oneOf(["both","x","y","none"]),className:le.default.string,children:le.default.element.isRequired,draggableOpts:le.default.shape({allowAnyClick:le.default.bool,cancel:le.default.string,children:le.default.node,disabled:le.default.bool,enableUserSelectHack:le.default.bool,offsetParent:le.default.node,grid:le.default.arrayOf(le.default.number),handle:le.default.string,nodeRef:le.default.object,onStart:le.default.func,onDrag:le.default.func,onStop:le.default.func,onMouseDown:le.default.func,scale:le.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r[0];if(i.axis==="both"||i.axis==="y"){var a;return(a=le.default.number).isRequired.apply(a,r)}return le.default.number.apply(le.default,r)},handle:le.default.oneOfType([le.default.node,le.default.func]),handleSize:le.default.arrayOf(le.default.number),lockAspectRatio:le.default.bool,maxConstraints:le.default.arrayOf(le.default.number),minConstraints:le.default.arrayOf(le.default.number),onResizeStop:le.default.func,onResizeStart:le.default.func,onResize:le.default.func,resizeHandles:le.default.arrayOf(le.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:le.default.number,width:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r[0];if(i.axis==="both"||i.axis==="x"){var a;return(a=le.default.number).isRequired.apply(a,r)}return le.default.number.apply(le.default,r)}};ki.resizableProps=f1,Si.__esModule=!0,Si.default=void 0;var Ri=w1(re),d1=Fd,h1=Gs,p1=ki,m1=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Wd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Wd=function(i){return i?r:t})(e)}function w1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Wd(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Ys(){return Ys=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ys.apply(this,arguments)}function g1(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function qd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qd(Object(r),!0).forEach(function(n){y1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function y1(e,t,r){return t=b1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b1(e){var t=v1(e,"string");return typeof t=="symbol"?t:String(t)}function v1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xs(e,t)}function Xs(e,t){return Xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Xs(e,t)}var Vs=function(e){_1(t,e);function t(){for(var n,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a))||this,n.handleRefs={},n.lastHandleRect=null,n.slack=null,n}var r=t.prototype;return r.componentWillUnmount=function(){this.resetData()},r.resetData=function(){this.lastHandleRect=this.slack=null},r.runConstraints=function(i,a){var o=this.props,s=o.minConstraints,l=o.maxConstraints,c=o.lockAspectRatio;if(!s&&!l&&!c)return[i,a];if(c){var u=this.props.width/this.props.height,d=i-this.props.width,p=a-this.props.height;Math.abs(d)>Math.abs(p*u)?a=i/u:i=a*u}var m=i,g=a,v=this.slack||[0,0],x=v[0],b=v[1];return i+=x,a+=b,s&&(i=Math.max(s[0],i),a=Math.max(s[1],a)),l&&(i=Math.min(l[0],i),a=Math.min(l[1],a)),this.slack=[x+(m-i),b+(g-a)],[i,a]},r.resizeHandler=function(i,a){var o=this;return function(s,l){var c=l.node,u=l.deltaX,d=l.deltaY;i==="onResizeStart"&&o.resetData();var p=(o.props.axis==="both"||o.props.axis==="x")&&a!=="n"&&a!=="s",m=(o.props.axis==="both"||o.props.axis==="y")&&a!=="e"&&a!=="w";if(!(!p&&!m)){var g=a[0],v=a[a.length-1],x=c.getBoundingClientRect();if(o.lastHandleRect!=null){if(v==="w"){var b=x.left-o.lastHandleRect.left;u+=b}if(g==="n"){var _=x.top-o.lastHandleRect.top;d+=_}}o.lastHandleRect=x,v==="w"&&(u=-u),g==="n"&&(d=-d);var k=o.props.width+(p?u/o.props.transformScale:0),S=o.props.height+(m?d/o.props.transformScale:0),y=o.runConstraints(k,S);k=y[0],S=y[1];var C=k!==o.props.width||S!==o.props.height,O=typeof o.props[i]=="function"?o.props[i]:null,R=i==="onResize"&&!C;O&&!R&&(s.persist==null||s.persist(),O(s,{node:c,size:{width:k,height:S},handle:a})),i==="onResizeStop"&&o.resetData()}}},r.renderResizeHandle=function(i,a){var o=this.props.handle;if(!o)return Ri.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+i,ref:a});if(typeof o=="function")return o(i,a);var s=typeof o.type=="string",l=Zs({ref:a},s?{}:{handleAxis:i});return Ri.cloneElement(o,l)},r.render=function(){var i=this,a=this.props,o=a.children,s=a.className,l=a.draggableOpts;a.width,a.height,a.handle,a.handleSize,a.lockAspectRatio,a.axis,a.minConstraints,a.maxConstraints,a.onResize,a.onResizeStop,a.onResizeStart;var c=a.resizeHandles;a.transformScale;var u=g1(a,m1);return(0,h1.cloneElement)(o,Zs(Zs({},u),{},{className:(s?s+" ":"")+"react-resizable",children:[].concat(o.props.children,c.map(function(d){var p,m=(p=i.handleRefs[d])!=null?p:i.handleRefs[d]=Ri.createRef();return Ri.createElement(d1.DraggableCore,Ys({},l,{nodeRef:m,key:"resizableHandle-"+d,onStop:i.resizeHandler("onResizeStop",d),onStart:i.resizeHandler("onResizeStart",d),onDrag:i.resizeHandler("onResize",d)}),i.renderResizeHandle(d,m))}))}))},t}(Ri.Component);Si.default=Vs,Vs.propTypes=p1.resizableProps,Vs.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var za={};za.__esModule=!0,za.default=void 0;var Ks=R1(re),x1=Gd(yr),E1=Gd(Si),S1=ki,k1=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Gd(e){return e&&e.__esModule?e:{default:e}}function Yd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Yd=function(i){return i?r:t})(e)}function R1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Yd(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Js(){return Js=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Js.apply(this,arguments)}function Zd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zd(Object(r),!0).forEach(function(n){O1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function O1(e,t,r){return t=C1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C1(e){var t=P1(e,"string");return typeof t=="symbol"?t:String(t)}function P1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function T1(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function A1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Qs(e,t)}function Qs(e,t){return Qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Qs(e,t)}var Xd=function(e){A1(t,e);function t(){for(var n,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a))||this,n.state={width:n.props.width,height:n.props.height,propsWidth:n.props.width,propsHeight:n.props.height},n.onResize=function(s,l){var c=l.size;n.props.onResize?(s.persist==null||s.persist(),n.setState(c,function(){return n.props.onResize&&n.props.onResize(s,l)})):n.setState(c)},n}t.getDerivedStateFromProps=function(i,a){return a.propsWidth!==i.width||a.propsHeight!==i.height?{width:i.width,height:i.height,propsWidth:i.width,propsHeight:i.height}:null};var r=t.prototype;return r.render=function(){var i=this.props,a=i.handle,o=i.handleSize;i.onResize;var s=i.onResizeStart,l=i.onResizeStop,c=i.draggableOpts,u=i.minConstraints,d=i.maxConstraints,p=i.lockAspectRatio,m=i.axis;i.width,i.height;var g=i.resizeHandles,v=i.style,x=i.transformScale,b=T1(i,k1);return Ks.createElement(E1.default,{axis:m,draggableOpts:c,handle:a,handleSize:o,height:this.state.height,lockAspectRatio:p,maxConstraints:d,minConstraints:u,onResizeStart:s,onResize:this.onResize,onResizeStop:l,resizeHandles:g,transformScale:x,width:this.state.width},Ks.createElement("div",Js({},b,{style:Na(Na({},v),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Ks.Component);za.default=Xd,Xd.propTypes=Na(Na({},S1.resizableProps),{},{children:x1.default.element}),ja.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},ja.exports.Resizable=Si.default,ja.exports.ResizableBox=za.default;var D1=ja.exports,er={};Object.defineProperty(er,"__esModule",{value:!0}),er.resizeHandleType=er.resizeHandleAxesType=er.default=void 0;var ue=Vd(yr),$1=Vd(re);function Vd(e){return e&&e.__esModule?e:{default:e}}const I1=er.resizeHandleAxesType=ue.default.arrayOf(ue.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),B1=er.resizeHandleType=ue.default.oneOfType([ue.default.node,ue.default.func]);er.default={className:ue.default.string,style:ue.default.object,width:ue.default.number,autoSize:ue.default.bool,cols:ue.default.number,draggableCancel:ue.default.string,draggableHandle:ue.default.string,verticalCompact:function(e){e.verticalCompact},compactType:ue.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&he.validateLayout(t,"layout")},margin:ue.default.arrayOf(ue.default.number),containerPadding:ue.default.arrayOf(ue.default.number),rowHeight:ue.default.number,maxRows:ue.default.number,isBounded:ue.default.bool,isDraggable:ue.default.bool,isResizable:ue.default.bool,allowOverlap:ue.default.bool,preventCollision:ue.default.bool,useCSSTransforms:ue.default.bool,transformScale:ue.default.number,isDroppable:ue.default.bool,resizeHandles:I1,resizeHandle:B1,onLayoutChange:ue.default.func,onDragStart:ue.default.func,onDrag:ue.default.func,onDragStop:ue.default.func,onResizeStart:ue.default.func,onResize:ue.default.func,onResizeStop:ue.default.func,onDrop:ue.default.func,droppingItem:ue.default.shape({i:ue.default.string.isRequired,w:ue.default.number.isRequired,h:ue.default.number.isRequired}),children:function(e,t){const r=e[t],n={};$1.default.Children.forEach(r,function(i){if((i==null?void 0:i.key)!=null){if(n[i.key])throw new Error('Duplicate child key "'+i.key+'" found! This will cause problems in ReactGridLayout.');n[i.key]=!0}})},innerRef:ue.default.any},Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.default=void 0;var xn=ec(re),ve=ec(yr),j1=Fd,z1=D1,En=he,Ye=Ut,Kd=er,N1=ec(Os);function ec(e){return e&&e.__esModule?e:{default:e}}function qt(e,t,r){return t=M1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M1(e){var t=L1(e,"string");return typeof t=="symbol"?t:String(t)}function L1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class tc extends xn.default.Component{constructor(){super(...arguments),qt(this,"state",{resizing:null,dragging:null,className:""}),qt(this,"elementRef",xn.default.createRef()),qt(this,"onDragStart",(t,r)=>{let{node:n}=r;const{onDragStart:i,transformScale:a}=this.props;if(!i)return;const o={top:0,left:0},{offsetParent:s}=n;if(!s)return;const l=s.getBoundingClientRect(),c=n.getBoundingClientRect(),u=c.left/a,d=l.left/a,p=c.top/a,m=l.top/a;o.left=u-d+s.scrollLeft,o.top=p-m+s.scrollTop,this.setState({dragging:o});const{x:g,y:v}=(0,Ye.calcXY)(this.getPositionParams(),o.top,o.left,this.props.w,this.props.h);return i.call(this,this.props.i,g,v,{e:t,node:n,newPosition:o})}),qt(this,"onDrag",(t,r)=>{let{node:n,deltaX:i,deltaY:a}=r;const{onDrag:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let s=this.state.dragging.top+a,l=this.state.dragging.left+i;const{isBounded:c,i:u,w:d,h:p,containerWidth:m}=this.props,g=this.getPositionParams();if(c){const{offsetParent:_}=n;if(_){const{margin:k,rowHeight:S,containerPadding:y}=this.props,C=_.clientHeight-(0,Ye.calcGridItemWHPx)(p,S,k[1]);s=(0,Ye.clamp)(s-y[1],0,C);const O=(0,Ye.calcGridColWidth)(g),R=m-(0,Ye.calcGridItemWHPx)(d,O,k[0]);l=(0,Ye.clamp)(l-y[0],0,R)}}const v={top:s,left:l};this.setState({dragging:v});const{x,y:b}=(0,Ye.calcXY)(g,s,l,d,p);return o.call(this,u,x,b,{e:t,node:n,newPosition:v})}),qt(this,"onDragStop",(t,r)=>{let{node:n}=r;const{onDragStop:i}=this.props;if(!i)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:a,h:o,i:s}=this.props,{left:l,top:c}=this.state.dragging,u={top:c,left:l};this.setState({dragging:null});const{x:d,y:p}=(0,Ye.calcXY)(this.getPositionParams(),c,l,a,o);return i.call(this,s,d,p,{e:t,node:n,newPosition:u})}),qt(this,"onResizeStop",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStop")),qt(this,"onResizeStart",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStart")),qt(this,"onResize",(t,r,n)=>this.onResizeHandler(t,r,n,"onResize"))}shouldComponentUpdate(t,r){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const n=(0,Ye.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),i=(0,Ye.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,r);return!(0,En.fastPositionEqual)(n,i)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:r}=this.props;if(!r)return;const n=this.elementRef.current;if(!n)return;const i=t.droppingPosition||{left:0,top:0},{dragging:a}=this.state,o=a&&r.left!==i.left||r.top!==i.top;if(!a)this.onDragStart(r.e,{node:n,deltaX:r.left,deltaY:r.top});else if(o){const s=r.left-a.left,l=r.top-a.top;this.onDrag(r.e,{node:n,deltaX:s,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:r,containerWidth:n,useCSSTransforms:i}=this.props;let a;return i?a=(0,En.setTransform)(t):(a=(0,En.setTopLeft)(t),r&&(a.left=(0,En.perc)(t.left/n),a.width=(0,En.perc)(t.width/n))),a}mixinDraggable(t,r){return xn.default.createElement(j1.DraggableCore,{disabled:!r,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,r){return(n,i)=>r(n,i,t)}mixinResizable(t,r,n){const{cols:i,minW:a,minH:o,maxW:s,maxH:l,transformScale:c,resizeHandles:u,resizeHandle:d}=this.props,p=this.getPositionParams(),m=(0,Ye.calcGridItemPosition)(p,0,0,i,0).width,g=(0,Ye.calcGridItemPosition)(p,0,0,a,o),v=(0,Ye.calcGridItemPosition)(p,0,0,s,l),x=[g.width,g.height],b=[Math.min(v.width,m),Math.min(v.height,1/0)];return xn.default.createElement(z1.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:r.width,height:r.height,minConstraints:x,maxConstraints:b,onResizeStop:this.curryResizeHandler(r,this.onResizeStop),onResizeStart:this.curryResizeHandler(r,this.onResizeStart),onResize:this.curryResizeHandler(r,this.onResize),transformScale:c,resizeHandles:u,handle:d},t)}onResizeHandler(t,r,n,i){let{node:a,size:o,handle:s}=r;const l=this.props[i];if(!l)return;const{x:c,y:u,i:d,maxH:p,minH:m,containerWidth:g}=this.props,{minW:v,maxW:x}=this.props;let b=o;a&&(b=(0,En.resizeItemInDirection)(s,n,o,g),this.setState({resizing:i==="onResizeStop"?null:b}));let{w:_,h:k}=(0,Ye.calcWH)(this.getPositionParams(),b.width,b.height,c,u,s);_=(0,Ye.clamp)(_,Math.max(v,1),x),k=(0,Ye.clamp)(k,m,p),l.call(this,d,_,k,{e:t,node:a,size:b,handle:s})}render(){const{x:t,y:r,w:n,h:i,isDraggable:a,isResizable:o,droppingPosition:s,useCSSTransforms:l}=this.props,c=(0,Ye.calcGridItemPosition)(this.getPositionParams(),t,r,n,i,this.state),u=xn.default.Children.only(this.props.children);let d=xn.default.cloneElement(u,{ref:this.elementRef,className:(0,N1.default)("react-grid-item",u.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":a,"react-draggable-dragging":!!this.state.dragging,dropping:!!s,cssTransforms:l}),style:{...this.props.style,...u.props.style,...this.createStyle(c)}});return d=this.mixinResizable(d,c,o),d=this.mixinDraggable(d,a),d}}Ta.default=tc,qt(tc,"propTypes",{children:ve.default.element,cols:ve.default.number.isRequired,containerWidth:ve.default.number.isRequired,rowHeight:ve.default.number.isRequired,margin:ve.default.array.isRequired,maxRows:ve.default.number.isRequired,containerPadding:ve.default.array.isRequired,x:ve.default.number.isRequired,y:ve.default.number.isRequired,w:ve.default.number.isRequired,h:ve.default.number.isRequired,minW:function(e,t){const r=e[t];if(typeof r!="number")return new Error("minWidth not Number");if(r>e.w||r>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const r=e[t];if(typeof r!="number")return new Error("maxWidth not Number");if(r<e.w||r<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const r=e[t];if(typeof r!="number")return new Error("minHeight not Number");if(r>e.h||r>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const r=e[t];if(typeof r!="number")return new Error("maxHeight not Number");if(r<e.h||r<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:ve.default.string.isRequired,resizeHandles:Kd.resizeHandleAxesType,resizeHandle:Kd.resizeHandleType,onDragStop:ve.default.func,onDragStart:ve.default.func,onDrag:ve.default.func,onResizeStop:ve.default.func,onResizeStart:ve.default.func,onResize:ve.default.func,isDraggable:ve.default.bool.isRequired,isResizable:ve.default.bool.isRequired,isBounded:ve.default.bool.isRequired,static:ve.default.bool,useCSSTransforms:ve.default.bool.isRequired,transformScale:ve.default.number,className:ve.default.string,handle:ve.default.string,cancel:ve.default.string,droppingPosition:ve.default.shape({e:ve.default.object.isRequired,left:ve.default.number.isRequired,top:ve.default.number.isRequired})}),qt(tc,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=void 0;var Mr=W1(re),rc=ks,F1=nc(Os),ae=he,U1=Ut,Jd=nc(Ta),H1=nc(er);function nc(e){return e&&e.__esModule?e:{default:e}}function Qd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Qd=function(n){return n?r:t})(e)}function W1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Qd(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Ke(e,t,r){return t=q1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q1(e){var t=G1(e,"string");return typeof t=="symbol"?t:String(t)}function G1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const eh="react-grid-layout";let th=!1;try{th=/firefox/i.test(navigator.userAgent)}catch{}class Ma extends Mr.Component{constructor(){super(...arguments),Ke(this,"state",{activeDrag:null,layout:(0,ae.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,ae.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),Ke(this,"dragEnterCounter",0),Ke(this,"onDragStart",(t,r,n,i)=>{let{e:a,node:o}=i;const{layout:s}=this.state,l=(0,ae.getLayoutItem)(s,t);if(!l)return;const c={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,ae.cloneLayoutItem)(l),oldLayout:s,activeDrag:c}),this.props.onDragStart(s,l,l,null,a,o)}),Ke(this,"onDrag",(t,r,n,i)=>{let{e:a,node:o}=i;const{oldDragItem:s}=this.state;let{layout:l}=this.state;const{cols:c,allowOverlap:u,preventCollision:d}=this.props,p=(0,ae.getLayoutItem)(l,t);if(!p)return;const m={w:p.w,h:p.h,x:p.x,y:p.y,placeholder:!0,i:t};l=(0,ae.moveElement)(l,p,r,n,!0,d,(0,ae.compactType)(this.props),c,u),this.props.onDrag(l,s,p,m,a,o),this.setState({layout:u?l:(0,ae.compact)(l,(0,ae.compactType)(this.props),c),activeDrag:m})}),Ke(this,"onDragStop",(t,r,n,i)=>{let{e:a,node:o}=i;if(!this.state.activeDrag)return;const{oldDragItem:s}=this.state;let{layout:l}=this.state;const{cols:c,preventCollision:u,allowOverlap:d}=this.props,p=(0,ae.getLayoutItem)(l,t);if(!p)return;l=(0,ae.moveElement)(l,p,r,n,!0,u,(0,ae.compactType)(this.props),c,d);const g=d?l:(0,ae.compact)(l,(0,ae.compactType)(this.props),c);this.props.onDragStop(g,s,p,null,a,o);const{oldLayout:v}=this.state;this.setState({activeDrag:null,layout:g,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(g,v)}),Ke(this,"onResizeStart",(t,r,n,i)=>{let{e:a,node:o}=i;const{layout:s}=this.state,l=(0,ae.getLayoutItem)(s,t);l&&(this.setState({oldResizeItem:(0,ae.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(s,l,l,null,a,o))}),Ke(this,"onResize",(t,r,n,i)=>{let{e:a,node:o,size:s,handle:l}=i;const{oldResizeItem:c}=this.state,{layout:u}=this.state,{cols:d,preventCollision:p,allowOverlap:m}=this.props;let g=!1,v,x,b;const[_,k]=(0,ae.withLayoutItem)(u,t,y=>{let C;return x=y.x,b=y.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(x=y.x+(y.w-r),r=y.x!==x&&x<0?y.w:r,x=x<0?0:x),["ne","n","nw"].indexOf(l)!==-1&&(b=y.y+(y.h-n),n=y.y!==b&&b<0?y.h:n,b=b<0?0:b),g=!0),p&&!m&&(C=(0,ae.getAllCollisions)(u,{...y,w:r,h:n,x,y:b}).filter(R=>R.i!==y.i).length>0,C&&(b=y.y,n=y.h,x=y.x,r=y.w,g=!1)),y.w=r,y.h=n,y});if(!k)return;v=_,g&&(v=(0,ae.moveElement)(_,k,x,b,!0,this.props.preventCollision,(0,ae.compactType)(this.props),d,m));const S={w:k.w,h:k.h,x:k.x,y:k.y,static:!0,i:t};this.props.onResize(v,c,k,S,a,o),this.setState({layout:m?v:(0,ae.compact)(v,(0,ae.compactType)(this.props),d),activeDrag:S})}),Ke(this,"onResizeStop",(t,r,n,i)=>{let{e:a,node:o}=i;const{layout:s,oldResizeItem:l}=this.state,{cols:c,allowOverlap:u}=this.props,d=(0,ae.getLayoutItem)(s,t),p=u?s:(0,ae.compact)(s,(0,ae.compactType)(this.props),c);this.props.onResizeStop(p,l,d,null,a,o);const{oldLayout:m}=this.state;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(p,m)}),Ke(this,"onDragOver",t=>{var _;if(t.preventDefault(),t.stopPropagation(),th&&!((_=t.nativeEvent.target)!=null&&_.classList.contains(eh)))return!1;const{droppingItem:r,onDropDragOver:n,margin:i,cols:a,rowHeight:o,maxRows:s,width:l,containerPadding:c,transformScale:u}=this.props,d=n==null?void 0:n(t);if(d===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const p={...r,...d},{layout:m}=this.state,g=t.currentTarget.getBoundingClientRect(),v=t.clientX-g.left,x=t.clientY-g.top,b={left:v/u,top:x/u,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:k,top:S}=this.state.droppingPosition;(k!=v||S!=x)&&this.setState({droppingPosition:b})}}else{const k={cols:a,margin:i,maxRows:s,rowHeight:o,containerWidth:l,containerPadding:c||i},S=(0,U1.calcXY)(k,x,v,p.w,p.h);this.setState({droppingDOMNode:Mr.createElement("div",{key:p.i}),droppingPosition:b,layout:[...m,{...p,x:S.x,y:S.y,static:!1,isDraggable:!0}]})}}),Ke(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:r}=this.props,{layout:n}=this.state,i=(0,ae.compact)(n.filter(a=>a.i!==t.i),(0,ae.compactType)(this.props),r,this.props.allowOverlap);this.setState({layout:i,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),Ke(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),Ke(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),Ke(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:r}=this.props,{layout:n}=this.state,i=n.find(a=>a.i===r.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(n,i,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,r){let n;return r.activeDrag?null:(!(0,rc.deepEqual)(t.layout,r.propsLayout)||t.compactType!==r.compactType?n=t.layout:(0,ae.childrenEqual)(t.children,r.children)||(n=r.layout),n?{layout:(0,ae.synchronizeLayoutWithChildren)(n,t.children,t.cols,(0,ae.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,r){return this.props.children!==t.children||!(0,ae.fastRGLPropsEqual)(this.props,t,rc.deepEqual)||this.state.activeDrag!==r.activeDrag||this.state.mounted!==r.mounted||this.state.droppingPosition!==r.droppingPosition}componentDidUpdate(t,r){if(!this.state.activeDrag){const n=this.state.layout,i=r.layout;this.onLayoutMaybeChanged(n,i)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,ae.bottom)(this.state.layout),r=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+r*2+"px"}onLayoutMaybeChanged(t,r){r||(r=this.state.layout),(0,rc.deepEqual)(r,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:r,cols:n,margin:i,containerPadding:a,rowHeight:o,maxRows:s,useCSSTransforms:l,transformScale:c}=this.props;return Mr.createElement(Jd.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:r,cols:n,margin:i,containerPadding:a||i,maxRows:s,rowHeight:o,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:c},Mr.createElement("div",null))}processGridItem(t,r){if(!t||!t.key)return;const n=(0,ae.getLayoutItem)(this.state.layout,String(t.key));if(!n)return null;const{width:i,cols:a,margin:o,containerPadding:s,rowHeight:l,maxRows:c,isDraggable:u,isResizable:d,isBounded:p,useCSSTransforms:m,transformScale:g,draggableCancel:v,draggableHandle:x,resizeHandles:b,resizeHandle:_}=this.props,{mounted:k,droppingPosition:S}=this.state,y=typeof n.isDraggable=="boolean"?n.isDraggable:!n.static&&u,C=typeof n.isResizable=="boolean"?n.isResizable:!n.static&&d,O=n.resizeHandles||b,R=y&&p&&n.isBounded!==!1;return Mr.createElement(Jd.default,{containerWidth:i,cols:a,margin:o,containerPadding:s||o,maxRows:c,rowHeight:l,cancel:v,handle:x,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:y,isResizable:C,isBounded:R,useCSSTransforms:m&&k,usePercentages:!k,transformScale:g,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:r?S:void 0,resizeHandles:O,resizeHandle:_},t)}render(){const{className:t,style:r,isDroppable:n,innerRef:i}=this.props,a=(0,F1.default)(eh,t),o={height:this.containerHeight(),...r};return Mr.createElement("div",{ref:i,className:a,style:o,onDrop:n?this.onDrop:ae.noop,onDragLeave:n?this.onDragLeave:ae.noop,onDragEnter:n?this.onDragEnter:ae.noop,onDragOver:n?this.onDragOver:ae.noop},Mr.Children.map(this.props.children,s=>this.processGridItem(s)),n&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}vi.default=Ma,Ke(Ma,"displayName","ReactGridLayout"),Ke(Ma,"propTypes",H1.default),Ke(Ma,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:ae.noop,onDragStart:ae.noop,onDrag:ae.noop,onDragStop:ae.noop,onResizeStart:ae.noop,onResize:ae.noop,onResizeStop:ae.noop,onDrop:ae.noop,onDropDragOver:ae.noop});var La={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.findOrGenerateResponsiveLayout=X1,Lr.getBreakpointFromWidth=Y1,Lr.getColsFromBreakpoint=Z1,Lr.sortBreakpoints=ic;var Fa=he;function Y1(e,t){const r=ic(e);let n=r[0];for(let i=1,a=r.length;i<a;i++){const o=r[i];t>e[o]&&(n=o)}return n}function Z1(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function X1(e,t,r,n,i,a){if(e[r])return(0,Fa.cloneLayout)(e[r]);let o=e[n];const s=ic(t),l=s.slice(s.indexOf(r));for(let c=0,u=l.length;c<u;c++){const d=l[c];if(e[d]){o=e[d];break}}return o=(0,Fa.cloneLayout)(o||[]),(0,Fa.compact)((0,Fa.correctBounds)(o,{cols:i}),a,i)}function ic(e){return Object.keys(e).sort(function(r,n){return e[r]-e[n]})}Object.defineProperty(La,"__esModule",{value:!0}),La.default=void 0;var rh=K1(re),dt=nh(yr),ac=ks,Sn=he,Fr=Lr,V1=nh(vi);function nh(e){return e&&e.__esModule?e:{default:e}}function ih(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(ih=function(n){return n?r:t})(e)}function K1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=ih(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function oc(){return oc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oc.apply(this,arguments)}function Ua(e,t,r){return t=J1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J1(e){var t=Q1(e,"string");return typeof t=="symbol"?t:String(t)}function Q1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const ah=e=>Object.prototype.toString.call(e);function Ha(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class sc extends rh.Component{constructor(){super(...arguments),Ua(this,"state",this.generateInitialState()),Ua(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:r,layouts:n,cols:i}=this.props,a=(0,Fr.getBreakpointFromWidth)(r,t),o=(0,Fr.getColsFromBreakpoint)(a,i),s=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Fr.findOrGenerateResponsiveLayout)(n,r,a,a,o,s),breakpoint:a,cols:o}}static getDerivedStateFromProps(t,r){if(!(0,ac.deepEqual)(t.layouts,r.layouts)){const{breakpoint:n,cols:i}=r;return{layout:(0,Fr.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,n,n,i,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,ac.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,ac.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:r,cols:n,layouts:i,compactType:a}=this.props,o=this.props.breakpoint||(0,Fr.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),s=this.state.breakpoint,l=(0,Fr.getColsFromBreakpoint)(o,n),c={...i};if(s!==o||t.breakpoints!==r||t.cols!==n){s in c||(c[s]=(0,Sn.cloneLayout)(this.state.layout));let p=(0,Fr.findOrGenerateResponsiveLayout)(c,r,o,s,l,a);p=(0,Sn.synchronizeLayoutWithChildren)(p,this.props.children,l,a,this.props.allowOverlap),c[o]=p,this.props.onBreakpointChange(o,l),this.props.onLayoutChange(p,c),this.setState({breakpoint:o,layout:p,cols:l})}const u=Ha(this.props.margin,o),d=Ha(this.props.containerPadding,o);this.props.onWidthChange(this.props.width,u,l,d)}render(){const{breakpoint:t,breakpoints:r,cols:n,layouts:i,margin:a,containerPadding:o,onBreakpointChange:s,onLayoutChange:l,onWidthChange:c,...u}=this.props;return rh.createElement(V1.default,oc({},u,{margin:Ha(a,this.state.breakpoint),containerPadding:Ha(o,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}La.default=sc,Ua(sc,"propTypes",{breakpoint:dt.default.string,breakpoints:dt.default.object,allowOverlap:dt.default.bool,cols:dt.default.object,margin:dt.default.oneOfType([dt.default.array,dt.default.object]),containerPadding:dt.default.oneOfType([dt.default.array,dt.default.object]),layouts(e,t){if(ah(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+ah(e[t]));Object.keys(e[t]).forEach(r=>{if(!(r in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,Sn.validateLayout)(e.layouts[r],"layouts."+r)})},width:dt.default.number.isRequired,onBreakpointChange:dt.default.func,onLayoutChange:dt.default.func,onWidthChange:dt.default.func}),Ua(sc,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:Sn.noop,onLayoutChange:Sn.noop,onWidthChange:Sn.noop});var cc={},oh=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(i,a){return i[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),i=this.__entries__[n];return i&&i[1]},t.prototype.set=function(r,n){var i=e(this.__entries__,r);~i?this.__entries__[i][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,i=e(n,r);~i&&n.splice(i,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var i=0,a=this.__entries__;i<a.length;i++){var o=a[i];r.call(n,o[1],o[0])}},t}()}(),lc=typeof window<"u"&&typeof document<"u"&&window.document===document,Wa=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),ex=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Wa):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),tx=2;function rx(e,t){var r=!1,n=!1,i=0;function a(){r&&(r=!1,e()),n&&s()}function o(){ex(a)}function s(){var l=Date.now();if(r){if(l-i<tx)return;n=!0}else r=!0,n=!1,setTimeout(o,t);i=l}return s}var nx=20,ix=["top","right","bottom","left","width","height","size","weight"],ax=typeof MutationObserver<"u",ox=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=rx(this.refresh.bind(this),nx)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!lc||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ax?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!lc||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,i=ix.some(function(a){return!!~n.indexOf(a)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),sh=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},kn=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Wa},ch=Ga(0,0,0,0);function qa(e){return parseFloat(e)||0}function lh(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,i){var a=e["border-"+i+"-width"];return n+qa(a)},0)}function sx(e){for(var t=["top","right","bottom","left"],r={},n=0,i=t;n<i.length;n++){var a=i[n],o=e["padding-"+a];r[a]=qa(o)}return r}function cx(e){var t=e.getBBox();return Ga(0,0,t.width,t.height)}function lx(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return ch;var n=kn(e).getComputedStyle(e),i=sx(n),a=i.left+i.right,o=i.top+i.bottom,s=qa(n.width),l=qa(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=lh(n,"left","right")+a),Math.round(l+o)!==r&&(l-=lh(n,"top","bottom")+o)),!fx(e)){var c=Math.round(s+a)-t,u=Math.round(l+o)-r;Math.abs(c)!==1&&(s-=c),Math.abs(u)!==1&&(l-=u)}return Ga(i.left,i.top,s,l)}var ux=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof kn(e).SVGGraphicsElement}:function(e){return e instanceof kn(e).SVGElement&&typeof e.getBBox=="function"}}();function fx(e){return e===kn(e).document.documentElement}function dx(e){return lc?ux(e)?cx(e):lx(e):ch}function hx(e){var t=e.x,r=e.y,n=e.width,i=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(a.prototype);return sh(o,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),o}function Ga(e,t,r,n){return{x:e,y:t,width:r,height:n}}var px=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Ga(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=dx(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),mx=function(){function e(t,r){var n=hx(r);sh(this,{target:t,contentRect:n})}return e}(),wx=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new oh,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof kn(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new px(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof kn(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new mx(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),uh=typeof WeakMap<"u"?new WeakMap:new oh,fh=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ox.getInstance(),n=new wx(t,r,this);uh.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){fh.prototype[e]=function(){var t;return(t=uh.get(this))[e].apply(t,arguments)}});var gx=function(){return typeof Wa.ResizeObserver<"u"?Wa.ResizeObserver:fh}();const yx=Za(Object.freeze(Object.defineProperty({__proto__:null,default:gx},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(cc,"__esModule",{value:!0}),cc.default=Rx;var Ya=xx(re),bx=uc(yr),vx=uc(yx),_x=uc(Os);function uc(e){return e&&e.__esModule?e:{default:e}}function dh(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(dh=function(n){return n?r:t})(e)}function xx(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=dh(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function fc(){return fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fc.apply(this,arguments)}function Rn(e,t,r){return t=Ex(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ex(e){var t=Sx(e,"string");return typeof t=="symbol"?t:String(t)}function Sx(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const kx="react-grid-layout";function Rx(e){var t;return t=class extends Ya.Component{constructor(){super(...arguments),Rn(this,"state",{width:1280}),Rn(this,"elementRef",Ya.createRef()),Rn(this,"mounted",!1),Rn(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new vx.default(i=>{if(this.elementRef.current instanceof HTMLElement){const o=i[0].contentRect.width;this.setState({width:o})}});const n=this.elementRef.current;n instanceof HTMLElement&&this.resizeObserver.observe(n)}componentWillUnmount(){this.mounted=!1;const n=this.elementRef.current;n instanceof HTMLElement&&this.resizeObserver.unobserve(n),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:n,...i}=this.props;return n&&!this.mounted?Ya.createElement("div",{className:(0,_x.default)(this.props.className,kx),style:this.props.style,ref:this.elementRef}):Ya.createElement(e,fc({innerRef:this.elementRef},i,this.state))}},Rn(t,"defaultProps",{measureBeforeMount:!1}),Rn(t,"propTypes",{measureBeforeMount:bx.default.bool}),t}(function(e){e.exports=vi.default,e.exports.utils=he,e.exports.calculateUtils=Ut,e.exports.Responsive=La.default,e.exports.Responsive.utils=Lr,e.exports.WidthProvider=cc.default})(fd);var dc=fd.exports;const hh=St(dc),Ox=dc.WidthProvider(hh),Cx=gr.div`
149
+ `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&zd(e.body,"react-draggable-transparent-selection")}function Gv(e){if(e)try{if(e.body&&Nd(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function zd(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Nd(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.canDragX=Xv,Wt.canDragY=Vv,Wt.createCoreData=Jv,Wt.createDraggableData=Qv,Wt.getBoundPosition=Yv,Wt.getControlPosition=Kv,Wt.snapToGrid=Zv;var gt=Ht,vn=je;function Yv(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:n}=e.props;n=typeof n=="string"?n:e1(n);const i=Hs(e);if(typeof n=="string"){const{ownerDocument:a}=i,o=a.defaultView;let s;if(n==="parent"?s=i.parentNode:s=a.querySelector(n),!(s instanceof o.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const l=s,c=o.getComputedStyle(i),u=o.getComputedStyle(l);n={left:-i.offsetLeft+(0,gt.int)(u.paddingLeft)+(0,gt.int)(c.marginLeft),top:-i.offsetTop+(0,gt.int)(u.paddingTop)+(0,gt.int)(c.marginTop),right:(0,vn.innerWidth)(l)-(0,vn.outerWidth)(i)-i.offsetLeft+(0,gt.int)(u.paddingRight)-(0,gt.int)(c.marginRight),bottom:(0,vn.innerHeight)(l)-(0,vn.outerHeight)(i)-i.offsetTop+(0,gt.int)(u.paddingBottom)-(0,gt.int)(c.marginBottom)}}return(0,gt.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,gt.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,gt.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,gt.isNum)(n.top)&&(r=Math.max(r,n.top)),[t,r]}function Zv(e,t,r){const n=Math.round(t/e[0])*e[0],i=Math.round(r/e[1])*e[1];return[n,i]}function Xv(e){return e.props.axis==="both"||e.props.axis==="x"}function Vv(e){return e.props.axis==="both"||e.props.axis==="y"}function Kv(e,t,r){const n=typeof t=="number"?(0,vn.getTouch)(e,t):null;if(typeof t=="number"&&!n)return null;const i=Hs(r),a=r.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,vn.offsetXYFromParent)(n||e,a,r.props.scale)}function Jv(e,t,r){const n=!(0,gt.isNum)(e.lastX),i=Hs(e);return n?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:r,x:t,y:r}:{node:i,deltaX:t-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:r}}function Qv(e,t){const r=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/r,y:e.state.y+t.deltaY/r,deltaX:t.deltaX/r,deltaY:t.deltaY/r,lastX:e.state.x,lastY:e.state.y}}function e1(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Hs(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var $a={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.default=t1;function t1(){}Object.defineProperty($a,"__esModule",{value:!0}),$a.default=void 0;var Ws=n1(Q),ft=Gs(yr),r1=Gs(pc),Ve=je,br=Wt,qs=Ht,Ei=Gs(Ia);function Gs(e){return e&&e.__esModule?e:{default:e}}function Md(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Md=function(n){return n?r:t})(e)}function n1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Md(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function at(e,t,r){return t=i1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i1(e){var t=a1(e,"string");return typeof t=="symbol"?t:String(t)}function a1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Pt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let _r=Pt.mouse,ja=class extends Ws.Component{constructor(){super(...arguments),at(this,"dragging",!1),at(this,"lastX",NaN),at(this,"lastY",NaN),at(this,"touchIdentifier",null),at(this,"mounted",!1),at(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=r;if(this.props.disabled||!(t.target instanceof n.defaultView.Node)||this.props.handle&&!(0,Ve.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,Ve.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const i=(0,Ve.getTouchIdentifier)(t);this.touchIdentifier=i;const a=(0,br.getControlPosition)(t,i,this);if(a==null)return;const{x:o,y:s}=a,l=(0,br.createCoreData)(this,o,s);(0,Ei.default)("DraggableCore: handleDragStart: %j",l),(0,Ei.default)("calling",this.props.onStart),!(this.props.onStart(t,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Ve.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=s,(0,Ve.addEvent)(n,_r.move,this.handleDrag),(0,Ve.addEvent)(n,_r.stop,this.handleDragStop))}),at(this,"handleDrag",t=>{const r=(0,br.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let s=n-this.lastX,l=i-this.lastY;if([s,l]=(0,br.snapToGrid)(this.props.grid,s,l),!s&&!l)return;n=this.lastX+s,i=this.lastY+l}const a=(0,br.createCoreData)(this,n,i);if((0,Ei.default)("DraggableCore: handleDrag: %j",a),this.props.onDrag(t,a)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=n,this.lastY=i}),at(this,"handleDragStop",t=>{if(!this.dragging)return;const r=(0,br.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:i}=r;if(Array.isArray(this.props.grid)){let l=n-this.lastX||0,c=i-this.lastY||0;[l,c]=(0,br.snapToGrid)(this.props.grid,l,c),n=this.lastX+l,i=this.lastY+c}const a=(0,br.createCoreData)(this,n,i);if(this.props.onStop(t,a)===!1||this.mounted===!1)return!1;const s=this.findDOMNode();s&&this.props.enableUserSelectHack&&(0,Ve.removeUserSelectStyles)(s.ownerDocument),(0,Ei.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,s&&((0,Ei.default)("DraggableCore: Removing handlers"),(0,Ve.removeEvent)(s.ownerDocument,_r.move,this.handleDrag),(0,Ve.removeEvent)(s.ownerDocument,_r.stop,this.handleDragStop))}),at(this,"onMouseDown",t=>(_r=Pt.mouse,this.handleDragStart(t))),at(this,"onMouseUp",t=>(_r=Pt.mouse,this.handleDragStop(t))),at(this,"onTouchStart",t=>(_r=Pt.touch,this.handleDragStart(t))),at(this,"onTouchEnd",t=>(_r=Pt.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,Ve.addEvent)(t,Pt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,Ve.removeEvent)(r,Pt.mouse.move,this.handleDrag),(0,Ve.removeEvent)(r,Pt.touch.move,this.handleDrag),(0,Ve.removeEvent)(r,Pt.mouse.stop,this.handleDragStop),(0,Ve.removeEvent)(r,Pt.touch.stop,this.handleDragStop),(0,Ve.removeEvent)(t,Pt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Ve.removeUserSelectStyles)(r)}}findDOMNode(){var t,r;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:r1.default.findDOMNode(this)}render(){return Ws.cloneElement(Ws.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};$a.default=ja,at(ja,"displayName","DraggableCore"),at(ja,"propTypes",{allowAnyClick:ft.default.bool,children:ft.default.node.isRequired,disabled:ft.default.bool,enableUserSelectHack:ft.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:ft.default.arrayOf(ft.default.number),handle:ft.default.string,cancel:ft.default.string,nodeRef:ft.default.object,onStart:ft.default.func,onDrag:ft.default.func,onStop:ft.default.func,onMouseDown:ft.default.func,scale:ft.default.number,className:qs.dontSetMe,style:qs.dontSetMe,transform:qs.dontSetMe}),at(ja,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),e.default=void 0;var t=p(Q),r=u(yr),n=u(pc),i=u(Sv),a=je,o=Wt,s=Ht,l=u($a),c=u(Ia);function u(_){return _&&_.__esModule?_:{default:_}}function d(_){if(typeof WeakMap!="function")return null;var R=new WeakMap,C=new WeakMap;return(d=function(x){return x?C:R})(_)}function p(_,R){if(_&&_.__esModule)return _;if(_===null||typeof _!="object"&&typeof _!="function")return{default:_};var C=d(R);if(C&&C.has(_))return C.get(_);var x={},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var k in _)if(k!=="default"&&Object.prototype.hasOwnProperty.call(_,k)){var S=O?Object.getOwnPropertyDescriptor(_,k):null;S&&(S.get||S.set)?Object.defineProperty(x,k,S):x[k]=_[k]}return x.default=_,C&&C.set(_,x),x}function m(){return m=Object.assign?Object.assign.bind():function(_){for(var R=1;R<arguments.length;R++){var C=arguments[R];for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(_[x]=C[x])}return _},m.apply(this,arguments)}function g(_,R,C){return R=b(R),R in _?Object.defineProperty(_,R,{value:C,enumerable:!0,configurable:!0,writable:!0}):_[R]=C,_}function b(_){var R=v(_,"string");return typeof R=="symbol"?R:String(R)}function v(_,R){if(typeof _!="object"||_===null)return _;var C=_[Symbol.toPrimitive];if(C!==void 0){var x=C.call(_,R||"default");if(typeof x!="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return(R==="string"?String:Number)(_)}class y extends t.Component{static getDerivedStateFromProps(R,C){let{position:x}=R,{prevPropsPosition:O}=C;return x&&(!O||x.x!==O.x||x.y!==O.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:x,prevPropsPosition:O}),{x:x.x,y:x.y,prevPropsPosition:{...x}}):null}constructor(R){super(R),g(this,"onDragStart",(C,x)=>{if((0,c.default)("Draggable: onDragStart: %j",x),this.props.onStart(C,(0,o.createDraggableData)(this,x))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(C,x)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",x);const O=(0,o.createDraggableData)(this,x),k={x:O.x,y:O.y,slackX:0,slackY:0};if(this.props.bounds){const{x:A,y:D}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[B,M]=(0,o.getBoundPosition)(this,k.x,k.y);k.x=B,k.y=M,k.slackX=this.state.slackX+(A-k.x),k.slackY=this.state.slackY+(D-k.y),O.x=k.x,O.y=k.y,O.deltaX=k.x-this.state.x,O.deltaY=k.y-this.state.y}if(this.props.onDrag(C,O)===!1)return!1;this.setState(k)}),g(this,"onDragStop",(C,x)=>{if(!this.state.dragging||this.props.onStop(C,(0,o.createDraggableData)(this,x))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",x);const k={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:A,y:D}=this.props.position;k.x=A,k.y=D}this.setState(k)}),this.state={dragging:!1,dragged:!1,x:R.position?R.position.x:R.defaultPosition.x,y:R.position?R.position.y:R.defaultPosition.y,prevPropsPosition:{...R.position},slackX:0,slackY:0,isElementSVG:!1},R.position&&!(R.onDrag||R.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var R,C;return(R=(C=this.props)===null||C===void 0||(C=C.nodeRef)===null||C===void 0?void 0:C.current)!==null&&R!==void 0?R:n.default.findDOMNode(this)}render(){const{axis:R,bounds:C,children:x,defaultPosition:O,defaultClassName:k,defaultClassNameDragging:S,defaultClassNameDragged:A,position:D,positionOffset:B,scale:M,...U}=this.props;let Z={},de=null;const ge=!!!D||this.state.dragging,xe=D||O,Je={x:(0,o.canDragX)(this)&&ge?this.state.x:xe.x,y:(0,o.canDragY)(this)&&ge?this.state.y:xe.y};this.state.isElementSVG?de=(0,a.createSVGTransform)(Je,B):Z=(0,a.createCSSTransform)(Je,B);const Qe=(0,i.default)(x.props.className||"",k,{[S]:this.state.dragging,[A]:this.state.dragged});return t.createElement(l.default,m({},U,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(x),{className:Qe,style:{...x.props.style,...Z},transform:de}))}}e.default=y,g(y,"displayName","Draggable"),g(y,"propTypes",{...l.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:s.dontSetMe,style:s.dontSetMe,transform:s.dontSetMe}),g(y,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(Pd);const{default:Ld,DraggableCore:o1}=Pd;Aa.exports=Ld,Aa.exports.default=Ld,Aa.exports.DraggableCore=o1;var Fd=Aa.exports,Ba={exports:{}},Si={},Ys={};Ys.__esModule=!0,Ys.cloneElement=d1;var s1=c1(Q);function c1(e){return e&&e.__esModule?e:{default:e}}function Ud(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Hd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ud(Object(r),!0).forEach(function(n){l1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ud(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function l1(e,t,r){return t=u1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u1(e){var t=f1(e,"string");return typeof t=="symbol"?t:String(t)}function f1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d1(e,t){return t.style&&e.props.style&&(t.style=Hd(Hd({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),s1.default.cloneElement(e,t)}var ki={};ki.__esModule=!0,ki.resizableProps=void 0;var le=h1(yr);function h1(e){return e&&e.__esModule?e:{default:e}}var p1={axis:le.default.oneOf(["both","x","y","none"]),className:le.default.string,children:le.default.element.isRequired,draggableOpts:le.default.shape({allowAnyClick:le.default.bool,cancel:le.default.string,children:le.default.node,disabled:le.default.bool,enableUserSelectHack:le.default.bool,offsetParent:le.default.node,grid:le.default.arrayOf(le.default.number),handle:le.default.string,nodeRef:le.default.object,onStart:le.default.func,onDrag:le.default.func,onStop:le.default.func,onMouseDown:le.default.func,scale:le.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r[0];if(i.axis==="both"||i.axis==="y"){var a;return(a=le.default.number).isRequired.apply(a,r)}return le.default.number.apply(le.default,r)},handle:le.default.oneOfType([le.default.node,le.default.func]),handleSize:le.default.arrayOf(le.default.number),lockAspectRatio:le.default.bool,maxConstraints:le.default.arrayOf(le.default.number),minConstraints:le.default.arrayOf(le.default.number),onResizeStop:le.default.func,onResizeStart:le.default.func,onResize:le.default.func,resizeHandles:le.default.arrayOf(le.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:le.default.number,width:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=r[0];if(i.axis==="both"||i.axis==="x"){var a;return(a=le.default.number).isRequired.apply(a,r)}return le.default.number.apply(le.default,r)}};ki.resizableProps=p1,Si.__esModule=!0,Si.default=void 0;var Ri=b1(Q),m1=Fd,w1=Ys,g1=ki,y1=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Wd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Wd=function(i){return i?r:t})(e)}function b1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Wd(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Zs(){return Zs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zs.apply(this,arguments)}function _1(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function qd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Xs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qd(Object(r),!0).forEach(function(n){v1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function v1(e,t,r){return t=x1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x1(e){var t=E1(e,"string");return typeof t=="symbol"?t:String(t)}function E1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function S1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Vs(e,t)}function Vs(e,t){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Vs(e,t)}var Ks=function(e){S1(t,e);function t(){for(var n,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a))||this,n.handleRefs={},n.lastHandleRect=null,n.slack=null,n}var r=t.prototype;return r.componentWillUnmount=function(){this.resetData()},r.resetData=function(){this.lastHandleRect=this.slack=null},r.runConstraints=function(i,a){var o=this.props,s=o.minConstraints,l=o.maxConstraints,c=o.lockAspectRatio;if(!s&&!l&&!c)return[i,a];if(c){var u=this.props.width/this.props.height,d=i-this.props.width,p=a-this.props.height;Math.abs(d)>Math.abs(p*u)?a=i/u:i=a*u}var m=i,g=a,b=this.slack||[0,0],v=b[0],y=b[1];return i+=v,a+=y,s&&(i=Math.max(s[0],i),a=Math.max(s[1],a)),l&&(i=Math.min(l[0],i),a=Math.min(l[1],a)),this.slack=[v+(m-i),y+(g-a)],[i,a]},r.resizeHandler=function(i,a){var o=this;return function(s,l){var c=l.node,u=l.deltaX,d=l.deltaY;i==="onResizeStart"&&o.resetData();var p=(o.props.axis==="both"||o.props.axis==="x")&&a!=="n"&&a!=="s",m=(o.props.axis==="both"||o.props.axis==="y")&&a!=="e"&&a!=="w";if(!(!p&&!m)){var g=a[0],b=a[a.length-1],v=c.getBoundingClientRect();if(o.lastHandleRect!=null){if(b==="w"){var y=v.left-o.lastHandleRect.left;u+=y}if(g==="n"){var _=v.top-o.lastHandleRect.top;d+=_}}o.lastHandleRect=v,b==="w"&&(u=-u),g==="n"&&(d=-d);var R=o.props.width+(p?u/o.props.transformScale:0),C=o.props.height+(m?d/o.props.transformScale:0),x=o.runConstraints(R,C);R=x[0],C=x[1];var O=R!==o.props.width||C!==o.props.height,k=typeof o.props[i]=="function"?o.props[i]:null,S=i==="onResize"&&!O;k&&!S&&(s.persist==null||s.persist(),k(s,{node:c,size:{width:R,height:C},handle:a})),i==="onResizeStop"&&o.resetData()}}},r.renderResizeHandle=function(i,a){var o=this.props.handle;if(!o)return Ri.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+i,ref:a});if(typeof o=="function")return o(i,a);var s=typeof o.type=="string",l=Xs({ref:a},s?{}:{handleAxis:i});return Ri.cloneElement(o,l)},r.render=function(){var i=this,a=this.props,o=a.children,s=a.className,l=a.draggableOpts;a.width,a.height,a.handle,a.handleSize,a.lockAspectRatio,a.axis,a.minConstraints,a.maxConstraints,a.onResize,a.onResizeStop,a.onResizeStart;var c=a.resizeHandles;a.transformScale;var u=_1(a,y1);return(0,w1.cloneElement)(o,Xs(Xs({},u),{},{className:(s?s+" ":"")+"react-resizable",children:[].concat(o.props.children,c.map(function(d){var p,m=(p=i.handleRefs[d])!=null?p:i.handleRefs[d]=Ri.createRef();return Ri.createElement(m1.DraggableCore,Zs({},l,{nodeRef:m,key:"resizableHandle-"+d,onStop:i.resizeHandler("onResizeStop",d),onStart:i.resizeHandler("onResizeStart",d),onDrag:i.resizeHandler("onResize",d)}),i.renderResizeHandle(d,m))}))}))},t}(Ri.Component);Si.default=Ks,Ks.propTypes=g1.resizableProps,Ks.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var za={};za.__esModule=!0,za.default=void 0;var Js=P1(Q),k1=Gd(yr),R1=Gd(Si),O1=ki,C1=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Gd(e){return e&&e.__esModule?e:{default:e}}function Yd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Yd=function(i){return i?r:t})(e)}function P1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Yd(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Qs(){return Qs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qs.apply(this,arguments)}function Zd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Na(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zd(Object(r),!0).forEach(function(n){T1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function T1(e,t,r){return t=A1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A1(e){var t=D1(e,"string");return typeof t=="symbol"?t:String(t)}function D1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $1(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function I1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ec(e,t)}function ec(e,t){return ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ec(e,t)}var Xd=function(e){I1(t,e);function t(){for(var n,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=e.call.apply(e,[this].concat(a))||this,n.state={width:n.props.width,height:n.props.height,propsWidth:n.props.width,propsHeight:n.props.height},n.onResize=function(s,l){var c=l.size;n.props.onResize?(s.persist==null||s.persist(),n.setState(c,function(){return n.props.onResize&&n.props.onResize(s,l)})):n.setState(c)},n}t.getDerivedStateFromProps=function(i,a){return a.propsWidth!==i.width||a.propsHeight!==i.height?{width:i.width,height:i.height,propsWidth:i.width,propsHeight:i.height}:null};var r=t.prototype;return r.render=function(){var i=this.props,a=i.handle,o=i.handleSize;i.onResize;var s=i.onResizeStart,l=i.onResizeStop,c=i.draggableOpts,u=i.minConstraints,d=i.maxConstraints,p=i.lockAspectRatio,m=i.axis;i.width,i.height;var g=i.resizeHandles,b=i.style,v=i.transformScale,y=$1(i,C1);return Js.createElement(R1.default,{axis:m,draggableOpts:c,handle:a,handleSize:o,height:this.state.height,lockAspectRatio:p,maxConstraints:d,minConstraints:u,onResizeStart:s,onResize:this.onResize,onResizeStop:l,resizeHandles:g,transformScale:v,width:this.state.width},Js.createElement("div",Qs({},y,{style:Na(Na({},b),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Js.Component);za.default=Xd,Xd.propTypes=Na(Na({},O1.resizableProps),{},{children:k1.default.element}),Ba.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Ba.exports.Resizable=Si.default,Ba.exports.ResizableBox=za.default;var j1=Ba.exports,er={};Object.defineProperty(er,"__esModule",{value:!0}),er.resizeHandleType=er.resizeHandleAxesType=er.default=void 0;var ue=Vd(yr),B1=Vd(Q);function Vd(e){return e&&e.__esModule?e:{default:e}}const z1=er.resizeHandleAxesType=ue.default.arrayOf(ue.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),N1=er.resizeHandleType=ue.default.oneOfType([ue.default.node,ue.default.func]);er.default={className:ue.default.string,style:ue.default.object,width:ue.default.number,autoSize:ue.default.bool,cols:ue.default.number,draggableCancel:ue.default.string,draggableHandle:ue.default.string,verticalCompact:function(e){e.verticalCompact},compactType:ue.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&he.validateLayout(t,"layout")},margin:ue.default.arrayOf(ue.default.number),containerPadding:ue.default.arrayOf(ue.default.number),rowHeight:ue.default.number,maxRows:ue.default.number,isBounded:ue.default.bool,isDraggable:ue.default.bool,isResizable:ue.default.bool,allowOverlap:ue.default.bool,preventCollision:ue.default.bool,useCSSTransforms:ue.default.bool,transformScale:ue.default.number,isDroppable:ue.default.bool,resizeHandles:z1,resizeHandle:N1,onLayoutChange:ue.default.func,onDragStart:ue.default.func,onDrag:ue.default.func,onDragStop:ue.default.func,onResizeStart:ue.default.func,onResize:ue.default.func,onResizeStop:ue.default.func,onDrop:ue.default.func,droppingItem:ue.default.shape({i:ue.default.string.isRequired,w:ue.default.number.isRequired,h:ue.default.number.isRequired}),children:function(e,t){const r=e[t],n={};B1.default.Children.forEach(r,function(i){if((i==null?void 0:i.key)!=null){if(n[i.key])throw new Error('Duplicate child key "'+i.key+'" found! This will cause problems in ReactGridLayout.');n[i.key]=!0}})},innerRef:ue.default.any},Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.default=void 0;var xn=tc(Q),ve=tc(yr),M1=Fd,L1=j1,En=he,Ye=Ut,Kd=er,F1=tc(Cs);function tc(e){return e&&e.__esModule?e:{default:e}}function qt(e,t,r){return t=U1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U1(e){var t=H1(e,"string");return typeof t=="symbol"?t:String(t)}function H1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class rc extends xn.default.Component{constructor(){super(...arguments),qt(this,"state",{resizing:null,dragging:null,className:""}),qt(this,"elementRef",xn.default.createRef()),qt(this,"onDragStart",(t,r)=>{let{node:n}=r;const{onDragStart:i,transformScale:a}=this.props;if(!i)return;const o={top:0,left:0},{offsetParent:s}=n;if(!s)return;const l=s.getBoundingClientRect(),c=n.getBoundingClientRect(),u=c.left/a,d=l.left/a,p=c.top/a,m=l.top/a;o.left=u-d+s.scrollLeft,o.top=p-m+s.scrollTop,this.setState({dragging:o});const{x:g,y:b}=(0,Ye.calcXY)(this.getPositionParams(),o.top,o.left,this.props.w,this.props.h);return i.call(this,this.props.i,g,b,{e:t,node:n,newPosition:o})}),qt(this,"onDrag",(t,r)=>{let{node:n,deltaX:i,deltaY:a}=r;const{onDrag:o}=this.props;if(!o)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let s=this.state.dragging.top+a,l=this.state.dragging.left+i;const{isBounded:c,i:u,w:d,h:p,containerWidth:m}=this.props,g=this.getPositionParams();if(c){const{offsetParent:_}=n;if(_){const{margin:R,rowHeight:C,containerPadding:x}=this.props,O=_.clientHeight-(0,Ye.calcGridItemWHPx)(p,C,R[1]);s=(0,Ye.clamp)(s-x[1],0,O);const k=(0,Ye.calcGridColWidth)(g),S=m-(0,Ye.calcGridItemWHPx)(d,k,R[0]);l=(0,Ye.clamp)(l-x[0],0,S)}}const b={top:s,left:l};this.setState({dragging:b});const{x:v,y}=(0,Ye.calcXY)(g,s,l,d,p);return o.call(this,u,v,y,{e:t,node:n,newPosition:b})}),qt(this,"onDragStop",(t,r)=>{let{node:n}=r;const{onDragStop:i}=this.props;if(!i)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:a,h:o,i:s}=this.props,{left:l,top:c}=this.state.dragging,u={top:c,left:l};this.setState({dragging:null});const{x:d,y:p}=(0,Ye.calcXY)(this.getPositionParams(),c,l,a,o);return i.call(this,s,d,p,{e:t,node:n,newPosition:u})}),qt(this,"onResizeStop",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStop")),qt(this,"onResizeStart",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStart")),qt(this,"onResize",(t,r,n)=>this.onResizeHandler(t,r,n,"onResize"))}shouldComponentUpdate(t,r){if(this.props.children!==t.children||this.props.droppingPosition!==t.droppingPosition)return!0;const n=(0,Ye.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),i=(0,Ye.calcGridItemPosition)(this.getPositionParams(t),t.x,t.y,t.w,t.h,r);return!(0,En.fastPositionEqual)(n,i)||this.props.useCSSTransforms!==t.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(t){this.moveDroppingItem(t)}moveDroppingItem(t){const{droppingPosition:r}=this.props;if(!r)return;const n=this.elementRef.current;if(!n)return;const i=t.droppingPosition||{left:0,top:0},{dragging:a}=this.state,o=a&&r.left!==i.left||r.top!==i.top;if(!a)this.onDragStart(r.e,{node:n,deltaX:r.left,deltaY:r.top});else if(o){const s=r.left-a.left,l=r.top-a.top;this.onDrag(r.e,{node:n,deltaX:s,deltaY:l})}}getPositionParams(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:t.cols,containerPadding:t.containerPadding,containerWidth:t.containerWidth,margin:t.margin,maxRows:t.maxRows,rowHeight:t.rowHeight}}createStyle(t){const{usePercentages:r,containerWidth:n,useCSSTransforms:i}=this.props;let a;return i?a=(0,En.setTransform)(t):(a=(0,En.setTopLeft)(t),r&&(a.left=(0,En.perc)(t.left/n),a.width=(0,En.perc)(t.width/n))),a}mixinDraggable(t,r){return xn.default.createElement(M1.DraggableCore,{disabled:!r,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},t)}curryResizeHandler(t,r){return(n,i)=>r(n,i,t)}mixinResizable(t,r,n){const{cols:i,minW:a,minH:o,maxW:s,maxH:l,transformScale:c,resizeHandles:u,resizeHandle:d}=this.props,p=this.getPositionParams(),m=(0,Ye.calcGridItemPosition)(p,0,0,i,0).width,g=(0,Ye.calcGridItemPosition)(p,0,0,a,o),b=(0,Ye.calcGridItemPosition)(p,0,0,s,l),v=[g.width,g.height],y=[Math.min(b.width,m),Math.min(b.height,1/0)];return xn.default.createElement(L1.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:r.width,height:r.height,minConstraints:v,maxConstraints:y,onResizeStop:this.curryResizeHandler(r,this.onResizeStop),onResizeStart:this.curryResizeHandler(r,this.onResizeStart),onResize:this.curryResizeHandler(r,this.onResize),transformScale:c,resizeHandles:u,handle:d},t)}onResizeHandler(t,r,n,i){let{node:a,size:o,handle:s}=r;const l=this.props[i];if(!l)return;const{x:c,y:u,i:d,maxH:p,minH:m,containerWidth:g}=this.props,{minW:b,maxW:v}=this.props;let y=o;a&&(y=(0,En.resizeItemInDirection)(s,n,o,g),this.setState({resizing:i==="onResizeStop"?null:y}));let{w:_,h:R}=(0,Ye.calcWH)(this.getPositionParams(),y.width,y.height,c,u,s);_=(0,Ye.clamp)(_,Math.max(b,1),v),R=(0,Ye.clamp)(R,m,p),l.call(this,d,_,R,{e:t,node:a,size:y,handle:s})}render(){const{x:t,y:r,w:n,h:i,isDraggable:a,isResizable:o,droppingPosition:s,useCSSTransforms:l}=this.props,c=(0,Ye.calcGridItemPosition)(this.getPositionParams(),t,r,n,i,this.state),u=xn.default.Children.only(this.props.children);let d=xn.default.cloneElement(u,{ref:this.elementRef,className:(0,F1.default)("react-grid-item",u.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":a,"react-draggable-dragging":!!this.state.dragging,dropping:!!s,cssTransforms:l}),style:{...this.props.style,...u.props.style,...this.createStyle(c)}});return d=this.mixinResizable(d,c,o),d=this.mixinDraggable(d,a),d}}Ta.default=rc,qt(rc,"propTypes",{children:ve.default.element,cols:ve.default.number.isRequired,containerWidth:ve.default.number.isRequired,rowHeight:ve.default.number.isRequired,margin:ve.default.array.isRequired,maxRows:ve.default.number.isRequired,containerPadding:ve.default.array.isRequired,x:ve.default.number.isRequired,y:ve.default.number.isRequired,w:ve.default.number.isRequired,h:ve.default.number.isRequired,minW:function(e,t){const r=e[t];if(typeof r!="number")return new Error("minWidth not Number");if(r>e.w||r>e.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(e,t){const r=e[t];if(typeof r!="number")return new Error("maxWidth not Number");if(r<e.w||r<e.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(e,t){const r=e[t];if(typeof r!="number")return new Error("minHeight not Number");if(r>e.h||r>e.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(e,t){const r=e[t];if(typeof r!="number")return new Error("maxHeight not Number");if(r<e.h||r<e.minH)return new Error("maxHeight smaller than item height/minHeight")},i:ve.default.string.isRequired,resizeHandles:Kd.resizeHandleAxesType,resizeHandle:Kd.resizeHandleType,onDragStop:ve.default.func,onDragStart:ve.default.func,onDrag:ve.default.func,onResizeStop:ve.default.func,onResizeStart:ve.default.func,onResize:ve.default.func,isDraggable:ve.default.bool.isRequired,isResizable:ve.default.bool.isRequired,isBounded:ve.default.bool.isRequired,static:ve.default.bool,useCSSTransforms:ve.default.bool.isRequired,transformScale:ve.default.number,className:ve.default.string,handle:ve.default.string,cancel:ve.default.string,droppingPosition:ve.default.shape({e:ve.default.object.isRequired,left:ve.default.number.isRequired,top:ve.default.number.isRequired})}),qt(rc,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Object.defineProperty(_i,"__esModule",{value:!0}),_i.default=void 0;var Mr=Y1(Q),nc=Rs,W1=ic(Cs),ae=he,q1=Ut,Jd=ic(Ta),G1=ic(er);function ic(e){return e&&e.__esModule?e:{default:e}}function Qd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Qd=function(n){return n?r:t})(e)}function Y1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Qd(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Ke(e,t,r){return t=Z1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z1(e){var t=X1(e,"string");return typeof t=="symbol"?t:String(t)}function X1(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const eh="react-grid-layout";let th=!1;try{th=/firefox/i.test(navigator.userAgent)}catch{}class Ma extends Mr.Component{constructor(){super(...arguments),Ke(this,"state",{activeDrag:null,layout:(0,ae.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,ae.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),Ke(this,"dragEnterCounter",0),Ke(this,"onDragStart",(t,r,n,i)=>{let{e:a,node:o}=i;const{layout:s}=this.state,l=(0,ae.getLayoutItem)(s,t);if(!l)return;const c={w:l.w,h:l.h,x:l.x,y:l.y,placeholder:!0,i:t};return this.setState({oldDragItem:(0,ae.cloneLayoutItem)(l),oldLayout:s,activeDrag:c}),this.props.onDragStart(s,l,l,null,a,o)}),Ke(this,"onDrag",(t,r,n,i)=>{let{e:a,node:o}=i;const{oldDragItem:s}=this.state;let{layout:l}=this.state;const{cols:c,allowOverlap:u,preventCollision:d}=this.props,p=(0,ae.getLayoutItem)(l,t);if(!p)return;const m={w:p.w,h:p.h,x:p.x,y:p.y,placeholder:!0,i:t};l=(0,ae.moveElement)(l,p,r,n,!0,d,(0,ae.compactType)(this.props),c,u),this.props.onDrag(l,s,p,m,a,o),this.setState({layout:u?l:(0,ae.compact)(l,(0,ae.compactType)(this.props),c),activeDrag:m})}),Ke(this,"onDragStop",(t,r,n,i)=>{let{e:a,node:o}=i;if(!this.state.activeDrag)return;const{oldDragItem:s}=this.state;let{layout:l}=this.state;const{cols:c,preventCollision:u,allowOverlap:d}=this.props,p=(0,ae.getLayoutItem)(l,t);if(!p)return;l=(0,ae.moveElement)(l,p,r,n,!0,u,(0,ae.compactType)(this.props),c,d);const g=d?l:(0,ae.compact)(l,(0,ae.compactType)(this.props),c);this.props.onDragStop(g,s,p,null,a,o);const{oldLayout:b}=this.state;this.setState({activeDrag:null,layout:g,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(g,b)}),Ke(this,"onResizeStart",(t,r,n,i)=>{let{e:a,node:o}=i;const{layout:s}=this.state,l=(0,ae.getLayoutItem)(s,t);l&&(this.setState({oldResizeItem:(0,ae.cloneLayoutItem)(l),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(s,l,l,null,a,o))}),Ke(this,"onResize",(t,r,n,i)=>{let{e:a,node:o,size:s,handle:l}=i;const{oldResizeItem:c}=this.state,{layout:u}=this.state,{cols:d,preventCollision:p,allowOverlap:m}=this.props;let g=!1,b,v,y;const[_,R]=(0,ae.withLayoutItem)(u,t,x=>{let O;return v=x.x,y=x.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(v=x.x+(x.w-r),r=x.x!==v&&v<0?x.w:r,v=v<0?0:v),["ne","n","nw"].indexOf(l)!==-1&&(y=x.y+(x.h-n),n=x.y!==y&&y<0?x.h:n,y=y<0?0:y),g=!0),p&&!m&&(O=(0,ae.getAllCollisions)(u,{...x,w:r,h:n,x:v,y}).filter(S=>S.i!==x.i).length>0,O&&(y=x.y,n=x.h,v=x.x,r=x.w,g=!1)),x.w=r,x.h=n,x});if(!R)return;b=_,g&&(b=(0,ae.moveElement)(_,R,v,y,!0,this.props.preventCollision,(0,ae.compactType)(this.props),d,m));const C={w:R.w,h:R.h,x:R.x,y:R.y,static:!0,i:t};this.props.onResize(b,c,R,C,a,o),this.setState({layout:m?b:(0,ae.compact)(b,(0,ae.compactType)(this.props),d),activeDrag:C})}),Ke(this,"onResizeStop",(t,r,n,i)=>{let{e:a,node:o}=i;const{layout:s,oldResizeItem:l}=this.state,{cols:c,allowOverlap:u}=this.props,d=(0,ae.getLayoutItem)(s,t),p=u?s:(0,ae.compact)(s,(0,ae.compactType)(this.props),c);this.props.onResizeStop(p,l,d,null,a,o);const{oldLayout:m}=this.state;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(p,m)}),Ke(this,"onDragOver",t=>{var _;if(t.preventDefault(),t.stopPropagation(),th&&!((_=t.nativeEvent.target)!=null&&_.classList.contains(eh)))return!1;const{droppingItem:r,onDropDragOver:n,margin:i,cols:a,rowHeight:o,maxRows:s,width:l,containerPadding:c,transformScale:u}=this.props,d=n==null?void 0:n(t);if(d===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const p={...r,...d},{layout:m}=this.state,g=t.currentTarget.getBoundingClientRect(),b=t.clientX-g.left,v=t.clientY-g.top,y={left:b/u,top:v/u,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:R,top:C}=this.state.droppingPosition;(R!=b||C!=v)&&this.setState({droppingPosition:y})}}else{const R={cols:a,margin:i,maxRows:s,rowHeight:o,containerWidth:l,containerPadding:c||i},C=(0,q1.calcXY)(R,v,b,p.w,p.h);this.setState({droppingDOMNode:Mr.createElement("div",{key:p.i}),droppingPosition:y,layout:[...m,{...p,x:C.x,y:C.y,static:!1,isDraggable:!0}]})}}),Ke(this,"removeDroppingPlaceholder",()=>{const{droppingItem:t,cols:r}=this.props,{layout:n}=this.state,i=(0,ae.compact)(n.filter(a=>a.i!==t.i),(0,ae.compactType)(this.props),r,this.props.allowOverlap);this.setState({layout:i,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),Ke(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),Ke(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),Ke(this,"onDrop",t=>{t.preventDefault(),t.stopPropagation();const{droppingItem:r}=this.props,{layout:n}=this.state,i=n.find(a=>a.i===r.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(n,i,t)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(t,r){let n;return r.activeDrag?null:(!(0,nc.deepEqual)(t.layout,r.propsLayout)||t.compactType!==r.compactType?n=t.layout:(0,ae.childrenEqual)(t.children,r.children)||(n=r.layout),n?{layout:(0,ae.synchronizeLayoutWithChildren)(n,t.children,t.cols,(0,ae.compactType)(t),t.allowOverlap),compactType:t.compactType,children:t.children,propsLayout:t.layout}:null)}shouldComponentUpdate(t,r){return this.props.children!==t.children||!(0,ae.fastRGLPropsEqual)(this.props,t,nc.deepEqual)||this.state.activeDrag!==r.activeDrag||this.state.mounted!==r.mounted||this.state.droppingPosition!==r.droppingPosition}componentDidUpdate(t,r){if(!this.state.activeDrag){const n=this.state.layout,i=r.layout;this.onLayoutMaybeChanged(n,i)}}containerHeight(){if(!this.props.autoSize)return;const t=(0,ae.bottom)(this.state.layout),r=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return t*this.props.rowHeight+(t-1)*this.props.margin[1]+r*2+"px"}onLayoutMaybeChanged(t,r){r||(r=this.state.layout),(0,nc.deepEqual)(r,t)||this.props.onLayoutChange(t)}placeholder(){const{activeDrag:t}=this.state;if(!t)return null;const{width:r,cols:n,margin:i,containerPadding:a,rowHeight:o,maxRows:s,useCSSTransforms:l,transformScale:c}=this.props;return Mr.createElement(Jd.default,{w:t.w,h:t.h,x:t.x,y:t.y,i:t.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:r,cols:n,margin:i,containerPadding:a||i,maxRows:s,rowHeight:o,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:l,transformScale:c},Mr.createElement("div",null))}processGridItem(t,r){if(!t||!t.key)return;const n=(0,ae.getLayoutItem)(this.state.layout,String(t.key));if(!n)return null;const{width:i,cols:a,margin:o,containerPadding:s,rowHeight:l,maxRows:c,isDraggable:u,isResizable:d,isBounded:p,useCSSTransforms:m,transformScale:g,draggableCancel:b,draggableHandle:v,resizeHandles:y,resizeHandle:_}=this.props,{mounted:R,droppingPosition:C}=this.state,x=typeof n.isDraggable=="boolean"?n.isDraggable:!n.static&&u,O=typeof n.isResizable=="boolean"?n.isResizable:!n.static&&d,k=n.resizeHandles||y,S=x&&p&&n.isBounded!==!1;return Mr.createElement(Jd.default,{containerWidth:i,cols:a,margin:o,containerPadding:s||o,maxRows:c,rowHeight:l,cancel:b,handle:v,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:x,isResizable:O,isBounded:S,useCSSTransforms:m&&R,usePercentages:!R,transformScale:g,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:r?C:void 0,resizeHandles:k,resizeHandle:_},t)}render(){const{className:t,style:r,isDroppable:n,innerRef:i}=this.props,a=(0,W1.default)(eh,t),o={height:this.containerHeight(),...r};return Mr.createElement("div",{ref:i,className:a,style:o,onDrop:n?this.onDrop:ae.noop,onDragLeave:n?this.onDragLeave:ae.noop,onDragEnter:n?this.onDragEnter:ae.noop,onDragOver:n?this.onDragOver:ae.noop},Mr.Children.map(this.props.children,s=>this.processGridItem(s)),n&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}_i.default=Ma,Ke(Ma,"displayName","ReactGridLayout"),Ke(Ma,"propTypes",G1.default),Ke(Ma,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:ae.noop,onDragStart:ae.noop,onDrag:ae.noop,onDragStop:ae.noop,onResizeStart:ae.noop,onResize:ae.noop,onResizeStop:ae.noop,onDrop:ae.noop,onDropDragOver:ae.noop});var La={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.findOrGenerateResponsiveLayout=J1,Lr.getBreakpointFromWidth=V1,Lr.getColsFromBreakpoint=K1,Lr.sortBreakpoints=ac;var Fa=he;function V1(e,t){const r=ac(e);let n=r[0];for(let i=1,a=r.length;i<a;i++){const o=r[i];t>e[o]&&(n=o)}return n}function K1(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function J1(e,t,r,n,i,a){if(e[r])return(0,Fa.cloneLayout)(e[r]);let o=e[n];const s=ac(t),l=s.slice(s.indexOf(r));for(let c=0,u=l.length;c<u;c++){const d=l[c];if(e[d]){o=e[d];break}}return o=(0,Fa.cloneLayout)(o||[]),(0,Fa.compact)((0,Fa.correctBounds)(o,{cols:i}),a,i)}function ac(e){return Object.keys(e).sort(function(r,n){return e[r]-e[n]})}Object.defineProperty(La,"__esModule",{value:!0}),La.default=void 0;var rh=ex(Q),dt=nh(yr),oc=Rs,Sn=he,Fr=Lr,Q1=nh(_i);function nh(e){return e&&e.__esModule?e:{default:e}}function ih(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(ih=function(n){return n?r:t})(e)}function ex(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=ih(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function sc(){return sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sc.apply(this,arguments)}function Ua(e,t,r){return t=tx(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tx(e){var t=rx(e,"string");return typeof t=="symbol"?t:String(t)}function rx(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const ah=e=>Object.prototype.toString.call(e);function Ha(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class cc extends rh.Component{constructor(){super(...arguments),Ua(this,"state",this.generateInitialState()),Ua(this,"onLayoutChange",t=>{this.props.onLayoutChange(t,{...this.props.layouts,[this.state.breakpoint]:t})})}generateInitialState(){const{width:t,breakpoints:r,layouts:n,cols:i}=this.props,a=(0,Fr.getBreakpointFromWidth)(r,t),o=(0,Fr.getColsFromBreakpoint)(a,i),s=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,Fr.findOrGenerateResponsiveLayout)(n,r,a,a,o,s),breakpoint:a,cols:o}}static getDerivedStateFromProps(t,r){if(!(0,oc.deepEqual)(t.layouts,r.layouts)){const{breakpoint:n,cols:i}=r;return{layout:(0,Fr.findOrGenerateResponsiveLayout)(t.layouts,t.breakpoints,n,n,i,t.compactType),layouts:t.layouts}}return null}componentDidUpdate(t){(this.props.width!=t.width||this.props.breakpoint!==t.breakpoint||!(0,oc.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,oc.deepEqual)(this.props.cols,t.cols))&&this.onWidthChange(t)}onWidthChange(t){const{breakpoints:r,cols:n,layouts:i,compactType:a}=this.props,o=this.props.breakpoint||(0,Fr.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),s=this.state.breakpoint,l=(0,Fr.getColsFromBreakpoint)(o,n),c={...i};if(s!==o||t.breakpoints!==r||t.cols!==n){s in c||(c[s]=(0,Sn.cloneLayout)(this.state.layout));let p=(0,Fr.findOrGenerateResponsiveLayout)(c,r,o,s,l,a);p=(0,Sn.synchronizeLayoutWithChildren)(p,this.props.children,l,a,this.props.allowOverlap),c[o]=p,this.props.onBreakpointChange(o,l),this.props.onLayoutChange(p,c),this.setState({breakpoint:o,layout:p,cols:l})}const u=Ha(this.props.margin,o),d=Ha(this.props.containerPadding,o);this.props.onWidthChange(this.props.width,u,l,d)}render(){const{breakpoint:t,breakpoints:r,cols:n,layouts:i,margin:a,containerPadding:o,onBreakpointChange:s,onLayoutChange:l,onWidthChange:c,...u}=this.props;return rh.createElement(Q1.default,sc({},u,{margin:Ha(a,this.state.breakpoint),containerPadding:Ha(o,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}La.default=cc,Ua(cc,"propTypes",{breakpoint:dt.default.string,breakpoints:dt.default.object,allowOverlap:dt.default.bool,cols:dt.default.object,margin:dt.default.oneOfType([dt.default.array,dt.default.object]),containerPadding:dt.default.oneOfType([dt.default.array,dt.default.object]),layouts(e,t){if(ah(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+ah(e[t]));Object.keys(e[t]).forEach(r=>{if(!(r in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,Sn.validateLayout)(e.layouts[r],"layouts."+r)})},width:dt.default.number.isRequired,onBreakpointChange:dt.default.func,onLayoutChange:dt.default.func,onWidthChange:dt.default.func}),Ua(cc,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:Sn.noop,onLayoutChange:Sn.noop,onWidthChange:Sn.noop});var lc={},oh=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(i,a){return i[0]===r?(n=a,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),i=this.__entries__[n];return i&&i[1]},t.prototype.set=function(r,n){var i=e(this.__entries__,r);~i?this.__entries__[i][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,i=e(n,r);~i&&n.splice(i,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var i=0,a=this.__entries__;i<a.length;i++){var o=a[i];r.call(n,o[1],o[0])}},t}()}(),uc=typeof window<"u"&&typeof document<"u"&&window.document===document,Wa=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),nx=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Wa):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),ix=2;function ax(e,t){var r=!1,n=!1,i=0;function a(){r&&(r=!1,e()),n&&s()}function o(){nx(a)}function s(){var l=Date.now();if(r){if(l-i<ix)return;n=!0}else r=!0,n=!1,setTimeout(o,t);i=l}return s}var ox=20,sx=["top","right","bottom","left","width","height","size","weight"],cx=typeof MutationObserver<"u",lx=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=ax(this.refresh.bind(this),ox)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!uc||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),cx?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!uc||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,i=sx.some(function(a){return!!~n.indexOf(a)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),sh=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},kn=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Wa},ch=Ga(0,0,0,0);function qa(e){return parseFloat(e)||0}function lh(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,i){var a=e["border-"+i+"-width"];return n+qa(a)},0)}function ux(e){for(var t=["top","right","bottom","left"],r={},n=0,i=t;n<i.length;n++){var a=i[n],o=e["padding-"+a];r[a]=qa(o)}return r}function fx(e){var t=e.getBBox();return Ga(0,0,t.width,t.height)}function dx(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return ch;var n=kn(e).getComputedStyle(e),i=ux(n),a=i.left+i.right,o=i.top+i.bottom,s=qa(n.width),l=qa(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=lh(n,"left","right")+a),Math.round(l+o)!==r&&(l-=lh(n,"top","bottom")+o)),!px(e)){var c=Math.round(s+a)-t,u=Math.round(l+o)-r;Math.abs(c)!==1&&(s-=c),Math.abs(u)!==1&&(l-=u)}return Ga(i.left,i.top,s,l)}var hx=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof kn(e).SVGGraphicsElement}:function(e){return e instanceof kn(e).SVGElement&&typeof e.getBBox=="function"}}();function px(e){return e===kn(e).document.documentElement}function mx(e){return uc?hx(e)?fx(e):dx(e):ch}function wx(e){var t=e.x,r=e.y,n=e.width,i=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(a.prototype);return sh(o,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),o}function Ga(e,t,r,n){return{x:e,y:t,width:r,height:n}}var gx=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Ga(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=mx(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),yx=function(){function e(t,r){var n=wx(r);sh(this,{target:t,contentRect:n})}return e}(),bx=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new oh,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof kn(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new gx(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof kn(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new yx(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),uh=typeof WeakMap<"u"?new WeakMap:new oh,fh=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=lx.getInstance(),n=new bx(t,r,this);uh.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){fh.prototype[e]=function(){var t;return(t=uh.get(this))[e].apply(t,arguments)}});var _x=function(){return typeof Wa.ResizeObserver<"u"?Wa.ResizeObserver:fh}();const vx=Za(Object.freeze(Object.defineProperty({__proto__:null,default:_x},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(lc,"__esModule",{value:!0}),lc.default=Px;var Ya=kx(Q),xx=fc(yr),Ex=fc(vx),Sx=fc(Cs);function fc(e){return e&&e.__esModule?e:{default:e}}function dh(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(dh=function(n){return n?r:t})(e)}function kx(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=dh(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function dc(){return dc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dc.apply(this,arguments)}function Rn(e,t,r){return t=Rx(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rx(e){var t=Ox(e,"string");return typeof t=="symbol"?t:String(t)}function Ox(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const Cx="react-grid-layout";function Px(e){var t;return t=class extends Ya.Component{constructor(){super(...arguments),Rn(this,"state",{width:1280}),Rn(this,"elementRef",Ya.createRef()),Rn(this,"mounted",!1),Rn(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new Ex.default(i=>{if(this.elementRef.current instanceof HTMLElement){const o=i[0].contentRect.width;this.setState({width:o})}});const n=this.elementRef.current;n instanceof HTMLElement&&this.resizeObserver.observe(n)}componentWillUnmount(){this.mounted=!1;const n=this.elementRef.current;n instanceof HTMLElement&&this.resizeObserver.unobserve(n),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:n,...i}=this.props;return n&&!this.mounted?Ya.createElement("div",{className:(0,Sx.default)(this.props.className,Cx),style:this.props.style,ref:this.elementRef}):Ya.createElement(e,dc({innerRef:this.elementRef},i,this.state))}},Rn(t,"defaultProps",{measureBeforeMount:!1}),Rn(t,"propTypes",{measureBeforeMount:xx.default.bool}),t}(function(e){e.exports=_i.default,e.exports.utils=he,e.exports.calculateUtils=Ut,e.exports.Responsive=La.default,e.exports.Responsive.utils=Lr,e.exports.WidthProvider=lc.default})(fd);var hc=fd.exports;const hh=St(hc),Tx=hc.WidthProvider(hh),Ax=gr.div`
150
150
  .grid-container {
151
151
  display: flex;
152
152
 
@@ -174,7 +174,7 @@ object-assign
174
174
  .react-grid-drag-handle {
175
175
  cursor: move;
176
176
  }
177
- `,ph=e=>ye.jsx(ye.Fragment,{children:ye.jsx(Cx,{children:ye.jsx(Ox,{className:"layout",rowHeight:50,cols:12,compactType:null,isResizable:!1,isDraggable:!1,preventCollision:!0,margin:[0,0],layout:e.layout,children:e.components.map(t=>ye.jsx("div",{className:"grid-item",children:t.component},t.id))})})}),Px=gr.div`
177
+ `,ph=e=>ye.jsx(ye.Fragment,{children:ye.jsx(Ax,{children:ye.jsx(Tx,{className:"layout",rowHeight:50,cols:12,compactType:null,isResizable:!1,isDraggable:!1,preventCollision:!0,margin:[0,0],layout:e.layout,children:e.components.map(t=>ye.jsx("div",{className:"grid-item",children:t.component},t.id))})})}),Dx=gr.div`
178
178
  .mi-container {
179
179
  display: flex;
180
180
  flex-direction: row;
@@ -193,7 +193,7 @@ object-assign
193
193
  flex-grow: 1;
194
194
  overflow: auto;
195
195
  }
196
- `,Tx=()=>{const[e,t]=re.useState([]),[r,n]=re.useState([]),[i,a]=re.useState(!1),{projectMetadata:o}=Es(),s=async()=>{a(!0),await Of(o.projectName,o.projectURL),a(!1),await Cf(o.projectName,o.projectURL),await Eb(o.projectName);const l=await ud(o.projectName);t(l.components),n(l.layout)};return re.useEffect(()=>{!o.projectName&&!o.projectURL||s()},[o.projectName,o.projectURL]),ye.jsx(ye.Fragment,{children:ye.jsxs(Px,{children:[ye.jsx(nd,{isVisible:i}),ye.jsx("div",{className:"mi-container",children:ye.jsx("div",{className:"mi-workspace",style:{backgroundColor:"#6f4d80"},children:ye.jsx(ph,{components:e,layout:r})})})]})})},Ax=re.forwardRef(({style:e,className:t,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:a,componentId:o},s)=>{const{selectedComponentId:l}=Es(),c=re.useMemo(()=>l===o,[l]),u=re.Children.toArray(a),d=u.filter(m=>m.key===".$resizableHandle-se"),p=u.filter(m=>m.key!==".$resizableHandle-se");return ye.jsxs("div",{style:{...e},className:t+(c?" selected":""),ref:s,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:[ye.jsx("div",{className:"grid-item "+(c?"selected":""),children:p}),d]})});class Dx extends re.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}render(){const{hasError:t,error:r}=this.state,{children:n,fallback:i,fallbackProps:a}=this.props;return t&&(this.resetState(),i)?ye.jsx(i,{error:r,...a}):n}resetState(){this.state={hasError:!1,error:null}}}const $x=e=>ye.jsx(ye.Fragment,{children:ye.jsx("div",{className:"droppable-element",draggable:!0,unselectable:"on",onDragStart:t=>{t.dataTransfer.setData("text/plain",""),t.dataTransfer.setData("application/reactgridlayout",JSON.stringify({id:e.id,type:e.type,initialSize:e.initialSize,metadata:e.metadata}))},children:e.node})}),Ix=dc.WidthProvider(hh),Bx=gr.div`
196
+ `,$x=()=>{const[e,t]=Q.useState([]),[r,n]=Q.useState([]),[i,a]=Q.useState(!1),{projectMetadata:o}=Ss(),s=async()=>{a(!0),await Cf(o.projectName,o.projectURL),a(!1),await ss(o.projectName,o.projectURL),await Eb(o.projectName);const l=await ud(o.projectName);t(l.components),n(l.layout)};return Q.useEffect(()=>{!o.projectName&&!o.projectURL||s()},[o.projectName,o.projectURL]),ye.jsx(ye.Fragment,{children:ye.jsxs(Dx,{children:[ye.jsx(nd,{isVisible:i}),ye.jsx("div",{className:"mi-container",children:ye.jsx("div",{className:"mi-workspace",style:{backgroundColor:"#6f4d80"},children:ye.jsx(ph,{components:e,layout:r})})})]})})},Ix=Q.forwardRef(({style:e,className:t,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:a,componentId:o},s)=>{const{selectedComponentId:l}=Ss(),c=Q.useMemo(()=>l===o,[l]),u=Q.Children.toArray(a),d=u.filter(m=>m.key===".$resizableHandle-se"),p=u.filter(m=>m.key!==".$resizableHandle-se");return ye.jsxs("div",{style:{...e},className:t+(c?" selected":""),ref:s,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:[ye.jsx("div",{className:"grid-item "+(c?"selected":""),children:p}),d]})});class jx extends Q.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}render(){const{hasError:t,error:r}=this.state,{children:n,fallback:i,fallbackProps:a}=this.props;return t&&(this.resetState(),i)?ye.jsx(i,{error:r,...a}):n}resetState(){this.state={hasError:!1,error:null}}}const Bx=e=>ye.jsx(ye.Fragment,{children:ye.jsx("div",{className:"droppable-element",draggable:!0,unselectable:"on",onDragStart:t=>{t.dataTransfer.setData("text/plain",""),t.dataTransfer.setData("application/reactgridlayout",JSON.stringify({id:e.id,type:e.type,initialSize:e.initialSize,metadata:e.metadata}))},children:e.node})}),zx=hc.WidthProvider(hh),Nx=gr.div`
197
197
  .react-grid-layout {
198
198
  position: relative;
199
199
  // transition: height 200ms ease;
@@ -241,7 +241,7 @@ object-assign
241
241
  box-sizing: border-box;
242
242
  cursor: se-resize;
243
243
  }
244
- `,jx=gr.div`
244
+ `,Mx=gr.div`
245
245
  .grid-container {
246
246
  display: flex;
247
247
 
@@ -269,4 +269,4 @@ object-assign
269
269
  .react-grid-drag-handle {
270
270
  cursor: move;
271
271
  }
272
- `,zx=e=>ye.jsx(ye.Fragment,{children:ye.jsx(Bx,{children:ye.jsx(jx,{children:ye.jsx(Ix,{className:"layout",rowHeight:50,cols:12,layout:e.layout,onLayoutChange:e.onLayoutChange,onResizeStop:e.onResize,onDrop:e.onDrop,onDragStop:e.onDrag,compactType:null,preventCollision:!0,draggableCancel:".cancel-drag",isDroppable:!0,draggableHandle:".react-grid-drag-handle",children:e.components})})})}),Nx=()=>{typeof window<"u"&&(window.Buffer=Ja.Buffer,window.fs=new up("fs"),window.pfs=window.fs.promises,window.miDir="/mi")};Re.MiniApp=Tx,Re.ProjectProvider=Yv,Re.RGComponent=Ax,Re.RGComponentErrorBoundary=Dx,Re.RGDroppable=$x,Re.RGEditLayout=zx,Re.RGPreviewLayout=ph,Re.getHeadCommit=Rb,Re.getRedoTargetCommitForFile=Cb,Re.getTags=Cf,Re.getUndoTargetCommitForFile=Ob,Re.initializeMakeInfinite=Nx,Re.listDir=Sf,Re.loadLibraryComponents=Xv,Re.loadProjectComponents=ud,Re.setTailwindTheme=Kv,Re.syncAndRetry=Of,Re.useAPI=ad,Re.useB64UrlForProjectImage=Jv,Re.useProject=Es,Object.defineProperty(Re,Symbol.toStringTag,{value:"Module"})});
272
+ `,Lx=e=>ye.jsx(ye.Fragment,{children:ye.jsx(Nx,{children:ye.jsx(Mx,{children:ye.jsx(zx,{className:"layout",rowHeight:50,cols:12,layout:e.layout,onLayoutChange:e.onLayoutChange,onResizeStop:e.onResize,onDrop:e.onDrop,onDragStop:e.onDrag,compactType:null,preventCollision:!0,draggableCancel:".cancel-drag",isDroppable:!0,draggableHandle:".react-grid-drag-handle",children:e.components})})})}),Fx=()=>{typeof window<"u"&&(window.Buffer=Ja.Buffer,window.fs=new up("fs"),window.pfs=window.fs.promises,window.miDir="/mi")};_e.MiniApp=$x,_e.ProjectProvider=Y_,_e.RGComponent=Ix,_e.RGComponentErrorBoundary=jx,_e.RGDroppable=Bx,_e.RGEditLayout=Lx,_e.RGPreviewLayout=ph,_e.getHeadCommit=Rb,_e.getRedoTargetCommitForFile=Cb,_e.getTags=ss,_e.getUndoTargetCommitForFile=Ob,_e.initializeMakeInfinite=Fx,_e.listDir=kf,_e.loadLibraryComponents=X_,_e.loadProjectComponents=ud,_e.setTailwindTheme=K_,_e.syncAndRetry=Cf,_e.useAPI=ad,_e.useAppMetadata=Q_,_e.useAppSettings=ev,_e.useAppVersions=tv,_e.useB64UrlForProjectImage=J_,_e.useProject=Ss,Object.defineProperty(_e,Symbol.toStringTag,{value:"Module"})});