git-truck 4.0.0 → 5.0.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.
- package/build/client/assets/ChevronButton-DMAgHXfP.js +1 -0
- package/build/client/assets/{CollapsibleHeader-Bu4p-oqI.js → CollapsibleHeader-D64_oUaZ.js} +1 -1
- package/build/client/assets/Tooltip-DD8MeSQ5.js +5 -0
- package/build/client/assets/api.abort-BsuDY3rd.js +1 -0
- package/build/client/assets/api.abort-D0XxKxsc.js +1 -0
- package/build/client/assets/api.commits-B87eK7HE.js +1 -0
- package/build/client/assets/api.commits-C8MoPAnE.js +1 -0
- package/build/client/assets/api.progress-BjsGOmGF.js +1 -0
- package/build/client/assets/api.progress-ClQ--CbT.js +1 -0
- package/build/client/assets/browse-Dt072k2G.js +1 -0
- package/build/client/assets/browse-NZo8Wkxj.js +1 -0
- package/build/client/assets/clear-cache-BdOk-5Hg.js +1 -0
- package/build/client/assets/clear-cache-Dpk-kNlJ.js +1 -0
- package/build/client/assets/{dist-QDdB6dtJ.js → dist-Q88wN5JZ.js} +1 -1
- package/build/client/assets/{manifest-a38e366c.js → manifest-fcb52500.js} +1 -1
- package/build/client/assets/{root-CA2KruPD.js → root-Bw7JpNPD.js} +2 -2
- package/build/client/assets/root-ulNnm43y.css +2 -0
- package/build/client/assets/{ui-HOyuwkxV.js → ui-BlLnrEiL.js} +1 -1
- package/build/client/assets/util-DXfdT-4_.js +44 -0
- package/build/client/assets/view-BO8_n49o.js +4 -0
- package/build/client/assets/viewParams-CYa4lbK3.js +1 -0
- package/build/server/assets/{server-build-D8iMgYfe.js → server-build-ChRJnQIf.js} +6448 -5886
- package/build/server/index.js +1 -1
- package/cli.mjs +270 -52
- package/package.json +2 -2
- package/build/client/assets/ChevronButton-ANoRM4oe.js +0 -1
- package/build/client/assets/Tooltip-DRu0grUy.js +0 -5
- package/build/client/assets/api.abort-CX5xkHwa.js +0 -1
- package/build/client/assets/api.abort-DxAkeS-W.js +0 -1
- package/build/client/assets/api.commits-DAF4WH2m.js +0 -1
- package/build/client/assets/api.commits-iEgBtL-A.js +0 -1
- package/build/client/assets/api.progress-BENNzkFW.js +0 -1
- package/build/client/assets/api.progress-DICNnGq5.js +0 -1
- package/build/client/assets/browse-DGrdg-dm.js +0 -1
- package/build/client/assets/browse-Mvd04mK4.js +0 -1
- package/build/client/assets/clear-cache-BTEuD7P-.js +0 -1
- package/build/client/assets/clear-cache-BdU23_cx.js +0 -1
- package/build/client/assets/root-CV-2KSQa.css +0 -2
- package/build/client/assets/util-CPW5oMgy.js +0 -44
- package/build/client/assets/view-Cwcd1vTK.js +0 -4
- package/build/client/assets/viewParams-BaE5Z0S4.js +0 -1
package/cli.mjs
CHANGED
|
@@ -362,7 +362,7 @@ var n=an(),r=P(`node:events`).EventEmitter,i=on(),a=wn(),o=Cn(),s=Nn(),c=zn();e=
|
|
|
362
362
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
363
363
|
* MIT Licensed
|
|
364
364
|
*/
|
|
365
|
-
t.exports=Vn()}))(),1),Un=`
|
|
365
|
+
t.exports=Vn()}))(),1),Un=`5.0.0`,Wn=class extends Error{constructor(e){super(`${e} is locked`)}};const Gn={old:new Set,young:new Set},Kn=1024,qn=65535;let Jn;const Yn=()=>{let e=y.networkInterfaces(),t=new Set([void 0,`0.0.0.0`]);for(let n of Object.values(e))for(let e of n)t.add(e.address);return t},Xn=e=>new Promise((t,n)=>{let r=v.createServer();r.unref(),r.on(`error`,n),r.listen(e,()=>{let{port:e}=r.address();r.close(()=>{t(e)})})}),Zn=async(e,t)=>{if(e.host||e.port===0)return Xn(e);for(let n of t)try{await Xn({port:e.port,host:n})}catch(e){if(![`EADDRNOTAVAIL`,`EINVAL`].includes(e.code))throw e}return e.port},Qn=function*(e){e&&(yield*e),yield 0};async function $n(e){let t,n=new Set;if(e&&(e.port&&(t=typeof e.port==`number`?[e.port]:e.port),e.exclude)){let t=e.exclude;if(typeof t[Symbol.iterator]!=`function`)throw TypeError("The `exclude` option must be an iterable.");for(let e of t){if(typeof e!=`number`)throw TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(e))throw TypeError(`Number ${e} in the exclude option is not a safe integer and can't be used`)}n=new Set(t)}Jn===void 0&&(Jn=setTimeout(()=>{Jn=void 0,Gn.old=Gn.young,Gn.young=new Set},15e3),Jn.unref&&Jn.unref());let r=Yn();for(let i of Qn(t))try{if(n.has(i))continue;let t=await Zn({...e,port:i},r);for(;Gn.old.has(t)||Gn.young.has(t);){if(i!==0)throw new Wn(i);t=await Zn({...e,port:i},r)}return Gn.young.add(t),t}catch(e){if(![`EADDRINUSE`,`EACCES`].includes(e.code)&&!(e instanceof Wn))throw e}throw Error(`No available ports found`)}function er(e,t){if(!Number.isInteger(e)||!Number.isInteger(t))throw TypeError("`from` and `to` must be integer numbers");if(e<Kn||e>qn)throw RangeError(`'from' must be between ${Kn} and ${qn}`);if(t<Kn||t>qn)throw RangeError(`'to' must be between ${Kn} and ${qn}`);if(e>t)throw RangeError("`to` must be greater than or equal to `from`");return function*(e,t){for(let n=e;n<=t;n++)yield n}(e,t)}let tr;function nr(){try{return d.statSync(`/.dockerenv`),!0}catch{return!1}}function rr(){try{return d.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function ir(){return tr===void 0&&(tr=nr()||rr()),tr}let ar;const or=()=>{try{return d.statSync(`/run/.containerenv`),!0}catch{return!1}};function sr(){return ar===void 0&&(ar=or()||ir()),ar}const cr=()=>{if(C.platform!==`linux`)return!1;if(y.release().toLowerCase().includes(`microsoft`))return!sr();try{if(d.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`))return!sr()}catch{}return d.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)||d.existsSync(`/run/WSL`)?!sr():!1};var lr=C.env.__IS_WSL_TEST__?cr:cr();const ur=A(T.execFile),dr=()=>`${C.env.SYSTEMROOT||C.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,fr=async(e,t={})=>{let{powerShellPath:n,...r}=t,i=fr.encodeCommand(e);return ur(n??dr(),[...fr.argumentsPrefix,i],{encoding:`utf8`,...r})};fr.argumentsPrefix=[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`],fr.encodeCommand=e=>_.from(e,`utf16le`).toString(`base64`),fr.escapeArgument=e=>`'${String(e).replaceAll(`'`,`''`)}'`;function pr(e){for(let t of e.split(`
|
|
366
366
|
`)){if(/^\s*#/.test(t))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,``)}}const mr=A(T.execFile),hr=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await D.access(n,O.F_OK),r=!0}catch{}if(!r)return e;let i=pr(await D.readFile(n,{encoding:`utf8`}));return i===void 0?e:(t=i,t=t.endsWith(`/`)?t:`${t}/`,t)}})(),gr=lr?async()=>`${await hr()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:dr;let _r;const vr=async()=>(_r??=(async()=>{try{let e=await gr();return await D.access(e,O.X_OK),!0}catch{return!1}})(),_r),yr=async()=>{let e=await gr(),{stdout:t}=await fr(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{powerShellPath:e});return t.trim()},br=async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await mr(`wslpath`,[`-aw`,e],{encoding:`utf8`});return t.trim()}catch{return e}};function xr(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}const Sr=A(E);async function Cr(){if(C.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await Sr(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}const wr=A(E);async function Tr(e,{humanReadableOutput:t=!0,signal:n}={}){if(C.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await wr(`osascript`,[`-e`,e,r],i);return a.trim()}async function Er(e){return Tr(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const Dr=A(E),Or={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},kr=new Map(Object.entries(Or));var Ar=class extends Error{};async function jr(e=Dr){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new Ar(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return Or[r]??Or[o]??Or[s]??{name:r,id:r}}const Mr=A(E),Nr=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function Pr(){if(C.platform===`darwin`){let e=await Cr();return{name:await Er(e),id:e}}if(C.platform===`linux`){let{stdout:e}=await Mr(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:Nr(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(C.platform===`win32`)return jr();throw Error(`Only macOS, Linux, and Windows are supported`)}const Fr=!!(C.env.SSH_CONNECTION||C.env.SSH_CLIENT||C.env.SSH_TTY),Ir=Symbol(`fallbackAttempt`),Lr=import.meta.url?c.dirname(w(import.meta.url)):``,Rr=c.join(Lr,`xdg-open`),{platform:zr,arch:Br}=C,Vr=async(e,t)=>{if(e.length===0)return;let n=[];for(let r of e)try{return await t(r)}catch(e){n.push(e)}throw AggregateError(n,`Failed to open in all supported apps`)},Hr=async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[Ir]===!0;if(delete e[Ir],Array.isArray(e.app))return Vr(e.app,t=>Hr({...e,app:t,[Ir]:!0}));let{name:n,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(n))return Vr(n,t=>Hr({...e,app:{name:t,arguments:r},[Ir]:!0}));if(n===`browser`||n===`browserPrivate`){let t={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`,"com.apple.safari":`safari`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a;if(lr){let e=await yr();a=kr.get(e)??{}}else a=await Pr();if(a.id in t){let o=t[a.id.toLowerCase()];if(n===`browserPrivate`){if(o===`safari`)throw Error(`Safari doesn't support opening in private mode via command line`);r.push(i[o])}return Hr({...e,app:{name:Kr[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let i,a=[],o={},s=!1;if(lr&&!sr()&&!Fr&&!n&&(s=await vr()),zr===`darwin`)i=`open`,e.wait&&a.push(`--wait-apps`),e.background&&a.push(`--background`),e.newInstance&&a.push(`--new`),n&&a.push(`-a`,n);else if(zr===`win32`||s){i=await gr(),a.push(...fr.argumentsPrefix),lr||(o.windowsVerbatimArguments=!0),lr&&e.target&&(e.target=await br(e.target));let t=[`$ProgressPreference = 'SilentlyContinue';`,`Start`];e.wait&&t.push(`-Wait`),n?(t.push(fr.escapeArgument(n)),e.target&&r.push(e.target)):e.target&&t.push(fr.escapeArgument(e.target)),r.length>0&&(r=r.map(e=>fr.escapeArgument(e)),t.push(`-ArgumentList`,r.join(`,`))),e.target=fr.encodeCommand(t.join(` `)),e.wait||(o.stdio=`ignore`)}else{if(n)i=n;else{let e=!Lr||Lr===`/`,t=!1;try{await D.access(Rr,O.X_OK),t=!0}catch{}i=C.versions.electron??(zr===`android`||e||!t)?`xdg-open`:Rr}r.length>0&&a.push(...r),e.wait||(o.stdio=`ignore`,o.detached=!0)}zr===`darwin`&&r.length>0&&a.push(`--args`,...r),e.target&&a.push(e.target);let c=T.spawn(i,a,o);return e.wait?new Promise((t,n)=>{c.once(`error`,n),c.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r!==0){n(Error(`Exited with code ${r}`));return}t(c)})}):t?new Promise((e,t)=>{c.once(`error`,t),c.once(`spawn`,()=>{c.once(`close`,n=>{if(c.off(`error`,t),n!==0){t(Error(`Exited with code ${n}`));return}c.unref(),e(c)})})}):(c.unref(),new Promise((e,t)=>{c.once(`error`,t),c.once(`spawn`,()=>{c.off(`error`,t),e(c)})}))},Ur=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return Hr({...t,target:e})};function Wr(e){if(typeof e==`string`||Array.isArray(e))return e;let{[Br]:t}=e;if(!t)throw Error(`${Br} is not supported`);return t}function Gr({[zr]:e},{wsl:t}={}){if(t&&lr)return Wr(t);if(!e)throw Error(`${zr} is not supported`);return Wr(e)}const Kr={browser:`browser`,browserPrivate:`browserPrivate`};xr(Kr,`chrome`,()=>Gr({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`,`chromium-browser`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),xr(Kr,`brave`,()=>Gr({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),xr(Kr,`firefox`,()=>Gr({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),xr(Kr,`edge`,()=>Gr({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),xr(Kr,`safari`,()=>Gr({darwin:`Safari`}));var qr=N(((e,t)=>{let n=typeof process<`u`&&process.env.TERM_PROGRAM===`Hyper`,r=typeof process<`u`&&process.platform===`win32`,i=typeof process<`u`&&process.platform===`linux`,a={ballotDisabled:`☒`,ballotOff:`☐`,ballotOn:`☑`,bullet:`•`,bulletWhite:`◦`,fullBlock:`█`,heart:`❤`,identicalTo:`≡`,line:`─`,mark:`※`,middot:`·`,minus:`-`,multiplication:`×`,obelus:`÷`,pencilDownRight:`✎`,pencilRight:`✏`,pencilUpRight:`✐`,percent:`%`,pilcrow2:`❡`,pilcrow:`¶`,plusMinus:`±`,question:`?`,section:`§`,starsOff:`☆`,starsOn:`★`,upDownArrow:`↕`},o=Object.assign({},a,{check:`√`,cross:`×`,ellipsisLarge:`...`,ellipsis:`...`,info:`i`,questionSmall:`?`,pointer:`>`,pointerSmall:`»`,radioOff:`( )`,radioOn:`(*)`,warning:`‼`}),s=Object.assign({},a,{ballotCross:`✘`,check:`✔`,cross:`✖`,ellipsisLarge:`⋯`,ellipsis:`…`,info:`ℹ`,questionFull:`?`,questionSmall:`﹖`,pointer:i?`▸`:`❯`,pointerSmall:i?`‣`:`›`,radioOff:`◯`,radioOn:`◉`,warning:`⚠`});t.exports=r&&!n?o:s,Reflect.defineProperty(t.exports,`common`,{enumerable:!1,value:a}),Reflect.defineProperty(t.exports,`windows`,{enumerable:!1,value:o}),Reflect.defineProperty(t.exports,`other`,{enumerable:!1,value:s})})),Jr=N(((e,t)=>{let n=e=>typeof e==`object`&&!!e&&!Array.isArray(e),r=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,i=()=>typeof process<`u`?process.env.FORCE_COLOR!==`0`:!1,a=()=>{let e={enabled:i(),visible:!0,styles:{},keys:{}},t=e=>{let t=e.open=`\u001b[${e.codes[0]}m`,n=e.close=`\u001b[${e.codes[1]}m`,r=e.regex=RegExp(`\\u001b\\[${e.codes[1]}m`,`g`);return e.wrap=(e,i)=>{e.includes(n)&&(e=e.replace(r,n+t));let a=t+e+n;return i?a.replace(/\r*\n/g,`${n}$&${t}`):a},e},a=(e,t,n)=>typeof e==`function`?e(t):e.wrap(t,n),o=(t,n)=>{if(t===``||t==null)return``;if(e.enabled===!1)return t;if(e.visible===!1)return``;let r=``+t,i=r.includes(`
|
|
367
367
|
`),o=n.length;for(o>0&&n.includes(`unstyle`)&&(n=[...new Set([`unstyle`,...n])].reverse());o-- >0;)r=a(e.styles[n[o]],r,i);return r},s=(n,r,i)=>{e.styles[n]=t({name:n,codes:r}),(e.keys[i]||(e.keys[i]=[])).push(n),Reflect.defineProperty(e,n,{configurable:!0,enumerable:!0,set(t){e.alias(n,t)},get(){let t=e=>o(e,t.stack);return Reflect.setPrototypeOf(t,e),t.stack=this.stack?this.stack.concat(n):[n],t}})};return s(`reset`,[0,0],`modifier`),s(`bold`,[1,22],`modifier`),s(`dim`,[2,22],`modifier`),s(`italic`,[3,23],`modifier`),s(`underline`,[4,24],`modifier`),s(`inverse`,[7,27],`modifier`),s(`hidden`,[8,28],`modifier`),s(`strikethrough`,[9,29],`modifier`),s(`black`,[30,39],`color`),s(`red`,[31,39],`color`),s(`green`,[32,39],`color`),s(`yellow`,[33,39],`color`),s(`blue`,[34,39],`color`),s(`magenta`,[35,39],`color`),s(`cyan`,[36,39],`color`),s(`white`,[37,39],`color`),s(`gray`,[90,39],`color`),s(`grey`,[90,39],`color`),s(`bgBlack`,[40,49],`bg`),s(`bgRed`,[41,49],`bg`),s(`bgGreen`,[42,49],`bg`),s(`bgYellow`,[43,49],`bg`),s(`bgBlue`,[44,49],`bg`),s(`bgMagenta`,[45,49],`bg`),s(`bgCyan`,[46,49],`bg`),s(`bgWhite`,[47,49],`bg`),s(`blackBright`,[90,39],`bright`),s(`redBright`,[91,39],`bright`),s(`greenBright`,[92,39],`bright`),s(`yellowBright`,[93,39],`bright`),s(`blueBright`,[94,39],`bright`),s(`magentaBright`,[95,39],`bright`),s(`cyanBright`,[96,39],`bright`),s(`whiteBright`,[97,39],`bright`),s(`bgBlackBright`,[100,49],`bgBright`),s(`bgRedBright`,[101,49],`bgBright`),s(`bgGreenBright`,[102,49],`bgBright`),s(`bgYellowBright`,[103,49],`bgBright`),s(`bgBlueBright`,[104,49],`bgBright`),s(`bgMagentaBright`,[105,49],`bgBright`),s(`bgCyanBright`,[106,49],`bgBright`),s(`bgWhiteBright`,[107,49],`bgBright`),e.ansiRegex=r,e.hasColor=e.hasAnsi=t=>(e.ansiRegex.lastIndex=0,typeof t==`string`&&t!==``&&e.ansiRegex.test(t)),e.alias=(t,n)=>{let r=typeof n==`string`?e[n]:n;if(typeof r!=`function`)throw TypeError(`Expected alias to be the name of an existing color (string) or a function`);r.stack||=(Reflect.defineProperty(r,`name`,{value:t}),e.styles[t]=r,[t]),Reflect.defineProperty(e,t,{configurable:!0,enumerable:!0,set(n){e.alias(t,n)},get(){let t=e=>o(e,t.stack);return Reflect.setPrototypeOf(t,e),t.stack=this.stack?this.stack.concat(r.stack):r.stack,t}})},e.theme=t=>{if(!n(t))throw TypeError(`Expected theme to be an object`);for(let n of Object.keys(t))e.alias(n,t[n]);return e},e.alias(`unstyle`,t=>typeof t==`string`&&t!==``?(e.ansiRegex.lastIndex=0,t.replace(e.ansiRegex,``)):``),e.alias(`noop`,e=>e),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=qr(),e.define=s,e};t.exports=a(),t.exports.create=a})),Yr=N(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),Xr=N((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.symbols=e.isTTY=void 0;let n=t(P(`node:tty`)),r=t(P(`node:process`)),i=r.default.env.CI||r.default.env.WT_SESSION||r.default.env.ConEmuTask===`{cmd::Cmder}`||r.default.env.TERM_PROGRAM===`vscode`||r.default.env.TERM===`xterm-256color`||r.default.env.TERM===`alacritty`,a=n.default.isatty(1)&&r.default.env.TERM!==`dumb`&&!(`CI`in r.default.env);e.isTTY=a;let o=r.default.platform===`win32`?i:r.default.env.TERM!==`linux`;e.symbols={frames:a?o?[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`]:[`-`,`\\`,`|`,`/`]:[`-`],tick:o?`✔`:`√`,cross:o?`✖`:`×`,warn:o?`⚠`:`!!`,info:o?`ℹ`:`i`}})),Zr=N((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.createSpinner=a;let n=t(Yr()),r=Xr();function i(e=``,t=80){return e.replace(/\u001b[^m]*?m/g,``).split(`
|
|
368
368
|
`).reduce((e,n)=>e+=Math.max(1,Math.ceil(n.length/t)),0)}function a(e=``,t={}){let a=0,o=t.interval||50,s=t.stream||process.stderr,c=t.frames&&t.frames.length?t.frames:r.symbols.frames,l=t.color||`yellow`,u=!1,d=0,f,p=(t={})=>typeof t==`string`?t:t.text||e,m=(e={})=>typeof e==`string`?!1:!!e.update,h=(e={})=>typeof e==`string`||!e.color?l:e.color,g=(e={},t)=>typeof e==`string`||!e.mark?t:e.mark,_=()=>{process.on(`SIGINT`,b),process.on(`SIGTERM`,b)},v=()=>{process.off(`SIGINT`,b),process.off(`SIGTERM`,b)},y={reset(){return a=0,d=0,u=!1,clearTimeout(f),f=void 0,y},clear(){y.write(`\x1B[1G`);for(let e=0;e<d;e++)e>0&&y.write(`\x1B[1A`),y.write(`\x1B[2K\x1B[1G`);return d=0,y},write(e,t=!1){return t&&r.isTTY&&y.clear(),s.write(e),y},render(){let t=`${n.default[l](c[a])} ${e}`;return r.isTTY?y.write(`\x1B[?25l`):t+=`
|
|
@@ -388,59 +388,61 @@ Examples:
|
|
|
388
388
|
Documentation: https://github.com/git-truck/git-truck
|
|
389
389
|
`},ri={SILENT:0,ERROR:1,WARN:2,INFO:3,DEBUG:4},ii={SILENT:ri.SILENT,ERROR:ri.ERROR,WARN:ri.WARN,INFO:ri.INFO,DEBUG:ri.DEBUG},ai={SILENT:``,ERROR:`ERR`,WARN:`WRN`,INFO:`NFO`,DEBUG:`DBG`},{ERROR:oi,WARN:si,INFO:ci,DEBUG:li}=ai;function ui(){let e=ti();return e.log?ii[e.log.toUpperCase()]??null:null}let di=ui();const fi=()=>di;function pi(...e){di!==null&&di>=ri.ERROR&&(process.stderr.write(yi(oi)),console.error(...e))}function mi(...e){di!==null&&di>=ri.WARN&&(process.stderr.write(yi(si)),console.warn(...e))}function hi(...e){di!==null&&di>=ri.INFO&&(process.stderr.write(yi(ci)),console.info(...e))}function gi(e){di!==null&&di>=ri.INFO&&console.time(e)}function _i(e){di!==null&&di>=ri.INFO&&(process.stderr.write(yi(ci)),console.timeEnd(e))}function vi(...e){di!==null&&di>=ri.DEBUG&&(process.stderr.write(yi(li)),console.debug(...e))}function yi(e){let t=(e,t=e=>e)=>`${t(` ${new Date().toLocaleTimeString()} ${e} `)} `;if(process.env.COLOR===`0`)return`[${e}] `;switch(e){case ai.ERROR:return t(ai.ERROR,Qr.default.bgRedBright.black.bold);case ai.WARN:return t(ai.WARN,Qr.default.bgYellow.black.bold);case ai.INFO:return t(ai.INFO,Qr.default.bgBlueBright.black.bold);case ai.DEBUG:return t(ai.DEBUG,Qr.default.bgWhite.bold);default:throw Error(`Invalid log level`)}}const I={error:pi,warn:mi,info:hi,debug:vi,time:gi,timeEnd:_i};var bi=N(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),xi=N(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),Si=N(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=bi(),a=xi();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Ci=N(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),wi=N(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),L=N(((e,t)=>{let n=xi(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=bi(),{safeRe:a,t:o}=Si(),s=Ci(),{compareIdentifiers:c}=wi();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Ti=N(((e,t)=>{let n=L();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Ei=N(((e,t)=>{let n=Ti();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Di=N(((e,t)=>{let n=Ti();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Oi=N(((e,t)=>{let n=L();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),ki=N(((e,t)=>{let n=Ti();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Ai=N(((e,t)=>{let n=L();t.exports=(e,t)=>new n(e,t).major})),ji=N(((e,t)=>{let n=L();t.exports=(e,t)=>new n(e,t).minor})),Mi=N(((e,t)=>{let n=L();t.exports=(e,t)=>new n(e,t).patch})),Ni=N(((e,t)=>{let n=Ti();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Pi=N(((e,t)=>{let n=L();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Fi=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(t,e,r)})),Ii=N(((e,t)=>{let n=Pi();t.exports=(e,t)=>n(e,t,!0)})),Li=N(((e,t)=>{let n=L();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Ri=N(((e,t)=>{let n=Li();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),zi=N(((e,t)=>{let n=Li();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Bi=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(e,t,r)>0})),Vi=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(e,t,r)<0})),Hi=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(e,t,r)===0})),Ui=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(e,t,r)!==0})),Wi=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(e,t,r)>=0})),Gi=N(((e,t)=>{let n=Pi();t.exports=(e,t,r)=>n(e,t,r)<=0})),Ki=N(((e,t)=>{let n=Hi(),r=Ui(),i=Bi(),a=Wi(),o=Vi(),s=Gi();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),qi=N(((e,t)=>{let n=L(),r=Ti(),{safeRe:i,t:a}=Si();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Ji=N(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Yi=N(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,D(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>ee(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(O(this.set[t],e,this.options))return!0;return!1}};let r=new(Ji()),i=Ci(),a=Xi(),o=xi(),s=L(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=Si(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=bi(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=E(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>T(e,t)).join(` `)),T=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},E=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),ee=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),D=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),O=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),Xi=N(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=Ci(),{safeRe:i,t:a}=Si(),o=Ki(),s=xi(),c=L(),l=Yi()})),Zi=N(((e,t)=>{let n=Yi();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Qi=N(((e,t)=>{let n=Yi();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),$i=N(((e,t)=>{let n=L(),r=Yi();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),ea=N(((e,t)=>{let n=L(),r=Yi();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),ta=N(((e,t)=>{let n=L(),r=Yi(),i=Bi();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),na=N(((e,t)=>{let n=Yi();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),ra=N(((e,t)=>{let n=L(),r=Xi(),{ANY:i}=r,a=Yi(),o=Zi(),s=Bi(),c=Vi(),l=Gi(),u=Wi();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),ia=N(((e,t)=>{let n=ra();t.exports=(e,t,r)=>n(e,t,`>`,r)})),aa=N(((e,t)=>{let n=ra();t.exports=(e,t,r)=>n(e,t,`<`,r)})),oa=N(((e,t)=>{let n=Yi();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),sa=N(((e,t)=>{let n=Zi(),r=Pi();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),ca=N(((e,t)=>{let n=Yi(),r=Xi(),{ANY:i}=r,a=Zi(),o=Pi(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),la=N(((e,t)=>{let n=Si(),r=bi(),i=L(),a=wi();t.exports={parse:Ti(),valid:Ei(),clean:Di(),inc:Oi(),diff:ki(),major:Ai(),minor:ji(),patch:Mi(),prerelease:Ni(),compare:Pi(),rcompare:Fi(),compareLoose:Ii(),compareBuild:Li(),sort:Ri(),rsort:zi(),gt:Bi(),lt:Vi(),eq:Hi(),neq:Ui(),gte:Wi(),lte:Gi(),cmp:Ki(),coerce:qi(),Comparator:Xi(),Range:Yi(),satisfies:Zi(),toComparators:Qi(),maxSatisfying:$i(),minSatisfying:ea(),minVersion:ta(),validRange:na(),outside:ra(),gtr:ia(),ltr:aa(),intersects:oa(),simplifyRange:sa(),subset:ca(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))();const ua={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in ua)Object.freeze(ua[e]);var da=Object.freeze(ua);const fa={};for(let e of Object.keys(da))fa[da[e]]=e;const R={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},oklab:{channels:3,labels:[`okl`,`oka`,`okb`]},lch:{channels:3,labels:`lch`},oklch:{channels:3,labels:[`okl`,`okc`,`okh`]},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}},pa=(6/29)**3;function ma(e){let t=e>.0031308?1.055*e**(1/2.4)-.055:e*12.92;return Math.min(Math.max(0,t),1)}function ha(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(R)){if(!(`channels`in R[e]))throw Error(`missing channels property: `+e);if(!(`labels`in R[e]))throw Error(`missing channel labels property: `+e);if(R[e].labels.length!==R[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=R[e];delete R[e].channels,delete R[e].labels,Object.defineProperty(R[e],`channels`,{value:t}),Object.defineProperty(R[e],`labels`,{value:n})}R.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;switch(a){case i:s=0;break;case t:s=(n-r)/o;break;case n:s=2+(r-t)/o;break;case r:s=4+(t-n)/o;break}s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},R.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};if(u===0)i=0,a=0;else{switch(a=u/l,t=d(o),n=d(s),r=d(c),l){case o:i=r-n;break;case s:i=1/3+t-r;break;case c:i=2/3+n-t;break}i<0?i+=1:i>1&&--i}return[i*360,a*100,l*100]},R.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=R.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},R.rgb.oklab=function(e){let t=ha(e[0]/255),n=ha(e[1]/255),r=ha(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},R.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function ga(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}R.rgb.keyword=function(e){let t=fa[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(da)){let i=da[t],a=ga(e,i);a<n&&(n=a,r=t)}return r},R.keyword.rgb=function(e){return[...da[e]]},R.rgb.xyz=function(e){let t=ha(e[0]/255),n=ha(e[1]/255),r=ha(e[2]/255),i=t*.4124564+n*.3575761+r*.1804375,a=t*.2126729+n*.7151522+r*.072175,o=t*.0193339+n*.119192+r*.9503041;return[i*100,a*100,o*100]},R.rgb.lab=function(e){let t=R.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>pa?n**(1/3):7.787*n+16/116,r=r>pa?r**(1/3):7.787*r+16/116,i=i>pa?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},R.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a;if(n===0)return a=r*255,[a,a,a];let o=r<.5?r*(1+n):r+n-r*n,s=2*r-o,c=[0,0,0];for(let e=0;e<3;e++)i=t+1/3*-(e-1),i<0&&i++,i>1&&i--,a=6*i<1?s+(o-s)*6*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,c[e]=a*255;return c},R.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},R.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},R.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},R.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},R.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},R.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2404542+n*-1.5371385+r*-.4985314,a=t*-.969266+n*1.8760108+r*.041556,o=t*.0556434+n*-.2040259+r*1.0572252,i=ma(i),a=ma(a),o=ma(o),[i*255,a*255,o*255]},R.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>pa?t**(1/3):7.787*t+16/116,n=n>pa?n**(1/3):7.787*n+16/116,r=r>pa?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},R.xyz.oklab=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),a=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),o=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},R.oklab.oklch=function(e){return R.lab.lch(e)},R.oklab.xyz=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(.999999998*t+.396337792*n+.215803758*r)**3,a=(1.000000008*t-.105561342*n-.063854175*r)**3,o=(1.000000055*t-.089484182*n-1.291485538*r)**3,s=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,l=-.076381285*i-.421481978*a+1.58616322*o;return[s*100,c*100,l*100]},R.oklab.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(t+.3963377774*n+.2158037573*r)**3,a=(t-.1055613458*n-.0638541728*r)**3,o=(t-.0894841775*n-1.291485548*r)**3,s=ma(4.0767416621*i-3.3077115913*a+.2309699292*o),c=ma(-1.2684380046*i+2.6097574011*a-.3413193965*o),l=ma(-.0041960863*i-.7034186147*a+1.707614701*o);return[s*255,c*255,l*255]},R.oklch.oklab=function(e){return R.lch.lab(e)},R.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>pa?s:(a-16/116)/7.787,i=c>pa?c:(i-16/116)/7.787,o=l>pa?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},R.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},R.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},R.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?R.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},R.hsv.ansi16=function(e){return R.rgb.ansi16(R.hsv.rgb(e),e[2])},R.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t>>4==n>>4&&n>>4==r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},R.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(Math.trunc(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},R.ansi256.rgb=function(e){if(e=e[0],e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},R.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.slice(t.length)+t},R.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},R.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c=o<1?a/(1-o):0;return s=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,s/=6,s%=1,[s*360,o*100,c*100]},R.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},R.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},R.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},R.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},R.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},R.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},R.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},R.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},R.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},R.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},R.gray.hsl=function(e){return[0,0,e[0]]},R.gray.hsv=R.gray.hsl,R.gray.hwb=function(e){return[0,100,e[0]]},R.gray.cmyk=function(e){return[0,0,0,e[0]]},R.gray.lab=function(e){return[e[0],0,0]},R.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.slice(n.length)+n},R.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function _a(){let e={},t=Object.keys(R);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function va(e){let t=_a(),n=[e];for(t[e].distance=0;n.length>0;){let e=n.pop(),r=Object.keys(R[e]);for(let{length:i}=r,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function ya(e,t){return function(n){return t(e(n))}}function ba(e,t){let n=[t[e].parent,e],r=R[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=ya(R[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}function xa(e){let t=va(e),n={},r=Object.keys(t);for(let{length:e}=r,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=ba(e,t))}return n}const Sa={},Ca=Object.keys(R);function wa(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function Ta(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let{length:e}=r,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}for(let e of Ca){Sa[e]={},Object.defineProperty(Sa[e],`channels`,{value:R[e].channels}),Object.defineProperty(Sa[e],`labels`,{value:R[e].labels});let t=xa(e),n=Object.keys(t);for(let r of n){let n=t[r];Sa[e][r]=Ta(n),Sa[e][r].raw=wa(n)}}function Ea(e,t,n,r,i){return Da(t,((e,t)=>{let n=e[t];if(n===void 0)throw TypeError(Bf(t));return n})(e,t),n,r,i)}function Da(e,t,n,r,i,a){let o=qa(t,n,r);if(i&&t!==o)throw RangeError(Rf(e,t,n,r,a));return o}function Oa(e){return e!==null&&/object|function/.test(typeof e)}function ka(e,t=Map){let n=new t;return(t,...r)=>{if(n.has(t))return n.get(t);let i=e(t,...r);return n.set(t,i),i}}function Aa(e){return ja({name:e},1)}function ja(e,t){return Fa((e=>({value:e,configurable:1,writable:!t})),e)}function Ma(e){return Fa((e=>({get:e,configurable:1})),e)}function Na(e){return{[Symbol.toStringTag]:{value:e,configurable:1}}}function Pa(e,t){let n={},r=e.length;for(let i of t)n[e[--r]]=i;return n}function Fa(e,t,n){let r={};for(let i in t)r[i]=e(t[i],i,n);return r}function Ia(e,t,n){let r={};for(let i=0;i<t.length;i++){let a=t[i];r[a]=e(a,i,n)}return r}function La(e,t,n){let r={};for(let i=0;i<e.length;i++)r[t[i]]=n[e[i]];return r}function Ra(e,t){let n=Object.create(null);for(let r of e)n[r]=t[r];return n}function za(e,t){for(let n of t)if(n in e)return 1;return 0}function Ba(e,t,n){for(let r of e)if(t[r]!==n[r])return 0;return 1}function Va(e,t,n){let r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function z(e,...t){return(...n)=>e(...t,...n)}function Ha(){}function Ua(e){return e[0].toUpperCase()+e.substring(1)}function Wa(e){return e.slice().sort()}function Ga(e,t){return String(t).padStart(e,`0`)}function Ka(e,t){return Math.sign(e-t)}function qa(e,t,n){return Math.min(Math.max(e,t),n)}function Ja(e,t){return[Math.floor(e/t),Ya(e,t)]}function Ya(e,t){return(e%t+t)%t}function Xa(e,t){return[Za(e,t),Qa(e,t)]}function Za(e,t){return Math.trunc(e/t)||0}function Qa(e,t){return e%t||0}function $a(e){return Math.abs(e%1)===.5}function eo(e,t,n){let r=0,i=0;for(let a=0;a<=t;a++){let t=e[n[a]],o=Fp[a],[s,c]=Xa(t,W/o);r+=c*o,i+=s}let[a,o]=Xa(r,W);return[i+a,o]}function to(e,t,n){let r={};for(let i=t;i>=0;i--){let t=Fp[i];r[n[i]]=Za(e,t),e=Qa(e,t)}return r}function no(e){if(e!==void 0)return G(e)}function ro(e){if(e!==void 0)return ao(e)}function io(e){if(e!==void 0)return oo(e)}function ao(e){return fo(oo(e))}function oo(e){return uo(sm(e))}function so(e,t){if(t==null)throw RangeError(Bf(e));return t}function co(e){if(!Oa(e))throw TypeError(Lf);return e}function lo(e,t,n=e){if(typeof t!==e)throw TypeError(zf(n,t));return t}function uo(e,t=`number`){if(!Number.isInteger(e))throw RangeError(jf(t,e));return e||0}function fo(e,t=`number`){if(e<=0)throw RangeError(Mf(t,e));return e}function po(e){if(typeof e==`symbol`)throw TypeError(If);return String(e)}function mo(e,t){return Oa(e)?String(e):G(e,t)}function ho(e){if(typeof e==`string`)return BigInt(e);if(typeof e!=`bigint`)throw TypeError(Ff(e));return e}function go(e,t=`number`){if(typeof e==`bigint`)throw TypeError(Pf(t));if(e=Number(e),!Number.isFinite(e))throw RangeError(Nf(t,e));return e}function _o(e,t){return Math.trunc(go(e,t))||0}function vo(e,t){return uo(go(e,t),t)}function yo(e,t){return fo(_o(e,t),t)}function bo(e,t){let[n,r]=Xa(t,W),i=e+n,a=Math.sign(i);return a&&a===-Math.sign(r)&&(i-=a,r+=a*864e11),[i,r]}function xo(e,t,n=1){return bo(e[0]+t[0]*n,e[1]+t[1]*n)}function So(e,t){return bo(e[0],e[1]+t)}function Co(e,t){return xo(t,e,-1)}function wo(e,t){return Ka(e[0],t[0])||Ka(e[1],t[1])}function To(e,t,n){return wo(e,t)===-1||wo(e,n)===1}function Eo(e,t=1){let n=BigInt(W/t);return[Number(e/n),Number(e%n)*t]}function Do(e,t=1){let[n,r]=Xa(e,W/t);return[n,r*t]}function Oo(e,t=1){let[n,r]=e,i=Math.floor(r/t),a=W/t;return BigInt(n)*BigInt(a)+BigInt(i)}function ko(e,t=1,n){let[r,i]=e,[a,o]=Xa(i,t);return W/t*r+(a+(n?o/t:0))}function Ao(e){return e[0]+e[1]/W}function jo(e,t,n=Ja){let[r,i]=e,[a,o]=n(i,t);return[W/t*r+a,o]}function Mo(e){return Ea(e,`isoYear`,Om,Dm,1),e.isoYear===Om?Ea(e,`isoMonth`,4,12,1):e.isoYear===Dm&&Ea(e,`isoMonth`,1,9,1),e}function No(e){return Po({...e,...xm,isoHour:12}),e}function Po(e){let t=Ea(e,`isoYear`,Om,Dm,1),n=t===Om?1:t===Dm?-1:0;return n&&Fo(B({...e,isoDay:e.isoDay+n,isoNanosecond:e.isoNanosecond-n})),e}function Fo(e){if(!e||To(e,Em,Tm))throw RangeError(dp);return e}function Io(e){return eo(e,5,hm)[1]}function Lo(e){let[t,n]=Ja(e,W);return[to(n,5,hm),t]}function Ro(e){return zo(e)[0]}function zo(e){return jo(e,Mp)}function Bo(e){return Uo(e.isoYear,e.isoMonth,e.isoDay,e.isoHour,e.isoMinute,e.isoSecond,e.isoMillisecond)}function B(e){let t=Bo(e);if(t!==void 0){let[n,r]=Xa(t,Op);return[n,r*jp+(e.isoMicrosecond||0)*Ap+(e.isoNanosecond||0)]}}function Vo(e,t){let[n,r]=Lo(Io(e)-t);return Fo(B({...e,isoDay:e.isoDay+r,...n}))}function Ho(...e){return Uo(...e)/kp}function Uo(...e){let[t,n]=Wo(...e),r=t.valueOf();if(!isNaN(r))return r-n*Op}function Wo(e,t=1,n=1,r=0,i=0,a=0,o=0){let s=e===Om?1:e===Dm?-1:0,c=new Date;return c.setUTCHours(r,i,a,o),c.setUTCFullYear(e,t-1,n+s),[c,s]}function Go(e,t){let[n,r]=So(e,t);r<0&&(r+=864e11,--n);let[i,a]=Ja(r,jp),[o,s]=Ja(a,Ap);return Ko(n*Op+i,o,s)}function Ko(e,t=0,n=0){let r=Math.ceil(Math.max(0,Math.abs(e)-wm)/Op)*Math.sign(e),i=new Date(e-r*Op);return Pa(_m,[i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate()+r,i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds(),t,n])}function qo(e,t){if(t<-wm)throw RangeError(dp);let n=e.formatToParts(t),r={};for(let e of n)r[e.type]=e.value;return r}function Jo(e){return e.isoDay}function Yo(e){return[e.isoYear,e.isoMonth,e.isoDay]}function Xo(e,t){return[t,0]}function Zo(e,t){if(!t)return[jm,e]}function Qo(e,t,n){return{isoYear:e,isoMonth:t,isoDay:n}}function $o(){return 7}function es(){return Mm}function ts(e,t){switch(t){case 2:return rs(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function ns(e){return rs(e)?366:365}function rs(e){return e%4==0&&(e%100!=0||e%400==0)}function is(e){let[t,n]=Wo(e.isoYear,e.isoMonth,e.isoDay);return Ya(t.getUTCDay()-n,7)||7}function as(e){return this.id===tm?(({isoYear:e})=>e<1?[`gregory-inverse`,1-e]:[`gregory`,e])(e):this.id===nm?Pm(e):[]}function os(e){let t=Bo(e);if(t<Nm){let{isoYear:t}=e;return t<1?[`japanese-inverse`,1-t]:[`japanese`,t]}let{era:n,eraYear:r}=ed(qo(Wh(nm),t),nm);return[n,r]}function ss(e){return cs(e),ds(e,1),e}function cs(e){return us(e,1),e}function ls(e){return Ba(gm,e,us(e))}function us(e,t){let{isoYear:n}=e,r=Ea(e,`isoMonth`,1,es(),t);return{isoYear:n,isoMonth:r,isoDay:Ea(e,`isoDay`,1,ts(n,r),t)}}function ds(e,t){return Pa(hm,[Ea(e,`isoHour`,0,23,t),Ea(e,`isoMinute`,0,59,t),Ea(e,`isoSecond`,0,59,t),Ea(e,`isoMillisecond`,0,999,t),Ea(e,`isoMicrosecond`,0,999,t),Ea(e,`isoNanosecond`,0,999,t)])}function V(e){return e===void 0?0:$m(co(e))}function fs(e,t=0){e=Cs(e);let n=eh(e),r=th(e,t);return[$m(e),r,n]}function ps(e,t,n,r=9,i=0,a=4){t=Cs(t);let o=Zm(t,r,i),s=bs(t),c=ah(t,a),l=Xm(t,r,i,1);return o==null?o=Math.max(n,l):Os(o,l),s=xs(s,l,1),e&&(c=(e=>e<4?(e+2)%4:e)(c)),[o,l,s,c]}function ms(e,t=6,n){let r=bs(e=ws(e,Fm)),i=ah(e,7),a=Xm(e,t);return a=so(Fm,a),r=xs(r,a,void 0,n),[a,r,i]}function hs(e){return nh(Cs(e))}function gs(e,t){return vs(Cs(e),t)}function _s(e){let t=Ds(Bm,Ym,ws(e,Bm),0);if(!t)throw RangeError(zf(Bm,t));return t}function vs(e,t=4){let n=Ss(e);return[ah(e,4),...ys(Xm(e,t),n)]}function ys(e,t){return e==null?[t===void 0?1:10**(9-t),t]:[Fp[e],e<4?9-3*e:-1]}function bs(e){let t=e[Lm];return t===void 0?1:_o(t,Lm)}function xs(e,t,n,r){let i=r?W:Fp[t+1];if(i){let n=Fp[t];if(i%((e=Da(Lm,e,1,i/n-+!r,1))*n))throw RangeError(zf(Lm,e))}else e=Da(Lm,e,1,n?10**9:1,1);return e}function Ss(e){let t=e[Rm];if(t!==void 0){if(typeof t!=`number`){if(po(t)===`auto`)return;throw RangeError(zf(Rm,t))}t=Da(Rm,Math.floor(t),0,9,1)}return t}function Cs(e){return e===void 0?{}:co(e)}function ws(e,t){return typeof e==`string`?{[t]:e}:co(e)}function Ts(e){return{overflow:Hm[e]}}function Es(e,t,n=9,r=0,i){let a=t[e];if(a===void 0)return i?r:void 0;if(a=po(a),a===`auto`)return i?r:null;let o=Ep[a];if(o===void 0&&(o=fm[a]),o===void 0)throw RangeError(Wf(e,a,Ep));return Da(e,o,r,n,1,Dp),o}function Ds(e,t,n,r=0){let i=n[e];if(i===void 0)return r;let a=po(i),o=t[a];if(o===void 0)throw RangeError(Wf(e,a,t));return o}function Os(e,t){if(t>e)throw RangeError(_p)}function ks(e){return{branding:fh,epochNanoseconds:e}}function As(e,t,n){return{branding:dh,calendar:n,timeZone:t,epochNanoseconds:e}}function js(e,t=e.calendar){return{branding:lh,calendar:t,...Ra(bm,e)}}function Ms(e,t=e.calendar){return{branding:ch,calendar:t,...Ra(vm,e)}}function Ns(e,t=e.calendar){return{branding:oh,calendar:t,...Ra(vm,e)}}function Ps(e,t=e.calendar){return{branding:sh,calendar:t,...Ra(vm,e)}}function Fs(e){return{branding:uh,...Ra(ym,e)}}function H(e){return{branding:ph,sign:pl(e),...Ra(cm,e)}}function Is(e){return jo(e.epochNanoseconds,jp)[0]}function Ls(e){return Oo(e.epochNanoseconds)}function Rs(e){return e.epochNanoseconds}function zs(e,t,n,r,i){let a=yl(r),[o,s]=((e,t)=>{let n=t((e=ws(e,Im))[zm]),r=Qm(e);return r=so(Im,r),[r,n]})(i,e);if(!s&&ol(Math.max(o,a),s))return Vs(r,o);if(!s)throw RangeError(mp);if(!r.sign)return 0;let[c,l,u]=tl(t,n,s),d=nl(u),f=rl(u),p=il(u),m=f(l,c,r);al(s)||(Po(c),Po(m));let h=p(l,c,m,o);return ol(o,s)?Vs(h,o):Bs(h,d(m),o,l,c,d,f)}function Bs(e,t,n,r,i,a,o){let s=pl(e),[c,l]=Hs(r,mm(n,e),n,s,i,a,o),u=Us(t,c,l);return e[K[n]]+u*s}function Vs(e,t){return ko(U(e),Fp[t],1)}function Hs(e,t,n,r,i,a,o){let s=K[n],c={...t,[s]:t[s]+r},l=o(e,i,t),u=o(e,i,c);return[a(l),a(u)]}function Us(e,t,n){let r=ko(Co(t,n));if(!r)throw RangeError(tp);return ko(Co(t,e))/r}function Ws(e,t){let[n,r,i]=ms(t,5,1);return ks(sc(e.epochNanoseconds,n,r,i,1))}function Gs(e,t,n){let{epochNanoseconds:r,timeZone:i,calendar:a}=t,[o,s,c]=ms(n);if(o===0&&s===1)return t;let l=e(i);if(o===6)r=Zs(rc,l,t,c);else{let e=l.N(r);r=Ic(l,Qs(Go(r,e),o,s,c),e,2,0,1)}return As(r,i,a)}function Ks(e,t){return js(Qs(e,...ms(t)),e.calendar)}function qs(e,t){let[n,r,i]=ms(t,5);var a;return Fs((a=i,ec(e,nc(n,r),a)[0]))}function Js(e,t){let n=e(t.timeZone),[r,i]=rc(bh(t,n)),a=ko(Co(Rc(n,r),Rc(n,i)),Pp,1);if(a<=0)throw RangeError(tp);return a}function Ys(e,t){let{timeZone:n,calendar:r}=t;return As(Xs(ic,e(n),t),n,r)}function Xs(e,t,n){return Rc(t,e(bh(n,t)))}function Zs(e,t,n,r){let[i,a]=e(bh(n,t)),o=n.epochNanoseconds,s=Rc(t,i),c=Rc(t,a);if(To(o,s,c))throw RangeError(tp);return uc(Us(o,s,c),r)?c:s}function Qs(e,t,n,r){return $s(e,nc(t,n),r)}function $s(e,t,n){let[r,i]=ec(e,t,n);return Po({...el(e,i),...r})}function ec(e,t,n){return Lo(lc(Io(e),t,n))}function tc(e){return lc(e,Np,7)}function nc(e,t){return Fp[e]*t}function rc(e){let t=ic(e);return[t,el(t,1)]}function ic(e){return Sm(6,e)}function ac(e,t,n){let r=Math.min(yl(e),6);return gl(cc(U(e,r),t,n),r)}function oc(e,t,n,r,i,a,o,s,c,l){if(r===0&&i===1)return e;let[u,d,f]=(ol(r,s)?al(s)&&r<6&&n>=6?fc:dc:pc)(e,t,n,r,i,a,o,s,c,l);return f&&r!==7&&(u=((e,t,n,r,i,a,o,s)=>{let c=pl(e);for(let l=r+1;l<=n;l++){if(l===7&&n!==7)continue;let r=mm(l,e);r[K[l]]+=c;let u=ko(Co(o(s(i,a,r)),t));if(u&&Math.sign(u)!==c)break;e=r}return e})(u,d,n,Math.max(6,r),o,s,c,l)),u}function sc(e,t,n,r,i){return t===6?[lc(Ao(e),n,r),0]:cc(e,nc(t,n),r,i)}function cc(e,t,n,r){let[i,a]=e;r&&a<0&&(a+=864e11,--i);let[o,s]=Ja(lc(a,t,n),W);return bo(i+o,s)}function lc(e,t,n){return uc(e/t,n)*t}function uc(e,t){return mh[t](e)}function dc(e,t,n,r,i,a){let o=pl(e),s=U(e),c=sc(s,r,i,a),l=Co(s,c),u=Math.sign(c[0]-s[0])===o,d=gl(c,Math.min(n,6));return[{...e,...d},xo(t,l),u]}function fc(e,t,n,r,i,a,o,s,c,l){let u=pl(e)||1,d=ko(U(e,5)),f=nc(r,i),p=lc(d,f,a),[m,h]=Hs(o,{...e,...pm},6,u,s,c,l),g=p-ko(Co(m,h)),_=0;g&&Math.sign(g)!==u?t=So(m,p):(_+=u,p=lc(g,f,a),t=So(h,p));let v=_l(p);return[{...e,...v,days:e.days+_},t,!!_]}function pc(e,t,n,r,i,a,o,s,c,l){let u=pl(e),d=K[r],f=mm(r,e);r===7&&(e={...e,weeks:e.weeks+Math.trunc(e.days/7)});let p=Za(e[d],i)*i;f[d]=p;let[m,h]=Hs(o,f,r,i*u,s,c,l),g=p+Us(t,m,h)*u*i,_=lc(g,i,a),v=Math.sign(_-g)===u;return f[d]=_,[f,v?h:m,v]}function mc(e,t,n,r){let[i,a,o,s]=(e=>{let t=vs(e=Cs(e));return[e.timeZone,...t]})(r),c=i!==void 0;return((e,t,n,r,i,a)=>{n=cc(n,i,r,1);let o=t.N(n);return wc(Go(n,o),a)+(e?kc(tc(o)):`Z`)})(c,t(c?e(i):hh),n.epochNanoseconds,a,o,s)}function hc(e,t,n){let[r,i,a,o,s,c]=(e=>{e=Cs(e);let t=nh(e),n=Ss(e),r=ih(e),i=ah(e,4),a=Xm(e,4);return[t,rh(e),r,i,...ys(a,n)]})(n);return((e,t,n,r,i,a,o,s,c,l)=>{r=cc(r,c,s,1);let u=e(n).N(r);return wc(Go(r,u),l)+kc(tc(u),o)+((e,t)=>t===1?``:`[`+(t===2?`!`:``)+e+`]`)(n,a)+Ac(t,i)})(e,t.calendar,t.timeZone,t.epochNanoseconds,r,i,a,o,s,c)}function gc(e,t){let[n,r,i,a]=(e=>(e=Cs(e),[nh(e),...vs(e)]))(t);return o=e.calendar,s=n,c=a,wc($s(e,i,r),c)+Ac(o,s);var o,s,c}function _c(e,t){return n=e.calendar,r=e,i=hs(t),Tc(r)+Ac(n,i);var n,r,i}function vc(e,t){return Sc(e.calendar,Ec,e,hs(t))}function yc(e,t){return Sc(e.calendar,Dc,e,hs(t))}function bc(e,t){let[n,r,i]=gs(t);return a=i,Oc(ec(e,r,n)[0],a);var a}function xc(e,t){let[n,r,i]=gs(t,3);return r>1&&ml(e={...e,...ac(e,r,n)}),((e,t)=>{let{sign:n}=e,r=n===-1?dl(e):e,{hours:i,minutes:a}=r,[o,s]=jo(U(r,3),Mp,Xa);hl(o);let c=Mc(s,t),l=t>=0||!n||c;return(n<0?`-`:``)+`P`+Cc({Y:Pc(r.years),M:Pc(r.months),W:Pc(r.weeks),D:Pc(r.days)})+(i||a||o||l?`T`+Cc({H:Pc(i),M:Pc(a),S:Pc(o,l)+c}):``)})(e,i)}function Sc(e,t,n,r){return r===1?e===`iso8601`?t(n):Tc(n):r>1||r===0&&e!==`iso8601`?Tc(n)+jc(e,r===2):t(n)}function Cc(e){let t=[];for(let n in e){let r=e[n];r&&t.push(r,n)}return t.join(``)}function wc(e,t){return Tc(e)+`T`+Oc(e,t)}function Tc(e){return Ec(e)+`-`+Tp(e.isoDay)}function Ec(e){let{isoYear:t}=e;return(t<0||t>9999?Nc(t)+Ga(6,Math.abs(t)):Ga(4,t))+`-`+Tp(e.isoMonth)}function Dc(e){return Tp(e.isoMonth)+`-`+Tp(e.isoDay)}function Oc(e,t){let n=[Tp(e.isoHour),Tp(e.isoMinute)];return t!==-1&&n.push(Tp(e.isoSecond)+((e,t,n,r)=>Mc(e*1e6+t*1e3+n,r))(e.isoMillisecond,e.isoMicrosecond,e.isoNanosecond,t)),n.join(`:`)}function kc(e,t=0){if(t===1)return``;let[n,r]=Ja(Math.abs(e),Pp),[i,a]=Ja(r,Np),[o,s]=Ja(a,Mp);return Nc(e)+Tp(n)+`:`+Tp(i)+(o||s?`:`+Tp(o)+Mc(s):``)}function Ac(e,t){return t!==1&&(t>1||t===0&&e!==`iso8601`)?jc(e,t===2):``}function jc(e,t){return`[`+(t?`!`:``)+`u-ca=`+e+`]`}function Mc(e,t){let n=Ga(9,e);return n=t===void 0?n.replace(yh,``):n.slice(0,t),n?`.`+n:``}function Nc(e){return e<0?`-`:`+`}function Pc(e,t){return e||t?e.toLocaleString(`fullwide`,{useGrouping:0}):``}function Fc(e,t){let{epochNanoseconds:n}=e,r=(t.N?t:t(e.timeZone)).N(n),i=Go(n,r);return{calendar:e.calendar,...i,offsetNanoseconds:r}}function Ic(e,t,n,r=0,i=0,a,o){if(n!==void 0&&r===1&&(r===1||o))return Vo(t,n);let s=e.v(t);if(n!==void 0&&r!==3){let e=((e,t,n,r)=>{let i=B(t);r&&(n=tc(n));for(let t of e){let e=ko(Co(t,i));if(r&&(e=tc(e)),e===n)return t}})(s,t,n,a);if(e!==void 0)return e;if(r===0)throw RangeError(lp)}return o?B(t):Lc(e,t,i,s)}function Lc(e,t,n=0,r=e.v(t)){if(r.length===1)return r[0];if(n===1)throw RangeError(up);if(r.length)return r[+(n===3)];let i=B(t),a=((e,t)=>{let n=e.N(So(t,-W));return(e=>{if(e>864e11)throw RangeError(cp);return e})(e.N(So(t,W))-n)})(e,i)*(n===2?-1:1);return(r=e.v(Go(i,a)))[n===2?0:r.length-1]}function Rc(e,t){let n=e.v(t);if(n.length)return n[0];let r=So(B(t),-W);return e.l(r,1)}function zc(e,t,n){return ks(Fo(xo(t.epochNanoseconds,(e=>{if(vl(e))throw RangeError(hp);return U(e,5)})(e?dl(n):n))))}function Bc(e,t,n,r,i,a=Object.create(null)){let o=t(r.timeZone),s=e(r.calendar);return{...r,...Gc(o,s,r,n?dl(i):i,a)}}function Vc(e,t,n,r,i=Object.create(null)){let{calendar:a}=n;return js(Kc(e(a),n,t?dl(r):r,i),a)}function Hc(e,t,n,r,i){let{calendar:a}=n;return Ms(qc(e(a),n,t?dl(r):r,i),a)}function Uc(e,t,n,r,i){let a=n.calendar,o=e(a),s=No(Jc(o,n));return t&&(r=ul(r)),r.sign<0&&(s=o.P(s,{...q,months:1}),s=el(s,-1)),Ns(Jc(o,o.P(s,r,i)),a)}function Wc(e,t,n){return Fs(Yc(t,e?dl(n):n)[0])}function Gc(e,t,n,r,i){let a=U(r,5),o=n.epochNanoseconds;if(vl(r)){let s=bh(n,e);o=xo(Lc(e,{...qc(t,s,{...r,...pm},i),...Ra(hm,s)}),a)}else o=xo(o,a),V(i);return{epochNanoseconds:Fo(o)}}function Kc(e,t,n,r){let[i,a]=Yc(t,n);return Po({...qc(e,t,{...n,...pm,days:n.days+a},r),...i})}function qc(e,t,n,r){if(n.years||n.months||n.weeks)return e.P(t,n,r);V(r);let i=n.days+U(n,5)[0];return i?No(el(t,i)):t}function Jc(e,t,n=1){return el(t,n-e.day(t))}function Yc(e,t){let[n,r]=U(t,5),[i,a]=Lo(Io(e)+r);return[i,n+a]}function Xc(e,t,n){let r=V(n),i,{years:a,months:o,weeks:s,days:c}=t;if(c+=U(t,5)[0],a||o)i=Zc(this,e,a,o,r);else{if(!s&&!c)return e;i=Bo(e)}if(i===void 0)throw RangeError(dp);return i+=(7*s+c)*Op,No(Ko(i))}function Zc(e,t,n,r,i){let[a,o,s]=e.u(t);if(n){let[t,r]=e.m(a,o);a+=n,o=Gu(t,r,e.F(a)),o=Da(`month`,o,1,e.O(a),i)}return r&&([a,o]=e.p(a,o,r)),s=Da(`day`,s,1,e.B(a,o),i),e.M(a,o,s)}function Qc(e,t,n){return e+=Za(n,Mm),(t+=Qa(n,Mm))<1?(e--,t+=Mm):t>Mm&&(e++,t-=Mm),[e,t]}function $c(e,t,n){if(n){if(t+=n,!Number.isSafeInteger(t))throw RangeError(dp);if(n<0)for(;t<1;)t+=dd.call(this,--e);else{let n;for(;t>(n=dd.call(this,e));)t-=n,e++}}return[e,t]}function el(e,t){return t?{...e,...Ko(Bo(e)+t*Op)}:e}function tl(e,t,n){let r=e(n.calendar);return al(n)?[n,r,t(n.timeZone)]:[{...n,...xm},r]}function nl(e){return e?Rs:B}function rl(e){return e?z(Gc,e):Kc}function il(e){return e?z(xu,e):Su}function al(e){return e&&e.epochNanoseconds}function ol(e,t){return e<=6-!!al(t)}function sl(e,t,n,r,i,a,o){let s=e(Cs(o).relativeTo),c=Math.max(yl(i),yl(a));if(ol(c,s))return H(ml(((e,t,n,r)=>{let i=xo(U(e),U(t),r?-1:1);if(!Number.isFinite(i[0]))throw RangeError(dp);return{...q,...gl(i,n)}})(i,a,c,r)));if(!s)throw RangeError(mp);r&&(a=dl(a));let[l,u,d]=tl(t,n,s),f=rl(d);return H(il(d)(u,l,f(u,f(u,l,i),a),c))}function cl(e,t,n,r,i){let a=yl(r),[o,s,c,l,u]=((e,t,n)=>{e=ws(e,Fm);let r=Zm(e),i=n(e[zm]),a=bs(e),o=ah(e,7),s=Xm(e);if(r===void 0&&s===void 0)throw RangeError(gp);if(s??=0,r??=Math.max(s,t),Os(r,s),a=xs(a,s,1),a>1&&s>5&&r!==s)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);return[r,s,a,o,i]})(i,a,e);if(!u&&Math.max(a,o)<=6)return H(ml(((e,t,n,r,i)=>{let a=sc(U(e),n,r,i);return{...q,...gl(a,t)}})(r,o,s,c,l)));if(!al(u)&&!r.sign)return r;if(!u)throw RangeError(mp);let[d,f,p]=tl(t,n,u),m=nl(p),h=rl(p),g=il(p),_=h(f,d,r);al(u)||(Po(d),Po(_));let v=g(f,d,_,o),y=r.sign,b=pl(v);if(y&&b&&y!==b)throw RangeError(tp);return v=oc(v,m(_),o,s,c,l,f,d,m,h),H(v)}function ll(e){return e.sign===-1?ul(e):e}function ul(e){return H(dl(e))}function dl(e){let t={};for(let n of K)t[n]=-1*e[n]||0;return t}function fl(e){return!e.sign}function pl(e,t=K){let n=0;for(let r of t){let t=Math.sign(e[r]);if(t){if(n&&n!==t)throw RangeError(pp);n=t}}return n}function ml(e){for(let t of dm)Da(t,e[t],-xh,xh,1);return hl(ko(U(e),Mp)),e}function hl(e){if(!Number.isSafeInteger(e))throw RangeError(fp)}function U(e,t=6){return eo(e,t,K)}function gl(e,t=6){let[n,r]=e,i=to(r,t,K);if(i[K[t]]+=n*(864e11/Fp[t]),!Number.isFinite(i[K[t]]))throw RangeError(dp);return i}function _l(e,t=5){return to(e,t,K)}function vl(e){return!!pl(e,um)}function yl(e){let t=9;for(;t>0&&!e[K[t]];t--);return t}function bl(e,t){return[e,t]}function xl(e){let t=Math.floor(e/gh)*gh;return[t,t+gh]}function Sl(e){let t=zl(e=mo(e));if(!t)throw RangeError(vp(e));let n;if(t.C)n=0;else{if(!t.offset)throw RangeError(vp(e));n=Tl(t.offset)}return t.timeZone&&Hl(t.timeZone,1),ks(Vo(ss(t),n))}function Cl(e){let t=zl(G(e));if(!t)throw RangeError(vp(e));if(t.timeZone)return Fl(t,t.offset?Tl(t.offset):void 0);if(t.C)throw RangeError(vp(e));return Ll(t)}function wl(e,t){let n=zl(G(e));if(!n||!n.timeZone)throw RangeError(vp(e));let{offset:r}=n,i=r?Tl(r):void 0,[,a,o]=fs(t);return Fl(n,i,a,o)}function Tl(e){let t=Hl(e);if(t===void 0)throw RangeError(vp(e));return t}function El(e){let t=zl(G(e));if(!t||t.C)throw RangeError(vp(e));return js(Il(t))}function Dl(e,t,n){let r=zl(G(e));if(!r||r.C)throw RangeError(vp(e));return t?r.calendar===`iso8601`&&(r=r.isoYear===-271821&&r.isoMonth===4?{...r,isoDay:20,...xm}:{...r,isoDay:1,...xm}):n&&r.calendar===`iso8601`&&(r={...r,isoYear:jm}),Ms(r.k?Il(r):Ll(r))}function Ol(e,t){let n=Bl(G(t));if(n)return kl(n),Ns(Mo(cs(n)));let r=Dl(t,1);return Ns(Jc(e(r.calendar),r))}function kl(e){if(e.calendar!==`iso8601`)throw RangeError(yp(e.calendar))}function Al(e,t){let n=Vl(G(t));if(n)return kl(n),Ps(cs(n));let r=Dl(t,0,1),{calendar:i}=r,a=e(i),[o,s,c]=a.u(r),[l,u]=a.m(o,s),[d,f]=a.R(l,u,c);return Ps(No(a.U(d,f,c)),i)}function jl(e){let t,n=(e=>{let t=Fh.exec(e);return t?(Gl(t[10]),Wl(t)):void 0})(G(e));if(!n){if(n=zl(e),!n||!n.k)throw RangeError(vp(e));if(n.C)throw RangeError(yp(`Z`));kl(n)}if((t=Bl(e))&&ls(t)||(t=Vl(e))&&ls(t))throw RangeError(vp(e));return Fs(ds(n,1))}function Ml(e){let t=(e=>{let t=Rh.exec(e);return t?(e=>{function t(e,t,a){let o=0,s=0;if(a&&([o,i]=Ja(i,Fp[a])),e!==void 0){if(r)throw RangeError(yp(e));s=(e=>{let t=parseInt(e);if(!Number.isFinite(t))throw RangeError(yp(e));return t})(e),n=1,t&&(i=Kl(t)*(Fp[a]/1e9),r=1)}return o+s}let n=0,r=0,i=0,a={...Pa(K,[t(e[2]),t(e[3]),t(e[4]),t(e[5]),t(e[6],e[7],5),t(e[8],e[9],4),t(e[10],e[11],3)]),...to(i,2,K)};if(!n)throw RangeError(Uf(K));return Jl(e[1])<0&&(a=dl(a)),a})(t):void 0})(G(e));if(!t)throw RangeError(vp(e));return H(ml(t))}function Nl(e){let t=zl(e)||Bl(e)||Vl(e);return t?t.calendar:e}function Pl(e){let t=zl(e);return t&&(t.timeZone||t.C&&hh||t.offset)||e}function Fl(e,t,n=0,r=0){let i=Zl(e.timeZone),a=J(i),o;return ss(e),o=e.k?Ic(a,e,t,n,r,!a.j,e.C):Rc(a,e),As(o,i,gd(e.calendar))}function Il(e){return Rl(Po(ss(e)))}function Ll(e){return Rl(No(cs(e)))}function Rl(e){return{...e,calendar:gd(e.calendar)}}function zl(e){let t=Ph.exec(e);return t?(e=>{let t=e[10],n=(t||``).toUpperCase()===`Z`;return{isoYear:Ul(e),isoMonth:parseInt(e[4]),isoDay:parseInt(e[5]),...Wl(e.slice(5)),...Gl(e[16]),k:!!e[6],C:n,offset:n?void 0:t}})(t):void 0}function Bl(e){let t=Mh.exec(e);return t?(e=>({isoYear:Ul(e),isoMonth:parseInt(e[4]),isoDay:1,...Gl(e[5])}))(t):void 0}function Vl(e){let t=Nh.exec(e);return t?(e=>({isoYear:jm,isoMonth:parseInt(e[1]),isoDay:parseInt(e[2]),...Gl(e[3])}))(t):void 0}function Hl(e,t){let n=Ih.exec(e);return n?((e,t)=>{let n=e[4]||e[5];if(t&&n)throw RangeError(yp(n));return(e=>{if(Math.abs(e)>=864e11)throw RangeError(sp);return e})((Yl(e[2])*Pp+Yl(e[3])*Np+Yl(e[4])*Mp+Kl(e[5]||``))*Jl(e[1]))})(n,t):void 0}function Ul(e){let t=Jl(e[1]),n=parseInt(e[2]||e[3]);if(t<0&&!n)throw RangeError(yp(-0));return t*n}function Wl(e){let t=Yl(e[3]);return{...Lo(Kl(e[4]||``))[0],isoHour:Yl(e[1]),isoMinute:Yl(e[2]),isoSecond:t===60?59:t}}function Gl(e){let t,n,r=[];if(e.replace(Lh,((e,i,a)=>{let o=!!i,[s,c]=a.split(`=`).reverse();if(c){if(c===`u-ca`)r.push(s),t||=o;else if(o||/[A-Z]/.test(c))throw RangeError(yp(e))}else{if(n)throw RangeError(yp(e));n=s}return``})),r.length>1&&t)throw RangeError(yp(e));return{timeZone:n,calendar:r[0]||`iso8601`}}function Kl(e){return parseInt(e.padEnd(9,`0`))}function ql(e){return RegExp(`^${e}$`,`i`)}function Jl(e){return e&&e!==`+`?-1:1}function Yl(e){return e===void 0?0:parseInt(e)}function Xl(e){return Zl(G(e))}function Zl(e){let t=$l(e);return typeof t==`number`?kc(t):t?(e=>{if(Vh.test(e))throw RangeError(ip(e));if(Bh.test(e))throw RangeError(op);return e.toLowerCase().split(`/`).map(((e,t)=>(e.length<=3||/\d/.test(e))&&!/etc|yap/.test(e)?e.toUpperCase():e.replace(/baja|dumont|[a-z]+/g,((e,n)=>e.length<=2&&!t||e===`in`||e===`chat`?e.toUpperCase():e.length>2||!n?Ua(e).replace(/island|noronha|murdo|rivadavia|urville/,Ua):e)))).join(`/`)})(e):hh}function Ql(e){let t=$l(e);return typeof t==`number`?t:t?t.resolvedOptions().timeZone:hh}function $l(e){let t=Hl(e=e.toUpperCase(),1);return t===void 0?e===hh?void 0:zh(e):t}function eu(e,t){return wo(e.epochNanoseconds,t.epochNanoseconds)}function tu(e,t){return wo(e.epochNanoseconds,t.epochNanoseconds)}function nu(e,t,n,r,i,a){let o=e(Cs(a).relativeTo),s=Math.max(yl(r),yl(i));if(Ba(K,r,i))return 0;if(ol(s,o))return wo(U(r),U(i));if(!o)throw RangeError(mp);let[c,l,u]=tl(t,n,o),d=nl(u),f=rl(u);return wo(d(f(l,c,r)),d(f(l,c,i)))}function ru(e,t){return iu(e,t)||au(e,t)}function iu(e,t){return Ka(Bo(e),Bo(t))}function au(e,t){return Ka(Io(e),Io(t))}function ou(e,t){return!eu(e,t)}function su(e,t){return!tu(e,t)&&!!pu(e.timeZone,t.timeZone)&&e.calendar===t.calendar}function cu(e,t){return!ru(e,t)&&e.calendar===t.calendar}function lu(e,t){return!iu(e,t)&&e.calendar===t.calendar}function uu(e,t){return!iu(e,t)&&e.calendar===t.calendar}function du(e,t){return!iu(e,t)&&e.calendar===t.calendar}function fu(e,t){return!au(e,t)}function pu(e,t){if(e===t)return 1;try{return Ql(e)===Ql(t)}catch{}}function mu(e,t,n,r){let i=ps(e,r,3,5),a=Eu(t.epochNanoseconds,n.epochNanoseconds,...i);return H(e?dl(a):a)}function hu(e,t,n,r,i,a){let o=Pu(r.calendar,i.calendar),[s,c,l,u]=ps(n,a,5),d=r.epochNanoseconds,f=i.epochNanoseconds,p=wo(f,d),m;if(p)if(s<6)m=Eu(d,f,s,c,l,u);else{let n=t(Fu(r.timeZone,i.timeZone)),d=e(o);m=Cu(d,n,r,i,p,s,a),m=oc(m,f,s,c,l,u,d,r,Rs,z(Gc,n))}else m=q;return H(n?dl(m):m)}function gu(e,t,n,r,i){let a=Pu(n.calendar,r.calendar),[o,s,c,l]=ps(t,i,6),u=B(n),d=B(r),f=wo(d,u),p;if(f)if(o<=6)p=Eu(u,d,o,s,c,l);else{let t=e(a);p=wu(t,n,r,f,o,i),p=oc(p,d,o,s,c,l,t,n,B,Kc)}else p=q;return H(t?dl(p):p)}function _u(e,t,n,r,i){let a=Pu(n.calendar,r.calendar);return yu(t,(()=>e(a)),n,r,...ps(t,i,6,9,6))}function vu(e,t,n,r,i){let a=Pu(n.calendar,r.calendar),o=ps(t,i,9,9,8),s=e(a),c=Jc(s,n),l=Jc(s,r);return c.isoYear===l.isoYear&&c.isoMonth===l.isoMonth&&c.isoDay===l.isoDay?H(q):yu(t,(()=>s),No(c),No(l),...o,8)}function yu(e,t,n,r,i,a,o,s,c=6){let l=B(n),u=B(r);if(l===void 0||u===void 0)throw RangeError(dp);let d;if(wo(u,l))if(i===6)d=Eu(l,u,i,a,o,s);else{let e=t();d=e.h(n,r,i),a===c&&o===1||(d=oc(d,u,i,a,o,s,e,n,B,qc))}else d=q;return H(e?dl(d):d)}function bu(e,t,n,r){let[i,a,o,s]=ps(e,r,5,5),c=lc(Au(t,n),nc(a,o),s),l={...q,..._l(c,i)};return H(e?dl(l):l)}function xu(e,t,n,r,i,a){let o=wo(r.epochNanoseconds,n.epochNanoseconds);return o?i<6?Du(n.epochNanoseconds,r.epochNanoseconds,i):Cu(t,e,n,r,o,i,a):q}function Su(e,t,n,r,i){let a=B(t),o=B(n),s=wo(o,a);return s?r<=6?Du(a,o,r):wu(e,t,n,s,r,i):q}function Cu(e,t,n,r,i,a,o){let[s,c,l]=Tu(t,n,r,i);var u,d;return{...a===6?(u=s,d=c,{...q,days:Ou(u,d)}):e.h(s,c,a,o),..._l(l)}}function wu(e,t,n,r,i,a){let[o,s,c]=((e,t,n)=>{let r=t,i=Au(e,t);return Math.sign(i)===-n&&(r=el(t,-n),i+=864e11*n),[e,r,i]})(t,n,r);return{...e.h(o,s,i,a),..._l(c)}}function Tu(e,t,n,r){function i(){return d={...el(s,l++*-r),...o},f=Lc(e,d),wo(c,f)===-r}let a=bh(t,e),o=Ra(hm,a),s=bh(n,e),c=n.epochNanoseconds,l=0,u=Au(a,s),d,f;if(Math.sign(u)===-r&&l++,i()&&(r===-1||i()))throw RangeError(tp);let p=ko(Co(f,c));return[a,d,p]}function Eu(e,t,n,r,i,a){return{...q,...gl(sc(Co(e,t),r,i,a),n)}}function Du(e,t,n){return{...q,...gl(Co(e,t),n)}}function Ou(e,t){return ku(Bo(e),Bo(t))}function ku(e,t){return Math.trunc((t-e)/Op)}function Au(e,t){return Io(t)-Io(e)}function ju(e,t,n){if(n<=7){let r=0,i=Ou({...e,...xm},{...t,...xm});return n===7&&([r,i]=Xa(i,7)),{...q,weeks:r,days:i}}let r=this.u(e),i=this.u(t),[a,o,s]=((e,t,n,r,i,a,o)=>{let s=i-t,c=a-n,l=o-r;if(s||c){let u=Math.sign(s||c),d=e.B(i,a),f=0;if(Math.sign(l)===-u){let r=d;[i,a]=e.p(i,a,-u),s=i-t,c=a-n,d=e.B(i,a),f=u<0?-r:d}if(l=o-Math.min(r,d)+f,s){let[r,o]=e.m(t,n),[l,d]=e.m(i,a);if(c=l-r||Number(d)-Number(o),Math.sign(c)===-u){let n=u<0&&-e.O(i);s=(i-=u)-t,c=a-Gu(r,o,e.F(i))+(n||e.O(i))}}}return[s,c,l]})(this,...r,...i);return n===8&&(o+=this.q(a,r[0]),a=0),{...q,years:a,months:o,days:s}}function Mu(e){return e*Mm}function Nu(e,t){let n=t+e,r=Math.sign(e),i=r<0?-1:0,a=0;for(let e=t;e!==n;e+=r)a+=dd.call(this,e+i);return a}function Pu(e,t){if(e!==t)throw RangeError(rp);return e}function Fu(e,t){if(!pu(e,t))throw RangeError(ap);return e}function Iu(e){return this.I(e)[0]}function Lu(e){return this.I(e)[1]}function Ru(e){let[t]=this.u(e);return this.L(t)}function zu(e){let[t]=this.u(e);return this.O(t)}function Bu(e){let[t,n]=this.u(e);return this.B(t,n)}function Vu(e){let[t]=this.u(e);return this.G(t)}function Hu(e){let[t]=this.u(e);return ku(this.M(t),Bo(e))+1}function Uu(e){let t=Hh.exec(e);if(!t)throw RangeError(Zf(e));return[parseInt(t[1]),!!t[2]]}function Wu(e,t){return`M`+Tp(e)+(t?`L`:``)}function Gu(e,t,n){return e+(t||n&&e>=n?1:0)}function Ku(e,t){return e-(t&&e>=t?1:0)}function qu(e,t){return(t+e)*(Math.sign(t)||1)||0}function Ju(e){return rm[Xu(e)]}function Yu(e){return am[Xu(e)]}function Xu(e){return _d(e.id||`iso8601`)}function Zu(e){function t(e){return((e,t)=>({...ed(e,t),V:e.month,day:parseInt(e.day)}))(qo(n,e),r)}let n=Wh(e),r=_d(e);return{id:e,_:Qu(t),J:$u(t)}}function Qu(e){return ka((t=>e(Bo(t))),WeakMap)}function $u(e){let t=e(0).year-Am;return ka((n=>{let r,i=Uo(n-t),a=0,o=[],s=[];do i+=400*Op;while((r=e(i)).year<=n);do if(i+=(1-r.day)*Op,r.year===n&&(o.push(i),s.push(r.V)),i-=Op,++a>100||i<-wm)throw RangeError(tp);while((r=e(i)).year>=n);return{K:o.reverse(),X:Cp(s.reverse())}}))}function ed(e,t){let n,r,i=td(e);if(e.era){let a=rm[t],o=im[t]||{};a!==void 0&&(n=t===`islamic`?`ah`:e.era.normalize(`NFD`).toLowerCase().replace(/[^a-z0-9]/g,``),n===`bc`||n===`b`?n=`bce`:n===`ad`||n===`a`?n=`ce`:n===`beforeroc`&&(n=`broc`),n=o[n]||n,r=i,i=qu(r,a[n]||0))}return{era:n,eraYear:r,year:i}}function td(e){return parseInt(e.relatedYear||e.year)}function nd(e){return this._(e).day}function rd(e){let{year:t,V:n,day:r}=this._(e),{X:i}=this.J(t);return[t,i[n]+1,r]}function id(e,t,n){return Ko(ad.call(this,e,t,n))}function ad(e,t=1,n=1){return this.J(e).K[t-1]+(n-1)*Op}function od(e,t){let n=sd.call(this,e);return[Ku(t,n),n===t]}function sd(e){let t=md(this,e),n=md(this,e-1),r=t.length;if(r>n.length){let e=Yu(this);if(e<0)return-e;for(let e=0;e<r;e++)if(t[e]!==n[e])return e+1}}function cd(e){let t=ld.call(this,e);return t>ld.call(this,e-1)&&t>ld.call(this,e+1)}function ld(e){return ku(ad.call(this,e),ad.call(this,e+1))}function ud(e,t){let{K:n}=this.J(e),r=t+1,i=n;return r>n.length&&(r=1,i=this.J(e+1).K),ku(n[t-1],i[r-1])}function dd(e){return this.J(e).K.length}function fd(e){let t=this._(e);return[t.era,t.eraYear]}function pd(e,t,n){let r=this.id&&_d(this.id)===`chinese`?((e,t,n)=>{if(t)switch(e){case 1:return 1651;case 2:return n<30?1947:1765;case 3:return n<30?1966:1955;case 4:return n<30?1963:1944;case 5:return n<30?1971:1952;case 6:return n<30?1960:1941;case 7:return n<30?1968:1938;case 8:return n<30?1957:1718;case 9:return 1832;case 10:return 1870;case 11:return 1814;case 12:return 1890}return 1972})(e,t,n):jm,[i,a,o]=rd.call(this,{isoYear:r,isoMonth:Mm,isoDay:31}),s=sd.call(this,i),c=a===s;(Ka(e,Ku(a,s))||Ka(Number(t),Number(c))||Ka(n,o))===1&&i--;for(let r=0;r<100;r++){let a=i-r,o=sd.call(this,a),s=Gu(e,t,o);if(t===(s===o)&&n<=ud.call(this,a,s))return[a,s]}}function md(e,t){return Object.keys(e.J(t).X)}function hd(e){return gd(G(e))}function gd(e){if((e=e.toLowerCase())!==`iso8601`&&e!==tm){let t=Wh(e).resolvedOptions().calendar;if(_d(e)!==_d(t))throw RangeError(np(e));return t}return e}function _d(e){return e===`islamicc`&&(e=`islamic`),e.split(`-`)[0]}function vd(e,t){return n=>n===`iso8601`?e:n===tm||n===nm?Object.assign(Object.create(e),{id:n}):Object.assign(Object.create(t),Uh(n))}function yd(e,t,n,r){let i=Dd(n,r,Xp,[],Vp);if(i.timeZone!==void 0){let r=n.ee(i),a=kd(i),o=e(i.timeZone);return{epochNanoseconds:Ic(t(o),{...r,...a},i.offset===void 0?void 0:Tl(i.offset)),timeZone:o}}return{...n.ee(i),...xm}}function bd(e,t,n,r,i,a){let o=Dd(n,i,Xp,zp,Vp),s=e(o.timeZone),[c,l,u]=fs(a),d=n.ee(o,Ts(c)),f=kd(o,c);return As(Ic(t(s),{...d,...f},o.offset===void 0?void 0:Tl(o.offset),l,u),s,r)}function xd(e,t,n){let r=Dd(e,t,Xp,[],Ip),i=V(n);return js(Po({...e.ee(r,Ts(i)),...kd(r,i)}))}function Sd(e,t,n,r=[]){let i=Dd(e,t,Xp,r);return e.ee(i,n)}function Cd(e,t,n,r){let i=Dd(e,t,Jp,r);return e.ne(i,n)}function wd(e,t,n,r){let i=Dd(e,n,Xp,qp);return t&&i.month!==void 0&&i.monthCode===void 0&&i.year===void 0&&(i.year=jm),e.te(i,r)}function Td(e,t){return Fs(kd(Od(e,Lp,[],1),V(t)))}function Ed(e){let t=Od(e,cm);return H(ml({...q,...t}))}function Dd(e,t,n,r=[],i=[]){return Od(t,[...e.fields(n),...i].sort(),r)}function Od(e,t,n,r=!n){let i={},a,o=0;for(let r of t){if(r===a)throw RangeError(Hf(r));if(r===`constructor`||r===`__proto__`)throw RangeError(Vf(r));let t=e[r];if(t!==void 0)o=1,Zh[r]&&(t=Zh[r](t,r)),i[r]=t;else if(n){if(n.includes(r))throw TypeError(Bf(r));i[r]=$p[r]}a=r}if(r&&!o)throw TypeError(Uf(t));return i}function kd(e,t){return ds(Qh({...$p,...e}),t)}function Ad(e,t,n,r,i){let{calendar:a,timeZone:o}=n,s=e(a),c=t(o),l=[...s.fields(Xp),...Bp].sort(),u=(e=>{let t=bh(e,J),n=kc(t.offsetNanoseconds),r=Xh(e.calendar),[i,a,o]=r.u(t),[s,c]=r.m(i,a),l=Wu(s,c);return{...$h(t),year:i,monthCode:l,day:o,offset:n}})(n),d=Od(r,l),f=s.oe(u,d),p={...u,...d},[m,h,g]=fs(i,2);return As(Ic(c,{...s.ee(f,Ts(m)),...ds(Qh(p),m)},Tl(p.offset),h,g),o,a)}function jd(e,t,n,r){let i=e(t.calendar),a=[...i.fields(Xp),...Ip].sort(),o={...Yd(s=t),hour:s.isoHour,minute:s.isoMinute,second:s.isoSecond,millisecond:s.isoMillisecond,microsecond:s.isoMicrosecond,nanosecond:s.isoNanosecond};var s;let c=Od(n,a),l=V(r),u=i.oe(o,c),d={...o,...c};return js(Po({...i.ee(u,Ts(l)),...ds(Qh(d),l)}))}function Md(e,t,n,r){let i=e(t.calendar),a=i.fields(Xp).sort(),o=Yd(t),s=Od(n,a),c=i.oe(o,s);return i.ee(c,r)}function Nd(e,t,n,r){let i=e(t.calendar),a=i.fields(Jp).sort(),o=(e=>{let t=Xh(e.calendar),[n,r]=t.u(e),[i,a]=t.m(n,r);return{year:n,monthCode:Wu(i,a)}})(t),s=Od(n,a),c=i.oe(o,s);return i.ne(c,r)}function Pd(e,t,n,r){let i=e(t.calendar),a=i.fields(Xp).sort(),o=(e=>{let t=Xh(e.calendar),[n,r,i]=t.u(e),[a,o]=t.m(n,r);return{monthCode:Wu(a,o),day:i}})(t),s=Od(n,a),c=i.oe(o,s);return i.te(c,r)}function Fd(e,t,n){return Fs(((e,t,n)=>kd({...Ra(Lp,e),...Od(t,Lp)},V(n)))(e,t,n))}function Id(e,t){return H((n=e,r=t,ml({...n,...Od(r,cm)})));var n,r}function Ld(e,t){let n=Dd(e,t,Qp);return e.te(n)}function Rd(e,t,n){let r=Dd(e,t,Yp);return e.ne(r,n)}function zd(e,t,n,r,i){t=Ra(n=e.fields(n),t),r=Od(r,i=e.fields(i),[]);let a=e.oe(t,r);return a=Od(a,[...n,...i].sort(),[]),e.ee(a)}function Bd(e,t){let n=V(t),r=Gd(this,e),i=Kd(this,e,r,n),a=qd(this,e,i,r,n);return Ms(No(this.U(r,i,a)),this.id||`iso8601`)}function Vd(e,t){let n=V(t),r=Gd(this,e),i=Kd(this,e,r,n);return Ns(Mo(this.U(r,i,1)),this.id||`iso8601`)}function Hd(e,t){let n=V(t),r,i,a,o=e.eraYear!==void 0||e.year!==void 0?Gd(this,e):void 0,s=!this.id;if(o===void 0&&s&&(o=jm),o!==void 0){let t=Kd(this,e,o,n);r=qd(this,e,t,o,n);let s=this.F(o);i=Ku(t,s),a=t===s}else{if(e.monthCode===void 0)throw TypeError($f);if([i,a]=Uu(e.monthCode),this.id&&this.id!==tm&&this.id!==nm)if(this.id&&_d(this.id)===`coptic`&&n===0){let t=a||i!==13?30:6;r=e.day,r=qa(r,1,t)}else if(this.id&&_d(this.id)===`chinese`&&n===0){let t=!a||i!==1&&i!==9&&i!==10&&i!==11&&i!==12?30:29;r=e.day,r=qa(r,1,t)}else r=e.day;else r=qd(this,e,Kd(this,e,jm,n),jm,n)}let c=this.R(i,a,r);if(!c)throw RangeError(`Cannot guess year`);let[l,u]=c;return Ps(No(this.U(l,u,r)),this.id||`iso8601`)}function Ud(e){return Ju(this)&&e.includes(`year`)?[...e,...Hp]:e}function Wd(e,t){let n=Object.assign(Object.create(null),e);return Jd(n,t,Kp),Ju(this)&&(Jd(n,t,Up),this.id===nm&&Jd(n,t,Zp,Hp)),n}function Gd(e,t){let n=Ju(e),r=im[e.id||``]||{},{era:i,eraYear:a,year:o}=t;if(i!==void 0||a!==void 0){if(i===void 0||a===void 0)throw TypeError(qf);if(!n)throw RangeError(Kf);let e=n[r[i]||i];if(e===void 0)throw RangeError(Yf(i));let t=qu(a,e);if(o!==void 0&&o!==t)throw RangeError(Jf);o=t}else if(o===void 0)throw TypeError(Xf(n));return o}function Kd(e,t,n,r){let{month:i,monthCode:a}=t;if(a!==void 0){let t=((e,t,n,r)=>{let i=e.F(n),[a,o]=Uu(t),s=Gu(a,o,i);if(o){let t=Yu(e);if(t===void 0)throw RangeError(ep);if(t>0){if(s>t)throw RangeError(ep);if(i===void 0){if(r===1)throw RangeError(ep);s--}}else if(s!==-t||i===void 0&&r===1)throw RangeError(ep)}return s})(e,a,n,r);if(i!==void 0&&i!==t)throw RangeError(Qf);i=t,r=1}else if(i===void 0)throw TypeError($f);return Da(`month`,i,1,e.O(n),r)}function qd(e,t,n,r,i){return Ea(t,`day`,1,e.B(r,n),i)}function Jd(e,t,n,r){let i=0,a=[];for(let e of n)t[e]===void 0?a.push(e):i=1;if(Object.assign(e,t),i)for(let t of r||a)delete e[t]}function Yd(e){let t=Xh(e.calendar),[n,r,i]=t.u(e),[a,o]=t.m(n,r);return{year:n,monthCode:Wu(a,o),day:i}}function Xd(e){return ks(Fo(Eo(ho(e))))}function Zd(e,t,n,r,i=em){return As(Fo(Eo(ho(n))),t(r),e(i))}function Qd(e,t,n,r,i=0,a=0,o=0,s=0,c=0,l=0,u=em){return js(Po(ss(Fa(_o,Pa(_m,[t,n,r,i,a,o,s,c,l])))),e(u))}function $d(e,t,n,r,i=em){return Ms(No(cs(Fa(_o,{isoYear:t,isoMonth:n,isoDay:r}))),e(i))}function ef(e,t,n,r=em,i=1){let a=_o(t),o=_o(n),s=e(r);return Ns(Mo(cs({isoYear:a,isoMonth:o,isoDay:_o(i)})),s)}function tf(e,t,n,r=em,i=jm){let a=_o(t),o=_o(n),s=e(r);return Ps(No(cs({isoYear:_o(i),isoMonth:a,isoDay:o})),s)}function nf(e=0,t=0,n=0,r=0,i=0,a=0){return Fs(ds(Fa(_o,Pa(hm,[e,t,n,r,i,a])),1))}function rf(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){return H(ml(Fa(vo,Pa(K,[e,t,n,r,i,a,o,s,c,l]))))}function af(e,t,n=em){return As(e.epochNanoseconds,t,n)}function of(e){return ks(e.epochNanoseconds)}function sf(e,t){return js(bh(t,e))}function cf(e,t){return Ms(bh(t,e))}function lf(e,t){return Fs(bh(t,e))}function uf(e,t,n,r){return As(Fo(((e,t,n,r)=>{let i=(e=>eh(Cs(e)))(r);return Lc(e(t),n,i)})(e,n,t,r)),n,t.calendar)}function df(e,t,n,r,i){let a=e(i.timeZone),o=i.plainTime,s=o===void 0?void 0:t(o),c=n(a),l;return l=s?Lc(c,{...r,...s}):Rc(c,{...r,...xm}),As(l,a,r.calendar)}function ff(e,t=xm){return js(Po({...e,...t}))}function pf(e,t,n){return Rd(e(t.calendar),n)}function mf(e,t,n){return Ld(e(t.calendar),n)}function hf(e,t,n,r){return((e,t,n)=>zd(e,t,Yp,co(n),qp))(e(t.calendar),n,r)}function gf(e,t,n,r){return((e,t,n)=>zd(e,t,Qp,co(n),Wp))(e(t.calendar),n,r)}function _f(e){return ks(Fo(Do(vo(e),jp)))}function vf(e){return ks(Fo(Eo(ho(e))))}function yf(e,t,n){let r=new Set(n);return(i,a)=>{let o=n&&za(i,n);if(!za(i=((e,t)=>{let n={};for(let r in t)e.has(r)||(n[r]=t[r]);return n})(r,i),e)){if(a&&o)throw TypeError(`Invalid formatting options`);i={...t,...i}}return n&&(i.timeZone=hh,[`full`,`long`].includes(i.ie)&&(i.ie=`medium`)),i}}function bf(e,t=xf,n=0){let[r,,,i]=e;return(a,o=kg,...s)=>{let c=t(i&&i(...s),a,o,r,n);return[c,...Cf(e,c.resolvedOptions(),s)]}}function xf(e,t,n,r,i){if(n=r(n,i),e){if(n.timeZone!==void 0)throw TypeError(Sp);n.timeZone=e}return new km(t,n)}function Sf(){return new km(void 0,{calendar:em}).resolvedOptions().calendar===em}function Cf(e,t,n){let[,r,i]=e;return n.map((e=>(e.calendar&&((e,t,n)=>{if((n||e!==`iso8601`)&&e!==t)throw RangeError(rp)})(e.calendar,t.calendar,i),r(e,t))))}function wf(e,t,n){let r=t.timeZone,i=e(r),a={...bh(t,i),...n||xm},o;return o=n?Ic(i,a,a.offsetNanoseconds,2):Rc(i,a),As(o,r,t.calendar)}function Tf(e,t=xm){return js(Po({...e,...t}))}function Ef(e,t){return{...e,calendar:t}}function Df(e,t){return{...e,timeZone:t}}function Of(e){let t=kf();return Go(t,e.N(t))}function kf(){return Do(Date.now(),jp)}function Af(){return new km().resolvedOptions().timeZone}const jf=(e,t)=>`Non-integer ${e}: ${t}`,Mf=(e,t)=>`Non-positive ${e}: ${t}`,Nf=(e,t)=>`Non-finite ${e}: ${t}`,Pf=e=>`Cannot convert bigint to ${e}`,Ff=e=>`Invalid bigint: ${e}`,If=`Cannot convert Symbol to string`,Lf=`Invalid object`,Rf=(e,t,n,r,i)=>i?Rf(e,i[t],i[n],i[r]):zf(e,t)+`; must be between ${n}-${r}`,zf=(e,t)=>`Invalid ${e}: ${t}`,Bf=e=>`Missing ${e}`,Vf=e=>`Invalid field ${e}`,Hf=e=>`Duplicate field ${e}`,Uf=e=>`No valid fields: `+e.join(),Wf=(e,t,n)=>zf(e,t)+`; must be `+Object.keys(n).join(),Gf=`Invalid calling context`,Kf=`Forbidden era/eraYear`,qf=`Mismatching era/eraYear`,Jf=`Mismatching year/eraYear`,Yf=e=>`Invalid era: ${e}`,Xf=e=>`Missing year`+(e?`/era/eraYear`:``),Zf=e=>`Invalid monthCode: ${e}`,Qf=`Mismatching month/monthCode`,$f=`Missing month/monthCode`,ep=`Invalid leap month`,tp=`Invalid protocol results`,np=e=>zf(`Calendar`,e),rp=`Mismatching Calendars`,ip=e=>zf(`TimeZone`,e),ap=`Mismatching TimeZones`,op=`Forbidden ICU TimeZone`,sp=`Out-of-bounds offset`,cp=`Out-of-bounds TimeZone gap`,lp=`Invalid TimeZone offset`,up=`Ambiguous offset`,dp=`Out-of-bounds date`,fp=`Out-of-bounds duration`,pp=`Cannot mix duration signs`,mp=`Missing relativeTo`,hp=`Cannot use large units`,gp=`Required smallestUnit or largestUnit`,_p=`smallestUnit > largestUnit`,vp=e=>`Cannot parse: ${e}`,yp=e=>`Invalid substring: ${e}`,bp=e=>`Cannot format ${e}`,xp=`Mismatching types for formatting`,Sp=`Cannot specify TimeZone`,Cp=z(Ia,((e,t)=>t)),wp=z(Ia,((e,t,n)=>n)),Tp=z(Ga,2),Ep={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Dp=Object.keys(Ep),Op=864e5,kp=1e3,Ap=1e3,jp=1e6,Mp=1e9,Np=6e10,Pp=36e11,W=864e11,Fp=[1,Ap,jp,Mp,Np,Pp,W],Ip=Dp.slice(0,6),Lp=Wa(Ip),Rp=[`offset`],zp=[`timeZone`],Bp=Ip.concat(Rp),Vp=Bp.concat(zp),Hp=[`era`,`eraYear`],Up=Hp.concat([`year`]),Wp=[`year`],Gp=[`monthCode`],Kp=[`month`].concat(Gp),qp=[`day`],Jp=Kp.concat(Wp),Yp=Gp.concat(Wp),Xp=qp.concat(Jp),Zp=qp.concat(Kp),Qp=qp.concat(Gp),$p=wp(Ip,0),em=`iso8601`,tm=`gregory`,nm=`japanese`,rm={[tm]:{"gregory-inverse":-1,gregory:0},[nm]:{"japanese-inverse":-1,japanese:0,meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018},ethiopic:{ethioaa:0,ethiopic:5500},coptic:{"coptic-inverse":-1,coptic:0},roc:{"roc-inverse":-1,roc:0},buddhist:{be:0},islamic:{ah:0},indian:{saka:0},persian:{ap:0}},im={[tm]:{bce:`gregory-inverse`,ce:`gregory`},[nm]:{bce:`japanese-inverse`,ce:`japanese`},ethiopic:{era0:`ethioaa`,era1:`ethiopic`},coptic:{era0:`coptic-inverse`,era1:`coptic`},roc:{broc:`roc-inverse`,minguo:`roc`}},am={chinese:13,dangi:13,hebrew:-6},G=z(lo,`string`),om=z(lo,`boolean`),sm=z(lo,`number`),K=Dp.map((e=>e+`s`)),cm=Wa(K),lm=K.slice(0,6),um=K.slice(6),dm=um.slice(1),fm=Cp(K),q=wp(K,0),pm=wp(lm,0),mm=z(Va,K),hm=[`isoNanosecond`,`isoMicrosecond`,`isoMillisecond`,`isoSecond`,`isoMinute`,`isoHour`],gm=[`isoDay`,`isoMonth`,`isoYear`],_m=hm.concat(gm),vm=Wa(gm),ym=Wa(hm),bm=Wa(_m),xm=wp(ym,0),Sm=z(Va,_m),Cm=1e8,wm=Cm*Op,Tm=[Cm,0],Em=[-Cm,0],Dm=275760,Om=-271821,km=Intl.DateTimeFormat,Am=1970,jm=1972,Mm=12,Nm=Uo(1868,9,8),Pm=ka(os,WeakMap),Fm=`smallestUnit`,Im=`unit`,Lm=`roundingIncrement`,Rm=`fractionalSecondDigits`,zm=`relativeTo`,Bm=`direction`,Vm={constrain:0,reject:1},Hm=Object.keys(Vm),Um={compatible:0,reject:1,earlier:2,later:3},Wm={reject:0,use:1,prefer:2,ignore:3},Gm={auto:0,never:1,critical:2,always:3},Km={auto:0,never:1,critical:2},qm={auto:0,never:1},Jm={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},Ym={previous:-1,next:1},Xm=z(Es,Fm),Zm=z(Es,`largestUnit`),Qm=z(Es,Im),$m=z(Ds,`overflow`,Vm),eh=z(Ds,`disambiguation`,Um),th=z(Ds,`offset`,Wm),nh=z(Ds,`calendarName`,Gm),rh=z(Ds,`timeZoneName`,Km),ih=z(Ds,`offset`,qm),ah=z(Ds,`roundingMode`,Jm),oh=`PlainYearMonth`,sh=`PlainMonthDay`,ch=`PlainDate`,lh=`PlainDateTime`,uh=`PlainTime`,dh=`ZonedDateTime`,fh=`Instant`,ph=`Duration`,mh=[Math.floor,e=>$a(e)?Math.floor(e):Math.round(e),Math.ceil,e=>$a(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>$a(e)?Math.trunc(e)||0:Math.round(e),e=>e<0?Math.floor(e):Math.ceil(e),e=>Math.sign(e)*Math.round(Math.abs(e))||0,e=>$a(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],hh=`UTC`,gh=5184e3,_h=Ho(1847),vh=Ho((()=>{let e=new Date;return(e.getTime()===0?2040:e.getUTCFullYear())+10})()),yh=/0+$/,bh=ka(Fc,WeakMap),xh=2**32-1,J=ka((e=>{let t=$l(e);return typeof t==`object`?new Ch(t):new Sh(t||0)}));var Sh=class{constructor(e){this.j=e}N(){return this.j}v(e){return(e=>{let t=B({...e,...xm});if(!t||Math.abs(t[0])>1e8)throw RangeError(dp)})(e),[Vo(e,this.j)]}l(){}},Ch=class{constructor(e){this.ae=(e=>{function t(e){let[t,s]=xl(qa(e,a,o)),c=r(t),l=r(s);return c===l?c:n(i(t,s),c,l,e)}function n(t,n,r,i){let a,o;for(;(i===void 0||(a=i<t[0]?n:i>=t[1]?r:void 0)===void 0)&&(o=t[1]-t[0]);){let n=t[0]+Math.floor(o/2);e(n)===r?t[1]=n:t[0]=n+1}return a}let r=ka(e),i=ka(bl),a=_h,o=vh;return{se(e){let n=t(e-86400),r=t(e+86400),i=e-n,a=e-r;if(n===r)return[i];let o=t(i);return o===t(a)?[e-o]:n>r?[i,a]:[]},ue:t,l(e,t){let s=qa(e,a,o),[c,l]=xl(s),u=gh*t,d=t<0?()=>l>a||(a=s,0):()=>c<o||(o=s,0);for(;d();){let a=r(c),o=r(l);if(a!==o){let r=i(c,l);n(r,a,o);let s=r[0];if((Ka(s,e)||1)===t)return s}c+=u,l+=u}}}})((e=>t=>{let n=qo(e,t*kp);return Ho(td(n),parseInt(n.month),parseInt(n.day),parseInt(n.hour),parseInt(n.minute),parseInt(n.second))-t})(e))}N(e){return this.ae.ue(Ro(e))*Mp}v(e){let[t,n]=[Ho((r=e).isoYear,r.isoMonth,r.isoDay,r.isoHour,r.isoMinute,r.isoSecond),r.isoMillisecond*jp+r.isoMicrosecond*Ap+r.isoNanosecond];var r;return this.ae.se(t).map((e=>Fo(So(Do(e,Mp),n))))}l(e,t){let[n,r]=zo(e),i=this.ae.l(n+(t>0||r?1:0),t);if(i!==void 0)return Do(i,Mp)}};const wh=`([+-])`,Th=`(?:[.,](\\d{1,9}))?`,Eh=`(?:(?:${wh}(\\d{6}))|(\\d{4}))-?(\\d{2})`,Dh=`(\\d{2})(?::?(\\d{2})(?::?(\\d{2})`+Th+`)?)?`,Oh=wh+Dh,kh=Eh+`-?(\\d{2})(?:[T ](\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?(Z|`+Oh+`)?)?`,Ah=`\\[(!?)([^\\]]*)\\]`,jh=`((?:${Ah}){0,9})`,Mh=ql(Eh+jh),Nh=ql(`(?:--)?(\\d{2})-?(\\d{2})`+jh),Ph=ql(kh+jh),Fh=ql(`T?`+Dh+`(?:`+Oh+`)?`+jh),Ih=ql(Oh),Lh=new RegExp(Ah,`g`),Rh=ql(`${wh}?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)${Th}H)?(?:(\\d+)${Th}M)?(?:(\\d+)${Th}S)?)?`),zh=ka((e=>new km(`en`,{calendar:em,timeZone:e,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hour12:0}))),Bh=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,Vh=/[^\w\/:+-]+/,Hh=/^M(\d{2})(L?)$/,Uh=ka(Zu),Wh=ka((e=>new km(`en`,{calendar:e,timeZone:`UTC`,era:`short`,year:`numeric`,month:`short`,day:`numeric`,hour12:0}))),Gh={P:Xc,h:ju,ee:Bd,ne:Vd,te:Hd,fields:Ud,oe:Wd,inLeapYear:Ru,monthsInYear:zu,daysInMonth:Bu,daysInYear:Vu,dayOfYear:Hu,era(e){return this.$(e)[0]},eraYear(e){return this.$(e)[1]},monthCode(e){let[t,n]=this.u(e),[r,i]=this.m(t,n);return Wu(r,i)},dayOfWeek:is,daysInWeek:$o},Kh={u:Yo,$:as,m:Xo},qh=Object.assign({},Gh,Object.assign({},{dayOfYear:Hu,u:Yo,M:Uo},{weekOfYear:Iu,yearOfWeek:Lu,I(e){function t(e){return(7-e<r?7:0)-e}function n(e){let n=ns(f+e),r=e||1;return u=(n+(t(Ya(c+n*r,7))-l)*r)/7}let r=this.id?1:4,i=is(e),a=this.dayOfYear(e),o=Ya(i-1,7),s=a-1,c=Ya(o-s,7),l=t(c),u,d=Math.floor((s-l)/7)+1,f=e.isoYear;return d?d>n(0)&&(d=1,f++):(d=n(-1),f--),[d,f,u]}}),{u:Yo,$:as,m:Xo,R:Zo,L:rs,F:Ha,O:es,q:Mu,B:ts,G:ns,U:Qo,M:Uo,p:Qc,year(e){return e.isoYear},month(e){return e.isoMonth},day:Jo}),Jh={u:rd,$:fd,m:od},Yh=Object.assign({},Gh,Object.assign({},{dayOfYear:Hu,u:rd,M:ad},{I(){return[]}},{weekOfYear:Iu,yearOfWeek:Lu}),{u:rd,$:fd,m:od,R:pd,L:cd,F:sd,O:dd,q:Nu,B:ud,G:ld,U:id,M:ad,p:$c,year(e){return this._(e).year},month(e){let{year:t,V:n}=this._(e),{X:r}=this.J(t);return r[n]+1},day:nd}),Xh=vd(Kh,Jh),Y=vd(qh,Yh),Zh=Object.assign({},{era:mo,eraYear:_o,year:_o,month:yo,monthCode(e){let t=mo(e);return Uu(t),t},day:yo},wp(Ip,_o),wp(K,vo),{offset(e){let t=mo(e);return Tl(t),t}}),Qh=z(La,Ip,hm),$h=z(La,hm,Ip),eg=`numeric`,tg=[`timeZoneName`],ng={month:eg,day:eg},rg={year:eg,month:eg},ig=Object.assign({},rg,{day:eg}),ag={hour:eg,minute:eg,second:eg},og=Object.assign({},ig,ag),sg=Object.assign({},og,{timeZoneName:`short`}),cg=Object.keys(rg),lg=Object.keys(ng),ug=Object.keys(ig),dg=Object.keys(ag),fg=[`dateStyle`],pg=cg.concat(fg),mg=lg.concat(fg),hg=ug.concat(fg,[`weekday`]),gg=dg.concat([`dayPeriod`,`timeStyle`,`fractionalSecondDigits`]),_g=hg.concat(gg),vg=tg.concat(gg),yg=tg.concat(hg),bg=tg.concat([`day`,`weekday`],gg),xg=tg.concat([`year`,`weekday`],gg),Sg=yf(_g,og),Cg=yf(_g,sg),wg=yf(_g,og,tg),Tg=yf(hg,ig,vg),Eg=yf(gg,ag,yg),Dg=yf(pg,rg,bg),Og=yf(mg,ng,xg),kg={},Ag=Sf(),jg=[Sg,Is],Mg=[Cg,Is,0,(e,t)=>{let n=e.timeZone;if(t&&t.timeZone!==n)throw RangeError(ap);return n}],Ng=[wg,Bo],Pg=[Tg,Bo],Fg=[Eg,e=>Io(e)/jp],Ig=[Dg,Bo,Ag],Lg=[Og,Bo,Ag];function Rg(e,t,n,r,i,a){function o(...e){if(!(this instanceof o))throw TypeError(Gf);{let n=t(...e);u_(this,n),Bg(this,n,a)}}function s(e,t){return Object.defineProperties((function(...t){return e.call(this,c(this),...t)}),Aa(t))}function c(t){let n=l_(t);if(!n||n.branding!==e)throw TypeError(Gf);return n}return Object.defineProperties(o.prototype,{...Ma(Fa(s,n)),...ja(Fa(s,r)),...Na(`Temporal.`+e)}),Object.defineProperties(o,{...ja(i),...Aa(e)}),[o,e=>{let t=Object.create(o.prototype);return u_(t,e),Bg(t,e,a),t},c]}function zg(e){if(l_(e)||e.calendar!==void 0||e.timeZone!==void 0)throw TypeError(`Invalid bag`);return e}function Bg(e,t,n){Bg.name===`dbg`&&Object.defineProperty(e,`o`,{value:n(t),writable:0,enumerable:0,configurable:0})}function Vg(e){return Hg(e)||`iso8601`}function Hg(e){let{calendar:t}=e;if(t!==void 0)return Ug(t)}function Ug(e){if(Oa(e)){let{calendar:t}=l_(e)||{};if(!t)throw TypeError(np(e));return t}return(e=>gd(Nl(G(e))))(e)}function Wg(e){let t={};for(let n in e)t[n]=e=>{let{calendar:t}=e;return Y(t)[n](e)};return t}function Gg(){throw TypeError(`Cannot use valueOf`)}function Kg(e){if(Oa(e)){let{timeZone:t}=l_(e)||{};if(!t)throw TypeError(ip(e));return t}return(e=>Zl(Pl(G(e))))(e)}function X(e){if(Oa(e)){let t=l_(e);return t&&t.branding===`Duration`?t:Ed(e)}return Ml(e)}function qg(e){if(e!==void 0){if(Oa(e)){let t=l_(e)||{};switch(t.branding){case dh:case ch:return t;case lh:return Ms(t)}let n=Vg(e);return{...yd(Kg,J,Y(n),e),calendar:n}}return Cl(e)}}function Jg(e,t){if(Oa(e)){let n=l_(e)||{};switch(n.branding){case uh:return V(t),n;case lh:return V(t),Fs(n);case dh:return V(t),lf(J,n)}return Td(e,t)}let n=jl(e);return V(t),n}function Yg(e){return e===void 0?void 0:Jg(e)}function Xg(e,t){if(Oa(e)){let n=l_(e)||{};switch(n.branding){case lh:return V(t),n;case ch:return V(t),js({...n,...xm});case dh:return V(t),sf(J,n)}return xd(Y(Vg(e)),e,t)}let n=El(e);return V(t),n}function Zg(e,t){if(Oa(e)){let n=l_(e);if(n&&n.branding===`PlainMonthDay`)return V(t),n;let r=Hg(e);return wd(Y(r||`iso8601`),!r,e,t)}let n=Al(Y,e);return V(t),n}function Qg(e,t){if(Oa(e)){let n=l_(e);return n&&n.branding===`PlainYearMonth`?(V(t),n):Cd(Y(Vg(e)),e,t)}let n=Ol(Y,e);return V(t),n}function $g(e,t){if(Oa(e)){let n=l_(e)||{};switch(n.branding){case ch:return V(t),n;case lh:return V(t),Ms(n);case dh:return V(t),cf(J,n)}return Sd(Y(Vg(e)),e,t)}let n=Dl(e);return V(t),n}function e_(e,t){if(Oa(e)){let n=l_(e);if(n&&n.branding===`ZonedDateTime`)return fs(t),n;let r=Vg(e);return bd(Kg,J,Y(r),r,e,t)}return wl(e,t)}function t_(e){return Fa((e=>t=>e(n_(t))),e)}function n_(e){return bh(e,J)}function r_(e){if(Oa(e)){let t=l_(e);if(t)switch(t.branding){case fh:return t;case dh:return ks(t.epochNanoseconds)}}return Sl(e)}function i_(){function e(e,n){return new t(e,n)}function t(e,t=Object.create(null)){Z_.set(this,((e,t)=>{let n=new km(e,t),r=n.resolvedOptions(),i=r.locale,a=Ra(Object.keys(t),r),o=ka(s_),s=(e,...t)=>{if(e){if(t.length!==2)throw TypeError(xp);for(let e of t)if(e===void 0)throw TypeError(xp)}e||t[0]!==void 0||(t=[]);let r=t.map((e=>l_(e)||Number(e))),s,c=0;for(let e of r){let t=typeof e==`object`?e.branding:void 0;if(c++&&t!==s)throw TypeError(xp);s=t}return s?o(s)(i,a,...r):[n,...r]};return s.i=n,s})(e,t))}let n=km.prototype,r=Object.getOwnPropertyDescriptors(n),i=Object.getOwnPropertyDescriptors(km);for(let t in r){let n=r[t],i=t.startsWith(`format`)&&a_(t);typeof n.value==`function`?n.value=t===`constructor`?e:i||o_(t):i&&(n.get=function(){if(!Z_.has(this))throw TypeError(`Invalid calling context`);return(...e)=>i.apply(this,e)},Object.defineProperties(n.get,Aa(`get ${t}`)))}return i.prototype.value=t.prototype=Object.create({},r),Object.defineProperties(e,i),e}function a_(e){return Object.defineProperties((function(...t){let[n,...r]=Z_.get(this)(e.includes(`Range`),...t);return n[e](...r)}),Aa(e))}function o_(e){return Object.defineProperties((function(...t){return Z_.get(this).i[e](...t)}),Aa(e))}function s_(e){let t=C_[e];if(!t)throw TypeError(bp(e));return bf(t,ka(xf),1)}const c_=new WeakMap,l_=c_.get.bind(c_),u_=c_.set.bind(c_),d_={era:no,eraYear:io,year:oo,month:ao,daysInMonth:ao,daysInYear:ao,inLeapYear:om,monthsInYear:ao},f_={monthCode:G},p_={day:ao},m_=Wg(Object.assign({},d_,f_,p_,{dayOfWeek:ao,dayOfYear:ao,weekOfYear:ro,yearOfWeek:io,daysInWeek:ao})),h_=Wg({...d_,...f_}),g_=Wg({...f_,...p_}),__={calendarId:e=>e.calendar},v_=Ia((e=>t=>t[e]),K.concat(`sign`)),y_=Ia(((e,t)=>e=>e[hm[t]]),Ip),b_={epochMilliseconds:Is,epochNanoseconds:Ls},[x_,Z,S_]=Rg(ph,rf,{...v_,blank:fl},{with:(e,t)=>Z(Id(e,t)),negated:e=>Z(ul(e)),abs:e=>Z(ll(e)),add:(e,t,n)=>Z(sl(qg,Y,J,0,e,X(t),n)),subtract:(e,t,n)=>Z(sl(qg,Y,J,1,e,X(t),n)),round:(e,t)=>Z(cl(qg,Y,J,e,t)),total:(e,t)=>zs(qg,Y,J,e,t),toLocaleString(e,t,n){return Intl.DurationFormat?new Intl.DurationFormat(t,n).format(this):xc(e)},toString:xc,toJSON:e=>xc(e),valueOf:Gg},{from:e=>Z(X(e)),compare:(e,t,n)=>nu(qg,Y,J,X(e),X(t),n)},xc),C_={Instant:jg,PlainDateTime:Ng,PlainDate:Pg,PlainTime:Fg,PlainYearMonth:Ig,PlainMonthDay:Lg},w_=bf(jg),T_=bf(Mg),E_=bf(Ng),D_=bf(Pg),O_=bf(Fg),k_=bf(Ig),A_=bf(Lg),[j_,M_]=Rg(uh,nf,y_,{with(e,t,n){return M_(Fd(this,zg(t),n))},add:(e,t)=>M_(Wc(0,e,X(t))),subtract:(e,t)=>M_(Wc(1,e,X(t))),until:(e,t,n)=>Z(bu(0,e,Jg(t),n)),since:(e,t,n)=>Z(bu(1,e,Jg(t),n)),round:(e,t)=>M_(qs(e,t)),equals:(e,t)=>fu(e,Jg(t)),toLocaleString(e,t,n){let[r,i]=O_(t,n,e);return r.format(i)},toString:bc,toJSON:e=>bc(e),valueOf:Gg},{from:(e,t)=>M_(Jg(e,t)),compare:(e,t)=>au(Jg(e),Jg(t))},bc),[N_,P_]=Rg(lh,z(Qd,hd),{...__,...m_,...y_},{with:(e,t,n)=>P_(jd(Y,e,zg(t),n)),withCalendar:(e,t)=>P_(Ef(e,Ug(t))),withPlainTime:(e,t)=>P_(Tf(e,Yg(t))),add:(e,t,n)=>P_(Vc(Y,0,e,X(t),n)),subtract:(e,t,n)=>P_(Vc(Y,1,e,X(t),n)),until:(e,t,n)=>Z(gu(Y,0,e,Xg(t),n)),since:(e,t,n)=>Z(gu(Y,1,e,Xg(t),n)),round:(e,t)=>P_(Ks(e,t)),equals:(e,t)=>cu(e,Xg(t)),toZonedDateTime:(e,t,n)=>Q(uf(J,e,Kg(t),n)),toPlainDate:e=>H_(Ms(e)),toPlainTime:e=>M_(Fs(e)),toLocaleString(e,t,n){let[r,i]=E_(t,n,e);return r.format(i)},toString:gc,toJSON:e=>gc(e),valueOf:Gg},{from:(e,t)=>P_(Xg(e,t)),compare:(e,t)=>ru(Xg(e),Xg(t))},gc),[F_,I_,L_]=Rg(sh,z(tf,hd),{...__,...g_},{with:(e,t,n)=>I_(Pd(Y,e,zg(t),n)),equals:(e,t)=>du(e,Zg(t)),toPlainDate(e,t){return H_(gf(Y,e,this,t))},toLocaleString(e,t,n){let[r,i]=A_(t,n,e);return r.format(i)},toString:yc,toJSON:e=>yc(e),valueOf:Gg},{from:(e,t)=>I_(Zg(e,t))},yc),[R_,z_,B_]=Rg(oh,z(ef,hd),{...__,...h_},{with:(e,t,n)=>z_(Nd(Y,e,zg(t),n)),add:(e,t,n)=>z_(Uc(Y,0,e,X(t),n)),subtract:(e,t,n)=>z_(Uc(Y,1,e,X(t),n)),until:(e,t,n)=>Z(vu(Y,0,e,Qg(t),n)),since:(e,t,n)=>Z(vu(Y,1,e,Qg(t),n)),equals:(e,t)=>uu(e,Qg(t)),toPlainDate(e,t){return H_(hf(Y,e,this,t))},toLocaleString(e,t,n){let[r,i]=k_(t,n,e);return r.format(i)},toString:vc,toJSON:e=>vc(e),valueOf:Gg},{from:(e,t)=>z_(Qg(e,t)),compare:(e,t)=>iu(Qg(e),Qg(t))},vc),[V_,H_,U_]=Rg(ch,z($d,hd),{...__,...m_},{with:(e,t,n)=>H_(Md(Y,e,zg(t),n)),withCalendar:(e,t)=>H_(Ef(e,Ug(t))),add:(e,t,n)=>H_(Hc(Y,0,e,X(t),n)),subtract:(e,t,n)=>H_(Hc(Y,1,e,X(t),n)),until:(e,t,n)=>Z(_u(Y,0,e,$g(t),n)),since:(e,t,n)=>Z(_u(Y,1,e,$g(t),n)),equals:(e,t)=>lu(e,$g(t)),toZonedDateTime(e,t){return Q(df(Kg,Jg,J,e,Oa(t)?t:{timeZone:t}))},toPlainDateTime:(e,t)=>P_(ff(e,Yg(t))),toPlainYearMonth(e){return z_(pf(Y,e,this))},toPlainMonthDay(e){return I_(mf(Y,e,this))},toLocaleString(e,t,n){let[r,i]=D_(t,n,e);return r.format(i)},toString:_c,toJSON:e=>_c(e),valueOf:Gg},{from:(e,t)=>H_($g(e,t)),compare:(e,t)=>iu($g(e),$g(t))},_c),[W_,Q]=Rg(dh,z(Zd,hd,Xl),{...b_,...__,...t_(m_),...t_(y_),offset:e=>kc(n_(e).offsetNanoseconds),offsetNanoseconds:e=>n_(e).offsetNanoseconds,timeZoneId:e=>e.timeZone,hoursInDay:e=>Js(J,e)},{with:(e,t,n)=>Q(Ad(Y,J,e,zg(t),n)),withCalendar:(e,t)=>Q(Ef(e,Ug(t))),withTimeZone:(e,t)=>Q(Df(e,Kg(t))),withPlainTime:(e,t)=>Q(wf(J,e,Yg(t))),add:(e,t,n)=>Q(Bc(Y,J,0,e,X(t),n)),subtract:(e,t,n)=>Q(Bc(Y,J,1,e,X(t),n)),until:(e,t,n)=>Z(H(hu(Y,J,0,e,e_(t),n))),since:(e,t,n)=>Z(H(hu(Y,J,1,e,e_(t),n))),round:(e,t)=>Q(Gs(J,e,t)),startOfDay:e=>Q(Ys(J,e)),equals:(e,t)=>su(e,e_(t)),toInstant:e=>K_(of(e)),toPlainDateTime:e=>P_(sf(J,e)),toPlainDate:e=>H_(cf(J,e)),toPlainTime:e=>M_(lf(J,e)),toLocaleString(e,t,n={}){let[r,i]=T_(t,n,e);return r.format(i)},toString:(e,t)=>hc(J,e,t),toJSON:e=>hc(J,e),valueOf:Gg,getTimeZoneTransition(e,t){let{timeZone:n,epochNanoseconds:r}=e,i=_s(t),a=J(n).l(r,i);return a?Q({...e,epochNanoseconds:a}):null}},{from:(e,t)=>Q(e_(e,t)),compare:(e,t)=>tu(e_(e),e_(t))},(e=>hc(J,e))),[G_,K_,q_]=Rg(fh,Xd,b_,{add:(e,t)=>K_(zc(0,e,X(t))),subtract:(e,t)=>K_(zc(1,e,X(t))),until:(e,t,n)=>Z(mu(0,e,r_(t),n)),since:(e,t,n)=>Z(mu(1,e,r_(t),n)),round:(e,t)=>K_(Ws(e,t)),equals:(e,t)=>ou(e,r_(t)),toZonedDateTimeISO:(e,t)=>Q(af(e,Kg(t))),toLocaleString(e,t,n){let[r,i]=w_(t,n,e);return r.format(i)},toString:(e,t)=>mc(Kg,J,e,t),toJSON:e=>mc(Kg,J,e),valueOf:Gg},{from:e=>K_(r_(e)),fromEpochMilliseconds:e=>K_(_f(e)),fromEpochNanoseconds:e=>K_(vf(e)),compare:(e,t)=>eu(r_(e),r_(t))},(e=>mc(Kg,J,e))),J_=Object.defineProperties({},{...Na(`Temporal.Now`),...ja({timeZoneId:()=>Af(),instant:()=>K_(ks(kf())),zonedDateTimeISO:(e=Af())=>Q(As(kf(),Kg(e),em)),plainDateTimeISO:(e=Af())=>P_(js(Of(J(Kg(e))),em)),plainDateISO:(e=Af())=>H_(Ms(Of(J(Kg(e))),em)),plainTimeISO:(e=Af())=>M_(Fs(Of(J(Kg(e)))))})}),Y_=Object.defineProperties({},{...Na(`Temporal`),...ja({PlainYearMonth:R_,PlainMonthDay:F_,PlainDate:V_,PlainTime:j_,PlainDateTime:N_,ZonedDateTime:W_,Instant:G_,Duration:x_,Now:J_})}),X_=i_(),Z_=new WeakMap;ja({DateTimeFormat:X_});const Q_=[`day`,`week`,`month`,`year`],$_=()=>Y_.Now.instant().epochMilliseconds/1e3,ev=(e,t)=>{let n=[`main`,`master`];return n.includes(e)?-1:n.includes(t)?1:e.toLowerCase().localeCompare(t.toLowerCase())},tv=(e,t)=>{let n=(0,la.valid)((0,la.clean)(e)),r=(0,la.valid)((0,la.clean)(t));return!n||!r?n?1:r?-1:e.toLowerCase().localeCompare(t.toLowerCase()):(0,la.compare)(n,r)};function nv({currentVersion:e,latestVersion:t}){return`https://github.com/git-truck/git-truck/compare/v${e}...v${t}`}function rv(e,t,n){let r=[],i=new Date(t*1e3);if(i.setUTCHours(0,0,0,0),e===`week`){let e=(i.getUTCDay()+6)%7;i.setUTCDate(i.getUTCDate()-e)}else e===`month`?i.setUTCDate(1):e===`year`&&i.setUTCMonth(0,1);let a=new Date(n*1e3);for(;i<=a;){let t=i.getTime()/1e3,n=i.toISOString().split(`T`)[0];switch(e){case`day`:{let e=i.toLocaleDateString(`en-gb`,{day:`numeric`,month:`numeric`,timeZone:`UTC`}).replace(`,`,``);r.push({label:e,lookup:n,timestamp:t}),i.setUTCDate(i.getUTCDate()+1);break}case`week`:{let e=new Date(i);e.setUTCDate(e.getUTCDate()+4-(e.getUTCDay()||7));let a=new Date(Date.UTC(e.getUTCFullYear(),0,1)),o=Math.ceil(((e.getTime()-a.getTime())/864e5+1)/7);r.push({label:`W${o<10?`0`:``}${o}`,lookup:n,timestamp:t}),i.setUTCDate(i.getUTCDate()+7);break}case`year`:r.push({label:i.getUTCFullYear().toString(),lookup:n,timestamp:t}),i.setUTCFullYear(i.getUTCFullYear()+1);break;case`month`:r.push({label:i.toLocaleString(`en-gb`,{month:`short`,timeZone:`UTC`}),lookup:n,timestamp:t}),i.setUTCMonth(i.getUTCMonth()+1);break;default:throw Error(`Unsupported time unit: ${e}`)}}return r}function iv(e,t,n,r,i){let a=/(?:.*{(?<oldPath>.*)\s=>\s(?<newPath>.*)}.*)|(?:^(?<oldPath2>.*) => (?<newPath2>.*))$/gm,o=/{.*}/gm,s=a.exec(e)?.groups??{},c,l;if(s.oldPath||s.newPath){let t=s.oldPath??``,n=s.newPath??``;c=i+`/`+e.replace(o,t).replace(`//`,`/`),l=i+`/`+e.replace(o,n).replace(`//`,`/`)}else c=i+`/`+(s.oldPath2??``),l=i+`/`+(s.newPath2??``);return r.push({fromName:c,toName:l,timestamp:t,timestampAuthor:n}),l}const av=e=>e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`;async function $(e){try{return[await e,null]}catch(e){return[null,e]}}function ov(e){if(e=e.replace(/\\/g,`/`),e=e.replace(/\/+/g,`/`),e.length<=1||!e.endsWith(`/`))return e;let t=e.slice(0,-1);return e.split(`/`).length>2?t:e}var sv=class{instance;connection;async init(){return await this.initTables(),await this.initViews(0,$_()),this}constructor({instance:e,connection:t}){this.instance=e,this.connection=t}async close(){this.connection.disconnectSync(),this.instance.closeSync()}async query(e){return I.debug(`query:`,e.trim().replaceAll(/\s+/g,` `)),(await this.connection.runAndReadAll(e)).getRowObjects()}async prepare(e){return I.debug(`prepare:`,e.trim().replaceAll(/\s+/g,` `)),this.connection.prepare(e)}async usingPreparedStatement(e,t,n){let r=null,i=n?` (${n})`:``;try{r=await this.prepare(e)}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Failed to prepare statement${i}: ${n}\nSQL: ${e.trim()}`,{cause:t instanceof Error?t:void 0})}try{return await t(r)}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Failed to execute prepared statement${i}: ${n}\nSQL: ${e.trim()}`,{cause:t instanceof Error?t:void 0})}finally{r.destroySync()}}async run(e){I.debug(`run:`,e.trim().replaceAll(/\s+/g,` `)),await this.connection.run(e)}async usingTableAppender(e,t){let n=await this.connection.createAppender(e);try{await t(n)}finally{n.closeSync()}}async checkpoint(){await this.run(`CHECKPOINT;`)}async initTables(){await this.connection.run(`
|
|
390
390
|
CREATE TABLE IF NOT EXISTS commits (
|
|
391
|
-
hash VARCHAR,
|
|
392
|
-
author VARCHAR,
|
|
393
|
-
authorEmail VARCHAR,
|
|
394
|
-
committerTime UINTEGER,
|
|
395
|
-
authorTime UINTEGER
|
|
391
|
+
hash VARCHAR NOT NULL,
|
|
392
|
+
author VARCHAR NOT NULL,
|
|
393
|
+
authorEmail VARCHAR NOT NULL,
|
|
394
|
+
committerTime UINTEGER NOT NULL,
|
|
395
|
+
authorTime UINTEGER NOT NULL,
|
|
396
|
+
parentHash VARCHAR NOT NULL,
|
|
397
|
+
secondaryParentHash VARCHAR,
|
|
396
398
|
);
|
|
397
399
|
CREATE TABLE IF NOT EXISTS fileChanges (
|
|
398
|
-
commitHash VARCHAR,
|
|
399
|
-
insertions UINTEGER,
|
|
400
|
-
deletions UINTEGER,
|
|
401
|
-
filePath VARCHAR,
|
|
400
|
+
commitHash VARCHAR NOT NULL,
|
|
401
|
+
insertions UINTEGER NOT NULL,
|
|
402
|
+
deletions UINTEGER NOT NULL,
|
|
403
|
+
filePath VARCHAR NOT NULL,
|
|
402
404
|
);
|
|
403
405
|
CREATE TABLE IF NOT EXISTS commitTrailers (
|
|
404
|
-
commitHash VARCHAR,
|
|
405
|
-
name VARCHAR,
|
|
406
|
-
email VARCHAR,
|
|
407
|
-
trailerType VARCHAR
|
|
406
|
+
commitHash VARCHAR NOT NULL,
|
|
407
|
+
name VARCHAR NOT NULL,
|
|
408
|
+
email VARCHAR NOT NULL,
|
|
409
|
+
trailerType VARCHAR NOT NULL
|
|
408
410
|
);
|
|
409
411
|
CREATE TABLE IF NOT EXISTS contributorGroups (
|
|
410
|
-
displayName VARCHAR,
|
|
411
|
-
email VARCHAR,
|
|
412
|
-
name VARCHAR
|
|
412
|
+
displayName VARCHAR NOT NULL,
|
|
413
|
+
email VARCHAR NOT NULL,
|
|
414
|
+
name VARCHAR NOT NULL
|
|
413
415
|
);
|
|
414
416
|
CREATE TABLE IF NOT EXISTS renames (
|
|
415
417
|
fromName VARCHAR,
|
|
416
418
|
toName VARCHAR,
|
|
417
|
-
timestamp UINTEGER,
|
|
418
|
-
timestampAuthor UINTEGER
|
|
419
|
+
timestamp UINTEGER NOT NULL,
|
|
420
|
+
timestampAuthor UINTEGER NOT NULL
|
|
419
421
|
);
|
|
420
422
|
|
|
421
423
|
CREATE SEQUENCE IF NOT EXISTS hiddenFiles_id_sequence START 1;
|
|
422
424
|
|
|
423
425
|
CREATE TABLE IF NOT EXISTS hiddenFiles (
|
|
424
|
-
id INTEGER DEFAULT nextval('hiddenFiles_id_sequence'),
|
|
425
|
-
path VARCHAR
|
|
426
|
+
id INTEGER NOT NULL DEFAULT nextval('hiddenFiles_id_sequence'),
|
|
427
|
+
path VARCHAR NOT NULL
|
|
426
428
|
);
|
|
427
429
|
CREATE TABLE IF NOT EXISTS metadata (
|
|
428
|
-
field VARCHAR,
|
|
430
|
+
field VARCHAR NOT NULL,
|
|
429
431
|
intValue UBIGINT,
|
|
430
432
|
stringValue VARCHAR
|
|
431
433
|
);
|
|
432
434
|
CREATE TABLE IF NOT EXISTS temporaryRenames (
|
|
433
435
|
fromName VARCHAR,
|
|
434
436
|
toName VARCHAR,
|
|
435
|
-
timestamp UINTEGER,
|
|
436
|
-
timestampEnd UINTEGER
|
|
437
|
+
timestamp UINTEGER NOT NULL,
|
|
438
|
+
timestampEnd UINTEGER NOT NULL
|
|
437
439
|
);
|
|
438
440
|
CREATE TABLE IF NOT EXISTS files (
|
|
439
|
-
path VARCHAR,
|
|
440
|
-
name VARCHAR,
|
|
441
|
-
hash VARCHAR,
|
|
442
|
-
type VARCHAR,
|
|
443
|
-
byteSize UINTEGER
|
|
441
|
+
path VARCHAR NOT NULL,
|
|
442
|
+
name VARCHAR NOT NULL,
|
|
443
|
+
hash VARCHAR NOT NULL,
|
|
444
|
+
type VARCHAR NOT NULL,
|
|
445
|
+
byteSize UINTEGER NOT NULL
|
|
444
446
|
);
|
|
445
447
|
|
|
446
448
|
`)}async getDbConnection(){return this.connection}async clearAllTables(){await this.run(`
|
|
@@ -456,13 +458,15 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
456
458
|
CREATE INDEX IF NOT EXISTS commitsTime ON commits(committerTime);
|
|
457
459
|
CREATE INDEX IF NOT EXISTS renamesTime ON renames(timestamp);`)}async initViews(e,t){await this.connection.run(`
|
|
458
460
|
CREATE OR REPLACE VIEW commits_unioned AS
|
|
459
|
-
SELECT c.hash, CASE WHEN cg.displayName IS NOT NULL THEN cg.displayName ELSE c.author END AS author, c.authorEmail,
|
|
461
|
+
SELECT c.hash, CASE WHEN cg.displayName IS NOT NULL THEN cg.displayName ELSE c.author END AS author, c.authorEmail,
|
|
462
|
+
c.committerTime, c.authorTime, c.parentHash, c.secondaryParentHash FROM
|
|
460
463
|
commits c LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
461
464
|
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
462
465
|
WHERE c.committerTime BETWEEN ${e} AND ${t};
|
|
463
466
|
|
|
464
467
|
CREATE OR REPLACE VIEW fileChanges_commits AS
|
|
465
|
-
SELECT f.commitHash, f.insertions, f.deletions, f.filePath, author, c.authorEmail, c.committerTime, c.authorTime
|
|
468
|
+
SELECT f.commitHash, f.insertions, f.deletions, f.filePath, author, c.authorEmail, c.committerTime, c.authorTime,
|
|
469
|
+
c.parentHash, c.secondaryParentHash FROM
|
|
466
470
|
fileChanges f JOIN commits_unioned c on f.commitHash = c.hash;
|
|
467
471
|
|
|
468
472
|
CREATE OR REPLACE VIEW commitTrailers_unioned AS
|
|
@@ -472,6 +476,7 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
472
476
|
|
|
473
477
|
CREATE OR REPLACE VIEW fileChanges_commits_renamed AS
|
|
474
478
|
SELECT f.commitHash, f.insertions, f.deletions, f.author, f.authorEmail, f.committerTime, f.authorTime,
|
|
479
|
+
f.parentHash, f.secondaryParentHash,
|
|
475
480
|
CASE
|
|
476
481
|
WHEN r.toName IS NOT NULL THEN r.toName
|
|
477
482
|
ELSE f.filePath
|
|
@@ -539,15 +544,15 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
539
544
|
);
|
|
540
545
|
`,async t=>{t.bindVarchar(1,e),t.bindVarchar(2,e),await t.run()},`addHiddenFile`)}async removeHiddenFile(e){await this.usingPreparedStatement(`DELETE FROM hiddenFiles
|
|
541
546
|
WHERE path = ?;
|
|
542
|
-
`,async t=>{t.bindVarchar(1,e),await t.run()},`removeHiddenFile`)}async clearHiddenFiles(){await this.run(`DELETE FROM hiddenFiles;`)}async getCommits(e,t){let n=await this.getObjectTypeFromPath(e)===`blob`;return(await this.usingPreparedStatement(n?`SELECT distinct commitHash, author, authorEmail, committerTime, authorTime, message, body
|
|
547
|
+
`,async t=>{t.bindVarchar(1,e),await t.run()},`removeHiddenFile`)}async clearHiddenFiles(){await this.run(`DELETE FROM hiddenFiles;`)}async getCommits(e,t){let n=await this.getObjectTypeFromPath(e)===`blob`;return(await this.usingPreparedStatement(n?`SELECT distinct parentHash, secondaryParentHash, commitHash, author, authorEmail, committerTime, authorTime, message, body
|
|
543
548
|
FROM fileChanges_commits_renamed_cached
|
|
544
549
|
WHERE filePath = ?
|
|
545
550
|
ORDER BY committerTime DESC, commitHash
|
|
546
|
-
LIMIT ?;`:`SELECT distinct commitHash, author, authorEmail, committerTime, authorTime, message, body
|
|
551
|
+
LIMIT ?;`:`SELECT distinct parentHash, secondaryParentHash, commitHash, author, authorEmail, committerTime, authorTime, message, body
|
|
547
552
|
FROM fileChanges_commits_renamed_cached
|
|
548
553
|
WHERE starts_with(filePath, ?) = true
|
|
549
554
|
ORDER BY committerTime DESC, commitHash
|
|
550
|
-
LIMIT ?;`,async r=>(r.bindVarchar(1,n?e:e+`/`),r.bindUInteger(2,t),(await r.runAndReadAll()).getRowObjects()),`getCommits`)).map(e=>({author:{name:String(e.author),email:String(e.authorEmail)},committerTime:e.committerTime,authorTime:e.authorTime,body:e.body,hash:e.commitHash,message:e.message}))}async getCommitHashes(e,t,n=[]){let r=await this.getObjectTypeFromPath(e)===`blob`,i=n.map(()=>`?`).join(`,`);if(r){let r=n.length>0?`SELECT distinct commitHash
|
|
555
|
+
LIMIT ?;`,async r=>(r.bindVarchar(1,n?e:e+`/`),r.bindUInteger(2,t),(await r.runAndReadAll()).getRowObjects()),`getCommits`)).map(e=>({author:{name:String(e.author),email:String(e.authorEmail)},committerTime:e.committerTime,authorTime:e.authorTime,body:e.body,hash:e.commitHash,message:e.message,parentHash:String(e.parentHash??``),secondaryParentHash:typeof e.secondaryParentHash==`string`?e.secondaryParentHash:null}))}async getCommitHashes(e,t,n=[]){let r=await this.getObjectTypeFromPath(e)===`blob`,i=n.map(()=>`?`).join(`,`);if(r){let r=n.length>0?`SELECT distinct commitHash
|
|
551
556
|
FROM fileChanges_commits_renamed_cached
|
|
552
557
|
WHERE filePath = ? AND (
|
|
553
558
|
author IN (${i})
|
|
@@ -584,7 +589,18 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
584
589
|
ORDER BY committerTime DESC, commitHash
|
|
585
590
|
LIMIT ?;`:`SELECT distinct commitHash
|
|
586
591
|
FROM fileChanges_commits_renamed_cached ORDER BY committerTime DESC, commitHash
|
|
587
|
-
LIMIT ?;`;return this.usingPreparedStatement(e,async e=>{let r=1;for(let t of n)e.bindVarchar(r++,t);for(let t of n)e.bindVarchar(r++,t);return e.bindUInteger(r++,t),(await e.runAndReadAll()).getRowObjects().map(e=>e.commitHash)},`getCommitHashes(root)`)}}async
|
|
592
|
+
LIMIT ?;`;return this.usingPreparedStatement(e,async e=>{let r=1;for(let t of n)e.bindVarchar(r++,t);for(let t of n)e.bindVarchar(r++,t);return e.bindUInteger(r++,t),(await e.runAndReadAll()).getRowObjects().map(e=>e.commitHash)},`getCommitHashes(root)`)}}async getCommitHashesForRepo(e,t=[]){let n=t.map(()=>`?`).join(`,`),r=t.length>0?`SELECT DISTINCT hash
|
|
593
|
+
FROM commits_unioned WHERE (
|
|
594
|
+
author IN (${n})
|
|
595
|
+
OR hash IN (
|
|
596
|
+
SELECT commitHash FROM commitTrailers_unioned
|
|
597
|
+
WHERE trailerType = 'coauthor' AND name IN (${n})
|
|
598
|
+
)
|
|
599
|
+
)
|
|
600
|
+
ORDER BY committerTime DESC, hash
|
|
601
|
+
LIMIT ?;`:`SELECT DISTINCT hash
|
|
602
|
+
FROM commits_unioned ORDER BY committerTime DESC, hash
|
|
603
|
+
LIMIT ?;`;return this.usingPreparedStatement(r,async n=>{let r=1;for(let e of t)n.bindVarchar(r++,e);for(let e of t)n.bindVarchar(r++,e);return n.bindUInteger(r++,e),(await n.runAndReadAll()).getRowObjects().map(e=>e.hash)},`getCommitHashesForRepo`)}async getCommitCountForPath({objectPath:e,startSecs:t,endSecs:n,contributors:r=[]}){let i=await this.getObjectTypeFromPath(e)===`blob`,a=r.map(()=>`?`).join(`,`);if(i){let i=r.length>0?`SELECT COUNT(DISTINCT commitHash) AS count from fileChanges_commits_renamed_cached
|
|
588
604
|
WHERE filePath = ?
|
|
589
605
|
AND committerTime BETWEEN ? AND ? AND (
|
|
590
606
|
author IN (${a})
|
|
@@ -606,7 +622,13 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
606
622
|
SELECT commitHash FROM commitTrailers_unioned
|
|
607
623
|
WHERE trailerType = 'coauthor' AND name IN (${a})
|
|
608
624
|
)
|
|
609
|
-
);`:`SELECT COUNT(DISTINCT commitHash) AS count from fileChanges_commits_renamed_cached;`;return this.usingPreparedStatement(e,async e=>{let t=1;for(let n of r)e.bindVarchar(t++,n);for(let n of r)e.bindVarchar(t++,n);let n=(await e.runAndReadAll()).getRowObjects();return Number(n[0].count)},`getCommitCountForPath(root)`)}}async
|
|
625
|
+
);`:`SELECT COUNT(DISTINCT commitHash) AS count from fileChanges_commits_renamed_cached;`;return this.usingPreparedStatement(e,async e=>{let t=1;for(let n of r)e.bindVarchar(t++,n);for(let n of r)e.bindVarchar(t++,n);let n=(await e.runAndReadAll()).getRowObjects();return Number(n[0].count)},`getCommitCountForPath(root)`)}}async getCommitCountForRepo(e=[]){let t=e.map(()=>`?`).join(`,`),n=e.length>0?`SELECT COUNT(DISTINCT hash) AS count FROM commits_unioned WHERE (
|
|
626
|
+
author IN (${t})
|
|
627
|
+
OR hash IN (
|
|
628
|
+
SELECT commitHash FROM commitTrailers_unioned
|
|
629
|
+
WHERE trailerType = 'coauthor' AND name IN (${t})
|
|
630
|
+
)
|
|
631
|
+
);`:`SELECT COUNT(DISTINCT hash) AS count FROM commits_unioned;`;return this.usingPreparedStatement(n,async t=>{let n=1;for(let r of e)t.bindVarchar(n++,r);for(let r of e)t.bindVarchar(n++,r);let r=(await t.runAndReadAll()).getRowObjects();return Number(r[0].count)},`getCommitCountForRepo`)}async getCommitCountPerFile(){let e=await this.query(`SELECT filePath, count(DISTINCT commitHash) AS count
|
|
610
632
|
FROM fileChanges_commits_renamed_cached
|
|
611
633
|
GROUP BY filePath
|
|
612
634
|
ORDER BY count DESC;
|
|
@@ -669,7 +691,18 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
669
691
|
)
|
|
670
692
|
SELECT DISTINCT contributor
|
|
671
693
|
FROM file_contributors;
|
|
672
|
-
`),n.map(e=>e.contributor)}async
|
|
694
|
+
`),n.map(e=>e.contributor)}async getUniqueContributorsForRepo(){return(await this.query(`
|
|
695
|
+
SELECT DISTINCT contributor
|
|
696
|
+
FROM (
|
|
697
|
+
SELECT author AS contributor
|
|
698
|
+
FROM commits_unioned
|
|
699
|
+
UNION
|
|
700
|
+
SELECT name AS contributor
|
|
701
|
+
FROM commitTrailers_unioned
|
|
702
|
+
WHERE trailerType = 'coauthor'
|
|
703
|
+
AND commitHash IN (SELECT hash FROM commits_unioned)
|
|
704
|
+
);
|
|
705
|
+
`)).map(e=>e.contributor)}async getContributionsForPath({objectPath:e,startSecs:t,endSecs:n}){return await this.usingPreparedStatement(`SELECT SUM(insertions + deletions) AS totalContributions
|
|
673
706
|
FROM fileChanges_commits_renamed_cached
|
|
674
707
|
WHERE (filePath = ? OR filePath LIKE ?)
|
|
675
708
|
AND committerTime BETWEEN ${t} AND ${n}`,async t=>{t.bindVarchar(1,e),t.bindVarchar(2,`${e}/%`);let n=(await t.runAndReadAll()).getRowObjectsJS();return Number(n[0]?.totalContributions??0)},`getContributionsForPath`)}async getContributorContributionsForPath(){let e=await this.query(`
|
|
@@ -742,7 +775,7 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
742
775
|
WHERE co.trailerType = 'coauthor'
|
|
743
776
|
);
|
|
744
777
|
`)).map(e=>({name:String(e.author??``),email:String(e.email??``)}))}async getNewestAndOldestChangeDates(){let e=await this.query(`SELECT MAX(max_time) AS newest, MIN(max_time) AS oldest FROM (SELECT filePath, MAX(committerTime) AS max_time FROM fileChanges_commits_renamed_cached GROUP BY filePath);
|
|
745
|
-
`);return{newestChangeDate:e[0].newest,oldestChangeDate:e[0].oldest}}async getCommitCount(){let e=await this.query(`SELECT count(distinct
|
|
778
|
+
`);return{newestChangeDate:e[0].newest,oldestChangeDate:e[0].oldest}}async getCommitCount(){let e=await this.query(`SELECT count(distinct hash) AS count FROM commits_unioned;
|
|
746
779
|
`);return Number(e[0].count)}async getMaxAndMinCommitCount(){let e=await this.query(`SELECT MAX(count) as max_commits, MIN(count) as min_commits FROM (SELECT filePath, count(distinct commitHash) AS count FROM fileChanges_commits_renamed_cached GROUP BY filePath ORDER BY count DESC);`);return{maxCommitCount:Number(e[0].max_commits),minCommitCount:Number(e[0].min_commits)}}async getMaxAndMinFileSize(){let e=await this.query(`SELECT MAX(f.byteSize) as max_size, MIN(f.byteSize) as min_size
|
|
747
780
|
FROM files f
|
|
748
781
|
INNER JOIN filtered_files fi ON fi.path = f.path
|
|
@@ -804,7 +837,42 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
804
837
|
FROM fileChanges_commits_renamed_cached
|
|
805
838
|
WHERE filePath = ? OR starts_with(filePath, ?) = true
|
|
806
839
|
) AS exists_in_range;`,async t=>(t.bindVarchar(1,e),t.bindVarchar(2,e+`/`),(await t.runAndReadAll()).getRowObjects()),`pathExistsInSelectedRange(tree)`):await this.query(`SELECT EXISTS(SELECT 1 FROM fileChanges_commits_renamed_cached) AS exists_in_range;
|
|
807
|
-
`);let r=n[0]?.exists_in_range;return r===!0||r===1||r===1n||r===`1`}
|
|
840
|
+
`);let r=n[0]?.exists_in_range;return r===!0||r===1||r===1n||r===`1`}async repoHasCommitsInSelectedRange(){let e=(await this.query(`
|
|
841
|
+
SELECT EXISTS(SELECT 1 FROM commits_unioned) AS exists_in_range;
|
|
842
|
+
`))[0]?.exists_in_range;return e===!0||e===1||e===1n||e===`1`}async getLastCommitTimeForRepo(){let e=await this.query(`
|
|
843
|
+
SELECT MAX(committerTime) AS lastChange
|
|
844
|
+
FROM commits_unioned;
|
|
845
|
+
`);return Number(e[0]?.lastChange??0)}getTimeStringFormat(e){let t=(e[1]-e[0])/(3600*24);return t<150?`day`:t<1e3?`week`:t<4e3?`month`:`year`}getTimeQueryFromTimeUnit(e){return{day:`%a %-d %B %Y`,week:`Week %V %Y`,month:`%B %Y`,year:`%Y`}[e]}mapCommitCountRowsToIntervals(e,t,n){let r=new Map;for(let{lookup:t,author:n,count:i}of e){r.has(t)||r.set(t,{count:0,contributors:{}});let e=r.get(t);e.count+=i,e.contributors[n]=(e.contributors[n]||0)+i}let i=[],a=rv(n,t[0],t[1]);for(let e of a){let t=r.get(e.lookup);i.push({date:e.label,count:t?.count??0,authoredCommitCount:t?.count??0,timestamp:e.timestamp,contributors:t?.contributors??{},contributorRoleCounts:Object.fromEntries(Object.entries(t?.contributors??{}).map(([e,t])=>[e,{authoredCommitCount:t,coauthoredCommitCount:0}]))})}return i.sort((e,t)=>e.timestamp-t.timestamp)}mapCommitRoleCountsToIntervals({intervals:e,rows:t,timerange:n,timeUnit:r}){let i=new Map(t.filter(e=>!e.author).map(e=>[e.lookup,{authoredCommitCount:e.authoredCommitCount,coauthoredCommitCount:e.coauthoredCommitCount}])),a=new Map(rv(r,n[0],n[1]).map(e=>[e.timestamp,e.lookup]));return e.map(e=>{let n=a.get(e.timestamp),r=n?t.filter(e=>e.lookup===n):[],o=n?i.get(n):void 0,s=Object.fromEntries(r.filter(e=>e.author).map(e=>[e.author,{authoredCommitCount:e.authoredCommitCount,coauthoredCommitCount:e.coauthoredCommitCount}]));return{...e,authoredCommitCount:o?.authoredCommitCount??e.authoredCommitCount,coauthoredCommitCount:o?.coauthoredCommitCount??0,contributorRoleCounts:Object.keys(s).length>0?s:e.contributorRoleCounts}})}async getCommitCountPerTime(e,t=this.getTimeStringFormat(e),n={}){let r=this.getTimeQueryFromTimeUnit(t??this.getTimeStringFormat(e)),i=(n.includeCoauthors?await this.query(`WITH authored_commits AS (
|
|
846
|
+
SELECT c.hash, c.committerTime, COALESCE(cg.displayName, c.author) AS author
|
|
847
|
+
FROM commits c
|
|
848
|
+
LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
849
|
+
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
850
|
+
WHERE c.committerTime BETWEEN ${e[0]} AND ${e[1]}
|
|
851
|
+
),
|
|
852
|
+
commit_people AS (
|
|
853
|
+
SELECT hash, committerTime, author
|
|
854
|
+
FROM authored_commits
|
|
855
|
+
UNION
|
|
856
|
+
SELECT c.hash, c.committerTime, co.name AS author
|
|
857
|
+
FROM authored_commits c
|
|
858
|
+
JOIN commitTrailers_unioned co ON c.hash = co.commitHash
|
|
859
|
+
WHERE co.trailerType = 'coauthor'
|
|
860
|
+
),
|
|
861
|
+
commit_shares AS (
|
|
862
|
+
SELECT date_trunc('${t}', to_timestamp(committerTime)) AS date,
|
|
863
|
+
author,
|
|
864
|
+
1.0 / COUNT(*) OVER (PARTITION BY hash) AS commitShare,
|
|
865
|
+
committerTime
|
|
866
|
+
FROM commit_people
|
|
867
|
+
)
|
|
868
|
+
SELECT strftime(date, '${r}') as timestring,
|
|
869
|
+
strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
870
|
+
author,
|
|
871
|
+
SUM(commitShare) AS count,
|
|
872
|
+
MIN(committerTime) AS ct
|
|
873
|
+
FROM commit_shares
|
|
874
|
+
GROUP BY date, author
|
|
875
|
+
ORDER BY date ASC;`):await this.query(`SELECT strftime(date, '${r}') as timestring,
|
|
808
876
|
strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
809
877
|
author,
|
|
810
878
|
count(*) AS count,
|
|
@@ -813,16 +881,143 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
813
881
|
COALESCE(cg.displayName, c.author) AS author,
|
|
814
882
|
c.committerTime FROM commits c
|
|
815
883
|
LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
816
|
-
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
884
|
+
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
885
|
+
WHERE c.committerTime BETWEEN ${e[0]} AND ${e[1]})
|
|
817
886
|
GROUP BY date, author
|
|
818
|
-
ORDER BY date ASC;`)).map(e=>({lookup:e.bucket_lookup,author:e.author,count:Number(e.count)})),
|
|
819
|
-
|
|
887
|
+
ORDER BY date ASC;`)).map(e=>({lookup:e.bucket_lookup,author:e.author,count:Number(e.count)})),a=this.mapCommitCountRowsToIntervals(i,e,t);if(!n.includeCoauthors)return[a,t];let o=(await this.query(`
|
|
888
|
+
SELECT strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
889
|
+
COUNT(DISTINCT hash) AS authoredCommitCount,
|
|
890
|
+
COUNT(DISTINCT coauthoredCommitHash) AS coauthoredCommitCount
|
|
891
|
+
FROM (
|
|
892
|
+
SELECT date_trunc('${t}', to_timestamp(c.committerTime)) AS date,
|
|
893
|
+
c.hash,
|
|
894
|
+
co.commitHash AS coauthoredCommitHash
|
|
895
|
+
FROM commits c
|
|
896
|
+
LEFT JOIN commitTrailers_unioned co ON c.hash = co.commitHash AND co.trailerType = 'coauthor'
|
|
897
|
+
WHERE c.committerTime BETWEEN ${e[0]} AND ${e[1]}
|
|
898
|
+
)
|
|
899
|
+
GROUP BY date
|
|
900
|
+
ORDER BY date ASC;`)).map(e=>({lookup:e.bucket_lookup,authoredCommitCount:Number(e.authoredCommitCount),coauthoredCommitCount:Number(e.coauthoredCommitCount)})),s=(await this.query(`
|
|
901
|
+
WITH authored_commits AS (
|
|
902
|
+
SELECT c.hash, c.committerTime, COALESCE(cg.displayName, c.author) AS author
|
|
903
|
+
FROM commits c
|
|
904
|
+
LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
905
|
+
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
906
|
+
WHERE c.committerTime BETWEEN ${e[0]} AND ${e[1]}
|
|
907
|
+
),
|
|
908
|
+
contributor_roles AS (
|
|
909
|
+
SELECT date_trunc('${t}', to_timestamp(committerTime)) AS date,
|
|
910
|
+
author,
|
|
911
|
+
COUNT(DISTINCT hash) AS authoredCommitCount,
|
|
912
|
+
0 AS coauthoredCommitCount
|
|
913
|
+
FROM authored_commits
|
|
914
|
+
GROUP BY date, author
|
|
915
|
+
UNION ALL
|
|
916
|
+
SELECT date_trunc('${t}', to_timestamp(c.committerTime)) AS date,
|
|
917
|
+
co.name AS author,
|
|
918
|
+
0 AS authoredCommitCount,
|
|
919
|
+
COUNT(DISTINCT c.hash) AS coauthoredCommitCount
|
|
920
|
+
FROM authored_commits c
|
|
921
|
+
JOIN commitTrailers_unioned co ON c.hash = co.commitHash
|
|
922
|
+
WHERE co.trailerType = 'coauthor' AND co.name <> c.author
|
|
923
|
+
GROUP BY date, co.name
|
|
924
|
+
)
|
|
925
|
+
SELECT strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
820
926
|
author,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
927
|
+
SUM(authoredCommitCount) AS authoredCommitCount,
|
|
928
|
+
SUM(coauthoredCommitCount) AS coauthoredCommitCount
|
|
929
|
+
FROM contributor_roles
|
|
930
|
+
GROUP BY date, author
|
|
931
|
+
ORDER BY date ASC;`)).map(e=>({lookup:e.bucket_lookup,author:e.author,authoredCommitCount:Number(e.authoredCommitCount),coauthoredCommitCount:Number(e.coauthoredCommitCount)}));return[this.mapCommitRoleCountsToIntervals({intervals:a,rows:[...o,...s],timerange:e,timeUnit:t}),t]}async getCommitCountPerTimeForClickedObject({timerange:e,timeUnit:t=this.getTimeStringFormat(e),objectPath:n,includeCoauthors:r=!1}){let i=this.getTimeQueryFromTimeUnit(t),a=r?`WITH object_commits AS (
|
|
932
|
+
SELECT DISTINCT commitHash, committerTime, author
|
|
933
|
+
FROM (
|
|
934
|
+
SELECT c.hash AS commitHash,
|
|
935
|
+
c.committerTime,
|
|
936
|
+
COALESCE(cg.displayName, c.author) AS author,
|
|
937
|
+
COALESCE(r.toName, f.filePath) AS resolvedPath
|
|
938
|
+
FROM commits c
|
|
939
|
+
JOIN fileChanges f ON c.hash = f.commitHash
|
|
940
|
+
LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
941
|
+
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
942
|
+
LEFT JOIN temporaryRenames r ON f.filePath = r.fromName AND (
|
|
943
|
+
c.committerTime BETWEEN r.timestamp AND r.timestampEnd
|
|
944
|
+
)
|
|
945
|
+
)
|
|
946
|
+
WHERE resolvedPath = ? OR resolvedPath LIKE ?
|
|
947
|
+
),
|
|
948
|
+
commit_people AS (
|
|
949
|
+
SELECT commitHash, committerTime, author
|
|
950
|
+
FROM object_commits
|
|
951
|
+
UNION
|
|
952
|
+
SELECT oc.commitHash, oc.committerTime, co.name AS author
|
|
953
|
+
FROM object_commits oc
|
|
954
|
+
JOIN commitTrailers_unioned co ON oc.commitHash = co.commitHash
|
|
955
|
+
WHERE co.trailerType = 'coauthor'
|
|
956
|
+
),
|
|
957
|
+
commit_shares AS (
|
|
958
|
+
SELECT date_trunc(?, to_timestamp(committerTime)) AS date,
|
|
959
|
+
author,
|
|
960
|
+
1.0 / COUNT(*) OVER (PARTITION BY commitHash) AS commitShare,
|
|
961
|
+
committerTime
|
|
962
|
+
FROM commit_people
|
|
963
|
+
)
|
|
964
|
+
SELECT strftime(date, ?) as timestring,
|
|
965
|
+
strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
966
|
+
author,
|
|
967
|
+
SUM(commitShare) AS count,
|
|
968
|
+
MIN(committerTime) AS ct
|
|
969
|
+
FROM commit_shares
|
|
970
|
+
GROUP BY date, author
|
|
971
|
+
ORDER BY date ASC;`:`SELECT strftime(date, ?) as timestring,
|
|
972
|
+
strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
973
|
+
author,
|
|
974
|
+
count(DISTINCT commitHash) AS count,
|
|
975
|
+
MIN(committerTime) AS ct FROM (
|
|
976
|
+
SELECT date_trunc(?, to_timestamp(c.committerTime)) AS date,
|
|
977
|
+
c.committerTime, c.hash as commitHash, COALESCE(cg.displayName, c.author) AS author,
|
|
978
|
+
COALESCE(r.toName, f.filePath) as resolvedPath
|
|
979
|
+
FROM commits c
|
|
980
|
+
JOIN fileChanges f ON c.hash = f.commitHash
|
|
981
|
+
LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
982
|
+
ON (c.author = cg.name AND c.authorEmail = cg.email)
|
|
983
|
+
LEFT JOIN temporaryRenames r ON f.filePath = r.fromName AND (
|
|
984
|
+
c.committerTime BETWEEN r.timestamp AND r.timestampEnd
|
|
985
|
+
)
|
|
986
|
+
)
|
|
987
|
+
WHERE resolvedPath = ? OR resolvedPath LIKE ?
|
|
988
|
+
GROUP BY date, author
|
|
989
|
+
ORDER BY date ASC;`,o=(await this.usingPreparedStatement(a,async e=>(r?(e.bindVarchar(1,n),e.bindVarchar(2,`${n}/%`),e.bindVarchar(3,t),e.bindVarchar(4,i)):(e.bindVarchar(1,i),e.bindVarchar(2,t),e.bindVarchar(3,n),e.bindVarchar(4,`${n}/%`)),(await e.runAndReadAll()).getRowObjects()),`getCommitCountPerTimeForClickedObject`)).map(e=>({lookup:e.bucket_lookup,author:e.author,count:Number(e.count)})),s=this.mapCommitCountRowsToIntervals(o,e,t);if(!r)return s;let c=(await this.usingPreparedStatement(`WITH object_commits AS (
|
|
990
|
+
SELECT DISTINCT commitHash, committerTime
|
|
991
|
+
FROM (
|
|
992
|
+
SELECT c.hash AS commitHash,
|
|
993
|
+
c.committerTime,
|
|
994
|
+
COALESCE(r.toName, f.filePath) AS resolvedPath
|
|
995
|
+
FROM commits c
|
|
996
|
+
JOIN fileChanges f ON c.hash = f.commitHash
|
|
997
|
+
LEFT JOIN temporaryRenames r ON f.filePath = r.fromName AND (
|
|
998
|
+
c.committerTime BETWEEN r.timestamp AND r.timestampEnd
|
|
999
|
+
)
|
|
1000
|
+
)
|
|
1001
|
+
WHERE resolvedPath = ? OR resolvedPath LIKE ?
|
|
1002
|
+
)
|
|
1003
|
+
SELECT strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
1004
|
+
COUNT(DISTINCT commitHash) AS authoredCommitCount,
|
|
1005
|
+
COUNT(DISTINCT coauthoredCommitHash) AS coauthoredCommitCount
|
|
1006
|
+
FROM (
|
|
1007
|
+
SELECT date_trunc(?, to_timestamp(oc.committerTime)) AS date,
|
|
1008
|
+
oc.commitHash,
|
|
1009
|
+
co.commitHash AS coauthoredCommitHash
|
|
1010
|
+
FROM object_commits oc
|
|
1011
|
+
LEFT JOIN commitTrailers_unioned co ON oc.commitHash = co.commitHash AND co.trailerType = 'coauthor'
|
|
1012
|
+
)
|
|
1013
|
+
GROUP BY date
|
|
1014
|
+
ORDER BY date ASC;`,async e=>(e.bindVarchar(1,n),e.bindVarchar(2,`${n}/%`),e.bindVarchar(3,t),(await e.runAndReadAll()).getRowObjects()),`getCommitCountPerTimeForClickedObjectRoleCounts`)).map(e=>({lookup:e.bucket_lookup,authoredCommitCount:Number(e.authoredCommitCount),coauthoredCommitCount:Number(e.coauthoredCommitCount)})),l=(await this.usingPreparedStatement(`WITH object_commits AS (
|
|
1015
|
+
SELECT DISTINCT commitHash, committerTime, author
|
|
1016
|
+
FROM (
|
|
1017
|
+
SELECT c.hash AS commitHash,
|
|
1018
|
+
c.committerTime,
|
|
1019
|
+
COALESCE(cg.displayName, c.author) AS author,
|
|
1020
|
+
COALESCE(r.toName, f.filePath) AS resolvedPath
|
|
826
1021
|
FROM commits c
|
|
827
1022
|
JOIN fileChanges f ON c.hash = f.commitHash
|
|
828
1023
|
LEFT JOIN (SELECT displayName, email, name FROM contributorGroups) cg
|
|
@@ -832,11 +1027,34 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
832
1027
|
)
|
|
833
1028
|
)
|
|
834
1029
|
WHERE resolvedPath = ? OR resolvedPath LIKE ?
|
|
835
|
-
|
|
836
|
-
|
|
1030
|
+
),
|
|
1031
|
+
contributor_roles AS (
|
|
1032
|
+
SELECT date_trunc(?, to_timestamp(committerTime)) AS date,
|
|
1033
|
+
author,
|
|
1034
|
+
COUNT(DISTINCT commitHash) AS authoredCommitCount,
|
|
1035
|
+
0 AS coauthoredCommitCount
|
|
1036
|
+
FROM object_commits
|
|
1037
|
+
GROUP BY date, author
|
|
1038
|
+
UNION ALL
|
|
1039
|
+
SELECT date_trunc(?, to_timestamp(oc.committerTime)) AS date,
|
|
1040
|
+
co.name AS author,
|
|
1041
|
+
0 AS authoredCommitCount,
|
|
1042
|
+
COUNT(DISTINCT oc.commitHash) AS coauthoredCommitCount
|
|
1043
|
+
FROM object_commits oc
|
|
1044
|
+
JOIN commitTrailers_unioned co ON oc.commitHash = co.commitHash
|
|
1045
|
+
WHERE co.trailerType = 'coauthor' AND co.name <> oc.author
|
|
1046
|
+
GROUP BY date, co.name
|
|
1047
|
+
)
|
|
1048
|
+
SELECT strftime(date, '%Y-%m-%d') AS bucket_lookup,
|
|
1049
|
+
author,
|
|
1050
|
+
SUM(authoredCommitCount) AS authoredCommitCount,
|
|
1051
|
+
SUM(coauthoredCommitCount) AS coauthoredCommitCount
|
|
1052
|
+
FROM contributor_roles
|
|
1053
|
+
GROUP BY date, author
|
|
1054
|
+
ORDER BY date ASC;`,async e=>(e.bindVarchar(1,n),e.bindVarchar(2,`${n}/%`),e.bindVarchar(3,t),e.bindVarchar(4,t),(await e.runAndReadAll()).getRowObjects()),`getCommitCountPerTimeForClickedObjectContributorRoleCounts`)).map(e=>({lookup:e.bucket_lookup,author:e.author,authoredCommitCount:Number(e.authoredCommitCount),coauthoredCommitCount:Number(e.coauthoredCommitCount)}));return this.mapCommitRoleCountsToIntervals({intervals:s,rows:[...c,...l],timerange:e,timeUnit:t})}async updateColorSeed(e){await this.run(`DELETE FROM metadata
|
|
837
1055
|
WHERE field = 'colorSeed';
|
|
838
1056
|
INSERT INTO metadata (field, intValue, stringValue)
|
|
839
|
-
VALUES ('colorSeed', null, '${e}');`),I.debug(`inserted seed`,e)}async getGitTruckVersion(){let e=await this.query(`SELECT stringValue from metadata WHERE field = 'version';`);return e.length===0?null:e[0].stringValue}async getColorSeed(){let e=await this.query(`SELECT stringValue FROM metadata WHERE field = 'colorSeed';`);return e.length<1?null:(I.debug(`retrieved seed`,e[0].stringValue),e[0].stringValue)}async getLastRunInfo(){let e=await this.query(`SELECT intValue as time, stringValue as hash FROM metadata WHERE field = 'finished' ORDER BY intValue DESC LIMIT 1;`);return e[0]?{time:Number(e[0].time),hash:e[0].hash}:{time:0,hash:``}}async addCommits(e){await this.usingTableAppender(`commits`,async t=>{for(let[n,r]of e){if(!r)throw Error(`Commit with hash ${n} is undefined`);t.appendVarchar(n),t.appendVarchar(r.author.name),t.appendVarchar(r.author.email),t.appendUInteger(r.committerTime),t.appendUInteger(r.authorTime),t.endRow()}}),await this.usingTableAppender(`commitTrailers`,async t=>{for(let[n,r]of e){if(!r)throw Error(`Commit with hash ${n} is undefined`);for(let e of r.coauthors)t.appendVarchar(n),t.appendVarchar(e.name),t.appendVarchar(e.email),t.appendVarchar(`coauthor`),t.endRow()}}),await this.usingTableAppender(`fileChanges`,async t=>{for(let[n,r]of e){if(!r)throw Error(`Commit with hash ${n} is undefined`);for(let e of r.fileChanges)t.appendVarchar(r.hash),t.appendUInteger(e.insertions),t.appendUInteger(e.deletions),t.appendVarchar(e.path),t.endRow()}})}};function cv(e){let t=e.matchAll(/Co-authored-by: (?<name>.*) <(?<email>.*)>/gim),n=t.next().value,r=[];for(;n!==void 0;)r.push({name:n.groups.name.trimEnd(),email:n.groups.email}),n=t.next().value;return r}var lv=class e{useCache=!0;catFileCache=new Map;repositoryPath;branch;constructor({repositoryPath:e,branch:t}){this.repositoryPath=e,this.branch=t}static hasGitDirectory(e){return f(u(e,`.git`))}static async isValidGitRepo(t){let n=this.hasGitDirectory(t);if(!n)return!1;let[,r]=await $(e.getCommitHashOfBranchHead({repositoryPath:t}));return n&&!r}static async isValidRevision({revision:t,repositoryPath:n}){let r=l(n,`.git`),[,i]=await $(e._revParse(r,t));return!i}static async getCommitHashOfBranchHead({repositoryPath:t,branch:n}){if(!n){let[r,i]=await $(e._getRepositoryHead(t));if(i)throw i;n=r}let r=l(t,`.git`);if(!f(r))throw Error(`No git folder exists at `+r);let i=await e._revParse(r,n);return I.debug(`${n} -> [commit] ${i}`),i}static getCachePath(e,t){return u(y.tmpdir(),`git-truck`,e,`${t}.json`)}async getRepositoryHead(){return await e._getRepositoryHead(this.repositoryPath)}async gitLogSpecificCommits(e){let t=[`log`,`--no-walk`,`--numstat`,`--format="author <|%aN|> email <|%aE|> date <|%ct %at|> message <|%s|> body <|%b|> hash <|%H|>"`,...e];return(await Xv(this.repositoryPath,`git`,t)).trim()}static async _getRepositoryHead(e){let[t,n]=await $(p.readFile(l(e,`.git`,`HEAD`),`utf-8`));if(n)throw n;return t.trim().trim().replace(`ref: refs/heads/`,``)}async lsTree(t){return await e._lsTree(this.repositoryPath,t)}static async _lsTree(e,t){return(await Xv(e,`git`,[`ls-tree`,`-rlt`,t])).trim()}async revParse(t){return await e._revParse(this.repositoryPath,t)}static async _revParse(e,t){return(await Xv(e,`git`,[`rev-list`,`-n`,`1`,t])).trim()}static async getRepoMetadata(t){let n=iy(t),r=ry(t),i=await e.getLastChanged(t);if(!i)return{status:`Error`,errorMessage:`Not a valid git repository`,repositoryName:n,repositoryPath:t,parentDirPath:r,parentDirName:iy(r),lastChanged:0};let a=e.parseRefs(await e._getRefs(t)),[o,s]=await $(e.getCommitHashOfBranchHead({repositoryPath:t}));return s?{status:`Error`,errorMessage:s.message,repositoryName:n,repositoryPath:t,parentDirPath:r,parentDirName:iy(r),lastChanged:i}:{status:`Success`,isAnalyzed:!1,repositoryName:n,repositoryPath:t,parentDirPath:r,parentDirName:iy(r),currentHead:o,refs:a,lastChanged:i}}static async getLastChanged(t){let n=await e.readFileSafe(l(t,`.git`,`HEAD`));if(!n)return null;let r=n.trim();if(r.startsWith(`ref:`)){let n=l(t,`.git`,r.slice(5).trim()),i=await e.readFileSafe(n);if(i){let n=e.readCommitTimestamp(t,i.trim());if(n!==null)return n}}else{let n=e.readCommitTimestamp(t,r);if(n!==null)return n}let[i]=await $(Xv(t,`git`,[`log`,`-1`,`--pretty=%at`]));if(!i)return null;let a=parseInt(i.trim());return isNaN(a)?null:a}static async readFileSafe(e){let[t]=await $(k(e,`utf-8`));return t}static readCommitTimestamp(e,t){try{let n=l(e,`.git`,`objects`,t.slice(0,2),t.slice(2));if(!f(n))return null;let r=a(m(n)).toString(`utf-8`).match(/^author .*? (\d+) [+-]\d{4}$/m);return r?Number(r[1]):null}catch{return null}}static parseRefs(e){let t={Branches:{},Tags:{}},n=e.matchAll(/^(?<hash>.*) refs\/(?<ref_type>.*?)\/(?<path>.*)$/gm),r=n.next();for(;r.value;){let e=r.value.groups;if(!e)break;r=n.next();let i=e.hash,a=e.ref_type,o=e.path;switch(a){case`heads`:t.Branches[o]=i;break;case`remotes`:break;case`tags`:t.Tags[o]=i;break;default:break}}return t.Branches=Object.fromEntries(Object.entries(t.Branches).sort(([e],[t])=>ev(e,t))),t.Tags=Object.fromEntries(Object.entries(t.Tags).sort(([e],[t])=>tv(e,t)*-1)),t}async gitLog(e,t){let n=[`log`,`--skip=${e}`,`--max-count=${t}`,this.branch,`--summary`,`--numstat`,`--format="author <|%aN|> email <|%aE|> date <|%ct %at|> message <|%s|> body <|%b|> hash <|%H|>"`];return(await Xv(this.repositoryPath,`git`,n)).trim()}async gitLogSimple(e,t,n,r){let i=[`log`,`--skip=${e}`,`--max-count=${t}`,this.branch,`--summary`,`--numstat`,`--format="<|%aN|><|%aE|><|%ct %at|><|%(trailers)|><|%H|>"`];return(await Xv(this.repositoryPath,`git`,i,n,r)).trim()}setUseCache(e){this.useCache=e}async commitCountSinceCommit(e,t){let n=Number(await Xv(this.repositoryPath,`git`,[`rev-list`,`--count`,`${e}..${t}`]));return isNaN(n)?0:n}async getRefs(){return await e._getRefs(this.repositoryPath)}static async _getRefs(e){return await Xv(e,`git`,[`show-ref`])}async catFile(e){return await Xv(this.repositoryPath,`git`,[`cat-file`,`-p`,e])}async catFileCached(e){if(this.useCache){let t=this.catFileCache.get(e);if(t)return t}let t=await this.catFile(e);return this.catFileCache.set(e,t),t}async getCommitCount(){let e=await Xv(this.repositoryPath,`git`,[`rev-list`,`--count`,this.branch]);return Number(e)}async getDefaultGitSettingValue(e){return await Xv(this.repositoryPath,`git`,[`config`,e])}async resetGitSetting(e,t){t?(await Xv(this.repositoryPath,`git`,[`config`,e,t]),I.debug(`Reset ${e} to ${t}`)):(await Xv(this.repositoryPath,`git`,[`config`,`--unset`,e]),I.debug(`Unset ${e}`))}async setGitSetting(e,t){await Xv(this.repositoryPath,`git`,[`config`,e,t]),I.debug(`Set ${e} to ${t}`)}};const uv=/"author\s+<\|(?<author>.*?)\|>\s+email\s+<\|(?<authorEmail>.*?)\|>\s+date\s+<\|(?<dateCommitter>\d+)\s(?<dateAuthor>\d+)\|>\s+message\s+<\|(?<message>[\s\S]*?)\|>\s+body\s+<\|(?<body>[\s\S]*?)\|>\s+hash\s+<\|(?<hash>.+?)\|>"\s*(?<contributions>(?:(?:\d+|-)\s+(?:\d+|-)\s+.+\s?)*)(?<modes>(?:\s.+\s*)*)/gmu,dv=/"<\|(?<author>.*?)\|><\|(?<authorEmail>.*?)\|><\|(?<dateCommitter>\d+)\s(?<dateAuthor>\d+)\|>\s*<\|(?<trailers>[\s\S]*?)\|><\|(?<hash>.+?)\|>"\s*(?<contributions>(?:(?:\d+|-)\s+(?:\d+|-)\s+.+\s?)*)(?<modes>(?:\s.+\s*)*)/gmu,fv=/(?<insertions>\d+|-)\s+(?<deletions>\d+|-)\s+(?<file>.+)/gm,pv=/^\S+? (?<type>\S+) (?<hash>\S+)\s+(?<size>\S+)\s+(?<path>.+)/gm,mv=/\s(?<mode>\w+)\s\w+\s\d+\s(?<file>.+)/gmu,hv=Error(`request for lock canceled`);var gv=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},_v=class{constructor(e,t=hv){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{let i={resolve:n,reject:r,weight:e,priority:t},a=yv(this._queue,e=>t<=e.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return gv(this,arguments,void 0,function*(e,t=1,n=0){let[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}})}waitForUnlock(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),vv(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(e=>e.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let n=this._weightedWaiters[t-1];if(!n)continue;let r=n.findIndex(t=>t.priority<=e);(r===-1?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function vv(e,t){let n=yv(e,e=>t.priority<=e.priority);e.splice(n+1,0,t)}function yv(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var bv=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},xv=class{constructor(e){this._semaphore=new _v(1,e)}acquire(){return bv(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}},Sv=class{mutex;constructor(){this.mutex=new xv}isLocked(){return this.mutex.isLocked()}async withDisposable(e){let t=await this.mutex.acquire();try{await e?.()}catch(e){throw t(),e}return{[Symbol.dispose]:()=>{t()}}}};function Cv(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var wv=class e{static separator=`---`;static metadataDB;static mutex=new Sv;static getPath(){return i(t.tmpdir(),`git-truck-cache`,`metadata.json`)}static getInstance(){return this.metadataDB||=new e,this.metadataDB}static async resetInstance(){try{var t=Cv();t.u(await e.mutex.withDisposable()),await g.rm(this.getPath(),{recursive:!0,force:!0}),e.metadataDB=new e}catch(e){t.e=e}finally{t.d()}}async readMetadata(){try{var t=Cv();return t.u(await e.mutex.withDisposable()),await this.readMetadataUnlocked()}catch(e){t.e=e}finally{t.d()}}async readMetadataUnlocked(){try{return JSON.parse(await g.readFile(e.getPath(),`utf8`))}catch{return{completions:{},authorcolors:{}}}}async setMetadataUnlocked(t){let n=JSON.stringify(t);await g.mkdir(r(e.getPath()),{recursive:!0}),await g.writeFile(e.getPath(),n,`utf8`)}async setCompletion({repositoryPath:t,branch:n},r){try{var i=Cv();i.u(await e.mutex.withDisposable()),await this.setCompletionUnlocked({repositoryPath:t,branch:n},r)}catch(e){i.e=e}finally{i.d()}}async setCompletionUnlocked({repositoryPath:t,branch:n},r){let i=await this.readMetadataUnlocked();i.completions[e.getCompletionKey({repositoryPath:t,branch:n})]={hash:r,time:Math.floor(Date.now()/1e3)},await this.setMetadataUnlocked(i)}async addContributorColor(t,n){try{var r=Cv();r.u(await e.mutex.withDisposable()),await this.addContributorColorUnlocked(t,n)}catch(e){r.e=e}finally{r.d()}}async addContributorColorUnlocked(e,t){let n=await this.readMetadataUnlocked();t===``?delete n.authorcolors[e]:n.authorcolors[e]=t,await this.setMetadataUnlocked(n)}async getContributorColors(){return(await this.readMetadata()).authorcolors}async getLastRun({repositoryPath:t,branch:n}){return(await this.readMetadata()).completions[e.getCompletionKey({repositoryPath:t,branch:n})]}async getCompletedRepos(){let t=[],n=await this.readMetadata();for(let[r,i]of Object.entries(n.completions)){let[n,a]=r.split(e.separator);t.push({repositoryPath:n,branch:a,time:i.time,hash:i.hash})}return t}static getCompletionKey({repositoryPath:t,branch:n}){return`${t}${e.separator}${n}`}},Tv=N(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},_=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],v=/(^|\\\/)?\\\*$/,y=`regex`,b=`checkRegex`,x={[y](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[b](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},S=e=>_.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),C=e=>typeof e==`string`,w=e=>e&&C(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(s).filter(Boolean);var E=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_`+y;return this[e]?this[e]:this._make(y,e)}get checkRegex(){let e=`_`+b;return this[e]?this[e]:this._make(b,e)}_make(e,t){let n=this.regexPrefix.replace(v,x[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let ee=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=S(i);return new E(e,t,i,n,r,s)};var D=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(C(e)&&(e={pattern:e}),w(e.pattern)){let t=ee(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),te=e=>c.test(e);k.isNotRelative=te,k.convert=e=>e;var A=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new D(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._strictPathCheck?O:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,b)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,y);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,y)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ne=e=>new A(e),re=e=>k(e&&k.convert(e),e,m),j=()=>{k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||te(t)};typeof process<`u`&&process.platform===`win32`&&j(),t.exports=ne,ne.default=ne,t.exports.isPathValid=re,f(t.exports,Symbol.for(`setupWindows`),j)})),Ev=N((e=>{
|
|
1057
|
+
VALUES ('colorSeed', null, '${e}');`),I.debug(`inserted seed`,e)}async getGitTruckVersion(){let e=await this.query(`SELECT stringValue from metadata WHERE field = 'version';`);return e.length===0?null:e[0].stringValue}async getColorSeed(){let e=await this.query(`SELECT stringValue FROM metadata WHERE field = 'colorSeed';`);return e.length<1?null:(I.debug(`retrieved seed`,e[0].stringValue),e[0].stringValue)}async getLastRunInfo(){let e=await this.query(`SELECT intValue as time, stringValue as hash FROM metadata WHERE field = 'finished' ORDER BY intValue DESC LIMIT 1;`);return e[0]?{time:Number(e[0].time),hash:e[0].hash}:{time:0,hash:``}}async addCommits(e){await this.usingTableAppender(`commits`,async t=>{for(let[n,r]of e)t.appendVarchar(n),t.appendVarchar(r.author.name),t.appendVarchar(r.author.email),t.appendUInteger(r.committerTime),t.appendUInteger(r.authorTime),t.appendVarchar(r.parentHash),r.secondaryParentHash===null?t.appendNull():t.appendVarchar(r.secondaryParentHash),t.endRow()}),await this.usingTableAppender(`commitTrailers`,async t=>{for(let[n,r]of e)for(let e of r.coauthors)t.appendVarchar(n),t.appendVarchar(e.name),t.appendVarchar(e.email),t.appendVarchar(`coauthor`),t.endRow()}),await this.usingTableAppender(`fileChanges`,async t=>{for(let[n,r]of e)for(let e of r.fileChanges)t.appendVarchar(n),t.appendUInteger(e.insertions),t.appendUInteger(e.deletions),t.appendVarchar(e.path),t.endRow()})}};function cv(e){let t=e.matchAll(/Co-authored-by: (?<name>.*) <(?<email>.*)>/gim),n=t.next().value,r=[];for(;n!==void 0;)r.push({name:n.groups.name.trimEnd(),email:n.groups.email}),n=t.next().value;return r}var lv=class e{useCache=!0;catFileCache=new Map;repositoryPath;branch;constructor({repositoryPath:e,branch:t}){this.repositoryPath=e,this.branch=t}static hasGitDirectory(e){return f(u(e,`.git`))}static async isValidGitRepo(t){let n=this.hasGitDirectory(t);if(!n)return!1;let[,r]=await $(e.getCommitHashOfBranchHead({repositoryPath:t}));return n&&!r}static async isValidRevision({revision:t,repositoryPath:n}){let r=l(n,`.git`),[,i]=await $(e._revParse(r,t));return!i}static async getCommitHashOfBranchHead({repositoryPath:t,branch:n}){if(!n){let[r,i]=await $(e._getRepositoryHead(t));if(i)throw i;n=r}let r=l(t,`.git`);if(!f(r))throw Error(`No git folder exists at `+r);let i=await e._revParse(r,n);return I.debug(`${n} -> [commit] ${i}`),i}static getCachePath(e,t){return u(y.tmpdir(),`git-truck`,e,`${t}.json`)}async getRepositoryHead(){return await e._getRepositoryHead(this.repositoryPath)}async gitLogSpecificCommits(e){let t=[`log`,`--no-walk`,`--numstat`,`--format="parents <|%P|> author <|%aN|> email <|%aE|> date <|%ct %at|> message <|%s|> body <|%b|> hash <|%H|>"`,...e];return(await Zv(this.repositoryPath,`git`,t)).trim()}static async _getRepositoryHead(e){let[t,n]=await $(p.readFile(l(e,`.git`,`HEAD`),`utf-8`));if(n)throw n;return t.trim().trim().replace(`ref: refs/heads/`,``)}async lsTree(t){return await e._lsTree(this.repositoryPath,t)}static async _lsTree(e,t){return(await Zv(e,`git`,[`ls-tree`,`-rlt`,t])).trim()}async revParse(t){return await e._revParse(this.repositoryPath,t)}static async _revParse(e,t){return(await Zv(e,`git`,[`rev-list`,`-n`,`1`,t])).trim()}static async getRepoMetadata(t){let n=ay(t),r=iy(t),i=await e.getLastChanged(t);if(!i)return{status:`Error`,errorMessage:`Not a valid git repository`,repositoryName:n,repositoryPath:t,parentDirPath:r,parentDirName:ay(r),lastChanged:0};let a=e.parseRefs(await e._getRefs(t)),[o,s]=await $(e.getCommitHashOfBranchHead({repositoryPath:t}));return s?{status:`Error`,errorMessage:s.message,repositoryName:n,repositoryPath:t,parentDirPath:r,parentDirName:ay(r),lastChanged:i}:{status:`Success`,isAnalyzed:!1,repositoryName:n,repositoryPath:t,parentDirPath:r,parentDirName:ay(r),currentHead:o,refs:a,lastChanged:i}}static async getLastChanged(t){let n=await e.readFileSafe(l(t,`.git`,`HEAD`));if(!n)return null;let r=n.trim();if(r.startsWith(`ref:`)){let n=l(t,`.git`,r.slice(5).trim()),i=await e.readFileSafe(n);if(i){let n=e.readCommitTimestamp(t,i.trim());if(n!==null)return n}}else{let n=e.readCommitTimestamp(t,r);if(n!==null)return n}let[i]=await $(Zv(t,`git`,[`log`,`-1`,`--pretty=%at`]));if(!i)return null;let a=parseInt(i.trim());return isNaN(a)?null:a}static async readFileSafe(e){let[t]=await $(k(e,`utf-8`));return t}static readCommitTimestamp(e,t){try{let n=l(e,`.git`,`objects`,t.slice(0,2),t.slice(2));if(!f(n))return null;let r=a(m(n)).toString(`utf-8`).match(/^author .*? (\d+) [+-]\d{4}$/m);return r?Number(r[1]):null}catch{return null}}static parseRefs(e){let t={Branches:{},Tags:{}},n=e.matchAll(/^(?<hash>.*) refs\/(?<ref_type>.*?)\/(?<path>.*)$/gm),r=n.next();for(;r.value;){let e=r.value.groups;if(!e)break;r=n.next();let i=e.hash,a=e.ref_type,o=e.path;switch(a){case`heads`:t.Branches[o]=i;break;case`remotes`:break;case`tags`:t.Tags[o]=i;break;default:break}}return t.Branches=Object.fromEntries(Object.entries(t.Branches).sort(([e],[t])=>ev(e,t))),t.Tags=Object.fromEntries(Object.entries(t.Tags).sort(([e],[t])=>tv(e,t)*-1)),t}async gitLog(e,t){let n=[`log`,`--skip=${e}`,`--max-count=${t}`,this.branch,`--summary`,`--numstat`,`--format="parents <|%P|> author <|%aN|> email <|%aE|> date <|%ct %at|> message <|%s|> body <|%b|> hash <|%H|>"`];return(await Zv(this.repositoryPath,`git`,n)).trim()}async gitLogSimple(e,t,n,r){let i=[`log`,`--skip=${e}`,`--max-count=${t}`,this.branch,`--summary`,`--numstat`,`--format="<|%P|><|%aN|><|%aE|><|%ct %at|><|%(trailers)|><|%H|>"`];return(await Zv(this.repositoryPath,`git`,i,n,r)).trim()}setUseCache(e){this.useCache=e}async commitCountSinceCommit(e,t){let n=Number(await Zv(this.repositoryPath,`git`,[`rev-list`,`--count`,`${e}..${t}`]));return isNaN(n)?0:n}async getRefs(){return await e._getRefs(this.repositoryPath)}static async _getRefs(e){return await Zv(e,`git`,[`show-ref`])}async catFile(e){return await Zv(this.repositoryPath,`git`,[`cat-file`,`-p`,e])}async catFileCached(e){if(this.useCache){let t=this.catFileCache.get(e);if(t)return t}let t=await this.catFile(e);return this.catFileCache.set(e,t),t}async getCommitCount(){let e=await Zv(this.repositoryPath,`git`,[`rev-list`,`--count`,this.branch]);return Number(e)}async getDefaultGitSettingValue(e){return await Zv(this.repositoryPath,`git`,[`config`,e])}async resetGitSetting(e,t){t?(await Zv(this.repositoryPath,`git`,[`config`,e,t]),I.debug(`Reset ${e} to ${t}`)):(await Zv(this.repositoryPath,`git`,[`config`,`--unset`,e]),I.debug(`Unset ${e}`))}async setGitSetting(e,t){await Zv(this.repositoryPath,`git`,[`config`,e,t]),I.debug(`Set ${e} to ${t}`)}};const uv=/"parents\s+<\|(?<parents>.*?)\|> author\s+<\|(?<author>.*?)\|>\s+email\s+<\|(?<authorEmail>.*?)\|>\s+date\s+<\|(?<dateCommitter>\d+)\s(?<dateAuthor>\d+)\|>\s+message\s+<\|(?<message>[\s\S]*?)\|>\s+body\s+<\|(?<body>[\s\S]*?)\|>\s+hash\s+<\|(?<hash>.+?)\|>"\s*(?<contributions>(?:(?:\d+|-)\s+(?:\d+|-)\s+.+\s?)*)(?<modes>(?:\s.+\s*)*)/gmu,dv=/"<\|(?<parents>.*?)\|><\|(?<author>.*?)\|><\|(?<authorEmail>.*?)\|><\|(?<dateCommitter>\d+)\s(?<dateAuthor>\d+)\|>\s*<\|(?<trailers>[\s\S]*?)\|><\|(?<hash>.+?)\|>"\s*(?<contributions>(?:(?:\d+|-)\s+(?:\d+|-)\s+.+\s?)*)(?<modes>(?:\s.+\s*)*)/gmu,fv=/(?<insertions>\d+|-)\s+(?<deletions>\d+|-)\s+(?<file>.+)/gm,pv=/^\S+? (?<type>\S+) (?<hash>\S+)\s+(?<size>\S+)\s+(?<path>.+)/gm,mv=/\s(?<mode>\w+)\s\w+\s\d+\s(?<file>.+)/gmu,hv=Error(`request for lock canceled`);var gv=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},_v=class{constructor(e,t=hv){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{let i={resolve:n,reject:r,weight:e,priority:t},a=yv(this._queue,e=>t<=e.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return gv(this,arguments,void 0,function*(e,t=1,n=0){let[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}})}waitForUnlock(e=1,t=0){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),vv(this._weightedWaiters[e-1],{resolve:n,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(e=>e.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let n=this._weightedWaiters[t-1];if(!n)continue;let r=n.findIndex(t=>t.priority<=e);(r===-1?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function vv(e,t){let n=yv(e,e=>t.priority<=e.priority);e.splice(n+1,0,t)}function yv(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var bv=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},xv=class{constructor(e){this._semaphore=new _v(1,e)}acquire(){return bv(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}},Sv=class{mutex;constructor(){this.mutex=new xv}isLocked(){return this.mutex.isLocked()}async withDisposable(e){let t=await this.mutex.acquire();try{await e?.()}catch(e){throw t(),e}return{[Symbol.dispose]:()=>{t()}}}};function Cv(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var wv=class e{static separator=`---`;static metadataDB;static mutex=new Sv;static getPath(){return i(t.tmpdir(),`git-truck-cache`,`metadata.json`)}static getInstance(){return this.metadataDB||=new e,this.metadataDB}static async resetInstance(){try{var t=Cv();t.u(await e.mutex.withDisposable()),await g.rm(this.getPath(),{recursive:!0,force:!0}),e.metadataDB=new e}catch(e){t.e=e}finally{t.d()}}async readMetadata(){try{var t=Cv();return t.u(await e.mutex.withDisposable()),await this.readMetadataUnlocked()}catch(e){t.e=e}finally{t.d()}}async readMetadataUnlocked(){try{return JSON.parse(await g.readFile(e.getPath(),`utf8`))}catch{return{completions:{},authorcolors:{}}}}async setMetadataUnlocked(t){let n=JSON.stringify(t);await g.mkdir(r(e.getPath()),{recursive:!0}),await g.writeFile(e.getPath(),n,`utf8`)}async setCompletion({repositoryPath:t,branch:n},r){try{var i=Cv();i.u(await e.mutex.withDisposable()),await this.setCompletionUnlocked({repositoryPath:t,branch:n},r)}catch(e){i.e=e}finally{i.d()}}async setCompletionUnlocked({repositoryPath:t,branch:n},r){let i=await this.readMetadataUnlocked();i.completions[e.getCompletionKey({repositoryPath:t,branch:n})]={hash:r,time:Math.floor(Date.now()/1e3)},await this.setMetadataUnlocked(i)}async addContributorColor(t,n){try{var r=Cv();r.u(await e.mutex.withDisposable()),await this.addContributorColorUnlocked(t,n)}catch(e){r.e=e}finally{r.d()}}async addContributorColorUnlocked(e,t){let n=await this.readMetadataUnlocked();t===``?delete n.authorcolors[e]:n.authorcolors[e]=t,await this.setMetadataUnlocked(n)}async getContributorColors(){return(await this.readMetadata()).authorcolors}async getLastRun({repositoryPath:t,branch:n}){return(await this.readMetadata()).completions[e.getCompletionKey({repositoryPath:t,branch:n})]}async getCompletedRepos(){let t=[],n=await this.readMetadata();for(let[r,i]of Object.entries(n.completions)){let[n,a]=r.split(e.separator);t.push({repositoryPath:n,branch:a,time:i.time,hash:i.hash})}return t}static getCompletionKey({repositoryPath:t,branch:n}){return`${t}${e.separator}${n}`}},Tv=N(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},_=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],v=/(^|\\\/)?\\\*$/,y=`regex`,b=`checkRegex`,x={[y](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[b](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},S=e=>_.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),C=e=>typeof e==`string`,w=e=>e&&C(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,T=e=>e.split(s).filter(Boolean);var E=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_`+y;return this[e]?this[e]:this._make(y,e)}get checkRegex(){let e=`_`+b;return this[e]?this[e]:this._make(b,e)}_make(e,t){let n=this.regexPrefix.replace(v,x[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let ee=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=S(i);return new E(e,t,i,n,r,s)};var D=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(C(e)&&(e={pattern:e}),w(e.pattern)){let t=ee(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?T(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let O=(e,t)=>{throw new t(e)},k=(e,t,n)=>C(e)?e?k.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),te=e=>c.test(e);k.isNotRelative=te,k.convert=e=>e;var A=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new D(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&k.convert(e);return k(i,e,this._strictPathCheck?O:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,b)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,y);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,y)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ne=e=>new A(e),re=e=>k(e&&k.convert(e),e,m),j=()=>{k.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;k.isNotRelative=t=>e.test(t)||te(t)};typeof process<`u`&&process.platform===`win32`&&j(),t.exports=ne,ne.default=ne,t.exports.isPathValid=re,f(t.exports,Symbol.for(`setupWindows`),j)})),Ev=N((e=>{
|
|
840
1058
|
/**
|
|
841
1059
|
* @license React
|
|
842
1060
|
* react.production.js
|
|
@@ -846,7 +1064,7 @@ Documentation: https://github.com/git-truck/git-truck
|
|
|
846
1064
|
* This source code is licensed under the MIT license found in the
|
|
847
1065
|
* LICENSE file in the root directory of this source tree.
|
|
848
1066
|
*/
|
|
849
|
-
var t={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},n=Object.assign,r={};function i(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}i.prototype.isReactComponent={},i.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},i.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function a(){}a.prototype=i.prototype;function o(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}var s=o.prototype=new a;s.constructor=o,n(s,i.prototype),s.isPureReactComponent=!0,Array.isArray})),Dv=N(((e,t)=>{t.exports=Ev()})),Ov=ue(Tv(),1);Dv();function kv(e){return e===null||Array.isArray(e)&&e.length===0}function Av(e,t,n){if(typeof e==`string`)n.set(t,e);else{n.delete(t);for(let r of e)n.append(t,r);n.has(t)||n.set(t,``)}return n}function jv(e,{urlKeys:t={}}={}){function n(r,{strict:i=!1}={}){if(r instanceof Promise)return r.then(e=>n(e,{strict:i}));let a=Mv(r),o={};for(let[n,r]of Object.entries(e)){let e=t[n]??n,s=r.type===`multi`?a.getAll(e):a.get(e);if(kv(s)){o[n]=r.defaultValue??null;continue}let c;try{c=r.parse(s)}catch(e){if(i)throw Error(`[nuqs] Error while parsing query \`${s}\` for key \`${n}\`: ${e}`);c=null}if(i&&s&&c===null)throw Error(`[nuqs] Failed to parse query \`${s}\` for key \`${n}\` (got null)`);o[n]=c??r.defaultValue??null}return o}return n}function Mv(e){try{if(e instanceof Request)return e.url?new URL(e.url).searchParams:new URLSearchParams;if(e instanceof URL)return e.searchParams;if(e instanceof URLSearchParams)return e;if(typeof e==`object`){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,r);return t}if(typeof e==`string`)return URL.hasOwnProperty(`canParse`)&&URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e)}catch{}return new URLSearchParams}function Nv(){if(typeof window>`u`||!window.GestureEvent)return 50;try{let e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}Nv();const Pv=Iv();function Fv(e,...t){Pv&&console.warn(e,...t)}function Iv(){if(typeof window>`u`)return(process.env.DEBUG||``).includes(`nuqs`);try{let e=`nuqs-localStorage-test`;if(typeof localStorage>`u`)return!1;localStorage.setItem(e,e);let t=localStorage.getItem(e)===e;return localStorage.removeItem(e),t&&(localStorage.getItem(`debug`)||``).includes(`nuqs`)}catch{return!1}}function Lv(e,t,n){try{return e(t)}catch(e){return Fv("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":``),t,e,n),null}}function Rv(e){function t(t){if(t===void 0)return null;let n=``;if(Array.isArray(t)){if(t[0]===void 0)return null;n=t[0]}return typeof t==`string`&&(n=t),Lv(e.parse,n)}return{type:`single`,eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide(n){return t(n)??e}}},withOptions(e){return{...this,...e}}}}const zv=Rv({parse:e=>e,serialize:String}),Bv=Rv({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>``+Math.round(e)});Rv({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>``+Math.round(e+1)}),Rv({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(t.length&1?`0`:``)+t}}),Rv({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String}),Rv({parse:e=>e.toLowerCase()===`true`,serialize:String});function Vv(e,t){return e.valueOf()===t.valueOf()}Rv({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>``+e.valueOf(),eq:Vv}),Rv({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:Vv}),Rv({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:Vv});function Hv(e){return Rv({parse:t=>{let n=t;return e.includes(n)?n:null},serialize:String})}function Uv(e){if(e.size===0)return``;let t=[];for(let[n,r]of e.entries()){let e=n.replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/\+/g,`%2B`).replace(/=/g,`%3D`).replace(/\?/g,`%3F`);t.push(`${e}=${Wv(r)}`)}return`?`+t.join(`&`)}function Wv(e){return e.replace(/%/g,`%25`).replace(/\+/g,`%2B`).replace(/ /g,`+`).replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/"/g,`%22`).replace(/'/g,`%27`).replace(/`/g,`%60`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/[\x00-\x1F]/g,e=>encodeURIComponent(e))}function Gv(e,{clearOnDefault:t=!0,urlKeys:n={},processUrlSearchParams:r}={}){function i(i,a={}){let[o,s]=Kv(i)?qv(i):[``,new URLSearchParams],c=Kv(i)?a:i;if(c===null){for(let t in e){let e=n[t]??t;s.delete(e)}return r&&(s=r(s)),o+Uv(s)}for(let r in e){let i=e[r],a=c[r];if(!i||a===void 0)continue;let o=n[r]??r,l=i.defaultValue!==void 0&&a!==null&&(i.eq??((e,t)=>e===t))(a,i.defaultValue);a===null||(i.clearOnDefault??t??!0)&&l?s.delete(o):s=Av(i.serialize(a),o,s)}return r&&(s=r(s)),o+Uv(s)}return i}function Kv(e){return typeof e==`string`||e instanceof URLSearchParams||e instanceof URL}function qv(e){if(typeof e==`string`){let[t=``,...n]=e.split(`?`);return[t,new URLSearchParams(n.join(`?`))]}else if(e instanceof URLSearchParams)return[``,new URLSearchParams(e)];else return[e.origin+e.pathname,new URLSearchParams(e.searchParams)]}const Jv={path:zv.withOptions({shallow:!1}),objectPath:zv,zoomPath:zv.withOptions({shallow:!1}),branch:zv.withOptions({shallow:!1}),timeUnit:Hv(Q_).withOptions({shallow:!1}),start:Bv.withOptions({shallow:!1}),end:Bv.withOptions({shallow:!1})};Gv(Jv),jv(Jv);var Yv=class{status=`Initialized`;gitService;db;progress=[0];totalCommitCount=0;progressRevision=0;fileTreeAsOf=null;fileTreeResult=null;timeIntervalMutex=new Sv;currentTimeInterval=null;prevResult=null;prevArgs=null;prevInvokeReason=`unknown`;repositoryPath;repositoryName;branch;constructor({db:e,gitService:t,repositoryPath:n,branch:r}){this.repositoryPath=n,this.repositoryName=iy(n),this.branch=r,this.gitService=t,this.db=e}updateProgress(e){this.progress[e]++,this.progressRevision++}abort(){let e=this.status;return this.status=`Aborted`,this.progressRevision++,e}throwIfAborted(){if(this.status===`Aborted`)throw Error(`Instance aborted`)}setAnalyzationStatus(e){this.status!==`Aborted`&&(this.status=e,this.progressRevision++)}async gathererWorker(e,t,n){let r=7e4;for(let i=e;i<=t;i+=r){let a=Math.min(i+r,t),o=new Map,s=[];I.debug(`thread ${n} gathering ${i}-${a}`),await this.gatherCommitsInRange(i,a,o,s,n),await this.db.addRenames(s),await this.db.addCommits(o),this.progress[n]=a-e}}async updateTimeInterval(e,t){if(this.currentTimeInterval?.start===e&&this.currentTimeInterval.end===t)return;await this.db.updateTimeInterval(e,t);let n=this.fileTreeAsOf;this.fileTreeAsOf=await this.db.getLatestCommitHash(t),n&&n!==this.fileTreeAsOf&&(this.fileTreeResult=null),this.currentTimeInterval={start:e,end:t}}invalidateTimeInterval(){this.currentTimeInterval=null}async withTimeInterval(e,t){return await this.timeIntervalMutex.withDisposable(()=>this.updateTimeInterval(e,t))}async analyzeTree(){this.throwIfAborted(),this.fileTreeAsOf||=await this.db.getLatestCommitHash();let e=(await this.gitService.lsTree(this.fileTreeAsOf)).matchAll(pv).toArray().flatMap(e=>{if(!e.groups)return[];let t=e.groups,n=t.path.split(`/`).at(-1),r=Number(t.size===`-`?0:t.size);return{type:t.type,hash:t.hash,byteSize:Number.isFinite(r)?r:0,path:this.repositoryName+`/`+t.path,name:n}});I.time(`calculate tree sizes`);let t=new Map([[this.repositoryName,0]]);for(let n of e)n.type===`tree`&&t.set(n.path,0);for(let n of e){if(n.type!==`blob`)continue;let e=n.path.lastIndexOf(`/`);for(;e!==-1;){let r=n.path.slice(0,e);if(t.set(r,(t.get(r)??0)+n.byteSize),r===this.repositoryName)break;e=r.lastIndexOf(`/`)}}I.timeEnd(`calculate tree sizes`);let n={type:`tree`,path:this.repositoryName,name:this.repositoryName,hash:this.fileTreeAsOf,byteSize:t.get(this.repositoryName)??0},r=[n,...e.map(e=>e.type===`tree`?{...e,byteSize:t.get(e.path)??0}:e)],i=e.filter(e=>e.type===`blob`).length,a={...n,children:[]};this.throwIfAborted(),await this.db.replaceFiles(r);let o=new Map([[a.path,a]]);for(let t of e){let e=`${t.path}`,n=e.slice(e.lastIndexOf(`/`)+1),r=e.slice(0,e.lastIndexOf(`/`)),i=o.get(r)??a;switch(t.type){case`tree`:{if(!t.hash)throw Error(`oh no missing hash`);let r={type:`tree`,hash:t.hash,path:e,name:n,byteSize:t.byteSize,children:[]};i.children.push(r),o.set(e,r);break}case`blob`:{let r={type:`blob`,hash:t.hash,path:e,name:n,extension:n.substring(n.lastIndexOf(`.`)+1),byteSize:t.byteSize};i.children.push(r);break}}}return this.treeCleanup(a),this.fileTreeResult={rootTree:a,fileCount:i},this.fileTreeResult}async getFileTree(){return this.fileTreeResult??await this.analyzeTree()}filterHiddenFilesFromTree(e,t){let n=t.flatMap(e=>{let t=`${this.repositoryName}/`;return e.startsWith(t)?[e,e.slice(t.length)]:[e]}),r=(0,Ov.default)().add(n),i=e=>{let t=e.path===this.repositoryName?``:e.path.slice(this.repositoryName.length+1);if(t&&r.ignores(t))return null;if(e.type===`blob`)return e;let n=0,a=[];for(let t of e.children){let e=i(t);e&&(n+=e.byteSize,a.push(e))}return a.length===0&&e.path!==this.repositoryName?null:{...e,byteSize:n,children:a}},a=i(e);return!a||a.type!==`tree`?{rootTree:{...e,byteSize:0,children:[]},fileCount:0}:{rootTree:a,fileCount:this.countFiles(a)}}countFiles(e){let t=0;for(let n of e.children)n.type===`blob`?t+=1:t+=this.countFiles(n);return t}treeCleanup(e){for(let t of e.children)if(t.type===`tree`){let e=t;this.treeCleanup(e)}if(e.children=e.children.filter(e=>e.type===`blob`?!0:e.children.length!==0),e.children.length===1&&e.children[0].type===`tree`){let t=e.children[0];e.children=t.children,e.name=`${e.name}/${t.name}`,e.path=`${e.path}/${t.name}`}}async gatherCommitsFromGitLog(e,t,n){let r=e.matchAll(dv),i=[];for(let e of r){this.throwIfAborted();let r=e.groups??{},a=r.author,o=r.authorEmail,s=Number(r.dateCommitter),c=Number(r.dateAuthor),l=r.hash,u=r.contributions,d=r.modes,f=cv(r.trailers),p=[];if(d){let e=d.matchAll(mv);for(let t of e){let e=t.groups?.file.trim(),n=t.groups?.mode.trim();!e||!n||(n===`delete`||n===`create`)&&i.push({path:e,timestamp:s,timestampAuthor:c,type:n})}}if(u){let e=u.matchAll(fv);for(let t of e){let e=t.groups?.file.trim(),r=t.groups?.insertions===`-`;if(!e)throw Error(`file not found`);let i=e.includes(`=>`),a=e;i&&(a=iv(e,s,c,n,this.repositoryName));let o=r?1:Number(t.groups?.insertions??`0`),l=r?0:Number(t.groups?.deletions??`0`);p.push({isBinary:r,insertions:o,deletions:l,path:this.repositoryName+`/`+a,mode:`modify`})}}t.set(l,{author:{name:a,email:o},committerTime:s,authorTime:c,hash:l,coauthors:f,fileChanges:p})}n.push(...i.map(e=>e.type===`delete`?{fromName:e.path,toName:null,timestamp:e.timestamp,timestampAuthor:e.timestampAuthor}:{fromName:null,toName:e.path,timestamp:e.timestamp,timestampAuthor:e.timestampAuthor}))}async getFullCommits(e){let t=[],n=e.matchAll(uv);for(let e of n){this.throwIfAborted();let n=e.groups??{},r=n.author,i=n.authorEmail,a=n.message,o=n.body,s=Number(n.dateCommitter),c=Number(n.dateAuthor),l=n.hash,u=n.contributions,d=cv(o),f=[];if(u){let e=u.matchAll(fv);for(let t of e){let e=t.groups?.file.trim(),n=t.groups?.insertions===`-`;if(!e)throw Error(`file not found`);let r=n?1:Number(t.groups?.insertions??`0`),i=n?0:Number(t.groups?.deletions??`0`);f.push({isBinary:n,insertions:r,deletions:i,path:e,mode:`modify`})}}t.push({author:{name:r,email:i},committerTime:s,authorTime:c,hash:l,fileChanges:f,message:a,body:o,coauthors:d})}return t}async gatherCommitsInRange(e,t,n,r,i){this.throwIfAborted();let a=await this.gitService.gitLogSimple(e,t-e,this,i);await this.gatherCommitsFromGitLog(a,n,r),I.debug(`done gathering`)}flattenChains(e){return e.flatMap(e=>{let t=e[0].toName;return e.map(e=>({...e,toName:t}))})}async updateRenames(){let e=await this.db.getCurrentRenameIntervals(),t=await this.db.getFiles(),n=this.generateRenameChains(e,t),r=this.flattenChains(n);await this.db.replaceTemporaryRenames(r)}generateRenameChains(e,t){let n=new Map,r=[];for(let e of t)n.set(e,[{fromName:e,toName:e,timestamp:0,timestampEnd:4e9}]);for(let t of e){if(t.toName===null)continue;let e=n.get(t.toName);if(e){let i=e[e.length-1];i.timestamp=t.timestampEnd,t.fromName===null?(i.timestamp=t.timestampEnd,r.push(e)):(e.push(t),n.set(t.fromName,e)),n.delete(t.toName)}}return r.push(...n.values()),r}getThreadCount(e){let t=8e8,n=process.platform===`linux`||process.platform===`win32`?x()-t:Math.floor(S()/2)-t,r=Math.min(Math.max(b().length-2,2),4);if(n<1)return r;let i=Math.max(1300*e,4e8),a=Math.floor(n/i);return Math.max(2,Math.min(r,a))}calculateSections(e,t){let n=[];if(t===2){let t=Math.floor(e*53/100);n.push([0,t]),n.push([t,e])}else if(t===3){let t=Math.floor(e*35/100),r=Math.floor(e*33/100);n.push([0,t]),n.push([t,t+r]),n.push([t+r,e])}else if(t===4){let t=Math.floor(e*27/100),r=Math.floor(e*26/100),i=Math.floor(e*24/100);n.push([0,t]),n.push([t,t+r]),n.push([t+r,t+r+i]),n.push([t+r+i,e])}else throw Error(`Invalid threadCount. Only 2, 3, or 4 are allowed.`);return n}async loadRepoData(){this.setAnalyzationStatus(`Initialized`);let e=await this.gitService.getCommitCount(),t=await wv.getInstance().getLastRun({repositoryPath:this.repositoryPath,branch:this.branch});if(!await this.db.commitTableEmpty())if(t){let t=await this.db.getLatestCommitHash();e=await this.gitService.commitCountSinceCommit(t,this.branch),I.debug(`Repo has been analyzed previously, only analyzing ${e} commits`)}else I.warn(`Incomplete database found. Clearing and running complete analysis.`),await this.db.clearAllTables();if(e<1)return;let[n]=await $(this.gitService.getDefaultGitSettingValue(`core.quotepath`));await $(this.gitService.setGitSetting(`core.quotePath`,`off`));let[r]=await $(this.gitService.getDefaultGitSettingValue(`diff.renames`));await $(this.gitService.setGitSetting(`diff.renames`,`true`));let[i]=await $(this.gitService.getDefaultGitSettingValue(`diff.renameLimit`));await $(this.gitService.setGitSetting(`diff.renameLimit`,`1000000`)),this.totalCommitCount=e;let a=this.getThreadCount(e);this.progress=Array(a).fill(0),this.setAnalyzationStatus(`ProcessingCommitHistory`);let o=this.calculateSections(e,a),s=Array.from({length:a},async(e,t)=>{let n=o[t][0],r=o[t][1];I.debug(`start thread `+n+`-`+r+`, `+t),await this.gathererWorker(n,r,t),I.debug(`finished thread: `+t)});await Promise.all(s),await this.db.createIndexes(),await this.db.checkpoint(),n&&await $(this.gitService.resetGitSetting(`core.quotepath`,n)),r&&await $(this.gitService.resetGitSetting(`diff.renames`,r)),i&&await $(this.gitService.resetGitSetting(`diff.renameLimit`,i)),await wv.getInstance().setCompletion({repositoryPath:this.repositoryPath,branch:this.branch},await this.db.getLatestCommitHash()),this.invalidateTimeInterval(),this.setAnalyzationStatus(`CommitHistoryProcessed`)}};function Xv(e,t,n,r,i){I.debug(`exec ${e} $ ${t} ${n.join(` `)}`);let a=Error(`Command failed: `+t+` `+n.join(` `));return new Promise((o,s)=>{let l=c.resolve(e),u=ee(t,n,{cwd:l}),d=[],f=[];u.on(`error`,e=>{a.message+=`\nFailed to start process: ${e.message}`,s(a)}),u.stdout.on(`data`,e=>{d.push(e),r&&i!==void 0&&r.updateProgress(i)}),u.stderr.on(`data`,e=>f.push(e)),u.on(`close`,e=>{let r=Buffer.concat(d).toString().trim(),i=Buffer.concat(f).toString().trim();if(e===0){o(r);return}a.message=`Command failed: ${t} ${n.join(` `)}\ncwd: ${l}\n\n${i||`Exited with code ${e}`}`,s(a)})})}function Zv(e){let t=[];for(let n=0;n<e;n++){let r=`${` `.repeat(e-n-1)}🚛\n`;t.push(r)}return t}function Qv(){return fi()===null?(0,$r.createSpinner)(``,{interval:1e3/20,frames:Zv(20)}):null}let $v=null;async function ey({job:e=async()=>null,beforeMsg:t=``,afterMsg:n=``,errorMsg:r=``,ms:i=null}){$v=Qv();let a=(e,t=!1)=>{if(fi()!==ri.SILENT){if($v===null)return I.info(e);$v.success({text:e}),t||$v.start()}},o=e=>{$v?($v.update({text:e,frames:Zv(e.length)}),$v.start()):I.info(e)},s=e=>$v===null?I.error(e):$v.error({text:e.message});t.length>0&&o(t);try{let t=ne.now(),r=await e(),o=ne.now();return a(`${n} ${Qr.default.gray(`${av(i||o-t)}`)}`,!0),[r,null]}catch(e){let t=Error(r,{cause:e});return s(t),[null,t]}}let ty=null;async function ny(){if(!ty){I.info(`Fetching latest version from npm registry...`);let[e]=await $(fetch(`https://registry.npmjs.org/-/package/git-truck/dist-tags`).then(e=>e.json()).then(e=>e.latest));ty=e}return ty}const ry=e=>ay(c.dirname(e)),iy=e=>{let t=c.resolve(e);return c.basename(t)||t};function ay(e){return ov(c.resolve(e))}var oy=class{static CACHE_FOLDER=i(t.tmpdir(),`git-truck-cache`);static instancesSingleton=new Map;static mutex=new Sv;static getInstanceIsAborted({repositoryPath:e,branch:t}){let n=this.instancesSingleton.get(e)?.get(t);return n?n.status===`Aborted`:!1}static async abortInstance({repositoryPath:e,branch:t}){try{var n=Cv();n.u(await this.mutex.withDisposable());let r=this.instancesSingleton.get(e)?.get(t);if(r){let n=r.abort();return await this.closeInstance({repositoryPath:e,branch:t}),n!==`CommitHistoryProcessed`&&await this.clearCache({repositoryPath:e,branch:t}),!0}return!1}catch(e){n.e=e}finally{n.d()}}static getInstanceProgress({repositoryPath:e,branch:t}){let n=this.instancesSingleton.get(e)?.get(t);return n?{status:n.status,totalCommitCount:n.totalCommitCount,progress:n.progress,progressPercentage:this.calculateProgressPercentage(n.progress,n.totalCommitCount),progressRevision:n.progressRevision}:null}static calculateProgressPercentage(e,t){return t>0?Math.min(e.reduce((e,t)=>e+t,0)/t*100,100):0}static async getInstance({repositoryPath:e,branch:t}){try{var n=Cv();return n.u(await this.mutex.withDisposable()),await this.getOrCreateInstanceUnlocked({repositoryPath:e,branch:t})}catch(e){n.e=e}finally{n.d()}}static async getOrCreateInstanceUnlocked({repositoryPath:e,branch:t}){this.instancesSingleton||=new Map;let n=this.instancesSingleton.get(e)?.get(t);if(n&&n.status!==`Aborted`)return n;let r=new Yv({db:await this.initOrRecreateDatabase({repositoryPath:e,branch:t}),gitService:new lv({repositoryPath:e,branch:t}),repositoryPath:e,branch:t}),i=this.instancesSingleton.get(e);return i?i.set(t,r):this.instancesSingleton.set(e,new Map([[t,r]])),r}static async closeInstance({repositoryPath:e,branch:t}){let n=this.instancesSingleton.get(e)?.get(t);n&&(this.instancesSingleton.get(e)?.delete(t),this.instancesSingleton.get(e)?.size===0&&this.instancesSingleton.delete(e),await n.db.close())}static async clearAllCaches(){try{var e=Cv();e.u(await this.mutex.withDisposable()),await this.closeAllDBInstancesUnlocked(),await this.clearAllCachesUnlocked(),await wv.resetInstance()}catch(t){e.e=t}finally{e.d()}}static async closeAllDBInstances(){try{var e=Cv();e.u(await this.mutex.withDisposable()),await this.closeAllDBInstancesUnlocked()}catch(t){e.e=t}finally{e.d()}}static async closeAllDBInstancesUnlocked(){let e=Array.from(this.instancesSingleton.values()).flatMap(e=>Array.from(e.values()).flatMap(e=>(e.abort(),e.db.close())));await Promise.all(e),this.instancesSingleton=new Map}static getDBPath({repositoryPath:e,branch:t}){let n=encodeURIComponent(e),r=encodeURIComponent(t);return i(this.CACHE_FOLDER,n,`${r}.db`)}static async clearAllCachesUnlocked(){h(this.CACHE_FOLDER)&&await j.rm(this.CACHE_FOLDER,{recursive:!0,force:!0})}static async clearCache({repositoryPath:e,branch:t}){let n=this.getDBPath({repositoryPath:e,branch:t});await Promise.allSettled([j.rm(n,{force:!0}),j.rm(`${n}.wal`,{force:!0})]);let i=r(n);(await j.readdir(i).catch(()=>[])).length===0&&await j.rmdir(i).catch(()=>{})}static async initDuckDBInstance(e){let t=r(e);return h(t)||await j.mkdir(t,{recursive:!0}),await re.create(e,{temp_directory:t})}static async initOrRecreateDatabase({repositoryPath:e,branch:t}){let n=this.getDBPath({repositoryPath:e,branch:t}),r=await this.initDuckDBInstance(n),i=await r.connect(),a=(await i.runAndReadAll(`SHOW TABLES`)).getRowObjects(),o=a.length===0,s=a.some(e=>e.name===`metadata`)?(await i.runAndReadAll(`SELECT stringValue FROM metadata WHERE field = 'version';`).catch(()=>{}))?.getRowObjects()[0]?.stringValue?.toString()??null:null;s&&I.debug(`Found existing database with git-truck version ${s}`);let c=s?(0,la.diff)(s,Un)===`major`:!0;if(a.length>0&&c){I.warn(`Database at path ${n} is stale (db: ${s}, installed: ${Un}), resetting...`),await this.closeInstance({repositoryPath:e,branch:t}),i.closeSync(),r.closeSync(),await this.clearCache({repositoryPath:e,branch:t}),r=await this.initDuckDBInstance(n),i=await r.connect(),I.info(`Database reset complete. Verifying...`);let a=(await i.runAndReadAll(`SHOW TABLES`)).getRowObjects();if(a.length>0)throw Error(`Failed to clear stale database, tables still exist after clearing: ${JSON.stringify(a)}`);I.info(`Done clearing stale database!`),o=!0}else I.info(`Database at path ${n} is up to date`);let l=await new sv({instance:r,connection:i}).init();return o&&(await this.insertGitTruckVersion(i),await this.insertCommonIgnoredFiles(l)),l}static async insertGitTruckVersion(e){if((await(await e.run(`SELECT stringValue FROM metadata WHERE field = 'version';`)).getRowObjects()).length>0)throw Error(`DB has already been populated with version metadata`);await e.run(`INSERT INTO metadata (field, stringValue) VALUES ('version', '${Un}');`)}static async insertCommonIgnoredFiles(e){await e.addHiddenFile(`package-lock.json`),await e.addHiddenFile(`bun.lock`),await e.addHiddenFile(`bun.lockb`),await e.addHiddenFile(`yarn.lock`)}};const sy=ti();sy.help&&(console.log(ni()),process.exit(0)),console.log(`Git Truck version ${Un}${await gy()}\n`),sy.version&&process.exit(0);const cy=n.dirname(o(import.meta.url)),ly=n.join(cy,`build/server/index.js`),uy=n.join(cy,`build/client`),dy=n.join(cy,`build/client/assets`);let fy;const py=process.env.PORT?Number.parseInt(process.env.PORT,10):NaN;Number.isInteger(py)&&py>=1&&py<=65535?fy=py:(process.env.PORT&&I.warn(`Invalid PORT environment variable "${process.env.PORT}". Falling back to an available port.`),fy=await $n({port:[...er(3e3,4e3)]}));const my=(0,Hn.default)();my.use(`/assets`,Hn.static(dy,{immutable:!0,maxAge:`1y`})),my.use(Hn.static(uy,{maxAge:`1h`})),my.use(await import(s(ly).href).then(e=>e.app));const hy=process.env.HOST?my.listen(fy,process.env.HOST,vy):my.listen(fy,vy);process.once(`SIGTERM`,_y),process.once(`SIGINT`,_y),process.on(`unhandledRejection`,e=>{let t=Error(`Unhandled Rejection`,{cause:e instanceof Error?e:void 0});console.error(`UNHANDLED:`,t)});async function gy(){let[e]=await $(ny());return e?tv(e,Un)===1?Un.startsWith(`0.0.0`)?` (experimental build)`:` [!] Update available: ${e}
|
|
1067
|
+
var t={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},n=Object.assign,r={};function i(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}i.prototype.isReactComponent={},i.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},i.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function a(){}a.prototype=i.prototype;function o(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}var s=o.prototype=new a;s.constructor=o,n(s,i.prototype),s.isPureReactComponent=!0,Array.isArray})),Dv=N(((e,t)=>{t.exports=Ev()})),Ov=ue(Tv(),1);Dv();function kv(e){return e===null||Array.isArray(e)&&e.length===0}function Av(e,t,n){if(typeof e==`string`)n.set(t,e);else{n.delete(t);for(let r of e)n.append(t,r);n.has(t)||n.set(t,``)}return n}function jv(e,{urlKeys:t={}}={}){function n(r,{strict:i=!1}={}){if(r instanceof Promise)return r.then(e=>n(e,{strict:i}));let a=Mv(r),o={};for(let[n,r]of Object.entries(e)){let e=t[n]??n,s=r.type===`multi`?a.getAll(e):a.get(e);if(kv(s)){o[n]=r.defaultValue??null;continue}let c;try{c=r.parse(s)}catch(e){if(i)throw Error(`[nuqs] Error while parsing query \`${s}\` for key \`${n}\`: ${e}`);c=null}if(i&&s&&c===null)throw Error(`[nuqs] Failed to parse query \`${s}\` for key \`${n}\` (got null)`);o[n]=c??r.defaultValue??null}return o}return n}function Mv(e){try{if(e instanceof Request)return e.url?new URL(e.url).searchParams:new URLSearchParams;if(e instanceof URL)return e.searchParams;if(e instanceof URLSearchParams)return e;if(typeof e==`object`){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,r);return t}if(typeof e==`string`)return URL.hasOwnProperty(`canParse`)&&URL.canParse(e)?new URL(e).searchParams:new URLSearchParams(e)}catch{}return new URLSearchParams}function Nv(){if(typeof window>`u`||!window.GestureEvent)return 50;try{let e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}Nv();const Pv=Iv();function Fv(e,...t){Pv&&console.warn(e,...t)}function Iv(){if(typeof window>`u`)return(process.env.DEBUG||``).includes(`nuqs`);try{let e=`nuqs-localStorage-test`;if(typeof localStorage>`u`)return!1;localStorage.setItem(e,e);let t=localStorage.getItem(e)===e;return localStorage.removeItem(e),t&&(localStorage.getItem(`debug`)||``).includes(`nuqs`)}catch{return!1}}function Lv(e,t,n){try{return e(t)}catch(e){return Fv("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":``),t,e,n),null}}function Rv(e){function t(t){if(t===void 0)return null;let n=``;if(Array.isArray(t)){if(t[0]===void 0)return null;n=t[0]}return typeof t==`string`&&(n=t),Lv(e.parse,n)}return{type:`single`,eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide(n){return t(n)??e}}},withOptions(e){return{...this,...e}}}}const zv=Rv({parse:e=>e,serialize:String}),Bv=Rv({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>``+Math.round(e)});Rv({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>``+Math.round(e+1)}),Rv({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(t.length&1?`0`:``)+t}}),Rv({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});const Vv=Rv({parse:e=>e.toLowerCase()===`true`,serialize:String});function Hv(e,t){return e.valueOf()===t.valueOf()}Rv({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>``+e.valueOf(),eq:Hv}),Rv({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:Hv}),Rv({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:Hv});function Uv(e){return Rv({parse:t=>{let n=t;return e.includes(n)?n:null},serialize:String})}function Wv(e){if(e.size===0)return``;let t=[];for(let[n,r]of e.entries()){let e=n.replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/\+/g,`%2B`).replace(/=/g,`%3D`).replace(/\?/g,`%3F`);t.push(`${e}=${Gv(r)}`)}return`?`+t.join(`&`)}function Gv(e){return e.replace(/%/g,`%25`).replace(/\+/g,`%2B`).replace(/ /g,`+`).replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/"/g,`%22`).replace(/'/g,`%27`).replace(/`/g,`%60`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/[\x00-\x1F]/g,e=>encodeURIComponent(e))}function Kv(e,{clearOnDefault:t=!0,urlKeys:n={},processUrlSearchParams:r}={}){function i(i,a={}){let[o,s]=qv(i)?Jv(i):[``,new URLSearchParams],c=qv(i)?a:i;if(c===null){for(let t in e){let e=n[t]??t;s.delete(e)}return r&&(s=r(s)),o+Wv(s)}for(let r in e){let i=e[r],a=c[r];if(!i||a===void 0)continue;let o=n[r]??r,l=i.defaultValue!==void 0&&a!==null&&(i.eq??((e,t)=>e===t))(a,i.defaultValue);a===null||(i.clearOnDefault??t??!0)&&l?s.delete(o):s=Av(i.serialize(a),o,s)}return r&&(s=r(s)),o+Wv(s)}return i}function qv(e){return typeof e==`string`||e instanceof URLSearchParams||e instanceof URL}function Jv(e){if(typeof e==`string`){let[t=``,...n]=e.split(`?`);return[t,new URLSearchParams(n.join(`?`))]}else if(e instanceof URLSearchParams)return[``,new URLSearchParams(e)];else return[e.origin+e.pathname,new URLSearchParams(e.searchParams)]}const Yv={path:zv.withOptions({shallow:!1}),objectPath:zv,zoomPath:zv.withOptions({shallow:!1}),branch:zv.withOptions({shallow:!1}),timeUnit:Uv(Q_).withOptions({shallow:!1}),start:Bv.withOptions({shallow:!1}),end:Bv.withOptions({shallow:!1}),includeCoauthors:Vv.withDefault(!0).withOptions({shallow:!1})};Kv(Yv),jv(Yv);var Xv=class{status=`Initialized`;gitService;db;progress=[0];totalCommitCount=0;progressRevision=0;fileTreeAsOf=null;fileTreeResult=null;timeIntervalMutex=new Sv;currentTimeInterval=null;prevResult=null;prevArgs=null;prevInvokeReason=`unknown`;repositoryPath;repositoryName;branch;constructor({db:e,gitService:t,repositoryPath:n,branch:r}){this.repositoryPath=n,this.repositoryName=ay(n),this.branch=r,this.gitService=t,this.db=e}updateProgress(e){this.progress[e]++,this.progressRevision++}abort(){let e=this.status;return this.status=`Aborted`,this.progressRevision++,e}throwIfAborted(){if(this.status===`Aborted`)throw Error(`Instance aborted`)}setAnalyzationStatus(e){this.status!==`Aborted`&&(this.status=e,this.progressRevision++)}async gathererWorker(e,t,n){let r=7e4;for(let i=e;i<=t;i+=r){let a=Math.min(i+r,t),o=new Map,s=[];I.debug(`thread ${n} gathering ${i}-${a}`),await this.gatherCommitsInRange(i,a,o,s,n),await this.db.addRenames(s),await this.db.addCommits(o),this.progress[n]=a-e}}async updateTimeInterval(e,t){if(this.currentTimeInterval?.start===e&&this.currentTimeInterval.end===t)return;await this.db.updateTimeInterval(e,t);let n=this.fileTreeAsOf;this.fileTreeAsOf=await this.db.getLatestCommitHash(t),n&&n!==this.fileTreeAsOf&&(this.fileTreeResult=null),this.currentTimeInterval={start:e,end:t}}invalidateTimeInterval(){this.currentTimeInterval=null}async withTimeInterval(e,t){return await this.timeIntervalMutex.withDisposable(()=>this.updateTimeInterval(e,t))}async analyzeTree(){this.throwIfAborted(),this.fileTreeAsOf||=await this.db.getLatestCommitHash();let e=(await this.gitService.lsTree(this.fileTreeAsOf)).matchAll(pv).toArray().flatMap(e=>{if(!e.groups)return[];let t=e.groups,n=t.path.split(`/`).at(-1),r=Number(t.size===`-`?0:t.size);return{type:t.type,hash:t.hash,byteSize:Number.isFinite(r)?r:0,path:this.repositoryName+`/`+t.path,name:n}});I.time(`calculate tree sizes`);let t=new Map([[this.repositoryName,0]]);for(let n of e)n.type===`tree`&&t.set(n.path,0);for(let n of e){if(n.type!==`blob`)continue;let e=n.path.lastIndexOf(`/`);for(;e!==-1;){let r=n.path.slice(0,e);if(t.set(r,(t.get(r)??0)+n.byteSize),r===this.repositoryName)break;e=r.lastIndexOf(`/`)}}I.timeEnd(`calculate tree sizes`);let n={type:`tree`,path:this.repositoryName,name:this.repositoryName,hash:this.fileTreeAsOf,byteSize:t.get(this.repositoryName)??0},r=[n,...e.map(e=>e.type===`tree`?{...e,byteSize:t.get(e.path)??0}:e)],i=e.filter(e=>e.type===`blob`).length,a={...n,children:[]};this.throwIfAborted(),await this.db.replaceFiles(r);let o=new Map([[a.path,a]]);for(let t of e){let e=`${t.path}`,n=e.slice(e.lastIndexOf(`/`)+1),r=e.slice(0,e.lastIndexOf(`/`)),i=o.get(r)??a;switch(t.type){case`tree`:{if(!t.hash)throw Error(`oh no missing hash`);let r={type:`tree`,hash:t.hash,path:e,name:n,byteSize:t.byteSize,children:[]};i.children.push(r),o.set(e,r);break}case`blob`:{let r={type:`blob`,hash:t.hash,path:e,name:n,extension:n.substring(n.lastIndexOf(`.`)+1),byteSize:t.byteSize};i.children.push(r);break}}}return this.treeCleanup(a),this.fileTreeResult={rootTree:a,fileCount:i},this.fileTreeResult}async getFileTree(){return this.fileTreeResult??await this.analyzeTree()}filterHiddenFilesFromTree(e,t){let n=t.flatMap(e=>{let t=`${this.repositoryName}/`;return e.startsWith(t)?[e,e.slice(t.length)]:[e]}),r=(0,Ov.default)().add(n),i=e=>{let t=e.path===this.repositoryName?``:e.path.slice(this.repositoryName.length+1);if(t&&r.ignores(t))return null;if(e.type===`blob`)return e;let n=0,a=[];for(let t of e.children){let e=i(t);e&&(n+=e.byteSize,a.push(e))}return a.length===0&&e.path!==this.repositoryName?null:{...e,byteSize:n,children:a}},a=i(e);return!a||a.type!==`tree`?{rootTree:{...e,byteSize:0,children:[]},fileCount:0}:{rootTree:a,fileCount:this.countFiles(a)}}countFiles(e){let t=0;for(let n of e.children)n.type===`blob`?t+=1:t+=this.countFiles(n);return t}treeCleanup(e){for(let t of e.children)if(t.type===`tree`){let e=t;this.treeCleanup(e)}if(e.children=e.children.filter(e=>e.type===`blob`?!0:e.children.length!==0),e.children.length===1&&e.children[0].type===`tree`){let t=e.children[0];e.children=t.children,e.name=`${e.name}/${t.name}`,e.path=`${e.path}/${t.name}`}}async gatherCommitsFromGitLog(e,t,n){let r=e.matchAll(dv),i=[];for(let e of r){this.throwIfAborted();let r=e.groups??{},a=r.parents.split(` `).filter(e=>e!==``),o=r.author,s=r.authorEmail,c=Number(r.dateCommitter),l=Number(r.dateAuthor),u=r.hash,d=r.contributions,f=r.modes,p=cv(r.trailers),m=[];if(f){let e=f.matchAll(mv);for(let t of e){let e=t.groups?.file.trim(),n=t.groups?.mode.trim();!e||!n||(n===`delete`||n===`create`)&&i.push({path:e,timestamp:c,timestampAuthor:l,type:n})}}if(d){let e=d.matchAll(fv);for(let t of e){let e=t.groups?.file.trim(),r=t.groups?.insertions===`-`;if(!e)throw Error(`file not found`);let i=e.includes(`=>`),a=e;i&&(a=iv(e,c,l,n,this.repositoryName));let o=r?1:Number(t.groups?.insertions??`0`),s=r?0:Number(t.groups?.deletions??`0`);m.push({isBinary:r,insertions:o,deletions:s,path:this.repositoryName+`/`+a,mode:`modify`})}}t.set(u,{author:{name:o,email:s},committerTime:c,authorTime:l,hash:u,coauthors:p,fileChanges:m,parentHash:a[0]??``,secondaryParentHash:a[1]??null})}n.push(...i.map(e=>e.type===`delete`?{fromName:e.path,toName:null,timestamp:e.timestamp,timestampAuthor:e.timestampAuthor}:{fromName:null,toName:e.path,timestamp:e.timestamp,timestampAuthor:e.timestampAuthor}))}async getFullCommits(e){let t=[],n=e.matchAll(uv);for(let e of n){this.throwIfAborted();let n=e.groups??{},r=n.parents.split(` `).filter(e=>e!==``),i=n.author,a=n.authorEmail,o=n.message,s=n.body,c=Number(n.dateCommitter),l=Number(n.dateAuthor),u=n.hash,d=n.contributions,f=cv(s),p=[];if(d){let e=d.matchAll(fv);for(let t of e){let e=t.groups?.file.trim(),n=t.groups?.insertions===`-`;if(!e)throw Error(`file not found`);let r=n?1:Number(t.groups?.insertions??`0`),i=n?0:Number(t.groups?.deletions??`0`);p.push({isBinary:n,insertions:r,deletions:i,path:e,mode:`modify`})}}t.push({author:{name:i,email:a},committerTime:c,authorTime:l,hash:u,fileChanges:p,message:o,body:s,coauthors:f,parentHash:r[0]??``,secondaryParentHash:r[1]??null})}return t}async gatherCommitsInRange(e,t,n,r,i){this.throwIfAborted();let a=await this.gitService.gitLogSimple(e,t-e,this,i);await this.gatherCommitsFromGitLog(a,n,r),I.debug(`done gathering`)}flattenChains(e){return e.flatMap(e=>{let t=e[0].toName;return e.map(e=>({...e,toName:t}))})}async updateRenames(){let e=await this.db.getCurrentRenameIntervals(),t=await this.db.getFiles(),n=this.generateRenameChains(e,t),r=this.flattenChains(n);await this.db.replaceTemporaryRenames(r)}generateRenameChains(e,t){let n=new Map,r=[];for(let e of t)n.set(e,[{fromName:e,toName:e,timestamp:0,timestampEnd:4e9}]);for(let t of e){if(t.toName===null)continue;let e=n.get(t.toName);if(e){let i=e[e.length-1];i.timestamp=t.timestampEnd,t.fromName===null?(i.timestamp=t.timestampEnd,r.push(e)):(e.push(t),n.set(t.fromName,e)),n.delete(t.toName)}}return r.push(...n.values()),r}getThreadCount(e){let t=8e8,n=process.platform===`linux`||process.platform===`win32`?x()-t:Math.floor(S()/2)-t,r=Math.min(Math.max(b().length-2,2),4);if(n<1)return r;let i=Math.max(1300*e,4e8),a=Math.floor(n/i);return Math.max(2,Math.min(r,a))}calculateSections(e,t){let n=[];if(t===2){let t=Math.floor(e*53/100);n.push([0,t]),n.push([t,e])}else if(t===3){let t=Math.floor(e*35/100),r=Math.floor(e*33/100);n.push([0,t]),n.push([t,t+r]),n.push([t+r,e])}else if(t===4){let t=Math.floor(e*27/100),r=Math.floor(e*26/100),i=Math.floor(e*24/100);n.push([0,t]),n.push([t,t+r]),n.push([t+r,t+r+i]),n.push([t+r+i,e])}else throw Error(`Invalid threadCount. Only 2, 3, or 4 are allowed.`);return n}async loadRepoData(){this.setAnalyzationStatus(`Initialized`);let e=await this.gitService.getCommitCount(),t=await wv.getInstance().getLastRun({repositoryPath:this.repositoryPath,branch:this.branch});if(!await this.db.commitTableEmpty())if(t){let t=await this.db.getLatestCommitHash();e=await this.gitService.commitCountSinceCommit(t,this.branch),I.debug(`Repo has been analyzed previously, only analyzing ${e} commits`)}else I.warn(`Incomplete database found. Clearing and running complete analysis.`),await this.db.clearAllTables();if(e<1)return;let[n]=await $(this.gitService.getDefaultGitSettingValue(`core.quotepath`));await $(this.gitService.setGitSetting(`core.quotePath`,`off`));let[r]=await $(this.gitService.getDefaultGitSettingValue(`diff.renames`));await $(this.gitService.setGitSetting(`diff.renames`,`true`));let[i]=await $(this.gitService.getDefaultGitSettingValue(`diff.renameLimit`));await $(this.gitService.setGitSetting(`diff.renameLimit`,`1000000`)),this.totalCommitCount=e;let a=this.getThreadCount(e);this.progress=Array(a).fill(0),this.setAnalyzationStatus(`ProcessingCommitHistory`);let o=this.calculateSections(e,a),s=Array.from({length:a},async(e,t)=>{let n=o[t][0],r=o[t][1];I.debug(`start thread `+n+`-`+r+`, `+t),await this.gathererWorker(n,r,t),I.debug(`finished thread: `+t)});await Promise.all(s),await this.db.createIndexes(),await this.db.checkpoint(),n&&await $(this.gitService.resetGitSetting(`core.quotepath`,n)),r&&await $(this.gitService.resetGitSetting(`diff.renames`,r)),i&&await $(this.gitService.resetGitSetting(`diff.renameLimit`,i)),await wv.getInstance().setCompletion({repositoryPath:this.repositoryPath,branch:this.branch},await this.db.getLatestCommitHash()),this.invalidateTimeInterval(),this.setAnalyzationStatus(`CommitHistoryProcessed`)}};function Zv(e,t,n,r,i){I.debug(`exec ${e} $ ${t} ${n.join(` `)}`);let a=Error(`Command failed: `+t+` `+n.join(` `));return new Promise((o,s)=>{let l=c.resolve(e),u=ee(t,n,{cwd:l}),d=[],f=[];u.on(`error`,e=>{a.message+=`\nFailed to start process: ${e.message}`,s(a)}),u.stdout.on(`data`,e=>{d.push(e),r&&i!==void 0&&r.updateProgress(i)}),u.stderr.on(`data`,e=>f.push(e)),u.on(`close`,e=>{let r=Buffer.concat(d).toString().trim(),i=Buffer.concat(f).toString().trim();if(e===0){o(r);return}a.message=`Command failed: ${t} ${n.join(` `)}\ncwd: ${l}\n\n${i||`Exited with code ${e}`}`,s(a)})})}function Qv(e){let t=[];for(let n=0;n<e;n++){let r=`${` `.repeat(e-n-1)}🚛\n`;t.push(r)}return t}function $v(){return fi()===null?(0,$r.createSpinner)(``,{interval:1e3/20,frames:Qv(20)}):null}let ey=null;async function ty({job:e=async()=>null,beforeMsg:t=``,afterMsg:n=``,errorMsg:r=``,ms:i=null}){ey=$v();let a=(e,t=!1)=>{if(fi()!==ri.SILENT){if(ey===null)return I.info(e);ey.success({text:e}),t||ey.start()}},o=e=>{ey?(ey.update({text:e,frames:Qv(e.length)}),ey.start()):I.info(e)},s=e=>ey===null?I.error(e):ey.error({text:e.message});t.length>0&&o(t);try{let t=ne.now(),r=await e(),o=ne.now();return a(`${n} ${Qr.default.gray(`${av(i||o-t)}`)}`,!0),[r,null]}catch(e){let t=Error(r,{cause:e});return s(t),[null,t]}}let ny=null;async function ry(){if(!ny){I.info(`Fetching latest version from npm registry...`);let[e]=await $(fetch(`https://registry.npmjs.org/-/package/git-truck/dist-tags`).then(e=>e.json()).then(e=>e.latest));ny=e}return ny}const iy=e=>oy(c.dirname(e)),ay=e=>{let t=c.resolve(e);return c.basename(t)||t};function oy(e){return ov(c.resolve(e))}var sy=class{static CACHE_FOLDER=i(t.tmpdir(),`git-truck-cache`);static instancesSingleton=new Map;static mutex=new Sv;static getInstanceIsAborted({repositoryPath:e,branch:t}){let n=this.instancesSingleton.get(e)?.get(t);return n?n.status===`Aborted`:!1}static async abortInstance({repositoryPath:e,branch:t}){try{var n=Cv();n.u(await this.mutex.withDisposable());let r=this.instancesSingleton.get(e)?.get(t);if(r){let n=r.abort();return await this.closeInstance({repositoryPath:e,branch:t}),n!==`CommitHistoryProcessed`&&await this.clearCache({repositoryPath:e,branch:t}),!0}return!1}catch(e){n.e=e}finally{n.d()}}static getInstanceProgress({repositoryPath:e,branch:t}){let n=this.instancesSingleton.get(e)?.get(t);return n?{status:n.status,totalCommitCount:n.totalCommitCount,progress:n.progress,progressPercentage:this.calculateProgressPercentage(n.progress,n.totalCommitCount),progressRevision:n.progressRevision}:null}static calculateProgressPercentage(e,t){return t>0?Math.min(e.reduce((e,t)=>e+t,0)/t*100,100):0}static async getInstance({repositoryPath:e,branch:t}){try{var n=Cv();return n.u(await this.mutex.withDisposable()),await this.getOrCreateInstanceUnlocked({repositoryPath:e,branch:t})}catch(e){n.e=e}finally{n.d()}}static async getOrCreateInstanceUnlocked({repositoryPath:e,branch:t}){this.instancesSingleton||=new Map;let n=this.instancesSingleton.get(e)?.get(t);if(n&&n.status!==`Aborted`)return n;let r=new Xv({db:await this.initOrRecreateDatabase({repositoryPath:e,branch:t}),gitService:new lv({repositoryPath:e,branch:t}),repositoryPath:e,branch:t}),i=this.instancesSingleton.get(e);return i?i.set(t,r):this.instancesSingleton.set(e,new Map([[t,r]])),r}static async closeInstance({repositoryPath:e,branch:t}){let n=this.instancesSingleton.get(e)?.get(t);n&&(this.instancesSingleton.get(e)?.delete(t),this.instancesSingleton.get(e)?.size===0&&this.instancesSingleton.delete(e),await n.db.close())}static async clearAllCaches(){try{var e=Cv();e.u(await this.mutex.withDisposable()),await this.closeAllDBInstancesUnlocked(),await this.clearAllCachesUnlocked(),await wv.resetInstance()}catch(t){e.e=t}finally{e.d()}}static async closeAllDBInstances(){try{var e=Cv();e.u(await this.mutex.withDisposable()),await this.closeAllDBInstancesUnlocked()}catch(t){e.e=t}finally{e.d()}}static async closeAllDBInstancesUnlocked(){let e=Array.from(this.instancesSingleton.values()).flatMap(e=>Array.from(e.values()).flatMap(e=>(e.abort(),e.db.close())));await Promise.all(e),this.instancesSingleton=new Map}static getDBPath({repositoryPath:e,branch:t}){let n=encodeURIComponent(e),r=encodeURIComponent(t);return i(this.CACHE_FOLDER,n,`${r}.db`)}static async clearAllCachesUnlocked(){h(this.CACHE_FOLDER)&&await j.rm(this.CACHE_FOLDER,{recursive:!0,force:!0})}static async clearCache({repositoryPath:e,branch:t}){let n=this.getDBPath({repositoryPath:e,branch:t});await Promise.allSettled([j.rm(n,{force:!0}),j.rm(`${n}.wal`,{force:!0})]);let i=r(n);(await j.readdir(i).catch(()=>[])).length===0&&await j.rmdir(i).catch(()=>{})}static async initDuckDBInstance(e){let t=r(e);return h(t)||await j.mkdir(t,{recursive:!0}),await re.create(e,{temp_directory:t})}static async initOrRecreateDatabase({repositoryPath:e,branch:t}){let n=this.getDBPath({repositoryPath:e,branch:t}),r=await this.initDuckDBInstance(n),i=await r.connect(),a=(await i.runAndReadAll(`SHOW TABLES`)).getRowObjects(),o=a.length===0,s=a.some(e=>e.name===`metadata`)?(await i.runAndReadAll(`SELECT stringValue FROM metadata WHERE field = 'version';`).catch(()=>{}))?.getRowObjects()[0]?.stringValue?.toString()??null:null;s&&I.debug(`Found existing database with git-truck version ${s}`);let c=s?(0,la.diff)(s,Un)===`major`:!0;if(a.length>0&&c){I.warn(`Database at path ${n} is stale (db: ${s}, installed: ${Un}), resetting...`),await this.closeInstance({repositoryPath:e,branch:t}),i.closeSync(),r.closeSync(),await this.clearCache({repositoryPath:e,branch:t}),r=await this.initDuckDBInstance(n),i=await r.connect(),I.info(`Database reset complete. Verifying...`);let a=(await i.runAndReadAll(`SHOW TABLES`)).getRowObjects();if(a.length>0)throw Error(`Failed to clear stale database, tables still exist after clearing: ${JSON.stringify(a)}`);I.info(`Done clearing stale database!`),o=!0}else I.info(`Database at path ${n} is up to date`);let l=await new sv({instance:r,connection:i}).init();return o&&(await this.insertGitTruckVersion(i),await this.insertCommonIgnoredFiles(l)),l}static async insertGitTruckVersion(e){if((await(await e.run(`SELECT stringValue FROM metadata WHERE field = 'version';`)).getRowObjects()).length>0)throw Error(`DB has already been populated with version metadata`);await e.run(`INSERT INTO metadata (field, stringValue) VALUES ('version', '${Un}');`)}static async insertCommonIgnoredFiles(e){await e.addHiddenFile(`package-lock.json`),await e.addHiddenFile(`bun.lock`),await e.addHiddenFile(`bun.lockb`),await e.addHiddenFile(`yarn.lock`)}};const cy=ti();cy.help&&(console.log(ni()),process.exit(0)),console.log(`Git Truck version ${Un}${await _y()}\n`),cy.version&&process.exit(0);const ly=n.dirname(o(import.meta.url)),uy=n.join(ly,`build/server/index.js`),dy=n.join(ly,`build/client`),fy=n.join(ly,`build/client/assets`);let py;const my=process.env.PORT?Number.parseInt(process.env.PORT,10):NaN;Number.isInteger(my)&&my>=1&&my<=65535?py=my:(process.env.PORT&&I.warn(`Invalid PORT environment variable "${process.env.PORT}". Falling back to an available port.`),py=await $n({port:[...er(3e3,4e3)]}));const hy=(0,Hn.default)();hy.use(`/assets`,Hn.static(fy,{immutable:!0,maxAge:`1y`})),hy.use(Hn.static(dy,{maxAge:`1h`})),hy.use(await import(s(uy).href).then(e=>e.app));const gy=process.env.HOST?hy.listen(py,process.env.HOST,yy):hy.listen(py,yy);process.once(`SIGTERM`,vy),process.once(`SIGINT`,vy),process.on(`unhandledRejection`,e=>{let t=Error(`Unhandled Rejection`,{cause:e instanceof Error?e:void 0});console.error(`UNHANDLED:`,t)});async function _y(){let[e]=await $(ry());return e?tv(e,Un)===1?Un.startsWith(`0.0.0`)?` (experimental build)`:` [!] Update available: ${e}
|
|
850
1068
|
|
|
851
1069
|
To update, run:
|
|
852
1070
|
npm install -g git-truck@latest
|
|
@@ -854,4 +1072,4 @@ npm install -g git-truck@latest
|
|
|
854
1072
|
See what's changed here:
|
|
855
1073
|
${nv({currentVersion:Un,latestVersion:e})}
|
|
856
1074
|
|
|
857
|
-
`:` (latest)`:` (offline)`}async function
|
|
1075
|
+
`:` (latest)`:` (offline)`}async function vy(){let e=sy.closeAllDBInstances();I.info(`Shutting down server`),gy.close(console.error),I.info(`Web server shut down`),await ty({job:()=>e,beforeMsg:`Stopping Git Truck...`,afterMsg:`Successfully stopped Git Truck`,errorMsg:`Failed to stop Git Truck`}),process.exit(0)}async function yy(){let e=`http://localhost:${py}`,t=new URL(process.env.PORTLESS_URL||e);t.searchParams.set(`path`,cy.path),t.pathname=await lv.isValidGitRepo(oy(cy.path))?`/view`:`/browse`,cy.headless,console.log(`Application available at ${t}`),cy.headless||(I.debug(`Opening ${t.toString()}`),await ty({job:()=>Ur(t.toString()),beforeMsg:`Opening Git Truck in your browser`,afterMsg:`Opened Git Truck in your browser`,errorMsg:`Failed to open Git Truck in your browser. To continue, open this link manually:\n\n${t}\n`}))}export{};
|