@spaceandtimelabs/makeinfinite-ui 0.35.4 → 0.36.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(ve,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("react"),require("@babel/standalone"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@babel/standalone","react-dom"],K):(ve=typeof globalThis<"u"?globalThis:ve||self,K(ve.MakeInfinite={},ve.React,ve.Babel,ve.ReactDOM))})(this,function(ve,K,wh,pc){"use strict";function gh(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=gh(wh);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 Xa(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 yh=bh;function bh(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,v){var O;return y instanceof Buffer?O=y:O=Buffer.from(y.buffer,y.byteOffset,y.byteLength),O.toString(v)}var r=function(y){return Buffer.from(y)};function n(y){for(var v=0,O=Math.min(256*256,y.length+1),R=new Uint16Array(O),b=[],C=0;;){var k=v<y.length;if(!k||C>=O-1){var S=R.subarray(0,C),P=S;if(b.push(String.fromCharCode.apply(null,P)),!k)return b.join("");y=y.subarray(v),v=0,C=0}var $=y[v++];if(!($&128))R[C++]=$;else if(($&224)===192){var j=y[v++]&63;R[C++]=($&31)<<6|j}else if(($&240)===224){var j=y[v++]&63,M=y[v++]&63;R[C++]=($&31)<<12|j<<6|M}else if(($&248)===240){var j=y[v++]&63,M=y[v++]&63,H=y[v++]&63,Y=($&7)<<18|j<<12|M<<6|H;Y>65535&&(Y-=65536,R[C++]=Y>>>10&1023|55296,Y=56320|Y&1023),R[C++]=Y}}}function i(y){for(var v=0,O=y.length,R=0,b=Math.max(32,O+(O>>>1)+7),C=new Uint8Array(b>>>3<<3);v<O;){var k=y.charCodeAt(v++);if(k>=55296&&k<=56319){if(v<O){var S=y.charCodeAt(v);(S&64512)===56320&&(++v,k=((k&1023)<<10)+(S&1023)+65536)}if(k>=55296&&k<=56319)continue}if(R+4>C.length){b+=8,b*=1+v/y.length*2,b=b>>>3<<3;var P=new Uint8Array(b);P.set(C),C=P}if(k&4294967168)if(!(k&4294965248))C[R++]=k>>>6&31|192;else if(!(k&4294901760))C[R++]=k>>>12&15|224,C[R++]=k>>>6&63|128;else if(!(k&4292870144))C[R++]=k>>>18&7|240,C[R++]=k>>>12&63|128,C[R++]=k>>>6&63|128;else continue;else{C[R++]=k;continue}C[R++]=k&63|128}return C.slice?C.slice(0,R):C.subarray(0,R)}var a="Failed to ",o=function(y,v,O){if(y)throw new Error("".concat(a).concat(v,": the '").concat(O,"' option is unsupported."))},s=typeof Buffer=="function"&&Buffer.from,l=s?r:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(y,v){return o(v&&v.stream,"encode","stream"),l(y)};function u(y){var v;try{var O=new Blob([y],{type:"text/plain;charset=UTF-8"});v=URL.createObjectURL(O);var R=new XMLHttpRequest;return R.open("GET",v,!1),R.send(),R.responseText}finally{v&&URL.revokeObjectURL(v)}}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'",_="".concat(a," ").concat(g,": the ");function x(y,v){o(v&&v.fatal,g,"fatal"),y=y||"utf-8";var O;if(s?O=Buffer.isEncoding(y):O=p.indexOf(y.toLowerCase())!==-1,!O)throw new RangeError("".concat(_," encoding label provided ('").concat(y,"') is invalid."));this.encoding=y,this.fatal=!1,this.ignoreBOM=!1}x.prototype.decode=function(y,v){o(v&&v.stream,"decode","stream");var O;return y instanceof Uint8Array?O=y:y.buffer instanceof ArrayBuffer?O=new Uint8Array(y.buffer):O=new Uint8Array(y),m(O,this.encoding)},e.TextEncoder=e.TextEncoder||c,e.TextDecoder=e.TextDecoder||x})(typeof window<"u"?window:Ci);var _h={encode:e=>new TextEncoder().encode(e),decode:e=>new TextDecoder().decode(e)},vh=xh;function xh(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(Rh,[]),Za(...t)}function Eh(...e){let t="";for(let r of e)r.startsWith("/")?t=r:t=wc(Za(t,r));return t}function Za(...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 Sh(e){const t=e.lastIndexOf("/");if(t===-1)throw new Error(`Cannot get dirname of "${e}"`);return t===0?"/":e.slice(0,t)}function kh(e){if(e==="/")throw new Error(`Cannot get basename of "${e}"`);const t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function Rh(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:Za,normalize:wc,split:gc,basename:kh,dirname:Sh,resolve:Eh};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 Oh=On("EEXIST"),Ch=On("ENOENT"),Th=On("ENOTDIR"),Ph=On("ENOTEMPTY"),Ah=On("ETIMEDOUT");var yc={EEXIST:Oh,ENOENT:Ch,ENOTDIR:Th,ENOTEMPTY:Ph,ETIMEDOUT:Ah};const et=Va,{EEXIST:bc,ENOENT:$h,ENOTDIR:_c,ENOTEMPTY:Dh}=yc,Ve=0;var Ih=class{constructor(){}_makeRoot(t=new Map){return t.set(Ve,{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!==Ve&&(r+=this._countInodes(i));return r}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(t){let r=t.get(Ve).ino;for(let[n,i]of t)n!==Ve&&(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(Ve),c=l.mode.toString(8);r+=`${" ".repeat(a)}${o} ${c}`,l.type==="file"?r+=` ${l.size} ${l.mtimeMs}
1
+ (function(ye,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("react"),require("@babel/standalone"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@babel/standalone","react-dom"],K):(ye=typeof globalThis<"u"?globalThis:ye||self,K(ye.MakeInfinite={},ye.React,ye.Babel,ye.ReactDOM))})(this,function(ye,K,wh,wc){"use strict";function gh(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 gc=gh(wh);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 Xa(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 yh=bh;function bh(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,v){var O;return y instanceof Buffer?O=y:O=Buffer.from(y.buffer,y.byteOffset,y.byteLength),O.toString(v)}var r=function(y){return Buffer.from(y)};function n(y){for(var v=0,O=Math.min(256*256,y.length+1),R=new Uint16Array(O),b=[],C=0;;){var k=v<y.length;if(!k||C>=O-1){var S=R.subarray(0,C),P=S;if(b.push(String.fromCharCode.apply(null,P)),!k)return b.join("");y=y.subarray(v),v=0,C=0}var $=y[v++];if(!($&128))R[C++]=$;else if(($&224)===192){var j=y[v++]&63;R[C++]=($&31)<<6|j}else if(($&240)===224){var j=y[v++]&63,M=y[v++]&63;R[C++]=($&31)<<12|j<<6|M}else if(($&248)===240){var j=y[v++]&63,M=y[v++]&63,H=y[v++]&63,Y=($&7)<<18|j<<12|M<<6|H;Y>65535&&(Y-=65536,R[C++]=Y>>>10&1023|55296,Y=56320|Y&1023),R[C++]=Y}}}function i(y){for(var v=0,O=y.length,R=0,b=Math.max(32,O+(O>>>1)+7),C=new Uint8Array(b>>>3<<3);v<O;){var k=y.charCodeAt(v++);if(k>=55296&&k<=56319){if(v<O){var S=y.charCodeAt(v);(S&64512)===56320&&(++v,k=((k&1023)<<10)+(S&1023)+65536)}if(k>=55296&&k<=56319)continue}if(R+4>C.length){b+=8,b*=1+v/y.length*2,b=b>>>3<<3;var P=new Uint8Array(b);P.set(C),C=P}if(k&4294967168)if(!(k&4294965248))C[R++]=k>>>6&31|192;else if(!(k&4294901760))C[R++]=k>>>12&15|224,C[R++]=k>>>6&63|128;else if(!(k&4292870144))C[R++]=k>>>18&7|240,C[R++]=k>>>12&63|128,C[R++]=k>>>6&63|128;else continue;else{C[R++]=k;continue}C[R++]=k&63|128}return C.slice?C.slice(0,R):C.subarray(0,R)}var a="Failed to ",o=function(y,v,O){if(y)throw new Error("".concat(a).concat(v,": the '").concat(O,"' option is unsupported."))},s=typeof Buffer=="function"&&Buffer.from,l=s?r:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(y,v){return o(v&&v.stream,"encode","stream"),l(y)};function u(y){var v;try{var O=new Blob([y],{type:"text/plain;charset=UTF-8"});v=URL.createObjectURL(O);var R=new XMLHttpRequest;return R.open("GET",v,!1),R.send(),R.responseText}finally{v&&URL.revokeObjectURL(v)}}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'",_="".concat(a," ").concat(g,": the ");function x(y,v){o(v&&v.fatal,g,"fatal"),y=y||"utf-8";var O;if(s?O=Buffer.isEncoding(y):O=p.indexOf(y.toLowerCase())!==-1,!O)throw new RangeError("".concat(_," encoding label provided ('").concat(y,"') is invalid."));this.encoding=y,this.fatal=!1,this.ignoreBOM=!1}x.prototype.decode=function(y,v){o(v&&v.stream,"decode","stream");var O;return y instanceof Uint8Array?O=y:y.buffer instanceof ArrayBuffer?O=new Uint8Array(y.buffer):O=new Uint8Array(y),m(O,this.encoding)},e.TextEncoder=e.TextEncoder||c,e.TextDecoder=e.TextDecoder||x})(typeof window<"u"?window:Ci);var _h={encode:e=>new TextEncoder().encode(e),decode:e=>new TextDecoder().decode(e)},vh=xh;function xh(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 yc(e){if(e.length===0)return".";let t=bc(e);return t=t.reduce(Rh,[]),Za(...t)}function Eh(...e){let t="";for(let r of e)r.startsWith("/")?t=r:t=yc(Za(t,r));return t}function Za(...e){if(e.length===0)return"";let t=e.join("/");return t=t.replace(/\/{2,}/g,"/"),t}function bc(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 Sh(e){const t=e.lastIndexOf("/");if(t===-1)throw new Error(`Cannot get dirname of "${e}"`);return t===0?"/":e.slice(0,t)}function kh(e){if(e==="/")throw new Error(`Cannot get basename of "${e}"`);const t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function Rh(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:Za,normalize:yc,split:bc,basename:kh,dirname:Sh,resolve:Eh};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 Oh=On("EEXIST"),Ch=On("ENOENT"),Th=On("ENOTDIR"),Ph=On("ENOTEMPTY"),Ah=On("ETIMEDOUT");var _c={EEXIST:Oh,ENOENT:Ch,ENOTDIR:Th,ENOTEMPTY:Ph,ETIMEDOUT:Ah};const et=Va,{EEXIST:vc,ENOENT:$h,ENOTDIR:xc,ENOTEMPTY:Dh}=_c,Ve=0;var Ih=class{constructor(){}_makeRoot(t=new Map){return t.set(Ve,{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!==Ve&&(r+=this._countInodes(i));return r}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(t){let r=t.get(Ve).ino;for(let[n,i]of t)n!==Ve&&(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(Ve),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([[Ve,{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 $h(t);if(r||o<a.length-1){const l=n.get(Ve);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(Ve,o),n.set(i,a)}rmdir(t){let r=this._lookup(t);if(r.get(Ve).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(Ve).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(Ve,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(Ve)}lstat(t){return this._lookup(t,!1).get(Ve)}readlink(t){return this._lookup(t,!1).get(Ve).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(Ve,s),a.set(o,l),s}_du(t){let r=0;for(const[n,i]of t.entries())n===Ve?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 jh(e,t=vr()){let r;return t._withIDBStore("readwrite",n=>{r=n.get(e)}).then(()=>r.result)}function Bh(e,t,r=vr()){return r._withIDBStore("readwrite",n=>{n.put(t,e)})}function zh(e,t,r=vr()){return r._withIDBStore("readwrite",n=>{const i=n.get(e);i.onsuccess=()=>{n.put(t(i.result),e)}})}function Nh(e,t=vr()){return t._withIDBStore("readwrite",r=>{r.delete(e)})}function Mh(e=vr()){return e._withIDBStore("readwrite",t=>{t.clear()})}function Lh(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 Fh(e=vr()){return e._close()}const xc=Xa(Object.freeze(Object.defineProperty({__proto__:null,Store:vc,clear:Mh,close:Fh,del:Nh,get:jh,keys:Lh,set:Bh,update:zh},Symbol.toStringTag,{value:"Module"}))),tr=xc;var Uh=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)}},Hh=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,Wh=e=>new Promise(t=>setTimeout(t,e));var Gh=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 Wh(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:Yh,decode:Ec}=_h,Xh=vh,Zh=Ih,{ENOENT:Vh,ENOTEMPTY:Kh,ETIMEDOUT:Jh}=yc,Qh=Uh,ep=Hh,tp=Gh,rp=qh,Tn=Va;var np=class{constructor(){this.saveSuperblock=Xh(()=>{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 Qh(a,s),this._mutex=navigator.locks?new rp(t):new tp(l,c),this._cache=new Zh(t),this._opts={wipe:r,url:n},this._needsWipe=!!r,n&&(this._http=new ep(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 Jh}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=Tn.split(Tn.dirname(t)),a=i.shift();for(let o of i){a=Tn.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=Tn.resolve(Tn.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 Vh(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=Yh(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 Kh;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()}},ip=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 ap=np,Sc=ip,Ti=Va;function Pt(e,t,...r){return e=Ti.normalize(e),(typeof t>"u"||typeof t=="function")&&(t={}),typeof t=="string"&&(t={encoding:t}),[e,t,...r]}function op(e,t,r,...n){return e=Ti.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[Ti.normalize(e),Ti.normalize(t),...r]}var sp=class{constructor(t,r={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,Pt,!1),this.writeFile=this._wrap(this.writeFile,op,!0),this.unlink=this._wrap(this.unlink,Pt,!0),this.readdir=this._wrap(this.readdir,Pt,!1),this.mkdir=this._wrap(this.mkdir,Pt,!0),this.rmdir=this._wrap(this.rmdir,Pt,!0),this.rename=this._wrap(this.rename,kc,!0),this.stat=this._wrap(this.stat,Pt,!1),this.lstat=this._wrap(this.lstat,Pt,!1),this.readlink=this._wrap(this.readlink,Pt,!1),this.symlink=this._wrap(this.symlink,kc,!0),this.backFile=this._wrap(this.backFile,Pt,!0),this.du=this._wrap(this.du,Pt,!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 ap,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 cp=yh,lp=sp;function ot(e,t){return typeof e=="function"&&(t=e),t=cp(t),[(...n)=>t(null,...n),t]}var up=class{constructor(...t){this.promises=new lp(...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 fp=St(up);var Ja={},Pi={};Pi.byteLength=pp,Pi.toByteArray=wp,Pi.fromByteArray=bp;for(var At=[],yt=[],dp=typeof Uint8Array<"u"?Uint8Array:Array,Qa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=0,hp=Qa.length;Ur<hp;++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 pp(e){var t=Rc(e),r=t[0],n=t[1];return(r+n)*3/4-n}function mp(e,t,r){return(t+r)*3/4-r}function wp(e){var t,r=Rc(e),n=r[0],i=r[1],a=new dp(mp(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 gp(e){return At[e>>18&63]+At[e>>12&63]+At[e>>6&63]+At[e&63]}function yp(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(gp(n));return i.join("")}function bp(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(yp(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,_=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]|=_*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 $h(t);if(r||o<a.length-1){const l=n.get(Ve);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 vc;let n=this._lookup(et.dirname(t)),i=et.basename(t);if(n.has(i))throw new vc;let a=new Map,o={mode:r,type:"dir",size:0,mtimeMs:Date.now(),ino:this.autoinc()};a.set(Ve,o),n.set(i,a)}rmdir(t){let r=this._lookup(t);if(r.get(Ve).type!=="dir")throw new xc;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(Ve).type!=="dir")throw new xc;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(Ve,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(Ve)}lstat(t){return this._lookup(t,!1).get(Ve)}readlink(t){return this._lookup(t,!1).get(Ve).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(Ve,s),a.set(o,l),s}_du(t){let r=0;for(const[n,i]of t.entries())n===Ve?r+=i.size:r+=this._du(i);return r}du(t){let r=this._lookup(t);return this._du(r)}};class Ec{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 Ec),Ka}function jh(e,t=vr()){let r;return t._withIDBStore("readwrite",n=>{r=n.get(e)}).then(()=>r.result)}function Bh(e,t,r=vr()){return r._withIDBStore("readwrite",n=>{n.put(t,e)})}function zh(e,t,r=vr()){return r._withIDBStore("readwrite",n=>{const i=n.get(e);i.onsuccess=()=>{n.put(t(i.result),e)}})}function Nh(e,t=vr()){return t._withIDBStore("readwrite",r=>{r.delete(e)})}function Mh(e=vr()){return e._withIDBStore("readwrite",t=>{t.clear()})}function Lh(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 Fh(e=vr()){return e._close()}const Sc=Xa(Object.freeze(Object.defineProperty({__proto__:null,Store:Ec,clear:Mh,close:Fh,del:Nh,get:jh,keys:Lh,set:Bh,update:zh},Symbol.toStringTag,{value:"Module"}))),tr=Sc;var Uh=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)}},Hh=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=Sc,Wh=e=>new Promise(t=>setTimeout(t,e));var Gh=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 Wh(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:Yh,decode:kc}=_h,Xh=vh,Zh=Ih,{ENOENT:Vh,ENOTEMPTY:Kh,ETIMEDOUT:Jh}=_c,Qh=Uh,ep=Hh,tp=Gh,rp=qh,Tn=Va;var np=class{constructor(){this.saveSuperblock=Xh(()=>{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 Qh(a,s),this._mutex=navigator.locks?new rp(t):new tp(l,c),this._cache=new Zh(t),this._opts={wipe:r,url:n},this._needsWipe=!!r,n&&(this._http=new ep(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 Jh}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=Tn.split(Tn.dirname(t)),a=i.shift();for(let o of i){a=Tn.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=Tn.resolve(Tn.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=kc(i):i.toString=()=>kc(i)),!a)throw new Vh(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=Yh(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 Kh;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()}},ip=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 ap=np,Rc=ip,Ti=Va;function Pt(e,t,...r){return e=Ti.normalize(e),(typeof t>"u"||typeof t=="function")&&(t={}),typeof t=="string"&&(t={encoding:t}),[e,t,...r]}function op(e,t,r,...n){return e=Ti.normalize(e),(typeof r>"u"||typeof r=="function")&&(r={}),typeof r=="string"&&(r={encoding:r}),[e,t,r,...n]}function Oc(e,t,...r){return[Ti.normalize(e),Ti.normalize(t),...r]}var sp=class{constructor(t,r={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,Pt,!1),this.writeFile=this._wrap(this.writeFile,op,!0),this.unlink=this._wrap(this.unlink,Pt,!0),this.readdir=this._wrap(this.readdir,Pt,!1),this.mkdir=this._wrap(this.mkdir,Pt,!0),this.rmdir=this._wrap(this.rmdir,Pt,!0),this.rename=this._wrap(this.rename,Oc,!0),this.stat=this._wrap(this.stat,Pt,!1),this.lstat=this._wrap(this.lstat,Pt,!1),this.readlink=this._wrap(this.readlink,Pt,!1),this.symlink=this._wrap(this.symlink,Oc,!0),this.backFile=this._wrap(this.backFile,Pt,!0),this.du=this._wrap(this.du,Pt,!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 ap,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 Rc(n)}async lstat(t,r){const n=await this._backend.lstat(t,r);return new Rc(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 cp=yh,lp=sp;function ot(e,t){return typeof e=="function"&&(t=e),t=cp(t),[(...n)=>t(null,...n),t]}var up=class{constructor(...t){this.promises=new lp(...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 fp=St(up);var Ja={},Pi={};Pi.byteLength=pp,Pi.toByteArray=wp,Pi.fromByteArray=bp;for(var At=[],yt=[],dp=typeof Uint8Array<"u"?Uint8Array:Array,Qa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=0,hp=Qa.length;Ur<hp;++Ur)At[Ur]=Qa[Ur],yt[Qa.charCodeAt(Ur)]=Ur;yt[45]=62,yt[95]=63;function Cc(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 pp(e){var t=Cc(e),r=t[0],n=t[1];return(r+n)*3/4-n}function mp(e,t,r){return(t+r)*3/4-r}function wp(e){var t,r=Cc(e),n=r[0],i=r[1],a=new dp(mp(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 gp(e){return At[e>>18&63]+At[e>>12&63]+At[e>>6&63]+At[e&63]}function yp(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(gp(n));return i.join("")}function bp(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(yp(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,_=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]|=_*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=Pi,r=eo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=v,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(We(w,ArrayBuffer)||w&&We(w.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(We(w,SharedArrayBuffer)||w&&We(w.buffer,SharedArrayBuffer)))return _(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 A=x(w);if(A)return A;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=O(w,f)|0;let E=o(h);const A=E.write(w,f);return A!==h&&(E=E.slice(0,A)),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(We(w,Uint8Array)){const f=new Uint8Array(w);return _(f.buffer,f.byteOffset,f.byteLength)}return m(w)}function _(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=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 v(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(We(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),We(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,A=h.length;for(let B=0,z=Math.min(E,A);B<z;++B)if(f[B]!==h[B]){E=f[B],A=h[B];break}return E<A?-1:A<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 A=s.allocUnsafe(h);let B=0;for(E=0;E<f.length;++E){let z=f[E];if(We(z,Uint8Array))B+z.length>A.length?(s.isBuffer(z)||(z=s.from(z)),z.copy(A,B)):Uint8Array.prototype.set.call(A,z,B);else if(s.isBuffer(z))z.copy(A,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=z.length}return A};function O(w,f){if(s.isBuffer(w))return w.length;if(ArrayBuffer.isView(w)||We(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 A=!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(A)return E?-1:ne(w).length;f=(""+f).toLowerCase(),A=!0}}s.byteLength=O;function R(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 Ue(this,f,h);case"utf8":case"utf-8":return Y(this,f,h);case"ascii":return le(this,f,h);case"latin1":case"binary":return be(this,f,h);case"base64":return H(this,f,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Be(this,f,h);default:if(E)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),E=!0}}s.prototype._isBuffer=!0;function b(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)b(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)b(this,h,h+3),b(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)b(this,h,h+7),b(this,h+1,h+6),b(this,h+2,h+5),b(this,h+3,h+4);return this},s.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?Y(this,0,f):R.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,A,B){if(We(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),A===void 0&&(A=0),B===void 0&&(B=this.length),h<0||E>f.length||A<0||B>this.length)throw new RangeError("out of range index");if(A>=B&&h>=E)return 0;if(A>=B)return-1;if(h>=E)return 1;if(h>>>=0,E>>>=0,A>>>=0,B>>>=0,this===f)return 0;let z=B-A,me=E-h;const ze=Math.min(z,me),Ie=this.slice(A,B),Ne=f.slice(h,E);for(let Te=0;Te<ze;++Te)if(Ie[Te]!==Ne[Te]){z=Ie[Te],me=Ne[Te];break}return z<me?-1:me<z?1:0};function C(w,f,h,E,A){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=A?0:w.length-1),h<0&&(h=w.length+h),h>=w.length){if(A)return-1;h=w.length-1}else if(h<0)if(A)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,A);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(w,f,h):Uint8Array.prototype.lastIndexOf.call(w,f,h):k(w,[f],h,E,A);throw new TypeError("val must be string, number or Buffer")}function k(w,f,h,E,A){let B=1,z=w.length,me=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,me/=2,h/=2}function ze(Ne,Te){return B===1?Ne[Te]:Ne.readUInt16BE(Te*B)}let Ie;if(A){let Ne=-1;for(Ie=h;Ie<z;Ie++)if(ze(w,Ie)===ze(f,Ne===-1?0:Ie-Ne)){if(Ne===-1&&(Ne=Ie),Ie-Ne+1===me)return Ne*B}else Ne!==-1&&(Ie-=Ie-Ne),Ne=-1}else for(h+me>z&&(h=z-me),Ie=h;Ie>=0;Ie--){let Ne=!0;for(let Te=0;Te<me;Te++)if(ze(w,Ie+Te)!==ze(f,Te)){Ne=!1;break}if(Ne)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 S(w,f,h,E){h=Number(h)||0;const A=w.length-h;E?(E=Number(E),E>A&&(E=A)):E=A;const B=f.length;E>B/2&&(E=B/2);let z;for(z=0;z<E;++z){const me=parseInt(f.substr(z*2,2),16);if(Pe(me))return z;w[h+z]=me}return z}function P(w,f,h,E){return Et(ne(f,w.length-h),w,h,E)}function $(w,f,h,E){return Et(ie(f),w,h,E)}function j(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,A){if(h===void 0)A="utf8",E=this.length,h=0;else if(E===void 0&&typeof h=="string")A=h,E=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(E)?(E=E>>>0,A===void 0&&(A="utf8")):(A=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");A||(A="utf8");let z=!1;for(;;)switch(A){case"hex":return S(this,f,h,E);case"utf8":case"utf-8":return P(this,f,h,E);case"ascii":case"latin1":case"binary":return $(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: "+A);A=(""+A).toLowerCase(),z=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function H(w,f,h){return f===0&&h===w.length?t.fromByteArray(w):t.fromByteArray(w.slice(f,h))}function Y(w,f,h){h=Math.min(w.length,h);const E=[];let A=f;for(;A<h;){const B=w[A];let z=null,me=B>239?4:B>223?3:B>191?2:1;if(A+me<=h){let ze,Ie,Ne,Te;switch(me){case 1:B<128&&(z=B);break;case 2:ze=w[A+1],(ze&192)===128&&(Te=(B&31)<<6|ze&63,Te>127&&(z=Te));break;case 3:ze=w[A+1],Ie=w[A+2],(ze&192)===128&&(Ie&192)===128&&(Te=(B&15)<<12|(ze&63)<<6|Ie&63,Te>2047&&(Te<55296||Te>57343)&&(z=Te));break;case 4:ze=w[A+1],Ie=w[A+2],Ne=w[A+3],(ze&192)===128&&(Ie&192)===128&&(Ne&192)===128&&(Te=(B&15)<<18|(ze&63)<<12|(Ie&63)<<6|Ne&63,Te>65535&&Te<1114112&&(z=Te))}}z===null?(z=65533,me=1):z>65535&&(z-=65536,E.push(z>>>10&1023|55296),z=56320|z&1023),E.push(z),A+=me}return Ce(E)}const de=4096;function Ce(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 le(w,f,h){let E="";h=Math.min(w.length,h);for(let A=f;A<h;++A)E+=String.fromCharCode(w[A]&127);return E}function be(w,f,h){let E="";h=Math.min(w.length,h);for(let A=f;A<h;++A)E+=String.fromCharCode(w[A]);return E}function Ue(w,f,h){const E=w.length;(!f||f<0)&&(f=0),(!h||h<0||h>E)&&(h=E);let A="";for(let B=f;B<h;++B)A+=se[w[B]];return A}function Be(w,f,h){const E=w.slice(f,h);let A="";for(let B=0;B<E.length-1;B+=2)A+=String.fromCharCode(E[B]+E[B+1]*256);return A}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 A=this.subarray(f,h);return Object.setPrototypeOf(A,s.prototype),A};function oe(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||oe(f,h,this.length);let A=this[f],B=1,z=0;for(;++z<h&&(B*=256);)A+=this[f+z]*B;return A},s.prototype.readUintBE=s.prototype.readUIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||oe(f,h,this.length);let A=this[f+--h],B=1;for(;h>0&&(B*=256);)A+=this[f+--h]*B;return A},s.prototype.readUint8=s.prototype.readUInt8=function(f,h){return f=f>>>0,h||oe(f,1,this.length),this[f]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(f,h){return f=f>>>0,h||oe(f,2,this.length),this[f]|this[f+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(f,h){return f=f>>>0,h||oe(f,2,this.length),this[f]<<8|this[f+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(f,h){return f=f>>>0,h||oe(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||oe(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 A=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(A)+(BigInt(B)<<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 A=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(A)<<BigInt(32))+BigInt(B)}),s.prototype.readIntLE=function(f,h,E){f=f>>>0,h=h>>>0,E||oe(f,h,this.length);let A=this[f],B=1,z=0;for(;++z<h&&(B*=256);)A+=this[f+z]*B;return B*=128,A>=B&&(A-=Math.pow(2,8*h)),A},s.prototype.readIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||oe(f,h,this.length);let A=h,B=1,z=this[f+--A];for(;A>0&&(B*=256);)z+=this[f+--A]*B;return B*=128,z>=B&&(z-=Math.pow(2,8*h)),z},s.prototype.readInt8=function(f,h){return f=f>>>0,h||oe(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},s.prototype.readInt16LE=function(f,h){f=f>>>0,h||oe(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||oe(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||oe(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||oe(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 A=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(E<<24);return(BigInt(A)<<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 A=(h<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(A)<<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||oe(f,4,this.length),r.read(this,f,!0,23,4)},s.prototype.readFloatBE=function(f,h){return f=f>>>0,h||oe(f,4,this.length),r.read(this,f,!1,23,4)},s.prototype.readDoubleLE=function(f,h){return f=f>>>0,h||oe(f,8,this.length),r.read(this,f,!0,52,8)},s.prototype.readDoubleBE=function(f,h){return f=f>>>0,h||oe(f,8,this.length),r.read(this,f,!1,52,8)};function F(w,f,h,E,A,B){if(!s.isBuffer(w))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>A||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,A){if(f=+f,h=h>>>0,E=E>>>0,!A){const me=Math.pow(2,8*E)-1;F(this,f,h,E,me,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,A){if(f=+f,h=h>>>0,E=E>>>0,!A){const me=Math.pow(2,8*E)-1;F(this,f,h,E,me,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 G(w,f,h,E,A){L(f,E,A,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,A){L(f,E,A,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=Se(function(f,h=0){return G(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,A){if(f=+f,h=h>>>0,!A){const ze=Math.pow(2,8*E-1);F(this,f,h,E,ze-1,-ze)}let B=0,z=1,me=0;for(this[h]=f&255;++B<E&&(z*=256);)f<0&&me===0&&this[h+B-1]!==0&&(me=1),this[h+B]=(f/z>>0)-me&255;return h+E},s.prototype.writeIntBE=function(f,h,E,A){if(f=+f,h=h>>>0,!A){const ze=Math.pow(2,8*E-1);F(this,f,h,E,ze-1,-ze)}let B=E-1,z=1,me=0;for(this[h+B]=f&255;--B>=0&&(z*=256);)f<0&&me===0&&this[h+B+1]!==0&&(me=1),this[h+B]=(f/z>>0)-me&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 G(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,A,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,A){return f=+f,h=h>>>0,A||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,A){return f=+f,h=h>>>0,A||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,A){if(!s.isBuffer(f))throw new TypeError("argument should be a Buffer");if(E||(E=0),!A&&A!==0&&(A=this.length),h>=f.length&&(h=f.length),h||(h=0),A>0&&A<E&&(A=E),A===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(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),f.length-h<A-E&&(A=f.length-h+E);const B=A-E;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(h,E,A):Uint8Array.prototype.set.call(f,this.subarray(E,A),h),B},s.prototype.fill=function(f,h,E,A){if(typeof f=="string"){if(typeof h=="string"?(A=h,h=0,E=this.length):typeof E=="string"&&(A=E,E=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!s.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(f.length===1){const z=f.charCodeAt(0);(A==="utf8"&&z<128||A==="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,A),me=z.length;if(me===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<E-h;++B)this[B+h]=z[B%me]}return this};const D={};function q(w,f,h){D[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(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0})}toString(){return`${this.name} [${w}]: ${this.message}`}}}q("ERR_BUFFER_OUT_OF_BOUNDS",function(w){return w?`${w} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),q("ERR_INVALID_ARG_TYPE",function(w,f){return`The "${w}" argument must be of type number. Received type ${typeof f}`},TypeError),q("ERR_OUT_OF_RANGE",function(w,f,h){let E=`The value of "${w}" is out of range.`,A=h;return Number.isInteger(h)&&Math.abs(h)>2**32?A=Z(String(h)):typeof h=="bigint"&&(A=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(A=Z(A)),A+="n"),E+=` It must be ${f}. Received ${A}`,E},RangeError);function Z(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 X(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,A,B){if(w>h||w<f){const z=typeof f=="bigint"?"n":"";let me;throw f===0||f===BigInt(0)?me=`>= 0${z} and < 2${z} ** ${(B+1)*8}${z}`:me=`>= -(2${z} ** ${(B+1)*8-1}${z}) and < 2 ** ${(B+1)*8-1}${z}`,new D.ERR_OUT_OF_RANGE("value",me,w)}X(E,A,B)}function V(w,f){if(typeof w!="number")throw new D.ERR_INVALID_ARG_TYPE(f,"number",w)}function re(w,f,h){throw Math.floor(w)!==w?(V(w,h),new D.ERR_OUT_OF_RANGE("offset","an integer",w)):f<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,w)}const Q=/[^+/0-9A-Za-z-_]/g;function ue(w){if(w=w.split("=")[0],w=w.trim().replace(Q,""),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 A=null;const B=[];for(let z=0;z<E;++z){if(h=w.charCodeAt(z),h>55295&&h<57344){if(!A){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}A=h;continue}if(h<56320){(f-=3)>-1&&B.push(239,191,189),A=h;continue}h=(A-55296<<10|h-56320)+65536}else A&&(f-=3)>-1&&B.push(239,191,189);if(A=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 Re(w,f){let h,E,A;const B=[];for(let z=0;z<w.length&&!((f-=2)<0);++z)h=w.charCodeAt(z),E=h>>8,A=h%256,B.push(A),B.push(E);return B}function Ee(w){return t.toByteArray(ue(w))}function Et(w,f,h,E){let A;for(A=0;A<E&&!(A+h>=f.length||A>=w.length);++A)f[A+h]=w[A];return A}function We(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 se=function(){const w="0123456789abcdef",f=new Array(256);for(let h=0;h<16;++h){const E=h*16;for(let A=0;A<16;++A)f[E+A]=w[h]+w[A]}return f}();function Se(w){return typeof BigInt>"u"?Oi:w}function Oi(){throw new Error("BigInt not supported")}})(Ja);function _p(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:_p(e)}async function xp(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 Ep(e){let t=0;const r=[];await xp(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 Sp(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 kp({onProgress:e,url:t,method:r="GET",headers:n={},body:i}){i&&(i=await Ep(i));const a=await fetch(t,{method:r,headers:n,body:i}),o=a.body&&a.body.getReader?Sp(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:kp},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(v,O){i=v,a=O})),n=n||{};var s=!1,l=null,c=null,u=null,d=this,p=function(v,O,R){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),v&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||(o?O?a(O):i(R):typeof r=="function"&&r(O,R),s=!0),v&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},m=function(v){if(s)return p(v);l&&(clearTimeout(l),l=null),d.domainReentrant&&v&&(d.domains[e]=process.domain);var O=n.maxExecutionTime||d.maxExecutionTime;if(O&&(u=setTimeout(function(){d.queues[e]&&p(v,new Error("Maximum execution time is exceeded "+e))},O)),t.length===1){var R=!1;try{t(function(b,C){R||(R=!0,p(v,b,C))})}catch(b){R||(R=!0,p(v,b))}}else d._promiseTry(function(){return t()}).then(function(b){p(v,void 0,b)},function(b){p(v,b)})};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 _=function(){m(!0)};n.skipQueue?d.queues[e].unshift(_):d.queues[e].push(_);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 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 Rp=ht,Op=Rp;const Pn=St(Op);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 Cp=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 Tp=Ai,Pp=Cp,Tc=Tp,Ap=Oc.Buffer,$p=[1518500249,1859775393,-1894007588,-899497514],Dp=new Array(80);function An(){this.init(),this._w=Dp,Tc.call(this,64,56)}Pp(An,Tc),An.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Ip(e){return e<<1|e>>>31}function jp(e){return e<<5|e>>>27}function Bp(e){return e<<30|e>>>2}function zp(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]=Ip(t[s-3]^t[s-8]^t[s-14]^t[s-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=jp(r)+zp(c,n,i,a)+o+t[l]+$p[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=Ap.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 Np=An;const Pc=St(Np);function $t(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 Mp(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),$t(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($t(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 $t(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];$t(n),n.length>0&&(t===void 0?t=n:t+="/"+n)}return t===void 0?".":Hr.normalize(t)},relative:function(t,r){if($t(t),$t(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($t(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');$t(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){$t(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 Mp("/",t)},parse:function(t){$t(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,$c={};/*! 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,P=new Array(256),$=0;$!=256;++$)S=$,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,P[$]=S;return typeof Int32Array<"u"?new Int32Array(P):P}var n=r();function i(S){var P=0,$=0,j=0,M=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(j=0;j!=256;++j)M[j]=S[j];for(j=0;j!=256;++j)for($=S[j],P=256+j;P<4096;P+=256)$=M[P]=$>>>8^S[$&255];var H=[];for(j=1;j!=16;++j)H[j-1]=typeof Int32Array<"u"?M.subarray(j*256,j*256+256):M.slice(j*256,j*256+256);return H}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],_=a[9],x=a[10],y=a[11],v=a[12],O=a[13],R=a[14];function b(S,P){for(var $=P^-1,j=0,M=S.length;j<M;)$=$>>>8^n[($^S.charCodeAt(j++))&255];return~$}function C(S,P){for(var $=P^-1,j=S.length-15,M=0;M<j;)$=R[S[M++]^$&255]^O[S[M++]^$>>8&255]^v[S[M++]^$>>16&255]^y[S[M++]^$>>>24]^x[S[M++]]^_[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(j+=15;M<j;)$=$>>>8^n[($^S[M++])&255];return~$}function k(S,P){for(var $=P^-1,j=0,M=S.length,H=0,Y=0;j<M;)H=S.charCodeAt(j++),H<128?$=$>>>8^n[($^H)&255]:H<2048?($=$>>>8^n[($^(192|H>>6&31))&255],$=$>>>8^n[($^(128|H&63))&255]):H>=55296&&H<57344?(H=(H&1023)+64,Y=S.charCodeAt(j++)&1023,$=$>>>8^n[($^(240|H>>8&7))&255],$=$>>>8^n[($^(128|H>>2&63))&255],$=$>>>8^n[($^(128|Y>>6&15|(H&3)<<4))&255],$=$>>>8^n[($^(128|Y&63))&255]):($=$>>>8^n[($^(224|H>>12&15))&255],$=$>>>8^n[($^(128|H>>6&63))&255],$=$>>>8^n[($^(128|H&63))&255]);return~$}t.table=n,t.bstr=b,t.buf=C,t.str=k})})($c);const Lp=St($c);var qt={};(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)})(qt);var $n={},Dt={},Wr={},Fp=qt,Up=4,Dc=0,Ic=1,Hp=2;function Gr(e){for(var t=e.length;--t>=0;)e[t]=0}var Wp=0,jc=1,Gp=2,qp=3,Yp=258,io=29,Dn=256,In=Dn+1+io,qr=30,ao=19,Bc=2*In+1,xr=15,oo=16,Xp=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],$i=[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],Vp=512,Yt=new Array((In+2)*2);Gr(Yt);var jn=new Array(qr*2);Gr(jn);var Bn=new Array(Vp);Gr(Bn);var zn=new Array(Yp-qp+1);Gr(zn);var lo=new Array(io);Gr(lo);var Di=new Array(qr);Gr(Di);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 Gc(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Kp(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 Jp(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,_=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,_++),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(_!==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]--,_-=2}while(_>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]=Gc(n[s]++,s))}}function Qp(){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(Di[n]=i,e=0;e<1<<$i[n];e++)Bn[i++]=n;for(i>>=7;n<qr;n++)for(Di[n]=i<<7,e=0;e<1<<$i[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(qc(Yt,In+1,a),e=0;e<qr;e++)jn[e*2+1]=5,jn[e*2]=Gc(e,5);Fc=new uo(Yt,co,Dn+1,In,xr),Uc=new uo(jn,$i,0,qr,xr),Hc=new uo(new Array(0),Zp,0,ao,Xp)}function Yc(e){var t;for(t=0;t<In;t++)e.dyn_ltree[t*2]=0;for(t=0;t<qr;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 Xc(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 em(e,t,r,n){Xc(e),Nn(e,r),Nn(e,~r),Fp.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 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+Dn+1,t),s=co[o],s!==0&&(i-=lo[o],st(e,i,s)),n--,o=Wc(n),It(e,o,r),s=$i[o],s!==0&&(n-=Di[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],Jp(e,t),qc(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 tm(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 rm(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 nm(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 Ic;for(r=32;r<Dn;r++)if(e.dyn_ltree[r*2]!==0)return Ic;return Dc}var Qc=!1;function im(e){Qc||(Qp(),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,(Wp<<1)+(n?1:0),3),em(e,t,r)}function am(e){st(e,jc<<1,3),It(e,so,Yt),Kp(e)}function om(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===Hp&&(e.strm.data_type=nm(e)),po(e,e.l_desc),po(e,e.d_desc),o=tm(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===Up||a===i?(st(e,(jc<<1)+(n?1:0),3),Vc(e,Yt,jn)):(st(e,(Gp<<1)+(n?1:0),3),rm(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&&Xc(e)}function sm(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]+Dn+1)*2]++,e.dyn_dtree[Wc(t)*2]++),e.last_lit===e.lit_bufsize-1}Wr._tr_init=im,Wr._tr_stored_block=el,Wr._tr_flush_block=om,Wr._tr_tally=sm,Wr._tr_align=am;function cm(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=cm;function lm(){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 um=lm();function fm(e,t,r,n){var i=um,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=fm,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=qt,bt=Wr,nl=tl,rr=rl,dm=mo,Er=0,hm=1,pm=3,nr=4,il=5,jt=0,al=1,_t=-2,mm=-3,wo=-5,wm=-1,gm=1,Ii=2,ym=3,bm=4,_m=0,vm=2,ji=8,xm=9,Em=15,Sm=8,km=29,Rm=256,go=Rm+1+km,Om=30,Cm=19,Tm=2*go+1,Pm=15,we=3,ir=258,kt=ir+we+1,Am=32,Bi=42,yo=69,zi=73,Ni=91,Mi=103,Sr=113,Mn=666,He=1,Ln=2,kr=3,Yr=4,$m=3;function ar(e,t){return e.msg=dm[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 Ye(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 _e(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>=we)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+we-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<we)););}while(e.lookahead<kt&&e.strm.avail_in!==0)}function Im(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 He;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,Ye(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-kt&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=0,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):(e.strstart>e.block_start&&(Ye(e,!1),e.strm.avail_out===0),He)}function bo(e,t){for(var r,n;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return He;if(e.lookahead===0)break}if(r=0,e.lookahead>=we&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+we-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>=we)if(n=bt._tr_tally(e,e.strstart-e.match_start,e.match_length-we),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=we){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+we-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&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=e.strstart<we-1?e.strstart:we-1,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He:Ln}function Xr(e,t){for(var r,n,i;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return He;if(e.lookahead===0)break}if(r=0,e.lookahead>=we&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+we-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=we-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===gm||e.match_length===we&&e.strstart-e.match_start>4096)&&(e.match_length=we-1)),e.prev_length>=we&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-we,n=bt._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-we),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+we-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=we-1,e.strstart++,n&&(Ye(e,!1),e.strm.avail_out===0))return He}else if(e.match_available){if(n=bt._tr_tally(e,0,e.window[e.strstart-1]),n&&Ye(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return He}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<we-1?e.strstart:we-1,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He:Ln}function jm(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=ir){if(Rr(e),e.lookahead<=ir&&t===Er)return He;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=we&&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>=we?(r=bt._tr_tally(e,1,e.match_length-we),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&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=0,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He:Ln}function Bm(e,t){for(var r;;){if(e.lookahead===0&&(Rr(e),e.lookahead===0)){if(t===Er)return He;break}if(e.match_length=0,r=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=0,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He: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 Zr;Zr=[new Bt(0,0,0,0,Im),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,Xr),new Bt(8,16,32,32,Xr),new Bt(8,16,128,128,Xr),new Bt(8,32,128,256,Xr),new Bt(32,128,258,1024,Xr),new Bt(32,258,258,4096,Xr)];function zm(e){e.window_size=2*e.w_size,or(e.head),e.max_lazy_match=Zr[e.level].max_lazy,e.good_match=Zr[e.level].good_length,e.nice_match=Zr[e.level].nice_length,e.max_chain_length=Zr[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=we-1,e.match_available=0,e.ins_h=0}function Nm(){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(Tm*2),this.dyn_dtree=new tt.Buf16((2*Om+1)*2),this.bl_tree=new tt.Buf16((2*Cm+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=vm,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&&zm(e.state),t}function Mm(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===wm&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>xm||r!==ji||n<8||n>15||t<0||t>9||a<0||a>bm)return ar(e,_t);n===8&&(n=9);var s=new Nm;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+we-1)/we),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 Lm(e,t){return ul(e,t,ji,Em,Sm,_m)}function Fm(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,_e(n,31),_e(n,139),_e(n,8),n.gzhead?(_e(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)),_e(n,n.gzhead.time&255),_e(n,n.gzhead.time>>8&255),_e(n,n.gzhead.time>>16&255),_e(n,n.gzhead.time>>24&255),_e(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),_e(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(_e(n,n.gzhead.extra.length&255),_e(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):(_e(n,0),_e(n,0),_e(n,0),_e(n,0),_e(n,0),_e(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),_e(n,$m),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|=Am),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));)_e(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,_e(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,_e(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&&(_e(n,e.adler&255),_e(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?Bm(n,t):n.strategy===ym?jm(n,t):Zr[n.level].func(n,t);if((l===kr||l===Yr)&&(n.status=Mn),l===He||l===kr)return e.avail_out===0&&(n.last_flush=-1),jt;if(l===Ln&&(t===hm?bt._tr_align(n):t!==il&&(bt._tr_stored_block(n,0,0,!1),t===pm&&(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?(_e(n,e.adler&255),_e(n,e.adler>>8&255),_e(n,e.adler>>16&255),_e(n,e.adler>>24&255),_e(n,e.total_in&255),_e(n,e.total_in>>8&255),_e(n,e.total_in>>16&255),_e(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 Um(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,mm):jt))}function Hm(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>=we;){i=n.strstart,a=n.lookahead-(we-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+we-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=we-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=we-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=s,n.wrap=o,jt}Dt.deflateInit=Lm,Dt.deflateInit2=ul,Dt.deflateReset=ll,Dt.deflateResetKeep=cl,Dt.deflateSetHeader=Mm,Dt.deflate=Fm,Dt.deflateEnd=Um,Dt.deflateSetDictionary=Hm,Dt.deflateInfo="pako deflate (from Nodeca project)";var Or={},Li=qt,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 Wm(){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=Wm,Hn=Dt,Wn=qt,_o=Or,vo=mo,Gm=pl,ml=Object.prototype.toString,qm=0,xo=4,Vr=0,wl=1,gl=2,Ym=-1,Xm=0,Zm=8;function Cr(e){if(!(this instanceof Cr))return new Cr(e);this.options=Wn.assign({level:Ym,method:Zm,chunkSize:16384,windowBits:15,memLevel:8,strategy:Xm,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 Gm,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 Vm(e,t){return t=t||{},t.raw=!0,Eo(e,t)}function Km(e,t){return t=t||{},t.gzip=!0,Eo(e,t)}$n.Deflate=Cr,$n.deflate=Eo,$n.deflateRaw=Vm,$n.gzip=Km;var Gn={},Rt={},Fi=30,Jm=12,Qm=function(t,r){var n,i,a,o,s,l,c,u,d,p,m,g,_,x,y,v,O,R,b,C,k,S,P,$,j;n=t.state,i=t.next_in,$=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,_=n.bits,x=n.lencode,y=n.distcode,v=(1<<n.lenbits)-1,O=(1<<n.distbits)-1;e:do{_<15&&(g+=$[i++]<<_,_+=8,g+=$[i++]<<_,_+=8),R=x[g&v];t:for(;;){if(b=R>>>24,g>>>=b,_-=b,b=R>>>16&255,b===0)j[o++]=R&65535;else if(b&16){C=R&65535,b&=15,b&&(_<b&&(g+=$[i++]<<_,_+=8),C+=g&(1<<b)-1,g>>>=b,_-=b),_<15&&(g+=$[i++]<<_,_+=8,g+=$[i++]<<_,_+=8),R=y[g&O];r:for(;;){if(b=R>>>24,g>>>=b,_-=b,b=R>>>16&255,b&16){if(k=R&65535,b&=15,_<b&&(g+=$[i++]<<_,_+=8,_<b&&(g+=$[i++]<<_,_+=8)),k+=g&(1<<b)-1,k>c){t.msg="invalid distance too far back",n.mode=Fi;break e}if(g>>>=b,_-=b,b=o-s,k>b){if(b=k-b,b>d&&n.sane){t.msg="invalid distance too far back",n.mode=Fi;break e}if(S=0,P=m,p===0){if(S+=u-b,b<C){C-=b;do j[o++]=m[S++];while(--b);S=o-k,P=j}}else if(p<b){if(S+=u+p-b,b-=p,b<C){C-=b;do j[o++]=m[S++];while(--b);if(S=0,p<C){b=p,C-=b;do j[o++]=m[S++];while(--b);S=o-k,P=j}}}else if(S+=p-b,b<C){C-=b;do j[o++]=m[S++];while(--b);S=o-k,P=j}for(;C>2;)j[o++]=P[S++],j[o++]=P[S++],j[o++]=P[S++],C-=3;C&&(j[o++]=P[S++],C>1&&(j[o++]=P[S++]))}else{S=o-k;do j[o++]=j[S++],j[o++]=j[S++],j[o++]=j[S++],C-=3;while(C>2);C&&(j[o++]=j[S++],C>1&&(j[o++]=j[S++]))}}else if(b&64){t.msg="invalid distance code",n.mode=Fi;break e}else{R=y[(R&65535)+(g&(1<<b)-1)];continue r}break}}else if(b&64)if(b&32){n.mode=Jm;break e}else{t.msg="invalid literal/length code",n.mode=Fi;break e}else{R=x[(R&65535)+(g&(1<<b)-1)];continue t}break}}while(i<a&&o<l);C=_>>3,i-=C,_-=C<<3,g&=(1<<_)-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=_},yl=qt,Kr=15,bl=852,_l=592,vl=0,So=1,xl=2,e0=[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],t0=[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],r0=[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],n0=[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],i0=function(t,r,n,i,a,o,s,l){var c=l.bits,u=0,d=0,p=0,m=0,g=0,_=0,x=0,y=0,v=0,O=0,R,b,C,k,S,P=null,$=0,j,M=new yl.Buf16(Kr+1),H=new yl.Buf16(Kr+1),Y=null,de=0,Ce,le,be;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(H[1]=0,u=1;u<Kr;u++)H[u+1]=H[u]+M[u];for(d=0;d<i;d++)r[n+d]!==0&&(s[H[r[n+d]]++]=d);if(t===vl?(P=Y=s,j=19):t===So?(P=e0,$-=257,Y=t0,de-=257,j=256):(P=r0,Y=n0,j=-1),O=0,d=0,u=p,S=o,_=g,x=0,C=-1,v=1<<g,k=v-1,t===So&&v>bl||t===xl&&v>_l)return 1;for(;;){Ce=u-x,s[d]<j?(le=0,be=s[d]):s[d]>j?(le=Y[de+s[d]],be=P[$+s[d]]):(le=96,be=0),R=1<<u-x,b=1<<_,p=b;do b-=R,a[S+(O>>x)+b]=Ce<<24|le<<16|be|0;while(b!==0);for(R=1<<u-1;O&R;)R>>=1;if(R!==0?(O&=R-1,O+=R):O=0,d++,--M[u]===0){if(u===m)break;u=r[n+s[d]]}if(u>g&&(O&k)!==C){for(x===0&&(x=g),S+=p,_=u-x,y=1<<_;_+x<m&&(y-=M[_+x],!(y<=0));)_++,y<<=1;if(v+=1<<_,t===So&&v>bl||t===xl&&v>_l)return 1;C=O&k,a[C]=g<<24|_<<16|S-o|0}}return O!==0&&(a[S+O]=u-x<<24|64<<16|0),l.bits=g,0},pt=qt,ko=tl,zt=rl,a0=Qm,qn=i0,o0=0,El=1,Sl=2,kl=4,s0=5,Ui=6,Tr=0,c0=1,l0=2,vt=-2,Rl=-3,Ol=-4,u0=-5,Cl=8,Tl=1,Pl=2,Al=3,$l=4,Dl=5,Il=6,jl=7,Bl=8,zl=9,Nl=10,Hi=11,Xt=12,Ro=13,Ml=14,Oo=15,Ll=16,Fl=17,Ul=18,Hl=19,Wi=20,Gi=21,Wl=22,Gl=23,ql=24,Yl=25,Xl=26,Co=27,Zl=28,Vl=29,Ae=30,Kl=31,f0=32,d0=852,h0=592,p0=15,m0=p0;function Jl(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function w0(){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=Tl,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(d0),t.distcode=t.distdyn=new pt.Buf32(h0),t.sane=1,t.back=-1,Tr)}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 w0,e.state=n,n.window=null,r=tu(e,t),r!==Tr&&(e.state=null),r):vt}function g0(e){return ru(e,m0)}var nu=!0,To,Po;function y0(e){if(nu){var t;for(To=new pt.Buf32(512),Po=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(qn(El,e.lens,0,288,To,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;qn(Sl,e.lens,0,32,Po,0,e.work,{bits:5}),nu=!1}e.lencode=To,e.lenbits=9,e.distcode=Po,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 b0(e,t){var r,n,i,a,o,s,l,c,u,d,p,m,g,_,x=0,y,v,O,R,b,C,k,S,P=new pt.Buf8(4),$,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 vt;r=e.state,r.mode===Xt&&(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=Tr;e:for(;;)switch(r.mode){case Tl: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,P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,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=Ae;break}if((c&15)!==Cl){e.msg="unknown compression method",r.mode=Ae;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=Ae;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=c&512?Nl:Xt,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)!==Cl){e.msg="unknown compression method",r.mode=Ae;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Ae;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,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&&(P[0]=c&255,P[1]=c>>>8&255,P[2]=c>>>16&255,P[3]=c>>>24&255,r.check=zt(r.check,P,4,0)),c=0,u=0,r.mode=$l;case $l: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&&(P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,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&&(P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,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=Ae;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=Xt;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,l0;e.adler=r.check=1,r.mode=Xt;case Xt:if(t===s0||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(y0(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=Ae}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=Ae;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=Xt;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=Ae;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,$={bits:r.lenbits},S=qn(o0,r.lens,0,19,r.lencode,0,r.work,$),r.lenbits=$.bits,S){e.msg="invalid code lengths set",r.mode=Ae;break}r.have=0,r.mode=Hl;case Hl:for(;r.have<r.nlen+r.ndist;){for(;x=r.lencode[c&(1<<r.lenbits)-1],y=x>>>24,v=x>>>16&255,O=x&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(O<16)c>>>=y,u-=y,r.lens[r.have++]=O;else{if(O===16){for(j=y+2;u<j;){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=Ae;break}k=r.lens[r.have-1],m=3+(c&3),c>>>=2,u-=2}else if(O===17){for(j=y+3;u<j;){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(j=y+7;u<j;){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=Ae;break}for(;m--;)r.lens[r.have++]=k}}if(r.mode===Ae)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Ae;break}if(r.lenbits=9,$={bits:r.lenbits},S=qn(El,r.lens,0,r.nlen,r.lencode,0,r.work,$),r.lenbits=$.bits,S){e.msg="invalid literal/lengths set",r.mode=Ae;break}if(r.distbits=6,r.distcode=r.distdyn,$={bits:r.distbits},S=qn(Sl,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,$),r.distbits=$.bits,S){e.msg="invalid distances set",r.mode=Ae;break}if(r.mode=Wi,t===Ui)break e;case Wi:r.mode=Gi;case Gi: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,a0(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===Xt&&(r.back=-1);break}for(r.back=0;x=r.lencode[c&(1<<r.lenbits)-1],y=x>>>24,v=x>>>16&255,O=x&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(v&&!(v&240)){for(R=y,b=v,C=O;x=r.lencode[C+((c&(1<<R+b)-1)>>R)],y=x>>>24,v=x>>>16&255,O=x&65535,!(R+y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=y,u-=y,r.back+=y,r.length=O,v===0){r.mode=Xl;break}if(v&32){r.back=-1,r.mode=Xt;break}if(v&64){e.msg="invalid literal/length code",r.mode=Ae;break}r.extra=v&15,r.mode=Wl;case Wl: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=Gl;case Gl:for(;x=r.distcode[c&(1<<r.distbits)-1],y=x>>>24,v=x>>>16&255,O=x&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(!(v&240)){for(R=y,b=v,C=O;x=r.distcode[C+((c&(1<<R+b)-1)>>R)],y=x>>>24,v=x>>>16&255,O=x&65535,!(R+y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=y,u-=y,r.back+=y,v&64){e.msg="invalid distance code",r.mode=Ae;break}r.offset=O,r.extra=v&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=Ae;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=Ae;break}m>r.wnext?(m-=r.wnext,g=r.wsize-m):g=r.wnext-m,m>r.length&&(m=r.length),_=r.window}else _=i,g=o-r.offset,m=r.length;m>l&&(m=l),l-=m,r.length-=m;do i[o++]=_[g++];while(--m);r.length===0&&(r.mode=Gi);break;case Xl:if(l===0)break e;i[o++]=r.length,l--,r.mode=Gi;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=Ae;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=Ae;break}c=0,u=0}r.mode=Vl;case Vl:S=c0;break e;case Ae:S=Rl;break e;case Kl:return Ol;case f0: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<Ae&&(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===Xt?128:0)+(r.mode===Wi||r.mode===Oo?256:0),(d===0&&p===0||t===kl)&&S===Tr&&(S=u0),S}function _0(e){if(!e||!e.state)return vt;var t=e.state;return t.window&&(t.window=null),e.state=null,Tr}function v0(e,t){var r;return!e||!e.state||(r=e.state,!(r.wrap&2))?vt:(r.head=t,t.done=!1,Tr)}function x0(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,Tr))}Rt.inflateReset=eu,Rt.inflateReset2=tu,Rt.inflateResetKeep=Ql,Rt.inflateInit=g0,Rt.inflateInit2=ru,Rt.inflate=b0,Rt.inflateEnd=_0,Rt.inflateGetHeader=v0,Rt.inflateSetDictionary=x0,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 E0(){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 S0=E0,Jr=Rt,Yn=qt,qi=Or,Me=au,Ao=mo,k0=pl,R0=S0,ou=Object.prototype.toString;function Pr(e){if(!(this instanceof Pr))return new Pr(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 k0,this.strm.avail_out=0;var r=Jr.inflateInit2(this.strm,t.windowBits);if(r!==Me.Z_OK)throw new Error(Ao[r]);if(this.header=new R0,Jr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=qi.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!==Me.Z_OK)))throw new Error(Ao[r])}Pr.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?Me.Z_FINISH:Me.Z_NO_FLUSH,typeof e=="string"?r.input=qi.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,Me.Z_NO_FLUSH),a===Me.Z_NEED_DICT&&i&&(a=Jr.inflateSetDictionary(this.strm,i)),a===Me.Z_BUF_ERROR&&u===!0&&(a=Me.Z_OK,u=!1),a!==Me.Z_STREAM_END&&a!==Me.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===Me.Z_STREAM_END||r.avail_in===0&&(o===Me.Z_FINISH||o===Me.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=qi.utf8border(r.output,r.next_out),l=r.next_out-s,c=qi.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!==Me.Z_STREAM_END);return a===Me.Z_STREAM_END&&(o=Me.Z_FINISH),o===Me.Z_FINISH?(a=Jr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Me.Z_OK):(o===Me.Z_SYNC_FLUSH&&(this.onEnd(Me.Z_OK),r.avail_out=0),!0)},Pr.prototype.onData=function(e){this.chunks.push(e)},Pr.prototype.onEnd=function(e){e===Me.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 $o(e,t){var r=new Pr(t);if(r.push(e,!0),r.err)throw r.msg||Ao[r.err];return r.result}function O0(e,t){return t=t||{},t.raw=!0,$o(e,t)}Gn.Inflate=Pr,Gn.inflate=$o,Gn.inflateRaw=O0,Gn.ungzip=$o;var C0=qt.assign,T0=$n,P0=Gn,A0=au,su={};C0(su,T0,P0,A0);var $0=su;const Do=St($0),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="\\",I0=/^\s+$/,j0=/(?:[^\\]|^)\\$/,B0=/^\\!/,z0=/^\\#/,N0=/\r?\n/g,M0=/^\.*\/|^\.+$/,zo="/";let fu="node-ignore";typeof Symbol<"u"&&(fu=Symbol.for("node-ignore"));const du=fu,L0=(e,t,r)=>Object.defineProperty(e,t,{value:r}),F0=/([0-z])-([0-z])/g,hu=()=>!1,U0=e=>e.replace(F0,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:jo),H0=e=>{const{length:t}=e;return e.slice(0,t-t%2)},W0=[[/^\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}${H0(n)}${i}`:i==="]"&&n.length%2===0?`[${U0(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],pu=Object.create(null),G0=(e,t)=>{let r=pu[e];return r||(r=W0.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)&&!I0.test(e)&&!j0.test(e)&&e.indexOf("#")!==0,Y0=e=>e.split(N0);class X0{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(B0,"!").replace(z0,"#");const i=G0(e,t);return new X0(r,e,n,i)},V0=(e,t)=>{throw new t(e)},Zt=(e,t,r)=>No(e)?e?Zt.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=>M0.test(e);Zt.isNotRelative=mu,Zt.convert=e=>e;class K0{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){L0(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)?Y0(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&&Zt.convert(t);return Zt(a,t,this._allowRelativePaths?hu:V0),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 K0(e),J0=e=>Zt(e&&Zt.convert(e),e,hu);Yi.isPathValid=J0,Yi.default=Yi;var Q0=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,"/");Zt.convert=e;const t=/^[a-z]:\//i;Zt.isNotRelative=r=>t.test(r)||mu(r)}const ew=St(Q0);function tw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nt(e,t,r){return t=t instanceof RegExp?t:new RegExp(tw(t),"g"),e.replace(t,r)}var rw={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}},nw=rw;const Mt=St(nw);var iw=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,_=1,x,y,v=function(){i>=a&&(x=r,y=i,r=n,n=x,i=a,a=y,o=!0,l=i+1)},O=function(k,S,P){return{x:k,y:S,k:P}},R=function(k,S){return{elem:k,t:S}},b=function(k,S,P){var $,j,M;for(S>P?$=c[k-1+l]:$=c[k+1+l],M=Math.max(S,P),j=M-k;j<i&&M<a&&r[j]===n[M];)++j,++M;return c[k+l]=u.length,u[u.length]=new O(j,M,$),M},C=function(k){var S,P,$;for(S=P=0,$=k.length-1;$>=0;--$)for(;S<k[$].x||P<k[$].y;)k[$].y-k[$].x>P-S?(o?d[d.length]=new R(n[P],m):d[d.length]=new R(n[P],_),++P):k[$].y-k[$].x<P-S?(o?d[d.length]=new R(r[S],_):d[d.length]=new R(r[S],m),++S):(d[d.length]=new R(r[S],g),p+=r[S],++S,++P)};return v(),{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,P,$,j,M,H,Y;for(k=a-i,S=i+a+3,P={},H=0;H<S;++H)P[H]=-1,c[H]=-1;$=-1;do{for(++$,Y=-$;Y<=k-1;++Y)P[Y+l]=b(Y,P[Y-1+l]+1,P[Y+1+l]);for(Y=k+$;Y>=k+1;--Y)P[Y+l]=b(Y,P[Y-1+l]+1,P[Y+1+l]);P[k+l]=b(k,P[k-1+l]+1,P[k+1+l])}while(P[k+l]!==a);for(s=k+2*$,j=c[k+l],M=[];j!==-1;)M[M.length]=new O(u[j].x,u[j].y,null),j=u[j].k;C(M)}}},aw=iw;function ow(e,t){var r=new aw(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=ow(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 sw(e,t,r){var n,i=wu(t,e),a=wu(t,r),o=[];function s(H,Y){o.push([H.file1[0],Y,H.file1[1],H.file2[0],H.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(H,Y){return H[0]-Y[0]});var l=[],c=0;function u(H){H>c&&(l.push([1,c,H-c]),c=H)}for(var d=0;d<o.length;d++){for(var p=d,m=o[d],g=m[0],_=g+m[2];d<o.length-1;){var x=o[d+1],y=x[0];if(y>_)break;_=Math.max(_,y+x[2]),d++}if(u(g),p==d)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var v={0:[e.length,-1,t.length,-1],2:[r.length,-1,t.length,-1]};for(n=p;n<=d;n++){m=o[n];var O=m[1],R=v[O],b=m[0],C=b+m[2],k=m[3],S=k+m[4];R[0]=Math.min(k,R[0]),R[1]=Math.max(S,R[1]),R[2]=Math.min(b,R[2]),R[3]=Math.max(C,R[3])}var P=v[0][0]+(g-v[0][2]),$=v[0][1]+(_-v[0][3]),j=v[2][0]+(g-v[2][2]),M=v[2][1]+(_-v[2][3]);l.push([-1,P,$-P,g,_-g,j,M-j])}c=_}return u(t.length),l}function cw(e,t,r){var n=[],i=[e,t,r],a=sw(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],_=m[5],x=0;x<m[2];x++)if(e[x+g]!=r[x+_])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 lw=cw;const uw=St(lw);class ge 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 ge(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 Xn extends ge{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=Xn.code,this.data={filepaths:t}}}Xn.code="UnmergedPathsError";class ce extends ge{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=ce.code,this.data={message:t}}}ce.code="InternalError";class Qr extends ge{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 Xi(e,t){return-(e<t)||+(e>t)}function gu(e,t){return Xi(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 fw(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 hw()),Mo?_u(e):dw(e)}function dw(e){return new Pc().update(e).digest("hex")}async function _u(e){const t=await crypto.subtle.digest("SHA-1",e);return fw(t)}async function hw(){try{if(await _u(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function pw(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function mw(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 ce("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(t.length===0)throw new ce("Index file is empty (.git/index)");const r=new Ar,n=new Lt(t),i=n.toString("utf8",4);if(i!=="DIRC")throw new ce(`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 ce(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);const s=n.readUInt32BE();if(s!==2)throw new ce(`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=pw(d);const p=t.indexOf(0,n.tell()+1)-n.tell();if(p<1)throw new ce(`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 ce(`Expected 1-8 null characters but got '${g}' after ${u.path}`);if(n.eof())throw new ce("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
- `)}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(mw(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 Zi(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 ww(){return{map:new Map,stats:new Map}}async function gw(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 yw(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:Zi(n,i)}class Ge{static async acquire({fs:t,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[tn]||(n[tn]=ww());const o=`${r}/index`;Lo===null&&(Lo=new Pn({maxPending:1/0}));let s,l=[];return await Lo.acquire(o,async()=>{await yw(t,o,n[tn])&&await gw(t,o,n[tn]);const c=n[tn].map.get(o);if(l=c.unmergedPaths,l.length&&!i)throw new Xn(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 bw(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 ce(`Unexpected GitTree entry mode: ${e.toString(8)}`)}class _w{constructor({fs:t,gitdir:r,cache:n}){this.treePromise=Ge.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(Xi),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":bw(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 _w({fs:t,gitdir:r,cache:n})}}),Object.freeze(e),e}class Oe extends ge{constructor(t){super(`Could not find ${t}.`),this.code=this.name=Oe.code,this.data={what:t}}}Oe.code="NotFoundError";class rt extends ge{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 ge{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 Zn extends ge{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:
9
+ */(function(e){const t=Pi,r=eo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=v,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(We(w,ArrayBuffer)||w&&We(w.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(We(w,SharedArrayBuffer)||w&&We(w.buffer,SharedArrayBuffer)))return _(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 A=x(w);if(A)return A;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=O(w,f)|0;let E=o(h);const A=E.write(w,f);return A!==h&&(E=E.slice(0,A)),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(We(w,Uint8Array)){const f=new Uint8Array(w);return _(f.buffer,f.byteOffset,f.byteLength)}return m(w)}function _(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=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 v(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(We(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),We(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,A=h.length;for(let B=0,z=Math.min(E,A);B<z;++B)if(f[B]!==h[B]){E=f[B],A=h[B];break}return E<A?-1:A<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 A=s.allocUnsafe(h);let B=0;for(E=0;E<f.length;++E){let z=f[E];if(We(z,Uint8Array))B+z.length>A.length?(s.isBuffer(z)||(z=s.from(z)),z.copy(A,B)):Uint8Array.prototype.set.call(A,z,B);else if(s.isBuffer(z))z.copy(A,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=z.length}return A};function O(w,f){if(s.isBuffer(w))return w.length;if(ArrayBuffer.isView(w)||We(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 A=!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(A)return E?-1:ne(w).length;f=(""+f).toLowerCase(),A=!0}}s.byteLength=O;function R(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 Ue(this,f,h);case"utf8":case"utf-8":return Y(this,f,h);case"ascii":return le(this,f,h);case"latin1":case"binary":return _e(this,f,h);case"base64":return H(this,f,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Be(this,f,h);default:if(E)throw new TypeError("Unknown encoding: "+w);w=(w+"").toLowerCase(),E=!0}}s.prototype._isBuffer=!0;function b(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)b(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)b(this,h,h+3),b(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)b(this,h,h+7),b(this,h+1,h+6),b(this,h+2,h+5),b(this,h+3,h+4);return this},s.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?Y(this,0,f):R.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,A,B){if(We(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),A===void 0&&(A=0),B===void 0&&(B=this.length),h<0||E>f.length||A<0||B>this.length)throw new RangeError("out of range index");if(A>=B&&h>=E)return 0;if(A>=B)return-1;if(h>=E)return 1;if(h>>>=0,E>>>=0,A>>>=0,B>>>=0,this===f)return 0;let z=B-A,me=E-h;const ze=Math.min(z,me),Ie=this.slice(A,B),Ne=f.slice(h,E);for(let Te=0;Te<ze;++Te)if(Ie[Te]!==Ne[Te]){z=Ie[Te],me=Ne[Te];break}return z<me?-1:me<z?1:0};function C(w,f,h,E,A){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=A?0:w.length-1),h<0&&(h=w.length+h),h>=w.length){if(A)return-1;h=w.length-1}else if(h<0)if(A)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,A);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(w,f,h):Uint8Array.prototype.lastIndexOf.call(w,f,h):k(w,[f],h,E,A);throw new TypeError("val must be string, number or Buffer")}function k(w,f,h,E,A){let B=1,z=w.length,me=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,me/=2,h/=2}function ze(Ne,Te){return B===1?Ne[Te]:Ne.readUInt16BE(Te*B)}let Ie;if(A){let Ne=-1;for(Ie=h;Ie<z;Ie++)if(ze(w,Ie)===ze(f,Ne===-1?0:Ie-Ne)){if(Ne===-1&&(Ne=Ie),Ie-Ne+1===me)return Ne*B}else Ne!==-1&&(Ie-=Ie-Ne),Ne=-1}else for(h+me>z&&(h=z-me),Ie=h;Ie>=0;Ie--){let Ne=!0;for(let Te=0;Te<me;Te++)if(ze(w,Ie+Te)!==ze(f,Te)){Ne=!1;break}if(Ne)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 S(w,f,h,E){h=Number(h)||0;const A=w.length-h;E?(E=Number(E),E>A&&(E=A)):E=A;const B=f.length;E>B/2&&(E=B/2);let z;for(z=0;z<E;++z){const me=parseInt(f.substr(z*2,2),16);if(Pe(me))return z;w[h+z]=me}return z}function P(w,f,h,E){return Et(ne(f,w.length-h),w,h,E)}function $(w,f,h,E){return Et(ie(f),w,h,E)}function j(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,A){if(h===void 0)A="utf8",E=this.length,h=0;else if(E===void 0&&typeof h=="string")A=h,E=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(E)?(E=E>>>0,A===void 0&&(A="utf8")):(A=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");A||(A="utf8");let z=!1;for(;;)switch(A){case"hex":return S(this,f,h,E);case"utf8":case"utf-8":return P(this,f,h,E);case"ascii":case"latin1":case"binary":return $(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: "+A);A=(""+A).toLowerCase(),z=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function H(w,f,h){return f===0&&h===w.length?t.fromByteArray(w):t.fromByteArray(w.slice(f,h))}function Y(w,f,h){h=Math.min(w.length,h);const E=[];let A=f;for(;A<h;){const B=w[A];let z=null,me=B>239?4:B>223?3:B>191?2:1;if(A+me<=h){let ze,Ie,Ne,Te;switch(me){case 1:B<128&&(z=B);break;case 2:ze=w[A+1],(ze&192)===128&&(Te=(B&31)<<6|ze&63,Te>127&&(z=Te));break;case 3:ze=w[A+1],Ie=w[A+2],(ze&192)===128&&(Ie&192)===128&&(Te=(B&15)<<12|(ze&63)<<6|Ie&63,Te>2047&&(Te<55296||Te>57343)&&(z=Te));break;case 4:ze=w[A+1],Ie=w[A+2],Ne=w[A+3],(ze&192)===128&&(Ie&192)===128&&(Ne&192)===128&&(Te=(B&15)<<18|(ze&63)<<12|(Ie&63)<<6|Ne&63,Te>65535&&Te<1114112&&(z=Te))}}z===null?(z=65533,me=1):z>65535&&(z-=65536,E.push(z>>>10&1023|55296),z=56320|z&1023),E.push(z),A+=me}return Ce(E)}const de=4096;function Ce(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 le(w,f,h){let E="";h=Math.min(w.length,h);for(let A=f;A<h;++A)E+=String.fromCharCode(w[A]&127);return E}function _e(w,f,h){let E="";h=Math.min(w.length,h);for(let A=f;A<h;++A)E+=String.fromCharCode(w[A]);return E}function Ue(w,f,h){const E=w.length;(!f||f<0)&&(f=0),(!h||h<0||h>E)&&(h=E);let A="";for(let B=f;B<h;++B)A+=se[w[B]];return A}function Be(w,f,h){const E=w.slice(f,h);let A="";for(let B=0;B<E.length-1;B+=2)A+=String.fromCharCode(E[B]+E[B+1]*256);return A}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 A=this.subarray(f,h);return Object.setPrototypeOf(A,s.prototype),A};function oe(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||oe(f,h,this.length);let A=this[f],B=1,z=0;for(;++z<h&&(B*=256);)A+=this[f+z]*B;return A},s.prototype.readUintBE=s.prototype.readUIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||oe(f,h,this.length);let A=this[f+--h],B=1;for(;h>0&&(B*=256);)A+=this[f+--h]*B;return A},s.prototype.readUint8=s.prototype.readUInt8=function(f,h){return f=f>>>0,h||oe(f,1,this.length),this[f]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(f,h){return f=f>>>0,h||oe(f,2,this.length),this[f]|this[f+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(f,h){return f=f>>>0,h||oe(f,2,this.length),this[f]<<8|this[f+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(f,h){return f=f>>>0,h||oe(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||oe(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 A=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(A)+(BigInt(B)<<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 A=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(A)<<BigInt(32))+BigInt(B)}),s.prototype.readIntLE=function(f,h,E){f=f>>>0,h=h>>>0,E||oe(f,h,this.length);let A=this[f],B=1,z=0;for(;++z<h&&(B*=256);)A+=this[f+z]*B;return B*=128,A>=B&&(A-=Math.pow(2,8*h)),A},s.prototype.readIntBE=function(f,h,E){f=f>>>0,h=h>>>0,E||oe(f,h,this.length);let A=h,B=1,z=this[f+--A];for(;A>0&&(B*=256);)z+=this[f+--A]*B;return B*=128,z>=B&&(z-=Math.pow(2,8*h)),z},s.prototype.readInt8=function(f,h){return f=f>>>0,h||oe(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},s.prototype.readInt16LE=function(f,h){f=f>>>0,h||oe(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||oe(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||oe(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||oe(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 A=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(E<<24);return(BigInt(A)<<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 A=(h<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(A)<<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||oe(f,4,this.length),r.read(this,f,!0,23,4)},s.prototype.readFloatBE=function(f,h){return f=f>>>0,h||oe(f,4,this.length),r.read(this,f,!1,23,4)},s.prototype.readDoubleLE=function(f,h){return f=f>>>0,h||oe(f,8,this.length),r.read(this,f,!0,52,8)},s.prototype.readDoubleBE=function(f,h){return f=f>>>0,h||oe(f,8,this.length),r.read(this,f,!1,52,8)};function F(w,f,h,E,A,B){if(!s.isBuffer(w))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>A||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,A){if(f=+f,h=h>>>0,E=E>>>0,!A){const me=Math.pow(2,8*E)-1;F(this,f,h,E,me,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,A){if(f=+f,h=h>>>0,E=E>>>0,!A){const me=Math.pow(2,8*E)-1;F(this,f,h,E,me,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 G(w,f,h,E,A){L(f,E,A,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,A){L(f,E,A,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=Se(function(f,h=0){return G(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,A){if(f=+f,h=h>>>0,!A){const ze=Math.pow(2,8*E-1);F(this,f,h,E,ze-1,-ze)}let B=0,z=1,me=0;for(this[h]=f&255;++B<E&&(z*=256);)f<0&&me===0&&this[h+B-1]!==0&&(me=1),this[h+B]=(f/z>>0)-me&255;return h+E},s.prototype.writeIntBE=function(f,h,E,A){if(f=+f,h=h>>>0,!A){const ze=Math.pow(2,8*E-1);F(this,f,h,E,ze-1,-ze)}let B=E-1,z=1,me=0;for(this[h+B]=f&255;--B>=0&&(z*=256);)f<0&&me===0&&this[h+B+1]!==0&&(me=1),this[h+B]=(f/z>>0)-me&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 G(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,A,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,A){return f=+f,h=h>>>0,A||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,A){return f=+f,h=h>>>0,A||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,A){if(!s.isBuffer(f))throw new TypeError("argument should be a Buffer");if(E||(E=0),!A&&A!==0&&(A=this.length),h>=f.length&&(h=f.length),h||(h=0),A>0&&A<E&&(A=E),A===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(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),f.length-h<A-E&&(A=f.length-h+E);const B=A-E;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(h,E,A):Uint8Array.prototype.set.call(f,this.subarray(E,A),h),B},s.prototype.fill=function(f,h,E,A){if(typeof f=="string"){if(typeof h=="string"?(A=h,h=0,E=this.length):typeof E=="string"&&(A=E,E=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!s.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(f.length===1){const z=f.charCodeAt(0);(A==="utf8"&&z<128||A==="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,A),me=z.length;if(me===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<E-h;++B)this[B+h]=z[B%me]}return this};const D={};function q(w,f,h){D[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(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0})}toString(){return`${this.name} [${w}]: ${this.message}`}}}q("ERR_BUFFER_OUT_OF_BOUNDS",function(w){return w?`${w} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),q("ERR_INVALID_ARG_TYPE",function(w,f){return`The "${w}" argument must be of type number. Received type ${typeof f}`},TypeError),q("ERR_OUT_OF_RANGE",function(w,f,h){let E=`The value of "${w}" is out of range.`,A=h;return Number.isInteger(h)&&Math.abs(h)>2**32?A=Z(String(h)):typeof h=="bigint"&&(A=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(A=Z(A)),A+="n"),E+=` It must be ${f}. Received ${A}`,E},RangeError);function Z(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 X(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,A,B){if(w>h||w<f){const z=typeof f=="bigint"?"n":"";let me;throw f===0||f===BigInt(0)?me=`>= 0${z} and < 2${z} ** ${(B+1)*8}${z}`:me=`>= -(2${z} ** ${(B+1)*8-1}${z}) and < 2 ** ${(B+1)*8-1}${z}`,new D.ERR_OUT_OF_RANGE("value",me,w)}X(E,A,B)}function V(w,f){if(typeof w!="number")throw new D.ERR_INVALID_ARG_TYPE(f,"number",w)}function re(w,f,h){throw Math.floor(w)!==w?(V(w,h),new D.ERR_OUT_OF_RANGE("offset","an integer",w)):f<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,w)}const Q=/[^+/0-9A-Za-z-_]/g;function ue(w){if(w=w.split("=")[0],w=w.trim().replace(Q,""),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 A=null;const B=[];for(let z=0;z<E;++z){if(h=w.charCodeAt(z),h>55295&&h<57344){if(!A){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}A=h;continue}if(h<56320){(f-=3)>-1&&B.push(239,191,189),A=h;continue}h=(A-55296<<10|h-56320)+65536}else A&&(f-=3)>-1&&B.push(239,191,189);if(A=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 Re(w,f){let h,E,A;const B=[];for(let z=0;z<w.length&&!((f-=2)<0);++z)h=w.charCodeAt(z),E=h>>8,A=h%256,B.push(A),B.push(E);return B}function Ee(w){return t.toByteArray(ue(w))}function Et(w,f,h,E){let A;for(A=0;A<E&&!(A+h>=f.length||A>=w.length);++A)f[A+h]=w[A];return A}function We(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 se=function(){const w="0123456789abcdef",f=new Array(256);for(let h=0;h<16;++h){const E=h*16;for(let A=0;A<16;++A)f[E+A]=w[h]+w[A]}return f}();function Se(w){return typeof BigInt>"u"?Oi:w}function Oi(){throw new Error("BigInt not supported")}})(Ja);function _p(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:_p(e)}async function xp(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 Ep(e){let t=0;const r=[];await xp(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 Sp(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 kp({onProgress:e,url:t,method:r="GET",headers:n={},body:i}){i&&(i=await Ep(i));const a=await fetch(t,{method:r,headers:n,body:i}),o=a.body&&a.body.getReader?Sp(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:kp},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(v,O){i=v,a=O})),n=n||{};var s=!1,l=null,c=null,u=null,d=this,p=function(v,O,R){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),v&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||(o?O?a(O):i(R):typeof r=="function"&&r(O,R),s=!0),v&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},m=function(v){if(s)return p(v);l&&(clearTimeout(l),l=null),d.domainReentrant&&v&&(d.domains[e]=process.domain);var O=n.maxExecutionTime||d.maxExecutionTime;if(O&&(u=setTimeout(function(){d.queues[e]&&p(v,new Error("Maximum execution time is exceeded "+e))},O)),t.length===1){var R=!1;try{t(function(b,C){R||(R=!0,p(v,b,C))})}catch(b){R||(R=!0,p(v,b))}}else d._promiseTry(function(){return t()}).then(function(b){p(v,void 0,b)},function(b){p(v,b)})};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 _=function(){m(!0)};n.skipQueue?d.queues[e].unshift(_):d.queues[e].push(_);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 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 Rp=ht,Op=Rp;const Pn=St(Op);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 Cp=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 Tc=no.exports,Pc=Tc.Buffer;function Ai(e,t){this._block=Pc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Ai.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=Pc.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 Tp=Ai,Pp=Cp,Ac=Tp,Ap=Tc.Buffer,$p=[1518500249,1859775393,-1894007588,-899497514],Dp=new Array(80);function An(){this.init(),this._w=Dp,Ac.call(this,64,56)}Pp(An,Ac),An.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Ip(e){return e<<1|e>>>31}function jp(e){return e<<5|e>>>27}function Bp(e){return e<<30|e>>>2}function zp(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]=Ip(t[s-3]^t[s-8]^t[s-14]^t[s-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=jp(r)+zp(c,n,i,a)+o+t[l]+$p[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=Ap.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 Np=An;const $c=St(Np);function $t(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function Dc(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 Mp(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),$t(a),a.length!==0&&(t=a+"/"+t,r=a.charCodeAt(0)===47)}return t=Dc(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if($t(t),t.length===0)return".";var r=t.charCodeAt(0)===47,n=t.charCodeAt(t.length-1)===47;return t=Dc(t,!r),t.length===0&&!r&&(t="."),t.length>0&&n&&(t+="/"),r?"/"+t:t},isAbsolute:function(t){return $t(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];$t(n),n.length>0&&(t===void 0?t=n:t+="/"+n)}return t===void 0?".":Hr.normalize(t)},relative:function(t,r){if($t(t),$t(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($t(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');$t(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){$t(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 Mp("/",t)},parse:function(t){$t(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,Ic={};/*! 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,P=new Array(256),$=0;$!=256;++$)S=$,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,P[$]=S;return typeof Int32Array<"u"?new Int32Array(P):P}var n=r();function i(S){var P=0,$=0,j=0,M=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(j=0;j!=256;++j)M[j]=S[j];for(j=0;j!=256;++j)for($=S[j],P=256+j;P<4096;P+=256)$=M[P]=$>>>8^S[$&255];var H=[];for(j=1;j!=16;++j)H[j-1]=typeof Int32Array<"u"?M.subarray(j*256,j*256+256):M.slice(j*256,j*256+256);return H}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],_=a[9],x=a[10],y=a[11],v=a[12],O=a[13],R=a[14];function b(S,P){for(var $=P^-1,j=0,M=S.length;j<M;)$=$>>>8^n[($^S.charCodeAt(j++))&255];return~$}function C(S,P){for(var $=P^-1,j=S.length-15,M=0;M<j;)$=R[S[M++]^$&255]^O[S[M++]^$>>8&255]^v[S[M++]^$>>16&255]^y[S[M++]^$>>>24]^x[S[M++]]^_[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(j+=15;M<j;)$=$>>>8^n[($^S[M++])&255];return~$}function k(S,P){for(var $=P^-1,j=0,M=S.length,H=0,Y=0;j<M;)H=S.charCodeAt(j++),H<128?$=$>>>8^n[($^H)&255]:H<2048?($=$>>>8^n[($^(192|H>>6&31))&255],$=$>>>8^n[($^(128|H&63))&255]):H>=55296&&H<57344?(H=(H&1023)+64,Y=S.charCodeAt(j++)&1023,$=$>>>8^n[($^(240|H>>8&7))&255],$=$>>>8^n[($^(128|H>>2&63))&255],$=$>>>8^n[($^(128|Y>>6&15|(H&3)<<4))&255],$=$>>>8^n[($^(128|Y&63))&255]):($=$>>>8^n[($^(224|H>>12&15))&255],$=$>>>8^n[($^(128|H>>6&63))&255],$=$>>>8^n[($^(128|H&63))&255]);return~$}t.table=n,t.bstr=b,t.buf=C,t.str=k})})(Ic);const Lp=St(Ic);var qt={};(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)})(qt);var $n={},Dt={},Wr={},Fp=qt,Up=4,jc=0,Bc=1,Hp=2;function Gr(e){for(var t=e.length;--t>=0;)e[t]=0}var Wp=0,zc=1,Gp=2,qp=3,Yp=258,io=29,Dn=256,In=Dn+1+io,qr=30,ao=19,Nc=2*In+1,xr=15,oo=16,Xp=7,so=256,Mc=16,Lc=17,Fc=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],$i=[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],Uc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Vp=512,Yt=new Array((In+2)*2);Gr(Yt);var jn=new Array(qr*2);Gr(jn);var Bn=new Array(Vp);Gr(Bn);var zn=new Array(Yp-qp+1);Gr(zn);var lo=new Array(io);Gr(lo);var Di=new Array(qr);Gr(Di);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 Hc,Wc,Gc;function fo(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function qc(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 Yc(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Kp(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 Jp(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,_=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<Nc;c++)u=e.heap[c],p=r[r[u*2+1]*2+1]+1,p>l&&(p=l,_++),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(_!==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]--,_-=2}while(_>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 Xc(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]=Yc(n[s]++,s))}}function Qp(){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(Di[n]=i,e=0;e<1<<$i[n];e++)Bn[i++]=n;for(i>>=7;n<qr;n++)for(Di[n]=i<<7,e=0;e<1<<$i[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(Xc(Yt,In+1,a),e=0;e<qr;e++)jn[e*2+1]=5,jn[e*2]=Yc(e,5);Hc=new uo(Yt,co,Dn+1,In,xr),Wc=new uo(jn,$i,0,qr,xr),Gc=new uo(new Array(0),Zp,0,ao,Xp)}function Zc(e){var t;for(t=0;t<In;t++)e.dyn_ltree[t*2]=0;for(t=0;t<qr;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 Vc(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 em(e,t,r,n){Vc(e),Nn(e,r),Nn(e,~r),Fp.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Kc(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&&Kc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Kc(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Jc(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+Dn+1,t),s=co[o],s!==0&&(i-=lo[o],st(e,i,s)),n--,o=qc(n),It(e,o,r),s=$i[o],s!==0&&(n-=Di[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=Nc,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],Jp(e,t),Xc(r,l,e.bl_count)}function Qc(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[Mc*2]++):s<=10?e.bl_tree[Lc*2]++:e.bl_tree[Fc*2]++,s=0,i=a,o===0?(l=138,c=3):a===o?(l=6,c=3):(l=7,c=4))}function el(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,Mc,e.bl_tree),st(e,s-3,2)):s<=10?(It(e,Lc,e.bl_tree),st(e,s-3,3)):(It(e,Fc,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 tm(e){var t;for(Qc(e,e.dyn_ltree,e.l_desc.max_code),Qc(e,e.dyn_dtree,e.d_desc.max_code),po(e,e.bl_desc),t=ao-1;t>=3&&e.bl_tree[Uc[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function rm(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[Uc[i]*2+1],3);el(e,e.dyn_ltree,t-1),el(e,e.dyn_dtree,r-1)}function nm(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return jc;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Bc;for(r=32;r<Dn;r++)if(e.dyn_ltree[r*2]!==0)return Bc;return jc}var tl=!1;function im(e){tl||(Qp(),tl=!0),e.l_desc=new fo(e.dyn_ltree,Hc),e.d_desc=new fo(e.dyn_dtree,Wc),e.bl_desc=new fo(e.bl_tree,Gc),e.bi_buf=0,e.bi_valid=0,Zc(e)}function rl(e,t,r,n){st(e,(Wp<<1)+(n?1:0),3),em(e,t,r)}function am(e){st(e,zc<<1,3),It(e,so,Yt),Kp(e)}function om(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===Hp&&(e.strm.data_type=nm(e)),po(e,e.l_desc),po(e,e.d_desc),o=tm(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?rl(e,t,r,n):e.strategy===Up||a===i?(st(e,(zc<<1)+(n?1:0),3),Jc(e,Yt,jn)):(st(e,(Gp<<1)+(n?1:0),3),rm(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Jc(e,e.dyn_ltree,e.dyn_dtree)),Zc(e),n&&Vc(e)}function sm(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]+Dn+1)*2]++,e.dyn_dtree[qc(t)*2]++),e.last_lit===e.lit_bufsize-1}Wr._tr_init=im,Wr._tr_stored_block=rl,Wr._tr_flush_block=om,Wr._tr_tally=sm,Wr._tr_align=am;function cm(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 nl=cm;function lm(){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 um=lm();function fm(e,t,r,n){var i=um,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}var il=fm,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=qt,bt=Wr,al=nl,rr=il,dm=mo,Er=0,hm=1,pm=3,nr=4,ol=5,jt=0,sl=1,_t=-2,mm=-3,wo=-5,wm=-1,gm=1,Ii=2,ym=3,bm=4,_m=0,vm=2,ji=8,xm=9,Em=15,Sm=8,km=29,Rm=256,go=Rm+1+km,Om=30,Cm=19,Tm=2*go+1,Pm=15,we=3,ir=258,kt=ir+we+1,Am=32,Bi=42,yo=69,zi=73,Ni=91,Mi=103,Sr=113,Mn=666,He=1,Ln=2,kr=3,Yr=4,$m=3;function ar(e,t){return e.msg=dm[t],t}function cl(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 Ye(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 ve(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=al(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 ll(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>=we)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+we-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<we)););}while(e.lookahead<kt&&e.strm.avail_in!==0)}function Im(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 He;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,Ye(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-kt&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=0,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):(e.strstart>e.block_start&&(Ye(e,!1),e.strm.avail_out===0),He)}function bo(e,t){for(var r,n;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return He;if(e.lookahead===0)break}if(r=0,e.lookahead>=we&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+we-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=ll(e,r)),e.match_length>=we)if(n=bt._tr_tally(e,e.strstart-e.match_start,e.match_length-we),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=we){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+we-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&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=e.strstart<we-1?e.strstart:we-1,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He:Ln}function Xr(e,t){for(var r,n,i;;){if(e.lookahead<kt){if(Rr(e),e.lookahead<kt&&t===Er)return He;if(e.lookahead===0)break}if(r=0,e.lookahead>=we&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+we-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=we-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-kt&&(e.match_length=ll(e,r),e.match_length<=5&&(e.strategy===gm||e.match_length===we&&e.strstart-e.match_start>4096)&&(e.match_length=we-1)),e.prev_length>=we&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-we,n=bt._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-we),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+we-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=we-1,e.strstart++,n&&(Ye(e,!1),e.strm.avail_out===0))return He}else if(e.match_available){if(n=bt._tr_tally(e,0,e.window[e.strstart-1]),n&&Ye(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return He}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<we-1?e.strstart:we-1,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He:Ln}function jm(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=ir){if(Rr(e),e.lookahead<=ir&&t===Er)return He;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=we&&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>=we?(r=bt._tr_tally(e,1,e.match_length-we),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&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=0,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He:Ln}function Bm(e,t){for(var r;;){if(e.lookahead===0&&(Rr(e),e.lookahead===0)){if(t===Er)return He;break}if(e.match_length=0,r=bt._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Ye(e,!1),e.strm.avail_out===0))return He}return e.insert=0,t===nr?(Ye(e,!0),e.strm.avail_out===0?kr:Yr):e.last_lit&&(Ye(e,!1),e.strm.avail_out===0)?He: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 Zr;Zr=[new Bt(0,0,0,0,Im),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,Xr),new Bt(8,16,32,32,Xr),new Bt(8,16,128,128,Xr),new Bt(8,32,128,256,Xr),new Bt(32,128,258,1024,Xr),new Bt(32,258,258,4096,Xr)];function zm(e){e.window_size=2*e.w_size,or(e.head),e.max_lazy_match=Zr[e.level].max_lazy,e.good_match=Zr[e.level].good_length,e.nice_match=Zr[e.level].nice_length,e.max_chain_length=Zr[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=we-1,e.match_available=0,e.ins_h=0}function Nm(){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(Tm*2),this.dyn_dtree=new tt.Buf16((2*Om+1)*2),this.bl_tree=new tt.Buf16((2*Cm+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 ul(e){var t;return!e||!e.state?ar(e,_t):(e.total_in=e.total_out=0,e.data_type=vm,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 fl(e){var t=ul(e);return t===jt&&zm(e.state),t}function Mm(e,t){return!e||!e.state||e.state.wrap!==2?_t:(e.state.gzhead=t,jt)}function dl(e,t,r,n,i,a){if(!e)return _t;var o=1;if(t===wm&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>xm||r!==ji||n<8||n>15||t<0||t>9||a<0||a>bm)return ar(e,_t);n===8&&(n=9);var s=new Nm;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+we-1)/we),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,fl(e)}function Lm(e,t){return dl(e,t,ji,Em,Sm,_m)}function Fm(e,t){var r,n,i,a;if(!e||!e.state||t>ol||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,ve(n,31),ve(n,139),ve(n,8),n.gzhead?(ve(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ve(n,n.gzhead.time&255),ve(n,n.gzhead.time>>8&255),ve(n,n.gzhead.time>>16&255),ve(n,n.gzhead.time>>24&255),ve(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),ve(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ve(n,n.gzhead.extra.length&255),ve(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=rr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=yo):(ve(n,0),ve(n,0),ve(n,0),ve(n,0),ve(n,0),ve(n,n.level===9?2:n.strategy>=Ii||n.level<2?4:0),ve(n,$m),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|=Am),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));)ve(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,ve(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,ve(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&&(ve(n,e.adler&255),ve(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&&cl(t)<=cl(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?Bm(n,t):n.strategy===ym?jm(n,t):Zr[n.level].func(n,t);if((l===kr||l===Yr)&&(n.status=Mn),l===He||l===kr)return e.avail_out===0&&(n.last_flush=-1),jt;if(l===Ln&&(t===hm?bt._tr_align(n):t!==ol&&(bt._tr_stored_block(n,0,0,!1),t===pm&&(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?sl:(n.wrap===2?(ve(n,e.adler&255),ve(n,e.adler>>8&255),ve(n,e.adler>>16&255),ve(n,e.adler>>24&255),ve(n,e.total_in&255),ve(n,e.total_in>>8&255),ve(n,e.total_in>>16&255),ve(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:sl)}function Um(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,mm):jt))}function Hm(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=al(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>=we;){i=n.strstart,a=n.lookahead-(we-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+we-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=we-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=we-1,n.match_available=0,e.next_in=l,e.input=c,e.avail_in=s,n.wrap=o,jt}Dt.deflateInit=Lm,Dt.deflateInit2=dl,Dt.deflateReset=fl,Dt.deflateResetKeep=ul,Dt.deflateSetHeader=Mm,Dt.deflate=Fm,Dt.deflateEnd=Um,Dt.deflateSetDictionary=Hm,Dt.deflateInfo="pako deflate (from Nodeca project)";var Or={},Li=qt,hl=!0,pl=!0;try{String.fromCharCode.apply(null,[0])}catch{hl=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{pl=!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 ml(e,t){if(t<65534&&(e.subarray&&pl||!e.subarray&&hl))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 ml(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 ml(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 Wm(){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 wl=Wm,Hn=Dt,Wn=qt,_o=Or,vo=mo,Gm=wl,gl=Object.prototype.toString,qm=0,xo=4,Vr=0,yl=1,bl=2,Ym=-1,Xm=0,Zm=8;function Cr(e){if(!(this instanceof Cr))return new Cr(e);this.options=Wn.assign({level:Ym,method:Zm,chunkSize:16384,windowBits:15,memLevel:8,strategy:Xm,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 Gm,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):gl.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):gl.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!==yl&&i!==Vr)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===xo||a===bl))&&(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!==yl);return a===xo?(i=Hn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Vr):(a===bl&&(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 Vm(e,t){return t=t||{},t.raw=!0,Eo(e,t)}function Km(e,t){return t=t||{},t.gzip=!0,Eo(e,t)}$n.Deflate=Cr,$n.deflate=Eo,$n.deflateRaw=Vm,$n.gzip=Km;var Gn={},Rt={},Fi=30,Jm=12,Qm=function(t,r){var n,i,a,o,s,l,c,u,d,p,m,g,_,x,y,v,O,R,b,C,k,S,P,$,j;n=t.state,i=t.next_in,$=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,_=n.bits,x=n.lencode,y=n.distcode,v=(1<<n.lenbits)-1,O=(1<<n.distbits)-1;e:do{_<15&&(g+=$[i++]<<_,_+=8,g+=$[i++]<<_,_+=8),R=x[g&v];t:for(;;){if(b=R>>>24,g>>>=b,_-=b,b=R>>>16&255,b===0)j[o++]=R&65535;else if(b&16){C=R&65535,b&=15,b&&(_<b&&(g+=$[i++]<<_,_+=8),C+=g&(1<<b)-1,g>>>=b,_-=b),_<15&&(g+=$[i++]<<_,_+=8,g+=$[i++]<<_,_+=8),R=y[g&O];r:for(;;){if(b=R>>>24,g>>>=b,_-=b,b=R>>>16&255,b&16){if(k=R&65535,b&=15,_<b&&(g+=$[i++]<<_,_+=8,_<b&&(g+=$[i++]<<_,_+=8)),k+=g&(1<<b)-1,k>c){t.msg="invalid distance too far back",n.mode=Fi;break e}if(g>>>=b,_-=b,b=o-s,k>b){if(b=k-b,b>d&&n.sane){t.msg="invalid distance too far back",n.mode=Fi;break e}if(S=0,P=m,p===0){if(S+=u-b,b<C){C-=b;do j[o++]=m[S++];while(--b);S=o-k,P=j}}else if(p<b){if(S+=u+p-b,b-=p,b<C){C-=b;do j[o++]=m[S++];while(--b);if(S=0,p<C){b=p,C-=b;do j[o++]=m[S++];while(--b);S=o-k,P=j}}}else if(S+=p-b,b<C){C-=b;do j[o++]=m[S++];while(--b);S=o-k,P=j}for(;C>2;)j[o++]=P[S++],j[o++]=P[S++],j[o++]=P[S++],C-=3;C&&(j[o++]=P[S++],C>1&&(j[o++]=P[S++]))}else{S=o-k;do j[o++]=j[S++],j[o++]=j[S++],j[o++]=j[S++],C-=3;while(C>2);C&&(j[o++]=j[S++],C>1&&(j[o++]=j[S++]))}}else if(b&64){t.msg="invalid distance code",n.mode=Fi;break e}else{R=y[(R&65535)+(g&(1<<b)-1)];continue r}break}}else if(b&64)if(b&32){n.mode=Jm;break e}else{t.msg="invalid literal/length code",n.mode=Fi;break e}else{R=x[(R&65535)+(g&(1<<b)-1)];continue t}break}}while(i<a&&o<l);C=_>>3,i-=C,_-=C<<3,g&=(1<<_)-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=_},_l=qt,Kr=15,vl=852,xl=592,El=0,So=1,Sl=2,e0=[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],t0=[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],r0=[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],n0=[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],i0=function(t,r,n,i,a,o,s,l){var c=l.bits,u=0,d=0,p=0,m=0,g=0,_=0,x=0,y=0,v=0,O=0,R,b,C,k,S,P=null,$=0,j,M=new _l.Buf16(Kr+1),H=new _l.Buf16(Kr+1),Y=null,de=0,Ce,le,_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),y=1,u=1;u<=Kr;u++)if(y<<=1,y-=M[u],y<0)return-1;if(y>0&&(t===El||m!==1))return-1;for(H[1]=0,u=1;u<Kr;u++)H[u+1]=H[u]+M[u];for(d=0;d<i;d++)r[n+d]!==0&&(s[H[r[n+d]]++]=d);if(t===El?(P=Y=s,j=19):t===So?(P=e0,$-=257,Y=t0,de-=257,j=256):(P=r0,Y=n0,j=-1),O=0,d=0,u=p,S=o,_=g,x=0,C=-1,v=1<<g,k=v-1,t===So&&v>vl||t===Sl&&v>xl)return 1;for(;;){Ce=u-x,s[d]<j?(le=0,_e=s[d]):s[d]>j?(le=Y[de+s[d]],_e=P[$+s[d]]):(le=96,_e=0),R=1<<u-x,b=1<<_,p=b;do b-=R,a[S+(O>>x)+b]=Ce<<24|le<<16|_e|0;while(b!==0);for(R=1<<u-1;O&R;)R>>=1;if(R!==0?(O&=R-1,O+=R):O=0,d++,--M[u]===0){if(u===m)break;u=r[n+s[d]]}if(u>g&&(O&k)!==C){for(x===0&&(x=g),S+=p,_=u-x,y=1<<_;_+x<m&&(y-=M[_+x],!(y<=0));)_++,y<<=1;if(v+=1<<_,t===So&&v>vl||t===Sl&&v>xl)return 1;C=O&k,a[C]=g<<24|_<<16|S-o|0}}return O!==0&&(a[S+O]=u-x<<24|64<<16|0),l.bits=g,0},pt=qt,ko=nl,zt=il,a0=Qm,qn=i0,o0=0,kl=1,Rl=2,Ol=4,s0=5,Ui=6,Tr=0,c0=1,l0=2,vt=-2,Cl=-3,Tl=-4,u0=-5,Pl=8,Al=1,$l=2,Dl=3,Il=4,jl=5,Bl=6,zl=7,Nl=8,Ml=9,Ll=10,Hi=11,Xt=12,Ro=13,Fl=14,Oo=15,Ul=16,Hl=17,Wl=18,Gl=19,Wi=20,Gi=21,ql=22,Yl=23,Xl=24,Zl=25,Vl=26,Co=27,Kl=28,Jl=29,Ae=30,Ql=31,f0=32,d0=852,h0=592,p0=15,m0=p0;function eu(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function w0(){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 tu(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=Al,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(d0),t.distcode=t.distdyn=new pt.Buf32(h0),t.sane=1,t.back=-1,Tr)}function ru(e){var t;return!e||!e.state?vt:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,tu(e))}function nu(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,ru(e))}function iu(e,t){var r,n;return e?(n=new w0,e.state=n,n.window=null,r=nu(e,t),r!==Tr&&(e.state=null),r):vt}function g0(e){return iu(e,m0)}var au=!0,To,Po;function y0(e){if(au){var t;for(To=new pt.Buf32(512),Po=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(qn(kl,e.lens,0,288,To,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;qn(Rl,e.lens,0,32,Po,0,e.work,{bits:5}),au=!1}e.lencode=To,e.lenbits=9,e.distcode=Po,e.distbits=5}function ou(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 b0(e,t){var r,n,i,a,o,s,l,c,u,d,p,m,g,_,x=0,y,v,O,R,b,C,k,S,P=new pt.Buf8(4),$,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 vt;r=e.state,r.mode===Xt&&(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=Tr;e:for(;;)switch(r.mode){case Al: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,P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,2,0),c=0,u=0,r.mode=$l;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=Ae;break}if((c&15)!==Pl){e.msg="unknown compression method",r.mode=Ae;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=Ae;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=c&512?Ll:Xt,c=0,u=0;break;case $l:for(;u<16;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(r.flags=c,(r.flags&255)!==Pl){e.msg="unknown compression method",r.mode=Ae;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=Ae;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,2,0)),c=0,u=0,r.mode=Dl;case Dl:for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}r.head&&(r.head.time=c),r.flags&512&&(P[0]=c&255,P[1]=c>>>8&255,P[2]=c>>>16&255,P[3]=c>>>24&255,r.check=zt(r.check,P,4,0)),c=0,u=0,r.mode=Il;case Il: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&&(P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,2,0)),c=0,u=0,r.mode=jl;case jl: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&&(P[0]=c&255,P[1]=c>>>8&255,r.check=zt(r.check,P,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=Bl;case Bl: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=zl;case zl: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=Nl;case Nl: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=Ml;case Ml: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=Ae;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=Xt;break;case Ll:for(;u<32;){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}e.adler=r.check=eu(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,l0;e.adler=r.check=1,r.mode=Xt;case Xt:if(t===s0||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=Fl;break;case 1:if(y0(r),r.mode=Wi,t===Ui){c>>>=2,u-=2;break e}break;case 2:r.mode=Hl;break;case 3:e.msg="invalid block type",r.mode=Ae}c>>>=2,u-=2;break;case Fl: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=Ae;break}if(r.length=c&65535,c=0,u=0,r.mode=Oo,t===Ui)break e;case Oo:r.mode=Ul;case Ul: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=Xt;break;case Hl: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=Ae;break}r.have=0,r.mode=Wl;case Wl: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,$={bits:r.lenbits},S=qn(o0,r.lens,0,19,r.lencode,0,r.work,$),r.lenbits=$.bits,S){e.msg="invalid code lengths set",r.mode=Ae;break}r.have=0,r.mode=Gl;case Gl:for(;r.have<r.nlen+r.ndist;){for(;x=r.lencode[c&(1<<r.lenbits)-1],y=x>>>24,v=x>>>16&255,O=x&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(O<16)c>>>=y,u-=y,r.lens[r.have++]=O;else{if(O===16){for(j=y+2;u<j;){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=Ae;break}k=r.lens[r.have-1],m=3+(c&3),c>>>=2,u-=2}else if(O===17){for(j=y+3;u<j;){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(j=y+7;u<j;){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=Ae;break}for(;m--;)r.lens[r.have++]=k}}if(r.mode===Ae)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Ae;break}if(r.lenbits=9,$={bits:r.lenbits},S=qn(kl,r.lens,0,r.nlen,r.lencode,0,r.work,$),r.lenbits=$.bits,S){e.msg="invalid literal/lengths set",r.mode=Ae;break}if(r.distbits=6,r.distcode=r.distdyn,$={bits:r.distbits},S=qn(Rl,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,$),r.distbits=$.bits,S){e.msg="invalid distances set",r.mode=Ae;break}if(r.mode=Wi,t===Ui)break e;case Wi:r.mode=Gi;case Gi: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,a0(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===Xt&&(r.back=-1);break}for(r.back=0;x=r.lencode[c&(1<<r.lenbits)-1],y=x>>>24,v=x>>>16&255,O=x&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(v&&!(v&240)){for(R=y,b=v,C=O;x=r.lencode[C+((c&(1<<R+b)-1)>>R)],y=x>>>24,v=x>>>16&255,O=x&65535,!(R+y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=y,u-=y,r.back+=y,r.length=O,v===0){r.mode=Vl;break}if(v&32){r.back=-1,r.mode=Xt;break}if(v&64){e.msg="invalid literal/length code",r.mode=Ae;break}r.extra=v&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.length+=c&(1<<r.extra)-1,c>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Yl;case Yl:for(;x=r.distcode[c&(1<<r.distbits)-1],y=x>>>24,v=x>>>16&255,O=x&65535,!(y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}if(!(v&240)){for(R=y,b=v,C=O;x=r.distcode[C+((c&(1<<R+b)-1)>>R)],y=x>>>24,v=x>>>16&255,O=x&65535,!(R+y<=u);){if(s===0)break e;s--,c+=n[a++]<<u,u+=8}c>>>=R,u-=R,r.back+=R}if(c>>>=y,u-=y,r.back+=y,v&64){e.msg="invalid distance code",r.mode=Ae;break}r.offset=O,r.extra=v&15,r.mode=Xl;case Xl: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=Ae;break}r.mode=Zl;case Zl: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=Ae;break}m>r.wnext?(m-=r.wnext,g=r.wsize-m):g=r.wnext-m,m>r.length&&(m=r.length),_=r.window}else _=i,g=o-r.offset,m=r.length;m>l&&(m=l),l-=m,r.length-=m;do i[o++]=_[g++];while(--m);r.length===0&&(r.mode=Gi);break;case Vl:if(l===0)break e;i[o++]=r.length,l--,r.mode=Gi;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:eu(c))!==r.check){e.msg="incorrect data check",r.mode=Ae;break}c=0,u=0}r.mode=Kl;case Kl: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=Ae;break}c=0,u=0}r.mode=Jl;case Jl:S=c0;break e;case Ae:S=Cl;break e;case Ql:return Tl;case f0: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<Ae&&(r.mode<Co||t!==Ol))&&ou(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===Xt?128:0)+(r.mode===Wi||r.mode===Oo?256:0),(d===0&&p===0||t===Ol)&&S===Tr&&(S=u0),S}function _0(e){if(!e||!e.state)return vt;var t=e.state;return t.window&&(t.window=null),e.state=null,Tr}function v0(e,t){var r;return!e||!e.state||(r=e.state,!(r.wrap&2))?vt:(r.head=t,t.done=!1,Tr)}function x0(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)?Cl:(a=ou(e,t,r,r),a?(n.mode=Ql,Tl):(n.havedict=1,Tr))}Rt.inflateReset=ru,Rt.inflateReset2=nu,Rt.inflateResetKeep=tu,Rt.inflateInit=g0,Rt.inflateInit2=iu,Rt.inflate=b0,Rt.inflateEnd=_0,Rt.inflateGetHeader=v0,Rt.inflateSetDictionary=x0,Rt.inflateInfo="pako inflate (from Nodeca project)";var su={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 E0(){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 S0=E0,Jr=Rt,Yn=qt,qi=Or,Me=su,Ao=mo,k0=wl,R0=S0,cu=Object.prototype.toString;function Pr(e){if(!(this instanceof Pr))return new Pr(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 k0,this.strm.avail_out=0;var r=Jr.inflateInit2(this.strm,t.windowBits);if(r!==Me.Z_OK)throw new Error(Ao[r]);if(this.header=new R0,Jr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=qi.string2buf(t.dictionary):cu.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Jr.inflateSetDictionary(this.strm,t.dictionary),r!==Me.Z_OK)))throw new Error(Ao[r])}Pr.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?Me.Z_FINISH:Me.Z_NO_FLUSH,typeof e=="string"?r.input=qi.binstring2buf(e):cu.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,Me.Z_NO_FLUSH),a===Me.Z_NEED_DICT&&i&&(a=Jr.inflateSetDictionary(this.strm,i)),a===Me.Z_BUF_ERROR&&u===!0&&(a=Me.Z_OK,u=!1),a!==Me.Z_STREAM_END&&a!==Me.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===Me.Z_STREAM_END||r.avail_in===0&&(o===Me.Z_FINISH||o===Me.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=qi.utf8border(r.output,r.next_out),l=r.next_out-s,c=qi.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!==Me.Z_STREAM_END);return a===Me.Z_STREAM_END&&(o=Me.Z_FINISH),o===Me.Z_FINISH?(a=Jr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Me.Z_OK):(o===Me.Z_SYNC_FLUSH&&(this.onEnd(Me.Z_OK),r.avail_out=0),!0)},Pr.prototype.onData=function(e){this.chunks.push(e)},Pr.prototype.onEnd=function(e){e===Me.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 $o(e,t){var r=new Pr(t);if(r.push(e,!0),r.err)throw r.msg||Ao[r.err];return r.result}function O0(e,t){return t=t||{},t.raw=!0,$o(e,t)}Gn.Inflate=Pr,Gn.inflate=$o,Gn.inflateRaw=O0,Gn.ungzip=$o;var C0=qt.assign,T0=$n,P0=Gn,A0=su,lu={};C0(lu,T0,P0,A0);var $0=lu;const Do=St($0),uu=(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):uu(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)?uu(o,t):o}return i};const Io=St(D0);function fu(e){return Array.isArray(e)?e:[e]}const jo="",du=" ",Bo="\\",I0=/^\s+$/,j0=/(?:[^\\]|^)\\$/,B0=/^\\!/,z0=/^\\#/,N0=/\r?\n/g,M0=/^\.*\/|^\.+$/,zo="/";let hu="node-ignore";typeof Symbol<"u"&&(hu=Symbol.for("node-ignore"));const pu=hu,L0=(e,t,r)=>Object.defineProperty(e,t,{value:r}),F0=/([0-z])-([0-z])/g,mu=()=>!1,U0=e=>e.replace(F0,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:jo),H0=e=>{const{length:t}=e;return e.slice(0,t-t%2)},W0=[[/^\uFEFF/,()=>jo],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?du:jo)],[/(\\+?)\s/g,(e,t)=>{const{length:r}=t;return t.slice(0,r-r%2)+du}],[/[\\$.|*+(){^]/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}${H0(n)}${i}`:i==="]"&&n.length%2===0?`[${U0(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],wu=Object.create(null),G0=(e,t)=>{let r=wu[e];return r||(r=W0.reduce((n,[i,a])=>n.replace(i,a.bind(e)),e),wu[e]=r),t?new RegExp(r,"i"):new RegExp(r)},No=e=>typeof e=="string",q0=e=>e&&No(e)&&!I0.test(e)&&!j0.test(e)&&e.indexOf("#")!==0,Y0=e=>e.split(N0);class X0{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(B0,"!").replace(z0,"#");const i=G0(e,t);return new X0(r,e,n,i)},V0=(e,t)=>{throw new t(e)},Zt=(e,t,r)=>No(e)?e?Zt.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),gu=e=>M0.test(e);Zt.isNotRelative=gu,Zt.convert=e=>e;class K0{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){L0(this,pu,!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[pu]){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,fu(No(t)?Y0(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&&Zt.convert(t);return Zt(a,t,this._allowRelativePaths?mu:V0),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 fu(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}}const Yi=e=>new K0(e),J0=e=>Zt(e&&Zt.convert(e),e,mu);Yi.isPathValid=J0,Yi.default=Yi;var Q0=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,"/");Zt.convert=e;const t=/^[a-z]:\//i;Zt.isNotRelative=r=>t.test(r)||gu(r)}const ew=St(Q0);function tw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nt(e,t,r){return t=t instanceof RegExp?t:new RegExp(tw(t),"g"),e.replace(t,r)}var rw={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}},nw=rw;const Mt=St(nw);var iw=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,_=1,x,y,v=function(){i>=a&&(x=r,y=i,r=n,n=x,i=a,a=y,o=!0,l=i+1)},O=function(k,S,P){return{x:k,y:S,k:P}},R=function(k,S){return{elem:k,t:S}},b=function(k,S,P){var $,j,M;for(S>P?$=c[k-1+l]:$=c[k+1+l],M=Math.max(S,P),j=M-k;j<i&&M<a&&r[j]===n[M];)++j,++M;return c[k+l]=u.length,u[u.length]=new O(j,M,$),M},C=function(k){var S,P,$;for(S=P=0,$=k.length-1;$>=0;--$)for(;S<k[$].x||P<k[$].y;)k[$].y-k[$].x>P-S?(o?d[d.length]=new R(n[P],m):d[d.length]=new R(n[P],_),++P):k[$].y-k[$].x<P-S?(o?d[d.length]=new R(r[S],_):d[d.length]=new R(r[S],m),++S):(d[d.length]=new R(r[S],g),p+=r[S],++S,++P)};return v(),{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,P,$,j,M,H,Y;for(k=a-i,S=i+a+3,P={},H=0;H<S;++H)P[H]=-1,c[H]=-1;$=-1;do{for(++$,Y=-$;Y<=k-1;++Y)P[Y+l]=b(Y,P[Y-1+l]+1,P[Y+1+l]);for(Y=k+$;Y>=k+1;--Y)P[Y+l]=b(Y,P[Y-1+l]+1,P[Y+1+l]);P[k+l]=b(k,P[k-1+l]+1,P[k+1+l])}while(P[k+l]!==a);for(s=k+2*$,j=c[k+l],M=[];j!==-1;)M[M.length]=new O(u[j].x,u[j].y,null),j=u[j].k;C(M)}}},aw=iw;function ow(e,t){var r=new aw(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 yu(e,t){for(var r=[],n=e.length,i=t.length,a=ow(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 sw(e,t,r){var n,i=yu(t,e),a=yu(t,r),o=[];function s(H,Y){o.push([H.file1[0],Y,H.file1[1],H.file2[0],H.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(H,Y){return H[0]-Y[0]});var l=[],c=0;function u(H){H>c&&(l.push([1,c,H-c]),c=H)}for(var d=0;d<o.length;d++){for(var p=d,m=o[d],g=m[0],_=g+m[2];d<o.length-1;){var x=o[d+1],y=x[0];if(y>_)break;_=Math.max(_,y+x[2]),d++}if(u(g),p==d)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var v={0:[e.length,-1,t.length,-1],2:[r.length,-1,t.length,-1]};for(n=p;n<=d;n++){m=o[n];var O=m[1],R=v[O],b=m[0],C=b+m[2],k=m[3],S=k+m[4];R[0]=Math.min(k,R[0]),R[1]=Math.max(S,R[1]),R[2]=Math.min(b,R[2]),R[3]=Math.max(C,R[3])}var P=v[0][0]+(g-v[0][2]),$=v[0][1]+(_-v[0][3]),j=v[2][0]+(g-v[2][2]),M=v[2][1]+(_-v[2][3]);l.push([-1,P,$-P,g,_-g,j,M-j])}c=_}return u(t.length),l}function cw(e,t,r){var n=[],i=[e,t,r],a=sw(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],_=m[5],x=0;x<m[2];x++)if(e[x+g]!=r[x+_])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 lw=cw;const uw=St(lw);class ge 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 ge(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 Xn extends ge{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=Xn.code,this.data={filepaths:t}}}Xn.code="UnmergedPathsError";class ce extends ge{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=ce.code,this.data={message:t}}}ce.code="InternalError";class Qr extends ge{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 Xi(e,t){return-(e<t)||+(e>t)}function bu(e,t){return Xi(e.path,t.path)}function _u(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 vu(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]=vu(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[n,i]=vu(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:_u(e.mode%Ft),uid:e.uid%Ft,gid:e.gid%Ft,size:e.size>-1?e.size%Ft:0}}function fw(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 hw()),Mo?xu(e):dw(e)}function dw(e){return new $c().update(e).digest("hex")}async function xu(e){const t=await crypto.subtle.digest("SHA-1",e);return fw(t)}async function hw(){try{if(await xu(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function pw(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function mw(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 ce("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(t.length===0)throw new ce("Index file is empty (.git/index)");const r=new Ar,n=new Lt(t),i=n.toString("utf8",4);if(i!=="DIRC")throw new ce(`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 ce(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);const s=n.readUInt32BE();if(s!==2)throw new ce(`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=pw(d);const p=t.indexOf(0,n.tell()+1)-n.tell();if(p<1)throw new ce(`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 ce(`Expected 1-8 null characters but got '${g}' after ${u.path}`);if(n.eof())throw new ce("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(bu)}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
+ `)}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(mw(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 Zi(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 ww(){return{map:new Map,stats:new Map}}async function gw(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 yw(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:Zi(n,i)}class Ge{static async acquire({fs:t,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[tn]||(n[tn]=ww());const o=`${r}/index`;Lo===null&&(Lo=new Pn({maxPending:1/0}));let s,l=[];return await Lo.acquire(o,async()=>{await yw(t,o,n[tn])&&await gw(t,o,n[tn]);const c=n[tn].map.get(o);if(l=c.unmergedPaths,l.length&&!i)throw new Xn(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 Eu(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 bw(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 ce(`Unexpected GitTree entry mode: ${e.toString(8)}`)}class _w{constructor({fs:t,gitdir:r,cache:n}){this.treePromise=Ge.acquire({fs:t,gitdir:r,cache:n},async function(a){return Eu(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(Xi),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":bw(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 _w({fs:t,gitdir:r,cache:n})}}),Object.freeze(e),e}class Oe extends ge{constructor(t){super(`Could not find ${t}.`),this.code=this.name=Oe.code,this.data={what:t}}}Oe.code="NotFoundError";class rt extends ge{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 ge{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 Zn extends ge{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=Zn.code,this.data={remote:t}}}Zn.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 ce("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 xw=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:xw}},Ew=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,Sw=/^[A-Za-z0-9-.]+$/,kw=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,Rw=/^[A-Za-z][A-Za-z-]*$/,Ow=/^(.*?)( *[#;].*)$/,Cw=e=>{const t=Ew.exec(e);if(t!=null){const[r,n]=t.slice(1);return[r,n]}return null},Tw=e=>{const t=kw.exec(e);if(t!=null){const[r,n="true"]=t.slice(1),i=Pw(n),a=Aw(i);return[r,a]}return null},Pw=e=>{const t=Ow.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,Aw=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)}},$w=(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=Cw(s),c=l!=null;if(c)[r,n]=l;else{const d=Tw(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=$w(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(Sw.test(i)&&Rw.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(`
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 ce("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 xw=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}`)},Su={core:{filemode:Vn,bare:Vn,logallrefupdates:Vn,symlinks:Vn,ignorecase:Vn,bigFileThreshold:xw}},Ew=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,Sw=/^[A-Za-z0-9-.]+$/,kw=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,Rw=/^[A-Za-z][A-Za-z-]*$/,Ow=/^(.*?)( *[#;].*)$/,Cw=e=>{const t=Ew.exec(e);if(t!=null){const[r,n]=t.slice(1);return[r,n]}return null},Tw=e=>{const t=kw.exec(e);if(t!=null){const[r,n="true"]=t.slice(1),i=Pw(n),a=Aw(i);return[r,a]}return null},Pw=e=>{const t=Ow.exec(e);if(t==null)return e;const[r,n]=t.slice(1);return ku(r)&&ku(n)?`${r}${n}`:r},ku=e=>(e.match(/(?:^|[^\\])"/g)||[]).length%2!==0,Aw=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},""),Ru=e=>e!=null?e.toLowerCase():null,Uo=(e,t,r)=>[Ru(e),t,Ru(r)].filter(n=>n!=null).join("."),Ou=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)}},$w=(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=Cw(s),c=l!=null;if(c)[r,n]=l;else{const d=Tw(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=Ou(t).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:o,value:s})=>{const l=Su[a]&&Su[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}=Ou(t),c=$w(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(Sw.test(i)&&Rw.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
18
  `)}}class Le{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 Pn),Wo.acquire(e,t)}class U{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 Le.get({fs:t,gitdir:r});if(!s){if(s=await u.getall(`remote.${n}.fetch`),s.length===0)throw new Zn(n);s.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}const d=Fo.from(s),p=new Map;if(c){const x=await U.listRefs({fs:t,gitdir:r,filepath:"refs/tags"});await U.deleteRefs({fs:t,gitdir:r,refs:x.map(y=>`refs/tags/${y}`)})}if(o){for(const x of i.keys())if(x.startsWith("refs/tags")&&!x.endsWith("^{}")&&!await U.exists({fs:t,gitdir:r,ref:x})){const y=i.get(x);p.set(x,y)}}const m=d.translate([...i.keys()]);for(const[x,y]of m){const v=i.get(x);p.set(y,v)}const g=d.translate([...a.keys()]);for(const[x,y]of g){const v=a.get(x),O=d.translateOne(v);O&&p.set(y,`ref: ${O}`)}const _=[];if(l){for(const x of d.localNamespaces()){const y=(await U.listRefs({fs:t,gitdir:r,filepath:x})).map(v=>`${x}/${v}`);for(const v of y)p.has(v)||_.push(v)}_.length>0&&await U.deleteRefs({fs:t,gitdir:r,refs:_})}for(const[x,y]of p)await ur(x,async()=>t.write(N.join(r,x),`${y.trim()}
19
19
  `,"utf8"));return{pruned:_}}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 U.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),U.resolve({fs:t,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;const a=await U.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 U.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 U.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 U.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),U.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 U.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=U.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?U.listRefs({fs:t,gitdir:r,filepath:`refs/remotes/${n}`}):U.listRefs({fs:t,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:r}){return(await U.listRefs({fs:t,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}}function Iw(e,t){return Xi(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 ce(`Unexpected GitTree entry mode: ${e}`)}function jw(e){const t=[];let r=0;for(;r<e.length;){const n=e.indexOf(32,r);if(n===-1)throw new ce(`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 ce(`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 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 ce(`Could not understand file mode: ${e}`)}function zw(e){return!e.oid&&e.sha&&(e.oid=e.sha),e.mode=Bw(e.mode),e.type||(e.type=Ou(e.mode)),e}class ct{constructor(t){if(Buffer.isBuffer(t))this._entries=jw(t);else if(Array.isArray(t))this._entries=t.map(zw);else throw new ce("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(Iw),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 ce(`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 Nw(e,t){const r=new Lt(e),n=Tu(r);if(n!==t.byteLength)throw new ce(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${t.length} bytes`);const i=Tu(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 ce(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function Tu(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 Au(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 Mw(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function $u(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:Mw(e)}class Du{constructor(t){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=$u(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>Lw(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 Lw(e){return e.reduce((t,r)=>t+r.length,0)}async function Fw(e,t){const r=new Du(e);let n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new ce(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ce(`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 Uw(r),d=new Do.Inflate;for(;!d.result;){const p=await r.chunk();if(!p)break;if(d.push(p,!1),d.err)throw new ce(`Pako error: ${d.msg}`);if(d.result){if(d.result.length!==l)throw new ce("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 Uw(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 Do.inflate(e)}function Hw(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 Ww(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 ce(`Unable to read version ${a} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new ce("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");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 Fw([t],async({data:x,type:y,reference:v,offset:O,num:R})=>{u===null&&(u=R);const b=Math.floor((u-R)*100/u);b!==d&&n&&await n({phase:"Receiving objects",loaded:u-R,total:u}),d=b,y=i[y],["commit","tree","blob","tag"].includes(y)?a[O]={type:y,offset:O}:y==="ofs-delta"?a[O]={type:y,offset:O}:y==="ref-delta"&&(a[O]={type:y,offset:O})});const p=Object.keys(a).map(Number);for(const[x,y]of p.entries()){const v=x+1===p.length?t.byteLength-20:p[x+1],O=a[y],R=Lp.buf(t.slice(y,v))>>>0;O.end=v,O.crc=R}const m=new on({pack:Promise.resolve(t),packfileSha:o,crcs:l,hashes:s,offsets:c,getExternalRefDelta:r});d=null;let g=0;const _=[0,0,0,0,0,0,0,0,0,0,0,0];for(let x in a){x=Number(x);const y=Math.floor(g*100/u);y!==d&&n&&await n({phase:"Resolving deltas",loaded:g,total:u}),g++,d=y;const v=a[x];if(!v.oid)try{m.readDepth=0,m.externalReadDepth=0;const{type:O,object:R}=await m.readSlice({start:x});_[m.readDepth]+=1;const b=await Vt(an.wrap({type:O,object:R}));v.oid=b,s.push(b),c.set(b,x),l[b]=v.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 ce(`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 ce("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 ce("Unrecognized type: 0b"+o.toString(2));const l=a&15;let c=l;a&128&&(c=Ww(i,l));let d=null,p=null;if(s==="ofs_delta"){const g=Hw(i),_=t-g;({object:d,type:s}=await this.readSlice({start:_}))}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 ce(`Packfile told us object would have length ${c} but it had length ${p.byteLength}`);return d&&(p=Buffer.from(Nw(p,d))),this.readDepth>3&&(this.offsetCache[t]={type:s,object:p}),{type:s,format:"content",object:p}}}const ta=Symbol("PackfileCache");async function Gw({fs:e,filename:t,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){const a=await e.read(t);return on.fromIdx({idx:a,getExternalRefDelta:r})}function Go({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=Gw({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 Go({fs:e,cache:t,filename:l,getExternalRefDelta:a});if(c.error)throw new ce(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 $e({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=u=>$e({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 ce(`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 ce(`invalid requested format "${i}"`)}class Ot extends ge{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 ge{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 ge{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 ge{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 ge{constructor(){super("Empty response from git server."),this.code=this.name=ei.code,this.data={}}}ei.code="EmptyServerResponseError";class ti extends ge{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=ti.code,this.data={}}}ti.code="FastForwardError";class ri extends ge{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 ge{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 ge{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 ge{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 ge{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 ge{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=cn.code,this.data={}}}cn.code="MergeNotSupportedError";class ln extends ge{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 Ke extends ge{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=Ke.code,this.data={role:t}}}Ke.code="MissingNameError";class lt extends ge{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 ge{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 $r extends ge{constructor(t,r){super(`Expected "${t}" but received "${r}".`),this.code=this.name=$r.code,this.data={expected:t,actual:r}}}$r.code="ParseError";class un extends ge{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 ge{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 ge{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 ge{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 ge{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=si.code,this.data={url:t}}}si.code="UrlParseError";class fn extends ge{constructor(){super("The operation was canceled."),this.code=this.name=fn.code,this.data={}}}fn.code="UserCanceledError";class ci extends ge{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 ge{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 Yw=Object.freeze({__proto__:null,AlreadyExistsError:Ot,AmbiguousError:Kn,CheckoutConflictError:Jn,CommitNotFetchedError:Qn,EmptyServerResponseError:ei,FastForwardError:ti,GitPushError:ri,HttpError:sn,InternalError:ce,InvalidFilepathError:fr,InvalidOidError:lr,InvalidRefNameError:Ct,MaxDepthError:ni,MergeNotSupportedError:cn,MergeConflictError:ln,MissingNameError:Ke,MissingParameterError:lt,MultipleGitError:ii,NoRefspecError:Zn,NotFoundError:Oe,ObjectTypeError:rt,ParseError:$r,PushRejectedError:un,RemoteCapabilityError:dr,SmartHttpError:ai,UnknownTransportError:oi,UnsafeFilepathError:Qr,UrlParseError:si,UserCanceledError:fn,UnmergedPathsError:Xn,IndexResetError:ci,NoCommitError:li});function qo({name:e,email:t,timestamp:r,timezoneOffset:n}){return n=Xw(n),`${e} <${t}> ${r} ${n}`}function Xw(e){const t=Zw(Vw(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 Vw(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 U.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),U.resolve({fs:t,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;const a=await U.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 U.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 U.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 U.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),U.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 U.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=U.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?U.listRefs({fs:t,gitdir:r,filepath:`refs/remotes/${n}`}):U.listRefs({fs:t,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:r}){return(await U.listRefs({fs:t,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}}function Iw(e,t){return Xi(Cu(e),Cu(t))}function Cu(e){return e.mode==="040000"?e.path+"/":e.path}function Tu(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 ce(`Unexpected GitTree entry mode: ${e}`)}function jw(e){const t=[];let r=0;for(;r<e.length;){const n=e.indexOf(32,r);if(n===-1)throw new ce(`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 ce(`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=Tu(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 ce(`Could not understand file mode: ${e}`)}function zw(e){return!e.oid&&e.sha&&(e.oid=e.sha),e.mode=Bw(e.mode),e.type||(e.type=Tu(e.mode)),e}class ct{constructor(t){if(Buffer.isBuffer(t))this._entries=jw(t);else if(Array.isArray(t))this._entries=t.map(zw);else throw new ce("invalid type passed to GitTree constructor");this._entries.sort(bu)}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(Iw),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 ce(`Length mismatch: expected ${a} bytes but got ${o} instead.`);return{type:i,object:Buffer.from(t.slice(n+1))}}}async function Pu({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 Nw(e,t){const r=new Lt(e),n=Au(r);if(n!==t.byteLength)throw new ce(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${t.length} bytes`);const i=Au(r);let a;const o=Du(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(Du(r,t));const l=s.tell();if(i!==l)throw new ce(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function Au(e){let t=0,r=0,n=null;do n=e.readUInt8(),t|=(n&127)<<r,r+=7;while(n&128);return t}function $u(e,t,r){let n=0,i=0;for(;r--;)t&1&&(n|=e.readUInt8()<<i),t>>=1,i+=8;return n}function Du(e,t){const r=e.readUInt8(),n=128,i=15,a=112;if(r&n){const o=$u(e,r&i,4);let s=$u(e,(r&a)>>4,3);return s===0&&(s=65536),t.slice(o,o+s)}else return e.slice(r)}function Mw(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function Iu(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:Mw(e)}class ju{constructor(t){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=Iu(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>Lw(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 Lw(e){return e.reduce((t,r)=>t+r.length,0)}async function Fw(e,t){const r=new ju(e);let n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new ce(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ce(`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 Uw(r),d=new Do.Inflate;for(;!d.result;){const p=await r.chunk();if(!p)break;if(d.push(p,!1),d.err)throw new ce(`Pako error: ${d.msg}`);if(d.result){if(d.result.length!==l)throw new ce("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 Uw(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 Bu(e){return Do.inflate(e)}function Hw(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 Ww(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 ce(`Unable to read version ${a} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new ce("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");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 Fw([t],async({data:x,type:y,reference:v,offset:O,num:R})=>{u===null&&(u=R);const b=Math.floor((u-R)*100/u);b!==d&&n&&await n({phase:"Receiving objects",loaded:u-R,total:u}),d=b,y=i[y],["commit","tree","blob","tag"].includes(y)?a[O]={type:y,offset:O}:y==="ofs-delta"?a[O]={type:y,offset:O}:y==="ref-delta"&&(a[O]={type:y,offset:O})});const p=Object.keys(a).map(Number);for(const[x,y]of p.entries()){const v=x+1===p.length?t.byteLength-20:p[x+1],O=a[y],R=Lp.buf(t.slice(y,v))>>>0;O.end=v,O.crc=R}const m=new on({pack:Promise.resolve(t),packfileSha:o,crcs:l,hashes:s,offsets:c,getExternalRefDelta:r});d=null;let g=0;const _=[0,0,0,0,0,0,0,0,0,0,0,0];for(let x in a){x=Number(x);const y=Math.floor(g*100/u);y!==d&&n&&await n({phase:"Resolving deltas",loaded:g,total:u}),g++,d=y;const v=a[x];if(!v.oid)try{m.readDepth=0,m.externalReadDepth=0;const{type:O,object:R}=await m.readSlice({start:x});_[m.readDepth]+=1;const b=await Vt(an.wrap({type:O,object:R}));v.oid=b,s.push(b),c.set(b,x),l[b]=v.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 ce(`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 ce("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 ce("Unrecognized type: 0b"+o.toString(2));const l=a&15;let c=l;a&128&&(c=Ww(i,l));let d=null,p=null;if(s==="ofs_delta"){const g=Hw(i),_=t-g;({object:d,type:s}=await this.readSlice({start:_}))}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 Bu(m)),p.byteLength!==c)throw new ce(`Packfile told us object would have length ${c} but it had length ${p.byteLength}`);return d&&(p=Buffer.from(Nw(p,d))),this.readDepth>3&&(this.offsetCache[t]={type:s,object:p}),{type:s,format:"content",object:p}}}const ta=Symbol("PackfileCache");async function Gw({fs:e,filename:t,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){const a=await e.read(t);return on.fromIdx({idx:a,getExternalRefDelta:r})}function Go({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=Gw({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 Go({fs:e,cache:t,filename:l,getExternalRefDelta:a});if(c.error)throw new ce(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 $e({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=u=>$e({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 Pu({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 Bu(o.object)),o.format="wrapped"),i==="wrapped"))return o;const s=await Vt(o.object);if(s!==n)throw new ce(`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 ce(`invalid requested format "${i}"`)}class Ot extends ge{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 ge{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 ge{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 ge{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 ge{constructor(){super("Empty response from git server."),this.code=this.name=ei.code,this.data={}}}ei.code="EmptyServerResponseError";class ti extends ge{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=ti.code,this.data={}}}ti.code="FastForwardError";class ri extends ge{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 ge{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 ge{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 ge{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 ge{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 ge{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=cn.code,this.data={}}}cn.code="MergeNotSupportedError";class ln extends ge{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 Ke extends ge{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=Ke.code,this.data={role:t}}}Ke.code="MissingNameError";class lt extends ge{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 ge{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 $r extends ge{constructor(t,r){super(`Expected "${t}" but received "${r}".`),this.code=this.name=$r.code,this.data={expected:t,actual:r}}}$r.code="ParseError";class un extends ge{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 ge{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 ge{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 ge{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 ge{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=si.code,this.data={url:t}}}si.code="UrlParseError";class fn extends ge{constructor(){super("The operation was canceled."),this.code=this.name=fn.code,this.data={}}}fn.code="UserCanceledError";class ci extends ge{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 ge{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 Yw=Object.freeze({__proto__:null,AlreadyExistsError:Ot,AmbiguousError:Kn,CheckoutConflictError:Jn,CommitNotFetchedError:Qn,EmptyServerResponseError:ei,FastForwardError:ti,GitPushError:ri,HttpError:sn,InternalError:ce,InvalidFilepathError:fr,InvalidOidError:lr,InvalidRefNameError:Ct,MaxDepthError:ni,MergeNotSupportedError:cn,MergeConflictError:ln,MissingNameError:Ke,MissingParameterError:lt,MultipleGitError:ii,NoRefspecError:Zn,NotFoundError:Oe,ObjectTypeError:rt,ParseError:$r,PushRejectedError:un,RemoteCapabilityError:dr,SmartHttpError:ai,UnknownTransportError:oi,UnsafeFilepathError:Qr,UrlParseError:si,UserCanceledError:fn,UnmergedPathsError:Xn,IndexResetError:ci,NoCommitError:li});function qo({name:e,email:t,timestamp:r,timezoneOffset:n}){return n=Xw(n),`${e} <${t}> ${r} ${n}`}function Xw(e){const t=Zw(Vw(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 Vw(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:Kw(i)}}function Kw(e){let[,t,r,n]=e.match(/(\+|-)(\d\d)(\d\d)/);return n=(t==="+"?1:-1)*(Number(r)*60+Number(n)),Jw(n)}function Jw(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 ce("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 Qw(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:ct.from([]),oid:n};const{type:i,object:a}=await $e({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 eg{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 U.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 $e({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 $e({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 eg({fs:r,gitdir:n,ref:e,cache:i})}}),Object.freeze(t),t}class tg{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 Le.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 Ge.acquire({fs:r,gitdir:n,cache:i},async function(o){const s=o.entriesMap.get(t._fullpath),l=await t.stat(),u=await(await Le.get({fs:r,gitdir:n})).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;!s||Zi(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)&&Zi(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 tg({fs:t,dir:r,gitdir:n,cache:i})}}),Object.freeze(e),e}function rg(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 ng{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*ig(e){const t=new ng;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=rg(0,l.length),d=async m=>{u.map(x=>{m[x]=m[x]&&new l[x].ConstructEntry(m[x])});const _=(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:ig(_)}},p=async m=>{const{entries:g,children:_}=await d(m),x=g.find(v=>v&&v._fullpath)._fullpath,y=await a(x,g);if(y!==null){let v=await s(p,_);return v=v.filter(O=>O!==void 0),o(y,v)}};return p(c)}async function Xo(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()?Xo(e,i):e.rm(i)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function ag(e){return og(e)&&Bu(e.then)&&Bu(e.catch)}function og(e){return e&&typeof e=="object"}function Bu(e){return typeof e=="function"}function zu(e){return ag((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=Xo.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=Xo.bind(null,e)}class J{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(Xi),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 T(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 sg({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n="HEAD",cache:i={}}){try{T("fs",e),T("dir",t),T("gitdir",r);const a=new J(e),o=[xt({ref:n}),ui(),nn()];let s=[];await Ge.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),_=!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(_)return!1;throw new ci(c)}});await Ge.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=ew().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 cg({fs:e,gitdir:t,object:r,format:n,oid:i}){if(n!=="deflated")throw new ce("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 Zo=null;async function Lu(e){return Zo===null&&(Zo=ug()),Zo?lg(e):Do.deflate(e)}async function lg(e){const t=new CompressionStream("deflate"),r=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}function ug(){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 cg({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 fg({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={},force:a=!1,parallel:o=!0}){try{T("fs",e),T("dir",t),T("gitdir",r),T("filepath",n);const s=new J(e);await Ge.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(_=>Vo({dir:e,gitdir:t,fs:r,filepath:[N.join(d,_)],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 Le.get({fs:r,gitdir:t})).get("core.autocrlf"),_=p.isSymbolicLink()?await r.readlink(N.join(e,d)).then(Fu):await r.read(N.join(e,d),{autocrlf:g});if(_===null)throw new Oe(d);const x=await ut({fs:r,gitdir:t,type:"blob",object:_});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 Le.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 $e({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 U.resolve({fs:e,gitdir:n,ref:"HEAD",depth:2}));let _,x;try{_=await U.resolve({fs:e,gitdir:n,ref:d}),x=await mn({fs:e,gitdir:n,oid:_,cache:{}})}catch{g=!0}if(l&&g)throw new li(d);const y=l?await pr({fs:e,gitdir:n,author:a,commit:x.commit}):await pr({fs:e,gitdir:n,author:a});if(!y)throw new Ke("author");const v=l?await pn({fs:e,gitdir:n,author:y,committer:o,commit:x.commit}):await pn({fs:e,gitdir:n,author:y,committer:o});if(!v)throw new Ke("committer");return Ge.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async function(O){const b=vu(O.entries).get(".");if(m||(m=await Wu({fs:e,gitdir:n,inode:b,dryRun:c})),p?p=await Promise.all(p.map(S=>U.resolve({fs:e,gitdir:n,ref:S}))):l?p=x.commit.parent:p=_?[_]:[],!i)if(l)i=x.commit.message;else throw new lt("message");let C=De.from({tree:m,parent:p,author:y,committer:v,message:i});s&&(C=await De.sign(C,r,s));const k=await ut({fs:e,gitdir:n,type:"commit",object:C.toObject(),dryRun:c});return!u&&!c&&await U.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 Gu({fs:e,cache:t,gitdir:r,tree:s,pathArray:l,oid:a,filepath:i})}return n}async function Gu({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 $e({fs:e,cache:t,gitdir:r,oid:l.oid});if(c!=="tree")throw new rt(a,c,"tree",o);return n=ct.from(u),Gu({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 dg({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 U.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 _=await hi({fs:e,gitdir:n,tree:m});return await ia({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:_,parent:d&&[d],message:`Note added by 'isomorphic-git addNote'
66
- `,author:l,committer:c,signingKey:u})}async function hg({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{T("fs",e),T("gitdir",n),T("oid",a),T("note",o),u&&T("onSign",t);const p=new J(e),m=await pr({fs:p,gitdir:n,author:l});if(!m)throw new Ke("author");const g=await pn({fs:p,gitdir:n,author:m,committer:c});if(!g)throw new Ke("committer");return await dg({fs:new J(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 Le.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 Le.save({fs:e,gitdir:t,config:a})}async function pg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n,url:i,force:a=!1}){try{return T("fs",e),T("gitdir",r),T("remote",n),T("url",i),await qu({fs:new J(e),gitdir:r,remote:n,url:i,force:a})}catch(o){throw o.caller="git.addRemote",o}}async function mg({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 U.exists({fs:e,gitdir:n,ref:i}))throw new Ot("tag",i);const d=await U.resolve({fs:e,gitdir:n,ref:l||"HEAD"}),{type:p}=await $e({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 U.writeRef({fs:e,gitdir:n,ref:i,value:g})}async function wg({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{T("fs",e),T("gitdir",n),T("ref",i),c&&T("onSign",t);const p=new J(e),m=await pr({fs:p,gitdir:n,author:a});if(!m)throw new Ke("tagger");return await mg({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 gg({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 U.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",r,!1);let s;try{s=await U.resolve({fs:e,gitdir:t,ref:n||"HEAD"})}catch{}s&&await U.writeRef({fs:e,gitdir:t,ref:o,value:s}),i&&await U.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function yg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,checkout:a=!1,force:o=!1}){try{return T("fs",e),T("gitdir",r),T("ref",n),await gg({fs:new J(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 U.resolve({fs:e,gitdir:a,ref:"HEAD"})}catch{g="0000000000000000000000000000000000000000"}let _;try{_=await U.resolve({fs:e,gitdir:a,ref:s})}catch(x){if(s==="HEAD")throw x;const y=`${o}/${s}`;if(_=await U.resolve({fs:e,gitdir:a,ref:y}),m){const v=await Le.get({fs:e,gitdir:a});await v.set(`branch.${s}.remote`,o),await v.set(`branch.${s}.merge`,`refs/heads/${s}`),await Le.save({fs:e,gitdir:a,config:v})}await U.writeRef({fs:e,gitdir:a,ref:`refs/heads/${s}`,value:_})}if(!c){let x;try{x=await bg({fs:e,cache:t,onProgress:r,dir:i,gitdir:a,ref:s,force:p,filepaths:l})}catch(b){throw b instanceof Oe&&b.data.what===_?new Qn(s,_):b}const y=x.filter(([b])=>b==="conflict").map(([b,C])=>C);if(y.length>0)throw new Jn(y);const v=x.filter(([b])=>b==="error").map(([b,C])=>C);if(v.length>0)throw new ce(v.join(", "));if(d){n&&await n({previousHead:g,newHead:_,type:l!=null&&l.length>0?"file":"branch"});return}let O=0;const R=x.length;await Ge.acquire({fs:e,gitdir:a,cache:t},async function(b){await Promise.all(x.filter(([C])=>C==="delete"||C==="delete-index").map(async function([C,k]){const S=`${i}/${k}`;C==="delete"&&await e.rm(S),b.delete({filepath:k}),r&&await r({phase:"Updating workdir",loaded:++O,total:R})}))}),await Ge.acquire({fs:e,gitdir:a,cache:t},async function(b){for(const[C,k]of x)if(C==="rmdir"||C==="rmdir-index"){const S=`${i}/${k}`;try{C==="rmdir-index"&&b.delete({filepath:k}),await e.rmdir(S),r&&await r({phase:"Updating workdir",loaded:++O,total:R})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${k} because directory is not empty`);else throw P}}}),await Promise.all(x.filter(([b])=>b==="mkdir"||b==="mkdir-index").map(async function([b,C]){const k=`${i}/${C}`;await e.mkdir(k),r&&await r({phase:"Updating workdir",loaded:++O,total:R})})),await Ge.acquire({fs:e,gitdir:a,cache:t},async function(b){await Promise.all(x.filter(([C])=>C==="create"||C==="create-index"||C==="update"||C==="mkdir-index").map(async function([C,k,S,P,$]){const j=`${i}/${k}`;try{if(C!=="create-index"&&C!=="mkdir-index"){const{object:H}=await $e({fs:e,cache:t,gitdir:a,oid:S});if($&&await e.rm(j),P===33188)await e.write(j,H);else if(P===33261)await e.write(j,H,{mode:511});else if(P===40960)await e.writelink(j,H);else throw new ce(`Invalid mode 0o${P.toString(8)} detected in blob ${S}`)}const M=await e.lstat(j);P===33261&&(M.mode=493),C==="mkdir-index"&&(M.mode=57344),b.insert({filepath:k,stats:M,oid:S}),r&&await r({phase:"Updating workdir",loaded:++O,total:R})}catch(M){console.log(M)}}))}),n&&await n({previousHead:g,newHead:_,type:l!=null&&l.length>0?"file":"branch"})}if(!u){const x=await U.expand({fs:e,gitdir:a,ref:s});x.startsWith("refs/heads")?await U.writeSymbolicRef({fs:e,gitdir:a,ref:"HEAD",value:x}):await U.writeRef({fs:e,gitdir:a,ref:"HEAD",value:_})}}async function bg({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 Xu({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{T("fs",e),T("dir",n),T("gitdir",i);const g=o||"HEAD";return await Ko({fs:new J(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 _g=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Dr(e){const t=_g.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 U.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2});if(n)try{await U.resolve({fs:e,gitdir:t,ref:i})}catch{return}if(i.startsWith("refs/"))return r?i:Dr(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=$u(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 Fe{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 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=Fe.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 $r(`# 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 $r(`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=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}=Vu(l);const m=o?Qu(o,d):d;(p.username||p.password)&&(c.Authorization=Zu(p)),u===2&&(c["Git-Protocol"]="version=2");let g,_,x=!1;do if(g=await t.request({onProgress:r,method:"GET",url:`${m}/info/refs?service=${s}`,headers:c}),_=!1,g.statusCode===401||g.statusCode===203){const y=x?a:n;if(y){if(p=await y(d,{...p,headers:{...c}}),p&&p.cancel)throw new fn;p&&(ef(c,p),x=!0,_=!0)}}else g.statusCode===200&&x&&i&&await i(d,p);while(_);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:v,data:O}=await es(g);try{const R=await Ju([O],{service:s});return R.auth=p,R}catch{throw new ai(y,v)}}}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 xg({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=xg({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 Pn);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 $e({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 eg{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 U.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 $e({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=_u(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 $e({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 eg({fs:r,gitdir:n,ref:e,cache:i})}}),Object.freeze(t),t}class tg{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 Le.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 Ge.acquire({fs:r,gitdir:n,cache:i},async function(o){const s=o.entriesMap.get(t._fullpath),l=await t.stat(),u=await(await Le.get({fs:r,gitdir:n})).get("core.filemode"),d=typeof process<"u"?process.platform!=="win32":!0;!s||Zi(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)&&Zi(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 tg({fs:t,dir:r,gitdir:n,cache:i})}}),Object.freeze(e),e}function rg(e,t){const r=t-e;return Array.from({length:r},(n,i)=>e+i)}const zu=typeof Array.prototype.flat>"u"?e=>e.reduce((t,r)=>t.concat(r),[]):e=>e.flat();class ng{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*ig(e){const t=new ng;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=zu(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=rg(0,l.length),d=async m=>{u.map(x=>{m[x]=m[x]&&new l[x].ConstructEntry(m[x])});const _=(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:ig(_)}},p=async m=>{const{entries:g,children:_}=await d(m),x=g.find(v=>v&&v._fullpath)._fullpath,y=await a(x,g);if(y!==null){let v=await s(p,_);return v=v.filter(O=>O!==void 0),o(y,v)}};return p(c)}async function Xo(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()?Xo(e,i):e.rm(i)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function ag(e){return og(e)&&Nu(e.then)&&Nu(e.catch)}function og(e){return e&&typeof e=="object"}function Nu(e){return typeof e=="function"}function Mu(e){return ag((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(e))}const Lu=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function Fu(e,t){if(Mu(t))for(const r of Lu)e[`_${r}`]=t[r].bind(t);else for(const r of Lu)e[`_${r}`]=Io(t[r].bind(t));Mu(t)?t.rm?e._rm=t.rm.bind(t):t.rmdir.length>1?e._rm=t.rmdir.bind(t):e._rm=Xo.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=Xo.bind(null,e)}class J{constructor(t){if(typeof t._original_unwrapped_fs<"u")return t;const r=Object.getOwnPropertyDescriptor(t,"promises");r&&r.enumerable?Fu(this,t.promises):Fu(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(Xi),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 T(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 sg({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n="HEAD",cache:i={}}){try{T("fs",e),T("dir",t),T("gitdir",r);const a=new J(e),o=[xt({ref:n}),ui(),nn()];let s=[];await Ge.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),_=!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(_)return!1;throw new ci(c)}});await Ge.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=ew().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 cg({fs:e,gitdir:t,object:r,format:n,oid:i}){if(n!=="deflated")throw new ce("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 Zo=null;async function Uu(e){return Zo===null&&(Zo=ug()),Zo?lg(e):Do.deflate(e)}async function lg(e){const t=new CompressionStream("deflate"),r=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}function ug(){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 Uu(n))),o||await cg({fs:e,gitdir:t,object:n,format:"deflated",oid:a}),a}function Hu(e){let t;for(;~(t=e.indexOf(92));)e[t]=47;return e}async function fg({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={},force:a=!1,parallel:o=!0}){try{T("fs",e),T("dir",t),T("gitdir",r),T("filepath",n);const s=new J(e);await Ge.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(_=>Vo({dir:e,gitdir:t,fs:r,filepath:[N.join(d,_)],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 Le.get({fs:r,gitdir:t})).get("core.autocrlf"),_=p.isSymbolicLink()?await r.readlink(N.join(e,d)).then(Hu):await r.read(N.join(e,d),{autocrlf:g});if(_===null)throw new Oe(d);const x=await ut({fs:r,gitdir:t,type:"blob",object:_});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 Le.get({fs:e,gitdir:t})).get(r)}function Wu(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=Wu({},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=Wu({},o,i?i.committer:void 0,r,n);if(s.name!==void 0)return s}async function Gu({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await $e({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,Gu({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 Gu({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 U.resolve({fs:e,gitdir:n,ref:"HEAD",depth:2}));let _,x;try{_=await U.resolve({fs:e,gitdir:n,ref:d}),x=await mn({fs:e,gitdir:n,oid:_,cache:{}})}catch{g=!0}if(l&&g)throw new li(d);const y=l?await pr({fs:e,gitdir:n,author:a,commit:x.commit}):await pr({fs:e,gitdir:n,author:a});if(!y)throw new Ke("author");const v=l?await pn({fs:e,gitdir:n,author:y,committer:o,commit:x.commit}):await pn({fs:e,gitdir:n,author:y,committer:o});if(!v)throw new Ke("committer");return Ge.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async function(O){const b=Eu(O.entries).get(".");if(m||(m=await qu({fs:e,gitdir:n,inode:b,dryRun:c})),p?p=await Promise.all(p.map(S=>U.resolve({fs:e,gitdir:n,ref:S}))):l?p=x.commit.parent:p=_?[_]:[],!i)if(l)i=x.commit.message;else throw new lt("message");let C=De.from({tree:m,parent:p,author:y,committer:v,message:i});s&&(C=await De.sign(C,r,s));const k=await ut({fs:e,gitdir:n,type:"commit",object:C.toObject(),dryRun:c});return!u&&!c&&await U.writeRef({fs:e,gitdir:n,ref:d,value:k}),k})}async function qu({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 qu({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 Yu({fs:e,cache:t,gitdir:r,tree:s,pathArray:l,oid:a,filepath:i})}return n}async function Yu({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 $e({fs:e,cache:t,gitdir:r,oid:l.oid});if(c!=="tree")throw new rt(a,c,"tree",o);return n=ct.from(u),Yu({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 dg({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 U.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 _=await hi({fs:e,gitdir:n,tree:m});return await ia({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:_,parent:d&&[d],message:`Note added by 'isomorphic-git addNote'
66
+ `,author:l,committer:c,signingKey:u})}async function hg({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{T("fs",e),T("gitdir",n),T("oid",a),T("note",o),u&&T("onSign",t);const p=new J(e),m=await pr({fs:p,gitdir:n,author:l});if(!m)throw new Ke("author");const g=await pn({fs:p,gitdir:n,author:m,committer:c});if(!g)throw new Ke("committer");return await dg({fs:new J(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 Xu({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 Le.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 Le.save({fs:e,gitdir:t,config:a})}async function pg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n,url:i,force:a=!1}){try{return T("fs",e),T("gitdir",r),T("remote",n),T("url",i),await Xu({fs:new J(e),gitdir:r,remote:n,url:i,force:a})}catch(o){throw o.caller="git.addRemote",o}}async function mg({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 U.exists({fs:e,gitdir:n,ref:i}))throw new Ot("tag",i);const d=await U.resolve({fs:e,gitdir:n,ref:l||"HEAD"}),{type:p}=await $e({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 U.writeRef({fs:e,gitdir:n,ref:i,value:g})}async function wg({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{T("fs",e),T("gitdir",n),T("ref",i),c&&T("onSign",t);const p=new J(e),m=await pr({fs:p,gitdir:n,author:a});if(!m)throw new Ke("tagger");return await mg({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 gg({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 U.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",r,!1);let s;try{s=await U.resolve({fs:e,gitdir:t,ref:n||"HEAD"})}catch{}s&&await U.writeRef({fs:e,gitdir:t,ref:o,value:s}),i&&await U.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function yg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,checkout:a=!1,force:o=!1}){try{return T("fs",e),T("gitdir",r),T("ref",n),await gg({fs:new J(e),gitdir:r,ref:n,object:i,checkout:a,force:o})}catch(s){throw s.caller="git.branch",s}}const Zu=(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 U.resolve({fs:e,gitdir:a,ref:"HEAD"})}catch{g="0000000000000000000000000000000000000000"}let _;try{_=await U.resolve({fs:e,gitdir:a,ref:s})}catch(x){if(s==="HEAD")throw x;const y=`${o}/${s}`;if(_=await U.resolve({fs:e,gitdir:a,ref:y}),m){const v=await Le.get({fs:e,gitdir:a});await v.set(`branch.${s}.remote`,o),await v.set(`branch.${s}.merge`,`refs/heads/${s}`),await Le.save({fs:e,gitdir:a,config:v})}await U.writeRef({fs:e,gitdir:a,ref:`refs/heads/${s}`,value:_})}if(!c){let x;try{x=await bg({fs:e,cache:t,onProgress:r,dir:i,gitdir:a,ref:s,force:p,filepaths:l})}catch(b){throw b instanceof Oe&&b.data.what===_?new Qn(s,_):b}const y=x.filter(([b])=>b==="conflict").map(([b,C])=>C);if(y.length>0)throw new Jn(y);const v=x.filter(([b])=>b==="error").map(([b,C])=>C);if(v.length>0)throw new ce(v.join(", "));if(d){n&&await n({previousHead:g,newHead:_,type:l!=null&&l.length>0?"file":"branch"});return}let O=0;const R=x.length;await Ge.acquire({fs:e,gitdir:a,cache:t},async function(b){await Promise.all(x.filter(([C])=>C==="delete"||C==="delete-index").map(async function([C,k]){const S=`${i}/${k}`;C==="delete"&&await e.rm(S),b.delete({filepath:k}),r&&await r({phase:"Updating workdir",loaded:++O,total:R})}))}),await Ge.acquire({fs:e,gitdir:a,cache:t},async function(b){for(const[C,k]of x)if(C==="rmdir"||C==="rmdir-index"){const S=`${i}/${k}`;try{C==="rmdir-index"&&b.delete({filepath:k}),await e.rmdir(S),r&&await r({phase:"Updating workdir",loaded:++O,total:R})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${k} because directory is not empty`);else throw P}}}),await Promise.all(x.filter(([b])=>b==="mkdir"||b==="mkdir-index").map(async function([b,C]){const k=`${i}/${C}`;await e.mkdir(k),r&&await r({phase:"Updating workdir",loaded:++O,total:R})})),await Ge.acquire({fs:e,gitdir:a,cache:t},async function(b){await Promise.all(x.filter(([C])=>C==="create"||C==="create-index"||C==="update"||C==="mkdir-index").map(async function([C,k,S,P,$]){const j=`${i}/${k}`;try{if(C!=="create-index"&&C!=="mkdir-index"){const{object:H}=await $e({fs:e,cache:t,gitdir:a,oid:S});if($&&await e.rm(j),P===33188)await e.write(j,H);else if(P===33261)await e.write(j,H,{mode:511});else if(P===40960)await e.writelink(j,H);else throw new ce(`Invalid mode 0o${P.toString(8)} detected in blob ${S}`)}const M=await e.lstat(j);P===33261&&(M.mode=493),C==="mkdir-index"&&(M.mode=57344),b.insert({filepath:k,stats:M,oid:S}),r&&await r({phase:"Updating workdir",loaded:++O,total:R})}catch(M){console.log(M)}}))}),n&&await n({previousHead:g,newHead:_,type:l!=null&&l.length>0?"file":"branch"})}if(!u){const x=await U.expand({fs:e,gitdir:a,ref:s});x.startsWith("refs/heads")?await U.writeSymbolicRef({fs:e,gitdir:a,ref:"HEAD",value:x}):await U.writeRef({fs:e,gitdir:a,ref:"HEAD",value:_})}}async function bg({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=>Zu(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=zu(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function Vu({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{T("fs",e),T("dir",n),T("gitdir",i);const g=o||"HEAD";return await Ko({fs:new J(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 _g=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Dr(e){const t=_g.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 U.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2});if(n)try{await U.resolve({fs:e,gitdir:t,ref:i})}catch{return}if(i.startsWith("refs/"))return r?i:Dr(i)}function vg(e){return e=e.replace(/^git@([^:]+):/,"https://$1/"),e=e.replace(/^ssh:\/\//,"https://"),e}function Ku({username:e="",password:t=""}){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}async function pi(e,t){const r=Iu(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 Ju(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 Fe{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 ju(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 Qu(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 ef(e,{service:t}){const r=new Set,n=new Map,i=new Map,a=Fe.streamReader(e);let o=await a();for(;o===null;)o=await a();if(o===!0)throw new ei;if(o.includes("version 2"))return Qu(a);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${t}`)throw new $r(`# 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 Qu(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 $r(`Two strings separated by '${r}'`,e.toString("utf8"));return n}const tf=(e,t)=>e.endsWith("?")?`${e}${t}`:`${e}/${t.replace(/^https?:\/\//,"")}`,rf=(e,t)=>{(t.username||t.password)&&(e.Authorization=Ku(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}=Ju(l);const m=o?tf(o,d):d;(p.username||p.password)&&(c.Authorization=Ku(p)),u===2&&(c["Git-Protocol"]="version=2");let g,_,x=!1;do if(g=await t.request({onProgress:r,method:"GET",url:`${m}/info/refs?service=${s}`,headers:c}),_=!1,g.statusCode===401||g.statusCode===203){const y=x?a:n;if(y){if(p=await y(d,{...p,headers:{...c}}),p&&p.cancel)throw new fn;p&&(rf(c,p),x=!0,_=!0)}}else g.statusCode===200&&x&&i&&await i(d,p);while(_);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 ef(g.body,{service:s});return y.auth=p,y}else{const{preview:y,response:v,data:O}=await es(g);try{const R=await ef([O],{service:s});return R.auth=p,R}catch{throw new ai(y,v)}}}static async connect({http:t,onProgress:r,corsProxy:n,service:i,url:a,auth:o,body:s,headers:l}){const c=Ju(a);c&&(a=c.url),n&&(a=tf(n,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,rf(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 xg({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=xg({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 Pn);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 Pn);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 Eg({fs:e,gitdir:t,oid:r}){const n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return e.exists(`${t}/${n}`)}async function Sg({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 Go({fs:e,cache:t,filename:s,getExternalRefDelta:i});if(l.error)throw new ce(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=>$e({fs:e,cache:t,gitdir:r,oid:s});let o=await Eg({fs:e,gitdir:r,oid:n});return o||(o=await Sg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a})),o}function kg(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 Rg(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=Rg(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=Fe.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 Og(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 Cg({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(Fe.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 Eg({fs:e,gitdir:t,oid:r}){const n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return e.exists(`${t}/${n}`)}async function Sg({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 Go({fs:e,cache:t,filename:s,getExternalRefDelta:i});if(l.error)throw new ce(l.error);if(l.offsets.has(n))return!0}return!1}async function nf({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){const a=s=>$e({fs:e,cache:t,gitdir:r,oid:s});let o=await Eg({fs:e,gitdir:r,oid:n});return o||(o=await Sg({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a})),o}function kg(e){const i="5041434b"+"00000002"+"00000000";return e.slice(0,12).toString("hex")===i}function af(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 Rg(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 of(e){const t=new la;let r="";return(async()=>(await pi(e,n=>{for(n=n.toString("utf8"),r+=n;;){const i=Rg(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 sf{static demux(t){const r=Fe.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 Og(e){const{packetlines:t,packfile:r,progress:n}=sf.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 Cg({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(Fe.encode(`want ${c}${l}
71
71
  `)),l="";for(const c of n)s.push(Fe.encode(`shallow ${c}
72
72
  `));i!==null&&s.push(Fe.encode(`deepen ${i}
73
73
  `)),a!==null&&s.push(Fe.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}
74
74
  `));for(const c of o)s.push(Fe.encode(`deepen-not ${c}
75
75
  `));s.push(Fe.flush());for(const c of r)s.push(Fe.encode(`have ${c}
76
76
  `));return s.push(Fe.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:_=null,exclude:x=[],relative:y=!1,tags:v=!1,singleBranch:O=!1,headers:R={},prune:b=!1,pruneTags:C=!1}){const k=c||await mr({fs:e,gitdir:l,test:!0}),S=await Le.get({fs:e,gitdir:l}),P=d||k&&await S.get(`branch.${k}.remote`)||"origin",$=p||await S.get(`remote.${P}.url`);if(typeof $>"u")throw new lt("remote OR url");const j=u||k&&await S.get(`branch.${k}.merge`)||c||"HEAD";m===void 0&&(m=await S.get("http.corsProxy"));const M=sa.getRemoteHelperFor({url:$}),H=await M.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:m,service:"git-upload-pack",url:$,headers:R,protocolVersion:1}),Y=H.auth,de=H.refs;if(de.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(g!==null&&!H.capabilities.has("shallow"))throw new dr("shallow","depth");if(_!==null&&!H.capabilities.has("deepen-since"))throw new dr("deepen-since","since");if(x.length>0&&!H.capabilities.has("deepen-not"))throw new dr("deepen-not","exclude");if(y===!0&&!H.capabilities.has("deepen-relative"))throw new dr("deepen-relative","relative");const{oid:Ce,fullref:le}=U.resolveAgainstMap({ref:j,map:de});for(const L of de.keys())L===le||L==="HEAD"||L.startsWith("refs/heads/")||v&&L.startsWith("refs/tags/")||de.delete(L);const be=rf([...H.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${ca.agent}`]);y&&be.push("deepen-relative");const Ue=O?[Ce]:de.values(),Be=O?[k]:await U.listRefs({fs:e,gitdir:l,filepath:"refs"});let oe=[];for(let L of Be)try{L=await U.expand({fs:e,gitdir:l,ref:L});const V=await U.resolve({fs:e,gitdir:l,ref:L});await tf({fs:e,cache:t,gitdir:l,oid:V})&&oe.push(V)}catch{}oe=[...new Set(oe)];const F=await mi.read({fs:e,gitdir:l}),G=H.capabilities.has("shallow")?[...F]:[],W=Cg({capabilities:be,wants:Ue,haves:oe,shallows:G,depth:g,since:_,exclude:x}),te=Buffer.from(await aa(W)),I=await M.connect({http:r,onProgress:n,corsProxy:m,service:"git-upload-pack",url:$,auth:Y,body:[te],headers:R}),ee=await Og(I.body);I.headers&&(ee.headers=I.headers);for(const L of ee.shallows)if(!F.has(L))try{const{object:V}=await $e({fs:e,cache:t,gitdir:l,oid:L}),re=new De(V),Q=await Promise.all(re.headers().parent.map(ne=>tf({fs:e,cache:t,gitdir:l,oid:ne})));Q.length===0||Q.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}),O){const L=new Map([[le,Ce]]),V=new Map;let re=10,Q=le;for(;re--;){const ie=H.symrefs.get(Q);if(ie===void 0)break;V.set(Q,ie),Q=ie}const ue=de.get(Q);ue&&L.set(Q,ue);const{pruned:ne}=await U.updateRemoteRefs({fs:e,gitdir:l,remote:P,refs:L,symrefs:V,tags:v,prune:b});b&&(ee.pruned=ne)}else{const{pruned:L}=await U.updateRemoteRefs({fs:e,gitdir:l,remote:P,refs:de,symrefs:H.symrefs,tags:v,prune:b,pruneTags:C});b&&(ee.pruned=L)}if(ee.HEAD=H.symrefs.get("HEAD"),ee.HEAD===void 0){const{oid:L}=U.resolveAgainstMap({ref:"HEAD",map:de});for(const[V,re]of de.entries())if(V!=="HEAD"&&re===L){ee.HEAD=V;break}}const D=le.startsWith("refs/tags")?"tag":"branch";if(ee.FETCH_HEAD={oid:Ce,description:`${D} '${Dr(le)}' of ${$}`},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 q=Buffer.from(await aa(ee.packfile));if(I.body.error)throw I.body.error;const Z=q.slice(-20).toString("hex"),X={defaultBranch:ee.HEAD,fetchHead:ee.FETCH_HEAD.oid,fetchHeadDescription:ee.FETCH_HEAD.description};if(ee.headers&&(X.headers=ee.headers),b&&(X.pruned=ee.pruned),Z!==""&&!kg(q)){X.packfile=`objects/pack/pack-${Z}.pack`;const L=N.join(l,X.packfile);await e.write(L,q);const V=Q=>$e({fs:e,cache:t,gitdir:l,oid:Q}),re=await on.fromPack({pack:q,getExternalRefDelta:V,onProgress:n});await e.write(L.replace(/\.pack$/,".idx"),await re.toBuffer())}return X}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]
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:_=null,exclude:x=[],relative:y=!1,tags:v=!1,singleBranch:O=!1,headers:R={},prune:b=!1,pruneTags:C=!1}){const k=c||await mr({fs:e,gitdir:l,test:!0}),S=await Le.get({fs:e,gitdir:l}),P=d||k&&await S.get(`branch.${k}.remote`)||"origin",$=p||await S.get(`remote.${P}.url`);if(typeof $>"u")throw new lt("remote OR url");const j=u||k&&await S.get(`branch.${k}.merge`)||c||"HEAD";m===void 0&&(m=await S.get("http.corsProxy"));const M=sa.getRemoteHelperFor({url:$}),H=await M.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:m,service:"git-upload-pack",url:$,headers:R,protocolVersion:1}),Y=H.auth,de=H.refs;if(de.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(g!==null&&!H.capabilities.has("shallow"))throw new dr("shallow","depth");if(_!==null&&!H.capabilities.has("deepen-since"))throw new dr("deepen-since","since");if(x.length>0&&!H.capabilities.has("deepen-not"))throw new dr("deepen-not","exclude");if(y===!0&&!H.capabilities.has("deepen-relative"))throw new dr("deepen-relative","relative");const{oid:Ce,fullref:le}=U.resolveAgainstMap({ref:j,map:de});for(const L of de.keys())L===le||L==="HEAD"||L.startsWith("refs/heads/")||v&&L.startsWith("refs/tags/")||de.delete(L);const _e=af([...H.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${ca.agent}`]);y&&_e.push("deepen-relative");const Ue=O?[Ce]:de.values(),Be=O?[k]:await U.listRefs({fs:e,gitdir:l,filepath:"refs"});let oe=[];for(let L of Be)try{L=await U.expand({fs:e,gitdir:l,ref:L});const V=await U.resolve({fs:e,gitdir:l,ref:L});await nf({fs:e,cache:t,gitdir:l,oid:V})&&oe.push(V)}catch{}oe=[...new Set(oe)];const F=await mi.read({fs:e,gitdir:l}),G=H.capabilities.has("shallow")?[...F]:[],W=Cg({capabilities:_e,wants:Ue,haves:oe,shallows:G,depth:g,since:_,exclude:x}),te=Buffer.from(await aa(W)),I=await M.connect({http:r,onProgress:n,corsProxy:m,service:"git-upload-pack",url:$,auth:Y,body:[te],headers:R}),ee=await Og(I.body);I.headers&&(ee.headers=I.headers);for(const L of ee.shallows)if(!F.has(L))try{const{object:V}=await $e({fs:e,cache:t,gitdir:l,oid:L}),re=new De(V),Q=await Promise.all(re.headers().parent.map(ne=>nf({fs:e,cache:t,gitdir:l,oid:ne})));Q.length===0||Q.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}),O){const L=new Map([[le,Ce]]),V=new Map;let re=10,Q=le;for(;re--;){const ie=H.symrefs.get(Q);if(ie===void 0)break;V.set(Q,ie),Q=ie}const ue=de.get(Q);ue&&L.set(Q,ue);const{pruned:ne}=await U.updateRemoteRefs({fs:e,gitdir:l,remote:P,refs:L,symrefs:V,tags:v,prune:b});b&&(ee.pruned=ne)}else{const{pruned:L}=await U.updateRemoteRefs({fs:e,gitdir:l,remote:P,refs:de,symrefs:H.symrefs,tags:v,prune:b,pruneTags:C});b&&(ee.pruned=L)}if(ee.HEAD=H.symrefs.get("HEAD"),ee.HEAD===void 0){const{oid:L}=U.resolveAgainstMap({ref:"HEAD",map:de});for(const[V,re]of de.entries())if(V!=="HEAD"&&re===L){ee.HEAD=V;break}}const D=le.startsWith("refs/tags")?"tag":"branch";if(ee.FETCH_HEAD={oid:Ce,description:`${D} '${Dr(le)}' of ${$}`},n||i){const L=of(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 q=Buffer.from(await aa(ee.packfile));if(I.body.error)throw I.body.error;const Z=q.slice(-20).toString("hex"),X={defaultBranch:ee.HEAD,fetchHead:ee.FETCH_HEAD.oid,fetchHeadDescription:ee.FETCH_HEAD.description};if(ee.headers&&(X.headers=ee.headers),b&&(X.pruned=ee.pruned),Z!==""&&!kg(q)){X.packfile=`objects/pack/pack-${Z}.pack`;const L=N.join(l,X.packfile);await e.write(L,q);const V=Q=>$e({fs:e,cache:t,gitdir:l,oid:Q}),re=await on.fromPack({pack:q,getExternalRefDelta:V,onProgress:n});await e.write(L.replace(/\.pack$/,".idx"),await re.toBuffer())}return X}async function cf({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,42 +82,42 @@ 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 Tg({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:_,since:x,exclude:y,relative:v,singleBranch:O,noCheckout:R,noTags:b,headers:C}){try{if(await of({fs:e,gitdir:u}),await qu({fs:e,gitdir:u,remote:g,url:d,force:!1}),p){const P=await Le.get({fs:e,gitdir:u});await P.set("http.corsProxy",p),await Le.save({fs:e,gitdir:u,config:P})}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:_,since:x,exclude:y,relative:v,singleBranch:O,headers:C,tags:!b});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:R})}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:_=void 0,exclude:x=[],relative:y=!1,singleBranch:v=!1,noCheckout:O=!1,noTags:R=!1,headers:b={},cache:C={}}){try{return T("fs",e),T("http",t),T("gitdir",c),O||T("dir",l),T("url",u),await Tg({fs:new J(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:_,exclude:x,relative:y,singleBranch:v,noCheckout:O,noTags:R,headers:b})}catch(k){throw k.caller="git.clone",k}}async function Ag({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{T("fs",e),l||T("message",i),s&&T("onSign",t);const _=new J(e);return await ia({fs:_,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(_){throw _.caller="git.commit",_}}async function $g({fs:e,dir:t,gitdir:r=N.join(t,".git"),fullname:n=!1,test:i=!1}){try{return T("fs",e),T("gitdir",r),await mr({fs:new J(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 U.exists({fs:e,gitdir:t,ref:r}))throw new Oe(r);const i=await U.expand({fs:e,gitdir:t,ref:r}),a=await mr({fs:e,gitdir:t,fullname:!0});if(i===a){const l=await U.resolve({fs:e,gitdir:t,ref:i});await U.writeRef({fs:e,gitdir:t,ref:"HEAD",value:l})}await U.deleteRef({fs:e,gitdir:t,ref:i});const o=Dr(r),s=await Le.get({fs:e,gitdir:t});await s.deleteSection("branch",o),await Le.save({fs:e,gitdir:t,config:s})}async function Ig({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return T("fs",e),T("ref",n),await Dg({fs:new J(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function jg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{T("fs",e),T("ref",n),await U.deleteRef({fs:new J(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 Le.get({fs:e,gitdir:t});await n.deleteSection("remote",r),await Le.save({fs:e,gitdir:t,config:n})}async function zg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return T("fs",e),T("remote",n),await Bg({fs:new J(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function Ng({fs:e,gitdir:t,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await U.deleteRef({fs:e,gitdir:t,ref:r})}async function Mg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return T("fs",e),T("ref",n),await Ng({fs:new J(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function Lg({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 Fg({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 Go({fs:e,cache:t,filename:l,getExternalRefDelta:i});if(c.error)throw new ce(c.error);for(const u of c.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function Ug({fs:e,cache:t,gitdir:r,oid:n}){const i=s=>$e({fs:e,cache:t,gitdir:r,oid:s}),a=await Lg({fs:e,gitdir:r,oid:n}),o=await Fg({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 Hg({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await Ug({fs:new J(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function Wg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return T("fs",e),T("gitdir",r),T("ref",n),await U.expand({fs:new J(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 $e({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 Gg({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=uw(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 Tg({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:_,since:x,exclude:y,relative:v,singleBranch:O,noCheckout:R,noTags:b,headers:C}){try{if(await cf({fs:e,gitdir:u}),await Xu({fs:e,gitdir:u,remote:g,url:d,force:!1}),p){const P=await Le.get({fs:e,gitdir:u});await P.set("http.corsProxy",p),await Le.save({fs:e,gitdir:u,config:P})}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:_,since:x,exclude:y,relative:v,singleBranch:O,headers:C,tags:!b});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:R})}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:_=void 0,exclude:x=[],relative:y=!1,singleBranch:v=!1,noCheckout:O=!1,noTags:R=!1,headers:b={},cache:C={}}){try{return T("fs",e),T("http",t),T("gitdir",c),O||T("dir",l),T("url",u),await Tg({fs:new J(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:_,exclude:x,relative:y,singleBranch:v,noCheckout:O,noTags:R,headers:b})}catch(k){throw k.caller="git.clone",k}}async function Ag({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{T("fs",e),l||T("message",i),s&&T("onSign",t);const _=new J(e);return await ia({fs:_,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(_){throw _.caller="git.commit",_}}async function $g({fs:e,dir:t,gitdir:r=N.join(t,".git"),fullname:n=!1,test:i=!1}){try{return T("fs",e),T("gitdir",r),await mr({fs:new J(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 U.exists({fs:e,gitdir:t,ref:r}))throw new Oe(r);const i=await U.expand({fs:e,gitdir:t,ref:r}),a=await mr({fs:e,gitdir:t,fullname:!0});if(i===a){const l=await U.resolve({fs:e,gitdir:t,ref:i});await U.writeRef({fs:e,gitdir:t,ref:"HEAD",value:l})}await U.deleteRef({fs:e,gitdir:t,ref:i});const o=Dr(r),s=await Le.get({fs:e,gitdir:t});await s.deleteSection("branch",o),await Le.save({fs:e,gitdir:t,config:s})}async function Ig({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return T("fs",e),T("ref",n),await Dg({fs:new J(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function jg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{T("fs",e),T("ref",n),await U.deleteRef({fs:new J(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 Le.get({fs:e,gitdir:t});await n.deleteSection("remote",r),await Le.save({fs:e,gitdir:t,config:n})}async function zg({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return T("fs",e),T("remote",n),await Bg({fs:new J(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function Ng({fs:e,gitdir:t,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await U.deleteRef({fs:e,gitdir:t,ref:r})}async function Mg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return T("fs",e),T("ref",n),await Ng({fs:new J(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function Lg({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 Fg({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 Go({fs:e,cache:t,filename:l,getExternalRefDelta:i});if(c.error)throw new ce(c.error);for(const u of c.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function Ug({fs:e,cache:t,gitdir:r,oid:n}){const i=s=>$e({fs:e,cache:t,gitdir:r,oid:s}),a=await Lg({fs:e,gitdir:r,oid:n}),o=await Fg({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 Hg({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await Ug({fs:new J(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function Wg({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n}){try{return T("fs",e),T("gitdir",r),T("ref",n),await U.expand({fs:new J(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 $e({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 Gg({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=uw(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}),_=xt({ref:o}),x=xt({ref:s}),y=[],v=[],O=[],R=[],b=await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[g,_,x],map:async function(C,[k,S,P]){const $=Vi(C),j=await na(k,S),M=await na(P,S);switch(`${j}-${M}`){case"false-false":return{mode:await S.mode(),path:$,oid:await S.oid(),type:await S.type()};case"false-true":return P?{mode:await P.mode(),path:$,oid:await P.oid(),type:await P.type()}:void 0;case"true-false":return k?{mode:await k.mode(),path:$,oid:await k.oid(),type:await k.type()}:void 0;case"true-true":{if(k&&S&&P&&await k.type()==="blob"&&await S.type()==="blob"&&await P.type()==="blob")return Yg({fs:e,gitdir:n,path:$,ours:k,base:S,theirs:P,ourName:l,baseName:c,theirName:u,mergeDriver:m}).then(async H=>{if(H.cleanMerge)p||i.insert({filepath:C,oid:H.mergeResult.oid,stage:0});else if(y.push(C),v.push(C),!p){const Y=await S.oid(),de=await k.oid(),Ce=await P.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:Y,stage:1}),i.insert({filepath:C,oid:de,stage:2}),i.insert({filepath:C,oid:Ce,stage:3})}return H.mergeResult});if(S&&!k&&P&&await S.type()==="blob"&&await P.type()==="blob"){if(y.push(C),O.push(C),!p){const H=await S.oid(),Y=await P.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:H,stage:1}),i.insert({filepath:C,oid:Y,stage:3})}return{mode:await P.mode(),oid:await P.oid(),type:"blob",path:$}}if(S&&k&&!P&&await S.type()==="blob"&&await k.type()==="blob"){if(y.push(C),R.push(C),!p){const H=await S.oid(),Y=await k.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:H,stage:1}),i.insert({filepath:C,oid:Y,stage:2})}return{mode:await k.mode(),oid:await k.oid(),type:"blob",path:$}}if(S&&!k&&!P&&await S.type()==="blob")return;throw new cn}}},reduce:y.length!==0&&(!r||p)?void 0:async(C,k)=>{const S=k.filter(Boolean);if(C&&!(C&&C.type==="tree"&&S.length===0)){if(S.length>0){const $=new ct(S).toObject(),j=await ut({fs:e,gitdir:n,type:"tree",object:$,dryRun:d});C.oid=j}return C}}});return y.length!==0?(r&&!p&&await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[xt({ref:b.oid})],map:async function(C,[k]){const S=`${r}/${C}`;if(await k.type()==="blob"){const P=await k.mode(),$=new TextDecoder().decode(await k.content());await e.write(S,$,{mode:P})}return!0}}),new ln(y,v,O,R)):b.oid}async function Yg({fs:e,gitdir:t,path:r,ours:n,base:i,theirs:a,ourName:o,theirName:s,baseName:l,dryRun:c,mergeDriver:u=Gg}){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"),_=Buffer.from(await a.content()).toString("utf8"),{mergedText:x,cleanMerge:y}=await u({branches:[l,o,s],contents:[g,m,_],path:r}),v=await ut({fs:e,gitdir:t,type:"blob",object:Buffer.from(x,"utf8"),dryRun:c});return{cleanMerge:y,mergeResult:{mode:p,path:r,oid:v,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:_,mergeDriver:x}){i===void 0&&(i=await mr({fs:e,gitdir:n,fullname:!0})),i=await U.expand({fs:e,gitdir:n,ref:i}),a=await U.expand({fs:e,gitdir:n,ref:a});const y=await U.resolve({fs:e,gitdir:n,ref:i}),v=await U.resolve({fs:e,gitdir:n,ref:a}),O=await rs({fs:e,cache:t,gitdir:n,oids:[y,v]});if(O.length!==1)throw new cn;const R=O[0];if(R===v)return{oid:y,alreadyMerged:!0};if(o&&R===y)return!l&&!c&&await U.writeRef({fs:e,gitdir:n,ref:i,value:v}),{oid:v,fastForward:!0};{if(s)throw new ti;const b=await Ge.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:v,baseOid:R,ourName:Dr(i),baseName:"base",theirName:Dr(a),dryRun:l,abortOnConflict:u,mergeDriver:x}));if(b instanceof ln)throw b;return d||(d=`Merge branch '${Dr(a)}' into ${Dr(i)}`),{oid:await ia({fs:e,cache:t,gitdir:n,message:d,ref:i,tree:b,parent:[y,v],author:p,committer:m,signingKey:g,onSign:_,dryRun:l,noUpdateBranch:c}),tree:b,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:_,fastForward:x,fastForwardOnly:y,corsProxy:v,singleBranch:O,headers:R,author:b,committer:C,signingKey:k}){try{if(!u){const $=await mr({fs:e,gitdir:c});if(!$)throw new lt("ref");u=$}const{fetchHead:S,fetchHeadDescription:P}=await ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:c,corsProxy:v,ref:u,url:d,remote:p,remoteRef:m,singleBranch:O,headers:R,prune:g,pruneTags:_});await sf({fs:e,cache:t,gitdir:c,ours:u,theirs:S,fastForward:x,fastForwardOnly:y,message:`Merge ${P}`,author:b,committer:C,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 Xg({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:_={},cache:x={}}){try{T("fs",e),T("http",t),T("gitdir",l);const y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await cf({fs:new J(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:_,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:_=null,exclude:x=[],relative:y=!1,tags:v=!1,singleBranch:O=!1,headers:R={},prune:b=!1,pruneTags:C=!1,cache:k={}}){try{return T("fs",e),T("http",t),T("gitdir",l),await ts({fs:new J(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:_,exclude:x,relative:y,tags:v,singleBranch:O,headers:R,prune:b,pruneTags:C})}catch(S){throw S.caller="git.fetch",S}}async function Vg({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oids",n),await rs({fs:new J(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 Kg({fs:e,filepath:t}){try{return T("fs",e),T("filepath",t),await lf({fs:new J(e),filepath:t})}catch(r){throw r.caller="git.findRoot",r}}async function Jg({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return T("fs",e),T("gitdir",r),T("path",n),await fi({fs:new J(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function Qg({fs:e,gitdir:t,path:r}){return(await Le.get({fs:e,gitdir:t})).getall(r)}async function ey({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return T("fs",e),T("gitdir",r),T("path",n),await Qg({fs:new J(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function ty({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1}){try{T("http",e),T("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 _=u;for(const x of m)_[x]=_[x]||{},_=_[x];_[g]=p}for(const[d,p]of c.symrefs){const m=d.split("/"),g=m.pop();let _=u;for(const x of m)_[x]=_[x]||{},_=_[x];_[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 ry({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:l=2}){try{T("http",e),T("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 ny({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 iy({object:e}){try{T("object",e),typeof e=="string"?e=Buffer.from(e,"utf8"):e=Buffer.from(e);const t="blob",{oid:r,object:n}=await ny({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 ay({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=>$e({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 oy({fs:e,onProgress:t,dir:r,gitdir:n=N.join(r,".git"),filepath:i,cache:a={}}){try{return T("fs",e),T("dir",r),T("gitdir",r),T("filepath",i),await ay({fs:new J(e),cache:a,onProgress:t,dir:r,gitdir:n,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function sy({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:N.join(r,".git"),defaultBranch:i="master"}){try{return T("fs",e),T("gitdir",n),t||T("dir",r),await of({fs:new J(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 $e({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 cy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,ancestor:i,depth:a=-1,cache:o={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),T("ancestor",i),await ff({fs:new J(e),cache:o,gitdir:r,oid:n,ancestor:i,depth:a})}catch(s){throw s.caller="git.isDescendent",s}}async function ly({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return T("fs",e),T("dir",t),T("gitdir",r),T("filepath",n),hn.isIgnored({fs:new J(e),dir:t,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function uy({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return T("fs",e),T("gitdir",r),U.listBranches({fs:new J(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function fy({fs:e,gitdir:t,ref:r,cache:n}){if(r){const i=await U.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 Ge.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 dy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),await fy({fs:new J(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function hy({fs:e,cache:t,gitdir:r,ref:n}){let i;try{i=await U.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 py({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return T("fs",e),T("gitdir",r),T("ref",n),await hy({fs:new J(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function my({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return T("fs",e),T("gitdir",r),U.listRefs({fs:new J(e),gitdir:r,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function wy({fs:e,gitdir:t}){const r=await Le.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 gy({fs:e,dir:t,gitdir:r=N.join(t,".git")}){try{return T("fs",e),T("gitdir",r),await wy({fs:new J(e),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function yy(e){const t=Fe.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 by({prefix:e,symrefs:t,peelTags:r}){const n=[];return n.push(Fe.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}),_=xt({ref:o}),x=xt({ref:s}),y=[],v=[],O=[],R=[],b=await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[g,_,x],map:async function(C,[k,S,P]){const $=Vi(C),j=await na(k,S),M=await na(P,S);switch(`${j}-${M}`){case"false-false":return{mode:await S.mode(),path:$,oid:await S.oid(),type:await S.type()};case"false-true":return P?{mode:await P.mode(),path:$,oid:await P.oid(),type:await P.type()}:void 0;case"true-false":return k?{mode:await k.mode(),path:$,oid:await k.oid(),type:await k.type()}:void 0;case"true-true":{if(k&&S&&P&&await k.type()==="blob"&&await S.type()==="blob"&&await P.type()==="blob")return Yg({fs:e,gitdir:n,path:$,ours:k,base:S,theirs:P,ourName:l,baseName:c,theirName:u,mergeDriver:m}).then(async H=>{if(H.cleanMerge)p||i.insert({filepath:C,oid:H.mergeResult.oid,stage:0});else if(y.push(C),v.push(C),!p){const Y=await S.oid(),de=await k.oid(),Ce=await P.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:Y,stage:1}),i.insert({filepath:C,oid:de,stage:2}),i.insert({filepath:C,oid:Ce,stage:3})}return H.mergeResult});if(S&&!k&&P&&await S.type()==="blob"&&await P.type()==="blob"){if(y.push(C),O.push(C),!p){const H=await S.oid(),Y=await P.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:H,stage:1}),i.insert({filepath:C,oid:Y,stage:3})}return{mode:await P.mode(),oid:await P.oid(),type:"blob",path:$}}if(S&&k&&!P&&await S.type()==="blob"&&await k.type()==="blob"){if(y.push(C),R.push(C),!p){const H=await S.oid(),Y=await k.oid();i.delete({filepath:C}),i.insert({filepath:C,oid:H,stage:1}),i.insert({filepath:C,oid:Y,stage:2})}return{mode:await k.mode(),oid:await k.oid(),type:"blob",path:$}}if(S&&!k&&!P&&await S.type()==="blob")return;throw new cn}}},reduce:y.length!==0&&(!r||p)?void 0:async(C,k)=>{const S=k.filter(Boolean);if(C&&!(C&&C.type==="tree"&&S.length===0)){if(S.length>0){const $=new ct(S).toObject(),j=await ut({fs:e,gitdir:n,type:"tree",object:$,dryRun:d});C.oid=j}return C}}});return y.length!==0?(r&&!p&&await hr({fs:e,cache:t,dir:r,gitdir:n,trees:[xt({ref:b.oid})],map:async function(C,[k]){const S=`${r}/${C}`;if(await k.type()==="blob"){const P=await k.mode(),$=new TextDecoder().decode(await k.content());await e.write(S,$,{mode:P})}return!0}}),new ln(y,v,O,R)):b.oid}async function Yg({fs:e,gitdir:t,path:r,ours:n,base:i,theirs:a,ourName:o,theirName:s,baseName:l,dryRun:c,mergeDriver:u=Gg}){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"),_=Buffer.from(await a.content()).toString("utf8"),{mergedText:x,cleanMerge:y}=await u({branches:[l,o,s],contents:[g,m,_],path:r}),v=await ut({fs:e,gitdir:t,type:"blob",object:Buffer.from(x,"utf8"),dryRun:c});return{cleanMerge:y,mergeResult:{mode:p,path:r,oid:v,type:d}}}async function lf({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:_,mergeDriver:x}){i===void 0&&(i=await mr({fs:e,gitdir:n,fullname:!0})),i=await U.expand({fs:e,gitdir:n,ref:i}),a=await U.expand({fs:e,gitdir:n,ref:a});const y=await U.resolve({fs:e,gitdir:n,ref:i}),v=await U.resolve({fs:e,gitdir:n,ref:a}),O=await rs({fs:e,cache:t,gitdir:n,oids:[y,v]});if(O.length!==1)throw new cn;const R=O[0];if(R===v)return{oid:y,alreadyMerged:!0};if(o&&R===y)return!l&&!c&&await U.writeRef({fs:e,gitdir:n,ref:i,value:v}),{oid:v,fastForward:!0};{if(s)throw new ti;const b=await Ge.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:v,baseOid:R,ourName:Dr(i),baseName:"base",theirName:Dr(a),dryRun:l,abortOnConflict:u,mergeDriver:x}));if(b instanceof ln)throw b;return d||(d=`Merge branch '${Dr(a)}' into ${Dr(i)}`),{oid:await ia({fs:e,cache:t,gitdir:n,message:d,ref:i,tree:b,parent:[y,v],author:p,committer:m,signingKey:g,onSign:_,dryRun:l,noUpdateBranch:c}),tree:b,mergeCommit:!0}}}async function uf({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:_,fastForward:x,fastForwardOnly:y,corsProxy:v,singleBranch:O,headers:R,author:b,committer:C,signingKey:k}){try{if(!u){const $=await mr({fs:e,gitdir:c});if(!$)throw new lt("ref");u=$}const{fetchHead:S,fetchHeadDescription:P}=await ts({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:c,corsProxy:v,ref:u,url:d,remote:p,remoteRef:m,singleBranch:O,headers:R,prune:g,pruneTags:_});await lf({fs:e,cache:t,gitdir:c,ours:u,theirs:S,fastForward:x,fastForwardOnly:y,message:`Merge ${P}`,author:b,committer:C,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 Xg({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:_={},cache:x={}}){try{T("fs",e),T("http",t),T("gitdir",l);const y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await uf({fs:new J(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:_,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:_=null,exclude:x=[],relative:y=!1,tags:v=!1,singleBranch:O=!1,headers:R={},prune:b=!1,pruneTags:C=!1,cache:k={}}){try{return T("fs",e),T("http",t),T("gitdir",l),await ts({fs:new J(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:_,exclude:x,relative:y,tags:v,singleBranch:O,headers:R,prune:b,pruneTags:C})}catch(S){throw S.caller="git.fetch",S}}async function Vg({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oids",n),await rs({fs:new J(e),cache:i,gitdir:r,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function ff({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 ff({fs:e,filepath:r})}}async function Kg({fs:e,filepath:t}){try{return T("fs",e),T("filepath",t),await ff({fs:new J(e),filepath:t})}catch(r){throw r.caller="git.findRoot",r}}async function Jg({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return T("fs",e),T("gitdir",r),T("path",n),await fi({fs:new J(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function Qg({fs:e,gitdir:t,path:r}){return(await Le.get({fs:e,gitdir:t})).getall(r)}async function ey({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n}){try{return T("fs",e),T("gitdir",r),T("path",n),await Qg({fs:new J(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function ty({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1}){try{T("http",e),T("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 _=u;for(const x of m)_[x]=_[x]||{},_=_[x];_[g]=p}for(const[d,p]of c.symrefs){const m=d.split("/"),g=m.pop();let _=u;for(const x of m)_[x]=_[x]||{},_=_[x];_[g]=p}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function df(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 ry({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:l=2}){try{T("http",e),T("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:df(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function ny({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 iy({object:e}){try{T("object",e),typeof e=="string"?e=Buffer.from(e,"utf8"):e=Buffer.from(e);const t="blob",{oid:r,object:n}=await ny({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 ay({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=>$e({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 oy({fs:e,onProgress:t,dir:r,gitdir:n=N.join(r,".git"),filepath:i,cache:a={}}){try{return T("fs",e),T("dir",r),T("gitdir",r),T("filepath",i),await ay({fs:new J(e),cache:a,onProgress:t,dir:r,gitdir:n,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function sy({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:N.join(r,".git"),defaultBranch:i="master"}){try{return T("fs",e),T("gitdir",n),t||T("dir",r),await cf({fs:new J(e),bare:t,dir:r,gitdir:n,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function hf({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 $e({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 cy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,ancestor:i,depth:a=-1,cache:o={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),T("ancestor",i),await hf({fs:new J(e),cache:o,gitdir:r,oid:n,ancestor:i,depth:a})}catch(s){throw s.caller="git.isDescendent",s}}async function ly({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return T("fs",e),T("dir",t),T("gitdir",r),T("filepath",n),hn.isIgnored({fs:new J(e),dir:t,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function uy({fs:e,dir:t,gitdir:r=N.join(t,".git"),remote:n}){try{return T("fs",e),T("gitdir",r),U.listBranches({fs:new J(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function fy({fs:e,gitdir:t,ref:r,cache:n}){if(r){const i=await U.resolve({gitdir:t,fs:e,ref:r}),a=[];return await pf({fs:e,cache:n,gitdir:t,oid:i,filenames:a,prefix:""}),a}else return Ge.acquire({fs:e,gitdir:t,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function pf({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 pf({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 dy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),await fy({fs:new J(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function hy({fs:e,cache:t,gitdir:r,ref:n}){let i;try{i=await U.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 py({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return T("fs",e),T("gitdir",r),T("ref",n),await hy({fs:new J(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function my({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n}){try{return T("fs",e),T("gitdir",r),U.listRefs({fs:new J(e),gitdir:r,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function wy({fs:e,gitdir:t}){const r=await Le.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 gy({fs:e,dir:t,gitdir:r=N.join(t,".git")}){try{return T("fs",e),T("gitdir",r),await wy({fs:new J(e),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function yy(e){const t=Fe.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 by({prefix:e,symrefs:t,peelTags:r}){const n=[];return n.push(Fe.encode(`command=ls-refs
89
89
  `)),n.push(Fe.encode(`agent=${ca.agent}
90
- `)),(r||t||e)&&n.push(Fe.delim()),r&&n.push(Fe.encode("peel")),t&&n.push(Fe.encode("symrefs")),e&&n.push(Fe.encode(`ref-prefix ${e}`)),n.push(Fe.flush()),n}async function _y({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{T("http",e),T("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 by({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 yy(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 T("fs",e),T("gitdir",r),U.listTags({fs:new J(e),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function xy(e,t){return e.committer.timestamp-t.committer.timestamp}const Ey="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function hf({fs:e,cache:t,gitdir:r,oid:n,fileId:i}){if(i===Ey)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=$e({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 Sy({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 U.resolve({fs:e,gitdir:r,ref:i}),m=[await mn({fs:e,cache:t,gitdir:r,oid:p})];let g,_,x;function y(v){x&&n&&u.push(v)}for(;m.length>0;){const v=m.pop();if(c!==void 0&&v.commit.committer.timestamp<=c)break;if(n){let O;try{O=await di({fs:e,cache:t,gitdir:r,oid:v.commit.tree,filepath:n}),_&&g!==O&&u.push(_),g=O,_=v,x=!0}catch(R){if(R instanceof Oe){let b=l&&g;if(b&&(b=await hf({fs:e,cache:t,gitdir:r,oid:v.commit.tree,fileId:g}),b))if(Array.isArray(b)){if(_){const C=await hf({fs:e,cache:t,gitdir:r,oid:_.commit.tree,fileId:g});if(Array.isArray(C))if(b=b.filter(k=>C.indexOf(k)===-1),b.length===1)b=b[0],n=b,_&&u.push(_);else{b=!1,_&&u.push(_);break}}}else n=b,_&&u.push(_);if(!b){if(x&&g&&(u.push(_),!s))break;if(!s&&!l)throw R}_=v,x=!1}else throw R}}else u.push(v);if(a!==void 0&&u.length===a){y(v);break}if(!d.has(v.oid))for(const O of v.commit.parent){const R=await mn({fs:e,cache:t,gitdir:r,oid:O});m.map(b=>b.oid).includes(R.oid)||m.push(R)}m.length===0&&y(v),m.sort((O,R)=>xy(O.commit,R.commit))}return u}async function ky({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 T("fs",e),T("gitdir",r),T("ref",i),await Sy({fs:new J(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 Ry({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:_={},mergeDriver:x}){try{T("fs",e),g&&T("onSign",t);const y=new J(e),v=await pr({fs:y,gitdir:n,author:p});if(!v&&(!s||!o))throw new Ke("author");const O=await pn({fs:y,gitdir:n,author:v,committer:m});if(!O&&(!s||!o))throw new Ke("committer");return await sf({fs:y,cache:_,dir:r,gitdir:n,ours:i,theirs:a,fastForward:o,fastForwardOnly:s,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:d,author:v,committer:O,signingKey:g,onSign:t,mergeDriver:x})}catch(y){throw y.caller="git.merge",y}}const Oy={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 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=Oy[u];let m=d.length,g=m>15?128:0;const _=m&15;m=m>>>4;let x=(g|p|_).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 Lu(d)))}s("PACK"),s("00000002","hex"),s(Jo(8,i.length),"hex");for(const u of i){const{type:d,object:p}=await $e({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 Cy({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 Ty({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,write:i=!1,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("oids",n),await Cy({fs:new J(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:_=!0,fastForwardOnly:x=!1,corsProxy:y,singleBranch:v,headers:O={},author:R,committer:b,signingKey:C,cache:k={}}){try{T("fs",e),T("gitdir",l);const S=new J(e),P=await pr({fs:S,gitdir:l,author:R});if(!P)throw new Ke("author");const $=await pn({fs:S,gitdir:l,author:P,committer:b});if(!$)throw new Ke("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:_,fastForwardOnly:x,corsProxy:y,singleBranch:v,headers:O,author:P,committer:$,signingKey:C,prune:m,pruneTags:g})}catch(S){throw S.caller="git.pull",S}}async function Ay({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 U.resolve({fs:e,gitdir:n,ref:d}));for(const d of a)try{const p=await U.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 $e({fs:e,cache:t,gitdir:n,oid:d});if(p==="tag"){const _=nt.from(m).headers().object;return u(_)}if(p!=="commit")throw new rt(d,p,"commit");if(!o.has(d)){const _=De.from(m).headers().parent;for(d of _)!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 $e({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 $y(e){const t={};let r="";const n=Fe.streamReader(e);let i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+`
90
+ `)),(r||t||e)&&n.push(Fe.delim()),r&&n.push(Fe.encode("peel")),t&&n.push(Fe.encode("symrefs")),e&&n.push(Fe.encode(`ref-prefix ${e}`)),n.push(Fe.flush()),n}async function _y({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{T("http",e),T("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 df(p,c,u,d);const m=await by({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 yy(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 T("fs",e),T("gitdir",r),U.listTags({fs:new J(e),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function xy(e,t){return e.committer.timestamp-t.committer.timestamp}const Ey="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function mf({fs:e,cache:t,gitdir:r,oid:n,fileId:i}){if(i===Ey)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 wf({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 wf({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=$e({fs:e,cache:t,gitdir:r,oid:c.oid}).then(function({object:d}){return wf({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 Sy({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 U.resolve({fs:e,gitdir:r,ref:i}),m=[await mn({fs:e,cache:t,gitdir:r,oid:p})];let g,_,x;function y(v){x&&n&&u.push(v)}for(;m.length>0;){const v=m.pop();if(c!==void 0&&v.commit.committer.timestamp<=c)break;if(n){let O;try{O=await di({fs:e,cache:t,gitdir:r,oid:v.commit.tree,filepath:n}),_&&g!==O&&u.push(_),g=O,_=v,x=!0}catch(R){if(R instanceof Oe){let b=l&&g;if(b&&(b=await mf({fs:e,cache:t,gitdir:r,oid:v.commit.tree,fileId:g}),b))if(Array.isArray(b)){if(_){const C=await mf({fs:e,cache:t,gitdir:r,oid:_.commit.tree,fileId:g});if(Array.isArray(C))if(b=b.filter(k=>C.indexOf(k)===-1),b.length===1)b=b[0],n=b,_&&u.push(_);else{b=!1,_&&u.push(_);break}}}else n=b,_&&u.push(_);if(!b){if(x&&g&&(u.push(_),!s))break;if(!s&&!l)throw R}_=v,x=!1}else throw R}}else u.push(v);if(a!==void 0&&u.length===a){y(v);break}if(!d.has(v.oid))for(const O of v.commit.parent){const R=await mn({fs:e,cache:t,gitdir:r,oid:O});m.map(b=>b.oid).includes(R.oid)||m.push(R)}m.length===0&&y(v),m.sort((O,R)=>xy(O.commit,R.commit))}return u}async function ky({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 T("fs",e),T("gitdir",r),T("ref",i),await Sy({fs:new J(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 Ry({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:_={},mergeDriver:x}){try{T("fs",e),g&&T("onSign",t);const y=new J(e),v=await pr({fs:y,gitdir:n,author:p});if(!v&&(!s||!o))throw new Ke("author");const O=await pn({fs:y,gitdir:n,author:v,committer:m});if(!O&&(!s||!o))throw new Ke("committer");return await lf({fs:y,cache:_,dir:r,gitdir:n,ours:i,theirs:a,fastForward:o,fastForwardOnly:s,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:d,author:v,committer:O,signingKey:g,onSign:t,mergeDriver:x})}catch(y){throw y.caller="git.merge",y}}const Oy={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function gf({fs:e,cache:t,dir:r,gitdir:n=N.join(r,".git"),oids:i}){const a=new $c,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=Oy[u];let m=d.length,g=m>15?128:0;const _=m&15;m=m>>>4;let x=(g|p|_).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 Uu(d)))}s("PACK"),s("00000002","hex"),s(Jo(8,i.length),"hex");for(const u of i){const{type:d,object:p}=await $e({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 Cy({fs:e,cache:t,gitdir:r,oids:n,write:i}){const a=await gf({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 Ty({fs:e,dir:t,gitdir:r=N.join(t,".git"),oids:n,write:i=!1,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("oids",n),await Cy({fs:new J(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:_=!0,fastForwardOnly:x=!1,corsProxy:y,singleBranch:v,headers:O={},author:R,committer:b,signingKey:C,cache:k={}}){try{T("fs",e),T("gitdir",l);const S=new J(e),P=await pr({fs:S,gitdir:l,author:R});if(!P)throw new Ke("author");const $=await pn({fs:S,gitdir:l,author:P,committer:b});if(!$)throw new Ke("committer");return await uf({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:_,fastForwardOnly:x,corsProxy:y,singleBranch:v,headers:O,author:P,committer:$,signingKey:C,prune:m,pruneTags:g})}catch(S){throw S.caller="git.pull",S}}async function Ay({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 U.resolve({fs:e,gitdir:n,ref:d}));for(const d of a)try{const p=await U.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 $e({fs:e,cache:t,gitdir:n,oid:d});if(p==="tag"){const _=nt.from(m).headers().object;return u(_)}if(p!=="commit")throw new rt(d,p,"commit");if(!o.has(d)){const _=De.from(m).headers().parent;for(d of _)!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 $e({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 $y(e){const t={};let r="";const n=Fe.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 $r('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(Fe.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
93
- `)),n="";return r.push(Fe.flush()),r}async function Iy({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:_=!1,corsProxy:x,headers:y={}}){const v=u||await mr({fs:e,gitdir:c});if(typeof v>"u")throw new lt("ref");const O=await Le.get({fs:e,gitdir:c});p=p||await O.get(`branch.${v}.pushRemote`)||await O.get("remote.pushDefault")||await O.get(`branch.${v}.remote`)||"origin";const R=m||await O.get(`remote.${p}.pushurl`)||await O.get(`remote.${p}.url`);if(typeof R>"u")throw new lt("remote OR url");const b=d||await O.get(`branch.${v}.merge`);if(typeof R>"u")throw new lt("remoteRef");x===void 0&&(x=await O.get("http.corsProxy"));const C=await U.expand({fs:e,gitdir:c,ref:v}),k=_?"0000000000000000000000000000000000000000":await U.resolve({fs:e,gitdir:c,ref:C}),S=sa.getRemoteHelperFor({url:R}),P=await S.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:x,service:"git-receive-pack",url:R,headers:y,protocolVersion:1}),$=P.auth;let j;if(!b)j=C;else try{j=await U.expandAgainstMap({ref:b,map:P.refs})}catch(F){if(F instanceof Oe)j=b.startsWith("refs/")?b:`refs/heads/${b}`;else throw F}const M=P.refs.get(j)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:p,url:R,localRef:{ref:_?"(delete)":C,oid:k},remoteRef:{ref:j,oid:M}}))throw new fn;const H=!P.capabilities.has("no-thin");let Y=new Set;if(!_){const F=[...P.refs.values()];let G=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);H&&(G=await is({fs:e,cache:t,gitdir:c,oids:W}))}if(!F.includes(k)){const W=await Ay({fs:e,cache:t,gitdir:c,start:[k],finish:F});Y=await is({fs:e,cache:t,gitdir:c,oids:W})}if(H){try{const W=await U.resolve({fs:e,gitdir:c,ref:`refs/remotes/${p}/HEAD`,depth:2}),{oid:te}=await U.resolveAgainstMap({ref:W.replace(`refs/remotes/${p}/`,""),fullref:W,map:P.refs}),I=[te];for(const ee of await is({fs:e,cache:t,gitdir:c,oids:I}))G.add(ee)}catch{}for(const W of G)Y.delete(W)}if(k===M&&(g=!0),!g){if(C.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([...P.capabilities],["report-status","side-band-64k",`agent=${ca.agent}`]),Ce=await Dy({capabilities:de,triplets:[{oldoid:M,oid:k,fullRef:j}]}),le=_?[]:await mf({fs:e,cache:t,gitdir:c,oids:[...Y]}),be=await S.connect({http:r,onProgress:n,corsProxy:x,service:"git-receive-pack",url:R,auth:$,headers:y,body:[...Ce,...le]}),{packfile:Ue,progress:Be}=await af.demux(be.body);if(i){const F=nf(Be);pi(F,async G=>{await i(G)})}const oe=await $y(Ue);if(be.headers&&(oe.headers=be.headers),p&&oe.ok&&oe.refs[j].ok&&!C.startsWith("refs/tags")){const F=`refs/remotes/${p}/${j.replace("refs/heads","")}`;_?await U.deleteRef({fs:e,gitdir:c,ref:F}):await U.writeRef({fs:e,gitdir:c,ref:F,value:k})}if(oe.ok&&Object.values(oe.refs).every(F=>F.ok))return oe;{const F=Object.entries(oe.refs).filter(([G,W])=>!W.ok).map(([G,W])=>`
94
- - ${G}: ${W.error}`).join("");throw new ri(F,oe)}}async function jy({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:_=!1,corsProxy:x,headers:y={},cache:v={}}){try{return T("fs",e),T("http",t),T("gitdir",c),await Iy({fs:new J(e),cache:v,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:_,corsProxy:x,headers:y})}catch(O){throw O.caller="git.push",O}}async function wf({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await $e({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 By({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await gf({fs:new J(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 T("fs",e),T("gitdir",r),T("oid",n),await mn({fs:new J(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function zy({fs:e,cache:t,gitdir:r,ref:n="refs/notes/commits",oid:i}){const a=await U.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 Ny({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("ref",n),T("oid",i),await zy({fs:new J(e),cache:a,gitdir:r,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function My({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{T("fs",e),T("gitdir",r),T("oid",n);const l=new J(e);a!==void 0&&(n=await di({fs:l,cache:s,gitdir:r,oid:n,filepath:a}));const u=await $e({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 Ly({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await $e({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 Fy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await Ly({fs:new J(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function Uy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await wn({fs:new J(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function Hy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{T("fs",e),T("gitdir",r),T("filepath",n),await Ge.acquire({fs:new J(e),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function Wy({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 U.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 Gy({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{T("fs",e),T("gitdir",n),T("oid",a);const u=new J(e),d=await pr({fs:u,gitdir:n,author:o});if(!d)throw new Ke("author");const p=await pn({fs:u,gitdir:n,author:d,committer:s});if(!p)throw new Ke("committer");return await Wy({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 U.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",n,!1);const l=await U.resolve({fs:e,gitdir:t,ref:a,depth:1});await U.writeRef({fs:e,gitdir:t,ref:o,value:l}),await U.deleteRef({fs:e,gitdir:t,ref:a});const u=await mr({fs:e,gitdir:t,fullname:!0})===a;(i||u)&&await U.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function Yy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,oldref:i,checkout:a=!1}){try{return T("fs",e),T("gitdir",r),T("ref",n),T("oldref",i),await qy({fs:new J(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 Xy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,ref:i,cache:a={}}){try{T("fs",e),T("gitdir",r),T("filepath",n);const o=new J(e);let s,l;try{s=await U.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 Ge.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 T("fs",e),T("gitdir",r),T("ref",n),await U.resolve({fs:new J(e),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Vy({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n,value:i,append:a=!1}){try{T("fs",e),T("gitdir",r),T("path",n);const o=new J(e),s=await Le.get({fs:o,gitdir:r});a?await s.append(n,i):await s.set(n,i),await Le.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}
93
+ `)),n="";return r.push(Fe.flush()),r}async function Iy({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:_=!1,corsProxy:x,headers:y={}}){const v=u||await mr({fs:e,gitdir:c});if(typeof v>"u")throw new lt("ref");const O=await Le.get({fs:e,gitdir:c});p=p||await O.get(`branch.${v}.pushRemote`)||await O.get("remote.pushDefault")||await O.get(`branch.${v}.remote`)||"origin";const R=m||await O.get(`remote.${p}.pushurl`)||await O.get(`remote.${p}.url`);if(typeof R>"u")throw new lt("remote OR url");const b=d||await O.get(`branch.${v}.merge`);if(typeof R>"u")throw new lt("remoteRef");x===void 0&&(x=await O.get("http.corsProxy"));const C=await U.expand({fs:e,gitdir:c,ref:v}),k=_?"0000000000000000000000000000000000000000":await U.resolve({fs:e,gitdir:c,ref:C}),S=sa.getRemoteHelperFor({url:R}),P=await S.discover({http:r,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:x,service:"git-receive-pack",url:R,headers:y,protocolVersion:1}),$=P.auth;let j;if(!b)j=C;else try{j=await U.expandAgainstMap({ref:b,map:P.refs})}catch(F){if(F instanceof Oe)j=b.startsWith("refs/")?b:`refs/heads/${b}`;else throw F}const M=P.refs.get(j)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:p,url:R,localRef:{ref:_?"(delete)":C,oid:k},remoteRef:{ref:j,oid:M}}))throw new fn;const H=!P.capabilities.has("no-thin");let Y=new Set;if(!_){const F=[...P.refs.values()];let G=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);H&&(G=await is({fs:e,cache:t,gitdir:c,oids:W}))}if(!F.includes(k)){const W=await Ay({fs:e,cache:t,gitdir:c,start:[k],finish:F});Y=await is({fs:e,cache:t,gitdir:c,oids:W})}if(H){try{const W=await U.resolve({fs:e,gitdir:c,ref:`refs/remotes/${p}/HEAD`,depth:2}),{oid:te}=await U.resolveAgainstMap({ref:W.replace(`refs/remotes/${p}/`,""),fullref:W,map:P.refs}),I=[te];for(const ee of await is({fs:e,cache:t,gitdir:c,oids:I}))G.add(ee)}catch{}for(const W of G)Y.delete(W)}if(k===M&&(g=!0),!g){if(C.startsWith("refs/tags")&&M!=="0000000000000000000000000000000000000000")throw new un("tag-exists");if(k!=="0000000000000000000000000000000000000000"&&M!=="0000000000000000000000000000000000000000"&&!await hf({fs:e,cache:t,gitdir:c,oid:k,ancestor:M,depth:-1}))throw new un("not-fast-forward")}}const de=af([...P.capabilities],["report-status","side-band-64k",`agent=${ca.agent}`]),Ce=await Dy({capabilities:de,triplets:[{oldoid:M,oid:k,fullRef:j}]}),le=_?[]:await gf({fs:e,cache:t,gitdir:c,oids:[...Y]}),_e=await S.connect({http:r,onProgress:n,corsProxy:x,service:"git-receive-pack",url:R,auth:$,headers:y,body:[...Ce,...le]}),{packfile:Ue,progress:Be}=await sf.demux(_e.body);if(i){const F=of(Be);pi(F,async G=>{await i(G)})}const oe=await $y(Ue);if(_e.headers&&(oe.headers=_e.headers),p&&oe.ok&&oe.refs[j].ok&&!C.startsWith("refs/tags")){const F=`refs/remotes/${p}/${j.replace("refs/heads","")}`;_?await U.deleteRef({fs:e,gitdir:c,ref:F}):await U.writeRef({fs:e,gitdir:c,ref:F,value:k})}if(oe.ok&&Object.values(oe.refs).every(F=>F.ok))return oe;{const F=Object.entries(oe.refs).filter(([G,W])=>!W.ok).map(([G,W])=>`
94
+ - ${G}: ${W.error}`).join("");throw new ri(F,oe)}}async function jy({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:_=!1,corsProxy:x,headers:y={},cache:v={}}){try{return T("fs",e),T("http",t),T("gitdir",c),await Iy({fs:new J(e),cache:v,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:_,corsProxy:x,headers:y})}catch(O){throw O.caller="git.push",O}}async function yf({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await $e({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=nt.from(a).parse().object,yf({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 bf({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 yf({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 T("fs",e),T("gitdir",r),T("oid",n),await bf({fs:new J(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function _f({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await mn({fs:new J(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function zy({fs:e,cache:t,gitdir:r,ref:n="refs/notes/commits",oid:i}){const a=await U.resolve({gitdir:r,fs:e,ref:n}),{blob:o}=await bf({fs:e,cache:t,gitdir:r,oid:a,filepath:i});return o}async function Ny({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("ref",n),T("oid",i),await zy({fs:new J(e),cache:a,gitdir:r,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function My({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{T("fs",e),T("gitdir",r),T("oid",n);const l=new J(e);a!==void 0&&(n=await di({fs:l,cache:s,gitdir:r,oid:n,filepath:a}));const u=await $e({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 Ly({fs:e,cache:t,gitdir:r,oid:n}){const{type:i,object:a}=await $e({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 Fy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,cache:i={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await Ly({fs:new J(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function Uy({fs:e,dir:t,gitdir:r=N.join(t,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return T("fs",e),T("gitdir",r),T("oid",n),await wn({fs:new J(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function Hy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{T("fs",e),T("gitdir",r),T("filepath",n),await Ge.acquire({fs:new J(e),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function Wy({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 U.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 Gy({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{T("fs",e),T("gitdir",n),T("oid",a);const u=new J(e),d=await pr({fs:u,gitdir:n,author:o});if(!d)throw new Ke("author");const p=await pn({fs:u,gitdir:n,author:d,committer:s});if(!p)throw new Ke("committer");return await Wy({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 U.exists({fs:e,gitdir:t,ref:o}))throw new Ot("branch",n,!1);const l=await U.resolve({fs:e,gitdir:t,ref:a,depth:1});await U.writeRef({fs:e,gitdir:t,ref:o,value:l}),await U.deleteRef({fs:e,gitdir:t,ref:a});const u=await mr({fs:e,gitdir:t,fullname:!0})===a;(i||u)&&await U.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:o})}async function Yy({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,oldref:i,checkout:a=!1}){try{return T("fs",e),T("gitdir",r),T("ref",n),T("oldref",i),await qy({fs:new J(e),gitdir:r,ref:n,oldref:i,checkout:a})}catch(o){throw o.caller="git.renameBranch",o}}async function vf({gitdir:e,type:t,object:r}){return Vt(an.wrap({type:t,object:r}))}async function Xy({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,ref:i,cache:a={}}){try{T("fs",e),T("gitdir",r),T("filepath",n);const o=new J(e);let s,l;try{s=await U.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 vf({gitdir:r,type:"blob",object:u}),s===l&&(c=await o.lstat(N.join(t,n)))),await Ge.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 T("fs",e),T("gitdir",r),T("ref",n),await U.resolve({fs:new J(e),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Vy({fs:e,dir:t,gitdir:r=N.join(t,".git"),path:n,value:i,append:a=!1}){try{T("fs",e),T("gitdir",r),T("path",n);const o=new J(e),s=await Le.get({fs:o,gitdir:r});a?await s.append(n,i):await s.set(n,i),await Le.save({fs:o,gitdir:r,config:s})}catch(o){throw o.caller="git.setConfig",o}}async function xf({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 Ky={stage:nn,workdir:ui};let as;async function gn(e,t){return as===void 0&&(as=new Pn),as.acquire(e,t)}async function Jy(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 ce(`${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 Qy({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 Jy(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"?Ky[m]():m),o=[],u=await hr({fs:e,cache:{},dir:t,gitdir:r,trees:a,map:async(m,[g,_])=>{if(!(m==="."||await hn.isIgnored({fs:e,dir:t,gitdir:r,filepath:m}))&&_)return(!g||await g.oid()!==await _.oid()&&await _.oid()!==void 0)&&o.push([g,_]),{mode:await _.mode(),path:m,oid:await _.oid(),type:await _.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 _=[];for(const x of g){const[y,v]=x;i?v&&(await e.exists(`${t}/${v.toString()}`)?_.push(x):o.push([null,v])):y&&(v?_.push(x):o.push([y,null]))}return _.length?Promise.all(_.map(m)):[]}});if(o.length===0||u.length===0)return null;const p=(await Qy({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 eb({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 $e({fs:e,cache:{},gitdir:r,oid:c.oid});await e.exists(u)&&await e.rm(u),await e.write(u,d)}break}}}),await Ge.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 Ke("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 U.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 tb({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 U.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 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}`,_=await i.writeStashCommit({message:g,tree:u,parent:c});return await i.writeStashRef(_),await i.writeStashReflogEntry({stashCommit:_,message:g}),await Xu({fs:e,dir:t,gitdir:r,ref:a,track:!1,force:!0}),_}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 eb({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 rb({fs:e,dir:t,gitdir:r}){return new Jt({fs:e,dir:t,gitdir:r}).readStashReflogs({parsed:!0})}async function nb({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 ib({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 ab({fs:e,dir:t,gitdir:r=N.join(t,".git"),op:n="push",message:i="",refIdx:a=0}){T("fs",e),T("dir",t),T("gitdir",r),T("op",n);const o={push:tb,apply:xf,drop:Ef,list:rb,clear:nb,pop:ib},s=["apply","drop","pop"];try{const l=new J(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 ob({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{T("fs",e),T("gitdir",r),T("filepath",n);const a=new J(e);if(await hn.isIgnored({fs:a,gitdir:r,dir:t,filepath:n}))return"ignored";const s=await sb({fs:a,cache:i,gitdir:r}),l=await Sf({fs:a,cache:i,gitdir:r,tree:s,path:n}),c=await Ge.acquire({fs:a,gitdir:r,cache:i},async function(_){for(const x of _)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&&!Zi(c,u))return c.oid;{const _=await a.read(N.join(t,n)),x=await bf({gitdir:r,type:"blob",object:_});return p&&c.oid===x&&u.size!==-1&&Ge.acquire({fs:a,gitdir:r,cache:i},async function(y){y.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 _=await g();return _===l?_===c.oid?"unmodified":"*unmodified":_===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 $e({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 sb({fs:e,cache:t,gitdir:r}){let n;try{n=await U.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 cb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:o={},ignored:s=!1}){try{T("fs",e),T("gitdir",r),T("ref",n);const l=new J(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=>Yu(c,C)))return null;if(a&&!a(c))return;const[m,g,_]=await Promise.all([u&&u.type(),d&&d.type(),p&&p.type()]),x=[m,g,_].includes("blob");if((m==="tree"||m==="special")&&!x)return;if(m==="commit")return null;if((g==="tree"||g==="special")&&!x)return;if(_==="commit")return null;if((_==="tree"||_==="special")&&!x)return;const y=m==="blob"?await u.oid():void 0,v=_==="blob"?await p.oid():void 0;let O;m!=="blob"&&g==="blob"&&_!=="blob"?O="42":g==="blob"&&(O=await d.oid());const R=[void 0,y,O,v],b=R.map(C=>R.indexOf(C));return b.shift(),[c,...b]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function lb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,force:a=!1}){try{T("fs",e),T("gitdir",r),T("ref",n);const o=new J(e);if(n===void 0)throw new lt("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;const s=await U.resolve({fs:o,gitdir:r,ref:i||"HEAD"});if(!a&&await U.exists({fs:o,gitdir:r,ref:n}))throw new Ot("tag",n);await U.writeRef({fs:o,gitdir:r,ref:n,value:s})}catch(o){throw o.caller="git.tag",o}}async function ub({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{T("fs",e),T("gitdir",r),T("filepath",i);const u=new J(e);if(l)return await Ge.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 Ge.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 fb(){try{return ca.version}catch(e){throw e.caller="git.version",e}}async function db({fs:e,dir:t,gitdir:r=N.join(t,".git"),trees:n,map:i,reduce:a,iterate:o,cache:s={}}){try{return T("fs",e),T("gitdir",r),T("trees",n),await hr({fs:new J(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 hb({fs:e,dir:t,gitdir:r=N.join(t,".git"),blob:n}){try{return T("fs",e),T("gitdir",r),T("blob",n),await ut({fs:new J(e),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function pb({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n}){try{return T("fs",e),T("gitdir",r),T("commit",n),await _f({fs:new J(e),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function mb({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 J(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 wb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,value:i,force:a=!1,symbolic:o=!1}){try{T("fs",e),T("gitdir",r),T("ref",n),T("value",i);const s=new J(e);if(n!==Mt.clean(n))throw new Ct(n,Mt.clean(n));if(!a&&await U.exists({fs:s,gitdir:r,ref:n}))throw new Ot("ref",n);o?await U.writeSymbolicRef({fs:s,gitdir:r,ref:n,value:i}):(i=await U.resolve({fs:s,gitdir:r,ref:i}),await U.writeRef({fs:s,gitdir:r,ref:n,value:i}))}catch(s){throw s.caller="git.writeRef",s}}async function gb({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 yb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tag:n}){try{return T("fs",e),T("gitdir",r),T("tag",n),await gb({fs:new J(e),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function bb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tree:n}){try{return T("fs",e),T("gitdir",r),T("tree",n),await hi({fs:new J(e),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var it={Errors:Yw,STAGE:nn,TREE:xt,WORKDIR:ui,add:fg,abortMerge:sg,addNote:hg,addRemote:pg,annotatedTag:wg,branch:yg,checkout:Xu,clone:Pg,commit:Ag,getConfig:Jg,getConfigAll:ey,setConfig:Vy,currentBranch:$g,deleteBranch:Ig,deleteRef:jg,deleteRemote:zg,deleteTag:Mg,expandOid:Hg,expandRef:Wg,fastForward:Xg,fetch:Zg,findMergeBase:Vg,findRoot:Kg,getRemoteInfo:ty,getRemoteInfo2:ry,hashBlob:iy,indexPack:oy,init:sy,isDescendent:cy,isIgnored:ly,listBranches:uy,listFiles:dy,listNotes:py,listRefs:my,listRemotes:gy,listServerRefs:_y,listTags:vy,log:ky,merge:Ry,packObjects:Ty,pull:Py,push:jy,readBlob:By,readCommit:yf,readNote:Ny,readObject:My,readTag:Fy,readTree:Uy,remove:Hy,removeNote:Gy,renameBranch:Yy,resetIndex:Xy,updateIndex:ub,resolveRef:Zy,status:ob,statusMatrix:cb,tag:lb,version:fb,walk:db,writeBlob:hb,writeCommit:pb,writeObject:mb,writeRef:wb,writeTag:yb,writeTree:bb,stash:ab};const _b=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}`)}},vb=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})},xb=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 vb(e)},Eb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await it.pull({fs:r,http:to,dir:n,url:t,ref:"main"})},Sb=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})},kb=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 Rb{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 Rb(i,a.sourceRef,a.opType)},Ob=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},Cb=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]}},Tb=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 _b(`${window.miDir}/${e}`)||await xb(e,t);try{await Eb(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 kb(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 Tf={exports:{}},wi={};/*
97
+ `).filter(a=>a).reverse().map((a,o)=>r?`stash@{${o}}: ${a.split(" ")[1]}`:a)}}const Ky={stage:nn,workdir:ui};let as;async function gn(e,t){return as===void 0&&(as=new Pn),as.acquire(e,t)}async function Jy(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 ce(`${a}: file expected, but found directory`);const s=i?await Pu({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(Hu):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 Qy({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 Jy(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 Ef({fs:e,dir:t,gitdir:r,treePair:n}){const i=n[1]==="stage",a=n.map(m=>typeof m=="string"?Ky[m]():m),o=[],u=await hr({fs:e,cache:{},dir:t,gitdir:r,trees:a,map:async(m,[g,_])=>{if(!(m==="."||await hn.isIgnored({fs:e,dir:t,gitdir:r,filepath:m}))&&_)return(!g||await g.oid()!==await _.oid()&&await _.oid()!==void 0)&&o.push([g,_]),{mode:await _.mode(),path:m,oid:await _.oid(),type:await _.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 _=[];for(const x of g){const[y,v]=x;i?v&&(await e.exists(`${t}/${v.toString()}`)?_.push(x):o.push([null,v])):y&&(v?_.push(x):o.push([y,null]))}return _.length?Promise.all(_.map(m)):[]}});if(o.length===0||u.length===0)return null;const p=(await Qy({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 eb({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 $e({fs:e,cache:{},gitdir:r,oid:c.oid});await e.exists(u)&&await e.rm(u),await e.write(u,d)}break}}}),await Ge.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 Ke("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 xf({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 U.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 tb({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 U.resolve({fs:e,gitdir:r,ref:"HEAD"}),l=(await _f({fs:e,dir:t,gitdir:r,oid:o})).commit.message,c=[o];let u=null,d=xt({ref:"HEAD"});const p=await Ef({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 Ef({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}`,_=await i.writeStashCommit({message:g,tree:u,parent:c});return await i.writeStashRef(_),await i.writeStashReflogEntry({stashCommit:_,message:g}),await Vu({fs:e,dir:t,gitdir:r,ref:a,track:!1,force:!0}),_}async function Sf({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 eb({fs:e,dir:t,gitdir:r,stashCommit:o[s+1],parentCommit:o[s],wasStaged:c})}}async function kf({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 rb({fs:e,dir:t,gitdir:r}){return new Jt({fs:e,dir:t,gitdir:r}).readStashReflogs({parsed:!0})}async function nb({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 ib({fs:e,dir:t,gitdir:r,refIdx:n=0}){await Sf({fs:e,dir:t,gitdir:r,refIdx:n}),await kf({fs:e,dir:t,gitdir:r,refIdx:n})}async function ab({fs:e,dir:t,gitdir:r=N.join(t,".git"),op:n="push",message:i="",refIdx:a=0}){T("fs",e),T("dir",t),T("gitdir",r),T("op",n);const o={push:tb,apply:Sf,drop:kf,list:rb,clear:nb,pop:ib},s=["apply","drop","pop"];try{const l=new J(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 ob({fs:e,dir:t,gitdir:r=N.join(t,".git"),filepath:n,cache:i={}}){try{T("fs",e),T("gitdir",r),T("filepath",n);const a=new J(e);if(await hn.isIgnored({fs:a,gitdir:r,dir:t,filepath:n}))return"ignored";const s=await sb({fs:a,cache:i,gitdir:r}),l=await Rf({fs:a,cache:i,gitdir:r,tree:s,path:n}),c=await Ge.acquire({fs:a,gitdir:r,cache:i},async function(_){for(const x of _)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&&!Zi(c,u))return c.oid;{const _=await a.read(N.join(t,n)),x=await vf({gitdir:r,type:"blob",object:_});return p&&c.oid===x&&u.size!==-1&&Ge.acquire({fs:a,gitdir:r,cache:i},async function(y){y.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 _=await g();return _===l?_===c.oid?"unmodified":"*unmodified":_===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function Rf({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 $e({fs:e,cache:t,gitdir:r,oid:o.oid});if(s==="tree"){const c=ct.from(l);return Rf({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 sb({fs:e,cache:t,gitdir:r}){let n;try{n=await U.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 cb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:o={},ignored:s=!1}){try{T("fs",e),T("gitdir",r),T("ref",n);const l=new J(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=>Zu(c,C)))return null;if(a&&!a(c))return;const[m,g,_]=await Promise.all([u&&u.type(),d&&d.type(),p&&p.type()]),x=[m,g,_].includes("blob");if((m==="tree"||m==="special")&&!x)return;if(m==="commit")return null;if((g==="tree"||g==="special")&&!x)return;if(_==="commit")return null;if((_==="tree"||_==="special")&&!x)return;const y=m==="blob"?await u.oid():void 0,v=_==="blob"?await p.oid():void 0;let O;m!=="blob"&&g==="blob"&&_!=="blob"?O="42":g==="blob"&&(O=await d.oid());const R=[void 0,y,O,v],b=R.map(C=>R.indexOf(C));return b.shift(),[c,...b]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function lb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,object:i,force:a=!1}){try{T("fs",e),T("gitdir",r),T("ref",n);const o=new J(e);if(n===void 0)throw new lt("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;const s=await U.resolve({fs:o,gitdir:r,ref:i||"HEAD"});if(!a&&await U.exists({fs:o,gitdir:r,ref:n}))throw new Ot("tag",n);await U.writeRef({fs:o,gitdir:r,ref:n,value:s})}catch(o){throw o.caller="git.tag",o}}async function ub({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{T("fs",e),T("gitdir",r),T("filepath",i);const u=new J(e);if(l)return await Ge.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 Ge.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 fb(){try{return ca.version}catch(e){throw e.caller="git.version",e}}async function db({fs:e,dir:t,gitdir:r=N.join(t,".git"),trees:n,map:i,reduce:a,iterate:o,cache:s={}}){try{return T("fs",e),T("gitdir",r),T("trees",n),await hr({fs:new J(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 hb({fs:e,dir:t,gitdir:r=N.join(t,".git"),blob:n}){try{return T("fs",e),T("gitdir",r),T("blob",n),await ut({fs:new J(e),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function pb({fs:e,dir:t,gitdir:r=N.join(t,".git"),commit:n}){try{return T("fs",e),T("gitdir",r),T("commit",n),await xf({fs:new J(e),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function mb({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 J(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 wb({fs:e,dir:t,gitdir:r=N.join(t,".git"),ref:n,value:i,force:a=!1,symbolic:o=!1}){try{T("fs",e),T("gitdir",r),T("ref",n),T("value",i);const s=new J(e);if(n!==Mt.clean(n))throw new Ct(n,Mt.clean(n));if(!a&&await U.exists({fs:s,gitdir:r,ref:n}))throw new Ot("ref",n);o?await U.writeSymbolicRef({fs:s,gitdir:r,ref:n,value:i}):(i=await U.resolve({fs:s,gitdir:r,ref:i}),await U.writeRef({fs:s,gitdir:r,ref:n,value:i}))}catch(s){throw s.caller="git.writeRef",s}}async function gb({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 yb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tag:n}){try{return T("fs",e),T("gitdir",r),T("tag",n),await gb({fs:new J(e),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function bb({fs:e,dir:t,gitdir:r=N.join(t,".git"),tree:n}){try{return T("fs",e),T("gitdir",r),T("tree",n),await hi({fs:new J(e),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var it={Errors:Yw,STAGE:nn,TREE:xt,WORKDIR:ui,add:fg,abortMerge:sg,addNote:hg,addRemote:pg,annotatedTag:wg,branch:yg,checkout:Vu,clone:Pg,commit:Ag,getConfig:Jg,getConfigAll:ey,setConfig:Vy,currentBranch:$g,deleteBranch:Ig,deleteRef:jg,deleteRemote:zg,deleteTag:Mg,expandOid:Hg,expandRef:Wg,fastForward:Xg,fetch:Zg,findMergeBase:Vg,findRoot:Kg,getRemoteInfo:ty,getRemoteInfo2:ry,hashBlob:iy,indexPack:oy,init:sy,isDescendent:cy,isIgnored:ly,listBranches:uy,listFiles:dy,listNotes:py,listRefs:my,listRemotes:gy,listServerRefs:_y,listTags:vy,log:ky,merge:Ry,packObjects:Ty,pull:Py,push:jy,readBlob:By,readCommit:_f,readNote:Ny,readObject:My,readTag:Fy,readTree:Uy,remove:Hy,removeNote:Gy,renameBranch:Yy,resetIndex:Xy,updateIndex:ub,resolveRef:Zy,status:ob,statusMatrix:cb,tag:lb,version:fb,walk:db,writeBlob:hb,writeCommit:pb,writeObject:mb,writeRef:wb,writeTag:yb,writeTree:bb,stash:ab};const _b=async e=>{try{return await(await window.pfs.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}},Of=async e=>await window.pfs.readdir(e),Cf=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 Cf(`${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 it.setConfig({fs:t,dir:r,path:"user.name",value:n}),await it.setConfig({fs:t,dir:r,path:"user.email",value:i})},xb=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 vb(e)},Eb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`;await it.pull({fs:r,http:to,dir:n,url:t,ref:"main"})},Sb=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})},kb=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 Rb{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 Rb(i,a.sourceRef,a.opType)},Ob=async e=>{const t=window.pfs,r=`${window.miDir}/${e}`;return await it.resolveRef({fs:t,dir:r,ref:"HEAD"})},Tf=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},Cb=async(e,t)=>{const r=window.pfs,n=`${window.miDir}/${e}`,i=await Tf(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]}},Tb=async(e,t)=>{const r=await Tf(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 _b(`${window.miDir}/${e}`)||await xb(e,t);try{await Eb(e,t)}catch(n){throw await Cf(`${window.miDir}/${e}`).catch(i=>console.log(`recursiveRm error: ${i}`)),n}},Pf=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 kb(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 Af={exports:{}},wi={};/*
100
100
  object-assign
101
101
  (c) Sindre Sorhus
102
102
  @license MIT
103
- */var Pf=Object.getOwnPropertySymbols,Ab=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Db(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Ib(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(a){return t[a]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(a){i[a]=a}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Ib();/** @license React v17.0.2
103
+ */var $f=Object.getOwnPropertySymbols,Ab=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Db(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Ib(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(a){return t[a]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(a){i[a]=a}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Ib();/** @license React v17.0.2
104
104
  * react-jsx-runtime.production.min.js
105
105
  *
106
106
  * Copyright (c) Facebook, Inc. and its affiliates.
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 jb=K,Af=60103;if(wi.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var $f=Symbol.for;Af=$f("react.element"),wi.Fragment=$f("react.fragment")}var Bb=jb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,zb=Object.prototype.hasOwnProperty,Nb={key:!0,ref:!0,__self:!0,__source:!0};function Df(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)zb.call(t,n)&&!Nb.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=Df,wi.jsxs=Df,Tf.exports=wi;var ye=Tf.exports,If={exports:{}},ke={};/** @license React v16.13.1
110
+ */var jb=K,Df=60103;if(wi.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var If=Symbol.for;Df=If("react.element"),wi.Fragment=If("react.fragment")}var Bb=jb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,zb=Object.prototype.hasOwnProperty,Nb={key:!0,ref:!0,__self:!0,__source:!0};function jf(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)zb.call(t,n)&&!Nb.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:Df,type:e,key:a,ref:o,props:i,_owner:Bb.current}}wi.jsx=jf,wi.jsxs=jf,Af.exports=wi;var be=Af.exports,Bf={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 qe=typeof Symbol=="function"&&Symbol.for,cs=qe?Symbol.for("react.element"):60103,ls=qe?Symbol.for("react.portal"):60106,da=qe?Symbol.for("react.fragment"):60107,ha=qe?Symbol.for("react.strict_mode"):60108,pa=qe?Symbol.for("react.profiler"):60114,ma=qe?Symbol.for("react.provider"):60109,wa=qe?Symbol.for("react.context"):60110,us=qe?Symbol.for("react.async_mode"):60111,ga=qe?Symbol.for("react.concurrent_mode"):60111,ya=qe?Symbol.for("react.forward_ref"):60112,ba=qe?Symbol.for("react.suspense"):60113,Mb=qe?Symbol.for("react.suspense_list"):60120,_a=qe?Symbol.for("react.memo"):60115,va=qe?Symbol.for("react.lazy"):60116,Lb=qe?Symbol.for("react.block"):60121,Fb=qe?Symbol.for("react.fundamental"):60117,Ub=qe?Symbol.for("react.responder"):60118,Hb=qe?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===Mb||typeof e=="object"&&e!==null&&(e.$$typeof===va||e.$$typeof===_a||e.$$typeof===ma||e.$$typeof===wa||e.$$typeof===ya||e.$$typeof===Fb||e.$$typeof===Ub||e.$$typeof===Hb||e.$$typeof===Lb)},ke.typeOf=mt,If.exports=ke;var fs=If.exports;function Wb(e){function t(F,G,W,te,I){for(var ee=0,D=0,q=0,Z=0,X,L,V=0,re=0,Q,ue=Q=X=0,ne=0,ie=0,Re=0,Ee=0,Et=W.length,We=Et-1,Pe,se="",Se="",Oi="",w="",f;ne<Et;){if(L=W.charCodeAt(ne),ne===We&&D+Z+q+ee!==0&&(D!==0&&(L=D===47?10:47),Z=q=ee=0,Et++,We++),D+Z+q+ee===0){if(ne===We&&(0<ie&&(se=se.replace(p,"")),0<se.trim().length)){switch(L){case 32:case 9:case 59:case 13:case 10:break;default:se+=W.charAt(ne)}L=59}switch(L){case 123:for(se=se.trim(),X=se.charCodeAt(0),Q=1,Ee=++ne;ne<Et;){switch(L=W.charCodeAt(ne)){case 123:Q++;break;case 125:Q--;break;case 47:switch(L=W.charCodeAt(ne+1)){case 42:case 47:e:{for(ue=ne+1;ue<We;++ue)switch(W.charCodeAt(ue)){case 47:if(L===42&&W.charCodeAt(ue-1)===42&&ne+2!==ue){ne=ue+1;break e}break;case 10:if(L===47){ne=ue+1;break e}}ne=ue}}break;case 91:L++;case 40:L++;case 34:case 39:for(;ne++<We&&W.charCodeAt(ne)!==L;);}if(Q===0)break;ne++}switch(Q=W.substring(Ee,ne),X===0&&(X=(se=se.replace(d,"").trim()).charCodeAt(0)),X){case 64:switch(0<ie&&(se=se.replace(p,"")),L=se.charCodeAt(1),L){case 100:case 109:case 115:case 45:ie=G;break;default:ie=Ce}if(Q=t(G,ie,Q,L,I+1),Ee=Q.length,0<be&&(ie=r(Ce,se,Re),f=s(3,Q,ie,G,H,M,Ee,L,I,te),se=ie.join(""),f!==void 0&&(Ee=(Q=f.trim()).length)===0&&(L=0,Q="")),0<Ee)switch(L){case 115:se=se.replace(C,o);case 100:case 109:case 45:Q=se+"{"+Q+"}";break;case 107:se=se.replace(v,"$1 $2"),Q=se+"{"+Q+"}",Q=de===1||de===2&&a("@"+Q,3)?"@-webkit-"+Q+"@"+Q:"@"+Q;break;default:Q=se+Q,te===112&&(Q=(Se+=Q,""))}else Q="";break;default:Q=t(G,r(G,se,Re),Q,te,I+1)}Oi+=Q,Q=Re=ie=ue=X=0,se="",L=W.charCodeAt(++ne);break;case 125:case 59:if(se=(0<ie?se.replace(p,""):se).trim(),1<(Ee=se.length))switch(ue===0&&(X=se.charCodeAt(0),X===45||96<X&&123>X)&&(Ee=(se=se.replace(" ",":")).length),0<be&&(f=s(1,se,G,F,H,M,Se.length,te,I,te))!==void 0&&(Ee=(se=f.trim()).length)===0&&(se="\0\0"),X=se.charCodeAt(0),L=se.charCodeAt(1),X){case 0:break;case 64:if(L===105||L===99){w+=se+W.charAt(ne);break}default:se.charCodeAt(Ee-1)!==58&&(Se+=i(se,X,L,se.charCodeAt(2)))}Re=ie=ue=X=0,se="",L=W.charCodeAt(++ne)}}switch(L){case 13:case 10:D===47?D=0:1+X===0&&te!==107&&0<se.length&&(ie=1,se+="\0"),0<be*Be&&s(0,se,G,F,H,M,Se.length,te,I,te),M=1,H++;break;case 59:case 125:if(D+Z+q+ee===0){M++;break}default:switch(M++,Pe=W.charAt(ne),L){case 9:case 32:if(Z+ee+D===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:Z+D+ee===0&&(ie=Re=1,Pe="\f"+Pe);break;case 108:if(Z+D+ee+Y===0&&0<ue)switch(ne-ue){case 2:V===112&&W.charCodeAt(ne-3)===58&&(Y=V);case 8:re===111&&(Y=re)}break;case 58:Z+D+ee===0&&(ue=ne);break;case 44:D+q+Z+ee===0&&(ie=1,Pe+="\r");break;case 34:case 39:D===0&&(Z=Z===L?0:Z===0?L:Z);break;case 91:Z+D+q===0&&ee++;break;case 93:Z+D+q===0&&ee--;break;case 41:Z+D+ee===0&&q--;break;case 40:if(Z+D+ee===0){if(X===0)switch(2*V+3*re){case 533:break;default:X=1}q++}break;case 64:D+q+Z+ee+ue+Q===0&&(Q=1);break;case 42:case 47:if(!(0<Z+ee+q))switch(D){case 0:switch(2*L+3*W.charCodeAt(ne+1)){case 235:D=47;break;case 220:Ee=ne,D=42}break;case 42:L===47&&V===42&&Ee+2!==ne&&(W.charCodeAt(Ee+2)===33&&(Se+=W.substring(Ee,ne+1)),Pe="",D=0)}}D===0&&(se+=Pe)}re=V,V=L,ne++}if(Ee=Se.length,0<Ee){if(ie=G,0<be&&(f=s(2,Se,ie,F,H,M,Ee,te,I,te),f!==void 0&&(Se=f).length===0))return w+Se+Oi;if(Se=ie.join(",")+"{"+Se+"}",de*Y!==0){switch(de!==2||a(Se,2)||(Y=0),Y){case 111:Se=Se.replace(R,":-moz-$1")+Se;break;case 112:Se=Se.replace(O,"::-webkit-input-$1")+Se.replace(O,"::-moz-$1")+Se.replace(O,":-ms-input-$1")+Se}Y=0}}return w+Se+Oi}function r(F,G,W){var te=G.trim().split(x);G=te;var I=te.length,ee=F.length;switch(ee){case 0:case 1:var D=0;for(F=ee===0?"":F[0]+" ";D<I;++D)G[D]=n(F,G[D],W).trim();break;default:var q=D=0;for(G=[];D<I;++D)for(var Z=0;Z<ee;++Z)G[q++]=n(F[Z]+" ",te[D],W).trim()}return G}function n(F,G,W){var te=G.charCodeAt(0);switch(33>te&&(te=(G=G.trim()).charCodeAt(0)),te){case 38:return G.replace(y,"$1"+F.trim());case 58:return F.trim()+G.replace(y,"$1"+F.trim());default:if(0<1*W&&0<G.indexOf("\f"))return G.replace(y,(F.charCodeAt(0)===58?"":"$1")+F.trim())}return F+G}function i(F,G,W,te){var I=F+";",ee=2*G+3*W+4*te;if(ee===944){F=I.indexOf(":",9)+1;var D=I.substring(F,I.length-1).trim();return D=I.substring(0,F).trim()+D+";",de===1||de===2&&a(D,1)?"-webkit-"+D+D:D}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(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 D=I.substring(I.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+D+"-webkit-"+I+"-ms-flex-pack"+D+I;case 1005:return g.test(I)?I.replace(m,":-webkit-")+I.replace(m,":-moz-")+I:I;case 1e3:switch(D=I.substring(13).trim(),G=D.indexOf("-")+1,D.charCodeAt(0)+D.charCodeAt(G)){case 226:D=I.replace(b,"tb");break;case 232:D=I.replace(b,"tb-rl");break;case 220:D=I.replace(b,"lr");break;default:return I}return"-webkit-"+I+"-ms-"+D+I;case 1017:if(I.indexOf("sticky",9)===-1)break;case 975:switch(G=(I=F).length-10,D=(I.charCodeAt(G)===33?I.substring(0,G):I).substring(F.indexOf(":",7)+1).trim(),ee=D.charCodeAt(0)+(D.charCodeAt(7)|0)){case 203:if(111>D.charCodeAt(8))break;case 115:I=I.replace(D,"-webkit-"+D)+";"+I;break;case 207:case 102:I=I.replace(D,"-webkit-"+(102<ee?"inline-":"")+"box")+";"+I.replace(D,"-webkit-"+D)+";"+I.replace(D,"-ms-"+D+"box")+";"+I}return I+";";case 938:if(I.charCodeAt(5)===45)switch(I.charCodeAt(6)){case 105:return D=I.replace("-items",""),"-webkit-"+I+"-webkit-box-"+D+"-ms-flex-"+D+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($.test(F)===!0)return(D=F.substring(F.indexOf(":")+1)).charCodeAt(0)===115?i(F.replace("stretch","fill-available"),G,W,te).replace(":fill-available",":stretch"):I.replace(D,"-webkit-"+D)+I.replace(D,"-moz-"+D.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(_,"$1-webkit-$2")+I}return I}function a(F,G){var W=F.indexOf(G===1?":":"{"),te=F.substring(0,G!==3?W:10);return W=F.substring(W+1,F.length-1),Ue(G!==2?te:te.replace(P,"$1"),W,G)}function o(F,G){var W=i(G,G.charCodeAt(0),G.charCodeAt(1),G.charCodeAt(2));return W!==G+";"?W.replace(k," or ($1)").substring(4):"("+G+")"}function s(F,G,W,te,I,ee,D,q,Z,X){for(var L=0,V=G,re;L<be;++L)switch(re=le[L].call(u,F,V,W,te,I,ee,D,q,Z,X)){case void 0:case!1:case!0:case null:break;default:V=re}if(V!==G)return V}function l(F){switch(F){case void 0:case null:be=le.length=0;break;default:if(typeof F=="function")le[be++]=F;else if(typeof F=="object")for(var G=0,W=F.length;G<W;++G)l(F[G]);else Be=!!F|0}return l}function c(F){return F=F.prefix,F!==void 0&&(Ue=null,F?typeof F!="function"?de=1:(de=2,Ue=F):de=0),c}function u(F,G){var W=F;if(33>W.charCodeAt(0)&&(W=W.trim()),oe=W,W=[oe],0<be){var te=s(-1,G,W,W,H,M,0,0,0,0);te!==void 0&&typeof te=="string"&&(G=te)}var I=t(Ce,W,G,0,0);return 0<be&&(te=s(-2,I,W,W,H,M,I.length,0,0,0),te!==void 0&&(I=te)),oe="",Y=0,M=H=1,I}var d=/^\0+/g,p=/[\0\r\f]/g,m=/: */g,g=/zoo|gra/,_=/([,: ])(transform)/g,x=/,\r+?/g,y=/([\t\r\n ])*\f?&/g,v=/@(k\w+)\s*(\S*)\s*/,O=/::(place)/g,R=/:(read-only)/g,b=/[svh]\w+-[tblr]{2}/,C=/\(\s*(.*)\s*\)/g,k=/([\s\S]*?);/g,S=/-self|flex-/g,P=/[^]*?(:[rp][el]a[\w-]+)[^]*/,$=/stretch|:\s*\w+\-(?:conte|avail)/,j=/([^-])(image-set\()/,M=1,H=1,Y=0,de=1,Ce=[],le=[],be=0,Ue=null,Be=0,oe="";return u.use=l,u.set=c,e!==void 0&&c(e),u}var Gb={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 Yb=/^((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 Yb.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),ds=fs,Xb={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},Vb={$$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]=Vb,hs[ds.Memo]=zf;function Nf(e){return ds.isMemo(e)?zf:hs[e.$$typeof]||Xb}var Kb=Object.defineProperty,Jb=Object.getOwnPropertyNames,Mf=Object.getOwnPropertySymbols,Qb=Object.getOwnPropertyDescriptor,e_=Object.getPrototypeOf,Lf=Object.prototype;function Ff(e,t,r){if(typeof t!="string"){if(Lf){var n=e_(t);n&&n!==Lf&&Ff(e,n,r)}var i=Jb(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=Qb(t,l);try{Kb(e,l,c)}catch{}}}}return e}var t_=Ff;const r_=St(t_);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,n_=!!(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 i_=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*/
117
+ */var qe=typeof Symbol=="function"&&Symbol.for,cs=qe?Symbol.for("react.element"):60103,ls=qe?Symbol.for("react.portal"):60106,da=qe?Symbol.for("react.fragment"):60107,ha=qe?Symbol.for("react.strict_mode"):60108,pa=qe?Symbol.for("react.profiler"):60114,ma=qe?Symbol.for("react.provider"):60109,wa=qe?Symbol.for("react.context"):60110,us=qe?Symbol.for("react.async_mode"):60111,ga=qe?Symbol.for("react.concurrent_mode"):60111,ya=qe?Symbol.for("react.forward_ref"):60112,ba=qe?Symbol.for("react.suspense"):60113,Mb=qe?Symbol.for("react.suspense_list"):60120,_a=qe?Symbol.for("react.memo"):60115,va=qe?Symbol.for("react.lazy"):60116,Lb=qe?Symbol.for("react.block"):60121,Fb=qe?Symbol.for("react.fundamental"):60117,Ub=qe?Symbol.for("react.responder"):60118,Hb=qe?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 zf(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 zf(e)||mt(e)===us},ke.isConcurrentMode=zf,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===Mb||typeof e=="object"&&e!==null&&(e.$$typeof===va||e.$$typeof===_a||e.$$typeof===ma||e.$$typeof===wa||e.$$typeof===ya||e.$$typeof===Fb||e.$$typeof===Ub||e.$$typeof===Hb||e.$$typeof===Lb)},ke.typeOf=mt,Bf.exports=ke;var fs=Bf.exports;function Wb(e){function t(F,G,W,te,I){for(var ee=0,D=0,q=0,Z=0,X,L,V=0,re=0,Q,ue=Q=X=0,ne=0,ie=0,Re=0,Ee=0,Et=W.length,We=Et-1,Pe,se="",Se="",Oi="",w="",f;ne<Et;){if(L=W.charCodeAt(ne),ne===We&&D+Z+q+ee!==0&&(D!==0&&(L=D===47?10:47),Z=q=ee=0,Et++,We++),D+Z+q+ee===0){if(ne===We&&(0<ie&&(se=se.replace(p,"")),0<se.trim().length)){switch(L){case 32:case 9:case 59:case 13:case 10:break;default:se+=W.charAt(ne)}L=59}switch(L){case 123:for(se=se.trim(),X=se.charCodeAt(0),Q=1,Ee=++ne;ne<Et;){switch(L=W.charCodeAt(ne)){case 123:Q++;break;case 125:Q--;break;case 47:switch(L=W.charCodeAt(ne+1)){case 42:case 47:e:{for(ue=ne+1;ue<We;++ue)switch(W.charCodeAt(ue)){case 47:if(L===42&&W.charCodeAt(ue-1)===42&&ne+2!==ue){ne=ue+1;break e}break;case 10:if(L===47){ne=ue+1;break e}}ne=ue}}break;case 91:L++;case 40:L++;case 34:case 39:for(;ne++<We&&W.charCodeAt(ne)!==L;);}if(Q===0)break;ne++}switch(Q=W.substring(Ee,ne),X===0&&(X=(se=se.replace(d,"").trim()).charCodeAt(0)),X){case 64:switch(0<ie&&(se=se.replace(p,"")),L=se.charCodeAt(1),L){case 100:case 109:case 115:case 45:ie=G;break;default:ie=Ce}if(Q=t(G,ie,Q,L,I+1),Ee=Q.length,0<_e&&(ie=r(Ce,se,Re),f=s(3,Q,ie,G,H,M,Ee,L,I,te),se=ie.join(""),f!==void 0&&(Ee=(Q=f.trim()).length)===0&&(L=0,Q="")),0<Ee)switch(L){case 115:se=se.replace(C,o);case 100:case 109:case 45:Q=se+"{"+Q+"}";break;case 107:se=se.replace(v,"$1 $2"),Q=se+"{"+Q+"}",Q=de===1||de===2&&a("@"+Q,3)?"@-webkit-"+Q+"@"+Q:"@"+Q;break;default:Q=se+Q,te===112&&(Q=(Se+=Q,""))}else Q="";break;default:Q=t(G,r(G,se,Re),Q,te,I+1)}Oi+=Q,Q=Re=ie=ue=X=0,se="",L=W.charCodeAt(++ne);break;case 125:case 59:if(se=(0<ie?se.replace(p,""):se).trim(),1<(Ee=se.length))switch(ue===0&&(X=se.charCodeAt(0),X===45||96<X&&123>X)&&(Ee=(se=se.replace(" ",":")).length),0<_e&&(f=s(1,se,G,F,H,M,Se.length,te,I,te))!==void 0&&(Ee=(se=f.trim()).length)===0&&(se="\0\0"),X=se.charCodeAt(0),L=se.charCodeAt(1),X){case 0:break;case 64:if(L===105||L===99){w+=se+W.charAt(ne);break}default:se.charCodeAt(Ee-1)!==58&&(Se+=i(se,X,L,se.charCodeAt(2)))}Re=ie=ue=X=0,se="",L=W.charCodeAt(++ne)}}switch(L){case 13:case 10:D===47?D=0:1+X===0&&te!==107&&0<se.length&&(ie=1,se+="\0"),0<_e*Be&&s(0,se,G,F,H,M,Se.length,te,I,te),M=1,H++;break;case 59:case 125:if(D+Z+q+ee===0){M++;break}default:switch(M++,Pe=W.charAt(ne),L){case 9:case 32:if(Z+ee+D===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:Z+D+ee===0&&(ie=Re=1,Pe="\f"+Pe);break;case 108:if(Z+D+ee+Y===0&&0<ue)switch(ne-ue){case 2:V===112&&W.charCodeAt(ne-3)===58&&(Y=V);case 8:re===111&&(Y=re)}break;case 58:Z+D+ee===0&&(ue=ne);break;case 44:D+q+Z+ee===0&&(ie=1,Pe+="\r");break;case 34:case 39:D===0&&(Z=Z===L?0:Z===0?L:Z);break;case 91:Z+D+q===0&&ee++;break;case 93:Z+D+q===0&&ee--;break;case 41:Z+D+ee===0&&q--;break;case 40:if(Z+D+ee===0){if(X===0)switch(2*V+3*re){case 533:break;default:X=1}q++}break;case 64:D+q+Z+ee+ue+Q===0&&(Q=1);break;case 42:case 47:if(!(0<Z+ee+q))switch(D){case 0:switch(2*L+3*W.charCodeAt(ne+1)){case 235:D=47;break;case 220:Ee=ne,D=42}break;case 42:L===47&&V===42&&Ee+2!==ne&&(W.charCodeAt(Ee+2)===33&&(Se+=W.substring(Ee,ne+1)),Pe="",D=0)}}D===0&&(se+=Pe)}re=V,V=L,ne++}if(Ee=Se.length,0<Ee){if(ie=G,0<_e&&(f=s(2,Se,ie,F,H,M,Ee,te,I,te),f!==void 0&&(Se=f).length===0))return w+Se+Oi;if(Se=ie.join(",")+"{"+Se+"}",de*Y!==0){switch(de!==2||a(Se,2)||(Y=0),Y){case 111:Se=Se.replace(R,":-moz-$1")+Se;break;case 112:Se=Se.replace(O,"::-webkit-input-$1")+Se.replace(O,"::-moz-$1")+Se.replace(O,":-ms-input-$1")+Se}Y=0}}return w+Se+Oi}function r(F,G,W){var te=G.trim().split(x);G=te;var I=te.length,ee=F.length;switch(ee){case 0:case 1:var D=0;for(F=ee===0?"":F[0]+" ";D<I;++D)G[D]=n(F,G[D],W).trim();break;default:var q=D=0;for(G=[];D<I;++D)for(var Z=0;Z<ee;++Z)G[q++]=n(F[Z]+" ",te[D],W).trim()}return G}function n(F,G,W){var te=G.charCodeAt(0);switch(33>te&&(te=(G=G.trim()).charCodeAt(0)),te){case 38:return G.replace(y,"$1"+F.trim());case 58:return F.trim()+G.replace(y,"$1"+F.trim());default:if(0<1*W&&0<G.indexOf("\f"))return G.replace(y,(F.charCodeAt(0)===58?"":"$1")+F.trim())}return F+G}function i(F,G,W,te){var I=F+";",ee=2*G+3*W+4*te;if(ee===944){F=I.indexOf(":",9)+1;var D=I.substring(F,I.length-1).trim();return D=I.substring(0,F).trim()+D+";",de===1||de===2&&a(D,1)?"-webkit-"+D+D:D}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(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 D=I.substring(I.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),"-webkit-box-pack"+D+"-webkit-"+I+"-ms-flex-pack"+D+I;case 1005:return g.test(I)?I.replace(m,":-webkit-")+I.replace(m,":-moz-")+I:I;case 1e3:switch(D=I.substring(13).trim(),G=D.indexOf("-")+1,D.charCodeAt(0)+D.charCodeAt(G)){case 226:D=I.replace(b,"tb");break;case 232:D=I.replace(b,"tb-rl");break;case 220:D=I.replace(b,"lr");break;default:return I}return"-webkit-"+I+"-ms-"+D+I;case 1017:if(I.indexOf("sticky",9)===-1)break;case 975:switch(G=(I=F).length-10,D=(I.charCodeAt(G)===33?I.substring(0,G):I).substring(F.indexOf(":",7)+1).trim(),ee=D.charCodeAt(0)+(D.charCodeAt(7)|0)){case 203:if(111>D.charCodeAt(8))break;case 115:I=I.replace(D,"-webkit-"+D)+";"+I;break;case 207:case 102:I=I.replace(D,"-webkit-"+(102<ee?"inline-":"")+"box")+";"+I.replace(D,"-webkit-"+D)+";"+I.replace(D,"-ms-"+D+"box")+";"+I}return I+";";case 938:if(I.charCodeAt(5)===45)switch(I.charCodeAt(6)){case 105:return D=I.replace("-items",""),"-webkit-"+I+"-webkit-box-"+D+"-ms-flex-"+D+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($.test(F)===!0)return(D=F.substring(F.indexOf(":")+1)).charCodeAt(0)===115?i(F.replace("stretch","fill-available"),G,W,te).replace(":fill-available",":stretch"):I.replace(D,"-webkit-"+D)+I.replace(D,"-moz-"+D.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(_,"$1-webkit-$2")+I}return I}function a(F,G){var W=F.indexOf(G===1?":":"{"),te=F.substring(0,G!==3?W:10);return W=F.substring(W+1,F.length-1),Ue(G!==2?te:te.replace(P,"$1"),W,G)}function o(F,G){var W=i(G,G.charCodeAt(0),G.charCodeAt(1),G.charCodeAt(2));return W!==G+";"?W.replace(k," or ($1)").substring(4):"("+G+")"}function s(F,G,W,te,I,ee,D,q,Z,X){for(var L=0,V=G,re;L<_e;++L)switch(re=le[L].call(u,F,V,W,te,I,ee,D,q,Z,X)){case void 0:case!1:case!0:case null:break;default:V=re}if(V!==G)return V}function l(F){switch(F){case void 0:case null:_e=le.length=0;break;default:if(typeof F=="function")le[_e++]=F;else if(typeof F=="object")for(var G=0,W=F.length;G<W;++G)l(F[G]);else Be=!!F|0}return l}function c(F){return F=F.prefix,F!==void 0&&(Ue=null,F?typeof F!="function"?de=1:(de=2,Ue=F):de=0),c}function u(F,G){var W=F;if(33>W.charCodeAt(0)&&(W=W.trim()),oe=W,W=[oe],0<_e){var te=s(-1,G,W,W,H,M,0,0,0,0);te!==void 0&&typeof te=="string"&&(G=te)}var I=t(Ce,W,G,0,0);return 0<_e&&(te=s(-2,I,W,W,H,M,I.length,0,0,0),te!==void 0&&(I=te)),oe="",Y=0,M=H=1,I}var d=/^\0+/g,p=/[\0\r\f]/g,m=/: */g,g=/zoo|gra/,_=/([,: ])(transform)/g,x=/,\r+?/g,y=/([\t\r\n ])*\f?&/g,v=/@(k\w+)\s*(\S*)\s*/,O=/::(place)/g,R=/:(read-only)/g,b=/[svh]\w+-[tblr]{2}/,C=/\(\s*(.*)\s*\)/g,k=/([\s\S]*?);/g,S=/-self|flex-/g,P=/[^]*?(:[rp][el]a[\w-]+)[^]*/,$=/stretch|:\s*\w+\-(?:conte|avail)/,j=/([^-])(image-set\()/,M=1,H=1,Y=0,de=1,Ce=[],le=[],_e=0,Ue=null,Be=0,oe="";return u.use=l,u.set=c,e!==void 0&&c(e),u}var Gb={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 Yb=/^((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)-.*))$/,Nf=qb(function(e){return Yb.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),ds=fs,Xb={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},Vb={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Mf={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},hs={};hs[ds.ForwardRef]=Vb,hs[ds.Memo]=Mf;function Lf(e){return ds.isMemo(e)?Mf:hs[e.$$typeof]||Xb}var Kb=Object.defineProperty,Jb=Object.getOwnPropertyNames,Ff=Object.getOwnPropertySymbols,Qb=Object.getOwnPropertyDescriptor,e_=Object.getPrototypeOf,Uf=Object.prototype;function Hf(e,t,r){if(typeof t!="string"){if(Uf){var n=e_(t);n&&n!==Uf&&Hf(e,n,r)}var i=Jb(t);Ff&&(i=i.concat(Ff(t)));for(var a=Lf(e),o=Lf(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=Qb(t,l);try{Kb(e,l,c)}catch{}}}}return e}var t_=Hf;const r_=St(t_);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 Wf=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 Gf(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,n_=!!(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 i_=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
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},a_=function(e){return Sa.get(e)},o_=function(e,t){t>=bi&&(bi=t+1),Ea.set(e,t),Sa.set(t,e)},s_="style["+yn+'][data-styled-version="5.3.11"]',c_=new RegExp("^"+yn+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),l_=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)},u_=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(c_);if(s){var l=0|parseInt(s[1],10),c=s[2];l!==0&&(o_(c,l),l_(e,c,s[3]),e.getTag().insertRules(l,n)),n.length=0}else n.push(o)}}},f_=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=f_();return o&&n.setAttribute("nonce",o),r.insertBefore(n,a),n},d_=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}(),h_=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}(),p_=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}(),Gf=ws,m_={isServer:!ws,useCSSOMInjection:!n_},qf=function(){function e(r,n,i){r===void 0&&(r=wr),n===void 0&&(n={}),this.options=Qt({},m_,{},r),this.gs=n,this.names=new Map(i),this.server=!!r.isServer,!this.server&&ws&&Gf&&(Gf=!1,function(a){for(var o=document.querySelectorAll(s_),s=0,l=o.length;s<l;s++){var c=o[s];c&&c.getAttribute(yn)!=="active"&&(u_(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 p_(o):a?new d_(o):new h_(o),new i_(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=a_(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}(),w_=/(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(w_,"$1-$2")}var bn=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Xf=function(e){return bn(5381,e)};function g_(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(gi(r)&&!ms(r))return!1}return!0}var y_=Xf("5.3.11"),b_=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&g_(t),this.componentId=r,this.baseHash=bn(y_,r),this.baseStyle=n,qf.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),_=Array.isArray(g)?g.join(""):g;u=bn(u,_+p),d+=_}}if(d){var x=gs(u>>>0);if(!r.hasNameForId(i,x)){var y=n(d,"."+x,void 0,i);r.insertRules(i,x,y)}a.push(x)}}return a.join(" ")},e}(),__=/^\s*\/\/.*$/gm,v_=[":","[",".","#"];function x_(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 Wb(s),d=[],p=function(_){function x(y){if(y)try{_(y+"}")}catch{}}return function(y,v,O,R,b,C,k,S,P,$){switch(y){case 1:if(P===0&&v.charCodeAt(0)===64)return _(v+";"),"";break;case 2:if(S===0)return v+"/*|*/";break;case 3:switch(S){case 102:case 112:return _(O[0]+v),"";default:return v+($===0?"/*|*/":"")}case-2:v.split("/*|*/}").forEach(x)}}}(function(_){d.push(_)}),m=function(_,x,y){return x===0&&v_.indexOf(y[r.length])!==-1||y.match(i)?_:"."+t};function g(_,x,y,v){v===void 0&&(v="&");var O=_.replace(__,""),R=x&&y?y+" "+x+" { "+O+" }":O;return t=v,r=x,n=new RegExp("\\"+r+"\\b","g"),i=new RegExp("(\\"+r+"\\b){2,}"),u(y||!x?"":x,R)}return u.use([].concat(c,[function(_,x,y){_===2&&y.length&&y[0].lastIndexOf(r)>0&&(y[0]=y[0].replace(n,m))},p,function(_){if(_===-2){var x=d;return d=[],x}}])),g.hash=c.length?c.reduce(function(_,x){return x.name||yi(15),bn(_,x.name)},5381).toString():"",g}var Zf=K.createContext();Zf.Consumer;var Vf=K.createContext(),E_=(Vf.Consumer,new qf),ys=x_();function S_(){return K.useContext(Zf)||E_}function k_(){return K.useContext(Vf)||ys}var R_=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}(),O_=/([A-Z])/,C_=/([A-Z])/g,T_=/^ms-/,P_=function(e){return"-"+e.toLowerCase()};function Kf(e){return O_.test(e)?e.replace(C_,P_).replace(T_,"-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 R_?r?(e.inject(r,n),e.getName(n)):e:ps(e)?function u(d,p){var m,g,_=[];for(var x in d)d.hasOwnProperty(x)&&!Jf(d[x])&&(Array.isArray(d[x])&&d[x].isCss||gi(d[x])?_.push(Kf(x)+":",d[x],";"):ps(d[x])?_.push.apply(_,u(d[x],x)):_.push(Kf(x)+": "+(m=x,(g=d[x])==null||typeof g=="boolean"||g===""?"":typeof g!="number"||g===0||m in Gb||m.startsWith("--")?String(g).trim():g+"px")+";"));return p?[p+" {"].concat(_,["}"]):_}(e):e.toString()}var Qf=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function A_(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 $_=function(e,t,r){return r===void 0&&(r=wr),e.theme!==r.theme&&e.theme||t||r.theme},D_=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,I_=/(^-|-$)/g;function bs(e){return e.replace(D_,"-").replace(I_,"")}var j_=function(e){return gs(Xf(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)},B_=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function z_(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)B_(s)&&z_(e,o[s],s)}return e}var td=K.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(v,O){var R=typeof v!="string"?"sc":bs(v);vs[R]=(vs[R]||0)+1;var b=R+"-"+j_("5.3.11"+R+vs[R]);return O?O+"-"+b:b}(t.displayName,t.parentComponentId):s,c=t.displayName,u=c===void 0?function(v){return Ra(v)?"styled."+v:"Styled("+Hf(v)+")"}(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(v,O,R){return e.shouldForwardProp(v,O,R)&&t.shouldForwardProp(v,O,R)}:e.shouldForwardProp);var g,_=new b_(r,d,n?e.componentStyle:void 0),x=_.isStatic&&o.length===0,y=function(v,O){return function(R,b,C,k){var S=R.attrs,P=R.componentStyle,$=R.defaultProps,j=R.foldedComponentIds,M=R.shouldForwardProp,H=R.styledComponentId,Y=R.target,de=function(te,I,ee){te===void 0&&(te=wr);var D=Qt({},I,{theme:te}),q={};return ee.forEach(function(Z){var X,L,V,re=Z;for(X in gi(re)&&(re=re(D)),re)D[X]=q[X]=X==="className"?(L=q[X],V=re[X],L&&V?L+" "+V:L||V):re[X]}),[D,q]}($_(b,K.useContext(td),$)||wr,b,S),Ce=de[0],le=de[1],be=function(te,I,ee,D){var q=S_(),Z=k_(),X=I?te.generateAndInjectStyles(wr,q,Z):te.generateAndInjectStyles(ee,q,Z);return X}(P,k,Ce),Ue=C,Be=le.$as||b.$as||le.as||b.as||Y,oe=Ra(Be),F=le!==b?Qt({},b,{},le):b,G={};for(var W in F)W[0]!=="$"&&W!=="as"&&(W==="forwardedAs"?G.as=F[W]:(M?M(W,Bf,Be):!oe||Bf(W))&&(G[W]=F[W]));return b.style&&le.style!==b.style&&(G.style=Qt({},b.style,{},le.style)),G.className=Array.prototype.concat(j,H,be!==H?be:null,b.className,le.className).filter(Boolean).join(" "),G.ref=Ue,K.createElement(Be,G)}(g,v,O,x)};return y.displayName=u,(g=K.forwardRef(y)).attrs=p,g.componentStyle=_,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(v){var O=t.componentId,R=function(C,k){if(C==null)return{};var S,P,$={},j=Object.keys(C);for(P=0;P<j.length;P++)S=j[P],k.indexOf(S)>=0||($[S]=C[S]);return $}(t,["componentId"]),b=O&&O+"-"+(Ra(v)?v:bs(Hf(v)));return rd(v,Qt({},R,{attrs:p,componentId:b}),r)},Object.defineProperty(g,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(v){this._foldedDefaultProps=n?ed({},e.defaultProps,v):v}}),Object.defineProperty(g,"toString",{value:function(){return"."+g.styledComponentId}}),i&&r_(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,A_.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 N_=gr.div`
119
+ `),n=[],i=0,a=r.length;i<a;i++){var o=r[i].trim();if(o){var s=o.match(c_);if(s){var l=0|parseInt(s[1],10),c=s[2];l!==0&&(o_(c,l),l_(e,c,s[3]),e.getTag().insertRules(l,n)),n.length=0}else n.push(o)}}},f_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null},qf=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=f_();return o&&n.setAttribute("nonce",o),r.insertBefore(n,a),n},d_=function(){function e(r){var n=this.element=qf(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}(),h_=function(){function e(r){var n=this.element=qf(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}(),p_=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}(),Yf=ws,m_={isServer:!ws,useCSSOMInjection:!n_},Xf=function(){function e(r,n,i){r===void 0&&(r=wr),n===void 0&&(n={}),this.options=Qt({},m_,{},r),this.gs=n,this.names=new Map(i),this.server=!!r.isServer,!this.server&&ws&&Yf&&(Yf=!1,function(a){for(var o=document.querySelectorAll(s_),s=0,l=o.length;s<l;s++){var c=o[s];c&&c.getAttribute(yn)!=="active"&&(u_(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 p_(o):a?new d_(o):new h_(o),new i_(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=a_(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}(),w_=/(a)(d)/gi,Zf=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=Zf(t%52)+r;return(Zf(t%52)+r).replace(w_,"$1-$2")}var bn=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Vf=function(e){return bn(5381,e)};function g_(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(gi(r)&&!ms(r))return!1}return!0}var y_=Vf("5.3.11"),b_=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&g_(t),this.componentId=r,this.baseHash=bn(y_,r),this.baseStyle=n,Xf.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),_=Array.isArray(g)?g.join(""):g;u=bn(u,_+p),d+=_}}if(d){var x=gs(u>>>0);if(!r.hasNameForId(i,x)){var y=n(d,"."+x,void 0,i);r.insertRules(i,x,y)}a.push(x)}}return a.join(" ")},e}(),__=/^\s*\/\/.*$/gm,v_=[":","[",".","#"];function x_(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 Wb(s),d=[],p=function(_){function x(y){if(y)try{_(y+"}")}catch{}}return function(y,v,O,R,b,C,k,S,P,$){switch(y){case 1:if(P===0&&v.charCodeAt(0)===64)return _(v+";"),"";break;case 2:if(S===0)return v+"/*|*/";break;case 3:switch(S){case 102:case 112:return _(O[0]+v),"";default:return v+($===0?"/*|*/":"")}case-2:v.split("/*|*/}").forEach(x)}}}(function(_){d.push(_)}),m=function(_,x,y){return x===0&&v_.indexOf(y[r.length])!==-1||y.match(i)?_:"."+t};function g(_,x,y,v){v===void 0&&(v="&");var O=_.replace(__,""),R=x&&y?y+" "+x+" { "+O+" }":O;return t=v,r=x,n=new RegExp("\\"+r+"\\b","g"),i=new RegExp("(\\"+r+"\\b){2,}"),u(y||!x?"":x,R)}return u.use([].concat(c,[function(_,x,y){_===2&&y.length&&y[0].lastIndexOf(r)>0&&(y[0]=y[0].replace(n,m))},p,function(_){if(_===-2){var x=d;return d=[],x}}])),g.hash=c.length?c.reduce(function(_,x){return x.name||yi(15),bn(_,x.name)},5381).toString():"",g}var Kf=K.createContext();Kf.Consumer;var Jf=K.createContext(),E_=(Jf.Consumer,new Xf),ys=x_();function S_(){return K.useContext(Kf)||E_}function k_(){return K.useContext(Jf)||ys}var R_=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}(),O_=/([A-Z])/,C_=/([A-Z])/g,T_=/^ms-/,P_=function(e){return"-"+e.toLowerCase()};function Qf(e){return O_.test(e)?e.replace(C_,P_).replace(T_,"-ms-"):e}var ed=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(ed(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 R_?r?(e.inject(r,n),e.getName(n)):e:ps(e)?function u(d,p){var m,g,_=[];for(var x in d)d.hasOwnProperty(x)&&!ed(d[x])&&(Array.isArray(d[x])&&d[x].isCss||gi(d[x])?_.push(Qf(x)+":",d[x],";"):ps(d[x])?_.push.apply(_,u(d[x],x)):_.push(Qf(x)+": "+(m=x,(g=d[x])==null||typeof g=="boolean"||g===""?"":typeof g!="number"||g===0||m in Gb||m.startsWith("--")?String(g).trim():g+"px")+";"));return p?[p+" {"].concat(_,["}"]):_}(e):e.toString()}var td=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function A_(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)?td(_n(Wf(xa,[e].concat(r)))):r.length===0&&e.length===1&&typeof e[0]=="string"?e:td(_n(Wf(e,r)))}var $_=function(e,t,r){return r===void 0&&(r=wr),e.theme!==r.theme&&e.theme||t||r.theme},D_=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,I_=/(^-|-$)/g;function bs(e){return e.replace(D_,"-").replace(I_,"")}var j_=function(e){return gs(Vf(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)},B_=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function z_(e,t,r){var n=e[r];_s(t)&&_s(n)?rd(n,t):e[r]=t}function rd(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)B_(s)&&z_(e,o[s],s)}return e}var nd=K.createContext();nd.Consumer;var vs={};function id(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(v,O){var R=typeof v!="string"?"sc":bs(v);vs[R]=(vs[R]||0)+1;var b=R+"-"+j_("5.3.11"+R+vs[R]);return O?O+"-"+b:b}(t.displayName,t.parentComponentId):s,c=t.displayName,u=c===void 0?function(v){return Ra(v)?"styled."+v:"Styled("+Gf(v)+")"}(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(v,O,R){return e.shouldForwardProp(v,O,R)&&t.shouldForwardProp(v,O,R)}:e.shouldForwardProp);var g,_=new b_(r,d,n?e.componentStyle:void 0),x=_.isStatic&&o.length===0,y=function(v,O){return function(R,b,C,k){var S=R.attrs,P=R.componentStyle,$=R.defaultProps,j=R.foldedComponentIds,M=R.shouldForwardProp,H=R.styledComponentId,Y=R.target,de=function(te,I,ee){te===void 0&&(te=wr);var D=Qt({},I,{theme:te}),q={};return ee.forEach(function(Z){var X,L,V,re=Z;for(X in gi(re)&&(re=re(D)),re)D[X]=q[X]=X==="className"?(L=q[X],V=re[X],L&&V?L+" "+V:L||V):re[X]}),[D,q]}($_(b,K.useContext(nd),$)||wr,b,S),Ce=de[0],le=de[1],_e=function(te,I,ee,D){var q=S_(),Z=k_(),X=I?te.generateAndInjectStyles(wr,q,Z):te.generateAndInjectStyles(ee,q,Z);return X}(P,k,Ce),Ue=C,Be=le.$as||b.$as||le.as||b.as||Y,oe=Ra(Be),F=le!==b?Qt({},b,{},le):b,G={};for(var W in F)W[0]!=="$"&&W!=="as"&&(W==="forwardedAs"?G.as=F[W]:(M?M(W,Nf,Be):!oe||Nf(W))&&(G[W]=F[W]));return b.style&&le.style!==b.style&&(G.style=Qt({},b.style,{},le.style)),G.className=Array.prototype.concat(j,H,_e!==H?_e:null,b.className,le.className).filter(Boolean).join(" "),G.ref=Ue,K.createElement(Be,G)}(g,v,O,x)};return y.displayName=u,(g=K.forwardRef(y)).attrs=p,g.componentStyle=_,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(v){var O=t.componentId,R=function(C,k){if(C==null)return{};var S,P,$={},j=Object.keys(C);for(P=0;P<j.length;P++)S=j[P],k.indexOf(S)>=0||($[S]=C[S]);return $}(t,["componentId"]),b=O&&O+"-"+(Ra(v)?v:bs(Gf(v)));return id(v,Qt({},R,{attrs:p,componentId:b}),r)},Object.defineProperty(g,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(v){this._foldedDefaultProps=n?rd({},e.defaultProps,v):v}}),Object.defineProperty(g,"toString",{value:function(){return"."+g.styledComponentId}}),i&&r_(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,A_.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}(id,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 N_=gr.div`
121
121
  position: fixed;
122
122
  top: 0;
123
123
  left: 0;
@@ -144,9 +144,9 @@ object-assign
144
144
  transform: rotate(360deg);
145
145
  }
146
146
  }
147
- `,nd=({isVisible:e})=>e?ye.jsx(N_,{children:ye.jsx(M_,{})}):null,id=K.createContext(null),ad=()=>{const e=K.useContext(id);if(!e)throw new Error("useAPI must be used within an APIProvider");return e},L_=({children:e})=>{const[t,r]=K.useState(0),n=K.useCallback(async a=>{r(o=>o+1);try{return await a}finally{r(o=>Math.max(0,o-1))}},[]),i=K.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(k,S)=>{const P={description:k,component_namespace:S};return await fetch(`${t}/create_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},getProjects:async()=>await fetch(`${t}/fetch_projects`,{method:"GET",headers:{"Content-Type":"application/json"}}),getSubdomains:async k=>await fetch(`${t}/subdomains?project_name=${k}`,{method:"GET",headers:{"Content-Type":"application/json"}}),allocateSubdomain:async(k,S)=>{const P={project_name:k,subdomain:S};return await fetch(`${t}/allocate_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},updateSubdomain:async(k,S)=>{const P={project_name:k,subdomain:S};return await fetch(`${t}/update_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},releaseSubdomain:async(k,S)=>{const P={project_name:k,subdomain:S};return await fetch(`${t}/release_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},publishProject:async(k,S)=>{const P={project_name:k,git_ref:S};return await fetch(`${t}/publish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},unpublishProject:async k=>{const S={project_name:k};return await fetch(`${t}/unpublish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},tagCommit:async(k,S,P)=>{const $={project_name:k,commit_hash:S,tag_name:P};return await fetch(`${t}/tag_project_commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},getComponentLibrary:async()=>await fetch(`${t}/library_components?namespaces=example`,{method:"GET",headers:{"Content-Type":"application/json"}}),addProjectComponent:async(k,S,P,$)=>{const j={project_name:k,component_namespace:S,component_name:P,layout_metadata:$};return await fetch(`${t}/add_project_component`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)})},addProjectChart:async(k,S,P)=>{const $={project_name:k,visual_id:S,layout_metadata:P};return await fetch(`${t}/add_project_chart`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},updateProjectComponentLayoutMetadata:async(k,S,P)=>{const $={project_name:k,component_id:S,layout_metadata:P};return await fetch(`${t}/update_project_component_layout_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},updateProjectComponentSourceCode:async(k,S,P)=>{const $={project_name:k,component_id:S,source_code:P};return await fetch(`${t}/update_project_component_source_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},updateApplicationMetadata:async(k,S,P,$)=>{const j={project_name:k,application_name:S,application_description:P,application_category:$};return await fetch(`${t}/update_application_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)})},updateApplicationSettings:async(k,S)=>{const P={project_name:k,application_login_enabled:S};return await fetch(`${t}/update_application_settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},deleteProjectFile:async(k,S)=>{const P={project_name:k,file_path:S};return await fetch(`${t}/delete_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},resetProjectFile:async(k,S,P,$,j)=>{let M={project_name:k,file_path:S,git_ref:P};return $&&(M.prune=$),j&&(M.extra_metadata=j),await fetch(`${t}/reset_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)})},deleteProject:async k=>{const S={projects:[k]};return await fetch(`${t}/delete_projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},requestErrorCorrection:async(k,S,P)=>{const $={project_name:k,component_id:S,error_message:P};return await fetch(`${t}/error_correction`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},addImage:async k=>await fetch(`${t}/add_image`,{method:"POST",body:k})}},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:[]})}),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"}})},getSubscription:async()=>await fetch(`${t}/v1/subscription`,{method:"GET",headers:{"Content-Type":"application/json"}})}},cd=e=>{const t=e;return{getSecrets:async()=>await fetch(`${t}/config/secrets`,{method:"GET",headers:{"Content-Type":"application/json"}}),putSecret:async(R,b)=>await fetch(`${t}/config/secrets/${R}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),getSecret:async R=>await fetch(`${t}/config/secrets/${R}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteSecret:async R=>await fetch(`${t}/config/secrets/${R}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),getTierKeyMap:async R=>await fetch(`${t}/config/miniapps/${R}/tier-key-map`,{method:"GET",headers:{"Content-Type":"application/json"}}),putTierKeyMap:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/tier-key-map/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret_reference:C})}),getTierKeyMapForTier:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/tier-key-map/${b}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteTierKeyMap:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/tier-key-map/${b}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),getTierAssignments:async R=>await fetch(`${t}/config/miniapps/${R}/assignments`,{method:"GET",headers:{"Content-Type":"application/json"}}),putTierAssignment:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/assignments/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:C})}),getTierAssignment:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/assignments/${b}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteTierAssignment:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/assignments/${b}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),getRateLimits:async R=>await fetch(`${t}/config/miniapps/${R}/rate-limits`,{method:"GET",headers:{"Content-Type":"application/json"}}),putRateLimit:async(R,b,C,k)=>await fetch(`${t}/config/miniapps/${R}/rate-limits/${b}/${C}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}),getRateLimit:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/rate-limits/${b}/${C}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteRateLimit:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/rate-limits/${b}/${C}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),createProxyFetch:R=>async(b,C)=>{const k=b instanceof URL?b:new URL(b.toString());return await fetch(`${t}/proxy/${R.miniappName}/${k.host}${k.pathname}${k.search}${k.hash}`,C)},createProxyGetView:R=>{const b=new URL(R.gwProxyUrl);return async(C,k,S={})=>{let P=`SELECT * FROM ${C}.${k}`;return S&&Object.keys(S).length>0&&(P+=`(${Object.entries(S).map(([$,j])=>`'${$}=${j}'`).join(",")})`),await fetch(`${t}/proxy/${R.miniappName}/${b}/v1/sql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:P})})}}}};for(var Xe=[],xs=0;xs<256;++xs)Xe.push((xs+256).toString(16).slice(1));function F_(e,t=0){return(Xe[e[t+0]]+Xe[e[t+1]]+Xe[e[t+2]]+Xe[e[t+3]]+"-"+Xe[e[t+4]]+Xe[e[t+5]]+"-"+Xe[e[t+6]]+Xe[e[t+7]]+"-"+Xe[e[t+8]]+Xe[e[t+9]]+"-"+Xe[e[t+10]]+Xe[e[t+11]]+Xe[e[t+12]]+Xe[e[t+13]]+Xe[e[t+14]]+Xe[e[t+15]]).toLowerCase()}var Oa,U_=new Uint8Array(16);function H_(){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(U_)}var W_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const ld={randomUUID:W_};function ud(e,t,r){if(ld.randomUUID&&!e)return ld.randomUUID();e=e||{};var n=e.random||(e.rng||H_)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,F_(n)}function G_(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 G_(o)?(...s)=>t(o.apply(i,s)):o}})},Es=K.createContext(null);Es.Consumer;const Y_=e=>{const[t,r]=K.useState({projectName:null,projectURL:null}),[n,i]=K.useState({API_BASE_URL:null,WS_BASE_URL:null,GW_BASE_URL:null,GW_PROXY_URL:null,PROXY_API_BASE_URL:null}),[a,o]=K.useState(()=>sd(e.config.GW_BASE_URL)),[s,l]=K.useState(!1),[c,u]=K.useState(""),[d,p]=K.useState(""),[m,g]=K.useState(""),[_,x]=K.useState(ud()),y=q_(e.config.API_BASE_URL),v=od(e.config.API_BASE_URL),O=y||v,[R,b]=K.useState(()=>cd(e.config.PROXY_API_BASE_URL)),[C,k]=K.useState(null),[S,P]=K.useState(null),[$,j]=K.useState(),[M,H]=K.useState(!1),Y=()=>{x(ud())},de=(Ce,le)=>{if(!Ce)return;$&&($.close(),H(!1));const be=localStorage.getItem("accessToken")||"",Ue=`${n.WS_BASE_URL}/ws/chat/${Ce}?token=${be}`;if(!Ue.startsWith("ws://")&&!Ue.startsWith("wss://")){le.onerror({customWebsocketError:"INVALID_URL"});return}const Be=new WebSocket(Ue);Be.onopen=()=>{H(!0),le.onopen()},Be.onclose=oe=>{H(!1),le.onclose(oe)},Be.onerror=oe=>{le.onerror(oe)},Be.onmessage=oe=>{le.onmessage(oe)},j(Be)};return K.useEffect(()=>{i(e==null?void 0:e.config)},[e.config]),K.useEffect(()=>(o(sd(n==null?void 0:n.GW_BASE_URL)),b(Ce=>{const le=cd(n==null?void 0:n.PROXY_API_BASE_URL);return t!=null&&t.projectName&&(k(le.createProxyFetch({miniappName:t==null?void 0:t.projectName})),P(le.createProxyGetView({miniappName:t==null?void 0:t.projectName,gwProxyUrl:n==null?void 0:n.GW_PROXY_URL}))),le}),()=>{$&&$.close()}),[n,t]),ye.jsx(Es.Provider,{value:{config:n,projectMetadata:t,setProjectMetadata:r,syncToken:_,setSyncToken:Y,selectedComponentId:c,setSelectedComponentId:u,selectedComponentXPath:d,setSelectedComponentXPath:p,selectedComponentHTML:m,setSelectedComponentHTML:g,isComponentSubselected:s,setIsComponentSubselected:l,APIHandler:O,gwAPIHandler:a,proxyHandler:R,proxyFetch:C,proxyGetView:S,startChatbot:de,chatbotWebsocket:$,chatbotWebsocketConnected:M},children:e.children})},X_=e=>ye.jsx(L_,{children:ye.jsx(Y_,{...e})}),Ss=()=>{const e=K.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}},V_=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},fd=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 _=`${s}/chart_config.json`;const x=await window.pfs.readFile(`${n}/${i}/${_}`,"utf8"),y=JSON.parse(x),v=d;g.component=ye.jsx(v,{chartConfig:y})}else{const _=d;g.component=ye.jsx(_,{})}t.push(g),r.push({...JSON.parse(m),i:o})}return{components:t,layout:r}},K_=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}`},J_=e=>{if(window.tailwind)window.tailwind.config=e;else throw new Error("Could not load tailwind theme: missing tailwind global.")},Q_=(e,t)=>{const[r,n]=K.useState("");return K.useEffect(()=>{(async()=>{try{const a=await K_(e,t);n(a)}catch(a){console.error("Error fetching background image URL:",a)}})()},[e,t]),r},ev=(e,t=[])=>{const[r,n]=K.useState(null);return K.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},tv=(e,t=[])=>{const[r,n]=K.useState(null);return K.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},rv=(e,t,r=[])=>{const[n,i]=K.useState(null);return K.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 dd={exports:{}},_i={},ks={exports:{}};(function(e,t){(function(r,n){n(t)})(Ci,function(r){function n(D){return function(Z,X,L,V,re,Q,ue){return D(Z,X,ue)}}function i(D){return function(Z,X,L,V){if(!Z||!X||typeof Z!="object"||typeof X!="object")return D(Z,X,L,V);var re=V.get(Z),Q=V.get(X);if(re&&Q)return re===X&&Q===Z;V.set(Z,X),V.set(X,Z);var ue=D(Z,X,L,V);return V.delete(Z),V.delete(X),ue}}function a(D,q){var Z={};for(var X in D)Z[X]=D[X];for(var X in q)Z[X]=q[X];return Z}function o(D){return D.constructor===Object||D.constructor==null}function s(D){return typeof D.then=="function"}function l(D,q){return D===q||D!==D&&q!==q}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",m="[object Map]",g="[object Number]",_="[object Object]",x="[object Set]",y="[object String]",v=Object.prototype.toString;function O(D){var q=D.areArraysEqual,Z=D.areDatesEqual,X=D.areMapsEqual,L=D.areObjectsEqual,V=D.areRegExpsEqual,re=D.areSetsEqual,Q=D.createIsNestedEqual,ue=Q(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,ue,Ee);var Et=Array.isArray(ie),We=Array.isArray(Re);if(Et||We)return Et===We&&q(ie,Re,ue,Ee);var Pe=v.call(ie);return Pe!==v.call(Re)?!1:Pe===d?Z(ie,Re,ue,Ee):Pe===p?V(ie,Re,ue,Ee):Pe===m?X(ie,Re,ue,Ee):Pe===x?re(ie,Re,ue,Ee):Pe===_||Pe===c?s(ie)||s(Re)?!1:L(ie,Re,ue,Ee):Pe===u||Pe===g||Pe===y?l(ie.valueOf(),Re.valueOf()):!1}return ne}function R(D,q,Z,X){var L=D.length;if(q.length!==L)return!1;for(;L-- >0;)if(!Z(D[L],q[L],L,L,D,q,X))return!1;return!0}var b=i(R);function C(D,q){return l(D.valueOf(),q.valueOf())}function k(D,q,Z,X){var L=D.size===q.size;if(!L)return!1;if(!D.size)return!0;var V={},re=0;return D.forEach(function(Q,ue){if(L){var ne=!1,ie=0;q.forEach(function(Re,Ee){!ne&&!V[ie]&&(ne=Z(ue,Ee,re,ie,D,q,X)&&Z(Q,Re,ue,Ee,D,q,X))&&(V[ie]=!0),ie++}),re++,L=ne}}),L}var S=i(k),P="_owner",$=Object.prototype.hasOwnProperty;function j(D,q,Z,X){var L=Object.keys(D),V=L.length;if(Object.keys(q).length!==V)return!1;for(var re;V-- >0;){if(re=L[V],re===P){var Q=!!D.$$typeof,ue=!!q.$$typeof;if((Q||ue)&&Q!==ue)return!1}if(!$.call(q,re)||!Z(D[re],q[re],re,re,D,q,X))return!1}return!0}var M=i(j);function H(D,q){return D.source===q.source&&D.flags===q.flags}function Y(D,q,Z,X){var L=D.size===q.size;if(!L)return!1;if(!D.size)return!0;var V={};return D.forEach(function(re,Q){if(L){var ue=!1,ne=0;q.forEach(function(ie,Re){!ue&&!V[ne]&&(ue=Z(re,ie,Q,Re,D,q,X))&&(V[ne]=!0),ne++}),L=ue}}),L}var de=i(Y),Ce=Object.freeze({areArraysEqual:R,areDatesEqual:C,areMapsEqual:k,areObjectsEqual:j,areRegExpsEqual:H,areSetsEqual:Y,createIsNestedEqual:n}),le=Object.freeze({areArraysEqual:b,areDatesEqual:C,areMapsEqual:S,areObjectsEqual:M,areRegExpsEqual:H,areSetsEqual:de,createIsNestedEqual:n}),be=O(Ce);function Ue(D,q){return be(D,q,void 0)}var Be=O(a(Ce,{createIsNestedEqual:function(){return l}}));function oe(D,q){return Be(D,q,void 0)}var F=O(le);function G(D,q){return F(D,q,new WeakMap)}var W=O(a(le,{createIsNestedEqual:function(){return l}}));function te(D,q){return W(D,q,new WeakMap)}function I(D){return O(a(Ce,D(Ce)))}function ee(D){var q=O(a(le,D(le)));return function(Z,X,L){return L===void 0&&(L=new WeakMap),q(Z,X,L)}}r.circularDeepEqual=G,r.circularShallowEqual=te,r.createCustomCircularEqual=ee,r.createCustomEqual=I,r.deepEqual=Ue,r.sameValueZeroEqual=l,r.shallowEqual=oe,Object.defineProperty(r,"__esModule",{value:!0})})})(ks,ks.exports);var Rs=ks.exports,Os={exports:{}};function hd(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=hd(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function pd(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=hd(e))&&(n&&(n+=" "),n+=t);return n}Os.exports=pd,Os.exports.clsx=pd;var Cs=Os.exports,pe={},nv=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(pe,"__esModule",{value:!0}),pe.bottom=Ts,pe.childrenEqual=ov,pe.cloneLayout=wd,pe.cloneLayoutItem=jr,pe.collides=Ca,pe.compact=yd,pe.compactItem=bd,pe.compactType=wv,pe.correctBounds=_d,pe.fastPositionEqual=sv,pe.fastRGLPropsEqual=void 0,pe.getAllCollisions=vd,pe.getFirstCollision=Br,pe.getLayoutItem=As,pe.getStatics=$s,pe.modifyLayout=gd,pe.moveElement=xi,pe.moveElementAwayFromCollision=Ds,pe.noop=void 0,pe.perc=lv,pe.resizeItemInDirection=fv,pe.setTopLeft=hv,pe.setTransform=dv,pe.sortLayoutItems=Ms,pe.sortLayoutItemsByColRow=Rd,pe.sortLayoutItemsByRowCol=kd,pe.synchronizeLayoutWithChildren=pv,pe.validateLayout=mv,pe.withLayoutItem=av;var md=Rs,vi=iv(K);function iv(e){return e&&e.__esModule?e:{default:e}}function Ts(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 wd(e){const t=Array(e.length);for(let r=0,n=e.length;r<n;r++)t[r]=jr(e[r]);return t}function gd(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 av(e,t,r){let n=As(e,t);return n?(n=r(jr(n)),e=gd(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 ov(e,t){return(0,md.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,md.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"]))}pe.fastRGLPropsEqual=nv;function sv(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 yd(e,t,r,n){const i=$s(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=bd(i,c,t,r,a,n),i.push(c)),o[e.indexOf(a[s])]=c,c.moved=!1}return o}const cv={x:"w",y:"h"};function Ps(e,t,r,n){const i=cv[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 bd(e,t,r,n,i,a){const o=r==="vertical",s=r==="horizontal";if(o)for(t.y=Math.min(Ts(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?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&&!Br(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function _d(e,t){const r=$s(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 vd(e,t){return e.filter(r=>Ca(r,t))}function $s(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=vd(d,t),g=m.length>0;if(g&&l)return wd(e);if(g&&a)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let _=0,x=m.length;_<x;_++){const y=m[_];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=Ds(e,y,t,i,o):e=Ds(e,t,y,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=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 lv(e){return e*100+"%"}const xd=(e,t,r,n)=>e+r>n?t:r,Ed=(e,t,r)=>e<0?t:r,Sd=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:Ed(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:xd(e.left,e.width,o,r),left:Sd(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:xd(e.left,e.width,a,r),top:Is(n),left:Sd(o)}},Ns=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{width:o,left:i,height:Ed(n,e.height,a),top:Is(n)}},uv={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 fv(e,t,r,n){const i=uv[e];return i?i(t,{...t,...r},n):r}function dv(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 hv(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"?Rd(e):t==="vertical"?kd(e):e}function kd(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 Rd(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 pv(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:Ts(a),i:String(s.key)}))});const o=_d(a,{cols:r});return i?o:yd(o,n,r)}function mv(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 wv(e){const{verticalCompact:t,compactType:r}=e||{};return t===!1?null:r}function Xx(){}const gv=()=>{};pe.noop=gv;var Ut={};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.calcGridColWidth=Ta,Ut.calcGridItemPosition=yv,Ut.calcGridItemWHPx=Ls,Ut.calcWH=_v,Ut.calcXY=bv,Ut.clamp=zr;function Ta(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 yv(e,t,r,n,i,a){const{margin:o,containerPadding:s,rowHeight:l}=e,c=Ta(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 bv(e,t,r,n,i){const{margin:a,containerPadding:o,cols:s,rowHeight:l,maxRows:c}=e,u=Ta(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 _v(e,t,r,n,i,a){const{margin:o,maxRows:s,cols:l,rowHeight:c}=e,u=Ta(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 Pa={},Od={exports:{}},vv="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xv=vv,Ev=xv;function Cd(){}function Td(){}Td.resetWarningCache=Cd;var Sv=function(){function e(n,i,a,o,s,l){if(l!==Ev){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:Td,resetWarningCache:Cd};return r.PropTypes=r,r};Od.exports=Sv();var yr=Od.exports,Aa={exports:{}},Pd={};function Ad(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=Ad(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function $d(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Ad(e))&&(n&&(n+=" "),n+=t);return n}const kv=Xa(Object.freeze(Object.defineProperty({__proto__:null,clsx:$d,default:$d},Symbol.toStringTag,{value:"Module"})));var je={},Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.dontSetMe=Pv,Ht.findInArray=Rv,Ht.int=Tv,Ht.isFunction=Ov,Ht.isNum=Cv;function Rv(e,t){for(let r=0,n=e.length;r<n;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function Ov(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Cv(e){return typeof e=="number"&&!isNaN(e)}function Tv(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=Id,Nr.browserPrefixToStyle=Av,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(Id(t,Fs[n])in r)return Fs[n];return""}function Id(e,t){return t?"".concat(t).concat($v(e)):e}function Av(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function $v(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=Nd,je.addEvent=jv,je.addUserSelectStyles=qv,je.createCSSTransform=Uv,je.createSVGTransform=Hv,je.getTouch=Wv,je.getTouchIdentifier=Gv,je.getTranslation=Us,je.innerHeight=Mv,je.innerWidth=Lv,je.matchesSelector=zd,je.matchesSelectorAndParentsTo=Iv,je.offsetXYFromParent=Fv,je.outerHeight=zv,je.outerWidth=Nv,je.removeClassName=Md,je.removeEvent=Bv,je.removeUserSelectStyles=Yv;var wt=Ht,jd=Dv(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 Dv(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 $a="";function zd(e,t){return $a||($a=(0,wt.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,wt.isFunction)(e[r])})),(0,wt.isFunction)(e[$a])?e[$a](t):!1}function Iv(e,t,r){let n=e;do{if(zd(n,t))return!0;if(n===r)return!1;n=n.parentNode}while(n);return!1}function jv(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 Bv(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 zv(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 Nv(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 Mv(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 Lv(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 Fv(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 Uv(e,t){const r=Us(e,t,"px");return{[(0,jd.browserPrefixToKey)("transform",jd.default)]:r}}function Hv(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 Wv(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 Gv(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;}
147
+ `,ad=({isVisible:e})=>e?be.jsx(N_,{children:be.jsx(M_,{})}):null,od=K.createContext(null),sd=()=>{const e=K.useContext(od);if(!e)throw new Error("useAPI must be used within an APIProvider");return e},L_=({children:e})=>{const[t,r]=K.useState(0),n=K.useCallback(async a=>{r(o=>o+1);try{return await a}finally{r(o=>Math.max(0,o-1))}},[]),i=K.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 be.jsxs(od.Provider,{value:{isLoading:t>0,wrapAPICall:n,wrapXHRCall:i},children:[be.jsx(ad,{isVisible:t>0}),e]})},xs=e=>{const t=e;return{createProject:async(k,S)=>{const P={description:k,component_namespace:S};return await fetch(`${t}/create_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},getProjects:async()=>await fetch(`${t}/fetch_projects`,{method:"GET",headers:{"Content-Type":"application/json"}}),getSubdomains:async k=>await fetch(`${t}/subdomains?project_name=${k}`,{method:"GET",headers:{"Content-Type":"application/json"}}),allocateSubdomain:async(k,S)=>{const P={project_name:k,subdomain:S};return await fetch(`${t}/allocate_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},updateSubdomain:async(k,S)=>{const P={project_name:k,subdomain:S};return await fetch(`${t}/update_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},releaseSubdomain:async(k,S)=>{const P={project_name:k,subdomain:S};return await fetch(`${t}/release_subdomain`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},publishProject:async(k,S)=>{const P={project_name:k,git_ref:S};return await fetch(`${t}/publish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},unpublishProject:async k=>{const S={project_name:k};return await fetch(`${t}/unpublish_project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},tagCommit:async(k,S,P)=>{const $={project_name:k,commit_hash:S,tag_name:P};return await fetch(`${t}/tag_project_commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},getComponentLibrary:async()=>await fetch(`${t}/library_components?namespaces=example`,{method:"GET",headers:{"Content-Type":"application/json"}}),addProjectComponent:async(k,S,P,$)=>{const j={project_name:k,component_namespace:S,component_name:P,layout_metadata:$};return await fetch(`${t}/add_project_component`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)})},addProjectChart:async(k,S,P)=>{const $={project_name:k,visual_id:S,layout_metadata:P};return await fetch(`${t}/add_project_chart`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},updateProjectComponentLayoutMetadata:async(k,S,P)=>{const $={project_name:k,component_id:S,layout_metadata:P};return await fetch(`${t}/update_project_component_layout_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},updateProjectComponentSourceCode:async(k,S,P)=>{const $={project_name:k,component_id:S,source_code:P};return await fetch(`${t}/update_project_component_source_code`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},updateApplicationMetadata:async(k,S,P,$)=>{const j={project_name:k,application_name:S,application_description:P,application_category:$};return await fetch(`${t}/update_application_metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)})},updateApplicationSettings:async(k,S)=>{const P={project_name:k,application_login_enabled:S};return await fetch(`${t}/update_application_settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},deleteProjectFile:async(k,S)=>{const P={project_name:k,file_path:S};return await fetch(`${t}/delete_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})},resetProjectFile:async(k,S,P,$,j)=>{let M={project_name:k,file_path:S,git_ref:P};return $&&(M.prune=$),j&&(M.extra_metadata=j),await fetch(`${t}/reset_project_file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)})},deleteProject:async k=>{const S={projects:[k]};return await fetch(`${t}/delete_projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)})},requestErrorCorrection:async(k,S,P)=>{const $={project_name:k,component_id:S,error_message:P};return await fetch(`${t}/error_correction`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})},addImage:async k=>await fetch(`${t}/add_image`,{method:"POST",body:k})}},cd=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:[]})}),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"}})},getSubscription:async()=>await fetch(`${t}/v1/subscription`,{method:"GET",headers:{"Content-Type":"application/json"}})}},Es=e=>{const t=e;return{getSecrets:async()=>await fetch(`${t}/config/secrets`,{method:"GET",headers:{"Content-Type":"application/json"}}),putSecret:async(R,b)=>await fetch(`${t}/config/secrets/${R}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),getSecret:async R=>await fetch(`${t}/config/secrets/${R}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteSecret:async R=>await fetch(`${t}/config/secrets/${R}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),getTierKeyMap:async R=>await fetch(`${t}/config/miniapps/${R}/tier-key-map`,{method:"GET",headers:{"Content-Type":"application/json"}}),putTierKeyMap:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/tier-key-map/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret_reference:C})}),getTierKeyMapForTier:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/tier-key-map/${b}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteTierKeyMap:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/tier-key-map/${b}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),getTierAssignments:async R=>await fetch(`${t}/config/miniapps/${R}/assignments`,{method:"GET",headers:{"Content-Type":"application/json"}}),putTierAssignment:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/assignments/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:C})}),getTierAssignment:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/assignments/${b}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteTierAssignment:async(R,b)=>await fetch(`${t}/config/miniapps/${R}/assignments/${b}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),getRateLimits:async R=>await fetch(`${t}/config/miniapps/${R}/rate-limits`,{method:"GET",headers:{"Content-Type":"application/json"}}),putRateLimit:async(R,b,C,k)=>await fetch(`${t}/config/miniapps/${R}/rate-limits/${b}/${C}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}),getRateLimit:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/rate-limits/${b}/${C}`,{method:"GET",headers:{"Content-Type":"application/json"}}),deleteRateLimit:async(R,b,C)=>await fetch(`${t}/config/miniapps/${R}/rate-limits/${b}/${C}`,{method:"DELETE",headers:{"Content-Type":"application/json"}}),createProxyFetch:R=>async(b,C)=>{const k=b instanceof URL?b:new URL(b.toString());return await fetch(`${t}/proxy/${R.miniappName}/${k.host}${k.pathname}${k.search}${k.hash}`,C)},createProxyGetView:R=>{const b=new URL(R.gwProxyUrl).hostname;return async(C,k,S={})=>{let P=`SELECT * FROM ${C}.${k}`;return S&&Object.keys(S).length>0&&(P+=`(${Object.entries(S).map(([$,j])=>`'${$}=${j}'`).join(",")})`),await fetch(`${t}/proxy/${R.miniappName}/${b}/v1/sql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:P})})}}}};for(var Xe=[],Ss=0;Ss<256;++Ss)Xe.push((Ss+256).toString(16).slice(1));function F_(e,t=0){return(Xe[e[t+0]]+Xe[e[t+1]]+Xe[e[t+2]]+Xe[e[t+3]]+"-"+Xe[e[t+4]]+Xe[e[t+5]]+"-"+Xe[e[t+6]]+Xe[e[t+7]]+"-"+Xe[e[t+8]]+Xe[e[t+9]]+"-"+Xe[e[t+10]]+Xe[e[t+11]]+Xe[e[t+12]]+Xe[e[t+13]]+Xe[e[t+14]]+Xe[e[t+15]]).toLowerCase()}var Oa,U_=new Uint8Array(16);function H_(){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(U_)}var W_=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const ld={randomUUID:W_};function ud(e,t,r){if(ld.randomUUID&&!e)return ld.randomUUID();e=e||{};var n=e.random||(e.rng||H_)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,F_(n)}function G_(e){return typeof e=="function"}const q_=e=>{const{wrapAPICall:t}=sd(),r=xs(e);return new Proxy(r,{get:(i,a)=>{const o=i[a];return G_(o)?(...s)=>t(o.apply(i,s)):o}})},ks=K.createContext(null);ks.Consumer;const Y_=e=>{const[t,r]=K.useState({projectName:null,projectURL:null}),[n,i]=K.useState({API_BASE_URL:null,WS_BASE_URL:null,GW_BASE_URL:null,GW_PROXY_URL:null,PROXY_API_BASE_URL:null}),[a,o]=K.useState(()=>cd(e.config.GW_BASE_URL)),[s,l]=K.useState(!1),[c,u]=K.useState(""),[d,p]=K.useState(""),[m,g]=K.useState(""),[_,x]=K.useState(ud()),y=q_(e.config.API_BASE_URL),v=xs(e.config.API_BASE_URL),O=y||v,[R,b]=K.useState(()=>Es(e.config.PROXY_API_BASE_URL)),[C,k]=K.useState(null),[S,P]=K.useState(null),[$,j]=K.useState(),[M,H]=K.useState(!1),Y=()=>{x(ud())},de=(Ce,le)=>{if(!Ce)return;$&&($.close(),H(!1));const _e=localStorage.getItem("accessToken")||"",Ue=`${n.WS_BASE_URL}/ws/chat/${Ce}?token=${_e}`;if(!Ue.startsWith("ws://")&&!Ue.startsWith("wss://")){le.onerror({customWebsocketError:"INVALID_URL"});return}const Be=new WebSocket(Ue);Be.onopen=()=>{H(!0),le.onopen()},Be.onclose=oe=>{H(!1),le.onclose(oe)},Be.onerror=oe=>{le.onerror(oe)},Be.onmessage=oe=>{le.onmessage(oe)},j(Be)};return K.useEffect(()=>{i(e==null?void 0:e.config)},[e.config]),K.useEffect(()=>(o(cd(n==null?void 0:n.GW_BASE_URL)),b(Ce=>{const le=Es(n==null?void 0:n.PROXY_API_BASE_URL);return t!=null&&t.projectName&&(k(le.createProxyFetch({miniappName:t==null?void 0:t.projectName})),P(le.createProxyGetView({miniappName:t==null?void 0:t.projectName,gwProxyUrl:n==null?void 0:n.GW_PROXY_URL}))),le}),()=>{$&&$.close()}),[n,t]),be.jsx(ks.Provider,{value:{config:n,projectMetadata:t,setProjectMetadata:r,syncToken:_,setSyncToken:Y,selectedComponentId:c,setSelectedComponentId:u,selectedComponentXPath:d,setSelectedComponentXPath:p,selectedComponentHTML:m,setSelectedComponentHTML:g,isComponentSubselected:s,setIsComponentSubselected:l,APIHandler:O,gwAPIHandler:a,proxyHandler:R,proxyFetch:C,proxyGetView:S,startChatbot:de,chatbotWebsocket:$,chatbotWebsocketConnected:M},children:e.children})},X_=e=>be.jsx(L_,{children:be.jsx(Y_,{...e})}),Rs=()=>{const e=K.useContext(ks);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=gc.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}},V_=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=gc.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:be.jsx(p,{})})}return t},fd=async e=>{let t=[],r=[];const n=`${window.miDir}/${e}`,i="src/ProjectComponents";let a=await Of(`${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 _=`${s}/chart_config.json`;const x=await window.pfs.readFile(`${n}/${i}/${_}`,"utf8"),y=JSON.parse(x),v=d;g.component=be.jsx(v,{chartConfig:y})}else{const _=d;g.component=be.jsx(_,{})}t.push(g),r.push({...JSON.parse(m),i:o})}return{components:t,layout:r}},K_=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}`},J_=e=>{if(window.tailwind)window.tailwind.config=e;else throw new Error("Could not load tailwind theme: missing tailwind global.")},Q_=(e,t)=>{const[r,n]=K.useState("");return K.useEffect(()=>{(async()=>{try{const a=await K_(e,t);n(a)}catch(a){console.error("Error fetching background image URL:",a)}})()},[e,t]),r},ev=(e,t=[])=>{const[r,n]=K.useState(null);return K.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},tv=(e,t=[])=>{const[r,n]=K.useState(null);return K.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},rv=(e,t,r=[])=>{const[n,i]=K.useState(null);return K.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 dd={exports:{}},_i={},Os={exports:{}};(function(e,t){(function(r,n){n(t)})(Ci,function(r){function n(D){return function(Z,X,L,V,re,Q,ue){return D(Z,X,ue)}}function i(D){return function(Z,X,L,V){if(!Z||!X||typeof Z!="object"||typeof X!="object")return D(Z,X,L,V);var re=V.get(Z),Q=V.get(X);if(re&&Q)return re===X&&Q===Z;V.set(Z,X),V.set(X,Z);var ue=D(Z,X,L,V);return V.delete(Z),V.delete(X),ue}}function a(D,q){var Z={};for(var X in D)Z[X]=D[X];for(var X in q)Z[X]=q[X];return Z}function o(D){return D.constructor===Object||D.constructor==null}function s(D){return typeof D.then=="function"}function l(D,q){return D===q||D!==D&&q!==q}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",m="[object Map]",g="[object Number]",_="[object Object]",x="[object Set]",y="[object String]",v=Object.prototype.toString;function O(D){var q=D.areArraysEqual,Z=D.areDatesEqual,X=D.areMapsEqual,L=D.areObjectsEqual,V=D.areRegExpsEqual,re=D.areSetsEqual,Q=D.createIsNestedEqual,ue=Q(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,ue,Ee);var Et=Array.isArray(ie),We=Array.isArray(Re);if(Et||We)return Et===We&&q(ie,Re,ue,Ee);var Pe=v.call(ie);return Pe!==v.call(Re)?!1:Pe===d?Z(ie,Re,ue,Ee):Pe===p?V(ie,Re,ue,Ee):Pe===m?X(ie,Re,ue,Ee):Pe===x?re(ie,Re,ue,Ee):Pe===_||Pe===c?s(ie)||s(Re)?!1:L(ie,Re,ue,Ee):Pe===u||Pe===g||Pe===y?l(ie.valueOf(),Re.valueOf()):!1}return ne}function R(D,q,Z,X){var L=D.length;if(q.length!==L)return!1;for(;L-- >0;)if(!Z(D[L],q[L],L,L,D,q,X))return!1;return!0}var b=i(R);function C(D,q){return l(D.valueOf(),q.valueOf())}function k(D,q,Z,X){var L=D.size===q.size;if(!L)return!1;if(!D.size)return!0;var V={},re=0;return D.forEach(function(Q,ue){if(L){var ne=!1,ie=0;q.forEach(function(Re,Ee){!ne&&!V[ie]&&(ne=Z(ue,Ee,re,ie,D,q,X)&&Z(Q,Re,ue,Ee,D,q,X))&&(V[ie]=!0),ie++}),re++,L=ne}}),L}var S=i(k),P="_owner",$=Object.prototype.hasOwnProperty;function j(D,q,Z,X){var L=Object.keys(D),V=L.length;if(Object.keys(q).length!==V)return!1;for(var re;V-- >0;){if(re=L[V],re===P){var Q=!!D.$$typeof,ue=!!q.$$typeof;if((Q||ue)&&Q!==ue)return!1}if(!$.call(q,re)||!Z(D[re],q[re],re,re,D,q,X))return!1}return!0}var M=i(j);function H(D,q){return D.source===q.source&&D.flags===q.flags}function Y(D,q,Z,X){var L=D.size===q.size;if(!L)return!1;if(!D.size)return!0;var V={};return D.forEach(function(re,Q){if(L){var ue=!1,ne=0;q.forEach(function(ie,Re){!ue&&!V[ne]&&(ue=Z(re,ie,Q,Re,D,q,X))&&(V[ne]=!0),ne++}),L=ue}}),L}var de=i(Y),Ce=Object.freeze({areArraysEqual:R,areDatesEqual:C,areMapsEqual:k,areObjectsEqual:j,areRegExpsEqual:H,areSetsEqual:Y,createIsNestedEqual:n}),le=Object.freeze({areArraysEqual:b,areDatesEqual:C,areMapsEqual:S,areObjectsEqual:M,areRegExpsEqual:H,areSetsEqual:de,createIsNestedEqual:n}),_e=O(Ce);function Ue(D,q){return _e(D,q,void 0)}var Be=O(a(Ce,{createIsNestedEqual:function(){return l}}));function oe(D,q){return Be(D,q,void 0)}var F=O(le);function G(D,q){return F(D,q,new WeakMap)}var W=O(a(le,{createIsNestedEqual:function(){return l}}));function te(D,q){return W(D,q,new WeakMap)}function I(D){return O(a(Ce,D(Ce)))}function ee(D){var q=O(a(le,D(le)));return function(Z,X,L){return L===void 0&&(L=new WeakMap),q(Z,X,L)}}r.circularDeepEqual=G,r.circularShallowEqual=te,r.createCustomCircularEqual=ee,r.createCustomEqual=I,r.deepEqual=Ue,r.sameValueZeroEqual=l,r.shallowEqual=oe,Object.defineProperty(r,"__esModule",{value:!0})})})(Os,Os.exports);var Cs=Os.exports,Ts={exports:{}};function hd(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=hd(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function pd(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=hd(e))&&(n&&(n+=" "),n+=t);return n}Ts.exports=pd,Ts.exports.clsx=pd;var Ps=Ts.exports,pe={},nv=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(pe,"__esModule",{value:!0}),pe.bottom=As,pe.childrenEqual=ov,pe.cloneLayout=wd,pe.cloneLayoutItem=jr,pe.collides=Ca,pe.compact=yd,pe.compactItem=bd,pe.compactType=wv,pe.correctBounds=_d,pe.fastPositionEqual=sv,pe.fastRGLPropsEqual=void 0,pe.getAllCollisions=vd,pe.getFirstCollision=Br,pe.getLayoutItem=Ds,pe.getStatics=Is,pe.modifyLayout=gd,pe.moveElement=xi,pe.moveElementAwayFromCollision=js,pe.noop=void 0,pe.perc=lv,pe.resizeItemInDirection=fv,pe.setTopLeft=hv,pe.setTransform=dv,pe.sortLayoutItems=Fs,pe.sortLayoutItemsByColRow=Rd,pe.sortLayoutItemsByRowCol=kd,pe.synchronizeLayoutWithChildren=pv,pe.validateLayout=mv,pe.withLayoutItem=av;var md=Cs,vi=iv(K);function iv(e){return e&&e.__esModule?e:{default:e}}function As(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 wd(e){const t=Array(e.length);for(let r=0,n=e.length;r<n;r++)t[r]=jr(e[r]);return t}function gd(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 av(e,t,r){let n=Ds(e,t);return n?(n=r(jr(n)),e=gd(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 ov(e,t){return(0,md.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,md.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"]))}pe.fastRGLPropsEqual=nv;function sv(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 yd(e,t,r,n){const i=Is(e),a=Fs(e,t),o=Array(e.length);for(let s=0,l=a.length;s<l;s++){let c=jr(a[s]);c.static||(c=bd(i,c,t,r,a,n),i.push(c)),o[e.indexOf(a[s])]=c,c.moved=!1}return o}const cv={x:"w",y:"h"};function $s(e,t,r,n){const i=cv[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)&&$s(e,s,r+t[i],n)}}t[n]=r}function bd(e,t,r,n,i,a){const o=r==="vertical",s=r==="horizontal";if(o)for(t.y=Math.min(As(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?$s(i,t,l.x+l.w,"x"):$s(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 _d(e,t){const r=Is(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 Ds(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 vd(e,t){return e.filter(r=>Ca(r,t))}function Is(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=Fs(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 wd(e);if(g&&a)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let _=0,x=m.length;_<x;_++){const y=m[_];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=js(e,y,t,i,o):e=js(e,t,y,i,o))}return e}function js(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 lv(e){return e*100+"%"}const xd=(e,t,r,n)=>e+r>n?t:r,Ed=(e,t,r)=>e<0?t:r,Sd=e=>Math.max(0,e),Bs=e=>Math.max(0,e),zs=(e,t,r)=>{let{left:n,height:i,width:a}=t;const o=e.top-(i-e.height);return{left:n,width:a,height:Ed(o,e.height,i),top:Bs(o)}},Ns=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{top:n,height:a,width:xd(e.left,e.width,o,r),left:Sd(i)}},Ms=(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:xd(e.left,e.width,a,r),top:Bs(n),left:Sd(o)}},Ls=(e,t,r)=>{let{top:n,left:i,height:a,width:o}=t;return{width:o,left:i,height:Ed(n,e.height,a),top:Bs(n)}},uv={n:zs,ne:function(){return zs(arguments.length<=0?void 0:arguments[0],Ns(...arguments))},e:Ns,se:function(){return Ls(arguments.length<=0?void 0:arguments[0],Ns(...arguments))},s:Ls,sw:function(){return Ls(arguments.length<=0?void 0:arguments[0],Ms(...arguments))},w:Ms,nw:function(){return zs(arguments.length<=0?void 0:arguments[0],Ms(...arguments))}};function fv(e,t,r,n){const i=uv[e];return i?i(t,{...t,...r},n):r}function dv(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 hv(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 Fs(e,t){return t==="horizontal"?Rd(e):t==="vertical"?kd(e):e}function kd(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 Rd(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 pv(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=Ds(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:As(a),i:String(s.key)}))});const o=_d(a,{cols:r});return i?o:yd(o,n,r)}function mv(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 wv(e){const{verticalCompact:t,compactType:r}=e||{};return t===!1?null:r}function Xx(){}const gv=()=>{};pe.noop=gv;var Ut={};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.calcGridColWidth=Ta,Ut.calcGridItemPosition=yv,Ut.calcGridItemWHPx=Us,Ut.calcWH=_v,Ut.calcXY=bv,Ut.clamp=zr;function Ta(e){const{margin:t,containerPadding:r,containerWidth:n,cols:i}=e;return(n-t[0]*(i-1)-r[0]*2)/i}function Us(e,t,r){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*r):e}function yv(e,t,r,n,i,a){const{margin:o,containerPadding:s,rowHeight:l}=e,c=Ta(e),u={};return a&&a.resizing?(u.width=Math.round(a.resizing.width),u.height=Math.round(a.resizing.height)):(u.width=Us(n,c,o[0]),u.height=Us(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 bv(e,t,r,n,i){const{margin:a,containerPadding:o,cols:s,rowHeight:l,maxRows:c}=e,u=Ta(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 _v(e,t,r,n,i,a){const{margin:o,maxRows:s,cols:l,rowHeight:c}=e,u=Ta(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 Pa={},Od={exports:{}},vv="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xv=vv,Ev=xv;function Cd(){}function Td(){}Td.resetWarningCache=Cd;var Sv=function(){function e(n,i,a,o,s,l){if(l!==Ev){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:Td,resetWarningCache:Cd};return r.PropTypes=r,r};Od.exports=Sv();var yr=Od.exports,Aa={exports:{}},Pd={};function Ad(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=Ad(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function $d(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Ad(e))&&(n&&(n+=" "),n+=t);return n}const kv=Xa(Object.freeze(Object.defineProperty({__proto__:null,clsx:$d,default:$d},Symbol.toStringTag,{value:"Module"})));var je={},Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.dontSetMe=Pv,Ht.findInArray=Rv,Ht.int=Tv,Ht.isFunction=Ov,Ht.isNum=Cv;function Rv(e,t){for(let r=0,n=e.length;r<n;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function Ov(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Cv(e){return typeof e=="number"&&!isNaN(e)}function Tv(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=Id,Nr.browserPrefixToStyle=Av,Nr.default=void 0,Nr.getPrefix=Dd;const Hs=["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<Hs.length;n++)if(Id(t,Hs[n])in r)return Hs[n];return""}function Id(e,t){return t?"".concat(t).concat($v(e)):e}function Av(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function $v(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=Nd,je.addEvent=jv,je.addUserSelectStyles=qv,je.createCSSTransform=Uv,je.createSVGTransform=Hv,je.getTouch=Wv,je.getTouchIdentifier=Gv,je.getTranslation=Ws,je.innerHeight=Mv,je.innerWidth=Lv,je.matchesSelector=zd,je.matchesSelectorAndParentsTo=Iv,je.offsetXYFromParent=Fv,je.outerHeight=zv,je.outerWidth=Nv,je.removeClassName=Md,je.removeEvent=Bv,je.removeUserSelectStyles=Yv;var wt=Ht,jd=Dv(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 Dv(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 $a="";function zd(e,t){return $a||($a=(0,wt.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,wt.isFunction)(e[r])})),(0,wt.isFunction)(e[$a])?e[$a](t):!1}function Iv(e,t,r){let n=e;do{if(zd(n,t))return!0;if(n===r)return!1;n=n.parentNode}while(n);return!1}function jv(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 Bv(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 zv(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 Nv(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 Mv(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 Lv(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 Fv(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 Uv(e,t){const r=Ws(e,t,"px");return{[(0,jd.browserPrefixToKey)("transform",jd.default)]:r}}function Hv(e,t){return Ws(e,t,"")}function Ws(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 Wv(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 Gv(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&&Nd(e.body,"react-draggable-transparent-selection")}function Yv(e){if(e)try{if(e.body&&Md(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 Nd(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Md(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=Vv,Wt.canDragY=Kv,Wt.createCoreData=Qv,Wt.createDraggableData=e1,Wt.getBoundPosition=Xv,Wt.getControlPosition=Jv,Wt.snapToGrid=Zv;var gt=Ht,vn=je;function Xv(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:n}=e.props;n=typeof n=="string"?n:t1(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 Vv(e){return e.props.axis==="both"||e.props.axis==="x"}function Kv(e){return e.props.axis==="both"||e.props.axis==="y"}function Jv(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 Qv(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 e1(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 t1(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 Da={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.default=r1;function r1(){}Object.defineProperty(Da,"__esModule",{value:!0}),Da.default=void 0;var Ws=i1(K),ft=qs(yr),n1=qs(pc),Je=je,br=Wt,Gs=Ht,Ei=qs(Ia);function qs(e){return e&&e.__esModule?e:{default:e}}function Ld(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Ld=function(n){return n?r:t})(e)}function i1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Ld(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=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=o1(e,"string");return typeof t=="symbol"?t:String(t)}function o1(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 Tt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let _r=Tt.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,Je.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,Je.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const i=(0,Je.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,Je.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=s,(0,Je.addEvent)(n,_r.move,this.handleDrag),(0,Je.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,Je.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,Je.removeEvent)(s.ownerDocument,_r.move,this.handleDrag),(0,Je.removeEvent)(s.ownerDocument,_r.stop,this.handleDragStop))}),at(this,"onMouseDown",t=>(_r=Tt.mouse,this.handleDragStart(t))),at(this,"onMouseUp",t=>(_r=Tt.mouse,this.handleDragStop(t))),at(this,"onTouchStart",t=>(_r=Tt.touch,this.handleDragStart(t))),at(this,"onTouchEnd",t=>(_r=Tt.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,Je.addEvent)(t,Tt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,Je.removeEvent)(r,Tt.mouse.move,this.handleDrag),(0,Je.removeEvent)(r,Tt.touch.move,this.handleDrag),(0,Je.removeEvent)(r,Tt.mouse.stop,this.handleDragStop),(0,Je.removeEvent)(r,Tt.touch.stop,this.handleDragStop),(0,Je.removeEvent)(t,Tt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Je.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:n1.default.findDOMNode(this)}render(){return Ws.cloneElement(Ws.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Da.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:Gs.dontSetMe,style:Gs.dontSetMe,transform:Gs.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(K),r=u(yr),n=u(pc),i=u(kv),a=je,o=Wt,s=Ht,l=u(Da),c=u(Ia);function u(v){return v&&v.__esModule?v:{default:v}}function d(v){if(typeof WeakMap!="function")return null;var O=new WeakMap,R=new WeakMap;return(d=function(b){return b?R:O})(v)}function p(v,O){if(v&&v.__esModule)return v;if(v===null||typeof v!="object"&&typeof v!="function")return{default:v};var R=d(O);if(R&&R.has(v))return R.get(v);var b={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var k in v)if(k!=="default"&&Object.prototype.hasOwnProperty.call(v,k)){var S=C?Object.getOwnPropertyDescriptor(v,k):null;S&&(S.get||S.set)?Object.defineProperty(b,k,S):b[k]=v[k]}return b.default=v,R&&R.set(v,b),b}function m(){return m=Object.assign?Object.assign.bind():function(v){for(var O=1;O<arguments.length;O++){var R=arguments[O];for(var b in R)Object.prototype.hasOwnProperty.call(R,b)&&(v[b]=R[b])}return v},m.apply(this,arguments)}function g(v,O,R){return O=_(O),O in v?Object.defineProperty(v,O,{value:R,enumerable:!0,configurable:!0,writable:!0}):v[O]=R,v}function _(v){var O=x(v,"string");return typeof O=="symbol"?O:String(O)}function x(v,O){if(typeof v!="object"||v===null)return v;var R=v[Symbol.toPrimitive];if(R!==void 0){var b=R.call(v,O||"default");if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(v)}class y extends t.Component{static getDerivedStateFromProps(O,R){let{position:b}=O,{prevPropsPosition:C}=R;return b&&(!C||b.x!==C.x||b.y!==C.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:b,prevPropsPosition:C}),{x:b.x,y:b.y,prevPropsPosition:{...b}}):null}constructor(O){super(O),g(this,"onDragStart",(R,b)=>{if((0,c.default)("Draggable: onDragStart: %j",b),this.props.onStart(R,(0,o.createDraggableData)(this,b))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(R,b)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",b);const C=(0,o.createDraggableData)(this,b),k={x:C.x,y:C.y,slackX:0,slackY:0};if(this.props.bounds){const{x:P,y:$}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[j,M]=(0,o.getBoundPosition)(this,k.x,k.y);k.x=j,k.y=M,k.slackX=this.state.slackX+(P-k.x),k.slackY=this.state.slackY+($-k.y),C.x=k.x,C.y=k.y,C.deltaX=k.x-this.state.x,C.deltaY=k.y-this.state.y}if(this.props.onDrag(R,C)===!1)return!1;this.setState(k)}),g(this,"onDragStop",(R,b)=>{if(!this.state.dragging||this.props.onStop(R,(0,o.createDraggableData)(this,b))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",b);const k={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:P,y:$}=this.props.position;k.x=P,k.y=$}this.setState(k)}),this.state={dragging:!1,dragged:!1,x:O.position?O.position.x:O.defaultPosition.x,y:O.position?O.position.y:O.defaultPosition.y,prevPropsPosition:{...O.position},slackX:0,slackY:0,isElementSVG:!1},O.position&&!(O.onDrag||O.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 O,R;return(O=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&O!==void 0?O:n.default.findDOMNode(this)}render(){const{axis:O,bounds:R,children:b,defaultPosition:C,defaultClassName:k,defaultClassNameDragging:S,defaultClassNameDragged:P,position:$,positionOffset:j,scale:M,...H}=this.props;let Y={},de=null;const le=!!!$||this.state.dragging,be=$||C,Ue={x:(0,o.canDragX)(this)&&le?this.state.x:be.x,y:(0,o.canDragY)(this)&&le?this.state.y:be.y};this.state.isElementSVG?de=(0,a.createSVGTransform)(Ue,j):Y=(0,a.createCSSTransform)(Ue,j);const Be=(0,i.default)(b.props.className||"",k,{[S]:this.state.dragging,[P]:this.state.dragged});return t.createElement(l.default,m({},H,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(b),{className:Be,style:{...b.props.style,...Y},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:Fd,DraggableCore:s1}=Pd;Aa.exports=Fd,Aa.exports.default=Fd,Aa.exports.DraggableCore=s1;var Ud=Aa.exports,Ba={exports:{}},Si={},Ys={};Ys.__esModule=!0,Ys.cloneElement=h1;var c1=l1(K);function l1(e){return e&&e.__esModule?e:{default:e}}function Hd(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 Wd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hd(Object(r),!0).forEach(function(n){u1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function u1(e,t,r){return t=f1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f1(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 h1(e,t){return t.style&&e.props.style&&(t.style=Wd(Wd({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),c1.default.cloneElement(e,t)}var ki={};ki.__esModule=!0,ki.resizableProps=void 0;var fe=p1(yr);function p1(e){return e&&e.__esModule?e:{default:e}}var m1={axis:fe.default.oneOf(["both","x","y","none"]),className:fe.default.string,children:fe.default.element.isRequired,draggableOpts:fe.default.shape({allowAnyClick:fe.default.bool,cancel:fe.default.string,children:fe.default.node,disabled:fe.default.bool,enableUserSelectHack:fe.default.bool,offsetParent:fe.default.node,grid:fe.default.arrayOf(fe.default.number),handle:fe.default.string,nodeRef:fe.default.object,onStart:fe.default.func,onDrag:fe.default.func,onStop:fe.default.func,onMouseDown:fe.default.func,scale:fe.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=fe.default.number).isRequired.apply(a,r)}return fe.default.number.apply(fe.default,r)},handle:fe.default.oneOfType([fe.default.node,fe.default.func]),handleSize:fe.default.arrayOf(fe.default.number),lockAspectRatio:fe.default.bool,maxConstraints:fe.default.arrayOf(fe.default.number),minConstraints:fe.default.arrayOf(fe.default.number),onResizeStop:fe.default.func,onResizeStart:fe.default.func,onResize:fe.default.func,resizeHandles:fe.default.arrayOf(fe.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:fe.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=fe.default.number).isRequired.apply(a,r)}return fe.default.number.apply(fe.default,r)}};ki.resizableProps=m1,Si.__esModule=!0,Si.default=void 0;var Ri=_1(K),w1=Ud,g1=Ys,y1=ki,b1=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Gd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Gd=function(i){return i?r:t})(e)}function _1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Gd(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 Xs(){return Xs=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},Xs.apply(this,arguments)}function v1(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){x1(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 x1(e,t,r){return t=E1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E1(e){var t=S1(e,"string");return typeof t=="symbol"?t:String(t)}function S1(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 k1(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){k1(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,_=this.slack||[0,0],x=_[0],y=_[1];return i+=x,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=[x+(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],_=a[a.length-1],x=c.getBoundingClientRect();if(o.lastHandleRect!=null){if(_==="w"){var y=x.left-o.lastHandleRect.left;u+=y}if(g==="n"){var v=x.top-o.lastHandleRect.top;d+=v}}o.lastHandleRect=x,_==="w"&&(u=-u),g==="n"&&(d=-d);var O=o.props.width+(p?u/o.props.transformScale:0),R=o.props.height+(m?d/o.props.transformScale:0),b=o.runConstraints(O,R);O=b[0],R=b[1];var C=O!==o.props.width||R!==o.props.height,k=typeof o.props[i]=="function"?o.props[i]:null,S=i==="onResize"&&!C;k&&!S&&(s.persist==null||s.persist(),k(s,{node:c,size:{width:O,height:R},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=v1(a,b1);return(0,g1.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(w1.DraggableCore,Xs({},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=y1.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(K),R1=Yd(yr),O1=Yd(Si),C1=ki,T1=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Yd(e){return e&&e.__esModule?e:{default:e}}function Xd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Xd=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=Xd(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){A1(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 A1(e,t,r){return t=$1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $1(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 I1(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 j1(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 Vd=function(e){j1(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,_=i.style,x=i.transformScale,y=I1(i,T1);return Js.createElement(O1.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},Js.createElement("div",Qs({},y,{style:Na(Na({},_),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(Js.Component);za.default=Vd,Vd.propTypes=Na(Na({},C1.resizableProps),{},{children:R1.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 B1=Ba.exports,er={};Object.defineProperty(er,"__esModule",{value:!0}),er.resizeHandleType=er.resizeHandleAxesType=er.default=void 0;var he=Kd(yr),z1=Kd(K);function Kd(e){return e&&e.__esModule?e:{default:e}}const N1=er.resizeHandleAxesType=he.default.arrayOf(he.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),M1=er.resizeHandleType=he.default.oneOfType([he.default.node,he.default.func]);er.default={className:he.default.string,style:he.default.object,width:he.default.number,autoSize:he.default.bool,cols:he.default.number,draggableCancel:he.default.string,draggableHandle:he.default.string,verticalCompact:function(e){e.verticalCompact},compactType:he.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&pe.validateLayout(t,"layout")},margin:he.default.arrayOf(he.default.number),containerPadding:he.default.arrayOf(he.default.number),rowHeight:he.default.number,maxRows:he.default.number,isBounded:he.default.bool,isDraggable:he.default.bool,isResizable:he.default.bool,allowOverlap:he.default.bool,preventCollision:he.default.bool,useCSSTransforms:he.default.bool,transformScale:he.default.number,isDroppable:he.default.bool,resizeHandles:N1,resizeHandle:M1,onLayoutChange:he.default.func,onDragStart:he.default.func,onDrag:he.default.func,onDragStop:he.default.func,onResizeStart:he.default.func,onResize:he.default.func,onResizeStop:he.default.func,onDrop:he.default.func,droppingItem:he.default.shape({i:he.default.string.isRequired,w:he.default.number.isRequired,h:he.default.number.isRequired}),children:function(e,t){const r=e[t],n={};z1.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:he.default.any},Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.default=void 0;var xn=tc(K),xe=tc(yr),L1=Ud,F1=B1,En=pe,Ze=Ut,Jd=er,U1=tc(Cs);function tc(e){return e&&e.__esModule?e:{default:e}}function Gt(e,t,r){return t=H1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H1(e){var t=W1(e,"string");return typeof t=="symbol"?t:String(t)}function W1(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),Gt(this,"state",{resizing:null,dragging:null,className:""}),Gt(this,"elementRef",xn.default.createRef()),Gt(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:_}=(0,Ze.calcXY)(this.getPositionParams(),o.top,o.left,this.props.w,this.props.h);return i.call(this,this.props.i,g,_,{e:t,node:n,newPosition:o})}),Gt(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:v}=n;if(v){const{margin:O,rowHeight:R,containerPadding:b}=this.props,C=v.clientHeight-(0,Ze.calcGridItemWHPx)(p,R,O[1]);s=(0,Ze.clamp)(s-b[1],0,C);const k=(0,Ze.calcGridColWidth)(g),S=m-(0,Ze.calcGridItemWHPx)(d,k,O[0]);l=(0,Ze.clamp)(l-b[0],0,S)}}const _={top:s,left:l};this.setState({dragging:_});const{x,y}=(0,Ze.calcXY)(g,s,l,d,p);return o.call(this,u,x,y,{e:t,node:n,newPosition:_})}),Gt(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,Ze.calcXY)(this.getPositionParams(),c,l,a,o);return i.call(this,s,d,p,{e:t,node:n,newPosition:u})}),Gt(this,"onResizeStop",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStop")),Gt(this,"onResizeStart",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStart")),Gt(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,Ze.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),i=(0,Ze.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(L1.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,Ze.calcGridItemPosition)(p,0,0,i,0).width,g=(0,Ze.calcGridItemPosition)(p,0,0,a,o),_=(0,Ze.calcGridItemPosition)(p,0,0,s,l),x=[g.width,g.height],y=[Math.min(_.width,m),Math.min(_.height,1/0)];return xn.default.createElement(F1.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:r.width,height:r.height,minConstraints:x,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:_,maxW:x}=this.props;let y=o;a&&(y=(0,En.resizeItemInDirection)(s,n,o,g),this.setState({resizing:i==="onResizeStop"?null:y}));let{w:v,h:O}=(0,Ze.calcWH)(this.getPositionParams(),y.width,y.height,c,u,s);v=(0,Ze.clamp)(v,Math.max(_,1),x),O=(0,Ze.clamp)(O,m,p),l.call(this,d,v,O,{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,Ze.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,U1.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}}Pa.default=rc,Gt(rc,"propTypes",{children:xe.default.element,cols:xe.default.number.isRequired,containerWidth:xe.default.number.isRequired,rowHeight:xe.default.number.isRequired,margin:xe.default.array.isRequired,maxRows:xe.default.number.isRequired,containerPadding:xe.default.array.isRequired,x:xe.default.number.isRequired,y:xe.default.number.isRequired,w:xe.default.number.isRequired,h:xe.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:xe.default.string.isRequired,resizeHandles:Jd.resizeHandleAxesType,resizeHandle:Jd.resizeHandleType,onDragStop:xe.default.func,onDragStart:xe.default.func,onDrag:xe.default.func,onResizeStop:xe.default.func,onResizeStart:xe.default.func,onResize:xe.default.func,isDraggable:xe.default.bool.isRequired,isResizable:xe.default.bool.isRequired,isBounded:xe.default.bool.isRequired,static:xe.default.bool,useCSSTransforms:xe.default.bool.isRequired,transformScale:xe.default.number,className:xe.default.string,handle:xe.default.string,cancel:xe.default.string,droppingPosition:xe.default.shape({e:xe.default.object.isRequired,left:xe.default.number.isRequired,top:xe.default.number.isRequired})}),Gt(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=X1(K),nc=Rs,G1=ic(Cs),ae=pe,q1=Ut,Qd=ic(Pa),Y1=ic(er);function ic(e){return e&&e.__esModule?e:{default:e}}function eh(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(eh=function(n){return n?r:t})(e)}function X1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=eh(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 Qe(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=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)}const th="react-grid-layout";let rh=!1;try{rh=/firefox/i.test(navigator.userAgent)}catch{}class Ma extends Mr.Component{constructor(){super(...arguments),Qe(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:[]}),Qe(this,"dragEnterCounter",0),Qe(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)}),Qe(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})}),Qe(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:_}=this.state;this.setState({activeDrag:null,layout:g,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(g,_)}),Qe(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))}),Qe(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,_,x,y;const[v,O]=(0,ae.withLayoutItem)(u,t,b=>{let C;return x=b.x,y=b.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(x=b.x+(b.w-r),r=b.x!==x&&x<0?b.w:r,x=x<0?0:x),["ne","n","nw"].indexOf(l)!==-1&&(y=b.y+(b.h-n),n=b.y!==y&&y<0?b.h:n,y=y<0?0:y),g=!0),p&&!m&&(C=(0,ae.getAllCollisions)(u,{...b,w:r,h:n,x,y}).filter(S=>S.i!==b.i).length>0,C&&(y=b.y,n=b.h,x=b.x,r=b.w,g=!1)),b.w=r,b.h=n,b});if(!O)return;_=v,g&&(_=(0,ae.moveElement)(v,O,x,y,!0,this.props.preventCollision,(0,ae.compactType)(this.props),d,m));const R={w:O.w,h:O.h,x:O.x,y:O.y,static:!0,i:t};this.props.onResize(_,c,O,R,a,o),this.setState({layout:m?_:(0,ae.compact)(_,(0,ae.compactType)(this.props),d),activeDrag:R})}),Qe(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)}),Qe(this,"onDragOver",t=>{var v;if(t.preventDefault(),t.stopPropagation(),rh&&!((v=t.nativeEvent.target)!=null&&v.classList.contains(th)))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(),_=t.clientX-g.left,x=t.clientY-g.top,y={left:_/u,top:x/u,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:O,top:R}=this.state.droppingPosition;(O!=_||R!=x)&&this.setState({droppingPosition:y})}}else{const O={cols:a,margin:i,maxRows:s,rowHeight:o,containerWidth:l,containerPadding:c||i},R=(0,q1.calcXY)(O,x,_,p.w,p.h);this.setState({droppingDOMNode:Mr.createElement("div",{key:p.i}),droppingPosition:y,layout:[...m,{...p,x:R.x,y:R.y,static:!1,isDraggable:!0}]})}}),Qe(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})}),Qe(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),Qe(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),Qe(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(Qd.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:_,draggableHandle:x,resizeHandles:y,resizeHandle:v}=this.props,{mounted:O,droppingPosition:R}=this.state,b=typeof n.isDraggable=="boolean"?n.isDraggable:!n.static&&u,C=typeof n.isResizable=="boolean"?n.isResizable:!n.static&&d,k=n.resizeHandles||y,S=b&&p&&n.isBounded!==!1;return Mr.createElement(Qd.default,{containerWidth:i,cols:a,margin:o,containerPadding:s||o,maxRows:c,rowHeight:l,cancel:_,handle:x,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:b,isResizable:C,isBounded:S,useCSSTransforms:m&&O,usePercentages:!O,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?R:void 0,resizeHandles:k,resizeHandle:v},t)}render(){const{className:t,style:r,isDroppable:n,innerRef:i}=this.props,a=(0,G1.default)(th,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,Qe(Ma,"displayName","ReactGridLayout"),Qe(Ma,"propTypes",Y1.default),Qe(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=Q1,Lr.getBreakpointFromWidth=K1,Lr.getColsFromBreakpoint=J1,Lr.sortBreakpoints=ac;var Fa=pe;function K1(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 J1(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function Q1(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 nh=tx(K),dt=ih(yr),oc=Rs,Sn=pe,Fr=Lr,ex=ih(_i);function ih(e){return e&&e.__esModule?e:{default:e}}function ah(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(ah=function(n){return n?r:t})(e)}function tx(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=ah(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=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=nx(e,"string");return typeof t=="symbol"?t:String(t)}function nx(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 oh=e=>Object.prototype.toString.call(e);function Ha(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class cc extends nh.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 nh.createElement(ex.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(oh(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+oh(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={},sh=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")()}(),ix=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Wa):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),ax=2;function ox(e,t){var r=!1,n=!1,i=0;function a(){r&&(r=!1,e()),n&&s()}function o(){ix(a)}function s(){var l=Date.now();if(r){if(l-i<ax)return;n=!0}else r=!0,n=!1,setTimeout(o,t);i=l}return s}var sx=20,cx=["top","right","bottom","left","width","height","size","weight"],lx=typeof MutationObserver<"u",ux=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=ox(this.refresh.bind(this),sx)}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),lx?(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=cx.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}(),ch=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},lh=qa(0,0,0,0);function Ga(e){return parseFloat(e)||0}function uh(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+Ga(a)},0)}function fx(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]=Ga(o)}return r}function dx(e){var t=e.getBBox();return qa(0,0,t.width,t.height)}function hx(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return lh;var n=kn(e).getComputedStyle(e),i=fx(n),a=i.left+i.right,o=i.top+i.bottom,s=Ga(n.width),l=Ga(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=uh(n,"left","right")+a),Math.round(l+o)!==r&&(l-=uh(n,"top","bottom")+o)),!mx(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 qa(i.left,i.top,s,l)}var px=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 mx(e){return e===kn(e).document.documentElement}function wx(e){return uc?px(e)?dx(e):hx(e):lh}function gx(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 ch(o,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),o}function qa(e,t,r,n){return{x:e,y:t,width:r,height:n}}var yx=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=qa(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=wx(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}(),bx=function(){function e(t,r){var n=gx(r);ch(this,{target:t,contentRect:n})}return e}(),_x=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new sh,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 yx(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 bx(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}(),fh=typeof WeakMap<"u"?new WeakMap:new sh,dh=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=ux.getInstance(),n=new _x(t,r,this);fh.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){dh.prototype[e]=function(){var t;return(t=fh.get(this))[e].apply(t,arguments)}});var vx=function(){return typeof Wa.ResizeObserver<"u"?Wa.ResizeObserver:dh}();const xx=Xa(Object.freeze(Object.defineProperty({__proto__:null,default:vx},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(lc,"__esModule",{value:!0}),lc.default=Px;var Ya=Rx(K),Ex=fc(yr),Sx=fc(xx),kx=fc(Cs);function fc(e){return e&&e.__esModule?e:{default:e}}function hh(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(hh=function(n){return n?r:t})(e)}function Rx(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=hh(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=Ox(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ox(e){var t=Cx(e,"string");return typeof t=="symbol"?t:String(t)}function Cx(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 Tx="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 Sx.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,kx.default)(this.props.className,Tx),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:Ex.default.bool}),t}(function(e){e.exports=_i.default,e.exports.utils=pe,e.exports.calculateUtils=Ut,e.exports.Responsive=La.default,e.exports.Responsive.utils=Lr,e.exports.WidthProvider=lc.default})(dd);var hc=dd.exports;const ph=St(hc),Ax=hc.WidthProvider(ph),$x=gr.div`
149
+ `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&Nd(e.body,"react-draggable-transparent-selection")}function Yv(e){if(e)try{if(e.body&&Md(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 Nd(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Md(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=Vv,Wt.canDragY=Kv,Wt.createCoreData=Qv,Wt.createDraggableData=e1,Wt.getBoundPosition=Xv,Wt.getControlPosition=Jv,Wt.snapToGrid=Zv;var gt=Ht,vn=je;function Xv(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:n}=e.props;n=typeof n=="string"?n:t1(n);const i=Gs(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 Vv(e){return e.props.axis==="both"||e.props.axis==="x"}function Kv(e){return e.props.axis==="both"||e.props.axis==="y"}function Jv(e,t,r){const n=typeof t=="number"?(0,vn.getTouch)(e,t):null;if(typeof t=="number"&&!n)return null;const i=Gs(r),a=r.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,vn.offsetXYFromParent)(n||e,a,r.props.scale)}function Qv(e,t,r){const n=!(0,gt.isNum)(e.lastX),i=Gs(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 e1(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 t1(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Gs(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var Da={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.default=r1;function r1(){}Object.defineProperty(Da,"__esModule",{value:!0}),Da.default=void 0;var qs=i1(K),ft=Xs(yr),n1=Xs(wc),Je=je,br=Wt,Ys=Ht,Ei=Xs(Ia);function Xs(e){return e&&e.__esModule?e:{default:e}}function Ld(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Ld=function(n){return n?r:t})(e)}function i1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Ld(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=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=o1(e,"string");return typeof t=="symbol"?t:String(t)}function o1(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 Tt={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let _r=Tt.mouse,ja=class extends qs.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,Je.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,Je.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const i=(0,Je.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,Je.addUserSelectStyles)(n),this.dragging=!0,this.lastX=o,this.lastY=s,(0,Je.addEvent)(n,_r.move,this.handleDrag),(0,Je.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,Je.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,Je.removeEvent)(s.ownerDocument,_r.move,this.handleDrag),(0,Je.removeEvent)(s.ownerDocument,_r.stop,this.handleDragStop))}),at(this,"onMouseDown",t=>(_r=Tt.mouse,this.handleDragStart(t))),at(this,"onMouseUp",t=>(_r=Tt.mouse,this.handleDragStop(t))),at(this,"onTouchStart",t=>(_r=Tt.touch,this.handleDragStart(t))),at(this,"onTouchEnd",t=>(_r=Tt.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,Je.addEvent)(t,Tt.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,Je.removeEvent)(r,Tt.mouse.move,this.handleDrag),(0,Je.removeEvent)(r,Tt.touch.move,this.handleDrag),(0,Je.removeEvent)(r,Tt.mouse.stop,this.handleDragStop),(0,Je.removeEvent)(r,Tt.touch.stop,this.handleDragStop),(0,Je.removeEvent)(t,Tt.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Je.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:n1.default.findDOMNode(this)}render(){return qs.cloneElement(qs.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Da.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:Ys.dontSetMe,style:Ys.dontSetMe,transform:Ys.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(K),r=u(yr),n=u(wc),i=u(kv),a=je,o=Wt,s=Ht,l=u(Da),c=u(Ia);function u(v){return v&&v.__esModule?v:{default:v}}function d(v){if(typeof WeakMap!="function")return null;var O=new WeakMap,R=new WeakMap;return(d=function(b){return b?R:O})(v)}function p(v,O){if(v&&v.__esModule)return v;if(v===null||typeof v!="object"&&typeof v!="function")return{default:v};var R=d(O);if(R&&R.has(v))return R.get(v);var b={},C=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var k in v)if(k!=="default"&&Object.prototype.hasOwnProperty.call(v,k)){var S=C?Object.getOwnPropertyDescriptor(v,k):null;S&&(S.get||S.set)?Object.defineProperty(b,k,S):b[k]=v[k]}return b.default=v,R&&R.set(v,b),b}function m(){return m=Object.assign?Object.assign.bind():function(v){for(var O=1;O<arguments.length;O++){var R=arguments[O];for(var b in R)Object.prototype.hasOwnProperty.call(R,b)&&(v[b]=R[b])}return v},m.apply(this,arguments)}function g(v,O,R){return O=_(O),O in v?Object.defineProperty(v,O,{value:R,enumerable:!0,configurable:!0,writable:!0}):v[O]=R,v}function _(v){var O=x(v,"string");return typeof O=="symbol"?O:String(O)}function x(v,O){if(typeof v!="object"||v===null)return v;var R=v[Symbol.toPrimitive];if(R!==void 0){var b=R.call(v,O||"default");if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(O==="string"?String:Number)(v)}class y extends t.Component{static getDerivedStateFromProps(O,R){let{position:b}=O,{prevPropsPosition:C}=R;return b&&(!C||b.x!==C.x||b.y!==C.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:b,prevPropsPosition:C}),{x:b.x,y:b.y,prevPropsPosition:{...b}}):null}constructor(O){super(O),g(this,"onDragStart",(R,b)=>{if((0,c.default)("Draggable: onDragStart: %j",b),this.props.onStart(R,(0,o.createDraggableData)(this,b))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(R,b)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",b);const C=(0,o.createDraggableData)(this,b),k={x:C.x,y:C.y,slackX:0,slackY:0};if(this.props.bounds){const{x:P,y:$}=k;k.x+=this.state.slackX,k.y+=this.state.slackY;const[j,M]=(0,o.getBoundPosition)(this,k.x,k.y);k.x=j,k.y=M,k.slackX=this.state.slackX+(P-k.x),k.slackY=this.state.slackY+($-k.y),C.x=k.x,C.y=k.y,C.deltaX=k.x-this.state.x,C.deltaY=k.y-this.state.y}if(this.props.onDrag(R,C)===!1)return!1;this.setState(k)}),g(this,"onDragStop",(R,b)=>{if(!this.state.dragging||this.props.onStop(R,(0,o.createDraggableData)(this,b))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",b);const k={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:P,y:$}=this.props.position;k.x=P,k.y=$}this.setState(k)}),this.state={dragging:!1,dragged:!1,x:O.position?O.position.x:O.defaultPosition.x,y:O.position?O.position.y:O.defaultPosition.y,prevPropsPosition:{...O.position},slackX:0,slackY:0,isElementSVG:!1},O.position&&!(O.onDrag||O.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 O,R;return(O=(R=this.props)===null||R===void 0||(R=R.nodeRef)===null||R===void 0?void 0:R.current)!==null&&O!==void 0?O:n.default.findDOMNode(this)}render(){const{axis:O,bounds:R,children:b,defaultPosition:C,defaultClassName:k,defaultClassNameDragging:S,defaultClassNameDragged:P,position:$,positionOffset:j,scale:M,...H}=this.props;let Y={},de=null;const le=!!!$||this.state.dragging,_e=$||C,Ue={x:(0,o.canDragX)(this)&&le?this.state.x:_e.x,y:(0,o.canDragY)(this)&&le?this.state.y:_e.y};this.state.isElementSVG?de=(0,a.createSVGTransform)(Ue,j):Y=(0,a.createCSSTransform)(Ue,j);const Be=(0,i.default)(b.props.className||"",k,{[S]:this.state.dragging,[P]:this.state.dragged});return t.createElement(l.default,m({},H,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(b),{className:Be,style:{...b.props.style,...Y},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:Fd,DraggableCore:s1}=Pd;Aa.exports=Fd,Aa.exports.default=Fd,Aa.exports.DraggableCore=s1;var Ud=Aa.exports,Ba={exports:{}},Si={},Zs={};Zs.__esModule=!0,Zs.cloneElement=h1;var c1=l1(K);function l1(e){return e&&e.__esModule?e:{default:e}}function Hd(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 Wd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Hd(Object(r),!0).forEach(function(n){u1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function u1(e,t,r){return t=f1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f1(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 h1(e,t){return t.style&&e.props.style&&(t.style=Wd(Wd({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),c1.default.cloneElement(e,t)}var ki={};ki.__esModule=!0,ki.resizableProps=void 0;var fe=p1(yr);function p1(e){return e&&e.__esModule?e:{default:e}}var m1={axis:fe.default.oneOf(["both","x","y","none"]),className:fe.default.string,children:fe.default.element.isRequired,draggableOpts:fe.default.shape({allowAnyClick:fe.default.bool,cancel:fe.default.string,children:fe.default.node,disabled:fe.default.bool,enableUserSelectHack:fe.default.bool,offsetParent:fe.default.node,grid:fe.default.arrayOf(fe.default.number),handle:fe.default.string,nodeRef:fe.default.object,onStart:fe.default.func,onDrag:fe.default.func,onStop:fe.default.func,onMouseDown:fe.default.func,scale:fe.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=fe.default.number).isRequired.apply(a,r)}return fe.default.number.apply(fe.default,r)},handle:fe.default.oneOfType([fe.default.node,fe.default.func]),handleSize:fe.default.arrayOf(fe.default.number),lockAspectRatio:fe.default.bool,maxConstraints:fe.default.arrayOf(fe.default.number),minConstraints:fe.default.arrayOf(fe.default.number),onResizeStop:fe.default.func,onResizeStart:fe.default.func,onResize:fe.default.func,resizeHandles:fe.default.arrayOf(fe.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:fe.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=fe.default.number).isRequired.apply(a,r)}return fe.default.number.apply(fe.default,r)}};ki.resizableProps=m1,Si.__esModule=!0,Si.default=void 0;var Ri=_1(K),w1=Ud,g1=Zs,y1=ki,b1=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Gd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Gd=function(i){return i?r:t})(e)}function _1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Gd(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 Vs(){return Vs=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},Vs.apply(this,arguments)}function v1(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 Ks(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){x1(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 x1(e,t,r){return t=E1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E1(e){var t=S1(e,"string");return typeof t=="symbol"?t:String(t)}function S1(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 k1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Js(e,t)}function Js(e,t){return Js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Js(e,t)}var Qs=function(e){k1(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,_=this.slack||[0,0],x=_[0],y=_[1];return i+=x,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=[x+(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],_=a[a.length-1],x=c.getBoundingClientRect();if(o.lastHandleRect!=null){if(_==="w"){var y=x.left-o.lastHandleRect.left;u+=y}if(g==="n"){var v=x.top-o.lastHandleRect.top;d+=v}}o.lastHandleRect=x,_==="w"&&(u=-u),g==="n"&&(d=-d);var O=o.props.width+(p?u/o.props.transformScale:0),R=o.props.height+(m?d/o.props.transformScale:0),b=o.runConstraints(O,R);O=b[0],R=b[1];var C=O!==o.props.width||R!==o.props.height,k=typeof o.props[i]=="function"?o.props[i]:null,S=i==="onResize"&&!C;k&&!S&&(s.persist==null||s.persist(),k(s,{node:c,size:{width:O,height:R},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=Ks({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=v1(a,b1);return(0,g1.cloneElement)(o,Ks(Ks({},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(w1.DraggableCore,Vs({},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=Qs,Qs.propTypes=y1.resizableProps,Qs.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 ec=P1(K),R1=Yd(yr),O1=Yd(Si),C1=ki,T1=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Yd(e){return e&&e.__esModule?e:{default:e}}function Xd(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Xd=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=Xd(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 tc(){return tc=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},tc.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){A1(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 A1(e,t,r){return t=$1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $1(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 I1(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 j1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,rc(e,t)}function rc(e,t){return rc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},rc(e,t)}var Vd=function(e){j1(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,_=i.style,x=i.transformScale,y=I1(i,T1);return ec.createElement(O1.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},ec.createElement("div",tc({},y,{style:Na(Na({},_),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(ec.Component);za.default=Vd,Vd.propTypes=Na(Na({},C1.resizableProps),{},{children:R1.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 B1=Ba.exports,er={};Object.defineProperty(er,"__esModule",{value:!0}),er.resizeHandleType=er.resizeHandleAxesType=er.default=void 0;var he=Kd(yr),z1=Kd(K);function Kd(e){return e&&e.__esModule?e:{default:e}}const N1=er.resizeHandleAxesType=he.default.arrayOf(he.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),M1=er.resizeHandleType=he.default.oneOfType([he.default.node,he.default.func]);er.default={className:he.default.string,style:he.default.object,width:he.default.number,autoSize:he.default.bool,cols:he.default.number,draggableCancel:he.default.string,draggableHandle:he.default.string,verticalCompact:function(e){e.verticalCompact},compactType:he.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;t!==void 0&&pe.validateLayout(t,"layout")},margin:he.default.arrayOf(he.default.number),containerPadding:he.default.arrayOf(he.default.number),rowHeight:he.default.number,maxRows:he.default.number,isBounded:he.default.bool,isDraggable:he.default.bool,isResizable:he.default.bool,allowOverlap:he.default.bool,preventCollision:he.default.bool,useCSSTransforms:he.default.bool,transformScale:he.default.number,isDroppable:he.default.bool,resizeHandles:N1,resizeHandle:M1,onLayoutChange:he.default.func,onDragStart:he.default.func,onDrag:he.default.func,onDragStop:he.default.func,onResizeStart:he.default.func,onResize:he.default.func,onResizeStop:he.default.func,onDrop:he.default.func,droppingItem:he.default.shape({i:he.default.string.isRequired,w:he.default.number.isRequired,h:he.default.number.isRequired}),children:function(e,t){const r=e[t],n={};z1.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:he.default.any},Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.default=void 0;var xn=nc(K),xe=nc(yr),L1=Ud,F1=B1,En=pe,Ze=Ut,Jd=er,U1=nc(Ps);function nc(e){return e&&e.__esModule?e:{default:e}}function Gt(e,t,r){return t=H1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H1(e){var t=W1(e,"string");return typeof t=="symbol"?t:String(t)}function W1(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 ic extends xn.default.Component{constructor(){super(...arguments),Gt(this,"state",{resizing:null,dragging:null,className:""}),Gt(this,"elementRef",xn.default.createRef()),Gt(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:_}=(0,Ze.calcXY)(this.getPositionParams(),o.top,o.left,this.props.w,this.props.h);return i.call(this,this.props.i,g,_,{e:t,node:n,newPosition:o})}),Gt(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:v}=n;if(v){const{margin:O,rowHeight:R,containerPadding:b}=this.props,C=v.clientHeight-(0,Ze.calcGridItemWHPx)(p,R,O[1]);s=(0,Ze.clamp)(s-b[1],0,C);const k=(0,Ze.calcGridColWidth)(g),S=m-(0,Ze.calcGridItemWHPx)(d,k,O[0]);l=(0,Ze.clamp)(l-b[0],0,S)}}const _={top:s,left:l};this.setState({dragging:_});const{x,y}=(0,Ze.calcXY)(g,s,l,d,p);return o.call(this,u,x,y,{e:t,node:n,newPosition:_})}),Gt(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,Ze.calcXY)(this.getPositionParams(),c,l,a,o);return i.call(this,s,d,p,{e:t,node:n,newPosition:u})}),Gt(this,"onResizeStop",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStop")),Gt(this,"onResizeStart",(t,r,n)=>this.onResizeHandler(t,r,n,"onResizeStart")),Gt(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,Ze.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),i=(0,Ze.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(L1.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,Ze.calcGridItemPosition)(p,0,0,i,0).width,g=(0,Ze.calcGridItemPosition)(p,0,0,a,o),_=(0,Ze.calcGridItemPosition)(p,0,0,s,l),x=[g.width,g.height],y=[Math.min(_.width,m),Math.min(_.height,1/0)];return xn.default.createElement(F1.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:r.width,height:r.height,minConstraints:x,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:_,maxW:x}=this.props;let y=o;a&&(y=(0,En.resizeItemInDirection)(s,n,o,g),this.setState({resizing:i==="onResizeStop"?null:y}));let{w:v,h:O}=(0,Ze.calcWH)(this.getPositionParams(),y.width,y.height,c,u,s);v=(0,Ze.clamp)(v,Math.max(_,1),x),O=(0,Ze.clamp)(O,m,p),l.call(this,d,v,O,{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,Ze.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,U1.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}}Pa.default=ic,Gt(ic,"propTypes",{children:xe.default.element,cols:xe.default.number.isRequired,containerWidth:xe.default.number.isRequired,rowHeight:xe.default.number.isRequired,margin:xe.default.array.isRequired,maxRows:xe.default.number.isRequired,containerPadding:xe.default.array.isRequired,x:xe.default.number.isRequired,y:xe.default.number.isRequired,w:xe.default.number.isRequired,h:xe.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:xe.default.string.isRequired,resizeHandles:Jd.resizeHandleAxesType,resizeHandle:Jd.resizeHandleType,onDragStop:xe.default.func,onDragStart:xe.default.func,onDrag:xe.default.func,onResizeStop:xe.default.func,onResizeStart:xe.default.func,onResize:xe.default.func,isDraggable:xe.default.bool.isRequired,isResizable:xe.default.bool.isRequired,isBounded:xe.default.bool.isRequired,static:xe.default.bool,useCSSTransforms:xe.default.bool.isRequired,transformScale:xe.default.number,className:xe.default.string,handle:xe.default.string,cancel:xe.default.string,droppingPosition:xe.default.shape({e:xe.default.object.isRequired,left:xe.default.number.isRequired,top:xe.default.number.isRequired})}),Gt(ic,"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=X1(K),ac=Cs,G1=oc(Ps),ae=pe,q1=Ut,Qd=oc(Pa),Y1=oc(er);function oc(e){return e&&e.__esModule?e:{default:e}}function eh(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(eh=function(n){return n?r:t})(e)}function X1(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=eh(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 Qe(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=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)}const th="react-grid-layout";let rh=!1;try{rh=/firefox/i.test(navigator.userAgent)}catch{}class Ma extends Mr.Component{constructor(){super(...arguments),Qe(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:[]}),Qe(this,"dragEnterCounter",0),Qe(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)}),Qe(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})}),Qe(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:_}=this.state;this.setState({activeDrag:null,layout:g,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(g,_)}),Qe(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))}),Qe(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,_,x,y;const[v,O]=(0,ae.withLayoutItem)(u,t,b=>{let C;return x=b.x,y=b.y,["sw","w","nw","n","ne"].indexOf(l)!==-1&&(["sw","nw","w"].indexOf(l)!==-1&&(x=b.x+(b.w-r),r=b.x!==x&&x<0?b.w:r,x=x<0?0:x),["ne","n","nw"].indexOf(l)!==-1&&(y=b.y+(b.h-n),n=b.y!==y&&y<0?b.h:n,y=y<0?0:y),g=!0),p&&!m&&(C=(0,ae.getAllCollisions)(u,{...b,w:r,h:n,x,y}).filter(S=>S.i!==b.i).length>0,C&&(y=b.y,n=b.h,x=b.x,r=b.w,g=!1)),b.w=r,b.h=n,b});if(!O)return;_=v,g&&(_=(0,ae.moveElement)(v,O,x,y,!0,this.props.preventCollision,(0,ae.compactType)(this.props),d,m));const R={w:O.w,h:O.h,x:O.x,y:O.y,static:!0,i:t};this.props.onResize(_,c,O,R,a,o),this.setState({layout:m?_:(0,ae.compact)(_,(0,ae.compactType)(this.props),d),activeDrag:R})}),Qe(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)}),Qe(this,"onDragOver",t=>{var v;if(t.preventDefault(),t.stopPropagation(),rh&&!((v=t.nativeEvent.target)!=null&&v.classList.contains(th)))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(),_=t.clientX-g.left,x=t.clientY-g.top,y={left:_/u,top:x/u,e:t};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:O,top:R}=this.state.droppingPosition;(O!=_||R!=x)&&this.setState({droppingPosition:y})}}else{const O={cols:a,margin:i,maxRows:s,rowHeight:o,containerWidth:l,containerPadding:c||i},R=(0,q1.calcXY)(O,x,_,p.w,p.h);this.setState({droppingDOMNode:Mr.createElement("div",{key:p.i}),droppingPosition:y,layout:[...m,{...p,x:R.x,y:R.y,static:!1,isDraggable:!0}]})}}),Qe(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})}),Qe(this,"onDragLeave",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),Qe(this,"onDragEnter",t=>{t.preventDefault(),t.stopPropagation(),this.dragEnterCounter++}),Qe(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,ac.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,ac.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,ac.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(Qd.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:_,draggableHandle:x,resizeHandles:y,resizeHandle:v}=this.props,{mounted:O,droppingPosition:R}=this.state,b=typeof n.isDraggable=="boolean"?n.isDraggable:!n.static&&u,C=typeof n.isResizable=="boolean"?n.isResizable:!n.static&&d,k=n.resizeHandles||y,S=b&&p&&n.isBounded!==!1;return Mr.createElement(Qd.default,{containerWidth:i,cols:a,margin:o,containerPadding:s||o,maxRows:c,rowHeight:l,cancel:_,handle:x,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:b,isResizable:C,isBounded:S,useCSSTransforms:m&&O,usePercentages:!O,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?R:void 0,resizeHandles:k,resizeHandle:v},t)}render(){const{className:t,style:r,isDroppable:n,innerRef:i}=this.props,a=(0,G1.default)(th,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,Qe(Ma,"displayName","ReactGridLayout"),Qe(Ma,"propTypes",Y1.default),Qe(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=Q1,Lr.getBreakpointFromWidth=K1,Lr.getColsFromBreakpoint=J1,Lr.sortBreakpoints=sc;var Fa=pe;function K1(e,t){const r=sc(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 J1(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]}function Q1(e,t,r,n,i,a){if(e[r])return(0,Fa.cloneLayout)(e[r]);let o=e[n];const s=sc(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 sc(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 nh=tx(K),dt=ih(yr),cc=Cs,Sn=pe,Fr=Lr,ex=ih(_i);function ih(e){return e&&e.__esModule?e:{default:e}}function ah(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(ah=function(n){return n?r:t})(e)}function tx(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=ah(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 lc(){return lc=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},lc.apply(this,arguments)}function Ua(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=nx(e,"string");return typeof t=="symbol"?t:String(t)}function nx(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 oh=e=>Object.prototype.toString.call(e);function Ha(e,t){return e==null?null:Array.isArray(e)?e:e[t]}class uc extends nh.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,cc.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,cc.deepEqual)(this.props.breakpoints,t.breakpoints)||!(0,cc.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 nh.createElement(ex.default,lc({},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=uc,Ua(uc,"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(oh(e[t])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+oh(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(uc,"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 fc={},sh=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}()}(),dc=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")()}(),ix=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Wa):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),ax=2;function ox(e,t){var r=!1,n=!1,i=0;function a(){r&&(r=!1,e()),n&&s()}function o(){ix(a)}function s(){var l=Date.now();if(r){if(l-i<ax)return;n=!0}else r=!0,n=!1,setTimeout(o,t);i=l}return s}var sx=20,cx=["top","right","bottom","left","width","height","size","weight"],lx=typeof MutationObserver<"u",ux=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=ox(this.refresh.bind(this),sx)}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(){!dc||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),lx?(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(){!dc||!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=cx.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}(),ch=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},lh=qa(0,0,0,0);function Ga(e){return parseFloat(e)||0}function uh(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+Ga(a)},0)}function fx(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]=Ga(o)}return r}function dx(e){var t=e.getBBox();return qa(0,0,t.width,t.height)}function hx(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return lh;var n=kn(e).getComputedStyle(e),i=fx(n),a=i.left+i.right,o=i.top+i.bottom,s=Ga(n.width),l=Ga(n.height);if(n.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=uh(n,"left","right")+a),Math.round(l+o)!==r&&(l-=uh(n,"top","bottom")+o)),!mx(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 qa(i.left,i.top,s,l)}var px=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 mx(e){return e===kn(e).document.documentElement}function wx(e){return dc?px(e)?dx(e):hx(e):lh}function gx(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 ch(o,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),o}function qa(e,t,r,n){return{x:e,y:t,width:r,height:n}}var yx=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=qa(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=wx(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}(),bx=function(){function e(t,r){var n=gx(r);ch(this,{target:t,contentRect:n})}return e}(),_x=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new sh,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 yx(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 bx(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}(),fh=typeof WeakMap<"u"?new WeakMap:new sh,dh=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=ux.getInstance(),n=new _x(t,r,this);fh.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){dh.prototype[e]=function(){var t;return(t=fh.get(this))[e].apply(t,arguments)}});var vx=function(){return typeof Wa.ResizeObserver<"u"?Wa.ResizeObserver:dh}();const xx=Xa(Object.freeze(Object.defineProperty({__proto__:null,default:vx},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(fc,"__esModule",{value:!0}),fc.default=Px;var Ya=Rx(K),Ex=hc(yr),Sx=hc(xx),kx=hc(Ps);function hc(e){return e&&e.__esModule?e:{default:e}}function hh(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(hh=function(n){return n?r:t})(e)}function Rx(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=hh(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 pc(){return pc=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},pc.apply(this,arguments)}function Rn(e,t,r){return t=Ox(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ox(e){var t=Cx(e,"string");return typeof t=="symbol"?t:String(t)}function Cx(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 Tx="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 Sx.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,kx.default)(this.props.className,Tx),style:this.props.style,ref:this.elementRef}):Ya.createElement(e,pc({innerRef:this.elementRef},i,this.state))}},Rn(t,"defaultProps",{measureBeforeMount:!1}),Rn(t,"propTypes",{measureBeforeMount:Ex.default.bool}),t}(function(e){e.exports=_i.default,e.exports.utils=pe,e.exports.calculateUtils=Ut,e.exports.Responsive=La.default,e.exports.Responsive.utils=Lr,e.exports.WidthProvider=fc.default})(dd);var mc=dd.exports;const ph=St(mc),Ax=mc.WidthProvider(ph),$x=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
- `,mh=e=>ye.jsx(ye.Fragment,{children:ye.jsx($x,{children:ye.jsx(Ax,{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`
177
+ `,mh=e=>be.jsx(be.Fragment,{children:be.jsx($x,{children:be.jsx(Ax,{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=>be.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
- `,Ix=()=>{const[e,t]=K.useState([]),[r,n]=K.useState([]),[i,a]=K.useState(!1),{projectMetadata:o}=Ss(),s=async()=>{a(!0),await Cf(o.projectName,o.projectURL),a(!1),await ss(o.projectName,o.projectURL),await Sb(o.projectName);const l=await fd(o.projectName);t(l.components),n(l.layout)};return K.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(mh,{components:e,layout:r})})})]})})},jx=K.forwardRef(({style:e,className:t,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:a,componentId:o},s)=>{const{selectedComponentId:l}=Ss(),c=K.useMemo(()=>l===o,[l]),u=K.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 Bx extends K.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 zx=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})}),Nx=hc.WidthProvider(ph),Mx=gr.div`
196
+ `,Ix=()=>{const[e,t]=K.useState([]),[r,n]=K.useState([]),[i,a]=K.useState(!1),{projectMetadata:o}=Rs(),s=async()=>{a(!0),await Pf(o.projectName,o.projectURL),a(!1),await ss(o.projectName,o.projectURL),await Sb(o.projectName);const l=await fd(o.projectName);t(l.components),n(l.layout)};return K.useEffect(()=>{!o.projectName&&!o.projectURL||s()},[o.projectName,o.projectURL]),be.jsx(be.Fragment,{children:be.jsxs(Dx,{children:[be.jsx(ad,{isVisible:i}),be.jsx("div",{className:"mi-container",children:be.jsx("div",{className:"mi-workspace",style:{backgroundColor:"#6f4d80"},children:be.jsx(mh,{components:e,layout:r})})})]})})},jx=K.forwardRef(({style:e,className:t,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:a,componentId:o},s)=>{const{selectedComponentId:l}=Rs(),c=K.useMemo(()=>l===o,[l]),u=K.Children.toArray(a),d=u.filter(m=>m.key===".$resizableHandle-se"),p=u.filter(m=>m.key!==".$resizableHandle-se");return be.jsxs("div",{style:{...e},className:t+(c?" selected":""),ref:s,onMouseDown:r,onMouseUp:n,onTouchEnd:i,children:[be.jsx("div",{className:"grid-item "+(c?"selected":""),children:p}),d]})});class Bx extends K.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)?be.jsx(i,{error:r,...a}):n}resetState(){this.state={hasError:!1,error:null}}}const zx=e=>be.jsx(be.Fragment,{children:be.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})}),Nx=mc.WidthProvider(ph),Mx=gr.div`
197
197
  .react-grid-layout {
198
198
  position: relative;
199
199
  // transition: height 200ms ease;
@@ -269,4 +269,4 @@ object-assign
269
269
  .react-grid-drag-handle {
270
270
  cursor: move;
271
271
  }
272
- `,Fx=e=>ye.jsx(ye.Fragment,{children:ye.jsx(Mx,{children:ye.jsx(Lx,{children:ye.jsx(Nx,{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})})})}),Ux=()=>{typeof window<"u"&&(window.Buffer=Ja.Buffer,window.fs=new fp("fs"),window.pfs=window.fs.promises,window.miDir="/mi")};ve.MiniApp=Ix,ve.ProjectProvider=X_,ve.RGComponent=jx,ve.RGComponentErrorBoundary=Bx,ve.RGDroppable=zx,ve.RGEditLayout=Fx,ve.RGPreviewLayout=mh,ve.getHeadCommit=Ob,ve.getRedoTargetCommitForFile=Tb,ve.getTags=ss,ve.getUndoTargetCommitForFile=Cb,ve.initializeMakeInfinite=Ux,ve.listDir=kf,ve.loadLibraryComponents=V_,ve.loadProjectComponents=fd,ve.setTailwindTheme=J_,ve.syncAndRetry=Cf,ve.useAPI=ad,ve.useAppMetadata=ev,ve.useAppSettings=tv,ve.useAppVersions=rv,ve.useB64UrlForProjectImage=Q_,ve.useProject=Ss,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});
272
+ `,Fx=e=>be.jsx(be.Fragment,{children:be.jsx(Mx,{children:be.jsx(Lx,{children:be.jsx(Nx,{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})})})}),Ux=()=>{typeof window<"u"&&(window.Buffer=Ja.Buffer,window.fs=new fp("fs"),window.pfs=window.fs.promises,window.miDir="/mi")};ye.APIHandler=xs,ye.APIProxyHandler=Es,ye.MiniApp=Ix,ye.ProjectProvider=X_,ye.RGComponent=jx,ye.RGComponentErrorBoundary=Bx,ye.RGDroppable=zx,ye.RGEditLayout=Fx,ye.RGPreviewLayout=mh,ye.getHeadCommit=Ob,ye.getRedoTargetCommitForFile=Tb,ye.getTags=ss,ye.getUndoTargetCommitForFile=Cb,ye.initializeMakeInfinite=Ux,ye.listDir=Of,ye.loadLibraryComponents=V_,ye.loadProjectComponents=fd,ye.setTailwindTheme=J_,ye.syncAndRetry=Pf,ye.useAPI=sd,ye.useAppMetadata=ev,ye.useAppSettings=tv,ye.useAppVersions=rv,ye.useB64UrlForProjectImage=Q_,ye.useProject=Rs,Object.defineProperty(ye,Symbol.toStringTag,{value:"Module"})});