jsrepo 3.0.0 → 3.0.1
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/dist/api/config.js +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/langs/index.js +1 -1
- package/dist/api/langs/js.js +1 -1
- package/dist/api/outputs.js +1 -1
- package/dist/api/providers.js +1 -1
- package/dist/api/utils.js +1 -1
- package/dist/bin.js +3 -3
- package/dist/{providers-rXkLWOba.js → providers-BD5Z5zBT.js} +2 -2
- package/package.json +1 -1
package/dist/api/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../errors-C_rb7vZB.js";import{M as e,N as t,P as n}from"../providers-
|
|
1
|
+
import"../errors-C_rb7vZB.js";import{M as e,N as t,P as n}from"../providers-BD5Z5zBT.js";export{t as OptionallyInstalledRegistryTypes,n as defineConfig,e as loadConfigSearch};
|
package/dist/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,D as r,E as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,V as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,k as E,l as D,m as O,n as k,o as A,p as j,r as M,s as N,t as P,u as F,v as I,w as L,x as R,y as z,z as B}from"../errors-C_rb7vZB.js";import{C as V,F as H,H as U,I as W,J as G,L as K,M as q,N as J,P as Y,R as X,S as Z,T as Q,X as $,_ as ee,a as te,b as ne,c as re,d as ie,f as ae,g as oe,i as se,it as ce,l as le,m as ue,n as de,o as fe,p as pe,s as me,t as he,u as ge,v as _e,x as ve,y as ye,z as be}from"../providers-
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,V as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,k as E,l as D,m as O,n as k,o as A,p as j,r as M,s as N,t as P,u as F,v as I,w as L,x as R,y as z,z as B}from"../errors-C_rb7vZB.js";import{C as V,F as H,H as U,I as W,J as G,L as K,M as q,N as J,P as Y,R as X,S as Z,T as Q,X as $,_ as ee,a as te,b as ne,c as re,d as ie,f as ae,g as oe,i as se,it as ce,l as le,m as ue,n as de,o as fe,p as pe,s as me,t as he,u as ge,v as _e,x as ve,y as ye,z as be}from"../providers-BD5Z5zBT.js";export{P as AlreadyInitializedError,k as BuildError,M as ConfigNotFoundError,w as ConfigObjectNotFoundError,_ as CouldNotFindJsrepoImportError,H as DEFAULT_LANGS,he as DEFAULT_PROVIDERS,A as DuplicateFileReferenceError,N as DuplicateItemNameError,y as FailedToLoadConfigError,D as FileNotFoundError,F as IllegalBlockNameError,b as ImportedFileNotResolvedError,x as InvalidDependencyError,j as InvalidJSONError,O as InvalidKeyTypeError,C as InvalidOptionsError,S as InvalidPluginError,g as InvalidRegistryDependencyError,I as InvalidRegistryError,z as InvalidRegistryNameError,v as InvalidRegistryVersionError,R as JsrepoError,p as ManifestFetchError,ie as ManifestSchema,n as MissingPeerDependencyError,L as ModuleNotFoundError,m as MultipleRegistriesError,i as NoFilesError,r as NoItemsToUpdateError,u as NoListedItemsError,E as NoOutputsError,e as NoPackageJsonFoundError,T as NoPathProvidedError,c as NoProviderFoundError,l as NoRegistriesError,J as OptionallyInstalledRegistryTypes,d as ProviderFetchError,a as RegistryFileFetchError,o as RegistryItemFetchError,s as RegistryItemNotFoundError,f as RegistryNotProvidedError,B as SelfReferenceError,t as Unreachable,h as ZodError,ge as azure,le as bitbucket,be as css,Y as defineConfig,Q as distributed,pe as fetchAllResolvedItems,de as fetchManifest,re as fs,ue as getPathsForItems,me as github,fe as gitlab,X as html,te as http,ce as joinAbsolute,U as js,se as jsrepo,q as loadConfigSearch,oe as normalizeItemTypeForPath,ee as parseWantedItems,_e as prepareUpdates,G as promptAddEnvVars,$ as promptInstallDependenciesByEcosystem,ae as repository,ye as resolveAndFetchAllItems,ne as resolveRegistries,ve as resolveTree,Z as resolveWantedItems,K as svelte,V as updateFiles,W as vue};
|
package/dist/api/langs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-C_rb7vZB.js";import{F as e,H as t,I as n,L as r,R as i,z as a}from"../../providers-
|
|
1
|
+
import"../../errors-C_rb7vZB.js";import{F as e,H as t,I as n,L as r,R as i,z as a}from"../../providers-BD5Z5zBT.js";export{e as DEFAULT_LANGS,a as css,i as html,t as js,r as svelte,n as vue};
|
package/dist/api/langs/js.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-C_rb7vZB.js";import{B as e,H as t,U as n,V as r,W as i}from"../../providers-
|
|
1
|
+
import"../../errors-C_rb7vZB.js";import{B as e,H as t,U as n,V as r,W as i}from"../../providers-BD5Z5zBT.js";export{e as getImports,r as installDependencies,t as js,n as resolveImports,i as transformImports};
|
package/dist/api/outputs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../errors-C_rb7vZB.js";import{T as e,d as t,f as n}from"../providers-
|
|
1
|
+
import"../errors-C_rb7vZB.js";import{T as e,d as t,f as n}from"../providers-BD5Z5zBT.js";export{t as ManifestSchema,e as distributed,n as repository};
|
package/dist/api/providers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../errors-C_rb7vZB.js";import{a as e,c as t,i as n,l as r,n as i,o as a,s as o,t as s,u as c}from"../providers-
|
|
1
|
+
import"../errors-C_rb7vZB.js";import{a as e,c as t,i as n,l as r,n as i,o as a,s as o,t as s,u as c}from"../providers-BD5Z5zBT.js";export{s as DEFAULT_PROVIDERS,c as azure,r as bitbucket,i as fetchManifest,t as fs,o as github,a as gitlab,e as http,n as jsrepo};
|
package/dist/api/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../errors-C_rb7vZB.js";import{C as e,J as t,S as n,X as r,_ as i,b as a,g as o,it as s,m as c,p as l,v as u,x as d,y as f}from"../providers-
|
|
1
|
+
import"../errors-C_rb7vZB.js";import{C as e,J as t,S as n,X as r,_ as i,b as a,g as o,it as s,m as c,p as l,v as u,x as d,y as f}from"../providers-BD5Z5zBT.js";export{l as fetchAllResolvedItems,c as getPathsForItems,s as joinAbsolute,o as normalizeItemTypeForPath,i as parseWantedItems,u as prepareUpdates,t as promptAddEnvVars,r as promptInstallDependenciesByEcosystem,f as resolveAndFetchAllItems,a as resolveRegistries,d as resolveTree,n as resolveWantedItems,e as updateFiles};
|
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{A as e,D as t,G as n,H as r,M as i,N as a,R as o,U as s,W as c,a as l,b as u,g as d,h as f,i as p,k as m,m as h,r as g,t as _,v,x as y,y as b}from"./errors-C_rb7vZB.js";import{$ as x,A as S,At as C,B as w,C as ee,Ct as te,D as ne,Dt as re,E as ie,Et as T,G as E,J as D,K as O,M as k,Mt as ae,Nt as oe,O as se,Ot as ce,Q as le,S as ue,St as de,Tt as A,X as fe,Y as pe,Z as me,_ as j,_t as he,at as ge,b as _e,bt as ve,ct as ye,dt as M,et as be,ft as xe,g as Se,gt as Ce,h as we,ht as Te,it as Ee,j as De,jt as Oe,k as ke,kt as Ae,lt as je,m as Me,mt as Ne,nt as Pe,ot as Fe,pt as Ie,q as Le,r as Re,rt as N,st as ze,t as Be,tt as Ve,ut as He,v as Ue,vt as We,w as Ge,wt as Ke,xt as qe,y as Je,yt as Ye}from"./providers-
|
|
2
|
+
import{A as e,D as t,G as n,H as r,M as i,N as a,R as o,U as s,W as c,a as l,b as u,g as d,h as f,i as p,k as m,m as h,r as g,t as _,v,x as y,y as b}from"./errors-C_rb7vZB.js";import{$ as x,A as S,At as C,B as w,C as ee,Ct as te,D as ne,Dt as re,E as ie,Et as T,G as E,J as D,K as O,M as k,Mt as ae,Nt as oe,O as se,Ot as ce,Q as le,S as ue,St as de,Tt as A,X as fe,Y as pe,Z as me,_ as j,_t as he,at as ge,b as _e,bt as ve,ct as ye,dt as M,et as be,ft as xe,g as Se,gt as Ce,h as we,ht as Te,it as Ee,j as De,jt as Oe,k as ke,kt as Ae,lt as je,m as Me,mt as Ne,nt as Pe,ot as Fe,pt as Ie,q as Le,r as Re,rt as N,st as ze,t as Be,tt as Ve,ut as He,v as Ue,vt as We,w as Ge,wt as Ke,xt as qe,y as Je,yt as Ye}from"./providers-BD5Z5zBT.js";import{t as Xe}from"./magic-string.es-BweEsiXU.js";import{Command as Ze,Option as Qe,program as $e}from"commander";import{watch as et}from"node:fs";import{Visitor as tt,parseAsync as nt}from"oxc-parser";import rt from"node:os";import{buffer as it}from"node:stream/consumers";import{createGzip as at}from"node:zlib";var ot=n(We(),1),st=n(r(),1);const ct=Ie({cwd:Te().transform(e=>e)}),P={yes:new Qe(`--yes`,`Skip the confirmation prompt.`).default(!1),noCache:new Qe(`--no-cache`,`Disable caching of resolved git urls.`).default(!1),verbose:new Qe(`--verbose`,`Include debug logs.`).default(!1),overwrite:new Qe(`--overwrite`,`Overwrite files without prompting.`).default(!1),expand:new Qe(`-E, --expand`,`Expands the diff so you see the entire file.`).default(!1),maxUnchanged:new Qe(`--max-unchanged <lines>`,`Maximum unchanged lines that will show without being collapsed.`).argParser(e=>Number.parseInt(e,10)).default(5),cwd:new Qe(`--cwd <path>`,`The current working directory.`).default(process.cwd())};function lt(e,t){return Fe(e,t).match(e=>e,e=>dt(new f(e.zodError)))}async function ut(e){try{let t=await e;return t.isErr()?dt(t.error):t.value}catch(e){e instanceof y&&dt(e),dt(new y(e instanceof Error?e.message:String(e),{suggestion:`Please try again.`}))}}function dt(e){return ft(e)}function ft(e){Ke.message(),process.env.JSREPO_TRACE===`1`?(console.trace(e),process.exit(1)):(T(st.default.red(e.toString())),process.exit(1))}async function pt(e,t,n){if(Array.isArray(e.registry)){let r=[];for(let i of e.registry)r.push(await t(await ye(i,n)));return r}else return[await t(await ye(e.registry,n))]}function mt(e){return Array.isArray(e.registry)?e.registry.length>0:!0}var ht=class{withinExportDefaultDeclaration=!1;withinDefineConfig=!1;withinMainObjectExpression=!1;withinIgnoredProperty=!1;configKeyPropertyDeclaration=null;mainObjectExpression=null};async function gt(e,{config:t}){if(Object.keys(e).length===0)return(0,ot.ok)(t.code);let n=await nt(t.path,t.code),r=new Xe(t.code),i=new ht;if(i.withinDefineConfig=!0,new tt({ExportDefaultDeclaration(){i.withinExportDefaultDeclaration=!0},"ExportDefaultDeclaration:exit"(){i.withinExportDefaultDeclaration=!1},ObjectExpression(e){i.withinExportDefaultDeclaration&&i.withinDefineConfig&&(i.withinIgnoredProperty||(i.withinMainObjectExpression||=(i.mainObjectExpression=e,!0)))},CallExpression(e){i.withinExportDefaultDeclaration&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(i.withinDefineConfig=!0)},"CallExpression:exit"(e){i.withinDefineConfig&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(i.withinDefineConfig=!1,i.withinMainObjectExpression=!1)},Property(e){if(i.withinDefineConfig&&i.withinMainObjectExpression&&!i.withinIgnoredProperty){if(e.key.type===`Identifier`&&e.key.name!==`paths`){i.withinIgnoredProperty=!0;return}if(e.key.type===`Identifier`&&(e.kind===`init`||e.kind===`get`)&&e.key.name===`paths`){if(e.value.type!==`ObjectExpression`)return(0,ot.err)(new h({key:`paths`,type:`object`}));i.configKeyPropertyDeclaration=e}}},"Property:exit"(e){if(i.withinDefineConfig&&e.key.type===`Identifier`&&e.key.name!==`paths`){i.withinIgnoredProperty=!1;return}}}).visit(n.program),i.configKeyPropertyDeclaration!==null){if(i.configKeyPropertyDeclaration.value.type!==`ObjectExpression`)return(0,ot.err)(new h({key:`paths`,type:`object`}));let t=new Map;for(let n of i.configKeyPropertyDeclaration.value.properties)if(n.type===`Property`&&(n.key.type===`Literal`||n.key.type===`Identifier`)){let i=r.slice(n.key.start,n.key.end).replaceAll(/['"]/g,``);e[i]!==void 0&&t.set(i,n)}let n=r.slice(i.configKeyPropertyDeclaration.value.start,i.configKeyPropertyDeclaration.value.end);if(i.configKeyPropertyDeclaration.value.properties.length===0)r.overwrite(i.configKeyPropertyDeclaration.value.start,i.configKeyPropertyDeclaration.value.end,`{\n${Object.entries(e).map(([e,t])=>`\t\t${S.test(e)?e:`'${e}'`}: '${t}'`).join(`,
|
|
3
3
|
`)}\n\t}`);else{let a=i.configKeyPropertyDeclaration.value.properties[i.configKeyPropertyDeclaration.value.properties.length-1],o=n.lastIndexOf(`,`),s=o===-1?-1:o+i.configKeyPropertyDeclaration.value.start+1,c=!1;c=!(s!==-1&&s>a.end);for(let[n,i]of Object.entries(e)){let a=t.get(n);a!==void 0&&(r.overwrite(a.value.start,a.value.end,`'${i}'`),delete e[n])}Object.keys(e).length>0&&r.appendRight(c?a.end:s,`${c?`,`:``}\n${Object.entries(e).map(([e,t])=>`\t\t${S.test(e)?e:`'${e}'`}: '${t}'`).join(`,
|
|
4
4
|
`)}`)}}else{if(i.mainObjectExpression===null)return(0,ot.err)(new p);let t=r.slice(i.mainObjectExpression.start,i.mainObjectExpression.end).lastIndexOf(`,`),n=t===-1?-1:t+i.mainObjectExpression.start+1;if(i.mainObjectExpression.properties.length===0)r.appendRight(i.mainObjectExpression.start+1,`\n\tpaths: {\n${Object.entries(e).map(([e,t])=>`\t\t${S.test(e)?e:`'${e}'`}: '${t}'`).join(`,
|
|
5
5
|
`)}\n\t}`);else{let t=i.mainObjectExpression.properties[i.mainObjectExpression.properties.length-1],a=!1;a=!(n!==-1&&n>t.end),r.appendRight(a?t.end:n,`${a?`,`:``}\n\tpaths: {\n${Object.entries(e).map(([e,t])=>`\t\t${S.test(e)?e:`'${e}'`}: '${t}'`).join(`,
|
|
@@ -355,13 +355,13 @@ var e=function(e,t){var n,r,i=1,a=0,o=0,s=String.alphabet;function c(e,t,r){if(r
|
|
|
355
355
|
`).slice(a+1).join(`
|
|
356
356
|
`)}`;try{Object.defineProperty(n,`stack`,{value:o})}catch{}return n}function re(){class e extends h{constructor(t,n,r,i,a,o,s){arguments.length===0?super(e.clock.now):super(...arguments),Object.defineProperty(this,`constructor`,{value:h,enumerable:!1})}static[Symbol.hasInstance](e){return e instanceof h}}return e.isFake=!0,h.now&&(e.now=function(){return e.clock.now}),h.toSource&&(e.toSource=function(){return h.toSource()}),e.toString=function(){return h.toString()},new Proxy(e,{apply(){if(this instanceof e)throw TypeError("A Proxy should only capture `new` calls with the `construct` handler. This is not supposed to be possible, so check the logic.");return new h(e.clock.now).toString()}})}function ie(){let e={};return Object.getOwnPropertyNames(g).forEach(t=>e[t]=g[t]),e.DateTimeFormat=function(...t){let n=new g.DateTimeFormat(...t),r={};return[`formatRange`,`formatRangeToParts`,`resolvedOptions`].forEach(e=>{r[e]=n[e].bind(n)}),[`format`,`formatToParts`].forEach(t=>{r[t]=function(r){return n[t](r||e.clock.now)}}),r},e.DateTimeFormat.prototype=Object.create(g.DateTimeFormat.prototype),e.DateTimeFormat.supportedLocalesOf=g.DateTimeFormat.supportedLocalesOf,e}function T(e,t){e.jobs||=[],e.jobs.push(t)}function E(e){if(e.jobs){for(let t=0;t<e.jobs.length;t++){let n=e.jobs[t];if(n.func.apply(null,n.args),x(e,t),e.loopLimit&&t>e.loopLimit)throw ne(e,n)}S(),e.jobs=[]}}function D(e,t){if(t.func===void 0)throw Error(`Callback must be provided to timer calls`);if(d&&typeof t.func!=`function`)throw TypeError(`[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${t.func} of type ${typeof t.func}`);if(b&&(t.error=Error()),t.type=t.immediate?`Immediate`:`Timeout`,t.hasOwnProperty(`delay`)&&(typeof t.delay!=`number`&&(t.delay=parseInt(t.delay,10)),y(t.delay)||(t.delay=0),t.delay=t.delay>a?1:t.delay,t.delay=Math.max(0,t.delay)),t.hasOwnProperty(`interval`)&&(t.type=`Interval`,t.interval=t.interval>a?1:t.interval),t.hasOwnProperty(`animation`)&&(t.type=`AnimationFrame`,t.animation=!0),t.hasOwnProperty(`idleCallback`)&&(t.type=`IdleCallback`,t.idleCallback=!0),e.timers||={},t.id=_++,t.createdAt=e.now,t.callAt=e.now+(parseInt(t.delay)||(e.duringTick?1:0)),e.timers[t.id]=t,d){let n={refed:!0,ref:function(){return this.refed=!0,n},unref:function(){return this.refed=!1,n},hasRef:function(){return this.refed},refresh:function(){return t.callAt=e.now+(parseInt(t.delay)||(e.duringTick?1:0)),e.timers[t.id]=t,n},[Symbol.toPrimitive]:function(){return t.id}};return n}return t.id}function O(e,t){if(e.callAt<t.callAt)return-1;if(e.callAt>t.callAt)return 1;if(e.immediate&&!t.immediate)return-1;if(!e.immediate&&t.immediate)return 1;if(e.createdAt<t.createdAt)return-1;if(e.createdAt>t.createdAt)return 1;if(e.id<t.id)return-1;if(e.id>t.id)return 1}function k(e,t,n){let r=e.timers,i=null,a,o;for(a in r)r.hasOwnProperty(a)&&(o=te(t,n,r[a]),o&&(!i||O(i,r[a])===1)&&(i=r[a]));return i}function ae(e){let t=e.timers,n=null,r;for(r in t)t.hasOwnProperty(r)&&(!n||O(n,t[r])===1)&&(n=t[r]);return n}function oe(e){let t=e.timers,n=null,r;for(r in t)t.hasOwnProperty(r)&&(!n||O(n,t[r])===-1)&&(n=t[r]);return n}function se(e,t){if(typeof t.interval==`number`?e.timers[t.id].callAt+=t.interval:delete e.timers[t.id],typeof t.func==`function`)t.func.apply(null,t.args);else{let e=eval;(function(){e(t.func)})()}}function ce(e){return e===`IdleCallback`||e===`AnimationFrame`?`cancel${e}`:`clear${e}`}function le(e){return e===`IdleCallback`||e===`AnimationFrame`?`request${e}`:`set${e}`}function ue(){let e=0;return function(t){!e++&&console.warn(t)}}let de=ue();function A(e,t,n){if(!t)return;e.timers||={};let r=Number(t);if(Number.isNaN(r)||r<o){let r=ce(n);if(e.shouldClearNativeTimers===!0){let n=e[`_${r}`];return typeof n==`function`?n(t):void 0}de(`FakeTimers: ${r} was invoked to clear a native timer instead of one created by this library.
|
|
357
357
|
To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`)}if(e.timers.hasOwnProperty(r)){let t=e.timers[r];if(t.type===n||t.type===`Timeout`&&n===`Interval`||t.type===`Interval`&&n===`Timeout`)delete e.timers[r];else{let e=ce(n),r=le(t.type);throw Error(`Cannot clear timer: timer created with ${r}() but cleared with ${e}()`)}}}function fe(e,r){let a,o,s;for(o=0,s=e.methods.length;o<s;o++){if(a=e.methods[o],a===`hrtime`&&i.process)i.process.hrtime=e._hrtime;else if(a===`nextTick`&&i.process)i.process.nextTick=e._nextTick;else if(a===`performance`){let t=Object.getOwnPropertyDescriptor(e,`_${a}`);t&&t.get&&!t.set?Object.defineProperty(i,a,t):t.configurable&&(i[a]=e[`_${a}`])}else if(i[a]&&i[a].hadOwnProperty)i[a]=e[`_${a}`];else try{delete i[a]}catch{}if(e.timersModuleMethods!==void 0)for(let n=0;n<e.timersModuleMethods.length;n++){let r=e.timersModuleMethods[n];t[r.methodName]=r.original}if(e.timersPromisesModuleMethods!==void 0)for(let t=0;t<e.timersPromisesModuleMethods.length;t++){let r=e.timersPromisesModuleMethods[t];n[r.methodName]=r.original}}r.shouldAdvanceTime===!0&&i.clearInterval(e.attachedInterval),e.methods=[];for(let[t,n]of e.abortListenerMap.entries())n.removeEventListener(`abort`,t),e.abortListenerMap.delete(t);return e.timers?Object.keys(e.timers).map(function(t){return e.timers[t]}):[]}function pe(e,t,n){if(n[t].hadOwnProperty=Object.prototype.hasOwnProperty.call(e,t),n[`_${t}`]=e[t],t===`Date`)e[t]=n[t];else if(t===`Intl`)e[t]=n[t];else if(t===`performance`){let r=Object.getOwnPropertyDescriptor(e,t);if(r&&r.get&&!r.set){Object.defineProperty(n,`_${t}`,r);let i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i)}else e[t]=n[t]}else e[t]=function(){return n[t].apply(n,arguments)},Object.defineProperties(e[t],Object.getOwnPropertyDescriptors(n[t]));e[t].clock=n}function me(e,t){e.tick(t)}let j={setTimeout:i.setTimeout,clearTimeout:i.clearTimeout,setInterval:i.setInterval,clearInterval:i.clearInterval,Date:i.Date};l.setImmediate&&(j.setImmediate=i.setImmediate),l.clearImmediate&&(j.clearImmediate=i.clearImmediate),l.hrtime&&(j.hrtime=i.process.hrtime),l.nextTick&&(j.nextTick=i.process.nextTick),l.performance&&(j.performance=i.performance),l.requestAnimationFrame&&(j.requestAnimationFrame=i.requestAnimationFrame),l.queueMicrotask&&(j.queueMicrotask=i.queueMicrotask),l.cancelAnimationFrame&&(j.cancelAnimationFrame=i.cancelAnimationFrame),l.requestIdleCallback&&(j.requestIdleCallback=i.requestIdleCallback),l.cancelIdleCallback&&(j.cancelIdleCallback=i.cancelIdleCallback),l.Intl&&(j.Intl=g);let he=i.setImmediate||i.setTimeout;function ge(e,t){e=Math.floor(ee(e)),t||=1e3;let n=0,r=[0,0],a={now:e,Date:re(),loopLimit:t};a.Date.clock=a;function o(){return 16-(a.now-e)%16}function s(t){let i=a.now-r[0]-e,o=Math.floor(i/1e3),s=(i-o*1e3)*1e6+n-r[1];if(Array.isArray(t)){if(t[1]>1e9)throw TypeError(`Number of nanoseconds can't exceed a billion`);let e=t[0],n=s-t[1],r=o-e;return n<0&&(n+=1e9,--r),[r,n]}return[o,s]}function c(){let e=s();return e[0]*1e3+e[1]/1e6}l.hrtimeBigint&&(s.bigint=function(){let e=s();return BigInt(e[0])*BigInt(1e9)+BigInt(e[1])}),l.Intl&&(a.Intl=ie(),a.Intl.clock=a),a.requestIdleCallback=function(e,t){let n=0;a.countTimers()>0&&(n=50);let r=D(a,{func:e,args:Array.prototype.slice.call(arguments,2),delay:t===void 0?n:Math.min(t,n),idleCallback:!0});return Number(r)},a.cancelIdleCallback=function(e){return A(a,e,`IdleCallback`)},a.setTimeout=function(e,t){return D(a,{func:e,args:Array.prototype.slice.call(arguments,2),delay:t})},i.Promise!==void 0&&f&&(a.setTimeout[f.custom]=function(e,t){return new i.Promise(function(n){D(a,{func:n,args:[t],delay:e})})}),a.clearTimeout=function(e){return A(a,e,`Timeout`)},a.nextTick=function(e){return T(a,{func:e,args:Array.prototype.slice.call(arguments,1),error:b?Error():null})},a.queueMicrotask=function(e){return a.nextTick(e)},a.setInterval=function(e,t){return t=parseInt(t,10),D(a,{func:e,args:Array.prototype.slice.call(arguments,2),delay:t,interval:t})},a.clearInterval=function(e){return A(a,e,`Interval`)},l.setImmediate&&(a.setImmediate=function(e){return D(a,{func:e,args:Array.prototype.slice.call(arguments,1),immediate:!0})},i.Promise!==void 0&&f&&(a.setImmediate[f.custom]=function(e){return new i.Promise(function(t){D(a,{func:t,args:[e],immediate:!0})})}),a.clearImmediate=function(e){return A(a,e,`Immediate`)}),a.countTimers=function(){return Object.keys(a.timers||{}).length+(a.jobs||[]).length},a.requestAnimationFrame=function(e){let t=D(a,{func:e,delay:o(),get args(){return[c()]},animation:!0});return Number(t)},a.cancelAnimationFrame=function(e){return A(a,e,`AnimationFrame`)},a.runMicrotasks=function(){E(a)};function u(e,t,r,i){let o=typeof e==`number`?e:C(e),s=Math.floor(o),c=w(o),l=n+c,u=a.now+s;if(o<0)throw TypeError(`Negative ticks are not supported`);l>=1e6&&(u+=1,l-=1e6),n=l;let d=a.now,f=a.now,p,m,h,g,_,v;a.duringTick=!0,h=a.now,E(a),h!==a.now&&(d+=a.now-h,u+=a.now-h);function y(){for(p=k(a,d,u);p&&d<=u;){if(a.timers[p.id]){d=p.callAt,a.now=p.callAt,h=a.now;try{E(a),se(a,p)}catch(e){m||=e}if(t){he(g);return}_()}v()}if(h=a.now,E(a),h!==a.now&&(d+=a.now-h,u+=a.now-h),a.duringTick=!1,p=k(a,d,u),p)try{a.tick(u-a.now)}catch(e){m||=e}else a.now=u,n=l;if(m)throw m;if(t)r(a.now);else return a.now}return g=t&&function(){try{_(),v(),y()}catch(e){i(e)}},_=function(){h!==a.now&&(d+=a.now-h,u+=a.now-h,f+=a.now-h)},v=function(){p=k(a,f,u),f=d},y()}return a.tick=function(e){return u(e,!1)},i.Promise!==void 0&&(a.tickAsync=function(e){return new i.Promise(function(t,n){he(function(){try{u(e,!0,t,n)}catch(e){n(e)}})})}),a.next=function(){E(a);let e=ae(a);if(!e)return a.now;a.duringTick=!0;try{return a.now=e.callAt,se(a,e),E(a),a.now}finally{a.duringTick=!1}},i.Promise!==void 0&&(a.nextAsync=function(){return new i.Promise(function(e,t){he(function(){try{let n=ae(a);if(!n){e(a.now);return}let r;a.duringTick=!0,a.now=n.callAt;try{se(a,n)}catch(e){r=e}a.duringTick=!1,he(function(){r?t(r):e(a.now)})}catch(e){t(e)}})})}),a.runAll=function(){let e,t;for(E(a),t=0;t<a.loopLimit;t++){if(!a.timers||(e=Object.keys(a.timers).length,e===0))return S(),a.now;a.next(),x(a,t)}throw ne(a,ae(a))},a.runToFrame=function(){return a.tick(o())},i.Promise!==void 0&&(a.runAllAsync=function(){return new i.Promise(function(e,t){let n=0;function r(){he(function(){try{E(a);let i;if(n<a.loopLimit){if(!a.timers){S(),e(a.now);return}if(i=Object.keys(a.timers).length,i===0){S(),e(a.now);return}a.next(),n++,r(),x(a,n);return}t(ne(a,ae(a)))}catch(e){t(e)}})}r()})}),a.runToLast=function(){let e=oe(a);return e?a.tick(e.callAt-a.now):(E(a),a.now)},i.Promise!==void 0&&(a.runToLastAsync=function(){return new i.Promise(function(e,t){he(function(){try{let t=oe(a);t||(E(a),e(a.now)),e(a.tickAsync(t.callAt-a.now))}catch(e){t(e)}})})}),a.reset=function(){n=0,a.timers={},a.jobs=[],a.now=e},a.setSystemTime=function(e){let t=ee(e),i=t-a.now,o,s;for(o in r[0]+=i,r[1]+=n,a.now=t,n=0,a.timers)a.timers.hasOwnProperty(o)&&(s=a.timers[o],s.createdAt+=i,s.callAt+=i)},a.jump=function(e){let t=typeof e==`number`?e:C(e),n=Math.floor(t);for(let e of Object.values(a.timers))a.now+n>e.callAt&&(e.callAt=a.now+n);a.tick(n)},l.performance&&(a.performance=Object.create(null),a.performance.now=c),l.hrtime&&(a.hrtime=s),a}function _e(r){if(arguments.length>1||r instanceof Date||Array.isArray(r)||typeof r==`number`)throw TypeError(`FakeTimers.install called with ${String(r)} install requires an object parameter`);if(i.Date.isFake===!0)throw TypeError(`Can't install fake timers twice on the same global object.`);if(r=r===void 0?{}:r,r.shouldAdvanceTime=r.shouldAdvanceTime||!1,r.advanceTimeDelta=r.advanceTimeDelta||20,r.shouldClearNativeTimers=r.shouldClearNativeTimers||!1,r.target)throw TypeError("config.target is no longer supported. Use `withGlobal(target)` instead.");function a(e){if(!r.ignoreMissingTimers)throw ReferenceError(`non-existent timers and/or objects cannot be faked: '${e}'`)}let o,u,d=ge(r.now,r.loopLimit);if(d.shouldClearNativeTimers=r.shouldClearNativeTimers,d.uninstall=function(){return fe(d,r)},d.abortListenerMap=new Map,d.methods=r.toFake||[],d.methods.length===0&&(d.methods=Object.keys(j)),r.shouldAdvanceTime===!0){let e=me.bind(null,d,r.advanceTimeDelta);d.attachedInterval=i.setInterval(e,r.advanceTimeDelta)}if(d.methods.includes(`performance`)){let e=(()=>{if(m)return i.performance.constructor.prototype;if(p)return i.Performance.prototype})();if(e)Object.getOwnPropertyNames(e).forEach(function(e){e!==`now`&&(d.performance[e]=e.indexOf(`getEntries`)===0?c:s)}),d.performance.mark=e=>new v(e,`mark`,0,0),d.performance.measure=e=>new v(e,`measure`,0,100),d.performance.timeOrigin=ee(r.now);else if((r.toFake||[]).includes(`performance`))return a(`performance`)}for(i===e&&t&&(d.timersModuleMethods=[]),i===e&&n&&(d.timersPromisesModuleMethods=[]),o=0,u=d.methods.length;o<u;o++){let e=d.methods[o];if(!l[e]){a(e);continue}if(e===`hrtime`?i.process&&typeof i.process.hrtime==`function`&&pe(i.process,e,d):e===`nextTick`?i.process&&typeof i.process.nextTick==`function`&&pe(i.process,e,d):pe(i,e,d),d.timersModuleMethods!==void 0&&t[e]){let n=t[e];d.timersModuleMethods.push({methodName:e,original:n}),t[e]=i[e]}d.timersPromisesModuleMethods!==void 0&&(e===`setTimeout`?(d.timersPromisesModuleMethods.push({methodName:`setTimeout`,original:n.setTimeout}),n.setTimeout=(e,t,n={})=>new Promise((r,i)=>{let a=()=>{n.signal.removeEventListener(`abort`,a),d.abortListenerMap.delete(a),d.clearTimeout(o),i(n.signal.reason)},o=d.setTimeout(()=>{n.signal&&(n.signal.removeEventListener(`abort`,a),d.abortListenerMap.delete(a)),r(t)},e);n.signal&&(n.signal.aborted?a():(n.signal.addEventListener(`abort`,a),d.abortListenerMap.set(a,n.signal)))})):e===`setImmediate`?(d.timersPromisesModuleMethods.push({methodName:`setImmediate`,original:n.setImmediate}),n.setImmediate=(e,t={})=>new Promise((n,r)=>{let i=()=>{t.signal.removeEventListener(`abort`,i),d.abortListenerMap.delete(i),d.clearImmediate(a),r(t.signal.reason)},a=d.setImmediate(()=>{t.signal&&(t.signal.removeEventListener(`abort`,i),d.abortListenerMap.delete(i)),n(e)});t.signal&&(t.signal.aborted?i():(t.signal.addEventListener(`abort`,i),d.abortListenerMap.set(i,t.signal)))})):e===`setInterval`&&(d.timersPromisesModuleMethods.push({methodName:`setInterval`,original:n.setInterval}),n.setInterval=(e,t,n={})=>({[Symbol.asyncIterator]:()=>{let r=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},i=!1,a=!1,o,s=0,c=[],l=d.setInterval(()=>{c.length>0?c.shift().resolve():s++},e),u=()=>{n.signal.removeEventListener(`abort`,u),d.abortListenerMap.delete(u),d.clearInterval(l),i=!0;for(let e of c)e.resolve()};return n.signal&&(n.signal.aborted?i=!0:(n.signal.addEventListener(`abort`,u),d.abortListenerMap.set(u,n.signal))),{next:async()=>{if(n.signal?.aborted&&!a)throw a=!0,n.signal.reason;if(i)return{done:!0,value:void 0};if(s>0)return s--,{done:!1,value:t};let e=r();if(c.push(e),await e,o&&c.length===0&&o.resolve(),n.signal?.aborted&&!a)throw a=!0,n.signal.reason;return i?{done:!0,value:void 0}:{done:!1,value:t}},return:async()=>i?{done:!0,value:void 0}:(c.length>0&&(o=r(),await o),d.clearInterval(l),i=!0,n.signal&&(n.signal.removeEventListener(`abort`,u),d.abortListenerMap.delete(u)),{done:!0,value:void 0})}}})))}return d}return{timers:j,createClock:ge,install:_e,withGlobal:r}}let i=r(e);return lh.timers=i.timers,lh.createClock=i.createClock,lh.install=i.install,lh.withGlobal=r,lh}var yg=vg(),bg=class{_global;_clock;_fakingTime;_fakingDate;_fakeTimers;_userConfig;_now=qm.now;constructor({global:e,config:t}){this._userConfig=t,this._fakingDate=null,this._fakingTime=!1,this._fakeTimers=yg.withGlobal(e),this._global=e}clearAllTimers(){this._fakingTime&&this._clock.reset()}dispose(){this.useRealTimers()}runAllTimers(){this._checkFakeTimers()&&this._clock.runAll()}async runAllTimersAsync(){this._checkFakeTimers()&&await this._clock.runAllAsync()}runOnlyPendingTimers(){this._checkFakeTimers()&&this._clock.runToLast()}async runOnlyPendingTimersAsync(){this._checkFakeTimers()&&await this._clock.runToLastAsync()}advanceTimersToNextTimer(e=1){if(this._checkFakeTimers())for(let t=e;t>0&&(this._clock.next(),this._clock.tick(0),this._clock.countTimers()!==0);t--);}async advanceTimersToNextTimerAsync(e=1){if(this._checkFakeTimers())for(let t=e;t>0&&(await this._clock.nextAsync(),this._clock.tick(0),this._clock.countTimers()!==0);t--);}advanceTimersByTime(e){this._checkFakeTimers()&&this._clock.tick(e)}async advanceTimersByTimeAsync(e){this._checkFakeTimers()&&await this._clock.tickAsync(e)}advanceTimersToNextFrame(){this._checkFakeTimers()&&this._clock.runToFrame()}runAllTicks(){this._checkFakeTimers()&&this._clock.runMicrotasks()}useRealTimers(){this._fakingDate&&=(Zm(),null),this._fakingTime&&=(this._clock.uninstall(),!1)}useFakeTimers(){let e=this._fakingDate||Date.now();this._fakingDate&&=(Zm(),null),this._fakingTime&&this._clock.uninstall();let t=Object.keys(this._fakeTimers.timers).filter(e=>e!==`nextTick`&&e!==`queueMicrotask`);if(this._userConfig?.toFake?.includes(`nextTick`)&&np())throw Error(`process.nextTick cannot be mocked inside child_process`);this._clock=this._fakeTimers.install({now:e,...this._userConfig,toFake:this._userConfig?.toFake||t,ignoreMissingTimers:!0}),this._fakingTime=!0}reset(){if(this._checkFakeTimers()){let{now:e}=this._clock;this._clock.reset(),this._clock.setSystemTime(e)}}setSystemTime(e){let t=e===void 0||e instanceof Date?e:new Date(e);this._fakingTime?this._clock.setSystemTime(t):(this._fakingDate=t??new Date(this.getRealSystemTime()),Xm(this._fakingDate))}getMockedSystemTime(){return this._fakingTime?new Date(this._clock.now):this._fakingDate}getRealSystemTime(){return this._now()}getTimerCount(){return this._checkFakeTimers()?this._clock.countTimers():0}configure(e){this._userConfig=e}isFakeTimers(){return this._fakingTime}_checkFakeTimers(){if(!this._fakingTime)throw Error("A function to advance timers was called but the timers APIs are not mocked. Call `vi.useFakeTimers()` in the test file first.");return this._fakingTime}};function xg(e,t){return t.stack!==void 0&&(e.stack=t.stack.replace(t.message,e.message)),e}function Sg(e,t={}){let{setTimeout:n,setInterval:r,clearTimeout:i,clearInterval:a}=Sd(),{interval:o=50,timeout:s=1e3}=typeof t==`number`?{timeout:t}:t,c=Error(`STACK_TRACE_ERROR`);return new Promise((t,l)=>{let u,d=`idle`,f,p,m=e=>{f&&i(f),p&&a(p),t(e)},h=()=>{p&&a(p);let e=u;e||=xg(Error(`Timed out in waitFor!`),c),l(e)},g=()=>{if(Tg.isFakeTimers()&&Tg.advanceTimersByTime(o),d!==`pending`)try{let t=e();if(typeof t==`object`&&t&&typeof t.then==`function`){let e=t;d=`pending`,e.then(e=>{d=`resolved`,m(e)},e=>{d=`rejected`,u=e})}else return m(t),!0}catch(e){u=e}};g()!==!0&&(f=n(h,s),p=r(g,o))})}function Cg(e,t={}){let{setTimeout:n,setInterval:r,clearTimeout:i,clearInterval:a}=Sd(),{interval:o=50,timeout:s=1e3}=typeof t==`number`?{timeout:t}:t,c=Error(`STACK_TRACE_ERROR`);return new Promise((t,l)=>{let u=`idle`,d,f,p=e=>{f&&a(f),e||=xg(Error(`Timed out in waitUntil!`),c),l(e)},m=e=>{if(e)return d&&i(d),f&&a(f),t(e),!0},h=()=>{if(Tg.isFakeTimers()&&Tg.advanceTimersByTime(o),u!==`pending`)try{let t=e();if(typeof t==`object`&&t&&typeof t.then==`function`){let e=t;u=`pending`,e.then(e=>{u=`resolved`,m(e)},e=>{u=`rejected`,p(e)})}else return m(t)}catch(e){p(e)}};h()!==!0&&(d=n(p,s),f=r(h,o))})}function wg(){let e=null,t=()=>tp(),n,r=()=>n||=new bg({global:globalThis,config:t().config.fakeTimers}),i=new Map,a=new Map,o=[`PROD`,`DEV`,`SSR`],s={useFakeTimers(e){if(np()&&(e?.toFake?.includes(`nextTick`)||t().config?.fakeTimers?.toFake?.includes(`nextTick`)))throw Error(`vi.useFakeTimers({ toFake: ["nextTick"] }) is not supported in node:child_process. Use --pool=threads if mocking nextTick is required.`);return e?r().configure({...t().config.fakeTimers,...e}):r().configure(t().config.fakeTimers),r().useFakeTimers(),s},isFakeTimers(){return r().isFakeTimers()},useRealTimers(){return r().useRealTimers(),s},runOnlyPendingTimers(){return r().runOnlyPendingTimers(),s},async runOnlyPendingTimersAsync(){return await r().runOnlyPendingTimersAsync(),s},runAllTimers(){return r().runAllTimers(),s},async runAllTimersAsync(){return await r().runAllTimersAsync(),s},runAllTicks(){return r().runAllTicks(),s},advanceTimersByTime(e){return r().advanceTimersByTime(e),s},async advanceTimersByTimeAsync(e){return await r().advanceTimersByTimeAsync(e),s},advanceTimersToNextTimer(){return r().advanceTimersToNextTimer(),s},async advanceTimersToNextTimerAsync(){return await r().advanceTimersToNextTimerAsync(),s},advanceTimersToNextFrame(){return r().advanceTimersToNextFrame(),s},getTimerCount(){return r().getTimerCount()},setSystemTime(e){return r().setSystemTime(e),s},getMockedSystemTime(){return r().getMockedSystemTime()},getRealSystemTime(){return r().getRealSystemTime()},clearAllTimers(){return r().clearAllTimers(),s},spyOn:Oo,fn:Do,waitFor:Sg,waitUntil:Cg,hoisted(e){return Bi(e,`"vi.hoisted" factory`,[`function`]),e()},mock(e,t){if(typeof e!=`string`)throw TypeError(`vi.mock() expects a string path, but received a ${typeof e}`);let n=Dg(`mock`);Eg().queueMock(e,n,typeof t==`function`?()=>t(()=>Eg().importActual(e,n,Eg().getMockContext().callstack)):t)},unmock(e){if(typeof e!=`string`)throw TypeError(`vi.unmock() expects a string path, but received a ${typeof e}`);Eg().queueUnmock(e,Dg(`unmock`))},doMock(e,t){if(typeof e!=`string`)throw TypeError(`vi.doMock() expects a string path, but received a ${typeof e}`);let n=Dg(`doMock`);Eg().queueMock(e,n,typeof t==`function`?()=>t(()=>Eg().importActual(e,n,Eg().getMockContext().callstack)):t)},doUnmock(e){if(typeof e!=`string`)throw TypeError(`vi.doUnmock() expects a string path, but received a ${typeof e}`);let t=Dg(`doUnmock`);Eg().queueUnmock(e,t)},async importActual(e){let t=Dg(`importActual`);return Eg().importActual(e,t,Eg().getMockContext().callstack)},async importMock(e){let t=Dg(`importMock`);return Eg().importMock(e,t)},mockObject(e,t){return Eg().mockObject({value:e},void 0,t?.spy?`autospy`:`automock`).value},mocked(e,t={}){return e},isMockFunction(e){return So(e)},clearAllMocks(){return Go(),s},resetAllMocks(){return Ko(),s},restoreAllMocks(){return Wo(),s},stubGlobal(e,t){return i.has(e)||i.set(e,Object.getOwnPropertyDescriptor(globalThis,e)),Object.defineProperty(globalThis,e,{value:t,writable:!0,configurable:!0,enumerable:!0}),s},stubEnv(e,n){let r=t().metaEnv;return a.has(e)||a.set(e,r[e]),o.includes(e)?r[e]=n?`1`:``:n===void 0?delete r[e]:r[e]=String(n),s},unstubAllGlobals(){return i.forEach((e,t)=>{e?Object.defineProperty(globalThis,t,e):Reflect.deleteProperty(globalThis,t)}),i.clear(),s},unstubAllEnvs(){let e=t().metaEnv;return a.forEach((t,n)=>{t===void 0?delete e[n]:e[n]=t}),a.clear(),s},resetModules(){return rp(t().evaluatedModules),s},async dynamicImportSettled(){return ap()},setConfig(n){e||={...t().config},Object.assign(t().config,n)},resetConfig(){e&&Object.assign(t().config,e)}};return s}const Tg=wg();function Eg(){return typeof __vitest_mocker__<`u`?__vitest_mocker__:new Proxy({},{get(e,t){throw Error(`Vitest mocker was not initialized in this environment. vi.${String(t)}() is forbidden.`)}})}function Dg(e){let t=zi({stackTraceLimit:5}).split(`
|
|
358
|
-
`);return Ld(t[t.findLastIndex(t=>t.includes(` at Object.${e}`)||t.includes(`${e}@`))+1])?.file||``}function Og(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`-`){n++,n<=e.length-1&&(t+=e[n].toUpperCase());continue}t+=e[n].toLocaleLowerCase()}return t}var kg=n(We(),1),Ag=class{IGNORED_PROPERTIES=[`registry`,`registries`,`paths`];importDeclarations=[];withinExportDefaultDeclaration=!1;withinDefineConfig=!1;withinMainObjectExpression=!1;withinIgnoredProperty=!1;lastImportDeclaration=null;configKeyPropertyDeclaration=null;mainObjectExpression=null};async function jg({plugins:e,key:t,config:n}){if(e.length===0)return(0,kg.ok)(n.code);let r=await nt(n.path,n.code),i=new Xe(n.code),a=new Ag;if(a.withinDefineConfig=!0,new tt({ImportDeclaration(e){a.withinDefineConfig&&(a.lastImportDeclaration=e,a.importDeclarations.push(e))},ExportDefaultDeclaration(){a.withinExportDefaultDeclaration=!0},"ExportDefaultDeclaration:exit"(){a.withinExportDefaultDeclaration=!1},ObjectExpression(e){a.withinExportDefaultDeclaration&&a.withinDefineConfig&&(a.withinIgnoredProperty||(a.withinMainObjectExpression||=(a.mainObjectExpression=e,!0)))},CallExpression(e){a.withinExportDefaultDeclaration&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(a.withinDefineConfig=!0)},"CallExpression:exit"(e){a.withinDefineConfig&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(a.withinDefineConfig=!1,a.withinMainObjectExpression=!1)},Property(e){if(a.withinDefineConfig&&a.withinMainObjectExpression&&!a.withinIgnoredProperty){if(a.IGNORED_PROPERTIES.includes(e.key.type===`Identifier`?e.key.name:``)){a.withinIgnoredProperty=!0;return}if(e.key.type===`Identifier`&&(e.kind===`init`||e.kind===`get`)&&e.key.name===t){if(e.value.type!==`ArrayExpression`)return(0,kg.err)(new h({key:t,type:`array`}));a.configKeyPropertyDeclaration=e}}},"Property:exit"(e){if(a.withinDefineConfig&&a.IGNORED_PROPERTIES.includes(e.key.type===`Identifier`?e.key.name:``)){a.withinIgnoredProperty=!1;return}}}).visit(r.program),e=e.filter(e=>!a.importDeclarations.some(t=>t.source.value===e.packageName)),e.length===0)return(0,kg.ok)(n.code);a.lastImportDeclaration!==null&&i.appendRight(a.lastImportDeclaration.end,e.map(e=>`\nimport ${e.name} from '${e.packageName}';`).join(``));let o=null;t===`providers`?o=`DEFAULT_PROVIDERS`:t===`languages`&&(o=`DEFAULT_LANGS`);let s=a.importDeclarations.find(e=>e.source.value===`jsrepo`);if(s===void 0)return(0,kg.err)(new l);let c=o?{added:!1,name:o}:null;if(c!==null){for(let e of s.specifiers)if(e.type===`ImportSpecifier`&&e.imported.type===`Identifier`&&e.imported.name===o){c.added=!0,e.local.name!==o&&(c.name=e.local.name);break}}if(a.configKeyPropertyDeclaration!==null){if(a.configKeyPropertyDeclaration.value.type!==`ArrayExpression`)return(0,kg.err)(new h({key:t,type:`array`}));let n=i.slice(a.configKeyPropertyDeclaration.value.start,a.configKeyPropertyDeclaration.value.end).lastIndexOf(`,`),r=n===-1?-1:n+a.configKeyPropertyDeclaration.value.start+1;if(a.configKeyPropertyDeclaration.value.elements.length===0)c=null,i.appendRight(a.configKeyPropertyDeclaration.value.start+1,`${e.map(e=>`${e.name}()`).join(`, `)}`);else{let t=a.configKeyPropertyDeclaration.value.elements[a.configKeyPropertyDeclaration.value.elements.length-1],n=!1;n=!(r!==-1&&r>t.end),c=null,i.appendRight(n?t.end:r,`${n?`,`:``} ${e.map(e=>`${e.name}()`).join(`, `)}`)}}else{if(a.mainObjectExpression===null)return(0,kg.err)(new p);let n=i.slice(a.mainObjectExpression.start,a.mainObjectExpression.end).lastIndexOf(`,`),r=n===-1?-1:n+a.mainObjectExpression.start+1;if(a.mainObjectExpression.properties.length===0)i.appendRight(a.mainObjectExpression.start+1,`\n\t${t}: [${c?`...${c.name}, `:``}${e.map(e=>`${e.name}()`).join(`, `)}]`);else{let n=a.mainObjectExpression.properties[a.mainObjectExpression.properties.length-1],o=!1;o=!(r!==-1&&r>n.end),i.appendRight(o?n.end:r,`${o?`,`:``}\n\t${t}: [${c?`...${c.name}, `:``}${e.map(e=>`${e.name}()`).join(`, `)}]`)}if(c&&!c.added){let e=i.slice(s.start,s.end).lastIndexOf(`,`),t=e===-1?-1:e+s.start+1,n=s.specifiers[s.specifiers.length-1],r=!1;r=!(t!==-1&&t>n.end),i.appendRight(t&&n.end,`${r?`,`:``} ${c.name}`)}}return(0,kg.ok)(i.toString())}async function Mg({plugins:e,config:t}){let n=Tg.fn(),r=await w(t.code,{fileName:t.path,warn:n});return e.filter(e=>!r.includes(e.package))}const Ng=[{shorthand:`prettier`,name:`@jsrepo/transform-prettier`},{shorthand:`biome`,name:`@jsrepo/transform-biome`},{shorthand:`javascript`,name:`@jsrepo/transform-javascript`}];function Pg(e,t){let n=e.map(e=>Fg(e,t)),r=[];for(let e of n){if(e.isErr())return(0,kg.err)(e.error);r.push(e.value)}return(0,kg.ok)(r)}function Fg(e,t){let n=Ng.find(t=>t.shorthand===e);if(n){let e=Fg(n.name,t);return e.isErr()?(0,kg.err)(e.error):(0,kg.ok)({name:e.value.name,packageName:n.name,version:void 0})}let r=me(e);if(r.isErr())return(0,kg.err)(new d(e));let i=r.value.name;return r.value.name.startsWith(`@`)&&(i=r.value.name.startsWith(`@jsrepo/`)?r.value.name.split(`/`)[1]?.includes(t)?`jsrepo-${r.value.name.split(`/`)[1]}`:`jsrepo-${t}-${r.value.name.split(`/`)[1]}`:r.value.name.split(`/`)[1]),(0,kg.ok)({name:Og(i.replace(`jsrepo-${t}-`,``)),packageName:r.value.name,version:r.value.version})}var Ig=n(We(),1),Lg=n(r(),1);const Rg=ct.extend({yes:M()}),zg=new Ze(`language`).description(`Add a language to your config.`).argument(`[languages...]`,`Names of the languages you want to add to your config. ex: (jsrepo-language-go, jsrepo-language-rust)`).addOption(P.cwd).addOption(P.yes).action(async(e,t)=>{let n=lt(Rg,t);O();let r=await k({cwd:n.cwd,promptForContinueIfNull:!n.yes});r||dt(new g(n.cwd)),A(Vg(await ut(Bg(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r))))});async function Bg(e,t,n){let r=performance.now(),i=Pg(e,`language`);if(i.isErr())return(0,Ig.err)(i.error);let a=i.value,o=Pe(n.path);if(o.isErr())return(0,Ig.err)(o.error);let s=o.value,c=await jg({plugins:a,key:`languages`,config:{path:n.path,code:s}});if(c.isErr())return(0,Ig.err)(c.error);let l=c.value,u=N(n.path,l);return u.isErr()?(0,Ig.err)(u.error):(await pe({devDependencies:a,dependencies:[]},{options:t,configPath:n.path}),(0,Ig.ok)({duration:performance.now()-r,languages:e.length}))}function Vg({duration:e,languages:t}){return`Added ${Lg.default.green(t.toString())} ${t>1?`languages`:`language`} in ${Lg.default.green(`${e.toFixed(2)}ms`)}.`}var Hg=n(We(),1),Ug=n(r(),1);const Wg=[`cursor`,`claude`,`vscode`,`codex`,`antigravity`],Gg=ct.extend({client:He(je(Wg)).optional(),all:M().optional()}),Kg=new Ze(`mcp`).description(`Configure the jsrepo MCP server for your environment.`).addOption(new Qe(`--client <clients...>`,`The MCP client(s) to configure`).choices(Wg)).option(`--all`,`Configure all supported MCP clients`,!1).addOption(P.cwd).action(async e=>{let t=lt(Gg,e);O(),A(Jg({...await ut(qg(t)),cwd:t.cwd}))});async function qg(e){let t;if(e.all)t=Object.keys(i_);else if(e.client&&e.client.length>0)t=e.client;else{let e=await te({message:`Which clients would you like to configure?`,options:Object.entries(i_).map(([e,t])=>({value:e,label:t.name}))});C(e)&&(T(`Canceled!`),process.exit(0)),t=e}let n=performance.now(),r=[];for(let n of t){let t=i_[n],i=t.filePath(e.cwd),a=t.writeConfig(i);r.push({name:t.name,result:a.isErr()?(0,Hg.err)(a.error):(0,Hg.ok)({filePath:i})})}return(0,Hg.ok)({duration:performance.now()-n,results:r})}function Jg({duration:e,results:t,cwd:n}){return`Configured ${t.length} ${t.length>1?`clients`:`client`} in ${Ug.default.green(`${e.toFixed(2)}ms`)}:\n${t.map(e=>Yg(e,n)).join(`
|
|
358
|
+
`);return Ld(t[t.findLastIndex(t=>t.includes(` at Object.${e}`)||t.includes(`${e}@`))+1])?.file||``}function Og(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`-`){n++,n<=e.length-1&&(t+=e[n].toUpperCase());continue}t+=e[n].toLocaleLowerCase()}return t}var kg=n(We(),1),Ag=class{IGNORED_PROPERTIES=[`registry`,`registries`,`paths`];importDeclarations=[];withinExportDefaultDeclaration=!1;withinDefineConfig=!1;withinMainObjectExpression=!1;withinIgnoredProperty=!1;lastImportDeclaration=null;configKeyPropertyDeclaration=null;mainObjectExpression=null};async function jg({plugins:e,key:t,config:n}){if(e.length===0)return(0,kg.ok)(n.code);let r=await nt(n.path,n.code),i=new Xe(n.code),a=new Ag;if(a.withinDefineConfig=!0,new tt({ImportDeclaration(e){a.withinDefineConfig&&(a.lastImportDeclaration=e,a.importDeclarations.push(e))},ExportDefaultDeclaration(){a.withinExportDefaultDeclaration=!0},"ExportDefaultDeclaration:exit"(){a.withinExportDefaultDeclaration=!1},ObjectExpression(e){a.withinExportDefaultDeclaration&&a.withinDefineConfig&&(a.withinIgnoredProperty||(a.withinMainObjectExpression||=(a.mainObjectExpression=e,!0)))},CallExpression(e){a.withinExportDefaultDeclaration&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(a.withinDefineConfig=!0)},"CallExpression:exit"(e){a.withinDefineConfig&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(a.withinDefineConfig=!1,a.withinMainObjectExpression=!1)},Property(e){if(a.withinDefineConfig&&a.withinMainObjectExpression&&!a.withinIgnoredProperty){if(a.IGNORED_PROPERTIES.includes(e.key.type===`Identifier`?e.key.name:``)){a.withinIgnoredProperty=!0;return}if(e.key.type===`Identifier`&&(e.kind===`init`||e.kind===`get`)&&e.key.name===t){if(e.value.type!==`ArrayExpression`)return(0,kg.err)(new h({key:t,type:`array`}));a.configKeyPropertyDeclaration=e}}},"Property:exit"(e){if(a.withinDefineConfig&&a.IGNORED_PROPERTIES.includes(e.key.type===`Identifier`?e.key.name:``)){a.withinIgnoredProperty=!1;return}}}).visit(r.program),e=e.filter(e=>!a.importDeclarations.some(t=>t.source.value===e.packageName)),e.length===0)return(0,kg.ok)(n.code);a.lastImportDeclaration!==null&&i.appendRight(a.lastImportDeclaration.end,e.map(e=>`\nimport ${e.name} from '${e.packageName}';`).join(``));let o=null;t===`providers`?o=`DEFAULT_PROVIDERS`:t===`languages`&&(o=`DEFAULT_LANGS`);let s=a.importDeclarations.find(e=>e.source.value===`jsrepo`);if(s===void 0)return(0,kg.err)(new l);let c=o?{added:!1,name:o}:null;if(c!==null){for(let e of s.specifiers)if(e.type===`ImportSpecifier`&&e.imported.type===`Identifier`&&e.imported.name===o){c.added=!0,e.local.name!==o&&(c.name=e.local.name);break}}if(a.configKeyPropertyDeclaration!==null){if(a.configKeyPropertyDeclaration.value.type!==`ArrayExpression`)return(0,kg.err)(new h({key:t,type:`array`}));let n=i.slice(a.configKeyPropertyDeclaration.value.start,a.configKeyPropertyDeclaration.value.end).lastIndexOf(`,`),r=n===-1?-1:n+a.configKeyPropertyDeclaration.value.start+1;if(a.configKeyPropertyDeclaration.value.elements.length===0)c=null,i.appendRight(a.configKeyPropertyDeclaration.value.start+1,`${e.map(e=>`${e.name}()`).join(`, `)}`);else{let t=a.configKeyPropertyDeclaration.value.elements[a.configKeyPropertyDeclaration.value.elements.length-1],n=!1;n=!(r!==-1&&r>t.end),c=null,i.appendRight(n?t.end:r,`${n?`,`:``} ${e.map(e=>`${e.name}()`).join(`, `)}`)}}else{if(a.mainObjectExpression===null)return(0,kg.err)(new p);let n=i.slice(a.mainObjectExpression.start,a.mainObjectExpression.end).lastIndexOf(`,`),r=n===-1?-1:n+a.mainObjectExpression.start+1;if(a.mainObjectExpression.properties.length===0)i.appendRight(a.mainObjectExpression.start+1,`\n\t${t}: [${c?`...${c.name}, `:``}${e.map(e=>`${e.name}()`).join(`, `)}]`);else{let n=a.mainObjectExpression.properties[a.mainObjectExpression.properties.length-1],o=!1;o=!(r!==-1&&r>n.end),i.appendRight(o?n.end:r,`${o?`,`:``}\n\t${t}: [${c?`...${c.name}, `:``}${e.map(e=>`${e.name}()`).join(`, `)}]`)}if(c&&!c.added){let e=i.slice(s.start,s.end).lastIndexOf(`,`),t=e===-1?-1:e+s.start+1,n=s.specifiers[s.specifiers.length-1],r=!1;r=!(t!==-1&&t>n.end),i.appendRight(t&&n.end,`${r?`,`:``} ${c.name}`)}}return(0,kg.ok)(i.toString())}async function Mg({plugins:e,config:t}){let n=Tg.fn(),r=await w(t.code,{fileName:t.path,warn:n});return e.filter(e=>!r.includes(e.package))}const Ng=[{shorthand:`prettier`,name:`@jsrepo/transform-prettier`},{shorthand:`biome`,name:`@jsrepo/transform-biome`},{shorthand:`javascript`,name:`@jsrepo/transform-javascript`}];function Pg(e,t){let n=e.map(e=>Fg(e,t)),r=[];for(let e of n){if(e.isErr())return(0,kg.err)(e.error);r.push(e.value)}return(0,kg.ok)(r)}function Fg(e,t){let n=Ng.find(t=>t.shorthand===e);if(n){let e=Fg(n.name,t);return e.isErr()?(0,kg.err)(e.error):(0,kg.ok)({name:e.value.name,packageName:n.name,version:void 0})}let r=me(e);if(r.isErr())return(0,kg.err)(new d(e));let i=r.value.name;return r.value.name.startsWith(`@`)&&(i=r.value.name.startsWith(`@jsrepo/`)?r.value.name.split(`/`)[1]?.includes(t)?`jsrepo-${r.value.name.split(`/`)[1]}`:`jsrepo-${t}-${r.value.name.split(`/`)[1]}`:r.value.name.split(`/`)[1]),(0,kg.ok)({name:Og(i.replace(`jsrepo-${t}-`,``)),packageName:r.value.name,version:r.value.version})}var Ig=n(We(),1),Lg=n(r(),1);const Rg=ct.extend({yes:M()}),zg=new Ze(`language`).description(`Add a language to your config.`).argument(`[languages...]`,`Names of the languages you want to add to your config. ex: (jsrepo-language-go, jsrepo-language-rust)`).addOption(P.cwd).addOption(P.yes).action(async(e,t)=>{let n=lt(Rg,t);O();let r=await k({cwd:n.cwd,promptForContinueIfNull:!n.yes});r||dt(new g(n.cwd)),A(Vg(await ut(Bg(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r))))});async function Bg(e,t,n){let r=performance.now(),i=Pg(e,`language`);if(i.isErr())return(0,Ig.err)(i.error);let a=i.value,o=Pe(n.path);if(o.isErr())return(0,Ig.err)(o.error);let s=o.value,c=await jg({plugins:a,key:`languages`,config:{path:n.path,code:s}});if(c.isErr())return(0,Ig.err)(c.error);let l=c.value,u=N(n.path,l);return u.isErr()?(0,Ig.err)(u.error):(await pe({devDependencies:a.map(e=>({name:e.packageName,version:e.version})),dependencies:[]},{options:t,configPath:n.path}),(0,Ig.ok)({duration:performance.now()-r,languages:e.length}))}function Vg({duration:e,languages:t}){return`Added ${Lg.default.green(t.toString())} ${t>1?`languages`:`language`} in ${Lg.default.green(`${e.toFixed(2)}ms`)}.`}var Hg=n(We(),1),Ug=n(r(),1);const Wg=[`cursor`,`claude`,`vscode`,`codex`,`antigravity`],Gg=ct.extend({client:He(je(Wg)).optional(),all:M().optional()}),Kg=new Ze(`mcp`).description(`Configure the jsrepo MCP server for your environment.`).addOption(new Qe(`--client <clients...>`,`The MCP client(s) to configure`).choices(Wg)).option(`--all`,`Configure all supported MCP clients`,!1).addOption(P.cwd).action(async e=>{let t=lt(Gg,e);O(),A(Jg({...await ut(qg(t)),cwd:t.cwd}))});async function qg(e){let t;if(e.all)t=Object.keys(i_);else if(e.client&&e.client.length>0)t=e.client;else{let e=await te({message:`Which clients would you like to configure?`,options:Object.entries(i_).map(([e,t])=>({value:e,label:t.name}))});C(e)&&(T(`Canceled!`),process.exit(0)),t=e}let n=performance.now(),r=[];for(let n of t){let t=i_[n],i=t.filePath(e.cwd),a=t.writeConfig(i);r.push({name:t.name,result:a.isErr()?(0,Hg.err)(a.error):(0,Hg.ok)({filePath:i})})}return(0,Hg.ok)({duration:performance.now()-n,results:r})}function Jg({duration:e,results:t,cwd:n}){return`Configured ${t.length} ${t.length>1?`clients`:`client`} in ${Ug.default.green(`${e.toFixed(2)}ms`)}:\n${t.map(e=>Yg(e,n)).join(`
|
|
359
359
|
`)}`}function Yg({name:e,result:t},n){if(t.isErr())return` ${Ug.default.cyan(e)}: ${Ug.default.red(t.error.message)}`;let{filePath:r}=t.value;return` ${Ug.default.cyan(e)} → ${Ug.default.dim(Ce.relative(n,r))}`}function Xg(e,t){try{return N(e,t),(0,Hg.ok)(void 0)}catch(t){return(0,Hg.err)(new y(`Failed to write config to ${e}: ${t instanceof Error?t.message:String(t)}`,{suggestion:`Please try again.`}))}}const Zg={command:`npx`,args:[`@jsrepo/mcp`]},Qg=`[mcp_servers.jsrepo]
|
|
360
360
|
command = "npx"
|
|
361
361
|
args = ["@jsrepo/mcp"]
|
|
362
362
|
`;function $g(e){return e?e.includes(`[mcp_servers.jsrepo]`)?e:(e.endsWith(`
|
|
363
363
|
`)||(e+=`
|
|
364
|
-
`),`${e}${Qg}`):Qg}const e_=Ie({command:Te(),args:He(Te()),env:Ne(Te(),Te()).optional()});Ie({mcpServers:Ne(Te(),e_)});const t_=Ie({servers:Ne(Te(),e_)});function n_({existingContent:e,serverName:t,serverConfig:n}){if(e.trim().length===0)return(0,Hg.ok)(ie({servers:{[t]:n}},{format:!0}));let r=ge(t_,e);return r.isErr()?(0,Hg.err)(new y(`Failed to parse MCP server config: ${r.error.message}`,{suggestion:`Please try again.`})):(0,Hg.ok)(ie({servers:{...r.value.servers,[t]:n}},{format:!0}))}function r_(e,t){let n=n_({existingContent:Ve(e)?Pe(e)._unsafeUnwrap():``,serverName:`jsrepo`,serverConfig:t});return n.isErr()?(0,Hg.err)(n.error):Xg(e,n.value)}const i_={cursor:{name:`Cursor`,filePath:e=>Ee(e,`.cursor/mcp.json`),writeConfig:e=>r_(e,Zg)},claude:{name:`Claude Code`,filePath:e=>Ee(e,`.mcp.json`),writeConfig:e=>r_(e,Zg)},vscode:{name:`VS Code`,filePath:e=>Ee(e,`.vscode/mcp.json`),writeConfig:e=>r_(e,Zg)},codex:{name:`Codex`,filePath:()=>Ee(rt.homedir(),`.codex/config.toml`),writeConfig:e=>Xg(e,$g(Ve(e)?Pe(e)._unsafeUnwrap():``))},antigravity:{name:`Antigravity`,filePath:()=>Ee(rt.homedir(),`.gemini/antigravity/mcp_config.json`),writeConfig:e=>r_(e,Zg)}};var a_=n(We(),1),o_=n(r(),1);const s_=ct.extend({yes:M()}),c_=new Ze(`provider`).description(`Add a provider to your config.`).argument(`[providers...]`,`Names of the providers you want to add to your config. ex: (jsrepo-provider-jsr, jsrepo-provider-npm)`).addOption(P.cwd).addOption(P.yes).action(async(e,t)=>{let n=lt(s_,t);O();let r=await k({cwd:n.cwd,promptForContinueIfNull:!n.yes});r||dt(new g(n.cwd)),A(u_(await ut(l_(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r))))});async function l_(e,t,n){let r=performance.now(),i=Pg(e,`provider`);if(i.isErr())return(0,a_.err)(i.error);let a=i.value,o=Pe(n.path);if(o.isErr())return(0,a_.err)(o.error);let s=o.value,c=await jg({plugins:a,key:`providers`,config:{path:n.path,code:s}});if(c.isErr())return(0,a_.err)(c.error);let l=c.value,u=N(n.path,l);return u.isErr()?(0,a_.err)(u.error):(await pe({devDependencies:a,dependencies:[]},{options:t,configPath:n.path}),(0,a_.ok)({duration:performance.now()-r,providers:e.length}))}function u_({duration:e,providers:t}){return`Added ${o_.default.green(t.toString())} ${t>1?`providers`:`provider`} in ${o_.default.green(`${e.toFixed(2)}ms`)}.`}var d_=n(We(),1),f_=n(r(),1);const p_=ct.extend({yes:M()}),m_=new Ze(`transform`).description(`Add a transform to your config.`).argument(`[transforms...]`,`Names of the transforms you want to add to your config. ex: (@jsrepo/transform-prettier, @jsrepo/transform-biome)`).addOption(P.cwd).addOption(P.yes).action(async(e,t)=>{let n=lt(p_,t);O();let r=await k({cwd:n.cwd,promptForContinueIfNull:!n.yes});r||dt(new g(n.cwd)),A(g_(await ut(h_(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r))))});async function h_(e,t,n){let r=performance.now(),i=Pg(e,`transform`);if(i.isErr())return(0,d_.err)(i.error);let a=i.value,o=Pe(n.path);if(o.isErr())return(0,d_.err)(o.error);let s=o.value,c=await jg({plugins:a,key:`transforms`,config:{path:n.path,code:s}});if(c.isErr())return(0,d_.err)(c.error);let l=c.value,u=N(n.path,l);return u.isErr()?(0,d_.err)(u.error):(await pe({devDependencies:a,dependencies:[]},{options:t,configPath:n.path}),(0,d_.ok)({duration:performance.now()-r,transforms:e.length}))}function g_({duration:e,transforms:t}){return`Added ${f_.default.green(t.toString())} ${t>1?`transforms`:`transform`} in ${f_.default.green(`${e.toFixed(2)}ms`)}.`}const __=new Ze(`config`).description(`Modify your jsrepo config.`).addCommand(m_).addCommand(c_).addCommand(zg).addCommand(Kg);var v_=n(We(),1),y_=class{withinExportDefaultDeclaration=!1;withinDefineConfig=!1;withinMainObjectExpression=!1;withinIgnoredProperty=!1;configKeyPropertyDeclaration=null;mainObjectExpression=null};async function b_(e,{config:t}){if(e.length===0)return(0,v_.ok)(t.code);let n=await nt(t.path,t.code),r=new Xe(t.code),i=new y_;if(i.withinDefineConfig=!0,new tt({ExportDefaultDeclaration(){i.withinExportDefaultDeclaration=!0},"ExportDefaultDeclaration:exit"(){i.withinExportDefaultDeclaration=!1},ObjectExpression(e){i.withinExportDefaultDeclaration&&i.withinDefineConfig&&(i.withinIgnoredProperty||(i.withinMainObjectExpression||=(i.mainObjectExpression=e,!0)))},CallExpression(e){i.withinExportDefaultDeclaration&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(i.withinDefineConfig=!0)},"CallExpression:exit"(e){i.withinDefineConfig&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(i.withinDefineConfig=!1,i.withinMainObjectExpression=!1)},Property(e){if(i.withinDefineConfig&&i.withinMainObjectExpression&&!i.withinIgnoredProperty){if(e.key.type===`Identifier`&&e.key.name!==`registries`){i.withinIgnoredProperty=!0;return}if(e.key.type===`Identifier`&&(e.kind===`init`||e.kind===`get`)&&e.key.name===`registries`){if(e.value.type!==`ArrayExpression`)return(0,v_.err)(new h({key:`registries`,type:`array`}));i.configKeyPropertyDeclaration=e}}},"Property:exit"(e){if(i.withinDefineConfig&&e.key.type===`Identifier`&&e.key.name!==`registries`){i.withinIgnoredProperty=!1;return}}}).visit(n.program),i.configKeyPropertyDeclaration!==null){if(i.configKeyPropertyDeclaration.value.type!==`ArrayExpression`)return(0,v_.err)(new h({key:`registries`,type:`array`}));for(let t of i.configKeyPropertyDeclaration.value.elements)!t||t.type!==`Literal`||typeof t.value==`string`&&(e=e.filter(e=>e!==t.value));if(e.length===0)return(0,v_.ok)(t.code);let n=r.slice(i.configKeyPropertyDeclaration.value.start,i.configKeyPropertyDeclaration.value.end).lastIndexOf(`,`),a=n===-1?-1:n+i.configKeyPropertyDeclaration.value.start+1;if(i.configKeyPropertyDeclaration.value.elements.length===0)r.appendRight(i.configKeyPropertyDeclaration.value.start+1,`${e.map(e=>`'${e}'`).join(`, `)}`);else{let t=i.configKeyPropertyDeclaration.value.elements[i.configKeyPropertyDeclaration.value.elements.length-1],n=!1;n=!(a!==-1&&a>t.end),r.appendRight(n?t.end:a,`${n?`,`:``} ${e.map(e=>`'${e}'`).join(`, `)}`)}}else{if(i.mainObjectExpression===null)return(0,v_.err)(new p);let t=r.slice(i.mainObjectExpression.start,i.mainObjectExpression.end).lastIndexOf(`,`),n=t===-1?-1:t+i.mainObjectExpression.start+1;if(i.mainObjectExpression.properties.length===0)r.appendRight(i.mainObjectExpression.start+1,`\n\tregistries: [${e.map(e=>`'${e}'`).join(`, `)}]`);else{let t=i.mainObjectExpression.properties[i.mainObjectExpression.properties.length-1],a=!1;a=!(n!==-1&&n>t.end),r.appendRight(a?t.end:n,`${a?`,`:``}\n\tregistries: [${e.map(e=>`'${e}'`).join(`, `)}]`)}}return(0,v_.ok)(r.toString())}var Z=n(We(),1),x_=n(r(),1);const S_=ct.extend({yes:M(),overwrite:M(),verbose:M(),expand:M(),maxUnchanged:xe(),js:M()}),C_=new Ze(`init`).description(`Initialize a new jsrepo project.`).argument(`[registries...]`,`The registries to initialize.`).option(`--js`,`Initialize the project and automatically add the @jsrepo/transform-javascript transform plugin.`,!1).addOption(P.cwd).addOption(P.yes).addOption(P.verbose).addOption(P.overwrite).addOption(P.expand).addOption(P.maxUnchanged).action(async(e,t)=>{let n=lt(S_,t),r=await k({cwd:n.cwd,promptForContinueIfNull:!1});O(),await ut(w_(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r)),A(x_.default.green(`Initialization complete!`))});async function w_(t,n,r){let{verbose:i,spinner:a}=E({options:n}),o=Ee(n.cwd,`package.json`),s=x(o);if(s.isErr())return(0,Z.err)(new e);let c=s.value,{config:l,path:u}=r??{config:null,path:Ee(n.cwd,c.type===`module`?`jsrepo.config.ts`:`jsrepo.config.mts`)},d=l?.providers??Be,f;if(l===null)f=k_();else{let e=Pe(u);if(e.isErr())return(0,Z.err)(e.error);f=e.value}let p=!0;if(c.dependencies?.jsrepo===void 0&&c.devDependencies?.jsrepo===void 0){c.devDependencies||={},c.devDependencies.jsrepo=`^${oe}`;let e=N(o,JSON.stringify(c,null,` `));if(e.isErr())return(0,Z.err)(e.error);p=!1}if(n.js){let e=await jg({plugins:[{name:`stripTypes`,packageName:`@jsrepo/transform-javascript`,version:void 0}],key:`transforms`,config:{path:u,code:f}});if(e.isErr())return(0,Z.err)(e.error);f=e.value}if(t.length===0){if(l!==null)return(0,Z.err)(new _);let e=N(u,f);return e.isErr()?(0,Z.err)(e.error):(Ke.success(`Wrote config to ${x_.default.cyan(Ce.relative(n.cwd,u))}`),p||await pe({dependencies:[],devDependencies:[...n.js?[{name:`@jsrepo/transform-javascript`}]:[]]},{configPath:u,options:n}),(0,Z.ok)())}let m=t.length>0?t:l?.registries??[];a.start(`Retrieving manifest${m.length>1?`s`:``} from ${x_.default.cyan(m.join(`, `))}`);let h=await _e(m,{cwd:n.cwd,providers:d});if(h.isErr())return a.stop(`Failed to retrieve manifests`),(0,Z.err)(h.error);a.stop(`Retrieved manifest${m.length>1?`s`:``} from ${x_.default.cyan(m.join(`, `))}`);let g=h.value,v=new Map;for(let[e,t]of g){let e=await T_(t,{configCode:f,configPath:u,options:n,pluginChoices:v,config:l});if(e.isErr())return(0,Z.err)(e.error);f=e.value}let y=await b_(t,{config:{path:u,code:f}});if(y.isErr())return(0,Z.err)(y.error);f=y.value;let b=N(u,f);if(b.isErr())return(0,Z.err)(b.error);Ke.success(`Wrote config to ${x_.default.cyan(Ce.relative(n.cwd,u))}`);let S=new Map(Array.from(v.values()).filter(e=>e.install).map(e=>[`js:${e.plugin.packageName}@${e.plugin.version??``}`,{name:e.plugin.packageName,version:e.plugin.version,ecosystem:`js`}]));S.size>0&&await pe({dependencies:[],devDependencies:[...Array.from(S.values()),...n.js?[{name:`@jsrepo/transform-javascript`}]:[]]},{options:{yes:!0},configPath:u}),S.clear();let w=await De({cwd:Ce.parse(u).dir});if(w.isErr())return(0,Z.err)(w.error);l=w.value;let ne=Array.from(g.values()).flatMap(e=>e.manifest.items.filter(e=>e.add===`on-init`||e.name===`index`).map(t=>({registry:e,item:t}))),re=Array.from(g.values()).flatMap(e=>e.manifest.items.filter(e=>e.add===`optionally-on-init`).map(t=>({registry:e,item:t})));if(re.length>0){let e=await te({message:`Would you like to add any of the following items?`,options:re.map(e=>({label:e.item.name,value:e.item.name}))});C(e)&&(T(`Canceled!`),process.exit(0)),ne.push(...re.filter(t=>e.includes(t.item.name)))}let ie={dependencies:[],devDependencies:[]};if(ne.length>0){a.start(`Fetching ${x_.default.cyan(ne.map(e=>e.item.name).join(`, `))}...`);let e=await Je(ne,{options:{withExamples:!1,withDocs:!1,withTests:!1}});if(e.isErr())return a.stop(`Failed to fetch items`),(0,Z.err)(e.error);a.stop(`Fetched ${x_.default.cyan(ne.map(e=>e.item.name).join(`, `))}`);let t=e.value,r=await Me({items:t,config:l,options:n});if(r.isErr())return(0,Z.err)(r.error);let{itemPaths:i}=r.value,o=await Ue({configResult:{path:u,config:l},options:{cwd:n.cwd,yes:n.yes,withExamples:!1,withDocs:!1,withTests:!1},itemPaths:i,items:t});if(o.isErr())return(0,Z.err)(o.error);let{neededDependencies:s,neededEnvVars:c,neededFiles:d}=o.value,f=await ee({files:d,options:n});if(f.isErr())return(0,Z.err)(f.error);let p=f.value;if(Ke.success(`Updated ${x_.default.green(p.length)} files`),c){let e=await D(c,{options:n});e&&Ke.success(`Updated ${x_.default.green(Object.keys(e).length)} environment variables`)}s.dependencies.push(...ie.dependencies),s.devDependencies.push(...ie.devDependencies)}if(l.paths!==void 0){let e=await gt(l.paths,{config:{path:u,code:f}});if(e.isErr())return(0,Z.err)(e.error);f=e.value;let t=N(u,f);if(t.isErr())return(0,Z.err)(t.error);Ke.success(`Updated paths`)}return await fe(ie,{options:n,config:l}),(0,Z.ok)()}async function T_(e,{configCode:t,configPath:n,options:r,pluginChoices:i,config:a}){let o=await E_(e,{configCode:t,configPath:n,options:r,pluginChoices:i});if(o.isErr())return(0,Z.err)(o.error);t=o.value;let s=await D_(e,{configCode:t,configPath:n,options:r,config:a});return s.isErr()?(0,Z.err)(s.error):(t=s.value,(0,Z.ok)(t))}async function E_(e,{configCode:t,configPath:n,options:r,pluginChoices:i}){if(!e.manifest.plugins)return(0,Z.ok)(t);for(let[a,o]of Object.entries(e.manifest.plugins)){let e=await O_(o,{pluginChoices:i,options:r,type:a.slice(0,-1),config:{path:n,code:t}});if(e.isErr())return(0,Z.err)(e.error);let s=e.value,c=await jg({plugins:s,key:a,config:{path:n,code:t}});if(c.isErr())return(0,Z.err)(c.error);t=c.value}return(0,Z.ok)(t)}async function D_(e,{configCode:t,configPath:n,config:r,options:i}){let a=Array.from(new Set(e.manifest.items.flatMap(e=>e.files.filter(e=>e.target===void 0).map(e=>Se(e.type))))),o=r?.paths??{};if(!i.yes&&a.length>0){let t=await te({message:`Which paths would you like to configure?`,options:a.map(t=>({label:t,value:t,hint:e.manifest.defaultPaths?.[t]?`Default: ${e.manifest.defaultPaths?.[t]}`:void 0})),required:!1});if(C(t)&&(T(`Canceled!`),process.exit(0)),t.length>0)for(let n of t){let t=o[n]??e.manifest.defaultPaths?.[n],r=await ce({message:`Where should ${n} be added in your project?`,validate(e){if(!e||e.trim()===``)return`Please provide a value`},placeholder:t||`./src/${n}`,defaultValue:t,initialValue:t});C(r)&&(T(`Canceled!`),process.exit(0)),o[n]=r}}return o={...e.manifest.defaultPaths,...o},await gt(o,{config:{path:n,code:t}})}async function O_(e,{pluginChoices:t,options:n,type:r,config:i}){let a=[],o=(e,n)=>{t.set(e.packageName,{install:n,plugin:e}),a.push(e)},s=await Mg({config:i,plugins:e});for(let e of s){if(t.has(e.package))continue;let i=Fg(e.package,r);if(i.isErr())return(0,Z.err)(i.error);let a={name:i.value.name,packageName:e.package,version:e.version};if(e.optional!==!0){o(a,!0);continue}let s=n.yes;if(!n.yes){let t=await Ae({message:`Would you like to add the ${x_.default.cyan(e.package)} ${r} plugin?`});C(t)&&(T(`Canceled!`),process.exit(0)),s=t}if(!s){t.set(e.package,{install:!1,plugin:a});continue}o(a,!0)}return(0,Z.ok)(a)}function k_(){return`import { defineConfig } from 'jsrepo';
|
|
364
|
+
`),`${e}${Qg}`):Qg}const e_=Ie({command:Te(),args:He(Te()),env:Ne(Te(),Te()).optional()});Ie({mcpServers:Ne(Te(),e_)});const t_=Ie({servers:Ne(Te(),e_)});function n_({existingContent:e,serverName:t,serverConfig:n}){if(e.trim().length===0)return(0,Hg.ok)(ie({servers:{[t]:n}},{format:!0}));let r=ge(t_,e);return r.isErr()?(0,Hg.err)(new y(`Failed to parse MCP server config: ${r.error.message}`,{suggestion:`Please try again.`})):(0,Hg.ok)(ie({servers:{...r.value.servers,[t]:n}},{format:!0}))}function r_(e,t){let n=n_({existingContent:Ve(e)?Pe(e)._unsafeUnwrap():``,serverName:`jsrepo`,serverConfig:t});return n.isErr()?(0,Hg.err)(n.error):Xg(e,n.value)}const i_={cursor:{name:`Cursor`,filePath:e=>Ee(e,`.cursor/mcp.json`),writeConfig:e=>r_(e,Zg)},claude:{name:`Claude Code`,filePath:e=>Ee(e,`.mcp.json`),writeConfig:e=>r_(e,Zg)},vscode:{name:`VS Code`,filePath:e=>Ee(e,`.vscode/mcp.json`),writeConfig:e=>r_(e,Zg)},codex:{name:`Codex`,filePath:()=>Ee(rt.homedir(),`.codex/config.toml`),writeConfig:e=>Xg(e,$g(Ve(e)?Pe(e)._unsafeUnwrap():``))},antigravity:{name:`Antigravity`,filePath:()=>Ee(rt.homedir(),`.gemini/antigravity/mcp_config.json`),writeConfig:e=>r_(e,Zg)}};var a_=n(We(),1),o_=n(r(),1);const s_=ct.extend({yes:M()}),c_=new Ze(`provider`).description(`Add a provider to your config.`).argument(`[providers...]`,`Names of the providers you want to add to your config. ex: (jsrepo-provider-jsr, jsrepo-provider-npm)`).addOption(P.cwd).addOption(P.yes).action(async(e,t)=>{let n=lt(s_,t);O();let r=await k({cwd:n.cwd,promptForContinueIfNull:!n.yes});r||dt(new g(n.cwd)),A(u_(await ut(l_(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r))))});async function l_(e,t,n){let r=performance.now(),i=Pg(e,`provider`);if(i.isErr())return(0,a_.err)(i.error);let a=i.value,o=Pe(n.path);if(o.isErr())return(0,a_.err)(o.error);let s=o.value,c=await jg({plugins:a,key:`providers`,config:{path:n.path,code:s}});if(c.isErr())return(0,a_.err)(c.error);let l=c.value,u=N(n.path,l);return u.isErr()?(0,a_.err)(u.error):(await pe({devDependencies:a.map(e=>({name:e.packageName,version:e.version})),dependencies:[]},{options:t,configPath:n.path}),(0,a_.ok)({duration:performance.now()-r,providers:e.length}))}function u_({duration:e,providers:t}){return`Added ${o_.default.green(t.toString())} ${t>1?`providers`:`provider`} in ${o_.default.green(`${e.toFixed(2)}ms`)}.`}var d_=n(We(),1),f_=n(r(),1);const p_=ct.extend({yes:M()}),m_=new Ze(`transform`).description(`Add a transform to your config.`).argument(`[transforms...]`,`Names of the transforms you want to add to your config. ex: (@jsrepo/transform-prettier, @jsrepo/transform-biome)`).addOption(P.cwd).addOption(P.yes).action(async(e,t)=>{let n=lt(p_,t);O();let r=await k({cwd:n.cwd,promptForContinueIfNull:!n.yes});r||dt(new g(n.cwd)),A(g_(await ut(h_(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r))))});async function h_(e,t,n){let r=performance.now(),i=Pg(e,`transform`);if(i.isErr())return(0,d_.err)(i.error);let a=i.value,o=Pe(n.path);if(o.isErr())return(0,d_.err)(o.error);let s=o.value,c=await jg({plugins:a,key:`transforms`,config:{path:n.path,code:s}});if(c.isErr())return(0,d_.err)(c.error);let l=c.value,u=N(n.path,l);return u.isErr()?(0,d_.err)(u.error):(await pe({devDependencies:a.map(e=>({name:e.packageName,version:e.version})),dependencies:[]},{options:t,configPath:n.path}),(0,d_.ok)({duration:performance.now()-r,transforms:e.length}))}function g_({duration:e,transforms:t}){return`Added ${f_.default.green(t.toString())} ${t>1?`transforms`:`transform`} in ${f_.default.green(`${e.toFixed(2)}ms`)}.`}const __=new Ze(`config`).description(`Modify your jsrepo config.`).addCommand(m_).addCommand(c_).addCommand(zg).addCommand(Kg);var v_=n(We(),1),y_=class{withinExportDefaultDeclaration=!1;withinDefineConfig=!1;withinMainObjectExpression=!1;withinIgnoredProperty=!1;configKeyPropertyDeclaration=null;mainObjectExpression=null};async function b_(e,{config:t}){if(e.length===0)return(0,v_.ok)(t.code);let n=await nt(t.path,t.code),r=new Xe(t.code),i=new y_;if(i.withinDefineConfig=!0,new tt({ExportDefaultDeclaration(){i.withinExportDefaultDeclaration=!0},"ExportDefaultDeclaration:exit"(){i.withinExportDefaultDeclaration=!1},ObjectExpression(e){i.withinExportDefaultDeclaration&&i.withinDefineConfig&&(i.withinIgnoredProperty||(i.withinMainObjectExpression||=(i.mainObjectExpression=e,!0)))},CallExpression(e){i.withinExportDefaultDeclaration&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(i.withinDefineConfig=!0)},"CallExpression:exit"(e){i.withinDefineConfig&&e.callee.type===`Identifier`&&e.callee.name===`defineConfig`&&(i.withinDefineConfig=!1,i.withinMainObjectExpression=!1)},Property(e){if(i.withinDefineConfig&&i.withinMainObjectExpression&&!i.withinIgnoredProperty){if(e.key.type===`Identifier`&&e.key.name!==`registries`){i.withinIgnoredProperty=!0;return}if(e.key.type===`Identifier`&&(e.kind===`init`||e.kind===`get`)&&e.key.name===`registries`){if(e.value.type!==`ArrayExpression`)return(0,v_.err)(new h({key:`registries`,type:`array`}));i.configKeyPropertyDeclaration=e}}},"Property:exit"(e){if(i.withinDefineConfig&&e.key.type===`Identifier`&&e.key.name!==`registries`){i.withinIgnoredProperty=!1;return}}}).visit(n.program),i.configKeyPropertyDeclaration!==null){if(i.configKeyPropertyDeclaration.value.type!==`ArrayExpression`)return(0,v_.err)(new h({key:`registries`,type:`array`}));for(let t of i.configKeyPropertyDeclaration.value.elements)!t||t.type!==`Literal`||typeof t.value==`string`&&(e=e.filter(e=>e!==t.value));if(e.length===0)return(0,v_.ok)(t.code);let n=r.slice(i.configKeyPropertyDeclaration.value.start,i.configKeyPropertyDeclaration.value.end).lastIndexOf(`,`),a=n===-1?-1:n+i.configKeyPropertyDeclaration.value.start+1;if(i.configKeyPropertyDeclaration.value.elements.length===0)r.appendRight(i.configKeyPropertyDeclaration.value.start+1,`${e.map(e=>`'${e}'`).join(`, `)}`);else{let t=i.configKeyPropertyDeclaration.value.elements[i.configKeyPropertyDeclaration.value.elements.length-1],n=!1;n=!(a!==-1&&a>t.end),r.appendRight(n?t.end:a,`${n?`,`:``} ${e.map(e=>`'${e}'`).join(`, `)}`)}}else{if(i.mainObjectExpression===null)return(0,v_.err)(new p);let t=r.slice(i.mainObjectExpression.start,i.mainObjectExpression.end).lastIndexOf(`,`),n=t===-1?-1:t+i.mainObjectExpression.start+1;if(i.mainObjectExpression.properties.length===0)r.appendRight(i.mainObjectExpression.start+1,`\n\tregistries: [${e.map(e=>`'${e}'`).join(`, `)}]`);else{let t=i.mainObjectExpression.properties[i.mainObjectExpression.properties.length-1],a=!1;a=!(n!==-1&&n>t.end),r.appendRight(a?t.end:n,`${a?`,`:``}\n\tregistries: [${e.map(e=>`'${e}'`).join(`, `)}]`)}}return(0,v_.ok)(r.toString())}var Z=n(We(),1),x_=n(r(),1);const S_=ct.extend({yes:M(),overwrite:M(),verbose:M(),expand:M(),maxUnchanged:xe(),js:M()}),C_=new Ze(`init`).description(`Initialize a new jsrepo project.`).argument(`[registries...]`,`The registries to initialize.`).option(`--js`,`Initialize the project and automatically add the @jsrepo/transform-javascript transform plugin.`,!1).addOption(P.cwd).addOption(P.yes).addOption(P.verbose).addOption(P.overwrite).addOption(P.expand).addOption(P.maxUnchanged).action(async(e,t)=>{let n=lt(S_,t),r=await k({cwd:n.cwd,promptForContinueIfNull:!1});O(),await ut(w_(e,{...n,cwd:r?Ce.dirname(r.path):n.cwd},r)),A(x_.default.green(`Initialization complete!`))});async function w_(t,n,r){let{verbose:i,spinner:a}=E({options:n}),o=Ee(n.cwd,`package.json`),s=x(o);if(s.isErr())return(0,Z.err)(new e);let c=s.value,{config:l,path:u}=r??{config:null,path:Ee(n.cwd,c.type===`module`?`jsrepo.config.ts`:`jsrepo.config.mts`)},d=l?.providers??Be,f;if(l===null)f=k_();else{let e=Pe(u);if(e.isErr())return(0,Z.err)(e.error);f=e.value}let p=!0;if(c.dependencies?.jsrepo===void 0&&c.devDependencies?.jsrepo===void 0){c.devDependencies||={},c.devDependencies.jsrepo=`^${oe}`;let e=N(o,JSON.stringify(c,null,` `));if(e.isErr())return(0,Z.err)(e.error);p=!1}if(n.js){let e=await jg({plugins:[{name:`stripTypes`,packageName:`@jsrepo/transform-javascript`,version:void 0}],key:`transforms`,config:{path:u,code:f}});if(e.isErr())return(0,Z.err)(e.error);f=e.value}if(t.length===0){if(l!==null)return(0,Z.err)(new _);let e=N(u,f);return e.isErr()?(0,Z.err)(e.error):(Ke.success(`Wrote config to ${x_.default.cyan(Ce.relative(n.cwd,u))}`),p||await pe({dependencies:[],devDependencies:[...n.js?[{name:`@jsrepo/transform-javascript`}]:[]]},{configPath:u,options:n}),(0,Z.ok)())}let m=t.length>0?t:l?.registries??[];a.start(`Retrieving manifest${m.length>1?`s`:``} from ${x_.default.cyan(m.join(`, `))}`);let h=await _e(m,{cwd:n.cwd,providers:d});if(h.isErr())return a.stop(`Failed to retrieve manifests`),(0,Z.err)(h.error);a.stop(`Retrieved manifest${m.length>1?`s`:``} from ${x_.default.cyan(m.join(`, `))}`);let g=h.value,v=new Map;for(let[e,t]of g){let e=await T_(t,{configCode:f,configPath:u,options:n,pluginChoices:v,config:l});if(e.isErr())return(0,Z.err)(e.error);f=e.value}let y=await b_(t,{config:{path:u,code:f}});if(y.isErr())return(0,Z.err)(y.error);f=y.value;let b=N(u,f);if(b.isErr())return(0,Z.err)(b.error);Ke.success(`Wrote config to ${x_.default.cyan(Ce.relative(n.cwd,u))}`);let S=new Map(Array.from(v.values()).filter(e=>e.install).map(e=>[`js:${e.plugin.packageName}@${e.plugin.version??``}`,{name:e.plugin.packageName,version:e.plugin.version,ecosystem:`js`}]));S.size>0&&await pe({dependencies:[],devDependencies:[...Array.from(S.values()),...n.js?[{name:`@jsrepo/transform-javascript`}]:[]]},{options:{yes:!0},configPath:u}),S.clear();let w=await De({cwd:Ce.parse(u).dir});if(w.isErr())return(0,Z.err)(w.error);l=w.value;let ne=Array.from(g.values()).flatMap(e=>e.manifest.items.filter(e=>e.add===`on-init`||e.name===`index`).map(t=>({registry:e,item:t}))),re=Array.from(g.values()).flatMap(e=>e.manifest.items.filter(e=>e.add===`optionally-on-init`).map(t=>({registry:e,item:t})));if(re.length>0){let e=await te({message:`Would you like to add any of the following items?`,options:re.map(e=>({label:e.item.name,value:e.item.name}))});C(e)&&(T(`Canceled!`),process.exit(0)),ne.push(...re.filter(t=>e.includes(t.item.name)))}let ie={dependencies:[],devDependencies:[]};if(ne.length>0){a.start(`Fetching ${x_.default.cyan(ne.map(e=>e.item.name).join(`, `))}...`);let e=await Je(ne,{options:{withExamples:!1,withDocs:!1,withTests:!1}});if(e.isErr())return a.stop(`Failed to fetch items`),(0,Z.err)(e.error);a.stop(`Fetched ${x_.default.cyan(ne.map(e=>e.item.name).join(`, `))}`);let t=e.value,r=await Me({items:t,config:l,options:n});if(r.isErr())return(0,Z.err)(r.error);let{itemPaths:i}=r.value,o=await Ue({configResult:{path:u,config:l},options:{cwd:n.cwd,yes:n.yes,withExamples:!1,withDocs:!1,withTests:!1},itemPaths:i,items:t});if(o.isErr())return(0,Z.err)(o.error);let{neededDependencies:s,neededEnvVars:c,neededFiles:d}=o.value,f=await ee({files:d,options:n});if(f.isErr())return(0,Z.err)(f.error);let p=f.value;if(Ke.success(`Updated ${x_.default.green(p.length)} files`),c){let e=await D(c,{options:n});e&&Ke.success(`Updated ${x_.default.green(Object.keys(e).length)} environment variables`)}s.dependencies.push(...ie.dependencies),s.devDependencies.push(...ie.devDependencies)}if(l.paths!==void 0){let e=await gt(l.paths,{config:{path:u,code:f}});if(e.isErr())return(0,Z.err)(e.error);f=e.value;let t=N(u,f);if(t.isErr())return(0,Z.err)(t.error);Ke.success(`Updated paths`)}return await fe(ie,{options:n,config:l}),(0,Z.ok)()}async function T_(e,{configCode:t,configPath:n,options:r,pluginChoices:i,config:a}){let o=await E_(e,{configCode:t,configPath:n,options:r,pluginChoices:i});if(o.isErr())return(0,Z.err)(o.error);t=o.value;let s=await D_(e,{configCode:t,configPath:n,options:r,config:a});return s.isErr()?(0,Z.err)(s.error):(t=s.value,(0,Z.ok)(t))}async function E_(e,{configCode:t,configPath:n,options:r,pluginChoices:i}){if(!e.manifest.plugins)return(0,Z.ok)(t);for(let[a,o]of Object.entries(e.manifest.plugins)){let e=await O_(o,{pluginChoices:i,options:r,type:a.slice(0,-1),config:{path:n,code:t}});if(e.isErr())return(0,Z.err)(e.error);let s=e.value,c=await jg({plugins:s,key:a,config:{path:n,code:t}});if(c.isErr())return(0,Z.err)(c.error);t=c.value}return(0,Z.ok)(t)}async function D_(e,{configCode:t,configPath:n,config:r,options:i}){let a=Array.from(new Set(e.manifest.items.flatMap(e=>e.files.filter(e=>e.target===void 0).map(e=>Se(e.type))))),o=r?.paths??{};if(!i.yes&&a.length>0){let t=await te({message:`Which paths would you like to configure?`,options:a.map(t=>({label:t,value:t,hint:e.manifest.defaultPaths?.[t]?`Default: ${e.manifest.defaultPaths?.[t]}`:void 0})),required:!1});if(C(t)&&(T(`Canceled!`),process.exit(0)),t.length>0)for(let n of t){let t=o[n]??e.manifest.defaultPaths?.[n],r=await ce({message:`Where should ${n} be added in your project?`,validate(e){if(!e||e.trim()===``)return`Please provide a value`},placeholder:t||`./src/${n}`,defaultValue:t,initialValue:t});C(r)&&(T(`Canceled!`),process.exit(0)),o[n]=r}}return o={...e.manifest.defaultPaths,...o},await gt(o,{config:{path:n,code:t}})}async function O_(e,{pluginChoices:t,options:n,type:r,config:i}){let a=[],o=(e,n)=>{t.set(e.packageName,{install:n,plugin:e}),a.push(e)},s=await Mg({config:i,plugins:e});for(let e of s){if(t.has(e.package))continue;let i=Fg(e.package,r);if(i.isErr())return(0,Z.err)(i.error);let a={name:i.value.name,packageName:e.package,version:e.version};if(e.optional!==!0){o(a,!0);continue}let s=n.yes;if(!n.yes){let t=await Ae({message:`Would you like to add the ${x_.default.cyan(e.package)} ${r} plugin?`});C(t)&&(T(`Canceled!`),process.exit(0)),s=t}if(!s){t.set(e.package,{install:!1,plugin:a});continue}o(a,!0)}return(0,Z.ok)(a)}function k_(){return`import { defineConfig } from 'jsrepo';
|
|
365
365
|
|
|
366
366
|
export default defineConfig({
|
|
367
367
|
// configure where stuff comes from here
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as e,C as t,E as n,F as r,G as i,H as a,I as o,L as s,O as c,P as l,R as u,S as d,T as f,U as p,V as m,W as h,_ as g,c as _,d as v,f as y,j as b,l as x,n as S,o as C,p as w,r as ee,s as te,u as ne,v as re,w as T,x as E,z as ie}from"./errors-C_rb7vZB.js";import ae,{builtinModules as oe,createRequire as se}from"node:module";import D,{cwd as ce,stdin as le,stdout as ue}from"node:process";import*as de from"node:readline";import fe from"node:readline";import{ReadStream as pe}from"node:tty";import O,{existsSync as me,lstatSync as he,readdirSync as ge}from"node:fs";import k,{delimiter as _e,dirname as ve,join as ye,normalize as be,resolve as xe}from"node:path";import{isDeepStrictEqual as Se,promisify as Ce,stripVTControlCharacters as we}from"node:util";import{parseAsync as Te}from"oxc-parser";import Ee from"node:fs/promises";import De from"node:os";import{createRequire as Oe}from"module";import{spawn as ke}from"node:child_process";import{PassThrough as Ae}from"node:stream";import je from"fs";import Me from"os";import Ne from"path";import{createConfigLoader as Pe}from"unconfig";import Fe from"node:crypto";import Ie from"node:assert";var Le=`jsrepo`,Re=`A CLI to add shared code from remote repositories.`,ze=`3.0.0`,Be=p(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),Ve=i(a(),1),He=i(Be(),1);const Ue=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,We=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Ge=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,Ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,qe=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Je=/\t{1,1000}/y,Ye=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Xe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ze=/\p{M}+/gu,Qe={limit:1/0,ellipsis:``},$e=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?$e(i,Qe,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;t:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(Ze,``)){let t=e.codePointAt(0)||0;if(w=We(t)?d:Ge(t)?p:l!==f&&Ue(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break t}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(Xe.lastIndex=h,Xe.test(e)){if(_=Xe.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=Xe.lastIndex;continue}if(Ke.lastIndex=h,Ke.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=Ke.lastIndex;continue}if(qe.lastIndex=h,qe.test(e)){if(_=qe.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=qe.lastIndex;continue}if(Je.lastIndex=h,Je.test(e)){if(_=Je.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=Je.lastIndex;continue}if(Ye.lastIndex=h,Ye.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=Ye.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},et={limit:1/0,ellipsis:``,ellipsisWidth:0},tt=(e,t={})=>$e(e,et,t).width,nt=`]8;;`,rt=RegExp(`(?:\\[(?<code>\\d+)m|\\${nt}(?<uri>.*))`,`y`),it=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},at=e=>`[${e}m`,ot=e=>`${nt}${e}`,st=e=>e.map(e=>tt(e)),ct=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:tt(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=tt(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(nt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},lt=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(tt(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},ut=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=st(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=tt(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),ct(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){ct(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){ct(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>lt(e)));let l=c.join(`
|
|
1
|
+
import{B as e,C as t,E as n,F as r,G as i,H as a,I as o,L as s,O as c,P as l,R as u,S as d,T as f,U as p,V as m,W as h,_ as g,c as _,d as v,f as y,j as b,l as x,n as S,o as C,p as w,r as ee,s as te,u as ne,v as re,w as T,x as E,z as ie}from"./errors-C_rb7vZB.js";import ae,{builtinModules as oe,createRequire as se}from"node:module";import D,{cwd as ce,stdin as le,stdout as ue}from"node:process";import*as de from"node:readline";import fe from"node:readline";import{ReadStream as pe}from"node:tty";import O,{existsSync as me,lstatSync as he,readdirSync as ge}from"node:fs";import k,{delimiter as _e,dirname as ve,join as ye,normalize as be,resolve as xe}from"node:path";import{isDeepStrictEqual as Se,promisify as Ce,stripVTControlCharacters as we}from"node:util";import{parseAsync as Te}from"oxc-parser";import Ee from"node:fs/promises";import De from"node:os";import{createRequire as Oe}from"module";import{spawn as ke}from"node:child_process";import{PassThrough as Ae}from"node:stream";import je from"fs";import Me from"os";import Ne from"path";import{createConfigLoader as Pe}from"unconfig";import Fe from"node:crypto";import Ie from"node:assert";var Le=`jsrepo`,Re=`A CLI to add shared code from remote repositories.`,ze=`3.0.1`,Be=p(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),Ve=i(a(),1),He=i(Be(),1);const Ue=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,We=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Ge=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,Ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,qe=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Je=/\t{1,1000}/y,Ye=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Xe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ze=/\p{M}+/gu,Qe={limit:1/0,ellipsis:``},$e=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?$e(i,Qe,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;t:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(Ze,``)){let t=e.codePointAt(0)||0;if(w=We(t)?d:Ge(t)?p:l!==f&&Ue(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break t}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(Xe.lastIndex=h,Xe.test(e)){if(_=Xe.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=Xe.lastIndex;continue}if(Ke.lastIndex=h,Ke.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=Ke.lastIndex;continue}if(qe.lastIndex=h,qe.test(e)){if(_=qe.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=qe.lastIndex;continue}if(Je.lastIndex=h,Je.test(e)){if(_=Je.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=Je.lastIndex;continue}if(Ye.lastIndex=h,Ye.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=Ye.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},et={limit:1/0,ellipsis:``,ellipsisWidth:0},tt=(e,t={})=>$e(e,et,t).width,nt=`]8;;`,rt=RegExp(`(?:\\[(?<code>\\d+)m|\\${nt}(?<uri>.*))`,`y`),it=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},at=e=>`[${e}m`,ot=e=>`${nt}${e}`,st=e=>e.map(e=>tt(e)),ct=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:tt(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=tt(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(nt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},lt=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(tt(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},ut=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=st(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=tt(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),ct(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){ct(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){ct(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>lt(e)));let l=c.join(`
|
|
2
2
|
`),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===``){rt.lastIndex=p+1;let e=rt.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?it(i):void 0;t===`
|
|
3
3
|
`?(a&&(r+=ot(``)),i&&n&&(r+=at(n))):e===`
|
|
4
4
|
`&&(i&&n&&(r+=at(i)),a&&(r+=ot(a))),p+=e.length,d=f,f=u.next()}return r};function dt(e,t,n){return String(e).normalize().replaceAll(`\r
|
|
@@ -154,4 +154,4 @@ ${A.default.cyan(Gt)}
|
|
|
154
154
|
depsCount: ${n},
|
|
155
155
|
deps: ${r}}`};let i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Ex=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z(),n=Q();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Dx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Hb(),n=Z(),r=Fb(),i=Q();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Ox=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Jb(),n=Hb(),r=Q(),i=Dx();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),kx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Hb(),n=Z(),r=Q(),i=Q();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Ax=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),jx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Hb().validateUnion,error:{message:`must match a schema in anyOf`}}})),Mx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z(),n=Q();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Nx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Px=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z(),n=Q(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Fx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Ix=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=bx(),n=Sx(),r=xx(),i=Cx(),a=wx(),o=Tx(),s=Ex(),c=Dx(),l=Ox(),u=kx(),d=Ax(),f=jx(),p=Mx(),m=Nx(),h=Px(),g=Fx();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Lx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.dynamicAnchor=void 0;let t=Z(),n=Fb(),r=Zb(),i=ax(),a={keyword:`$dynamicAnchor`,schemaType:`string`,code:e=>o(e,e.schema)};function o(e,r){let{gen:i,it:a}=e;a.schemaEnv.root.dynamicAnchors[r]=!0;let o=(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(r)}`,c=a.errSchemaPath===`#`?a.validateName:s(e);i.if((0,t._)`!${o}`,()=>i.assign(o,c))}e.dynamicAnchor=o;function s(e){let{schemaEnv:t,schema:n,self:a}=e.it,{root:o,baseId:s,localRefs:c,meta:l}=t.root,{schemaId:u}=a.opts,d=new r.SchemaEnv({schema:n,schemaId:u,root:o,baseId:s,localRefs:c,meta:l});return r.compileSchema.call(a,d),(0,i.getValidate)(e,d)}e.default=a})),Rx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.dynamicRef=void 0;let t=Z(),n=Fb(),r=ax(),i={keyword:`$dynamicRef`,schemaType:`string`,code:e=>a(e,e.schema)};function a(e,i){let{gen:a,keyword:o,it:s}=e;if(i[0]!==`#`)throw Error(`"${o}" only supports hash fragment reference`);let c=i.slice(1);if(s.allErrors)l();else{let t=a.let(`valid`,!1);l(t),e.ok(t)}function l(e){if(s.schemaEnv.root.dynamicAnchors[c]){let r=a.let(`_v`,(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(c)}`);a.if(r,u(r,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,n){return n?()=>a.block(()=>{(0,r.callRef)(e,t),a.let(n,!0)}):()=>(0,r.callRef)(e,t)}}e.dynamicRef=a,e.default=i})),zx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Lx(),n=Q();e.default={keyword:`$recursiveAnchor`,schemaType:`boolean`,code(e){e.schema?(0,t.dynamicAnchor)(e,``):(0,n.checkStrictMode)(e.it,`$recursiveAnchor: false is ignored`)}}})),Bx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Rx();e.default={keyword:`$recursiveRef`,schemaType:`string`,code:e=>(0,t.dynamicRef)(e,e.schema)}})),Vx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Lx(),n=Rx(),r=zx(),i=Bx();e.default=[t.default,n.default,r.default,i.default]})),Hx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Tx();e.default={keyword:`dependentRequired`,type:`object`,schemaType:`object`,error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}})),Ux=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Tx();e.default={keyword:`dependentSchemas`,type:`object`,schemaType:`object`,code:e=>(0,t.validateSchemaDeps)(e)}})),Wx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:[`maxContains`,`minContains`],type:`array`,schemaType:`number`,code({keyword:e,parentSchema:n,it:r}){n.contains===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}}})),Gx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Hx(),n=Ux(),r=Wx();e.default=[t.default,n.default,r.default]})),Kx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z(),n=Q(),r=Fb();e.default={keyword:`unevaluatedProperties`,type:`object`,schemaType:[`boolean`,`object`],trackErrors:!0,error:{message:`must NOT have unevaluated properties`,params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:i,schema:a,data:o,errsCount:s,it:c}=e;if(!s)throw Error(`ajv implementation error`);let{allErrors:l,props:u}=c;u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn(`key`,o,e=>i.if(f(u,e),()=>d(e)))):u!==!0&&i.forIn(`key`,o,e=>u===void 0?d(e):i.if(p(u,e),()=>d(e))),c.props=!0,e.ok((0,t._)`${s} === ${r.default.errors}`);function d(r){if(a===!1){e.setParams({unevaluatedProperty:r}),e.error(),l||i.break();return}if(!(0,n.alwaysValidSchema)(c,a)){let a=i.name(`valid`);e.subschema({keyword:`unevaluatedProperties`,dataProp:r,dataPropType:n.Type.Str},a),l||i.if((0,t.not)(a),()=>i.break())}}function f(e,n){return(0,t._)`!${e} || !${e}[${n}]`}function p(e,n){let r=[];for(let i in e)e[i]===!0&&r.push((0,t._)`${n} !== ${i}`);return(0,t.and)(...r)}}}})),qx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z(),n=Q();e.default={keyword:`unevaluatedItems`,type:`array`,schemaType:[`boolean`,`object`],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e,s=o.items||0;if(s===!0)return;let c=r.const(`len`,(0,t._)`${a}.length`);if(i===!1)e.setParams({len:s}),e.fail((0,t._)`${c} > ${s}`);else if(typeof i==`object`&&!(0,n.alwaysValidSchema)(o,i)){let n=r.var(`valid`,(0,t._)`${c} <= ${s}`);r.if((0,t.not)(n),()=>l(n,s)),e.ok(n)}o.items=!0;function l(i,a){r.forRange(`i`,a,c,a=>{e.subschema({keyword:`unevaluatedItems`,dataProp:a,dataPropType:n.Type.Num},i),o.allErrors||r.if((0,t.not)(i),()=>r.break())})}}}})),Jx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Kx(),n=qx();e.default=[t.default,n.default]})),Yx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Xx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[Yx().default]})),Zx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Qx=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=ox(),n=yx(),r=Ix(),i=Vx(),a=Gx(),o=Jx(),s=Xx(),c=Zx();e.default=[i.default,t.default,n.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,a.default,o.default]})),$x=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),eS=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Z(),n=$x(),r=Zb(),i=Xb(),a=Q();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();for(let e in o.if(!1),r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),tS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/schema`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/unevaluated`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format-annotation`},{$ref:`meta/content`}],type:[`object`,`boolean`],$comment:`This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.`,properties:{definitions:{$comment:`"definitions" has been replaced by "$defs".`,type:`object`,additionalProperties:{$dynamicRef:`#meta`},deprecated:!0,default:{}},dependencies:{$comment:`"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.`,type:`object`,additionalProperties:{anyOf:[{$dynamicRef:`#meta`},{$ref:`meta/validation#/$defs/stringArray`}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:`"$recursiveAnchor" has been replaced by "$dynamicAnchor".`,$ref:`meta/core#/$defs/anchorString`,deprecated:!0},$recursiveRef:{$comment:`"$recursiveRef" has been replaced by "$dynamicRef".`,$ref:`meta/core#/$defs/uriReferenceString`,deprecated:!0}}}})),nS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:`meta`,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{prefixItems:{$ref:`#/$defs/schemaArray`},items:{$dynamicRef:`#meta`},contains:{$dynamicRef:`#meta`},additionalProperties:{$dynamicRef:`#meta`},properties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},patternProperties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},propertyNames:{$dynamicRef:`#meta`},if:{$dynamicRef:`#meta`},then:{$dynamicRef:`#meta`},else:{$dynamicRef:`#meta`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$dynamicRef:`#meta`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$dynamicRef:`#meta`}}}}})),rS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/unevaluated`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:`meta`,title:`Unevaluated applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{unevaluatedItems:{$dynamicRef:`#meta`},unevaluatedProperties:{$dynamicRef:`#meta`}}}})),iS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/content`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentEncoding:{type:`string`},contentMediaType:{type:`string`},contentSchema:{$dynamicRef:`#meta`}}}})),aS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/core`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:`meta`,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{$ref:`#/$defs/uriReferenceString`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{$ref:`#/$defs/uriString`},$ref:{$ref:`#/$defs/uriReferenceString`},$anchor:{$ref:`#/$defs/anchorString`},$dynamicRef:{$ref:`#/$defs/uriReferenceString`},$dynamicAnchor:{$ref:`#/$defs/anchorString`},$vocabulary:{type:`object`,propertyNames:{$ref:`#/$defs/uriString`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$dynamicRef:`#meta`}}},$defs:{anchorString:{type:`string`,pattern:`^[A-Za-z_][-A-Za-z0-9._]*$`},uriString:{type:`string`,format:`uri`},uriReferenceString:{type:`string`,format:`uri-reference`}}}})),oS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/format-annotation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:`meta`,title:`Format vocabulary meta-schema for annotation results`,type:[`object`,`boolean`],properties:{format:{type:`string`}}}})),sS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:`meta`,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}}})),cS=p(((e,t)=>{t.exports={$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:`meta`,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}}})),lS=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=tS(),n=nS(),r=rS(),i=iS(),a=aS(),o=oS(),s=sS(),c=cS(),l=[`/properties`];function u(e){return[t,n,r,i,a,u(this,o),s,u(this,c)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,n){return e?t.$dataMetaSchema(n,l):n}}e.default=u})),uS=p(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let n=rx(),r=Qx(),i=eS(),a=lS(),o=`https://json-schema.org/draft/2020-12/schema`;var s=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(a.default.call(this,e),this.refs[`http://json-schema.org/schema`]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s;var c=Jb();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return c.KeywordCxt}});var l=Z();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return l.CodeGen}});var u=Yb();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return u.default}});var d=Xb();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return d.default}})})),dS=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:te,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}let d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}let h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}let v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}let b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}let ee=/[^\\]\\Z/;function te(e){if(ee.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),fS=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=ox(),n=yx(),r=Ix(),i=Xx(),a=Zx();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),pS=p(((e,t)=>{t.exports={$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}})),mS=p(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=rx(),r=fS(),i=eS(),a=pS(),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`;var c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=Jb();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Z();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=Yb();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var f=Xb();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return f.default}})})),hS=p((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;let t=mS(),n=Z(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),gS=p(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});let n=dS(),r=hS(),i=Z(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s}));const _S=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);!vS(i,a)&&r||Object.defineProperty(e,n,a)},vS=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},yS=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},bS=(e,t)=>`/* Wrapped ${e}*/\n${t}`,xS=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),SS=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),CS=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=bS.bind(null,r,t.toString());Object.defineProperty(i,`name`,SS);let{writable:a,enumerable:o,configurable:s}=xS;Object.defineProperty(e,`toString`,{value:i,writable:a,enumerable:o,configurable:s})};function wS(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))_S(e,t,r,n);return yS(e,t),CS(e,t,r),e}var TS=(e,t={})=>{if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:n=0,maxWait:r=1/0,before:i=!1,after:a=!0}=t;if(n<0||r<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!i&&!a)throw Error("Both `before` and `after` are false, function wouldn't be called.");let o,s,c,l=function(...t){let l=this,u=()=>{o=void 0,s&&=(clearTimeout(s),void 0),a&&(c=e.apply(l,t))},d=()=>{s=void 0,o&&=(clearTimeout(o),void 0),a&&(c=e.apply(l,t))},f=i&&!o;return clearTimeout(o),o=setTimeout(u,n),r>0&&r!==1/0&&!s&&(s=setTimeout(d,r)),f&&(c=e.apply(l,t)),c};return wS(l,e),l.cancel=()=>{o&&=(clearTimeout(o),void 0),s&&=(clearTimeout(s),void 0)},l};const ES=Object.prototype.toString;function DS(e,t,n){return e?e.constructor===t?!0:ES.call(e)===n:!1}function OS(e){return DS(e,Uint8Array,`[object Uint8Array]`)}function kS(e){return DS(e,ArrayBuffer,`[object ArrayBuffer]`)}function AS(e){return OS(e)||kS(e)}function jS(e){if(!OS(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function MS(e){if(!AS(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function NS(e,t){if(e.length===0)return new Uint8Array;t??=e.reduce((e,t)=>e+t.length,0);let n=new Uint8Array(t),r=0;for(let t of e)jS(t),n.set(t,r),r+=t.length;return n}const PS={utf8:new globalThis.TextDecoder(`utf8`)};function FS(e,t=`utf8`){return MS(e),PS[t]??=new globalThis.TextDecoder(t),PS[t].decode(e)}function IS(e){if(typeof e!=`string`)throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}const LS=new globalThis.TextEncoder;function RS(e){return IS(e),LS.encode(e)}Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));var zS=i(uS(),1),BS=i(gS(),1),VS=i(hd(),1);const HS=`aes-256-cbc`,US=()=>Object.create(null),WS=e=>e!==void 0,GS=(e,t)=>{let n=new Set([`undefined`,`symbol`,`function`]),r=typeof t;if(n.has(r))throw TypeError(`Setting a value of type \`${r}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},KS=`__internal__`,qS=`${KS}.migrations.version`;var JS=class{path;events;#e;#t;#n;#r={};#i=!1;#a;#o;#s;constructor(e={}){let t=this.#c(e);this.#n=t,this.#l(t),this.#d(t),this.#f(t),this.events=new EventTarget,this.#t=t.encryptionKey,this.path=this.#p(t),this.#m(t),t.watch&&this._watch()}get(e,t){if(this.#n.accessPropertiesByDotNotation)return this._get(e,t);let{store:n}=this;return e in n?n[e]:t}set(e,t){if(typeof e!=`string`&&typeof e!=`object`)throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=`object`&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${KS} key, as it's used to manage this module internal operations.`);let{store:n}=this,r=(e,t)=>{if(GS(e,t),this.#n.accessPropertiesByDotNotation)Zy(n,e,t);else{if(e===`__proto__`||e===`constructor`||e===`prototype`)return;n[e]=t}};if(typeof e==`object`){let t=e;for(let[e,n]of Object.entries(t))r(e,n)}else r(e,t);this.store=n}has(e){return this.#n.accessPropertiesByDotNotation?$y(this.store,e):e in this.store}appendToArray(e,t){GS(e,t);let n=this.#n.accessPropertiesByDotNotation?this._get(e,[]):e in this.store?this.store[e]:[];if(!Array.isArray(n))throw TypeError(`The key \`${e}\` is already set to a non-array value`);this.set(e,[...n,t])}reset(...e){for(let t of e)WS(this.#r[t])&&this.set(t,this.#r[t])}delete(e){let{store:t}=this;this.#n.accessPropertiesByDotNotation?Qy(t,e):delete t[e],this.store=t}clear(){let e=US();for(let t of Object.keys(this.#r))WS(this.#r[t])&&(GS(t,this.#r[t]),this.#n.accessPropertiesByDotNotation?Zy(e,t,this.#r[t]):e[t]=this.#r[t]);this.store=e}onDidChange(e,t){if(typeof e!=`string`)throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=`function`)throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleValueChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=`function`)throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleStoreChange(e)}get size(){return Object.keys(this.store).filter(e=>!this._isReservedKeyPath(e)).length}get store(){try{let e=O.readFileSync(this.path,this.#t?null:`utf8`),t=this._decryptData(e),n=this._deserialize(t);return this.#i||this._validate(n),Object.assign(US(),n)}catch(e){if(e?.code===`ENOENT`)return this._ensureDirectory(),US();if(this.#n.clearInvalidConfig){let t=e;if(t.name===`SyntaxError`||t.message?.startsWith(`Config schema violation:`))return US()}throw e}}set store(e){if(this._ensureDirectory(),!$y(e,KS))try{let t=O.readFileSync(this.path,this.#t?null:`utf8`),n=this._decryptData(t),r=this._deserialize(n);$y(r,KS)&&Zy(e,KS,Xy(r,KS))}catch{}this.#i||this._validate(e),this._write(e),this.events.dispatchEvent(new Event(`change`))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))this._isReservedKeyPath(e)||(yield[e,t])}_closeWatcher(){this.#a&&=(this.#a.close(),void 0),this.#o&&=(O.unwatchFile(this.path),!1),this.#s=void 0}_decryptData(e){if(!this.#t)return typeof e==`string`?e:FS(e);try{let t=e.slice(0,16),n=Fe.pbkdf2Sync(this.#t,t,1e4,32,`sha512`),r=Fe.createDecipheriv(HS,n,t),i=e.slice(17),a=typeof i==`string`?RS(i):i;return FS(NS([r.update(a),r.final()]))}catch{try{let t=e.slice(0,16),n=Fe.pbkdf2Sync(this.#t,t.toString(),1e4,32,`sha512`),r=Fe.createDecipheriv(HS,n,t),i=e.slice(17),a=typeof i==`string`?RS(i):i;return FS(NS([r.update(a),r.final()]))}catch{}}return typeof e==`string`?e:FS(e)}_handleStoreChange(e){let t=this.store,n=()=>{let n=t,r=this.store;Se(r,n)||(t=r,e.call(this,r,n))};return this.events.addEventListener(`change`,n),()=>{this.events.removeEventListener(`change`,n)}}_handleValueChange(e,t){let n=e(),r=()=>{let r=n,i=e();Se(i,r)||(n=i,t.call(this,i,r))};return this.events.addEventListener(`change`,r),()=>{this.events.removeEventListener(`change`,r)}}_deserialize=e=>JSON.parse(e);_serialize=e=>JSON.stringify(e,void 0,` `);_validate(e){if(!this.#e||this.#e(e)||!this.#e.errors)return;let t=this.#e.errors.map(({instancePath:e,message:t=``})=>`\`${e.slice(1)}\` ${t}`);throw Error(`Config schema violation: `+t.join(`; `))}_ensureDirectory(){O.mkdirSync(k.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let e=Fe.randomBytes(16),n=Fe.pbkdf2Sync(this.#t,e,1e4,32,`sha512`),r=Fe.createCipheriv(HS,n,e);t=NS([e,RS(`:`),r.update(RS(t)),r.final()])}if(D.env.SNAP)O.writeFileSync(this.path,t,{mode:this.#n.configFileMode});else try{Mb(this.path,t,{mode:this.#n.configFileMode})}catch(e){if(e?.code===`EXDEV`){O.writeFileSync(this.path,t,{mode:this.#n.configFileMode});return}throw e}}_watch(){if(this._ensureDirectory(),O.existsSync(this.path)||this._write(US()),D.platform===`win32`||D.platform===`darwin`){this.#s??=TS(()=>{this.events.dispatchEvent(new Event(`change`))},{wait:100});let e=k.dirname(this.path),t=k.basename(this.path);this.#a=O.watch(e,{persistent:!1,encoding:`utf8`},(e,n)=>{n&&n!==t||typeof this.#s==`function`&&this.#s()})}else this.#s??=TS(()=>{this.events.dispatchEvent(new Event(`change`))},{wait:1e3}),O.watchFile(this.path,{persistent:!1},(e,t)=>{typeof this.#s==`function`&&this.#s()}),this.#o=!0}_migrate(e,t,n){let r=this._get(qS,`0.0.0`),i=Object.keys(e).filter(e=>this._shouldPerformMigration(e,r,t)),a=structuredClone(this.store);for(let o of i)try{n&&n(this,{fromVersion:r,toVersion:o,finalVersion:t,versions:i});let s=e[o];s?.(this),this._set(qS,o),r=o,a=structuredClone(this.store)}catch(e){this.store=a;try{this._write(a)}catch{}let t=e instanceof Error?e.message:String(e);throw Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}(this._isVersionInRangeFormat(r)||!VS.default.eq(r,t))&&this._set(qS,t)}_containsReservedKey(e){return typeof e==`string`?this._isReservedKeyPath(e):!e||typeof e!=`object`?!1:this._objectContainsReservedKey(e)}_objectContainsReservedKey(e){if(!e||typeof e!=`object`)return!1;for(let[t,n]of Object.entries(e))if(this._isReservedKeyPath(t)||this._objectContainsReservedKey(n))return!0;return!1}_isReservedKeyPath(e){return e===KS||e.startsWith(`${KS}.`)}_isVersionInRangeFormat(e){return VS.default.clean(e)===null}_shouldPerformMigration(e,t,n){return this._isVersionInRangeFormat(e)?t!==`0.0.0`&&VS.default.satisfies(t,e)?!1:VS.default.satisfies(n,e):!(VS.default.lte(e,t)||VS.default.gt(e,n))}_get(e,t){return Xy(this.store,e,t)}_set(e,t){let{store:n}=this;Zy(n,e,t),this.store=n}#c(e){let t={configName:`config`,fileExtension:`json`,projectSuffix:`nodejs`,clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=ob(t.projectName,{suffix:t.projectSuffix}).config}return typeof t.fileExtension==`string`&&(t.fileExtension=t.fileExtension.replace(/^\.+/,``)),t}#l(e){if(!(e.schema??e.ajvOptions??e.rootSchema))return;if(e.schema&&typeof e.schema!=`object`)throw TypeError("The `schema` option must be an object.");let t=BS.default.default,n=new zS.Ajv2020({allErrors:!0,useDefaults:!0,...e.ajvOptions});t(n);let r={...e.rootSchema,type:`object`,properties:e.schema};this.#e=n.compile(r),this.#u(e.schema)}#u(e){let t=Object.entries(e??{});for(let[e,n]of t){if(!n||typeof n!=`object`||!Object.hasOwn(n,`default`))continue;let{default:t}=n;t!==void 0&&(this.#r[e]=t)}}#d(e){e.defaults&&Object.assign(this.#r,e.defaults)}#f(e){e.serialize&&(this._serialize=e.serialize),e.deserialize&&(this._deserialize=e.deserialize)}#p(e){let t=typeof e.fileExtension==`string`?e.fileExtension:void 0,n=t?`.${t}`:``;return k.resolve(e.cwd,`${e.configName??`config`}${n}`)}#m(e){if(e.migrations){this.#h(e),this._validate(this.store);return}let t=this.store,n=Object.assign(US(),e.defaults??{},t);this._validate(n);try{Ie.deepEqual(t,n)}catch{this.store=n}}#h(e){let{migrations:t,projectVersion:n}=e;if(t){if(!n)throw Error("Please specify the `projectVersion` option.");this.#i=!0;try{let r=this.store,i=Object.assign(US(),e.defaults??{},r);try{Ie.deepEqual(r,i)}catch{this._write(i)}this._migrate(t,n,e.beforeEachMigration)}finally{this.#i=!1}}}};function YS(){return new JS({projectName:`jsrepo-v2`})}var XS=class{#e;constructor(e){this.#e=e??YS()}get(e,t){if(e.auth?.tokenStoredFor===`registry`){let n=this.getProviderRegistryTokens(e);if(!t)throw new E(`No registry was provided to get when one was expected`,{suggestion:`This is a bug in jsrepo. Please report it here https://github.com/jsrepo/jsrepo/issues`});return n[t]}else{let t=this.#e.get(e.name,void 0);return e.auth?.envVar?t??process.env[e.auth.envVar]:t}}set(e,t,n){if(e.auth?.tokenStoredFor===`registry`){if(!t)throw new E(`No registry was provided to set when one was expected`,{suggestion:`This is a bug in jsrepo. Please report it here https://github.com/jsrepo/jsrepo/issues`});this.setProviderRegistryToken(e,t,n)}else this.#e.set(e.name,n)}delete(e,t){if(e.auth?.tokenStoredFor===`registry`){let n=this.getProviderRegistryTokens(e);if(!t)throw new E(`No registry was provided to delete when one was expected`,{suggestion:`This is a bug in jsrepo. Please report it here https://github.com/jsrepo/jsrepo/issues`});delete n[t],this.#e.set(e.name,n)}else this.#e.delete(e.name)}getProviderRegistryTokens(e){return this.#e.get(e.name)??{}}setProviderRegistryToken(e,t,n){let r=this.getProviderRegistryTokens(e);r[t]=n,this.#e.set(e.name,r)}},$=i(Kn(),1),ZS=i(a(),1);async function QS(e,{cwd:t,providers:n}){if(e.length===0)return(0,$.ok)(new Map);let r=new XS,i=await Promise.all(e.map(async e=>{let i=n.find(t=>t?.matches(e));if(!i)return(0,$.err)(new re(e));let a=r.get(i,e),o=await i?.create(e,{cwd:t,token:a}),s=await JC(o,{token:a});return s.isErr()?(0,$.err)(s.error):(0,$.ok)({url:e,provider:o,manifest:s.value,token:a})})),a=new Map;for(let e of i){if(e.isErr())return(0,$.err)(e.error);a.set(e.value.url,e.value)}return(0,$.ok)(a)}function $S(e,{providers:t,registries:n}){let r=e.map(e=>{if(t.some(t=>t.matches(e))){let t=e.lastIndexOf(`/`);return{registryUrl:e.substring(0,t),itemName:e.substring(t+1)}}return{itemName:e}}),i=r.every(e=>e.registryUrl),a=r.every(e=>e.registryUrl===void 0),o=r.filter(e=>e.registryUrl!==void 0).map(e=>e.registryUrl);return a&&n.length===0?(0,$.err)(new u):(0,$.ok)({wantedItems:r,neededRegistries:[...o,...i?[]:n]})}async function eC(e,{resolvedRegistries:t,nonInteractive:n}){let r=[];for(let i of e){let e,a;if(i.registryUrl){e=t.get(i.registryUrl);let n=e.manifest.items.find(e=>e.name===i.itemName);if(!n)return(0,$.err)(new s(i.itemName,e.url));a={...n,add:n.add??`when-added`}}else{let r=new Map;for(let[e,n]of t.entries()){let t=n.manifest.items.find(e=>e.name===i.itemName);t&&r.set(e,{registry:n,item:t})}if(r.size===0)return(0,$.err)(new s(i.itemName));if(r.size>1){if(n)return(0,$.err)(new f(i.itemName,Array.from(r.keys())));let t=await Vn({message:`Multiple registries contain ${ZS.default.cyan(i.itemName)}. Please select one:`,options:Array.from(r.entries()).map(([e])=>({label:i.itemName,value:e,hint:e}))});_t(t)&&(Pn(`Canceled!`),process.exit(0));let{registry:o,item:s}=r.get(t);e=o,a=s}else{let{registry:t,item:n}=r.values().next().value;e=t,a=n}}r.push({registry:e,item:a})}return(0,$.ok)(r)}function tC(e,{resolvedItems:t,options:n}){for(let r of e){if(t.has(r.item.name))continue;let e=[];for(let n of r.item.registryDependencies??[]){if(t.has(n))continue;let i=r.registry.manifest.items.find(e=>e.name===n);if(!i)return(0,$.err)(new s(n,r.registry.url));e.push({registry:r.registry,item:i})}for(let i of r.item.files)if(!(i.role===`example`&&!n.withExamples)&&!(i.role===`doc`&&!n.withDocs)&&!(i.role===`test`&&!n.withTests))for(let n of i.registryDependencies??[]){if(t.has(n))continue;let i=r.registry.manifest.items.find(e=>e.name===n);if(!i)return(0,$.err)(new s(n,r.registry.url));e.push({registry:r.registry,item:i})}let i=tC(e,{resolvedItems:t,options:n});if(i.isErr())return(0,$.err)(i.error);for(let e of i.value)t.set(e.name,e);t.set(r.item.name,{name:r.item.name,type:r.item.type,add:r.item.add,dependencies:r.item.dependencies,registry:r.registry,files:r.item.files})}return(0,$.ok)(Array.from(t.values()))}async function nC(e){try{return jl(Ny,await e.registry.provider.fetch(`${e.name}.json`,{token:e.registry.token}))}catch(t){return(0,$.err)(new o(t,{registry:e.registry.url,item:e.name}))}}async function rC(e,t){try{return(0,$.ok)(await t.registry.provider.fetch(e,{token:t.registry.token}))}catch(n){return n instanceof l?(0,$.err)(new r(n.originalMessage,{registry:t.registry.url,item:t.name,resourcePath:n.resourcePath})):(0,$.err)(new r(n instanceof Error?n.message:String(n),{registry:t.registry.url,item:t.name,resourcePath:e}))}}async function iC(e){let t=await Promise.all(e.files.map(async t=>{let n=await rC(t.path,e);return n.isErr()?(0,$.err)(n.error):(0,$.ok)({...t,content:n.value})})),n=[];for(let e of t){if(e.isErr())return(0,$.err)(e.error);n.push(e.value)}return(0,$.ok)({name:e.name,type:e.type,add:e.add,description:e.description,dependencies:e.dependencies,registry:e.registry,files:n})}async function aC(e){let t=await nC(e);return t.isErr()?(0,$.err)(t.error):(0,$.ok)({...t.value,files:t.value.files.map(e=>({...e,path:t.value.$schema===`https://ui.shadcn.com/schema/registry-item.json`?M.basename(e.path):e.path})),registry:e.registry})}async function oC(e){let t=await Promise.all(e.map(async e=>e.registry.manifest.type===`repository`?await iC(e):await aC(e))),n=[];for(let e of t){if(e.isErr())return(0,$.err)(e.error);n.push(e.value)}return(0,$.ok)(n)}async function sC(e,{paths:t,nonInteractive:n,options:r,matcher:i}){if(e.files.filter(e=>e.target!==void 0).length===e.files.length)return(0,$.ok)({path:``,resolvedPath:``});let a=t[`*`],o=hC(e.type),s=t[o];if(!s){if(a)return(0,$.ok)({path:a,resolvedPath:a});if(n)return(0,$.err)(new b({item:e.name,type:o}));let t=await Gn({message:`Where would you like to add ${ZS.default.cyan(o)}?`,placeholder:`./src/${o}`,initialValue:`./src/${o}`,defaultValue:`./src/${o}`,validate(e){if(!e||e.trim()===``)return`Please provide a value`}});return _t(t)&&(Pn(`Canceled!`),process.exit(0)),(0,$.ok)({path:t,resolvedPath:Vv(t,{cwd:r.cwd,matcher:i})})}return(0,$.ok)({path:s,resolvedPath:s})}async function cC(t,{item:n,languages:r,options:i,config:a,itemPaths:o}){t.content=await r.find(e=>e.canResolveDependencies(t.path))?.transformImports(t.content,t._imports_??[],{cwd:i.cwd,targetPath:t.path,item:n.name,file:{type:t.type,path:t.path},getItemPath:({item:t,file:n})=>{for(let[e,r]of Object.entries(o))if(e===`${n.type}/${t}`||e===n.type)return r;throw new e}})??t.content;for(let e of a?.transforms??[]){let r=await e.transform({code:t.content,fileName:t.path,options:{cwd:i.cwd,registryUrl:n.registry.url,item:n}});t.content=r.code??t.content,t.path=r.fileName??t.path}return t}function lC(e,{itemPath:t,options:n}){return e.target?z(n.cwd,e.target):z(n.cwd,t.path,e.path)}async function uC(e,{options:t}){let n=tC(e,{resolvedItems:new Map,options:t});if(n.isErr())return(0,$.err)(n.error);let r=n.value,i=await oC(r);if(i.isErr())return(0,$.err)(i.error);let a=i.value;return(0,$.ok)(a)}async function dC({items:e,config:t,options:n,continueOnNoPath:r=!1}){let i=zv({cwd:n.cwd}),a=Bv(t?.paths??{},{cwd:n.cwd,matcher:i}),o={};for(let s of e){let e=Array.from(new Set(Array.from(s.files,e=>hC(e.type))));for(let c of e){let e=a[`${c}/${s.name}`]??a[c];if(e!==void 0){a[`${c}/${s.name}`]=e;continue}let l=await sC(s,{paths:a,nonInteractive:n.yes,options:n,matcher:i});if(l.isErr()){if(l.error instanceof b&&r)continue;return(0,$.err)(l.error)}let{path:u,resolvedPath:d}=l.value;a[c]=d,o[c]=u,t&&(t.paths[c]=u)}}return(0,$.ok)({itemPaths:mC(e,a,{config:t}),resolvedPaths:a,updatedPaths:o})}async function fC({items:e,itemPaths:t,configResult:n,options:r}){let i=[],a=new Map,o=new Map,s;for(let c of e){for(let e of c.files){if(e.role===`example`&&!r.withExamples||e.role===`doc`&&!r.withDocs||e.role===`test`&&!r.withTests)continue;let s=t[`${hC(e.type)}/${c.name}`];e=await cC(e,{item:c,languages:n?.config.languages??Ov,options:r,config:n?.config,itemPaths:t});for(let t of e.dependencies??[])a.set(`${t.ecosystem}:${t.name}@${t.version}`,t);for(let t of e.devDependencies??[])o.set(`${t.ecosystem}:${t.name}@${t.version}`,t);let l=lC(e,{itemPath:s,options:r});if(Cu(l)){let t=vu(l)._unsafeUnwrap();if(t===e.content)continue;i.push({type:`update`,oldContent:t,filePath:l,content:e.content,itemName:c.name,registryUrl:c.registry.url})}else i.push({type:`create`,filePath:l,content:e.content,itemName:c.name,registryUrl:c.registry.url})}for(let e of c.dependencies??[])if(typeof e==`string`){let t=Ed(e);if(t.isErr())return(0,$.err)(new y({dependency:e,registryName:c.registry.url,itemName:c.name}));let n=t.value;a.set(`js:${n.name}@${n.version}`,{ecosystem:`js`,name:n.name,version:n.version})}else a.set(`${e.ecosystem}:${e.name}@${e.version}`,e);for(let e of c.devDependencies??[])if(typeof e==`string`){let t=Ed(e);if(t.isErr())return(0,$.err)(new y({dependency:e,registryName:c.registry.url,itemName:c.name}));let n=t.value;o.set(`js:${n.name}@${n.version}`,{ecosystem:`js`,name:n.name,version:n.version})}else o.set(`${e.ecosystem}:${e.name}@${e.version}`,e);for(let[e,t]of Object.entries(c.envVars??{}))s===void 0&&(s={}),s[e]=t}return(0,$.ok)({neededDependencies:{dependencies:Array.from(a.values()),devDependencies:Array.from(o.values())},neededEnvVars:s,neededFiles:i})}async function pC({files:e,options:t}){let n=[];for(let r of e)if(r.type===`create`||t.overwrite){let e=yu(r.filePath,r.content);if(e.isErr())return(0,$.err)(e.error);n.push(M.relative(t.cwd,r.filePath))}else{let e=ay(r.oldContent,r.content),i=M.relative(t.cwd,r.filePath),a=Vy({from:`${r.registryUrl}/${r.itemName}`,to:i,changes:e,expand:t.expand,maxUnchanged:t.maxUnchanged,prefix:()=>`${kf} `,onUnchanged:({from:e,to:t,prefix:n})=>`${n?.()??``}${ZS.default.cyan(e)} → ${ZS.default.gray(t)} ${ZS.default.gray(`(unchanged)`)}\n`,intro:({from:e,to:t,changes:n,prefix:r})=>{let i=n.filter(e=>e.added||e.removed).length;return`${r?.()??``}${ZS.default.cyan(e)} → ${ZS.default.gray(t)} (${i} change${i===1?``:`s`})\n${r?.()??``}\n`}});if(a.type===`unchanged`)continue;process.stdout.write(`${kf}\n`),process.stdout.write(a.diff);let o=await Vn({message:`Would you like to apply these changes?`,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}],initialValue:`yes`});if(_t(o)&&(Pn(`Canceled!`),process.exit(0)),o===`no`)continue;let s=yu(r.filePath,r.content);if(s.isErr())return(0,$.err)(s.error);n.push(M.relative(t.cwd,r.filePath))}return(0,$.ok)(n)}function mC(e,t,{config:n}){let r=e.reduce((e,r)=>{for(let i of r.files){let a=hC(i.type),o=t[`${a}/${r.name}`],s=n?.paths[`${a}/${r.name}`]&&n.paths[`${a}/${r.name}`]!==o?n.paths[`${a}/${r.name}`]:void 0,c=t[a],l=n?.paths[a]&&n.paths[a]!==c?n.paths[a]:void 0;e[`${a}/${r.name}`]=o?{path:o,alias:s}:{path:c,alias:l}}return e},{});for(let[e,i]of Object.entries(t)){if(e.includes(`/`))continue;let t=e,a=i,o=n?.paths[t]&&n.paths[t]!==a?n.paths[t]:void 0;a&&(r[t]={path:a,alias:o})}return r}function hC(e){return e.startsWith(`registry:`)?e.slice(9):e}function gC({format:e}={}){return{output:async(t,{cwd:n})=>{let r={name:t.name,authors:t.authors,bugs:t.bugs,description:t.description,homepage:t.homepage,repository:t.repository,tags:t.tags,version:t.version,meta:t.meta,type:`repository`,plugins:t.plugins,defaultPaths:t.defaultPaths,items:t.items.map(e=>({name:e.name,title:e.title,description:e.description,type:e.type,add:e.add,registryDependencies:e.registryDependencies,dependencies:e.dependencies,devDependencies:e.devDependencies,files:e.files.map(e=>({type:e.type,role:e.role,path:e.path,relativePath:gu(n,e.absolutePath),_imports_:e._imports_,target:e.target,registryDependencies:e.registryDependencies,dependencies:e.dependencies,devDependencies:e.devDependencies})),envVars:e.envVars,categories:e.categories,meta:e.meta}))};yu(z(n,py),Dy(r,{format:e}))},clean:async({cwd:e})=>{Su(z(e,py))}}}const _C=Uc({path:F().transform(e=>e),type:F(),role:R([R(jv.map(e=>el(e))),I()]),relativePath:F().transform(e=>e),_imports_:L(my),target:R([F(),I()]),registryDependencies:R([L(F()),I()]),dependencies:R([L(ly),I()]),devDependencies:R([L(ly),I()])}),vC=Uc({name:F(),title:R([F(),I()]),description:R([F(),I()]),type:F(),registryDependencies:R([L(F()),I()]),add:R([Av,I()]),files:R([L(_C),I()]).default([]),dependencies:R([L(R([ly,F()])),I()]),devDependencies:R([L(R([ly,F()])),I()]),envVars:R([Xc(F(),F()),I()]),categories:R([L(F()),I()]),meta:R([Xc(F(),F()),I()])}),yC=Kc(`type`,[jy,kv.extend({type:el(`repository`),plugins:R([dy,I()]),items:L(vC),defaultPaths:R([Xc(F(),F()),I()])})]),bC=`https://dev.azure.com`;function xC(e={}){return{name:`azure`,matches:e=>e.startsWith(bC)||e.startsWith(`azure/`)||e.startsWith(`azure:`),create:(t,n)=>SC.create(t,e,n),auth:{tokenStoredFor:`provider`,envVar:`AZURE_TOKEN`}}}var SC=class e{constructor(e,t){this.state=e,this.opts=t}static async create(t,n,r){return new e(await e.getState(t,n,r),n)}async fetch(t,{token:n,fetch:r=fetch}){let i=this.resolveRaw(t);try{let t={...e.authHeader(n)??{}},a=await r(i.toString(),{headers:t});if(!a.ok)throw a.headers.get(`content-type`)?.includes(`application/json`)?new l(`${a.status} ${(await a.json()).message??a.statusText}`,i.toString()):new l(`${a.status} ${a.statusText}`,i.toString());return await a.text()}catch(e){throw e instanceof l?new l(e.originalMessage,i.toString()):new l(`${e instanceof Error?e.message:String(e)}`,i.toString())}}static async getState(t,n,r){return e.parseUrl(t,n)}static parseUrl(e,t){let n=t.baseUrl??bC;e.startsWith(`azure:`)?n=new URL(e.slice(6)).origin:e.startsWith(bC)&&(n=bC);let[r,i,a,...o]=e.replaceAll(/(azure\/)|(azure:https?:\/\/[^/]+\/)/g,``).split(`/`),s=`main`,c=`heads`;return o[0]&&[`tags`,`heads`].includes(o[0])&&(c=o[0],o[1]&&o[1]!==``&&(s=o[1])),{baseUrl:n,owner:r,repoName:a,project:i,ref:s,refs:c}}resolveRaw(e){let{owner:t,repoName:n,project:r,ref:i,refs:a,baseUrl:o}=this.state,s=a===`tags`?`tag`:`branch`;return new URL(`${o}/${t}/${r}/_apis/git/repositories/${n}/items?path=${e}&api-version=7.2-preview.1&versionDescriptor.version=${i}&versionDescriptor.versionType=${s}`)}static authHeader(e){if(e)return{Authorization:`Bearer ${e}`}}};const CC=`https://bitbucket.org`,wC=`main`;function TC(e={}){return{name:`bitbucket`,matches:e=>e.startsWith(CC)||e.startsWith(`bitbucket/`)||e.startsWith(`bitbucket:`),create:(t,n)=>EC.create(t,e,n),auth:{tokenStoredFor:`provider`,envVar:`BITBUCKET_TOKEN`}}}var EC=class e{constructor(e,t){this.state=e,this.opts=t}static async create(t,n,r){return new e(await e.getState(t,n,r),n)}async fetch(t,{token:n,fetch:r=fetch}){let i=this.resolveRaw(t);try{let t={...e.authHeader(n)??{}},a=await r(i.toString(),{headers:t});if(!a.ok)throw a.headers.get(`content-type`)?.includes(`application/json`)?new l(`${a.status} ${(await a.json()).message??a.statusText}`,i.toString()):new l(`${a.status} ${a.statusText}`,i.toString());return await a.text()}catch(e){throw e instanceof l?new l(e.originalMessage,i.toString()):new l(`${e instanceof Error?e.message:String(e)}`,i.toString())}}static async getState(t,n,{token:r,fetch:i=fetch}){let a=e.parseUrl(t,n),{owner:o,repoName:s,ref:c,baseUrl:l}=a;if(c===void 0)try{let t=e.getApiUrl(a.baseUrl),n=await i(new URL(`/repositories/${o}/${s}`,t).toString(),{headers:e.authHeader(r)});c=n.ok?(await n.json()).mainbranch.name:wC}catch{c=wC}return{owner:o,ref:c,repoName:s,baseUrl:l}}static parseUrl(e,t){let n=t.baseUrl??CC;e.startsWith(`bitbucket:`)?n=new URL(e.slice(10)).origin:e.startsWith(CC)&&(n=CC);let[r,i,...a]=e.replaceAll(/(https:\/\/bitbucket.org\/)|(bitbucket\/)|(bitbucket:https?:\/\/[^/]+\/)/g,``).split(`/`),o;return a[0]===`src`&&(o=a[1]),{baseUrl:n,owner:r,repoName:i,ref:o}}static getApiUrl(e){let t=new URL(e??CC);return`${t.protocol}//api.${t.host}/2.0`}resolveRaw(t){let{owner:n,repoName:r,ref:i,baseUrl:a}=this.state;return new URL(`repositories/${n}/${r}/src/${i}/${t}`,`${e.getApiUrl(a)}/`)}static authHeader(e){if(e)return{Authorization:`Bearer ${e}`}}};function DC(e={}){return{name:`Fs`,matches:e=>e.startsWith(`fs://`),create:(t,n)=>OC.create(t,e,n)}}var OC=class e{constructor(e,t){this.state=e,this.opts=t}async fetch(e){let t=z(this.state.path,e);try{return vu(t)._unsafeUnwrap()}catch(e){let n=M.isAbsolute(t)?t:M.join(process.cwd(),t);throw e instanceof l?new l(e.originalMessage,n):new l(`${e instanceof Error?e.message:String(e)}`,n)}}static async create(t,n,r){let i=t.slice(5),a;return a=n.baseDir?n.baseDir.startsWith(`.`)?z(r.cwd,n.baseDir,i):z(n.baseDir,i):i.startsWith(`.`)?z(r.cwd,i):i,new e({path:a},n)}};const kC=`https://github.com`,AC=`main`;function jC(e={}){return{name:`github`,matches:t=>t.startsWith(e.baseUrl??kC)||t.startsWith(`github/`)||t.startsWith(`github:`),create:(t,n)=>MC.create(t,e,n),auth:{tokenStoredFor:`provider`,envVar:`GITHUB_TOKEN`}}}var MC=class e{constructor(e,t){this.state=e,this.opts=t}static async create(t,n,r){return new e(await e.getState(t,n,r),n)}async fetch(t,{token:n,fetch:r=fetch}){let i=this.resolveRaw(t);try{let t={...e.authHeader(n)??{},Accept:`application/vnd.github.raw+json`},a=await r(i.toString(),{headers:t});if(!a.ok)throw a.headers.get(`content-type`)?.includes(`application/json`)?new l(`${a.status} ${(await a.json()).message??a.statusText}`,i.toString()):new l(`${a.status} ${a.statusText}`,i.toString());return await a.text()}catch(e){throw e instanceof l?new l(e.originalMessage,i.toString()):new l(`${e instanceof Error?e.message:String(e)}`,i.toString())}}static async getState(t,n,{token:r,fetch:i=fetch}){let{owner:a,repoName:o,ref:s}=e.parseUrl(t,n);if(s===void 0)try{let t=e.getApiUrl(n.baseUrl??kC),c=await i(new URL(`/repos/${a}/${o}`,t).toString(),{headers:e.authHeader(r)});s=c.ok?(await c.json()).default_branch:AC}catch{s=AC}return{owner:a,ref:s,repoName:o,url:t,baseUrl:n.baseUrl??kC}}static parseUrl(e,t){let n=t.baseUrl??kC;e.startsWith(`github:`)?n=new URL(e.slice(7)).origin:e.startsWith(kC)&&(n=kC);let[r,i,...a]=e.replaceAll(/github\/|https:\/\/github\.com\/|github:https?:\/\/[^/]+\//g,``).split(`/`),o;if(a.length>0&&a[0]===`tree`&&a[1]&&(o=a[1]),!r||!i)throw Error(`Failed to parse invalid URL: ${e}`);return{baseUrl:n,owner:r,repoName:i,ref:o}}resolveRaw(t){let{owner:n,repoName:r,ref:i,baseUrl:a}=this.state;return new URL(`${t}?ref=${i}`,`${e.getApiUrl(a)}/repos/${n}/${r}/contents/`)}static getApiUrl(e){let t=new URL(e??kC);return`${t.protocol}//api.${t.host}`}static authHeader(e){if(e)return{Authorization:`Bearer ${e}`}}};const NC=`https://gitlab.com`,PC=`main`;function FC(e={}){return{name:`gitlab`,matches:t=>t.startsWith(e.baseUrl??NC)||t.startsWith(`gitlab/`)||t.startsWith(`gitlab:`),create:(t,n)=>IC.create(t,e,n),auth:{tokenStoredFor:`provider`,envVar:`GITLAB_TOKEN`}}}var IC=class e{constructor(e,t){this.state=e,this.opts=t}static async create(t,n,r){return new e(await e.getState(t,n,r),n)}async fetch(t,{token:n,fetch:r=fetch}){let i=this.resolveRaw(t);try{let t={...e.authHeader(n)??{}},a=await r(i.toString(),{headers:t});if(!a.ok)throw a.headers.get(`content-type`)?.includes(`application/json`)?new l(`${a.status} ${(await a.json()).message??a.statusText}`,i.toString()):new l(`${a.status} ${a.statusText}`,i.toString());return await a.text()}catch(e){throw e instanceof l?new l(e.originalMessage,i.toString()):new l(`${e instanceof Error?e.message:String(e)}`,i.toString())}}static async getState(t,n,{token:r,fetch:i=fetch}){let a=e.parseUrl(t,n),{id:o,ref:s}=a;if(s===void 0)try{let t=e.getApiUrl(a.baseUrl),n=await i(new URL(`/projects/${encodeURIComponent(o)}`,t).toString(),{headers:e.authHeader(r)});s=n.ok?(await n.json()).default_branch:PC}catch{s=PC}return{id:o,ref:s,url:t,baseUrl:n.baseUrl??NC}}static parseUrl(e,t){let n=t.baseUrl??NC;e.startsWith(`gitlab:`)?n=new URL(e.slice(7)).origin:e.startsWith(NC)&&(n=NC);let r=e.replaceAll(/gitlab\/|https:\/\/gitlab\.com\/|gitlab:https?:\/\/[^/]+\//g,``),i=r,a=r.indexOf(`/-/tree/`),o;if(a!==-1){o=r.slice(a+8);let e=o.indexOf(`?`);e!==-1&&(o=o.slice(0,e)),i=i.slice(0,a)}return{baseUrl:n,id:i,ref:o,url:e}}static getApiUrl(e){let t=new URL(e??NC);return`${t.protocol}//${t.host}/api/v4`}resolveRaw(t){let{id:n,ref:r,baseUrl:i}=this.state;return new URL(`projects/${encodeURIComponent(n)}/repository/files/${encodeURIComponent(t)}/raw?ref=${r}`,`${e.getApiUrl(i)}/`)}static authHeader(e){if(e)return{"PRIVATE-TOKEN":e}}};function LC(e){let t=e;return t.endsWith(`/`)||(t=`${t}/`),t}function RC(e={}){return{name:`http`,matches:t=>e.baseUrl?t.startsWith(e.baseUrl):t.startsWith(`http`),create:t=>zC.create(t,e),auth:{tokenStoredFor:`registry`}}}var zC=class e{constructor(e,t){this.state=e,this.opts=t}async fetch(e,{token:t,fetch:n=fetch}){let r=this.resolveRaw(e);try{let e={...this.authHeader(t)??{}},i=await n(r.toString(),{headers:e});if(!i.ok)throw i.headers.get(`content-type`)?.includes(`application/json`)?new l(`${i.status} ${(await i.json()).message??i.statusText}`,r.toString()):new l(`${i.status} ${i.statusText}`,r.toString());return await i.text()}catch(e){throw e instanceof l?new l(e.originalMessage,r.toString()):new l(`${e instanceof Error?e.message:String(e)}`,r.toString())}}resolveRaw(e){return new URL(e,LC(this.state.url))}authHeader(e){if(e)return this.opts.authHeader?this.opts.authHeader(e):{Authorization:`Bearer ${e}`}}static async create(t,n){return new e({url:t},n)}},BC=i(p(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(h(`child_process`),h(`crypto`)):typeof define==`function`&&define.amd?define([`child_process`,`crypto`],r):typeof e==`object`?e[`electron-machine-id`]=r(h(`child_process`),h(`crypto`)):n[`electron-machine-id`]=r(n.child_process,n.crypto)})(e,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p=``,t(0)}([function(e,t,n){e.exports=n(34)},function(e,t,n){var r=n(29)(`wks`),i=n(33),a=n(2).Symbol,o=typeof a==`function`,s=e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)(`Symbol.`+e))};s.store=r},function(e,t){var n=e.exports=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)();typeof __g==`number`&&(__g=n)},function(e,t,n){var r=n(9);e.exports=function(e){if(!r(e))throw TypeError(e+` is not an object!`);return e}},function(e,t,n){e.exports=!n(24)(function(){return Object.defineProperty({},`a`,{get:function(){return 7}}).a!=7})},function(e,t,n){var r=n(12),i=n(17);e.exports=n(4)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n=e.exports={version:`2.4.0`};typeof __e==`number`&&(__e=n)},function(e,t,n){var r=n(14);e.exports=function(e,t,n){if(r(e),t===void 0)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports=function(e){return typeof e==`object`?e!==null:typeof e==`function`}},function(e,t){e.exports={}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(3),i=n(26),a=n(32),o=Object.defineProperty;t.f=n(4)?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch{}if(`get`in n||`set`in n)throw TypeError(`Accessors not supported!`);return`value`in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(42),i=n(15);e.exports=function(e){return r(i(e))}},function(e,t){e.exports=function(e){if(typeof e!=`function`)throw TypeError(e+` is not a function!`);return e}},function(e,t){e.exports=function(e){if(e==null)throw TypeError(`Can't call method on `+e);return e}},function(e,t,n){var r=n(9),i=n(2).document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(12).f,i=n(8),a=n(1)(`toStringTag`);e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,n){var r=n(29)(`keys`),i=n(33);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(11),i=n(1)(`toStringTag`),a=r(function(){return arguments}())==`Arguments`,o=function(e,t){try{return e[t]}catch{}};e.exports=function(e){var t,n,s;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=o(t=Object(e),i))==`string`?n:a?r(t):(s=r(t))==`Object`&&typeof t.callee==`function`?`Arguments`:s}},function(e,t){e.exports=`constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf`.split(`,`)},function(e,t,n){var r=n(2),i=n(6),a=n(7),o=n(5),s=`prototype`,c=function(e,t,n){var l,u,d,f=e&c.F,p=e&c.G,m=e&c.S,h=e&c.P,g=e&c.B,_=e&c.W,v=p?i:i[t]||(i[t]={}),y=v[s],b=p?r:m?r[t]:(r[t]||{})[s];for(l in p&&(n=t),n)u=!f&&b&&b[l]!==void 0,u&&l in v||(d=u?b[l]:n[l],v[l]=p&&typeof b[l]!=`function`?n[l]:g&&u?a(d,r):_&&b[l]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t[s]=e[s],t}(d):h&&typeof d==`function`?a(Function.call,d):d,h&&((v.virtual||={})[l]=d,e&c.R&&y&&!y[l]&&o(y,l,d)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t){e.exports=function(e){try{return!!e()}catch{return!0}}},function(e,t,n){e.exports=n(2).document&&document.documentElement},function(e,t,n){e.exports=!n(4)&&!n(24)(function(){return Object.defineProperty(n(16)(`div`),`a`,{get:function(){return 7}}).a!=7})},function(e,t,n){var r=n(28),i=n(23),a=n(57),o=n(5),s=n(8),c=n(10),l=n(45),u=n(18),d=n(52),f=n(1)(`iterator`),p=!([].keys&&`next`in[].keys()),m=`@@iterator`,h=`keys`,g=`values`,_=function(){return this};e.exports=function(e,t,n,v,y,b,x){l(n,t,v);var S,C,w,ee=function(e){if(!p&&e in T)return T[e];switch(e){case h:return function(){return new n(this,e)};case g:return function(){return new n(this,e)}}return function(){return new n(this,e)}},te=t+` Iterator`,ne=y==g,re=!1,T=e.prototype,E=T[f]||T[m]||y&&T[y],ie=E||ee(y),ae=y?ne?ee(`entries`):ie:void 0,oe=t==`Array`&&T.entries||E;if(oe&&(w=d(oe.call(new e)),w!==Object.prototype&&(u(w,te,!0),r||s(w,f)||o(w,f,_))),ne&&E&&E.name!==g&&(re=!0,ie=function(){return E.call(this)}),r&&!x||!p&&!re&&T[f]||o(T,f,ie),c[t]=ie,c[te]=_,y)if(S={values:ne?ie:ee(g),keys:b?ie:ee(h),entries:ae},x)for(C in S)C in T||a(T,C,S[C]);else i(i.P+i.F*(p||re),t,S);return S}},function(e,t){e.exports=!0},function(e,t,n){var r=n(2),i=`__core-js_shared__`,a=r[i]||(r[i]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t,n){var r,i,a,o=n(7),s=n(41),c=n(25),l=n(16),u=n(2),d=u.process,f=u.setImmediate,p=u.clearImmediate,m=u.MessageChannel,h=0,g={},_=`onreadystatechange`,v=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},y=function(e){v.call(e.data)};f&&p||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++h]=function(){s(typeof e==`function`?e:Function(e),t)},r(h),h},p=function(e){delete g[e]},n(11)(d)==`process`?r=function(e){d.nextTick(o(v,e,1))}:m?(i=new m,a=i.port2,i.port1.onmessage=y,r=o(a.postMessage,a,1)):u.addEventListener&&typeof postMessage==`function`&&!u.importScripts?(r=function(e){u.postMessage(e+``,`*`)},u.addEventListener(`message`,y,!1)):r=_ in l(`script`)?function(e){c.appendChild(l(`script`))[_]=function(){c.removeChild(this),v.call(e)}}:function(e){setTimeout(o(v,e,1),0)}),e.exports={set:f,clear:p}},function(e,t,n){var r=n(20),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(9);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&typeof(n=e.toString)==`function`&&!r(i=n.call(e))||typeof(n=e.valueOf)==`function`&&!r(i=n.call(e))||!t&&typeof(n=e.toString)==`function`&&!r(i=n.call(e)))return i;throw TypeError(`Can't convert object to primitive value`)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return`Symbol(${e===void 0?``:e})_${(++n+r).toString(36)}`}},function(e,t,n){function r(e){return e&&e.__esModule?e:{default:e}}function i(){return process.platform===`win32`?process.arch===`ia32`&&process.env.hasOwnProperty(`PROCESSOR_ARCHITEW6432`)?`mixed`:`native`:``}function a(e){return(0,d.createHash)(`sha256`).update(e).digest(`hex`)}function o(e){switch(f){case`darwin`:return e.split(`IOPlatformUUID`)[1].split(`
|
|
156
156
|
`)[0].replace(/\=|\s+|\"/gi,``).toLowerCase();case`win32`:return e.toString().split(`REG_SZ`)[1].replace(/\r+|\n+|\s+/gi,``).toLowerCase();case`linux`:return e.toString().replace(/\r+|\n+|\s+/gi,``).toLowerCase();case`freebsd`:return e.toString().replace(/\r+|\n+|\s+/gi,``).toLowerCase();default:throw Error(`Unsupported platform: `+process.platform)}}function s(e){var t=o((0,u.execSync)(p[f]).toString());return e?t:a(t)}function c(e){return new l.default(function(t,n){return(0,u.exec)(p[f],{},function(r,i,s){if(r)return n(Error(`Error while obtaining machine id: `+r.stack));var c=o(i.toString());return t(e?c:a(c))})})}Object.defineProperty(t,`__esModule`,{value:!0});var l=r(n(35));t.machineIdSync=s,t.machineId=c;var u=n(70),d=n(71),f=process.platform,p={darwin:`ioreg -rd1 -c IOPlatformExpertDevice`,win32:{native:`%windir%\\System32`,mixed:`%windir%\\sysnative\\cmd.exe /c %windir%\\System32`}[i()]+`\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,linux:`( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :`,freebsd:`kenv -q smbios.system.uuid || sysctl -n kern.hostuuid`}},function(e,t,n){e.exports={default:n(36),__esModule:!0}},function(e,t,n){n(66),n(68),n(69),n(67),e.exports=n(6).Promise},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||r!==void 0&&r in e)throw TypeError(n+`: incorrect invocation!`);return e}},function(e,t,n){var r=n(13),i=n(31),a=n(62);e.exports=function(e){return function(t,n,o){var s,c=r(t),l=i(c.length),u=a(o,l);if(e&&n!=n){for(;l>u;)if(s=c[u++],s!=s)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(7),i=n(44),a=n(43),o=n(3),s=n(31),c=n(64),l={},u={},t=e.exports=function(e,t,n,d,f){var p,m,h,g,_=f?function(){return e}:c(e),v=r(n,d,t?2:1),y=0;if(typeof _!=`function`)throw TypeError(e+` is not iterable!`);if(a(_)){for(p=s(e.length);p>y;y++)if(g=t?v(o(m=e[y])[0],m[1]):v(e[y]),g===l||g===u)return g}else for(h=_.call(e);!(m=h.next()).done;)if(g=i(h,v,m.value,t),g===l||g===u)return g};t.BREAK=l,t.RETURN=u},function(e,t){e.exports=function(e,t,n){var r=n===void 0;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(11);e.exports=Object(`z`).propertyIsEnumerable(0)?Object:function(e){return r(e)==`String`?e.split(``):Object(e)}},function(e,t,n){var r=n(10),i=n(1)(`iterator`),a=Array.prototype;e.exports=function(e){return e!==void 0&&(r.Array===e||a[i]===e)}},function(e,t,n){var r=n(3);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw a!==void 0&&r(a.call(e)),t}}},function(e,t,n){var r=n(49),i=n(17),a=n(18),o={};n(5)(o,n(1)(`iterator`),function(){return this}),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),a(e,t+` Iterator`)}},function(e,t,n){var r=n(1)(`iterator`),i=!1;try{var a=[7][r]();a.return=function(){i=!0},Array.from(a,function(){throw 2})}catch{}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:n=!0}},a[r]=function(){return o},e(a)}catch{}return n}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(2),i=n(30).set,a=r.MutationObserver||r.WebKitMutationObserver,o=r.process,s=r.Promise,c=n(11)(o)==`process`;e.exports=function(){var e,t,n,l=function(){var r,i;for(c&&(r=o.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(c)n=function(){o.nextTick(l)};else if(a){var u=!0,d=document.createTextNode(``);new a(l).observe(d,{characterData:!0}),n=function(){d.data=u=!u}}else if(s&&s.resolve){var f=s.resolve();n=function(){f.then(l)}}else n=function(){i.call(r,l)};return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){var r=n(3),i=n(50),a=n(22),o=n(19)(`IE_PROTO`),s=function(){},c=`prototype`,l=function(){var e,t=n(16)(`iframe`),r=a.length,i=`>`;for(t.style.display=`none`,n(25).appendChild(t),t.src=`javascript:`,e=t.contentWindow.document,e.open(),e.write(`<script>document.F=Object<\/script`+i),e.close(),l=e.F;r--;)delete l[c][a[r]];return l()};e.exports=Object.create||function(e,t){var n;return e===null?n=l():(s[c]=r(e),n=new s,s[c]=null,n[o]=e),t===void 0?n:i(n,t)}},function(e,t,n){var r=n(12),i=n(3),a=n(54);e.exports=n(4)?Object.defineProperties:function(e,t){i(e);for(var n,o=a(t),s=o.length,c=0;s>c;)r.f(e,n=o[c++],t[n]);return e}},function(e,t,n){var r=n(55),i=n(17),a=n(13),o=n(32),s=n(8),c=n(26),l=Object.getOwnPropertyDescriptor;t.f=n(4)?l:function(e,t){if(e=a(e),t=o(t,!0),c)try{return l(e,t)}catch{}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){var r=n(8),i=n(63),a=n(19)(`IE_PROTO`),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,a)?e[a]:typeof e.constructor==`function`&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,n){var r=n(8),i=n(13),a=n(39)(!1),o=n(19)(`IE_PROTO`);e.exports=function(e,t){var n,s=i(e),c=0,l=[];for(n in s)n!=o&&r(s,n)&&l.push(n);for(;t.length>c;)r(s,n=t[c++])&&(~a(l,n)||l.push(n));return l}},function(e,t,n){var r=n(53),i=n(22);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(5);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t,n){e.exports=n(5)},function(e,t,n){var r=n(9),i=n(3),a=function(e,t){if(i(e),!r(t)&&t!==null)throw TypeError(t+`: can't set as prototype!`)};e.exports={set:Object.setPrototypeOf||(`__proto__`in{}?function(e,t,r){try{r=n(7)(Function.call,n(51).f(Object.prototype,`__proto__`).set,2),r(e,[]),t=!(e instanceof Array)}catch{t=!0}return function(e,n){return a(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:a}},function(e,t,n){var r=n(2),i=n(6),a=n(12),o=n(4),s=n(1)(`species`);e.exports=function(e){var t=typeof i[e]==`function`?i[e]:r[e];o&&t&&!t[s]&&a.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(3),i=n(14),a=n(1)(`species`);e.exports=function(e,t){var n,o=r(e).constructor;return o===void 0||(n=r(o)[a])==null?t:i(n)}},function(e,t,n){var r=n(20),i=n(15);e.exports=function(e){return function(t,n){var a,o,s=String(i(t)),c=r(n),l=s.length;return c<0||c>=l?e?``:void 0:(a=s.charCodeAt(c),a<55296||a>56319||c+1===l||(o=s.charCodeAt(c+1))<56320||o>57343?e?s.charAt(c):a:e?s.slice(c,c+2):(a-55296<<10)+(o-56320)+65536)}}},function(e,t,n){var r=n(20),i=Math.max,a=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):a(e,t)}},function(e,t,n){var r=n(15);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(21),i=n(1)(`iterator`),a=n(10);e.exports=n(6).getIteratorMethod=function(e){if(e!=null)return e[i]||e[`@@iterator`]||a[r(e)]}},function(e,t,n){var r=n(37),i=n(47),a=n(10),o=n(13);e.exports=n(27)(Array,`Array`,function(e,t){this._t=o(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):t==`keys`?i(0,n):t==`values`?i(0,e[n]):i(0,[n,e[n]])},`values`),a.Arguments=a.Array,r(`keys`),r(`values`),r(`entries`)},function(e,t){},function(e,t,n){var r,i,a,o=n(28),s=n(2),c=n(7),l=n(21),u=n(23),d=n(9),f=(n(3),n(14)),p=n(38),m=n(40),h=(n(58).set,n(60)),g=n(30).set,_=n(48)(),v=`Promise`,y=s.TypeError,b=s.process,x=s[v],b=s.process,S=l(b)==`process`,C=function(){},w=!!function(){try{var e=x.resolve(1),t=(e.constructor={})[n(1)(`species`)]=function(e){e(C,C)};return(S||typeof PromiseRejectionEvent==`function`)&&e.then(C)instanceof t}catch{}}(),ee=function(e,t){return e===t||e===x&&t===a},te=function(e){var t;return!(!d(e)||typeof(t=e.then)!=`function`)&&t},ne=function(e){return ee(x,e)?new re(e):new i(e)},re=i=function(e){var t,n;this.promise=new e(function(e,r){if(t!==void 0||n!==void 0)throw y(`Bad Promise constructor`);t=e,n=r}),this.resolve=f(t),this.reject=f(n)},T=function(e){try{e()}catch(e){return{error:e}}},E=function(e,t){if(!e._n){e._n=!0;var n=e._c;_(function(){for(var r=e._v,i=e._s==1,a=0,o=function(t){var n,a,o=i?t.ok:t.fail,s=t.resolve,c=t.reject,l=t.domain;try{o?(i||(e._h==2&&oe(e),e._h=1),o===!0?n=r:(l&&l.enter(),n=o(r),l&&l.exit()),n===t.promise?c(y(`Promise-chain cycle`)):(a=te(n))?a.call(n,s,c):s(n)):c(r)}catch(e){c(e)}};n.length>a;)o(n[a++]);e._c=[],e._n=!1,t&&!e._h&&ie(e)})}},ie=function(e){g.call(s,function(){var t,n,r,i=e._v;if(ae(e)&&(t=T(function(){S?b.emit(`unhandledRejection`,i,e):(n=s.onunhandledrejection)?n({promise:e,reason:i}):(r=s.console)&&r.error&&r.error(`Unhandled promise rejection`,i)}),e._h=S||ae(e)?2:1),e._a=void 0,t)throw t.error})},ae=function(e){if(e._h==1)return!1;for(var t,n=e._a||e._c,r=0;n.length>r;)if(t=n[r++],t.fail||!ae(t.promise))return!1;return!0},oe=function(e){g.call(s,function(){var t;S?b.emit(`rejectionHandled`,e):(t=s.onrejectionhandled)&&t({promise:e,reason:e._v})})},se=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||=t._c.slice(),E(t,!0))},D=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw y(`Promise can't be resolved itself`);(t=te(e))?_(function(){var r={_w:n,_d:!1};try{t.call(e,c(D,r,1),c(se,r,1))}catch(e){se.call(r,e)}}):(n._v=e,n._s=1,E(n,!1))}catch(e){se.call({_w:n,_d:!1},e)}}};w||(x=function(e){p(this,x,v,`_h`),f(e),r.call(this);try{e(c(D,this,1),c(se,this,1))}catch(e){se.call(this,e)}},r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(56)(x.prototype,{then:function(e,t){var n=ne(h(this,x));return n.ok=typeof e!=`function`||e,n.fail=typeof t==`function`&&t,n.domain=S?b.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&E(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),re=function(){var e=new r;this.promise=e,this.resolve=c(D,e,1),this.reject=c(se,e,1)}),u(u.G+u.W+u.F*!w,{Promise:x}),n(18)(x,v),n(59)(v),a=n(6)[v],u(u.S+u.F*!w,v,{reject:function(e){var t=ne(this),n=t.reject;return n(e),t.promise}}),u(u.S+u.F*(o||!w),v,{resolve:function(e){if(e instanceof x&&ee(e.constructor,this))return e;var t=ne(this),n=t.resolve;return n(e),t.promise}}),u(u.S+u.F*!(w&&n(46)(function(e){x.all(e).catch(C)})),v,{all:function(e){var t=this,n=ne(t),r=n.resolve,i=n.reject,a=T(function(){var n=[],a=0,o=1;m(e,!1,function(e){var s=a++,c=!1;n.push(void 0),o++,t.resolve(e).then(function(e){c||(c=!0,n[s]=e,--o||r(n))},i)}),--o||r(n)});return a&&i(a.error),n.promise},race:function(e){var t=this,n=ne(t),r=n.reject,i=T(function(){m(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i&&r(i.error),n.promise}})},function(e,t,n){var r=n(61)(!0);n(27)(String,`String`,function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(65);for(var r=n(2),i=n(5),a=n(10),o=n(1)(`toStringTag`),s=[`NodeList`,`DOMTokenList`,`MediaList`,`StyleSheetList`,`CSSRuleList`],c=0;c<5;c++){var l=s[c],u=r[l],d=u&&u.prototype;d&&!d[o]&&i(d,o,l),a[l]=a.Array}},function(e,t){e.exports=h(`child_process`)},function(e,t){e.exports=h(`crypto`)}])})}))(),1);const VC=/^(?![-0-9])(?!.*--)[a-z0-9]*(?:-[a-z0-9]+)*$/i,HC=`https://www.jsrepo.com`;function UC(e={}){let t=e.baseUrl??HC;return{name:`jsrepo`,matches:e=>e.startsWith(`@`),create:(t,n)=>WC.create(t,e,n),auth:{tokenStoredFor:`provider`,envVar:`JSREPO_TOKEN`,getToken:e=>GC(e,t)},baseUrl:t}}var WC=class e{constructor(e,t){this.state=e,this.opts=t}static async create(t,n,r){return new e(await e.getState(t,n),n)}async fetch(t,{token:n,fetch:r=fetch}){let i=this.resolveRaw(t);try{let t={...e.authHeader(n)??{}},a=await r(i.toString(),{headers:t});if(!a.ok)throw a.headers.get(`content-type`)?.includes(`application/json`)?new l(`${a.status} ${(await a.json()).message??a.statusText}`,i.toString()):new l(`${a.status} ${a.statusText}`,i.toString());return await a.text()}catch(e){throw e instanceof l?new l(e.originalMessage,i.toString()):new l(`${e instanceof Error?e.message:String(e)}`,i.toString())}}static async getState(t,n){return{...e.parseUrl(t),baseUrl:n.baseUrl??HC}}static parseUrl(e){let[t,n,...r]=e.split(`/`);if(!t||!n)throw Error(`Failed to parse invalid URL: ${e}`);let[i,a]=n.split(`@`);if(!i)throw Error(`Failed to parse invalid URL: ${e}`);let o;return r.length>0&&(o=r.join(`/`)),{url:`${t}/${n}`,specifier:o,scope:t,registryName:i,version:a??`latest`}}resolveRaw(e){let{scope:t,registryName:n,version:r,baseUrl:i}=this.state;return new URL(`${LC(i)}api/scopes/${t}/${n}/v/${r}/files/${e}`)}static authHeader(e){if(e)return{"x-api-key":e}}};const GC=async({p:e},t)=>{let n=BC.default.machineIdSync(!0),r;try{let e=await fetch(`${t}/api/login/device`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({hardwareId:n})});if(!e.ok)throw Error(`There was an error creating the session`);r=(await e.json()).id}catch(e){throw new E(e instanceof Error?e.message:String(e),{suggestion:`Please try again.`})}e.log.step(`Sign in at ${e.color.cyan(`${t}/login/device/${r}`)}`);let i=e.spinner(),a=setTimeout(()=>{throw i.stop(`You never signed in.`),new E(`Session timed out!`,{suggestion:`Please try again.`})},54e6);for(i.start(`Waiting for you to sign in...`);;){await Dl(5e3);let e=`${t}/api/login/device/${r}`;try{let t=await fetch(e,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({hardwareId:n})});if(!t.ok)continue;clearTimeout(a);let r=await t.text();return i.stop(`Done`),r}catch{}}};var KC=i(Kn(),1);const qC=[UC(),jC(),FC(),TC(),xC(),RC()];async function JC(e,t){try{return jl(yC,await e.fetch(py,t))}catch(e){return(0,KC.err)(new d(e))}}export{yd as $,Pv as A,_t as At,mm as B,pC as C,Ln as Ct,py as D,Rn as Dt,Dy as E,Pn as Et,Ov as F,Sf as G,fm as H,wv as I,Tf as J,bf as K,xv as L,Rv as M,Le as Mt,jv as N,ze as Nt,gy as O,Gn as Ot,Mv as P,vd as Q,vv as R,eC as S,An as St,Oy as T,In as Tt,pm as U,xm as V,vm as W,Ef as X,wf as Y,Ed as Z,$S as _,sr as _t,RC as a,jl as at,QS as b,Bn as bt,DC as c,Cl as ct,yC as d,Fc as dt,hd as et,gC as f,jc as ft,hC as g,M as gt,lC as h,F as ht,UC as i,z as it,Iv as j,Re as jt,hy as k,jn as kt,TC as l,Qc as lt,dC as m,Xc as mt,JC as n,vu as nt,FC as o,Al as ot,oC as p,Uc as pt,yf as q,VC as r,yu as rt,jC as s,El as st,qC as t,Cu as tt,xC as u,L as ut,fC as v,Kn as vt,XS as w,Nn as wt,tC as x,Vn as xt,uC as y,Mn as yt,Sm as z};
|
|
157
|
-
//# sourceMappingURL=providers-
|
|
157
|
+
//# sourceMappingURL=providers-BD5Z5zBT.js.map
|