@scheduler-systems/gal-cli 0.1.18 → 0.1.19-beta
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/index.cjs +1358 -98
- package/package.json +7 -8
package/dist/index.cjs
CHANGED
|
@@ -1,36 +1,245 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`).replace(/^/gm," ".repeat(
|
|
4
|
-
`)}padWidth(e,n){return Math.max(n.longestOptionTermLength(e,n),n.longestGlobalOptionTermLength(e,n),n.longestSubcommandTermLength(e,n),n.longestArgumentTermLength(e,n))}wrap(e,n,o
|
|
2
|
+
"use strict";var _F=Object.create;var zd=Object.defineProperty;var wF=Object.getOwnPropertyDescriptor;var EF=Object.getOwnPropertyNames;var DF=Object.getPrototypeOf,CF=Object.prototype.hasOwnProperty;var kF=(t,e)=>()=>(t&&(e=t(t=0)),e);var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kb=(t,e)=>{for(var n in e)zd(t,n,{get:e[n],enumerable:!0})},AF=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of EF(e))!CF.call(t,o)&&o!==n&&zd(t,o,{get:()=>e[o],enumerable:!(r=wF(e,o))||r.enumerable});return t};var H=(t,e,n)=>(n=t!=null?_F(DF(t)):{},AF(e||!t||!t.__esModule?zd(n,"default",{value:t,enumerable:!0}):n,t));var Bs=b(Xd=>{var Qa=class extends Error{constructor(e,n,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=e,this.nestedError=void 0}},Zd=class extends Qa{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Xd.CommanderError=Qa;Xd.InvalidArgumentError=Zd});var ec=b(ef=>{var{InvalidArgumentError:TF}=Bs(),Qd=class{constructor(e,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,n){return n===this.defaultValue||!Array.isArray(n)?[e]:n.concat(e)}default(e,n){return this.defaultValue=e,this.defaultValueDescription=n,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(n,r)=>{if(!this.argChoices.includes(n))throw new TF(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(n,r):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function FF(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}ef.Argument=Qd;ef.humanReadableArgName=FF});var nf=b(Ab=>{var{humanReadableArgName:OF}=ec(),tf=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let n=e.commands.filter(o=>!o._hidden),r=e._getHelpCommand();return r&&!r._hidden&&n.push(r),this.sortSubcommands&&n.sort((o,s)=>o.name().localeCompare(s.name())),n}compareOptions(e,n){let r=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return r(e).localeCompare(r(n))}visibleOptions(e){let n=e.options.filter(o=>!o.hidden),r=e._getHelpOption();if(r&&!r.hidden){let o=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!o&&!s?n.push(r):r.long&&!s?n.push(e.createOption(r.long,r.description)):r.short&&!o&&n.push(e.createOption(r.short,r.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let n=[];for(let r=e.parent;r;r=r.parent){let o=r.options.filter(s=>!s.hidden);n.push(...o)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(n=>{n.description=n.description||e._argsDescription[n.name()]||""}),e.registeredArguments.find(n=>n.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(r=>OF(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,n){return n.visibleCommands(e).reduce((r,o)=>Math.max(r,n.subcommandTerm(o).length),0)}longestOptionTermLength(e,n){return n.visibleOptions(e).reduce((r,o)=>Math.max(r,n.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,n){return n.visibleGlobalOptions(e).reduce((r,o)=>Math.max(r,n.optionTerm(o).length),0)}longestArgumentTermLength(e,n){return n.visibleArguments(e).reduce((r,o)=>Math.max(r,n.argumentTerm(o).length),0)}commandUsage(e){let n=e._name;e._aliases[0]&&(n=n+"|"+e._aliases[0]);let r="";for(let o=e.parent;o;o=o.parent)r=o.name()+" "+r;return r+n+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let n=[];return e.argChoices&&n.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&n.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&n.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&n.push(`env: ${e.envVar}`),n.length>0?`${e.description} (${n.join(", ")})`:e.description}argumentDescription(e){let n=[];if(e.argChoices&&n.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&n.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),n.length>0){let r=`(${n.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,n){let r=n.padWidth(e,n),o=n.helpWidth||80,s=2,i=2;function a(g,h){if(h){let y=`${g.padEnd(r+i)}${h}`;return n.wrap(y,o-s,r+i)}return g}function c(g){return g.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(s))}let u=[`Usage: ${n.commandUsage(e)}`,""],d=n.commandDescription(e);d.length>0&&(u=u.concat([n.wrap(d,o,0),""]));let m=n.visibleArguments(e).map(g=>a(n.argumentTerm(g),n.argumentDescription(g)));m.length>0&&(u=u.concat(["Arguments:",c(m),""]));let p=n.visibleOptions(e).map(g=>a(n.optionTerm(g),n.optionDescription(g)));if(p.length>0&&(u=u.concat(["Options:",c(p),""])),this.showGlobalOptions){let g=n.visibleGlobalOptions(e).map(h=>a(n.optionTerm(h),n.optionDescription(h)));g.length>0&&(u=u.concat(["Global Options:",c(g),""]))}let f=n.visibleCommands(e).map(g=>a(n.subcommandTerm(g),n.subcommandDescription(g)));return f.length>0&&(u=u.concat(["Commands:",c(f),""])),u.join(`
|
|
4
|
+
`)}padWidth(e,n){return Math.max(n.longestOptionTermLength(e,n),n.longestGlobalOptionTermLength(e,n),n.longestSubcommandTermLength(e,n),n.longestArgumentTermLength(e,n))}wrap(e,n,r,o=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",i=new RegExp(`[\\n][${s}]+`);if(e.match(i))return e;let a=n-r;if(a<o)return e;let c=e.slice(0,r),u=e.slice(r).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),
|
|
7
|
-
|.{1,${
|
|
8
|
-
`?"":(
|
|
9
|
-
`)}};
|
|
10
|
-
(Did you mean one of ${
|
|
11
|
-
(Did you mean ${
|
|
12
|
-
- specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=e._name),(n.noHelp||n.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,n){return new
|
|
13
|
-
Expecting one of '${
|
|
14
|
-
- already used by option '${n.flags}'`)}this.options.push(e)}_registerCommand(e){let n=
|
|
6
|
+
`),d=" ".repeat(r),p="\\s\u200B",f=new RegExp(`
|
|
7
|
+
|.{1,${a-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g"),g=u.match(f)||[];return c+g.map((h,y)=>h===`
|
|
8
|
+
`?"":(y>0?d:"")+h.trimEnd()).join(`
|
|
9
|
+
`)}};Ab.Help=tf});var af=b(sf=>{var{InvalidArgumentError:IF}=Bs(),rf=class{constructor(e,n){this.flags=e,this.description=n||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=xF(e);this.short=r.shortFlag,this.long=r.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,n){return this.defaultValue=e,this.defaultValueDescription=n,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let n=e;return typeof e=="string"&&(n={[e]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,n){return n===this.defaultValue||!Array.isArray(n)?[e]:n.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(n,r)=>{if(!this.argChoices.includes(n))throw new IF(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(n,r):n},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return NF(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},of=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(n=>{n.negate?this.negativeOptions.set(n.attributeName(),n):this.positiveOptions.set(n.attributeName(),n)}),this.negativeOptions.forEach((n,r)=>{this.positiveOptions.has(r)&&this.dualOptions.add(r)})}valueFromOption(e,n){let r=n.attributeName();if(!this.dualOptions.has(r))return!0;let o=this.negativeOptions.get(r).presetArg,s=o!==void 0?o:!1;return n.negate===(s===e)}};function NF(t){return t.split("-").reduce((e,n)=>e+n[0].toUpperCase()+n.slice(1))}function xF(t){let e,n,r=t.split(/[ |,]+/);return r.length>1&&!/^[[<]/.test(r[1])&&(e=r.shift()),n=r.shift(),!e&&/^-[^-]$/.test(n)&&(e=n,n=void 0),{shortFlag:e,longFlag:n}}sf.Option=rf;sf.DualOptions=of});var Fb=b(Tb=>{function PF(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let n=[];for(let r=0;r<=t.length;r++)n[r]=[r];for(let r=0;r<=e.length;r++)n[0][r]=r;for(let r=1;r<=e.length;r++)for(let o=1;o<=t.length;o++){let s=1;t[o-1]===e[r-1]?s=0:s=1,n[o][r]=Math.min(n[o-1][r]+1,n[o][r-1]+1,n[o-1][r-1]+s),o>1&&r>1&&t[o-1]===e[r-2]&&t[o-2]===e[r-1]&&(n[o][r]=Math.min(n[o][r],n[o-2][r-2]+1))}return n[t.length][e.length]}function RF(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let n=t.startsWith("--");n&&(t=t.slice(2),e=e.map(i=>i.slice(2)));let r=[],o=3,s=.4;return e.forEach(i=>{if(i.length<=1)return;let a=PF(t,i),c=Math.max(t.length,i.length);(c-a)/c>s&&(a<o?(o=a,r=[i]):a===o&&r.push(i))}),r.sort((i,a)=>i.localeCompare(a)),n&&(r=r.map(i=>`--${i}`)),r.length>1?`
|
|
10
|
+
(Did you mean one of ${r.join(", ")}?)`:r.length===1?`
|
|
11
|
+
(Did you mean ${r[0]}?)`:""}Tb.suggestSimilar=RF});var Pb=b(xb=>{var jF=require("node:events").EventEmitter,cf=require("node:child_process"),xn=require("node:path"),lf=require("node:fs"),Ae=require("node:process"),{Argument:$F,humanReadableArgName:LF}=ec(),{CommanderError:uf}=Bs(),{Help:BF}=nf(),{Option:Ob,DualOptions:MF}=af(),{suggestSimilar:Ib}=Fb(),df=class t extends jF{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:n=>Ae.stdout.write(n),writeErr:n=>Ae.stderr.write(n),getOutHelpWidth:()=>Ae.stdout.isTTY?Ae.stdout.columns:void 0,getErrHelpWidth:()=>Ae.stderr.isTTY?Ae.stderr.columns:void 0,outputError:(n,r)=>r(n)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let n=this;n;n=n.parent)e.push(n);return e}command(e,n,r){let o=n,s=r;typeof o=="object"&&o!==null&&(s=o,o=null),s=s||{};let[,i,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(i);return o&&(c.description(o),c._executableHandler=!0),s.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(s.noHelp||s.hidden),c._executableFile=s.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),o?this:c}createCommand(e){return new t(e)}createHelp(){return Object.assign(new BF,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,n){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
|
+
- specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=e._name),(n.noHelp||n.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,n){return new $F(e,n)}argument(e,n,r,o){let s=this.createArgument(e,n);return typeof r=="function"?s.default(o).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(e){let n=this.registeredArguments.slice(-1)[0];if(n&&n.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,n){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,r,o]=e.match(/([^ ]+) *(.*)/),s=n??"display help for command",i=this.createCommand(r);return i.helpOption(!1),o&&i.arguments(o),s&&i.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(e,n){return typeof e!="object"?(this.helpCommand(e,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,n){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(n):this._lifeCycleHooks[e]=[n],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(e,n,r){this._exitCallback&&this._exitCallback(new uf(e,n,r)),Ae.exit(e)}action(e){let n=r=>{let o=this.registeredArguments.length,s=r.slice(0,o);return this._storeOptionsAsProperties?s[o]=this:s[o]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=n,this}createOption(e,n){return new Ob(e,n)}_callParseArg(e,n,r,o){try{return e.parseArg(n,r)}catch(s){if(s.code==="commander.invalidArgument"){let i=`${o} ${s.message}`;this.error(i,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let n=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(n){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
|
|
14
|
+
- already used by option '${n.flags}'`)}this.options.push(e)}_registerCommand(e){let n=o=>[o.name()].concat(o.aliases()),r=n(e).find(o=>this._findCommand(o));if(r){let o=n(this._findCommand(r)).join("|"),s=n(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let n=e.name(),r=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let o=(s,i,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let c=this.getOptionValue(r);s!==null&&e.parseArg?s=this._callParseArg(e,s,c,i):s!==null&&e.variadic&&(s=e._concatValue(s,c)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(r,s,a)};return this.on("option:"+n,s=>{let i=`error: option '${e.flags}' argument '${s}' is invalid.`;o(s,i,"cli")}),e.envVar&&this.on("optionEnv:"+n,s=>{let i=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;o(s,i,"env")}),this}_optionEx(e,n,r,o,s){if(typeof n=="object"&&n instanceof Ob)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let i=this.createOption(n,r);if(i.makeOptionMandatory(!!e.mandatory),typeof o=="function")i.default(s).argParser(o);else if(o instanceof RegExp){let a=o;o=(c,u)=>{let d=a.exec(c);return d?d[0]:u},i.default(s).argParser(o)}else i.default(o);return this.addOption(i)}option(e,n,r,o){return this._optionEx({},e,n,r,o)}requiredOption(e,n,r,o){return this._optionEx({mandatory:!0},e,n,r,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,n){return this.setOptionValueWithSource(e,n,void 0)}setOptionValueWithSource(e,n,r){return this._storeOptionsAsProperties?this[e]=n:this._optionValues[e]=n,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let n;return this._getCommandAndAncestors().forEach(r=>{r.getOptionValueSource(e)!==void 0&&(n=r.getOptionValueSource(e))}),n}_prepareUserArgs(e,n){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},e===void 0&&n.from===void 0){Ae.versions?.electron&&(n.from="electron");let o=Ae.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(n.from="eval")}e===void 0&&(e=Ae.argv),this.rawArgs=e.slice();let r;switch(n.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":Ae.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${n.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,n){let r=this._prepareUserArgs(e,n);return this._parseCommand([],r),this}async parseAsync(e,n){let r=this._prepareUserArgs(e,n);return await this._parseCommand([],r),this}_executeSubCommand(e,n){n=n.slice();let r=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function s(d,m){let p=xn.resolve(d,m);if(lf.existsSync(p))return p;if(o.includes(xn.extname(m)))return;let f=o.find(g=>lf.existsSync(`${p}${g}`));if(f)return`${p}${f}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let d;try{d=lf.realpathSync(this._scriptPath)}catch{d=this._scriptPath}a=xn.resolve(xn.dirname(d),a)}if(a){let d=s(a,i);if(!d&&!e._executableFile&&this._scriptPath){let m=xn.basename(this._scriptPath,xn.extname(this._scriptPath));m!==this._name&&(d=s(a,`${m}-${e._name}`))}i=d||i}r=o.includes(xn.extname(i));let c;Ae.platform!=="win32"?r?(n.unshift(i),n=Nb(Ae.execArgv).concat(n),c=cf.spawn(Ae.argv[0],n,{stdio:"inherit"})):c=cf.spawn(i,n,{stdio:"inherit"}):(n.unshift(i),n=Nb(Ae.execArgv).concat(n),c=cf.spawn(Ae.execPath,n,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(m=>{Ae.on(m,()=>{c.killed===!1&&c.exitCode===null&&c.kill(m)})});let u=this._exitCallback;c.on("close",d=>{d=d??1,u?u(new uf(d,"commander.executeSubCommandAsync","(close)")):Ae.exit(d)}),c.on("error",d=>{if(d.code==="ENOENT"){let m=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",p=`'${i}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${
|
|
17
|
+
- ${m}`;throw new Error(p)}else if(d.code==="EACCES")throw new Error(`'${i}' not executable`);if(!u)Ae.exit(1);else{let m=new uf(1,"commander.executeSubCommandAsync","(error)");m.nestedError=d,u(m)}}),this.runningCommand=c}_dispatchSubcommand(e,n,r){let o=this._findCommand(e);o||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,o,"preSubcommand"),s=this._chainOrCall(s,()=>{if(o._executableHandler)this._executeSubCommand(o,n.concat(r));else return o._parseCommand(n,r)}),s}_dispatchHelpCommand(e){e||this.help();let n=this._findCommand(e);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,n)=>{e.required&&this.args[n]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(r,o,s)=>{let i=o;if(o!==null&&r.parseArg){let a=`error: command-argument value '${o}' is invalid for argument '${r.name()}'.`;i=this._callParseArg(r,o,s,a)}return i};this._checkNumberOfArguments();let n=[];this.registeredArguments.forEach((r,o)=>{let s=r.defaultValue;r.variadic?o<this.args.length?(s=this.args.slice(o),r.parseArg&&(s=s.reduce((i,a)=>e(r,a,i),r.defaultValue))):s===void 0&&(s=[]):o<this.args.length&&(s=this.args[o],r.parseArg&&(s=e(r,s,r.defaultValue))),n[o]=s}),this.processedArgs=n}_chainOrCall(e,n){return e&&e.then&&typeof e.then=="function"?e.then(()=>n()):n()}_chainOrCallHooks(e,n){let r=e,o=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[n]!==void 0).forEach(s=>{s._lifeCycleHooks[n].forEach(i=>{o.push({hookedCommand:s,callback:i})})}),n==="postAction"&&o.reverse(),o.forEach(s=>{r=this._chainOrCall(r,()=>s.callback(s.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,n,r){let o=e;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(s=>{o=this._chainOrCall(o,()=>s(this,n))}),o}_parseCommand(e,n){let r=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),n=r.unknown,this.args=e.concat(n),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),n);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,e,n);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let i;return i=this._chainOrCallHooks(i,"preAction"),i=this._chainOrCall(i,()=>this._actionHandler(this.processedArgs)),this.parent&&(i=this._chainOrCall(i,()=>{this.parent.emit(s,e,n)})),i=this._chainOrCallHooks(i,"postAction"),i}if(this.parent&&this.parent.listenerCount(s))o(),this._processArguments(),this.parent.emit(s,e,n);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,n);this.listenerCount("command:*")?this.emit("command:*",e,n):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(n=>n._name===e||n._aliases.includes(e))}_findOption(e){return this.options.find(n=>n.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(n=>{n.mandatory&&e.getOptionValue(n.attributeName())===void 0&&e.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(r=>{let o=r.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let o=e.find(s=>r.conflictsWith.includes(s.attributeName()));o&&this._conflictingOption(r,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let n=[],r=[],o=n,s=e.slice();function i(c){return c.length>1&&c[0]==="-"}let a=null;for(;s.length;){let c=s.shift();if(c==="--"){o===r&&o.push(c),o.push(...s);break}if(a&&!i(c)){this.emit(`option:${a.name()}`,c);continue}if(a=null,i(c)){let u=this._findOption(c);if(u){if(u.required){let d=s.shift();d===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,d)}else if(u.optional){let d=null;s.length>0&&!i(s[0])&&(d=s.shift()),this.emit(`option:${u.name()}`,d)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(c.length>2&&c[0]==="-"&&c[1]!=="-"){let u=this._findOption(`-${c[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,c.slice(2)):(this.emit(`option:${u.name()}`),s.unshift(`-${c.slice(2)}`));continue}}if(/^--[^=]+=/.test(c)){let u=c.indexOf("="),d=this._findOption(c.slice(0,u));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,c.slice(u+1));continue}}if(i(c)&&(o=r),(this._enablePositionalOptions||this._passThroughOptions)&&n.length===0&&r.length===0){if(this._findCommand(c)){n.push(c),s.length>0&&r.push(...s);break}else if(this._getHelpCommand()&&c===this._getHelpCommand().name()){n.push(c),s.length>0&&n.push(...s);break}else if(this._defaultCommandName){r.push(c),s.length>0&&r.push(...s);break}}if(this._passThroughOptions){o.push(c),s.length>0&&o.push(...s);break}o.push(c)}return{operands:n,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},n=this.options.length;for(let r=0;r<n;r++){let o=this.options[r].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,n)=>Object.assign(e,n.opts()),{})}error(e,n){this._outputConfiguration.outputError(`${e}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let
|
|
21
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,n){return e===void 0&&n===void 0?this._description:(this._description=e,n&&(this._argsDescription=n),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),e===n._name)throw new Error("Command alias can't be the same as its name");let
|
|
22
|
-
Expecting one of '${
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let n=this._getHelpOption();n&&e.find(
|
|
24
|
-
`);let
|
|
25
|
-
`),r=r.replace(/\\r/g,"\r")),e[s]=r}return e}function ds(t){t=t||{};let e=_n(t);t.path=e;let n=w.configDotenv(t);if(!n.parsed){let a=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw a.code="MISSING_DATA",a}let o=En(t).split(","),s=o.length,r;for(let a=0;a<s;a++)try{let u=o[a].trim(),l=hs(n,u);r=w.decrypt(l.ciphertext,l.key);break}catch(u){if(a+1>=s)throw u}return w.parse(r)}function fs(t){console.log(`[dotenv@${ut}][WARN] ${t}`)}function ie(t){console.log(`[dotenv@${ut}][DEBUG] ${t}`)}function Cn(t){console.log(`[dotenv@${ut}] ${t}`)}function En(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function hs(t,e){let n;try{n=new URL(e)}catch(u){if(u.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw u}let o=n.password;if(!o){let u=new Error("INVALID_DOTENV_KEY: Missing key part");throw u.code="INVALID_DOTENV_KEY",u}let s=n.searchParams.get("environment");if(!s){let u=new Error("INVALID_DOTENV_KEY: Missing environment part");throw u.code="INVALID_DOTENV_KEY",u}let r=`DOTENV_VAULT_${s.toUpperCase()}`,a=t.parsed[r];if(!a){let u=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${r} in your .env.vault file.`);throw u.code="NOT_FOUND_DOTENV_ENVIRONMENT",u}return{ciphertext:a,key:o}}function _n(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let n of t.path)at.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=ve.resolve(process.cwd(),".env.vault");return at.existsSync(e)?e:null}function yn(t){return t[0]==="~"?ve.join(is.homedir(),t.slice(1)):t}function ps(t){let e=!!(t&&t.debug),n=t&&"quiet"in t?t.quiet:!0;(e||!n)&&Cn("Loading env from encrypted .env.vault");let o=w._parseVault(t),s=process.env;return t&&t.processEnv!=null&&(s=t.processEnv),w.populate(s,o,t),{parsed:o}}function ms(t){let e=ve.resolve(process.cwd(),".env"),n="utf8",o=!!(t&&t.debug),s=t&&"quiet"in t?t.quiet:!0;t&&t.encoding?n=t.encoding:o&&ie("No encoding is specified. UTF-8 is used by default");let r=[e];if(t&&t.path)if(!Array.isArray(t.path))r=[yn(t.path)];else{r=[];for(let d of t.path)r.push(yn(d))}let a,u={};for(let d of r)try{let c=w.parse(at.readFileSync(d,{encoding:n}));w.populate(u,c,t)}catch(c){o&&ie(`Failed to load ${d} ${c.message}`),a=c}let l=process.env;if(t&&t.processEnv!=null&&(l=t.processEnv),w.populate(l,u,t),o||!s){let d=Object.keys(u).length,c=[];for(let f of r)try{let h=ve.relative(process.cwd(),f);c.push(h)}catch(h){o&&ie(`Failed to load ${f} ${h.message}`),a=h}Cn(`injecting env (${d}) from ${c.join(",")}`)}return a?{parsed:u,error:a}:{parsed:u}}function Ds(t){if(En(t).length===0)return w.configDotenv(t);let e=_n(t);return e?w._configVault(t):(fs(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),w.configDotenv(t))}function gs(t,e){let n=Buffer.from(e.slice(-64),"hex"),o=Buffer.from(t,"base64"),s=o.subarray(0,12),r=o.subarray(-16);o=o.subarray(12,-16);try{let a=as.createDecipheriv("aes-256-gcm",n,s);return a.setAuthTag(r),`${a.update(o)}${a.final()}`}catch(a){let u=a instanceof RangeError,l=a.message==="Invalid key length",d=a.message==="Unsupported state or unable to authenticate data";if(u||l){let c=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw c.code="INVALID_DOTENV_KEY",c}else if(d){let c=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw c.code="DECRYPTION_FAILED",c}else throw a}}function Fs(t,e,n={}){let o=!!(n&&n.debug),s=!!(n&&n.override);if(typeof e!="object"){let r=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw r.code="OBJECT_REQUIRED",r}for(let r of Object.keys(e))Object.prototype.hasOwnProperty.call(t,r)?(s===!0&&(t[r]=e[r]),o&&ie(s===!0?`"${r}" is already defined and WAS overwritten`:`"${r}" is already defined and was NOT overwritten`)):t[r]=e[r]}var w={configDotenv:ms,_configVault:ps,_parseVault:ds,config:Ds,decrypt:gs,parse:cs,populate:Fs};M.exports.configDotenv=w.configDotenv;M.exports._configVault=w._configVault;M.exports._parseVault=w._parseVault;M.exports.config=w.config;M.exports.decrypt=w.decrypt;M.exports.parse=w.parse;M.exports.populate=w.populate;M.exports=w});var so=x((Ki,Ys)=>{Ys.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Lt=x((Qi,io)=>{"use strict";var Ne=Object.assign({},so()),ro=Object.keys(Ne);Object.defineProperty(Ne,"random",{get(){let t=Math.floor(Math.random()*ro.length),e=ro[t];return Ne[e]}});io.exports=Ne});var ho=x((la,fo)=>{fo.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var go=x((ka,ar)=>{ar.exports={name:"@scheduler-systems/gal-cli",version:"0.1.18",description:"GAL CLI - Command-line tool for managing AI agent configurations across your organization",license:"UNLICENSED",private:!1,publishConfig:{registry:"https://registry.npmjs.org",access:"public"},type:"module",main:"./dist/index.cjs",bin:{gal:"./dist/index.cjs"},files:["dist/index.cjs","scripts/postinstall.cjs","scripts/preuninstall.cjs","README.md","LICENSE"],scripts:{postinstall:"node scripts/postinstall.cjs",preuninstall:"node scripts/preuninstall.cjs",dev:"tsx watch src/index.ts",build:`rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/index.cjs --format=cjs --define:__CLI_VERSION__=\\"$(node -p "require('./package.json').version")-local+$(git rev-parse --short HEAD)\\" --define:__DEFAULT_API_URL__=\\"http://localhost:3000\\" && { printf '%s\\n' '#!/usr/bin/env node'; cat dist/index.cjs; } > dist/temp.cjs && mv dist/temp.cjs dist/index.cjs && chmod +x dist/index.cjs`,"build:publish":`rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --outfile=dist/index.cjs --format=cjs --define:__CLI_VERSION__=\\"$(node -p "require('./package.json').version")\\" --define:__DEFAULT_API_URL__=\\"\${DEFAULT_API_URL:-https://api.gal.run}\\" && { printf '%s\\n' '#!/usr/bin/env node'; cat dist/index.cjs; } > dist/temp.cjs && mv dist/temp.cjs dist/index.cjs && chmod +x dist/index.cjs`,start:"node dist/index.js",test:"vitest run --pool=forks","test:watch":"vitest","test:unit":"vitest run --pool=forks tests/unit/","test:e2e":"vitest run --pool=forks tests/e2e/","test:mutation":"stryker run","test:mutation:incremental":"stryker run --incremental","test:coverage":"vitest run --coverage","type-check":"tsc --noEmit",prepublishOnly:"npm run build:publish",clean:"rm -rf dist"},keywords:["gal","governance","ai","agent","cli","configuration","claude","cursor","windsurf","gemini","codex"],author:"Scheduler Systems",repository:{type:"git",url:"https://github.com/Scheduler-Systems/gal.git",directory:"apps/cli"},bugs:{url:"https://github.com/Scheduler-Systems/gal/issues"},homepage:"https://github.com/Scheduler-Systems/gal#readme",engines:{node:">=18.0.0"},dependencies:{"@anthropic-ai/sdk":"^0.32.1","@e2b/code-interpreter":"^1.0.4","@octokit/rest":"^21.0.2",chalk:"^5.4.1",commander:"^12.1.0",dotenv:"^16.4.7",openai:"^4.77.3",ora:"^8.1.1"},devDependencies:{"@eslint/js":"^9.39.1","@gal/types":"workspace:*","@stryker-mutator/core":"^9.4.0","@stryker-mutator/typescript-checker":"^9.4.0","@stryker-mutator/vitest-runner":"^9.4.0","@types/node":"^22.10.2","@vitest/coverage-v8":"^4.0.16",esbuild:"^0.24.0",eslint:"^9.39.2","eslint-plugin-security":"^3.0.1","eslint-plugin-sonarjs":"^3.0.5","fast-check":"^4.5.3",globals:"^16.5.0","node-pty":"^1.0.0",tsx:"^4.19.2",typescript:"^5.7.2","typescript-eslint":"^8.46.4",vitest:"^4.0.16"}}});var Hr={};Mo(Hr,{DEFAULT_API_URL:()=>ee});module.exports=Ho(Hr);var gn=b(Dn(),1),{program:Xr,createCommand:Zr,createArgument:ei,createOption:ti,CommanderError:ni,InvalidArgumentError:oi,InvalidOptionArgumentError:si,Command:B,Argument:ri,Option:ii,Help:ai}=gn.default;var To=b(vn(),1),Io=b(require("https"),1),V=require("fs"),Xt=require("path"),Bo=require("os");var An=(t=0)=>e=>`\x1B[${e+t}m`,bn=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,wn=(t=0)=>(e,n,o)=>`\x1B[${38+t};2;${e};${n};${o}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},di=Object.keys(C.modifier),ys=Object.keys(C.color),Cs=Object.keys(C.bgColor),fi=[...ys,...Cs];function Es(){let t=new Map;for(let[e,n]of Object.entries(C)){for(let[o,s]of Object.entries(n))C[o]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[o]=C[o],t.set(s[0],s[1]);Object.defineProperty(C,e,{value:n,enumerable:!1})}return Object.defineProperty(C,"codes",{value:t,enumerable:!1}),C.color.close="\x1B[39m",C.bgColor.close="\x1B[49m",C.color.ansi=An(),C.color.ansi256=bn(),C.color.ansi16m=wn(),C.bgColor.ansi=An(10),C.bgColor.ansi256=bn(10),C.bgColor.ansi16m=wn(10),Object.defineProperties(C,{rgbToAnsi256:{value(e,n,o){return e===n&&n===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(e){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!n)return[0,0,0];let[o]=n;o.length===3&&(o=[...o].map(r=>r+r).join(""));let s=Number.parseInt(o,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>C.rgbToAnsi256(...C.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let n,o,s;if(e>=232)n=((e-232)*10+8)/255,o=n,s=n;else{e-=16;let u=e%36;n=Math.floor(e/36)/5,o=Math.floor(u/6)/5,s=u%6/5}let r=Math.max(n,o,s)*2;if(r===0)return 30;let a=30+(Math.round(s)<<2|Math.round(o)<<1|Math.round(n));return r===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,n,o)=>C.ansi256ToAnsi(C.rgbToAnsi256(e,n,o)),enumerable:!1},hexToAnsi:{value:e=>C.ansi256ToAnsi(C.hexToAnsi256(e)),enumerable:!1}}),C}var _s=Es(),P=_s;var be=b(require("node:process"),1),kn=b(require("node:os"),1),lt=b(require("node:tty"),1);function R(t,e=globalThis.Deno?globalThis.Deno.args:be.default.argv){let n=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(n+t),s=e.indexOf("--");return o!==-1&&(s===-1||o<s)}var{env:E}=be.default,Ae;R("no-color")||R("no-colors")||R("color=false")||R("color=never")?Ae=0:(R("color")||R("colors")||R("color=true")||R("color=always"))&&(Ae=1);function vs(){if("FORCE_COLOR"in E)return E.FORCE_COLOR==="true"?1:E.FORCE_COLOR==="false"?0:E.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(E.FORCE_COLOR,10),3)}function As(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function bs(t,{streamIsTTY:e,sniffFlags:n=!0}={}){let o=vs();o!==void 0&&(Ae=o);let s=n?Ae:o;if(s===0)return 0;if(n){if(R("color=16m")||R("color=full")||R("color=truecolor"))return 3;if(R("color=256"))return 2}if("TF_BUILD"in E&&"AGENT_NAME"in E)return 1;if(t&&!e&&s===void 0)return 0;let r=s||0;if(E.TERM==="dumb")return r;if(be.default.platform==="win32"){let a=kn.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in E)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in E)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in E)||E.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in E)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(E.TEAMCITY_VERSION)?1:0;if(E.COLORTERM==="truecolor"||E.TERM==="xterm-kitty"||E.TERM==="xterm-ghostty"||E.TERM==="wezterm")return 3;if("TERM_PROGRAM"in E){let a=Number.parseInt((E.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(E.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(E.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(E.TERM)||"COLORTERM"in E?1:r}function Sn(t,e={}){let n=bs(t,{streamIsTTY:t&&t.isTTY,...e});return As(n)}var ws={stdout:Sn({isTTY:lt.default.isatty(1)}),stderr:Sn({isTTY:lt.default.isatty(2)})},On=ws;function xn(t,e,n){let o=t.indexOf(e);if(o===-1)return t;let s=e.length,r=0,a="";do a+=t.slice(r,o)+e+n,r=o+s,o=t.indexOf(e,r);while(o!==-1);return a+=t.slice(r),a}function Tn(t,e,n,o){let s=0,r="";do{let a=t[o-1]==="\r";r+=t.slice(s,a?o-1:o)+e+(a?`\r
|
|
20
|
+
`),this.outputHelp({error:!0}));let r=n||{},o=r.exitCode||1,s=r.code||"commander.error";this._exit(o,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Ae.env){let n=e.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Ae.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new MF(this.options),n=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&n(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(o=>!n(o)).forEach(o=>{this.setOptionValueWithSource(o,r.implied[o],"implied")})})}missingArgument(e){let n=`error: missing required argument '${e}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(e){let n=`error: option '${e.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let n=`error: required option '${e.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,n){let r=i=>{let a=i.attributeName(),c=this.getOptionValue(a),u=this.options.find(m=>m.negate&&a===m.attributeName()),d=this.options.find(m=>!m.negate&&a===m.attributeName());return u&&(u.presetArg===void 0&&c===!1||u.presetArg!==void 0&&c===u.presetArg)?u:d||i},o=i=>{let a=r(i),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${o(e)} cannot be used with ${o(n)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let n="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],s=this;do{let i=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);o=o.concat(i),s=s.parent}while(s&&!s._enablePositionalOptions);n=Ib(e,o)}let r=`error: unknown option '${e}'${n}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,r=n===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${n} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],n="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(s=>{o.push(s.name()),s.alias()&&o.push(s.alias())}),n=Ib(e,o)}let r=`error: unknown command '${e}'${n}`;this.error(r,{code:"commander.unknownCommand"})}version(e,n,r){if(e===void 0)return this._version;this._version=e,n=n||"-V, --version",r=r||"output the version number";let o=this.createOption(n,r);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,n){return e===void 0&&n===void 0?this._description:(this._description=e,n&&(this._argsDescription=n),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),e===n._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let o=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return n._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(n=>this.alias(n)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(r=>LF(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=xn.basename(e,xn.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let n=this.createHelp();return n.helpWidth===void 0&&(n.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),n.formatHelp(this,n)}_getHelpContext(e){e=e||{};let n={error:!!e.error},r;return n.error?r=o=>this._outputConfiguration.writeErr(o):r=o=>this._outputConfiguration.writeOut(o),n.write=e.write||r,n.command=this,n}outputHelp(e){let n;typeof e=="function"&&(n=e,e=void 0);let r=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let o=this.helpInformation(r);if(n&&(o=n(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",r),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",r))}helpOption(e,n){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",n=n??"display help for command",this._helpOption=this.createOption(e,n),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let n=Ae.exitCode||0;n===0&&e&&typeof e!="function"&&e.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(e,n){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
|
+
Expecting one of '${r.join("', '")}'`);let o=`${e}Help`;return this.on(o,s=>{let i;typeof n=="function"?i=n({error:s.error,command:s.command}):i=n,i&&s.write(`${i}
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let n=this._getHelpOption();n&&e.find(o=>n.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Nb(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let n,r="127.0.0.1",o="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?n=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=s[1],/^\d+$/.test(s[3])?o=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=s[1],r=s[3],o=s[4]),n&&o!=="0"?`${n}=${r}:${parseInt(o)+1}`:e})}xb.Command=df});var Lb=b(Nt=>{var{Argument:Rb}=ec(),{Command:ff}=Pb(),{CommanderError:UF,InvalidArgumentError:jb}=Bs(),{Help:GF}=nf(),{Option:$b}=af();Nt.program=new ff;Nt.createCommand=t=>new ff(t);Nt.createOption=(t,e)=>new $b(t,e);Nt.createArgument=(t,e)=>new Rb(t,e);Nt.Command=ff;Nt.Option=$b;Nt.Argument=Rb;Nt.Help=GF;Nt.CommanderError=UF;Nt.InvalidArgumentError=jb;Nt.InvalidOptionArgumentError=jb});var Mb=b((Y9,VF)=>{VF.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Hb=b((K9,Pn)=>{var mf=require("fs"),tc=require("path"),qF=require("os"),HF=require("crypto"),WF=Mb(),pf=WF.version,JF=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function YF(t){let e={},n=t.toString();n=n.replace(/\r\n?/mg,`
|
|
24
|
+
`);let r;for(;(r=JF.exec(n))!=null;){let o=r[1],s=r[2]||"";s=s.trim();let i=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(s=s.replace(/\\n/g,`
|
|
25
|
+
`),s=s.replace(/\\r/g,"\r")),e[o]=s}return e}function KF(t){t=t||{};let e=qb(t);t.path=e;let n=$e.configDotenv(t);if(!n.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let r=Vb(t).split(","),o=r.length,s;for(let i=0;i<o;i++)try{let a=r[i].trim(),c=ZF(n,a);s=$e.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=o)throw a}return $e.parse(s)}function zF(t){console.log(`[dotenv@${pf}][WARN] ${t}`)}function Ms(t){console.log(`[dotenv@${pf}][DEBUG] ${t}`)}function Gb(t){console.log(`[dotenv@${pf}] ${t}`)}function Vb(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function ZF(t,e){let n;try{n=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let r=n.password;if(!r){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=n.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${o.toUpperCase()}`,i=t.parsed[s];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:r}}function qb(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let n of t.path)mf.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=tc.resolve(process.cwd(),".env.vault");return mf.existsSync(e)?e:null}function Ub(t){return t[0]==="~"?tc.join(qF.homedir(),t.slice(1)):t}function XF(t){let e=!!(t&&t.debug),n=t&&"quiet"in t?t.quiet:!0;(e||!n)&&Gb("Loading env from encrypted .env.vault");let r=$e._parseVault(t),o=process.env;return t&&t.processEnv!=null&&(o=t.processEnv),$e.populate(o,r,t),{parsed:r}}function QF(t){let e=tc.resolve(process.cwd(),".env"),n="utf8",r=!!(t&&t.debug),o=t&&"quiet"in t?t.quiet:!0;t&&t.encoding?n=t.encoding:r&&Ms("No encoding is specified. UTF-8 is used by default");let s=[e];if(t&&t.path)if(!Array.isArray(t.path))s=[Ub(t.path)];else{s=[];for(let u of t.path)s.push(Ub(u))}let i,a={};for(let u of s)try{let d=$e.parse(mf.readFileSync(u,{encoding:n}));$e.populate(a,d,t)}catch(d){r&&Ms(`Failed to load ${u} ${d.message}`),i=d}let c=process.env;if(t&&t.processEnv!=null&&(c=t.processEnv),$e.populate(c,a,t),r||!o){let u=Object.keys(a).length,d=[];for(let m of s)try{let p=tc.relative(process.cwd(),m);d.push(p)}catch(p){r&&Ms(`Failed to load ${m} ${p.message}`),i=p}Gb(`injecting env (${u}) from ${d.join(",")}`)}return i?{parsed:a,error:i}:{parsed:a}}function e1(t){if(Vb(t).length===0)return $e.configDotenv(t);let e=qb(t);return e?$e._configVault(t):(zF(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),$e.configDotenv(t))}function t1(t,e){let n=Buffer.from(e.slice(-64),"hex"),r=Buffer.from(t,"base64"),o=r.subarray(0,12),s=r.subarray(-16);r=r.subarray(12,-16);try{let i=HF.createDecipheriv("aes-256-gcm",n,o);return i.setAuthTag(s),`${i.update(r)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",u=i.message==="Unsupported state or unable to authenticate data";if(a||c){let d=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw d.code="INVALID_DOTENV_KEY",d}else if(u){let d=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw d.code="DECRYPTION_FAILED",d}else throw i}}function n1(t,e,n={}){let r=!!(n&&n.debug),o=!!(n&&n.override);if(typeof e!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(e))Object.prototype.hasOwnProperty.call(t,s)?(o===!0&&(t[s]=e[s]),r&&Ms(o===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):t[s]=e[s]}var $e={configDotenv:QF,_configVault:XF,_parseVault:KF,config:e1,decrypt:t1,parse:YF,populate:n1};Pn.exports.configDotenv=$e.configDotenv;Pn.exports._configVault=$e._configVault;Pn.exports._parseVault=$e._parseVault;Pn.exports.config=$e.config;Pn.exports.decrypt=$e.decrypt;Pn.exports.parse=$e.parse;Pn.exports.populate=$e.populate;Pn.exports=$e});var O0=b((L6,P1)=>{P1.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Bf=b((B6,N0)=>{"use strict";var hc=Object.assign({},O0()),I0=Object.keys(hc);Object.defineProperty(hc,"random",{get(){let t=Math.floor(Math.random()*I0.length),e=I0[t];return hc[e]}});N0.exports=hc});var L0=b((Z6,$0)=>{$0.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var J0=b((NH,tO)=>{tO.exports={name:"@scheduler-systems/gal-cli",version:"0.1.19-beta",description:"GAL CLI - Command-line tool for managing AI agent configurations across your organization",license:"UNLICENSED",private:!1,type:"module",main:"./dist/index.cjs",bin:{gal:"./dist/index.cjs"},files:["dist/index.cjs","scripts/postinstall.cjs","scripts/preuninstall.cjs","README.md","LICENSE"],scripts:{postinstall:"node scripts/postinstall.cjs",preuninstall:"node scripts/preuninstall.cjs",dev:"tsx watch src/index.ts",build:`rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/index.cjs --format=cjs --banner:js='#!/usr/bin/env node' --define:__CLI_VERSION__=\\"$(node -p "require('./package.json').version")-local+$(git rev-parse --short HEAD)\\" --define:__DEFAULT_API_URL__=\\"http://localhost:3000\\" && chmod +x dist/index.cjs`,"build:publish":`rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --outfile=dist/index.cjs --format=cjs --define:__CLI_VERSION__=\\"$(node -p "require('./package.json').version")\\" --define:__DEFAULT_API_URL__=\\"\${DEFAULT_API_URL:-https://api.gal.run}\\" && { printf '%s\\n' '#!/usr/bin/env node'; cat dist/index.cjs; } > dist/temp.cjs && mv dist/temp.cjs dist/index.cjs && chmod +x dist/index.cjs`,start:"node dist/index.js",test:"vitest run --pool=forks","test:watch":"vitest","test:unit":"vitest run --pool=forks tests/unit/","test:e2e":"vitest run --pool=forks tests/e2e/","test:mutation":"stryker run","test:mutation:incremental":"stryker run --incremental","test:coverage":"vitest run --coverage","type-check":"tsc --noEmit",prepublishOnly:"npm run build:publish",clean:"rm -rf dist"},keywords:["gal","governance","ai","agent","cli","configuration","claude","cursor","windsurf","gemini","codex"],author:"Scheduler Systems",repository:{type:"git",url:"https://github.com/Scheduler-Systems/gal.git",directory:"apps/cli"},bugs:{url:"https://github.com/Scheduler-Systems/gal/issues"},homepage:"https://github.com/Scheduler-Systems/gal#readme",engines:{node:">=18.0.0"},dependencies:{"@anthropic-ai/sdk":"^0.32.1","@e2b/code-interpreter":"^1.0.4","@google-cloud/vertexai":"^1.10.0","@octokit/rest":"^21.0.2",chalk:"^5.4.1",commander:"^12.1.0",dotenv:"^16.4.7",openai:"^4.77.3",ora:"^8.1.1",yaml:"^2.8.2",zod:"^3.23.8"},devDependencies:{"@eslint/js":"^9.39.1","@gal/types":"workspace:*","@stryker-mutator/core":"^9.4.0","@stryker-mutator/typescript-checker":"^9.4.0","@stryker-mutator/vitest-runner":"^9.4.0","@types/node":"^22.10.2","@vitest/coverage-v8":"^4.0.16",esbuild:"^0.24.0",eslint:"^9.39.2","eslint-plugin-security":"^3.0.1","eslint-plugin-sonarjs":"^3.0.5","fast-check":"^4.5.3",globals:"^16.5.0","node-pty":"^1.0.0",tsx:"^4.19.2",typescript:"^5.7.2","typescript-eslint":"^8.46.4",vitest:"^4.0.16"}}});var Z0={};kb(Z0,{DANGEROUS_PATTERNS:()=>Mr,findAllDangerousPatterns:()=>Dc,getPatternsByCategory:()=>fO,getPatternsBySeverity:()=>dO,matchDangerousPattern:()=>uO});function uO(t){for(let e of Mr)if(e.pattern.test(t))return e;return null}function Dc(t){return Mr.filter(e=>e.pattern.test(t))}function dO(t){return Mr.filter(e=>e.severity===t)}function fO(t){return Mr.filter(e=>e.category===t)}var Mr,Qs=kF(()=>{"use strict";Mr=[{id:"rm-rf-root",pattern:/rm\s+(-[rfRF]+\s+)*[\/~]\s*$/,description:"Recursive deletion of root or home directory",severity:"critical",category:"command"},{id:"rm-rf-wildcard",pattern:/rm\s+(-[rfRF]+\s+)+\*|rm\s+(-[rfRF]+\s+)+\.\.\/\*\*|rm\s+(-[rfRF]+\s+)+\/\*/,description:"Recursive deletion with dangerous wildcard",severity:"critical",category:"command"},{id:"chmod-777",pattern:/chmod\s+777\s+/,description:"Setting world-readable/writable/executable permissions",severity:"critical",category:"permission"},{id:"chmod-recursive-dangerous",pattern:/chmod\s+-R\s+[0-7]{3}\s+[\/~]/,description:"Recursive chmod on root or home directory",severity:"critical",category:"permission"},{id:"curl-upload",pattern:/curl\s+.*(-d|--data|--data-raw|--upload-file)\s+.*(@|<)/,description:"Uploading file content via curl",severity:"high",category:"network"},{id:"wget-post",pattern:/wget\s+.*--post-(data|file)/,description:"Posting data via wget",severity:"high",category:"network"},{id:"base64-pipe",pattern:/base64\s+.*\|\s*(curl|wget|nc)/,description:"Base64 encoding piped to network command",severity:"high",category:"network"},{id:"env-exposure",pattern:/env\s*[|>]|printenv\s*[|>]|cat\s+.*\.env\s*[|>]/,description:"Environment variable exposure to output",severity:"high",category:"file_access"},{id:"eval-command",pattern:/\beval\s+["\$]/,description:"Dynamic code evaluation",severity:"high",category:"command"},{id:"shell-injection",pattern:/\$\(.*\)|`.*`/,description:"Command substitution (potential injection)",severity:"medium",category:"command"},{id:"ssh-key-access",pattern:/cat\s+.*\.ssh\/(id_rsa|id_ed25519|id_ecdsa)|cp\s+.*\.ssh\//,description:"SSH private key access",severity:"high",category:"file_access"},{id:"aws-credentials",pattern:/cat\s+.*\.aws\/(credentials|config)|cp\s+.*\.aws\//,description:"AWS credentials access",severity:"high",category:"file_access"},{id:"gcp-credentials",pattern:/cat\s+.*\.config\/gcloud|cp\s+.*\.config\/gcloud/,description:"GCP credentials access",severity:"high",category:"file_access"},{id:"netcat-listen",pattern:/nc\s+(-[lvnp]+\s+)+|netcat\s+(-[lvnp]+\s+)+/,description:"Netcat listener (potential reverse shell)",severity:"medium",category:"network"},{id:"reverse-shell",pattern:/bash\s+-i\s+>&?\s*\/dev\/tcp|\/bin\/sh\s+-i\s+/,description:"Reverse shell pattern",severity:"critical",category:"network"},{id:"cron-modification",pattern:/crontab\s+-[er]|echo\s+.*>>\s*\/etc\/cron/,description:"Crontab modification",severity:"medium",category:"command"},{id:"sudoers-modification",pattern:/\/etc\/sudoers|visudo/,description:"Sudoers file modification",severity:"critical",category:"permission"},{id:"passwd-shadow-access",pattern:/cat\s+\/etc\/(passwd|shadow)|cp\s+\/etc\/(passwd|shadow)/,description:"Password/shadow file access",severity:"high",category:"file_access"},{id:"npm-install-global",pattern:/npm\s+i(nstall)?\s+-g\s+[^@]/,description:"Global npm package installation (review package name)",severity:"low",category:"command"},{id:"pip-install-dangerous",pattern:/pip\s+install\s+--user\s+/,description:"User pip installation (may modify local packages)",severity:"low",category:"command"},{id:"history-access",pattern:/cat\s+.*\.(bash_history|zsh_history)|history\s*>/,description:"Shell history access",severity:"low",category:"file_access"}]});var fm=b((t4,Bv)=>{"use strict";var lm=Object.defineProperty,yI=Object.getOwnPropertyDescriptor,bI=Object.getOwnPropertyNames,vI=Object.prototype.hasOwnProperty,SI=(t,e)=>{for(var n in e)lm(t,n,{get:e[n],enumerable:!0})},_I=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of bI(e))!vI.call(t,o)&&o!==n&&lm(t,o,{get:()=>e[o],enumerable:!(r=yI(e,o))||r.enumerable});return t},wI=t=>_I(lm({},"__esModule",{value:!0}),t),Rv={};SI(Rv,{createFinalURL:()=>Lv,createQuerySerializer:()=>am,default:()=>kI,defaultBodySerializer:()=>$v,defaultPathSerializer:()=>jv,mergeHeaders:()=>cm,serializeArrayParam:()=>dm,serializeObjectParam:()=>um,serializePrimitiveParam:()=>ai});Bv.exports=wI(Rv);var EI={"Content-Type":"application/json"},DI=/\{[^{}]+\}/g,CI=class extends Request{constructor(t,e){super(t,e);for(let n in e)n in this||(this[n]=e[n])}};function kI(t){let{baseUrl:e="",fetch:n=globalThis.fetch,querySerializer:r,bodySerializer:o,headers:s,...i}={...t};e.endsWith("/")&&(e=e.substring(0,e.length-1)),s=cm(EI,s);let a=[];async function c(u,d){let{fetch:m=n,headers:p,params:f={},parseAs:g="json",querySerializer:h,bodySerializer:y=o??$v,..._}=d||{},E=typeof r=="function"?r:am(r);h&&(E=typeof h=="function"?h:am({...typeof r=="object"?r:{},...h}));let D={redirect:"follow",...i,..._,headers:cm(s,p,f.header)};D.body&&(D.body=y(D.body)),D.body instanceof FormData&&D.headers.delete("Content-Type");let T=new CI(Lv(u,{baseUrl:e,params:f,querySerializer:E}),D),I={baseUrl:e,fetch:m,parseAs:g,querySerializer:E,bodySerializer:y};for(let v of a)if(v&&typeof v=="object"&&typeof v.onRequest=="function"){T.schemaPath=u,T.params=f;let P=await v.onRequest(T,I);if(P){if(!(P instanceof Request))throw new Error("Middleware must return new Request() when modifying the request");T=P}}let k=await m(T);for(let v=a.length-1;v>=0;v--){let P=a[v];if(P&&typeof P=="object"&&typeof P.onResponse=="function"){T.schemaPath=u,T.params=f;let U=await P.onResponse(k,I,T);if(U){if(!(U instanceof Response))throw new Error("Middleware must return new Response() when modifying the response");k=U}}}if(k.status===204||k.headers.get("Content-Length")==="0")return k.ok?{data:{},response:k}:{error:{},response:k};if(k.ok)return g==="stream"?{data:k.body,response:k}:{data:await k[g](),response:k};let O=await k.text();try{O=JSON.parse(O)}catch{}return{error:O,response:k}}return{async GET(u,d){return c(u,{...d,method:"GET"})},async PUT(u,d){return c(u,{...d,method:"PUT"})},async POST(u,d){return c(u,{...d,method:"POST"})},async DELETE(u,d){return c(u,{...d,method:"DELETE"})},async OPTIONS(u,d){return c(u,{...d,method:"OPTIONS"})},async HEAD(u,d){return c(u,{...d,method:"HEAD"})},async PATCH(u,d){return c(u,{...d,method:"PATCH"})},async TRACE(u,d){return c(u,{...d,method:"TRACE"})},use(...u){for(let d of u)if(d){if(typeof d!="object"||!("onRequest"in d||"onResponse"in d))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");a.push(d)}},eject(...u){for(let d of u){let m=a.indexOf(d);m!==-1&&a.splice(m,1)}}}}function ai(t,e,n){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${n?.allowReserved===!0?e:encodeURIComponent(e)}`}function um(t,e,n){if(!e||typeof e!="object")return"";let r=[],o={simple:",",label:".",matrix:";"}[n.style]||"&";if(n.style!=="deepObject"&&n.explode===!1){for(let a in e)r.push(a,n.allowReserved===!0?e[a]:encodeURIComponent(e[a]));let i=r.join(",");switch(n.style){case"form":return`${t}=${i}`;case"label":return`.${i}`;case"matrix":return`;${t}=${i}`;default:return i}}for(let i in e){let a=n.style==="deepObject"?`${t}[${i}]`:i;r.push(ai(a,e[i],n))}let s=r.join(o);return n.style==="label"||n.style==="matrix"?`${o}${s}`:s}function dm(t,e,n){if(!Array.isArray(e))return"";if(n.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[n.style]||",",i=(n.allowReserved===!0?e:e.map(a=>encodeURIComponent(a))).join(s);switch(n.style){case"simple":return i;case"label":return`.${i}`;case"matrix":return`;${t}=${i}`;default:return`${t}=${i}`}}let r={simple:",",label:".",matrix:";"}[n.style]||"&",o=[];for(let s of e)n.style==="simple"||n.style==="label"?o.push(n.allowReserved===!0?s:encodeURIComponent(s)):o.push(ai(t,s,n));return n.style==="label"||n.style==="matrix"?`${r}${o.join(r)}`:o.join(r)}function am(t){return function(n){let r=[];if(n&&typeof n=="object")for(let o in n){let s=n[o];if(s!=null){if(Array.isArray(s)){r.push(dm(o,s,{style:"form",explode:!0,...t?.array,allowReserved:t?.allowReserved||!1}));continue}if(typeof s=="object"){r.push(um(o,s,{style:"deepObject",explode:!0,...t?.object,allowReserved:t?.allowReserved||!1}));continue}r.push(ai(o,s,t))}}return r.join("&")}}function jv(t,e){let n=t;for(let r of t.match(DI)??[]){let o=r.substring(1,r.length-1),s=!1,i="simple";if(o.endsWith("*")&&(s=!0,o=o.substring(0,o.length-1)),o.startsWith(".")?(i="label",o=o.substring(1)):o.startsWith(";")&&(i="matrix",o=o.substring(1)),!e||e[o]===void 0||e[o]===null)continue;let a=e[o];if(Array.isArray(a)){n=n.replace(r,dm(o,a,{style:i,explode:s}));continue}if(typeof a=="object"){n=n.replace(r,um(o,a,{style:i,explode:s}));continue}if(i==="matrix"){n=n.replace(r,`;${ai(o,a)}`);continue}n=n.replace(r,i==="label"?`.${a}`:a)}return n}function $v(t){return JSON.stringify(t)}function Lv(t,e){let n=`${e.baseUrl}${t}`;e.params?.path&&(n=jv(n,e.params.path));let r=e.querySerializer(e.params.query??{});return r.startsWith("?")&&(r=r.substring(1)),r&&(n+=`?${r}`),n}function cm(...t){let e=new Headers;for(let n of t){if(!n||typeof n!="object")continue;let r=n instanceof Headers?n.entries():Object.entries(n);for(let[o,s]of r)if(s===null)e.delete(o);else if(Array.isArray(s))for(let i of s)e.append(o,i);else s!==void 0&&e.set(o,s)}return e}});var Mv=b((jc,ci)=>{(function(){"use strict";var t={function:!0,object:!0},e=t[typeof window]&&window||this,n=e,r=t[typeof jc]&&jc,o=t[typeof ci]&&ci&&!ci.nodeType&&ci,s=r&&o&&typeof global=="object"&&global;s&&(s.global===s||s.window===s||s.self===s)&&(e=s);var i=Math.pow(2,53)-1,a=/\bOpera/,c=this,u=Object.prototype,d=u.hasOwnProperty,m=u.toString;function p(v){return v=String(v),v.charAt(0).toUpperCase()+v.slice(1)}function f(v,P,U){var de={"10.0":"10","6.4":"10 Technical Preview","6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return P&&U&&/^Win/i.test(v)&&!/^Windows Phone /i.test(v)&&(de=de[/[\d.]+$/.exec(v)])&&(v="Windows "+de),v=String(v),P&&U&&(v=v.replace(RegExp(P,"i"),U)),v=h(v.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0]),v}function g(v,P){var U=-1,de=v?v.length:0;if(typeof de=="number"&&de>-1&&de<=i)for(;++U<de;)P(v[U],U,v);else y(v,P)}function h(v){return v=I(v),/^(?:webOS|i(?:OS|P))/.test(v)?v:p(v)}function y(v,P){for(var U in v)d.call(v,U)&&P(v[U],U,v)}function _(v){return v==null?p(v):m.call(v).slice(8,-1)}function E(v,P){var U=v!=null?typeof v[P]:"number";return!/^(?:boolean|number|string|undefined)$/.test(U)&&(U=="object"?!!v[P]:!0)}function D(v){return String(v).replace(/([ -])(?!$)/g,"$1?")}function T(v,P){var U=null;return g(v,function(de,fe){U=P(U,de,fe,v)}),U}function I(v){return String(v).replace(/^ +| +$/g,"")}function k(v){var P=e,U=v&&typeof v=="object"&&_(v)!="String";U&&(P=v,v=null);var de=P.navigator||{},fe=de.userAgent||"";v||(v=fe);var nr=U||c==n,Ka=U?!!de.likeChrome:/\bChrome\b/.test(v)&&!/internal|\n/i.test(m.toString()),rr="Object",Nn=U?rr:"ScriptBridgingProxyObject",Jd=U?rr:"Environment",dF=U&&P.java?"JavaPackage":_(P.java),fF=U?rr:"RuntimeObject",Ls=/\bJava/.test(dF)&&P.java,mF=Ls&&_(P.environment)==Jd,pF=Ls?"a":"\u03B1",gF=Ls?"b":"\u03B2",Yd=P.document||{},or=P.operamini||P.opera,za=a.test(za=U&&or?or["[[Class]]"]:_(or))?za:or=null,w,Za=v,Z=[],Xa=null,sr=v==fe,L=sr&&or&&typeof or.version=="function"&&or.version(),Kd,se=hF([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),R=bF(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),J=Db([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),We=yF({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),j=vF(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function hF(ot){return T(ot,function(ve,ie){return ve||RegExp("\\b"+(ie.pattern||D(ie))+"\\b","i").exec(v)&&(ie.label||ie)})}function yF(ot){return T(ot,function(ve,ie,qt){return ve||(ie[J]||ie[/^[a-z]+(?: +[a-z]+\b)*/i.exec(J)]||RegExp("\\b"+D(qt)+"(?:\\b|\\w*\\d)","i").exec(v))&&qt})}function bF(ot){return T(ot,function(ve,ie){return ve||RegExp("\\b"+(ie.pattern||D(ie))+"\\b","i").exec(v)&&(ie.label||ie)})}function vF(ot){return T(ot,function(ve,ie){var qt=ie.pattern||D(ie);return!ve&&(ve=RegExp("\\b"+qt+"(?:/[\\d.]+|[ \\w.]*)","i").exec(v))&&(ve=f(ve,qt,ie.label||ie)),ve})}function Db(ot){return T(ot,function(ve,ie){var qt=ie.pattern||D(ie);return!ve&&(ve=RegExp("\\b"+qt+" *\\d+[.\\w_]*","i").exec(v)||RegExp("\\b"+qt+" *\\w+-[\\w]*","i").exec(v)||RegExp("\\b"+qt+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(v))&&((ve=String(ie.label&&!RegExp(qt,"i").test(ie.label)?ie.label:ve).split("/"))[1]&&!/[\d.]+/.test(ve[0])&&(ve[0]+=" "+ve[1]),ie=ie.label||ie,ve=h(ve[0].replace(RegExp(qt,"i"),ie).replace(RegExp("; *(?:"+ie+"[_-])?","i")," ").replace(RegExp("("+ie+")[-_.]?(\\w)","i"),"$1 $2"))),ve})}function Cb(ot){return T(ot,function(ve,ie){return ve||(RegExp(ie+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(v)||0)[1]||null})}function SF(){return this.description||""}if(se&&(se=[se]),/\bAndroid\b/.test(j)&&!J&&(w=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(v))&&(J=I(w[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),We&&!J?J=Db([We]):We&&J&&(J=J.replace(RegExp("^("+D(We)+")[-_.\\s]","i"),We+" ").replace(RegExp("^("+D(We)+")[-_.]?(\\w)","i"),We+" $2")),(w=/\bGoogle TV\b/.exec(J))&&(J=w[0]),/\bSimulator\b/i.test(v)&&(J=(J?J+" ":"")+"Simulator"),R=="Opera Mini"&&/\bOPiOS\b/.test(v)&&Z.push("running in Turbo/Uncompressed mode"),R=="IE"&&/\blike iPhone OS\b/.test(v)?(w=k(v.replace(/like iPhone OS/,"")),We=w.manufacturer,J=w.product):/^iP/.test(J)?(R||(R="Safari"),j="iOS"+((w=/ OS ([\d_]+)/i.exec(v))?" "+w[1].replace(/_/g,"."):"")):R=="Konqueror"&&/^Linux\b/i.test(j)?j="Kubuntu":We&&We!="Google"&&(/Chrome/.test(R)&&!/\bMobile Safari\b/i.test(v)||/\bVita\b/.test(J))||/\bAndroid\b/.test(j)&&/^Chrome/.test(R)&&/\bVersion\//i.test(v)?(R="Android Browser",j=/\bAndroid\b/.test(j)?j:"Android"):R=="Silk"?(/\bMobi/i.test(v)||(j="Android",Z.unshift("desktop mode")),/Accelerated *= *true/i.test(v)&&Z.unshift("accelerated")):R=="UC Browser"&&/\bUCWEB\b/.test(v)?Z.push("speed mode"):R=="PaleMoon"&&(w=/\bFirefox\/([\d.]+)\b/.exec(v))?Z.push("identifying as Firefox "+w[1]):R=="Firefox"&&(w=/\b(Mobile|Tablet|TV)\b/i.exec(v))?(j||(j="Firefox OS"),J||(J=w[1])):!R||(w=!/\bMinefield\b/i.test(v)&&/\b(?:Firefox|Safari)\b/.exec(R))?(R&&!J&&/[\/,]|^[^(]+?\)/.test(v.slice(v.indexOf(w+"/")+8))&&(R=null),(w=J||We||j)&&(J||We||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(j))&&(R=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(j)?j:w)+" Browser")):R=="Electron"&&(w=(/\bChrome\/([\d.]+)\b/.exec(v)||0)[1])&&Z.push("Chromium "+w),L||(L=Cb(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",D(R),"(?:Firefox|Minefield|NetFront)"])),(w=se=="iCab"&&parseFloat(L)>3&&"WebKit"||/\bOpera\b/.test(R)&&(/\bOPR\b/.test(v)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(v)&&!/^(?:Trident|EdgeHTML)$/.test(se)&&"WebKit"||!se&&/\bMSIE\b/i.test(v)&&(j=="Mac OS"?"Tasman":"Trident")||se=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(R)&&"NetFront")&&(se=[w]),R=="IE"&&(w=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(v)||0)[1])?(R+=" Mobile",j="Windows Phone "+(/\+$/.test(w)?w:w+".x"),Z.unshift("desktop mode")):/\bWPDesktop\b/i.test(v)?(R="IE Mobile",j="Windows Phone 8.x",Z.unshift("desktop mode"),L||(L=(/\brv:([\d.]+)/.exec(v)||0)[1])):R!="IE"&&se=="Trident"&&(w=/\brv:([\d.]+)/.exec(v))&&(R&&Z.push("identifying as "+R+(L?" "+L:"")),R="IE",L=w[1]),sr){if(E(P,"global"))if(Ls&&(w=Ls.lang.System,Za=w.getProperty("os.arch"),j=j||w.getProperty("os.name")+" "+w.getProperty("os.version")),mF){try{L=P.require("ringo/engine").version.join("."),R="RingoJS"}catch{(w=P.system)&&w.global.system==P.system&&(R="Narwhal",j||(j=w[0].os||null))}R||(R="Rhino")}else typeof P.process=="object"&&!P.process.browser&&(w=P.process)&&(typeof w.versions=="object"&&(typeof w.versions.electron=="string"?(Z.push("Node "+w.versions.node),R="Electron",L=w.versions.electron):typeof w.versions.nw=="string"&&(Z.push("Chromium "+L,"Node "+w.versions.node),R="NW.js",L=w.versions.nw)),R||(R="Node.js",Za=w.arch,j=w.platform,L=/[\d.]+/.exec(w.version),L=L?L[0]:null));else _(w=P.runtime)==Nn?(R="Adobe AIR",j=w.flash.system.Capabilities.os):_(w=P.phantom)==fF?(R="PhantomJS",L=(w=w.version||null)&&w.major+"."+w.minor+"."+w.patch):typeof Yd.documentMode=="number"&&(w=/\bTrident\/(\d+)/i.exec(v))?(L=[L,Yd.documentMode],(w=+w[1]+4)!=L[1]&&(Z.push("IE "+L[1]+" mode"),se&&(se[1]=""),L[1]=w),L=R=="IE"?String(L[1].toFixed(1)):L[0]):typeof Yd.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(R)&&(Z.push("masking as "+R+" "+L),R="IE",L="11.0",se=["Trident"],j="Windows");j=j&&h(j)}if(L&&(w=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(L)||/(?:alpha|beta)(?: ?\d)?/i.exec(v+";"+(sr&&de.appMinorVersion))||/\bMinefield\b/i.test(v)&&"a")&&(Xa=/b/i.test(w)?"beta":"alpha",L=L.replace(RegExp(w+"\\+?$"),"")+(Xa=="beta"?gF:pF)+(/\d+\+?/.exec(w)||"")),R=="Fennec"||R=="Firefox"&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(j))R="Firefox Mobile";else if(R=="Maxthon"&&L)L=L.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(J))J=="Xbox 360"&&(j=null),J=="Xbox 360"&&/\bIEMobile\b/.test(v)&&Z.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(R)||R&&!J&&!/Browser|Mobi/.test(R))&&(j=="Windows CE"||/Mobi/i.test(v)))R+=" Mobile";else if(R=="IE"&&sr)try{P.external===null&&Z.unshift("platform preview")}catch{Z.unshift("embedded")}else(/\bBlackBerry\b/.test(J)||/\bBB10\b/.test(v))&&(w=(RegExp(J.replace(/ +/g," *")+"/([.\\d]+)","i").exec(v)||0)[1]||L)?(w=[w,/BB10/.test(v)],j=(w[1]?(J=null,We="BlackBerry"):"Device Software")+" "+w[0],L=null):this!=y&&J!="Wii"&&(sr&&or||/Opera/.test(R)&&/\b(?:MSIE|Firefox)\b/i.test(v)||R=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(j)||R=="IE"&&(j&&!/^Win/.test(j)&&L>5.5||/\bWindows XP\b/.test(j)&&L>8||L==8&&!/\bTrident\b/.test(v)))&&!a.test(w=k.call(y,v.replace(a,"")+";"))&&w.name&&(w="ing as "+w.name+((w=w.version)?" "+w:""),a.test(R)?(/\bIE\b/.test(w)&&j=="Mac OS"&&(j=null),w="identify"+w):(w="mask"+w,za?R=h(za.replace(/([a-z])([A-Z])/g,"$1 $2")):R="Opera",/\bIE\b/.test(w)&&(j=null),sr||(L=null)),se=["Presto"],Z.push(w));(w=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(v)||0)[1])&&(w=[parseFloat(w.replace(/\.(\d)$/,".0$1")),w],R=="Safari"&&w[1].slice(-1)=="+"?(R="WebKit Nightly",Xa="alpha",L=w[1].slice(0,-1)):(L==w[1]||L==(w[2]=(/\bSafari\/([\d.]+\+?)/i.exec(v)||0)[1]))&&(L=null),w[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(v)||0)[1],w[0]==537.36&&w[2]==537.36&&parseFloat(w[1])>=28&&se=="WebKit"&&(se=["Blink"]),!sr||!Ka&&!w[1]?(se&&(se[1]="like Safari"),w=(w=w[0],w<400?1:w<500?2:w<526?3:w<533?4:w<534?"4+":w<535?5:w<537?6:w<538?7:w<601?8:w<602?9:w<604?10:w<606?11:w<608?12:"12")):(se&&(se[1]="like Chrome"),w=w[1]||(w=w[0],w<530?1:w<532?2:w<532.05?3:w<533?4:w<534.03?5:w<534.07?6:w<534.1?7:w<534.13?8:w<534.16?9:w<534.24?10:w<534.3?11:w<535.01?12:w<535.02?"13+":w<535.07?15:w<535.11?16:w<535.19?17:w<536.05?18:w<536.1?19:w<537.01?20:w<537.11?"21+":w<537.13?23:w<537.18?24:w<537.24?25:w<537.36?26:se!="Blink"?"27":"28")),se&&(se[1]+=" "+(w+=typeof w=="number"?".x":/[.+]/.test(w)?"":"+")),R=="Safari"&&(!L||parseInt(L)>45)?L=w:R=="Chrome"&&/\bHeadlessChrome/i.test(v)&&Z.unshift("headless")),R=="Opera"&&(w=/\bzbov|zvav$/.exec(j))?(R+=" ",Z.unshift("desktop mode"),w=="zvav"?(R+="Mini",L=null):R+="Mobile",j=j.replace(RegExp(" *"+w+"$"),"")):R=="Safari"&&/\bChrome\b/.exec(se&&se[1])?(Z.unshift("desktop mode"),R="Chrome Mobile",L=null,/\bOS X\b/.test(j)?(We="Apple",j="iOS 4.3+"):j=null):/\bSRWare Iron\b/.test(R)&&!L&&(L=Cb("Chrome")),L&&L.indexOf(w=/[\d.]+$/.exec(j))==0&&v.indexOf("/"+w+"-")>-1&&(j=I(j.replace(w,""))),j&&j.indexOf(R)!=-1&&!RegExp(R+" OS").test(j)&&(j=j.replace(RegExp(" *"+D(R)+" *"),"")),se&&!/\b(?:Avant|Nook)\b/.test(R)&&(/Browser|Lunascape|Maxthon/.test(R)||R!="Safari"&&/^iOS/.test(j)&&/\bSafari\b/.test(se[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(R)&&se[1])&&(w=se[se.length-1])&&Z.push(w),Z.length&&(Z=["("+Z.join("; ")+")"]),We&&J&&J.indexOf(We)<0&&Z.push("on "+We),J&&Z.push((/^on /.test(Z[Z.length-1])?"":"on ")+J),j&&(w=/ ([\d.+]+)$/.exec(j),Kd=w&&j.charAt(j.length-w[0].length-1)=="/",j={architecture:32,family:w&&!Kd?j.replace(w[0],""):j,version:w?w[1]:null,toString:function(){var ot=this.version;return this.family+(ot&&!Kd?" "+ot:"")+(this.architecture==64?" 64-bit":"")}}),(w=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(Za))&&!/\bi686\b/i.test(Za)?(j&&(j.architecture=64,j.family=j.family.replace(RegExp(" *"+w),"")),R&&(/\bWOW64\b/i.test(v)||sr&&/\w(?:86|32)$/.test(de.cpuClass||de.platform)&&!/\bWin64; x64\b/i.test(v))&&Z.unshift("32-bit")):j&&/^OS X/.test(j.family)&&R=="Chrome"&&parseFloat(L)>=39&&(j.architecture=64),v||(v=null);var lt={};return lt.description=v,lt.layout=se&&se[0],lt.manufacturer=We,lt.name=R,lt.prerelease=Xa,lt.product=J,lt.ua=v,lt.version=R&&L,lt.os=j||{architecture:null,family:null,version:null,toString:function(){return"null"}},lt.parse=k,lt.toString=SF,lt.version&&Z.unshift(L),lt.name&&Z.unshift(R),j&&R&&!(j==String(j).split(" ")[0]&&(j==R.split(" ")[0]||J))&&Z.push(J?"("+j+")":"on "+j),Z.length&&(lt.description=Z.join(" ")),lt}var O=k();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e.platform=O,define(function(){return O})):r&&o?y(O,function(v,P){r[P]=v}):e.platform=O}).call(jc)});var Y=b($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.Code=void 0;var Uv;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(Uv||($c.Code=Uv={}))});var Vv=b(Gv=>{"use strict";Object.defineProperty(Gv,"__esModule",{value:!0})});var Lc=b(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.isMessage=AI;function AI(t,e){return t!==null&&typeof t=="object"&&"$typeName"in t&&typeof t.$typeName=="string"?e===void 0?!0:e.typeName===t.$typeName:!1}});var ut=b(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.ScalarType=void 0;var qv;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(qv||(Bc.ScalarType=qv={}))});var Uc=b(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.varint64read=TI;Ln.varint64write=FI;Ln.int64FromString=OI;Ln.int64ToString=II;Ln.uInt64ToString=Wv;Ln.varint32write=xI;Ln.varint32read=PI;function TI(){let t=0,e=0;for(let r=0;r<28;r+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<r,!(o&128))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<r,!(o&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function FI(t,e,n){for(let s=0;s<28;s=s+7){let i=t>>>s,a=!(!(i>>>7)&&e==0),c=(a?i|128:i)&255;if(n.push(c),!a)return}let r=t>>>28&15|(e&7)<<4,o=!!(e>>3);if(n.push((o?r|128:r)&255),!!o){for(let s=3;s<31;s=s+7){let i=e>>>s,a=!!(i>>>7),c=(a?i|128:i)&255;if(n.push(c),!a)return}n.push(e>>>31&1)}}var Mc=4294967296;function OI(t){let e=t[0]==="-";e&&(t=t.slice(1));let n=1e6,r=0,o=0;function s(i,a){let c=Number(t.slice(i,a));o*=n,r=r*n+c,r>=Mc&&(o=o+(r/Mc|0),r=r%Mc)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?Jv(r,o):pm(r,o)}function II(t,e){let n=pm(t,e),r=n.hi&2147483648;r&&(n=Jv(n.lo,n.hi));let o=Wv(n.lo,n.hi);return r?"-"+o:o}function Wv(t,e){if({lo:t,hi:e}=NI(t,e),e<=2097151)return String(Mc*e+t);let n=t&16777215,r=(t>>>24|e<<8)&16777215,o=e>>16&65535,s=n+r*6777216+o*6710656,i=r+o*8147497,a=o*2,c=1e7;return s>=c&&(i+=Math.floor(s/c),s%=c),i>=c&&(a+=Math.floor(i/c),i%=c),a.toString()+Hv(i)+Hv(s)}function NI(t,e){return{lo:t>>>0,hi:e>>>0}}function pm(t,e){return{lo:t|0,hi:e|0}}function Jv(t,e){return e=~e,t?t=~t+1:e+=1,pm(t,e)}var Hv=t=>{let e=String(t);return"0000000".slice(e.length)+e};function xI(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function PI(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}});var pn=b(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.protoInt64=void 0;var Gc=Uc();Vc.protoInt64=RI();function RI(){let t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(!!globalThis.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let n=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),o=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let a=typeof i=="bigint"?i:BigInt(i);if(a>r||a<n)throw new Error(`invalid int64: ${i}`);return a},uParse(i){let a=typeof i=="bigint"?i:BigInt(i);if(a>s||a<o)throw new Error(`invalid uint64: ${i}`);return a},enc(i){return t.setBigInt64(0,this.parse(i),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(i){return t.setBigInt64(0,this.uParse(i),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(i,a){return t.setInt32(0,i,!0),t.setInt32(4,a,!0),t.getBigInt64(0,!0)},uDec(i,a){return t.setInt32(0,i,!0),t.setInt32(4,a,!0),t.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(n){return typeof n!="string"&&(n=n.toString()),Yv(n),n},uParse(n){return typeof n!="string"&&(n=n.toString()),Kv(n),n},enc(n){return typeof n!="string"&&(n=n.toString()),Yv(n),(0,Gc.int64FromString)(n)},uEnc(n){return typeof n!="string"&&(n=n.toString()),Kv(n),(0,Gc.int64FromString)(n)},dec(n,r){return(0,Gc.int64ToString)(n,r)},uDec(n,r){return(0,Gc.uInt64ToString)(n,r)}}}function Yv(t){if(!/^-?[0-9]+$/.test(t))throw new Error("invalid int64: "+t)}function Kv(t){if(!/^[0-9]+$/.test(t))throw new Error("invalid uint64: "+t)}});var lr=b(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.scalarEquals=$I;li.scalarZeroValue=LI;li.isScalarZeroValue=BI;var jI=pn(),Be=ut();function $I(t,e,n){if(e===n)return!0;if(t==Be.ScalarType.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}switch(t){case Be.ScalarType.UINT64:case Be.ScalarType.FIXED64:case Be.ScalarType.INT64:case Be.ScalarType.SFIXED64:case Be.ScalarType.SINT64:return e==n}return!1}function LI(t,e){switch(t){case Be.ScalarType.STRING:return"";case Be.ScalarType.BOOL:return!1;case Be.ScalarType.DOUBLE:case Be.ScalarType.FLOAT:return 0;case Be.ScalarType.INT64:case Be.ScalarType.UINT64:case Be.ScalarType.SFIXED64:case Be.ScalarType.FIXED64:case Be.ScalarType.SINT64:return e?"0":jI.protoInt64.zero;case Be.ScalarType.BYTES:return new Uint8Array(0);default:return 0}}function BI(t,e){switch(t){case Be.ScalarType.BOOL:return e===!1;case Be.ScalarType.STRING:return e==="";case Be.ScalarType.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}});var Jr=b(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.unsafeLocal=void 0;gn.unsafeOneofCase=MI;gn.unsafeIsSet=UI;gn.unsafeIsSetExplicit=GI;gn.unsafeGet=VI;gn.unsafeSet=qI;gn.unsafeClear=HI;var zv=lr(),Zv=2;gn.unsafeLocal=Symbol.for("reflect unsafe local");function MI(t,e){let n=t[e.localName].case;return n===void 0?n:e.fields.find(r=>r.localName===n)}function UI(t,e){let n=e.localName;if(e.oneof)return t[e.oneof.localName].case===n;if(e.presence!=Zv)return t[n]!==void 0&&Object.prototype.hasOwnProperty.call(t,n);switch(e.fieldKind){case"list":return t[n].length>0;case"map":return Object.keys(t[n]).length>0;case"scalar":return!(0,zv.isScalarZeroValue)(e.scalar,t[n]);case"enum":return t[n]!==e.enum.values[0].number}throw new Error("message field with implicit presence")}function GI(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==void 0}function VI(t,e){if(e.oneof){let n=t[e.oneof.localName];return n.case===e.localName?n.value:void 0}return t[e.localName]}function qI(t,e,n){e.oneof?t[e.oneof.localName]={case:e.localName,value:n}:t[e.localName]=n}function HI(t,e){let n=e.localName;if(e.oneof){let r=e.oneof.localName;t[r].case===n&&(t[r]={case:void 0})}else if(e.presence!=Zv)delete t[n];else switch(e.fieldKind){case"map":t[n]={};break;case"list":t[n]=[];break;case"enum":t[n]=e.enum.values[0].number;break;case"scalar":t[n]=(0,zv.scalarZeroValue)(e.scalar,e.longAsString);break}}});var di=b(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.isObject=ui;Yr.isOneofADT=WI;Yr.isReflectList=JI;Yr.isReflectMap=YI;Yr.isReflectMessage=KI;var gm=Jr();function ui(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function WI(t){return t!==null&&typeof t=="object"&&"case"in t&&(typeof t.case=="string"&&"value"in t&&t.value!=null||t.case===void 0&&(!("value"in t)||t.value===void 0))}function JI(t,e){var n,r,o,s;if(ui(t)&&gm.unsafeLocal in t&&"add"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let i=e,a=t.field();return i.listKind==a.listKind&&i.scalar===a.scalar&&((n=i.message)===null||n===void 0?void 0:n.typeName)===((r=a.message)===null||r===void 0?void 0:r.typeName)&&((o=i.enum)===null||o===void 0?void 0:o.typeName)===((s=a.enum)===null||s===void 0?void 0:s.typeName)}return!0}return!1}function YI(t,e){var n,r,o,s;if(ui(t)&&gm.unsafeLocal in t&&"has"in t&&"field"in t&&typeof t.field=="function"){if(e!==void 0){let i=e,a=t.field();return i.mapKey===a.mapKey&&i.mapKind==a.mapKind&&i.scalar===a.scalar&&((n=i.message)===null||n===void 0?void 0:n.typeName)===((r=a.message)===null||r===void 0?void 0:r.typeName)&&((o=i.enum)===null||o===void 0?void 0:o.typeName)===((s=a.enum)===null||s===void 0?void 0:s.typeName)}return!0}return!1}function KI(t,e){return ui(t)&&gm.unsafeLocal in t&&"desc"in t&&ui(t.desc)&&t.desc.kind==="message"&&(e===void 0||t.desc.typeName==e.typeName)}});var Wo=b(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.isWrapper=zI;qc.isWrapperDesc=ZI;function zI(t){return Xv(t.$typeName)}function ZI(t){let e=t.fields[0];return Xv(t.typeName)&&e!==void 0&&e.fieldKind=="scalar"&&e.name=="value"&&e.number==1}function Xv(t){return t.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(t.substring(16))}});var ur=b(_m=>{"use strict";Object.defineProperty(_m,"__esModule",{value:!0});_m.create=rS;var tS=Lc(),bm=ut(),XI=lr(),nS=di(),hm=Jr(),QI=Wo(),eN=999,tN=998,Hc=2;function rS(t,e){if((0,tS.isMessage)(e,t))return e;let n=iN(t);return e!==void 0&&nN(t,n,e),n}function nN(t,e,n){for(let r of t.members){let o=n[r.localName];if(o==null)continue;let s;if(r.kind=="oneof"){let i=(0,hm.unsafeOneofCase)(n,r);if(!i)continue;s=i,o=(0,hm.unsafeGet)(n,i)}else s=r;switch(s.fieldKind){case"message":o=vm(s,o);break;case"scalar":o=oS(s,o);break;case"list":o=oN(s,o);break;case"map":o=rN(s,o);break}(0,hm.unsafeSet)(e,s,o)}return e}function oS(t,e){return t.scalar==bm.ScalarType.BYTES?Sm(e):e}function rN(t,e){if((0,nS.isObject)(e)){if(t.scalar==bm.ScalarType.BYTES)return Qv(e,Sm);if(t.mapKind=="message")return Qv(e,n=>vm(t,n))}return e}function oN(t,e){if(Array.isArray(e)){if(t.scalar==bm.ScalarType.BYTES)return e.map(Sm);if(t.listKind=="message")return e.map(n=>vm(t,n))}return e}function vm(t,e){if(t.fieldKind=="message"&&!t.oneof&&(0,QI.isWrapperDesc)(t.message))return oS(t.message.fields[0],e);if((0,nS.isObject)(e)){if(t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!=="google.protobuf.Value")return e;if(!(0,tS.isMessage)(e,t.message))return rS(t.message,e)}return e}function Sm(t){return Array.isArray(t)?new Uint8Array(t):t}function Qv(t,e){let n={};for(let r of Object.entries(t))n[r[0]]=e(r[1]);return n}var sN=Symbol(),eS=new WeakMap;function iN(t){let e;if(aN(t)){let n=eS.get(t),r,o;if(n)({prototype:r,members:o}=n);else{r={},o=new Set;for(let s of t.members)s.kind!="oneof"&&(s.fieldKind!="scalar"&&s.fieldKind!="enum"||s.presence!=Hc&&(o.add(s),r[s.localName]=ym(s)));eS.set(t,{prototype:r,members:o})}e=Object.create(r),e.$typeName=t.typeName;for(let s of t.members)o.has(s)||s.kind=="field"&&(s.fieldKind=="message"||(s.fieldKind=="scalar"||s.fieldKind=="enum")&&s.presence!=Hc)||(e[s.localName]=ym(s))}else{e={$typeName:t.typeName};for(let n of t.members)(n.kind=="oneof"||n.presence==Hc)&&(e[n.localName]=ym(n))}return e}function aN(t){switch(t.file.edition){case eN:return!1;case tN:return!0;default:return t.fields.some(e=>e.presence!=Hc&&e.fieldKind!="message"&&!e.oneof)}}function ym(t){if(t.kind=="oneof")return{case:void 0};if(t.fieldKind=="list")return[];if(t.fieldKind=="map")return{};if(t.fieldKind=="message")return sN;let e=t.getDefaultValue();return e!==void 0?t.fieldKind=="scalar"&&t.longAsString?e.toString():e:t.fieldKind=="scalar"?(0,XI.scalarZeroValue)(t.scalar,t.longAsString):t.enum.values[0].number}});var Wc=b(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.FieldError=void 0;fi.isFieldError=lN;var cN=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"],wm=class extends Error{constructor(e,n,r="FieldValueInvalidError"){super(n),this.name=r,this.field=()=>e}};fi.FieldError=wm;function lN(t){return t instanceof Error&&cN.includes(t.name)&&"field"in t&&typeof t.field=="function"}});var Kc=b(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.configureTextEncoding=uN;Yc.getTextEncoding=dN;var Jc=Symbol.for("@bufbuild/protobuf/text-encoding");function uN(t){globalThis[Jc]=t}function dN(){if(globalThis[Jc]==null){let t=new globalThis.TextEncoder,e=new globalThis.TextDecoder;globalThis[Jc]={encodeUtf8(n){return t.encode(n)},decodeUtf8(n){return e.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return globalThis[Jc]}});var zr=b(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.BinaryReader=De.BinaryWriter=De.INT32_MIN=De.INT32_MAX=De.UINT32_MAX=De.FLOAT32_MIN=De.FLOAT32_MAX=De.WireType=void 0;var Kr=Uc(),hn=pn(),iS=Kc(),dr;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(dr||(De.WireType=dr={}));De.FLOAT32_MAX=34028234663852886e22;De.FLOAT32_MIN=-34028234663852886e22;De.UINT32_MAX=4294967295;De.INT32_MAX=2147483647;De.INT32_MIN=-2147483648;var Dm=class{constructor(e=(0,iS.getTextEncoding)().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let o=0;o<this.chunks.length;o++)e+=this.chunks[o].length;let n=new Uint8Array(e),r=0;for(let o=0;o<this.chunks.length;o++)n.set(this.chunks[o],r),r+=this.chunks[o].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(sS(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Em(e),(0,Kr.varint32write)(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.encodeUtf8(e);return this.uint32(n.byteLength),this.raw(n)}float(e){fN(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){sS(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Em(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Em(e),e=(e<<1^e>>31)>>>0,(0,Kr.varint32write)(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),o=hn.protoInt64.enc(e);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),o=hn.protoInt64.uEnc(e);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(n)}int64(e){let n=hn.protoInt64.enc(e);return(0,Kr.varint64write)(n.lo,n.hi,this.buf),this}sint64(e){let n=hn.protoInt64.enc(e),r=n.hi>>31,o=n.lo<<1^r,s=(n.hi<<1|n.lo>>>31)^r;return(0,Kr.varint64write)(o,s,this.buf),this}uint64(e){let n=hn.protoInt64.uEnc(e);return(0,Kr.varint64write)(n.lo,n.hi,this.buf),this}};De.BinaryWriter=Dm;var Cm=class{constructor(e,n=(0,iS.getTextEncoding)().decodeUtf8){this.decodeUtf8=n,this.varint64=Kr.varint64read,this.uint32=Kr.varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e,n){let r=this.pos;switch(e){case dr.Varint:for(;this.buf[this.pos++]&128;);break;case dr.Bit64:this.pos+=4;case dr.Bit32:this.pos+=4;break;case dr.LengthDelimited:let o=this.uint32();this.pos+=o;break;case dr.StartGroup:for(;;){let[s,i]=this.tag();if(i===dr.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(i,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return hn.protoInt64.dec(...this.varint64())}uint64(){return hn.protoInt64.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,hn.protoInt64.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return hn.protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return hn.protoInt64.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.decodeUtf8(this.bytes())}};De.BinaryReader=Cm;function Em(t){if(typeof t=="string")t=Number(t);else if(typeof t!="number")throw new Error("invalid int32: "+typeof t);if(!Number.isInteger(t)||t>De.INT32_MAX||t<De.INT32_MIN)throw new Error("invalid int32: "+t)}function sS(t){if(typeof t=="string")t=Number(t);else if(typeof t!="number")throw new Error("invalid uint32: "+typeof t);if(!Number.isInteger(t)||t>De.UINT32_MAX||t<0)throw new Error("invalid uint32: "+t)}function fN(t){if(typeof t=="string"){let e=t;if(t=Number(t),Number.isNaN(t)&&e!=="NaN")throw new Error("invalid float32: "+e)}else if(typeof t!="number")throw new Error("invalid float32: "+typeof t);if(Number.isFinite(t)&&(t>De.FLOAT32_MAX||t<De.FLOAT32_MIN))throw new Error("invalid float32: "+t)}});var Xc=b(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.checkField=gN;Yo.checkListItem=hN;Yo.checkMapEntry=yN;Yo.formatVal=pi;var z=ut(),mN=Lc(),zc=Wc(),Jo=di(),mi=zr(),pN=Kc(),aS=pn();function gN(t,e){let n=t.fieldKind=="list"?(0,Jo.isReflectList)(e,t):t.fieldKind=="map"?(0,Jo.isReflectMap)(e,t):km(t,e);if(n===!0)return;let r;switch(t.fieldKind){case"list":r=`expected ${uS(t)}, got ${pi(e)}`;break;case"map":r=`expected ${dS(t)}, got ${pi(e)}`;break;default:r=Zc(t,e,n)}return new zc.FieldError(t,r)}function hN(t,e,n){let r=km(t,n);if(r!==!0)return new zc.FieldError(t,`list item #${e+1}: ${Zc(t,n,r)}`)}function yN(t,e,n){let r=cS(e,t.mapKey);if(r!==!0)return new zc.FieldError(t,`invalid map key: ${Zc({scalar:t.mapKey},e,r)}`);let o=km(t,n);if(o!==!0)return new zc.FieldError(t,`map entry ${pi(e)}: ${Zc(t,n,o)}`)}function km(t,e){return t.scalar!==void 0?cS(e,t.scalar):t.enum!==void 0?t.enum.open?Number.isInteger(e):t.enum.values.some(n=>n.number===e):(0,Jo.isReflectMessage)(e,t.message)}function cS(t,e){switch(e){case z.ScalarType.DOUBLE:return typeof t=="number";case z.ScalarType.FLOAT:return typeof t!="number"?!1:Number.isNaN(t)||!Number.isFinite(t)?!0:t>mi.FLOAT32_MAX||t<mi.FLOAT32_MIN?`${t.toFixed()} out of range`:!0;case z.ScalarType.INT32:case z.ScalarType.SFIXED32:case z.ScalarType.SINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>mi.INT32_MAX||t<mi.INT32_MIN?`${t.toFixed()} out of range`:!0;case z.ScalarType.FIXED32:case z.ScalarType.UINT32:return typeof t!="number"||!Number.isInteger(t)?!1:t>mi.UINT32_MAX||t<0?`${t.toFixed()} out of range`:!0;case z.ScalarType.BOOL:return typeof t=="boolean";case z.ScalarType.STRING:return typeof t!="string"?!1:(0,pN.getTextEncoding)().checkUtf8(t)||"invalid UTF8";case z.ScalarType.BYTES:return t instanceof Uint8Array;case z.ScalarType.INT64:case z.ScalarType.SFIXED64:case z.ScalarType.SINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return aS.protoInt64.parse(t),!0}catch{return`${t} out of range`}return!1;case z.ScalarType.FIXED64:case z.ScalarType.UINT64:if(typeof t=="bigint"||typeof t=="number"||typeof t=="string"&&t.length>0)try{return aS.protoInt64.uParse(t),!0}catch{return`${t} out of range`}return!1}}function Zc(t,e,n){return n=typeof n=="string"?`: ${n}`:`, got ${pi(e)}`,t.scalar!==void 0?`expected ${bN(t.scalar)}`+n:t.enum!==void 0?`expected ${t.enum.toString()}`+n:`expected ${lS(t.message)}`+n}function pi(t){switch(typeof t){case"object":return t===null?"null":t instanceof Uint8Array?`Uint8Array(${t.length})`:Array.isArray(t)?`Array(${t.length})`:(0,Jo.isReflectList)(t)?uS(t.field()):(0,Jo.isReflectMap)(t)?dS(t.field()):(0,Jo.isReflectMessage)(t)?lS(t.desc):(0,mN.isMessage)(t)?`message ${t.$typeName}`:"object";case"string":return t.length>30?"string":`"${t.split('"').join('\\"')}"`;case"boolean":return String(t);case"number":return String(t);case"bigint":return String(t)+"n";default:return typeof t}}function lS(t){return`ReflectMessage (${t.typeName})`}function uS(t){switch(t.listKind){case"message":return`ReflectList (${t.message.toString()})`;case"enum":return`ReflectList (${t.enum.toString()})`;case"scalar":return`ReflectList (${z.ScalarType[t.scalar]})`}}function dS(t){switch(t.mapKind){case"message":return`ReflectMap (${z.ScalarType[t.mapKey]}, ${t.message.toString()})`;case"enum":return`ReflectMap (${z.ScalarType[t.mapKey]}, ${t.enum.toString()})`;case"scalar":return`ReflectMap (${z.ScalarType[t.mapKey]}, ${z.ScalarType[t.scalar]})`}}function bN(t){switch(t){case z.ScalarType.STRING:return"string";case z.ScalarType.BOOL:return"boolean";case z.ScalarType.INT64:case z.ScalarType.SINT64:case z.ScalarType.SFIXED64:return"bigint (int64)";case z.ScalarType.UINT64:case z.ScalarType.FIXED64:return"bigint (uint64)";case z.ScalarType.BYTES:return"Uint8Array";case z.ScalarType.DOUBLE:return"number (float64)";case z.ScalarType.FLOAT:return"number (float32)";case z.ScalarType.FIXED32:case z.ScalarType.UINT32:return"number (uint32)";case z.ScalarType.INT32:case z.ScalarType.SFIXED32:case z.ScalarType.SINT32:return"number (int32)"}}});var Bn=b(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.reflect=_N;yi.reflectList=wN;yi.reflectMap=EN;var Me=ut(),el=Xc(),gS=Wc(),Kt=Jr(),vN=ur(),hS=Wo(),SN=lr(),Ko=pn(),hi=di();function _N(t,e,n=!0){return new tl(t,e,n)}var fS=new WeakMap,tl=class{get sortedFields(){let e=fS.get(this.desc);if(e)return e;let n=this.desc.fields.concat().sort((r,o)=>r.number-o.number);return fS.set(this.desc,n),n}constructor(e,n,r=!0){this.lists=new Map,this.maps=new Map,this.check=r,this.desc=e,this.message=this[Kt.unsafeLocal]=n??(0,vN.create)(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(n=>[n.number,n]))),this._fieldsByNumber.get(e)}oneofCase(e){return gi(this.message,e),(0,Kt.unsafeOneofCase)(this.message,e)}isSet(e){return gi(this.message,e),(0,Kt.unsafeIsSet)(this.message,e)}clear(e){gi(this.message,e),(0,Kt.unsafeClear)(this.message,e)}get(e){gi(this.message,e);let n=(0,Kt.unsafeGet)(this.message,e);switch(e.fieldKind){case"list":let r=this.lists.get(e);return(!r||r[Kt.unsafeLocal]!==n)&&this.lists.set(e,r=new nl(e,n,this.check)),r;case"map":let o=this.maps.get(e);return(!o||o[Kt.unsafeLocal]!==n)&&this.maps.set(e,o=new rl(e,n,this.check)),o;case"message":return Om(e,n,this.check);case"scalar":return n===void 0?(0,SN.scalarZeroValue)(e.scalar,!1):Im(e,n);case"enum":return n??e.enum.values[0].number}}set(e,n){if(gi(this.message,e),this.check){let o=(0,el.checkField)(e,n);if(o)throw o}let r;e.fieldKind=="message"?r=Fm(e,n):(0,hi.isReflectMap)(n)||(0,hi.isReflectList)(n)?r=n[Kt.unsafeLocal]:r=Nm(e,n),(0,Kt.unsafeSet)(this.message,e,r)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}};function gi(t,e){if(e.parent.typeName!==t.$typeName)throw new gS.FieldError(e,`cannot use ${e.toString()} with message ${t.$typeName}`,"ForeignFieldError")}function wN(t,e,n=!0){return new nl(t,e??[],n)}var nl=class{field(){return this._field}get size(){return this._arr.length}constructor(e,n,r){this._field=e,this._arr=this[Kt.unsafeLocal]=n,this.check=r}get(e){let n=this._arr[e];return n===void 0?void 0:Am(this._field,n,this.check)}set(e,n){if(e<0||e>=this._arr.length)throw new gS.FieldError(this._field,`list item #${e+1}: out of range`);if(this.check){let r=(0,el.checkListItem)(this._field,e,n);if(r)throw r}this._arr[e]=mS(this._field,n)}add(e){if(this.check){let n=(0,el.checkListItem)(this._field,this._arr.length,e);if(n)throw n}this._arr.push(mS(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(let e of this._arr)yield Am(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,Am(this._field,this._arr[e],this.check)]}};function EN(t,e,n=!0){return new rl(t,e,n)}var rl=class{constructor(e,n,r=!0){this.obj=this[Kt.unsafeLocal]=n??{},this.check=r,this._field=e}field(){return this._field}set(e,n){if(this.check){let r=(0,el.checkMapEntry)(this._field,e,n);if(r)throw r}return this.obj[Qc(e)]=DN(this._field,n),this}delete(e){let n=Qc(e),r=Object.prototype.hasOwnProperty.call(this.obj,n);return r&&delete this.obj[n],r}clear(){for(let e of Object.keys(this.obj))delete this.obj[e]}get(e){let n=this.obj[Qc(e)];return n!==void 0&&(n=Tm(this._field,n,this.check)),n}has(e){return Object.prototype.hasOwnProperty.call(this.obj,Qc(e))}*keys(){for(let e of Object.keys(this.obj))yield pS(e,this._field.mapKey)}*entries(){for(let e of Object.entries(this.obj))yield[pS(e[0],this._field.mapKey),Tm(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(let e of Object.values(this.obj))yield Tm(this._field,e,this.check)}forEach(e,n){for(let r of this.entries())e.call(n,r[1],r[0],this)}};function Fm(t,e){return(0,hi.isReflectMessage)(e)?(0,hS.isWrapper)(e.message)&&!t.oneof&&t.fieldKind=="message"?e.message.value:e.desc.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"?bS(e.message):e.message:e}function Om(t,e,n){return e!==void 0&&((0,hS.isWrapperDesc)(t.message)&&!t.oneof&&t.fieldKind=="message"?e={$typeName:t.message.typeName,value:Im(t.message.fields[0],e)}:t.message.typeName=="google.protobuf.Struct"&&t.parent.typeName!="google.protobuf.Value"&&(0,hi.isObject)(e)&&(e=yS(e))),new tl(t.message,e,n)}function mS(t,e){return t.listKind=="message"?Fm(t,e):Nm(t,e)}function Am(t,e,n){return t.listKind=="message"?Om(t,e,n):Im(t,e)}function DN(t,e){return t.mapKind=="message"?Fm(t,e):Nm(t,e)}function Tm(t,e,n){return t.mapKind=="message"?Om(t,e,n):e}function Qc(t){return typeof t=="string"||typeof t=="number"?t:String(t)}function pS(t,e){switch(e){case Me.ScalarType.STRING:return t;case Me.ScalarType.INT32:case Me.ScalarType.FIXED32:case Me.ScalarType.UINT32:case Me.ScalarType.SFIXED32:case Me.ScalarType.SINT32:{let n=Number.parseInt(t);if(Number.isFinite(n))return n;break}case Me.ScalarType.BOOL:switch(t){case"true":return!0;case"false":return!1}break;case Me.ScalarType.UINT64:case Me.ScalarType.FIXED64:try{return Ko.protoInt64.uParse(t)}catch{}break;default:try{return Ko.protoInt64.parse(t)}catch{}break}return t}function Im(t,e){switch(t.scalar){case Me.ScalarType.INT64:case Me.ScalarType.SFIXED64:case Me.ScalarType.SINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=Ko.protoInt64.parse(e));break;case Me.ScalarType.FIXED64:case Me.ScalarType.UINT64:"longAsString"in t&&t.longAsString&&typeof e=="string"&&(e=Ko.protoInt64.uParse(e));break}return e}function Nm(t,e){switch(t.scalar){case Me.ScalarType.INT64:case Me.ScalarType.SFIXED64:case Me.ScalarType.SINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=Ko.protoInt64.parse(e));break;case Me.ScalarType.FIXED64:case Me.ScalarType.UINT64:"longAsString"in t&&t.longAsString?e=String(e):(typeof e=="string"||typeof e=="number")&&(e=Ko.protoInt64.uParse(e));break}return e}function yS(t){let e={$typeName:"google.protobuf.Struct",fields:{}};if((0,hi.isObject)(t))for(let[n,r]of Object.entries(t))e.fields[n]=SS(r);return e}function bS(t){let e={};for(let[n,r]of Object.entries(t.fields))e[n]=vS(r);return e}function vS(t){switch(t.kind.case){case"structValue":return bS(t.kind.value);case"listValue":return t.kind.value.values.map(vS);case"nullValue":case void 0:return null;default:return t.kind.value}}function SS(t){let e={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof t){case"number":e.kind={case:"numberValue",value:t};break;case"string":e.kind={case:"stringValue",value:t};break;case"boolean":e.kind={case:"boolValue",value:t};break;case"object":if(t===null)e.kind={case:"nullValue",value:0};else if(Array.isArray(t)){let n={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(t))for(let r of t)n.values.push(SS(r));e.kind={case:"listValue",value:n}}else e.kind={case:"structValue",value:yS(t)};break}return e}});var Rm=b(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});Pm.clone=AN;var CN=ut(),_S=Bn(),kN=di();function AN(t,e){return wS((0,_S.reflect)(t,e)).message}function wS(t){let e=(0,_S.reflect)(t.desc);for(let r of t.fields)if(t.isSet(r))switch(r.fieldKind){case"list":let o=e.get(r);for(let i of t.get(r))o.add(xm(r,i));break;case"map":let s=e.get(r);for(let i of t.get(r).entries())s.set(i[0],xm(r,i[1]));break;default:{e.set(r,xm(r,t.get(r)));break}}let n=t.getUnknown();return n&&n.length>0&&e.setUnknown([...n]),e}function xm(t,e){return t.message!==void 0&&(0,kN.isReflectMessage)(e)?wS(e):t.scalar==CN.ScalarType.BYTES&&e instanceof Uint8Array?e.slice():e}});var bi=b(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.base64Decode=TN;sl.base64Encode=FN;function TN(t){let e=ON(),n=t.length*3/4;t[t.length-2]=="="?n-=2:t[t.length-1]=="="&&(n-=1);let r=new Uint8Array(n),o=0,s=0,i,a=0;for(let c=0;c<t.length;c++){if(i=e[t.charCodeAt(c)],i===void 0)switch(t[c]){case"=":s=0;case`
|
|
26
|
+
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string")}switch(s){case 0:a=i,s=1;break;case 1:r[o++]=a<<2|(i&48)>>4,a=i,s=2;break;case 2:r[o++]=(a&15)<<4|(i&60)>>2,a=i,s=3;break;case 3:r[o++]=(a&3)<<6|i,s=0;break}}if(s==1)throw Error("invalid base64 string");return r.subarray(0,o)}function FN(t,e="std"){let n=DS(e),r=e=="std",o="",s=0,i,a=0;for(let c=0;c<t.length;c++)switch(i=t[c],s){case 0:o+=n[i>>2],a=(i&3)<<4,s=1;break;case 1:o+=n[a|i>>4],a=(i&15)<<2,s=2;break;case 2:o+=n[a|i>>6],o+=n[i&63],s=0;break}return s&&(o+=n[a],r&&(o+="=",s==1&&(o+="="))),o}var ol,ES,zo;function DS(t){return ol||(ol="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ES=ol.slice(0,-2).concat("-","_")),t=="url"?ES:ol}function ON(){if(!zo){zo=[];let t=DS("std");for(let e=0;e<t.length;e++)zo[t[e].charCodeAt(0)]=e;zo[45]=t.indexOf("+"),zo[95]=t.indexOf("/")}return zo}});var Si=b(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.qualifiedName=IN;vi.protoCamelCase=NN;vi.safeObjectProperty=PN;function IN(t){switch(t.kind){case"field":case"oneof":case"rpc":return t.parent.typeName+"."+t.name;case"enum_value":{let e=t.parent.parent?t.parent.parent.typeName:t.parent.file.proto.package;return e+(e.length>0?".":"")+t.name}case"service":case"message":case"enum":case"extension":return t.typeName;case"file":return t.proto.name}}function NN(t){let e=!1,n=[];for(let r=0;r<t.length;r++){let o=t.charAt(r);switch(o){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(o),e=!1;break;default:e&&(e=!1,o=o.toUpperCase()),n.push(o);break}}return n.join("")}var xN=new Set(["constructor","toString","toJSON","valueOf"]);function PN(t){return xN.has(t)?t+"$":t}});var $m=b(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});jm.restoreJsonNames=CS;var RN=Si(),jN=Jr();function CS(t){for(let e of t.field)(0,jN.unsafeIsSetExplicit)(e,"jsonName")||(e.jsonName=(0,RN.protoCamelCase)(e.name));t.nestedType.forEach(CS)}});var Bm=b(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.parseTextFormatEnumValue=$N;il.parseTextFormatScalarValue=LN;var it=ut(),Lm=pn();function $N(t,e){let n=t.values.find(r=>r.name===e);if(!n)throw new Error(`cannot parse ${t} default value: ${e}`);return n.number}function LN(t,e){switch(t){case it.ScalarType.STRING:return e;case it.ScalarType.BYTES:{let n=BN(e);if(n===!1)throw new Error(`cannot parse ${it.ScalarType[t]} default value: ${e}`);return n}case it.ScalarType.INT64:case it.ScalarType.SFIXED64:case it.ScalarType.SINT64:return Lm.protoInt64.parse(e);case it.ScalarType.UINT64:case it.ScalarType.FIXED64:return Lm.protoInt64.uParse(e);case it.ScalarType.DOUBLE:case it.ScalarType.FLOAT:switch(e){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(e)}case it.ScalarType.BOOL:return e==="true";case it.ScalarType.INT32:case it.ScalarType.UINT32:case it.ScalarType.SINT32:case it.ScalarType.FIXED32:case it.ScalarType.SFIXED32:return parseInt(e,10)}}function BN(t){let e=[],n={tail:t,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(r){if(this.tail.length>=r){let o=this.tail.substring(0,r);return this.tail=this.tail.substring(r),o}return!1}};for(;n.next();)switch(n.c){case"\\":if(n.next())switch(n.c){case"\\":e.push(n.c.charCodeAt(0));break;case"b":e.push(8);break;case"f":e.push(12);break;case"n":e.push(10);break;case"r":e.push(13);break;case"t":e.push(9);break;case"v":e.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let r=n.c,o=n.take(2);if(o===!1)return!1;let s=parseInt(r+o,8);if(Number.isNaN(s))return!1;e.push(s);break}case"x":{let r=n.c,o=n.take(2);if(o===!1)return!1;let s=parseInt(r+o,16);if(Number.isNaN(s))return!1;e.push(s);break}case"u":{let r=n.c,o=n.take(4);if(o===!1)return!1;let s=parseInt(r+o,16);if(Number.isNaN(s))return!1;let i=new Uint8Array(4);new DataView(i.buffer).setInt32(0,s,!0),e.push(i[0],i[1],i[2],i[3]);break}case"U":{let r=n.c,o=n.take(8);if(o===!1)return!1;let s=Lm.protoInt64.uEnc(r+o),i=new Uint8Array(8),a=new DataView(i.buffer);a.setInt32(0,s.lo,!0),a.setInt32(4,s.hi,!0),e.push(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7]);break}}break;default:e.push(n.c.charCodeAt(0))}return new Uint8Array(e)}});var AS=b(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.nestedTypes=Mm;_i.usedTypes=MN;_i.parentTypes=UN;function*Mm(t){switch(t.kind){case"file":for(let e of t.messages)yield e,yield*Mm(e);yield*t.enums,yield*t.services,yield*t.extensions;break;case"message":for(let e of t.nestedMessages)yield e,yield*Mm(e);yield*t.nestedEnums,yield*t.nestedExtensions;break}}function MN(t){return kS(t,new Set)}function*kS(t,e){var n,r;for(let o of t.fields){let s=(r=(n=o.enum)!==null&&n!==void 0?n:o.message)!==null&&r!==void 0?r:void 0;!s||e.has(s.typeName)||(e.add(s.typeName),yield s,s.kind=="message"&&(yield*kS(s,e)))}}function UN(t){let e=[];for(;t.kind!=="file";){let n=GN(t);t=n,e.push(n)}return e}function GN(t){var e;switch(t.kind){case"enum_value":case"field":case"oneof":case"rpc":return t.parent;case"service":return t.file;case"extension":case"enum":case"message":return(e=t.parent)!==null&&e!==void 0?e:t.file}}});var ll=b(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.maximumEdition=Un.minimumEdition=void 0;Un.createRegistry=qN;Un.createMutableRegistry=HN;Un.createFileRegistry=WN;var Um=ut(),TS=Bm(),VN=AS(),al=Jr(),fr=Si();function qN(...t){return RS(t)}function HN(...t){let e=RS(t);return Object.assign(Object.assign({},e),{remove(n){var r;n.kind=="extension"&&((r=e.extendees.get(n.extendee.typeName))===null||r===void 0||r.delete(n.number)),e.types.delete(n.typeName)}})}function WN(...t){let e=PS();if(!t.length)return e;if("$typeName"in t[0]&&t[0].$typeName=="google.protobuf.FileDescriptorSet"){for(let n of t[0].file)NS(n,e);return e}if("$typeName"in t[0]){let s=function(i){let a=[];for(let c of i.dependency){if(e.getFile(c)!=null||o.has(c))continue;let u=r(c);if(!u)throw new Error(`Unable to resolve ${c}, imported by ${i.name}`);"kind"in u?e.addFile(u,!1,!0):(o.add(u.name),a.push(u))}return a.concat(...a.map(s))},n=t[0],r=t[1],o=new Set;for(let i of[n,...s(n)].reverse())NS(i,e)}else for(let n of t)for(let r of n.files)e.addFile(r);return e}function PS(){let t=new Map,e=new Map,n=new Map;return{kind:"registry",types:t,extendees:e,[Symbol.iterator](){return t.values()},get files(){return n.values()},addFile(r,o,s){if(n.set(r.proto.name,r),!o)for(let i of(0,VN.nestedTypes)(r))this.add(i);if(s)for(let i of r.dependencies)this.addFile(i,o,s)},add(r){if(r.kind=="extension"){let o=e.get(r.extendee.typeName);o||e.set(r.extendee.typeName,o=new Map),o.set(r.number,r)}t.set(r.typeName,r)},get(r){return t.get(r)},getFile(r){return n.get(r)},getMessage(r){let o=t.get(r);return o?.kind=="message"?o:void 0},getEnum(r){let o=t.get(r);return o?.kind=="enum"?o:void 0},getExtension(r){let o=t.get(r);return o?.kind=="extension"?o:void 0},getExtensionFor(r,o){var s;return(s=e.get(r.typeName))===null||s===void 0?void 0:s.get(o)},getService(r){let o=t.get(r);return o?.kind=="service"?o:void 0}}}function RS(t){let e=PS();for(let n of t)switch(n.kind){case"registry":for(let r of n)e.add(r);break;case"file":e.addFile(n);break;default:e.add(n);break}return e}var JN=998,YN=999,KN=9,Ei=10,wi=11,zN=12,FS=14,Wm=3,ZN=2,OS=1,XN=0,Gm=1,IS=2,QN=3,ex=1,tx=2,nx=1;Un.minimumEdition=998,Un.maximumEdition=1001;var jS={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function NS(t,e){var n,r;let o={kind:"file",proto:t,deprecated:(r=(n=t.options)===null||n===void 0?void 0:n.deprecated)!==null&&r!==void 0?r:!1,edition:ix(t),name:t.name.replace(/\.proto$/,""),dependencies:ax(t,e),enums:[],messages:[],extensions:[],services:[],toString(){return`file ${t.name}`}},s=new Map,i={get(a){return s.get(a)},add(a){var c;zt(((c=a.proto.options)===null||c===void 0?void 0:c.mapEntry)===!0),s.set(a.typeName,a)}};for(let a of t.enumType)$S(a,o,void 0,e);for(let a of t.messageType)LS(a,o,void 0,e,i);for(let a of t.service)rx(a,o,e);Vm(o,e);for(let a of s.values())qm(a,e,i);for(let a of o.messages)qm(a,e,i),Vm(a,e);e.addFile(o,!0)}function Vm(t,e){switch(t.kind){case"file":for(let n of t.proto.extension){let r=Hm(n,t,e);t.extensions.push(r),e.add(r)}break;case"message":for(let n of t.proto.extension){let r=Hm(n,t,e);t.nestedExtensions.push(r),e.add(r)}for(let n of t.nestedMessages)Vm(n,e);break}}function qm(t,e,n){let r=t.proto.oneofDecl.map(s=>sx(s,t)),o=new Set;for(let s of t.proto.field){let i=ux(s,r),a=Hm(s,t,e,i,n);t.fields.push(a),t.field[a.localName]=a,i===void 0?t.members.push(a):(i.fields.push(a),o.has(i)||(o.add(i),t.members.push(i)))}for(let s of r.filter(i=>o.has(i)))t.oneofs.push(s);for(let s of t.nestedMessages)qm(s,e,n)}function $S(t,e,n,r){var o,s,i,a,c;let u=cx(t.name,t.value),d={kind:"enum",proto:t,deprecated:(s=(o=t.options)===null||o===void 0?void 0:o.deprecated)!==null&&s!==void 0?s:!1,file:e,parent:n,open:!0,name:t.name,typeName:cl(t,n,e),value:{},values:[],sharedPrefix:u,toString(){return`enum ${this.typeName}`}};d.open=px(d),r.add(d);for(let m of t.value){let p=m.name;d.values.push(d.value[m.number]={kind:"enum_value",proto:m,deprecated:(a=(i=m.options)===null||i===void 0?void 0:i.deprecated)!==null&&a!==void 0?a:!1,parent:d,name:p,localName:(0,fr.safeObjectProperty)(u==null?p:p.substring(u.length)),number:m.number,toString(){return`enum value ${d.typeName}.${p}`}})}((c=n?.nestedEnums)!==null&&c!==void 0?c:e.enums).push(d)}function LS(t,e,n,r,o){var s,i,a,c;let u={kind:"message",proto:t,deprecated:(i=(s=t.options)===null||s===void 0?void 0:s.deprecated)!==null&&i!==void 0?i:!1,file:e,parent:n,name:t.name,typeName:cl(t,n,e),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};((a=t.options)===null||a===void 0?void 0:a.mapEntry)===!0?o.add(u):(((c=n?.nestedMessages)!==null&&c!==void 0?c:e.messages).push(u),r.add(u));for(let d of t.enumType)$S(d,e,u,r);for(let d of t.nestedType)LS(d,e,u,r,o)}function rx(t,e,n){var r,o;let s={kind:"service",proto:t,deprecated:(o=(r=t.options)===null||r===void 0?void 0:r.deprecated)!==null&&o!==void 0?o:!1,file:e,name:t.name,typeName:cl(t,void 0,e),methods:[],method:{},toString(){return`service ${this.typeName}`}};e.services.push(s),n.add(s);for(let i of t.method){let a=ox(i,s,n);s.methods.push(a),s.method[a.localName]=a}}function ox(t,e,n){var r,o,s,i;let a;t.clientStreaming&&t.serverStreaming?a="bidi_streaming":t.clientStreaming?a="client_streaming":t.serverStreaming?a="server_streaming":a="unary";let c=n.getMessage(Mn(t.inputType)),u=n.getMessage(Mn(t.outputType));zt(c,`invalid MethodDescriptorProto: input_type ${t.inputType} not found`),zt(u,`invalid MethodDescriptorProto: output_type ${t.inputType} not found`);let d=t.name;return{kind:"rpc",proto:t,deprecated:(o=(r=t.options)===null||r===void 0?void 0:r.deprecated)!==null&&o!==void 0?o:!1,parent:e,name:d,localName:(0,fr.safeObjectProperty)(d.length?(0,fr.safeObjectProperty)(d[0].toLowerCase()+d.substring(1)):d),methodKind:a,input:c,output:u,idempotency:(i=(s=t.options)===null||s===void 0?void 0:s.idempotencyLevel)!==null&&i!==void 0?i:XN,toString(){return`rpc ${e.typeName}.${d}`}}}function sx(t,e){return{kind:"oneof",proto:t,deprecated:!1,parent:e,fields:[],name:t.name,localName:(0,fr.safeObjectProperty)((0,fr.protoCamelCase)(t.name)),toString(){return`oneof ${e.typeName}.${this.name}`}}}function Hm(t,e,n,r,o){var s,i,a;let c=o===void 0,u={kind:"field",proto:t,deprecated:(i=(s=t.options)===null||s===void 0?void 0:s.deprecated)!==null&&i!==void 0?i:!1,name:t.name,number:t.number,scalar:void 0,message:void 0,enum:void 0,presence:dx(t,r,c,e),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(c){let f=e.kind=="file"?e:e.file,g=e.kind=="file"?void 0:e,h=cl(t,g,f);u.kind="extension",u.file=f,u.parent=g,u.oneof=void 0,u.typeName=h,u.jsonName=`[${h}]`,u.toString=()=>`extension ${h}`;let y=n.getMessage(Mn(t.extendee));zt(y,`invalid FieldDescriptorProto: extendee ${t.extendee} not found`),u.extendee=y}else{let f=e;zt(f.kind=="message"),u.parent=f,u.oneof=r,u.localName=r?(0,fr.protoCamelCase)(t.name):(0,fr.safeObjectProperty)((0,fr.protoCamelCase)(t.name)),u.jsonName=t.jsonName,u.toString=()=>`field ${f.typeName}.${t.name}`}let d=t.label,m=t.type,p=(a=t.options)===null||a===void 0?void 0:a.jstype;if(d===Wm){let f=m==wi?o?.get(Mn(t.typeName)):void 0;if(f){u.fieldKind="map";let{key:g,value:h}=mx(f);return u.mapKey=g.scalar,u.mapKind=h.fieldKind,u.message=h.message,u.delimitedEncoding=!1,u.enum=h.enum,u.scalar=h.scalar,u}switch(u.fieldKind="list",m){case wi:case Ei:u.listKind="message",u.message=n.getMessage(Mn(t.typeName)),zt(u.message),u.delimitedEncoding=xS(t,e);break;case FS:u.listKind="enum",u.enum=n.getEnum(Mn(t.typeName)),zt(u.enum);break;default:u.listKind="scalar",u.scalar=m,u.longAsString=p==OS;break}return u.packed=fx(t,e),u}switch(m){case wi:case Ei:u.fieldKind="message",u.message=n.getMessage(Mn(t.typeName)),zt(u.message,`invalid FieldDescriptorProto: type_name ${t.typeName} not found`),u.delimitedEncoding=xS(t,e),u.getDefaultValue=()=>{};break;case FS:{let f=n.getEnum(Mn(t.typeName));zt(f!==void 0,`invalid FieldDescriptorProto: type_name ${t.typeName} not found`),u.fieldKind="enum",u.enum=n.getEnum(Mn(t.typeName)),u.getDefaultValue=()=>(0,al.unsafeIsSetExplicit)(t,"defaultValue")?(0,TS.parseTextFormatEnumValue)(f,t.defaultValue):void 0;break}default:{u.fieldKind="scalar",u.scalar=m,u.longAsString=p==OS,u.getDefaultValue=()=>(0,al.unsafeIsSetExplicit)(t,"defaultValue")?(0,TS.parseTextFormatScalarValue)(m,t.defaultValue):void 0;break}}return u}function ix(t){switch(t.syntax){case"":case"proto2":return JN;case"proto3":return YN;case"editions":if(t.edition in jS)return t.edition;throw new Error(`${t.name}: unsupported edition`);default:throw new Error(`${t.name}: unsupported syntax "${t.syntax}"`)}}function ax(t,e){return t.dependency.map(n=>{let r=e.getFile(n);if(!r)throw new Error(`Cannot find ${n}, imported by ${t.name}`);return r})}function cx(t,e){let n=lx(t)+"_";for(let r of e){if(!r.name.toLowerCase().startsWith(n))return;let o=r.name.substring(n.length);if(o.length==0||/^\d/.test(o))return}return n}function lx(t){return(t.substring(0,1)+t.substring(1).replace(/[A-Z]/g,e=>"_"+e)).toLowerCase()}function cl(t,e,n){let r;return e?r=`${e.typeName}.${t.name}`:n.proto.package.length>0?r=`${n.proto.package}.${t.name}`:r=`${t.name}`,r}function Mn(t){return t.startsWith(".")?t.substring(1):t}function ux(t,e){if(!(0,al.unsafeIsSetExplicit)(t,"oneofIndex")||t.proto3Optional)return;let n=e[t.oneofIndex];return zt(n,`invalid FieldDescriptorProto: oneof #${t.oneofIndex} for field #${t.number} not found`),n}function dx(t,e,n,r){if(t.label==ZN)return QN;if(t.label==Wm)return IS;if(e||t.proto3Optional||n)return Gm;let o=Zo("fieldPresence",{proto:t,parent:r});return o==IS&&(t.type==wi||t.type==Ei)?Gm:o}function fx(t,e){if(t.label!=Wm)return!1;switch(t.type){case KN:case zN:case Ei:case wi:return!1}let n=t.options;return n&&(0,al.unsafeIsSetExplicit)(n,"packed")?n.packed:ex==Zo("repeatedFieldEncoding",{proto:t,parent:e})}function mx(t){let e=t.fields.find(r=>r.number===1),n=t.fields.find(r=>r.number===2);return zt(e&&e.fieldKind=="scalar"&&e.scalar!=Um.ScalarType.BYTES&&e.scalar!=Um.ScalarType.FLOAT&&e.scalar!=Um.ScalarType.DOUBLE&&n&&n.fieldKind!="list"&&n.fieldKind!="map"),{key:e,value:n}}function px(t){var e;return nx==Zo("enumType",{proto:t.proto,parent:(e=t.parent)!==null&&e!==void 0?e:t.file})}function xS(t,e){return t.type==Ei?!0:tx==Zo("messageEncoding",{proto:t,parent:e})}function Zo(t,e){var n,r;let o=(n=e.proto.options)===null||n===void 0?void 0:n.features;if(o){let s=o[t];if(s!=0)return s}if("kind"in e){if(e.kind=="message")return Zo(t,(r=e.parent)!==null&&r!==void 0?r:e.file);let s=jS[e.edition];if(!s)throw new Error(`feature default for edition ${e.edition} not found`);return s[t]}return Zo(t,e.parent)}function zt(t,e){if(!t)throw new Error(e)}});var dl=b(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.boot=yx;ul.bootFileDescriptorProto=BS;var gx=$m(),hx=ll();function yx(t){let e=BS(t);return e.messageType.forEach(gx.restoreJsonNames),(0,hx.createFileRegistry)(e,()=>{}).getFile(e.name)}function BS(t){return Object.assign(Object.create({syntax:"",edition:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},t),{messageType:t.messageType.map(MS),enumType:t.enumType.map(US)}))}function MS(t){var e,n,r,o,s,i,a,c;return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.DescriptorProto",name:t.name,field:(n=(e=t.field)===null||e===void 0?void 0:e.map(bx))!==null&&n!==void 0?n:[],extension:[],nestedType:(o=(r=t.nestedType)===null||r===void 0?void 0:r.map(MS))!==null&&o!==void 0?o:[],enumType:(i=(s=t.enumType)===null||s===void 0?void 0:s.map(US))!==null&&i!==void 0?i:[],extensionRange:(c=(a=t.extensionRange)===null||a===void 0?void 0:a.map(d=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},d)))!==null&&c!==void 0?c:[],oneofDecl:[],reservedRange:[],reservedName:[]})}function bx(t){return Object.assign(Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},t),{options:t.options?vx(t.options):void 0}))}function vx(t){var e,n,r;return Object.assign(Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0}),Object.assign(Object.assign({$typeName:"google.protobuf.FieldOptions"},t),{targets:(e=t.targets)!==null&&e!==void 0?e:[],editionDefaults:(r=(n=t.editionDefaults)===null||n===void 0?void 0:n.map(s=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},s)))!==null&&r!==void 0?r:[],uninterpretedOption:[]}))}function US(t){return Object.assign(Object.create({visibility:0}),{$typeName:"google.protobuf.EnumDescriptorProto",name:t.name,reservedName:[],reservedRange:[],value:t.value.map(n=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},n))})}});var Xe=b(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.messageDesc=Sx;function Sx(t,e,...n){return n.reduce((r,o)=>r.nestedMessages[o],t.messages[e])}});var yn=b(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.enumDesc=_x;fl.tsEnum=wx;function _x(t,e,...n){if(n.length==0)return t.enums[e];let r=n.pop();return n.reduce((o,s)=>o.nestedMessages[s],t.messages[e]).nestedEnums[r]}function wx(t){let e={};for(let n of t.values)e[n.localName]=n.number,e[n.number]=n.localName;return e}});var mr=b(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.FeatureSet_FieldPresence=S.FeatureSet_VisibilityFeature_DefaultSymbolVisibilitySchema=S.FeatureSet_VisibilityFeature_DefaultSymbolVisibility=S.FeatureSet_VisibilityFeatureSchema=S.FeatureSetSchema=S.UninterpretedOption_NamePartSchema=S.UninterpretedOptionSchema=S.MethodOptions_IdempotencyLevelSchema=S.MethodOptions_IdempotencyLevel=S.MethodOptionsSchema=S.ServiceOptionsSchema=S.EnumValueOptionsSchema=S.EnumOptionsSchema=S.OneofOptionsSchema=S.FieldOptions_OptionTargetTypeSchema=S.FieldOptions_OptionTargetType=S.FieldOptions_OptionRetentionSchema=S.FieldOptions_OptionRetention=S.FieldOptions_JSTypeSchema=S.FieldOptions_JSType=S.FieldOptions_CTypeSchema=S.FieldOptions_CType=S.FieldOptions_FeatureSupportSchema=S.FieldOptions_EditionDefaultSchema=S.FieldOptionsSchema=S.MessageOptionsSchema=S.FileOptions_OptimizeModeSchema=S.FileOptions_OptimizeMode=S.FileOptionsSchema=S.MethodDescriptorProtoSchema=S.ServiceDescriptorProtoSchema=S.EnumValueDescriptorProtoSchema=S.EnumDescriptorProto_EnumReservedRangeSchema=S.EnumDescriptorProtoSchema=S.OneofDescriptorProtoSchema=S.FieldDescriptorProto_LabelSchema=S.FieldDescriptorProto_Label=S.FieldDescriptorProto_TypeSchema=S.FieldDescriptorProto_Type=S.FieldDescriptorProtoSchema=S.ExtensionRangeOptions_VerificationStateSchema=S.ExtensionRangeOptions_VerificationState=S.ExtensionRangeOptions_DeclarationSchema=S.ExtensionRangeOptionsSchema=S.DescriptorProto_ReservedRangeSchema=S.DescriptorProto_ExtensionRangeSchema=S.DescriptorProtoSchema=S.FileDescriptorProtoSchema=S.FileDescriptorSetSchema=S.file_google_protobuf_descriptor=void 0;S.SymbolVisibilitySchema=S.SymbolVisibility=S.EditionSchema=S.Edition=S.GeneratedCodeInfo_Annotation_SemanticSchema=S.GeneratedCodeInfo_Annotation_Semantic=S.GeneratedCodeInfo_AnnotationSchema=S.GeneratedCodeInfoSchema=S.SourceCodeInfo_LocationSchema=S.SourceCodeInfoSchema=S.FeatureSetDefaults_FeatureSetEditionDefaultSchema=S.FeatureSetDefaultsSchema=S.FeatureSet_EnforceNamingStyleSchema=S.FeatureSet_EnforceNamingStyle=S.FeatureSet_JsonFormatSchema=S.FeatureSet_JsonFormat=S.FeatureSet_MessageEncodingSchema=S.FeatureSet_MessageEncoding=S.FeatureSet_Utf8ValidationSchema=S.FeatureSet_Utf8Validation=S.FeatureSet_RepeatedFieldEncodingSchema=S.FeatureSet_RepeatedFieldEncoding=S.FeatureSet_EnumTypeSchema=S.FeatureSet_EnumType=S.FeatureSet_FieldPresenceSchema=void 0;var Ex=dl(),X=Xe(),Oe=yn();S.file_google_protobuf_descriptor=(0,Ex.boot)({name:"google/protobuf/descriptor.proto",package:"google.protobuf",messageType:[{name:"FileDescriptorSet",field:[{name:"file",number:1,type:11,label:3,typeName:".google.protobuf.FileDescriptorProto"}],extensionRange:[{start:536e6,end:536000001}]},{name:"FileDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"package",number:2,type:9,label:1},{name:"dependency",number:3,type:9,label:3},{name:"public_dependency",number:10,type:5,label:3},{name:"weak_dependency",number:11,type:5,label:3},{name:"option_dependency",number:15,type:9,label:3},{name:"message_type",number:4,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:5,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"service",number:6,type:11,label:3,typeName:".google.protobuf.ServiceDescriptorProto"},{name:"extension",number:7,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FileOptions"},{name:"source_code_info",number:9,type:11,label:1,typeName:".google.protobuf.SourceCodeInfo"},{name:"syntax",number:12,type:9,label:1},{name:"edition",number:14,type:14,label:1,typeName:".google.protobuf.Edition"}]},{name:"DescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"field",number:2,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"extension",number:6,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"nested_type",number:3,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"extension_range",number:5,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ExtensionRange"},{name:"oneof_decl",number:8,type:11,label:3,typeName:".google.protobuf.OneofDescriptorProto"},{name:"options",number:7,type:11,label:1,typeName:".google.protobuf.MessageOptions"},{name:"reserved_range",number:9,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ReservedRange"},{name:"reserved_name",number:10,type:9,label:3},{name:"visibility",number:11,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"ExtensionRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ExtensionRangeOptions"}]},{name:"ReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"ExtensionRangeOptions",field:[{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"},{name:"declaration",number:2,type:11,label:3,typeName:".google.protobuf.ExtensionRangeOptions.Declaration",options:{retention:2}},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"verification",number:3,type:14,label:1,typeName:".google.protobuf.ExtensionRangeOptions.VerificationState",defaultValue:"UNVERIFIED",options:{retention:2}}],nestedType:[{name:"Declaration",field:[{name:"number",number:1,type:5,label:1},{name:"full_name",number:2,type:9,label:1},{name:"type",number:3,type:9,label:1},{name:"reserved",number:5,type:8,label:1},{name:"repeated",number:6,type:8,label:1}]}],enumType:[{name:"VerificationState",value:[{name:"DECLARATION",number:0},{name:"UNVERIFIED",number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:3,type:5,label:1},{name:"label",number:4,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Label"},{name:"type",number:5,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Type"},{name:"type_name",number:6,type:9,label:1},{name:"extendee",number:2,type:9,label:1},{name:"default_value",number:7,type:9,label:1},{name:"oneof_index",number:9,type:5,label:1},{name:"json_name",number:10,type:9,label:1},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FieldOptions"},{name:"proto3_optional",number:17,type:8,label:1}],enumType:[{name:"Type",value:[{name:"TYPE_DOUBLE",number:1},{name:"TYPE_FLOAT",number:2},{name:"TYPE_INT64",number:3},{name:"TYPE_UINT64",number:4},{name:"TYPE_INT32",number:5},{name:"TYPE_FIXED64",number:6},{name:"TYPE_FIXED32",number:7},{name:"TYPE_BOOL",number:8},{name:"TYPE_STRING",number:9},{name:"TYPE_GROUP",number:10},{name:"TYPE_MESSAGE",number:11},{name:"TYPE_BYTES",number:12},{name:"TYPE_UINT32",number:13},{name:"TYPE_ENUM",number:14},{name:"TYPE_SFIXED32",number:15},{name:"TYPE_SFIXED64",number:16},{name:"TYPE_SINT32",number:17},{name:"TYPE_SINT64",number:18}]},{name:"Label",value:[{name:"LABEL_OPTIONAL",number:1},{name:"LABEL_REPEATED",number:3},{name:"LABEL_REQUIRED",number:2}]}]},{name:"OneofDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"options",number:2,type:11,label:1,typeName:".google.protobuf.OneofOptions"}]},{name:"EnumDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"value",number:2,type:11,label:3,typeName:".google.protobuf.EnumValueDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumOptions"},{name:"reserved_range",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto.EnumReservedRange"},{name:"reserved_name",number:5,type:9,label:3},{name:"visibility",number:6,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"EnumReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"EnumValueDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumValueOptions"}]},{name:"ServiceDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"method",number:2,type:11,label:3,typeName:".google.protobuf.MethodDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ServiceOptions"}]},{name:"MethodDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"input_type",number:2,type:9,label:1},{name:"output_type",number:3,type:9,label:1},{name:"options",number:4,type:11,label:1,typeName:".google.protobuf.MethodOptions"},{name:"client_streaming",number:5,type:8,label:1,defaultValue:"false"},{name:"server_streaming",number:6,type:8,label:1,defaultValue:"false"}]},{name:"FileOptions",field:[{name:"java_package",number:1,type:9,label:1},{name:"java_outer_classname",number:8,type:9,label:1},{name:"java_multiple_files",number:10,type:8,label:1,defaultValue:"false"},{name:"java_generate_equals_and_hash",number:20,type:8,label:1,options:{deprecated:!0}},{name:"java_string_check_utf8",number:27,type:8,label:1,defaultValue:"false"},{name:"optimize_for",number:9,type:14,label:1,typeName:".google.protobuf.FileOptions.OptimizeMode",defaultValue:"SPEED"},{name:"go_package",number:11,type:9,label:1},{name:"cc_generic_services",number:16,type:8,label:1,defaultValue:"false"},{name:"java_generic_services",number:17,type:8,label:1,defaultValue:"false"},{name:"py_generic_services",number:18,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:23,type:8,label:1,defaultValue:"false"},{name:"cc_enable_arenas",number:31,type:8,label:1,defaultValue:"true"},{name:"objc_class_prefix",number:36,type:9,label:1},{name:"csharp_namespace",number:37,type:9,label:1},{name:"swift_prefix",number:39,type:9,label:1},{name:"php_class_prefix",number:40,type:9,label:1},{name:"php_namespace",number:41,type:9,label:1},{name:"php_metadata_namespace",number:44,type:9,label:1},{name:"ruby_package",number:45,type:9,label:1},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"OptimizeMode",value:[{name:"SPEED",number:1},{name:"CODE_SIZE",number:2},{name:"LITE_RUNTIME",number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"MessageOptions",field:[{name:"message_set_wire_format",number:1,type:8,label:1,defaultValue:"false"},{name:"no_standard_descriptor_accessor",number:2,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"map_entry",number:7,type:8,label:1},{name:"deprecated_legacy_json_field_conflicts",number:11,type:8,label:1,options:{deprecated:!0}},{name:"features",number:12,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldOptions",field:[{name:"ctype",number:1,type:14,label:1,typeName:".google.protobuf.FieldOptions.CType",defaultValue:"STRING"},{name:"packed",number:2,type:8,label:1},{name:"jstype",number:6,type:14,label:1,typeName:".google.protobuf.FieldOptions.JSType",defaultValue:"JS_NORMAL"},{name:"lazy",number:5,type:8,label:1,defaultValue:"false"},{name:"unverified_lazy",number:15,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"weak",number:10,type:8,label:1,defaultValue:"false",options:{deprecated:!0}},{name:"debug_redact",number:16,type:8,label:1,defaultValue:"false"},{name:"retention",number:17,type:14,label:1,typeName:".google.protobuf.FieldOptions.OptionRetention"},{name:"targets",number:19,type:14,label:3,typeName:".google.protobuf.FieldOptions.OptionTargetType"},{name:"edition_defaults",number:20,type:11,label:3,typeName:".google.protobuf.FieldOptions.EditionDefault"},{name:"features",number:21,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"feature_support",number:22,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],nestedType:[{name:"EditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"value",number:2,type:9,label:1}]},{name:"FeatureSupport",field:[{name:"edition_introduced",number:1,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"edition_deprecated",number:2,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"deprecation_warning",number:3,type:9,label:1},{name:"edition_removed",number:4,type:14,label:1,typeName:".google.protobuf.Edition"}]}],enumType:[{name:"CType",value:[{name:"STRING",number:0},{name:"CORD",number:1},{name:"STRING_PIECE",number:2}]},{name:"JSType",value:[{name:"JS_NORMAL",number:0},{name:"JS_STRING",number:1},{name:"JS_NUMBER",number:2}]},{name:"OptionRetention",value:[{name:"RETENTION_UNKNOWN",number:0},{name:"RETENTION_RUNTIME",number:1},{name:"RETENTION_SOURCE",number:2}]},{name:"OptionTargetType",value:[{name:"TARGET_TYPE_UNKNOWN",number:0},{name:"TARGET_TYPE_FILE",number:1},{name:"TARGET_TYPE_EXTENSION_RANGE",number:2},{name:"TARGET_TYPE_MESSAGE",number:3},{name:"TARGET_TYPE_FIELD",number:4},{name:"TARGET_TYPE_ONEOF",number:5},{name:"TARGET_TYPE_ENUM",number:6},{name:"TARGET_TYPE_ENUM_ENTRY",number:7},{name:"TARGET_TYPE_SERVICE",number:8},{name:"TARGET_TYPE_METHOD",number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"OneofOptions",field:[{name:"features",number:1,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumOptions",field:[{name:"allow_alias",number:2,type:8,label:1},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"deprecated_legacy_json_field_conflicts",number:6,type:8,label:1,options:{deprecated:!0}},{name:"features",number:7,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumValueOptions",field:[{name:"deprecated",number:1,type:8,label:1,defaultValue:"false"},{name:"features",number:2,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"debug_redact",number:3,type:8,label:1,defaultValue:"false"},{name:"feature_support",number:4,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"ServiceOptions",field:[{name:"features",number:34,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"MethodOptions",field:[{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"idempotency_level",number:34,type:14,label:1,typeName:".google.protobuf.MethodOptions.IdempotencyLevel",defaultValue:"IDEMPOTENCY_UNKNOWN"},{name:"features",number:35,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"IdempotencyLevel",value:[{name:"IDEMPOTENCY_UNKNOWN",number:0},{name:"NO_SIDE_EFFECTS",number:1},{name:"IDEMPOTENT",number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"UninterpretedOption",field:[{name:"name",number:2,type:11,label:3,typeName:".google.protobuf.UninterpretedOption.NamePart"},{name:"identifier_value",number:3,type:9,label:1},{name:"positive_int_value",number:4,type:4,label:1},{name:"negative_int_value",number:5,type:3,label:1},{name:"double_value",number:6,type:1,label:1},{name:"string_value",number:7,type:12,label:1},{name:"aggregate_value",number:8,type:9,label:1}],nestedType:[{name:"NamePart",field:[{name:"name_part",number:1,type:9,label:2},{name:"is_extension",number:2,type:8,label:2}]}]},{name:"FeatureSet",field:[{name:"field_presence",number:1,type:14,label:1,typeName:".google.protobuf.FeatureSet.FieldPresence",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPLICIT",edition:900},{value:"IMPLICIT",edition:999},{value:"EXPLICIT",edition:1e3}]}},{name:"enum_type",number:2,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnumType",options:{retention:1,targets:[6,1],editionDefaults:[{value:"CLOSED",edition:900},{value:"OPEN",edition:999}]}},{name:"repeated_field_encoding",number:3,type:14,label:1,typeName:".google.protobuf.FeatureSet.RepeatedFieldEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPANDED",edition:900},{value:"PACKED",edition:999}]}},{name:"utf8_validation",number:4,type:14,label:1,typeName:".google.protobuf.FeatureSet.Utf8Validation",options:{retention:1,targets:[4,1],editionDefaults:[{value:"NONE",edition:900},{value:"VERIFY",edition:999}]}},{name:"message_encoding",number:5,type:14,label:1,typeName:".google.protobuf.FeatureSet.MessageEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"LENGTH_PREFIXED",edition:900}]}},{name:"json_format",number:6,type:14,label:1,typeName:".google.protobuf.FeatureSet.JsonFormat",options:{retention:1,targets:[3,6,1],editionDefaults:[{value:"LEGACY_BEST_EFFORT",edition:900},{value:"ALLOW",edition:999}]}},{name:"enforce_naming_style",number:7,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnforceNamingStyle",options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:"STYLE_LEGACY",edition:900},{value:"STYLE2024",edition:1001}]}},{name:"default_symbol_visibility",number:8,type:14,label:1,typeName:".google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility",options:{retention:2,targets:[1],editionDefaults:[{value:"EXPORT_ALL",edition:900},{value:"EXPORT_TOP_LEVEL",edition:1001}]}}],nestedType:[{name:"VisibilityFeature",enumType:[{name:"DefaultSymbolVisibility",value:[{name:"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",number:0},{name:"EXPORT_ALL",number:1},{name:"EXPORT_TOP_LEVEL",number:2},{name:"LOCAL_ALL",number:3},{name:"STRICT",number:4}]}]}],enumType:[{name:"FieldPresence",value:[{name:"FIELD_PRESENCE_UNKNOWN",number:0},{name:"EXPLICIT",number:1},{name:"IMPLICIT",number:2},{name:"LEGACY_REQUIRED",number:3}]},{name:"EnumType",value:[{name:"ENUM_TYPE_UNKNOWN",number:0},{name:"OPEN",number:1},{name:"CLOSED",number:2}]},{name:"RepeatedFieldEncoding",value:[{name:"REPEATED_FIELD_ENCODING_UNKNOWN",number:0},{name:"PACKED",number:1},{name:"EXPANDED",number:2}]},{name:"Utf8Validation",value:[{name:"UTF8_VALIDATION_UNKNOWN",number:0},{name:"VERIFY",number:2},{name:"NONE",number:3}]},{name:"MessageEncoding",value:[{name:"MESSAGE_ENCODING_UNKNOWN",number:0},{name:"LENGTH_PREFIXED",number:1},{name:"DELIMITED",number:2}]},{name:"JsonFormat",value:[{name:"JSON_FORMAT_UNKNOWN",number:0},{name:"ALLOW",number:1},{name:"LEGACY_BEST_EFFORT",number:2}]},{name:"EnforceNamingStyle",value:[{name:"ENFORCE_NAMING_STYLE_UNKNOWN",number:0},{name:"STYLE2024",number:1},{name:"STYLE_LEGACY",number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:"FeatureSetDefaults",field:[{name:"defaults",number:1,type:11,label:3,typeName:".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"},{name:"minimum_edition",number:4,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"maximum_edition",number:5,type:14,label:1,typeName:".google.protobuf.Edition"}],nestedType:[{name:"FeatureSetEditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"overridable_features",number:4,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"fixed_features",number:5,type:11,label:1,typeName:".google.protobuf.FeatureSet"}]}]},{name:"SourceCodeInfo",field:[{name:"location",number:1,type:11,label:3,typeName:".google.protobuf.SourceCodeInfo.Location"}],nestedType:[{name:"Location",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"span",number:2,type:5,label:3,options:{packed:!0}},{name:"leading_comments",number:3,type:9,label:1},{name:"trailing_comments",number:4,type:9,label:1},{name:"leading_detached_comments",number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:"GeneratedCodeInfo",field:[{name:"annotation",number:1,type:11,label:3,typeName:".google.protobuf.GeneratedCodeInfo.Annotation"}],nestedType:[{name:"Annotation",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"source_file",number:2,type:9,label:1},{name:"begin",number:3,type:5,label:1},{name:"end",number:4,type:5,label:1},{name:"semantic",number:5,type:14,label:1,typeName:".google.protobuf.GeneratedCodeInfo.Annotation.Semantic"}],enumType:[{name:"Semantic",value:[{name:"NONE",number:0},{name:"SET",number:1},{name:"ALIAS",number:2}]}]}]}],enumType:[{name:"Edition",value:[{name:"EDITION_UNKNOWN",number:0},{name:"EDITION_LEGACY",number:900},{name:"EDITION_PROTO2",number:998},{name:"EDITION_PROTO3",number:999},{name:"EDITION_2023",number:1e3},{name:"EDITION_2024",number:1001},{name:"EDITION_1_TEST_ONLY",number:1},{name:"EDITION_2_TEST_ONLY",number:2},{name:"EDITION_99997_TEST_ONLY",number:99997},{name:"EDITION_99998_TEST_ONLY",number:99998},{name:"EDITION_99999_TEST_ONLY",number:99999},{name:"EDITION_MAX",number:2147483647}]},{name:"SymbolVisibility",value:[{name:"VISIBILITY_UNSET",number:0},{name:"VISIBILITY_LOCAL",number:1},{name:"VISIBILITY_EXPORT",number:2}]}]});S.FileDescriptorSetSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,0);S.FileDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,1);S.DescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,2);S.DescriptorProto_ExtensionRangeSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,2,0);S.DescriptorProto_ReservedRangeSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,2,1);S.ExtensionRangeOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,3);S.ExtensionRangeOptions_DeclarationSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,3,0);var GS;(function(t){t[t.DECLARATION=0]="DECLARATION",t[t.UNVERIFIED=1]="UNVERIFIED"})(GS||(S.ExtensionRangeOptions_VerificationState=GS={}));S.ExtensionRangeOptions_VerificationStateSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,3,0);S.FieldDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,4);var VS;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.GROUP=10]="GROUP",t[t.MESSAGE=11]="MESSAGE",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.ENUM=14]="ENUM",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(VS||(S.FieldDescriptorProto_Type=VS={}));S.FieldDescriptorProto_TypeSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,4,0);var qS;(function(t){t[t.OPTIONAL=1]="OPTIONAL",t[t.REPEATED=3]="REPEATED",t[t.REQUIRED=2]="REQUIRED"})(qS||(S.FieldDescriptorProto_Label=qS={}));S.FieldDescriptorProto_LabelSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,4,1);S.OneofDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,5);S.EnumDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,6);S.EnumDescriptorProto_EnumReservedRangeSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,6,0);S.EnumValueDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,7);S.ServiceDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,8);S.MethodDescriptorProtoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,9);S.FileOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,10);var HS;(function(t){t[t.SPEED=1]="SPEED",t[t.CODE_SIZE=2]="CODE_SIZE",t[t.LITE_RUNTIME=3]="LITE_RUNTIME"})(HS||(S.FileOptions_OptimizeMode=HS={}));S.FileOptions_OptimizeModeSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,10,0);S.MessageOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,11);S.FieldOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,12);S.FieldOptions_EditionDefaultSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,12,0);S.FieldOptions_FeatureSupportSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,12,1);var WS;(function(t){t[t.STRING=0]="STRING",t[t.CORD=1]="CORD",t[t.STRING_PIECE=2]="STRING_PIECE"})(WS||(S.FieldOptions_CType=WS={}));S.FieldOptions_CTypeSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,12,0);var JS;(function(t){t[t.JS_NORMAL=0]="JS_NORMAL",t[t.JS_STRING=1]="JS_STRING",t[t.JS_NUMBER=2]="JS_NUMBER"})(JS||(S.FieldOptions_JSType=JS={}));S.FieldOptions_JSTypeSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,12,1);var YS;(function(t){t[t.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",t[t.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",t[t.RETENTION_SOURCE=2]="RETENTION_SOURCE"})(YS||(S.FieldOptions_OptionRetention=YS={}));S.FieldOptions_OptionRetentionSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,12,2);var KS;(function(t){t[t.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",t[t.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",t[t.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",t[t.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",t[t.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",t[t.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",t[t.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",t[t.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",t[t.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",t[t.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD"})(KS||(S.FieldOptions_OptionTargetType=KS={}));S.FieldOptions_OptionTargetTypeSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,12,3);S.OneofOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,13);S.EnumOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,14);S.EnumValueOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,15);S.ServiceOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,16);S.MethodOptionsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,17);var zS;(function(t){t[t.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",t[t.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",t[t.IDEMPOTENT=2]="IDEMPOTENT"})(zS||(S.MethodOptions_IdempotencyLevel=zS={}));S.MethodOptions_IdempotencyLevelSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,17,0);S.UninterpretedOptionSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,18);S.UninterpretedOption_NamePartSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,18,0);S.FeatureSetSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,19);S.FeatureSet_VisibilityFeatureSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,19,0);var ZS;(function(t){t[t.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]="DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",t[t.EXPORT_ALL=1]="EXPORT_ALL",t[t.EXPORT_TOP_LEVEL=2]="EXPORT_TOP_LEVEL",t[t.LOCAL_ALL=3]="LOCAL_ALL",t[t.STRICT=4]="STRICT"})(ZS||(S.FeatureSet_VisibilityFeature_DefaultSymbolVisibility=ZS={}));S.FeatureSet_VisibilityFeature_DefaultSymbolVisibilitySchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,0,0);var XS;(function(t){t[t.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",t[t.EXPLICIT=1]="EXPLICIT",t[t.IMPLICIT=2]="IMPLICIT",t[t.LEGACY_REQUIRED=3]="LEGACY_REQUIRED"})(XS||(S.FeatureSet_FieldPresence=XS={}));S.FeatureSet_FieldPresenceSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,0);var QS;(function(t){t[t.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",t[t.OPEN=1]="OPEN",t[t.CLOSED=2]="CLOSED"})(QS||(S.FeatureSet_EnumType=QS={}));S.FeatureSet_EnumTypeSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,1);var e_;(function(t){t[t.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",t[t.PACKED=1]="PACKED",t[t.EXPANDED=2]="EXPANDED"})(e_||(S.FeatureSet_RepeatedFieldEncoding=e_={}));S.FeatureSet_RepeatedFieldEncodingSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,2);var t_;(function(t){t[t.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",t[t.VERIFY=2]="VERIFY",t[t.NONE=3]="NONE"})(t_||(S.FeatureSet_Utf8Validation=t_={}));S.FeatureSet_Utf8ValidationSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,3);var n_;(function(t){t[t.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",t[t.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",t[t.DELIMITED=2]="DELIMITED"})(n_||(S.FeatureSet_MessageEncoding=n_={}));S.FeatureSet_MessageEncodingSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,4);var r_;(function(t){t[t.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",t[t.ALLOW=1]="ALLOW",t[t.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT"})(r_||(S.FeatureSet_JsonFormat=r_={}));S.FeatureSet_JsonFormatSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,5);var o_;(function(t){t[t.ENFORCE_NAMING_STYLE_UNKNOWN=0]="ENFORCE_NAMING_STYLE_UNKNOWN",t[t.STYLE2024=1]="STYLE2024",t[t.STYLE_LEGACY=2]="STYLE_LEGACY"})(o_||(S.FeatureSet_EnforceNamingStyle=o_={}));S.FeatureSet_EnforceNamingStyleSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,19,6);S.FeatureSetDefaultsSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,20);S.FeatureSetDefaults_FeatureSetEditionDefaultSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,20,0);S.SourceCodeInfoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,21);S.SourceCodeInfo_LocationSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,21,0);S.GeneratedCodeInfoSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,22);S.GeneratedCodeInfo_AnnotationSchema=(0,X.messageDesc)(S.file_google_protobuf_descriptor,22,0);var s_;(function(t){t[t.NONE=0]="NONE",t[t.SET=1]="SET",t[t.ALIAS=2]="ALIAS"})(s_||(S.GeneratedCodeInfo_Annotation_Semantic=s_={}));S.GeneratedCodeInfo_Annotation_SemanticSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,22,0,0);var i_;(function(t){t[t.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",t[t.EDITION_LEGACY=900]="EDITION_LEGACY",t[t.EDITION_PROTO2=998]="EDITION_PROTO2",t[t.EDITION_PROTO3=999]="EDITION_PROTO3",t[t.EDITION_2023=1e3]="EDITION_2023",t[t.EDITION_2024=1001]="EDITION_2024",t[t.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",t[t.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",t[t.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",t[t.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",t[t.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY",t[t.EDITION_MAX=2147483647]="EDITION_MAX"})(i_||(S.Edition=i_={}));S.EditionSchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,0);var a_;(function(t){t[t.VISIBILITY_UNSET=0]="VISIBILITY_UNSET",t[t.VISIBILITY_LOCAL=1]="VISIBILITY_LOCAL",t[t.VISIBILITY_EXPORT=2]="VISIBILITY_EXPORT"})(a_||(S.SymbolVisibility=a_={}));S.SymbolVisibilitySchema=(0,Oe.enumDesc)(S.file_google_protobuf_descriptor,1)});var Qo=b(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.fromBinary=Cx;Ci.mergeFromBinary=kx;Ci.readField=d_;var Ue=ut(),c_=lr(),ml=Bn(),Di=zr(),Dx=Uc(),l_={readUnknownFields:!0};function u_(t){return t?Object.assign(Object.assign({},l_),t):l_}function Cx(t,e,n){let r=(0,ml.reflect)(t,void 0,!1);return Ym(r,new Di.BinaryReader(e),u_(n),!1,e.byteLength),r.message}function kx(t,e,n,r){return Ym((0,ml.reflect)(t,e,!1),new Di.BinaryReader(n),u_(r),!1,n.byteLength),e}function Ym(t,e,n,r,o){var s;let i=r?e.len:e.pos+o,a,c,u=(s=t.getUnknown())!==null&&s!==void 0?s:[];for(;e.pos<i&&([a,c]=e.tag(),!(r&&c==Di.WireType.EndGroup));){let d=t.findNumber(a);if(!d){let m=e.skip(c,a);n.readUnknownFields&&u.push({no:a,wireType:c,data:m});continue}d_(t,e,d,c,n)}if(r&&(c!=Di.WireType.EndGroup||a!==o))throw new Error("invalid end group tag");u.length>0&&t.setUnknown(u)}function d_(t,e,n,r,o){var s;switch(n.fieldKind){case"scalar":t.set(n,Xo(e,n.scalar));break;case"enum":let i=Xo(e,Ue.ScalarType.INT32);if(n.enum.open)t.set(n,i);else if(n.enum.values.some(c=>c.number===i))t.set(n,i);else if(o.readUnknownFields){let c=[];(0,Dx.varint32write)(i,c);let u=(s=t.getUnknown())!==null&&s!==void 0?s:[];u.push({no:n.number,wireType:r,data:new Uint8Array(c)}),t.setUnknown(u)}break;case"message":t.set(n,Km(e,o,n,t.get(n)));break;case"list":Tx(e,r,t.get(n),o);break;case"map":Ax(e,t.get(n),o);break}}function Ax(t,e,n){let r=e.field(),o,s,i=t.uint32(),a=t.pos+i;for(;t.pos<a;){let[c]=t.tag();switch(c){case 1:o=Xo(t,r.mapKey);break;case 2:switch(r.mapKind){case"scalar":s=Xo(t,r.scalar);break;case"enum":s=t.int32();break;case"message":s=Km(t,n,r);break}break}}if(o===void 0&&(o=(0,c_.scalarZeroValue)(r.mapKey,!1)),s===void 0)switch(r.mapKind){case"scalar":s=(0,c_.scalarZeroValue)(r.scalar,!1);break;case"enum":s=r.enum.values[0].number;break;case"message":s=(0,ml.reflect)(r.message,void 0,!1);break}e.set(o,s)}function Tx(t,e,n,r){var o;let s=n.field();if(s.listKind==="message"){n.add(Km(t,r,s));return}let i=(o=s.scalar)!==null&&o!==void 0?o:Ue.ScalarType.INT32;if(!(e==Di.WireType.LengthDelimited&&i!=Ue.ScalarType.STRING&&i!=Ue.ScalarType.BYTES)){n.add(Xo(t,i));return}let c=t.uint32()+t.pos;for(;t.pos<c;)n.add(Xo(t,i))}function Km(t,e,n,r){let o=n.delimitedEncoding,s=r??(0,ml.reflect)(n.message,void 0,!1);return Ym(s,t,e,o,o?n.number:t.uint32()),s}function Xo(t,e){switch(e){case Ue.ScalarType.STRING:return t.string();case Ue.ScalarType.BOOL:return t.bool();case Ue.ScalarType.DOUBLE:return t.double();case Ue.ScalarType.FLOAT:return t.float();case Ue.ScalarType.INT32:return t.int32();case Ue.ScalarType.INT64:return t.int64();case Ue.ScalarType.UINT64:return t.uint64();case Ue.ScalarType.FIXED64:return t.fixed64();case Ue.ScalarType.BYTES:return t.bytes();case Ue.ScalarType.FIXED32:return t.fixed32();case Ue.ScalarType.SFIXED32:return t.sfixed32();case Ue.ScalarType.SFIXED64:return t.sfixed64();case Ue.ScalarType.SINT64:return t.sint64();case Ue.ScalarType.UINT32:return t.uint32();case Ue.ScalarType.SINT32:return t.sint32()}}});var Qe=b(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.fileDesc=Px;var Fx=bi(),Ox=mr(),Ix=ll(),Nx=$m(),xx=Qo();function Px(t,e){var n;let r=(0,xx.fromBinary)(Ox.FileDescriptorProtoSchema,(0,Fx.base64Decode)(t));return r.messageType.forEach(Nx.restoreJsonNames),r.dependency=(n=e?.map(s=>s.proto.name))!==null&&n!==void 0?n:[],(0,Ix.createFileRegistry)(r,s=>e?.find(i=>i.proto.name===s)).getFile(r.name)}});var Zm=b(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.TimestampSchema=Zr.file_google_protobuf_timestamp=void 0;var Rx=Qe(),jx=Xe();Zr.file_google_protobuf_timestamp=(0,Rx.fileDesc)("Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJvdG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MYAiABKAVChQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3RvUAFaMmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3RpbWVzdGFtcHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");Zr.TimestampSchema=(0,jx.messageDesc)(Zr.file_google_protobuf_timestamp,0)});var g_=b(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.timestampNow=Mx;Xr.timestampFromDate=f_;Xr.timestampDate=Ux;Xr.timestampFromMs=m_;Xr.timestampMs=p_;var $x=Zm(),Lx=ur(),Bx=pn();function Mx(){return f_(new Date)}function f_(t){return m_(t.getTime())}function Ux(t){return new Date(p_(t))}function m_(t){let e=Math.floor(t/1e3);return(0,Lx.create)($x.TimestampSchema,{seconds:Bx.protoInt64.parse(e),nanos:(t-e*1e3)*1e6})}function p_(t){return Number(t.seconds)*1e3+Math.round(t.nanos/1e6)}});var Xm=b(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.DurationSchema=Qr.file_google_protobuf_duration=void 0;var Gx=Qe(),Vx=Xe();Qr.file_google_protobuf_duration=(0,Gx.fileDesc)("Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIgASgFQoMBChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvUAFaMWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2R1cmF0aW9ucGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw");Qr.DurationSchema=(0,Vx.messageDesc)(Qr.file_google_protobuf_duration,0)});var h_=b(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.durationFromMs=Jx;pl.durationMs=Yx;var qx=Xm(),Hx=ur(),Wx=pn();function Jx(t){let e=t<0?-1:1,n=Math.abs(t),r=Math.floor(n/1e3),o=(n-r*1e3)*1e6;return(0,Hx.create)(qx.DurationSchema,{seconds:Wx.protoInt64.parse(r*e),nanos:o===0?0:o*e})}function Yx(t){return Number(t.seconds)*1e3+Math.round(t.nanos/1e6)}});var gl=b(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.AnySchema=eo.file_google_protobuf_any=void 0;var Kx=Qe(),zx=Xe();eo.file_google_protobuf_any=(0,Kx.fileDesc)("Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiJgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnYKE2NvbS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2FueXBiogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");eo.AnySchema=(0,zx.messageDesc)(eo.file_google_protobuf_any,0)});var es=b(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.toBinary=eP;bl.writeField=b_;var Zx=Bn(),Zt=zr(),pe=ut(),Xx=3,y_={writeUnknownFields:!0};function Qx(t){return t?Object.assign(Object.assign({},y_),t):y_}function eP(t,e,n){return hl(new Zt.BinaryWriter,Qx(n),(0,Zx.reflect)(t,e)).finish()}function hl(t,e,n){var r;for(let o of n.sortedFields){if(!n.isSet(o)){if(o.presence==Xx)throw new Error(`cannot encode ${o} to binary: required field not set`);continue}b_(t,e,n,o)}if(e.writeUnknownFields)for(let{no:o,wireType:s,data:i}of(r=n.getUnknown())!==null&&r!==void 0?r:[])t.tag(o,s).raw(i);return t}function b_(t,e,n,r){var o;switch(r.fieldKind){case"scalar":case"enum":yl(t,n.desc.typeName,r.name,(o=r.scalar)!==null&&o!==void 0?o:pe.ScalarType.INT32,r.number,n.get(r));break;case"list":tP(t,e,r,n.get(r));break;case"message":v_(t,e,r,n.get(r));break;case"map":for(let[s,i]of n.get(r))nP(t,e,r,s,i);break}}function yl(t,e,n,r,o,s){S_(t.tag(o,rP(r)),e,n,r,s)}function v_(t,e,n,r){n.delimitedEncoding?hl(t.tag(n.number,Zt.WireType.StartGroup),e,r).tag(n.number,Zt.WireType.EndGroup):hl(t.tag(n.number,Zt.WireType.LengthDelimited).fork(),e,r).join()}function tP(t,e,n,r){var o;if(n.listKind=="message"){for(let i of r)v_(t,e,n,i);return}let s=(o=n.scalar)!==null&&o!==void 0?o:pe.ScalarType.INT32;if(n.packed){if(!r.size)return;t.tag(n.number,Zt.WireType.LengthDelimited).fork();for(let i of r)S_(t,n.parent.typeName,n.name,s,i);t.join();return}for(let i of r)yl(t,n.parent.typeName,n.name,s,n.number,i)}function nP(t,e,n,r,o){var s;switch(t.tag(n.number,Zt.WireType.LengthDelimited).fork(),yl(t,n.parent.typeName,n.name,n.mapKey,1,r),n.mapKind){case"scalar":case"enum":yl(t,n.parent.typeName,n.name,(s=n.scalar)!==null&&s!==void 0?s:pe.ScalarType.INT32,2,o);break;case"message":hl(t.tag(2,Zt.WireType.LengthDelimited).fork(),e,o).join();break}t.join()}function S_(t,e,n,r,o){try{switch(r){case pe.ScalarType.STRING:t.string(o);break;case pe.ScalarType.BOOL:t.bool(o);break;case pe.ScalarType.DOUBLE:t.double(o);break;case pe.ScalarType.FLOAT:t.float(o);break;case pe.ScalarType.INT32:t.int32(o);break;case pe.ScalarType.INT64:t.int64(o);break;case pe.ScalarType.UINT64:t.uint64(o);break;case pe.ScalarType.FIXED64:t.fixed64(o);break;case pe.ScalarType.BYTES:t.bytes(o);break;case pe.ScalarType.FIXED32:t.fixed32(o);break;case pe.ScalarType.SFIXED32:t.sfixed32(o);break;case pe.ScalarType.SFIXED64:t.sfixed64(o);break;case pe.ScalarType.SINT64:t.sint64(o);break;case pe.ScalarType.UINT32:t.uint32(o);break;case pe.ScalarType.SINT32:t.sint32(o);break}}catch(s){throw s instanceof Error?new Error(`cannot encode field ${e}.${n} to binary: ${s.message}`):s}}function rP(t){switch(t){case pe.ScalarType.BYTES:case pe.ScalarType.STRING:return Zt.WireType.LengthDelimited;case pe.ScalarType.DOUBLE:case pe.ScalarType.FIXED64:case pe.ScalarType.SFIXED64:return Zt.WireType.Bit64;case pe.ScalarType.FIXED32:case pe.ScalarType.SFIXED32:case pe.ScalarType.FLOAT:return Zt.WireType.Bit32;default:return Zt.WireType.Varint}}});var E_=b(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.anyPack=aP;ts.anyIs=Qm;ts.anyUnpack=cP;ts.anyUnpackTo=lP;var oP=gl(),sP=ur(),iP=es(),__=Qo();function aP(t,e,n){let r=!1;return n||(n=(0,sP.create)(oP.AnySchema),r=!0),n.value=(0,iP.toBinary)(t,e),n.typeUrl=uP(e.$typeName),r?n:void 0}function Qm(t,e){if(t.typeUrl==="")return!1;let n=typeof e=="string"?e:e.typeName,r=w_(t.typeUrl);return n===r}function cP(t,e){if(t.typeUrl==="")return;let n=e.kind=="message"?e:e.getMessage(w_(t.typeUrl));if(!(!n||!Qm(t,n)))return(0,__.fromBinary)(n,t.value)}function lP(t,e,n){if(Qm(t,e))return(0,__.mergeFromBinary)(e,n,t.value)}function uP(t){return`type.googleapis.com/${t}`}function w_(t){let e=t.lastIndexOf("/"),n=e>=0?t.substring(e+1):t;if(!n.length)throw new Error(`invalid type url: ${t}`);return n}});var vl=b(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.SourceContextSchema=to.file_google_protobuf_source_context=void 0;var dP=Qe(),fP=Xe();to.file_google_protobuf_source_context=(0,dP.fileDesc)("CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEoCUKKAQoTY29tLmdvb2dsZS5wcm90b2J1ZkISU291cmNlQ29udGV4dFByb3RvUAFaNmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3NvdXJjZWNvbnRleHRwYqICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z");to.SourceContextSchema=(0,fP.messageDesc)(to.file_google_protobuf_source_context,0)});var tp=b(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.SyntaxSchema=Q.Syntax=Q.OptionSchema=Q.EnumValueSchema=Q.EnumSchema=Q.Field_CardinalitySchema=Q.Field_Cardinality=Q.Field_KindSchema=Q.Field_Kind=Q.FieldSchema=Q.TypeSchema=Q.file_google_protobuf_type=void 0;var mP=Qe(),pP=gl(),gP=vl(),ki=Xe(),ep=yn();Q.file_google_protobuf_type=(0,mP.fileDesc)("Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIugBCgRUeXBlEgwKBG5hbWUYASABKAkSJgoGZmllbGRzGAIgAygLMhYuZ29vZ2xlLnByb3RvYnVmLkZpZWxkEg4KBm9uZW9mcxgDIAMoCRIoCgdvcHRpb25zGAQgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2VfY29udGV4dBgFIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0EicKBnN5bnRheBgGIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5TeW50YXgSDwoHZWRpdGlvbhgHIAEoCSLVBQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2dsZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIuZ29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgDIAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9mX2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAkSFQoNZGVmYXVsdF92YWx1ZRgLIAEoCSLIAgoES2luZBIQCgxUWVBFX1VOS05PV04QABIPCgtUWVBFX0RPVUJMRRABEg4KClRZUEVfRkxPQVQQAhIOCgpUWVBFX0lOVDY0EAMSDwoLVFlQRV9VSU5UNjQQBBIOCgpUWVBFX0lOVDMyEAUSEAoMVFlQRV9GSVhFRDY0EAYSEAoMVFlQRV9GSVhFRDMyEAcSDQoJVFlQRV9CT09MEAgSDwoLVFlQRV9TVFJJTkcQCRIOCgpUWVBFX0dST1VQEAoSEAoMVFlQRV9NRVNTQUdFEAsSDgoKVFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJVFlQRV9FTlVNEA4SEQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVENjQQEBIPCgtUWVBFX1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIidAoLQ2FyZGluYWxpdHkSFwoTQ0FSRElOQUxJVFlfVU5LTk9XThAAEhgKFENBUkRJTkFMSVRZX09QVElPTkFMEAESGAoUQ0FSRElOQUxJVFlfUkVRVUlSRUQQAhIYChRDQVJESU5BTElUWV9SRVBFQVRFRBADIt8BCgRFbnVtEgwKBG5hbWUYASABKAkSLQoJZW51bXZhbHVlGAIgAygLMhouZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1ZRIoCgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2Cg5zb3VyY2VfY29udGV4dBgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb250ZXh0EicKBnN5bnRheBgFIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5TeW50YXgSDwoHZWRpdGlvbhgGIAEoCSJTCglFbnVtVmFsdWUSDAoEbmFtZRgBIAEoCRIOCgZudW1iZXIYAiABKAUSKAoHb3B0aW9ucxgDIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb24iOwoGT3B0aW9uEgwKBG5hbWUYASABKAkSIwoFdmFsdWUYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55KkMKBlN5bnRheBIRCg1TWU5UQVhfUFJPVE8yEAASEQoNU1lOVEFYX1BST1RPMxABEhMKD1NZTlRBWF9FRElUSU9OUxACQnsKE2NvbS5nb29nbGUucHJvdG9idWZCCVR5cGVQcm90b1ABWi1nb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi90eXBlcGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw",[pP.file_google_protobuf_any,gP.file_google_protobuf_source_context]);Q.TypeSchema=(0,ki.messageDesc)(Q.file_google_protobuf_type,0);Q.FieldSchema=(0,ki.messageDesc)(Q.file_google_protobuf_type,1);var D_;(function(t){t[t.TYPE_UNKNOWN=0]="TYPE_UNKNOWN",t[t.TYPE_DOUBLE=1]="TYPE_DOUBLE",t[t.TYPE_FLOAT=2]="TYPE_FLOAT",t[t.TYPE_INT64=3]="TYPE_INT64",t[t.TYPE_UINT64=4]="TYPE_UINT64",t[t.TYPE_INT32=5]="TYPE_INT32",t[t.TYPE_FIXED64=6]="TYPE_FIXED64",t[t.TYPE_FIXED32=7]="TYPE_FIXED32",t[t.TYPE_BOOL=8]="TYPE_BOOL",t[t.TYPE_STRING=9]="TYPE_STRING",t[t.TYPE_GROUP=10]="TYPE_GROUP",t[t.TYPE_MESSAGE=11]="TYPE_MESSAGE",t[t.TYPE_BYTES=12]="TYPE_BYTES",t[t.TYPE_UINT32=13]="TYPE_UINT32",t[t.TYPE_ENUM=14]="TYPE_ENUM",t[t.TYPE_SFIXED32=15]="TYPE_SFIXED32",t[t.TYPE_SFIXED64=16]="TYPE_SFIXED64",t[t.TYPE_SINT32=17]="TYPE_SINT32",t[t.TYPE_SINT64=18]="TYPE_SINT64"})(D_||(Q.Field_Kind=D_={}));Q.Field_KindSchema=(0,ep.enumDesc)(Q.file_google_protobuf_type,1,0);var C_;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.OPTIONAL=1]="OPTIONAL",t[t.REQUIRED=2]="REQUIRED",t[t.REPEATED=3]="REPEATED"})(C_||(Q.Field_Cardinality=C_={}));Q.Field_CardinalitySchema=(0,ep.enumDesc)(Q.file_google_protobuf_type,1,1);Q.EnumSchema=(0,ki.messageDesc)(Q.file_google_protobuf_type,2);Q.EnumValueSchema=(0,ki.messageDesc)(Q.file_google_protobuf_type,3);Q.OptionSchema=(0,ki.messageDesc)(Q.file_google_protobuf_type,4);var k_;(function(t){t[t.PROTO2=0]="PROTO2",t[t.PROTO3=1]="PROTO3",t[t.EDITIONS=2]="EDITIONS"})(k_||(Q.Syntax=k_={}));Q.SyntaxSchema=(0,ep.enumDesc)(Q.file_google_protobuf_type,0)});var A_=b(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.MixinSchema=Tt.MethodSchema=Tt.ApiSchema=Tt.file_google_protobuf_api=void 0;var hP=Qe(),yP=vl(),bP=tp(),np=Xe();Tt.file_google_protobuf_api=(0,hP.fileDesc)("Chlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvEg9nb29nbGUucHJvdG9idWYikgIKA0FwaRIMCgRuYW1lGAEgASgJEigKB21ldGhvZHMYAiADKAsyFy5nb29nbGUucHJvdG9idWYuTWV0aG9kEigKB29wdGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9uEg8KB3ZlcnNpb24YBCABKAkSNgoOc291cmNlX2NvbnRleHQYBSABKAsyHi5nb29nbGUucHJvdG9idWYuU291cmNlQ29udGV4dBImCgZtaXhpbnMYBiADKAsyFi5nb29nbGUucHJvdG9idWYuTWl4aW4SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRheBIPCgdlZGl0aW9uGAggASgJIu4BCgZNZXRob2QSDAoEbmFtZRgBIAEoCRIYChByZXF1ZXN0X3R5cGVfdXJsGAIgASgJEhkKEXJlcXVlc3Rfc3RyZWFtaW5nGAMgASgIEhkKEXJlc3BvbnNlX3R5cGVfdXJsGAQgASgJEhoKEnJlc3BvbnNlX3N0cmVhbWluZxgFIAEoCBIoCgdvcHRpb25zGAYgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIrCgZzeW50YXgYByABKA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4QgIYARITCgdlZGl0aW9uGAggASgJQgIYASIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCdgoTY29tLmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAVosZ29vZ2xlLmdvbGFuZy5vcmcvcHJvdG9idWYvdHlwZXMva25vd24vYXBpcGKiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw",[yP.file_google_protobuf_source_context,bP.file_google_protobuf_type]);Tt.ApiSchema=(0,np.messageDesc)(Tt.file_google_protobuf_api,0);Tt.MethodSchema=(0,np.messageDesc)(Tt.file_google_protobuf_api,1);Tt.MixinSchema=(0,np.messageDesc)(Tt.file_google_protobuf_api,2)});var Ai=b(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});rp.extDesc=vP;function vP(t,e,...n){if(n.length==0)return t.extensions[e];let r=n.pop();return n.reduce((o,s)=>o.nestedMessages[s],t.messages[e]).nestedExtensions[r]}});var F_=b(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.cpp=dt.CppFeatures_StringTypeSchema=dt.CppFeatures_StringType=dt.CppFeaturesSchema=dt.file_google_protobuf_cpp_features=void 0;var SP=Qe(),_P=mr(),wP=Xe(),EP=yn(),DP=Ai();dt.file_google_protobuf_cpp_features=(0,SP.fileDesc)("CiJnb29nbGUvcHJvdG9idWYvY3BwX2ZlYXR1cmVzLnByb3RvEgJwYiL8AwoLQ3BwRmVhdHVyZXMS+wEKEmxlZ2FjeV9jbG9zZWRfZW51bRgBIAEoCELeAYgBAZgBBJgBAaIBCRIEdHJ1ZRiEB6IBChIFZmFsc2UY5weyAbgBCOgHEOgHGq8BVGhlIGxlZ2FjeSBjbG9zZWQgZW51bSBiZWhhdmlvciBpbiBDKysgaXMgZGVwcmVjYXRlZCBhbmQgaXMgc2NoZWR1bGVkIHRvIGJlIHJlbW92ZWQgaW4gZWRpdGlvbiAyMDI1LiAgU2VlIGh0dHA6Ly9wcm90b2J1Zi5kZXYvcHJvZ3JhbW1pbmctZ3VpZGVzL2VudW0vI2NwcCBmb3IgbW9yZSBpbmZvcm1hdGlvbhJaCgtzdHJpbmdfdHlwZRgCIAEoDjIaLnBiLkNwcEZlYXR1cmVzLlN0cmluZ1R5cGVCKYgBAZgBBJgBAaIBCxIGU1RSSU5HGIQHogEJEgRWSUVXGOkHsgEDCOgHEkwKGmVudW1fbmFtZV91c2VzX3N0cmluZ192aWV3GAMgASgIQiiIAQGYAQaYAQGiAQoSBWZhbHNlGIQHogEJEgR0cnVlGOkHsgEDCOkHIkUKClN0cmluZ1R5cGUSFwoTU1RSSU5HX1RZUEVfVU5LTk9XThAAEggKBFZJRVcQARIICgRDT1JEEAISCgoGU1RSSU5HEAM6PwoDY3BwEhsuZ29vZ2xlLnByb3RvYnVmLkZlYXR1cmVTZXQY6AcgASgLMg8ucGIuQ3BwRmVhdHVyZXNSA2NwcA",[_P.file_google_protobuf_descriptor]);dt.CppFeaturesSchema=(0,wP.messageDesc)(dt.file_google_protobuf_cpp_features,0);var T_;(function(t){t[t.STRING_TYPE_UNKNOWN=0]="STRING_TYPE_UNKNOWN",t[t.VIEW=1]="VIEW",t[t.CORD=2]="CORD",t[t.STRING=3]="STRING"})(T_||(dt.CppFeatures_StringType=T_={}));dt.CppFeatures_StringTypeSchema=(0,EP.enumDesc)(dt.file_google_protobuf_cpp_features,0,0);dt.cpp=(0,DP.extDesc)(dt.file_google_protobuf_cpp_features,0)});var O_=b(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.EmptySchema=no.file_google_protobuf_empty=void 0;var CP=Qe(),kP=Xe();no.file_google_protobuf_empty=(0,CP.fileDesc)("Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIHCgVFbXB0eUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3RvUAFaLmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2VtcHR5cGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw");no.EmptySchema=(0,kP.messageDesc)(no.file_google_protobuf_empty,0)});var I_=b(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.FieldMaskSchema=ro.file_google_protobuf_field_mask=void 0;var AP=Qe(),TP=Xe();ro.file_google_protobuf_field_mask=(0,AP.fileDesc)("CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUKFAQoTY29tLmdvb2dsZS5wcm90b2J1ZkIORmllbGRNYXNrUHJvdG9QAVoyZ29vZ2xlLmdvbGFuZy5vcmcvcHJvdG9idWYvdHlwZXMva25vd24vZmllbGRtYXNrcGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw");ro.FieldMaskSchema=(0,TP.messageDesc)(ro.file_google_protobuf_field_mask,0)});var R_=b(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.go=Ie.GoFeatures_StripEnumPrefixSchema=Ie.GoFeatures_StripEnumPrefix=Ie.GoFeatures_APILevelSchema=Ie.GoFeatures_APILevel=Ie.GoFeaturesSchema=Ie.file_google_protobuf_go_features=void 0;var FP=Qe(),OP=mr(),IP=Xe(),P_=yn(),NP=Ai();Ie.file_google_protobuf_go_features=(0,FP.fileDesc)("CiFnb29nbGUvcHJvdG9idWYvZ29fZmVhdHVyZXMucHJvdG8SAnBiIvcECgpHb0ZlYXR1cmVzEqUBChpsZWdhY3lfdW5tYXJzaGFsX2pzb25fZW51bRgBIAEoCEKAAYgBAZgBBpgBAaIBCRIEdHJ1ZRiEB6IBChIFZmFsc2UY5weyAVsI6AcQ6AcaU1RoZSBsZWdhY3kgVW5tYXJzaGFsSlNPTiBBUEkgaXMgZGVwcmVjYXRlZCBhbmQgd2lsbCBiZSByZW1vdmVkIGluIGEgZnV0dXJlIGVkaXRpb24uEmoKCWFwaV9sZXZlbBgCIAEoDjIXLnBiLkdvRmVhdHVyZXMuQVBJTGV2ZWxCPogBAZgBA5gBAaIBGhIVQVBJX0xFVkVMX1VOU1BFQ0lGSUVEGIQHogEPEgpBUElfT1BBUVVFGOkHsgEDCOgHEmsKEXN0cmlwX2VudW1fcHJlZml4GAMgASgOMh4ucGIuR29GZWF0dXJlcy5TdHJpcEVudW1QcmVmaXhCMIgBAZgBBpgBB5gBAaIBGxIWU1RSSVBfRU5VTV9QUkVGSVhfS0VFUBiEB7IBAwjpByJTCghBUElMZXZlbBIZChVBUElfTEVWRUxfVU5TUEVDSUZJRUQQABIMCghBUElfT1BFThABEg4KCkFQSV9IWUJSSUQQAhIOCgpBUElfT1BBUVVFEAMikgEKD1N0cmlwRW51bVByZWZpeBIhCh1TVFJJUF9FTlVNX1BSRUZJWF9VTlNQRUNJRklFRBAAEhoKFlNUUklQX0VOVU1fUFJFRklYX0tFRVAQARIjCh9TVFJJUF9FTlVNX1BSRUZJWF9HRU5FUkFURV9CT1RIEAISGwoXU1RSSVBfRU5VTV9QUkVGSVhfU1RSSVAQAzo8CgJnbxIbLmdvb2dsZS5wcm90b2J1Zi5GZWF0dXJlU2V0GOoHIAEoCzIOLnBiLkdvRmVhdHVyZXNSAmdvQi9aLWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2dvZmVhdHVyZXNwYg",[OP.file_google_protobuf_descriptor]);Ie.GoFeaturesSchema=(0,IP.messageDesc)(Ie.file_google_protobuf_go_features,0);var N_;(function(t){t[t.API_LEVEL_UNSPECIFIED=0]="API_LEVEL_UNSPECIFIED",t[t.API_OPEN=1]="API_OPEN",t[t.API_HYBRID=2]="API_HYBRID",t[t.API_OPAQUE=3]="API_OPAQUE"})(N_||(Ie.GoFeatures_APILevel=N_={}));Ie.GoFeatures_APILevelSchema=(0,P_.enumDesc)(Ie.file_google_protobuf_go_features,0,0);var x_;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.KEEP=1]="KEEP",t[t.GENERATE_BOTH=2]="GENERATE_BOTH",t[t.STRIP=3]="STRIP"})(x_||(Ie.GoFeatures_StripEnumPrefix=x_={}));Ie.GoFeatures_StripEnumPrefixSchema=(0,P_.enumDesc)(Ie.file_google_protobuf_go_features,0,1);Ie.go=(0,NP.extDesc)(Ie.file_google_protobuf_go_features,0)});var M_=b(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.java=Ce.JavaFeatures_Utf8ValidationSchema=Ce.JavaFeatures_Utf8Validation=Ce.JavaFeatures_NestInFileClassFeature_NestInFileClassSchema=Ce.JavaFeatures_NestInFileClassFeature_NestInFileClass=Ce.JavaFeatures_NestInFileClassFeatureSchema=Ce.JavaFeaturesSchema=Ce.file_google_protobuf_java_features=void 0;var xP=Qe(),PP=mr(),L_=Xe(),B_=yn(),RP=Ai();Ce.file_google_protobuf_java_features=(0,xP.fileDesc)("CiNnb29nbGUvcHJvdG9idWYvamF2YV9mZWF0dXJlcy5wcm90bxICcGIigwgKDEphdmFGZWF0dXJlcxL+AQoSbGVnYWN5X2Nsb3NlZF9lbnVtGAEgASgIQuEBiAEBmAEEmAEBogEJEgR0cnVlGIQHogEKEgVmYWxzZRjnB7IBuwEI6AcQ6AcasgFUaGUgbGVnYWN5IGNsb3NlZCBlbnVtIGJlaGF2aW9yIGluIEphdmEgaXMgZGVwcmVjYXRlZCBhbmQgaXMgc2NoZWR1bGVkIHRvIGJlIHJlbW92ZWQgaW4gZWRpdGlvbiAyMDI1LiAgU2VlIGh0dHA6Ly9wcm90b2J1Zi5kZXYvcHJvZ3JhbW1pbmctZ3VpZGVzL2VudW0vI2phdmEgZm9yIG1vcmUgaW5mb3JtYXRpb24uEp8CCg91dGY4X3ZhbGlkYXRpb24YAiABKA4yHy5wYi5KYXZhRmVhdHVyZXMuVXRmOFZhbGlkYXRpb25C5AGIAQGYAQSYAQGiAQwSB0RFRkFVTFQYhAeyAcgBCOgHEOkHGr8BVGhlIEphdmEtc3BlY2lmaWMgdXRmOCB2YWxpZGF0aW9uIGZlYXR1cmUgaXMgZGVwcmVjYXRlZCBhbmQgaXMgc2NoZWR1bGVkIHRvIGJlIHJlbW92ZWQgaW4gZWRpdGlvbiAyMDI1LiAgVXRmOCB2YWxpZGF0aW9uIGJlaGF2aW9yIHNob3VsZCB1c2UgdGhlIGdsb2JhbCBjcm9zcy1sYW5ndWFnZSB1dGY4X3ZhbGlkYXRpb24gZmVhdHVyZS4SMAoKbGFyZ2VfZW51bRgDIAEoCEIciAEBmAEGmAEBogEKEgVmYWxzZRiEB7IBAwjpBxJRCh91c2Vfb2xkX291dGVyX2NsYXNzbmFtZV9kZWZhdWx0GAQgASgIQiiIAQGYAQGiAQkSBHRydWUYhAeiAQoSBWZhbHNlGOkHsgEGCOkHIOkHEn8KEm5lc3RfaW5fZmlsZV9jbGFzcxgFIAEoDjI3LnBiLkphdmFGZWF0dXJlcy5OZXN0SW5GaWxlQ2xhc3NGZWF0dXJlLk5lc3RJbkZpbGVDbGFzc0IqiAEBmAEDmAEGmAEIogELEgZMRUdBQ1kYhAeiAQcSAk5PGOkHsgEDCOkHGnwKFk5lc3RJbkZpbGVDbGFzc0ZlYXR1cmUiWAoPTmVzdEluRmlsZUNsYXNzEh4KGk5FU1RfSU5fRklMRV9DTEFTU19VTktOT1dOEAASBgoCTk8QARIHCgNZRVMQAhIUCgZMRUdBQ1kQAxoIIgYI6Qcg6QdKCAgBEICAgIACIkYKDlV0ZjhWYWxpZGF0aW9uEhsKF1VURjhfVkFMSURBVElPTl9VTktOT1dOEAASCwoHREVGQVVMVBABEgoKBlZFUklGWRACSgQIBhAHOkIKBGphdmESGy5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldBjpByABKAsyEC5wYi5KYXZhRmVhdHVyZXNSBGphdmFCKAoTY29tLmdvb2dsZS5wcm90b2J1ZkIRSmF2YUZlYXR1cmVzUHJvdG8",[PP.file_google_protobuf_descriptor]);Ce.JavaFeaturesSchema=(0,L_.messageDesc)(Ce.file_google_protobuf_java_features,0);Ce.JavaFeatures_NestInFileClassFeatureSchema=(0,L_.messageDesc)(Ce.file_google_protobuf_java_features,0,0);var j_;(function(t){t[t.NEST_IN_FILE_CLASS_UNKNOWN=0]="NEST_IN_FILE_CLASS_UNKNOWN",t[t.NO=1]="NO",t[t.YES=2]="YES",t[t.LEGACY=3]="LEGACY"})(j_||(Ce.JavaFeatures_NestInFileClassFeature_NestInFileClass=j_={}));Ce.JavaFeatures_NestInFileClassFeature_NestInFileClassSchema=(0,B_.enumDesc)(Ce.file_google_protobuf_java_features,0,0,0);var $_;(function(t){t[t.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",t[t.DEFAULT=1]="DEFAULT",t[t.VERIFY=2]="VERIFY"})($_||(Ce.JavaFeatures_Utf8Validation=$_={}));Ce.JavaFeatures_Utf8ValidationSchema=(0,B_.enumDesc)(Ce.file_google_protobuf_java_features,0,0);Ce.java=(0,RP.extDesc)(Ce.file_google_protobuf_java_features,0)});var G_=b(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.NullValueSchema=Je.NullValue=Je.ListValueSchema=Je.ValueSchema=Je.StructSchema=Je.file_google_protobuf_struct=void 0;var jP=Qe(),op=Xe(),$P=yn();Je.file_google_protobuf_struct=(0,jP.fileDesc)("Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9idWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9idWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgBIAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToCOAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJvdG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoMc3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8KDHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RIABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RWYWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9WQUxVRRAAQn8KE2NvbS5nb29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAFaL2dvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3N0cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");Je.StructSchema=(0,op.messageDesc)(Je.file_google_protobuf_struct,0);Je.ValueSchema=(0,op.messageDesc)(Je.file_google_protobuf_struct,1);Je.ListValueSchema=(0,op.messageDesc)(Je.file_google_protobuf_struct,2);var U_;(function(t){t[t.NULL_VALUE=0]="NULL_VALUE"})(U_||(Je.NullValue=U_={}));Je.NullValueSchema=(0,$P.enumDesc)(Je.file_google_protobuf_struct,0)});var V_=b(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.BytesValueSchema=ae.StringValueSchema=ae.BoolValueSchema=ae.UInt32ValueSchema=ae.Int32ValueSchema=ae.UInt64ValueSchema=ae.Int64ValueSchema=ae.FloatValueSchema=ae.DoubleValueSchema=ae.file_google_protobuf_wrappers=void 0;var LP=Qe(),Gn=Xe();ae.file_google_protobuf_wrappers=(0,LP.fileDesc)("Ch5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIcCgtEb3VibGVWYWx1ZRINCgV2YWx1ZRgBIAEoASIbCgpGbG9hdFZhbHVlEg0KBXZhbHVlGAEgASgCIhsKCkludDY0VmFsdWUSDQoFdmFsdWUYASABKAMiHAoLVUludDY0VmFsdWUSDQoFdmFsdWUYASABKAQiGwoKSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEoBSIcCgtVSW50MzJWYWx1ZRINCgV2YWx1ZRgBIAEoDSIaCglCb29sVmFsdWUSDQoFdmFsdWUYASABKAgiHAoLU3RyaW5nVmFsdWUSDQoFdmFsdWUYASABKAkiGwoKQnl0ZXNWYWx1ZRINCgV2YWx1ZRgBIAEoDEKDAQoTY29tLmdvb2dsZS5wcm90b2J1ZkINV3JhcHBlcnNQcm90b1ABWjFnb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi93cmFwcGVyc3Bi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM");ae.DoubleValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,0);ae.FloatValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,1);ae.Int64ValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,2);ae.UInt64ValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,3);ae.Int32ValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,4);ae.UInt32ValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,5);ae.BoolValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,6);ae.StringValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,7);ae.BytesValueSchema=(0,Gn.messageDesc)(ae.file_google_protobuf_wrappers,8)});var H_=b(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.CodeGeneratorResponse_FeatureSchema=Fe.CodeGeneratorResponse_Feature=Fe.CodeGeneratorResponse_FileSchema=Fe.CodeGeneratorResponseSchema=Fe.CodeGeneratorRequestSchema=Fe.VersionSchema=Fe.file_google_protobuf_compiler_plugin=void 0;var BP=Qe(),MP=mr(),Sl=Xe(),UP=yn();Fe.file_google_protobuf_compiler_plugin=(0,BP.fileDesc)("CiVnb29nbGUvcHJvdG9idWYvY29tcGlsZXIvcGx1Z2luLnByb3RvEhhnb29nbGUucHJvdG9idWYuY29tcGlsZXIiRgoHVmVyc2lvbhINCgVtYWpvchgBIAEoBRINCgVtaW5vchgCIAEoBRINCgVwYXRjaBgDIAEoBRIOCgZzdWZmaXgYBCABKAkigQIKFENvZGVHZW5lcmF0b3JSZXF1ZXN0EhgKEGZpbGVfdG9fZ2VuZXJhdGUYASADKAkSEQoJcGFyYW1ldGVyGAIgASgJEjgKCnByb3RvX2ZpbGUYDyADKAsyJC5nb29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90bxJFChdzb3VyY2VfZmlsZV9kZXNjcmlwdG9ycxgRIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5GaWxlRGVzY3JpcHRvclByb3RvEjsKEGNvbXBpbGVyX3ZlcnNpb24YAyABKAsyIS5nb29nbGUucHJvdG9idWYuY29tcGlsZXIuVmVyc2lvbiKSAwoVQ29kZUdlbmVyYXRvclJlc3BvbnNlEg0KBWVycm9yGAEgASgJEhoKEnN1cHBvcnRlZF9mZWF0dXJlcxgCIAEoBBIXCg9taW5pbXVtX2VkaXRpb24YAyABKAUSFwoPbWF4aW11bV9lZGl0aW9uGAQgASgFEkIKBGZpbGUYDyADKAsyNC5nb29nbGUucHJvdG9idWYuY29tcGlsZXIuQ29kZUdlbmVyYXRvclJlc3BvbnNlLkZpbGUafwoERmlsZRIMCgRuYW1lGAEgASgJEhcKD2luc2VydGlvbl9wb2ludBgCIAEoCRIPCgdjb250ZW50GA8gASgJEj8KE2dlbmVyYXRlZF9jb2RlX2luZm8YECABKAsyIi5nb29nbGUucHJvdG9idWYuR2VuZXJhdGVkQ29kZUluZm8iVwoHRmVhdHVyZRIQCgxGRUFUVVJFX05PTkUQABIbChdGRUFUVVJFX1BST1RPM19PUFRJT05BTBABEh0KGUZFQVRVUkVfU1VQUE9SVFNfRURJVElPTlMQAkJyChxjb20uZ29vZ2xlLnByb3RvYnVmLmNvbXBpbGVyQgxQbHVnaW5Qcm90b3NaKWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL3BsdWdpbnBiqgIYR29vZ2xlLlByb3RvYnVmLkNvbXBpbGVy",[MP.file_google_protobuf_descriptor]);Fe.VersionSchema=(0,Sl.messageDesc)(Fe.file_google_protobuf_compiler_plugin,0);Fe.CodeGeneratorRequestSchema=(0,Sl.messageDesc)(Fe.file_google_protobuf_compiler_plugin,1);Fe.CodeGeneratorResponseSchema=(0,Sl.messageDesc)(Fe.file_google_protobuf_compiler_plugin,2);Fe.CodeGeneratorResponse_FileSchema=(0,Sl.messageDesc)(Fe.file_google_protobuf_compiler_plugin,2,0);var q_;(function(t){t[t.NONE=0]="NONE",t[t.PROTO3_OPTIONAL=1]="PROTO3_OPTIONAL",t[t.SUPPORTS_EDITIONS=2]="SUPPORTS_EDITIONS"})(q_||(Fe.CodeGeneratorResponse_Feature=q_={}));Fe.CodeGeneratorResponse_FeatureSchema=(0,UP.enumDesc)(Fe.file_google_protobuf_compiler_plugin,2,0)});var bn=b(he=>{"use strict";var GP=he&&he.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Ge=he&&he.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&GP(e,t,n)};Object.defineProperty(he,"__esModule",{value:!0});Ge(g_(),he);Ge(h_(),he);Ge(E_(),he);Ge(Wo(),he);Ge(gl(),he);Ge(A_(),he);Ge(F_(),he);Ge(mr(),he);Ge(Xm(),he);Ge(O_(),he);Ge(I_(),he);Ge(R_(),he);Ge(M_(),he);Ge(vl(),he);Ge(G_(),he);Ge(Zm(),he);Ge(tp(),he);Ge(V_(),he);Ge(H_(),he)});var Ti=b(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.getExtension=J_;Vn.setExtension=YP;Vn.clearExtension=KP;Vn.hasExtension=Y_;Vn.hasOption=zP;Vn.getOption=ZP;Vn.createExtensionContainer=_l;var W_=ur(),VP=Qo(),qP=Bn(),HP=lr(),WP=es(),sp=zr(),JP=Wo();function J_(t,e){ip(e,t);let n=XP(t.$unknown,e),[r,o,s]=_l(e);for(let i of n)(0,VP.readField)(r,new sp.BinaryReader(i.data),o,i.wireType,{readUnknownFields:!0});return s()}function YP(t,e,n){var r;ip(e,t);let o=((r=t.$unknown)!==null&&r!==void 0?r:[]).filter(u=>u.no!==e.number),[s,i]=_l(e,n),a=new sp.BinaryWriter;(0,WP.writeField)(a,{writeUnknownFields:!0},s,i);let c=new sp.BinaryReader(a.finish());for(;c.pos<c.len;){let[u,d]=c.tag(),m=c.skip(d,u);o.push({no:u,wireType:d,data:m})}t.$unknown=o}function KP(t,e){ip(e,t),t.$unknown!==void 0&&(t.$unknown=t.$unknown.filter(n=>n.no!==e.number))}function Y_(t,e){var n;return e.extendee.typeName===t.$typeName&&!!(!((n=t.$unknown)===null||n===void 0)&&n.find(r=>r.no===e.number))}function zP(t,e){let n=t.proto.options;return n?Y_(n,e):!1}function ZP(t,e){let n=t.proto.options;if(!n){let[,,r]=_l(e);return r()}return J_(n,e)}function XP(t,e){if(t===void 0)return[];if(e.fieldKind==="enum"||e.fieldKind==="scalar"){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.number)return[t[n]];return[]}return t.filter(n=>n.no===e.number)}function _l(t,e){let n=t.typeName,r=Object.assign(Object.assign({},t),{kind:"field",parent:t.extendee,localName:n}),o=Object.assign(Object.assign({},t.extendee),{fields:[r],members:[r],oneofs:[]}),s=(0,W_.create)(o,e!==void 0?{[n]:e}:void 0);return[(0,qP.reflect)(o,s),r,()=>{let i=s[n];if(i===void 0){let a=t.message;return(0,JP.isWrapperDesc)(a)?(0,HP.scalarZeroValue)(a.fields[0].scalar,a.fields[0].longAsString):(0,W_.create)(a)}return i}]}function ip(t,e){if(t.extendee.typeName!=e.$typeName)throw new Error(`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}});var ew=b(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.equals=X_;var Fi=lr(),K_=Bn(),Z_=ut(),z_=bn(),wl=Ti();function X_(t,e,n,r){return e.$typeName!=t.typeName||n.$typeName!=t.typeName?!1:e===n?!0:El((0,K_.reflect)(t,e),(0,K_.reflect)(t,n),r)}function El(t,e,n){if(t.desc.typeName==="google.protobuf.Any"&&n?.unpackAny==!0)return QP(t.message,e.message,n);for(let r of t.fields)if(!Q_(r,t,e,n))return!1;return!(n?.unknown==!0&&!eR(t,e,n.registry)||n?.extensions==!0&&!tR(t,e,n))}function Q_(t,e,n,r){if(!e.isSet(t)&&!n.isSet(t))return!0;if(!e.isSet(t)||!n.isSet(t))return!1;switch(t.fieldKind){case"scalar":return(0,Fi.scalarEquals)(t.scalar,e.get(t),n.get(t));case"enum":return e.get(t)===n.get(t);case"message":return El(e.get(t),n.get(t),r);case"map":{let o=e.get(t),s=n.get(t),i=[];for(let a of o.keys()){if(!s.has(a))return!1;i.push(a)}for(let a of s.keys())if(!o.has(a))return!1;for(let a of i){let c=o.get(a),u=s.get(a);if(c!==u)switch(t.mapKind){case"enum":return!1;case"message":if(!El(c,u,r))return!1;break;case"scalar":if(!(0,Fi.scalarEquals)(t.scalar,c,u))return!1;break}}break}case"list":{let o=e.get(t),s=n.get(t);if(o.size!=s.size)return!1;for(let i=0;i<o.size;i++){let a=o.get(i),c=s.get(i);if(a!==c)switch(t.listKind){case"enum":return!1;case"message":if(!El(a,c,r))return!1;break;case"scalar":if(!(0,Fi.scalarEquals)(t.scalar,a,c))return!1;break}}break}}return!0}function QP(t,e,n){if(t.typeUrl!==e.typeUrl)return!1;let r=(0,z_.anyUnpack)(t,n.registry),o=(0,z_.anyUnpack)(e,n.registry);if(r&&o){let s=n.registry.getMessage(r.$typeName);if(s)return X_(s,r,o,n)}return(0,Fi.scalarEquals)(Z_.ScalarType.BYTES,t.value,e.value)}function eR(t,e,n){function r(i,a){var c;let u=(c=i.getUnknown())!==null&&c!==void 0?c:[];return a?u.filter(d=>!a.getExtensionFor(i.desc,d.no)):u}let o=r(t,n),s=r(e,n);if(o.length!=s.length)return!1;for(let i=0;i<o.length;i++){let a=o[i],c=s[i];if(a.no!=c.no||a.wireType!=c.wireType||!(0,Fi.scalarEquals)(Z_.ScalarType.BYTES,a.data,c.data))return!1}return!0}function tR(t,e,n){function r(i,a){var c;return((c=i.getUnknown())!==null&&c!==void 0?c:[]).map(u=>a.getExtensionFor(i.desc,u.no)).filter(u=>u!=null).filter((u,d,m)=>m.indexOf(u)===d)}let o=r(t,n.registry),s=r(e,n.registry);if(o.length!=s.length||o.some(i=>!s.includes(i)))return!1;for(let i of o){let[a,c]=(0,wl.createExtensionContainer)(i,(0,wl.getExtension)(t.message,i)),[u]=(0,wl.createExtensionContainer)(i,(0,wl.getExtension)(e.message,i));if(!Q_(c,a,u,n))return!1}return!0}});var cp=b(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.isFieldSet=nR;Dl.clearField=rR;var tw=Jr();function nR(t,e){return e.parent.typeName==t.$typeName&&(0,tw.unsafeIsSet)(t,e)}function rR(t,e){e.parent.typeName==t.$typeName&&(0,tw.unsafeClear)(t,e)}});var ow=b(Xt=>{"use strict";var oR=Xt&&Xt.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},ns=Xt&&Xt.__await||function(t){return this instanceof ns?(this.v=t,this):new ns(t)},sR=Xt&&Xt.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof ns?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.sizeDelimitedEncode=cR;Xt.sizeDelimitedDecodeStream=lR;Xt.sizeDelimitedPeek=rw;var iR=es(),nw=zr(),aR=Qo();function cR(t,e,n){let r=new nw.BinaryWriter;return r.bytes((0,iR.toBinary)(t,e,n)),r.finish()}function lR(t,e,n){return sR(this,arguments,function*(){var o,s,i,a;function c(f,g){let h=new Uint8Array(f.byteLength+g.byteLength);return h.set(f),h.set(g,f.length),h}let u=new Uint8Array(0);try{for(var d=!0,m=oR(e),p;p=yield ns(m.next()),o=p.done,!o;d=!0)for(a=p.value,d=!1,u=c(u,a);;){let g=rw(u);if(g.eof||g.offset+g.size>u.byteLength)break;yield yield ns((0,aR.fromBinary)(t,u.subarray(g.offset,g.offset+g.size),n)),u=u.subarray(g.offset+g.size)}}catch(f){s={error:f}}finally{try{!d&&!o&&(i=m.return)&&(yield ns(i.call(m)))}finally{if(s)throw s.error}}if(u.byteLength>0)throw new Error("incomplete data")})}function rw(t){let e={eof:!0,size:null,offset:null};for(let n=0;n<10;n++){if(n>t.byteLength)return e;if(!(t[n]&128)){let r=new nw.BinaryReader(t),o;try{o=r.uint32()}catch(s){if(s instanceof RangeError)return e;throw s}return{eof:!1,size:o,offset:r.pos}}}throw new Error("invalid varint")}});var rs=b(Qt=>{"use strict";var uR=Qt&&Qt.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Oi=Qt&&Qt.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&uR(e,t,n)};Object.defineProperty(Qt,"__esModule",{value:!0});Oi(zr(),Qt);Oi(bi(),Qt);Oi(Kc(),Qt);Oi(Bm(),Qt);Oi(ow(),Qt)});var fw=b(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.toJson=lw;Ni.toJsonString=bR;Ni.enumToJson=vR;var ft=ut(),dR=Si(),cw=Bn(),fR=bn(),mR=Wo(),pR=rs(),sw=Ti(),oo=Xc(),gR=3,hR=2,iw={alwaysEmitImplicit:!1,enumAsInteger:!1,useProtoFieldName:!1};function yR(t){return t?Object.assign(Object.assign({},iw),t):iw}function lw(t,e,n){return Ii((0,cw.reflect)(t,e),yR(n))}function bR(t,e,n){var r;let o=lw(t,e,n);return JSON.stringify(o,null,(r=n?.prettySpaces)!==null&&r!==void 0?r:0)}function vR(t,e){var n;if(t.typeName=="google.protobuf.NullValue")return null;let r=(n=t.value[e])===null||n===void 0?void 0:n.name;if(r===void 0)throw new Error(`${e} is not a value in ${t}`);return r}function Ii(t,e){var n;let r=ER(t,e);if(r!==void 0)return r;let o={};for(let s of t.sortedFields){if(!t.isSet(s)){if(s.presence==gR)throw new Error(`cannot encode ${s} to JSON: required field not set`);if(!e.alwaysEmitImplicit||s.presence!==hR)continue}let i=aw(s,t.get(s),e);i!==void 0&&(o[wR(s,e)]=i)}if(e.registry){let s=new Set;for(let{no:i}of(n=t.getUnknown())!==null&&n!==void 0?n:[])if(!s.has(i)){s.add(i);let a=e.registry.getExtensionFor(t.desc,i);if(!a)continue;let c=(0,sw.getExtension)(t.message,a),[u,d]=(0,sw.createExtensionContainer)(a,c),m=aw(d,u.get(d),e);m!==void 0&&(o[a.jsonName]=m)}}return o}function aw(t,e,n){switch(t.fieldKind){case"scalar":return Cl(t,e);case"message":return Ii(e,n);case"enum":return lp(t.enum,e,n.enumAsInteger);case"list":return _R(e,n);case"map":return SR(e,n)}}function SR(t,e){let n=t.field(),r={};switch(n.mapKind){case"scalar":for(let[o,s]of t)r[o]=Cl(n,s);break;case"message":for(let[o,s]of t)r[o]=Ii(s,e);break;case"enum":for(let[o,s]of t)r[o]=lp(n.enum,s,e.enumAsInteger);break}return e.alwaysEmitImplicit||t.size>0?r:void 0}function _R(t,e){let n=t.field(),r=[];switch(n.listKind){case"scalar":for(let o of t)r.push(Cl(n,o));break;case"enum":for(let o of t)r.push(lp(n.enum,o,e.enumAsInteger));break;case"message":for(let o of t)r.push(Ii(o,e));break}return e.alwaysEmitImplicit||r.length>0?r:void 0}function lp(t,e,n){var r;if(typeof e!="number")throw new Error(`cannot encode ${t} to JSON: expected number, got ${(0,oo.formatVal)(e)}`);if(t.typeName=="google.protobuf.NullValue")return null;if(n)return e;let o=t.value[e];return(r=o?.name)!==null&&r!==void 0?r:e}function Cl(t,e){var n,r,o,s,i,a;switch(t.scalar){case ft.ScalarType.INT32:case ft.ScalarType.SFIXED32:case ft.ScalarType.SINT32:case ft.ScalarType.FIXED32:case ft.ScalarType.UINT32:if(typeof e!="number")throw new Error(`cannot encode ${t} to JSON: ${(n=(0,oo.checkField)(t,e))===null||n===void 0?void 0:n.message}`);return e;case ft.ScalarType.FLOAT:case ft.ScalarType.DOUBLE:if(typeof e!="number")throw new Error(`cannot encode ${t} to JSON: ${(r=(0,oo.checkField)(t,e))===null||r===void 0?void 0:r.message}`);return Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case ft.ScalarType.STRING:if(typeof e!="string")throw new Error(`cannot encode ${t} to JSON: ${(o=(0,oo.checkField)(t,e))===null||o===void 0?void 0:o.message}`);return e;case ft.ScalarType.BOOL:if(typeof e!="boolean")throw new Error(`cannot encode ${t} to JSON: ${(s=(0,oo.checkField)(t,e))===null||s===void 0?void 0:s.message}`);return e;case ft.ScalarType.UINT64:case ft.ScalarType.FIXED64:case ft.ScalarType.INT64:case ft.ScalarType.SFIXED64:case ft.ScalarType.SINT64:if(typeof e!="bigint"&&typeof e!="string")throw new Error(`cannot encode ${t} to JSON: ${(i=(0,oo.checkField)(t,e))===null||i===void 0?void 0:i.message}`);return e.toString();case ft.ScalarType.BYTES:if(e instanceof Uint8Array)return(0,pR.base64Encode)(e);throw new Error(`cannot encode ${t} to JSON: ${(a=(0,oo.checkField)(t,e))===null||a===void 0?void 0:a.message}`)}}function wR(t,e){return e.useProtoFieldName?t.name:t.jsonName}function ER(t,e){if(t.desc.typeName.startsWith("google.protobuf."))switch(t.desc.typeName){case"google.protobuf.Any":return DR(t.message,e);case"google.protobuf.Timestamp":return AR(t.message);case"google.protobuf.Duration":return CR(t.message);case"google.protobuf.FieldMask":return kR(t.message);case"google.protobuf.Struct":return uw(t.message);case"google.protobuf.Value":return up(t.message);case"google.protobuf.ListValue":return dw(t.message);default:if((0,mR.isWrapperDesc)(t.desc)){let n=t.desc.fields[0];return Cl(n,t.get(n))}return}}function DR(t,e){if(t.typeUrl==="")return{};let{registry:n}=e,r,o;if(n&&(r=(0,fR.anyUnpack)(t,n),r&&(o=n.getMessage(r.$typeName))),!o||!r)throw new Error(`cannot encode message ${t.$typeName} to JSON: "${t.typeUrl}" is not in the type registry`);let s=Ii((0,cw.reflect)(o,r),e);return(o.typeName.startsWith("google.protobuf.")||s===null||Array.isArray(s)||typeof s!="object")&&(s={value:s}),s["@type"]=t.typeUrl,s}function CR(t){let e=Number(t.seconds),n=t.nanos;if(e>315576e6||e<-315576e6)throw new Error(`cannot encode message ${t.$typeName} to JSON: value out of range`);if(e>0&&n<0||e<0&&n>0)throw new Error(`cannot encode message ${t.$typeName} to JSON: nanos sign must match seconds sign`);let r=t.seconds.toString();if(n!==0){let o=Math.abs(n).toString();o="0".repeat(9-o.length)+o,o.substring(3)==="000000"?o=o.substring(0,3):o.substring(6)==="000"&&(o=o.substring(0,6)),r+="."+o,n<0&&e==0&&(r="-"+r)}return r+"s"}function kR(t){return t.paths.map(e=>{if(e.match(/_[0-9]?_/g)||e.match(/[A-Z]/g))throw new Error(`cannot encode message ${t.$typeName} to JSON: lowerCamelCase of path name "`+e+'" is irreversible');return(0,dR.protoCamelCase)(e)}).join(",")}function uw(t){let e={};for(let[n,r]of Object.entries(t.fields))e[n]=up(r);return e}function up(t){switch(t.kind.case){case"nullValue":return null;case"numberValue":if(!Number.isFinite(t.kind.value))throw new Error(`${t.$typeName} cannot be NaN or Infinity`);return t.kind.value;case"boolValue":return t.kind.value;case"stringValue":return t.kind.value;case"structValue":return uw(t.kind.value);case"listValue":return dw(t.kind.value);default:throw new Error(`${t.$typeName} must have a value`)}}function dw(t){return t.values.map(up)}function AR(t){let e=Number(t.seconds)*1e3;if(e<Date.parse("0001-01-01T00:00:00Z")||e>Date.parse("9999-12-31T23:59:59Z"))throw new Error(`cannot encode message ${t.$typeName} to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);if(t.nanos<0)throw new Error(`cannot encode message ${t.$typeName} to JSON: nanos must not be negative`);if(t.nanos>999999999)throw new Error(`cannot encode message ${t.$typeName} to JSON: nanos must not be greater than 99999999`);let n="Z";if(t.nanos>0){let r=(t.nanos+1e9).toString().substring(1);r.substring(3)==="000000"?n="."+r.substring(0,3)+"Z":r.substring(6)==="000"?n="."+r.substring(0,6)+"Z":n="."+r+"Z"}return new Date(e).toISOString().replace(".000Z",n)}});var Dw=b(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.fromJsonString=OR;pr.mergeFromJsonString=IR;pr.fromJson=bw;pr.mergeFromJson=vw;pr.enumFromJson=NR;pr.isEnumJson=xR;var St=ut(),hw=pn(),kl=ur(),os=Bn(),vn=Wc(),_t=Xc(),TR=lr(),FR=bi(),so=bn(),mw=Ti(),pw={ignoreUnknownFields:!1};function yw(t){return t?Object.assign(Object.assign({},pw),t):pw}function OR(t,e,n){return bw(t,_w(e,t.typeName),n)}function IR(t,e,n,r){return vw(t,e,_w(n,t.typeName),r)}function bw(t,e,n){let r=(0,os.reflect)(t);try{io(r,e,yw(n))}catch(o){throw(0,vn.isFieldError)(o)?new Error(`cannot decode ${o.field()} from JSON: ${o.message}`,{cause:o}):o}return r.message}function vw(t,e,n,r){try{io((0,os.reflect)(t,e),n,yw(r))}catch(o){throw(0,vn.isFieldError)(o)?new Error(`cannot decode ${o.field()} from JSON: ${o.message}`,{cause:o}):o}return e}function NR(t,e){let n=Al(t,e,!1,!1);if(n===xi)throw new Error(`cannot decode ${t} from JSON: ${(0,_t.formatVal)(e)}`);return n}function xR(t,e){return t.values.find(n=>n.name===e)!==void 0}function io(t,e,n){var r;if(MR(t,e,n))return;if(e==null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode ${t.desc} from JSON: ${(0,_t.formatVal)(e)}`);let o=new Map,s=new Map;for(let i of t.desc.fields)s.set(i.name,i).set(i.jsonName,i);for(let[i,a]of Object.entries(e)){let c=s.get(i);if(c){if(c.oneof){if(a===null&&c.fieldKind=="scalar")continue;let u=o.get(c.oneof);if(u!==void 0)throw new vn.FieldError(c.oneof,`oneof set multiple times by ${u.name} and ${c.name}`);o.set(c.oneof,c)}gw(t,c,a,n)}else{let u;if(i.startsWith("[")&&i.endsWith("]")&&(u=(r=n.registry)===null||r===void 0?void 0:r.getExtension(i.substring(1,i.length-1)))&&u.extendee.typeName===t.desc.typeName){let[d,m,p]=(0,mw.createExtensionContainer)(u);gw(d,m,a,n),(0,mw.setExtension)(t.message,u,p())}if(!u&&!n.ignoreUnknownFields)throw new Error(`cannot decode ${t.desc} from JSON: key "${i}" is unknown`)}}}function gw(t,e,n,r){switch(e.fieldKind){case"scalar":LR(t,e,n);break;case"enum":$R(t,e,n,r);break;case"message":jR(t,e,n,r);break;case"list":RR(t.get(e),n,r);break;case"map":PR(t.get(e),n,r);break}}function PR(t,e,n){if(e===null)return;let r=t.field();if(typeof e!="object"||Array.isArray(e))throw new vn.FieldError(r,"expected object, got "+(0,_t.formatVal)(e));for(let[o,s]of Object.entries(e)){if(s===null)throw new vn.FieldError(r,"map value must not be null");let i;switch(r.mapKind){case"message":let c=(0,os.reflect)(r.message);io(c,s,n),i=c;break;case"enum":if(i=Al(r.enum,s,n.ignoreUnknownFields,!0),i===xi)return;break;case"scalar":i=Fl(r,s,!0);break}let a=BR(r.mapKey,o);t.set(a,i)}}function RR(t,e,n){if(e===null)return;let r=t.field();if(!Array.isArray(e))throw new vn.FieldError(r,"expected Array, got "+(0,_t.formatVal)(e));for(let o of e){if(o===null)throw new vn.FieldError(r,"list item must not be null");switch(r.listKind){case"message":let s=(0,os.reflect)(r.message);io(s,o,n),t.add(s);break;case"enum":let i=Al(r.enum,o,n.ignoreUnknownFields,!0);i!==xi&&t.add(i);break;case"scalar":t.add(Fl(r,o,!0));break}}}function jR(t,e,n,r){if(n===null&&e.message.typeName!="google.protobuf.Value"){t.clear(e);return}let o=t.isSet(e)?t.get(e):(0,os.reflect)(e.message);io(o,n,r),t.set(e,o)}function $R(t,e,n,r){let o=Al(e.enum,n,r.ignoreUnknownFields,!1);o===Tl?t.clear(e):o!==xi&&t.set(e,o)}function LR(t,e,n){let r=Fl(e,n,!1);r===Tl?t.clear(e):t.set(e,r)}var xi=Symbol();function Al(t,e,n,r){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:r?t.values[0].number:Tl;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":let o=t.values.find(s=>s.name===e);if(o!==void 0)return o.number;if(n)return xi;break}throw new Error(`cannot decode ${t} from JSON: ${(0,_t.formatVal)(e)}`)}var Tl=Symbol();function Fl(t,e,n){if(e===null)return n?(0,TR.scalarZeroValue)(t.scalar,!1):Tl;switch(t.scalar){case St.ScalarType.DOUBLE:case St.ScalarType.FLOAT:if(e==="NaN")return NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(typeof e=="number"){if(Number.isNaN(e))throw new vn.FieldError(t,"unexpected NaN number");if(!Number.isFinite(e))throw new vn.FieldError(t,"unexpected infinite number");break}if(typeof e=="string"){if(e===""||e.trim().length!==e.length)break;let r=Number(e);if(!Number.isFinite(r))break;return r}break;case St.ScalarType.INT32:case St.ScalarType.FIXED32:case St.ScalarType.SFIXED32:case St.ScalarType.SINT32:case St.ScalarType.UINT32:return Sw(e);case St.ScalarType.BYTES:if(typeof e=="string"){if(e==="")return new Uint8Array(0);try{return(0,FR.base64Decode)(e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new vn.FieldError(t,o)}}break}return e}function BR(t,e){switch(t){case St.ScalarType.BOOL:switch(e){case"true":return!0;case"false":return!1}return e;case St.ScalarType.INT32:case St.ScalarType.FIXED32:case St.ScalarType.UINT32:case St.ScalarType.SFIXED32:case St.ScalarType.SINT32:return Sw(e);default:return e}}function Sw(t){if(typeof t=="string"){if(t===""||t.trim().length!==t.length)return t;let e=Number(t);return Number.isNaN(e)?t:e}return t}function _w(t,e){try{return JSON.parse(t)}catch(n){let r=n instanceof Error?n.message:String(n);throw new Error(`cannot decode message ${e} from JSON: ${r}`,{cause:n})}}function MR(t,e,n){if(!t.desc.typeName.startsWith("google.protobuf."))return!1;switch(t.desc.typeName){case"google.protobuf.Any":return UR(t.message,e,n),!0;case"google.protobuf.Timestamp":return GR(t.message,e),!0;case"google.protobuf.Duration":return VR(t.message,e),!0;case"google.protobuf.FieldMask":return qR(t.message,e),!0;case"google.protobuf.Struct":return ww(t.message,e),!0;case"google.protobuf.Value":return dp(t.message,e),!0;case"google.protobuf.ListValue":return Ew(t.message,e),!0;default:if((0,so.isWrapperDesc)(t.desc)){let r=t.desc.fields[0];return e===null?t.clear(r):t.set(r,Fl(r,e,!0)),!0}return!1}}function UR(t,e,n){var r;if(e===null||Array.isArray(e)||typeof e!="object")throw new Error(`cannot decode message ${t.$typeName} from JSON: expected object but got ${(0,_t.formatVal)(e)}`);if(Object.keys(e).length==0)return;let o=e["@type"];if(typeof o!="string"||o=="")throw new Error(`cannot decode message ${t.$typeName} from JSON: "@type" is empty`);let s=o.includes("/")?o.substring(o.lastIndexOf("/")+1):o;if(!s.length)throw new Error(`cannot decode message ${t.$typeName} from JSON: "@type" is invalid`);let i=(r=n.registry)===null||r===void 0?void 0:r.getMessage(s);if(!i)throw new Error(`cannot decode message ${t.$typeName} from JSON: ${o} is not in the type registry`);let a=(0,os.reflect)(i);if(s.startsWith("google.protobuf.")&&Object.prototype.hasOwnProperty.call(e,"value")){let c=e.value;io(a,c,n)}else{let c=Object.assign({},e);delete c["@type"],io(a,c,n)}(0,so.anyPack)(a.desc,a.message,t)}function GR(t,e){if(typeof e!="string")throw new Error(`cannot decode message ${t.$typeName} from JSON: ${(0,_t.formatVal)(e)}`);let n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?(?:Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error(`cannot decode message ${t.$typeName} from JSON: invalid RFC 3339 string`);let r=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(r))throw new Error(`cannot decode message ${t.$typeName} from JSON: invalid RFC 3339 string`);if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error(`cannot decode message ${t.$typeName} from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);t.seconds=hw.protoInt64.parse(r/1e3),t.nanos=0,n[7]&&(t.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9)}function VR(t,e){if(typeof e!="string")throw new Error(`cannot decode message ${t.$typeName} from JSON: ${(0,_t.formatVal)(e)}`);let n=e.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);if(n===null)throw new Error(`cannot decode message ${t.$typeName} from JSON: ${(0,_t.formatVal)(e)}`);let r=Number(n[1]);if(r>315576e6||r<-315576e6)throw new Error(`cannot decode message ${t.$typeName} from JSON: ${(0,_t.formatVal)(e)}`);if(t.seconds=hw.protoInt64.parse(r),typeof n[2]!="string")return;let o=n[2]+"0".repeat(9-n[2].length);t.nanos=parseInt(o),(r<0||Object.is(r,-0))&&(t.nanos=-t.nanos)}function qR(t,e){if(typeof e!="string")throw new Error(`cannot decode message ${t.$typeName} from JSON: ${(0,_t.formatVal)(e)}`);if(e==="")return;function n(r){if(r.includes("_"))throw new Error(`cannot decode message ${t.$typeName} from JSON: path names must be lowerCamelCase`);let o=r.replace(/[A-Z]/g,s=>"_"+s.toLowerCase());return o[0]==="_"?o.substring(1):o}t.paths=e.split(",").map(n)}function ww(t,e){if(typeof e!="object"||e==null||Array.isArray(e))throw new Error(`cannot decode message ${t.$typeName} from JSON ${(0,_t.formatVal)(e)}`);for(let[n,r]of Object.entries(e)){let o=(0,kl.create)(so.ValueSchema);dp(o,r),t.fields[n]=o}}function dp(t,e){switch(typeof e){case"number":t.kind={case:"numberValue",value:e};break;case"string":t.kind={case:"stringValue",value:e};break;case"boolean":t.kind={case:"boolValue",value:e};break;case"object":if(e===null)t.kind={case:"nullValue",value:so.NullValue.NULL_VALUE};else if(Array.isArray(e)){let n=(0,kl.create)(so.ListValueSchema);Ew(n,e),t.kind={case:"listValue",value:n}}else{let n=(0,kl.create)(so.StructSchema);ww(n,e),t.kind={case:"structValue",value:n}}break;default:throw new Error(`cannot decode message ${t.$typeName} from JSON ${(0,_t.formatVal)(e)}`)}return t}function Ew(t,e){if(!Array.isArray(e))throw new Error(`cannot decode message ${t.$typeName} from JSON ${(0,_t.formatVal)(e)}`);for(let n of e){let r=(0,kl.create)(so.ValueSchema);dp(r,n),t.values.push(r)}}});var Aw=b(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.merge=HR;var Cw=Bn();function HR(t,e,n){kw((0,Cw.reflect)(t,e),(0,Cw.reflect)(t,n))}function kw(t,e){var n,r;let o=e.message.$unknown;o!==void 0&&o.length>0&&((n=(r=t.message).$unknown)!==null&&n!==void 0||(r.$unknown=[]),t.message.$unknown.push(...o));for(let s of t.fields)if(e.isSet(s))switch(s.fieldKind){case"scalar":case"enum":t.set(s,e.get(s));break;case"message":t.isSet(s)?kw(t.get(s),e.get(s)):t.set(s,e.get(s));break;case"list":let i=t.get(s);for(let c of e.get(s))i.add(c);break;case"map":let a=t.get(s);for(let[c,u]of e.get(s))a.set(c,u);break}}});var Sn=b(K=>{"use strict";var WR=K&&K.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),Rt=K&&K.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&WR(e,t,n)};Object.defineProperty(K,"__esModule",{value:!0});K.getOption=K.hasOption=K.clearExtension=K.setExtension=K.getExtension=K.hasExtension=K.mergeFromBinary=K.fromBinary=K.toBinary=void 0;Rt(Vv(),K);Rt(Lc(),K);Rt(ur(),K);Rt(Rm(),K);Rt(ut(),K);Rt(ew(),K);Rt(cp(),K);Rt(ll(),K);var JR=es();Object.defineProperty(K,"toBinary",{enumerable:!0,get:function(){return JR.toBinary}});var Tw=Qo();Object.defineProperty(K,"fromBinary",{enumerable:!0,get:function(){return Tw.fromBinary}});Object.defineProperty(K,"mergeFromBinary",{enumerable:!0,get:function(){return Tw.mergeFromBinary}});Rt(fw(),K);Rt(Dw(),K);Rt(Aw(),K);var ss=Ti();Object.defineProperty(K,"hasExtension",{enumerable:!0,get:function(){return ss.hasExtension}});Object.defineProperty(K,"getExtension",{enumerable:!0,get:function(){return ss.getExtension}});Object.defineProperty(K,"setExtension",{enumerable:!0,get:function(){return ss.setExtension}});Object.defineProperty(K,"clearExtension",{enumerable:!0,get:function(){return ss.clearExtension}});Object.defineProperty(K,"hasOption",{enumerable:!0,get:function(){return ss.hasOption}});Object.defineProperty(K,"getOption",{enumerable:!0,get:function(){return ss.getOption}});Rt(pn(),K)});var Pi=b(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.codeToString=Ow;Il.codeFromString=YR;var Fw=Y();function Ow(t){let e=Fw.Code[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}var Ol;function YR(t){if(!Ol){Ol={};for(let e of Object.values(Fw.Code))typeof e!="string"&&(Ol[Ow(e)]=e)}return Ol[t]}});var ne=b(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.ConnectError=void 0;var mp=Y(),Iw=Sn(),Nw=Pi(),pp=class t extends Error{constructor(e,n=mp.Code.Unknown,r,o,s){super(KR(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(r??{}),this.details=o??[],this.cause=s}static from(e,n=mp.Code.Unknown){return e instanceof t?e:e instanceof Error?e.name=="AbortError"?new t(e.message,mp.Code.Canceled):new t(e.message,n,void 0,void 0,e):new t(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error?Object.getPrototypeOf(e)===t.prototype?!0:e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e:!1}findDetails(e){let n=e.kind==="message"?{getMessage:o=>o===e.typeName?e:void 0}:e,r=[];for(let o of this.details){if("desc"in o){n.getMessage(o.desc.typeName)&&r.push((0,Iw.create)(o.desc,o.value));continue}let s=n.getMessage(o.type);if(s)try{r.push((0,Iw.fromBinary)(s,o.value))}catch{}}return r}};Nl.ConnectError=pp;function KR(t,e){return t.length?`[${(0,Nw.codeToString)(e)}] ${t}`:`[${(0,Nw.codeToString)(e)}]`}});var ji=b(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.encodeBinaryHeader=XR;Ri.decodeBinaryHeader=QR;Ri.appendHeaders=e2;var xw=Sn(),Pw=rs(),zR=ne(),ZR=Y();function XR(t,e){let n;return e!==void 0?n=(0,xw.toBinary)(e,t):typeof t=="string"?n=new TextEncoder().encode(t):n=t instanceof Uint8Array?t:new Uint8Array(t),(0,Pw.base64Encode)(n,"std_raw")}function QR(t,e,n){try{let r=(0,Pw.base64Decode)(t);return e?(0,xw.fromBinary)(e,r,n):r}catch(r){throw zR.ConnectError.from(r,ZR.Code.DataLoss)}}function e2(...t){let e=new Headers;for(let n of t)n.forEach((r,o)=>{e.append(o,r)});return e}});var xl=b(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});gp.makeAnyClient=t2;function t2(t,e){let n={};for(let r of t.methods){let o=e(r);o!=null&&(n[r.localName]=o)}return n}});var is=b($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.compressedFlag=void 0;$i.compressionNegotiate=o2;var n2=ne(),r2=Y();$i.compressedFlag=1;function o2(t,e,n,r){let o=null,s=null,i;if(e!==null&&e!=="identity"){let a=t.find(c=>c.name===e);if(a)o=a;else{let c=t.map(u=>u.name).join(",");i=new n2.ConnectError(`unknown compression "${e}": supported encodings are ${c}`,r2.Code.Unimplemented,{[r]:c})}}if(n===null||n==="")s=o;else{let a=n.split(",").map(c=>c.trim());for(let c of a){let u=t.find(d=>d.name===c);if(u){s=u;break}}}return{request:o,response:s,error:i}}});var bp=b(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.createEnvelopeReadableStream=s2;ao.envelopeCompress=i2;ao.envelopeDecompress=a2;ao.encodeEnvelope=c2;ao.encodeEnvelopes=l2;var hp=ne(),yp=Y(),as=is();function s2(t){let e,n=new Uint8Array(0);function r(o){let s=new Uint8Array(n.length+o.length);s.set(n),s.set(o,n.length),n=s}return new ReadableStream({start(){e=t.getReader()},async pull(o){let s;for(;;){if(s===void 0&&n.byteLength>=5){let c=0;for(let u=1;u<5;u++)c=(c<<8)+n[u];s={flags:n[0],length:c}}if(s!==void 0&&n.byteLength>=s.length+5)break;let a=await e.read();if(a.done)break;r(a.value)}if(s===void 0){if(n.byteLength==0){o.close();return}o.error(new hp.ConnectError("premature end of stream",yp.Code.DataLoss));return}let i=n.subarray(5,5+s.length);n=n.subarray(5+s.length),o.enqueue({flags:s.flags,data:i})}})}async function i2(t,e,n){let{flags:r,data:o}=t;if((r&as.compressedFlag)===as.compressedFlag)throw new hp.ConnectError("invalid envelope, already compressed",yp.Code.Internal);return e&&o.byteLength>=n&&(o=await e.compress(o),r=r|as.compressedFlag),{data:o,flags:r}}async function a2(t,e,n){let{flags:r,data:o}=t;if((r&as.compressedFlag)===as.compressedFlag){if(!e)throw new hp.ConnectError("received compressed envelope, but do not know how to decompress",yp.Code.Internal);o=await e.decompress(o,n),r=r^as.compressedFlag}return{data:o,flags:r}}function c2(t,e){let n=new Uint8Array(e.length+5);n.set(e,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,t),r.setUint32(1,e.length),n}function l2(...t){let e=t.reduce((s,i)=>s+i.data.length+5,0),n=new Uint8Array(e),r=new DataView(n.buffer),o=0;for(let s of t)r.setUint8(o,s.flags),r.setUint32(o+1,s.data.length),n.set(s.data,o+5),o+=s.data.length+5;return n}});var Bi=b(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.validateReadWriteMaxBytes=d2;Li.assertWriteMaxBytes=f2;Li.assertReadMaxBytes=m2;var Rl=ne(),jl=Y(),Pl=4294967295,vp=Pl,u2=1024;function d2(t,e,n){if(e??(e=vp),t??(t=Pl),n??(n=u2),e<1||e>vp)throw new Rl.ConnectError(`writeMaxBytes ${e} must be >= 1 and <= ${vp}`,jl.Code.Internal);if(t<1||t>Pl)throw new Rl.ConnectError(`readMaxBytes ${t} must be >= 1 and <= ${Pl}`,jl.Code.Internal);return{readMaxBytes:t,writeMaxBytes:e,compressMinBytes:n}}function f2(t,e){if(e>t)throw new Rl.ConnectError(`message size ${e} is larger than configured writeMaxBytes ${t}`,jl.Code.ResourceExhausted)}function m2(t,e,n=!1){if(e>t){let r=`message size is larger than configured readMaxBytes ${t}`;throw n&&(r=`message size ${e} is larger than configured readMaxBytes ${t}`),new Rl.ConnectError(r,jl.Code.ResourceExhausted)}}});var jt=b(le=>{"use strict";var wt=le&&le.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},B=le&&le.__await||function(t){return this instanceof B?(this.v=t,this):new B(t)},mt=le&&le.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof B?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}},p2=le&&le.__asyncDelegator||function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,s){e[o]=t[o]?function(i){return(n=!n)?{value:B(t[o](i)),done:!1}:s?s(i):i}:s}};Object.defineProperty(le,"__esModule",{value:!0});le.pipeTo=g2;le.sinkAll=y2;le.sinkAllBytes=b2;le.pipe=Rw;le.transformCatch=S2;le.transformCatchFinally=_2;le.transformAppend=w2;le.transformPrepend=E2;le.transformReadAllBytes=D2;le.transformSerializeEnvelope=C2;le.transformParseEnvelope=k2;le.transformCompressEnvelope=A2;le.transformDecompressEnvelope=T2;le.transformJoinEnvelopes=F2;le.transformSplitEnvelope=O2;le.readAllBytes=wp;le.untilFirst=N2;le.makeIterableAbortable=Ep;le.createWritableIterable=x2;le.createAsyncIterable=P2;var $l=Y(),Ll=ne(),_p=bp(),Sp=Bi();function g2(t,...e){let[n,r,o]=h2(e),s=t,i;return o?.propagateDownStreamError===!0&&(s=i=Ep(s)),s=Rw(s,...n,{propagateDownStreamError:!1}),r(s).catch(a=>i?i.abort(a).then(()=>Promise.reject(a)):Promise.reject(a))}function h2(t){let e;typeof t[t.length-1]!="function"&&(e=t.pop());let n=t.pop();return[t,n,e]}function y2(){return async function(t){var e,n,r,o;let s=[];try{for(var i=!0,a=wt(t),c;c=await a.next(),e=c.done,!e;i=!0){o=c.value,i=!1;let u=o;s.push(u)}}catch(u){n={error:u}}finally{try{!i&&!e&&(r=a.return)&&await r.call(a)}finally{if(n)throw n.error}}return s}}function b2(t,e){return async function(n){return await wp(n,t,e)}}function Rw(t,...e){return mt(this,arguments,function*(){var r;let[o,s]=v2(e),i,a=t[Symbol.asyncIterator](),u={[Symbol.asyncIterator](){return a}};s?.propagateDownStreamError===!0&&(u=i=Ep(u));for(let m of o)u=m(u);let d=u[Symbol.asyncIterator]();try{for(;;){let m=yield B(d.next());if(m.done===!0)break;if(!i){yield yield B(m.value);continue}try{yield yield B(m.value)}catch(p){throw yield B(i.abort(p)),p}}}finally{s?.propagateDownStreamError===!0&&((r=a.return)===null||r===void 0||r.call(a).catch(()=>{}))}})}function v2(t){let e;return typeof t[t.length-1]!="function"&&(e=t.pop()),[t,e]}function S2(t){return function(e){return mt(this,arguments,function*(){let n=e[Symbol.asyncIterator]();for(;;){let r;try{r=yield B(n.next())}catch(o){let s=yield B(t(o));s!==void 0&&(yield yield B(s));break}if(r.done===!0)break;yield yield B(r.value)}})}}function _2(t){return function(e){return mt(this,arguments,function*(){let n,r=e[Symbol.asyncIterator]();for(;;){let s;try{s=yield B(r.next())}catch(i){n=i;break}if(s.done===!0)break;yield yield B(s.value)}let o=yield B(t(n));o!==void 0&&(yield yield B(o))})}}function w2(t){return function(e){return mt(this,arguments,function*(){var n,r,o,s;try{for(var i=!0,a=wt(e),c;c=yield B(a.next()),n=c.done,!n;i=!0)s=c.value,i=!1,yield yield B(s)}catch(d){r={error:d}}finally{try{!i&&!n&&(o=a.return)&&(yield B(o.call(a)))}finally{if(r)throw r.error}}let u=yield B(t());u!==void 0&&(yield yield B(u))})}}function E2(t){return function(e){return mt(this,arguments,function*(){var n,r,o,s;let i=yield B(t());i!==void 0&&(yield yield B(i));try{for(var a=!0,c=wt(e),u;u=yield B(c.next()),n=u.done,!n;a=!0)s=u.value,a=!1,yield yield B(s)}catch(d){r={error:d}}finally{try{!a&&!n&&(o=c.return)&&(yield B(o.call(c)))}finally{if(r)throw r.error}}})}}function D2(t,e){return function(n){return mt(this,arguments,function*(){yield yield B(yield B(wp(n,t,e)))})}}function C2(t,e,n){return e===void 0||n===void 0?function(r){return mt(this,arguments,function*(){var o,s,i,a;try{for(var c=!0,u=wt(r),d;d=yield B(u.next()),o=d.done,!o;c=!0){a=d.value,c=!1;let m=a,p=t.serialize(m);yield yield B({flags:0,data:p})}}catch(m){s={error:m}}finally{try{!c&&!o&&(i=u.return)&&(yield B(i.call(u)))}finally{if(s)throw s.error}}})}:function(r){return mt(this,arguments,function*(){var o,s,i,a;try{for(var c=!0,u=wt(r),d;d=yield B(u.next()),o=d.done,!o;c=!0){a=d.value,c=!1;let m=a,p,f=0;m.end?(f=f|e,p=n.serialize(m.value)):p=t.serialize(m.value),yield yield B({flags:f,data:p})}}catch(m){s={error:m}}finally{try{!c&&!o&&(i=u.return)&&(yield B(i.call(u)))}finally{if(s)throw s.error}}})}}function k2(t,e,n){return n&&e!==void 0?function(r){return mt(this,arguments,function*(){var o,s,i,a;try{for(var c=!0,u=wt(r),d;d=yield B(u.next()),o=d.done,!o;c=!0){a=d.value,c=!1;let{flags:m,data:p}=a;(m&e)===e?yield yield B({value:n.parse(p),end:!0}):yield yield B({value:t.parse(p),end:!1})}}catch(m){s={error:m}}finally{try{!c&&!o&&(i=u.return)&&(yield B(i.call(u)))}finally{if(s)throw s.error}}})}:function(r){return mt(this,arguments,function*(){var o,s,i,a;try{for(var c=!0,u=wt(r),d;d=yield B(u.next()),o=d.done,!o;c=!0){a=d.value,c=!1;let{flags:m,data:p}=a;if(e!==void 0&&(m&e)===e){if(n===null)throw new Ll.ConnectError("unexpected end flag",$l.Code.InvalidArgument);continue}yield yield B(t.parse(p))}}catch(m){s={error:m}}finally{try{!c&&!o&&(i=u.return)&&(yield B(i.call(u)))}finally{if(s)throw s.error}}})}}function A2(t,e){return function(n){return mt(this,arguments,function*(){var r,o,s,i;try{for(var a=!0,c=wt(n),u;u=yield B(c.next()),r=u.done,!r;a=!0){i=u.value,a=!1;let d=i;yield yield B(yield B((0,_p.envelopeCompress)(d,t,e)))}}catch(d){o={error:d}}finally{try{!a&&!r&&(s=c.return)&&(yield B(s.call(c)))}finally{if(o)throw o.error}}})}}function T2(t,e){return function(n){return mt(this,arguments,function*(){var r,o,s,i;try{for(var a=!0,c=wt(n),u;u=yield B(c.next()),r=u.done,!r;a=!0){i=u.value,a=!1;let d=i;yield yield B(yield B((0,_p.envelopeDecompress)(d,t,e)))}}catch(d){o={error:d}}finally{try{!a&&!r&&(s=c.return)&&(yield B(s.call(c)))}finally{if(o)throw o.error}}})}}function F2(){return function(t){return mt(this,arguments,function*(){var e,n,r,o;try{for(var s=!0,i=wt(t),a;a=yield B(i.next()),e=a.done,!e;s=!0){o=a.value,s=!1;let{flags:c,data:u}=o;yield yield B((0,_p.encodeEnvelope)(c,u))}}catch(c){n={error:c}}finally{try{!s&&!e&&(r=i.return)&&(yield B(r.call(i)))}finally{if(n)throw n.error}}})}}function O2(t){function e(o,s){let i=new Uint8Array(o.byteLength+s.byteLength);return i.set(o),i.set(s,o.length),i}function n(o,s){return o.byteLength<5+s.length?[void 0,o]:[{flags:s.flags,data:o.subarray(5,5+s.length)},o.subarray(5+s.length)]}function r(o){if(o.byteLength<5)return;let s=new DataView(o.buffer,o.byteOffset,o.byteLength),i=s.getUint32(1),a=s.getUint8(0);return{length:i,flags:a}}return function(o){return mt(this,arguments,function*(){var s,i,a,c;let u=new Uint8Array(0);try{for(var d=!0,m=wt(o),p;p=yield B(m.next()),s=p.done,!s;d=!0)for(c=p.value,d=!1,u=e(u,c);;){let g=r(u);if(!g)break;(0,Sp.assertReadMaxBytes)(t,g.length,!0);let h;if([h,u]=n(u,g),!h)break;yield yield B(h)}}catch(f){i={error:f}}finally{try{!d&&!s&&(a=m.return)&&(yield B(a.call(m)))}finally{if(i)throw i.error}}if(u.byteLength>0){let f=r(u),g="protocol error: incomplete envelope";throw f&&(g=`protocol error: promised ${f.length} bytes in enveloped message, got ${u.byteLength-5} bytes`),new Ll.ConnectError(g,$l.Code.InvalidArgument)}})}}async function wp(t,e,n){var r,o,s,i,a,c,u,d;let[m,p]=I2(n);if(m){p>e&&(0,Sp.assertReadMaxBytes)(e,p,!0);let O=new Uint8Array(p),v=0;try{for(var f=!0,g=wt(t),h;h=await g.next(),r=h.done,!r;f=!0){i=h.value,f=!1;let P=i;if(v+P.byteLength>p)throw new Ll.ConnectError(`protocol error: promised ${p} bytes, received ${v+P.byteLength}`,$l.Code.InvalidArgument);O.set(P,v),v+=P.byteLength}}catch(P){o={error:P}}finally{try{!f&&!r&&(s=g.return)&&await s.call(g)}finally{if(o)throw o.error}}if(v<p)throw new Ll.ConnectError(`protocol error: promised ${p} bytes, received ${v}`,$l.Code.InvalidArgument);return O}let y=[],_=0;try{for(var E=!0,D=wt(t),T;T=await D.next(),a=T.done,!a;E=!0){d=T.value,E=!1;let O=d;_+=O.byteLength,(0,Sp.assertReadMaxBytes)(e,_),y.push(O)}}catch(O){c={error:O}}finally{try{!E&&!a&&(u=D.return)&&await u.call(D)}finally{if(c)throw c.error}}let I=new Uint8Array(_),k=0;for(let O=y.shift();O;O=y.shift())I.set(O,k),k+=O.byteLength;return I}function I2(t){if(t==null)return[!1,0];let e=typeof t=="string"?parseInt(t,10):t;return!Number.isSafeInteger(e)||e<0?[!1,e]:[!0,e]}async function N2(t){let e=t[Symbol.asyncIterator](),n=await e.next();return{[Symbol.asyncIterator](){let r={async next(){if(n!==null){let o=n;return n=null,o}return await e.next()}};return e.throw!==void 0&&(r.throw=o=>e.throw(o)),e.return!==void 0&&(r.return=o=>e.return(o)),r}}}function Ep(t){let e=t[Symbol.asyncIterator]();if(e.throw===void 0)throw new Error("AsyncIterable does not implement throw");let n=e,r,o,s={next(){return o=n.next().finally(()=>{o=void 0}),o},throw(a){return n.throw(a)}};e.return!==void 0&&(s=Object.assign(Object.assign({},s),{return(a){return n.return(a)}}));let i=!1;return{abort(a){if(r)return r.state;let c=()=>n.throw(a).then(u=>u.done===!0?"completed":"caught",()=>"rethrown");return o?(r={reason:a,state:o.then(c,c)},r.state):(r={reason:a,state:c()},r.state)},[Symbol.asyncIterator](){if(i)throw new Error("AsyncIterable cannot be re-used");return i=!0,s}}}function x2(){let t=[],e=[],n,r,o,s=new Promise((c,u)=>{r=c,o=u}),i=!1;function a(){for(let c of t.splice(0,t.length))c({done:!0,value:void 0})}return{close(){i=!0,a()},async write(c){if(i)throw n??new Error("cannot write, WritableIterable already closed");let u=t.shift();if(u===void 0)e.push(c);else if(u({done:!1,value:c}),t.length>0)return;let d=e.length+1;for(let m=0;m<d;m++)await s},[Symbol.asyncIterator](){return{next(){r(),s=new Promise((m,p)=>{r=m,o=p});let c=e.shift();if(c!==void 0)return Promise.resolve({done:!1,value:c});if(i)return Promise.resolve({done:!0,value:void 0});let u,d=new Promise(m=>u=m);return t.push(u),d},throw(c){return n=c,i=!0,e.splice(0,e.length),s.catch(()=>{}),o(n),a(),Promise.resolve({done:!0,value:void 0})},return(){return i=!0,e.splice(0,e.length),r(),s=Promise.reject(new Error("cannot write, consumer called return")),s.catch(()=>{}),a(),Promise.resolve({done:!0,value:void 0})}}}}}function P2(t){return mt(this,arguments,function*(){yield B(yield*p2(wt(t)))})}});var Lw=b(Mi=>{"use strict";var R2=Mi&&Mi.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.createCallbackClient=B2;var j2=Sn(),jw=ne(),Bl=Y(),$2=xl(),L2=jt();function B2(t,e){return(0,$2.makeAnyClient)(t,n=>{switch(n.methodKind){case"unary":return M2(e,n);case"server_streaming":return U2(e,n);default:return null}})}function M2(t,e){return function(n,r,o){let s=new AbortController;return o=$w(s,o),t.unary(e,s.signal,o.timeoutMs,o.headers,n,o.contextValues).then(i=>{var a,c;(a=o.onHeader)===null||a===void 0||a.call(o,i.header),(c=o.onTrailer)===null||c===void 0||c.call(o,i.trailer),r(void 0,i.message)},i=>{let a=jw.ConnectError.from(i,Bl.Code.Internal);a.code===Bl.Code.Canceled&&s.signal.aborted||r(a,(0,j2.create)(e.output))}),()=>s.abort()}}function U2(t,e){return function(n,r,o,s){let i=new AbortController;async function a(){var c,u,d,m,p,f;s=$w(i,s);let g=await t.stream(e,s.signal,s.timeoutMs,s.headers,(0,L2.createAsyncIterable)([n]),s.contextValues);(p=s.onHeader)===null||p===void 0||p.call(s,g.header);try{for(var h=!0,y=R2(g.message),_;_=await y.next(),c=_.done,!c;h=!0)m=_.value,h=!1,r(m)}catch(E){u={error:E}}finally{try{!h&&!c&&(d=y.return)&&await d.call(y)}finally{if(u)throw u.error}}(f=s.onTrailer)===null||f===void 0||f.call(s,g.trailer),o(void 0)}return a().catch(c=>{let u=jw.ConnectError.from(c,Bl.Code.Internal);u.code===Bl.Code.Canceled&&i.signal.aborted?o(void 0):o(u)}),()=>i.abort()}}function $w(t,e){return e?.signal&&(e.signal.addEventListener("abort",()=>t.abort()),e.signal.aborted&&t.abort()),Object.assign(Object.assign({},e),{signal:t.signal})}});var Jw=b(pt=>{"use strict";var Uw=pt&&pt.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},cs=pt&&pt.__await||function(t){return this instanceof cs?(this.v=t,this):new cs(t)},G2=pt&&pt.__asyncDelegator||function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,s){e[o]=t[o]?function(i){return(n=!n)?{value:cs(t[o](i)),done:!1}:s?s(i):i}:s}},V2=pt&&pt.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof cs?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(pt,"__esModule",{value:!0});pt.createClient=W2;pt.createUnaryFn=Gw;pt.createServerStreamingFn=Vw;pt.createClientStreamingFn=qw;pt.createBiDiStreamingFn=Hw;var q2=xl(),Bw=ne(),Mw=Y(),H2=jt();function W2(t,e){return(0,q2.makeAnyClient)(t,n=>{switch(n.methodKind){case"unary":return Gw(e,n);case"server_streaming":return Vw(e,n);case"client_streaming":return qw(e,n);case"bidi_streaming":return Hw(e,n);default:return null}})}function Gw(t,e){return async function(n,r){var o,s;let i=await t.unary(e,r?.signal,r?.timeoutMs,r?.headers,n,r?.contextValues);return(o=r?.onHeader)===null||o===void 0||o.call(r,i.header),(s=r?.onTrailer)===null||s===void 0||s.call(r,i.trailer),i.message}}function Vw(t,e){return function(n,r){return Ww(t.stream(e,r?.signal,r?.timeoutMs,r?.headers,(0,H2.createAsyncIterable)([n]),r?.contextValues),r)}}function qw(t,e){return async function(n,r){var o,s,i,a,c,u;let d=await t.stream(e,r?.signal,r?.timeoutMs,r?.headers,n,r?.contextValues);(c=r?.onHeader)===null||c===void 0||c.call(r,d.header);let m,p=0;try{for(var f=!0,g=Uw(d.message),h;h=await g.next(),o=h.done,!o;f=!0)a=h.value,f=!1,m=a,p++}catch(y){s={error:y}}finally{try{!f&&!o&&(i=g.return)&&await i.call(g)}finally{if(s)throw s.error}}if(!m)throw new Bw.ConnectError("protocol error: missing response message",Mw.Code.Unimplemented);if(p>1)throw new Bw.ConnectError("protocol error: received extra messages for client streaming method",Mw.Code.Unimplemented);return(u=r?.onTrailer)===null||u===void 0||u.call(r,d.trailer),m}}function Hw(t,e){return function(n,r){return Ww(t.stream(e,r?.signal,r?.timeoutMs,r?.headers,n,r?.contextValues),r)}}function Ww(t,e){let n=function(){return V2(this,arguments,function*(){var r,o;let s=yield cs(t);(r=e?.onHeader)===null||r===void 0||r.call(e,s.header),yield cs(yield*G2(Uw(s.message))),(o=e?.onTrailer)===null||o===void 0||o.call(e,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}});var Gi=b(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.createLinkedAbortController=K2;Ui.createDeadlineSignal=z2;Ui.getAbortSignalReason=Yw;var J2=ne(),Y2=Y();function K2(...t){let e=new AbortController,n=t.filter(o=>o!==void 0).concat(e.signal);for(let o of n){if(o.aborted){r.apply(o);break}o.addEventListener("abort",r)}function r(){e.signal.aborted||e.abort(Yw(this));for(let o of n)o.removeEventListener("abort",r)}return e}function z2(t){let e=new AbortController,n=()=>{e.abort(new J2.ConnectError("the operation timed out",Y2.Code.DeadlineExceeded))},r;return t!==void 0&&(t<=0?n():r=setTimeout(n,t)),{signal:e.signal,cleanup:()=>clearTimeout(r)}}function Yw(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;let e=new Error("This operation was aborted");return e.name="AbortError",e}});var ls=b(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.createContextValues=Z2;Ml.createContextKey=X2;function Z2(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function X2(t,e){return{id:Symbol(e?.description),defaultValue:t}}});var co=b(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.createHandlerContext=nj;Vi.createMethodImplSpec=zw;Vi.createServiceImplSpec=rj;var Q2=ne(),ej=Y(),Kw=Gi(),tj=ls();function nj(t){var e;let n;if(t.timeoutMs!==void 0){let s=new Date(Date.now()+t.timeoutMs);n=()=>s.getTime()-Date.now()}else n=()=>{};let r=(0,Kw.createDeadlineSignal)(t.timeoutMs),o=(0,Kw.createLinkedAbortController)(r.signal,t.requestSignal,t.shutdownSignal);return Object.assign(Object.assign({},t),{signal:o.signal,timeoutMs:n,requestHeader:new Headers(t.requestHeader),responseHeader:new Headers(t.responseHeader),responseTrailer:new Headers(t.responseTrailer),abort(s){r.cleanup(),o.abort(s)},values:(e=t.contextValues)!==null&&e!==void 0?e:(0,tj.createContextValues)()})}function zw(t,e){return{kind:t.methodKind,method:t,impl:e}}function rj(t,e){let n={service:t,methods:{}};for(let r of t.methods){let o=e[r.localName];if(typeof o=="function")o=o.bind(e);else{let s=`${t.typeName}.${r.name} is not implemented`;o=function(){throw new Q2.ConnectError(s,ej.Code.Unimplemented)}}n.methods[r.localName]=zw(r,o)}return n}});var Ul=b(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.trailerFlag=void 0;lo.trailerParse=Zw;lo.trailerSerialize=Xw;lo.createTrailerSerialization=oj;lo.trailerFlag=128;function Zw(t){let e=new Headers,n=new TextDecoder().decode(t).split(`\r
|
|
27
|
+
`);for(let r of n){if(r==="")continue;let o=r.indexOf(":");if(o>0){let s=r.substring(0,o).trim(),i=r.substring(o+1).trim();e.append(s,i)}}return e}function Xw(t){let e=[];return t.forEach((n,r)=>{e.push(`${r}: ${n}\r
|
|
28
|
+
`)}),new TextEncoder().encode(e.join(""))}function oj(){return{serialize:Xw,parse:Zw}}});var _n=b(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.headerUserAgent=Ne.headerMessageType=Ne.headerStatusDetailsBin=Ne.headerGrpcMessage=Ne.headerGrpcStatus=Ne.headerTimeout=Ne.headerAcceptEncoding=Ne.headerEncoding=Ne.headerContentType=void 0;Ne.headerContentType="Content-Type";Ne.headerEncoding="Grpc-Encoding";Ne.headerAcceptEncoding="Grpc-Accept-Encoding";Ne.headerTimeout="Grpc-Timeout";Ne.headerGrpcStatus="Grpc-Status";Ne.headerGrpcMessage="Grpc-Message";Ne.headerStatusDetailsBin="Grpc-Status-Details-Bin";Ne.headerMessageType="Grpc-Message-Type";Ne.headerUserAgent="User-Agent"});var uo=b(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.headerXGrpcWeb=Te.headerXUserAgent=Te.headerUserAgent=Te.headerStatusDetailsBin=Te.headerGrpcMessage=Te.headerGrpcStatus=Te.headerTimeout=Te.headerAcceptEncoding=Te.headerEncoding=Te.headerContentType=void 0;var gr=_n();Object.defineProperty(Te,"headerContentType",{enumerable:!0,get:function(){return gr.headerContentType}});Object.defineProperty(Te,"headerEncoding",{enumerable:!0,get:function(){return gr.headerEncoding}});Object.defineProperty(Te,"headerAcceptEncoding",{enumerable:!0,get:function(){return gr.headerAcceptEncoding}});Object.defineProperty(Te,"headerTimeout",{enumerable:!0,get:function(){return gr.headerTimeout}});Object.defineProperty(Te,"headerGrpcStatus",{enumerable:!0,get:function(){return gr.headerGrpcStatus}});Object.defineProperty(Te,"headerGrpcMessage",{enumerable:!0,get:function(){return gr.headerGrpcMessage}});Object.defineProperty(Te,"headerStatusDetailsBin",{enumerable:!0,get:function(){return gr.headerStatusDetailsBin}});Object.defineProperty(Te,"headerUserAgent",{enumerable:!0,get:function(){return gr.headerUserAgent}});Te.headerXUserAgent="X-User-Agent";Te.headerXGrpcWeb="X-Grpc-Web"});var Gl=b(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.contentTypeJson=wn.contentTypeProto=wn.contentTypeRegExp=void 0;wn.parseContentType=sj;wn.contentTypeRegExp=/^application\/grpc-web(-text)?(?:\+(?:(json)(?:; ?charset=utf-?8)?|proto))?$/i;wn.contentTypeProto="application/grpc-web+proto";wn.contentTypeJson="application/grpc-web+json";function sj(t){let e=t?.match(wn.contentTypeRegExp);if(!e)return;let n=!!e[1],r=!e[2];return{text:n,binary:r}}});var Vl=b(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.parseTimeout=ij;var Qw=Y(),eE=ne();function ij(t,e){if(t===null)return{};let n=/^(\d{1,8})([HMSmun])$/.exec(t);if(n===null)return{error:new eE.ConnectError(`protocol error: invalid grpc timeout value: ${t}`,Qw.Code.InvalidArgument)};let o={H:60*60*1e3,M:60*1e3,S:1e3,m:1,u:.001,n:1e-6}[n[2]]*parseInt(n[1]);return o>e?{timeoutMs:o,error:new eE.ConnectError(`timeout ${o}ms must be <= ${e}`,Qw.Code.InvalidArgument)}:{timeoutMs:o}}});var Cp=b(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.embedFileDesc=uj;qi.pathInFileDesc=dj;qi.createFileDescriptorProtoBoot=rE;var tE=Si(),ye=cp(),aj=bi(),cj=es(),lj=Rm(),me=mr();function uj(t){let e={bootable:!1,proto(){let n=(0,lj.clone)(me.FileDescriptorProtoSchema,t);return(0,ye.clearField)(n,me.FileDescriptorProtoSchema.field.dependency),(0,ye.clearField)(n,me.FileDescriptorProtoSchema.field.sourceCodeInfo),n.messageType.map(nE),n},base64(){let n=(0,cj.toBinary)(me.FileDescriptorProtoSchema,this.proto());return(0,aj.base64Encode)(n,"std_raw")}};return t.name=="google/protobuf/descriptor.proto"?Object.assign(Object.assign({},e),{bootable:!0,boot(){return rE(this.proto())}}):e}function nE(t){for(let e of t.field)e.jsonName===(0,tE.protoCamelCase)(e.name)&&(0,ye.clearField)(e,me.FieldDescriptorProtoSchema.field.jsonName);for(let e of t.nestedType)nE(e)}function dj(t){if(t.kind=="service")return[t.file.services.indexOf(t)];let e=t.parent;if(e==null)switch(t.kind){case"enum":return[t.file.enums.indexOf(t)];case"message":return[t.file.messages.indexOf(t)];case"extension":return[t.file.extensions.indexOf(t)]}function n(o){let s=[];for(let i=o.parent;i;){let a=i.nestedMessages.indexOf(o);s.unshift(a),o=i,i=o.parent}return s.unshift(o.file.messages.indexOf(o)),s}let r=n(e);switch(t.kind){case"extension":return[...r,e.nestedExtensions.indexOf(t)];case"message":return[...r,e.nestedMessages.indexOf(t)];case"enum":return[...r,e.nestedEnums.indexOf(t)]}}function rE(t){var e;return re(t.name=="google/protobuf/descriptor.proto"),re(t.package=="google.protobuf"),re(!t.dependency.length),re(!t.publicDependency.length),re(!t.weakDependency.length),re(!t.optionDependency.length),re(!t.service.length),re(!t.extension.length),re(t.sourceCodeInfo===void 0),re(t.syntax==""||t.syntax=="proto2"),re(!(!((e=t.options)===null||e===void 0)&&e.features)),re(t.edition===me.Edition.EDITION_UNKNOWN),{name:t.name,package:t.package,messageType:t.messageType.map(oE),enumType:t.enumType.map(sE)}}function oE(t){re(t.extension.length==0),re(!t.oneofDecl.length),re(!t.options),re(!(0,ye.isFieldSet)(t,me.DescriptorProtoSchema.field.visibility));let e={name:t.name};return t.field.length&&(e.field=t.field.map(fj)),t.nestedType.length&&(e.nestedType=t.nestedType.map(oE)),t.enumType.length&&(e.enumType=t.enumType.map(sE)),t.extensionRange.length&&(e.extensionRange=t.extensionRange.map(n=>(re(!n.options),{start:n.start,end:n.end}))),e}function fj(t){re((0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.name)),re((0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.number)),re((0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.type)),re(!(0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.oneofIndex)),re(!(0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.jsonName)||t.jsonName===(0,tE.protoCamelCase)(t.name));let e={name:t.name,number:t.number,type:t.type};return(0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.label)&&(e.label=t.label),(0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.typeName)&&(e.typeName=t.typeName),(0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.extendee)&&(e.extendee=t.extendee),(0,ye.isFieldSet)(t,me.FieldDescriptorProtoSchema.field.defaultValue)&&(e.defaultValue=t.defaultValue),t.options&&(e.options=mj(t.options)),e}function mj(t){let e={};return re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.ctype)),(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.packed)&&(e.packed=t.packed),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.jstype)),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.lazy)),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.unverifiedLazy)),(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.deprecated)&&(e.deprecated=t.deprecated),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.weak)),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.debugRedact)),(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.retention)&&(e.retention=t.retention),t.targets.length&&(e.targets=t.targets),t.editionDefaults.length&&(e.editionDefaults=t.editionDefaults.map(n=>({value:n.value,edition:n.edition}))),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.features)),re(!(0,ye.isFieldSet)(t,me.FieldOptionsSchema.field.uninterpretedOption)),e}function sE(t){return re(!t.options),re(!(0,ye.isFieldSet)(t,me.EnumDescriptorProtoSchema.field.visibility)),{name:t.name,value:t.value.map(e=>(re(!e.options),{name:e.name,number:e.number}))}}function re(t){if(!t)throw new Error}});var iE=b(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.tsEnum=void 0;Hi.enumDesc=gj;var pj=yn();Object.defineProperty(Hi,"tsEnum",{enumerable:!0,get:function(){return pj.tsEnum}});function gj(t,e,...n){if(n.length==0)return t.enums[e];let r=n.pop();return n.reduce((o,s)=>o.nestedMessages[s],t.messages[e]).nestedEnums[r]}});var aE=b(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});kp.extDesc=hj;function hj(t,e,...n){if(n.length==0)return t.extensions[e];let r=n.pop();return n.reduce((o,s)=>o.nestedMessages[s],t.messages[e]).nestedExtensions[r]}});var cE=b(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.fileDesc=void 0;var yj=Qe();Object.defineProperty(ql,"fileDesc",{enumerable:!0,get:function(){return yj.fileDesc}})});var lE=b(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.messageDesc=bj;function bj(t,e,...n){return n.reduce((r,o)=>r.nestedMessages[o],t.messages[e])}});var uE=b(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.serviceDesc=vj;function vj(t,e,...n){if(n.length>0)throw new Error;return t.services[e]}});var Fp=b(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.symbols=G.wktPublicImportPaths=G.packageName=void 0;G.packageName="@bufbuild/protobuf";G.wktPublicImportPaths={"google/protobuf/compiler/plugin.proto":G.packageName+"/wkt","google/protobuf/any.proto":G.packageName+"/wkt","google/protobuf/api.proto":G.packageName+"/wkt","google/protobuf/cpp_features.proto":G.packageName+"/wkt","google/protobuf/descriptor.proto":G.packageName+"/wkt","google/protobuf/duration.proto":G.packageName+"/wkt","google/protobuf/empty.proto":G.packageName+"/wkt","google/protobuf/field_mask.proto":G.packageName+"/wkt","google/protobuf/go_features.proto":G.packageName+"/wkt","google/protobuf/java_features.proto":G.packageName+"/wkt","google/protobuf/source_context.proto":G.packageName+"/wkt","google/protobuf/struct.proto":G.packageName+"/wkt","google/protobuf/timestamp.proto":G.packageName+"/wkt","google/protobuf/type.proto":G.packageName+"/wkt","google/protobuf/wrappers.proto":G.packageName+"/wkt"};G.symbols={isMessage:{typeOnly:!1,bootstrapWktFrom:"../../is-message.js",from:G.packageName},Message:{typeOnly:!0,bootstrapWktFrom:"../../types.js",from:G.packageName},create:{typeOnly:!1,bootstrapWktFrom:"../../create.js",from:G.packageName},fromJson:{typeOnly:!1,bootstrapWktFrom:"../../from-json.js",from:G.packageName},fromJsonString:{typeOnly:!1,bootstrapWktFrom:"../../from-json.js",from:G.packageName},fromBinary:{typeOnly:!1,bootstrapWktFrom:"../../from-binary.js",from:G.packageName},toBinary:{typeOnly:!1,bootstrapWktFrom:"../../to-binary.js",from:G.packageName},toJson:{typeOnly:!1,bootstrapWktFrom:"../../to-json.js",from:G.packageName},toJsonString:{typeOnly:!1,bootstrapWktFrom:"../../to-json.js",from:G.packageName},protoInt64:{typeOnly:!1,bootstrapWktFrom:"../../proto-int64.js",from:G.packageName},JsonValue:{typeOnly:!0,bootstrapWktFrom:"../../json-value.js",from:G.packageName},JsonObject:{typeOnly:!0,bootstrapWktFrom:"../../json-value.js",from:G.packageName},codegen:{boot:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/boot.js",from:G.packageName+"/codegenv2"},fileDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/file.js",from:G.packageName+"/codegenv2"},enumDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/enum.js",from:G.packageName+"/codegenv2"},extDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/extension.js",from:G.packageName+"/codegenv2"},messageDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/message.js",from:G.packageName+"/codegenv2"},serviceDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/service.js",from:G.packageName+"/codegenv2"},tsEnum:{typeOnly:!1,bootstrapWktFrom:"../../codegenv2/enum.js",from:G.packageName+"/codegenv2"},GenFile:{typeOnly:!0,bootstrapWktFrom:"../../codegenv2/types.js",from:G.packageName+"/codegenv2"},GenEnum:{typeOnly:!0,bootstrapWktFrom:"../../codegenv2/types.js",from:G.packageName+"/codegenv2"},GenExtension:{typeOnly:!0,bootstrapWktFrom:"../../codegenv2/types.js",from:G.packageName+"/codegenv2"},GenMessage:{typeOnly:!0,bootstrapWktFrom:"../../codegenv2/types.js",from:G.packageName+"/codegenv2"},GenService:{typeOnly:!0,bootstrapWktFrom:"../../codegenv2/types.js",from:G.packageName+"/codegenv2"}}}});var dE=b(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.symbols=xe.wktPublicImportPaths=xe.packageName=void 0;var Op=Fp();xe.packageName=Op.packageName;xe.wktPublicImportPaths=Op.wktPublicImportPaths;xe.symbols=Object.assign(Object.assign({},Op.symbols),{codegen:{boot:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/boot.js",from:xe.packageName+"/codegenv1"},fileDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/file.js",from:xe.packageName+"/codegenv1"},enumDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/enum.js",from:xe.packageName+"/codegenv1"},extDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/extension.js",from:xe.packageName+"/codegenv1"},messageDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/message.js",from:xe.packageName+"/codegenv1"},serviceDesc:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/service.js",from:xe.packageName+"/codegenv1"},tsEnum:{typeOnly:!1,bootstrapWktFrom:"../../codegenv1/enum.js",from:xe.packageName+"/codegenv1"},GenFile:{typeOnly:!0,bootstrapWktFrom:"../../codegenv1/types.js",from:xe.packageName+"/codegenv1"},GenEnum:{typeOnly:!0,bootstrapWktFrom:"../../codegenv1/types.js",from:xe.packageName+"/codegenv1"},GenExtension:{typeOnly:!0,bootstrapWktFrom:"../../codegenv1/types.js",from:xe.packageName+"/codegenv1"},GenMessage:{typeOnly:!0,bootstrapWktFrom:"../../codegenv1/types.js",from:xe.packageName+"/codegenv1"},GenService:{typeOnly:!0,bootstrapWktFrom:"../../codegenv1/types.js",from:xe.packageName+"/codegenv1"}}})});var Ip=b(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.scalarTypeScriptType=Sj;Hl.scalarJsonType=_j;var ke=ut();function Sj(t,e){switch(t){case ke.ScalarType.STRING:return"string";case ke.ScalarType.BOOL:return"boolean";case ke.ScalarType.UINT64:case ke.ScalarType.SFIXED64:case ke.ScalarType.FIXED64:case ke.ScalarType.SINT64:case ke.ScalarType.INT64:return e?"string":"bigint";case ke.ScalarType.BYTES:return"Uint8Array";default:return"number"}}function _j(t){switch(t){case ke.ScalarType.DOUBLE:case ke.ScalarType.FLOAT:return'number | "NaN" | "Infinity" | "-Infinity"';case ke.ScalarType.UINT64:case ke.ScalarType.SFIXED64:case ke.ScalarType.FIXED64:case ke.ScalarType.SINT64:case ke.ScalarType.INT64:return"string";case ke.ScalarType.INT32:case ke.ScalarType.FIXED32:case ke.ScalarType.UINT32:case ke.ScalarType.SFIXED32:case ke.ScalarType.SINT32:return"number";case ke.ScalarType.STRING:return"string";case ke.ScalarType.BOOL:return"boolean";case ke.ScalarType.BYTES:return"string"}}});var mE=b(fE=>{"use strict";Object.defineProperty(fE,"__esModule",{value:!0})});var pE=b(at=>{"use strict";var wj=at&&at.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),En=at&&at.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&wj(e,t,n)};Object.defineProperty(at,"__esModule",{value:!0});En(dl(),at);En(Cp(),at);En(iE(),at);En(aE(),at);En(cE(),at);En(lE(),at);En(uE(),at);En(dE(),at);En(Ip(),at);En(mE(),at)});var hE=b(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.StatusSchema=fo.file_status=void 0;var gE=pE(),Ej=bn();fo.file_status=(0,gE.fileDesc)("CgxzdGF0dXMucHJvdG8SCmdvb2dsZS5ycGMiTgoGU3RhdHVzEgwKBGNvZGUYASABKAUSDwoHbWVzc2FnZRgCIAEoCRIlCgdkZXRhaWxzGAMgAygLMhQuZ29vZ2xlLnByb3RvYnVmLkFueUJeCg5jb20uZ29vZ2xlLnJwY0ILU3RhdHVzUHJvdG9QAVo3Z29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vZ29vZ2xlYXBpcy9ycGMvc3RhdHVzO3N0YXR1c6ICA1JQQ2IGcHJvdG8z",[Ej.file_google_protobuf_any]);fo.StatusSchema=(0,gE.messageDesc)(fo.file_status,0)});var po=b(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.grpcStatusOk=void 0;hr.setTrailerStatus=Cj;hr.findTrailerError=kj;var xp=hE(),Np=ne(),vE=ji(),yE=Y(),Dj=bn(),mo=_n(),bE=Sn();hr.grpcStatusOk="0";function Cj(t,e){if(e){if(t.set(mo.headerGrpcStatus,e.code.toString(10)),t.set(mo.headerGrpcMessage,encodeURIComponent(e.rawMessage)),e.details.length>0){let n=(0,bE.create)(xp.StatusSchema,{code:e.code,message:e.rawMessage,details:e.details.map(r=>"desc"in r?(0,Dj.anyPack)(r.desc,(0,bE.create)(r.desc,r.value)):{typeUrl:`type.googleapis.com/${r.type}`,value:r.value})});t.set(mo.headerStatusDetailsBin,(0,vE.encodeBinaryHeader)(n,xp.StatusSchema))}}else t.set(mo.headerGrpcStatus,hr.grpcStatusOk.toString());return t}function kj(t){var e;let n=t.get(mo.headerStatusDetailsBin);if(n!=null){let o=(0,vE.decodeBinaryHeader)(n,xp.StatusSchema);if(o.code==0)return;let s=new Np.ConnectError(o.message,o.code,t);return s.details=o.details.map(i=>({type:i.typeUrl.substring(i.typeUrl.lastIndexOf("/")+1),value:i.value})),s}let r=t.get(mo.headerGrpcStatus);if(r!=null){if(r===hr.grpcStatusOk)return;let o=parseInt(r,10);return o in yE.Code?new Np.ConnectError(decodeURIComponent((e=t.get(mo.headerGrpcMessage))!==null&&e!==void 0?e:""),o,t):new Np.ConnectError(`invalid grpc-status: ${r}`,yE.Code.Internal,t)}}});var us=b(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.contentTypeMatcher=Tj;var Aj=1024;function Tj(...t){let e=new Map,n=t.reduce((o,s)=>o.concat("supported"in s?s.supported:s),[]);function r(o){if(o===null||o.length==0)return!1;let s=e.get(o);if(s!==void 0)return s;let i=n.some(a=>a.test(o));return e.size<Aj&&e.set(o,i),i}return r.supported=n,r}});var yr=b(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});Rp.createMethodUrl=Fj;function Fj(t,e){return t.toString().replace(/\/?$/,`/${e.parent.typeName}/${e.name}`)}});var jp=b(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.normalize=SE;Wl.normalizeIterable=Ij;var Oj=Sn();function SE(t,e){return(0,Oj.create)(t,e)}function Ij(t,e){function n(r){return r.done===!0?r:{done:r.done,value:SE(t,r.value)}}return{[Symbol.asyncIterator](){let r=e[Symbol.asyncIterator](),o={next:()=>r.next().then(n)};return r.throw!==void 0&&(o.throw=s=>r.throw(s).then(n)),r.return!==void 0&&(o.return=s=>r.return(s).then(n)),o}}}});var Lp=b($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.applyInterceptors=Nj;function Nj(t,e){var n;return(n=e?.concat().reverse().reduce((r,o)=>o(r),t))!==null&&n!==void 0?n:t}});var Wi=b($t=>{"use strict";var qn=$t&&$t.__await||function(t){return this instanceof qn?(this.v=t,this):new qn(t)},DE=$t&&$t.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof qn?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}},xj=$t&&$t.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},Pj=$t&&$t.__asyncDelegator||function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,s){e[o]=t[o]?function(i){return(n=!n)?{value:qn(t[o](i)),done:!1}:s?s(i):i}:s}};Object.defineProperty($t,"__esModule",{value:!0});$t.invokeUnaryImplementation=kE;$t.transformInvokeImplementation=jj;var _E=ne(),wE=Y(),Rj=jt(),Jl=jp(),CE=Lp();async function kE(t,e,n,r){let o=async u=>Object.assign({message:(0,Jl.normalize)(t.method.output,await t.impl(u.message,Kl(e,u))),stream:!1,method:t.method},Yl(e,t)),s=(0,CE.applyInterceptors)(o,r),{message:i,header:a,trailer:c}=await s(Object.assign({stream:!1,message:n,method:t.method},AE(e,t)));return zl(a,e.responseHeader),zl(c,e.responseTrailer),i}function jj(t,e,n){switch(t.kind){case"unary":return function(o){return DE(this,arguments,function*(){yield yield qn(yield qn(kE(t,e,yield qn(EE(o,"unary")),n)))})};case"server_streaming":return function(o){return Bp(t,e,o,n,async s=>{let i=(0,Jl.normalizeIterable)(t.method.output,t.impl(await EE(o,"server-streaming"),Kl(e,s)));return Object.assign({stream:!0,message:i,method:t.method},Yl(e,t))})};case"client_streaming":return function(o){return Bp(t,e,o,n,async s=>Object.assign({message:(0,Rj.createAsyncIterable)([(0,Jl.normalize)(t.method.output,await t.impl(s.message,Kl(e,s)))]),stream:!0,method:t.method},Yl(e,t)))};case"bidi_streaming":return function(o){return Bp(t,e,o,n,s=>Promise.resolve(Object.assign({message:(0,Jl.normalizeIterable)(t.method.output,t.impl(s.message,Kl(e,s))),stream:!0,method:t.method},Yl(e,t))))}}}function Bp(t,e,n,r,o){return DE(this,arguments,function*(){let i=(0,CE.applyInterceptors)(o,r),{message:a,header:c,trailer:u}=yield qn(i(Object.assign({stream:!0,message:n,method:t.method},AE(e,t))));zl(c,e.responseHeader),yield qn(yield*Pj(xj(a))),zl(u,e.responseTrailer)})}async function EE(t,e){let n=t[Symbol.asyncIterator](),r=await n.next();if(r.done===!0)throw new _E.ConnectError(`protocol error: missing input message for ${e} method`,wE.Code.Unimplemented);if((await n.next()).done!==!0)throw new _E.ConnectError(`protocol error: received extra input message for ${e} method`,wE.Code.Unimplemented);return r.value}function AE(t,e){return{requestMethod:t.requestMethod,url:t.url,signal:t.signal,header:t.requestHeader,service:e.method.parent,contextValues:t.values}}function Yl(t,e){return{service:e.method.parent,header:t.responseHeader,trailer:t.responseTrailer}}function Kl(t,e){return Object.assign(Object.assign({},t),{service:e.service,requestHeader:e.header,signal:e.signal,values:e.contextValues})}function zl(t,e){t!==e&&(e.forEach((n,r)=>{e.delete(r)}),t.forEach((n,r)=>{e.set(r,n)}))}});var vr=b(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.getJsonOptions=FE;br.createMethodSerializationLookup=$j;br.createClientMethodSerializers=Lj;br.limitSerialization=Ji;br.createBinarySerialization=Yi;br.createJsonSerialization=Ki;var Zl=Sn(),Xl=ne(),Ql=Y(),TE=Bi();function FE(t){var e;let n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function $j(t,e,n,r){let o=Ji(Yi(t.input,e),r),s=Ji(Ki(t.input,n),r),i=Ji(Yi(t.output,e),r),a=Ji(Ki(t.output,n),r);return{getI(c){return c?o:s},getO(c){return c?i:a}}}function Lj(t,e,n,r){let o=e?Yi(t.input,r):Ki(t.input,n);return{parse:(e?Yi(t.output,r):Ki(t.output,n)).parse,serialize:o.serialize}}function Ji(t,e){return{serialize(n){let r=t.serialize(n);return(0,TE.assertWriteMaxBytes)(e.writeMaxBytes,r.byteLength),r},parse(n){return(0,TE.assertReadMaxBytes)(e.readMaxBytes,n.byteLength,!0),t.parse(n)}}}function Yi(t,e){return{parse(n){try{return(0,Zl.fromBinary)(t,n,e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Xl.ConnectError(`parse binary: ${o}`,Ql.Code.Internal)}},serialize(n){try{return(0,Zl.toBinary)(t,n,e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Xl.ConnectError(`serialize binary: ${o}`,Ql.Code.Internal)}}}}function Ki(t,e){var n,r;let o=(n=e?.textEncoder)!==null&&n!==void 0?n:new TextEncoder,s=(r=e?.textDecoder)!==null&&r!==void 0?r:new TextDecoder,i=FE(e);return{parse(a){try{let c=s.decode(a);return(0,Zl.fromJsonString)(t,c,i)}catch(c){throw Xl.ConnectError.from(c,Ql.Code.InvalidArgument)}},serialize(a){try{let c=(0,Zl.toJsonString)(t,a,i);return o.encode(c)}catch(c){throw Xl.ConnectError.from(c,Ql.Code.Internal)}}}}});var ds=b(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.uResponseVersionNotSupported=Ft.uResponseMethodNotAllowed=Ft.uResponseUnsupportedMediaType=Ft.uResponseNotFound=Ft.uResponseOk=void 0;Ft.assertByteStreamRequest=Bj;function Bj(t){if(!(typeof t.body=="object"&&t.body!==null&&Symbol.asyncIterator in t.body))throw new Error("byte stream required, but received JSON")}Ft.uResponseOk={status:200};Ft.uResponseNotFound={status:404};Ft.uResponseUnsupportedMediaType={status:415};Ft.uResponseMethodNotAllowed={status:405};Ft.uResponseVersionNotSupported={status:505}});var ms=b(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.validateUniversalHandlerOptions=Gj;fs.createUniversalServiceHandlers=Vj;fs.createUniversalMethodHandler=OE;fs.negotiateProtocol=IE;var Mp=ds(),Mj=us(),Uj=Bi(),Up=ne(),Gp=Y();function Gj(t){var e,n,r;t??(t={});let o=t.acceptCompression?[...t.acceptCompression]:[],s=(e=t.requireConnectProtocolHeader)!==null&&e!==void 0?e:!1,i=(n=t.maxTimeoutMs)!==null&&n!==void 0?n:Number.MAX_SAFE_INTEGER;return Object.assign(Object.assign({acceptCompression:o},(0,Uj.validateReadWriteMaxBytes)(t.readMaxBytes,t.writeMaxBytes,t.compressMinBytes)),{jsonOptions:t.jsonOptions,binaryOptions:t.binaryOptions,maxTimeoutMs:i,shutdownSignal:t.shutdownSignal,requireConnectProtocolHeader:s,interceptors:(r=t.interceptors)!==null&&r!==void 0?r:[]})}function Vj(t,e){return Object.entries(t.methods).map(([,n])=>OE(n,e))}function OE(t,e){return IE(e.map(n=>n(t)))}function IE(t){if(t.length==0)throw new Up.ConnectError("at least one protocol is required",Gp.Code.Internal);let e=t[0].service,n=t[0].method,r=t[0].requestPath;if(t.some(s=>s.service!==e||s.method!==n))throw new Up.ConnectError("cannot negotiate protocol for different RPCs",Gp.Code.Internal);if(t.some(s=>s.requestPath!==r))throw new Up.ConnectError("cannot negotiate protocol for different requestPaths",Gp.Code.Internal);async function o(s){var i;if(n.methodKind=="bidi_streaming"&&s.httpVersion.startsWith("1."))return Object.assign(Object.assign({},Mp.uResponseVersionNotSupported),{header:new Headers({Connection:"close"})});let a=(i=s.header.get("Content-Type"))!==null&&i!==void 0?i:"",c=t.filter(m=>m.allowedMethods.includes(s.method));if(c.length==0)return Mp.uResponseMethodNotAllowed;if(c.length==1&&a===""){let m=c[0];return m(s)}let u=c.filter(m=>m.supportedContentType(a));if(u.length==0)return Mp.uResponseUnsupportedMediaType;let d=u[0];return d(s)}return Object.assign(o,{service:e,method:n,requestPath:r,supportedContentType:(0,Mj.contentTypeMatcher)(...t.map(s=>s.supportedContentType)),protocolNames:t.flatMap(s=>s.protocolNames).filter((s,i,a)=>a.indexOf(s)===i),allowedMethods:t.flatMap(s=>s.allowedMethods).filter((s,i,a)=>a.indexOf(s)===i)})}});var Jp=b(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.createHandlerFactory=Qj;var NE=ne(),qj=Y(),Hj=co(),qp=Ul(),Sr=uo(),tu=Gl(),Wj=Vl(),Vp=po(),en=jt(),Jj=is(),Yj=us(),Kj=yr(),zj=Wi(),Zj=vr(),Xj=ms(),eu=ds(),Hp="grpc-web",xE="POST";function Qj(t){let e=(0,Xj.validateUniversalHandlerOptions)(t),n=(0,qp.createTrailerSerialization)();function r(o){let s=e$(e,n,o);return Object.assign(s,{protocolNames:[Hp],allowedMethods:[xE],supportedContentType:(0,Yj.contentTypeMatcher)(tu.contentTypeRegExp),requestPath:(0,Kj.createMethodUrl)("/",o.method),service:o.method.parent,method:o.method})}return r.protocolName=Hp,r}function e$(t,e,n){let r=(0,Zj.createMethodSerializationLookup)(n.method,t.binaryOptions,t.jsonOptions,t);return async function(s){(0,eu.assertByteStreamRequest)(s);let i=(0,tu.parseContentType)(s.header.get(Sr.headerContentType));if(i==null||i.text)return eu.uResponseUnsupportedMediaType;if(s.method!==xE)return eu.uResponseMethodNotAllowed;let a=(0,Wj.parseTimeout)(s.header.get(Sr.headerTimeout),t.maxTimeoutMs),c=(0,Hj.createHandlerContext)(Object.assign(Object.assign({},n),{service:n.method.parent,requestMethod:s.method,protocolName:Hp,timeoutMs:a.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:s.signal,requestHeader:s.header,url:s.url,responseHeader:{[Sr.headerContentType]:i.binary?tu.contentTypeProto:tu.contentTypeJson},responseTrailer:{[Sr.headerGrpcStatus]:Vp.grpcStatusOk},contextValues:s.contextValues})),u=(0,Jj.compressionNegotiate)(t.acceptCompression,s.header.get(Sr.headerEncoding),s.header.get(Sr.headerAcceptEncoding),Sr.headerAcceptEncoding);u.response&&c.responseHeader.set(Sr.headerEncoding,u.response.name);let d=(0,en.pipe)(s.body,(0,en.transformPrepend)(()=>{if(u.error)throw u.error;if(a.error)throw a.error}),(0,en.transformSplitEnvelope)(t.readMaxBytes),(0,en.transformDecompressEnvelope)(u.request,t.readMaxBytes),(0,en.transformParseEnvelope)(r.getI(i.binary),qp.trailerFlag)),m=(0,zj.transformInvokeImplementation)(n,c,t.interceptors)(d)[Symbol.asyncIterator](),p=(0,en.pipe)({[Symbol.asyncIterator](){return{next:()=>m.next(),throw:f=>{var g,h;return c.abort(f),(h=(g=m.throw)===null||g===void 0?void 0:g.call(m,f))!==null&&h!==void 0?h:Promise.reject({done:!0})},return:f=>{var g,h;return c.abort(),(h=(g=m.return)===null||g===void 0?void 0:g.call(m,f))!==null&&h!==void 0?h:Promise.resolve({done:!0,value:f})}}}},(0,en.transformSerializeEnvelope)(r.getO(i.binary)),(0,en.transformCatchFinally)(f=>(c.abort(f),f instanceof NE.ConnectError?(0,Vp.setTrailerStatus)(c.responseTrailer,f):f!==void 0&&(0,Vp.setTrailerStatus)(c.responseTrailer,new NE.ConnectError("internal error",qj.Code.Internal,void 0,void 0,f)),{flags:qp.trailerFlag,data:e.serialize(c.responseTrailer)})),(0,en.transformCompressEnvelope)(u.response,t.compressMinBytes),(0,en.transformJoinEnvelopes)(),{propagateDownStreamError:!0});return Object.assign(Object.assign({},eu.uResponseOk),{body:await(0,en.untilFirst)(p),header:c.responseHeader})}}});var zi=b(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.contentTypeJson=Dn.contentTypeProto=Dn.contentTypeRegExp=void 0;Dn.parseContentType=t$;Dn.contentTypeRegExp=/^application\/grpc(?:\+(?:(json)(?:; ?charset=utf-?8)?|proto))?$/i;Dn.contentTypeProto="application/grpc+proto";Dn.contentTypeJson="application/grpc+json";function t$(t){let e=t?.match(Dn.contentTypeRegExp);return e?{binary:!e[1]}:void 0}});var Zp=b(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.createHandlerFactory=d$;var n$=co(),PE=ne(),r$=Y(),ru=zi(),_r=_n(),Yp=po(),o$=Vl(),tn=jt(),s$=is(),i$=us(),a$=yr(),c$=Wi(),l$=vr(),u$=ms(),nu=ds(),Kp="grpc",RE="POST";function d$(t){let e=(0,u$.validateUniversalHandlerOptions)(t);function n(r){let o=f$(e,r);return Object.assign(o,{protocolNames:[Kp],allowedMethods:[RE],supportedContentType:(0,i$.contentTypeMatcher)(ru.contentTypeRegExp),requestPath:(0,a$.createMethodUrl)("/",r.method),service:r.method.parent,method:r.method})}return n.protocolName=Kp,n}function f$(t,e){let n=(0,l$.createMethodSerializationLookup)(e.method,t.binaryOptions,t.jsonOptions,t);return async function(o){(0,nu.assertByteStreamRequest)(o);let s=(0,ru.parseContentType)(o.header.get(_r.headerContentType));if(s==null)return nu.uResponseUnsupportedMediaType;if(o.method!==RE)return nu.uResponseMethodNotAllowed;let i=(0,o$.parseTimeout)(o.header.get(_r.headerTimeout),t.maxTimeoutMs),a=(0,n$.createHandlerContext)(Object.assign(Object.assign({},e),{service:e.method.parent,requestMethod:o.method,protocolName:Kp,timeoutMs:i.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:o.signal,requestHeader:o.header,url:o.url,responseHeader:{[_r.headerContentType]:s.binary?ru.contentTypeProto:ru.contentTypeJson},responseTrailer:{[_r.headerGrpcStatus]:Yp.grpcStatusOk},contextValues:o.contextValues})),c=(0,s$.compressionNegotiate)(t.acceptCompression,o.header.get(_r.headerEncoding),o.header.get(_r.headerAcceptEncoding),_r.headerAcceptEncoding);c.response&&a.responseHeader.set(_r.headerEncoding,c.response.name);let u=(0,tn.pipe)(o.body,(0,tn.transformPrepend)(()=>{if(c.error)throw c.error;if(i.error)throw i.error}),(0,tn.transformSplitEnvelope)(t.readMaxBytes),(0,tn.transformDecompressEnvelope)(c.request,t.readMaxBytes),(0,tn.transformParseEnvelope)(n.getI(s.binary))),d=(0,c$.transformInvokeImplementation)(e,a,t.interceptors)(u)[Symbol.asyncIterator](),m=(0,tn.pipe)({[Symbol.asyncIterator](){return{next:()=>d.next(),throw:p=>{var f,g;return a.abort(p),(g=(f=d.throw)===null||f===void 0?void 0:f.call(d,p))!==null&&g!==void 0?g:Promise.reject({done:!0})},return:p=>{var f,g;return a.abort(),(g=(f=d.return)===null||f===void 0?void 0:f.call(d,p))!==null&&g!==void 0?g:Promise.resolve({done:!0,value:p})}}}},(0,tn.transformSerializeEnvelope)(n.getO(s.binary)),(0,tn.transformCompressEnvelope)(c.response,t.compressMinBytes),(0,tn.transformJoinEnvelopes)(),(0,tn.transformCatchFinally)(p=>{a.abort(p),p instanceof PE.ConnectError?(0,Yp.setTrailerStatus)(a.responseTrailer,p):p!==void 0&&(0,Yp.setTrailerStatus)(a.responseTrailer,new PE.ConnectError("internal error",r$.Code.Internal,void 0,void 0,p))}),{propagateDownStreamError:!0});return Object.assign(Object.assign({},nu.uResponseOk),{body:await(0,tn.untilFirst)(m),header:a.responseHeader,trailer:a.responseTrailer})}}});var Zi=b(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.contentTypeStreamJson=Ve.contentTypeStreamProto=Ve.contentTypeUnaryJson=Ve.contentTypeUnaryProto=Ve.contentTypeStreamRegExp=Ve.contentTypeUnaryRegExp=Ve.contentTypeRegExp=void 0;Ve.parseContentType=g$;Ve.parseEncodingQuery=h$;Ve.contentTypeRegExp=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;Ve.contentTypeUnaryRegExp=/^application\/(?:json(?:; ?charset=utf-?8)?|proto)$/i;Ve.contentTypeStreamRegExp=/^application\/connect\+?(?:json(?:; ?charset=utf-?8)?|proto)$/i;Ve.contentTypeUnaryProto="application/proto";Ve.contentTypeUnaryJson="application/json";Ve.contentTypeStreamProto="application/connect+proto";Ve.contentTypeStreamJson="application/connect+json";var m$="proto",p$="json";function g$(t){let e=t?.match(Ve.contentTypeRegExp);if(!e)return;let n=!!e[1],r=!!e[3];return{stream:n,binary:r}}function h$(t){switch(t){case m$:return{stream:!1,binary:!0};case p$:return{stream:!1,binary:!1};default:return}}});var Xi=b(wr=>{"use strict";var y$=wr&&wr.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};Object.defineProperty(wr,"__esModule",{value:!0});wr.errorFromJson=BE;wr.errorFromJsonBytes=v$;wr.errorToJson=ME;wr.errorToJsonBytes=S$;var jE=rs(),Xp=Sn(),b$=Y(),$E=ne(),LE=Pi();function BE(t,e,n){var r;if(e&&new Headers(e).forEach((a,c)=>n.metadata.append(c,a)),typeof t!="object"||t==null||Array.isArray(t))throw n;let o=n.code;"code"in t&&typeof t.code=="string"&&(o=(r=(0,LE.codeFromString)(t.code))!==null&&r!==void 0?r:o);let s=t.message;if(s!=null&&typeof s!="string")throw n;let i=new $E.ConnectError(s??"",o,e);if("details"in t&&Array.isArray(t.details))for(let a of t.details){if(a===null||typeof a!="object"||Array.isArray(a)||typeof a.type!="string"||typeof a.value!="string")throw n;try{i.details.push({type:a.type,value:(0,jE.base64Decode)(a.value),debug:a.debug})}catch{throw n}}return i}function v$(t,e,n){let r;try{r=JSON.parse(new TextDecoder().decode(t))}catch{throw n}return BE(r,e,n)}function ME(t,e){let n={code:(0,LE.codeToString)(t.code)};return t.rawMessage.length>0&&(n.message=t.rawMessage),t.details.length>0&&(n.details=t.details.map(r=>{if("desc"in r){let o=(0,Xp.create)(r.desc,r.value),s={type:r.desc.typeName,value:(0,Xp.toBinary)(r.desc,o)};try{s.debug=(0,Xp.toJson)(r.desc,o,e)}catch{}return s}return r}).map(r=>{var{value:o}=r,s=y$(r,["value"]);return Object.assign(Object.assign({},s),{value:(0,jE.base64Encode)(o,"std_raw")})})),n}function S$(t,e){let n=new TextEncoder;try{let r=ME(t,e),o=JSON.stringify(r);return n.encode(o)}catch(r){let o=r instanceof Error?r.message:String(r);throw new $E.ConnectError(`failed to serialize Connect Error: ${o}`,b$.Code.Internal)}}});var ou=b(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.endStreamFlag=void 0;go.endStreamFromJson=GE;go.endStreamToJson=VE;go.createEndStreamSerialization=w$;var UE=Xi(),_$=ji(),Qp=ne(),eg=Y();go.endStreamFlag=2;function GE(t){let e=new Qp.ConnectError("invalid end stream",eg.Code.Unknown),n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;let r=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(let[s,i]of Object.entries(n.metadata)){if(!Array.isArray(i)||i.some(a=>typeof a!="string"))throw e;for(let a of i)r.append(s,a)}}let o="error"in n&&n.error!=null?(0,UE.errorFromJson)(n.error,r,e):void 0;return{metadata:r,error:o}}function VE(t,e,n){let r={};e!==void 0&&(r.error=(0,UE.errorToJson)(e,n),t=(0,_$.appendHeaders)(t,e.metadata));let o=!1,s={};return t.forEach((i,a)=>{o=!0,s[a]=[i]}),o&&(r.metadata=s),r}function w$(t){let e=new TextEncoder;return{serialize(n){try{let r=VE(n.metadata,n.error,t),o=JSON.stringify(r);return e.encode(o)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Qp.ConnectError(`failed to serialize EndStreamResponse: ${o}`,eg.Code.Internal)}},parse(n){try{return GE(n)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Qp.ConnectError(`failed to parse EndStreamResponse: ${o}`,eg.Code.InvalidArgument)}}}}});var Hn=b(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.headerUserAgent=Pe.headerProtocolVersion=Pe.headerTimeout=Pe.headerStreamAcceptEncoding=Pe.headerUnaryAcceptEncoding=Pe.headerStreamEncoding=Pe.headerUnaryEncoding=Pe.headerUnaryContentLength=Pe.headerContentType=void 0;Pe.headerContentType="Content-Type";Pe.headerUnaryContentLength="Content-Length";Pe.headerUnaryEncoding="Content-Encoding";Pe.headerStreamEncoding="Connect-Content-Encoding";Pe.headerUnaryAcceptEncoding="Accept-Encoding";Pe.headerStreamAcceptEncoding="Connect-Accept-Encoding";Pe.headerTimeout="Connect-Timeout-Ms";Pe.headerProtocolVersion="Connect-Protocol-Version";Pe.headerUserAgent="User-Agent"});var iu=b(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.codeFromHttpStatus=E$;su.codeToHttpStatus=D$;var be=Y();function E$(t){switch(t){case 400:return be.Code.Internal;case 401:return be.Code.Unauthenticated;case 403:return be.Code.PermissionDenied;case 404:return be.Code.Unimplemented;case 429:return be.Code.Unavailable;case 502:return be.Code.Unavailable;case 503:return be.Code.Unavailable;case 504:return be.Code.Unavailable;default:return be.Code.Unknown}}function D$(t){switch(t){case be.Code.Canceled:return 499;case be.Code.Unknown:return 500;case be.Code.InvalidArgument:return 400;case be.Code.DeadlineExceeded:return 504;case be.Code.NotFound:return 404;case be.Code.AlreadyExists:return 409;case be.Code.PermissionDenied:return 403;case be.Code.ResourceExhausted:return 429;case be.Code.FailedPrecondition:return 400;case be.Code.Aborted:return 409;case be.Code.OutOfRange:return 400;case be.Code.Unimplemented:return 501;case be.Code.Internal:return 500;case be.Code.Unavailable:return 503;case be.Code.DataLoss:return 500;case be.Code.Unauthenticated:return 401;default:return 500}}});var ng=b(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});tg.parseTimeout=C$;var qE=Y(),HE=ne();function C$(t,e){if(t===null)return{};let n=/^\d{1,10}$/.exec(t);if(n===null)return{error:new HE.ConnectError(`protocol error: invalid connect timeout value: ${t}`,qE.Code.InvalidArgument)};let r=parseInt(n[0]);return r>e?{timeoutMs:r,error:new HE.ConnectError(`timeout ${r}ms must be <= ${e}`,qE.Code.InvalidArgument)}:{timeoutMs:parseInt(n[0])}}});var rg=b(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.paramMessage=Lt.paramBase64=Lt.paramCompression=Lt.paramEncoding=Lt.paramConnectVersion=void 0;Lt.paramConnectVersion="connect";Lt.paramEncoding="encoding";Lt.paramCompression="compression";Lt.paramBase64="base64";Lt.paramMessage="message"});var cu=b(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.trailerDemux=k$;au.trailerMux=A$;function k$(t){let e=new Headers,n=new Headers;return t.forEach((r,o)=>{o.toLowerCase().startsWith("trailer-")?n.append(o.substring(8),r):e.append(o,r)}),[e,n]}function A$(t,e){let n=new Headers(t);return e.forEach((r,o)=>{n.append(`trailer-${o}`,r)}),n}});var Qi=b(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.protocolVersion=void 0;Bt.requireProtocolVersionHeader=T$;Bt.requireProtocolVersionParam=F$;var og=Hn(),sg=rg(),lu=ne(),uu=Y();Bt.protocolVersion="1";function T$(t){let e=t.get(og.headerProtocolVersion);if(e===null)throw new lu.ConnectError(`missing required header: set ${og.headerProtocolVersion} to "${Bt.protocolVersion}"`,uu.Code.InvalidArgument);if(e!==Bt.protocolVersion)throw new lu.ConnectError(`${og.headerProtocolVersion} must be "${Bt.protocolVersion}": got "${e}"`,uu.Code.InvalidArgument)}function F$(t){let e=t.get(sg.paramConnectVersion);if(e===null)throw new lu.ConnectError(`missing required parameter: set ${sg.paramConnectVersion} to "v${Bt.protocolVersion}"`,uu.Code.InvalidArgument);if(e!==`v${Bt.protocolVersion}`)throw new lu.ConnectError(`${sg.paramConnectVersion} must be "v${Bt.protocolVersion}": got "${e}"`,uu.Code.InvalidArgument)}});var lg=b(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});cg.createHandlerFactory=B$;var O$=Sn(),I$=rs(),du=Y(),ps=ne(),WE=co(),Cn=Zi(),ig=ou(),N$=Xi(),et=Hn(),x$=iu(),JE=ng(),fu=rg(),P$=cu(),ag=Qi(),YE=is(),R$=vr(),j$=ms(),ho=ds(),Ot=jt(),$$=us(),L$=yr(),KE=Wi(),zE=bn(),mu="connect",ZE="POST",XE="GET";function B$(t){let e=(0,j$.validateUniversalHandlerOptions)(t),n=(0,ig.createEndStreamSerialization)(e.jsonOptions);function r(o){let s,i,a=(0,R$.createMethodSerializationLookup)(o.method,e.binaryOptions,e.jsonOptions,e);switch(o.kind){case"unary":i=Cn.contentTypeUnaryRegExp,s=M$(e,o,a);break;default:i=Cn.contentTypeStreamRegExp,s=q$(e,o,a,n);break}let c=[ZE];return o.method.idempotency===zE.MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS&&c.push(XE),Object.assign(s,{protocolNames:[mu],supportedContentType:(0,$$.contentTypeMatcher)(i),allowedMethods:c,requestPath:(0,L$.createMethodUrl)("/",o.method),service:o.method.parent,method:o.method})}return r.protocolName=mu,r}function M$(t,e,n){return async function(o){let s=o.method==XE;if(s&&e.method.idempotency!=zE.MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS)return ho.uResponseMethodNotAllowed;let i=new URL(o.url).searchParams,a=s?i.get(fu.paramCompression):o.header.get(et.headerUnaryEncoding),c=s?(0,Cn.parseEncodingQuery)(i.get(fu.paramEncoding)):(0,Cn.parseContentType)(o.header.get(et.headerContentType));if(c==null||c.stream)return ho.uResponseUnsupportedMediaType;let u=(0,JE.parseTimeout)(o.header.get(et.headerTimeout),t.maxTimeoutMs),d=(0,WE.createHandlerContext)(Object.assign(Object.assign({},e),{service:e.method.parent,requestMethod:o.method,protocolName:mu,timeoutMs:u.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:o.signal,requestHeader:o.header,url:o.url,responseHeader:{[et.headerContentType]:c.binary?Cn.contentTypeUnaryProto:Cn.contentTypeUnaryJson},contextValues:o.contextValues})),m=(0,YE.compressionNegotiate)(t.acceptCompression,a,o.header.get(et.headerUnaryAcceptEncoding),et.headerUnaryAcceptEncoding),p=ho.uResponseOk.status,f;try{if(t.requireConnectProtocolHeader&&(s?(0,ag.requireProtocolVersionParam)(i):(0,ag.requireProtocolVersionHeader)(o.header)),m.error)throw m.error;if(u.error)throw u.error;let h;s?h=await G$(t.readMaxBytes,m.request,i):h=await U$(t.readMaxBytes,m.request,o);let y=V$(e.method,c.binary,n,h),_=await(0,KE.invokeUnaryImplementation)(e,d,y,t.interceptors);f=n.getO(c.binary).serialize(_)}catch(h){d.abort(h);let y;h instanceof ps.ConnectError?y=h:y=new ps.ConnectError("internal error",du.Code.Internal,void 0,void 0,h),p=(0,x$.codeToHttpStatus)(y.code),d.responseHeader.set(et.headerContentType,Cn.contentTypeUnaryJson),y.metadata.forEach((_,E)=>{d.responseHeader.set(E,_)}),f=(0,N$.errorToJsonBytes)(y,t.jsonOptions)}finally{d.abort()}m.response&&f.byteLength>=t.compressMinBytes&&(f=await m.response.compress(f),d.responseHeader.set(et.headerUnaryEncoding,m.response.name));let g=(0,P$.trailerMux)(d.responseHeader,d.responseTrailer);return g.set(et.headerUnaryContentLength,f.byteLength.toString(10)),{status:p,body:(0,Ot.createAsyncIterable)([f]),header:g}}}async function U$(t,e,n){if(typeof n.body=="object"&&n.body!==null&&Symbol.asyncIterator in n.body){let r=await(0,Ot.readAllBytes)(n.body,t,n.header.get(et.headerUnaryContentLength));return e&&(r=await e.decompress(r,t)),r}return n.body}async function G$(t,e,n){var r;let o=n.get(fu.paramBase64),s=(r=n.get(fu.paramMessage))!==null&&r!==void 0?r:"",i;return o==="1"?i=(0,I$.base64Decode)(s):i=new TextEncoder().encode(s),e&&(i=await e.decompress(i,t)),i}function V$(t,e,n,r){if(r instanceof Uint8Array)return n.getI(e).parse(r);if(e)throw new ps.ConnectError("received parsed JSON request body, but content-type indicates binary format",du.Code.Internal);try{return(0,O$.fromJson)(t.input,r)}catch(o){throw ps.ConnectError.from(o,du.Code.InvalidArgument)}}function q$(t,e,n,r){return async function(s){(0,ho.assertByteStreamRequest)(s);let i=(0,Cn.parseContentType)(s.header.get(et.headerContentType));if(i==null||!i.stream)return ho.uResponseUnsupportedMediaType;if(s.method!==ZE)return ho.uResponseMethodNotAllowed;let a=(0,JE.parseTimeout)(s.header.get(et.headerTimeout),t.maxTimeoutMs),c=(0,WE.createHandlerContext)(Object.assign(Object.assign({},e),{service:e.method.parent,requestMethod:s.method,protocolName:mu,timeoutMs:a.timeoutMs,shutdownSignal:t.shutdownSignal,requestSignal:s.signal,requestHeader:s.header,url:s.url,responseHeader:{[et.headerContentType]:i.binary?Cn.contentTypeStreamProto:Cn.contentTypeStreamJson},contextValues:s.contextValues})),u=(0,YE.compressionNegotiate)(t.acceptCompression,s.header.get(et.headerStreamEncoding),s.header.get(et.headerStreamAcceptEncoding),et.headerStreamAcceptEncoding);u.response&&c.responseHeader.set(et.headerStreamEncoding,u.response.name);let d=(0,Ot.pipe)(s.body,(0,Ot.transformPrepend)(()=>{if(t.requireConnectProtocolHeader&&(0,ag.requireProtocolVersionHeader)(s.header),u.error)throw u.error;if(a.error)throw a.error}),(0,Ot.transformSplitEnvelope)(t.readMaxBytes),(0,Ot.transformDecompressEnvelope)(u.request,t.readMaxBytes),(0,Ot.transformParseEnvelope)(n.getI(i.binary),ig.endStreamFlag)),m=(0,KE.transformInvokeImplementation)(e,c,t.interceptors)(d)[Symbol.asyncIterator](),p=(0,Ot.pipe)({[Symbol.asyncIterator](){return{next:()=>m.next(),throw:f=>{var g,h;return c.abort(f),(h=(g=m.throw)===null||g===void 0?void 0:g.call(m,f))!==null&&h!==void 0?h:Promise.reject({done:!0})},return:f=>{var g,h;return c.abort(),(h=(g=m.return)===null||g===void 0?void 0:g.call(m,f))!==null&&h!==void 0?h:Promise.resolve({done:!0,value:f})}}}},(0,Ot.transformSerializeEnvelope)(n.getO(i.binary)),(0,Ot.transformCatchFinally)(f=>{c.abort(f);let g={metadata:c.responseTrailer};return f instanceof ps.ConnectError?g.error=f:f!==void 0&&(g.error=new ps.ConnectError("internal error",du.Code.Internal,void 0,void 0,f)),{flags:ig.endStreamFlag,data:r.serialize(g)}}),(0,Ot.transformCompressEnvelope)(u.response,t.compressMinBytes),(0,Ot.transformJoinEnvelopes)(),{propagateDownStreamError:!0});return Object.assign(Object.assign({},ho.uResponseOk),{body:await(0,Ot.untilFirst)(p),header:c.responseHeader})}}});var fg=b(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});dg.createConnectRouter=z$;var H$=ne(),W$=Y(),QE=co(),J$=Jp(),Y$=Zp(),K$=lg(),pu=ms();function z$(t){let e=ug(t),n=[],r={handlers:n,service:(o,s,i)=>{let{protocols:a}=ug(i,e);return n.push(...(0,pu.createUniversalServiceHandlers)((0,QE.createServiceImplSpec)(o,s),a)),r},rpc:(o,s,i)=>{let{protocols:a}=ug(i,e);return n.push((0,pu.createUniversalMethodHandler)((0,QE.createMethodImplSpec)(o,s),a)),r}};return r}function ug(t,e){if(e&&!t)return e;let n=e?Object.assign(Object.assign({},(0,pu.validateUniversalHandlerOptions)(e.options)),t):Object.assign(Object.assign({},t),(0,pu.validateUniversalHandlerOptions)(t??{})),r=[];if(t?.grpc!==!1&&r.push((0,Y$.createHandlerFactory)(n)),t?.grpcWeb!==!1&&r.push((0,J$.createHandlerFactory)(n)),t?.connect!==!1&&r.push((0,K$.createHandlerFactory)(n)),r.length===0)throw new H$.ConnectError("cannot create handler, all protocols are disabled",W$.Code.InvalidArgument);return{options:n,protocols:r}}});var eD=b(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.cors=void 0;var Wn=Hn(),Z$=_n(),gs=uo();gu.cors={allowedMethods:["POST","GET"],allowedHeaders:[Wn.headerContentType,Wn.headerProtocolVersion,Wn.headerTimeout,Wn.headerStreamEncoding,Wn.headerStreamAcceptEncoding,Wn.headerUnaryEncoding,Wn.headerUnaryAcceptEncoding,Z$.headerMessageType,gs.headerXGrpcWeb,gs.headerXUserAgent,gs.headerTimeout],exposedHeaders:[gs.headerGrpcStatus,gs.headerGrpcMessage,gs.headerStatusDetailsBin,Wn.headerUnaryEncoding,Wn.headerStreamEncoding]}});var mg=b(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.requestHeader=tD;yu.requestHeaderWithCompression=Q$;var Jn=Hn(),X$=Qi(),hu=Zi();function tD(t,e,n,r,o){let s=new Headers(r??{});return n!==void 0&&s.set(Jn.headerTimeout,`${n}`),s.set(Jn.headerContentType,t=="unary"?e?hu.contentTypeUnaryProto:hu.contentTypeUnaryJson:e?hu.contentTypeStreamProto:hu.contentTypeStreamJson),s.set(Jn.headerProtocolVersion,X$.protocolVersion),!s.has(Jn.headerUserAgent)&&o&&s.set(Jn.headerUserAgent,"connect-es/2.0.0-rc.3"),s}function Q$(t,e,n,r,o,s,i){let a=tD(t,e,n,r,i);if(s!=null){let c=t=="unary"?Jn.headerUnaryEncoding:Jn.headerStreamEncoding;a.set(c,s.name)}if(o.length>0){let c=t=="unary"?Jn.headerUnaryAcceptEncoding:Jn.headerStreamAcceptEncoding;a.set(c,o.map(u=>u.name).join(","))}return a}});var yg=b(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.validateResponse=nD;bu.validateResponseWithCompression=nL;var pg=Y(),eL=iu(),gg=ne(),tL=Zi(),hg=Hn();function nD(t,e,n,r){let o=r.get(hg.headerContentType),s=(0,tL.parseContentType)(o);if(n!==200){let a=new gg.ConnectError(`HTTP ${n}`,(0,eL.codeFromHttpStatus)(n),r);if(t=="unary"&&s&&!s.binary)return{isUnaryError:!0,unaryError:a};throw a}let i={binary:e,stream:t!=="unary"};if(s?.binary!==i.binary||s.stream!==i.stream)throw new gg.ConnectError(`unsupported content type ${o}`,s===void 0?pg.Code.Unknown:pg.Code.Internal,r);return{isUnaryError:!1}}function nL(t,e,n,r,o){let s,i=o.get(t=="unary"?hg.headerUnaryEncoding:hg.headerStreamEncoding);if(i!=null&&i.toLowerCase()!=="identity"&&(s=e.find(a=>a.name===i),!s))throw new gg.ConnectError(`unsupported response encoding "${i}"`,pg.Code.Internal,o);return Object.assign({compression:s},nD(t,n,r,o))}});var vg=b(bg=>{"use strict";Object.defineProperty(bg,"__esModule",{value:!0});bg.transformConnectPostToGetRequest=iL;var rL=rs(),yo=Hn(),oL=Qi(),rD="application/";function sL(t,e){return e?(0,rL.base64Encode)(t,"url"):encodeURIComponent(new TextDecoder().decode(t))}function iL(t,e,n){let r=`?connect=v${oL.protocolVersion}`,o=t.header.get(yo.headerContentType);o?.indexOf(rD)===0&&(r+="&encoding="+encodeURIComponent(o.slice(rD.length)));let s=t.header.get(yo.headerUnaryEncoding);s!==null&&s!=="identity"&&(r+="&compression="+encodeURIComponent(s),n=!0),n&&(r+="&base64=1"),r+="&message="+sL(e,n);let i=t.url+r,a=new Headers(t.header);return[yo.headerProtocolVersion,yo.headerContentType,yo.headerUnaryContentLength,yo.headerUnaryEncoding,yo.headerUnaryAcceptEncoding].forEach(c=>a.delete(c)),Object.assign(Object.assign({},t),{requestMethod:"GET",url:i,header:a})}});var ea=b(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.runUnaryCall=cL;vu.runStreamingCall=lL;var oD=Lp(),aL=ne(),Sg=Gi(),sD=jp();function cL(t){let e=(0,oD.applyInterceptors)(t.next,t.interceptors),[n,r,o]=iD(t),s=Object.assign(Object.assign({},t.req),{message:(0,sD.normalize)(t.req.method.input,t.req.message),signal:n});return e(s).then(i=>(o(),i),r)}function lL(t){let e=(0,oD.applyInterceptors)(t.next,t.interceptors),[n,r,o]=iD(t),s=Object.assign(Object.assign({},t.req),{message:(0,sD.normalizeIterable)(t.req.method.input,t.req.message),signal:n}),i=!1;return n.addEventListener("abort",function(){var a,c;let u=t.req.message[Symbol.asyncIterator]();i||(a=u.throw)===null||a===void 0||a.call(u,this.reason).catch(()=>{}),(c=u.return)===null||c===void 0||c.call(u).catch(()=>{})}),e(s).then(a=>Object.assign(Object.assign({},a),{message:{[Symbol.asyncIterator](){let c=a.message[Symbol.asyncIterator]();return{next(){return c.next().then(u=>(u.done==!0&&(i=!0,o()),u),r)}}}}}),r)}function iD(t){let{signal:e,cleanup:n}=(0,Sg.createDeadlineSignal)(t.timeoutMs),r=(0,Sg.createLinkedAbortController)(t.signal,e);return[r.signal,function(s){let i=aL.ConnectError.from(e.aborted?(0,Sg.getAbortSignalReason)(e):s);return r.abort(i),n(),Promise.reject(i)},function(){n(),r.abort()}]}});var Dg=b(Yn=>{"use strict";var uL=Yn&&Yn.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},hs=Yn&&Yn.__await||function(t){return this instanceof hs?(this.v=t,this):new hs(t)},dL=Yn&&Yn.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof hs?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.createTransport=yL;var aD=mg(),_g=Hn(),cD=yg(),fL=cu(),mL=Xi(),lD=ou(),pL=vg(),wg=Y(),Eg=ne(),gL=ji(),nn=jt(),uD=yr(),dD=ea(),fD=vr(),mD=ls(),hL=bn();function yL(t){return{async unary(e,n,r,o,s,i){let a=(0,fD.createMethodSerializationLookup)(e,t.binaryOptions,t.jsonOptions,t);return r=r===void 0?t.defaultTimeoutMs:r<=0?void 0:r,await(0,dD.runUnaryCall)({interceptors:t.interceptors,signal:n,timeoutMs:r,req:{stream:!1,service:e.parent,method:e,requestMethod:"POST",url:(0,uD.createMethodUrl)(t.baseUrl,e),header:(0,aD.requestHeaderWithCompression)(e.methodKind,t.useBinaryFormat,r,o,t.acceptCompression,t.sendCompression,!0),contextValues:i??(0,mD.createContextValues)(),message:s},next:async c=>{let u=a.getI(t.useBinaryFormat).serialize(c.message);t.sendCompression&&u.byteLength>t.compressMinBytes?(u=await t.sendCompression.compress(u),c.header.set(_g.headerUnaryEncoding,t.sendCompression.name)):c.header.delete(_g.headerUnaryEncoding);let d=t.useHttpGet===!0&&e.idempotency===hL.MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS,m;d?c=(0,pL.transformConnectPostToGetRequest)(c,u,t.useBinaryFormat):m=(0,nn.createAsyncIterable)([u]);let p=await t.httpClient({url:c.url,method:c.requestMethod,header:c.header,signal:c.signal,body:m}),{compression:f,isUnaryError:g,unaryError:h}=(0,cD.validateResponseWithCompression)(e.methodKind,t.acceptCompression,t.useBinaryFormat,p.status,p.header),[y,_]=(0,fL.trailerDemux)(p.header),E=await(0,nn.pipeTo)(p.body,(0,nn.sinkAllBytes)(t.readMaxBytes,p.header.get(_g.headerUnaryContentLength)),{propagateDownStreamError:!1});if(f&&(E=await f.decompress(E,t.readMaxBytes)),g)throw(0,mL.errorFromJsonBytes)(E,(0,gL.appendHeaders)(y,_),h);return{stream:!1,service:e.parent,method:e,header:y,message:a.getO(t.useBinaryFormat).parse(E),trailer:_}}})},async stream(e,n,r,o,s,i){let a=(0,fD.createMethodSerializationLookup)(e,t.binaryOptions,t.jsonOptions,t),c=(0,lD.createEndStreamSerialization)(t.jsonOptions);return r=r===void 0?t.defaultTimeoutMs:r<=0?void 0:r,(0,dD.runStreamingCall)({interceptors:t.interceptors,signal:n,timeoutMs:r,req:{stream:!0,service:e.parent,method:e,requestMethod:"POST",url:(0,uD.createMethodUrl)(t.baseUrl,e),header:(0,aD.requestHeaderWithCompression)(e.methodKind,t.useBinaryFormat,r,o,t.acceptCompression,t.sendCompression,!0),contextValues:i??(0,mD.createContextValues)(),message:s},next:async u=>{let d=await t.httpClient({url:u.url,method:"POST",header:u.header,signal:u.signal,body:(0,nn.pipe)(u.message,(0,nn.transformSerializeEnvelope)(a.getI(t.useBinaryFormat)),(0,nn.transformCompressEnvelope)(t.sendCompression,t.compressMinBytes),(0,nn.transformJoinEnvelopes)(),{propagateDownStreamError:!0})}),{compression:m}=(0,cD.validateResponseWithCompression)(e.methodKind,t.acceptCompression,t.useBinaryFormat,d.status,d.header),p=Object.assign(Object.assign({},u),{header:d.header,trailer:new Headers,message:(0,nn.pipe)(d.body,(0,nn.transformSplitEnvelope)(t.readMaxBytes),(0,nn.transformDecompressEnvelope)(m??null,t.readMaxBytes),(0,nn.transformParseEnvelope)(a.getO(t.useBinaryFormat),lD.endStreamFlag,c),function(f){return dL(this,arguments,function*(){var g,h,y,_;let E=!1;try{for(var D=!0,T=uL(f),I;I=yield hs(T.next()),g=I.done,!g;D=!0){_=I.value,D=!1;let k=_;if(k.end){if(E)throw new Eg.ConnectError("protocol error: received extra EndStreamResponse",wg.Code.InvalidArgument);if(E=!0,k.value.error){let O=k.value.error;throw d.header.forEach((v,P)=>{O.metadata.append(P,v)}),O}k.value.metadata.forEach((O,v)=>p.trailer.set(v,O));continue}if(E)throw new Eg.ConnectError("protocol error: received extra message after EndStreamResponse",wg.Code.InvalidArgument);yield yield hs(k.value)}}catch(k){h={error:k}}finally{try{!D&&!g&&(y=T.return)&&(yield hs(y.call(T)))}finally{if(h)throw h.error}}if(!E)throw new Eg.ConnectError("protocol error: missing EndStreamResponse",wg.Code.InvalidArgument)})},{propagateDownStreamError:!0})});return p}})}}}});var Ag=b(kg=>{"use strict";Object.defineProperty(kg,"__esModule",{value:!0});kg.createUniversalHandlerClient=_L;var bL=Y(),vL=ne(),Cg=jt(),SL=Gi();function _L(t){let e=new Map;for(let n of t)e.set(n.requestPath,n);return async n=>{var r,o,s;let i=new URL(n.url).pathname,a=e.get(i);if(!a)throw new vL.ConnectError(`RouterHttpClient: no handler registered for ${i}`,bL.Code.Unimplemented);let c=(r=n.signal)!==null&&r!==void 0?r:new AbortController().signal,u=await pD(c,a({body:(o=n.body)!==null&&o!==void 0?o:(0,Cg.createAsyncIterable)([]),httpVersion:"2.0",method:n.method,url:n.url,header:n.header,signal:c})),d=(s=u.body)!==null&&s!==void 0?s:(0,Cg.createAsyncIterable)([]);return{body:(0,Cg.pipe)(d,m=>({[Symbol.asyncIterator](){let p=m[Symbol.asyncIterator](),f={next(){return pD(c,p.next())}};return p.throw!==void 0&&(f.throw=g=>p.throw(g)),p.return!==void 0&&(f.return=g=>p.return(g)),f}})),header:new Headers(u.header),status:u.status,trailer:new Headers(u.trailer)}}}function pD(t,e){let n,r=new Promise((o,s)=>{let i=()=>s((0,SL.getAbortSignalReason)(t));if(t.aborted)return i();t.addEventListener("abort",i),n=()=>t.removeEventListener("abort",i)});return Promise.race([r,e]).finally(n)}});var gD=b(Tg=>{"use strict";Object.defineProperty(Tg,"__esModule",{value:!0});Tg.createRouterTransport=CL;var wL=Dg(),EL=Ag(),DL=fg();function CL(t,e){var n,r;let o=(0,DL.createConnectRouter)(Object.assign(Object.assign({},(n=e?.router)!==null&&n!==void 0?n:{}),{connect:!0}));return t(o),(0,wL.createTransport)(Object.assign({httpClient:(0,EL.createUniversalHandlerClient)(o.handlers),baseUrl:"https://in-memory",useBinaryFormat:!0,interceptors:[],acceptCompression:[],sendCompression:null,compressMinBytes:Number.MAX_SAFE_INTEGER,readMaxBytes:Number.MAX_SAFE_INTEGER,writeMaxBytes:Number.MAX_SAFE_INTEGER},(r=e?.transport)!==null&&r!==void 0?r:{}))}});var Er=b(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.createRouterTransport=ee.createMethodImplSpec=ee.createServiceImplSpec=ee.makeAnyClient=ee.createContextValues=ee.createContextKey=ee.cors=ee.createHandlerContext=ee.createConnectRouter=ee.createClient=ee.createCallbackClient=ee.appendHeaders=ee.decodeBinaryHeader=ee.encodeBinaryHeader=ee.Code=ee.ConnectError=void 0;var kL=ne();Object.defineProperty(ee,"ConnectError",{enumerable:!0,get:function(){return kL.ConnectError}});var AL=Y();Object.defineProperty(ee,"Code",{enumerable:!0,get:function(){return AL.Code}});var Fg=ji();Object.defineProperty(ee,"encodeBinaryHeader",{enumerable:!0,get:function(){return Fg.encodeBinaryHeader}});Object.defineProperty(ee,"decodeBinaryHeader",{enumerable:!0,get:function(){return Fg.decodeBinaryHeader}});Object.defineProperty(ee,"appendHeaders",{enumerable:!0,get:function(){return Fg.appendHeaders}});var TL=Lw();Object.defineProperty(ee,"createCallbackClient",{enumerable:!0,get:function(){return TL.createCallbackClient}});var FL=Jw();Object.defineProperty(ee,"createClient",{enumerable:!0,get:function(){return FL.createClient}});var OL=fg();Object.defineProperty(ee,"createConnectRouter",{enumerable:!0,get:function(){return OL.createConnectRouter}});var IL=co();Object.defineProperty(ee,"createHandlerContext",{enumerable:!0,get:function(){return IL.createHandlerContext}});var NL=eD();Object.defineProperty(ee,"cors",{enumerable:!0,get:function(){return NL.cors}});var hD=ls();Object.defineProperty(ee,"createContextKey",{enumerable:!0,get:function(){return hD.createContextKey}});Object.defineProperty(ee,"createContextValues",{enumerable:!0,get:function(){return hD.createContextValues}});var xL=xl();Object.defineProperty(ee,"makeAnyClient",{enumerable:!0,get:function(){return xL.makeAnyClient}});var yD=co();Object.defineProperty(ee,"createServiceImplSpec",{enumerable:!0,get:function(){return yD.createServiceImplSpec}});Object.defineProperty(ee,"createMethodImplSpec",{enumerable:!0,get:function(){return yD.createMethodImplSpec}});var PL=gD();Object.defineProperty(ee,"createRouterTransport",{enumerable:!0,get:function(){return PL.createRouterTransport}})});var bD=b(Og=>{"use strict";Object.defineProperty(Og,"__esModule",{value:!0});Og.serviceDesc=RL;function RL(t,e,...n){if(n.length>0)throw new Error;return t.services[e]}});var SD=b(vD=>{"use strict";Object.defineProperty(vD,"__esModule",{value:!0})});var Ig=b(ct=>{"use strict";var jL=ct&&ct.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),kn=ct&&ct.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&jL(e,t,n)};Object.defineProperty(ct,"__esModule",{value:!0});kn(dl(),ct);kn(Cp(),ct);kn(yn(),ct);kn(Ai(),ct);kn(Qe(),ct);kn(Xe(),ct);kn(bD(),ct);kn(Fp(),ct);kn(Ip(),ct);kn(SD(),ct)});var _u=b((Su,_D)=>{(function(t,e){typeof Su=="object"&&typeof _D<"u"?e(Su):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.compareVersions={}))})(Su,function(t){"use strict";let e=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,n=y=>{if(typeof y!="string")throw new TypeError("Invalid argument expected string");let _=y.match(e);if(!_)throw new Error(`Invalid argument not valid semver ('${y}' received)`);return _.shift(),_},r=y=>y==="*"||y==="x"||y==="X",o=y=>{let _=parseInt(y,10);return isNaN(_)?y:_},s=(y,_)=>typeof y!=typeof _?[String(y),String(_)]:[y,_],i=(y,_)=>{if(r(y)||r(_))return 0;let[E,D]=s(o(y),o(_));return E>D?1:E<D?-1:0},a=(y,_)=>{for(let E=0;E<Math.max(y.length,_.length);E++){let D=i(y[E]||"0",_[E]||"0");if(D!==0)return D}return 0},c=(y,_)=>{let E=n(y),D=n(_),T=E.pop(),I=D.pop(),k=a(E,D);return k!==0?k:T&&I?a(T.split("."),I.split(".")):T||I?T?-1:1:0},u=(y,_,E)=>{p(E);let D=c(y,_);return d[E].includes(D)},d={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},m=Object.keys(d),p=y=>{if(typeof y!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof y}`);if(m.indexOf(y)===-1)throw new Error(`Invalid operator, expected one of ${m.join("|")}`)},f=(y,_)=>{if(_=_.replace(/([><=]+)\s+/g,"$1"),_.includes("||"))return _.split("||").some(Nn=>f(y,Nn));if(_.includes(" - ")){let[Nn,Jd]=_.split(" - ",2);return f(y,`>=${Nn} <=${Jd}`)}else if(_.includes(" "))return _.trim().replace(/\s{2,}/g," ").split(" ").every(Nn=>f(y,Nn));let E=_.match(/^([<>=~^]+)/),D=E?E[1]:"=";if(D!=="^"&&D!=="~")return u(y,_,D);let[T,I,k,,O]=n(y),[v,P,U,,de]=n(_),fe=[T,I,k],nr=[v,P??"x",U??"x"];if(de&&(!O||a(fe,nr)!==0||a(O.split("."),de.split("."))===-1))return!1;let Ka=nr.findIndex(Nn=>Nn!=="0")+1,rr=D==="~"?2:Ka>1?Ka:1;return!(a(fe.slice(0,rr),nr.slice(0,rr))!==0||a(fe.slice(rr),nr.slice(rr))===-1)},g=y=>typeof y=="string"&&/^[v\d]/.test(y)&&e.test(y),h=y=>typeof y=="string"&&/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(y);t.compare=u,t.compareVersions=c,t.satisfies=f,t.validate=g,t.validateStrict=h})});var TD=b(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.createFetchClient=$L;Dr.createFetchHandler=LL;Dr.universalClientRequestToFetch=wD;Dr.universalClientResponseFromFetch=ED;Dr.universalServerRequestFromFetch=DD;Dr.universalServerResponseToFetch=CD;function $L(t){return async function(n){let r=await t(wD(n));return ED(r)}}function LL(t,e){async function n(r){let o=DD(r,e??{}),s=await t(o);return CD(s)}return Object.assign(n,t)}function wD(t){let e=t.body===void 0?null:kD(t.body);return new Request(t.url,{method:t.method,headers:t.header,signal:t.signal,body:e})}function ED(t){return{status:t.status,header:t.headers,body:AD(t.body),trailer:new Headers}}function DD(t,e){var n;return{httpVersion:(n=e.httpVersion)!==null&&n!==void 0?n:"",method:t.method,url:t.url,header:t.headers,body:AD(t.body),signal:t.signal}}function CD(t){let e=null;return t.body!==void 0&&(e=kD(t.body)),new Response(e,{status:t.status,headers:t.header})}function kD(t){let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=await e.next();if(r.done===!0){n.close();return}n.enqueue(r.value)},async cancel(n){if(e.throw)try{await e.throw(n)}catch{}}})}function AD(t){let e=t?.getReader();return{[Symbol.asyncIterator](){return{async next(){if(e!==void 0){let n=await e.read();return n.done?{done:!0,value:void 0}:n}return{done:!0,value:void 0}},async throw(n){return e!==void 0&&await e.cancel(n),{done:!0,value:void 0}}}}}}});var Pg=b(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.uResponseOk=A.assertByteStreamRequest=A.createDeadlineSignal=A.getAbortSignalReason=A.createLinkedAbortController=A.transformInvokeImplementation=A.invokeUnaryImplementation=A.contentTypeMatcher=A.untilFirst=A.readAllBytes=A.createAsyncIterable=A.createWritableIterable=A.makeIterableAbortable=A.sinkAllBytes=A.sinkAll=A.pipeTo=A.transformParseEnvelope=A.transformSerializeEnvelope=A.transformSplitEnvelope=A.transformJoinEnvelopes=A.transformDecompressEnvelope=A.transformCompressEnvelope=A.transformReadAllBytes=A.transformPrepend=A.transformAppend=A.transformCatchFinally=A.transformCatch=A.pipe=A.compressionNegotiate=A.compressedFlag=A.createEnvelopeReadableStream=A.envelopeCompress=A.envelopeDecompress=A.encodeEnvelopes=A.encodeEnvelope=A.validateReadWriteMaxBytes=A.limitSerialization=A.getJsonOptions=A.createClientMethodSerializers=A.createMethodSerializationLookup=A.runStreamingCall=A.runUnaryCall=A.universalServerResponseToFetch=A.universalServerRequestFromFetch=A.universalClientResponseFromFetch=A.universalClientRequestToFetch=A.createFetchHandler=A.createFetchClient=A.createUniversalHandlerClient=A.createMethodUrl=void 0;A.createUniversalMethodHandler=A.createUniversalServiceHandlers=A.validateUniversalHandlerOptions=A.uResponseVersionNotSupported=A.uResponseMethodNotAllowed=A.uResponseUnsupportedMediaType=A.uResponseNotFound=void 0;var BL=yr();Object.defineProperty(A,"createMethodUrl",{enumerable:!0,get:function(){return BL.createMethodUrl}});var ML=Ag();Object.defineProperty(A,"createUniversalHandlerClient",{enumerable:!0,get:function(){return ML.createUniversalHandlerClient}});var ys=TD();Object.defineProperty(A,"createFetchClient",{enumerable:!0,get:function(){return ys.createFetchClient}});Object.defineProperty(A,"createFetchHandler",{enumerable:!0,get:function(){return ys.createFetchHandler}});Object.defineProperty(A,"universalClientRequestToFetch",{enumerable:!0,get:function(){return ys.universalClientRequestToFetch}});Object.defineProperty(A,"universalClientResponseFromFetch",{enumerable:!0,get:function(){return ys.universalClientResponseFromFetch}});Object.defineProperty(A,"universalServerRequestFromFetch",{enumerable:!0,get:function(){return ys.universalServerRequestFromFetch}});Object.defineProperty(A,"universalServerResponseToFetch",{enumerable:!0,get:function(){return ys.universalServerResponseToFetch}});var FD=ea();Object.defineProperty(A,"runUnaryCall",{enumerable:!0,get:function(){return FD.runUnaryCall}});Object.defineProperty(A,"runStreamingCall",{enumerable:!0,get:function(){return FD.runStreamingCall}});var wu=vr();Object.defineProperty(A,"createMethodSerializationLookup",{enumerable:!0,get:function(){return wu.createMethodSerializationLookup}});Object.defineProperty(A,"createClientMethodSerializers",{enumerable:!0,get:function(){return wu.createClientMethodSerializers}});Object.defineProperty(A,"getJsonOptions",{enumerable:!0,get:function(){return wu.getJsonOptions}});Object.defineProperty(A,"limitSerialization",{enumerable:!0,get:function(){return wu.limitSerialization}});var UL=Bi();Object.defineProperty(A,"validateReadWriteMaxBytes",{enumerable:!0,get:function(){return UL.validateReadWriteMaxBytes}});var ta=bp();Object.defineProperty(A,"encodeEnvelope",{enumerable:!0,get:function(){return ta.encodeEnvelope}});Object.defineProperty(A,"encodeEnvelopes",{enumerable:!0,get:function(){return ta.encodeEnvelopes}});Object.defineProperty(A,"envelopeDecompress",{enumerable:!0,get:function(){return ta.envelopeDecompress}});Object.defineProperty(A,"envelopeCompress",{enumerable:!0,get:function(){return ta.envelopeCompress}});Object.defineProperty(A,"createEnvelopeReadableStream",{enumerable:!0,get:function(){return ta.createEnvelopeReadableStream}});var OD=is();Object.defineProperty(A,"compressedFlag",{enumerable:!0,get:function(){return OD.compressedFlag}});Object.defineProperty(A,"compressionNegotiate",{enumerable:!0,get:function(){return OD.compressionNegotiate}});var Re=jt();Object.defineProperty(A,"pipe",{enumerable:!0,get:function(){return Re.pipe}});Object.defineProperty(A,"transformCatch",{enumerable:!0,get:function(){return Re.transformCatch}});Object.defineProperty(A,"transformCatchFinally",{enumerable:!0,get:function(){return Re.transformCatchFinally}});Object.defineProperty(A,"transformAppend",{enumerable:!0,get:function(){return Re.transformAppend}});Object.defineProperty(A,"transformPrepend",{enumerable:!0,get:function(){return Re.transformPrepend}});Object.defineProperty(A,"transformReadAllBytes",{enumerable:!0,get:function(){return Re.transformReadAllBytes}});Object.defineProperty(A,"transformCompressEnvelope",{enumerable:!0,get:function(){return Re.transformCompressEnvelope}});Object.defineProperty(A,"transformDecompressEnvelope",{enumerable:!0,get:function(){return Re.transformDecompressEnvelope}});Object.defineProperty(A,"transformJoinEnvelopes",{enumerable:!0,get:function(){return Re.transformJoinEnvelopes}});Object.defineProperty(A,"transformSplitEnvelope",{enumerable:!0,get:function(){return Re.transformSplitEnvelope}});Object.defineProperty(A,"transformSerializeEnvelope",{enumerable:!0,get:function(){return Re.transformSerializeEnvelope}});Object.defineProperty(A,"transformParseEnvelope",{enumerable:!0,get:function(){return Re.transformParseEnvelope}});Object.defineProperty(A,"pipeTo",{enumerable:!0,get:function(){return Re.pipeTo}});Object.defineProperty(A,"sinkAll",{enumerable:!0,get:function(){return Re.sinkAll}});Object.defineProperty(A,"sinkAllBytes",{enumerable:!0,get:function(){return Re.sinkAllBytes}});Object.defineProperty(A,"makeIterableAbortable",{enumerable:!0,get:function(){return Re.makeIterableAbortable}});Object.defineProperty(A,"createWritableIterable",{enumerable:!0,get:function(){return Re.createWritableIterable}});Object.defineProperty(A,"createAsyncIterable",{enumerable:!0,get:function(){return Re.createAsyncIterable}});Object.defineProperty(A,"readAllBytes",{enumerable:!0,get:function(){return Re.readAllBytes}});Object.defineProperty(A,"untilFirst",{enumerable:!0,get:function(){return Re.untilFirst}});var GL=us();Object.defineProperty(A,"contentTypeMatcher",{enumerable:!0,get:function(){return GL.contentTypeMatcher}});var ID=Wi();Object.defineProperty(A,"invokeUnaryImplementation",{enumerable:!0,get:function(){return ID.invokeUnaryImplementation}});Object.defineProperty(A,"transformInvokeImplementation",{enumerable:!0,get:function(){return ID.transformInvokeImplementation}});var Ng=Gi();Object.defineProperty(A,"createLinkedAbortController",{enumerable:!0,get:function(){return Ng.createLinkedAbortController}});Object.defineProperty(A,"getAbortSignalReason",{enumerable:!0,get:function(){return Ng.getAbortSignalReason}});Object.defineProperty(A,"createDeadlineSignal",{enumerable:!0,get:function(){return Ng.createDeadlineSignal}});var bs=ds();Object.defineProperty(A,"assertByteStreamRequest",{enumerable:!0,get:function(){return bs.assertByteStreamRequest}});Object.defineProperty(A,"uResponseOk",{enumerable:!0,get:function(){return bs.uResponseOk}});Object.defineProperty(A,"uResponseNotFound",{enumerable:!0,get:function(){return bs.uResponseNotFound}});Object.defineProperty(A,"uResponseUnsupportedMediaType",{enumerable:!0,get:function(){return bs.uResponseUnsupportedMediaType}});Object.defineProperty(A,"uResponseMethodNotAllowed",{enumerable:!0,get:function(){return bs.uResponseMethodNotAllowed}});Object.defineProperty(A,"uResponseVersionNotSupported",{enumerable:!0,get:function(){return bs.uResponseVersionNotSupported}});var xg=ms();Object.defineProperty(A,"validateUniversalHandlerOptions",{enumerable:!0,get:function(){return xg.validateUniversalHandlerOptions}});Object.defineProperty(A,"createUniversalServiceHandlers",{enumerable:!0,get:function(){return xg.createUniversalServiceHandlers}});Object.defineProperty(A,"createUniversalMethodHandler",{enumerable:!0,get:function(){return xg.createUniversalMethodHandler}})});var jD=b($=>{"use strict";var VL=$&&$.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),qL=$&&$.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&VL(e,t,n)};Object.defineProperty($,"__esModule",{value:!0});$.codeToString=$.codeFromString=$.protocolVersion=$.transformConnectPostToGetRequest=$.trailerDemux=$.trailerMux=$.validateResponseWithCompression=$.validateResponse=$.parseTimeout=$.contentTypeStreamRegExp=$.contentTypeUnaryRegExp=$.contentTypeRegExp=$.contentTypeStreamJson=$.contentTypeStreamProto=$.contentTypeUnaryJson=$.contentTypeUnaryProto=$.parseContentType=$.errorToJsonBytes=$.errorToJson=$.errorFromJsonBytes=$.errorFromJson=$.createEndStreamSerialization=$.endStreamFlag=$.endStreamFromJson=$.endStreamToJson=$.requestHeaderWithCompression=$.requestHeader=$.codeToHttpStatus=$.codeFromHttpStatus=$.createTransport=$.createHandlerFactory=void 0;var HL=lg();Object.defineProperty($,"createHandlerFactory",{enumerable:!0,get:function(){return HL.createHandlerFactory}});var WL=Dg();Object.defineProperty($,"createTransport",{enumerable:!0,get:function(){return WL.createTransport}});var ND=iu();Object.defineProperty($,"codeFromHttpStatus",{enumerable:!0,get:function(){return ND.codeFromHttpStatus}});Object.defineProperty($,"codeToHttpStatus",{enumerable:!0,get:function(){return ND.codeToHttpStatus}});var xD=mg();Object.defineProperty($,"requestHeader",{enumerable:!0,get:function(){return xD.requestHeader}});Object.defineProperty($,"requestHeaderWithCompression",{enumerable:!0,get:function(){return xD.requestHeaderWithCompression}});var Eu=ou();Object.defineProperty($,"endStreamToJson",{enumerable:!0,get:function(){return Eu.endStreamToJson}});Object.defineProperty($,"endStreamFromJson",{enumerable:!0,get:function(){return Eu.endStreamFromJson}});Object.defineProperty($,"endStreamFlag",{enumerable:!0,get:function(){return Eu.endStreamFlag}});Object.defineProperty($,"createEndStreamSerialization",{enumerable:!0,get:function(){return Eu.createEndStreamSerialization}});var Du=Xi();Object.defineProperty($,"errorFromJson",{enumerable:!0,get:function(){return Du.errorFromJson}});Object.defineProperty($,"errorFromJsonBytes",{enumerable:!0,get:function(){return Du.errorFromJsonBytes}});Object.defineProperty($,"errorToJson",{enumerable:!0,get:function(){return Du.errorToJson}});Object.defineProperty($,"errorToJsonBytes",{enumerable:!0,get:function(){return Du.errorToJsonBytes}});var Cr=Zi();Object.defineProperty($,"parseContentType",{enumerable:!0,get:function(){return Cr.parseContentType}});Object.defineProperty($,"contentTypeUnaryProto",{enumerable:!0,get:function(){return Cr.contentTypeUnaryProto}});Object.defineProperty($,"contentTypeUnaryJson",{enumerable:!0,get:function(){return Cr.contentTypeUnaryJson}});Object.defineProperty($,"contentTypeStreamProto",{enumerable:!0,get:function(){return Cr.contentTypeStreamProto}});Object.defineProperty($,"contentTypeStreamJson",{enumerable:!0,get:function(){return Cr.contentTypeStreamJson}});Object.defineProperty($,"contentTypeRegExp",{enumerable:!0,get:function(){return Cr.contentTypeRegExp}});Object.defineProperty($,"contentTypeUnaryRegExp",{enumerable:!0,get:function(){return Cr.contentTypeUnaryRegExp}});Object.defineProperty($,"contentTypeStreamRegExp",{enumerable:!0,get:function(){return Cr.contentTypeStreamRegExp}});var JL=ng();Object.defineProperty($,"parseTimeout",{enumerable:!0,get:function(){return JL.parseTimeout}});var PD=yg();Object.defineProperty($,"validateResponse",{enumerable:!0,get:function(){return PD.validateResponse}});Object.defineProperty($,"validateResponseWithCompression",{enumerable:!0,get:function(){return PD.validateResponseWithCompression}});var RD=cu();Object.defineProperty($,"trailerMux",{enumerable:!0,get:function(){return RD.trailerMux}});Object.defineProperty($,"trailerDemux",{enumerable:!0,get:function(){return RD.trailerDemux}});qL(Hn(),$);var YL=vg();Object.defineProperty($,"transformConnectPostToGetRequest",{enumerable:!0,get:function(){return YL.transformConnectPostToGetRequest}});var KL=Qi();Object.defineProperty($,"protocolVersion",{enumerable:!0,get:function(){return KL.protocolVersion}});var zL=Pi();Object.defineProperty($,"codeFromString",{enumerable:!0,get:function(){return zL.codeFromString}});var ZL=Pi();Object.defineProperty($,"codeToString",{enumerable:!0,get:function(){return ZL.codeToString}})});var jg=b(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});Rg.assertFetchApi=XL;function XL(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}}});var LD=b(bo=>{"use strict";var ra=bo&&bo.__await||function(t){return this instanceof ra?(this.v=t,this):new ra(t)},QL=bo&&bo.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof ra?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(bo,"__esModule",{value:!0});bo.createConnectTransport=rB;var eB=Sn(),na=Er(),rn=Pg(),on=jD(),tB=jg(),nB=bn(),$D={redirect:"error"};function rB(t){var e;(0,tB.assertFetchApi)();let n=(e=t.useBinaryFormat)!==null&&e!==void 0?e:!1;return{async unary(r,o,s,i,a,c){let{serialize:u,parse:d}=(0,rn.createClientMethodSerializers)(r,n,t.jsonOptions,t.binaryOptions);return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await(0,rn.runUnaryCall)({interceptors:t.interceptors,signal:o,timeoutMs:s,req:{stream:!1,service:r.parent,method:r,requestMethod:"POST",url:(0,rn.createMethodUrl)(t.baseUrl,r),header:(0,on.requestHeader)(r.methodKind,n,s,i,!1),contextValues:c??(0,na.createContextValues)(),message:a},next:async m=>{var p;let f=t.useHttpGet===!0&&r.idempotency===nB.MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS,g=null;f?m=(0,on.transformConnectPostToGetRequest)(m,u(m.message),n):g=u(m.message);let y=await((p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch)(m.url,Object.assign(Object.assign({},$D),{method:m.requestMethod,headers:m.header,signal:m.signal,body:g})),{isUnaryError:_,unaryError:E}=(0,on.validateResponse)(r.methodKind,n,y.status,y.headers);if(_)throw(0,on.errorFromJson)(await y.json(),(0,na.appendHeaders)(...(0,on.trailerDemux)(y.headers)),E);let[D,T]=(0,on.trailerDemux)(y.headers);return{stream:!1,service:r.parent,method:r,header:D,message:n?d(new Uint8Array(await y.arrayBuffer())):(0,eB.fromJson)(r.output,await y.json(),(0,rn.getJsonOptions)(t.jsonOptions)),trailer:T}}})},async stream(r,o,s,i,a,c){let{serialize:u,parse:d}=(0,rn.createClientMethodSerializers)(r,n,t.jsonOptions,t.binaryOptions);function m(f,g,h,y){return QL(this,arguments,function*(){let E=(0,rn.createEnvelopeReadableStream)(f).getReader(),D=!1;for(;;){let T=yield ra(E.read());if(T.done)break;let{flags:I,data:k}=T.value;if((I&rn.compressedFlag)===rn.compressedFlag)throw new na.ConnectError("protocol error: received unsupported compressed output",na.Code.Internal);if((I&on.endStreamFlag)===on.endStreamFlag){D=!0;let O=(0,on.endStreamFromJson)(k);if(O.error){let v=O.error;throw h.forEach((P,U)=>{v.metadata.append(U,P)}),v}O.metadata.forEach((v,P)=>g.set(P,v));continue}yield yield ra(d(k))}if("throwIfAborted"in y&&y.throwIfAborted(),!D)throw"missing EndStreamResponse"})}async function p(f){if(r.methodKind!="server_streaming")throw"The fetch API does not support streaming request bodies";let g=await f[Symbol.asyncIterator]().next();if(g.done==!0)throw"missing request message";return(0,rn.encodeEnvelope)(0,u(g.value))}return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await(0,rn.runStreamingCall)({interceptors:t.interceptors,timeoutMs:s,signal:o,req:{stream:!0,service:r.parent,method:r,requestMethod:"POST",url:(0,rn.createMethodUrl)(t.baseUrl,r),header:(0,on.requestHeader)(r.methodKind,n,s,i,!1),contextValues:c??(0,na.createContextValues)(),message:a},next:async f=>{var g;let y=await((g=t.fetch)!==null&&g!==void 0?g:globalThis.fetch)(f.url,Object.assign(Object.assign({},$D),{method:f.requestMethod,headers:f.header,signal:f.signal,body:await p(f.message)}));if((0,on.validateResponse)(r.methodKind,n,y.status,y.headers),y.body===null)throw"missing response body";let _=new Headers;return Object.assign(Object.assign({},f),{header:y.headers,trailer:_,message:m(y.body,_,y.headers,f.signal)})}})}}}});var Cu=b($g=>{"use strict";Object.defineProperty($g,"__esModule",{value:!0});$g.validateTrailer=aB;var oB=Y(),sB=ne(),BD=_n(),iB=po();function aB(t,e){let n=(0,iB.findTrailerError)(t);if(n)throw e.forEach((r,o)=>{n.metadata.append(o,r)}),n;if(!e.has(BD.headerGrpcStatus)&&!t.has(BD.headerGrpcStatus))throw new sB.ConnectError("protocol error: missing status",oB.Code.Internal)}});var Lg=b(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.requestHeader=UD;ku.requestHeaderWithCompression=cB;var sn=uo(),MD=Gl();function UD(t,e,n,r){let o=new Headers(n??{});o.set(sn.headerContentType,t?MD.contentTypeProto:MD.contentTypeJson),o.set(sn.headerXGrpcWeb,"1");let s="connect-es/2.0.0-rc.3";return s=o.has(sn.headerUserAgent)?o.get(sn.headerUserAgent):o.has(sn.headerXUserAgent)?o.get(sn.headerXUserAgent):s,o.set(sn.headerXUserAgent,s),r&&o.set(sn.headerUserAgent,s),e!==void 0&&o.set(sn.headerTimeout,`${e}m`),o}function cB(t,e,n,r,o,s){let i=UD(t,e,n,s);return o!=null&&i.set(sn.headerEncoding,o.name),r.length>0&&i.set(sn.headerAcceptEncoding,r.map(a=>a.name).join(",")),i}});var Au=b(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});Bg.codeFromHttpStatus=lB;var Kn=Y();function lB(t){switch(t){case 400:return Kn.Code.Internal;case 401:return Kn.Code.Unauthenticated;case 403:return Kn.Code.PermissionDenied;case 404:return Kn.Code.Unimplemented;case 429:return Kn.Code.Unavailable;case 502:return Kn.Code.Unavailable;case 503:return Kn.Code.Unavailable;case 504:return Kn.Code.Unavailable;default:return Kn.Code.Unknown}}});var Ug=b(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.validateResponse=VD;Tu.validateResponseWithCompression=mB;var GD=ne(),uB=Y(),Mg=uo(),dB=Au(),fB=po();function VD(t,e){var n;if(t>=200&&t<300)return{foundStatus:e.has(Mg.headerGrpcStatus),headerError:(0,fB.findTrailerError)(e)};throw new GD.ConnectError(decodeURIComponent((n=e.get(Mg.headerGrpcMessage))!==null&&n!==void 0?n:`HTTP ${t}`),(0,dB.codeFromHttpStatus)(t),e)}function mB(t,e,n){let{foundStatus:r,headerError:o}=VD(e,n),s,i=n.get(Mg.headerEncoding);if(i!==null&&i.toLowerCase()!=="identity"&&(s=t.find(a=>a.name===i),!s))throw new GD.ConnectError(`unsupported response encoding "${i}"`,uB.Code.Internal,n);return{foundStatus:r,compression:s,headerError:o}}});var QD=b(zn=>{"use strict";var qD=zn&&zn.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},Ar=zn&&zn.__await||function(t){return this instanceof Ar?(this.v=t,this):new Ar(t)},pB=zn&&zn.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof Ar?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(zn,"__esModule",{value:!0});zn.createTransport=gB;var HD=Cu(),WD=Lg(),JD=Ug(),Fu=Ul(),An=Y(),kr=ne(),tt=jt(),YD=yr(),KD=ea(),zD=vr(),ZD=ls(),XD=uo();function gB(t){return{async unary(e,n,r,o,s,i){let a=(0,zD.createMethodSerializationLookup)(e,t.binaryOptions,t.jsonOptions,t);return r=r===void 0?t.defaultTimeoutMs:r<=0?void 0:r,await(0,KD.runUnaryCall)({interceptors:t.interceptors,signal:n,timeoutMs:r,req:{stream:!1,service:e.parent,method:e,requestMethod:"POST",url:(0,YD.createMethodUrl)(t.baseUrl,e),header:(0,WD.requestHeaderWithCompression)(t.useBinaryFormat,r,o,t.acceptCompression,t.sendCompression,!0),contextValues:i??(0,ZD.createContextValues)(),message:s},next:async c=>{let u=await t.httpClient({url:c.url,method:c.requestMethod,header:c.header,signal:c.signal,body:(0,tt.pipe)((0,tt.createAsyncIterable)([c.message]),(0,tt.transformSerializeEnvelope)(a.getI(t.useBinaryFormat)),(0,tt.transformCompressEnvelope)(t.sendCompression,t.compressMinBytes),(0,tt.transformJoinEnvelopes)(),{propagateDownStreamError:!0})}),{compression:d,headerError:m}=(0,JD.validateResponseWithCompression)(t.acceptCompression,u.status,u.header),{trailer:p,message:f}=await(0,tt.pipeTo)(u.body,(0,tt.transformSplitEnvelope)(t.readMaxBytes),(0,tt.transformDecompressEnvelope)(d??null,t.readMaxBytes),(0,tt.transformParseEnvelope)(a.getO(t.useBinaryFormat),Fu.trailerFlag,(0,Fu.createTrailerSerialization)()),async g=>{var h,y,_,E;let D,T;try{for(var I=!0,k=qD(g),O;O=await k.next(),h=O.done,!h;I=!0){E=O.value,I=!1;let v=E;if(v.end){if(T!==void 0)throw new kr.ConnectError("protocol error: received extra trailer",An.Code.Unimplemented);T=v.value}else{if(D!==void 0)throw new kr.ConnectError("protocol error: received extra output message for unary method",An.Code.Unimplemented);D=v.value}}}catch(v){y={error:v}}finally{try{!I&&!h&&(_=k.return)&&await _.call(k)}finally{if(y)throw y.error}}return{trailer:T,message:D}},{propagateDownStreamError:!1});if(p===void 0)throw m??new kr.ConnectError("protocol error: missing trailer",u.header.has(XD.headerGrpcStatus)?An.Code.Unimplemented:An.Code.Unknown);if((0,HD.validateTrailer)(p,u.header),f===void 0)throw new kr.ConnectError("protocol error: missing output message for unary method",p.has(XD.headerGrpcStatus)?An.Code.Unimplemented:An.Code.Unknown);return{stream:!1,service:e.parent,method:e,header:u.header,message:f,trailer:p}}})},async stream(e,n,r,o,s,i){let a=(0,zD.createMethodSerializationLookup)(e,t.binaryOptions,t.jsonOptions,t);return r=r===void 0?t.defaultTimeoutMs:r<=0?void 0:r,(0,KD.runStreamingCall)({interceptors:t.interceptors,signal:n,timeoutMs:r,req:{stream:!0,service:e.parent,method:e,requestMethod:"POST",url:(0,YD.createMethodUrl)(t.baseUrl,e),header:(0,WD.requestHeaderWithCompression)(t.useBinaryFormat,r,o,t.acceptCompression,t.sendCompression,!0),contextValues:i??(0,ZD.createContextValues)(),message:s},next:async c=>{let u=await t.httpClient({url:c.url,method:c.requestMethod,header:c.header,signal:c.signal,body:(0,tt.pipe)(c.message,(0,tt.transformSerializeEnvelope)(a.getI(t.useBinaryFormat)),(0,tt.transformCompressEnvelope)(t.sendCompression,t.compressMinBytes),(0,tt.transformJoinEnvelopes)(),{propagateDownStreamError:!0})}),{compression:d,foundStatus:m,headerError:p}=(0,JD.validateResponseWithCompression)(t.acceptCompression,u.status,u.header);if(p)throw p;let f=Object.assign(Object.assign({},c),{header:u.header,trailer:new Headers,message:(0,tt.pipe)(u.body,(0,tt.transformSplitEnvelope)(t.readMaxBytes),(0,tt.transformDecompressEnvelope)(d??null,t.readMaxBytes),(0,tt.transformParseEnvelope)(a.getO(t.useBinaryFormat),Fu.trailerFlag,(0,Fu.createTrailerSerialization)()),function(g){return pB(this,arguments,function*(){var h,y,_,E;if(m){if((yield Ar(g[Symbol.asyncIterator]().next())).done!==!0)throw new kr.ConnectError("protocol error: extra data for trailers-only",An.Code.InvalidArgument);return yield Ar(void 0)}let D=!1;try{for(var T=!0,I=qD(g),k;k=yield Ar(I.next()),h=k.done,!h;T=!0){E=k.value,T=!1;let O=E;if(O.end){if(D)throw new kr.ConnectError("protocol error: received extra trailer",An.Code.InvalidArgument);D=!0,(0,HD.validateTrailer)(O.value,u.header),O.value.forEach((v,P)=>f.trailer.set(P,v));continue}if(D)throw new kr.ConnectError("protocol error: received extra message after trailer",An.Code.InvalidArgument);yield yield Ar(O.value)}}catch(O){y={error:O}}finally{try{!T&&!h&&(_=I.return)&&(yield Ar(_.call(I)))}finally{if(y)throw y.error}}if(!D)throw new kr.ConnectError("protocol error: missing trailer",An.Code.Internal)})},{propagateDownStreamError:!0})});return f}})}}}});var Gg=b(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.requestHeader=tC;Ou.requestHeaderWithCompression=hB;var vs=_n(),eC=zi();function tC(t,e,n){let r=new Headers(n??{});return r.set(vs.headerContentType,t?eC.contentTypeProto:eC.contentTypeJson),r.has(vs.headerUserAgent)||r.set(vs.headerUserAgent,"connect-es/2.0.0-rc.3"),e!==void 0&&r.set(vs.headerTimeout,`${e}m`),r.set("Te","trailers"),r}function hB(t,e,n,r,o){let s=tC(t,e,n);return o!=null&&s.set(vs.headerEncoding,o.name),r.length>0&&s.set(vs.headerAcceptEncoding,r.map(i=>i.name).join(",")),s}});var Hg=b(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.validateResponse=rC;Iu.validateResponseWithCompression=SB;var yB=Au(),Vg=ne(),bB=po(),nC=Y(),qg=_n(),vB=zi();function rC(t,e){if(t!=200)throw new Vg.ConnectError(`HTTP ${t}`,(0,yB.codeFromHttpStatus)(t),e);let n=e.get(qg.headerContentType);if((0,vB.parseContentType)(n)==null)throw new Vg.ConnectError(`unsupported content type ${n}`,nC.Code.Unknown);return{foundStatus:e.has(qg.headerGrpcStatus),headerError:(0,bB.findTrailerError)(e)}}function SB(t,e,n){let{foundStatus:r,headerError:o}=rC(e,n),s,i=n.get(qg.headerEncoding);if(i!==null&&i.toLowerCase()!=="identity"&&(s=t.find(a=>a.name===i),!s))throw new Vg.ConnectError(`unsupported response encoding "${i}"`,nC.Code.Internal,n);return{foundStatus:r,compression:s,headerError:o}}});var fC=b(an=>{"use strict";var oC=an&&an.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(i){return new Promise(function(a,c){i=t[s](i),o(a,c,i.done,i.value)})}}function o(s,i,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},i)}},oa=an&&an.__await||function(t){return this instanceof oa?(this.v=t,this):new oa(t)},_B=an&&an.__asyncDelegator||function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,s){e[o]=t[o]?function(i){return(n=!n)?{value:oa(t[o](i)),done:!1}:s?s(i):i}:s}},wB=an&&an.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof oa?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(an,"__esModule",{value:!0});an.createTransport=DB;var sC=Gg(),iC=Hg(),aC=Cu(),Nu=Y(),Wg=ne(),nt=jt(),cC=yr(),lC=ea(),uC=vr(),dC=ls(),EB=_n();function DB(t){return{async unary(e,n,r,o,s,i){let a=(0,uC.createMethodSerializationLookup)(e,t.binaryOptions,t.jsonOptions,t);return r=r===void 0?t.defaultTimeoutMs:r<=0?void 0:r,await(0,lC.runUnaryCall)({interceptors:t.interceptors,signal:n,timeoutMs:r,req:{stream:!1,service:e.parent,method:e,requestMethod:"POST",url:(0,cC.createMethodUrl)(t.baseUrl,e),header:(0,sC.requestHeaderWithCompression)(t.useBinaryFormat,r,o,t.acceptCompression,t.sendCompression),contextValues:i??(0,dC.createContextValues)(),message:s},next:async c=>{let u=await t.httpClient({url:c.url,method:"POST",header:c.header,signal:c.signal,body:(0,nt.pipe)((0,nt.createAsyncIterable)([c.message]),(0,nt.transformSerializeEnvelope)(a.getI(t.useBinaryFormat)),(0,nt.transformCompressEnvelope)(t.sendCompression,t.compressMinBytes),(0,nt.transformJoinEnvelopes)(),{propagateDownStreamError:!0})}),{compression:d,headerError:m}=(0,iC.validateResponseWithCompression)(t.acceptCompression,u.status,u.header),p=await(0,nt.pipeTo)(u.body,(0,nt.transformSplitEnvelope)(t.readMaxBytes),(0,nt.transformDecompressEnvelope)(d??null,t.readMaxBytes),(0,nt.transformParseEnvelope)(a.getO(t.useBinaryFormat)),async f=>{var g,h,y,_;let E;try{for(var D=!0,T=oC(f),I;I=await T.next(),g=I.done,!g;D=!0){_=I.value,D=!1;let k=_;if(E!==void 0)throw new Wg.ConnectError("protocol error: received extra output message for unary method",Nu.Code.Unimplemented);E=k}}catch(k){h={error:k}}finally{try{!D&&!g&&(y=T.return)&&await y.call(T)}finally{if(h)throw h.error}}return E},{propagateDownStreamError:!1});if((0,aC.validateTrailer)(u.trailer,u.header),p===void 0)throw m||new Wg.ConnectError("protocol error: missing output message for unary method",u.trailer.has(EB.headerGrpcStatus)?Nu.Code.Unimplemented:Nu.Code.Unknown);if(m)throw new Wg.ConnectError("protocol error: received output message for unary method with error status",Nu.Code.Unknown);return{stream:!1,service:e.parent,method:e,header:u.header,message:p,trailer:u.trailer}}})},async stream(e,n,r,o,s,i){let a=(0,uC.createMethodSerializationLookup)(e,t.binaryOptions,t.jsonOptions,t);return r=r===void 0?t.defaultTimeoutMs:r<=0?void 0:r,(0,lC.runStreamingCall)({interceptors:t.interceptors,signal:n,timeoutMs:r,req:{stream:!0,service:e.parent,method:e,requestMethod:"POST",url:(0,cC.createMethodUrl)(t.baseUrl,e),header:(0,sC.requestHeaderWithCompression)(t.useBinaryFormat,r,o,t.acceptCompression,t.sendCompression),contextValues:i??(0,dC.createContextValues)(),message:s},next:async c=>{let u=await t.httpClient({url:c.url,method:"POST",header:c.header,signal:c.signal,body:(0,nt.pipe)(c.message,(0,nt.transformSerializeEnvelope)(a.getI(t.useBinaryFormat)),(0,nt.transformCompressEnvelope)(t.sendCompression,t.compressMinBytes),(0,nt.transformJoinEnvelopes)(),{propagateDownStreamError:!0})}),{compression:d,foundStatus:m,headerError:p}=(0,iC.validateResponseWithCompression)(t.acceptCompression,u.status,u.header);if(p)throw p;return Object.assign(Object.assign({},c),{header:u.header,trailer:u.trailer,message:(0,nt.pipe)(u.body,(0,nt.transformSplitEnvelope)(t.readMaxBytes),(0,nt.transformDecompressEnvelope)(d??null,t.readMaxBytes),(0,nt.transformParseEnvelope)(a.getO(t.useBinaryFormat)),function(g){return wB(this,arguments,function*(){yield oa(yield*_B(oC(g))),m||(0,aC.validateTrailer)(u.trailer,u.header)})},{propagateDownStreamError:!0})})}})}}}});var gC=b(q=>{"use strict";var CB=q&&q.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),kB=q&&q.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&CB(e,t,n)};Object.defineProperty(q,"__esModule",{value:!0});q.validateTrailer=q.validateResponseWithCompression=q.validateResponse=q.grpcStatusOk=q.setTrailerStatus=q.findTrailerError=q.parseTimeout=q.contentTypeProto=q.contentTypeJson=q.contentTypeRegExp=q.parseContentType=q.requestHeaderWithCompression=q.requestHeader=q.codeFromHttpStatus=q.createTransport=q.createHandlerFactory=void 0;var AB=Zp();Object.defineProperty(q,"createHandlerFactory",{enumerable:!0,get:function(){return AB.createHandlerFactory}});var TB=fC();Object.defineProperty(q,"createTransport",{enumerable:!0,get:function(){return TB.createTransport}});var FB=Au();Object.defineProperty(q,"codeFromHttpStatus",{enumerable:!0,get:function(){return FB.codeFromHttpStatus}});var mC=Gg();Object.defineProperty(q,"requestHeader",{enumerable:!0,get:function(){return mC.requestHeader}});Object.defineProperty(q,"requestHeaderWithCompression",{enumerable:!0,get:function(){return mC.requestHeaderWithCompression}});var xu=zi();Object.defineProperty(q,"parseContentType",{enumerable:!0,get:function(){return xu.parseContentType}});Object.defineProperty(q,"contentTypeRegExp",{enumerable:!0,get:function(){return xu.contentTypeRegExp}});Object.defineProperty(q,"contentTypeJson",{enumerable:!0,get:function(){return xu.contentTypeJson}});Object.defineProperty(q,"contentTypeProto",{enumerable:!0,get:function(){return xu.contentTypeProto}});var OB=Vl();Object.defineProperty(q,"parseTimeout",{enumerable:!0,get:function(){return OB.parseTimeout}});var Jg=po();Object.defineProperty(q,"findTrailerError",{enumerable:!0,get:function(){return Jg.findTrailerError}});Object.defineProperty(q,"setTrailerStatus",{enumerable:!0,get:function(){return Jg.setTrailerStatus}});Object.defineProperty(q,"grpcStatusOk",{enumerable:!0,get:function(){return Jg.grpcStatusOk}});var pC=Hg();Object.defineProperty(q,"validateResponse",{enumerable:!0,get:function(){return pC.validateResponse}});Object.defineProperty(q,"validateResponseWithCompression",{enumerable:!0,get:function(){return pC.validateResponseWithCompression}});var IB=Cu();Object.defineProperty(q,"validateTrailer",{enumerable:!0,get:function(){return IB.validateTrailer}});kB(_n(),q)});var bC=b(V=>{"use strict";var NB=V&&V.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),xB=V&&V.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&NB(e,t,n)};Object.defineProperty(V,"__esModule",{value:!0});V.grpcStatusOk=V.validateTrailer=V.setTrailerStatus=V.parseTimeout=V.createTrailerSerialization=V.trailerSerialize=V.trailerParse=V.trailerFlag=V.validateResponseWithCompression=V.validateResponse=V.contentTypeJson=V.contentTypeProto=V.contentTypeRegExp=V.parseContentType=V.requestHeaderWithCompression=V.requestHeader=V.createTransport=V.createHandlerFactory=void 0;var PB=Jp();Object.defineProperty(V,"createHandlerFactory",{enumerable:!0,get:function(){return PB.createHandlerFactory}});var RB=QD();Object.defineProperty(V,"createTransport",{enumerable:!0,get:function(){return RB.createTransport}});var hC=Lg();Object.defineProperty(V,"requestHeader",{enumerable:!0,get:function(){return hC.requestHeader}});Object.defineProperty(V,"requestHeaderWithCompression",{enumerable:!0,get:function(){return hC.requestHeaderWithCompression}});var Pu=Gl();Object.defineProperty(V,"parseContentType",{enumerable:!0,get:function(){return Pu.parseContentType}});Object.defineProperty(V,"contentTypeRegExp",{enumerable:!0,get:function(){return Pu.contentTypeRegExp}});Object.defineProperty(V,"contentTypeProto",{enumerable:!0,get:function(){return Pu.contentTypeProto}});Object.defineProperty(V,"contentTypeJson",{enumerable:!0,get:function(){return Pu.contentTypeJson}});var yC=Ug();Object.defineProperty(V,"validateResponse",{enumerable:!0,get:function(){return yC.validateResponse}});Object.defineProperty(V,"validateResponseWithCompression",{enumerable:!0,get:function(){return yC.validateResponseWithCompression}});var Ru=Ul();Object.defineProperty(V,"trailerFlag",{enumerable:!0,get:function(){return Ru.trailerFlag}});Object.defineProperty(V,"trailerParse",{enumerable:!0,get:function(){return Ru.trailerParse}});Object.defineProperty(V,"trailerSerialize",{enumerable:!0,get:function(){return Ru.trailerSerialize}});Object.defineProperty(V,"createTrailerSerialization",{enumerable:!0,get:function(){return Ru.createTrailerSerialization}});var ju=gC();Object.defineProperty(V,"parseTimeout",{enumerable:!0,get:function(){return ju.parseTimeout}});Object.defineProperty(V,"setTrailerStatus",{enumerable:!0,get:function(){return ju.setTrailerStatus}});Object.defineProperty(V,"validateTrailer",{enumerable:!0,get:function(){return ju.validateTrailer}});Object.defineProperty(V,"grpcStatusOk",{enumerable:!0,get:function(){return ju.grpcStatusOk}});xB(uo(),V)});var SC=b(So=>{"use strict";var vo=So&&So.__await||function(t){return this instanceof vo?(this.v=t,this):new vo(t)},jB=So&&So.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(f){return function(g){return Promise.resolve(g).then(f,m)}}function a(f,g){r[f]&&(o[f]=function(h){return new Promise(function(y,_){s.push([f,h,y,_])>1||c(f,h)})},g&&(o[f]=g(o[f])))}function c(f,g){try{u(r[f](g))}catch(h){p(s[0][3],h)}}function u(f){f.value instanceof vo?Promise.resolve(f.value.v).then(d,m):p(s[0][2],f)}function d(f){c("next",f)}function m(f){c("throw",f)}function p(f,g){f(g),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(So,"__esModule",{value:!0});So.createGrpcWebTransport=LB;var Mt=Er(),Ut=Pg(),It=bC(),$B=jg(),vC={redirect:"error"};function LB(t){var e;(0,$B.assertFetchApi)();let n=(e=t.useBinaryFormat)!==null&&e!==void 0?e:!0;return{async unary(r,o,s,i,a,c){let{serialize:u,parse:d}=(0,Ut.createClientMethodSerializers)(r,n,t.jsonOptions,t.binaryOptions);return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await(0,Ut.runUnaryCall)({interceptors:t.interceptors,signal:o,timeoutMs:s,req:{stream:!1,service:r.parent,method:r,requestMethod:"POST",url:(0,Ut.createMethodUrl)(t.baseUrl,r),header:(0,It.requestHeader)(n,s,i,!1),contextValues:c??(0,Mt.createContextValues)(),message:a},next:async m=>{var p;let g=await((p=t.fetch)!==null&&p!==void 0?p:globalThis.fetch)(m.url,Object.assign(Object.assign({},vC),{method:m.requestMethod,headers:m.header,signal:m.signal,body:(0,Ut.encodeEnvelope)(0,u(m.message))})),{headerError:h}=(0,It.validateResponse)(g.status,g.headers);if(!g.body)throw h!==void 0?h:"missing response body";let y=(0,Ut.createEnvelopeReadableStream)(g.body).getReader(),_,E;for(;;){let D=await y.read();if(D.done)break;let{flags:T,data:I}=D.value;if((T&Ut.compressedFlag)===Ut.compressedFlag)throw new Mt.ConnectError("protocol error: received unsupported compressed output",Mt.Code.Internal);if(T===It.trailerFlag){if(_!==void 0)throw"extra trailer";_=(0,It.trailerParse)(I);continue}if(E!==void 0)throw new Mt.ConnectError("extra message",Mt.Code.Unimplemented);E=d(I)}if(_===void 0)throw h!==void 0?h:new Mt.ConnectError("missing trailer",g.headers.has(It.headerGrpcStatus)?Mt.Code.Unimplemented:Mt.Code.Unknown);if((0,It.validateTrailer)(_,g.headers),E===void 0)throw new Mt.ConnectError("missing message",_.has(It.headerGrpcStatus)?Mt.Code.Unimplemented:Mt.Code.Unknown);return{stream:!1,service:r.parent,method:r,header:g.headers,message:E,trailer:_}}})},async stream(r,o,s,i,a,c){let{serialize:u,parse:d}=(0,Ut.createClientMethodSerializers)(r,n,t.jsonOptions,t.binaryOptions);function m(f,g,h,y,_){return jB(this,arguments,function*(){let D=(0,Ut.createEnvelopeReadableStream)(f).getReader();if(g){if(!(yield vo(D.read())).done)throw"extra data for trailers-only";return yield vo(void 0)}let T=!1;for(;;){let I=yield vo(D.read());if(I.done)break;let{flags:k,data:O}=I.value;if((k&It.trailerFlag)===It.trailerFlag){if(T)throw"extra trailer";T=!0;let v=(0,It.trailerParse)(O);(0,It.validateTrailer)(v,y),v.forEach((P,U)=>h.set(U,P));continue}if(T)throw"extra message";yield yield vo(d(O))}if("throwIfAborted"in _&&_.throwIfAborted(),!T)throw"missing trailer"})}async function p(f){if(r.methodKind!="server_streaming")throw"The fetch API does not support streaming request bodies";let g=await f[Symbol.asyncIterator]().next();if(g.done==!0)throw"missing request message";return(0,Ut.encodeEnvelope)(0,u(g.value))}return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,(0,Ut.runStreamingCall)({interceptors:t.interceptors,signal:o,timeoutMs:s,req:{stream:!0,service:r.parent,method:r,requestMethod:"POST",url:(0,Ut.createMethodUrl)(t.baseUrl,r),header:(0,It.requestHeader)(n,s,i,!1),contextValues:c??(0,Mt.createContextValues)(),message:a},next:async f=>{var g;let y=await((g=t.fetch)!==null&&g!==void 0?g:globalThis.fetch)(f.url,Object.assign(Object.assign({},vC),{method:f.requestMethod,headers:f.header,signal:f.signal,body:await p(f.message)})),{foundStatus:_,headerError:E}=(0,It.validateResponse)(y.status,y.headers);if(E!=null)throw E;if(!y.body)throw"missing response body";let D=new Headers;return Object.assign(Object.assign({},f),{header:y.headers,trailer:D,message:m(y.body,_,D,y.headers,f.signal)})}})}}}});var _C=b(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.createGrpcWebTransport=Ss.createConnectTransport=void 0;var BB=LD();Object.defineProperty(Ss,"createConnectTransport",{enumerable:!0,get:function(){return BB.createConnectTransport}});var MB=SC();Object.defineProperty(Ss,"createGrpcWebTransport",{enumerable:!0,get:function(){return MB.createGrpcWebTransport}})});var fa=b((RJ,GC)=>{"use strict";var UB=Object.create,ua=Object.defineProperty,GB=Object.defineProperties,VB=Object.getOwnPropertyDescriptor,qB=Object.getOwnPropertyDescriptors,HB=Object.getOwnPropertyNames,wC=Object.getOwnPropertySymbols,WB=Object.getPrototypeOf,AC=Object.prototype.hasOwnProperty,JB=Object.prototype.propertyIsEnumerable,Xg=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),EC=(t,e,n)=>e in t?ua(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,we=(t,e)=>{for(var n in e||(e={}))AC.call(e,n)&&EC(t,n,e[n]);if(wC)for(var n of wC(e))JB.call(e,n)&&EC(t,n,e[n]);return t},Eo=(t,e)=>GB(t,qB(e)),YB=(t,e)=>{for(var n in e)ua(t,n,{get:e[n],enumerable:!0})},TC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of HB(e))!AC.call(t,o)&&o!==n&&ua(t,o,{get:()=>e[o],enumerable:!(r=VB(e,o))||r.enumerable});return t},rh=(t,e,n)=>(n=t!=null?UB(WB(t)):{},TC(e||!t||!t.__esModule?ua(n,"default",{value:t,enumerable:!0}):n,t)),KB=t=>TC(ua({},"__esModule",{value:!0}),t),Do=function(t,e){this[0]=t,this[1]=e},oh=(t,e,n)=>{var r=(i,a,c,u)=>{try{var d=n[i](a),m=(a=d.value)instanceof Do,p=d.done;Promise.resolve(m?a[0]:a).then(f=>m?r(i==="return"?i:"next",a[1]?{done:f.done,value:f.value}:f,c,u):c({value:f,done:p})).catch(f=>r("throw",f,c,u))}catch(f){u(f)}},o=i=>s[i]=a=>new Promise((c,u)=>r(i,a,c,u)),s={};return n=n.apply(t,e),s[Xg("asyncIterator")]=()=>s,o("next"),o("throw"),o("return"),s},ca=(t,e,n)=>(e=t[Xg("asyncIterator")])?e.call(t):(t=t[Xg("iterator")](),e={},n=(r,o)=>(o=t[r])&&(e[r]=s=>new Promise((i,a,c)=>(s=o.call(t,s),c=s.done,Promise.resolve(s.value).then(u=>i({value:u,done:c}),a)))),n("next"),n("return"),e),FC={};YB(FC,{ApiClient:()=>wo,AuthenticationError:()=>la,CommandExitError:()=>LC,ConnectionConfig:()=>Tn,FileType:()=>$C,FilesystemEventType:()=>jC,InvalidArgumentError:()=>Vu,NotEnoughSpaceError:()=>NC,NotFoundError:()=>da,RateLimitError:()=>xC,Sandbox:()=>UC,SandboxError:()=>gt,TemplateError:()=>ih,TimeoutError:()=>Bu,default:()=>_M,getSignature:()=>Qg});GC.exports=KB(FC);var zB=rh(fm()),Lu=rh(Mv()),OC="1.13.2";function ZB(){var t,e,n;return globalThis.Bun?{runtime:"bun",version:globalThis.Bun.version}:globalThis.Deno?{runtime:"deno",version:globalThis.Deno.version.deno}:((e=(t=globalThis.process)==null?void 0:t.release)==null?void 0:e.name)==="node"?{runtime:"node",version:Lu.default.version||"unknown"}:typeof EdgeRuntime=="string"?{runtime:"vercel-edge",version:"unknown"}:((n=globalThis.navigator)==null?void 0:n.userAgent)==="Cloudflare-Workers"?{runtime:"cloudflare-worker",version:"unknown"}:typeof window<"u"?{runtime:"browser",version:Lu.default.version||"unknown"}:{runtime:"unknown",version:"unknown"}}var{runtime:sh,version:XB}=ZB(),DC,QB={browser:typeof window<"u"&&Lu.default.name||"unknown",lang:"js",lang_version:XB,package_version:OC,publisher:"e2b",sdk_runtime:sh,system:((DC=Lu.default.os)==null?void 0:DC.family)||"unknown"};function $u(t){return sh==="deno"?Deno.env.get(t):typeof process>"u"?"":process.env[t]}function IC(t){return new Bu(`${t}: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeoutMs' when starting the sandbox or calling '.setTimeout' on the sandbox with the desired timeout.`)}var gt=class extends Error{constructor(t){super(t),this.name="SandboxError"}},Bu=class extends gt{constructor(t){super(t),this.name="TimeoutError"}},Vu=class extends gt{constructor(t){super(t),this.name="InvalidArgumentError"}},NC=class extends gt{constructor(t){super(t),this.name="NotEnoughSpaceError"}},da=class extends gt{constructor(t){super(t),this.name="NotFoundError"}},la=class extends gt{constructor(t){super(t),this.name="AuthenticationError"}},ih=class extends gt{constructor(t){super(t),this.name="TemplateError"}},xC=class extends gt{constructor(t){super(t),this.name="RateLimitError"}};function CC(t){return JSON.parse(JSON.stringify(t))}function eM(t){function e(n){return oh(this,null,function*(){var r;try{for(var o=ca(n),s,i,a;s=!(i=yield new Do(o.next())).done;s=!1){let c=i.value;(r=t.debug)==null||r.call(t,"Response stream:",CC(c)),yield c}}catch(c){a=[c]}finally{try{s&&(i=o.return)&&(yield new Do(i.call(o)))}finally{if(a)throw a[0]}}})}return n=>async r=>{var o,s;(o=t.info)==null||o.call(t,`Request: POST ${r.url}`);let i=await n(r);return i.stream?Eo(we({},i),{message:e(i.message)}):((s=t.info)==null||s.call(t,"Response:",CC(i.message)),i)}}function PC(t){return{async onRequest(e){var n;return(n=t.info)==null||n.call(t,`Request ${e.method} ${e.url}`),e},async onResponse(e){var n,r;return e.status>=400?(n=t.error)==null||n.call(t,"Response:",e.status,e.statusText):(r=t.info)==null||r.call(t,"Response:",e.status,e.statusText),e}}}function _s(t){var e,n;if(!t.error)return;if(t.response.status===429)return new xC("Rate limit exceeded, please try again later.");let r=(n=(e=t.error)==null?void 0:e.message)!=null?n:t.error;return new gt(`${t.response.status}: ${r}`)}var wo=class{constructor(t,e={requireAccessToken:!1,requireApiKey:!0}){if(!e?.requireApiKey&&!t.apiKey)throw new la("API key is required, please visit the Team tab at https://e2b.dev/dashboard to get your API key. You can either set the environment variable `E2B_API_KEY` or you can pass it directly to the sandbox like Sandbox.create({ apiKey: 'e2b_...' })");if(e?.requireAccessToken&&!t.accessToken)throw new la("Access token is required, please visit the Personal tab at https://e2b.dev/dashboard to get your access token. You can set the environment variable `E2B_ACCESS_TOKEN` or pass the `accessToken` in options.");this.api=(0,zB.default)({baseUrl:t.apiUrl,headers:we(we(we(we({},QB),t.apiKey&&{"X-API-KEY":t.apiKey}),t.accessToken&&{Authorization:`Bearer ${t.accessToken}`}),t.headers)}),t.logger&&this.api.use(PC(t.logger))}},tM=6e4,Mu=50,Uu="Keepalive-Ping-Interval",Tn=class ia{constructor(e){var n;this.apiKey=e?.apiKey||ia.apiKey,this.debug=e?.debug||ia.debug,this.domain=e?.domain||ia.domain,this.accessToken=e?.accessToken||ia.accessToken,this.requestTimeoutMs=(n=e?.requestTimeoutMs)!=null?n:tM,this.logger=e?.logger,this.headers=e?.headers||{},this.headers["User-Agent"]=`e2b-js-sdk/${OC}`,this.apiUrl=this.debug?"http://localhost:3000":`https://api.${this.domain}`}static get domain(){return $u("E2B_DOMAIN")||"e2b.app"}static get debug(){return($u("E2B_DEBUG")||"false").toLowerCase()==="true"}static get apiKey(){return $u("E2B_API_KEY")}static get accessToken(){return $u("E2B_ACCESS_TOKEN")}getSignal(e){let n=e??this.requestTimeoutMs;return n?AbortSignal.timeout(n):void 0}},ws="user";async function nM(t){if(typeof crypto<"u"){let o=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",o),i=new Uint8Array(s);return btoa(String.fromCharCode(...i))}let{createHash:e}=require("crypto");return e("sha256").update(t,"utf8").digest().toString("base64")}async function Qg({path:t,operation:e,user:n,expirationInSeconds:r,envdAccessToken:o}){if(!o)throw new Error("Access token is not set and signature cannot be generated!");let s=r?Math.floor(Date.now()/1e3)+r:null,i;return s===null?i=`${t}:${e}:${n}:${o}`:i=`${t}:${e}:${n}:${o}:${s.toString()}`,{signature:"v1_"+(await nM(i)).replace(/=+$/,""),expiration:s}}var sa=Er(),rM=rh(fm()),Gu=Er();async function eh(t){var e;if(!t.error)return;let n=typeof t.error=="string"?t.error:((e=t.error)==null?void 0:e.message)||await t.response.text();switch(t.response.status){case 400:return new Vu(n);case 401:return new la(n);case 404:return new da(n);case 429:return new gt(`${t.response.status}: ${n}: The requests are being rate limited.`);case 502:return IC(n);case 507:return new NC(n);default:return new gt(`${t.response.status}: ${n}`)}}async function th(t){var e;let n;try{n=(await t[Symbol.asyncIterator]().next()).value}catch(r){throw r instanceof Gu.ConnectError&&r.code===Gu.Code.Unavailable?new da("Sandbox is probably not running anymore"):r}if(((e=n.event)==null?void 0:e.event.case)!=="start")throw new Error("Expected start event");return n.event.event.value.pid}async function oM(t){var e;let n;try{n=(await t[Symbol.asyncIterator]().next()).value}catch(r){throw r instanceof Gu.ConnectError&&r.code===Gu.Code.Unavailable?new da("Sandbox is probably not running anymore"):r}if(((e=n.event)==null?void 0:e.case)!=="start")throw new Error("Expected start event");return n.event.value}var sM=class{constructor(t,e){this.api=(0,rM.default)({baseUrl:t.apiUrl,fetch:t?.fetch,headers:t?.headers}),this.version=e.version,t.logger&&this.api.use(PC(t.logger))}},_o=Er();function Ye(t){if(t instanceof _o.ConnectError)switch(t.code){case _o.Code.InvalidArgument:return new Vu(t.message);case _o.Code.Unauthenticated:return new la(t.message);case _o.Code.NotFound:return new da(t.message);case _o.Code.Unavailable:return IC(t.message);case _o.Code.Canceled:return new Bu(`${t.message}: This error is likely due to exceeding 'requestTimeoutMs'. You can pass the request timeout value as an option when making the request.`);case _o.Code.DeadlineExceeded:return new Bu(`${t.message}: This error is likely due to exceeding 'timeoutMs' \u2014 the total time a long running request (like command execution or directory watch) can be active. It can be modified by passing 'timeoutMs' when making the request. Use '0' to disable the timeout.`);default:return new gt(`${t.code}: ${t.message}`)}return t}function iM(t){switch(sh){case"deno":return btoa(t);case"node":return Buffer.from(t).toString("base64");case"bun":return Buffer.from(t).toString("base64");default:return btoa(t)}}function Zn(t){let e=`${t||ws}:`;return{Authorization:`Basic ${iM(e)}`}}var RC=Ig(),aM=bn(),cM=(0,RC.fileDesc)("ChtmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0ucHJvdG8SCmZpbGVzeXN0ZW0iMgoLTW92ZVJlcXVlc3QSDgoGc291cmNlGAEgASgJEhMKC2Rlc3RpbmF0aW9uGAIgASgJIjQKDE1vdmVSZXNwb25zZRIkCgVlbnRyeRgBIAEoCzIVLmZpbGVzeXN0ZW0uRW50cnlJbmZvIh4KDk1ha2VEaXJSZXF1ZXN0EgwKBHBhdGgYASABKAkiNwoPTWFrZURpclJlc3BvbnNlEiQKBWVudHJ5GAEgASgLMhUuZmlsZXN5c3RlbS5FbnRyeUluZm8iHQoNUmVtb3ZlUmVxdWVzdBIMCgRwYXRoGAEgASgJIhAKDlJlbW92ZVJlc3BvbnNlIhsKC1N0YXRSZXF1ZXN0EgwKBHBhdGgYASABKAkiNAoMU3RhdFJlc3BvbnNlEiQKBWVudHJ5GAEgASgLMhUuZmlsZXN5c3RlbS5FbnRyeUluZm8i/QEKCUVudHJ5SW5mbxIMCgRuYW1lGAEgASgJEiIKBHR5cGUYAiABKA4yFC5maWxlc3lzdGVtLkZpbGVUeXBlEgwKBHBhdGgYAyABKAkSDAoEc2l6ZRgEIAEoAxIMCgRtb2RlGAUgASgNEhMKC3Blcm1pc3Npb25zGAYgASgJEg0KBW93bmVyGAcgASgJEg0KBWdyb3VwGAggASgJEjEKDW1vZGlmaWVkX3RpbWUYCSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEhsKDnN5bWxpbmtfdGFyZ2V0GAogASgJSACIAQFCEQoPX3N5bWxpbmtfdGFyZ2V0Ii0KDkxpc3REaXJSZXF1ZXN0EgwKBHBhdGgYASABKAkSDQoFZGVwdGgYAiABKA0iOQoPTGlzdERpclJlc3BvbnNlEiYKB2VudHJpZXMYASADKAsyFS5maWxlc3lzdGVtLkVudHJ5SW5mbyIyCg9XYXRjaERpclJlcXVlc3QSDAoEcGF0aBgBIAEoCRIRCglyZWN1cnNpdmUYAiABKAgiRAoPRmlsZXN5c3RlbUV2ZW50EgwKBG5hbWUYASABKAkSIwoEdHlwZRgCIAEoDjIVLmZpbGVzeXN0ZW0uRXZlbnRUeXBlIuABChBXYXRjaERpclJlc3BvbnNlEjgKBXN0YXJ0GAEgASgLMicuZmlsZXN5c3RlbS5XYXRjaERpclJlc3BvbnNlLlN0YXJ0RXZlbnRIABIxCgpmaWxlc3lzdGVtGAIgASgLMhsuZmlsZXN5c3RlbS5GaWxlc3lzdGVtRXZlbnRIABI7CglrZWVwYWxpdmUYAyABKAsyJi5maWxlc3lzdGVtLldhdGNoRGlyUmVzcG9uc2UuS2VlcEFsaXZlSAAaDAoKU3RhcnRFdmVudBoLCglLZWVwQWxpdmVCBwoFZXZlbnQiNwoUQ3JlYXRlV2F0Y2hlclJlcXVlc3QSDAoEcGF0aBgBIAEoCRIRCglyZWN1cnNpdmUYAiABKAgiKwoVQ3JlYXRlV2F0Y2hlclJlc3BvbnNlEhIKCndhdGNoZXJfaWQYASABKAkiLQoXR2V0V2F0Y2hlckV2ZW50c1JlcXVlc3QSEgoKd2F0Y2hlcl9pZBgBIAEoCSJHChhHZXRXYXRjaGVyRXZlbnRzUmVzcG9uc2USKwoGZXZlbnRzGAEgAygLMhsuZmlsZXN5c3RlbS5GaWxlc3lzdGVtRXZlbnQiKgoUUmVtb3ZlV2F0Y2hlclJlcXVlc3QSEgoKd2F0Y2hlcl9pZBgBIAEoCSIXChVSZW1vdmVXYXRjaGVyUmVzcG9uc2UqUgoIRmlsZVR5cGUSGQoVRklMRV9UWVBFX1VOU1BFQ0lGSUVEEAASEgoORklMRV9UWVBFX0ZJTEUQARIXChNGSUxFX1RZUEVfRElSRUNUT1JZEAIqmAEKCUV2ZW50VHlwZRIaChZFVkVOVF9UWVBFX1VOU1BFQ0lGSUVEEAASFQoRRVZFTlRfVFlQRV9DUkVBVEUQARIUChBFVkVOVF9UWVBFX1dSSVRFEAISFQoRRVZFTlRfVFlQRV9SRU1PVkUQAxIVChFFVkVOVF9UWVBFX1JFTkFNRRAEEhQKEEVWRU5UX1RZUEVfQ0hNT0QQBTKfBQoKRmlsZXN5c3RlbRI5CgRTdGF0EhcuZmlsZXN5c3RlbS5TdGF0UmVxdWVzdBoYLmZpbGVzeXN0ZW0uU3RhdFJlc3BvbnNlEkIKB01ha2VEaXISGi5maWxlc3lzdGVtLk1ha2VEaXJSZXF1ZXN0GhsuZmlsZXN5c3RlbS5NYWtlRGlyUmVzcG9uc2USOQoETW92ZRIXLmZpbGVzeXN0ZW0uTW92ZVJlcXVlc3QaGC5maWxlc3lzdGVtLk1vdmVSZXNwb25zZRJCCgdMaXN0RGlyEhouZmlsZXN5c3RlbS5MaXN0RGlyUmVxdWVzdBobLmZpbGVzeXN0ZW0uTGlzdERpclJlc3BvbnNlEj8KBlJlbW92ZRIZLmZpbGVzeXN0ZW0uUmVtb3ZlUmVxdWVzdBoaLmZpbGVzeXN0ZW0uUmVtb3ZlUmVzcG9uc2USRwoIV2F0Y2hEaXISGy5maWxlc3lzdGVtLldhdGNoRGlyUmVxdWVzdBocLmZpbGVzeXN0ZW0uV2F0Y2hEaXJSZXNwb25zZTABElQKDUNyZWF0ZVdhdGNoZXISIC5maWxlc3lzdGVtLkNyZWF0ZVdhdGNoZXJSZXF1ZXN0GiEuZmlsZXN5c3RlbS5DcmVhdGVXYXRjaGVyUmVzcG9uc2USXQoQR2V0V2F0Y2hlckV2ZW50cxIjLmZpbGVzeXN0ZW0uR2V0V2F0Y2hlckV2ZW50c1JlcXVlc3QaJC5maWxlc3lzdGVtLkdldFdhdGNoZXJFdmVudHNSZXNwb25zZRJUCg1SZW1vdmVXYXRjaGVyEiAuZmlsZXN5c3RlbS5SZW1vdmVXYXRjaGVyUmVxdWVzdBohLmZpbGVzeXN0ZW0uUmVtb3ZlV2F0Y2hlclJlc3BvbnNlQmkKDmNvbS5maWxlc3lzdGVtQg9GaWxlc3lzdGVtUHJvdG9QAaICA0ZYWKoCCkZpbGVzeXN0ZW3KAgpGaWxlc3lzdGVt4gIWRmlsZXN5c3RlbVxHUEJNZXRhZGF0YeoCCkZpbGVzeXN0ZW1iBnByb3RvMw",[aM.file_google_protobuf_timestamp]),lM=(0,RC.serviceDesc)(cM,0),jC=(t=>(t.CHMOD="chmod",t.CREATE="create",t.REMOVE="remove",t.RENAME="rename",t.WRITE="write",t))(jC||{});function uM(t){switch(t){case 5:return"chmod";case 1:return"create";case 3:return"remove";case 4:return"rename";case 2:return"write"}}var dM=class{constructor(t,e,n,r){this.handleStop=t,this.events=e,this.onEvent=n,this.onExit=r,this.handleEvents()}async stop(){this.handleStop()}iterateEvents(){return oh(this,null,function*(){try{try{for(var t=ca(this.events),e,n,r;e=!(n=yield new Do(t.next())).done;e=!1){let o=n.value;switch(o.event.case){case"filesystem":yield o.event;break}}}catch(o){r=[o]}finally{try{e&&(n=t.return)&&(yield new Do(n.call(t)))}finally{if(r)throw r[0]}}}catch(o){throw Ye(o)}})}async handleEvents(){var t,e,n;try{try{for(var r=ca(this.iterateEvents()),o,s,i;o=!(s=await r.next()).done;o=!1){let a=s.value,c=uM(a.value.type);c!==void 0&&((t=this.onEvent)==null||t.call(this,{name:a.value.name,type:c}))}}catch(a){i=[a]}finally{try{o&&(s=r.return)&&await s.call(r)}finally{if(i)throw i[0]}}(e=this.onExit)==null||e.call(this)}catch(a){(n=this.onExit)==null||n.call(this,a)}}},fM=_u(),mM="0.1.4",$C=(t=>(t.FILE="file",t.DIR="dir",t))($C||{});function Yg(t){switch(t){case 2:return"dir";case 1:return"file"}}function Kg(t){if(t)return new Date(Number(t.seconds)*1e3+Math.floor(t.nanos/1e6))}var pM=class{constructor(t,e,n){this.envdApi=e,this.connectionConfig=n,this.defaultWatchTimeout=6e4,this.defaultWatchRecursive=!1,this.rpc=(0,sa.createClient)(lM,t)}async read(t,e){var n;let r=(n=e?.format)!=null?n:"text",o=await this.envdApi.api.GET("/files",{params:{query:{path:t,username:e?.user||ws}},parseAs:r==="bytes"?"arrayBuffer":r,signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)}),s=await eh(o);if(s)throw s;return r==="bytes"?new Uint8Array(o.data):o.response.headers.get("content-length")==="0"?"":o.data}async write(t,e,n){if(typeof t!="string"&&!Array.isArray(t))throw new Error("Path or files are required");if(typeof t=="string"&&Array.isArray(e))throw new Error("Cannot specify both path and array of files. You have to specify either path and data for a single file or an array for multiple files.");let{path:r,writeOpts:o,writeFiles:s}=typeof t=="string"?{path:t,writeOpts:n,writeFiles:[{data:e}]}:{path:void 0,writeOpts:e,writeFiles:t};if(s.length===0)return[];let i=await Promise.all(s.map(d=>new Response(d.data).blob())),a=await this.envdApi.api.POST("/files",{params:{query:{path:r,username:o?.user||ws}},bodySerializer(){return i.reduce((d,m,p)=>(d.append("file",m,s[p].path),d),new FormData)},body:{},headers:{"Content-Type":"multipart/form-data","Bun-Content-Type":"temporary-fix"}}),c=await eh(a);if(c)throw c;let u=a.data;if(!u)throw new Error("Expected to receive information about written file");return u.length===1&&r?u[0]:u}async list(t,e){var n;if(typeof e?.depth=="number"&&e.depth<1)throw new Vu("depth should be at least one");try{let r=await this.rpc.listDir({path:t,depth:(n=e?.depth)!=null?n:1},{headers:Zn(e?.user),signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)}),o=[];for(let s of r.entries){let i=Yg(s.type);i&&o.push({name:s.name,type:i,path:s.path,size:Number(s.size),mode:s.mode,permissions:s.permissions,owner:s.owner,group:s.group,modifiedTime:Kg(s.modifiedTime),symlinkTarget:s.symlinkTarget})}return o}catch(r){throw Ye(r)}}async makeDir(t,e){try{return await this.rpc.makeDir({path:t},{headers:Zn(e?.user),signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)}),!0}catch(n){if(n instanceof sa.ConnectError&&n.code===sa.Code.AlreadyExists)return!1;throw Ye(n)}}async rename(t,e,n){try{let o=(await this.rpc.move({source:t,destination:e},{headers:Zn(n?.user),signal:this.connectionConfig.getSignal(n?.requestTimeoutMs)})).entry;if(!o)throw new Error("Expected to receive information about moved object");return{name:o.name,type:Yg(o.type),path:o.path,size:Number(o.size),mode:o.mode,permissions:o.permissions,owner:o.owner,group:o.group,modifiedTime:Kg(o.modifiedTime),symlinkTarget:o.symlinkTarget}}catch(r){throw Ye(r)}}async remove(t,e){try{await this.rpc.remove({path:t},{headers:Zn(e?.user),signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)})}catch(n){throw Ye(n)}}async exists(t,e){try{return await this.rpc.stat({path:t},{headers:Zn(e?.user),signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)}),!0}catch(n){if(n instanceof sa.ConnectError&&n.code===sa.Code.NotFound)return!1;throw Ye(n)}}async getInfo(t,e){try{let n=await this.rpc.stat({path:t},{headers:Zn(e?.user)});if(!n.entry)throw new Error("Expected to receive information about the file or directory");return{name:n.entry.name,type:Yg(n.entry.type),path:n.entry.path,size:Number(n.entry.size),mode:n.entry.mode,permissions:n.entry.permissions,owner:n.entry.owner,group:n.entry.group,modifiedTime:Kg(n.entry.modifiedTime),symlinkTarget:n.entry.symlinkTarget}}catch(n){throw Ye(n)}}async watchDir(t,e,n){var r,o,s;if(n?.recursive&&this.envdApi.version&&(0,fM.compareVersions)(this.envdApi.version,mM)<0)throw new ih("You need to update the template to use recursive watching. You can do this by running `e2b template build` in the directory with the template.");let i=(r=n?.requestTimeoutMs)!=null?r:this.connectionConfig.requestTimeoutMs,a=new AbortController,c=i?setTimeout(()=>{a.abort()},i):void 0,u=this.rpc.watchDir({path:t,recursive:(o=n?.recursive)!=null?o:this.defaultWatchRecursive},{headers:Eo(we({},Zn(n?.user)),{[Uu]:Mu.toString()}),signal:a.signal,timeoutMs:(s=n?.timeoutMs)!=null?s:this.defaultWatchTimeout});try{return await oM(u),clearTimeout(c),new dM(()=>a.abort(),u,e,n?.onExit)}catch(d){throw Ye(d)}}},LC=class extends gt{constructor(t){super(t.error),this.result=t,this.name="CommandExitError"}get exitCode(){return this.result.exitCode}get error(){return this.result.error}get stdout(){return this.result.stdout}get stderr(){return this.result.stderr}},nh=class{constructor(t,e,n,r,o,s,i){this.pid=t,this.handleDisconnect=e,this.handleKill=n,this.events=r,this.onStdout=o,this.onStderr=s,this.onPty=i,this._stdout="",this._stderr="",this._wait=this.handleEvents()}get exitCode(){var t;return(t=this.result)==null?void 0:t.exitCode}get error(){var t;return(t=this.result)==null?void 0:t.error}get stderr(){return this._stderr}get stdout(){return this._stdout}async wait(){if(await this._wait,this.iterationError)throw this.iterationError;if(!this.result)throw new gt("Process exited without a result");if(this.result.exitCode!==0)throw new LC(this.result);return this.result}async disconnect(){this.handleDisconnect()}async kill(){return await this.handleKill()}iterateEvents(){return oh(this,null,function*(){var t;try{for(var e=ca(this.events),n,r,o;n=!(r=yield new Do(e.next())).done;n=!1){let s=r.value,i=(t=s?.event)==null?void 0:t.event,a;switch(i?.case){case"data":switch(i.value.output.case){case"stdout":a=new TextDecoder().decode(i.value.output.value),this._stdout+=a,yield[a,null,null];break;case"stderr":a=new TextDecoder().decode(i.value.output.value),this._stderr+=a,yield[null,a,null];break;case"pty":yield[null,null,i.value.output.value];break}break;case"end":this.result={exitCode:i.value.exitCode,error:i.value.error,stdout:this.stdout,stderr:this.stderr};break}}}catch(s){o=[s]}finally{try{n&&(r=e.return)&&(yield new Do(r.call(e)))}finally{if(o)throw o[0]}}})}async handleEvents(){var t,e,n;try{try{for(var r=ca(this.iterateEvents()),o,s,i;o=!(s=await r.next()).done;o=!1){let[a,c,u]=s.value;a!==null?(t=this.onStdout)==null||t.call(this,a):c!==null?(e=this.onStderr)==null||e.call(this,c):u&&((n=this.onPty)==null||n.call(this,u))}}catch(a){i=[a]}finally{try{o&&(s=r.return)&&await s.call(r)}finally{if(i)throw i[0]}}}catch(a){this.iterationError=Ye(a)}}},gM=_C(),zg=Er(),BC=Ig(),hM=(0,BC.fileDesc)("ChVwcm9jZXNzL3Byb2Nlc3MucHJvdG8SB3Byb2Nlc3MiSgoDUFRZEh8KBHNpemUYASABKAsyES5wcm9jZXNzLlBUWS5TaXplGiIKBFNpemUSDAoEY29scxgBIAEoDRIMCgRyb3dzGAIgASgNIqEBCg1Qcm9jZXNzQ29uZmlnEgsKA2NtZBgBIAEoCRIMCgRhcmdzGAIgAygJEi4KBGVudnMYAyADKAsyIC5wcm9jZXNzLlByb2Nlc3NDb25maWcuRW52c0VudHJ5EhAKA2N3ZBgEIAEoCUgAiAEBGisKCUVudnNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBQgYKBF9jd2QiDQoLTGlzdFJlcXVlc3QiXAoLUHJvY2Vzc0luZm8SJgoGY29uZmlnGAEgASgLMhYucHJvY2Vzcy5Qcm9jZXNzQ29uZmlnEgsKA3BpZBgCIAEoDRIQCgN0YWcYAyABKAlIAIgBAUIGCgRfdGFnIjcKDExpc3RSZXNwb25zZRInCglwcm9jZXNzZXMYASADKAsyFC5wcm9jZXNzLlByb2Nlc3NJbmZvInkKDFN0YXJ0UmVxdWVzdBInCgdwcm9jZXNzGAEgASgLMhYucHJvY2Vzcy5Qcm9jZXNzQ29uZmlnEh4KA3B0eRgCIAEoCzIMLnByb2Nlc3MuUFRZSACIAQESEAoDdGFnGAMgASgJSAGIAQFCBgoEX3B0eUIGCgRfdGFnImIKDVVwZGF0ZVJlcXVlc3QSKQoHcHJvY2VzcxgBIAEoCzIYLnByb2Nlc3MuUHJvY2Vzc1NlbGVjdG9yEh4KA3B0eRgCIAEoCzIMLnByb2Nlc3MuUFRZSACIAQFCBgoEX3B0eSIQCg5VcGRhdGVSZXNwb25zZSKvAwoMUHJvY2Vzc0V2ZW50EjEKBXN0YXJ0GAEgASgLMiAucHJvY2Vzcy5Qcm9jZXNzRXZlbnQuU3RhcnRFdmVudEgAEi8KBGRhdGEYAiABKAsyHy5wcm9jZXNzLlByb2Nlc3NFdmVudC5EYXRhRXZlbnRIABItCgNlbmQYAyABKAsyHi5wcm9jZXNzLlByb2Nlc3NFdmVudC5FbmRFdmVudEgAEjQKCWtlZXBhbGl2ZRgEIAEoCzIfLnByb2Nlc3MuUHJvY2Vzc0V2ZW50LktlZXBBbGl2ZUgAGhkKClN0YXJ0RXZlbnQSCwoDcGlkGAEgASgNGkgKCURhdGFFdmVudBIQCgZzdGRvdXQYASABKAxIABIQCgZzdGRlcnIYAiABKAxIABINCgNwdHkYAyABKAxIAEIICgZvdXRwdXQaWwoIRW5kRXZlbnQSEQoJZXhpdF9jb2RlGAEgASgREg4KBmV4aXRlZBgCIAEoCBIOCgZzdGF0dXMYAyABKAkSEgoFZXJyb3IYBCABKAlIAIgBAUIICgZfZXJyb3IaCwoJS2VlcEFsaXZlQgcKBWV2ZW50IjUKDVN0YXJ0UmVzcG9uc2USJAoFZXZlbnQYASABKAsyFS5wcm9jZXNzLlByb2Nlc3NFdmVudCI3Cg9Db25uZWN0UmVzcG9uc2USJAoFZXZlbnQYASABKAsyFS5wcm9jZXNzLlByb2Nlc3NFdmVudCJjChBTZW5kSW5wdXRSZXF1ZXN0EikKB3Byb2Nlc3MYASABKAsyGC5wcm9jZXNzLlByb2Nlc3NTZWxlY3RvchIkCgVpbnB1dBgCIAEoCzIVLnByb2Nlc3MuUHJvY2Vzc0lucHV0IhMKEVNlbmRJbnB1dFJlc3BvbnNlIjcKDFByb2Nlc3NJbnB1dBIPCgVzdGRpbhgBIAEoDEgAEg0KA3B0eRgCIAEoDEgAQgcKBWlucHV0IsICChJTdHJlYW1JbnB1dFJlcXVlc3QSNwoFc3RhcnQYASABKAsyJi5wcm9jZXNzLlN0cmVhbUlucHV0UmVxdWVzdC5TdGFydEV2ZW50SAASNQoEZGF0YRgCIAEoCzIlLnByb2Nlc3MuU3RyZWFtSW5wdXRSZXF1ZXN0LkRhdGFFdmVudEgAEjoKCWtlZXBhbGl2ZRgDIAEoCzIlLnByb2Nlc3MuU3RyZWFtSW5wdXRSZXF1ZXN0LktlZXBBbGl2ZUgAGjcKClN0YXJ0RXZlbnQSKQoHcHJvY2VzcxgBIAEoCzIYLnByb2Nlc3MuUHJvY2Vzc1NlbGVjdG9yGjEKCURhdGFFdmVudBIkCgVpbnB1dBgCIAEoCzIVLnByb2Nlc3MuUHJvY2Vzc0lucHV0GgsKCUtlZXBBbGl2ZUIHCgVldmVudCIVChNTdHJlYW1JbnB1dFJlc3BvbnNlIl8KEVNlbmRTaWduYWxSZXF1ZXN0EikKB3Byb2Nlc3MYASABKAsyGC5wcm9jZXNzLlByb2Nlc3NTZWxlY3RvchIfCgZzaWduYWwYAiABKA4yDy5wcm9jZXNzLlNpZ25hbCIUChJTZW5kU2lnbmFsUmVzcG9uc2UiOwoOQ29ubmVjdFJlcXVlc3QSKQoHcHJvY2VzcxgBIAEoCzIYLnByb2Nlc3MuUHJvY2Vzc1NlbGVjdG9yIjsKD1Byb2Nlc3NTZWxlY3RvchINCgNwaWQYASABKA1IABINCgN0YWcYAiABKAlIAEIKCghzZWxlY3RvcipICgZTaWduYWwSFgoSU0lHTkFMX1VOU1BFQ0lGSUVEEAASEgoOU0lHTkFMX1NJR1RFUk0QDxISCg5TSUdOQUxfU0lHS0lMTBAJMsoDCgdQcm9jZXNzEjMKBExpc3QSFC5wcm9jZXNzLkxpc3RSZXF1ZXN0GhUucHJvY2Vzcy5MaXN0UmVzcG9uc2USPgoHQ29ubmVjdBIXLnByb2Nlc3MuQ29ubmVjdFJlcXVlc3QaGC5wcm9jZXNzLkNvbm5lY3RSZXNwb25zZTABEjgKBVN0YXJ0EhUucHJvY2Vzcy5TdGFydFJlcXVlc3QaFi5wcm9jZXNzLlN0YXJ0UmVzcG9uc2UwARI5CgZVcGRhdGUSFi5wcm9jZXNzLlVwZGF0ZVJlcXVlc3QaFy5wcm9jZXNzLlVwZGF0ZVJlc3BvbnNlEkoKC1N0cmVhbUlucHV0EhsucHJvY2Vzcy5TdHJlYW1JbnB1dFJlcXVlc3QaHC5wcm9jZXNzLlN0cmVhbUlucHV0UmVzcG9uc2UoARJCCglTZW5kSW5wdXQSGS5wcm9jZXNzLlNlbmRJbnB1dFJlcXVlc3QaGi5wcm9jZXNzLlNlbmRJbnB1dFJlc3BvbnNlEkUKClNlbmRTaWduYWwSGi5wcm9jZXNzLlNlbmRTaWduYWxSZXF1ZXN0GhsucHJvY2Vzcy5TZW5kU2lnbmFsUmVzcG9uc2VCVwoLY29tLnByb2Nlc3NCDFByb2Nlc3NQcm90b1ABogIDUFhYqgIHUHJvY2Vzc8oCB1Byb2Nlc3PiAhNQcm9jZXNzXEdQQk1ldGFkYXRh6gIHUHJvY2Vzc2IGcHJvdG8z"),MC=(0,BC.serviceDesc)(hM,0),Zg=Er(),yM=class{constructor(t,e){this.transport=t,this.connectionConfig=e,this.rpc=(0,Zg.createClient)(MC,this.transport)}async create(t){var e,n,r;let o=(e=t?.requestTimeoutMs)!=null?e:this.connectionConfig.requestTimeoutMs,s=(n=t?.envs)!=null?n:{};s.TERM="xterm-256color";let i=new AbortController,a=setTimeout(()=>{i.abort()},o),c=this.rpc.start({process:{cmd:"/bin/bash",args:["-i","-l"],envs:s,cwd:t?.cwd},pty:{size:{cols:t.cols,rows:t.rows}}},{headers:Eo(we({},Zn(t?.user)),{[Uu]:Mu.toString()}),signal:i.signal,timeoutMs:(r=t?.timeoutMs)!=null?r:6e4});try{let u=await th(c);return clearTimeout(a),new nh(u,()=>i.abort(),()=>this.kill(u),c,void 0,void 0,t.onData)}catch(u){throw Ye(u)}}async sendInput(t,e,n){try{await this.rpc.sendInput({input:{input:{case:"pty",value:e}},process:{selector:{case:"pid",value:t}}},{signal:this.connectionConfig.getSignal(n?.requestTimeoutMs)})}catch(r){throw Ye(r)}}async resize(t,e,n){try{await this.rpc.update({process:{selector:{case:"pid",value:t}},pty:{size:e}},{signal:this.connectionConfig.getSignal(n?.requestTimeoutMs)})}catch(r){throw Ye(r)}}async kill(t,e){try{return await this.rpc.sendSignal({process:{selector:{case:"pid",value:t}},signal:9},{signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)}),!0}catch(n){if(n instanceof Zg.ConnectError&&n.code===Zg.Code.NotFound)return!1;throw Ye(n)}}},bM=class{constructor(t,e){this.connectionConfig=e,this.defaultProcessConnectionTimeout=6e4,this.rpc=(0,zg.createClient)(MC,t)}async list(t){try{return(await this.rpc.list({},{signal:this.connectionConfig.getSignal(t?.requestTimeoutMs)})).processes.map(n=>we(Eo(we({pid:n.pid},n.tag&&{tag:n.tag}),{args:n.config.args,envs:n.config.envs,cmd:n.config.cmd}),n.config.cwd&&{cwd:n.config.cwd}))}catch(e){throw Ye(e)}}async sendStdin(t,e,n){try{await this.rpc.sendInput({process:{selector:{case:"pid",value:t}},input:{input:{case:"stdin",value:new TextEncoder().encode(e)}}},{signal:this.connectionConfig.getSignal(n?.requestTimeoutMs)})}catch(r){throw Ye(r)}}async kill(t,e){try{return await this.rpc.sendSignal({process:{selector:{case:"pid",value:t}},signal:9},{signal:this.connectionConfig.getSignal(e?.requestTimeoutMs)}),!0}catch(n){if(n instanceof zg.ConnectError&&n.code===zg.Code.NotFound)return!1;throw Ye(n)}}async connect(t,e){var n,r;let o=(n=e?.requestTimeoutMs)!=null?n:this.connectionConfig.requestTimeoutMs,s=new AbortController,i=o?setTimeout(()=>{s.abort()},o):void 0,a=this.rpc.connect({process:{selector:{case:"pid",value:t}}},{signal:s.signal,headers:{[Uu]:Mu.toString()},timeoutMs:(r=e?.timeoutMs)!=null?r:this.defaultProcessConnectionTimeout});try{let c=await th(a);return clearTimeout(i),new nh(c,()=>s.abort(),()=>this.kill(c),a,e?.onStdout,e?.onStderr,void 0)}catch(c){throw Ye(c)}}async run(t,e){let n=await this.start(t,e);return e?.background?n:n.wait()}async start(t,e){var n,r;let o=(n=e?.requestTimeoutMs)!=null?n:this.connectionConfig.requestTimeoutMs,s=new AbortController,i=o?setTimeout(()=>{s.abort()},o):void 0,a=this.rpc.start({process:{cmd:"/bin/bash",cwd:e?.cwd,envs:e?.envs,args:["-l","-c",t]}},{headers:Eo(we({},Zn(e?.user)),{[Uu]:Mu.toString()}),signal:s.signal,timeoutMs:(r=e?.timeoutMs)!=null?r:this.defaultProcessConnectionTimeout});try{let c=await th(a);return clearTimeout(i),new nh(c,()=>s.abort(),()=>this.kill(c),a,e?.onStdout,e?.onStderr,void 0)}catch(c){throw Ye(c)}}},vM=_u(),SM=class{constructor(){}static async kill(t,e){var n;let r=new Tn(e),s=await new wo(r).api.DELETE("/sandboxes/{sandboxID}",{params:{path:{sandboxID:t}},signal:r.getSignal(e?.requestTimeoutMs)});if(((n=s.error)==null?void 0:n.code)===404)return!1;let i=_s(s);if(i)throw i;return!0}static async list(t){var e,n;let r=new Tn(t),o=new wo(r),s;if(t?.query&&t.query.metadata){let c=Object.fromEntries(Object.entries(t.query.metadata).map(([u,d])=>[encodeURIComponent(u),encodeURIComponent(d)]));s=new URLSearchParams(c).toString()}let i=await o.api.GET("/sandboxes",{params:{query:{metadata:s}},signal:r.getSignal(t?.requestTimeoutMs)}),a=_s(i);if(a)throw a;return(n=(e=i.data)==null?void 0:e.map(c=>({sandboxId:c.sandboxID,templateId:c.templateID,clientId:c.clientID,state:c.state,cpuCount:c.cpuCount,memoryMB:c.memoryMB,alias:c.alias,metadata:c.metadata,startedAt:new Date(c.startedAt),endAt:new Date(c.endAt)})))!=null?n:[]}static async getInfo(t,e){var n;let r=new Tn(e),s=await new wo(r).api.GET("/sandboxes/{sandboxID}",{params:{path:{sandboxID:t}},signal:r.getSignal(e?.requestTimeoutMs)}),i=_s(s);if(i)throw i;if(!s.data)throw new Error("Sandbox not found");return Eo(we({sandboxId:s.data.sandboxID,sandboxDomain:s.data.domain||void 0,templateId:s.data.templateID},s.data.alias&&{name:s.data.alias}),{metadata:(n=s.data.metadata)!=null?n:{},envdVersion:s.data.envdVersion,envdAccessToken:s.data.envdAccessToken,startedAt:new Date(s.data.startedAt),endAt:new Date(s.data.endAt)})}static async getMetrics(t,e){var n,r;let o=new Tn(e),i=await new wo(o).api.GET("/sandboxes/{sandboxID}/metrics",{params:{path:{sandboxID:t,start:e?.start,end:e?.end}},signal:o.getSignal(e?.requestTimeoutMs)}),a=_s(i);if(a)throw a;return(r=(n=i.data)==null?void 0:n.map(c=>({timestamp:new Date(c.timestamp),cpuUsedPct:c.cpuUsedPct,cpuCount:c.cpuCount,memUsed:c.memUsed,memTotal:c.memTotal,diskUsed:c.diskUsed,diskTotal:c.diskTotal})))!=null?r:[]}static async setTimeout(t,e,n){let r=new Tn(n),s=await new wo(r).api.POST("/sandboxes/{sandboxID}/timeout",{params:{path:{sandboxID:t}},body:{timeout:this.timeoutToSeconds(e)},signal:r.getSignal(n?.requestTimeoutMs)}),i=_s(s);if(i)throw i}static async createSandbox(t,e,n){var r;let o=new Tn(n),i=await new wo(o).api.POST("/sandboxes",{body:{autoPause:!1,templateID:t,metadata:n?.metadata,envVars:n?.envs,timeout:this.timeoutToSeconds(e),secure:n?.secure,allow_internet_access:(r=n?.allowInternetAccess)!=null?r:!0},signal:o.getSignal(n?.requestTimeoutMs)}),a=_s(i);if(a)throw a;if((0,vM.compareVersions)(i.data.envdVersion,"0.1.0")<0)throw await this.kill(i.data.sandboxID,n),new ih("You need to update the template to use the new SDK. You can do this by running `e2b template build` in the directory with the template.");return{sandboxId:i.data.sandboxID,sandboxDomain:i.data.domain||void 0,envdVersion:i.data.envdVersion,envdAccessToken:i.data.envdAccessToken}}static timeoutToSeconds(t){return Math.ceil(t/1e3)}},kC=_u(),ah=class aa extends SM{constructor(e){var n;super(),this.envdPort=49983,this.connectionConfig=new Tn(e),this.sandboxId=e.sandboxId,this.sandboxDomain=(n=e.sandboxDomain)!=null?n:this.connectionConfig.domain,this.envdAccessToken=e.envdAccessToken,this.envdApiUrl=`${this.connectionConfig.debug?"http":"https"}://${this.getHost(this.envdPort)}`;let r=(0,gM.createConnectTransport)({baseUrl:this.envdApiUrl,useBinaryFormat:!1,interceptors:e?.logger?[eM(e.logger)]:void 0,fetch:(o,s)=>{let i=new Headers(this.connectionConfig.headers);return new Headers(s?.headers).forEach((a,c)=>i.append(c,a)),this.envdAccessToken&&i.append("X-Access-Token",this.envdAccessToken),s=Eo(we({},s??{}),{headers:i,redirect:"follow"}),fetch(o,s)}});this.envdApi=new sM({apiUrl:this.envdApiUrl,logger:e?.logger,accessToken:this.envdAccessToken,headers:this.envdAccessToken?{"X-Access-Token":this.envdAccessToken}:{}},{version:e?.envdVersion}),this.files=new pM(r,this.envdApi,this.connectionConfig),this.commands=new bM(r,this.connectionConfig),this.pty=new yM(r,this.connectionConfig)}static async create(e,n){var r;let{template:o,sandboxOpts:s}=typeof e=="string"?{template:e,sandboxOpts:n}:{template:this.defaultTemplate,sandboxOpts:e},i=new Tn(s);if(i.debug)return new this(we({sandboxId:"debug_sandbox_id"},i));{let a=await this.createSandbox(o,(r=s?.timeoutMs)!=null?r:this.defaultSandboxTimeoutMs,s);return new this(we(we({},a),i))}}static async connect(e,n){let r=new Tn(n),o=await this.getInfo(e,n);return new this(we({sandboxId:e,sandboxDomain:o.sandboxDomain,envdAccessToken:o.envdAccessToken,envdVersion:o.envdVersion},r))}getHost(e){return this.connectionConfig.debug?`localhost:${e}`:`${e}-${this.sandboxId}.${this.sandboxDomain}`}async isRunning(e){let n=this.connectionConfig.getSignal(e?.requestTimeoutMs),r=await this.envdApi.api.GET("/health",{signal:n});if(r.response.status==502)return!1;let o=await eh(r);if(o)throw o;return!0}async setTimeout(e,n){this.connectionConfig.debug||await aa.setTimeout(this.sandboxId,e,we(we({},this.connectionConfig),n))}async kill(e){this.connectionConfig.debug||await aa.kill(this.sandboxId,we(we({},this.connectionConfig),e))}async uploadUrl(e,n){var r;n=n??{};let o=!!this.envdAccessToken;if(!o&&n.useSignatureExpiration!=null)throw new Error("Signature expiration can be used only when sandbox is created as secured.");let s=(r=n.user)!=null?r:ws,i=e??"",a=this.fileUrl(i,s);if(o){let c=new URL(a),u=await Qg({path:i,operation:"write",user:s,expirationInSeconds:n.useSignatureExpiration,envdAccessToken:this.envdAccessToken});return c.searchParams.set("signature",u.signature),u.expiration&&c.searchParams.set("signature_expiration",u.expiration.toString()),c.toString()}return a}async downloadUrl(e,n){var r;n=n??{};let o=!!this.envdAccessToken;if(!o&&n.useSignatureExpiration!=null)throw new Error("Signature expiration can be used only when sandbox is created as secured.");let s=(r=n.user)!=null?r:ws,i=this.fileUrl(e,s);if(o){let a=new URL(i),c=await Qg({path:e,operation:"read",user:s,expirationInSeconds:n.useSignatureExpiration,envdAccessToken:this.envdAccessToken});return a.searchParams.set("signature",c.signature),c.expiration&&a.searchParams.set("signature_expiration",c.expiration.toString()),a.toString()}return i}async getInfo(e){return await aa.getInfo(this.sandboxId,we(we({},this.connectionConfig),e))}async getMetrics(e){var n,r;if(this.envdApi.version){if((0,kC.compareVersions)(this.envdApi.version,"0.1.5")<0)throw new gt("You need to update the template to use the new SDK. You can do this by running `e2b template build` in the directory with the template.");(0,kC.compareVersions)(this.envdApi.version,"0.2.4")<0&&((r=(n=this.connectionConfig.logger)==null?void 0:n.warn)==null||r.call(n,"Disk metrics are not supported in this version of the sandbox, please rebuild the template to get disk metrics."))}return await aa.getMetrics(this.sandboxId,we(we({},this.connectionConfig),e))}fileUrl(e,n){let r=new URL("/files",this.envdApiUrl);return r.searchParams.set("username",n??ws),e&&r.searchParams.set("path",e),r.toString()}};ah.defaultTemplate="base";ah.defaultSandboxTimeoutMs=3e5;var UC=ah,_M=UC});var ZC=b((QJ,ph)=>{"use strict";var qu=Object.defineProperty,wM=Object.defineProperties,EM=Object.getOwnPropertyDescriptor,DM=Object.getOwnPropertyDescriptors,CM=Object.getOwnPropertyNames,VC=Object.getOwnPropertySymbols,YC=Object.prototype.hasOwnProperty,kM=Object.prototype.propertyIsEnumerable,lh=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),qC=(t,e,n)=>e in t?qu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,uh=(t,e)=>{for(var n in e||(e={}))YC.call(e,n)&&qC(t,n,e[n]);if(VC)for(var n of VC(e))kM.call(e,n)&&qC(t,n,e[n]);return t},AM=(t,e)=>wM(t,DM(e)),TM=(t,e)=>{for(var n in e)qu(t,n,{get:e[n],enumerable:!0})},dh=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of CM(e))!YC.call(t,o)&&o!==n&&qu(t,o,{get:()=>e[o],enumerable:!(r=EM(e,o))||r.enumerable});return t},FM=(t,e,n)=>(dh(t,e,"default"),n&&dh(n,e,"default")),OM=t=>dh(qu({},"__esModule",{value:!0}),t),KC=function(t,e){this[0]=t,this[1]=e},IM=(t,e,n)=>{var r=(i,a,c,u)=>{try{var d=n[i](a),m=(a=d.value)instanceof KC,p=d.done;Promise.resolve(m?a[0]:a).then(f=>m?r(i==="return"?i:"next",a[1]?{done:f.done,value:f.value}:f,c,u):c({value:f,done:p})).catch(f=>r("throw",f,c,u))}catch(f){u(f)}},o=i=>s[i]=a=>new Promise((c,u)=>r(i,a,c,u)),s={};return n=n.apply(t,e),s[lh("asyncIterator")]=()=>s,o("next"),o("throw"),o("return"),s},NM=(t,e,n)=>(e=t[lh("asyncIterator")])?e.call(t):(t=t[lh("iterator")](),e={},n=(r,o)=>(o=t[r])&&(e[r]=s=>new Promise((i,a,c)=>(s=o.call(t,s),c=s.done,Promise.resolve(s.value).then(u=>i({value:u,done:c}),a)))),n("next"),n("return"),e),fh={};TM(fh,{Sandbox:()=>mh,default:()=>UM});ph.exports=OM(fh);FM(fh,fa(),ph.exports);var HC=fa(),ch=fa();async function WC(t){if(!t.ok)switch(t.status){case 502:return new ch.TimeoutError(`${await t.text()}: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeoutMs' when starting the sandbox or calling '.setTimeout' on the sandbox with the desired timeout.`);case 404:return new ch.NotFoundError(await t.text());default:return new ch.SandboxError(`${t.status} ${t.statusText}`)}}var xM=class{constructor(t,e,n){this.name=t,this.value=e,this.traceback=n}},PM=class{constructor(t,e){this.isMainResult=e;let n=uh({},t);delete n.type,delete n.is_main_result,this.text=n.text,this.html=n.html,this.markdown=n.markdown,this.svg=n.svg,this.png=n.png,this.jpeg=n.jpeg,this.pdf=n.pdf,this.latex=n.latex,this.json=n.json,this.javascript=n.javascript,this.isMainResult=e,this.raw=n,this.data=n.data,this.chart=n.chart,this.extra={};for(let r of Object.keys(n))["plain","html","markdown","svg","png","jpeg","pdf","latex","json","javascript","data","chart","extra","text"].includes(r)||(this.extra[r]=n[r])}formats(){let t=[];this.html&&t.push("html"),this.markdown&&t.push("markdown"),this.svg&&t.push("svg"),this.png&&t.push("png"),this.jpeg&&t.push("jpeg"),this.pdf&&t.push("pdf"),this.latex&&t.push("latex"),this.json&&t.push("json"),this.javascript&&t.push("javascript"),this.data&&t.push("data");for(let e of Object.keys(this.extra))t.push(e);return t}toJSON(){return uh({text:this.text,html:this.html,markdown:this.markdown,svg:this.svg,png:this.png,jpeg:this.jpeg,pdf:this.pdf,latex:this.latex,json:this.json,javascript:this.javascript},Object.keys(this.extra).length>0?{extra:this.extra}:{})}},RM=class{constructor(t=[],e={stdout:[],stderr:[]},n,r){this.results=t,this.logs=e,this.error=n,this.executionCount=r}get text(){for(let t of this.results)if(t.isMainResult)return t.text}toJSON(){return{results:this.results,logs:this.logs,error:this.error}}};async function jM(t,e,n,r,o,s){let i=JSON.parse(e);switch(i.type){case"result":let a=new PM(AM(uh({},i),{type:void 0,is_main_result:void 0}),i.is_main_result);t.results.push(a),o&&await o(a);break;case"stdout":t.logs.stdout.push(i.text),n&&await n({error:!1,line:i.text,timestamp:new Date().getTime()*1e3});break;case"stderr":t.logs.stderr.push(i.text),r&&await r({error:!0,line:i.text,timestamp:new Date().getTime()*1e3});break;case"error":t.error=new xM(i.name,i.value,i.traceback),s&&await s(t.error);break;case"number_of_executions":t.executionCount=i.execution_count;break}}var zC=fa();function JC(t){return t instanceof Error&&t.name==="AbortError"?new zC.TimeoutError("Request timed out \u2014 the 'requestTimeoutMs' option can be used to increase this timeout"):t}function $M(t){return t instanceof Error&&t.name==="AbortError"?new zC.TimeoutError("Execution timed out \u2014 the 'timeoutMs' option can be used to increase this timeout"):t}function LM(t){return IM(this,null,function*(){let e=t.getReader(),n="";try{for(;;){let{done:r,value:o}=yield new KC(e.read());if(o!==void 0&&(n+=new TextDecoder().decode(o)),r){n.length>0&&(yield n);break}let s=-1;do s=n.indexOf(`
|
|
29
|
+
`),s!==-1&&(yield n.slice(0,s),n=n.slice(s+1));while(s!==-1)}}finally{e.releaseLock()}})}var BM=6e4,MM=49999,mh=class extends HC.Sandbox{async runCode(t,e){var n,r,o;if(e?.context&&e?.language)throw new HC.InvalidArgumentError("You can provide context or language, but not both at the same time.");let s=new AbortController,i=(n=e?.requestTimeoutMs)!=null?n:this.connectionConfig.requestTimeoutMs,a=i?setTimeout(()=>{s.abort()},i):void 0;try{let p=await fetch(`${this.jupyterUrl}/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,context_id:(r=e?.context)==null?void 0:r.id,language:e?.language,env_vars:e?.envs}),signal:s.signal,keepalive:!0}),f=await WC(p);if(f)throw f;if(!p.body)throw new Error(`Not response body: ${p.statusText} ${await p?.text()}`);clearTimeout(a);let g=(o=e?.timeoutMs)!=null?o:BM,h=g?setTimeout(()=>{s.abort()},g):void 0,y=new RM;try{try{for(var c=NM(LM(p.body)),u,d,m;u=!(d=await c.next()).done;u=!1){let _=d.value;await jM(y,_,e?.onStdout,e?.onStderr,e?.onResult,e?.onError)}}catch(_){m=[_]}finally{try{u&&(d=c.return)&&await d.call(c)}finally{if(m)throw m[0]}}}catch(_){throw $M(_)}finally{clearTimeout(h)}return y}catch(p){throw JC(p)}}async createCodeContext(t){try{let e=await fetch(`${this.jupyterUrl}/contexts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({language:t?.language,cwd:t?.cwd}),keepalive:!0,signal:this.connectionConfig.getSignal(t?.requestTimeoutMs)}),n=await WC(e);if(n)throw n;return await e.json()}catch(e){throw JC(e)}}get jupyterUrl(){return`${this.connectionConfig.debug?"http":"https"}://${this.getHost(MM)}`}};mh.defaultTemplate="code-interpreter-v1";var UM=mh});var te=b(rt=>{"use strict";var Sh=Symbol.for("yaml.alias"),ok=Symbol.for("yaml.document"),Yu=Symbol.for("yaml.map"),sk=Symbol.for("yaml.pair"),_h=Symbol.for("yaml.scalar"),Ku=Symbol.for("yaml.seq"),Xn=Symbol.for("yaml.node.type"),zM=t=>!!t&&typeof t=="object"&&t[Xn]===Sh,ZM=t=>!!t&&typeof t=="object"&&t[Xn]===ok,XM=t=>!!t&&typeof t=="object"&&t[Xn]===Yu,QM=t=>!!t&&typeof t=="object"&&t[Xn]===sk,ik=t=>!!t&&typeof t=="object"&&t[Xn]===_h,e3=t=>!!t&&typeof t=="object"&&t[Xn]===Ku;function ak(t){if(t&&typeof t=="object")switch(t[Xn]){case Yu:case Ku:return!0}return!1}function t3(t){if(t&&typeof t=="object")switch(t[Xn]){case Sh:case Yu:case _h:case Ku:return!0}return!1}var n3=t=>(ik(t)||ak(t))&&!!t.anchor;rt.ALIAS=Sh;rt.DOC=ok;rt.MAP=Yu;rt.NODE_TYPE=Xn;rt.PAIR=sk;rt.SCALAR=_h;rt.SEQ=Ku;rt.hasAnchor=n3;rt.isAlias=zM;rt.isCollection=ak;rt.isDocument=ZM;rt.isMap=XM;rt.isNode=t3;rt.isPair=QM;rt.isScalar=ik;rt.isSeq=e3});var ma=b(wh=>{"use strict";var qe=te(),Dt=Symbol("break visit"),ck=Symbol("skip children"),Fn=Symbol("remove node");function zu(t,e){let n=lk(e);qe.isDocument(t)?Cs(null,t.contents,n,Object.freeze([t]))===Fn&&(t.contents=null):Cs(null,t,n,Object.freeze([]))}zu.BREAK=Dt;zu.SKIP=ck;zu.REMOVE=Fn;function Cs(t,e,n,r){let o=uk(t,e,n,r);if(qe.isNode(o)||qe.isPair(o))return dk(t,r,o),Cs(t,o,n,r);if(typeof o!="symbol"){if(qe.isCollection(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let i=Cs(s,e.items[s],n,r);if(typeof i=="number")s=i-1;else{if(i===Dt)return Dt;i===Fn&&(e.items.splice(s,1),s-=1)}}}else if(qe.isPair(e)){r=Object.freeze(r.concat(e));let s=Cs("key",e.key,n,r);if(s===Dt)return Dt;s===Fn&&(e.key=null);let i=Cs("value",e.value,n,r);if(i===Dt)return Dt;i===Fn&&(e.value=null)}}return o}async function Zu(t,e){let n=lk(e);qe.isDocument(t)?await ks(null,t.contents,n,Object.freeze([t]))===Fn&&(t.contents=null):await ks(null,t,n,Object.freeze([]))}Zu.BREAK=Dt;Zu.SKIP=ck;Zu.REMOVE=Fn;async function ks(t,e,n,r){let o=await uk(t,e,n,r);if(qe.isNode(o)||qe.isPair(o))return dk(t,r,o),ks(t,o,n,r);if(typeof o!="symbol"){if(qe.isCollection(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let i=await ks(s,e.items[s],n,r);if(typeof i=="number")s=i-1;else{if(i===Dt)return Dt;i===Fn&&(e.items.splice(s,1),s-=1)}}}else if(qe.isPair(e)){r=Object.freeze(r.concat(e));let s=await ks("key",e.key,n,r);if(s===Dt)return Dt;s===Fn&&(e.key=null);let i=await ks("value",e.value,n,r);if(i===Dt)return Dt;i===Fn&&(e.value=null)}}return o}function lk(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function uk(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(qe.isMap(e))return n.Map?.(t,e,r);if(qe.isSeq(e))return n.Seq?.(t,e,r);if(qe.isPair(e))return n.Pair?.(t,e,r);if(qe.isScalar(e))return n.Scalar?.(t,e,r);if(qe.isAlias(e))return n.Alias?.(t,e,r)}function dk(t,e,n){let r=e[e.length-1];if(qe.isCollection(r))r.items[t]=n;else if(qe.isPair(r))t==="key"?r.key=n:r.value=n;else if(qe.isDocument(r))r.contents=n;else{let o=qe.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}wh.visit=zu;wh.visitAsync=Zu});var Eh=b(mk=>{"use strict";var fk=te(),r3=ma(),o3={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},s3=t=>t.replace(/[!,[\]{}]/g,e=>o3[e]),pa=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,i]=r;return this.tags[s]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let i=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,i),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let i=e.slice(2,-1);return i==="!"||i==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),i)}let[,r,o]=e.match(/^(.*!)([^!]*)$/s);o||n(`The ${e} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(o)}catch(i){return n(String(i)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+s3(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(e&&r.length>0&&fk.isNode(e.contents)){let s={};r3.visit(e.contents,(i,a)=>{fk.isNode(a)&&a.tag&&(s[a.tag]=!0)}),o=Object.keys(s)}else o=[];for(let[s,i]of r)s==="!!"&&i==="tag:yaml.org,2002:"||(!e||o.some(a=>a.startsWith(i)))&&n.push(`%TAG ${s} ${i}`);return n.join(`
|
|
30
|
+
`)}};pa.defaultYaml={explicit:!1,version:"1.2"};pa.defaultTags={"!!":"tag:yaml.org,2002:"};mk.Directives=pa});var Xu=b(ga=>{"use strict";var pk=te(),i3=ma();function a3(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function gk(t){let e=new Set;return i3.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function hk(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function c3(t,e){let n=[],r=new Map,o=null;return{onAnchor:s=>{n.push(s),o??(o=gk(t));let i=hk(e,o);return o.add(i),i},setAnchors:()=>{for(let s of n){let i=r.get(s);if(typeof i=="object"&&i.anchor&&(pk.isScalar(i.node)||pk.isCollection(i.node)))i.node.anchor=i.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:r}}ga.anchorIsValid=a3;ga.anchorNames=gk;ga.createNodeAnchors=c3;ga.findNewAnchor=hk});var Dh=b(yk=>{"use strict";function ha(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let o=0,s=r.length;o<s;++o){let i=r[o],a=ha(t,r,String(o),i);a===void 0?delete r[o]:a!==i&&(r[o]=a)}else if(r instanceof Map)for(let o of Array.from(r.keys())){let s=r.get(o),i=ha(t,r,o,s);i===void 0?r.delete(o):i!==s&&r.set(o,i)}else if(r instanceof Set)for(let o of Array.from(r)){let s=ha(t,r,o,o);s===void 0?r.delete(o):s!==o&&(r.delete(o),r.add(s))}else for(let[o,s]of Object.entries(r)){let i=ha(t,r,o,s);i===void 0?delete r[o]:i!==s&&(r[o]=i)}return t.call(e,n,r)}yk.applyReviver=ha});var Tr=b(vk=>{"use strict";var l3=te();function bk(t,e,n){if(Array.isArray(t))return t.map((r,o)=>bk(r,String(o),n));if(t&&typeof t.toJSON=="function"){if(!n||!l3.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let o=t.toJSON(e,n);return n.onCreate&&n.onCreate(o),o}return typeof t=="bigint"&&!n?.keep?Number(t):t}vk.toJS=bk});var Qu=b(_k=>{"use strict";var u3=Dh(),Sk=te(),d3=Tr(),Ch=class{constructor(e){Object.defineProperty(this,Sk.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:s}={}){if(!Sk.isDocument(e))throw new TypeError("A document argument is required");let i={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=d3.toJS(this,"",i);if(typeof o=="function")for(let{count:c,res:u}of i.anchors.values())o(u,c);return typeof s=="function"?u3.applyReviver(s,{"":a},"",a):a}};_k.NodeBase=Ch});var ya=b(wk=>{"use strict";var f3=Xu(),m3=ma(),As=te(),p3=Qu(),g3=Tr(),kh=class extends p3.NodeBase{constructor(e){super(As.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],m3.visit(e,{Node:(s,i)=>{(As.isAlias(i)||As.hasAnchor(i))&&r.push(i)}}),n&&(n.aliasResolveCache=r));let o;for(let s of r){if(s===this)break;s.anchor===this.source&&(o=s)}return o}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:s}=n,i=this.resolve(o,n);if(!i){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(i);if(a||(g3.toJS(i,null,n),a=r.get(i)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ed(o,i,r)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let o=`*${this.source}`;if(e){if(f3.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${o} `}return o}};function ed(t,e,n){if(As.isAlias(e)){let r=e.resolve(t),o=n&&r&&n.get(r);return o?o.count*o.aliasCount:0}else if(As.isCollection(e)){let r=0;for(let o of e.items){let s=ed(t,o,n);s>r&&(r=s)}return r}else if(As.isPair(e)){let r=ed(t,e.key,n),o=ed(t,e.value,n);return Math.max(r,o)}return 1}wk.Alias=kh});var je=b(Ah=>{"use strict";var h3=te(),y3=Qu(),b3=Tr(),v3=t=>!t||typeof t!="function"&&typeof t!="object",Fr=class extends y3.NodeBase{constructor(e){super(h3.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:b3.toJS(this.value,e,n)}toString(){return String(this.value)}};Fr.BLOCK_FOLDED="BLOCK_FOLDED";Fr.BLOCK_LITERAL="BLOCK_LITERAL";Fr.PLAIN="PLAIN";Fr.QUOTE_DOUBLE="QUOTE_DOUBLE";Fr.QUOTE_SINGLE="QUOTE_SINGLE";Ah.Scalar=Fr;Ah.isScalarValue=v3});var ba=b(Dk=>{"use strict";var S3=ya(),ko=te(),Ek=je(),_3="tag:yaml.org,2002:";function w3(t,e,n){if(e){let r=n.filter(s=>s.tag===e),o=r.find(s=>!s.format)??r[0];if(!o)throw new Error(`Tag ${e} not found`);return o}return n.find(r=>r.identify?.(t)&&!r.format)}function E3(t,e,n){if(ko.isDocument(t)&&(t=t.contents),ko.isNode(t))return t;if(ko.isPair(t)){let m=n.schema[ko.MAP].createNode?.(n.schema,null,n);return m.items.push(t),m}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:s,schema:i,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=o(t)),new S3.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=_3+e.slice(2));let u=w3(t,e,i.tags);if(!u){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let m=new Ek.Scalar(t);return c&&(c.node=m),m}u=t instanceof Map?i[ko.MAP]:Symbol.iterator in Object(t)?i[ko.SEQ]:i[ko.MAP]}s&&(s(u),delete n.onTagObj);let d=u?.createNode?u.createNode(n.schema,t,n):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(n.schema,t,n):new Ek.Scalar(t);return e?d.tag=e:u.default||(d.tag=u.tag),c&&(c.node=d),d}Dk.createNode=E3});var nd=b(td=>{"use strict";var D3=ba(),On=te(),C3=Qu();function Th(t,e,n){let r=n;for(let o=e.length-1;o>=0;--o){let s=e[o];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let i=[];i[s]=r,r=i}else r=new Map([[s,r]])}return D3.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Ck=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Fh=class extends C3.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>On.isNode(r)||On.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Ck(e))this.add(n);else{let[r,...o]=e,s=this.get(r,!0);if(On.isCollection(s))s.addIn(o,n);else if(s===void 0&&this.schema)this.set(r,Th(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let o=this.get(n,!0);if(On.isCollection(o))return o.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...o]=e,s=this.get(r,!0);return o.length===0?!n&&On.isScalar(s)?s.value:s:On.isCollection(s)?s.getIn(o,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!On.isPair(n))return!1;let r=n.value;return r==null||e&&On.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let o=this.get(n,!0);return On.isCollection(o)?o.hasIn(r):!1}setIn(e,n){let[r,...o]=e;if(o.length===0)this.set(r,n);else{let s=this.get(r,!0);if(On.isCollection(s))s.setIn(o,n);else if(s===void 0&&this.schema)this.set(r,Th(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}};td.Collection=Fh;td.collectionFromPath=Th;td.isEmptyPath=Ck});var va=b(rd=>{"use strict";var k3=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Oh(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var A3=(t,e,n)=>t.endsWith(`
|
|
31
|
+
`)?Oh(n,e):n.includes(`
|
|
32
|
+
`)?`
|
|
33
|
+
`+Oh(n,e):(t.endsWith(" ")?"":" ")+n;rd.indentComment=Oh;rd.lineComment=A3;rd.stringifyComment=k3});var Ak=b(Sa=>{"use strict";var T3="flow",Ih="block",od="quoted";function F3(t,e,n="flow",{indentAtStart:r,lineWidth:o=80,minContentWidth:s=20,onFold:i,onOverflow:a}={}){if(!o||o<0)return t;o<s&&(s=0);let c=Math.max(1+s,1+o-e.length);if(t.length<=c)return t;let u=[],d={},m=o-e.length;typeof r=="number"&&(r>o-Math.max(2,s)?u.push(0):m=o-r);let p,f,g=!1,h=-1,y=-1,_=-1;n===Ih&&(h=kk(t,h,e.length),h!==-1&&(m=h+c));for(let D;D=t[h+=1];){if(n===od&&D==="\\"){switch(y=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}_=h}if(D===`
|
|
34
|
+
`)n===Ih&&(h=kk(t,h,e.length)),m=h+e.length+c,p=void 0;else{if(D===" "&&f&&f!==" "&&f!==`
|
|
35
|
+
`&&f!==" "){let T=t[h+1];T&&T!==" "&&T!==`
|
|
36
|
+
`&&T!==" "&&(p=h)}if(h>=m)if(p)u.push(p),m=p+c,p=void 0;else if(n===od){for(;f===" "||f===" ";)f=D,D=t[h+=1],g=!0;let T=h>_+1?h-2:y-1;if(d[T])return t;u.push(T),d[T]=!0,m=T+c,p=void 0}else g=!0}f=D}if(g&&a&&a(),u.length===0)return t;i&&i();let E=t.slice(0,u[0]);for(let D=0;D<u.length;++D){let T=u[D],I=u[D+1]||t.length;T===0?E=`
|
|
37
|
+
${e}${t.slice(0,I)}`:(n===od&&d[T]&&(E+=`${t[T]}\\`),E+=`
|
|
38
|
+
${e}${t.slice(T+1,I)}`)}return E}function kk(t,e,n){let r=e,o=e+1,s=t[o];for(;s===" "||s===" ";)if(e<o+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
|
39
|
+
`);r=e,o=e+1,s=t[o]}return r}Sa.FOLD_BLOCK=Ih;Sa.FOLD_FLOW=T3;Sa.FOLD_QUOTED=od;Sa.foldFlowLines=F3});var wa=b(Tk=>{"use strict";var cn=je(),Or=Ak(),id=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ad=t=>/^(%|---|\.\.\.)/m.test(t);function O3(t,e,n){if(!e||e<0)return!1;let r=e-n,o=t.length;if(o<=r)return!1;for(let s=0,i=0;s<o;++s)if(t[s]===`
|
|
40
|
+
`){if(s-i>r)return!0;if(i=s+1,o-i<=r)return!1}return!0}function _a(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,o=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(ad(t)?" ":""),i="",a=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(i+=n.slice(a,c)+"\\ ",c+=1,a=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{i+=n.slice(a,c);let d=n.substr(c+2,4);switch(d){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:d.substr(0,2)==="00"?i+="\\x"+d.substr(2):i+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<o)c+=1;else{for(i+=n.slice(a,c)+`
|
|
41
|
+
|
|
42
|
+
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)i+=`
|
|
43
|
+
`,c+=2;i+=s,n[c+2]===" "&&(i+="\\"),c+=1,a=c+1}break;default:c+=1}return i=a?i+n.slice(a):n,r?i:Or.foldFlowLines(i,s,Or.FOLD_QUOTED,id(e,!1))}function Nh(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
44
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return _a(t,e);let n=e.indent||(ad(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
45
|
+
${n}`)+"'";return e.implicitKey?r:Or.foldFlowLines(r,n,Or.FOLD_FLOW,id(e,!1))}function Ts(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=_a;else{let o=t.includes('"'),s=t.includes("'");o&&!s?r=Nh:s&&!o?r=_a:r=n?Nh:_a}return r(t,e)}var xh;try{xh=new RegExp(`(^|(?<!
|
|
46
|
+
))
|
|
47
|
+
+(?!
|
|
48
|
+
|$)`,"g")}catch{xh=/\n+(?!\n|$)/g}function sd({comment:t,type:e,value:n},r,o,s){let{blockQuote:i,commentString:a,lineWidth:c}=r.options;if(!i||/\n[\t ]+$/.test(n))return Ts(n,r);let u=r.indent||(r.forceBlockIndent||ad(n)?" ":""),d=i==="literal"?!0:i==="folded"||e===cn.Scalar.BLOCK_FOLDED?!1:e===cn.Scalar.BLOCK_LITERAL?!0:!O3(n,c,u.length);if(!n)return d?`|
|
|
49
|
+
`:`>
|
|
50
|
+
`;let m,p;for(p=n.length;p>0;--p){let I=n[p-1];if(I!==`
|
|
51
|
+
`&&I!==" "&&I!==" ")break}let f=n.substring(p),g=f.indexOf(`
|
|
52
|
+
`);g===-1?m="-":n===f||g!==f.length-1?(m="+",s&&s()):m="",f&&(n=n.slice(0,-f.length),f[f.length-1]===`
|
|
53
|
+
`&&(f=f.slice(0,-1)),f=f.replace(xh,`$&${u}`));let h=!1,y,_=-1;for(y=0;y<n.length;++y){let I=n[y];if(I===" ")h=!0;else if(I===`
|
|
54
|
+
`)_=y;else break}let E=n.substring(0,_<y?_+1:y);E&&(n=n.substring(E.length),E=E.replace(/\n+/g,`$&${u}`));let T=(h?u?"2":"1":"")+m;if(t&&(T+=" "+a(t.replace(/ ?[\r\n]+/g," ")),o&&o()),!d){let I=n.replace(/\n+/g,`
|
|
55
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,O=id(r,!0);i!=="folded"&&e!==cn.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{k=!0});let v=Or.foldFlowLines(`${E}${I}${f}`,u,Or.FOLD_BLOCK,O);if(!k)return`>${T}
|
|
56
|
+
${u}${v}`}return n=n.replace(/\n+/g,`$&${u}`),`|${T}
|
|
57
|
+
${u}${E}${n}${f}`}function I3(t,e,n,r){let{type:o,value:s}=t,{actualString:i,implicitKey:a,indent:c,indentStep:u,inFlow:d}=e;if(a&&s.includes(`
|
|
58
|
+
`)||d&&/[[\]{},]/.test(s))return Ts(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||d||!s.includes(`
|
|
59
|
+
`)?Ts(s,e):sd(t,e,n,r);if(!a&&!d&&o!==cn.Scalar.PLAIN&&s.includes(`
|
|
60
|
+
`))return sd(t,e,n,r);if(ad(s)){if(c==="")return e.forceBlockIndent=!0,sd(t,e,n,r);if(a&&c===u)return Ts(s,e)}let m=s.replace(/\n+/g,`$&
|
|
61
|
+
${c}`);if(i){let p=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(m),{compat:f,tags:g}=e.doc.schema;if(g.some(p)||f?.some(p))return Ts(s,e)}return a?m:Or.foldFlowLines(m,c,Or.FOLD_FLOW,id(e,!1))}function N3(t,e,n,r){let{implicitKey:o,inFlow:s}=e,i=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==cn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=cn.Scalar.QUOTE_DOUBLE);let c=d=>{switch(d){case cn.Scalar.BLOCK_FOLDED:case cn.Scalar.BLOCK_LITERAL:return o||s?Ts(i.value,e):sd(i,e,n,r);case cn.Scalar.QUOTE_DOUBLE:return _a(i.value,e);case cn.Scalar.QUOTE_SINGLE:return Nh(i.value,e);case cn.Scalar.PLAIN:return I3(i,e,n,r);default:return null}},u=c(a);if(u===null){let{defaultKeyType:d,defaultStringType:m}=e.options,p=o&&d||m;if(u=c(p),u===null)throw new Error(`Unsupported default string type ${p}`)}return u}Tk.stringifyString=N3});var Ea=b(Ph=>{"use strict";var x3=Xu(),Ir=te(),P3=va(),R3=wa();function j3(t,e){let n=Object.assign({blockQuote:!0,commentString:P3.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function $3(t,e){if(e.tag){let o=t.filter(s=>s.tag===e.tag);if(o.length>0)return o.find(s=>s.format===e.format)??o[0]}let n,r;if(Ir.isScalar(e)){r=e.value;let o=t.filter(s=>s.identify?.(r));if(o.length>1){let s=o.filter(i=>i.test);s.length>0&&(o=s)}n=o.find(s=>s.format===e.format)??o.find(s=>!s.format)}else r=e,n=t.find(o=>o.nodeClass&&r instanceof o.nodeClass);if(!n){let o=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${o} value`)}return n}function L3(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let o=[],s=(Ir.isScalar(t)||Ir.isCollection(t))&&t.anchor;s&&x3.anchorIsValid(s)&&(n.add(s),o.push(`&${s}`));let i=t.tag??(e.default?null:e.tag);return i&&o.push(r.directives.tagString(i)),o.join(" ")}function B3(t,e,n,r){if(Ir.isPair(t))return t.toString(e,n,r);if(Ir.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let o,s=Ir.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>o=c});o??(o=$3(e.doc.schema.tags,s));let i=L3(s,o,e);i.length>0&&(e.indentAtStart=(e.indentAtStart??0)+i.length+1);let a=typeof o.stringify=="function"?o.stringify(s,e,n,r):Ir.isScalar(s)?R3.stringifyString(s,e,n,r):s.toString(e,n,r);return i?Ir.isScalar(s)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
|
|
62
|
+
${e.indent}${a}`:a}Ph.createStringifyContext=j3;Ph.stringify=B3});var Nk=b(Ik=>{"use strict";var Qn=te(),Fk=je(),Ok=Ea(),Da=va();function M3({key:t,value:e},n,r,o){let{allNullValues:s,doc:i,indent:a,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:m}}=n,p=Qn.isNode(t)&&t.comment||null;if(m){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(Qn.isCollection(t)||!Qn.isNode(t)&&typeof t=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let f=!m&&(!t||p&&e==null&&!n.inFlow||Qn.isCollection(t)||(Qn.isScalar(t)?t.type===Fk.Scalar.BLOCK_FOLDED||t.type===Fk.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!f&&(m||!s),indent:a+c});let g=!1,h=!1,y=Ok.stringify(t,n,()=>g=!0,()=>h=!0);if(!f&&!n.inFlow&&y.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(n.inFlow){if(s||e==null)return g&&r&&r(),y===""?"?":f?`? ${y}`:y}else if(s&&!m||e==null&&f)return y=`? ${y}`,p&&!g?y+=Da.lineComment(y,n.indent,u(p)):h&&o&&o(),y;g&&(p=null),f?(p&&(y+=Da.lineComment(y,n.indent,u(p))),y=`? ${y}
|
|
63
|
+
${a}:`):(y=`${y}:`,p&&(y+=Da.lineComment(y,n.indent,u(p))));let _,E,D;Qn.isNode(e)?(_=!!e.spaceBefore,E=e.commentBefore,D=e.comment):(_=!1,E=null,D=null,e&&typeof e=="object"&&(e=i.createNode(e))),n.implicitKey=!1,!f&&!p&&Qn.isScalar(e)&&(n.indentAtStart=y.length+1),h=!1,!d&&c.length>=2&&!n.inFlow&&!f&&Qn.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let T=!1,I=Ok.stringify(e,n,()=>T=!0,()=>h=!0),k=" ";if(p||_||E){if(k=_?`
|
|
64
|
+
`:"",E){let O=u(E);k+=`
|
|
65
|
+
${Da.indentComment(O,n.indent)}`}I===""&&!n.inFlow?k===`
|
|
66
|
+
`&&D&&(k=`
|
|
67
|
+
|
|
68
|
+
`):k+=`
|
|
69
|
+
${n.indent}`}else if(!f&&Qn.isCollection(e)){let O=I[0],v=I.indexOf(`
|
|
70
|
+
`),P=v!==-1,U=n.inFlow??e.flow??e.items.length===0;if(P||!U){let de=!1;if(P&&(O==="&"||O==="!")){let fe=I.indexOf(" ");O==="&"&&fe!==-1&&fe<v&&I[fe+1]==="!"&&(fe=I.indexOf(" ",fe+1)),(fe===-1||v<fe)&&(de=!0)}de||(k=`
|
|
71
|
+
${n.indent}`)}}else(I===""||I[0]===`
|
|
72
|
+
`)&&(k="");return y+=k+I,n.inFlow?T&&r&&r():D&&!T?y+=Da.lineComment(y,n.indent,u(D)):h&&o&&o(),y}Ik.stringifyPair=M3});var jh=b(Rh=>{"use strict";var xk=require("process");function U3(t,...e){t==="debug"&&console.log(...e)}function G3(t,e){(t==="debug"||t==="warn")&&(typeof xk.emitWarning=="function"?xk.emitWarning(e):console.warn(e))}Rh.debug=U3;Rh.warn=G3});var dd=b(ud=>{"use strict";var Ca=te(),Pk=je(),cd="<<",ld={identify:t=>t===cd||typeof t=="symbol"&&t.description===cd,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Pk.Scalar(Symbol(cd)),{addToJSMap:Rk}),stringify:()=>cd},V3=(t,e)=>(ld.identify(e)||Ca.isScalar(e)&&(!e.type||e.type===Pk.Scalar.PLAIN)&&ld.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===ld.tag&&n.default);function Rk(t,e,n){if(n=t&&Ca.isAlias(n)?n.resolve(t.doc):n,Ca.isSeq(n))for(let r of n.items)$h(t,e,r);else if(Array.isArray(n))for(let r of n)$h(t,e,r);else $h(t,e,n)}function $h(t,e,n){let r=t&&Ca.isAlias(n)?n.resolve(t.doc):n;if(!Ca.isMap(r))throw new Error("Merge sources must be maps or map aliases");let o=r.toJSON(null,t,Map);for(let[s,i]of o)e instanceof Map?e.has(s)||e.set(s,i):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0});return e}ud.addMergeToJSMap=Rk;ud.isMergeKey=V3;ud.merge=ld});var Bh=b(Lk=>{"use strict";var q3=jh(),jk=dd(),H3=Ea(),$k=te(),Lh=Tr();function W3(t,e,{key:n,value:r}){if($k.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(jk.isMergeKey(t,n))jk.addMergeToJSMap(t,e,r);else{let o=Lh.toJS(n,"",t);if(e instanceof Map)e.set(o,Lh.toJS(r,o,t));else if(e instanceof Set)e.add(o);else{let s=J3(n,o,t),i=Lh.toJS(r,s,t);s in e?Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0}):e[s]=i}}return e}function J3(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if($k.isNode(t)&&n?.doc){let r=H3.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let o=t.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(o);s.length>40&&(s=s.substring(0,36)+'..."'),q3.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(e)}Lk.addPairToJSMap=W3});var Nr=b(Mh=>{"use strict";var Bk=ba(),Y3=Nk(),K3=Bh(),fd=te();function z3(t,e,n){let r=Bk.createNode(t,void 0,n),o=Bk.createNode(e,void 0,n);return new md(r,o)}var md=class t{constructor(e,n=null){Object.defineProperty(this,fd.NODE_TYPE,{value:fd.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return fd.isNode(n)&&(n=n.clone(e)),fd.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return K3.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?Y3.stringifyPair(this,e,n,r):JSON.stringify(this)}};Mh.Pair=md;Mh.createPair=z3});var Uh=b(Uk=>{"use strict";var Ao=te(),Mk=Ea(),pd=va();function Z3(t,e,n){return(e.inFlow??t.flow?Q3:X3)(t,e,n)}function X3({comment:t,items:e},n,{blockItemPrefix:r,flowChars:o,itemIndent:s,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null}),m=!1,p=[];for(let g=0;g<e.length;++g){let h=e[g],y=null;if(Ao.isNode(h))!m&&h.spaceBefore&&p.push(""),gd(n,p,h.commentBefore,m),h.comment&&(y=h.comment);else if(Ao.isPair(h)){let E=Ao.isNode(h.key)?h.key:null;E&&(!m&&E.spaceBefore&&p.push(""),gd(n,p,E.commentBefore,m))}m=!1;let _=Mk.stringify(h,d,()=>y=null,()=>m=!0);y&&(_+=pd.lineComment(_,s,u(y))),m&&y&&(m=!1),p.push(r+_)}let f;if(p.length===0)f=o.start+o.end;else{f=p[0];for(let g=1;g<p.length;++g){let h=p[g];f+=h?`
|
|
73
|
+
${c}${h}`:`
|
|
74
|
+
`}}return t?(f+=`
|
|
75
|
+
`+pd.indentComment(u(t),c),a&&a()):m&&i&&i(),f}function Q3({items:t},e,{flowChars:n,itemIndent:r}){let{indent:o,indentStep:s,flowCollectionPadding:i,options:{commentString:a}}=e;r+=s;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),u=!1,d=0,m=[];for(let g=0;g<t.length;++g){let h=t[g],y=null;if(Ao.isNode(h))h.spaceBefore&&m.push(""),gd(e,m,h.commentBefore,!1),h.comment&&(y=h.comment);else if(Ao.isPair(h)){let E=Ao.isNode(h.key)?h.key:null;E&&(E.spaceBefore&&m.push(""),gd(e,m,E.commentBefore,!1),E.comment&&(u=!0));let D=Ao.isNode(h.value)?h.value:null;D?(D.comment&&(y=D.comment),D.commentBefore&&(u=!0)):h.value==null&&E?.comment&&(y=E.comment)}y&&(u=!0);let _=Mk.stringify(h,c,()=>y=null);g<t.length-1&&(_+=","),y&&(_+=pd.lineComment(_,r,a(y))),!u&&(m.length>d||_.includes(`
|
|
76
|
+
`))&&(u=!0),m.push(_),d=m.length}let{start:p,end:f}=n;if(m.length===0)return p+f;if(!u){let g=m.reduce((h,y)=>h+y.length+2,2);u=e.options.lineWidth>0&&g>e.options.lineWidth}if(u){let g=p;for(let h of m)g+=h?`
|
|
77
|
+
${s}${o}${h}`:`
|
|
78
|
+
`;return`${g}
|
|
79
|
+
${o}${f}`}else return`${p}${i}${m.join(" ")}${i}${f}`}function gd({indent:t,options:{commentString:e}},n,r,o){if(r&&o&&(r=r.replace(/^\n+/,"")),r){let s=pd.indentComment(e(r),t);n.push(s.trimStart())}}Uk.stringifyCollection=Z3});var Pr=b(Vh=>{"use strict";var eU=Uh(),tU=Bh(),nU=nd(),xr=te(),hd=Nr(),rU=je();function ka(t,e){let n=xr.isScalar(e)?e.value:e;for(let r of t)if(xr.isPair(r)&&(r.key===e||r.key===n||xr.isScalar(r.key)&&r.key.value===n))return r}var Gh=class extends nU.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(xr.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:o,replacer:s}=r,i=new this(e),a=(c,u)=>{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||o)&&i.items.push(hd.createPair(c,u,r))};if(n instanceof Map)for(let[c,u]of n)a(c,u);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&i.items.sort(e.sortMapEntries),i}add(e,n){let r;xr.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new hd.Pair(e,e?.value):r=new hd.Pair(e.key,e.value);let o=ka(this.items,r.key),s=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${r.key} already set`);xr.isScalar(o.value)&&rU.isScalarValue(r.value)?o.value.value=r.value:o.value=r.value}else if(s){let i=this.items.findIndex(a=>s(r,a)<0);i===-1?this.items.push(r):this.items.splice(i,0,r)}else this.items.push(r)}delete(e){let n=ka(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let o=ka(this.items,e)?.value;return(!n&&xr.isScalar(o)?o.value:o)??void 0}has(e){return!!ka(this.items,e)}set(e,n){this.add(new hd.Pair(e,n),!0)}toJSON(e,n,r){let o=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(let s of this.items)tU.addPairToJSMap(n,o,s);return o}toString(e,n,r){if(!e)return JSON.stringify(this);for(let o of this.items)if(!xr.isPair(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),eU.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};Vh.YAMLMap=Gh;Vh.findPair=ka});var Fs=b(Vk=>{"use strict";var oU=te(),Gk=Pr(),sU={collection:"map",default:!0,nodeClass:Gk.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return oU.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Gk.YAMLMap.from(t,e,n)};Vk.map=sU});var Rr=b(qk=>{"use strict";var iU=ba(),aU=Uh(),cU=nd(),bd=te(),lU=je(),uU=Tr(),qh=class extends cU.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(bd.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=yd(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=yd(e);if(typeof r!="number")return;let o=this.items[r];return!n&&bd.isScalar(o)?o.value:o}has(e){let n=yd(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=yd(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let o=this.items[r];bd.isScalar(o)&&lU.isScalarValue(n)?o.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let o=0;for(let s of this.items)r.push(uU.toJS(s,String(o++),n));return r}toString(e,n,r){return e?aU.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:o}=r,s=new this(e);if(n&&Symbol.iterator in Object(n)){let i=0;for(let a of n){if(typeof o=="function"){let c=n instanceof Set?a:String(i++);a=o.call(n,c,a)}s.items.push(iU.createNode(a,void 0,r))}}return s}};function yd(t){let e=bd.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}qk.YAMLSeq=qh});var Os=b(Wk=>{"use strict";var dU=te(),Hk=Rr(),fU={collection:"seq",default:!0,nodeClass:Hk.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return dU.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Hk.YAMLSeq.from(t,e,n)};Wk.seq=fU});var Aa=b(Jk=>{"use strict";var mU=wa(),pU={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),mU.stringifyString(t,e,n,r)}};Jk.string=pU});var vd=b(zk=>{"use strict";var Yk=je(),Kk={identify:t=>t==null,createNode:()=>new Yk.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Yk.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Kk.test.test(t)?t:e.options.nullStr};zk.nullTag=Kk});var Hh=b(Xk=>{"use strict";var gU=je(),Zk={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new gU.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Zk.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};Xk.boolTag=Zk});var Is=b(Qk=>{"use strict";function hU({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let o=typeof r=="number"?r:Number(r);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let i=s.indexOf(".");i<0&&(i=s.length,s+=".");let a=e-(s.length-i-1);for(;a-- >0;)s+="0"}return s}Qk.stringifyNumber=hU});var Jh=b(Sd=>{"use strict";var yU=je(),Wh=Is(),bU={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Wh.stringifyNumber},vU={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Wh.stringifyNumber(t)}},SU={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new yU.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Wh.stringifyNumber};Sd.float=SU;Sd.floatExp=vU;Sd.floatNaN=bU});var Kh=b(wd=>{"use strict";var eA=Is(),_d=t=>typeof t=="bigint"||Number.isInteger(t),Yh=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function tA(t,e,n){let{value:r}=t;return _d(r)&&r>=0?n+r.toString(e):eA.stringifyNumber(t)}var _U={identify:t=>_d(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Yh(t,2,8,n),stringify:t=>tA(t,8,"0o")},wU={identify:_d,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Yh(t,0,10,n),stringify:eA.stringifyNumber},EU={identify:t=>_d(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Yh(t,2,16,n),stringify:t=>tA(t,16,"0x")};wd.int=wU;wd.intHex=EU;wd.intOct=_U});var rA=b(nA=>{"use strict";var DU=Fs(),CU=vd(),kU=Os(),AU=Aa(),TU=Hh(),zh=Jh(),Zh=Kh(),FU=[DU.map,kU.seq,AU.string,CU.nullTag,TU.boolTag,Zh.intOct,Zh.int,Zh.intHex,zh.floatNaN,zh.floatExp,zh.float];nA.schema=FU});var iA=b(sA=>{"use strict";var OU=je(),IU=Fs(),NU=Os();function oA(t){return typeof t=="bigint"||Number.isInteger(t)}var Ed=({value:t})=>JSON.stringify(t),xU=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ed},{identify:t=>t==null,createNode:()=>new OU.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ed},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ed},{identify:oA,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>oA(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Ed}],PU={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},RU=[IU.map,NU.seq].concat(xU,PU);sA.schema=RU});var Qh=b(aA=>{"use strict";var Ta=require("buffer"),Xh=je(),jU=wa(),$U={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ta.Buffer=="function")return Ta.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,o,s){if(!n)return"";let i=n,a;if(typeof Ta.Buffer=="function")a=i instanceof Ta.Buffer?i.toString("base64"):Ta.Buffer.from(i.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let u=0;u<i.length;++u)c+=String.fromCharCode(i[u]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Xh.Scalar.BLOCK_LITERAL),e!==Xh.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),u=Math.ceil(a.length/c),d=new Array(u);for(let m=0,p=0;m<u;++m,p+=c)d[m]=a.substr(p,c);a=d.join(e===Xh.Scalar.BLOCK_LITERAL?`
|
|
80
|
+
`:" ")}return jU.stringifyString({comment:t,type:e,value:a},r,o,s)}};aA.binary=$U});var kd=b(Cd=>{"use strict";var Dd=te(),ey=Nr(),LU=je(),BU=Rr();function cA(t,e){if(Dd.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!Dd.isPair(r)){if(Dd.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let o=r.items[0]||new ey.Pair(new LU.Scalar(null));if(r.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${r.commentBefore}
|
|
81
|
+
${o.key.commentBefore}`:r.commentBefore),r.comment){let s=o.value??o.key;s.comment=s.comment?`${r.comment}
|
|
82
|
+
${s.comment}`:r.comment}r=o}t.items[n]=Dd.isPair(r)?r:new ey.Pair(r)}}else e("Expected a sequence for this tag");return t}function lA(t,e,n){let{replacer:r}=n,o=new BU.YAMLSeq(t);o.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let i of e){typeof r=="function"&&(i=r.call(e,String(s++),i));let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;o.items.push(ey.createPair(a,c,n))}return o}var MU={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cA,createNode:lA};Cd.createPairs=lA;Cd.pairs=MU;Cd.resolvePairs=cA});var ry=b(ny=>{"use strict";var uA=te(),ty=Tr(),Fa=Pr(),UU=Rr(),dA=kd(),To=class t extends UU.YAMLSeq{constructor(){super(),this.add=Fa.YAMLMap.prototype.add.bind(this),this.delete=Fa.YAMLMap.prototype.delete.bind(this),this.get=Fa.YAMLMap.prototype.get.bind(this),this.has=Fa.YAMLMap.prototype.has.bind(this),this.set=Fa.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let o of this.items){let s,i;if(uA.isPair(o)?(s=ty.toJS(o.key,"",n),i=ty.toJS(o.value,s,n)):s=ty.toJS(o,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,i)}return r}static from(e,n,r){let o=dA.createPairs(e,n,r),s=new this;return s.items=o.items,s}};To.tag="tag:yaml.org,2002:omap";var GU={collection:"seq",identify:t=>t instanceof Map,nodeClass:To,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=dA.resolvePairs(t,e),r=[];for(let{key:o}of n.items)uA.isScalar(o)&&(r.includes(o.value)?e(`Ordered maps must not include duplicate keys: ${o.value}`):r.push(o.value));return Object.assign(new To,n)},createNode:(t,e,n)=>To.from(t,e,n)};ny.YAMLOMap=To;ny.omap=GU});var hA=b(oy=>{"use strict";var fA=je();function mA({value:t,source:e},n){return e&&(t?pA:gA).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var pA={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new fA.Scalar(!0),stringify:mA},gA={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new fA.Scalar(!1),stringify:mA};oy.falseTag=gA;oy.trueTag=pA});var yA=b(Ad=>{"use strict";var VU=je(),sy=Is(),qU={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:sy.stringifyNumber},HU={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():sy.stringifyNumber(t)}},WU={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new VU.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:sy.stringifyNumber};Ad.float=WU;Ad.floatExp=HU;Ad.floatNaN=qU});var vA=b(Ia=>{"use strict";var bA=Is(),Oa=t=>typeof t=="bigint"||Number.isInteger(t);function Td(t,e,n,{intAsBigInt:r}){let o=t[0];if((o==="-"||o==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let i=BigInt(t);return o==="-"?BigInt(-1)*i:i}let s=parseInt(t,n);return o==="-"?-1*s:s}function iy(t,e,n){let{value:r}=t;if(Oa(r)){let o=r.toString(e);return r<0?"-"+n+o.substr(1):n+o}return bA.stringifyNumber(t)}var JU={identify:Oa,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Td(t,2,2,n),stringify:t=>iy(t,2,"0b")},YU={identify:Oa,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Td(t,1,8,n),stringify:t=>iy(t,8,"0")},KU={identify:Oa,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Td(t,0,10,n),stringify:bA.stringifyNumber},zU={identify:Oa,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Td(t,2,16,n),stringify:t=>iy(t,16,"0x")};Ia.int=KU;Ia.intBin=JU;Ia.intHex=zU;Ia.intOct=YU});var cy=b(ay=>{"use strict";var Id=te(),Fd=Nr(),Od=Pr(),Fo=class t extends Od.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Id.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Fd.Pair(e.key,null):n=new Fd.Pair(e,null),Od.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=Od.findPair(this.items,e);return!n&&Id.isPair(r)?Id.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Od.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Fd.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:o}=r,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let i of n)typeof o=="function"&&(i=o.call(n,i,i)),s.items.push(Fd.createPair(i,null,r));return s}};Fo.tag="tag:yaml.org,2002:set";var ZU={collection:"map",identify:t=>t instanceof Set,nodeClass:Fo,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Fo.from(t,e,n),resolve(t,e){if(Id.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Fo,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ay.YAMLSet=Fo;ay.set=ZU});var uy=b(Nd=>{"use strict";var XU=Is();function ly(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,o=i=>e?BigInt(i):Number(i),s=r.replace(/_/g,"").split(":").reduce((i,a)=>i*o(60)+o(a),o(0));return n==="-"?o(-1)*s:s}function SA(t){let{value:e}=t,n=i=>i;if(typeof e=="bigint")n=i=>BigInt(i);else if(isNaN(e)||!isFinite(e))return XU.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let o=n(60),s=[e%o];return e<60?s.unshift(0):(e=(e-s[0])/o,s.unshift(e%o),e>=60&&(e=(e-s[0])/o,s.unshift(e))),r+s.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var QU={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>ly(t,n),stringify:SA},eG={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>ly(t,!1),stringify:SA},_A={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(_A.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,o,s,i,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(n,r-1,o,s||0,i||0,a||0,c),d=e[8];if(d&&d!=="Z"){let m=ly(d,!1);Math.abs(m)<30&&(m*=60),u-=6e4*m}return new Date(u)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Nd.floatTime=eG;Nd.intTime=QU;Nd.timestamp=_A});var DA=b(EA=>{"use strict";var tG=Fs(),nG=vd(),rG=Os(),oG=Aa(),sG=Qh(),wA=hA(),dy=yA(),xd=vA(),iG=dd(),aG=ry(),cG=kd(),lG=cy(),fy=uy(),uG=[tG.map,rG.seq,oG.string,nG.nullTag,wA.trueTag,wA.falseTag,xd.intBin,xd.intOct,xd.int,xd.intHex,dy.floatNaN,dy.floatExp,dy.float,sG.binary,iG.merge,aG.omap,cG.pairs,lG.set,fy.intTime,fy.floatTime,fy.timestamp];EA.schema=uG});var PA=b(gy=>{"use strict";var TA=Fs(),dG=vd(),FA=Os(),fG=Aa(),mG=Hh(),my=Jh(),py=Kh(),pG=rA(),gG=iA(),OA=Qh(),Na=dd(),IA=ry(),NA=kd(),CA=DA(),xA=cy(),Pd=uy(),kA=new Map([["core",pG.schema],["failsafe",[TA.map,FA.seq,fG.string]],["json",gG.schema],["yaml11",CA.schema],["yaml-1.1",CA.schema]]),AA={binary:OA.binary,bool:mG.boolTag,float:my.float,floatExp:my.floatExp,floatNaN:my.floatNaN,floatTime:Pd.floatTime,int:py.int,intHex:py.intHex,intOct:py.intOct,intTime:Pd.intTime,map:TA.map,merge:Na.merge,null:dG.nullTag,omap:IA.omap,pairs:NA.pairs,seq:FA.seq,set:xA.set,timestamp:Pd.timestamp},hG={"tag:yaml.org,2002:binary":OA.binary,"tag:yaml.org,2002:merge":Na.merge,"tag:yaml.org,2002:omap":IA.omap,"tag:yaml.org,2002:pairs":NA.pairs,"tag:yaml.org,2002:set":xA.set,"tag:yaml.org,2002:timestamp":Pd.timestamp};function yG(t,e,n){let r=kA.get(e);if(r&&!t)return n&&!r.includes(Na.merge)?r.concat(Na.merge):r.slice();let o=r;if(!o)if(Array.isArray(t))o=[];else{let s=Array.from(kA.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)o=o.concat(s);else typeof t=="function"&&(o=t(o.slice()));return n&&(o=o.concat(Na.merge)),o.reduce((s,i)=>{let a=typeof i=="string"?AA[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(AA).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(a)||s.push(a),s},[])}gy.coreKnownTags=hG;gy.getTags=yG});var by=b(RA=>{"use strict";var hy=te(),bG=Fs(),vG=Os(),SG=Aa(),Rd=PA(),_G=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,yy=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:o,schema:s,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(e)?Rd.getTags(e,"compat"):e?Rd.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=o?Rd.coreKnownTags:{},this.tags=Rd.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,hy.MAP,{value:bG.map}),Object.defineProperty(this,hy.SCALAR,{value:SG.string}),Object.defineProperty(this,hy.SEQ,{value:vG.seq}),this.sortMapEntries=typeof i=="function"?i:i===!0?_G:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};RA.Schema=yy});var $A=b(jA=>{"use strict";var wG=te(),vy=Ea(),xa=va();function EG(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let o=vy.createStringifyContext(t,e),{commentString:s}=o.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(xa.indentComment(c,""))}let i=!1,a=null;if(t.contents){if(wG.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let d=s(t.contents.commentBefore);n.push(xa.indentComment(d,""))}o.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>i=!0,u=vy.stringify(t.contents,o,()=>a=null,c);a&&(u+=xa.lineComment(u,"",s(a))),(u[0]==="|"||u[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${u}`:n.push(u)}else n.push(vy.stringify(t.contents,o));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
83
|
+
`)?(n.push("..."),n.push(xa.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&i&&(c=c.replace(/^\n+/,"")),c&&((!i||a)&&n[n.length-1]!==""&&n.push(""),n.push(xa.indentComment(s(c),"")))}return n.join(`
|
|
84
|
+
`)+`
|
|
85
|
+
`}jA.stringifyDocument=EG});var Pa=b(LA=>{"use strict";var DG=ya(),Ns=nd(),Gt=te(),CG=Nr(),kG=Tr(),AG=by(),TG=$A(),Sy=Xu(),FG=Dh(),OG=ba(),_y=Eh(),wy=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Gt.NODE_TYPE,{value:Gt.DOC});let o=null;typeof n=="function"||Array.isArray(n)?o=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:i}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new _y.Directives({version:i}),this.setSchema(i,r),this.contents=e===void 0?null:this.createNode(e,o,r)}clone(){let e=Object.create(t.prototype,{[Gt.NODE_TYPE]:{value:Gt.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Gt.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){xs(this.contents)&&this.contents.add(e)}addIn(e,n){xs(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=Sy.anchorNames(this);e.anchor=!n||r.has(n)?Sy.findNewAnchor(n||"a",r):n}return new DG.Alias(e.anchor)}createNode(e,n,r){let o;if(typeof n=="function")e=n.call({"":e},"",e),o=n;else if(Array.isArray(n)){let y=E=>typeof E=="number"||E instanceof String||E instanceof Number,_=n.filter(y).map(String);_.length>0&&(n=n.concat(_)),o=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:i,flow:a,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:m,setAnchors:p,sourceObjects:f}=Sy.createNodeAnchors(this,i||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:m,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:f},h=OG.createNode(e,d,g);return a&&Gt.isCollection(h)&&(h.flow=!0),p(),h}createPair(e,n,r={}){let o=this.createNode(e,null,r),s=this.createNode(n,null,r);return new CG.Pair(o,s)}delete(e){return xs(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ns.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):xs(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Gt.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Ns.isEmptyPath(e)?!n&&Gt.isScalar(this.contents)?this.contents.value:this.contents:Gt.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Gt.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ns.isEmptyPath(e)?this.contents!==void 0:Gt.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Ns.collectionFromPath(this.schema,[e],n):xs(this.contents)&&this.contents.set(e,n)}setIn(e,n){Ns.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Ns.collectionFromPath(this.schema,Array.from(e),n):xs(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _y.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new _y.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let o=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new AG.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:o,onAnchor:s,reviver:i}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},c=kG.toJS(this.contents,n??"",a);if(typeof s=="function")for(let{count:u,res:d}of a.anchors.values())s(d,u);return typeof i=="function"?FG.applyReviver(i,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return TG.stringifyDocument(this,e)}};function xs(t){if(Gt.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}LA.Document=wy});var $a=b(ja=>{"use strict";var Ra=class extends Error{constructor(e,n,r,o){super(),this.name=e,this.code=r,this.message=o,this.pos=n}},Ey=class extends Ra{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Dy=class extends Ra{constructor(e,n,r){super("YAMLWarning",e,n,r)}},IG=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:o}=n.linePos[0];n.message+=` at line ${r}, column ${o}`;let s=o-1,i=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&i.length>80){let a=Math.min(s-39,i.length-79);i="\u2026"+i.substring(a),s-=a-1}if(i.length>80&&(i=i.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(i.substring(0,s))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
86
|
+
`),i=a+i}if(/[^ ]/.test(i)){let a=1,c=n.linePos[1];c?.line===r&&c.col>o&&(a=Math.max(1,Math.min(c.col-o,80-s)));let u=" ".repeat(s)+"^".repeat(a);n.message+=`:
|
|
87
|
+
|
|
88
|
+
${i}
|
|
89
|
+
${u}
|
|
90
|
+
`}};ja.YAMLError=Ra;ja.YAMLParseError=Ey;ja.YAMLWarning=Dy;ja.prettifyError=IG});var La=b(BA=>{"use strict";function NG(t,{flow:e,indicator:n,next:r,offset:o,onError:s,parentIndent:i,startOnNewline:a}){let c=!1,u=a,d=a,m="",p="",f=!1,g=!1,h=null,y=null,_=null,E=null,D=null,T=null,I=null;for(let v of t)switch(g&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&s(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(u&&v.type!=="comment"&&v.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),v.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&v.source.includes(" ")&&(h=v),d=!0;break;case"comment":{d||s(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=v.source.substring(1)||" ";m?m+=p+P:m=P,p="",u=!1;break}case"newline":u?m?m+=v.source:(!T||n!=="seq-item-ind")&&(c=!0):p+=v.source,u=!0,f=!0,(y||_)&&(E=v),d=!0;break;case"anchor":y&&s(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&s(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=v,I??(I=v.offset),u=!1,d=!1,g=!0;break;case"tag":{_&&s(v,"MULTIPLE_TAGS","A node can have at most one tag"),_=v,I??(I=v.offset),u=!1,d=!1,g=!0;break}case n:(y||_)&&s(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),T&&s(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),T=v,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(e){D&&s(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),D=v,u=!1,d=!1;break}default:s(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),u=!1,d=!1}let k=t[t.length-1],O=k?k.offset+k.source.length:o;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(u&&h.indent<=i||r?.type==="block-map"||r?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:D,found:T,spaceBefore:c,comment:m,hasNewline:f,anchor:y,tag:_,newlineAfterProp:E,end:O,start:I??O}}BA.resolveProps=NG});var jd=b(MA=>{"use strict";function Cy(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
91
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Cy(e.key)||Cy(e.value))return!0}return!1;default:return!0}}MA.containsNewline=Cy});var ky=b(UA=>{"use strict";var xG=jd();function PG(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&xG.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}UA.flowIndentCheck=PG});var Ay=b(VA=>{"use strict";var GA=te();function RG(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let o=typeof r=="function"?r:(s,i)=>s===i||GA.isScalar(s)&&GA.isScalar(i)&&s.value===i.value;return e.some(s=>o(s.key,n))}VA.mapIncludes=RG});var KA=b(YA=>{"use strict";var qA=Nr(),jG=Pr(),HA=La(),$G=jd(),WA=ky(),LG=Ay(),JA="All mapping items must start at the same column";function BG({composeNode:t,composeEmptyNode:e},n,r,o,s){let i=s?.nodeClass??jG.YAMLMap,a=new i(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(let d of r.items){let{start:m,key:p,sep:f,value:g}=d,h=HA.resolveProps(m,{indicator:"explicit-key-ind",next:p??f?.[0],offset:c,onError:o,parentIndent:r.indent,startOnNewline:!0}),y=!h.found;if(y){if(p&&(p.type==="block-seq"?o(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&o(c,"BAD_INDENT",JA)),!h.anchor&&!h.tag&&!f){u=h.end,h.comment&&(a.comment?a.comment+=`
|
|
92
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||$G.containsNewline(p))&&o(p??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&o(c,"BAD_INDENT",JA);n.atKey=!0;let _=h.end,E=p?t(n,p,h,o):e(n,_,m,null,h,o);n.schema.compat&&WA.flowIndentCheck(r.indent,p,o),n.atKey=!1,LG.mapIncludes(n,a.items,E)&&o(_,"DUPLICATE_KEY","Map keys must be unique");let D=HA.resolveProps(f??[],{indicator:"map-value-ind",next:g,offset:E.range[2],onError:o,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=D.end,D.found){y&&(g?.type==="block-map"&&!D.hasNewline&&o(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<D.found.offset-1024&&o(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let T=g?t(n,g,D,o):e(n,c,f,null,D,o);n.schema.compat&&WA.flowIndentCheck(r.indent,g,o),c=T.range[2];let I=new qA.Pair(E,T);n.options.keepSourceTokens&&(I.srcToken=d),a.items.push(I)}else{y&&o(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),D.comment&&(E.comment?E.comment+=`
|
|
93
|
+
`+D.comment:E.comment=D.comment);let T=new qA.Pair(E);n.options.keepSourceTokens&&(T.srcToken=d),a.items.push(T)}}return u&&u<c&&o(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,u??c],a}YA.resolveBlockMap=BG});var ZA=b(zA=>{"use strict";var MG=Rr(),UG=La(),GG=ky();function VG({composeNode:t,composeEmptyNode:e},n,r,o,s){let i=s?.nodeClass??MG.YAMLSeq,a=new i(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,u=null;for(let{start:d,value:m}of r.items){let p=UG.resolveProps(d,{indicator:"seq-item-ind",next:m,offset:c,onError:o,parentIndent:r.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||m)m?.type==="block-seq"?o(p.end,"BAD_INDENT","All sequence items must start at the same column"):o(c,"MISSING_CHAR","Sequence item without - indicator");else{u=p.end,p.comment&&(a.comment=p.comment);continue}let f=m?t(n,m,p,o):e(n,p.end,d,null,p,o);n.schema.compat&&GG.flowIndentCheck(r.indent,m,o),c=f.range[2],a.items.push(f)}return a.range=[r.offset,c,u??c],a}zA.resolveBlockSeq=VG});var Ps=b(XA=>{"use strict";function qG(t,e,n,r){let o="";if(t){let s=!1,i="";for(let a of t){let{source:c,type:u}=a;switch(u){case"space":s=!0;break;case"comment":{n&&!s&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";o?o+=i+d:o=d,i="";break}case"newline":o&&(i+=c),s=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=c.length}}return{comment:o,offset:e}}XA.resolveEnd=qG});var nT=b(tT=>{"use strict";var HG=te(),WG=Nr(),QA=Pr(),JG=Rr(),YG=Ps(),eT=La(),KG=jd(),zG=Ay(),Ty="Block collections are not allowed within flow collections",Fy=t=>t&&(t.type==="block-map"||t.type==="block-seq");function ZG({composeNode:t,composeEmptyNode:e},n,r,o,s){let i=r.start.source==="{",a=i?"flow map":"flow sequence",c=s?.nodeClass??(i?QA.YAMLMap:JG.YAMLSeq),u=new c(n.schema);u.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let _=r.items[y],{start:E,key:D,sep:T,value:I}=_,k=eT.resolveProps(E,{flow:a,indicator:"explicit-key-ind",next:D??T?.[0],offset:m,onError:o,parentIndent:r.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!T&&!I){y===0&&k.comma?o(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&o(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),k.comment&&(u.comment?u.comment+=`
|
|
94
|
+
`+k.comment:u.comment=k.comment),m=k.end;continue}!i&&n.options.strict&&KG.containsNewline(D)&&o(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)k.comma&&o(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(k.comma||o(k.start,"MISSING_CHAR",`Missing , between ${a} items`),k.comment){let O="";e:for(let v of E)switch(v.type){case"comma":case"space":break;case"comment":O=v.source.substring(1);break e;default:break e}if(O){let v=u.items[u.items.length-1];HG.isPair(v)&&(v=v.value??v.key),v.comment?v.comment+=`
|
|
95
|
+
`+O:v.comment=O,k.comment=k.comment.substring(O.length+1)}}if(!i&&!T&&!k.found){let O=I?t(n,I,k,o):e(n,k.end,T,null,k,o);u.items.push(O),m=O.range[2],Fy(I)&&o(O.range,"BLOCK_IN_FLOW",Ty)}else{n.atKey=!0;let O=k.end,v=D?t(n,D,k,o):e(n,O,E,null,k,o);Fy(D)&&o(v.range,"BLOCK_IN_FLOW",Ty),n.atKey=!1;let P=eT.resolveProps(T??[],{flow:a,indicator:"map-value-ind",next:I,offset:v.range[2],onError:o,parentIndent:r.indent,startOnNewline:!1});if(P.found){if(!i&&!k.found&&n.options.strict){if(T)for(let fe of T){if(fe===P.found)break;if(fe.type==="newline"){o(fe,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}k.start<P.found.offset-1024&&o(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else I&&("source"in I&&I.source?.[0]===":"?o(I,"MISSING_CHAR",`Missing space after : in ${a}`):o(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let U=I?t(n,I,P,o):P.found?e(n,P.end,T,null,P,o):null;U?Fy(I)&&o(U.range,"BLOCK_IN_FLOW",Ty):P.comment&&(v.comment?v.comment+=`
|
|
96
|
+
`+P.comment:v.comment=P.comment);let de=new WG.Pair(v,U);if(n.options.keepSourceTokens&&(de.srcToken=_),i){let fe=u;zG.mapIncludes(n,fe.items,v)&&o(O,"DUPLICATE_KEY","Map keys must be unique"),fe.items.push(de)}else{let fe=new QA.YAMLMap(n.schema);fe.flow=!0,fe.items.push(de);let nr=(U??v).range;fe.range=[v.range[0],nr[1],nr[2]],u.items.push(fe)}m=U?U.range[2]:P.end}}let p=i?"}":"]",[f,...g]=r.end,h=m;if(f?.source===p)h=f.offset+f.source.length;else{let y=a[0].toUpperCase()+a.substring(1),_=d?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;o(m,d?"MISSING_CHAR":"BAD_INDENT",_),f&&f.source.length!==1&&g.unshift(f)}if(g.length>0){let y=YG.resolveEnd(g,h,n.options.strict,o);y.comment&&(u.comment?u.comment+=`
|
|
97
|
+
`+y.comment:u.comment=y.comment),u.range=[r.offset,h,y.offset]}else u.range=[r.offset,h,h];return u}tT.resolveFlowCollection=ZG});var oT=b(rT=>{"use strict";var XG=te(),QG=je(),eV=Pr(),tV=Rr(),nV=KA(),rV=ZA(),oV=nT();function Oy(t,e,n,r,o,s){let i=n.type==="block-map"?nV.resolveBlockMap(t,e,n,r,s):n.type==="block-seq"?rV.resolveBlockSeq(t,e,n,r,s):oV.resolveFlowCollection(t,e,n,r,s),a=i.constructor;return o==="!"||o===a.tagName?(i.tag=a.tagName,i):(o&&(i.tag=o),i)}function sV(t,e,n,r,o){let s=r.tag,i=s?e.directives.tagName(s.source,p=>o(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){let{anchor:p,newlineAfterProp:f}=r,g=p&&s?p.offset>s.offset?p:s:p??s;g&&(!f||f.offset<g.offset)&&o(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!i||i==="!"||i===eV.YAMLMap.tagName&&a==="map"||i===tV.YAMLSeq.tagName&&a==="seq")return Oy(t,e,n,o,i);let c=e.schema.tags.find(p=>p.tag===i&&p.collection===a);if(!c){let p=e.schema.knownTags[i];if(p?.collection===a)e.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?o(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),Oy(t,e,n,o,i)}let u=Oy(t,e,n,o,i,c),d=c.resolve?.(u,p=>o(s,"TAG_RESOLVE_FAILED",p),e.options)??u,m=XG.isNode(d)?d:new QG.Scalar(d);return m.range=u.range,m.tag=i,c?.format&&(m.format=c.format),m}rT.composeCollection=sV});var Ny=b(sT=>{"use strict";var Iy=je();function iV(t,e,n){let r=e.offset,o=aV(e,t.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[r,r,r]};let s=o.mode===">"?Iy.Scalar.BLOCK_FOLDED:Iy.Scalar.BLOCK_LITERAL,i=e.source?cV(e.source):[],a=i.length;for(let h=i.length-1;h>=0;--h){let y=i[h][1];if(y===""||y==="\r")a=h;else break}if(a===0){let h=o.chomp==="+"&&i.length>0?`
|
|
98
|
+
`.repeat(Math.max(1,i.length-1)):"",y=r+o.length;return e.source&&(y+=e.source.length),{value:h,type:s,comment:o.comment,range:[r,y,y]}}let c=e.indent+o.indent,u=e.offset+o.length,d=0;for(let h=0;h<a;++h){let[y,_]=i[h];if(_===""||_==="\r")o.indent===0&&y.length>c&&(c=y.length);else{y.length<c&&n(u+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(c=y.length),d=h,c===0&&!t.atRoot&&n(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=y.length+_.length+1}for(let h=i.length-1;h>=a;--h)i[h][0].length>c&&(a=h+1);let m="",p="",f=!1;for(let h=0;h<d;++h)m+=i[h][0].slice(c)+`
|
|
99
|
+
`;for(let h=d;h<a;++h){let[y,_]=i[h];u+=y.length+_.length+1;let E=_[_.length-1]==="\r";if(E&&(_=_.slice(0,-1)),_&&y.length<c){let T=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(u-_.length-(E?2:1),"BAD_INDENT",T),y=""}s===Iy.Scalar.BLOCK_LITERAL?(m+=p+y.slice(c)+_,p=`
|
|
100
|
+
`):y.length>c||_[0]===" "?(p===" "?p=`
|
|
101
|
+
`:!f&&p===`
|
|
102
|
+
`&&(p=`
|
|
103
|
+
|
|
104
|
+
`),m+=p+y.slice(c)+_,p=`
|
|
105
|
+
`,f=!0):_===""?p===`
|
|
106
|
+
`?m+=`
|
|
107
|
+
`:p=`
|
|
108
|
+
`:(m+=p+_,p=" ",f=!1)}switch(o.chomp){case"-":break;case"+":for(let h=a;h<i.length;++h)m+=`
|
|
109
|
+
`+i[h][0].slice(c);m[m.length-1]!==`
|
|
110
|
+
`&&(m+=`
|
|
111
|
+
`);break;default:m+=`
|
|
112
|
+
`}let g=r+o.length+e.source.length;return{value:m,type:s,comment:o.comment,range:[r,g,g]}}function aV({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=e[0],s=o[0],i=0,a="",c=-1;for(let p=1;p<o.length;++p){let f=o[p];if(!a&&(f==="-"||f==="+"))a=f;else{let g=Number(f);!i&&g?i=g:c===-1&&(c=t+p)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,d="",m=o.length;for(let p=1;p<e.length;++p){let f=e[p];switch(f.type){case"space":u=!0;case"newline":m+=f.source.length;break;case"comment":n&&!u&&r(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=f.source.length,d=f.source.substring(1);break;case"error":r(f,"UNEXPECTED_TOKEN",f.message),m+=f.source.length;break;default:{let g=`Unexpected token in block scalar header: ${f.type}`;r(f,"UNEXPECTED_TOKEN",g);let h=f.source;h&&typeof h=="string"&&(m+=h.length)}}}return{mode:s,indent:i,chomp:a,comment:d,length:m}}function cV(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let i=1;i<e.length;i+=2)s.push([e[i],e[i+1]]);return s}sT.resolveBlockScalar=iV});var Py=b(aT=>{"use strict";var xy=je(),lV=Ps();function uV(t,e,n){let{offset:r,type:o,source:s,end:i}=t,a,c,u=(p,f,g)=>n(r+p,f,g);switch(o){case"scalar":a=xy.Scalar.PLAIN,c=dV(s,u);break;case"single-quoted-scalar":a=xy.Scalar.QUOTE_SINGLE,c=fV(s,u);break;case"double-quoted-scalar":a=xy.Scalar.QUOTE_DOUBLE,c=mV(s,u);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let d=r+s.length,m=lV.resolveEnd(i,d,e,n);return{value:c,type:a,comment:m.comment,range:[r,d,m.offset]}}function dV(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),iT(t)}function fV(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),iT(t.slice(1,-1)).replace(/''/g,"'")}function iT(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
113
|
+
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
114
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let o=r[1],s=" ",i=e.lastIndex;for(n.lastIndex=i;r=n.exec(t);)r[1]===""?s===`
|
|
115
|
+
`?o+=s:s=`
|
|
116
|
+
`:(o+=s+r[1],s=" "),i=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,r=a.exec(t),o+s+(r?.[1]??"")}function mV(t,e){let n="";for(let r=1;r<t.length-1;++r){let o=t[r];if(!(o==="\r"&&t[r+1]===`
|
|
117
|
+
`))if(o===`
|
|
118
|
+
`){let{fold:s,offset:i}=pV(t,r);n+=s,r=i}else if(o==="\\"){let s=t[++r],i=gV[s];if(i)n+=i;else if(s===`
|
|
119
|
+
`)for(s=t[r+1];s===" "||s===" ";)s=t[++r+1];else if(s==="\r"&&t[r+1]===`
|
|
120
|
+
`)for(s=t[++r+1];s===" "||s===" ";)s=t[++r+1];else if(s==="x"||s==="u"||s==="U"){let a={x:2,u:4,U:8}[s];n+=hV(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(o===" "||o===" "){let s=r,i=t[r+1];for(;i===" "||i===" ";)i=t[++r+1];i!==`
|
|
121
|
+
`&&!(i==="\r"&&t[r+2]===`
|
|
122
|
+
`)&&(n+=r>s?t.slice(s,r+1):o)}else n+=o}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function pV(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
|
123
|
+
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
124
|
+
`);)r===`
|
|
125
|
+
`&&(n+=`
|
|
126
|
+
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var gV={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
127
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function hV(t,e,n,r){let o=t.substr(e,n),i=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;if(isNaN(i)){let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(i)}aT.resolveFlowScalar=uV});var uT=b(lT=>{"use strict";var Oo=te(),cT=je(),yV=Ny(),bV=Py();function vV(t,e,n,r){let{value:o,type:s,comment:i,range:a}=e.type==="block-scalar"?yV.resolveBlockScalar(t,e,r):bV.resolveFlowScalar(e,t.options.strict,r),c=n?t.directives.tagName(n.source,m=>r(n,"TAG_RESOLVE_FAILED",m)):null,u;t.options.stringKeys&&t.atKey?u=t.schema[Oo.SCALAR]:c?u=SV(t.schema,o,c,n,r):e.type==="scalar"?u=_V(t,o,e,r):u=t.schema[Oo.SCALAR];let d;try{let m=u.resolve(o,p=>r(n??e,"TAG_RESOLVE_FAILED",p),t.options);d=Oo.isScalar(m)?m:new cT.Scalar(m)}catch(m){let p=m instanceof Error?m.message:String(m);r(n??e,"TAG_RESOLVE_FAILED",p),d=new cT.Scalar(o)}return d.range=a,d.source=o,s&&(d.type=s),c&&(d.tag=c),u.format&&(d.format=u.format),i&&(d.comment=i),d}function SV(t,e,n,r,o){if(n==="!")return t[Oo.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let i=t.knownTags[n];return i&&!i.collection?(t.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(o(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Oo.SCALAR])}function _V({atKey:t,directives:e,schema:n},r,o,s){let i=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[Oo.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[Oo.SCALAR];if(i.tag!==a.tag){let c=e.tagString(i.tag),u=e.tagString(a.tag),d=`Value may be parsed as either ${c} or ${u}`;s(o,"TAG_RESOLVE_FAILED",d,!0)}}return i}lT.composeScalar=vV});var fT=b(dT=>{"use strict";function wV(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let o=e[r];switch(o.type){case"space":case"comment":case"newline":t-=o.source.length;continue}for(o=e[++r];o?.type==="space";)t+=o.source.length,o=e[++r];break}}return t}dT.emptyScalarPosition=wV});var gT=b(jy=>{"use strict";var EV=ya(),DV=te(),CV=oT(),mT=uT(),kV=Ps(),AV=fT(),TV={composeNode:pT,composeEmptyNode:Ry};function pT(t,e,n,r){let o=t.atKey,{spaceBefore:s,comment:i,anchor:a,tag:c}=n,u,d=!0;switch(e.type){case"alias":u=FV(t,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=mT.composeScalar(t,e,c,r),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":u=CV.composeCollection(TV,t,e,n,r),a&&(u.anchor=a.source.substring(1));break;default:{let m=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",m),u=Ry(t,e.offset,void 0,null,n,r),d=!1}}return a&&u.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),o&&t.options.stringKeys&&(!DV.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?u.comment=i:u.commentBefore=i),t.options.keepSourceTokens&&d&&(u.srcToken=e),u}function Ry(t,e,n,r,{spaceBefore:o,comment:s,anchor:i,tag:a,end:c},u){let d={type:"scalar",offset:AV.emptyScalarPosition(e,n,r),indent:-1,source:""},m=mT.composeScalar(t,d,a,u);return i&&(m.anchor=i.source.substring(1),m.anchor===""&&u(i,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(m.spaceBefore=!0),s&&(m.comment=s,m.range[2]=c),m}function FV({options:t},{offset:e,source:n,end:r},o){let s=new EV.Alias(n.substring(1));s.source===""&&o(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&o(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=e+n.length,a=kV.resolveEnd(r,i,t.strict,o);return s.range=[e,i,a.offset],a.comment&&(s.comment=a.comment),s}jy.composeEmptyNode=Ry;jy.composeNode=pT});var bT=b(yT=>{"use strict";var OV=Pa(),hT=gT(),IV=Ps(),NV=La();function xV(t,e,{offset:n,start:r,value:o,end:s},i){let a=Object.assign({_directives:e},t),c=new OV.Document(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=NV.resolveProps(r,{indicator:"doc-start",next:o??s?.[0],offset:n,onError:i,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!d.hasNewline&&i(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=o?hT.composeNode(u,o,d,i):hT.composeEmptyNode(u,d.end,r,null,d,i);let m=c.contents.range[2],p=IV.resolveEnd(s,m,!1,i);return p.comment&&(c.comment=p.comment),c.range=[n,m,p.offset],c}yT.composeDoc=xV});var Ly=b(_T=>{"use strict";var PV=require("process"),RV=Eh(),jV=Pa(),Ba=$a(),vT=te(),$V=bT(),LV=Ps();function Ma(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function ST(t){let e="",n=!1,r=!1;for(let o=0;o<t.length;++o){let s=t[o];switch(s[0]){case"#":e+=(e===""?"":r?`
|
|
128
|
+
|
|
129
|
+
`:`
|
|
130
|
+
`)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":t[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var $y=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,o,s)=>{let i=Ma(n);s?this.warnings.push(new Ba.YAMLWarning(i,r,o)):this.errors.push(new Ba.YAMLParseError(i,r,o))},this.directives=new RV.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:o}=ST(this.prelude);if(r){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
131
|
+
${r}`:r;else if(o||e.directives.docStart||!s)e.commentBefore=r;else if(vT.isCollection(s)&&!s.flow&&s.items.length>0){let i=s.items[0];vT.isPair(i)&&(i=i.key);let a=i.commentBefore;i.commentBefore=a?`${r}
|
|
132
|
+
${a}`:r}else{let i=s.commentBefore;s.commentBefore=i?`${r}
|
|
133
|
+
${i}`:r}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ST(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let o of e)yield*this.next(o);yield*this.end(n,r)}*next(e){switch(PV.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,o)=>{let s=Ma(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,o)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=$V.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Ba.YAMLParseError(Ma(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Ba.YAMLParseError(Ma(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=LV.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
134
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ba.YAMLParseError(Ma(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),o=new jV.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}};_T.Composer=$y});var DT=b($d=>{"use strict";var BV=Ny(),MV=Py(),UV=$a(),wT=wa();function GV(t,e=!0,n){if(t){let r=(o,s,i)=>{let a=typeof o=="number"?o:Array.isArray(o)?o[0]:o.offset;if(n)n(a,s,i);else throw new UV.YAMLParseError([a,a+1],s,i)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return MV.resolveFlowScalar(t,e,r);case"block-scalar":return BV.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function VV(t,e){let{implicitKey:n=!1,indent:r,inFlow:o=!1,offset:s=-1,type:i="PLAIN"}=e,a=wT.stringifyString({type:i,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
135
|
+
`}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
|
|
136
|
+
`),d=a.substring(0,u),m=a.substring(u+1)+`
|
|
137
|
+
`,p=[{type:"block-scalar-header",offset:s,indent:r,source:d}];return ET(p,c)||p.push({type:"newline",offset:-1,indent:r,source:`
|
|
138
|
+
`}),{type:"block-scalar",offset:s,indent:r,props:p,source:m}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:a,end:c};default:return{type:"scalar",offset:s,indent:r,source:a,end:c}}}function qV(t,e,n={}){let{afterKey:r=!1,implicitKey:o=!1,inFlow:s=!1,type:i}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!i)switch(t.type){case"single-quoted-scalar":i="QUOTE_SINGLE";break;case"double-quoted-scalar":i="QUOTE_DOUBLE";break;case"block-scalar":{let u=t.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:i="PLAIN"}let c=wT.stringifyString({type:i,value:e},{implicitKey:o||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":HV(t,c);break;case'"':By(t,c,"double-quoted-scalar");break;case"'":By(t,c,"single-quoted-scalar");break;default:By(t,c,"scalar")}}function HV(t,e){let n=e.indexOf(`
|
|
139
|
+
`),r=e.substring(0,n),o=e.substring(n+1)+`
|
|
140
|
+
`;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,t.source=o}else{let{offset:s}=t,i="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:i,source:r}];ET(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:i,source:`
|
|
141
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:i,props:a,source:o})}}function ET(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function By(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),o=e.length;t.props[0].type==="block-scalar-header"&&(o-=t.props[0].source.length);for(let s of r)s.offset+=o;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let o={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
142
|
+
`};delete t.items,Object.assign(t,{type:n,source:e,end:[o]});break}default:{let r="indent"in t?t.indent:-1,o="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:r,source:e,end:o})}}}$d.createScalarToken=VV;$d.resolveAsScalar=GV;$d.setScalarValue=qV});var kT=b(CT=>{"use strict";var WV=t=>"type"in t?Bd(t):Ld(t);function Bd(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Bd(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Ld(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Ld(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Ld(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Ld({start:t,key:e,sep:n,value:r}){let o="";for(let s of t)o+=s.source;if(e&&(o+=Bd(e)),n)for(let s of n)o+=s.source;return r&&(o+=Bd(r)),o}CT.stringify=WV});var OT=b(FT=>{"use strict";var My=Symbol("break visit"),JV=Symbol("skip children"),AT=Symbol("remove item");function Io(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),TT(Object.freeze([]),t,e)}Io.BREAK=My;Io.SKIP=JV;Io.REMOVE=AT;Io.itemAtPath=(t,e)=>{let n=t;for(let[r,o]of e){let s=n?.[r];if(s&&"items"in s)n=s.items[o];else return}return n};Io.parentCollection=(t,e)=>{let n=Io.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],o=n?.[r];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function TT(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let o of["key","value"]){let s=e[o];if(s&&"items"in s){for(let i=0;i<s.items.length;++i){let a=TT(Object.freeze(t.concat([[o,i]])),s.items[i],n);if(typeof a=="number")i=a-1;else{if(a===My)return My;a===AT&&(s.items.splice(i,1),i-=1)}}typeof r=="function"&&o==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}FT.visit=Io});var Md=b(Ct=>{"use strict";var Uy=DT(),YV=kT(),KV=OT(),Gy="\uFEFF",Vy="",qy="",Hy="",zV=t=>!!t&&"items"in t,ZV=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function XV(t){switch(t){case Gy:return"<BOM>";case Vy:return"<DOC>";case qy:return"<FLOW_END>";case Hy:return"<SCALAR>";default:return JSON.stringify(t)}}function QV(t){switch(t){case Gy:return"byte-order-mark";case Vy:return"doc-mode";case qy:return"flow-error-end";case Hy:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
143
|
+
`:case`\r
|
|
144
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ct.createScalarToken=Uy.createScalarToken;Ct.resolveAsScalar=Uy.resolveAsScalar;Ct.setScalarValue=Uy.setScalarValue;Ct.stringify=YV.stringify;Ct.visit=KV.visit;Ct.BOM=Gy;Ct.DOCUMENT=Vy;Ct.FLOW_END=qy;Ct.SCALAR=Hy;Ct.isCollection=zV;Ct.isScalar=ZV;Ct.prettyToken=XV;Ct.tokenType=QV});var Yy=b(NT=>{"use strict";var Ua=Md();function ln(t){switch(t){case void 0:case" ":case`
|
|
145
|
+
`:case"\r":case" ":return!0;default:return!1}}var IT=new Set("0123456789ABCDEFabcdef"),eq=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ud=new Set(",[]{}"),tq=new Set(` ,[]{}
|
|
146
|
+
\r `),Wy=t=>!t||tq.has(t),Jy=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
|
147
|
+
`?!0:n==="\r"?this.buffer[e+1]===`
|
|
148
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let o=this.buffer[r+e+1];if(o===`
|
|
149
|
+
`||!o&&!this.atEnd)return e+r+1}return n===`
|
|
150
|
+
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ln(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
151
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Ua.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let s=e[r-1];if(s===" "||s===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Ua.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ln(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ln(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ln(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Wy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&ln(o[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield Ua.FLOW_END,yield*this.parseLineStart();let s=0;for(;o[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),o[s]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Wy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let i=this.charAt(1);if(this.flowKey||ln(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),o=r.indexOf(`
|
|
152
|
+
`,this.pos);if(o!==-1){for(;o!==-1;){let s=this.continueScalar(o+1);if(s===-1)break;o=r.indexOf(`
|
|
153
|
+
`,s)}o!==-1&&(n=o-(r[o-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ln(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
|
|
154
|
+
`:e=s,n=0;break;case"\r":{let i=this.buffer[s+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
|
|
155
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
|
|
156
|
+
`,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let o=e+1;for(r=this.buffer[o];r===" ";)r=this.buffer[++o];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
157
|
+
`;)r=this.buffer[++o];e=o-1}else if(!this.blockScalarKeep)do{let s=e-1,i=this.buffer[s];i==="\r"&&(i=this.buffer[--s]);let a=s;for(;i===" ";)i=this.buffer[--s];if(i===`
|
|
158
|
+
`&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield Ua.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,o;for(;o=this.buffer[++r];)if(o===":"){let s=this.buffer[r+1];if(ln(s)||e&&Ud.has(s))break;n=r}else if(ln(o)){let s=this.buffer[r+1];if(o==="\r"&&(s===`
|
|
159
|
+
`?(r+=1,o=`
|
|
160
|
+
`,s=this.buffer[r+1]):n=r),s==="#"||e&&Ud.has(s))break;if(o===`
|
|
161
|
+
`){let i=this.continueScalar(r+1);if(i===-1)break;r=Math.max(r,i-2)}}else{if(e&&Ud.has(o))break;n=r}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield Ua.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Wy))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(ln(n)||e&&Ud.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ln(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(eq.has(n))n=this.buffer[++e];else if(n==="%"&&IT.has(this.buffer[e+1])&&IT.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
162
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
163
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};NT.Lexer=Jy});var zy=b(xT=>{"use strict";var Ky=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<e?n=s+1:r=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let o=this.lineStarts[n-1];return{line:n,col:e-o+1}}}};xT.LineCounter=Ky});var Xy=b(LT=>{"use strict";var nq=require("process"),PT=Md(),rq=Yy();function jr(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function RT(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function $T(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Gd(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Rs(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function jT(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!jr(e.start,"explicit-key-ind")&&!jr(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,$T(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Zy=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new rq.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,nq.env.LOG_TOKENS&&console.log("|",PT.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=PT.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&jT(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];o.value?r.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{let o=r.items[r.items.length-1];!o||o.value?r.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&RT(o.start)===-1&&(n.indent===0||o.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=o.start:r.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{RT(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Gd(this.peek(2)),r=Rs(n),o;e.end?(o=e.end,o.push(this.sourceToken),delete e.end):o=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
164
|
+
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
165
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,o=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(o&&n.sep&&!n.value){let i=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":i.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(s=n.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(jr(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if($T(n.key)&&!jr(n.sep,"newline")){let i=Rs(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(jr(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let i=Rs(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?e.items.push({start:s,key:null,sep:[this.sourceToken]}):jr(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);o||n.value?(e.items.push({start:s,key:i,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(i):(Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(e);if(i){if(i.type==="block-seq"){if(!n.explicitKey&&n.sep&&!jr(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:s});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||jr(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=Gd(r),s=Rs(o);jT(e);let i=e.end.splice(1,e.end.length);i.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
|
166
|
+
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
167
|
+
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Gd(e),r=Rs(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Gd(e),r=Rs(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};LT.Parser=Zy});var VT=b(Va=>{"use strict";var BT=Ly(),oq=Pa(),Ga=$a(),sq=jh(),iq=te(),aq=zy(),MT=Xy();function UT(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new aq.LineCounter||null,prettyErrors:e}}function cq(t,e={}){let{lineCounter:n,prettyErrors:r}=UT(e),o=new MT.Parser(n?.addNewLine),s=new BT.Composer(e),i=Array.from(s.compose(o.parse(t)));if(r&&n)for(let a of i)a.errors.forEach(Ga.prettifyError(t,n)),a.warnings.forEach(Ga.prettifyError(t,n));return i.length>0?i:Object.assign([],{empty:!0},s.streamInfo())}function GT(t,e={}){let{lineCounter:n,prettyErrors:r}=UT(e),o=new MT.Parser(n?.addNewLine),s=new BT.Composer(e),i=null;for(let a of s.compose(o.parse(t),!0,t.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new Ga.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(i.errors.forEach(Ga.prettifyError(t,n)),i.warnings.forEach(Ga.prettifyError(t,n))),i}function lq(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let o=GT(t,n);if(!o)return null;if(o.warnings.forEach(s=>sq.warn(o.options.logLevel,s)),o.errors.length>0){if(o.options.logLevel!=="silent")throw o.errors[0];o.errors=[]}return o.toJS(Object.assign({reviver:r},n))}function uq(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let o=Math.round(n);n=o<1?void 0:o>8?{indent:8}:{indent:o}}if(t===void 0){let{keepUndefined:o}=n??e??{};if(!o)return}return iq.isDocument(t)&&!r?t.toString(n):new oq.Document(t,r,n).toString(n)}Va.parse=lq;Va.parseAllDocuments=cq;Va.parseDocument=GT;Va.stringify=uq});var HT=b(ue=>{"use strict";var dq=Ly(),fq=Pa(),mq=by(),Qy=$a(),pq=ya(),$r=te(),gq=Nr(),hq=je(),yq=Pr(),bq=Rr(),vq=Md(),Sq=Yy(),_q=zy(),wq=Xy(),Vd=VT(),qT=ma();ue.Composer=dq.Composer;ue.Document=fq.Document;ue.Schema=mq.Schema;ue.YAMLError=Qy.YAMLError;ue.YAMLParseError=Qy.YAMLParseError;ue.YAMLWarning=Qy.YAMLWarning;ue.Alias=pq.Alias;ue.isAlias=$r.isAlias;ue.isCollection=$r.isCollection;ue.isDocument=$r.isDocument;ue.isMap=$r.isMap;ue.isNode=$r.isNode;ue.isPair=$r.isPair;ue.isScalar=$r.isScalar;ue.isSeq=$r.isSeq;ue.Pair=gq.Pair;ue.Scalar=hq.Scalar;ue.YAMLMap=yq.YAMLMap;ue.YAMLSeq=bq.YAMLSeq;ue.CST=vq;ue.Lexer=Sq.Lexer;ue.LineCounter=_q.LineCounter;ue.Parser=wq.Parser;ue.parse=Vd.parse;ue.parseAllDocuments=Vd.parseAllDocuments;ue.parseDocument=Vd.parseDocument;ue.stringify=Vd.stringify;ue.visit=qT.visit;ue.visitAsync=qT.visitAsync});var Bb=H(Lb(),1),{program:$9,createCommand:L9,createArgument:B9,createOption:M9,CommanderError:U9,InvalidArgumentError:G9,InvalidOptionArgumentError:V9,Command:F,Argument:q9,Option:H9,Help:W9}=Bb.default;var cF=H(Hb(),1),lF=H(require("https"),1),tr=require("fs"),wb=require("path"),uF=require("os");var Wb=(t=0)=>e=>`\x1B[${e+t}m`,Jb=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Yb=(t=0)=>(e,n,r)=>`\x1B[${38+t};2;${e};${n};${r}m`,Se={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},z9=Object.keys(Se.modifier),r1=Object.keys(Se.color),o1=Object.keys(Se.bgColor),Z9=[...r1,...o1];function s1(){let t=new Map;for(let[e,n]of Object.entries(Se)){for(let[r,o]of Object.entries(n))Se[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},n[r]=Se[r],t.set(o[0],o[1]);Object.defineProperty(Se,e,{value:n,enumerable:!1})}return Object.defineProperty(Se,"codes",{value:t,enumerable:!1}),Se.color.close="\x1B[39m",Se.bgColor.close="\x1B[49m",Se.color.ansi=Wb(),Se.color.ansi256=Jb(),Se.color.ansi16m=Yb(),Se.bgColor.ansi=Wb(10),Se.bgColor.ansi256=Jb(10),Se.bgColor.ansi16m=Yb(10),Object.defineProperties(Se,{rgbToAnsi256:{value(e,n,r){return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(s=>s+s).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>Se.rgbToAnsi256(...Se.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let n,r,o;if(e>=232)n=((e-232)*10+8)/255,r=n,o=n;else{e-=16;let a=e%36;n=Math.floor(e/36)/5,r=Math.floor(a/6)/5,o=a%6/5}let s=Math.max(n,r,o)*2;if(s===0)return 30;let i=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(n));return s===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,n,r)=>Se.ansi256ToAnsi(Se.rgbToAnsi256(e,n,r)),enumerable:!1},hexToAnsi:{value:e=>Se.ansi256ToAnsi(Se.hexToAnsi256(e)),enumerable:!1}}),Se}var i1=s1(),Ht=i1;var rc=H(require("node:process"),1),zb=H(require("node:os"),1),gf=H(require("node:tty"),1);function xt(t,e=globalThis.Deno?globalThis.Deno.args:rc.default.argv){let n=t.startsWith("-")?"":t.length===1?"-":"--",r=e.indexOf(n+t),o=e.indexOf("--");return r!==-1&&(o===-1||r<o)}var{env:_e}=rc.default,nc;xt("no-color")||xt("no-colors")||xt("color=false")||xt("color=never")?nc=0:(xt("color")||xt("colors")||xt("color=true")||xt("color=always"))&&(nc=1);function a1(){if("FORCE_COLOR"in _e)return _e.FORCE_COLOR==="true"?1:_e.FORCE_COLOR==="false"?0:_e.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(_e.FORCE_COLOR,10),3)}function c1(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function l1(t,{streamIsTTY:e,sniffFlags:n=!0}={}){let r=a1();r!==void 0&&(nc=r);let o=n?nc:r;if(o===0)return 0;if(n){if(xt("color=16m")||xt("color=full")||xt("color=truecolor"))return 3;if(xt("color=256"))return 2}if("TF_BUILD"in _e&&"AGENT_NAME"in _e)return 1;if(t&&!e&&o===void 0)return 0;let s=o||0;if(_e.TERM==="dumb")return s;if(rc.default.platform==="win32"){let i=zb.default.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in _e)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(i=>i in _e)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(i=>i in _e)||_e.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in _e)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(_e.TEAMCITY_VERSION)?1:0;if(_e.COLORTERM==="truecolor"||_e.TERM==="xterm-kitty"||_e.TERM==="xterm-ghostty"||_e.TERM==="wezterm")return 3;if("TERM_PROGRAM"in _e){let i=Number.parseInt((_e.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(_e.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(_e.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(_e.TERM)||"COLORTERM"in _e?1:s}function Kb(t,e={}){let n=l1(t,{streamIsTTY:t&&t.isTTY,...e});return c1(n)}var u1={stdout:Kb({isTTY:gf.default.isatty(1)}),stderr:Kb({isTTY:gf.default.isatty(2)})},Zb=u1;function Xb(t,e,n){let r=t.indexOf(e);if(r===-1)return t;let o=e.length,s=0,i="";do i+=t.slice(s,r)+e+n,s=r+o,r=t.indexOf(e,s);while(r!==-1);return i+=t.slice(s),i}function Qb(t,e,n,r){let o=0,s="";do{let i=t[r-1]==="\r";s+=t.slice(o,i?r-1:r)+e+(i?`\r
|
|
26
168
|
`:`
|
|
27
|
-
`)+n,
|
|
28
|
-
`,
|
|
29
|
-
`);return r!==-1&&(e=Tn(e,s,o,r)),o+e+s};Object.defineProperties(ue.prototype,Q);var Is=ue(),yi=ue({level:Bn?Bn.level:0});var i=Is;var zn=require("crypto"),Yn=b(require("os"),1);var N=require("fs"),Pn=require("os"),X=require("path"),Nn=require("url"),Rs={},ht=(0,X.join)((0,Pn.homedir)(),".gal"),Se=(0,X.join)(ht,"config.json"),Bs={development:"http://localhost:3000",staging:"https://gal-api-wug5dzqj2a-uc.a.run.app",production:"https://api.gal.run"};function Ln(){let t=process.env.GAL_ENV?.toLowerCase();if(t==="development"||t==="dev"||t==="local")return"development";if(t==="staging"||t==="stg"||t==="beta")return"staging";if(t==="production"||t==="prod")return"production";if(process.argv[1]?.includes("tsx")||process.argv[1]?.includes("ts-node")||process.argv[1]?.endsWith(".ts")||process.env.npm_lifecycle_event==="dev"||process.env.NODE_ENV==="development")return"development";try{let n="0.1.18";if(n&&(n.includes("-beta")||n.includes("-rc")||n.includes("-alpha")))return"staging";if(!n||n==="0.0.0-dev"){let o=(0,Nn.fileURLToPath)(Rs.url),s=(0,X.dirname)(o),r=(0,X.join)(s,"..","package.json");if((0,N.existsSync)(r)){let u=JSON.parse((0,N.readFileSync)(r,"utf-8")).version||"";if(u.includes("-beta")||u.includes("-rc")||u.includes("-alpha"))return"staging"}}}catch{}return"production"}var y=class{static getEnvironment(){return Ln()}static load(){let e=Ln(),n=Bs[e];if(!(0,N.existsSync)(Se))return{apiUrl:n};try{let o=(0,N.readFileSync)(Se,"utf-8"),s=JSON.parse(o);return s.apiUrl||(s.apiUrl=n),e!=="development"&&s.apiUrl.includes("localhost")&&(s.apiUrl=n),s}catch(o){return console.error("Error loading config:",o),{apiUrl:n}}}static save(e){(0,N.existsSync)(ht)||(0,N.mkdirSync)(ht,{recursive:!0}),(0,N.writeFileSync)(Se,JSON.stringify(e,null,2),"utf-8")}static set(e,n){let o=this.load();o[e]=n,this.save(o)}static get(e){return this.load()[e]}static getConfigPath(){return Se}};var G=require("fs"),mt=require("path"),$n=require("os"),jn=require("crypto"),pt=(0,mt.join)((0,$n.homedir)(),".gal"),ke=(0,mt.join)(pt,"installation-id");function Gn(){try{if((0,G.existsSync)(ke)){let e=(0,G.readFileSync)(ke,"utf-8").trim();if(e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))return e}}catch{}let t=(0,jn.randomUUID)();try{(0,G.existsSync)(pt)||(0,G.mkdirSync)(pt,{recursive:!0}),(0,G.writeFileSync)(ke,t,"utf-8")}catch{}return t}function Un(){return!(0,G.existsSync)(ke)}var O=require("fs"),Te=require("path"),Hn=require("os"),Oe=(0,Te.join)((0,Hn.homedir)(),".gal"),le=(0,Te.join)(Oe,"telemetry-queue.json"),Dt=(0,Te.join)(Oe,"telemetry-pending-events.json"),Mn=100,Ls=7,Ps=Ls*24*60*60*1e3,xe=class{queue=[];flushCallback=null;constructor(){this.loadOfflineQueue(),this.loadPendingEvents()}setFlushCallback(e){this.flushCallback=e}async addEvent(e){let n={event:e,queuedAt:Date.now()};this.queue.push(n),this.queue.length>=Mn&&await this.flush()}async flush(){if(this.queue.length===0)return;if(!this.flushCallback){this.saveOfflineQueue();return}if(this.pruneExpiredEvents(),this.queue.length===0)return;let e=this.queue.slice(0,Mn),n=e.map(o=>o.event);try{await this.flushCallback(n)?(this.queue=this.queue.slice(e.length),this.queue.length>0?this.saveOfflineQueue():this.clearOfflineQueue()):this.saveOfflineQueue()}catch{this.saveOfflineQueue()}}getQueueLength(){return this.queue.length}loadOfflineQueue(){try{if((0,O.existsSync)(le)){let e=(0,O.readFileSync)(le,"utf-8"),n=JSON.parse(e);Array.isArray(n)&&(this.queue=n.map(o=>"event"in o&&"queuedAt"in o?o:{event:this.upgradeOldEvent(o),queuedAt:o.queuedAt||Date.now()}),this.pruneExpiredEvents())}}catch{}}upgradeOldEvent(e){let n=e.payload||{};return{id:e.id||"",timestamp:e.timestamp||new Date().toISOString(),severity:n.success===!1?"ERROR":"INFO",resource:{"service.name":"gal-cli","service.version":n.cliVersion||"unknown","host.os":n.platform||"linux","host.arch":"x64","process.runtime.version":n.nodeVersion},eventType:e.eventType||"cli_command",attributes:{command:n.command??null,success:n.success??null,error_type:n.errorType??null,duration_ms:n.durationMs??null,notification_type:n.notificationType??null,rate_limit_hit:n.rateLimitHit??null,sync_age_hours:n.syncAgeHours??null,files_synced:n.filesTracked??null},installationId:e.installationId||""}}loadPendingEvents(){try{if((0,O.existsSync)(Dt)){let e=(0,O.readFileSync)(Dt,"utf-8"),n=JSON.parse(e);if(Array.isArray(n))for(let o of n){let s,r;"event"in o?(s=o.event,r=o.queuedAt||Date.now()):(s=this.upgradeOldEvent(o),r=o.queuedAt||Date.now()),this.queue.push({event:s,queuedAt:r})}(0,O.writeFileSync)(Dt,"[]","utf-8")}}catch{}}saveOfflineQueue(){try{(0,O.existsSync)(Oe)||(0,O.mkdirSync)(Oe,{recursive:!0}),(0,O.writeFileSync)(le,JSON.stringify(this.queue),"utf-8")}catch{}}clearOfflineQueue(){try{(0,O.existsSync)(le)&&(0,O.writeFileSync)(le,"[]","utf-8")}catch{}}pruneExpiredEvents(){let e=Date.now();this.queue=this.queue.filter(n=>e-n.queuedAt<Ps)}};var Ns="v2",Ie=class{baseUrl;constructor(e){this.baseUrl=e}async sendEvents(e){if(e.length===0)return!0;try{let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),s=await fetch(`${this.baseUrl}/telemetry/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:e,schemaVersion:Ns}),signal:n.signal});return clearTimeout(o),s.ok?(await s.json()).accepted===!0:s.status===202}catch{return!1}}async sendFeedback(e,n){try{let o=new AbortController,s=setTimeout(()=>o.abort(),5e3),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);let a=await fetch(`${this.baseUrl}/telemetry/feedback`,{method:"POST",headers:r,body:JSON.stringify(e),signal:o.signal});return clearTimeout(s),a.ok?(await a.json()).accepted===!0:a.status===202}catch{return!1}}setBaseUrl(e){this.baseUrl=e}};var gt=b(require("readline"),1);var Vn=0;function Ft(){Vn++}async function ce(t,e){if(!Et()||!process.stdin.isTTY||!process.stdout.isTTY||!qn("error"))return;let n=gt.createInterface({input:process.stdin,output:process.stdout}),o=s=>new Promise(r=>{n.question(s,r)});try{console.log(),console.log(i.yellow("\u2501".repeat(50))),console.log(i.yellow(" Help us improve GAL CLI")),console.log(i.yellow("\u2501".repeat(50))),console.log();let s=await o(i.dim("Would you like to report this error? (y/N): "));if(s.toLowerCase()!=="y"&&s.toLowerCase()!=="yes"){n.close();return}let r=await o(i.dim("Any additional context? (press Enter to skip): "));n.close(),await Ct(1,r||`Error in ${t}: ${e.message}`,{command:t,errorType:e.name,errorMessage:e.message.substring(0,200)})&&console.log(i.green("\u2713 Thanks for your feedback!")),Wn("error")}catch{n.close()}}async function yt(){if(!Et()||!process.stdin.isTTY||!process.stdout.isTTY||Vn<10||!qn("session"))return;let t=gt.createInterface({input:process.stdin,output:process.stdout}),e=n=>new Promise(o=>{t.question(n,o)});try{console.log(),console.log(i.blue("\u2501".repeat(50))),console.log(i.blue(" Quick feedback (1 question)")),console.log(i.blue("\u2501".repeat(50))),console.log();let n=await e(i.dim("How would you rate GAL CLI? (1-5, or press Enter to skip): "));if(!n){t.close();return}let o=parseInt(n,10);if(isNaN(o)||o<1||o>5){console.log(i.dim("Invalid rating, skipping...")),t.close();return}let s;o<=3&&(s=await e(i.dim("What could we improve? (press Enter to skip): "))),t.close(),await Ct(o,s||void 0,{command:"session_feedback"})&&console.log(i.green("\u2713 Thanks for your feedback!")),Wn("session")}catch{t.close()}}function qn(t){try{let e=y.load(),n=Date.now(),o=24*60*60*1e3,s=7*o;if(t==="error"){let r=e.lastErrorFeedback||0;return n-r>o}else{let r=e.lastSessionFeedback||0;return n-r>s}}catch{return!0}}function Wn(t){try{let e=t==="error"?"lastErrorFeedback":"lastSessionFeedback";y.set(e,Date.now())}catch{}}var Kn="0.1.18",q=null,Jn=!1;function vt(){let t=process.env.GAL_TELEMETRY?.toLowerCase();if(t==="false"||t==="0"||t==="no"||t==="off")return!0;try{if(y.load().telemetry===!1)return!0}catch{}return!1}function $s(){return{"service.name":"gal-cli","service.version":Kn,"host.os":process.platform,"host.arch":Yn.default.arch(),"process.runtime.version":process.version}}var _t=class{queue;client;installationId;resource;exitHandlersRegistered=!1;constructor(e){this.installationId=Gn(),this.resource=$s(),this.queue=new xe,this.client=new Ie(e),this.queue.setFlushCallback(n=>this.client.sendEvents(n)),this.registerExitHandlers()}async trackEvent(e,n,o="INFO"){let s={id:(0,zn.randomUUID)(),timestamp:new Date().toISOString(),severity:o,resource:this.resource,eventType:e,attributes:n,installationId:this.installationId};await this.queue.addEvent(s)}async flush(){await this.queue.flush()}async sendFeedback(e,n,o){let s={installationId:this.installationId,rating:e,comment:n,context:{...o,cliVersion:Kn,platform:process.platform}},r=y.load();return this.client.sendFeedback(s,r.authToken)}registerExitHandlers(){if(this.exitHandlersRegistered)return;let e=async()=>{await this.flush()};process.on("beforeExit",e),process.on("SIGINT",async()=>{await e(),process.exit(130)}),process.on("SIGTERM",async()=>{await e(),process.exit(143)}),this.exitHandlersRegistered=!0}};function Qn(){if(Jn||(Jn=!0,vt()))return;let e=y.load().apiUrl||"https://api.gal.run";q=new _t(e)}function Xn(){if(!(vt()||y.load().telemetryNoticeShown)){if(!Un()){y.set("telemetryNoticeShown","true");return}console.log(i.blue("\u2501".repeat(60))),console.log(i.blue.bold(" GAL CLI Telemetry")),console.log(i.blue("\u2501".repeat(60))),console.log(),console.log(" GAL collects anonymous usage data to improve the CLI."),console.log(" This helps us diagnose issues and understand which"),console.log(" features are most valuable to developers."),console.log(),console.log(i.dim(" No personal information or code is collected.")),console.log(),console.log(" To opt out:"),console.log(i.cyan(" gal config set telemetry false")),console.log(" Or set environment variable:"),console.log(i.cyan(" export GAL_TELEMETRY=false")),console.log(),console.log(i.blue("\u2501".repeat(60))),console.log(),y.set("telemetryNoticeShown","true")}}function At(t,e){q&&q.trackEvent("auth_login",{success:t,error_type:e?e.name:null,auth_method:"github_oauth"},t?"INFO":"ERROR")}function bt(t,e,n,o){q&&q.trackEvent("sync_pull",{files_synced:t,success:e,sync_age_hours:n??null,config_version:o??null},e?"INFO":"ERROR")}async function Ct(t,e,n){return q?q.sendFeedback(t,e,n):!1}function Et(){return!vt()&&q!==null}var pe=b(require("node:process"),1);var Bt=b(require("node:process"),1);var de=b(require("node:process"),1);var js=(t,e,n,o)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let s=Object.getOwnPropertyDescriptor(t,n),r=Object.getOwnPropertyDescriptor(e,n);!Gs(s,r)&&o||Object.defineProperty(t,n,r)},Gs=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Us=(t,e)=>{let n=Object.getPrototypeOf(e);n!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,n)},Ms=(t,e)=>`/* Wrapped ${t}*/
|
|
30
|
-
${e}`,Hs=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Vs=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),qs=(t,e,n)=>{let o=n===""?"":`with ${n.trim()}() `,s=Ms.bind(null,o,e.toString());Object.defineProperty(s,"name",Vs);let{writable:r,enumerable:a,configurable:u}=Hs;Object.defineProperty(t,"toString",{value:s,writable:r,enumerable:a,configurable:u})};function wt(t,e,{ignoreNonConfigurable:n=!1}={}){let{name:o}=t;for(let s of Reflect.ownKeys(e))js(t,e,s,n);return Us(t,e),qs(t,e,o),t}var Be=new WeakMap,Zn=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let n,o=0,s=t.displayName||t.name||"<anonymous>",r=function(...a){if(Be.set(r,++o),o===1)n=t.apply(this,a),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return n};return wt(r,t),Be.set(r,o),r};Zn.callCount=t=>{if(!Be.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return Be.get(t)};var eo=Zn;var W=[];W.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&W.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&W.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Re=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",St=Symbol.for("signal-exit emitter"),kt=globalThis,Ws=Object.defineProperty.bind(Object),Ot=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(kt[St])return kt[St];Ws(kt,St,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){let o=this.listeners[e],s=o.indexOf(n);s!==-1&&(s===0&&o.length===1?o.length=0:o.splice(s,1))}emit(e,n,o){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let r of this.listeners[e])s=r(n,o)===!0||s;return e==="exit"&&(s=this.emit("afterExit",n,o)||s),s}},Le=class{},Js=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}}),xt=class extends Le{onExit(){return()=>{}}load(){}unload(){}},Tt=class extends Le{#i=It.platform==="win32"?"SIGINT":"SIGHUP";#n=new Ot;#e;#s;#f;#t={};#r=!1;constructor(e){super(),this.#e=e,this.#t={};for(let n of W)this.#t[n]=()=>{let o=this.#e.listeners(n),{count:s}=this.#n,r=e;if(typeof r.__signal_exit_emitter__=="object"&&typeof r.__signal_exit_emitter__.count=="number"&&(s+=r.__signal_exit_emitter__.count),o.length===s){this.unload();let a=this.#n.emit("exit",null,n),u=n==="SIGHUP"?this.#i:n;a||e.kill(e.pid,u)}};this.#f=e.reallyExit,this.#s=e.emit}onExit(e,n){if(!Re(this.#e))return()=>{};this.#r===!1&&this.load();let o=n?.alwaysLast?"afterExit":"exit";return this.#n.on(o,e),()=>{this.#n.removeListener(o,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#n.count+=1;for(let e of W)try{let n=this.#t[e];n&&this.#e.on(e,n)}catch{}this.#e.emit=(e,...n)=>this.#h(e,...n),this.#e.reallyExit=e=>this.#o(e)}}unload(){this.#r&&(this.#r=!1,W.forEach(e=>{let n=this.#t[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,n)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#f,this.#n.count-=1)}#o(e){return Re(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#f.call(this.#e,this.#e.exitCode)):0}#h(e,...n){let o=this.#s;if(e==="exit"&&Re(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let s=o.call(this.#e,e,...n);return this.#n.emit("exit",this.#e.exitCode,null),s}else return o.call(this.#e,e,...n)}},It=globalThis.process,{onExit:to,load:Mi,unload:Hi}=Js(Re(It)?new Tt(It):new xt);var no=de.default.stderr.isTTY?de.default.stderr:de.default.stdout.isTTY?de.default.stdout:void 0,zs=no?eo(()=>{to(()=>{no.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},oo=zs;var Pe=!1,Z={};Z.show=(t=Bt.default.stderr)=>{t.isTTY&&(Pe=!1,t.write("\x1B[?25h"))};Z.hide=(t=Bt.default.stderr)=>{t.isTTY&&(oo(),Pe=!0,t.write("\x1B[?25l"))};Z.toggle=(t,e)=>{t!==void 0&&(Pe=t),Pe?Z.show(e):Z.hide(e)};var Rt=Z;var me=b(Lt(),1);var L=b(require("node:process"),1);function Pt(){return L.default.platform!=="win32"?L.default.env.TERM!=="linux":!!L.default.env.CI||!!L.default.env.WT_SESSION||!!L.default.env.TERMINUS_SUBLIME||L.default.env.ConEmuTask==="{cmd::Cmder}"||L.default.env.TERM_PROGRAM==="Terminus-Sublime"||L.default.env.TERM_PROGRAM==="vscode"||L.default.env.TERM==="xterm-256color"||L.default.env.TERM==="alacritty"||L.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ks={info:i.blue("\u2139"),success:i.green("\u2714"),warning:i.yellow("\u26A0"),error:i.red("\u2716")},Qs={info:i.blue("i"),success:i.green("\u221A"),warning:i.yellow("\u203C"),error:i.red("\xD7")},Xs=Pt()?Ks:Qs,fe=Xs;function Nt({onlyFirst:t=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,t?void 0:"g")}var Zs=Nt();function he(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Zs,"")}function ao(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function uo(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function lo(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function er(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function co(t,{ambiguousAsWide:e=!1}={}){return er(t),uo(t)||lo(t)||e&&ao(t)?2:1}var po=b(ho(),1),tr=new Intl.Segmenter,nr=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function $t(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:o=!1}=e;if(o||(t=he(t)),t.length===0)return 0;let s=0,r={ambiguousAsWide:!n};for(let{segment:a}of tr.segment(t)){let u=a.codePointAt(0);if(!(u<=31||u>=127&&u<=159)&&!(u>=8203&&u<=8207||u===65279)&&!(u>=768&&u<=879||u>=6832&&u<=6911||u>=7616&&u<=7679||u>=8400&&u<=8447||u>=65056&&u<=65071)&&!(u>=55296&&u<=57343)&&!(u>=65024&&u<=65039)&&!nr.test(a)){if((0,po.default)().test(a)){s+=2;continue}s+=co(u,r)}}return s}function jt({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Gt=b(require("node:process"),1);function Ut(){let{env:t}=Gt.default,{TERM:e,TERM_PROGRAM:n}=t;return Gt.default.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var $=b(require("node:process"),1),or=3,Mt=class{#i=0;start(){this.#i++,this.#i===1&&this.#n()}stop(){if(this.#i<=0)throw new Error("`stop` called more times than `start`");this.#i--,this.#i===0&&this.#e()}#n(){$.default.platform==="win32"||!$.default.stdin.isTTY||($.default.stdin.setRawMode(!0),$.default.stdin.on("data",this.#s),$.default.stdin.resume())}#e(){$.default.stdin.isTTY&&($.default.stdin.off("data",this.#s),$.default.stdin.pause(),$.default.stdin.setRawMode(!1))}#s(e){e[0]===or&&$.default.emit("SIGINT")}},sr=new Mt,Ht=sr;var rr=b(Lt(),1),Vt=class{#i=0;#n=!1;#e=0;#s=-1;#f=0;#t;#r;#o;#h;#m;#l;#c;#d;#D;#a;#u;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:pe.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#m=this.#t.interval,this.#o=this.#t.stream,this.#l=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:jt({stream:this.#o}),this.#c=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,pe.default.env.NODE_ENV==="test"&&(this._stream=this.#o,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#i},set(n){this.#i=n}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#p()}get interval(){return this.#m??this.#r.interval??100}get spinner(){return this.#r}set spinner(e){if(this.#s=-1,this.#m=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=e}else if(!Ut())this.#r=me.default.line;else if(e===void 0)this.#r=me.default.dots;else if(e!=="default"&&me.default[e])this.#r=me.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#D}set text(e=""){this.#D=e,this.#p()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#p()}get suffixText(){return this.#u}set suffixText(e=""){this.#u=e,this.#p()}get isSpinning(){return this.#h!==void 0}#g(e=this.#a,n=" "){return typeof e=="string"&&e!==""?e+n:typeof e=="function"?e()+n:""}#F(e=this.#u,n=" "){return typeof e=="string"&&e!==""?n+e:typeof e=="function"?n+e():""}#p(){let e=this.#o.columns??80,n=this.#g(this.#a,"-"),o=this.#F(this.#u,"-"),s=" ".repeat(this.#d)+n+"--"+this.#D+"--"+o;this.#e=0;for(let r of he(s).split(`
|
|
31
|
-
`))this.#e+=Math.max(1,Math.ceil(
|
|
32
|
-
`),this)}stop(){return this.#l?(clearInterval(this.#
|
|
33
|
-
`;return this.stop(),this.#
|
|
169
|
+
`)+n,o=r+1,r=t.indexOf(`
|
|
170
|
+
`,o)}while(r!==-1);return s+=t.slice(o),s}var{stdout:e0,stderr:t0}=Zb,hf=Symbol("GENERATOR"),jo=Symbol("STYLER"),Us=Symbol("IS_EMPTY"),n0=["ansi","ansi","ansi256","ansi16m"],$o=Object.create(null),d1=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=e0?e0.level:0;t.level=e.level===void 0?n:e.level};var f1=t=>{let e=(...n)=>n.join(" ");return d1(e,t),Object.setPrototypeOf(e,Gs.prototype),e};function Gs(t){return f1(t)}Object.setPrototypeOf(Gs.prototype,Function.prototype);for(let[t,e]of Object.entries(Ht))$o[t]={get(){let n=oc(this,bf(e.open,e.close,this[jo]),this[Us]);return Object.defineProperty(this,t,{value:n}),n}};$o.visible={get(){let t=oc(this,this[jo],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var yf=(t,e,n,...r)=>t==="rgb"?e==="ansi16m"?Ht[n].ansi16m(...r):e==="ansi256"?Ht[n].ansi256(Ht.rgbToAnsi256(...r)):Ht[n].ansi(Ht.rgbToAnsi(...r)):t==="hex"?yf("rgb",e,n,...Ht.hexToRgb(...r)):Ht[n][t](...r),m1=["rgb","hex","ansi256"];for(let t of m1){$o[t]={get(){let{level:n}=this;return function(...r){let o=bf(yf(t,n0[n],"color",...r),Ht.color.close,this[jo]);return oc(this,o,this[Us])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);$o[e]={get(){let{level:n}=this;return function(...r){let o=bf(yf(t,n0[n],"bgColor",...r),Ht.bgColor.close,this[jo]);return oc(this,o,this[Us])}}}}var p1=Object.defineProperties(()=>{},{...$o,level:{enumerable:!0,get(){return this[hf].level},set(t){this[hf].level=t}}}),bf=(t,e,n)=>{let r,o;return n===void 0?(r=t,o=e):(r=n.openAll+t,o=e+n.closeAll),{open:t,close:e,openAll:r,closeAll:o,parent:n}},oc=(t,e,n)=>{let r=(...o)=>g1(r,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(r,p1),r[hf]=t,r[jo]=e,r[Us]=n,r},g1=(t,e)=>{if(t.level<=0||!e)return t[Us]?"":e;let n=t[jo];if(n===void 0)return e;let{openAll:r,closeAll:o}=n;if(e.includes("\x1B"))for(;n!==void 0;)e=Xb(e,n.close,n.open),n=n.parent;let s=e.indexOf(`
|
|
171
|
+
`);return s!==-1&&(e=Qb(e,o,r,s)),r+e+o};Object.defineProperties(Gs.prototype,$o);var h1=Gs(),o6=Gs({level:t0?t0.level:0});var l=h1;var Vs="0.1.19-beta",Ze="https://api.gal.run";var v0=require("crypto"),S0=H(require("os"),1);var Wt=require("fs"),o0=require("os"),Lo=require("path"),s0=require("url"),b1={},vf=(0,Lo.join)((0,o0.homedir)(),".gal"),sc=(0,Lo.join)(vf,"config.json"),y1={development:"http://localhost:3000",staging:"https://gal-api-wug5dzqj2a-uc.a.run.app",production:"https://api.gal.run"};function r0(){let t=process.env.GAL_ENV?.toLowerCase();if(t==="development"||t==="dev"||t==="local")return"development";if(t==="staging"||t==="stg"||t==="beta")return"staging";if(t==="production"||t==="prod")return"production";if(process.argv[1]?.includes("tsx")||process.argv[1]?.includes("ts-node")||process.argv[1]?.endsWith(".ts")||process.env.npm_lifecycle_event==="dev"||process.env.NODE_ENV==="development")return"development";try{let n="0.1.19-beta";if(n&&n.includes("-local"))return"development";if(n&&(n.includes("-beta")||n.includes("-rc")||n.includes("-alpha")))return"staging";if(!n||n==="0.0.0-dev"){let r=(0,s0.fileURLToPath)(b1.url),o=(0,Lo.dirname)(r),s=(0,Lo.join)(o,"..","package.json");if((0,Wt.existsSync)(s)){let a=JSON.parse((0,Wt.readFileSync)(s,"utf-8")).version||"";if(a.includes("-beta")||a.includes("-rc")||a.includes("-alpha"))return"staging"}}}catch{}return"production"}var M=class{static getEnvironment(){return r0()}static load(){let e=r0(),n=y1[e];if(!(0,Wt.existsSync)(sc))return{apiUrl:n};try{let r=(0,Wt.readFileSync)(sc,"utf-8"),o=JSON.parse(r);return o.apiUrl||(o.apiUrl=n),e!=="development"&&o.apiUrl.includes("localhost")&&(o.apiUrl=n),e==="development"&&o.apiUrl.includes("localhost")&&(o.apiUrl=n),o}catch(r){return console.error("Error loading config:",r),{apiUrl:n}}}static save(e){(0,Wt.existsSync)(vf)||(0,Wt.mkdirSync)(vf,{recursive:!0}),(0,Wt.writeFileSync)(sc,JSON.stringify(e,null,2),"utf-8")}static set(e,n){let r=this.load();r[e]=n,this.save(r)}static get(e){return this.load()[e]}static getConfigPath(){return sc}};var fn=require("fs"),_f=require("path"),i0=require("os"),a0=require("crypto"),Sf=(0,_f.join)((0,i0.homedir)(),".gal"),ic=(0,_f.join)(Sf,"installation-id");function c0(){try{if((0,fn.existsSync)(ic)){let e=(0,fn.readFileSync)(ic,"utf-8").trim();if(e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))return e}}catch{}let t=(0,a0.randomUUID)();try{(0,fn.existsSync)(Sf)||(0,fn.mkdirSync)(Sf,{recursive:!0}),(0,fn.writeFileSync)(ic,t,"utf-8")}catch{}return t}function l0(){return!(0,fn.existsSync)(ic)}var ht=require("fs"),lc=require("path"),d0=require("os"),ac=(0,lc.join)((0,d0.homedir)(),".gal"),qs=(0,lc.join)(ac,"telemetry-queue.json"),wf=(0,lc.join)(ac,"telemetry-pending-events.json"),u0=100,v1=7,S1=v1*24*60*60*1e3,cc=class{queue=[];flushCallback=null;constructor(){this.loadOfflineQueue(),this.loadPendingEvents()}setFlushCallback(e){this.flushCallback=e}async addEvent(e){let n={event:e,queuedAt:Date.now()};this.queue.push(n),this.queue.length>=u0&&await this.flush()}async flush(){if(this.queue.length===0)return;if(!this.flushCallback){this.saveOfflineQueue();return}if(this.pruneExpiredEvents(),this.queue.length===0)return;let e=this.queue.slice(0,u0),n=e.map(r=>r.event);try{await this.flushCallback(n)?(this.queue=this.queue.slice(e.length),this.queue.length>0?this.saveOfflineQueue():this.clearOfflineQueue()):this.saveOfflineQueue()}catch{this.saveOfflineQueue()}}getQueueLength(){return this.queue.length}loadOfflineQueue(){try{if((0,ht.existsSync)(qs)){let e=(0,ht.readFileSync)(qs,"utf-8"),n=JSON.parse(e);Array.isArray(n)&&(this.queue=n.map(r=>"event"in r&&"queuedAt"in r?r:{event:this.upgradeOldEvent(r),queuedAt:r.queuedAt||Date.now()}),this.pruneExpiredEvents())}}catch{}}upgradeOldEvent(e){let n=e.payload||{};return{id:e.id||"",timestamp:e.timestamp||new Date().toISOString(),severity:n.success===!1?"ERROR":"INFO",resource:{"service.name":"gal-cli","service.version":n.cliVersion||"unknown","host.os":n.platform||"linux","host.arch":"x64","process.runtime.version":n.nodeVersion},eventType:e.eventType||"cli_command",attributes:{command:n.command??null,success:n.success??null,error_type:n.errorType??null,duration_ms:n.durationMs??null,notification_type:n.notificationType??null,rate_limit_hit:n.rateLimitHit??null,sync_age_hours:n.syncAgeHours??null,files_synced:n.filesTracked??null},installationId:e.installationId||""}}loadPendingEvents(){try{if((0,ht.existsSync)(wf)){let e=(0,ht.readFileSync)(wf,"utf-8"),n=JSON.parse(e);if(Array.isArray(n))for(let r of n){let o,s;"event"in r?(o=r.event,s=r.queuedAt||Date.now()):(o=this.upgradeOldEvent(r),s=r.queuedAt||Date.now()),this.queue.push({event:o,queuedAt:s})}(0,ht.writeFileSync)(wf,"[]","utf-8")}}catch{}}saveOfflineQueue(){try{(0,ht.existsSync)(ac)||(0,ht.mkdirSync)(ac,{recursive:!0}),(0,ht.writeFileSync)(qs,JSON.stringify(this.queue),"utf-8")}catch{}}clearOfflineQueue(){try{(0,ht.existsSync)(qs)&&(0,ht.writeFileSync)(qs,"[]","utf-8")}catch{}}pruneExpiredEvents(){let e=Date.now();this.queue=this.queue.filter(n=>e-n.queuedAt<S1)}};var _1="v2",uc=class{baseUrl;constructor(e){this.baseUrl=e}async sendEvents(e){if(e.length===0)return!0;try{let n=new AbortController,r=setTimeout(()=>n.abort(),5e3),o=await fetch(`${this.baseUrl}/telemetry/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:e,schemaVersion:_1}),signal:n.signal});return clearTimeout(r),o.ok?(await o.json()).accepted===!0:o.status===202}catch{return!1}}async sendFeedback(e,n){try{let r=new AbortController,o=setTimeout(()=>r.abort(),5e3),s={"Content-Type":"application/json"};n&&(s.Authorization=`Bearer ${n}`);let i=await fetch(`${this.baseUrl}/telemetry/feedback`,{method:"POST",headers:s,body:JSON.stringify(e),signal:r.signal});return clearTimeout(o),i.ok?(await i.json()).accepted===!0:i.status===202}catch{return!1}}setBaseUrl(e){this.baseUrl=e}};var p0=!1,f0,m0;function Ef(){return p0}async function w1(t){return!p0||!f0||!m0?!1:(fetch("https://telemetry.gal-cli.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:f0,platform:m0})}).catch(()=>{}),!0)}async function Df(t,e,n){let r={event:"feedback",properties:{rating:t,comment:e,...n}};return w1(r)}var Cf=H(require("readline"),1);var g0=0;function kf(){g0++}async function Hs(t,e){if(!Ef()||!process.stdin.isTTY||!process.stdout.isTTY||!h0("error"))return;let n=Cf.createInterface({input:process.stdin,output:process.stdout}),r=o=>new Promise(s=>{n.question(o,s)});try{console.log(),console.log(l.yellow("\u2501".repeat(50))),console.log(l.yellow(" Help us improve GAL CLI")),console.log(l.yellow("\u2501".repeat(50))),console.log();let o=await r(l.dim("Would you like to report this error? (y/N): "));if(o.toLowerCase()!=="y"&&o.toLowerCase()!=="yes"){n.close();return}let s=await r(l.dim("Any additional context? (press Enter to skip): "));n.close(),await Df(1,s||`Error in ${t}: ${e.message}`,{command:t,errorType:e.name,errorMessage:e.message.substring(0,200)})&&console.log(l.green("\u2713 Thanks for your feedback!")),y0("error")}catch{n.close()}}async function Af(){if(!Ef()||!process.stdin.isTTY||!process.stdout.isTTY||g0<10||!h0("session"))return;let t=Cf.createInterface({input:process.stdin,output:process.stdout}),e=n=>new Promise(r=>{t.question(n,r)});try{console.log(),console.log(l.blue("\u2501".repeat(50))),console.log(l.blue(" Quick feedback (1 question)")),console.log(l.blue("\u2501".repeat(50))),console.log();let n=await e(l.dim("How would you rate GAL CLI? (1-5, or press Enter to skip): "));if(!n){t.close();return}let r=parseInt(n,10);if(isNaN(r)||r<1||r>5){console.log(l.dim("Invalid rating, skipping...")),t.close();return}let o;r<=3&&(o=await e(l.dim("What could we improve? (press Enter to skip): "))),t.close(),await Df(r,o||void 0,{command:"session_feedback"})&&console.log(l.green("\u2713 Thanks for your feedback!")),y0("session")}catch{t.close()}}function h0(t){try{let e=M.load(),n=Date.now(),r=24*60*60*1e3,o=7*r;if(t==="error"){let s=e.lastErrorFeedback||0;return n-s>r}else{let s=e.lastSessionFeedback||0;return n-s>o}}catch{return!0}}function y0(t){try{let e=t==="error"?"lastErrorFeedback":"lastSessionFeedback";M.set(e,Date.now())}catch{}}var _0="0.1.19-beta",Ws=null,b0=!1;function w0(){let t=process.env.GAL_TELEMETRY?.toLowerCase();if(t==="false"||t==="0"||t==="no"||t==="off")return!0;try{if(M.load().telemetry===!1)return!0}catch{}return!1}function E1(){return{"service.name":"gal-cli","service.version":_0,"host.os":process.platform,"host.arch":S0.default.arch(),"process.runtime.version":process.version}}var Tf=class{queue;client;installationId;resource;exitHandlersRegistered=!1;constructor(e){this.installationId=c0(),this.resource=E1(),this.queue=new cc,this.client=new uc(e),this.queue.setFlushCallback(n=>this.client.sendEvents(n)),this.registerExitHandlers()}async trackEvent(e,n,r="INFO"){let o={id:(0,v0.randomUUID)(),timestamp:new Date().toISOString(),severity:r,resource:this.resource,eventType:e,attributes:n,installationId:this.installationId};await this.queue.addEvent(o)}async flush(){await this.queue.flush()}async sendFeedback(e,n,r){let o={installationId:this.installationId,rating:e,comment:n,context:{...r,cliVersion:_0,platform:process.platform}},s=M.load();return this.client.sendFeedback(o,s.authToken)}registerExitHandlers(){if(this.exitHandlersRegistered)return;let e=async()=>{await this.flush()};process.on("beforeExit",e),process.on("SIGINT",async()=>{await e(),process.exit(130)}),process.on("SIGTERM",async()=>{await e(),process.exit(143)}),this.exitHandlersRegistered=!0}};function E0(){if(b0||(b0=!0,w0()))return;let e=M.load().apiUrl||"https://api.gal.run";Ws=new Tf(e)}function D0(){if(!(w0()||M.load().telemetryNoticeShown)){if(!l0()){M.set("telemetryNoticeShown","true");return}console.log(l.blue("\u2501".repeat(60))),console.log(l.blue.bold(" GAL CLI Telemetry")),console.log(l.blue("\u2501".repeat(60))),console.log(),console.log(" GAL collects anonymous usage data to improve the CLI."),console.log(" This helps us diagnose issues and understand which"),console.log(" features are most valuable to developers."),console.log(),console.log(l.dim(" No personal information or code is collected.")),console.log(),console.log(" To opt out:"),console.log(l.cyan(" gal config set telemetry false")),console.log(" Or set environment variable:"),console.log(l.cyan(" export GAL_TELEMETRY=false")),console.log(),console.log(l.blue("\u2501".repeat(60))),console.log(),M.set("telemetryNoticeShown","true")}}function Ff(t,e){Ws&&Ws.trackEvent("auth_login",{success:t,error_type:e?e.name:null,auth_method:"github_oauth"},t?"INFO":"ERROR")}function dc(t,e,n,r){Ws&&Ws.trackEvent("sync_pull",{files_synced:t,success:e,sync_age_hours:n??null,config_version:r??null},e?"INFO":"ERROR")}var vb={};kb(vb,{SetupCommand:()=>yh,createAdminCommand:()=>H1,createApproveCommand:()=>V0,createAuditCommand:()=>q0,createAuthCommand:()=>iO,createCheckCommand:()=>z0,createComplianceCommand:()=>bO,createConfigCommand:()=>EO,createDistributeCommand:()=>DO,createDocsCommand:()=>OO,createEnforceCommand:()=>NO,createFetchCommand:()=>BO,createFleetCommand:()=>UO,createHeadlessCommand:()=>vv,createJoinCommand:()=>YO,createMaintainCommand:()=>KO,createProtectCommand:()=>QO,createQualityCommand:()=>tI,createRunCommand:()=>fI,createSalCommand:()=>gI,createSandboxCommand:()=>GM,createSandboxProfilesCommand:()=>hI,createSyncCommand:()=>Tq,createTemplateCommand:()=>Wq,createTestCommand:()=>Jq,createTimeCommand:()=>Zq,createTriggerCommand:()=>l9,createUninstallCommand:()=>b9,createUniversalCommand:()=>v9,createWorkflowCommand:()=>S9});var zs=H(require("node:process"),1);var $f=H(require("node:process"),1);var Js=H(require("node:process"),1);var D1=(t,e,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(t,n),s=Object.getOwnPropertyDescriptor(e,n);!C1(o,s)&&r||Object.defineProperty(t,n,s)},C1=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},k1=(t,e)=>{let n=Object.getPrototypeOf(e);n!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,n)},A1=(t,e)=>`/* Wrapped ${t}*/
|
|
172
|
+
${e}`,T1=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),F1=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),O1=(t,e,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=A1.bind(null,r,e.toString());Object.defineProperty(o,"name",F1);let{writable:s,enumerable:i,configurable:a}=T1;Object.defineProperty(t,"toString",{value:o,writable:s,enumerable:i,configurable:a})};function Of(t,e,{ignoreNonConfigurable:n=!1}={}){let{name:r}=t;for(let o of Reflect.ownKeys(e))D1(t,e,o,n);return k1(t,e),O1(t,e,r),t}var fc=new WeakMap,C0=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let n,r=0,o=t.displayName||t.name||"<anonymous>",s=function(...i){if(fc.set(s,++r),r===1)n=t.apply(this,i),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return n};return Of(s,t),fc.set(s,r),s};C0.callCount=t=>{if(!fc.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return fc.get(t)};var k0=C0;var Lr=[];Lr.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Lr.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Lr.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var mc=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",If=Symbol.for("signal-exit emitter"),Nf=globalThis,I1=Object.defineProperty.bind(Object),xf=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Nf[If])return Nf[If];I1(Nf,If,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){let r=this.listeners[e],o=r.indexOf(n);o!==-1&&(o===0&&r.length===1?r.length=0:r.splice(o,1))}emit(e,n,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let o=!1;for(let s of this.listeners[e])o=s(n,r)===!0||o;return e==="exit"&&(o=this.emit("afterExit",n,r)||o),o}},pc=class{},N1=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}}),Pf=class extends pc{onExit(){return()=>{}}load(){}unload(){}},Rf=class extends pc{#i=jf.platform==="win32"?"SIGINT":"SIGHUP";#n=new xf;#e;#o;#f;#t={};#s=!1;constructor(e){super(),this.#e=e,this.#t={};for(let n of Lr)this.#t[n]=()=>{let r=this.#e.listeners(n),{count:o}=this.#n,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(o+=s.__signal_exit_emitter__.count),r.length===o){this.unload();let i=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#i:n;i||e.kill(e.pid,a)}};this.#f=e.reallyExit,this.#o=e.emit}onExit(e,n){if(!mc(this.#e))return()=>{};this.#s===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,e),()=>{this.#n.removeListener(r,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#n.count+=1;for(let e of Lr)try{let n=this.#t[e];n&&this.#e.on(e,n)}catch{}this.#e.emit=(e,...n)=>this.#m(e,...n),this.#e.reallyExit=e=>this.#r(e)}}unload(){this.#s&&(this.#s=!1,Lr.forEach(e=>{let n=this.#t[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,n)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#f,this.#n.count-=1)}#r(e){return mc(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#f.call(this.#e,this.#e.exitCode)):0}#m(e,...n){let r=this.#o;if(e==="exit"&&mc(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let o=r.call(this.#e,e,...n);return this.#n.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,e,...n)}},jf=globalThis.process,{onExit:A0,load:O6,unload:I6}=N1(mc(jf)?new Rf(jf):new Pf);var T0=Js.default.stderr.isTTY?Js.default.stderr:Js.default.stdout.isTTY?Js.default.stdout:void 0,x1=T0?k0(()=>{A0(()=>{T0.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},F0=x1;var gc=!1,Bo={};Bo.show=(t=$f.default.stderr)=>{t.isTTY&&(gc=!1,t.write("\x1B[?25h"))};Bo.hide=(t=$f.default.stderr)=>{t.isTTY&&(F0(),gc=!0,t.write("\x1B[?25l"))};Bo.toggle=(t,e)=>{t!==void 0&&(gc=t),gc?Bo.show(e):Bo.hide(e)};var Lf=Bo;var Zs=H(Bf(),1);var Pt=H(require("node:process"),1);function Mf(){return Pt.default.platform!=="win32"?Pt.default.env.TERM!=="linux":!!Pt.default.env.CI||!!Pt.default.env.WT_SESSION||!!Pt.default.env.TERMINUS_SUBLIME||Pt.default.env.ConEmuTask==="{cmd::Cmder}"||Pt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Pt.default.env.TERM_PROGRAM==="vscode"||Pt.default.env.TERM==="xterm-256color"||Pt.default.env.TERM==="alacritty"||Pt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var R1={info:l.blue("\u2139"),success:l.green("\u2714"),warning:l.yellow("\u26A0"),error:l.red("\u2716")},j1={info:l.blue("i"),success:l.green("\u221A"),warning:l.yellow("\u203C"),error:l.red("\xD7")},$1=Mf()?R1:j1,Ys=$1;function Uf({onlyFirst:t=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,t?void 0:"g")}var L1=Uf();function Ks(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(L1,"")}function x0(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function P0(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function R0(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function B1(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function j0(t,{ambiguousAsWide:e=!1}={}){return B1(t),P0(t)||R0(t)||e&&x0(t)?2:1}var B0=H(L0(),1),M1=new Intl.Segmenter,U1=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function Gf(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=e;if(r||(t=Ks(t)),t.length===0)return 0;let o=0,s={ambiguousAsWide:!n};for(let{segment:i}of M1.segment(t)){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!U1.test(i)){if((0,B0.default)().test(i)){o+=2;continue}o+=j0(a,s)}}return o}function Vf({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var qf=H(require("node:process"),1);function Hf(){let{env:t}=qf.default,{TERM:e,TERM_PROGRAM:n}=t;return qf.default.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Jt=H(require("node:process"),1),G1=3,Wf=class{#i=0;start(){this.#i++,this.#i===1&&this.#n()}stop(){if(this.#i<=0)throw new Error("`stop` called more times than `start`");this.#i--,this.#i===0&&this.#e()}#n(){Jt.default.platform==="win32"||!Jt.default.stdin.isTTY||(Jt.default.stdin.setRawMode(!0),Jt.default.stdin.on("data",this.#o),Jt.default.stdin.resume())}#e(){Jt.default.stdin.isTTY&&(Jt.default.stdin.off("data",this.#o),Jt.default.stdin.pause(),Jt.default.stdin.setRawMode(!1))}#o(e){e[0]===G1&&Jt.default.emit("SIGINT")}},V1=new Wf,Jf=V1;var q1=H(Bf(),1),Yf=class{#i=0;#n=!1;#e=0;#o=-1;#f=0;#t;#s;#r;#m;#g;#l;#u;#d;#h;#a;#c;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:zs.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#g=this.#t.interval,this.#r=this.#t.stream,this.#l=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Vf({stream:this.#r}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,zs.default.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#i},set(n){this.#i=n}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#p()}get interval(){return this.#g??this.#s.interval??100}get spinner(){return this.#s}set spinner(e){if(this.#o=-1,this.#g=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#s=e}else if(!Hf())this.#s=Zs.default.line;else if(e===void 0)this.#s=Zs.default.dots;else if(e!=="default"&&Zs.default[e])this.#s=Zs.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(e=""){this.#h=e,this.#p()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#p()}get suffixText(){return this.#c}set suffixText(e=""){this.#c=e,this.#p()}get isSpinning(){return this.#m!==void 0}#y(e=this.#a,n=" "){return typeof e=="string"&&e!==""?e+n:typeof e=="function"?e()+n:""}#b(e=this.#c,n=" "){return typeof e=="string"&&e!==""?n+e:typeof e=="function"?n+e():""}#p(){let e=this.#r.columns??80,n=this.#y(this.#a,"-"),r=this.#b(this.#c,"-"),o=" ".repeat(this.#d)+n+"--"+this.#h+"--"+r;this.#e=0;for(let s of Ks(o).split(`
|
|
173
|
+
`))this.#e+=Math.max(1,Math.ceil(Gf(s,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#l&&!this.#u}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=e}get isSilent(){return this.#u}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=e}frame(){let e=Date.now();(this.#o===-1||e-this.#f>=this.interval)&&(this.#o=++this.#o%this.#s.frames.length,this.#f=e);let{frames:n}=this.#s,r=n[this.#o];this.color&&(r=l[this.color](r));let o=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",s=typeof this.text=="string"?" "+this.text:"",i=typeof this.#c=="string"&&this.#c!==""?" "+this.#c:"";return o+r+s+i}clear(){if(!this.#l||!this.#r.isTTY)return this;this.#r.cursorTo(0);for(let e=0;e<this.#i;e++)e>0&&this.#r.moveCursor(0,-1),this.#r.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#r.cursorTo(this.#d),this.lastIndent=this.#d,this.#i=0,this}render(){return this.#u?this:(this.clear(),this.#r.write(this.frame()),this.#i=this.#e,this)}start(e){return e&&(this.text=e),this.#u?this:this.#l?this.isSpinning?this:(this.#t.hideCursor&&Lf.hide(this.#r),this.#t.discardStdin&&zs.default.stdin.isTTY&&(this.#n=!0,Jf.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#r.write(`- ${this.text}
|
|
174
|
+
`),this)}stop(){return this.#l?(clearInterval(this.#m),this.#m=void 0,this.#o=0,this.clear(),this.#t.hideCursor&&Lf.show(this.#r),this.#t.discardStdin&&zs.default.stdin.isTTY&&this.#n&&(Jf.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:Ys.success,text:e})}fail(e){return this.stopAndPersist({symbol:Ys.error,text:e})}warn(e){return this.stopAndPersist({symbol:Ys.warning,text:e})}info(e){return this.stopAndPersist({symbol:Ys.info,text:e})}stopAndPersist(e={}){if(this.#u)return this;let n=e.prefixText??this.#a,r=this.#y(n," "),o=e.symbol??" ",s=e.text??this.text,a=typeof s=="string"?(o?" ":"")+s:"",c=e.suffixText??this.#c,u=this.#b(c," "),d=r+o+a+u+`
|
|
175
|
+
`;return this.stop(),this.#r.write(d),this}};function x(t){return new Yf(t)}var M0=process.env.GAL_API_URL||Ze;async function U0(){return M.load().apiKey||process.env.GAL_API_KEY||null}function H1(){let t=new F("admin").description("Administrative commands (requires admin access)");return t.command("grant-plan").description("Grant a plan to an organization (bypasses Stripe)").argument("<org>","Organization name").argument("<plan>","Plan tier: free, convenience, enforcement, or enterprise").option("-r, --reason <reason>","Reason for the grant","Admin grant").action(async(e,n,r)=>{let o=x();["free","convenience","enforcement","enterprise"].includes(n)||(console.error(l.red("Error: Plan must be one of: free, convenience, enforcement, enterprise")),process.exit(1));let s=await U0();s||(console.error(l.red("Error: Not authenticated")),console.log(l.dim("Run: gal config set apiKey <your-api-key>")),process.exit(1)),o.start(`Granting ${l.cyan(n)} plan to ${l.cyan(e)}...`);try{let i=await fetch(`${M0}/admin/organizations/${encodeURIComponent(e)}/grant-plan`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({planTier:n,reason:r.reason})});if(!i.ok){let c=await i.json();throw new Error(c.error||`HTTP ${i.status}`)}let a=await i.json();o.succeed(l.green("Plan granted successfully!")),console.log(""),console.log(l.blue("Grant Details:")),console.log(` Organization: ${l.white(a.organization)}`),console.log(` Plan: ${l.cyan(a.planTier)}`),console.log(` Seat Limit: ${a.seatLimit===-1?l.green("Unlimited"):a.seatLimit}`),console.log(` Granted By: ${a.grantedBy}`),console.log("")}catch(i){o.fail(l.red("Failed to grant plan"));let a=i;console.error(l.red(a.message)),process.exit(1)}}),t.command("list-orgs").description("List all organizations with their plans").option("--json","Output as JSON").action(async e=>{let n=x(),r=await U0();r||(console.error(l.red("Error: Not authenticated")),console.log(l.dim("Run: gal config set apiKey <your-api-key>")),process.exit(1)),n.start("Fetching organizations...");try{let o=await fetch(`${M0}/admin/organizations`,{headers:{Authorization:`Bearer ${r}`}});if(!o.ok){let u=await o.json();throw new Error(u.error||`HTTP ${o.status}`)}let s=await o.json(),{organizations:i,total:a}=s;if(n.stop(),e.json){console.log(JSON.stringify({organizations:i,total:a},null,2));return}console.log(l.blue(`
|
|
176
|
+
Organizations (${a}):
|
|
177
|
+
`)),console.log(l.dim("\u2500".repeat(70)));for(let u of i){let d=u.planTier==="enterprise"?l.magenta:u.planTier==="enforcement"?l.yellow:u.planTier==="convenience"?l.cyan:l.gray;console.log(`${l.white(u.name)}`),console.log(` Plan: ${d(u.planTier)} | Seats: ${u.seatLimit===-1?"Unlimited":u.seatLimit} | Configs: ${u.totalConfigs}`),u.manualGrant&&(console.log(l.dim(` Manual grant by ${u.manualGrant.grantedBy} on ${new Date(u.manualGrant.grantedAt).toLocaleDateString()}`)),u.manualGrant.reason!=="Admin grant"&&console.log(l.dim(` Reason: ${u.manualGrant.reason}`))),console.log("")}console.log(l.dim("\u2500".repeat(70)));let c=i.reduce((u,d)=>(u[d.planTier]=(u[d.planTier]||0)+1,u),{});console.log(l.blue(`
|
|
178
|
+
Summary:`)),console.log(` Free: ${c.free||0} | Pro: ${c.pro||0} | Enterprise: ${c.enterprise||0}`),console.log("")}catch(o){n.fail(l.red("Failed to list organizations"));let s=o;console.error(l.red(s.message)),process.exit(1)}}),t}var G0=require("crypto"),st=require("fs"),yt=require("path");var ce=class{config;constructor(e){this.config=e}async getCurrentUser(){return(await(await this.fetch("/auth/me")).json()).user}async listOrganizations(){return(await(await this.fetch("/organizations")).json()).organizations}async getOrganization(e){return(await(await this.fetch(`/organizations/${e}`)).json()).organization}async scanOrganization(e){return await(await this.fetch(`/scan/${e}`,{method:"POST"})).json()}async downloadConfigs(e,n){let r=new URLSearchParams;n&&r.set("platform",n);let o=`/organizations/${e}/configs${r.toString()?"?"+r.toString():""}`;return(await(await this.fetch(o)).json()).configs.map(a=>({fileName:a.fileName,content:a.content,platform:a.platform,type:a.category,repoName:a.repoName}))}async testConnection(){try{let n=await(await this.fetch("/health")).json();return n.status==="ok"&&n.service==="gal-api"}catch{return!1}}async getPolicy(e){try{return(await(await this.fetch(`/policies/${e}`)).json()).policy}catch{return null}}async getOrgPolicy(e){try{return(await(await this.fetch(`/organizations/${e}/policy`)).json()).policy}catch{return null}}async fleetRegister(e,n){return await(await this.fetch(`/organizations/${e}/fleet/register`,{method:"POST",body:JSON.stringify(n)})).json()}async fleetHeartbeat(e){return await(await this.fetch("/fleet/heartbeat",{method:"POST",body:JSON.stringify(e)})).json()}async fleetStatus(e){return await(await this.fetch(`/fleet/developers/${e}/status`)).json()}async fleetList(e,n="all"){let r=new URLSearchParams;n!=="all"&&r.set("status",n);let o=`/organizations/${e}/fleet${r.toString()?"?"+r.toString():""}`;return await(await this.fetch(o)).json()}async fleetReport(e){return await(await this.fetch(`/organizations/${e}/fleet/report`)).json()}async fleetUnenroll(e){await this.fetch(`/fleet/developers/${e}`,{method:"DELETE"})}async getApprovedConfig(e,n){try{return await(await this.fetch(`/organizations/${e}/approved-config?platform=${n}`)).json()}catch(r){if(r.message?.includes("404"))return{approved:!1};throw r}}async getAllApprovedConfigs(e){try{return await(await this.fetch(`/organizations/${e}/approved-config?platform=all`)).json()}catch(n){if(n.message?.includes("404"))return{configs:{},available_platforms:[]};throw n}}async getHookSettings(e){try{return await(await this.fetch(`/organizations/${e}/hook-settings`)).json()}catch{return{globalIntervalMinutes:10,intervals:{}}}}async validateInvite(e){return await(await this.fetch(`/invites/${encodeURIComponent(e)}/validate`)).json()}async useInvite(e,n){return await(await this.fetch(`/invites/${encodeURIComponent(e)}/use`,{method:"POST",body:JSON.stringify(n)})).json()}async reportDeveloperStatus(e,n){return await(await this.fetch(`/organizations/${encodeURIComponent(e)}/developer-status`,{method:"POST",body:JSON.stringify(n)})).json()}async setApprovedConfig(e,n){return await(await this.fetch(`/organizations/${encodeURIComponent(e)}/approved-config`,{method:"PUT",body:JSON.stringify(n)})).json()}async fetch(e,n={}){if(!this.config.apiUrl)throw new Error("API URL not configured. Run: gal config set apiUrl <url>");let r=`${this.config.apiUrl}${e}`,o={"Content-Type":"application/json",...n.headers};this.config.authToken?o.Authorization=`Bearer ${this.config.authToken}`:this.config.apiKey&&(o.Authorization=`Bearer ${this.config.apiKey}`);let s=await fetch(r,{...n,headers:o});if(!s.ok){let i=`API request failed: ${s.status} ${s.statusText}`;try{let a=await s.json();a&&a.error&&(i=a.error)}catch{}throw new Error(i)}return s}};function yc(t,e=[]){if(!(0,st.existsSync)(t))return e;let n=(0,st.readdirSync)(t,{withFileTypes:!0});for(let r of n){let o=(0,yt.join)(t,r.name);r.isDirectory()?yc(o,e):r.name.endsWith(".md")&&e.push(o)}return e}function Kf(t){let e=t.match(/^---\s*\n([\s\S]*?)\n---/);if(e){let o=e[1].match(/description:\s*["']?([^"'\n]+)["']?/);if(o)return o[1].trim()}let n=t.match(/^#\s+(.+)$/m);return n?n[1].trim():t.split(`
|
|
179
|
+
`).find(o=>o.trim()&&!o.startsWith("#"))?.trim().slice(0,100)||"No description"}function W1(t){let e=(0,yt.join)(t,".claude","commands");return yc(e).map(r=>{let o=(0,st.readFileSync)(r,"utf-8");return{name:(0,yt.relative)(e,r).replace(/\.md$/,"").replace(/\//g,":"),description:Kf(o),content:o}})}function J1(t){let e=(0,yt.join)(t,".claude","agents");return yc(e).map(r=>{let o=(0,st.readFileSync)(r,"utf-8");return{name:(0,yt.relative)(e,r).replace(/\.md$/,"").replace(/\//g,":"),description:Kf(o),content:o}})}function Y1(t){let e=(0,yt.join)(t,"CLAUDE.md");return(0,st.existsSync)(e)?{content:(0,st.readFileSync)(e,"utf-8")}:null}function K1(t){let e=(0,yt.join)(t,".claude","settings.json");return(0,st.existsSync)(e)?{content:(0,st.readFileSync)(e,"utf-8")}:null}function z1(t){let e=(0,yt.join)(t,".claude","rules");return yc(e).map(r=>{let o=(0,st.readFileSync)(r,"utf-8");return{name:(0,yt.basename)(r,".md"),content:o}})}function Z1(t){let e=(0,yt.join)(t,".claude","skills");if(!(0,st.existsSync)(e))return[];let n=(0,st.readdirSync)(e,{withFileTypes:!0}),r=[];for(let o of n)if(o.isDirectory()){let s=(0,yt.join)(e,o.name,"SKILL.md");if((0,st.existsSync)(s)){let i=(0,st.readFileSync)(s,"utf-8");r.push({name:o.name,description:Kf(i),content:i})}}return r}function X1(t,e,n,r,o){let s=(0,G0.createHash)("sha256");return t.forEach(i=>s.update(i.content)),e.forEach(i=>s.update(i.content)),n.forEach(i=>s.update(i.content)),o.forEach(i=>s.update(i.content)),r&&s.update(r.content),s.digest("hex").slice(0,16)}function V0(){return new F("approve").description("Upload local configs to org approved config").option("-o, --org <name>","Organization name (default: from config)").option("-p, --platform <platform>","Platform to approve for","claude").option("-d, --dir <path>","Directory to read configs from",process.cwd()).option("--dry-run","Preview what would be uploaded without making changes").option("--commands-only","Only approve commands (no agents, CLAUDE.md, settings)").option("--agents-only","Only approve agents (no commands, CLAUDE.md, settings)").action(async e=>{console.log(l.blue(`
|
|
180
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL CLI - Approve Configs")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
181
|
+
`));let n=M.load();n.authToken||(console.log(l.red("Not authenticated. Run: gal auth login")),process.exit(1));let r=e.org||n.defaultOrg;r||(console.log(l.red("No organization specified. Use --org or set default org.")),process.exit(1));let o=e.platform||"claude";o!=="claude"&&console.log(l.yellow(` Note: approve reads from .claude only; using platform "claude" instead of "${o}".`));let s="claude",i=e.dir||process.cwd();console.log(l.dim(` Organization: ${r}`)),console.log(l.dim(` Platform: ${s}`)),console.log(l.dim(` Directory: ${i}`)),e.dryRun&&console.log(l.yellow(` Mode: DRY RUN (no changes will be made)
|
|
182
|
+
`)),console.log();let a=x("Reading local configs...").start();try{let c=e.agentsOnly?[]:W1(i),u=e.commandsOnly?[]:J1(i),d=e.commandsOnly||e.agentsOnly?[]:Z1(i),m=e.commandsOnly||e.agentsOnly?[]:z1(i),p=e.commandsOnly||e.agentsOnly?null:Y1(i),f=e.commandsOnly||e.agentsOnly?null:K1(i),g=X1(c,u,d,p,m),h=e.commandsOnly?" (commands only)":e.agentsOnly?" (agents only)":"";a.succeed(`Found ${c.length} commands, ${u.length} subagents, ${d.length} skills, ${m.length} rules${h}`),console.log(l.dim(`
|
|
183
|
+
Commands:`)),c.slice(0,10).forEach(D=>{console.log(l.dim(` /${D.name}`))}),c.length>10&&console.log(l.dim(` ... and ${c.length-10} more`)),console.log(l.dim(`
|
|
184
|
+
Subagents:`)),u.slice(0,10).forEach(D=>{console.log(l.dim(` \u{1F916} ${D.name}`))}),u.length>10&&console.log(l.dim(` ... and ${u.length-10} more`)),d.length>0&&(console.log(l.dim(`
|
|
185
|
+
Skills:`)),d.slice(0,5).forEach(D=>{console.log(l.dim(` \u26A1 ${D.name}`))}),d.length>5&&console.log(l.dim(` ... and ${d.length-5} more`))),m.length>0&&(console.log(l.dim(`
|
|
186
|
+
Rules:`)),m.slice(0,5).forEach(D=>{console.log(l.dim(` \u{1F4DC} ${D.name}`))}),m.length>5&&console.log(l.dim(` ... and ${m.length-5} more`))),p&&console.log(l.dim(`
|
|
187
|
+
CLAUDE.md: \u2713`)),f&&console.log(l.dim("settings.json: \u2713")),console.log(l.dim(`
|
|
188
|
+
Content hash: ${g}`)),e.dryRun&&(console.log(l.yellow(`
|
|
189
|
+
\u2713 Dry run complete. No changes made.
|
|
190
|
+
`)),process.exit(0));let y=x("Uploading to approved config...").start(),E=await new ce(n).setApprovedConfig(r,{platform:s,hash:g,commands:c,subagents:u,skills:d,rules:m,claudeMd:p,settings:f});y.succeed(l.green(`Approved config uploaded! Version: ${E.version}`)),console.log(l.green(`
|
|
191
|
+
\u2713 Configs approved successfully!
|
|
192
|
+
`)),console.log("Developers can now run:"),console.log(l.cyan(" gal sync --pull")),console.log(),process.exit(0)}catch(c){a.fail(l.red("Failed to approve configs")),console.error(l.red(c instanceof Error?c.message:String(c))),process.exit(1)}})}var bc=require("child_process"),ir=require("fs"),vc=class{organization;tokens=[];constructor(e){this.organization=e}async runAudit(){return console.log(l.blue(`
|
|
193
|
+
\u{1F510} GAL Token Security Audit
|
|
194
|
+
`)),await this.auditGitHubTokens(),await this.auditEnvironmentTokens(),await this.auditConfigFiles(),this.generateReport()}async auditGitHubTokens(){console.log(l.gray("Scanning GitHub tokens..."));try{(0,bc.execSync)("gh auth status",{stdio:"pipe"});let e=(0,bc.execSync)("gh auth status 2>&1",{encoding:"utf-8"}),n=e.includes("Logged in"),r=e.includes("Token expires");if(n){let o={id:"gh-cli-token",name:"GitHub CLI Token",type:"github",status:"active",risk:"low",scopes:this.extractScopes(e),recommendations:[]};(o.scopes?.includes("admin:org")||o.scopes?.includes("delete_repo"))&&(o.risk="high",o.recommendations.push("Token has admin privileges. Consider using more restricted scopes.")),r||(o.risk=o.risk==="low"?"medium":o.risk,o.recommendations.push("Token has no expiration. Set an expiration date for security.")),this.tokens.push(o)}try{let o=(0,bc.execSync)('gh api user/installations --paginate 2>/dev/null || echo "[]"',{encoding:"utf-8"}),s=JSON.parse(o||"[]");for(let i of s)this.tokens.push({id:`installation-${i.id}`,name:i.app_slug||"GitHub App",type:"github",status:"active",risk:"low",scopes:i.permissions?Object.keys(i.permissions):[],recommendations:[]})}catch{}}catch{console.log(l.yellow(" GitHub CLI not authenticated or not installed"))}}async auditEnvironmentTokens(){console.log(l.gray("Scanning environment variables..."));let e=[{pattern:/^GITHUB_TOKEN$/i,type:"github",name:"GitHub Token"},{pattern:/^GH_TOKEN$/i,type:"github",name:"GitHub Token (GH)"},{pattern:/^OPENAI_API_KEY$/i,type:"api_key",name:"OpenAI API Key"},{pattern:/^ANTHROPIC_API_KEY$/i,type:"api_key",name:"Anthropic API Key"},{pattern:/^FIREBASE_TOKEN$/i,type:"api_key",name:"Firebase Token"},{pattern:/^AWS_ACCESS_KEY_ID$/i,type:"api_key",name:"AWS Access Key"},{pattern:/^SLACK_TOKEN$/i,type:"api_key",name:"Slack Token"},{pattern:/^NPM_TOKEN$/i,type:"api_key",name:"NPM Token"},{pattern:/.*_API_KEY$/i,type:"api_key",name:"API Key"},{pattern:/.*_SECRET$/i,type:"api_key",name:"Secret"},{pattern:/.*_TOKEN$/i,type:"api_key",name:"Token"}];for(let n of Object.keys(process.env))for(let{pattern:r,type:o,name:s}of e)if(r.test(n)){let i=process.env[n]||"",a={id:`env-${n}`,name:`${s} (${n})`,type:o,status:i?"active":"unknown",risk:"medium",recommendations:[]};i.length<20&&(a.risk="low",a.recommendations.push("Token appears to be a placeholder or invalid")),(i.includes("xxx")||i.includes("placeholder")||i.includes("CHANGE"))&&(a.status="unknown",a.risk="low",a.recommendations.push("Token appears to be a placeholder")),this.tokens.push(a);break}}async auditConfigFiles(){console.log(l.gray("Scanning configuration files..."));let e=[".env",".env.local",".env.development",".env.production","config/secrets.json",".npmrc",".yarnrc"];for(let n of e)if((0,ir.existsSync)(n))try{let r=(0,ir.readFileSync)(n,"utf-8"),o=[{pattern:/ghp_[a-zA-Z0-9]{36}/g,type:"github",name:"GitHub PAT"},{pattern:/gho_[a-zA-Z0-9]{36}/g,type:"oauth",name:"GitHub OAuth"},{pattern:/github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}/g,type:"github",name:"GitHub Fine-grained PAT"},{pattern:/sk-[a-zA-Z0-9]{48}/g,type:"api_key",name:"OpenAI Key"},{pattern:/AKIA[0-9A-Z]{16}/g,type:"api_key",name:"AWS Key"},{pattern:/xox[baprs]-[0-9a-zA-Z]{10,48}/g,type:"api_key",name:"Slack Token"}];for(let{pattern:s,type:i,name:a}of o){let c=r.match(s)||[];for(let u of c)this.tokens.push({id:`file-${n}-${u.substring(0,10)}`,name:`${a} in ${n}`,type:i,status:"active",risk:"critical",recommendations:[`CRITICAL: Token found in ${n}`,"Move to environment variable immediately","Rotate this token as it may be compromised",`Add ${n} to .gitignore`]})}}catch{}}extractScopes(e){let n=e.match(/Token scopes: ([^\n]+)/);return n?n[1].split(",").map(r=>r.trim()):[]}generateReport(){let e=new Date,n=new Date(e.getTime()+30*24*60*60*1e3),r=this.tokens.filter(p=>p.status==="active"),o=this.tokens.filter(p=>p.status==="expired"),s=this.tokens.filter(p=>p.expiresAt&&p.expiresAt<=n&&p.expiresAt>e),i=this.tokens.filter(p=>p.lastUsed&&e.getTime()-p.lastUsed.getTime()>90*24*60*60*1e3),a=this.tokens.filter(p=>p.risk==="critical"),c=this.tokens.filter(p=>p.risk==="high"),u=this.tokens.filter(p=>p.risk==="critical"||p.risk==="high"||p.status==="expired"),d=[];a.length>0&&d.push(`\u26A0\uFE0F URGENT: ${a.length} tokens have critical security issues`),o.length>0&&d.push(`Remove or rotate ${o.length} expired tokens`),s.length>0&&d.push(`${s.length} tokens expire within 30 days`),i.length>0&&d.push(`Consider removing ${i.length} unused tokens (>90 days)`);let m=this.tokens.filter(p=>!p.expiresAt&&p.type==="github"&&p.status==="active");return m.length>0&&d.push(`${m.length} tokens have no expiration date set`),{timestamp:e,organization:this.organization,tokens:this.tokens,summary:{total:this.tokens.length,active:r.length,expired:o.length,expiringSoon:s.length,unused:i.length,critical:a.length,high:c.length,needsRotation:u.length},recommendations:d}}displayResults(e){console.log(l.white(`
|
|
195
|
+
`+"\u2550".repeat(60))),console.log(l.white.bold(" TOKEN AUDIT REPORT")),console.log(l.white("\u2550".repeat(60))),console.log(l.white.bold(`
|
|
196
|
+
\u{1F4CA} Summary:
|
|
197
|
+
`)),console.log(` Total tokens found: ${l.white(e.summary.total)}`),console.log(` Active: ${l.green(e.summary.active)}`),console.log(` Expired: ${l.red(e.summary.expired)}`),console.log(` Expiring soon: ${l.yellow(e.summary.expiringSoon)}`),console.log(` Unused (>90 days): ${l.gray(e.summary.unused)}`),console.log(` Critical risk: ${l.red.bold(e.summary.critical)}`),console.log(` High risk: ${l.yellow(e.summary.high)}`),console.log(` Needs rotation: ${l.red(e.summary.needsRotation)}`);let n=e.tokens.filter(o=>o.risk==="critical");if(n.length>0){console.log(l.red.bold(`
|
|
198
|
+
\u{1F6A8} CRITICAL ISSUES:
|
|
199
|
+
`));for(let o of n){console.log(l.red(` \u2022 ${o.name}`));for(let s of o.recommendations)console.log(l.gray(` \u2192 ${s}`))}}let r=e.tokens.filter(o=>o.risk==="high");if(r.length>0){console.log(l.yellow.bold(`
|
|
200
|
+
\u26A0\uFE0F HIGH RISK:
|
|
201
|
+
`));for(let o of r){console.log(l.yellow(` \u2022 ${o.name}`));for(let s of o.recommendations)console.log(l.gray(` \u2192 ${s}`))}}if(e.recommendations.length>0){console.log(l.blue.bold(`
|
|
202
|
+
\u{1F4A1} Recommendations:
|
|
203
|
+
`));for(let o of e.recommendations)console.log(l.blue(` \u2022 ${o}`))}console.log(l.white.bold(`
|
|
204
|
+
\u{1F4CB} All Tokens:
|
|
205
|
+
`)),console.log(l.gray(" Name Type Status Risk")),console.log(l.gray(" "+"\u2500".repeat(70)));for(let o of e.tokens){let s=o.name.substring(0,40).padEnd(40),i=o.type.padEnd(10),a=o.status.padEnd(9),c=o.risk,u={critical:l.red.bold,high:l.yellow,medium:l.blue,low:l.green}[c];console.log(` ${s} ${i} ${a} ${u(c)}`)}console.log(l.white(`
|
|
206
|
+
`+"\u2550".repeat(60)+`
|
|
207
|
+
`))}};function q0(){let t=new F("audit").description("Token security audit - review PATs and API keys");return t.command("tokens").description("Audit all tokens for security issues").option("--org <organization>","GitHub organization to audit").option("--report","Generate JSON report").option("--output <path>","Output path for report").action(async e=>{let n=new vc(e.org),r=await n.runAudit();if(n.displayResults(r),e.report){let o=e.output||"token-audit-report.json";(0,ir.writeFileSync)(o,JSON.stringify(r,null,2)),console.log(l.blue(`Report saved to: ${o}`))}r.summary.critical>0&&process.exit(1)}),t.command("rotate").description("Generate rotation plan for expiring tokens").action(async()=>{console.log(l.blue(`
|
|
208
|
+
\u{1F504} Token Rotation Plan
|
|
209
|
+
`)),console.log(l.gray("This feature generates a rotation schedule for tokens.")),console.log(l.gray("Run `gal audit tokens` first to identify tokens needing rotation.\n")),console.log(l.yellow("Rotation best practices:")),console.log(" 1. Generate new token before revoking old one"),console.log(" 2. Update all services using the token"),console.log(" 3. Verify services work with new token"),console.log(" 4. Revoke old token"),console.log(` 5. Document rotation in audit log
|
|
210
|
+
`)}),t.command("report").description("Generate comprehensive audit report").option("--format <format>","Output format (json, csv, markdown)","json").option("--output <path>","Output path").action(async e=>{let r=await new vc().runAudit(),o=e.output||`token-audit-${Date.now()}.${e.format}`;if(e.format==="json")(0,ir.writeFileSync)(o,JSON.stringify(r,null,2));else if(e.format==="markdown"){let s=Q1(r);(0,ir.writeFileSync)(o,s)}console.log(l.blue(`
|
|
211
|
+
Report saved to: ${o}
|
|
212
|
+
`))}),t}function Q1(t){return`# Token Security Audit Report
|
|
213
|
+
|
|
214
|
+
Generated: ${t.timestamp.toISOString()}
|
|
215
|
+
|
|
216
|
+
## Summary
|
|
217
|
+
|
|
218
|
+
| Metric | Count |
|
|
219
|
+
|--------|-------|
|
|
220
|
+
| Total Tokens | ${t.summary.total} |
|
|
221
|
+
| Active | ${t.summary.active} |
|
|
222
|
+
| Expired | ${t.summary.expired} |
|
|
223
|
+
| Expiring Soon | ${t.summary.expiringSoon} |
|
|
224
|
+
| Critical Risk | ${t.summary.critical} |
|
|
225
|
+
| High Risk | ${t.summary.high} |
|
|
226
|
+
| Needs Rotation | ${t.summary.needsRotation} |
|
|
227
|
+
|
|
228
|
+
## Recommendations
|
|
229
|
+
|
|
230
|
+
${t.recommendations.map(n=>`- ${n}`).join(`
|
|
231
|
+
`)}
|
|
232
|
+
|
|
233
|
+
## Token Details
|
|
234
|
+
|
|
235
|
+
| Name | Type | Status | Risk |
|
|
236
|
+
|------|------|--------|------|
|
|
237
|
+
${t.tokens.map(n=>`| ${n.name} | ${n.type} | ${n.status} | ${n.risk} |`).join(`
|
|
238
|
+
`)}
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
Generated by GAL Token Security Audit
|
|
242
|
+
`}var Y0=require("http"),Sc=require("child_process");var zf=require("os"),Le=require("fs"),Rn=require("path");var eO=process.env.GAL_API_URL||"http://localhost:3000";var OH=60*60*1e3;function H0(t,e){return`#!/usr/bin/env node
|
|
34
243
|
/**
|
|
35
244
|
* GAL Config Sync Hook for Claude Code (SessionStart only)
|
|
36
245
|
*
|
|
@@ -194,7 +403,7 @@ if (state.syncedFiles && state.syncedFiles.length > 0) {
|
|
|
194
403
|
|
|
195
404
|
// All good - show synced status with friendly reminder
|
|
196
405
|
showMessage(\`\u2705 GAL: You're good to go! Synced with \${state.organization}'s approved config (v\${state.version || 'latest'}).\`);
|
|
197
|
-
`}function
|
|
406
|
+
`}function W0(t,e=eO){return`#!/usr/bin/env node
|
|
198
407
|
/**
|
|
199
408
|
* GAL Config Enforcement Hook for Cursor IDE (beforeShellExecution)
|
|
200
409
|
* Blocks git commit/push when config is out of sync with org's approved version.
|
|
@@ -382,18 +591,18 @@ function main(hookInput) {
|
|
|
382
591
|
// All good - allow the git command
|
|
383
592
|
allow();
|
|
384
593
|
}
|
|
385
|
-
`}var
|
|
594
|
+
`}var _c=9876,K0="/callback";function nO(t){let e=process.platform;try{e==="darwin"?(0,Sc.execSync)(`open "${t}"`):e==="win32"?(0,Sc.execSync)(`start "" "${t}"`):(0,Sc.execSync)(`xdg-open "${t}"`)}catch{console.log(l.yellow(`
|
|
386
595
|
Could not open browser. Please visit:
|
|
387
596
|
${t}
|
|
388
|
-
`))}}function
|
|
597
|
+
`))}}function rO(t,e){let n=(0,Rn.join)((0,zf.homedir)(),".claude"),r=(0,Rn.join)(n,"hooks"),o=(0,Rn.join)(r,"gal-sync-reminder.js"),s=(0,Rn.join)(n,"settings.json");try{(0,Le.existsSync)(r)||(0,Le.mkdirSync)(r,{recursive:!0});let i=H0(t,e);(0,Le.writeFileSync)(o,i,"utf-8"),(0,Le.chmodSync)(o,"755");let a={};if((0,Le.existsSync)(s))try{a=JSON.parse((0,Le.readFileSync)(s,"utf-8"))}catch{}a.hooks||(a.hooks={}),a.hooks.SessionStart||(a.hooks.SessionStart=[]),a.hooks.UserPromptSubmit&&(a.hooks.UserPromptSubmit=a.hooks.UserPromptSubmit.filter(d=>d.hooks?(d.hooks=d.hooks.filter(m=>!m.command?.includes("gal-")&&!m.command?.includes("/gal/")),d.hooks.length>0):!0),a.hooks.UserPromptSubmit.length===0&&delete a.hooks.UserPromptSubmit);let c=`node ${o}`;return a.hooks.SessionStart.some(d=>d.hooks?.some(m=>m.command===c))||(a.hooks.SessionStart.push({hooks:[{type:"command",command:c}]}),(0,Le.writeFileSync)(s,JSON.stringify(a,null,2),"utf-8")),!0}catch{return!1}}function oO(t,e){let n=(0,Rn.join)((0,zf.homedir)(),".cursor"),r=(0,Rn.join)(n,"hooks"),o=(0,Rn.join)(r,"gal-shell-enforcement.js"),s=(0,Rn.join)(n,"hooks.json");try{(0,Le.existsSync)(r)||(0,Le.mkdirSync)(r,{recursive:!0});let i=W0(t,e);(0,Le.writeFileSync)(o,i,"utf-8"),(0,Le.chmodSync)(o,"755");let a={version:1,hooks:{}};if((0,Le.existsSync)(s))try{a=JSON.parse((0,Le.readFileSync)(s,"utf-8")),a.hooks||(a.hooks={})}catch{a={version:1,hooks:{}}}a.hooks.beforeShellExecution||(a.hooks.beforeShellExecution=[]);let c=`node ${o}`;return a.hooks.beforeShellExecution.some(d=>d.command===c)||(a.hooks.beforeShellExecution.push({command:c}),(0,Le.writeFileSync)(s,JSON.stringify(a,null,2),"utf-8")),!0}catch{return!1}}function sO(t=12e4){return new Promise((e,n)=>{let r=(0,Y0.createServer)((s,i)=>{let a=new URL(s.url||"",`http://localhost:${_c}`);if(a.pathname===K0){let c=a.searchParams.get("token"),u=a.searchParams.get("error"),d=a.searchParams.get("user");if(u){i.writeHead(200,{"Content-Type":"text/html"}),i.end(`
|
|
389
598
|
<html>
|
|
390
599
|
<body style="font-family: system-ui; padding: 40px; text-align: center;">
|
|
391
600
|
<h1 style="color: #dc2626;">\u274C Authentication Failed</h1>
|
|
392
|
-
<p>${
|
|
601
|
+
<p>${u}</p>
|
|
393
602
|
<p>You can close this window.</p>
|
|
394
603
|
</body>
|
|
395
604
|
</html>
|
|
396
|
-
`),
|
|
605
|
+
`),r.close(),n(new Error(u));return}if(c){i.writeHead(200,{"Content-Type":"text/html"}),i.end(`
|
|
397
606
|
<html>
|
|
398
607
|
<body style="font-family: system-ui; padding: 40px; text-align: center;">
|
|
399
608
|
<h1 style="color: #00FF41;">\u2705 Authentication Successful</h1>
|
|
@@ -401,31 +610,880 @@ ${t}
|
|
|
401
610
|
<p>You can close this window and return to the terminal.</p>
|
|
402
611
|
</body>
|
|
403
612
|
</html>
|
|
404
|
-
`),
|
|
405
|
-
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(
|
|
406
|
-
`));let e=
|
|
407
|
-
`))
|
|
408
|
-
Logged in as:`)),console.log(` User: ${
|
|
409
|
-
User details not available.`));let
|
|
613
|
+
`),r.close();let m=null;if(d)try{m=JSON.parse(decodeURIComponent(d))}catch{}e({token:c,user:m});return}i.writeHead(400,{"Content-Type":"text/plain"}),i.end("Missing token");return}i.writeHead(404,{"Content-Type":"text/plain"}),i.end("Not found")});r.listen(_c,()=>{});let o=setTimeout(()=>{r.close(),n(new Error("Authentication timed out. Please try again."))},t);r.on("close",()=>{clearTimeout(o)}),r.on("error",s=>{s.code==="EADDRINUSE"?n(new Error(`Port ${_c} is in use. Close other GAL auth processes and try again.`)):n(s)})})}function iO(){let t=new F("auth").description("Manage GitHub authentication");return t.command("login").description("Authenticate with GitHub OAuth").action(async()=>{console.log(l.blue(`
|
|
614
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL CLI - GitHub Authentication")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
615
|
+
`));let e=M.load(),n=e.apiUrl||process.env.GAL_API_URL||(()=>{throw new Error("API URL not configured. This should never happen.")})();if(e.authToken){let o=new ce(e);try{let s=await o.getCurrentUser();console.log(l.yellow(`Already logged in as ${l.bold(s.login)}`)),console.log(l.dim(`Use "gal auth logout" first to switch accounts.
|
|
616
|
+
`));return}catch{}}let r=x("Starting authentication...").start();try{let o=`http://localhost:${_c}${K0}`,s=`${n}/auth/github?redirect=${encodeURIComponent(o)}&source=cli&force_select=true`;r.text="Opening browser for GitHub authentication...";let i=sO();nO(s),r.text="Waiting for authentication (check your browser)...";let{token:a,user:c}=await i;r.succeed(l.green("Authentication successful!")),Ff(!0),e.authToken=a,c?(e.defaultOrg=c.organizations?.[0]||void 0,console.log(l.blue(`
|
|
617
|
+
Logged in as:`)),console.log(` User: ${l.bold(c.login)}`),console.log(` Name: ${c.name||l.dim("(not set)")}`),console.log(` Email: ${c.email||l.dim("(not set)")}`),c.organizations?.length&&(console.log(` Organizations: ${c.organizations.join(", ")}`),console.log(` Default org: ${l.bold(e.defaultOrg)}`))):console.log(l.dim(`
|
|
618
|
+
User details not available.`));let u=e.defaultOrg||"your-organization",d=rO(u,n),m=oO(u,n);if((d||m)&&(console.log(l.dim(" \u2713 Sync reminder hooks installed:")),d&&console.log(l.dim(" - Claude Code (~/.claude/hooks/)")),m&&console.log(l.dim(" - Cursor IDE (~/.cursor/hooks/)"))),M.save(e),e.defaultOrg)try{let p=new ce(e),f=await Promise.resolve().then(()=>H(J0(),1));await p.reportDeveloperStatus(e.defaultOrg,{cliInstalled:!0,cliVersion:f.version,authenticated:!0,authExpiresAt:new Date(Date.now()+7*24*60*60*1e3).toISOString()})}catch{console.log(l.dim(" \u26A0 Could not report status to dashboard"))}console.log(l.green(`
|
|
410
619
|
\u2713 Credentials saved!
|
|
411
|
-
`)),console.log("Next steps:"),console.log(` ${
|
|
412
|
-
`),process.exit(0)}catch(
|
|
413
|
-
Not authenticated.`)),console.log(
|
|
414
|
-
`))
|
|
620
|
+
`)),console.log("Next steps:"),console.log(` ${l.cyan("gal sync --pull")} - Pull org-approved config`),console.log(` ${l.cyan("gal auth status")} - Check auth status
|
|
621
|
+
`),process.exit(0)}catch(o){r.fail(l.red("Authentication failed"));let s=o instanceof Error?o:new Error(String(o));Ff(!1,s),console.error(l.red(s.message)),await Hs("auth login",s),process.exit(1)}}),t.command("status").description("Show current authentication status").option("--json","Output as JSON (for extension/script integration)").action(async e=>{let n=M.load();if(e.json){if(!n.authToken){console.log(JSON.stringify({authenticated:!1,expired:!1,user:null,organizations:[]}));return}try{let s=await new ce(n).getCurrentUser();console.log(JSON.stringify({authenticated:!0,expired:!1,user:s.login,email:s.email,name:s.name,organizations:s.organizations||[],defaultOrg:n.defaultOrg,apiUrl:n.apiUrl||Ze}))}catch{console.log(JSON.stringify({authenticated:!1,expired:!0,user:null,organizations:[]}))}return}if(!n.authToken){console.log(l.yellow(`
|
|
622
|
+
Not authenticated.`)),console.log(l.dim(`Run: gal auth login
|
|
623
|
+
`));return}let r=x("Checking authentication...").start();try{let s=await new ce(n).getCurrentUser();r.stop(),console.log(l.green(`
|
|
415
624
|
\u2713 Authenticated
|
|
416
|
-
`)),console.log(` User: ${
|
|
417
|
-
`)),process.exit(
|
|
625
|
+
`)),console.log(` User: ${l.bold(s.login)}`),console.log(` Name: ${s.name||l.dim("(not set)")}`),console.log(` Email: ${s.email||l.dim("(not set)")}`),s.organizations?.length&&console.log(` Organizations: ${s.organizations.join(", ")}`),n.defaultOrg&&console.log(` Default org: ${l.bold(n.defaultOrg)}`),console.log(` API: ${n.apiUrl}`),console.log(),process.exit(0)}catch{r.fail(l.red("Token invalid or expired")),console.log(l.dim(`Run: gal auth login
|
|
626
|
+
`)),process.exit(1)}}),t.command("logout").description("Clear saved credentials").action(()=>{let e=M.load();if(!e.authToken){console.log(l.yellow(`
|
|
418
627
|
Not logged in.
|
|
419
|
-
`))
|
|
628
|
+
`));return}delete e.authToken,delete e.defaultOrg,M.save(e),console.log(l.green(`
|
|
420
629
|
\u2713 Logged out successfully.
|
|
421
|
-
`))
|
|
630
|
+
`))}),t}var bt=require("fs"),mn=require("path"),wc=require("child_process"),aO=[{name:"AWS Access Key",pattern:/AKIA[0-9A-Z]{16}/g,severity:"critical",suggestion:"Remove AWS key and use AWS credentials file or environment variables"},{name:"GitHub Token",pattern:/ghp_[a-zA-Z0-9]{36}/g,severity:"critical",suggestion:"Remove GitHub token and use GITHUB_TOKEN environment variable"},{name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z]{10,48}/g,severity:"critical",suggestion:"Remove Slack token and use SLACK_TOKEN environment variable"},{name:"OpenAI API Key",pattern:/sk-[a-zA-Z0-9]{48}/g,severity:"critical",suggestion:"Remove OpenAI key and use OPENAI_API_KEY environment variable"},{name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA )?PRIVATE KEY-----/g,severity:"critical",suggestion:"Never commit private keys. Use secret management tools"},{name:"Generic API Key",pattern:/(?:api[_-]?key|apikey)\s*[:=]\s*['"]?([a-zA-Z0-9_\-]{20,})['"]?/gi,severity:"high",suggestion:"Move API key to environment variable"},{name:"Password in Config",pattern:/(?:password|passwd|pwd)\s*[:=]\s*['"]?([^\s'"]{8,})['"]?/gi,severity:"high",suggestion:"Never hardcode passwords. Use secret management"},{name:"Firebase Config",pattern:/(?:firebase|FIREBASE)[_-]?(?:key|KEY|apiKey|API_KEY)\s*[:=]\s*['"]?([^\s'"]{20,})['"]?/gi,severity:"high",suggestion:"Move Firebase config to environment variables"}],cO=[{name:"Dangerous rm command",pattern:/rm\s+-rf\s+[\/~]/g,severity:"critical",suggestion:"Avoid recursive force delete from root. Use specific paths with safeguards"},{name:"World-writable permissions",pattern:/chmod\s+777/g,severity:"high",suggestion:"Use restrictive permissions (755 for dirs, 644 for files)"},{name:"Pipe to shell",pattern:/curl\s+.*\|\s*(?:bash|sh)/g,severity:"high",suggestion:"Download scripts first, review, then execute"},{name:"Sudo in scripts",pattern:/sudo\s+/g,severity:"medium",suggestion:"Avoid sudo in automated scripts. Configure proper permissions"},{name:"Eval usage",pattern:/eval\s+/g,severity:"medium",suggestion:"Avoid eval. Use safer alternatives for dynamic code execution"}],lO=[{pattern:/\.env\.local$/i,message:"Local environment files should not be committed"},{pattern:/\.env\.production$/i,message:"Production environment files should not be committed"},{pattern:/credentials\.json$/i,message:"Credential files should not be committed"},{pattern:/\.pem$/i,message:"Certificate files should not be committed"},{pattern:/id_rsa$/i,message:"SSH private keys should not be committed"},{pattern:/\.p12$/i,message:"Certificate files should not be committed"}],Zf=class{projectPath;issues=[];interactive;autoFix;constructor(e,n={}){this.projectPath=e,this.interactive=n.interactive||!1,this.autoFix=n.autoFix||!1}async runAllChecks(){console.log(l.blue(`
|
|
631
|
+
\u{1F50D} GAL Pre-Enforcement Check
|
|
632
|
+
`)),console.log(l.gray(`Scanning: ${this.projectPath}
|
|
633
|
+
`));let e=this.getFilesToCheck();await this.checkForSecrets(e),await this.checkForDangerousCommands(e),await this.checkForbiddenFiles(e),await this.checkAgentConfigs(),await this.checkMissingTests(e);let n=this.generateReport();return this.displayResults(n),this.autoFix&&n.issues.some(r=>r.autoFixable)&&await this.applyAutoFixes(),n}getFilesToCheck(){try{let e=(0,wc.execSync)("git diff --cached --name-only",{cwd:this.projectPath,encoding:"utf-8"}).trim();return e?e.split(`
|
|
634
|
+
`).filter(r=>r.trim()):(0,wc.execSync)("git ls-files",{cwd:this.projectPath,encoding:"utf-8"}).trim().split(`
|
|
635
|
+
`).filter(r=>r.trim()).slice(0,500)}catch{return this.scanDirectory(this.projectPath)}}scanDirectory(e,n=3){let r=[],o=["node_modules",".git","dist","build",".next","coverage"],s=(i,a)=>{if(!(a>n))try{let c=(0,bt.readdirSync)(i,{withFileTypes:!0});for(let u of c){let d=(0,mn.join)(i,u.name),m=(0,mn.relative)(this.projectPath,d);u.isDirectory()?o.includes(u.name)||s(d,a+1):u.isFile()&&r.push(m)}}catch{}};return s(e,0),r.slice(0,500)}async checkForSecrets(e){for(let n of e){let r=(0,mn.join)(this.projectPath,n);if(!(!(0,bt.existsSync)(r)||!this.isTextFile(r)))try{let o=(0,bt.readFileSync)(r,"utf-8"),s=o.split(`
|
|
636
|
+
`);for(let{name:i,pattern:a,severity:c,suggestion:u}of aO){a.lastIndex=0;let d;for(;(d=a.exec(o))!==null;){let p=o.substring(0,d.index).split(`
|
|
637
|
+
`).length;this.isFalsePositive(d[0],s[p-1])||this.issues.push({severity:c,type:"secret",message:`${i} detected`,file:n,line:p,suggestion:u,autoFixable:!1})}}}catch{}}}async checkForDangerousCommands(e){let n=[".sh",".bash",".zsh",".ps1",".bat",".cmd"];for(let r of e){let o=(0,mn.join)(this.projectPath,r);if(!(0,bt.existsSync)(o))continue;let s=n.some(a=>r.endsWith(a)),i=r.includes("hook")||r.includes("command");if(!(!s&&!i))try{let a=(0,bt.readFileSync)(o,"utf-8");for(let{name:c,pattern:u,severity:d,suggestion:m}of cO){u.lastIndex=0;let p;for(;(p=u.exec(a))!==null;){let g=a.substring(0,p.index).split(`
|
|
638
|
+
`).length;this.issues.push({severity:d,type:"dangerous_command",message:c,file:r,line:g,suggestion:m,autoFixable:!1})}}}catch{}}}async checkForbiddenFiles(e){for(let n of e)for(let{pattern:r,message:o}of lO)r.test(n)&&this.issues.push({severity:"critical",type:"forbidden_file",message:o,file:n,suggestion:`Add ${n} to .gitignore and remove from staging`,autoFixable:!0,autoFix:()=>{(0,wc.execSync)(`git reset HEAD "${n}"`,{cwd:this.projectPath})}})}async checkAgentConfigs(){let e=[".claude",".cursor",".gemini",".codex",".windsurf"];for(let n of e){let r=(0,mn.join)(this.projectPath,n);if(!(0,bt.existsSync)(r))continue;let o=this.scanDirectory(r,2);for(let s of o){let i=(0,mn.join)(this.projectPath,s);if((0,bt.existsSync)(i))try{let a=(0,bt.readFileSync)(i,"utf-8");(a.includes('"allowAll": true')||a.includes("allowAll: true"))&&this.issues.push({severity:"high",type:"config_security",message:"Overly permissive agent configuration",file:s,suggestion:'Remove "allowAll: true" and specify explicit permissions',autoFixable:!1}),s.includes("settings")&&!a.includes("sandbox")&&this.issues.push({severity:"medium",type:"config_security",message:"Agent configuration missing sandbox settings",file:s,suggestion:"Add sandbox configuration for safer agent execution",autoFixable:!1})}catch{}}}}async checkMissingTests(e){let n=e.filter(r=>(r.endsWith(".ts")||r.endsWith(".tsx")||r.endsWith(".js")||r.endsWith(".jsx"))&&!r.includes(".test.")&&!r.includes(".spec.")&&!r.includes("__tests__")&&r.includes("src/"));for(let r of n)[r.replace(/\.(ts|tsx|js|jsx)$/,".test.$1"),r.replace(/\.(ts|tsx|js|jsx)$/,".spec.$1"),r.replace("src/","src/__tests__/").replace(/\.(ts|tsx|js|jsx)$/,".test.$1")].some(i=>(0,bt.existsSync)((0,mn.join)(this.projectPath,i)))||this.issues.push({severity:"low",type:"missing_test",message:"No test file found for source file",file:r,suggestion:`Create test file: ${r.replace(/\.(ts|tsx|js|jsx)$/,".test.$1")}`,autoFixable:!1})}isTextFile(e){return[".ts",".tsx",".js",".jsx",".json",".md",".yaml",".yml",".env",".sh",".bash",".zsh",".py",".rb",".go",".rs",".java",".kt",".swift",".dart",".xml",".html",".css",".scss",".less",".sql",".graphql",".toml",".ini",".cfg"].some(r=>e.endsWith(r))||e.includes(".env")}isFalsePositive(e,n){return[/YOUR_API_KEY/i,/PLACEHOLDER/i,/EXAMPLE/i,/CHANGE_ME/i,/REPLACE_WITH/i,/\$\{/,/\{\{/,/<.*>/,/process\.env/,/getenv/i,/os\.environ/i].some(o=>o.test(e)||o.test(n))}generateReport(){let e={critical:this.issues.filter(n=>n.severity==="critical").length,high:this.issues.filter(n=>n.severity==="high").length,medium:this.issues.filter(n=>n.severity==="medium").length,low:this.issues.filter(n=>n.severity==="low").length,total:this.issues.length,blocked:this.issues.some(n=>n.severity==="critical")};return{timestamp:new Date,projectPath:this.projectPath,issues:this.issues,summary:e}}displayResults(e){let{issues:n,summary:r}=e,o=n.filter(u=>u.severity==="critical"),s=n.filter(u=>u.severity==="high"),i=n.filter(u=>u.severity==="medium"),a=n.filter(u=>u.severity==="low");if(o.length>0){console.log(l.red.bold(`
|
|
639
|
+
\u274C CRITICAL Issues (Will Block Commit):
|
|
640
|
+
`));for(let u of o)this.displayIssue(u,l.red)}if(s.length>0){console.log(l.yellow.bold(`
|
|
641
|
+
\u26A0\uFE0F HIGH Severity Issues:
|
|
642
|
+
`));for(let u of s)this.displayIssue(u,l.yellow)}if(i.length>0){console.log(l.blue.bold(`
|
|
643
|
+
\u2139\uFE0F MEDIUM Severity Issues:
|
|
644
|
+
`));for(let u of i)this.displayIssue(u,l.blue)}if(a.length>0){console.log(l.gray.bold(`
|
|
645
|
+
\u{1F4DD} LOW Severity (Recommendations):
|
|
646
|
+
`));for(let u of a.slice(0,5))this.displayIssue(u,l.gray);a.length>5&&console.log(l.gray(` ... and ${a.length-5} more recommendations
|
|
647
|
+
`))}console.log(l.white(`
|
|
648
|
+
`+"\u2500".repeat(60))),console.log(l.white.bold(`
|
|
649
|
+
\u{1F4CA} Summary:
|
|
650
|
+
`)),console.log(` ${l.red(`Critical: ${r.critical}`)}`),console.log(` ${l.yellow(`High: ${r.high}`)}`),console.log(` ${l.blue(`Medium: ${r.medium}`)}`),console.log(` ${l.gray(`Low: ${r.low}`)}`),console.log(` ${l.white(`Total: ${r.total}`)}`),r.blocked?(console.log(l.red.bold(`
|
|
651
|
+
\u{1F6AB} COMMIT WILL BE BLOCKED`)),console.log(l.red(`Fix critical issues before committing.
|
|
652
|
+
`))):r.high>0?(console.log(l.yellow.bold(`
|
|
653
|
+
\u26A0\uFE0F COMMIT ALLOWED WITH WARNINGS`)),console.log(l.yellow(`Consider fixing high severity issues.
|
|
654
|
+
`))):(console.log(l.green.bold(`
|
|
655
|
+
\u2705 ALL CHECKS PASSED`)),console.log(l.green(`Ready to commit!
|
|
656
|
+
`)));let c=n.filter(u=>u.autoFixable);c.length>0&&console.log(l.cyan(`\u{1F4A1} ${c.length} issues can be auto-fixed. Run: gal check --fix
|
|
657
|
+
`))}displayIssue(e,n){let r=e.line?`${e.file}:${e.line}`:e.file;console.log(n(` ${e.message}`)),console.log(l.gray(` File: ${r}`)),console.log(l.gray(` \u2192 ${e.suggestion}`)),e.autoFixable&&console.log(l.cyan(" \u2192 Auto-fixable")),console.log("")}async applyAutoFixes(){let e=this.issues.filter(n=>n.autoFixable&&n.autoFix);if(e.length!==0){console.log(l.cyan(`
|
|
658
|
+
\u{1F527} Applying ${e.length} auto-fixes...
|
|
659
|
+
`));for(let n of e)try{n.autoFix(),console.log(l.green(` \u2713 Fixed: ${n.message} in ${n.file}`))}catch(r){console.log(l.red(` \u2717 Failed: ${n.message} - ${r.message}`))}console.log(l.cyan(`
|
|
660
|
+
\u2705 Auto-fixes applied. Please review changes.
|
|
661
|
+
`))}}};function z0(){return new F("check").description("Pre-enforcement check - see what issues will block your commit").option("--fix","Auto-fix issues where possible").option("--interactive","Interactive mode to review issues").option("--report","Generate detailed JSON report").option("--path <path>","Project path to check",process.cwd()).action(async e=>{let r=await new Zf(e.path,{interactive:e.interactive,autoFix:e.fix}).runAllChecks();if(e.report){let o=(0,mn.join)(e.path,"gal-check-report.json");(0,bt.writeFileSync)(o,JSON.stringify(r,null,2)),console.log(l.blue(`Report saved to: ${o}`))}r.summary.blocked&&process.exit(1)})}var em=require("node:fs/promises");var Br=[{id:"soc2-cc6.1",framework:"soc2",category:"Access Control",name:"Logical Access Security",description:"AI agents must have defined access controls and permissions",severity:"critical",checkFunction:"checkAccessControls"},{id:"soc2-cc6.2",framework:"soc2",category:"Access Control",name:"Authentication Controls",description:"AI agent configurations must require authentication",severity:"high",checkFunction:"checkAuthentication"},{id:"soc2-cc6.6",framework:"soc2",category:"Access Control",name:"Privileged Access",description:"AI agents must not have unnecessary privileged access",severity:"critical",checkFunction:"checkPrivilegedAccess"},{id:"soc2-cc7.1",framework:"soc2",category:"System Operations",name:"Configuration Management",description:"AI agent configurations must be version controlled",severity:"high",checkFunction:"checkVersionControl"},{id:"soc2-cc7.2",framework:"soc2",category:"System Operations",name:"Security Monitoring",description:"AI agent activities must be monitored and logged",severity:"high",checkFunction:"checkAuditLogging"},{id:"soc2-cc8.1",framework:"soc2",category:"Change Management",name:"Change Authorization",description:"Configuration changes must be authorized and documented",severity:"medium",checkFunction:"checkChangeManagement"},{id:"gdpr-art5.1c",framework:"gdpr",category:"Data Minimization",name:"Data Minimization",description:"AI agents must only process necessary data",severity:"high",checkFunction:"checkDataMinimization"},{id:"gdpr-art5.1f",framework:"gdpr",category:"Security",name:"Data Security",description:"AI agents must protect processed data",severity:"critical",checkFunction:"checkDataSecurity"},{id:"gdpr-art17",framework:"gdpr",category:"Data Rights",name:"Right to Erasure",description:"AI-generated content must be erasable",severity:"high",checkFunction:"checkDataErasure"},{id:"gdpr-art30",framework:"gdpr",category:"Documentation",name:"Processing Records",description:"AI processing activities must be documented",severity:"medium",checkFunction:"checkProcessingRecords"},{id:"gdpr-art32",framework:"gdpr",category:"Security",name:"Security Measures",description:"Appropriate security measures must be implemented",severity:"critical",checkFunction:"checkSecurityMeasures"},{id:"gdpr-art44",framework:"gdpr",category:"Data Transfer",name:"Cross-Border Transfer",description:"Data transfers outside EU must be controlled",severity:"high",checkFunction:"checkCrossBorderTransfer"},{id:"iso27001-a5.1",framework:"iso27001",category:"Policy",name:"Information Security Policy",description:"AI agent policies must be documented",severity:"high",checkFunction:"checkSecurityPolicy"},{id:"iso27001-a8.1",framework:"iso27001",category:"Asset Management",name:"Asset Inventory",description:"AI agent configurations must be inventoried",severity:"medium",checkFunction:"checkAssetInventory"},{id:"iso27001-a9.1",framework:"iso27001",category:"Access Control",name:"Access Control Policy",description:"AI agent access must follow defined policy",severity:"high",checkFunction:"checkAccessPolicy"},{id:"iso27001-a12.4",framework:"iso27001",category:"Operations",name:"Logging and Monitoring",description:"AI agent activities must be logged",severity:"high",checkFunction:"checkLogging"},{id:"iso27001-a14.2",framework:"iso27001",category:"Development",name:"Secure Development",description:"AI-assisted development must follow secure practices",severity:"high",checkFunction:"checkSecureDevelopment"},{id:"iso27001-a18.1",framework:"iso27001",category:"Compliance",name:"Compliance Review",description:"Regular compliance reviews must be conducted",severity:"medium",checkFunction:"checkComplianceReview"},{id:"hipaa-164.308.a1",framework:"hipaa",category:"Administrative",name:"Security Management",description:"Security management process for AI agents",severity:"critical",checkFunction:"checkSecurityManagement"},{id:"hipaa-164.308.a3",framework:"hipaa",category:"Administrative",name:"Workforce Security",description:"AI agent access authorization procedures",severity:"high",checkFunction:"checkWorkforceSecurity"},{id:"hipaa-164.308.a4",framework:"hipaa",category:"Administrative",name:"Access Management",description:"Information access management for AI agents",severity:"critical",checkFunction:"checkAccessManagement"},{id:"hipaa-164.312.a1",framework:"hipaa",category:"Technical",name:"Access Control",description:"Technical access controls for AI agents",severity:"critical",checkFunction:"checkTechnicalAccessControl"},{id:"hipaa-164.312.b",framework:"hipaa",category:"Technical",name:"Audit Controls",description:"Hardware/software audit controls",severity:"high",checkFunction:"checkAuditControls"},{id:"hipaa-164.312.c1",framework:"hipaa",category:"Technical",name:"Integrity Controls",description:"Data integrity controls for AI processing",severity:"high",checkFunction:"checkIntegrityControls"}];function Ec(t){return Br.filter(e=>e.framework===t)}var Xs=class{orgId;constructor(e){this.orgId=e}async evaluateCompliance(e,n=["soc2","gdpr","iso27001","hipaa"]){let r=[],o=[];for(let c of n){let u=await this.evaluateFramework(c,e);r.push(...u);let d=this.calculateFrameworkScore(c,u);o.push(d)}let s=this.calculateOverallScore(o),i=this.generateSummary(r),a=this.generateRecommendations(r);return{id:`compliance-${Date.now()}`,orgId:this.orgId,generatedAt:new Date().toISOString(),frameworks:n,scores:o,overallScore:s,checks:r,summary:i,recommendations:a}}async evaluateFramework(e,n){let r=Ec(e),o=[];for(let s of r){let i=await this.evaluateRequirement(s.id,s.checkFunction,n);o.push(i)}return o}async evaluateRequirement(e,n,r){let o=[],s=[],i=!0,a=100;switch(n){case"checkAccessControls":({passed:i,score:a}=this.checkAccessControls(r,o,s));break;case"checkAuthentication":({passed:i,score:a}=this.checkAuthentication(r,o,s));break;case"checkPrivilegedAccess":({passed:i,score:a}=this.checkPrivilegedAccess(r,o,s));break;case"checkVersionControl":({passed:i,score:a}=this.checkVersionControl(r,o,s));break;case"checkAuditLogging":({passed:i,score:a}=this.checkAuditLogging(r,o,s));break;case"checkDataSecurity":({passed:i,score:a}=this.checkDataSecurity(r,o,s));break;case"checkSecurityMeasures":({passed:i,score:a}=this.checkSecurityMeasures(r,o,s));break;default:s.push("Check not yet implemented - manual review required"),a=50}return{requirementId:e,passed:i,score:a,findings:o,evidence:s,remediation:i?void 0:this.getRemediation(e)}}checkAccessControls(e,n,r){let o=100,s=!0;for(let i of e)i.settings?.allowedTools?r.push(`${i.platform}: allowed-tools configured`):(n.push({type:"warning",message:`${i.platform}: No allowed-tools restrictions defined`,location:i.path,timestamp:new Date().toISOString()}),o-=20),i.hooks?.some(a=>a.type==="pre_tool_use")?r.push(`${i.platform}: pre-tool-use hook enabled`):(n.push({type:"violation",message:`${i.platform}: No pre-tool-use access control hook`,location:i.path,timestamp:new Date().toISOString()}),o-=30,s=!1);return{passed:s,score:Math.max(0,o)}}checkAuthentication(e,n,r){let o=100,s=!0;for(let i of e)if(i.mcpServers&&i.mcpServers.length>0)for(let a of i.mcpServers)!a.env||!Object.keys(a.env).some(c=>c.includes("TOKEN")||c.includes("KEY"))?n.push({type:"info",message:`${i.platform}: MCP server '${a.name}' may lack authentication`,location:i.path,timestamp:new Date().toISOString()}):r.push(`${i.platform}: MCP '${a.name}' has auth configured`);return{passed:s,score:o}}checkPrivilegedAccess(e,n,r){let o=100,s=!0,i=["sudo","root","admin","chmod 777","--privileged"];for(let a of e)if(a.commands)for(let c of a.commands)for(let u of i)c.content.toLowerCase().includes(u)&&(n.push({type:"violation",message:`${a.platform}: Command '${c.name}' contains privileged pattern: ${u}`,location:c.path,timestamp:new Date().toISOString()}),o-=25,s=!1);return s&&r.push("No privileged access patterns detected in commands"),{passed:s,score:Math.max(0,o)}}checkVersionControl(e,n,r){return r.push("Configuration files are in version-controlled repository"),{passed:!0,score:100}}checkAuditLogging(e,n,r){let o=100,s=!0;for(let i of e)i.hooks?.some(c=>c.type==="session_start"||c.type==="session_end")?r.push(`${i.platform}: Session hooks enabled for audit logging`):(n.push({type:"warning",message:`${i.platform}: No session hooks for audit logging`,location:i.path,timestamp:new Date().toISOString()}),o-=15);return{passed:s,score:Math.max(0,o)}}checkDataSecurity(e,n,r){let o=100,s=!0;for(let i of e)if(i.mcpServers){for(let a of i.mcpServers)if(a.env)for(let[c,u]of Object.entries(a.env))this.looksLikeSecret(c)&&u&&!u.startsWith("${")&&(n.push({type:"violation",message:`${i.platform}: Hardcoded secret in MCP '${a.name}': ${c}`,location:i.path,timestamp:new Date().toISOString()}),o-=40,s=!1)}return s&&r.push("No hardcoded secrets detected"),{passed:s,score:Math.max(0,o)}}checkSecurityMeasures(e,n,r){let o=100;for(let s of e){let i=s.hooks?.some(c=>c.type==="pre_tool_use"),a=s.hooks?.some(c=>c.type==="post_tool_use");i?(r.push(`${s.platform}: Pre-tool security hook enabled`),o=Math.min(o,100)):o-=20,a&&r.push(`${s.platform}: Post-tool security hook enabled`)}return{passed:o>=60,score:Math.max(0,o)}}looksLikeSecret(e){return[/API_KEY/i,/SECRET/i,/TOKEN/i,/PASSWORD/i,/CREDENTIAL/i,/PRIVATE/i].some(r=>r.test(e))}calculateFrameworkScore(e,n){let r=n.filter(c=>c.requirementId.startsWith(e)),o=r.reduce((c,u)=>c+u.score,0),s=r.length>0?o/r.length:0,i={},a={critical:0,high:0,medium:0,low:0};for(let c of r){let u=Br.find(d=>d.id===c.requirementId);u&&(i[u.category]||(i[u.category]=0),i[u.category]+=c.score,c.passed||a[u.severity]++)}return{framework:e,overallScore:Math.round(s),categoryScores:i,passedChecks:r.filter(c=>c.passed).length,totalChecks:r.length,criticalViolations:a.critical,highViolations:a.high,mediumViolations:a.medium,lowViolations:a.low}}calculateOverallScore(e){if(e.length===0)return 0;let n=e.reduce((r,o)=>r+o.overallScore,0);return Math.round(n/e.length)}generateSummary(e){return{totalRequirements:e.length,compliant:e.filter(n=>n.score>=80).length,nonCompliant:e.filter(n=>n.score<50).length,partiallyCompliant:e.filter(n=>n.score>=50&&n.score<80).length,notApplicable:0}}generateRecommendations(e){let n=[],r=e.filter(o=>!o.passed);return r.some(o=>o.requirementId.includes("access"))&&n.push("Implement pre-tool-use hooks for access control enforcement"),r.some(o=>o.requirementId.includes("audit")||o.requirementId.includes("log"))&&n.push("Enable session hooks for comprehensive audit logging"),r.some(o=>o.findings.some(s=>s.message.includes("secret")))&&n.push("Remove hardcoded secrets and use environment variable references"),r.some(o=>o.findings.some(s=>s.message.includes("privileged")))&&n.push("Remove privileged access patterns from AI agent commands"),n.length===0&&n.push("Continue maintaining current security posture"),n}getRemediation(e){return{"soc2-cc6.1":"Run: gal enforce install --all","soc2-cc6.6":"Remove sudo/admin patterns from commands","soc2-cc7.2":"Enable session hooks: gal enforce install","gdpr-art5.1f":"Remove hardcoded secrets from configurations","gdpr-art32":"Install security hooks: gal enforce install"}[e]||"Review configuration and apply security best practices"}};Qs();Qs();var Ur=class{policy=null;customRules=[];setPolicy(e){this.policy=e}addCustomRules(e){this.customRules=[...this.customRules,...e]}clearCustomRules(){this.customRules=[]}evaluate(e){let n=[],r=[],o=[],s=[];for(let a of e){if(s.push(a.path),a.commands)for(let c of a.commands){s.push(c.path);let u=this.checkContent(c.content,c.path,"command");this.categorizeViolations(u,n,r,o)}if(a.hooks)for(let c of a.hooks){let u=this.checkContent(c.command,a.path,"hook");this.categorizeViolations(u,n,r,o)}if(a.mcpServers)for(let c of a.mcpServers){let u=this.checkMcpServer(c,a.path);this.categorizeViolations(u,n,r,o)}if(this.policy){let c=this.applyPolicyRules(a);this.categorizeViolations(c,n,r,o)}if(this.customRules.length>0){let c=this.applyCustomRules(a);this.categorizeViolations(c,n,r,o)}}let i=this.calculateSummary([...n,...r,...o]);return{passed:n.length===0,violations:n,warnings:r,audits:o,summary:i,scannedFiles:[...new Set(s)],timestamp:new Date().toISOString()}}checkContent(e,n,r){let o=[],s=Dc(e);for(let i of s)o.push({ruleId:i.id,ruleName:i.description,severity:i.severity,action:i.severity==="critical"?"block":i.severity==="high"?"warn":"audit",file:n,message:`Dangerous pattern detected in ${r}: ${i.description}`,details:`Pattern category: ${i.category}`,suggestion:this.getSuggestionForPattern(i.id)});return o}checkMcpServer(e,n){let r=[],o=Dc(e.command);for(let s of o)r.push({ruleId:`mcp-${s.id}`,ruleName:`MCP Server: ${s.description}`,severity:s.severity,action:"block",file:n,message:`Dangerous command in MCP server '${e.name}': ${s.description}`,suggestion:"Review the MCP server command and ensure it follows security best practices"});if(e.env)for(let[s,i]of Object.entries(e.env))this.isSensitiveEnvVar(s)&&i&&!i.startsWith("${")&&r.push({ruleId:"mcp-hardcoded-secret",ruleName:"Hardcoded Secret in MCP Server",severity:"high",action:"block",file:n,message:`MCP server '${e.name}' has hardcoded value for sensitive env var: ${s}`,suggestion:"Use environment variable references instead of hardcoding secrets"});return r}isSensitiveEnvVar(e){return[/API_KEY$/i,/SECRET$/i,/TOKEN$/i,/PASSWORD$/i,/CREDENTIAL/i,/PRIVATE_KEY$/i,/^AWS_/i,/^GCP_/i,/^AZURE_/i].some(r=>r.test(e))}applyPolicyRules(e){if(!this.policy)return[];let n=[];for(let r of this.policy.rules){if(!r.enabled||!this.policy.platforms.includes(e.platform))continue;let o=this.evaluateRule(r,e);o&&n.push(o)}return n}applyCustomRules(e){let n=[];for(let r of this.customRules){if(!r.enabled)continue;let o=this.evaluateRule(r,e);o&&n.push(o)}return n}evaluateRule(e,n){for(let r of e.conditions)if(this.evaluateCondition(r,n))return{ruleId:e.id,ruleName:e.name,severity:e.severity,action:e.action,file:n.path,message:e.description};return null}evaluateCondition(e,n){let r=this.getFieldValue(n,e.field);if(r===void 0)return!1;switch(e.type){case"pattern":return typeof e.value=="string"?new RegExp(e.value).test(String(r)):!1;case"denylist":return Array.isArray(e.value)?e.value.includes(String(r)):!1;case"allowlist":return Array.isArray(e.value)?!e.value.includes(String(r)):!1;case"threshold":if(typeof e.value=="number"&&typeof r=="number")switch(e.operator){case"greater_than":return r>e.value;case"less_than":return r<e.value;default:return r===e.value}return!1;default:return!1}}getFieldValue(e,n){let r=n.split("."),o=e;for(let s of r)if(o&&typeof o=="object"&&s in o)o=o[s];else return;return o}categorizeViolations(e,n,r,o){for(let s of e)switch(s.action){case"block":n.push(s);break;case"warn":r.push(s);break;case"audit":o.push(s);break}}calculateSummary(e){return{total:e.length,critical:e.filter(n=>n.severity==="critical").length,high:e.filter(n=>n.severity==="high").length,medium:e.filter(n=>n.severity==="medium").length,low:e.filter(n=>n.severity==="low").length}}getSuggestionForPattern(e){return{"rm-rf-root":"Never delete root or home directories. Use specific paths instead.","rm-rf-wildcard":"Avoid recursive deletion with wildcards. Be specific about what to delete.","chmod-777":"Use minimal permissions (e.g., 644 for files, 755 for directories).","curl-upload":"Review what data is being uploaded and ensure it does not contain secrets.","ssh-key-access":"SSH keys should never be accessed by AI agents. Remove this command.","reverse-shell":"Remove this pattern immediately - this is a critical security risk.","env-exposure":"Do not expose environment variables. Use secure secret management."}[e]||"Review this pattern and ensure it follows security best practices."}},n8=new Ur;var Vr=require("node:fs/promises"),Gr=require("node:path"),mO={claude:".claude",cursor:".cursor",gemini:".gemini",codex:".codex",windsurf:".windsurf"},Xf=class{basePath;constructor(e=process.cwd()){this.basePath=e}async discoverConfigs(){let e=[];for(let[n,r]of Object.entries(mO)){let o=(0,Gr.join)(this.basePath,r),s=await this.loadPlatformConfig(n,o);s&&e.push(s)}return e}async loadPlatformConfig(e,n){try{if(!(await(0,Vr.stat)(n)).isDirectory())return null}catch{return null}let r={platform:e,path:n,settings:{},commands:[],hooks:[],mcpServers:[]};return r.settings=await this.loadSettings(e,n),r.commands=await this.loadCommands(n),r.hooks=this.extractHooks(r.settings),r.mcpServers=this.extractMcpServers(r.settings),r}async loadSettings(e,n){let o={claude:["settings.json","settings.local.json"],cursor:["settings.json","mcp.json"],gemini:["settings.json"],codex:["settings.json","config.json"],windsurf:["settings.json","mcp_config.json"]}[e]||["settings.json"],s={};for(let i of o){let a=(0,Gr.join)(n,i);try{let c=await(0,Vr.readFile)(a,"utf-8"),u=JSON.parse(c);s={...s,...u}}catch{}}return s}async loadCommands(e){let n=[],r=(0,Gr.join)(e,"commands");try{let o=await(0,Vr.readdir)(r,{withFileTypes:!0});for(let s of o)if(s.isFile()&&s.name.endsWith(".md")){let i=(0,Gr.join)(r,s.name);try{let a=await(0,Vr.readFile)(i,"utf-8");n.push({name:(0,Gr.basename)(s.name,".md"),path:i,content:a})}catch{}}}catch{}return n}extractHooks(e){let n=[];if(e.hooks&&typeof e.hooks=="object"){let r=e.hooks;if(r.pre_tool_use&&typeof r.pre_tool_use=="object"){let o=r.pre_tool_use;o.command&&typeof o.command=="string"&&n.push({type:"pre_tool_use",command:o.command,timeout:typeof o.timeout=="number"?o.timeout:void 0})}if(r.post_tool_use&&typeof r.post_tool_use=="object"){let o=r.post_tool_use;o.command&&typeof o.command=="string"&&n.push({type:"post_tool_use",command:o.command,timeout:typeof o.timeout=="number"?o.timeout:void 0})}if(r.session_start&&typeof r.session_start=="object"){let o=r.session_start;o.command&&typeof o.command=="string"&&n.push({type:"session_start",command:o.command,timeout:typeof o.timeout=="number"?o.timeout:void 0})}if(r.session_end&&typeof r.session_end=="object"){let o=r.session_end;o.command&&typeof o.command=="string"&&n.push({type:"session_end",command:o.command,timeout:typeof o.timeout=="number"?o.timeout:void 0})}}return n}extractMcpServers(e){let n=[];if(e.mcpServers&&typeof e.mcpServers=="object"){let r=e.mcpServers;for(let[o,s]of Object.entries(r))if(s&&typeof s=="object"){let i=s;i.command&&typeof i.command=="string"&&n.push({name:o,command:i.command,args:Array.isArray(i.args)?i.args.filter(a=>typeof a=="string"):void 0,env:i.env&&typeof i.env=="object"?i.env:void 0})}}return n}};async function ei(t){return new Xf(t).discoverConfigs()}Qs();function X0(t,e){let n=e||Mr.filter(r=>r.severity==="critical"||r.severity==="high");switch(t){case"claude":return Q0(n);case"cursor":return ev(n);case"windsurf":return pO(n);default:return gO(t,n)}}function Q0(t){let e=t.map(r=>({id:r.id,pattern:r.pattern.source,description:r.description,severity:r.severity}));return{platform:"claude",hookType:"pre_tool_use",filename:"gal-safety-hook.py",content:`#!/usr/bin/env python3
|
|
662
|
+
"""
|
|
663
|
+
GAL Safety Hook - Pre-Tool-Use Enforcement
|
|
664
|
+
Generated by GAL CLI
|
|
665
|
+
Blocks dangerous commands before execution
|
|
666
|
+
"""
|
|
667
|
+
import json
|
|
668
|
+
import sys
|
|
669
|
+
import re
|
|
670
|
+
import os
|
|
671
|
+
|
|
672
|
+
# Dangerous patterns from GAL policy
|
|
673
|
+
DANGEROUS_PATTERNS = ${JSON.stringify(e,null,2)}
|
|
674
|
+
|
|
675
|
+
def check_command(command: str) -> tuple[bool, str | None]:
|
|
676
|
+
"""Check if command matches any dangerous pattern."""
|
|
677
|
+
for pattern in DANGEROUS_PATTERNS:
|
|
678
|
+
if re.search(pattern['pattern'], command):
|
|
679
|
+
return False, f"BLOCKED by GAL: {pattern['description']} (severity: {pattern['severity']})"
|
|
680
|
+
return True, None
|
|
681
|
+
|
|
682
|
+
def main():
|
|
683
|
+
# Read hook input from stdin
|
|
684
|
+
try:
|
|
685
|
+
hook_input = json.load(sys.stdin)
|
|
686
|
+
except json.JSONDecodeError:
|
|
687
|
+
# If no JSON input, allow (might be non-tool invocation)
|
|
688
|
+
sys.exit(0)
|
|
689
|
+
|
|
690
|
+
tool_name = hook_input.get('tool_name', '')
|
|
691
|
+
tool_input = hook_input.get('tool_input', {})
|
|
692
|
+
|
|
693
|
+
# Check Bash commands
|
|
694
|
+
if tool_name == 'Bash':
|
|
695
|
+
command = tool_input.get('command', '')
|
|
696
|
+
allowed, reason = check_command(command)
|
|
697
|
+
if not allowed:
|
|
698
|
+
print(json.dumps({
|
|
699
|
+
"decision": "block",
|
|
700
|
+
"reason": reason
|
|
701
|
+
}))
|
|
702
|
+
sys.exit(0)
|
|
703
|
+
|
|
704
|
+
# Check Write tool for script content
|
|
705
|
+
if tool_name == 'Write':
|
|
706
|
+
content = tool_input.get('content', '')
|
|
707
|
+
file_path = tool_input.get('file_path', '')
|
|
708
|
+
|
|
709
|
+
# Check if writing executable scripts
|
|
710
|
+
if file_path.endswith(('.sh', '.bash', '.py', '.rb')):
|
|
711
|
+
allowed, reason = check_command(content)
|
|
712
|
+
if not allowed:
|
|
713
|
+
print(json.dumps({
|
|
714
|
+
"decision": "block",
|
|
715
|
+
"reason": f"Script contains dangerous pattern: {reason}"
|
|
716
|
+
}))
|
|
717
|
+
sys.exit(0)
|
|
718
|
+
|
|
719
|
+
# Allow by default
|
|
720
|
+
print(json.dumps({"decision": "allow"}))
|
|
721
|
+
sys.exit(0)
|
|
722
|
+
|
|
723
|
+
if __name__ == '__main__':
|
|
724
|
+
main()
|
|
725
|
+
`,settingsSnippet:{hooks:{pre_tool_use:{command:"python3 .claude/hooks/gal-safety-hook.py",timeout:5e3}}}}}function ev(t){let e=t.map(r=>({id:r.id,pattern:r.pattern.source,description:r.description,severity:r.severity}));return{platform:"cursor",hookType:"pre_tool_use",filename:"gal-safety-hook.js",content:`#!/usr/bin/env node
|
|
726
|
+
/**
|
|
727
|
+
* GAL Safety Hook - Cursor Pre-Tool Enforcement
|
|
728
|
+
* Generated by GAL CLI
|
|
729
|
+
*/
|
|
730
|
+
const readline = require('readline');
|
|
731
|
+
|
|
732
|
+
const DANGEROUS_PATTERNS = ${JSON.stringify(e,null,2)};
|
|
733
|
+
|
|
734
|
+
function checkCommand(command) {
|
|
735
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
736
|
+
const regex = new RegExp(pattern.pattern);
|
|
737
|
+
if (regex.test(command)) {
|
|
738
|
+
return { blocked: true, reason: \`BLOCKED by GAL: \${pattern.description}\` };
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return { blocked: false };
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
const rl = readline.createInterface({ input: process.stdin });
|
|
745
|
+
let input = '';
|
|
746
|
+
|
|
747
|
+
rl.on('line', (line) => { input += line; });
|
|
748
|
+
rl.on('close', () => {
|
|
749
|
+
try {
|
|
750
|
+
const data = JSON.parse(input);
|
|
751
|
+
const command = data.tool_input?.command || '';
|
|
752
|
+
const result = checkCommand(command);
|
|
753
|
+
|
|
754
|
+
if (result.blocked) {
|
|
755
|
+
console.log(JSON.stringify({ decision: 'block', reason: result.reason }));
|
|
756
|
+
} else {
|
|
757
|
+
console.log(JSON.stringify({ decision: 'allow' }));
|
|
758
|
+
}
|
|
759
|
+
} catch (e) {
|
|
760
|
+
console.log(JSON.stringify({ decision: 'allow' }));
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
`,settingsSnippet:{hooks:{pre_tool_use:{command:"node .cursor/hooks/gal-safety-hook.js"}}}}}function pO(t){return{...ev(t),platform:"windsurf",settingsSnippet:{hooks:{pre_tool_use:{command:"node .windsurf/hooks/gal-safety-hook.js"}}}}}function gO(t,e){let n=Q0(e),r=`.${t}`;return{...n,platform:t,settingsSnippet:{hooks:{pre_tool_use:{command:`python3 ${r}/hooks/gal-safety-hook.py`}}}}}var ov=require("node:fs"),sv=require("node:fs/promises"),iv=require("node:os"),av=require("node:events");var tv=require("node:os");var hO=["ptrace","process_vm_readv","process_vm_writev","personality","mount","umount2","pivot_root","chroot","reboot","sethostname","setdomainname","init_module","finit_module","delete_module","kexec_load","kexec_file_load","perf_event_open","bpf","userfaultfd","keyctl","add_key","request_key"],yO=["read","write","open","openat","close","stat","fstat","lstat","poll","lseek","mmap","mprotect","munmap","brk","ioctl","access","faccessat","pipe","pipe2","dup","dup2","dup3","fcntl","flock","fsync","fdatasync","truncate","ftruncate","getdents","getdents64","getcwd","readlink","readlinkat","statfs","fstatfs","statx","execve","execveat","exit","exit_group","wait4","waitid","getpid","getppid","getuid","geteuid","getgid","getegid","gettid","getgroups","setgroups","madvise","mincore","mremap","msync","rt_sigaction","rt_sigprocmask","rt_sigreturn","rt_sigsuspend","sigaltstack","kill","tgkill","tkill","nanosleep","clock_nanosleep","clock_gettime","clock_getres","gettimeofday","times","socket","connect","sendto","recvfrom","sendmsg","recvmsg","shutdown","bind","listen","accept","accept4","getsockname","getpeername","socketpair","setsockopt","getsockopt","select","pselect6","epoll_create","epoll_create1","epoll_ctl","epoll_wait","epoll_pwait","clone","clone3","futex","set_robust_list","get_robust_list","set_tid_address","sched_yield","sched_getaffinity","uname","sysinfo","getrlimit","setrlimit","prlimit64","getrandom","arch_prctl","prctl"];function ti(t){let e=[];return e.push({names:yO,action:"SCMP_ACT_ALLOW"}),e.push({names:hO,action:"SCMP_ACT_ERRNO"}),t.fileSystem.deniedPaths.length>0&&e.push({names:["unlink","unlinkat","rmdir"],action:t.fileSystem.deniedPaths.includes("/")?"SCMP_ACT_ERRNO":"SCMP_ACT_ALLOW"}),t.network.egressOnly&&e.push({names:["bind","listen","accept","accept4"],action:"SCMP_ACT_ERRNO"}),t.network.allowRawSockets||e.push({names:["socket"],action:"SCMP_ACT_ERRNO",args:[{index:1,value:3,op:"SCMP_CMP_EQ"}]}),t.process.allowFork||e.push({names:["fork","vfork"],action:"SCMP_ACT_ERRNO"}),t.process.allowPtrace||e.push({names:["ptrace"],action:"SCMP_ACT_ERRNO"}),t.process.allowSetuid||e.push({names:["setuid","setgid","setreuid","setregid","setresuid","setresgid"],action:"SCMP_ACT_ERRNO"}),{defaultAction:"SCMP_ACT_ERRNO",architectures:["SCMP_ARCH_X86_64","SCMP_ARCH_AARCH64"],syscalls:e}}function ni(t){return JSON.stringify(t,null,2)}function Cc(t){let e=[];e.push({operation:"default",action:"deny"}),e.push({operation:"process-fork",action:"allow"}),e.push({operation:"process-exec",action:"allow"}),e.push({operation:"signal",action:"allow"});for(let n of t.fileSystem.readOnlyPaths)e.push({operation:"file-read*",action:"allow",filter:`subpath "${n}"`});for(let n of t.fileSystem.writablePaths)e.push({operation:"file-read*",action:"allow",filter:`subpath "${n}"`}),e.push({operation:"file-write*",action:"allow",filter:`subpath "${n}"`});for(let n of t.fileSystem.deniedPaths)e.push({operation:"file*",action:"deny",filter:`subpath "${n}"`});return t.network.egressOnly?(e.push({operation:"network-outbound",action:"allow"}),e.push({operation:"network-inbound",action:"deny"})):e.push({operation:"network*",action:"allow"}),e.push({operation:"sysctl-read",action:"allow"}),e.push({operation:"mach-lookup",action:"allow"}),e.push({operation:"ipc-posix-shm-read*",action:"allow"}),e.push({operation:"system-kext*",action:"deny"}),e.push({operation:"system-privilege",action:"deny"}),e.push({operation:"nvram*",action:"deny"}),e.push({operation:"iokit-open",action:"deny"}),{version:1,allowDefault:!1,rules:e}}function kc(t){let e=[];e.push("(version 1)"),e.push("");for(let n of t.rules)n.operation==="default"?e.push(`(${n.action} default)`):n.filter?e.push(`(${n.action} ${n.operation} (${n.filter}))`):e.push(`(${n.action} ${n.operation})`);return e.join(`
|
|
764
|
+
`)}function Mo(){let t=(0,tv.platform)();return t==="linux"?"linux":t==="darwin"?"darwin":t==="win32"?"win32":"linux"}function Ac(t,e){let n={id:`gal-${t}-${Date.now()}`,name:t,description:`GAL kernel enforcement profile: ${t}`,version:"1.0.0",config:e};return e.platform==="linux"?n.seccomp=ti(e):e.platform==="darwin"&&(n.macosSandbox=Cc(e)),n}function qr(t){let e=t||Mo(),n=process.env.HOME||"/tmp";return{platform:e,fileSystem:{readOnlyPaths:["/usr","/lib","/bin","/sbin","/opt"],writablePaths:["/tmp",`${n}/.cache`,`${n}/projects`],deniedPaths:[`${n}/.ssh`,`${n}/.aws`,`${n}/.config/gcloud`,`${n}/.gnupg`,"/etc/passwd","/etc/shadow"],allowSymlinks:!1},network:{allowedDomains:["*.github.com","*.npmjs.org","*.pypi.org"],blockedDomains:[],allowedPorts:[80,443],blockedPorts:[22,23,25,3389],allowRawSockets:!1,egressOnly:!0},process:{allowedExecutables:["node","npm","npx","yarn","pnpm","python","python3","pip","pip3","git","gh","code","cursor"],blockedExecutables:["sudo","su","doas","pkexec","nc","netcat","ncat","curl","wget"],allowFork:!0,maxProcesses:50,allowPtrace:!1,allowSetuid:!1},resources:{maxMemoryMB:4096,maxCpuPercent:50,maxOpenFiles:1024,maxThreads:128}}}function nv(t){return t.config.platform==="linux"&&t.seccomp?ni(t.seccomp):t.config.platform==="darwin"&&t.macosSandbox?kc(t.macosSandbox):JSON.stringify(t.config,null,2)}function rv(t){let e=[];e.push("--security-opt=no-new-privileges"),e.push("--cap-drop=ALL"),e.push(`--memory=${t.resources.maxMemoryMB}m`),e.push(`--cpus=${t.resources.maxCpuPercent/100}`),e.push(`--pids-limit=${t.process.maxProcesses}`),e.push(`--ulimit=nofile=${t.resources.maxOpenFiles}`),t.network.egressOnly&&e.push("--network=bridge"),e.push("--read-only");for(let n of t.fileSystem.writablePaths)e.push(`--tmpfs=${n}:rw,noexec,nosuid,size=100m`);return e}var Qf=class extends av.EventEmitter{config;policyEngine;watchers=[];scanTimer;violationCount=0;running=!1;lastScan;platform;constructor(e){super(),this.config=e,this.policyEngine=new Ur,this.platform=Mo(),e.policy&&this.policyEngine.setPolicy(e.policy)}async start(){if(this.running)throw new Error("System enforcer already running");console.log("[GAL System Enforcer] Starting enforcement..."),console.log(` Mode: ${this.config.enforceMode}`),console.log(` Platform: ${this.platform}`),console.log(` Kernel Enforcement: ${this.config.enableKernelEnforcement?"enabled":"disabled"}`),this.config.enableKernelEnforcement&&await this.applyKernelEnforcement(),this.config.scanInterval&&this.config.scanInterval>0?(this.scanTimer=setInterval(()=>{this.scanAllConfigs().catch(e=>{this.emit("error",e)})},this.config.scanInterval),await this.scanAllConfigs()):this.startFileWatchers(),this.running=!0,this.emit("started",this.getStatus())}async stop(){if(this.running){console.log("[GAL System Enforcer] Stopping enforcement...");for(let e of this.watchers)e.close();this.watchers=[],this.scanTimer&&(clearInterval(this.scanTimer),this.scanTimer=void 0),this.running=!1,this.emit("stopped")}}getStatus(){return{running:this.running,mode:this.config.enforceMode,kernelEnforcementEnabled:this.config.enableKernelEnforcement,watchedPaths:this.config.watchPaths,violationsDetected:this.violationCount,lastScan:this.lastScan,platform:this.platform}}async applyKernelEnforcement(){let e={...qr(this.platform),...this.config.kernelConfig},n=Ac("gal-system-enforcer",e);console.log("[GAL System Enforcer] Applying kernel-level enforcement:"),console.log(` Profile ID: ${n.id}`),console.log(` Platform: ${n.config.platform}`),n.config.platform==="linux"?console.log(" - Seccomp profile generated"):n.config.platform==="darwin"&&console.log(" - macOS Sandbox profile generated"),this.emit("kernel-enforcement-applied",n)}startFileWatchers(){for(let e of this.config.watchPaths){let n=(0,ov.watch)(e,{recursive:!0},(r,o)=>{o&&this.isAgentConfigFile(o)&&this.checkFile(e,o).catch(s=>{this.emit("error",s)})});this.watchers.push(n),console.log(`[GAL System Enforcer] Watching: ${e}`)}}isAgentConfigFile(e){return[/\.claude\/settings\.json$/,/\.claude\/commands\/.*\.md$/,/\.claude\/agents\/.*\.md$/,/\.claude\/hooks\/.*\.(py|js|sh)$/,/\.cursor\/.*$/,/\.windsurf\/.*$/,/\.mcp\.json$/,/CLAUDE\.md$/].some(r=>r.test(e))}async scanAllConfigs(){console.log("[GAL System Enforcer] Running policy scan..."),this.lastScan=new Date().toISOString();let e=[];for(let r of this.config.watchPaths)console.log(` Scanning: ${r}`);let n=this.policyEngine.evaluate(e);n.violations.length>0&&(this.violationCount+=n.violations.length,await this.handleViolations(n.violations)),console.log(`[GAL System Enforcer] Scan complete: ${n.violations.length} violations`),this.emit("scan-complete",n)}async checkFile(e,n){let r=`${e}/${n}`;try{let o=await(0,sv.readFile)(r,"utf-8"),s=await this.parseAgentConfig(r,o);if(!s)return;let i=this.policyEngine.evaluate([s]);i.violations.length>0&&(this.violationCount+=i.violations.length,await this.handleViolations(i.violations,r))}catch(o){this.emit("error",new Error(`Failed to check file ${r}: ${o}`))}}async parseAgentConfig(e,n){let r=e.match(/\.(claude|cursor|windsurf|gemini|codex)\//),o=r?r[1]:"claude";try{if(e.endsWith("settings.json")){let s=JSON.parse(n);return{platform:o,path:e,settings:s}}else if(e.endsWith(".mcp.json")){let s=JSON.parse(n);return{platform:o,path:e,mcpServers:s.mcpServers}}else{if(e.includes("/commands/"))return{platform:o,path:e,commands:[{name:e.split("/").pop()?.replace(".md","")||"unknown",path:e,content:n}]};if(e.includes("/hooks/"))return{platform:o,path:e,hooks:[{type:"pre_tool_use",command:n}]}}}catch(s){this.emit("error",new Error(`Failed to parse ${e}: ${s}`))}return null}async handleViolations(e,n){let r={timestamp:new Date().toISOString(),filePath:n||"multiple",violations:e,action:this.config.enforceMode==="block"?"blocked":"logged",hostname:(0,iv.platform)()};this.emit("violation",r),console.error("[GAL System Enforcer] POLICY VIOLATION DETECTED"),console.error(` File: ${r.filePath}`),console.error(` Violations: ${e.length}`);for(let o of e)console.error(` - [${o.severity}] ${o.message}`);this.config.alertWebhook&&await this.sendAlert(r),this.config.enforceMode==="block"&&n&&await this.blockViolation(n,e)}async sendAlert(e){if(this.config.alertWebhook)try{let n=await fetch(this.config.alertWebhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"gal.enforcement.violation",event:e})});if(!n.ok)throw new Error(`Webhook returned ${n.status}`)}catch(n){this.emit("error",new Error(`Failed to send alert: ${n}`))}}async blockViolation(e,n){console.error(`[GAL System Enforcer] BLOCKING: ${e}`),this.emit("blocked",{filePath:e,violations:n})}updatePolicy(e){this.policyEngine.setPolicy(e),this.emit("policy-updated",e),console.log("[GAL System Enforcer] Policy updated")}};async function cv(t={}){let e={watchPaths:[process.cwd(),`${process.env.HOME}/.claude`,`${process.env.HOME}/.cursor`],enforceMode:"monitor",enableKernelEnforcement:!1,...t};return new Qf(e)}function bO(){let t=new F("compliance").description("Enterprise security compliance assessment (SOC 2, GDPR, ISO 27001, HIPAA)");return t.command("assess").description("Run compliance assessment on local AI agent configurations").option("-f, --framework <framework>","Specific framework (soc2, gdpr, iso27001, hipaa)").option("-o, --org <orgName>","Organization name").option("--path <path>","Path to scan (default: current directory)").option("--json","Output as JSON").option("--output <file>","Save report to file").action(async e=>{let n=x({isSilent:e.json});try{let r=M.load(),o=e.org||r.defaultOrg||"default",s=e.path||process.cwd();n.start("Scanning AI agent configurations...");let i=await ei(s);if(i.length===0){n.info("No AI agent configurations found");return}n.text=`Found ${i.length} platform(s). Running compliance assessment...`;let a=e.framework?[e.framework]:["soc2","gdpr","iso27001","hipaa"],u=await new Xs(o).evaluateCompliance(i,a);n.stop(),e.json?console.log(JSON.stringify(u,null,2)):vO(u),e.output&&(await(0,em.writeFile)(e.output,JSON.stringify(u,null,2),"utf-8"),console.log(l.dim(`
|
|
765
|
+
Report saved to: ${e.output}`))),u.overallScore<50&&process.exit(1)}catch(r){n.fail("Compliance assessment failed"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("requirements").description("List compliance requirements").option("-f, --framework <framework>","Filter by framework").option("--json","Output as JSON").action(e=>{let n=[...Br];if(e.framework&&(n=Ec(e.framework)),e.json){console.log(JSON.stringify(n,null,2));return}console.log(l.bold(`
|
|
766
|
+
Compliance Requirements
|
|
767
|
+
`));let r=lv(n,"framework");for(let[o,s]of Object.entries(r)){console.log(l.cyan.bold(`
|
|
768
|
+
${o.toUpperCase()} (${s.length} requirements)
|
|
769
|
+
`));let i=lv(s,"category");for(let[a,c]of Object.entries(i)){console.log(l.yellow(` ${a}:`));for(let u of c){let d=wO(u.severity);console.log(` ${d(`[${u.severity}]`)} ${u.name}`),console.log(l.dim(` ${u.description}`))}}}console.log(l.dim(`
|
|
770
|
+
Total: ${n.length} requirements`))}),t.command("frameworks").description("Show compliance framework information").action(()=>{console.log(l.bold(`
|
|
771
|
+
Supported Compliance Frameworks
|
|
772
|
+
`));let e=[{name:"SOC 2",id:"soc2",org:"AICPA (American Institute of CPAs)",focus:"Security, Availability, Processing Integrity, Confidentiality, Privacy",url:"https://www.aicpa.org/soc2"},{name:"GDPR",id:"gdpr",org:"European Union",focus:"Data protection and privacy for EU citizens",url:"https://gdpr.eu/"},{name:"ISO 27001",id:"iso27001",org:"International Organization for Standardization",focus:"Information security management systems (ISMS)",url:"https://www.iso.org/iso-27001"},{name:"HIPAA",id:"hipaa",org:"U.S. Department of Health and Human Services",focus:"Healthcare data protection (PHI)",url:"https://www.hhs.gov/hipaa"}];for(let n of e)console.log(l.cyan.bold(`${n.name} (${n.id})`)),console.log(` Standard body: ${n.org}`),console.log(` Focus: ${n.focus}`),console.log(l.dim(` Reference: ${n.url}`)),console.log();console.log(l.yellow("Note: GAL provides self-assessment tools for pre-audit preparation.")),console.log(l.yellow("Official certification requires third-party auditors."))}),t.command("export").description("Export compliance report in various formats").option("-f, --format <format>","Output format (json, csv, markdown)","json").option("-o, --output <file>","Output file path").option("--framework <framework>","Specific framework").action(async e=>{let n=x();try{let o=M.load().defaultOrg||"default";n.start("Generating compliance report...");let s=await ei(process.cwd()),i=e.framework?[e.framework]:["soc2","gdpr","iso27001","hipaa"],c=await new Xs(o).evaluateCompliance(s,i),u,d;switch(e.format){case"csv":u=SO(c),d="csv";break;case"markdown":u=_O(c),d="md";break;default:u=JSON.stringify(c,null,2),d="json"}let m=e.output||`compliance-report-${Date.now()}.${d}`;await(0,em.writeFile)(m,u,"utf-8"),n.succeed(`Report exported to: ${m}`)}catch(r){n.fail("Export failed"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t}function vO(t){console.log(`
|
|
773
|
+
`+l.bold("GAL Compliance Assessment Report")),console.log("\u2550".repeat(60)),console.log(`Organization: ${t.orgId}`),console.log(`Generated: ${t.generatedAt}`),console.log();let e=t.overallScore>=80?l.green:t.overallScore>=50?l.yellow:l.red;console.log(`Overall Compliance Score: ${e.bold(`${t.overallScore}%`)}`),console.log(),console.log(l.bold("Framework Scores:"));for(let r of t.scores){let o=r.overallScore>=80?l.green:r.overallScore>=50?l.yellow:l.red;console.log(` ${r.framework.toUpperCase().padEnd(10)} ${o(`${r.overallScore}%`)} (${r.passedChecks}/${r.totalChecks} passed)`),r.criticalViolations>0&&console.log(l.red(` Critical violations: ${r.criticalViolations}`)),r.highViolations>0&&console.log(l.yellow(` High violations: ${r.highViolations}`))}if(console.log(`
|
|
774
|
+
`+l.bold("Summary:")),console.log(` Total requirements: ${t.summary.totalRequirements}`),console.log(l.green(` Compliant: ${t.summary.compliant}`)),console.log(l.yellow(` Partially compliant: ${t.summary.partiallyCompliant}`)),console.log(l.red(` Non-compliant: ${t.summary.nonCompliant}`)),t.recommendations.length>0){console.log(`
|
|
775
|
+
`+l.bold("Recommendations:"));for(let r of t.recommendations)console.log(l.cyan(` \u2022 ${r}`))}let n=t.checks.filter(r=>!r.passed);if(n.length>0){console.log(`
|
|
776
|
+
`+l.bold("Key Findings:"));for(let r of n.slice(0,5)){let o=Br.find(s=>s.id===r.requirementId);o&&(console.log(l.red(` \u2717 ${o.name} (${o.framework.toUpperCase()})`)),r.remediation&&console.log(l.dim(` Remediation: ${r.remediation}`)))}n.length>5&&console.log(l.dim(` ... and ${n.length-5} more`))}console.log()}function SO(t){let e=[];e.push("Requirement ID,Framework,Category,Name,Score,Passed,Findings");for(let n of t.checks){let r=Br.find(o=>o.id===n.requirementId);if(r){let o=n.findings.map(s=>s.message).join("; ");e.push(`"${r.id}","${r.framework}","${r.category}","${r.name}",${n.score},${n.passed},"${o}"`)}}return e.join(`
|
|
777
|
+
`)}function _O(t){let e=[];e.push(`# GAL Compliance Assessment Report
|
|
778
|
+
`),e.push(`**Organization:** ${t.orgId}`),e.push(`**Generated:** ${t.generatedAt}`),e.push(`**Overall Score:** ${t.overallScore}%
|
|
779
|
+
`),e.push(`## Framework Scores
|
|
780
|
+
`),e.push("| Framework | Score | Passed | Critical | High |"),e.push("|-----------|-------|--------|----------|------|");for(let n of t.scores)e.push(`| ${n.framework.toUpperCase()} | ${n.overallScore}% | ${n.passedChecks}/${n.totalChecks} | ${n.criticalViolations} | ${n.highViolations} |`);e.push(`
|
|
781
|
+
## Recommendations
|
|
782
|
+
`);for(let n of t.recommendations)e.push(`- ${n}`);return e.join(`
|
|
783
|
+
`)}function wO(t){switch(t){case"critical":return l.red.bold;case"high":return l.yellow;case"medium":return l.blue;case"low":return l.dim;default:return l.white}}function lv(t,e){return t.reduce((n,r)=>{let o=String(r[e]);return n[o]||(n[o]=[]),n[o].push(r),n},{})}function EO(){let t=new F("config");return t.enablePositionalOptions(),t.description("Manage GAL CLI configuration").action(()=>{let e=M.load(),n=M.getEnvironment(),o={development:l.yellow,staging:l.cyan,production:l.green}[n]||l.white;console.log(l.blue("Current Configuration:")),console.log(l.gray(" Environment:"),o(n)),console.log(l.gray(" Config file:"),M.getConfigPath()),console.log(l.gray(" API URL:"),e.apiUrl||l.dim("(not set)")),console.log(l.gray(" API Key:"),e.apiKey?l.green("(set)"):l.dim("(not set)")),console.log(l.gray(" Default Org:"),e.defaultOrg||l.dim("(not set)")),console.log(l.gray(" Telemetry:"),e.telemetry===!1?l.red("disabled"):l.green("enabled")),console.log(""),console.log(l.dim(" Tip: Set GAL_ENV=dev|staging|prod to override environment")),console.log(l.dim(" Tip: gal config set telemetry false to disable telemetry"))}),t.command("set").description("Set a configuration value").argument("<key>","Configuration key (apiUrl, apiKey, defaultOrg, telemetry)").argument("<value>","Configuration value").passThroughOptions().action((e,n)=>{["__proto__","constructor","prototype"].includes(e)&&(console.error(l.red(`Invalid key: "${e}" is not allowed for security reasons`)),process.exit(1));let o=["apiUrl","apiKey","defaultOrg","telemetry"];o.includes(e)||(console.error(l.red(`Invalid key: ${e}. Valid keys: ${o.join(", ")}`)),process.exit(1));let s=n;if(e==="telemetry"){let a=n.toLowerCase();a==="true"||a==="1"||a==="yes"||a==="on"?s=!0:a==="false"||a==="0"||a==="no"||a==="off"?s=!1:(console.error(l.red("Invalid value for telemetry. Use: true/false, yes/no, 1/0, on/off")),process.exit(1))}M.set(e,s);let i=e==="apiKey"?"***":String(s);console.log(l.green(`\u2713 Set ${e} = ${i}`))}),t.command("get").description("Get a configuration value").argument("<key>","Configuration key").action(e=>{let n=M.get(e);console.log(n===void 0?l.dim(`${e} is not set`):e==="apiKey"?"***":n)}),t.command("test").description("Test connection to GAL API").action(async()=>{let e=x("Testing API connection...").start();try{let n=M.load();n.apiUrl||(e.fail(l.red("API URL not configured")),console.log(l.dim("Run: gal config set apiUrl <url>")),process.exit(1)),await new ce(n).testConnection()?e.succeed(l.green(`Connected to GAL API at ${n.apiUrl}`)):(e.fail(l.red(`Failed to connect to ${n.apiUrl}`)),process.exit(1))}catch(n){e.fail(l.red("Connection test failed")),console.error(l.dim(n.message)),process.exit(1)}}),t.command("path").description("Show config file path").action(()=>{console.log(M.getConfigPath())}),t}var Tc=class{config;constructor(e){this.config=e}async syncRepo(e,n){return{success:!0,prUrl:this.config.createPRs?`https://github.com/${this.config.orgName}/${e}/pull/1`:void 0}}async syncAll(e){return{success:!0,totalRepos:10,updated:3,upToDate:7,errors:0,prs:this.config.createPRs?[{repo:"repo-1",url:"https://github.com/org/repo-1/pull/1"}]:[]}}},Fc=class{config;constructor(e){this.config=e}getAvailableCommands(){return[{id:"review",description:"Automated code review"},{id:"audit",description:"Security audit"},{id:"compliance",description:"Compliance check"},{id:"estimate",description:"Time estimation"}]}async distribute(e){return{commands:e.commands,reposUpdated:e.repos?.length||10,errors:0}}};function DO(){let t=new F("distribute").description("Distribute configurations and commands across repositories");return t.addCommand(CO()),t.addCommand(kO()),t.addCommand(AO()),t}function CO(){return new F("config").description("Distribute governance configurations to repositories").option("-o, --org <name>","Organization name").option("-r, --repos <repos...>","Target repository names").option("-t, --template <id>","Template to use","claude-code").option("--create-pr","Create pull requests instead of direct commit").option("--dry-run","Show changes without applying").option("-f, --force","Force update even if no changes detected").action(async t=>{let e=x("Initializing distribution pipeline...").start();try{let n=new Tc({orgName:t.org||process.env.GITHUB_ORG,githubToken:process.env.GITHUB_TOKEN,createPRs:t.createPr,dryRun:t.dryRun});if(t.repos&&t.repos.length>0){e.text=`Distributing to ${t.repos.length} repositories...`;let r=[];for(let o of t.repos){e.text=`Syncing ${o}...`;let s=await n.syncRepo(o,{template:t.template,force:t.force});r.push({repo:o,...s})}e.stop(),console.log(TO(r))}else{e.text="Scanning organization repositories...";let r=await n.syncAll({template:t.template,force:t.force});e.stop(),console.log(uv(r))}}catch(n){e.fail(l.red("Distribution failed")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function kO(){return new F("commands").description("Distribute slash commands to repositories").option("-o, --org <name>","Organization name").option("-r, --repos <repos...>","Target repository names").option("-c, --commands <cmds...>","Command IDs to distribute").option("--all","Distribute all standard commands").option("--dry-run","Show changes without applying").action(async t=>{let e=x("Initializing command distributor...").start();try{let n=new Fc({orgName:t.org||process.env.GITHUB_ORG,githubToken:process.env.GITHUB_TOKEN,dryRun:t.dryRun}),r=t.all?["review","audit","compliance","estimate"]:t.commands||[];if(r.length===0){e.fail(l.yellow("No commands specified")),console.log(`
|
|
784
|
+
Available commands:`);let s=n.getAvailableCommands();for(let i of s)console.log(` - ${i.id}: ${i.description}`);console.log(`
|
|
785
|
+
Use --commands <id> or --all to distribute commands`);return}e.text=`Distributing ${r.length} command(s)...`;let o=await n.distribute({repos:t.repos,commands:r});e.stop(),console.log(dv(o))}catch(n){e.fail(l.red("Command distribution failed")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function AO(){return new F("sync").description("Sync all configurations and commands").option("-o, --org <name>","Organization name").option("--config-template <id>","Config template to use","claude-code").option("--include-commands","Also distribute standard commands").option("--create-pr","Create pull requests").option("--dry-run","Preview changes only").action(async t=>{let e=x("Starting full organization sync...").start();try{let n=new Tc({orgName:t.org||process.env.GITHUB_ORG,githubToken:process.env.GITHUB_TOKEN,createPRs:t.createPr,dryRun:t.dryRun});e.text="Syncing configurations...";let r=await n.syncAll({template:t.configTemplate}),o=null;t.includeCommands&&(e.text="Distributing commands...",o=await new Fc({orgName:t.org||process.env.GITHUB_ORG,githubToken:process.env.GITHUB_TOKEN,dryRun:t.dryRun}).distribute({commands:["review","audit","compliance","estimate"]})),e.stop(),console.log(l.blue.bold(`
|
|
786
|
+
\u2501\u2501\u2501 Organization Sync Complete \u2501\u2501\u2501
|
|
787
|
+
`)),console.log(uv(r)),o&&(console.log(`
|
|
788
|
+
`+l.blue("Commands Distribution:")),console.log(dv(o)))}catch(n){e.fail(l.red("Organization sync failed")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function TO(t){let e=[];e.push(""),e.push(l.blue.bold("Distribution Results")),e.push("\u2500".repeat(50));let n=0,r=0;for(let o of t){let s=o.success?l.green("\u2713"):l.red("\u2717");e.push(`${s} ${o.repo}`),o.prUrl&&e.push(` PR: ${o.prUrl}`),o.error&&e.push(` Error: ${l.red(o.error)}`),o.success?n++:r++}return e.push(""),e.push(`Success: ${l.green(n)} | Failed: ${l.red(r)}`),e.join(`
|
|
789
|
+
`)}function uv(t){let e=[];if(e.push(l.blue("Configuration Sync:")),e.push(` Repositories scanned: ${t.totalRepos||0}`),e.push(` Configurations updated: ${l.green(t.updated||0)}`),e.push(` Already up-to-date: ${t.upToDate||0}`),e.push(` Errors: ${l.red(t.errors||0)}`),t.prs&&t.prs.length>0){e.push(""),e.push(l.blue("Pull Requests Created:"));for(let n of t.prs)e.push(` \u2022 ${n.repo}: ${n.url}`)}return e.join(`
|
|
790
|
+
`)}function dv(t){let e=[];return e.push(` Commands distributed: ${t.commands?.length||0}`),e.push(` Repositories updated: ${l.green(t.reposUpdated||0)}`),e.push(` Errors: ${l.red(t.errors||0)}`),e.join(`
|
|
791
|
+
`)}var Oc=H(require("fs"),1),Ic=H(require("path"),1),jn="https://gal.run/docs",FO="https://app.gal.run";function OO(){let t=new F("docs").description("Documentation and dashboard access");return t.addCommand(new F("open").description("Open documentation in browser").argument("[topic]","Documentation topic").action(e=>{let n={default:jn,"getting-started":`${jn}/getting-started`,api:`${jn}/api`,cli:`${jn}/cli`,security:`${jn}/security`,compliance:`${jn}/compliance`,plugins:`${jn}/plugins`,integrations:`${jn}/integrations`},r=n[e||"default"]||jn;console.log(l.blue(`
|
|
792
|
+
Opening: ${r}
|
|
793
|
+
`)),console.log(l.dim("(Would open browser in production)")),console.log(l.blue(`
|
|
794
|
+
Available documentation topics:`));for(let[o,s]of Object.entries(n))o!=="default"&&console.log(` \u2022 ${o}: ${s}`)})),t.addCommand(new F("dashboard").description("Open GAL dashboard").action(()=>{console.log(l.blue(`
|
|
795
|
+
Opening GAL Dashboard: ${FO}
|
|
796
|
+
`)),console.log(l.dim("(Would open browser in production)")),console.log(l.blue(`
|
|
797
|
+
Dashboard features:`)),console.log(" \u2022 Organization overview"),console.log(" \u2022 Configuration management"),console.log(" \u2022 Compliance reports"),console.log(" \u2022 Security audit logs"),console.log(" \u2022 Team settings")})),t.addCommand(new F("generate").description("Generate documentation for current project").option("-o, --output <dir>","Output directory","docs").option("-f, --format <format>","Output format: markdown, html","markdown").action(async e=>{console.log(l.blue.bold(`
|
|
798
|
+
Generating Project Documentation
|
|
799
|
+
`));let n=Ic.resolve(e.output);Oc.mkdirSync(n,{recursive:!0});let r=IO();for(let[o,s]of Object.entries(r)){let i=Ic.join(n,o);Oc.writeFileSync(i,s,"utf-8"),console.log(` ${l.green("\u2713")} ${o}`)}console.log(""),console.log(l.green(`Documentation generated in ${e.output}/`))})),t.addCommand(new F("cli").description("Show CLI command reference").action(()=>{console.log(l.blue.bold(`
|
|
800
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue.bold(" GAL CLI REFERENCE")),console.log(l.blue.bold(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
801
|
+
`));let e=[{cmd:"scan <org>",desc:"Scan organization for AI agent configs"},{cmd:"list",desc:"List discovered configurations"},{cmd:"analyze",desc:"Analyze configurations for security issues"},{cmd:"config",desc:"Manage GAL configuration"},{cmd:"sync",desc:"Sync configurations across repos"},{cmd:"sandbox",desc:"Manage sandbox environments"},{cmd:"compliance",desc:"Run compliance assessments"},{cmd:"enforce",desc:"Enforce policies"},{cmd:"",desc:""},{cmd:"test",desc:"Run governance test suites (GAL-2)"},{cmd:"template",desc:"Generate dev environment templates (GAL-3)"},{cmd:"distribute",desc:"Distribute configs & commands (GAL-5, 32, 63)"},{cmd:"time",desc:"Time tracking & workflow (GAL-19, 22, 24)"},{cmd:"maintain",desc:"Run maintenance tasks (GAL-11)"},{cmd:"quality",desc:"Code quality checks (GAL-20)"},{cmd:"protect",desc:"Recursion protection (GAL-12)"},{cmd:"universal",desc:"Universal AI agent commands (GAL-14)"},{cmd:"sal",desc:"Sandbox orchestration (GAL-66, 67, 68)"},{cmd:"docs",desc:"Documentation & dashboard (GAL-1, 65)"}];for(let{cmd:n,desc:r}of e){if(n===""){console.log("");continue}console.log(` ${l.cyan("gal "+n.padEnd(20))} ${r}`)}console.log(`
|
|
802
|
+
`+"\u2500".repeat(55)),console.log(l.dim("Run `gal <command> --help` for command details"))})),t.addCommand(new F("api").description("Show API reference").action(()=>{console.log(l.blue.bold(`
|
|
803
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue.bold(" GAL API REFERENCE")),console.log(l.blue.bold(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
804
|
+
`)),console.log(l.cyan("Base URL:"),"https://api.gal.run/v1"),console.log("");let e=[{method:"GET",path:"/organizations",desc:"List organizations"},{method:"GET",path:"/organizations/:id",desc:"Get organization details"},{method:"POST",path:"/organizations/:id/scan",desc:"Trigger config scan"},{method:"GET",path:"/configs",desc:"List configurations"},{method:"GET",path:"/configs/:id",desc:"Get configuration details"},{method:"PUT",path:"/configs/:id",desc:"Update configuration"},{method:"POST",path:"/compliance/assess",desc:"Run compliance assessment"},{method:"GET",path:"/compliance/reports",desc:"Get compliance reports"},{method:"POST",path:"/sandbox/create",desc:"Create sandbox session"},{method:"POST",path:"/sandbox/:id/execute",desc:"Execute in sandbox"},{method:"DELETE",path:"/sandbox/:id",desc:"Destroy sandbox"}];console.log(l.blue(`Endpoints:
|
|
805
|
+
`));for(let{method:n,path:r,desc:o}of e){let s=n==="GET"?l.green:n==="POST"?l.yellow:n==="PUT"?l.blue:l.red;console.log(` ${s(n.padEnd(7))} ${r.padEnd(30)} ${l.dim(o)}`)}console.log(`
|
|
806
|
+
`+"\u2500".repeat(60)),console.log(l.dim("Full API docs: https://gal.run/docs/api"))})),t.addCommand(new F("quickstart").description("Show quick start guide").action(()=>{console.log(l.blue.bold(`
|
|
807
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue.bold(" GAL QUICK START")),console.log(l.blue.bold(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
808
|
+
`)),console.log(l.cyan("1. Install GAL CLI:")),console.log(` npm install -g @gal/cli
|
|
809
|
+
`),console.log(l.cyan("2. Authenticate:")),console.log(` gal config set --api-key YOUR_API_KEY
|
|
810
|
+
`),console.log(l.cyan("3. Scan your organization:")),console.log(` gal scan my-org
|
|
811
|
+
`),console.log(l.cyan("4. Analyze configurations:")),console.log(` gal analyze --path .
|
|
812
|
+
`),console.log(l.cyan("5. Run compliance check:")),console.log(` gal compliance assess --frameworks soc2,gdpr
|
|
813
|
+
`),console.log(l.cyan("6. Set up governance:")),console.log(` gal template generate claude-code --governance
|
|
814
|
+
`),console.log("\u2500".repeat(55)),console.log(l.dim("Full documentation: https://gal.run/docs/getting-started"))})),t}function IO(){let t={};return t["README.md"]=`# Project Governance Documentation
|
|
815
|
+
|
|
816
|
+
This documentation was auto-generated by GAL CLI.
|
|
817
|
+
|
|
818
|
+
## Quick Links
|
|
819
|
+
|
|
820
|
+
- [Configuration Guide](./CONFIGURATION.md)
|
|
821
|
+
- [Security Policies](./SECURITY.md)
|
|
822
|
+
- [Compliance](./COMPLIANCE.md)
|
|
823
|
+
- [CLI Commands](./CLI.md)
|
|
824
|
+
|
|
825
|
+
## Getting Started
|
|
826
|
+
|
|
827
|
+
Run \`gal analyze\` to check your configuration.
|
|
828
|
+
|
|
829
|
+
## Support
|
|
830
|
+
|
|
831
|
+
Visit https://gal.run/docs for full documentation.
|
|
832
|
+
`,t["CONFIGURATION.md"]=`# GAL Configuration Guide
|
|
833
|
+
|
|
834
|
+
## File Locations
|
|
835
|
+
|
|
836
|
+
- \`.claude/settings.json\` - Main configuration
|
|
837
|
+
- \`.claude/commands/\` - Custom commands
|
|
838
|
+
- \`CLAUDE.md\` - Project context
|
|
839
|
+
|
|
840
|
+
## Configuration Options
|
|
841
|
+
|
|
842
|
+
\`\`\`json
|
|
843
|
+
{
|
|
844
|
+
"version": "1.0.0",
|
|
845
|
+
"governance": {
|
|
846
|
+
"complianceLevel": "standard",
|
|
847
|
+
"requiredReviewers": 1
|
|
848
|
+
},
|
|
849
|
+
"security": {
|
|
850
|
+
"sandbox": {
|
|
851
|
+
"enabled": true
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
\`\`\`
|
|
856
|
+
|
|
857
|
+
## Environment Variables
|
|
858
|
+
|
|
859
|
+
- \`GAL_API_KEY\` - Your API key
|
|
860
|
+
- \`GAL_ORG_ID\` - Organization ID
|
|
861
|
+
- \`GITHUB_TOKEN\` - GitHub access token
|
|
862
|
+
`,t["SECURITY.md"]=`# Security Policies
|
|
863
|
+
|
|
864
|
+
## Sandboxing
|
|
865
|
+
|
|
866
|
+
All agent operations are sandboxed by default.
|
|
867
|
+
|
|
868
|
+
## Denied Paths
|
|
869
|
+
|
|
870
|
+
The following paths are blocked:
|
|
871
|
+
- \`$HOME/.ssh\`
|
|
872
|
+
- \`$HOME/.aws/credentials\`
|
|
873
|
+
- \`$HOME/.config/gcloud/credentials\`
|
|
874
|
+
|
|
875
|
+
## Secret Detection
|
|
876
|
+
|
|
877
|
+
GAL scans for:
|
|
878
|
+
- API keys
|
|
879
|
+
- Private keys
|
|
880
|
+
- Credentials
|
|
881
|
+
- Tokens
|
|
882
|
+
`,t["CLI.md"]="# GAL CLI Reference\n\n## Installation\n\n```bash\nnpm install -g @gal/cli\n```\n\n## Commands\n\n- `gal scan <org>` - Scan organization\n- `gal analyze` - Analyze configurations\n- `gal compliance assess` - Run compliance check\n- `gal test` - Run governance tests\n- `gal quality check` - Code quality check\n\nRun `gal --help` for full command list.\n",t}var vt=require("node:fs/promises"),Yt=require("node:path");var Nc={claude:".claude",cursor:".cursor",gemini:".gemini",codex:".codex",windsurf:".windsurf"};function NO(){let t=new F("enforce").description("Install and manage organization security policies locally");return t.command("install").description("Install organization-approved safety hooks from GAL").option("-o, --org <orgName>","Organization name").option("-p, --platform <platform>","Specific platform (claude, cursor, gemini, codex, windsurf)").option("--all","Install hooks for all detected platforms").option("--path <path>","Base path (default: current directory)").option("--force","Overwrite existing hooks").option("--dry-run","Show what would be installed without making changes").action(async e=>{let n=x();try{let r=M.load(),o=e.org||r.defaultOrg;o||(console.error(l.red("Error: Organization name required. Use --org or set defaultOrg in config.")),console.log(l.dim("Run: gal config set defaultOrg <your-org>")),process.exit(1)),r.apiUrl||(console.error(l.red("Error: GAL API URL not configured.")),console.log(l.dim("Run: gal config set apiUrl <api-url>")),process.exit(1)),n.start(`Fetching enforcement policy from GAL for ${o}...`);let i=await new ce({apiUrl:r.apiUrl}).getOrgPolicy(o);i||(n.fail("No enforcement policy found for organization"),console.log(l.yellow(`
|
|
883
|
+
Your organization has not configured an enforcement policy yet.`)),console.log(l.dim("Contact your administrator to set up policies in GAL dashboard.")),process.exit(1)),n.succeed(`Loaded policy: ${i.name} (v${i.version})`),console.log(l.dim(` ${i.rules.length} rules, ${i.platforms.length} platforms`));let a=e.path||process.cwd(),c=e.platform?[e.platform]:e.all?["claude","cursor","gemini","codex","windsurf"]:await xO(a);if(c.length===0){n.info("No AI agent configurations detected in this directory."),console.log(l.dim("Use --platform or --all to specify which platforms to set up."));return}console.log(l.blue(`
|
|
884
|
+
Installing hooks for: ${c.join(", ")}`));for(let u of c){if(!i.platforms.includes(u)){console.log(l.dim(` Skipping ${u} (not in policy platforms)`));continue}if(n.start(`Installing ${u} safety hook...`),e.dryRun){n.info(`[DRY RUN] Would install ${u} hook`);continue}try{await PO(a,u,i,e.force),n.succeed(`Installed ${u} safety hook`)}catch(d){let m=d instanceof Error?d.message:String(d);n.warn(`Failed to install ${u} hook: ${m}`)}}console.log(l.green(`
|
|
885
|
+
Enforcement hooks installed successfully!`)),console.log(l.dim("AI agents will now enforce your organization's security policies."))}catch(r){n.fail("Failed to install enforcement hooks"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("status").description("Check enforcement status and installed hooks").option("--path <path>","Base path (default: current directory)").option("--json","Output as JSON").option("--no-heartbeat","Skip fleet heartbeat").action(async e=>{let n=e.path||process.cwd(),r={},o=[],s="unknown";for(let a of["claude","cursor","gemini","codex","windsurf"]){let c=(0,Yt.join)(n,Nc[a]),u=(0,Yt.join)(c,"hooks","gal-safety-hook.py");try{await(0,vt.stat)(u);let m=(await(0,vt.readFile)(u,"utf-8")).match(/GAL Policy Version: ([\d.]+)/),p=m?m[1]:"unknown";r[a]={installed:!0,hookPath:u,version:p},o.push(a),s=p}catch{r[a]={installed:!1}}}if(e.heartbeat!==!1)try{let a=M.load();a.fleetDeveloperId&&a.apiUrl&&await new ce({apiUrl:a.apiUrl,apiKey:a.apiKey}).fleetHeartbeat({developerId:a.fleetDeveloperId,machineId:"",enforcementStatus:{installed:o.length>0,version:"0.1.0",policyVersion:s,platforms:o}})}catch{}if(e.json){console.log(JSON.stringify(r,null,2));return}console.log(l.bold(`
|
|
886
|
+
GAL Enforcement Status
|
|
887
|
+
`));for(let[a,c]of Object.entries(r)){let u=c.installed?l.green("\u2713"):l.red("\u2717"),d=c.installed?l.green(`installed (v${c.version})`):l.dim("not installed");console.log(` ${u} ${a}: ${d}`)}let i=Object.values(r).filter(a=>a.installed).length;console.log(`
|
|
888
|
+
${i}/5 platforms enforced`)}),t.command("scan").description("Scan local configurations for policy violations").option("--path <path>","Path to scan (default: current directory)").option("--strict","Fail on warnings").option("--json","Output as JSON").action(async e=>{let n=x({isSilent:e.json});try{n.start("Scanning configurations...");let r=e.path||process.cwd(),o=await ei(r);if(o.length===0){n.info("No AI agent configurations found");return}let i=new Ur().evaluate(o);n.stop(),e.json?console.log(JSON.stringify(i,null,2)):RO(i,!0),(!i.passed||e.strict&&i.warnings.length>0)&&process.exit(1)}catch(r){n.fail("Scan failed"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("uninstall").description("Remove GAL enforcement hooks").option("--platform <platform>","Specific platform").option("--all","Remove from all platforms").option("--path <path>","Base path").action(async e=>{let{rm:n}=await import("node:fs/promises"),r=e.path||process.cwd(),o=e.platform?[e.platform]:["claude","cursor","gemini","codex","windsurf"];for(let s of o){let i=(0,Yt.join)(r,Nc[s],"hooks","gal-safety-hook.py");try{await n(i),console.log(l.green(`\u2713 Removed ${s} hook`))}catch{console.log(l.dim(` ${s}: no hook found`))}}}),t.command("patterns").description("List dangerous patterns that hooks block").option("--severity <level>","Filter by severity").option("--json","Output as JSON").action(async e=>{let{DANGEROUS_PATTERNS:n}=await Promise.resolve().then(()=>(Qs(),Z0)),r=[...n];if(e.severity&&(r=r.filter(o=>o.severity===e.severity)),e.json){console.log(JSON.stringify(r.map(o=>({id:o.id,description:o.description,severity:o.severity,category:o.category})),null,2));return}console.log(l.bold(`
|
|
889
|
+
Dangerous Patterns (blocked by hooks)
|
|
890
|
+
`));for(let o of["critical","high","medium","low"]){let s=r.filter(a=>a.severity===o);if(s.length===0)continue;let i=mv(o);console.log(i(`${o.toUpperCase()} (${s.length}):`));for(let a of s)console.log(` ${a.description}`);console.log()}}),t.command("monitor").description("[ENTERPRISE] Start system-level enforcement daemon (independent of hooks)").option("-o, --org <orgName>","Organization name").option("--mode <mode>","Enforcement mode: monitor or block","monitor").option("--interval <ms>","Scan interval in milliseconds (0 for realtime)","0").option("--kernel","Enable kernel-level enforcement (requires elevated privileges)").option("--webhook <url>","Webhook URL for violation alerts").option("--daemonize","Run as background daemon").action(async e=>{let n=x();try{let r=M.load(),o=e.org||r.defaultOrg;o||(console.error(l.red("Error: Organization name required.")),console.log(l.dim("Use --org or set defaultOrg in config")),process.exit(1)),n.start(`Loading enforcement policy for ${o}...`);let i=await new ce({apiUrl:r.apiUrl}).getOrgPolicy(o);i||(n.fail("No enforcement policy found"),console.log(l.yellow("Contact your administrator to configure policies")),process.exit(1)),n.succeed(`Loaded policy: ${i.name} (v${i.version})`);let a=await cv({policy:i,watchPaths:[process.cwd(),(0,Yt.join)(process.env.HOME||"",".claude"),(0,Yt.join)(process.env.HOME||"",".cursor")],enforceMode:e.mode==="block"?"block":"monitor",enableKernelEnforcement:e.kernel,alertWebhook:e.webhook,scanInterval:parseInt(e.interval,10)});a.on("started",c=>{console.log(l.green(`
|
|
891
|
+
\u2713 System enforcement started`)),console.log(l.dim(` Mode: ${c.mode}`)),console.log(l.dim(` Platform: ${c.platform}`)),console.log(l.dim(` Kernel enforcement: ${c.kernelEnforcementEnabled?"enabled":"disabled"}`)),console.log(l.dim(` Watching: ${c.watchedPaths.join(", ")}`))}),a.on("violation",c=>{console.log(l.red(`
|
|
892
|
+
\u26A0 POLICY VIOLATION DETECTED`)),console.log(l.dim(` Timestamp: ${c.timestamp}`)),console.log(l.dim(` File: ${c.filePath}`)),console.log(l.dim(` Action: ${c.action}`)),console.log(l.dim(` Violations: ${c.violations.length}`));for(let u of c.violations)console.log(` - [${u.severity}] ${u.message}`)}),a.on("error",c=>{console.error(l.red(`
|
|
893
|
+
\u2717 Enforcement error: ${c.message}`))}),a.on("kernel-enforcement-applied",c=>{console.log(l.blue(`
|
|
894
|
+
\u2713 Kernel enforcement applied: ${c.id}`))}),await a.start(),e.daemonize?(console.log(l.yellow(`
|
|
895
|
+
Daemonization not yet implemented`)),console.log(l.dim("Run without --daemonize flag"))):(console.log(l.blue(`
|
|
896
|
+
Press Ctrl+C to stop enforcement
|
|
897
|
+
`)),process.on("SIGINT",async()=>{console.log(l.yellow(`
|
|
898
|
+
Stopping enforcement...`)),await a.stop(),process.exit(0)}),await new Promise(()=>{}))}catch(r){n.fail("Failed to start system enforcement"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t}async function xO(t){let e=[];for(let[n,r]of Object.entries(Nc))try{(await(0,vt.stat)((0,Yt.join)(t,r))).isDirectory()&&e.push(n)}catch{}return e}async function PO(t,e,n,r){let o=(0,Yt.join)(t,Nc[e]),s=(0,Yt.join)(o,"hooks"),i=(0,Yt.join)(s,"gal-safety-hook.py");if(!r)try{throw await(0,vt.stat)(i),new Error("Hook already exists. Use --force to overwrite.")}catch(f){if(f.code!=="ENOENT")throw f}await(0,vt.mkdir)(s,{recursive:!0});let a=X0(e),c=`# GAL Policy Version: ${n.version}
|
|
899
|
+
# Policy: ${n.name}
|
|
900
|
+
${a.content}`;await(0,vt.writeFile)(i,c,"utf-8"),await(0,vt.chmod)(i,493);let u=(0,Yt.join)(o,"settings.json"),d={};try{let f=await(0,vt.readFile)(u,"utf-8");d=JSON.parse(f)}catch{}let m=d.hooks||{},p=a.settingsSnippet.hooks;d.hooks={...m,...p},await(0,vt.writeFile)(u,JSON.stringify(d,null,2),"utf-8")}function RO(t,e){if(console.log(`
|
|
901
|
+
`+l.bold("GAL Enforcement Scan Report")),console.log("\u2550".repeat(50)),console.log(`Status: ${t.passed?l.green("PASSED"):l.red("FAILED")}`),console.log(`Scanned: ${t.scannedFiles.length} file(s)`),t.summary.total>0&&(console.log(`
|
|
902
|
+
Findings:`),t.summary.critical>0&&console.log(l.red(` Critical: ${t.summary.critical}`)),t.summary.high>0&&console.log(l.yellow(` High: ${t.summary.high}`)),t.summary.medium>0&&console.log(l.blue(` Medium: ${t.summary.medium}`)),t.summary.low>0&&console.log(l.dim(` Low: ${t.summary.low}`))),t.violations.length>0){console.log(`
|
|
903
|
+
`+l.red.bold("Violations:"));for(let n of t.violations)fv(n)}if(t.warnings.length>0){console.log(`
|
|
904
|
+
`+l.yellow.bold("Warnings:"));for(let n of t.warnings)fv(n)}}function fv(t){let e=mv(t.severity);console.log(`
|
|
905
|
+
${e(`[${t.severity.toUpperCase()}]`)} ${t.ruleName}`),console.log(` File: ${l.dim(t.file)}`),console.log(` ${t.message}`),t.suggestion&&console.log(` Fix: ${l.cyan(t.suggestion)}`)}function mv(t){switch(t){case"critical":return l.red.bold;case"high":return l.yellow;case"medium":return l.blue;case"low":return l.dim;default:return l.white}}var Go=require("fs"),Uo=require("path"),jO={claude:".claude",cursor:".cursor",gemini:".gemini",codex:".codex",windsurf:".windsurf"},$O={settings:"",commands:"commands",hooks:"hooks",rule:"rules"},LO={settings:".json",commands:".md",hooks:".py",rule:".md"};function BO(){let t=new F("fetch");return t.description("Fetch agent configurations from GAL API and write to local directory").argument("[orgName]","Organization name (uses default if not specified)").option("-o, --output <path>","Output directory",process.cwd()).option("-p, --platform <platform>","Filter by platform (claude, cursor, gemini, codex, windsurf)").option("--json","Output as JSON (does not write files)").option("--dry-run","Show what would be written without writing").option("--scan","Trigger a fresh scan before fetching").action(async(e,n)=>{try{let r=M.load(),o=e||r.defaultOrg;o||(console.error(l.red("Error: No organization specified and no default set")),console.log(l.dim("Usage: gal fetch <orgName>")),console.log(l.dim(" or: gal config set defaultOrg <orgName>")),process.exit(1));let s=new ce(r);if(n.scan){let d=x(`Scanning ${o}...`).start();try{let m=await s.scanOrganization(o);d.succeed(l.green(`Scan complete: ${m.totalConfigs} configs found`))}catch(m){d.fail(l.red("Scan failed")),console.error(l.dim(m.message)),process.exit(1)}}let i=x(`Downloading configs for ${o}...`).start(),a;try{a=await s.downloadConfigs(o,n.platform)}catch(d){i.fail(l.red(`Failed to download configs for ${o}`)),console.error(l.dim(d.message)),process.exit(1)}if(a.length===0){i.warn(l.yellow(`No configs found for ${o}`));return}if(i.succeed(l.green(`Downloaded ${a.length} configs`)),n.json){console.log(JSON.stringify({organization:o,configs:a},null,2));return}let c=n.output,u=[];console.log(l.blue(`
|
|
906
|
+
Writing configs to ${c}:
|
|
907
|
+
`));for(let d of a){let m=jO[d.platform]||`.${d.platform}`,p=$O[d.type]||d.type,f=LO[d.type]||"",g=d.fileName;g.includes(".")||(g=`${g}${f}`);let h=p?(0,Uo.join)(m,p,g):(0,Uo.join)(m,g),y=(0,Uo.join)(c,h);if(n.dryRun){console.log(l.cyan(" [dry-run]"),h),u.push(h);continue}let _=(0,Uo.dirname)(y);(0,Go.existsSync)(_)||(0,Go.mkdirSync)(_,{recursive:!0}),(0,Go.writeFileSync)(y,d.content,"utf-8"),u.push(h),console.log(l.green(" \u2713"),h)}console.log(l.bold(`
|
|
908
|
+
${n.dryRun?"Would write":"Wrote"} ${u.length} files`)),n.dryRun||console.log(l.dim(`
|
|
909
|
+
Files written to ${c}`))}catch(r){console.error(l.red("Error:"),r.message),process.exit(1)}}),t.command("list").description("List all available organizations").option("--json","Output as JSON").action(async e=>{let n=x("Fetching organizations...").start();try{let r=M.load(),s=await new ce(r).listOrganizations();if(n.stop(),e.json){console.log(JSON.stringify({organizations:s},null,2));return}if(s.length===0){console.log(l.yellow("No organizations found"));return}console.log(l.blue(`Found ${s.length} organizations:
|
|
910
|
+
`));for(let i of s)console.log(l.bold(i.name)),console.log(l.gray(" Repos:"),i.totalRepos),console.log(l.gray(" Commands:"),i.totalCommands),console.log(l.gray(" Hooks:"),i.totalHooks),i.lastScanAt&&console.log(l.gray(" Last Scan:"),new Date(i.lastScanAt).toLocaleString()),console.log()}catch(r){n.fail(l.red("Failed to fetch organizations")),console.error(l.dim(r.message)),process.exit(1)}}),t}var ri=require("node:os"),gv=require("node:child_process"),hv=require("node:fs/promises");var GO={};function pv(){let t=[(0,ri.hostname)(),(0,ri.userInfo)().username,process.platform,process.arch].join(":");return createHash("sha256").update(t).digest("hex").substring(0,16)}function MO(){try{return(0,gv.execSync)("git config user.email",{encoding:"utf-8"}).trim()}catch{return null}}async function tm(){let{stat:t,readFile:e}=await import("node:fs/promises"),{join:n}=await import("node:path"),r=[],o="0.0.0",s="0.0.0",i=[".claude",".cursor",".gemini",".codex",".windsurf"];for(let a of i){let c=n(process.cwd(),a,"hooks","gal-safety-hook.py");try{await t(c),r.push(a.replace(".",""));let d=(await e(c,"utf-8")).match(/GAL Policy Version: ([\d.]+)/);d&&(s=d[1])}catch{}}try{let a=n(GO.url.replace("file://",""),"..","..","..","package.json");o=JSON.parse(await e(a,"utf-8")).version||"0.1.0"}catch{o="0.1.0"}return{installed:r.length>0,version:o,policyVersion:s,platforms:r}}function UO(){let t=new F("fleet").description("Manage developer enrollment and fleet visibility (GAL-99)");return t.command("register").description("Register this machine with your organization").option("-o, --org <orgName>","Organization name").option("-e, --email <email>","Developer email (defaults to git config)").action(async e=>{let n=x();try{let r=M.load(),o=e.org||r.defaultOrg;o||(console.error(l.red("Error: Organization name required.")),console.log(l.dim("Use --org <name> or run: gal config set defaultOrg <your-org>")),process.exit(1));let s=e.email||MO();s||(console.error(l.red("Error: Could not determine email.")),console.log(l.dim("Use --email or configure git: git config user.email <email>")),process.exit(1)),n.start("Checking enforcement status...");let i=await tm();i.installed||(n.warn("No enforcement hooks installed"),console.log(l.yellow(`
|
|
911
|
+
You must install enforcement hooks before registering.`)),console.log(l.dim("Run: gal enforce install --org "+o)),process.exit(1)),n.text=`Registering ${s} with ${o}...`;let a=new ce({apiUrl:r.apiUrl||process.env.GAL_API_URL||Ze,apiKey:r.apiKey}),c={email:s,machineId:pv(),hostname:(0,ri.hostname)(),enforcementStatus:i},u=await a.fleetRegister(o,c);n.succeed(l.green("Successfully registered with organization")),console.log(l.blue(`
|
|
912
|
+
Registration Details:`)),console.log(` Developer ID: ${l.bold(u.developerId)}`),console.log(` Organization: ${l.bold(o)}`),console.log(` Email: ${s}`),console.log(` Platforms: ${i.platforms.join(", ")}`),console.log(` Policy Version: ${i.policyVersion}`),r.fleetDeveloperId=u.developerId,M.save(r),console.log(l.dim(`
|
|
913
|
+
Your enforcement status will be reported automatically.`))}catch(r){n.fail("Registration failed"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("status").description("Check your enrollment and compliance status").option("--json","Output as JSON").action(async e=>{let n=x({isSilent:e.json});try{let r=M.load();if(!r.fleetDeveloperId){e.json?console.log(JSON.stringify({enrolled:!1})):(console.log(l.yellow("Not enrolled in fleet management.")),console.log(l.dim("Run: gal fleet register --org <your-org>")));return}n.start("Checking fleet status...");let s=await new ce({apiUrl:r.apiUrl||process.env.GAL_API_URL||Ze,apiKey:r.apiKey}).fleetStatus(r.fleetDeveloperId),i=await tm();if(n.stop(),e.json){console.log(JSON.stringify({...s,localStatus:i},null,2));return}if(console.log(l.bold(`
|
|
914
|
+
Fleet Enrollment Status
|
|
915
|
+
`)),console.log("\u2500".repeat(50)),console.log(` ${l.green("\u2713")} Enrolled: ${l.bold("Yes")}`),console.log(` Developer ID: ${r.fleetDeveloperId}`),console.log(` Organization: ${s.organizationName||"Unknown"}`),s.lastCheckIn){let a=new Date(s.lastCheckIn);console.log(` Last Check-in: ${a.toLocaleString()}`)}if(s.complianceScore!==void 0){let a=s.complianceScore>=80?l.green:s.complianceScore>=50?l.yellow:l.red;console.log(` Compliance Score: ${a(s.complianceScore+"%")}`)}console.log(l.blue(`
|
|
916
|
+
Local Enforcement:`)),console.log(` Installed: ${i.installed?l.green("Yes"):l.red("No")}`),console.log(` Platforms: ${i.platforms.join(", ")||"None"}`),console.log(` Policy Version: ${i.policyVersion}`),s.policyUpdate?.available&&(console.log(l.yellow(`
|
|
917
|
+
\u26A0 Policy update available: v${s.policyUpdate.version}`)),console.log(l.dim("Run: gal enforce install --force")))}catch(r){n.fail("Failed to check status"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("check-in").description("Send a manual status check-in to the organization").action(async()=>{let e=x();try{let n=M.load();n.fleetDeveloperId||(console.error(l.red("Not enrolled in fleet management.")),console.log(l.dim("Run: gal fleet register --org <your-org>")),process.exit(1)),e.start("Sending check-in...");let r=new ce({apiUrl:n.apiUrl||process.env.GAL_API_URL||Ze,apiKey:n.apiKey}),o=await tm(),s={developerId:n.fleetDeveloperId,machineId:pv(),enforcementStatus:o},i=await r.fleetHeartbeat(s);e.succeed("Check-in complete"),i.policyUpdate?.available&&(console.log(l.yellow(`
|
|
918
|
+
\u26A0 Policy update available: v${i.policyUpdate.version}`)),console.log(l.dim("Run: gal enforce install --force")))}catch(n){e.fail("Check-in failed"),n instanceof Error&&console.error(l.red(n.message)),process.exit(1)}}),t.command("list").description("List all enrolled developers (admin only)").option("-o, --org <orgName>","Organization name").option("--status <status>","Filter by status (compliant, non-compliant, all)","all").option("--json","Output as JSON").action(async e=>{let n=x({isSilent:e.json});try{let r=M.load(),o=e.org||r.defaultOrg;o||(console.error(l.red("Error: Organization name required.")),process.exit(1)),n.start(`Fetching fleet data for ${o}...`);let i=await new ce({apiUrl:r.apiUrl||process.env.GAL_API_URL||Ze,apiKey:r.apiKey}).fleetList(o,e.status);if(n.stop(),e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(l.bold(`
|
|
919
|
+
Fleet Status: ${o}
|
|
920
|
+
`)),console.log("\u2500".repeat(80)),console.log(l.blue("Summary:")),console.log(` Total Developers: ${l.bold(i.total)}`),console.log(` Compliant: ${l.green(i.compliant)}`),console.log(` Non-Compliant: ${l.red(i.nonCompliant)}`),console.log(),i.developers.length===0){console.log(l.dim("No developers found."));return}console.log(l.blue("Developers:")),console.log(),console.log(l.dim(" "+"Email".padEnd(30)+"Status".padEnd(15)+"Policy".padEnd(10)+"Last Check-in".padEnd(20)+"Violations")),console.log(" "+"\u2500".repeat(78));for(let a of i.developers){let c=a.enforcementInstalled?l.green("\u2713"):l.red("\u2717"),u=a.enforcementInstalled?"Enforced":"Not enforced",d=a.lastCheckIn?new Date(a.lastCheckIn).toLocaleDateString():"Never",m=a.violations>0?l.yellow(String(a.violations)):l.dim("0");console.log(` ${c} `+a.email.padEnd(28)+u.padEnd(15)+`v${a.policyVersion}`.padEnd(10)+d.padEnd(20)+m)}console.log(`
|
|
921
|
+
`+"\u2500".repeat(80)),console.log(l.dim(`Last updated: ${i.lastUpdated}`))}catch(r){n.fail("Failed to fetch fleet data"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("report").description("Generate fleet compliance report (admin only)").option("-o, --org <orgName>","Organization name").option("--json","Output as JSON").action(async e=>{let n=x({isSilent:e.json});try{let r=M.load(),o=e.org||r.defaultOrg;o||(console.error(l.red("Error: Organization name required.")),process.exit(1)),n.start(`Generating compliance report for ${o}...`);let i=await new ce({apiUrl:r.apiUrl||process.env.GAL_API_URL||Ze,apiKey:r.apiKey}).fleetReport(o);if(n.stop(),e.json){console.log(JSON.stringify(i,null,2));return}console.log(l.bold.blue(`
|
|
922
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.bold.blue(" FLEET COMPLIANCE REPORT")),console.log(l.bold.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
923
|
+
`)),console.log(`Organization: ${l.bold(i.organizationName)}`),console.log(`Generated: ${new Date(i.generatedAt).toLocaleString()}`),console.log(),console.log(l.blue(`\u2500\u2500\u2500 Summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
924
|
+
`));let a=i.summary.totalDevelopers>0?Math.round(i.summary.enrolled/i.summary.totalDevelopers*100):0,c=i.summary.enrolled>0?Math.round(i.summary.compliant/i.summary.enrolled*100):0;if(console.log(` Total Developers: ${l.bold(i.summary.totalDevelopers)}`),console.log(` Enrolled: ${l.bold(i.summary.enrolled)} (${a}%)`),console.log(` Compliant: ${l.green.bold(i.summary.compliant)} (${c}%)`),console.log(` Non-Compliant: ${l.red.bold(i.summary.nonCompliant)}`),console.log(` Active (24h): ${i.summary.activeLastDay}`),console.log(` Active (7d): ${i.summary.activeLastWeek}`),console.log(),i.recommendations.length>0){console.log(l.blue(`\u2500\u2500\u2500 Recommendations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
925
|
+
`));for(let u of i.recommendations)console.log(` \u2022 ${u}`);console.log()}console.log(l.bold.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
926
|
+
`))}catch(r){n.fail("Failed to generate report"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("export").description("Export fleet data to file (admin only)").option("-o, --org <orgName>","Organization name").option("-f, --format <format>","Export format (json, csv)","csv").option("--output <file>","Output file path").action(async e=>{let n=x();try{let r=M.load(),o=e.org||r.defaultOrg;o||(console.error(l.red("Error: Organization name required.")),process.exit(1)),n.start(`Exporting fleet data for ${o}...`);let i=await new ce({apiUrl:r.apiUrl||process.env.GAL_API_URL||Ze,apiKey:r.apiKey}).fleetList(o,"all"),a=new Date().toISOString().split("T")[0],c=e.output||`fleet-export-${o}-${a}.${e.format}`,u;if(e.format==="csv"){let d=["Email","Machine ID","Enforcement Installed","Policy Version","Last Check-in","Compliance Score","Violations"],m=i.developers.map(p=>[p.email,p.machineId,p.enforcementInstalled?"Yes":"No",p.policyVersion,p.lastCheckIn||"Never",String(p.complianceScore),String(p.violations)]);u=[d.join(","),...m.map(p=>p.join(","))].join(`
|
|
927
|
+
`)}else u=JSON.stringify(i,null,2);await(0,hv.writeFile)(c,u,"utf-8"),n.succeed(`Exported to ${l.bold(c)}`),console.log(l.dim(` ${i.developers.length} developer(s) exported`))}catch(r){n.fail("Export failed"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t.command("unenroll").description("Remove this machine from fleet management").option("--force","Skip confirmation").action(async e=>{let n=M.load();if(!n.fleetDeveloperId){console.log(l.yellow("Not enrolled in fleet management."));return}if(!e.force){console.log(l.yellow("Warning: This will remove your machine from fleet management.")),console.log(l.dim("Your organization may require fleet enrollment.")),console.log(l.dim(`
|
|
928
|
+
Use --force to confirm.`));return}try{await new ce({apiUrl:n.apiUrl||process.env.GAL_API_URL||Ze,apiKey:n.apiKey}).fleetUnenroll(n.fleetDeveloperId),delete n.fleetDeveloperId,M.save(n),console.log(l.green("Successfully unenrolled from fleet management."))}catch(r){r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}}),t}var yv=require("child_process"),At=require("fs"),Vo=require("path"),VO={dataDir:".gal/headless",logDir:".gal/headless/logs",maxConcurrentTasks:3,defaultTimeout:36e5,retryDelay:6e4},bv={"review-all-prs":{name:"Review All Open PRs",command:'gh pr list --state open --json number,title | jq -r ".[].number" | xargs -I {} gh pr review {} --comment --body "Automated review by GAL"',timeout:72e5},"compliance-scan":{name:"Organization Compliance Scan",command:"gal compliance assess --all-repos --output compliance-report.json",timeout:36e5},"dependency-update":{name:"Update Dependencies",command:"pnpm update --latest && pnpm audit fix",timeout:18e5},"security-audit":{name:"Security Audit",command:"gal audit tokens && gal check --report",timeout:18e5},"test-suite":{name:"Full Test Suite",command:"pnpm test --coverage && pnpm e2e",timeout:72e5}},ar=class{config;tasks=new Map;runningProcesses=new Map;projectPath;constructor(e=process.cwd(),n={}){this.projectPath=e,this.config={...VO,...n},this.ensureDirectories(),this.loadTasks()}ensureDirectories(){let e=(0,Vo.join)(this.projectPath,this.config.dataDir),n=(0,Vo.join)(this.projectPath,this.config.logDir);(0,At.existsSync)(e)||(0,At.mkdirSync)(e,{recursive:!0}),(0,At.existsSync)(n)||(0,At.mkdirSync)(n,{recursive:!0})}loadTasks(){let e=(0,Vo.join)(this.projectPath,this.config.dataDir,"tasks.json");if((0,At.existsSync)(e))try{let n=JSON.parse((0,At.readFileSync)(e,"utf-8"));for(let r of n.tasks||[])this.tasks.set(r.id,{...r,createdAt:new Date(r.createdAt),startedAt:r.startedAt?new Date(r.startedAt):void 0,completedAt:r.completedAt?new Date(r.completedAt):void 0})}catch{}}saveTasks(){let e=(0,Vo.join)(this.projectPath,this.config.dataDir,"tasks.json"),n={tasks:Array.from(this.tasks.values()),updatedAt:new Date().toISOString()};(0,At.writeFileSync)(e,JSON.stringify(n,null,2))}createTask(e){let n={id:`task_${Date.now()}_${Math.random().toString(36).substring(7)}`,name:e.name,command:e.command,schedule:e.schedule,status:e.schedule?"scheduled":"pending",createdAt:new Date,retries:0,maxRetries:e.maxRetries||3,timeout:e.timeout||this.config.defaultTimeout,notify:e.notify};return this.tasks.set(n.id,n),this.saveTasks(),n}createFromTemplate(e,n){let r=bv[e];return r?this.createTask({name:r.name||e,command:r.command||"",timeout:r.timeout,...n}):null}async runTask(e){let n=this.tasks.get(e);if(!n)throw new Error(`Task not found: ${e}`);if(this.runningProcesses.size>=this.config.maxConcurrentTasks)throw new Error(`Maximum concurrent tasks (${this.config.maxConcurrentTasks}) reached`);n.status="running",n.startedAt=new Date,this.saveTasks();let r=(0,Vo.join)(this.projectPath,this.config.logDir,`${n.id}_${Date.now()}.log`);return console.log(l.blue(`
|
|
929
|
+
\u{1F680} Starting task: ${n.name}
|
|
930
|
+
`)),console.log(l.gray(` ID: ${n.id}`)),console.log(l.gray(` Command: ${n.command}`)),console.log(l.gray(` Log file: ${r}
|
|
931
|
+
`)),new Promise(o=>{let s=(0,yv.spawn)("sh",["-c",n.command],{cwd:this.projectPath,env:{...process.env,GAL_HEADLESS:"true",GAL_TASK_ID:n.id},detached:!0});this.runningProcesses.set(n.id,s);let i=(c,u=!1)=>{let d=c.toString(),m=u?"[ERROR] ":"";(0,At.appendFileSync)(r,`${new Date().toISOString()} ${m}${d}`),n.output||(n.output=""),n.output+=d};s.stdout?.on("data",c=>i(c)),s.stderr?.on("data",c=>i(c,!0));let a=setTimeout(()=>{console.log(l.yellow(`
|
|
932
|
+
\u23F0 Task ${n.id} timed out
|
|
933
|
+
`)),s.kill("SIGTERM"),setTimeout(()=>s.kill("SIGKILL"),5e3)},n.timeout);s.on("close",c=>{clearTimeout(a),this.runningProcesses.delete(n.id),n.completedAt=new Date,n.exitCode=c||0,c===0?(n.status="completed",console.log(l.green(`
|
|
934
|
+
\u2705 Task completed: ${n.name}
|
|
935
|
+
`))):(n.status="failed",n.error=`Exit code: ${c}`,console.log(l.red(`
|
|
936
|
+
\u274C Task failed: ${n.name} (exit code: ${c})
|
|
937
|
+
`)),n.retries<n.maxRetries&&(n.retries++,console.log(l.yellow(` Retry ${n.retries}/${n.maxRetries} scheduled
|
|
938
|
+
`)),setTimeout(()=>this.runTask(n.id),this.config.retryDelay))),this.saveTasks(),this.sendNotifications(n),o(n)}),s.on("error",c=>{clearTimeout(a),this.runningProcesses.delete(n.id),n.status="failed",n.completedAt=new Date,n.error=c.message,this.saveTasks(),o(n)})})}scheduleTask(e,n){let r=this.tasks.get(e);if(!r)throw new Error(`Task not found: ${e}`);r.schedule=n,r.status="scheduled",this.saveTasks(),console.log(l.blue(`
|
|
939
|
+
\u{1F4C5} Task scheduled: ${r.name}`)),console.log(l.gray(` Cron: ${n}`)),console.log(l.gray(` Next run: Use 'gal headless status' to check
|
|
940
|
+
`))}getTask(e){return this.tasks.get(e)}listTasks(e){let n=Array.from(this.tasks.values());return e?.status&&(n=n.filter(r=>r.status===e.status)),n.sort((r,o)=>o.createdAt.getTime()-r.createdAt.getTime())}cancelTask(e){let n=this.runningProcesses.get(e);if(!n)return!1;n.kill("SIGTERM"),setTimeout(()=>n.kill("SIGKILL"),5e3);let r=this.tasks.get(e);return r&&(r.status="failed",r.error="Cancelled by user",r.completedAt=new Date,this.saveTasks()),this.runningProcesses.delete(e),!0}deleteTask(e){this.cancelTask(e);let n=this.tasks.delete(e);return n&&this.saveTasks(),n}getTaskLogs(e){let n=this.tasks.get(e);return n?n.output||"No output captured":null}async sendNotifications(e){if(!(!e.notify||!(e.status==="completed"&&e.notify.onComplete||e.status==="failed"&&e.notify.onFailure))){if(e.notify.webhook)try{await fetch(e.notify.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({task:{id:e.id,name:e.name,status:e.status,completedAt:e.completedAt,exitCode:e.exitCode,error:e.error}})})}catch(r){console.log(l.yellow(`Failed to send webhook notification: ${r}`))}console.log(l.blue(`
|
|
941
|
+
\u{1F4EC} Notification sent for task: ${e.name}
|
|
942
|
+
`))}}displayStatus(){console.log(l.blue(`
|
|
943
|
+
\u{1F4CB} Headless Task Status
|
|
944
|
+
`));let e=this.listTasks({status:"running"}),n=this.listTasks({status:"scheduled"}),r=this.listTasks().slice(0,10);if(console.log(l.white(`Running: ${e.length}/${this.config.maxConcurrentTasks}`)),e.length>0){console.log(l.green(`
|
|
945
|
+
\u{1F3C3} Running Tasks:
|
|
946
|
+
`));for(let o of e){let s=o.startedAt?Math.round((Date.now()-o.startedAt.getTime())/1e3):0;console.log(` ${o.name} (${o.id})`),console.log(l.gray(` Running for: ${s}s`))}}if(n.length>0){console.log(l.blue(`
|
|
947
|
+
\u{1F4C5} Scheduled Tasks:
|
|
948
|
+
`));for(let o of n)console.log(` ${o.name}`),console.log(l.gray(` Cron: ${o.schedule}`))}console.log(l.white(`
|
|
949
|
+
\u{1F4DC} Recent Tasks:
|
|
950
|
+
`)),console.log(l.gray(" Name Status Duration")),console.log(l.gray(" "+"\u2500".repeat(60)));for(let o of r){let s=o.name.substring(0,30).padEnd(30),i=o.status.padEnd(10),a=o.startedAt&&o.completedAt?`${Math.round((o.completedAt.getTime()-o.startedAt.getTime())/1e3)}s`:"-",c={pending:l.gray,running:l.blue,completed:l.green,failed:l.red,scheduled:l.cyan}[o.status];console.log(` ${s} ${c(i)} ${a}`)}console.log("")}};function vv(){let t=new F("headless").description("Autonomous task execution for overnight jobs");return t.command("run").description("Run a task").option("--task <name>","Task template name or custom command").option("--command <cmd>","Custom command to run").option("--timeout <ms>","Timeout in milliseconds","3600000").option("--notify-webhook <url>","Webhook URL for notifications").action(async e=>{let n=new ar,r=null;if(e.task?(r=n.createFromTemplate(e.task),!r&&e.command&&(r=n.createTask({name:e.task,command:e.command,timeout:parseInt(e.timeout,10),notify:e.notifyWebhook?{webhook:e.notifyWebhook,onComplete:!0,onFailure:!0}:void 0}))):e.command&&(r=n.createTask({name:"Custom Task",command:e.command,timeout:parseInt(e.timeout,10),notify:e.notifyWebhook?{webhook:e.notifyWebhook,onComplete:!0,onFailure:!0}:void 0})),!r){console.log(l.red(`
|
|
951
|
+
Please specify --task or --command
|
|
952
|
+
`)),console.log("Available templates:");for(let[o,s]of Object.entries(bv))console.log(l.gray(` ${o}: ${s.name}`));return}await n.runTask(r.id)}),t.command("schedule").description("Schedule a task with cron expression").requiredOption("--task <name>","Task name").requiredOption("--cron <expression>",'Cron expression (e.g., "0 2 * * *")').option("--command <cmd>","Command to run").action(async e=>{let n=new ar,r=n.createFromTemplate(e.task,{command:e.command});if(!r&&e.command&&(r=n.createTask({name:e.task,command:e.command})),!r){console.log(l.red(`
|
|
953
|
+
Invalid task template. Use --command for custom tasks.
|
|
954
|
+
`));return}n.scheduleTask(r.id,e.cron)}),t.command("status").description("Show status of headless tasks").action(()=>{new ar().displayStatus()}),t.command("logs").description("Show logs for a task").argument("<task-id>","Task ID").action(e=>{let r=new ar().getTaskLogs(e);r?(console.log(l.blue(`
|
|
955
|
+
\u{1F4DC} Logs for task ${e}:
|
|
956
|
+
`)),console.log(r)):console.log(l.red(`
|
|
957
|
+
Task not found: ${e}
|
|
958
|
+
`))}),t.command("cancel").description("Cancel a running task").argument("<task-id>","Task ID").action(e=>{let r=new ar().cancelTask(e);console.log(r?l.green(`
|
|
959
|
+
\u2705 Task cancelled: ${e}
|
|
960
|
+
`):l.yellow(`
|
|
961
|
+
Task not running: ${e}
|
|
962
|
+
`))}),t.command("list").description("List all tasks").option("--status <status>","Filter by status").action(e=>{new ar().displayStatus()}),t}var oi=require("node:os"),Sv=require("node:child_process"),si=require("node:fs/promises"),nm=require("node:path");function qO(){let t=[(0,oi.hostname)(),(0,oi.userInfo)().username,process.platform,process.arch].join(":");return createHash("sha256").update(t).digest("hex").substring(0,16)}function HO(){try{return(0,Sv.execSync)("git config user.email",{encoding:"utf-8"}).trim()}catch{return null}}async function WO(t,e,n){let r=`.${t}`,o=(0,nm.join)(process.cwd(),r,"hooks");try{await(0,si.mkdir)(o,{recursive:!0});let s=JO(e,n,t),i=(0,nm.join)(o,"gal-safety-hook.py");return await(0,si.writeFile)(i,s,"utf-8"),!0}catch{return!1}}function JO(t,e,n){return`#!/usr/bin/env python3
|
|
963
|
+
"""
|
|
964
|
+
GAL Safety Enforcement Hook
|
|
965
|
+
Organization: ${t}
|
|
966
|
+
GAL Policy Version: ${e}
|
|
967
|
+
Platform: ${n}
|
|
968
|
+
Generated: ${new Date().toISOString()}
|
|
969
|
+
|
|
970
|
+
This hook enforces organization security policies on AI agent operations.
|
|
971
|
+
DO NOT MODIFY - This file is managed by GAL.
|
|
972
|
+
"""
|
|
973
|
+
|
|
974
|
+
import sys
|
|
975
|
+
import json
|
|
976
|
+
import os
|
|
977
|
+
from datetime import datetime
|
|
978
|
+
|
|
979
|
+
# Policy configuration
|
|
980
|
+
ORG_NAME = "${t}"
|
|
981
|
+
POLICY_VERSION = "${e}"
|
|
982
|
+
PLATFORM = "${n}"
|
|
983
|
+
|
|
984
|
+
# Blocked patterns (customizable via organization policy)
|
|
985
|
+
BLOCKED_PATTERNS = [
|
|
986
|
+
# Secrets and credentials
|
|
987
|
+
r'password\\s*=',
|
|
988
|
+
r'api[_-]?key\\s*=',
|
|
989
|
+
r'secret\\s*=',
|
|
990
|
+
r'token\\s*=',
|
|
991
|
+
r'credentials',
|
|
992
|
+
# Dangerous operations
|
|
993
|
+
r'rm\\s+-rf\\s+/',
|
|
994
|
+
r'sudo\\s+rm',
|
|
995
|
+
r'curl.*\\|.*sh',
|
|
996
|
+
r'wget.*\\|.*sh',
|
|
997
|
+
# Package manager attacks
|
|
998
|
+
r'npm\\s+publish',
|
|
999
|
+
r'pip\\s+upload',
|
|
1000
|
+
]
|
|
1001
|
+
|
|
1002
|
+
# Allowed paths (everything else is restricted)
|
|
1003
|
+
ALLOWED_PATHS = [
|
|
1004
|
+
os.getcwd(),
|
|
1005
|
+
'/tmp/gal-',
|
|
1006
|
+
]
|
|
1007
|
+
|
|
1008
|
+
def log_event(event_type: str, details: dict):
|
|
1009
|
+
"""Log security event for audit trail"""
|
|
1010
|
+
event = {
|
|
1011
|
+
'timestamp': datetime.utcnow().isoformat(),
|
|
1012
|
+
'type': event_type,
|
|
1013
|
+
'org': ORG_NAME,
|
|
1014
|
+
'policy_version': POLICY_VERSION,
|
|
1015
|
+
'platform': PLATFORM,
|
|
1016
|
+
**details
|
|
1017
|
+
}
|
|
1018
|
+
# In production, this would send to GAL telemetry
|
|
1019
|
+
# For now, log to stderr for visibility
|
|
1020
|
+
print(f"[GAL] {json.dumps(event)}", file=sys.stderr)
|
|
1021
|
+
|
|
1022
|
+
def check_operation(operation: dict) -> tuple[bool, str]:
|
|
1023
|
+
"""
|
|
1024
|
+
Check if an operation is allowed by policy.
|
|
1025
|
+
Returns (allowed, reason)
|
|
1026
|
+
"""
|
|
1027
|
+
import re
|
|
1028
|
+
|
|
1029
|
+
op_type = operation.get('type', '')
|
|
1030
|
+
content = operation.get('content', '')
|
|
1031
|
+
path = operation.get('path', '')
|
|
1032
|
+
|
|
1033
|
+
# Check blocked patterns
|
|
1034
|
+
for pattern in BLOCKED_PATTERNS:
|
|
1035
|
+
if re.search(pattern, content, re.IGNORECASE):
|
|
1036
|
+
return False, f"Blocked pattern detected: {pattern}"
|
|
1037
|
+
|
|
1038
|
+
# Check path restrictions for file operations
|
|
1039
|
+
if op_type in ['write', 'edit', 'delete']:
|
|
1040
|
+
path_allowed = any(path.startswith(allowed) for allowed in ALLOWED_PATHS)
|
|
1041
|
+
if not path_allowed:
|
|
1042
|
+
return False, f"Path not in allowed list: {path}"
|
|
1043
|
+
|
|
1044
|
+
return True, "OK"
|
|
1045
|
+
|
|
1046
|
+
def main():
|
|
1047
|
+
"""Main hook entry point"""
|
|
1048
|
+
try:
|
|
1049
|
+
# Read operation from stdin (Claude Code sends JSON)
|
|
1050
|
+
input_data = sys.stdin.read()
|
|
1051
|
+
if not input_data.strip():
|
|
1052
|
+
return 0
|
|
1053
|
+
|
|
1054
|
+
operation = json.loads(input_data)
|
|
1055
|
+
|
|
1056
|
+
# Check operation against policy
|
|
1057
|
+
allowed, reason = check_operation(operation)
|
|
1058
|
+
|
|
1059
|
+
if not allowed:
|
|
1060
|
+
log_event('blocked', {
|
|
1061
|
+
'reason': reason,
|
|
1062
|
+
'operation': operation.get('type', 'unknown'),
|
|
1063
|
+
})
|
|
1064
|
+
print(json.dumps({
|
|
1065
|
+
'allowed': False,
|
|
1066
|
+
'reason': reason,
|
|
1067
|
+
'policy': POLICY_VERSION,
|
|
1068
|
+
}))
|
|
1069
|
+
return 1
|
|
1070
|
+
|
|
1071
|
+
log_event('allowed', {
|
|
1072
|
+
'operation': operation.get('type', 'unknown'),
|
|
1073
|
+
})
|
|
1074
|
+
print(json.dumps({
|
|
1075
|
+
'allowed': True,
|
|
1076
|
+
'policy': POLICY_VERSION,
|
|
1077
|
+
}))
|
|
1078
|
+
return 0
|
|
1079
|
+
|
|
1080
|
+
except json.JSONDecodeError as e:
|
|
1081
|
+
log_event('error', {'error': f'Invalid JSON: {e}'})
|
|
1082
|
+
return 1
|
|
1083
|
+
except Exception as e:
|
|
1084
|
+
log_event('error', {'error': str(e)})
|
|
1085
|
+
return 1
|
|
1086
|
+
|
|
1087
|
+
if __name__ == '__main__':
|
|
1088
|
+
sys.exit(main())
|
|
1089
|
+
`}function YO(){return new F("join").description("Join an organization using an invite code (GAL-100)").option("-c, --code <code>","Invite code (e.g., GAL-XXXX-XXXX)").option("-e, --email <email>","Developer email (defaults to git config)").option("--skip-hooks","Skip enforcement hook installation").option("--dry-run","Validate invite without joining").action(async e=>{let n=x();if(!e.code){console.log(l.bold(`
|
|
1090
|
+
GAL Developer Onboarding
|
|
1091
|
+
`)),console.log("To join your organization, you need an invite code from your CISO."),console.log(l.dim(`
|
|
1092
|
+
Usage:`)),console.log(l.cyan(" gal join --code GAL-XXXX-XXXX")),console.log(l.dim(`
|
|
1093
|
+
The invite code is generated by your organization administrator.`)),console.log(l.dim(`Contact your security team if you haven't received one.
|
|
1094
|
+
`));return}try{let r=e.email||HO();r||(console.error(l.red("Error: Could not determine your email.")),console.log(l.dim("Use --email <your-email> or configure git:")),console.log(l.dim(" git config user.email your@email.com")),process.exit(1));let o=M.load(),s=new ce({apiUrl:o.apiUrl||process.env.GAL_API_URL||Ze,apiKey:o.apiKey});n.start(`Validating invite code ${l.bold(e.code)}...`);let i=await s.validateInvite(e.code);(!i.valid||!i.invite||!i.organization)&&(n.fail(l.red("Invalid invite code")),console.error(l.red(`
|
|
1095
|
+
Error: ${i.error||"Unknown error"}`)),console.log(l.dim(`
|
|
1096
|
+
Contact your organization administrator for a valid code.`)),process.exit(1)),n.succeed("Invite code validated");let a=i.organization;console.log(l.blue(`
|
|
1097
|
+
Organization Details:`)),console.log(` Name: ${l.bold(a.name)}`),console.log(` Plan: ${l.bold(a.planTier)}`),console.log(` Seats: ${a.seatsUsed}/${a.seatsLimit===-1?"\u221E":a.seatsLimit} used`),a.seatsAvailable===0&&(console.log(l.red(`
|
|
1098
|
+
\u2717 No seats available`)),console.log(l.dim("Your organization has reached its seat limit.")),console.log(l.dim("Contact your administrator to upgrade the plan.")),process.exit(1)),console.log(l.green(` Available: ${a.seatsAvailable===-1?"\u221E":a.seatsAvailable} seat(s)`));let c=new Date(i.invite.expiresAt),u=Math.ceil((c.getTime()-Date.now())/(1e3*60*60*24));if(u<=7&&console.log(l.yellow(` \u26A0 Invite expires in ${u} day(s)`)),e.dryRun){console.log(l.blue(`
|
|
1099
|
+
[Dry run] Validation successful. No changes made.`));return}n.start(`Joining ${a.name}...`);let d=await s.useInvite(e.code,{email:r,machineId:qO(),hostname:(0,oi.hostname)()});if(d.success||(n.fail("Failed to join organization"),console.error(l.red(`
|
|
1100
|
+
Error: ${d.error||"Unknown error"}`)),process.exit(1)),n.succeed(`Joined ${l.bold(a.name)}`),o.fleetDeveloperId=d.developerId,o.defaultOrg=a.name,M.save(o),console.log(l.blue(`
|
|
1101
|
+
Developer Registration:`)),console.log(` Developer ID: ${l.bold(d.developerId)}`),console.log(` Email: ${r}`),console.log(` Policy Version: ${d.policyVersion||"1.0.0"}`),e.skipHooks)console.log(l.yellow(`
|
|
1102
|
+
\u26A0 Enforcement hooks not installed (--skip-hooks)`)),console.log(l.dim("Run: gal enforce install --org "+a.name));else{console.log(l.blue(`
|
|
1103
|
+
Installing enforcement hooks...`));let m=["claude","cursor"],p=0;for(let f of m)await WO(f,a.name,d.policyVersion||"1.0.0")?(console.log(l.green(` \u2713 ${f}`)),p++):console.log(l.yellow(` \u26A0 ${f} (skipped)`));p>0&&console.log(l.dim(`
|
|
1104
|
+
Installed ${p} enforcement hook(s)`))}console.log(l.green.bold(`
|
|
1105
|
+
\u2713 Setup Complete!
|
|
1106
|
+
`)),console.log("You are now enrolled in your organization's fleet management."),console.log(l.dim(`Your CISO can now see your enforcement status.
|
|
1107
|
+
`)),console.log(l.blue("Next steps:")),console.log(" 1. Run "+l.cyan("gal fleet status")+" to check your status"),console.log(" 2. Run "+l.cyan("gal fleet check-in")+" to send a manual check-in"),console.log(` 3. Start working with AI agents - enforcement is active!
|
|
1108
|
+
`)}catch(r){n.fail("Setup failed"),r instanceof Error&&console.error(l.red(r.message)),process.exit(1)}})}var Hr=class{config;tasks=[{id:"dep-update-check",description:"Check for dependency updates",schedule:"weekly",priority:"medium"},{id:"security-audit",description:"Run security vulnerability scan",schedule:"daily",priority:"high"},{id:"lint-check",description:"Run linting checks",schedule:"on-commit",priority:"low"},{id:"type-check",description:"Run TypeScript type checking",schedule:"on-commit",priority:"low"},{id:"doc-sync",description:"Sync documentation",schedule:"weekly",priority:"low"},{id:"cache-cleanup",description:"Clean up caches and temp files",schedule:"monthly",priority:"low"}];constructor(e={}){this.config=e}getAvailableTasks(){return this.tasks}async runTask(e){if(!this.tasks.find(o=>o.id===e))return{success:!1,error:`Unknown task: ${e}`};let r=Date.now();switch(e){case"dep-update-check":return{success:!0,duration:Date.now()-r,updates:[{name:"typescript",current:"5.2.0",latest:"5.3.0",type:"minor"},{name:"eslint",current:"8.50.0",latest:"8.55.0",type:"minor"}]};case"security-audit":return{success:!0,duration:Date.now()-r,vulnerabilities:[],message:"No vulnerabilities found"};case"cache-cleanup":return{success:!0,duration:Date.now()-r,bytesFreed:52428800,filesRemoved:127};default:return{success:!0,duration:Date.now()-r,message:`Task ${e} completed`}}}};function KO(){let t=new F("maintain").description("Run maintenance automation tasks");return t.addCommand(new F("run").description("Run maintenance tasks").option("-t, --tasks <tasks...>","Specific tasks to run").option("--all","Run all maintenance tasks").option("-p, --path <path>","Project path",process.cwd()).option("--dry-run","Preview actions without executing").option("--json","Output results as JSON").action(async e=>{let n=x("Initializing maintenance hooks...").start();try{let r=new Hr({projectPath:e.path,dryRun:e.dryRun}),o=e.tasks;(e.all||!o||o.length===0)&&(o=r.getAvailableTasks().map(a=>a.id)),n.text=`Running ${o.length} maintenance task(s)...`;let s=[];for(let a of o){n.text=`Running: ${a}...`;let c=await r.runTask(a);s.push({task:a,...c})}n.stop(),e.json?console.log(JSON.stringify(s,null,2)):console.log(zO(s)),s.filter(a=>!a.success).length>0&&process.exit(1)}catch(r){n.fail(l.red("Maintenance failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("list").description("List available maintenance tasks").action(()=>{let n=new Hr().getAvailableTasks();console.log(l.blue.bold(`
|
|
1109
|
+
Available Maintenance Tasks
|
|
1110
|
+
`)),console.log("\u2500".repeat(60));for(let r of n)console.log(`
|
|
1111
|
+
${l.cyan(r.id)}`),console.log(` ${r.description}`),console.log(` Schedule: ${l.dim(r.schedule||"manual")}`),console.log(` Priority: ${ZO(r.priority)}`);console.log(`
|
|
1112
|
+
`+"\u2500".repeat(60)),console.log(l.dim(`
|
|
1113
|
+
Run: gal maintain run --tasks <task-id> or --all`))})),t.addCommand(new F("deps").description("Check and update dependencies").option("--security-only","Only check security updates").option("--update","Apply updates").action(async e=>{let n=x("Checking dependencies...").start();try{let o=await new Hr().runTask("dep-update-check");if(n.stop(),console.log(l.blue.bold(`
|
|
1114
|
+
Dependency Check Results
|
|
1115
|
+
`)),console.log("\u2500".repeat(50)),o.updates&&o.updates.length>0){console.log(`
|
|
1116
|
+
Updates available: ${o.updates.length}`);for(let s of o.updates.slice(0,10)){let i=s.type==="security"?l.red:l.yellow;console.log(` ${i("\u25CF")} ${s.name}: ${s.current} \u2192 ${s.latest}`)}o.updates.length>10&&console.log(l.dim(` ... and ${o.updates.length-10} more`)),e.update?(console.log(`
|
|
1117
|
+
Applying updates...`),console.log(l.green("Updates applied!"))):console.log(l.dim(`
|
|
1118
|
+
Run with --update to apply updates`))}else console.log(l.green(`
|
|
1119
|
+
All dependencies are up to date!`))}catch(r){n.fail(l.red("Dependency check failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("security").description("Run security audit").option("--fix","Auto-fix vulnerabilities where possible").action(async e=>{let n=x("Running security audit...").start();try{let o=await new Hr().runTask("security-audit");if(n.stop(),console.log(l.blue.bold(`
|
|
1120
|
+
Security Audit Results
|
|
1121
|
+
`)),console.log("\u2500".repeat(50)),o.vulnerabilities&&o.vulnerabilities.length>0){let s=o.vulnerabilities.filter(u=>u.severity==="critical"),i=o.vulnerabilities.filter(u=>u.severity==="high"),a=o.vulnerabilities.filter(u=>u.severity==="medium"),c=o.vulnerabilities.filter(u=>u.severity==="low");console.log(`
|
|
1122
|
+
Vulnerabilities found: ${o.vulnerabilities.length}`),console.log(` ${l.red("Critical")}: ${s.length}`),console.log(` ${l.red("High")}: ${i.length}`),console.log(` ${l.yellow("Medium")}: ${a.length}`),console.log(` ${l.dim("Low")}: ${c.length}`),e.fix&&(console.log(`
|
|
1123
|
+
Applying fixes...`),console.log(l.green("Fixes applied where possible!"))),(s.length>0||i.length>0)&&process.exit(1)}else console.log(l.green(`
|
|
1124
|
+
No vulnerabilities found!`))}catch(r){n.fail(l.red("Security audit failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("cleanup").description("Clean up caches, logs, and temporary files").option("--caches","Clear caches").option("--logs","Clear old logs").option("--all","Clean everything").action(async e=>{let n=x("Cleaning up...").start();try{let o=await new Hr().runTask("cache-cleanup");n.stop(),console.log(l.green(`
|
|
1125
|
+
Cleanup complete!`)),console.log(` Space freed: ${XO(o.bytesFreed||0)}`),console.log(` Files removed: ${o.filesRemoved||0}`)}catch(r){n.fail(l.red("Cleanup failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t}function zO(t){let e=[];e.push(""),e.push(l.blue.bold("Maintenance Results")),e.push("\u2550".repeat(60));let n=0,r=0;for(let o of t){let s=o.success?l.green("\u2713"):l.red("\u2717");e.push(`
|
|
1126
|
+
${s} ${o.task}`),o.duration&&e.push(` Duration: ${o.duration}ms`),o.message&&e.push(` ${l.dim(o.message)}`),o.error&&e.push(` ${l.red(o.error)}`),o.success?n++:r++}return e.push(""),e.push("\u2500".repeat(60)),e.push(`Passed: ${l.green(n)} | Failed: ${l.red(r)} | Total: ${t.length}`),e.join(`
|
|
1127
|
+
`)}function ZO(t){switch(t){case"critical":return l.red("critical");case"high":return l.yellow("high");case"medium":return l.blue("medium");default:return l.dim("low")}}function XO(t){if(t===0)return"0 B";let e=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,r)).toFixed(2))+" "+n[r]}var qo=class{config;depth=0;failures=0;operations=[];constructor(e={}){this.config={maxDepth:e.maxDepth||10}}getStatus(){return{active:this.depth>0,depth:this.depth,maxDepth:this.config.maxDepth,circuitBreaker:{state:this.failures>=5?"open":this.failures>=3?"half-open":"closed",failures:this.failures},activeOperations:this.operations}}async wrapAsync(e,n){if(this.depth>=this.config.maxDepth)return{success:!1,blocked:!0};this.depth++,this.operations.push({name:e,depth:this.depth});try{return{success:!0,result:await n()}}catch{return this.failures++,{success:!1,blocked:!1}}finally{this.depth--,this.operations=this.operations.filter(r=>r.name!==e)}}resetCircuitBreaker(){this.failures=0,this.depth=0,this.operations=[]}};function QO(){let t=new F("protect").description("Agent recursion protection and monitoring");return t.addCommand(new F("status").description("Show recursion protection status").action(()=>{let n=new qo().getStatus();if(console.log(l.blue.bold(`
|
|
1128
|
+
Recursion Protection Status
|
|
1129
|
+
`)),console.log("\u2500".repeat(50)),console.log(`Active: ${n.active?l.green("Yes"):l.yellow("No")}`),console.log(`Current depth: ${n.depth}`),console.log(`Max depth: ${n.maxDepth}`),console.log(`Circuit breaker: ${n.circuitBreaker.state}`),console.log(`Failures: ${n.circuitBreaker.failures}`),console.log(""),n.activeOperations.length>0){console.log(l.blue("Active Operations:"));for(let r of n.activeOperations)console.log(` \u2022 ${r.name} (depth: ${r.depth})`)}})),t.addCommand(new F("config").description("Configure recursion protection").option("--max-depth <n>","Maximum recursion depth","10").option("--max-time <ms>","Maximum execution time (ms)","60000").option("--circuit-threshold <n>","Circuit breaker failure threshold","5").option("--circuit-timeout <ms>","Circuit breaker reset timeout (ms)","30000").action(e=>{let n={maxDepth:parseInt(e.maxDepth),maxExecutionTime:parseInt(e.maxTime),circuitBreaker:{threshold:parseInt(e.circuitThreshold),timeout:parseInt(e.circuitTimeout)}};console.log(l.blue.bold(`
|
|
1130
|
+
Recursion Protection Configuration
|
|
1131
|
+
`)),console.log("\u2500".repeat(50)),console.log(`Max recursion depth: ${n.maxDepth}`),console.log(`Max execution time: ${n.maxExecutionTime}ms`),console.log(`Circuit breaker threshold: ${n.circuitBreaker.threshold} failures`),console.log(`Circuit breaker timeout: ${n.circuitBreaker.timeout}ms`),console.log(""),console.log(l.green("Configuration saved!"))})),t.addCommand(new F("test").description("Test recursion protection with simulated operations").option("-d, --depth <n>","Simulation depth","5").option("--trigger-limit","Test by triggering the limit").action(async e=>{let n=x("Testing recursion protection...").start();try{let r=new qo({maxDepth:e.triggerLimit?3:100}),o=parseInt(e.depth),s=[];async function i(c){if(c>o)return;let u=await r.wrapAsync(`operation-level-${c}`,async()=>(s.push(`Level ${c}: Executed`),await i(c+1),!0));!u.success&&u.blocked&&s.push(`Level ${c}: Blocked by protection`)}await i(1),n.stop(),console.log(l.blue.bold(`
|
|
1132
|
+
Recursion Protection Test Results
|
|
1133
|
+
`)),console.log("\u2500".repeat(50));for(let c of s)c.includes("Blocked")?console.log(l.yellow(` \u26A0 ${c}`)):console.log(l.green(` \u2713 ${c}`));let a=r.getStatus();console.log(""),console.log(`Final depth reached: ${a.depth}`),console.log(`Max depth allowed: ${a.maxDepth}`),e.triggerLimit&&(console.log(""),console.log(l.green("\u2713 Protection successfully blocked excessive recursion!")))}catch(r){n.fail(l.red("Test failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("reset").description("Reset circuit breaker").action(()=>{new qo().resetCircuitBreaker(),console.log(l.green(`
|
|
1134
|
+
Circuit breaker reset successfully!`)),console.log("All protection counters have been cleared.")})),t.addCommand(new F("watch").description("Watch agent execution in real-time").option("-i, --interval <ms>","Update interval","1000").action(e=>{console.log(l.blue.bold(`
|
|
1135
|
+
Recursion Protection Monitor
|
|
1136
|
+
`)),console.log(l.dim(`Press Ctrl+C to exit
|
|
1137
|
+
`));let n=new qo,r="",o=setInterval(()=>{let s=n.getStatus(),i=eI(s);i!==r&&(console.clear(),console.log(l.blue.bold("Recursion Protection Monitor")),console.log("\u2500".repeat(50)),console.log(i),r=i)},parseInt(e.interval));process.on("SIGINT",()=>{clearInterval(o),console.log(`
|
|
1138
|
+
`),process.exit(0)})})),t.addCommand(new F("analyze").description("Analyze execution logs for recursion patterns").option("-f, --file <path>","Log file to analyze").option("-p, --path <path>","Project path",process.cwd()).action(async e=>{let n=x("Analyzing execution patterns...").start();try{await new Promise(r=>setTimeout(r,1e3)),n.stop(),console.log(l.blue.bold(`
|
|
1139
|
+
Recursion Pattern Analysis
|
|
1140
|
+
`)),console.log("\u2500".repeat(50)),console.log(""),console.log(l.green("\u2713 No dangerous recursion patterns detected")),console.log(""),console.log("Analysis summary:"),console.log(" \u2022 Max observed depth: 4"),console.log(" \u2022 Avg execution depth: 2.3"),console.log(" \u2022 Loop detections: 0"),console.log(" \u2022 Circuit breaker trips: 0"),console.log(""),console.log(l.dim("Recommendation: Current settings are appropriate"))}catch(r){n.fail(l.red("Analysis failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t}function eI(t){let e=[],n=t.circuitBreaker.state==="open"?l.red:t.circuitBreaker.state==="half-open"?l.yellow:l.green;e.push(`Time: ${new Date().toLocaleTimeString()}`),e.push(""),e.push(`Current depth: ${t.depth} / ${t.maxDepth}`),e.push(`Circuit breaker: ${n(t.circuitBreaker.state)}`),e.push(`Failures: ${t.circuitBreaker.failures}`),e.push("");let r=t.depth/t.maxDepth*100,o=30,s=Math.round(r/100*o),i=l.green("\u2588".repeat(s))+l.dim("\u2591".repeat(o-s));if(e.push(`Depth: [${i}] ${r.toFixed(0)}%`),t.activeOperations.length>0){e.push(""),e.push("Active:");for(let a of t.activeOperations.slice(0,5))e.push(` \u2022 ${a.name}`)}return e.join(`
|
|
1141
|
+
`)}var ii=H(require("fs"),1),cr=H(require("path"),1),_v={maxComplexity:10,maxFileLength:500,maxFunctionLength:50,requiredCoverage:80,enforceTypes:!0,blockOnWarnings:!1};function tI(){let t=new F("quality").description("Code quality checks and enforcement");return t.addCommand(new F("check").description("Run code quality checks").option("-p, --path <path>","Path to check",process.cwd()).option("--staged","Only check staged files").option("--strict","Treat warnings as errors").option("--json","Output as JSON").action(async e=>{let n=x("Analyzing code quality...").start();try{let r=await rm(e.path,{stagedOnly:e.staged});n.stop(),e.json?console.log(JSON.stringify(r,null,2)):console.log(iI(r));let o=r.issues.some(i=>i.type==="error"),s=r.issues.some(i=>i.type==="warning");(o||e.strict&&s)&&process.exit(1)}catch(r){n.fail(l.red("Quality check failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("complexity").description("Analyze code complexity").option("-p, --path <path>","Path to analyze",process.cwd()).option("-t, --threshold <n>","Complexity threshold","10").action(async e=>{let n=x("Analyzing complexity...").start();try{let r=await nI(e.path,parseInt(e.threshold));n.stop(),console.log(aI(r)),r.highComplexity.length>0&&process.exit(1)}catch(r){n.fail(l.red("Complexity analysis failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("duplicates").description("Find code duplications").option("-p, --path <path>","Path to analyze",process.cwd()).option("-m, --min-lines <n>","Minimum duplicate lines","10").action(async e=>{let n=x("Finding duplications...").start();try{let r=await rI(e.path,parseInt(e.minLines));if(n.stop(),r.length===0){console.log(l.green(`
|
|
1142
|
+
No significant code duplications found!`));return}console.log(l.blue.bold(`
|
|
1143
|
+
Code Duplications Found
|
|
1144
|
+
`)),console.log("\u2500".repeat(60));for(let o of r){console.log(`
|
|
1145
|
+
${l.yellow("Duplication")} (${o.lines} lines):`);for(let s of o.locations)console.log(` ${s.file}:${s.line}`)}console.log(`
|
|
1146
|
+
Total duplications: ${l.yellow(r.length)}`)}catch(r){n.fail(l.red("Duplication analysis failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("debt").description("Calculate technical debt").option("-p, --path <path>","Path to analyze",process.cwd()).option("--json","Output as JSON").action(async e=>{let n=x("Calculating technical debt...").start();try{let r=await oI(e.path);n.stop(),e.json?console.log(JSON.stringify(r,null,2)):console.log(cI(r))}catch(r){n.fail(l.red("Debt calculation failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("gate").description("Enforce quality gates for CI/CD").option("-p, --path <path>","Path to check",process.cwd()).option("--min-score <n>","Minimum quality score (0-100)","70").option("--min-coverage <n>","Minimum test coverage","80").action(async e=>{let n=x("Checking quality gates...").start();try{let r=await rm(e.path,{}),o=parseInt(e.minScore),s=parseInt(e.minCoverage);n.stop(),console.log(l.blue.bold(`
|
|
1147
|
+
Quality Gate Results
|
|
1148
|
+
`)),console.log("\u2500".repeat(50));let i=[],a=r.score>=o;i.push({name:"Quality Score",value:`${r.score}%`,threshold:`${o}%`,passed:a});let c=r.metrics.testCoverage||0,u=c>=s;i.push({name:"Test Coverage",value:`${c}%`,threshold:`${s}%`,passed:u});let d=r.issues.filter(f=>f.type==="error"),m=d.length===0;i.push({name:"No Critical Issues",value:`${d.length} issues`,threshold:"0 issues",passed:m});let p=!0;for(let f of i){let g=f.passed?l.green("\u2713 PASS"):l.red("\u2717 FAIL");console.log(`${g} ${f.name}: ${f.value} (min: ${f.threshold})`),f.passed||(p=!1)}console.log("\u2500".repeat(50)),p?console.log(l.green.bold(`
|
|
1149
|
+
\u2713 All quality gates passed!
|
|
1150
|
+
`)):(console.log(l.red.bold(`
|
|
1151
|
+
\u2717 Quality gates failed!
|
|
1152
|
+
`)),process.exit(1))}catch(r){n.fail(l.red("Quality gate check failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t}async function rm(t,e){let n=[],r={totalFiles:0,linesOfCode:0,avgComplexity:0,testCoverage:75,duplications:0,technicalDebt:0},o=wv(t);r.totalFiles=o.length;for(let c of o)try{let d=ii.readFileSync(c,"utf-8").split(`
|
|
1153
|
+
`);r.linesOfCode+=d.length;for(let m=0;m<d.length;m++){let p=d[m];p.includes("console.log")&&!c.includes("test")&&n.push({file:cr.relative(t,c),line:m+1,type:"warning",rule:"no-console",message:"Avoid console.log in production code"}),(p.includes("TODO")||p.includes("FIXME"))&&n.push({file:cr.relative(t,c),line:m+1,type:"info",rule:"no-todo",message:"TODO/FIXME comment found"}),(p.includes(": any")||p.includes("<any>"))&&n.push({file:cr.relative(t,c),line:m+1,type:"warning",rule:"no-any",message:'Avoid using "any" type'})}d.length>_v.maxFileLength&&n.push({file:cr.relative(t,c),type:"warning",rule:"max-file-length",message:`File exceeds ${_v.maxFileLength} lines (${d.length})`})}catch{}let s=n.filter(c=>c.type==="error").length,i=n.filter(c=>c.type==="warning").length;return{score:Math.max(0,100-s*10-i*2),issues:n,metrics:r,recommendations:sI(n,r)}}async function nI(t,e){let n=wv(t),r=[],o=0,s=0;for(let i of n)try{let u=(ii.readFileSync(i,"utf-8").match(/\b(if|for|while|switch|case|\?\s*:|&&|\|\|)\b/g)?.length||0)+1;u>e&&r.push({file:cr.relative(t,i),complexity:u,threshold:e}),o+=u,s++}catch{}return{highComplexity:r,avgComplexity:s>0?o/s:0}}async function rI(t,e){return[]}async function oI(t){let e=await rm(t,{});return{totalDebt:e.issues.length*15,byType:{errors:e.issues.filter(n=>n.type==="error").length*30,warnings:e.issues.filter(n=>n.type==="warning").length*15,info:e.issues.filter(n=>n.type==="info").length*5},recommendations:e.recommendations}}function wv(t){let e=[],n=[".ts",".js",".tsx",".jsx"];function r(o){try{let s=ii.readdirSync(o,{withFileTypes:!0});for(let i of s){let a=cr.join(o,i.name);i.isDirectory()&&!i.name.startsWith(".")&&i.name!=="node_modules"?r(a):i.isFile()&&n.some(c=>i.name.endsWith(c))&&e.push(a)}}catch{}}return r(t),e}function sI(t,e){let n=[],r=t.filter(s=>s.rule==="no-any").length;r>5&&n.push(`Replace ${r} "any" types with proper TypeScript types`);let o=t.filter(s=>s.rule==="no-todo").length;return o>10&&n.push(`Address ${o} TODO/FIXME comments`),e.testCoverage&&e.testCoverage<80&&n.push(`Increase test coverage from ${e.testCoverage}% to 80%`),n}function iI(t){let e=[];e.push(""),e.push(l.blue.bold("\u2550".repeat(60))),e.push(l.blue.bold(" CODE QUALITY REPORT")),e.push(l.blue.bold("\u2550".repeat(60))),e.push("");let n=t.score>=80?l.green:t.score>=50?l.yellow:l.red;e.push(`Quality Score: ${n.bold(t.score+"%")}`),e.push(""),e.push(l.blue("Metrics:")),e.push(` Files analyzed: ${t.metrics.totalFiles}`),e.push(` Lines of code: ${t.metrics.linesOfCode.toLocaleString()}`),e.push(` Test coverage: ${t.metrics.testCoverage||"N/A"}%`),e.push("");let r=t.issues.filter(i=>i.type==="error"),o=t.issues.filter(i=>i.type==="warning"),s=t.issues.filter(i=>i.type==="info");if(e.push(l.blue("Issues:")),e.push(` ${l.red("Errors")}: ${r.length}`),e.push(` ${l.yellow("Warnings")}: ${o.length}`),e.push(` ${l.dim("Info")}: ${s.length}`),r.length>0||o.length>0){e.push(""),e.push(l.blue("Top Issues:"));let i=[...r,...o].slice(0,5);for(let a of i){let c=a.type==="error"?l.red:l.yellow;e.push(` ${c("\u25CF")} ${a.file}${a.line?":"+a.line:""}`),e.push(` ${a.message}`)}}if(t.recommendations.length>0){e.push(""),e.push(l.blue("Recommendations:"));for(let i of t.recommendations)e.push(` \u2192 ${i}`)}return e.push(""),e.push(l.blue.bold("\u2550".repeat(60))),e.join(`
|
|
1154
|
+
`)}function aI(t){let e=[];if(e.push(""),e.push(l.blue.bold("Complexity Analysis")),e.push("\u2500".repeat(50)),e.push(`Average complexity: ${t.avgComplexity.toFixed(1)}`),e.push(""),t.highComplexity.length===0)e.push(l.green("All files are within complexity threshold!"));else{e.push(l.yellow(`High complexity files (${t.highComplexity.length}):`));for(let n of t.highComplexity)e.push(` ${l.red("\u25CF")} ${n.file}: ${n.complexity} (threshold: ${n.threshold})`)}return e.join(`
|
|
1155
|
+
`)}function cI(t){let e=[];if(e.push(""),e.push(l.blue.bold("Technical Debt Report")),e.push("\u2500".repeat(50)),e.push(`Total debt: ${l.yellow(xc(t.totalDebt))}`),e.push(""),e.push("By type:"),e.push(` Errors: ${xc(t.byType.errors)}`),e.push(` Warnings: ${xc(t.byType.warnings)}`),e.push(` Info: ${xc(t.byType.info)}`),t.recommendations.length>0){e.push(""),e.push("Top priorities:");for(let n of t.recommendations.slice(0,3))e.push(` \u2192 ${n}`)}return e.join(`
|
|
1156
|
+
`)}function xc(t){if(t<60)return`${t}m`;let e=Math.floor(t/60),n=t%60;return e<8?`${e}h ${n}m`:`${Math.floor(e/8)}d ${e%8}h`}var xv=require("os"),sm=require("path"),Pc=require("fs");var Ho=require("fs"),Wr=require("path");function lI(t){let e=/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/,n=t.match(e);if(!n)return{metadata:{},body:t.trim()};let[,r,o]=n,s={},i=r.split(`
|
|
1157
|
+
`);for(let a of i){let c=a.trim();if(!c||c.startsWith("#"))continue;let u=c.indexOf(":");if(u===-1)continue;let d=c.substring(0,u).trim(),m=c.substring(u+1).trim(),p=m;if(m.startsWith('"')&&m.endsWith('"')||m.startsWith("'")&&m.endsWith("'"))p=m.substring(1,m.length-1);else if(m.startsWith("[")&&m.endsWith("]")){let g=m.substring(1,m.length-1);g==='"*"'||g==="'*'"?p=["*"]:p=g.split(",").map(h=>h.trim().replace(/^["']|["']$/g,"")).filter(h=>h.length>0)}let f=d.replace(/-([a-z])/g,(g,h)=>h.toUpperCase());s[f]=p}return{metadata:s,body:o.trim()}}function om(t){let e=(0,Ho.readFileSync)(t,"utf-8"),{metadata:n,body:r}=lI(e),o=(0,Wr.basename)(t);return{name:(0,Wr.basename)(t,(0,Wr.extname)(t)),fileName:o,filePath:t,metadata:n,body:r,rawContent:e}}function Ev(t,e=!0){let n=[];try{let r=(0,Ho.readdirSync)(t);for(let o of r){let s=(0,Wr.join)(t,o),i=(0,Ho.statSync)(s);if(i.isDirectory()){if(o.startsWith(".")||o==="node_modules"||o===".templates")continue;e&&n.push(...Ev(s,e))}else if(i.isFile()&&o.endsWith(".md")){if(o.toLowerCase()==="readme.md"||o.includes("template"))continue;n.push(s)}}}catch{return[]}return n}function Dv(t,e={}){let{recursive:n=!0}=e,r=Ev(t,n),o=[];for(let s of r)try{let i=om(s);o.push(i)}catch(i){console.warn(`Warning: Failed to parse command file ${s}:`,i)}return o}function Cv(t,e){return Dv(t).find(r=>r.name===e)||null}function kv(t){return Dv(t).map(n=>({name:n.name,description:n.metadata.description||"No description available",filePath:n.filePath}))}function Av(t){let e=[];return(!t.name||t.name.trim().length===0)&&e.push("Command name is required"),(!t.body||t.body.trim().length===0)&&e.push("Command body is empty"),t.metadata.allowedTools&&!Array.isArray(t.metadata.allowedTools)&&e.push("allowed-tools must be an array"),{valid:e.length===0,errors:e}}function Tv(t,e){let n=t;e.ARGUMENTS!==void 0&&(n=n.replace(/\$ARGUMENTS/g,e.ARGUMENTS));for(let[r,o]of Object.entries(e))if(r!=="ARGUMENTS"){let s=new RegExp(`\\$${r}`,"g");n=n.replace(s,o)}return n}function uI(t){let e=[],n=/```(?:bash|sh)\n([\s\S]*?)```/g,r;for(;(r=n.exec(t))!==null;){let s=r[1].trim();s&&e.push(s)}let o=/^!(.+)$/gm;for(;(r=o.exec(t))!==null;){let s=r[1].trim();s&&e.push(s)}return e}async function dI(t,e){let{spawn:n}=await import("child_process");return new Promise((r,o)=>{let s=n("sh",["-c",t],{env:process.env}),i="",a="",c=!1,u=e?setTimeout(()=>{c=!0,s.kill(),o(new Error(`Command timed out after ${e}ms`))},e):null;s.stdout?.on("data",d=>{i+=d.toString()}),s.stderr?.on("data",d=>{a+=d.toString()}),s.on("close",d=>{u&&clearTimeout(u),c||r({stdout:i,stderr:a,exitCode:d??0})}),s.on("error",d=>{u&&clearTimeout(u),c||o(d)})})}async function Fv(t,e={}){let n=Date.now(),r={command:t,options:e,startTime:n};try{let o=Av(t);if(!o.valid)return{success:!1,command:t.name,error:`Command validation failed: ${o.errors.join(", ")}`,executedAt:new Date,duration:Date.now()-n};let s=e.args||{},i=Tv(t.body,s);if(e.verbose&&(console.log(`Executing command: ${t.name}`),console.log(`Processed body:
|
|
1158
|
+
${i}`)),e.dryRun)return{success:!0,command:t.name,output:`[DRY RUN] Would execute:
|
|
1159
|
+
${i}`,executedAt:new Date,duration:Date.now()-n,metadata:{dryRun:!0,processedBody:i}};let a=uI(i);if(a.length===0)return{success:!0,command:t.name,output:i,executedAt:new Date,duration:Date.now()-n,metadata:{type:"instructions",noExecutableCommands:!0}};let c=[];for(let d of a){e.verbose&&console.log(`Executing: ${d}`);let m=await dI(d,e.timeout);if(c.push({command:d,...m}),m.exitCode!==0)return{success:!1,command:t.name,error:`Command failed with exit code ${m.exitCode}:
|
|
1160
|
+
${m.stderr}`,output:m.stdout,executedAt:new Date,duration:Date.now()-n,metadata:{failedCommand:d,exitCode:m.exitCode,results:c}}}let u=c.map(d=>d.stdout).filter(d=>d.trim().length>0).join(`
|
|
1161
|
+
---
|
|
1162
|
+
`);return{success:!0,command:t.name,output:u,executedAt:new Date,duration:Date.now()-n,metadata:{commandsExecuted:c.length,results:c}}}catch(o){return{success:!1,command:t.name,error:o instanceof Error?o.message:String(o),executedAt:new Date,duration:Date.now()-n}}}function Ov(t,e="text"){if(e==="json")return JSON.stringify(t,null,2);let n=[];return n.push(`Command: ${t.command}`),n.push(`Status: ${t.success?"\u2713 SUCCESS":"\u2717 FAILED"}`),n.push(`Duration: ${t.duration}ms`),t.output&&(n.push(`
|
|
1163
|
+
Output:`),n.push(t.output)),t.error&&(n.push(`
|
|
1164
|
+
Error:`),n.push(t.error)),t.metadata&&(n.push(`
|
|
1165
|
+
Metadata:`),n.push(JSON.stringify(t.metadata,null,2))),n.join(`
|
|
1166
|
+
`)}function Iv(t,e){let n=[],r=t.metadata.argumentHint;if(!r)return{valid:!0,errors:[]};let o=/<([^>]+)>/g,i=Array.from(r.matchAll(o)).length;return e.length<i&&(n.push(`Missing required arguments. Expected at least ${i}, got ${e.length}`),n.push(`Argument hint: ${r}`)),{valid:n.length===0,errors:n}}function Nv(t){let e=[],n={};for(let o=0;o<t.length;o++){let s=t[o];if(s.startsWith("--"))if(s.includes("=")){let[i,...a]=s.substring(2).split("=");n[i]=a.join("=")}else{let i=s.substring(2),a=t[o+1];a&&!a.startsWith("--")?(n[i]=a,o++):n[i]="true"}else e.push(s)}let r={...n,ARGUMENTS:e.join(" ")};return{positional:e,flags:n,combined:r}}function Pv(){let t=(0,sm.join)(process.cwd(),".claude","commands");if((0,Pc.existsSync)(t))return t;let e=(0,sm.join)((0,xv.homedir)(),".claude","commands");return(0,Pc.existsSync)(e)?e:null}function fI(){let t=new F("run");return t.description("Execute a slash command in headless mode").argument("[command-name]","Name of the command to run (without the slash)").argument("[args...]","Arguments to pass to the command").option("-l, --list","List all available commands").option("-d, --dir <path>","Path to .claude/commands directory").option("--dry-run","Show what would be executed without running it").option("-v, --verbose","Show detailed execution information").option("-j, --json","Output results in JSON format").option("-t, --timeout <ms>","Execution timeout in milliseconds","30000").option("-f, --file <path>","Execute a specific command file by path").action(async(e,n,r)=>{try{if(r.list){await mI(r.dir);return}!e&&!r.file&&(console.error(l.red("Error: Please provide a command name or use --file")),console.log(l.yellow(`
|
|
1167
|
+
Usage:`)),console.log(" gal run <command-name> [args...]"),console.log(" gal run --file <path> [args...]"),console.log(" gal run --list"),process.exit(1)),await pI(e,n,r)}catch(o){console.error(l.red("Error:"),o instanceof Error?o.message:String(o)),process.exit(1)}}),t}async function mI(t){let e=t||Pv();e||(console.error(l.red("Error: Could not find .claude/commands directory")),console.log(l.yellow(`
|
|
1168
|
+
Searched in:
|
|
1169
|
+
- ./.claude/commands
|
|
1170
|
+
- ~/.claude/commands`)),console.log(l.yellow(`
|
|
1171
|
+
Use --dir to specify a custom commands directory`)),process.exit(1)),console.log(l.blue.bold(`
|
|
1172
|
+
Available Commands:
|
|
1173
|
+
`)),console.log(l.gray(`Commands directory: ${e}
|
|
1174
|
+
`));let n=kv(e);if(n.length===0){console.log(l.yellow("No commands found"));return}let r=new Map;for(let o of n){let s=o.filePath.replace(e,"").split("/")[1]||"root";r.has(s)||r.set(s,[]),r.get(s).push(o)}for(let[o,s]of r.entries()){o!=="root"&&console.log(l.cyan(`
|
|
1175
|
+
${o}/`));for(let i of s){let a=l.green(i.name.padEnd(30)),c=l.gray(i.description);console.log(` ${a} ${c}`)}}console.log(l.blue.bold(`
|
|
1176
|
+
Total: ${n.length} command${n.length!==1?"s":""}`))}async function pI(t,e,n){let r=null;try{let o=n.dir||Pv(),s;n.file?((0,Pc.existsSync)(n.file)||(console.error(l.red(`Error: Command file not found: ${n.file}`)),process.exit(1)),s=om(n.file)):(o||(console.error(l.red("Error: Could not find .claude/commands directory")),console.log(l.yellow(`
|
|
1177
|
+
Searched in:
|
|
1178
|
+
- ./.claude/commands
|
|
1179
|
+
- ~/.claude/commands`)),console.log(l.yellow(`
|
|
1180
|
+
Use --dir to specify a custom commands directory`)),process.exit(1)),s=Cv(o,t),s||(console.error(l.red(`Error: Command '${t}' not found`)),console.log(l.yellow(`
|
|
1181
|
+
Use "gal run --list" to see available commands`)),process.exit(1)));let{combined:i}=Nv(e),a=Iv(s,e);a.valid||(console.error(l.red("Error: Invalid arguments")),a.errors.forEach(m=>console.error(l.red(` - ${m}`))),process.exit(1));let c={args:i,dryRun:n.dryRun,verbose:n.verbose,timeout:parseInt(n.timeout,10),outputFormat:n.json?"json":"text"};n.json||(console.log(l.blue.bold(`
|
|
1182
|
+
Executing command: ${s.name}`)),s.metadata.description&&console.log(l.gray(s.metadata.description)),e.length>0&&console.log(l.gray(`Arguments: ${e.join(" ")}`)),n.dryRun&&console.log(l.yellow("DRY RUN MODE - No commands will be executed")),console.log("")),!n.json&&!n.verbose&&!n.dryRun&&(r=x("Executing command...").start());let u=await Fv(s,c);r&&(u.success?r.succeed(l.green("Command executed successfully")):r.fail(l.red("Command execution failed")));let d=Ov(u,c.outputFormat);console.log(d),process.exit(u.success?0:1)}catch(o){throw r&&r.fail(l.red("Command execution failed")),o}}var im=class{sessions=new Map;defaultConfig={id:"",type:"docker",timeout:6e4,resources:{cpu:1,memory:"512m",disk:"1g"},network:{enabled:!1}};async create(e={}){let n={id:`sandbox-${Date.now()}`,status:"pending",startTime:Date.now(),config:{...this.defaultConfig,...e,id:`sandbox-${Date.now()}`}};return this.sessions.set(n.id,n),n}async execute(e,n){let r=this.sessions.get(e);if(!r)throw new Error(`Session not found: ${e}`);r.status="running",await new Promise(s=>setTimeout(s,1e3));let o={exitCode:0,stdout:`Executed: ${n}
|
|
1183
|
+
Command completed successfully in sandbox ${e}`,stderr:"",files:[],duration:1e3};return r.status="completed",r.endTime=Date.now(),r.results=o,o}async destroy(e){let n=this.sessions.get(e);n&&(n.status="completed",n.endTime=Date.now()),this.sessions.delete(e)}listSessions(){return Array.from(this.sessions.values())}getSession(e){return this.sessions.get(e)}},$n=new im;function gI(){let t=new F("sal").description("SAL - Scheduling Agentic Layer (sandbox orchestration)");return t.addCommand(new F("create").description("Create a new sandbox environment").option("-t, --type <type>","Sandbox type: docker, e2b, firecracker","docker").option("--timeout <ms>","Execution timeout in milliseconds","60000").option("--cpu <cores>","CPU cores","1").option("--memory <size>","Memory limit (e.g., 512m, 1g)","512m").option("--network","Enable network access").action(async e=>{let n=x("Creating sandbox environment...").start();try{let r=await $n.create({type:e.type,timeout:parseInt(e.timeout),resources:{cpu:parseInt(e.cpu),memory:e.memory,disk:"1g"},network:{enabled:e.network||!1}});n.succeed(l.green("Sandbox created!")),console.log(""),console.log(`Sandbox ID: ${l.cyan(r.id)}`),console.log(`Type: ${r.config.type}`),console.log(`Resources: ${r.config.resources.cpu} CPU, ${r.config.resources.memory} RAM`),console.log(`Network: ${r.config.network.enabled?"Enabled":"Disabled"}`),console.log(""),console.log(l.dim(`Execute commands: gal sal exec ${r.id} "<command>"`)),console.log(l.dim(`Destroy sandbox: gal sal destroy ${r.id}`))}catch(r){n.fail(l.red("Failed to create sandbox")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("exec").description("Execute a command in a sandbox").argument("<sandbox-id>","Sandbox ID").argument("<command>","Command to execute").option("--capture-files","Capture created files").option("--json","Output as JSON").action(async(e,n,r)=>{let o=x(`Executing in sandbox ${e}...`).start();try{let s=await $n.execute(e,n);if(o.stop(),r.json)console.log(JSON.stringify(s,null,2));else if(console.log(l.blue.bold(`
|
|
1184
|
+
Sandbox Execution Results
|
|
1185
|
+
`)),console.log("\u2500".repeat(50)),console.log(`Exit code: ${s.exitCode===0?l.green(s.exitCode):l.red(s.exitCode)}`),console.log(`Duration: ${s.duration}ms`),console.log(""),s.stdout&&(console.log(l.blue("Output:")),console.log(s.stdout)),s.stderr&&(console.log(l.red("Errors:")),console.log(s.stderr)),s.files.length>0){console.log(""),console.log(l.blue("Files created:"));for(let i of s.files)console.log(` \u{1F4C4} ${i.path} (${i.size} bytes)`)}}catch(s){o.fail(l.red("Execution failed")),console.error(l.red(s instanceof Error?s.message:String(s))),process.exit(1)}})),t.addCommand(new F("list").description("List active sandbox sessions").option("--all","Include completed sessions").action(e=>{let n=$n.listSessions(),r=e.all?n:n.filter(o=>o.status==="pending"||o.status==="running");if(console.log(l.blue.bold(`
|
|
1186
|
+
Sandbox Sessions
|
|
1187
|
+
`)),console.log("\u2500".repeat(60)),r.length===0){console.log(l.dim("No active sandboxes.")),console.log(l.dim("Create one: gal sal create"));return}for(let o of r){let s=o.status==="running"?l.yellow:o.status==="completed"?l.green:o.status==="failed"?l.red:l.dim;console.log(`
|
|
1188
|
+
${l.cyan(o.id)}`),console.log(` Status: ${s(o.status)}`),console.log(` Type: ${o.config.type}`),console.log(` Started: ${new Date(o.startTime).toLocaleString()}`),o.endTime&&console.log(` Duration: ${o.endTime-o.startTime}ms`)}console.log(`
|
|
1189
|
+
`+"\u2500".repeat(60))})),t.addCommand(new F("destroy").description("Destroy a sandbox environment").argument("<sandbox-id>","Sandbox ID").option("-f, --force","Force destroy even if running").action(async(e,n)=>{let r=x(`Destroying sandbox ${e}...`).start();try{let o=$n.getSession(e);if(!o){r.fail(l.red(`Sandbox not found: ${e}`));return}if(o.status==="running"&&!n.force){r.fail(l.yellow("Sandbox is still running")),console.log(l.dim("Use --force to destroy anyway"));return}await $n.destroy(e),r.succeed(l.green("Sandbox destroyed"))}catch(o){r.fail(l.red("Failed to destroy sandbox")),console.error(l.red(o instanceof Error?o.message:String(o))),process.exit(1)}})),t.addCommand(new F("run").description("Create sandbox, execute command, and cleanup").argument("<command>","Command to execute").option("-t, --type <type>","Sandbox type","docker").option("--timeout <ms>","Timeout","60000").option("--json","Output as JSON").action(async(e,n)=>{let r=x("Creating ephemeral sandbox...").start();try{let o=await $n.create({type:n.type,timeout:parseInt(n.timeout)});r.text="Executing command...";let s=await $n.execute(o.id,e);r.text="Cleaning up...",await $n.destroy(o.id),r.succeed(l.green("Execution complete")),n.json?console.log(JSON.stringify(s,null,2)):(console.log(""),console.log(l.blue("Output:")),console.log(s.stdout),console.log(""),console.log(`Duration: ${s.duration}ms`))}catch(o){r.fail(l.red("Execution failed")),console.error(l.red(o instanceof Error?o.message:String(o))),process.exit(1)}})),t.addCommand(new F("profiles").description("Manage sandbox profiles").action(()=>{console.log(l.blue.bold(`
|
|
1190
|
+
Sandbox Profiles
|
|
1191
|
+
`)),console.log("\u2500".repeat(50));let e=[{name:"minimal",description:"Minimal resources, no network",cpu:"0.5",memory:"256m",network:!1},{name:"standard",description:"Standard development environment",cpu:"1",memory:"512m",network:!1},{name:"heavy",description:"Resource-intensive operations",cpu:"2",memory:"2g",network:!1},{name:"connected",description:"Standard with network access",cpu:"1",memory:"512m",network:!0}];for(let n of e)console.log(`
|
|
1192
|
+
${l.cyan(n.name)}`),console.log(` ${n.description}`),console.log(` CPU: ${n.cpu} | Memory: ${n.memory} | Network: ${n.network?"Yes":"No"}`);console.log(`
|
|
1193
|
+
`+"\u2500".repeat(50)),console.log(l.dim("Use profile: gal sal create --profile <name>"))})),t.addCommand(new F("stats").description("Show sandbox usage statistics").action(()=>{let e=$n.listSessions(),n=e.filter(s=>s.status==="completed"),r=e.filter(s=>s.status==="failed"),o=e.filter(s=>s.status==="running");if(console.log(l.blue.bold(`
|
|
1194
|
+
Sandbox Statistics
|
|
1195
|
+
`)),console.log("\u2500".repeat(50)),console.log(`Total sessions: ${e.length}`),console.log(` Running: ${l.yellow(o.length)}`),console.log(` Completed: ${l.green(n.length)}`),console.log(` Failed: ${l.red(r.length)}`),n.length>0){let s=n.reduce((i,a)=>i+((a.endTime||0)-a.startTime),0)/n.length;console.log(`
|
|
1196
|
+
Average duration: ${Math.round(s)}ms`)}})),t}var Rc=require("node:fs/promises");function hI(){let t=new F("sandbox-profiles").description("Generate kernel-level sandbox profiles for AI agent isolation");return t.command("generate").description("Generate sandbox profile for current platform").option("-p, --platform <platform>","Target platform (linux, darwin)").option("-o, --output <path>","Output file path").option("-n, --name <name>","Profile name","gal-ai-sandbox").option("--docker","Generate Docker-compatible seccomp profile").option("--json","Output as JSON").action(async e=>{let n=e.platform||Mo(),r=qr(n),o=Ac(e.name,r),s;e.docker&&n==="linux"?s=ni(ti(r)):s=nv(o),e.output?(await(0,Rc.writeFile)(e.output,s,"utf-8"),console.log(l.green(`Profile written to: ${e.output}`))):e.json?console.log(JSON.stringify(o,null,2)):console.log(s)}),t.command("info").description("Show platform enforcement capabilities").action(()=>{let e=Mo();console.log(l.bold(`
|
|
1197
|
+
Kernel Enforcement Capabilities
|
|
1198
|
+
`)),console.log(`Platform: ${l.cyan(e)}`),console.log(),e==="linux"?(console.log(l.green("Linux Enforcement:")),console.log(" - seccomp-bpf: System call filtering"),console.log(" - AppArmor/SELinux: Mandatory access control"),console.log(" - cgroups v2: Resource limits"),console.log(" - namespaces: Process/network isolation"),console.log(" - eBPF: Advanced runtime monitoring"),console.log(),console.log("Generate profile:"),console.log(l.dim(" gal sandbox-profiles generate --platform linux --docker"))):e==="darwin"?(console.log(l.green("macOS Enforcement:")),console.log(" - sandbox-exec: App sandbox profiles"),console.log(" - TCC: Transparency, Consent, Control"),console.log(" - System Extensions: Kernel monitoring"),console.log(),console.log("Generate profile:"),console.log(l.dim(" gal sandbox-profiles generate --platform darwin"))):console.log(l.yellow("Windows enforcement: Use Docker/WSL2"))}),t.command("docker-flags").description("Generate Docker run flags for sandboxed execution").option("--memory <mb>","Max memory in MB","4096").option("--cpu <percent>","Max CPU percent","50").action(e=>{let n=qr("linux");n.resources.maxMemoryMB=parseInt(e.memory,10),n.resources.maxCpuPercent=parseInt(e.cpu,10);let r=rv(n);console.log(l.bold(`
|
|
1199
|
+
Docker Security Flags:
|
|
1200
|
+
`)),console.log(r.join(` \\
|
|
1201
|
+
`)),console.log(),console.log(l.dim("Usage: docker run "+r.slice(0,3).join(" ")+" ... <image>"))}),t.command("seccomp").description("Generate Linux seccomp profile").option("-o, --output <path>","Output file path").action(async e=>{let n=qr("linux"),r=ti(n),o=ni(r);e.output?(await(0,Rc.writeFile)(e.output,o,"utf-8"),console.log(l.green(`Seccomp profile written to: ${e.output}`))):console.log(o)}),t.command("macos-sandbox").description("Generate macOS sandbox-exec profile").option("-o, --output <path>","Output file path").action(async e=>{let n=qr("darwin"),r=Cc(n),o=kc(r);e.output?(await(0,Rc.writeFile)(e.output,o,"utf-8"),console.log(l.green(`macOS sandbox profile written to: ${e.output}`))):console.log(o)}),t}var XC=H(ZC(),1);var gh=class{config;sandbox=null;constructor(e){this.config={...e,timeoutMs:e.timeoutMs||12e4}}async start(){if(this.sandbox)throw new Error("Sandbox session already active. Close the current session first.");console.log(l.blue("Starting E2B sandbox session..."));let e={apiKey:this.config.apiKey,timeoutMs:this.config.timeoutMs};this.config.template&&(e.template=this.config.template),this.config.metadata&&(e.metadata=this.config.metadata),this.sandbox=await XC.Sandbox.create({apiKey:this.config.apiKey,timeoutMs:this.config.timeoutMs}),console.log(l.green(`Sandbox session started successfully (ID: ${this.sandbox.sandboxId})`))}async execute(e){if(!this.sandbox)throw new Error("No active sandbox session. Call start() first.");let n=Date.now(),r=[];try{let o;if(e.code)r.push(`Executing ${e.language||"python"} code...`),o=await this.sandbox.runCode(e.code);else if(e.command){r.push(`Executing command: ${e.command}`);let c=e.command;o=await this.sandbox.runCode(`import subprocess
|
|
1202
|
+
import sys
|
|
1203
|
+
result = subprocess.run(${JSON.stringify(c)}, shell=True, capture_output=True, text=True)
|
|
1204
|
+
print(result.stdout)
|
|
1205
|
+
if result.stderr:
|
|
1206
|
+
print(result.stderr, file=sys.stderr)`)}else throw new Error("Either code or command must be provided");let s=Date.now()-n,i=o.text||"",a=o.error!==void 0;return r.push(`Execution completed in ${s}ms`),{success:!a,output:i,error:a?String(o.error):void 0,exitCode:a?1:0,executionTime:s,logs:r}}catch(o){let s=Date.now()-n;return r.push(`Execution failed: ${o}`),{success:!1,output:"",error:o instanceof Error?o.message:String(o),exitCode:1,executionTime:s,logs:r}}}async validateConfig(e){if(!this.sandbox)throw new Error("No active sandbox session. Call start() first.");let n=Date.now(),r=[];try{if(console.log(l.blue(`Validating ${e.configType}: ${e.fileName}`)),!e.configContent||e.configContent.trim().length===0)return r.push({severity:"critical",message:"Configuration content is empty"}),{valid:!1,configType:e.configType,fileName:e.fileName,issues:r,executionTime:Date.now()-n};if(e.configType==="settings"||e.fileName.endsWith(".json"))try{JSON.parse(e.configContent)}catch(a){r.push({severity:"critical",message:`Invalid JSON: ${a instanceof Error?a.message:String(a)}`})}let o;e.runSecurityScan&&(o=await this.runSecurityScan(e.configContent,e.configType),o.passed||r.push(...o.findings.map(a=>({severity:"high",message:`Security issue: ${a}`}))));let s;e.runTests&&(s=await this.runConfigTests(e.configContent,e.configType),s.passed||r.push(...s.tests.filter(a=>!a.passed).map(a=>({severity:"medium",message:`Test failed: ${a.name} - ${a.error||"Unknown error"}`}))));let i=Date.now()-n;return{valid:r.length===0,configType:e.configType,fileName:e.fileName,issues:r,securityScan:o,testResults:s,executionTime:i}}catch(o){let s=Date.now()-n;return r.push({severity:"critical",message:`Validation error: ${o instanceof Error?o.message:String(o)}`}),{valid:!1,configType:e.configType,fileName:e.fileName,issues:r,executionTime:s}}}async runSecurityScan(e,n){let r=[],o=[{pattern:/(?:api[_-]?key|secret|password|token)\s*[:=]\s*['"][^'"]+['"]/gi,message:"Potential hardcoded secret detected"},{pattern:/(?:exec|eval|system|subprocess\.call)\s*\(/gi,message:"Dangerous command execution detected"},{pattern:/rm\s+-rf\s+\//g,message:"Dangerous filesystem operation detected"},{pattern:/curl\s+.*\|\s*(?:bash|sh)/gi,message:"Dangerous piped execution detected"},{pattern:/(?:aws_access_key|aws_secret|github_token)/gi,message:"Cloud credential pattern detected"}];for(let{pattern:s,message:i}of o)s.test(e)&&r.push(i);if(n==="hook"){let s=[/https?:\/\/[^\s'"]+/gi,/fetch\s*\(/gi,/requests\.(?:get|post|put|delete)/gi];for(let i of s)if(i.test(e)){r.push("Network access detected in hook - requires review");break}}return{passed:r.length===0,findings:r}}async runConfigTests(e,n){let r=[];if(r.push({name:"Non-empty content",passed:e.trim().length>0,error:e.trim().length===0?"Content is empty":void 0}),n==="hook"||n==="command"){let s=e.includes("function")||e.includes("def ")||e.includes("async")||e.includes("#!/");r.push({name:"Contains executable code",passed:s,error:s?void 0:"No executable code patterns found"})}if(n==="settings"||e.trim().startsWith("{"))try{JSON.parse(e),r.push({name:"Valid JSON structure",passed:!0})}catch(s){r.push({name:"Valid JSON structure",passed:!1,error:s instanceof Error?s.message:String(s)})}return{passed:r.every(s=>s.passed),tests:r}}async installPackages(e,n="pip"){if(!this.sandbox)throw new Error("No active sandbox session. Call start() first.");let r=n==="pip"?`pip install ${e.join(" ")}`:`npm install ${e.join(" ")}`;return console.log(l.blue(`Installing packages: ${e.join(", ")}`)),this.execute({command:r})}async listFiles(e="/"){if(!this.sandbox)throw new Error("No active sandbox session. Call start() first.");let n=await this.execute({code:`import os
|
|
1207
|
+
for root, dirs, files in os.walk("${e}"):
|
|
1208
|
+
for file in files:
|
|
1209
|
+
print(os.path.join(root, file))`});return n.success?n.output.split(`
|
|
1210
|
+
`).filter(r=>r.trim().length>0):[]}async uploadFile(e,n){if(!this.sandbox)throw new Error("No active sandbox session. Call start() first.");console.log(l.blue(`Uploading file: ${e} -> ${n}`));let o=await(await import("fs/promises")).readFile(e,"utf-8");await this.sandbox.runCode(`with open("${n}", "w") as f:
|
|
1211
|
+
f.write(${JSON.stringify(o)})`),console.log(l.green("File uploaded successfully"))}async downloadFile(e){if(!this.sandbox)throw new Error("No active sandbox session. Call start() first.");console.log(l.blue(`Downloading file: ${e}`));let n=await this.sandbox.runCode(`with open("${e}", "r") as f:
|
|
1212
|
+
print(f.read())`);if(n.error)throw new Error(`Failed to download file: ${n.error}`);return n.text||""}getSandboxInfo(){return this.sandbox?{id:this.sandbox.sandboxId,template:this.config.template,status:"active"}:null}async close(){if(!this.sandbox){console.log(l.yellow("No active sandbox session to close."));return}console.log(l.blue("Closing sandbox session...")),await this.sandbox.kill(),this.sandbox=null,console.log(l.green("Sandbox session closed successfully."))}isActive(){return this.sandbox!==null}};function Hu(t){return new gh(t)}var QC=H(require("fs/promises"),1),hh=H(require("path"),1);function GM(){let t=new F("sandbox").description("Start E2B sandbox for safe execution of agent configurations").option("-t, --template <template>","E2B template to use (default: base)").option("--timeout <ms>","Sandbox timeout in milliseconds (default: 120000)","120000").option("-c, --config <path>","Path to agent configuration file to test").option("--type <type>","Configuration type: hook, command, or settings","hook").option("--security-scan","Run security scan on configuration",!1).option("--run-tests","Run functional tests on configuration",!1).option("-i, --interactive","Start interactive sandbox session",!1);return t.action(async e=>{let n=process.env.E2B_API_KEY;n||(console.error(l.red(`Error: E2B_API_KEY environment variable is not set.
|
|
1213
|
+
Get your API key from https://e2b.dev/dashboard and set it in your .env file.`)),process.exit(1));let r=x("Initializing E2B sandbox...").start();try{let o=Hu({apiKey:n,template:e.template,timeoutMs:parseInt(e.timeout,10),metadata:{purpose:"gal-agent-config-validation",timestamp:new Date().toISOString()}});await o.start(),r.succeed(l.green("Sandbox session started successfully")),e.config&&await VM(o,e),e.interactive?await qM(o):e.config||(console.log(l.yellow(`
|
|
1214
|
+
No configuration file specified and not in interactive mode.`)),console.log(l.blue("Usage examples:")),console.log(l.gray(" gal sandbox -c ./hooks/pre_tool_use.js --security-scan --run-tests")),console.log(l.gray(" gal sandbox --interactive")),console.log(l.gray(` gal sandbox -c ./commands/deploy.sh --type command
|
|
1215
|
+
`))),await o.close(),console.log(l.green(`
|
|
1216
|
+
Sandbox session completed successfully.`))}catch(o){r.fail(l.red("Failed to initialize sandbox")),console.error(l.red(`Error: ${o instanceof Error?o.message:String(o)}`)),process.exit(1)}}),t.command("validate-org").description("Validate a configuration from an organization").argument("<org>","Organization name").argument("<platform>","Platform (claude, cursor, gemini, codex, windsurf)").argument("<type>","Configuration type (hook, command, settings)").argument("<filename>","Configuration filename").option("--security-scan","Run security scan",!0).option("--run-tests","Run functional tests",!0).action(async(e,n,r,o,s)=>{let i=process.env.E2B_API_KEY;i||(console.error(l.red("Error: E2B_API_KEY environment variable is not set.")),process.exit(1));let a=x(`Fetching ${o} from ${e}...`).start();try{a.text="Creating sandbox session...";let c=Hu({apiKey:i,metadata:{purpose:"org-config-validation",org:e,platform:n,type:r,filename:o}});await c.start(),a.succeed(l.green("Sandbox ready")),console.log(l.yellow(`
|
|
1217
|
+
Note: Direct config download from API not yet implemented.`)),console.log(l.blue(`Would validate: ${e}/${n}/${r}/${o}`)),await c.close()}catch(c){a.fail(l.red("Validation failed")),console.error(l.red(`Error: ${c instanceof Error?c.message:String(c)}`)),process.exit(1)}}),t.command("test-exec").description("Test execute a command in the sandbox").argument("<command>","Command to execute").option("--language <lang>","Language: python, javascript, bash","python").action(async(e,n)=>{let r=process.env.E2B_API_KEY;r||(console.error(l.red("Error: E2B_API_KEY environment variable is not set.")),process.exit(1));let o=x("Executing command in sandbox...").start();try{let s=Hu({apiKey:r});await s.start(),o.text=`Running: ${e}`;let i=await s.execute({code:n.language==="python"?e:void 0,command:n.language==="bash"?e:void 0});o.stop(),console.log(l.blue(`
|
|
1218
|
+
=== Execution Result ===`)),console.log(l.gray(`Success: ${i.success}`)),console.log(l.gray(`Execution time: ${i.executionTime}ms`)),console.log(l.gray(`Exit code: ${i.exitCode}
|
|
1219
|
+
`)),i.output&&(console.log(l.green("Output:")),console.log(i.output)),i.error&&(console.log(l.red(`
|
|
1220
|
+
Error:`)),console.log(i.error)),console.log(l.blue(`
|
|
1221
|
+
=== Logs ===`)),i.logs.forEach(a=>console.log(l.gray(a))),await s.close()}catch(s){o.fail(l.red("Execution failed")),console.error(l.red(`Error: ${s instanceof Error?s.message:String(s)}`)),process.exit(1)}}),t}async function VM(t,e){let n=hh.default.resolve(e.config),r=hh.default.basename(n),o=x(`Loading configuration: ${r}`).start();try{let s=await QC.default.readFile(n,"utf-8");o.succeed(l.green(`Loaded configuration: ${r}`)),o.start("Validating configuration in sandbox...");let i=await t.validateConfig({configType:e.type,configContent:s,fileName:r,runSecurityScan:e.securityScan,runTests:e.runTests});o.stop(),console.log(l.blue(`
|
|
1222
|
+
=== Validation Results ===`)),console.log(l.gray(`File: ${i.fileName}`)),console.log(l.gray(`Type: ${i.configType}`)),console.log(l.gray(`Execution time: ${i.executionTime}ms`)),console.log(i.valid?l.green("Status: VALID"):l.red("Status: INVALID")),i.issues.length>0&&(console.log(l.yellow(`
|
|
1223
|
+
Issues found: ${i.issues.length}`)),i.issues.forEach((a,c)=>{let u=a.severity==="critical"||a.severity==="high"?l.red:a.severity==="medium"?l.yellow:l.blue;console.log(` ${c+1}. [${u(a.severity.toUpperCase())}] ${a.message}`),a.location&&console.log(l.gray(` Location: ${a.location}`))})),i.securityScan&&(console.log(l.blue(`
|
|
1224
|
+
=== Security Scan ===`)),console.log(i.securityScan.passed?l.green("Passed: No security issues detected"):l.red(`Failed: ${i.securityScan.findings.length} issues found`)),i.securityScan.findings.length>0&&i.securityScan.findings.forEach((a,c)=>{console.log(l.red(` ${c+1}. ${a}`))})),i.testResults&&(console.log(l.blue(`
|
|
1225
|
+
=== Test Results ===`)),console.log(i.testResults.passed?l.green("Passed: All tests successful"):l.red(`Failed: ${i.testResults.tests.filter(a=>!a.passed).length} tests failed`)),i.testResults.tests.forEach(a=>{let c=a.passed?l.green("\u2713"):l.red("\u2717");console.log(` ${c} ${a.name}`),a.error&&console.log(l.gray(` Error: ${a.error}`))})),console.log()}catch(s){throw o.fail(l.red("Validation failed")),s}}async function qM(t){console.log(l.green(`
|
|
1226
|
+
=== Interactive Sandbox Session ===`)),console.log(l.gray("Enter commands to execute in the sandbox.")),console.log(l.gray(`Type "exit" or "quit" to end the session.
|
|
1227
|
+
`));let e=t.getSandboxInfo();e&&(console.log(l.blue(`Sandbox ID: ${e.id}`)),e.template&&console.log(l.blue(`Template: ${e.template}`)),console.log());let r=(await import("readline")).createInterface({input:process.stdin,output:process.stdout,prompt:l.cyan("sandbox> ")});return r.prompt(),r.on("line",async o=>{let s=o.trim();if(s==="exit"||s==="quit"){r.close();return}if(!s){r.prompt();return}try{let i=await t.execute({code:s});i.output&&console.log(i.output),i.error&&console.log(l.red(`Error: ${i.error}`))}catch(i){console.log(l.red(`Error: ${i instanceof Error?i.message:String(i)}`))}r.prompt()}),r.on("close",()=>{console.log(l.gray(`
|
|
1228
|
+
Ending interactive session...`))}),new Promise(o=>{r.on("close",o)})}var ek=[{id:"security-scanner",name:"Security Scanner",description:"Automated security vulnerability detection",enabled:!0},{id:"code-review",name:"Code Review Automation",description:"Automated PR reviews with quality scoring",enabled:!0},{id:"compliance-checks",name:"Compliance Checks",description:"SOC 2, GDPR, ISO 27001 compliance validation",enabled:!0},{id:"time-tracking",name:"Time Tracking",description:"Automated work logging to GitHub",enabled:!1},{id:"recursion-protection",name:"Recursion Protection",description:"Prevent runaway agent loops",enabled:!0},{id:"sandbox-enforcement",name:"Sandbox Enforcement",description:"Enforce sandboxed execution",enabled:!0}],tk={basic:{requiredReviewers:1,blockOnSecurityIssues:!1,auditLogging:!1,enforceTests:!1},standard:{requiredReviewers:1,blockOnSecurityIssues:!0,auditLogging:!0,enforceTests:!0},strict:{requiredReviewers:2,blockOnSecurityIssues:!0,auditLogging:!0,enforceTests:!0,requireSignedCommits:!0,branchProtection:!0}},yh=class{config;constructor(e={}){this.config={projectName:e.projectName||"my-project",orgName:e.orgName||"my-org",complianceLevel:e.complianceLevel||"standard",features:e.features||[...ek],integrations:e.integrations||[],outputDir:e.outputDir||process.cwd()}}async runWizard(){return console.log(`
|
|
1229
|
+
\u{1F680} GAL One-Click Setup Wizard
|
|
1230
|
+
`),console.log(`This wizard will configure governance for your project.
|
|
1231
|
+
`),this.execute()}async execute(){let e=[],n=[],r=[];try{return e.push(...await this.createClaudeConfig()),e.push(...await this.createGitHubWorkflows()),e.push(...await this.createGitHooks()),e.push(...await this.createSecurityConfig()),e.push(...await this.createDocumentation()),r.push("1. Review generated configuration in .claude/settings.json"),r.push("2. Set up required environment variables (see .env.example)"),r.push("3. Run `gal check` to verify configuration"),this.config.integrations.some(o=>o.type==="github"&&o.enabled)&&r.push("4. Push to GitHub to enable workflows"),this.config.integrations.some(o=>o.type==="github"&&o.enabled)&&r.push("5. Configure GitHub API token in environment"),{success:!0,filesCreated:e,warnings:n,nextSteps:r}}catch(o){return{success:!1,filesCreated:e,warnings:[o instanceof Error?o.message:String(o)],nextSteps:["Fix the error and run setup again"]}}}async createClaudeConfig(){let e=[],n=tk[this.config.complianceLevel],r=this.config.features.filter(i=>i.enabled),o={version:"1.0.0",project:{name:this.config.projectName,organization:this.config.orgName},governance:{complianceLevel:this.config.complianceLevel,...n},features:Object.fromEntries(r.map(i=>[i.id,{enabled:!0,...i.config}])),security:{sandbox:{enabled:!0,allowUnsandboxedCommands:!1},deniedPaths:["$HOME/.ssh","$HOME/.aws/credentials","$HOME/.config/gcloud/credentials"],deniedPatterns:["*.pem","*.key","credentials.json"]},hooks:{preCommit:["gal check --staged"],prePush:["gal audit --quick"]}};await this.writeFile(".claude/settings.json",JSON.stringify(o,null,2)),e.push(".claude/settings.json");let s=this.generateClaudeMd();return await this.writeFile("CLAUDE.md",s),e.push("CLAUDE.md"),await this.writeFile(".claude/commands/review.md",this.generateReviewCommand()),e.push(".claude/commands/review.md"),await this.writeFile(".claude/commands/check.md",this.generateCheckCommand()),e.push(".claude/commands/check.md"),e}async createGitHubWorkflows(){let e=[];return await this.writeFile(".github/workflows/ci.yml",`name: CI
|
|
1232
|
+
on:
|
|
1233
|
+
push:
|
|
1234
|
+
branches: [main, develop]
|
|
1235
|
+
pull_request:
|
|
1236
|
+
branches: [main]
|
|
1237
|
+
|
|
1238
|
+
jobs:
|
|
1239
|
+
build:
|
|
1240
|
+
runs-on: ubuntu-latest
|
|
1241
|
+
steps:
|
|
1242
|
+
- uses: actions/checkout@v4
|
|
1243
|
+
- name: Setup Node
|
|
1244
|
+
uses: actions/setup-node@v4
|
|
1245
|
+
with:
|
|
1246
|
+
node-version: '20'
|
|
1247
|
+
cache: 'npm'
|
|
1248
|
+
- run: npm ci
|
|
1249
|
+
- run: npm run lint
|
|
1250
|
+
- run: npm test
|
|
1251
|
+
- run: npm run build
|
|
1252
|
+
|
|
1253
|
+
security:
|
|
1254
|
+
runs-on: ubuntu-latest
|
|
1255
|
+
steps:
|
|
1256
|
+
- uses: actions/checkout@v4
|
|
1257
|
+
- name: Run security scan
|
|
1258
|
+
run: npx gal audit
|
|
1259
|
+
`),e.push(".github/workflows/ci.yml"),await this.writeFile(".github/workflows/pr-governance.yml",`name: PR Governance
|
|
1260
|
+
on:
|
|
1261
|
+
pull_request:
|
|
1262
|
+
types: [opened, synchronize]
|
|
1263
|
+
|
|
1264
|
+
jobs:
|
|
1265
|
+
governance:
|
|
1266
|
+
runs-on: ubuntu-latest
|
|
1267
|
+
steps:
|
|
1268
|
+
- uses: actions/checkout@v4
|
|
1269
|
+
- name: Run governance checks
|
|
1270
|
+
run: npx gal check --pr
|
|
1271
|
+
- name: Security review
|
|
1272
|
+
run: npx gal audit --strict
|
|
1273
|
+
`),e.push(".github/workflows/pr-governance.yml"),e}async createGitHooks(){let e=[],n=`#!/bin/bash
|
|
1274
|
+
# GAL Config Enforcement Hook
|
|
1275
|
+
# Generated by GAL CLI (Convenience Package)
|
|
1276
|
+
# Ensures AI agent configs match CISO-approved version
|
|
1277
|
+
|
|
1278
|
+
set -e
|
|
1279
|
+
|
|
1280
|
+
GAL_API_URL="\${GAL_API_URL:-https://api.gal.dev}"
|
|
1281
|
+
GAL_ORG_ID="\${GAL_ORG_ID:-${this.config.orgName}}"
|
|
1282
|
+
|
|
1283
|
+
# Colors
|
|
1284
|
+
RED='\\033[0;31m'
|
|
1285
|
+
GREEN='\\033[0;32m'
|
|
1286
|
+
YELLOW='\\033[1;33m'
|
|
1287
|
+
NC='\\033[0m'
|
|
1288
|
+
|
|
1289
|
+
# Platforms to check
|
|
1290
|
+
PLATFORMS=("claude" "cursor" "gemini" "codex" "windsurf")
|
|
1291
|
+
|
|
1292
|
+
check_platform_config() {
|
|
1293
|
+
local platform=$1
|
|
1294
|
+
local config_dir=".$platform"
|
|
1295
|
+
|
|
1296
|
+
# Skip if no config for this platform
|
|
1297
|
+
if [ ! -d "$config_dir" ]; then
|
|
1298
|
+
return 0
|
|
1299
|
+
fi
|
|
1300
|
+
|
|
1301
|
+
# Calculate local config hash
|
|
1302
|
+
local_hash=$(find "$config_dir" -type f \\( -name "*.md" -o -name "*.json" -o -name "*.yaml" -o -name "*.yml" -o -name "*.toml" \\) -exec cat {} \\; 2>/dev/null | sha256sum | cut -d' ' -f1)
|
|
1303
|
+
|
|
1304
|
+
# Fetch approved config from GAL API
|
|
1305
|
+
response=$(curl -s -f "$GAL_API_URL/organizations/$GAL_ORG_ID/approved-config?platform=$platform" 2>/dev/null || echo '{"approved":false}')
|
|
1306
|
+
|
|
1307
|
+
# Check if org has set an approved config
|
|
1308
|
+
approved=$(echo "$response" | grep -o '"approved":true' || echo "")
|
|
1309
|
+
if [ -z "$approved" ]; then
|
|
1310
|
+
# No approved config set - allow (org hasn't set a standard yet)
|
|
1311
|
+
return 0
|
|
1312
|
+
fi
|
|
1313
|
+
|
|
1314
|
+
# Extract approved hash
|
|
1315
|
+
approved_hash=$(echo "$response" | grep -o '"hash":"[^"]*"' | cut -d'"' -f4)
|
|
1316
|
+
version=$(echo "$response" | grep -o '"version":"[^"]*"' | cut -d'"' -f4)
|
|
1317
|
+
|
|
1318
|
+
if [ "$local_hash" != "$approved_hash" ]; then
|
|
1319
|
+
echo ""
|
|
1320
|
+
echo -e "\${RED}\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\${NC}"
|
|
1321
|
+
echo -e "\${RED} GAL CONFIG ENFORCEMENT - COMMIT BLOCKED\${NC}"
|
|
1322
|
+
echo -e "\${RED}\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\${NC}"
|
|
1323
|
+
echo ""
|
|
1324
|
+
echo -e " Your \${YELLOW}$platform\${NC} AI agent config is OUT OF SYNC"
|
|
1325
|
+
echo -e " with the CISO-approved organization standard."
|
|
1326
|
+
echo ""
|
|
1327
|
+
echo -e " Approved version: \${GREEN}v$version\${NC}"
|
|
1328
|
+
echo -e " Your hash: $local_hash"
|
|
1329
|
+
echo -e " Expected hash: $approved_hash"
|
|
1330
|
+
echo ""
|
|
1331
|
+
echo -e " To sync your config, run:"
|
|
1332
|
+
echo ""
|
|
1333
|
+
echo -e " \${GREEN}gal sync\${NC}"
|
|
1334
|
+
echo ""
|
|
1335
|
+
echo -e "\${RED}\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\${NC}"
|
|
1336
|
+
echo ""
|
|
1337
|
+
return 1
|
|
1338
|
+
fi
|
|
1339
|
+
|
|
1340
|
+
return 0
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
# Main execution
|
|
1344
|
+
failed=0
|
|
1345
|
+
|
|
1346
|
+
for platform in "\${PLATFORMS[@]}"; do
|
|
1347
|
+
if ! check_platform_config "$platform"; then
|
|
1348
|
+
failed=1
|
|
1349
|
+
fi
|
|
1350
|
+
done
|
|
1351
|
+
|
|
1352
|
+
if [ $failed -eq 1 ]; then
|
|
1353
|
+
exit 1
|
|
1354
|
+
fi
|
|
1355
|
+
|
|
1356
|
+
echo -e "\${GREEN}GAL: Config check passed\${NC}"
|
|
1357
|
+
exit 0
|
|
1358
|
+
`;return await this.writeFile(".git/hooks/pre-commit",n),e.push(".git/hooks/pre-commit"),await this.writeFile(".husky/pre-commit",n),e.push(".husky/pre-commit"),e}async createSecurityConfig(){let e=[];await this.writeFile(".gitleaks.toml",`# GAL Security Configuration
|
|
1359
|
+
title = "GAL Gitleaks Configuration"
|
|
1360
|
+
|
|
1361
|
+
[extend]
|
|
1362
|
+
useDefault = true
|
|
1363
|
+
|
|
1364
|
+
[[rules]]
|
|
1365
|
+
id = "gal-api-key"
|
|
1366
|
+
description = "GAL API Key"
|
|
1367
|
+
regex = '''gal_[a-zA-Z0-9]{32}'''
|
|
1368
|
+
secretGroup = 0
|
|
1369
|
+
|
|
1370
|
+
[[rules]]
|
|
1371
|
+
id = "generic-api-key"
|
|
1372
|
+
description = "Generic API Key"
|
|
1373
|
+
regex = '''(?i)api[_-]?key["']?\\s*[:=]\\s*["'][a-zA-Z0-9]{20,}["']'''
|
|
1374
|
+
|
|
1375
|
+
[allowlist]
|
|
1376
|
+
paths = [
|
|
1377
|
+
".gitleaks.toml",
|
|
1378
|
+
"*.md",
|
|
1379
|
+
"*.example",
|
|
1380
|
+
]
|
|
1381
|
+
`),e.push(".gitleaks.toml");let r=`# Security Policy
|
|
1382
|
+
|
|
1383
|
+
## Reporting a Vulnerability
|
|
1384
|
+
|
|
1385
|
+
Please report security vulnerabilities to security@${this.config.orgName}.com.
|
|
1386
|
+
|
|
1387
|
+
## Supported Versions
|
|
1388
|
+
|
|
1389
|
+
| Version | Supported |
|
|
1390
|
+
| ------- | ------------------ |
|
|
1391
|
+
| latest | :white_check_mark: |
|
|
1392
|
+
|
|
1393
|
+
## Security Measures
|
|
1394
|
+
|
|
1395
|
+
This project uses GAL (Governance Agentic Layer) for:
|
|
1396
|
+
- Automated security scanning
|
|
1397
|
+
- Secret detection
|
|
1398
|
+
- Compliance validation
|
|
1399
|
+
- Code review automation
|
|
1400
|
+
`;return await this.writeFile("SECURITY.md",r),e.push("SECURITY.md"),e}async createDocumentation(){let e=[];return await this.writeFile(".env.example",`# GAL Configuration
|
|
1401
|
+
GAL_ORG_ID=your-org-id
|
|
1402
|
+
GAL_PROJECT_ID=your-project-id
|
|
1403
|
+
|
|
1404
|
+
# GitHub (for PR automation)
|
|
1405
|
+
GITHUB_TOKEN=ghp_xxxx
|
|
1406
|
+
|
|
1407
|
+
# GitHub (for time tracking)
|
|
1408
|
+
GITHUB_TOKEN=your-github-token
|
|
1409
|
+
GITHUB_REPO=YOUR-PROJECT
|
|
1410
|
+
|
|
1411
|
+
# Optional integrations
|
|
1412
|
+
SLACK_WEBHOOK_URL=
|
|
1413
|
+
DATADOG_API_KEY=
|
|
1414
|
+
`),e.push(".env.example"),e}generateClaudeMd(){return`# ${this.config.projectName} - Claude Code Configuration
|
|
1415
|
+
|
|
1416
|
+
## Project Overview
|
|
1417
|
+
|
|
1418
|
+
This project is governed by GAL (Governance Agentic Layer) with **${this.config.complianceLevel}** compliance level.
|
|
1419
|
+
|
|
1420
|
+
## Governance Rules
|
|
1421
|
+
|
|
1422
|
+
### Security
|
|
1423
|
+
- All code changes are scanned for secrets and vulnerabilities
|
|
1424
|
+
- Sandboxed execution is enforced
|
|
1425
|
+
- Security findings block merges
|
|
1426
|
+
|
|
1427
|
+
### Code Quality
|
|
1428
|
+
- Automated code review on all PRs
|
|
1429
|
+
- Test coverage requirements enforced
|
|
1430
|
+
- Linting must pass before commit
|
|
1431
|
+
|
|
1432
|
+
### Compliance
|
|
1433
|
+
- ${this.config.complianceLevel==="strict"?"SOC 2, GDPR, ISO 27001":"Basic security"} compliance validated
|
|
1434
|
+
- Audit logging ${this.config.complianceLevel!=="basic"?"enabled":"disabled"}
|
|
1435
|
+
- ${tk[this.config.complianceLevel].requiredReviewers} reviewer(s) required
|
|
1436
|
+
|
|
1437
|
+
## Commands
|
|
1438
|
+
|
|
1439
|
+
- \`/review\` - Run code review
|
|
1440
|
+
- \`/check\` - Run security check
|
|
1441
|
+
- \`/audit\` - Full security audit
|
|
1442
|
+
|
|
1443
|
+
## Contact
|
|
1444
|
+
|
|
1445
|
+
Organization: ${this.config.orgName}
|
|
1446
|
+
`}generateReviewCommand(){return`---
|
|
1447
|
+
description: Run automated code review
|
|
1448
|
+
---
|
|
1449
|
+
|
|
1450
|
+
Review the current changes for:
|
|
1451
|
+
1. Security issues
|
|
1452
|
+
2. Code quality
|
|
1453
|
+
3. Best practices
|
|
1454
|
+
4. Test coverage
|
|
1455
|
+
|
|
1456
|
+
Provide actionable feedback for any issues found.
|
|
1457
|
+
`}generateCheckCommand(){return`---
|
|
1458
|
+
description: Run pre-commit security checks
|
|
1459
|
+
---
|
|
1460
|
+
|
|
1461
|
+
Check staged files for:
|
|
1462
|
+
1. Hardcoded secrets
|
|
1463
|
+
2. API keys
|
|
1464
|
+
3. Dangerous patterns
|
|
1465
|
+
4. Security vulnerabilities
|
|
1466
|
+
|
|
1467
|
+
Report findings with severity and fix suggestions.
|
|
1468
|
+
`}async writeFile(e,n){console.log(`Creating: ${e}`)}static getAvailableFeatures(){return[...ek]}formatResult(e){let n=[];if(n.push(""),n.push("\u2550".repeat(50)),n.push(" GAL SETUP COMPLETE"),n.push("\u2550".repeat(50)),n.push(""),e.success){n.push("\u2705 Setup completed successfully!"),n.push(""),n.push("Files created:");for(let r of e.filesCreated)n.push(` \u{1F4C4} ${r}`)}else n.push("\u274C Setup failed");if(e.warnings.length>0){n.push(""),n.push("Warnings:");for(let r of e.warnings)n.push(` \u26A0\uFE0F ${r}`)}n.push(""),n.push("Next Steps:");for(let r of e.nextSteps)n.push(` ${r}`);return n.push(""),n.push("\u2550".repeat(50)),n.join(`
|
|
1469
|
+
`)}};var C=require("fs"),N=require("path"),ZT=require("os");var bh=require("fs"),Co=require("path"),Es=null,Wu=null,HM=process.env.GAL_DEBUG==="true"||process.env.GAL_DEBUG==="1";function Ds(t){HM&&console.log(`[GAL:project-detection] ${t}`)}function vh(t=process.cwd()){if(Ds(`Finding project root from: ${t}`),Wu===t&&Es!==null)return Ds(`Using cached project root: ${Es}`),Es;let e=t,n=(0,Co.parse)(e).root;for(;e!==n;){let o=(0,Co.join)(e,".git");if((0,bh.existsSync)(o))return Ds(`Found .git at: ${e}`),Wu=t,Es=e,e;Ds(`No .git in: ${e}, checking parent...`),e=(0,Co.dirname)(e)}let r=(0,Co.join)(n,".git");return(0,bh.existsSync)(r)?(Ds(`Found .git at filesystem root: ${n}`),Wu=t,Es=n,n):(Ds(`Not in git repo, using start path: ${t}`),Wu=t,Es=t,t)}var XT=require("crypto");var Ke=require("fs"),Et=require("path");function nk(t){if(!t||typeof t!="string")throw new Error("fileName is required and must be a string");let e=t.replace(/\.\./g,"").replace(/\//g,"-").replace(/\\/g,"-").replace(/[\x00-\x1f]/g,"").replace(/[<>:"|?*]/g,"-").replace(/-+/g,"-").trim();if(e=e.replace(/^[.-]+/,""),!e||e.length===0)throw new Error("fileName results in empty string after sanitization");return e.length>200&&(e=e.substring(0,200)),e}function Ju(t,e){let n=(0,Et.resolve)(t);if(!(0,Et.resolve)(e).startsWith(n))throw new Error(`Path traversal detected: ${e} is outside ${t}`)}function WM(t,e,n,r){let o=(0,Et.join)(t,".github");(0,Ke.existsSync)(o)||(0,Ke.mkdirSync)(o,{recursive:!0});let s=(0,Et.join)(o,"copilot-instructions.md");(0,Ke.writeFileSync)(s,e.content,"utf-8");let i=".github/copilot-instructions.md";n.push(i),r.push({path:i,type:"instructions",name:"copilot-instructions",platform:"copilot"})}function JM(t,e,n,r){let o=(0,Et.join)(t,".github","instructions");(0,Ke.existsSync)(o)||(0,Ke.mkdirSync)(o,{recursive:!0});let s=nk(e.fileName);s.endsWith(".instructions.md")||(s.endsWith(".md")?s=s.replace(/\.md$/,".instructions.md"):s=`${s}.instructions.md`);let i=["---"];i.push(`applyTo: "${e.applyTo}"`),e.excludeAgent&&i.push(`excludeAgent: "${e.excludeAgent}"`),i.push("---"),i.push("");let a=e.content,c=a.match(/^---\s*\n[\s\S]*?\n---\s*\n?/);c&&(a=a.substring(c[0].length));let u=i.join(`
|
|
1470
|
+
`)+a,d=(0,Et.join)(o,s);Ju(o,d),(0,Ke.writeFileSync)(d,u,"utf-8");let m=`.github/instructions/${s}`;n.push(m),r.push({path:m,type:"path-instructions",name:e.name,description:`Applies to: ${e.applyTo}`,platform:"copilot"})}function YM(t,e,n,r){let o=(0,Et.join)(t,".github","agents");(0,Ke.existsSync)(o)||(0,Ke.mkdirSync)(o,{recursive:!0});let s=nk(e.fileName);s.endsWith(".agent.md")||(s.endsWith(".md")?s=s.replace(/\.md$/,".agent.md"):s=`${s}.agent.md`);let i=["---"];if(i.push(`name: ${e.name}`),i.push(`description: "${e.description.replace(/"/g,'\\"')}"`),e.tools){if(e.tools==="*")i.push('tools: "*"');else if(Array.isArray(e.tools)&&e.tools.length>0){i.push("tools:");for(let p of e.tools)i.push(` - ${p}`)}}e.target&&i.push(`target: ${e.target}`),e.infer!==void 0&&i.push(`infer: ${e.infer}`),i.push("---"),i.push("");let a=e.content,c=a.match(/^---\s*\n[\s\S]*?\n---\s*\n?/);c&&(a=a.substring(c[0].length));let u=i.join(`
|
|
1471
|
+
`)+a,d=(0,Et.join)(o,s);Ju(o,d),(0,Ke.writeFileSync)(d,u,"utf-8");let m=`.github/agents/${s}`;n.push(m),r.push({path:m,type:"agents",name:e.name,description:e.description,platform:"copilot"})}function KM(t,e,n,r){let o=e.name.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,64);if(!o||o.length===0)throw new Error(`Skill name '${e.name}' results in empty string after sanitization`);let s=(0,Et.join)(t,".github","skills"),i=(0,Et.join)(s,o);Ju(s,i),(0,Ke.existsSync)(i)||(0,Ke.mkdirSync)(i,{recursive:!0});let a=["---"];a.push(`name: ${o}`);let c=e.description.substring(0,1024);a.push(`description: "${c.replace(/"/g,'\\"')}"`),a.push("---"),a.push("");let u=e.content,d=u.match(/^---\s*\n[\s\S]*?\n---\s*\n?/);d&&(u=u.substring(d[0].length));let m=a.join(`
|
|
1472
|
+
`)+u,p=(0,Et.join)(i,"SKILL.md");Ju(i,p),(0,Ke.writeFileSync)(p,m,"utf-8");let f=`.github/skills/${o}/SKILL.md`;n.push(f),r.push({path:f,type:"skills",name:o,description:c,platform:"copilot"})}function rk(t,e,n,r){let o=(0,Et.join)(t,".github");if((0,Ke.existsSync)(o)||(0,Ke.mkdirSync)(o,{recursive:!0}),e.copilotInstructions?.content&&WM(t,e.copilotInstructions,n,r),e.copilotPathInstructions&&e.copilotPathInstructions.length>0)for(let s of e.copilotPathInstructions)JM(t,s,n,r);if(e.copilotAgents&&e.copilotAgents.length>0)for(let s of e.copilotAgents)YM(t,s,n,r);if(e.copilotSkills&&e.copilotSkills.length>0)for(let s of e.copilotSkills)KM(t,s,n,r)}var W=require("fs"),ge=require("path"),JT=require("crypto"),Hd=H(HT(),1),eb={claude:".claude",cursor:".cursor",copilot:".github",gemini:".gemini",codex:".codex",windsurf:".windsurf"},WT={claude:"CLAUDE.md",cursor:".cursorrules",copilot:"copilot-instructions.md",gemini:"GEMINI.md",codex:"AGENTS.md",windsurf:".windsurfrules"},qd=class{projectRoot;galDir;constructor(e){this.projectRoot=e,this.galDir=(0,ge.join)(e,".gal")}getGalDir(){return this.galDir}getConfigPath(){return(0,ge.join)(this.galDir,"config.yaml")}getSyncStatePath(){return(0,ge.join)(this.galDir,"sync-state.json")}getPlatformsDir(){return(0,ge.join)(this.galDir,"platforms")}getPlatformDir(e){return(0,ge.join)(this.getPlatformsDir(),e)}ensureGalDir(){(0,W.existsSync)(this.galDir)||(0,W.mkdirSync)(this.galDir,{recursive:!0})}configExists(){return(0,W.existsSync)(this.getConfigPath())}readConfig(){let e=this.getConfigPath();if(!(0,W.existsSync)(e))return null;try{let n=(0,W.readFileSync)(e,"utf-8");return(0,Hd.parse)(n)}catch(n){return console.error("Error reading .gal/config.yaml:",n),null}}writeConfig(e){this.ensureGalDir();let n=this.getConfigPath(),r=(0,Hd.stringify)(e,{lineWidth:120,defaultStringType:"QUOTE_DOUBLE",defaultKeyType:"PLAIN"});(0,W.writeFileSync)(n,r,"utf-8")}readSyncState(){let e=this.getSyncStatePath();if(!(0,W.existsSync)(e))return null;try{let n=(0,W.readFileSync)(e,"utf-8");return JSON.parse(n)}catch(n){return console.error("Error reading sync state:",n),null}}writeSyncState(e){this.ensureGalDir();let n=this.getSyncStatePath();(0,W.writeFileSync)(n,JSON.stringify(e,null,2),"utf-8")}convertFromApiResponse(e,n){let r={version:1,organization:n,policyName:e.policyName,syncedAt:new Date().toISOString(),hash:e.hash||this.calculateHash(JSON.stringify(e)),configVersion:e.version||"1"};if(e.claudeMd&&(r.instructions={content:e.claudeMd.content,sourceRepo:e.claudeMd.sourceRepo,sourcePath:e.claudeMd.sourcePath}),e.commands&&e.commands.length>0&&(r.commands=e.commands.map(o=>{let{description:s,allowedTools:i}=this.parseCommandFrontmatter(o.content);return{name:o.name,description:s,content:o.content,allowedTools:i,sourceRepo:o.sourceRepo,sourcePath:o.sourcePath}})),e.subagents&&e.subagents.length>0&&(r.agents=e.subagents.map(o=>{let{description:s}=this.parseCommandFrontmatter(o.content);return{name:o.name,description:s,content:o.content,sourceRepo:o.sourceRepo,sourcePath:o.sourcePath}})),e.hooks&&e.hooks.length>0&&(r.hooks=e.hooks.map(o=>({name:o.name,event:this.detectHookEvent(o.content),content:o.content,runtime:this.detectHookRuntime(o.name,o.content),sourceRepo:o.sourceRepo,sourcePath:o.sourcePath}))),e.rules&&e.rules.length>0&&(r.rules=e.rules.map(o=>({name:o.name,content:o.content,sourceRepo:o.sourceRepo,sourcePath:o.sourcePath}))),e.settings)try{let o=JSON.parse(e.settings.content);r.settings={model:o.model,maxTokens:o.maxTokens,permissions:o.permissions}}catch{}return r}generatePlatformConfigs(e,n=["claude","cursor","copilot","gemini","codex","windsurf"]){let r=new Map;for(let o of n){let s=[];if(e.instructions){let i=this.generateInstructionFile(e,o);i&&s.push(i)}if(o==="claude"&&e.commands)for(let i of e.commands)s.push({path:`commands/${i.name}.md`,content:i.content,hash:this.calculateHash(i.content)});if(o==="claude"&&e.agents)for(let i of e.agents)s.push({path:`agents/${i.name}.md`,content:i.content,hash:this.calculateHash(i.content)});if(e.rules)for(let i of e.rules){let a=o==="cursor"?".mdc":".md";s.push({path:`rules/${i.name}${a}`,content:this.formatRuleForPlatform(i,o),hash:this.calculateHash(i.content)})}if(o==="claude"&&e.hooks)for(let i of e.hooks){let a=i.runtime==="python"?".py":i.runtime==="bash"?".sh":".js";s.push({path:`hooks/${i.name}${a}`,content:i.content,hash:this.calculateHash(i.content)})}if(e.settings){let i=this.generateSettingsForPlatform(e.settings,o);i&&s.push({path:"settings.json",content:i,hash:this.calculateHash(i)})}r.set(o,{platform:o,generatedAt:new Date().toISOString(),sourceHash:e.hash,files:s})}return r}writePlatformBundles(e){let n=[],r=this.getPlatformsDir();for(let[o,s]of e){let i=(0,ge.join)(r,o);(0,W.existsSync)(i)&&(0,W.rmSync)(i,{recursive:!0}),(0,W.mkdirSync)(i,{recursive:!0});for(let c of s.files){let u=(0,ge.join)(i,c.path),d=(0,ge.dirname)(u);(0,W.existsSync)(d)||(0,W.mkdirSync)(d,{recursive:!0}),(0,W.writeFileSync)(u,c.content,"utf-8"),n.push((0,ge.join)(".gal","platforms",o,c.path))}let a=(0,ge.join)(i,".bundle.json");(0,W.writeFileSync)(a,JSON.stringify({platform:s.platform,generatedAt:s.generatedAt,sourceHash:s.sourceHash,fileCount:s.files.length},null,2),"utf-8")}return n}writePlatformBundleToNative(e){let n=[],r=eb[e.platform],o=(0,ge.join)(this.projectRoot,r),s=WT[e.platform];for(let i of e.files){let a=e.platform==="claude"&&i.path===s||e.platform==="cursor"&&i.path===s,c=a?(0,ge.join)(this.projectRoot,i.path):(0,ge.join)(o,i.path),u=(0,ge.dirname)(c);(0,W.existsSync)(u)||(0,W.mkdirSync)(u,{recursive:!0}),(0,W.writeFileSync)(c,i.content,"utf-8"),n.push(a?i.path:(0,ge.join)(r,i.path))}return n}copyToNativeLocations(e=["claude"]){let n=[];for(let r of e){let o=this.getPlatformDir(r);if(!(0,W.existsSync)(o))continue;let s=(0,ge.join)(this.projectRoot,eb[r]);if(r==="claude"){let i=(0,ge.join)(o,"CLAUDE.md");if((0,W.existsSync)(i)){let a=(0,ge.join)(this.projectRoot,"CLAUDE.md");(0,W.writeFileSync)(a,(0,W.readFileSync)(i,"utf-8")),n.push("CLAUDE.md")}}else if(r==="cursor"){let i=(0,ge.join)(o,".cursorrules");if((0,W.existsSync)(i)){let a=(0,ge.join)(this.projectRoot,".cursorrules");(0,W.writeFileSync)(a,(0,W.readFileSync)(i,"utf-8")),n.push(".cursorrules")}}if((0,W.existsSync)(o)){let i=this.copyDirectory(o,s,[".bundle.json","CLAUDE.md",".cursorrules"]);n.push(...i.map(a=>(0,ge.join)(eb[r],a)))}}return n}calculateHash(e){return(0,JT.createHash)("sha256").update(e).digest("hex").substring(0,16)}parseCommandFrontmatter(e){let n=e.match(/^---\s*\n([\s\S]*?)\n---/);if(!n)return{};let r=n[1],o={},s=r.match(/description:\s*(.+)/);s&&(o.description=s[1].trim().replace(/^["']|["']$/g,""));let i=r.match(/allowed-tools:\s*\[([^\]]+)\]/);return i&&(o.allowedTools=i[1].split(",").map(a=>a.trim())),o}detectHookEvent(e){let n=e.toLowerCase();return n.includes("pre_tool_use")||n.includes("pretooluse")?"PreToolUse":n.includes("post_tool_use")||n.includes("posttooluse")?"PostToolUse":n.includes("session_end")||n.includes("sessionend")?"SessionEnd":"SessionStart"}detectHookRuntime(e,n){return e.endsWith(".py")||n.includes("#!/usr/bin/env python")?"python":e.endsWith(".sh")||n.includes("#!/bin/bash")?"bash":"node"}generateInstructionFile(e,n){if(!e.instructions)return null;let r=WT[n],o=e.instructions.content;return n==="cursor"?o=`# Project Rules
|
|
1473
|
+
|
|
1474
|
+
${o}`:n==="copilot"&&(o=`# GitHub Copilot Instructions
|
|
1475
|
+
|
|
1476
|
+
${o}`),{path:r,content:o,hash:this.calculateHash(o)}}formatRuleForPlatform(e,n){return n==="cursor"?`${["---",`description: "${e.name}"`,e.alwaysApply?"alwaysApply: true":"","---"].filter(Boolean).join(`
|
|
1477
|
+
`)}
|
|
1478
|
+
|
|
1479
|
+
${e.content}`:e.content}generateSettingsForPlatform(e,n){return n==="claude"?JSON.stringify({model:e.model,maxTokens:e.maxTokens,permissions:e.permissions,...e.platformOverrides?.claude||{}},null,2):null}copyDirectory(e,n,r=[]){let o=[];(0,W.existsSync)(n)||(0,W.mkdirSync)(n,{recursive:!0});let s=(0,W.readdirSync)(e,{withFileTypes:!0});for(let i of s){if(r.includes(i.name))continue;let a=(0,ge.join)(e,i.name),c=(0,ge.join)(n,i.name);if(i.isDirectory()){let u=this.copyDirectory(a,c,r);o.push(...u.map(d=>(0,ge.join)(i.name,d)))}else(0,W.writeFileSync)(c,(0,W.readFileSync)(a)),o.push(i.name)}return o}};var QT="1.0.0",Eq=`---
|
|
422
1480
|
description: "GAL CLI awareness for syncing org-approved configs"
|
|
423
1481
|
alwaysApply: true
|
|
424
1482
|
---
|
|
425
1483
|
|
|
426
1484
|
# GAL CLI
|
|
427
1485
|
|
|
428
|
-
<!-- GAL_CURSOR_RULES_VERSION = "${
|
|
1486
|
+
<!-- GAL_CURSOR_RULES_VERSION = "${QT}" -->
|
|
429
1487
|
|
|
430
1488
|
The \`gal\` CLI is available for managing org-approved AI agent configurations.
|
|
431
1489
|
|
|
@@ -438,7 +1496,7 @@ The \`gal\` CLI is available for managing org-approved AI agent configurations.
|
|
|
438
1496
|
- **Confirmation Required**: Always ask the user before running any \`gal\` command
|
|
439
1497
|
- **Self-Discovery**: If unsure about syntax, run \`gal --help\` or \`gal <command> --help\` first
|
|
440
1498
|
- **Sync Notifications**: When configs need updating, ask: "Do you want me to sync gal now?"
|
|
441
|
-
`,
|
|
1499
|
+
`,No={approved:!0,hash:"demo-approved-v1.3.0",version:"1.3.0",platform:"claude",approvedAt:"2024-12-20T10:00:00Z",approvedBy:"admin@scheduler-systems.com",claudeMd:`# Scheduler-Systems Ltd - Approved Claude Code Configuration
|
|
442
1500
|
|
|
443
1501
|
## Organization Standards
|
|
444
1502
|
All Claude Code usage must follow these guidelines.
|
|
@@ -751,59 +1809,261 @@ Use the approved deployment workflow:
|
|
|
751
1809
|
|
|
752
1810
|
// Allow the operation
|
|
753
1811
|
console.log(JSON.stringify({ decision: 'allow' }));
|
|
754
|
-
`}]};function
|
|
1812
|
+
`}]};function Dq(t){let e=(0,N.join)(t,".cursor","rules","gal-cli"),n=(0,N.join)(e,"RULE.md");try{if((0,C.existsSync)(n)){let o=(0,C.readFileSync)(n,"utf-8").match(/GAL_CURSOR_RULES_VERSION = "([^"]+)"/);if(o&&o[1]===QT)return!0}return(0,C.existsSync)(e)||(0,C.mkdirSync)(e,{recursive:!0}),(0,C.writeFileSync)(n,Eq,"utf-8"),!0}catch{return!1}}function eF(t,e,n){let r=(0,N.join)(process.cwd(),".gal"),o=(0,N.join)(r,"sync-state.json");(0,C.existsSync)(r)||(0,C.mkdirSync)(r,{recursive:!0});let s={};for(let[c,u]of e)s[c]=u;let i=s.claude||Object.values(s)[0],a={organization:t,schemaVersion:2,platforms:s,hookSettings:n,lastSyncHash:i?.lastSyncHash,lastSyncTimestamp:i?.lastSyncTimestamp,syncedFiles:i?.syncedFiles,policyName:i?.policyName};(0,C.writeFileSync)(o,JSON.stringify(a,null,2),"utf-8")}function tF(t,e,n,r,o=[],s,i){let a=new Map;a.set("claude",{lastSyncHash:e,lastSyncTimestamp:new Date().toISOString(),approvedConfigVersion:r,policyName:s||void 0,syncedFiles:o.length>0?o:[]}),eF(t,a,i)}function Cq(t){let e={lastSyncHash:t.lastSyncHash,lastSyncTimestamp:t.lastSyncTimestamp,approvedConfigVersion:t.version,policyName:t.policyName,syncedFiles:t.syncedFiles||[]};return{organization:t.organization,schemaVersion:2,platforms:{claude:e},hookSettings:t.hookSettings,lastSyncHash:t.lastSyncHash,lastSyncTimestamp:t.lastSyncTimestamp,syncedFiles:t.syncedFiles,version:t.version,policyName:t.policyName}}function un(t){return(0,XT.createHash)("sha256").update(t).digest("hex").substring(0,16)}function kq(){let t=vh(),e=(0,N.join)(t,".gal","sync-state.json");if(!(0,C.existsSync)(e))return null;try{let n=(0,C.readFileSync)(e,"utf-8"),r=JSON.parse(n);if(!r.schemaVersion){let o=Cq(r);return(0,C.writeFileSync)(e,JSON.stringify(o,null,2),"utf-8"),o}return r}catch{return null}}function qa(t){let e=t.match(/^---\s*\n([\s\S]*?)\n---/);if(!e)return{};let n=e[1],r={},o=n.match(/description:\s*(.+)/);o&&(r.description=o[1].trim().replace(/^["']|["']$/g,""));let s=n.match(/allowed-tools:\s*\[([^\]]+)\]/);return s&&(r.allowedTools=s[1].split(",").map(i=>i.trim())),r}function Aq(t){let{description:e}=qa(t);if(e)return e;let n=t.match(/^#\s+(.+)$/m);return n?n[1].trim():t.split(`
|
|
1813
|
+
`).find(o=>o.trim()&&!o.startsWith("#"))?.trim().slice(0,100)||"No description"}function tb(t){return t==="settings.json"||t.endsWith("/settings.json")?"settings":t.startsWith("rules/")||t.includes("/rules/")?"rules":t.startsWith("commands/")||t.includes("/commands/")?"commands":t.startsWith("skills/")||t.includes("/skills/")?"skills":t.startsWith("hooks/")||t.includes("/hooks/")?"hooks":t.startsWith("agents/")||t.includes("/agents/")?"agents":t===".mcp.json"||t.endsWith(".mcp.json")?"mcp":"unknown"}function nb(t){let e=t.split("/");return e[e.length-1].replace(/\.(md|json|js|py|sh)$/,"")}function rb(t,e,n,r){let o={};for(let m of t)o[m.type]||(o[m.type]=[]),o[m.type].push(m);let s={commands:{label:"Slash Commands",icon:"/"},skills:{label:"Skills",icon:"\u26A1"},settings:{label:"Settings",icon:"\u2699"},rules:{label:"Rules",icon:"\u{1F4CB}"},hooks:{label:"Hooks",icon:"\u{1FA9D}"},agents:{label:"Agents",icon:"\u{1F916}"},mcp:{label:"MCP Config",icon:"\u{1F50C}"},unknown:{label:"Other",icon:"\u{1F4C4}"}};console.log(l.dim(`
|
|
755
1814
|
// Synced from org approved config:
|
|
756
|
-
`));for(let[
|
|
757
|
-
Never synced.`)),console.log(
|
|
758
|
-
`))
|
|
759
|
-
\u2713
|
|
760
|
-
`)):(console.log(i.
|
|
761
|
-
\
|
|
762
|
-
`)),console.log(
|
|
763
|
-
`)))
|
|
764
|
-
|
|
1815
|
+
`));for(let[m,p]of Object.entries(o)){let{label:f}=s[m]||{label:m,icon:"\u{1F4C4}"};if(m==="commands")for(let g of p)console.log(l.green(` /${g.name}`)),g.description&&console.log(l.white(` ${g.description}`)),g.allowedTools&&g.allowedTools.length>0&&console.log(l.dim(" Allowed tools: ")+l.cyan(g.allowedTools.join(", "))),console.log();else if(m==="skills")for(let g of p)console.log(l.green(` \u26A1 ${g.name}`)),g.description&&console.log(l.white(` ${g.description}`)),console.log();else if(m==="settings")console.log(l.green(" \u2699 Settings")),console.log(l.white(" Organization-approved configuration")),console.log();else if(m==="agents")for(let g of p)console.log(l.green(` \u{1F916} ${g.name}`)),g.description&&console.log(l.white(` ${g.description}`)),console.log();else if(m==="rules"){console.log(l.green(` \u{1F4CB} Rules (${p.length})`));for(let g of p)console.log(l.dim(` \u2192 ${g.name}.md`));console.log()}else if(m==="hooks"){console.log(l.green(` \u{1FA9D} Hooks (${p.length})`));for(let g of p)console.log(l.dim(` \u2192 ${g.path}`));console.log()}else if(m==="mcp")console.log(l.green(" \u{1F50C} MCP Configuration")),console.log(l.white(" Model Context Protocol servers")),console.log();else{console.log(l.green(` \u{1F4C4} ${f} (${p.length})`));for(let g of p)console.log(l.dim(` \u2192 ${g.path}`));console.log()}}console.log(l.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));let i=t.length,a=o.commands?.length||0,c=r?` \u2022 Policy: ${l.cyan(r)}`:"",u=[];a>0&&u.push(`${a} command${a>1?"s":""}`),o.rules?.length&&u.push(`${o.rules.length} rule${o.rules.length>1?"s":""}`),o.settings?.length&&u.push("settings"),o.agents?.length&&u.push(`${o.agents.length} agent${o.agents.length>1?"s":""}`),o.skills?.length&&u.push(`${o.skills.length} skill${o.skills.length>1?"s":""}`),o.hooks?.length&&u.push(`${o.hooks.length} hook${o.hooks.length>1?"s":""}`),o.mcp?.length&&u.push("MCP config");let d=u.length>0?u.join(", "):`${i} file${i>1?"s":""}`;console.log(l.green("[GAL] ")+l.white(`${d} synced from ${e} v${n}`)+c)}function Tq(){let t=new F("sync").description("Sync local configs with CISO-approved organization standard");return t.command("status").description("Check current sync status (for extension integration)").option("--json","Output as JSON").option("-p, --platform <platform>","Filter by platform (claude, cursor, etc.)").action(async n=>{let r=kq(),o=n.platform,s={};if(r?.platforms)for(let[a,c]of Object.entries(r.platforms))o&&a!==o||c&&(s[a]={synced:!0,version:c.approvedConfigVersion,lastSync:c.lastSyncTimestamp,fileCount:c.syncedFiles?.length||0,policyName:c.policyName});if(r&&Object.keys(s).length===0&&r.lastSyncTimestamp&&(!o||o==="claude")&&(s.claude={synced:!0,version:r.version,lastSync:r.lastSyncTimestamp,fileCount:r.syncedFiles?.length||0,policyName:r.policyName}),n.json){if(!r||Object.keys(s).length===0){console.log(JSON.stringify({synced:!1,neverSynced:!0,upToDate:!1,lastSync:null,organization:null,hash:null,platforms:{}}));return}console.log(JSON.stringify({synced:!0,neverSynced:!1,organization:r.organization,schemaVersion:r.schemaVersion||1,platforms:s,upToDate:!0,lastSync:r.lastSyncTimestamp||Object.values(s)[0]?.lastSync,version:r.version||Object.values(s)[0]?.version,hash:r.lastSyncHash,approvedHash:r.approvedConfigHash,syncedFiles:r.syncedFiles||[]}));return}if(!r||Object.keys(s).length===0){console.log(l.yellow(`
|
|
1816
|
+
Never synced.`)),console.log(l.dim(`Run: gal sync --pull
|
|
1817
|
+
`));return}console.log(l.green(`
|
|
1818
|
+
\u2713 Sync Status
|
|
1819
|
+
`)),console.log(` Organization: ${l.bold(r.organization)}`);let i=Object.keys(s).length;if(i>0){console.log(),console.log(l.dim(` Platforms synced: ${i}`)),console.log();let a={claude:{name:"Claude Code",icon:"\u2728"},cursor:{name:"Cursor",icon:"\u2328\uFE0F"},copilot:{name:"GitHub Copilot",icon:"\u{1F680}"},gemini:{name:"Gemini",icon:"\u{1F48E}"},codex:{name:"Codex",icon:"\u{1F537}"},windsurf:{name:"Windsurf",icon:"\u{1F30A}"}};for(let[c,u]of Object.entries(s)){let d=a[c]||{name:c,icon:"\u{1F4E6}"};console.log(` ${d.icon} ${l.cyan(d.name)}`),console.log(` Version: ${u.version||"unknown"}`),console.log(` Last sync: ${u.lastSync?new Date(u.lastSync).toLocaleString():"unknown"}`),console.log(` Files: ${u.fileCount}`),u.policyName&&console.log(` Policy: ${u.policyName}`),console.log()}}else console.log(` Version: ${r.version}`),console.log(` Last sync: ${r.lastSyncTimestamp?new Date(r.lastSyncTimestamp).toLocaleString():"unknown"}`),r.syncedFiles&&r.syncedFiles.length>0&&console.log(` Synced files: ${r.syncedFiles.length}`),console.log();console.log()}),t.argument("[orgName]","Organization name (uses default if not specified)").option("-d, --directory <path>","Local config directory (auto-detects project root)",process.cwd()).option("-p, --platform <platform>","Filter by platform (claude, cursor, etc.)").option("--pull","Download CISO-approved config to local directory").option("--repo <name>","Personal repo to sync from (for users without org)").option("--check","Check if local files match approved config (for hooks)").option("--demo","Run in demo mode with mock data").option("--output-json","Output as JSON").action(async(n,r)=>{try{let o=vh(r.directory);if(r.demo||process.env.GAL_DEMO_MODE==="true"){let g=n||"Scheduler-Systems";r.pull?await Hq(g,o):(console.log(l.green(`
|
|
1820
|
+
[DEMO MODE] Would sync with Scheduler-Systems Ltd approved config`)),console.log(l.dim("Use --pull to write demo config files")));return}let i=M.load();!i.authToken&&!i.apiKey&&(console.error(l.red("\u2716 Not authenticated. Run: gal auth login")),process.exit(1));let a=i.apiUrl||process.env.GAL_API_URL;a||(console.error(l.red("Error: API URL not configured")),process.exit(1));let c=new ce({...i,apiUrl:a});r.repo&&r.pull&&(await KT(c,r.repo,r.directory),process.exit(0));let u=n||i.defaultOrg;if(!u){if(r.pull){if((await c.getPersonalGitHubStatus()).connected){console.log(l.blue(`
|
|
1821
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL Config Sync - Personal GitHub")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1822
|
+
`));let h=x("Checking for approved config...").start(),y=await c.getPersonalApprovedConfig();y.approved&&y.configContent&&(h.succeed(l.green("Found approved config")),console.log(l.dim(`Source: ${y.sourceRepo||"personal"}`)),console.log(l.dim(`Version: ${y.version||"1.0.0"}`)),await Vq(c,y,r.directory),process.exit(0)),h.info(l.dim("No approved config set, scanning repos..."));let _=await c.getPersonalConfigRepos();if(_.total===0){console.log(l.yellow(`
|
|
1823
|
+
No repos with Claude configs found`)),console.log(l.dim(`
|
|
1824
|
+
Create a .claude/ directory in one of your repos with:`)),console.log(l.dim(" - settings.json")),console.log(l.dim(" - commands/*.md")),console.log(l.dim(" - rules/*.md")),console.log(l.dim(`
|
|
1825
|
+
Or set an approved config at: https://app.gal.run/approved-config`)),console.log(l.dim("Then run: gal sync --pull"));return}console.log(l.green(`Found ${_.total} repo(s) with Claude configs`));let E=_.repos[0];console.log(l.dim(`Using: ${E.fullName}`)),await KT(c,E.name,r.directory),process.exit(0)}console.error(l.red("No organization configured")),console.log(l.dim(`
|
|
1826
|
+
You have two options:
|
|
1827
|
+
`)),console.log(l.white("1. For org users:")),console.log(l.dim(" gal sync <orgName> --pull")),console.log(l.dim(` gal config set defaultOrg <orgName>
|
|
1828
|
+
`)),console.log(l.white("2. For personal GitHub:")),console.log(l.dim(" Connect at: https://app.gal.run/settings?tab=github")),console.log(l.dim(" Then run: gal sync --pull")),process.exit(1)}console.error(l.red("Error: No organization specified and no default set")),console.log(l.dim(`
|
|
1829
|
+
Run: gal sync <orgName> --pull`)),console.log(l.dim("Or: gal config set defaultOrg <orgName>")),process.exit(1)}r.pull&&(await Gq(c,u,o,r.platform,a),process.exit(0)),r.check&&(await qq(c,u,o,r.platform),process.exit(0));let d=x(`Comparing configs for ${u}...`).start(),m;try{m=await c.getOrganization(u)}catch(g){d.fail(l.red(`Failed to fetch organization ${u}`)),console.error(l.dim(g.message)),process.exit(1)}let p=Fq(o,r.platform);d.stop();let f=Oq(p,m);r.outputJson&&(console.log(JSON.stringify(f,null,2)),process.exit(0)),Iq(u,f),process.exit(0)}catch(o){let s=o instanceof Error?o:new Error(String(o));console.error(l.red("Error:"),s.message),await Hs("sync",s),process.exit(1)}}),t}function Fq(t,e){let n=["claude","cursor","copilot","gemini","codex","windsurf"],r=[];for(let o of n){if(e&&o!==e)continue;let s=ob(o),i=(0,N.join)(t,s);if(!(0,C.existsSync)(i))continue;let a=[],c=(0,N.join)(i,"settings.json");(0,C.existsSync)(c)&&a.push({path:c,type:"settings",content:(0,C.readFileSync)(c,"utf-8")});let u=(0,N.join)(i,"rules");if((0,C.existsSync)(u)){let d=(0,C.readdirSync)(u).filter(m=>m.endsWith(".md")||m.endsWith(".mdc"));for(let m of d){let p=(0,N.join)(u,m);a.push({path:p,type:"rule",content:(0,C.readFileSync)(p,"utf-8")})}}if(o==="cursor"){let d=(0,N.join)(t,".cursorrules");(0,C.existsSync)(d)&&a.push({path:d,type:"rule",content:(0,C.readFileSync)(d,"utf-8")})}if(o==="claude"){let d=(0,N.join)(i,"commands");if((0,C.existsSync)(d)){let p=(0,C.readdirSync)(d).filter(f=>f.endsWith(".md"));for(let f of p){let g=(0,N.join)(d,f);a.push({path:g,type:"command",content:(0,C.readFileSync)(g,"utf-8")})}}let m=(0,N.join)(i,"hooks");if((0,C.existsSync)(m)){let p=(0,C.readdirSync)(m).filter(f=>f.endsWith(".py")||f.endsWith(".sh"));for(let f of p){let g=(0,N.join)(m,f);a.push({path:g,type:"hook",content:(0,C.readFileSync)(g,"utf-8")})}}}a.length>0&&r.push({platform:o,directory:i,files:a})}return r}function ob(t){return{claude:".claude",cursor:".cursor",copilot:".github",gemini:".gemini",codex:".codex",windsurf:".windsurf"}[t]}function Oq(t,e){let n={platforms:{},summary:{localOnly:0,remoteOnly:0,inSync:0,total:0}},r=t.find(i=>i.platform==="claude"),o=e.totalCommands+e.totalHooks+(e.settings.versions>0?1:0),s={hasLocal:!!r,hasRemote:o>0,localCount:r?.files.length||0,remoteCount:o};return r&&o===0?(s.status="local-only",n.summary.localOnly+=r.files.length):!r&&o>0?(s.status="remote-only",n.summary.remoteOnly+=o):r&&o>0&&(s.status="exists-both",n.summary.inSync+=r.files.length),n.platforms.claude=s,n.summary.total=Math.max(s.localCount,s.remoteCount),n}function Iq(t,e){console.log(l.blue(`
|
|
765
1830
|
Sync Status for ${t}:
|
|
766
|
-
`));for(let[n,
|
|
767
|
-
\u{1F4A1} Tip: Local-only configs are not tracked by GAL. Consider pushing them to your repo.`)),e.summary.remoteOnly>0&&console.log(
|
|
768
|
-
\u{1F4A1} Tip: Use "gal sync --pull" to download CISO-approved configs.`))}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
1831
|
+
`));for(let[n,r]of Object.entries(e.platforms)){let o=r;console.log(l.bold(n.toUpperCase())),o.status==="local-only"?(console.log(l.yellow(" \u26A0 Local only:"),`${o.localCount} configs`),console.log(l.dim(" These configs exist locally but not in GAL"))):o.status==="remote-only"?(console.log(l.cyan(" \u2193 Remote only:"),`${o.remoteCount} configs`),console.log(l.dim(" These configs exist in GAL but not locally"))):o.status==="exists-both"&&(console.log(l.green(" \u2713 Exists in both:"),`Local: ${o.localCount}, Remote: ${o.remoteCount}`),o.localCount!==o.remoteCount&&console.log(l.dim(" File counts differ - manual review needed"))),console.log()}console.log(l.bold("Summary:")),console.log(l.gray(" Total configs:"),e.summary.total),console.log(l.yellow(" Local only:"),e.summary.localOnly),console.log(l.cyan(" Remote only:"),e.summary.remoteOnly),e.summary.localOnly>0&&console.log(l.dim(`
|
|
1832
|
+
\u{1F4A1} Tip: Local-only configs are not tracked by GAL. Consider pushing them to your repo.`)),e.summary.remoteOnly>0&&console.log(l.dim(`
|
|
1833
|
+
\u{1F4A1} Tip: Use "gal sync --pull" to download CISO-approved configs.`))}function Nq(t,e,n,r){let o=(0,N.join)(t,".cursor");if(e.rules&&e.rules.length>0){let s=(0,N.join)(o,"rules");(0,C.existsSync)(s)||(0,C.mkdirSync)(s,{recursive:!0});for(let i of e.rules){let a=i.name.endsWith(".mdc")||i.name.endsWith(".md")?i.name:`${i.name}.mdc`,c=(0,N.join)(s,a);(0,C.writeFileSync)(c,i.content,"utf-8");let u=`.cursor/rules/${a}`;n.push(u),r.push({path:u,type:"rules",name:i.name.replace(/\.(mdc|md)$/,""),platform:"cursor"})}}if(e.cursorRules?.content){let s=(0,N.join)(t,".cursorrules");(0,C.writeFileSync)(s,e.cursorRules.content,"utf-8"),n.push(".cursorrules"),r.push({path:".cursorrules",type:"rules",name:".cursorrules",platform:"cursor"})}if(e.settings?.content){(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});let s=(0,N.join)(o,"settings.json");(0,C.writeFileSync)(s,e.settings.content,"utf-8"),n.push(".cursor/settings.json"),r.push({path:".cursor/settings.json",type:"settings",name:"settings.json",platform:"cursor"})}}function xq(t,e,n,r){let o=(0,N.join)(t,".claude");if(e.claudeMd?.content){let s=(0,N.join)(t,"CLAUDE.md");(0,C.writeFileSync)(s,e.claudeMd.content,"utf-8"),n.push("CLAUDE.md"),r.push({path:"CLAUDE.md",type:"unknown",name:"CLAUDE.md",platform:"claude"})}if(e.commands&&e.commands.length>0){let s=(0,N.join)(o,"commands");(0,C.existsSync)(s)||(0,C.mkdirSync)(s,{recursive:!0});for(let i of e.commands){let a=i.name.replace(/:/g,"/"),c=a.endsWith(".md")?a:`${a}.md`,u=(0,N.join)(s,c),d=(0,N.dirname)(u);(0,C.existsSync)(d)||(0,C.mkdirSync)(d,{recursive:!0}),(0,C.writeFileSync)(u,i.content,"utf-8");let m=`.claude/commands/${c}`;n.push(m);let{description:p,allowedTools:f}=qa(i.content);r.push({path:m,type:"commands",name:i.name.replace(/\.md$/,""),description:p,allowedTools:f,platform:"claude"})}}if(e.hooks&&e.hooks.length>0){let s=(0,N.join)(o,"hooks");(0,C.existsSync)(s)||(0,C.mkdirSync)(s,{recursive:!0});for(let i of e.hooks){let a=(0,N.join)(s,i.name);(0,C.writeFileSync)(a,i.content,"utf-8");let c=`.claude/hooks/${i.name}`;n.push(c),r.push({path:c,type:"hooks",name:i.name,platform:"claude"})}}if(e.settings?.content){(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});let s=(0,N.join)(o,"settings.json");(0,C.writeFileSync)(s,e.settings.content,"utf-8"),n.push(".claude/settings.json"),r.push({path:".claude/settings.json",type:"settings",name:"settings.json",platform:"claude"})}if(e.subagents&&e.subagents.length>0){let s=(0,N.join)(o,"agents");(0,C.existsSync)(s)||(0,C.mkdirSync)(s,{recursive:!0});for(let i of e.subagents){let a=i.name.replace(/:/g,"/"),c=a.endsWith(".md")?a:`${a}.md`,u=(0,N.join)(s,c),d=(0,N.dirname)(u);(0,C.existsSync)(d)||(0,C.mkdirSync)(d,{recursive:!0}),(0,C.writeFileSync)(u,i.content,"utf-8");let m=`.claude/agents/${c}`;n.push(m);let{description:p}=qa(i.content);r.push({path:m,type:"agents",name:i.name.replace(/\.md$/,""),description:p,platform:"claude"})}}if(e.skills&&e.skills.length>0){let s=(0,N.join)(o,"skills");(0,C.existsSync)(s)||(0,C.mkdirSync)(s,{recursive:!0});for(let i of e.skills){let a=(0,N.join)(s,i.name);(0,C.existsSync)(a)||(0,C.mkdirSync)(a,{recursive:!0});let c=(0,N.join)(a,"SKILL.md");(0,C.writeFileSync)(c,i.content,"utf-8");let u=`.claude/skills/${i.name}/SKILL.md`;n.push(u),r.push({path:u,type:"skills",name:i.name,description:i.description,platform:"claude"})}}if(e.rules&&e.rules.length>0){let s=(0,N.join)(o,"rules");(0,C.existsSync)(s)||(0,C.mkdirSync)(s,{recursive:!0});for(let i of e.rules){let a=i.name.endsWith(".md")?i.name:`${i.name}.md`,c=(0,N.join)(s,a);(0,C.writeFileSync)(c,i.content,"utf-8");let u=`.claude/rules/${a}`;n.push(u),r.push({path:u,type:"rules",name:i.name.replace(/\.md$/,""),platform:"claude"})}}}function YT(t,e,n,r){let o=(0,N.join)(t,".codex"),s=(0,C.existsSync)(o),i="";if(e.claudeMd?.content&&(i=e.claudeMd.content,i=i.replace(/Claude Code/g,"Codex CLI"),i=i.replace(/CLAUDE\.md/g,"AGENTS.md"),i=i.replace(/\.claude\//g,".codex/")),e.rules&&e.rules.length>0){i+=`
|
|
1834
|
+
|
|
1835
|
+
---
|
|
1836
|
+
|
|
1837
|
+
## Project Rules
|
|
1838
|
+
|
|
1839
|
+
`,i+=`_The following rules are embedded from the organization's approved configuration._
|
|
1840
|
+
|
|
1841
|
+
`;for(let a of e.rules){let c=a.name.replace(/\.md$/,"");i+=`### ${c}
|
|
1842
|
+
|
|
1843
|
+
`,i+=a.content,i+=`
|
|
1844
|
+
|
|
1845
|
+
`}}if(i){let a=(0,N.join)(t,"AGENTS.md");(0,C.writeFileSync)(a,i.trim(),"utf-8"),n.push("AGENTS.md"),r.push({path:"AGENTS.md",type:"unknown",name:"AGENTS.md",platform:"codex"})}if(s){if(e.skills&&e.skills.length>0){let a=(0,N.join)(o,"skills");(0,C.existsSync)(a)||(0,C.mkdirSync)(a,{recursive:!0});for(let c of e.skills){let u=(0,N.join)(a,c.name);(0,C.existsSync)(u)||(0,C.mkdirSync)(u,{recursive:!0});let d=(0,N.join)(u,"SKILL.md");(0,C.writeFileSync)(d,c.content,"utf-8");let m=`.codex/skills/${c.name}/SKILL.md`;n.push(m),r.push({path:m,type:"skills",name:c.name,platform:"codex"})}}if(e.settings?.content){let a=(0,N.join)(o,"settings.json");(0,C.writeFileSync)(a,e.settings.content,"utf-8"),n.push(".codex/settings.json"),r.push({path:".codex/settings.json",type:"settings",name:"settings.json",platform:"codex"})}}}var Pq="gal-",Rq=".gemini/commands",jq=".gemini/skills";function $q(t){let e=t.replace(/[:/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"-");return`${Pq}${e}.md`}function Lq(t){if(!t||t.length===0)return 0;let e=(0,N.join)((0,ZT.homedir)(),".codex","prompts");(0,C.existsSync)(e)||(0,C.mkdirSync)(e,{recursive:!0});let n=0;for(let r of t){let o=$q(r.name),s=(0,N.join)(e,o);(0,C.writeFileSync)(s,r.content,"utf-8"),n+=1}return n}function Bq(t,e,n){let r=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\s+/g," ").trim();if(!n.includes("'''"))return[`# Invoked via: /${t}`,`description = "${r}"`,"prompt = '''",n,"'''",""].join(`
|
|
1846
|
+
`);let s=n.replace(/\\/g,"\\\\").replace(/"""/g,'\\"""');return[`# Invoked via: /${t}`,`description = "${r}"`,'prompt = """',s,'"""',""].join(`
|
|
1847
|
+
`)}function Mq(t,e){let n=0,r=0;if(e.commands&&e.commands.length>0){let o=(0,N.join)(t,Rq);(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.commands){let i=s.name.replace(/:/g,"/"),a=(0,N.join)(o,`${i}.toml`),c=(0,N.dirname)(a);(0,C.existsSync)(c)||(0,C.mkdirSync)(c,{recursive:!0});let u=Aq(s.content),d=Bq(s.name,u,s.content);(0,C.writeFileSync)(a,d,"utf-8"),n+=1}}if(e.skills&&e.skills.length>0){let o=(0,N.join)(t,jq);(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.skills){let i=(0,N.join)(o,s.name);(0,C.existsSync)(i)||(0,C.mkdirSync)(i,{recursive:!0});let a=(0,N.join)(i,"SKILL.md");(0,C.writeFileSync)(a,s.content,"utf-8"),r+=1}}return{commandsWritten:n,skillsWritten:r}}function Uq(t,e){let n=(0,N.join)(t,".gal","approved","claude"),r=(0,N.join)(n,".claude");if((0,C.existsSync)(r)||(0,C.mkdirSync)(r,{recursive:!0}),e.claudeMd?.content){let o=(0,N.join)(n,"CLAUDE.md");(0,C.writeFileSync)(o,e.claudeMd.content,"utf-8")}if(e.commands&&e.commands.length>0){let o=(0,N.join)(r,"commands");(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.commands){let i=s.name.replace(/:/g,"/"),a=i.endsWith(".md")?i:`${i}.md`,c=(0,N.join)(o,a),u=(0,N.dirname)(c);(0,C.existsSync)(u)||(0,C.mkdirSync)(u,{recursive:!0}),(0,C.writeFileSync)(c,s.content,"utf-8")}}if(e.hooks&&e.hooks.length>0){let o=(0,N.join)(r,"hooks");(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.hooks){let i=(0,N.join)(o,s.name);(0,C.writeFileSync)(i,s.content,"utf-8")}}if(e.settings?.content){let o=(0,N.join)(r,"settings.json");(0,C.writeFileSync)(o,e.settings.content,"utf-8")}if(e.subagents&&e.subagents.length>0){let o=(0,N.join)(r,"agents");(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.subagents){let i=s.name.replace(/:/g,"/"),a=i.endsWith(".md")?i:`${i}.md`,c=(0,N.join)(o,a),u=(0,N.dirname)(c);(0,C.existsSync)(u)||(0,C.mkdirSync)(u,{recursive:!0}),(0,C.writeFileSync)(c,s.content,"utf-8")}}if(e.skills&&e.skills.length>0){let o=(0,N.join)(r,"skills");(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.skills){let i=(0,N.join)(o,s.name);(0,C.existsSync)(i)||(0,C.mkdirSync)(i,{recursive:!0});let a=(0,N.join)(i,"SKILL.md");(0,C.writeFileSync)(a,s.content,"utf-8")}}if(e.rules&&e.rules.length>0){let o=(0,N.join)(r,"rules");(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});for(let s of e.rules){let i=s.name.endsWith(".md")?s.name:`${s.name}.md`,a=(0,N.join)(o,i);(0,C.writeFileSync)(a,s.content,"utf-8")}}}async function Gq(t,e,n,r,o){console.log(l.blue(`
|
|
1848
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL Config Sync - Convenience Package")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1849
|
+
`));let s;try{s=await t.getHookSettings(e),console.log(l.dim(` Fetched hook settings (interval: ${s.globalIntervalMinutes||10} min)`))}catch{s={globalIntervalMinutes:10,intervals:{}}}let i=x("Fetching approved configs for all platforms...").start(),a;try{a=await t.getAllApprovedConfigs(e),i.succeed(l.green(`Found ${a.available_platforms.length} platform(s) with approved configs`))}catch(h){i.fail(l.red(`Failed to fetch configs: ${h.message}`)),dc(0,!1);return}let c=r?a.available_platforms.filter(h=>h===r):a.available_platforms;if(c.length===0){r?(console.log(l.yellow(`
|
|
1850
|
+
\u26A0 No approved config found for platform '${r}'.`)),console.log(l.dim(" Available platforms: "+(a.available_platforms.join(", ")||"none")))):console.log(l.yellow(`
|
|
1851
|
+
\u26A0 No CISO-approved configs found for this organization.`)),console.log(l.dim(" Ask your admin to approve configs on the GAL dashboard.")),console.log(l.dim(` Dashboard: https://app.gal.run/approved-config
|
|
1852
|
+
`)),dc(0,!1);try{await t.reportDeveloperStatus(e,{syncStatus:"never_synced"})}catch{}return}let u=new Map,d=[],m=[],p=0;console.log(l.blue(`
|
|
1853
|
+
Syncing platforms:`));for(let h of c){let y=a.configs[h];if(!y){console.log(l.dim(` ${h}: No config data (skipped)`));continue}let _=x(` ${h}: Writing config files...`).start(),E=[],D=[];try{if(h==="cursor")Nq(n,y,E,D);else if(h==="claude")xq(n,y,E,D),Uq(n,y);else if(h==="codex")YT(n,y,E,D);else if(h==="copilot"){let I=[];rk(n,{copilotInstructions:y.copilotInstructions?{platform:"copilot",fileName:"copilot-instructions.md",content:y.copilotInstructions.content,version:1,repoName:""}:void 0,copilotPathInstructions:y.copilotPathInstructions?.map(k=>({platform:"copilot",name:k.name,fileName:k.fileName,content:k.content,applyTo:k.applyTo,excludeAgent:k.excludeAgent,version:1,repoName:""})),copilotAgents:y.copilotAgents?.map(k=>({platform:"copilot",name:k.name,fileName:k.fileName,description:k.description,content:k.content,tools:k.tools,target:k.target,infer:k.infer,version:1,repoName:""})),copilotSkills:y.copilotSkills?.map(k=>({platform:"copilot",name:k.name,dirName:k.dirName,description:k.description,content:k.content,version:1,repoName:""})),version:y.version,policyName:y.policyName},E,I);for(let k of I)D.push({path:k.path,type:k.type==="instructions"||k.type==="path-instructions"?"rules":k.type==="agents"?"agents":k.type==="skills"?"skills":"unknown",name:k.name,description:k.description,platform:"copilot"})}else if(y.configContent){let I=ob(h),k=(0,N.join)(n,I);(0,C.existsSync)(k)||(0,C.mkdirSync)(k,{recursive:!0});try{let O=JSON.parse(y.configContent);for(let[v,P]of Object.entries(O)){let U=(0,N.join)(k,v),de=(0,N.dirname)(U);(0,C.existsSync)(de)||(0,C.mkdirSync)(de,{recursive:!0}),(0,C.writeFileSync)(U,P),E.push((0,N.join)(I,v)),D.push({path:v,type:tb(v),name:nb(v),platform:h})}}catch{let O=(0,N.join)(k,"approved-config.json");(0,C.writeFileSync)(O,y.configContent),E.push((0,N.join)(I,"approved-config.json"))}}let T=un(JSON.stringify(y));u.set(h,{lastSyncHash:T,lastSyncTimestamp:new Date().toISOString(),approvedConfigVersion:y.version,policyName:y.policyName,syncedFiles:E}),d.push(...E),m.push(...D),p+=E.length,_.succeed(l.green(` ${h}: Synced ${E.length} file(s) (v${y.version})`))}catch(T){_.fail(l.red(` ${h}: Failed - ${T.message}`))}}let f=a.configs.claude;if(f&&!c.includes("codex")){let h=x(" codex: Generating from Claude config...").start(),y=[],_=[];try{YT(n,f,y,_);let E=un(JSON.stringify(f));u.set("codex",{lastSyncHash:E,lastSyncTimestamp:new Date().toISOString(),approvedConfigVersion:f.version,policyName:f.policyName,syncedFiles:y}),d.push(...y),m.push(..._),p+=y.length,h.succeed(l.green(` codex: Generated ${y.length} file(s) from Claude config`))}catch(E){h.fail(l.red(` codex: Failed - ${E.message}`))}}if(f?.commands&&f.commands.length>0){let h=Lq(f.commands);h>0&&console.log(l.dim(` Synced: ${h} Codex prompts to ~/.codex/prompts/`))}if(f&&!c.includes("gemini")){let{commandsWritten:h,skillsWritten:y}=Mq(n,f);h>0&&console.log(l.dim(` Synced: ${h} Gemini commands to .gemini/commands/`)),y>0&&console.log(l.dim(` Synced: ${y} Gemini skills to .gemini/skills/`))}eF(e,u,s);try{let h=new qd(n),y=a.configs.claude?"claude":c[0],_=a.configs[y];if(_){let E={approved:!0,hash:_.hash||un(JSON.stringify(_)),version:_.version,platform:y,policyName:_.policyName,claudeMd:_.claudeMd?.content?{content:_.claudeMd.content,hash:un(_.claudeMd.content)}:void 0,settings:_.settings?.content?{content:_.settings.content,hash:un(_.settings.content)}:void 0,commands:_.commands?.map(O=>({name:O.name,content:O.content,hash:un(O.content)})),hooks:_.hooks?.map(O=>({name:O.name,event:O.event||"PreToolUse",content:O.content,hash:un(O.content)})),rules:_.rules?.map(O=>({name:O.name,content:O.content,hash:un(O.content)})),subagents:_.subagents?.map(O=>({name:O.name,content:O.content,hash:un(O.content)}))},D=h.convertFromApiResponse(E,e);D.syncedAt=new Date().toISOString(),D.hash=E.hash||"",D.configVersion=_.version||"1",D.policyName=_.policyName||void 0,h.writeConfig(D),console.log(l.dim(" Written: .gal/config.yaml (canonical format)")),a.configs.claude&&console.log(l.dim(" Written: .gal/approved/claude/ (approved config mirror)"));let T=["cursor","copilot","gemini","windsurf"],I=h.generatePlatformConfigs(D,T),k=T.filter(O=>!c.includes(O));for(let O of k){let v=I.get(O);v&&h.writePlatformBundleToNative(v)}}}catch(h){console.log(l.dim(` Note: Could not write .gal/config.yaml: ${h.message}`))}if((!r||r==="cursor"||c.includes("cursor"))&&Dq(n)&&(console.log(l.dim(" GAL CLI rules installed to .cursor/rules/gal-cli/")),d.push(".cursor/rules/gal-cli/RULE.md")),m.length>0){let h=c[0],y=a.configs[h];rb(m,e,y?.version||"1",y?.policyName||"")}s&&console.log(l.dim(` Hook reminder interval: ${s.globalIntervalMinutes||10} minutes`)),dc(p,!0);try{let h=a.configs[c[0]];await t.reportDeveloperStatus(e,{lastSyncAt:new Date().toISOString(),syncedConfigVersion:h?.version||"1",syncStatus:"synced"})}catch{}console.log(l.green(`
|
|
1854
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.green(" \u2713 Sync complete! Your configs match org standard.")),console.log(l.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));let g=c.map(h=>{let y=u.get(h);return`${h}: ${y?.syncedFiles.length||0}`}).join(", ");console.log(l.blue(`
|
|
1855
|
+
[GAL] ${p} org configs loaded (${g})
|
|
1856
|
+
`)),console.log(l.yellow(`\u26A0\uFE0F RESTART Claude Code/Cursor for changes to take effect.
|
|
1857
|
+
`))}async function KT(t,e,n){console.log(l.blue(`
|
|
1858
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL Config Sync - Personal GitHub")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1859
|
+
`));let r=x(`Fetching configs from ${e}...`).start();try{if(!(await t.getPersonalGitHubStatus()).connected){r.fail(l.red("Personal GitHub not connected")),console.log(l.dim(`
|
|
1860
|
+
Connect your personal GitHub first:`)),console.log(l.dim(" 1. Go to GAL dashboard: https://app.gal.run/settings?tab=github")),console.log(l.dim(' 2. Click "Connect Personal GitHub"')),console.log(l.dim(" 3. Then retry: gal sync --pull --repo "+e));return}let s=await t.getPersonalRepoConfigs(e);if(!s.approved||!s.configContent){r.fail(l.red(`No Claude configs found in ${e}`)),console.log(l.dim(`
|
|
1861
|
+
Make sure your repo has a .claude/ directory with:`)),console.log(l.dim(" - settings.json")),console.log(l.dim(" - commands/*.md")),console.log(l.dim(" - rules/*.md"));return}r.succeed(l.green(`Found configs in ${s.repo||e}`));let i=JSON.parse(s.configContent),a=".claude",c=(0,N.join)(n,a);(0,C.existsSync)(c)||(0,C.mkdirSync)(c,{recursive:!0});let u=[],d=[];for(let[p,f]of Object.entries(i)){let g=(0,N.join)(c,p),h=(0,N.dirname)(g);(0,C.existsSync)(h)||(0,C.mkdirSync)(h,{recursive:!0}),(0,C.writeFileSync)(g,f);let y=(0,N.join)(a,p);u.push(y);let _=tb(p),E=nb(p),D={path:p,type:_,name:E};if(_==="commands"&&typeof f=="string"){let{description:T,allowedTools:I}=qa(f);D.description=T,D.allowedTools=I}d.push(D)}d.length>0&&rb(d,s.repo||e,"1",void 0);let m=un(s.configContent);tF(`personal:${e}`,m,m,"1",u,void 0,void 0),console.log(l.green(`
|
|
1862
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.green(" \u2713 Sync complete! Configs loaded from personal repo.")),console.log(l.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),console.log(l.blue(`
|
|
1863
|
+
[GAL] ${u.length} configs loaded from ${s.repo||e}
|
|
1864
|
+
`)),console.log(l.yellow(`\u26A0\uFE0F RESTART Claude Code/Cursor for changes to take effect.
|
|
1865
|
+
`))}catch(o){r.fail(l.red("Failed to fetch configs")),console.error(l.dim(o.message))}}async function Vq(t,e,n){let r=x("Installing approved config...").start();try{if(!e.configContent){r.fail(l.red("No config content in approved config"));return}let o=JSON.parse(e.configContent),s=".claude",i=(0,N.join)(n,s);(0,C.existsSync)(i)||(0,C.mkdirSync)(i,{recursive:!0});let a=[],c=[];for(let[d,m]of Object.entries(o)){let p=(0,N.join)(i,d),f=(0,N.dirname)(p);(0,C.existsSync)(f)||(0,C.mkdirSync)(f,{recursive:!0}),(0,C.writeFileSync)(p,m);let g=(0,N.join)(s,d);a.push(g);let h=tb(d),y=nb(d),_={path:d,type:h,name:y};if(h==="commands"&&typeof m=="string"){let{description:E,allowedTools:D}=qa(m);_.description=E,_.allowedTools=D}c.push(_)}if(r.succeed(l.green(`Installed ${c.length} configs`)),c.length>0){let d=e.sourceRepo||"personal";rb(c,d,e.version||"1",void 0)}let u=e.hash||un(e.configContent);tF("personal:approved",u,u,e.version||"1",a,void 0,void 0),console.log(l.green(`
|
|
1866
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.green(" \u2713 Sync complete! Approved config loaded.")),console.log(l.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),console.log(l.blue(`
|
|
1867
|
+
[GAL] ${a.length} configs loaded from approved config
|
|
1868
|
+
`)),console.log(l.yellow(`\u26A0\uFE0F RESTART Claude Code/Cursor for changes to take effect.
|
|
1869
|
+
`))}catch(o){r.fail(l.red("Failed to install approved config")),console.error(l.dim(o.message))}}async function qq(t,e,n,r){let o=r?[r]:["claude"],s={inSync:!0,missingFiles:[],expectedFiles:[]};for(let i of o)try{let a=await t.getApprovedConfig(e,i);if(!a.approved||!a.configContent)continue;s.approvedHash=a.hash;try{let c=JSON.parse(a.configContent),u=ob(i);for(let d of Object.keys(c)){let m=(0,N.join)(u,d),p=(0,N.join)(n,m);s.expectedFiles.push(m),(0,C.existsSync)(p)||(s.missingFiles.push(m),s.inSync=!1)}}catch{}}catch{}console.log(JSON.stringify(s))}async function Hq(t,e){console.log(l.blue(`
|
|
1870
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL Config Sync - DEMO MODE")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1871
|
+
`)),console.log(l.yellow(` [DEMO] Using Scheduler-Systems Ltd approved config
|
|
1872
|
+
`));let n=x("Syncing approved config...").start(),r=[],o=(0,N.join)(e,".claude");(0,C.existsSync)(o)||(0,C.mkdirSync)(o,{recursive:!0});let s=(0,N.join)(e,"CLAUDE.md");(0,C.writeFileSync)(s,No.claudeMd),r.push("CLAUDE.md"),console.log(l.dim(" \u2192 Written: CLAUDE.md"));let i=(0,N.join)(o,"settings.json");(0,C.writeFileSync)(i,JSON.stringify(No.settings,null,2)),r.push(".claude/settings.json"),console.log(l.dim(" \u2192 Written: .claude/settings.json"));let a=(0,N.join)(o,"commands");(0,C.existsSync)(a)||(0,C.mkdirSync)(a,{recursive:!0});for(let m of No.commands){let p=(0,N.join)(a,`${m.name}.md`);(0,C.writeFileSync)(p,m.content),r.push(`.claude/commands/${m.name}.md`),console.log(l.dim(` \u2192 Written: .claude/commands/${m.name}.md`))}let c=(0,N.join)(o,"hooks");(0,C.existsSync)(c)||(0,C.mkdirSync)(c,{recursive:!0});for(let m of No.hooks){let p=(0,N.join)(c,`${m.name}.js`);(0,C.writeFileSync)(p,m.content),(0,C.chmodSync)(p,"755"),r.push(`.claude/hooks/${m.name}.js`),console.log(l.dim(` \u2192 Written: .claude/hooks/${m.name}.js (${m.event})`))}n.succeed(l.green(`Synced ${r.length} files from Scheduler-Systems Ltd approved config`));let u=(0,N.join)(e,".gal");(0,C.existsSync)(u)||(0,C.mkdirSync)(u,{recursive:!0});let d={lastSyncTimestamp:new Date().toISOString(),lastSyncHash:No.hash,approvedConfigHash:No.hash,lastCheckTimestamp:new Date().toISOString(),organization:t,version:No.version,syncedFiles:r,demoMode:!0};(0,C.writeFileSync)((0,N.join)(u,"sync-state.json"),JSON.stringify(d,null,2)),console.log(l.dim(" Sync state saved to .gal/sync-state.json")),console.log(l.green(`
|
|
1873
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.green(" \u2713 Demo sync complete!")),console.log(l.green("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550")),console.log(l.cyan(`
|
|
1874
|
+
Synced files:`));for(let m of r)console.log(l.dim(` \u2022 ${m}`));console.log(l.yellow(`
|
|
782
1875
|
\u26A0\uFE0F RESTART Claude Code for new slash commands and hooks to work.
|
|
783
|
-
`))}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1876
|
+
`))}var Vt=H(require("fs"),1),xo=H(require("path"),1),Ha=class{templates=[{id:"node-typescript",name:"Node.js TypeScript",description:"Node.js project with TypeScript, ESLint, and Prettier",stack:{language:"TypeScript",runtime:"Node.js 20+",aiPlatforms:["Claude Code","Cursor","Codex"]},features:["TypeScript configuration","ESLint + Prettier","Jest testing","GitHub Actions CI"],requirements:["Node.js 20+","npm or yarn"],files:[{path:"tsconfig.json",content:JSON.stringify({compilerOptions:{target:"ES2022",module:"NodeNext",moduleResolution:"NodeNext",strict:!0,outDir:"./dist",rootDir:"./src"},include:["src/**/*"],exclude:["node_modules"]},null,2)},{path:".eslintrc.json",content:JSON.stringify({env:{node:!0,es2022:!0},extends:["eslint:recommended","plugin:@typescript-eslint/recommended"],parser:"@typescript-eslint/parser"},null,2)}]},{id:"claude-code",name:"Claude Code Project",description:"Pre-configured Claude Code development environment",stack:{language:"TypeScript",runtime:"Node.js 20+",aiPlatforms:["Claude Code"]},features:["Claude Code configuration","Custom slash commands","Memory files","Governance policies"],requirements:["Claude Code CLI","Node.js 20+"],files:[{path:".claude/settings.json",content:JSON.stringify({version:"1.0.0",permissions:{allowedTools:["Read","Write","Edit","Bash"]}},null,2)},{path:"CLAUDE.md",content:`# Project Context
|
|
1877
|
+
|
|
1878
|
+
This project uses Claude Code for AI-assisted development.
|
|
1879
|
+
`}]},{id:"python-fastapi",name:"Python FastAPI",description:"Python FastAPI project with typing and testing",stack:{language:"Python",runtime:"Python 3.11+",aiPlatforms:["Claude Code","Cursor","Codex"]},features:["FastAPI framework","Type hints with mypy","Pytest testing","Docker support"],requirements:["Python 3.11+","pip or poetry"],files:[{path:"pyproject.toml",content:`[project]
|
|
1880
|
+
name = "my-project"
|
|
1881
|
+
version = "0.1.0"
|
|
1882
|
+
requires-python = ">=3.11"
|
|
1883
|
+
|
|
1884
|
+
[tool.pytest.ini_options]
|
|
1885
|
+
testpaths = ["tests"]
|
|
1886
|
+
`}]},{id:"flutter-firebase",name:"Flutter Firebase",description:"Flutter app with Firebase backend",stack:{language:"Dart",runtime:"Flutter 3.x",aiPlatforms:["Claude Code","Cursor"]},features:["Firebase integration","BLoC state management","Multi-flavor builds"],requirements:["Flutter SDK","Firebase CLI"],files:[{path:"analysis_options.yaml",content:`include: package:flutter_lints/flutter.yaml
|
|
1887
|
+
|
|
1888
|
+
linter:
|
|
1889
|
+
rules:
|
|
1890
|
+
prefer_const_constructors: true
|
|
1891
|
+
`}]}];getTemplates(){return this.templates}getTemplate(e){return this.templates.find(n=>n.id===e)}listTemplates(){let e=[];e.push(l.blue.bold(`
|
|
1892
|
+
Available Templates
|
|
1893
|
+
`)),e.push("\u2500".repeat(60));for(let n of this.templates)e.push(`
|
|
1894
|
+
${l.cyan(n.id)}`),e.push(` ${n.name}`),e.push(` ${l.dim(n.description)}`),e.push(` Stack: ${n.stack.language} / ${n.stack.runtime}`);return e.push(`
|
|
1895
|
+
`+"\u2500".repeat(60)),e.push(l.dim(`
|
|
1896
|
+
Generate template: gal template generate <template-id>`)),e.join(`
|
|
1897
|
+
`)}generateFiles(e,n={}){let r=this.getTemplate(e);if(!r)throw new Error(`Template not found: ${e}`);let o=[...r.files];return n.includeGovernance&&(o.push({path:".claude/settings.json",content:JSON.stringify({version:"1.0.0",governance:{enabled:!0,complianceLevel:"standard"}},null,2)}),o.push({path:"CLAUDE.md",content:`# Project Context
|
|
1898
|
+
|
|
1899
|
+
This project uses GAL governance policies.
|
|
1900
|
+
|
|
1901
|
+
## Governance
|
|
1902
|
+
|
|
1903
|
+
- Compliance level: standard
|
|
1904
|
+
- Sandbox: enabled
|
|
1905
|
+
`})),n.outputDir&&n.outputDir!=="."?o.map(s=>({...s,path:xo.join(n.outputDir,s.path)})):o}formatTemplateInfo(e){let n=[];n.push(l.blue.bold(`
|
|
1906
|
+
${e.name}
|
|
1907
|
+
`)),n.push("\u2500".repeat(50)),n.push(`
|
|
1908
|
+
${e.description}
|
|
1909
|
+
`),n.push(l.cyan("Stack:")),n.push(` Language: ${e.stack.language}`),n.push(` Runtime: ${e.stack.runtime}`),e.stack.aiPlatforms&&n.push(` AI Platforms: ${e.stack.aiPlatforms.join(", ")}`),n.push(""),n.push(l.cyan("Features:"));for(let r of e.features)n.push(` \u2022 ${r}`);n.push(""),n.push(l.cyan("Requirements:"));for(let r of e.requirements)n.push(` \u2022 ${r}`);n.push(""),n.push(l.cyan("Files:"));for(let r of e.files)n.push(` \u{1F4C4} ${r.path}`);return n.join(`
|
|
1910
|
+
`)}};function Wq(){let t=new F("template").description("Generate development environment templates");return t.addCommand(new F("list").description("List available templates").action(()=>{let e=new Ha;console.log(e.listTemplates())})),t.addCommand(new F("generate").description("Generate template files").argument("<template-id>","Template ID (e.g., node-typescript)").option("-o, --output <dir>","Output directory",process.cwd()).option("-g, --governance","Include GAL governance files").option("--dry-run","Show files without creating them").option("-f, --force","Overwrite existing files").action(async(e,n)=>{let r=x(`Generating ${e} template...`).start();try{let o=new Ha,s=o.getTemplate(e);if(!s){r.fail(l.red(`Unknown template: ${e}`)),console.log(`
|
|
1911
|
+
Available templates:`);for(let u of o.getTemplates())console.log(` - ${u.id}: ${u.name}`);process.exit(1)}let i=o.generateFiles(e,{outputDir:n.output,includeGovernance:n.governance});if(n.dryRun){r.stop(),console.log(l.blue.bold(`
|
|
1912
|
+
Files that would be created:
|
|
1913
|
+
`));for(let u of i)console.log(` \u{1F4C4} ${u.path}`);console.log(l.dim(`
|
|
1914
|
+
Run without --dry-run to create files.`));return}let a=0,c=0;for(let u of i){let d=xo.resolve(u.path),m=xo.dirname(d);if(Vt.existsSync(d)&&!n.force){c++;continue}Vt.mkdirSync(m,{recursive:!0}),Vt.writeFileSync(d,u.content,"utf-8"),u.executable&&Vt.chmodSync(d,"755"),a++}r.succeed(l.green("Template generated successfully!")),console.log(""),console.log(l.cyan(s.name)),console.log(s.description),console.log(""),console.log(`Files created: ${l.green(a)}`),c>0&&(console.log(`Files skipped (already exist): ${l.yellow(c)}`),console.log(l.dim("Use --force to overwrite existing files"))),console.log(""),console.log(l.blue("Next steps:"));for(let u of s.requirements)console.log(` \u2022 Ensure ${u} is installed`);n.governance&&console.log(" \u2022 Run `gal check` to verify governance setup")}catch(o){r.fail(l.red("Template generation failed")),console.error(l.red(o instanceof Error?o.message:String(o))),process.exit(1)}})),t.addCommand(new F("info").description("Show detailed template information").argument("<template-id>","Template ID").action(e=>{let n=new Ha,r=n.getTemplate(e);r||(console.log(l.red(`Unknown template: ${e}`)),process.exit(1)),console.log(n.formatTemplateInfo(r))})),t.addCommand(new F("create").description("Create a custom template from current directory").option("-n, --name <name>","Template name").option("-o, --output <file>","Output file for template JSON").action(async e=>{let n=x("Analyzing current directory...").start();try{let r=process.cwd(),o=[],s=[".devcontainer/devcontainer.json","tsconfig.json",".eslintrc.json",".prettierrc","pyproject.toml","requirements.txt","analysis_options.yaml","firebase.json"];for(let a of s){let c=xo.join(r,a);Vt.existsSync(c)&&o.push({path:a,content:Vt.readFileSync(c,"utf-8")})}if(n.stop(),o.length===0){console.log(l.yellow("No configuration files found."));return}let i={id:e.name?.toLowerCase().replace(/\s+/g,"-")||"custom-template",name:e.name||"Custom Template",description:"Custom template from current project",stack:{language:"TypeScript",runtime:"Node.js"},features:o.map(a=>`Includes ${a.path}`),requirements:["Review template requirements"],files:o};e.output?(Vt.writeFileSync(e.output,JSON.stringify(i,null,2)),console.log(l.green(`Template saved to ${e.output}`))):console.log(JSON.stringify(i,null,2)),console.log(`
|
|
1915
|
+
Extracted ${o.length} configuration files.`)}catch(r){n.fail(l.red("Template creation failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t}var js=class{config;suites=[{name:"policyValidation",description:"Validate governance policies",tests:[{name:"settings.json exists",fn:async()=>{}},{name:"valid JSON format",fn:async()=>{}},{name:"required fields present",fn:async()=>{}}]},{name:"securityScanner",description:"Security vulnerability checks",tests:[{name:"no hardcoded secrets",fn:async()=>{}},{name:"sandbox enabled",fn:async()=>{}},{name:"denied paths configured",fn:async()=>{}}]},{name:"complianceChecks",description:"Compliance requirement validation",tests:[{name:"audit logging enabled",fn:async()=>{}},{name:"encryption configured",fn:async()=>{}}]}];constructor(e={}){this.config=e}getSuites(){return this.suites}async runAll(){let e=0,n=0,r=Date.now();for(let o of this.suites)for(let s of o.tests){e++;try{await s.fn(),n++}catch{}}return{passed:n===e,total:e,passed_count:n,failed_count:e-n,duration:Date.now()-r}}async runSuite(e){let n=this.suites.find(s=>s.name===e);if(!n)throw new Error(`Suite not found: ${e}`);let r=0,o=Date.now();for(let s of n.tests)try{await s.fn(),r++}catch{}return{passed:r===n.tests.length,total:n.tests.length,passed_count:r,failed_count:n.tests.length-r,duration:Date.now()-o}}};function Jq(){let t=new F("test").description("Run governance test suites").option("-s, --suite <name>","Run specific test suite").option("-f, --file <path>","Run tests from custom file").option("-p, --path <path>","Project path to test",process.cwd()).option("--json","Output results as JSON").option("-v, --verbose","Verbose output").action(async e=>{let n=x("Initializing test framework...").start();try{let r=new js({projectPath:e.path,verbose:e.verbose});n.text="Running governance tests...";let o;e.suite?(n.text=`Running suite: ${e.suite}`,o=await r.runSuite(e.suite)):o=await r.runAll(),n.stop(),e.json?console.log(JSON.stringify(o,null,2)):console.log(sb(o)),o.passed||process.exit(1)}catch(r){n.fail(l.red("Test execution failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}});return t.addCommand(Yq()),t.addCommand(Kq()),t.addCommand(zq()),t}function Yq(){return new F("list").description("List available test suites").action(()=>{let e=new js().getSuites();console.log(l.blue.bold(`
|
|
1916
|
+
Available Test Suites
|
|
1917
|
+
`)),console.log("\u2500".repeat(50));for(let n of e)console.log(`
|
|
1918
|
+
${l.cyan(n.name)}`),console.log(` ${l.dim(n.description)}`),console.log(` Tests: ${n.tests.length}`);console.log(`
|
|
1919
|
+
`+"\u2500".repeat(50)),console.log(l.dim(`
|
|
1920
|
+
Run specific suite: gal test --suite <name>`))})}function Kq(){return new F("policies").description("Validate governance policies").option("-p, --path <path>","Path to policy files",".claude").action(async t=>{let e=x("Validating policies...").start();try{let r=await new js().runSuite("policyValidation");e.stop(),console.log(sb(r)),r.passed||process.exit(1)}catch(n){e.fail(l.red("Policy validation failed")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function zq(){return new F("security").description("Run security test suite").option("--strict","Fail on any warning").action(async t=>{let e=x("Running security scan...").start();try{let r=await new js().runSuite("securityScanner");e.stop(),console.log(sb(r)),(!r.passed||t.strict&&(r.warnings??0)>0)&&process.exit(1)}catch(n){e.fail(l.red("Security scan failed")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function sb(t){let e=[];e.push(""),e.push("\u2550".repeat(60)),e.push(" GOVERNANCE TEST RESULTS"),e.push("\u2550".repeat(60)),e.push("");let n=t.passed?"\u2705":"\u274C",r=t.passed?l.green("PASSED"):l.red("FAILED");if(e.push(`Status: ${n} ${r}`),e.push(""),e.push("Summary:"),e.push(` Total: ${t.total}`),e.push(` Passed: ${l.green(t.passed_count||0)}`),e.push(` Failed: ${l.red(t.failed_count||0)}`),e.push(` Skipped: ${l.yellow(t.skipped||0)}`),e.push(` Duration: ${t.duration}ms`),t.failures&&t.failures.length>0){e.push(""),e.push(l.red("Failures:"));for(let o of t.failures)e.push(` ${l.red("\u2717")} ${o.name}`),e.push(` ${l.dim(o.error)}`)}return t.warnings&&t.warnings>0&&(e.push(""),e.push(l.yellow(`Warnings: ${t.warnings}`))),e.push(""),e.push("\u2550".repeat(60)),e.join(`
|
|
1921
|
+
`)}var $s=class{config;currentSession=null;constructor(e){this.config=e}async startSession(e){return this.currentSession={id:`session-${Date.now()}`,startTime:Date.now(),issueKey:e.issueKey,description:e.description},this.currentSession}async endSession(e){let n=this.currentSession?Date.now()-this.currentSession.startTime:0,r={duration:Math.floor(n/1e3),loggedToGitHub:e.logToGitHub!==!1&&!!this.currentSession?.issueKey,issueKey:this.currentSession?.issueKey};return this.currentSession=null,r}getStatus(){return this.currentSession?{active:!0,issueKey:this.currentSession.issueKey,startTime:this.currentSession.startTime,elapsed:Math.floor((Date.now()-this.currentSession.startTime)/1e3),activityCount:0}:{active:!1}}async logWork(e){}},ib=class{config;constructor(e){this.config=e}validateTransition(e,n){let r=[],o=[];return n==="In Progress"&&!e.estimate&&r.push({message:"Time estimate required before starting work"}),n==="Done"&&!e.timeSpent&&r.push({message:"Time must be logged before marking as done"}),{allowed:r.length===0,blockers:r,warnings:o}}formatValidation(e){let n=[];if(e.allowed)n.push("\u2705 Transition allowed");else{n.push("\u274C Transition blocked");for(let r of e.blockers)n.push(` \u2022 ${r.message}`)}return n.join(`
|
|
1922
|
+
`)}},ab=class{config;constructor(e){this.config=e}analyzeCompliance(e){let n=e.filter(r=>r.timeSpent>0);return{period:{start:new Date,end:new Date},projectKey:this.config.projectKey,summary:{totalIssues:e.length,compliantIssues:n.length,warningIssues:0,violationIssues:e.length-n.length,overallScore:e.length>0?Math.round(n.length/e.length*100):100},byTeamMember:[],violations:[],warnings:[],recommendations:[]}}formatReport(e){let n=[];return n.push("\u2550".repeat(60)),n.push(" TIME TRACKING COMPLIANCE REPORT"),n.push("\u2550".repeat(60)),n.push(`Overall Score: ${e.summary.overallScore}%`),n.push(`Compliant: ${e.summary.compliantIssues}/${e.summary.totalIssues}`),n.join(`
|
|
1923
|
+
`)}};function Zq(){let t=new F("time").description("Time tracking and workflow management");return t.addCommand(Xq()),t.addCommand(Qq()),t.addCommand(e9()),t.addCommand(t9()),t.addCommand(n9()),t.addCommand(r9()),t}function Xq(){return new F("start").description("Start time tracking session").argument("[issue-key]","GitHub issue number (e.g., GAL-123)").option("-d, --description <text>","Work description").action(async(t,e)=>{let n=x("Starting time tracking session...").start();try{let o=await new $s({githubApiUrl:process.env.GITHUB_API_URL,githubToken:process.env.GITHUB_TOKEN,projectKey:process.env.GITHUB_REPO}).startSession({issueKey:t,description:e.description});n.succeed(l.green("Session started!")),console.log(""),console.log(`Session ID: ${l.cyan(o.id)}`),t&&console.log(`Issue: ${l.cyan(t)}`),console.log(`Started: ${new Date(o.startTime).toLocaleString()}`),console.log(""),console.log(l.dim("Run `gal time stop` to end the session and log time."))}catch(r){n.fail(l.red("Failed to start session")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})}function Qq(){return new F("stop").description("Stop current time tracking session").option("--no-log","Stop without logging to GitHub").option("-c, --comment <text>","Work log comment").action(async t=>{let e=x("Stopping session...").start();try{let r=await new $s({githubApiUrl:process.env.GITHUB_API_URL,githubToken:process.env.GITHUB_TOKEN,projectKey:process.env.GITHUB_REPO}).endSession({logToGitHub:t.log,comment:t.comment});e.succeed(l.green("Session ended!")),console.log(""),console.log(`Duration: ${l.cyan(cb(r.duration))}`),r.loggedToGitHub&&console.log(`Logged to: ${l.cyan(r.issueKey)}`)}catch(n){e.fail(l.red("Failed to stop session")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function e9(){return new F("status").description("Show current session status").action(async()=>{try{let e=new $s({githubApiUrl:process.env.GITHUB_API_URL,githubToken:process.env.GITHUB_TOKEN,projectKey:process.env.GITHUB_REPO}).getStatus();if(!e.active){console.log(l.yellow(`
|
|
1924
|
+
No active session.`)),console.log(l.dim("Run `gal time start [issue-key]` to begin tracking."));return}console.log(l.blue.bold(`
|
|
1925
|
+
Active Session`)),console.log("\u2500".repeat(40)),console.log(`Issue: ${l.cyan(e.issueKey||"No issue")}`),console.log(`Started: ${new Date(e.startTime??Date.now()).toLocaleString()}`),console.log(`Duration: ${l.cyan(cb(e.elapsed??0))}`),console.log(`Activities: ${e.activityCount??0}`)}catch(t){console.error(l.red(t instanceof Error?t.message:String(t))),process.exit(1)}})}function t9(){return new F("validate").description("Validate workflow transition").argument("<issue-key>","GitHub issue number").argument("<to-status>","Target status").option("--strict","Treat warnings as errors").action(async(t,e,n)=>{let r=x(`Validating transition to ${e}...`).start();try{let o=new ib({projectKey:process.env.GITHUB_REPO}),s={key:t,summary:"Issue summary",status:"To Do",assignee:void 0,estimate:0,timeSpent:0,fields:{}},i=o.validateTransition(s,e);r.stop(),console.log(o.formatValidation(i)),(!i.allowed||n.strict&&i.warnings.length>0)&&process.exit(1)}catch(o){r.fail(l.red("Validation failed")),console.error(l.red(o instanceof Error?o.message:String(o))),process.exit(1)}})}function n9(){return new F("report").description("Generate time tracking compliance report").option("-p, --project <key>","Project key").option("--period <period>","Reporting period: daily, weekly, monthly","weekly").option("--json","Output as JSON").action(async t=>{let e=x("Generating compliance report...").start();try{let n=new ab({projectKey:t.project||process.env.GITHUB_REPO,reportingPeriod:t.period}),r=[{key:"GAL-1",summary:"Example issue",status:"In Progress",issueType:"Story",assignee:"developer",estimate:14400,timeSpent:7200}],o=n.analyzeCompliance(r);e.stop(),t.json?console.log(JSON.stringify(o,null,2)):console.log(n.formatReport(o))}catch(n){e.fail(l.red("Report generation failed")),console.error(l.red(n instanceof Error?n.message:String(n))),process.exit(1)}})}function r9(){return new F("log").description("Log time manually").argument("<issue-key>","GitHub issue number").argument("<duration>","Duration (e.g., 1h30m, 2h, 90m)").option("-c, --comment <text>","Work log comment").option("-d, --date <date>","Date for the work log (YYYY-MM-DD)").action(async(t,e,n)=>{let r=x(`Logging ${e} to ${t}...`).start();try{let o=new $s({githubApiUrl:process.env.GITHUB_API_URL,githubToken:process.env.GITHUB_TOKEN,projectKey:process.env.GITHUB_REPO}),s=o9(e);await o.logWork({issueKey:t,timeSpentSeconds:s,comment:n.comment,started:n.date?new Date(n.date):new Date}),r.succeed(l.green(`Logged ${cb(s)} to ${t}`))}catch(o){r.fail(l.red("Failed to log time")),console.error(l.red(o instanceof Error?o.message:String(o))),process.exit(1)}})}function cb(t){let e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function o9(t){let e=0,n=t.match(/(\d+\.?\d*)h/);n&&(e+=parseFloat(n[1])*3600);let r=t.match(/(\d+)m/);if(r&&(e+=parseInt(r[1])*60),e===0){let o=parseInt(t);isNaN(o)||(e=o*60)}return e}var nF=require("events"),rF=require("crypto");var s9={enabled:!0,rules:[],defaultAction:"audit",logging:{enabled:!0,level:"info",destination:"console"},retry:{enabled:!0,maxAttempts:3,backoffMs:1e3}},ub=class{handlers=new Map;rules=[];config;emitter;eventLog=[];constructor(e={}){this.config={...s9,...e},this.emitter=new nF.EventEmitter,this.setupEventListeners()}registerHandler(e,n){this.handlers.has(e)&&console.warn(l.yellow(`Handler '${e}' already registered, overwriting`)),this.handlers.set(e,n),this.log("debug",`Registered handler: ${e}`)}unregisterHandler(e){let n=this.handlers.delete(e);return n&&this.log("debug",`Unregistered handler: ${e}`),n}addRule(e){if(!this.handlers.has(e.handler))throw new Error(`Handler '${e.handler}' not found for rule '${e.name}'`);let n=this.rules.findIndex(r=>r.priority<e.priority);n===-1?this.rules.push(e):this.rules.splice(n,0,e),this.log("info",`Added rule: ${e.name} (priority: ${e.priority})`)}removeRule(e){let n=this.rules.findIndex(r=>r.id===e);return n!==-1?(this.rules.splice(n,1),this.log("info",`Removed rule: ${e}`),!0):!1}async emit(e,n,r,o={}){if(!this.config.enabled)return[];let s={id:(0,rF.randomUUID)(),type:e,source:n,timestamp:new Date,severity:o.severity||"normal",payload:r,metadata:o.metadata||{}};this.eventLog.push(s),this.log("info",`Event received: ${e}/${n} [${s.id}]`);let i=this.findMatchingRules(s);if(i.length===0)return this.log("debug",`No matching rules for event ${s.id}`),[{success:!0,action:this.config.defaultAction,message:"No matching rules, using default action",duration:0}];let a=[];for(let c of i){if(!c.enabled)continue;let u=this.handlers.get(c.handler);if(!u){this.log("warn",`Handler '${c.handler}' not found for rule '${c.name}'`);continue}let d=await this.executeHandler(u,s,c);if(a.push(d),this.emitter.emit("result",{event:s,rule:c,result:d}),d.action==="block"){this.log("warn",`Event ${s.id} blocked by rule '${c.name}'`);break}}return a}async executeHandler(e,n,r){let o=Date.now(),s=null,i=this.config.retry.enabled?this.config.retry.maxAttempts:1;for(let a=1;a<=i;a++)try{return{...await e(n),duration:Date.now()-o}}catch(c){if(s=c instanceof Error?c:new Error(String(c)),this.log("warn",`Handler '${r.handler}' attempt ${a} failed: ${s.message}`),a<i&&this.config.retry.enabled){let u=this.config.retry.backoffMs*Math.pow(2,a-1);await this.delay(u)}}return{success:!1,action:"audit",message:`Handler failed after ${i} attempts: ${s?.message}`,duration:Date.now()-o}}findMatchingRules(e){return this.rules.filter(n=>n.eventTypes.includes(e.type)?n.conditions&&n.conditions.length>0?n.conditions.every(r=>this.evaluateCondition(e,r)):!0:!1)}evaluateCondition(e,n){let r=this.getNestedValue(e,n.field);switch(n.operator){case"equals":return r===n.value;case"contains":return typeof r=="string"?r.includes(String(n.value)):Array.isArray(r)?r.includes(n.value):!1;case"matches":return typeof r=="string"?new RegExp(String(n.value)).test(r):!1;case"gt":return typeof r=="number"&&r>Number(n.value);case"lt":return typeof r=="number"&&r<Number(n.value);case"in":return Array.isArray(n.value)?n.value.includes(r):!1;case"not_in":return Array.isArray(n.value)?!n.value.includes(r):!0;default:return!1}}getNestedValue(e,n){return n.split(".").reduce((r,o)=>{if(r&&typeof r=="object")return r[o]},e)}on(e,n){this.emitter.on(e,n)}getEventLog(e){return e?this.eventLog.slice(-e):[...this.eventLog]}clearEventLog(){this.eventLog=[]}getHandlers(){return Array.from(this.handlers.keys())}getRules(){return[...this.rules]}updateConfig(e){this.config={...this.config,...e}}log(e,n){if(!this.config.logging.enabled)return;let r=["debug","info","warn","error"],o=r.indexOf(this.config.logging.level);if(r.indexOf(e)<o)return;let a=`[GAL-Trigger ${new Date().toISOString()}]`;switch(e){case"debug":console.log(l.gray(`${a} ${n}`));break;case"info":console.log(l.blue(`${a} ${n}`));break;case"warn":console.log(l.yellow(`${a} ${n}`));break;case"error":console.log(l.red(`${a} ${n}`));break}}delay(e){return new Promise(n=>setTimeout(n,e))}},lb=null;function dn(){return lb||(lb=new ub),lb}var Po=require("child_process"),ze=require("fs"),In=require("path");var i9={enabled:!0,hooks:["pre-commit","pre-push"],validateConfigs:!0,blockOnFailure:!0,scanStagedOnly:!0},fb=class{config;registry;gitDir=null;constructor(e={},n){this.config={...i9,...e},this.registry=n||dn(),this.registerHandlers()}registerHandlers(){this.registry.registerHandler("git-validate-configs",this.handleValidateConfigs.bind(this)),this.registry.registerHandler("git-security-scan",this.handleSecurityScan.bind(this)),this.registry.registerHandler("git-audit-log",this.handleAuditLog.bind(this))}findGitDir(e=process.cwd()){if(this.gitDir)return this.gitDir;let n=e;for(;n!=="/";){let r=(0,In.join)(n,".git");if((0,ze.existsSync)(r))return this.gitDir=r,r;n=(0,In.dirname)(n)}return null}installHooks(e=process.cwd()){let n=this.findGitDir(e);if(!n)throw new Error("Not a git repository");let r=(0,In.join)(n,"hooks");(0,ze.existsSync)(r)||(0,ze.mkdirSync)(r,{recursive:!0});let o=[],s=[];for(let i of this.config.hooks){let a=(0,In.join)(r,i),c=this.generateHookScript(i);(0,ze.existsSync)(a)?(0,ze.readFileSync)(a,"utf-8").includes("GAL_HOOK_MARKER")?((0,ze.writeFileSync)(a,c),(0,ze.chmodSync)(a,"755"),o.push(i)):(console.log(l.yellow(`Skipping ${i}: existing hook found`)),s.push(i)):((0,ze.writeFileSync)(a,c),(0,ze.chmodSync)(a,"755"),o.push(i))}return{installed:o,skipped:s}}uninstallHooks(e=process.cwd()){let n=this.findGitDir(e);if(!n)throw new Error("Not a git repository");let r=(0,In.join)(n,"hooks"),o=[];for(let s of this.config.hooks){let i=(0,In.join)(r,s);if((0,ze.existsSync)(i)&&(0,ze.readFileSync)(i,"utf-8").includes("GAL_HOOK_MARKER")){let{unlinkSync:c}=require("fs");c(i),o.push(s)}}return o}generateHookScript(e){return`#!/bin/bash
|
|
1926
|
+
# GAL_HOOK_MARKER - Generated by GAL Governance Agentic Layer
|
|
1927
|
+
# Do not edit this file manually
|
|
1928
|
+
|
|
1929
|
+
# Execute GAL hook handler
|
|
1930
|
+
gal trigger git ${e} "$@"
|
|
1931
|
+
exit_code=$?
|
|
1932
|
+
|
|
1933
|
+
# Block on failure if configured
|
|
1934
|
+
if [ $exit_code -ne 0 ]; then
|
|
1935
|
+
echo "GAL governance check failed for ${e}"
|
|
1936
|
+
exit $exit_code
|
|
1937
|
+
fi
|
|
1938
|
+
|
|
1939
|
+
exit 0
|
|
1940
|
+
`}async executeHook(e,n=[]){if(!this.config.enabled)return[{success:!0,action:"allow",message:"Git hooks disabled",duration:0}];let r=await this.buildGitPayload(e);return this.registry.emit("git",e,r,{severity:this.getSeverity(e),metadata:{projectPath:process.cwd(),agentType:"git"}})}async buildGitPayload(e){let n={hookType:e};try{if(n.branch=(0,Po.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8"}).trim(),e==="pre-commit"&&this.config.scanStagedOnly){let r=(0,Po.execSync)("git diff --cached --name-only",{encoding:"utf-8"});n.files=r.split(`
|
|
1941
|
+
`).filter(o=>o.trim())}(e==="post-commit"||e==="commit-msg")&&(n.commit=(0,Po.execSync)("git rev-parse HEAD",{encoding:"utf-8"}).trim(),n.message=(0,Po.execSync)("git log -1 --pretty=%B",{encoding:"utf-8"}).trim(),n.author=(0,Po.execSync)("git log -1 --pretty=%an",{encoding:"utf-8"}).trim())}catch{}return n}getSeverity(e){switch(e){case"pre-commit":case"pre-push":return"high";case"commit-msg":case"prepare-commit-msg":return"normal";default:return"low"}}async handleValidateConfigs(e){let n=Date.now(),r=e.payload,o=[".claude/",".cursor/",".gemini/",".codex/",".windsurf/"],s=(r.files||[]).filter(i=>o.some(a=>i.includes(a)));return s.length===0?{success:!0,action:"allow",message:"No agent config files changed",duration:Date.now()-n}:(console.log(l.blue(`Validating ${s.length} agent config files...`)),{success:!0,action:"audit",message:`Validated ${s.length} config files`,data:{files:s},duration:Date.now()-n})}async handleSecurityScan(e){let n=Date.now(),o=e.payload.files||[],s=[{pattern:/(?:api[_-]?key|secret|password|token)\s*[:=]\s*['"][^'"]+['"]/gi,severity:"high"},{pattern:/(?:aws_access_key|aws_secret|github_token)/gi,severity:"critical"},{pattern:/rm\s+-rf\s+\//g,severity:"critical"}],i=[];for(let a of o)try{let c=(0,Po.execSync)(`git show :${a}`,{encoding:"utf-8"});for(let{pattern:u,severity:d}of s)u.test(c)&&i.push({file:a,pattern:u.source,severity:d})}catch{}if(i.length>0){let a=i.filter(c=>c.severity==="critical");return a.length>0&&this.config.blockOnFailure?{success:!1,action:"block",message:`Security scan found ${a.length} critical issues`,data:{findings:i},duration:Date.now()-n}:{success:!0,action:"warn",message:`Security scan found ${i.length} issues`,data:{findings:i},duration:Date.now()-n}}return{success:!0,action:"allow",message:"Security scan passed",duration:Date.now()-n}}async handleAuditLog(e){let n=Date.now(),r=e.payload,o={timestamp:e.timestamp,type:"git",action:r.hookType,branch:r.branch,commit:r.commit,files:r.files?.length||0,author:r.author};return console.log(l.gray(`[AUDIT] ${JSON.stringify(o)}`)),{success:!0,action:"audit",message:"Audit log recorded",data:o,duration:Date.now()-n}}isInstalled(e=process.cwd()){let n=this.findGitDir(e);if(!n)return{installed:[],missing:this.config.hooks};let r=(0,In.join)(n,"hooks"),o=[],s=[];for(let i of this.config.hooks){let a=(0,In.join)(r,i);(0,ze.existsSync)(a)&&(0,ze.readFileSync)(a,"utf-8").includes("GAL_HOOK_MARKER")?o.push(i):s.push(i)}return{installed:o,missing:s}}},db=null;function Wa(){return db||(db=new fb),db}var er=require("fs"),Ro=require("path");var a9={enabled:!0,watchPaths:[".claude",".cursor",".gemini",".codex",".windsurf",".gal"],ignorePatterns:["*.swp","*.tmp","*~",".DS_Store","node_modules"],debounceMs:100,recursive:!0},c9={claude:[".claude/commands",".claude/hooks",".claude/settings.json"],cursor:[".cursor/rules",".cursor/settings.json"],gemini:[".gemini/commands",".gemini/settings.json"],codex:[".codex/agents",".codex/settings.json"],windsurf:[".windsurf/rules",".windsurf/settings.json"]},pb=class{config;registry;watchers=new Map;debounceTimers=new Map;isRunning=!1;constructor(e={},n){this.config={...a9,...e},this.registry=n||dn(),this.registerHandlers()}registerHandlers(){this.registry.registerHandler("fs-config-changed",this.handleConfigChange.bind(this)),this.registry.registerHandler("fs-validate-config",this.handleValidateConfig.bind(this)),this.registry.registerHandler("fs-sync-governance",this.handleSyncGovernance.bind(this))}start(e=process.cwd()){if(this.isRunning)return console.log(l.yellow("File watcher already running")),{watching:[],notFound:[]};let n=[],r=[];for(let o of this.config.watchPaths){let s=(0,Ro.join)(e,o);if(!(0,er.existsSync)(s)){r.push(o);continue}try{let i=(0,er.watch)(s,{recursive:this.config.recursive},(a,c)=>{c&&!this.shouldIgnore(c)&&this.handleFileEvent(a,s,c)});i.on("error",a=>{console.error(l.red(`Watcher error for ${o}:`),a)}),this.watchers.set(o,i),n.push(o)}catch(i){console.error(l.red(`Failed to watch ${o}:`),i),r.push(o)}}return this.isRunning=!0,console.log(l.green(`File watcher started, monitoring ${n.length} paths`)),{watching:n,notFound:r}}stop(){for(let[e,n]of this.watchers)n.close(),console.log(l.gray(`Stopped watching: ${e}`));this.watchers.clear();for(let e of this.debounceTimers.values())clearTimeout(e);this.debounceTimers.clear(),this.isRunning=!1,console.log(l.green("File watcher stopped"))}shouldIgnore(e){let n=(0,Ro.basename)(e);for(let r of this.config.ignorePatterns)if(r.startsWith("*")){if(n.endsWith(r.slice(1)))return!0}else if(r.endsWith("*")){if(n.startsWith(r.slice(0,-1)))return!0}else if(n===r)return!0;return!1}handleFileEvent(e,n,r){let o=(0,Ro.join)(n,r),s=`${e}:${o}`,i=this.debounceTimers.get(s);i&&clearTimeout(i);let a=setTimeout(()=>{this.debounceTimers.delete(s),this.processFileEvent(e,n,r)},this.config.debounceMs);this.debounceTimers.set(s,a)}async processFileEvent(e,n,r){let o=(0,Ro.join)(n,r),s,i=!1,a;try{if((0,er.existsSync)(o)){let d=(0,er.statSync)(o);i=d.isDirectory(),a=d.size,s=e==="rename"?"create":"modify"}else s="delete"}catch{s="delete"}let c={eventType:s,path:o,isDirectory:i,size:a},u=this.getEventSeverity(o,s);await this.registry.emit("filesystem",n,c,{severity:u,metadata:{projectPath:process.cwd(),agentType:this.detectAgentType(o)}})}getEventSeverity(e,n){return e.includes("settings.json")?"high":e.includes("/hooks/")?n==="delete"?"normal":"high":e.includes("/commands/")?"normal":e.includes("/rules/")?"low":"normal"}detectAgentType(e){for(let[n,r]of Object.entries(c9))if(r.some(o=>e.includes(o.split("/")[0])))return n}async handleConfigChange(e){let n=Date.now(),r=e.payload;return console.log(l.blue(`Config ${r.eventType}: ${r.path}`)),{success:!0,action:"audit",message:`Config change detected: ${r.eventType}`,data:{path:r.path,eventType:r.eventType},duration:Date.now()-n}}async handleValidateConfig(e){let n=Date.now(),r=e.payload;return r.eventType==="delete"?{success:!0,action:"audit",message:"Config deleted, no validation needed",duration:Date.now()-n}:(console.log(l.blue(`Validating config: ${r.path}`)),{success:!0,action:"audit",message:"Config validation placeholder",data:{path:r.path},duration:Date.now()-n})}async handleSyncGovernance(e){let n=Date.now(),r=e.payload;return console.log(l.blue(`Would sync to governance: ${r.path}`)),{success:!0,action:"audit",message:"Governance sync placeholder",data:{path:r.path},duration:Date.now()-n}}getStatus(){return{running:this.isRunning,watchedPaths:Array.from(this.watchers.keys())}}addWatchPath(e,n=process.cwd()){if(!this.isRunning)return this.config.watchPaths.push(e),!0;let r=(0,Ro.join)(n,e);if(!(0,er.existsSync)(r))return!1;try{let o=(0,er.watch)(r,{recursive:this.config.recursive},(s,i)=>{i&&!this.shouldIgnore(i)&&this.handleFileEvent(s,r,i)});return this.watchers.set(e,o),this.config.watchPaths.push(e),!0}catch{return!1}}removeWatchPath(e){let n=this.watchers.get(e);if(n){n.close(),this.watchers.delete(e);let r=this.config.watchPaths.indexOf(e);return r!==-1&&this.config.watchPaths.splice(r,1),!0}return!1}},mb=null;function gb(){return mb||(mb=new pb),mb}function l9(){let t=new F("trigger");t.description("Manage governance triggers and event handlers"),t.command("git <hook-type>").description("Execute a git hook trigger (pre-commit, post-commit, pre-push, etc.)").option("--dry-run","Show what would be triggered without executing").option("--json","Output results as JSON").action(async(n,r)=>{let o=Wa();if(r.dryRun){console.log(l.blue(`Would execute git hook: ${n}`));let i=dn().getRules().filter(a=>a.eventTypes.includes("git"));console.log(l.gray(`Matching rules: ${i.map(a=>a.name).join(", ")||"none"}`));return}try{let s=await o.executeHook(n);if(r.json){console.log(JSON.stringify({hookType:n,results:s},null,2));return}let i=s.find(c=>c.action==="block");i&&(console.error(l.red(`Blocked: ${i.message}`)),process.exit(1));let a=s.filter(c=>c.action==="warn");if(a.length>0)for(let c of a)console.log(l.yellow(`Warning: ${c.message}`));console.log(l.green(`Git hook ${n} completed successfully`))}catch(s){console.error(l.red("Git hook failed:"),s),process.exit(1)}}),t.command("install").description("Install GAL git hooks in the current repository").option("-p, --path <path>","Project path",process.cwd()).option("--force","Overwrite existing hooks").action(async n=>{let r=Wa();try{let o=r.installHooks(n.path);if(o.installed.length>0){console.log(l.green("Installed hooks:"));for(let s of o.installed)console.log(l.green(` \u2713 ${s}`))}if(o.skipped.length>0){console.log(l.yellow("Skipped (existing hooks):"));for(let s of o.skipped)console.log(l.yellow(` \u26A0 ${s}`));n.force||console.log(l.gray("Use --force to overwrite existing hooks"))}}catch(o){console.error(l.red("Failed to install hooks:"),o),process.exit(1)}}),t.command("uninstall").description("Remove GAL git hooks from the current repository").option("-p, --path <path>","Project path",process.cwd()).action(async n=>{let r=Wa();try{let o=r.uninstallHooks(n.path);if(o.length>0){console.log(l.green("Removed hooks:"));for(let s of o)console.log(l.green(` \u2713 ${s}`))}else console.log(l.yellow("No GAL hooks found to remove"))}catch(o){console.error(l.red("Failed to uninstall hooks:"),o),process.exit(1)}}),t.command("watch").description("Start watching for file system changes").option("-p, --path <path>","Project path",process.cwd()).option("--paths <paths...>","Additional paths to watch").action(async n=>{let r=gb();if(n.paths)for(let s of n.paths)r.addWatchPath(s,n.path);let o=r.start(n.path);if(o.watching.length>0){console.log(l.green("Watching paths:"));for(let s of o.watching)console.log(l.green(` \u2713 ${s}`))}if(o.notFound.length>0){console.log(l.yellow("Not found (skipped):"));for(let s of o.notFound)console.log(l.yellow(` \u26A0 ${s}`))}console.log(l.blue(`
|
|
1942
|
+
Watching for changes... Press Ctrl+C to stop`)),process.on("SIGINT",()=>{r.stop(),process.exit(0)})}),t.command("status").description("Show trigger system status").option("--json","Output as JSON").action(async n=>{let r=dn(),o=Wa(),s=gb(),i=o.isInstalled(),a=s.getStatus(),c={registry:{handlers:r.getHandlers(),rules:r.getRules().map(u=>({name:u.name,enabled:u.enabled,eventTypes:u.eventTypes})),eventCount:r.getEventLog().length},gitHooks:{installed:i.installed,missing:i.missing},fileWatcher:a};if(n.json){console.log(JSON.stringify(c,null,2));return}console.log(l.bold(`
|
|
1943
|
+
Trigger System Status
|
|
1944
|
+
`)),console.log(l.blue("Registry:")),console.log(` Handlers: ${c.registry.handlers.join(", ")||"none"}`),console.log(` Rules: ${c.registry.rules.length}`),console.log(` Events logged: ${c.registry.eventCount}`),console.log(l.blue(`
|
|
1945
|
+
Git Hooks:`)),i.installed.length>0&&console.log(l.green(` Installed: ${i.installed.join(", ")}`)),i.missing.length>0&&console.log(l.yellow(` Missing: ${i.missing.join(", ")}`)),console.log(l.blue(`
|
|
1946
|
+
File Watcher:`)),console.log(` Running: ${a.running?l.green("yes"):l.gray("no")}`),a.watchedPaths.length>0&&console.log(` Watching: ${a.watchedPaths.join(", ")}`)});let e=t.command("rules").description("Manage trigger rules");return e.command("list").description("List all registered trigger rules").option("--json","Output as JSON").action(async n=>{let o=dn().getRules();if(n.json){console.log(JSON.stringify({rules:o},null,2));return}if(o.length===0){console.log(l.yellow("No rules registered"));return}console.log(l.bold(`
|
|
1947
|
+
Trigger Rules:
|
|
1948
|
+
`));for(let s of o){let i=s.enabled?l.green("\u2713"):l.gray("\u25CB");console.log(`${i} ${l.bold(s.name)} (priority: ${s.priority})`),s.description&&console.log(l.gray(` ${s.description}`)),console.log(l.gray(` Events: ${s.eventTypes.join(", ")}`)),console.log(l.gray(` Handler: ${s.handler}`)),console.log()}}),e.command("add <name>").description("Add a new trigger rule").requiredOption("-e, --events <types...>","Event types (git, filesystem, process, webhook)").requiredOption("-h, --handler <name>","Handler name").option("-d, --description <text>","Rule description").option("-p, --priority <number>","Rule priority","50").option("--disabled","Create rule in disabled state").action(async(n,r)=>{let o=dn(),s={id:`rule-${Date.now()}`,name:n,description:r.description,enabled:!r.disabled,eventTypes:r.events,handler:r.handler,action:"audit",priority:parseInt(r.priority,10)};try{o.addRule(s),console.log(l.green(`Added rule: ${n}`))}catch(i){console.error(l.red("Failed to add rule:"),i),process.exit(1)}}),t.command("events").description("View trigger event log").option("-n, --limit <number>","Number of events to show","10").option("--json","Output as JSON").option("--clear","Clear event log").action(async n=>{let r=dn();if(n.clear){r.clearEventLog(),console.log(l.green("Event log cleared"));return}let o=r.getEventLog(parseInt(n.limit,10));if(n.json){console.log(JSON.stringify({events:o},null,2));return}if(o.length===0){console.log(l.yellow("No events logged"));return}console.log(l.bold(`
|
|
1949
|
+
Recent Events (${o.length}):
|
|
1950
|
+
`));for(let s of o.reverse()){let i=s.timestamp.toLocaleTimeString(),a={critical:l.red,high:l.yellow,normal:l.blue,low:l.gray}[s.severity];console.log(`${l.gray(i)} ${a(s.severity.toUpperCase())} ${s.type}/${s.source}`),console.log(l.gray(` ID: ${s.id}`)),console.log()}}),t.command("emit <type> <source>").description("Manually emit a trigger event (for testing)").option("-p, --payload <json>","Event payload as JSON","{}").option("-s, --severity <level>","Event severity","normal").option("--json","Output results as JSON").action(async(n,r,o)=>{let s=dn(),i;try{i=JSON.parse(o.payload)}catch{console.error(l.red("Invalid JSON payload")),process.exit(1)}let a=await s.emit(n,r,i,{severity:o.severity});if(o.json){console.log(JSON.stringify({results:a},null,2));return}console.log(l.green(`Emitted ${n}/${r}`)),console.log(`Results: ${a.length}`);for(let c of a){let u=c.success?l.green("\u2713"):l.red("\u2717");console.log(` ${u} ${c.action}: ${c.message||"no message"}`)}}),t}var oe=require("fs"),Ee=require("path"),hb=require("os"),sF=require("readline");async function u9(t){let e=(0,sF.createInterface)({input:process.stdin,output:process.stdout});return new Promise(n=>{e.question(`${t} (y/N): `,r=>{e.close(),n(r.toLowerCase()==="y"||r.toLowerCase()==="yes")})})}function yb(t){if(!(0,oe.existsSync)(t))return!1;try{let e=(0,oe.readFileSync)(t,"utf-8");return["GAL Config","GAL CLI","GAL Governance","Generated by GAL","gal sync","gal check","Governance Agentic Layer","CISO-approved","gal-sync-reminder","gal-config-hook","gal-safety-hook"].some(r=>e.includes(r))}catch{return!1}}function d9(t){if(!(0,oe.existsSync)(t))return!1;try{let e=(0,oe.readFileSync)(t,"utf-8");return e.includes("CURRENT_VERSION =")||e.includes("const CURRENT_VERSION")}catch{return!1}}function oF(t){return d9(t)?"npm":yb(t)?"org-sync":"unknown"}function f9(t){let e=[],n=(0,Ee.join)((0,hb.homedir)(),".claude"),r=(0,Ee.join)(n,"hooks"),o=(0,Ee.join)(n,"status_lines"),s=t?.includeNpmInstalled??!0;if((0,oe.existsSync)(r)){let d=(0,oe.readdirSync)(r);for(let m of d)if(m.startsWith("gal-")){let p=(0,Ee.join)(r,m),f=oF(p);if(!s&&f==="npm")continue;e.push({path:p,type:"file",reason:`GAL hook file (${f==="npm"?"npm-installed":f==="org-sync"?"org-synced":"unknown source"})`,isGalOwned:!0,source:f})}}if((0,oe.existsSync)(o)){let d=(0,oe.readdirSync)(o);for(let m of d)if(m.startsWith("gal-")){let p=(0,Ee.join)(o,m),f=oF(p);if(!s&&f==="npm")continue;e.push({path:p,type:"file",reason:`GAL status line script (${f==="npm"?"npm-installed":f==="org-sync"?"org-synced":"unknown source"})`,isGalOwned:!0,source:f})}}let i=(0,Ee.join)(n,"settings.json");if((0,oe.existsSync)(i))try{let d=JSON.parse((0,oe.readFileSync)(i,"utf-8"));d.hooks?.SessionStart&&d.hooks.SessionStart.some(p=>p.hooks?.some(f=>f.command?.includes("gal-")||f.command?.includes("/gal/")))&&e.push({path:i,type:"hook-entry",reason:"GAL hook entries in SessionStart",isGalOwned:!1}),d.hooks?.UserPromptSubmit&&d.hooks.UserPromptSubmit.some(p=>p.hooks?.some(f=>f.command?.includes("gal-")||f.command?.includes("/gal/")))&&e.push({path:i,type:"hook-entry",reason:"GAL hook entries in UserPromptSubmit",isGalOwned:!1,source:"unknown"}),d.statusLine?.command?.includes("gal-")&&e.push({path:i,type:"statusline-entry",reason:"GAL status line entry in settings",isGalOwned:!1})}catch{}let a=(0,Ee.join)((0,hb.homedir)(),".cursor"),c=(0,Ee.join)(a,"hooks");if((0,oe.existsSync)(c)){let d=(0,oe.readdirSync)(c);for(let m of d)m.startsWith("gal-")&&e.push({path:(0,Ee.join)(c,m),type:"file",reason:"GAL hook file for Cursor IDE",isGalOwned:!0})}let u=(0,Ee.join)(a,"hooks.json");if((0,oe.existsSync)(u))try{let d=JSON.parse((0,oe.readFileSync)(u,"utf-8")),m=["beforeShellExecution","beforeSubmitPrompt"];for(let p of m)if(d.hooks?.[p]&&d.hooks[p].some(g=>g.command?.includes("gal-")||g.command?.includes("/gal/"))){e.push({path:u,type:"hook-entry",reason:`GAL hook entries in Cursor hooks.json (${p})`,isGalOwned:!1});break}}catch{}return e}function m9(t){let e=[],n=(0,Ee.join)(t,".gal");(0,oe.existsSync)(n)&&e.push({path:n,type:"directory",reason:"GAL state directory",isGalOwned:!0});let r=(0,Ee.join)(t,"gal.config.json");(0,oe.existsSync)(r)&&e.push({path:r,type:"file",reason:"GAL configuration file",isGalOwned:!0});let o=[(0,Ee.join)(t,".git","hooks","pre-commit"),(0,Ee.join)(t,".husky","pre-commit")];for(let i of o)(0,oe.existsSync)(i)&&yb(i)&&e.push({path:i,type:"file",reason:"GAL-generated git hook",isGalOwned:!0});let s=[{path:(0,Ee.join)(t,"CLAUDE.md"),reason:"GAL-generated CLAUDE.md"},{path:(0,Ee.join)(t,".claude","settings.json"),reason:"GAL-generated settings"},{path:(0,Ee.join)(t,".claude","commands","review.md"),reason:"GAL-generated command"},{path:(0,Ee.join)(t,".claude","commands","check.md"),reason:"GAL-generated command"},{path:(0,Ee.join)(t,".github","workflows","ci.yml"),reason:"GAL-generated workflow"},{path:(0,Ee.join)(t,".github","workflows","pr-governance.yml"),reason:"GAL-generated workflow"},{path:(0,Ee.join)(t,".gitleaks.toml"),reason:"GAL-generated security config"},{path:(0,Ee.join)(t,"SECURITY.md"),reason:"GAL-generated security docs"},{path:(0,Ee.join)(t,".env.example"),reason:"GAL-generated env template"}];for(let{path:i,reason:a}of s)(0,oe.existsSync)(i)&&yb(i)&&e.push({path:i,type:"file",reason:a,isGalOwned:!0});return e}function p9(t){try{let e=JSON.parse((0,oe.readFileSync)(t,"utf-8"));return e.statusLine?.command?.includes("gal-")?(delete e.statusLine,(0,oe.writeFileSync)(t,JSON.stringify(e,null,2)),!0):!1}catch{return!1}}function g9(t){try{let e=JSON.parse((0,oe.readFileSync)(t,"utf-8")),n=!1;for(let r of["SessionStart","UserPromptSubmit"]){if(!e.hooks?.[r])continue;let o=e.hooks[r].length;e.hooks[r]=e.hooks[r].filter(s=>s.hooks?(s.hooks=s.hooks.filter(i=>!i.command?.includes("gal-")&&!i.command?.includes("/gal/")),s.hooks.length>0):!0),e.hooks[r].length===0&&delete e.hooks[r],e.hooks[r]?.length!==o&&(n=!0)}return Object.keys(e.hooks||{}).length===0&&delete e.hooks,n?((0,oe.writeFileSync)(t,JSON.stringify(e,null,2)),!0):!1}catch{return!1}}function h9(t){try{let e=JSON.parse((0,oe.readFileSync)(t,"utf-8"));if(!e.hooks)return!1;let n=!1,r=["beforeShellExecution","beforeSubmitPrompt"];for(let o of r)if(e.hooks[o]){let s=e.hooks[o].length;e.hooks[o]=e.hooks[o].filter(i=>!i.command?.includes("gal-")&&!i.command?.includes("/gal/")),e.hooks[o].length===0&&delete e.hooks[o],e.hooks[o]?.length!==s&&(n=!0)}return Object.keys(e.hooks).length===0&&delete e.hooks,n?((0,oe.writeFileSync)(t,JSON.stringify(e,null,2)),!0):!1}catch{return!1}}function y9(t,e){let n={removed:[],skipped:[],errors:[]};for(let r of t){if(e){n.removed.push(r.path);continue}try{r.type==="hook-entry"?(r.path.includes(".cursor")&&r.path.endsWith("hooks.json")?h9(r.path):g9(r.path))?n.removed.push(`${r.path} (GAL hooks removed)`):n.skipped.push(`${r.path} (no GAL hooks found)`):r.type==="statusline-entry"?p9(r.path)?n.removed.push(`${r.path} (GAL statusLine removed)`):n.skipped.push(`${r.path} (no GAL statusLine found)`):r.type==="directory"?((0,oe.rmSync)(r.path,{recursive:!0,force:!0}),n.removed.push(r.path)):((0,oe.unlinkSync)(r.path),n.removed.push(r.path))}catch(o){n.errors.push(`${r.path}: ${o instanceof Error?o.message:String(o)}`)}}return n}function b9(){let t=new F("uninstall");return t.description("Remove GAL-installed files and configurations").option("-d, --directory <path>","Project directory",process.cwd()).option("--user-only","Only remove org-synced configs from ~/.claude/ (preserves npm-installed CLI hooks)").option("--project-only","Only remove project-level configs").option("--dry-run","Show what would be removed without actually removing").option("-y, --yes","Skip confirmation prompt").action(async e=>{console.log(l.blue(`
|
|
1951
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL Uninstall")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1952
|
+
`));let n=e.projectOnly?[]:f9({includeNpmInstalled:!e.userOnly}),r=e.userOnly?[]:m9(e.directory),o=[...n,...r];if(o.length===0){console.log(l.yellow("No GAL-installed files found.")),e.userOnly&&(console.log(l.dim(`
|
|
1953
|
+
Note: --user-only preserves npm-installed CLI hooks (e.g., gal-sync-reminder.js)`)),console.log(l.dim("To remove CLI hooks, uninstall the npm package: npm uninstall -g @scheduler-systems/gal-cli"))),console.log(l.dim(`
|
|
1954
|
+
Nothing to uninstall.`));return}if(console.log(l.bold(`The following GAL-installed items were detected:
|
|
1955
|
+
`)),e.userOnly&&(console.log(l.cyan("Mode: User-level org-synced configs only")),console.log(l.dim(` (npm-installed CLI hooks will be preserved)
|
|
1956
|
+
`))),n.length>0){console.log(l.cyan("User-level (Claude Code & Cursor IDE):"));for(let i of n){let a=i.type==="directory"?"\u{1F4C1}":i.type==="hook-entry"?"\u{1F527}":i.type==="statusline-entry"?"\u{1F4CA}":"\u{1F4C4}";console.log(` ${a} ${l.dim(i.path)}`),console.log(` ${l.dim(i.reason)}`)}console.log()}if(r.length>0){console.log(l.cyan("Project-level:"));for(let i of r){let a=i.type==="directory"?"\u{1F4C1}":"\u{1F4C4}",c=i.path.replace(e.directory,".");console.log(` ${a} ${l.dim(c)}`),console.log(` ${l.dim(i.reason)}`)}console.log()}if(e.dryRun){console.log(l.yellow("DRY RUN - No files were removed."));return}if(!e.yes&&(console.log(l.yellow("\u26A0\uFE0F This action cannot be undone.")),!await u9(`
|
|
1957
|
+
Proceed with uninstallation?`))){console.log(l.dim(`
|
|
1958
|
+
Uninstall cancelled.`));return}console.log(l.dim(`
|
|
1959
|
+
Removing files...`));let s=y9(o,!1);if(console.log(),s.removed.length>0){console.log(l.green(`\u2713 Removed ${s.removed.length} item(s):`));for(let i of s.removed)console.log(l.dim(` - ${i}`))}if(s.skipped.length>0){console.log(l.yellow(`
|
|
1960
|
+
\u26A0 Skipped ${s.skipped.length} item(s):`));for(let i of s.skipped)console.log(l.dim(` - ${i}`))}if(s.errors.length>0){console.log(l.red(`
|
|
1961
|
+
\u2717 Failed to remove ${s.errors.length} item(s):`));for(let i of s.errors)console.log(l.dim(` - ${i}`))}console.log(l.blue(`
|
|
1962
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(l.blue(" GAL has been uninstalled.")),console.log(l.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1963
|
+
`)),console.log(l.dim("To reinstall, run: gal sync --pull")),console.log(l.dim(`To completely remove the CLI: npm uninstall -g @scheduler-systems/gal-cli
|
|
1964
|
+
`))}),t}var He=H(require("fs"),1),kt=H(require("path"),1),iF=[{id:"claude-code",name:"Claude Code",configPath:".claude/settings.json",commandsPath:".claude/commands",detected:!1},{id:"cursor",name:"Cursor",configPath:".cursor/settings.json",commandsPath:".cursor/rules",detected:!1},{id:"windsurf",name:"Windsurf",configPath:".windsurf/settings.json",commandsPath:".windsurf/commands",detected:!1},{id:"codex",name:"GitHub Copilot/Codex",configPath:".github/copilot/settings.json",commandsPath:".github/copilot",detected:!1},{id:"gemini",name:"Google Gemini",configPath:".gemini/settings.json",commandsPath:".gemini/commands",detected:!1}],bb=[{id:"review",name:"Code Review",description:"Run automated code review",platforms:["claude-code","cursor","windsurf","codex","gemini"],template:`---
|
|
1965
|
+
description: Run automated code review
|
|
1966
|
+
---
|
|
1967
|
+
|
|
1968
|
+
Review the current changes for:
|
|
1969
|
+
1. Security vulnerabilities
|
|
1970
|
+
2. Code quality issues
|
|
1971
|
+
3. Best practices violations
|
|
1972
|
+
4. Test coverage gaps
|
|
1973
|
+
|
|
1974
|
+
Provide actionable feedback with specific line references.`},{id:"audit",name:"Security Audit",description:"Run security audit",platforms:["claude-code","cursor","windsurf","codex","gemini"],template:`---
|
|
1975
|
+
description: Run security audit
|
|
1976
|
+
---
|
|
1977
|
+
|
|
1978
|
+
Perform a security audit checking for:
|
|
1979
|
+
1. Hardcoded secrets and API keys
|
|
1980
|
+
2. SQL injection vulnerabilities
|
|
1981
|
+
3. XSS vulnerabilities
|
|
1982
|
+
4. Insecure dependencies
|
|
1983
|
+
5. Authentication/authorization issues
|
|
1984
|
+
|
|
1985
|
+
Report findings with severity levels and remediation steps.`},{id:"test",name:"Generate Tests",description:"Generate unit tests",platforms:["claude-code","cursor","windsurf","codex","gemini"],template:`---
|
|
1986
|
+
description: Generate unit tests for changed files
|
|
1987
|
+
---
|
|
1988
|
+
|
|
1989
|
+
Generate comprehensive unit tests for recently changed files:
|
|
1990
|
+
1. Identify all modified functions/classes
|
|
1991
|
+
2. Create test cases covering happy path and edge cases
|
|
1992
|
+
3. Include error handling tests
|
|
1993
|
+
4. Aim for high coverage
|
|
1994
|
+
|
|
1995
|
+
Use the project's existing testing framework and patterns.`},{id:"document",name:"Generate Documentation",description:"Generate code documentation",platforms:["claude-code","cursor","windsurf","codex","gemini"],template:`---
|
|
1996
|
+
description: Generate documentation for code
|
|
1997
|
+
---
|
|
1998
|
+
|
|
1999
|
+
Generate documentation for the current file/module:
|
|
2000
|
+
1. Add JSDoc/TSDoc comments to all public functions
|
|
2001
|
+
2. Document parameters and return types
|
|
2002
|
+
3. Include usage examples where helpful
|
|
2003
|
+
4. Update README if significant changes made`},{id:"refactor",name:"Suggest Refactoring",description:"Suggest code refactoring improvements",platforms:["claude-code","cursor","windsurf","codex","gemini"],template:`---
|
|
2004
|
+
description: Suggest refactoring improvements
|
|
2005
|
+
---
|
|
2006
|
+
|
|
2007
|
+
Analyze the code and suggest refactoring improvements:
|
|
2008
|
+
1. Identify code smells
|
|
2009
|
+
2. Find duplication opportunities
|
|
2010
|
+
3. Suggest better abstractions
|
|
2011
|
+
4. Recommend performance improvements
|
|
2012
|
+
|
|
2013
|
+
Provide specific, actionable suggestions with before/after examples.`},{id:"fix",name:"Fix Issues",description:"Fix linting and type errors",platforms:["claude-code","cursor","windsurf","codex","gemini"],template:`---
|
|
2014
|
+
description: Fix linting and type errors
|
|
2015
|
+
---
|
|
2016
|
+
|
|
2017
|
+
Fix all linting and type errors in the project:
|
|
2018
|
+
1. Run linter and identify issues
|
|
2019
|
+
2. Fix each issue appropriately
|
|
2020
|
+
3. Ensure no new issues are introduced
|
|
2021
|
+
4. Run type check and fix any type errors
|
|
2022
|
+
|
|
2023
|
+
Preserve code behavior while fixing issues.`}];function v9(){let t=new F("universal").description("Universal AI agent commands");return t.addCommand(new F("detect").description("Detect installed AI agent platforms").option("-p, --path <path>","Project path",process.cwd()).action(e=>{let n=Wd(e.path);console.log(l.blue.bold(`
|
|
2024
|
+
AI Agent Platform Detection
|
|
2025
|
+
`)),console.log("\u2500".repeat(50));for(let o of n){let s=o.detected?l.green("\u2713 Detected"):l.dim("Not found");console.log(`${s} ${o.name}`),o.detected&&console.log(l.dim(` Config: ${o.configPath}`))}let r=n.filter(o=>o.detected).length;console.log(""),console.log(r>0?l.green(`Found ${r} platform(s)`):l.yellow("No AI agent platforms detected"))})),t.addCommand(new F("list").description("List available universal commands").action(()=>{console.log(l.blue.bold(`
|
|
2026
|
+
Universal AI Agent Commands
|
|
2027
|
+
`)),console.log("\u2500".repeat(50));for(let e of bb)console.log(`
|
|
2028
|
+
${l.cyan("/"+e.id)}`),console.log(` ${e.description}`),console.log(l.dim(` Platforms: ${e.platforms.join(", ")}`));console.log(`
|
|
2029
|
+
`+"\u2500".repeat(50)),console.log(l.dim(`
|
|
2030
|
+
Install: gal universal install <command-id>`)),console.log(l.dim("Install all: gal universal install --all"))})),t.addCommand(new F("install").description("Install universal commands to detected platforms").argument("[command-id]","Command to install").option("--all","Install all commands").option("-p, --path <path>","Project path",process.cwd()).option("--platforms <platforms...>","Specific platforms to install to").option("--force","Overwrite existing commands").action(async(e,n)=>{let r=x("Installing universal commands...").start();try{let o=n.path,s=n.platforms?iF.filter(c=>n.platforms.includes(c.id)):Wd(o).filter(c=>c.detected);if(s.length===0){r.fail(l.yellow("No platforms detected")),console.log(l.dim("Use --platforms to specify target platforms"));return}let i=n.all?bb:bb.filter(c=>c.id===e);if(i.length===0){r.fail(l.red(`Unknown command: ${e}`));return}let a=[];for(let c of s)for(let u of i){if(!u.platforms.includes(c.id))continue;let d=kt.join(o,c.commandsPath,`${u.id}.md`);if(He.existsSync(d)&&!n.force){console.log(l.dim(` Skipping ${u.id} for ${c.name} (exists)`));continue}He.mkdirSync(kt.dirname(d),{recursive:!0}),He.writeFileSync(d,u.template,"utf-8"),a.push(`${c.name}/${u.id}`)}r.succeed(l.green("Commands installed successfully!")),console.log(""),console.log(`Installed ${a.length} command(s):`);for(let c of a)console.log(l.green(` \u2713 ${c}`))}catch(o){r.fail(l.red("Installation failed")),console.error(l.red(o instanceof Error?o.message:String(o))),process.exit(1)}})),t.addCommand(new F("sync").description("Sync commands across all detected platforms").option("-p, --path <path>","Project path",process.cwd()).action(async e=>{let n=x("Syncing commands...").start();try{let r=e.path,o=Wd(r).filter(u=>u.detected);if(o.length<2){n.info(l.yellow("Need at least 2 platforms to sync"));return}let s=o[0],i=kt.join(r,s.commandsPath);if(!He.existsSync(i)){n.fail(l.yellow("No commands found to sync"));return}let a=He.readdirSync(i).filter(u=>u.endsWith(".md")),c=0;for(let u of o.slice(1)){let d=kt.join(r,u.commandsPath);He.mkdirSync(d,{recursive:!0});for(let m of a){let p=kt.join(i,m),f=kt.join(d,m);He.existsSync(f)||(He.copyFileSync(p,f),c++)}}n.succeed(l.green(`Synced ${c} commands!`))}catch(r){n.fail(l.red("Sync failed")),console.error(l.red(r instanceof Error?r.message:String(r))),process.exit(1)}})),t.addCommand(new F("create").description("Create a new universal command").argument("<name>","Command name").option("-d, --description <text>","Command description").option("-p, --path <path>","Project path",process.cwd()).action((e,n)=>{let r=`---
|
|
2031
|
+
description: ${n.description||`Custom command: ${e}`}
|
|
2032
|
+
---
|
|
2033
|
+
|
|
2034
|
+
# ${e}
|
|
2035
|
+
|
|
2036
|
+
Add your command instructions here.
|
|
2037
|
+
|
|
2038
|
+
## What this command does
|
|
2039
|
+
|
|
2040
|
+
Describe what the AI should do when this command is invoked.
|
|
2041
|
+
|
|
2042
|
+
## Guidelines
|
|
2043
|
+
|
|
2044
|
+
1. First step
|
|
2045
|
+
2. Second step
|
|
2046
|
+
3. Third step
|
|
2047
|
+
`,o=Wd(n.path).filter(s=>s.detected);if(o.length===0){console.log(l.yellow("No platforms detected. Creating for Claude Code."));let s=kt.join(n.path,".claude/commands");He.mkdirSync(s,{recursive:!0}),He.writeFileSync(kt.join(s,`${e}.md`),r),console.log(l.green(`Created: .claude/commands/${e}.md`));return}for(let s of o){let i=kt.join(n.path,s.commandsPath,`${e}.md`);He.mkdirSync(kt.dirname(i),{recursive:!0}),He.writeFileSync(i,r),console.log(l.green(`Created: ${i}`))}})),t}function Wd(t){return iF.map(e=>({...e,detected:He.existsSync(kt.join(t,e.configPath))||He.existsSync(kt.join(t,e.commandsPath))}))}var Ja=H(require("fs/promises"),1),Ya=H(require("path"),1);function S9(){let t=new F("workflow").description("Test workflow configurations (commands and hooks) in E2B sandbox");return t.command("test").description("Test a workflow file in sandbox before deployment").argument("<file>","Path to command (.md) or hook (.json) file").option("-p, --platform <platform>","Platform: claude, cursor, gemini, codex, windsurf","claude").option("--type <type>","Type: command or hook (auto-detected if not specified)").option("--test-cases <cases>","Comma-separated test cases to run").option("--max-iterations <n>","Maximum improvement iterations (default: 3)","3").option("-o, --org <org>","Organization name").option("--json","Output results as JSON",!1).action(async(e,n)=>{let r=process.env.GAL_API_URL||Ze;try{let o=x(`Reading ${e}...`).start(),s=Ya.default.resolve(e),i=await Ja.default.readFile(s,"utf-8"),a=Ya.default.basename(e),c=n.type;c||(a.endsWith(".md")?c="command":a.includes("hook")||a.endsWith(".json")||a.endsWith(".py")||a.endsWith(".js")?c="hook":(o.fail(l.red("Could not auto-detect type. Please specify --type (command or hook)")),process.exit(1))),o.text="Uploading to sandbox...";let u=n.org||await aF(r);u||(o.fail(l.red("No organization found. Please connect GitHub via dashboard or use --org flag")),process.exit(1));let d=n.testCases?.split(",").map(g=>g.trim()).filter(g=>g)||[];o.text=`Testing ${a} in sandbox...`;let m=await fetch(`${r}/organizations/${u}/workflow-test`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:a,type:c,platform:n.platform,content:i,testCases:d,maxIterations:parseInt(n.maxIterations,10)})});if(!m.ok){let g=await m.text();o.fail(l.red("Test failed")),console.error(l.red(g)),process.exit(1)}let f=(await m.json()).result;o.stop(),n.json?console.log(JSON.stringify(f,null,2)):_9(f),f.recommendation==="reject"&&process.exit(1)}catch(o){console.error(l.red(`Error: ${o instanceof Error?o.message:String(o)}`)),process.exit(1)}}),t.command("test-batch").description("Test multiple workflow files in batch").argument("<directory>","Directory containing workflow files").option("-p, --platform <platform>","Platform: claude, cursor, gemini, codex, windsurf","claude").option("-o, --org <org>","Organization name").option("--report <path>","Save detailed report to file").action(async(e,n)=>{let r=process.env.GAL_API_URL||Ze,o=x("Scanning directory...").start();try{let s=n.org||await aF(r);s||(o.fail(l.red("No organization found. Please connect GitHub via dashboard or use --org flag")),process.exit(1));let i=Ya.default.resolve(e),c=(await Ja.default.readdir(i)).filter(f=>f.endsWith(".md")||f.includes("hook")&&(f.endsWith(".json")||f.endsWith(".py")||f.endsWith(".js")));c.length===0&&(o.fail(l.yellow("No workflow files found")),process.exit(0)),o.text=`Found ${c.length} workflow files. Preparing batch test...`;let u=[];for(let f of c){let g=Ya.default.join(i,f),h=await Ja.default.readFile(g,"utf-8"),y=f.endsWith(".md")?"command":"hook";u.push({fileName:f,type:y,platform:n.platform,content:h,testCases:[],maxIterations:3})}o.text=`Testing ${u.length} workflows in sandbox...`;let d=await fetch(`${r}/organizations/${s}/workflow-test/batch`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({requests:u})});if(!d.ok){let f=await d.text();o.fail(l.red("Batch test failed")),console.error(l.red(f)),process.exit(1)}let p=(await d.json()).report;o.stop(),console.log(l.green(`
|
|
798
2048
|
=== Batch Test Results ===
|
|
799
|
-
`)),console.log(`Total Tests: ${
|
|
800
|
-
Recommendations:`),console.log(` Approve: ${
|
|
801
|
-
Detailed report saved to: ${n.report}`))),
|
|
2049
|
+
`)),console.log(`Total Tests: ${l.bold(p.totalTests)}`),console.log(`Passed: ${l.green(p.passedTests)}`),console.log(`Average Score: ${l.yellow(p.averageScore+"%")}`),console.log(`
|
|
2050
|
+
Recommendations:`),console.log(` Approve: ${l.green(p.summary.byRecommendation.approve)}`),console.log(` Needs Revision: ${l.yellow(p.summary.byRecommendation.revise)}`),console.log(` Reject: ${l.red(p.summary.byRecommendation.reject)}`),n.report&&(await Ja.default.writeFile(n.report,JSON.stringify(p,null,2)),console.log(l.gray(`
|
|
2051
|
+
Detailed report saved to: ${n.report}`))),p.passedTests<p.totalTests&&process.exit(1)}catch(s){o.fail(l.red("Batch test failed")),console.error(l.red(`Error: ${s instanceof Error?s.message:String(s)}`)),process.exit(1)}}),t}async function aF(t){try{let e=await fetch(`${t}/organizations`,{credentials:"include"});if(!e.ok)return null;let n=await e.json();return n.length>0?n[0].name:null}catch{return null}}function _9(t){console.log(l.green(`
|
|
802
2052
|
=== Test Results ===
|
|
803
|
-
`)),console.log(`File: ${
|
|
804
|
-
`)),console.log(
|
|
805
|
-
`)),
|
|
806
|
-
`)),
|
|
807
|
-
`),
|
|
808
|
-
`+
|
|
809
|
-
`)}function
|
|
2053
|
+
`)),console.log(`File: ${l.bold(t.fileName)}`),console.log(`Type: ${l.cyan(t.type)}`),console.log(`Platform: ${l.cyan(t.platform)}`),console.log(`Iterations: ${t.iterations.length}`),console.log(`Execution: ${t.executionTimeMs}ms`),console.log();let e=t.finalScore>=80?l.green:t.finalScore>=60?l.yellow:l.red;console.log(`Final Score: ${e(t.finalScore+"/100")}`);let n=t.recommendation==="approve"?l.green:t.recommendation==="revise"?l.yellow:l.red;console.log(`Recommendation: ${n(t.recommendation.toUpperCase())}`),console.log(),t.error&&(console.log(l.red("Error:")),console.log(l.red(" "+t.error)),console.log());let r=t.iterations[t.iterations.length-1];r&&(console.log(l.blue(`=== LLM Evaluation ===
|
|
2054
|
+
`)),console.log(r.evaluation.reasoning),console.log(),r.evaluation.issues.length>0&&(console.log(l.yellow(`Issues Found:
|
|
2055
|
+
`)),r.evaluation.issues.forEach((o,s)=>{let i=o.severity==="critical"||o.severity==="high"?l.red:o.severity==="medium"?l.yellow:l.blue;console.log(` ${s+1}. [${i(o.severity.toUpperCase())}] ${o.message}`)}),console.log()),r.evaluation.suggestedImprovements.length>0&&(console.log(l.cyan(`Suggested Improvements:
|
|
2056
|
+
`)),r.evaluation.suggestedImprovements.forEach((o,s)=>{console.log(` ${s+1}. ${o}`)}),console.log())),t.recommendation==="approve"?console.log(l.green("\u2713 This workflow is ready for deployment!")):t.recommendation==="revise"?console.log(l.yellow("\u26A0 This workflow needs improvements before deployment.")):console.log(l.red("\u2717 This workflow should be rejected. See issues above.")),console.log()}var Sb=(0,wb.join)((0,uF.homedir)(),".gal"),_b=(0,wb.join)(Sb,"update-cache.json"),w9=24*60*60*1e3;function E9(t,e){let n=t.replace(/^v/,"").split(".").map(Number),r=e.replace(/^v/,"").split(".").map(Number);for(let o=0;o<3;o++){if((n[o]||0)<(r[o]||0))return-1;if((n[o]||0)>(r[o]||0))return 1}return 0}function D9(){try{if((0,tr.existsSync)(_b))return JSON.parse((0,tr.readFileSync)(_b,"utf-8"))}catch{}return null}function C9(t){try{(0,tr.existsSync)(Sb)||(0,tr.mkdirSync)(Sb,{recursive:!0}),(0,tr.writeFileSync)(_b,JSON.stringify(t))}catch{}}function k9(t,e){let n=["",l.bgYellow.black(" UPDATE AVAILABLE "),"",` ${l.dim(t)} \u2192 ${l.green(e)}`,"",` Run: ${l.cyan("npm update -g @scheduler-systems/gal-cli")}`,""].join(`
|
|
2057
|
+
`),o=l.yellow("\u2500".repeat(50));console.log(`
|
|
2058
|
+
`+o),console.log(n),console.log(o+`
|
|
2059
|
+
`)}function A9(t){return/-(alpha|beta|pr|rc|dev)/i.test(t)}function T9(){if(A9(Vs))return;let t=process.argv.includes("--json")||process.argv.includes("-j"),e=D9(),n=!e||Date.now()-e.lastCheck>w9;if(e?.latestVersion&&E9(Vs,e.latestVersion)<0&&!t&&process.on("exit",()=>{k9(Vs,e.latestVersion)}),n){let r=lF.default.get("https://registry.npmjs.org/@scheduler-systems/gal-cli/latest",{timeout:3e3},o=>{let s="";o.on("data",i=>s+=i),o.on("end",()=>{try{let i=JSON.parse(s);C9({lastCheck:Date.now(),latestVersion:i.version})}catch{}})});r.on("error",()=>{}),r.on("timeout",()=>r.destroy());try{typeof r.unref=="function"&&r.unref()}catch{}}}T9();D0();E0();kf();process.on("beforeExit",async()=>{await Af()});cF.default.config();var Eb=new F;Eb.name("gal").description("GAL - Governance Agentic Layer CLI").version(Vs);Object.values(vb).filter(t=>typeof t=="function"&&t.name.startsWith("create")&&t.name.endsWith("Command")).forEach(t=>Eb.addCommand(t()));Eb.parse();
|
|
2060
|
+
/*! Bundled license information:
|
|
2061
|
+
|
|
2062
|
+
platform/platform.js:
|
|
2063
|
+
(*!
|
|
2064
|
+
* Platform.js v1.3.6
|
|
2065
|
+
* Copyright 2014-2020 Benjamin Tan
|
|
2066
|
+
* Copyright 2011-2013 John-David Dalton
|
|
2067
|
+
* Available under MIT license
|
|
2068
|
+
*)
|
|
2069
|
+
*/
|