zion-mcp 2.8.7 → 2.8.9

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.
@@ -0,0 +1,1599 @@
1
+ import { createRequire as __nodeCreateRequire } from 'node:module';
2
+ const require = __nodeCreateRequire(import.meta.url);
3
+ import{a as Ap,b as Ai,c as zo,d as Jo,f as eE,g as tE}from"./chunk-PELMZ3TA.js";import{A as cE,B as lE,V as pE,W as Pp,X as dE,Y as fE,Z as hE,_ as mE,a as rE,b as xp,c as nE,d as Cp,e as P,f as Ht,g as iE,h as Kt,i as oE,j as Rp,k as sE,l as aE,s as uE}from"./chunk-4EEDKION.js";import{a as nn,b as Yv,c as jr,d as X,e as Fn,f as Xv,g as Ka,i as Zv}from"./chunk-EHH2N7RR.js";import{a as F,c as v,e as Qe,g as p}from"./chunk-4CUA7DTF.js";var Yo=v(Dp=>{p();var Qa=class extends Error{constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},Np=class extends Qa{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Dp.CommanderError=Qa;Dp.InvalidArgumentError=Np});var Wa=v(kp=>{p();var{InvalidArgumentError:gL}=Yo(),Lp=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new gL(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function yL(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}kp.Argument=Lp;kp.humanReadableArgName=yL});var Fp=v(Mp=>{p();var{humanReadableArgName:vL}=Wa(),jp=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(i=>!i._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,o)=>i.name().localeCompare(o.name())),r}compareOptions(t,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(i=>!i.hidden),n=t._getHelpOption();if(n&&!n.hidden){let i=n.short&&t._findOption(n.short),o=n.long&&t._findOption(n.long);!i&&!o?r.push(n):n.long&&!o?r.push(t.createOption(n.long,n.description)):n.short&&!i&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>vL(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let i=t.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatItemList(t,r,n){return r.length===0?[]:[n.styleTitle(t),...r,""]}groupItems(t,r,n){let i=new Map;return t.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[])}),r.forEach(o=>{let s=n(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(t,r){let n=r.padWidth(t,r),i=r.helpWidth??80;function o(d,f){return r.formatItem(d,n,f,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],a=r.commandDescription(t);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let u=r.visibleArguments(t).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(s=s.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(t.options,r.visibleOptions(t),d=>d.helpGroupHeading??"Options:").forEach((d,f)=>{let h=d.map(g=>o(r.styleOptionTerm(r.optionTerm(g)),r.styleOptionDescription(r.optionDescription(g))));s=s.concat(this.formatItemList(f,h,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(t).map(f=>o(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));s=s.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(t.commands,r.visibleCommands(t),d=>d.helpGroup()||"Commands:").forEach((d,f)=>{let h=d.map(g=>o(r.styleSubcommandTerm(r.subcommandTerm(g)),r.styleSubcommandDescription(r.subcommandDescription(g))));s=s.concat(this.formatItemList(f,h,r))}),s.join(`
4
+ `)}displayWidth(t){return gE(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,n,i){let s=" ".repeat(2);if(!n)return s+t;let a=t.padEnd(r+t.length-i.displayWidth(t)),u=2,l=(this.helpWidth??80)-r-u-2,d;return l<this.minWidthToWrap||i.preformatted(n)?d=n:d=i.boxWrap(n,l).replace(/\n/g,`
5
+ `+" ".repeat(r+u)),s+a+" ".repeat(u)+d.replace(/\n/g,`
6
+ ${s}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let n=t.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,o=[];return n.forEach(s=>{let a=s.match(i);if(a===null){o.push("");return}let u=[a.shift()],c=this.displayWidth(u[0]);a.forEach(l=>{let d=this.displayWidth(l);if(c+d<=r){u.push(l),c+=d;return}o.push(u.join(""));let f=l.trimStart();u=[f],c=this.displayWidth(f)}),o.push(u.join(""))}),o.join(`
7
+ `)}};function gE(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}Mp.Help=jp;Mp.stripColor=gE});var Gp=v(Vp=>{p();var{InvalidArgumentError:EL}=Yo(),qp=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=_L(t);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new EL(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?yE(this.name().replace(/^no-/,"")):yE(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Up=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===t)}};function yE(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function _L(e){let t,r,n=/^-[^-]$/,i=/^--[^-]/,o=e.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(t=o.shift()),i.test(o[0])&&(r=o.shift()),!t&&n.test(o[0])&&(t=o.shift()),!t&&i.test(o[0])&&(t=r,r=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${e}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a}
8
+ - a short flag is a single dash and a single character
9
+ - either use a single dash and a single character (for a short flag)
10
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a}
11
+ - too many short flags`):i.test(s)?new Error(`${a}
12
+ - too many long flags`):new Error(`${a}
13
+ - unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}Vp.Option=qp;Vp.DualOptions=Up});var EE=v(vE=>{p();function SL(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=e.length;i++){let o=1;e[i-1]===t[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&e[i-1]===t[n-2]&&e[i-2]===t[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[e.length][t.length]}function bL(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(s=>s.slice(2)));let n=[],i=3,o=.4;return t.forEach(s=>{if(s.length<=1)return;let a=SL(e,s),u=Math.max(e.length,s.length);(u-a)/u>o&&(a<i?(i=a,n=[s]):a===i&&n.push(s))}),n.sort((s,a)=>s.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?`
14
+ (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
15
+ (Did you mean ${n[0]}?)`:""}vE.suggestSimilar=bL});var TE=v(Qp=>{p();var TL=F("node:events").EventEmitter,$p=F("node:child_process"),Mr=F("node:path"),za=F("node:fs"),Ee=F("node:process"),{Argument:IL,humanReadableArgName:wL}=Wa(),{CommanderError:Bp}=Yo(),{Help:OL,stripColor:AL}=Fp(),{Option:_E,DualOptions:xL}=Gp(),{suggestSimilar:SE}=EE(),Hp=class e extends TL{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",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._savedState=null,this._outputConfiguration={writeOut:r=>Ee.stdout.write(r),writeErr:r=>Ee.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ee.stdout.isTTY?Ee.stdout.columns:void 0,getErrHelpWidth:()=>Ee.stderr.isTTY?Ee.stderr.columns:void 0,getOutHasColors:()=>Kp()??(Ee.stdout.isTTY&&Ee.stdout.hasColors?.()),getErrHasColors:()=>Kp()??(Ee.stderr.isTTY&&Ee.stderr.hasColors?.()),stripColor:r=>AL(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=t.match(/([^ ]+) *(.*)/),u=this.createCommand(s);return i&&(u.description(i),u._executableHandler=!0),o.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(o.noHelp||o.hidden),u._executableFile=o.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),i?this:u}createCommand(t){return new e(t)}createHelp(){return Object.assign(new OL,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
16
+ - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new IL(t,r)}argument(t,r,n,i){let o=this.createArgument(t,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=t??"help [command]",[,i,o]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(t||r)&&this._initCommandGroup(a),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),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(t,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
17
+ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,n){this._exitCallback&&this._exitCallback(new Bp(t,r,n)),Ee.exit(t)}action(t){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),t.apply(this,o)};return this._actionHandler=r,this}createOption(t,r){return new _E(t,r)}_callParseArg(t,r,n,i){try{return t.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
18
+ - already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=i=>[i.name()].concat(i.aliases()),n=r(t).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),n=t.attributeName();if(t.negate){let o=t.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");let i=(o,s,a)=>{o==null&&t.presetArg!==void 0&&(o=t.presetArg);let u=this.getOptionValue(n);o!==null&&t.parseArg?o=this._callParseArg(t,o,u,s):o!==null&&t.variadic&&(o=t._collectValue(o,u)),o==null&&(t.negate?o=!1:t.isBoolean()||t.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${t.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),t.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${t.flags}' value '${o}' from env '${t.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(t,r,n,i,o){if(typeof r=="object"&&r instanceof _E)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!t.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(u,c)=>{let l=a.exec(u);return l?l[0]:c},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(t,r,n,i){return this._optionEx({},t,r,n,i)}requiredOption(t,r,n,i){return this._optionEx({mandatory:!0},t,r,n,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,n){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(t)!==void 0&&(r=n.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){Ee.versions?.electron&&(r.from="electron");let i=Ee.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}t===void 0&&(t=Ee.argv),this.rawArgs=t.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":Ee.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;case"eval":n=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,r){this._prepareForParse();let n=this._prepareUserArgs(t,r);return this._parseCommand([],n),this}async parseAsync(t,r){this._prepareForParse();let n=this._prepareUserArgs(t,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
19
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,r,n){if(za.existsSync(t))return;let i=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${t}' does not exist
20
+ - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
21
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
22
+ - ${i}`;throw new Error(o)}_executeSubCommand(t,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(l,d){let f=Mr.resolve(l,d);if(za.existsSync(f))return f;if(i.includes(Mr.extname(d)))return;let h=i.find(g=>za.existsSync(`${f}${g}`));if(h)return`${f}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=za.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=Mr.resolve(Mr.dirname(l),a)}if(a){let l=o(a,s);if(!l&&!t._executableFile&&this._scriptPath){let d=Mr.basename(this._scriptPath,Mr.extname(this._scriptPath));d!==this._name&&(l=o(a,`${d}-${t._name}`))}s=l||s}n=i.includes(Mr.extname(s));let u;Ee.platform!=="win32"?n?(r.unshift(s),r=bE(Ee.execArgv).concat(r),u=$p.spawn(Ee.argv[0],r,{stdio:"inherit"})):u=$p.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,t._name),r.unshift(s),r=bE(Ee.execArgv).concat(r),u=$p.spawn(Ee.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ee.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new Bp(l,"commander.executeSubCommandAsync","(close)")):Ee.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(s,a,t._name);else if(l.code==="EACCES")throw new Error(`'${s}' not executable`);if(!c)Ee.exit(1);else{let d=new Bp(1,"commander.executeSubCommandAsync","(error)");d.nestedError=l,c(d)}}),this.runningCommand=u}_dispatchSubcommand(t,r,n){let i=this._findCommand(t);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(n,i,o)=>{let s=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,i,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?i<this.args.length?(o=this.args.slice(i),n.parseArg&&(o=o.reduce((s,a)=>t(n,a,s),n.defaultValue))):o===void 0&&(o=[]):i<this.args.length&&(o=this.args[i],n.parseArg&&(o=t(n,o,n.defaultValue))),r[i]=o}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let n=t,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,r,n){let i=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_parseCommand(t,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),r=n.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,t,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=t.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],n=[],i=r;function o(l){return l.length>1&&l[0]==="-"}let s=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(d=>d.options.map(f=>f.short).some(f=>/^-\d$/.test(f))):!1,a=null,u=null,c=0;for(;c<t.length||u;){let l=u??t[c++];if(u=null,l==="--"){i===n&&i.push(l),i.push(...t.slice(c));break}if(a&&(!o(l)||s(l))){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let d=this._findOption(l);if(d){if(d.required){let f=t[c++];f===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,f)}else if(d.optional){let f=null;c<t.length&&(!o(t[c])||s(t[c]))&&(f=t[c++]),this.emit(`option:${d.name()}`,f)}else this.emit(`option:${d.name()}`);a=d.variadic?d:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let d=this._findOption(`-${l[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,l.slice(2)):(this.emit(`option:${d.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let d=l.indexOf("="),f=this._findOption(l.slice(0,d));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,l.slice(d+1));continue}}if(i===r&&o(l)&&!(this.commands.length===0&&s(l))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...t.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...t.slice(c));break}else if(this._defaultCommandName){n.push(l,...t.slice(c));break}}if(this._passThroughOptions){i.push(l,...t.slice(c));break}i.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let n=0;n<r;n++){let i=this.options[n].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
23
+ `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
24
+ `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
25
+ `),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in Ee.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,Ee.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new xL(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let n=s=>{let a=s.attributeName(),u=this.getOptionValue(a),c=this.options.find(d=>d.negate&&a===d.attributeName()),l=this.options.find(d=>!d.negate&&a===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||s},i=s=>{let a=n(s),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(t)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=SE(t,i)}let n=`error: unknown option '${t}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${t.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=SE(t,i)}let n=`error: unknown command '${t}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(t,r,n){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",n=n||"output the version number";let i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
26
+ `),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(t);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>wL(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Mr.basename(t,Mr.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),n=this._getOutputContext(t);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=r.formatHelp(this,r);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(t){t=t||{};let r=!!t.error,n,i,o;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:o}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let n=this._getOutputContext(t),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(Ee.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
27
+ Expecting one of '${n.join("', '")}'`);let i=`${t}Help`;return this.on(i,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s}
28
+ `)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function bE(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",i="9229",o;return(o=t.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:t})}function Kp(){if(Ee.env.NO_COLOR||Ee.env.FORCE_COLOR==="0"||Ee.env.FORCE_COLOR==="false")return!1;if(Ee.env.FORCE_COLOR||Ee.env.CLICOLOR_FORCE!==void 0)return!0}Qp.Command=Hp;Qp.useColor=Kp});var AE=v(Qt=>{p();var{Argument:IE}=Wa(),{Command:Wp}=TE(),{CommanderError:CL,InvalidArgumentError:wE}=Yo(),{Help:RL}=Fp(),{Option:OE}=Gp();Qt.program=new Wp;Qt.createCommand=e=>new Wp(e);Qt.createOption=(e,t)=>new OE(e,t);Qt.createArgument=(e,t)=>new IE(e,t);Qt.Command=Wp;Qt.Option=OE;Qt.Argument=IE;Qt.Help=RL;Qt.CommanderError=CL;Qt.InvalidArgumentError=wE;Qt.InvalidOptionArgumentError=wE});var xi=v((Jp,PE)=>{p();var Ja=F("buffer"),Er=Ja.Buffer;function RE(e,t){for(var r in e)t[r]=e[r]}Er.from&&Er.alloc&&Er.allocUnsafe&&Er.allocUnsafeSlow?PE.exports=Ja:(RE(Ja,Jp),Jp.Buffer=qn);function qn(e,t,r){return Er(e,t,r)}qn.prototype=Object.create(Er.prototype);RE(Er,qn);qn.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Er(e,t,r)};qn.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Er(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};qn.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Er(e)};qn.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Ja.SlowBuffer(e)}});var Yp=v((C7,NE)=>{p();var Ya=xi().Buffer,PL=F("stream"),NL=F("util");function Xa(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=Ya.alloc(0),this;if(typeof e.pipe=="function")return this.buffer=Ya.alloc(0),e.pipe(this),this;if(e.length||typeof e=="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}NL.inherits(Xa,PL);Xa.prototype.write=function(t){this.buffer=Ya.concat([this.buffer,Ya.from(t)]),this.emit("data",t)};Xa.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};NE.exports=Xa});var LE=v((P7,DE)=>{"use strict";p();function Xp(e){var t=(e/8|0)+(e%8===0?0:1);return t}var DL={ES256:Xp(256),ES384:Xp(384),ES512:Xp(521)};function LL(e){var t=DL[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}DE.exports=LL});var VE=v((D7,UE)=>{"use strict";p();var Za=xi().Buffer,jE=LE(),eu=128,ME=0,kL=32,jL=16,ML=2,FE=jL|kL|ME<<6,tu=ML|ME<<6;function FL(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function qE(e){if(Za.isBuffer(e))return e;if(typeof e=="string")return Za.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function qL(e,t){e=qE(e);var r=jE(t),n=r+1,i=e.length,o=0;if(e[o++]!==FE)throw new Error('Could not find expected "seq"');var s=e[o++];if(s===(eu|1)&&(s=e[o++]),i-o<s)throw new Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==tu)throw new Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw new Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var u=o;if(o+=a,e[o++]!==tu)throw new Error('Could not find expected "int" for "s"');var c=e[o++];if(i-o!==c)throw new Error('"s" specified length of "'+c+'", expected "'+(i-o)+'"');if(n<c)throw new Error('"s" specified length of "'+c+'", max of "'+n+'" is acceptable');var l=o;if(o+=c,o!==i)throw new Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var d=r-a,f=r-c,h=Za.allocUnsafe(d+a+f+c);for(o=0;o<d;++o)h[o]=0;e.copy(h,o,u+Math.max(-d,0),u+a),o=r;for(var g=o;o<g+f;++o)h[o]=0;return e.copy(h,o,l+Math.max(-f,0),l+c),h=h.toString("base64"),h=FL(h),h}function kE(e,t,r){for(var n=0;t+n<r&&e[t+n]===0;)++n;var i=e[t+n]>=eu;return i&&--n,n}function UL(e,t){e=qE(e);var r=jE(t),n=e.length;if(n!==r*2)throw new TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=kE(e,0,r),o=kE(e,r,e.length),s=r-i,a=r-o,u=2+s+1+1+a,c=u<eu,l=Za.allocUnsafe((c?2:3)+u),d=0;return l[d++]=FE,c?l[d++]=u:(l[d++]=eu|1,l[d++]=u&255),l[d++]=tu,l[d++]=s,i<0?(l[d++]=0,d+=e.copy(l,d,0,r)):d+=e.copy(l,d,i,r),l[d++]=tu,l[d++]=a,o<0?(l[d++]=0,e.copy(l,d,r)):e.copy(l,d,r+o),l}UE.exports={derToJose:qL,joseToDer:UL}});var $E=v((k7,GE)=>{"use strict";p();var Xo=F("buffer").Buffer,Zp=F("buffer").SlowBuffer;GE.exports=ru;function ru(e,t){if(!Xo.isBuffer(e)||!Xo.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}ru.install=function(){Xo.prototype.equal=Zp.prototype.equal=function(t){return ru(this,t)}};var VL=Xo.prototype.equal,GL=Zp.prototype.equal;ru.restore=function(){Xo.prototype.equal=VL,Zp.prototype.equal=GL}});var nd=v((M7,XE)=>{p();var Ri=xi().Buffer,Wt=F("crypto"),HE=VE(),BE=F("util"),$L=`"%s" is not a valid algorithm.
29
+ Supported algorithms are:
30
+ "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,Zo="secret must be a string or buffer",Ci="key must be a string or a buffer",BL="key must be a string, a buffer or an object",td=typeof Wt.createPublicKey=="function";td&&(Ci+=" or a KeyObject",Zo+="or a KeyObject");function KE(e){if(!Ri.isBuffer(e)&&typeof e!="string"&&(!td||typeof e!="object"||typeof e.type!="string"||typeof e.asymmetricKeyType!="string"||typeof e.export!="function"))throw ur(Ci)}function QE(e){if(!Ri.isBuffer(e)&&typeof e!="string"&&typeof e!="object")throw ur(BL)}function HL(e){if(!Ri.isBuffer(e)){if(typeof e=="string")return e;if(!td||typeof e!="object"||e.type!=="secret"||typeof e.export!="function")throw ur(Zo)}}function rd(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function WE(e){e=e.toString();var t=4-e.length%4;if(t!==4)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function ur(e){var t=[].slice.call(arguments,1),r=BE.format.bind(BE,e).apply(null,t);return new TypeError(r)}function KL(e){return Ri.isBuffer(e)||typeof e=="string"}function es(e){return KL(e)||(e=JSON.stringify(e)),e}function zE(e){return function(r,n){HL(n),r=es(r);var i=Wt.createHmac("sha"+e,n),o=(i.update(r),i.digest("base64"));return rd(o)}}var ed,QL="timingSafeEqual"in Wt?function(t,r){return t.byteLength!==r.byteLength?!1:Wt.timingSafeEqual(t,r)}:function(t,r){return ed||(ed=$E()),ed(t,r)};function WL(e){return function(r,n,i){var o=zE(e)(r,i);return QL(Ri.from(n),Ri.from(o))}}function JE(e){return function(r,n){QE(n),r=es(r);var i=Wt.createSign("RSA-SHA"+e),o=(i.update(r),i.sign(n,"base64"));return rd(o)}}function YE(e){return function(r,n,i){KE(i),r=es(r),n=WE(n);var o=Wt.createVerify("RSA-SHA"+e);return o.update(r),o.verify(i,n,"base64")}}function zL(e){return function(r,n){QE(n),r=es(r);var i=Wt.createSign("RSA-SHA"+e),o=(i.update(r),i.sign({key:n,padding:Wt.constants.RSA_PKCS1_PSS_PADDING,saltLength:Wt.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return rd(o)}}function JL(e){return function(r,n,i){KE(i),r=es(r),n=WE(n);var o=Wt.createVerify("RSA-SHA"+e);return o.update(r),o.verify({key:i,padding:Wt.constants.RSA_PKCS1_PSS_PADDING,saltLength:Wt.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function YL(e){var t=JE(e);return function(){var n=t.apply(null,arguments);return n=HE.derToJose(n,"ES"+e),n}}function XL(e){var t=YE(e);return function(n,i,o){i=HE.joseToDer(i,"ES"+e).toString("base64");var s=t(n,i,o);return s}}function ZL(){return function(){return""}}function ek(){return function(t,r){return r===""}}XE.exports=function(t){var r={hs:zE,rs:JE,ps:zL,es:YL,none:ZL},n={hs:WL,rs:YE,ps:JL,es:XL,none:ek},i=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw ur($L,t);var o=(i[1]||i[3]).toLowerCase(),s=i[2];return{sign:r[o](s),verify:n[o](s)}}});var id=v((q7,ZE)=>{p();var tk=F("buffer").Buffer;ZE.exports=function(t){return typeof t=="string"?t:typeof t=="number"||tk.isBuffer(t)?t.toString():JSON.stringify(t)}});var o_=v((V7,i_)=>{p();var rk=xi().Buffer,e_=Yp(),nk=nd(),ik=F("stream"),t_=id(),od=F("util");function r_(e,t){return rk.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ok(e,t,r){r=r||"utf8";var n=r_(t_(e),"binary"),i=r_(t_(t),r);return od.format("%s.%s",n,i)}function n_(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,i=e.encoding,o=nk(t.alg),s=ok(t,r,i),a=o.sign(s,n);return od.format("%s.%s",s,a)}function nu(e){var t=e.secret;if(t=t??e.privateKey,t=t??e.key,/^hs/i.test(e.header.alg)===!0&&t==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new e_(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new e_(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}od.inherits(nu,ik);nu.prototype.sign=function(){try{var t=n_({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};nu.sign=n_;i_.exports=nu});var m_=v(($7,h_)=>{p();var a_=xi().Buffer,s_=Yp(),sk=nd(),ak=F("stream"),u_=id(),uk=F("util"),ck=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function lk(e){return Object.prototype.toString.call(e)==="[object Object]"}function pk(e){if(lk(e))return e;try{return JSON.parse(e)}catch{return}}function c_(e){var t=e.split(".",1)[0];return pk(a_.from(t,"base64").toString("binary"))}function dk(e){return e.split(".",2).join(".")}function l_(e){return e.split(".")[2]}function fk(e,t){t=t||"utf8";var r=e.split(".")[1];return a_.from(r,"base64").toString(t)}function p_(e){return ck.test(e)&&!!c_(e)}function d_(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}e=u_(e);var i=l_(e),o=dk(e),s=sk(t);return s.verify(o,i,r)}function f_(e,t){if(t=t||{},e=u_(e),!p_(e))return null;var r=c_(e);if(!r)return null;var n=fk(e);return(r.typ==="JWT"||t.json)&&(n=JSON.parse(n,t.encoding)),{header:r,payload:n,signature:l_(e)}}function Pi(e){e=e||{};var t=e.secret;if(t=t??e.publicKey,t=t??e.key,/^hs/i.test(e.algorithm)===!0&&t==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new s_(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new s_(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}uk.inherits(Pi,ak);Pi.prototype.verify=function(){try{var t=d_(this.signature.buffer,this.algorithm,this.key.buffer),r=f_(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}};Pi.decode=f_;Pi.isValid=p_;Pi.verify=d_;h_.exports=Pi});var ou=v(on=>{p();var g_=o_(),iu=m_(),hk=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];on.ALGORITHMS=hk;on.sign=g_.sign;on.verify=iu.verify;on.decode=iu.decode;on.isValid=iu.isValid;on.createSign=function(t){return new g_(t)};on.createVerify=function(t){return new iu(t)}});var sd=v((Q7,y_)=>{p();var mk=ou();y_.exports=function(e,t){t=t||{};var r=mk.decode(e,t);if(!r)return null;var n=r.payload;if(typeof n=="string")try{var i=JSON.parse(n);i!==null&&typeof i=="object"&&(n=i)}catch{}return t.complete===!0?{header:r.header,payload:n,signature:r.signature}:n}});var ts=v((z7,v_)=>{p();var su=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};su.prototype=Object.create(Error.prototype);su.prototype.constructor=su;v_.exports=su});var ad=v((Y7,__)=>{p();var E_=ts(),au=function(e,t){E_.call(this,e),this.name="NotBeforeError",this.date=t};au.prototype=Object.create(E_.prototype);au.prototype.constructor=au;__.exports=au});var ud=v((Z7,b_)=>{p();var S_=ts(),uu=function(e,t){S_.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};uu.prototype=Object.create(S_.prototype);uu.prototype.constructor=uu;b_.exports=uu});var I_=v((tee,T_)=>{p();var Ni=1e3,Di=Ni*60,Li=Di*60,Un=Li*24,gk=Un*7,yk=Un*365.25;T_.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return vk(e);if(r==="number"&&isFinite(e))return t.long?_k(e):Ek(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function vk(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*yk;case"weeks":case"week":case"w":return r*gk;case"days":case"day":case"d":return r*Un;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Li;case"minutes":case"minute":case"mins":case"min":case"m":return r*Di;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ni;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Ek(e){var t=Math.abs(e);return t>=Un?Math.round(e/Un)+"d":t>=Li?Math.round(e/Li)+"h":t>=Di?Math.round(e/Di)+"m":t>=Ni?Math.round(e/Ni)+"s":e+"ms"}function _k(e){var t=Math.abs(e);return t>=Un?cu(e,t,Un,"day"):t>=Li?cu(e,t,Li,"hour"):t>=Di?cu(e,t,Di,"minute"):t>=Ni?cu(e,t,Ni,"second"):e+" ms"}function cu(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var cd=v((nee,w_)=>{p();var Sk=I_();w_.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if(typeof e=="string"){var n=Sk(e);return typeof n>"u"?void 0:Math.floor(r+n/1e3)}else return typeof e=="number"?r+e:void 0}});var ki=v((oee,O_)=>{"use strict";p();var bk="2.0.0",Tk=Number.MAX_SAFE_INTEGER||9007199254740991,Ik=16,wk=250,Ok=["major","premajor","minor","preminor","patch","prepatch","prerelease"];O_.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Ik,MAX_SAFE_BUILD_LENGTH:wk,MAX_SAFE_INTEGER:Tk,RELEASE_TYPES:Ok,SEMVER_SPEC_VERSION:bk,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var rs=v((aee,A_)=>{"use strict";p();var Ak=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};A_.exports=Ak});var ji=v((_r,x_)=>{"use strict";p();var{MAX_SAFE_COMPONENT_LENGTH:ld,MAX_SAFE_BUILD_LENGTH:xk,MAX_LENGTH:Ck}=ki(),Rk=rs();_r=x_.exports={};var Pk=_r.re=[],Nk=_r.safeRe=[],j=_r.src=[],Dk=_r.safeSrc=[],M=_r.t={},Lk=0,pd="[a-zA-Z0-9-]",kk=[["\\s",1],["\\d",Ck],[pd,xk]],jk=e=>{for(let[t,r]of kk)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Z=(e,t,r)=>{let n=jk(t),i=Lk++;Rk(e,i,t),M[e]=i,j[i]=t,Dk[i]=n,Pk[i]=new RegExp(t,r?"g":void 0),Nk[i]=new RegExp(n,r?"g":void 0)};Z("NUMERICIDENTIFIER","0|[1-9]\\d*");Z("NUMERICIDENTIFIERLOOSE","\\d+");Z("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${pd}*`);Z("MAINVERSION",`(${j[M.NUMERICIDENTIFIER]})\\.(${j[M.NUMERICIDENTIFIER]})\\.(${j[M.NUMERICIDENTIFIER]})`);Z("MAINVERSIONLOOSE",`(${j[M.NUMERICIDENTIFIERLOOSE]})\\.(${j[M.NUMERICIDENTIFIERLOOSE]})\\.(${j[M.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASEIDENTIFIER",`(?:${j[M.NONNUMERICIDENTIFIER]}|${j[M.NUMERICIDENTIFIER]})`);Z("PRERELEASEIDENTIFIERLOOSE",`(?:${j[M.NONNUMERICIDENTIFIER]}|${j[M.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASE",`(?:-(${j[M.PRERELEASEIDENTIFIER]}(?:\\.${j[M.PRERELEASEIDENTIFIER]})*))`);Z("PRERELEASELOOSE",`(?:-?(${j[M.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${j[M.PRERELEASEIDENTIFIERLOOSE]})*))`);Z("BUILDIDENTIFIER",`${pd}+`);Z("BUILD",`(?:\\+(${j[M.BUILDIDENTIFIER]}(?:\\.${j[M.BUILDIDENTIFIER]})*))`);Z("FULLPLAIN",`v?${j[M.MAINVERSION]}${j[M.PRERELEASE]}?${j[M.BUILD]}?`);Z("FULL",`^${j[M.FULLPLAIN]}$`);Z("LOOSEPLAIN",`[v=\\s]*${j[M.MAINVERSIONLOOSE]}${j[M.PRERELEASELOOSE]}?${j[M.BUILD]}?`);Z("LOOSE",`^${j[M.LOOSEPLAIN]}$`);Z("GTLT","((?:<|>)?=?)");Z("XRANGEIDENTIFIERLOOSE",`${j[M.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Z("XRANGEIDENTIFIER",`${j[M.NUMERICIDENTIFIER]}|x|X|\\*`);Z("XRANGEPLAIN",`[v=\\s]*(${j[M.XRANGEIDENTIFIER]})(?:\\.(${j[M.XRANGEIDENTIFIER]})(?:\\.(${j[M.XRANGEIDENTIFIER]})(?:${j[M.PRERELEASE]})?${j[M.BUILD]}?)?)?`);Z("XRANGEPLAINLOOSE",`[v=\\s]*(${j[M.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[M.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[M.XRANGEIDENTIFIERLOOSE]})(?:${j[M.PRERELEASELOOSE]})?${j[M.BUILD]}?)?)?`);Z("XRANGE",`^${j[M.GTLT]}\\s*${j[M.XRANGEPLAIN]}$`);Z("XRANGELOOSE",`^${j[M.GTLT]}\\s*${j[M.XRANGEPLAINLOOSE]}$`);Z("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ld}})(?:\\.(\\d{1,${ld}}))?(?:\\.(\\d{1,${ld}}))?`);Z("COERCE",`${j[M.COERCEPLAIN]}(?:$|[^\\d])`);Z("COERCEFULL",j[M.COERCEPLAIN]+`(?:${j[M.PRERELEASE]})?(?:${j[M.BUILD]})?(?:$|[^\\d])`);Z("COERCERTL",j[M.COERCE],!0);Z("COERCERTLFULL",j[M.COERCEFULL],!0);Z("LONETILDE","(?:~>?)");Z("TILDETRIM",`(\\s*)${j[M.LONETILDE]}\\s+`,!0);_r.tildeTrimReplace="$1~";Z("TILDE",`^${j[M.LONETILDE]}${j[M.XRANGEPLAIN]}$`);Z("TILDELOOSE",`^${j[M.LONETILDE]}${j[M.XRANGEPLAINLOOSE]}$`);Z("LONECARET","(?:\\^)");Z("CARETTRIM",`(\\s*)${j[M.LONECARET]}\\s+`,!0);_r.caretTrimReplace="$1^";Z("CARET",`^${j[M.LONECARET]}${j[M.XRANGEPLAIN]}$`);Z("CARETLOOSE",`^${j[M.LONECARET]}${j[M.XRANGEPLAINLOOSE]}$`);Z("COMPARATORLOOSE",`^${j[M.GTLT]}\\s*(${j[M.LOOSEPLAIN]})$|^$`);Z("COMPARATOR",`^${j[M.GTLT]}\\s*(${j[M.FULLPLAIN]})$|^$`);Z("COMPARATORTRIM",`(\\s*)${j[M.GTLT]}\\s*(${j[M.LOOSEPLAIN]}|${j[M.XRANGEPLAIN]})`,!0);_r.comparatorTrimReplace="$1$2$3";Z("HYPHENRANGE",`^\\s*(${j[M.XRANGEPLAIN]})\\s+-\\s+(${j[M.XRANGEPLAIN]})\\s*$`);Z("HYPHENRANGELOOSE",`^\\s*(${j[M.XRANGEPLAINLOOSE]})\\s+-\\s+(${j[M.XRANGEPLAINLOOSE]})\\s*$`);Z("STAR","(<|>)?=?\\s*\\*");Z("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Z("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var lu=v((lee,C_)=>{"use strict";p();var Mk=Object.freeze({loose:!0}),Fk=Object.freeze({}),qk=e=>e?typeof e!="object"?Mk:e:Fk;C_.exports=qk});var dd=v((dee,N_)=>{"use strict";p();var R_=/^[0-9]+$/,P_=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=R_.test(e),n=R_.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},Uk=(e,t)=>P_(t,e);N_.exports={compareIdentifiers:P_,rcompareIdentifiers:Uk}});var ot=v((hee,L_)=>{"use strict";p();var pu=rs(),{MAX_LENGTH:D_,MAX_SAFE_INTEGER:du}=ki(),{safeRe:fu,t:hu}=ji(),Vk=lu(),{compareIdentifiers:fd}=dd(),hd=class e{constructor(t,r){if(r=Vk(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>D_)throw new TypeError(`version is longer than ${D_} characters`);pu("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?fu[hu.LOOSE]:fu[hu.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>du||this.major<0)throw new TypeError("Invalid major version");if(this.minor>du||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>du||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<du)return o}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(pu("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=t.prerelease[r];if(pu("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return fd(n,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],i=t.build[r];if(pu("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return fd(n,i)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?fu[hu.PRERELEASELOOSE]:fu[hu.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let o=[r,i];n===!1&&(o=[r]),fd(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};L_.exports=hd});var sn=v((gee,j_)=>{"use strict";p();var k_=ot(),Gk=(e,t,r=!1)=>{if(e instanceof k_)return e;try{return new k_(e,t)}catch(n){if(!r)return null;throw n}};j_.exports=Gk});var F_=v((vee,M_)=>{"use strict";p();var $k=sn(),Bk=(e,t)=>{let r=$k(e,t);return r?r.version:null};M_.exports=Bk});var U_=v((_ee,q_)=>{"use strict";p();var Hk=sn(),Kk=(e,t)=>{let r=Hk(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};q_.exports=Kk});var $_=v((bee,G_)=>{"use strict";p();var V_=ot(),Qk=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new V_(e instanceof V_?e.version:e,r).inc(t,n,i).version}catch{return null}};G_.exports=Qk});var K_=v((Iee,H_)=>{"use strict";p();var B_=sn(),Wk=(e,t)=>{let r=B_(e,null,!0),n=B_(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,u=!!s.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};H_.exports=Wk});var W_=v((Oee,Q_)=>{"use strict";p();var zk=ot(),Jk=(e,t)=>new zk(e,t).major;Q_.exports=Jk});var J_=v((xee,z_)=>{"use strict";p();var Yk=ot(),Xk=(e,t)=>new Yk(e,t).minor;z_.exports=Xk});var X_=v((Ree,Y_)=>{"use strict";p();var Zk=ot(),ej=(e,t)=>new Zk(e,t).patch;Y_.exports=ej});var eS=v((Nee,Z_)=>{"use strict";p();var tj=sn(),rj=(e,t)=>{let r=tj(e,t);return r&&r.prerelease.length?r.prerelease:null};Z_.exports=rj});var zt=v((Lee,rS)=>{"use strict";p();var tS=ot(),nj=(e,t,r)=>new tS(e,r).compare(new tS(t,r));rS.exports=nj});var iS=v((jee,nS)=>{"use strict";p();var ij=zt(),oj=(e,t,r)=>ij(t,e,r);nS.exports=oj});var sS=v((Fee,oS)=>{"use strict";p();var sj=zt(),aj=(e,t)=>sj(e,t,!0);oS.exports=aj});var mu=v((Uee,uS)=>{"use strict";p();var aS=ot(),uj=(e,t,r)=>{let n=new aS(e,r),i=new aS(t,r);return n.compare(i)||n.compareBuild(i)};uS.exports=uj});var lS=v((Gee,cS)=>{"use strict";p();var cj=mu(),lj=(e,t)=>e.sort((r,n)=>cj(r,n,t));cS.exports=lj});var dS=v((Bee,pS)=>{"use strict";p();var pj=mu(),dj=(e,t)=>e.sort((r,n)=>pj(n,r,t));pS.exports=dj});var ns=v((Kee,fS)=>{"use strict";p();var fj=zt(),hj=(e,t,r)=>fj(e,t,r)>0;fS.exports=hj});var gu=v((Wee,hS)=>{"use strict";p();var mj=zt(),gj=(e,t,r)=>mj(e,t,r)<0;hS.exports=gj});var md=v((Jee,mS)=>{"use strict";p();var yj=zt(),vj=(e,t,r)=>yj(e,t,r)===0;mS.exports=vj});var gd=v((Xee,gS)=>{"use strict";p();var Ej=zt(),_j=(e,t,r)=>Ej(e,t,r)!==0;gS.exports=_j});var yu=v((ete,yS)=>{"use strict";p();var Sj=zt(),bj=(e,t,r)=>Sj(e,t,r)>=0;yS.exports=bj});var vu=v((rte,vS)=>{"use strict";p();var Tj=zt(),Ij=(e,t,r)=>Tj(e,t,r)<=0;vS.exports=Ij});var yd=v((ite,ES)=>{"use strict";p();var wj=md(),Oj=gd(),Aj=ns(),xj=yu(),Cj=gu(),Rj=vu(),Pj=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return wj(e,r,n);case"!=":return Oj(e,r,n);case">":return Aj(e,r,n);case">=":return xj(e,r,n);case"<":return Cj(e,r,n);case"<=":return Rj(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};ES.exports=Pj});var SS=v((ste,_S)=>{"use strict";p();var Nj=ot(),Dj=sn(),{safeRe:Eu,t:_u}=ji(),Lj=(e,t)=>{if(e instanceof Nj)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Eu[_u.COERCEFULL]:Eu[_u.COERCE]);else{let u=t.includePrerelease?Eu[_u.COERCERTLFULL]:Eu[_u.COERCERTL],c;for(;(c=u.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Dj(`${n}.${i}.${o}${s}${a}`,t)};_S.exports=Lj});var TS=v((ute,bS)=>{"use strict";p();var kj=sn(),jj=ki(),Mj=ot(),Fj=(e,t,r)=>{if(!jj.RELEASE_TYPES.includes(t))return null;let n=qj(e,r);return n&&Uj(n,t)},qj=(e,t)=>{let r=e instanceof Mj?e.version:e;return kj(r,t)},Uj=(e,t)=>{if(Vj(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},Vj=e=>e.startsWith("pre");bS.exports=Fj});var wS=v((lte,IS)=>{"use strict";p();var vd=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};IS.exports=vd});var Jt=v((dte,CS)=>{"use strict";p();var Gj=/\s+/g,Ed=class e{constructor(t,r){if(r=Bj(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof _d)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Gj," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!AS(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Zj(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){t=t.replace(Xj,"");let n=((this.options.includePrerelease&&Jj)|(this.options.loose&&Yj))+":"+t,i=OS.get(n);if(i)return i;let o=this.options.loose,s=o?gt[st.HYPHENRANGELOOSE]:gt[st.HYPHENRANGE];t=t.replace(s,cM(this.options.includePrerelease)),Ce("hyphen replace",t),t=t.replace(gt[st.COMPARATORTRIM],Qj),Ce("comparator trim",t),t=t.replace(gt[st.TILDETRIM],Wj),Ce("tilde trim",t),t=t.replace(gt[st.CARETTRIM],zj),Ce("caret trim",t);let a=t.split(" ").map(d=>eM(d,this.options)).join(" ").split(/\s+/).map(d=>uM(d,this.options));o&&(a=a.filter(d=>(Ce("loose invalid filter",d,this.options),!!d.match(gt[st.COMPARATORLOOSE])))),Ce("range list",a);let u=new Map,c=a.map(d=>new _d(d,this.options));for(let d of c){if(AS(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return OS.set(n,l),l}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>xS(n,r)&&t.set.some(i=>xS(i,r)&&n.every(o=>i.every(s=>o.intersects(s,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Hj(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(lM(this.set[r],t,this.options))return!0;return!1}};CS.exports=Ed;var $j=wS(),OS=new $j,Bj=lu(),_d=is(),Ce=rs(),Hj=ot(),{safeRe:gt,src:Kj,t:st,comparatorTrimReplace:Qj,tildeTrimReplace:Wj,caretTrimReplace:zj}=ji(),{FLAG_INCLUDE_PRERELEASE:Jj,FLAG_LOOSE:Yj}=ki(),Xj=new RegExp(Kj[st.BUILD],"g"),AS=e=>e.value==="<0.0.0-0",Zj=e=>e.value==="",xS=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every(o=>i.intersects(o,t)),i=n.pop();return r},eM=(e,t)=>(e=e.replace(gt[st.BUILD],""),Ce("comp",e,t),e=nM(e,t),Ce("caret",e),e=tM(e,t),Ce("tildes",e),e=oM(e,t),Ce("xrange",e),e=aM(e,t),Ce("stars",e),e),yt=e=>!e||e.toLowerCase()==="x"||e==="*",tM=(e,t)=>e.trim().split(/\s+/).map(r=>rM(r,t)).join(" "),rM=(e,t)=>{let r=t.loose?gt[st.TILDELOOSE]:gt[st.TILDE];return e.replace(r,(n,i,o,s,a)=>{Ce("tilde",e,n,i,o,s,a);let u;return yt(i)?u="":yt(o)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:yt(s)?u=`>=${i}.${o}.0 <${i}.${+o+1}.0-0`:a?(Ce("replaceTilde pr",a),u=`>=${i}.${o}.${s}-${a} <${i}.${+o+1}.0-0`):u=`>=${i}.${o}.${s} <${i}.${+o+1}.0-0`,Ce("tilde return",u),u})},nM=(e,t)=>e.trim().split(/\s+/).map(r=>iM(r,t)).join(" "),iM=(e,t)=>{Ce("caret",e,t);let r=t.loose?gt[st.CARETLOOSE]:gt[st.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,u)=>{Ce("caret",e,i,o,s,a,u);let c;return yt(o)?c="":yt(s)?c=`>=${o}.0.0${n} <${+o+1}.0.0-0`:yt(a)?o==="0"?c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:u?(Ce("replaceCaret pr",u),o==="0"?s==="0"?c=`>=${o}.${s}.${a}-${u} <${o}.${s}.${+a+1}-0`:c=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.${a}-${u} <${+o+1}.0.0-0`):(Ce("no pr"),o==="0"?s==="0"?c=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:c=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.${a} <${+o+1}.0.0-0`),Ce("caret return",c),c})},oM=(e,t)=>(Ce("replaceXRanges",e,t),e.split(/\s+/).map(r=>sM(r,t)).join(" ")),sM=(e,t)=>{e=e.trim();let r=t.loose?gt[st.XRANGELOOSE]:gt[st.XRANGE];return e.replace(r,(n,i,o,s,a,u)=>{Ce("xRange",e,n,i,o,s,a,u);let c=yt(o),l=c||yt(s),d=l||yt(a),f=d;return i==="="&&f&&(i=""),u=t.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&f?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(u="-0"),n=`${i+o}.${s}.${a}${u}`):l?n=`>=${o}.0.0${u} <${+o+1}.0.0-0`:d&&(n=`>=${o}.${s}.0${u} <${o}.${+s+1}.0-0`),Ce("xRange return",n),n})},aM=(e,t)=>(Ce("replaceStars",e,t),e.trim().replace(gt[st.STAR],"")),uM=(e,t)=>(Ce("replaceGTE0",e,t),e.trim().replace(gt[t.includePrerelease?st.GTE0PRE:st.GTE0],"")),cM=e=>(t,r,n,i,o,s,a,u,c,l,d,f)=>(yt(n)?r="":yt(i)?r=`>=${n}.0.0${e?"-0":""}`:yt(o)?r=`>=${n}.${i}.0${e?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,yt(c)?u="":yt(l)?u=`<${+c+1}.0.0-0`:yt(d)?u=`<${c}.${+l+1}.0-0`:f?u=`<=${c}.${l}.${d}-${f}`:e?u=`<${c}.${l}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),lM=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++)if(Ce(e[n].semver),e[n].semver!==_d.ANY&&e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var is=v((hte,kS)=>{"use strict";p();var os=Symbol("SemVer ANY"),Td=class e{static get ANY(){return os}constructor(t,r){if(r=RS(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),bd("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===os?this.value="":this.value=this.operator+this.semver.version,bd("comp",this)}parse(t){let r=this.options.loose?PS[NS.COMPARATORLOOSE]:PS[NS.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new DS(n[2],this.options.loose):this.semver=os}toString(){return this.value}test(t){if(bd("Comparator.test",t,this.options.loose),this.semver===os||t===os)return!0;if(typeof t=="string")try{t=new DS(t,this.options)}catch{return!1}return Sd(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new LS(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new LS(this.value,r).test(t.semver):(r=RS(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Sd(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Sd(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};kS.exports=Td;var RS=lu(),{safeRe:PS,t:NS}=ji(),Sd=yd(),bd=rs(),DS=ot(),LS=Jt()});var ss=v((gte,jS)=>{"use strict";p();var pM=Jt(),dM=(e,t,r)=>{try{t=new pM(t,r)}catch{return!1}return t.test(e)};jS.exports=dM});var FS=v((vte,MS)=>{"use strict";p();var fM=Jt(),hM=(e,t)=>new fM(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));MS.exports=hM});var US=v((_te,qS)=>{"use strict";p();var mM=ot(),gM=Jt(),yM=(e,t,r)=>{let n=null,i=null,o=null;try{o=new gM(t,r)}catch{return null}return e.forEach(s=>{o.test(s)&&(!n||i.compare(s)===-1)&&(n=s,i=new mM(n,r))}),n};qS.exports=yM});var GS=v((bte,VS)=>{"use strict";p();var vM=ot(),EM=Jt(),_M=(e,t,r)=>{let n=null,i=null,o=null;try{o=new EM(t,r)}catch{return null}return e.forEach(s=>{o.test(s)&&(!n||i.compare(s)===1)&&(n=s,i=new vM(n,r))}),n};VS.exports=_M});var HS=v((Ite,BS)=>{"use strict";p();var Id=ot(),SM=Jt(),$S=ns(),bM=(e,t)=>{e=new SM(e,t);let r=new Id("0.0.0");if(e.test(r)||(r=new Id("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;i.forEach(s=>{let a=new Id(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||$S(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||$S(r,o))&&(r=o)}return r&&e.test(r)?r:null};BS.exports=bM});var QS=v((Ote,KS)=>{"use strict";p();var TM=Jt(),IM=(e,t)=>{try{return new TM(e,t).range||"*"}catch{return null}};KS.exports=IM});var Su=v((xte,YS)=>{"use strict";p();var wM=ot(),JS=is(),{ANY:OM}=JS,AM=Jt(),xM=ss(),WS=ns(),zS=gu(),CM=vu(),RM=yu(),PM=(e,t,r,n)=>{e=new wM(e,n),t=new AM(t,n);let i,o,s,a,u;switch(r){case">":i=WS,o=CM,s=zS,a=">",u=">=";break;case"<":i=zS,o=RM,s=WS,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xM(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let l=t.set[c],d=null,f=null;if(l.forEach(h=>{h.semver===OM&&(h=new JS(">=0.0.0")),d=d||h,f=f||h,i(h.semver,d.semver,n)?d=h:s(h.semver,f.semver,n)&&(f=h)}),d.operator===a||d.operator===u||(!f.operator||f.operator===a)&&o(e,f.semver))return!1;if(f.operator===u&&s(e,f.semver))return!1}return!0};YS.exports=PM});var ZS=v((Rte,XS)=>{"use strict";p();var NM=Su(),DM=(e,t,r)=>NM(e,t,">",r);XS.exports=DM});var tb=v((Nte,eb)=>{"use strict";p();var LM=Su(),kM=(e,t,r)=>LM(e,t,"<",r);eb.exports=kM});var ib=v((Lte,nb)=>{"use strict";p();var rb=Jt(),jM=(e,t,r)=>(e=new rb(e,r),t=new rb(t,r),e.intersects(t,r));nb.exports=jM});var sb=v((jte,ob)=>{"use strict";p();var MM=ss(),FM=zt();ob.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((l,d)=>FM(l,d,r));for(let l of s)MM(l,t,r)?(o=l,i||(i=l)):(o&&n.push([i,o]),o=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return u.length<c.length?u:t}});var db=v((Fte,pb)=>{"use strict";p();var ab=Jt(),Ad=is(),{ANY:wd}=Ad,Od=ss(),xd=zt(),qM=(e,t,r={})=>{if(e===t)return!0;e=new ab(e,r),t=new ab(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=VM(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},UM=[new Ad(">=0.0.0-0")],ub=[new Ad(">=0.0.0")],VM=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===wd){if(t.length===1&&t[0].semver===wd)return!0;r.includePrerelease?e=UM:e=ub}if(t.length===1&&t[0].semver===wd){if(r.includePrerelease)return!0;t=ub}let n=new Set,i,o;for(let h of e)h.operator===">"||h.operator===">="?i=cb(i,h,r):h.operator==="<"||h.operator==="<="?o=lb(o,h,r):n.add(h.semver);if(n.size>1)return null;let s;if(i&&o){if(s=xd(i.semver,o.semver,r),s>0)return null;if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let h of n){if(i&&!Od(h,String(i),r)||o&&!Od(h,String(o),r))return null;for(let g of t)if(!Od(h,String(g),r))return!1;return!0}let a,u,c,l,d=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,f=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;d&&d.prerelease.length===1&&o.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",i){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(a=cb(i,h,r),a===h&&a!==i)return!1}else if(i.operator===">="&&!h.test(i.semver))return!1}if(o){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(u=lb(o,h,r),u===h&&u!==o)return!1}else if(o.operator==="<="&&!h.test(o.semver))return!1}if(!h.operator&&(o||i)&&s!==0)return!1}return!(i&&c&&!o&&s!==0||o&&l&&!i&&s!==0||f||d)},cb=(e,t,r)=>{if(!e)return t;let n=xd(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},lb=(e,t,r)=>{if(!e)return t;let n=xd(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};pb.exports=qM});var bu=v((Ute,mb)=>{"use strict";p();var Cd=ji(),fb=ki(),GM=ot(),hb=dd(),$M=sn(),BM=F_(),HM=U_(),KM=$_(),QM=K_(),WM=W_(),zM=J_(),JM=X_(),YM=eS(),XM=zt(),ZM=iS(),eF=sS(),tF=mu(),rF=lS(),nF=dS(),iF=ns(),oF=gu(),sF=md(),aF=gd(),uF=yu(),cF=vu(),lF=yd(),pF=SS(),dF=TS(),fF=is(),hF=Jt(),mF=ss(),gF=FS(),yF=US(),vF=GS(),EF=HS(),_F=QS(),SF=Su(),bF=ZS(),TF=tb(),IF=ib(),wF=sb(),OF=db();mb.exports={parse:$M,valid:BM,clean:HM,inc:KM,diff:QM,major:WM,minor:zM,patch:JM,prerelease:YM,compare:XM,rcompare:ZM,compareLoose:eF,compareBuild:tF,sort:rF,rsort:nF,gt:iF,lt:oF,eq:sF,neq:aF,gte:uF,lte:cF,cmp:lF,coerce:pF,truncate:dF,Comparator:fF,Range:hF,satisfies:mF,toComparators:gF,maxSatisfying:yF,minSatisfying:vF,minVersion:EF,validRange:_F,outside:SF,gtr:bF,ltr:TF,intersects:IF,simplifyRange:wF,subset:OF,SemVer:GM,re:Cd.re,src:Cd.src,tokens:Cd.t,SEMVER_SPEC_VERSION:fb.SEMVER_SPEC_VERSION,RELEASE_TYPES:fb.RELEASE_TYPES,compareIdentifiers:hb.compareIdentifiers,rcompareIdentifiers:hb.rcompareIdentifiers}});var yb=v((Gte,gb)=>{p();var AF=bu();gb.exports=AF.satisfies(process.version,">=15.7.0")});var Eb=v((Bte,vb)=>{p();var xF=bu();vb.exports=xF.satisfies(process.version,">=16.9.0")});var Rd=v((Kte,_b)=>{p();var CF=yb(),RF=Eb(),PF={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},NF={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};_b.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let n=PF[r];if(!n)throw new Error(`Unknown key type "${r}".`);if(!n.includes(e))throw new Error(`"alg" parameter for "${r}" key type must be one of: ${n.join(", ")}.`);if(CF)switch(r){case"ec":let i=t.asymmetricKeyDetails.namedCurve,o=NF[e];if(i!==o)throw new Error(`"alg" parameter "${e}" requires curve "${o}".`);break;case"rsa-pss":if(RF){let s=parseInt(e.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:u,saltLength:c}=t.asymmetricKeyDetails;if(a!==`sha${s}`||u!==a)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(c!==void 0&&c>s>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}break}}});var Pd=v((Wte,Sb)=>{p();var DF=bu();Sb.exports=DF.satisfies(process.version,"^6.12.0 || >=8.0.0")});var Ib=v((Jte,Tb)=>{p();var xe=ts(),LF=ad(),bb=ud(),kF=sd(),jF=cd(),MF=Rd(),FF=Pd(),qF=ou(),{KeyObject:UF,createSecretKey:VF,createPublicKey:GF}=F("crypto"),Nd=["RS256","RS384","RS512"],$F=["ES256","ES384","ES512"],Dd=["RS256","RS384","RS512"],BF=["HS256","HS384","HS512"];FF&&(Nd.splice(Nd.length,0,"PS256","PS384","PS512"),Dd.splice(Dd.length,0,"PS256","PS384","PS512"));Tb.exports=function(e,t,r,n){typeof r=="function"&&!n&&(n=r,r={}),r||(r={}),r=Object.assign({},r);let i;if(n?i=n:i=function(l,d){if(l)throw l;return d},r.clockTimestamp&&typeof r.clockTimestamp!="number")return i(new xe("clockTimestamp must be a number"));if(r.nonce!==void 0&&(typeof r.nonce!="string"||r.nonce.trim()===""))return i(new xe("nonce must be a non-empty string"));if(r.allowInvalidAsymmetricKeyTypes!==void 0&&typeof r.allowInvalidAsymmetricKeyTypes!="boolean")return i(new xe("allowInvalidAsymmetricKeyTypes must be a boolean"));let o=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return i(new xe("jwt must be provided"));if(typeof e!="string")return i(new xe("jwt must be a string"));let s=e.split(".");if(s.length!==3)return i(new xe("jwt malformed"));let a;try{a=kF(e,{complete:!0})}catch(l){return i(l)}if(!a)return i(new xe("invalid token"));let u=a.header,c;if(typeof t=="function"){if(!n)return i(new xe("verify must be called asynchronous if secret or public key is provided as a callback"));c=t}else c=function(l,d){return d(null,t)};return c(u,function(l,d){if(l)return i(new xe("error in secret or public key callback: "+l.message));let f=s[2].trim()!=="";if(!f&&d)return i(new xe("jwt signature is required"));if(f&&!d)return i(new xe("secret or public key must be provided"));if(!f&&!r.algorithms)return i(new xe('please specify "none" in "algorithms" to verify unsigned tokens'));if(d!=null&&!(d instanceof UF))try{d=GF(d)}catch{try{d=VF(typeof d=="string"?Buffer.from(d):d)}catch{return i(new xe("secretOrPublicKey is not valid key material"))}}if(r.algorithms||(d.type==="secret"?r.algorithms=BF:["rsa","rsa-pss"].includes(d.asymmetricKeyType)?r.algorithms=Dd:d.asymmetricKeyType==="ec"?r.algorithms=$F:r.algorithms=Nd),r.algorithms.indexOf(a.header.alg)===-1)return i(new xe("invalid algorithm"));if(u.alg.startsWith("HS")&&d.type!=="secret")return i(new xe(`secretOrPublicKey must be a symmetric key when using ${u.alg}`));if(/^(?:RS|PS|ES)/.test(u.alg)&&d.type!=="public")return i(new xe(`secretOrPublicKey must be an asymmetric key when using ${u.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{MF(u.alg,d)}catch(y){return i(y)}let h;try{h=qF.verify(e,a.header.alg,d)}catch(y){return i(y)}if(!h)return i(new xe("invalid signature"));let g=a.payload;if(typeof g.nbf<"u"&&!r.ignoreNotBefore){if(typeof g.nbf!="number")return i(new xe("invalid nbf value"));if(g.nbf>o+(r.clockTolerance||0))return i(new LF("jwt not active",new Date(g.nbf*1e3)))}if(typeof g.exp<"u"&&!r.ignoreExpiration){if(typeof g.exp!="number")return i(new xe("invalid exp value"));if(o>=g.exp+(r.clockTolerance||0))return i(new bb("jwt expired",new Date(g.exp*1e3)))}if(r.audience){let y=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(g.aud)?g.aud:[g.aud]).some(function(S){return y.some(function(I){return I instanceof RegExp?I.test(S):I===S})}))return i(new xe("jwt audience invalid. expected: "+y.join(" or ")))}if(r.issuer&&(typeof r.issuer=="string"&&g.iss!==r.issuer||Array.isArray(r.issuer)&&r.issuer.indexOf(g.iss)===-1))return i(new xe("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&g.sub!==r.subject)return i(new xe("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&g.jti!==r.jwtid)return i(new xe("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&g.nonce!==r.nonce)return i(new xe("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if(typeof g.iat!="number")return i(new xe("iat required when maxAge is specified"));let y=jF(r.maxAge,g.iat);if(typeof y>"u")return i(new xe('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(o>=y+(r.clockTolerance||0))return i(new bb("maxAge exceeded",new Date(y*1e3)))}if(r.complete===!0){let y=a.signature;return i(null,{header:u,payload:g,signature:y})}return i(null,g)})}});var Rb=v((Xte,Cb)=>{p();var wb=1/0,Ab=9007199254740991,HF=17976931348623157e292,Ob=NaN,KF="[object Arguments]",QF="[object Function]",WF="[object GeneratorFunction]",zF="[object String]",JF="[object Symbol]",YF=/^\s+|\s+$/g,XF=/^[-+]0x[0-9a-f]+$/i,ZF=/^0b[01]+$/i,eq=/^0o[0-7]+$/i,tq=/^(?:0|[1-9]\d*)$/,rq=parseInt;function nq(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function iq(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function oq(e,t,r){if(t!==t)return iq(e,sq,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function sq(e){return e!==e}function aq(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function uq(e,t){return nq(t,function(r){return e[r]})}function cq(e,t){return function(r){return e(t(r))}}var Tu=Object.prototype,kd=Tu.hasOwnProperty,Iu=Tu.toString,lq=Tu.propertyIsEnumerable,pq=cq(Object.keys,Object),dq=Math.max;function fq(e,t){var r=xb(e)||vq(e)?aq(e.length,String):[],n=r.length,i=!!n;for(var o in e)(t||kd.call(e,o))&&!(i&&(o=="length"||mq(o,n)))&&r.push(o);return r}function hq(e){if(!gq(e))return pq(e);var t=[];for(var r in Object(e))kd.call(e,r)&&r!="constructor"&&t.push(r);return t}function mq(e,t){return t=t??Ab,!!t&&(typeof e=="number"||tq.test(e))&&e>-1&&e%1==0&&e<t}function gq(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Tu;return e===r}function yq(e,t,r,n){e=jd(e)?e:xq(e),r=r&&!n?wq(r):0;var i=e.length;return r<0&&(r=dq(i+r,0)),bq(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&oq(e,t,r)>-1}function vq(e){return Eq(e)&&kd.call(e,"callee")&&(!lq.call(e,"callee")||Iu.call(e)==KF)}var xb=Array.isArray;function jd(e){return e!=null&&Sq(e.length)&&!_q(e)}function Eq(e){return Md(e)&&jd(e)}function _q(e){var t=Ld(e)?Iu.call(e):"";return t==QF||t==WF}function Sq(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ab}function Ld(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Md(e){return!!e&&typeof e=="object"}function bq(e){return typeof e=="string"||!xb(e)&&Md(e)&&Iu.call(e)==zF}function Tq(e){return typeof e=="symbol"||Md(e)&&Iu.call(e)==JF}function Iq(e){if(!e)return e===0?e:0;if(e=Oq(e),e===wb||e===-wb){var t=e<0?-1:1;return t*HF}return e===e?e:0}function wq(e){var t=Iq(e),r=t%1;return t===t?r?t-r:t:0}function Oq(e){if(typeof e=="number")return e;if(Tq(e))return Ob;if(Ld(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ld(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(YF,"");var r=ZF.test(e);return r||eq.test(e)?rq(e.slice(2),r?2:8):XF.test(e)?Ob:+e}function Aq(e){return jd(e)?fq(e):hq(e)}function xq(e){return e?uq(e,Aq(e)):[]}Cb.exports=yq});var Nb=v((ere,Pb)=>{p();var Cq="[object Boolean]",Rq=Object.prototype,Pq=Rq.toString;function Nq(e){return e===!0||e===!1||Dq(e)&&Pq.call(e)==Cq}function Dq(e){return!!e&&typeof e=="object"}Pb.exports=Nq});var Mb=v((rre,jb)=>{p();var Db=1/0,Lq=17976931348623157e292,Lb=NaN,kq="[object Symbol]",jq=/^\s+|\s+$/g,Mq=/^[-+]0x[0-9a-f]+$/i,Fq=/^0b[01]+$/i,qq=/^0o[0-7]+$/i,Uq=parseInt,Vq=Object.prototype,Gq=Vq.toString;function $q(e){return typeof e=="number"&&e==Qq(e)}function kb(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Bq(e){return!!e&&typeof e=="object"}function Hq(e){return typeof e=="symbol"||Bq(e)&&Gq.call(e)==kq}function Kq(e){if(!e)return e===0?e:0;if(e=Wq(e),e===Db||e===-Db){var t=e<0?-1:1;return t*Lq}return e===e?e:0}function Qq(e){var t=Kq(e),r=t%1;return t===t?r?t-r:t:0}function Wq(e){if(typeof e=="number")return e;if(Hq(e))return Lb;if(kb(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=kb(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(jq,"");var r=Fq.test(e);return r||qq.test(e)?Uq(e.slice(2),r?2:8):Mq.test(e)?Lb:+e}jb.exports=$q});var qb=v((ire,Fb)=>{p();var zq="[object Number]",Jq=Object.prototype,Yq=Jq.toString;function Xq(e){return!!e&&typeof e=="object"}function Zq(e){return typeof e=="number"||Xq(e)&&Yq.call(e)==zq}Fb.exports=Zq});var $b=v((sre,Gb)=>{p();var eU="[object Object]";function tU(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function rU(e,t){return function(r){return e(t(r))}}var nU=Function.prototype,Ub=Object.prototype,Vb=nU.toString,iU=Ub.hasOwnProperty,oU=Vb.call(Object),sU=Ub.toString,aU=rU(Object.getPrototypeOf,Object);function uU(e){return!!e&&typeof e=="object"}function cU(e){if(!uU(e)||sU.call(e)!=eU||tU(e))return!1;var t=aU(e);if(t===null)return!0;var r=iU.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Vb.call(r)==oU}Gb.exports=cU});var Hb=v((ure,Bb)=>{p();var lU="[object String]",pU=Object.prototype,dU=pU.toString,fU=Array.isArray;function hU(e){return!!e&&typeof e=="object"}function mU(e){return typeof e=="string"||!fU(e)&&hU(e)&&dU.call(e)==lU}Bb.exports=mU});var Jb=v((lre,zb)=>{p();var gU="Expected a function",Kb=1/0,yU=17976931348623157e292,Qb=NaN,vU="[object Symbol]",EU=/^\s+|\s+$/g,_U=/^[-+]0x[0-9a-f]+$/i,SU=/^0b[01]+$/i,bU=/^0o[0-7]+$/i,TU=parseInt,IU=Object.prototype,wU=IU.toString;function OU(e,t){var r;if(typeof t!="function")throw new TypeError(gU);return e=PU(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}function AU(e){return OU(2,e)}function Wb(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function xU(e){return!!e&&typeof e=="object"}function CU(e){return typeof e=="symbol"||xU(e)&&wU.call(e)==vU}function RU(e){if(!e)return e===0?e:0;if(e=NU(e),e===Kb||e===-Kb){var t=e<0?-1:1;return t*yU}return e===e?e:0}function PU(e){var t=RU(e),r=t%1;return t===t?r?t-r:t:0}function NU(e){if(typeof e=="number")return e;if(CU(e))return Qb;if(Wb(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Wb(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(EU,"");var r=SU.test(e);return r||bU.test(e)?TU(e.slice(2),r?2:8):_U.test(e)?Qb:+e}zb.exports=AU});var oT=v((dre,iT)=>{p();var Yb=cd(),DU=Pd(),LU=Rd(),Xb=ou(),kU=Rb(),wu=Nb(),Zb=Mb(),Fd=qb(),tT=$b(),an=Hb(),jU=Jb(),{KeyObject:MU,createSecretKey:FU,createPrivateKey:qU}=F("crypto"),rT=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];DU&&rT.splice(3,0,"PS256","PS384","PS512");var UU={expiresIn:{isValid:function(e){return Zb(e)||an(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return Zb(e)||an(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return an(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:kU.bind(null,rT),message:'"algorithm" must be a valid string enum value'},header:{isValid:tT,message:'"header" must be an object'},encoding:{isValid:an,message:'"encoding" must be a string'},issuer:{isValid:an,message:'"issuer" must be a string'},subject:{isValid:an,message:'"subject" must be a string'},jwtid:{isValid:an,message:'"jwtid" must be a string'},noTimestamp:{isValid:wu,message:'"noTimestamp" must be a boolean'},keyid:{isValid:an,message:'"keyid" must be a string'},mutatePayload:{isValid:wu,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:wu,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:wu,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},VU={iat:{isValid:Fd,message:'"iat" should be a number of seconds'},exp:{isValid:Fd,message:'"exp" should be a number of seconds'},nbf:{isValid:Fd,message:'"nbf" should be a number of seconds'}};function nT(e,t,r,n){if(!tT(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(i){let o=e[i];if(!o){if(!t)throw new Error('"'+i+'" is not allowed in "'+n+'"');return}if(!o.isValid(r[i]))throw new Error(o.message)})}function GU(e){return nT(UU,!1,e,"options")}function $U(e){return nT(VU,!0,e,"payload")}var eT={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},BU=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];iT.exports=function(e,t,r,n){typeof r=="function"?(n=r,r={}):r=r||{};let i=typeof e=="object"&&!Buffer.isBuffer(e),o=Object.assign({alg:r.algorithm||"HS256",typ:i?"JWT":void 0,kid:r.keyid},r.header);function s(c){if(n)return n(c);throw c}if(!t&&r.algorithm!=="none")return s(new Error("secretOrPrivateKey must have a value"));if(t!=null&&!(t instanceof MU))try{t=qU(t)}catch{try{t=FU(typeof t=="string"?Buffer.from(t):t)}catch{return s(new Error("secretOrPrivateKey is not valid key material"))}}if(o.alg.startsWith("HS")&&t.type!=="secret")return s(new Error(`secretOrPrivateKey must be a symmetric key when using ${o.alg}`));if(/^(?:RS|PS|ES)/.test(o.alg)){if(t.type!=="private")return s(new Error(`secretOrPrivateKey must be an asymmetric key when using ${o.alg}`));if(!r.allowInsecureKeySizes&&!o.alg.startsWith("ES")&&t.asymmetricKeyDetails!==void 0&&t.asymmetricKeyDetails.modulusLength<2048)return s(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`))}if(typeof e>"u")return s(new Error("payload is required"));if(i){try{$U(e)}catch(c){return s(c)}r.mutatePayload||(e=Object.assign({},e))}else{let c=BU.filter(function(l){return typeof r[l]<"u"});if(c.length>0)return s(new Error("invalid "+c.join(",")+" option for "+typeof e+" payload"))}if(typeof e.exp<"u"&&typeof r.expiresIn<"u")return s(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof e.nbf<"u"&&typeof r.notBefore<"u")return s(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{GU(r)}catch(c){return s(c)}if(!r.allowInvalidAsymmetricKeyTypes)try{LU(o.alg,t)}catch(c){return s(c)}let a=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:i&&(e.iat=a),typeof r.notBefore<"u"){try{e.nbf=Yb(r.notBefore,a)}catch(c){return s(c)}if(typeof e.nbf>"u")return s(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof r.expiresIn<"u"&&typeof e=="object"){try{e.exp=Yb(r.expiresIn,a)}catch(c){return s(c)}if(typeof e.exp>"u")return s(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(eT).forEach(function(c){let l=eT[c];if(typeof r[c]<"u"){if(typeof e[l]<"u")return s(new Error('Bad "options.'+c+'" option. The payload already has an "'+l+'" property.'));e[l]=r[c]}});let u=r.encoding||"utf8";if(typeof n=="function")n=n&&jU(n),Xb.createSign({header:o,privateKey:t,payload:e,encoding:u}).once("error",n).once("done",function(c){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&c.length<256)return n(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`));n(null,c)});else{let c=Xb.sign({header:o,payload:e,secret:t,encoding:u});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&c.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`);return c}}});var as=v((hre,sT)=>{p();sT.exports={decode:sd(),verify:Ib(),sign:oT(),JsonWebTokenError:ts(),NotBeforeError:ad(),TokenExpiredError:ud()}});var dT=v(Mi=>{"use strict";p();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.versionInfo=Mi.version=void 0;var zU="15.10.2";Mi.version=zU;var JU=Object.freeze({major:15,minor:10,patch:2,preReleaseTag:null});Mi.versionInfo=JU});var xu=v(Vd=>{"use strict";p();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.default=YU;function YU(e){return typeof e?.then=="function"}});var Yt=v(Gd=>{"use strict";p();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.default=XU;function XU(e,t){var r=!!e;if(!r)throw new Error(t)}});var Sr=v($d=>{"use strict";p();Object.defineProperty($d,"__esModule",{value:!0});$d.default=ZU;function Cu(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Cu=function(r){return typeof r}:Cu=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Cu(e)}function ZU(e){return Cu(e)=="object"&&e!==null}});var br=v(cn=>{"use strict";p();Object.defineProperty(cn,"__esModule",{value:!0});cn.SYMBOL_TO_STRING_TAG=cn.SYMBOL_ASYNC_ITERATOR=cn.SYMBOL_ITERATOR=void 0;var eV=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator";cn.SYMBOL_ITERATOR=eV;var tV=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator";cn.SYMBOL_ASYNC_ITERATOR=tV;var rV=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";cn.SYMBOL_TO_STRING_TAG=rV});var Ru=v(Bd=>{"use strict";p();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.getLocation=nV;function nV(e,t){for(var r=/\r\n|[\n\r]/g,n=1,i=t+1,o;(o=r.exec(e.body))&&o.index<t;)n+=1,i=t+1-(o.index+o[0].length);return{line:n,column:i}}});var Hd=v(Nu=>{"use strict";p();Object.defineProperty(Nu,"__esModule",{value:!0});Nu.printLocation=oV;Nu.printSourceLocation=hT;var iV=Ru();function oV(e){return hT(e.source,(0,iV.getLocation)(e.source,e.start))}function hT(e,t){var r=e.locationOffset.column-1,n=Pu(r)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=t.line===1?r:0,u=t.column+a,c="".concat(e.name,":").concat(s,":").concat(u,`
31
+ `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var f=Math.floor(u/80),h=u%80,g=[],y=0;y<d.length;y+=80)g.push(d.slice(y,y+80));return c+fT([["".concat(s),g[0]]].concat(g.slice(1,f+1).map(function(_){return["",_]}),[[" ",Pu(h-1)+"^"],["",g[f+1]]]))}return c+fT([["".concat(s-1),l[i-1]],["".concat(s),d],["",Pu(u-1)+"^"],["".concat(s+1),l[i+1]]])}function fT(e){var t=e.filter(function(n){var i=n[0],o=n[1];return o!==void 0}),r=Math.max.apply(Math,t.map(function(n){var i=n[0];return i.length}));return t.map(function(n){var i=n[0],o=n[1];return sV(r,i)+(o?" | "+o:" |")}).join(`
32
+ `)}function Pu(e){return Array(e+1).join(" ")}function sV(e,t){return Pu(e-t.length)+t}});var Q=v(Fi=>{"use strict";p();function Du(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Du=function(r){return typeof r}:Du=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Du(e)}Object.defineProperty(Fi,"__esModule",{value:!0});Fi.printError=TT;Fi.formatError=IT;Fi.GraphQLError=void 0;var aV=_T(Yt()),uV=_T(Sr()),cV=br(),mT=Ru(),gT=Hd();function _T(e){return e&&e.__esModule?e:{default:e}}function yT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function lV(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yT(Object(r),!0).forEach(function(n){pV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yT(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pV(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dV(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vT(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function fV(e,t,r){return t&&vT(e.prototype,t),r&&vT(e,r),e}function hV(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ls(e,t)}function mV(e){var t=bT();return function(){var n=ps(e),i;if(t){var o=ps(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ST(this,i)}}function ST(e,t){return t&&(Du(t)==="object"||typeof t=="function")?t:cs(e)}function cs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kd(e){var t=typeof Map=="function"?new Map:void 0;return Kd=function(n){if(n===null||!gV(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return Lu(n,arguments,ps(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ls(i,n)},Kd(e)}function Lu(e,t,r){return bT()?Lu=Reflect.construct:Lu=function(i,o,s){var a=[null];a.push.apply(a,o);var u=Function.bind.apply(i,a),c=new u;return s&&ls(c,s.prototype),c},Lu.apply(null,arguments)}function bT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function gV(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function ls(e,t){return ls=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ls(e,t)}function ps(e){return ps=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ps(e)}var yV=(function(e){hV(r,e);var t=mV(r);function r(n,i,o,s,a,u,c){var l,d,f,h;dV(this,r),h=t.call(this,n),h.name="GraphQLError",h.originalError=u??void 0,h.nodes=ET(Array.isArray(i)?i:i?[i]:void 0);for(var g=[],y=0,_=(b=h.nodes)!==null&&b!==void 0?b:[];y<_.length;y++){var b,S=_[y],I=S.loc;I!=null&&g.push(I)}g=ET(g),h.source=o??((l=g)===null||l===void 0?void 0:l[0].source),h.positions=s??((d=g)===null||d===void 0?void 0:d.map(function(T){return T.start})),h.locations=s&&o?s.map(function(T){return(0,mT.getLocation)(o,T)}):(f=g)===null||f===void 0?void 0:f.map(function(T){return(0,mT.getLocation)(T.source,T.start)}),h.path=a??void 0;var O=u?.extensions;return c==null&&(0,uV.default)(O)?h.extensions=lV({},O):h.extensions=c??{},Object.defineProperties(cs(h),{message:{enumerable:!0},locations:{enumerable:h.locations!=null},path:{enumerable:h.path!=null},extensions:{enumerable:h.extensions!=null&&Object.keys(h.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?(Object.defineProperty(cs(h),"stack",{value:u.stack,writable:!0,configurable:!0}),ST(h)):(Error.captureStackTrace?Error.captureStackTrace(cs(h),r):Object.defineProperty(cs(h),"stack",{value:Error().stack,writable:!0,configurable:!0}),h)}return fV(r,[{key:"toString",value:function(){return TT(this)}},{key:"toJSON",value:function(){return IT(this)}},{key:cV.SYMBOL_TO_STRING_TAG,get:function(){return"Object"}}]),r})(Kd(Error));Fi.GraphQLError=yV;function ET(e){return e===void 0||e.length===0?void 0:e}function TT(e){var t=e.message;if(e.nodes)for(var r=0,n=e.nodes;r<n.length;r++){var i=n[r];i.loc&&(t+=`
33
+
34
+ `+(0,gT.printLocation)(i.loc))}else if(e.source&&e.locations)for(var o=0,s=e.locations;o<s.length;o++){var a=s[o];t+=`
35
+
36
+ `+(0,gT.printSourceLocation)(e.source,a)}return t}function IT(e){var t;e||(0,aV.default)(0,"Received null or undefined error.");var r=(t=e.message)!==null&&t!==void 0?t:"An unknown error occurred.",n=e.locations,i=e.path,o=e.extensions;return o&&Object.keys(o).length>0?{message:r,locations:n,path:i,extensions:o}:{message:r,locations:n,path:i}}});var ku=v(Qd=>{"use strict";p();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.syntaxError=EV;var vV=Q();function EV(e,t,r){return new vV.GraphQLError("Syntax Error: ".concat(r),void 0,e,[t])}});var we=v(ju=>{"use strict";p();Object.defineProperty(ju,"__esModule",{value:!0});ju.Kind=void 0;var _V=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});ju.Kind=_V});var ut=v(Wd=>{"use strict";p();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.default=SV;function SV(e,t){var r=!!e;if(!r)throw new Error(t??"Unexpected invariant triggered.")}});var zd=v(Mu=>{"use strict";p();Object.defineProperty(Mu,"__esModule",{value:!0});Mu.default=void 0;var bV=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,TV=bV;Mu.default=TV});var Fu=v(Jd=>{"use strict";p();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.default=wV;var IV=OT(ut()),wT=OT(zd());function OT(e){return e&&e.__esModule?e:{default:e}}function wV(e){var t=e.prototype.toJSON;typeof t=="function"||(0,IV.default)(0),e.prototype.inspect=t,wT.default&&(e.prototype[wT.default]=t)}});var qi=v($n=>{"use strict";p();Object.defineProperty($n,"__esModule",{value:!0});$n.isNode=AV;$n.Token=$n.Location=void 0;var AT=OV(Fu());function OV(e){return e&&e.__esModule?e:{default:e}}var xT=(function(){function e(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var t=e.prototype;return t.toJSON=function(){return{start:this.start,end:this.end}},e})();$n.Location=xT;(0,AT.default)(xT);var CT=(function(){function e(r,n,i,o,s,a,u){this.kind=r,this.start=n,this.end=i,this.line=o,this.column=s,this.value=u,this.prev=a,this.next=null}var t=e.prototype;return t.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e})();$n.Token=CT;(0,AT.default)(CT);function AV(e){return e!=null&&typeof e.kind=="string"}});var Ui=v(qu=>{"use strict";p();Object.defineProperty(qu,"__esModule",{value:!0});qu.TokenKind=void 0;var xV=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});qu.TokenKind=xV});var he=v(Yd=>{"use strict";p();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.default=NV;var CV=RV(zd());function RV(e){return e&&e.__esModule?e:{default:e}}function Uu(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Uu=function(r){return typeof r}:Uu=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Uu(e)}var PV=10,RT=2;function NV(e){return Vu(e,[])}function Vu(e,t){switch(Uu(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return e===null?"null":DV(e,t);default:return String(e)}}function DV(e,t){if(t.indexOf(e)!==-1)return"[Circular]";var r=[].concat(t,[e]),n=jV(e);if(n!==void 0){var i=n.call(e);if(i!==e)return typeof i=="string"?i:Vu(i,r)}else if(Array.isArray(e))return kV(e,r);return LV(e,r)}function LV(e,t){var r=Object.keys(e);if(r.length===0)return"{}";if(t.length>RT)return"["+MV(e)+"]";var n=r.map(function(i){var o=Vu(e[i],t);return i+": "+o});return"{ "+n.join(", ")+" }"}function kV(e,t){if(e.length===0)return"[]";if(t.length>RT)return"[Array]";for(var r=Math.min(PV,e.length),n=e.length-r,i=[],o=0;o<r;++o)i.push(Vu(e[o],t));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function jV(e){var t=e[String(CV.default)];if(typeof t=="function")return t;if(typeof e.inspect=="function")return e.inspect}function MV(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){var r=e.constructor.name;if(typeof r=="string"&&r!=="")return r}return t}});var ds=v($u=>{"use strict";p();Object.defineProperty($u,"__esModule",{value:!0});$u.default=void 0;var FV=qV(he());function qV(e){return e&&e.__esModule?e:{default:e}}function Gu(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Gu=function(r){return typeof r}:Gu=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Gu(e)}var UV=process.env.NODE_ENV==="production"?function(t,r){return t instanceof r}:function(t,r){if(t instanceof r)return!0;if(Gu(t)==="object"&&t!==null){var n,i=r.prototype[Symbol.toStringTag],o=Symbol.toStringTag in t?t[Symbol.toStringTag]:(n=t.constructor)===null||n===void 0?void 0:n.name;if(i===o){var s=(0,FV.default)(t);throw new Error("Cannot use ".concat(i,' "').concat(s,`" from another module or realm.
37
+
38
+ Ensure that there is only one instance of "graphql" in the node_modules
39
+ directory. If different versions of "graphql" are the dependencies of other
40
+ relied on modules, use "resolutions" to ensure only one version is installed.
41
+
42
+ https://yarnpkg.com/en/docs/selective-version-resolutions
43
+
44
+ Duplicate "graphql" modules cannot be used at the same time since different
45
+ versions may have different capabilities and behavior. The data from one
46
+ version used in the function from another could produce confusing and
47
+ spurious results.`))}}return!1};$u.default=UV});var Bu=v(fs=>{"use strict";p();Object.defineProperty(fs,"__esModule",{value:!0});fs.isSource=HV;fs.Source=void 0;var VV=br(),GV=Zd(he()),Xd=Zd(Yt()),$V=Zd(ds());function Zd(e){return e&&e.__esModule?e:{default:e}}function PT(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function BV(e,t,r){return t&&PT(e.prototype,t),r&&PT(e,r),e}var NT=(function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof t=="string"||(0,Xd.default)(0,"Body must be a string. Received: ".concat((0,GV.default)(t),".")),this.body=t,this.name=r,this.locationOffset=n,this.locationOffset.line>0||(0,Xd.default)(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,Xd.default)(0,"column in locationOffset is 1-indexed and must be positive.")}return BV(e,[{key:VV.SYMBOL_TO_STRING_TAG,get:function(){return"Source"}}]),e})();fs.Source=NT;function HV(e){return(0,$V.default)(e,NT)}});var Vi=v(Hu=>{"use strict";p();Object.defineProperty(Hu,"__esModule",{value:!0});Hu.DirectiveLocation=void 0;var KV=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});Hu.DirectiveLocation=KV});var Gi=v(hs=>{"use strict";p();Object.defineProperty(hs,"__esModule",{value:!0});hs.dedentBlockStringValue=QV;hs.getBlockStringIndentation=LT;hs.printBlockString=WV;function QV(e){var t=e.split(/\r\n|[\n\r]/g),r=LT(e);if(r!==0)for(var n=1;n<t.length;n++)t[n]=t[n].slice(r);for(var i=0;i<t.length&&DT(t[i]);)++i;for(var o=t.length;o>i&&DT(t[o-1]);)--o;return t.slice(i,o).join(`
48
+ `)}function DT(e){for(var t=0;t<e.length;++t)if(e[t]!==" "&&e[t]!==" ")return!1;return!0}function LT(e){for(var t,r=!0,n=!0,i=0,o=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:e.charCodeAt(s+1)===10&&++s;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(o===null||i<o)&&(o=i),n=!1}return(t=o)!==null&&t!==void 0?t:0}function WV(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=e.indexOf(`
49
+ `)===-1,i=e[0]===" "||e[0]===" ",o=e[e.length-1]==='"',s=e[e.length-1]==="\\",a=!n||o||s||r,u="";return a&&!(n&&i)&&(u+=`
50
+ `+t),u+=t?e.replace(/\n/g,`
51
+ `+t):e,a&&(u+=`
52
+ `),'"""'+u.replace(/"""/g,'\\"""')+'"""'}});var Qu=v(ms=>{"use strict";p();Object.defineProperty(ms,"__esModule",{value:!0});ms.isPunctuatorTokenKind=YV;ms.Lexer=void 0;var Tr=ku(),$e=qi(),ie=Ui(),zV=Gi(),JV=(function(){function e(r){var n=new $e.Token(ie.TokenKind.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},t.lookahead=function(){var n=this.token;if(n.kind!==ie.TokenKind.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=XV(this,n)}while(n.kind===ie.TokenKind.COMMENT);return n},e})();ms.Lexer=JV;function YV(e){return e===ie.TokenKind.BANG||e===ie.TokenKind.DOLLAR||e===ie.TokenKind.AMP||e===ie.TokenKind.PAREN_L||e===ie.TokenKind.PAREN_R||e===ie.TokenKind.SPREAD||e===ie.TokenKind.COLON||e===ie.TokenKind.EQUALS||e===ie.TokenKind.AT||e===ie.TokenKind.BRACKET_L||e===ie.TokenKind.BRACKET_R||e===ie.TokenKind.BRACE_L||e===ie.TokenKind.PIPE||e===ie.TokenKind.BRACE_R}function Bn(e){return isNaN(e)?ie.TokenKind.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function XV(e,t){for(var r=e.source,n=r.body,i=n.length,o=t.end;o<i;){var s=n.charCodeAt(o),a=e.line,u=1+o-e.lineStart;switch(s){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++e.line,e.lineStart=o;continue;case 13:n.charCodeAt(o+1)===10?o+=2:++o,++e.line,e.lineStart=o;continue;case 33:return new $e.Token(ie.TokenKind.BANG,o,o+1,a,u,t);case 35:return eG(r,o,a,u,t);case 36:return new $e.Token(ie.TokenKind.DOLLAR,o,o+1,a,u,t);case 38:return new $e.Token(ie.TokenKind.AMP,o,o+1,a,u,t);case 40:return new $e.Token(ie.TokenKind.PAREN_L,o,o+1,a,u,t);case 41:return new $e.Token(ie.TokenKind.PAREN_R,o,o+1,a,u,t);case 46:if(n.charCodeAt(o+1)===46&&n.charCodeAt(o+2)===46)return new $e.Token(ie.TokenKind.SPREAD,o,o+3,a,u,t);break;case 58:return new $e.Token(ie.TokenKind.COLON,o,o+1,a,u,t);case 61:return new $e.Token(ie.TokenKind.EQUALS,o,o+1,a,u,t);case 64:return new $e.Token(ie.TokenKind.AT,o,o+1,a,u,t);case 91:return new $e.Token(ie.TokenKind.BRACKET_L,o,o+1,a,u,t);case 93:return new $e.Token(ie.TokenKind.BRACKET_R,o,o+1,a,u,t);case 123:return new $e.Token(ie.TokenKind.BRACE_L,o,o+1,a,u,t);case 124:return new $e.Token(ie.TokenKind.PIPE,o,o+1,a,u,t);case 125:return new $e.Token(ie.TokenKind.BRACE_R,o,o+1,a,u,t);case 34:return n.charCodeAt(o+1)===34&&n.charCodeAt(o+2)===34?nG(r,o,a,u,t,e):rG(r,o,a,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return tG(r,o,s,a,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return oG(r,o,a,u,t)}throw(0,Tr.syntaxError)(r,o,ZV(s))}var c=e.line,l=1+o-e.lineStart;return new $e.Token(ie.TokenKind.EOF,i,i,c,l,t)}function ZV(e){return e<32&&e!==9&&e!==10&&e!==13?"Cannot contain the invalid character ".concat(Bn(e),"."):e===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Bn(e),".")}function eG(e,t,r,n,i){var o=e.body,s,a=t;do s=o.charCodeAt(++a);while(!isNaN(s)&&(s>31||s===9));return new $e.Token(ie.TokenKind.COMMENT,t,a,r,n,i,o.slice(t+1,a))}function tG(e,t,r,n,i,o){var s=e.body,a=r,u=t,c=!1;if(a===45&&(a=s.charCodeAt(++u)),a===48){if(a=s.charCodeAt(++u),a>=48&&a<=57)throw(0,Tr.syntaxError)(e,u,"Invalid number, unexpected digit after 0: ".concat(Bn(a),"."))}else u=ef(e,u,a),a=s.charCodeAt(u);if(a===46&&(c=!0,a=s.charCodeAt(++u),u=ef(e,u,a),a=s.charCodeAt(u)),(a===69||a===101)&&(c=!0,a=s.charCodeAt(++u),(a===43||a===45)&&(a=s.charCodeAt(++u)),u=ef(e,u,a),a=s.charCodeAt(u)),a===46||sG(a))throw(0,Tr.syntaxError)(e,u,"Invalid number, expected digit but got: ".concat(Bn(a),"."));return new $e.Token(c?ie.TokenKind.FLOAT:ie.TokenKind.INT,t,u,n,i,o,s.slice(t,u))}function ef(e,t,r){var n=e.body,i=t,o=r;if(o>=48&&o<=57){do o=n.charCodeAt(++i);while(o>=48&&o<=57);return i}throw(0,Tr.syntaxError)(e,i,"Invalid number, expected digit but got: ".concat(Bn(o),"."))}function rG(e,t,r,n,i){for(var o=e.body,s=t+1,a=s,u=0,c="";s<o.length&&!isNaN(u=o.charCodeAt(s))&&u!==10&&u!==13;){if(u===34)return c+=o.slice(a,s),new $e.Token(ie.TokenKind.STRING,t,s+1,r,n,i,c);if(u<32&&u!==9)throw(0,Tr.syntaxError)(e,s,"Invalid character within String: ".concat(Bn(u),"."));if(++s,u===92){switch(c+=o.slice(a,s-1),u=o.charCodeAt(s),u){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
53
+ `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=iG(o.charCodeAt(s+1),o.charCodeAt(s+2),o.charCodeAt(s+3),o.charCodeAt(s+4));if(l<0){var d=o.slice(s+1,s+5);throw(0,Tr.syntaxError)(e,s,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),s+=4;break}default:throw(0,Tr.syntaxError)(e,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++s,a=s}}throw(0,Tr.syntaxError)(e,s,"Unterminated string.")}function nG(e,t,r,n,i,o){for(var s=e.body,a=t+3,u=a,c=0,l="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(c===34&&s.charCodeAt(a+1)===34&&s.charCodeAt(a+2)===34)return l+=s.slice(u,a),new $e.Token(ie.TokenKind.BLOCK_STRING,t,a+3,r,n,i,(0,zV.dedentBlockStringValue)(l));if(c<32&&c!==9&&c!==10&&c!==13)throw(0,Tr.syntaxError)(e,a,"Invalid character within String: ".concat(Bn(c),"."));c===10?(++a,++o.line,o.lineStart=a):c===13?(s.charCodeAt(a+1)===10?a+=2:++a,++o.line,o.lineStart=a):c===92&&s.charCodeAt(a+1)===34&&s.charCodeAt(a+2)===34&&s.charCodeAt(a+3)===34?(l+=s.slice(u,a)+'"""',a+=4,u=a):++a}throw(0,Tr.syntaxError)(e,a,"Unterminated string.")}function iG(e,t,r,n){return Ku(e)<<12|Ku(t)<<8|Ku(r)<<4|Ku(n)}function Ku(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function oG(e,t,r,n,i){for(var o=e.body,s=o.length,a=t+1,u=0;a!==s&&!isNaN(u=o.charCodeAt(a))&&(u===95||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++a;return new $e.Token(ie.TokenKind.NAME,t,a,r,n,i,o.slice(t,a))}function sG(e){return e===95||e>=65&&e<=90||e>=97&&e<=122}});var $i=v(Hn=>{"use strict";p();Object.defineProperty(Hn,"__esModule",{value:!0});Hn.parse=cG;Hn.parseValue=lG;Hn.parseType=pG;Hn.Parser=void 0;var tf=ku(),z=we(),aG=qi(),D=Ui(),kT=Bu(),uG=Vi(),jT=Qu();function cG(e,t){var r=new Wu(e,t);return r.parseDocument()}function lG(e,t){var r=new Wu(e,t);r.expectToken(D.TokenKind.SOF);var n=r.parseValueLiteral(!1);return r.expectToken(D.TokenKind.EOF),n}function pG(e,t){var r=new Wu(e,t);r.expectToken(D.TokenKind.SOF);var n=r.parseTypeReference();return r.expectToken(D.TokenKind.EOF),n}var Wu=(function(){function e(r,n){var i=(0,kT.isSource)(r)?r:new kT.Source(r);this._lexer=new jT.Lexer(i),this._options=n}var t=e.prototype;return t.parseName=function(){var n=this.expectToken(D.TokenKind.NAME);return{kind:z.Kind.NAME,value:n.value,loc:this.loc(n)}},t.parseDocument=function(){var n=this._lexer.token;return{kind:z.Kind.DOCUMENT,definitions:this.many(D.TokenKind.SOF,this.parseDefinition,D.TokenKind.EOF),loc:this.loc(n)}},t.parseDefinition=function(){if(this.peek(D.TokenKind.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(D.TokenKind.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(D.TokenKind.BRACE_L))return{kind:z.Kind.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),o;return this.peek(D.TokenKind.NAME)&&(o=this.parseName()),{kind:z.Kind.OPERATION_DEFINITION,operation:i,name:o,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},t.parseOperationType=function(){var n=this.expectToken(D.TokenKind.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},t.parseVariableDefinitions=function(){return this.optionalMany(D.TokenKind.PAREN_L,this.parseVariableDefinition,D.TokenKind.PAREN_R)},t.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:z.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(D.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(D.TokenKind.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},t.parseVariable=function(){var n=this._lexer.token;return this.expectToken(D.TokenKind.DOLLAR),{kind:z.Kind.VARIABLE,name:this.parseName(),loc:this.loc(n)}},t.parseSelectionSet=function(){var n=this._lexer.token;return{kind:z.Kind.SELECTION_SET,selections:this.many(D.TokenKind.BRACE_L,this.parseSelection,D.TokenKind.BRACE_R),loc:this.loc(n)}},t.parseSelection=function(){return this.peek(D.TokenKind.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var n=this._lexer.token,i=this.parseName(),o,s;return this.expectOptionalToken(D.TokenKind.COLON)?(o=i,s=this.parseName()):s=i,{kind:z.Kind.FIELD,alias:o,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(D.TokenKind.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(D.TokenKind.PAREN_L,i,D.TokenKind.PAREN_R)},t.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(D.TokenKind.COLON),{kind:z.Kind.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},t.parseConstArgument=function(){var n=this._lexer.token;return{kind:z.Kind.ARGUMENT,name:this.parseName(),value:(this.expectToken(D.TokenKind.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},t.parseFragment=function(){var n=this._lexer.token;this.expectToken(D.TokenKind.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(D.TokenKind.NAME)?{kind:z.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:z.Kind.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},t.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:z.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:z.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},t.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case D.TokenKind.BRACKET_L:return this.parseList(n);case D.TokenKind.BRACE_L:return this.parseObject(n);case D.TokenKind.INT:return this._lexer.advance(),{kind:z.Kind.INT,value:i.value,loc:this.loc(i)};case D.TokenKind.FLOAT:return this._lexer.advance(),{kind:z.Kind.FLOAT,value:i.value,loc:this.loc(i)};case D.TokenKind.STRING:case D.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case D.TokenKind.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:z.Kind.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:z.Kind.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:z.Kind.NULL,loc:this.loc(i)};default:return{kind:z.Kind.ENUM,value:i.value,loc:this.loc(i)}}case D.TokenKind.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},t.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:z.Kind.STRING,value:n.value,block:n.kind===D.TokenKind.BLOCK_STRING,loc:this.loc(n)}},t.parseList=function(n){var i=this,o=this._lexer.token,s=function(){return i.parseValueLiteral(n)};return{kind:z.Kind.LIST,values:this.any(D.TokenKind.BRACKET_L,s,D.TokenKind.BRACKET_R),loc:this.loc(o)}},t.parseObject=function(n){var i=this,o=this._lexer.token,s=function(){return i.parseObjectField(n)};return{kind:z.Kind.OBJECT,fields:this.any(D.TokenKind.BRACE_L,s,D.TokenKind.BRACE_R),loc:this.loc(o)}},t.parseObjectField=function(n){var i=this._lexer.token,o=this.parseName();return this.expectToken(D.TokenKind.COLON),{kind:z.Kind.OBJECT_FIELD,name:o,value:this.parseValueLiteral(n),loc:this.loc(i)}},t.parseDirectives=function(n){for(var i=[];this.peek(D.TokenKind.AT);)i.push(this.parseDirective(n));return i},t.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(D.TokenKind.AT),{kind:z.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},t.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(D.TokenKind.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(D.TokenKind.BRACKET_R),i={kind:z.Kind.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(D.TokenKind.BANG)?{kind:z.Kind.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},t.parseNamedType=function(){var n=this._lexer.token;return{kind:z.Kind.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},t.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===D.TokenKind.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},t.peekDescription=function(){return this.peek(D.TokenKind.STRING)||this.peek(D.TokenKind.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var o=this.parseDirectives(!0),s=this.many(D.TokenKind.BRACE_L,this.parseOperationTypeDefinition,D.TokenKind.BRACE_R);return{kind:z.Kind.SCHEMA_DEFINITION,description:i,directives:o,operationTypes:s,loc:this.loc(n)}},t.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(D.TokenKind.COLON);var o=this.parseNamedType();return{kind:z.Kind.OPERATION_TYPE_DEFINITION,operation:i,type:o,loc:this.loc(n)}},t.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var o=this.parseName(),s=this.parseDirectives(!0);return{kind:z.Kind.SCALAR_TYPE_DEFINITION,description:i,name:o,directives:s,loc:this.loc(n)}},t.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var o=this.parseName(),s=this.parseImplementsInterfaces(),a=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:z.Kind.OBJECT_TYPE_DEFINITION,description:i,name:o,interfaces:s,directives:a,fields:u,loc:this.loc(n)}},t.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(D.TokenKind.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(D.TokenKind.AMP)||this.peek(D.TokenKind.NAME));return i}return this.delimitedMany(D.TokenKind.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(D.TokenKind.BRACE_L)&&this._lexer.lookahead().kind===D.TokenKind.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(D.TokenKind.BRACE_L,this.parseFieldDefinition,D.TokenKind.BRACE_R)},t.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),o=this.parseName(),s=this.parseArgumentDefs();this.expectToken(D.TokenKind.COLON);var a=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:z.Kind.FIELD_DEFINITION,description:i,name:o,arguments:s,type:a,directives:u,loc:this.loc(n)}},t.parseArgumentDefs=function(){return this.optionalMany(D.TokenKind.PAREN_L,this.parseInputValueDef,D.TokenKind.PAREN_R)},t.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),o=this.parseName();this.expectToken(D.TokenKind.COLON);var s=this.parseTypeReference(),a;this.expectOptionalToken(D.TokenKind.EQUALS)&&(a=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:z.Kind.INPUT_VALUE_DEFINITION,description:i,name:o,type:s,defaultValue:a,directives:u,loc:this.loc(n)}},t.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var o=this.parseName(),s=this.parseImplementsInterfaces(),a=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:z.Kind.INTERFACE_TYPE_DEFINITION,description:i,name:o,interfaces:s,directives:a,fields:u,loc:this.loc(n)}},t.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var o=this.parseName(),s=this.parseDirectives(!0),a=this.parseUnionMemberTypes();return{kind:z.Kind.UNION_TYPE_DEFINITION,description:i,name:o,directives:s,types:a,loc:this.loc(n)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(D.TokenKind.EQUALS)?this.delimitedMany(D.TokenKind.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var o=this.parseName(),s=this.parseDirectives(!0),a=this.parseEnumValuesDefinition();return{kind:z.Kind.ENUM_TYPE_DEFINITION,description:i,name:o,directives:s,values:a,loc:this.loc(n)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(D.TokenKind.BRACE_L,this.parseEnumValueDefinition,D.TokenKind.BRACE_R)},t.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),o=this.parseName(),s=this.parseDirectives(!0);return{kind:z.Kind.ENUM_VALUE_DEFINITION,description:i,name:o,directives:s,loc:this.loc(n)}},t.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var o=this.parseName(),s=this.parseDirectives(!0),a=this.parseInputFieldsDefinition();return{kind:z.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:o,directives:s,fields:a,loc:this.loc(n)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(D.TokenKind.BRACE_L,this.parseInputValueDef,D.TokenKind.BRACE_R)},t.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===D.TokenKind.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},t.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),o=this.optionalMany(D.TokenKind.BRACE_L,this.parseOperationTypeDefinition,D.TokenKind.BRACE_R);if(i.length===0&&o.length===0)throw this.unexpected();return{kind:z.Kind.SCHEMA_EXTENSION,directives:i,operationTypes:o,loc:this.loc(n)}},t.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),o=this.parseDirectives(!0);if(o.length===0)throw this.unexpected();return{kind:z.Kind.SCALAR_TYPE_EXTENSION,name:i,directives:o,loc:this.loc(n)}},t.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),a=this.parseFieldsDefinition();if(o.length===0&&s.length===0&&a.length===0)throw this.unexpected();return{kind:z.Kind.OBJECT_TYPE_EXTENSION,name:i,interfaces:o,directives:s,fields:a,loc:this.loc(n)}},t.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),a=this.parseFieldsDefinition();if(o.length===0&&s.length===0&&a.length===0)throw this.unexpected();return{kind:z.Kind.INTERFACE_TYPE_EXTENSION,name:i,interfaces:o,directives:s,fields:a,loc:this.loc(n)}},t.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(o.length===0&&s.length===0)throw this.unexpected();return{kind:z.Kind.UNION_TYPE_EXTENSION,name:i,directives:o,types:s,loc:this.loc(n)}},t.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(o.length===0&&s.length===0)throw this.unexpected();return{kind:z.Kind.ENUM_TYPE_EXTENSION,name:i,directives:o,values:s,loc:this.loc(n)}},t.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(o.length===0&&s.length===0)throw this.unexpected();return{kind:z.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:o,fields:s,loc:this.loc(n)}},t.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(D.TokenKind.AT);var o=this.parseName(),s=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:z.Kind.DIRECTIVE_DEFINITION,description:i,name:o,arguments:s,repeatable:a,locations:u,loc:this.loc(n)}},t.parseDirectiveLocations=function(){return this.delimitedMany(D.TokenKind.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(uG.DirectiveLocation[i.value]!==void 0)return i;throw this.unexpected(n)},t.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new aG.Location(n,this._lexer.lastToken,this._lexer.source)},t.peek=function(n){return this._lexer.token.kind===n},t.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw(0,tf.syntaxError)(this._lexer.source,i.start,"Expected ".concat(MT(n),", found ").concat(rf(i),"."))},t.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},t.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===D.TokenKind.NAME&&i.value===n)this._lexer.advance();else throw(0,tf.syntaxError)(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(rf(i),"."))},t.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===D.TokenKind.NAME&&i.value===n?(this._lexer.advance(),!0):!1},t.unexpected=function(n){var i=n??this._lexer.token;return(0,tf.syntaxError)(this._lexer.source,i.start,"Unexpected ".concat(rf(i),"."))},t.any=function(n,i,o){this.expectToken(n);for(var s=[];!this.expectOptionalToken(o);)s.push(i.call(this));return s},t.optionalMany=function(n,i,o){if(this.expectOptionalToken(n)){var s=[];do s.push(i.call(this));while(!this.expectOptionalToken(o));return s}return[]},t.many=function(n,i,o){this.expectToken(n);var s=[];do s.push(i.call(this));while(!this.expectOptionalToken(o));return s},t.delimitedMany=function(n,i){this.expectOptionalToken(n);var o=[];do o.push(i.call(this));while(this.expectOptionalToken(n));return o},e})();Hn.Parser=Wu;function rf(e){var t=e.value;return MT(e.kind)+(t!=null?' "'.concat(t,'"'):"")}function MT(e){return(0,jT.isPunctuatorTokenKind)(e)?'"'.concat(e,'"'):e}});var ln=v(Ur=>{"use strict";p();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.visit=hG;Ur.visitInParallel=mG;Ur.getVisitFn=zu;Ur.BREAK=Ur.QueryDocumentKeys=void 0;var dG=fG(he()),FT=qi();function fG(e){return e&&e.__esModule?e:{default:e}}var qT={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};Ur.QueryDocumentKeys=qT;var Bi=Object.freeze({});Ur.BREAK=Bi;function hG(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qT,n=void 0,i=Array.isArray(e),o=[e],s=-1,a=[],u=void 0,c=void 0,l=void 0,d=[],f=[],h=e;do{s++;var g=s===o.length,y=g&&a.length!==0;if(g){if(c=f.length===0?void 0:d[d.length-1],u=l,l=f.pop(),y){if(i)u=u.slice();else{for(var _={},b=0,S=Object.keys(u);b<S.length;b++){var I=S[b];_[I]=u[I]}u=_}for(var O=0,T=0;T<a.length;T++){var C=a[T][0],L=a[T][1];i&&(C-=O),i&&L===null?(u.splice(C,1),O++):u[C]=L}}s=n.index,o=n.keys,a=n.edits,i=n.inArray,n=n.prev}else{if(c=l?i?s:o[s]:void 0,u=l?l[c]:h,u==null)continue;l&&d.push(c)}var w=void 0;if(!Array.isArray(u)){if(!(0,FT.isNode)(u))throw new Error("Invalid AST Node: ".concat((0,dG.default)(u),"."));var W=zu(t,u.kind,g);if(W){if(w=W.call(t,u,c,l,d,f),w===Bi)break;if(w===!1){if(!g){d.pop();continue}}else if(w!==void 0&&(a.push([c,w]),!g))if((0,FT.isNode)(w))u=w;else{d.pop();continue}}}if(w===void 0&&y&&a.push([c,u]),g)d.pop();else{var ae;n={inArray:i,index:s,keys:o,edits:a,prev:n},i=Array.isArray(u),o=i?u:(ae=r[u.kind])!==null&&ae!==void 0?ae:[],s=-1,a=[],l&&f.push(l),l=u}}while(n!==void 0);return a.length!==0&&(h=a[a.length-1][1]),h}function mG(e){var t=new Array(e.length);return{enter:function(n){for(var i=0;i<e.length;i++)if(t[i]==null){var o=zu(e[i],n.kind,!1);if(o){var s=o.apply(e[i],arguments);if(s===!1)t[i]=n;else if(s===Bi)t[i]=Bi;else if(s!==void 0)return s}}},leave:function(n){for(var i=0;i<e.length;i++)if(t[i]==null){var o=zu(e[i],n.kind,!0);if(o){var s=o.apply(e[i],arguments);if(s===Bi)t[i]=Bi;else if(s!==void 0&&s!==!1)return s}}else t[i]===n&&(t[i]=null)}}}function zu(e,t,r){var n=e[t];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var o=r?e.leave:e.enter;if(o){if(typeof o=="function")return o;var s=o[t];if(typeof s=="function")return s}}}});var Hi=v(Ju=>{"use strict";p();Object.defineProperty(Ju,"__esModule",{value:!0});Ju.default=void 0;var gG=Array.prototype.find?function(e,t){return Array.prototype.find.call(e,t)}:function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(t(n))return n}},yG=gG;Ju.default=yG});var Lt=v(Yu=>{"use strict";p();Object.defineProperty(Yu,"__esModule",{value:!0});Yu.default=void 0;var vG=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},EG=vG;Yu.default=EG});var gs=v(nf=>{"use strict";p();Object.defineProperty(nf,"__esModule",{value:!0});nf.locatedError=TG;var _G=bG(he()),SG=Q();function bG(e){return e&&e.__esModule?e:{default:e}}function TG(e,t,r){var n,i=e instanceof Error?e:new Error("Unexpected error value: "+(0,_G.default)(e));return Array.isArray(i.path)?i:new SG.GraphQLError(i.message,(n=i.nodes)!==null&&n!==void 0?n:t,i.source,i.positions,r,i)}});var of=v(Xu=>{"use strict";p();Object.defineProperty(Xu,"__esModule",{value:!0});Xu.assertValidName=AG;Xu.isValidNameError=VT;var IG=wG(Yt()),UT=Q();function wG(e){return e&&e.__esModule?e:{default:e}}var OG=/^[_a-zA-Z][_a-zA-Z0-9]*$/;function AG(e){var t=VT(e);if(t)throw t;return e}function VT(e){if(typeof e=="string"||(0,IG.default)(0,"Expected name to be a string."),e.length>1&&e[0]==="_"&&e[1]==="_")return new UT.GraphQLError('Name "'.concat(e,'" must not begin with "__", which is reserved by GraphQL introspection.'));if(!OG.test(e))return new UT.GraphQLError('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "'.concat(e,'" does not.'))}});var Ki=v(Zu=>{"use strict";p();Object.defineProperty(Zu,"__esModule",{value:!0});Zu.default=void 0;var xG=Object.entries||function(e){return Object.keys(e).map(function(t){return[t,e[t]]})},CG=xG;Zu.default=CG});var pn=v(sf=>{"use strict";p();Object.defineProperty(sf,"__esModule",{value:!0});sf.default=RG;function RG(e,t){return e.reduce(function(r,n){return r[t(n)]=n,r},Object.create(null))}});var uf=v(af=>{"use strict";p();Object.defineProperty(af,"__esModule",{value:!0});af.default=DG;var PG=NG(Ki());function NG(e){return e&&e.__esModule?e:{default:e}}function DG(e,t){for(var r=Object.create(null),n=0,i=(0,PG.default)(e);n<i.length;n++){var o=i[n],s=o[0],a=o[1];r[s]=t(a,s)}return r}});var ec=v(cf=>{"use strict";p();Object.defineProperty(cf,"__esModule",{value:!0});cf.default=jG;var LG=kG(Ki());function kG(e){return e&&e.__esModule?e:{default:e}}function jG(e){if(Object.getPrototypeOf(e)===null)return e;for(var t=Object.create(null),r=0,n=(0,LG.default)(e);r<n.length;r++){var i=n[r],o=i[0],s=i[1];t[o]=s}return t}});var ys=v(lf=>{"use strict";p();Object.defineProperty(lf,"__esModule",{value:!0});lf.default=MG;function MG(e,t,r){return e.reduce(function(n,i){return n[t(i)]=r(i),n},Object.create(null))}});var dn=v(pf=>{"use strict";p();Object.defineProperty(pf,"__esModule",{value:!0});pf.default=qG;var FG=5;function qG(e,t){var r=typeof e=="string"?[e,t]:[void 0,e],n=r[0],i=r[1],o=" Did you mean ";n&&(o+=n+" ");var s=i.map(function(c){return'"'.concat(c,'"')});switch(s.length){case 0:return"";case 1:return o+s[0]+"?";case 2:return o+s[0]+" or "+s[1]+"?"}var a=s.slice(0,FG),u=a.pop();return o+a.join(", ")+", or "+u+"?"}});var GT=v(df=>{"use strict";p();Object.defineProperty(df,"__esModule",{value:!0});df.default=UG;function UG(e){return e}});var vs=v(hf=>{"use strict";p();Object.defineProperty(hf,"__esModule",{value:!0});hf.default=VG;function VG(e,t){for(var r=0,n=0;r<e.length&&n<t.length;){var i=e.charCodeAt(r),o=t.charCodeAt(n);if(tc(i)&&tc(o)){var s=0;do++r,s=s*10+i-ff,i=e.charCodeAt(r);while(tc(i)&&s>0);var a=0;do++n,a=a*10+o-ff,o=t.charCodeAt(n);while(tc(o)&&a>0);if(s<a)return-1;if(s>a)return 1}else{if(i<o)return-1;if(i>o)return 1;++r,++n}}return e.length-t.length}var ff=48,GG=57;function tc(e){return!isNaN(e)&&ff<=e&&e<=GG}});var fn=v(mf=>{"use strict";p();Object.defineProperty(mf,"__esModule",{value:!0});mf.default=HG;var $G=BG(vs());function BG(e){return e&&e.__esModule?e:{default:e}}function HG(e,t){for(var r=Object.create(null),n=new KG(e),i=Math.floor(e.length*.4)+1,o=0;o<t.length;o++){var s=t[o],a=n.measure(s,i);a!==void 0&&(r[s]=a)}return Object.keys(r).sort(function(u,c){var l=r[u]-r[c];return l!==0?l:(0,$G.default)(u,c)})}var KG=(function(){function e(r){this._input=r,this._inputLowerCase=r.toLowerCase(),this._inputArray=$T(this._inputLowerCase),this._rows=[new Array(r.length+1).fill(0),new Array(r.length+1).fill(0),new Array(r.length+1).fill(0)]}var t=e.prototype;return t.measure=function(n,i){if(this._input===n)return 0;var o=n.toLowerCase();if(this._inputLowerCase===o)return 1;var s=$T(o),a=this._inputArray;if(s.length<a.length){var u=s;s=a,a=u}var c=s.length,l=a.length;if(!(c-l>i)){for(var d=this._rows,f=0;f<=l;f++)d[0][f]=f;for(var h=1;h<=c;h++){for(var g=d[(h-1)%3],y=d[h%3],_=y[0]=h,b=1;b<=l;b++){var S=s[h-1]===a[b-1]?0:1,I=Math.min(g[b]+1,y[b-1]+1,g[b-1]+S);if(h>1&&b>1&&s[h-1]===a[b-2]&&s[h-2]===a[b-1]){var O=d[(h-2)%3][b-2];I=Math.min(I,O+1)}I<_&&(_=I),y[b]=I}if(_>i)return}var T=d[c%3][l];return T<=i?T:void 0}},e})();function $T(e){for(var t=e.length,r=new Array(t),n=0;n<t;++n)r[n]=e.charCodeAt(n);return r}});var wt=v(gf=>{"use strict";p();Object.defineProperty(gf,"__esModule",{value:!0});gf.print=zG;var QG=ln(),WG=Gi();function zG(e){return(0,QG.visit)(e,{leave:YG})}var JG=80,YG={Name:function(t){return t.value},Variable:function(t){return"$"+t.name},Document:function(t){return q(t.definitions,`
54
+
55
+ `)+`
56
+ `},OperationDefinition:function(t){var r=t.operation,n=t.name,i=je("(",q(t.variableDefinitions,", "),")"),o=q(t.directives," "),s=t.selectionSet;return!n&&!o&&!i&&r==="query"?s:q([r,q([n,i]),o,s]," ")},VariableDefinition:function(t){var r=t.variable,n=t.type,i=t.defaultValue,o=t.directives;return r+": "+n+je(" = ",i)+je(" ",q(o," "))},SelectionSet:function(t){var r=t.selections;return lr(r)},Field:function(t){var r=t.alias,n=t.name,i=t.arguments,o=t.directives,s=t.selectionSet,a=je("",r,": ")+n,u=a+je("(",q(i,", "),")");return u.length>JG&&(u=a+je(`(
57
+ `,rc(q(i,`
58
+ `)),`
59
+ )`)),q([u,q(o," "),s]," ")},Argument:function(t){var r=t.name,n=t.value;return r+": "+n},FragmentSpread:function(t){var r=t.name,n=t.directives;return"..."+r+je(" ",q(n," "))},InlineFragment:function(t){var r=t.typeCondition,n=t.directives,i=t.selectionSet;return q(["...",je("on ",r),q(n," "),i]," ")},FragmentDefinition:function(t){var r=t.name,n=t.typeCondition,i=t.variableDefinitions,o=t.directives,s=t.selectionSet;return"fragment ".concat(r).concat(je("(",q(i,", "),")")," ")+"on ".concat(n," ").concat(je("",q(o," ")," "))+s},IntValue:function(t){var r=t.value;return r},FloatValue:function(t){var r=t.value;return r},StringValue:function(t,r){var n=t.value,i=t.block;return i?(0,WG.printBlockString)(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(t){var r=t.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(t){var r=t.value;return r},ListValue:function(t){var r=t.values;return"["+q(r,", ")+"]"},ObjectValue:function(t){var r=t.fields;return"{"+q(r,", ")+"}"},ObjectField:function(t){var r=t.name,n=t.value;return r+": "+n},Directive:function(t){var r=t.name,n=t.arguments;return"@"+r+je("(",q(n,", "),")")},NamedType:function(t){var r=t.name;return r},ListType:function(t){var r=t.type;return"["+r+"]"},NonNullType:function(t){var r=t.type;return r+"!"},SchemaDefinition:cr(function(e){var t=e.directives,r=e.operationTypes;return q(["schema",q(t," "),lr(r)]," ")}),OperationTypeDefinition:function(t){var r=t.operation,n=t.type;return r+": "+n},ScalarTypeDefinition:cr(function(e){var t=e.name,r=e.directives;return q(["scalar",t,q(r," ")]," ")}),ObjectTypeDefinition:cr(function(e){var t=e.name,r=e.interfaces,n=e.directives,i=e.fields;return q(["type",t,je("implements ",q(r," & ")),q(n," "),lr(i)]," ")}),FieldDefinition:cr(function(e){var t=e.name,r=e.arguments,n=e.type,i=e.directives;return t+(BT(r)?je(`(
60
+ `,rc(q(r,`
61
+ `)),`
62
+ )`):je("(",q(r,", "),")"))+": "+n+je(" ",q(i," "))}),InputValueDefinition:cr(function(e){var t=e.name,r=e.type,n=e.defaultValue,i=e.directives;return q([t+": "+r,je("= ",n),q(i," ")]," ")}),InterfaceTypeDefinition:cr(function(e){var t=e.name,r=e.interfaces,n=e.directives,i=e.fields;return q(["interface",t,je("implements ",q(r," & ")),q(n," "),lr(i)]," ")}),UnionTypeDefinition:cr(function(e){var t=e.name,r=e.directives,n=e.types;return q(["union",t,q(r," "),n&&n.length!==0?"= "+q(n," | "):""]," ")}),EnumTypeDefinition:cr(function(e){var t=e.name,r=e.directives,n=e.values;return q(["enum",t,q(r," "),lr(n)]," ")}),EnumValueDefinition:cr(function(e){var t=e.name,r=e.directives;return q([t,q(r," ")]," ")}),InputObjectTypeDefinition:cr(function(e){var t=e.name,r=e.directives,n=e.fields;return q(["input",t,q(r," "),lr(n)]," ")}),DirectiveDefinition:cr(function(e){var t=e.name,r=e.arguments,n=e.repeatable,i=e.locations;return"directive @"+t+(BT(r)?je(`(
63
+ `,rc(q(r,`
64
+ `)),`
65
+ )`):je("(",q(r,", "),")"))+(n?" repeatable":"")+" on "+q(i," | ")}),SchemaExtension:function(t){var r=t.directives,n=t.operationTypes;return q(["extend schema",q(r," "),lr(n)]," ")},ScalarTypeExtension:function(t){var r=t.name,n=t.directives;return q(["extend scalar",r,q(n," ")]," ")},ObjectTypeExtension:function(t){var r=t.name,n=t.interfaces,i=t.directives,o=t.fields;return q(["extend type",r,je("implements ",q(n," & ")),q(i," "),lr(o)]," ")},InterfaceTypeExtension:function(t){var r=t.name,n=t.interfaces,i=t.directives,o=t.fields;return q(["extend interface",r,je("implements ",q(n," & ")),q(i," "),lr(o)]," ")},UnionTypeExtension:function(t){var r=t.name,n=t.directives,i=t.types;return q(["extend union",r,q(n," "),i&&i.length!==0?"= "+q(i," | "):""]," ")},EnumTypeExtension:function(t){var r=t.name,n=t.directives,i=t.values;return q(["extend enum",r,q(n," "),lr(i)]," ")},InputObjectTypeExtension:function(t){var r=t.name,n=t.directives,i=t.fields;return q(["extend input",r,q(n," "),lr(i)]," ")}};function cr(e){return function(t){return q([t.description,e(t)],`
66
+ `)}}function q(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(t=e?.filter(function(n){return n}).join(r))!==null&&t!==void 0?t:""}function lr(e){return je(`{
67
+ `,rc(q(e,`
68
+ `)),`
69
+ }`)}function je(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return t!=null&&t!==""?e+t+r:""}function rc(e){return je(" ",e.replace(/\n/g,`
70
+ `))}function XG(e){return e.indexOf(`
71
+ `)!==-1}function BT(e){return e!=null&&e.some(XG)}});var _f=v(Ef=>{"use strict";p();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.valueFromASTUntyped=yf;var ZG=vf(he()),e$=vf(ut()),t$=vf(ys()),Vr=we();function vf(e){return e&&e.__esModule?e:{default:e}}function yf(e,t){switch(e.kind){case Vr.Kind.NULL:return null;case Vr.Kind.INT:return parseInt(e.value,10);case Vr.Kind.FLOAT:return parseFloat(e.value);case Vr.Kind.STRING:case Vr.Kind.ENUM:case Vr.Kind.BOOLEAN:return e.value;case Vr.Kind.LIST:return e.values.map(function(r){return yf(r,t)});case Vr.Kind.OBJECT:return(0,t$.default)(e.fields,function(r){return r.name.value},function(r){return yf(r.value,t)});case Vr.Kind.VARIABLE:return t?.[e.name.value]}(0,e$.default)(0,"Unexpected value node: "+(0,ZG.default)(e))}});var ce=v(K=>{"use strict";p();Object.defineProperty(K,"__esModule",{value:!0});K.isType=Sf;K.assertType=JT;K.isScalarType=Kn;K.assertScalarType=u$;K.isObjectType=zi;K.assertObjectType=c$;K.isInterfaceType=Qn;K.assertInterfaceType=l$;K.isUnionType=Wn;K.assertUnionType=p$;K.isEnumType=zn;K.assertEnumType=d$;K.isInputObjectType=_s;K.assertInputObjectType=f$;K.isListType=oc;K.assertListType=h$;K.isNonNullType=En;K.assertNonNullType=m$;K.isInputType=bf;K.assertInputType=g$;K.isOutputType=Tf;K.assertOutputType=y$;K.isLeafType=YT;K.assertLeafType=v$;K.isCompositeType=XT;K.assertCompositeType=E$;K.isAbstractType=ZT;K.assertAbstractType=_$;K.GraphQLList=hn;K.GraphQLNonNull=mn;K.isWrappingType=Ss;K.assertWrappingType=S$;K.isNullableType=eI;K.assertNullableType=tI;K.getNullableType=b$;K.isNamedType=rI;K.assertNamedType=T$;K.getNamedType=I$;K.argsToArgsConfig=sI;K.isRequiredArgument=w$;K.isRequiredInputField=C$;K.GraphQLInputObjectType=K.GraphQLEnumType=K.GraphQLUnionType=K.GraphQLInterfaceType=K.GraphQLObjectType=K.GraphQLScalarType=void 0;var WT=kt(Ki()),gn=br(),Re=kt(he()),r$=kt(pn()),ic=kt(uf()),Ir=kt(ec()),Ne=kt(Yt()),zT=kt(ys()),yn=kt(ds()),n$=kt(dn()),i$=kt(Sr()),HT=kt(GT()),vn=kt(Fu()),o$=kt(fn()),Es=Q(),s$=we(),KT=wt(),a$=_f();function kt(e){return e&&e.__esModule?e:{default:e}}function QT(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Wi(e,t,r){return t&&QT(e.prototype,t),r&&QT(e,r),e}function Sf(e){return Kn(e)||zi(e)||Qn(e)||Wn(e)||zn(e)||_s(e)||oc(e)||En(e)}function JT(e){if(!Sf(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL type."));return e}function Kn(e){return(0,yn.default)(e,If)}function u$(e){if(!Kn(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Scalar type."));return e}function zi(e){return(0,yn.default)(e,wf)}function c$(e){if(!zi(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Object type."));return e}function Qn(e){return(0,yn.default)(e,Of)}function l$(e){if(!Qn(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Interface type."));return e}function Wn(e){return(0,yn.default)(e,Af)}function p$(e){if(!Wn(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Union type."));return e}function zn(e){return(0,yn.default)(e,xf)}function d$(e){if(!zn(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Enum type."));return e}function _s(e){return(0,yn.default)(e,Cf)}function f$(e){if(!_s(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Input Object type."));return e}function oc(e){return(0,yn.default)(e,hn)}function h$(e){if(!oc(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL List type."));return e}function En(e){return(0,yn.default)(e,mn)}function m$(e){if(!En(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL Non-Null type."));return e}function bf(e){return Kn(e)||zn(e)||_s(e)||Ss(e)&&bf(e.ofType)}function g$(e){if(!bf(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL input type."));return e}function Tf(e){return Kn(e)||zi(e)||Qn(e)||Wn(e)||zn(e)||Ss(e)&&Tf(e.ofType)}function y$(e){if(!Tf(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL output type."));return e}function YT(e){return Kn(e)||zn(e)}function v$(e){if(!YT(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL leaf type."));return e}function XT(e){return zi(e)||Qn(e)||Wn(e)}function E$(e){if(!XT(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL composite type."));return e}function ZT(e){return Qn(e)||Wn(e)}function _$(e){if(!ZT(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL abstract type."));return e}function hn(e){if(this instanceof hn)this.ofType=JT(e);else return new hn(e)}hn.prototype.toString=function(){return"["+String(this.ofType)+"]"};hn.prototype.toJSON=function(){return this.toString()};Object.defineProperty(hn.prototype,gn.SYMBOL_TO_STRING_TAG,{get:function(){return"GraphQLList"}});(0,vn.default)(hn);function mn(e){if(this instanceof mn)this.ofType=tI(e);else return new mn(e)}mn.prototype.toString=function(){return String(this.ofType)+"!"};mn.prototype.toJSON=function(){return this.toString()};Object.defineProperty(mn.prototype,gn.SYMBOL_TO_STRING_TAG,{get:function(){return"GraphQLNonNull"}});(0,vn.default)(mn);function Ss(e){return oc(e)||En(e)}function S$(e){if(!Ss(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL wrapping type."));return e}function eI(e){return Sf(e)&&!En(e)}function tI(e){if(!eI(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL nullable type."));return e}function b$(e){if(e)return En(e)?e.ofType:e}function rI(e){return Kn(e)||zi(e)||Qn(e)||Wn(e)||zn(e)||_s(e)}function T$(e){if(!rI(e))throw new Error("Expected ".concat((0,Re.default)(e)," to be a GraphQL named type."));return e}function I$(e){if(e){for(var t=e;Ss(t);)t=t.ofType;return t}}function sc(e){return typeof e=="function"?e():e}function Ji(e){return e&&e.length>0?e:void 0}var If=(function(){function e(r){var n,i,o,s=(n=r.parseValue)!==null&&n!==void 0?n:HT.default;this.name=r.name,this.description=r.description,this.specifiedByUrl=r.specifiedByUrl,this.serialize=(i=r.serialize)!==null&&i!==void 0?i:HT.default,this.parseValue=s,this.parseLiteral=(o=r.parseLiteral)!==null&&o!==void 0?o:function(a,u){return s((0,a$.valueFromASTUntyped)(a,u))},this.extensions=r.extensions&&(0,Ir.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=Ji(r.extensionASTNodes),typeof r.name=="string"||(0,Ne.default)(0,"Must provide name."),r.specifiedByUrl==null||typeof r.specifiedByUrl=="string"||(0,Ne.default)(0,"".concat(this.name,' must provide "specifiedByUrl" as a string, ')+"but got: ".concat((0,Re.default)(r.specifiedByUrl),".")),r.serialize==null||typeof r.serialize=="function"||(0,Ne.default)(0,"".concat(this.name,' must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.')),r.parseLiteral&&(typeof r.parseValue=="function"&&typeof r.parseLiteral=="function"||(0,Ne.default)(0,"".concat(this.name,' must provide both "parseValue" and "parseLiteral" functions.')))}var t=e.prototype;return t.toConfig=function(){var n;return{name:this.name,description:this.description,specifiedByUrl:this.specifiedByUrl,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(n=this.extensionASTNodes)!==null&&n!==void 0?n:[]}},t.toString=function(){return this.name},t.toJSON=function(){return this.toString()},Wi(e,[{key:gn.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLScalarType"}}]),e})();K.GraphQLScalarType=If;(0,vn.default)(If);var wf=(function(){function e(r){this.name=r.name,this.description=r.description,this.isTypeOf=r.isTypeOf,this.extensions=r.extensions&&(0,Ir.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=Ji(r.extensionASTNodes),this._fields=iI.bind(void 0,r),this._interfaces=nI.bind(void 0,r),typeof r.name=="string"||(0,Ne.default)(0,"Must provide name."),r.isTypeOf==null||typeof r.isTypeOf=="function"||(0,Ne.default)(0,"".concat(this.name,' must provide "isTypeOf" as a function, ')+"but got: ".concat((0,Re.default)(r.isTypeOf),"."))}var t=e.prototype;return t.getFields=function(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields},t.getInterfaces=function(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces},t.toConfig=function(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:oI(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes||[]}},t.toString=function(){return this.name},t.toJSON=function(){return this.toString()},Wi(e,[{key:gn.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLObjectType"}}]),e})();K.GraphQLObjectType=wf;(0,vn.default)(wf);function nI(e){var t,r=(t=sc(e.interfaces))!==null&&t!==void 0?t:[];return Array.isArray(r)||(0,Ne.default)(0,"".concat(e.name," interfaces must be an Array or a function which returns an Array.")),r}function iI(e){var t=sc(e.fields);return Qi(t)||(0,Ne.default)(0,"".concat(e.name," fields must be an object with field names as keys or a function which returns such an object.")),(0,ic.default)(t,function(r,n){var i;Qi(r)||(0,Ne.default)(0,"".concat(e.name,".").concat(n," field config must be an object.")),!("isDeprecated"in r)||(0,Ne.default)(0,"".concat(e.name,".").concat(n,' should provide "deprecationReason" instead of "isDeprecated".')),r.resolve==null||typeof r.resolve=="function"||(0,Ne.default)(0,"".concat(e.name,".").concat(n," field resolver must be a function if ")+"provided, but got: ".concat((0,Re.default)(r.resolve),"."));var o=(i=r.args)!==null&&i!==void 0?i:{};Qi(o)||(0,Ne.default)(0,"".concat(e.name,".").concat(n," args must be an object with argument names as keys."));var s=(0,WT.default)(o).map(function(a){var u=a[0],c=a[1];return{name:u,description:c.description,type:c.type,defaultValue:c.defaultValue,deprecationReason:c.deprecationReason,extensions:c.extensions&&(0,Ir.default)(c.extensions),astNode:c.astNode}});return{name:n,description:r.description,type:r.type,args:s,resolve:r.resolve,subscribe:r.subscribe,isDeprecated:r.deprecationReason!=null,deprecationReason:r.deprecationReason,extensions:r.extensions&&(0,Ir.default)(r.extensions),astNode:r.astNode}})}function Qi(e){return(0,i$.default)(e)&&!Array.isArray(e)}function oI(e){return(0,ic.default)(e,function(t){return{description:t.description,type:t.type,args:sI(t.args),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}})}function sI(e){return(0,zT.default)(e,function(t){return t.name},function(t){return{description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}})}function w$(e){return En(e.type)&&e.defaultValue===void 0}var Of=(function(){function e(r){this.name=r.name,this.description=r.description,this.resolveType=r.resolveType,this.extensions=r.extensions&&(0,Ir.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=Ji(r.extensionASTNodes),this._fields=iI.bind(void 0,r),this._interfaces=nI.bind(void 0,r),typeof r.name=="string"||(0,Ne.default)(0,"Must provide name."),r.resolveType==null||typeof r.resolveType=="function"||(0,Ne.default)(0,"".concat(this.name,' must provide "resolveType" as a function, ')+"but got: ".concat((0,Re.default)(r.resolveType),"."))}var t=e.prototype;return t.getFields=function(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields},t.getInterfaces=function(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces},t.toConfig=function(){var n;return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:oI(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(n=this.extensionASTNodes)!==null&&n!==void 0?n:[]}},t.toString=function(){return this.name},t.toJSON=function(){return this.toString()},Wi(e,[{key:gn.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLInterfaceType"}}]),e})();K.GraphQLInterfaceType=Of;(0,vn.default)(Of);var Af=(function(){function e(r){this.name=r.name,this.description=r.description,this.resolveType=r.resolveType,this.extensions=r.extensions&&(0,Ir.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=Ji(r.extensionASTNodes),this._types=O$.bind(void 0,r),typeof r.name=="string"||(0,Ne.default)(0,"Must provide name."),r.resolveType==null||typeof r.resolveType=="function"||(0,Ne.default)(0,"".concat(this.name,' must provide "resolveType" as a function, ')+"but got: ".concat((0,Re.default)(r.resolveType),"."))}var t=e.prototype;return t.getTypes=function(){return typeof this._types=="function"&&(this._types=this._types()),this._types},t.toConfig=function(){var n;return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(n=this.extensionASTNodes)!==null&&n!==void 0?n:[]}},t.toString=function(){return this.name},t.toJSON=function(){return this.toString()},Wi(e,[{key:gn.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLUnionType"}}]),e})();K.GraphQLUnionType=Af;(0,vn.default)(Af);function O$(e){var t=sc(e.types);return Array.isArray(t)||(0,Ne.default)(0,"Must provide Array of types or a function which returns such an array for Union ".concat(e.name,".")),t}var xf=(function(){function e(r){this.name=r.name,this.description=r.description,this.extensions=r.extensions&&(0,Ir.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=Ji(r.extensionASTNodes),this._values=A$(this.name,r.values),this._valueLookup=new Map(this._values.map(function(n){return[n.value,n]})),this._nameLookup=(0,r$.default)(this._values,function(n){return n.name}),typeof r.name=="string"||(0,Ne.default)(0,"Must provide name.")}var t=e.prototype;return t.getValues=function(){return this._values},t.getValue=function(n){return this._nameLookup[n]},t.serialize=function(n){var i=this._valueLookup.get(n);if(i===void 0)throw new Es.GraphQLError('Enum "'.concat(this.name,'" cannot represent value: ').concat((0,Re.default)(n)));return i.name},t.parseValue=function(n){if(typeof n!="string"){var i=(0,Re.default)(n);throw new Es.GraphQLError('Enum "'.concat(this.name,'" cannot represent non-string value: ').concat(i,".")+nc(this,i))}var o=this.getValue(n);if(o==null)throw new Es.GraphQLError('Value "'.concat(n,'" does not exist in "').concat(this.name,'" enum.')+nc(this,n));return o.value},t.parseLiteral=function(n,i){if(n.kind!==s$.Kind.ENUM){var o=(0,KT.print)(n);throw new Es.GraphQLError('Enum "'.concat(this.name,'" cannot represent non-enum value: ').concat(o,".")+nc(this,o),n)}var s=this.getValue(n.value);if(s==null){var a=(0,KT.print)(n);throw new Es.GraphQLError('Value "'.concat(a,'" does not exist in "').concat(this.name,'" enum.')+nc(this,a),n)}return s.value},t.toConfig=function(){var n,i=(0,zT.default)(this.getValues(),function(o){return o.name},function(o){return{description:o.description,value:o.value,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}});return{name:this.name,description:this.description,values:i,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(n=this.extensionASTNodes)!==null&&n!==void 0?n:[]}},t.toString=function(){return this.name},t.toJSON=function(){return this.toString()},Wi(e,[{key:gn.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLEnumType"}}]),e})();K.GraphQLEnumType=xf;(0,vn.default)(xf);function nc(e,t){var r=e.getValues().map(function(i){return i.name}),n=(0,o$.default)(t,r);return(0,n$.default)("the enum value",n)}function A$(e,t){return Qi(t)||(0,Ne.default)(0,"".concat(e," values must be an object with value names as keys.")),(0,WT.default)(t).map(function(r){var n=r[0],i=r[1];return Qi(i)||(0,Ne.default)(0,"".concat(e,".").concat(n,' must refer to an object with a "value" key ')+"representing an internal value but got: ".concat((0,Re.default)(i),".")),!("isDeprecated"in i)||(0,Ne.default)(0,"".concat(e,".").concat(n,' should provide "deprecationReason" instead of "isDeprecated".')),{name:n,description:i.description,value:i.value!==void 0?i.value:n,isDeprecated:i.deprecationReason!=null,deprecationReason:i.deprecationReason,extensions:i.extensions&&(0,Ir.default)(i.extensions),astNode:i.astNode}})}var Cf=(function(){function e(r){this.name=r.name,this.description=r.description,this.extensions=r.extensions&&(0,Ir.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=Ji(r.extensionASTNodes),this._fields=x$.bind(void 0,r),typeof r.name=="string"||(0,Ne.default)(0,"Must provide name.")}var t=e.prototype;return t.getFields=function(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields},t.toConfig=function(){var n,i=(0,ic.default)(this.getFields(),function(o){return{description:o.description,type:o.type,defaultValue:o.defaultValue,deprecationReason:o.deprecationReason,extensions:o.extensions,astNode:o.astNode}});return{name:this.name,description:this.description,fields:i,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(n=this.extensionASTNodes)!==null&&n!==void 0?n:[]}},t.toString=function(){return this.name},t.toJSON=function(){return this.toString()},Wi(e,[{key:gn.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLInputObjectType"}}]),e})();K.GraphQLInputObjectType=Cf;(0,vn.default)(Cf);function x$(e){var t=sc(e.fields);return Qi(t)||(0,Ne.default)(0,"".concat(e.name," fields must be an object with field names as keys or a function which returns such an object.")),(0,ic.default)(t,function(r,n){return!("resolve"in r)||(0,Ne.default)(0,"".concat(e.name,".").concat(n," field has a resolve property, but Input Types cannot define resolvers.")),{name:n,description:r.description,type:r.type,defaultValue:r.defaultValue,deprecationReason:r.deprecationReason,extensions:r.extensions&&(0,Ir.default)(r.extensions),astNode:r.astNode}})}function C$(e){return En(e.type)&&e.defaultValue===void 0}});var Ts=v(bs=>{"use strict";p();Object.defineProperty(bs,"__esModule",{value:!0});bs.isEqualType=Rf;bs.isTypeSubTypeOf=ac;bs.doTypesOverlap=R$;var pt=ce();function Rf(e,t){return e===t?!0:(0,pt.isNonNullType)(e)&&(0,pt.isNonNullType)(t)||(0,pt.isListType)(e)&&(0,pt.isListType)(t)?Rf(e.ofType,t.ofType):!1}function ac(e,t,r){return t===r?!0:(0,pt.isNonNullType)(r)?(0,pt.isNonNullType)(t)?ac(e,t.ofType,r.ofType):!1:(0,pt.isNonNullType)(t)?ac(e,t.ofType,r):(0,pt.isListType)(r)?(0,pt.isListType)(t)?ac(e,t.ofType,r.ofType):!1:(0,pt.isListType)(t)?!1:(0,pt.isAbstractType)(r)&&((0,pt.isInterfaceType)(t)||(0,pt.isObjectType)(t))&&e.isSubType(r,t)}function R$(e,t,r){return t===r?!0:(0,pt.isAbstractType)(t)?(0,pt.isAbstractType)(r)?e.getPossibleTypes(t).some(function(n){return e.isSubType(r,n)}):e.isSubType(t,r):(0,pt.isAbstractType)(r)?e.isSubType(r,t):!1}});var Pf=v(uc=>{"use strict";p();Object.defineProperty(uc,"__esModule",{value:!0});uc.default=void 0;var P$=br(),N$=Array.from||function(e,t,r){if(e==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n=e[P$.SYMBOL_ITERATOR];if(typeof n=="function"){for(var i=n.call(e),o=[],s,a=0;!(s=i.next()).done;++a)if(o.push(t.call(r,s.value,a)),a>9999999)throw new TypeError("Near-infinite iteration.");return o}var u=e.length;if(typeof u=="number"&&u>=0&&u%1===0){for(var c=[],l=0;l<u;++l)Object.prototype.hasOwnProperty.call(e,l)&&c.push(t.call(r,e[l],l));return c}return[]},D$=N$;uc.default=D$});var Nf=v(cc=>{"use strict";p();Object.defineProperty(cc,"__esModule",{value:!0});cc.default=void 0;var L$=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},k$=L$;cc.default=k$});var pc=v(Df=>{"use strict";p();Object.defineProperty(Df,"__esModule",{value:!0});Df.default=M$;var j$=br();function lc(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?lc=function(r){return typeof r}:lc=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},lc(e)}function M$(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(l){return l};if(e==null||lc(e)!=="object")return null;if(Array.isArray(e))return e.map(t);var r=e[j$.SYMBOL_ITERATOR];if(typeof r=="function"){for(var n=r.call(e),i=[],o,s=0;!(o=n.next()).done;++s)i.push(t(o.value,s));return i}var a=e.length;if(typeof a=="number"&&a>=0&&a%1===0){for(var u=[],c=0;c<a;++c){if(!Object.prototype.hasOwnProperty.call(e,c))return null;u.push(t(e[String(c)],c))}return u}return null}});var aI=v(dc=>{"use strict";p();Object.defineProperty(dc,"__esModule",{value:!0});dc.default=void 0;var F$=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e},q$=F$;dc.default=q$});var wr=v(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0});vt.isSpecifiedScalarType=J$;vt.specifiedScalarTypes=vt.GraphQLID=vt.GraphQLBoolean=vt.GraphQLString=vt.GraphQLFloat=vt.GraphQLInt=void 0;var fc=mc(Nf()),hc=mc(aI()),pr=mc(he()),uI=mc(Sr()),Jn=we(),Is=wt(),rt=Q(),ws=ce();function mc(e){return e&&e.__esModule?e:{default:e}}var Lf=2147483647,kf=-2147483648;function U$(e){var t=Os(e);if(typeof t=="boolean")return t?1:0;var r=t;if(typeof t=="string"&&t!==""&&(r=Number(t)),!(0,hc.default)(r))throw new rt.GraphQLError("Int cannot represent non-integer value: ".concat((0,pr.default)(t)));if(r>Lf||r<kf)throw new rt.GraphQLError("Int cannot represent non 32-bit signed integer value: "+(0,pr.default)(t));return r}function V$(e){if(!(0,hc.default)(e))throw new rt.GraphQLError("Int cannot represent non-integer value: ".concat((0,pr.default)(e)));if(e>Lf||e<kf)throw new rt.GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(e));return e}var cI=new ws.GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize:U$,parseValue:V$,parseLiteral:function(t){if(t.kind!==Jn.Kind.INT)throw new rt.GraphQLError("Int cannot represent non-integer value: ".concat((0,Is.print)(t)),t);var r=parseInt(t.value,10);if(r>Lf||r<kf)throw new rt.GraphQLError("Int cannot represent non 32-bit signed integer value: ".concat(t.value),t);return r}});vt.GraphQLInt=cI;function G$(e){var t=Os(e);if(typeof t=="boolean")return t?1:0;var r=t;if(typeof t=="string"&&t!==""&&(r=Number(t)),!(0,fc.default)(r))throw new rt.GraphQLError("Float cannot represent non numeric value: ".concat((0,pr.default)(t)));return r}function $$(e){if(!(0,fc.default)(e))throw new rt.GraphQLError("Float cannot represent non numeric value: ".concat((0,pr.default)(e)));return e}var lI=new ws.GraphQLScalarType({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize:G$,parseValue:$$,parseLiteral:function(t){if(t.kind!==Jn.Kind.FLOAT&&t.kind!==Jn.Kind.INT)throw new rt.GraphQLError("Float cannot represent non numeric value: ".concat((0,Is.print)(t)),t);return parseFloat(t.value)}});vt.GraphQLFloat=lI;function Os(e){if((0,uI.default)(e)){if(typeof e.valueOf=="function"){var t=e.valueOf();if(!(0,uI.default)(t))return t}if(typeof e.toJSON=="function")return e.toJSON()}return e}function B$(e){var t=Os(e);if(typeof t=="string")return t;if(typeof t=="boolean")return t?"true":"false";if((0,fc.default)(t))return t.toString();throw new rt.GraphQLError("String cannot represent value: ".concat((0,pr.default)(e)))}function H$(e){if(typeof e!="string")throw new rt.GraphQLError("String cannot represent a non string value: ".concat((0,pr.default)(e)));return e}var pI=new ws.GraphQLScalarType({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize:B$,parseValue:H$,parseLiteral:function(t){if(t.kind!==Jn.Kind.STRING)throw new rt.GraphQLError("String cannot represent a non string value: ".concat((0,Is.print)(t)),t);return t.value}});vt.GraphQLString=pI;function K$(e){var t=Os(e);if(typeof t=="boolean")return t;if((0,fc.default)(t))return t!==0;throw new rt.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0,pr.default)(t)))}function Q$(e){if(typeof e!="boolean")throw new rt.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0,pr.default)(e)));return e}var dI=new ws.GraphQLScalarType({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize:K$,parseValue:Q$,parseLiteral:function(t){if(t.kind!==Jn.Kind.BOOLEAN)throw new rt.GraphQLError("Boolean cannot represent a non boolean value: ".concat((0,Is.print)(t)),t);return t.value}});vt.GraphQLBoolean=dI;function W$(e){var t=Os(e);if(typeof t=="string")return t;if((0,hc.default)(t))return String(t);throw new rt.GraphQLError("ID cannot represent value: ".concat((0,pr.default)(e)))}function z$(e){if(typeof e=="string")return e;if((0,hc.default)(e))return e.toString();throw new rt.GraphQLError("ID cannot represent value: ".concat((0,pr.default)(e)))}var fI=new ws.GraphQLScalarType({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize:W$,parseValue:z$,parseLiteral:function(t){if(t.kind!==Jn.Kind.STRING&&t.kind!==Jn.Kind.INT)throw new rt.GraphQLError("ID cannot represent a non-string and non-integer value: "+(0,Is.print)(t),t);return t.value}});vt.GraphQLID=fI;var hI=Object.freeze([pI,cI,lI,dI,fI]);vt.specifiedScalarTypes=hI;function J$(e){return hI.some(function(t){var r=t.name;return e.name===r})}});var Cs=v(jf=>{"use strict";p();Object.defineProperty(jf,"__esModule",{value:!0});jf.astFromValue=xs;var Y$=Yi(Nf()),X$=Yi(Lt()),mI=Yi(he()),Z$=Yi(ut()),e1=Yi(Sr()),t1=Yi(pc()),Xt=we(),r1=wr(),As=ce();function Yi(e){return e&&e.__esModule?e:{default:e}}function xs(e,t){if((0,As.isNonNullType)(t)){var r=xs(e,t.ofType);return r?.kind===Xt.Kind.NULL?null:r}if(e===null)return{kind:Xt.Kind.NULL};if(e===void 0)return null;if((0,As.isListType)(t)){var n=t.ofType,i=(0,t1.default)(e);if(i!=null){for(var o=[],s=0;s<i.length;s++){var a=i[s],u=xs(a,n);u!=null&&o.push(u)}return{kind:Xt.Kind.LIST,values:o}}return xs(e,n)}if((0,As.isInputObjectType)(t)){if(!(0,e1.default)(e))return null;for(var c=[],l=0,d=(0,X$.default)(t.getFields());l<d.length;l++){var f=d[l],h=xs(e[f.name],f.type);h&&c.push({kind:Xt.Kind.OBJECT_FIELD,name:{kind:Xt.Kind.NAME,value:f.name},value:h})}return{kind:Xt.Kind.OBJECT,fields:c}}if((0,As.isLeafType)(t)){var g=t.serialize(e);if(g==null)return null;if(typeof g=="boolean")return{kind:Xt.Kind.BOOLEAN,value:g};if(typeof g=="number"&&(0,Y$.default)(g)){var y=String(g);return gI.test(y)?{kind:Xt.Kind.INT,value:y}:{kind:Xt.Kind.FLOAT,value:y}}if(typeof g=="string")return(0,As.isEnumType)(t)?{kind:Xt.Kind.ENUM,value:g}:t===r1.GraphQLID&&gI.test(g)?{kind:Xt.Kind.INT,value:g}:{kind:Xt.Kind.STRING,value:g};throw new TypeError("Cannot convert value to AST: ".concat((0,mI.default)(g),"."))}(0,Z$.default)(0,"Unexpected input type: "+(0,mI.default)(t))}var gI=/^-?(?:0|[1-9][0-9]*)$/});var er=v(Te=>{"use strict";p();Object.defineProperty(Te,"__esModule",{value:!0});Te.isIntrospectionType=l1;Te.introspectionTypes=Te.TypeNameMetaFieldDef=Te.TypeMetaFieldDef=Te.SchemaMetaFieldDef=Te.__TypeKind=Te.TypeKind=Te.__EnumValue=Te.__InputValue=Te.__Field=Te.__Type=Te.__DirectiveLocation=Te.__Directive=Te.__Schema=void 0;var Mf=Ff(Lt()),n1=Ff(he()),i1=Ff(ut()),o1=wt(),Ye=Vi(),s1=Cs(),Oe=wr(),V=ce();function Ff(e){return e&&e.__esModule?e:{default:e}}var qf=new V.GraphQLObjectType({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:function(){return{description:{type:Oe.GraphQLString,resolve:function(r){return r.description}},types:{description:"A list of all types supported by this server.",type:new V.GraphQLNonNull(new V.GraphQLList(new V.GraphQLNonNull(Zt))),resolve:function(r){return(0,Mf.default)(r.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new V.GraphQLNonNull(Zt),resolve:function(r){return r.getQueryType()}},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Zt,resolve:function(r){return r.getMutationType()}},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Zt,resolve:function(r){return r.getSubscriptionType()}},directives:{description:"A list of all directives supported by this server.",type:new V.GraphQLNonNull(new V.GraphQLList(new V.GraphQLNonNull(Uf))),resolve:function(r){return r.getDirectives()}}}}});Te.__Schema=qf;var Uf=new V.GraphQLObjectType({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
72
+
73
+ In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:function(){return{name:{type:new V.GraphQLNonNull(Oe.GraphQLString),resolve:function(r){return r.name}},description:{type:Oe.GraphQLString,resolve:function(r){return r.description}},isRepeatable:{type:new V.GraphQLNonNull(Oe.GraphQLBoolean),resolve:function(r){return r.isRepeatable}},locations:{type:new V.GraphQLNonNull(new V.GraphQLList(new V.GraphQLNonNull(Vf))),resolve:function(r){return r.locations}},args:{type:new V.GraphQLNonNull(new V.GraphQLList(new V.GraphQLNonNull(Rs))),args:{includeDeprecated:{type:Oe.GraphQLBoolean,defaultValue:!1}},resolve:function(r,n){var i=n.includeDeprecated;return i?r.args:r.args.filter(function(o){return o.deprecationReason==null})}}}}});Te.__Directive=Uf;var Vf=new V.GraphQLEnumType({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:Ye.DirectiveLocation.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:Ye.DirectiveLocation.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:Ye.DirectiveLocation.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:Ye.DirectiveLocation.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:Ye.DirectiveLocation.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:Ye.DirectiveLocation.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:Ye.DirectiveLocation.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:Ye.DirectiveLocation.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:Ye.DirectiveLocation.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:Ye.DirectiveLocation.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:Ye.DirectiveLocation.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:Ye.DirectiveLocation.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:Ye.DirectiveLocation.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:Ye.DirectiveLocation.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:Ye.DirectiveLocation.UNION,description:"Location adjacent to a union definition."},ENUM:{value:Ye.DirectiveLocation.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:Ye.DirectiveLocation.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:Ye.DirectiveLocation.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:Ye.DirectiveLocation.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}});Te.__DirectiveLocation=Vf;var Zt=new V.GraphQLObjectType({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:function(){return{kind:{type:new V.GraphQLNonNull(Bf),resolve:function(r){if((0,V.isScalarType)(r))return ct.SCALAR;if((0,V.isObjectType)(r))return ct.OBJECT;if((0,V.isInterfaceType)(r))return ct.INTERFACE;if((0,V.isUnionType)(r))return ct.UNION;if((0,V.isEnumType)(r))return ct.ENUM;if((0,V.isInputObjectType)(r))return ct.INPUT_OBJECT;if((0,V.isListType)(r))return ct.LIST;if((0,V.isNonNullType)(r))return ct.NON_NULL;(0,i1.default)(0,'Unexpected type: "'.concat((0,n1.default)(r),'".'))}},name:{type:Oe.GraphQLString,resolve:function(r){return r.name!==void 0?r.name:void 0}},description:{type:Oe.GraphQLString,resolve:function(r){return r.description!==void 0?r.description:void 0}},specifiedByUrl:{type:Oe.GraphQLString,resolve:function(r){return r.specifiedByUrl!==void 0?r.specifiedByUrl:void 0}},fields:{type:new V.GraphQLList(new V.GraphQLNonNull(Gf)),args:{includeDeprecated:{type:Oe.GraphQLBoolean,defaultValue:!1}},resolve:function(r,n){var i=n.includeDeprecated;if((0,V.isObjectType)(r)||(0,V.isInterfaceType)(r)){var o=(0,Mf.default)(r.getFields());return i?o:o.filter(function(s){return s.deprecationReason==null})}}},interfaces:{type:new V.GraphQLList(new V.GraphQLNonNull(Zt)),resolve:function(r){if((0,V.isObjectType)(r)||(0,V.isInterfaceType)(r))return r.getInterfaces()}},possibleTypes:{type:new V.GraphQLList(new V.GraphQLNonNull(Zt)),resolve:function(r,n,i,o){var s=o.schema;if((0,V.isAbstractType)(r))return s.getPossibleTypes(r)}},enumValues:{type:new V.GraphQLList(new V.GraphQLNonNull($f)),args:{includeDeprecated:{type:Oe.GraphQLBoolean,defaultValue:!1}},resolve:function(r,n){var i=n.includeDeprecated;if((0,V.isEnumType)(r)){var o=r.getValues();return i?o:o.filter(function(s){return s.deprecationReason==null})}}},inputFields:{type:new V.GraphQLList(new V.GraphQLNonNull(Rs)),args:{includeDeprecated:{type:Oe.GraphQLBoolean,defaultValue:!1}},resolve:function(r,n){var i=n.includeDeprecated;if((0,V.isInputObjectType)(r)){var o=(0,Mf.default)(r.getFields());return i?o:o.filter(function(s){return s.deprecationReason==null})}}},ofType:{type:Zt,resolve:function(r){return r.ofType!==void 0?r.ofType:void 0}}}}});Te.__Type=Zt;var Gf=new V.GraphQLObjectType({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:function(){return{name:{type:new V.GraphQLNonNull(Oe.GraphQLString),resolve:function(r){return r.name}},description:{type:Oe.GraphQLString,resolve:function(r){return r.description}},args:{type:new V.GraphQLNonNull(new V.GraphQLList(new V.GraphQLNonNull(Rs))),args:{includeDeprecated:{type:Oe.GraphQLBoolean,defaultValue:!1}},resolve:function(r,n){var i=n.includeDeprecated;return i?r.args:r.args.filter(function(o){return o.deprecationReason==null})}},type:{type:new V.GraphQLNonNull(Zt),resolve:function(r){return r.type}},isDeprecated:{type:new V.GraphQLNonNull(Oe.GraphQLBoolean),resolve:function(r){return r.deprecationReason!=null}},deprecationReason:{type:Oe.GraphQLString,resolve:function(r){return r.deprecationReason}}}}});Te.__Field=Gf;var Rs=new V.GraphQLObjectType({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:function(){return{name:{type:new V.GraphQLNonNull(Oe.GraphQLString),resolve:function(r){return r.name}},description:{type:Oe.GraphQLString,resolve:function(r){return r.description}},type:{type:new V.GraphQLNonNull(Zt),resolve:function(r){return r.type}},defaultValue:{type:Oe.GraphQLString,description:"A GraphQL-formatted string representing the default value for this input value.",resolve:function(r){var n=r.type,i=r.defaultValue,o=(0,s1.astFromValue)(i,n);return o?(0,o1.print)(o):null}},isDeprecated:{type:new V.GraphQLNonNull(Oe.GraphQLBoolean),resolve:function(r){return r.deprecationReason!=null}},deprecationReason:{type:Oe.GraphQLString,resolve:function(r){return r.deprecationReason}}}}});Te.__InputValue=Rs;var $f=new V.GraphQLObjectType({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:function(){return{name:{type:new V.GraphQLNonNull(Oe.GraphQLString),resolve:function(r){return r.name}},description:{type:Oe.GraphQLString,resolve:function(r){return r.description}},isDeprecated:{type:new V.GraphQLNonNull(Oe.GraphQLBoolean),resolve:function(r){return r.deprecationReason!=null}},deprecationReason:{type:Oe.GraphQLString,resolve:function(r){return r.deprecationReason}}}}});Te.__EnumValue=$f;var ct=Object.freeze({SCALAR:"SCALAR",OBJECT:"OBJECT",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",INPUT_OBJECT:"INPUT_OBJECT",LIST:"LIST",NON_NULL:"NON_NULL"});Te.TypeKind=ct;var Bf=new V.GraphQLEnumType({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:ct.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:ct.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:ct.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:ct.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:ct.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:ct.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:ct.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:ct.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}});Te.__TypeKind=Bf;var a1={name:"__schema",type:new V.GraphQLNonNull(qf),description:"Access the current type schema of this server.",args:[],resolve:function(t,r,n,i){var o=i.schema;return o},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0};Te.SchemaMetaFieldDef=a1;var u1={name:"__type",type:Zt,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new V.GraphQLNonNull(Oe.GraphQLString),defaultValue:void 0,deprecationReason:void 0,extensions:void 0,astNode:void 0}],resolve:function(t,r,n,i){var o=r.name,s=i.schema;return s.getType(o)},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0};Te.TypeMetaFieldDef=u1;var c1={name:"__typename",type:new V.GraphQLNonNull(Oe.GraphQLString),description:"The name of the current Object type at runtime.",args:[],resolve:function(t,r,n,i){var o=i.parentType;return o.name},isDeprecated:!1,deprecationReason:void 0,extensions:void 0,astNode:void 0};Te.TypeNameMetaFieldDef=c1;var yI=Object.freeze([qf,Uf,Vf,Zt,Gf,Rs,$f,Bf]);Te.introspectionTypes=yI;function l1(e){return yI.some(function(t){var r=t.name;return e.name===r})}});var Ot=v(Xe=>{"use strict";p();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.isDirective=_I;Xe.assertDirective=v1;Xe.isSpecifiedDirective=E1;Xe.specifiedDirectives=Xe.GraphQLSpecifiedByDirective=Xe.GraphQLDeprecatedDirective=Xe.DEFAULT_DEPRECATION_REASON=Xe.GraphQLSkipDirective=Xe.GraphQLIncludeDirective=Xe.GraphQLDirective=void 0;var p1=Yn(Ki()),d1=br(),f1=Yn(he()),vI=Yn(ec()),Hf=Yn(Yt()),h1=Yn(ds()),m1=Yn(Sr()),g1=Yn(Fu()),dr=Vi(),gc=wr(),yc=ce();function Yn(e){return e&&e.__esModule?e:{default:e}}function EI(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y1(e,t,r){return t&&EI(e.prototype,t),r&&EI(e,r),e}function _I(e){return(0,h1.default)(e,Xn)}function v1(e){if(!_I(e))throw new Error("Expected ".concat((0,f1.default)(e)," to be a GraphQL directive."));return e}var Xn=(function(){function e(r){var n,i;this.name=r.name,this.description=r.description,this.locations=r.locations,this.isRepeatable=(n=r.isRepeatable)!==null&&n!==void 0?n:!1,this.extensions=r.extensions&&(0,vI.default)(r.extensions),this.astNode=r.astNode,r.name||(0,Hf.default)(0,"Directive must be named."),Array.isArray(r.locations)||(0,Hf.default)(0,"@".concat(r.name," locations must be an Array."));var o=(i=r.args)!==null&&i!==void 0?i:{};(0,m1.default)(o)&&!Array.isArray(o)||(0,Hf.default)(0,"@".concat(r.name," args must be an object with argument names as keys.")),this.args=(0,p1.default)(o).map(function(s){var a=s[0],u=s[1];return{name:a,description:u.description,type:u.type,defaultValue:u.defaultValue,deprecationReason:u.deprecationReason,extensions:u.extensions&&(0,vI.default)(u.extensions),astNode:u.astNode}})}var t=e.prototype;return t.toConfig=function(){return{name:this.name,description:this.description,locations:this.locations,args:(0,yc.argsToArgsConfig)(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}},t.toString=function(){return"@"+this.name},t.toJSON=function(){return this.toString()},y1(e,[{key:d1.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLDirective"}}]),e})();Xe.GraphQLDirective=Xn;(0,g1.default)(Xn);var SI=new Xn({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[dr.DirectiveLocation.FIELD,dr.DirectiveLocation.FRAGMENT_SPREAD,dr.DirectiveLocation.INLINE_FRAGMENT],args:{if:{type:new yc.GraphQLNonNull(gc.GraphQLBoolean),description:"Included when true."}}});Xe.GraphQLIncludeDirective=SI;var bI=new Xn({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[dr.DirectiveLocation.FIELD,dr.DirectiveLocation.FRAGMENT_SPREAD,dr.DirectiveLocation.INLINE_FRAGMENT],args:{if:{type:new yc.GraphQLNonNull(gc.GraphQLBoolean),description:"Skipped when true."}}});Xe.GraphQLSkipDirective=bI;var TI="No longer supported";Xe.DEFAULT_DEPRECATION_REASON=TI;var II=new Xn({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[dr.DirectiveLocation.FIELD_DEFINITION,dr.DirectiveLocation.ARGUMENT_DEFINITION,dr.DirectiveLocation.INPUT_FIELD_DEFINITION,dr.DirectiveLocation.ENUM_VALUE],args:{reason:{type:gc.GraphQLString,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:TI}}});Xe.GraphQLDeprecatedDirective=II;var wI=new Xn({name:"specifiedBy",description:"Exposes a URL that specifies the behaviour of this scalar.",locations:[dr.DirectiveLocation.SCALAR],args:{url:{type:new yc.GraphQLNonNull(gc.GraphQLString),description:"The URL that specifies the behaviour of this scalar."}}});Xe.GraphQLSpecifiedByDirective=wI;var OI=Object.freeze([SI,bI,II,wI]);Xe.specifiedDirectives=OI;function E1(e){return OI.some(function(t){var r=t.name;return r===e.name})}});var Zn=v(Xi=>{"use strict";p();Object.defineProperty(Xi,"__esModule",{value:!0});Xi.isSchema=CI;Xi.assertSchema=x1;Xi.GraphQLSchema=void 0;var _1=_n(Hi()),S1=_n(Pf()),Kf=_n(Lt()),b1=br(),Qf=_n(he()),T1=_n(ec()),vc=_n(Yt()),I1=_n(ds()),w1=_n(Sr()),O1=er(),AI=Ot(),fr=ce();function _n(e){return e&&e.__esModule?e:{default:e}}function xI(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A1(e,t,r){return t&&xI(e.prototype,t),r&&xI(e,r),e}function CI(e){return(0,I1.default)(e,RI)}function x1(e){if(!CI(e))throw new Error("Expected ".concat((0,Qf.default)(e)," to be a GraphQL schema."));return e}var RI=(function(){function e(r){var n;this.__validationErrors=r.assumeValid===!0?[]:void 0,(0,w1.default)(r)||(0,vc.default)(0,"Must provide configuration object."),!r.types||Array.isArray(r.types)||(0,vc.default)(0,'"types" must be Array if provided but got: '.concat((0,Qf.default)(r.types),".")),!r.directives||Array.isArray(r.directives)||(0,vc.default)(0,'"directives" must be Array if provided but got: '+"".concat((0,Qf.default)(r.directives),".")),this.description=r.description,this.extensions=r.extensions&&(0,T1.default)(r.extensions),this.astNode=r.astNode,this.extensionASTNodes=r.extensionASTNodes,this._queryType=r.query,this._mutationType=r.mutation,this._subscriptionType=r.subscription,this._directives=(n=r.directives)!==null&&n!==void 0?n:AI.specifiedDirectives;var i=new Set(r.types);if(r.types!=null)for(var o=0,s=r.types;o<s.length;o++){var a=s[o];i.delete(a),hr(a,i)}this._queryType!=null&&hr(this._queryType,i),this._mutationType!=null&&hr(this._mutationType,i),this._subscriptionType!=null&&hr(this._subscriptionType,i);for(var u=0,c=this._directives;u<c.length;u++){var l=c[u];if((0,AI.isDirective)(l))for(var d=0,f=l.args;d<f.length;d++){var h=f[d];hr(h.type,i)}}hr(O1.__Schema,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(var g=0,y=(0,S1.default)(i);g<y.length;g++){var _=y[g];if(_!=null){var b=_.name;if(b||(0,vc.default)(0,"One of the provided types for building the Schema is missing a name."),this._typeMap[b]!==void 0)throw new Error('Schema must contain uniquely named types but contains multiple types named "'.concat(b,'".'));if(this._typeMap[b]=_,(0,fr.isInterfaceType)(_))for(var S=0,I=_.getInterfaces();S<I.length;S++){var O=I[S];if((0,fr.isInterfaceType)(O)){var T=this._implementationsMap[O.name];T===void 0&&(T=this._implementationsMap[O.name]={objects:[],interfaces:[]}),T.interfaces.push(_)}}else if((0,fr.isObjectType)(_))for(var C=0,L=_.getInterfaces();C<L.length;C++){var w=L[C];if((0,fr.isInterfaceType)(w)){var W=this._implementationsMap[w.name];W===void 0&&(W=this._implementationsMap[w.name]={objects:[],interfaces:[]}),W.objects.push(_)}}}}}var t=e.prototype;return t.getQueryType=function(){return this._queryType},t.getMutationType=function(){return this._mutationType},t.getSubscriptionType=function(){return this._subscriptionType},t.getTypeMap=function(){return this._typeMap},t.getType=function(n){return this.getTypeMap()[n]},t.getPossibleTypes=function(n){return(0,fr.isUnionType)(n)?n.getTypes():this.getImplementations(n).objects},t.getImplementations=function(n){var i=this._implementationsMap[n.name];return i??{objects:[],interfaces:[]}},t.isPossibleType=function(n,i){return this.isSubType(n,i)},t.isSubType=function(n,i){var o=this._subTypeMap[n.name];if(o===void 0){if(o=Object.create(null),(0,fr.isUnionType)(n))for(var s=0,a=n.getTypes();s<a.length;s++){var u=a[s];o[u.name]=!0}else{for(var c=this.getImplementations(n),l=0,d=c.objects;l<d.length;l++){var f=d[l];o[f.name]=!0}for(var h=0,g=c.interfaces;h<g.length;h++){var y=g[h];o[y.name]=!0}}this._subTypeMap[n.name]=o}return o[i.name]!==void 0},t.getDirectives=function(){return this._directives},t.getDirective=function(n){return(0,_1.default)(this.getDirectives(),function(i){return i.name===n})},t.toConfig=function(){var n;return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:(0,Kf.default)(this.getTypeMap()),directives:this.getDirectives().slice(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:(n=this.extensionASTNodes)!==null&&n!==void 0?n:[],assumeValid:this.__validationErrors!==void 0}},A1(e,[{key:b1.SYMBOL_TO_STRING_TAG,get:function(){return"GraphQLSchema"}}]),e})();Xi.GraphQLSchema=RI;function hr(e,t){var r=(0,fr.getNamedType)(e);if(!t.has(r)){if(t.add(r),(0,fr.isUnionType)(r))for(var n=0,i=r.getTypes();n<i.length;n++){var o=i[n];hr(o,t)}else if((0,fr.isObjectType)(r)||(0,fr.isInterfaceType)(r)){for(var s=0,a=r.getInterfaces();s<a.length;s++){var u=a[s];hr(u,t)}for(var c=0,l=(0,Kf.default)(r.getFields());c<l.length;c++){var d=l[c];hr(d.type,t);for(var f=0,h=d.args;f<h.length;f++){var g=h[f];hr(g.type,t)}}}else if((0,fr.isInputObjectType)(r))for(var y=0,_=(0,Kf.default)(r.getFields());y<_.length;y++){var b=_[y];hr(b.type,t)}}return t}});var Ds=v(Ec=>{"use strict";p();Object.defineProperty(Ec,"__esModule",{value:!0});Ec.validateSchema=MI;Ec.assertValidSchema=L1;var PI=zf(Hi()),Ns=zf(Lt()),dt=zf(he()),C1=Q(),R1=gs(),P1=of(),NI=Ts(),N1=Zn(),D1=er(),jI=Ot(),Be=ce();function zf(e){return e&&e.__esModule?e:{default:e}}function MI(e){if((0,N1.assertSchema)(e),e.__validationErrors)return e.__validationErrors;var t=new k1(e);j1(t),M1(t),F1(t);var r=t.getErrors();return e.__validationErrors=r,r}function L1(e){var t=MI(e);if(t.length!==0)throw new Error(t.map(function(r){return r.message}).join(`
74
+
75
+ `))}var k1=(function(){function e(r){this._errors=[],this.schema=r}var t=e.prototype;return t.reportError=function(n,i){var o=Array.isArray(i)?i.filter(Boolean):i;this.addError(new C1.GraphQLError(n,o))},t.addError=function(n){this._errors.push(n)},t.getErrors=function(){return this._errors},e})();function j1(e){var t=e.schema,r=t.getQueryType();if(!r)e.reportError("Query root type must be provided.",t.astNode);else if(!(0,Be.isObjectType)(r)){var n;e.reportError("Query root type must be Object type, it cannot be ".concat((0,dt.default)(r),"."),(n=Wf(t,"query"))!==null&&n!==void 0?n:r.astNode)}var i=t.getMutationType();if(i&&!(0,Be.isObjectType)(i)){var o;e.reportError("Mutation root type must be Object type if provided, it cannot be "+"".concat((0,dt.default)(i),"."),(o=Wf(t,"mutation"))!==null&&o!==void 0?o:i.astNode)}var s=t.getSubscriptionType();if(s&&!(0,Be.isObjectType)(s)){var a;e.reportError("Subscription root type must be Object type if provided, it cannot be "+"".concat((0,dt.default)(s),"."),(a=Wf(t,"subscription"))!==null&&a!==void 0?a:s.astNode)}}function Wf(e,t){for(var r=Jf(e,function(o){return o.operationTypes}),n=0;n<r.length;n++){var i=r[n];if(i.operation===t)return i.type}}function M1(e){for(var t=0,r=e.schema.getDirectives();t<r.length;t++){var n=r[t];if(!(0,jI.isDirective)(n)){e.reportError("Expected directive but got: ".concat((0,dt.default)(n),"."),n?.astNode);continue}ei(e,n);for(var i=0,o=n.args;i<o.length;i++){var s=o[i];if(ei(e,s),(0,Be.isInputType)(s.type)||e.reportError("The type of @".concat(n.name,"(").concat(s.name,":) must be Input Type ")+"but got: ".concat((0,dt.default)(s.type),"."),s.astNode),(0,Be.isRequiredArgument)(s)&&s.deprecationReason!=null){var a;e.reportError("Required argument @".concat(n.name,"(").concat(s.name,":) cannot be deprecated."),[Yf(s.astNode),(a=s.astNode)===null||a===void 0?void 0:a.type])}}}}function ei(e,t){var r=(0,P1.isValidNameError)(t.name);r&&e.addError((0,R1.locatedError)(r,t.astNode))}function F1(e){for(var t=B1(e),r=e.schema.getTypeMap(),n=0,i=(0,Ns.default)(r);n<i.length;n++){var o=i[n];if(!(0,Be.isNamedType)(o)){e.reportError("Expected GraphQL named type but got: ".concat((0,dt.default)(o),"."),o.astNode);continue}(0,D1.isIntrospectionType)(o)||ei(e,o),(0,Be.isObjectType)(o)||(0,Be.isInterfaceType)(o)?(DI(e,o),LI(e,o)):(0,Be.isUnionType)(o)?V1(e,o):(0,Be.isEnumType)(o)?G1(e,o):(0,Be.isInputObjectType)(o)&&($1(e,o),t(o))}}function DI(e,t){var r=(0,Ns.default)(t.getFields());r.length===0&&e.reportError("Type ".concat(t.name," must define one or more fields."),Zi(t));for(var n=0;n<r.length;n++){var i=r[n];if(ei(e,i),!(0,Be.isOutputType)(i.type)){var o;e.reportError("The type of ".concat(t.name,".").concat(i.name," must be Output Type ")+"but got: ".concat((0,dt.default)(i.type),"."),(o=i.astNode)===null||o===void 0?void 0:o.type)}for(var s=0,a=i.args;s<a.length;s++){var u=a[s],c=u.name;if(ei(e,u),!(0,Be.isInputType)(u.type)){var l;e.reportError("The type of ".concat(t.name,".").concat(i.name,"(").concat(c,":) must be Input ")+"Type but got: ".concat((0,dt.default)(u.type),"."),(l=u.astNode)===null||l===void 0?void 0:l.type)}if((0,Be.isRequiredArgument)(u)&&u.deprecationReason!=null){var d;e.reportError("Required argument ".concat(t.name,".").concat(i.name,"(").concat(c,":) cannot be deprecated."),[Yf(u.astNode),(d=u.astNode)===null||d===void 0?void 0:d.type])}}}}function LI(e,t){for(var r=Object.create(null),n=0,i=t.getInterfaces();n<i.length;n++){var o=i[n];if(!(0,Be.isInterfaceType)(o)){e.reportError("Type ".concat((0,dt.default)(t)," must only implement Interface types, ")+"it cannot implement ".concat((0,dt.default)(o),"."),Ps(t,o));continue}if(t===o){e.reportError("Type ".concat(t.name," cannot implement itself because it would create a circular reference."),Ps(t,o));continue}if(r[o.name]){e.reportError("Type ".concat(t.name," can only implement ").concat(o.name," once."),Ps(t,o));continue}r[o.name]=!0,U1(e,t,o),q1(e,t,o)}}function q1(e,t,r){for(var n=t.getFields(),i=0,o=(0,Ns.default)(r.getFields());i<o.length;i++){var s=o[i],a=s.name,u=n[a];if(!u){e.reportError("Interface field ".concat(r.name,".").concat(a," expected but ").concat(t.name," does not provide it."),[s.astNode].concat(Zi(t)));continue}if(!(0,NI.isTypeSubTypeOf)(e.schema,u.type,s.type)){var c,l;e.reportError("Interface field ".concat(r.name,".").concat(a," expects type ")+"".concat((0,dt.default)(s.type)," but ").concat(t.name,".").concat(a," ")+"is type ".concat((0,dt.default)(u.type),"."),[(c=s.astNode)===null||c===void 0?void 0:c.type,(l=u.astNode)===null||l===void 0?void 0:l.type])}for(var d=function(I,O){var T=O[I],C=T.name,L=(0,PI.default)(u.args,function(ae){return ae.name===C});if(!L)return e.reportError("Interface field argument ".concat(r.name,".").concat(a,"(").concat(C,":) expected but ").concat(t.name,".").concat(a," does not provide it."),[T.astNode,u.astNode]),"continue";if(!(0,NI.isEqualType)(T.type,L.type)){var w,W;e.reportError("Interface field argument ".concat(r.name,".").concat(a,"(").concat(C,":) ")+"expects type ".concat((0,dt.default)(T.type)," but ")+"".concat(t.name,".").concat(a,"(").concat(C,":) is type ")+"".concat((0,dt.default)(L.type),"."),[(w=T.astNode)===null||w===void 0?void 0:w.type,(W=L.astNode)===null||W===void 0?void 0:W.type])}},f=0,h=s.args;f<h.length;f++)var g=d(f,h);for(var y=function(I,O){var T=O[I],C=T.name,L=(0,PI.default)(s.args,function(w){return w.name===C});!L&&(0,Be.isRequiredArgument)(T)&&e.reportError("Object field ".concat(t.name,".").concat(a," includes required argument ").concat(C," that is missing from the Interface field ").concat(r.name,".").concat(a,"."),[T.astNode,s.astNode])},_=0,b=u.args;_<b.length;_++)y(_,b)}}function U1(e,t,r){for(var n=t.getInterfaces(),i=0,o=r.getInterfaces();i<o.length;i++){var s=o[i];n.indexOf(s)===-1&&e.reportError(s===t?"Type ".concat(t.name," cannot implement ").concat(r.name," because it would create a circular reference."):"Type ".concat(t.name," must implement ").concat(s.name," because it is implemented by ").concat(r.name,"."),[].concat(Ps(r,s),Ps(t,r)))}}function V1(e,t){var r=t.getTypes();r.length===0&&e.reportError("Union type ".concat(t.name," must define one or more member types."),Zi(t));for(var n=Object.create(null),i=0;i<r.length;i++){var o=r[i];if(n[o.name]){e.reportError("Union type ".concat(t.name," can only include type ").concat(o.name," once."),kI(t,o.name));continue}n[o.name]=!0,(0,Be.isObjectType)(o)||e.reportError("Union type ".concat(t.name," can only include Object types, ")+"it cannot include ".concat((0,dt.default)(o),"."),kI(t,String(o)))}}function G1(e,t){var r=t.getValues();r.length===0&&e.reportError("Enum type ".concat(t.name," must define one or more values."),Zi(t));for(var n=0;n<r.length;n++){var i=r[n],o=i.name;ei(e,i),(o==="true"||o==="false"||o==="null")&&e.reportError("Enum type ".concat(t.name," cannot include value: ").concat(o,"."),i.astNode)}}function $1(e,t){var r=(0,Ns.default)(t.getFields());r.length===0&&e.reportError("Input Object type ".concat(t.name," must define one or more fields."),Zi(t));for(var n=0;n<r.length;n++){var i=r[n];if(ei(e,i),!(0,Be.isInputType)(i.type)){var o;e.reportError("The type of ".concat(t.name,".").concat(i.name," must be Input Type ")+"but got: ".concat((0,dt.default)(i.type),"."),(o=i.astNode)===null||o===void 0?void 0:o.type)}if((0,Be.isRequiredInputField)(i)&&i.deprecationReason!=null){var s;e.reportError("Required input field ".concat(t.name,".").concat(i.name," cannot be deprecated."),[Yf(i.astNode),(s=i.astNode)===null||s===void 0?void 0:s.type])}}}function B1(e){var t=Object.create(null),r=[],n=Object.create(null);return i;function i(o){if(!t[o.name]){t[o.name]=!0,n[o.name]=r.length;for(var s=(0,Ns.default)(o.getFields()),a=0;a<s.length;a++){var u=s[a];if((0,Be.isNonNullType)(u.type)&&(0,Be.isInputObjectType)(u.type.ofType)){var c=u.type.ofType,l=n[c.name];if(r.push(u),l===void 0)i(c);else{var d=r.slice(l),f=d.map(function(h){return h.name}).join(".");e.reportError('Cannot reference Input Object "'.concat(c.name,'" within itself through a series of non-null fields: "').concat(f,'".'),d.map(function(h){return h.astNode}))}r.pop()}}n[o.name]=void 0}}}function Zi(e){var t=e.astNode,r=e.extensionASTNodes;return t?r?[t].concat(r):[t]:r??[]}function Jf(e,t){for(var r=[],n=0,i=Zi(e);n<i.length;n++){var o,s=i[n];r=r.concat((o=t(s))!==null&&o!==void 0?o:[])}return r}function Ps(e,t){return Jf(e,function(r){return r.interfaces}).filter(function(r){return r.name.value===t.name})}function kI(e,t){return Jf(e,function(r){return r.types}).filter(function(r){return r.name.value===t})}function Yf(e){var t;return e==null||(t=e.directives)===null||t===void 0?void 0:t.find(function(r){return r.name.value===jI.GraphQLDeprecatedDirective.name})}});var Or=v(eh=>{"use strict";p();Object.defineProperty(eh,"__esModule",{value:!0});eh.typeFromAST=Zf;var H1=qI(he()),K1=qI(ut()),Xf=we(),FI=ce();function qI(e){return e&&e.__esModule?e:{default:e}}function Zf(e,t){var r;if(t.kind===Xf.Kind.LIST_TYPE)return r=Zf(e,t.type),r&&new FI.GraphQLList(r);if(t.kind===Xf.Kind.NON_NULL_TYPE)return r=Zf(e,t.type),r&&new FI.GraphQLNonNull(r);if(t.kind===Xf.Kind.NAMED_TYPE)return e.getType(t.name.value);(0,K1.default)(0,"Unexpected type node: "+(0,H1.default)(t))}});var _c=v(Ls=>{"use strict";p();Object.defineProperty(Ls,"__esModule",{value:!0});Ls.visitWithTypeInfo=X1;Ls.TypeInfo=void 0;var Q1=z1(Hi()),Ue=we(),W1=qi(),UI=ln(),Ve=ce(),eo=er(),VI=Or();function z1(e){return e&&e.__esModule?e:{default:e}}var J1=(function(){function e(r,n,i){this._schema=r,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=n??Y1,i&&((0,Ve.isInputType)(i)&&this._inputTypeStack.push(i),(0,Ve.isCompositeType)(i)&&this._parentTypeStack.push(i),(0,Ve.isOutputType)(i)&&this._typeStack.push(i))}var t=e.prototype;return t.getType=function(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]},t.getParentType=function(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]},t.getInputType=function(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]},t.getParentInputType=function(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]},t.getFieldDef=function(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]},t.getDefaultValue=function(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]},t.getDirective=function(){return this._directive},t.getArgument=function(){return this._argument},t.getEnumValue=function(){return this._enumValue},t.enter=function(n){var i=this._schema;switch(n.kind){case Ue.Kind.SELECTION_SET:{var o=(0,Ve.getNamedType)(this.getType());this._parentTypeStack.push((0,Ve.isCompositeType)(o)?o:void 0);break}case Ue.Kind.FIELD:{var s=this.getParentType(),a,u;s&&(a=this._getFieldDef(i,s,n),a&&(u=a.type)),this._fieldDefStack.push(a),this._typeStack.push((0,Ve.isOutputType)(u)?u:void 0);break}case Ue.Kind.DIRECTIVE:this._directive=i.getDirective(n.name.value);break;case Ue.Kind.OPERATION_DEFINITION:{var c;switch(n.operation){case"query":c=i.getQueryType();break;case"mutation":c=i.getMutationType();break;case"subscription":c=i.getSubscriptionType();break}this._typeStack.push((0,Ve.isObjectType)(c)?c:void 0);break}case Ue.Kind.INLINE_FRAGMENT:case Ue.Kind.FRAGMENT_DEFINITION:{var l=n.typeCondition,d=l?(0,VI.typeFromAST)(i,l):(0,Ve.getNamedType)(this.getType());this._typeStack.push((0,Ve.isOutputType)(d)?d:void 0);break}case Ue.Kind.VARIABLE_DEFINITION:{var f=(0,VI.typeFromAST)(i,n.type);this._inputTypeStack.push((0,Ve.isInputType)(f)?f:void 0);break}case Ue.Kind.ARGUMENT:{var h,g,y,_=(h=this.getDirective())!==null&&h!==void 0?h:this.getFieldDef();_&&(g=(0,Q1.default)(_.args,function(w){return w.name===n.name.value}),g&&(y=g.type)),this._argument=g,this._defaultValueStack.push(g?g.defaultValue:void 0),this._inputTypeStack.push((0,Ve.isInputType)(y)?y:void 0);break}case Ue.Kind.LIST:{var b=(0,Ve.getNullableType)(this.getInputType()),S=(0,Ve.isListType)(b)?b.ofType:b;this._defaultValueStack.push(void 0),this._inputTypeStack.push((0,Ve.isInputType)(S)?S:void 0);break}case Ue.Kind.OBJECT_FIELD:{var I=(0,Ve.getNamedType)(this.getInputType()),O,T;(0,Ve.isInputObjectType)(I)&&(T=I.getFields()[n.name.value],T&&(O=T.type)),this._defaultValueStack.push(T?T.defaultValue:void 0),this._inputTypeStack.push((0,Ve.isInputType)(O)?O:void 0);break}case Ue.Kind.ENUM:{var C=(0,Ve.getNamedType)(this.getInputType()),L;(0,Ve.isEnumType)(C)&&(L=C.getValue(n.value)),this._enumValue=L;break}}},t.leave=function(n){switch(n.kind){case Ue.Kind.SELECTION_SET:this._parentTypeStack.pop();break;case Ue.Kind.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case Ue.Kind.DIRECTIVE:this._directive=null;break;case Ue.Kind.OPERATION_DEFINITION:case Ue.Kind.INLINE_FRAGMENT:case Ue.Kind.FRAGMENT_DEFINITION:this._typeStack.pop();break;case Ue.Kind.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case Ue.Kind.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case Ue.Kind.LIST:case Ue.Kind.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case Ue.Kind.ENUM:this._enumValue=null;break}},e})();Ls.TypeInfo=J1;function Y1(e,t,r){var n=r.name.value;if(n===eo.SchemaMetaFieldDef.name&&e.getQueryType()===t)return eo.SchemaMetaFieldDef;if(n===eo.TypeMetaFieldDef.name&&e.getQueryType()===t)return eo.TypeMetaFieldDef;if(n===eo.TypeNameMetaFieldDef.name&&(0,Ve.isCompositeType)(t))return eo.TypeNameMetaFieldDef;if((0,Ve.isObjectType)(t)||(0,Ve.isInterfaceType)(t))return t.getFields()[n]}function X1(e,t){return{enter:function(n){e.enter(n);var i=(0,UI.getVisitFn)(t,n.kind,!1);if(i){var o=i.apply(t,arguments);return o!==void 0&&(e.leave(n),(0,W1.isNode)(o)&&e.enter(o)),o}},leave:function(n){var i=(0,UI.getVisitFn)(t,n.kind,!0),o;return i&&(o=i.apply(t,arguments)),e.leave(n),o}}}});var ti=v(mr=>{"use strict";p();Object.defineProperty(mr,"__esModule",{value:!0});mr.isDefinitionNode=Z1;mr.isExecutableDefinitionNode=GI;mr.isSelectionNode=eB;mr.isValueNode=tB;mr.isTypeNode=rB;mr.isTypeSystemDefinitionNode=$I;mr.isTypeDefinitionNode=BI;mr.isTypeSystemExtensionNode=HI;mr.isTypeExtensionNode=KI;var me=we();function Z1(e){return GI(e)||$I(e)||HI(e)}function GI(e){return e.kind===me.Kind.OPERATION_DEFINITION||e.kind===me.Kind.FRAGMENT_DEFINITION}function eB(e){return e.kind===me.Kind.FIELD||e.kind===me.Kind.FRAGMENT_SPREAD||e.kind===me.Kind.INLINE_FRAGMENT}function tB(e){return e.kind===me.Kind.VARIABLE||e.kind===me.Kind.INT||e.kind===me.Kind.FLOAT||e.kind===me.Kind.STRING||e.kind===me.Kind.BOOLEAN||e.kind===me.Kind.NULL||e.kind===me.Kind.ENUM||e.kind===me.Kind.LIST||e.kind===me.Kind.OBJECT}function rB(e){return e.kind===me.Kind.NAMED_TYPE||e.kind===me.Kind.LIST_TYPE||e.kind===me.Kind.NON_NULL_TYPE}function $I(e){return e.kind===me.Kind.SCHEMA_DEFINITION||BI(e)||e.kind===me.Kind.DIRECTIVE_DEFINITION}function BI(e){return e.kind===me.Kind.SCALAR_TYPE_DEFINITION||e.kind===me.Kind.OBJECT_TYPE_DEFINITION||e.kind===me.Kind.INTERFACE_TYPE_DEFINITION||e.kind===me.Kind.UNION_TYPE_DEFINITION||e.kind===me.Kind.ENUM_TYPE_DEFINITION||e.kind===me.Kind.INPUT_OBJECT_TYPE_DEFINITION}function HI(e){return e.kind===me.Kind.SCHEMA_EXTENSION||KI(e)}function KI(e){return e.kind===me.Kind.SCALAR_TYPE_EXTENSION||e.kind===me.Kind.OBJECT_TYPE_EXTENSION||e.kind===me.Kind.INTERFACE_TYPE_EXTENSION||e.kind===me.Kind.UNION_TYPE_EXTENSION||e.kind===me.Kind.ENUM_TYPE_EXTENSION||e.kind===me.Kind.INPUT_OBJECT_TYPE_EXTENSION}});var rh=v(th=>{"use strict";p();Object.defineProperty(th,"__esModule",{value:!0});th.ExecutableDefinitionsRule=oB;var nB=Q(),QI=we(),iB=ti();function oB(e){return{Document:function(r){for(var n=0,i=r.definitions;n<i.length;n++){var o=i[n];if(!(0,iB.isExecutableDefinitionNode)(o)){var s=o.kind===QI.Kind.SCHEMA_DEFINITION||o.kind===QI.Kind.SCHEMA_EXTENSION?"schema":'"'+o.name.value+'"';e.reportError(new nB.GraphQLError("The ".concat(s," definition is not executable."),o))}}return!1}}}});var ih=v(nh=>{"use strict";p();Object.defineProperty(nh,"__esModule",{value:!0});nh.UniqueOperationNamesRule=aB;var sB=Q();function aB(e){var t=Object.create(null);return{OperationDefinition:function(n){var i=n.name;return i&&(t[i.value]?e.reportError(new sB.GraphQLError('There can be only one operation named "'.concat(i.value,'".'),[t[i.value],i])):t[i.value]=i),!1},FragmentDefinition:function(){return!1}}}});var sh=v(oh=>{"use strict";p();Object.defineProperty(oh,"__esModule",{value:!0});oh.LoneAnonymousOperationRule=lB;var uB=Q(),cB=we();function lB(e){var t=0;return{Document:function(n){t=n.definitions.filter(function(i){return i.kind===cB.Kind.OPERATION_DEFINITION}).length},OperationDefinition:function(n){!n.name&&t>1&&e.reportError(new uB.GraphQLError("This anonymous operation must be the only defined operation.",n))}}}});var uh=v(ah=>{"use strict";p();Object.defineProperty(ah,"__esModule",{value:!0});ah.SingleFieldSubscriptionsRule=dB;var pB=Q();function dB(e){return{OperationDefinition:function(r){r.operation==="subscription"&&r.selectionSet.selections.length!==1&&e.reportError(new pB.GraphQLError(r.name?'Subscription "'.concat(r.name.value,'" must select only one top level field.'):"Anonymous Subscription must select only one top level field.",r.selectionSet.selections.slice(1)))}}}});var ph=v(lh=>{"use strict";p();Object.defineProperty(lh,"__esModule",{value:!0});lh.KnownTypeNamesRule=vB;var fB=WI(dn()),hB=WI(fn()),mB=Q(),ch=ti(),gB=wr(),yB=er();function WI(e){return e&&e.__esModule?e:{default:e}}function vB(e){for(var t=e.getSchema(),r=t?t.getTypeMap():Object.create(null),n=Object.create(null),i=0,o=e.getDocument().definitions;i<o.length;i++){var s=o[i];(0,ch.isTypeDefinitionNode)(s)&&(n[s.name.value]=!0)}var a=Object.keys(r).concat(Object.keys(n));return{NamedType:function(c,l,d,f,h){var g=c.name.value;if(!r[g]&&!n[g]){var y,_=(y=h[2])!==null&&y!==void 0?y:d,b=_!=null&&_B(_);if(b&&EB(g))return;var S=(0,hB.default)(g,b?zI.concat(a):a);e.reportError(new mB.GraphQLError('Unknown type "'.concat(g,'".')+(0,fB.default)(S),c))}}}}var zI=[].concat(gB.specifiedScalarTypes,yB.introspectionTypes).map(function(e){return e.name});function EB(e){return zI.indexOf(e)!==-1}function _B(e){return!Array.isArray(e)&&((0,ch.isTypeSystemDefinitionNode)(e)||(0,ch.isTypeSystemExtensionNode)(e))}});var fh=v(dh=>{"use strict";p();Object.defineProperty(dh,"__esModule",{value:!0});dh.FragmentsOnCompositeTypesRule=SB;var JI=Q(),YI=wt(),XI=ce(),ZI=Or();function SB(e){return{InlineFragment:function(r){var n=r.typeCondition;if(n){var i=(0,ZI.typeFromAST)(e.getSchema(),n);if(i&&!(0,XI.isCompositeType)(i)){var o=(0,YI.print)(n);e.reportError(new JI.GraphQLError('Fragment cannot condition on non composite type "'.concat(o,'".'),n))}}},FragmentDefinition:function(r){var n=(0,ZI.typeFromAST)(e.getSchema(),r.typeCondition);if(n&&!(0,XI.isCompositeType)(n)){var i=(0,YI.print)(r.typeCondition);e.reportError(new JI.GraphQLError('Fragment "'.concat(r.name.value,'" cannot condition on non composite type "').concat(i,'".'),r.typeCondition))}}}}});var mh=v(hh=>{"use strict";p();Object.defineProperty(hh,"__esModule",{value:!0});hh.VariablesAreInputTypesRule=OB;var bB=Q(),TB=wt(),IB=ce(),wB=Or();function OB(e){return{VariableDefinition:function(r){var n=(0,wB.typeFromAST)(e.getSchema(),r.type);if(n&&!(0,IB.isInputType)(n)){var i=r.variable.name.value,o=(0,TB.print)(r.type);e.reportError(new bB.GraphQLError('Variable "$'.concat(i,'" cannot be non-input type "').concat(o,'".'),r.type))}}}}});var yh=v(gh=>{"use strict";p();Object.defineProperty(gh,"__esModule",{value:!0});gh.ScalarLeafsRule=xB;var ew=AB(he()),tw=Q(),rw=ce();function AB(e){return e&&e.__esModule?e:{default:e}}function xB(e){return{Field:function(r){var n=e.getType(),i=r.selectionSet;if(n){if((0,rw.isLeafType)((0,rw.getNamedType)(n))){if(i){var o=r.name.value,s=(0,ew.default)(n);e.reportError(new tw.GraphQLError('Field "'.concat(o,'" must not have a selection since type "').concat(s,'" has no subfields.'),i))}}else if(!i){var a=r.name.value,u=(0,ew.default)(n);e.reportError(new tw.GraphQLError('Field "'.concat(a,'" of type "').concat(u,'" must have a selection of subfields. Did you mean "').concat(a,' { ... }"?'),r))}}}}}});var Eh=v(vh=>{"use strict";p();Object.defineProperty(vh,"__esModule",{value:!0});vh.FieldsOnCorrectTypeRule=DB;var CB=Sc(Pf()),nw=Sc(dn()),RB=Sc(fn()),PB=Sc(vs()),NB=Q(),ks=ce();function Sc(e){return e&&e.__esModule?e:{default:e}}function DB(e){return{Field:function(r){var n=e.getParentType();if(n){var i=e.getFieldDef();if(!i){var o=e.getSchema(),s=r.name.value,a=(0,nw.default)("to use an inline fragment on",LB(o,n,s));a===""&&(a=(0,nw.default)(kB(n,s))),e.reportError(new NB.GraphQLError('Cannot query field "'.concat(s,'" on type "').concat(n.name,'".')+a,r))}}}}}function LB(e,t,r){if(!(0,ks.isAbstractType)(t))return[];for(var n=new Set,i=Object.create(null),o=0,s=e.getPossibleTypes(t);o<s.length;o++){var a=s[o];if(a.getFields()[r]){n.add(a),i[a.name]=1;for(var u=0,c=a.getInterfaces();u<c.length;u++){var l,d=c[u];d.getFields()[r]&&(n.add(d),i[d.name]=((l=i[d.name])!==null&&l!==void 0?l:0)+1)}}}return(0,CB.default)(n).sort(function(f,h){var g=i[h.name]-i[f.name];return g!==0?g:(0,ks.isInterfaceType)(f)&&e.isSubType(f,h)?-1:(0,ks.isInterfaceType)(h)&&e.isSubType(h,f)?1:(0,PB.default)(f.name,h.name)}).map(function(f){return f.name})}function kB(e,t){if((0,ks.isObjectType)(e)||(0,ks.isInterfaceType)(e)){var r=Object.keys(e.getFields());return(0,RB.default)(t,r)}return[]}});var Sh=v(_h=>{"use strict";p();Object.defineProperty(_h,"__esModule",{value:!0});_h.UniqueFragmentNamesRule=MB;var jB=Q();function MB(e){var t=Object.create(null);return{OperationDefinition:function(){return!1},FragmentDefinition:function(n){var i=n.name.value;return t[i]?e.reportError(new jB.GraphQLError('There can be only one fragment named "'.concat(i,'".'),[t[i],n.name])):t[i]=n.name,!1}}}});var Th=v(bh=>{"use strict";p();Object.defineProperty(bh,"__esModule",{value:!0});bh.KnownFragmentNamesRule=qB;var FB=Q();function qB(e){return{FragmentSpread:function(r){var n=r.name.value,i=e.getFragment(n);i||e.reportError(new FB.GraphQLError('Unknown fragment "'.concat(n,'".'),r.name))}}}});var wh=v(Ih=>{"use strict";p();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.NoUnusedFragmentsRule=VB;var UB=Q();function VB(e){var t=[],r=[];return{OperationDefinition:function(i){return t.push(i),!1},FragmentDefinition:function(i){return r.push(i),!1},Document:{leave:function(){for(var i=Object.create(null),o=0;o<t.length;o++)for(var s=t[o],a=0,u=e.getRecursivelyReferencedFragments(s);a<u.length;a++){var c=u[a];i[c.name.value]=!0}for(var l=0;l<r.length;l++){var d=r[l],f=d.name.value;i[f]!==!0&&e.reportError(new UB.GraphQLError('Fragment "'.concat(f,'" is never used.'),d))}}}}}});var xh=v(Ah=>{"use strict";p();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.PossibleFragmentSpreadsRule=BB;var bc=$B(he()),iw=Q(),Oh=ce(),GB=Or(),ow=Ts();function $B(e){return e&&e.__esModule?e:{default:e}}function BB(e){return{InlineFragment:function(r){var n=e.getType(),i=e.getParentType();if((0,Oh.isCompositeType)(n)&&(0,Oh.isCompositeType)(i)&&!(0,ow.doTypesOverlap)(e.getSchema(),n,i)){var o=(0,bc.default)(i),s=(0,bc.default)(n);e.reportError(new iw.GraphQLError('Fragment cannot be spread here as objects of type "'.concat(o,'" can never be of type "').concat(s,'".'),r))}},FragmentSpread:function(r){var n=r.name.value,i=HB(e,n),o=e.getParentType();if(i&&o&&!(0,ow.doTypesOverlap)(e.getSchema(),i,o)){var s=(0,bc.default)(o),a=(0,bc.default)(i);e.reportError(new iw.GraphQLError('Fragment "'.concat(n,'" cannot be spread here as objects of type "').concat(s,'" can never be of type "').concat(a,'".'),r))}}}}function HB(e,t){var r=e.getFragment(t);if(r){var n=(0,GB.typeFromAST)(e.getSchema(),r.typeCondition);if((0,Oh.isCompositeType)(n))return n}}});var Rh=v(Ch=>{"use strict";p();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.NoFragmentCyclesRule=QB;var KB=Q();function QB(e){var t=Object.create(null),r=[],n=Object.create(null);return{OperationDefinition:function(){return!1},FragmentDefinition:function(s){return i(s),!1}};function i(o){if(!t[o.name.value]){var s=o.name.value;t[s]=!0;var a=e.getFragmentSpreads(o.selectionSet);if(a.length!==0){n[s]=r.length;for(var u=0;u<a.length;u++){var c=a[u],l=c.name.value,d=n[l];if(r.push(c),d===void 0){var f=e.getFragment(l);f&&i(f)}else{var h=r.slice(d),g=h.slice(0,-1).map(function(y){return'"'+y.name.value+'"'}).join(", ");e.reportError(new KB.GraphQLError('Cannot spread fragment "'.concat(l,'" within itself')+(g!==""?" via ".concat(g,"."):"."),h))}r.pop()}n[s]=void 0}}}}});var Nh=v(Ph=>{"use strict";p();Object.defineProperty(Ph,"__esModule",{value:!0});Ph.UniqueVariableNamesRule=zB;var WB=Q();function zB(e){var t=Object.create(null);return{OperationDefinition:function(){t=Object.create(null)},VariableDefinition:function(n){var i=n.variable.name.value;t[i]?e.reportError(new WB.GraphQLError('There can be only one variable named "$'.concat(i,'".'),[t[i],n.variable.name])):t[i]=n.variable.name}}}});var Lh=v(Dh=>{"use strict";p();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.NoUndefinedVariablesRule=YB;var JB=Q();function YB(e){var t=Object.create(null);return{OperationDefinition:{enter:function(){t=Object.create(null)},leave:function(n){for(var i=e.getRecursiveVariableUsages(n),o=0;o<i.length;o++){var s=i[o],a=s.node,u=a.name.value;t[u]!==!0&&e.reportError(new JB.GraphQLError(n.name?'Variable "$'.concat(u,'" is not defined by operation "').concat(n.name.value,'".'):'Variable "$'.concat(u,'" is not defined.'),[a,n]))}}},VariableDefinition:function(n){t[n.variable.name.value]=!0}}}});var jh=v(kh=>{"use strict";p();Object.defineProperty(kh,"__esModule",{value:!0});kh.NoUnusedVariablesRule=ZB;var XB=Q();function ZB(e){var t=[];return{OperationDefinition:{enter:function(){t=[]},leave:function(n){for(var i=Object.create(null),o=e.getRecursiveVariableUsages(n),s=0;s<o.length;s++){var a=o[s],u=a.node;i[u.name.value]=!0}for(var c=0,l=t;c<l.length;c++){var d=l[c],f=d.variable.name.value;i[f]!==!0&&e.reportError(new XB.GraphQLError(n.name?'Variable "$'.concat(f,'" is never used in operation "').concat(n.name.value,'".'):'Variable "$'.concat(f,'" is never used.'),d))}}},VariableDefinition:function(n){t.push(n)}}}});var Fh=v(Mh=>{"use strict";p();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.KnownDirectivesRule=rH;var eH=uw(he()),aw=uw(ut()),sw=Q(),Pe=we(),Ze=Vi(),tH=Ot();function uw(e){return e&&e.__esModule?e:{default:e}}function rH(e){for(var t=Object.create(null),r=e.getSchema(),n=r?r.getDirectives():tH.specifiedDirectives,i=0;i<n.length;i++){var o=n[i];t[o.name]=o.locations}for(var s=e.getDocument().definitions,a=0;a<s.length;a++){var u=s[a];u.kind===Pe.Kind.DIRECTIVE_DEFINITION&&(t[u.name.value]=u.locations.map(function(c){return c.value}))}return{Directive:function(l,d,f,h,g){var y=l.name.value,_=t[y];if(!_){e.reportError(new sw.GraphQLError('Unknown directive "@'.concat(y,'".'),l));return}var b=nH(g);b&&_.indexOf(b)===-1&&e.reportError(new sw.GraphQLError('Directive "@'.concat(y,'" may not be used on ').concat(b,"."),l))}}}function nH(e){var t=e[e.length-1];switch(!Array.isArray(t)||(0,aw.default)(0),t.kind){case Pe.Kind.OPERATION_DEFINITION:return iH(t.operation);case Pe.Kind.FIELD:return Ze.DirectiveLocation.FIELD;case Pe.Kind.FRAGMENT_SPREAD:return Ze.DirectiveLocation.FRAGMENT_SPREAD;case Pe.Kind.INLINE_FRAGMENT:return Ze.DirectiveLocation.INLINE_FRAGMENT;case Pe.Kind.FRAGMENT_DEFINITION:return Ze.DirectiveLocation.FRAGMENT_DEFINITION;case Pe.Kind.VARIABLE_DEFINITION:return Ze.DirectiveLocation.VARIABLE_DEFINITION;case Pe.Kind.SCHEMA_DEFINITION:case Pe.Kind.SCHEMA_EXTENSION:return Ze.DirectiveLocation.SCHEMA;case Pe.Kind.SCALAR_TYPE_DEFINITION:case Pe.Kind.SCALAR_TYPE_EXTENSION:return Ze.DirectiveLocation.SCALAR;case Pe.Kind.OBJECT_TYPE_DEFINITION:case Pe.Kind.OBJECT_TYPE_EXTENSION:return Ze.DirectiveLocation.OBJECT;case Pe.Kind.FIELD_DEFINITION:return Ze.DirectiveLocation.FIELD_DEFINITION;case Pe.Kind.INTERFACE_TYPE_DEFINITION:case Pe.Kind.INTERFACE_TYPE_EXTENSION:return Ze.DirectiveLocation.INTERFACE;case Pe.Kind.UNION_TYPE_DEFINITION:case Pe.Kind.UNION_TYPE_EXTENSION:return Ze.DirectiveLocation.UNION;case Pe.Kind.ENUM_TYPE_DEFINITION:case Pe.Kind.ENUM_TYPE_EXTENSION:return Ze.DirectiveLocation.ENUM;case Pe.Kind.ENUM_VALUE_DEFINITION:return Ze.DirectiveLocation.ENUM_VALUE;case Pe.Kind.INPUT_OBJECT_TYPE_DEFINITION:case Pe.Kind.INPUT_OBJECT_TYPE_EXTENSION:return Ze.DirectiveLocation.INPUT_OBJECT;case Pe.Kind.INPUT_VALUE_DEFINITION:{var r=e[e.length-3];return r.kind===Pe.Kind.INPUT_OBJECT_TYPE_DEFINITION?Ze.DirectiveLocation.INPUT_FIELD_DEFINITION:Ze.DirectiveLocation.ARGUMENT_DEFINITION}}}function iH(e){switch(e){case"query":return Ze.DirectiveLocation.QUERY;case"mutation":return Ze.DirectiveLocation.MUTATION;case"subscription":return Ze.DirectiveLocation.SUBSCRIPTION}(0,aw.default)(0,"Unexpected operation: "+(0,eH.default)(e))}});var Vh=v(Uh=>{"use strict";p();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.UniqueDirectivesPerLocationRule=aH;var oH=Q(),qh=we(),cw=ti(),sH=Ot();function aH(e){for(var t=Object.create(null),r=e.getSchema(),n=r?r.getDirectives():sH.specifiedDirectives,i=0;i<n.length;i++){var o=n[i];t[o.name]=!o.isRepeatable}for(var s=e.getDocument().definitions,a=0;a<s.length;a++){var u=s[a];u.kind===qh.Kind.DIRECTIVE_DEFINITION&&(t[u.name.value]=!u.repeatable)}var c=Object.create(null),l=Object.create(null);return{enter:function(f){if(f.directives!=null){var h;if(f.kind===qh.Kind.SCHEMA_DEFINITION||f.kind===qh.Kind.SCHEMA_EXTENSION)h=c;else if((0,cw.isTypeDefinitionNode)(f)||(0,cw.isTypeExtensionNode)(f)){var g=f.name.value;h=l[g],h===void 0&&(l[g]=h=Object.create(null))}else h=Object.create(null);for(var y=0,_=f.directives;y<_.length;y++){var b=_[y],S=b.name.value;t[S]&&(h[S]?e.reportError(new oH.GraphQLError('The directive "@'.concat(S,'" can only be used once at this location.'),[h[S],b])):h[S]=b)}}}}}});var Gh=v(Tc=>{"use strict";p();Object.defineProperty(Tc,"__esModule",{value:!0});Tc.KnownArgumentNamesRule=pH;Tc.KnownArgumentNamesOnDirectivesRule=gw;var dw=mw(dn()),fw=mw(fn()),hw=Q(),uH=we(),cH=Ot();function mw(e){return e&&e.__esModule?e:{default:e}}function lw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function pw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lw(Object(r),!0).forEach(function(n){lH(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lH(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pH(e){return pw(pw({},gw(e)),{},{Argument:function(r){var n=e.getArgument(),i=e.getFieldDef(),o=e.getParentType();if(!n&&i&&o){var s=r.name.value,a=i.args.map(function(c){return c.name}),u=(0,fw.default)(s,a);e.reportError(new hw.GraphQLError('Unknown argument "'.concat(s,'" on field "').concat(o.name,".").concat(i.name,'".')+(0,dw.default)(u),r))}}})}function gw(e){for(var t=Object.create(null),r=e.getSchema(),n=r?r.getDirectives():cH.specifiedDirectives,i=0;i<n.length;i++){var o=n[i];t[o.name]=o.args.map(function(d){return d.name})}for(var s=e.getDocument().definitions,a=0;a<s.length;a++){var u=s[a];if(u.kind===uH.Kind.DIRECTIVE_DEFINITION){var c,l=(c=u.arguments)!==null&&c!==void 0?c:[];t[u.name.value]=l.map(function(d){return d.name.value})}}return{Directive:function(f){var h=f.name.value,g=t[h];if(f.arguments&&g)for(var y=0,_=f.arguments;y<_.length;y++){var b=_[y],S=b.name.value;if(g.indexOf(S)===-1){var I=(0,fw.default)(S,g);e.reportError(new hw.GraphQLError('Unknown argument "'.concat(S,'" on directive "@').concat(h,'".')+(0,dw.default)(I),b))}}return!1}}}});var Bh=v($h=>{"use strict";p();Object.defineProperty($h,"__esModule",{value:!0});$h.UniqueArgumentNamesRule=fH;var dH=Q();function fH(e){var t=Object.create(null);return{Field:function(){t=Object.create(null)},Directive:function(){t=Object.create(null)},Argument:function(n){var i=n.name.value;return t[i]?e.reportError(new dH.GraphQLError('There can be only one argument named "'.concat(i,'".'),[t[i],n.name])):t[i]=n.name,!1}}}});var Kh=v(Hh=>{"use strict";p();Object.defineProperty(Hh,"__esModule",{value:!0});Hh.ValuesOfCorrectTypeRule=vH;var hH=Ms(Lt()),mH=Ms(pn()),js=Ms(he()),gH=Ms(dn()),yH=Ms(fn()),ni=Q(),Ic=wt(),Ar=ce();function Ms(e){return e&&e.__esModule?e:{default:e}}function vH(e){return{ListValue:function(r){var n=(0,Ar.getNullableType)(e.getParentInputType());if(!(0,Ar.isListType)(n))return ri(e,r),!1},ObjectValue:function(r){var n=(0,Ar.getNamedType)(e.getInputType());if(!(0,Ar.isInputObjectType)(n))return ri(e,r),!1;for(var i=(0,mH.default)(r.fields,function(l){return l.name.value}),o=0,s=(0,hH.default)(n.getFields());o<s.length;o++){var a=s[o],u=i[a.name];if(!u&&(0,Ar.isRequiredInputField)(a)){var c=(0,js.default)(a.type);e.reportError(new ni.GraphQLError('Field "'.concat(n.name,".").concat(a.name,'" of required type "').concat(c,'" was not provided.'),r))}}},ObjectField:function(r){var n=(0,Ar.getNamedType)(e.getParentInputType()),i=e.getInputType();if(!i&&(0,Ar.isInputObjectType)(n)){var o=(0,yH.default)(r.name.value,Object.keys(n.getFields()));e.reportError(new ni.GraphQLError('Field "'.concat(r.name.value,'" is not defined by type "').concat(n.name,'".')+(0,gH.default)(o),r))}},NullValue:function(r){var n=e.getInputType();(0,Ar.isNonNullType)(n)&&e.reportError(new ni.GraphQLError('Expected value of type "'.concat((0,js.default)(n),'", found ').concat((0,Ic.print)(r),"."),r))},EnumValue:function(r){return ri(e,r)},IntValue:function(r){return ri(e,r)},FloatValue:function(r){return ri(e,r)},StringValue:function(r){return ri(e,r)},BooleanValue:function(r){return ri(e,r)}}}function ri(e,t){var r=e.getInputType();if(r){var n=(0,Ar.getNamedType)(r);if(!(0,Ar.isLeafType)(n)){var i=(0,js.default)(r);e.reportError(new ni.GraphQLError('Expected value of type "'.concat(i,'", found ').concat((0,Ic.print)(t),"."),t));return}try{var o=n.parseLiteral(t,void 0);if(o===void 0){var s=(0,js.default)(r);e.reportError(new ni.GraphQLError('Expected value of type "'.concat(s,'", found ').concat((0,Ic.print)(t),"."),t))}}catch(u){var a=(0,js.default)(r);u instanceof ni.GraphQLError?e.reportError(u):e.reportError(new ni.GraphQLError('Expected value of type "'.concat(a,'", found ').concat((0,Ic.print)(t),"; ")+u.message,t,void 0,void 0,void 0,u))}}}});var Wh=v(Oc=>{"use strict";p();Object.defineProperty(Oc,"__esModule",{value:!0});Oc.ProvidedRequiredArgumentsRule=bH;Oc.ProvidedRequiredArgumentsOnDirectivesRule=Tw;var Ew=bw(he()),wc=bw(pn()),_w=Q(),Sw=we(),EH=wt(),_H=Ot(),Qh=ce();function bw(e){return e&&e.__esModule?e:{default:e}}function yw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yw(Object(r),!0).forEach(function(n){SH(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function SH(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bH(e){return vw(vw({},Tw(e)),{},{Field:{leave:function(r){var n,i=e.getFieldDef();if(!i)return!1;for(var o=(n=r.arguments)!==null&&n!==void 0?n:[],s=(0,wc.default)(o,function(f){return f.name.value}),a=0,u=i.args;a<u.length;a++){var c=u[a],l=s[c.name];if(!l&&(0,Qh.isRequiredArgument)(c)){var d=(0,Ew.default)(c.type);e.reportError(new _w.GraphQLError('Field "'.concat(i.name,'" argument "').concat(c.name,'" of type "').concat(d,'" is required, but it was not provided.'),r))}}}}})}function Tw(e){for(var t=Object.create(null),r=e.getSchema(),n=r?r.getDirectives():_H.specifiedDirectives,i=0;i<n.length;i++){var o=n[i];t[o.name]=(0,wc.default)(o.args.filter(Qh.isRequiredArgument),function(d){return d.name})}for(var s=e.getDocument().definitions,a=0;a<s.length;a++){var u=s[a];if(u.kind===Sw.Kind.DIRECTIVE_DEFINITION){var c,l=(c=u.arguments)!==null&&c!==void 0?c:[];t[u.name.value]=(0,wc.default)(l.filter(TH),function(d){return d.name.value})}}return{Directive:{leave:function(f){var h=f.name.value,g=t[h];if(g)for(var y,_=(y=f.arguments)!==null&&y!==void 0?y:[],b=(0,wc.default)(_,function(L){return L.name.value}),S=0,I=Object.keys(g);S<I.length;S++){var O=I[S];if(!b[O]){var T=g[O].type,C=(0,Qh.isType)(T)?(0,Ew.default)(T):(0,EH.print)(T);e.reportError(new _w.GraphQLError('Directive "@'.concat(h,'" argument "').concat(O,'" of type "').concat(C,'" is required, but it was not provided.'),f))}}}}}}function TH(e){return e.type.kind===Sw.Kind.NON_NULL_TYPE&&e.defaultValue==null}});var Jh=v(zh=>{"use strict";p();Object.defineProperty(zh,"__esModule",{value:!0});zh.VariablesInAllowedPositionRule=xH;var Iw=AH(he()),IH=Q(),wH=we(),ww=ce(),OH=Or(),Ow=Ts();function AH(e){return e&&e.__esModule?e:{default:e}}function xH(e){var t=Object.create(null);return{OperationDefinition:{enter:function(){t=Object.create(null)},leave:function(n){for(var i=e.getRecursiveVariableUsages(n),o=0;o<i.length;o++){var s=i[o],a=s.node,u=s.type,c=s.defaultValue,l=a.name.value,d=t[l];if(d&&u){var f=e.getSchema(),h=(0,OH.typeFromAST)(f,d.type);if(h&&!CH(f,h,d.defaultValue,u,c)){var g=(0,Iw.default)(h),y=(0,Iw.default)(u);e.reportError(new IH.GraphQLError('Variable "$'.concat(l,'" of type "').concat(g,'" used in position expecting type "').concat(y,'".'),[d,a]))}}}}},VariableDefinition:function(n){t[n.variable.name.value]=n}}}function CH(e,t,r,n,i){if((0,ww.isNonNullType)(n)&&!(0,ww.isNonNullType)(t)){var o=r!=null&&r.kind!==wH.Kind.NULL,s=i!==void 0;if(!o&&!s)return!1;var a=n.ofType;return(0,Ow.isTypeSubTypeOf)(e,t,a)}return(0,Ow.isTypeSubTypeOf)(e,t,n)}});var nm=v(rm=>{"use strict";p();Object.defineProperty(rm,"__esModule",{value:!0});rm.OverlappingFieldsCanBeMergedRule=DH;var RH=em(Hi()),PH=em(Ki()),Aw=em(he()),NH=Q(),Yh=we(),xw=wt(),At=ce(),Cw=Or();function em(e){return e&&e.__esModule?e:{default:e}}function Rw(e){return Array.isArray(e)?e.map(function(t){var r=t[0],n=t[1];return'subfields "'.concat(r,'" conflict because ')+Rw(n)}).join(" and "):e}function DH(e){var t=new UH,r=new Map;return{SelectionSet:function(i){for(var o=LH(e,r,t,e.getParentType(),i),s=0;s<o.length;s++){var a=o[s],u=a[0],c=u[0],l=u[1],d=a[1],f=a[2],h=Rw(l);e.reportError(new NH.GraphQLError('Fields "'.concat(c,'" conflict because ').concat(h,". Use different aliases on the fields to fetch both if this was intentional."),d.concat(f)))}}}}function LH(e,t,r,n,i){var o=[],s=Cc(e,t,n,i),a=s[0],u=s[1];if(jH(e,o,t,r,a),u.length!==0)for(var c=0;c<u.length;c++){Ac(e,o,t,r,!1,a,u[c]);for(var l=c+1;l<u.length;l++)xc(e,o,t,r,!1,u[c],u[l])}return o}function Ac(e,t,r,n,i,o,s){var a=e.getFragment(s);if(a){var u=Zh(e,r,a),c=u[0],l=u[1];if(o!==c){tm(e,t,r,n,i,o,c);for(var d=0;d<l.length;d++){var f=l[d];n.has(f,s,i)||(n.add(f,s,i),Ac(e,t,r,n,i,o,l[d]))}}}}function xc(e,t,r,n,i,o,s){if(o!==s&&!n.has(o,s,i)){n.add(o,s,i);var a=e.getFragment(o),u=e.getFragment(s);if(!(!a||!u)){var c=Zh(e,r,a),l=c[0],d=c[1],f=Zh(e,r,u),h=f[0],g=f[1];tm(e,t,r,n,i,l,h);for(var y=0;y<g.length;y++)xc(e,t,r,n,i,o,g[y]);for(var _=0;_<d.length;_++)xc(e,t,r,n,i,d[_],s)}}}function kH(e,t,r,n,i,o,s,a){var u=[],c=Cc(e,t,i,o),l=c[0],d=c[1],f=Cc(e,t,s,a),h=f[0],g=f[1];if(tm(e,u,t,r,n,l,h),g.length!==0)for(var y=0;y<g.length;y++)Ac(e,u,t,r,n,l,g[y]);if(d.length!==0)for(var _=0;_<d.length;_++)Ac(e,u,t,r,n,h,d[_]);for(var b=0;b<d.length;b++)for(var S=0;S<g.length;S++)xc(e,u,t,r,n,d[b],g[S]);return u}function jH(e,t,r,n,i){for(var o=0,s=(0,PH.default)(i);o<s.length;o++){var a=s[o],u=a[0],c=a[1];if(c.length>1)for(var l=0;l<c.length;l++)for(var d=l+1;d<c.length;d++){var f=Pw(e,r,n,!1,u,c[l],c[d]);f&&t.push(f)}}}function tm(e,t,r,n,i,o,s){for(var a=0,u=Object.keys(o);a<u.length;a++){var c=u[a],l=s[c];if(l)for(var d=o[c],f=0;f<d.length;f++)for(var h=0;h<l.length;h++){var g=Pw(e,r,n,i,c,d[f],l[h]);g&&t.push(g)}}}function Pw(e,t,r,n,i,o,s){var a=o[0],u=o[1],c=o[2],l=s[0],d=s[1],f=s[2],h=n||a!==l&&(0,At.isObjectType)(a)&&(0,At.isObjectType)(l);if(!h){var g,y,_=u.name.value,b=d.name.value;if(_!==b)return[[i,'"'.concat(_,'" and "').concat(b,'" are different fields')],[u],[d]];var S=(g=u.arguments)!==null&&g!==void 0?g:[],I=(y=d.arguments)!==null&&y!==void 0?y:[];if(!MH(S,I))return[[i,"they have differing arguments"],[u],[d]]}var O=c?.type,T=f?.type;if(O&&T&&Xh(O,T))return[[i,'they return conflicting types "'.concat((0,Aw.default)(O),'" and "').concat((0,Aw.default)(T),'"')],[u],[d]];var C=u.selectionSet,L=d.selectionSet;if(C&&L){var w=kH(e,t,r,h,(0,At.getNamedType)(O),C,(0,At.getNamedType)(T),L);return qH(w,i,u,d)}}function MH(e,t){return e.length!==t.length?!1:e.every(function(r){var n=(0,RH.default)(t,function(i){return i.name.value===r.name.value});return n?FH(r.value,n.value):!1})}function FH(e,t){return(0,xw.print)(e)===(0,xw.print)(t)}function Xh(e,t){return(0,At.isListType)(e)?(0,At.isListType)(t)?Xh(e.ofType,t.ofType):!0:(0,At.isListType)(t)?!0:(0,At.isNonNullType)(e)?(0,At.isNonNullType)(t)?Xh(e.ofType,t.ofType):!0:(0,At.isNonNullType)(t)?!0:(0,At.isLeafType)(e)||(0,At.isLeafType)(t)?e!==t:!1}function Cc(e,t,r,n){var i=t.get(n);if(!i){var o=Object.create(null),s=Object.create(null);Nw(e,r,n,o,s),i=[o,Object.keys(s)],t.set(n,i)}return i}function Zh(e,t,r){var n=t.get(r.selectionSet);if(n)return n;var i=(0,Cw.typeFromAST)(e.getSchema(),r.typeCondition);return Cc(e,t,i,r.selectionSet)}function Nw(e,t,r,n,i){for(var o=0,s=r.selections;o<s.length;o++){var a=s[o];switch(a.kind){case Yh.Kind.FIELD:{var u=a.name.value,c=void 0;((0,At.isObjectType)(t)||(0,At.isInterfaceType)(t))&&(c=t.getFields()[u]);var l=a.alias?a.alias.value:u;n[l]||(n[l]=[]),n[l].push([t,a,c]);break}case Yh.Kind.FRAGMENT_SPREAD:i[a.name.value]=!0;break;case Yh.Kind.INLINE_FRAGMENT:{var d=a.typeCondition,f=d?(0,Cw.typeFromAST)(e.getSchema(),d):t;Nw(e,f,a.selectionSet,n,i);break}}}}function qH(e,t,r,n){if(e.length>0)return[[t,e.map(function(i){var o=i[0];return o})],e.reduce(function(i,o){var s=o[1];return i.concat(s)},[r]),e.reduce(function(i,o){var s=o[2];return i.concat(s)},[n])]}var UH=(function(){function e(){this._data=Object.create(null)}var t=e.prototype;return t.has=function(n,i,o){var s=this._data[n],a=s&&s[i];return a===void 0?!1:o===!1?a===!1:!0},t.add=function(n,i,o){this._pairSetAdd(n,i,o),this._pairSetAdd(i,n,o)},t._pairSetAdd=function(n,i,o){var s=this._data[n];s||(s=Object.create(null),this._data[n]=s),s[i]=o},e})()});var om=v(im=>{"use strict";p();Object.defineProperty(im,"__esModule",{value:!0});im.UniqueInputFieldNamesRule=GH;var VH=Q();function GH(e){var t=[],r=Object.create(null);return{ObjectValue:{enter:function(){t.push(r),r=Object.create(null)},leave:function(){r=t.pop()}},ObjectField:function(i){var o=i.name.value;r[o]?e.reportError(new VH.GraphQLError('There can be only one input field named "'.concat(o,'".'),[r[o],i.name])):r[o]=i.name}}}});var am=v(sm=>{"use strict";p();Object.defineProperty(sm,"__esModule",{value:!0});sm.MaxIntrospectionDepthRule=HH;var $H=Q(),Dw=we(),BH=3;function HH(e){function t(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object.create(null),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(r.kind===Dw.Kind.FRAGMENT_SPREAD){var o=r.name.value;if(n[o]===!0)return!1;var s=e.getFragment(o);if(!s)return!1;try{return n[o]=!0,t(s,n,i)}finally{n[o]=null}}if(r.kind===Dw.Kind.FIELD&&(r.name.value==="fields"||r.name.value==="interfaces"||r.name.value==="possibleTypes"||r.name.value==="inputFields")&&(i++,i>=BH))return!0;if("selectionSet"in r&&r.selectionSet)for(var a=0,u=r.selectionSet.selections;a<u.length;a++){var c=u[a];if(t(c,n,i))return!0}return!1}return{Field:function(n){if((n.name.value==="__schema"||n.name.value==="__type")&&t(n))return e.reportError(new $H.GraphQLError("Maximum introspection depth exceeded",[n])),!1}}}});var cm=v(um=>{"use strict";p();Object.defineProperty(um,"__esModule",{value:!0});um.LoneSchemaDefinitionRule=KH;var Lw=Q();function KH(e){var t,r,n,i=e.getSchema(),o=(t=(r=(n=i?.astNode)!==null&&n!==void 0?n:i?.getQueryType())!==null&&r!==void 0?r:i?.getMutationType())!==null&&t!==void 0?t:i?.getSubscriptionType(),s=0;return{SchemaDefinition:function(u){if(o){e.reportError(new Lw.GraphQLError("Cannot define a new schema within a schema extension.",u));return}s>0&&e.reportError(new Lw.GraphQLError("Must provide only one schema definition.",u)),++s}}}});var pm=v(lm=>{"use strict";p();Object.defineProperty(lm,"__esModule",{value:!0});lm.UniqueOperationTypesRule=QH;var kw=Q();function QH(e){var t=e.getSchema(),r=Object.create(null),n=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:i,SchemaExtension:i};function i(o){for(var s,a=(s=o.operationTypes)!==null&&s!==void 0?s:[],u=0;u<a.length;u++){var c=a[u],l=c.operation,d=r[l];n[l]?e.reportError(new kw.GraphQLError("Type for ".concat(l," already defined in the schema. It cannot be redefined."),c)):d?e.reportError(new kw.GraphQLError("There can be only one ".concat(l," type in schema."),[d,c])):r[l]=c}return!1}}});var fm=v(dm=>{"use strict";p();Object.defineProperty(dm,"__esModule",{value:!0});dm.UniqueTypeNamesRule=WH;var jw=Q();function WH(e){var t=Object.create(null),r=e.getSchema();return{ScalarTypeDefinition:n,ObjectTypeDefinition:n,InterfaceTypeDefinition:n,UnionTypeDefinition:n,EnumTypeDefinition:n,InputObjectTypeDefinition:n};function n(i){var o=i.name.value;if(r!=null&&r.getType(o)){e.reportError(new jw.GraphQLError('Type "'.concat(o,'" already exists in the schema. It cannot also be defined in this type definition.'),i.name));return}return t[o]?e.reportError(new jw.GraphQLError('There can be only one type named "'.concat(o,'".'),[t[o],i.name])):t[o]=i.name,!1}}});var mm=v(hm=>{"use strict";p();Object.defineProperty(hm,"__esModule",{value:!0});hm.UniqueEnumValueNamesRule=JH;var Mw=Q(),zH=ce();function JH(e){var t=e.getSchema(),r=t?t.getTypeMap():Object.create(null),n=Object.create(null);return{EnumTypeDefinition:i,EnumTypeExtension:i};function i(o){var s,a=o.name.value;n[a]||(n[a]=Object.create(null));for(var u=(s=o.values)!==null&&s!==void 0?s:[],c=n[a],l=0;l<u.length;l++){var d=u[l],f=d.name.value,h=r[a];(0,zH.isEnumType)(h)&&h.getValue(f)?e.reportError(new Mw.GraphQLError('Enum value "'.concat(a,".").concat(f,'" already exists in the schema. It cannot also be defined in this type extension.'),d.name)):c[f]?e.reportError(new Mw.GraphQLError('Enum value "'.concat(a,".").concat(f,'" can only be defined once.'),[c[f],d.name])):c[f]=d.name}return!1}}});var vm=v(ym=>{"use strict";p();Object.defineProperty(ym,"__esModule",{value:!0});ym.UniqueFieldDefinitionNamesRule=YH;var Fw=Q(),gm=ce();function YH(e){var t=e.getSchema(),r=t?t.getTypeMap():Object.create(null),n=Object.create(null);return{InputObjectTypeDefinition:i,InputObjectTypeExtension:i,InterfaceTypeDefinition:i,InterfaceTypeExtension:i,ObjectTypeDefinition:i,ObjectTypeExtension:i};function i(o){var s,a=o.name.value;n[a]||(n[a]=Object.create(null));for(var u=(s=o.fields)!==null&&s!==void 0?s:[],c=n[a],l=0;l<u.length;l++){var d=u[l],f=d.name.value;XH(r[a],f)?e.reportError(new Fw.GraphQLError('Field "'.concat(a,".").concat(f,'" already exists in the schema. It cannot also be defined in this type extension.'),d.name)):c[f]?e.reportError(new Fw.GraphQLError('Field "'.concat(a,".").concat(f,'" can only be defined once.'),[c[f],d.name])):c[f]=d.name}return!1}}function XH(e,t){return(0,gm.isObjectType)(e)||(0,gm.isInterfaceType)(e)||(0,gm.isInputObjectType)(e)?e.getFields()[t]!=null:!1}});var _m=v(Em=>{"use strict";p();Object.defineProperty(Em,"__esModule",{value:!0});Em.UniqueDirectiveNamesRule=ZH;var qw=Q();function ZH(e){var t=Object.create(null),r=e.getSchema();return{DirectiveDefinition:function(i){var o=i.name.value;if(r!=null&&r.getDirective(o)){e.reportError(new qw.GraphQLError('Directive "@'.concat(o,'" already exists in the schema. It cannot be redefined.'),i.name));return}return t[o]?e.reportError(new qw.GraphQLError('There can be only one directive named "@'.concat(o,'".'),[t[o],i.name])):t[o]=i.name,!1}}}});var bm=v(Sm=>{"use strict";p();Object.defineProperty(Sm,"__esModule",{value:!0});Sm.PossibleTypeExtensionsRule=nK;var Vw=Rc(he()),Gw=Rc(ut()),eK=Rc(dn()),tK=Rc(fn()),Uw=Q(),De=we(),rK=ti(),to=ce(),Sn;function Rc(e){return e&&e.__esModule?e:{default:e}}function ro(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nK(e){for(var t=e.getSchema(),r=Object.create(null),n=0,i=e.getDocument().definitions;n<i.length;n++){var o=i[n];(0,rK.isTypeDefinitionNode)(o)&&(r[o.name.value]=o)}return{ScalarTypeExtension:s,ObjectTypeExtension:s,InterfaceTypeExtension:s,UnionTypeExtension:s,EnumTypeExtension:s,InputObjectTypeExtension:s};function s(a){var u=a.name.value,c=r[u],l=t?.getType(u),d;if(c?d=iK[c.kind]:l&&(d=oK(l)),d){if(d!==a.kind){var f=sK(a.kind);e.reportError(new Uw.GraphQLError("Cannot extend non-".concat(f,' type "').concat(u,'".'),c?[c,a]:a))}}else{var h=Object.keys(r);t&&(h=h.concat(Object.keys(t.getTypeMap())));var g=(0,tK.default)(u,h);e.reportError(new Uw.GraphQLError('Cannot extend type "'.concat(u,'" because it is not defined.')+(0,eK.default)(g),a.name))}}}var iK=(Sn={},ro(Sn,De.Kind.SCALAR_TYPE_DEFINITION,De.Kind.SCALAR_TYPE_EXTENSION),ro(Sn,De.Kind.OBJECT_TYPE_DEFINITION,De.Kind.OBJECT_TYPE_EXTENSION),ro(Sn,De.Kind.INTERFACE_TYPE_DEFINITION,De.Kind.INTERFACE_TYPE_EXTENSION),ro(Sn,De.Kind.UNION_TYPE_DEFINITION,De.Kind.UNION_TYPE_EXTENSION),ro(Sn,De.Kind.ENUM_TYPE_DEFINITION,De.Kind.ENUM_TYPE_EXTENSION),ro(Sn,De.Kind.INPUT_OBJECT_TYPE_DEFINITION,De.Kind.INPUT_OBJECT_TYPE_EXTENSION),Sn);function oK(e){if((0,to.isScalarType)(e))return De.Kind.SCALAR_TYPE_EXTENSION;if((0,to.isObjectType)(e))return De.Kind.OBJECT_TYPE_EXTENSION;if((0,to.isInterfaceType)(e))return De.Kind.INTERFACE_TYPE_EXTENSION;if((0,to.isUnionType)(e))return De.Kind.UNION_TYPE_EXTENSION;if((0,to.isEnumType)(e))return De.Kind.ENUM_TYPE_EXTENSION;if((0,to.isInputObjectType)(e))return De.Kind.INPUT_OBJECT_TYPE_EXTENSION;(0,Gw.default)(0,"Unexpected type: "+(0,Vw.default)(e))}function sK(e){switch(e){case De.Kind.SCALAR_TYPE_EXTENSION:return"scalar";case De.Kind.OBJECT_TYPE_EXTENSION:return"object";case De.Kind.INTERFACE_TYPE_EXTENSION:return"interface";case De.Kind.UNION_TYPE_EXTENSION:return"union";case De.Kind.ENUM_TYPE_EXTENSION:return"enum";case De.Kind.INPUT_OBJECT_TYPE_EXTENSION:return"input object"}(0,Gw.default)(0,"Unexpected kind: "+(0,Vw.default)(e))}});var Tm=v(bn=>{"use strict";p();Object.defineProperty(bn,"__esModule",{value:!0});bn.specifiedSDLRules=bn.specifiedRules=bn.recommendedRules=void 0;var aK=rh(),uK=ih(),cK=sh(),lK=uh(),$w=ph(),pK=fh(),dK=mh(),fK=yh(),hK=Eh(),mK=Sh(),gK=Th(),yK=wh(),vK=xh(),EK=Rh(),_K=Nh(),SK=Lh(),bK=jh(),Bw=Fh(),Hw=Vh(),Kw=Gh(),Qw=Bh(),TK=Kh(),Ww=Wh(),IK=Jh(),wK=nm(),zw=om(),OK=am(),AK=cm(),xK=pm(),CK=fm(),RK=mm(),PK=vm(),NK=_m(),DK=bm(),Jw=Object.freeze([OK.MaxIntrospectionDepthRule]);bn.recommendedRules=Jw;var LK=Object.freeze([aK.ExecutableDefinitionsRule,uK.UniqueOperationNamesRule,cK.LoneAnonymousOperationRule,lK.SingleFieldSubscriptionsRule,$w.KnownTypeNamesRule,pK.FragmentsOnCompositeTypesRule,dK.VariablesAreInputTypesRule,fK.ScalarLeafsRule,hK.FieldsOnCorrectTypeRule,mK.UniqueFragmentNamesRule,gK.KnownFragmentNamesRule,yK.NoUnusedFragmentsRule,vK.PossibleFragmentSpreadsRule,EK.NoFragmentCyclesRule,_K.UniqueVariableNamesRule,SK.NoUndefinedVariablesRule,bK.NoUnusedVariablesRule,Bw.KnownDirectivesRule,Hw.UniqueDirectivesPerLocationRule,Kw.KnownArgumentNamesRule,Qw.UniqueArgumentNamesRule,TK.ValuesOfCorrectTypeRule,Ww.ProvidedRequiredArgumentsRule,IK.VariablesInAllowedPositionRule,wK.OverlappingFieldsCanBeMergedRule,zw.UniqueInputFieldNamesRule].concat(Jw));bn.specifiedRules=LK;var kK=Object.freeze([AK.LoneSchemaDefinitionRule,xK.UniqueOperationTypesRule,CK.UniqueTypeNamesRule,RK.UniqueEnumValueNamesRule,PK.UniqueFieldDefinitionNamesRule,NK.UniqueDirectiveNamesRule,$w.KnownTypeNamesRule,Bw.KnownDirectivesRule,Hw.UniqueDirectivesPerLocationRule,DK.PossibleTypeExtensionsRule,Kw.KnownArgumentNamesOnDirectivesRule,Qw.UniqueArgumentNamesRule,zw.UniqueInputFieldNamesRule,Ww.ProvidedRequiredArgumentsOnDirectivesRule]);bn.specifiedSDLRules=kK});var wm=v(Tn=>{"use strict";p();Object.defineProperty(Tn,"__esModule",{value:!0});Tn.ValidationContext=Tn.SDLValidationContext=Tn.ASTValidationContext=void 0;var Yw=we(),jK=ln(),Xw=_c();function Zw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Im=(function(){function e(r,n){this._ast=r,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=n}var t=e.prototype;return t.reportError=function(n){this._onError(n)},t.getDocument=function(){return this._ast},t.getFragment=function(n){var i=this._fragments;return i||(this._fragments=i=this.getDocument().definitions.reduce(function(o,s){return s.kind===Yw.Kind.FRAGMENT_DEFINITION&&(o[s.name.value]=s),o},Object.create(null))),i[n]},t.getFragmentSpreads=function(n){var i=this._fragmentSpreads.get(n);if(!i){i=[];for(var o=[n];o.length!==0;)for(var s=o.pop(),a=0,u=s.selections;a<u.length;a++){var c=u[a];c.kind===Yw.Kind.FRAGMENT_SPREAD?i.push(c):c.selectionSet&&o.push(c.selectionSet)}this._fragmentSpreads.set(n,i)}return i},t.getRecursivelyReferencedFragments=function(n){var i=this._recursivelyReferencedFragments.get(n);if(!i){i=[];for(var o=Object.create(null),s=[n.selectionSet];s.length!==0;)for(var a=s.pop(),u=0,c=this.getFragmentSpreads(a);u<c.length;u++){var l=c[u],d=l.name.value;if(o[d]!==!0){o[d]=!0;var f=this.getFragment(d);f&&(i.push(f),s.push(f.selectionSet))}}this._recursivelyReferencedFragments.set(n,i)}return i},e})();Tn.ASTValidationContext=Im;var MK=(function(e){Zw(t,e);function t(n,i,o){var s;return s=e.call(this,n,o)||this,s._schema=i,s}var r=t.prototype;return r.getSchema=function(){return this._schema},t})(Im);Tn.SDLValidationContext=MK;var FK=(function(e){Zw(t,e);function t(n,i,o,s){var a;return a=e.call(this,i,s)||this,a._schema=n,a._typeInfo=o,a._variableUsages=new Map,a._recursiveVariableUsages=new Map,a}var r=t.prototype;return r.getSchema=function(){return this._schema},r.getVariableUsages=function(i){var o=this._variableUsages.get(i);if(!o){var s=[],a=new Xw.TypeInfo(this._schema);(0,jK.visit)(i,(0,Xw.visitWithTypeInfo)(a,{VariableDefinition:function(){return!1},Variable:function(c){s.push({node:c,type:a.getInputType(),defaultValue:a.getDefaultValue()})}})),o=s,this._variableUsages.set(i,o)}return o},r.getRecursiveVariableUsages=function(i){var o=this._recursiveVariableUsages.get(i);if(!o){o=this.getVariableUsages(i);for(var s=0,a=this.getRecursivelyReferencedFragments(i);s<a.length;s++){var u=a[s];o=o.concat(this.getVariableUsages(u))}this._recursiveVariableUsages.set(i,o)}return o},r.getType=function(){return this._typeInfo.getType()},r.getParentType=function(){return this._typeInfo.getParentType()},r.getInputType=function(){return this._typeInfo.getInputType()},r.getParentInputType=function(){return this._typeInfo.getParentInputType()},r.getFieldDef=function(){return this._typeInfo.getFieldDef()},r.getDirective=function(){return this._typeInfo.getDirective()},r.getArgument=function(){return this._typeInfo.getArgument()},r.getEnumValue=function(){return this._typeInfo.getEnumValue()},t})(Im);Tn.ValidationContext=FK});var io=v(no=>{"use strict";p();Object.defineProperty(no,"__esModule",{value:!0});no.validate=$K;no.validateSDL=Om;no.assertValidSDL=BK;no.assertValidSDLExtension=HK;var qK=GK(Yt()),UK=Q(),Pc=ln(),VK=Ds(),eO=_c(),tO=Tm(),rO=wm();function GK(e){return e&&e.__esModule?e:{default:e}}function $K(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tO.specifiedRules,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new eO.TypeInfo(e),i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{maxErrors:void 0};t||(0,qK.default)(0,"Must provide document."),(0,VK.assertValidSchema)(e);var o=Object.freeze({}),s=[],a=new rO.ValidationContext(e,t,n,function(c){if(i.maxErrors!=null&&s.length>=i.maxErrors)throw s.push(new UK.GraphQLError("Too many validation errors, error limit reached. Validation aborted.")),o;s.push(c)}),u=(0,Pc.visitInParallel)(r.map(function(c){return c(a)}));try{(0,Pc.visit)(t,(0,eO.visitWithTypeInfo)(n,u))}catch(c){if(c!==o)throw c}return s}function Om(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tO.specifiedSDLRules,n=[],i=new rO.SDLValidationContext(e,t,function(s){n.push(s)}),o=r.map(function(s){return s(i)});return(0,Pc.visit)(e,(0,Pc.visitInParallel)(o)),n}function BK(e){var t=Om(e);if(t.length!==0)throw new Error(t.map(function(r){return r.message}).join(`
76
+
77
+ `))}function HK(e,t){var r=Om(e,t);if(r.length!==0)throw new Error(r.map(function(n){return n.message}).join(`
78
+
79
+ `))}});var nO=v(Am=>{"use strict";p();Object.defineProperty(Am,"__esModule",{value:!0});Am.default=KK;function KK(e){var t;return function(n,i,o){t||(t=new WeakMap);var s=t.get(n),a;if(s){if(a=s.get(i),a){var u=a.get(o);if(u!==void 0)return u}}else s=new WeakMap,t.set(n,s);a||(a=new WeakMap,s.set(i,a));var c=e(n,i,o);return a.set(o,c),c}}});var iO=v(xm=>{"use strict";p();Object.defineProperty(xm,"__esModule",{value:!0});xm.default=zK;var QK=WK(xu());function WK(e){return e&&e.__esModule?e:{default:e}}function zK(e,t,r){return e.reduce(function(n,i){return(0,QK.default)(n)?n.then(function(o){return t(o,i)}):t(n,i)},r)}});var oO=v(Cm=>{"use strict";p();Object.defineProperty(Cm,"__esModule",{value:!0});Cm.default=JK;function JK(e){var t=Object.keys(e),r=t.map(function(n){return e[n]});return Promise.all(r).then(function(n){return n.reduce(function(i,o,s){return i[t[s]]=o,i},Object.create(null))})}});var Fs=v(Nc=>{"use strict";p();Object.defineProperty(Nc,"__esModule",{value:!0});Nc.addPath=YK;Nc.pathToArray=XK;function YK(e,t,r){return{prev:e,key:t,typename:r}}function XK(e){for(var t=[],r=e;r;)t.push(r.key),r=r.prev;return t.reverse()}});var Lc=v(Rm=>{"use strict";p();Object.defineProperty(Rm,"__esModule",{value:!0});Rm.getOperationRootType=ZK;var Dc=Q();function ZK(e,t){if(t.operation==="query"){var r=e.getQueryType();if(!r)throw new Dc.GraphQLError("Schema does not define the required query root type.",t);return r}if(t.operation==="mutation"){var n=e.getMutationType();if(!n)throw new Dc.GraphQLError("Schema is not configured for mutations.",t);return n}if(t.operation==="subscription"){var i=e.getSubscriptionType();if(!i)throw new Dc.GraphQLError("Schema is not configured for subscriptions.",t);return i}throw new Dc.GraphQLError("Can only have query, mutation and subscription operations.",t)}});var Nm=v(Pm=>{"use strict";p();Object.defineProperty(Pm,"__esModule",{value:!0});Pm.default=eQ;function eQ(e){return e.map(function(t){return typeof t=="number"?"["+t.toString()+"]":"."+t}).join("")}});var Us=v(Dm=>{"use strict";p();Object.defineProperty(Dm,"__esModule",{value:!0});Dm.valueFromAST=qs;var tQ=kc(Lt()),rQ=kc(pn()),nQ=kc(he()),iQ=kc(ut()),oo=we(),ii=ce();function kc(e){return e&&e.__esModule?e:{default:e}}function qs(e,t,r){if(e){if(e.kind===oo.Kind.VARIABLE){var n=e.name.value;if(r==null||r[n]===void 0)return;var i=r[n];return i===null&&(0,ii.isNonNullType)(t)?void 0:i}if((0,ii.isNonNullType)(t))return e.kind===oo.Kind.NULL?void 0:qs(e,t.ofType,r);if(e.kind===oo.Kind.NULL)return null;if((0,ii.isListType)(t)){var o=t.ofType;if(e.kind===oo.Kind.LIST){for(var s=[],a=0,u=e.values;a<u.length;a++){var c=u[a];if(sO(c,r)){if((0,ii.isNonNullType)(o))return;s.push(null)}else{var l=qs(c,o,r);if(l===void 0)return;s.push(l)}}return s}var d=qs(e,o,r);return d===void 0?void 0:[d]}if((0,ii.isInputObjectType)(t)){if(e.kind!==oo.Kind.OBJECT)return;for(var f=Object.create(null),h=(0,rQ.default)(e.fields,function(O){return O.name.value}),g=0,y=(0,tQ.default)(t.getFields());g<y.length;g++){var _=y[g],b=h[_.name];if(!b||sO(b.value,r)){if(_.defaultValue!==void 0)f[_.name]=_.defaultValue;else if((0,ii.isNonNullType)(_.type))return;continue}var S=qs(b.value,_.type,r);if(S===void 0)return;f[_.name]=S}return f}if((0,ii.isLeafType)(t)){var I;try{I=t.parseLiteral(e,r)}catch{return}return I===void 0?void 0:I}(0,iQ.default)(0,"Unexpected input type: "+(0,nQ.default)(t))}}function sO(e,t){return e.kind===oo.Kind.VARIABLE&&(t==null||t[e.name.value]===void 0)}});var km=v(Lm=>{"use strict";p();Object.defineProperty(Lm,"__esModule",{value:!0});Lm.coerceInputValue=hQ;var oQ=In(Lt()),jc=In(he()),sQ=In(ut()),aQ=In(dn()),uQ=In(Sr()),cQ=In(pc()),lQ=In(fn()),pQ=In(Nm()),Gr=Fs(),oi=Q(),Vs=ce();function In(e){return e&&e.__esModule?e:{default:e}}function aO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dQ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aO(Object(r),!0).forEach(function(n){fQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fQ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hQ(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mQ;return Gs(e,t,r)}function mQ(e,t,r){var n="Invalid value "+(0,jc.default)(t);throw e.length>0&&(n+=' at "value'.concat((0,pQ.default)(e),'"')),r.message=n+": "+r.message,r}function Gs(e,t,r,n){if((0,Vs.isNonNullType)(t)){if(e!=null)return Gs(e,t.ofType,r,n);r((0,Gr.pathToArray)(n),e,new oi.GraphQLError('Expected non-nullable type "'.concat((0,jc.default)(t),'" not to be null.')));return}if(e==null)return null;if((0,Vs.isListType)(t)){var i=t.ofType,o=(0,cQ.default)(e,function(S,I){var O=(0,Gr.addPath)(n,I,void 0);return Gs(S,i,r,O)});return o??[Gs(e,i,r,n)]}if((0,Vs.isInputObjectType)(t)){if(!(0,uQ.default)(e)){r((0,Gr.pathToArray)(n),e,new oi.GraphQLError('Expected type "'.concat(t.name,'" to be an object.')));return}for(var s=Object.create(null),a=t.getFields(),u=0,c=(0,oQ.default)(a);u<c.length;u++){var l=c[u],d=e[l.name];if(d===void 0){if(l.defaultValue!==void 0)s[l.name]=l.defaultValue;else if((0,Vs.isNonNullType)(l.type)){var f=(0,jc.default)(l.type);r((0,Gr.pathToArray)(n),e,new oi.GraphQLError('Field "'.concat(l.name,'" of required type "').concat(f,'" was not provided.')))}continue}s[l.name]=Gs(d,l.type,r,(0,Gr.addPath)(n,l.name,t.name))}for(var h=0,g=Object.keys(e);h<g.length;h++){var y=g[h];if(!a[y]){var _=(0,lQ.default)(y,Object.keys(t.getFields()));r((0,Gr.pathToArray)(n),e,new oi.GraphQLError('Field "'.concat(y,'" is not defined by type "').concat(t.name,'".')+(0,aQ.default)(_)))}}return dQ({},s)}if((0,Vs.isLeafType)(t)){var b;try{b=t.parseValue(e)}catch(S){S instanceof oi.GraphQLError?r((0,Gr.pathToArray)(n),e,S):r((0,Gr.pathToArray)(n),e,new oi.GraphQLError('Expected type "'.concat(t.name,'". ')+S.message,void 0,void 0,void 0,void 0,S));return}return b===void 0&&r((0,Gr.pathToArray)(n),e,new oi.GraphQLError('Expected type "'.concat(t.name,'".'))),b}(0,sQ.default)(0,"Unexpected input type: "+(0,jc.default)(t))}});var Bs=v($s=>{"use strict";p();Object.defineProperty($s,"__esModule",{value:!0});$s.getVariableValues=bQ;$s.getArgumentValues=fO;$s.getDirectiveValues=IQ;var gQ=Mc(Hi()),yQ=Mc(pn()),so=Mc(he()),vQ=Mc(Nm()),$r=Q(),uO=we(),lO=wt(),ao=ce(),EQ=Or(),pO=Us(),_Q=km();function Mc(e){return e&&e.__esModule?e:{default:e}}function cO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cO(Object(r),!0).forEach(function(n){SQ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function SQ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bQ(e,t,r,n){var i=[],o=n?.maxErrors;try{var s=TQ(e,t,r,function(a){if(o!=null&&i.length>=o)throw new $r.GraphQLError("Too many errors processing variables, error limit reached. Execution aborted.");i.push(a)});if(i.length===0)return{coerced:s}}catch(a){i.push(a)}return{errors:i}}function TQ(e,t,r,n){for(var i=Object.create(null),o=function(c){var l=t[c],d=l.variable.name.value,f=(0,EQ.typeFromAST)(e,l.type);if(!(0,ao.isInputType)(f)){var h=(0,lO.print)(l.type);return n(new $r.GraphQLError('Variable "$'.concat(d,'" expected value of type "').concat(h,'" which cannot be used as an input type.'),l.type)),"continue"}if(!hO(r,d)){if(l.defaultValue)i[d]=(0,pO.valueFromAST)(l.defaultValue,f);else if((0,ao.isNonNullType)(f)){var g=(0,so.default)(f);n(new $r.GraphQLError('Variable "$'.concat(d,'" of required type "').concat(g,'" was not provided.'),l))}return"continue"}var y=r[d];if(y===null&&(0,ao.isNonNullType)(f)){var _=(0,so.default)(f);return n(new $r.GraphQLError('Variable "$'.concat(d,'" of non-null type "').concat(_,'" must not be null.'),l)),"continue"}i[d]=(0,_Q.coerceInputValue)(y,f,function(b,S,I){var O='Variable "$'.concat(d,'" got invalid value ')+(0,so.default)(S);b.length>0&&(O+=' at "'.concat(d).concat((0,vQ.default)(b),'"')),n(new $r.GraphQLError(O+"; "+I.message,l,void 0,void 0,void 0,I.originalError))})},s=0;s<t.length;s++)var a=o(s);return dO({},i)}function fO(e,t,r){for(var n,i=Object.create(null),o=(n=t.arguments)!==null&&n!==void 0?n:[],s=(0,yQ.default)(o,function(b){return b.name.value}),a=0,u=e.args;a<u.length;a++){var c=u[a],l=c.name,d=c.type,f=s[l];if(!f){if(c.defaultValue!==void 0)i[l]=c.defaultValue;else if((0,ao.isNonNullType)(d))throw new $r.GraphQLError('Argument "'.concat(l,'" of required type "').concat((0,so.default)(d),'" ')+"was not provided.",t);continue}var h=f.value,g=h.kind===uO.Kind.NULL;if(h.kind===uO.Kind.VARIABLE){var y=h.name.value;if(r==null||!hO(r,y)){if(c.defaultValue!==void 0)i[l]=c.defaultValue;else if((0,ao.isNonNullType)(d))throw new $r.GraphQLError('Argument "'.concat(l,'" of required type "').concat((0,so.default)(d),'" ')+'was provided the variable "$'.concat(y,'" which was not provided a runtime value.'),h);continue}g=r[y]==null}if(g&&(0,ao.isNonNullType)(d))throw new $r.GraphQLError('Argument "'.concat(l,'" of non-null type "').concat((0,so.default)(d),'" ')+"must not be null.",h);var _=(0,pO.valueFromAST)(h,d,r);if(_===void 0)throw new $r.GraphQLError('Argument "'.concat(l,'" has invalid value ').concat((0,lO.print)(h),"."),h);i[l]=_}return dO({},i)}function IQ(e,t,r){var n=t.directives&&(0,gQ.default)(t.directives,function(i){return i.name.value===e.name});if(n)return fO(e,n,r)}function hO(e,t){return Object.prototype.hasOwnProperty.call(e,t)}});var Ws=v(jt=>{"use strict";p();Object.defineProperty(jt,"__esModule",{value:!0});jt.execute=NQ;jt.executeSync=DQ;jt.assertValidExecutionArguments=TO;jt.buildExecutionContext=IO;jt.collectFields=Ks;jt.buildResolveInfo=AO;jt.getFieldDef=RO;jt.defaultFieldResolver=jt.defaultTypeResolver=void 0;var co=Hr(he()),wQ=Hr(nO()),OQ=Hr(ut()),mO=Hr(Yt()),tr=Hr(xu()),qm=Hr(Sr()),AQ=Hr(pc()),xQ=Hr(iO()),gO=Hr(oO()),si=Fs(),xr=Q(),Fc=gs(),Hs=we(),CQ=Ds(),uo=er(),yO=Ot(),Br=ce(),RQ=Or(),PQ=Lc(),qc=Bs();function Hr(e){return e&&e.__esModule?e:{default:e}}function NQ(e,t,r,n,i,o,s,a){return arguments.length===1?Mm(e):Mm({schema:e,document:t,rootValue:r,contextValue:n,variableValues:i,operationName:o,fieldResolver:s,typeResolver:a})}function DQ(e){var t=Mm(e);if((0,tr.default)(t))throw new Error("GraphQL execution failed to complete synchronously.");return t}function Mm(e){var t=e.schema,r=e.document,n=e.rootValue,i=e.contextValue,o=e.variableValues,s=e.operationName,a=e.fieldResolver,u=e.typeResolver;TO(t,r,o);var c=IO(t,r,n,i,o,s,a,u);if(Array.isArray(c))return{errors:c};var l=LQ(c,c.operation,n);return bO(c,l)}function bO(e,t){return(0,tr.default)(t)?t.then(function(r){return bO(e,r)}):e.errors.length===0?{data:t}:{errors:e.errors,data:t}}function TO(e,t,r){t||(0,mO.default)(0,"Must provide document."),(0,CQ.assertValidSchema)(e),r==null||(0,qm.default)(r)||(0,mO.default)(0,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}function IO(e,t,r,n,i,o,s,a){for(var u,c,l,d=Object.create(null),f=0,h=t.definitions;f<h.length;f++){var g=h[f];switch(g.kind){case Hs.Kind.OPERATION_DEFINITION:if(o==null){if(l!==void 0)return[new xr.GraphQLError("Must provide operation name if query contains multiple operations.")];l=g}else((u=g.name)===null||u===void 0?void 0:u.value)===o&&(l=g);break;case Hs.Kind.FRAGMENT_DEFINITION:d[g.name.value]=g;break}}if(!l)return o!=null?[new xr.GraphQLError('Unknown operation named "'.concat(o,'".'))]:[new xr.GraphQLError("Must provide an operation.")];var y=(c=l.variableDefinitions)!==null&&c!==void 0?c:[],_=(0,qc.getVariableValues)(e,y,i??{},{maxErrors:50});return _.errors?_.errors:{schema:e,fragments:d,rootValue:r,contextValue:n,operation:l,variableValues:_.coerced,fieldResolver:s??CO,typeResolver:a??xO,errors:[]}}function LQ(e,t,r){var n=(0,PQ.getOperationRootType)(e.schema,t),i=Ks(e,n,t.selectionSet,Object.create(null),Object.create(null)),o=void 0;try{var s=t.operation==="mutation"?kQ(e,n,r,o,i):wO(e,n,r,o,i);return(0,tr.default)(s)?s.then(void 0,function(a){return e.errors.push(a),Promise.resolve(null)}):s}catch(a){return e.errors.push(a),null}}function kQ(e,t,r,n,i){return(0,xQ.default)(Object.keys(i),function(o,s){var a=i[s],u=(0,si.addPath)(n,s,t.name),c=OO(e,t,r,a,u);return c===void 0?o:(0,tr.default)(c)?c.then(function(l){return o[s]=l,o}):(o[s]=c,o)},Object.create(null))}function wO(e,t,r,n,i){var o=Object.create(null),s=!1;try{for(var a=0,u=Object.keys(i);a<u.length;a++){var c=u[a],l=i[c],d=(0,si.addPath)(n,c,t.name),f=OO(e,t,r,l,d);f!==void 0&&(o[c]=f,(0,tr.default)(f)&&(s=!0))}}catch(h){if(s)return(0,gO.default)(o).finally(function(){throw h});throw h}return s?(0,gO.default)(o):o}function Ks(e,t,r,n,i){for(var o=0,s=r.selections;o<s.length;o++){var a=s[o];switch(a.kind){case Hs.Kind.FIELD:{if(!jm(e,a))continue;var u=jQ(a);n[u]||(n[u]=[]),n[u].push(a);break}case Hs.Kind.INLINE_FRAGMENT:{if(!jm(e,a)||!vO(e,a,t))continue;Ks(e,t,a.selectionSet,n,i);break}case Hs.Kind.FRAGMENT_SPREAD:{var c=a.name.value;if(i[c]||!jm(e,a))continue;i[c]=!0;var l=e.fragments[c];if(!l||!vO(e,l,t))continue;Ks(e,t,l.selectionSet,n,i);break}}}return n}function jm(e,t){var r=(0,qc.getDirectiveValues)(yO.GraphQLSkipDirective,t,e.variableValues);if(r?.if===!0)return!1;var n=(0,qc.getDirectiveValues)(yO.GraphQLIncludeDirective,t,e.variableValues);return n?.if!==!1}function vO(e,t,r){var n=t.typeCondition;if(!n)return!0;var i=(0,RQ.typeFromAST)(e.schema,n);return i===r?!0:(0,Br.isAbstractType)(i)?e.schema.isSubType(i,r):!1}function jQ(e){return e.alias?e.alias.value:e.name.value}function OO(e,t,r,n,i){var o,s=n[0],a=s.name.value,u=RO(e.schema,t,a);if(u){var c=u.type,l=(o=u.resolve)!==null&&o!==void 0?o:e.fieldResolver,d=AO(e,u,n,t,i);try{var f=(0,qc.getArgumentValues)(u,n[0],e.variableValues),h=e.contextValue,g=l(r,f,h,d),y;return(0,tr.default)(g)?y=g.then(function(b){return Qs(e,c,n,d,i,b)}):y=Qs(e,c,n,d,i,g),(0,tr.default)(y)?y.then(void 0,function(b){var S=(0,Fc.locatedError)(b,n,(0,si.pathToArray)(i));return Uc(S,c,e)}):y}catch(b){var _=(0,Fc.locatedError)(b,n,(0,si.pathToArray)(i));return Uc(_,c,e)}}}function AO(e,t,r,n,i){return{fieldName:t.name,fieldNodes:r,returnType:t.type,parentType:n,path:i,schema:e.schema,fragments:e.fragments,rootValue:e.rootValue,operation:e.operation,variableValues:e.variableValues}}function Uc(e,t,r){if((0,Br.isNonNullType)(t))throw e;return r.errors.push(e),null}function Qs(e,t,r,n,i,o){if(o instanceof Error)throw o;if((0,Br.isNonNullType)(t)){var s=Qs(e,t.ofType,r,n,i,o);if(s===null)throw new Error("Cannot return null for non-nullable field ".concat(n.parentType.name,".").concat(n.fieldName,"."));return s}if(o==null)return null;if((0,Br.isListType)(t))return MQ(e,t,r,n,i,o);if((0,Br.isLeafType)(t))return FQ(t,o);if((0,Br.isAbstractType)(t))return qQ(e,t,r,n,i,o);if((0,Br.isObjectType)(t))return Fm(e,t,r,n,i,o);(0,OQ.default)(0,"Cannot complete value of unexpected output type: "+(0,co.default)(t))}function MQ(e,t,r,n,i,o){var s=t.ofType,a=!1,u=(0,AQ.default)(o,function(c,l){var d=(0,si.addPath)(i,l,void 0);try{var f;return(0,tr.default)(c)?f=c.then(function(g){return Qs(e,s,r,n,d,g)}):f=Qs(e,s,r,n,d,c),(0,tr.default)(f)?(a=!0,f.then(void 0,function(g){var y=(0,Fc.locatedError)(g,r,(0,si.pathToArray)(d));return Uc(y,s,e)})):f}catch(g){var h=(0,Fc.locatedError)(g,r,(0,si.pathToArray)(d));return Uc(h,s,e)}});if(u==null)throw new xr.GraphQLError('Expected Iterable, but did not find one for field "'.concat(n.parentType.name,".").concat(n.fieldName,'".'));return a?Promise.all(u):u}function FQ(e,t){var r=e.serialize(t);if(r===void 0)throw new Error('Expected a value of type "'.concat((0,co.default)(e),'" but ')+"received: ".concat((0,co.default)(t)));return r}function qQ(e,t,r,n,i,o){var s,a=(s=t.resolveType)!==null&&s!==void 0?s:e.typeResolver,u=e.contextValue,c=a(o,u,n,t);return(0,tr.default)(c)?c.then(function(l){return Fm(e,EO(l,e,t,r,n,o),r,n,i,o)}):Fm(e,EO(c,e,t,r,n,o),r,n,i,o)}function EO(e,t,r,n,i,o){if(e==null)throw new xr.GraphQLError('Abstract type "'.concat(r.name,'" must resolve to an Object type at runtime for field "').concat(i.parentType.name,".").concat(i.fieldName,'". Either the "').concat(r.name,'" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.'),n);var s=(0,Br.isNamedType)(e)?e.name:e;if(typeof s!="string")throw new xr.GraphQLError('Abstract type "'.concat(r.name,'" must resolve to an Object type at runtime for field "').concat(i.parentType.name,".").concat(i.fieldName,'" with ')+"value ".concat((0,co.default)(o),', received "').concat((0,co.default)(e),'".'));var a=t.schema.getType(s);if(a==null)throw new xr.GraphQLError('Abstract type "'.concat(r.name,'" was resolve to a type "').concat(s,'" that does not exist inside schema.'),n);if(!(0,Br.isObjectType)(a))throw new xr.GraphQLError('Abstract type "'.concat(r.name,'" was resolve to a non-object type "').concat(s,'".'),n);if(!t.schema.isSubType(r,a))throw new xr.GraphQLError('Runtime Object type "'.concat(a.name,'" is not a possible type for "').concat(r.name,'".'),n);return a}function Fm(e,t,r,n,i,o){if(t.isTypeOf){var s=t.isTypeOf(o,e.contextValue,n);if((0,tr.default)(s))return s.then(function(a){if(!a)throw _O(t,o,r);return SO(e,t,r,i,o)});if(!s)throw _O(t,o,r)}return SO(e,t,r,i,o)}function _O(e,t,r){return new xr.GraphQLError('Expected value of type "'.concat(e.name,'" but got: ').concat((0,co.default)(t),"."),r)}function SO(e,t,r,n,i){var o=UQ(e,t,r);return wO(e,t,i,n,o)}var UQ=(0,wQ.default)(VQ);function VQ(e,t,r){for(var n=Object.create(null),i=Object.create(null),o=0;o<r.length;o++){var s=r[o];s.selectionSet&&(n=Ks(e,t,s.selectionSet,n,i))}return n}var xO=function(t,r,n,i){if((0,qm.default)(t)&&typeof t.__typename=="string")return t.__typename;for(var o=n.schema.getPossibleTypes(i),s=[],a=0;a<o.length;a++){var u=o[a];if(u.isTypeOf){var c=u.isTypeOf(t,r,n);if((0,tr.default)(c))s[a]=c;else if(c)return u.name}}if(s.length)return Promise.all(s).then(function(l){for(var d=0;d<l.length;d++)if(l[d])return o[d].name})};jt.defaultTypeResolver=xO;var CO=function(t,r,n,i){if((0,qm.default)(t)||typeof t=="function"){var o=t[i.fieldName];return typeof o=="function"?t[i.fieldName](r,n,i):o}};jt.defaultFieldResolver=CO;function RO(e,t,r){return r===uo.SchemaMetaFieldDef.name&&e.getQueryType()===t?uo.SchemaMetaFieldDef:r===uo.TypeMetaFieldDef.name&&e.getQueryType()===t?uo.TypeMetaFieldDef:r===uo.TypeNameMetaFieldDef.name?uo.TypeNameMetaFieldDef:t.getFields()[r]}});var PO=v(Gc=>{"use strict";p();Object.defineProperty(Gc,"__esModule",{value:!0});Gc.graphql=WQ;Gc.graphqlSync=zQ;var GQ=QQ(xu()),$Q=$i(),BQ=io(),HQ=Ds(),KQ=Ws();function QQ(e){return e&&e.__esModule?e:{default:e}}function WQ(e,t,r,n,i,o,s,a){var u=arguments;return new Promise(function(c){return c(u.length===1?Vc(e):Vc({schema:e,source:t,rootValue:r,contextValue:n,variableValues:i,operationName:o,fieldResolver:s,typeResolver:a}))})}function zQ(e,t,r,n,i,o,s,a){var u=arguments.length===1?Vc(e):Vc({schema:e,source:t,rootValue:r,contextValue:n,variableValues:i,operationName:o,fieldResolver:s,typeResolver:a});if((0,GQ.default)(u))throw new Error("GraphQL execution failed to complete synchronously.");return u}function Vc(e){var t=e.schema,r=e.source,n=e.rootValue,i=e.contextValue,o=e.variableValues,s=e.operationName,a=e.fieldResolver,u=e.typeResolver,c=(0,HQ.validateSchema)(t);if(c.length>0)return{errors:c};var l;try{l=(0,$Q.parse)(r)}catch(f){return{errors:[f]}}var d=(0,BQ.validate)(t,l);return d.length>0?{errors:d}:(0,KQ.execute)({schema:t,document:l,rootValue:n,contextValue:i,variableValues:o,operationName:s,fieldResolver:a,typeResolver:u})}});var DO=v(R=>{"use strict";p();Object.defineProperty(R,"__esModule",{value:!0});Object.defineProperty(R,"isSchema",{enumerable:!0,get:function(){return Um.isSchema}});Object.defineProperty(R,"assertSchema",{enumerable:!0,get:function(){return Um.assertSchema}});Object.defineProperty(R,"GraphQLSchema",{enumerable:!0,get:function(){return Um.GraphQLSchema}});Object.defineProperty(R,"isType",{enumerable:!0,get:function(){return J.isType}});Object.defineProperty(R,"isScalarType",{enumerable:!0,get:function(){return J.isScalarType}});Object.defineProperty(R,"isObjectType",{enumerable:!0,get:function(){return J.isObjectType}});Object.defineProperty(R,"isInterfaceType",{enumerable:!0,get:function(){return J.isInterfaceType}});Object.defineProperty(R,"isUnionType",{enumerable:!0,get:function(){return J.isUnionType}});Object.defineProperty(R,"isEnumType",{enumerable:!0,get:function(){return J.isEnumType}});Object.defineProperty(R,"isInputObjectType",{enumerable:!0,get:function(){return J.isInputObjectType}});Object.defineProperty(R,"isListType",{enumerable:!0,get:function(){return J.isListType}});Object.defineProperty(R,"isNonNullType",{enumerable:!0,get:function(){return J.isNonNullType}});Object.defineProperty(R,"isInputType",{enumerable:!0,get:function(){return J.isInputType}});Object.defineProperty(R,"isOutputType",{enumerable:!0,get:function(){return J.isOutputType}});Object.defineProperty(R,"isLeafType",{enumerable:!0,get:function(){return J.isLeafType}});Object.defineProperty(R,"isCompositeType",{enumerable:!0,get:function(){return J.isCompositeType}});Object.defineProperty(R,"isAbstractType",{enumerable:!0,get:function(){return J.isAbstractType}});Object.defineProperty(R,"isWrappingType",{enumerable:!0,get:function(){return J.isWrappingType}});Object.defineProperty(R,"isNullableType",{enumerable:!0,get:function(){return J.isNullableType}});Object.defineProperty(R,"isNamedType",{enumerable:!0,get:function(){return J.isNamedType}});Object.defineProperty(R,"isRequiredArgument",{enumerable:!0,get:function(){return J.isRequiredArgument}});Object.defineProperty(R,"isRequiredInputField",{enumerable:!0,get:function(){return J.isRequiredInputField}});Object.defineProperty(R,"assertType",{enumerable:!0,get:function(){return J.assertType}});Object.defineProperty(R,"assertScalarType",{enumerable:!0,get:function(){return J.assertScalarType}});Object.defineProperty(R,"assertObjectType",{enumerable:!0,get:function(){return J.assertObjectType}});Object.defineProperty(R,"assertInterfaceType",{enumerable:!0,get:function(){return J.assertInterfaceType}});Object.defineProperty(R,"assertUnionType",{enumerable:!0,get:function(){return J.assertUnionType}});Object.defineProperty(R,"assertEnumType",{enumerable:!0,get:function(){return J.assertEnumType}});Object.defineProperty(R,"assertInputObjectType",{enumerable:!0,get:function(){return J.assertInputObjectType}});Object.defineProperty(R,"assertListType",{enumerable:!0,get:function(){return J.assertListType}});Object.defineProperty(R,"assertNonNullType",{enumerable:!0,get:function(){return J.assertNonNullType}});Object.defineProperty(R,"assertInputType",{enumerable:!0,get:function(){return J.assertInputType}});Object.defineProperty(R,"assertOutputType",{enumerable:!0,get:function(){return J.assertOutputType}});Object.defineProperty(R,"assertLeafType",{enumerable:!0,get:function(){return J.assertLeafType}});Object.defineProperty(R,"assertCompositeType",{enumerable:!0,get:function(){return J.assertCompositeType}});Object.defineProperty(R,"assertAbstractType",{enumerable:!0,get:function(){return J.assertAbstractType}});Object.defineProperty(R,"assertWrappingType",{enumerable:!0,get:function(){return J.assertWrappingType}});Object.defineProperty(R,"assertNullableType",{enumerable:!0,get:function(){return J.assertNullableType}});Object.defineProperty(R,"assertNamedType",{enumerable:!0,get:function(){return J.assertNamedType}});Object.defineProperty(R,"getNullableType",{enumerable:!0,get:function(){return J.getNullableType}});Object.defineProperty(R,"getNamedType",{enumerable:!0,get:function(){return J.getNamedType}});Object.defineProperty(R,"GraphQLScalarType",{enumerable:!0,get:function(){return J.GraphQLScalarType}});Object.defineProperty(R,"GraphQLObjectType",{enumerable:!0,get:function(){return J.GraphQLObjectType}});Object.defineProperty(R,"GraphQLInterfaceType",{enumerable:!0,get:function(){return J.GraphQLInterfaceType}});Object.defineProperty(R,"GraphQLUnionType",{enumerable:!0,get:function(){return J.GraphQLUnionType}});Object.defineProperty(R,"GraphQLEnumType",{enumerable:!0,get:function(){return J.GraphQLEnumType}});Object.defineProperty(R,"GraphQLInputObjectType",{enumerable:!0,get:function(){return J.GraphQLInputObjectType}});Object.defineProperty(R,"GraphQLList",{enumerable:!0,get:function(){return J.GraphQLList}});Object.defineProperty(R,"GraphQLNonNull",{enumerable:!0,get:function(){return J.GraphQLNonNull}});Object.defineProperty(R,"isDirective",{enumerable:!0,get:function(){return Cr.isDirective}});Object.defineProperty(R,"assertDirective",{enumerable:!0,get:function(){return Cr.assertDirective}});Object.defineProperty(R,"GraphQLDirective",{enumerable:!0,get:function(){return Cr.GraphQLDirective}});Object.defineProperty(R,"isSpecifiedDirective",{enumerable:!0,get:function(){return Cr.isSpecifiedDirective}});Object.defineProperty(R,"specifiedDirectives",{enumerable:!0,get:function(){return Cr.specifiedDirectives}});Object.defineProperty(R,"GraphQLIncludeDirective",{enumerable:!0,get:function(){return Cr.GraphQLIncludeDirective}});Object.defineProperty(R,"GraphQLSkipDirective",{enumerable:!0,get:function(){return Cr.GraphQLSkipDirective}});Object.defineProperty(R,"GraphQLDeprecatedDirective",{enumerable:!0,get:function(){return Cr.GraphQLDeprecatedDirective}});Object.defineProperty(R,"GraphQLSpecifiedByDirective",{enumerable:!0,get:function(){return Cr.GraphQLSpecifiedByDirective}});Object.defineProperty(R,"DEFAULT_DEPRECATION_REASON",{enumerable:!0,get:function(){return Cr.DEFAULT_DEPRECATION_REASON}});Object.defineProperty(R,"isSpecifiedScalarType",{enumerable:!0,get:function(){return ai.isSpecifiedScalarType}});Object.defineProperty(R,"specifiedScalarTypes",{enumerable:!0,get:function(){return ai.specifiedScalarTypes}});Object.defineProperty(R,"GraphQLInt",{enumerable:!0,get:function(){return ai.GraphQLInt}});Object.defineProperty(R,"GraphQLFloat",{enumerable:!0,get:function(){return ai.GraphQLFloat}});Object.defineProperty(R,"GraphQLString",{enumerable:!0,get:function(){return ai.GraphQLString}});Object.defineProperty(R,"GraphQLBoolean",{enumerable:!0,get:function(){return ai.GraphQLBoolean}});Object.defineProperty(R,"GraphQLID",{enumerable:!0,get:function(){return ai.GraphQLID}});Object.defineProperty(R,"isIntrospectionType",{enumerable:!0,get:function(){return xt.isIntrospectionType}});Object.defineProperty(R,"introspectionTypes",{enumerable:!0,get:function(){return xt.introspectionTypes}});Object.defineProperty(R,"__Schema",{enumerable:!0,get:function(){return xt.__Schema}});Object.defineProperty(R,"__Directive",{enumerable:!0,get:function(){return xt.__Directive}});Object.defineProperty(R,"__DirectiveLocation",{enumerable:!0,get:function(){return xt.__DirectiveLocation}});Object.defineProperty(R,"__Type",{enumerable:!0,get:function(){return xt.__Type}});Object.defineProperty(R,"__Field",{enumerable:!0,get:function(){return xt.__Field}});Object.defineProperty(R,"__InputValue",{enumerable:!0,get:function(){return xt.__InputValue}});Object.defineProperty(R,"__EnumValue",{enumerable:!0,get:function(){return xt.__EnumValue}});Object.defineProperty(R,"__TypeKind",{enumerable:!0,get:function(){return xt.__TypeKind}});Object.defineProperty(R,"TypeKind",{enumerable:!0,get:function(){return xt.TypeKind}});Object.defineProperty(R,"SchemaMetaFieldDef",{enumerable:!0,get:function(){return xt.SchemaMetaFieldDef}});Object.defineProperty(R,"TypeMetaFieldDef",{enumerable:!0,get:function(){return xt.TypeMetaFieldDef}});Object.defineProperty(R,"TypeNameMetaFieldDef",{enumerable:!0,get:function(){return xt.TypeNameMetaFieldDef}});Object.defineProperty(R,"validateSchema",{enumerable:!0,get:function(){return NO.validateSchema}});Object.defineProperty(R,"assertValidSchema",{enumerable:!0,get:function(){return NO.assertValidSchema}});var Um=Zn(),J=ce(),Cr=Ot(),ai=wr(),xt=er(),NO=Ds()});var jO=v(Ie=>{"use strict";p();Object.defineProperty(Ie,"__esModule",{value:!0});Object.defineProperty(Ie,"Source",{enumerable:!0,get:function(){return JQ.Source}});Object.defineProperty(Ie,"getLocation",{enumerable:!0,get:function(){return YQ.getLocation}});Object.defineProperty(Ie,"printLocation",{enumerable:!0,get:function(){return LO.printLocation}});Object.defineProperty(Ie,"printSourceLocation",{enumerable:!0,get:function(){return LO.printSourceLocation}});Object.defineProperty(Ie,"Kind",{enumerable:!0,get:function(){return XQ.Kind}});Object.defineProperty(Ie,"TokenKind",{enumerable:!0,get:function(){return ZQ.TokenKind}});Object.defineProperty(Ie,"Lexer",{enumerable:!0,get:function(){return eW.Lexer}});Object.defineProperty(Ie,"parse",{enumerable:!0,get:function(){return Vm.parse}});Object.defineProperty(Ie,"parseValue",{enumerable:!0,get:function(){return Vm.parseValue}});Object.defineProperty(Ie,"parseType",{enumerable:!0,get:function(){return Vm.parseType}});Object.defineProperty(Ie,"print",{enumerable:!0,get:function(){return tW.print}});Object.defineProperty(Ie,"visit",{enumerable:!0,get:function(){return $c.visit}});Object.defineProperty(Ie,"visitInParallel",{enumerable:!0,get:function(){return $c.visitInParallel}});Object.defineProperty(Ie,"getVisitFn",{enumerable:!0,get:function(){return $c.getVisitFn}});Object.defineProperty(Ie,"BREAK",{enumerable:!0,get:function(){return $c.BREAK}});Object.defineProperty(Ie,"Location",{enumerable:!0,get:function(){return kO.Location}});Object.defineProperty(Ie,"Token",{enumerable:!0,get:function(){return kO.Token}});Object.defineProperty(Ie,"isDefinitionNode",{enumerable:!0,get:function(){return Kr.isDefinitionNode}});Object.defineProperty(Ie,"isExecutableDefinitionNode",{enumerable:!0,get:function(){return Kr.isExecutableDefinitionNode}});Object.defineProperty(Ie,"isSelectionNode",{enumerable:!0,get:function(){return Kr.isSelectionNode}});Object.defineProperty(Ie,"isValueNode",{enumerable:!0,get:function(){return Kr.isValueNode}});Object.defineProperty(Ie,"isTypeNode",{enumerable:!0,get:function(){return Kr.isTypeNode}});Object.defineProperty(Ie,"isTypeSystemDefinitionNode",{enumerable:!0,get:function(){return Kr.isTypeSystemDefinitionNode}});Object.defineProperty(Ie,"isTypeDefinitionNode",{enumerable:!0,get:function(){return Kr.isTypeDefinitionNode}});Object.defineProperty(Ie,"isTypeSystemExtensionNode",{enumerable:!0,get:function(){return Kr.isTypeSystemExtensionNode}});Object.defineProperty(Ie,"isTypeExtensionNode",{enumerable:!0,get:function(){return Kr.isTypeExtensionNode}});Object.defineProperty(Ie,"DirectiveLocation",{enumerable:!0,get:function(){return rW.DirectiveLocation}});var JQ=Bu(),YQ=Ru(),LO=Hd(),XQ=we(),ZQ=Ui(),eW=Qu(),Vm=$i(),tW=wt(),$c=ln(),kO=qi(),Kr=ti(),rW=Vi()});var MO=v(wn=>{"use strict";p();Object.defineProperty(wn,"__esModule",{value:!0});Object.defineProperty(wn,"responsePathAsArray",{enumerable:!0,get:function(){return nW.pathToArray}});Object.defineProperty(wn,"execute",{enumerable:!0,get:function(){return Bc.execute}});Object.defineProperty(wn,"executeSync",{enumerable:!0,get:function(){return Bc.executeSync}});Object.defineProperty(wn,"defaultFieldResolver",{enumerable:!0,get:function(){return Bc.defaultFieldResolver}});Object.defineProperty(wn,"defaultTypeResolver",{enumerable:!0,get:function(){return Bc.defaultTypeResolver}});Object.defineProperty(wn,"getDirectiveValues",{enumerable:!0,get:function(){return iW.getDirectiveValues}});var nW=Fs(),Bc=Ws(),iW=Bs()});var FO=v(Gm=>{"use strict";p();Object.defineProperty(Gm,"__esModule",{value:!0});Gm.default=sW;var oW=br();function sW(e){return typeof e?.[oW.SYMBOL_ASYNC_ITERATOR]=="function"}});var GO=v($m=>{"use strict";p();Object.defineProperty($m,"__esModule",{value:!0});$m.default=uW;var qO=br();function aW(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uW(e,t,r){var n=e[qO.SYMBOL_ASYNC_ITERATOR],i=n.call(e),o,s;typeof i.return=="function"&&(o=i.return,s=function(d){var f=function(){return Promise.reject(d)};return o.call(i).then(f,f)});function a(l){return l.done?l:UO(l.value,t).then(VO,s)}var u;if(r){var c=r;u=function(d){return UO(d,c).then(VO,s)}}return aW({next:function(){return i.next().then(a,u)},return:function(){return o?o.call(i).then(a,u):Promise.resolve({value:void 0,done:!0})},throw:function(d){return typeof i.throw=="function"?i.throw(d).then(a,u):Promise.reject(d).catch(s)}},qO.SYMBOL_ASYNC_ITERATOR,function(){return this})}function UO(e,t){return new Promise(function(r){return r(t(e))})}function VO(e){return{value:e,done:!1}}});var zO=v(Hc=>{"use strict";p();Object.defineProperty(Hc,"__esModule",{value:!0});Hc.subscribe=fW;Hc.createSourceEventStream=WO;var cW=Hm(he()),HO=Hm(FO()),Bm=Fs(),KO=Q(),$O=gs(),lW=Bs(),lo=Ws(),pW=Lc(),dW=Hm(GO());function Hm(e){return e&&e.__esModule?e:{default:e}}function fW(e,t,r,n,i,o,s,a){return arguments.length===1?BO(e):BO({schema:e,document:t,rootValue:r,contextValue:n,variableValues:i,operationName:o,fieldResolver:s,subscribeFieldResolver:a})}function QO(e){if(e instanceof KO.GraphQLError)return{errors:[e]};throw e}function BO(e){var t=e.schema,r=e.document,n=e.rootValue,i=e.contextValue,o=e.variableValues,s=e.operationName,a=e.fieldResolver,u=e.subscribeFieldResolver,c=WO(t,r,n,i,o,s,u),l=function(f){return(0,lo.execute)({schema:t,document:r,rootValue:f,contextValue:i,variableValues:o,operationName:s,fieldResolver:a})};return c.then(function(d){return(0,HO.default)(d)?(0,dW.default)(d,l,QO):d})}function WO(e,t,r,n,i,o,s){return(0,lo.assertValidExecutionArguments)(e,t,i),new Promise(function(a){var u=(0,lo.buildExecutionContext)(e,t,r,n,i,o,s);a(Array.isArray(u)?{errors:u}:hW(u))}).catch(QO)}function hW(e){var t=e.schema,r=e.operation,n=e.variableValues,i=e.rootValue,o=(0,pW.getOperationRootType)(t,r),s=(0,lo.collectFields)(e,o,r.selectionSet,Object.create(null),Object.create(null)),a=Object.keys(s),u=a[0],c=s[u],l=c[0],d=l.name.value,f=(0,lo.getFieldDef)(t,o,d);if(!f)throw new KO.GraphQLError('The subscription field "'.concat(d,'" is not defined.'),c);var h=(0,Bm.addPath)(void 0,u,o.name),g=(0,lo.buildResolveInfo)(e,f,c,o,h);return new Promise(function(y){var _,b=(0,lW.getArgumentValues)(f,c[0],n),S=e.contextValue,I=(_=f.subscribe)!==null&&_!==void 0?_:e.fieldResolver;y(I(i,b,S,g))}).then(function(y){if(y instanceof Error)throw(0,$O.locatedError)(y,c,(0,Bm.pathToArray)(h));if(!(0,HO.default)(y))throw new Error("Subscription field must return Async Iterable. "+"Received: ".concat((0,cW.default)(y),"."));return y},function(y){throw(0,$O.locatedError)(y,c,(0,Bm.pathToArray)(h))})}});var YO=v(Kc=>{"use strict";p();Object.defineProperty(Kc,"__esModule",{value:!0});Object.defineProperty(Kc,"subscribe",{enumerable:!0,get:function(){return JO.subscribe}});Object.defineProperty(Kc,"createSourceEventStream",{enumerable:!0,get:function(){return JO.createSourceEventStream}});var JO=zO()});var zm=v(Wm=>{"use strict";p();Object.defineProperty(Wm,"__esModule",{value:!0});Wm.NoDeprecatedCustomRule=gW;var Km=mW(ut()),zs=Q(),Qm=ce();function mW(e){return e&&e.__esModule?e:{default:e}}function gW(e){return{Field:function(r){var n=e.getFieldDef(),i=n?.deprecationReason;if(n&&i!=null){var o=e.getParentType();o!=null||(0,Km.default)(0),e.reportError(new zs.GraphQLError("The field ".concat(o.name,".").concat(n.name," is deprecated. ").concat(i),r))}},Argument:function(r){var n=e.getArgument(),i=n?.deprecationReason;if(n&&i!=null){var o=e.getDirective();if(o!=null)e.reportError(new zs.GraphQLError('Directive "@'.concat(o.name,'" argument "').concat(n.name,'" is deprecated. ').concat(i),r));else{var s=e.getParentType(),a=e.getFieldDef();s!=null&&a!=null||(0,Km.default)(0),e.reportError(new zs.GraphQLError('Field "'.concat(s.name,".").concat(a.name,'" argument "').concat(n.name,'" is deprecated. ').concat(i),r))}}},ObjectField:function(r){var n=(0,Qm.getNamedType)(e.getParentInputType());if((0,Qm.isInputObjectType)(n)){var i=n.getFields()[r.name.value],o=i?.deprecationReason;o!=null&&e.reportError(new zs.GraphQLError("The input field ".concat(n.name,".").concat(i.name," is deprecated. ").concat(o),r))}},EnumValue:function(r){var n=e.getEnumValue(),i=n?.deprecationReason;if(n&&i!=null){var o=(0,Qm.getNamedType)(e.getInputType());o!=null||(0,Km.default)(0),e.reportError(new zs.GraphQLError('The enum value "'.concat(o.name,".").concat(n.name,'" is deprecated. ').concat(i),r))}}}}});var XO=v(Jm=>{"use strict";p();Object.defineProperty(Jm,"__esModule",{value:!0});Jm.NoSchemaIntrospectionCustomRule=_W;var yW=Q(),vW=ce(),EW=er();function _W(e){return{Field:function(r){var n=(0,vW.getNamedType)(e.getType());n&&(0,EW.isIntrospectionType)(n)&&e.reportError(new yW.GraphQLError('GraphQL introspection has been disabled, but the requested query contained the field "'.concat(r.name.value,'".'),r))}}}});var eA=v(te=>{"use strict";p();Object.defineProperty(te,"__esModule",{value:!0});Object.defineProperty(te,"validate",{enumerable:!0,get:function(){return SW.validate}});Object.defineProperty(te,"ValidationContext",{enumerable:!0,get:function(){return bW.ValidationContext}});Object.defineProperty(te,"specifiedRules",{enumerable:!0,get:function(){return ZO.specifiedRules}});Object.defineProperty(te,"recommendedRules",{enumerable:!0,get:function(){return ZO.recommendedRules}});Object.defineProperty(te,"ExecutableDefinitionsRule",{enumerable:!0,get:function(){return TW.ExecutableDefinitionsRule}});Object.defineProperty(te,"FieldsOnCorrectTypeRule",{enumerable:!0,get:function(){return IW.FieldsOnCorrectTypeRule}});Object.defineProperty(te,"FragmentsOnCompositeTypesRule",{enumerable:!0,get:function(){return wW.FragmentsOnCompositeTypesRule}});Object.defineProperty(te,"KnownArgumentNamesRule",{enumerable:!0,get:function(){return OW.KnownArgumentNamesRule}});Object.defineProperty(te,"KnownDirectivesRule",{enumerable:!0,get:function(){return AW.KnownDirectivesRule}});Object.defineProperty(te,"KnownFragmentNamesRule",{enumerable:!0,get:function(){return xW.KnownFragmentNamesRule}});Object.defineProperty(te,"KnownTypeNamesRule",{enumerable:!0,get:function(){return CW.KnownTypeNamesRule}});Object.defineProperty(te,"LoneAnonymousOperationRule",{enumerable:!0,get:function(){return RW.LoneAnonymousOperationRule}});Object.defineProperty(te,"NoFragmentCyclesRule",{enumerable:!0,get:function(){return PW.NoFragmentCyclesRule}});Object.defineProperty(te,"NoUndefinedVariablesRule",{enumerable:!0,get:function(){return NW.NoUndefinedVariablesRule}});Object.defineProperty(te,"NoUnusedFragmentsRule",{enumerable:!0,get:function(){return DW.NoUnusedFragmentsRule}});Object.defineProperty(te,"NoUnusedVariablesRule",{enumerable:!0,get:function(){return LW.NoUnusedVariablesRule}});Object.defineProperty(te,"OverlappingFieldsCanBeMergedRule",{enumerable:!0,get:function(){return kW.OverlappingFieldsCanBeMergedRule}});Object.defineProperty(te,"PossibleFragmentSpreadsRule",{enumerable:!0,get:function(){return jW.PossibleFragmentSpreadsRule}});Object.defineProperty(te,"ProvidedRequiredArgumentsRule",{enumerable:!0,get:function(){return MW.ProvidedRequiredArgumentsRule}});Object.defineProperty(te,"ScalarLeafsRule",{enumerable:!0,get:function(){return FW.ScalarLeafsRule}});Object.defineProperty(te,"SingleFieldSubscriptionsRule",{enumerable:!0,get:function(){return qW.SingleFieldSubscriptionsRule}});Object.defineProperty(te,"UniqueArgumentNamesRule",{enumerable:!0,get:function(){return UW.UniqueArgumentNamesRule}});Object.defineProperty(te,"UniqueDirectivesPerLocationRule",{enumerable:!0,get:function(){return VW.UniqueDirectivesPerLocationRule}});Object.defineProperty(te,"UniqueFragmentNamesRule",{enumerable:!0,get:function(){return GW.UniqueFragmentNamesRule}});Object.defineProperty(te,"UniqueInputFieldNamesRule",{enumerable:!0,get:function(){return $W.UniqueInputFieldNamesRule}});Object.defineProperty(te,"UniqueOperationNamesRule",{enumerable:!0,get:function(){return BW.UniqueOperationNamesRule}});Object.defineProperty(te,"UniqueVariableNamesRule",{enumerable:!0,get:function(){return HW.UniqueVariableNamesRule}});Object.defineProperty(te,"ValuesOfCorrectTypeRule",{enumerable:!0,get:function(){return KW.ValuesOfCorrectTypeRule}});Object.defineProperty(te,"VariablesAreInputTypesRule",{enumerable:!0,get:function(){return QW.VariablesAreInputTypesRule}});Object.defineProperty(te,"VariablesInAllowedPositionRule",{enumerable:!0,get:function(){return WW.VariablesInAllowedPositionRule}});Object.defineProperty(te,"MaxIntrospectionDepthRule",{enumerable:!0,get:function(){return zW.MaxIntrospectionDepthRule}});Object.defineProperty(te,"LoneSchemaDefinitionRule",{enumerable:!0,get:function(){return JW.LoneSchemaDefinitionRule}});Object.defineProperty(te,"UniqueOperationTypesRule",{enumerable:!0,get:function(){return YW.UniqueOperationTypesRule}});Object.defineProperty(te,"UniqueTypeNamesRule",{enumerable:!0,get:function(){return XW.UniqueTypeNamesRule}});Object.defineProperty(te,"UniqueEnumValueNamesRule",{enumerable:!0,get:function(){return ZW.UniqueEnumValueNamesRule}});Object.defineProperty(te,"UniqueFieldDefinitionNamesRule",{enumerable:!0,get:function(){return ez.UniqueFieldDefinitionNamesRule}});Object.defineProperty(te,"UniqueDirectiveNamesRule",{enumerable:!0,get:function(){return tz.UniqueDirectiveNamesRule}});Object.defineProperty(te,"PossibleTypeExtensionsRule",{enumerable:!0,get:function(){return rz.PossibleTypeExtensionsRule}});Object.defineProperty(te,"NoDeprecatedCustomRule",{enumerable:!0,get:function(){return nz.NoDeprecatedCustomRule}});Object.defineProperty(te,"NoSchemaIntrospectionCustomRule",{enumerable:!0,get:function(){return iz.NoSchemaIntrospectionCustomRule}});var SW=io(),bW=wm(),ZO=Tm(),TW=rh(),IW=Eh(),wW=fh(),OW=Gh(),AW=Fh(),xW=Th(),CW=ph(),RW=sh(),PW=Rh(),NW=Lh(),DW=wh(),LW=jh(),kW=nm(),jW=xh(),MW=Wh(),FW=yh(),qW=uh(),UW=Bh(),VW=Vh(),GW=Sh(),$W=om(),BW=ih(),HW=Nh(),KW=Kh(),QW=mh(),WW=Jh(),zW=am(),JW=cm(),YW=pm(),XW=fm(),ZW=mm(),ez=vm(),tz=_m(),rz=bm(),nz=zm(),iz=XO()});var tA=v(Ym=>{"use strict";p();Object.defineProperty(Ym,"__esModule",{value:!0});Object.defineProperty(Ym,"formatError",{enumerable:!0,get:function(){return oz.formatError}});var oz=Q()});var nA=v(ui=>{"use strict";p();Object.defineProperty(ui,"__esModule",{value:!0});Object.defineProperty(ui,"GraphQLError",{enumerable:!0,get:function(){return rA.GraphQLError}});Object.defineProperty(ui,"printError",{enumerable:!0,get:function(){return rA.printError}});Object.defineProperty(ui,"syntaxError",{enumerable:!0,get:function(){return sz.syntaxError}});Object.defineProperty(ui,"locatedError",{enumerable:!0,get:function(){return az.locatedError}});Object.defineProperty(ui,"formatError",{enumerable:!0,get:function(){return uz.formatError}});var rA=Q(),sz=ku(),az=gs(),uz=tA()});var Zm=v(Xm=>{"use strict";p();Object.defineProperty(Xm,"__esModule",{value:!0});Xm.getIntrospectionQuery=pz;function iA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function cz(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iA(Object(r),!0).forEach(function(n){lz(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lz(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pz(e){var t=cz({descriptions:!0,specifiedByUrl:!1,directiveIsRepeatable:!1,schemaDescription:!1,inputValueDeprecation:!1},e),r=t.descriptions?"description":"",n=t.specifiedByUrl?"specifiedByUrl":"",i=t.directiveIsRepeatable?"isRepeatable":"",o=t.schemaDescription?r:"";function s(a){return t.inputValueDeprecation?a:""}return`
80
+ query IntrospectionQuery {
81
+ __schema {
82
+ `.concat(o,`
83
+ queryType { name }
84
+ mutationType { name }
85
+ subscriptionType { name }
86
+ types {
87
+ ...FullType
88
+ }
89
+ directives {
90
+ name
91
+ `).concat(r,`
92
+ `).concat(i,`
93
+ locations
94
+ args`).concat(s("(includeDeprecated: true)"),` {
95
+ ...InputValue
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ fragment FullType on __Type {
102
+ kind
103
+ name
104
+ `).concat(r,`
105
+ `).concat(n,`
106
+ fields(includeDeprecated: true) {
107
+ name
108
+ `).concat(r,`
109
+ args`).concat(s("(includeDeprecated: true)"),` {
110
+ ...InputValue
111
+ }
112
+ type {
113
+ ...TypeRef
114
+ }
115
+ isDeprecated
116
+ deprecationReason
117
+ }
118
+ inputFields`).concat(s("(includeDeprecated: true)"),` {
119
+ ...InputValue
120
+ }
121
+ interfaces {
122
+ ...TypeRef
123
+ }
124
+ enumValues(includeDeprecated: true) {
125
+ name
126
+ `).concat(r,`
127
+ isDeprecated
128
+ deprecationReason
129
+ }
130
+ possibleTypes {
131
+ ...TypeRef
132
+ }
133
+ }
134
+
135
+ fragment InputValue on __InputValue {
136
+ name
137
+ `).concat(r,`
138
+ type { ...TypeRef }
139
+ defaultValue
140
+ `).concat(s("isDeprecated"),`
141
+ `).concat(s("deprecationReason"),`
142
+ }
143
+
144
+ fragment TypeRef on __Type {
145
+ kind
146
+ name
147
+ ofType {
148
+ kind
149
+ name
150
+ ofType {
151
+ kind
152
+ name
153
+ ofType {
154
+ kind
155
+ name
156
+ ofType {
157
+ kind
158
+ name
159
+ ofType {
160
+ kind
161
+ name
162
+ ofType {
163
+ kind
164
+ name
165
+ ofType {
166
+ kind
167
+ name
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ `)}});var tg=v(eg=>{"use strict";p();Object.defineProperty(eg,"__esModule",{value:!0});eg.getOperationAST=fz;var dz=we();function fz(e,t){for(var r=null,n=0,i=e.definitions;n<i.length;n++){var o=i[n];if(o.kind===dz.Kind.OPERATION_DEFINITION){var s;if(t==null){if(r)return null;r=o}else if(((s=o.name)===null||s===void 0?void 0:s.value)===t)return o}}return r}});var sA=v(rg=>{"use strict";p();Object.defineProperty(rg,"__esModule",{value:!0});rg.introspectionFromSchema=Sz;var hz=vz(ut()),mz=$i(),gz=Ws(),yz=Zm();function vz(e){return e&&e.__esModule?e:{default:e}}function oA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ez(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oA(Object(r),!0).forEach(function(n){_z(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sz(e,t){var r=Ez({specifiedByUrl:!0,directiveIsRepeatable:!0,schemaDescription:!0,inputValueDeprecation:!0},t),n=(0,mz.parse)((0,yz.getIntrospectionQuery)(r)),i=(0,gz.executeSync)({schema:e,document:n});return!i.errors&&i.data||(0,hz.default)(0),i.data}});var uA=v(ng=>{"use strict";p();Object.defineProperty(ng,"__esModule",{value:!0});ng.buildClientSchema=Cz;var bz=Js(Lt()),Mt=Js(he()),Tz=Js(Yt()),Qc=Js(ys()),aA=Js(Sr()),Iz=$i(),wz=Zn(),Oz=Ot(),Az=wr(),Rr=er(),Ft=ce(),xz=Us();function Js(e){return e&&e.__esModule?e:{default:e}}function Cz(e,t){(0,aA.default)(e)&&(0,aA.default)(e.__schema)||(0,Tz.default)(0,'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: '.concat((0,Mt.default)(e),"."));for(var r=e.__schema,n=(0,Qc.default)(r.types,function(A){return A.name},function(A){return y(A)}),i=0,o=[].concat(Az.specifiedScalarTypes,Rr.introspectionTypes);i<o.length;i++){var s=o[i];n[s.name]&&(n[s.name]=s)}var a=r.queryType?h(r.queryType):null,u=r.mutationType?h(r.mutationType):null,c=r.subscriptionType?h(r.subscriptionType):null,l=r.directives?r.directives.map(de):[];return new wz.GraphQLSchema({description:r.description,query:a,mutation:u,subscription:c,types:(0,bz.default)(n),directives:l,assumeValid:t?.assumeValid});function d(A){if(A.kind===Rr.TypeKind.LIST){var re=A.ofType;if(!re)throw new Error("Decorated type deeper than introspection query.");return new Ft.GraphQLList(d(re))}if(A.kind===Rr.TypeKind.NON_NULL){var B=A.ofType;if(!B)throw new Error("Decorated type deeper than introspection query.");var le=d(B);return new Ft.GraphQLNonNull((0,Ft.assertNullableType)(le))}return f(A)}function f(A){var re=A.name;if(!re)throw new Error("Unknown type reference: ".concat((0,Mt.default)(A),"."));var B=n[re];if(!B)throw new Error("Invalid or incomplete schema, unknown type: ".concat(re,". Ensure that a full introspection query is used in order to build a client schema."));return B}function h(A){return(0,Ft.assertObjectType)(f(A))}function g(A){return(0,Ft.assertInterfaceType)(f(A))}function y(A){if(A!=null&&A.name!=null&&A.kind!=null)switch(A.kind){case Rr.TypeKind.SCALAR:return _(A);case Rr.TypeKind.OBJECT:return S(A);case Rr.TypeKind.INTERFACE:return I(A);case Rr.TypeKind.UNION:return O(A);case Rr.TypeKind.ENUM:return T(A);case Rr.TypeKind.INPUT_OBJECT:return C(A)}var re=(0,Mt.default)(A);throw new Error("Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ".concat(re,"."))}function _(A){return new Ft.GraphQLScalarType({name:A.name,description:A.description,specifiedByUrl:A.specifiedByUrl})}function b(A){if(A.interfaces===null&&A.kind===Rr.TypeKind.INTERFACE)return[];if(!A.interfaces){var re=(0,Mt.default)(A);throw new Error("Introspection result missing interfaces: ".concat(re,"."))}return A.interfaces.map(g)}function S(A){return new Ft.GraphQLObjectType({name:A.name,description:A.description,interfaces:function(){return b(A)},fields:function(){return L(A)}})}function I(A){return new Ft.GraphQLInterfaceType({name:A.name,description:A.description,interfaces:function(){return b(A)},fields:function(){return L(A)}})}function O(A){if(!A.possibleTypes){var re=(0,Mt.default)(A);throw new Error("Introspection result missing possibleTypes: ".concat(re,"."))}return new Ft.GraphQLUnionType({name:A.name,description:A.description,types:function(){return A.possibleTypes.map(h)}})}function T(A){if(!A.enumValues){var re=(0,Mt.default)(A);throw new Error("Introspection result missing enumValues: ".concat(re,"."))}return new Ft.GraphQLEnumType({name:A.name,description:A.description,values:(0,Qc.default)(A.enumValues,function(B){return B.name},function(B){return{description:B.description,deprecationReason:B.deprecationReason}})})}function C(A){if(!A.inputFields){var re=(0,Mt.default)(A);throw new Error("Introspection result missing inputFields: ".concat(re,"."))}return new Ft.GraphQLInputObjectType({name:A.name,description:A.description,fields:function(){return W(A.inputFields)}})}function L(A){if(!A.fields)throw new Error("Introspection result missing fields: ".concat((0,Mt.default)(A),"."));return(0,Qc.default)(A.fields,function(re){return re.name},w)}function w(A){var re=d(A.type);if(!(0,Ft.isOutputType)(re)){var B=(0,Mt.default)(re);throw new Error("Introspection must provide output type for fields, but received: ".concat(B,"."))}if(!A.args){var le=(0,Mt.default)(A);throw new Error("Introspection result missing field args: ".concat(le,"."))}return{description:A.description,deprecationReason:A.deprecationReason,type:re,args:W(A.args)}}function W(A){return(0,Qc.default)(A,function(re){return re.name},ae)}function ae(A){var re=d(A.type);if(!(0,Ft.isInputType)(re)){var B=(0,Mt.default)(re);throw new Error("Introspection must provide input type for arguments, but received: ".concat(B,"."))}var le=A.defaultValue!=null?(0,xz.valueFromAST)((0,Iz.parseValue)(A.defaultValue),re):void 0;return{description:A.description,type:re,defaultValue:le,deprecationReason:A.deprecationReason}}function de(A){if(!A.args){var re=(0,Mt.default)(A);throw new Error("Introspection result missing directive args: ".concat(re,"."))}if(!A.locations){var B=(0,Mt.default)(A);throw new Error("Introspection result missing directive locations: ".concat(B,"."))}return new Oz.GraphQLDirective({name:A.name,description:A.description,isRepeatable:A.isRepeatable,locations:A.locations.slice(),args:W(A.args)})}}});var ig=v(Xs=>{"use strict";p();Object.defineProperty(Xs,"__esModule",{value:!0});Xs.extendSchema=Mz;Xs.extendSchemaImpl=_A;Xs.getDescription=ci;var Rz=po(Lt()),Pz=po(pn()),cA=po(he()),Ys=po(uf()),lA=po(ut()),Nz=po(Yt()),rr=we(),Dz=Ui(),Lz=Gi(),pA=ti(),kz=io(),yA=Bs(),dA=Zn(),vA=wr(),EA=er(),zc=Ot(),Le=ce(),fA=Us();function po(e){return e&&e.__esModule?e:{default:e}}function hA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hA(Object(r),!0).forEach(function(n){jz(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jz(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mz(e,t,r){(0,dA.assertSchema)(e),t!=null&&t.kind===rr.Kind.DOCUMENT||(0,Nz.default)(0,"Must provide valid Document AST."),r?.assumeValid!==!0&&r?.assumeValidSDL!==!0&&(0,kz.assertValidSDLExtension)(t,e);var n=e.toConfig(),i=_A(n,t,r);return n===i?e:new dA.GraphQLSchema(i)}function _A(e,t,r){for(var n,i,o,s,a=[],u=Object.create(null),c=[],l,d=[],f=0,h=t.definitions;f<h.length;f++){var g=h[f];if(g.kind===rr.Kind.SCHEMA_DEFINITION)l=g;else if(g.kind===rr.Kind.SCHEMA_EXTENSION)d.push(g);else if((0,pA.isTypeDefinitionNode)(g))a.push(g);else if((0,pA.isTypeExtensionNode)(g)){var y=g.name.value,_=u[y];u[y]=_?_.concat([g]):[g]}else g.kind===rr.Kind.DIRECTIVE_DEFINITION&&c.push(g)}if(Object.keys(u).length===0&&a.length===0&&c.length===0&&d.length===0&&l==null)return e;for(var b=Object.create(null),S=0,I=e.types;S<I.length;S++){var O=I[S];b[O.name]=re(O)}for(var T=0;T<a.length;T++){var C,L=a[T],w=L.name.value;b[w]=(C=mA[w])!==null&&C!==void 0?C:pL(L)}var W=ge(ge({query:e.query&&de(e.query),mutation:e.mutation&&de(e.mutation),subscription:e.subscription&&de(e.subscription)},l&&Lr([l])),Lr(d));return ge(ge({description:(n=l)===null||n===void 0||(i=n.description)===null||i===void 0?void 0:i.value},W),{},{types:(0,Rz.default)(b),directives:[].concat(e.directives.map(A),c.map(tt)),extensions:void 0,astNode:(o=l)!==null&&o!==void 0?o:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:(s=r?.assumeValid)!==null&&s!==void 0?s:!1});function ae(x){return(0,Le.isListType)(x)?new Le.GraphQLList(ae(x.ofType)):(0,Le.isNonNullType)(x)?new Le.GraphQLNonNull(ae(x.ofType)):de(x)}function de(x){return b[x.name]}function A(x){var H=x.toConfig();return new zc.GraphQLDirective(ge(ge({},H),{},{args:(0,Ys.default)(H.args,$t)}))}function re(x){if((0,EA.isIntrospectionType)(x)||(0,vA.isSpecifiedScalarType)(x))return x;if((0,Le.isScalarType)(x))return ee(x);if((0,Le.isObjectType)(x))return fe(x);if((0,Le.isInterfaceType)(x))return Me(x);if((0,Le.isUnionType)(x))return Fe(x);if((0,Le.isEnumType)(x))return le(x);if((0,Le.isInputObjectType)(x))return B(x);(0,lA.default)(0,"Unexpected type: "+(0,cA.default)(x))}function B(x){var H,k=x.toConfig(),$=(H=u[k.name])!==null&&H!==void 0?H:[];return new Le.GraphQLInputObjectType(ge(ge({},k),{},{fields:function(){return ge(ge({},(0,Ys.default)(k.fields,function(_e){return ge(ge({},_e),{},{type:ae(_e.type)})})),Op($))},extensionASTNodes:k.extensionASTNodes.concat($)}))}function le(x){var H,k=x.toConfig(),$=(H=u[x.name])!==null&&H!==void 0?H:[];return new Le.GraphQLEnumType(ge(ge({},k),{},{values:ge(ge({},k.values),Ba($)),extensionASTNodes:k.extensionASTNodes.concat($)}))}function ee(x){for(var H,k=x.toConfig(),$=(H=u[k.name])!==null&&H!==void 0?H:[],oe=k.specifiedByUrl,_e=0;_e<$.length;_e++){var Se,be=$[_e];oe=(Se=gA(be))!==null&&Se!==void 0?Se:oe}return new Le.GraphQLScalarType(ge(ge({},k),{},{specifiedByUrl:oe,extensionASTNodes:k.extensionASTNodes.concat($)}))}function fe(x){var H,k=x.toConfig(),$=(H=u[k.name])!==null&&H!==void 0?H:[];return new Le.GraphQLObjectType(ge(ge({},k),{},{interfaces:function(){return[].concat(x.getInterfaces().map(de),Ha($))},fields:function(){return ge(ge({},(0,Ys.default)(k.fields,ue)),qe($))},extensionASTNodes:k.extensionASTNodes.concat($)}))}function Me(x){var H,k=x.toConfig(),$=(H=u[k.name])!==null&&H!==void 0?H:[];return new Le.GraphQLInterfaceType(ge(ge({},k),{},{interfaces:function(){return[].concat(x.getInterfaces().map(de),Ha($))},fields:function(){return ge(ge({},(0,Ys.default)(k.fields,ue)),qe($))},extensionASTNodes:k.extensionASTNodes.concat($)}))}function Fe(x){var H,k=x.toConfig(),$=(H=u[k.name])!==null&&H!==void 0?H:[];return new Le.GraphQLUnionType(ge(ge({},k),{},{types:function(){return[].concat(x.getTypes().map(de),Qv($))},extensionASTNodes:k.extensionASTNodes.concat($)}))}function ue(x){return ge(ge({},x),{},{type:ae(x.type),args:(0,Ys.default)(x.args,$t)})}function $t(x){return ge(ge({},x),{},{type:ae(x.type)})}function Lr(x){for(var H={},k=0;k<x.length;k++)for(var $,oe=x[k],_e=($=oe.operationTypes)!==null&&$!==void 0?$:[],Se=0;Se<_e.length;Se++){var be=_e[Se];H[be.operation]=kr(be.type)}return H}function kr(x){var H,k=x.name.value,$=(H=mA[k])!==null&&H!==void 0?H:b[k];if($===void 0)throw new Error('Unknown type: "'.concat(k,'".'));return $}function Bt(x){return x.kind===rr.Kind.LIST_TYPE?new Le.GraphQLList(Bt(x.type)):x.kind===rr.Kind.NON_NULL_TYPE?new Le.GraphQLNonNull(Bt(x.type)):kr(x)}function tt(x){var H=x.locations.map(function(k){var $=k.value;return $});return new zc.GraphQLDirective({name:x.name.value,description:ci(x,r),locations:H,isRepeatable:x.repeatable,args:Ko(x.arguments),astNode:x})}function qe(x){for(var H=Object.create(null),k=0;k<x.length;k++)for(var $,oe=x[k],_e=($=oe.fields)!==null&&$!==void 0?$:[],Se=0;Se<_e.length;Se++){var be=_e[Se];H[be.name.value]={type:Bt(be.type),description:ci(be,r),args:Ko(be.arguments),deprecationReason:Wc(be),astNode:be}}return H}function Ko(x){for(var H=x??[],k=Object.create(null),$=0;$<H.length;$++){var oe=H[$],_e=Bt(oe.type);k[oe.name.value]={type:_e,description:ci(oe,r),defaultValue:(0,fA.valueFromAST)(oe.defaultValue,_e),deprecationReason:Wc(oe),astNode:oe}}return k}function Op(x){for(var H=Object.create(null),k=0;k<x.length;k++)for(var $,oe=x[k],_e=($=oe.fields)!==null&&$!==void 0?$:[],Se=0;Se<_e.length;Se++){var be=_e[Se],Qo=Bt(be.type);H[be.name.value]={type:Qo,description:ci(be,r),defaultValue:(0,fA.valueFromAST)(be.defaultValue,Qo),deprecationReason:Wc(be),astNode:be}}return H}function Ba(x){for(var H=Object.create(null),k=0;k<x.length;k++)for(var $,oe=x[k],_e=($=oe.values)!==null&&$!==void 0?$:[],Se=0;Se<_e.length;Se++){var be=_e[Se];H[be.name.value]={description:ci(be,r),deprecationReason:Wc(be),astNode:be}}return H}function Ha(x){for(var H=[],k=0;k<x.length;k++)for(var $,oe=x[k],_e=($=oe.interfaces)!==null&&$!==void 0?$:[],Se=0;Se<_e.length;Se++){var be=_e[Se];H.push(kr(be))}return H}function Qv(x){for(var H=[],k=0;k<x.length;k++)for(var $,oe=x[k],_e=($=oe.types)!==null&&$!==void 0?$:[],Se=0;Se<_e.length;Se++){var be=_e[Se];H.push(kr(be))}return H}function pL(x){var H,k=x.name.value,$=ci(x,r),oe=(H=u[k])!==null&&H!==void 0?H:[];switch(x.kind){case rr.Kind.OBJECT_TYPE_DEFINITION:{var _e=oe,Se=[x].concat(_e);return new Le.GraphQLObjectType({name:k,description:$,interfaces:function(){return Ha(Se)},fields:function(){return qe(Se)},astNode:x,extensionASTNodes:_e})}case rr.Kind.INTERFACE_TYPE_DEFINITION:{var be=oe,Qo=[x].concat(be);return new Le.GraphQLInterfaceType({name:k,description:$,interfaces:function(){return Ha(Qo)},fields:function(){return qe(Qo)},astNode:x,extensionASTNodes:be})}case rr.Kind.ENUM_TYPE_DEFINITION:{var Wv=oe,dL=[x].concat(Wv);return new Le.GraphQLEnumType({name:k,description:$,values:Ba(dL),astNode:x,extensionASTNodes:Wv})}case rr.Kind.UNION_TYPE_DEFINITION:{var zv=oe,fL=[x].concat(zv);return new Le.GraphQLUnionType({name:k,description:$,types:function(){return Qv(fL)},astNode:x,extensionASTNodes:zv})}case rr.Kind.SCALAR_TYPE_DEFINITION:{var hL=oe;return new Le.GraphQLScalarType({name:k,description:$,specifiedByUrl:gA(x),astNode:x,extensionASTNodes:hL})}case rr.Kind.INPUT_OBJECT_TYPE_DEFINITION:{var Jv=oe,mL=[x].concat(Jv);return new Le.GraphQLInputObjectType({name:k,description:$,fields:function(){return Op(mL)},astNode:x,extensionASTNodes:Jv})}}(0,lA.default)(0,"Unexpected type definition node: "+(0,cA.default)(x))}}var mA=(0,Pz.default)(vA.specifiedScalarTypes.concat(EA.introspectionTypes),function(e){return e.name});function Wc(e){var t=(0,yA.getDirectiveValues)(zc.GraphQLDeprecatedDirective,e);return t?.reason}function gA(e){var t=(0,yA.getDirectiveValues)(zc.GraphQLSpecifiedByDirective,e);return t?.url}function ci(e,t){if(e.description)return e.description.value;if(t?.commentDescriptions===!0){var r=Fz(e);if(r!==void 0)return(0,Lz.dedentBlockStringValue)(`
177
+ `+r)}}function Fz(e){var t=e.loc;if(t){for(var r=[],n=t.startToken.prev;n!=null&&n.kind===Dz.TokenKind.COMMENT&&n.next&&n.prev&&n.line+1===n.next.line&&n.line!==n.prev.line;){var i=String(n.value);r.push(i),n=n.prev}return r.length>0?r.reverse().join(`
178
+ `):void 0}}});var TA=v(Jc=>{"use strict";p();Object.defineProperty(Jc,"__esModule",{value:!0});Jc.buildASTSchema=bA;Jc.buildSchema=Kz;var qz=Hz(Yt()),Uz=we(),Vz=$i(),Gz=io(),$z=Zn(),SA=Ot(),Bz=ig();function Hz(e){return e&&e.__esModule?e:{default:e}}function bA(e,t){e!=null&&e.kind===Uz.Kind.DOCUMENT||(0,qz.default)(0,"Must provide valid Document AST."),t?.assumeValid!==!0&&t?.assumeValidSDL!==!0&&(0,Gz.assertValidSDL)(e);var r={description:void 0,types:[],directives:[],extensions:void 0,extensionASTNodes:[],assumeValid:!1},n=(0,Bz.extendSchemaImpl)(r,e,t);if(n.astNode==null)for(var i=0,o=n.types;i<o.length;i++){var s=o[i];switch(s.name){case"Query":n.query=s;break;case"Mutation":n.mutation=s;break;case"Subscription":n.subscription=s;break}}for(var a=n.directives,u=function(d){var f=SA.specifiedDirectives[d];a.every(function(h){return h.name!==f.name})&&a.push(f)},c=0;c<SA.specifiedDirectives.length;c++)u(c);return new $z.GraphQLSchema(n)}function Kz(e,t){var r=(0,Vz.parse)(e,{noLocation:t?.noLocation,allowLegacySDLEmptyFields:t?.allowLegacySDLEmptyFields,allowLegacySDLImplementsInterfaces:t?.allowLegacySDLImplementsInterfaces,experimentalFragmentVariables:t?.experimentalFragmentVariables});return bA(r,{commentDescriptions:t?.commentDescriptions,assumeValidSDL:t?.assumeValidSDL,assumeValid:t?.assumeValid})}});var wA=v(ag=>{"use strict";p();Object.defineProperty(ag,"__esModule",{value:!0});ag.lexicographicSortSchema=rJ;var Qz=Zs(Lt()),Wz=Zs(he()),zz=Zs(ut()),Jz=Zs(ys()),Yz=Zs(vs()),Xz=Zn(),Zz=Ot(),eJ=er(),Et=ce();function Zs(e){return e&&e.__esModule?e:{default:e}}function IA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function We(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IA(Object(r),!0).forEach(function(n){tJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IA(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tJ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rJ(e){var t=e.toConfig(),r=(0,Jz.default)(og(t.types),function(f){return f.name},d);return new Xz.GraphQLSchema(We(We({},t),{},{types:(0,Qz.default)(r),directives:og(t.directives).map(s),query:o(t.query),mutation:o(t.mutation),subscription:o(t.subscription)}));function n(f){return(0,Et.isListType)(f)?new Et.GraphQLList(n(f.ofType)):(0,Et.isNonNullType)(f)?new Et.GraphQLNonNull(n(f.ofType)):i(f)}function i(f){return r[f.name]}function o(f){return f&&i(f)}function s(f){var h=f.toConfig();return new Zz.GraphQLDirective(We(We({},h),{},{locations:sg(h.locations,function(g){return g}),args:a(h.args)}))}function a(f){return Yc(f,function(h){return We(We({},h),{},{type:n(h.type)})})}function u(f){return Yc(f,function(h){return We(We({},h),{},{type:n(h.type),args:a(h.args)})})}function c(f){return Yc(f,function(h){return We(We({},h),{},{type:n(h.type)})})}function l(f){return og(f).map(i)}function d(f){if((0,Et.isScalarType)(f)||(0,eJ.isIntrospectionType)(f))return f;if((0,Et.isObjectType)(f)){var h=f.toConfig();return new Et.GraphQLObjectType(We(We({},h),{},{interfaces:function(){return l(h.interfaces)},fields:function(){return u(h.fields)}}))}if((0,Et.isInterfaceType)(f)){var g=f.toConfig();return new Et.GraphQLInterfaceType(We(We({},g),{},{interfaces:function(){return l(g.interfaces)},fields:function(){return u(g.fields)}}))}if((0,Et.isUnionType)(f)){var y=f.toConfig();return new Et.GraphQLUnionType(We(We({},y),{},{types:function(){return l(y.types)}}))}if((0,Et.isEnumType)(f)){var _=f.toConfig();return new Et.GraphQLEnumType(We(We({},_),{},{values:Yc(_.values)}))}if((0,Et.isInputObjectType)(f)){var b=f.toConfig();return new Et.GraphQLInputObjectType(We(We({},b),{},{fields:function(){return c(b.fields)}}))}(0,zz.default)(0,"Unexpected type: "+(0,Wz.default)(f))}}function Yc(e,t){for(var r=Object.create(null),n=sg(Object.keys(e),function(a){return a}),i=0;i<n.length;i++){var o=n[i],s=e[o];r[o]=t?t(s):s}return r}function og(e){return sg(e,function(t){return t.name})}function sg(e,t){return e.slice().sort(function(r,n){var i=t(r),o=t(n);return(0,Yz.default)(i,o)})}});var DA=v(ea=>{"use strict";p();Object.defineProperty(ea,"__esModule",{value:!0});ea.printSchema=oJ;ea.printIntrospectionSchema=sJ;ea.printType=CA;var cg=hg(Lt()),nJ=hg(he()),OA=hg(ut()),lg=wt(),iJ=Gi(),AA=er(),pg=wr(),dg=Ot(),fo=ce(),fg=Cs();function hg(e){return e&&e.__esModule?e:{default:e}}function oJ(e,t){return xA(e,function(r){return!(0,dg.isSpecifiedDirective)(r)},aJ,t)}function sJ(e,t){return xA(e,dg.isSpecifiedDirective,AA.isIntrospectionType,t)}function aJ(e){return!(0,pg.isSpecifiedScalarType)(e)&&!(0,AA.isIntrospectionType)(e)}function xA(e,t,r,n){var i=e.getDirectives().filter(t),o=(0,cg.default)(e.getTypeMap()).filter(r);return[uJ(e)].concat(i.map(function(s){return gJ(s,n)}),o.map(function(s){return CA(s,n)})).filter(Boolean).join(`
179
+
180
+ `)+`
181
+ `}function uJ(e){if(!(e.description==null&&cJ(e))){var t=[],r=e.getQueryType();r&&t.push(" query: ".concat(r.name));var n=e.getMutationType();n&&t.push(" mutation: ".concat(n.name));var i=e.getSubscriptionType();return i&&t.push(" subscription: ".concat(i.name)),nr({},e)+`schema {
182
+ `.concat(t.join(`
183
+ `),`
184
+ }`)}}function cJ(e){var t=e.getQueryType();if(t&&t.name!=="Query")return!1;var r=e.getMutationType();if(r&&r.name!=="Mutation")return!1;var n=e.getSubscriptionType();return!(n&&n.name!=="Subscription")}function CA(e,t){if((0,fo.isScalarType)(e))return lJ(e,t);if((0,fo.isObjectType)(e))return pJ(e,t);if((0,fo.isInterfaceType)(e))return dJ(e,t);if((0,fo.isUnionType)(e))return fJ(e,t);if((0,fo.isEnumType)(e))return hJ(e,t);if((0,fo.isInputObjectType)(e))return mJ(e,t);(0,OA.default)(0,"Unexpected type: "+(0,nJ.default)(e))}function lJ(e,t){return nr(t,e)+"scalar ".concat(e.name)+yJ(e)}function RA(e){var t=e.getInterfaces();return t.length?" implements "+t.map(function(r){return r.name}).join(" & "):""}function pJ(e,t){return nr(t,e)+"type ".concat(e.name)+RA(e)+PA(t,e)}function dJ(e,t){return nr(t,e)+"interface ".concat(e.name)+RA(e)+PA(t,e)}function fJ(e,t){var r=e.getTypes(),n=r.length?" = "+r.join(" | "):"";return nr(t,e)+"union "+e.name+n}function hJ(e,t){var r=e.getValues().map(function(n,i){return nr(t,n," ",!i)+" "+n.name+gg(n.deprecationReason)});return nr(t,e)+"enum ".concat(e.name)+mg(r)}function mJ(e,t){var r=(0,cg.default)(e.getFields()).map(function(n,i){return nr(t,n," ",!i)+" "+ug(n)});return nr(t,e)+"input ".concat(e.name)+mg(r)}function PA(e,t){var r=(0,cg.default)(t.getFields()).map(function(n,i){return nr(e,n," ",!i)+" "+n.name+NA(e,n.args," ")+": "+String(n.type)+gg(n.deprecationReason)});return mg(r)}function mg(e){return e.length!==0?` {
185
+ `+e.join(`
186
+ `)+`
187
+ }`:""}function NA(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return t.length===0?"":t.every(function(n){return!n.description})?"("+t.map(ug).join(", ")+")":`(
188
+ `+t.map(function(n,i){return nr(e,n," "+r,!i)+" "+r+ug(n)}).join(`
189
+ `)+`
190
+ `+r+")"}function ug(e){var t=(0,fg.astFromValue)(e.defaultValue,e.type),r=e.name+": "+String(e.type);return t&&(r+=" = ".concat((0,lg.print)(t))),r+gg(e.deprecationReason)}function gJ(e,t){return nr(t,e)+"directive @"+e.name+NA(t,e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}function gg(e){if(e==null)return"";var t=(0,fg.astFromValue)(e,pg.GraphQLString);return t&&e!==dg.DEFAULT_DEPRECATION_REASON?" @deprecated(reason: "+(0,lg.print)(t)+")":" @deprecated"}function yJ(e){if(e.specifiedByUrl==null)return"";var t=e.specifiedByUrl,r=(0,fg.astFromValue)(t,pg.GraphQLString);return r||(0,OA.default)(0,"Unexpected null value returned from `astFromValue` for specifiedByUrl")," @specifiedBy(url: "+(0,lg.print)(r)+")"}function nr(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=t.description;if(i==null)return"";if(e?.commentDescriptions===!0)return vJ(i,r,n);var o=i.length>70,s=(0,iJ.printBlockString)(i,"",o),a=r&&!n?`
191
+ `+r:r;return a+s.replace(/\n/g,`
192
+ `+r)+`
193
+ `}function vJ(e,t,r){var n=t&&!r?`
194
+ `:"",i=e.split(`
195
+ `).map(function(o){return t+(o!==""?"# "+o:"#")}).join(`
196
+ `);return n+i+`
197
+ `}});var LA=v(yg=>{"use strict";p();Object.defineProperty(yg,"__esModule",{value:!0});yg.concatAST=EJ;function EJ(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t=t.concat(n.definitions)}return{kind:"Document",definitions:t}}});var MA=v(vg=>{"use strict";p();Object.defineProperty(vg,"__esModule",{value:!0});vg.separateOperations=SJ;var Xc=we(),_J=ln();function SJ(e){for(var t=[],r=Object.create(null),n=0,i=e.definitions;n<i.length;n++){var o=i[n];switch(o.kind){case Xc.Kind.OPERATION_DEFINITION:t.push(o);break;case Xc.Kind.FRAGMENT_DEFINITION:r[o.name.value]=kA(o.selectionSet);break}}for(var s=Object.create(null),a=function(l){for(var d=t[l],f=new Set,h=0,g=kA(d.selectionSet);h<g.length;h++){var y=g[h];jA(f,r,y)}var _=d.name?d.name.value:"";s[_]={kind:Xc.Kind.DOCUMENT,definitions:e.definitions.filter(function(b){return b===d||b.kind===Xc.Kind.FRAGMENT_DEFINITION&&f.has(b.name.value)})}},u=0;u<t.length;u++)a(u);return s}function jA(e,t,r){if(!e.has(r)){e.add(r);var n=t[r];if(n!==void 0)for(var i=0;i<n.length;i++){var o=n[i];jA(e,t,o)}}}function kA(e){var t=[];return(0,_J.visit)(e,{FragmentSpread:function(n){t.push(n.name.value)}}),t}});var VA=v(_g=>{"use strict";p();Object.defineProperty(_g,"__esModule",{value:!0});_g.stripIgnoredCharacters=bJ;var FA=Bu(),Eg=Ui(),qA=Qu(),UA=Gi();function bJ(e){for(var t=(0,FA.isSource)(e)?e:new FA.Source(e),r=t.body,n=new qA.Lexer(t),i="",o=!1;n.advance().kind!==Eg.TokenKind.EOF;){var s=n.token,a=s.kind,u=!(0,qA.isPunctuatorTokenKind)(s.kind);o&&(u||s.kind===Eg.TokenKind.SPREAD)&&(i+=" ");var c=r.slice(s.start,s.end);a===Eg.TokenKind.BLOCK_STRING?i+=TJ(c):i+=c,o=u}return i}function TJ(e){var t=e.slice(3,-3),r=(0,UA.dedentBlockStringValue)(t);(0,UA.getBlockStringIndentation)(r)>0&&(r=`
198
+ `+r);var n=r[r.length-1],i=n==='"'&&r.slice(-4)!=='\\"""';return(i||n==="\\")&&(r+=`
199
+ `),'"""'+r+'"""'}});var YA=v(On=>{"use strict";p();Object.defineProperty(On,"__esModule",{value:!0});On.findBreakingChanges=PJ;On.findDangerousChanges=NJ;On.DangerousChangeType=On.BreakingChangeType=void 0;var ho=na(Lt()),GA=na(pn()),IJ=na(he()),zA=na(ut()),wJ=na(vs()),OJ=wt(),AJ=ln(),xJ=wr(),ye=ce(),CJ=Cs();function na(e){return e&&e.__esModule?e:{default:e}}function $A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function BA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$A(Object(r),!0).forEach(function(n){RJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$A(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function RJ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ze=Object.freeze({TYPE_REMOVED:"TYPE_REMOVED",TYPE_CHANGED_KIND:"TYPE_CHANGED_KIND",TYPE_REMOVED_FROM_UNION:"TYPE_REMOVED_FROM_UNION",VALUE_REMOVED_FROM_ENUM:"VALUE_REMOVED_FROM_ENUM",REQUIRED_INPUT_FIELD_ADDED:"REQUIRED_INPUT_FIELD_ADDED",IMPLEMENTED_INTERFACE_REMOVED:"IMPLEMENTED_INTERFACE_REMOVED",FIELD_REMOVED:"FIELD_REMOVED",FIELD_CHANGED_KIND:"FIELD_CHANGED_KIND",REQUIRED_ARG_ADDED:"REQUIRED_ARG_ADDED",ARG_REMOVED:"ARG_REMOVED",ARG_CHANGED_KIND:"ARG_CHANGED_KIND",DIRECTIVE_REMOVED:"DIRECTIVE_REMOVED",DIRECTIVE_ARG_REMOVED:"DIRECTIVE_ARG_REMOVED",REQUIRED_DIRECTIVE_ARG_ADDED:"REQUIRED_DIRECTIVE_ARG_ADDED",DIRECTIVE_REPEATABLE_REMOVED:"DIRECTIVE_REPEATABLE_REMOVED",DIRECTIVE_LOCATION_REMOVED:"DIRECTIVE_LOCATION_REMOVED"});On.BreakingChangeType=ze;var Qr=Object.freeze({VALUE_ADDED_TO_ENUM:"VALUE_ADDED_TO_ENUM",TYPE_ADDED_TO_UNION:"TYPE_ADDED_TO_UNION",OPTIONAL_INPUT_FIELD_ADDED:"OPTIONAL_INPUT_FIELD_ADDED",OPTIONAL_ARG_ADDED:"OPTIONAL_ARG_ADDED",IMPLEMENTED_INTERFACE_ADDED:"IMPLEMENTED_INTERFACE_ADDED",ARG_DEFAULT_VALUE_CHANGE:"ARG_DEFAULT_VALUE_CHANGE"});On.DangerousChangeType=Qr;function PJ(e,t){var r=JA(e,t).filter(function(n){return n.type in ze});return r}function NJ(e,t){var r=JA(e,t).filter(function(n){return n.type in Qr});return r}function JA(e,t){return[].concat(LJ(e,t),DJ(e,t))}function DJ(e,t){for(var r=[],n=Wr(e.getDirectives(),t.getDirectives()),i=0,o=n.removed;i<o.length;i++){var s=o[i];r.push({type:ze.DIRECTIVE_REMOVED,description:"".concat(s.name," was removed.")})}for(var a=0,u=n.persisted;a<u.length;a++){for(var c=u[a],l=c[0],d=c[1],f=Wr(l.args,d.args),h=0,g=f.added;h<g.length;h++){var y=g[h];(0,ye.isRequiredArgument)(y)&&r.push({type:ze.REQUIRED_DIRECTIVE_ARG_ADDED,description:"A required arg ".concat(y.name," on directive ").concat(l.name," was added.")})}for(var _=0,b=f.removed;_<b.length;_++){var S=b[_];r.push({type:ze.DIRECTIVE_ARG_REMOVED,description:"".concat(S.name," was removed from ").concat(l.name,".")})}l.isRepeatable&&!d.isRepeatable&&r.push({type:ze.DIRECTIVE_REPEATABLE_REMOVED,description:"Repeatable flag was removed from ".concat(l.name,".")});for(var I=0,O=l.locations;I<O.length;I++){var T=O[I];d.locations.indexOf(T)===-1&&r.push({type:ze.DIRECTIVE_LOCATION_REMOVED,description:"".concat(T," was removed from ").concat(l.name,".")})}}return r}function LJ(e,t){for(var r=[],n=Wr((0,ho.default)(e.getTypeMap()),(0,ho.default)(t.getTypeMap())),i=0,o=n.removed;i<o.length;i++){var s=o[i];r.push({type:ze.TYPE_REMOVED,description:(0,xJ.isSpecifiedScalarType)(s)?"Standard scalar ".concat(s.name," was removed because it is not referenced anymore."):"".concat(s.name," was removed.")})}for(var a=0,u=n.persisted;a<u.length;a++){var c=u[a],l=c[0],d=c[1];(0,ye.isEnumType)(l)&&(0,ye.isEnumType)(d)?r.push.apply(r,MJ(l,d)):(0,ye.isUnionType)(l)&&(0,ye.isUnionType)(d)?r.push.apply(r,jJ(l,d)):(0,ye.isInputObjectType)(l)&&(0,ye.isInputObjectType)(d)?r.push.apply(r,kJ(l,d)):(0,ye.isObjectType)(l)&&(0,ye.isObjectType)(d)||(0,ye.isInterfaceType)(l)&&(0,ye.isInterfaceType)(d)?r.push.apply(r,KA(l,d).concat(HA(l,d))):l.constructor!==d.constructor&&r.push({type:ze.TYPE_CHANGED_KIND,description:"".concat(l.name," changed from ")+"".concat(QA(l)," to ").concat(QA(d),".")})}return r}function kJ(e,t){for(var r=[],n=Wr((0,ho.default)(e.getFields()),(0,ho.default)(t.getFields())),i=0,o=n.added;i<o.length;i++){var s=o[i];(0,ye.isRequiredInputField)(s)?r.push({type:ze.REQUIRED_INPUT_FIELD_ADDED,description:"A required field ".concat(s.name," on input type ").concat(e.name," was added.")}):r.push({type:Qr.OPTIONAL_INPUT_FIELD_ADDED,description:"An optional field ".concat(s.name," on input type ").concat(e.name," was added.")})}for(var a=0,u=n.removed;a<u.length;a++){var c=u[a];r.push({type:ze.FIELD_REMOVED,description:"".concat(e.name,".").concat(c.name," was removed.")})}for(var l=0,d=n.persisted;l<d.length;l++){var f=d[l],h=f[0],g=f[1],y=ra(h.type,g.type);y||r.push({type:ze.FIELD_CHANGED_KIND,description:"".concat(e.name,".").concat(h.name," changed type from ")+"".concat(String(h.type)," to ").concat(String(g.type),".")})}return r}function jJ(e,t){for(var r=[],n=Wr(e.getTypes(),t.getTypes()),i=0,o=n.added;i<o.length;i++){var s=o[i];r.push({type:Qr.TYPE_ADDED_TO_UNION,description:"".concat(s.name," was added to union type ").concat(e.name,".")})}for(var a=0,u=n.removed;a<u.length;a++){var c=u[a];r.push({type:ze.TYPE_REMOVED_FROM_UNION,description:"".concat(c.name," was removed from union type ").concat(e.name,".")})}return r}function MJ(e,t){for(var r=[],n=Wr(e.getValues(),t.getValues()),i=0,o=n.added;i<o.length;i++){var s=o[i];r.push({type:Qr.VALUE_ADDED_TO_ENUM,description:"".concat(s.name," was added to enum type ").concat(e.name,".")})}for(var a=0,u=n.removed;a<u.length;a++){var c=u[a];r.push({type:ze.VALUE_REMOVED_FROM_ENUM,description:"".concat(c.name," was removed from enum type ").concat(e.name,".")})}return r}function HA(e,t){for(var r=[],n=Wr(e.getInterfaces(),t.getInterfaces()),i=0,o=n.added;i<o.length;i++){var s=o[i];r.push({type:Qr.IMPLEMENTED_INTERFACE_ADDED,description:"".concat(s.name," added to interfaces implemented by ").concat(e.name,".")})}for(var a=0,u=n.removed;a<u.length;a++){var c=u[a];r.push({type:ze.IMPLEMENTED_INTERFACE_REMOVED,description:"".concat(e.name," no longer implements interface ").concat(c.name,".")})}return r}function KA(e,t){for(var r=[],n=Wr((0,ho.default)(e.getFields()),(0,ho.default)(t.getFields())),i=0,o=n.removed;i<o.length;i++){var s=o[i];r.push({type:ze.FIELD_REMOVED,description:"".concat(e.name,".").concat(s.name," was removed.")})}for(var a=0,u=n.persisted;a<u.length;a++){var c=u[a],l=c[0],d=c[1];r.push.apply(r,FJ(e,l,d));var f=ta(l.type,d.type);f||r.push({type:ze.FIELD_CHANGED_KIND,description:"".concat(e.name,".").concat(l.name," changed type from ")+"".concat(String(l.type)," to ").concat(String(d.type),".")})}return r}function FJ(e,t,r){for(var n=[],i=Wr(t.args,r.args),o=0,s=i.removed;o<s.length;o++){var a=s[o];n.push({type:ze.ARG_REMOVED,description:"".concat(e.name,".").concat(t.name," arg ").concat(a.name," was removed.")})}for(var u=0,c=i.persisted;u<c.length;u++){var l=c[u],d=l[0],f=l[1],h=ra(d.type,f.type);if(!h)n.push({type:ze.ARG_CHANGED_KIND,description:"".concat(e.name,".").concat(t.name," arg ").concat(d.name," has changed type from ")+"".concat(String(d.type)," to ").concat(String(f.type),".")});else if(d.defaultValue!==void 0)if(f.defaultValue===void 0)n.push({type:Qr.ARG_DEFAULT_VALUE_CHANGE,description:"".concat(e.name,".").concat(t.name," arg ").concat(d.name," defaultValue was removed.")});else{var g=WA(d.defaultValue,d.type),y=WA(f.defaultValue,f.type);g!==y&&n.push({type:Qr.ARG_DEFAULT_VALUE_CHANGE,description:"".concat(e.name,".").concat(t.name," arg ").concat(d.name," has changed defaultValue from ").concat(g," to ").concat(y,".")})}}for(var _=0,b=i.added;_<b.length;_++){var S=b[_];(0,ye.isRequiredArgument)(S)?n.push({type:ze.REQUIRED_ARG_ADDED,description:"A required arg ".concat(S.name," on ").concat(e.name,".").concat(t.name," was added.")}):n.push({type:Qr.OPTIONAL_ARG_ADDED,description:"An optional arg ".concat(S.name," on ").concat(e.name,".").concat(t.name," was added.")})}return n}function ta(e,t){return(0,ye.isListType)(e)?(0,ye.isListType)(t)&&ta(e.ofType,t.ofType)||(0,ye.isNonNullType)(t)&&ta(e,t.ofType):(0,ye.isNonNullType)(e)?(0,ye.isNonNullType)(t)&&ta(e.ofType,t.ofType):(0,ye.isNamedType)(t)&&e.name===t.name||(0,ye.isNonNullType)(t)&&ta(e,t.ofType)}function ra(e,t){return(0,ye.isListType)(e)?(0,ye.isListType)(t)&&ra(e.ofType,t.ofType):(0,ye.isNonNullType)(e)?(0,ye.isNonNullType)(t)&&ra(e.ofType,t.ofType)||!(0,ye.isNonNullType)(t)&&ra(e.ofType,t):(0,ye.isNamedType)(t)&&e.name===t.name}function QA(e){if((0,ye.isScalarType)(e))return"a Scalar type";if((0,ye.isObjectType)(e))return"an Object type";if((0,ye.isInterfaceType)(e))return"an Interface type";if((0,ye.isUnionType)(e))return"a Union type";if((0,ye.isEnumType)(e))return"an Enum type";if((0,ye.isInputObjectType)(e))return"an Input type";(0,zA.default)(0,"Unexpected type: "+(0,IJ.default)(e))}function WA(e,t){var r=(0,CJ.astFromValue)(e,t);r!=null||(0,zA.default)(0);var n=(0,AJ.visit)(r,{ObjectValue:function(o){var s=[].concat(o.fields);return s.sort(function(a,u){return(0,wJ.default)(a.name.value,u.name.value)}),BA(BA({},o),{},{fields:s})}});return(0,OJ.print)(n)}function Wr(e,t){for(var r=[],n=[],i=[],o=(0,GA.default)(e,function(f){var h=f.name;return h}),s=(0,GA.default)(t,function(f){var h=f.name;return h}),a=0;a<e.length;a++){var u=e[a],c=s[u.name];c===void 0?n.push(u):i.push([u,c])}for(var l=0;l<t.length;l++){var d=t[l];o[d.name]===void 0&&r.push(d)}return{added:r,persisted:i,removed:n}}});var XA=v(Sg=>{"use strict";p();Object.defineProperty(Sg,"__esModule",{value:!0});Sg.findDeprecatedUsages=VJ;var qJ=io(),UJ=zm();function VJ(e,t){return(0,qJ.validate)(e,t,[UJ.NoDeprecatedCustomRule])}});var n0=v(se=>{"use strict";p();Object.defineProperty(se,"__esModule",{value:!0});Object.defineProperty(se,"getIntrospectionQuery",{enumerable:!0,get:function(){return GJ.getIntrospectionQuery}});Object.defineProperty(se,"getOperationAST",{enumerable:!0,get:function(){return $J.getOperationAST}});Object.defineProperty(se,"getOperationRootType",{enumerable:!0,get:function(){return BJ.getOperationRootType}});Object.defineProperty(se,"introspectionFromSchema",{enumerable:!0,get:function(){return HJ.introspectionFromSchema}});Object.defineProperty(se,"buildClientSchema",{enumerable:!0,get:function(){return KJ.buildClientSchema}});Object.defineProperty(se,"buildASTSchema",{enumerable:!0,get:function(){return ZA.buildASTSchema}});Object.defineProperty(se,"buildSchema",{enumerable:!0,get:function(){return ZA.buildSchema}});Object.defineProperty(se,"extendSchema",{enumerable:!0,get:function(){return e0.extendSchema}});Object.defineProperty(se,"getDescription",{enumerable:!0,get:function(){return e0.getDescription}});Object.defineProperty(se,"lexicographicSortSchema",{enumerable:!0,get:function(){return QJ.lexicographicSortSchema}});Object.defineProperty(se,"printSchema",{enumerable:!0,get:function(){return bg.printSchema}});Object.defineProperty(se,"printType",{enumerable:!0,get:function(){return bg.printType}});Object.defineProperty(se,"printIntrospectionSchema",{enumerable:!0,get:function(){return bg.printIntrospectionSchema}});Object.defineProperty(se,"typeFromAST",{enumerable:!0,get:function(){return WJ.typeFromAST}});Object.defineProperty(se,"valueFromAST",{enumerable:!0,get:function(){return zJ.valueFromAST}});Object.defineProperty(se,"valueFromASTUntyped",{enumerable:!0,get:function(){return JJ.valueFromASTUntyped}});Object.defineProperty(se,"astFromValue",{enumerable:!0,get:function(){return YJ.astFromValue}});Object.defineProperty(se,"TypeInfo",{enumerable:!0,get:function(){return t0.TypeInfo}});Object.defineProperty(se,"visitWithTypeInfo",{enumerable:!0,get:function(){return t0.visitWithTypeInfo}});Object.defineProperty(se,"coerceInputValue",{enumerable:!0,get:function(){return XJ.coerceInputValue}});Object.defineProperty(se,"concatAST",{enumerable:!0,get:function(){return ZJ.concatAST}});Object.defineProperty(se,"separateOperations",{enumerable:!0,get:function(){return eY.separateOperations}});Object.defineProperty(se,"stripIgnoredCharacters",{enumerable:!0,get:function(){return tY.stripIgnoredCharacters}});Object.defineProperty(se,"isEqualType",{enumerable:!0,get:function(){return Tg.isEqualType}});Object.defineProperty(se,"isTypeSubTypeOf",{enumerable:!0,get:function(){return Tg.isTypeSubTypeOf}});Object.defineProperty(se,"doTypesOverlap",{enumerable:!0,get:function(){return Tg.doTypesOverlap}});Object.defineProperty(se,"assertValidName",{enumerable:!0,get:function(){return r0.assertValidName}});Object.defineProperty(se,"isValidNameError",{enumerable:!0,get:function(){return r0.isValidNameError}});Object.defineProperty(se,"BreakingChangeType",{enumerable:!0,get:function(){return Zc.BreakingChangeType}});Object.defineProperty(se,"DangerousChangeType",{enumerable:!0,get:function(){return Zc.DangerousChangeType}});Object.defineProperty(se,"findBreakingChanges",{enumerable:!0,get:function(){return Zc.findBreakingChanges}});Object.defineProperty(se,"findDangerousChanges",{enumerable:!0,get:function(){return Zc.findDangerousChanges}});Object.defineProperty(se,"findDeprecatedUsages",{enumerable:!0,get:function(){return rY.findDeprecatedUsages}});var GJ=Zm(),$J=tg(),BJ=Lc(),HJ=sA(),KJ=uA(),ZA=TA(),e0=ig(),QJ=wA(),bg=DA(),WJ=Or(),zJ=Us(),JJ=_f(),YJ=Cs(),t0=_c(),XJ=km(),ZJ=LA(),eY=MA(),tY=VA(),Tg=Ts(),r0=of(),Zc=YA(),rY=XA()});var An=v(E=>{"use strict";p();Object.defineProperty(E,"__esModule",{value:!0});Object.defineProperty(E,"version",{enumerable:!0,get:function(){return i0.version}});Object.defineProperty(E,"versionInfo",{enumerable:!0,get:function(){return i0.versionInfo}});Object.defineProperty(E,"graphql",{enumerable:!0,get:function(){return o0.graphql}});Object.defineProperty(E,"graphqlSync",{enumerable:!0,get:function(){return o0.graphqlSync}});Object.defineProperty(E,"GraphQLSchema",{enumerable:!0,get:function(){return N.GraphQLSchema}});Object.defineProperty(E,"GraphQLDirective",{enumerable:!0,get:function(){return N.GraphQLDirective}});Object.defineProperty(E,"GraphQLScalarType",{enumerable:!0,get:function(){return N.GraphQLScalarType}});Object.defineProperty(E,"GraphQLObjectType",{enumerable:!0,get:function(){return N.GraphQLObjectType}});Object.defineProperty(E,"GraphQLInterfaceType",{enumerable:!0,get:function(){return N.GraphQLInterfaceType}});Object.defineProperty(E,"GraphQLUnionType",{enumerable:!0,get:function(){return N.GraphQLUnionType}});Object.defineProperty(E,"GraphQLEnumType",{enumerable:!0,get:function(){return N.GraphQLEnumType}});Object.defineProperty(E,"GraphQLInputObjectType",{enumerable:!0,get:function(){return N.GraphQLInputObjectType}});Object.defineProperty(E,"GraphQLList",{enumerable:!0,get:function(){return N.GraphQLList}});Object.defineProperty(E,"GraphQLNonNull",{enumerable:!0,get:function(){return N.GraphQLNonNull}});Object.defineProperty(E,"specifiedScalarTypes",{enumerable:!0,get:function(){return N.specifiedScalarTypes}});Object.defineProperty(E,"GraphQLInt",{enumerable:!0,get:function(){return N.GraphQLInt}});Object.defineProperty(E,"GraphQLFloat",{enumerable:!0,get:function(){return N.GraphQLFloat}});Object.defineProperty(E,"GraphQLString",{enumerable:!0,get:function(){return N.GraphQLString}});Object.defineProperty(E,"GraphQLBoolean",{enumerable:!0,get:function(){return N.GraphQLBoolean}});Object.defineProperty(E,"GraphQLID",{enumerable:!0,get:function(){return N.GraphQLID}});Object.defineProperty(E,"specifiedDirectives",{enumerable:!0,get:function(){return N.specifiedDirectives}});Object.defineProperty(E,"GraphQLIncludeDirective",{enumerable:!0,get:function(){return N.GraphQLIncludeDirective}});Object.defineProperty(E,"GraphQLSkipDirective",{enumerable:!0,get:function(){return N.GraphQLSkipDirective}});Object.defineProperty(E,"GraphQLDeprecatedDirective",{enumerable:!0,get:function(){return N.GraphQLDeprecatedDirective}});Object.defineProperty(E,"GraphQLSpecifiedByDirective",{enumerable:!0,get:function(){return N.GraphQLSpecifiedByDirective}});Object.defineProperty(E,"TypeKind",{enumerable:!0,get:function(){return N.TypeKind}});Object.defineProperty(E,"DEFAULT_DEPRECATION_REASON",{enumerable:!0,get:function(){return N.DEFAULT_DEPRECATION_REASON}});Object.defineProperty(E,"introspectionTypes",{enumerable:!0,get:function(){return N.introspectionTypes}});Object.defineProperty(E,"__Schema",{enumerable:!0,get:function(){return N.__Schema}});Object.defineProperty(E,"__Directive",{enumerable:!0,get:function(){return N.__Directive}});Object.defineProperty(E,"__DirectiveLocation",{enumerable:!0,get:function(){return N.__DirectiveLocation}});Object.defineProperty(E,"__Type",{enumerable:!0,get:function(){return N.__Type}});Object.defineProperty(E,"__Field",{enumerable:!0,get:function(){return N.__Field}});Object.defineProperty(E,"__InputValue",{enumerable:!0,get:function(){return N.__InputValue}});Object.defineProperty(E,"__EnumValue",{enumerable:!0,get:function(){return N.__EnumValue}});Object.defineProperty(E,"__TypeKind",{enumerable:!0,get:function(){return N.__TypeKind}});Object.defineProperty(E,"SchemaMetaFieldDef",{enumerable:!0,get:function(){return N.SchemaMetaFieldDef}});Object.defineProperty(E,"TypeMetaFieldDef",{enumerable:!0,get:function(){return N.TypeMetaFieldDef}});Object.defineProperty(E,"TypeNameMetaFieldDef",{enumerable:!0,get:function(){return N.TypeNameMetaFieldDef}});Object.defineProperty(E,"isSchema",{enumerable:!0,get:function(){return N.isSchema}});Object.defineProperty(E,"isDirective",{enumerable:!0,get:function(){return N.isDirective}});Object.defineProperty(E,"isType",{enumerable:!0,get:function(){return N.isType}});Object.defineProperty(E,"isScalarType",{enumerable:!0,get:function(){return N.isScalarType}});Object.defineProperty(E,"isObjectType",{enumerable:!0,get:function(){return N.isObjectType}});Object.defineProperty(E,"isInterfaceType",{enumerable:!0,get:function(){return N.isInterfaceType}});Object.defineProperty(E,"isUnionType",{enumerable:!0,get:function(){return N.isUnionType}});Object.defineProperty(E,"isEnumType",{enumerable:!0,get:function(){return N.isEnumType}});Object.defineProperty(E,"isInputObjectType",{enumerable:!0,get:function(){return N.isInputObjectType}});Object.defineProperty(E,"isListType",{enumerable:!0,get:function(){return N.isListType}});Object.defineProperty(E,"isNonNullType",{enumerable:!0,get:function(){return N.isNonNullType}});Object.defineProperty(E,"isInputType",{enumerable:!0,get:function(){return N.isInputType}});Object.defineProperty(E,"isOutputType",{enumerable:!0,get:function(){return N.isOutputType}});Object.defineProperty(E,"isLeafType",{enumerable:!0,get:function(){return N.isLeafType}});Object.defineProperty(E,"isCompositeType",{enumerable:!0,get:function(){return N.isCompositeType}});Object.defineProperty(E,"isAbstractType",{enumerable:!0,get:function(){return N.isAbstractType}});Object.defineProperty(E,"isWrappingType",{enumerable:!0,get:function(){return N.isWrappingType}});Object.defineProperty(E,"isNullableType",{enumerable:!0,get:function(){return N.isNullableType}});Object.defineProperty(E,"isNamedType",{enumerable:!0,get:function(){return N.isNamedType}});Object.defineProperty(E,"isRequiredArgument",{enumerable:!0,get:function(){return N.isRequiredArgument}});Object.defineProperty(E,"isRequiredInputField",{enumerable:!0,get:function(){return N.isRequiredInputField}});Object.defineProperty(E,"isSpecifiedScalarType",{enumerable:!0,get:function(){return N.isSpecifiedScalarType}});Object.defineProperty(E,"isIntrospectionType",{enumerable:!0,get:function(){return N.isIntrospectionType}});Object.defineProperty(E,"isSpecifiedDirective",{enumerable:!0,get:function(){return N.isSpecifiedDirective}});Object.defineProperty(E,"assertSchema",{enumerable:!0,get:function(){return N.assertSchema}});Object.defineProperty(E,"assertDirective",{enumerable:!0,get:function(){return N.assertDirective}});Object.defineProperty(E,"assertType",{enumerable:!0,get:function(){return N.assertType}});Object.defineProperty(E,"assertScalarType",{enumerable:!0,get:function(){return N.assertScalarType}});Object.defineProperty(E,"assertObjectType",{enumerable:!0,get:function(){return N.assertObjectType}});Object.defineProperty(E,"assertInterfaceType",{enumerable:!0,get:function(){return N.assertInterfaceType}});Object.defineProperty(E,"assertUnionType",{enumerable:!0,get:function(){return N.assertUnionType}});Object.defineProperty(E,"assertEnumType",{enumerable:!0,get:function(){return N.assertEnumType}});Object.defineProperty(E,"assertInputObjectType",{enumerable:!0,get:function(){return N.assertInputObjectType}});Object.defineProperty(E,"assertListType",{enumerable:!0,get:function(){return N.assertListType}});Object.defineProperty(E,"assertNonNullType",{enumerable:!0,get:function(){return N.assertNonNullType}});Object.defineProperty(E,"assertInputType",{enumerable:!0,get:function(){return N.assertInputType}});Object.defineProperty(E,"assertOutputType",{enumerable:!0,get:function(){return N.assertOutputType}});Object.defineProperty(E,"assertLeafType",{enumerable:!0,get:function(){return N.assertLeafType}});Object.defineProperty(E,"assertCompositeType",{enumerable:!0,get:function(){return N.assertCompositeType}});Object.defineProperty(E,"assertAbstractType",{enumerable:!0,get:function(){return N.assertAbstractType}});Object.defineProperty(E,"assertWrappingType",{enumerable:!0,get:function(){return N.assertWrappingType}});Object.defineProperty(E,"assertNullableType",{enumerable:!0,get:function(){return N.assertNullableType}});Object.defineProperty(E,"assertNamedType",{enumerable:!0,get:function(){return N.assertNamedType}});Object.defineProperty(E,"getNullableType",{enumerable:!0,get:function(){return N.getNullableType}});Object.defineProperty(E,"getNamedType",{enumerable:!0,get:function(){return N.getNamedType}});Object.defineProperty(E,"validateSchema",{enumerable:!0,get:function(){return N.validateSchema}});Object.defineProperty(E,"assertValidSchema",{enumerable:!0,get:function(){return N.assertValidSchema}});Object.defineProperty(E,"Token",{enumerable:!0,get:function(){return Ae.Token}});Object.defineProperty(E,"Source",{enumerable:!0,get:function(){return Ae.Source}});Object.defineProperty(E,"Location",{enumerable:!0,get:function(){return Ae.Location}});Object.defineProperty(E,"getLocation",{enumerable:!0,get:function(){return Ae.getLocation}});Object.defineProperty(E,"printLocation",{enumerable:!0,get:function(){return Ae.printLocation}});Object.defineProperty(E,"printSourceLocation",{enumerable:!0,get:function(){return Ae.printSourceLocation}});Object.defineProperty(E,"Lexer",{enumerable:!0,get:function(){return Ae.Lexer}});Object.defineProperty(E,"TokenKind",{enumerable:!0,get:function(){return Ae.TokenKind}});Object.defineProperty(E,"parse",{enumerable:!0,get:function(){return Ae.parse}});Object.defineProperty(E,"parseValue",{enumerable:!0,get:function(){return Ae.parseValue}});Object.defineProperty(E,"parseType",{enumerable:!0,get:function(){return Ae.parseType}});Object.defineProperty(E,"print",{enumerable:!0,get:function(){return Ae.print}});Object.defineProperty(E,"visit",{enumerable:!0,get:function(){return Ae.visit}});Object.defineProperty(E,"visitInParallel",{enumerable:!0,get:function(){return Ae.visitInParallel}});Object.defineProperty(E,"getVisitFn",{enumerable:!0,get:function(){return Ae.getVisitFn}});Object.defineProperty(E,"BREAK",{enumerable:!0,get:function(){return Ae.BREAK}});Object.defineProperty(E,"Kind",{enumerable:!0,get:function(){return Ae.Kind}});Object.defineProperty(E,"DirectiveLocation",{enumerable:!0,get:function(){return Ae.DirectiveLocation}});Object.defineProperty(E,"isDefinitionNode",{enumerable:!0,get:function(){return Ae.isDefinitionNode}});Object.defineProperty(E,"isExecutableDefinitionNode",{enumerable:!0,get:function(){return Ae.isExecutableDefinitionNode}});Object.defineProperty(E,"isSelectionNode",{enumerable:!0,get:function(){return Ae.isSelectionNode}});Object.defineProperty(E,"isValueNode",{enumerable:!0,get:function(){return Ae.isValueNode}});Object.defineProperty(E,"isTypeNode",{enumerable:!0,get:function(){return Ae.isTypeNode}});Object.defineProperty(E,"isTypeSystemDefinitionNode",{enumerable:!0,get:function(){return Ae.isTypeSystemDefinitionNode}});Object.defineProperty(E,"isTypeDefinitionNode",{enumerable:!0,get:function(){return Ae.isTypeDefinitionNode}});Object.defineProperty(E,"isTypeSystemExtensionNode",{enumerable:!0,get:function(){return Ae.isTypeSystemExtensionNode}});Object.defineProperty(E,"isTypeExtensionNode",{enumerable:!0,get:function(){return Ae.isTypeExtensionNode}});Object.defineProperty(E,"execute",{enumerable:!0,get:function(){return mo.execute}});Object.defineProperty(E,"executeSync",{enumerable:!0,get:function(){return mo.executeSync}});Object.defineProperty(E,"defaultFieldResolver",{enumerable:!0,get:function(){return mo.defaultFieldResolver}});Object.defineProperty(E,"defaultTypeResolver",{enumerable:!0,get:function(){return mo.defaultTypeResolver}});Object.defineProperty(E,"responsePathAsArray",{enumerable:!0,get:function(){return mo.responsePathAsArray}});Object.defineProperty(E,"getDirectiveValues",{enumerable:!0,get:function(){return mo.getDirectiveValues}});Object.defineProperty(E,"subscribe",{enumerable:!0,get:function(){return s0.subscribe}});Object.defineProperty(E,"createSourceEventStream",{enumerable:!0,get:function(){return s0.createSourceEventStream}});Object.defineProperty(E,"validate",{enumerable:!0,get:function(){return ne.validate}});Object.defineProperty(E,"ValidationContext",{enumerable:!0,get:function(){return ne.ValidationContext}});Object.defineProperty(E,"specifiedRules",{enumerable:!0,get:function(){return ne.specifiedRules}});Object.defineProperty(E,"recommendedRules",{enumerable:!0,get:function(){return ne.recommendedRules}});Object.defineProperty(E,"ExecutableDefinitionsRule",{enumerable:!0,get:function(){return ne.ExecutableDefinitionsRule}});Object.defineProperty(E,"FieldsOnCorrectTypeRule",{enumerable:!0,get:function(){return ne.FieldsOnCorrectTypeRule}});Object.defineProperty(E,"FragmentsOnCompositeTypesRule",{enumerable:!0,get:function(){return ne.FragmentsOnCompositeTypesRule}});Object.defineProperty(E,"KnownArgumentNamesRule",{enumerable:!0,get:function(){return ne.KnownArgumentNamesRule}});Object.defineProperty(E,"KnownDirectivesRule",{enumerable:!0,get:function(){return ne.KnownDirectivesRule}});Object.defineProperty(E,"KnownFragmentNamesRule",{enumerable:!0,get:function(){return ne.KnownFragmentNamesRule}});Object.defineProperty(E,"KnownTypeNamesRule",{enumerable:!0,get:function(){return ne.KnownTypeNamesRule}});Object.defineProperty(E,"LoneAnonymousOperationRule",{enumerable:!0,get:function(){return ne.LoneAnonymousOperationRule}});Object.defineProperty(E,"NoFragmentCyclesRule",{enumerable:!0,get:function(){return ne.NoFragmentCyclesRule}});Object.defineProperty(E,"NoUndefinedVariablesRule",{enumerable:!0,get:function(){return ne.NoUndefinedVariablesRule}});Object.defineProperty(E,"NoUnusedFragmentsRule",{enumerable:!0,get:function(){return ne.NoUnusedFragmentsRule}});Object.defineProperty(E,"NoUnusedVariablesRule",{enumerable:!0,get:function(){return ne.NoUnusedVariablesRule}});Object.defineProperty(E,"OverlappingFieldsCanBeMergedRule",{enumerable:!0,get:function(){return ne.OverlappingFieldsCanBeMergedRule}});Object.defineProperty(E,"PossibleFragmentSpreadsRule",{enumerable:!0,get:function(){return ne.PossibleFragmentSpreadsRule}});Object.defineProperty(E,"ProvidedRequiredArgumentsRule",{enumerable:!0,get:function(){return ne.ProvidedRequiredArgumentsRule}});Object.defineProperty(E,"ScalarLeafsRule",{enumerable:!0,get:function(){return ne.ScalarLeafsRule}});Object.defineProperty(E,"SingleFieldSubscriptionsRule",{enumerable:!0,get:function(){return ne.SingleFieldSubscriptionsRule}});Object.defineProperty(E,"UniqueArgumentNamesRule",{enumerable:!0,get:function(){return ne.UniqueArgumentNamesRule}});Object.defineProperty(E,"UniqueDirectivesPerLocationRule",{enumerable:!0,get:function(){return ne.UniqueDirectivesPerLocationRule}});Object.defineProperty(E,"UniqueFragmentNamesRule",{enumerable:!0,get:function(){return ne.UniqueFragmentNamesRule}});Object.defineProperty(E,"UniqueInputFieldNamesRule",{enumerable:!0,get:function(){return ne.UniqueInputFieldNamesRule}});Object.defineProperty(E,"UniqueOperationNamesRule",{enumerable:!0,get:function(){return ne.UniqueOperationNamesRule}});Object.defineProperty(E,"UniqueVariableNamesRule",{enumerable:!0,get:function(){return ne.UniqueVariableNamesRule}});Object.defineProperty(E,"ValuesOfCorrectTypeRule",{enumerable:!0,get:function(){return ne.ValuesOfCorrectTypeRule}});Object.defineProperty(E,"VariablesAreInputTypesRule",{enumerable:!0,get:function(){return ne.VariablesAreInputTypesRule}});Object.defineProperty(E,"VariablesInAllowedPositionRule",{enumerable:!0,get:function(){return ne.VariablesInAllowedPositionRule}});Object.defineProperty(E,"MaxIntrospectionDepthRule",{enumerable:!0,get:function(){return ne.MaxIntrospectionDepthRule}});Object.defineProperty(E,"LoneSchemaDefinitionRule",{enumerable:!0,get:function(){return ne.LoneSchemaDefinitionRule}});Object.defineProperty(E,"UniqueOperationTypesRule",{enumerable:!0,get:function(){return ne.UniqueOperationTypesRule}});Object.defineProperty(E,"UniqueTypeNamesRule",{enumerable:!0,get:function(){return ne.UniqueTypeNamesRule}});Object.defineProperty(E,"UniqueEnumValueNamesRule",{enumerable:!0,get:function(){return ne.UniqueEnumValueNamesRule}});Object.defineProperty(E,"UniqueFieldDefinitionNamesRule",{enumerable:!0,get:function(){return ne.UniqueFieldDefinitionNamesRule}});Object.defineProperty(E,"UniqueDirectiveNamesRule",{enumerable:!0,get:function(){return ne.UniqueDirectiveNamesRule}});Object.defineProperty(E,"PossibleTypeExtensionsRule",{enumerable:!0,get:function(){return ne.PossibleTypeExtensionsRule}});Object.defineProperty(E,"NoDeprecatedCustomRule",{enumerable:!0,get:function(){return ne.NoDeprecatedCustomRule}});Object.defineProperty(E,"NoSchemaIntrospectionCustomRule",{enumerable:!0,get:function(){return ne.NoSchemaIntrospectionCustomRule}});Object.defineProperty(E,"GraphQLError",{enumerable:!0,get:function(){return ia.GraphQLError}});Object.defineProperty(E,"syntaxError",{enumerable:!0,get:function(){return ia.syntaxError}});Object.defineProperty(E,"locatedError",{enumerable:!0,get:function(){return ia.locatedError}});Object.defineProperty(E,"printError",{enumerable:!0,get:function(){return ia.printError}});Object.defineProperty(E,"formatError",{enumerable:!0,get:function(){return ia.formatError}});Object.defineProperty(E,"getIntrospectionQuery",{enumerable:!0,get:function(){return pe.getIntrospectionQuery}});Object.defineProperty(E,"getOperationAST",{enumerable:!0,get:function(){return pe.getOperationAST}});Object.defineProperty(E,"getOperationRootType",{enumerable:!0,get:function(){return pe.getOperationRootType}});Object.defineProperty(E,"introspectionFromSchema",{enumerable:!0,get:function(){return pe.introspectionFromSchema}});Object.defineProperty(E,"buildClientSchema",{enumerable:!0,get:function(){return pe.buildClientSchema}});Object.defineProperty(E,"buildASTSchema",{enumerable:!0,get:function(){return pe.buildASTSchema}});Object.defineProperty(E,"buildSchema",{enumerable:!0,get:function(){return pe.buildSchema}});Object.defineProperty(E,"getDescription",{enumerable:!0,get:function(){return pe.getDescription}});Object.defineProperty(E,"extendSchema",{enumerable:!0,get:function(){return pe.extendSchema}});Object.defineProperty(E,"lexicographicSortSchema",{enumerable:!0,get:function(){return pe.lexicographicSortSchema}});Object.defineProperty(E,"printSchema",{enumerable:!0,get:function(){return pe.printSchema}});Object.defineProperty(E,"printType",{enumerable:!0,get:function(){return pe.printType}});Object.defineProperty(E,"printIntrospectionSchema",{enumerable:!0,get:function(){return pe.printIntrospectionSchema}});Object.defineProperty(E,"typeFromAST",{enumerable:!0,get:function(){return pe.typeFromAST}});Object.defineProperty(E,"valueFromAST",{enumerable:!0,get:function(){return pe.valueFromAST}});Object.defineProperty(E,"valueFromASTUntyped",{enumerable:!0,get:function(){return pe.valueFromASTUntyped}});Object.defineProperty(E,"astFromValue",{enumerable:!0,get:function(){return pe.astFromValue}});Object.defineProperty(E,"TypeInfo",{enumerable:!0,get:function(){return pe.TypeInfo}});Object.defineProperty(E,"visitWithTypeInfo",{enumerable:!0,get:function(){return pe.visitWithTypeInfo}});Object.defineProperty(E,"coerceInputValue",{enumerable:!0,get:function(){return pe.coerceInputValue}});Object.defineProperty(E,"concatAST",{enumerable:!0,get:function(){return pe.concatAST}});Object.defineProperty(E,"separateOperations",{enumerable:!0,get:function(){return pe.separateOperations}});Object.defineProperty(E,"stripIgnoredCharacters",{enumerable:!0,get:function(){return pe.stripIgnoredCharacters}});Object.defineProperty(E,"isEqualType",{enumerable:!0,get:function(){return pe.isEqualType}});Object.defineProperty(E,"isTypeSubTypeOf",{enumerable:!0,get:function(){return pe.isTypeSubTypeOf}});Object.defineProperty(E,"doTypesOverlap",{enumerable:!0,get:function(){return pe.doTypesOverlap}});Object.defineProperty(E,"assertValidName",{enumerable:!0,get:function(){return pe.assertValidName}});Object.defineProperty(E,"isValidNameError",{enumerable:!0,get:function(){return pe.isValidNameError}});Object.defineProperty(E,"BreakingChangeType",{enumerable:!0,get:function(){return pe.BreakingChangeType}});Object.defineProperty(E,"DangerousChangeType",{enumerable:!0,get:function(){return pe.DangerousChangeType}});Object.defineProperty(E,"findBreakingChanges",{enumerable:!0,get:function(){return pe.findBreakingChanges}});Object.defineProperty(E,"findDangerousChanges",{enumerable:!0,get:function(){return pe.findDangerousChanges}});Object.defineProperty(E,"findDeprecatedUsages",{enumerable:!0,get:function(){return pe.findDeprecatedUsages}});var i0=dT(),o0=PO(),N=DO(),Ae=jO(),mo=MO(),s0=YO(),ne=eA(),ia=nA(),pe=n0()});var S0=v((lue,zr)=>{p();var xg=F("fs"),il=F("path"),cY=F("os"),lY=F("crypto"),g0=["\u25C8 encrypted .env [www.dotenvx.com]","\u25C8 secrets for agents [www.dotenvx.com]","\u2301 auth for agents [www.vestauth.com]","\u2318 custom filepath { path: '/custom/path/.env' }","\u2318 enable debugging { debug: true }","\u2318 override existing { override: true }","\u2318 suppress logs { quiet: true }","\u2318 multiple files { path: ['.env.local', '.env'] }"];function pY(){return g0[Math.floor(Math.random()*g0.length)]}function go(e){return typeof e=="string"?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}function dY(){return process.stdout.isTTY}function fY(e){return dY()?`\x1B[2m${e}\x1B[0m`:e}var hY=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function mY(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
200
+ `);let n;for(;(n=hY.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
201
+ `),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function gY(e){e=e||{};let t=_0(e);e.path=t;let r=et.configDotenv(e);if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=E0(e).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),u=vY(r,a);o=et.decrypt(u.ciphertext,u.key);break}catch(a){if(s+1>=i)throw a}return et.parse(o)}function yY(e){console.error(`\u26A0 ${e}`)}function aa(e){console.log(`\u2506 ${e}`)}function v0(e){console.log(`\u25C7 ${e}`)}function E0(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function vY(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let u=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 u.code="INVALID_DOTENV_KEY",u}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function _0(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)xg.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=il.resolve(process.cwd(),".env.vault");return xg.existsSync(t)?t:null}function y0(e){return e[0]==="~"?il.join(cY.homedir(),e.slice(1)):e}function EY(e){let t=go(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=go(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&v0("loading env from encrypted .env.vault");let n=et._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),et.populate(i,n,e),{parsed:n}}function _Y(e){let t=il.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let i=go(n.DOTENV_CONFIG_DEBUG||e&&e.debug),o=go(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:i&&aa("no encoding is specified (UTF-8 is used by default)");let s=[t];if(e&&e.path)if(!Array.isArray(e.path))s=[y0(e.path)];else{s=[];for(let l of e.path)s.push(y0(l))}let a,u={};for(let l of s)try{let d=et.parse(xg.readFileSync(l,{encoding:r}));et.populate(u,d,e)}catch(d){i&&aa(`failed to load ${l} ${d.message}`),a=d}let c=et.populate(n,u,e);if(i=go(n.DOTENV_CONFIG_DEBUG||i),o=go(n.DOTENV_CONFIG_QUIET||o),i||!o){let l=Object.keys(c).length,d=[];for(let f of s)try{let h=il.relative(process.cwd(),f);d.push(h)}catch(h){i&&aa(`failed to load ${f} ${h.message}`),a=h}v0(`injected env (${l}) from ${d.join(",")} ${fY(`// tip: ${pY()}`)}`)}return a?{parsed:u,error:a}:{parsed:u}}function SY(e){if(E0(e).length===0)return et.configDotenv(e);let t=_0(e);return t?et._configVault(e):(yY(`you set DOTENV_KEY but you are missing a .env.vault file at ${t}`),et.configDotenv(e))}function bY(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=lY.createDecipheriv("aes-256-gcm",r,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,u=s.message==="Invalid key length",c=s.message==="Unsupported state or unable to authenticate data";if(a||u){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(c){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw s}}function TY(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override),o={};if(typeof t!="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(t))Object.prototype.hasOwnProperty.call(e,s)?(i===!0&&(e[s]=t[s],o[s]=t[s]),n&&aa(i===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):(e[s]=t[s],o[s]=t[s]);return o}var et={configDotenv:_Y,_configVault:EY,_parseVault:gY,config:SY,decrypt:bY,parse:mY,populate:TY};zr.exports.configDotenv=et.configDotenv;zr.exports._configVault=et._configVault;zr.exports._parseVault=et._parseVault;zr.exports.config=et.config;zr.exports.decrypt=et.decrypt;zr.exports.parse=et.parse;zr.exports.populate=et.populate;zr.exports=et});var Jr=v((jue,wx)=>{"use strict";p();var Tx=["nodebuffer","arraybuffer","fragments"],Ix=typeof Blob<"u";Ix&&Tx.push("blob");wx.exports={BINARY_TYPES:Tx,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Ix,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var la=v((Fue,ul)=>{"use strict";p();var{EMPTY_BUFFER:DY}=Jr(),Lg=Buffer[Symbol.species];function LY(e,t){if(e.length===0)return DY;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let i=0;i<e.length;i++){let o=e[i];r.set(o,n),n+=o.length}return n<t?new Lg(r.buffer,r.byteOffset,n):r}function Ox(e,t,r,n,i){for(let o=0;o<i;o++)r[n+o]=e[o]^t[o&3]}function Ax(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function kY(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function kg(e){if(kg.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Lg(e):ArrayBuffer.isView(e)?t=new Lg(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),kg.readOnly=!1),t}ul.exports={concat:LY,mask:Ox,toArrayBuffer:kY,toBuffer:kg,unmask:Ax};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=F("bufferutil");ul.exports.mask=function(t,r,n,i,o){o<48?Ox(t,r,n,i,o):e.mask(t,r,n,i,o)},ul.exports.unmask=function(t,r){t.length<32?Ax(t,r):e.unmask(t,r)}}catch{}});var Rx=v((Uue,Cx)=>{"use strict";p();var xx=Symbol("kDone"),jg=Symbol("kRun"),Mg=class{constructor(t){this[xx]=()=>{this.pending--,this[jg]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[jg]()}[jg](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[xx])}}};Cx.exports=Mg});var So=v((Gue,Lx)=>{"use strict";p();var pa=F("zlib"),Px=la(),jY=Rx(),{kStatusCode:Nx}=Jr(),MY=Buffer[Symbol.species],FY=Buffer.from([0,0,255,255]),ll=Symbol("permessage-deflate"),Yr=Symbol("total-length"),Eo=Symbol("callback"),Cn=Symbol("buffers"),_o=Symbol("error"),cl,Fg=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!cl){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;cl=new jY(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Eo];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),t}decompress(t,r,n){cl.add(i=>{this._decompress(t,r,(o,s)=>{i(),n(o,s)})})}compress(t,r,n){cl.add(i=>{this._compress(t,r,(o,s)=>{i(),n(o,s)})})}_decompress(t,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?pa.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=pa.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[ll]=this,this._inflate[Yr]=0,this._inflate[Cn]=[],this._inflate.on("error",UY),this._inflate.on("data",Dx)}this._inflate[Eo]=n,this._inflate.write(t),r&&this._inflate.write(FY),this._inflate.flush(()=>{let o=this._inflate[_o];if(o){this._inflate.close(),this._inflate=null,n(o);return}let s=Px.concat(this._inflate[Cn],this._inflate[Yr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Yr]=0,this._inflate[Cn]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?pa.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=pa.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Yr]=0,this._deflate[Cn]=[],this._deflate.on("data",qY)}this._deflate[Eo]=n,this._deflate.write(t),this._deflate.flush(pa.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=Px.concat(this._deflate[Cn],this._deflate[Yr]);r&&(o=new MY(o.buffer,o.byteOffset,o.length-4)),this._deflate[Eo]=null,this._deflate[Yr]=0,this._deflate[Cn]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,o)})}};Lx.exports=Fg;function qY(e){this[Cn].push(e),this[Yr]+=e.length}function Dx(e){if(this[Yr]+=e.length,this[ll]._maxPayload<1||this[Yr]<=this[ll]._maxPayload){this[Cn].push(e);return}this[_o]=new RangeError("Max payload size exceeded"),this[_o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_o][Nx]=1009,this.removeListener("data",Dx),this.reset()}function UY(e){if(this[ll]._inflate=null,this[_o]){this[Eo](this[_o]);return}e[Nx]=1007,this[Eo](e)}});var bo=v((Bue,pl)=>{"use strict";p();var{isUtf8:kx}=F("buffer"),{hasBlob:VY}=Jr(),GY=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function $Y(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function qg(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function BY(e){return VY&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}pl.exports={isBlob:BY,isValidStatusCode:$Y,isValidUTF8:qg,tokenChars:GY};if(kx)pl.exports.isValidUTF8=function(e){return e.length<24?qg(e):kx(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=F("utf-8-validate");pl.exports.isValidUTF8=function(t){return t.length<32?qg(t):e(t)}}catch{}});var Bg=v((Kue,Gx)=>{"use strict";p();var{Writable:HY}=F("stream"),jx=So(),{BINARY_TYPES:KY,EMPTY_BUFFER:Mx,kStatusCode:QY,kWebSocket:WY}=Jr(),{concat:Ug,toArrayBuffer:zY,unmask:JY}=la(),{isValidStatusCode:YY,isValidUTF8:Fx}=bo(),dl=Buffer[Symbol.species],ir=0,qx=1,Ux=2,Vx=3,Vg=4,Gg=5,fl=6,$g=class extends HY{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||KY[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[WY]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=ir}_write(t,r,n){if(this._opcode===8&&this._state==ir)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new dl(n.buffer,n.byteOffset+t,n.length-t),new dl(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],i=r.length-t;t>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),i),this._buffers[0]=new dl(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case ir:this.getInfo(t);break;case qx:this.getPayloadLength16(t);break;case Ux:this.getPayloadLength64(t);break;case Vx:this.getMask();break;case Vg:this.getData(t);break;case Gg:case fl:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[jx.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(i);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(i);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(i);return}if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(i);return}this._payloadLength===126?this._state=qx:this._payloadLength===127?this._state=Ux:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(i);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=Vx:this._state=Vg}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Vg}getData(t){let r=Mx;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&JY(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._compressed){this._state=Gg,this.decompress(r,t);return}if(r.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}this._messageLength=this._totalPayloadLength,this._fragments.push(r)}this.dataMessage(t)}decompress(t,r){this._extensions[jx.extensionName].decompress(t,this._fin,(i,o)=>{if(i)return r(i);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let s=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");r(s);return}this._fragments.push(o)}this.dataMessage(r),this._state===ir&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=ir;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=Ug(n,r):this._binaryType==="arraybuffer"?i=zY(Ug(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=ir):(this._state=fl,setImmediate(()=>{this.emit("message",i,!0),this._state=ir,this.startLoop(t)}))}else{let i=Ug(n,r);if(!this._skipUTF8Validation&&!Fx(i)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(o);return}this._state===Gg||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=ir):(this._state=fl,setImmediate(()=>{this.emit("message",i,!1),this._state=ir,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,Mx),this.end();else{let n=t.readUInt16BE(0);if(!YY(n)){let o=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(o);return}let i=new dl(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!Fx(i)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(o);return}this._loop=!1,this.emit("conclude",n,i),this.end()}this._state=ir;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=ir):(this._state=fl,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=ir,this.startLoop(r)}))}createError(t,r,n,i,o){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=o,s[QY]=i,s}};Gx.exports=$g});var Qg=v((zue,Hx)=>{"use strict";p();var{Duplex:Wue}=F("stream"),{randomFillSync:XY}=F("crypto"),{types:{isUint8Array:ZY}}=F("util"),$x=So(),{EMPTY_BUFFER:e2,kWebSocket:t2,NOOP:r2}=Jr(),{isBlob:To,isValidStatusCode:n2}=bo(),{mask:Bx,toBuffer:li}=la(),or=Symbol("kByteLength"),i2=Buffer.alloc(4),hl=8*1024,pi,Io=hl,gr=0,o2=1,s2=2,Hg=class e{constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=gr,this.onerror=r2,this[t2]=void 0}static frame(t,r){let n,i=!1,o=2,s=!1;r.mask&&(n=r.maskBuffer||i2,r.generateMask?r.generateMask(n):(Io===hl&&(pi===void 0&&(pi=Buffer.alloc(hl)),XY(pi,0,hl),Io=0),n[0]=pi[Io++],n[1]=pi[Io++],n[2]=pi[Io++],n[3]=pi[Io++]),s=(n[0]|n[1]|n[2]|n[3])===0,o=6);let a;typeof t=="string"?(!r.mask||s)&&r[or]!==void 0?a=r[or]:(t=Buffer.from(t),a=t.length):(a=t.length,i=r.mask&&r.readOnly&&!s);let u=a;a>=65536?(o+=8,u=127):a>125&&(o+=2,u=126);let c=Buffer.allocUnsafe(i?a+o:o);return c[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(c[0]|=64),c[1]=u,u===126?c.writeUInt16BE(a,2):u===127&&(c[2]=c[3]=0,c.writeUIntBE(a,4,6)),r.mask?(c[1]|=128,c[o-4]=n[0],c[o-3]=n[1],c[o-2]=n[2],c[o-1]=n[3],s?[c,t]:i?(Bx(t,n,c,o,a),[c]):(Bx(t,n,t,0,a),[c,t])):[c,t]}close(t,r,n,i){let o;if(t===void 0)o=e2;else{if(typeof t!="number"||!n2(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");if(o=Buffer.allocUnsafe(2+a),o.writeUInt16BE(t,0),typeof r=="string")o.write(r,2);else if(ZY(r))o.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[or]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==gr?this.enqueue([this.dispatch,o,!1,s,i]):this.sendFrame(e.frame(o,s),i)}ping(t,r,n){let i,o;if(typeof t=="string"?(i=Buffer.byteLength(t),o=!1):To(t)?(i=t.size,o=!1):(t=li(t),i=t.length,o=li.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[or]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};To(t)?this._state!==gr?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==gr?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let i,o;if(typeof t=="string"?(i=Buffer.byteLength(t),o=!1):To(t)?(i=t.size,o=!1):(t=li(t),i=t.length,o=li.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[or]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};To(t)?this._state!==gr?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==gr?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let i=this._extensions[$x.extensionName],o=r.binary?2:1,s=r.compress,a,u;typeof t=="string"?(a=Buffer.byteLength(t),u=!1):To(t)?(a=t.size,u=!1):(t=li(t),a=t.length,u=li.readOnly),this._firstFragment?(this._firstFragment=!1,s&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=a>=i._threshold),this._compress=s):(s=!1,o=0),r.fin&&(this._firstFragment=!0);let c={[or]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:u,rsv1:s};To(t)?this._state!==gr?this.enqueue([this.getBlobData,t,this._compress,c,n]):this.getBlobData(t,this._compress,c,n):this._state!==gr?this.enqueue([this.dispatch,t,this._compress,c,n]):this.dispatch(t,this._compress,c,n)}getBlobData(t,r,n,i){this._bufferedBytes+=n[or],this._state=s2,t.arrayBuffer().then(o=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(Kg,this,a,i);return}this._bufferedBytes-=n[or];let s=li(o);r?this.dispatch(s,r,n,i):(this._state=gr,this.sendFrame(e.frame(s,n),i),this.dequeue())}).catch(o=>{process.nextTick(a2,this,o,i)})}dispatch(t,r,n,i){if(!r){this.sendFrame(e.frame(t,n),i);return}let o=this._extensions[$x.extensionName];this._bufferedBytes+=n[or],this._state=o2,o.compress(t,n.fin,(s,a)=>{if(this._socket.destroyed){let u=new Error("The socket was closed while data was being compressed");Kg(this,u,i);return}this._bufferedBytes-=n[or],this._state=gr,n.readOnly=!1,this.sendFrame(e.frame(a,n),i),this.dequeue()})}dequeue(){for(;this._state===gr&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][or],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][or],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};Hx.exports=Hg;function Kg(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let i=e._queue[n],o=i[i.length-1];typeof o=="function"&&o(t)}}function a2(e,t,r){Kg(e,t,r),e.onerror(t)}});var eC=v((Yue,Zx)=>{"use strict";p();var{kForOnEventAttribute:da,kListener:Wg}=Jr(),Kx=Symbol("kCode"),Qx=Symbol("kData"),Wx=Symbol("kError"),zx=Symbol("kMessage"),Jx=Symbol("kReason"),wo=Symbol("kTarget"),Yx=Symbol("kType"),Xx=Symbol("kWasClean"),Xr=class{constructor(t){this[wo]=null,this[Yx]=t}get target(){return this[wo]}get type(){return this[Yx]}};Object.defineProperty(Xr.prototype,"target",{enumerable:!0});Object.defineProperty(Xr.prototype,"type",{enumerable:!0});var di=class extends Xr{constructor(t,r={}){super(t),this[Kx]=r.code===void 0?0:r.code,this[Jx]=r.reason===void 0?"":r.reason,this[Xx]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Kx]}get reason(){return this[Jx]}get wasClean(){return this[Xx]}};Object.defineProperty(di.prototype,"code",{enumerable:!0});Object.defineProperty(di.prototype,"reason",{enumerable:!0});Object.defineProperty(di.prototype,"wasClean",{enumerable:!0});var Oo=class extends Xr{constructor(t,r={}){super(t),this[Wx]=r.error===void 0?null:r.error,this[zx]=r.message===void 0?"":r.message}get error(){return this[Wx]}get message(){return this[zx]}};Object.defineProperty(Oo.prototype,"error",{enumerable:!0});Object.defineProperty(Oo.prototype,"message",{enumerable:!0});var fa=class extends Xr{constructor(t,r={}){super(t),this[Qx]=r.data===void 0?null:r.data}get data(){return this[Qx]}};Object.defineProperty(fa.prototype,"data",{enumerable:!0});var u2={addEventListener(e,t,r={}){for(let i of this.listeners(e))if(!r[da]&&i[Wg]===t&&!i[da])return;let n;if(e==="message")n=function(o,s){let a=new fa("message",{data:s?o:o.toString()});a[wo]=this,ml(t,this,a)};else if(e==="close")n=function(o,s){let a=new di("close",{code:o,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[wo]=this,ml(t,this,a)};else if(e==="error")n=function(o){let s=new Oo("error",{error:o,message:o.message});s[wo]=this,ml(t,this,s)};else if(e==="open")n=function(){let o=new Xr("open");o[wo]=this,ml(t,this,o)};else return;n[da]=!!r[da],n[Wg]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[Wg]===t&&!r[da]){this.removeListener(e,r);break}}};Zx.exports={CloseEvent:di,ErrorEvent:Oo,Event:Xr,EventTarget:u2,MessageEvent:fa};function ml(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var gl=v((Zue,tC)=>{"use strict";p();var{tokenChars:ha}=bo();function Nr(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function c2(e){let t=Object.create(null),r=Object.create(null),n=!1,i=!1,o=!1,s,a,u=-1,c=-1,l=-1,d=0;for(;d<e.length;d++)if(c=e.charCodeAt(d),s===void 0)if(l===-1&&ha[c]===1)u===-1&&(u=d);else if(d!==0&&(c===32||c===9))l===-1&&u!==-1&&(l=d);else if(c===59||c===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let h=e.slice(u,l);c===44?(Nr(t,h,r),r=Object.create(null)):s=h,u=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(a===void 0)if(l===-1&&ha[c]===1)u===-1&&(u=d);else if(c===32||c===9)l===-1&&u!==-1&&(l=d);else if(c===59||c===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d),Nr(r,e.slice(u,l),!0),c===44&&(Nr(t,s,r),r=Object.create(null),s=void 0),u=l=-1}else if(c===61&&u!==-1&&l===-1)a=e.slice(u,d),u=l=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(i){if(ha[c]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);u===-1?u=d:n||(n=!0),i=!1}else if(o)if(ha[c]===1)u===-1&&(u=d);else if(c===34&&u!==-1)o=!1,l=d;else if(c===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(c===34&&e.charCodeAt(d-1)===61)o=!0;else if(l===-1&&ha[c]===1)u===-1&&(u=d);else if(u!==-1&&(c===32||c===9))l===-1&&(l=d);else if(c===59||c===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let h=e.slice(u,l);n&&(h=h.replace(/\\/g,""),n=!1),Nr(r,a,h),c===44&&(Nr(t,s,r),r=Object.create(null),s=void 0),a=void 0,u=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(u===-1||o||c===32||c===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=d);let f=e.slice(u,l);return s===void 0?Nr(t,f,r):(a===void 0?Nr(r,f,!0):n?Nr(r,a,f.replace(/\\/g,"")):Nr(r,a,f),Nr(t,s,r)),t}function l2(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(i=>{let o=n[i];return Array.isArray(o)||(o=[o]),o.map(s=>s===!0?i:`${i}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}tC.exports={format:l2,parse:c2}});var _l=v((nce,fC)=>{"use strict";p();var p2=F("events"),d2=F("https"),f2=F("http"),iC=F("net"),h2=F("tls"),{randomBytes:m2,createHash:g2}=F("crypto"),{Duplex:tce,Readable:rce}=F("stream"),{URL:zg}=F("url"),Rn=So(),y2=Bg(),v2=Qg(),{isBlob:E2}=bo(),{BINARY_TYPES:rC,CLOSE_TIMEOUT:_2,EMPTY_BUFFER:yl,GUID:S2,kForOnEventAttribute:Jg,kListener:b2,kStatusCode:T2,kWebSocket:nt,NOOP:oC}=Jr(),{EventTarget:{addEventListener:I2,removeEventListener:w2}}=eC(),{format:O2,parse:A2}=gl(),{toBuffer:x2}=la(),sC=Symbol("kAborted"),Yg=[8,13],Zr=["CONNECTING","OPEN","CLOSING","CLOSED"],C2=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ke=class e extends p2{constructor(t,r,n){super(),this._binaryType=rC[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=yl,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),aC(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){rC.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let i=new y2({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),o=new v2(t,this._extensions,n.generateMask);this._receiver=i,this._sender=o,this._socket=t,i[nt]=this,o[nt]=this,t[nt]=this,i.on("conclude",N2),i.on("drain",D2),i.on("error",L2),i.on("message",k2),i.on("ping",j2),i.on("pong",M2),o.onerror=F2,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",lC),t.on("data",El),t.on("end",pC),t.on("error",dC),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Rn.extensionName]&&this._extensions[Rn.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Vt(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),cC(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Xg(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||yl,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Xg(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||yl,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Xg(this,t,n);return}let i={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Rn.extensionName]||(i.compress=!1),this._sender.send(t||yl,i,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Vt(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ke,"CONNECTING",{enumerable:!0,value:Zr.indexOf("CONNECTING")});Object.defineProperty(ke.prototype,"CONNECTING",{enumerable:!0,value:Zr.indexOf("CONNECTING")});Object.defineProperty(ke,"OPEN",{enumerable:!0,value:Zr.indexOf("OPEN")});Object.defineProperty(ke.prototype,"OPEN",{enumerable:!0,value:Zr.indexOf("OPEN")});Object.defineProperty(ke,"CLOSING",{enumerable:!0,value:Zr.indexOf("CLOSING")});Object.defineProperty(ke.prototype,"CLOSING",{enumerable:!0,value:Zr.indexOf("CLOSING")});Object.defineProperty(ke,"CLOSED",{enumerable:!0,value:Zr.indexOf("CLOSED")});Object.defineProperty(ke.prototype,"CLOSED",{enumerable:!0,value:Zr.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(ke.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(ke.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[Jg])return t[b2];return null},set(t){for(let r of this.listeners(e))if(r[Jg]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[Jg]:!0})}})});ke.prototype.addEventListener=I2;ke.prototype.removeEventListener=w2;fC.exports=ke;function aC(e,t,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_2,protocolVersion:Yg[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=i.autoPong,e._closeTimeout=i.closeTimeout,!Yg.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Yg.join(", ")})`);let o;if(t instanceof zg)o=t;else try{o=new zg(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}o.protocol==="http:"?o.protocol="ws:":o.protocol==="https:"&&(o.protocol="wss:"),e._url=o.href;let s=o.protocol==="wss:",a=o.protocol==="ws+unix:",u;if(o.protocol!=="ws:"&&!s&&!a?u=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!o.pathname?u="The URL's pathname is empty":o.hash&&(u="The URL contains a fragment identifier"),u){let y=new SyntaxError(u);if(e._redirects===0)throw y;vl(e,y);return}let c=s?443:80,l=m2(16).toString("base64"),d=s?d2.request:f2.request,f=new Set,h;if(i.createConnection=i.createConnection||(s?P2:R2),i.defaultPort=i.defaultPort||c,i.port=o.port||c,i.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"},i.path=o.pathname+o.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(h=new Rn({...i.perMessageDeflate,isServer:!1,maxPayload:i.maxPayload}),i.headers["Sec-WebSocket-Extensions"]=O2({[Rn.extensionName]:h.offer()})),r.length){for(let y of r){if(typeof y!="string"||!C2.test(y)||f.has(y))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(y)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(o.username||o.password)&&(i.auth=`${o.username}:${o.password}`),a){let y=i.path.split(":");i.socketPath=y[0],i.path=y[1]}let g;if(i.followRedirects){if(e._redirects===0){e._originalIpc=a,e._originalSecure=s,e._originalHostOrSocketPath=a?i.socketPath:o.host;let y=n&&n.headers;if(n={...n,headers:{}},y)for(let[_,b]of Object.entries(y))n.headers[_.toLowerCase()]=b}else if(e.listenerCount("redirect")===0){let y=a?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:o.host===e._originalHostOrSocketPath;(!y||e._originalSecure&&!s)&&(delete i.headers.authorization,delete i.headers.cookie,y||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),g=e._req=d(i),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=d(i);i.timeout&&g.on("timeout",()=>{Vt(e,g,"Opening handshake has timed out")}),g.on("error",y=>{g===null||g[sC]||(g=e._req=null,vl(e,y))}),g.on("response",y=>{let _=y.headers.location,b=y.statusCode;if(_&&i.followRedirects&&b>=300&&b<400){if(++e._redirects>i.maxRedirects){Vt(e,g,"Maximum redirects exceeded");return}g.abort();let S;try{S=new zg(_,t)}catch{let O=new SyntaxError(`Invalid URL: ${_}`);vl(e,O);return}aC(e,S,r,n)}else e.emit("unexpected-response",g,y)||Vt(e,g,`Unexpected server response: ${y.statusCode}`)}),g.on("upgrade",(y,_,b)=>{if(e.emit("upgrade",y),e.readyState!==ke.CONNECTING)return;g=e._req=null;let S=y.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){Vt(e,_,"Invalid Upgrade header");return}let I=g2("sha1").update(l+S2).digest("base64");if(y.headers["sec-websocket-accept"]!==I){Vt(e,_,"Invalid Sec-WebSocket-Accept header");return}let O=y.headers["sec-websocket-protocol"],T;if(O!==void 0?f.size?f.has(O)||(T="Server sent an invalid subprotocol"):T="Server sent a subprotocol but none was requested":f.size&&(T="Server sent no subprotocol"),T){Vt(e,_,T);return}O&&(e._protocol=O);let C=y.headers["sec-websocket-extensions"];if(C!==void 0){if(!h){Vt(e,_,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let L;try{L=A2(C)}catch{Vt(e,_,"Invalid Sec-WebSocket-Extensions header");return}let w=Object.keys(L);if(w.length!==1||w[0]!==Rn.extensionName){Vt(e,_,"Server indicated an extension that was not requested");return}try{h.accept(L[Rn.extensionName])}catch{Vt(e,_,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Rn.extensionName]=h}e.setSocket(_,b,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(g,e):g.end()}function vl(e,t){e._readyState=ke.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function R2(e){return e.path=e.socketPath,iC.connect(e)}function P2(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=iC.isIP(e.host)?"":e.host),h2.connect(e)}function Vt(e,t,r){e._readyState=ke.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Vt),t.setHeader?(t[sC]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(vl,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function Xg(e,t,r){if(t){let n=E2(t)?t.size:x2(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Zr[e.readyState]})`);process.nextTick(r,n)}}function N2(e,t){let r=this[nt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[nt]!==void 0&&(r._socket.removeListener("data",El),process.nextTick(uC,r._socket),e===1005?r.close():r.close(e,t))}function D2(){let e=this[nt];e.isPaused||e._socket.resume()}function L2(e){let t=this[nt];t._socket[nt]!==void 0&&(t._socket.removeListener("data",El),process.nextTick(uC,t._socket),t.close(e[T2])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function nC(){this[nt].emitClose()}function k2(e,t){this[nt].emit("message",e,t)}function j2(e){let t=this[nt];t._autoPong&&t.pong(e,!this._isServer,oC),t.emit("ping",e)}function M2(e){this[nt].emit("pong",e)}function uC(e){e.resume()}function F2(e){let t=this[nt];t.readyState!==ke.CLOSED&&(t.readyState===ke.OPEN&&(t._readyState=ke.CLOSING,cC(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function cC(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function lC(){let e=this[nt];if(this.removeListener("close",lC),this.removeListener("data",El),this.removeListener("end",pC),e._readyState=ke.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[nt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",nC),e._receiver.on("finish",nC))}function El(e){this[nt]._receiver.write(e)||this.pause()}function pC(){let e=this[nt];e._readyState=ke.CLOSING,e._receiver.end(),this.end()}function dC(){let e=this[nt];this.removeListener("error",dC),this.on("error",oC),e&&(e._readyState=ke.CLOSING,this.destroy())}});var yC=v((sce,gC)=>{"use strict";p();var oce=_l(),{Duplex:q2}=F("stream");function hC(e){e.emit("close")}function U2(){!this.destroyed&&this._writableState.finished&&this.destroy()}function mC(e){this.removeListener("error",mC),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function V2(e,t){let r=!0,n=new q2({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(o,s){let a=!s&&n._readableState.objectMode?o.toString():o;n.push(a)||e.pause()}),e.once("error",function(o){n.destroyed||(r=!1,n.destroy(o))}),e.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(i,o){if(e.readyState===e.CLOSED){o(i),process.nextTick(hC,n);return}let s=!1;e.once("error",function(u){s=!0,o(u)}),e.once("close",function(){s||o(i),process.nextTick(hC,n)}),r&&e.terminate()},n._final=function(i){if(e.readyState===e.CONNECTING){e.once("open",function(){n._final(i)});return}e._socket!==null&&(e._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",function(){i()}),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(i,o,s){if(e.readyState===e.CONNECTING){e.once("open",function(){n._write(i,o,s)});return}e.send(i,s)},n.on("end",U2),n.on("error",mC),n}gC.exports=V2});var Zg=v((uce,vC)=>{"use strict";p();var{tokenChars:G2}=bo();function $2(e){let t=new Set,r=-1,n=-1,i=0;for(i;i<e.length;i++){let s=e.charCodeAt(i);if(n===-1&&G2[s]===1)r===-1&&(r=i);else if(i!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=i);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let a=e.slice(r,n);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);t.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let o=e.slice(r,i);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}vC.exports={parse:$2}});var wC=v((pce,IC)=>{"use strict";p();var B2=F("events"),Sl=F("http"),{Duplex:lce}=F("stream"),{createHash:H2}=F("crypto"),EC=gl(),fi=So(),K2=Zg(),Q2=_l(),{CLOSE_TIMEOUT:W2,GUID:z2,kWebSocket:J2}=Jr(),Y2=/^[+/0-9A-Za-z]{22}==$/,_C=0,SC=1,TC=2,ey=class extends B2{constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:W2,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Q2,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Sl.createServer((n,i)=>{let o=Sl.STATUS_CODES[426];i.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),i.end(o)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=X2(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,o,s)=>{this.handleUpgrade(i,o,s,n)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=_C}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===TC){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(ma,this);return}if(t&&this.once("close",t),this._state!==SC)if(this._state=SC,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(ma,this):process.nextTick(ma,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{ma(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,i){r.on("error",bC);let o=t.headers["sec-websocket-key"],s=t.headers.upgrade,a=+t.headers["sec-websocket-version"];if(t.method!=="GET"){hi(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){hi(this,t,r,400,"Invalid Upgrade header");return}if(o===void 0||!Y2.test(o)){hi(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){hi(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){ga(r,400);return}let u=t.headers["sec-websocket-protocol"],c=new Set;if(u!==void 0)try{c=K2.parse(u)}catch{hi(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let l=t.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&l!==void 0){let f=new fi({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let h=EC.parse(l);h[fi.extensionName]&&(f.accept(h[fi.extensionName]),d[fi.extensionName]=f)}catch{hi(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:t.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(f,(h,g,y,_)=>{if(!h)return ga(r,g||401,y,_);this.completeUpgrade(d,o,c,t,r,n,i)});return}if(!this.options.verifyClient(f))return ga(r,401)}this.completeUpgrade(d,o,c,t,r,n,i)}completeUpgrade(t,r,n,i,o,s,a){if(!o.readable||!o.writable)return o.destroy();if(o[J2])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>_C)return ga(o,503);let c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${H2("sha1").update(r+z2).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;d&&(c.push(`Sec-WebSocket-Protocol: ${d}`),l._protocol=d)}if(t[fi.extensionName]){let d=t[fi.extensionName].params,f=EC.format({[fi.extensionName]:[d]});c.push(`Sec-WebSocket-Extensions: ${f}`),l._extensions=t}this.emit("headers",c,i),o.write(c.concat(`\r
202
+ `).join(`\r
203
+ `)),o.removeListener("error",bC),l.setSocket(o,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(l),l.on("close",()=>{this.clients.delete(l),this._shouldEmitClose&&!this.clients.size&&process.nextTick(ma,this)})),a(l,i)}};IC.exports=ey;function X2(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function ma(e){e._state=TC,e.emit("close")}function bC(){this.destroy()}function ga(e,t,r,n){r=r||Sl.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Sl.STATUS_CODES[t]}\r
204
+ `+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
205
+ `)+`\r
206
+ \r
207
+ `+r)}function hi(e,t,r,n,i,o){if(e.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,hi),e.emit("wsClientError",s,r,t)}else ga(r,n,i,o)}});var KR=v((Ede,HR)=>{p();HR.exports=ko;function ko(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ko.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-r:e+r}return Math.min(e,this.max)|0};ko.prototype.reset=function(){this.attempts=0};ko.prototype.setMin=function(e){this.ms=e};ko.prototype.setMax=function(e){this.max=e};ko.prototype.setJitter=function(e){this.jitter=e}});var WR=v((Sde,Fy)=>{"use strict";p();var C5=Object.prototype.hasOwnProperty,bt="~";function Oa(){}Object.create&&(Oa.prototype=Object.create(null),new Oa().__proto__||(bt=!1));function R5(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function QR(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var o=new R5(r,n||e,i),s=bt?bt+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],o]:e._events[s].push(o):(e._events[s]=o,e._eventsCount++),e}function Bl(e,t){--e._eventsCount===0?e._events=new Oa:delete e._events[t]}function ft(){this._events=new Oa,this._eventsCount=0}ft.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)C5.call(r,n)&&t.push(bt?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};ft.prototype.listeners=function(t){var r=bt?bt+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s};ft.prototype.listenerCount=function(t){var r=bt?bt+t:t,n=this._events[r];return n?n.fn?1:n.length:0};ft.prototype.emit=function(t,r,n,i,o,s){var a=bt?bt+t:t;if(!this._events[a])return!1;var u=this._events[a],c=arguments.length,l,d;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,i),!0;case 5:return u.fn.call(u.context,r,n,i,o),!0;case 6:return u.fn.call(u.context,r,n,i,o,s),!0}for(d=1,l=new Array(c-1);d<c;d++)l[d-1]=arguments[d];u.fn.apply(u.context,l)}else{var f=u.length,h;for(d=0;d<f;d++)switch(u[d].once&&this.removeListener(t,u[d].fn,void 0,!0),c){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,r);break;case 3:u[d].fn.call(u[d].context,r,n);break;case 4:u[d].fn.call(u[d].context,r,n,i);break;default:if(!l)for(h=1,l=new Array(c-1);h<c;h++)l[h-1]=arguments[h];u[d].fn.apply(u[d].context,l)}}return!0};ft.prototype.on=function(t,r,n){return QR(this,t,r,n,!1)};ft.prototype.once=function(t,r,n){return QR(this,t,r,n,!0)};ft.prototype.removeListener=function(t,r,n,i){var o=bt?bt+t:t;if(!this._events[o])return this;if(!r)return Bl(this,o),this;var s=this._events[o];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&Bl(this,o);else{for(var a=0,u=[],c=s.length;a<c;a++)(s[a].fn!==r||i&&!s[a].once||n&&s[a].context!==n)&&u.push(s[a]);u.length?this._events[o]=u.length===1?u[0]:u:Bl(this,o)}return this};ft.prototype.removeAllListeners=function(t){var r;return t?(r=bt?bt+t:t,this._events[r]&&Bl(this,r)):(this._events=new Oa,this._eventsCount=0),this};ft.prototype.off=ft.prototype.removeListener;ft.prototype.addListener=ft.prototype.on;ft.prefixed=bt;ft.EventEmitter=ft;typeof Fy<"u"&&(Fy.exports=ft)});var zR=v(qy=>{"use strict";p();Object.defineProperty(qy,"__esModule",{value:!0});function P5(e){return typeof e=="string"}qy.default=P5});var Vy=v(Uy=>{"use strict";p();Object.defineProperty(Uy,"__esModule",{value:!0});function N5(e){return e!==null&&typeof e=="object"}Uy.default=N5});var JR=v(Gy=>{"use strict";p();Object.defineProperty(Gy,"__esModule",{value:!0});Gy.default=D5;function D5(e){var t,r=e.Symbol;return typeof r=="function"?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}});var YR=v((By,$y)=>{"use strict";p();Object.defineProperty(By,"__esModule",{value:!0});var L5=JR(),k5=j5(L5);function j5(e){return e&&e.__esModule?e:{default:e}}var jo;typeof self<"u"?jo=self:typeof window<"u"?jo=window:typeof global<"u"?jo=global:typeof $y<"u"?jo=$y:jo=Function("return this")();var M5=(0,k5.default)(jo);By.default=M5});var Hl=v(Mo=>{"use strict";p();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.GRAPHQL_SUBSCRIPTIONS=Mo.GRAPHQL_WS=void 0;var F5="graphql-ws";Mo.GRAPHQL_WS=F5;var q5="graphql-subscriptions";Mo.GRAPHQL_SUBSCRIPTIONS=q5});var XR=v(Fo=>{"use strict";p();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.WS_TIMEOUT=Fo.MIN_WS_TIMEOUT=void 0;var U5=1e3;Fo.MIN_WS_TIMEOUT=U5;var V5=3e4;Fo.WS_TIMEOUT=V5});var Aa=v(Hy=>{"use strict";p();Object.defineProperty(Hy,"__esModule",{value:!0});var G5=(function(){function e(){throw new Error("Static Class")}return e.GQL_CONNECTION_INIT="connection_init",e.GQL_CONNECTION_ACK="connection_ack",e.GQL_CONNECTION_ERROR="connection_error",e.GQL_CONNECTION_KEEP_ALIVE="ka",e.GQL_CONNECTION_TERMINATE="connection_terminate",e.GQL_START="start",e.GQL_DATA="data",e.GQL_ERROR="error",e.GQL_COMPLETE="complete",e.GQL_STOP="stop",e.SUBSCRIPTION_START="subscription_start",e.SUBSCRIPTION_DATA="subscription_data",e.SUBSCRIPTION_SUCCESS="subscription_success",e.SUBSCRIPTION_FAIL="subscription_fail",e.SUBSCRIPTION_END="subscription_end",e.INIT="init",e.INIT_SUCCESS="init_success",e.INIT_FAIL="init_fail",e.KEEP_ALIVE="keepalive",e})();Hy.default=G5});var iP=v(ar=>{"use strict";p();var qo=ar&&ar.__assign||function(){return qo=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},qo.apply(this,arguments)},$5=ar&&ar.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(l){try{c(n.next(l))}catch(d){s(d)}}function u(l){try{c(n.throw(l))}catch(d){s(d)}}function c(l){l.done?o(l.value):i(l.value).then(a,u)}c((n=n.apply(e,t||[])).next())})},B5=ar&&ar.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},ZR=ar&&ar.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(ar,"__esModule",{value:!0});ar.SubscriptionClient=void 0;var eP=typeof global<"u"?global:typeof window<"u"?window:{},H5=eP.WebSocket||eP.MozWebSocket,tP=KR(),K5=WR(),rP=zR(),Q5=Vy(),W5=wt(),z5=tg(),J5=YR(),Y5=Hl(),nP=XR(),Tt=Aa(),X5=(function(){function e(t,r,n,i){var o=r||{},s=o.connectionCallback,a=s===void 0?void 0:s,u=o.connectionParams,c=u===void 0?{}:u,l=o.minTimeout,d=l===void 0?nP.MIN_WS_TIMEOUT:l,f=o.timeout,h=f===void 0?nP.WS_TIMEOUT:f,g=o.reconnect,y=g===void 0?!1:g,_=o.reconnectionAttempts,b=_===void 0?1/0:_,S=o.lazy,I=S===void 0?!1:S,O=o.inactivityTimeout,T=O===void 0?0:O,C=o.wsOptionArguments,L=C===void 0?[]:C;if(this.wsImpl=n||H5,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=i||Y5.GRAPHQL_WS,this.connectionCallback=a,this.url=t,this.operations={},this.nextOperationId=0,this.minWsTimeout=d,this.wsTimeout=h,this.unsentMessagesQueue=[],this.reconnect=y,this.reconnecting=!1,this.reconnectionAttempts=b,this.lazy=!!I,this.inactivityTimeout=T,this.closedByUser=!1,this.backoff=new tP({jitter:.5}),this.eventEmitter=new K5.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams(c),this.wsOptionArguments=L,this.lazy||this.connect()}return Object.defineProperty(e.prototype,"status",{get:function(){return this.client===null?this.wsImpl.CLOSED:this.client.readyState},enumerable:!1,configurable:!0}),e.prototype.close=function(t,r){t===void 0&&(t=!0),r===void 0&&(r=!0),this.clearInactivityTimeout(),this.client!==null&&(this.closedByUser=r,t&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,Tt.default.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client.onopen=null,this.client.onclose=null,this.client.onerror=null,this.client.onmessage=null,this.client=null,this.eventEmitter.emit("disconnected"),t||this.tryReconnect())},e.prototype.request=function(t){var r,n=this.getObserver.bind(this),i=this.executeOperation.bind(this),o=this.unsubscribe.bind(this),s;return this.clearInactivityTimeout(),r={},r[J5.default]=function(){return this},r.subscribe=function(a,u,c){var l=n(a,u,c);return s=i(t,function(d,f){d===null&&f===null?l.complete&&l.complete():d?l.error&&l.error(d[0]):l.next&&l.next(f)}),{unsubscribe:function(){s&&(o(s),s=null)}}},r},e.prototype.on=function(t,r,n){var i=this.eventEmitter.on(t,r,n);return function(){i.off(t,r,n)}},e.prototype.onConnected=function(t,r){return this.on("connected",t,r)},e.prototype.onConnecting=function(t,r){return this.on("connecting",t,r)},e.prototype.onDisconnected=function(t,r){return this.on("disconnected",t,r)},e.prototype.onReconnected=function(t,r){return this.on("reconnected",t,r)},e.prototype.onReconnecting=function(t,r){return this.on("reconnecting",t,r)},e.prototype.onError=function(t,r){return this.on("error",t,r)},e.prototype.unsubscribeAll=function(){var t=this;Object.keys(this.operations).forEach(function(r){t.unsubscribe(r)})},e.prototype.applyMiddlewares=function(t){var r=this;return new Promise(function(n,i){var o=function(s,a){var u=function(c){if(c)i(c);else if(s.length>0){var l=s.shift();l&&l.applyMiddleware.apply(a,[t,u])}else n(t)};u()};o(ZR([],r.middlewares,!0),r)})},e.prototype.use=function(t){var r=this;return t.map(function(n){if(typeof n.applyMiddleware=="function")r.middlewares.push(n);else throw new Error("Middleware must implement the applyMiddleware function.")}),this},e.prototype.getConnectionParams=function(t){return function(){return new Promise(function(r,n){if(typeof t=="function")try{return r(t.call(null))}catch(i){return n(i)}r(t)})}},e.prototype.executeOperation=function(t,r){var n=this;this.client===null&&this.connect();var i=this.generateOperationId();return this.operations[i]={options:t,handler:r},this.applyMiddlewares(t).then(function(o){n.checkOperationOptions(o,r),n.operations[i]&&(n.operations[i]={options:o,handler:r},n.sendMessage(i,Tt.default.GQL_START,o))}).catch(function(o){n.unsubscribe(i),r(n.formatErrors(o))}),i},e.prototype.getObserver=function(t,r,n){return typeof t=="function"?{next:function(i){return t(i)},error:function(i){return r&&r(i)},complete:function(){return n&&n()}}:t},e.prototype.createMaxConnectTimeGenerator=function(){var t=this.minWsTimeout,r=this.wsTimeout;return new tP({min:t,max:r,factor:1.2})},e.prototype.clearCheckConnectionInterval=function(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)},e.prototype.clearMaxConnectTimeout=function(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)},e.prototype.clearTryReconnectTimeout=function(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)},e.prototype.clearInactivityTimeout=function(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)},e.prototype.setInactivityTimeout=function(){var t=this;this.inactivityTimeout>0&&Object.keys(this.operations).length===0&&(this.inactivityTimeoutId=setTimeout(function(){Object.keys(t.operations).length===0&&t.close()},this.inactivityTimeout))},e.prototype.checkOperationOptions=function(t,r){var n=t.query,i=t.variables,o=t.operationName;if(!n)throw new Error("Must provide a query.");if(!r)throw new Error("Must provide an handler.");if(!(0,rP.default)(n)&&!(0,z5.getOperationAST)(n,o)||o&&!(0,rP.default)(o)||i&&!(0,Q5.default)(i))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")},e.prototype.buildMessage=function(t,r,n){var i=n&&n.query?qo(qo({},n),{query:typeof n.query=="string"?n.query:(0,W5.print)(n.query)}):n;return{id:t,type:r,payload:i}},e.prototype.formatErrors=function(t){return Array.isArray(t)?t:t&&t.errors?this.formatErrors(t.errors):t&&t.message?[t]:[{name:"FormatedError",message:"Unknown error",originalError:t}]},e.prototype.sendMessage=function(t,r,n){this.sendMessageRaw(this.buildMessage(t,r,n))},e.prototype.sendMessageRaw=function(t){switch(this.status){case this.wsImpl.OPEN:var r=JSON.stringify(t);try{JSON.parse(r)}catch{this.eventEmitter.emit("error",new Error("Message must be JSON-serializable. Got: "+t))}this.client.send(r);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(t);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(t)))}},e.prototype.generateOperationId=function(){return String(++this.nextOperationId)},e.prototype.tryReconnect=function(){var t=this;if(!(!this.reconnect||this.backoff.attempts>=this.reconnectionAttempts)){this.reconnecting||(Object.keys(this.operations).forEach(function(n){t.unsentMessagesQueue.push(t.buildMessage(n,Tt.default.GQL_START,t.operations[n].options))}),this.reconnecting=!0),this.clearTryReconnectTimeout();var r=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout(function(){t.connect()},r)}},e.prototype.flushUnsentMessagesQueue=function(){var t=this;this.unsentMessagesQueue.forEach(function(r){t.sendMessageRaw(r)}),this.unsentMessagesQueue=[]},e.prototype.checkConnection=function(){if(this.wasKeepAliveReceived){this.wasKeepAliveReceived=!1;return}this.reconnecting||this.close(!1,!0)},e.prototype.checkMaxConnectTimeout=function(){var t=this;this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout(function(){t.status!==t.wsImpl.OPEN&&(t.reconnecting=!0,t.close(!1,!0))},this.maxConnectTimeGenerator.duration())},e.prototype.connect=function(){var t,r=this;this.client=new((t=this.wsImpl).bind.apply(t,ZR([void 0,this.url,this.wsProtocols],this.wsOptionArguments,!1))),this.checkMaxConnectTimeout(),this.client.onopen=function(){return $5(r,void 0,void 0,function(){var n,i;return B5(this,function(o){switch(o.label){case 0:if(this.status!==this.wsImpl.OPEN)return[3,4];this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.connectionParams()];case 2:return n=o.sent(),this.sendMessage(void 0,Tt.default.GQL_CONNECTION_INIT,n),this.flushUnsentMessagesQueue(),[3,4];case 3:return i=o.sent(),this.sendMessage(void 0,Tt.default.GQL_CONNECTION_ERROR,i),this.flushUnsentMessagesQueue(),[3,4];case 4:return[2]}})})},this.client.onclose=function(){r.closedByUser||r.close(!1,!1)},this.client.onerror=function(n){r.eventEmitter.emit("error",n)},this.client.onmessage=function(n){var i=n.data;r.processReceivedData(i)}},e.prototype.processReceivedData=function(t){var r,n;try{r=JSON.parse(t),n=r.id}catch{throw new Error("Message must be JSON-parseable. Got: "+t)}if([Tt.default.GQL_DATA,Tt.default.GQL_COMPLETE,Tt.default.GQL_ERROR].indexOf(r.type)!==-1&&!this.operations[n]){this.unsubscribe(n);return}switch(r.type){case Tt.default.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(r.payload);break;case Tt.default.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected",r.payload),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case Tt.default.GQL_COMPLETE:var i=this.operations[n].handler;delete this.operations[n],i.call(this,null,null);break;case Tt.default.GQL_ERROR:this.operations[n].handler(this.formatErrors(r.payload),null),delete this.operations[n];break;case Tt.default.GQL_DATA:var o=r.payload.errors?qo(qo({},r.payload),{errors:this.formatErrors(r.payload.errors)}):r.payload;this.operations[n].handler(null,o);break;case Tt.default.GQL_CONNECTION_KEEP_ALIVE:var s=typeof this.wasKeepAliveReceived>"u";this.wasKeepAliveReceived=!0,s&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}},e.prototype.unsubscribe=function(t){this.operations[t]&&(delete this.operations[t],this.setInactivityTimeout(),this.sendMessage(t,Tt.default.GQL_STOP,void 0))},e})();ar.SubscriptionClient=X5});var Si=v((Fde,oP)=>{"use strict";p();oP.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}}});var xa=v((Ude,Ky)=>{"use strict";p();var{EMPTY_BUFFER:Z5}=Si();function sP(e,t){if(e.length===0)return Z5;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let i=0;i<e.length;i++){let o=e[i];r.set(o,n),n+=o.length}return n<t?r.slice(0,n):r}function aP(e,t,r,n,i){for(let o=0;o<i;o++)r[n+o]=e[o]^t[o&3]}function uP(e,t){let r=e.length;for(let n=0;n<r;n++)e[n]^=t[n&3]}function cP(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function Kl(e){if(Kl.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=Buffer.from(e):ArrayBuffer.isView(e)?t=Buffer.from(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Kl.readOnly=!1),t}try{let e=F("bufferutil"),t=e.BufferUtil||e;Ky.exports={concat:sP,mask(r,n,i,o,s){s<48?aP(r,n,i,o,s):t.mask(r,n,i,o,s)},toArrayBuffer:cP,toBuffer:Kl,unmask(r,n){r.length<32?uP(r,n):t.unmask(r,n)}}}catch{Ky.exports={concat:sP,mask:aP,toArrayBuffer:cP,toBuffer:Kl,unmask:uP}}});var dP=v((Gde,pP)=>{"use strict";p();var lP=Symbol("kDone"),Qy=Symbol("kRun"),Wy=class{constructor(t){this[lP]=()=>{this.pending--,this[Qy]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Qy]()}[Qy](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[lP])}}};pP.exports=Wy});var Pa=v((Bde,gP)=>{"use strict";p();var Ca=F("zlib"),fP=xa(),e8=dP(),{kStatusCode:hP,NOOP:t8}=Si(),r8=Buffer.from([0,0,255,255]),zl=Symbol("permessage-deflate"),en=Symbol("total-length"),Ra=Symbol("callback"),Ln=Symbol("buffers"),Wl=Symbol("error"),Ql,zy=class{constructor(t,r,n){if(this._maxPayload=n|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!Ql){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ql=new e8(i)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Ra];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),t}decompress(t,r,n){Ql.add(i=>{this._decompress(t,r,(o,s)=>{i(),n(o,s)})})}compress(t,r,n){Ql.add(i=>{this._compress(t,r,(o,s)=>{i(),n(o,s)})})}_decompress(t,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?Ca.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Ca.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[zl]=this,this._inflate[en]=0,this._inflate[Ln]=[],this._inflate.on("error",i8),this._inflate.on("data",mP)}this._inflate[Ra]=n,this._inflate.write(t),r&&this._inflate.write(r8),this._inflate.flush(()=>{let o=this._inflate[Wl];if(o){this._inflate.close(),this._inflate=null,n(o);return}let s=fP.concat(this._inflate[Ln],this._inflate[en]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[en]=0,this._inflate[Ln]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?Ca.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Ca.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[en]=0,this._deflate[Ln]=[],this._deflate.on("error",t8),this._deflate.on("data",n8)}this._deflate[Ra]=n,this._deflate.write(t),this._deflate.flush(Ca.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=fP.concat(this._deflate[Ln],this._deflate[en]);r&&(o=o.slice(0,o.length-4)),this._deflate[Ra]=null,this._deflate[en]=0,this._deflate[Ln]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,o)})}};gP.exports=zy;function n8(e){this[Ln].push(e),this[en]+=e.length}function mP(e){if(this[en]+=e.length,this[zl]._maxPayload<1||this[en]<=this[zl]._maxPayload){this[Ln].push(e);return}this[Wl]=new RangeError("Max payload size exceeded"),this[Wl].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Wl][hP]=1009,this.removeListener("data",mP),this.reset()}function i8(e){this[zl]._inflate=null,e[hP]=1007,this[Ra](e)}});var Yy=v((Kde,Jy)=>{"use strict";p();function yP(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function vP(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}try{let e=F("utf-8-validate");typeof e=="object"&&(e=e.Validation.isValidUTF8),Jy.exports={isValidStatusCode:yP,isValidUTF8(t){return t.length<150?vP(t):e(t)}}}catch{Jy.exports={isValidStatusCode:yP,isValidUTF8:vP}}});var tv=v((Wde,IP)=>{"use strict";p();var{Writable:o8}=F("stream"),EP=Pa(),{BINARY_TYPES:s8,EMPTY_BUFFER:a8,kStatusCode:u8,kWebSocket:c8}=Si(),{concat:Xy,toArrayBuffer:l8,unmask:p8}=xa(),{isValidStatusCode:d8,isValidUTF8:_P}=Yy(),Na=0,SP=1,bP=2,TP=3,Zy=4,f8=5,ev=class extends o8{constructor(t,r,n,i,o,s){super(),this._binaryType=t||s8[0],this[c8]=void 0,this._extensions=r||{},this._isServer=!!n,this._maxBufferedChunks=o|0,this._maxFragments=s|0,this._maxPayload=i|0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=Na,this._loop=!1}_write(t,r,n){if(this._opcode===8&&this._state==Na)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks)return n(Ge(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=n.slice(t),n.slice(0,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],i=r.length-t;t>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),i),this._buffers[0]=n.slice(t)),t-=n.length}while(t>0);return r}startLoop(t){let r;this._loop=!0;do switch(this._state){case Na:r=this.getInfo();break;case SP:r=this.getPayloadLength16();break;case bP:r=this.getPayloadLength64();break;case TP:this.getMask();break;case Zy:r=this.getData(t);break;default:this._loop=!1;return}while(this._loop);t(r)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((t[0]&48)!==0)return this._loop=!1,Ge(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let r=(t[0]&64)===64;if(r&&!this._extensions[EP.extensionName])return this._loop=!1,Ge(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(r)return this._loop=!1,Ge(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,Ge(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,Ge(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,Ge(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(r)return this._loop=!1,Ge(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,Ge(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,Ge(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,Ge(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,Ge(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=SP;else if(this._payloadLength===127)this._state=bP;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),r=t.readUInt32BE(0);return r>Math.pow(2,21)-1?(this._loop=!1,Ge(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=r*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,Ge(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=TP:this._state=Zy}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Zy}getData(t){let r=a8;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&p8(r,this._mask)}if(this._opcode>7)return this.controlMessage(r);if(this._compressed){this._state=f8,this.decompress(r,t);return}if(r.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return this._loop=!1,Ge(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");this._messageLength=this._totalPayloadLength,this._fragments.push(r)}return this.dataMessage()}decompress(t,r){this._extensions[EP.extensionName].decompress(t,this._fin,(i,o)=>{if(i)return r(i);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return r(Ge(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return r(Ge(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._fragments.push(o)}let s=this.dataMessage();if(s)return r(s);this.startLoop(r)})}dataMessage(){if(this._fin){let t=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let n;this._binaryType==="nodebuffer"?n=Xy(r,t):this._binaryType==="arraybuffer"?n=l8(Xy(r,t)):n=r,this.emit("message",n)}else{let n=Xy(r,t);if(!_P(n))return this._loop=!1,Ge(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",n.toString())}}this._state=Na}controlMessage(t){if(this._opcode===8)if(this._loop=!1,t.length===0)this.emit("conclude",1005,""),this.end();else{if(t.length===1)return Ge(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let r=t.readUInt16BE(0);if(!d8(r))return Ge(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let n=t.slice(2);if(!_P(n))return Ge(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",r,n.toString()),this.end()}}else this._opcode===9?this.emit("ping",t):this.emit("pong",t);this._state=Na}};IP.exports=ev;function Ge(e,t,r,n,i){let o=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,Ge),o.code=i,o[u8]=n,o}});var nv=v((Xde,AP)=>{"use strict";p();var Jde=F("net"),Yde=F("tls"),{randomFillSync:h8}=F("crypto"),wP=Pa(),{EMPTY_BUFFER:m8}=Si(),{isValidStatusCode:g8}=Yy(),{mask:OP,toBuffer:tn}=xa(),bi=Buffer.alloc(4),rv=class e{constructor(t,r){this._extensions=r||{},this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,r){let n=r.mask&&r.readOnly,i=r.mask?6:2,o=t.length;t.length>=65536?(i+=8,o=127):t.length>125&&(i+=2,o=126);let s=Buffer.allocUnsafe(n?t.length+i:i);return s[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(s[0]|=64),s[1]=o,o===126?s.writeUInt16BE(t.length,2):o===127&&(s.writeUInt32BE(0,2),s.writeUInt32BE(t.length,6)),r.mask?(h8(bi,0,4),s[1]|=128,s[i-4]=bi[0],s[i-3]=bi[1],s[i-2]=bi[2],s[i-1]=bi[3],n?(OP(t,bi,s,i,t.length),[s]):(OP(t,bi,t,0,t.length),[s,t])):[s,t]}close(t,r,n,i){let o;if(t===void 0)o=m8;else{if(typeof t!="number"||!g8(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||r==="")o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let s=Buffer.byteLength(r);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+s),o.writeUInt16BE(t,0),o.write(r,2)}}this._deflating?this.enqueue([this.doClose,o,n,i]):this.doClose(o,n,i)}doClose(t,r,n){this.sendFrame(e.frame(t,{fin:!0,rsv1:!1,opcode:8,mask:r,readOnly:!1}),n)}ping(t,r,n){let i=tn(t);if(i.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,i,r,tn.readOnly,n]):this.doPing(i,r,tn.readOnly,n)}doPing(t,r,n,i){this.sendFrame(e.frame(t,{fin:!0,rsv1:!1,opcode:9,mask:r,readOnly:n}),i)}pong(t,r,n){let i=tn(t);if(i.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,i,r,tn.readOnly,n]):this.doPong(i,r,tn.readOnly,n)}doPong(t,r,n,i){this.sendFrame(e.frame(t,{fin:!0,rsv1:!1,opcode:10,mask:r,readOnly:n}),i)}send(t,r,n){let i=tn(t),o=this._extensions[wP.extensionName],s=r.binary?2:1,a=r.compress;if(this._firstFragment?(this._firstFragment=!1,a&&o&&(a=i.length>=o._threshold),this._compress=a):(a=!1,s=0),r.fin&&(this._firstFragment=!0),o){let u={fin:r.fin,rsv1:a,opcode:s,mask:r.mask,readOnly:tn.readOnly};this._deflating?this.enqueue([this.dispatch,i,this._compress,u,n]):this.dispatch(i,this._compress,u,n)}else this.sendFrame(e.frame(i,{fin:r.fin,rsv1:!1,opcode:s,mask:r.mask,readOnly:tn.readOnly}),n)}dispatch(t,r,n,i){if(!r){this.sendFrame(e.frame(t,n),i);return}let o=this._extensions[wP.extensionName];this._bufferedBytes+=t.length,this._deflating=!0,o.compress(t,n.fin,(s,a)=>{if(this._socket.destroyed){let u=new Error("The socket was closed while data was being compressed");typeof i=="function"&&i(u);for(let c=0;c<this._queue.length;c++){let l=this._queue[c][4];typeof l=="function"&&l(u)}return}this._bufferedBytes-=t.length,this._deflating=!1,n.readOnly=!1,this.sendFrame(e.frame(a,n),i),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[1].length,Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[1].length,this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};AP.exports=rv});var CP=v((efe,xP)=>{"use strict";p();var Uo=class{constructor(t,r){this.target=r,this.type=t}},iv=class extends Uo{constructor(t,r){super("message",r),this.data=t}},ov=class extends Uo{constructor(t,r,n){super("close",n),this.wasClean=n._closeFrameReceived&&n._closeFrameSent,this.reason=r,this.code=t}},sv=class extends Uo{constructor(t){super("open",t)}},av=class extends Uo{constructor(t,r){super("error",r),this.message=t.message,this.error=t}},y8={addEventListener(e,t,r){if(typeof t!="function")return;function n(u){t.call(this,new iv(u,this))}function i(u,c){t.call(this,new ov(u,c,this))}function o(u){t.call(this,new av(u,this))}function s(){t.call(this,new sv(this))}let a=r&&r.once?"once":"on";e==="message"?(n._listener=t,this[a](e,n)):e==="close"?(i._listener=t,this[a](e,i)):e==="error"?(o._listener=t,this[a](e,o)):e==="open"?(s._listener=t,this[a](e,s)):this[a](e,t)},removeEventListener(e,t){let r=this.listeners(e);for(let n=0;n<r.length;n++)(r[n]===t||r[n]._listener===t)&&this.removeListener(e,r[n])}};xP.exports=y8});var uv=v((rfe,RP)=>{"use strict";p();var Da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Dr(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function v8(e){let t=Object.create(null);if(e===void 0||e==="")return t;let r=Object.create(null),n=!1,i=!1,o=!1,s,a,u=-1,c=-1,l=0;for(;l<e.length;l++){let f=e.charCodeAt(l);if(s===void 0)if(c===-1&&Da[f]===1)u===-1&&(u=l);else if(f===32||f===9)c===-1&&u!==-1&&(c=l);else if(f===59||f===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${l}`);c===-1&&(c=l);let h=e.slice(u,c);f===44?(Dr(t,h,r),r=Object.create(null)):s=h,u=c=-1}else throw new SyntaxError(`Unexpected character at index ${l}`);else if(a===void 0)if(c===-1&&Da[f]===1)u===-1&&(u=l);else if(f===32||f===9)c===-1&&u!==-1&&(c=l);else if(f===59||f===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${l}`);c===-1&&(c=l),Dr(r,e.slice(u,c),!0),f===44&&(Dr(t,s,r),r=Object.create(null),s=void 0),u=c=-1}else if(f===61&&u!==-1&&c===-1)a=e.slice(u,l),u=c=-1;else throw new SyntaxError(`Unexpected character at index ${l}`);else if(i){if(Da[f]!==1)throw new SyntaxError(`Unexpected character at index ${l}`);u===-1?u=l:n||(n=!0),i=!1}else if(o)if(Da[f]===1)u===-1&&(u=l);else if(f===34&&u!==-1)o=!1,c=l;else if(f===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${l}`);else if(f===34&&e.charCodeAt(l-1)===61)o=!0;else if(c===-1&&Da[f]===1)u===-1&&(u=l);else if(u!==-1&&(f===32||f===9))c===-1&&(c=l);else if(f===59||f===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${l}`);c===-1&&(c=l);let h=e.slice(u,c);n&&(h=h.replace(/\\/g,""),n=!1),Dr(r,a,h),f===44&&(Dr(t,s,r),r=Object.create(null),s=void 0),a=void 0,u=c=-1}else throw new SyntaxError(`Unexpected character at index ${l}`)}if(u===-1||o)throw new SyntaxError("Unexpected end of input");c===-1&&(c=l);let d=e.slice(u,c);return s===void 0?Dr(t,d,r):(a===void 0?Dr(r,d,!0):n?Dr(r,a,d.replace(/\\/g,"")):Dr(r,a,d),Dr(t,s,r)),t}function E8(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(i=>{let o=n[i];return Array.isArray(o)||(o=[o]),o.map(s=>s===!0?i:`${i}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}RP.exports={format:E8,parse:v8}});var hv=v((ofe,UP)=>{"use strict";p();var _8=F("events"),S8=F("https"),b8=F("http"),DP=F("net"),T8=F("tls"),{randomBytes:I8,createHash:w8}=F("crypto"),{Readable:ife}=F("stream"),{URL:cv}=F("url"),kn=Pa(),O8=tv(),A8=nv(),{BINARY_TYPES:PP,EMPTY_BUFFER:lv,GUID:x8,kStatusCode:C8,kWebSocket:ht,NOOP:LP}=Si(),{addEventListener:R8,removeEventListener:P8}=CP(),{format:N8,parse:D8}=uv(),{toBuffer:L8}=xa(),rn=["CONNECTING","OPEN","CLOSING","CLOSED"],pv=[8,13],k8=30*1e3,Ke=class e extends _8{constructor(t,r,n){super(),this._binaryType=PP[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(r)?r=r.join(", "):typeof r=="object"&&r!==null&&(n=r,r=void 0),kP(this,t,r,n)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){PP.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get onclose(){}set onclose(t){}get onerror(){}set onerror(t){}get onopen(){}set onopen(t){}get onmessage(){}set onmessage(t){}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n,i,o){let s=new O8(this.binaryType,this._extensions,this._isServer,n,i,o);this._sender=new A8(t,this._extensions),this._receiver=s,this._socket=t,s[ht]=this,t[ht]=this,s.on("conclude",F8),s.on("drain",q8),s.on("error",U8),s.on("message",V8),s.on("ping",G8),s.on("pong",$8),t.setTimeout(0),t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",MP),t.on("data",Jl),t.on("end",FP),t.on("error",qP),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[kn.extensionName]&&this._extensions[kn.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING)return Gt(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),k8)}}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){fv(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||lv,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){fv(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||lv,r,n)}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){fv(this,t,n);return}let i={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[kn.extensionName]||(i.compress=!1),this._sender.send(t||lv,i,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING)return Gt(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(Ke,"CONNECTING",{enumerable:!0,value:rn.indexOf("CONNECTING")});Object.defineProperty(Ke.prototype,"CONNECTING",{enumerable:!0,value:rn.indexOf("CONNECTING")});Object.defineProperty(Ke,"OPEN",{enumerable:!0,value:rn.indexOf("OPEN")});Object.defineProperty(Ke.prototype,"OPEN",{enumerable:!0,value:rn.indexOf("OPEN")});Object.defineProperty(Ke,"CLOSING",{enumerable:!0,value:rn.indexOf("CLOSING")});Object.defineProperty(Ke.prototype,"CLOSING",{enumerable:!0,value:rn.indexOf("CLOSING")});Object.defineProperty(Ke,"CLOSED",{enumerable:!0,value:rn.indexOf("CLOSED")});Object.defineProperty(Ke.prototype,"CLOSED",{enumerable:!0,value:rn.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach(e=>{Object.defineProperty(Ke.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(Ke.prototype,`on${e}`,{enumerable:!0,get(){let t=this.listeners(e);for(let r=0;r<t.length;r++)if(t[r]._listener)return t[r]._listener},set(t){let r=this.listeners(e);for(let n=0;n<r.length;n++)r[n]._listener&&this.removeListener(e,r[n]);this.addEventListener(e,t)}})});Ke.prototype.addEventListener=R8;Ke.prototype.removeEventListener=P8;UP.exports=Ke;function kP(e,t,r,n){let i={protocolVersion:pv[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!pv.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${pv.join(", ")})`);let o;t instanceof cv?(o=t,e._url=t.href):(o=new cv(t),e._url=t);let s=o.protocol==="ws+unix:";if(!o.host&&(!s||!o.pathname)){let h=new Error(`Invalid URL: ${e.url}`);if(e._redirects===0)throw h;dv(e,h);return}let a=o.protocol==="wss:"||o.protocol==="https:",u=a?443:80,c=I8(16).toString("base64"),l=a?S8.get:b8.get,d;if(i.createConnection=a?M8:j8,i.defaultPort=i.defaultPort||u,i.port=o.port||u,i.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,i.headers={"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket",...i.headers},i.path=o.pathname+o.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(d=new kn(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=N8({[kn.extensionName]:d.offer()})),r&&(i.headers["Sec-WebSocket-Protocol"]=r),i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(o.username||o.password)&&(i.auth=`${o.username}:${o.password}`),s){let h=i.path.split(":");i.socketPath=h[0],i.path=h[1]}if(i.followRedirects){if(e._redirects===0){e._originalUnixSocket=s,e._originalSecure=a,e._originalHostOrSocketPath=s?i.socketPath:o.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[g,y]of Object.entries(h))n.headers[g.toLowerCase()]=y}else{let h=s?e._originalUnixSocket?i.socketPath===e._originalHostOrSocketPath:!1:e._originalUnixSocket?!1:o.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!a)&&(delete i.headers.authorization,delete i.headers.cookie,h||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64"))}let f=e._req=l(i);i.timeout&&f.on("timeout",()=>{Gt(e,f,"Opening handshake has timed out")}),f.on("error",h=>{f===null||f.aborted||(f=e._req=null,dv(e,h))}),f.on("response",h=>{let g=h.headers.location,y=h.statusCode;if(g&&i.followRedirects&&y>=300&&y<400){if(++e._redirects>i.maxRedirects){Gt(e,f,"Maximum redirects exceeded");return}f.abort();let _;try{_=new cv(g,t)}catch(b){dv(e,b);return}kP(e,_,r,n)}else e.emit("unexpected-response",f,h)||Gt(e,f,`Unexpected server response: ${h.statusCode}`)}),f.on("upgrade",(h,g,y)=>{if(e.emit("upgrade",h),e.readyState!==Ke.CONNECTING)return;f=e._req=null;let _=h.headers.upgrade;if(_===void 0||_.toLowerCase()!=="websocket"){Gt(e,g,"Invalid Upgrade header");return}let b=w8("sha1").update(c+x8).digest("base64");if(h.headers["sec-websocket-accept"]!==b){Gt(e,g,"Invalid Sec-WebSocket-Accept header");return}let S=h.headers["sec-websocket-protocol"],I=(r||"").split(/, */),O;if(!r&&S?O="Server sent a subprotocol but none was requested":r&&!S?O="Server sent no subprotocol":S&&!I.includes(S)&&(O="Server sent an invalid subprotocol"),O){Gt(e,g,O);return}S&&(e._protocol=S);let T=h.headers["sec-websocket-extensions"];if(T!==void 0){if(!d){Gt(e,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=D8(T)}catch{Gt(e,g,"Invalid Sec-WebSocket-Extensions header");return}let L=Object.keys(C);if(L.length){if(L.length!==1||L[0]!==kn.extensionName){Gt(e,g,"Server indicated an extension that was not requested");return}try{d.accept(C[kn.extensionName])}catch{Gt(e,g,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[kn.extensionName]=d}}e.setSocket(g,y,i.maxPayload,i.maxBufferedChunks,i.maxFragments)})}function dv(e,t){e._readyState=Ke.CLOSING,e.emit("error",t),e.emitClose()}function j8(e){return e.path=e.socketPath,DP.connect(e)}function M8(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=DP.isIP(e.host)?"":e.host),T8.connect(e)}function Gt(e,t,r){e._readyState=Ke.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Gt),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function fv(e,t,r){if(t){let n=L8(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${rn[e.readyState]})`);r(n)}}function F8(e,t){let r=this[ht];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[ht]!==void 0&&(r._socket.removeListener("data",Jl),process.nextTick(jP,r._socket),e===1005?r.close():r.close(e,t))}function q8(){this[ht]._socket.resume()}function U8(e){let t=this[ht];t._socket[ht]!==void 0&&(t._socket.removeListener("data",Jl),process.nextTick(jP,t._socket),t.close(e[C8])),t.emit("error",e)}function NP(){this[ht].emitClose()}function V8(e){this[ht].emit("message",e)}function G8(e){let t=this[ht];t.pong(e,!t._isServer,LP),t.emit("ping",e)}function $8(e){this[ht].emit("pong",e)}function jP(e){e.resume()}function MP(){let e=this[ht];this.removeListener("close",MP),this.removeListener("data",Jl),this.removeListener("end",FP),e._readyState=Ke.CLOSING;let t;!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null&&e._receiver.write(t),e._receiver.end(),this[ht]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",NP),e._receiver.on("finish",NP))}function Jl(e){this[ht]._receiver.write(e)||this.pause()}function FP(){let e=this[ht];e._readyState=Ke.CLOSING,e._receiver.end(),this.end()}function qP(){let e=this[ht];this.removeListener("error",qP),this.on("error",LP),e&&(e._readyState=Ke.CLOSING,this.destroy())}});var BP=v((afe,$P)=>{"use strict";p();var{Duplex:B8}=F("stream");function VP(e){e.emit("close")}function H8(){!this.destroyed&&this._writableState.finished&&this.destroy()}function GP(e){this.removeListener("error",GP),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function K8(e,t){let r=!0,n=!0;function i(){r&&e._socket.resume()}e.readyState===e.CONNECTING?e.once("open",function(){e._receiver.removeAllListeners("drain"),e._receiver.on("drain",i)}):(e._receiver.removeAllListeners("drain"),e._receiver.on("drain",i));let o=new B8({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(a){o.push(a)||(r=!1,e._socket.pause())}),e.once("error",function(a){o.destroyed||(n=!1,o.destroy(a))}),e.once("close",function(){o.destroyed||o.push(null)}),o._destroy=function(s,a){if(e.readyState===e.CLOSED){a(s),process.nextTick(VP,o);return}let u=!1;e.once("error",function(l){u=!0,a(l)}),e.once("close",function(){u||a(s),process.nextTick(VP,o)}),n&&e.terminate()},o._final=function(s){if(e.readyState===e.CONNECTING){e.once("open",function(){o._final(s)});return}e._socket!==null&&(e._socket._writableState.finished?(s(),o._readableState.endEmitted&&o.destroy()):(e._socket.once("finish",function(){s()}),e.close()))},o._read=function(){(e.readyState===e.OPEN||e.readyState===e.CLOSING)&&!r&&(r=!0,e._receiver._writableState.needDrain||e._socket.resume())},o._write=function(s,a,u){if(e.readyState===e.CONNECTING){e.once("open",function(){o._write(s,a,u)});return}e.send(s,u)},o.on("end",H8),o.on("error",GP),o}$P.exports=K8});var zP=v((dfe,WP)=>{"use strict";p();var Q8=F("events"),Yl=F("http"),cfe=F("https"),lfe=F("net"),pfe=F("tls"),{createHash:W8}=F("crypto"),Ti=Pa(),z8=hv(),{format:J8,parse:Y8}=uv(),{GUID:X8,kWebSocket:Z8}=Si(),e6=/^[+/0-9A-Za-z]{22}==$/,HP=0,KP=1,QP=2,gv=class extends Q8{constructor(t,r){if(super(),t={maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Yl.createServer((n,i)=>{let o=Yl.STATUS_CODES[426];i.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),i.end(o)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=t6(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,o,s)=>{this.handleUpgrade(i,o,s,n)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set),this.options=t,this._state=HP}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(t&&this.once("close",t),this._state===QP){process.nextTick(mv,this);return}if(this._state===KP)return;if(this._state=KP,this.clients)for(let n of this.clients)n.terminate();let r=this._server;if(r&&(this._removeListeners(),this._removeListeners=this._server=null,this.options.port!=null)){r.close(mv.bind(void 0,this));return}process.nextTick(mv,this)}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,i){r.on("error",yv);let o=t.headers["sec-websocket-key"]!==void 0?t.headers["sec-websocket-key"].trim():!1,s=t.headers.upgrade,a=+t.headers["sec-websocket-version"],u={};if(t.method!=="GET"||s===void 0||s.toLowerCase()!=="websocket"||!o||!e6.test(o)||a!==8&&a!==13||!this.shouldHandle(t))return La(r,400);if(this.options.perMessageDeflate){let c=new Ti(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let l=Y8(t.headers["sec-websocket-extensions"]);l[Ti.extensionName]&&(c.accept(l[Ti.extensionName]),u[Ti.extensionName]=c)}catch{return La(r,400)}}if(this.options.verifyClient){let c={origin:t.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(c,(l,d,f,h)=>{if(!l)return La(r,d||401,f,h);this.completeUpgrade(o,u,t,r,n,i)});return}if(!this.options.verifyClient(c))return La(r,401)}this.completeUpgrade(o,u,t,r,n,i)}completeUpgrade(t,r,n,i,o,s){if(!i.readable||!i.writable)return i.destroy();if(i[Z8])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>HP)return La(i,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${W8("sha1").update(t+X8).digest("base64")}`],c=new z8(null),l=n.headers["sec-websocket-protocol"];if(l&&(l=l.split(",").map(r6),this.options.handleProtocols?l=this.options.handleProtocols(l,n):l=l[0],l&&(u.push(`Sec-WebSocket-Protocol: ${l}`),c._protocol=l)),r[Ti.extensionName]){let d=r[Ti.extensionName].params,f=J8({[Ti.extensionName]:[d]});u.push(`Sec-WebSocket-Extensions: ${f}`),c._extensions=r}this.emit("headers",u,n),i.write(u.concat(`\r
208
+ `).join(`\r
209
+ `)),i.removeListener("error",yv),c.setSocket(i,o,this.options.maxPayload,this.options.maxBufferedChunks,this.options.maxFragments),this.clients&&(this.clients.add(c),c.on("close",()=>this.clients.delete(c))),s(c,n)}};WP.exports=gv;function t6(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function mv(e){e._state=QP,e.emit("close")}function yv(){this.destroy()}function La(e,t,r,n){e.writable&&(r=r||Yl.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.write(`HTTP/1.1 ${t} ${Yl.STATUS_CODES[t]}\r
210
+ `+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
211
+ `)+`\r
212
+ \r
213
+ `+r)),e.removeListener("error",yv),e.destroy()}function r6(e){return e.trim()}});var YP=v((hfe,JP)=>{"use strict";p();var ka=hv();ka.createWebSocketStream=BP();ka.Server=zP();ka.Receiver=tv();ka.Sender=nv();JP.exports=ka});var wv=v(It=>{"use strict";p();It.isIterable=XP;It.isArrayLike=Zl;It.isCollection=i6;It.getIterator=_v;It.getIteratorMethod=Sv;It.createIterator=ZP;It.forEach=o6;It.isAsyncIterable=a6;It.getAsyncIterator=eN;It.getAsyncIteratorMethod=Tv;It.createAsyncIterator=tN;It.forAwaitEach=u6;var Xl=typeof Symbol=="function"?Symbol:void 0,vv=Xl&&Xl.iterator,n6=It.$$iterator=vv||"@@iterator";function XP(e){return!!Sv(e)}function Zl(e){var t=e!=null&&e.length;return typeof t=="number"&&t>=0&&t%1===0}function i6(e){return Object(e)===e&&(Zl(e)||XP(e))}function _v(e){var t=Sv(e);if(t)return t.call(e)}function Sv(e){if(e!=null){var t=vv&&e[vv]||e["@@iterator"];if(typeof t=="function")return t}}function ZP(e){if(e!=null){var t=_v(e);if(t)return t;if(Zl(e))return new bv(e)}}function bv(e){this._o=e,this._i=0}bv.prototype[n6]=function(){return this};bv.prototype.next=function(){return this._o===void 0||this._i>=this._o.length?(this._o=void 0,{value:void 0,done:!0}):{value:this._o[this._i++],done:!1}};function o6(e,t,r){if(e!=null){if(typeof e.forEach=="function")return e.forEach(t,r);var n=0,i=_v(e);if(i){for(var o;!(o=i.next()).done;)if(t.call(r,o.value,n++,e),n>9999999)throw new TypeError("Near-infinite iteration.")}else if(Zl(e))for(;n<e.length;n++)e.hasOwnProperty(n)&&t.call(r,e[n],n,e)}}var Ev=Xl&&Xl.asyncIterator,s6=It.$$asyncIterator=Ev||"@@asyncIterator";function a6(e){return!!Tv(e)}function eN(e){var t=Tv(e);if(t)return t.call(e)}function Tv(e){if(e!=null){var t=Ev&&e[Ev]||e["@@asyncIterator"];if(typeof t=="function")return t}}function tN(e){if(e!=null){var t=eN(e);if(t)return t;var r=ZP(e);if(r)return new ja(r)}}function ja(e){this._i=e}ja.prototype[s6]=function(){return this};ja.prototype.next=function(e){return Iv(this._i,"next",e)};ja.prototype.return=function(e){return this._i.return?Iv(this._i,"return",e):Promise.resolve({value:e,done:!0})};ja.prototype.throw=function(e){return this._i.throw?Iv(this._i,"throw",e):Promise.reject(e)};function Iv(e,t,r){var n;return new Promise(function(i){n=e[t](r),i(n.value)}).then(function(i){return{value:i,done:n.done}})}function u6(e,t,r){var n=tN(e);if(n){var i=0;return new Promise(function(o,s){function a(){return n.next().then(function(u){return u.done?o():Promise.resolve(t.call(r,u.value,i++,e)).then(a).catch(s),null}).catch(s),null}a()})}}});var rN=v(ep=>{"use strict";p();Object.defineProperty(ep,"__esModule",{value:!0});ep.createEmptyIterable=void 0;var c6=wv(),l6=function(){var e;return e={next:function(){return Promise.resolve({value:void 0,done:!0})},return:function(){return Promise.resolve({value:void 0,done:!0})},throw:function(t){return Promise.reject(t)}},e[c6.$$asyncIterator]=function(){return this},e};ep.createEmptyIterable=l6});var nN=v(tp=>{"use strict";p();Object.defineProperty(tp,"__esModule",{value:!0});tp.isASubscriptionOperation=void 0;var p6=An(),d6=function(e,t){var r=(0,p6.getOperationAST)(e,t);return!!r&&r.operation==="subscription"};tp.isASubscriptionOperation=d6});var iN=v(Vo=>{"use strict";p();var Nt=Vo&&Vo.__assign||function(){return Nt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Nt.apply(this,arguments)};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.parseLegacyProtocolMessage=void 0;var mt=Aa(),f6=function(e,t){var r=t;switch(t.type){case mt.default.INIT:e.isLegacy=!0,r=Nt(Nt({},t),{type:mt.default.GQL_CONNECTION_INIT});break;case mt.default.SUBSCRIPTION_START:r={id:t.id,type:mt.default.GQL_START,payload:{query:t.query,operationName:t.operationName,variables:t.variables}};break;case mt.default.SUBSCRIPTION_END:r=Nt(Nt({},t),{type:mt.default.GQL_STOP});break;case mt.default.GQL_CONNECTION_ACK:e.isLegacy&&(r=Nt(Nt({},t),{type:mt.default.INIT_SUCCESS}));break;case mt.default.GQL_CONNECTION_ERROR:e.isLegacy&&(r=Nt(Nt({},t),{type:mt.default.INIT_FAIL,payload:t.payload.message?{error:t.payload.message}:t.payload}));break;case mt.default.GQL_ERROR:e.isLegacy&&(r=Nt(Nt({},t),{type:mt.default.SUBSCRIPTION_FAIL}));break;case mt.default.GQL_DATA:e.isLegacy&&(r=Nt(Nt({},t),{type:mt.default.SUBSCRIPTION_DATA}));break;case mt.default.GQL_COMPLETE:e.isLegacy&&(r=null);break;case mt.default.SUBSCRIPTION_SUCCESS:e.isLegacy||(r=null);break;default:break}return r};Vo.parseLegacyProtocolMessage=f6});var aN=v(rp=>{"use strict";p();Object.defineProperty(rp,"__esModule",{value:!0});rp.SubscriptionServer=void 0;var Ov=YP(),lt=Aa(),oN=Hl(),h6=Vy(),Av=An(),m6=rN(),xv=wv(),g6=nN(),sN=iN(),y6=function(e){return e.on},v6=(function(){function e(t,r){var n=this,i=t.onOperation,o=t.onOperationComplete,s=t.onConnect,a=t.onDisconnect,u=t.keepAlive;this.specifiedRules=t.validationRules||Av.specifiedRules,this.loadExecutor(t),this.onOperation=i,this.onOperationComplete=o,this.onConnect=s,this.onDisconnect=a,this.keepAlive=u,y6(r)?this.wsServer=r:this.wsServer=new Ov.Server(r||{});var c=(function(l,d){if(l.upgradeReq=d,l.protocol===void 0||l.protocol.indexOf(oN.GRAPHQL_WS)===-1&&l.protocol.indexOf(oN.GRAPHQL_SUBSCRIPTIONS)===-1){l.close(1002);return}var f=Object.create(null);f.initPromise=Promise.resolve(!0),f.isLegacy=!1,f.socket=l,f.request=d,f.operations={};var h=function(g){g&&(n.sendError(f,"",{message:g.message?g.message:g},lt.default.GQL_CONNECTION_ERROR),setTimeout(function(){f.socket.close(1011)},10)),n.onClose(f),n.onDisconnect&&n.onDisconnect(l,f)};l.on("error",h),l.on("close",h),l.on("message",n.onMessage(f))});this.wsServer.on("connection",c),this.closeHandler=function(){n.wsServer.removeListener("connection",c),n.wsServer.close()}}return e.create=function(t,r){return new e(t,r)},Object.defineProperty(e.prototype,"server",{get:function(){return this.wsServer},enumerable:!1,configurable:!0}),e.prototype.close=function(){this.closeHandler()},e.prototype.loadExecutor=function(t){var r=t.execute,n=t.subscribe,i=t.schema,o=t.rootValue;if(!r)throw new Error("Must provide `execute` for websocket server constructor.");this.schema=i,this.rootValue=o,this.execute=r,this.subscribe=n},e.prototype.unsubscribe=function(t,r){t.operations&&t.operations[r]&&(t.operations[r].return&&t.operations[r].return(),delete t.operations[r],this.onOperationComplete&&this.onOperationComplete(t.socket,r))},e.prototype.onClose=function(t){var r=this;Object.keys(t.operations).forEach(function(n){r.unsubscribe(t,n)})},e.prototype.onMessage=function(t){var r=this;return function(n){var i;try{i=(0,sN.parseLegacyProtocolMessage)(t,JSON.parse(n))}catch(s){r.sendError(t,null,{message:s.message},lt.default.GQL_CONNECTION_ERROR);return}var o=i.id;switch(i.type){case lt.default.GQL_CONNECTION_INIT:r.onConnect&&(t.initPromise=new Promise(function(s,a){try{s(r.onConnect(i.payload,t.socket,t))}catch(u){a(u)}})),t.initPromise.then(function(s){if(s===!1)throw new Error("Prohibited connection!");if(r.sendMessage(t,void 0,lt.default.GQL_CONNECTION_ACK,void 0),r.keepAlive){r.sendKeepAlive(t);var a=setInterval(function(){t.socket.readyState===Ov.OPEN?r.sendKeepAlive(t):clearInterval(a)},r.keepAlive)}}).catch(function(s){r.sendError(t,o,{message:s.message},lt.default.GQL_CONNECTION_ERROR),setTimeout(function(){t.socket.close(1011)},10)});break;case lt.default.GQL_CONNECTION_TERMINATE:t.socket.close();break;case lt.default.GQL_START:t.initPromise.then(function(s){t.operations&&t.operations[o]&&r.unsubscribe(t,o);var a={query:i.payload.query,variables:i.payload.variables,operationName:i.payload.operationName,context:(0,h6.default)(s)?Object.assign(Object.create(Object.getPrototypeOf(s)),s):{},formatResponse:void 0,formatError:void 0,callback:void 0,schema:r.schema},u=Promise.resolve(a);if(t.operations[o]=(0,m6.createEmptyIterable)(),r.onOperation){var c=i;u=Promise.resolve(r.onOperation(c,a,t.socket))}return u.then(function(l){if(typeof l!="object"){var d="Invalid params returned from onOperation! return values must be an object!";throw r.sendError(t,o,{message:d}),new Error(d)}if(!l.schema){var d="Missing schema information. The GraphQL schema should be provided either statically in the `SubscriptionServer` constructor or as a property on the object returned from onOperation!";throw r.sendError(t,o,{message:d}),new Error(d)}var f=typeof a.query!="string"?a.query:(0,Av.parse)(a.query),h,g=(0,Av.validate)(l.schema,f,r.specifiedRules);if(g.length>0)h=Promise.resolve({errors:g});else{var y=r.execute;r.subscribe&&(0,g6.isASubscriptionOperation)(f,l.operationName)&&(y=r.subscribe),h=Promise.resolve(y({schema:l.schema,document:f,rootValue:r.rootValue,contextValue:l.context,variableValues:l.variables,operationName:l.operationName}))}return h.then(function(_){return{executionIterable:(0,xv.isAsyncIterable)(_)?_:(0,xv.createAsyncIterator)([_]),params:l}})}).then(function(l){var d=l.executionIterable,f=l.params;return(0,xv.forAwaitEach)(d,function(h){var g=h;if(f.formatResponse)try{g=f.formatResponse(h,f)}catch(y){console.error("Error in formatResponse function:",y)}r.sendMessage(t,o,lt.default.GQL_DATA,g)}).then(function(){r.sendMessage(t,o,lt.default.GQL_COMPLETE,null)}).catch(function(h){var g=h;if(f.formatError)try{g=f.formatError(h,f)}catch(y){console.error("Error in formatError function: ",y)}Object.keys(g).length===0&&(g={name:g.name,message:g.message}),r.sendError(t,o,g)}),d}).then(function(l){t.operations[o]=l}).then(function(){r.sendMessage(t,o,lt.default.SUBSCRIPTION_SUCCESS,void 0)}).catch(function(l){l.errors?r.sendMessage(t,o,lt.default.GQL_DATA,{errors:l.errors}):r.sendError(t,o,{message:l.message}),r.unsubscribe(t,o)})}).catch(function(s){r.sendError(t,o,{message:s.message}),r.unsubscribe(t,o)});break;case lt.default.GQL_STOP:r.unsubscribe(t,o);break;default:r.sendError(t,o,{message:"Invalid message type!"})}}},e.prototype.sendKeepAlive=function(t){t.isLegacy?this.sendMessage(t,void 0,lt.default.KEEP_ALIVE,void 0):this.sendMessage(t,void 0,lt.default.GQL_CONNECTION_KEEP_ALIVE,void 0)},e.prototype.sendMessage=function(t,r,n,i){var o=(0,sN.parseLegacyProtocolMessage)(t,{type:n,id:r,payload:i});o&&t.socket.readyState===Ov.OPEN&&t.socket.send(JSON.stringify(o))},e.prototype.sendError=function(t,r,n,i){var o=i||lt.default.GQL_ERROR;if([lt.default.GQL_CONNECTION_ERROR,lt.default.GQL_ERROR].indexOf(o)===-1)throw new Error("overrideDefaultErrorType should be one of the allowed error messages GQL_CONNECTION_ERROR or GQL_ERROR");this.sendMessage(t,r,o,n)},e})();rp.SubscriptionServer=v6});var uN=v(yr=>{"use strict";p();var E6=yr&&yr.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Cv=yr&&yr.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&E6(t,e,r)};Object.defineProperty(yr,"__esModule",{value:!0});yr.MessageTypes=void 0;Cv(iP(),yr);Cv(aN(),yr);var _6=Aa();Object.defineProperty(yr,"MessageTypes",{enumerable:!0,get:function(){return _6.default}});Cv(Hl(),yr)});p();import{spawn as V9}from"child_process";import{randomUUID as G9}from"crypto";import{closeSync as $9,openSync as B9}from"fs";import{promises as H9}from"fs";import aL from"path";p();var xE=Qe(AE(),1),{program:y7,createCommand:v7,createArgument:E7,createOption:_7,CommanderError:S7,InvalidArgumentError:zp,InvalidOptionArgumentError:b7,Command:CE,Argument:T7,Option:I7,Help:w7}=xE.default;p();p();var aT=Qe(as(),1);import{promises as un}from"fs";import HU from"os";import Vn from"path";import{randomUUID as KU}from"crypto";var Fr=class{workspaceRoot;mcpConfigDir;credentialsPath;configPath;projectContextPath;globalConfigDir=Vn.join(HU.homedir(),`.${X}`);globalCredentialsPath=Vn.join(this.globalConfigDir,"credentials.json");constructor(t){this.setWorkspaceRoot(t)}setWorkspaceRoot(t){this.workspaceRoot=t,this.mcpConfigDir=Vn.join(t,`.${X}`),this.credentialsPath=Vn.join(this.mcpConfigDir,"credentials.json"),this.configPath=Vn.join(this.mcpConfigDir,"config.json"),this.projectContextPath=Vn.join(this.mcpConfigDir,"project-context.json")}async ensureInitialized(){await un.mkdir(this.mcpConfigDir,{recursive:!0});let t=Vn.join(this.mcpConfigDir,".gitignore"),r="*";try{await un.writeFile(t,r,{flag:"wx"})}catch(n){if(n.code!=="EEXIST")throw n}}tempPathFor(t){return`${t}.${process.pid}.${KU()}.tmp`}async atomicWrite(t,r,n){let i=this.tempPathFor(t);await un.writeFile(i,JSON.stringify(r,null,2),n!==void 0?{mode:n}:void 0),await un.rename(i,t)}async readJsonFile(t){try{let r=await un.readFile(t,"utf8");return JSON.parse(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}async unlinkIfExists(t){try{await un.unlink(t)}catch(r){if(r.code!=="ENOENT")throw r}}async fileExists(t){try{return await un.access(t),!0}catch{return!1}}async saveCredentials(t){if(!t.access_token||t.access_token.trim()==="")throw new Error("Invalid credentials: access_token is required");let r={access_token:t.access_token,token_type:t.token_type||"Bearer",savedAt:new Date().toISOString()};if(!this.validateCredentials(r))throw new Error("Invalid credentials: JWT token validation failed");await this.fileExists(this.credentialsPath)?(await this.ensureInitialized(),await this.atomicWrite(this.credentialsPath,r,384)):(await un.mkdir(this.globalConfigDir,{recursive:!0}),await this.atomicWrite(this.globalCredentialsPath,r,384)),P.info("[CredentialStore] Credentials saved successfully")}async loadCredentials(){let t=await this.readJsonFile(this.credentialsPath);if(t){if(this.validateCredentials(t))return t;P.error("[CredentialStore] Workspace credentials are invalid or expired")}let r=await this.readJsonFile(this.globalCredentialsPath);if(r){if(this.validateCredentials(r))return r;P.error("[CredentialStore] Global credentials are invalid or expired")}return null}validateCredentials(t){if(!t||!t.access_token)return P.error("[CredentialStore] Missing access token"),!1;if(t.token_type!=="Bearer")return P.error("[CredentialStore] Invalid token type:",t.token_type),!1;try{let r=aT.default.decode(t.access_token,{complete:!0});if(!r||typeof r=="string")return P.error("[CredentialStore] Failed to decode JWT token"),!1;let n=r.payload;if(n.exp){let i=n.exp*1e3,o=Date.now();if(o>=i)return P.error("[CredentialStore] JWT token has expired"),!1;let s=Math.floor((i-o)/1e3/60);P.debug(`[CredentialStore] Token valid for ${s} more minutes`)}else console.warn("[CredentialStore] JWT token does not have expiration field");return n.iss&&P.debug(`[CredentialStore] Token issued by: ${n.iss}`),n.sub&&P.debug(`[CredentialStore] Token subject: ${n.sub}`),!0}catch(r){return P.error("[CredentialStore] Error validating JWT token:",r.message),!1}}async deleteCredentials(){await this.unlinkIfExists(this.credentialsPath),await this.unlinkIfExists(this.globalCredentialsPath),P.info("[CredentialStore] Credentials deleted")}async areCredentialsValid(){return await this.loadCredentials()!==null}async saveConfig(t){await this.ensureInitialized(),await this.atomicWrite(this.configPath,t)}async loadConfig(){return this.readJsonFile(this.configPath)}async saveProjectContext(t,r){await this.ensureInitialized();let n={projectExId:t,appExId:r,lastUsed:new Date().toISOString()};await this.atomicWrite(this.projectContextPath,n)}async loadProjectContext(){let t=await this.readJsonFile(this.projectContextPath);return t&&{...t,appExId:t.appExId??null}}async deleteProjectContext(){await this.unlinkIfExists(this.projectContextPath)}getWorkspaceRoot(){return this.workspaceRoot}getMcpConfigDir(){return this.mcpConfigDir}};p();var T0=Qe(as(),1);p();p();var qr=class e extends Error{response;request;constructor(t,r){let n=`${e.extractMessage(t)}: ${JSON.stringify({response:t,request:r})}`;super(n),Object.setPrototypeOf(this,e.prototype),this.response=t,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${String(t.status)})`}};p();p();p();var qd=e=>e.toUpperCase(),Ou=e=>typeof e=="function"?e():e,Ud=(e,t)=>e.map((r,n)=>[r,t[n]]),Gn=e=>{let t={};return e instanceof Headers?t=QU(e):Array.isArray(e)?e.forEach(([r,n])=>{r&&n!==void 0&&(t[r]=n)}):e&&(t=e),t},QU=e=>{let t={};return e.forEach((r,n)=>{t[n]=r}),t},cT=e=>{try{let t=e();return WU(t)?t.catch(r=>uT(r)):t}catch(t){return uT(t)}},uT=e=>e instanceof Error?e:new Error(String(e)),WU=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"&&"catch"in e&&typeof e.catch=="function"&&"finally"in e&&typeof e.finally=="function",Au=e=>{throw new Error(`Unhandled case: ${String(e)}`)},us=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);p();var lT=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};p();var pT=(e,t,r)=>e.query?e:{query:e,variables:t,requestHeaders:r,signal:void 0};p();p();var c0=Qe(An(),1);p();var Ig="Accept",el="Content-Type",oa="application/json",tl="application/graphql-response+json";var wg=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),l0=e=>{let t=e.toLowerCase();return t.includes(tl)||t.includes(oa)},Og=e=>{try{if(Array.isArray(e))return{_tag:"Batch",executionResults:e.map(a0)};if(us(e))return{_tag:"Single",executionResult:a0(e)};throw new Error(`Invalid execution result: result is not object or array.
214
+ Got:
215
+ ${String(e)}`)}catch(t){return t}},a0=e=>{if(typeof e!="object"||e===null)throw new Error("Invalid execution result: result is not object");let t,r,n;if("errors"in e){if(!us(e.errors)&&!Array.isArray(e.errors))throw new Error("Invalid execution result: errors is not plain object OR array");t=e.errors}if("data"in e){if(!us(e.data)&&e.data!==null)throw new Error("Invalid execution result: data is not plain object");r=e.data}if("extensions"in e){if(!us(e.extensions))throw new Error("Invalid execution result: extensions is not plain object");n=e.extensions}return{data:r,errors:t,extensions:n}},p0=e=>e._tag==="Batch"?e.executionResults.some(u0):u0(e.executionResult),u0=e=>Array.isArray(e.errors)?e.errors.length>0:!!e.errors,Ag=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind===c0.Kind.OPERATION_DEFINITION;var d0=Qe(An(),1),f0=Qe(An(),1),nY=e=>{let t,r=e.definitions.filter(Ag);return r.length===1&&(t=r[0].name?.value),t},iY=e=>{let t=!1,r=e.definitions.filter(Ag);return r.length===1&&(t=r[0].operation==="mutation"),t},sa=(e,t)=>{let r=typeof e=="string"||"kind"in e?e:String(e),n=typeof r=="string"?r:(0,f0.print)(r),i=!1,o;if(t)return{expression:n,isMutation:i,operationName:o};let s=cT(()=>typeof r=="string"?(0,d0.parse)(r):r);return s instanceof Error?{expression:n,isMutation:i,operationName:o}:(o=nY(s),i=iY(s),{expression:n,operationName:o,isMutation:i})};p();p();var rl=JSON;var nl=async e=>{let t={...e,method:e.request._tag==="Single"?e.request.document.isMutation?"POST":qd(e.method??"post"):e.request.hasMutations?"POST":qd(e.method??"post"),fetchOptions:{...e.fetchOptions,errorPolicy:e.fetchOptions.errorPolicy??"none"}},n=await sY(t.method)(t),i=await n.text(),o;try{o=oY(i,n.headers.get(el),e.fetchOptions.jsonSerializer??rl)}catch(a){o=a}let s={status:n.status,headers:n.headers,body:i};if(!n.ok){if(o instanceof Error)return new qr({...s},{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables});let a=o._tag==="Batch"?{...o.executionResults,...s}:{...o.executionResult,...s};return new qr(a,{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables})}if(o instanceof Error)throw o;if(p0(o)&&t.fetchOptions.errorPolicy==="none"){let a=o._tag==="Batch"?{...o.executionResults,...s}:{...o.executionResult,...s};return new qr(a,{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables})}switch(o._tag){case"Single":return{...s,...h0(t)(o.executionResult)};case"Batch":return{...s,data:o.executionResults.map(h0(t))};default:Au(o)}},h0=e=>t=>({extensions:t.extensions,data:t.data,errors:e.fetchOptions.errorPolicy==="all"?t.errors:void 0}),oY=(e,t,r)=>t&&l0(t)?Og(r.parse(e)):Og(e),sY=e=>async t=>{let r=new Headers(t.headers),n=null,i;r.has(Ig)||r.set(Ig,[tl,oa].join(", ")),e==="POST"?(i=(t.fetchOptions.jsonSerializer??rl).stringify(aY(t)),typeof i=="string"&&!r.has(el)&&r.set(el,oa)):n=uY(t);let o={method:e,headers:r,body:i,...t.fetchOptions},s=new URL(t.url),a=o;if(t.middleware){let c=await Promise.resolve(t.middleware({...o,url:t.url,operationName:t.request._tag==="Single"?t.request.document.operationName:void 0,variables:t.request.variables})),{url:l,...d}=c;s=new URL(l),a=d}return n&&n.forEach((c,l)=>{s.searchParams.append(l,c)}),await(t.fetch??fetch)(s,a)},aY=e=>{switch(e.request._tag){case"Single":return{query:e.request.document.expression,variables:e.request.variables,operationName:e.request.document.operationName};case"Batch":return Ud(e.request.query,e.request.variables??[]).map(([t,r])=>({query:t,variables:r}));default:throw Au(e.request)}},uY=e=>{let t=e.fetchOptions.jsonSerializer??rl,r=new URLSearchParams;switch(e.request._tag){case"Single":return r.append("query",wg(e.request.document.expression)),e.request.variables&&r.append("variables",t.stringify(e.request.variables)),e.request.document.operationName&&r.append("operationName",e.request.document.operationName),r;case"Batch":{let n=e.request.variables?.map(s=>t.stringify(s))??[],i=e.request.query.map(wg),o=Ud(i,n).map(([s,a])=>({query:s,variables:a}));return r.append("query",t.stringify(o)),r}default:throw Au(e.request)}};var at=class{url;requestConfig;constructor(t,r={}){this.url=t,this.requestConfig=r}rawRequest=async(...t)=>{let[r,n,i]=t,o=pT(r,n,i),{headers:s,fetch:a=globalThis.fetch,method:u="POST",requestMiddleware:c,responseMiddleware:l,excludeOperationName:d,...f}=this.requestConfig,{url:h}=this;o.signal!==void 0&&(f.signal=o.signal);let g=sa(o.query,d),y=await nl({url:h,request:{_tag:"Single",document:g,variables:o.variables},headers:{...Gn(Ou(s)),...Gn(o.requestHeaders)},fetch:a,method:u,fetchOptions:f,middleware:c});if(l&&await l(y,{operationName:g.operationName,variables:n,url:this.url}),y instanceof Error)throw y;return y};async request(t,...r){let[n,i]=r,o=m0(t,n,i),{headers:s,fetch:a=globalThis.fetch,method:u="POST",requestMiddleware:c,responseMiddleware:l,excludeOperationName:d,...f}=this.requestConfig,{url:h}=this;o.signal!==void 0&&(f.signal=o.signal);let g=sa(o.document,d),y=await nl({url:h,request:{_tag:"Single",document:g,variables:o.variables},headers:{...Gn(Ou(s)),...Gn(o.requestHeaders)},fetch:a,method:u,fetchOptions:f,middleware:c});if(l&&await l(y,{operationName:g.operationName,variables:o.variables,url:this.url}),y instanceof Error)throw y;return y.data}async batchRequests(t,r){let n=lT(t,r),{headers:i,excludeOperationName:o,...s}=this.requestConfig;n.signal!==void 0&&(s.signal=n.signal);let a=n.documents.map(({document:f})=>sa(f,o)),u=a.map(({expression:f})=>f),c=a.some(({isMutation:f})=>f),l=n.documents.map(({variables:f})=>f),d=await nl({url:this.url,request:{_tag:"Batch",operationName:void 0,query:u,hasMutations:c,variables:l},headers:{...Gn(Ou(i)),...Gn(n.requestHeaders)},fetch:this.requestConfig.fetch??globalThis.fetch,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware});if(this.requestConfig.responseMiddleware&&await this.requestConfig.responseMiddleware(d,{operationName:void 0,variables:l,url:this.url}),d instanceof Error)throw d;return d.data}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,r){let{headers:n}=this.requestConfig;return n?n[t]=r:this.requestConfig.headers={[t]:r},this}setEndpoint(t){return this.url=t,this}};var m0=(e,t,r)=>e.document?e:{document:e,variables:t,requestHeaders:r,signal:void 0};p();var U=(e,...t)=>e.reduce((r,n,i)=>`${r}${n}${i in t?String(t[i]):""}`,"");p();var b0=Qe(S0(),1);(0,b0.config)({quiet:!0});async function Pr(e){let t=await e.loadConfig();if(!t){let r=Ht();t={authEndpoint:r.authEndpoint,apiBaseUrl:r.apiBaseUrl,callbackPort:process.env.LOCAL_CALLBACK_PORT?parseInt(process.env.LOCAL_CALLBACK_PORT,10):8088}}return t}var IY=.25,wY=300*1e3,OY=3600*1e3,AY="query { refreshToken { accessToken } }",yo=class{store;lastRefreshAt=Date.now();constructor(t){this.store=t}async getValidToken(){let t=await this.store.loadCredentials();if(!t)throw new Error(Ka);return await this.refreshIfDue(t.access_token)??t.access_token}async refreshIfNeeded(){try{let t=await this.store.loadCredentials();if(!t)return;await this.refreshIfDue(t.access_token)}catch(t){P.debug(`[TokenManager] background refresh check failed: ${t.message}`)}}async refreshIfDue(t){if(!this.isDue(t))return null;try{let r=await Pr(this.store),o=(await new at(`${r.apiBaseUrl}/api/graphql`,{headers:{Authorization:`Bearer ${t}`}}).request(AY)).refreshToken?.accessToken;return o?(await this.store.saveCredentials({access_token:o,token_type:"Bearer"}),this.lastRefreshAt=Date.now(),P.info("[TokenManager] Access token refreshed"),o):(P.debug("[TokenManager] refreshToken returned no accessToken - keeping current token"),null)}catch(r){return P.debug(`[TokenManager] Token refresh failed - keeping current token: ${r.message}`),null}}isDue(t){try{let r=T0.default.decode(t,{complete:!0});if(!r||typeof r=="string")return!1;let n=r.payload;if(!n.exp)return!1;let i=Date.now(),o=n.exp*1e3-i;if(o<=0)return!1;let s=n.iat!=null?(n.exp-n.iat)*1e3*IY:wY;if(o<s)return!0;let a=n.iat!=null?n.iat*1e3:this.lastRefreshAt;return i-a>=OY}catch{return!1}}};p();import{EventEmitter as Z4}from"events";p();import{randomUUID as gi}from"crypto";p();p();var I0=U`
216
+ query TabBarIcons {
217
+ getTabBarIcons {
218
+ exId
219
+ url
220
+ }
221
+ }
222
+ `,w0=U`
223
+ fragment SchemaCrdtPatch on SchemaCrdtPatch {
224
+ exId
225
+ createdAt
226
+ content
227
+ patchBase64
228
+ }
229
+ `,xY=U`
230
+ fragment SchemaCrdtPatches on SchemaCrdtPatches {
231
+ lastPatchExId
232
+ patches {
233
+ ...SchemaCrdtPatch
234
+ }
235
+ }
236
+ ${w0}
237
+ `,Cg=U`
238
+ fragment ActiveCommit on CrdtSchema {
239
+ activeCommit {
240
+ commitExId
241
+ crdtModelUrl
242
+ crdtPatches {
243
+ ...SchemaCrdtPatches
244
+ }
245
+ }
246
+ }
247
+ `,ol=U`
248
+ query FuzzySearchProjectName(
249
+ $projectName: String!
250
+ $paginator: ConnectionPaginatorInput
251
+ ) {
252
+ fuzzySearchProjectName(projectName: $projectName, paginator: $paginator) {
253
+ pageInfo {
254
+ hasNextPage
255
+ endCursor {
256
+ value
257
+ }
258
+ }
259
+ edges {
260
+ node {
261
+ exId
262
+ type
263
+ projectName
264
+ name
265
+ updatedAt
266
+ hasPublished
267
+ appList {
268
+ __typename
269
+ appType
270
+ ... on WebApp {
271
+ webProdDomain
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ `,ua=U`
279
+ query FetchAppDetailByExId(
280
+ $projectExId: String!
281
+ $appExId: String
282
+ $appVersionExId: String
283
+ ) {
284
+ # Not WithoutReconcile: the backend migrates the schema up to our X-ZED-VERSION first.
285
+ fetchAppDetailByExId(
286
+ projectExId: $projectExId
287
+ appExId: $appExId
288
+ appVersionExId: $appVersionExId
289
+ ) {
290
+ projectExId
291
+ appExId
292
+ appType
293
+ ... on WebApp {
294
+ name
295
+ createdAt
296
+ lastOpenedAt
297
+ collaboratorTypeByLevel
298
+ hasPublished
299
+ config {
300
+ favicon
301
+ customDomain
302
+ }
303
+ isExpired
304
+ additional
305
+ webProdDomain
306
+ project {
307
+ ...ProjectDetails
308
+ lastDeployedServerSchemaExId
309
+ }
310
+ latestDeployedServerSchema
311
+ lastUploadedSchema: latestSchema {
312
+ exId
313
+ crdtModelUrl
314
+ }
315
+ }
316
+ ... on WechatMiniProgramApp {
317
+ name
318
+ createdAt
319
+ lastOpenedAt
320
+ collaboratorTypeByLevel
321
+ hasPublished
322
+ config {
323
+ ...WechatConfigFragment
324
+ }
325
+ debugScriptUrl
326
+ wechatMiniAppPreviewTime
327
+ wechatMiniAppPreviewVersion
328
+ isExpired
329
+ additional
330
+ project {
331
+ ...ProjectDetails
332
+ lastDeployedServerSchemaExId
333
+ }
334
+ latestDeployedServerSchema
335
+ lastUploadedSchema: latestSchema {
336
+ exId
337
+ crdtModelUrl
338
+ }
339
+ }
340
+ ... on MobileApp {
341
+ name
342
+ createdAt
343
+ lastOpenedAt
344
+ collaboratorTypeByLevel
345
+ hasPublished
346
+ isExpired
347
+ additional
348
+ project {
349
+ ...ProjectDetails
350
+ lastDeployedServerSchemaExId
351
+ }
352
+ latestDeployedServerSchema
353
+ lastUploadedSchema: latestSchema {
354
+ exId
355
+ crdtModelUrl
356
+ }
357
+ }
358
+ ... on Project {
359
+ ...ProjectDetails
360
+ lastUploadedSchema: latestSchema {
361
+ exId
362
+ crdtModelUrl
363
+ }
364
+ deploymentEnvConfigs {
365
+ exId
366
+ userDeploymentEnvironment
367
+ }
368
+ }
369
+ }
370
+ }
371
+
372
+ fragment ProjectDetails on Project {
373
+ exId
374
+ createdAt
375
+ updatedAt
376
+ name
377
+ projectName
378
+ collaboratorType
379
+ collaboratorTypeByLevel
380
+ schemaExId
381
+ debugScriptUrl
382
+ callbackConfigUrlPrefix
383
+ wechatMiniAppPreviewVersion
384
+ wechatMiniAppPreviewTime
385
+ adminToken
386
+ forBeginnerGuide
387
+ hasPublished
388
+ zeroUrl
389
+ zeroSubscriptionUrl
390
+ lastDeployedServerSchemaExId
391
+ relatedTemplate {
392
+ exId
393
+ }
394
+ projectConfig {
395
+ ...ProjectConfigFragment
396
+ }
397
+ appList {
398
+ projectExId
399
+ appExId
400
+ appType
401
+ name
402
+ lastOpenedAt
403
+ collaboratorType
404
+ collaboratorTypeByLevel
405
+ hasPublished
406
+ expireAt
407
+ isExpired
408
+ isRenewable
409
+ additional
410
+ ... on WebApp {
411
+ webProdDomain
412
+ }
413
+ }
414
+ vectorStorageSupported
415
+ isExpired
416
+ allowCopyToOtherProjects
417
+ }
418
+
419
+ fragment ProjectConfigFragment on ProjectConfig {
420
+ wechatAppConfig {
421
+ ...WechatConfigFragment
422
+ }
423
+ webConfig {
424
+ favicon
425
+ customDomain
426
+ }
427
+ aliyunSmsConfig {
428
+ powerOfAttorneyImageExId
429
+ signature {
430
+ description
431
+ signSource
432
+ signature
433
+ }
434
+ }
435
+ emailConfig {
436
+ emailPassword
437
+ emailProvider
438
+ emailSender
439
+ }
440
+ aliPayConfig {
441
+ appId
442
+ merchantPrivateKey
443
+ alipayPublicKey
444
+ notifyUrl
445
+ paymentConfigVersion
446
+ }
447
+ stripePayConfig {
448
+ stripePrivateKey
449
+ stripePublicKey
450
+ callbackUrl
451
+ endpointSecret
452
+ paymentConfigVersion
453
+ }
454
+ wechatPayConfig {
455
+ appId
456
+ mchId
457
+ mchKey
458
+ notifyUrl
459
+ paymentConfigVersion
460
+ wechatPaymentBase64CertFileExId
461
+ }
462
+ supportedPlatforms
463
+ registerToken
464
+ }
465
+
466
+ fragment WechatConfigFragment on WechatAppConfig {
467
+ appId
468
+ wechatAppId
469
+ wechatAppSecret
470
+ hasGrantedThirdPartyAuthorization
471
+ wechatPaymentMerchantId
472
+ wechatPaymentMerchantKey
473
+ wechatPaymentNotifyUrl
474
+ paymentConfigVersion
475
+ wechatPaymentBase64CertFileExId
476
+ wechatPrivateKeyFileExId
477
+ wechatBetaAppExpireAt
478
+ wechatBetaAppId
479
+ }
480
+ `,CY=U`
481
+ fragment OrganizationForAgent on Organization {
482
+ exId
483
+ displayName
484
+ ownerName
485
+ planType
486
+ planExpireAt
487
+ permissionEnabled
488
+ permissionRoleLimit
489
+ capabilities {
490
+ capability
491
+ limit {
492
+ amount
493
+ unlimited
494
+ }
495
+ }
496
+ }
497
+ `,sl=U`
498
+ query FetchCurrentUserInfoForAgent {
499
+ user {
500
+ exId
501
+ email
502
+ phoneNumber
503
+ username
504
+ displayName
505
+ availableTechnicalSupportHours
506
+ daysSinceRegistration
507
+ involvedProjectCount
508
+ currentOrganization {
509
+ exId
510
+ }
511
+ organization {
512
+ exId
513
+ }
514
+ organizations {
515
+ exId
516
+ }
517
+ joinedOrganizations {
518
+ exId
519
+ }
520
+ }
521
+ }
522
+ `,O0=U`
523
+ query FetchAccountProfileForAgent {
524
+ user {
525
+ exId
526
+ email
527
+ phoneNumber
528
+ username
529
+ displayName
530
+ availableTechnicalSupportHours
531
+ daysSinceRegistration
532
+ involvedProjectCount
533
+ joinedOrganizations {
534
+ ...OrganizationForAgent
535
+ }
536
+ }
537
+ }
538
+
539
+ ${CY}
540
+ `,A0=U`
541
+ mutation CreateMultiClientProjectForAgent(
542
+ $createProjectDetail: CreateProjectInputInput!
543
+ ) {
544
+ createMultiClientProjectAsync(createProjectDetail: $createProjectDetail)
545
+ }
546
+ `,x0=U`
547
+ query GetFeaturesForAgent($projectExId: String) {
548
+ features(projectExId: $projectExId) {
549
+ featureName
550
+ enabled
551
+ }
552
+ }
553
+ `,C0=U`
554
+ mutation RenameProjectForAgent($projectExId: String!, $projectName: String!) {
555
+ renameProject(projectExId: $projectExId, projectName: $projectName) {
556
+ projectName
557
+ }
558
+ }
559
+ `,R0=U`
560
+ mutation RenameAppForAgent(
561
+ $projectExId: String!
562
+ $appExId: String!
563
+ $appName: String!
564
+ ) {
565
+ renameApp(projectExId: $projectExId, appName: $appName, appExId: $appExId) {
566
+ name
567
+ }
568
+ }
569
+ `,P0=U`
570
+ mutation DeleteProjectForAgent($projectExId: String!) {
571
+ deleteProject(projectExId: $projectExId)
572
+ }
573
+ `,N0=U`
574
+ mutation ResetProjectForAgent(
575
+ $projectExId: String!
576
+ $languageType: LanguageType!
577
+ ) {
578
+ resetProject(projectExId: $projectExId, languageType: $languageType)
579
+ }
580
+ `,D0=U`
581
+ query FetchProjectRuntimeAdminAccess(
582
+ $projectExId: String!
583
+ $appVersionExId: String
584
+ ) {
585
+ fetchAppDetailByExIdWithoutReconcile(
586
+ projectExId: $projectExId
587
+ appVersionExId: $appVersionExId
588
+ ) {
589
+ __typename
590
+ ... on Project {
591
+ adminToken
592
+ zeroUrl
593
+ adminZeroUrl
594
+ adminZeroSubscriptionUrl
595
+ }
596
+ }
597
+ }
598
+ `,L0=U`
599
+ query FetchLatestSchemaPatchesAfter(
600
+ $projectExId: String!
601
+ $appExId: String
602
+ $appVersionExId: String
603
+ $afterPatchExId: String
604
+ ) {
605
+ fetchAppDetailByExId(
606
+ projectExId: $projectExId
607
+ appExId: $appExId
608
+ appVersionExId: $appVersionExId
609
+ ) {
610
+ ... on WebApp {
611
+ lastUploadedSchema: latestSchema {
612
+ ...LatestSchemaPatchesAfter
613
+ }
614
+ }
615
+ ... on WechatMiniProgramApp {
616
+ lastUploadedSchema: latestSchema {
617
+ ...LatestSchemaPatchesAfter
618
+ }
619
+ }
620
+ ... on MobileApp {
621
+ lastUploadedSchema: latestSchema {
622
+ ...LatestSchemaPatchesAfter
623
+ }
624
+ }
625
+ ... on Project {
626
+ lastUploadedSchema: latestSchema {
627
+ ...LatestSchemaPatchesAfter
628
+ }
629
+ }
630
+ }
631
+ }
632
+
633
+ fragment LatestSchemaPatchesAfter on CrdtSchema {
634
+ exId
635
+ crdtModelUrl
636
+ crdtPatches(afterPatchExId: $afterPatchExId) {
637
+ ...SchemaCrdtPatches
638
+ }
639
+ ...ActiveCommit
640
+ }
641
+ ${xY}
642
+ ${Cg}
643
+ `,k0=U`
644
+ query CrdtSchemaFields {
645
+ __type(name: "CrdtSchema") {
646
+ fields {
647
+ name
648
+ }
649
+ }
650
+ }
651
+ `,j0=U`
652
+ query SchemaCrdtPatchInputFields {
653
+ __type(name: "SchemaCrdtPatchCreationDtoInput") {
654
+ inputFields {
655
+ name
656
+ }
657
+ }
658
+ }
659
+ `,M0=U`
660
+ mutation BatchCreateSchemaCrdtPatch(
661
+ $projectExId: String!
662
+ $appExId: String
663
+ $schemaExId: String!
664
+ $patches: [SchemaCrdtPatchCreationDtoInput!]!
665
+ ) {
666
+ batchCreateSchemaCrdtPatch(
667
+ projectExId: $projectExId
668
+ appExId: $appExId
669
+ schemaExId: $schemaExId
670
+ patches: $patches
671
+ ) {
672
+ ...SchemaCrdtPatch
673
+ }
674
+ }
675
+ ${w0}
676
+ `,Rg=U`
677
+ mutation SaveSchema(
678
+ $projectExId: String!
679
+ $appExId: String
680
+ $versionExId: String
681
+ ) {
682
+ saveSchema(
683
+ projectExId: $projectExId
684
+ appExId: $appExId
685
+ versionExId: $versionExId
686
+ )
687
+ }
688
+ `,F0=U`
689
+ subscription OnNewCrdtPatchV2(
690
+ $projectExId: String!
691
+ $appExId: String
692
+ $versionExId: String
693
+ $latestPatchExIdInClient: String
694
+ ) {
695
+ onNewCrdtPatchV2(
696
+ projectExId: $projectExId
697
+ appExId: $appExId
698
+ versionExId: $versionExId
699
+ shouldExcludeSameSessionDiffs: true
700
+ latestPatchExIdInClient: $latestPatchExIdInClient
701
+ ) {
702
+ lastPatchExId
703
+ }
704
+ }
705
+ `,q0=U`
706
+ subscription OnSchemaUploadV3(
707
+ $projectExId: String!
708
+ $appExId: String
709
+ $appVersionExId: String
710
+ ) {
711
+ onSchemaUploadV3(
712
+ projectExId: $projectExId
713
+ appExId: $appExId
714
+ shouldExcludeSameSessionEvent: true
715
+ appVersionExId: $appVersionExId
716
+ ) {
717
+ ... on SchemaUploadEndV3 {
718
+ __typename
719
+ schemaExId
720
+ continuous
721
+ }
722
+ ... on SchemaUploadStartV3 {
723
+ __typename
724
+ }
725
+ }
726
+ }
727
+ `,U0=U`
728
+ mutation DeployV2ForAgent(
729
+ $schemaExId: String!
730
+ $projectExId: String!
731
+ $appExId: String
732
+ $buildTarget: BuildTarget!
733
+ ) {
734
+ deployV2(
735
+ schemaExId: $schemaExId
736
+ projectExId: $projectExId
737
+ appExId: $appExId
738
+ buildTarget: $buildTarget
739
+ )
740
+ }
741
+ `,V0=U`
742
+ mutation ValidateAndDeploySupportServiceForAgent(
743
+ $schemaExId: String!
744
+ $projectExId: String!
745
+ $appExId: String
746
+ ) {
747
+ validateAndDeploy(
748
+ schemaExId: $schemaExId
749
+ projectExId: $projectExId
750
+ appExId: $appExId
751
+ ) {
752
+ appExId
753
+ }
754
+ }
755
+ `,G0=U`
756
+ mutation DeployV2AtCommitForAgent(
757
+ $schemaExId: String!
758
+ $commitExId: String
759
+ $projectExId: String!
760
+ $appExId: String
761
+ $buildTarget: BuildTarget!
762
+ ) {
763
+ deployV2(
764
+ schemaExId: $schemaExId
765
+ commitExId: $commitExId
766
+ projectExId: $projectExId
767
+ appExId: $appExId
768
+ buildTarget: $buildTarget
769
+ )
770
+ }
771
+ `,$0=U`
772
+ mutation ValidateAndDeploySupportServiceAtCommitForAgent(
773
+ $schemaExId: String!
774
+ $commitExId: String
775
+ $projectExId: String!
776
+ $appExId: String
777
+ ) {
778
+ validateAndDeploy(
779
+ schemaExId: $schemaExId
780
+ commitExId: $commitExId
781
+ projectExId: $projectExId
782
+ appExId: $appExId
783
+ ) {
784
+ appExId
785
+ }
786
+ }
787
+ `,B0=U`
788
+ mutation TakeSchemaCommitForAgent(
789
+ $projectExId: String!
790
+ $appExId: String
791
+ $groupId: String
792
+ $fromDeploy: Boolean
793
+ ) {
794
+ takeSchemaCommit(
795
+ projectExId: $projectExId
796
+ appExId: $appExId
797
+ groupId: $groupId
798
+ fromDeploy: $fromDeploy
799
+ )
800
+ }
801
+ `,H0=U`
802
+ mutation TakeAgentSchemaCommitForAgent(
803
+ $projectExId: String!
804
+ $appExId: String
805
+ $name: String!
806
+ $groupId: String
807
+ ) {
808
+ takeSchemaCommit(
809
+ projectExId: $projectExId
810
+ appExId: $appExId
811
+ name: $name
812
+ groupId: $groupId
813
+ kind: AGENT
814
+ )
815
+ }
816
+ `,K0=U`
817
+ query ResourceUsageAndBurstInfoForAgent(
818
+ $projectExId: String!
819
+ $nonRealTimeDisplayedResourceTypes: [ResourceType]
820
+ ) {
821
+ resourceUsageAndBurstInfo(
822
+ projectExId: $projectExId
823
+ nonRealTimeDisplayedResourceTypes: $nonRealTimeDisplayedResourceTypes
824
+ ) {
825
+ projectResourceUsageInfo {
826
+ availableAmountWithNoExhaustionBurst
827
+ resourceType
828
+ resourceUsageStatus
829
+ usedAmount
830
+ unlimited
831
+ }
832
+ unitComputingPower
833
+ visitTimesSupportedByComputingPower
834
+ }
835
+ }
836
+ `,Q0=U`
837
+ mutation RefreshAllProjectResourcesForAgent($projectExId: String!) {
838
+ refreshAllProjectResources(projectExId: $projectExId)
839
+ }
840
+ `,W0=U`
841
+ query MonthlyResourceUsageHistoryForAgent(
842
+ $projectExId: String!
843
+ $resourceType: ResourceType!
844
+ ) {
845
+ monthlyResourceUsageHistory(
846
+ projectExId: $projectExId
847
+ resourceType: $resourceType
848
+ )
849
+ }
850
+ `,z0=U`
851
+ query DailyResourceUsageHistoryForAgent(
852
+ $projectExId: String!
853
+ $resourceType: ResourceType!
854
+ ) {
855
+ dailyResourceUsageHistory(
856
+ projectExId: $projectExId
857
+ resourceType: $resourceType
858
+ )
859
+ }
860
+ `,J0=U`
861
+ query ActiveSingleTenantResourceInfoForAgent($projectExId: String!) {
862
+ findActiveSingleTenantResourceInfoAndThrowOnExpireTimeMismatch(
863
+ projectExId: $projectExId
864
+ ) {
865
+ amount
866
+ expireAt
867
+ resourceType
868
+ }
869
+ }
870
+ `,Y0=U`
871
+ query ProjectPlanAndCapabilityForAgentQuery(
872
+ $projectExId: String!
873
+ $appExId: String
874
+ ) {
875
+ fetchAppDetailByExId: fetchAppDetailByExIdWithoutReconcile(
876
+ projectExId: $projectExId
877
+ appExId: $appExId
878
+ ) {
879
+ projectExId
880
+ appExId
881
+ appType
882
+ ... on WebApp {
883
+ project {
884
+ ...ProjectPlanAndCapabilityForAgent
885
+ }
886
+ }
887
+ ... on WechatMiniProgramApp {
888
+ project {
889
+ ...ProjectPlanAndCapabilityForAgent
890
+ }
891
+ }
892
+ ... on MobileApp {
893
+ project {
894
+ ...ProjectPlanAndCapabilityForAgent
895
+ }
896
+ }
897
+ ... on Project {
898
+ ...ProjectPlanAndCapabilityForAgent
899
+ }
900
+ }
901
+ }
902
+
903
+ fragment ProjectPlanAndCapabilityForAgent on Project {
904
+ capabilities {
905
+ capability
906
+ limit {
907
+ amount
908
+ unlimited
909
+ }
910
+ }
911
+ highestPurchasedProjectPlanType
912
+ projectPlan {
913
+ expireAt
914
+ projectPlanType
915
+ }
916
+ }
917
+ `,bue=U`
918
+ query ProjectRpsStatsForAgent($projectExId: String!) {
919
+ project(projectExId: $projectExId) {
920
+ rpsStatsInLast30Days {
921
+ exceededNumOfDays
922
+ exceededTotal
923
+ }
924
+ }
925
+ }
926
+ `,X0=U`
927
+ query SupportedCustomModelDescriptor {
928
+ supportedCustomModelDescriptor {
929
+ chatModelDescriptors
930
+ embeddingModelDescriptors
931
+ }
932
+ }
933
+ `,al=U`
934
+ query ProjectMetadataForAgent($projectExId: String!, $appExId: String) {
935
+ fetchAppDetailByExId: fetchAppDetailByExIdWithoutReconcile(
936
+ projectExId: $projectExId
937
+ appExId: $appExId
938
+ ) {
939
+ __typename
940
+ projectExId
941
+ appExId
942
+ appType
943
+ ... on WebApp {
944
+ name
945
+ createdAt
946
+ hasPublished
947
+ isExpired
948
+ config {
949
+ customDomain
950
+ }
951
+ webProdDomain
952
+ lastUploadedSchema: latestSchema {
953
+ exId
954
+ }
955
+ project {
956
+ ...ProjectMetaSummary
957
+ }
958
+ }
959
+ ... on WechatMiniProgramApp {
960
+ name
961
+ createdAt
962
+ hasPublished
963
+ isExpired
964
+ lastUploadedSchema: latestSchema {
965
+ exId
966
+ }
967
+ project {
968
+ ...ProjectMetaSummary
969
+ }
970
+ }
971
+ ... on MobileApp {
972
+ name
973
+ createdAt
974
+ hasPublished
975
+ isExpired
976
+ lastUploadedSchema: latestSchema {
977
+ exId
978
+ }
979
+ project {
980
+ ...ProjectMetaSummary
981
+ }
982
+ }
983
+ ... on Project {
984
+ ...ProjectMetaSummary
985
+ lastUploadedSchema: latestSchema {
986
+ exId
987
+ }
988
+ deploymentEnvConfigs {
989
+ userDeploymentEnvironment
990
+ }
991
+ }
992
+ }
993
+ project(projectExId: $projectExId) {
994
+ rpsStatsInLast30Days {
995
+ exceededNumOfDays
996
+ exceededTotal
997
+ }
998
+ }
999
+ }
1000
+
1001
+ fragment ProjectMetaSummary on Project {
1002
+ exId
1003
+ projectName
1004
+ createdAt
1005
+ updatedAt
1006
+ hasPublished
1007
+ isExpired
1008
+ lastDeployedServerSchemaExId
1009
+ projectConfig {
1010
+ supportedPlatforms
1011
+ webConfig {
1012
+ customDomain
1013
+ }
1014
+ stripePayConfig {
1015
+ paymentConfigVersion
1016
+ }
1017
+ aliPayConfig {
1018
+ paymentConfigVersion
1019
+ }
1020
+ wechatPayConfig {
1021
+ paymentConfigVersion
1022
+ }
1023
+ wechatAppConfig {
1024
+ paymentConfigVersion
1025
+ }
1026
+ aliyunSmsConfig {
1027
+ powerOfAttorneyImageExId
1028
+ }
1029
+ emailConfig {
1030
+ emailProvider
1031
+ }
1032
+ }
1033
+ appList {
1034
+ __typename
1035
+ appExId
1036
+ appType
1037
+ name
1038
+ hasPublished
1039
+ isExpired
1040
+ ... on WebApp {
1041
+ webProdDomain
1042
+ }
1043
+ }
1044
+ capabilities {
1045
+ capability
1046
+ limit {
1047
+ amount
1048
+ unlimited
1049
+ }
1050
+ }
1051
+ highestPurchasedProjectPlanType
1052
+ projectPlan {
1053
+ expireAt
1054
+ projectPlanType
1055
+ }
1056
+ }
1057
+ `,Z0=U`
1058
+ mutation CreateStaticSiteDeploymentForAgent(
1059
+ $projectExId: String!
1060
+ $appExId: String
1061
+ $target: StaticSiteTarget!
1062
+ $files: [StaticFileInputInput]!
1063
+ ) {
1064
+ createStaticSiteDeployment(
1065
+ projectExId: $projectExId
1066
+ appExId: $appExId
1067
+ target: $target
1068
+ files: $files
1069
+ ) {
1070
+ exId
1071
+ status
1072
+ target
1073
+ siteUrl
1074
+ fileCount
1075
+ totalBytes
1076
+ }
1077
+ }
1078
+ `,ex=U`
1079
+ mutation GetStaticSiteUploadUrlsForAgent(
1080
+ $projectExId: String!
1081
+ $appExId: String
1082
+ $staticSiteDeploymentExId: String!
1083
+ $offset: Int
1084
+ $limit: Int
1085
+ $paths: [String]
1086
+ ) {
1087
+ staticSiteUploadUrls(
1088
+ projectExId: $projectExId
1089
+ appExId: $appExId
1090
+ staticSiteDeploymentExId: $staticSiteDeploymentExId
1091
+ offset: $offset
1092
+ limit: $limit
1093
+ paths: $paths
1094
+ ) {
1095
+ items {
1096
+ path
1097
+ objectKey
1098
+ uploadUrl
1099
+ headers
1100
+ expiresAt
1101
+ }
1102
+ nextOffset
1103
+ totalCount
1104
+ }
1105
+ }
1106
+ `,tx=U`
1107
+ mutation CompleteStaticSiteDeploymentForAgent(
1108
+ $projectExId: String!
1109
+ $appExId: String
1110
+ $staticSiteDeploymentExId: String!
1111
+ $dryRun: Boolean
1112
+ ) {
1113
+ completeStaticSiteDeployment(
1114
+ projectExId: $projectExId
1115
+ appExId: $appExId
1116
+ staticSiteDeploymentExId: $staticSiteDeploymentExId
1117
+ dryRun: $dryRun
1118
+ ) {
1119
+ status
1120
+ incomplete
1121
+ missingPaths
1122
+ missingCount
1123
+ siteUrl
1124
+ previousDeploymentExId
1125
+ }
1126
+ }
1127
+ `,rx=U`
1128
+ mutation AbortStaticSiteDeploymentForAgent(
1129
+ $projectExId: String!
1130
+ $appExId: String
1131
+ $staticSiteDeploymentExId: String!
1132
+ ) {
1133
+ abortStaticSiteDeployment(
1134
+ projectExId: $projectExId
1135
+ appExId: $appExId
1136
+ staticSiteDeploymentExId: $staticSiteDeploymentExId
1137
+ ) {
1138
+ exId
1139
+ status
1140
+ target
1141
+ }
1142
+ }
1143
+ `,nx=U`
1144
+ query GetStaticSiteStatusForAgent(
1145
+ $projectExId: String!
1146
+ $appExId: String
1147
+ $target: StaticSiteTarget!
1148
+ ) {
1149
+ inProgressStaticSiteDeployment(
1150
+ projectExId: $projectExId
1151
+ appExId: $appExId
1152
+ target: $target
1153
+ ) {
1154
+ exId
1155
+ status
1156
+ target
1157
+ fileCount
1158
+ totalBytes
1159
+ createdAt
1160
+ manifest {
1161
+ path
1162
+ md5Base64
1163
+ sizeBytes
1164
+ }
1165
+ }
1166
+ activeStaticSiteDeployment(
1167
+ projectExId: $projectExId
1168
+ appExId: $appExId
1169
+ target: $target
1170
+ ) {
1171
+ exId
1172
+ status
1173
+ target
1174
+ siteUrl
1175
+ fileCount
1176
+ totalBytes
1177
+ activatedAt
1178
+ }
1179
+ }
1180
+ `,ix=U`
1181
+ mutation StartAgentSession(
1182
+ $projectExId: String!
1183
+ $client: String!
1184
+ $clientVersion: String!
1185
+ $sessionId: String!
1186
+ $agent: String
1187
+ ) {
1188
+ startAgentSession(
1189
+ projectExId: $projectExId
1190
+ client: $client
1191
+ clientVersion: $clientVersion
1192
+ sessionId: $sessionId
1193
+ agent: $agent
1194
+ )
1195
+ }
1196
+ `,ox=U`
1197
+ mutation SaveSecretForAgent(
1198
+ $projectExId: String!
1199
+ $schemaExId: String!
1200
+ $secretValue: String!
1201
+ ) {
1202
+ saveSecret(
1203
+ projectExId: $projectExId
1204
+ schemaExId: $schemaExId
1205
+ secretValue: $secretValue
1206
+ ) {
1207
+ secretKey
1208
+ }
1209
+ }
1210
+ `,sx=U`
1211
+ mutation CreateWechatSourceCodeDeploymentForAgent(
1212
+ $projectExId: String!
1213
+ $appExId: String
1214
+ $files: [WechatSourceCodeFileInputInput]!
1215
+ ) {
1216
+ createWechatSourceCodeDeployment(
1217
+ projectExId: $projectExId
1218
+ appExId: $appExId
1219
+ files: $files
1220
+ ) {
1221
+ exId
1222
+ status
1223
+ fileCount
1224
+ totalBytes
1225
+ }
1226
+ }
1227
+ `,ax=U`
1228
+ mutation GetWechatSourceCodeUploadUrlsForAgent(
1229
+ $projectExId: String!
1230
+ $appExId: String
1231
+ $wechatSourceCodeDeploymentExId: String!
1232
+ $offset: Int
1233
+ $limit: Int
1234
+ $paths: [String]
1235
+ ) {
1236
+ wechatSourceCodeUploadUrls(
1237
+ projectExId: $projectExId
1238
+ appExId: $appExId
1239
+ wechatSourceCodeDeploymentExId: $wechatSourceCodeDeploymentExId
1240
+ offset: $offset
1241
+ limit: $limit
1242
+ paths: $paths
1243
+ ) {
1244
+ items {
1245
+ path
1246
+ objectKey
1247
+ uploadUrl
1248
+ headers
1249
+ expiresAt
1250
+ }
1251
+ nextOffset
1252
+ totalCount
1253
+ }
1254
+ }
1255
+ `,ux=U`
1256
+ mutation CompleteWechatSourceCodeUploadForAgent(
1257
+ $projectExId: String!
1258
+ $appExId: String
1259
+ $wechatSourceCodeDeploymentExId: String!
1260
+ $dryRun: Boolean
1261
+ ) {
1262
+ completeWechatSourceCodeUpload(
1263
+ projectExId: $projectExId
1264
+ appExId: $appExId
1265
+ wechatSourceCodeDeploymentExId: $wechatSourceCodeDeploymentExId
1266
+ dryRun: $dryRun
1267
+ ) {
1268
+ status
1269
+ incomplete
1270
+ missingPaths
1271
+ missingCount
1272
+ deploymentRecordExId
1273
+ }
1274
+ }
1275
+ `,cx=U`
1276
+ mutation AbortWechatSourceCodeDeploymentForAgent(
1277
+ $projectExId: String!
1278
+ $appExId: String
1279
+ $wechatSourceCodeDeploymentExId: String!
1280
+ ) {
1281
+ abortWechatSourceCodeDeployment(
1282
+ projectExId: $projectExId
1283
+ appExId: $appExId
1284
+ wechatSourceCodeDeploymentExId: $wechatSourceCodeDeploymentExId
1285
+ ) {
1286
+ exId
1287
+ status
1288
+ }
1289
+ }
1290
+ `,lx=U`
1291
+ query GetWechatSourceCodeStatusForAgent(
1292
+ $projectExId: String!
1293
+ $appExId: String
1294
+ ) {
1295
+ inProgressWechatSourceCodeDeployment(
1296
+ projectExId: $projectExId
1297
+ appExId: $appExId
1298
+ ) {
1299
+ exId
1300
+ status
1301
+ fileCount
1302
+ totalBytes
1303
+ createdAt
1304
+ lastUploadUrlIssuedAt
1305
+ manifest {
1306
+ path
1307
+ md5Base64
1308
+ sizeBytes
1309
+ }
1310
+ }
1311
+ buildingWechatSourceCodeDeployment(
1312
+ projectExId: $projectExId
1313
+ appExId: $appExId
1314
+ ) {
1315
+ exId
1316
+ status
1317
+ fileCount
1318
+ totalBytes
1319
+ createdAt
1320
+ buildStartedAt
1321
+ deploymentRecordExId
1322
+ }
1323
+ }
1324
+ `,px=U`
1325
+ query GetWechatSourceCodeDeploymentForAgent(
1326
+ $projectExId: String!
1327
+ $appExId: String
1328
+ $wechatSourceCodeDeploymentExId: String!
1329
+ ) {
1330
+ wechatSourceCodeDeployment(
1331
+ projectExId: $projectExId
1332
+ appExId: $appExId
1333
+ wechatSourceCodeDeploymentExId: $wechatSourceCodeDeploymentExId
1334
+ ) {
1335
+ exId
1336
+ status
1337
+ fileCount
1338
+ totalBytes
1339
+ createdAt
1340
+ buildStartedAt
1341
+ deploymentRecordExId
1342
+ }
1343
+ }
1344
+ `,dx=U`
1345
+ query GetWechatTrialVersionForAgent($projectExId: String!) {
1346
+ project(projectExId: $projectExId) {
1347
+ exId
1348
+ wechatMiniAppPreviewVersion
1349
+ wechatMiniAppPreviewTime
1350
+ wechatMiniAppQRCodeBase64
1351
+ }
1352
+ }
1353
+ `,fx=U`
1354
+ query GetWechatTrialVersionMetaForAgent($projectExId: String!) {
1355
+ project(projectExId: $projectExId) {
1356
+ exId
1357
+ wechatMiniAppPreviewVersion
1358
+ wechatMiniAppPreviewTime
1359
+ }
1360
+ }
1361
+ `,hx=U`
1362
+ query SupportServicePipelineStatusForAgent($projectExId: String!) {
1363
+ project(projectExId: $projectExId) {
1364
+ lastAllPipelinePlatformStatus {
1365
+ buildTarget
1366
+ status
1367
+ startedAt
1368
+ }
1369
+ }
1370
+ }
1371
+ `,mx=U`
1372
+ query DeployedServerSchemaForAgent($projectExId: String!) {
1373
+ project(projectExId: $projectExId) {
1374
+ exId
1375
+ lastDeployedServerSchema
1376
+ }
1377
+ }
1378
+ `,gx=U`
1379
+ query AgentFileSnapshot(
1380
+ $projectExId: String!
1381
+ $appExId: String
1382
+ $readState: String
1383
+ ) {
1384
+ agentFileSnapshot(
1385
+ projectExId: $projectExId
1386
+ appExId: $appExId
1387
+ readState: $readState
1388
+ ) {
1389
+ text
1390
+ readState
1391
+ }
1392
+ }
1393
+ `,yx=U`
1394
+ mutation RunAgentFileTool(
1395
+ $projectExId: String!
1396
+ $appExId: String
1397
+ $tool: AgentFileTool!
1398
+ $args: Json
1399
+ $readState: String
1400
+ ) {
1401
+ runAgentFileTool(
1402
+ projectExId: $projectExId
1403
+ appExId: $appExId
1404
+ tool: $tool
1405
+ args: $args
1406
+ readState: $readState
1407
+ ) {
1408
+ output
1409
+ readState
1410
+ }
1411
+ }
1412
+ `,vx=U`
1413
+ query ApiConfigFromCurlForAgent($projectExId: String!, $curl: String!) {
1414
+ apiConfigFromCurlV2(projectExId: $projectExId, curl: $curl) {
1415
+ api
1416
+ typeDefinitions
1417
+ ignoredOptions
1418
+ }
1419
+ }
1420
+ `;p();var Ex=U`
1421
+ query FetchLogsByPaginator(
1422
+ $queryCreation: QueryCreationInputType
1423
+ $paginator: PaginatorType
1424
+ ) {
1425
+ fetchLogsByPaginator(queryCreation: $queryCreation, paginator: $paginator) {
1426
+ edges {
1427
+ node {
1428
+ content
1429
+ createdAt
1430
+ eventId
1431
+ level
1432
+ type
1433
+ }
1434
+ }
1435
+ }
1436
+ }
1437
+ `;p();var xl=Qe(An(),1);import{randomUUID as l4}from"crypto";p();p();p();function Ct(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function xn(e){return Ct(e)==="object"}function RY(e){return Array.isArray(e)&&e.length>0&&e.every(t=>"message"in t)}function Pg(e,t){return e.length<124?e:t}var _x="graphql-transport-ws";var qt=(e=>(e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",e))(qt||{}),Ut=(e=>(e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete",e))(Ut||{});function Sx(e){if(!xn(e))throw new Error(`Message is expected to be an object, but got ${Ct(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${Ct(e.type)}`);switch(e.type){case"connection_init":case"connection_ack":case"ping":case"pong":{if(e.payload!=null&&!xn(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case"subscribe":{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${Ct(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!xn(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${Ct(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${Ct(e.payload.query)}`);if(e.payload.variables!=null&&!xn(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${Ct(e.payload.variables)}`);if(e.payload.operationName!=null&&Ct(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${Ct(e.payload.operationName)}`);if(e.payload.extensions!=null&&!xn(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${Ct(e.payload.extensions)}`);break}case"next":{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${Ct(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!xn(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${Ct(e.payload)}`);break}case"error":{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${Ct(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!RY(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case"complete":{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${Ct(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function bx(e,t){return Sx(typeof e=="string"?JSON.parse(e,t):e)}function vo(e,t){return Sx(e),JSON.stringify(e,t)}function Dg(e){let{url:t,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:o=0,keepAlive:s=0,disablePong:a,connectionAckWaitTimeout:u=0,retryAttempts:c=5,retryWait:l=async function(le){let ee=Math.pow(2,le);await new Promise(fe=>setTimeout(fe,ee*1e3+Math.floor(Math.random()*2700+300)))},shouldRetry:d=Ng,on:f,webSocketImpl:h,generateID:g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,le=>{let ee=Math.random()*16|0;return(le=="x"?ee:ee&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:_}=e,b;if(h){if(!NY(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=b,I=(()=>{let B=(()=>{let ee={};return{on(fe,Me){return ee[fe]=Me,()=>{delete ee[fe]}},emit(fe){"id"in fe&&ee[fe.id]?.(fe)}}})(),le={connecting:f?.connecting?[f.connecting]:[],opened:f?.opened?[f.opened]:[],connected:f?.connected?[f.connected]:[],ping:f?.ping?[f.ping]:[],pong:f?.pong?[f.pong]:[],message:f?.message?[B.emit,f.message]:[B.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:B.on,on(ee,fe){let Me=le[ee];return Me.push(fe),()=>{let Fe=Me.indexOf(fe);Fe>-1&&Me.splice(Fe,1)}},emit(ee,...fe){for(let Me of[...le[ee]])Me(...fe)}}})();function O(B){let le=[I.on("error",ee=>{le.forEach(fe=>fe()),B(ee)}),I.on("closed",ee=>{le.forEach(fe=>fe()),B(ee)})];return()=>le.forEach(ee=>ee())}let T,C=0,L,w=!1,W=0,ae=!1;async function de(){clearTimeout(L);let[B,le]=await(T??(T=new Promise((Me,Fe)=>(async()=>{if(w){if(await l(W),!C)return T=void 0,Fe({code:1e3,reason:"All Subscriptions Gone"});W++}I.emit("connecting",w);let ue=new S(typeof t=="function"?await t():t,_x),$t,Lr;function kr(){isFinite(s)&&s>0&&(clearTimeout(Lr),Lr=setTimeout(()=>{ue.readyState===S.OPEN&&(ue.send(vo({type:Ut.Ping})),I.emit("ping",!1,void 0))},s))}O(tt=>{T=void 0,clearTimeout($t),clearTimeout(Lr),Fe(tt),tt instanceof ca&&(ue.close(4499,"Terminated"),ue.onerror=null,ue.onclose=null)}),ue.onerror=tt=>I.emit("error",tt),ue.onclose=tt=>I.emit("closed",tt),ue.onopen=async()=>{try{I.emit("opened",ue);let tt=typeof r=="function"?await r():r;if(ue.readyState!==S.OPEN)return;ue.send(vo(tt?{type:Ut.ConnectionInit,payload:tt}:{type:Ut.ConnectionInit},y)),isFinite(u)&&u>0&&($t=setTimeout(()=>{ue.close(qt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),kr()}catch(tt){I.emit("error",tt),ue.close(qt.InternalClientError,Pg(tt instanceof Error?tt.message:String(tt),"Internal client error"))}};let Bt=!1;ue.onmessage=({data:tt})=>{try{let qe=bx(tt,_);if(I.emit("message",qe),qe.type==="ping"||qe.type==="pong"){I.emit(qe.type,!0,qe.payload),qe.type==="pong"?kr():a||(ue.send(vo(qe.payload?{type:Ut.Pong,payload:qe.payload}:{type:Ut.Pong},y)),I.emit("pong",!1,qe.payload));return}if(Bt)return;if(qe.type!==Ut.ConnectionAck)throw new Error(`First message cannot be of type ${qe.type}`);clearTimeout($t),Bt=!0,I.emit("connected",ue,qe.payload,w),w=!1,W=0;let Ko=new Promise((Op,Ba)=>O(Ba));Ko.catch(()=>{}),Me([ue,Ko])}catch(qe){ue.onmessage=null,I.emit("error",qe),ue.close(qt.BadResponse,Pg(qe instanceof Error?qe.message:String(qe),"Bad response"))}}})())));B.readyState===S.CLOSING&&await le;let ee=()=>{},fe=new Promise(Me=>ee=Me);return[B,ee,new Promise((Me,Fe)=>{let ue=O(Fe);B.readyState!==S.OPEN&&le.catch(Fe),fe.then(()=>{if(ue(),!C){let $t=()=>B.close(1e3,"Normal Closure");isFinite(o)&&o>0?(clearTimeout(L),L=setTimeout(()=>{!C&&B.readyState===S.OPEN&&$t()},o)):$t()}Me()})})]}function A(B){if(Ng(B)&&(PY(B.code)||[qt.InternalServerError,qt.InternalClientError,qt.BadRequest,qt.BadResponse,qt.Unauthorized,qt.SubprotocolNotAcceptable,qt.SubscriberAlreadyExists,qt.TooManyInitialisationRequests].includes(B.code)))throw B;if(ae)return!1;if(Ng(B)&&B.code===1e3)return C>0;if(!c||W>=c||!d(B))throw B;return w=!0}n||(async()=>{for(C++;;)try{let[,,B]=await de();await B}catch(B){try{if(!A(B))return}catch(le){return i?.(le)}}})();function re(B,le){let ee=g(B),fe=!1,Me=!1,Fe=()=>{C--,fe=!0};return(async()=>{for(C++;;)try{let[ue,$t,Lr]=await de();if(fe)return Lr.catch(()=>{}),$t();let kr=I.onMessage(ee,Bt=>{switch(Bt.type){case Ut.Next:{le.next(Bt.payload);return}case Ut.Error:{Me=!0,fe=!0,le.error(Bt.payload),Fe();return}case Ut.Complete:{fe=!0,Fe();return}}});ue.send(vo({id:ee,type:Ut.Subscribe,payload:B},y)),Fe=()=>{!fe&&ue.readyState===S.OPEN&&ue.send(vo({id:ee,type:Ut.Complete},y)),C--,fe=!0,$t()},await Lr.finally(kr);return}catch(ue){if(!A(ue))return}})().then(()=>{Me||le.complete()}).catch(ue=>{le.error(ue)}),()=>{fe||Fe()}}return{on:I.on,subscribe:re,iterate(B){let le=[],ee={done:!1,error:null,resolve:()=>{}},fe=re(B,{next(Fe){le.push(Fe),ee.resolve()},error(Fe){ee.done=!0,ee.error=Fe,ee.resolve()},complete(){ee.done=!0,ee.resolve()}}),Me=(async function*(){for(;;){for(le.length||await new Promise(ue=>ee.resolve=ue);le.length;)yield le.shift();if(ee.error)throw ee.error;if(ee.done)return}})();return Me.throw=async Fe=>(ee.done||(ee.done=!0,ee.error=Fe,ee.resolve()),{done:!0,value:void 0}),Me.return=async()=>(fe(),{done:!0,value:void 0}),Me},async dispose(){if(ae=!0,clearTimeout(L),T){let[B]=await T;B.close(1e3,"Normal Closure")}},terminate(){T&&I.emit("closed",new ca)}}}var ca=class extends Error{name="TerminatedCloseEvent";message="4499: Terminated";code=4499;reason="Terminated";wasClean=!1};function Ng(e){return xn(e)&&"code"in e&&"reason"in e}function PY(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function NY(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}p();var Z2=Qe(yC(),1),e4=Qe(gl(),1),t4=Qe(So(),1),r4=Qe(Bg(),1),n4=Qe(Qg(),1),i4=Qe(Zg(),1),OC=Qe(_l(),1),o4=Qe(wC(),1);var ty=OC.default;p();var AC=100*1024*1024,Tl=class{current=Promise.resolve();async run(t){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await t()}finally{n()}}},ry=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download CRDT model: ${t.status} ${t.statusText}`);let r=t.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:a,value:u}=await r.read();if(a)break;if(i+=u.length,i>AC)throw new Error(`CRDT model is larger than ${AC} bytes`);n.push(u)}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.length;return o},ya=async(e,t)=>{try{return await t()}catch(r){return P.warn(`Optional runtime package unavailable: ${e}`,r.message),null}},xC=null,Rt=async()=>(xC??=ya("@functorz/ztype",()=>import("./ztype-4WFGZNIN.js")).then(e=>(e?.default??e)?.com?.functorz?.ztype??null),xC),CC=null,DC=async()=>(CC??=ya("@functorz/ztype",()=>import("./ztype-4WFGZNIN.js")).then(e=>(e?.default??e)?.kotlin?.collections??null),CC),RC=null,LC=async()=>(RC??=Rt().then(e=>e?.typesystem?.schema?.SCHEMA_VERSION??null),RC),PC=null,va=async()=>(PC??=ya("@functorz/crdt-helper",()=>import("./index.cjs-CETVDSNT.js")).then(e=>e?.Crdt??e?.default?.Crdt??null),PC),NC=null,ny=async()=>(NC??=ya("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-YS6JVLNT.js")).then(e=>e??ya("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-UM4HQDFS.js"))).then(e=>e?.Patch??e?.default?.Patch??null),NC),iy=e=>e?.lastUploadedSchema??null,oy=e=>{if(!e)return null;let t=e.activeCommit;return t?{commitExId:t.commitExId,crdtModelUrl:t.crdtModelUrl,crdtPatches:t.crdtPatches??null}:{commitExId:null,crdtModelUrl:e.crdtModelUrl,crdtPatches:e.crdtPatches??null}},kC=e=>[e?.project?.lastDeployedServerSchemaExId,e?.lastDeployedServerSchemaExId,e?.project?.latestDeployedServerSchema?.exId,e?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,jC=e=>e==null?e:structuredClone(e),sy=(e,t)=>e?.appExId?e.appExId:t?.name??"",ay=(e,t)=>{let r=e?.typesystem?.schema?.ClientType;if(r)return t==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:t==="MOBILE"?r.MOBILE??r.WEB:r.WEB},Ao=e=>{let t=e?.typesystem?.schema?.Product?.[Fn];if(!t)throw new Error(`ztype runtime has no Product enum member for ${Fn}`);return t},MC=e=>{let t=e?.typesystem?.schema?.Locale?.["ZH"];if(!t)throw new Error(`ztype runtime has no Locale enum member for ${"ZH"}`);return t},s4=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return String(e)}},Il=e=>({componentId:e?.componentId??null,message:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("EN"):e?.message??String(e),zhMessage:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("ZH"):void 0,platform:e?.platform??null,isBackendError:!!e?.isBackendError,fullPath:s4(e?.fullPath??[])}),wl=e=>e.stableErrors.filter(t=>!!t.isBackendError),FC=e=>wl(e).length,qC=(e,t)=>{if(t.__typename==="DiffItem"){let r=t.pathComponents?.at(-1)?.key??"";if(t.operation==="delete"){delete e[r];return}e[r]=structuredClone(t.newValue);return}if(t.__typename==="ArrayDiffItem"){let r=t.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(e)||r<0)throw new Error("Invalid array diff target");if(t.operation==="delete"){e.splice(r,1);return}if(t.operation==="insert"){e.splice(r,0,structuredClone(t.newValue));return}e[r]=structuredClone(t.newValue)}};p();var UC=Qe(as(),1);import{createRequire as a4}from"module";var u4=a4(import.meta.url);var Ol=e=>{if(nn){if(e==="@functorz/ztype")return nn.ztype;if(e==="@functorz/crdt-helper")return nn.crdtHelper;if(e==="json-joy")return nn.jsonJoy}try{let t=u4(`${e}/package.json`);return t.ztypeBuild??t.version??"unknown"}catch{return"unavailable"}},c4=async()=>{if(nn)return{ztypeVersion:nn.ztype,ztypeSchemaVersion:nn.ztypeSchemaVersion};try{let e=await Rt();return{ztypeVersion:Ol("@functorz/ztype"),ztypeSchemaVersion:e?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:Ol("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function uy(){let e=Yv(),t=await c4();return{agentVersion:e.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:t.ztypeVersion,ztypeSchemaVersion:t.ztypeSchemaVersion,crdtHelperVersion:Ol("@functorz/crdt-helper"),jsonJoyVersion:Ol("json-joy")}}async function xo(e,t){let[r,n,i]=await Promise.all([uy(),Pr(e),e.loadCredentials()]),o=i?UC.default.decode(i.access_token):null,s=typeof o=="object"&&o!==null?String(o.sub??o.exId??o.id??"authenticated"):"anonymous";return{...r,product:X,apiBaseUrl:n.apiBaseUrl,authUserId:s,workspaceRoot:e.getWorkspaceRoot(),startupFlags:[...t].sort()}}function VC(e,t){return JSON.stringify(e)===JSON.stringify(t)}p();var mi=async(e,t)=>{let n=(await e.request(al,{projectExId:t,appExId:null})).fetchAppDetailByExId;return((n?.__typename==="Project"?n.appList:null)??[]).filter(o=>o.appExId!=null)},Co=e=>e.length===1?e[0].appExId:null;var cy=l4(),GC=`${X}/${jr()}`,p4=e=>{if(!e)return e;if(Array.isArray(e))return e.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof e=="object"&&"forEach"in e&&typeof e.forEach=="function"){let r={};return e.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let t={};for(let[r,n]of Object.entries(e))t[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return t},Cl=(e,t)=>{let r=e?.response?.errors;return Array.isArray(r)&&r.some(n=>n?.errorType===t)};function ly(e){if(!Array.isArray(e)||e.length===0)return null;let t=e.map(r=>{let n=r,i=typeof n.operation=="string"?n.operation:null,o=typeof n.errorType=="string"?n.errorType:typeof n.extensions?.classification=="string"?n.extensions.classification:null,s=typeof n.message=="string"?n.message:null;return!s&&!i&&!o?null:`${i?`${i}: `:""}${s??"GraphQL error"}${o?` (${o})`:""}`}).filter(r=>!!r);return t.length>0?t.join("; "):null}var d4=e=>{if(typeof e=="string")return e;if(e instanceof Uint8Array)return Buffer.from(e).toString("utf8");try{return String(e)}catch{return"<unserializable body>"}},f4=new Set(["ECONNRESET","EPIPE","UND_ERR_SOCKET"]),h4="UND_ERR_CONNECT_TIMEOUT",m4=(e,t)=>{let r=e?.cause?.code;return r===h4?!0:typeof r=="string"&&f4.has(r)&&g4(t)},g4=e=>{if(typeof e!="string")return!1;try{let{query:t,operationName:r}=JSON.parse(e);return typeof t!="string"?!1:(0,xl.getOperationAST)((0,xl.parse)(t),typeof r=="string"?r:void 0)?.operation==="query"}catch{return!1}},Ro=async(e,t)=>{let r=xp();P.debug(`[HTTP] Request URL: ${e.toString()}`),t?.headers&&P.debug(`[HTTP] Request Headers: ${JSON.stringify(p4(t.headers))}`),r&&t?.body!=null&&P.debug(`[GQL] Request Body: ${d4(t.body)}`);let n=await fetch(e,t).catch(o=>{if(!m4(o,t?.body))throw o;return P.info(`[HTTP] ${String(o.cause)}; resending the request to ${e.toString()}`),fetch(e,t)}),i=null;try{i=await n.clone().text()}catch(o){P.debug(`[GQL] Response read failed: ${String(o)}`)}if(r&&P.debug(`[GQL] Response ${n.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let o=null;try{o=JSON.parse(i).errors}catch{o=null}let s=ly(o);s&&P.warn(`[GQL] ${n.status} errors: ${s}`)}return n};async function py(e,t){let r=await Pr(t),n={"User-Locale":"en_US","X-SESSION-ID":cy,"X-Client":GC},i=await LC();return i&&(n["X-ZED-VERSION"]=i),process.env.REACT_APP_VERSION&&(n["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new at(`${r.apiBaseUrl}/api/graphql`,{headers:n,fetch:Ro,requestMiddleware:async o=>{let s=new Headers(o.headers);return s.set("Authorization",`Bearer ${await e.getValidToken()}`),{...o,headers:s}}})}var y4=3e3,v4=3e4,E4=e=>new Promise(t=>setTimeout(t,Math.min(y4*2**e,v4)*(.5+Math.random()/2))),Al=class extends ty{constructor(...t){super(...t),this.on("error",r=>P.debug(`[SUB] socket error: ${r.message}`))}},_4=3e4;function S4(e,t){let r,n=()=>{clearTimeout(r),r=void 0},i=()=>{n(),r=setTimeout(()=>{r=void 0,P.debug("[SUB] no frame from the backend, reconnecting"),e.terminate()},t)},o=[e.on("connected",i),e.on("message",i),e.on("closed",n)];return()=>{n(),o.forEach(s=>s())}}async function $C(e,t,{silenceTimeoutMs:r=_4}={}){let i=`${(await Pr(t)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(o,s,a)=>{let u=xp(),c={"X-SESSION-ID":cy,"X-Client":GC};P.debug(`[SUB] connecting ${i} params=${JSON.stringify(c)}`);let l=Dg({url:i,webSocketImpl:ty,lazy:!0,retryAttempts:1/0,shouldRetry:()=>!0,retryWait:E4,connectionParams:async()=>({...c,authToken:await e.getValidToken()}),on:{connected:(g,y,_)=>P.debug(_?"[SUB] reconnected":"[SUB] connected"),closed:()=>P.debug("[SUB] disconnected"),error:g=>P.debug(`[SUB] error ${g?.message??String(g)}`)}}),d=S4(l,r),h=[{name:"onNewCrdtPatchV2",query:F0,variables:{projectExId:o.projectExId,appExId:o.appExId??null,versionExId:o.appVersionExId??null,latestPatchExIdInClient:s}},{name:"onSchemaUploadV3",query:q0,variables:{projectExId:o.projectExId,appExId:o.appExId??null,appVersionExId:o.appVersionExId??null}}].map(g=>(P.debug(`[SUB] subscribe ${g.name} vars=${JSON.stringify(g.variables)}`),l.subscribe({query:g.query,variables:g.variables},{next:y=>{u&&P.debug(`[SUB] ${g.name} event: ${JSON.stringify(y)}`),a()},error:y=>{P.warn("Schema subscription event failed",String(y)),a()},complete:()=>{}})));return{unsubscribe(){d();for(let g of h)g();Promise.resolve(l.dispose()).catch(g=>P.debug(`[SUB] dispose failed: ${g.message}`))}}}}async function BC(e,t,r){let n=await e.loadProjectContext();if(t.projectExId)return n?.projectExId!==t.projectExId&&await e.saveProjectContext(t.projectExId,r?Co(await mi(r,t.projectExId)):null),t.projectExId;if(!n?.projectExId)throw new Error("No projectExId provided and no current project is set");return n.projectExId}async function dy(e,t,r,n){try{await e.request(ix,{projectExId:t,client:X,clientVersion:jr(),sessionId:n??cy,agent:r??null}),P.debug(`[agent-session] started for project ${t}`)}catch(i){P.debug(`[agent-session] skipped: ${String(i)}`)}}p();p();p();import{createHash as b4}from"crypto";var T4=e=>!!(e&&typeof e=="object"&&!Array.isArray(e)),fy=e=>{if(Array.isArray(e))return e.map(r=>r===void 0?null:fy(r));if(!T4(e))return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=fy(n))}return t},I4=e=>JSON.stringify(fy(e)),w4=e=>b4("sha256").update(I4(e)).digest("hex"),HC=e=>({projectExId:e.projectExId,appExId:e.appExId??null,appVersionExId:e.appVersionExId??null,schemaExId:e.schemaExId??null,lastPatchExId:e.lastPatchExId??null,snapshotHash:w4(e.snapshot),deployedSchemaExId:e.deployedSchemaExId??null,checkedAt:e.checkedAt??new Date().toISOString()}),KC=(e,t)=>!e||!t?e!==t:e.schemaExId!==t.schemaExId||e.lastPatchExId!==t.lastPatchExId||e.snapshotHash!==t.snapshotHash||e.deployedSchemaExId!==t.deployedSchemaExId,Rl=e=>e.changes.length>0;var QC=null,O4=()=>(QC??=Rt().then(e=>{let t=e?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof t=="function"?t:null}),QC),A4=async(e,t)=>{let r=await O4();return r?r(e,t):{changes:[]}},hy=(e,t)=>A4(JSON.stringify(e),JSON.stringify(t));p();var my=null,Pl=e=>(my??=e.request(k0).then(t=>(t.__type?.fields??[]).some(r=>r.name==="activeCommit")).catch(t=>{throw my=null,t}),my),Po=async(e,t)=>await Pl(e)?t:t.replace(Cg,"").replace(/^[ \t]*\.\.\.ActiveCommit\n/gm,"");p();var x4="Functorz";function WC(e,t,r,n){let i=e?.typesystem?.settings,o=e?.typesystem?.schema,s=t?.KtList,a=t?.KtMap;if(!i?.ExtraContext||!o?.CustomChatModelDescriptor||!o?.AIModelDescriptors||!s||!a)return P.warn("ztype ExtraContext symbols missing; schema graph will be built without custom models"),null;try{let{ExtraContext:u}=i,{AIModelDescriptors:c,CustomChatModelDescriptor:l,CustomEmbeddingModelDescriptor:d,ModelCustomParamDescriptor:f,CustomModelParam:h,CustomChatCompletionFeatures:g,Identifier:y,MediaOutputCardinality:_}=o,b=w=>a.fromJsMap(new Map(Object.entries(w??{}))),S=w=>typeof w=="string"?w==="single"?_.SINGLE:w==="multiple"?_.MULTIPLE:_.NONE:typeof w=="boolean"&&w?_.MULTIPLE:_.NONE,I=w=>new f(w.name,b(w.displayName),w.type,b(w.description)),O=w=>new h(I(w.serverUrl),I(w.apiToken),s.fromJsArray((w.extensionParams??[]).map(W=>new f(W.name,b(W.displayName),W.type,b(W.displayName))))),T=w=>w.provider===x4&&w.customModelIdentifier?new y(w.customModelIdentifier.id,w.customModelIdentifier.namespace):null,C=(r?.chatModelDescriptors??[]).map(w=>new l(w.provider,w.name,O(w.paramToConfigure),w.delisted,new g(w.features.streamResponse,w.features.multiModal,w.features.imageInput??!1,!1,w.features.videoInput??!1,w.features.imageMessageInput??!1,!1,w.features.videoMessageInput??!1,w.features.tools,w.features.reasoningContent,w.features.imageOutput,w.features.videoOutput,S(w.features.imageOutput),S(w.features.videoOutput),null,w.features.structuredOutput),T(w))),L=(r?.embeddingModelDescriptors??[]).map(w=>new d(w.provider,w.name,O(w.paramToConfigure),T(w),w.delisted));return new u(new c(s.fromJsArray(C),s.fromJsArray(L)),a.fromJsMap(new Map),n)}catch(u){return P.warn("ztype ExtraContext construction failed; schema graph will be built without custom models",u.message),null}}p();var Pn=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};p();function Nl(e,t,r,n=null){let i=ay(e,r?.appType);return e.api.ZTypeCoreApi.genZTypeApiContext(t,Ao(e),i,sy(r,i),MC(e),n)}function zC(e,t){return sy(t,ay(e,t?.appType))}p();var Nn=e=>e==null,gy=(e,t)=>{if(Nn(e)&&Nn(t)||e===t)return!0;if(Nn(e)||Nn(t)||typeof e!="object"||typeof t!="object")return!1;let r=e,n=t,i=new Set([...Object.keys(r),...Object.keys(n)]);for(let o of i)if(!gy(r[o],n[o]))return!1;return!0};var yy=e=>{let t=new Set;for(let r of e)if(t.add(r.pathComponents.map(n=>n.index!==void 0?`[${n.index}]`:`.${n.key}`).join("").replace(/^\./,"")),t.size>=20)break;return[...t]},JC=e=>{if(e.__typename==="DiffItem")switch(e.operation){case"add":return{__typename:"DiffItem",oldValue:e.newValue,newValue:null,operation:"delete",pathComponents:e.pathComponents};case"delete":return{__typename:"DiffItem",oldValue:null,newValue:e.oldValue,operation:"add",pathComponents:e.pathComponents};case"update":return{__typename:"DiffItem",oldValue:e.newValue,newValue:e.oldValue,operation:"update",pathComponents:e.pathComponents}}else switch(e.operation){case"insert":return{__typename:"ArrayDiffItem",oldValue:e.newValue,newValue:null,previousValue:e.previousValue,nextValue:e.nextValue,operation:"delete",pathComponents:e.pathComponents};case"delete":return{__typename:"ArrayDiffItem",oldValue:null,newValue:e.oldValue,previousValue:e.previousValue,nextValue:e.nextValue,operation:"insert",pathComponents:e.pathComponents};case"update":return{__typename:"ArrayDiffItem",oldValue:e.newValue,newValue:e.oldValue,operation:"update",pathComponents:e.pathComponents}}throw new Error(`Cannot reverse diff item: ${JSON.stringify(e)}`)},C4=e=>e.key??e.index??"",R4=(e,t)=>{let r=e;for(let n of t){if(r===null||typeof r!="object")return;r=r[n]}return r},P4=(e,t)=>{if(t.__typename!=="DiffItem")return null;let r=t.pathComponents.at(-1)?.key;if(r===void 0)return null;let n=gy(e[r],t.oldValue);switch(t.operation){case"add":e[r]=t.newValue;break;case"update":if(!n)return null;e[r]=t.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(e,r)||!n)return null;delete e[r];break;default:return null}return t},N4=(e,t)=>{if(t.__typename!=="ArrayDiffItem")return null;let r=t.pathComponents.at(-1)?.index;if(r===void 0||r>e.length)return null;let n=()=>gy(e[r],t.oldValue);switch(t.operation){case"insert":e.splice(r,0,t.newValue);break;case"delete":if(!n())return null;e.splice(r,1);break;case"update":if(!n())return null;e.splice(r,1,t.newValue);break;default:return null}return t},YC=(e,t)=>{let r=e,n=new WeakSet,i=s=>{if(r===null||typeof r!="object")return r;n.has(r)||(r=Array.isArray(r)?[...r]:{...r},n.add(r));let a=r;for(let u of s){let c=a[u];if(c!==null&&typeof c=="object"){if(!n.has(c)){let l=Array.isArray(c)?[...c]:{...c};n.add(l),a[u]=l}a=a[u]}else a=c}return a},o=[];for(let s of t)try{let u=s.pathComponents.map(C4).slice(0,-1);if(Nn(R4(r,u)))continue;let c=i(u);if(Array.isArray(c)){let l=N4(c,s);l&&o.push(l)}else if(c!==null&&typeof c=="object"){let l=P4(c,s);l&&o.push(l)}}catch{continue}return o};p();var D4=3e4,Dl=class{constructor(t){this.options=t}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(t=>{this.subscriptionHandle=t}).catch(t=>{P.warn("Schema subscription failed; falling back to polling",t.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},D4),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};p();var XC=(e,t)=>{let r=new WeakMap,n=s=>{let a=r.get(s);return a||(a=Array.isArray(s)?[...s]:{...s},r.set(s,a)),a},i=new WeakMap,o=n(e);for(let s of t){let a=(s?.pathComponents??[]).slice(0,-1),u=e,c=o;for(let l of a){let d=l.key??l.index??"",f=u[d];if(f===null||typeof f!="object")break;if(Array.isArray(f)){let h=i.get(f);h||(h=structuredClone(f),i.set(f,h)),c[d]=h;break}c[d]=n(f),u=f,c=c[d]}}return o};p();p();var k4=new Set(["WEB","WECHAT_MINI_PROGRAM","MOBILE"]),No=e=>k4.has(e?.appType??""),eR=(e,t)=>{if(!t)return e;let r=t.model.view();return{...e,server:r?.server??null}},Ll=e=>e?.pathComponents?.[0]?.key==="server",tR=e=>e?.pathComponents?.[0]?.key==="clients",rR=e=>e?.appType==="BACKEND_ONLY",ZC=e=>typeof e=="string"&&e.length>0?e:null,vy=(e,t)=>{let r=e.serverDoc;if(r){let i=ZC(r.schemaExId);return i?{ok:!0,appExId:null,schemaExId:i}:{ok:!1,error:"the backend app document has no schemaExId"}}if(e.serverDocRequired===!0)return{ok:!1,error:"this client app's server lives in the backend app's document, which did not load, so there is nothing to sync; retry, or run project sync-backend without appExId"};let n=ZC(e.schemaExId);return n?{ok:!0,appExId:t,schemaExId:n}:{ok:!1,error:"the session has no schemaExId"}};p();var Ey=null,nR=async e=>(Ey??=e.request(j0).then(t=>(t.__type?.inputFields??[]).some(r=>r.name==="origin")).catch(()=>(Ey=null,!1)),await Ey?{origin:"MCP"}:{});p();function iR(e,t){let r=new Set;for(let n of e){let i=n&&typeof n=="object"?n.name:void 0;if(typeof i!="string")continue;let o=oE[i];o!==void 0&&!t.includes(o)&&r.add(i)}return[...r]}function oR(e){return`${e.join(", ")} ${e.length===1?"is":"are"} not available to this project yet: the feature is still being rolled out and has not been opened to this account or project. Nothing was applied. Do not retry or work around it; tell the user it is not available to them yet.`}var _y=300*1e3,j4=100,M4=50,F4="SCHEMA_COMMIT_VERSIONING",q4=["dataModel","types"];function U4(e){let t=e.server;if(!t||typeof t!="object"||Array.isArray(t))return e;let r={};for(let i of q4){let o=t[i];o!==void 0&&(r[i]=o)}let n={};return e.version!==void 0&&(n.version=e.version),n.server=r,n}function V4(e){if(typeof e!="string")return e;let t=e.trim();if(!/^[[{]|^(true|false|null|-?\d)/.test(t))return e;try{return JSON.parse(t)}catch{return e}}function uR(e){if(typeof e!="string")return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;let r={};for(let[n,i]of Object.entries(t))r[n]=V4(i);return r}function G4(e){let t=new Set;return e.map(r=>{if(!r||typeof r!="object")return r;let n=r,i=typeof n.toolCallId=="string"&&n.toolCallId?n.toolCallId:null;if(i!==null&&t.has(i))throw new Error(`Duplicate toolCallId: ${i}`);let o=i??gi();return t.add(o),i===o?n:{...n,toolCallId:o}})}function $4(e,t){if(!e)return;let r=new Map(Object.entries(e)),n=t.map((i,o)=>{if(!r.has(i))throw new Error(`Missing ztype response for tool call ${o}`);let s=r.get(i);return r.delete(i),s});if(r.size>0)throw new Error(`Unexpected ztype responses: ${[...r.keys()].join(", ")}`);return n}function B4(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?Object.values(t).find(n=>typeof n=="string")??t:t):[]}function H4(e){let t=e??{},r=t.data??{},n={},i=uR(r.responseByToolCallId??t.responseByToolCallId);i&&Object.keys(i).length>0&&(n.responses=i);let o=r.schemaDiff??t.schemaDiff;o&&(n.schemaDiff=o);let s=B4(t.errors??r.errors);return s.length>0&&(n.errors=s),n}function K4(e,t){let n=(e??{}).data?.noticesByToolCallId;if(!n)return;let i=t.map(o=>n[o]??null);return i.some(o=>o!==null)?i:void 0}function Q4(e){let t=e??{},r=t.data?.updatedReadState;if(r!=null)return r;if(typeof t.updatedReadStateJson=="string")try{return JSON.parse(t.updatedReadStateJson)}catch{return}}function W4(e){return(e??{}).data?.touchesComponents===!0}function z4(e,t){let r=e??{};if(r.isSuccess!==!1)return{};let n={},i=uR(r.readResponseByToolCallId);if(i&&(n.readResponses=t.map(o=>i[o]??null)),typeof r.readFailureByToolCallIdJson=="string"){let o=JSON.parse(r.readFailureByToolCallIdJson);n.readErrors=t.map(s=>o[s]??null)}return n}function J4(e,t){let r=e??{};if(r.isSuccess!==!1)return{};let n={},i=typeof r.failedToolCallId=="string"?t.indexOf(r.failedToolCallId):-1;i>=0&&(n.failedIndex=i),typeof r.errorCode=="string"&&(n.errorCode=r.errorCode),r.failedBeforeExecution===!0&&(n.failedBeforeExecution=!0);let o=Array.isArray(r.detailKeys)?r.detailKeys:[],s=Array.isArray(r.detailValues)?r.detailValues:[];if(o.length>0&&o.length===s.length){let a={};o.forEach((u,c)=>{typeof u=="string"&&typeof s[c]=="string"&&(a[u]=s[c])}),Object.keys(a).length>0&&(n.errorDetails=a)}return n}async function Y4(e){let r=(await Rt())?.application?.schemaops?.SchemaOpsErrorCode?.DEPENDENCY_CONFLICT?.name,i=(e.diagnostics?.stableErrors??[]).map(o=>{let s=o??{};return[s.componentId,s.message].filter(a=>typeof a=="string"&&a!=="").join(": ")}).filter(o=>o!=="");return{applied:{applied:!1,reason:"ztype validation interrupted the batch"},errors:i.length>0?i:[e.message],...typeof r=="string"?{errorCode:r}:{},errorDetails:{dependents:i.join("; ")},ztypeDiagnostics:e.diagnostics}}function X4(e){return e?e.available===!1||(e.stableErrors?.length??0)>0||(e.betaErrors?.length??0)>0:!1}var sR=e=>e.activeCommit?.commitExId??null,aR=e=>e.filter(t=>!!t?.exId).at(-1)?.exId??null,Ea=class e{constructor(t,r,n,i){this.client=t;this.sessionKey=r;this.onSchemaEvent=i;this.key=e.stringifyKey(r),this.watcher=new Dl({sessionKey:r,subscriptionFactory:n,getLastPatchExId:()=>this.lastPatchExId,refresh:()=>this.runWatchRefresh()})}crdtBinary=null;model=null;serverDoc=null;schemaGraph=null;extraContext=null;extraContextLoaded=!1;enabledProjectFeatureNames=[];appDetail=null;snapshot=null;schemaExId=null;commitExId=null;agentCommitWatermark=null;lastPatchExId=null;remotePatchCursor=null;appliedPatchExIds=new Set;staleReason="not loaded";lastError=null;lastZtypeDiagnostics=null;diagnosedFor=null;lastRevision=null;events=[];undoStack=[];redoStack=[];projectCapabilitiesCache;watcher;loadedAt=0;lastUsedAt=Date.now();mutex=new Tl;key;static stringifyKey(t){return[t.projectExId,t.appExId??"",t.appVersionExId??""].join(":")}isExpired(t=Date.now()){return t-this.lastUsedAt>_y}currentView(){if(!this.model)throw new Error("CRDT model not loaded");return eR(this.model.view(),this.serverDoc)}lastPatchExIds(){return[this.lastPatchExId,this.serverDoc?.lastPatchExId??null].filter(t=>typeof t=="string")}serverSchemaExId(){return No(this.appDetail)?this.serverDoc?.schemaExId??null:this.schemaExId}status(){return{key:this.key,projectExId:this.sessionKey.projectExId,appExId:this.sessionKey.appExId??null,appVersionExId:this.sessionKey.appVersionExId??null,schemaExId:this.schemaExId,lastPatchExId:this.lastPatchExId,serverDocRequired:No(this.appDetail),serverDoc:this.serverDoc?{schemaExId:this.serverDoc.schemaExId,lastPatchExId:this.serverDoc.lastPatchExId}:null,loadedAt:this.loadedAt?new Date(this.loadedAt).toISOString():null,lastUsedAt:new Date(this.lastUsedAt).toISOString(),staleReason:this.staleReason,lastError:this.lastError,schemaRevision:this.lastRevision,ztypeDiagnostics:this.lastZtypeDiagnostics,crdtBinaryBytes:this.crdtBinary?.byteLength??null,hasCrdtModel:this.model!==null,hasZtypeGraph:this.schemaGraph!==null,schemaEventCount:this.events.length,undoDepth:this.undoStack.length,redoDepth:this.redoStack.length,watcherActive:this.watcher.isActive()}}state(){return{...this.status(),latestEvent:this.events.at(-1)??null}}listEvents(t,r=100){if(!t)return this.events.slice(-r);let n=this.events.findIndex(i=>i.id===t);return(n>=0?this.events.slice(n+1):this.events).slice(-r)}async checkRemoteAndSync(){return this.mutex.run(async()=>this.withErrorState(async()=>this.checkRemoteAndSyncLocked("remote")))}async load(t=!1){return this.mutex.run(async()=>this.withErrorState(()=>this.loadLocked(t)))}async sync(){return this.mutex.run(async()=>this.withErrorState(async()=>{if(this.touch(),!this.schemaExId)return this.loadLocked();let t=await this.pullPatchesAfterRemoteCursorLocked();return t?(await this.syncServerDocLocked(),this.model&&(this.snapshot=this.currentView(),await this.resolveZtypeGraph(),await this.refreshZtypeDiagnostics()),this.lastPatchExId=t.remoteLastPatchExId,this.updateRevision(),this.status()):this.status()}))}getSnapshot(t=!1){if(this.touch(),this.model?.view&&(this.snapshot=this.currentView()),!this.snapshot)throw new Error("Project schema is not loaded");return t?this.snapshot:U4(this.snapshot)}dataModel(){let t=this.getSnapshot().server;return!t||typeof t!="object"?null:t.dataModel??null}async save(){return this.mutex.run(async()=>this.withErrorState(async()=>{this.touch();let t=await this.currentZtypeDiagnostics();return await this.saveOwnDocLocked(),this.serverDoc&&await this.saveServerDocLocked(this.serverDoc),this.updateRevision(),{...this.status(),ztypeDiagnostics:t}}))}async saveForDeploy(){return this.mutex.run(async()=>this.withErrorState(async()=>{this.touch(),(!this.model||!this.schemaGraph||!this.appDetail)&&await this.loadLocked();let t=await this.currentZtypeDiagnostics(),r=await Pl(this.client)&&await this.schemaCommitVersioningOnLocked(),n=this.serverDoc,i=r||this.commitExId!==null,o=n!==null&&(r||n.commitExId!==null);if(i&&this.sessionKey.appVersionExId)throw new Error(`version history does not cover app versions: this session edits appVersionExId ${this.sessionKey.appVersionExId}, which takeSchemaCommit cannot address`);let s=i&&o?gi():null,a={};return i?(this.commitExId=await this.takeDeployCommit(this.sessionKey.appExId??null,s),this.schemaExId&&(a[this.schemaExId]=this.commitExId)):await this.saveOwnDocLocked(),n&&o?(n.commitExId=await this.takeDeployCommit(null,s),a[n.schemaExId]=n.commitExId):n&&await this.saveServerDocLocked(n),this.updateRevision(),{...this.status(),commitExIds:a,ztypeDiagnostics:t}}))}async takeAgentSchemaCommit(t){return this.mutex.run(async()=>this.withErrorState(async()=>{if(this.touch(),(!this.model||!this.schemaGraph||!this.appDetail)&&await this.loadLocked(),!await Pl(this.client)||!await this.schemaCommitVersioningOnLocked())return{status:"NOT_SAVED",message:"Version history is not enabled for this project."};if(this.sessionKey.appVersionExId)return{status:"NOT_SAVED",message:"Version history does not cover app versions."};let r=this.lastPatchExIds().join(",");if(this.agentCommitWatermark===r)return{status:"UNCHANGED",message:"Nothing changed since the last version, so no new one was taken."};let n=this.serverDoc,i=n?gi():null,o=async a=>{let{takeSchemaCommit:u}=await this.client.request(H0,{projectExId:this.sessionKey.projectExId,appExId:a,name:t,groupId:i});return u},s={};return this.commitExId=await o(this.sessionKey.appExId??null),this.schemaExId&&(s[this.schemaExId]=this.commitExId),n&&(n.commitExId=await o(null),s[n.schemaExId]=n.commitExId),this.agentCommitWatermark=r,{status:"SAVED",message:`Version "${t}" was taken.`,commitExIds:s}}))}async schemaCommitVersioningOnLocked(){return await this.getExtraContext(await Rt()),this.enabledProjectFeatureNames.includes(F4)}async takeDeployCommit(t,r){let{takeSchemaCommit:n}=await this.client.request(B0,{projectExId:this.sessionKey.projectExId,appExId:t,groupId:r,fromDeploy:!0});if(!n)throw new Error(`takeSchemaCommit returned no version for ${t??"the project"} document`);return n}async saveOwnDocLocked(){let t=await this.client.request(Rg,{projectExId:this.sessionKey.projectExId,appExId:this.sessionKey.appExId??null,versionExId:this.sessionKey.appVersionExId??null});t.saveSchema!==this.schemaExId&&(this.schemaExId=t.saveSchema,this.commitExId=null)}async saveServerDocLocked(t){let r=await this.client.request(Rg,{projectExId:this.sessionKey.projectExId,appExId:null,versionExId:null});r.saveSchema!==t.schemaExId&&(t.schemaExId=r.saveSchema,t.commitExId=null)}async validate(){return this.mutex.run(async()=>this.withErrorState(async()=>(this.touch(),(!this.model||!this.schemaGraph||!this.appDetail)&&await this.loadLocked(),this.currentZtypeDiagnostics())))}async fetchProjectCapabilities(){try{let r=(await this.client.request(Y0,{projectExId:this.sessionKey.projectExId,appExId:this.sessionKey.appExId??null})).fetchAppDetailByExId;if(!r)return null;let n="project"in r?r.project:r,i={};for(let o of n.capabilities??[])!o?.capability||!o.limit||(i[o.capability]=o.limit.unlimited?{unlimited:!0}:{unlimited:!1,amount:o.limit.amount??0});return Object.keys(i).length===0?null:i}catch(t){return P.warn("Could not load project capabilities for the schemaops gate",t.message),null}}async resolveProjectCapabilities(){if(this.projectCapabilitiesCache!==void 0)return this.projectCapabilitiesCache;let t=await this.fetchProjectCapabilities();return t!==null&&(this.projectCapabilitiesCache=t),t}async ztypeToolCalls(t,r=!1,n=null,i=!1,o=null){return this.mutex.run(async()=>this.withErrorState(async()=>{if(this.touch(),(!this.model||!this.schemaGraph||!this.appDetail)&&await this.loadLocked(),!this.schemaGraph)throw new Error("ztype runtime is unavailable; install @functorz/ztype in this package");let s=await Rt(),a=s?.api;if(!a?.ZTypeCoreApi||!a?.ZTypeSchemaOpsApi)throw new Error("ztype SchemaOps API is unavailable");let u=o??await this.resolveProjectCapabilities(),c=u===null?this.schemaGraph:a.ZTypeCoreApi.withProjectCapabilities(this.schemaGraph,u),l=Nl(s,c,this.appDetail,await this.getExtraContext(s)),d=iR(t,this.enabledProjectFeatureNames);if(d.length)throw new Error(oR(d));let f=G4(t),h=f.map(L=>L&&typeof L=="object"?L.toolCallId:void 0).filter(L=>typeof L=="string"),g=this.withProjectFeatures(a.ZTypeCoreApi,()=>a.ZTypeSchemaOpsApi.toolCalls(l,f,n??null,!0)),y=H4(g),_=J4(g,h),b=s?.application?.schemaops?.SchemaOpsErrorCode?.CAPABILITY_LIMITED?.name;b!==void 0&&_.errorCode===b&&(this.projectCapabilitiesCache=void 0);let S=y.schemaDiff,I=$4(y.responses,h),O={},T=Q4(g);T!=null&&(O.updatedReadState=T),I&&(O.responses=I);let C=K4(g,h);if(C&&(O.notices=C),y.errors&&(O.errors=y.errors,Object.assign(O,_,z4(g,h)),O.applied={applied:!1,reason:"batch rejected by ztype"}),S&&r&&(O.schemaDiff=S),S)try{O.applied=await this.applySchemaDiffLocked(S,{skipValidation:i}),W4(g)&&(O.touchesComponents=!0)}catch(L){if(!(L instanceof Pn))throw L;let w=await Y4(L);return Object.assign(O,w,{errors:[...Array.isArray(O.errors)?O.errors:[],...w.errors]}),O}return await this.attachValidationErrorIfAny(O),O}))}async attachValidationErrorIfAny(t){let r=await this.currentZtypeDiagnostics();X4(r)&&(t.ztypeDiagnostics=r)}async undo(){return this.mutex.run(async()=>this.withErrorState(async()=>{if(this.touch(),(!this.model||!this.schemaGraph||!this.appDetail)&&await this.loadLocked(),this.undoStack.length===0)return{...this.status(),undone:!1,reason:"nothing to undo"};let t=this.undoStack[this.undoStack.length-1],r=t.dataSource.map(JC).reverse(),n=await this.applyReversibleLocked(r);return n?(this.undoStack.pop(),this.redoStack.push(t),{...n,undone:!0,undoDepth:this.undoStack.length,redoDepth:this.redoStack.length,reverted:t.semanticChanges??void 0,revertedPaths:yy(t.dataSource)}):{...this.status(),undone:!1,reason:"schema diverged since this change; undo no longer applies cleanly"}}))}async redo(){return this.mutex.run(async()=>this.withErrorState(async()=>{if(this.touch(),(!this.model||!this.schemaGraph||!this.appDetail)&&await this.loadLocked(),this.redoStack.length===0)return{...this.status(),redone:!1,reason:"nothing to redo"};let t=this.redoStack[this.redoStack.length-1],r=await this.applyReversibleLocked(t.dataSource);return r?(this.redoStack.pop(),this.undoStack.push(t),{...r,redone:!0,undoDepth:this.undoStack.length,redoDepth:this.redoStack.length,reapplied:t.semanticChanges??void 0,reappliedPaths:yy(t.dataSource)}):{...this.status(),redone:!1,reason:"schema diverged since this change; redo no longer applies cleanly"}}))}async applyReversibleLocked(t){if(!this.model)throw new Error("CRDT model not loaded");let r=this.currentView(),n=YC(r,t);if(n.length!==t.length)return null;let i=n.filter(o=>!(o.__typename==="DiffItem"&&Nn(o.oldValue)&&Nn(o.newValue)));return i.length===0?null:this.applySchemaDiffLocked({id:gi(),dataSource:i},{recordUndo:!1})}async recordUndoEntry(t,r,n){let i=await va();if(!i?.generateDiff)return;let o=[];i.generateDiff({before:t,after:r,prefix:[],result:o}),o.length!==0&&(this.undoStack.push({id:gi(),dataSource:structuredClone(o),semanticChanges:n}),this.undoStack.length>M4&&this.undoStack.shift(),this.redoStack=[])}async loadLocked(t=!1){if(this.touch(),this.model&&!t&&!this.staleReason)return this.status();let n=(await this.client.request(await Po(this.client,ua),this.sessionKey)).fetchAppDetailByExId;if(!n)throw new Error(`Project not found: ${this.sessionKey.projectExId}`);let i=await this.fetchLatestSchemaPatchesAfter(this.sessionKey,null),o=oy(i);if(!o?.crdtModelUrl||!i?.exId)throw new Error("Project has no uploaded CRDT schema");let s=await ry(o.crdtModelUrl);return this.crdtBinary=s,this.appliedPatchExIds.clear(),this.lastPatchExId=null,this.remotePatchCursor=null,this.serverDoc=null,this.undoStack=[],this.redoStack=[],this.projectCapabilitiesCache=void 0,this.appDetail=n,await this.initializeRuntime(s,o.crdtPatches?.patches??[],n),this.schemaExId=i.exId,this.commitExId=o.commitExId,this.lastPatchExId=o.crdtPatches?.lastPatchExId??null,this.remotePatchCursor=this.lastPatchExId,this.loadedAt=Date.now(),this.model&&this.schemaGraph?this.staleReason=!this.serverDoc&&No(n)?"backend app document unavailable":null:this.model&&!this.schemaGraph&&(this.staleReason="ztype runtime unavailable"),this.updateRevision(),this.watcher.start(),this.status()}async applySchemaDiffLocked(t,r={}){if(Array.isArray(t.dataSource)&&t.dataSource.length===0)return{...this.status(),applied:!1,reason:"empty schema diff"};if(!this.serverDoc&&No(this.appDetail)&&(t.dataSource??[]).some(Ll))throw new Error("This client app's server lives in the backend app's document, which is not loaded; refusing to write server changes into the client document. Run schema load again.");if(rR(this.appDetail)&&(t.dataSource??[]).some(tR))throw new Error("This session is on the project's own document, which holds the project's backend and no client, so pages and components written here would belong to nothing and never render. Pin the client they belong to with set_current_project (appExId), or pass appExId on this call; take it from `project metadata` -> apps[]. A project with no client app has nowhere to hold them at all.");let i=(r.recordUndo??process.env.MOMEN_MCP_UNDO!=="0")&&this.snapshot?XC(this.snapshot,t.dataSource??[]):null,o=this.currentRevision(),s=await Rt(),a=s?.api?.ZTypeCoreApi,u=await va();if(!a||!u?.executeCrdtNodeUpdateAndTransformDiff||!u.generateDiff)throw new Error("CRDT/ztype write runtime is unavailable");let c=Nl(s,this.schemaGraph,this.appDetail,await this.getExtraContext(s)),l=this.withProjectFeatures(a,()=>a.batchUpdateSchemaGraph(c,[t]));if(l?.interruptErrors?.length>0){let g={available:!0,stableErrors:[...l.interruptErrors].map(Il),betaErrors:[]};if(r.skipValidation!==!0)throw new Pn("ztype validation interrupted schema update",g)}if(!this.model)throw new Error("CRDT model not loaded");P.debug(`[Session] applying schemaDiff dataSource: ${JSON.stringify(t.dataSource).slice(0,4e3)}`);try{await this.uploadByDoc(u,t.dataSource??[],this.model)}catch(g){P.error(`[Session] CRDT apply/upload failed; reloading session to discard the diverged graph: ${g.message}`);let{undoStack:y,redoStack:_}=this;try{await this.loadLocked(!0),this.undoStack=y,this.redoStack=_}catch(b){P.error(`[Session] reload after the failed write failed too; unloading the session so the next command loads it again: ${b.message}`),this.model=null,this.snapshot=null,this.schemaGraph=null,this.schemaExId=null,this.diagnosedFor=null,this.staleReason="a write failed and the reload after it failed too"}throw g}this.schemaGraph=l.updatedGraph,this.snapshot=this.currentView();let d=await this.refreshZtypeDiagnostics(),f=this.updateRevision(),h=i&&o&&i.server!==this.snapshot.server?await hy({version:i.version,server:i.server},{version:this.snapshot.version,server:this.snapshot.server}):null;return h&&Rl(h)&&o&&f&&this.appendSchemaEvent("local",o,f,h),i&&await this.recordUndoEntry(i,this.snapshot,h&&Rl(h)?h:null).catch(g=>P.warn(`[Session] the write landed but its undo entry could not be recorded: ${g.message}`)),{...this.status(),ztypeDiagnostics:d,backendErrorCount:FC(d),_schema:h&&Rl(h)?{change:h}:void 0}}async uploadByDoc(t,r,n){let i=this.serverDoc,o=i?r.filter(Ll):[],s=i?r.filter(u=>!Ll(u)):r,a=i&&o.length>0&&s.length>0?jC(i.model.view()):null;if(i&&o.length>0)for(let u of await this.uploadDocPatch(t,o,i.model,null,i.schemaExId))i.appliedPatchExIds.add(u.exId),i.lastPatchExId=u.exId;if(s.length!==0)try{for(let u of await this.uploadDocPatch(t,s,n,this.sessionKey.appExId??null,this.schemaExId))this.appliedPatchExIds.add(u.exId),this.lastPatchExId=u.exId}catch(u){if(i&&a){let c=[];t.generateDiff({before:i.model.view(),after:a,prefix:[],result:c}),c.length>0&&await this.uploadDocPatch(t,c,i.model,null,i.schemaExId).catch(l=>{throw new Error(`The server half of this change was saved to the backend app's document, but the client half failed (${u.message}) and reverting the server half failed too (${l.message}). Those server changes are live without their client counterparts: read the schema again before retrying, or the retry applies them a second time.`)})}throw u}}async uploadDocPatch(t,r,n,i,o){let s=t.executeCrdtNodeUpdateAndTransformDiff(r,n,this.snapshot,qC),a=gi(),u=await nR(this.client);return(await this.client.request(M0,{projectExId:this.sessionKey.projectExId,appExId:i,schemaExId:o,patches:[{content:{id:a,dataSource:s.diffsFromCrdt},patchBase64:s.patchBase64,uuid:a,...u}]})).batchCreateSchemaCrdtPatch??[]}async checkRemoteAndSyncLocked(t){if(!this.model||!this.schemaExId||!this.snapshot)return await this.loadLocked(),null;let r=this.currentRevision();if(!r)return null;let n={version:this.snapshot.version,server:this.snapshot.server},o=(await this.client.request(await Po(this.client,ua),this.sessionKey)).fetchAppDetailByExId,s=iy(o);if(!s?.exId)return null;let a=await this.syncServerDocLocked();if(this.appDetail=o??this.appDetail,s.exId!==this.schemaExId||!s.crdtModelUrl)await this.loadLocked(!0);else{let l=await this.pullPatchesAfterRemoteCursorLocked();l&&((l.applied||a)&&this.model&&(this.snapshot=this.currentView(),await this.resolveZtypeGraph(),await this.refreshZtypeDiagnostics()),this.lastPatchExId=l.remoteLastPatchExId,this.updateRevision())}let u=this.currentRevision();if(!u||!KC(r,u))return null;let c=await hy(n,{version:this.snapshot?.version,server:this.snapshot?.server});return this.appendSchemaEvent(t==="watch"?"remote":t,r,u,c),{type:"SCHEMA_STALE",message:"Project schema changed since this session last used it; session was refreshed before executing the command.",projectExId:this.sessionKey.projectExId,fromRevision:r,toRevision:u,semanticChanges:c,detectedAt:new Date().toISOString()}}currentRevision(){return this.lastRevision??this.updateRevision()}updateRevision(){return!this.snapshot&&!this.crdtBinary?(this.lastRevision=null,null):(this.lastRevision=HC({projectExId:this.sessionKey.projectExId,appExId:this.sessionKey.appExId??this.appDetail?.appExId??null,appVersionExId:this.sessionKey.appVersionExId??null,schemaExId:this.schemaExId,lastPatchExId:this.lastPatchExId,snapshot:this.snapshot??{binaryBytes:this.crdtBinary?.byteLength??null},deployedSchemaExId:kC(this.appDetail)}),this.lastRevision)}appendSchemaEvent(t,r,n,i){let o={id:gi(),type:"SCHEMA_CHANGED",source:t,projectExId:this.sessionKey.projectExId,fromRevision:r,toRevision:n,semanticChanges:i,detectedAt:new Date().toISOString()};this.events.push(o),this.events=this.events.slice(-j4),this.onSchemaEvent?.(o)}async runWatchRefresh(){let t=this.lastUsedAt;try{await this.mutex.run(async()=>{await this.withErrorState(async()=>this.checkRemoteAndSyncLocked("watch"))})}catch(r){P.warn("Schema watch refresh failed",r.message)}finally{this.lastUsedAt=t}}dispose(){this.watcher.dispose()}async initializeRuntime(t,r,n){let i=await va();if(!i?.initModelByBinary){this.model=null,this.snapshot={binaryBytes:t.length,patches:r},this.schemaGraph=null,this.diagnosedFor=null,this.appDetail=n,this.staleReason="CRDT runtime unavailable";return}this.model=i.initModelByBinary(t),await this.applyNetworkPatches(r),this.model&&(No(n)&&(this.serverDoc=await this.loadServerDoc(i).catch(o=>{if(Cl(o,"CLIENT_VERSION_TOO_OLD"))throw this.staleReason="backend app document unavailable",o;return P.warn("Backend app document unavailable; loading this client app's own document alone",o.message),null})),this.snapshot=this.currentView(),await this.resolveZtypeGraph(),await this.refreshZtypeDiagnostics())}async applyNetworkPatches(t){let r=t.filter(i=>!!(i?.exId&&!this.appliedPatchExIds.has(i.exId)));if(!this.model||r.length===0)return;let n=await ny();if(!n?.fromBinary)throw new Error("json-joy Patch runtime is unavailable");this.model.applyBatch(r.map(i=>n.fromBinary(Buffer.from(i.patchBase64,"base64"))));for(let i of r)this.appliedPatchExIds.add(i.exId),this.lastPatchExId=i.exId;this.snapshot=this.currentView()}async loadServerDoc(t){let r=await this.fetchLatestSchemaPatchesAfter({projectExId:this.sessionKey.projectExId},null),n=oy(r);if(!n?.crdtModelUrl||!r?.exId||!t.initModelByBinary)throw new Error("Could not load the backend app's document this client app's server half lives in");let i={model:t.initModelByBinary(await ry(n.crdtModelUrl)),schemaExId:r.exId,commitExId:n.commitExId,lastPatchExId:null,remotePatchCursor:null,appliedPatchExIds:new Set};return await this.applyServerPatches(i,n.crdtPatches?.patches??[]),i.lastPatchExId=n.crdtPatches?.lastPatchExId??i.lastPatchExId,i.remotePatchCursor=i.lastPatchExId,i}async applyServerPatches(t,r){let n=r.filter(o=>!!(o?.exId&&!t.appliedPatchExIds.has(o.exId)));if(n.length===0)return!1;let i=await ny();if(!i?.fromBinary)throw new Error("json-joy Patch runtime is unavailable");t.model.applyBatch(n.map(o=>i.fromBinary(Buffer.from(o.patchBase64,"base64"))));for(let o of n)t.appliedPatchExIds.add(o.exId),t.lastPatchExId=o.exId;return!0}async syncServerDocLocked(){let t=this.serverDoc;if(!t)return!1;let r=await this.fetchLatestSchemaPatchesAfter({projectExId:this.sessionKey.projectExId},t.remotePatchCursor);if(!r?.exId)return!1;if(r.exId!==t.schemaExId||sR(r)!==t.commitExId)return this.serverDoc=await this.loadServerDoc(await va()),!0;let n=r.crdtPatches?.patches??[],i=await this.applyServerPatches(t,n);t.remotePatchCursor=aR(n)??t.remotePatchCursor;let o=r.crdtPatches?.lastPatchExId??null,s=i||o!==t.lastPatchExId;return t.lastPatchExId=o,s}async pullPatchesAfterRemoteCursorLocked(){let t=await this.fetchLatestSchemaPatchesAfter(this.sessionKey,this.remotePatchCursor);if(!t?.exId||!t.crdtModelUrl||t.exId!==this.schemaExId||sR(t)!==this.commitExId)return await this.loadLocked(!0),null;let r=t.crdtPatches?.patches??[],n=this.appliedPatchExIds.size;return await this.applyNetworkPatches(r),this.remotePatchCursor=aR(r)??this.remotePatchCursor,{applied:this.appliedPatchExIds.size>n,remoteLastPatchExId:t.crdtPatches?.lastPatchExId??null}}async fetchLatestSchemaPatchesAfter(t,r){let n=await this.client.request(await Po(this.client,L0),{projectExId:t.projectExId,appExId:t.appExId??null,appVersionExId:t.appVersionExId??null,afterPatchExId:r});return iy(n.fetchAppDetailByExId)}async resolveZtypeGraph(){let t=await Rt(),r=t?.api;if(!r?.ZTypeCoreApi||!this.snapshot){this.schemaGraph=null,this.diagnosedFor=null,this.staleReason="ztype runtime unavailable";return}let n=r.ZTypeCoreApi.parseZSchemaFromJsObject(this.snapshot),i=await this.getExtraContext(t);this.schemaGraph=this.withProjectFeatures(r.ZTypeCoreApi,()=>r.ZTypeCoreApi.resolveZSchemaToSchemaGraph(n,i))}withProjectFeatures(t,r){return t.withEnabledFeatures(this.enabledProjectFeatureNames,r)}async getExtraContext(t){if(this.extraContextLoaded)return this.extraContext;this.extraContextLoaded=!0;try{let[r,n,i]=await Promise.all([DC(),this.client.request(X0).then(o=>o.supportedCustomModelDescriptor??null).catch(o=>(P.warn("extraContext: model descriptors unavailable",o.message),null)),this.client.request(x0,{projectExId:this.sessionKey.projectExId}).then(o=>(o.features??[]).filter(s=>s.enabled).map(s=>s.featureName)).catch(o=>(P.warn("extraContext: project features unavailable; ztype runs with every feature off",o.message),[]))]);this.enabledProjectFeatureNames=i,this.extraContext=WC(t,r,n,Ao(t))}catch(r){P.warn("extraContext build failed; resolving schema without it",r.message),this.extraContext=null}return this.extraContext}diagnosticsInputs(){return{graph:this.schemaGraph,target:`${this.appDetail?.appType??""}:${this.appDetail?.appExId??""}`,extraContext:this.extraContext,featureNames:this.enabledProjectFeatureNames}}async currentZtypeDiagnostics(){let t=this.diagnosedFor,r=this.diagnosticsInputs();return this.lastZtypeDiagnostics&&t&&Object.keys(r).every(n=>t[n]===r[n])?this.lastZtypeDiagnostics:this.refreshZtypeDiagnostics()}async refreshZtypeDiagnostics(){if(this.diagnosedFor=null,this.lastZtypeDiagnostics=null,!this.schemaGraph||!this.appDetail)return this.lastZtypeDiagnostics={available:!1,stableErrors:[],betaErrors:[],error:this.staleReason??"ztype schema graph is not loaded"},this.lastZtypeDiagnostics;let t=await Rt(),r=t?.api;if(!r?.ZTypeCoreApi||!r?.ZTypeValidationApi)return this.lastZtypeDiagnostics={available:!1,stableErrors:[],betaErrors:[],error:"ztype validation API is unavailable"},this.lastZtypeDiagnostics;let n=Nl(t,this.schemaGraph,this.appDetail,await this.getExtraContext(t)),i=this.withProjectFeatures(r.ZTypeCoreApi,()=>r.ZTypeValidationApi.validateSchemaGraph(n,zC(t,this.appDetail)));return this.lastZtypeDiagnostics={available:!0,stableErrors:[...i?.errors??i?.stableErrors??[]].map(Il),betaErrors:[...i?.warnings??i?.betaErrors??[]].map(Il)},this.diagnosedFor=this.diagnosticsInputs(),this.lastZtypeDiagnostics}touch(){this.lastUsedAt=Date.now()}async withErrorState(t){try{let r=await t();return this.lastError=null,r}catch(r){throw this.lastError=r instanceof Error?r.message:String(r),r}}};var kl=class{constructor(t,r){this.clientFactory=t;this.subscriptionFactory=r}sessions=new Map;emitter=new Z4;clear(){for(let t of this.sessions.values())t.dispose();this.sessions.clear()}sweep(){let t=Date.now();for(let[r,n]of this.sessions.entries())n.isExpired(t)&&(n.dispose(),this.sessions.delete(r))}status(){return this.sweep(),{projectSessionIdleTtlMs:_y,sessions:[...this.sessions.values()].map(t=>t.status())}}async load(t,r=!1){return(await this.getSession(t)).load(r)}async sync(t){return(await this.getSession(t)).sync()}async snapshot(t,r=!1){return(await this.getSession(t)).getSnapshot(r)}async dataModel(t){return(await this.getSession(t)).dataModel()}async save(t){return(await this.getSession(t)).save()}async takeAgentSchemaCommit(t,r){return(await this.getSession(t)).takeAgentSchemaCommit(r)}async saveForDeploy(t){return(await this.getSession(t)).saveForDeploy()}async validate(t){return(await this.getSession(t)).validate()}async ztypeToolCalls(t,r,n=!1,i=null,o=!1,s=null){return(await this.getSession(t)).ztypeToolCalls(r,n,i,o,s)}async serverSchemaExId(t){let r=await this.getSession(t);return await r.load(!1),r.serverSchemaExId()}async lastPatchExIds(t){let r=await this.getSession(t);return await r.load(!1),await r.checkRemoteAndSync(),r.lastPatchExIds()}async undo(t){return(await this.getSession(t)).undo()}async redo(t){return(await this.getSession(t)).redo()}async checkRemoteAndSync(t){return(await this.getSession(t)).checkRemoteAndSync()}schemaState(t){this.sweep();let r=[...this.sessions.values()].filter(n=>!t||n.status().projectExId===t);return{projectExId:t??null,sessions:r.map(n=>n.state())}}schemaEvents(t,r,n=100){this.sweep();let i=[...this.sessions.values()].filter(o=>!t||o.status().projectExId===t);return{projectExId:t??null,events:i.flatMap(o=>o.listEvents(r,n))}}async getSession(t){this.sweep();let r=Ea.stringifyKey(t),n=this.sessions.get(r);if(n)return n;let i=new Ea(await this.clientFactory(),t,this.subscriptionFactory,o=>{this.emitter.emit("schemaChanged",o)});return this.sessions.set(r,i),i}};function _t(e,t){return{projectExId:e,appExId:t.appExId??null,appVersionExId:t.appVersionExId??null}}p();import{execSync as e3}from"node:child_process";import{createRequire as t3}from"node:module";import r3 from"node:path";var Sa=1e5,n3=15e3,i3=3e4,cR=["--js-flags=--max-old-space-size=1024","--renderer-process-limit=1","--enable-precise-memory-info"],o3=1e3,s3=5e3,lR=2e3,a3=3,u3=5*6e4,c3=["chrome","msedge"],_a=e=>Math.max(1,e-Date.now()),Ty=e=>(e/1e3).toFixed(1),yi=(e,t,r=()=>`The canvas did not answer within ${Sa/1e3}s.`,n)=>{let i;return Promise.race([e,new Promise((o,s)=>{i=setTimeout(()=>{n&&e.then(n).catch(()=>{}),s(new Error(r()))},_a(t))})]).finally(()=>clearTimeout(i))},Do=(e,t,r,n)=>{let i=Date.now();return yi(t,r,()=>`${e} did not finish within the ${Sa/1e3}s budget (it started ${Ty(i-(r-Sa))}s in).`,n)},Sy=(e,t)=>{e.includes(t)||(e.push(t),e.length>a3&&e.shift())},by=e=>{try{let{host:t,pathname:r}=new URL(e);return`${t}${r}`.slice(0,80)}catch{return"(unparsable url)"}},l3=e=>e.replace(/(\w+:\/\/[^\s?#]*)[?#]\S*/g,"$1"),p3=async()=>{try{return await import("playwright")}catch{let e=e3("npm root -g",{stdio:"pipe"}).toString().trim();return t3(r3.join(e,"noop.js"))("playwright")}},d3=()=>{let e=globalThis.performance.memory;return e?{used:e.usedJSHeapSize,limit:e.jsHeapSizeLimit}:null},pR=e=>Math.round(e/2**20),Iy=e=>(e instanceof Error?e.message:String(e)).split(`
1438
+ `)[0]??"",f3=async e=>{if(Number(process.versions.node.split(".")[0])<20)throw new Error(`Rendering the canvas needs Node.js 20 or newer; this is Node ${process.versions.node}.`);let t=[];try{return await(await p3()).chromium.launch(e)}catch(n){t.push(`playwright: ${Iy(n)}`)}let r=await import("playwright-core");for(let n of c3)try{return await r.chromium.launch({...e,channel:n})}catch(i){t.push(`${n}: ${Iy(i)}`)}throw new Error(`No browser could be started to render the canvas. Install Google Chrome or Microsoft Edge and try again. (${t.join("; ")})`)},h3=async()=>({chromium:{launch:f3}}),wy=class{constructor(t=h3,r=u3){this.playwright=t;this.idleCloseMs=r}browser=null;context=null;page=null;loadedFor=null;loadedWithPatches=new Set;queue=Promise.resolve();pending=0;idleTimer=null;crash=null;heap=null;trail={pageErrors:[],failedRequests:[]};run(t,r){this.pending+=1,this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null);let n=this.queue.then(()=>(this.crash=null,this.heap=null,this.runNow(t,r).catch(async i=>{throw await this.discard(this.page),await this.withCrashEvidence(i)})));return this.queue=n.catch(()=>{}).finally(()=>{this.pending-=1,this.pending===0&&r.rpc==="CAPTURE"&&this.scheduleIdleClose()}),n}scheduleIdleClose(){this.idleTimer=setTimeout(()=>{this.idleTimer=null,this.queue=this.queue.then(()=>this.close())},this.idleCloseMs),this.idleTimer.unref?.()}async withCrashEvidence(t){if(!(t instanceof Error)||!/crashed/i.test(t.message))return t;let r=Date.now()+o3;for(;!this.crash&&Date.now()<r;)await new Promise(i=>setTimeout(i,20));let n=[this.crash&&`renderer ${this.crash.status}, exit code ${this.crash.errorCode}`,this.heap?.used&&`JS heap ${pR(this.heap.used)} of ${pR(this.heap.limit)} MB before rendering`].filter(Boolean);return n.length>0&&(t.message=`${t.message.trimEnd()} (${n.join("; ")})`),t}async watchCrashes(t){let r=await t.newBrowserCDPSession?.().catch(()=>{});r&&(r.on("Target.targetCrashed",({status:n,errorCode:i})=>{this.crash={status:n,errorCode:i}}),await r.send("Target.setDiscoverTargets",{discover:!0}).catch(()=>{}))}async discard(t){t&&(this.page===t&&(this.page=null,this.loadedFor=null),await yi(t.close(),Date.now()+s3).catch(()=>{}))}async close(){let t=this.browser;this.browser=null,this.context=null,this.page=null,this.loadedFor=null,await t?.close().catch(()=>{})}async runNow(t,r){let n=await this.pageFor(t,r);if(!await yi(n.evaluate(()=>globalThis.__ZION_AGENT_CANVAS__.isInSync()),r.deadline).catch(()=>!1))n=await this.load(t,r);else for(let o of r.lastPatchExIds)if(!this.loadedWithPatches.has(o)&&!await this.waitForPatch(n,o,r.deadline)){n=await this.load(t,r);break}return r.pageId&&(await yi(n.evaluate(({pageId:o,breakpoint:s})=>globalThis.__ZION_AGENT_CANVAS__.focus(o,s),{pageId:r.pageId,breakpoint:r.breakpoint}),r.deadline),await n.waitForFunction(({pageId:o,breakpoint:s})=>globalThis.__ZION_AGENT_CANVAS__.isFocused(o,s),{pageId:r.pageId,breakpoint:r.breakpoint},{timeout:Math.min(i3,_a(r.deadline))})),this.heap=await yi(n.evaluate(d3),r.deadline).catch(()=>null),yi(n.evaluate(({rpc:o,args:s,sessionExId:a})=>{let u=globalThis.__ZION_AGENT_CANVAS__;if(o!=="CAPTURE")return u.dispatch(o,s,a);if(!u.capture)throw new Error("Canvas capture is not available on this deployment yet.");return u.capture(s)},{rpc:r.rpc,args:r.args,sessionExId:r.sessionExId}),r.deadline)}async pageFor(t,r){let n=`${t.projectExId}/${t.appExId}`;return this.page&&!this.page.isClosed()&&this.browser?.isConnected()&&this.loadedFor===n?this.page:this.load(t,r)}async waitForPatch(t,r,n){try{return await t.waitForFunction(i=>globalThis.__ZION_AGENT_CANVAS__.hasAppliedPatch(i),r,{timeout:Math.min(n3,_a(n))}),!0}catch{return!1}}async load(t,r){let n=Ht().editorBaseUrl;if(!this.browser?.isConnected()||!this.context){await Do("Closing the old browser",this.close(),r.deadline);let u=process.env.EDITOR_HOST_RESOLVER_RULES,c=await Do("Launching the browser",this.playwright().then(({chromium:l})=>l.launch({headless:!0,args:u?[...cR,`--host-resolver-rules=${u}`]:cR})),r.deadline,l=>l.close());this.browser=c,await Do("Watching the browser for crashes",this.watchCrashes(c),r.deadline),this.context=await Do("Opening a browser context",c.newContext({viewport:{width:1280,height:800}}),r.deadline)}if(await Do("Signing the browser in",this.context.addCookies([{name:"loggedInUserStorageKey",value:encodeURIComponent(JSON.stringify({exId:t.user.exId,username:t.user.username,token:t.token,roleNames:[],registeredWithInLastMinute:!1})),url:n}]),r.deadline),!this.page||this.page.isClosed()){let u=await Do("Opening a page",this.context.newPage(),r.deadline,c=>c.close());u.on("crash",()=>void this.discard(u)),u.on("pageerror",c=>Sy(this.trail.pageErrors,l3(Iy(c)).slice(0,100))),u.on("requestfailed",c=>{let l=c.failure()?.errorText??"failed";l!=="net::ERR_ABORTED"&&Sy(this.trail.failedRequests,`${by(c.url())} ${l}`)}),u.on("response",c=>{c.status()>=400&&Sy(this.trail.failedRequests,`${by(c.url())} ${c.status()}`)}),this.page=u}let i=this.page,o=new URLSearchParams({mode:"AGENT_CANVAS",leftSideTab:"page"});r.pageId&&o.set("componentId",r.pageId),r.breakpoint&&o.set("breakpoint",r.breakpoint),this.loadedWithPatches=new Set(r.lastPatchExIds),this.loadedFor=null,this.trail={pageErrors:[],failedRequests:[]};let s=Date.now(),a=null;try{await i.goto(`${n}/multi-client/tool/${t.projectExId}/${t.appExId}/design?${o}`,{waitUntil:"domcontentloaded",timeout:_a(r.deadline-lR)}),a=Date.now()-s,await i.waitForFunction(()=>!!globalThis.__ZION_AGENT_CANVAS__&&!!globalThis.document.querySelector("#canvas-viewport [data-meta-id]"),void 0,{timeout:_a(r.deadline-lR)})}catch(u){throw await this.withLoadEvidence(u,i,a===null?`goto gave up after ${Ty(Date.now()-s)}s`:`goto ${Ty(a)}s`,r.deadline)}return this.loadedFor=`${t.projectExId}/${t.appExId}`,i}async withLoadEvidence(t,r,n,i){if(!(t instanceof Error))return t;let o=await yi(r.evaluate(()=>{let{__ZION_AGENT_CANVAS__:a,document:u}=globalThis;return{title:u.title,api:!!a,viewport:!!u.querySelector("#canvas-viewport"),metaNodes:u.querySelectorAll("#canvas-viewport [data-meta-id]").length}}),i).catch(()=>null),s=[n,`at ${by(r.url())}`+(o?` "${o.title.slice(0,60)}"`:""),o?`canvas API ${o.api?"present":"missing"}, #canvas-viewport ${o.viewport?"present":"missing"}, ${o.metaNodes} [data-meta-id]`:"the page did not answer",this.trail.pageErrors.length>0&&`page errors: ${this.trail.pageErrors.join(" | ")}`,this.trail.failedRequests.length>0&&`failed requests: ${this.trail.failedRequests.join(", ")}`].filter(Boolean);return t.message=`${t.message.trimEnd()} (${s.join("; ")})`,t}},jl=new wy;p();var dR=e=>e??{},G=e=>typeof e=="string"&&e.length>0?e:void 0,ve=e=>typeof e=="string"&&e.length>0?e:null,Je=(e,t=!1)=>typeof e=="boolean"?e:t,He=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,vi=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?e:void 0,Y=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},Ei=(e,t)=>{let r=G(e);if(!r)throw new Error(`${t} is required`);return r},St=(e,t)=>{if(!t)return e;if(e&&typeof e=="object"&&!Array.isArray(e)){let r=e,n=Y(r._schema);return{...r,_schema:{...n,warning:t}}}return{result:e,_schema:{warning:t}}},m3=e=>new Promise(t=>{setTimeout(t,e)}),Ml=e=>{let t=e?.name;if(typeof t!="string"||t.length===0)return null;let r=typeof e?.type=="string"?e.type:"";return/IMAGE|VIDEO|FILE/.test(r)?r.includes("LIST")?`${t}_ids`:`${t}_id`:t},fR=(e,t)=>{let n=e?.tableMetadata?.find(i=>i?.name===t)?.columnMetadata?.map(i=>Ml(i))?.filter(i=>i!==null);return n?.length?n.slice(0,20):["id"]},g3=/token|secret|password|privatekey|merchantkey|mchkey|apikey/i,Oy=e=>{if(Array.isArray(e))return e.map(Oy);if(!e||typeof e!="object")return e;let t={};for(let[r,n]of Object.entries(e))t[r]=g3.test(r)?"<redacted>":Oy(n);return t},Ay=(e,t)=>Je(t.includeSecrets,!1)?e:Oy(e),ba=async(e,t,r)=>{let n={projectExId:G(t.projectExId),appExId:ve(t.appExId),appVersionExId:ve(t.appVersionExId)},i="appExId"in t,o=await BC(e,n,r);if(!i){let s=await e.loadProjectContext();n.appExId=s?.projectExId===o?s.appExId??null:null}if(n.appExId!==null&&n.appExId===o)throw new Error(`appExId was given the project exId (${o}). appExId names a client app inside the project, never the project itself: pass appExId: null to address the project's own document (its backend alone), or take an app exId from \`project metadata\` -> apps[] whose appExId is non-null.`);return{...n,projectExId:o}},hR=async(e,t)=>{let r=G(t.organizationExId),n=G(t.projectSpaceType);if(r&&n)return{organizationExId:r,projectSpaceType:n};let o=(await e.request(sl))?.user,s=o?.currentOrganization??o?.organization??o?.organizations?.[0]??o?.joinedOrganizations?.[0];if(!s?.exId)throw new Error("No default organization found; pass organizationExId and projectSpaceType");return{organizationExId:r??s.exId,projectSpaceType:n??"PERSONAL"}},y3=async(e,t)=>((await e.request(ol,{projectName:t,paginator:{first:20}}))?.fuzzySearchProjectName?.edges??[]).find(o=>o?.node?.projectName===t)?.node??null,mR=async(e,t,r)=>{let n=Date.now()+r;for(;Date.now()<n;){let i=await y3(e,t);if(i)return i;await m3(2e3)}return null},gR=(e,t,r,n=!0)=>{if(G(t.confirmProjectExId)!==e&&!(n&&Je(t.force,!1)))throw new Error(`${r} is destructive; pass confirmProjectExId=${e}`+(n?" or force=true":""))},v3=e=>e.replace(/\/api\/graphql-v2(\/?)$/,"/api/graphql-admin$1"),sr=async(e,t)=>{let n=(await e.request(D0,{projectExId:t.projectExId,appVersionExId:t.appVersionExId}))?.fetchAppDetailByExIdWithoutReconcile,i=n?.__typename==="Project"?n:null;if(!i?.adminToken)throw new Error(`Runtime commands need the project admin token, which only project editors get; none was returned for project ${t.projectExId}`);let o=i.zeroUrl??Ht().zeroApiUrlTemplate.replace("{projectExId}",t.projectExId),s={authorization:`Bearer ${i.adminToken}`};return{adminToken:i.adminToken,zeroUrl:o,adminSubscriptionUrl:i.adminZeroSubscriptionUrl,dataClient:new at(o,{headers:s,fetch:Ro}),adminClient:new at(i.adminZeroUrl??v3(o),{headers:s,fetch:Ro})}};p();p();import{promises as E3}from"fs";import _3 from"path";var S3=async(e,t)=>{let r=G(e.cwd);if(!r)throw new Error("cwd is required");let n=_3.resolve(r);if(!(await E3.stat(n)).isDirectory())throw new Error(`Path is not a directory: ${n}`);return t.credentialStore.setWorkspaceRoot(n),t.schemaManager.clear(),t.ok({cwd:n},`Current working directory set to ${n}`)},yR={"workspace.set":S3};p();var IR=Qe(as(),1);p();import{randomBytes as b3,timingSafeEqual as T3}from"crypto";import{createServer as I3}from"http";import w3 from"open";var xy="127.0.0.1",O3=3e5,Ta=class{config;openBrowser;constructor(t,r=w3){this.config=t,this.openBrowser=r}async authenticate(){let t=b3(32).toString("base64url"),r,n,i=new Promise((h,g)=>{r=h,n=g}),o=!1,s=h=>{o||(o=!0,clearTimeout(c),setTimeout(()=>{a.close(),"token"in h?r(h.token):n(h.error)},"token"in h?1e3:0))},a=I3((h,g)=>{let y=new URL(h.url??"/",`http://${xy}`);if(y.pathname!=="/callback"){g.writeHead(404),g.end();return}if(o){P.info("[JwtAuth] Ignored a callback after the login finished"),g.writeHead(400,{"Content-Type":"text/html"}),g.end(this.errorPage("This login has already finished."));return}if(!A3(y.searchParams.get("state"),t)){P.info("[JwtAuth] Ignored a callback that does not carry this login's state"),g.writeHead(400,{"Content-Type":"text/html"}),g.end(this.errorPage("This page belongs to a different login attempt. Finish the login in the newest browser tab, or run login again."));return}let _=y.searchParams.get("token");if(!_||_.trim()===""){P.info("[JwtAuth] No token parameter found in callback URL"),g.writeHead(400,{"Content-Type":"text/html"}),g.end(this.errorPage("No authentication token received")),s({error:new Error("No token parameter in callback")});return}P.info(`[JwtAuth] Token received (length: ${_.length} chars)`),g.writeHead(200,{"Content-Type":"text/html"}),g.end(this.successPage()),s({token:_})}),u=await vR(a,this.config.callbackPort??8088),c=setTimeout(()=>s({error:new Error("Authentication timeout - no response after 5 minutes")}),O3);a.on("error",h=>s({error:h}));let l=`http://${xy}:${u}/callback`,d=new URL(this.config.authEndpoint);d.searchParams.set("redirect_uri",l),d.searchParams.set("state",t),P.info(`[JwtAuth] Using callback URL: ${l}`),P.info("[JwtAuth] Opening browser for authentication...");try{await this.openBrowser(d.toString())}catch{P.info("[JwtAuth] Could not open browser automatically"),P.info("[JwtAuth] Please open this URL manually:"),P.info(d.toString())}let f=await i;return P.info("[JwtAuth] JWT token received successfully"),{access_token:f,token_type:"Bearer"}}renderPage(t){let r=t.autoClose?`
1439
+ <script>
1440
+ setTimeout(() => {
1441
+ window.close();
1442
+ }, 2000);
1443
+ </script>`:"";return`
1444
+ <!DOCTYPE html>
1445
+ <html>
1446
+ <head>
1447
+ <meta charset="utf-8">
1448
+ <title>${t.title}</title>
1449
+ <style>
1450
+ body {
1451
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
1452
+ display: flex;
1453
+ justify-content: center;
1454
+ align-items: center;
1455
+ height: 100vh;
1456
+ margin: 0;
1457
+ background: linear-gradient(135deg, ${t.gradient});
1458
+ }
1459
+ .container {
1460
+ background: white;
1461
+ padding: 2.5rem;
1462
+ border-radius: 1rem;
1463
+ box-shadow: 0 20px 60px rgba(0,0,0,0.3);
1464
+ text-align: center;
1465
+ max-width: 400px;
1466
+ }
1467
+ h1 {
1468
+ margin: 0 0 1rem;
1469
+ color: ${t.headingColor};
1470
+ font-size: 1.5rem;
1471
+ }
1472
+ p {
1473
+ color: #666;
1474
+ margin: 0;
1475
+ line-height: 1.6;
1476
+ }
1477
+ .icon {
1478
+ font-size: 3rem;
1479
+ margin-bottom: 1rem;
1480
+ }
1481
+ </style>
1482
+ </head>
1483
+ <body>
1484
+ <div class="container">
1485
+ <div class="icon">${t.icon}</div>
1486
+ <h1>${t.heading}</h1>
1487
+ <p>${t.body}</p>
1488
+ <p style="margin-top: 1rem; font-size: 0.9em; opacity: 0.8;">${t.footer}</p>
1489
+ </div>${r}
1490
+ </body>
1491
+ </html>`}successPage(){return this.renderPage({title:"Token Received",gradient:"#667eea 0%, #764ba2 100%",headingColor:"#333",icon:"\u2713",heading:"Token Received",body:"MCP server authenticated successfully.",footer:"You can close this window.",autoClose:!0})}errorPage(t){return this.renderPage({title:"Authentication Error",gradient:"#f093fb 0%, #f5576c 100%",headingColor:"#d93025",icon:"\u26A0\uFE0F",heading:"Authentication Error",body:t,footer:"Please try again."})}};function A3(e,t){if(e===null)return!1;let r=Buffer.from(e),n=Buffer.from(t);return r.length===n.length&&T3(r,n)}function vR(e,t){return new Promise((r,n)=>{let i=s=>{e.off("listening",o),s.code==="EADDRINUSE"&&t!==0?r(vR(e,t+1)):n(s)},o=()=>{e.off("error",i),r(e.address().port)};e.once("error",i),e.once("listening",o),e.listen(t,xy)})}p();var it=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},Ia=e=>Array.isArray(e)?e:[];function ER(e){let t={};for(let r of Ia(e)){let n=it(r),i=n.capability;if(typeof i!="string")continue;let o=it(n.limit);t[i]=o.unlimited?"unlimited":o.amount??0}return t}function Fl(e,t){if(Array.isArray(e))return e.map(r=>Fl(r,t));if(e&&typeof e=="object"){let r={};for(let[n,i]of Object.entries(e))t.has(n)||(r[n]=Fl(i,t));return r}return e}var _R=new Set(["crdtPatches","crdtModelUrl","latestDeployedServerSchema","additional"]);function SR(e){let t=it(e),r=it(t.fetchAppDetailByExId),n=it(r.project),i=y=>r[y]??n[y],o=it(i("projectConfig")),s=it(r.config).customDomain??r.webProdDomain??null,a=r.__typename==="Project",u=i("lastDeployedServerSchemaExId")??null,c=it(r.lastUploadedSchema).exId??null,l=a?{deployedSchemaExId:u,uploadedSchemaExId:c,hasUndeployedChanges:c!=null&&c!==u,deploymentEnvs:Ia(i("deploymentEnvConfigs")).map(y=>it(y).userDeploymentEnvironment).filter(y=>y!=null)}:{},d=Ia(i("appList")).map(y=>{let _=it(y);return{appExId:_.appExId,appType:_.appType,name:_.name,published:_.hasPublished??!1,expired:_.isExpired??!1,..._.__typename==="WebApp"?{webDomain:_.webProdDomain??null}:{}}}),f=it(i("projectPlan")),h=it(it(t.project).rpsStatsInLast30Days),g={projectExId:r.projectExId??n.exId??null,projectName:i("projectName")??null,appType:r.appType??null,supportedPlatforms:o.supportedPlatforms??null,createdAt:i("createdAt")??null,updatedAt:i("updatedAt")??null,published:i("hasPublished")??!1,expired:i("isExpired")??!1,webDomain:s,...l,integrations:{stripe:o.stripePayConfig!=null,alipay:o.aliPayConfig!=null,wechatPay:o.wechatPayConfig!=null,wechatApp:o.wechatAppConfig!=null,sms:o.aliyunSmsConfig!=null,email:o.emailConfig!=null},plan:{type:f.projectPlanType??null,expireAt:f.expireAt??null,highestPurchased:i("highestPurchasedProjectPlanType")??null},capabilities:ER(i("capabilities")),rpsLast30Days:{exceededDays:h.exceededNumOfDays??0,exceededTotal:h.exceededTotal??0}};return d.length>0&&(g.apps=d),g}function bR(e){let t=it(e),r={};for(let n of Ia(t.projectResourceUsageInfo)){let i=it(n),o=i.resourceType;typeof o=="string"&&(r[o]={used:i.usedAmount??0,available:i.availableAmountWithNoExhaustionBurst??null,status:i.resourceUsageStatus??null,unlimited:i.unlimited??!1})}return{resources:r,unitComputingPower:t.unitComputingPower??null,visitTimesSupportedByComputingPower:t.visitTimesSupportedByComputingPower??null}}function TR(e){let t=it(it(e).user),r=Ia(t.joinedOrganizations).map(n=>{let i=it(n);return{exId:i.exId,displayName:i.displayName,ownerName:i.ownerName,planType:i.planType,planExpireAt:i.planExpireAt,permissionEnabled:i.permissionEnabled,permissionRoleLimit:i.permissionRoleLimit,capabilities:ER(i.capabilities)}});return{exId:t.exId,email:t.email,phoneNumber:t.phoneNumber,username:t.username,displayName:t.displayName,availableTechnicalSupportHours:t.availableTechnicalSupportHours,daysSinceRegistration:t.daysSinceRegistration,involvedProjectCount:t.involvedProjectCount,organizations:r}}async function Cy(e){let t=await e.loadCredentials();if(!t)return null;let r=IR.default.decode(t.access_token),n=r&&typeof r=="object"?r:null;return{tokenType:t.token_type,savedAt:t.savedAt,jwt:n?{sub:n.sub,roles:n.roles,iat:n.iat,exp:n.exp}:r}}var x3=async(e,t)=>{let r=await Pr(t.credentialStore),n=await new Ta(r).authenticate();return await t.credentialStore.saveCredentials(n),t.ok(await Cy(t.credentialStore),"Authenticated")},C3=async(e,t)=>{await t.credentialStore.deleteCredentials();let r=await Pr(t.credentialStore),n=await new Ta(r).authenticate();return await t.credentialStore.saveCredentials(n),t.ok(await Cy(t.credentialStore),"Authenticated")},R3=async(e,t)=>(await t.credentialStore.deleteCredentials(),await t.credentialStore.deleteProjectContext(),t.schemaManager.clear(),t.ok(void 0,"Logged out")),P3=async(e,t)=>{let r=await Cy(t.credentialStore);return r?t.ok(r):t.fail(new Error(Ka))},N3=async(e,t)=>t.ok(TR(await t.client.request(O0))),wR={"auth.login":x3,"auth.reauth":C3,"auth.logout":R3,"auth.whoami":P3,"account.profile":N3};p();p();import{spawn as D3}from"child_process";var OR=18e4,Ul=Math.floor(OR/1e3),L3=OR+5e3,AR=()=>(process.env.MCP_HITL??"").trim().toLowerCase()==="off";function Dn(e,t){return new Promise(r=>{let n="",i="",o=!1,s=D3(e,t,{stdio:["ignore","pipe","pipe"]}),a=setTimeout(()=>{o||(s.kill("SIGKILL"),o=!0,r({code:null,stdout:n,stderr:i,timedOut:!0}))},L3);a.unref(),s.stdout?.on("data",u=>{n+=u.toString()}),s.stderr?.on("data",u=>{i+=u.toString()}),s.on("error",u=>{o||(o=!0,clearTimeout(a),r({code:null,stdout:n,stderr:i,spawnError:u}))}),s.on("close",u=>{o||(o=!0,clearTimeout(a),r({code:u,stdout:n,stderr:i}))})})}async function k3(e,t){let n=["on run argv","set pid to item 1 of argv","set verb to item 2 of argv",'set msg to "This will " & verb & " project " & pid & "." & return & "This action is IRREVERSIBLE." & return & return & "Type the project id to confirm:"',"try",`set dlg to display dialog msg with title "Human approval required" default answer "" buttons {"Cancel", "Confirm"} default button "Cancel" cancel button "Cancel" with icon caution giving up after ${Ul}`,"on error number -128",'return "__CANCELLED__"',"end try",'if (gave up of dlg) then return "__CANCELLED__"',"return text returned of dlg","end run"].flatMap(s=>["-e",s]);n.push(e,t);let i=await Dn("osascript",n);if(i.spawnError)return"unavailable";if(i.timedOut)return"denied";if(i.code!==0)return"unavailable";let o=i.stdout.trim();return o==="__CANCELLED__"?"denied":o===e?"approved":"denied"}async function j3(e,t){if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return"unavailable";let r=`This will ${t} project ${e}.
1492
+ This action is IRREVERSIBLE.
1493
+
1494
+ Type the project id to confirm:`,n=await Dn("zenity",["--entry","--title=Human approval required",`--text=${r}`,`--timeout=${Ul}`]);if(!n.spawnError)return n.timedOut?"denied":n.code===0&&n.stdout.trim()===e?"approved":"denied";let i=await Dn("kdialog",["--title","Human approval required","--inputbox",r,""]);return i.spawnError?"unavailable":i.timedOut?"denied":i.code===0&&i.stdout.trim()===e?"approved":"denied"}async function M3(e,t){let r=`This will ${t} project ${e}. This action is IRREVERSIBLE.
1495
+
1496
+ Type the project id to confirm:`,i=`Add-Type -AssemblyName Microsoft.VisualBasic;$r=[Microsoft.VisualBasic.Interaction]::InputBox('${(s=>s.replace(/'/g,"''"))(r)}','Human approval required','');Write-Output $r`,o=await Dn("powershell",["-NoProfile","-NonInteractive","-Command",i]);return o.spawnError?"unavailable":o.timedOut?"denied":o.code!==0?"unavailable":o.stdout.trim()===e?"approved":"denied"}async function F3(e,t){switch(process.platform){case"darwin":return k3(e,t);case"linux":return j3(e,t);case"win32":return M3(e,t);default:return"unavailable"}}async function wa(e,t,r,n={}){if(AR()){gR(e,t,r,n.allowForce??!0);return}let i=await F3(e,r);if(i==="approved"){Cp("notice",`Human approved ${r} of project ${e}`);return}throw i==="unavailable"?new Error(`${r} requires human approval via a GUI dialog, but no dialog could be shown on this host (headless/SSH/CI). Set MCP_HITL=off to bypass with the confirmProjectExId/force text gate.`):new Error(`${r} was not approved: the confirmation dialog was cancelled or the project id was not entered correctly.`)}var ql=e=>e.replace(/\r?\n$/,"");async function q3(e){let r=["on run argv","set lbl to item 1 of argv",'set msg to "Enter the value for secret " & quote & lbl & quote & ":"',"try",`set dlg to display dialog msg with title "Set secret value" default answer "" with hidden answer buttons {"Cancel", "Save"} default button "Save" cancel button "Cancel" with icon note giving up after ${Ul}`,"on error number -128",'return "__CANCELLED__"',"end try",'if (gave up of dlg) then return "__CANCELLED__"',"return text returned of dlg","end run"].flatMap(o=>["-e",o]);r.push(e);let n=await Dn("osascript",r);if(n.spawnError||n.code!==0)return{ok:!1,reason:"unavailable"};if(n.timedOut)return{ok:!1,reason:"cancelled"};let i=ql(n.stdout);return i==="__CANCELLED__"?{ok:!1,reason:"cancelled"}:{ok:!0,value:i}}async function U3(e){if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return{ok:!1,reason:"unavailable"};let t=`Enter the value for secret "${e}":`,r=await Dn("zenity",["--entry","--hide-text","--title=Set secret value",`--text=${t}`,`--timeout=${Ul}`]);if(!r.spawnError)return r.timedOut?{ok:!1,reason:"cancelled"}:r.code===0?{ok:!0,value:ql(r.stdout)}:{ok:!1,reason:"cancelled"};let n=await Dn("kdialog",["--title","Set secret value","--password",t]);return n.spawnError?{ok:!1,reason:"unavailable"}:n.timedOut?{ok:!1,reason:"cancelled"}:n.code===0?{ok:!0,value:ql(n.stdout)}:{ok:!1,reason:"cancelled"}}async function V3(e){let t=s=>s.replace(/'/g,"''"),r=`Enter the value for secret "${e}":`,n=["Add-Type -AssemblyName System.Windows.Forms;","Add-Type -AssemblyName System.Drawing;","$f=New-Object System.Windows.Forms.Form;$f.Text='Set secret value';$f.Width=440;$f.Height=180;$f.StartPosition='CenterScreen';$f.TopMost=$true;",`$l=New-Object System.Windows.Forms.Label;$l.Text='${t(r)}';$l.AutoSize=$true;$l.Top=15;$l.Left=15;$f.Controls.Add($l);`,"$t=New-Object System.Windows.Forms.TextBox;$t.UseSystemPasswordChar=$true;$t.Width=400;$t.Top=45;$t.Left=15;$f.Controls.Add($t);","$ok=New-Object System.Windows.Forms.Button;$ok.Text='Save';$ok.Top=90;$ok.Left=235;$ok.DialogResult=[System.Windows.Forms.DialogResult]::OK;$f.Controls.Add($ok);$f.AcceptButton=$ok;","$cn=New-Object System.Windows.Forms.Button;$cn.Text='Cancel';$cn.Top=90;$cn.Left=325;$cn.DialogResult=[System.Windows.Forms.DialogResult]::Cancel;$f.Controls.Add($cn);$f.CancelButton=$cn;",'$r=$f.ShowDialog();if($r -eq [System.Windows.Forms.DialogResult]::OK){Write-Output $t.Text}else{Write-Output "__CANCELLED__"}'].join(""),i=await Dn("powershell",["-NoProfile","-NonInteractive","-STA","-Command",n]);if(i.spawnError||i.code!==0)return{ok:!1,reason:"unavailable"};if(i.timedOut)return{ok:!1,reason:"cancelled"};let o=ql(i.stdout);return o==="__CANCELLED__"?{ok:!1,reason:"cancelled"}:{ok:!0,value:o}}async function xR(e){if(AR())throw new Error("Setting a secret value needs a native GUI dialog so the value stays off the tool call, but MCP_HITL=off. Run without MCP_HITL=off on a machine with a desktop session.");let t;switch(process.platform){case"darwin":t=await q3(e);break;case"linux":t=await U3(e);break;case"win32":t=await V3(e);break;default:t={ok:!1,reason:"unavailable"}}if(t.ok){if(!t.value)throw new Error("No secret value was entered.");return Cp("notice",`Human entered a value for secret "${e}"`),t.value}throw t.reason==="unavailable"?new Error("Setting a secret value requires a native GUI dialog, but none could be shown on this host (headless/SSH/CI)."):new Error("Setting the secret value was cancelled.")}p();var G3=new Set(["projectExId","appExId","appVersionExId"]),Vl=new Map,Ry=new Set,Py=(e,t)=>JSON.stringify([e.hostSessionId??null,t]),_i=e=>async(t,r)=>{let{projectExId:n,appExId:i}=await r.getProjectArgs(t),o=Py(r,n),{runAgentFileTool:s}=await r.client.request(yx,{projectExId:n,appExId:i??null,tool:e,args:Object.fromEntries(Object.entries(t).filter(([a])=>!G3.has(a))),readState:Vl.get(o)??null});return Vl.set(o,s.readState),r.ok(void 0,s.output)},CR=async(e,t,r)=>{let n=Py(e,t);Ry.add(n);let{agentFileSnapshot:i}=await e.client.request(gx,{projectExId:t,appExId:r??null,readState:Vl.get(n)??null});return Vl.set(n,i.readState),i.text},Ny=async(e,t)=>{try{let{appExId:r}=await ba(e.credentialStore,{projectExId:t},e.client);return await CR(e,t,r)??void 0}catch(r){return`The agent files of project ${t} could not be loaded: ${r instanceof Error?r.message:String(r)}`}},RR=async(e,t)=>{let r=Py(e,t);if(!(!e.hostSessionId||Ry.has(r)))return Ry.add(r),Ny(e,t)},$3=async(e,t)=>{let{projectExId:r,appExId:n}=await t.getProjectArgs(e);return t.ok(void 0,await CR(t,r,n)??"This project has no agent files yet.")},PR={"agent_files.read_file":_i("READ_FILE"),"agent_files.write_file":_i("WRITE_FILE"),"agent_files.edit_file":_i("EDIT_FILE"),"agent_files.list_files":_i("LIST_FILES"),"agent_files.grep_files":_i("GREP_FILES"),"agent_files.rename_file":_i("RENAME_FILE"),"agent_files.delete_file":_i("DELETE_FILE"),"agent_files.snapshot":$3};var NR=async(e,t)=>{let n=(await t.client.request(ol,{projectName:G(e.projectName)??"",paginator:{after:ve(e.cursor),first:He(e.limit,20)}})).fuzzySearchProjectName,i=(n?.edges??[]).map(a=>a?.node).filter(a=>a!=null).map(a=>({exId:a.exId,projectName:a.projectName,updatedAt:a.updatedAt,hasPublished:a.hasPublished,webDomains:(a.appList??[]).flatMap(u=>u.__typename==="WebApp"&&u.webProdDomain?[u.webProdDomain]:[])})),o=n?.pageInfo,s=o?.hasNextPage?o.endCursor?.value??null:null;return t.ok({projects:i,nextCursor:s})},DR=()=>Fn==="ZION",B3=["WEB","WECHAT_MINI_PROGRAM","MOBILE","BACKEND_ONLY"],H3={WEB:"Web",WECHAT_MINI_PROGRAM:"WeChat mini program",MOBILE:"App"},K3="WEB, WECHAT_MINI_PROGRAM and MOBILE each create a client this project hosts \u2014 build its pages as component trees with these tools, or deploy your own build to a WEB client; BACKEND_ONLY creates no client, for a front end hosted elsewhere that calls the project's auto-generated GraphQL API",Q3=e=>{let t=G(e.appType);if(t==="WECHAT_MINI_PROGRAM"&&!DR())throw new Error("appType WECHAT_MINI_PROGRAM is a Zion-only client type and cannot be created here");let r=B3.filter(n=>n!=="WECHAT_MINI_PROGRAM"||DR());if(!t||!r.some(n=>n===t))throw new Error(`appType is required and must be one of ${r.join(", ")} \u2014 ${K3}.`);return t},W3=(e,t)=>({appName:G(e.appName)??H3[t],appType:t,source:{type:"BLANK"}}),z3=async(e,t)=>{let r=G(e.projectName)??G(e.name);if(!r)throw new Error("projectName is required");let n=Q3(e),i=await hR(t.client,e),s=(await t.client.request(A0,{createProjectDetail:{projectName:r,organizationExId:i.organizationExId,projectSpaceType:i.projectSpaceType,category:ve(e.category),source:{type:"BLANK"},entry:"MCP",...n!=="BACKEND_ONLY"&&{builtInClientApp:W3(e,n)}}})).createMultiClientProjectAsync;if(!s)throw new Error("Project creation failed: taskId is missing");let u=Je(e.wait,!0)?await mR(t.client,r,He(e.timeoutMs,12e4)):null,c=null;if(u?.exId){let l=String(u.exId);n!=="BACKEND_ONLY"&&(c=(await mi(t.client,l))[0]??null),await t.credentialStore.saveProjectContext(l,c?.appExId??null),await dy(t.client,l,t.codingAgent,t.hostSessionId)}return t.ok({taskId:s,project:u,builtInApp:c,projectSpace:i})},J3=async(e,t)=>{let r=G(e.projectExId);if(!r)throw new Error("projectExId is required");let n=G(e.appExId),i=e.appExId===null,o=n||i?[]:await mi(t.client,r);if(o.length>1)throw new Error(`Project ${r} has ${o.length} client apps, so the current client cannot be resolved: ${o.map(a=>`${a.appExId} (${a.appType})`).join(", ")}. Pages and components belong to one client, so call this again with appExId set to the one to work on, or with appExId: null to address the project's backend document alone. The current project is left as it was.`);let s=n??Co(o);return await t.credentialStore.saveProjectContext(r,s),await dy(t.client,r,t.codingAgent,t.hostSessionId),{...t.ok({projectExId:r,appExId:s},s?`Current project set to ${r}, current client ${s}`:`Current project set to ${r} (no client; calls address its backend document)`),agentFiles:await Ny(t,r)}},Y3=async(e,t)=>t.ok(await t.credentialStore.loadProjectContext()),X3=async(e,t)=>{let r=await t.getProjectLevelArgs(e),n=await t.client.request(await Po(t.client,ua),r);return t.ok(Ay(Fl(n,_R),e))},Z3=async(e,t)=>{let r=await t.getProjectLevelArgs(e),n=await t.client.request(al,r);return Je(e.raw,!1)?t.ok(Ay(n,e)):t.ok(SR(n))},e5=async(e,t)=>{let r=await t.getProjectArgs(e),n=G(e.projectName)??G(e.name);if(!n)throw new Error("projectName is required");return t.ok(await t.client.request(C0,{projectExId:r.projectExId,projectName:n}))},t5=async(e,t)=>{let r=await t.getProjectArgs(e),n=G(e.appExId),i=G(e.appName)??G(e.name);if(!n)throw new Error("appExId is required");if(!i)throw new Error("appName is required");return t.ok(await t.client.request(R0,{projectExId:r.projectExId,appExId:n,appName:i}))},r5=async(e,t)=>{let r=await t.getProjectArgs(e);await wa(r.projectExId,e,"delete");let n=await t.client.request(P0,{projectExId:r.projectExId});return(await t.credentialStore.loadProjectContext())?.projectExId===r.projectExId&&await t.credentialStore.deleteProjectContext(),t.schemaManager.clear(),t.ok(n)},n5=async(e,t)=>{let r=await t.getProjectArgs(e);await wa(r.projectExId,e,"reset");let n=G(e.languageType)??"ZH";return t.ok(await t.client.request(N0,{projectExId:r.projectExId,languageType:n}))},i5=async(e,t)=>{let r=await t.getProjectArgs(e);Je(e.refresh,!1)&&await t.client.request(Q0,{projectExId:r.projectExId});let n=G(e.resourceType),[i,o,s,a]=await Promise.all([t.client.request(K0,{projectExId:r.projectExId,nonRealTimeDisplayedResourceTypes:vi(e.nonRealTimeDisplayedResourceTypes)}),t.client.request(J0,{projectExId:r.projectExId}).catch(l=>({error:l instanceof Error?l.message:String(l)})),n?t.client.request(W0,{projectExId:r.projectExId,resourceType:n}):Promise.resolve(null),n?t.client.request(z0,{projectExId:r.projectExId,resourceType:n}):Promise.resolve(null)]),u=o&&"findActiveSingleTenantResourceInfoAndThrowOnExpireTimeMismatch"in o?o.findActiveSingleTenantResourceInfoAndThrowOnExpireTimeMismatch:null,c={usage:bR(i.resourceUsageAndBurstInfo)};return u&&u.length>0&&(c.singleTenant=u),s?.monthlyResourceUsageHistory!=null&&(c.monthly=s.monthlyResourceUsageHistory),a?.dailyResourceUsageHistory!=null&&(c.daily=a.dailyResourceUsageHistory),t.ok(c)},LR={"projects.search":NR,"projects.list":NR,"project.create":z3,"project.set_current":J3,"project.get_current":Y3,"project.detail":X3,"project.metadata":Z3,"project.rename":e5,"project.rename_app":t5,"project.delete":r5,"project.reset":n5,"project.resources":i5};p();p();var o5=`query AgentPreviewApiRequest($definitionById: Json!, $apiWorkspace: Json!, $apiId: String!, $inputs: Json, $inputsFrom: Json) {
1497
+ fz_agent_preview_api_request(definitionById: $definitionById, apiWorkspace: $apiWorkspace, apiId: $apiId, inputs: $inputs, inputsFrom: $inputsFrom)
1498
+ }`,s5=`mutation AgentDebugApi($definitionById: Json!, $apiWorkspace: Json!, $apiId: String!, $inputs: Json, $inputsFrom: Json) {
1499
+ fz_agent_debug_api(definitionById: $definitionById, apiWorkspace: $apiWorkspace, apiId: $apiId, inputs: $inputs, inputsFrom: $inputsFrom)
1500
+ }`,a5=`query AgentDebugRunSample($debugRunId: String!, $path: String) {
1501
+ fz_agent_debug_run_sample(debugRunId: $debugRunId, path: $path)
1502
+ }`,Dy=e=>Array.isArray(e)?e:[],kR=async(e,t)=>{let r=G(e.apiId);if(!r)throw new Error("Provide an 'apiId' (from the api tool's LIST op).");let n=await t.getProjectArgs(e),i=_t(n.projectExId,n);await t.schemaManager.load(i);let o=Y(Y(await t.schemaManager.snapshot(i,!0)).server),s=Dy(o.apiWorkSpaces).find(a=>Dy(Y(a).apis).some(u=>Y(u).uniqueId===r));if(!s)throw new Error(`No API with id ${r}; list them with the api tool's LIST op.`);return{projectArgs:n,variables:{definitionById:Y(Y(o.types).definitionById),apiWorkspace:s,apiId:r,inputs:e.inputs??null,inputsFrom:e.inputsFrom??null}}},Ly=async e=>{try{return await e()}catch(t){let r=t instanceof Error?t.message:String(t);throw/fz_agent_\w*.*(undefined|unknown|not defined)/i.test(r)?new Error("This project's runtime predates masked API test calls (fz_agent_*), so nothing was sent. It needs a platform update; until then use the editor's test button."):t}},u5=async(e,t)=>{let{projectArgs:r,variables:n}=await kR(e,t),i=await sr(t.client,r),o=await Ly(()=>i.adminClient.request(o5,n));return t.ok(o.fz_agent_preview_api_request)},c5=async(e,t)=>{if(!G(e.reason))return t.fail(new Error("Provide a 'reason': one sentence for the user on why this real call is sent."));let{projectArgs:r,variables:n}=await kR(e,t),i=await sr(t.client,r),o=await Ly(()=>i.adminClient.request(s5,n));return t.ok(o.fz_agent_debug_api)},jR=async(e,t,r)=>{let n=o=>{let s=Y(o);return s.name==="APPLY_API_JSON_SAMPLE"&&G(Y(s.args).fromDebugRunId)};if(!e.some(n))return e;let i=await sr(r.client,await r.getProjectArgs(t));return Promise.all(e.map(async o=>{if(!n(o))return o;let s=Y(o),{fromDebugRunId:a,fromDebugRunPath:u,...c}=Y(s.args);if(c.sampleJson!=null)return o;let l=await Ly(()=>i.adminClient.request(a5,{debugRunId:a,path:G(u)??null}));if(!l.fz_agent_debug_run_sample)throw new Error(`Test call ${String(a)} returned no body to sample.`);return{...s,args:{...c,sampleJson:l.fz_agent_debug_run_sample}}}))},l5=async(e,t)=>{let r=G(e.curl),n=G(e.workspaceId);if(!r||!n)return t.fail(new Error("Provide 'curl' and 'workspaceId'."));let i=await t.checkSchema(e),o=await t.getProjectArgs(e),s=_t(o.projectExId,o),u=(await t.client.request(vx,{projectExId:o.projectExId,curl:r})).apiConfigFromCurlV2;if(!u?.api)throw new Error("The curl command could not be read.");let c=G(e.displayName),l=await t.schemaManager.ztypeToolCalls(s,[{name:"IMPORT_CURL_API",args:{workspaceId:n,api:u.api,typeDefinitions:u.typeDefinitions??[],...c?{displayName:c}:{}}}],!1);return t.ok(St({applied:l,ignoredCurlOptions:Dy(u.ignoredOptions).map(d=>Y(d).option),next:"Each secret in movedToSecrets has no value yet: have the user set it with `secret save-value` and its secretId. The value in the curl was not kept."},i))},MR={"api.preview_request":u5,"api.debug":c5,"api.import_curl":l5};async function Gl(e,t){let r=await t.checkSchema(e),n=await t.getProjectArgs(e);return{warning:r,projectArgs:n,sArgs:_t(n.projectExId,n)}}var Lo=e=>async(t,r)=>{let{warning:n,sArgs:i}=await Gl(t,r);return r.ok(St(await e(r.schemaManager,i),n))},p5=Lo((e,t)=>e.load(t)),d5=Lo((e,t)=>e.load(t,!0)),f5=async(e,t)=>{let r=G(e.projectExId)?await t.checkSchema(e):null;return t.ok(St(t.schemaManager.status(),r))},h5=async(e,t)=>t.ok(t.schemaManager.schemaState(G(e.projectExId))),m5=async(e,t)=>t.ok(t.schemaManager.schemaEvents(G(e.projectExId),ve(e.afterEventId),He(e.limit,100))),g5=Lo((e,t)=>e.sync(t)),y5=async(e,t)=>{let{warning:r,sArgs:n}=await Gl(e,t),i=await t.schemaManager.snapshot(n,Je(e.full,!1));return t.ok(St(i,r))},v5=Lo((e,t)=>e.validate(t)),E5=Lo((e,t)=>e.undo(t)),_5=Lo((e,t)=>e.redo(t)),ky=async(e,t)=>{let{warning:r,projectArgs:n,sArgs:i}=await Gl(e,t),o=await t.schemaManager.load(i),s=vy(o,n.appExId??null);if(!s.ok)return{ok:!1,error:s.error,data:St({status:o},r)};let a=await t.schemaManager.validate(i),u=wl(a);if(u.length>0&&!Je(e.allowValidationErrors,!1))return{ok:!1,error:"ztype backend validation errors block backend sync",data:St({ztypeDiagnostics:a,backendErrors:u},r)};let c=await t.schemaManager.saveForDeploy(i),l=vy(c,n.appExId??null);if(!l.ok)throw new Error(`schema.save: ${l.error}`);let d=c.serverDoc??null,f=l.schemaExId,h=l.appExId,g=Je(e.validateMultiClient,!1)&&!!d,y=Je(e.validateMultiClient,!1)&&!d,_=G(e.buildTarget)??"SUPPORT_SERVICE",b={projectExId:n.projectExId,appExId:h,schemaExId:f},S=c.commitExIds?.[f],I;return S&&y?I=await t.client.request($0,{...b,commitExId:S}):S?I=await t.client.request(G0,{...b,commitExId:S,buildTarget:_}):y?I=await t.client.request(V0,b):I=await t.client.request(U0,{...b,buildTarget:_}),t.ok(St({saved:c,deploy:I,ztypeDiagnostics:a,...g?{multiClientValidationSkipped:!0}:{}},r))},S5=async(e,t)=>{let{warning:r,sArgs:n}=await Gl(e,t),i=Array.isArray(e.toolCalls)?e.toolCalls:[];if(i.length===0)throw new Error("toolCalls must be a non-empty array");let o=Je(e.verbose,!1),s=await t.schemaManager.ztypeToolCalls(n,await jR(i,e,t),o,e.readState??null,Je(e.force,!1),e.projectCapabilities??null);return t.ok(St(s,r))},FR={"schema.load":p5,"schema.reload":d5,"schema.status":f5,"schema.state":h5,"schema.events":m5,"schema.sync":g5,"schema.snapshot":y5,"schema.validate":v5,"project.sync_backend":ky,"schema.ztype_tool_calls":S5,"schema.undo":E5,"schema.redo":_5};p();p();var Pt=e=>Array.isArray(e)?e:[],$l=e=>Y(Y(e).server),b5=e=>{for(let t of e){let r=Y(t);if(r.type==="FLOW_END"&&r.removable!==!0)return ve(r.uniqueId)}return null},qR=(e,t)=>{let n=Pt($l(e).actionFlows).find(s=>Y(s).uniqueId===t);if(!n)throw new Error(`No action flow with id ${t}`);let i=Y(n),o=b5(Pt(i.allNodes));if(!o)throw new Error(`Action flow ${t} has no terminal end node, so it cannot be debugged.`);return{definition:i,endNodeId:o,displayName:ve(i.displayName),isAsync:i.isAsync===!0}},T5=(e,t)=>{let r=Y(e),n=Y(t);return r.id===n.id&&r.namespace===n.namespace},UR=(e,t)=>{let r=$l(e),n=Pt(r.zAiConfigs).find(a=>Y(a).id===t);if(!n)throw new Error(`No AI agent with id ${t}`);let i=Y(n),o=i.customModelIdentifier,s=o?Pt(r.customAiModelConfigs).map(Y).find(a=>T5(a.id,o)):void 0;return{definition:i,...s?{customLLMConfig:s}:{},typeDefinitions:Y(Y(r.types).definitionById)}},My=50,I5=e=>{for(let t=0;t<e.length-1;t++)if(e[t].key==="componentById")return ve(e[t+1].key);return null},VR=(e,t=My)=>{let r=Y(e);if(r.available===!1)return{count:0,errors:[],unavailable:!0};let n=[...Pt(r.stableErrors),...Pt(r.betaErrors)].map(Y),i=n.slice(0,t).map(s=>{let a=Pt(s.fullPath).map(Y),u={message:ve(s.message)??"",path:a},c=ve(s.platform);c&&(u.platform=c);let l=I5(a)??ve(s.componentId);return l&&(u.componentId=l),u}),o={count:n.length,errors:i};return n.length>i.length&&(o.truncated=!0),o},w5=e=>{let t=Y(e);if(!(e===void 0||t.available===!1))return Pt(t.stableErrors).length+Pt(t.betaErrors).length},GR=(e,t,r,n)=>{let i=w5(Y(t).ztypeDiagnostics),o=e?n===null?{status:"IN_PROGRESS",message:"The backend sync has not finished yet. Call sync_backend again to keep waiting for it."}:n==="FINISHED"?{status:"SYNCED",message:"The backend is synced: the saved schema is live on the project runtime."}:{status:"FAILED",message:"The backend sync failed. Inspect the project errors and the DEPLOYMENT logs for the cause, fix it, and sync again."}:{status:"FAILED",message:r??"The backend sync was refused and reported no reason."};return i!==void 0&&(o.projectErrorCount=i),o},O5=e=>{let t=new Map;for(let r of Pt(e.actionFlows)){let n=Y(r),i=ve(n.uniqueId),o=ve(n.displayName);i&&o&&t.set(i,o)}return t},A5=e=>{let t=new Map;for(let r of Pt(Y(e.dataModel).tables)){let n=Y(r),i=ve(n.uniqueId)??ve(n.id),o=ve(n.name);i&&o&&t.set(i,o)}return t},$R=e=>{let t=$l(e),r=O5(t),n=A5(t),i=Pt(t.triggerConfigurations).map(s=>{let a=Y(s),u=ve(a.tableId);return{triggerId:ve(a.uniqueId),displayName:ve(a.displayName),enabled:a.enabled===!0,tableName:u?n.get(u)??null:null,operation:ve(Y(a.trigger).dbOperationType),flowNames:Pt(a.actions).map(c=>ve(Y(c).actionFlowUniqueId)).filter(c=>!!c).map(c=>r.get(c)).filter(c=>!!c)}}),o=Pt(t.scheduledJobConfigurations).map(s=>{let a=Y(s),u=ve(Y(a.action).actionFlowUniqueId);return{triggerId:ve(a.uniqueId),name:ve(a.name),enabled:a.enabled!==!1,cron:ve(a.cron),flowName:u?r.get(u)??null:null}});return{dbTriggers:i,scheduledTriggers:o}},x5=["dataModel","actionFlows","callbackConfigurations","scheduledJobConfigurations","triggerConfigurations","apiWorkSpaces","zAiConfigs","roleConfigs","authenticationConfig","secretConfigs"],jy=(e,t)=>{if(e===t)return!0;if(e==null)return t==null;if(t==null)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((r,n)=>jy(r,t[n]));if(typeof e=="object"&&typeof t=="object"){let r=e,n=t,i=new Set([...Object.keys(r),...Object.keys(n)]);for(let o of i)if(!jy(r[o],n[o]))return!1;return!0}return!1},BR=(e,t)=>{if(t==null)return{hasPendingChanges:!1,changedAreas:[],known:!1};let r=$l(e),n=Y(t),i=x5.filter(o=>!jy(r[o],n[o]));return{hasPendingChanges:i.length>0,changedAreas:[...i],known:!0}};p();import{randomUUID as S6}from"crypto";var lN=Qe(uN(),1);var b6=e=>!!e.errorMessage||!e.nextNodeId,np=1e4,T6=e=>e>=55296&&e<=56319,cN=e=>{let t=JSON.stringify(e);if(t===void 0||t.length<=np)return e;let r=T6(t.charCodeAt(np-1))?np-1:np;return{note:`Only the first ${r.toLocaleString("en-US")} of ${t.length.toLocaleString("en-US")} characters of this value are shown; query the data it came from to read the rest.`,head:t.slice(0,r)}},I6=e=>({nodeType:e.nodeType,nodeId:e.nodeId,input:cN(e.input),output:cN(e.output),executionDurationMillis:e.executionDurationMillis,errorMessage:e.errorMessage,traceId:e.traceId}),w6=(e,t)=>new Promise((r,n)=>{let i=[],o=!1,s={},a=c=>{o||(o=!0,clearTimeout(u),s.subscription?.unsubscribe(),c())},u=setTimeout(()=>a(()=>r({nodes:i,timedOut:!0})),t);try{s.subscription=e.subscribe({next:c=>{o||(i.push(I6(c)),b6(c)&&a(()=>r({nodes:i,timedOut:!1})))},error:c=>a(()=>n(c)),complete:()=>a(()=>r({nodes:i,timedOut:!1}))})}catch(c){a(()=>n(c));return}o&&s.subscription.unsubscribe()}),O6=`mutation AgentSaveDebugActionFlowContext($request: DebugActionFlowRequestInput!) {
1503
+ fz_save_debug_action_flow_context(request: $request)
1504
+ }`,A6=`subscription AgentDebugActionFlow($contextId: String!) {
1505
+ fz_debug_action_flow(contextId: $contextId)
1506
+ }`,x6=1100,C6=2,R6=5e3,P6=60,N6=e=>e instanceof qr&&e.response.status===429,D6=async e=>{for(let t=0;;t++){try{return await e()}catch(r){if(t===C6||!N6(r))throw r}await new Promise(r=>setTimeout(r,x6))}},Rv=e=>{let t=Array.isArray(e)?e[0]:e;return t instanceof Error?t.message:Y(t).message??JSON.stringify(t)},L6=e=>Y(typeof e=="string"?JSON.parse(e):e),k6=(e,t,r)=>({subscribe:n=>{let i=new lN.SubscriptionClient(e,{lazy:!0,reconnect:!1,minTimeout:1e4,connectionParams:t,connectionCallback:s=>{s&&n.error(new Error(`The runtime refused the debug connection: ${Rv(s)}`))}},Al);i.onDisconnected(()=>n.error(new Error("The runtime closed the debug connection before the run finished")));let o=i.request({query:A6,variables:{contextId:r}}).subscribe({next:({data:s,errors:a})=>{if(a?.length){n.error(new Error(a.map(Rv).join("; ")));return}let u=Y(s).fz_debug_action_flow;if(u==null)return;let c;try{c=L6(u)}catch{n.error(new Error("Could not parse a debug node output from the runtime"));return}n.next(c)},error:s=>n.error(new Error(Rv(s))),complete:n.complete});return{unsubscribe:()=>{o.unsubscribe(),i.close(!0,!0)}}}}),pN=async(e,t,r,n)=>{if(!e.adminSubscriptionUrl)throw new Error("The project has no admin runtime endpoint; deploy it before debugging a flow");let o=(await D6(()=>e.adminClient.request(O6,{request:t})))?.fz_save_debug_action_flow_context;if(!o)throw new Error("The runtime did not return a debug context for this run");let s={authToken:e.adminToken,"X-SESSION-ID":S6()};r&&(s["X-MOCK-ACCOUNT-ID"]=String(r));let a=He(t.timeoutSeconds,P6)*1e3+R6;return w6(k6(e.adminSubscriptionUrl,s,o),Math.max(0,Math.min(a,n-Date.now())))};var Ma=async(e,t)=>{let r=await t.getProjectArgs(e),n=_t(r.projectExId,r);return await t.schemaManager.load(n),{projectArgs:r,sArgs:n,snapshot:await t.schemaManager.snapshot(n,!0)}},j6=async(e,t)=>{let r=G(e.flowId);if(!r)return t.fail(new Error("Provide a 'flowId'."));let{snapshot:n}=await Ma(e,t);return t.ok(qR(n,r))},M6=async(e,t)=>{let r=G(e.configId);if(!r)return t.fail(new Error("Provide a 'configId'."));let{snapshot:n}=await Ma(e,t);return t.ok(UR(n,r))},F6=1e5,q6=async(e,t)=>{let r=Date.now()+F6,n=Y(e.request);if(!n.actionFlowDefinition||!G(n.endNodeId))return t.fail(new Error("Provide a 'request' holding the flow's 'actionFlowDefinition' and 'endNodeId'."));let i=await t.getProjectArgs(e),o=await sr(t.client,i),s=He(e.mockAccountId,0);return t.ok(await pN(o,n,s||null,r))},U6=async(e,t)=>{let{snapshot:r}=await Ma(e,t);return t.ok($R(r))},V6=async(e,t)=>{let{projectArgs:r,snapshot:n}=await Ma(e,t),i=await t.client.request(mx,{projectExId:r.projectExId});return t.ok(BR(n,i?.project?.lastDeployedServerSchema??null))},G6=async(e,t)=>{let{sArgs:r}=await Ma(e,t);return t.ok(VR(await t.schemaManager.validate(r),He(e.limit,My)))},$6=9e4,B6=2e3,dN=async(e,t)=>(await e.client.request(hx,{projectExId:t})).project?.lastAllPipelinePlatformStatus.find(n=>n.buildTarget==="SUPPORT_SERVICE")??null,H6=async(e,t,r,n)=>{for(;;){let i=await dN(e,t);if(i&&i.status!=="DEPLOYING"&&n(i))return i.status;if(Date.now()>=r)return null;await new Promise(o=>setTimeout(o,B6))}},K6=async(e,t)=>{let r=Date.now()+$6,{projectExId:n}=await t.getProjectArgs(e),i=await dN(t,n),o=i?.status==="DEPLOYING",s=o?t.ok():await ky(e,t),a=s.ok?await H6(t,n,r,u=>o||u.startedAt!==i?.startedAt):null;return t.ok(GR(s.ok,s.data,s.error??null,a))},Q6=async(e,t)=>{if(e.appExId)return e.appExId;let r=await mi(t.client,e.projectExId);if(r.length===0)throw new Error("The project has no client app, so there is no canvas to render.");let n=Co(r);if(!n)throw new Error(`Pass appExId: the project has ${r.length} client apps (${r.map(i=>i.appExId).join(", ")}), so the canvas to render is ambiguous.`);return n},ip=async(e,t,r,n)=>{let i=Date.now()+Sa,o=await n.getProjectArgs(r),s=_t(o.projectExId,o),a=await Q6(o,n),u=await n.client.request(sl);if(!u?.user?.exId)throw new Error("Could not resolve the signed-in account to render the canvas as.");return jl.run({projectExId:o.projectExId,appExId:a,token:await n.tokenManager.getValidToken(),user:{exId:u.user.exId,username:u.user.username??null}},{rpc:e,args:t,sessionExId:G(r.sessionExId)??"",pageId:G(r.pageId)??null,breakpoint:G(r.breakpoint)??null,lastPatchExIds:await n.schemaManager.lastPatchExIds(s),deadline:i})},W6=["pageId","componentId","mode","breakpoint","maxWidth","limit"],op=e=>Object.fromEntries(W6.filter(t=>e[t]!==void 0).map(t=>[t,e[t]])),z6=async(e,t)=>t.ok(await ip("editor.getClippedComponents",op(e),e,t)),J6=async(e,t)=>G(e.sessionExId)?t.ok(await ip("editor.captureCanvas",op(e),e,t)):t.fail(new Error("Provide 'sessionExId': the capture is stored as that agent session's media.")),Y6=async(e,t)=>{let r=G(e.name)?.trim().slice(0,100);if(!r)return t.ok({status:"NOT_SAVED",message:"A version needs a non-empty name."});let n=await t.getProjectArgs(e),i=_t(n.projectExId,n);try{return t.ok(await t.schemaManager.takeAgentSchemaCommit(i,r))}catch(o){return t.ok({status:"NOT_SAVED",message:`The version could not be taken: ${o.message}`})}},fN={"bridge.flow_definition":j6,"bridge.agent_definition":M6,"bridge.debug_flow":q6,"bridge.trigger_bindings":U6,"bridge.deploy_status":V6,"bridge.project_errors":G6,"bridge.sync_backend":K6,"bridge.save_version_history":Y6,"bridge.clipped_components":z6,"bridge.capture_canvas":J6};p();p();var X6=/Subselection required for type '(FZ_\w+)' of field '([^'/]+\/)?([^']+)'/,Z6=/Unknown field argument '(where|limit|offset|order_by)'/,eX=/Field '([^']+)' in type '([^']+)' is undefined/,tX=/field name '([^']+)' that is not defined for input object type '(\w+)'/,rX=(e,t)=>{let r=Array.from({length:t.length+1},(n,i)=>i);for(let n=1;n<=e.length;n+=1){let i=[n];for(let o=1;o<=t.length;o+=1)i[o]=Math.min(r[o]+1,i[o-1]+1,r[o-1]+(e[n-1]===t[o-1]?0:1));r=i}return r[t.length]},mN=(e,t)=>{let r=Math.max(2,Math.ceil(t.length/2));return e.map(n=>({name:n,score:rX(n.toLowerCase(),t.toLowerCase())})).filter(n=>n.score<=r).sort((n,i)=>n.score-i.score).slice(0,3).map(n=>n.name)},nX=e=>(e?.tableMetadata??[]).flatMap(t=>[t?.name,t?.displayName].filter(r=>typeof r=="string"&&r.length>0)),sp=(e,t)=>(e?.tableMetadata??[]).find(r=>r?.name===t),hN=(e,t)=>{let r=t?.columnMetadata??[],n=r.find(o=>o?.displayName===e&&o?.name);if(n){let o=Ml(n)??n.name;return`'${e}' is a column DISPLAY name, which the runtime never accepts \u2014 pass '${o}'.`}if(r.some(o=>o?.name===e))return`'${e}' is in the project schema but not in the deployed backend. Run 'project sync-backend', then retry.`;let i=mN(r.flatMap(o=>[o?.name,o?.displayName]).filter(o=>typeof o=="string"&&o.length>0),e);return i.length>0?`No column '${e}'. Closest: ${i.join(", ")}.`:`No column '${e}' on this table.`},iX=(e,t,r)=>{let n=X6.exec(e);if(n){let c=n[3];return`'${c}' is a media column \u2014 the runtime takes the asset id as '${c}_id', the only form it filters, sorts or writes. Read the asset's url or metadata with runtime graphql instead: ${c} { id url }.`}if(Z6.test(e))return`'${t}' exists in the runtime but is not a table collection \u2014 it takes no where/limit/order_by. Query it with runtime graphql instead.`;let i=tX.exec(e);if(i)return hN(i[1],sp(r,t));let o=eX.exec(e);if(!o)return null;let[,s,a]=o;if(a!=="Query"&&a!=="Mutation")return hN(s,sp(r,t));if(sp(r,t))return`'${t}' is in the project schema but not in the deployed backend. Run 'project sync-backend', then retry \u2014 every runtime call hits the deployed app, never the draft.`;let u=mN(nX(r),t);return u.length>0?`No table '${t}' in the project schema. Closest: ${u.join(", ")}.`:`No table '${t}' in the project schema \u2014 'schema snapshot' lists the ones there are.`},gN=(e,t,r)=>{let n=e instanceof Error?e.message:String(e),i=iX(n,t,r);return i?e instanceof Error?(e.runtimeDiagnosis=i,e):new Error(`${n}
1507
+ ${i}`):e},yN=(e,t,r)=>{let n=e?.tableMetadata??[];if(!n.some(o=>o?.name===t)){let o=n.find(s=>s?.displayName===t&&s?.name);if(o?.name)throw new Error(`'${t}' is a table DISPLAY name, which the runtime never accepts \u2014 pass '${o.name}'.`)}let i=sp(e,t)?.columnMetadata??[];for(let o of r??[]){let s=i.find(u=>u?.name===o)??i.find(u=>u?.displayName===o),a=s?Ml(s):null;if(!(!s||!a||a===o))throw new Error(s.name===o?`'${o}' is a media column \u2014 pass '${a}', the asset id, which is the only form the runtime filters, sorts or writes. For the asset's url or metadata, select subfields with runtime graphql: ${o} { id url }.`:`'${o}' is a column DISPLAY name, which the runtime never accepts \u2014 pass '${a}'.`)}};p();p();var oX=/^[A-Za-z_][A-Za-z0-9_]*$/,jn=(e,t)=>{if(!oX.test(e))throw new Error(`${t} must be a GraphQL identifier`)},Pv=(e,t)=>{for(let r of e)jn(r,t)},ap=(e,t)=>{if(e.length===0)throw new Error("at least one field must be selected");return Pv(e,"fields"),e.map(r=>`${t}${r}`).join(`
1508
+ `)},vN=(e,t)=>(jn(e,"table"),`query AgentQuery($where: ${e}_bool_exp, $limit: Int, $offset: Int, $order_by: [${e}_order_by!]) {
1509
+ ${e}(where: $where, limit: $limit, offset: $offset, order_by: $order_by) {
1510
+ ${ap(t," ")}
1511
+ }
1512
+ }`),EN=e=>(jn(e,"table"),`query AgentAggregate($where: ${e}_bool_exp) {
1513
+ ${e}_aggregate(where: $where) {
1514
+ aggregate {
1515
+ count
1516
+ }
1517
+ }
1518
+ }`),_N=(e,t)=>(jn(e,"table"),`mutation AgentInsert($objects: [${e}_insert_input!]!) {
1519
+ insert_${e}(objects: $objects) {
1520
+ affected_rows
1521
+ returning {
1522
+ ${ap(t," ")}
1523
+ }
1524
+ }
1525
+ }`),SN=(e,t)=>(jn(e,"table"),`mutation AgentUpdate($where: ${e}_bool_exp!, $set: ${e}_set_input!) {
1526
+ update_${e}(where: $where, _set: $set) {
1527
+ affected_rows
1528
+ returning {
1529
+ ${ap(t," ")}
1530
+ }
1531
+ }
1532
+ }`),bN=(e,t)=>(jn(e,"table"),`mutation AgentDelete($where: ${e}_bool_exp!) {
1533
+ delete_${e}(where: $where) {
1534
+ affected_rows
1535
+ returning {
1536
+ ${ap(t," ")}
1537
+ }
1538
+ }
1539
+ }`),TN=()=>`mutation AgentRunCode($jsCode: String!, $args: JsonObject, $updateDb: Boolean!) {
1540
+ fz_debug_action_code(jsCode: $jsCode, args: $args, updateDb: $updateDb)
1541
+ }`;var sX=20,aX=200,uX=20,Nv="id",Dv=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:{},xN=e=>Array.isArray(e)?e:[],cX=(e,t)=>typeof e=="boolean"?e:e==null?t:String(e).toLowerCase()==="true",IN=(e,t)=>typeof e=="number"&&Number.isFinite(e)?Math.trunc(e):t,wN=(e,t)=>{let r=e[t];if(typeof r!="string"||r.trim()==="")throw new Error(`'${t}' is required.`);return r},ON=(e,t,r)=>{let n=Dv(e.where);if(Object.keys(n).length>0)return n;if(e[r]===!0)return{};throw new Error(`'where' is required and must not be empty \u2014 this ${t} runs against the live app and there is no change-everything option.`)},up=(e,t)=>{let r=xN(e.fields).filter(n=>typeof n=="string"&&n.trim()!=="");return r.length>0?(Pv(r,"fields"),r):t.length>0?t.slice(0,uX):[Nv]},AN=e=>e.includes(Nv)?e:[Nv,...e],Lv=(e,t,r=[])=>{if(e==="runtime.run_code")return{document:TN(),variables:{jsCode:wN(t,"jsCode"),args:Dv(t.args),updateDb:cX(t.updateDb,!1)},rootField:"fz_debug_action_code"};let n=wN(t,"tableName");switch(jn(n,"tableName"),e){case"runtime.query":return{document:vN(n,up(t,r)),variables:{where:t.where??{},limit:Math.min(IN(t.limit,sX),aX),offset:IN(t.offset,0),order_by:t.orderBy??null},rootField:n};case"runtime.aggregate":return{document:EN(n),variables:{where:t.where??{}},rootField:`${n}_aggregate`};case"runtime.insert":{let i=xN(t.objects);if(i.length===0)throw new Error("'objects' must contain at least one row to insert.");if(i.some(o=>!o||typeof o!="object"||Array.isArray(o)))throw new Error("every entry in 'objects' must be an object of column values.");return{document:_N(n,AN(up(t,r))),variables:{objects:i},rootField:`insert_${n}`}}case"runtime.update":{let i=ON(t,"update","allowUpdateAll"),o=Dv(t.set);if(Object.keys(o).length===0)throw new Error("'set' must contain at least one column to change.");return{document:SN(n,up(t,r)),variables:{where:i,set:o},rootField:`update_${n}`}}case"runtime.delete":return{document:bN(n,AN(up(t,r))),variables:{where:ON(t,"delete","allowDeleteAll")},rootField:`delete_${n}`};default:throw new Error(`'${e}' is not a planned runtime operation.`)}},CN=e=>{if(!e||typeof e!="object"||Array.isArray(e))return e;let t=Object.keys(e);return t.length===1?e[t[0]]:e};async function Fa(e,t,r,n){let i=await r.checkSchema(t),o=await r.getProjectArgs(t),s=Ei(t.tableName,"tableName"),[a,u]=await Promise.all([r.schemaManager.dataModel(_t(o.projectExId,o)),sr(r.client,o)]);yN(a,s,vi(t.fields));let c=Lv(e,{...t,tableName:s},fR(a,s)),l;try{l=await u.dataClient.request(c.document,c.variables)}catch(d){throw gN(d,s,a)}return r.ok(St(n?CN(l):l,i))}var lX=async(e,t)=>{let r=await t.checkSchema(e),n=await t.getProjectArgs(e),i=Ei(e.query,"query"),s=await(await sr(t.client,n)).dataClient.request(i,e.variables??{});return t.ok(St(s,r))},pX=async(e,t)=>Fa("runtime.query",e,t,!1),dX=async(e,t)=>Fa("runtime.aggregate",e,t,!1),fX=async(e,t)=>Fa("runtime.insert",e,t,!0),hX=async(e,t)=>Fa("runtime.update",e,t,!0),mX=async(e,t)=>Fa("runtime.delete",e,t,!0),gX=async(e,t)=>{let r=await t.getProjectArgs(e),n=Lv("runtime.run_code",e),o=await(await sr(t.client,r)).adminClient.request(n.document,n.variables);return t.ok({keptWrites:n.variables.updateDb===!0,result:o?.fz_debug_action_code})},RN={"runtime.graphql":lX,"runtime.run_code":gX,"runtime.query":pX,"runtime.aggregate":dX,"runtime.insert":fX,"runtime.update":hX,"runtime.delete":mX};p();var yX=["GATEWAY","ACTION_FLOW","ACTION_FLOW_NODE","ACTION_FLOW_CONTEXT_LOG","DEPLOYMENT","TPA","TRIGGER","SQL_GENERATION","GQL","ZAI"],vX=["INFO","WARNING","ERROR"],EX=50,_X=100,PN=5,NN=e=>`${e.toISOString().slice(0,19)}Z`,SX=e=>{if(!e)return new Date;let t=new Date(e);return Number.isNaN(t.getTime())?new Date:t},DN=(e,t)=>{if(!e)return;let r=e.map(n=>n.toUpperCase()).filter(n=>t.includes(n));return r.length>0?r:void 0},bX=async(e,t)=>{let r=await t.getProjectArgs(e),{adminToken:n}=await sr(t.client,r),i=SX(G(e.requestCreatedAt)),o={start:NN(new Date(i.getTime()-PN*6e4)),end:NN(new Date(i.getTime()+PN*6e4)),desc:!0},s=DN(vi(e.types),yX);s&&(o.type=s);let a=DN(vi(e.levels),vX);a&&(o.level=a);let u=G(e.customQueryCondition);u&&(o.customQueryCondition=u);let c=Math.min(_X,He(e.limit,EX)),l=Ht().logApiUrlTemplate.replace("{projectExId}",r.projectExId),h=((await new at(l,{headers:{authorization:`Bearer ${n}`},fetch:Ro}).request(Ex,{queryCreation:o,paginator:{first:c}}))?.fetchLogsByPaginator?.edges??[]).map(g=>g?.node).filter(g=>!!g);return t.ok({entries:h})},LN={"logs.search":bX};p();p();var TX=async()=>(await import("./corpus-2LB3HZNC.js")).DOCS_CORPUS,IX=3,kN=null,wX=e=>{let t=new Map;for(let r of e)t.set(r.path,r);for(let r of e)for(let n of r.aliases??[])t.has(n)||t.set(n,r);return t},OX=e=>{let t=e.map(r=>{let n=Rp(r.content),i=Rp(r.title);for(let o=0;o<IX;o+=1)n.push(...i);return{ref:r,tokens:n}});return{index:sE(t),byPath:wX(e)}},jN=async()=>(kN??=OX(await TX()),kN),MN=async(e,t=10)=>{let{index:r}=await jN();return aE(r,e).filter(n=>n.score>0).sort((n,i)=>i.score-n.score).slice(0,Math.max(1,t)).map(n=>({path:n.ref.path,title:n.ref.title,url:n.ref.url}))},AX=e=>{let t=e.trim().replace(/\.mdx$/,"").replace(/^\/+/,"/").replace(/\/+$/,"");return t===""||t==="/"?"/":t.startsWith("/")?t:`/${t}`},FN=async e=>(await jN()).byPath.get(AX(e))??null;var xX=async(e,t)=>{let r=G(e.query);if(!r)throw new Error("query is required");let n=He(e.limit,10);return t.ok({results:await MN(r,n)})},CX=async(e,t)=>{let r=G(e.path);if(!r)throw new Error("path is required");let n=await FN(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return t.ok(n)},qN={"docs.search":xX,"docs.get_page":CX};p();var Ii=Qe(An(),1);var UN=["saveSchema","deployV2","validateSchemaIdIsLatest","addCodeComponentToProject","changeProjectCodeComponentVersion"],VN=(e,t)=>e.selections.flatMap(r=>{if(r.kind===Ii.Kind.FIELD)return[r.name.value];let n=r.kind===Ii.Kind.INLINE_FRAGMENT?r.selectionSet:t.get(r.name.value)?.selectionSet;return n?VN(n,t):[]}),RX=e=>{let t=(0,Ii.parse)(e),r=new Map;for(let i of t.definitions)i.kind===Ii.Kind.FRAGMENT_DEFINITION&&r.set(i.name.value,i);let n=new Set;for(let i of t.definitions)if(i.kind===Ii.Kind.OPERATION_DEFINITION&&i.operation!=="query")for(let o of VN(i.selectionSet,r))UN.includes(o)||n.add(o);return[...n]},PX=async(e,t)=>{let r=G(e.query);if(!r)throw new Error("query is required");let n=RX(r);if(n.length>0)throw new Error(`platform_graphql refused ${n.join(", ")}: queries pass through unchanged, but mutations are refused except the allow list for client builds and code component versions (${UN.join(", ")}). Make schema changes through ztype_tool_calls (CLI: schema tool-call), which validates each change before it is written.`);let i=e.variables&&typeof e.variables=="object"?e.variables:{};return t.ok(await t.client.request(r,i))},GN={"platform.graphql":PX};p();var NX=async(e,t)=>{let r=await Rt(),n=r?.api?.ZTypePredefinedApi;if(!n)return t.fail(new Error("ztype predefined template API is unavailable"));let o=n.getActionFlowTemplates(Ao(r)).map(s=>({templateCodeId:s.preDefinedCodeId,displayName:s.displayName,group:s.directory,async:s.async,inputs:s.input,outputs:s.output}));return t.ok({templates:o})},$N={"actionflow.list_node_templates":NX};p();import{promises as BN}from"node:fs";import kv from"node:path";var DX=e=>{if(!e)return null;let t=e.split("?")[0]?.split("/").pop();if(!t)return null;let r=t.replace(/\.[a-z0-9]+$/i,"");return r.length>0?r:null},LX=async(e,t)=>{let n=(await t.client.request(I0)).getTabBarIcons.flatMap(i=>i?[{name:DX(i.url),exId:i.exId}]:[]);return t.ok({icons:n,note:n.length===0?"This deployment ships no preset tab-bar icons; upload one in the editor and use its exId.":"A name ending in _selected is the pressed-state partner of the icon with the same prefix; for the plain icons use the same exId for both states."})},kX=async(e,t)=>{let{base64:r,...n}=await ip("CAPTURE",op(e),e,t);if(!r)return t.ok(n);let i=kv.resolve(G(e.out)??kv.join(t.credentialStore.getMcpConfigDir(),"canvas",`canvas-${Date.now()}.png`));return await BN.mkdir(kv.dirname(i),{recursive:!0}),await BN.writeFile(i,Buffer.from(r,"base64")),t.ok({path:i,...n})},HN={"component.tab_bar_icons":LX,"component.capture_canvas":kX};p();p();function jX(e){let t;try{t=new URL(e)}catch{throw new Error(`Unsupported or malformed URL: ${e}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error(`Only http/https URLs are allowed: ${e}`);return t}async function MX(e,t){let r=e.body?.getReader();if(!r)throw new Error(`Empty response body from ${t}`);let n=[],i=0;for(;;){let{done:o,value:s}=await r.read();if(o)break;if(i+=s.byteLength,i>10485760)throw await r.cancel(),new Error("Response exceeds size limit of 10485760 bytes");n.push(s)}return Buffer.concat(n).toString("utf8")}async function KN(e){let t=e;for(let r=0;r<=5;r++){let n=jX(t),i=await fetch(n,{redirect:"manual",signal:AbortSignal.timeout(2e4),headers:{Accept:"application/json, application/yaml, text/yaml, text/html, */*","User-Agent":"Momen-Agent-TpaImport"}});if(i.status>=300&&i.status<400){let o=i.headers.get("location");if(await i.body?.cancel(),!o)throw new Error(`Redirect without Location from ${t}`);t=new URL(o,n).toString();continue}if(!i.ok)throw await i.body?.cancel(),new Error(`HTTP ${i.status} fetching ${t}`);return{finalUrl:n.toString(),contentType:i.headers.get("content-type"),body:await MX(i,t)}}throw new Error(`Too many redirects fetching ${e}`)}p();var FX=/(?:href|src|url)\s*[=:]\s*["']?([^"'\s>)]+)/gi,qX=/<(script|style|noscript|svg|iframe|canvas|template|nav|footer|aside)\b[\s\S]*?<\/\1\s*>/gi,UX=new Set(["css","js","png","jpg","jpeg","gif","svg","ico","woff","woff2","ttf","webp","mp4","zip","pdf"]);function QN(e,t){if(e&&e.toLowerCase().includes("html"))return!0;let r=t.trimStart();return r.startsWith("<")&&!r.startsWith("<?xml")}function WN(e){let t=e.length>4e3?e.slice(0,4e3):e;return t.includes('"openapi"')||t.includes('"swagger"')||/(^|\n)\s*openapi\s*:/.test(t)||/(^|\n)\s*swagger\s*:/.test(t)}function zN(e,t){try{return new URL(t,e).toString()}catch{return t.startsWith("http")?t:null}}var VX=/^https?:\/\/app\.swaggerhub\.com\/apis(?:-docs)?\/([^/?#]+)\/([^/?#]+)\/([^/?#]+)/i;function GX(e){let t=e.match(VX);return t?`https://api.swaggerhub.com/apis/${t[1]}/${t[2]}/${t[3]}`:null}function JN(e,t){let r=[],n=i=>{i&&r.length<20&&!r.includes(i)&&r.push(i)};for(let i of e.matchAll(FX)){if(r.length>=20)break;let o=i[1],s=o.toLowerCase();if(!(s.includes("openapi")||s.includes("swagger")||(s.endsWith(".json")||s.endsWith(".yaml")||s.endsWith(".yml"))&&s.includes("api")))continue;let u=zN(t,o);n(u&&GX(u)),n(u)}return r}function YN(e,t){let r=[],n;try{n=new URL(t).host}catch{return r}for(let i of e.matchAll(/<a\b[^>]*href\s*=\s*["']([^"'#]+)[^"']*["']/gi)){if(r.length>=40)break;let o;try{o=new URL(i[1],t)}catch{continue}if(o.host!==n)continue;o.hash="";let s=o.toString(),a=o.pathname.toLowerCase(),u=a.slice(a.lastIndexOf(".")+1);UX.has(u)||s===t||r.includes(s)||r.push(s)}return r}var $X={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",copy:"\xA9"};function jv(e){return e.replace(/&#x([0-9a-f]+);/gi,(t,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&#(\d+);/g,(t,r)=>String.fromCodePoint(parseInt(r,10))).replace(/&([a-z]+);/gi,(t,r)=>$X[r.toLowerCase()]??t)}var qa=e=>e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function XN(e,t){let r=e.replace(/<!--[\s\S]*?-->/g,"").replace(qX,"");return r=r.replace(/<pre\b[^>]*>([\s\S]*?)<\/pre\s*>/gi,(n,i)=>`
1542
+ \`\`\`
1543
+ ${jv(BX(i))}
1544
+ \`\`\`
1545
+ `),r=r.replace(/<code\b[^>]*>([\s\S]*?)<\/code\s*>/gi,(n,i)=>`\`${jv(qa(i))}\``),r=r.replace(/<a\b[^>]*href\s*=\s*["']([^"']+)["'][^>]*>([\s\S]*?)<\/a\s*>/gi,(n,i,o)=>{let s=qa(o);if(!s)return"";let a=zN(t,i);return a?`[${s}](${a})`:s}),r=r.replace(/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1\s*>/gi,(n,i,o)=>`
1546
+
1547
+ ${"#".repeat(Number(i))} ${qa(o)}
1548
+
1549
+ `),r=r.replace(/<t[hd]\b[^>]*>([\s\S]*?)<\/t[hd]\s*>/gi,(n,i)=>` ${qa(i)} |`).replace(/<tr\b[^>]*>/gi,`
1550
+ |`).replace(/<\/tr\s*>/gi,""),r=r.replace(/<li\b[^>]*>/gi,`
1551
+ - `).replace(/<br\s*\/?>/gi,`
1552
+ `).replace(/<\/(p|div|section|article|ul|ol|table|thead|tbody|dl|blockquote)\s*>/gi,`
1553
+
1554
+ `).replace(/<(strong|b)\b[^>]*>([\s\S]*?)<\/\1\s*>/gi,(n,i,o)=>`**${qa(o)}**`),r=jv(r.replace(/<[^>]+>/g," ")),r.replace(/[^\S\n]+\n/g,`
1555
+ `).replace(/[ \t]{3,}/g," ").replace(/\n{3,}/g,`
1556
+
1557
+ `).trim()}var BX=e=>e.replace(/<[^>]+>/g,"");var eD=15,KX=3600*1e3,ZN=new Map;function QX(e){let t=Date.now(),r=ZN.get(e),n=r&&t-r.startedAt<KX?r:{used:0,startedAt:t};return n.used+=1,ZN.set(e,n),eD-n.used}var WX=async(e,t)=>{let r=G(e.url);if(!r||r.trim()==="")throw new Error("Provide a 'url' to fetch.");let n=QX(t.credentialStore.getWorkspaceRoot());if(n<0)throw new Error(`fetch budget exhausted (${eD} per session) \u2014 build the endpoints from what you have already read.`);let i=await KN(r),o=QN(i.contentType,i.body),s=o?JN(i.body,i.finalUrl):[],a=o?YN(i.body,i.finalUrl):[],u=o?XN(i.body,i.finalUrl):i.body,c=Math.max(0,Math.min(He(e.offset,0),u.length)),l=u.slice(c,c+2e4);return t.ok({finalUrl:i.finalUrl,contentType:i.contentType,looksLikeSpec:WN(i.body),specLinks:s,pageLinks:a,truncated:c+l.length<u.length,totalLength:u.length,fetchesRemaining:n,content:l})},tD={"web.fetch_doc":WX};p();var zX=async(e,t)=>{let r=ve(e.secretId),n=ve(e.displayName),i=ve(e.description);if(!!r==!!n)return t.fail("Provide exactly one of secretId (set an existing secret) or displayName (create a new one).");let o=await t.checkSchema(e),s=await t.getProjectArgs(e),a=_t(s.projectExId,s),u=await t.schemaManager.serverSchemaExId(a);if(!u)throw new Error("A secret value is stored under the project's backend document, which this session could not load \u2014 `schema status` reports why in staleReason.");let c=await xR(n??r),d=(await t.client.request(ox,{projectExId:s.projectExId,schemaExId:u,secretValue:c})).saveSecret?.secretKey;if(!d)throw new Error("saveSecret did not return a secretKey.");let f=r?{name:"UPDATE_SECRET_CONFIG",args:{secretId:r,secretKey:d}}:{name:"ADD_SECRET_CONFIGS",args:{items:[{displayName:n,secretKey:d,...i?{description:i}:{}}]}},h=await t.schemaManager.ztypeToolCalls(a,[f],!1);return t.ok(St({status:"SAVED",applied:h},o))},rD={"secret.save_value":zX};p();p();p();import{createHash as JX}from"node:crypto";import cp from"node:fs/promises";import lp from"node:path";var vr=class extends Error{},YX=1024,XX=255,ZX=e=>{let t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0||r===t.length-1?null:t.slice(r+1).toLowerCase()},nD=(e,t)=>lp.relative(e,t).split(lp.sep).join("/").normalize("NFC"),eZ=e=>{if(e.length>YX||e.startsWith("/")||e.endsWith("/")||e.includes("\\")||e.includes("//")||e.includes(":"))throw new vr(`Invalid asset path: ${e}`);for(let t of e.split("/"))if(t===""||t==="."||t===".."||t.length>XX)throw new vr(`Invalid asset path: ${e}`);for(let t of e){let r=t.charCodeAt(0);if(r<32||r===127)throw new vr(`Invalid asset path: ${e}`)}},tZ=async e=>{let t=JX("md5"),r=await cp.open(e,"r");try{let n=r.createReadStream();for await(let i of n)t.update(i)}finally{await r.close()}return t.digest("base64")},iD=async(e,t,r,n)=>{let i=await cp.readdir(t,{withFileTypes:!0}),o=[],s=[];for(let a of i){let u=lp.join(t,a.name),c=n&&a.name.startsWith(".");if(a.isDirectory()){if(c||r.has(a.name)){s.push(`${nD(e,u)}/`);continue}let l=await iD(e,u,r,n);o.push(...l.files),s.push(...l.prunedDirectories)}else a.isFile()&&!c&&o.push(u)}return{files:o,prunedDirectories:s}};async function pp(e,t,r={}){let n=lp.resolve(e);if(!(await cp.stat(n).catch(()=>null))?.isDirectory())throw new vr(`Not a directory: ${n}`);let o=r.maxFileSizeBytes??t.maxFileSizeBytes,s=t.reservedFiles??new Set,a=await iD(n,n,t.ignoredDirectories??new Set,t.ignoreHidden??!1),u=a.files.sort(),c=[],l=[...a.prunedDirectories.sort()],d=[],f=0;for(let h of u){let g=nD(n,h);if(s.has(g)){d.push(g);continue}let y=ZX(g);if(y===null||!t.allowedExtensions.has(y)){l.push(g);continue}eZ(g);let{size:_}=await cp.stat(h);if(_>o)throw new vr(`${g} is ${_} bytes, over the ${o}-byte per-file limit`);c.push({path:g,absolutePath:h,md5Base64:await tZ(h),sizeBytes:_}),f+=_}if(c.length===0)throw new vr(`No uploadable files found under ${n}`);if(!c.some(h=>h.path===t.entryFile))throw new vr(`${n} has no ${t.entryFile} at its root \u2014 a ${t.label} deployment must have one. ${t.entryHint}`);if(t.maxFileCount!==void 0&&c.length>t.maxFileCount)throw new vr(`${n} holds ${c.length} uploadable files, over the ${t.maxFileCount}-file limit`);if(t.maxTotalBytes!==void 0&&f>t.maxTotalBytes)throw new vr(`${n} totals ${f} bytes, over the ${t.maxTotalBytes}-byte package limit`);return{files:c,totalBytes:f,skipped:l,reserved:d}}var rZ=new Set(["html","htm","js","mjs","cjs","css","map","json","webmanifest","txt","xml","csv","wasm","pdf","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","woff","woff2","ttf","otf","eot","mp4","webm","mp3","wav","ogg"]),nZ="index.html",iZ=2*1024*1024*1024,oZ={label:"static site",entryFile:nZ,entryHint:"Point --dir at the build output directory (e.g. ./dist), not the project root.",allowedExtensions:rZ,maxFileSizeBytes:iZ};function oD(e,t={}){return pp(e,oZ,t)}p();import sZ from"node:fs/promises";var aZ=12e4,uZ=1e3/(1024*1024),sD=3,cZ=500,lZ=256*1024*1024,pZ=e=>new Promise(t=>setTimeout(t,e)),dZ=e=>e>=500||e===429,fZ=async(e,t,r)=>{let n=AbortSignal.timeout(Math.ceil(aZ+t.byteLength*uZ)),i=await fetch(e.uploadUrl,{method:"PUT",headers:e.headers,body:t,signal:r?AbortSignal.any([r,n]):n});if(!i.ok){let o=await i.text().catch(()=>""),s=new Error(`PUT ${e.path} failed with ${i.status}${o?`: ${o.slice(0,300)}`:""}`);throw dZ(i.status)||Object.assign(s,{fatal:!0}),s}await i.body?.cancel()},hZ=async(e,t,r)=>{let n=await sZ.readFile(t),i;for(let o=1;o<=sD;o+=1)try{await fZ(e,n,r);return}catch(s){if(i=s,r?.aborted||s.fatal||o===sD)break;await pZ(cZ*2**(o-1))}throw i},Mv=class{constructor(t){this.limit=t}inFlight=0;waiters=[];async acquire(t){for(;this.inFlight>0&&this.inFlight+t>this.limit;)await new Promise(r=>this.waiters.push(r));this.inFlight+=t}release(t){this.inFlight-=t;let r=this.waiters;this.waiters=[];for(let n of r)n()}};async function dp(e,t,r,n){let i=[],o=[],s=new Mv(lZ),a=0,u=async()=>{for(;;){if(n?.aborted)return;let l=a;if(a+=1,l>=e.length)return;let d=e[l],f=t(d.path);if(!f){o.push({path:d.path,error:"no local file matches this manifest path"});continue}await s.acquire(f.sizeBytes);try{await hZ(d,f.absolutePath,n),i.push(d.path)}catch(h){o.push({path:d.path,error:h instanceof Error?h.message:String(h)})}finally{s.release(f.sizeBytes)}}},c=Math.max(1,Math.min(r,e.length));return await Promise.all(Array.from({length:c},()=>u())),{uploaded:i,failures:o}}var mZ=8,gZ=32,aD=200,yZ=6,vZ=6e4,EZ=3,uD=e=>{let t=(G(e.target)??"BETA").toUpperCase();if(t!=="BETA"&&t!=="PROD")throw new Error(`target must be BETA or PROD, got ${t}`);return t},Fv=async(e,t)=>{let r=await t.getProjectArgs(e),n=r.appExId??null;if(!n)throw new Error("site commands act on a client app, and this call resolved to the project itself. Pin one with set_current_project (appExId), or pass appExId here; take it from `project metadata` -> apps[], the entry whose appType is WEB. A project with no client app has no site domain and cannot host a static site.");return{projectExId:r.projectExId,appExId:n,target:uD(e)}},qv=(e,t)=>t.client.request(nx,e),cD=(e,t,r)=>r.client.request(rx,{projectExId:e.projectExId,appExId:e.appExId,staticSiteDeploymentExId:t}),lD=async(e,t,r,n)=>(await n.client.request(tx,{projectExId:e.projectExId,appExId:e.appExId,staticSiteDeploymentExId:t,dryRun:r})).completeStaticSiteDeployment,pD=async(e,t,r,n,i)=>{let o=await i.client.request(ex,{projectExId:e.projectExId,appExId:e.appExId,staticSiteDeploymentExId:t,offset:n?null:r,limit:n?null:aD,paths:n}),s=(o.staticSiteUploadUrls.items??[]).filter(u=>u!==null),a=s.map(u=>Date.parse(String(u.expiresAt??""))).filter(u=>Number.isFinite(u));return{targets:s.map(u=>({path:u.path??"",uploadUrl:u.uploadUrl??"",headers:u.headers??{}})),nextOffset:o.staticSiteUploadUrls.nextOffset??null,expiresAt:a.length?Math.min(...a):null}},_Z=e=>e!==null&&e-vZ<=Date.now(),SZ=async(e,t,r,n,i,o)=>{let s=[],a=[],u=r;for(let c=1;;c+=1){let l=await dp(u.targets,h=>n.get(h),i,o.signal);s.push(...l.uploaded);let f=_Z(u.expiresAt)&&c<EZ&&!o.signal?.aborted?l.failures.filter(h=>n.has(h.path)):[];if(a.push(...l.failures.filter(h=>!f.includes(h))),f.length===0)return{uploaded:s,failures:a};u=await pD(e,t,null,f.map(h=>h.path),o)}},bZ=async(e,t,r,n,i,o)=>{let s=[],a=[],u=i?null:0,c=i?[...i]:null;for(;;){o.signal?.throwIfAborted();let l=c?.splice(0,aD)??null;if(l&&l.length===0)break;let d=await pD(e,t,l?null:u,l,o),f=await SZ(e,t,d,r,n,o);if(s.push(...f.uploaded),a.push(...f.failures),l)continue;let h=d.nextOffset;if(h!==null&&u!==null&&h<=u)throw new Error(`upload url pagination stalled at offset ${u} (server returned ${h})`);if(u=h,u===null)break}return{uploaded:s,failures:a}},TZ=(e,t)=>{if(e.length!==t.length)return!1;let r=new Map(t.map(n=>[n.path??"",n.md5Base64??""]));return e.every(n=>r.get(n.path)===n.md5Base64)},IZ=async(e,t,r,n)=>{let o=(await qv(e,n)).inProgressStaticSiteDeployment;if(o){if(!r&&TZ(t,o.manifest))return{deploymentExId:o.exId,resumed:!0,resumedStatus:o.status};await cD(e,o.exId,n)}return{deploymentExId:(await n.client.request(Z0,{projectExId:e.projectExId,appExId:e.appExId,target:e.target,files:t.map(a=>({path:a.path,md5Base64:a.md5Base64,sizeBytes:a.sizeBytes}))})).createStaticSiteDeployment.exId,resumed:!1,resumedStatus:null}},dD=e=>{let t=(e.missingPaths??[]).filter(r=>typeof r=="string");return e.missingCount>t.length?null:t},wZ=async(e,t,r,n)=>r!=="UPLOADING"?null:dD(await lD(e,t,!0,n)),OZ=async(e,t)=>{let r=Ei(e.dir,"dir"),n=Je(e.dryRun,!1),i=Je(e.force,!1),o=uD(e),s=Math.max(1,Math.min(He(e.concurrency,mZ),gZ)),a=await oD(r);if(n)return t.ok({dryRun:!0,target:o,fileCount:a.files.length,totalBytes:a.totalBytes,skipped:a.skipped,files:a.files.map(I=>({path:I.path,sizeBytes:I.sizeBytes}))});let u=await Fv(e,t);u.target==="PROD"&&await wa(u.projectExId,e,"deploy to production",{allowForce:!1});let c=new Map(a.files.map(I=>[I.path,I])),{deploymentExId:l,resumed:d,resumedStatus:f}=await IZ(u,a.files,i,t),h=d?await wZ(u,l,f,t):null,g=new Set,y=[],_=null,b=Number.POSITIVE_INFINITY,S=0;for(let I=1;I<=yZ;I+=1){S=I;let O=await bZ(u,l,c,s,h,t);for(let T of O.uploaded)g.add(T);if(y=O.failures,_=await lD(u,l,!1,t),!_.incomplete||_.missingCount>=b||(b=_.missingCount,h=dD(_),h?.length===0))break}return!_||_.incomplete?t.fail(new Error(`deployment ${l} is still missing ${_?.missingCount??"?"} file(s) after ${S} upload pass(es): ${(_?.missingPaths??[]).slice(0,10).join(", ")}${y.length?`; upload errors: ${y[0].error}`:""}. Re-run to resume, or pass force=true to start over.`)):t.ok({deploymentExId:l,target:u.target,resumed:d,fileCount:a.files.length,totalBytes:a.totalBytes,uploaded:g.size,skipped:a.skipped,siteUrl:_.siteUrl,previousDeploymentExId:_.previousDeploymentExId,...y.length?{uploadRetries:y}:{}})},AZ=async(e,t)=>{let r=await Fv(e,t),n=await qv(r,t);return t.ok({target:r.target,inProgress:n.inProgressStaticSiteDeployment?{deploymentExId:n.inProgressStaticSiteDeployment.exId,status:n.inProgressStaticSiteDeployment.status,fileCount:n.inProgressStaticSiteDeployment.fileCount,totalBytes:n.inProgressStaticSiteDeployment.totalBytes,createdAt:n.inProgressStaticSiteDeployment.createdAt}:null,active:n.activeStaticSiteDeployment?{deploymentExId:n.activeStaticSiteDeployment.exId,siteUrl:n.activeStaticSiteDeployment.siteUrl,fileCount:n.activeStaticSiteDeployment.fileCount,totalBytes:n.activeStaticSiteDeployment.totalBytes,activatedAt:n.activeStaticSiteDeployment.activatedAt}:null})},xZ=async(e,t)=>{let r=await Fv(e,t),i=G(e.deploymentExId)??(await qv(r,t)).inProgressStaticSiteDeployment?.exId;if(!i)return t.ok({target:r.target,aborted:null},"no in-progress deployment to abort");let o=await cD(r,i,t);return t.ok({deploymentExId:i,target:r.target,status:o.abortStaticSiteDeployment.status})},fD={"site.deploy":OZ,"site.status":AZ,"site.abort":xZ};p();import gD from"node:fs/promises";import yD from"node:path";p();var CZ=new Set(["js","ts","json","wxml","wxss","wxs","png","jpg","jpeg","gif","svg","webp","ico","ttf","otf","woff","woff2","mp3","mp4","wasm","cer","txt"]),RZ=new Set(["project.config.json","project.private.config.json"]),PZ=new Set(["node_modules"]),NZ="app.json",DZ=5e3,hD=20*1024*1024,LZ={label:"WeChat mini program source",entryFile:NZ,entryHint:"Point --dir at the mini program root (the directory holding app.js / app.json / app.wxss).",allowedExtensions:CZ,ignoredDirectories:PZ,ignoreHidden:!0,reservedFiles:RZ,maxFileSizeBytes:hD,maxFileCount:DZ,maxTotalBytes:hD};function mD(e,t={}){return pp(e,LZ,t)}var kZ=8,jZ=32,vD=200,MZ=6,FZ=6e4,qZ=3,UZ=900,VZ=5e3,ED="wechat-trial-qrcode.jpg",fp=async(e,t)=>{let r=await t.getProjectArgs(e),n=r.appExId??null;if(!n)throw new Error("wechat commands act on a mini program app, and this call resolved to the project itself. Pin one with set_current_project (appExId), or pass appExId here; take it from `project metadata` -> apps[], the entry whose appType is WECHAT_MINI_PROGRAM. A project without that client app has no mini program to upload.");return{projectExId:r.projectExId,appExId:n}},Uv=(e,t)=>t.client.request(lx,e),_D=(e,t,r)=>r.client.request(cx,{projectExId:e.projectExId,appExId:e.appExId,wechatSourceCodeDeploymentExId:t}),SD=async(e,t,r,n)=>(await n.client.request(ux,{projectExId:e.projectExId,appExId:e.appExId,wechatSourceCodeDeploymentExId:t,dryRun:r})).completeWechatSourceCodeUpload,bD=async(e,t,r,n,i)=>{let o=await i.client.request(ax,{projectExId:e.projectExId,appExId:e.appExId,wechatSourceCodeDeploymentExId:t,offset:n?null:r,limit:n?null:vD,paths:n}),s=(o.wechatSourceCodeUploadUrls.items??[]).filter(u=>u!==null),a=s.map(u=>Date.parse(String(u.expiresAt??""))).filter(u=>Number.isFinite(u));return{targets:s.map(u=>({path:u.path??"",uploadUrl:u.uploadUrl??"",headers:u.headers??{}})),nextOffset:o.wechatSourceCodeUploadUrls.nextOffset??null,expiresAt:a.length?Math.min(...a):null}},GZ=e=>e!==null&&e-FZ<=Date.now(),$Z=async(e,t,r,n,i,o)=>{let s=[],a=[],u=r;for(let c=1;;c+=1){let l=await dp(u.targets,h=>n.get(h),i,o.signal);s.push(...l.uploaded);let f=GZ(u.expiresAt)&&c<qZ&&!o.signal?.aborted?l.failures.filter(h=>n.has(h.path)):[];if(a.push(...l.failures.filter(h=>!f.includes(h))),f.length===0)return{uploaded:s,failures:a};u=await bD(e,t,null,f.map(h=>h.path),o)}},BZ=async(e,t,r,n,i,o)=>{let s=[],a=[],u=i?null:0,c=i?[...i]:null;for(;;){o.signal?.throwIfAborted();let l=c?.splice(0,vD)??null;if(l&&l.length===0)break;let d=await bD(e,t,l?null:u,l,o),f=await $Z(e,t,d,r,n,o);if(s.push(...f.uploaded),a.push(...f.failures),l)continue;let h=d.nextOffset;if(h!==null&&u!==null&&h<=u)throw new Error(`upload url pagination stalled at offset ${u} (server returned ${h})`);if(u=h,u===null)break}return{uploaded:s,failures:a}},HZ=(e,t)=>{if(e.length!==t.length)return!1;let r=new Map(t.map(n=>[n.path??"",n.md5Base64??""]));return e.every(n=>r.get(n.path)===n.md5Base64)},KZ=async(e,t,r,n)=>{let i=await Uv(e,n),o=i.buildingWechatSourceCodeDeployment;if(o)throw new Error(`deployment ${o.exId} is already BUILDING (started ${o.buildStartedAt}) \u2014 a build cannot be aborted and blocks the next upload. Wait for it to finish, then re-run.`);let s=i.inProgressWechatSourceCodeDeployment;if(s){if(!r&&HZ(t,s.manifest))return{deploymentExId:s.exId,resumed:!0,resumedStatus:s.status};await _D(e,s.exId,n)}return{deploymentExId:(await n.client.request(sx,{projectExId:e.projectExId,appExId:e.appExId,files:t.map(u=>({path:u.path,md5Base64:u.md5Base64,sizeBytes:u.sizeBytes}))})).createWechatSourceCodeDeployment.exId,resumed:!1,resumedStatus:null}},TD=e=>{let t=(e.missingPaths??[]).filter(r=>typeof r=="string");return e.missingCount>t.length?null:t},QZ=async(e,t,r,n)=>r!=="UPLOADING"?null:TD(await SD(e,t,!0,n)),WZ=async(e,t,r)=>(await r.client.request(px,{projectExId:e.projectExId,appExId:e.appExId,wechatSourceCodeDeploymentExId:t})).wechatSourceCodeDeployment,ID=async(e,t)=>(await t.client.request(dx,{projectExId:e.projectExId})).project,zZ=async(e,t)=>(await t.client.request(fx,{projectExId:e.projectExId})).project,JZ=(e,t)=>new Promise((r,n)=>{let i=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),o=()=>{clearTimeout(i),n(t?.reason??new Error("aborted"))};if(t?.aborted){o();return}t?.addEventListener("abort",o,{once:!0})}),wD=async(e,t)=>{let r=yD.resolve(t),n=Buffer.from(e,"base64");return await gD.mkdir(yD.dirname(r),{recursive:!0}),await gD.writeFile(r,n),{qrCodePath:r,qrCodeBytes:n.length}},YZ=async(e,t,r,n)=>{let i=Date.now(),o=i+r*1e3;for(;;){n.signal?.throwIfAborted();let a=(await WZ(e,t,n))?.status??null,u=Math.round((Date.now()-i)/1e3);if(a!=="BUILDING"&&a!=="UPLOADING")return{status:a,timedOut:!1,waitedSeconds:u};if(Date.now()>=o)return{status:a,timedOut:!0,waitedSeconds:u};await JZ(Math.min(VZ,Math.max(0,o-Date.now())),n.signal)}},XZ=async(e,t)=>{let r=Ei(e.dir,"dir"),n=Je(e.dryRun,!1),i=Je(e.force,!1),o=Je(e.wait,!0),s=Math.max(0,He(e.timeoutSeconds,UZ)),a=G(e.qrOut)??ED,u=Math.max(1,Math.min(He(e.concurrency,kZ),jZ)),c=await mD(r);if(n)return t.ok({dryRun:!0,fileCount:c.files.length,totalBytes:c.totalBytes,skipped:c.skipped,serverManaged:c.reserved,files:c.files.map(ae=>({path:ae.path,sizeBytes:ae.sizeBytes}))});let l=await fp(e,t),d=new Map(c.files.map(ae=>[ae.path,ae])),{deploymentExId:f,resumed:h,resumedStatus:g}=await KZ(l,c.files,i,t),y=h?await QZ(l,f,g,t):null,_=new Set,b=[],S=null,I=Number.POSITIVE_INFINITY,O=0;for(let ae=1;ae<=MZ;ae+=1){O=ae;let de=await BZ(l,f,d,u,y,t);for(let A of de.uploaded)_.add(A);if(b=de.failures,S=await SD(l,f,!1,t),!S.incomplete||S.missingCount>=I||(I=S.missingCount,y=TD(S),y?.length===0))break}if(!S||S.incomplete)return t.fail(new Error(`deployment ${f} is still missing ${S?.missingCount??"?"} file(s) after ${O} upload pass(es): ${(S?.missingPaths??[]).slice(0,10).join(", ")}${b.length?`; upload errors: ${b[0].error}`:""}. Re-run to resume, or pass force=true to start over.`));let T={deploymentExId:f,resumed:h,fileCount:c.files.length,totalBytes:c.totalBytes,uploaded:_.size,skipped:c.skipped,serverManaged:c.reserved,deploymentRecordExId:S.deploymentRecordExId,...b.length?{uploadRetries:b}:{}};if(!o)return t.ok({...T,status:S.status,waited:!1});let C=await YZ(l,f,s,t);if(C.timedOut)return t.ok({...T,status:C.status,waited:!0,timedOut:!0,waitedSeconds:C.waitedSeconds},`build is still running after ${C.waitedSeconds}s \u2014 poll \`wechat status\` for the trial version`);if(C.status!=="SUCCEEDED")return t.fail(new Error(`deployment ${f} ended in ${C.status} after ${C.waitedSeconds}s. The upload landed but the WeChat build did not succeed; check the deployment record ${S.deploymentRecordExId??"(none)"} for the failure.`));let L=await ID(l,t),w=L?.wechatMiniAppQRCodeBase64??null,W=w?await wD(w,a):null;return t.ok({...T,status:C.status,waited:!0,waitedSeconds:C.waitedSeconds,trialVersion:L?.wechatMiniAppPreviewVersion??null,trialVersionCommittedAt:L?.wechatMiniAppPreviewTime??null,...W??{qrCodePath:null}})},ZZ=async(e,t)=>{let r=await fp(e,t),n=await Uv(r,t),i=await zZ(r,t);return t.ok({trial:{version:i?.wechatMiniAppPreviewVersion??null,committedAt:i?.wechatMiniAppPreviewTime??null},inProgress:n.inProgressWechatSourceCodeDeployment?{deploymentExId:n.inProgressWechatSourceCodeDeployment.exId,status:n.inProgressWechatSourceCodeDeployment.status,fileCount:n.inProgressWechatSourceCodeDeployment.fileCount,totalBytes:n.inProgressWechatSourceCodeDeployment.totalBytes,createdAt:n.inProgressWechatSourceCodeDeployment.createdAt,lastUploadUrlIssuedAt:n.inProgressWechatSourceCodeDeployment.lastUploadUrlIssuedAt}:null,building:n.buildingWechatSourceCodeDeployment?{deploymentExId:n.buildingWechatSourceCodeDeployment.exId,status:n.buildingWechatSourceCodeDeployment.status,fileCount:n.buildingWechatSourceCodeDeployment.fileCount,totalBytes:n.buildingWechatSourceCodeDeployment.totalBytes,buildStartedAt:n.buildingWechatSourceCodeDeployment.buildStartedAt,deploymentRecordExId:n.buildingWechatSourceCodeDeployment.deploymentRecordExId}:null})},e9=async(e,t)=>{let r=await fp(e,t),i=G(e.deploymentExId)??(await Uv(r,t)).inProgressWechatSourceCodeDeployment?.exId;if(!i)return t.ok({aborted:null},"no in-progress upload to abort");let o=await _D(r,i,t);return t.ok({deploymentExId:i,status:o.abortWechatSourceCodeDeployment.status})},t9=async(e,t)=>{let r=await fp(e,t),n=G(e.out)??ED,i=await ID(r,t),o=i?.wechatMiniAppQRCodeBase64??null;if(!o)return t.fail(new Error("no trial version QR code is available for this project yet \u2014 run `wechat deploy` and let the build finish first."));let s=await wD(o,n);return t.ok({...s,trialVersion:i?.wechatMiniAppPreviewVersion??null,trialVersionCommittedAt:i?.wechatMiniAppPreviewTime??null})},OD={"wechat.deploy":XZ,"wechat.status":ZZ,"wechat.abort":e9,"wechat.qrcode":t9};p();var AD={...yR,...wR,...LR,...FR,...fN,...RN,...LN,...qN,...GN,...$N,...HN,...tD,...rD,...fD,...OD,...PR,...MR};p();p();var r9=new Map([["claude-code","Claude Code"],["codex-mcp-client","Codex"]]);function xD(e){let t=typeof e?.name=="string"?e.name:"",r=typeof e?.title=="string"?e.title:"";return r9.get(t)??(r||t||"the coding agent")}function hp(e="the coding agent"){return`quit ${e} completely and open it again (starting a new chat in the same window may keep the old tools)`}function wi(e,t,r){let n=`${X} ${e.current} is older than the minimum supported version ${e.minSupported} (latest ${e.latest})`,i=t?`, and upgrading it automatically failed: ${t}`:"";return`${n}${i}. Calls to the backend keep failing until it is upgraded, so stop retrying and tell the user, in their language: update the ${Xv} plugin from the plugin marketplace (or run \`npm i -g ${X}@latest\` if ${X} was installed with npm), then ${hp(r)} so it starts the new version.`}function CD(e){return`This project's schema was saved by a newer editor than ${X} ${e} can read, and no ${X} release that can read it has been published yet, so updating or restarting will not help for now, and neither will retrying. Stop and tell the user, in their language, that this project cannot be edited through ${X} until a newer release comes out; they can keep working on it in the editor meanwhile.`}function RD(e,t){return`${X} is upgrading itself from ${e} to ${t} in the background because the backend no longer supports ${e}. Nothing is broken and the user does not need to do anything: retry this call in about a minute.`}function PD(e,t,r){return`Note: ${X} upgraded itself from ${e} to ${t} during this session and ran this call on ${t}, but ${r} did not reload its tool list, so tools added in ${t} are not visible to you. Tell the user once, in their language, that ${X} was upgraded and that to use the new version's tools they should ${hp(r)}. Then carry on with their request; everything that worked before still works.`}function ND(e,t,r,n){let i=hp(r);return n.upgradedFrom&&n.toolListReloaded?`${X} has no tool ${e}. ${X} upgraded itself from ${n.upgradedFrom} to ${t} during this session and ${r} has already reloaded its tool list, so ${e} was from the old list: use the tools you have now instead. The user does not need to restart anything.`:n.upgradedFrom?`${X} has no tool ${e}. ${X} upgraded itself from ${n.upgradedFrom} to ${t} during this session, so your tool list is still the ${n.upgradedFrom} one. Tell the user, in their language, to ${i} so you get the current tools, then try again.`:`${X} ${t} has no tool ${e}. Use only the tools in your current tool list; if that list was loaded from another ${X} version, tell the user, in their language, to ${i}, then try again.`}function DD(e,t,r,n){return n?`${X} upgraded itself from ${e} to ${t} during this session and ${r} has already reloaded its tool list, so check this tool's current arguments and try again.`:`${X} upgraded itself from ${e} to ${t} during this session, so this tool's arguments may have changed since your tool list was loaded. If the error does not make sense against your tool list, tell the user, in their language, to ${hp(r)}.`}var n9=U`
1558
+ query SupportedMcpVersion {
1559
+ supportedMcpVersion {
1560
+ latest
1561
+ minSupported
1562
+ }
1563
+ }
1564
+ `,i9=3600*1e3,o9=3600*1e3;function LD(e={}){let t=e.check??Ua,r=e.now??Date.now,n=e.ttlMs??i9,i=e.unknownTtlMs??o9,o=null,s=null;return{async check(){return o&&r()<o.expiresAt?o.result:s||(s=t().then(a=>(o={result:a,expiresAt:r()+(a.status==="unknown"?i:n)},a)).finally(()=>{s=null}),s)},invalidate(){o=null}}}function s9(e){let t=e instanceof Error?e.message:String(e);return/supportedMcpVersion|Cannot query field|Validation error|undefined/i.test(t)?"backend does not advertise a supported version":"backend version check unavailable"}async function Ua(){let{agentVersion:e}=await uy();try{let t=Ht(),r=new at(`${t.apiBaseUrl}/api/graphql`,{headers:{"User-Locale":"en_US"}}),{supportedMcpVersion:n}=await r.request(n9),{latest:i,minSupported:o}=n;return{status:Ai(e,o)<0?"outdated":"ok",current:e,latest:i,minSupported:o}}catch(t){return P.debug(`[version-check] skipped: ${String(t)}`),{status:"unknown",current:e,reason:s9(t)}}}function mp(e){return e.status==="outdated"?wi(e):e.status==="ok"?`${X} ${e.current} meets the backend minimum ${e.minSupported} (latest ${e.latest}).`:`${X} ${e.current}: ${e.reason}; skipping compatibility check.`}var a9=new Set(["docs.search","docs.get_page","auth.login","auth.reauth","auth.logout","auth.whoami","workspace.set"]),u9=e=>new Proxy({},{get(){throw new Error(`${e} is a local-only command and has no authenticated client`)}}),kD=e=>({ok:!1,error:mp(e),data:{upgrade:e}});function c9(e){let t=e.cause,r=t?.code;if(typeof r!="string")return null;let n=typeof t?.message=="string"?t.message:"";return n?n.includes(r)?n:`${r}: ${n}`:r}function l9(e){if(!(e instanceof Error))return String(e);let t=ly(e.response?.errors),r=e.message||String(e),n=c9(e),i=t||(n?`${r} (${n})`:r),o=e.runtimeDiagnosis;return typeof o=="string"?`${i}
1565
+ ${o}`:i}function gp(e,t={}){let r=new Fr(e),n=new yo(r),i=new kl(()=>py(n,r),t.watchSchemaChanges?async(...c)=>(await $C(n,r))(...c):void 0),o=LD({check:t.checkMcpVersion}),s=(c,l)=>({ok:!0,data:c,message:l}),a=c=>(c instanceof Error&&c.stack&&P.debug(`[AgentApp] command failed: ${c.stack}`),{ok:!1,error:l9(c),data:c instanceof Pn?{ztypeDiagnostics:c.diagnostics}:void 0});return{execute:async(c,l)=>{let d=dR(c.args),f=a9.has(c.name);try{if(!f){let w=await o.check();if(w.status==="outdated")return kD(w)}let h=AD[c.name];if(!h)throw new Error(`Unknown command: ${c.name}`);let g=f?u9(c.name):await py(n,r),y=null,_=f?void 0:g,b,S=async w=>(y??=await ba(r,w,_),b=y.projectExId,y),I=async w=>{let W=await ba(r,{appExId:null,...w},_);return b=W.projectExId,W},O=async w=>{let W=await S(w);return i.checkRemoteAndSync(_t(W.projectExId,W))},T={credentialStore:r,tokenManager:n,schemaManager:i,client:g,signal:l,codingAgent:c.agent,hostSessionId:c.sessionId,getProjectArgs:S,getProjectLevelArgs:I,checkSchema:O,ok:s,fail:a},C=await h(d,T);if(!C.ok||!b||C.agentFiles)return C;let L=await RR(T,b);return L?{...C,agentFiles:L}:C}catch(h){if(!Cl(h,"CLIENT_VERSION_TOO_OLD"))return a(h);o.invalidate();let g=await o.check();return g.status==="outdated"?kD(g):a(new Error(CD(g.current)))}},schemaManager:i,setWorkspaceRoot(c){r.setWorkspaceRoot(c),i.clear()},stop(){i.clear(),jl.close()}}}p();import yp from"net";p();import{StringDecoder as p9}from"string_decoder";var Va=e=>{let t=new p9("utf8"),r="";return n=>{for(r+=t.write(n);;){let i=r.indexOf(`
1566
+ `);if(i<0)return;let o=r.slice(0,i);r=r.slice(i+1),o.trim()!==""&&e(o)}}};var d9=600*1e3;async function Dt(e,t,r){let{socketPath:n,token:i}=e,o=`${Date.now()}-${Math.random().toString(16).slice(2)}`,s={id:o,token:i,command:t};return new Promise((a,u)=>{let c=n.startsWith("tcp://")?yp.createConnection(MD(n)):yp.createConnection(n),l=setTimeout(()=>{c.destroy(),u(new Error(`Timed out waiting for daemon response to ${t.name}`))},d9),d=()=>{r&&r.removeEventListener("abort",f)},f=()=>{clearTimeout(l),c.destroy(),u(new Error(`Request aborted: ${t.name}`))};if(r){if(r.aborted){f();return}r.addEventListener("abort",f)}c.on("connect",()=>{c.write(`${JSON.stringify(s)}
1567
+ `)}),c.on("data",Va(h=>{clearTimeout(l),d(),c.end();try{let g=JSON.parse(h);if(g.id!==o){u(new Error("Daemon response id mismatch"));return}a(g.result)}catch(g){u(g)}})),c.on("error",h=>{clearTimeout(l),d(),u(h)})})}function jD(e,t,r){let{socketPath:n,token:i}=e,o=null,s=!1,a=null,u=()=>{if(s)return;o=n.startsWith("tcp://")?yp.createConnection(MD(n)):yp.createConnection(n);let c=`sub-${Date.now()}-${Math.random().toString(16).slice(2)}`,l={id:c,token:i,command:{name:"schema.subscribe"}},d=o;d.on("connect",()=>{d.write(`${JSON.stringify(l)}
1568
+ `)}),d.on("data",Va(f=>{if(!d.destroyed)try{let h=JSON.parse(f);if(h.id===c)return;h.event==="schemaChanged"&&t(h.data)}catch(h){P.warn(`Failed to parse daemon event, destroying socket to force reconnect. Line: ${f}`,h),d.destroy()}})),o.on("error",f=>{s||r(f)}),o.on("close",()=>{o=null,s||(a=setTimeout(u,2e3))})};return u(),{unsubscribe(){s=!0,a&&clearTimeout(a),o&&o.end()}}}function MD(e){let t=new URL(e),r=Number.parseInt(t.port,10);if(!t.hostname||!Number.isInteger(r))throw new Error(`Invalid daemon TCP endpoint: ${e}`);return{host:t.hostname,port:r}}p();import{createHash as f9,randomUUID as FD}from"crypto";import{promises as Go,rmSync as h9}from"fs";import $o from"path";var m9="registry.json",Mn=class{constructor(t){this.workspaceRoot=t;this.root=$o.join(t,`.${X}`,"daemon"),this.logRoot=$o.join(this.root,"logs"),this.socketRoot=$o.join(this.root,"sockets"),this.registryPath=$o.join(this.root,m9)}root;logRoot;socketRoot;registryPath;async ensure(){await Go.mkdir(this.root,{recursive:!0,mode:448}),await Go.mkdir(this.logRoot,{recursive:!0,mode:448}),await Go.mkdir(this.socketRoot,{recursive:!0,mode:448})}async list(){await this.ensure();try{let t=await Go.readFile(this.registryPath,"utf8"),r=JSON.parse(t),n=r.filter(i=>this.isProcessAlive(i.pid));if(n.length!==r.length){for(let i of r)this.isProcessAlive(i.pid)||this.unlinkSocket(i.socketPath);await this.write(n)}return n}catch(t){if(t.code==="ENOENT")return[];throw t}}async findCompatible(t){return(await this.list()).find(n=>VC(t,n.compatibility)&&this.isProcessAlive(n.pid))??null}async upsert(t){let r=(await this.list()).filter(n=>n.uid!==t.uid);r.push(t),await this.write(r)}async remove(t){let r=await this.list();for(let n of r)n.pid===t&&this.unlinkSocket(n.socketPath);await this.write(r.filter(n=>n.pid!==t))}createRecord(t){let r=FD(),n=f9("sha256").update(`${this.workspaceRoot}:${r}`).digest("hex").slice(0,16),i=new Date().toISOString();return{uid:r,pid:process.pid,socketPath:this.chooseSocketPath(n),token:FD(),logPath:$o.join(this.logRoot,`${n}.log`),status:"idle",startedAt:i,lastBusyAt:i,compatibility:t}}chooseSocketPath(t){if(process.platform==="win32")return"tcp://127.0.0.1:0";let r=$o.join(this.socketRoot,`${t}.sock`);return r.length<=100?r:"tcp://127.0.0.1:0"}unlinkSocket(t){if(!t.startsWith("tcp://"))try{h9(t,{force:!0})}catch{}}async write(t){await this.ensure();let r=`${this.registryPath}.tmp`;await Go.writeFile(r,JSON.stringify(t,null,2),{mode:384}),await Go.rename(r,this.registryPath)}isProcessAlive(t){try{return process.kill(t,0),!0}catch{return!1}}};p();import{chmodSync as g9}from"fs";import y9 from"net";var vp=10800*1e3;async function qD(e){let t=e.idleTimeoutMs??vp,r=new Mn(e.workspaceRoot),n=new Fr(e.workspaceRoot),i=new yo(n),o=await xo(n,e.startupFlags??[]),s=r.createRecord(o),a=gp(e.workspaceRoot,{watchSchemaChanges:!0}),u=new Set;a.schemaManager.emitter.on("schemaChanged",T=>{let C=JSON.stringify({event:"schemaChanged",data:T})+`
1569
+ `;for(let L of u)try{L.write(C)}catch{u.delete(L)}});let c=new Map,l=0,d=!1,f=Date.now(),h=null,g=()=>{f=Date.now()},y=(T,C)=>`${JSON.stringify({id:T,result:C})}
1570
+ `,_=async()=>{s.compatibility=await xo(n,e.startupFlags??[]),await r.upsert(s)},b=async T=>{switch(T.command.name){case"daemon.ping":return{ok:!0,data:{pid:process.pid,record:s,pins:c.size}};case"daemon.pin":{let C=typeof T.command.args?.token=="string"?T.command.args.token:`${Date.now()}-${Math.random()}`;return c.set(C,{token:C,lastSeenAt:Date.now()}),{ok:!0,data:{token:C}}}case"daemon.heartbeat":{let C=T.command.args?.token;return typeof C=="string"&&c.has(C)&&c.set(C,{token:C,lastSeenAt:Date.now()}),{ok:!0}}case"daemon.unpin":{let C=T.command.args?.token;return typeof C=="string"&&c.delete(C),{ok:!0}}case"daemon.stop":return d=!0,setTimeout(()=>I(0),25),{ok:!0,message:"Stopping daemon"};default:return null}},S=()=>{let T=Date.now();for(let[C,L]of c.entries())T-L.lastSeenAt>t&&c.delete(C)},I=async T=>{h&&h.close(),a.stop(),await r.remove(process.pid).catch(()=>{}),process.exit(T)};setInterval(()=>{S(),a.schemaManager.sweep(),d||i.refreshIfNeeded(),!(d||l>0||c.size>0)&&Date.now()-f>t&&(P.info("Daemon idle timeout reached; shutting down"),I(0))},3e4).unref(),h=y9.createServer(T=>{let C=!1,L=new Map;T.on("close",()=>{u.delete(T);for(let W of L.values())W.abort();L.clear()}),T.on("error",()=>{u.delete(T);for(let W of L.values())W.abort();L.clear()});let w=W=>{(async()=>{l+=1,g();let ae="unknown";try{let de=JSON.parse(W);if(ae=de.id,de.token!==s.token){T.write(y(de.id,{ok:!1,error:"Unauthorized: invalid or missing daemon token"}));return}if(de.command.name==="schema.subscribe"){C=!0,u.add(T),T.write(y(de.id,{ok:!0,message:"Subscribed to schema events"}));return}let A=new AbortController;L.set(de.id,A);let B=await b(de)??await a.execute(de.command,A.signal);B.ok&&(de.command.name==="auth.login"||de.command.name==="auth.reauth"||de.command.name==="auth.logout")&&await _(),T.write(y(de.id,B))}catch(de){let A=ae!=="unknown"?ae:v9(W);T.write(y(A,{ok:!1,error:de instanceof Error?de.message:String(de)}))}finally{l-=1,g(),ae!=="unknown"&&L.delete(ae),C||T.end()}})()};T.on("data",Va(w))}),await r.ensure(),await new Promise((T,C)=>{if(h?.once("error",C),s.socketPath.startsWith("tcp://")){h?.listen(0,"127.0.0.1",()=>{let w=h?.address();if(!w||typeof w=="string"){C(new Error("Daemon TCP listener did not expose a port"));return}s.socketPath=`tcp://127.0.0.1:${w.port}`,T()});return}let L=s.socketPath;h?.listen(L,()=>{try{g9(L,384)}catch{}T()})}),await r.upsert(s),P.info(`Daemon listening on ${s.socketPath}`),iE(),process.on("SIGINT",()=>void I(0)),process.on("SIGTERM",()=>void I(0))}function v9(e){try{return JSON.parse(e).id??"unknown"}catch{return"unknown"}}p();p();import UD from"node:process";p();var Bo=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
1571
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),E9(r)}clear(){this._buffer=void 0}};function E9(e){return uE.parse(JSON.parse(e))}function Ep(e){return JSON.stringify(e)+`
1572
+ `}var _p=class{constructor(t=UD.stdin,r=UD.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Bo,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=Ep(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import{spawn as D9}from"child_process";import WD from"path";import{randomUUID as L9}from"crypto";p();function VD(){let{productName:e}=hE();return`# ${e} MCP \u2014 no-code platform (visual UI + PostgreSQL + actionflows)
1573
+ Two modes. **Builder**: edit the data model, bindings, action flows, request filters, UI, third-party APIs, project lifecycle, deploys, and data with tools. **Consultant**: for what tools can't change (permission config, payment setup, formula columns), diagnose and guide the user through the editor.
1574
+
1575
+ ## Session
1576
+ - Pin a project with set_current_project (or pass projectExId); resolve a name via get_projects.
1577
+ - Warm it with schema_session op=LOAD before reading/editing. Edits apply immediately (CRDT patch) but are NOT live until sync_backend; schema_undo reverts the last; re-read before the next.
1578
+ - Deploy with schema_session op=VALIDATE \u2192 sync_backend; never sync an unvalidated session.
1579
+
1580
+ ## Tools \u2014 call guide {plugin} for an area's rules before editing it
1581
+ Schema editing: one tool per capability, each {op, args} where op is a schema ToolName \u2014 database, type, bindings, actionflow, api, secret, zai, component. Read/write ALL runtime data (queries, mutations, aggregates, invoking actionflows/AI, uploads) via runtime_graphql. Diagnose: search_logs. Docs: search_docs \u2192 get_doc_page.
1582
+
1583
+ ## Cannot do (consultant only)
1584
+ Permission config, payment module/credentials, and formula COLUMNS are editor-only. (Formula data BINDINGS via schema_create_binding op=FORMULA are fine \u2014 different thing.)
1585
+
1586
+ ## Always
1587
+ Ask when ambiguous. Ground every call in what you retrieved \u2014 never fabricate table/column/enum/component names; verify names before any query/mutation. Before deleting tables/columns/relations/enums, list what's removed and warn of data loss. Data-model/permission/actionflow changes take effect only after sync_backend. Done = VALIDATE clean, synced, each changed actionflow without external calls debug-run once, and what the user asked for actually exercised. Reply in the user's language.`}p();import{randomUUID as _9}from"crypto";p();function Sp(e){if(e.ok||typeof e.data!="object"||e.data===null)return null;let t=e.data.upgrade;return t?.status!=="outdated"||typeof t.current!="string"||typeof t.latest!="string"||typeof t.minSupported!="string"?null:t}function Ga(e){let t=Ap(e.minSupported)?e.minSupported:e.current;return[...new Set([e.latest,e.minSupported])].filter(Ap).filter(r=>Ai(r,e.current)>0&&Ai(r,t)>=0).sort((r,n)=>Ai(n,r))}function Ho(e){return Ga(e)[0]??null}async function GD(e,t,r=new zo,n){let i=Ho(e);if(!i||!Jo(n))return{kind:"UNAVAILABLE"};process.stderr.write(`[${X}] ${e.current} is no longer supported by the backend; upgrading to ${i}...
1588
+ `);let o;try{o=await r.installFirst(Ga(e))}catch(s){return{kind:"FAILED",reason:s instanceof Error?s.message:String(s)}}return{kind:"RERAN",status:await eE(r,o,t)}}async function $D(e,t=new zo,r){if(!Jo(r))return;let n=await e();n.status==="outdated"&&Ho(n)&&await t.installFirst(Ga(n))}var BD=`__MCP_UPGRADE_HANDOVER_${_9()}__`,S9=4e4,b9=3e4,T9=600*1e3,I9=2e3,w9=`${X} upgraded itself from`,O9=/^(MCP error -?\d+: )?Tool \S+ not found/,A9=/^(MCP error -?\d+: )?Input validation error/,x9=new Set(["logging/setLevel","resources/subscribe","resources/unsubscribe"]),C9=["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed"],HD=e=>"method"in e&&"id"in e,QD=e=>"id"in e&&!("method"in e),bp=class{constructor(t){this.options=t}onmessage;onclose;onerror;pending=new Map;initializeRequest=null;negotiatedProtocol=null;logLevelRequest=null;subscriptions=new Map;upgrade=null;relay=null;toolsRelisted=new Gv;startedAt=Date.now();upgradeNoted=!1;async start(){let{inner:t}=this.options;t.onmessage=(r,n)=>this.fromHost(r,n),t.onclose=()=>this.onclose?.(),t.onerror=r=>this.onerror?.(r),await t.start()}async close(){this.relay?.close(),await this.options.inner.close()}setProtocolVersion(t){this.options.inner.setProtocolVersion?.(t)}async send(t,r){if(QD(t)){let n=this.pending.get(t.id);if(this.pending.delete(t.id),n&&this.upgrade&&JSON.stringify(t).includes(BD)){this.handOver(n);return}if(n?.method==="initialize"){let i=t.result?.protocolVersion;this.negotiatedProtocol=typeof i=="string"?i:null}n&&(t=await this.withToolHint(n,t))}await this.options.inner.send(t,r)}wrapSender(t){return async(r,n)=>{let i=await t(r,n),o=Sp(i);return!o||!this.options.canUpgrade(o)?i:(this.requestUpgrade(o),{ok:!1,error:BD})}}fromHost(t,r){if(HD(t)&&t.method==="tools/list"&&this.toolsRelisted.mark(),this.relay){this.relay.send(t);return}HD(t)&&(this.remember(t),this.pending.set(t.id,t)),this.onmessage?.(t,r)}remember(t){if(t.method==="initialize")this.initializeRequest=t;else if(t.method==="logging/setLevel")this.logLevelRequest=t;else if(x9.has(t.method)){let r=String(t.params?.uri??"");t.method==="resources/subscribe"?this.subscriptions.set(r,t):this.subscriptions.delete(r)}}requestUpgrade(t){let r=this.upgrade;if(r?.kind==="RUNNING"||r?.kind==="FAILED"&&Date.now()-r.at<T9)return;let n=this.performUpgrade(t);this.upgrade={kind:"RUNNING",version:t,target:n},n.catch(i=>{let o=i instanceof Error?i.message:String(i);P.warn(`[upgrade] handover failed: ${o}`),this.upgrade={kind:"FAILED",version:t,reason:o,at:Date.now()}})}async performUpgrade(t){let r=this.initializeRequest;if(!r)throw new Error("the MCP client never initialized this server");let n=await this.options.prepare(t),i=new $v(n,this.options.launch(n),o=>this.options.inner.send(o),o=>{this.relay===i&&this.options.onRelayExit?.(o)});try{await i.initialize(r,this.negotiatedProtocol,[...this.logLevelRequest?[this.logLevelRequest]:[],...this.subscriptions.values()])}catch(o){throw i.close(),o}this.relay=i,this.toolsRelisted.reset();for(let o of C9)await this.options.inner.send({jsonrpc:"2.0",method:o});return P.info(`[upgrade] handed this session over to ${n} (was ${this.options.currentVersion})`),this.options.onRelayActive?.(),i}async handOver(t){let r=this.upgrade;if(!r){await this.options.inner.send(Vv(t,"internal error: upgrade was not requested"));return}if(r.kind==="FAILED"){await this.options.inner.send(Vv(t,wi(r.version,r.reason,this.host())));return}let n=await N9(r.target,this.options.waitMs??S9);if(n.kind==="DONE"){let o=this.options.currentVersion,s=n.value.version;n.value.send(t,async a=>{let u=await this.toolsRelisted.waitFor(this.reloadGraceMs()),c=this.upgradeNoted;return this.upgradeNoted=!0,u||c||JSON.stringify(a).includes(w9)?a:KD(a,PD(o,s,this.host()))});return}let i=n.kind==="TIMEOUT"?RD(r.version.current,Ho(r.version)??r.version.latest):wi(r.version,n.reason,this.host());await this.options.inner.send(Vv(t,i))}reloadGraceMs(){return this.options.toolReloadGraceMs??I9}async hostRelistedTools(){let t=this.startedAt+2*this.reloadGraceMs()-Date.now();return this.toolsRelisted.waitFor(Math.max(0,t))}host(){let t=this.initializeRequest?.params?.clientInfo;return xD(t)}async withToolHint(t,r){if(t.method!=="tools/call")return r;let n=R9(r);if(n===null)return r;let{upgradedFrom:i,currentVersion:o}=this.options;return O9.test(n)?P9(r,ND(String(t.params?.name??""),o,this.host(),{upgradedFrom:i,toolListReloaded:i?await this.hostRelistedTools():!1})):i&&A9.test(n)?KD(r,DD(i,o,this.host(),await this.hostRelistedTools())):r}};function R9(e){let t=e.result,r=t?.content?.[0];return t?.isError&&r?.type==="text"&&typeof r.text=="string"?r.text:null}function P9(e,t){return{jsonrpc:"2.0",id:e.id,result:{content:[{type:"text",text:t}],isError:!0}}}function KD(e,t){if(e.error)return{jsonrpc:"2.0",id:e.id,error:{...e.error,message:`${e.error.message}
1589
+ ${t}`}};let r=e.result;return r?.content?{jsonrpc:"2.0",id:e.id,result:{...r,content:[...r.content,{type:"text",text:t}]}}:e}function Vv(e,t){return e.method==="tools/call"?{jsonrpc:"2.0",id:e.id,result:{content:[{type:"text",text:t}],isError:!0}}:{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:t}}}var Gv=class{seen=!1;waiters=new Set;reset(){this.seen=!1}mark(){this.seen=!0;for(let t of this.waiters)t();this.waiters.clear()}waitFor(t){return this.seen||t<=0?Promise.resolve(this.seen):new Promise(r=>{let n=()=>{clearTimeout(i),r(!0)},i=setTimeout(()=>{this.waiters.delete(n),r(!1)},t);this.waiters.add(n)})}};function N9(e,t){return new Promise(r=>{let n=setTimeout(()=>r({kind:"TIMEOUT"}),t);e.then(i=>{clearTimeout(n),r({kind:"DONE",value:i})},i=>{clearTimeout(n),r({kind:"FAILED",reason:i instanceof Error?i.message:String(i)})})})}var $v=class{constructor(t,r,n,i){this.version=t;this.child=r;this.toHost=n;r.stdout.on("data",a=>{for(this.buffer.append(a);;){let u;try{u=this.buffer.readMessage()}catch(c){P.warn(`[upgrade] unreadable message from new version: ${String(c)}`);continue}if(!u)break;this.route(u)}}),r.stdin.on("error",()=>{});let o=!1,s=(a,u)=>{if(!o){o=!0;for(let c of this.waiters.values())c({jsonrpc:"2.0",id:"",error:{code:-32603,message:u}});this.waiters.clear(),this.closed||Promise.allSettled([...this.inflight]).then(()=>i(a))}};r.on("error",a=>s(1,`it could not start: ${a.message}`)),r.on("exit",a=>s(a??1,`it exited with ${a}`))}buffer=new Bo;intercepts=new Map;inflight=new Set;waiters=new Map;sequence=0;closed=!1;send(t,r){r&&"id"in t&&t.id!==void 0&&this.intercepts.set(t.id,r),this.closed||this.child.stdin.write(Ep(t))}async initialize(t,r,n){let i=await this.request(t.method,{...t.params,...r?{protocolVersion:r}:{}});if(i.error)throw new Error(`the new version did not initialize: ${i.error.message}`);let o=i.result?.protocolVersion;if(r&&o!==r)throw new Error(`the new version speaks MCP ${String(o)}, but this session uses ${r}`);this.send({jsonrpc:"2.0",method:"notifications/initialized"});for(let s of n)await this.request(s.method,s.params).catch(()=>{})}close(){this.closed||(this.closed=!0,this.child.stdin.end())}request(t,r){this.sequence+=1;let n=`handover-${this.sequence}`;return new Promise((i,o)=>{let s=setTimeout(()=>{this.waiters.delete(n),o(new Error(`the new version did not answer ${t}`))},b9);this.waiters.set(n,a=>{clearTimeout(s),i(a)}),this.send({jsonrpc:"2.0",id:n,method:t,params:r})})}route(t){if(QD(t)){let r=typeof t.id=="string"?this.waiters.get(t.id):void 0;if(r){this.waiters.delete(t.id),r(t);return}let n=this.intercepts.get(t.id);if(n){this.intercepts.delete(t.id);let i=n(t).then(o=>this.toHost(o));this.inflight.add(i),i.finally(()=>this.inflight.delete(i));return}}this.toHost(t)}};var Tp=Fn.toLowerCase(),zD=e=>`${Tp}://project/${encodeURIComponent(e)}/schema-state`,JD=e=>`${Tp}://project/${encodeURIComponent(e)}/schema-events`,YD=e=>Array.isArray(e)?String(e[0]??""):String(e??"");async function Bv(e){let t=WD.resolve(e),r=await $a(t),n=XD(),i=async()=>{await Dt(r,{name:"daemon.pin",args:{token:n}})},o=async()=>{await Dt(r,{name:"daemon.unpin",args:{token:n}}).catch(()=>{})};await i();let s=setInterval(()=>{Dt(r,{name:"daemon.heartbeat",args:{token:n}}).catch(()=>{})},6e4);s.unref();let a=new pE({name:X,version:"1.0.0"},{instructions:VD(),capabilities:{tools:{},prompts:{},resources:{subscribe:!0}}});rE(a);let u=new Set;a.server.setRequestHandler(cE,S=>(u.add(S.params.uri),{})),a.server.setRequestHandler(lE,S=>(u.delete(S.params.uri),{}));let c=process.env.MCP_HOST_SESSION_ID||L9(),l=async(S,I)=>{if(S.agent??=a.server.getClientVersion()?.name,S.sessionId??=c,S.name==="workspace.set"&&typeof S.args?.cwd=="string"){let O=WD.resolve(S.args.cwd);if(S.args.cwd=O,O!==t){let T=r;r=await $a(O),t=O,await Dt(T,{name:"daemon.unpin",args:{token:n}},I).catch(()=>{}),await i()}}return Dt(r,S,I)},d=new zo,f=new bp({inner:new _p,currentVersion:jr(),upgradedFrom:process.env.MCP_UPGRADED_FROM||void 0,canUpgrade:S=>Jo()&&Ho(S)!==null,prepare:S=>d.installFirst(Ga(S)),launch:S=>D9(process.execPath,[d.binPath(S),"mcp","--cwd",t],{stdio:["pipe","pipe","inherit"],env:{...process.env,MCP_HOST_SESSION_ID:c,MCP_UPGRADED_FROM:jr()}}),onRelayActive:()=>{clearInterval(s),y.unsubscribe(),o()},onRelayExit:S=>process.exit(S)});fE(a,f.wrapSender(l)),mE(a,f.wrapSender(l));let h=async()=>{let S=await Dt(r,{name:"schema.status"});if(!S.ok)return[];let O=S.data?.sessions;return Array.isArray(O)?[...new Set(O.map(T=>T?.projectExId).filter(T=>typeof T=="string"))]:[]};a.registerResource("project-schema-state",new Pp(`${Tp}://project/{projectExId}/schema-state`,{list:async()=>({resources:(await h()).map(S=>({uri:zD(S),name:`schema-state-${S}`,title:`Schema state ${S}`,description:"Current in-memory schema revision and stale/change notification state.",mimeType:"application/json"}))})}),{title:"Project Schema State",description:"Current in-memory schema revision and stale/change notification state.",mimeType:"application/json"},async(S,I)=>{let O=YD(I.projectExId),T=await Dt(r,{name:"schema.state",args:{projectExId:O}});return{contents:[{uri:S.href,mimeType:"application/json",text:JSON.stringify(T.ok?T.data:T,null,2)}]}}),a.registerResource("project-schema-events",new Pp(`${Tp}://project/{projectExId}/schema-events`,{list:async()=>({resources:(await h()).map(S=>({uri:JD(S),name:`schema-events-${S}`,title:`Schema events ${S}`,description:"Recent semantic schema-change events observed by the daemon.",mimeType:"application/json"}))})}),{title:"Project Schema Events",description:"Recent semantic schema-change events observed by the daemon.",mimeType:"application/json"},async(S,I)=>{let O=YD(I.projectExId),T=await Dt(r,{name:"schema.events",args:{projectExId:O}});return{contents:[{uri:S.href,mimeType:"application/json",text:JSON.stringify(T.ok?T.data:T,null,2)}]}}),await a.connect(f),process.env.MCP_UPGRADED_FROM||$D(Ua,d).catch(S=>{P.warn(`[upgrade] prefetch failed: ${String(S)}`)});let g=new Set,y=jD(r,async S=>{if(!S?.id||g.has(S.id))return;g.add(S.id);let I=String(S.projectExId??"");if(!I)return;let O=zD(I),T=JD(I),C=[u.has(O)?a.server.sendResourceUpdated({uri:O}):Promise.resolve(),u.has(T)?a.server.sendResourceUpdated({uri:T}):Promise.resolve()];await Promise.all([...C,a.sendLoggingMessage({level:"notice",logger:X,data:{message:"Project schema changed",projectExId:I,event:S}})])},S=>{P.warn("Daemon subscription error",S.message)}),_=!1,b=async()=>{_||(_=!0,clearInterval(s),y.unsubscribe(),await o(),await a.close())};process.on("SIGINT",()=>{b().finally(()=>process.exit(0))}),process.on("SIGTERM",()=>{b().finally(()=>process.exit(0))}),process.stdin.on("end",()=>{b().finally(()=>process.exit(0))}),process.stdin.on("close",()=>{b().finally(()=>process.exit(0))}),process.on("exit",()=>{clearInterval(s),y.unsubscribe()})}p();import{readFileSync as k9}from"fs";var j9=/^-?\d+(\.\d+)?$/;function M9(e){return e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")}function F9(e){if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(j9.test(e))return Number(e);if(M9(e))try{return JSON.parse(e)}catch{return e}return e}function ZD(e){let t=Number(e);if(Number.isNaN(t))throw new zp("expected a number");return t}function Hv(e){try{return JSON.parse(e)}catch{throw new zp("expected valid JSON")}}function eL(e){if(typeof e!="string")return{};try{let t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function q9(e){let t={};for(let r=0;r<e.length;r++){let n=e[r];if(!n.startsWith("--"))continue;let i=n.slice(2),o,s=i.indexOf("=");if(s!==-1)o=i.slice(s+1),i=i.slice(0,s);else{let a=e[r+1];a!==void 0&&!a.startsWith("--")&&(o=a,r+=1)}o===void 0?i.startsWith("no-")?t[i.slice(3)]=!1:t[i]=!0:t[i]=F9(o)}return t}function tL(e){return typeof e.argsFile=="string"?k9(e.argsFile,"utf8"):e.args}function rL(e,t,r){let n=eL(tL(e));return Object.assign(n,q9(t)),r&&(n.subcommand=r),n}function nL(e,t){let r=eL(tL(t)),n=e.opts();for(let i of e.options){let o=i.attributeName();e.getOptionValueSource(o)==="cli"&&(r[o]=n[o])}return r}p();function U9(e){let t=e,r=!1;for(;;)if(t instanceof Kt.ZodOptional)r=!0,t=t.unwrap();else if(t instanceof Kt.ZodNullable)t=t.unwrap();else if(t instanceof Kt.ZodDefault)t=t.removeDefault();else break;return{base:t,optional:r}}function iL(e,t){for(let[r,n]of Object.entries(t)){let{base:i,optional:o}=U9(n),s=o?"":"required",a=`${s} JSON`.trim();i instanceof Kt.ZodBoolean?(e.option(`--${r}`,s),e.option(`--no-${r}`)):i instanceof Kt.ZodNumber?e.option(`--${r} <value>`,s,ZD):i instanceof Kt.ZodArray?i.element instanceof Kt.ZodString?e.option(`--${r} <values...>`,s):e.option(`--${r} <json>`,a,Hv):i instanceof Kt.ZodRecord||i instanceof Kt.ZodObject||i instanceof Kt.ZodAny||i instanceof Kt.ZodUnknown?e.option(`--${r} <json>`,a,Hv):e.option(`--${r} <value>`,s)}}var Kv=["default"],uL=[];function Oi(e){return typeof e.cwd=="string"?aL.resolve(e.cwd):process.env.WORKSPACE_ROOT||process.cwd()}function Ip(e){return e.pretty===void 0?!0:!e.pretty}async function cL(e,t,r){let n={name:e,args:t},i=Oi(r),o=r.daemon===!1?await e7(n,i):await Z9(n,i),s=Sp(o);if(s){let a=await GD(s,uL);if(a.kind==="RERAN"){tE(a.status);return}a.kind==="FAILED"&&(o={...o,error:wi(s,a.reason)})}wp(o,Ip(r)),o.ok||(process.exitCode=1)}async function K9(e){let t=await $a(Oi(e));wp({ok:!0,data:lL(t),message:"Daemon started"},Ip(e))}async function Q9(e){await qD({workspaceRoot:Oi(e),idleTimeoutMs:t7(process.env.ZED_AGENT_DAEMON_IDLE_TTL)??vp,startupFlags:Kv})}async function W9(e){let r=await new Mn(Oi(e)).list();wp({ok:!0,data:r.map(lL)},Ip(e))}async function z9(e){let t=Oi(e),r=new Mn(t),n=new Fr(t),i=await xo(n,Kv),o=await r.list(),s=[];for(let a of o)if(JSON.stringify(a.compatibility)===JSON.stringify(i))try{await Dt(a,{name:"daemon.stop"}),s.push(a.pid)}catch{await r.remove(a.pid)}wp({ok:!0,data:{stopped:s}},Ip(e))}function oL(e,t){return e.commands.find(r=>r.name()===t)}function sL(e,t,r,n,i){let o=e;for(let u=0;u<t.length-1;u+=1)o=oL(o,t[u])??o.command(t[u]);let s=t[t.length-1];if(oL(o,s))return;let a=o.command(s).description(r);i&&iL(a,i),a.action(async(u,c)=>{let l=c.optsWithGlobals();await cL(n,nL(c,l),l)})}function J9(e,t,r,n){sL(e,r.path.split(" "),t.description,t.command,n),r.alias&&sL(e,r.alias.split(" "),t.description,t.command,n)}function Y9(){let e=Ht(),t=Object.keys(Zv).join(", ");return["","Backend environment:",` Active: ${e.name} (select with ZION_ENV / MCP_ENV; known: ${t})`,` API: ${e.apiBaseUrl}`,` Auth: ${e.authEndpoint}`," Override any endpoint individually with BACKEND_API_BASE,"," BACKEND_AUTH_ENDPOINT, ZERO_API_URL_TEMPLATE, LOG_API_URL_TEMPLATE.","","Upgrades:"," When the backend stops supporting this version, the newer release is installed",` into ~/.${X}/versions and the call continues on it; later starts run it directly.`," MCP_AUTO_UPGRADE=0 turns this off and only reports the required upgrade.","","Logs:",` File: ${nE()}`,` Level: ${process.env.MCP_LOG_LEVEL??"info"} (set MCP_LOG_LEVEL; debug, or verbose)`," Verbose: MCP_LOG_LEVEL=verbose (or MCP_LOG_GQL=1) logs full GraphQL bodies + subscription events"," Rotation: 50 MB x 5 files; data older than 1 day is truncated"," Override: MCP_LOG_DIR, MCP_LOG_MAX_BYTES, MCP_LOG_MAX_FILES,"," MCP_LOG_MAX_AGE_DAYS (0 disables), MCP_LOG_FILE=off"].join(`
1590
+ `)}function X9(e){return e instanceof Error&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}async function hve(e=process.argv.slice(2)){uL=e,process.env.MCP_STDERR_VERSION==="1"&&process.stderr.write(`${X} version ${jr()}
1591
+ `);let t=new CE;t.name(X).allowUnknownOption(!0).allowExcessArguments(!0).exitOverride(),t.option("--no-daemon","Run command one-shot without starting or using daemon"),t.option("--cwd <dir>","Workspace root for product config and daemon registry"),t.option("--pretty","Human-oriented output"),t.option("--args <json>","Pass arguments as JSON string"),t.option("--args-file <path>","Read the JSON arguments from a file instead of --args"),t.command("mcp").description("Run MCP Bridge").allowUnknownOption(!0).action(async(i,o)=>{await Bv(Oi(o.optsWithGlobals()))}),t.command("version-check").description("Compare this CLI against the backend-advertised minimum supported version").action(async()=>{let i=await Ua();process.stdout.write(`${mp(i)}
1592
+ `),i.status==="outdated"&&(process.exitCode=1)}),t.command("tool-surface",{hidden:!0}).description("Print the MCP tools, prompts and CLI verbs this version exposes, as JSON").action(async()=>{let{collectToolSurface:i}=await import("./surface-VEPYVQHB.js");process.stdout.write(`${JSON.stringify(await i(),null,2)}
1593
+ `)});let r=t.command("daemon").description("Daemon control"),n=[["start","Start daemon",K9],["foreground","Run daemon in foreground",Q9],["status","Get daemon status",W9],["stop","Stop daemon",z9]];for(let[i,o,s]of n)r.command(i).description(o).action(async(a,u)=>{await s(u.optsWithGlobals())});for(let i of dE){if(!i.cli)continue;let o=i.cli,s=o.inputSchema??i.tool?.inputSchema;J9(t,i,o,s)}t.argument("[parts...]","Custom agent command or MCP Bridge").action(async(i,o,s)=>{let a=s.optsWithGlobals();if(!i||i.length===0){await Bv(Oi(a));return}let u=[],c=[],l=!1;for(let d of i)!l&&d.startsWith("--")&&(l=!0),(l?c:u).push(d);await cL(u[0],rL(a,c,u[1]),a)}),t.addHelpText("afterAll",Y9);try{await t.parseAsync(["node",X,...e])}catch(i){if(X9(i)){i.code==="commander.help"||i.code==="commander.helpDisplayed"||i.code==="commander.version"||(process.exitCode=1);return}throw i}}async function Z9(e,t){let r=await $a(t);return Dt(r,e)}async function e7(e,t){let r=gp(t);try{return await r.execute(e)}finally{r.stop()}}async function $a(e){let t=new Mn(e),r=new Fr(e),n=await xo(r,Kv),i=await t.findCompatible(n);if(i)try{if((await Dt(i,{name:"daemon.ping"})).ok)return i}catch{await t.remove(i.pid)}let o=t.createRecord(n);await t.ensure(),await H9.mkdir(aL.dirname(o.logPath),{recursive:!0});let s=B9(o.logPath,"a"),a=V9(process.execPath,[process.argv[1],"daemon","foreground"],{cwd:e,detached:!0,env:{...process.env,WORKSPACE_ROOT:e,ZED_AGENT_DAEMON_IDLE_TTL:process.env.ZED_AGENT_DAEMON_IDLE_TTL??String(vp)},stdio:["ignore",s,s]});$9(s),a.unref();let u=Date.now()+1e4,c=null;for(;Date.now()<u;){await r7(200);let l=await t.findCompatible(n);if(l)try{if((await Dt(l,{name:"daemon.ping"})).ok)return l}catch(d){c=d}}throw new Error(`Failed to start daemon${c?`: ${c.message}`:""}`)}function lL(e){let{token:t,...r}=e;return r}function wp(e,t){if(t){let r=e.ok?e.data??(e.message!==void 0?{message:e.message}:{}):{error:e.error,...e.data!==void 0?{data:e.data}:{}},n=e.agentFiles&&typeof r=="object"&&r!==null&&!Array.isArray(r)?{...r,agentFiles:e.agentFiles}:r;process.stdout.write(`${JSON.stringify(n,null,2)}
1594
+ `);return}e.agentFiles&&process.stdout.write(`${e.agentFiles}
1595
+
1596
+ `),e.message&&process.stdout.write(`${e.message}
1597
+ `),e.data!==void 0&&process.stdout.write(`${JSON.stringify(e.data,null,2)}
1598
+ `),e.error&&process.stderr.write(`${e.error}
1599
+ `)}function t7(e){if(!e)return null;if(/^\d+$/.test(e))return Number(e);let t=e.match(/^(\d+)(ms|s|m|h)$/);if(!t)return null;let r=Number(t[1]),n=t[2];return n==="ms"?r:n==="s"?r*1e3:n==="m"?r*6e4:r*60*6e4}function XD(){return G9()}var r7=e=>new Promise(t=>{setTimeout(t,e)});export{XD as createMcpPinToken,$a as ensureDaemon,hve as runCli};