@gjsify/cli 0.64.16 → 0.64.17-next.292

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/cli.gjs.mjs CHANGED
@@ -145,7 +145,7 @@ fi
145
145
  `)}`:``;n.fail(N(`Missing required argument: %s`,`Missing required arguments: %s`,Object.keys(C).length,Object.keys(C).join(`, `)+S))}},F.unknownArguments=function unknownArguments(S,C,I,H,W=!0){let q=t.getInternalMethods().getCommandInstance().getCommands(),Y=[],X=t.getInternalMethods().getContext();if(Object.keys(S).forEach(n=>{!Ap.includes(n)&&!Object.prototype.hasOwnProperty.call(I,n)&&!Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),n)&&!F.isValidAndSomeAliasIsNotNew(n,C)&&Y.push(n)}),W&&(X.commands.length>0||q.length>0||H)&&S._.slice(X.commands.length).forEach(t=>{q.includes(``+t)||Y.push(``+t)}),W){let n=t.getDemandedCommands()._?.max||0,C=X.commands.length+n;C<S._.length&&S._.slice(C).forEach(t=>{t=String(t),!X.commands.includes(t)&&!Y.includes(t)&&Y.push(t)})}Y.length&&n.fail(N(`Unknown argument: %s`,`Unknown arguments: %s`,Y.length,Y.map(t=>t.trim()?t:`"${t}"`).join(`, `)))},F.unknownCommands=function unknownCommands(S){let C=t.getInternalMethods().getCommandInstance().getCommands(),F=[],I=t.getInternalMethods().getContext();return(I.commands.length>0||C.length>0)&&S._.slice(I.commands.length).forEach(t=>{C.includes(``+t)||F.push(``+t)}),F.length>0?(n.fail(N(`Unknown command: %s`,`Unknown commands: %s`,F.length,F.join(`, `))),!0):!1},F.isValidAndSomeAliasIsNotNew=function isValidAndSomeAliasIsNotNew(n,S){if(!Object.prototype.hasOwnProperty.call(S,n))return!1;let C=t.parsed.newAliases;return[n,...S[n]].some(t=>!Object.prototype.hasOwnProperty.call(C,t)||!C[n])},F.limitedChoices=function limitedChoices(S){let N=t.getOptions(),F={};if(!Object.keys(N.choices).length)return;Object.keys(S).forEach(t=>{Ap.indexOf(t)===-1&&Object.prototype.hasOwnProperty.call(N.choices,t)&&[].concat(S[t]).forEach(n=>{N.choices[t].indexOf(n)===-1&&n!==void 0&&(F[t]=(F[t]||[]).concat(n))})});let I=Object.keys(F);if(!I.length)return;let H=C(`Invalid values:`);I.forEach(t=>{H+=`\n ${C(`Argument: %s, Given: %s, Choices: %s`,t,n.stringifiedValues(F[t]),n.stringifiedValues(N.choices[t]))}`}),n.fail(H)};let I={};F.implies=function implies(n,C){argsert(`<string|object> [array|number|string]`,[n,C],arguments.length),typeof n==`object`?Object.keys(n).forEach(t=>{F.implies(t,n[t])}):(t.global(n),I[n]||(I[n]=[]),Array.isArray(C)?C.forEach(t=>F.implies(n,t)):(assertNotStrictEqual(C,void 0,S),I[n].push(C)))},F.getImplied=function getImplied(){return I};function keyExists(t,n){let S=Number(n);return n=isNaN(S)?n:S,typeof n==`number`?n=t._.length>=n:n.match(/^--no-.+/)?(n=n.match(/^--no-(.+)/)[1],n=!Object.prototype.hasOwnProperty.call(t,n)):n=Object.prototype.hasOwnProperty.call(t,n),n}F.implications=function implications(t){let S=[];if(Object.keys(I).forEach(n=>{let C=n;(I[n]||[]).forEach(n=>{let N=C,F=n;N=keyExists(t,N),n=keyExists(t,n),N&&!n&&S.push(` ${C} -> ${F}`)})}),S.length){let t=`${C(`Implications failed:`)}\n`;S.forEach(n=>{t+=n}),n.fail(t)}};let H={};F.conflicts=function conflicts(n,S){argsert(`<string|object> [array|string]`,[n,S],arguments.length),typeof n==`object`?Object.keys(n).forEach(t=>{F.conflicts(t,n[t])}):(t.global(n),H[n]||(H[n]=[]),Array.isArray(S)?S.forEach(t=>F.conflicts(n,t)):H[n].push(S))},F.getConflicting=()=>H,F.conflicting=function conflictingFn(N){Object.keys(N).forEach(t=>{H[t]&&H[t].forEach(S=>{S&&N[t]!==void 0&&N[S]!==void 0&&n.fail(C(`Arguments %s and %s are mutually exclusive`,t,S))})}),t.getInternalMethods().getParserConfiguration()[`strip-dashed`]&&Object.keys(H).forEach(t=>{H[t].forEach(F=>{F&&N[S.Parser.camelCase(t)]!==void 0&&N[S.Parser.camelCase(F)]!==void 0&&n.fail(C(`Arguments %s and %s are mutually exclusive`,t,F))})})},F.recommendCommands=function recommendCommands(t,S){S=S.sort((t,n)=>n.length-t.length);let N=null,F=1/0;for(let n=0,C;(C=S[n])!==void 0;n++){let n=levenshtein(t,C);n<=3&&n<F&&(F=n,N=C)}N&&n.fail(C(`Did you mean %s?`,N))},F.reset=function reset(t){return I=objFilter(I,n=>!t[n]),H=objFilter(H,n=>!t[n]),F};let W=[];return F.freeze=function freeze(){W.push({implied:I,conflicting:H})},F.unfreeze=function unfreeze(){let t=W.pop();assertNotStrictEqual(t,void 0,S),{implied:I,conflicting:H}=t},F}var Ap,jp=__esmMin(()=>{gp(),fp(),kp(),Sp(),Ap=[`$0`,`--`,`_`]});function YargsFactory(t){return(n=[],S=t.process.cwd(),C)=>{let N=new YargsInstance(n,S,C,t);return Object.defineProperty(N,"argv",{get:()=>N.parse(),enumerable:!0}),N.help(),N.version(),N}}function isYargsInstance(t){return!!t&&typeof t.getInternalMethods==`function`}var __classPrivateFieldSet,__classPrivateFieldGet,Mp,Np,Pp,Fp,Ip,Lp,Rp,zp,Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm,Em,Dm,Om,km,Am,jm,Mm,Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm,Um,Wm,Gm,Km,qm,Jm,Ym,Xm,YargsInstance,Zm=__esmMin(()=>{_e(),xp(),fp(),jl(),wp(),gp(),Op(),jp(),Sp(),Pl(),vp(),pp(),yp(),Cp(),__classPrivateFieldSet=function(t,n,S,C,N){if(C===`m`)throw TypeError(`Private method is not writable`);if(C===`a`&&!N)throw TypeError(`Private accessor was defined without a setter`);if(typeof n==`function`?t!==n||!N:!n.has(t))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return C===`a`?N.call(t,S):N?N.value=S:n.set(t,S),S},__classPrivateFieldGet=function(t,n,S,C){if(S===`a`&&!C)throw TypeError(`Private accessor was defined without a getter`);if(typeof n==`function`?t!==n||!C:!n.has(t))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return S===`m`?C:S===`a`?C.call(t):C?C.value:n.get(t)},mm=Symbol(`copyDoubleDash`),hm=Symbol(`copyDoubleDash`),gm=Symbol(`deleteFromParserHintObject`),_m=Symbol(`emitWarning`),vm=Symbol(`freeze`),ym=Symbol(`getDollarZero`),bm=Symbol(`getParserConfiguration`),xm=Symbol(`getUsageConfiguration`),Sm=Symbol(`guessLocale`),Cm=Symbol(`guessVersion`),wm=Symbol(`parsePositionalNumbers`),Tm=Symbol(`pkgUp`),Em=Symbol(`populateParserHintArray`),Dm=Symbol(`populateParserHintSingleValueDictionary`),Om=Symbol(`populateParserHintArrayDictionary`),km=Symbol(`populateParserHintDictionary`),Am=Symbol(`sanitizeKey`),jm=Symbol(`setKey`),Mm=Symbol(`unfreeze`),Nm=Symbol(`validateAsync`),Pm=Symbol(`getCommandInstance`),Fm=Symbol(`getContext`),Im=Symbol(`getHasOutput`),Lm=Symbol(`getLoggerInstance`),Rm=Symbol(`getParseContext`),zm=Symbol(`getUsageInstance`),Bm=Symbol(`getValidationInstance`),Vm=Symbol(`hasParseCallback`),Hm=Symbol(`isGlobalContext`),Um=Symbol(`postProcess`),Wm=Symbol(`rebase`),Gm=Symbol(`reset`),Km=Symbol(`runYargsParserAndExecuteCommands`),qm=Symbol(`runValidation`),Jm=Symbol(`setHasOutput`),Ym=Symbol(`kTrackManuallySetKeys`),Xm=`en_US`,YargsInstance=class{constructor(t=[],n,S,C){this.customScriptName=!1,this.parsed=!1,Mp.set(this,void 0),Np.set(this,void 0),Pp.set(this,{commands:[],fullCommands:[]}),Fp.set(this,null),Ip.set(this,null),Lp.set(this,`show-hidden`),Rp.set(this,null),zp.set(this,!0),Bp.set(this,{}),Vp.set(this,!0),Hp.set(this,[]),Up.set(this,void 0),Wp.set(this,{}),Gp.set(this,!1),Kp.set(this,null),qp.set(this,!0),Jp.set(this,void 0),Yp.set(this,``),Xp.set(this,void 0),Zp.set(this,void 0),Qp.set(this,{}),$p.set(this,null),em.set(this,null),tm.set(this,{}),nm.set(this,{}),im.set(this,void 0),am.set(this,!1),om.set(this,void 0),sm.set(this,!1),cm.set(this,!1),lm.set(this,!1),um.set(this,void 0),dm.set(this,{}),fm.set(this,null),pm.set(this,void 0),__classPrivateFieldSet(this,om,C,`f`),__classPrivateFieldSet(this,im,t,`f`),__classPrivateFieldSet(this,Np,n,`f`),__classPrivateFieldSet(this,Zp,S,`f`),__classPrivateFieldSet(this,Up,new GlobalMiddleware(this),`f`),this.$0=this[ym](),this[Gm](),__classPrivateFieldSet(this,Mp,__classPrivateFieldGet(this,Mp,`f`),`f`),__classPrivateFieldSet(this,um,__classPrivateFieldGet(this,um,`f`),`f`),__classPrivateFieldSet(this,pm,__classPrivateFieldGet(this,pm,`f`),`f`),__classPrivateFieldSet(this,Xp,__classPrivateFieldGet(this,Xp,`f`),`f`),__classPrivateFieldGet(this,Xp,`f`).showHiddenOpt=__classPrivateFieldGet(this,Lp,`f`),__classPrivateFieldSet(this,Jp,this[hm](),`f`),__classPrivateFieldGet(this,om,`f`).y18n.setLocale(Xm)}addHelpOpt(t,n){return argsert(`[string|boolean] [string]`,[t,n],arguments.length),__classPrivateFieldGet(this,Kp,`f`)&&(this[gm](__classPrivateFieldGet(this,Kp,`f`)),__classPrivateFieldSet(this,Kp,null,`f`)),t===!1&&n===void 0?this:(__classPrivateFieldSet(this,Kp,typeof t==`string`?t:`help`,`f`),this.boolean(__classPrivateFieldGet(this,Kp,`f`)),this.describe(__classPrivateFieldGet(this,Kp,`f`),n||__classPrivateFieldGet(this,um,`f`).deferY18nLookup(`Show help`)),this)}help(t,n){return this.addHelpOpt(t,n)}addShowHiddenOpt(t,n){if(argsert(`[string|boolean] [string]`,[t,n],arguments.length),t===!1&&n===void 0)return this;let S=typeof t==`string`?t:__classPrivateFieldGet(this,Lp,`f`);return this.boolean(S),this.describe(S,n||__classPrivateFieldGet(this,um,`f`).deferY18nLookup(`Show hidden options`)),__classPrivateFieldGet(this,Xp,`f`).showHiddenOpt=S,this}showHidden(t,n){return this.addShowHiddenOpt(t,n)}alias(t,n){return argsert(`<object|string|array> [string|array]`,[t,n],arguments.length),this[Om](this.alias.bind(this),`alias`,t,n),this}array(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`array`,t),this[Ym](t),this}boolean(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`boolean`,t),this[Ym](t),this}check(t,n){return argsert(`<function> [boolean]`,[t,n],arguments.length),this.middleware((n,S)=>maybeAsyncResult(()=>t(n,S.getOptions()),S=>(S?(typeof S==`string`||S instanceof Error)&&__classPrivateFieldGet(this,um,`f`).fail(S.toString(),S):__classPrivateFieldGet(this,um,`f`).fail(__classPrivateFieldGet(this,om,`f`).y18n.__(`Argument check failed: %s`,t.toString())),n),t=>(__classPrivateFieldGet(this,um,`f`).fail(t.message?t.message:t.toString(),t),n)),!1,n),this}choices(t,n){return argsert(`<object|string|array> [string|array]`,[t,n],arguments.length),this[Om](this.choices.bind(this),`choices`,t,n),this}coerce(t,n){if(argsert(`<object|string|array> [function]`,[t,n],arguments.length),Array.isArray(t)){if(!n)throw new Al(`coerce callback must be provided`);for(let S of t)this.coerce(S,n);return this}else if(typeof t==`object`){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!n)throw new Al(`coerce callback must be provided`);let S=t;return __classPrivateFieldGet(this,Xp,`f`).key[S]=!0,__classPrivateFieldGet(this,Up,`f`).addCoerceMiddleware((t,C)=>{let N=C.getAliases()[S]??[],F=[S,...N].filter(n=>Object.prototype.hasOwnProperty.call(t,n));return F.length===0?t:maybeAsyncResult(()=>n(t[F[0]]),n=>(F.forEach(S=>{t[S]=n}),t),t=>{throw new Al(t.message)})},S),this}conflicts(t,n){return argsert(`<string|object> [string|array]`,[t,n],arguments.length),__classPrivateFieldGet(this,pm,`f`).conflicts(t,n),this}config(t=`config`,n,S){return argsert(`[object|string] [string|function] [function]`,[t,n,S],arguments.length),typeof t==`object`&&!Array.isArray(t)?(t=applyExtends(t,__classPrivateFieldGet(this,Np,`f`),this[bm]()[`deep-merge-config`]||!1,__classPrivateFieldGet(this,om,`f`)),__classPrivateFieldGet(this,Xp,`f`).configObjects=(__classPrivateFieldGet(this,Xp,`f`).configObjects||[]).concat(t),this):(typeof n==`function`&&(S=n,n=void 0),this.describe(t,n||__classPrivateFieldGet(this,um,`f`).deferY18nLookup(`Path to JSON config file`)),(Array.isArray(t)?t:[t]).forEach(t=>{__classPrivateFieldGet(this,Xp,`f`).config[t]=S||!0}),this)}completion(t,n,S){return argsert(`[string] [string|boolean|function] [function]`,[t,n,S],arguments.length),typeof n==`function`&&(S=n,n=void 0),__classPrivateFieldSet(this,Ip,t||__classPrivateFieldGet(this,Ip,`f`)||`completion`,`f`),!n&&n!==!1&&(n=`generate completion script`),this.command(__classPrivateFieldGet(this,Ip,`f`),n),S&&__classPrivateFieldGet(this,Fp,`f`).registerFunction(S),this}command(t,n,S,C,N,F){return argsert(`<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]`,[t,n,S,C,N,F],arguments.length),__classPrivateFieldGet(this,Mp,`f`).addHandler(t,n,S,C,N,F),this}commands(t,n,S,C,N,F){return this.command(t,n,S,C,N,F)}commandDir(t,n){argsert(`<string> [object]`,[t,n],arguments.length);let S=__classPrivateFieldGet(this,Zp,`f`)||__classPrivateFieldGet(this,om,`f`).require;return __classPrivateFieldGet(this,Mp,`f`).addDirectory(t,S,__classPrivateFieldGet(this,om,`f`).getCallerFile(),n),this}count(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`count`,t),this[Ym](t),this}default(t,n,S){return argsert(`<object|string|array> [*] [string]`,[t,n,S],arguments.length),S&&(assertSingleKey(t,__classPrivateFieldGet(this,om,`f`)),__classPrivateFieldGet(this,Xp,`f`).defaultDescription[t]=S),typeof n==`function`&&(assertSingleKey(t,__classPrivateFieldGet(this,om,`f`)),__classPrivateFieldGet(this,Xp,`f`).defaultDescription[t]||(__classPrivateFieldGet(this,Xp,`f`).defaultDescription[t]=__classPrivateFieldGet(this,um,`f`).functionDescription(n)),n=n.call()),this[Dm](this.default.bind(this),`default`,t,n),this}defaults(t,n,S){return this.default(t,n,S)}demandCommand(t=1,n,S,C){return argsert(`[number] [number|string] [string|null|undefined] [string|null|undefined]`,[t,n,S,C],arguments.length),typeof n!=`number`&&(S=n,n=1/0),this.global(`_`,!1),__classPrivateFieldGet(this,Xp,`f`).demandedCommands._={min:t,max:n,minMsg:S,maxMsg:C},this}demand(t,n,S){return Array.isArray(n)?(n.forEach(t=>{assertNotStrictEqual(S,!0,__classPrivateFieldGet(this,om,`f`)),this.demandOption(t,S)}),n=1/0):typeof n!=`number`&&(S=n,n=1/0),typeof t==`number`?(assertNotStrictEqual(S,!0,__classPrivateFieldGet(this,om,`f`)),this.demandCommand(t,n,S,S)):Array.isArray(t)?t.forEach(t=>{assertNotStrictEqual(S,!0,__classPrivateFieldGet(this,om,`f`)),this.demandOption(t,S)}):typeof S==`string`?this.demandOption(t,S):(S===!0||S===void 0)&&this.demandOption(t),this}demandOption(t,n){return argsert(`<object|string|array> [string]`,[t,n],arguments.length),this[Dm](this.demandOption.bind(this),`demandedOptions`,t,n),this}deprecateOption(t,n){return argsert(`<string> [string|boolean]`,[t,n],arguments.length),__classPrivateFieldGet(this,Xp,`f`).deprecatedOptions[t]=n,this}describe(t,n){return argsert(`<object|string|array> [string]`,[t,n],arguments.length),this[jm](t,!0),__classPrivateFieldGet(this,um,`f`).describe(t,n),this}detectLocale(t){return argsert(`<boolean>`,[t],arguments.length),__classPrivateFieldSet(this,zp,t,`f`),this}env(t){return argsert(`[string|boolean]`,[t],arguments.length),t===!1?delete __classPrivateFieldGet(this,Xp,`f`).envPrefix:__classPrivateFieldGet(this,Xp,`f`).envPrefix=t||``,this}epilogue(t){return argsert(`<string>`,[t],arguments.length),__classPrivateFieldGet(this,um,`f`).epilog(t),this}epilog(t){return this.epilogue(t)}example(t,n){return argsert(`<string|array> [string]`,[t,n],arguments.length),Array.isArray(t)?t.forEach(t=>this.example(...t)):__classPrivateFieldGet(this,um,`f`).example(t,n),this}exit(t,n){__classPrivateFieldSet(this,Gp,!0,`f`),__classPrivateFieldSet(this,Rp,n,`f`),__classPrivateFieldGet(this,Vp,`f`)&&__classPrivateFieldGet(this,om,`f`).process.exit(t)}exitProcess(t=!0){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,Vp,t,`f`),this}fail(t){if(argsert(`<function|boolean>`,[t],arguments.length),typeof t==`boolean`&&t!==!1)throw new Al(`Invalid first argument. Expected function or boolean 'false'`);return __classPrivateFieldGet(this,um,`f`).failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,n){return argsert(`<array> [function]`,[t,n],arguments.length),n?__classPrivateFieldGet(this,Fp,`f`).getCompletion(t,n):new Promise((n,S)=>{__classPrivateFieldGet(this,Fp,`f`).getCompletion(t,(t,C)=>{t?S(t):n(C)})})}getDemandedOptions(){return argsert([],0),__classPrivateFieldGet(this,Xp,`f`).demandedOptions}getDemandedCommands(){return argsert([],0),__classPrivateFieldGet(this,Xp,`f`).demandedCommands}getDeprecatedOptions(){return argsert([],0),__classPrivateFieldGet(this,Xp,`f`).deprecatedOptions}getDetectLocale(){return __classPrivateFieldGet(this,zp,`f`)}getExitProcess(){return __classPrivateFieldGet(this,Vp,`f`)}getGroups(){return Object.assign({},__classPrivateFieldGet(this,Wp,`f`),__classPrivateFieldGet(this,nm,`f`))}getHelp(){if(__classPrivateFieldSet(this,Gp,!0,`f`),!__classPrivateFieldGet(this,um,`f`).hasCachedHelpMessage()){if(!this.parsed){let t=this[Km](__classPrivateFieldGet(this,im,`f`),void 0,void 0,0,!0);if(isPromise(t))return t.then(()=>__classPrivateFieldGet(this,um,`f`).help())}let t=__classPrivateFieldGet(this,Mp,`f`).runDefaultBuilderOn(this);if(isPromise(t))return t.then(()=>__classPrivateFieldGet(this,um,`f`).help())}return Promise.resolve(__classPrivateFieldGet(this,um,`f`).help())}getOptions(){return __classPrivateFieldGet(this,Xp,`f`)}getStrict(){return __classPrivateFieldGet(this,sm,`f`)}getStrictCommands(){return __classPrivateFieldGet(this,cm,`f`)}getStrictOptions(){return __classPrivateFieldGet(this,lm,`f`)}global(t,n){return argsert(`<string|array> [boolean]`,[t,n],arguments.length),t=[].concat(t),n===!1?t.forEach(t=>{__classPrivateFieldGet(this,Xp,`f`).local.includes(t)||__classPrivateFieldGet(this,Xp,`f`).local.push(t)}):__classPrivateFieldGet(this,Xp,`f`).local=__classPrivateFieldGet(this,Xp,`f`).local.filter(n=>t.indexOf(n)===-1),this}group(t,n){argsert(`<string|array> <string>`,[t,n],arguments.length);let S=__classPrivateFieldGet(this,nm,`f`)[n]||__classPrivateFieldGet(this,Wp,`f`)[n];__classPrivateFieldGet(this,nm,`f`)[n]&&delete __classPrivateFieldGet(this,nm,`f`)[n];let C={};return __classPrivateFieldGet(this,Wp,`f`)[n]=(S||[]).concat(t).filter(t=>C[t]?!1:C[t]=!0),this}hide(t){return argsert(`<string>`,[t],arguments.length),__classPrivateFieldGet(this,Xp,`f`).hiddenOptions.push(t),this}implies(t,n){return argsert(`<string|object> [number|string|array]`,[t,n],arguments.length),__classPrivateFieldGet(this,pm,`f`).implies(t,n),this}locale(t){return argsert(`[string]`,[t],arguments.length),t===void 0?(this[Sm](),__classPrivateFieldGet(this,om,`f`).y18n.getLocale()):(__classPrivateFieldSet(this,zp,!1,`f`),__classPrivateFieldGet(this,om,`f`).y18n.setLocale(t),this)}middleware(t,n,S){return __classPrivateFieldGet(this,Up,`f`).addMiddleware(t,!!n,S)}nargs(t,n){return argsert(`<string|object|array> [number]`,[t,n],arguments.length),this[Dm](this.nargs.bind(this),`narg`,t,n),this}normalize(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`normalize`,t),this}number(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`number`,t),this[Ym](t),this}option(t,n){if(argsert(`<string|object> [object]`,[t,n],arguments.length),typeof t==`object`)Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof n!=`object`&&(n={}),this[Ym](t),__classPrivateFieldGet(this,fm,`f`)&&(t===`version`||n?.alias===`version`)&&this[_m]([`"version" is a reserved word.`,`Please do one of the following:`,'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)",`- Use a different option key`,`https://yargs.js.org/docs/#api-reference-version`].join(`
146
146
  `),void 0,`versionWarning`),__classPrivateFieldGet(this,Xp,`f`).key[t]=!0,n.alias&&this.alias(t,n.alias);let S=n.deprecate||n.deprecated;S&&this.deprecateOption(t,S);let C=n.demand||n.required||n.require;C&&this.demand(t,C),n.demandOption&&this.demandOption(t,typeof n.demandOption==`string`?n.demandOption:void 0),n.conflicts&&this.conflicts(t,n.conflicts),`default`in n&&this.default(t,n.default),n.implies!==void 0&&this.implies(t,n.implies),n.nargs!==void 0&&this.nargs(t,n.nargs),n.config&&this.config(t,n.configParser),n.normalize&&this.normalize(t),n.choices&&this.choices(t,n.choices),n.coerce&&this.coerce(t,n.coerce),n.group&&this.group(t,n.group),(n.boolean||n.type===`boolean`)&&(this.boolean(t),n.alias&&this.boolean(n.alias)),(n.array||n.type===`array`)&&(this.array(t),n.alias&&this.array(n.alias)),(n.number||n.type===`number`)&&(this.number(t),n.alias&&this.number(n.alias)),(n.string||n.type===`string`)&&(this.string(t),n.alias&&this.string(n.alias)),(n.count||n.type===`count`)&&this.count(t),typeof n.global==`boolean`&&this.global(t,n.global),n.defaultDescription&&(__classPrivateFieldGet(this,Xp,`f`).defaultDescription[t]=n.defaultDescription),n.skipValidation&&this.skipValidation(t);let N=n.describe||n.description||n.desc,F=__classPrivateFieldGet(this,um,`f`).getDescriptions();(!Object.prototype.hasOwnProperty.call(F,t)||typeof N==`string`)&&this.describe(t,N),n.hidden&&this.hide(t),n.requiresArg&&this.requiresArg(t)}return this}options(t,n){return this.option(t,n)}parse(t,n,S){argsert(`[string|array] [function|boolean|object] [function]`,[t,n,S],arguments.length),this[vm](),t===void 0&&(t=__classPrivateFieldGet(this,im,`f`)),typeof n==`object`&&(__classPrivateFieldSet(this,em,n,`f`),n=S),typeof n==`function`&&(__classPrivateFieldSet(this,$p,n,`f`),n=!1),n||__classPrivateFieldSet(this,im,t,`f`),__classPrivateFieldGet(this,$p,`f`)&&__classPrivateFieldSet(this,Vp,!1,`f`);let C=this[Km](t,!!n),N=this.parsed;return __classPrivateFieldGet(this,Fp,`f`).setParsed(this.parsed),isPromise(C)?C.then(t=>(__classPrivateFieldGet(this,$p,`f`)&&__classPrivateFieldGet(this,$p,`f`).call(this,__classPrivateFieldGet(this,Rp,`f`),t,__classPrivateFieldGet(this,Yp,`f`)),t)).catch(t=>{throw __classPrivateFieldGet(this,$p,`f`)&&__classPrivateFieldGet(this,$p,`f`)(t,this.parsed.argv,__classPrivateFieldGet(this,Yp,`f`)),t}).finally(()=>{this[Mm](),this.parsed=N}):(__classPrivateFieldGet(this,$p,`f`)&&__classPrivateFieldGet(this,$p,`f`).call(this,__classPrivateFieldGet(this,Rp,`f`),C,__classPrivateFieldGet(this,Yp,`f`)),this[Mm](),this.parsed=N,C)}parseAsync(t,n,S){let C=this.parse(t,n,S);return isPromise(C)?C:Promise.resolve(C)}parseSync(t,n,S){let C=this.parse(t,n,S);if(isPromise(C))throw new Al(`.parseSync() must not be used with asynchronous builders, handlers, or middleware`);return C}parserConfiguration(t){return argsert(`<object>`,[t],arguments.length),__classPrivateFieldSet(this,Qp,t,`f`),this}pkgConf(t,n){argsert(`<string> [string]`,[t,n],arguments.length);let S=null,C=this[Tm](n||__classPrivateFieldGet(this,Np,`f`));return C[t]&&typeof C[t]==`object`&&(S=applyExtends(C[t],n||__classPrivateFieldGet(this,Np,`f`),this[bm]()[`deep-merge-config`]||!1,__classPrivateFieldGet(this,om,`f`)),__classPrivateFieldGet(this,Xp,`f`).configObjects=(__classPrivateFieldGet(this,Xp,`f`).configObjects||[]).concat(S)),this}positional(t,n){argsert(`<string> <object>`,[t,n],arguments.length);let S=[`default`,`defaultDescription`,`implies`,`normalize`,`choices`,`conflicts`,`coerce`,`type`,`describe`,`desc`,`description`,`alias`];n=objFilter(n,(t,n)=>t===`type`&&![`string`,`number`,`boolean`].includes(n)?!1:S.includes(t));let C=__classPrivateFieldGet(this,Pp,`f`).fullCommands[__classPrivateFieldGet(this,Pp,`f`).fullCommands.length-1],N=C?__classPrivateFieldGet(this,Mp,`f`).cmdToParseOptions(C):{array:[],alias:{},default:{},demand:{}};return objectKeys(N).forEach(S=>{let C=N[S];Array.isArray(C)?C.indexOf(t)!==-1&&(n[S]=!0):C[t]&&!(S in n)&&(n[S]=C[t])}),this.group(t,__classPrivateFieldGet(this,um,`f`).getPositionalGroupName()),this.option(t,n)}recommendCommands(t=!0){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,am,t,`f`),this}required(t,n,S){return this.demand(t,n,S)}require(t,n,S){return this.demand(t,n,S)}requiresArg(t){return argsert(`<array|string|object> [number]`,[t],arguments.length),typeof t==`string`&&__classPrivateFieldGet(this,Xp,`f`).narg[t]||this[Dm](this.requiresArg.bind(this),`narg`,t,NaN),this}showCompletionScript(t,n){return argsert(`[string] [string]`,[t,n],arguments.length),t||=this.$0,__classPrivateFieldGet(this,Jp,`f`).log(__classPrivateFieldGet(this,Fp,`f`).generateCompletionScript(t,n||__classPrivateFieldGet(this,Ip,`f`)||`completion`)),this}showHelp(t){if(argsert(`[string|function]`,[t],arguments.length),__classPrivateFieldSet(this,Gp,!0,`f`),!__classPrivateFieldGet(this,um,`f`).hasCachedHelpMessage()){if(!this.parsed){let n=this[Km](__classPrivateFieldGet(this,im,`f`),void 0,void 0,0,!0);if(isPromise(n))return n.then(()=>{__classPrivateFieldGet(this,um,`f`).showHelp(t)}),this}let n=__classPrivateFieldGet(this,Mp,`f`).runDefaultBuilderOn(this);if(isPromise(n))return n.then(()=>{__classPrivateFieldGet(this,um,`f`).showHelp(t)}),this}return __classPrivateFieldGet(this,um,`f`).showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,n){return argsert(`[boolean|string] [string]`,[t,n],arguments.length),__classPrivateFieldGet(this,um,`f`).showHelpOnFail(t,n),this}showVersion(t){return argsert(`[string|function]`,[t],arguments.length),__classPrivateFieldGet(this,um,`f`).showVersion(t),this}skipValidation(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`skipValidation`,t),this}strict(t){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,sm,t!==!1,`f`),this}strictCommands(t){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,cm,t!==!1,`f`),this}strictOptions(t){return argsert(`[boolean]`,[t],arguments.length),__classPrivateFieldSet(this,lm,t!==!1,`f`),this}string(t){return argsert(`<array|string>`,[t],arguments.length),this[Em](`string`,t),this[Ym](t),this}terminalWidth(){return argsert([],0),__classPrivateFieldGet(this,om,`f`).process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return argsert(`<object>`,[t],arguments.length),__classPrivateFieldSet(this,zp,!1,`f`),__classPrivateFieldGet(this,om,`f`).y18n.updateLocale(t),this}usage(t,n,S,C){if(argsert(`<string|null|undefined> [string|boolean] [function|object] [function]`,[t,n,S,C],arguments.length),n!==void 0){if(assertNotStrictEqual(t,null,__classPrivateFieldGet(this,om,`f`)),(t||``).match(/^\$0( |$)/))return this.command(t,n,S,C);throw new Al(`.usage() description must start with $0 if being used as alias for .command()`)}else return __classPrivateFieldGet(this,um,`f`).usage(t),this}usageConfiguration(t){return argsert(`<object>`,[t],arguments.length),__classPrivateFieldSet(this,dm,t,`f`),this}version(t,n,S){let C=`version`;if(argsert(`[boolean|string] [string] [string]`,[t,n,S],arguments.length),__classPrivateFieldGet(this,fm,`f`)&&(this[gm](__classPrivateFieldGet(this,fm,`f`)),__classPrivateFieldGet(this,um,`f`).version(void 0),__classPrivateFieldSet(this,fm,null,`f`)),arguments.length===0)S=this[Cm](),t=C;else if(arguments.length===1){if(t===!1)return this;S=t,t=C}else arguments.length===2&&(S=n,n=void 0);return __classPrivateFieldSet(this,fm,typeof t==`string`?t:C,`f`),n||=__classPrivateFieldGet(this,um,`f`).deferY18nLookup(`Show version number`),__classPrivateFieldGet(this,um,`f`).version(S||void 0),this.boolean(__classPrivateFieldGet(this,fm,`f`)),this.describe(__classPrivateFieldGet(this,fm,`f`),n),this}wrap(t){return argsert(`<number|null|undefined>`,[t],arguments.length),__classPrivateFieldGet(this,um,`f`).wrap(t),this}[(Mp=new WeakMap,Np=new WeakMap,Pp=new WeakMap,Fp=new WeakMap,Ip=new WeakMap,Lp=new WeakMap,Rp=new WeakMap,zp=new WeakMap,Bp=new WeakMap,Vp=new WeakMap,Hp=new WeakMap,Up=new WeakMap,Wp=new WeakMap,Gp=new WeakMap,Kp=new WeakMap,qp=new WeakMap,Jp=new WeakMap,Yp=new WeakMap,Xp=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,$p=new WeakMap,em=new WeakMap,tm=new WeakMap,nm=new WeakMap,im=new WeakMap,am=new WeakMap,om=new WeakMap,sm=new WeakMap,cm=new WeakMap,lm=new WeakMap,um=new WeakMap,dm=new WeakMap,fm=new WeakMap,pm=new WeakMap,mm)](t){if(!t._||!t[`--`])return t;t._.push.apply(t._,t[`--`]);try{delete t[`--`]}catch{}return t}[hm](){return{log:(...t)=>{this[Vm]()||ge.log(...t),__classPrivateFieldSet(this,Gp,!0,`f`),__classPrivateFieldGet(this,Yp,`f`).length&&__classPrivateFieldSet(this,Yp,__classPrivateFieldGet(this,Yp,`f`)+`
147
147
  `,`f`),__classPrivateFieldSet(this,Yp,__classPrivateFieldGet(this,Yp,`f`)+t.join(` `),`f`)},error:(...t)=>{this[Vm]()||ge.error(...t),__classPrivateFieldSet(this,Gp,!0,`f`),__classPrivateFieldGet(this,Yp,`f`).length&&__classPrivateFieldSet(this,Yp,__classPrivateFieldGet(this,Yp,`f`)+`
148
- `,`f`),__classPrivateFieldSet(this,Yp,__classPrivateFieldGet(this,Yp,`f`)+t.join(` `),`f`)}}}[gm](t){objectKeys(__classPrivateFieldGet(this,Xp,`f`)).forEach(n=>{if((t=>t===`configObjects`)(n))return;let S=__classPrivateFieldGet(this,Xp,`f`)[n];Array.isArray(S)?S.includes(t)&&S.splice(S.indexOf(t),1):typeof S==`object`&&delete S[t]}),delete __classPrivateFieldGet(this,um,`f`).getDescriptions()[t]}[_m](t,n,S){__classPrivateFieldGet(this,Bp,`f`)[S]||(__classPrivateFieldGet(this,om,`f`).process.emitWarning(t,n),__classPrivateFieldGet(this,Bp,`f`)[S]=!0)}[vm](){__classPrivateFieldGet(this,Hp,`f`).push({options:__classPrivateFieldGet(this,Xp,`f`),configObjects:__classPrivateFieldGet(this,Xp,`f`).configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,Vp,`f`),groups:__classPrivateFieldGet(this,Wp,`f`),strict:__classPrivateFieldGet(this,sm,`f`),strictCommands:__classPrivateFieldGet(this,cm,`f`),strictOptions:__classPrivateFieldGet(this,lm,`f`),completionCommand:__classPrivateFieldGet(this,Ip,`f`),output:__classPrivateFieldGet(this,Yp,`f`),exitError:__classPrivateFieldGet(this,Rp,`f`),hasOutput:__classPrivateFieldGet(this,Gp,`f`),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,$p,`f`),parseContext:__classPrivateFieldGet(this,em,`f`)}),__classPrivateFieldGet(this,um,`f`).freeze(),__classPrivateFieldGet(this,pm,`f`).freeze(),__classPrivateFieldGet(this,Mp,`f`).freeze(),__classPrivateFieldGet(this,Up,`f`).freeze()}[ym](){let t=``,n;return n=/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,om,`f`).process.argv()[0])?__classPrivateFieldGet(this,om,`f`).process.argv().slice(1,2):__classPrivateFieldGet(this,om,`f`).process.argv().slice(0,1),t=n.map(t=>{let n=this[Wm](__classPrivateFieldGet(this,Np,`f`),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&n.length<t.length?n:t}).join(` `).trim(),__classPrivateFieldGet(this,om,`f`).getEnv(`_`)&&__classPrivateFieldGet(this,om,`f`).getProcessArgvBin()===__classPrivateFieldGet(this,om,`f`).getEnv(`_`)&&(t=__classPrivateFieldGet(this,om,`f`).getEnv(`_`).replace(`${__classPrivateFieldGet(this,om,`f`).path.dirname(__classPrivateFieldGet(this,om,`f`).process.execPath())}/`,``)),t}[bm](){return __classPrivateFieldGet(this,Qp,`f`)}[xm](){return __classPrivateFieldGet(this,dm,`f`)}[Sm](){if(!__classPrivateFieldGet(this,zp,`f`))return;let t=__classPrivateFieldGet(this,om,`f`).getEnv(`LC_ALL`)||__classPrivateFieldGet(this,om,`f`).getEnv(`LC_MESSAGES`)||__classPrivateFieldGet(this,om,`f`).getEnv(`LANG`)||__classPrivateFieldGet(this,om,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(t.replace(/[.:].*/,``))}[Cm](){return this[Tm]().version||`unknown`}[wm](t){let n=t[`--`]?t[`--`]:t._;for(let t=0,S;(S=n[t])!==void 0;t++)__classPrivateFieldGet(this,om,`f`).Parser.looksLikeNumber(S)&&Number.isSafeInteger(Math.floor(parseFloat(`${S}`)))&&(n[t]=Number(S));return t}[Tm](t){let n=t||`*`;if(__classPrivateFieldGet(this,tm,`f`)[n])return __classPrivateFieldGet(this,tm,`f`)[n];let S={};try{let n=t||__classPrivateFieldGet(this,om,`f`).mainFilename;__classPrivateFieldGet(this,om,`f`).path.extname(n)&&(n=__classPrivateFieldGet(this,om,`f`).path.dirname(n));let C=__classPrivateFieldGet(this,om,`f`).findUp(n,(t,n)=>{if(n.includes(`package.json`))return`package.json`});assertNotStrictEqual(C,void 0,__classPrivateFieldGet(this,om,`f`)),S=JSON.parse(__classPrivateFieldGet(this,om,`f`).readFileSync(C,`utf8`))}catch{}return __classPrivateFieldGet(this,tm,`f`)[n]=S||{},__classPrivateFieldGet(this,tm,`f`)[n]}[Em](t,n){n=[].concat(n),n.forEach(n=>{n=this[Am](n),__classPrivateFieldGet(this,Xp,`f`)[t].push(n)})}[Dm](t,n,S,C){this[km](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Xp,`f`)[t][n]=S})}[Om](t,n,S,C){this[km](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Xp,`f`)[t][n]=(__classPrivateFieldGet(this,Xp,`f`)[t][n]||[]).concat(S)})}[km](t,n,S,C,N){if(Array.isArray(S))S.forEach(n=>{t(n,C)});else if((t=>typeof t==`object`)(S))for(let n of objectKeys(S))t(n,S[n]);else N(n,this[Am](S),C)}[Am](t){return t===`__proto__`?`___proto___`:t}[jm](t,n){return this[Dm](this[jm].bind(this),`key`,t,n),this}[Mm](){var t,n,S,C,N,F,I,H,W,q,Y,X;let Z=__classPrivateFieldGet(this,Hp,`f`).pop();assertNotStrictEqual(Z,void 0,__classPrivateFieldGet(this,om,`f`));let te;t=this,n=this,S=this,C=this,N=this,F=this,I=this,H=this,W=this,q=this,Y=this,X=this,{options:{set value(n){__classPrivateFieldSet(t,Xp,n,`f`)}}.value,configObjects:te,exitProcess:{set value(t){__classPrivateFieldSet(n,Vp,t,`f`)}}.value,groups:{set value(t){__classPrivateFieldSet(S,Wp,t,`f`)}}.value,output:{set value(t){__classPrivateFieldSet(C,Yp,t,`f`)}}.value,exitError:{set value(t){__classPrivateFieldSet(N,Rp,t,`f`)}}.value,hasOutput:{set value(t){__classPrivateFieldSet(F,Gp,t,`f`)}}.value,parsed:this.parsed,strict:{set value(t){__classPrivateFieldSet(I,sm,t,`f`)}}.value,strictCommands:{set value(t){__classPrivateFieldSet(H,cm,t,`f`)}}.value,strictOptions:{set value(t){__classPrivateFieldSet(W,lm,t,`f`)}}.value,completionCommand:{set value(t){__classPrivateFieldSet(q,Ip,t,`f`)}}.value,parseFn:{set value(t){__classPrivateFieldSet(Y,$p,t,`f`)}}.value,parseContext:{set value(t){__classPrivateFieldSet(X,em,t,`f`)}}.value}=Z,__classPrivateFieldGet(this,Xp,`f`).configObjects=te,__classPrivateFieldGet(this,um,`f`).unfreeze(),__classPrivateFieldGet(this,pm,`f`).unfreeze(),__classPrivateFieldGet(this,Mp,`f`).unfreeze(),__classPrivateFieldGet(this,Up,`f`).unfreeze()}[Nm](t,n){return maybeAsyncResult(n,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Pm].bind(this),getContext:this[Fm].bind(this),getHasOutput:this[Im].bind(this),getLoggerInstance:this[Lm].bind(this),getParseContext:this[Rm].bind(this),getParserConfiguration:this[bm].bind(this),getUsageConfiguration:this[xm].bind(this),getUsageInstance:this[zm].bind(this),getValidationInstance:this[Bm].bind(this),hasParseCallback:this[Vm].bind(this),isGlobalContext:this[Hm].bind(this),postProcess:this[Um].bind(this),reset:this[Gm].bind(this),runValidation:this[qm].bind(this),runYargsParserAndExecuteCommands:this[Km].bind(this),setHasOutput:this[Jm].bind(this)}}[Pm](){return __classPrivateFieldGet(this,Mp,`f`)}[Fm](){return __classPrivateFieldGet(this,Pp,`f`)}[Im](){return __classPrivateFieldGet(this,Gp,`f`)}[Lm](){return __classPrivateFieldGet(this,Jp,`f`)}[Rm](){return __classPrivateFieldGet(this,em,`f`)||{}}[zm](){return __classPrivateFieldGet(this,um,`f`)}[Bm](){return __classPrivateFieldGet(this,pm,`f`)}[Vm](){return!!__classPrivateFieldGet(this,$p,`f`)}[Hm](){return __classPrivateFieldGet(this,qp,`f`)}[Um](t,n,S,C){return S||isPromise(t)?t:(n||(t=this[mm](t)),(this[bm]()[`parse-positional-numbers`]||this[bm]()[`parse-positional-numbers`]===void 0)&&(t=this[wm](t)),C&&(t=applyMiddleware(t,this,__classPrivateFieldGet(this,Up,`f`).getMiddleware(),!1)),t)}[Gm](t={}){__classPrivateFieldSet(this,Xp,__classPrivateFieldGet(this,Xp,`f`)||{},`f`);let n={};n.local=__classPrivateFieldGet(this,Xp,`f`).local||[],n.configObjects=__classPrivateFieldGet(this,Xp,`f`).configObjects||[];let S={};return n.local.forEach(n=>{S[n]=!0,(t[n]||[]).forEach(t=>{S[t]=!0})}),Object.assign(__classPrivateFieldGet(this,nm,`f`),Object.keys(__classPrivateFieldGet(this,Wp,`f`)).reduce((t,n)=>{let C=__classPrivateFieldGet(this,Wp,`f`)[n].filter(t=>!(t in S));return C.length>0&&(t[n]=C),t},{})),__classPrivateFieldSet(this,Wp,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(t=>{n[t]=(__classPrivateFieldGet(this,Xp,`f`)[t]||[]).filter(t=>!S[t])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(t=>{n[t]=objFilter(__classPrivateFieldGet(this,Xp,`f`)[t],t=>!S[t])}),n.envPrefix=__classPrivateFieldGet(this,Xp,`f`).envPrefix,__classPrivateFieldSet(this,Xp,n,`f`),__classPrivateFieldSet(this,um,__classPrivateFieldGet(this,um,`f`)?__classPrivateFieldGet(this,um,`f`).reset(S):usage(this,__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldSet(this,pm,__classPrivateFieldGet(this,pm,`f`)?__classPrivateFieldGet(this,pm,`f`).reset(S):validation(this,__classPrivateFieldGet(this,um,`f`),__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldSet(this,Mp,__classPrivateFieldGet(this,Mp,`f`)?__classPrivateFieldGet(this,Mp,`f`).reset():command(__classPrivateFieldGet(this,um,`f`),__classPrivateFieldGet(this,pm,`f`),__classPrivateFieldGet(this,Up,`f`),__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldGet(this,Fp,`f`)||__classPrivateFieldSet(this,Fp,completion(this,__classPrivateFieldGet(this,um,`f`),__classPrivateFieldGet(this,Mp,`f`),__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldGet(this,Up,`f`).reset(),__classPrivateFieldSet(this,Ip,null,`f`),__classPrivateFieldSet(this,Yp,``,`f`),__classPrivateFieldSet(this,Rp,null,`f`),__classPrivateFieldSet(this,Gp,!1,`f`),this.parsed=!1,this}[Wm](t,n){return __classPrivateFieldGet(this,om,`f`).path.relative(t,n)}[Km](t,n,S,C=0,N=!1){let F=!!S||N;t||=__classPrivateFieldGet(this,im,`f`),__classPrivateFieldGet(this,Xp,`f`).__=__classPrivateFieldGet(this,om,`f`).y18n.__,__classPrivateFieldGet(this,Xp,`f`).configuration=this[bm]();let I=!!__classPrivateFieldGet(this,Xp,`f`).configuration[`populate--`],H=Object.assign({},__classPrivateFieldGet(this,Xp,`f`).configuration,{"populate--":!0}),W=__classPrivateFieldGet(this,om,`f`).Parser.detailed(t,Object.assign({},__classPrivateFieldGet(this,Xp,`f`),{configuration:{"parse-positional-numbers":!1,...H}})),q=Object.assign(W.argv,__classPrivateFieldGet(this,em,`f`)),Y,X=W.aliases,Z=!1,te=!1;Object.keys(q).forEach(t=>{t===__classPrivateFieldGet(this,Kp,`f`)&&q[t]?Z=!0:t===__classPrivateFieldGet(this,fm,`f`)&&q[t]&&(te=!0)}),q.$0=this.$0,this.parsed=W,C===0&&__classPrivateFieldGet(this,um,`f`).clearCachedHelpMessage();try{if(this[Sm](),n)return this[Um](q,I,!!S,!1);__classPrivateFieldGet(this,Kp,`f`)&&[__classPrivateFieldGet(this,Kp,`f`)].concat(X[__classPrivateFieldGet(this,Kp,`f`)]||[]).filter(t=>t.length>1).includes(``+q._[q._.length-1])&&(q._.pop(),Z=!0),__classPrivateFieldSet(this,qp,!1,`f`);let H=__classPrivateFieldGet(this,Mp,`f`).getCommands(),ne=__classPrivateFieldGet(this,Fp,`f`)?.completionKey?[__classPrivateFieldGet(this,Fp,`f`)?.completionKey,...this.getAliases()[__classPrivateFieldGet(this,Fp,`f`)?.completionKey]??[]].some(t=>Object.prototype.hasOwnProperty.call(q,t)):!1,re=Z||ne||N;if(q._.length){if(H.length){let t;for(let n=C||0,F;q._[n]!==void 0;n++)if(F=String(q._[n]),H.includes(F)&&F!==__classPrivateFieldGet(this,Ip,`f`)){let t=__classPrivateFieldGet(this,Mp,`f`).runCommand(F,this,W,n+1,N,Z||te||N);return this[Um](t,I,!!S,!1)}else if(!t&&F!==__classPrivateFieldGet(this,Ip,`f`)){t=F;break}!__classPrivateFieldGet(this,Mp,`f`).hasDefaultCommand()&&__classPrivateFieldGet(this,am,`f`)&&t&&!re&&__classPrivateFieldGet(this,pm,`f`).recommendCommands(t,H)}__classPrivateFieldGet(this,Ip,`f`)&&q._.includes(__classPrivateFieldGet(this,Ip,`f`))&&!ne&&(__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,Mp,`f`).hasDefaultCommand()&&!re){let t=__classPrivateFieldGet(this,Mp,`f`).runCommand(null,this,W,0,N,Z||te||N);return this[Um](t,I,!!S,!1)}if(ne){__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),t=[].concat(t);let n=t.slice(t.indexOf(`--${__classPrivateFieldGet(this,Fp,`f`).completionKey}`)+1);return __classPrivateFieldGet(this,Fp,`f`).getCompletion(n,(t,n)=>{if(t)throw new Al(t.message);(n||[]).forEach(t=>{__classPrivateFieldGet(this,Jp,`f`).log(t)}),this.exit(0)}),this[Um](q,!I,!!S,!1)}if(__classPrivateFieldGet(this,Gp,`f`)||(Z?(__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),F=!0,this.showHelp(t=>{__classPrivateFieldGet(this,Jp,`f`).log(t),this.exit(0)})):te&&(__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),F=!0,__classPrivateFieldGet(this,um,`f`).showVersion(`log`),this.exit(0))),!F&&__classPrivateFieldGet(this,Xp,`f`).skipValidation.length>0&&(F=Object.keys(q).some(t=>__classPrivateFieldGet(this,Xp,`f`).skipValidation.indexOf(t)>=0&&q[t]===!0)),!F){if(W.error)throw new Al(W.error.message);if(!ne){let t=this[qm](X,{},W.error);S||(Y=applyMiddleware(q,this,__classPrivateFieldGet(this,Up,`f`).getMiddleware(),!0)),Y=this[Nm](t,Y??q),isPromise(Y)&&!S&&(Y=Y.then(()=>applyMiddleware(q,this,__classPrivateFieldGet(this,Up,`f`).getMiddleware(),!1)))}}}catch(t){if(t instanceof Al)__classPrivateFieldGet(this,um,`f`).fail(t.message,t);else throw t}return this[Um](Y??q,I,!!S,!0)}[qm](t,n,S,C){let N={...this.getDemandedOptions()};return F=>{if(S)throw new Al(S.message);__classPrivateFieldGet(this,pm,`f`).nonOptionCount(F),__classPrivateFieldGet(this,pm,`f`).requiredArguments(F,N);let I=!1;__classPrivateFieldGet(this,cm,`f`)&&(I=__classPrivateFieldGet(this,pm,`f`).unknownCommands(F)),__classPrivateFieldGet(this,sm,`f`)&&!I?__classPrivateFieldGet(this,pm,`f`).unknownArguments(F,t,n,!!C):__classPrivateFieldGet(this,lm,`f`)&&__classPrivateFieldGet(this,pm,`f`).unknownArguments(F,t,{},!1,!1),__classPrivateFieldGet(this,pm,`f`).limitedChoices(F),__classPrivateFieldGet(this,pm,`f`).implications(F),__classPrivateFieldGet(this,pm,`f`).conflicting(F)}}[Jm](){__classPrivateFieldSet(this,Gp,!0,`f`)}[Ym](t){if(typeof t==`string`)__classPrivateFieldGet(this,Xp,`f`).key[t]=!0;else for(let n of t)__classPrivateFieldGet(this,Xp,`f`).key[n]=!0}}}),Qm,$m=__esmMin(()=>{dp(),Zm(),Qm=YargsFactory(up)});function classifyCliFailure(t,n){return typeof t==`string`&&t.length>0?{kind:`usage`,message:t}:{kind:`runtime`}}var eh=__esmMin(()=>{});function buildHeaders(t,n){let S={"user-agent":`gjsify-install/0.64.16`,"accept-encoding":n.acceptEncoding??`identity`};if(n.npmrc){let C=resolveAuthForUrl(t,n.npmrc);C&&(S.authorization=C)}if(n.headers)for(let[t,C]of Object.entries(n.headers))S[t.toLowerCase()]=C;return S}function resolveAuthForUrl(t,n){let S=pathPrefixes(new URL(t));for(let t of S){let S=n.authTokens[t];if(S)return`Bearer ${S}`;let C=n.basicAuth[t];if(C)return`Basic ${btoa(`${C.username}:${C.password}`)}`}return null}function pathPrefixes(t){let n=t.pathname.split(`/`).filter(Boolean),S=[];for(let C=n.length;C>=0;C--){let N=n.slice(0,C).join(`/`);S.push(N?`//${t.host}/${N}`:`//${t.host}`)}return S}var th=__esmMin(()=>{}),PackageNotFoundError,IntegrityError,RegistryTimeoutError,RegistryUnreachableError,nh=__esmMin(()=>{PackageNotFoundError=class extends Error{name;url;constructor(t,n){super(`Package not found in registry: ${t} (${n})`),this.name=t,this.url=n,this.name=`PackageNotFoundError`}},IntegrityError=class extends Error{url;integrity;constructor(t,n){super(`Tarball integrity mismatch for ${t} (expected ${n})`),this.url=t,this.integrity=n,this.name=`IntegrityError`}},RegistryTimeoutError=class extends Error{url;timeoutMs;attempts;constructor(t,n,S){let C=Math.round(n/100)/10,N=Math.round(n*S/100)/10;super(`@gjsify/npm-registry: GET ${t} timed out after ${C}s × ${S} attempt(s) (total ~${N}s). This usually means the registry CDN is slow or unreachable.`),this.url=t,this.timeoutMs=n,this.attempts=S,this.name=`RegistryTimeoutError`}},RegistryUnreachableError=class extends Error{url;attempts;elapsedMs;constructor(t,n,S,C){let N=Math.round(S/100)/10,F=C instanceof Error?C.message:String(C);super(`@gjsify/npm-registry: GET ${t} failed after ${n} attempt(s) over ~${N}s: ${F}. This usually means the registry or the network dropped out.`),this.url=t,this.attempts=n,this.elapsedMs=S,this.name=`RegistryUnreachableError`,this.cause=C}}});function registryFor(t,n){if(n&&t.startsWith(`@`)){let S=t.slice(0,t.indexOf(`/`)),C=n.scopes[S];if(C)return ensureTrailingSlash$1(C)}return n?.registry?ensureTrailingSlash$1(n.registry):rh}function parseNpmrc(t){let n={registry:rh,scopes:{},authTokens:{},basicAuth:{}},S=t.split(/\r?\n/),C={};for(let t of S){let S=t.replace(/^\s+|\s+$/g,``);if(!S||S.startsWith(`#`)||S.startsWith(`;`))continue;let N=S.indexOf(`=`);if(N<0)continue;let F=S.slice(0,N).trim(),I=expandEnv(stripQuotes(S.slice(N+1).trim()));if(F===`registry`){n.registry=ensureTrailingSlash$1(I);continue}let H=F.match(/^(@[^:]+):registry$/);if(H){n.scopes[H[1]]=ensureTrailingSlash$1(I);continue}let W=F.match(/^\/\/(.+):_authToken$/);if(W){n.authTokens[normalizeAuthHost(W[1])]=I;continue}let q=F.match(/^\/\/(.+):username$/);if(q){(C[normalizeAuthHost(q[1])]??={}).user=I;continue}let Y=F.match(/^\/\/(.+):_password$/);if(Y){let t=base64Decode$1(I);(C[normalizeAuthHost(Y[1])]??={}).pass=t;continue}}for(let[t,S]of Object.entries(C))S.user&&S.pass!==void 0&&(n.basicAuth[t]={username:S.user,password:S.pass});return n}function normalizeAuthHost(t){return`//${t.replace(/\/+$/,``)}`}function ensureTrailingSlash$1(t){return t.endsWith(`/`)?t:t+`/`}function stripQuotes(t){return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function expandEnv(t){return t.replace(/\$\{([A-Z0-9_]+)\}/gi,(t,n)=>globalThis.process?.env?.[n]??``)}function base64Decode$1(t){return atob(t)}var rh,ih=__esmMin(()=>{rh=`https://registry.npmjs.org/`,__name$1(ensureTrailingSlash$1,`ensureTrailingSlash`),__name$1(base64Decode$1,`base64Decode`)});async function fetchWithRetry(t,n,S){let C=S.fetch??globalThis.fetch;if(!C)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let N=Math.max(0,S.retries??5),F=Math.max(0,S.retryDelayMs??1e3),I=Math.max(0,S.timeoutMs??3e4),H=S.retryNotFound??!1,W=Date.now(),q=0,Y,X=0;for(;;){if(n.signal?.aborted)throw signalAbortError(n.signal);let Z=I>0?new AbortController:null,te=Z===null?null:setTimeout(()=>Z.abort(Error(`@gjsify/npm-registry: per-request timeout ${I}ms`)),I),ne=composeSignals(n.signal,Z?.signal);try{let F=await C(t,{...n,signal:ne}),I=isRetryableStatus(F.status)||H&&F.status===404;if(F.ok||!I||q>=N)return S.read?await S.read(F):F;try{await F.arrayBuffer()}catch{}Y=Error(`HTTP ${F.status} ${F.statusText}`)}catch(S){let C=Z!==null&&Z.signal.aborted,F=n.signal?.aborted===!0;if(C&&!F){if(X++,q>=N)throw new RegistryTimeoutError(t,I,X);Y=S}else if(F)throw signalAbortError(n.signal);else{if(!isRetryableError(S))throw S;if(q>=N)throw new RegistryUnreachableError(t,q+1,Date.now()-W,S);Y=S}}finally{te!==null&&clearTimeout(te)}let re=Math.min(F*2**q,8e3);S.onRetry?.({attempt:q+1,error:Y,delayMs:re}),await delay$1(re,n.signal),q++}}function composeSignals(t,n){return t?n?AbortSignal.any([t,n]):t:n}function isRetryableStatus(t){return t===408||t===425||t===429||t===500||t===502||t===503||t===504||t===521||t===522||t===524||t===525}function isRetryableError(t){if(t&&typeof t==`object`&&`name`in t&&t.name===`AbortError`)return!1;if(t instanceof TypeError)return!0;if(t&&typeof t==`object`&&`name`in t){let n=t.name;if(n===`FetchError`)return!0;if(n===`AbortError`)return!1}let n=t?.cause;if(n&&typeof n==`object`&&`code`in n){let t=n.code;if(typeof t==`string`)return t===`ECONNRESET`||t===`ECONNREFUSED`||t===`ENETUNREACH`||t===`ENOTFOUND`||t===`ETIMEDOUT`||t===`EAI_AGAIN`||t===`UND_ERR_SOCKET`||t===`UND_ERR_CONNECT_TIMEOUT`}return!1}function delay$1(t,n){return t<=0?Promise.resolve():new Promise((S,C)=>{let N=setTimeout(()=>{n?.removeEventListener?.(`abort`,onAbort),S()},t),onAbort=()=>{clearTimeout(N),C(signalAbortError(n))};if(n?.aborted){clearTimeout(N),C(signalAbortError(n));return}n?.addEventListener?.(`abort`,onAbort,{once:!0})})}function signalAbortError(t){let n=t&&`reason`in t?t.reason:void 0;if(n instanceof Error)return n;let S=Error(`Aborted`);return S.name=`AbortError`,S}var ah=__esmMin(()=>{nh(),__name$1(delay$1,`delay`)});async function verifyIntegrity(t,n){let S=n.trim().split(/\s+/);for(let n of S){let S=n.indexOf(`-`);if(S<0)continue;let C=n.slice(0,S).toLowerCase(),N=n.slice(S+1),F=globalThis.crypto?.subtle;if(!F)throw Error(`@gjsify/npm-registry: globalThis.crypto.subtle is missing`);let I=subriToWebCryptoAlgo(C);if(!I)continue;let H=await F.digest(I,dataAsArrayBuffer(t));if(bytesToBase64(new Uint8Array(H))===N)return!0}return!1}function subriToWebCryptoAlgo(t){switch(t){case`sha1`:return`SHA-1`;case`sha256`:return`SHA-256`;case`sha384`:return`SHA-384`;case`sha512`:return`SHA-512`;default:return null}}function dataAsArrayBuffer(t){if(t.byteOffset===0&&t.byteLength===t.buffer.byteLength)return t.buffer;let n=new Uint8Array(t.byteLength);return n.set(t),n.buffer}function bytesToBase64(t){let n=``;for(let S=0;S<t.length;S++)n+=String.fromCharCode(t[S]);return btoa(n)}var oh=__esmMin(()=>{});function assertPackument(t,n){if(!n||typeof n!=`object`)throw TypeError(`registry: ${t} packument is not an object`);let S=n;if(typeof S.name!=`string`)throw TypeError(`registry: ${t} packument missing string name`);if(!S.versions||typeof S.versions!=`object`)throw TypeError(`registry: ${t} packument missing versions map`)}function packumentUrl(t,n){let S=ensureTrailingSlash$1(n);if(t.startsWith(`@`)){let n=t.indexOf(`/`);if(n<0)throw TypeError(`Invalid scoped package name: ${t}`);let C=t.slice(0,n),N=t.slice(n+1);return`${S}${encodeURIComponent(C)}/${encodeURIComponent(N)}`}return`${S}${encodeURIComponent(t)}`}async function fetchPackumentConditional(t,n={}){let S=packumentUrl(t,n.registry??registryFor(t,n.npmrc)),C=buildHeaders(S,{...n,acceptEncoding:`gzip`});C.accept??=n.fullMetadata?`application/json`:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`,n.ifNoneMatch&&(C[`if-none-match`]=n.ifNoneMatch);let N=await fetchWithRetry(S,{headers:C,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,read:async n=>{if(n.status===304){try{await n.arrayBuffer()}catch{}return{status:`not-modified`}}if(!n.ok)throw n.status===404||n.status===406?new PackageNotFoundError(t,S):Error(`registry GET ${S} -> ${n.status} ${n.statusText}`);return{status:`fresh`,body:await decodeJsonBody(n),etag:n.headers.get(`etag`)??void 0}}});if(N.status===`not-modified`)return{status:`not-modified`,etag:n.ifNoneMatch};let F=N.body;return assertPackument(t,F),{status:`fresh`,packument:F,etag:N.etag}}async function decodeJsonBody(t){return t.json()}async function fetchPackument(t,n={}){let S=await fetchPackumentConditional(t,n);if(!S.packument)throw Error(`registry: ${t} returned 304 Not Modified to an unconditional request`);return S.packument}var sh=__esmMin(()=>{th(),nh(),ih(),ah()});async function fetchTarball(t,n={}){let S=buildHeaders(t,{...n,acceptEncoding:`identity`});S.accept??=`application/octet-stream`;let C=await fetchWithRetry(t,{headers:S,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,retryNotFound:n.retryNotFound??!0,read:async n=>{if(!n.ok)throw Error(`tarball GET ${t} -> ${n.status} ${n.statusText}`);return new Uint8Array(await n.arrayBuffer())}});if(n.integrity&&!await verifyIntegrity(C,n.integrity))throw new IntegrityError(t,n.integrity);return C}var ch=__esmMin(()=>{th(),nh(),ah(),oh()});async function whoami(t,n){let S=`${ensureTrailingSlash$1(t)}-/whoami`,C=buildHeaders(S,{npmrc:n});C.accept=`application/json`;let N=globalThis.fetch;if(!N)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let F=await N(S,{method:`GET`,headers:C});if(!F.ok)throw Error(`whoami GET ${S} -> ${F.status} ${F.statusText}`);let I=await F.json();if(I&&typeof I==`object`&&`username`in I){let t=I.username;if(typeof t==`string`&&t.length>0)return{username:t}}return{}}var lh=__esmMin(()=>{th(),ih()}),uh=__esmMin(()=>{th(),nh(),ih(),oh(),sh(),ch(),lh()});function escapePackageName(t){return t.replace(`/`,`%2f`)}function buildPublishHeaders(t,n){let S=buildHeaders(t,{npmrc:n.npmrc});return S[`content-type`]=`application/json`,S[`npm-command`]=`publish`,S[`npm-auth-type`]=n.otp?`legacy`:`web`,S[`user-agent`]=n.userAgent??defaultUserAgent(),n.otp&&(S[`npm-otp`]=n.otp),n.authorization&&(S.authorization=n.authorization),S}function cliVersion(){return dh===void 0&&(dh=`0.64.16`),dh}function cliPackageDir(){let t=globalThis.process?.env?.GJSIFY_CLI_PACKAGE_JSON,n;try{n=Pn(t||fileURLToPath(import.meta.url))}catch{return null}for(let t=0;t<12;t++){try{if(JSON.parse(readFileSync(`${n}/package.json`,`utf8`)).name===`@gjsify/cli`)return n}catch{}let t=Pn(n);if(t===n)break;n=t}return null}function defaultUserAgent(){let t=globalThis.process,n=t?.arch??`x64`,S=t?.platform??`linux`;return`gjsify-publish/${cliVersion()} (${S} ${n})`}var dh,fh=__esmMin(()=>{Jd(),Hn(),$n(),uh()}),ph,mh=__esmMin(()=>{ph=`gjsify`});function parseDeclaredChannel(t,n){if(!(t===void 0||t===``)){if(hh.includes(t))return t;throw Error(`${n}: "${String(t)}" is not a distribution channel. Known: ${hh.join(`, `)}.`)}}function channelAllowsDonations(t){return t!==void 0&&gh[t]===!0}var hh,gh,vh,yh=__esmMin(()=>{hh=[`flathub`,`web`,`microsoft-store`,`apple-app-store`],gh={flathub:!0,web:!0,"microsoft-store":!1,"apple-app-store":!1},vh=`GJSIFY_CHANNEL`}),bh=__commonJSMin(((t,n)=>{let S=(Hn(),__toCommonJS(En)),C=(Wl(),__toCommonJS(Bl)),N=(Jd(),__toCommonJS(Kd)),resolveFrom=(t,n,F)=>{if(typeof t!=`string`)throw TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof t}\``);if(typeof n!=`string`)throw TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof n}\``);try{t=N.realpathSync(t)}catch(n){if(n.code===`ENOENT`)t=S.resolve(t);else if(F)return null;else throw n}let I=S.join(t,`noop.js`),resolveFileName=()=>C._resolveFilename(n,{id:I,filename:I,paths:C._nodeModulePaths(t)});if(F)try{return resolveFileName()}catch{return null}return resolveFileName()};n.exports=(t,n)=>resolveFrom(t,n),n.exports.silent=(t,n)=>resolveFrom(t,n,!0)})),xh=__commonJSMin(((t,n)=>{let callsites=()=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=(t,n)=>n;let n=Error().stack.slice(1);return Error.prepareStackTrace=t,n};n.exports=callsites,n.exports.default=callsites})),Sh=__commonJSMin(((t,n)=>{let S=xh();n.exports=t=>{let n=S();if(!t)return n[2].getFileName();let C=!1;n.shift();for(let S of n){let n=S.getFileName();if(typeof n==`string`){if(n===t){C=!0;continue}if(n!==`module.js`&&C&&n!==t)return n}}}})),Ch=__commonJSMin(((t,n)=>{var{__gjsifyModuleDir:S,__gjsifyModuleFile:C}=(Jl(),__toCommonJS(Gl)),N=S(`import-fresh/index.js`),F=C(`import-fresh/index.js`);let I=(Hn(),__toCommonJS(En)),H=bh(),W=Sh();n.exports=t=>{if(typeof t!=`string`)throw TypeError(`Expected a string`);let n=W(F),S=n?I.dirname(n):N,C=H(S,t),q=Y.cache[C];if(q&&q.parent){let t=q.parent.children.length;for(;t--;)q.parent.children[t].id===C&&q.parent.children.splice(t,1)}delete Y.cache[C];let X=Y.cache[n];return X===void 0||X.require===void 0?Y(C):X.require(C)}})),wh=__commonJSMin(((t,n)=>{n.exports=function isArrayish(t){return t?t instanceof Array||Array.isArray(t)||t.length>=0&&t.splice instanceof Function:!1}})),Th=__commonJSMin(((t,n)=>{var S=(Nu(),__toCommonJS(ku)),C=wh(),N=function errorEx(t,n){(!t||t.constructor!==String)&&(n=t||{},t=Error.name);var N=function ErrorEXError(S){if(!this)return new ErrorEXError(S);S=S instanceof Error?S.message:S||this.message,Error.call(this,S),Error.captureStackTrace(this,N),this.name=t,Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,get:function(){var t=S.split(/\r?\n/g);for(var N in n)if(n.hasOwnProperty(N)){var F=n[N];`message`in F&&(t=F.message(this[N],t)||t,C(t)||(t=[t]))}return t.join(`
148
+ `,`f`),__classPrivateFieldSet(this,Yp,__classPrivateFieldGet(this,Yp,`f`)+t.join(` `),`f`)}}}[gm](t){objectKeys(__classPrivateFieldGet(this,Xp,`f`)).forEach(n=>{if((t=>t===`configObjects`)(n))return;let S=__classPrivateFieldGet(this,Xp,`f`)[n];Array.isArray(S)?S.includes(t)&&S.splice(S.indexOf(t),1):typeof S==`object`&&delete S[t]}),delete __classPrivateFieldGet(this,um,`f`).getDescriptions()[t]}[_m](t,n,S){__classPrivateFieldGet(this,Bp,`f`)[S]||(__classPrivateFieldGet(this,om,`f`).process.emitWarning(t,n),__classPrivateFieldGet(this,Bp,`f`)[S]=!0)}[vm](){__classPrivateFieldGet(this,Hp,`f`).push({options:__classPrivateFieldGet(this,Xp,`f`),configObjects:__classPrivateFieldGet(this,Xp,`f`).configObjects.slice(0),exitProcess:__classPrivateFieldGet(this,Vp,`f`),groups:__classPrivateFieldGet(this,Wp,`f`),strict:__classPrivateFieldGet(this,sm,`f`),strictCommands:__classPrivateFieldGet(this,cm,`f`),strictOptions:__classPrivateFieldGet(this,lm,`f`),completionCommand:__classPrivateFieldGet(this,Ip,`f`),output:__classPrivateFieldGet(this,Yp,`f`),exitError:__classPrivateFieldGet(this,Rp,`f`),hasOutput:__classPrivateFieldGet(this,Gp,`f`),parsed:this.parsed,parseFn:__classPrivateFieldGet(this,$p,`f`),parseContext:__classPrivateFieldGet(this,em,`f`)}),__classPrivateFieldGet(this,um,`f`).freeze(),__classPrivateFieldGet(this,pm,`f`).freeze(),__classPrivateFieldGet(this,Mp,`f`).freeze(),__classPrivateFieldGet(this,Up,`f`).freeze()}[ym](){let t=``,n;return n=/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this,om,`f`).process.argv()[0])?__classPrivateFieldGet(this,om,`f`).process.argv().slice(1,2):__classPrivateFieldGet(this,om,`f`).process.argv().slice(0,1),t=n.map(t=>{let n=this[Wm](__classPrivateFieldGet(this,Np,`f`),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&n.length<t.length?n:t}).join(` `).trim(),__classPrivateFieldGet(this,om,`f`).getEnv(`_`)&&__classPrivateFieldGet(this,om,`f`).getProcessArgvBin()===__classPrivateFieldGet(this,om,`f`).getEnv(`_`)&&(t=__classPrivateFieldGet(this,om,`f`).getEnv(`_`).replace(`${__classPrivateFieldGet(this,om,`f`).path.dirname(__classPrivateFieldGet(this,om,`f`).process.execPath())}/`,``)),t}[bm](){return __classPrivateFieldGet(this,Qp,`f`)}[xm](){return __classPrivateFieldGet(this,dm,`f`)}[Sm](){if(!__classPrivateFieldGet(this,zp,`f`))return;let t=__classPrivateFieldGet(this,om,`f`).getEnv(`LC_ALL`)||__classPrivateFieldGet(this,om,`f`).getEnv(`LC_MESSAGES`)||__classPrivateFieldGet(this,om,`f`).getEnv(`LANG`)||__classPrivateFieldGet(this,om,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(t.replace(/[.:].*/,``))}[Cm](){return this[Tm]().version||`unknown`}[wm](t){let n=t[`--`]?t[`--`]:t._;for(let t=0,S;(S=n[t])!==void 0;t++)__classPrivateFieldGet(this,om,`f`).Parser.looksLikeNumber(S)&&Number.isSafeInteger(Math.floor(parseFloat(`${S}`)))&&(n[t]=Number(S));return t}[Tm](t){let n=t||`*`;if(__classPrivateFieldGet(this,tm,`f`)[n])return __classPrivateFieldGet(this,tm,`f`)[n];let S={};try{let n=t||__classPrivateFieldGet(this,om,`f`).mainFilename;__classPrivateFieldGet(this,om,`f`).path.extname(n)&&(n=__classPrivateFieldGet(this,om,`f`).path.dirname(n));let C=__classPrivateFieldGet(this,om,`f`).findUp(n,(t,n)=>{if(n.includes(`package.json`))return`package.json`});assertNotStrictEqual(C,void 0,__classPrivateFieldGet(this,om,`f`)),S=JSON.parse(__classPrivateFieldGet(this,om,`f`).readFileSync(C,`utf8`))}catch{}return __classPrivateFieldGet(this,tm,`f`)[n]=S||{},__classPrivateFieldGet(this,tm,`f`)[n]}[Em](t,n){n=[].concat(n),n.forEach(n=>{n=this[Am](n),__classPrivateFieldGet(this,Xp,`f`)[t].push(n)})}[Dm](t,n,S,C){this[km](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Xp,`f`)[t][n]=S})}[Om](t,n,S,C){this[km](t,n,S,C,(t,n,S)=>{__classPrivateFieldGet(this,Xp,`f`)[t][n]=(__classPrivateFieldGet(this,Xp,`f`)[t][n]||[]).concat(S)})}[km](t,n,S,C,N){if(Array.isArray(S))S.forEach(n=>{t(n,C)});else if((t=>typeof t==`object`)(S))for(let n of objectKeys(S))t(n,S[n]);else N(n,this[Am](S),C)}[Am](t){return t===`__proto__`?`___proto___`:t}[jm](t,n){return this[Dm](this[jm].bind(this),`key`,t,n),this}[Mm](){var t,n,S,C,N,F,I,H,W,q,Y,X;let Z=__classPrivateFieldGet(this,Hp,`f`).pop();assertNotStrictEqual(Z,void 0,__classPrivateFieldGet(this,om,`f`));let te;t=this,n=this,S=this,C=this,N=this,F=this,I=this,H=this,W=this,q=this,Y=this,X=this,{options:{set value(n){__classPrivateFieldSet(t,Xp,n,`f`)}}.value,configObjects:te,exitProcess:{set value(t){__classPrivateFieldSet(n,Vp,t,`f`)}}.value,groups:{set value(t){__classPrivateFieldSet(S,Wp,t,`f`)}}.value,output:{set value(t){__classPrivateFieldSet(C,Yp,t,`f`)}}.value,exitError:{set value(t){__classPrivateFieldSet(N,Rp,t,`f`)}}.value,hasOutput:{set value(t){__classPrivateFieldSet(F,Gp,t,`f`)}}.value,parsed:this.parsed,strict:{set value(t){__classPrivateFieldSet(I,sm,t,`f`)}}.value,strictCommands:{set value(t){__classPrivateFieldSet(H,cm,t,`f`)}}.value,strictOptions:{set value(t){__classPrivateFieldSet(W,lm,t,`f`)}}.value,completionCommand:{set value(t){__classPrivateFieldSet(q,Ip,t,`f`)}}.value,parseFn:{set value(t){__classPrivateFieldSet(Y,$p,t,`f`)}}.value,parseContext:{set value(t){__classPrivateFieldSet(X,em,t,`f`)}}.value}=Z,__classPrivateFieldGet(this,Xp,`f`).configObjects=te,__classPrivateFieldGet(this,um,`f`).unfreeze(),__classPrivateFieldGet(this,pm,`f`).unfreeze(),__classPrivateFieldGet(this,Mp,`f`).unfreeze(),__classPrivateFieldGet(this,Up,`f`).unfreeze()}[Nm](t,n){return maybeAsyncResult(n,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Pm].bind(this),getContext:this[Fm].bind(this),getHasOutput:this[Im].bind(this),getLoggerInstance:this[Lm].bind(this),getParseContext:this[Rm].bind(this),getParserConfiguration:this[bm].bind(this),getUsageConfiguration:this[xm].bind(this),getUsageInstance:this[zm].bind(this),getValidationInstance:this[Bm].bind(this),hasParseCallback:this[Vm].bind(this),isGlobalContext:this[Hm].bind(this),postProcess:this[Um].bind(this),reset:this[Gm].bind(this),runValidation:this[qm].bind(this),runYargsParserAndExecuteCommands:this[Km].bind(this),setHasOutput:this[Jm].bind(this)}}[Pm](){return __classPrivateFieldGet(this,Mp,`f`)}[Fm](){return __classPrivateFieldGet(this,Pp,`f`)}[Im](){return __classPrivateFieldGet(this,Gp,`f`)}[Lm](){return __classPrivateFieldGet(this,Jp,`f`)}[Rm](){return __classPrivateFieldGet(this,em,`f`)||{}}[zm](){return __classPrivateFieldGet(this,um,`f`)}[Bm](){return __classPrivateFieldGet(this,pm,`f`)}[Vm](){return!!__classPrivateFieldGet(this,$p,`f`)}[Hm](){return __classPrivateFieldGet(this,qp,`f`)}[Um](t,n,S,C){return S||isPromise(t)?t:(n||(t=this[mm](t)),(this[bm]()[`parse-positional-numbers`]||this[bm]()[`parse-positional-numbers`]===void 0)&&(t=this[wm](t)),C&&(t=applyMiddleware(t,this,__classPrivateFieldGet(this,Up,`f`).getMiddleware(),!1)),t)}[Gm](t={}){__classPrivateFieldSet(this,Xp,__classPrivateFieldGet(this,Xp,`f`)||{},`f`);let n={};n.local=__classPrivateFieldGet(this,Xp,`f`).local||[],n.configObjects=__classPrivateFieldGet(this,Xp,`f`).configObjects||[];let S={};return n.local.forEach(n=>{S[n]=!0,(t[n]||[]).forEach(t=>{S[t]=!0})}),Object.assign(__classPrivateFieldGet(this,nm,`f`),Object.keys(__classPrivateFieldGet(this,Wp,`f`)).reduce((t,n)=>{let C=__classPrivateFieldGet(this,Wp,`f`)[n].filter(t=>!(t in S));return C.length>0&&(t[n]=C),t},{})),__classPrivateFieldSet(this,Wp,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(t=>{n[t]=(__classPrivateFieldGet(this,Xp,`f`)[t]||[]).filter(t=>!S[t])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(t=>{n[t]=objFilter(__classPrivateFieldGet(this,Xp,`f`)[t],t=>!S[t])}),n.envPrefix=__classPrivateFieldGet(this,Xp,`f`).envPrefix,__classPrivateFieldSet(this,Xp,n,`f`),__classPrivateFieldSet(this,um,__classPrivateFieldGet(this,um,`f`)?__classPrivateFieldGet(this,um,`f`).reset(S):usage(this,__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldSet(this,pm,__classPrivateFieldGet(this,pm,`f`)?__classPrivateFieldGet(this,pm,`f`).reset(S):validation(this,__classPrivateFieldGet(this,um,`f`),__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldSet(this,Mp,__classPrivateFieldGet(this,Mp,`f`)?__classPrivateFieldGet(this,Mp,`f`).reset():command(__classPrivateFieldGet(this,um,`f`),__classPrivateFieldGet(this,pm,`f`),__classPrivateFieldGet(this,Up,`f`),__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldGet(this,Fp,`f`)||__classPrivateFieldSet(this,Fp,completion(this,__classPrivateFieldGet(this,um,`f`),__classPrivateFieldGet(this,Mp,`f`),__classPrivateFieldGet(this,om,`f`)),`f`),__classPrivateFieldGet(this,Up,`f`).reset(),__classPrivateFieldSet(this,Ip,null,`f`),__classPrivateFieldSet(this,Yp,``,`f`),__classPrivateFieldSet(this,Rp,null,`f`),__classPrivateFieldSet(this,Gp,!1,`f`),this.parsed=!1,this}[Wm](t,n){return __classPrivateFieldGet(this,om,`f`).path.relative(t,n)}[Km](t,n,S,C=0,N=!1){let F=!!S||N;t||=__classPrivateFieldGet(this,im,`f`),__classPrivateFieldGet(this,Xp,`f`).__=__classPrivateFieldGet(this,om,`f`).y18n.__,__classPrivateFieldGet(this,Xp,`f`).configuration=this[bm]();let I=!!__classPrivateFieldGet(this,Xp,`f`).configuration[`populate--`],H=Object.assign({},__classPrivateFieldGet(this,Xp,`f`).configuration,{"populate--":!0}),W=__classPrivateFieldGet(this,om,`f`).Parser.detailed(t,Object.assign({},__classPrivateFieldGet(this,Xp,`f`),{configuration:{"parse-positional-numbers":!1,...H}})),q=Object.assign(W.argv,__classPrivateFieldGet(this,em,`f`)),Y,X=W.aliases,Z=!1,te=!1;Object.keys(q).forEach(t=>{t===__classPrivateFieldGet(this,Kp,`f`)&&q[t]?Z=!0:t===__classPrivateFieldGet(this,fm,`f`)&&q[t]&&(te=!0)}),q.$0=this.$0,this.parsed=W,C===0&&__classPrivateFieldGet(this,um,`f`).clearCachedHelpMessage();try{if(this[Sm](),n)return this[Um](q,I,!!S,!1);__classPrivateFieldGet(this,Kp,`f`)&&[__classPrivateFieldGet(this,Kp,`f`)].concat(X[__classPrivateFieldGet(this,Kp,`f`)]||[]).filter(t=>t.length>1).includes(``+q._[q._.length-1])&&(q._.pop(),Z=!0),__classPrivateFieldSet(this,qp,!1,`f`);let H=__classPrivateFieldGet(this,Mp,`f`).getCommands(),ne=__classPrivateFieldGet(this,Fp,`f`)?.completionKey?[__classPrivateFieldGet(this,Fp,`f`)?.completionKey,...this.getAliases()[__classPrivateFieldGet(this,Fp,`f`)?.completionKey]??[]].some(t=>Object.prototype.hasOwnProperty.call(q,t)):!1,re=Z||ne||N;if(q._.length){if(H.length){let t;for(let n=C||0,F;q._[n]!==void 0;n++)if(F=String(q._[n]),H.includes(F)&&F!==__classPrivateFieldGet(this,Ip,`f`)){let t=__classPrivateFieldGet(this,Mp,`f`).runCommand(F,this,W,n+1,N,Z||te||N);return this[Um](t,I,!!S,!1)}else if(!t&&F!==__classPrivateFieldGet(this,Ip,`f`)){t=F;break}!__classPrivateFieldGet(this,Mp,`f`).hasDefaultCommand()&&__classPrivateFieldGet(this,am,`f`)&&t&&!re&&__classPrivateFieldGet(this,pm,`f`).recommendCommands(t,H)}__classPrivateFieldGet(this,Ip,`f`)&&q._.includes(__classPrivateFieldGet(this,Ip,`f`))&&!ne&&(__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),this.showCompletionScript(),this.exit(0))}if(__classPrivateFieldGet(this,Mp,`f`).hasDefaultCommand()&&!re){let t=__classPrivateFieldGet(this,Mp,`f`).runCommand(null,this,W,0,N,Z||te||N);return this[Um](t,I,!!S,!1)}if(ne){__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),t=[].concat(t);let n=t.slice(t.indexOf(`--${__classPrivateFieldGet(this,Fp,`f`).completionKey}`)+1);return __classPrivateFieldGet(this,Fp,`f`).getCompletion(n,(t,n)=>{if(t)throw new Al(t.message);(n||[]).forEach(t=>{__classPrivateFieldGet(this,Jp,`f`).log(t)}),this.exit(0)}),this[Um](q,!I,!!S,!1)}if(__classPrivateFieldGet(this,Gp,`f`)||(Z?(__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),F=!0,this.showHelp(t=>{__classPrivateFieldGet(this,Jp,`f`).log(t),this.exit(0)})):te&&(__classPrivateFieldGet(this,Vp,`f`)&&setBlocking(!0),F=!0,__classPrivateFieldGet(this,um,`f`).showVersion(`log`),this.exit(0))),!F&&__classPrivateFieldGet(this,Xp,`f`).skipValidation.length>0&&(F=Object.keys(q).some(t=>__classPrivateFieldGet(this,Xp,`f`).skipValidation.indexOf(t)>=0&&q[t]===!0)),!F){if(W.error)throw new Al(W.error.message);if(!ne){let t=this[qm](X,{},W.error);S||(Y=applyMiddleware(q,this,__classPrivateFieldGet(this,Up,`f`).getMiddleware(),!0)),Y=this[Nm](t,Y??q),isPromise(Y)&&!S&&(Y=Y.then(()=>applyMiddleware(q,this,__classPrivateFieldGet(this,Up,`f`).getMiddleware(),!1)))}}}catch(t){if(t instanceof Al)__classPrivateFieldGet(this,um,`f`).fail(t.message,t);else throw t}return this[Um](Y??q,I,!!S,!0)}[qm](t,n,S,C){let N={...this.getDemandedOptions()};return F=>{if(S)throw new Al(S.message);__classPrivateFieldGet(this,pm,`f`).nonOptionCount(F),__classPrivateFieldGet(this,pm,`f`).requiredArguments(F,N);let I=!1;__classPrivateFieldGet(this,cm,`f`)&&(I=__classPrivateFieldGet(this,pm,`f`).unknownCommands(F)),__classPrivateFieldGet(this,sm,`f`)&&!I?__classPrivateFieldGet(this,pm,`f`).unknownArguments(F,t,n,!!C):__classPrivateFieldGet(this,lm,`f`)&&__classPrivateFieldGet(this,pm,`f`).unknownArguments(F,t,{},!1,!1),__classPrivateFieldGet(this,pm,`f`).limitedChoices(F),__classPrivateFieldGet(this,pm,`f`).implications(F),__classPrivateFieldGet(this,pm,`f`).conflicting(F)}}[Jm](){__classPrivateFieldSet(this,Gp,!0,`f`)}[Ym](t){if(typeof t==`string`)__classPrivateFieldGet(this,Xp,`f`).key[t]=!0;else for(let n of t)__classPrivateFieldGet(this,Xp,`f`).key[n]=!0}}}),Qm,$m=__esmMin(()=>{dp(),Zm(),Qm=YargsFactory(up)});function classifyCliFailure(t,n){return typeof t==`string`&&t.length>0?{kind:`usage`,message:t}:{kind:`runtime`}}var eh=__esmMin(()=>{});function buildHeaders(t,n){let S={"user-agent":`gjsify-install/0.64.17-next.292`,"accept-encoding":n.acceptEncoding??`identity`};if(n.npmrc){let C=resolveAuthForUrl(t,n.npmrc);C&&(S.authorization=C)}if(n.headers)for(let[t,C]of Object.entries(n.headers))S[t.toLowerCase()]=C;return S}function resolveAuthForUrl(t,n){let S=pathPrefixes(new URL(t));for(let t of S){let S=n.authTokens[t];if(S)return`Bearer ${S}`;let C=n.basicAuth[t];if(C)return`Basic ${btoa(`${C.username}:${C.password}`)}`}return null}function pathPrefixes(t){let n=t.pathname.split(`/`).filter(Boolean),S=[];for(let C=n.length;C>=0;C--){let N=n.slice(0,C).join(`/`);S.push(N?`//${t.host}/${N}`:`//${t.host}`)}return S}var th=__esmMin(()=>{}),PackageNotFoundError,IntegrityError,RegistryTimeoutError,RegistryUnreachableError,nh=__esmMin(()=>{PackageNotFoundError=class extends Error{name;url;constructor(t,n){super(`Package not found in registry: ${t} (${n})`),this.name=t,this.url=n,this.name=`PackageNotFoundError`}},IntegrityError=class extends Error{url;integrity;constructor(t,n){super(`Tarball integrity mismatch for ${t} (expected ${n})`),this.url=t,this.integrity=n,this.name=`IntegrityError`}},RegistryTimeoutError=class extends Error{url;timeoutMs;attempts;constructor(t,n,S){let C=Math.round(n/100)/10,N=Math.round(n*S/100)/10;super(`@gjsify/npm-registry: GET ${t} timed out after ${C}s × ${S} attempt(s) (total ~${N}s). This usually means the registry CDN is slow or unreachable.`),this.url=t,this.timeoutMs=n,this.attempts=S,this.name=`RegistryTimeoutError`}},RegistryUnreachableError=class extends Error{url;attempts;elapsedMs;constructor(t,n,S,C){let N=Math.round(S/100)/10,F=C instanceof Error?C.message:String(C);super(`@gjsify/npm-registry: GET ${t} failed after ${n} attempt(s) over ~${N}s: ${F}. This usually means the registry or the network dropped out.`),this.url=t,this.attempts=n,this.elapsedMs=S,this.name=`RegistryUnreachableError`,this.cause=C}}});function registryFor(t,n){if(n&&t.startsWith(`@`)){let S=t.slice(0,t.indexOf(`/`)),C=n.scopes[S];if(C)return ensureTrailingSlash$1(C)}return n?.registry?ensureTrailingSlash$1(n.registry):rh}function parseNpmrc(t){let n={registry:rh,scopes:{},authTokens:{},basicAuth:{}},S=t.split(/\r?\n/),C={};for(let t of S){let S=t.replace(/^\s+|\s+$/g,``);if(!S||S.startsWith(`#`)||S.startsWith(`;`))continue;let N=S.indexOf(`=`);if(N<0)continue;let F=S.slice(0,N).trim(),I=expandEnv(stripQuotes(S.slice(N+1).trim()));if(F===`registry`){n.registry=ensureTrailingSlash$1(I);continue}let H=F.match(/^(@[^:]+):registry$/);if(H){n.scopes[H[1]]=ensureTrailingSlash$1(I);continue}let W=F.match(/^\/\/(.+):_authToken$/);if(W){n.authTokens[normalizeAuthHost(W[1])]=I;continue}let q=F.match(/^\/\/(.+):username$/);if(q){(C[normalizeAuthHost(q[1])]??={}).user=I;continue}let Y=F.match(/^\/\/(.+):_password$/);if(Y){let t=base64Decode$1(I);(C[normalizeAuthHost(Y[1])]??={}).pass=t;continue}}for(let[t,S]of Object.entries(C))S.user&&S.pass!==void 0&&(n.basicAuth[t]={username:S.user,password:S.pass});return n}function normalizeAuthHost(t){return`//${t.replace(/\/+$/,``)}`}function ensureTrailingSlash$1(t){return t.endsWith(`/`)?t:t+`/`}function stripQuotes(t){return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function expandEnv(t){return t.replace(/\$\{([A-Z0-9_]+)\}/gi,(t,n)=>globalThis.process?.env?.[n]??``)}function base64Decode$1(t){return atob(t)}var rh,ih=__esmMin(()=>{rh=`https://registry.npmjs.org/`,__name$1(ensureTrailingSlash$1,`ensureTrailingSlash`),__name$1(base64Decode$1,`base64Decode`)});async function fetchWithRetry(t,n,S){let C=S.fetch??globalThis.fetch;if(!C)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let N=Math.max(0,S.retries??5),F=Math.max(0,S.retryDelayMs??1e3),I=Math.max(0,S.timeoutMs??3e4),H=S.retryNotFound??!1,W=Date.now(),q=0,Y,X=0;for(;;){if(n.signal?.aborted)throw signalAbortError(n.signal);let Z=I>0?new AbortController:null,te=Z===null?null:setTimeout(()=>Z.abort(Error(`@gjsify/npm-registry: per-request timeout ${I}ms`)),I),ne=composeSignals(n.signal,Z?.signal);try{let F=await C(t,{...n,signal:ne}),I=isRetryableStatus(F.status)||H&&F.status===404;if(F.ok||!I||q>=N)return S.read?await S.read(F):F;try{await F.arrayBuffer()}catch{}Y=Error(`HTTP ${F.status} ${F.statusText}`)}catch(S){let C=Z!==null&&Z.signal.aborted,F=n.signal?.aborted===!0;if(C&&!F){if(X++,q>=N)throw new RegistryTimeoutError(t,I,X);Y=S}else if(F)throw signalAbortError(n.signal);else{if(!isRetryableError(S))throw S;if(q>=N)throw new RegistryUnreachableError(t,q+1,Date.now()-W,S);Y=S}}finally{te!==null&&clearTimeout(te)}let re=Math.min(F*2**q,8e3);S.onRetry?.({attempt:q+1,error:Y,delayMs:re}),await delay$1(re,n.signal),q++}}function composeSignals(t,n){return t?n?AbortSignal.any([t,n]):t:n}function isRetryableStatus(t){return t===408||t===425||t===429||t===500||t===502||t===503||t===504||t===521||t===522||t===524||t===525}function isRetryableError(t){if(t&&typeof t==`object`&&`name`in t&&t.name===`AbortError`)return!1;if(t instanceof TypeError)return!0;if(t&&typeof t==`object`&&`name`in t){let n=t.name;if(n===`FetchError`)return!0;if(n===`AbortError`)return!1}let n=t?.cause;if(n&&typeof n==`object`&&`code`in n){let t=n.code;if(typeof t==`string`)return t===`ECONNRESET`||t===`ECONNREFUSED`||t===`ENETUNREACH`||t===`ENOTFOUND`||t===`ETIMEDOUT`||t===`EAI_AGAIN`||t===`UND_ERR_SOCKET`||t===`UND_ERR_CONNECT_TIMEOUT`}return!1}function delay$1(t,n){return t<=0?Promise.resolve():new Promise((S,C)=>{let N=setTimeout(()=>{n?.removeEventListener?.(`abort`,onAbort),S()},t),onAbort=()=>{clearTimeout(N),C(signalAbortError(n))};if(n?.aborted){clearTimeout(N),C(signalAbortError(n));return}n?.addEventListener?.(`abort`,onAbort,{once:!0})})}function signalAbortError(t){let n=t&&`reason`in t?t.reason:void 0;if(n instanceof Error)return n;let S=Error(`Aborted`);return S.name=`AbortError`,S}var ah=__esmMin(()=>{nh(),__name$1(delay$1,`delay`)});async function verifyIntegrity(t,n){let S=n.trim().split(/\s+/);for(let n of S){let S=n.indexOf(`-`);if(S<0)continue;let C=n.slice(0,S).toLowerCase(),N=n.slice(S+1),F=globalThis.crypto?.subtle;if(!F)throw Error(`@gjsify/npm-registry: globalThis.crypto.subtle is missing`);let I=subriToWebCryptoAlgo(C);if(!I)continue;let H=await F.digest(I,dataAsArrayBuffer(t));if(bytesToBase64(new Uint8Array(H))===N)return!0}return!1}function subriToWebCryptoAlgo(t){switch(t){case`sha1`:return`SHA-1`;case`sha256`:return`SHA-256`;case`sha384`:return`SHA-384`;case`sha512`:return`SHA-512`;default:return null}}function dataAsArrayBuffer(t){if(t.byteOffset===0&&t.byteLength===t.buffer.byteLength)return t.buffer;let n=new Uint8Array(t.byteLength);return n.set(t),n.buffer}function bytesToBase64(t){let n=``;for(let S=0;S<t.length;S++)n+=String.fromCharCode(t[S]);return btoa(n)}var oh=__esmMin(()=>{});function assertPackument(t,n){if(!n||typeof n!=`object`)throw TypeError(`registry: ${t} packument is not an object`);let S=n;if(typeof S.name!=`string`)throw TypeError(`registry: ${t} packument missing string name`);if(!S.versions||typeof S.versions!=`object`)throw TypeError(`registry: ${t} packument missing versions map`)}function packumentUrl(t,n){let S=ensureTrailingSlash$1(n);if(t.startsWith(`@`)){let n=t.indexOf(`/`);if(n<0)throw TypeError(`Invalid scoped package name: ${t}`);let C=t.slice(0,n),N=t.slice(n+1);return`${S}${encodeURIComponent(C)}/${encodeURIComponent(N)}`}return`${S}${encodeURIComponent(t)}`}async function fetchPackumentConditional(t,n={}){let S=packumentUrl(t,n.registry??registryFor(t,n.npmrc)),C=buildHeaders(S,{...n,acceptEncoding:`gzip`});C.accept??=n.fullMetadata?`application/json`:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`,n.ifNoneMatch&&(C[`if-none-match`]=n.ifNoneMatch);let N=await fetchWithRetry(S,{headers:C,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,read:async n=>{if(n.status===304){try{await n.arrayBuffer()}catch{}return{status:`not-modified`}}if(!n.ok)throw n.status===404||n.status===406?new PackageNotFoundError(t,S):Error(`registry GET ${S} -> ${n.status} ${n.statusText}`);return{status:`fresh`,body:await decodeJsonBody(n),etag:n.headers.get(`etag`)??void 0}}});if(N.status===`not-modified`)return{status:`not-modified`,etag:n.ifNoneMatch};let F=N.body;return assertPackument(t,F),{status:`fresh`,packument:F,etag:N.etag}}async function decodeJsonBody(t){return t.json()}async function fetchPackument(t,n={}){let S=await fetchPackumentConditional(t,n);if(!S.packument)throw Error(`registry: ${t} returned 304 Not Modified to an unconditional request`);return S.packument}var sh=__esmMin(()=>{th(),nh(),ih(),ah()});async function fetchTarball(t,n={}){let S=buildHeaders(t,{...n,acceptEncoding:`identity`});S.accept??=`application/octet-stream`;let C=await fetchWithRetry(t,{headers:S,signal:n.signal},{fetch:n.fetch,retries:n.retries,retryDelayMs:n.retryDelayMs,timeoutMs:n.timeoutMs,onRetry:n.onRetry,retryNotFound:n.retryNotFound??!0,read:async n=>{if(!n.ok)throw Error(`tarball GET ${t} -> ${n.status} ${n.statusText}`);return new Uint8Array(await n.arrayBuffer())}});if(n.integrity&&!await verifyIntegrity(C,n.integrity))throw new IntegrityError(t,n.integrity);return C}var ch=__esmMin(()=>{th(),nh(),ah(),oh()});async function whoami(t,n){let S=`${ensureTrailingSlash$1(t)}-/whoami`,C=buildHeaders(S,{npmrc:n});C.accept=`application/json`;let N=globalThis.fetch;if(!N)throw Error(`@gjsify/npm-registry: globalThis.fetch is missing`);let F=await N(S,{method:`GET`,headers:C});if(!F.ok)throw Error(`whoami GET ${S} -> ${F.status} ${F.statusText}`);let I=await F.json();if(I&&typeof I==`object`&&`username`in I){let t=I.username;if(typeof t==`string`&&t.length>0)return{username:t}}return{}}var lh=__esmMin(()=>{th(),ih()}),uh=__esmMin(()=>{th(),nh(),ih(),oh(),sh(),ch(),lh()});function escapePackageName(t){return t.replace(`/`,`%2f`)}function buildPublishHeaders(t,n){let S=buildHeaders(t,{npmrc:n.npmrc});return S[`content-type`]=`application/json`,S[`npm-command`]=`publish`,S[`npm-auth-type`]=n.otp?`legacy`:`web`,S[`user-agent`]=n.userAgent??defaultUserAgent(),n.otp&&(S[`npm-otp`]=n.otp),n.authorization&&(S.authorization=n.authorization),S}function cliVersion(){return dh===void 0&&(dh=`0.64.17-next.292`),dh}function cliPackageDir(){let t=globalThis.process?.env?.GJSIFY_CLI_PACKAGE_JSON,n;try{n=Pn(t||fileURLToPath(import.meta.url))}catch{return null}for(let t=0;t<12;t++){try{if(JSON.parse(readFileSync(`${n}/package.json`,`utf8`)).name===`@gjsify/cli`)return n}catch{}let t=Pn(n);if(t===n)break;n=t}return null}function defaultUserAgent(){let t=globalThis.process,n=t?.arch??`x64`,S=t?.platform??`linux`;return`gjsify-publish/${cliVersion()} (${S} ${n})`}var dh,fh=__esmMin(()=>{Jd(),Hn(),$n(),uh()}),ph,mh=__esmMin(()=>{ph=`gjsify`});function parseDeclaredChannel(t,n){if(!(t===void 0||t===``)){if(hh.includes(t))return t;throw Error(`${n}: "${String(t)}" is not a distribution channel. Known: ${hh.join(`, `)}.`)}}function channelAllowsDonations(t){return t!==void 0&&gh[t]===!0}var hh,gh,vh,yh=__esmMin(()=>{hh=[`flathub`,`web`,`microsoft-store`,`apple-app-store`],gh={flathub:!0,web:!0,"microsoft-store":!1,"apple-app-store":!1},vh=`GJSIFY_CHANNEL`}),bh=__commonJSMin(((t,n)=>{let S=(Hn(),__toCommonJS(En)),C=(Wl(),__toCommonJS(Bl)),N=(Jd(),__toCommonJS(Kd)),resolveFrom=(t,n,F)=>{if(typeof t!=`string`)throw TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof t}\``);if(typeof n!=`string`)throw TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof n}\``);try{t=N.realpathSync(t)}catch(n){if(n.code===`ENOENT`)t=S.resolve(t);else if(F)return null;else throw n}let I=S.join(t,`noop.js`),resolveFileName=()=>C._resolveFilename(n,{id:I,filename:I,paths:C._nodeModulePaths(t)});if(F)try{return resolveFileName()}catch{return null}return resolveFileName()};n.exports=(t,n)=>resolveFrom(t,n),n.exports.silent=(t,n)=>resolveFrom(t,n,!0)})),xh=__commonJSMin(((t,n)=>{let callsites=()=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=(t,n)=>n;let n=Error().stack.slice(1);return Error.prepareStackTrace=t,n};n.exports=callsites,n.exports.default=callsites})),Sh=__commonJSMin(((t,n)=>{let S=xh();n.exports=t=>{let n=S();if(!t)return n[2].getFileName();let C=!1;n.shift();for(let S of n){let n=S.getFileName();if(typeof n==`string`){if(n===t){C=!0;continue}if(n!==`module.js`&&C&&n!==t)return n}}}})),Ch=__commonJSMin(((t,n)=>{var{__gjsifyModuleDir:S,__gjsifyModuleFile:C}=(Jl(),__toCommonJS(Gl)),N=S(`import-fresh/index.js`),F=C(`import-fresh/index.js`);let I=(Hn(),__toCommonJS(En)),H=bh(),W=Sh();n.exports=t=>{if(typeof t!=`string`)throw TypeError(`Expected a string`);let n=W(F),S=n?I.dirname(n):N,C=H(S,t),q=Y.cache[C];if(q&&q.parent){let t=q.parent.children.length;for(;t--;)q.parent.children[t].id===C&&q.parent.children.splice(t,1)}delete Y.cache[C];let X=Y.cache[n];return X===void 0||X.require===void 0?Y(C):X.require(C)}})),wh=__commonJSMin(((t,n)=>{n.exports=function isArrayish(t){return t?t instanceof Array||Array.isArray(t)||t.length>=0&&t.splice instanceof Function:!1}})),Th=__commonJSMin(((t,n)=>{var S=(Nu(),__toCommonJS(ku)),C=wh(),N=function errorEx(t,n){(!t||t.constructor!==String)&&(n=t||{},t=Error.name);var N=function ErrorEXError(S){if(!this)return new ErrorEXError(S);S=S instanceof Error?S.message:S||this.message,Error.call(this,S),Error.captureStackTrace(this,N),this.name=t,Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,get:function(){var t=S.split(/\r?\n/g);for(var N in n)if(n.hasOwnProperty(N)){var F=n[N];`message`in F&&(t=F.message(this[N],t)||t,C(t)||(t=[t]))}return t.join(`
149
149
  `)},set:function(t){S=t}});var F=null,I=Object.getOwnPropertyDescriptor(this,`stack`),H=I.get,W=I.value;delete I.value,delete I.writable,I.set=function(t){F=t},I.get=function(){var t=(F||(H?H.call(this):W)).split(/\r?\n+/g);F||(t[0]=this.name+`: `+this.message);var S=1;for(var C in n)if(n.hasOwnProperty(C)){var N=n[C];if(`line`in N){var I=N.line(this[C]);I&&t.splice(S++,0,` `+I)}`stack`in N&&N.stack(this[C],t)}return t.join(`
150
150
  `)},Object.defineProperty(this,"stack",I)};return Object.setPrototypeOf?(Object.setPrototypeOf(N.prototype,Error.prototype),Object.setPrototypeOf(N,Error)):S.inherits(N,Error),N};N.append=function(t,n){return{message:function(S,C){return S||=n,S&&(C[0]+=` `+t.replace(`%s`,S.toString())),C}}},N.line=function(t,n){return{line:function(S){return S||=n,S?t.replace(`%s`,S.toString()):null}}},n.exports=N})),Eh=__commonJSMin(((t,n)=>{let hexify=t=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return`0x`+(n.length%2?`0`:``)+n},parseError=(t,n,S)=>{if(!n)return{message:t.message+` while parsing empty string`,position:0};let C=t.message.match(/^Unexpected token (.) .*position\s+(\d+)/i),N=C?+C[2]:t.message.match(/^Unexpected end of JSON.*/i)?n.length-1:null,F=C?t.message.replace(/^Unexpected token ./,`Unexpected token ${JSON.stringify(C[1])} (${hexify(C[1])})`):t.message;if(N!=null){let t=N<=S?0:N-S,C=N+S>=n.length?n.length:N+S,I=(t===0?``:`...`)+n.slice(t,C)+(C===n.length?``:`...`);return{message:F+` while parsing ${n===I?``:`near `}${JSON.stringify(I)}`,position:N}}else return{message:F+` while parsing '${n.slice(0,S*2)}'`,position:0}};var JSONParseError=class extends SyntaxError{constructor(t,n,S,C){S||=20;let N=parseError(t,n,S);super(N.message),Object.assign(this,N),this.code=`EJSONPARSE`,this.systemError=t,Error.captureStackTrace(this,C||this.constructor)}get name(){return this.constructor.name}set name(t){}get[Symbol.toStringTag](){return this.constructor.name}};let S=Symbol.for(`indent`),C=Symbol.for(`newline`),N=/^\s*[{\[]((?:\r?\n)+)([\s\t]*)/,F=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,parseJson=(t,n,I)=>{let H=stripBOM(t);I||=20;try{let[,t=`
151
151
  `,I=` `]=H.match(F)||H.match(N)||[,``,``],W=JSON.parse(H,n);return W&&typeof W==`object`&&(W[C]=t,W[S]=I),W}catch(n){if(typeof t!=`string`&&!Buffer.isBuffer(t)){let S=Array.isArray(t)&&t.length===0;throw Object.assign(TypeError(`Cannot parse ${S?`an empty array`:String(t)}`),{code:`EJSONPARSE`,systemError:n})}throw new JSONParseError(n,H,I,parseJson)}},stripBOM=t=>String(t).replace(/^\uFEFF/,``);n.exports=parseJson,parseJson.JSONParseError=JSONParseError,parseJson.noExceptions=(t,n)=>{try{return JSON.parse(stripBOM(t),n)}catch{}}})),Dh=__commonJSMin((t=>{t.__esModule=!0,t.LinesAndColumns=void 0;var n=`
@@ -766,7 +766,7 @@ var S=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,N=Object.pr
766
766
  `)}}}var Pj,Fj,Ij,Lj,Rj,zj=__esmMin(()=>{jd(),Pj=`gjsify-gschema`,Fj=new Set([`b`,`i`,`u`,`d`,`s`,`ab`,`ai`,`au`,`ad`,`as`]),Ij=[`range`,`choices`,`enum`,`flags`,`child`,`override`],__name$1(lineOf$1,`lineOf`),__name$1(attr$1,`attr`),Lj=/\.gschema\.xml\?schema(?:&|$)/,Rj={browser:`@gjsify/app-settings/browser`,nativescript:`@gjsify/app-settings/nativescript`}});function lineOf(t,n){return t.slice(0,n).split(`
767
767
  `).length}function attr(t,n){return RegExp(`\\s${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(t)?.slice(1).find(t=>t!==void 0)}function prepareGresourceXml(t,n,S){let C=t.replace(/<!--[\s\S]*?-->/g,t=>t.replace(/[^\n]/g,` `));for(let t of C.matchAll(/<file\b([^>]*)>([\s\S]*?)<\/file>/g))if((attr(t[1],`preprocess`)??``).split(`,`).map(t=>t.trim()).includes(`to-pixdata`))throw Error(`${n}:${lineOf(C,t.index)}: '${t[2].trim()}' uses preprocess="to-pixdata", which GLib deprecated and the web and NativeScript cannot decode; ship the PNG as it is (ADR 0116 § 2)`);if(S.compressed===`keep`)return t;let N=``,F=0;for(let n of C.matchAll(/<file\b[^>]*>/g))N+=t.slice(F,n.index),N+=t.slice(n.index,n.index+n[0].length).replace(/\scompressed\s*=\s*(?:"[^"]*"|'[^']*')/,``),F=n.index+n[0].length;return N+t.slice(F)}async function compileResources(t){try{let{stdout:n}=await Bj(Uj,t,{maxBuffer:64*1024*1024});return n}catch(t){let n=t;throw n?.code===`ENOENT`?Error(`${Uj} not found; embedding a .gresource.xml needs it on the build host for every target (ADR 0116). Install it via your distro (package: glib2-devel / libglib2.0-dev).`):Error(`${Uj} failed${n?.code===void 0?``:` (exit ${n.code})`}: ${String(n?.stderr??``)}`)}}async function compileGresource(t,n){let S=await readFile$1(t,`utf8`),C=prepareGresourceXml(S,t,n),N=Pn(t),F=await mkdtemp$1(jn(tmpdir(),`gjsify-gresource-`));try{let n=t;C!==S&&(n=jn(F,`resources.gresource.xml`),await writeFile$1(n,C));let I=jn(F,`resources.gresource`),H=await compileResources([`--sourcedir=${N}`,`--generate-dependencies`,n]);return await compileResources([`--sourcedir=${N}`,`--target=${I}`,n]),{bytes:new Uint8Array(await readFile$1(I)),inputs:H.split(`
768
768
  `).filter(t=>t!==``)}}finally{await rm$1(F,{recursive:!0,force:!0})}}function gresourceModuleSource(t){let n=ot.from(t.buffer,t.byteOffset,t.byteLength).toString(`base64`);return[`const s = ${JSON.stringify(n)};`,`const a = ${JSON.stringify(Wj)};`,`const t = new Uint8Array(128);`,`for (let i = 0; i < 64; i++) t[a.charCodeAt(i)] = i;`,`const b = new Uint8Array((s.length / 4) * 3 - (s.endsWith("==") ? 2 : s.endsWith("=") ? 1 : 0));`,`for (let i = 0, j = 0; i < s.length; i += 4) {`,` const v = (t[s.charCodeAt(i)] << 18) | (t[s.charCodeAt(i + 1)] << 12) | (t[s.charCodeAt(i + 2)] << 6) | t[s.charCodeAt(i + 3)];`,` b[j++] = v >> 16;`,` if (j < b.length) b[j++] = (v >> 8) & 255;`,` if (j < b.length) b[j++] = v & 255;`,`}`,`export default b;`].join(`
769
- `)}function gresourcePlugin(t){return{name:Vj,async load(n){if(!Hj.test(n))return null;let{bytes:S,inputs:C}=await compileGresource(n,t),N=this;for(let t of[n,...C])N.addWatchFile?.(t);let F=gresourceModuleSource(S);return N.info?.(`${n}: ${S.byteLength} B compiled, ${F.length} B embedded (ADR 0116)`),{code:F,moduleType:`js`}}}}var Bj,Vj,Hj,Uj,Wj,Gj=__esmMin(()=>{ht(),W_(),jd(),qg(),Hn(),Nu(),Bj=promisify(execFile),Vj=`gjsify-gresource`,Hj=/\.gresource\.xml$/,Uj=`glib-compile-resources`,Wj=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`});function isScopeRoot(t){switch(t.type){case`Program`:case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSDeclareMethod`:case`TSEmptyBodyFunctionExpression`:return!0;default:return!1}}function bindingNames(t){switch(t.type){case`VariableDeclarator`:return t.id?extractBindingNames(asAcornNode(t.id)):[];case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSDeclareMethod`:case`TSEmptyBodyFunctionExpression`:{let n=t.id?.name===void 0?[]:[t.id.name];for(let S of t.params??[])n.push(...extractBindingNames(asAcornNode(S)));return n}case`ClassDeclaration`:case`ClassExpression`:return t.id?.name===void 0?[]:[t.id.name];case`CatchClause`:return t.param?extractBindingNames(asAcornNode(t.param)):[];case`ImportSpecifier`:case`ImportDefaultSpecifier`:case`ImportNamespaceSpecifier`:return t.local?.name===void 0?[]:[t.local.name];default:return[]}}function hoistsOutward(t,n){switch(t.type){case`FunctionDeclaration`:case`ClassDeclaration`:case`TSDeclareFunction`:return t.id?.name===n;default:return!1}}function freeTarget(t){return t.type===`AssignmentExpression`?t.left?.type===`Identifier`&&Yj.has(t.operator??``)?t.left:null:(t.type===`ForInStatement`||t.type===`ForOfStatement`)&&t.left?.type===`Identifier`?t.left:null}function collectAssignments(t){let n=[],S=new Map,C=!1,N=[{node:t,roots:[]}];for(;N.length>0;){let{node:t,roots:F}=N.pop(),I=isScopeRoot(t)?[t,...F]:F;t.type===`WithStatement`&&(C=!0);for(let n of bindingNames(t)){let C=I[0];if(C&&(addBinding(S,C,n),hoistsOutward(t,n))){let t=I[1];t&&addBinding(S,t,n)}}let H=freeTarget(t);H&&H.name!==void 0&&!qj.has(H.name)&&n.push({name:H.name,start:H.start,end:H.end,roots:I});for(let n of childrenOf$1(t))N.push({node:n,roots:I})}return C?null:n.filter(({name:t,roots:n})=>!n.some(n=>S.get(n)?.has(t))).map(({name:t,start:n,end:S})=>({name:t,start:n,end:S}))}function addBinding(t,n,S){let C=t.get(n);if(C){C.add(S);return}t.set(n,new Set([S]))}function childrenOf$1(t){let n=[];for(let S of Object.values(t)){if(Array.isArray(S)){for(let t of S)pushIfNode(t,n);continue}pushIfNode(S,n)}return n}function pushIfNode(t,n){typeof t!=`object`||!t||typeof t.type==`string`&&n.push(t)}function findImplicitGlobalAssignments(t,n){let S;try{S=parseSource(t,n)}catch{return null}return collectAssignments(S)}function rewriteImplicitGlobalAssignments(t,n){let S=findImplicitGlobalAssignments(t,n);if(!S||S.length===0)return null;let C=t;for(let t of[...S].sort((t,n)=>n.start-t.start))C=C.slice(0,t.start)+Jj+t.name+C.slice(t.end);return C}function implicitGlobalAssignPlugin(){return{name:Kj,transform:{filter:{id:kC},handler(t,n){if(!kC.test(n))return null;let S=rewriteImplicitGlobalAssignments(t,n);return S===null?null:{code:S,map:null}}}}}var Kj,qj,Jj,Yj,asAcornNode,Xj=__esmMin(()=>{mS(),PS(),LC(),Kj=`gjsify-implicit-global-assign`,qj=new Set([`undefined`,`NaN`,`Infinity`,`arguments`,`eval`,`globalThis`,`exports`,`module`,`require`,`__filename`,`__dirname`]),Jj=`globalThis.`,Yj=new Set([`=`]),asAcornNode=t=>t,__name$1(childrenOf$1,`childrenOf`)});function childrenOf(t){let n=[];for(let S of Object.values(t)){let t=Array.isArray(S)?S:[S];for(let S of t)typeof S==`object`&&S&&typeof S.type==`string`&&n.push(S)}return n}function workerAliases(t){let n=new Set([`Worker`]);for(let S of childrenOf(t))if(!(S.type!==`ImportDeclaration`||typeof S.source?.value!=`string`)&&Qj.test(S.source.value))for(let t of S.specifiers??[])t.type===`ImportSpecifier`&&t.imported?.name===`Worker`&&t.local?.name&&n.add(t.local.name);return n}function isWorkerCallee(t,n){return t?t.type===`Identifier`?t.name!==void 0&&n.has(t.name):t.type===`MemberExpression`&&t.computed!==!0&&t.property?.type===`Identifier`&&t.property.name===`Worker`:!1}function isImportMetaUrl(t){return t?.type===`MemberExpression`&&t.computed!==!0&&t.property?.name===`url`&&t.object?.type===`MetaProperty`&&t.object.meta?.name===`import`}function urlLiteral(t){if(t?.type!==`NewExpression`||t.callee?.type!==`Identifier`||t.callee.name!==`URL`)return null;let[n,S]=t.arguments??[];return n?.type!==`Literal`||typeof n.value!=`string`?null:isImportMetaUrl(S)?n:null}function findWorkerUrls(t,n){let S;try{S=parseSource(t,n)}catch{return[]}let C=workerAliases(S),N=[],F=[S];for(;F.length>0;){let t=F.pop();if(t.type===`NewExpression`&&isWorkerCallee(t.callee,C)){let n=urlLiteral(t.arguments?.[0]);n&&N.push({specifier:n.value,start:n.start,end:n.end})}for(let n of childrenOf(t))F.push(n)}return N.sort((t,n)=>t.start-n.start)}function pathHash(t){let n=2166136261;for(let S=0;S<t.length;S++)n^=t.charCodeAt(S),n=Math.imul(n,16777619)>>>0;return n.toString(36)}async function rewriteWorkerUrls(t,n,S,C){let N=findWorkerUrls(t,n).filter(t=>isRelative(t.specifier));if(N.length===0)return null;let F=t,I=!1;for(let t of N.sort((t,n)=>n.start-t.start)){let n=await S(t.specifier);n!==null&&(F=`${F.slice(0,t.start)}${JSON.stringify(`./${C.register(n)}`)}${F.slice(t.end)}`,I=!0)}return I?F:null}function workerUrlPlugin(t){return{name:Zj,transform:{filter:{id:kC},async handler(n,S){if(!kC.test(S)||!n.includes(`import.meta.url`)||!n.includes(`Worker`))return null;let C=await rewriteWorkerUrls(n,S,async t=>{let n=await this.resolve(t,S);return!n||n.external?(this.warn(`${S}: cannot resolve worker script ${t}; left as written`),null):n.id.split(`?`)[0]},t);return C===null?null:{code:C,map:null}}}}}var Zj,Qj,isRelative,WorkerEntries,$j=__esmMin(()=>{Hn(),PS(),LC(),Zj=`gjsify-worker-url`,Qj=/^(?:node:)?worker_threads$/,isRelative=t=>/^\.\.?\//.test(t),WorkerEntries=class{extension;#e=new Map;#t=new Set;#n=new Set;constructor(t=`.js`){this.extension=t}register(t){let n=this.#e.get(t);if(n!==void 0)return n;let S=Fn(t,In(t)),C=`${S}.worker${this.extension}`;return this.#t.has(C)&&(C=`${S}-${pathHash(t)}.worker${this.extension}`),this.#t.add(C),this.#e.set(t,C),C}takePending(){let t=[];for(let[n,S]of this.#e)this.#n.has(n)||(this.#n.add(n),t.push({source:n,fileName:S}));return t}}});function inputShebangStripPlugin(){return{name:`gjsify-input-shebang-strip`,transform:{order:`pre`,handler(t){return t.startsWith(`#!`)?{code:t.replace(nM,``),map:null}:null}}}}function shebangPlugin(t={}){if(!t.enabled)return null;let n=t.line??`#!/usr/bin/env -S gjs -m`;return{name:`gjsify-shebang`,renderChunk:{order:`post`,handler(t,S){return!S.isEntry||t.startsWith(`#!`)?null:{code:n+`
769
+ `)}function gresourcePlugin(t){return{name:Vj,async load(n){if(!Hj.test(n))return null;let{bytes:S,inputs:C}=await compileGresource(n,t),N=this;for(let t of[n,...C])N.addWatchFile?.(t);let F=gresourceModuleSource(S);return N.info?.(`${n}: ${S.byteLength} B compiled, ${F.length} B embedded (ADR 0116)`),{code:F,moduleType:`js`}}}}var Bj,Vj,Hj,Uj,Wj,Gj=__esmMin(()=>{ht(),W_(),jd(),qg(),Hn(),Nu(),Bj=promisify(execFile),Vj=`gjsify-gresource`,Hj=/\.gresource\.xml$/,Uj=`glib-compile-resources`,Wj=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`});function isScopeRoot(t){switch(t.type){case`Program`:case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSDeclareMethod`:case`TSEmptyBodyFunctionExpression`:return!0;default:return!1}}function bindingNames(t){switch(t.type){case`VariableDeclarator`:return t.id?extractBindingNames(asAcornNode(t.id)):[];case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSDeclareMethod`:case`TSEmptyBodyFunctionExpression`:{let n=t.id?.name===void 0?[]:[t.id.name];for(let S of t.params??[])n.push(...extractBindingNames(asAcornNode(S)));return n}case`ClassDeclaration`:case`ClassExpression`:return t.id?.name===void 0?[]:[t.id.name];case`CatchClause`:return t.param?extractBindingNames(asAcornNode(t.param)):[];case`ImportSpecifier`:case`ImportDefaultSpecifier`:case`ImportNamespaceSpecifier`:return t.local?.name===void 0?[]:[t.local.name];default:return[]}}function hoistsOutward(t,n){switch(t.type){case`FunctionDeclaration`:case`ClassDeclaration`:case`TSDeclareFunction`:return t.id?.name===n;default:return!1}}function freeTarget(t){return t.type===`AssignmentExpression`?t.left?.type===`Identifier`&&Yj.has(t.operator??``)?t.left:null:(t.type===`ForInStatement`||t.type===`ForOfStatement`)&&t.left?.type===`Identifier`?t.left:null}function collectAssignments(t){let n=[],S=new Map,C=!1,N=[{node:t,roots:[]}];for(;N.length>0;){let{node:t,roots:F}=N.pop(),I=isScopeRoot(t)?[t,...F]:F;t.type===`WithStatement`&&(C=!0);for(let n of bindingNames(t)){let C=I[0];if(C&&(addBinding(S,C,n),hoistsOutward(t,n))){let t=I[1];t&&addBinding(S,t,n)}}let H=freeTarget(t);H&&H.name!==void 0&&!qj.has(H.name)&&n.push({name:H.name,start:H.start,end:H.end,roots:I});for(let n of childrenOf$1(t))N.push({node:n,roots:I})}return C?null:n.filter(({name:t,roots:n})=>!n.some(n=>S.get(n)?.has(t))).map(({name:t,start:n,end:S})=>({name:t,start:n,end:S}))}function addBinding(t,n,S){let C=t.get(n);if(C){C.add(S);return}t.set(n,new Set([S]))}function childrenOf$1(t){let n=[];for(let S of Object.values(t)){if(Array.isArray(S)){for(let t of S)pushIfNode(t,n);continue}pushIfNode(S,n)}return n}function pushIfNode(t,n){typeof t!=`object`||!t||typeof t.type==`string`&&n.push(t)}function findImplicitGlobalAssignments(t,n){let S;try{S=parseSource(t,n)}catch{return null}return collectAssignments(S)}function rewriteImplicitGlobalAssignments(t,n){let S=findImplicitGlobalAssignments(t,n);if(!S||S.length===0)return null;let C=t;for(let t of[...S].sort((t,n)=>n.start-t.start))C=C.slice(0,t.start)+Jj+t.name+C.slice(t.end);return C}function implicitGlobalAssignPlugin(){return{name:Kj,transform:{filter:{id:kC},handler(t,n){if(!kC.test(n))return null;let S=rewriteImplicitGlobalAssignments(t,n);return S===null?null:{code:S,map:null}}}}}var Kj,qj,Jj,Yj,asAcornNode,Xj=__esmMin(()=>{mS(),PS(),LC(),Kj=`gjsify-implicit-global-assign`,qj=new Set([`undefined`,`NaN`,`Infinity`,`arguments`,`eval`,`globalThis`,`exports`,`module`,`require`,`__filename`,`__dirname`]),Jj=`globalThis.`,Yj=new Set([`=`]),asAcornNode=t=>t,__name$1(childrenOf$1,`childrenOf`)});function childrenOf(t){let n=[];for(let S of Object.values(t)){let t=Array.isArray(S)?S:[S];for(let S of t)typeof S==`object`&&S&&typeof S.type==`string`&&n.push(S)}return n}function workerAliases(t){let n=new Set([`Worker`]);for(let S of childrenOf(t))if(!(S.type!==`ImportDeclaration`||typeof S.source?.value!=`string`)&&Qj.test(S.source.value))for(let t of S.specifiers??[])t.type===`ImportSpecifier`&&t.imported?.name===`Worker`&&t.local?.name&&n.add(t.local.name);return n}function isWorkerCallee(t,n){return t?t.type===`Identifier`?t.name!==void 0&&n.has(t.name):t.type===`MemberExpression`&&t.computed!==!0&&t.property?.type===`Identifier`&&t.property.name===`Worker`:!1}function isImportMetaUrl(t){return t?.type===`MemberExpression`&&t.computed!==!0&&t.property?.name===`url`&&t.object?.type===`MetaProperty`&&t.object.meta?.name===`import`}function urlLiteral(t){if(t?.type!==`NewExpression`||t.callee?.type!==`Identifier`||t.callee.name!==`URL`)return null;let[n,S]=t.arguments??[];return n?.type!==`Literal`||typeof n.value!=`string`?null:isImportMetaUrl(S)?n:null}function findWorkerUrls(t,n){let S;try{S=parseSource(t,n)}catch{return[]}let C=workerAliases(S),N=[],F=[S];for(;F.length>0;){let t=F.pop();if(t.type===`NewExpression`&&isWorkerCallee(t.callee,C)){let n=urlLiteral(t.arguments?.[0]);n&&N.push({specifier:n.value,start:n.start,end:n.end})}for(let n of childrenOf(t))F.push(n)}return N.sort((t,n)=>t.start-n.start)}function bundleSuffix(t){let n=Fn(t).replace(/^\.+/,``),S=n.indexOf(`.`);return S===-1?`.js`:n.slice(S)}function pathHash(t){let n=2166136261;for(let S=0;S<t.length;S++)n^=t.charCodeAt(S),n=Math.imul(n,16777619)>>>0;return n.toString(36)}async function rewriteWorkerUrls(t,n,S,C){let N=findWorkerUrls(t,n).filter(t=>isRelative(t.specifier));if(N.length===0)return null;let F=t,I=!1;for(let t of N.sort((t,n)=>n.start-t.start)){let n=await S(t.specifier);n!==null&&(F=`${F.slice(0,t.start)}${JSON.stringify(`./${C.register(n)}`)}${F.slice(t.end)}`,I=!0)}return I?F:null}function workerUrlPlugin(t){return{name:Zj,transform:{filter:{id:kC},async handler(n,S){if(!kC.test(S)||!n.includes(`import.meta.url`)||!n.includes(`Worker`))return null;let C=await rewriteWorkerUrls(n,S,async t=>{let n=await this.resolve(t,S);return!n||n.external?(this.warn(`${S}: cannot resolve worker script ${t}; left as written`),null):n.id.split(`?`)[0]},t);return C===null?null:{code:C,map:null}}}}}var Zj,Qj,isRelative,WorkerEntries,$j=__esmMin(()=>{Hn(),PS(),LC(),Zj=`gjsify-worker-url`,Qj=/^(?:node:)?worker_threads$/,isRelative=t=>/^\.\.?\//.test(t),WorkerEntries=class{extension;#e=new Map;#t=new Set;#n=new Set;constructor(t=`.js`){this.extension=t}register(t){let n=this.#e.get(t);if(n!==void 0)return n;let S=Fn(t,In(t)),C=`${S}.worker${this.extension}`;return this.#t.has(C)&&(C=`${S}-${pathHash(t)}.worker${this.extension}`),this.#t.add(C),this.#e.set(t,C),C}takePending(){let t=[];for(let[n,S]of this.#e)this.#n.has(n)||(this.#n.add(n),t.push({source:n,fileName:S}));return t}}});function inputShebangStripPlugin(){return{name:`gjsify-input-shebang-strip`,transform:{order:`pre`,handler(t){return t.startsWith(`#!`)?{code:t.replace(nM,``),map:null}:null}}}}function shebangPlugin(t={}){if(!t.enabled)return null;let n=t.line??`#!/usr/bin/env -S gjs -m`;return{name:`gjsify-shebang`,renderChunk:{order:`post`,handler(t,S){return!S.isEntry||t.startsWith(`#!`)?null:{code:n+`
770
770
  `+t,map:null}}}}}function expandEnvTemplate(t,n=process.env){return t.replace(/\$\{env:([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g,(t,S,C)=>{let N=n[S];return N!==void 0&&N!==``?N:C??``})}function resolveShebangLine(t,n=eM){if(t===void 0||t===!1)return null;if(t===!0)return n;let S=expandEnvTemplate(t);return S.trim()?S.startsWith(`#!`)?S:`#!`+S:null}var eM,tM,nM,rM=__esmMin(()=>{eM=`#!/usr/bin/env -S gjs -m`,tM=`#!/usr/bin/env node`,nM=/^#![^\n]*\n/});function resolveShim(t){let n=On(iM,`../shims/${t}.js`);if(existsSync(n))return n;try{return createRequire(import.meta.url).resolve(`@gjsify/rolldown-plugin-gjsify/shims/${t}`)}catch(S){throw Error(`@gjsify/rolldown-plugin-gjsify: cannot locate the "${t}" shim. Tried ${n} and the "./shims/${t}" subpath export.`,{cause:S})}}function flattenAliases$4(t){let n={};for(let[S,C]of Object.entries(t))C&&(n[S]=C);return n}function createGjsExternalsPredicate(t=[]){let n=[`cairo`,`gettext`,`system`,...t];return t=>isRegisterSubpath(t)||isGjsifyShim(t)?!1:!!(t.startsWith(`gi://`)||n.includes(t))}function isGjsifyShim(t){return/@gjsify\/rolldown-plugin-gjsify\/shims\/[^?]+$/.test(t)?!0:/[\\/]rolldown-plugin-gjsify[\\/](?:lib|src)[\\/]shims[\\/]/.test(t)}function isRegisterSubpath(t){return!!(/\/register(?:\/[^?]*)?$/.test(t)||/[/\\]register(?:[/\\][^/\\]+)?\.(?:[mc]?js|ts)$/.test(t))}var iM,setupForGjs,aM=__esmMin(()=>{$n(),Hn(),Jd(),Wl(),$S(),eC(),cC(),GS(),pC(),yC(),EC(),VC(),qT(),mj(),Ov(),$y(),LC(),Cj(),kj(),Nj(),zj(),Gj(),Xj(),$j(),rM(),RS(),iM=Pn(fileURLToPath(import.meta.url)),setupForGjs=async t=>{let n=t.userExternal??[],S=[`cairo`,`gettext`,`system`,...n.filter(t=>!isRegisterSubpath(t)&&!isGjsifyShim(t))],C=createGjsExternalsPredicate(n),N=t.pluginOptions.format??`esm`,F=t.pluginOptions.exclude??[],I=await globToEntryPoints(t.input,F),H=resolveShim(`unicorn-magic`),W={...getAliasesForGjs({external:C}),"unicorn-magic":H,...t.pluginOptions.aliases,...t.userAliases},q=t.pluginOptions.consoleShim===!1?null:resolveShim(`console-gjs`),Y=[];t.pluginOptions.autoGlobalsInject&&Y.push(t.pluginOptions.autoGlobalsInject);let X=wrapInputWithSideEffects(I,Y,{preserveDefaultExport:t.pluginOptions.preserveDefaultExport===!0,exitOnReportedCode:!0}),Z={input:X.input,platform:`neutral`,external:S,resolve:{mainFields:N===`esm`?[`browser`,`module`,`main`]:[`browser`,`main`,`module`],conditionNames:[`browser`]},transform:{target:`firefox140`,define:{global:`globalThis`,window:`globalThis`,"process.env.READABLE_STREAM":`"disable"`,"process.env.NODE_ENV":`"production"`},...q?{inject:{console:[q,`console`]}}:{}},output:{...t.output,format:N,sourcemap:!1,codeSplitting:!1},treeshake:!0},te=getBundleDirFromOutput(t.output),ne={"random-access-file":`random-access-file/index.js`,...flattenAliases$4(W)},re=[deepkitPlugin({reflection:t.pluginOptions.reflection})];return t.pluginOptions.dialect===`react-native`&&re.push(reactNativeSupportGatePlugin()),{options:Z,prePlugins:re,plugins:[...X.plugin?[X.plugin]:[],inputShebangStripPlugin(),...q?[consoleAssignPlugin()]:[],gschemaPlugin({mode:`ignore`}),gresourcePlugin({compressed:`keep`}),implicitGlobalAssignPlugin(),...t.pluginOptions.workers?[workerUrlPlugin(t.pluginOptions.workers)]:[],giOptionalPlugin(`gjs`),platformResolvePlugin({suffixes:desktopSuffixChain(desktopOsSuffix()),refusedSuffixes:_C,siblingIndex:!0}),...t.pluginOptions.dialect===`react-native`?[reactNativeAliasPlugin()]:[],aliasPlugin({entries:ne}),napiNodeAddonPlugin({runtimeResolve:N===`esm`}),externalsPlugin(C,{name:`gjsify-gjs-externalize`}),blueprintPlugin(),cssAsStringPlugin({targets:{firefox:60<<16}}),nodeModulesPathRewritePlugin({bundleDir:te,runtimeResolve:N===`esm`}),...t.pluginOptions.skipProcessStub?[]:[processStubPlugin({userBanner:t.userBanner,captureBundleUrl:N===`esm`,giSystemProbes:t.giSystemProbes})],(()=>{let n=resolveShebangLine(t.shebang);return shebangPlugin({enabled:n!==null,line:n??void 0})})(),unresolvedWorkspaceImportPlugin({target:`gjs`,aliases:ne,isExternal:C,...t.pluginOptions.toolchainAnchor===void 0?{}:{toolchainAnchor:t.pluginOptions.toolchainAnchor}})]}},__name$1(flattenAliases$4,`flattenAliases`)});function gjsImportsEmptyPlugin(t={}){let n=t.emptyGirs??!0?/^(@girs\/|gi:\/\/)/:/^gi:\/\//,isVocabulary=t=>/^@girs\/[^/]+\/vocabulary$/.test(t);return{name:`gjsify-gjs-imports-empty`,resolveId:{order:`pre`,filter:{id:n},handler(t){return!n.test(t)||isVocabulary(t)?null:{id:oM}}},load(t){return t===oM?{code:`export {}; export default {};`,moduleSideEffects:!1}:null}}}var oM,sM=__esmMin(()=>{IS(),oM=`${FS}empty-gjs-import`});function readdirSafe(t){try{return readdirSync(t)}catch{return[]}}function hasNodeBinary(t){for(let n of readdirSafe(t))if(n.endsWith(`.node`)||readdirSafe(jn(t,n)).some(t=>t.endsWith(`.node`)))return!0;return!1}function isNodeAddonPackage(t,n){if(isGjsifyNativeBridge(n))return!1;if(n.gypfile===!0||n.binary!==null&&typeof n.binary==`object`||existsSync(jn(t,`binding.gyp`)))return!0;let S={...n.dependencies,...n.optionalDependencies};return lM.some(t=>t in S)||isNapiRsPackageJson(n)?!0:hasNodeBinary(jn(t,`prebuilds`))||hasNodeBinary(jn(t,`build`))}function packageNameOf(t){if(t.startsWith(`.`)||t.startsWith(`/`)||t.startsWith(`\0`)||t.includes(`:`))return null;let n=t.split(`/`);return t.startsWith(`@`)?n.length>=2&&n[1]?`${n[0]}/${n[1]}`:null:n[0]||null}function packageRootFor(t,n){let S=Pn(t);for(let t=0;t<64;t++){let t=jn(S,`package.json`);if(existsSync(t))try{let C=JSON.parse(readFileSync(t,`utf8`));if(C.name===n)return{root:S,pkg:C}}catch{}let C=Pn(S);if(C===S)break;S=C}return null}function nodeNativeExternalPlugin(){let t=new Map;return{name:`gjsify-node-native-external`,resolveId:{order:`pre`,filter:{id:cM},async handler(n,S){let C=packageNameOf(n);if(C===null)return null;let N=typeof S==`string`?S:void 0,F=`${C}\0${N===void 0?``:Pn(N)}`,I=t.get(F);if(I===void 0){I=!1;let S=await this.resolve(n,N,{skipSelf:!0});if(S&&!S.external&&An(S.id)&&existsSync(S.id)){let t=packageRootFor(S.id,C);I=t!==null&&isNodeAddonPackage(t.root,t.pkg)}t.set(F,I)}return I?{id:n,external:!0}:null}}}}var cM,lM,uM=__esmMin(()=>{Jd(),Hn(),cC(),cM=/^[^.\\/:\s\x00][^:\s\x00]*$/,lM=[`node-gyp-build`,`node-gyp-build-optional-packages`,`bindings`,`prebuild-install`,`node-pre-gyp`,`@mapbox/node-pre-gyp`,`cmake-js`]});function assertReverseBridgeRoutes(){let t=createRequire(import.meta.url),resolves=n=>{try{return t.resolve(n),!0}catch{return!1}};for(let[t,n]of Object.entries(mM))if(resolves(t)&&!resolves(n))throw Error(`@gjsify/rolldown-plugin-gjsify: the reverse-bridge entry route for "${t}" is dangling — "${n}" does not resolve, while "${t}" does. Without the route this build silently takes ${t}'s "node" export condition, which is why the route exists; update REVERSE_BRIDGE_ENTRY_ROUTES in app/node.ts to the entry the --app gjs build resolves.`)}function enableGjsRegistersForNode(t){let n={};for(let[S,C]of Object.entries(t))C===`@gjsify/empty`&&pM.test(S)||(n[S]=C);for(let[t,S]of Object.entries(Cv))pM.test(t)&&(n[t]=S);return Object.assign(n,mM),n}function isGjsSourceBuild(t){return!!(t.nodeGiGlobalsInject||t.registerInject)}function flattenAliases$3(t){let n={};for(let[S,C]of Object.entries(t))C&&(n[S]=C);return n}var dM,fM,pM,mM,setupForNode,hM=__esmMin(()=>{Wl(),$S(),mj(),qT(),Dv(),Ov(),$y(),LC(),kj(),sM(),VS(),GS(),zj(),Gj(),Xj(),$j(),pC(),uM(),yC(),EC(),VC(),RS(),dM=`@gjsify/node-gi/globals`,fM=Object.values(Tv),pM=/\/register(\/|$)/,mM={"solid-js":`solid-js/dist/solid.js`},setupForNode=async t=>{let n=t.userExternal??[],S=[...gv,`@gjsify/node-gi`,`@gjsify/node-gi/gi`,dM,...fM,...n],external=t=>!!(S.includes(t)||t===`@gjsify/node-gi`||t.startsWith(`@gjsify/node-gi/`)),C=t.pluginOptions.format??`esm`,N=t.pluginOptions.exclude??[],F=await globToEntryPoints(t.input,N),I=[];t.pluginOptions.nodeGiGlobalsInject&&I.push(dM);let H=t.pluginOptions.autoGlobalsInject;H&&I.push(H);let W=wrapInputWithSideEffects(F,I),q=W.input,Y=isGjsSourceBuild({...t.pluginOptions,registerInject:H});Y&&assertReverseBridgeRoutes();let X=getAliasesForNode({external}),Z=flattenAliases$3({...Y?enableGjsRegistersForNode(X):X,...t.pluginOptions.aliases,...t.userAliases}),te=getBundleDirFromOutput(t.output),ne={input:q,platform:`node`,external:S,resolve:{mainFields:C===`esm`?[`module`,`main`,`browser`]:[`main`,`module`,`browser`],conditionNames:C===`esm`?[`node`]:[`require`]},transform:{target:`node24`,define:{global:`globalThis`}},output:{...t.output,format:C,sourcemap:!1,banner:void 0,codeSplitting:!1},treeshake:!0},re=[deepkitPlugin({reflection:t.pluginOptions.reflection})];return t.pluginOptions.dialect===`react-native`&&re.push(reactNativeSupportGatePlugin()),{options:ne,prePlugins:re,plugins:[...W.plugin?[W.plugin]:[],giOptionalPlugin(`node`),gjsGiNodePlugin(),gjsBuiltinModulesNodePlugin(Tv),gschemaPlugin({mode:`ignore`}),gresourcePlugin({compressed:`keep`}),implicitGlobalAssignPlugin(),...t.pluginOptions.workers?[workerUrlPlugin(t.pluginOptions.workers)]:[],gjsImportsEmptyPlugin({emptyGirs:!Y}),platformResolvePlugin({suffixes:desktopSuffixChain(desktopOsSuffix()),refusedSuffixes:_C,siblingIndex:!0}),...t.pluginOptions.dialect===`react-native`?[reactNativeAliasPlugin()]:[],nodeNativeExternalPlugin(),aliasPlugin({entries:Z}),blueprintPlugin(),cssAsStringPlugin(t.pluginOptions.nodeGiGlobalsInject?{targets:{firefox:60<<16}}:{}),nodeModulesPathRewritePlugin({bundleDir:te}),unresolvedWorkspaceImportPlugin({target:`node`,aliases:Z,isExternal:external})]}},__name$1(flattenAliases$3,`flattenAliases`)});function importLine(t,n){let S=t.specifiers?.[n];return S===void 0?`import { ${n} as namespace } from ${JSON.stringify(t.renderer)};\n`:`import * as namespace from ${JSON.stringify(S)};\n`}function giRendererShimSource(t,n,S){return importLine(t,n)+`const RENDERER = ${JSON.stringify(t.renderer)};\nconst APP = ${JSON.stringify(t.app)};\nconst NS = ${JSON.stringify(n)};\nconst VERSION = ${JSON.stringify(S)};\nexport default new Proxy(namespace, {\n get(target, property, receiver) {\n if (typeof property === 'symbol' || property === 'then' || property in target) {\n return Reflect.get(target, property, receiver);\n }\n throw new Error(\n 'the ' + NS + ' arm (version ' + VERSION + ') on --app ' + APP + ': ' + RENDERER +\n ' has no ' + String(property) + '. A renderer implements a fraction of the GIR ' +\n 'vocabulary, and every absent member is a declared remainder (ADR 0034 clause 3) ' +\n 'rather than an oversight — refused by name here because reading it would be ' +\n 'undefined and \`class X extends undefined\` throws far from the import that asked ' +\n 'for it. It has: ' + Object.keys(target).sort().join(', ') + '.'\n );\n },\n});\n`}function giRendererPlugin(t){let n=Object.keys(t.namespaces).sort().map(n=>`${n} (version ${t.namespaces[n]})`).join(`, `);return{name:`gjsify-gi-renderer`,resolveId:{order:`pre`,filter:{id:/^gi:\/\//},handler(S){let C=parseGiSpecifier(S);if(C===null)return null;let N=t.namespaces[C.namespace];if(N===void 0)throw Error(`gjsify build --app ${t.app}: \`${S}\` has no widget renderer. --gi-renderer answers ${n} out of ${t.renderer} and nothing else — there is no GObject introspection on this target, so a namespace with no renderer counterpart cannot be substituted for. Drop --gi-renderer to keep the previous behaviour (every \`gi://\` import becomes an empty module), or gate the import to a target that has GI (\`--app gjs\`, \`--app node\`).`);if(C.version!==void 0&&C.version!==N)throw Error(`gjsify build --app ${t.app}: \`${S}\` asks for ${C.namespace} version ${C.version}; this arm answers version ${N} — the version ${t.renderer}'s vocabulary is held against. GJS throws on a version it has no typelib for, so accepting it here would make this target the only place a wrong version passes.`);return{id:`${gM}${C.namespace}`}}},load(n){if(!n.startsWith(gM))return null;let S=n.slice(gM.length),C=t.namespaces[S];return C===void 0?null:{code:giRendererShimSource(t,S,C),moduleSideEffects:!1}}}}var gM,_M=__esmMin(()=>{IS(),VS(),gM=`${FS}gi-renderer:`});function blueprintTemplateExit(t,n){return n===void 0?{refusal:`On --app ${t} it is the projected tree of the renderer --gi-renderer composes, and that flag is off. Pass --gi-renderer, or import the file without \`?template\`.`}:{renderer:n.renderer.replace(/^@gjsify\//,``)}}var vM=__esmMin(()=>{});function flattenAliases$2(t){let n={};for(let[S,C]of Object.entries(t))C&&(n[S]=C);return n}var setupForBrowser,yM=__esmMin(()=>{$S(),qT(),mj(),Dv(),$y(),sM(),yC(),_M(),vM(),kj(),pC(),zj(),Gj(),Xj(),$j(),setupForBrowser=async t=>{let n=[...t.userExternal??[]],S=t.pluginOptions.exclude??[],C=await globToEntryPoints(t.input,S),N=t.pluginOptions.giRenderer?pv.browser:void 0,F={};for(let[t,n]of Object.entries(xv))F[t]=n,F[`node:${t}`]=n;let I={},H={...getDerivedAliasesSync(`browser`),...F,...I,...t.pluginOptions.aliases,...t.userAliases},W={input:C,platform:`browser`,external:n,resolve:{mainFields:[`browser`,`module`,`main`],conditionNames:[`import`,`browser`]},transform:{target:`esnext`,define:{global:`globalThis`,window:`globalThis`,"process.env.NODE_ENV":`"production"`}},output:{...t.output,format:`esm`,sourcemap:!1,codeSplitting:!1},treeshake:!0},q=flattenAliases$2(H);return{options:W,prePlugins:[deepkitPlugin({reflection:t.pluginOptions.reflection})],plugins:[platformResolvePlugin({suffixes:browserSuffixChain(),refusedSuffixes:vC,siblingIndex:!0}),...N?[giRendererPlugin({app:`browser`,...N})]:[],gjsImportsEmptyPlugin({emptyGirs:!N}),aliasPlugin({entries:q}),blueprintPlugin({template:blueprintTemplateExit(`browser`,N)}),gschemaPlugin({mode:`emit`,register:Rj.browser}),gresourcePlugin({compressed:`strip`}),implicitGlobalAssignPlugin(),...t.pluginOptions.workers?[workerUrlPlugin(t.pluginOptions.workers)]:[],cssAsStringPlugin(),unresolvedWorkspaceImportPlugin({target:`browser`,aliases:q,isExternal:t=>n.includes(t)})]}},__name$1(flattenAliases$2,`flattenAliases`)}),GettextGuardError,bM=__esmMin(()=>{GettextGuardError=class extends Error{}});function scriptMappingFor(t){let n=SM.exec(t);if(!(!n?.[2]||n[3]))return xM[`${n[1]}_${n[2]}`]}function catalogNames(t,n){let S=t.replace(/-/g,`_`),C=n?.[t]??n?.[S];if(C&&C.length>0)return{catalog:t,posix:dedupe([...C,t]),bcp47:C[0].split(`@`)[0].replace(/_/g,`-`)};if(S.includes(`@`))return{catalog:t,posix:[S],bcp47:S.split(`@`)[0].replace(/_/g,`-`)};let N=SM.exec(S);if(!N)return{catalog:t,posix:[S],bcp47:S.replace(/_/g,`-`)};let[,F,I,H]=N;if(!I)return{catalog:t,posix:dedupe([S,t]),bcp47:S.replace(/_/g,`-`)};if(H)return{catalog:t,posix:dedupe([`${F}_${H}`,t]),bcp47:`${F}-${H}`};let W=xM[`${F}_${I}`];if(W?.bcp47)return{catalog:t,posix:dedupe([...W.posix,t]),bcp47:W.bcp47}}function posixLocaleDirectories(t,n){let S=catalogNames(t,n);if(S)return S.posix;let C=scriptMappingFor(t.replace(/-/g,`_`));return C?dedupe([...C.posix,t]):void 0}function planCatalogNames(t,n){let S=[],C=[];for(let N of t){if(n.namespace===`posix`){let t=posixLocaleDirectories(N,n.localeNames);if(!t){C.push(N);continue}S.push({catalog:N,posix:t,bcp47:``});continue}let t=catalogNames(N,n.localeNames);if(!t){C.push(N);continue}S.push(t)}if(C.length>0)throw new UnmappableCatalogNameError(unmappableMessage(C,n),C);return assertNoCollision(S,n),S}function unmappableMessage(t,n){let S=t.map(t=>` - ${t}.po`).join(`
771
771
  `),C=t.length===1?`a catalog carries`:`${t.length} catalogs carry`;return n.namespace===`posix`?`[${n.pluginName}] ${C} a script subtag with no known POSIX locale:\n${S}\nCompiling it under that name produces a directory glibc never probes, so the language ships complete and renders in English — the build would exit 0 and nothing would look wrong.
772
772
  Map it explicitly in the plugin's \`localeNames\`, e.g. \`{ 'az_Arab': ['az_IR'] }\`, using the name \`locale -a\` lists on the target system.`:`[${n.pluginName}] ${C} a script subtag that has no Android resource qualifier:\n${S}\nA qualifier is built as \`values-<lang>[-r<REGION>]\` and cannot express a script, so the generated directory would be one Android never consults — and the build would exit 0.
@@ -839,7 +839,7 @@ Configure one of:
839
839
  `+S.map(t=>` - ${t}`).join(`
840
840
  `)+"\n\nThe `@gjsify/node-gi/globals` shim seeds them, but it is injected only when the pre-build detection pass finds them — and that pass did not. The two passes therefore disagreed about the module graph. Either the detection ran against a different graph than the one emitted (check that anything feeding `isGjsSourceBuild()` — the `--globals` register stub, `nodeGiGlobalsInject` — is settled BEFORE `detectNodeGiGlobals`), or the offending package should stop reaching for the legacy `imports` object: `gi://<Ns>` and the bare `system`/`gettext`/`cairo` built-ins resolve on both runtimes, `imports` does not.")}var jL=__esmMin(()=>{lL()});function hasWildcard(t){return t.includes(`*`)||t.includes(`?`)}function segmentToRegExp(t){let n=t.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`[^/\\\\]*`).replace(/\?/g,`[^/\\\\]`);return RegExp(`^${n}$`)}function assertInsideCwd(t,n,S){let C=Mn(S,t);if(C===``)throw Error(`gjsify clear: refusing to delete the working directory itself ("${n}").`);if(C===`..`||C.startsWith(`..${zn}`)||An(C))throw Error(`gjsify clear: "${n}" resolves to ${t}, outside the working directory ${S}. Only paths inside the package may be cleared.`)}function resolveClearTargets(t,n){let S=[],C=new Set;for(let N of t)for(let t of expandTarget(N,n))assertInsideCwd(t,N,n.cwd),!C.has(t)&&(C.add(t),S.push(t));return S}function expandTarget(t,n){let S=Fn(t),C=Pn(t);if(hasWildcard(C))throw Error(`gjsify clear: a wildcard is only supported in the last path segment — got "${t}".`);if(!hasWildcard(S))return[On(n.cwd,t)];let N=On(n.cwd,C);assertInsideCwdOrSelf(N,t,n.cwd);let F=segmentToRegExp(S),I;try{I=n.readdir(N)}catch{return[]}return I.filter(t=>F.test(t)).sort().map(t=>jn(N,t))}function assertInsideCwdOrSelf(t,n,S){Mn(S,t)!==``&&assertInsideCwd(t,n,S)}var ML=__esmMin(()=>{Hn()});function tokenizeSimpleCommand(t,n={}){let S=n.allowGlobs===!0?PL:NL,C=[],N=``,F=!1,I=null;for(let n=0;n<t.length;n++){let H=t[n];if(I===`'`){H===`'`?I=null:N+=H;continue}if(I===`"`){if(H===`"`)I=null;else if(H===`\\`&&(t[n+1]===`"`||t[n+1]===`\\`))N+=t[++n];else if(H===`$`||H==="`")return null;else N+=H;continue}if(H===`'`||H===`"`){I=H,F=!0;continue}if(H===` `||H===` `){F&&=(C.push(N),N=``,!1);continue}if(S.includes(H))return null;N+=H,F=!0}return I?null:(F&&C.push(N),C)}function gjsifyCommandArgv(t,n={}){let S=tokenizeSimpleCommand(t,n);return!S||S.length<2||S[0]!==`gjsify`?null:S.slice(1)}var NL,PL,FL=__esmMin(()=>{NL=`|&;<>\`$()\\
841
841
  \r*?{}[]~#!`,PL=NL.replace(`*`,``).replace(`?`,``)});function packageOutputPaths(t){let n=t?.scripts?.clear;if(n===void 0)return[...IL];let S=gjsifyCommandArgv(n,{allowGlobs:!0});return S===null||S[0]!==`clear`?[]:[...S.slice(1).filter(t=>!t.startsWith(`-`)),...IL]}function readPackageManifest(t){try{return JSON.parse(readFileSync(jn(t,`package.json`),`utf-8`))}catch{return null}}function makeOutputMatcher(t){let n=t.map(t=>t.split(/[\\/]+/).filter(t=>t!==``&&t!==`.`).map(t=>hasWildcard(t)?segmentToRegExp(t):t)).filter(t=>t.length>0);return t=>{let S=t.split(`/`);for(let t of n){if(t.length>S.length)continue;let n=!0;for(let C=0;C<t.length;C++){let N=t[C],F=S[C];if(typeof N==`string`?N!==F:!N.test(F)){n=!1;break}}if(n)return!0}return!1}}function walk(t,n,S,C){let N;try{N=readdirSync(t)}catch{return}N.sort();for(let F of N){if(F===`node_modules`||F.startsWith(`.`))continue;let N=n===``?F:`${n}/${F}`;if(S(N))continue;let I=jn(t,F),H;try{H=lstatSync(I)}catch{continue}H.isSymbolicLink()?C.push({rel:N,abs:I,link:readLinkTarget(I)}):H.isDirectory()?walk(I,N,S,C):H.isFile()&&C.push({rel:N,abs:I})}}function readLinkTarget(t){try{return readlinkSync(t)}catch{return``}}function packageBuildInputs(t,n={}){let S=[...packageOutputPaths(n.manifest===void 0?readPackageManifest(t):n.manifest),...n.extraOutputs??[]],C=[];return walk(t,``,makeOutputMatcher(S),C),C}function newestInputMtimeMs(t){let n=0;for(let S of t)try{let{mtimeMs:t}=statSync(S.abs);t>n&&(n=t)}catch{return 1/0}return n}function newestDepSignalMtimeMs(t){let n=0,S=t;for(;;){for(let t of LL){let C=jn(S,t);if(existsSync(C))try{let{mtimeMs:t}=statSync(C);t>n&&(n=t)}catch{}}let t=Pn(S);if(t===S)return n;S=t}}var IL,LL,RL=__esmMin(()=>{Jd(),Hn(),ML(),FL(),IL=[`lib`,`dist`,`dist-templates`],LL=[`gjsify-lock.json`,`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`]}),zL=__exportAll$5({BuildAction:()=>VL});function isUnsafeDefaultOutput(t){if(/\.[cm]?tsx?$/i.test(t))return!0;let n=t.replace(/\\/g,`/`);return!!/(?:^|\/)src\//.test(n)}async function buildPnpPlugin(){return pnpPlugin({issuerUrl:import.meta.url})}function shortHash(t){let n=5381;for(let S=0;S<t.length;S++)n=(n<<5)+n+t.charCodeAt(S)>>>0;return n.toString(16).padStart(8,`0`)}function isTruthyEnv(t){return t===`1`||t===`true`||t===`yes`}async function newestLockfileMtime(t){let n=0;for(let S of LL)try{let C=await stat$1(jn(t,S));C.mtimeMs>n&&(n=C.mtimeMs)}catch{}return n}function runningCliFile(){try{return fileURLToPath(import.meta.url)}catch{return null}}async function isBundleFresh(t,n,S,C){try{let N=await stat$1(t),F=await stat$1(n),I=await newestLockfileMtime(S),H=C===void 0?0:(await stat$1(C)).mtimeMs;return N.mtimeMs>=Math.max(F.mtimeMs,I,H)}catch{return!1}}async function runOneLibraryBuild(t){let n=await gjsifyPlugin({input:t.userBundler.input,output:t.output,userAliases:t.userAliases},t.pluginOpts);return await runBundle({...mergeBundlerOptions(n.options,t.userBundler),plugins:[...t.pnpPlugins,...n.prePlugins,...t.userPlugins,...n.plugins]})}var BL,VL,HL=__esmMin(()=>{_e(),$I(),BN(),x_(),eL(),lL(),uL(),Hn(),$n(),jd(),pL(),mL(),CL(),TL(),DL(),kL(),AL(),jL(),RL(),BL=`#!/usr/bin/env -S gjs -m`,VL=class BuildAction{configData;constructor(t={}){this.configData=t}async buildLibrary(){let{verbose:t,library:n,typescript:S,exclude:C,aliases:N}=this.configData,F=n??{},I=normalizeBundlerOptions(this.configData),H=process.cwd(),W=inputSourceDirs(I.input,H),assertDerivedOutdirSafe=t=>{if(t&&isOutdirInsideSource(t,W,H))throw libraryOutputLeakError(t)},q=F.module?Pn(F.module):void 0,Y=F.main?Pn(F.main):void 0,X=F.module?In(F.module):`.js`,Z=F.main?In(F.main):`.js`,te=q&&Y&&q!==Y,ne=await buildPnpPlugin(),re=ne?[ne]:[],ie=textLoaderPlugin({loaders:this.configData.loaders}),ae=ie?[ie]:[];if(I.plugins?.length){let n=await resolveUserPlugins(I.plugins,process.cwd(),isGjs()?{loadModule:(n,S)=>this.loadPluginViaGjsBundle(n,S,t)}:{});ae.push(...n)}let oe=[];if(te){assertDerivedOutdirSafe(q),assertDerivedOutdirSafe(Y);let n=q.includes(`/cjs`)||X===`.cjs`?`cjs`:`esm`;oe.push(await runOneLibraryBuild({pluginOpts:{debug:t,library:n,exclude:C,reflection:S?.reflection,jsExtension:X},userBundler:I,output:{dir:q},userAliases:N,pnpPlugins:re,userPlugins:ae}));let F=Y.includes(`/cjs`)||Z===`.cjs`?`cjs`:`esm`;oe.push(await runOneLibraryBuild({pluginOpts:{debug:t,library:F,exclude:C,reflection:S?.reflection,jsExtension:Z},userBundler:I,output:{dir:Y},userAliases:N,pnpPlugins:re,userPlugins:ae}))}else{let n=I.output?.dir,H=I.output?.file??F.module??F.main,W=H?In(H):`.js`,q=n??(H?Pn(H):void 0);n===void 0&&assertDerivedOutdirSafe(q);let Y=I.output?.format??(q?.includes(`/cjs`)||W===`.cjs`?`cjs`:`esm`);oe.push(await runOneLibraryBuild({pluginOpts:{debug:t,library:Y,exclude:C,reflection:S?.reflection,jsExtension:W},userBundler:I,output:{dir:q},userAliases:N,pnpPlugins:re,userPlugins:ae}))}return oe}parseGlobalsValue(t){if(t===void 0)return{autoMode:!0,extras:``};if(t===`none`||t===``)return{autoMode:!1,extras:``};let n=t.split(`,`).map(t=>t.trim()).filter(Boolean);return{autoMode:n.includes(`auto`),extras:n.filter(t=>t!==`auto`).join(`,`)}}async resolveGlobalsInject(t,n,S){if(t!==`gjs`&&t!==`node`||!n)return;let C=resolveGlobalsList(n);if(C.size===0)return;let N=await writeRegisterInjectFile(C,process.cwd(),{reverseBridgeOverride:t===`node`});return S&&N&&ge.debug(`[gjsify] globals: injected ${C.size} register module(s) from --globals ${n}`),N??void 0}async applyShebang(t,n,S){if(!n){S&&ge.warn(`[gjsify] --shebang skipped: no single outfile (use --outfile for executables)`);return}let C=t===`node`?tM:BL,N=resolveShebangLine(this.configData.shebang,C)??C,F=await readFile$1(n,`utf-8`);F.startsWith(`#!`)?S&&ge.debug(`[gjsify] --shebang skipped: ${n} already starts with a shebang`):await writeFile$1(n,N+`
842
- `+F),await chmod$1(n,493),S&&ge.debug(`[gjsify] --shebang: wrote ${N} + chmod 0o755 to ${n}`)}async escapeRawNul(t,n,S){let C=[];if(t)C.push(t);else if(n)try{for(let t of await readdir$1(n))(t.endsWith(`.mjs`)||t.endsWith(`.js`))&&C.push(On(n,t))}catch(t){if(t?.code===`ENOENT`)return;throw t}for(let t of C){let n;try{n=await readFile$1(t,`utf-8`)}catch(t){if(t?.code===`ENOENT`)continue;throw t}let{code:C,replaced:N}=escapeRawNulForGjs(n);N!==0&&(await writeFile$1(t,C),S&&ge.debug(`[gjsify] escaped ${N} raw NUL byte(s) in ${t} so GJS can load it`))}}assertGjsOutputLoadable(t,n,S,C){assertGjsBundleLoadable((t.output??[]).filter(t=>t.type===`chunk`),n??S??`the GJS bundle`,{isExternal:createGjsExternalsPredicate(C??[]),emitted:(t.output??[]).map(t=>t.fileName)})}assertNodeOutputGlobals(t,n,S){let C=n??S??`the node bundle`;for(let n of t.output??[]){if(n.type!==`chunk`)continue;let t=n.code;typeof t!=`string`||t.length===0||assertNodeBundleGlobalsShimmed(t,n.fileName?`${C} (${n.fileName})`:C)}}assertNativescriptGiSelected(t,n,S){let C=n??S??`the nativescript bundle`,N=new Set;for(let n of t.output??[]){if(n.type!==`chunk`)continue;let t=n.code;if(!(typeof t!=`string`||t.length===0))for(let n of scanGiNamespaces(t))N.add(n)}let F;try{F=planGiSelection({declared:this.configData.nativescript?.giNamespaces??[],scanned:[...N]})}catch(t){throw Error(`gjsify build: ${C}: ${t.message}`)}for(let t of F.unscanned)ge.warn(`[gjsify] --app nativescript: nativescript.giNamespaces declares ${t}, which ${C} does not appear to import. The APK carries it anyway — drop it if nothing needs it, since every selected namespace costs APK size.`)}async applyBrowserHtml(t,n,S){let C=On(n),N=htmlOutPathFor(C),F=emitBrowserHtml({htmlSource:t.htmlSource,scriptTag:t.scriptTag,scriptSrc:t.scriptSrc,jsOutPath:C,outHtmlPath:N,assets:t.assets});await mkdir$1(Pn(N),{recursive:!0}),await writeFile$1(N,F);for(let{source:n,target:S}of new Map(t.assets.map(t=>[t.target,t])).values()){let t=On(Pn(N),S);await mkdir$1(Pn(t),{recursive:!0}),await copyFile$1(n,t)}S&&ge.debug(`[gjsify] --app browser: wrote ${N}`)}async loadPluginViaGjsBundle(t,n,S){let C=await this.bundlePluginForGjs(t,n,S);try{return await import(pathToFileURL(C).href)}catch(t){throw Error(`gjsify config: failed to import the GJS bundle for plugin "${n}" (bundled to ${C}). (${t.message})`)}}async bundlePluginForGjs(t,n,S){try{return await BuildAction.bundleFileForGjsCached(t,{cacheSubdir:`plugins`,label:n,verbose:S,noCacheEnv:`GJSIFY_NO_PLUGIN_CACHE`,resolveFromToolchain:!0})}catch(t){throw Error(`gjsify config: failed to bundle plugin "${n}" for GJS (needed because GJS can't import packages that use exports-map subpaths directly). (${t.message})`)}}static async bundleFileForGjsCached(t,n){let S=process.cwd(),C=jn(S,`node_modules`,`.cache`,`gjsify`,n.cacheSubdir),N=n.label.replace(/[^a-zA-Z0-9._-]/g,`_`),F=n.resolveFromToolchain===!0?runningCliFile():null,I=jn(C,`${N}-${shortHash(n.globals===void 0&&n.excludeGlobals===void 0&&F===null?t:`${t} ${JSON.stringify([n.globals??null,n.excludeGlobals??null,F])}`)}`,`${Fn(t).replace(/\.[cm]?[jt]sx?$/i,``)}.mjs`);return!(n.cache===!1||n.noCacheEnv&&isTruthyEnv(process.env[n.noCacheEnv]))&&await isBundleFresh(I,t,S,F??void 0)?(n.verbose&&ge.debug(`[gjsify] reusing cached GJS bundle ${I}`),I):(n.verbose&&ge.debug(`[gjsify] bundling ${t} for GJS → ${I}`),await BuildAction.bundleFileForGjs(t,I,{...n,toolchainAnchor:F}),I)}static async bundleFileForGjs(t,n,S){await mkdir$1(Pn(n),{recursive:!0}),await new BuildAction({verbose:S.verbose,...S.globals===void 0?{}:{globals:S.globals},...S.excludeGlobals===void 0?{}:{excludeGlobals:S.excludeGlobals},bundler:{input:t,output:{file:n},...S.define?{transform:{define:S.define}}:{},...S.logLevel?{logLevel:S.logLevel}:{}}}).buildApp(`gjs`,{preserveDefaultExport:S.preserveDefaultExport??!0,...S.toolchainAnchor?{toolchainAnchor:S.toolchainAnchor}:{}})}static runningCliFile(){return runningCliFile()}async buildApp(t=`gjs`,n={}){let{verbose:S,typescript:C,exclude:N,library:F,aliases:I,excludeGlobals:H}=this.configData,W=normalizeBundlerOptions(this.configData),q=describeJsxConfig({transformJsx:W.transform?.jsx,tsconfigJsx:C?.compilerOptions?.jsx,tsconfigJsxImportSource:C?.compilerOptions?.jsxImportSource});if(t===`gjs`&&!q.configured){let t=findJsxEntryPoint(collectEntryPaths(await globToEntryPoints(W.input,N)));if(t!==void 0)throw jsxConfigMissingError(t)}let Y=null;if(t===`browser`){let t=detectHtmlEntry(W.input);if(t){let n=await readFile$1(t,`utf-8`),{moduleEntry:S,scriptTag:C,scriptSrc:N}=parseHtmlEntry(t,n);W.input=S,Y={htmlSource:n,scriptTag:C,scriptSrc:N,assets:collectLinkedAssets(t,n)}}}let X=W.output?.format??(W.output?.file?.endsWith(`.cjs`)?`cjs`:`esm`),Z=X===`iife`?`esm`:X,te=W.output?.file,ne=W.output?.dir;if(!te&&!ne&&(F?.main||F?.module)){let t=Z===`cjs`?F.main??F.module:F.module??F.main;if(t&&isUnsafeDefaultOutput(t))throw Error(`gjsify build: refusing to default --outfile to ${t} (would overwrite a TypeScript source file). Pass --outfile/--outdir explicitly, or set "gjsify.bundler.output.file" in package.json.`);te=t}if(Y&&!te)throw Error(`gjsify build: an .html entry needs an explicit --outfile (e.g. --outfile dist-app/app.js); the emitted index.html is written beside it.`);let{consoleShim:re,globals:ie,dialect:ae,giRenderer:oe,nativescriptLocale:Q}=this.configData,se=Array.isArray(W.external)?W.external:void 0,ce=typeof W.output?.banner==`string`?W.output.banner:void 0,le={debug:S,app:t,format:Z,exclude:N,reflection:C?.reflection,consoleShim:re,...ae===void 0?{}:{dialect:ae},...oe===!0?{giRenderer:!0}:{},...Q?{nativescriptLocale:Q}:{},...I?{aliases:I}:{},...n.preserveDefaultExport?{preserveDefaultExport:!0}:{},...n.toolchainAnchor===void 0?{}:{toolchainAnchor:n.toolchainAnchor}},ue=n.workers===void 0,de=n.workers??(t!==`nativescript`&&!n.watch&&(te||ne)?new WorkerEntries(te&&In(te)||`.js`):void 0);de&&(le.workers=de);let{autoMode:fe,extras:pe}=this.parseGlobalsValue(ie),me=await buildPnpPlugin(),he=me?[me]:[],ge=textLoaderPlugin({loaders:this.configData.loaders}),_e=ge?[ge]:[];if(W.plugins?.length){let t=await resolveUserPlugins(W.plugins,process.cwd(),isGjs()?{loadModule:(t,n)=>this.loadPluginViaGjsBundle(t,n,S)}:{});_e.push(...t)}if(t===`gjs`&&fe){let gjsifyPluginFactory=async t=>{let n=await gjsifyPlugin({input:W.input,output:{file:te,dir:ne},userExternal:se,userBanner:ce,userAliases:I,shebang:this.configData.shebang},t);return{options:n.options,plugins:n.plugins}},{injectPath:t}=await detectAutoGlobals({input:W.input,plugins:[...he,..._e],external:W.external,transform:W.transform,format:Z},le,gjsifyPluginFactory,S,{extraGlobalsList:pe,excludeGlobals:H,cwd:process.cwd(),...n.toolchainAnchor===void 0?{}:{toolchainDir:Pn(n.toolchainAnchor)}},bundleToChunks);le.autoGlobalsInject=t}else if(t===`node`&&fe){pe&&(le.autoGlobalsInject=await this.resolveGlobalsInject(t,pe,S));let gjsifyPluginFactory=async t=>{let n=await gjsifyPlugin({input:W.input,output:{file:te,dir:ne},userExternal:se,userBanner:ce,userAliases:I,shebang:this.configData.shebang},t);return{options:n.options,plugins:n.plugins}};await detectNodeGiGlobals({input:W.input,plugins:[...he,..._e],external:W.external,transform:W.transform,format:Z},le,gjsifyPluginFactory,bundleToChunks)&&(le.nodeGiGlobalsInject=!0)}else pe&&(le.autoGlobalsInject=await this.resolveGlobalsInject(t,pe,S));let ve=t===`gjs`?giSystemProbes():void 0,ye=await gjsifyPlugin({input:W.input,output:{file:te,dir:ne},userExternal:se,userBanner:ce,userAliases:I,shebang:this.configData.shebang,giSystemProbes:ve},le),be={...mergeBundlerOptions(ye.options,W),plugins:[...he,...ye.prePlugins,..._e,...ye.plugins]};if(n.watch)return await this.runWatchLoop(be,t,te,ne,S),[];let xe=await runBundle(be,{onWatchFiles:n.onWatchFiles});return t===`gjs`&&await this.escapeRawNul(te,ne,S),(t===`gjs`||t===`node`)&&this.configData.shebang&&await this.applyShebang(t,te,S),t===`gjs`&&(this.assertGjsOutputLoadable(xe,te,ne,se),q.preserves&&assertGjsBundleParses((xe.output??[]).filter(t=>t.type===`chunk`),te??ne??`the GJS bundle`)),t===`node`&&fe&&!le.nodeGiGlobalsInject&&this.assertNodeOutputGlobals(xe,te,ne),t===`nativescript`&&this.assertNativescriptGiSelected(xe,te,ne),t===`browser`&&Y&&te&&await this.applyBrowserHtml(Y,te,S),de&&ue&&await this.buildWorkers(de,t,Pn(On(te??jn(ne,`x`))),n),[xe]}async buildWorkers(t,n,S,C){let{esbuild:N,...F}=this.configData,I=normalizeBundlerOptions(this.configData);for(let N=t.takePending();N.length>0;N=t.takePending())for(let{source:H,fileName:W}of N){this.configData.verbose&&ge.debug(`[gjsify] bundling worker ${H} → ${W}`);let{dir:N,...q}=I.output??{};await new BuildAction({...F,shebang:!1,bundler:{...I,input:H,output:{...q,file:jn(S,W)}}}).buildApp(n,{...C,workers:t})}}async runWatchLoop(t,n,S,C,N){let F=await runWatch(t),I=new Promise(t=>{F.on(`close`,()=>t())}),H=!1,shutdown=async()=>{if(!H){H=!0,ge.log(`
842
+ `+F),await chmod$1(n,493),S&&ge.debug(`[gjsify] --shebang: wrote ${N} + chmod 0o755 to ${n}`)}async escapeRawNul(t,n,S){let C=[];if(t)C.push(t);else if(n)try{for(let t of await readdir$1(n))(t.endsWith(`.mjs`)||t.endsWith(`.js`))&&C.push(On(n,t))}catch(t){if(t?.code===`ENOENT`)return;throw t}for(let t of C){let n;try{n=await readFile$1(t,`utf-8`)}catch(t){if(t?.code===`ENOENT`)continue;throw t}let{code:C,replaced:N}=escapeRawNulForGjs(n);N!==0&&(await writeFile$1(t,C),S&&ge.debug(`[gjsify] escaped ${N} raw NUL byte(s) in ${t} so GJS can load it`))}}assertGjsOutputLoadable(t,n,S,C){assertGjsBundleLoadable((t.output??[]).filter(t=>t.type===`chunk`),n??S??`the GJS bundle`,{isExternal:createGjsExternalsPredicate(C??[]),emitted:(t.output??[]).map(t=>t.fileName)})}assertNodeOutputGlobals(t,n,S){let C=n??S??`the node bundle`;for(let n of t.output??[]){if(n.type!==`chunk`)continue;let t=n.code;typeof t!=`string`||t.length===0||assertNodeBundleGlobalsShimmed(t,n.fileName?`${C} (${n.fileName})`:C)}}assertNativescriptGiSelected(t,n,S){let C=n??S??`the nativescript bundle`,N=new Set;for(let n of t.output??[]){if(n.type!==`chunk`)continue;let t=n.code;if(!(typeof t!=`string`||t.length===0))for(let n of scanGiNamespaces(t))N.add(n)}let F;try{F=planGiSelection({declared:this.configData.nativescript?.giNamespaces??[],scanned:[...N]})}catch(t){throw Error(`gjsify build: ${C}: ${t.message}`)}for(let t of F.unscanned)ge.warn(`[gjsify] --app nativescript: nativescript.giNamespaces declares ${t}, which ${C} does not appear to import. The APK carries it anyway — drop it if nothing needs it, since every selected namespace costs APK size.`)}async applyBrowserHtml(t,n,S){let C=On(n),N=htmlOutPathFor(C),F=emitBrowserHtml({htmlSource:t.htmlSource,scriptTag:t.scriptTag,scriptSrc:t.scriptSrc,jsOutPath:C,outHtmlPath:N,assets:t.assets});await mkdir$1(Pn(N),{recursive:!0}),await writeFile$1(N,F);for(let{source:n,target:S}of new Map(t.assets.map(t=>[t.target,t])).values()){let t=On(Pn(N),S);await mkdir$1(Pn(t),{recursive:!0}),await copyFile$1(n,t)}S&&ge.debug(`[gjsify] --app browser: wrote ${N}`)}async loadPluginViaGjsBundle(t,n,S){let C=await this.bundlePluginForGjs(t,n,S);try{return await import(pathToFileURL(C).href)}catch(t){throw Error(`gjsify config: failed to import the GJS bundle for plugin "${n}" (bundled to ${C}). (${t.message})`)}}async bundlePluginForGjs(t,n,S){try{return await BuildAction.bundleFileForGjsCached(t,{cacheSubdir:`plugins`,label:n,verbose:S,noCacheEnv:`GJSIFY_NO_PLUGIN_CACHE`,resolveFromToolchain:!0})}catch(t){throw Error(`gjsify config: failed to bundle plugin "${n}" for GJS (needed because GJS can't import packages that use exports-map subpaths directly). (${t.message})`)}}static async bundleFileForGjsCached(t,n){let S=process.cwd(),C=jn(S,`node_modules`,`.cache`,`gjsify`,n.cacheSubdir),N=n.label.replace(/[^a-zA-Z0-9._-]/g,`_`),F=n.resolveFromToolchain===!0?runningCliFile():null,I=jn(C,`${N}-${shortHash(n.globals===void 0&&n.excludeGlobals===void 0&&F===null?t:`${t} ${JSON.stringify([n.globals??null,n.excludeGlobals??null,F])}`)}`,`${Fn(t).replace(/\.[cm]?[jt]sx?$/i,``)}.mjs`);return!(n.cache===!1||n.noCacheEnv&&isTruthyEnv(process.env[n.noCacheEnv]))&&await isBundleFresh(I,t,S,F??void 0)?(n.verbose&&ge.debug(`[gjsify] reusing cached GJS bundle ${I}`),I):(n.verbose&&ge.debug(`[gjsify] bundling ${t} for GJS → ${I}`),await BuildAction.bundleFileForGjs(t,I,{...n,toolchainAnchor:F}),I)}static async bundleFileForGjs(t,n,S){await mkdir$1(Pn(n),{recursive:!0}),await new BuildAction({verbose:S.verbose,...S.globals===void 0?{}:{globals:S.globals},...S.excludeGlobals===void 0?{}:{excludeGlobals:S.excludeGlobals},bundler:{input:t,output:{file:n},...S.define?{transform:{define:S.define}}:{},...S.logLevel?{logLevel:S.logLevel}:{}}}).buildApp(`gjs`,{preserveDefaultExport:S.preserveDefaultExport??!0,...S.toolchainAnchor?{toolchainAnchor:S.toolchainAnchor}:{}})}static runningCliFile(){return runningCliFile()}async buildApp(t=`gjs`,n={}){let{verbose:S,typescript:C,exclude:N,library:F,aliases:I,excludeGlobals:H}=this.configData,W=normalizeBundlerOptions(this.configData),q=describeJsxConfig({transformJsx:W.transform?.jsx,tsconfigJsx:C?.compilerOptions?.jsx,tsconfigJsxImportSource:C?.compilerOptions?.jsxImportSource});if(t===`gjs`&&!q.configured){let t=findJsxEntryPoint(collectEntryPaths(await globToEntryPoints(W.input,N)));if(t!==void 0)throw jsxConfigMissingError(t)}let Y=null;if(t===`browser`){let t=detectHtmlEntry(W.input);if(t){let n=await readFile$1(t,`utf-8`),{moduleEntry:S,scriptTag:C,scriptSrc:N}=parseHtmlEntry(t,n);W.input=S,Y={htmlSource:n,scriptTag:C,scriptSrc:N,assets:collectLinkedAssets(t,n)}}}let X=W.output?.format??(W.output?.file?.endsWith(`.cjs`)?`cjs`:`esm`),Z=X===`iife`?`esm`:X,te=W.output?.file,ne=W.output?.dir;if(!te&&!ne&&(F?.main||F?.module)){let t=Z===`cjs`?F.main??F.module:F.module??F.main;if(t&&isUnsafeDefaultOutput(t))throw Error(`gjsify build: refusing to default --outfile to ${t} (would overwrite a TypeScript source file). Pass --outfile/--outdir explicitly, or set "gjsify.bundler.output.file" in package.json.`);te=t}if(Y&&!te)throw Error(`gjsify build: an .html entry needs an explicit --outfile (e.g. --outfile dist-app/app.js); the emitted index.html is written beside it.`);let{consoleShim:re,globals:ie,dialect:ae,giRenderer:oe,nativescriptLocale:Q}=this.configData,se=Array.isArray(W.external)?W.external:void 0,ce=typeof W.output?.banner==`string`?W.output.banner:void 0,le={debug:S,app:t,format:Z,exclude:N,reflection:C?.reflection,consoleShim:re,...ae===void 0?{}:{dialect:ae},...oe===!0?{giRenderer:!0}:{},...Q?{nativescriptLocale:Q}:{},...I?{aliases:I}:{},...n.preserveDefaultExport?{preserveDefaultExport:!0}:{},...n.toolchainAnchor===void 0?{}:{toolchainAnchor:n.toolchainAnchor}},ue=n.workers===void 0,de=n.workers??(t!==`nativescript`&&!n.watch&&(te||ne)?new WorkerEntries(te?bundleSuffix(te):`.js`):void 0);de&&(le.workers=de);let{autoMode:fe,extras:pe}=this.parseGlobalsValue(ie),me=await buildPnpPlugin(),he=me?[me]:[],ge=textLoaderPlugin({loaders:this.configData.loaders}),_e=ge?[ge]:[];if(W.plugins?.length){let t=await resolveUserPlugins(W.plugins,process.cwd(),isGjs()?{loadModule:(t,n)=>this.loadPluginViaGjsBundle(t,n,S)}:{});_e.push(...t)}if(t===`gjs`&&fe){let gjsifyPluginFactory=async t=>{let n=await gjsifyPlugin({input:W.input,output:{file:te,dir:ne},userExternal:se,userBanner:ce,userAliases:I,shebang:this.configData.shebang},t);return{options:n.options,plugins:n.plugins}},{injectPath:t}=await detectAutoGlobals({input:W.input,plugins:[...he,..._e],external:W.external,transform:W.transform,format:Z},le,gjsifyPluginFactory,S,{extraGlobalsList:pe,excludeGlobals:H,cwd:process.cwd(),...n.toolchainAnchor===void 0?{}:{toolchainDir:Pn(n.toolchainAnchor)}},bundleToChunks);le.autoGlobalsInject=t}else if(t===`node`&&fe){pe&&(le.autoGlobalsInject=await this.resolveGlobalsInject(t,pe,S));let gjsifyPluginFactory=async t=>{let n=await gjsifyPlugin({input:W.input,output:{file:te,dir:ne},userExternal:se,userBanner:ce,userAliases:I,shebang:this.configData.shebang},t);return{options:n.options,plugins:n.plugins}};await detectNodeGiGlobals({input:W.input,plugins:[...he,..._e],external:W.external,transform:W.transform,format:Z},le,gjsifyPluginFactory,bundleToChunks)&&(le.nodeGiGlobalsInject=!0)}else pe&&(le.autoGlobalsInject=await this.resolveGlobalsInject(t,pe,S));let ve=t===`gjs`?giSystemProbes():void 0,ye=await gjsifyPlugin({input:W.input,output:{file:te,dir:ne},userExternal:se,userBanner:ce,userAliases:I,shebang:this.configData.shebang,giSystemProbes:ve},le),be={...mergeBundlerOptions(ye.options,W),plugins:[...he,...ye.prePlugins,..._e,...ye.plugins]};if(n.watch)return await this.runWatchLoop(be,t,te,ne,S),[];let xe=await runBundle(be,{onWatchFiles:n.onWatchFiles});return t===`gjs`&&await this.escapeRawNul(te,ne,S),(t===`gjs`||t===`node`)&&this.configData.shebang&&await this.applyShebang(t,te,S),t===`gjs`&&(this.assertGjsOutputLoadable(xe,te,ne,se),q.preserves&&assertGjsBundleParses((xe.output??[]).filter(t=>t.type===`chunk`),te??ne??`the GJS bundle`)),t===`node`&&fe&&!le.nodeGiGlobalsInject&&this.assertNodeOutputGlobals(xe,te,ne),t===`nativescript`&&this.assertNativescriptGiSelected(xe,te,ne),t===`browser`&&Y&&te&&await this.applyBrowserHtml(Y,te,S),de&&ue&&await this.buildWorkers(de,t,Pn(On(te??jn(ne,`x`))),n),[xe]}async buildWorkers(t,n,S,C){let{esbuild:N,...F}=this.configData,I=normalizeBundlerOptions(this.configData);for(let N=t.takePending();N.length>0;N=t.takePending())for(let{source:H,fileName:W}of N){this.configData.verbose&&ge.debug(`[gjsify] bundling worker ${H} → ${W}`);let{dir:N,...q}=I.output??{};await new BuildAction({...F,shebang:!1,bundler:{...I,input:H,output:{...q,file:jn(S,W)}}}).buildApp(n,{...C,workers:t})}}async runWatchLoop(t,n,S,C,N){let F=await runWatch(t),I=new Promise(t=>{F.on(`close`,()=>t())}),H=!1,shutdown=async()=>{if(!H){H=!0,ge.log(`
843
843
  [gjsify build --watch] stopping watcher…`);try{await F.close()}catch(t){ge.error(`[gjsify build --watch] watcher close error:`,t)}}};process.on(`SIGINT`,shutdown),process.on(`SIGTERM`,shutdown),F.on(`event`,async t=>{switch(t.code){case`START`:N&&ge.log(`[gjsify build --watch] rebuild start`);break;case`BUNDLE_START`:ge.log(`[gjsify build --watch] building…`);break;case`BUNDLE_END`:ge.log(`[gjsify build --watch] built in ${t.duration}ms`);try{n===`gjs`&&await this.escapeRawNul(S,C,N),(n===`gjs`||n===`node`)&&this.configData.shebang&&await this.applyShebang(n,S,N)}finally{await t.result.close()}break;case`END`:ge.log(`[gjsify build --watch] waiting for changes…`);break;case`ERROR`:ge.error(`[gjsify build --watch] build failed:`,t.error?.message??t.error),N&&t.error?.stack&&ge.error(t.error.stack);try{await t.result.close()}catch{}break}}),N&&F.on(`change`,(t,n)=>{ge.log(`[gjsify build --watch] ${n.event}: ${t}`)}),await I}async start(t={app:`gjs`}){if(t.library){if(t.watch)throw Error(`gjsify build: --watch is not supported with --library (library mode would emit watcher rebuilds for every produced format; use --app gjs|node|browser instead).`);return await this.buildLibrary()}return await this.buildApp(t.app,{watch:t.watch,onWatchFiles:t.onWatchFiles})}}});function isModuleResolutionFailure(t){let n=t instanceof Error?t.message:String(t);return/Unsupported URI scheme|\bnode:|Cannot find (module|package)|Module not found|ERR_MODULE_NOT_FOUND|Failed to resolve/i.test(n)}async function loadConfigViaGjsBundle(t,n){let S;try{let{BuildAction:C}=await Promise.resolve().then(()=>(HL(),zL));S=await C.bundleFileForGjsCached(t,{cacheSubdir:`config`,label:Fn(t),verbose:n,noCacheEnv:`GJSIFY_NO_CONFIG_CACHE`,define:{"import.meta.url":JSON.stringify(pathToFileURL(t).href)},resolveFromToolchain:!0})}catch(n){throw Error(`gjsify: failed to bundle the config ${t} for the GJS CLI. Fixes: run the build under Node (\`npx gjsify …\`), keep the config to plain values / \`process.env\`, or move settings into \`package.json#gjsify\`. (${n.message})`)}try{let t=await import(pathToFileURL(S).href);return t.default??t}catch(n){throw Error(`gjsify: bundled the config ${t} for GJS but could not import the result (${S}). (${n.message})`)}}function defaultSearchPlaces(t){return[`package.json`,`.${t}rc`,`.${t}rc.json`,`.${t}rc.yaml`,`.${t}rc.yml`,`.${t}rc.js`,`.${t}rc.ts`,`.${t}rc.mjs`,`.${t}rc.cjs`,`${t}.config.js`,`${t}.config.ts`,`${t}.config.mjs`,`${t}.config.cjs`]}function merge(t,...n){for(let S of n)if(S)for(let n of Object.keys(S)){let C=t[n],N=S[n];N!==void 0&&(isPlainObject(C)&&isPlainObject(N)?merge(C,N):t[n]=N)}return t}function isPlainObject(t){return typeof t==`object`&&!!t&&!Array.isArray(t)&&Object.getPrototypeOf(t)===Object.prototype}function readDottedPath(t,n){if(!n.includes(`.`))return t[n];let S=t;for(let t of n.split(`.`)){if(typeof S!=`object`||!S)return;S=S[t]}return S}var UL,gjsConfigLoader,WL,Config,GL=__esmMin(()=>{_e(),mh(),yh(),UL=b_(),Hn(),$n(),x_(),ev(),BN(),Dv(),GP(),lI(),gjsConfigLoader=async t=>{try{let n=await import(pathToFileURL(t).href);return n.default??n}catch(n){if(!isModuleResolutionFailure(n))throw n;return loadConfigViaGjsBundle(t,!!process.env.GJSIFY_DEBUG)}},WL=isGjs()?{".js":gjsConfigLoader,".mjs":gjsConfigLoader,".cjs":gjsConfigLoader}:{},Config=class{loadOptions={};constructor(t={}){Object.keys(t).length&&(this.loadOptions=t)}async load(t){let n=await(0,UL.cosmiconfig)(ph,{...this.loadOptions,searchPlaces:(this.loadOptions.searchPlaces??defaultSearchPlaces(`gjsify`)).filter(t=>t!==`package.json`),loaders:{...WL,...this.loadOptions.loaders}}).search(t),S={};try{let n=await this.readPackageJSON(t);isPlainObject(n?.gjsify)&&merge(S,n.gjsify)}catch{}return n?.config&&isPlainObject(n.config)&&merge(S,n.config),S.bundler||={},S.library||={},S.typescript||={},{config:S,filepath:n?.filepath??``,isEmpty:!n&&Object.keys(S).length===3}}async readPackageJSON(t){return t=await resolvePackageJSON(t),await readPackageJSON(t)}async readTSConfig(t){return rI(t)?.config||{}}async forNodeScript(t){let{config:n}=await this.load(Pn(t));return{globals:n.nodeScript?.globals??n.globals,excludeGlobals:n.nodeScript?.excludeGlobals??n.excludeGlobals}}async forCommand(t=process.cwd()){let{config:n}=await this.load(t);return n}async forBuild(t){let n=await this.load(process.cwd()),S={...n.config},C=n.filepath||process.cwd(),N=await this.readPackageJSON(C),F=await this.readTSConfig(C);if(F.reflection||=t.reflection,S.verbose=t.verbose||t.logLevel===`debug`||t.logLevel===`verbose`,S.exclude=t.exclude||[],t.consoleShim!==void 0&&(S.consoleShim=t.consoleShim),t.giRenderer!==void 0&&(S.giRenderer=t.giRenderer),t.dialect!==void 0){if(!isSourceDialect(t.dialect))throw Error(`gjsify build: "${t.dialect}" is not a source dialect. Known: ${tv.join(`, `)}. This is the dialect the SOURCE is written in — not gjsify.runtimes, which declares the runtime a package RUNS on.`);S.dialect=t.dialect}if(t.app!==void 0&&(S.app=t.app),S.app??=buildAppForRuntime(hostRuntime$1()),S.dialect!==void 0&&!nv.has(S.app))throw Error(`gjsify build: --dialect ${S.dialect} has no effect on --app ${S.app}. It composes on ${[...nv].join(` and `)} only. Drop the dialect, or build one of those targets.`);if(S.giRenderer===!0&&!mv.includes(S.app))throw Error(`gjsify build: --gi-renderer has no effect on --app ${S.app}. It composes on ${mv.join(` and `)} only — the targets with no GObject introspection to answer \`gi://\` with. \`--app gjs\` resolves it natively and \`--app node\` through @gjsify/node-gi, so neither needs a widget renderer standing in for it.`);if(S.nativescript?.giNamespaces!==void 0&&S.app!==`nativescript`)throw Error(`gjsify build: nativescript.giNamespaces has no effect on --app ${S.app}. It selects what an Android APK carries (ADR 0117); every other target resolves \`gi://\` against a GI stack the host already has.`);if(assertGiNamespaceEntries(S.nativescript?.giNamespaces??[],`gjsify build: nativescript.giNamespaces`),t.globals!==void 0&&(S.globals=t.globals),S.globals??=`auto`,t.shebang!==void 0&&(S.shebang=t.shebang),t.excludeGlobals){let n=(Array.isArray(t.excludeGlobals)?t.excludeGlobals.join(`,`):String(t.excludeGlobals)).split(`,`).map(t=>t.trim()).filter(Boolean);n.length&&(S.excludeGlobals=[...S.excludeGlobals??[],...n])}merge(S.library??={},N,S.library),merge(S.typescript??={},F,S.typescript);let parseKvPairs=(t,n)=>{let S={};for(let C of t){let t=C.indexOf(`=`);if(t===-1)throw Error(`Invalid --${n} value '${C}'. Expected KEY=VALUE.`);let N=C.slice(0,t).trim(),F=C.slice(t+1);if(!N)throw Error(`Invalid --${n} value '${C}'. Empty key.`);S[N]=F}return S},I=parseKvPairs(t.define??[],`define`),H=parseDeclaredChannel(t.channel??process.env.GJSIFY_CHANNEL??S.ship?.channel,t.channel===void 0?`gjsify.ship.channel`:`--channel`);H!==void 0&&I.__GJSIFY_CHANNEL__===void 0&&(I.__GJSIFY_CHANNEL__=JSON.stringify(H));let W=parseKvPairs(t.alias??[],`alias`);Object.keys(W).length&&(S.aliases={...S.aliases,...W});let q={};if(S.defineFromPackageJson)for(let[t,n]of Object.entries(S.defineFromPackageJson)){if(!n||typeof n.field!=`string`||!n.field)throw Error(`gjsify config: defineFromPackageJson["${t}"] is missing a "field" string`);let S=readDottedPath(N,n.field);q[t]=S===void 0?`undefined`:JSON.stringify(S)}let Y={};if(S.defineFromEnv)for(let[t,n]of Object.entries(S.defineFromEnv)){if(!n||typeof n.env!=`string`||!n.env)throw Error(`gjsify config: defineFromEnv["${t}"] is missing an "env" string`);let S=process.env[n.env],C=S===void 0?n.default:S;Y[t]=C===void 0?`undefined`:JSON.stringify(C)}let X=S.bundler??={},Z=X.output??={},te=X.transform??={};return t.entryPoints?.length&&(X.input=t.entryPoints),X.input||=[`src/index.ts`],t.outfile!==void 0&&(Z.file=t.outfile),t.outdir!==void 0&&(Z.dir=t.outdir),t.format!==void 0&&(Z.format=t.format),t.minify!==void 0&&(Z.minify=t.minify),Z.minify===void 0&&(Z.minify=!0),Z.minify===!0&&(Z.keepNames=!0),t.logLevel&&(X.logLevel={silent:`silent`,error:`warn`,warning:`warn`,warn:`warn`,info:`info`,debug:`debug`,verbose:`debug`}[t.logLevel]??`warn`),t.external?.length&&(X.external=[...Array.isArray(X.external)?X.external:[],...t.external]),(Object.keys(I).length||Object.keys(q).length||Object.keys(Y).length)&&(te.define={...te.define,...q,...Y,...I}),S.verbose&&ge.debug(`configData`,S),S}}}),KL,qL=__esmMin(()=>{GL(),HL(),BN(),KL={command:`build [entryPoints..]`,description:`Build and bundle your Gjs project`,builder:t=>t.option(`entry-points`,{description:`The entry points you want to bundle. Defaults to bundler.input from package.json#gjsify or .gjsifyrc.js, falling back to src/index.ts when neither is set.`,array:!0,type:`string`,defaultDescription:`src/index.ts (fallback)`,coerce:t=>[...new Set(t)]}).option(`exclude`,{description:`An array of glob patterns to exclude entry-points and aliases`,array:!0,type:`string`,default:[]}).option(`verbose`,{description:`Switch on the verbose mode`,type:`boolean`,default:!1}).option(`app`,{description:"Build target for an application. Defaults to the target of the HOST runtime running the CLI: gjs when run under gjs, node when run under node/bun/deno (both consume the --app node bundle). Set `gjsify.app` in package.json#gjsify to override the host default.",type:`string`,choices:[`gjs`,`node`,`browser`,`nativescript`],defaultDescription:`host runtime target (gjs on gjs, else node)`}).option(`format`,{description:`Override the default output format`,type:`string`,choices:[`iife`,`esm`,`cjs`]}).option(`minify`,{description:`Minify the bundled output. Defaults to true; use --no-minify to emit pretty-printed code (e.g. for debugging or readable bundle review).`,type:`boolean`,defaultDescription:`true`}).option(`library`,{description:`Use this if you want to build a library for Gjsify`,type:`boolean`,default:!1}).option(`outfile`,{alias:`o`,description:`Sets the output file name for the build operation. If no outfile is specified, the outfile will be parsed from the package.json. Only used if application mode is active`,type:`string`,normalize:!0}).option(`outdir`,{alias:`d`,description:`Sets the output directory for the build operation. If no outdir is specified, the outdir will be parsed from the package.json. Only used if library mode is active`,type:`string`,normalize:!0}).option(`reflection`,{alias:`r`,description:`Enables TypeScript types on runtime using Deepkit's type compiler`,type:`boolean`,default:!1}).option(`log-level`,{description:`The log level can be changed to prevent esbuild from printing warning and/or error messages to the terminal`,type:`string`,choices:[`silent`,`error`,`warning`,`info`,`debug`,`verbose`],default:`warning`}).option(`channel`,{description:`Distribution channel this build is for (ADR 0113): flathub, web, microsoft-store or apple-app-store. Sets the __GJSIFY_CHANNEL__ define that @gjsify/distribution reads; overrides gjsify.ship.channel. Unset builds report no donation UI.`,type:`string`,choices:[`flathub`,`web`,`microsoft-store`,`apple-app-store`]}).option(`dialect`,{description:`The dialect the SOURCE is written in. 'react-native' aliases 'react-native' onto '@gjsify/react-native' and fails the build on an import whose ADR 0032 support-table status is not supported/partial. GJS and Node app builds. This is NOT gjsify.runtimes['react-native'], which declares the runtime a package RUNS on — the two answer opposite questions.`,type:`string`,choices:[...tv]}).option(`gi-renderer`,{description:"Resolve `gi://Ns?version=X` to the target's widget renderer instead of an empty module (ADR 0034 stage 9): --app browser answers gi://Adw and gi://Gtk out of @gjsify/adwaita-web, --app nativescript out of @gjsify/adwaita-nativescript. A namespace with no renderer, and a ?version= the renderer's vocabulary was not generated against, both FAIL the build by name. Off by default — a gi:// import on those targets is usually a GJS-only code path pulled in transitively.",type:`boolean`}).option(`console-shim`,{description:`Inject a console shim into GJS builds for clean output without the GLib prefix and with working ANSI colors. Use --no-console-shim to disable. Only applies to GJS app builds.`,type:`boolean`,default:!0}).option(`globals`,{description:"Comma-separated list of global identifiers, 'auto' (default) to detect automatically from the bundled output, or 'none' to disable. The 'auto' token may be combined with explicit identifiers/groups (e.g. 'auto,dom') for cases where the detector cannot statically see a global because it's accessed via indirection. Each identifier is mapped to the corresponding `@gjsify/<pkg>/register` module and injected into the bundle. See the CLI Reference docs for the full list of known identifiers. Only applies to GJS app builds.",type:`string`}).option(`shebang`,{description:"Prepend a target-appropriate shebang to the output and mark it executable (chmod 755): `#!/usr/bin/env -S gjs -m` for --app gjs, `#!/usr/bin/env node` for --app node. Applies to GJS and Node app builds with a single --outfile. Default: false (use --shebang to enable, or set `shebang: true` in `.gjsifyrc.js`).",type:`boolean`}).option(`external`,{description:"Module names that should NOT be bundled — EXACT package names only, matched literally on both bundler engines (no globs). Repeat the flag or pass a comma-separated list (e.g. --external typedoc,prettier). Appended to the per-app built-in externals; register subpaths (`<pkg>/register[/…]`) are always force-inlined for --app gjs regardless of this flag.",array:!0,type:`string`,default:[],coerce:t=>t.flatMap(t=>t.split(`,`).map(t=>t.trim()).filter(Boolean))}).option(`define`,{description:`Substitute compile-time constants. Each entry is KEY=VALUE where VALUE is a JS expression (string literals must be quoted: --define VERSION='"1.2.3"'). Repeat the flag or pass comma-separated. See https://esbuild.github.io/api/#define`,array:!0,type:`string`,default:[]}).option(`alias`,{description:`Map module specifiers at bundle time. Each entry is FROM=TO (e.g. --alias typedoc=@gjsify/empty). Layered on top of the built-in alias map. Useful for stubbing heavy deps the test scenario never executes.`,array:!0,type:`string`,default:[],coerce:t=>t.flatMap(t=>t.split(`,`).map(t=>t.trim()).filter(Boolean))}).option(`exclude-globals`,{description:`Comma-separated global identifiers to remove from auto-detection results. Use for false positives from dead browser-compat code whose polyfills require unavailable native libraries (e.g. --exclude-globals fetch,XMLHttpRequest).`,type:`string`}).option(`watch`,{alias:`w`,description:"Watch source files and rebuild on change. Logs each rebuild with duration; clean SIGINT shutdown. Only valid with --app gjs|node|browser (rejected with --library). Requires the npm `rolldown` engine — run under Node, not the GJS-bundled CLI.",type:`boolean`,default:!1}),handler:async t=>{let n=await new Config().forBuild(t);await new VL(n).start({library:t.library,app:n.app,watch:t.watch})}}}),JL,YL=__esmMin(()=>{_e(),jd(),Jd(),Hn(),ML(),JL={command:`clear [paths..]`,description:"Delete build output recursively. Portable replacement for `rm -rf` in package `clear` scripts.",builder:t=>t.positional(`paths`,{description:"Files and directories to delete, relative to the current package. A missing path is not an error. `*` and `?` are honoured in the last segment.",type:`string`,array:!0}).option(`dry-run`,{description:`Print what would be deleted and exit without touching anything.`,type:`boolean`,default:!1}).option(`verbose`,{alias:`v`,description:`Print each path as it is deleted.`,type:`boolean`,default:!1}),handler:async t=>{let n=process.cwd(),S=t.paths??[];if(S.length===0)throw Error(`gjsify clear: no paths given. Usage: gjsify clear <paths…>`);let C=resolveClearTargets(S,{cwd:n,readdir:readdirSync});for(let S of C){let C=Mn(n,S);if(t.dryRun){let t=await stat$1(S).then(()=>!0,()=>!1);ge.log(`gjsify clear: would remove ${C}${t?``:` (absent)`}`);continue}await rm$1(S,{recursive:!0,force:!0,maxRetries:3,retryDelay:100}),t.verbose&&ge.log(`gjsify clear: removed ${C}`)}}}});function isDirectoryDestination(t,n){return n.endsWith(`/`)||n.endsWith(`\\`)||t.length>1?!0:t.some(t=>hasWildcard(t))}function assertWritableDestination(t,n,S,C){let N=Mn(S,t);if(N===``){if(C)return;throw Error(`gjsify copy: "${n}" is the working directory itself. Name a file, or add a trailing "/" to copy INTO the directory.`)}if(N===`..`||N.startsWith(`..${zn}`)||An(N))throw Error(`gjsify copy: "${n}" resolves to ${t}, outside the working directory ${S}. Only paths inside the package may be written.`)}function expandSource(t,n){let S=Fn(t),C=Pn(t);if(hasWildcard(C))throw Error(`gjsify copy: a wildcard is only supported in the last path segment — got "${t}".`);if(!hasWildcard(S))return[On(n.cwd,t)];let N=On(n.cwd,C),F=segmentToRegExp(S),I;try{I=n.readdir(N)}catch{return[]}return I.filter(t=>F.test(t)).sort().map(t=>jn(N,t))}function planCopy(t,n){if(t.length<2)throw Error(`gjsify copy: needs at least one source and a destination. Usage: gjsify copy <sources…> <dest>`);let S=t.slice(0,-1),C=t[t.length-1];if(C===``)throw Error(`gjsify copy: the destination is empty.`);let N=isDirectoryDestination(S,C),F=On(n.cwd,C);assertWritableDestination(F,C,n.cwd,N);let I=[];for(let t of S){if(t===``)throw Error(`gjsify copy: a source path is empty.`);I.push(...expandSource(t,n))}if(!N&&I.length!==1)throw Error(`gjsify copy: "${C}" names a single destination, but ${I.length} sources resolved.`);let H=[],W=new Set;for(let t of I){let n=N?jn(F,Fn(t)):F;if(t===n)throw Error(`gjsify copy: "${t}" is its own destination.`);if(W.has(n))throw Error(`gjsify copy: two sources would both be written to ${n}.`);W.add(n),H.push({from:t,to:n})}return H}var XL=__esmMin(()=>{Hn(),ML()}),ZL,QL=__esmMin(()=>{_e(),jd(),Jd(),Hn(),XL(),ZL={command:`copy [paths..]`,description:"Copy files and directories into the build output. Portable replacement for `mkdir -p` + `cp -r` in package scripts.",builder:t=>t.positional(`paths`,{description:'One or more sources followed by the destination. The destination is a DIRECTORY when it ends with "/", when several sources are given, or when a source carries a wildcard; otherwise it is the exact target path. Missing parent directories are created. `*` and `?` are honoured in the last segment of a source.',type:`string`,array:!0}).option(`dry-run`,{description:`Print what would be copied and exit without touching anything.`,type:`boolean`,default:!1}).option(`verbose`,{alias:`v`,description:`Print each path as it is copied.`,type:`boolean`,default:!1}),handler:async t=>{let n=process.cwd(),S=t.paths??[];if(S.length<2)throw Error(`gjsify copy: needs at least one source and a destination. Usage: gjsify copy <sources…> <dest>`);let C=planCopy(S,{cwd:n,readdir:readdirSync}),show=t=>{let S=Mn(n,t);return S===``?`.`:S};for(let{from:n,to:S}of C){if(t.dryRun){ge.log(`gjsify copy: would copy ${show(n)} -> ${show(S)}`);continue}await mkdir$1(Pn(S),{recursive:!0}),await cpPromises(n,S,{recursive:!0,force:!0}),t.verbose&&ge.log(`gjsify copy: ${show(n)} -> ${show(S)}`)}}}});function doubleDashArgs(t){let n=t[`--`];if(n==null)return[];if(!Array.isArray(n))throw Error(`gjsify: internal error — yargs' \`--\` slot holds a ${typeof n} rather than an array, so the arguments after \`--\` cannot be forwarded. The command builder must set \`parserConfiguration({ 'populate--': true })\`.`);return n.map((t,n)=>{if(typeof t==`string`)return t;throw Error(`gjsify: internal error — the argument after \`--\` at position ${n} arrived as a ${typeof t} (${String(t)}) instead of a string, so forwarding it would change what the caller wrote. The command builder must set \`parserConfiguration({ 'parse-positional-numbers': false })\` alongside \`populate--\`.`)})}var $L=__esmMin(()=>{});function splitEnvArgv(t){let n=[],S=0;for(;S<t.length;S++){let C=eR.exec(t[S]);if(!C)break;n.push([C[1],C[2]])}return S>=t.length?null:{assignments:n,command:t[S],args:t.slice(S+1)}}function joinEnvArgv(t,n){return n.length===0?[...t]:splitEnvArgv(t)?[...t,`--`,...n]:[...t,...n]}function applyAssignments(t,n,S=process.platform){let C={...t};for(let[t,N]of n){if(S===`win32`)for(let n of Object.keys(C))n!==t&&n.toLowerCase()===t.toLowerCase()&&delete C[n];C[t]=N}return C}var eR,tR,nR=__esmMin(()=>{_e(),$L(),Z_(),eR=/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/s,tR={command:`env <entries..>`,description:"Run a command with extra environment variables: `gjsify env NAME=VALUE… <command> [args…]`. Portable replacement for the POSIX `NAME=value command` prefix, which cmd.exe cannot run.",builder:t=>t.positional(`entries`,{description:"`NAME=VALUE` assignments, then the command and its arguments.",type:`string`,array:!0}).version(!1).help(!1).parserConfiguration({"populate--":!0,"parse-positional-numbers":!1,"unknown-options-as-args":!0}),handler:async t=>{let n=splitEnvArgv(joinEnvArgv(t.entries??[],doubleDashArgs(t)));if(!n)return ge.error(`gjsify env: no command given. Usage: gjsify env NAME=VALUE… <command> [args…]`),process.exit(1);let{assignments:S,command:C,args:N}=n,F;try{F=await spawnToCompletion(C,N,{completion:`exit`,env:applyAssignments(process.env,S)})}catch(t){let n=t;return ge.error(n.code===`ENOENT`?`gjsify env: \`${C}\` not found on PATH`:`gjsify env: ${C}: ${n.message}`),process.exit(127)}return F.code===0?process.exit(0):(F.code===null&&ge.error(`gjsify env: ${C} ended by ${describeExit(F)}`),process.exit(F.code??1))}}});function parseShebang(t){let n=rR.exec(t.trim());return n?{variables:n[1]??``,prog:n[2]??``,args:n[3]??``}:null}function replaceDollarWithPercentPair(t){return t.replace(/\$\{?([^$@#?\- \t{}:]+)\}?/g,(t,n)=>`%${n}%`)}function convertToSetCommands(t){let n=``;for(let S of t.split(` `)){let t=S.indexOf(`=`);if(t<=0)continue;let C=S.slice(0,t).trim(),N=S.slice(t+1).trim();C&&N&&(n+=`@SET ${C}=${replaceDollarWithPercentPair(N)}\r\n`)}return n}function buildCmdShim(t,n){let S=t.split(`\\`).join(`/`),C=S.split(`/`).join(`\\`),N=S,F=n?.prog??``,I=n?.args??``,H=n?.variables??``,W=F?F.split(`\\`).join(`/`):``,q=W?`"${W}$exe"`:``,Y=``,X=``,Z=``;F?(Y=`"%dp0%\\${F}.exe"`,X=`"$basedir/${F}"`,Z=`"$basedir/${F}$exe"`,C=`"%dp0%\\${C}"`,S=`"$basedir_win/${S}"`,N=`"$basedir/${N}"`):(F=`"%dp0%\\${C}"`,W=`"$basedir/${S}"`,q=W,I=``,C=``,S=``,N=``);let te;if(Y){let t=I.trim();te=iR+convertToSetCommands(H)+`\r
844
844
  IF EXIST ${Y} (\r\n SET "_prog=${Y.replace(/(^")|("$)/g,``)}"\r\n) ELSE (\r
845
845
  SET "_prog=${F.replace(/(^")|("$)/g,``)}"\r\n)\r
@@ -972,7 +972,7 @@ No install command available for your package manager. Install manually.`),proce
972
972
  deno run -A --reload --min-dep-age 0 npm:@gjsify/cli@latest showcase <name>`,rB={command:`showcase [name]`,description:`List or run curated gjsify showcase applications.`,builder:t=>t.positional(`name`,{description:`Showcase name to run (omit to list all)`,type:`string`}).option(`json`,{description:`Output as JSON`,type:`boolean`,default:!1}).option(`list`,{description:`List available showcases`,type:`boolean`,default:!1}).option(`runtime`,{type:`string`,choices:Q_,defaultDescription:`gjs when gjs is installed, else the host runtime`,description:"Runtime to run the showcase on: gjs | node | bun | deno (default: gjs when installed, else the host runtime). node/bun/deno run its `--app node` bundle."}),handler:async t=>{if(!t.name||t.list){let n=discoverShowcases();if(t.json){ge.log(JSON.stringify(n,null,2));return}if(n.length===0){ge.log("No showcases found. The CLI ships a curated list in `showcases.json`; if it is missing the CLI install is incomplete.");return}let S=new Map;for(let t of n){let n=S.get(t.category)??[];n.push(t),S.set(t.category,n)}ge.log(`Available gjsify showcases:
973
973
  `);for(let[t,n]of S){ge.log(` ${t.toUpperCase()}:`);let S=Math.max(...n.map(t=>t.name.length));for(let t of n){let n=` `.repeat(S-t.name.length+2),C=t.description?`${n}${t.description}`:``;ge.log(` ${t.name}${C}`)}ge.log(``)}ge.log(`Run a showcase: gjsify showcase <name>`);return}let n=findShowcase(t.name);if(!n)return ge.error(`Unknown showcase: "${t.name}"`),ge.error(`Run "gjsify showcase" to list available showcases.`),process.exit(1);let S=t.runtime??defaultExampleRuntime();if(!isExampleRuntime(S))return ge.error(`Unknown --runtime "${S}" (expected: ${Q_.join(`, `)}).`),process.exit(1);if(requiresGjsSystemDeps(S)){let t=runMinimalChecks().filter(t=>!t.found&&t.severity===`required`);if(t.length>0){ge.error(`Missing system dependencies:
974
974
  `);for(let n of t)ge.error(` ✗ ${n.name}`);let n=buildInstallCommand(detectPackageManager$1(),t);return n&&ge.error(`\nInstall with:\n ${n}`),process.exit(1)}}let C=readCliVersion();if(S!==`gjs`){await runShowcaseOnRuntime(n,S,C);return}let N=C?`${n.packageName}@${C}`:n.packageName;ge.log(`Running showcase: ${n.name} ${runningAs(C)}(via gjsify dlx ${N})\n`);try{let{runCli:t}=await Promise.resolve().then(()=>(CJ(),SJ));await t([`dlx`,N])}catch(t){ge.error(t.message),process.exit(1)}}}});function resolveTemplatesRoot(){let t=Pn(fileURLToPath(import.meta.url)),n=[jn(t,`..`,`dist-templates`),jn(t,`dist-templates`)];try{let t=createRequire(import.meta.url).resolve(`@gjsify/create-app/package.json`);n.splice(1,0,jn(Pn(t),`dist-templates`))}catch{}return n.find(t=>existsSync(t))}function discoverTemplates(){let t=resolveTemplatesRoot();if(!t)return[];let n=[];for(let S of readdirSync(t)){let C=jn(t,S),N=jn(C,`package.json`);if(!statSync(C).isDirectory()||!existsSync(N))continue;let F=aB[S]??``;try{let t=JSON.parse(readFileSync(N,`utf-8`));typeof t.description==`string`&&t.description.trim()&&(F=t.description)}catch{}n.push({name:S,description:F,path:C})}return n.sort((t,n)=>t.name.localeCompare(n.name)),n}function findTemplate(t){return discoverTemplates().find(n=>n.name===t)}var aB,oB=__esmMin(()=>{Jd(),Wl(),Hn(),$n(),aB={"gtk-minimal":`Minimal GTK4 app — Gtk.ApplicationWindow + Gtk.Label, no Adwaita (Blueprint UI).`,cli:`Command-line tool using yargs (Node.js + GJS).`,"adw-canvas2d":`Adwaita app with HTML Canvas 2D rendering (Blueprint UI).`,"adw-webgl":`Adwaita app with WebGL + three.js (Blueprint UI).`,"adw-game":`Adwaita game shell using Excalibur.js, WebGL → Canvas2D fallback.`,"web-server-hono":`HTTP server using Hono (Web-standard fetch-style API).`,"web-server-express":`HTTP server using Express (familiar Node.js stack).`}});function installCommandLine(t){return[t,...cB[t]].join(` `)}function runScriptCommand(t){return lB[t]}function packageManagersForRuntime(t){return uB[t]}function hostRuntime(){let t=globalThis;return t.Bun===void 0?t.Deno===void 0?t.imports?.gi===void 0?`node`:`gjs`:`deno`:`bun`}function defaultRuntimeFor(t,n){if(n)return t.find(t=>packageManagersForRuntime(t)?.includes(n));let S=hostRuntime();return t.includes(S)?S:t[0]}function startScriptFor(t){return t===`gjs`?`start`:`start:${t}`}var sB,cB,lB,uB,dB,fB=__esmMin(()=>{sB=[`npm`,`yarn`,`pnpm`,`gjsify`,`bun`,`deno`],cB={npm:[`install`,`--no-audit`,`--no-fund`],yarn:[`install`],pnpm:[`install`],gjsify:[`install`],bun:[`install`],deno:[`install`]},lB={npm:`npm run`,yarn:`yarn`,pnpm:`pnpm`,gjsify:`gjsify run`,bun:`bun run`,deno:`deno task`},uB={gjs:[`gjsify`],node:[`npm`,`yarn`,`pnpm`,`gjsify`],bun:[`bun`],deno:[`deno`]},dB={gjs:`GNOME JavaScript — no Node.js needed at runtime.`,node:`Node.js — gi:// via the @gjsify/node-gi bridge.`,bun:`Bun — runs the same --app node bundle.`,deno:`Deno — runs the same --app node bundle.`}});function selectRuntime(t){let{flag:n,offered:S,manager:C,interactive:N}=t;if(n!==void 0)return S.length>0&&!S.includes(n)?{kind:`error`,message:`this template does not run on "${n}". Declared runtimes: ${S.join(`, `)}.`}:{kind:`value`,value:n};if(S.length===1)return{kind:`value`,value:S[0]};if(S.length===0)return{kind:`error`,message:`this template declares no runtime this scaffolder can install for.`};let F=defaultRuntimeFor(S,C);return F===void 0?{kind:`error`,message:`no runtime this template declares installs with "${C}". Declared runtimes: ${S.join(`, `)}.`}:C===void 0?N?{kind:`prompt`,choices:S,initial:F}:{kind:`auto`,value:F,notice:`--runtime not given, using "${F}". Runs on: ${S.join(`, `)}.`}:{kind:`auto`,value:F,notice:`Setting up for ${F} — the runtime ${C} installs for.`}}function selectPackageManager(t){let{flag:n,runtime:S,install:C,interactive:N}=t,F=packageManagersForRuntime(S);return F===void 0||F.length===0?{kind:`error`,message:`no package manager known for runtime "${S}".`}:n===void 0?F.length===1?{kind:`auto`,value:F[0],notice:`Using ${F[0]} — the only package manager that installs for ${S}.`}:N?{kind:`prompt`,choices:F,initial:F[0]}:C?{kind:`error`,message:`--package-manager is required with --install in non-interactive mode. Package managers for ${S}: ${F.join(`, `)}.`}:{kind:`auto`,value:F[0],notice:`--package-manager not given, using "${F[0]}" for ${S}.`}:F.includes(n)?{kind:`value`,value:n}:{kind:`error`,message:`"${n}" cannot install a project you intend to run on ${S}. Package managers for ${S}: ${F.join(`, `)}.`}}var pB=__esmMin(()=>{fB()});function applicationIdFor(t){let n=t.replace(/[^A-Za-z0-9_-]/g,`-`);return`org.gjsify.${/^[0-9]/.test(n)?`app-${n}`:n}`}function sanitizeProjectName(t){let n=t.trim();if(!n)throw Error(`Project name cannot be empty.`);let S=n.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^[._-]+/,``).replace(/[._-]+$/,``);if(!S)throw Error(`"${t}" is not a valid npm package name.`);return S}function isDirEmpty(t){return existsSync(t)?readdirSync(t).length===0:!0}async function createProject(t){let n=sanitizeProjectName(t.projectName),{template:S,force:C=!1,install:N=!1}=t,F=findTemplate(S);if(!F){let t=discoverTemplates().map(t=>t.name).join(`, `);throw Error(`Unknown template "${S}". Available templates: ${t||`(none — run "yarn build" first)`}`)}let I=supportedRuntimes(F),H=t.runtime??defaultRuntimeFor(I,t.packageManager)??hostRuntime(),W=packageManagersForRuntime(H);if(!W)throw Error(`Template "${F.name}" was asked for runtime "${H}", which this version of @gjsify/create-app has no installer mapping for. Upgrade it, or pick one of: ${I.join(`, `)||`(none)`}.`);let q=t.packageManager??W[0];if(!W.includes(q))throw Error(`"${q}" cannot install a project you intend to run on ${H}. Package managers for ${H}: ${W.join(`, `)}.`);let Y=On(process.cwd(),n);if(existsSync(Y)&&!isDirEmpty(Y)&&!C)return ge.error(`Error: Directory "${n}" exists and is not empty. Use --force to scaffold into it anyway.`),process.exit(1);if(ge.log(`Creating new Gjsify project in ${Y} (template: ${F.name})...`),mkdirSync(Y,{recursive:!0}),cpSync(F.path,Y,{recursive:!0}),substituteTemplateSentinels(Y,n),N){let t=installCommandLine(q);ge.log(`Running ${t}...`);let n=spawnSync(t,{cwd:Y,stdio:`inherit`,shell:!0});n.error?ge.warn(`${q} install could not start (${n.error.message}); re-run it manually.`):n.status!==0&&ge.warn(`${q} install failed; re-run it manually in the project directory.`)}printNextSteps(n,F,N,q,H)}function substituteTemplateSentinels(t,n){let S=[[mB,n],[hB,applicationIdFor(n)]];renameSentinelPaths(t,S),substituteSentinelContents(t,S)}function renameSentinelPaths(t,n){for(let S of readdirSync(t,{withFileTypes:!0})){let C=S.name;for(let[t,S]of n)C=C.replaceAll(t,S);let N=jn(t,S.name),F=jn(t,C);F!==N&&renameSync(N,F),S.isDirectory()&&renameSentinelPaths(F,n)}}function substituteSentinelContents(t,n){let S=new Set([`node_modules`,`dist`,`lib`]),C=[t];for(;C.length>0;){let t=C.pop();for(let N of readdirSync(t,{withFileTypes:!0})){let F=jn(t,N.name);if(N.isDirectory()){S.has(N.name)||C.push(F);continue}if(!N.isFile())continue;let I=N.name.lastIndexOf(`.`),H=I>=0?N.name.slice(I):``;if(!gB.has(H)&&!_B.has(N.name))continue;let W=readFileSync(F,`utf-8`),q=W;for(let[t,S]of n)q=q.replaceAll(t,S);q!==W&&writeFileSync(F,q)}}}function printNextSteps(t,n,S,C,N){let F=runScriptCommand(C),I=templateScripts(n),H=startScriptFor(N);ge.log(``),ge.log(`Project created from template "${n.name}", set up for ${N}.`),ge.log(``),ge.log(`Next steps:`),ge.log(` cd ${t}`),S||ge.log(` ${C} install`),N===`gjs`&&I.dev?ge.log(` ${F} dev`):(ge.log(` ${F} build`),ge.log(` ${F} ${H}`)),ge.log(``);let W=supportedRuntimes(n).filter(t=>t!==N&&I[startScriptFor(t)]);if(W.length>0){ge.log(`Also runs on ${W.join(`, `)}:`);for(let t of W)ge.log(` ${F} ${startScriptFor(t)}`);ge.log(``)}I.ship&&(ge.log(`Package it for a machine without gjsify:`),ge.log(` ${F} ship -- darwin`),ge.log(``))}function templateManifest(t){try{return JSON.parse(readFileSync(jn(t.path,`package.json`),`utf-8`))}catch{return{}}}function templateScripts(t){let n=templateManifest(t).scripts;return n?Object.fromEntries(Object.entries(n).filter(t=>typeof t[1]==`string`)):{}}function supportedRuntimes(t){let n=templateManifest(t).gjsify?.example?.runtimes;return Array.isArray(n)?n.filter(t=>typeof t==`string`&&packageManagersForRuntime(t)!==void 0):[]}var mB,hB,gB,_B,vB=__esmMin(()=>{_e(),W_(),Jd(),Hn(),oB(),fB(),pB(),mB=`new-gjsify-app`,hB=`org.gjsify.example`,gB=new Set([`.json`,`.md`,`.ts`,`.tsx`,`.js`,`.mjs`,`.cjs`,`.blp`,`.html`,`.css`,`.scss`,`.xml`,`.ui`,`.txt`,`.svg`]),_B=new Set([`LICENSE`,`LICENCE`,`COPYING`,`NOTICE`])});function isCancelled(t){return t instanceof Error&&t.message===bB}function render(t,n,S){S||pn.write(`\x1b[${t.length}A`);for(let S=0;S<t.length;S++){let C=t[S],N=S===n?`${yB.cyan}❯${yB.reset}`:` `,F=S===n?`${yB.bold}${yB.green}${C.label}${yB.reset}`:C.label,I=C.description?` ${yB.dim}${C.description}${yB.reset}`:``;pn.write(`\x1b[2K\r ${N} ${F}${I}\n`)}}function promptChoice(t,n,S=0){return n.length===0?Promise.reject(Error(`Nothing to choose for "${t}".`)):new Promise((C,N)=>{let F=S>=0&&S<n.length?S:0;pn.write(`${yB.bold}${t}${yB.reset} ${yB.dim}(↑/↓ to navigate, Enter to confirm, Ctrl+C to cancel)${yB.reset}\n`),render(n,F,!0),emitKeypressEvents(mn),mn.isTTY&&mn.setRawMode(!0),mn.resume();let cleanup=()=>{mn.removeListener(`keypress`,onKeypress),mn.isTTY&&mn.setRawMode(!1),mn.pause()},onKeypress=(t,S)=>{if(S){if(S.ctrl&&S.name===`c`){cleanup(),pn.write(`
975
- `),N(Error(bB));return}S.name===`up`||S.name===`k`?(F=(F-1+n.length)%n.length,render(n,F,!1)):S.name===`down`||S.name===`j`?(F=(F+1)%n.length,render(n,F,!1)):(S.name===`return`||S.name===`enter`)&&(cleanup(),C(n[F].value))}};mn.on(`keypress`,onKeypress)})}function promptTemplate(t){return t.length===0?Promise.reject(Error(`No templates available.`)):promptChoice(`Select a template`,t.map(t=>({value:t,label:t.name,description:t.description})))}function promptRuntime(t,n){return promptChoice(`Select a runtime`,t.map(t=>({value:t,label:t,description:dB[t]??``})),t.indexOf(n))}function promptPackageManager(t,n){return promptChoice(`Select a package manager`,t.map(t=>({value:t,label:t,description:``})),t.indexOf(n))}async function settle(t,n){switch(t.kind){case`value`:return t.value;case`auto`:return ge.error(t.notice),t.value;case`prompt`:try{return await n(t.choices,t.initial)}catch(t){if(!isCancelled(t))throw t;ge.error(`Cancelled.`);return}case`error`:ge.error(`Error: ${t.message}`);return}}async function promptSetup(t){let{offered:n,install:S,interactive:C}=t,N=await settle(selectRuntime({flag:t.runtime,offered:n,manager:t.packageManager,interactive:C}),(t,n)=>promptRuntime(t,n));if(N===void 0)return;let F=await settle(selectPackageManager({flag:t.packageManager,runtime:N,install:S,interactive:C}),(t,n)=>promptPackageManager(t,n));if(F!==void 0)return{runtime:N,packageManager:F}}var yB,bB,xB=__esmMin(()=>{_e(),hn(),Bd(),fB(),pB(),yB={reset:`\x1B[0m`,bold:`\x1B[1m`,dim:`\x1B[2m`,cyan:`\x1B[36m`,green:`\x1B[32m`},bB=`Cancelled by user`}),SB,CB=__esmMin(()=>{_e(),vB(),xB(),SB={command:`create [project-name]`,description:`Scaffold a new Gjsify project in a new directory.`,builder:t=>{let n=discoverTemplates(),S=n.map(t=>t.name),C=[...new Set(n.flatMap(t=>supportedRuntimes(t)))];return t.positional(`project-name`,{describe:`Name of the project directory to create`,type:`string`,default:`my-gjs-app`}).option(`template`,{alias:`t`,describe:`Template to scaffold from`,type:`string`,choices:S.length>0?S:void 0}).option(`runtime`,{alias:`r`,describe:`Runtime to set the project up for. Decides which package managers are offered and which start script the next steps name.`,type:`string`,choices:C.length>0?C:void 0}).option(`force`,{alias:`f`,describe:`Scaffold into a non-empty directory`,type:`boolean`,default:!1}).option(`install`,{describe:`Install dependencies after scaffolding`,type:`boolean`,default:!1}).option(`package-manager`,{alias:`p`,describe:"Package manager to install with, and to name in the printed next steps. Must be one the chosen runtime can install for. `gjsify` is the only one that works on a host with no Node.js.",type:`string`,choices:sB})},handler:async t=>{let n=!!process.stdin.isTTY,S=discoverTemplates(),C=t.template;if(!C){if(!n){let t=S.map(t=>t.name).join(`, `);return ge.error(`Error: --template is required in non-interactive mode. Available templates: ${t||`(none)`}`),process.exit(1)}let t=await promptTemplate(S).catch(t=>{if(!isCancelled(t))throw t;ge.error(`Cancelled.`)});if(t===void 0)return process.exit(1);C=t.name}let N=S.find(t=>t.name===C),F=await promptSetup({offered:N?supportedRuntimes(N):[],runtime:t.runtime,packageManager:t[`package-manager`],install:t.install,interactive:n});if(F===void 0)return process.exit(1);await createProject({projectName:t[`project-name`],template:C,runtime:F.runtime,force:t.force,install:t.install,packageManager:F.packageManager})}}});function defaultTargetFor(t){let n=Fn(t,In(t));return On(Pn(t),n)}var wB,TB,EB=__esmMin(()=>{_e(),W_(),jd(),Hn(),Nu(),wB=promisify(execFile),TB={command:`gresource <xml>`,description:"Compile a GResource XML descriptor into a binary .gresource bundle (wraps `glib-compile-resources`).",builder:t=>t.positional(`xml`,{description:`Path to the .gresource.xml descriptor`,type:`string`,normalize:!0,demandOption:!0}).option(`sourcedir`,{description:`Directory containing the resource files referenced by <xml>`,type:`string`,normalize:!0}).option(`target`,{alias:`t`,description:`Output .gresource file (default: <xml-without-.xml> next to <xml>)`,type:`string`,normalize:!0}).option(`verbose`,{description:`Print the underlying glib-compile-resources invocation`,type:`boolean`,default:!1}),handler:async t=>{let n=On(t.xml),S=t.target?On(t.target):defaultTargetFor(n),C=[`--sourcedir=${t.sourcedir?On(t.sourcedir):Pn(n)}`,`--target=${S}`,n];t.verbose&&ge.log(`[gjsify gresource] glib-compile-resources ${C.join(` `)}`),await mkdir$1(Pn(S),{recursive:!0});try{let{stdout:n,stderr:N}=await wB(`glib-compile-resources`,C);n&&process.stdout.write(n),N&&process.stderr.write(N),t.verbose&&ge.log(`[gjsify gresource] wrote ${S}`)}catch(t){let n=t;n?.code===`ENOENT`?ge.error(`[gjsify gresource] glib-compile-resources not found. Install it via your distro (package: glib2-devel / libglib2.0-dev).`):(n?.stderr&&process.stderr.write(n.stderr),ge.error(`[gjsify gresource] glib-compile-resources failed${n?.code===void 0?``:` (exit ${n.code})`}`)),process.exitCode=typeof n?.code==`number`?n.code:1}}}});function mergeCatalogues(t){let n=t.template,S=new Set;for(let{locale:n}of t.catalogues){if(S.has(n))throw Error(`mergeCatalogues: two catalogues both claim locale "${n}". msgfmt APPENDS each --locale, so the chain would emit a duplicate key (desktop-file-validate: "multiple keys named Name[${n}]"; appstreamcli: "tag-duplicated") from two exit-0 calls. Merge them into one .po first (msgcat --use-first) and pass that.`);S.add(n)}for(let[S,C]of t.catalogues.entries()){let N=jn(t.workDir,`${S}${t.extension}`),F=[t.mode,`--template=${n}`,`--locale=${C.locale}`,`--output-file=${N}`,C.po];t.onCall?.(F),execFileSync(`msgfmt`,F,{stdio:`pipe`}),n=N}return n}var DB=__esmMin(()=>{W_(),Hn()});async function listLanguages(t){return(await readdir$1(t)).filter(t=>t.endsWith(`.po`)&&!t.startsWith(`.`)).map(t=>t.slice(0,-3)).sort()}function stripXmlComments(t){return t.replace(/<!--[\s\S]*?-->/g,``)}async function ensureDir(t){await mkdir$1(t,{recursive:!0})}async function fileExists(t){try{return await stat$1(t),!0}catch{return!1}}async function compileMerged(t){let n=await listLanguages(t.poDir);if(n.length===0){ge.warn(`[gjsify gettext] no .po files found in ${t.poDir}`);return}let S=jn(t.outDir,t.filename);await ensureDir(t.outDir);let C=await mkdtemp$1(jn(tmpdir(),`gjsify-gettext-`));try{let N=await readFile$1(mergeCatalogues({mode:`--${t.format}`,template:t.template,extension:`-${Fn(t.template).replace(/\.in$/,``)}`,catalogues:n.map(n=>({locale:n,po:jn(t.poDir,`${n}.po`)})),workDir:C,onCall:t.verbose?t=>ge.log(`[gjsify gettext] msgfmt ${t.join(` `)}`):void 0}),`utf-8`);await writeFile$1(S,t.removeXmlComments&&t.format===`xml`?stripXmlComments(N):N)}finally{await rm$1(C,{recursive:!0,force:!0})}t.verbose&&ge.log(`[gjsify gettext] merged ${n.length} language(s) into ${S}`)}async function compileCatalogues(t){let n=await listLanguages(t.poDir);if(n.length===0){ge.warn(`[gjsify gettext] no .po files found in ${t.poDir}`);return}for(let S of n){let n=jn(t.outDir,S,`LC_MESSAGES`);await ensureDir(n);let C=[`--output-file=${jn(n,t.filename)}`,jn(t.poDir,`${S}.po`)];t.verbose&&ge.log(`[gjsify gettext] msgfmt ${C.join(` `)}`),await OB(`msgfmt`,C)}t.verbose&&ge.log(`[gjsify gettext] compiled ${n.length} language(s) into ${t.outDir}`)}function defaultFilename(t,n,S){switch(n){case`mo`:return`${t}.mo`;case`desktop`:return`${t}.desktop`;case`xml`:return S?Fn(S.replace(/\.in$/,``)):`${t}.xml`}}var OB,kB,AB=__esmMin(()=>{_e(),W_(),jd(),qg(),Hn(),Nu(),DB(),OB=promisify(execFile),kB={command:`gettext <poDir> <outDir>`,description:`Compile gettext .po files to .mo (per-language locale tree), or merge every catalogue into a .desktop / AppStream template via msgfmt --desktop / --xml.`,builder:t=>t.positional(`poDir`,{description:`Directory containing <lang>.po files`,type:`string`,normalize:!0,demandOption:!0}).positional(`outDir`,{description:`Output directory (locale tree for --format=mo, plain dir for xml/desktop)`,type:`string`,normalize:!0,demandOption:!0}).option(`domain`,{description:"Text domain / application ID (e.g. `org.pixelrpg.maker`)",type:`string`,normalize:!0,demandOption:!0}).option(`format`,{description:`Output format`,type:`string`,choices:[`mo`,`xml`,`desktop`],default:`mo`}).option(`template`,{description:"Required for --format=xml|desktop: the file msgfmt substitutes into. Its SUFFIX matters — msgfmt --xml finds its ITS rules by filename pattern, so an AppStream template must be named `*.metainfo.xml[.in]`.",type:`string`,normalize:!0}).option(`metainfo`,{description:`Deprecated alias for --template.`,type:`string`,normalize:!0,hidden:!0}).option(`filename`,{description:`Override the output filename (defaults to <domain>.<ext>)`,type:`string`,normalize:!0}).option(`remove-xml-comments`,{description:`For --format=xml: strip XML comments from the compiled output`,type:`boolean`,default:!0}).option(`verbose`,{description:`Print each msgfmt invocation`,type:`boolean`,default:!1}),handler:async t=>{let n=On(t.poDir),S=On(t.outDir),C=t.domain,N=t.format??`mo`,F=t.template??t.metainfo,I=F?On(F):void 0,H=t.filename??defaultFilename(C,N,I),W=!!t.verbose,q=!!t[`remove-xml-comments`];if(!await fileExists(n)){ge.error(`[gjsify gettext] PO directory does not exist: ${n}`),process.exitCode=1;return}if(N!==`mo`&&I===void 0){ge.error(`[gjsify gettext] --format=${N} needs a template to substitute into: pass \`--template <file>\`. msgfmt has no way to produce this format from .po files alone.`+(N===`xml`?" Name it `*.metainfo.xml[.in]` — msgfmt --xml finds its ITS rules by filename pattern.":``)),process.exitCode=1;return}try{N===`mo`?await compileCatalogues({poDir:n,outDir:S,filename:H,verbose:W}):await compileMerged({poDir:n,outDir:S,format:N,template:I,filename:H,removeXmlComments:q,verbose:W})}catch(t){let n=t;n?.code===`ENOENT`?ge.error(`[gjsify gettext] msgfmt not found. Install it via your distro (package: gettext).`):(n?.stderr&&process.stderr.write(n.stderr),ge.error(`[gjsify gettext] msgfmt failed${n?.code===void 0?``:` (exit ${n.code})`}`)),process.exitCode=typeof n?.code==`number`?n.code:1}}}}),jB,MB,NB=__esmMin(()=>{_e(),W_(),jd(),Hn(),Nu(),jB=promisify(execFile),MB={command:`gsettings <schemadir>`,description:"Compile GSettings schema XML files into a binary gschemas.compiled (wraps `glib-compile-schemas`).",builder:t=>t.positional(`schemadir`,{description:`Directory containing *.gschema.xml descriptors`,type:`string`,normalize:!0,demandOption:!0}).option(`targetdir`,{alias:`t`,description:`Directory to write gschemas.compiled (default: <schemadir>)`,type:`string`,normalize:!0}).option(`strict`,{description:`Abort on any schema warning (passes --strict to glib-compile-schemas)`,type:`boolean`,default:!0}).option(`verbose`,{description:`Print the underlying glib-compile-schemas invocation`,type:`boolean`,default:!1}),handler:async t=>{let n=On(t.schemadir),S=t.targetdir?On(t.targetdir):n,C=[];t.strict&&C.push(`--strict`),C.push(`--targetdir=${S}`),C.push(n),t.verbose&&ge.log(`[gjsify gsettings] glib-compile-schemas ${C.join(` `)}`),await mkdir$1(S,{recursive:!0});try{let{stdout:n,stderr:N}=await jB(`glib-compile-schemas`,C);n&&process.stdout.write(n),N&&process.stderr.write(N),t.verbose&&ge.log(`[gjsify gsettings] wrote ${S}/gschemas.compiled`)}catch(t){let n=t;n?.code===`ENOENT`?ge.error(`[gjsify gsettings] glib-compile-schemas not found. Install it via your distro (package: glib2-devel / libglib2.0-dev).`):(n?.stderr&&process.stderr.write(n.stderr),ge.error(`[gjsify gsettings] glib-compile-schemas failed${n?.code===void 0?``:` (exit ${n.code})`}`)),process.exitCode=typeof n?.code==`number`?n.code:1}}}});function readPackageJson(t){let n=On(t,`package.json`),S;try{S=readFileSync(n,`utf-8`)}catch{throw Error(`gjsify flatpak: no package.json found at ${n}`)}try{return JSON.parse(S)}catch(t){throw Error(`gjsify flatpak: package.json at ${n} is not valid JSON: ${t.message}`)}}function looksLikeAppId(t){return typeof t==`string`&&/^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z][A-Za-z0-9_-]*){2,}$/.test(t)}function defaultCiContainer(t,n){return`ghcr.io/flathub-infra/flatpak-github-actions:${`${t}-${n}`}`}var PB,FB=__esmMin(()=>{Jd(),Hn(),PB=`gjsify-sources.json`});function resolveRuntime(t,n){let S=n.runtime??t?.runtime??`gnome`;if(S!==`gnome`&&S!==`freedesktop`)throw Error(`gjsify flatpak: unknown runtime "${S}" (expected "gnome" or "freedesktop")`);let C=n.runtimeVersion??t?.runtimeVersion??(S===`gnome`?`50`:`24.08`);return S===`gnome`?{runtime:S,runtimeId:`org.gnome.Platform`,sdk:`org.gnome.Sdk`,runtimeVersion:C}:{runtime:S,runtimeId:`org.freedesktop.Platform`,sdk:`org.freedesktop.Sdk`,runtimeVersion:C}}function deriveAppendPath(t){let n=[];for(let S of t){let t=/^org\.freedesktop\.Sdk\.Extension\.([A-Za-z0-9-]+)$/.exec(S);t&&n.push(`/usr/lib/sdk/${t[1]}/bin`)}return n.push(`/app/bin`),n}var IB,LB,RB=__esmMin(()=>{IB=[`--device=dri`,`--share=ipc`,`--socket=fallback-x11`,`--socket=wayland`],LB=[]});function pickFlatpakBuildKeys(t,n){let S=t??{},C={},N=[];for(let t of BB){let F=S[t];if(F!==void 0){C[t]=F;continue}let I=n[t];I!==void 0&&N.push(t),C[t]=I}return{values:C,fromLegacy:N}}function resolveShipFlatpakSettings(t){let n=t.ship.flatpak??{},{values:S,fromLegacy:C}=pickFlatpakBuildKeys(n,t.flatpak),N=resolveRuntime(S,{}),F=S.sdkExtensions??[],{appendPath:I,finishArgs:H,cleanup:W}=S;return{settings:{runtime:N.runtimeId,runtimeVersion:N.runtimeVersion,sdk:N.sdk,branch:n.branch??`stable`,sdkExtensions:[...F],appendPath:I??(F.length>0?deriveAppendPath(F):[]),finishArgs:H??(t.kind===`cli`?LB:IB),cleanup:[...new Set([...W??[],...t.kind===`app`?[VB]:[]])]},warnings:C.length===0?[]:[deprecationWarning(C)]}}function assertNoDroppedFlatpakModules(t){let n=[`modules`,`extraModules`].filter(n=>(t[n]?.length??0)>0);if(n.length===0)return;let S=n.map(t=>`gjsify.flatpak.${t}`).join(` and `);throw Error(`gjsify ship: ${S} ${n.length>1?`are`:`is`} set, but the \`flatpak\` target renders ONE module, the staged payload, and would drop ${n.length>1?`them`:`it`} (ADR 0024 § 2). Build this Flatpak with \`gjsify flatpak init\` + \`gjsify flatpak build\`, which honour the key, or leave \`flatpak\` out of \`--target\` / \`gjsify.ship.targets\`.`)}function deprecationWarning(t){let n=t.map(t=>`gjsify.flatpak.${t}`).join(`, `),S=t.map(t=>`gjsify.ship.flatpak.${t}`).join(`, `);return`DEPRECATION: ${n} ${t.length>1?`are`:`is`} read by \`gjsify ship\` for compatibility and will be removed in ${zB}. Move ${t.length>1?`them`:`it`} to ${S} — both spellings resolve until then, and \`gjsify.ship.flatpak\` wins where both are set. The app METADATA in \`gjsify.flatpak\` (name, summary, developer, categories, licence) is NOT deprecated: both blocks describe the same application and either may carry it (ADR 0024 § 8).`}var zB,BB,VB,HB=__esmMin(()=>{RB(),zB=`1.0.0`,BB=[`runtime`,`runtimeVersion`,`sdkExtensions`,`appendPath`,`finishArgs`,`cleanup`],VB=`/share/icons/hicolor/scalable`});function loadDesktopTemplate(){return UB}function validateAppMetadata(t){let n=t.metadata,S=t.configKey,C=[];return(!n.developer?.id||!n.developer?.name)&&C.push({field:`${S}.developer`,hint:`Set \`${S}.developer = { "id": "io.github.you", "name": "Your Name" }\` in package.json. The id is reverse-DNS.`}),n.summary||C.push({field:`${S}.summary`,hint:`One-line app summary, ≤80 chars, no trailing period. Example: "Learn 6502 assembly language".`}),n.description||C.push({field:`${S}.description`,hint:`Plain text (split on blank lines) or DescriptionBlock[] for rich content with bullet lists + translator hints.`}),n.license?.project||C.push({field:`${S}.license.project`,hint:`SPDX identifier of the project license, e.g. "MIT", "GPL-3.0-or-later".`}),n.homepageUrl||C.push({field:`${S}.homepageUrl`,hint:`Required by Flathub. Example: "https://github.com/you/your-repo".`}),C}function renderMetainfoApp$1(t){return renderMetainfo(t,`desktop-application`)}function renderMetainfoCli$1(t){return renderMetainfo(t,`console-application`)}function renderDesktopEntry(t){let n=t.metadata,S=(n.categories??[`Utility`]).join(`;`)+`;`,C=n.keywords?.length?`Keywords=${n.keywords.join(`;`)};\n`:``,N=n.provides?.mimetypes??[],F=N.length?`MimeType=${N.join(`;`)};\n`:``;return substitute(loadDesktopTemplate(),{NAME:t.name,SUMMARY:n.summary??t.name,COMMAND:`${t.command}${execFieldCode(N)}`,APP_ID:t.appId,CATEGORIES_LINE:S,KEYWORDS_LINE:C,MIMETYPES_LINE:F})}function execFieldCode(t){return t.some(t=>t.startsWith(`x-scheme-handler/`))?` %u`:t.length>0?` %f`:``}function renderMetainfo(t,n){let S=t.metadata,C=t.copyrightYear??new Date().getFullYear(),N=S.developer?.name??``,F=[];F.push(`<?xml version="1.0" encoding="UTF-8"?>`),F.push(`<!-- Copyright ${C} ${escapeXml(N)} -->`),F.push(`<component type="${n}">`),F.push(` <id>${escapeXml(t.appId)}</id>`),F.push(` <metadata_license>${escapeXml(S.license?.metadata??`CC0-1.0`)}</metadata_license>`),F.push(` <project_license>${escapeXml(S.license?.project??``)}</project_license>`),F.push(` <name>${escapeXml(t.name)}</name>`),pushTranslatorHint(F,S.summaryTranslatorHint,` `),F.push(` <summary>${escapeXml(S.summary??t.name)}</summary>`),S.iconRemote&&F.push(` <icon type="remote">${escapeXml(S.iconRemote)}</icon>`),F.push(` <description>`);for(let t of renderDescriptionBlocks(S.description??``,` `))F.push(t);if(F.push(` </description>`),S.developer?.id&&S.developer?.name){F.push(` <developer id="${escapeXml(S.developer.id)}">`);let t=S.developer.nameTranslatable===!0?``:` translate="no"`;F.push(` <name${t}>${escapeXml(S.developer.name)}</name>`),S.developer.email&&F.push(` <email>${escapeXml(S.developer.email)}</email>`),F.push(` </developer>`)}n===`desktop-application`&&F.push(` <launchable type="desktop-id">${escapeXml(t.appId)}.desktop</launchable>`),S.screenshots?.length&&(F.push(` <screenshots>`),S.screenshots.forEach((t,n)=>{let S=t.type??(n===0?`default`:void 0),C=S?` type="${escapeXml(S)}"`:``,N=t.environment?` environment="${escapeXml(t.environment)}"`:``;F.push(` <screenshot${C}${N}>`),F.push(` <image>${escapeXml(t.url)}</image>`);for(let[n,S]of Object.entries(t.localizedUrls??{}))F.push(` <image xml:lang="${escapeXml(n)}">${escapeXml(S)}</image>`);t.caption&&(pushTranslatorHint(F,t.captionTranslatorHint,` `),F.push(` <caption>${escapeXml(t.caption)}</caption>`)),F.push(` </screenshot>`)}),F.push(` </screenshots>`)),S.homepageUrl&&F.push(` <url type="homepage">${escapeXml(S.homepageUrl)}</url>`),S.bugtrackerUrl&&F.push(` <url type="bugtracker">${escapeXml(S.bugtrackerUrl)}</url>`),S.vcsBrowserUrl&&F.push(` <url type="vcs-browser">${escapeXml(S.vcsBrowserUrl)}</url>`),S.donationUrl&&channelAllowsDonations(t.channel)&&F.push(` <url type="donation">${escapeXml(S.donationUrl)}</url>`),S.translateUrl&&F.push(` <url type="translate">${escapeXml(S.translateUrl)}</url>`);let I=normaliseContentRating(S.contentRating);if(I.attributes&&Object.keys(I.attributes).length>0){F.push(` <content_rating type="${escapeXml(I.type)}">`);for(let[t,n]of Object.entries(I.attributes))F.push(` <content_attribute id="${escapeXml(t)}">${escapeXml(n)}</content_attribute>`);F.push(` </content_rating>`)}else F.push(` <content_rating type="${escapeXml(I.type)}" />`);if(S.releases?.length){F.push(` <releases>`);for(let t of S.releases)if(t.description===void 0)F.push(` <release version="${escapeXml(t.version)}" date="${escapeXml(t.date)}" />`);else{F.push(` <release version="${escapeXml(t.version)}" date="${escapeXml(t.date)}">`),F.push(` <description>`);for(let n of renderDescriptionBlocks(t.description,` `))F.push(n);F.push(` </description>`),F.push(` </release>`)}F.push(` </releases>`)}if(S.categories?.length){F.push(` <categories>`);for(let t of S.categories)F.push(` <category>${escapeXml(t)}</category>`);F.push(` </categories>`)}if(S.keywords?.length){F.push(` <keywords>`);for(let t of S.keywords)F.push(` <keyword>${escapeXml(t)}</keyword>`);F.push(` </keywords>`)}if(n===`desktop-application`&&S.branding&&(F.push(` <branding>`),F.push(` <color type="primary" scheme_preference="light">${escapeXml(S.branding.accentLight)}</color>`),F.push(` <color type="primary" scheme_preference="dark">${escapeXml(S.branding.accentDark)}</color>`),F.push(` </branding>`)),S.kudos?.length){F.push(` <kudos>`);for(let t of S.kudos)F.push(` <kudo>${escapeXml(t)}</kudo>`);F.push(` </kudos>`)}let H=S.provides?.binaries??[t.command],W=S.provides?.mimetypes??[],q=S.provides?.dbus??[];if(H.length||W.length||q.length){F.push(` <provides>`);for(let t of H)F.push(` <binary>${escapeXml(t)}</binary>`);for(let t of W)F.push(` <mediatype>${escapeXml(t)}</mediatype>`);for(let t of q)F.push(` <dbus type="${escapeXml(t.type)}">${escapeXml(t.id)}</dbus>`);F.push(` </provides>`)}if(S.supports?.controls?.length||S.supports?.internet){F.push(` <supports>`);for(let t of S.supports.controls??[])F.push(` <control>${escapeXml(t)}</control>`);S.supports.internet&&F.push(` <internet>${escapeXml(S.supports.internet)}</internet>`),F.push(` </supports>`)}if(S.requires?.displayLengthMin||S.requires?.controls?.length||S.requires?.internet){F.push(` <requires>`),S.requires.displayLengthMin&&F.push(` <display_length compare="ge">${S.requires.displayLengthMin}</display_length>`);for(let t of S.requires.controls??[])F.push(` <control>${escapeXml(t)}</control>`);S.requires.internet&&F.push(` <internet>${escapeXml(S.requires.internet)}</internet>`),F.push(` </requires>`)}if(S.recommends?.displayLengthMin||S.recommends?.controls?.length){F.push(` <recommends>`),S.recommends.displayLengthMin&&F.push(` <display_length compare="ge">${S.recommends.displayLengthMin}</display_length>`);for(let t of S.recommends.controls??[])F.push(` <control>${escapeXml(t)}</control>`);F.push(` </recommends>`)}return F.push(`</component>`),F.join(`
975
+ `),N(Error(bB));return}S.name===`up`||S.name===`k`?(F=(F-1+n.length)%n.length,render(n,F,!1)):S.name===`down`||S.name===`j`?(F=(F+1)%n.length,render(n,F,!1)):(S.name===`return`||S.name===`enter`)&&(cleanup(),C(n[F].value))}};mn.on(`keypress`,onKeypress)})}function promptTemplate(t){return t.length===0?Promise.reject(Error(`No templates available.`)):promptChoice(`Select a template`,t.map(t=>({value:t,label:t.name,description:t.description})))}function promptRuntime(t,n){return promptChoice(`Select a runtime`,t.map(t=>({value:t,label:t,description:dB[t]??``})),t.indexOf(n))}function promptPackageManager(t,n){return promptChoice(`Select a package manager`,t.map(t=>({value:t,label:t,description:``})),t.indexOf(n))}async function settle(t,n){switch(t.kind){case`value`:return t.value;case`auto`:return ge.error(t.notice),t.value;case`prompt`:try{return await n(t.choices,t.initial)}catch(t){if(!isCancelled(t))throw t;ge.error(`Cancelled.`);return}case`error`:ge.error(`Error: ${t.message}`);return}}async function promptSetup(t){let{offered:n,install:S,interactive:C}=t,N=await settle(selectRuntime({flag:t.runtime,offered:n,manager:t.packageManager,interactive:C}),(t,n)=>promptRuntime(t,n));if(N===void 0)return;let F=await settle(selectPackageManager({flag:t.packageManager,runtime:N,install:S,interactive:C}),(t,n)=>promptPackageManager(t,n));if(F!==void 0)return{runtime:N,packageManager:F}}var yB,bB,xB=__esmMin(()=>{_e(),hn(),Bd(),fB(),pB(),yB={reset:`\x1B[0m`,bold:`\x1B[1m`,dim:`\x1B[2m`,cyan:`\x1B[36m`,green:`\x1B[32m`},bB=`Cancelled by user`}),SB,CB=__esmMin(()=>{_e(),vB(),xB(),SB={command:`create [project-name]`,description:`Scaffold a new Gjsify project in a new directory.`,builder:t=>{let n=discoverTemplates(),S=n.map(t=>t.name),C=[...new Set(n.flatMap(t=>supportedRuntimes(t)))];return t.positional(`project-name`,{describe:`Name of the project directory to create`,type:`string`,default:`my-gjs-app`}).option(`template`,{alias:`t`,describe:`Template to scaffold from`,type:`string`,choices:S.length>0?S:void 0}).option(`runtime`,{alias:`r`,describe:`Runtime to set the project up for. Decides which package managers are offered and which start script the next steps name.`,type:`string`,choices:C.length>0?C:void 0}).option(`force`,{alias:`f`,describe:`Scaffold into a non-empty directory`,type:`boolean`,default:!1}).option(`install`,{describe:`Install dependencies after scaffolding`,type:`boolean`,default:!1}).option(`package-manager`,{alias:`p`,describe:"Package manager to install with, and to name in the printed next steps. Must be one the chosen runtime can install for. `gjsify` is the only one that works on a host with no Node.js.",type:`string`,choices:sB})},handler:async t=>{let n=!!process.stdin.isTTY,S=discoverTemplates(),C=t.template;if(!C){if(!n){let t=S.map(t=>t.name).join(`, `);return ge.error(`Error: --template is required in non-interactive mode. Available templates: ${t||`(none)`}`),process.exit(1)}let t=await promptTemplate(S).catch(t=>{if(!isCancelled(t))throw t;ge.error(`Cancelled.`)});if(t===void 0)return process.exit(1);C=t.name}let N=S.find(t=>t.name===C),F=await promptSetup({offered:N?supportedRuntimes(N):[],runtime:t.runtime,packageManager:t[`package-manager`],install:t.install,interactive:n});if(F===void 0)return process.exit(1);await createProject({projectName:t[`project-name`],template:C,runtime:F.runtime,force:t.force,install:t.install,packageManager:F.packageManager})}}});function defaultTargetFor(t){let n=Fn(t,In(t));return On(Pn(t),n)}var wB,TB,EB=__esmMin(()=>{_e(),W_(),jd(),Hn(),Nu(),wB=promisify(execFile),TB={command:`gresource <xml>`,description:"Compile a GResource XML descriptor into a binary .gresource bundle (wraps `glib-compile-resources`).",builder:t=>t.positional(`xml`,{description:`Path to the .gresource.xml descriptor`,type:`string`,normalize:!0,demandOption:!0}).option(`sourcedir`,{description:`Directory containing the resource files referenced by <xml>`,type:`string`,normalize:!0}).option(`target`,{alias:`t`,description:`Output .gresource file (default: <xml-without-.xml> next to <xml>)`,type:`string`,normalize:!0}).option(`verbose`,{description:`Print the underlying glib-compile-resources invocation`,type:`boolean`,default:!1}),handler:async t=>{let n=On(t.xml),S=t.target?On(t.target):defaultTargetFor(n),C=[`--sourcedir=${t.sourcedir?On(t.sourcedir):Pn(n)}`,`--target=${S}`,n];t.verbose&&ge.log(`[gjsify gresource] glib-compile-resources ${C.join(` `)}`),await mkdir$1(Pn(S),{recursive:!0});try{let{stdout:n,stderr:N}=await wB(`glib-compile-resources`,C);n&&process.stdout.write(n),N&&process.stderr.write(N),t.verbose&&ge.log(`[gjsify gresource] wrote ${S}`)}catch(t){let n=t;n?.code===`ENOENT`?ge.error(`[gjsify gresource] glib-compile-resources not found. Install it via your distro (package: glib2-devel / libglib2.0-dev).`):(n?.stderr&&process.stderr.write(n.stderr),ge.error(`[gjsify gresource] glib-compile-resources failed${n?.code===void 0?``:` (exit ${n.code})`}`)),process.exitCode=typeof n?.code==`number`?n.code:1}}}});function mergeCatalogues(t){let n=t.template,S=new Set;for(let{locale:n}of t.catalogues){if(S.has(n))throw Error(`mergeCatalogues: two catalogues both claim locale "${n}". msgfmt APPENDS each --locale, so the chain would emit a duplicate key (desktop-file-validate: "multiple keys named Name[${n}]"; appstreamcli: "tag-duplicated") from two exit-0 calls. Merge them into one .po first (msgcat --use-first) and pass that.`);S.add(n)}for(let[S,C]of t.catalogues.entries()){let N=jn(t.workDir,`${S}${t.extension}`),F=[t.mode,`--template=${n}`,`--locale=${C.locale}`,`--output-file=${N}`,C.po];t.onCall?.(F),execFileSync(`msgfmt`,F,{stdio:`pipe`}),n=N}return n}var DB=__esmMin(()=>{W_(),Hn()});async function listLanguages(t){return(await readdir$1(t)).filter(t=>t.endsWith(`.po`)&&!t.startsWith(`.`)).map(t=>t.slice(0,-3)).sort()}function stripXmlComments(t){return t.replace(/<!--[\s\S]*?-->/g,``)}async function ensureDir(t){await mkdir$1(t,{recursive:!0})}async function fileExists(t){try{return await stat$1(t),!0}catch{return!1}}async function compileMerged(t){let n=await listLanguages(t.poDir);if(n.length===0){ge.warn(`[gjsify gettext] no .po files found in ${t.poDir}`);return}let S=jn(t.outDir,t.filename);await ensureDir(t.outDir);let C=await mkdtemp$1(jn(tmpdir(),`gjsify-gettext-`));try{let N=await readFile$1(mergeCatalogues({mode:`--${t.format}`,template:t.template,extension:`-${Fn(t.template).replace(/\.in$/,``)}`,catalogues:n.map(n=>({locale:n,po:jn(t.poDir,`${n}.po`)})),workDir:C,onCall:t.verbose?t=>ge.log(`[gjsify gettext] msgfmt ${t.join(` `)}`):void 0}),`utf-8`);await writeFile$1(S,t.removeXmlComments&&t.format===`xml`?stripXmlComments(N):N)}finally{await rm$1(C,{recursive:!0,force:!0})}t.verbose&&ge.log(`[gjsify gettext] merged ${n.length} language(s) into ${S}`)}async function compileCatalogues(t){let n=await listLanguages(t.poDir);if(n.length===0){ge.warn(`[gjsify gettext] no .po files found in ${t.poDir}`);return}for(let S of n){let n=jn(t.outDir,S,`LC_MESSAGES`);await ensureDir(n);let C=[`--output-file=${jn(n,t.filename)}`,jn(t.poDir,`${S}.po`)];t.verbose&&ge.log(`[gjsify gettext] msgfmt ${C.join(` `)}`),await OB(`msgfmt`,C)}t.verbose&&ge.log(`[gjsify gettext] compiled ${n.length} language(s) into ${t.outDir}`)}function defaultFilename(t,n,S){switch(n){case`mo`:return`${t}.mo`;case`desktop`:return`${t}.desktop`;case`xml`:return S?Fn(S.replace(/\.in$/,``)):`${t}.xml`}}var OB,kB,AB=__esmMin(()=>{_e(),W_(),jd(),qg(),Hn(),Nu(),DB(),OB=promisify(execFile),kB={command:`gettext <poDir> <outDir>`,description:`Compile gettext .po files to .mo (per-language locale tree), or merge every catalogue into a .desktop / AppStream template via msgfmt --desktop / --xml.`,builder:t=>t.positional(`poDir`,{description:`Directory containing <lang>.po files`,type:`string`,normalize:!0,demandOption:!0}).positional(`outDir`,{description:`Output directory (locale tree for --format=mo, plain dir for xml/desktop)`,type:`string`,normalize:!0,demandOption:!0}).option(`domain`,{description:"Text domain / application ID (e.g. `org.pixelrpg.maker`)",type:`string`,normalize:!0,demandOption:!0}).option(`format`,{description:`Output format`,type:`string`,choices:[`mo`,`xml`,`desktop`],default:`mo`}).option(`template`,{description:"Required for --format=xml|desktop: the file msgfmt substitutes into. Its SUFFIX matters — msgfmt --xml finds its ITS rules by filename pattern, so an AppStream template must be named `*.metainfo.xml[.in]`.",type:`string`,normalize:!0}).option(`metainfo`,{description:`Deprecated alias for --template.`,type:`string`,normalize:!0,hidden:!0}).option(`filename`,{description:`Override the output filename (defaults to <domain>.<ext>)`,type:`string`,normalize:!0}).option(`remove-xml-comments`,{description:`For --format=xml: strip XML comments from the compiled output`,type:`boolean`,default:!0}).option(`verbose`,{description:`Print each msgfmt invocation`,type:`boolean`,default:!1}),handler:async t=>{let n=On(t.poDir),S=On(t.outDir),C=t.domain,N=t.format??`mo`,F=t.template??t.metainfo,I=F?On(F):void 0,H=t.filename??defaultFilename(C,N,I),W=!!t.verbose,q=!!t[`remove-xml-comments`];if(!await fileExists(n)){ge.error(`[gjsify gettext] PO directory does not exist: ${n}`),process.exitCode=1;return}if(N!==`mo`&&I===void 0){ge.error(`[gjsify gettext] --format=${N} needs a template to substitute into: pass \`--template <file>\`. msgfmt has no way to produce this format from .po files alone.`+(N===`xml`?" Name it `*.metainfo.xml[.in]` — msgfmt --xml finds its ITS rules by filename pattern.":``)),process.exitCode=1;return}try{N===`mo`?await compileCatalogues({poDir:n,outDir:S,filename:H,verbose:W}):await compileMerged({poDir:n,outDir:S,format:N,template:I,filename:H,removeXmlComments:q,verbose:W})}catch(t){let n=t;n?.code===`ENOENT`?ge.error(`[gjsify gettext] msgfmt not found. Install it via your distro (package: gettext).`):(n?.stderr&&process.stderr.write(n.stderr),ge.error(`[gjsify gettext] msgfmt failed${n?.code===void 0?``:` (exit ${n.code})`}`)),process.exitCode=typeof n?.code==`number`?n.code:1}}}}),jB,MB,NB=__esmMin(()=>{_e(),W_(),jd(),Hn(),Nu(),jB=promisify(execFile),MB={command:`gsettings <schemadir>`,description:"Compile GSettings schema XML files into a binary gschemas.compiled (wraps `glib-compile-schemas`).",builder:t=>t.positional(`schemadir`,{description:`Directory containing *.gschema.xml descriptors`,type:`string`,normalize:!0,demandOption:!0}).option(`targetdir`,{alias:`t`,description:`Directory to write gschemas.compiled (default: <schemadir>)`,type:`string`,normalize:!0}).option(`strict`,{description:`Abort on any schema warning (passes --strict to glib-compile-schemas)`,type:`boolean`,default:!0}).option(`verbose`,{description:`Print the underlying glib-compile-schemas invocation`,type:`boolean`,default:!1}),handler:async t=>{let n=On(t.schemadir),S=t.targetdir?On(t.targetdir):n,C=[];t.strict&&C.push(`--strict`),C.push(`--targetdir=${S}`),C.push(n),t.verbose&&ge.log(`[gjsify gsettings] glib-compile-schemas ${C.join(` `)}`),await mkdir$1(S,{recursive:!0});try{let{stdout:n,stderr:N}=await jB(`glib-compile-schemas`,C);n&&process.stdout.write(n),N&&process.stderr.write(N),t.verbose&&ge.log(`[gjsify gsettings] wrote ${S}/gschemas.compiled`)}catch(t){let n=t;n?.code===`ENOENT`?ge.error(`[gjsify gsettings] glib-compile-schemas not found. Install it via your distro (package: glib2-devel / libglib2.0-dev).`):(n?.stderr&&process.stderr.write(n.stderr),ge.error(`[gjsify gsettings] glib-compile-schemas failed${n?.code===void 0?``:` (exit ${n.code})`}`)),process.exitCode=typeof n?.code==`number`?n.code:1}}}});function readPackageJson(t){let n=On(t,`package.json`),S;try{S=readFileSync(n,`utf-8`)}catch{throw Error(`gjsify flatpak: no package.json found at ${n}`)}try{return JSON.parse(S)}catch(t){throw Error(`gjsify flatpak: package.json at ${n} is not valid JSON: ${t.message}`)}}function looksLikeAppId(t){return typeof t==`string`&&/^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z][A-Za-z0-9_-]*){2,}$/.test(t)}function defaultCiContainer(t,n){return`ghcr.io/flathub-infra/flatpak-github-actions:${`${t}-${n}`}`}var PB,FB=__esmMin(()=>{Jd(),Hn(),PB=`gjsify-sources.json`});function resolveRuntime(t,n){let S=n.runtime??t?.runtime??`gnome`;if(S!==`gnome`&&S!==`freedesktop`)throw Error(`gjsify flatpak: unknown runtime "${S}" (expected "gnome" or "freedesktop")`);let C=n.runtimeVersion??t?.runtimeVersion??(S===`gnome`?`51`:`24.08`);return S===`gnome`?{runtime:S,runtimeId:`org.gnome.Platform`,sdk:`org.gnome.Sdk`,runtimeVersion:C}:{runtime:S,runtimeId:`org.freedesktop.Platform`,sdk:`org.freedesktop.Sdk`,runtimeVersion:C}}function deriveAppendPath(t){let n=[];for(let S of t){let t=/^org\.freedesktop\.Sdk\.Extension\.([A-Za-z0-9-]+)$/.exec(S);t&&n.push(`/usr/lib/sdk/${t[1]}/bin`)}return n.push(`/app/bin`),n}var IB,LB,RB=__esmMin(()=>{IB=[`--device=dri`,`--share=ipc`,`--socket=fallback-x11`,`--socket=wayland`],LB=[]});function pickFlatpakBuildKeys(t,n){let S=t??{},C={},N=[];for(let t of BB){let F=S[t];if(F!==void 0){C[t]=F;continue}let I=n[t];I!==void 0&&N.push(t),C[t]=I}return{values:C,fromLegacy:N}}function resolveShipFlatpakSettings(t){let n=t.ship.flatpak??{},{values:S,fromLegacy:C}=pickFlatpakBuildKeys(n,t.flatpak),N=resolveRuntime(S,{}),F=S.sdkExtensions??[],{appendPath:I,finishArgs:H,cleanup:W}=S;return{settings:{runtime:N.runtimeId,runtimeVersion:N.runtimeVersion,sdk:N.sdk,branch:n.branch??`stable`,sdkExtensions:[...F],appendPath:I??(F.length>0?deriveAppendPath(F):[]),finishArgs:H??(t.kind===`cli`?LB:IB),cleanup:[...new Set([...W??[],...t.kind===`app`?[VB]:[]])]},warnings:C.length===0?[]:[deprecationWarning(C)]}}function assertNoDroppedFlatpakModules(t){let n=[`modules`,`extraModules`].filter(n=>(t[n]?.length??0)>0);if(n.length===0)return;let S=n.map(t=>`gjsify.flatpak.${t}`).join(` and `);throw Error(`gjsify ship: ${S} ${n.length>1?`are`:`is`} set, but the \`flatpak\` target renders ONE module, the staged payload, and would drop ${n.length>1?`them`:`it`} (ADR 0024 § 2). Build this Flatpak with \`gjsify flatpak init\` + \`gjsify flatpak build\`, which honour the key, or leave \`flatpak\` out of \`--target\` / \`gjsify.ship.targets\`.`)}function deprecationWarning(t){let n=t.map(t=>`gjsify.flatpak.${t}`).join(`, `),S=t.map(t=>`gjsify.ship.flatpak.${t}`).join(`, `);return`DEPRECATION: ${n} ${t.length>1?`are`:`is`} read by \`gjsify ship\` for compatibility and will be removed in ${zB}. Move ${t.length>1?`them`:`it`} to ${S} — both spellings resolve until then, and \`gjsify.ship.flatpak\` wins where both are set. The app METADATA in \`gjsify.flatpak\` (name, summary, developer, categories, licence) is NOT deprecated: both blocks describe the same application and either may carry it (ADR 0024 § 8).`}var zB,BB,VB,HB=__esmMin(()=>{RB(),zB=`1.0.0`,BB=[`runtime`,`runtimeVersion`,`sdkExtensions`,`appendPath`,`finishArgs`,`cleanup`],VB=`/share/icons/hicolor/scalable`});function loadDesktopTemplate(){return UB}function validateAppMetadata(t){let n=t.metadata,S=t.configKey,C=[];return(!n.developer?.id||!n.developer?.name)&&C.push({field:`${S}.developer`,hint:`Set \`${S}.developer = { "id": "io.github.you", "name": "Your Name" }\` in package.json. The id is reverse-DNS.`}),n.summary||C.push({field:`${S}.summary`,hint:`One-line app summary, ≤80 chars, no trailing period. Example: "Learn 6502 assembly language".`}),n.description||C.push({field:`${S}.description`,hint:`Plain text (split on blank lines) or DescriptionBlock[] for rich content with bullet lists + translator hints.`}),n.license?.project||C.push({field:`${S}.license.project`,hint:`SPDX identifier of the project license, e.g. "MIT", "GPL-3.0-or-later".`}),n.homepageUrl||C.push({field:`${S}.homepageUrl`,hint:`Required by Flathub. Example: "https://github.com/you/your-repo".`}),C}function renderMetainfoApp$1(t){return renderMetainfo(t,`desktop-application`)}function renderMetainfoCli$1(t){return renderMetainfo(t,`console-application`)}function renderDesktopEntry(t){let n=t.metadata,S=(n.categories??[`Utility`]).join(`;`)+`;`,C=n.keywords?.length?`Keywords=${n.keywords.join(`;`)};\n`:``,N=n.provides?.mimetypes??[],F=N.length?`MimeType=${N.join(`;`)};\n`:``;return substitute(loadDesktopTemplate(),{NAME:t.name,SUMMARY:n.summary??t.name,COMMAND:`${t.command}${execFieldCode(N)}`,APP_ID:t.appId,CATEGORIES_LINE:S,KEYWORDS_LINE:C,MIMETYPES_LINE:F})}function execFieldCode(t){return t.some(t=>t.startsWith(`x-scheme-handler/`))?` %u`:t.length>0?` %f`:``}function renderMetainfo(t,n){let S=t.metadata,C=t.copyrightYear??new Date().getFullYear(),N=S.developer?.name??``,F=[];F.push(`<?xml version="1.0" encoding="UTF-8"?>`),F.push(`<!-- Copyright ${C} ${escapeXml(N)} -->`),F.push(`<component type="${n}">`),F.push(` <id>${escapeXml(t.appId)}</id>`),F.push(` <metadata_license>${escapeXml(S.license?.metadata??`CC0-1.0`)}</metadata_license>`),F.push(` <project_license>${escapeXml(S.license?.project??``)}</project_license>`),F.push(` <name>${escapeXml(t.name)}</name>`),pushTranslatorHint(F,S.summaryTranslatorHint,` `),F.push(` <summary>${escapeXml(S.summary??t.name)}</summary>`),S.iconRemote&&F.push(` <icon type="remote">${escapeXml(S.iconRemote)}</icon>`),F.push(` <description>`);for(let t of renderDescriptionBlocks(S.description??``,` `))F.push(t);if(F.push(` </description>`),S.developer?.id&&S.developer?.name){F.push(` <developer id="${escapeXml(S.developer.id)}">`);let t=S.developer.nameTranslatable===!0?``:` translate="no"`;F.push(` <name${t}>${escapeXml(S.developer.name)}</name>`),S.developer.email&&F.push(` <email>${escapeXml(S.developer.email)}</email>`),F.push(` </developer>`)}n===`desktop-application`&&F.push(` <launchable type="desktop-id">${escapeXml(t.appId)}.desktop</launchable>`),S.screenshots?.length&&(F.push(` <screenshots>`),S.screenshots.forEach((t,n)=>{let S=t.type??(n===0?`default`:void 0),C=S?` type="${escapeXml(S)}"`:``,N=t.environment?` environment="${escapeXml(t.environment)}"`:``;F.push(` <screenshot${C}${N}>`),F.push(` <image>${escapeXml(t.url)}</image>`);for(let[n,S]of Object.entries(t.localizedUrls??{}))F.push(` <image xml:lang="${escapeXml(n)}">${escapeXml(S)}</image>`);t.caption&&(pushTranslatorHint(F,t.captionTranslatorHint,` `),F.push(` <caption>${escapeXml(t.caption)}</caption>`)),F.push(` </screenshot>`)}),F.push(` </screenshots>`)),S.homepageUrl&&F.push(` <url type="homepage">${escapeXml(S.homepageUrl)}</url>`),S.bugtrackerUrl&&F.push(` <url type="bugtracker">${escapeXml(S.bugtrackerUrl)}</url>`),S.vcsBrowserUrl&&F.push(` <url type="vcs-browser">${escapeXml(S.vcsBrowserUrl)}</url>`),S.donationUrl&&channelAllowsDonations(t.channel)&&F.push(` <url type="donation">${escapeXml(S.donationUrl)}</url>`),S.translateUrl&&F.push(` <url type="translate">${escapeXml(S.translateUrl)}</url>`);let I=normaliseContentRating(S.contentRating);if(I.attributes&&Object.keys(I.attributes).length>0){F.push(` <content_rating type="${escapeXml(I.type)}">`);for(let[t,n]of Object.entries(I.attributes))F.push(` <content_attribute id="${escapeXml(t)}">${escapeXml(n)}</content_attribute>`);F.push(` </content_rating>`)}else F.push(` <content_rating type="${escapeXml(I.type)}" />`);if(S.releases?.length){F.push(` <releases>`);for(let t of S.releases)if(t.description===void 0)F.push(` <release version="${escapeXml(t.version)}" date="${escapeXml(t.date)}" />`);else{F.push(` <release version="${escapeXml(t.version)}" date="${escapeXml(t.date)}">`),F.push(` <description>`);for(let n of renderDescriptionBlocks(t.description,` `))F.push(n);F.push(` </description>`),F.push(` </release>`)}F.push(` </releases>`)}if(S.categories?.length){F.push(` <categories>`);for(let t of S.categories)F.push(` <category>${escapeXml(t)}</category>`);F.push(` </categories>`)}if(S.keywords?.length){F.push(` <keywords>`);for(let t of S.keywords)F.push(` <keyword>${escapeXml(t)}</keyword>`);F.push(` </keywords>`)}if(n===`desktop-application`&&S.branding&&(F.push(` <branding>`),F.push(` <color type="primary" scheme_preference="light">${escapeXml(S.branding.accentLight)}</color>`),F.push(` <color type="primary" scheme_preference="dark">${escapeXml(S.branding.accentDark)}</color>`),F.push(` </branding>`)),S.kudos?.length){F.push(` <kudos>`);for(let t of S.kudos)F.push(` <kudo>${escapeXml(t)}</kudo>`);F.push(` </kudos>`)}let H=S.provides?.binaries??[t.command],W=S.provides?.mimetypes??[],q=S.provides?.dbus??[];if(H.length||W.length||q.length){F.push(` <provides>`);for(let t of H)F.push(` <binary>${escapeXml(t)}</binary>`);for(let t of W)F.push(` <mediatype>${escapeXml(t)}</mediatype>`);for(let t of q)F.push(` <dbus type="${escapeXml(t.type)}">${escapeXml(t.id)}</dbus>`);F.push(` </provides>`)}if(S.supports?.controls?.length||S.supports?.internet){F.push(` <supports>`);for(let t of S.supports.controls??[])F.push(` <control>${escapeXml(t)}</control>`);S.supports.internet&&F.push(` <internet>${escapeXml(S.supports.internet)}</internet>`),F.push(` </supports>`)}if(S.requires?.displayLengthMin||S.requires?.controls?.length||S.requires?.internet){F.push(` <requires>`),S.requires.displayLengthMin&&F.push(` <display_length compare="ge">${S.requires.displayLengthMin}</display_length>`);for(let t of S.requires.controls??[])F.push(` <control>${escapeXml(t)}</control>`);S.requires.internet&&F.push(` <internet>${escapeXml(S.requires.internet)}</internet>`),F.push(` </requires>`)}if(S.recommends?.displayLengthMin||S.recommends?.controls?.length){F.push(` <recommends>`),S.recommends.displayLengthMin&&F.push(` <display_length compare="ge">${S.recommends.displayLengthMin}</display_length>`);for(let t of S.recommends.controls??[])F.push(` <control>${escapeXml(t)}</control>`);F.push(` </recommends>`)}return F.push(`</component>`),F.join(`
976
976
  `)+`
977
977
  `}function renderDescriptionBlocks(t,n){let S=typeof t==`string`?stringToBlocks(t):t,C=[];for(let t of S)if(`p`in t)pushTranslatorHint(C,t.translatorHint,n),C.push(`${n}<p>${escapeXml(t.p.trim().replace(/\s+/g,` `))}</p>`);else{pushTranslatorHint(C,t.translatorHint,n),C.push(`${n}<ul>`);for(let S of t.ul)typeof S==`string`?C.push(`${n} <li>${escapeXml(S)}</li>`):(pushTranslatorHint(C,S.translatorHint,`${n} `),C.push(`${n} <li>${escapeXml(S.item)}</li>`));C.push(`${n}</ul>`)}return C}function stringToBlocks(t){return t.trim().split(/\n\n+/).map(t=>({p:t.trim().replace(/\s+/g,` `)}))}function pushTranslatorHint(t,n,S){n&&t.push(`${S}<!-- TRANSLATORS: ${n} -->`)}function normaliseContentRating(t){return t===void 0?{type:`oars-1.1`}:typeof t==`string`?{type:t}:{type:t.type??`oars-1.1`,attributes:t.attributes}}function substitute(t,n){let S=t;for(let[t,C]of Object.entries(n))S=S.split(`{{${t}}}`).join(C);return S}function escapeXml(t){return t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var UB,WB=__esmMin(()=>{yh(),UB=`[Desktop Entry]
978
978
  Name={{NAME}}
@@ -1,5 +1,5 @@
1
1
  import { runBundle, runWatch, bundleToChunks } from '../bundler-pick.js';
2
- import { gjsifyPlugin, textLoaderPlugin, resolveShebangLine, NODE_SHEBANG, createGjsExternalsPredicate, globToEntryPoints, scanGiNamespaces, planGiSelection, WorkerEntries, } from '@gjsify/rolldown-plugin-gjsify';
2
+ import { gjsifyPlugin, textLoaderPlugin, resolveShebangLine, NODE_SHEBANG, createGjsExternalsPredicate, globToEntryPoints, scanGiNamespaces, planGiSelection, WorkerEntries, bundleSuffix, } from '@gjsify/rolldown-plugin-gjsify';
3
3
  import { isGjs } from '@gjsify/rolldown-plugin-gjsify/runtime';
4
4
  import { resolveUserPlugins } from '../utils/resolve-plugin-by-name.js';
5
5
  import { resolveGlobalsList, writeRegisterInjectFile, detectAutoGlobals, detectNodeGiGlobals, } from '@gjsify/rolldown-plugin-gjsify/globals';
@@ -720,7 +720,7 @@ export class BuildAction {
720
720
  const ownsWorkers = opts.workers === undefined;
721
721
  const workers = opts.workers ??
722
722
  (app !== 'nativescript' && !opts.watch && (outfile || outdir)
723
- ? new WorkerEntries(outfile ? extname(outfile) || '.js' : '.js')
723
+ ? new WorkerEntries(outfile ? bundleSuffix(outfile) : '.js')
724
724
  : undefined);
725
725
  if (workers)
726
726
  pluginOpts.workers = workers;
@@ -944,8 +944,8 @@ export interface ConfigDataFlatpak extends AppMetadata {
944
944
  lockfile?: string;
945
945
  /**
946
946
  * GitHub-Actions container image override for `gjsify flatpak ci`. Default is
947
- * derived from runtime + runtimeVersion, e.g. gnome+50 →
948
- * `ghcr.io/flathub-infra/flatpak-github-actions:gnome-50`.
947
+ * derived from runtime + runtimeVersion, e.g. gnome+51 →
948
+ * `ghcr.io/flathub-infra/flatpak-github-actions:gnome-51`.
949
949
  */
950
950
  ciContainer?: string;
951
951
  /** Branches the generated workflow triggers on. Default `['main']`. */
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Default GNOME-Platform runtime version. Bumped per release window.
3
- * GNOME 50 = April 2026 stable; tracked in
3
+ * GNOME 51 = September 2026 stable (on Freedesktop 26.08); tracked in
4
4
  * https://docs.flathub.org/docs/for-app-authors/requirements.
5
5
  */
6
- export declare const DEFAULT_GNOME_RUNTIME_VERSION = "50";
6
+ export declare const DEFAULT_GNOME_RUNTIME_VERSION = "51";
7
7
  /** Default Freedesktop-Platform runtime version (LTS-ish). */
8
8
  export declare const DEFAULT_FREEDESKTOP_RUNTIME_VERSION = "24.08";
9
9
  /** Permissive GUI defaults for GTK4 + Adwaita apps. */
@@ -9,10 +9,10 @@
9
9
  // GNOME releases from the same `package.json`.
10
10
  /**
11
11
  * Default GNOME-Platform runtime version. Bumped per release window.
12
- * GNOME 50 = April 2026 stable; tracked in
12
+ * GNOME 51 = September 2026 stable (on Freedesktop 26.08); tracked in
13
13
  * https://docs.flathub.org/docs/for-app-authors/requirements.
14
14
  */
15
- export const DEFAULT_GNOME_RUNTIME_VERSION = '50';
15
+ export const DEFAULT_GNOME_RUNTIME_VERSION = '51';
16
16
  /** Default Freedesktop-Platform runtime version (LTS-ish). */
17
17
  export const DEFAULT_FREEDESKTOP_RUNTIME_VERSION = '24.08';
18
18
  /** Permissive GUI defaults for GTK4 + Adwaita apps. */
@@ -69,7 +69,7 @@ export type FormatId = 'deb' | 'rpm' | 'flatpak' | 'appimage' | 'macos-app' | 'm
69
69
  * instead of being rediscovered per call site. A `.deb` says
70
70
  * `Depends: gir1.2-gtk-4.0`, an `.rpm` says `Requires: gtk4`, and both are
71
71
  * package names in a distribution's namespace. A Flatpak has no such field: it
72
- * declares ONE dependency, its runtime (`org.gnome.Platform//50`), in the
72
+ * declares ONE dependency, its runtime (`org.gnome.Platform//51`), in the
73
73
  * manifest — and inside that runtime a typelib is either present or nothing on
74
74
  * the system provides it, so there is no package to name and no gap a name
75
75
  * could close.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/cli",
3
- "version": "0.64.16",
3
+ "version": "0.64.17-next.292",
4
4
  "description": "CLI for Gjsify",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -18,7 +18,7 @@
18
18
  "kind": "cli",
19
19
  "name": "gjsify",
20
20
  "runtime": "gnome",
21
- "runtimeVersion": "50",
21
+ "runtimeVersion": "51",
22
22
  "sdkExtensions": [
23
23
  "org.freedesktop.Sdk.Extension.node24"
24
24
  ],
@@ -142,22 +142,22 @@
142
142
  "cli"
143
143
  ],
144
144
  "dependencies": {
145
- "@gjsify/blueprint": "^0.64.16",
146
- "@gjsify/buffer": "^0.64.16",
147
- "@gjsify/create-app": "^0.64.16",
148
- "@gjsify/node-globals": "^0.64.16",
149
- "@gjsify/node-polyfills": "^0.64.16",
150
- "@gjsify/npm-registry": "^0.64.16",
151
- "@gjsify/resolve-npm": "^0.64.16",
152
- "@gjsify/rolldown-plugin-gjsify": "^0.64.16",
153
- "@gjsify/vite-plugin-blueprint": "^0.64.16",
154
- "@gjsify/rolldown-plugin-pnp": "^0.64.16",
155
- "@gjsify/semver": "^0.64.16",
156
- "@gjsify/tar": "^0.64.16",
157
- "@gjsify/tsc": "^0.64.16",
158
- "@gjsify/utils": "^0.64.16",
159
- "@gjsify/web-polyfills": "^0.64.16",
160
- "@gjsify/workspace": "^0.64.16",
145
+ "@gjsify/blueprint": "0.64.17-next.292",
146
+ "@gjsify/buffer": "0.64.17-next.292",
147
+ "@gjsify/create-app": "0.64.17-next.292",
148
+ "@gjsify/node-globals": "0.64.17-next.292",
149
+ "@gjsify/node-polyfills": "0.64.17-next.292",
150
+ "@gjsify/npm-registry": "0.64.17-next.292",
151
+ "@gjsify/resolve-npm": "0.64.17-next.292",
152
+ "@gjsify/rolldown-plugin-gjsify": "0.64.17-next.292",
153
+ "@gjsify/vite-plugin-blueprint": "0.64.17-next.292",
154
+ "@gjsify/rolldown-plugin-pnp": "0.64.17-next.292",
155
+ "@gjsify/semver": "0.64.17-next.292",
156
+ "@gjsify/tar": "0.64.17-next.292",
157
+ "@gjsify/tsc": "0.64.17-next.292",
158
+ "@gjsify/utils": "0.64.17-next.292",
159
+ "@gjsify/web-polyfills": "0.64.17-next.292",
160
+ "@gjsify/workspace": "0.64.17-next.292",
161
161
  "acorn": "^8.17.0",
162
162
  "cosmiconfig": "^9.0.2",
163
163
  "get-tsconfig": "^4.14.0",
@@ -166,13 +166,13 @@
166
166
  "yargs": "^18.0.0"
167
167
  },
168
168
  "devDependencies": {
169
- "@gjsify/unit": "^0.64.16",
169
+ "@gjsify/unit": "0.64.17-next.292",
170
170
  "@types/yargs": "^17.0.35",
171
171
  "typescript": "^6.0.3"
172
172
  },
173
173
  "peerDependencies": {
174
- "@gjsify/oxfmt-native": "^0.64.16",
175
- "@gjsify/rolldown-native": "^0.64.16"
174
+ "@gjsify/oxfmt-native": "0.64.17-next.292",
175
+ "@gjsify/rolldown-native": "0.64.17-next.292"
176
176
  },
177
177
  "peerDependenciesMeta": {
178
178
  "@gjsify/oxfmt-native": {
@@ -191,5 +191,6 @@
191
191
  "bugs": {
192
192
  "url": "https://github.com/gjsify/gjsify/issues"
193
193
  },
194
- "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/cli#readme"
194
+ "homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/cli#readme",
195
+ "gitHead": "1cd14727f5a53991fbdee0f38eedea4dd8fdecdd"
195
196
  }