@zuplo/core 5.1655.0 → 5.1659.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create.index.minified.js +1 -1
- package/index.minified.js +2 -2
- package/package.json +1 -1
package/create.index.minified.js
CHANGED
|
@@ -407,5 +407,5 @@ ${p}
|
|
|
407
407
|
${f}`;const m=`${a}/${t.region}/${n}/${ANt}`;const g=`${RSe}
|
|
408
408
|
${s}
|
|
409
409
|
${m}
|
|
410
|
-
`+await t.crypto.sha256DigestHex(h);const y=await xNt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await H6(t.crypto,y,g);const w=`${RSe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,OSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(CNt,"generateAuthenticationHeaderMap")});var dG=_(jA=>{"use strict";Object.defineProperty(jA,"__esModule",{value:true});jA.AwsClient=void 0;var RNt=NSe();var ONt=lf();var z6=class extends ONt.BaseExternalAccountClient{static{o(this,"AwsClient")}constructor(e,r){super(e,r);this.environmentId=e.credential_source.environment_id;this.regionUrl=e.credential_source.region_url;this.securityCredentialsUrl=e.credential_source.url;this.regionalCredVerificationUrl=e.credential_source.regional_cred_verification_url;this.imdsV2SessionTokenUrl=e.credential_source.imdsv2_session_token_url;this.awsRequestSigner=null;this.region="";this.validateEnvironmentId()}validateEnvironmentId(){var e;const r=(e=this.environmentId)===null||e===void 0?void 0:e.match(/^(aws)(\d+)$/);if(!r||!this.regionalCredVerificationUrl){throw new Error('No valid AWS "credential_source" provided')}else if(parseInt(r[2],10)!==1){throw new Error(`aws version "${r[2]}" is not supported in the current build.`)}}async retrieveSubjectToken(){if(!this.awsRequestSigner){const i={};if(this.shouldUseMetadataServer()&&this.imdsV2SessionTokenUrl){i["x-aws-ec2-metadata-token"]=await this.getImdsV2SessionToken()}this.region=await this.getAwsRegion(i);this.awsRequestSigner=new RNt.AwsRequestSigner(async()=>{if(this.securityCredentialsFromEnv){return this.securityCredentialsFromEnv}const s=await this.getAwsRoleName(i);const a=await this.getAwsSecurityCredentials(s,i);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,token:a.Token}},this.region)}const e=await this.awsRequestSigner.getRequestOptions({url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"});const r=[];const n=Object.assign({"x-goog-cloud-target-resource":this.audience},e.headers);for(const i in n){r.push({key:i,value:n[i]})}return encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:r}))}async getImdsV2SessionToken(){const e={url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};const r=await this.transporter.request(e);return r.data}async getAwsRegion(e){if(this.regionFromEnv){return this.regionFromEnv}if(!this.regionUrl){throw new Error('Unable to determine AWS region due to missing "options.credential_source.region_url"')}const r={url:this.regionUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data.substr(0,n.data.length-1)}async getAwsRoleName(e){if(!this.securityCredentialsUrl){throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"')}const r={url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data}async getAwsSecurityCredentials(e,r){const n=await this.transporter.request({url:`${this.securityCredentialsUrl}/${e}`,responseType:"json",headers:r});return n.data}shouldUseMetadataServer(){return!this.regionFromEnv||!this.securityCredentialsFromEnv}get regionFromEnv(){return process.env["AWS_REGION"]||process.env["AWS_DEFAULT_REGION"]||null}get securityCredentialsFromEnv(){if(process.env["AWS_ACCESS_KEY_ID"]&&process.env["AWS_SECRET_ACCESS_KEY"]){return{accessKeyId:process.env["AWS_ACCESS_KEY_ID"],secretAccessKey:process.env["AWS_SECRET_ACCESS_KEY"],token:process.env["AWS_SESSION_TOKEN"]}}return null}};jA.AwsClient=z6;z6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";z6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var gG=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:true});pi.InvalidSubjectTokenError=pi.InvalidMessageFieldError=pi.InvalidCodeFieldError=pi.InvalidTokenTypeFieldError=pi.InvalidExpirationTimeFieldError=pi.InvalidSuccessFieldError=pi.InvalidVersionFieldError=pi.ExecutableResponseError=pi.ExecutableResponse=void 0;var UA="urn:ietf:params:oauth:token-type:saml2";var pG="urn:ietf:params:oauth:token-type:id_token";var fG="urn:ietf:params:oauth:token-type:jwt";var hG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new FA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new BA("Executable response must contain a 'success' field.")}this.version=e.version;this.success=e.success;if(this.success){this.expirationTime=e.expiration_time;this.tokenType=e.token_type;if(this.tokenType!==UA&&this.tokenType!==pG&&this.tokenType!==fG){throw new MA(`Executable response must contain a 'token_type' field when successful and it must be one of ${pG}, ${fG}, or ${UA}.`)}if(this.tokenType===UA){if(!e.saml_response){throw new G6(`Executable response must contain a 'saml_response' field when token_type=${UA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new G6(`Executable response must contain a 'id_token' field when token_type=${pG} or ${fG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new VA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new HA("Executable response must contain a 'message' field when unsuccessful.")}this.errorCode=e.code;this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};pi.ExecutableResponse=hG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var FA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=FA;var BA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=BA;var mG=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=mG;var MA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=MA;var VA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=VA;var HA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=HA;var G6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=G6});var ISe=_(zA=>{"use strict";Object.defineProperty(zA,"__esModule",{value:true});zA.PluggableAuthHandler=void 0;var NNt=GA();var Om=gG();var INt=require("child_process");var yG=require("fs");var vG=class t{static{o(this,"PluggableAuthHandler")}constructor(e){if(!e.command){throw new Error("No command provided.")}this.commandComponents=t.parseCommand(e.command);this.timeoutMillis=e.timeoutMillis;if(!this.timeoutMillis){throw new Error("No timeoutMillis provided.")}this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((r,n)=>{const i=INt.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}});let s="";i.stdout.on("data",u=>{s+=u});i.stderr.on("data",u=>{s+=u});const a=setTimeout(()=>{i.removeAllListeners();i.kill();return n(new Error("The executable failed to finish within the timeout specified."))},this.timeoutMillis);i.on("close",u=>{clearTimeout(a);if(u===0){try{const l=JSON.parse(s);const c=new Om.ExecutableResponse(l);return r(c)}catch(l){if(l instanceof Om.ExecutableResponseError){return n(l)}return n(new Om.ExecutableResponseError(`The executable returned an invalid response: ${s}`))}}else{return n(new NNt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await yG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await yG.promises.lstat(e)).isFile()){return void 0}const r=await yG.promises.readFile(e,{encoding:"utf8"});if(r===""){return void 0}try{const n=JSON.parse(r);const i=new Om.ExecutableResponse(n);if(i.isValid()){return new Om.ExecutableResponse(n)}return void 0}catch(n){if(n instanceof Om.ExecutableResponseError){throw n}throw new Om.ExecutableResponseError(`The output file contained an invalid response: ${r}`)}}static parseCommand(e){const r=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!r){throw new Error(`Provided command: "${e}" could not be parsed.`)}for(let n=0;n<r.length;n++){if(r[n][0]==='"'&&r[n].slice(-1)==='"'){r[n]=r[n].slice(1,-1)}}return r}};zA.PluggableAuthHandler=vG});var GA=_(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:true});Sy.PluggableAuthClient=Sy.ExecutableError=void 0;var PNt=lf();var DNt=gG();var kNt=ISe();var KA=class extends Error{static{o(this,"ExecutableError")}constructor(e,r){super(`The executable failed with exit code: ${r} and error message: ${e}.`);this.code=r;Object.setPrototypeOf(this,new.target.prototype)}};Sy.ExecutableError=KA;var $Nt=30*1e3;var PSe=5*1e3;var DSe=120*1e3;var LNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var kSe=1;var _G=class extends PNt.BaseExternalAccountClient{static{o(this,"PluggableAuthClient")}constructor(e,r){super(e,r);if(!e.credential_source.executable){throw new Error('No valid Pluggable Auth "credential_source" provided.')}this.command=e.credential_source.executable.command;if(!this.command){throw new Error('No valid Pluggable Auth "credential_source" provided.')}if(e.credential_source.executable.timeout_millis===void 0){this.timeoutMillis=$Nt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<PSe||this.timeoutMillis>DSe){throw new Error(`Timeout must be between ${PSe} and ${DSe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new kNt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[LNt]!=="1"){throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.")}let e=void 0;if(this.outputFile){e=await this.handler.retrieveCachedResponse()}if(!e){const r=new Map;r.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience);r.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType);r.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0");if(this.outputFile){r.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile)}const n=this.getServiceAccountEmail();if(n){r.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",n)}e=await this.handler.retrieveResponseFromExecutable(r)}if(e.version>kSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${kSe}.`)}if(!e.success){throw new KA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new DNt.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}}if(e.isExpired()){throw new Error("Executable response is expired.")}return e.subjectToken}};Sy.PluggableAuthClient=_G});var bG=_(YA=>{"use strict";Object.defineProperty(YA,"__esModule",{value:true});YA.ExternalAccountClient=void 0;var qNt=lf();var jNt=lG();var UNt=dG();var FNt=GA();var EG=class{static{o(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e,r){var n,i;if(e&&e.type===qNt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new UNt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new FNt.PluggableAuthClient(e,r)}else{return new jNt.IdentityPoolClient(e,r)}}else{return null}}};YA.ExternalAccountClient=EG});var LSe=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.ExternalAccountAuthorizedUserClient=Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var BNt=ny();var $Se=Xz();var MNt=Wc();var VNt=require("stream");var HNt=lf();Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var wG=class extends $Se.OAuthClientAuthHandler{static{o(this,"ExternalAccountAuthorizedUserHandler")}constructor(e,r,n){super(n);this.url=e;this.transporter=r}async refreshToken(e,r){const n=new URLSearchParams({grant_type:"refresh_token",refresh_token:e});const i={"Content-Type":"application/x-www-form-urlencoded",...r};const s={url:this.url,method:"POST",headers:i,data:n.toString(),responseType:"json"};this.applyClientAuthenticationOptions(s);try{const a=await this.transporter.request(s);const u=a.data;u.res=a;return u}catch(a){if(a instanceof MNt.GaxiosError&&a.response){throw(0,$Se.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var SG=class extends BNt.AuthClient{static{o(this,"ExternalAccountAuthorizedUserClient")}constructor(e,r){super();this.refreshToken=e.refresh_token;const n={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new wG(e.token_url,this.transporter,n);this.cachedAccessToken=null;this.quotaProjectId=e.quota_project_id;if(typeof(r===null||r===void 0?void 0:r.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=HNt.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=r.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(r===null||r===void 0?void 0:r.forceRefreshOnFailure)}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof VNt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){const e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res};if(e.refresh_token!==void 0){this.refreshToken=e.refresh_token}return this.cachedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Ty.ExternalAccountAuthorizedUserClient=SG});var USe=_(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:true});xy.GoogleAuth=xy.CLOUD_SDK_CLIENT_ID=void 0;var zNt=require("child_process");var K6=require("fs");var TG=B7();var GNt=require("os");var AG=require("path");var KNt=ty();var YNt=C6();var WNt=kH();var JNt=LH();var QNt=qH();var Ay=Gz();var xG=Yz();var WA=Jz();var XNt=bG();var Y6=lf();var qSe=LSe();xy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var jSe={NO_PROJECT_ID_FOUND:"Unable to detect a Project Id in the current environment. \nTo learn more about authentication and Google APIs, visit: \nhttps://cloud.google.com/docs/authentication/getting-started"};var JA=class{static{o(this,"GoogleAuth")}get isGCE(){return this.checkIsGCE}constructor(e){this.checkIsGCE=void 0;this.jsonContent=null;this.cachedCredential=null;e=e||{};this._cachedProjectId=e.projectId||null;this.cachedCredential=e.authClient||null;this.keyFilename=e.keyFilename||e.keyFile;this.scopes=e.scopes;this.jsonContent=e.credentials||null;this.clientOptions=e.clientOptions}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath;e.useJWTAccessWithScope=this.useJWTAccessWithScope;e.defaultScopes=this.defaultScopes}getProjectId(e){if(e){this.getProjectIdAsync().then(r=>e(null,r),e)}else{return this.getProjectIdAsync()}}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===jSe.NO_PROJECT_ID_FOUND){return null}else{throw e}}}async findAndCacheProjectId(){let e=null;e||(e=await this.getProductionProjectId());e||(e=await this.getFileProjectId());e||(e=await this.getDefaultServiceProjectId());e||(e=await this.getGCEProjectId());e||(e=await this.getExternalAccountClientProjectId());if(e){this._cachedProjectId=e;return e}else{throw new Error(jSe.NO_PROJECT_ID_FOUND)}}async getProjectIdAsync(){if(this._cachedProjectId){return this._cachedProjectId}if(!this._findProjectIdPromise){this._findProjectIdPromise=this.findAndCacheProjectId()}return this._findProjectIdPromise}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},r){let n;if(typeof e==="function"){r=e}else{n=e}if(r){this.getApplicationDefaultAsync(n).then(i=>r(null,i.credential,i.projectId),r)}else{return this.getApplicationDefaultAsync(n)}}async getApplicationDefaultAsync(e={}){if(this.cachedCredential){return await this.prepareAndCacheADC(this.cachedCredential)}const r=process.env["GOOGLE_CLOUD_QUOTA_PROJECT"];let n;n=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Y6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}n=await this._tryGetApplicationCredentialsFromWellKnownFile(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Y6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}let i;try{i=await this._checkIsGCE()}catch(s){if(s instanceof Error){s.message=`Unexpected error determining execution environment: ${s.message}`}throw s}if(!i){throw new Error("Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.")}e.scopes=this.getAnyScopes();return await this.prepareAndCacheADC(new WNt.Compute(e),r)}async prepareAndCacheADC(e,r){const n=await this.getProjectIdOptional();if(r){e.quotaProjectId=r}this.cachedCredential=e;return{credential:e,projectId:n}}async _checkIsGCE(){if(this.checkIsGCE===void 0){this.checkIsGCE=await TG.isAvailable()}return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){const r=process.env["GOOGLE_APPLICATION_CREDENTIALS"]||process.env["google_application_credentials"];if(!r||r.length===0){return null}try{return this._getApplicationCredentialsFromFilePath(r,e)}catch(n){if(n instanceof Error){n.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${n.message}`}throw n}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let r=null;if(this._isWindows()){r=process.env["APPDATA"]}else{const i=process.env["HOME"];if(i){r=AG.join(i,".config")}}if(r){r=AG.join(r,"gcloud","application_default_credentials.json");if(!K6.existsSync(r)){r=null}}if(!r){return null}const n=await this._getApplicationCredentialsFromFilePath(r,e);return n}async _getApplicationCredentialsFromFilePath(e,r={}){if(!e||e.length===0){throw new Error("The file path is invalid.")}try{e=K6.realpathSync(e);if(!K6.lstatSync(e).isFile()){throw new Error}}catch(i){if(i instanceof Error){i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`}throw i}const n=K6.createReadStream(e);return this.fromStream(n,r)}fromImpersonatedJSON(e){var r,n,i,s;if(!e){throw new Error("Must pass in a JSON object containing an impersonated refresh token")}if(e.type!==WA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${WA.IMPERSONATED_ACCOUNT_TYPE}" type`)}if(!e.source_credentials){throw new Error("The incoming JSON object does not contain a source_credentials field")}if(!e.service_account_impersonation_url){throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field")}const a=new xG.UserRefreshClient(e.source_credentials.client_id,e.source_credentials.client_secret,e.source_credentials.refresh_token);const u=(n=(r=/(?<target>[^/]+):generateAccessToken$/.exec(e.service_account_impersonation_url))===null||r===void 0?void 0:r.groups)===null||n===void 0?void 0:n.target;if(!u){throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`)}const l=(i=this.getAnyScopes())!==null&&i!==void 0?i:[];const c=new WA.Impersonated({delegates:(s=e.delegates)!==null&&s!==void 0?s:[],sourceClient:a,targetPrincipal:u,targetScopes:Array.isArray(l)?l:[l]});return c}fromJSON(e,r={}){let n;r=r||{};if(e.type===xG.USER_REFRESH_ACCOUNT_TYPE){n=new xG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===WA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===Y6.EXTERNAL_ACCOUNT_TYPE){n=XNt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===qSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new qSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new Ay.JWT(r);this.setGapicJWTValues(n);n.fromJSON(e)}return n}_cacheClientFromJSON(e,r){const n=this.fromJSON(e,r);this.jsonContent=e;this.cachedCredential=n;return n}fromStream(e,r={},n){let i={};if(typeof r==="function"){n=r}else{i=r}if(n){this.fromStreamAsync(e,i).then(s=>n(null,s),n)}else{return this.fromStreamAsync(e,i)}}fromStreamAsync(e,r){return new Promise((n,i)=>{if(!e){throw new Error("Must pass in a stream containing the Google auth settings.")}let s="";e.setEncoding("utf8").on("error",i).on("data",a=>s+=a).on("end",()=>{try{try{const a=JSON.parse(s);const u=this._cacheClientFromJSON(a,r);return n(u)}catch(a){if(!this.keyFilename)throw a;const u=new Ay.JWT({...this.clientOptions,keyFile:this.keyFilename});this.cachedCredential=u;this.setGapicJWTValues(u);return n(u)}}catch(a){return i(a)}})})}fromAPIKey(e,r){r=r||{};const n=new Ay.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=GNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,zNt.exec)("gcloud config config-helper --format json",(r,n)=>{if(!r&&n){try{const i=JSON.parse(n).configuration.properties.core.project;e(i);return}catch(i){}}e(null)})})}getProductionProjectId(){return process.env["GCLOUD_PROJECT"]||process.env["GOOGLE_CLOUD_PROJECT"]||process.env["gcloud_project"]||process.env["google_cloud_project"]}async getFileProjectId(){if(this.cachedCredential){return this.cachedCredential.projectId}if(this.keyFilename){const r=await this.getClient();if(r&&r.projectId){return r.projectId}}const e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(e){return e.projectId}else{return null}}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==Y6.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await TG.project("project-id");return e}catch(e){return null}}getCredentials(e){if(e){this.getCredentialsAsync().then(r=>e(null,r),e)}else{return this.getCredentialsAsync()}}async getCredentialsAsync(){const e=await this.getClient();if(e instanceof Y6.BaseExternalAccountClient){const i=e.getServiceAccountEmail();if(i){return{client_email:i}}}if(this.jsonContent){const i={client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key};return i}const r=await this._checkIsGCE();if(!r){throw new Error("Unknown error.")}const n=await TG.instance({property:"service-accounts/",params:{recursive:"true"}});if(!n||!n.default||!n.default.email){throw new Error("Failure from metadata server.")}return{client_email:n.default.email}}async getClient(){if(!this.cachedCredential){if(this.jsonContent){this._cacheClientFromJSON(this.jsonContent,this.clientOptions)}else if(this.keyFilename){const e=AG.resolve(this.keyFilename);const r=K6.createReadStream(e);await this.fromStreamAsync(r,this.clientOptions)}else{await this.getApplicationDefaultAsync(this.clientOptions)}}return this.cachedCredential}async getIdTokenClient(e){const r=await this.getClient();if(!("fetchIdToken"in r)){throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.")}return new JNt.IdTokenClient({targetAudience:e,idTokenProvider:r})}async getAccessToken(){const e=await this.getClient();return(await e.getAccessToken()).token}async getRequestHeaders(e){const r=await this.getClient();return r.getRequestHeaders(e)}async authorizeRequest(e){e=e||{};const r=e.url||e.uri;const n=await this.getClient();const i=await n.getRequestHeaders(r);e.headers=Object.assign(e.headers||{},i);return e}async request(e){const r=await this.getClient();return r.request(e)}getEnv(){return(0,QNt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,KNt.createCrypto)();if(r instanceof Ay.JWT&&r.key){const s=await n.sign(r.key,e);return s}const i=await this.getCredentials();if(!i.client_email){throw new Error("Cannot sign data without `client_email`.")}return this.signBlob(n,i.client_email,e)}async signBlob(e,r,n){const i=`https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${r}:signBlob`;const s=await this.request({method:"POST",url:i,data:{payload:e.encodeBase64StringUtf8(n)}});return s.data.signedBlob}};xy.GoogleAuth=JA;JA.DefaultTransporter=YNt.DefaultTransporter});var FSe=_(QA=>{"use strict";Object.defineProperty(QA,"__esModule",{value:true});QA.IAMAuth=void 0;var CG=class{static{o(this,"IAMAuth")}constructor(e,r){this.selector=e;this.token=r;this.selector=e;this.token=r}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};QA.IAMAuth=CG});var BSe=_(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:true});Nu.DownscopedClient=Nu.EXPIRATION_TIME_OFFSET=Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var ZNt=require("stream");var eIt=ny();var tIt=eG();var rIt="urn:ietf:params:oauth:grant-type:token-exchange";var nIt="urn:ietf:params:oauth:token-type:access_token";var iIt="urn:ietf:params:oauth:token-type:access_token";var sIt="https://sts.googleapis.com/v1/token";Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Nu.EXPIRATION_TIME_OFFSET=5*60*1e3;var RG=class extends eIt.AuthClient{static{o(this,"DownscopedClient")}constructor(e,r,n,i){super();this.authClient=e;this.credentialAccessBoundary=r;if(r.accessBoundary.accessBoundaryRules.length===0){throw new Error("At least one access boundary rule needs to be defined.")}else if(r.accessBoundary.accessBoundaryRules.length>Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`)}for(const s of r.accessBoundary.accessBoundaryRules){if(s.availablePermissions.length===0){throw new Error("At least one permission should be defined in access boundary rules.")}}this.stsCredential=new tIt.StsCredentials(sIt);this.cachedDownscopedAccessToken=null;if(typeof(n===null||n===void 0?void 0:n.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=Nu.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=n.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(n===null||n===void 0?void 0:n.forceRefreshOnFailure);this.quotaProjectId=i}setCredentials(e){if(!e.expiry_date){throw new Error("The access token expiry_date field is missing in the provided credentials.")}super.setCredentials(e);this.cachedDownscopedAccessToken=e}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof ZNt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){var e;const r=(await this.authClient.getAccessToken()).token;const n={grantType:rIt,requestedTokenType:nIt,subjectToken:r,subjectTokenType:iIt};const i=await this.stsCredential.exchangeToken(n,void 0,this.credentialAccessBoundary);const s=((e=this.authClient.credentials)===null||e===void 0?void 0:e.expiry_date)||null;const a=i.expires_in?new Date().getTime()+i.expires_in*1e3:s;this.cachedDownscopedAccessToken={access_token:i.access_token,expiry_date:a,res:i.res};this.credentials={};Object.assign(this.credentials,this.cachedDownscopedAccessToken);delete this.credentials.res;this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null});return this.cachedDownscopedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Nu.DownscopedClient=RG});var OG=_(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:true});Ot.GoogleAuth=Ot.auth=Ot.DefaultTransporter=Ot.PluggableAuthClient=Ot.DownscopedClient=Ot.BaseExternalAccountClient=Ot.ExternalAccountClient=Ot.IdentityPoolClient=Ot.AwsClient=Ot.UserRefreshClient=Ot.LoginTicket=Ot.OAuth2Client=Ot.CodeChallengeMethod=Ot.Impersonated=Ot.JWT=Ot.JWTAccess=Ot.IdTokenClient=Ot.IAMAuth=Ot.GCPEnv=Ot.Compute=Ot.AuthClient=void 0;var MSe=USe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return MSe.GoogleAuth}});var aIt=ny();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return aIt.AuthClient}});var oIt=kH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return oIt.Compute}});var uIt=qH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return uIt.GCPEnv}});var lIt=FSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return lIt.IAMAuth}});var cIt=LH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return cIt.IdTokenClient}});var dIt=Hz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return dIt.JWTAccess}});var pIt=Gz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return pIt.JWT}});var fIt=Jz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return fIt.Impersonated}});var VSe=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return VSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return VSe.OAuth2Client}});var hIt=IH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return hIt.LoginTicket}});var mIt=Yz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return mIt.UserRefreshClient}});var gIt=dG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return gIt.AwsClient}});var yIt=lG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return yIt.IdentityPoolClient}});var vIt=bG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return vIt.ExternalAccountClient}});var _It=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return _It.BaseExternalAccountClient}});var EIt=BSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return EIt.DownscopedClient}});var bIt=GA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return bIt.PluggableAuthClient}});var wIt=C6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return wIt.DefaultTransporter}});var SIt=new MSe.GoogleAuth;Ot.auth=SIt});var Ry=_(Cy=>{"use strict";var TIt=Cy&&Cy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Cy,"__esModule",{value:true});Cy.getServiceAccountIdToken=void 0;var AIt=OG();var xIt=TIt(Vu());var CIt=new AIt.GoogleAuth;var HSe=new xIt.default({max:50,maxAge:1e3*60*50});async function RIt(t){let e=HSe.get(t);if(!e){const r=await CIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);HSe.set(t,e)}return e}o(RIt,"getServiceAccountIdToken");Cy.getServiceAccountIdToken=RIt});var WSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Oy=As();var OIt=Ry();var NIt={"Content-Type":"application/json"};var IIt=/\/*$/;async function PIt(t){const{baseUrl:e,fetch:r=globalThis.fetch,querySerializer:n,bodySerializer:i,zuploExtensions:s,...a}=t;const u=s?.fastifyRequest.log;const l=s?.fastifyRequest.id;const c=s?.options?.userSub??s?.fastifyRequest.getUserSub();const d=new Headers({...NIt,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,OIt.getServiceAccountIdToken)(e);d.set("Authorization",`Bearer ${p}`);async function f(h,m){const{headers:g,body:y,params:v={},parseAs:w="json",querySerializer:E=n??zSe,bodySerializer:b=i??GSe,...S}=m||{};const T=KSe(h,{baseUrl:e,params:v,querySerializer:E});const A=YSe(d,g,v.header);const P={redirect:"follow",...a,...S,headers:A};if(y)P.body=b(y);if(P.body instanceof FormData)A.delete("Content-Type");const D=await r(T,P);if(D.status===404){const F=await D.json();if(F&&F.hasOwnProperty("type")&&F.hasOwnProperty("title")&&F.hasOwnProperty("status")){throw new Oy.ApiError(F)}throw new Oy.ApiError(Oy.Problems.NOT_FOUND)}if(D.status===204||D.headers.get("Content-Length")==="0"){return D.ok?{data:{},response:D}:{error:{},response:D}}if(D.ok){let F=D.body;if(w!=="stream"){const V=D.clone();F=typeof V[w]==="function"?await V[w]():await V.text()}return{data:F,response:D}}else{u.debug(`Error on internal api: path: ${T}, status: ${D.status}, headers: ${JSON.stringify(D.headers)}, body: ${await D.clone().text()}`);let F={};try{F=await D.clone().json();if(F.type&&F.status&&F.title){throw new Oy.ApiError(F)}}catch(V){}throw new Oy.ApiError(Oy.Problems.INTERNAL_SERVER_ERROR)}}o(f,"coreFetch");return{async GET(h,m){return f(h,{...m,method:"GET"})},async PUT(h,m){return f(h,{...m,method:"PUT"})},async POST(h,m){return f(h,{...m,method:"POST"})},async DELETE(h,m){return f(h,{...m,method:"DELETE"})},async OPTIONS(h,m){return f(h,{...m,method:"OPTIONS"})},async HEAD(h,m){return f(h,{...m,method:"HEAD"})},async PATCH(h,m){return f(h,{...m,method:"PATCH"})},async TRACE(h,m){return f(h,{...m,method:"TRACE"})}}}o(PIt,"createClient");Fo.createClient=PIt;function zSe(t){const e=new URLSearchParams;if(t&&typeof t==="object"){for(const[r,n]of Object.entries(t)){if(n===void 0||n===null)continue;e.set(r,n)}}return e.toString()}o(zSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=zSe;function GSe(t){return JSON.stringify(t)}o(GSe,"defaultBodySerializer");Fo.defaultBodySerializer=GSe;function KSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(IIt,""):""}${t}`;if(e.params.path){for(const[n,i]of Object.entries(e.params.path))r=r.replace(`{${n}}`,encodeURIComponent(String(i)))}if(e.params.query){const n=e.querySerializer(e.params.query);if(n)r+=`?${n}`}return r}o(KSe,"createFinalURL");Fo.createFinalURL=KSe;function YSe(...t){const e=new Headers;for(const r of t){if(!r||typeof r!=="object")continue;const n=r instanceof Headers?r.entries():Object.entries(r);for(const[i,s]of n){if(s!==void 0&&s!==null){e.set(i,s)}}}return e}o(YSe,"mergeHeaders");Fo.mergeHeaders=YSe});var JSe=_(cf=>{"use strict";var DIt=cf&&cf.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(cf,"__esModule",{value:true});cf.ApiKeyService=cf.createApiKeyServiceClient=void 0;var Ny=As();var kIt=OG();var XA=DIt(za());var $It=WSe();async function LIt(t){return(0,$It.createClient)({baseUrl:XA.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(LIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=LIt;var NG=class{static{o(this,"ApiKeyService")}logger;requestId;constructor(e){this.logger=e.log;this.requestId=e.id}async fetchGCP(e,r={}){this.logger.info(`Fetching with GCP JWT ${r.method} ${e} from Api Key Service API.`);const n=new kIt.GoogleAuth;const i=await n.getIdTokenClient(XA.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${XA.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:"GET",body:r.body,headers:{...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}}})}`);const s=await i.getRequestHeaders();const a=await i.request({url:`${XA.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:r.method||"GET",body:r.body,headers:{...s,...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}},validateStatus:u=>u>=200&&u<500});if(a.status===404){const u=await a.data;if(u&&u.hasOwnProperty("type")&&u.hasOwnProperty("title")&&u.hasOwnProperty("status")){throw new Ny.ApiError(u)}throw new Ny.ApiError(Ny.Problems.NOT_FOUND)}if(a.status>=300){this.logger.debug(`Error on api-key-service: path: ${e}, status: ${a.status}, headers: ${JSON.stringify(a.headers)}, body: ${JSON.stringify(a.data)}`);const u=a.data;if(u.type&&u.status&&u.title){throw new Ny.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Ny.ApiError(Ny.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};cf.ApiKeyService=NG});var XSe=_(Iy=>{"use strict";var qIt=Iy&&Iy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Iy,"__esModule",{value:true});Iy.AuthApiService=void 0;var Nm=As();var QSe=qIt(za());var jIt=Ry();var IG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!QSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=QSe.default.AUTH_API_URL}async getClientJWT(e,r){let n;try{n=await this.fetch(`/v1/clients/${e}`,{method:"GET"})}catch(s){if(s.status===Nm.Problems.NOT_FOUND.status){n=await this.fetch(`/v1/clients`,{method:"POST",body:JSON.stringify({client_id:e})})}else{throw s}}const i=await this.fetch(`/v1/oauth/token`,{method:"POST",body:JSON.stringify({client_id:e,client_secret:n.client_secret,grant_type:"client_credentials",custom_claims:r})});return i.access_token}async fetch(e,r){this.logger.info(`Fetching internally ${e} from Auth API V2.`);const n=new Headers({"content-type":"application/json","zp-rid":this.requestId,authorization:""});if(process.env.K_SERVICE){const s=await(0,jIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===Nm.HttpStatusCode.NOT_FOUND){throw new Nm.ApiError(Nm.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on auth-api: path: ${e}, status: ${i.status}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Nm.ApiError(s)}this.logger.error(`Error not handled on auth-api: path: ${e}, status: ${i.status}`);throw new Nm.ApiError(Nm.Problems.INTERNAL_SERVER_ERROR)}return i.clone().json()}};Iy.AuthApiService=IG});var ex=_(ZA=>{"use strict";Object.defineProperty(ZA,"__esModule",{value:true});ZA.ApiServiceClient=void 0;var Py=As();var UIt=Ry();var PG=class{static{o(this,"ApiServiceClient")}userSub;logger;requestId;baseUrl;cache;constructor(e,r,n){this.userSub=n.userSub;this.logger=n.logger;this.requestId=n.requestId;this.baseUrl=e;this.cache=r}async cachedFetch(e,r,n){if(!this.userSub||!n){throw new Error("userSub and cacheKey parameters are required to use cachedFetch")}const i=`${this.userSub}@${n}`;if(this.cache.has(i)){return this.cache.get(i)}const s=await this.fetchInternally(e,r);this.cache.set(i,s);return s}async fetchInternally(e,r){this.logger.info(`Fetching internally ${r.method} ${this.baseUrl}${e}`);const n=new Headers({...r.headers,"zuplo-user":this.userSub,"content-type":"application/json","zp-rid":this.requestId});if(process.env.K_SERVICE){const s=await(0,UIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===404){const s=await i.json();if(s&&s.hasOwnProperty("type")&&s.hasOwnProperty("title")&&s.hasOwnProperty("status")){throw new Py.ApiError(s)}throw new Py.ApiError(Py.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on internal api: path: ${e}, status: ${i.status}, headers: ${JSON.stringify(i.headers)}, body: ${JSON.stringify(i.clone().text())}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Py.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Py.ApiError(Py.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};ZA.ApiServiceClient=PG});var rTe=_(Ml=>{"use strict";var eTe=Ml&&Ml.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ml,"__esModule",{value:true});Ml.ContentApiService=Ml.getContentApiStorageTarballPath=Ml.contentApiTarballFileName=void 0;var FIt=eTe(Vu());var ZSe=eTe(za());var BIt=ex();var MIt=new FIt.default({max:500,maxAge:1e3*60*50});function tTe(t,e){return`${t}--${e}.tar.gz`}o(tTe,"contentApiTarballFileName");Ml.contentApiTarballFileName=tTe;function VIt(t,e){const r=tTe(t,e);return`${t}/builds/${r}`}o(VIt,"getContentApiStorageTarballPath");Ml.getContentApiStorageTarballPath=VIt;var DG=class extends BIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!ZSe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(ZSe.default.CONTENT_API_URL,MIt,e)}};Ml.ContentApiService=DG});var sTe=_(Dy=>{"use strict";var iTe=Dy&&Dy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Dy,"__esModule",{value:true});Dy.DevApiService=void 0;var HIt=iTe(Vu());var nTe=iTe(za());var zIt=ex();var GIt=new HIt.default({max:500,maxAge:1e3*60*50});var kG=class extends zIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!nTe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(nTe.default.DEV_API_URL,GIt,{userSub:n,logger:e.log,requestId:e.id})}};Dy.DevApiService=kG});var uTe=_((bhr,oTe)=>{var aTe=require("stream").Stream;var KIt=require("util");oTe.exports=Iu;function Iu(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(Iu,"DelayedStream");KIt.inherits(Iu,aTe);Iu.create=function(t,e){var r=new this;e=e||{};for(var n in e){r[n]=e[n]}r.source=t;var i=t.emit;t.emit=function(){r._handleEmit(arguments);return i.apply(t,arguments)};t.on("error",function(){});if(r.pauseStream){t.pause()}return r};Object.defineProperty(Iu.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});Iu.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Iu.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};Iu.prototype.pause=function(){this.source.pause()};Iu.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};Iu.prototype.pipe=function(){var t=aTe.prototype.pipe.apply(this,arguments);this.resume();return t};Iu.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}if(t[0]==="data"){this.dataSize+=t[1].length;this._checkIfMaxDataSizeExceeded()}this._bufferedEvents.push(t)};Iu.prototype._checkIfMaxDataSizeExceeded=function(){if(this._maxDataSizeExceeded){return}if(this.dataSize<=this.maxDataSize){return}this._maxDataSizeExceeded=true;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}});var pTe=_((Shr,dTe)=>{var YIt=require("util");var cTe=require("stream").Stream;var lTe=uTe();dTe.exports=Xn;function Xn(){this.writable=false;this.readable=true;this.dataSize=0;this.maxDataSize=2*1024*1024;this.pauseStreams=true;this._released=false;this._streams=[];this._currentStream=null;this._insideLoop=false;this._pendingNext=false}o(Xn,"CombinedStream");YIt.inherits(Xn,cTe);Xn.create=function(t){var e=new this;t=t||{};for(var r in t){e[r]=t[r]}return e};Xn.isStreamLike=function(t){return typeof t!=="function"&&typeof t!=="string"&&typeof t!=="boolean"&&typeof t!=="number"&&!Buffer.isBuffer(t)};Xn.prototype.append=function(t){var e=Xn.isStreamLike(t);if(e){if(!(t instanceof lTe)){var r=lTe.create(t,{maxDataSize:Infinity,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this));t=r}this._handleErrors(t);if(this.pauseStreams){t.pause()}}this._streams.push(t);return this};Xn.prototype.pipe=function(t,e){cTe.prototype.pipe.call(this,t,e);this.resume();return t};Xn.prototype._getNext=function(){this._currentStream=null;if(this._insideLoop){this._pendingNext=true;return}this._insideLoop=true;try{do{this._pendingNext=false;this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=false}};Xn.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t=="undefined"){this.end();return}if(typeof t!=="function"){this._pipeNext(t);return}var e=t;e(function(r){var n=Xn.isStreamLike(r);if(n){r.on("data",this._checkDataSize.bind(this));this._handleErrors(r)}this._pipeNext(r)}.bind(this))};Xn.prototype._pipeNext=function(t){this._currentStream=t;var e=Xn.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this));t.pipe(this,{end:false});return}var r=t;this.write(r);this._getNext()};Xn.prototype._handleErrors=function(t){var e=this;t.on("error",function(r){e._emitError(r)})};Xn.prototype.write=function(t){this.emit("data",t)};Xn.prototype.pause=function(){if(!this.pauseStreams){return}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function")this._currentStream.pause();this.emit("pause")};Xn.prototype.resume=function(){if(!this._released){this._released=true;this.writable=true;this._getNext()}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function")this._currentStream.resume();this.emit("resume")};Xn.prototype.end=function(){this._reset();this.emit("end")};Xn.prototype.destroy=function(){this._reset();this.emit("close")};Xn.prototype._reset=function(){this.writable=false;this._streams=[];this._currentStream=null};Xn.prototype._checkDataSize=function(){this._updateDataSize();if(this.dataSize<=this.maxDataSize){return}var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))};Xn.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){if(!e.dataSize){return}t.dataSize+=e.dataSize});if(this._currentStream&&this._currentStream.dataSize){this.dataSize+=this._currentStream.dataSize}};Xn.prototype._emitError=function(t){this._reset();this.emit("error",t)}});var hTe=_((Ahr,fTe)=>{fTe.exports=WIt;function WIt(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;if(e){e(t)}else{setTimeout(t,0)}}o(WIt,"defer")});var $G=_((Chr,gTe)=>{var mTe=hTe();gTe.exports=JIt;function JIt(t){var e=false;mTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{mTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(JIt,"async")});var LG=_((Ohr,yTe)=>{yTe.exports=QIt;function QIt(t){Object.keys(t.jobs).forEach(XIt.bind(t));t.jobs={}}o(QIt,"abort");function XIt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(XIt,"clean")});var qG=_((Ihr,_Te)=>{var vTe=$G();var ZIt=LG();_Te.exports=ePt;function ePt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=tPt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){ZIt(r)}else{r.results[i]=a}n(s,r.results)})}o(ePt,"iterate");function tPt(t,e,r,n){var i;if(t.length==2){i=t(r,vTe(n))}else{i=t(r,e,vTe(n))}return i}o(tPt,"runJob")});var jG=_((Dhr,ETe)=>{ETe.exports=rPt;function rPt(t,e){var r=!Array.isArray(t),n={index:0,keyedList:r||e?Object.keys(t):null,jobs:{},results:r?{}:[],size:r?Object.keys(t).length:t.length};if(e){n.keyedList.sort(r?e:function(i,s){return e(t[i],t[s])})}return n}o(rPt,"state")});var UG=_(($hr,bTe)=>{var nPt=LG();var iPt=$G();bTe.exports=sPt;function sPt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;nPt(this);iPt(t)(null,this.results)}o(sPt,"terminator")});var STe=_((qhr,wTe)=>{var aPt=qG();var oPt=jG();var uPt=UG();wTe.exports=lPt;function lPt(t,e,r){var n=oPt(t);while(n.index<(n["keyedList"]||t).length){aPt(t,e,n,function(i,s){if(i){r(i,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}});n.index++}return uPt.bind(n,r)}o(lPt,"parallel")});var FG=_((Uhr,tx)=>{var TTe=qG();var cPt=jG();var dPt=UG();tx.exports=pPt;tx.exports.ascending=ATe;tx.exports.descending=fPt;function pPt(t,e,r,n){var i=cPt(t,r);TTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){TTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return dPt.bind(i,n)}o(pPt,"serialOrdered");function ATe(t,e){return t<e?-1:t>e?1:0}o(ATe,"ascending");function fPt(t,e){return-1*ATe(t,e)}o(fPt,"descending")});var CTe=_((Bhr,xTe)=>{var hPt=FG();xTe.exports=mPt;function mPt(t,e,r){return hPt(t,e,null,r)}o(mPt,"serial")});var OTe=_((Vhr,RTe)=>{RTe.exports={parallel:STe(),serial:CTe(),serialOrdered:FG()}});var ITe=_((Hhr,NTe)=>{NTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var kTe=_((zhr,DTe)=>{var HG=pTe();var PTe=require("util");var BG=require("path");var gPt=require("http");var yPt=require("https");var vPt=require("url").parse;var _Pt=require("fs");var EPt=require("stream").Stream;var MG=AB();var bPt=OTe();var VG=ITe();DTe.exports=Fr;PTe.inherits(Fr,HG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];HG.call(this);t=t||{};for(var e in t){this[e]=t[e]}}o(Fr,"FormData");Fr.LINE_BREAK="\r\n";Fr.DEFAULT_CONTENT_TYPE="application/octet-stream";Fr.prototype.append=function(t,e,r){r=r||{};if(typeof r=="string"){r={filename:r}}var n=HG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(PTe.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(t,e,r);var s=this._multiPartFooter();n(i);n(e);n(s);this._trackLength(i,e,r)};Fr.prototype._trackLength=function(t,e,r){var n=0;if(r.knownLength!=null){n+=+r.knownLength}else if(Buffer.isBuffer(e)){n=e.length}else if(typeof e==="string"){n=Buffer.byteLength(e)}this._valueLength+=n;this._overheadLength+=Buffer.byteLength(t)+Fr.LINE_BREAK.length;if(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof EPt)){return}if(!r.knownLength){this._valuesToMeasure.push(e)}};Fr.prototype._lengthRetriever=function(t,e){if(t.hasOwnProperty("fd")){if(t.end!=void 0&&t.end!=Infinity&&t.start!=void 0){e(null,t.end+1-(t.start?t.start:0))}else{_Pt.stat(t.path,function(r,n){var i;if(r){e(r);return}i=n.size-(t.start?t.start:0);e(null,i)})}}else if(t.hasOwnProperty("httpVersion")){e(null,+t.headers["content-length"])}else if(t.hasOwnProperty("httpModule")){t.on("response",function(r){t.pause();e(null,+r.headers["content-length"])});t.resume()}else{e("Unknown stream")}};Fr.prototype._multiPartHeader=function(t,e,r){if(typeof r.header=="string"){return r.header}var n=this._getContentDisposition(e,r);var i=this._getContentType(e,r);var s="";var a={"Content-Disposition":["form-data",'name="'+t+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};if(typeof r.header=="object"){VG(a,r.header)}var u;for(var l in a){if(!a.hasOwnProperty(l))continue;u=a[l];if(u==null){continue}if(!Array.isArray(u)){u=[u]}if(u.length){s+=l+": "+u.join("; ")+Fr.LINE_BREAK}}return"--"+this.getBoundary()+Fr.LINE_BREAK+s+Fr.LINE_BREAK};Fr.prototype._getContentDisposition=function(t,e){var r,n;if(typeof e.filepath==="string"){r=BG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=BG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=BG.basename(t.client._httpMessage.path||"")}if(r){n='filename="'+r+'"'}return n};Fr.prototype._getContentType=function(t,e){var r=e.contentType;if(!r&&t.name){r=MG.lookup(t.name)}if(!r&&t.path){r=MG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=MG.lookup(e.filepath||e.filename)}if(!r&&typeof t=="object"){r=Fr.DEFAULT_CONTENT_TYPE}return r};Fr.prototype._multiPartFooter=function(){return function(t){var e=Fr.LINE_BREAK;var r=this._streams.length===0;if(r){e+=this._lastBoundary()}t(e)}.bind(this)};Fr.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Fr.LINE_BREAK};Fr.prototype.getHeaders=function(t){var e;var r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t){if(t.hasOwnProperty(e)){r[e.toLowerCase()]=t[e]}}return r};Fr.prototype.setBoundary=function(t){this._boundary=t};Fr.prototype.getBoundary=function(){if(!this._boundary){this._generateBoundary()}return this._boundary};Fr.prototype.getBuffer=function(){var t=new Buffer.alloc(0);var e=this.getBoundary();for(var r=0,n=this._streams.length;r<n;r++){if(typeof this._streams[r]!=="function"){if(Buffer.isBuffer(this._streams[r])){t=Buffer.concat([t,this._streams[r]])}else{t=Buffer.concat([t,Buffer.from(this._streams[r])])}if(typeof this._streams[r]!=="string"||this._streams[r].substring(2,e.length+2)!==e){t=Buffer.concat([t,Buffer.from(Fr.LINE_BREAK)])}}}return Buffer.concat([t,Buffer.from(this._lastBoundary())])};Fr.prototype._generateBoundary=function(){var t="--------------------------";for(var e=0;e<24;e++){t+=Math.floor(Math.random()*10).toString(16)}this._boundary=t};Fr.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;if(this._streams.length){t+=this._lastBoundary().length}if(!this.hasKnownLength()){this._error(new Error("Cannot calculate proper length in synchronous way."))}return t};Fr.prototype.hasKnownLength=function(){var t=true;if(this._valuesToMeasure.length){t=false}return t};Fr.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length){e+=this._lastBoundary().length}if(!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}bPt.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){t(r);return}n.forEach(function(i){e+=i});t(null,e)})};Fr.prototype.submit=function(t,e){var r,n,i={method:"post"};if(typeof t=="string"){t=vPt(t);n=VG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=VG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=yPt.request(n)}else{r=gPt.request(n)}this.getLength(function(s,a){if(s&&s!=="Unknown stream"){this._error(s);return}if(a){r.setHeader("Content-Length",a)}this.pipe(r);if(e){var u;var l=o(function(c,d){r.removeListener("error",l);r.removeListener("response",u);return e.call(this,c,d)},"callback");u=l.bind(this,null);r.on("error",l);r.on("response",u)}}.bind(this));return r};Fr.prototype._error=function(t){if(!this.error){this.error=t;this.pause();this.emit("error",t)}};Fr.prototype.toString=function(){return"[object FormData]"}});var LTe=_($Te=>{"use strict";var wPt=require("url").parse;var SPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var TPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function APt(t){var e=typeof t==="string"?wPt(t):t||{};var r=e.protocol;var n=e.host;var i=e.port;if(typeof n!=="string"||!n||typeof r!=="string"){return""}r=r.split(":",1)[0];n=n.replace(/:\d*$/,"");i=parseInt(i)||SPt[r]||0;if(!xPt(n,i)){return""}var s=ky("npm_config_"+r+"_proxy")||ky(r+"_proxy")||ky("npm_config_proxy")||ky("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(APt,"getProxyForUrl");function xPt(t,e){var r=(ky("npm_config_no_proxy")||ky("no_proxy")).toLowerCase();if(!r){return true}if(r==="*"){return false}return r.split(/[,\s]/).every(function(n){if(!n){return true}var i=n.match(/^(.+):(\d+)$/);var s=i?i[1]:n;var a=i?parseInt(i[2]):0;if(a&&a!==e){return true}if(!/^[.*]/.test(s)){return t!==s}if(s.charAt(0)==="*"){s=s.slice(1)}return!TPt.call(t,s)})}o(xPt,"shouldProxy");function ky(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o(ky,"getEnv");$Te.getProxyForUrl=APt});var jTe=_((Whr,qTe)=>{var W6;qTe.exports=function(){if(!W6){try{W6=Ja()("follow-redirects")}catch(t){}if(typeof W6!=="function"){W6=o(function(){},"debug")}}W6.apply(null,arguments)}});var VTe=_((Qhr,rK)=>{var X6=require("url");var J6=X6.URL;var CPt=require("http");var RPt=require("https");var WG=require("stream").Writable;var JG=require("assert");var UTe=jTe();var QG=false;try{JG(new J6)}catch(t){QG=t.code==="ERR_INVALID_URL"}var OPt=["auth","host","hostname","href","path","pathname","port","protocol","query","search"];var XG=["abort","aborted","connect","error","socket","timeout"];var ZG=Object.create(null);XG.forEach(function(t){ZG[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var GG=Z6("ERR_INVALID_URL","Invalid URL",TypeError);var KG=Z6("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var NPt=Z6("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",KG);var IPt=Z6("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var PPt=Z6("ERR_STREAM_WRITE_AFTER_END","write after end");var DPt=WG.prototype.destroy||BTe;function Ta(t,e){WG.call(this);this._sanitizeOptions(t);this._options=t;this._ended=false;this._ending=false;this._redirectCount=0;this._redirects=[];this._requestBodyLength=0;this._requestBodyBuffers=[];if(e){this.on("response",e)}var r=this;this._onNativeResponse=function(n){try{r._processResponse(n)}catch(i){r.emit("error",i instanceof KG?i:new KG({cause:i}))}};this._performRequest()}o(Ta,"RedirectableRequest");Ta.prototype=Object.create(WG.prototype);Ta.prototype.abort=function(){tK(this._currentRequest);this._currentRequest.abort();this.emit("abort")};Ta.prototype.destroy=function(t){tK(this._currentRequest,t);DPt.call(this,t);return this};Ta.prototype.write=function(t,e,r){if(this._ending){throw new PPt}if(!Im(t)&&!LPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(Q6(e)){r=e;e=null}if(t.length===0){if(r){r()}return}if(this._requestBodyLength+t.length<=this._options.maxBodyLength){this._requestBodyLength+=t.length;this._requestBodyBuffers.push({data:t,encoding:e});this._currentRequest.write(t,e,r)}else{this.emit("error",new IPt);this.abort()}};Ta.prototype.end=function(t,e,r){if(Q6(t)){r=t;t=e=null}else if(Q6(e)){r=e;e=null}if(!t){this._ended=this._ending=true;this._currentRequest.end(null,null,r)}else{var n=this;var i=this._currentRequest;this.write(t,e,function(){n._ended=true;i.end(null,null,r)});this._ending=true}};Ta.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Ta.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Ta.prototype.setTimeout=function(t,e){var r=this;function n(a){a.setTimeout(t);a.removeListener("timeout",a.destroy);a.addListener("timeout",a.destroy)}o(n,"destroyOnTimeout");function i(a){if(r._timeout){clearTimeout(r._timeout)}r._timeout=setTimeout(function(){r.emit("timeout");s()},t);n(a)}o(i,"startTimer");function s(){if(r._timeout){clearTimeout(r._timeout);r._timeout=null}r.removeListener("abort",s);r.removeListener("error",s);r.removeListener("response",s);r.removeListener("close",s);if(e){r.removeListener("timeout",e)}if(!r.socket){r._currentRequest.removeListener("socket",i)}}o(s,"clearTimer");if(e){this.on("timeout",e)}if(this.socket){i(this.socket)}else{this._currentRequest.once("socket",i)}this.on("socket",n);this.on("abort",s);this.on("error",s);this.on("response",s);this.on("close",s);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ta.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ta.prototype,t,{get:function(){return this._currentRequest[t]}})});Ta.prototype._sanitizeOptions=function(t){if(!t.headers){t.headers={}}if(t.host){if(!t.hostname){t.hostname=t.host}delete t.host}if(!t.pathname&&t.path){var e=t.path.indexOf("?");if(e<0){t.pathname=t.path}else{t.pathname=t.path.substring(0,e);t.search=t.path.substring(e)}}};Ta.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){throw new TypeError("Unsupported protocol "+t)}if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var i of XG){n.on(i,ZG[i])}this._currentUrl=/^\//.test(this._options.path)?X6.format(this._options):this._options.path;if(this._isRedirect){var s=0;var a=this;var u=this._requestBodyBuffers;o(function l(c){if(n===a._currentRequest){if(c){a.emit("error",c)}else if(s<u.length){var d=u[s++];if(!n.finished){n.write(d.data,d.encoding,l)}}else if(a._ended){n.end()}}},"writeNext")()}};Ta.prototype._processResponse=function(t){var e=t.statusCode;if(this._options.trackRedirects){this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e})}var r=t.headers.location;if(!r||this._options.followRedirects===false||e<300||e>=400){t.responseUrl=this._currentUrl;t.redirects=this._redirects;this.emit("response",t);this._requestBodyBuffers=[];return}tK(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){throw new NPt}var n;var i=this._options.beforeRedirect;if(i){n=Object.assign({Host:t.req.getHeader("host")},this._options.headers)}var s=this._options.method;if((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method)){this._options.method="GET";this._requestBodyBuffers=[];zG(/^content-/i,this._options.headers)}var a=zG(/^host$/i,this._options.headers);var u=eK(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:X6.format(Object.assign(u,{host:l}));var d=kPt(r,c);UTe("redirecting to",d.href);this._isRedirect=true;YG(d,this._options);if(d.protocol!==u.protocol&&d.protocol!=="https:"||d.host!==l&&!$Pt(d.host,l)){zG(/^(?:authorization|cookie)$/i,this._options.headers)}if(Q6(i)){var p={headers:t.headers,statusCode:e};var f={url:c,method:s,headers:n};i(this._options,p,f);this._sanitizeOptions(this._options)}this._performRequest()};function FTe(t){var e={maxRedirects:21,maxBodyLength:10*1024*1024};var r={};Object.keys(t).forEach(function(n){var i=n+":";var s=r[i]=t[n];var a=e[n]=Object.create(s);function u(c,d,p){if(qPt(c)){c=YG(c)}else if(Im(c)){c=YG(eK(c))}else{p=d;d=MTe(c);c={protocol:i}}if(Q6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Im(d.host)&&!Im(d.hostname)){d.hostname="::1"}JG.equal(d.protocol,i,"protocol mismatch");UTe("options",d);return new Ta(d,p)}o(u,"request");function l(c,d,p){var f=a.request(c,d,p);f.end();return f}o(l,"get");Object.defineProperties(a,{request:{value:u,configurable:true,enumerable:true,writable:true},get:{value:l,configurable:true,enumerable:true,writable:true}})});return e}o(FTe,"wrap");function BTe(){}o(BTe,"noop");function eK(t){var e;if(QG){e=new J6(t)}else{e=MTe(X6.parse(t));if(!Im(e.protocol)){throw new GG({input:t})}}return e}o(eK,"parseUrl");function kPt(t,e){return QG?new J6(t,e):eK(X6.resolve(e,t))}o(kPt,"resolveUrl");function MTe(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname)){throw new GG({input:t.href||t})}if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host)){throw new GG({input:t.href||t})}return t}o(MTe,"validateUrl");function YG(t,e){var r=e||{};for(var n of OPt){r[n]=t[n]}if(r.hostname.startsWith("[")){r.hostname=r.hostname.slice(1,-1)}if(r.port!==""){r.port=Number(r.port)}r.path=r.search?r.pathname+r.search:r.pathname;return r}o(YG,"spreadUrlObject");function zG(t,e){var r;for(var n in e){if(t.test(n)){r=e[n];delete e[n]}}return r===null||typeof r==="undefined"?void 0:String(r).trim()}o(zG,"removeMatchingHeaders");function Z6(t,e,r){function n(i){Error.captureStackTrace(this,this.constructor);Object.assign(this,i||{});this.code=t;this.message=this.cause?e+": "+this.cause.message:e}o(n,"CustomError");n.prototype=new(r||Error);Object.defineProperties(n.prototype,{constructor:{value:n,enumerable:false},name:{value:"Error ["+t+"]",enumerable:false}});return n}o(Z6,"createErrorType");function tK(t,e){for(var r of XG){t.removeListener(r,ZG[r])}t.on("error",BTe);t.destroy(e)}o(tK,"destroyRequest");function $Pt(t,e){JG(Im(t)&&Im(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o($Pt,"isSubdomain");function Im(t){return typeof t==="string"||t instanceof String}o(Im,"isString");function Q6(t){return typeof t==="function"}o(Q6,"isFunction");function LPt(t){return typeof t==="object"&&"length"in t}o(LPt,"isBuffer");function qPt(t){return J6&&t instanceof J6}o(qPt,"isURL");rK.exports=FTe({http:CPt,https:RPt});rK.exports.wrap=FTe});var dx=_((Zhr,P7e)=>{"use strict";var jPt=kTe();var UPt=require("url");var FPt=LTe();var BPt=require("http");var MPt=require("https");var o7e=require("util");var VPt=VTe();var HPt=require("zlib");var u7e=require("stream");var zPt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var l7e=td(jPt);var GPt=td(UPt);var KPt=td(BPt);var YPt=td(MPt);var WPt=td(o7e);var JPt=td(VPt);var hf=td(HPt);var pf=td(u7e);var QPt=td(zPt);function c7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(c7e,"bind");var{toString:XPt}=Object.prototype;var{getPrototypeOf:yK}=Object;var ox=(t=>e=>{const r=XPt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>ox(e)===t},"kindOfTest");var ux=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:jy}=Array;var rb=ux("undefined");function ZPt(t){return t!==null&&!rb(t)&&t.constructor!==null&&!rb(t.constructor)&&Mo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(ZPt,"isBuffer");var d7e=Vl("ArrayBuffer");function eDt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&d7e(t.buffer)}return e}o(eDt,"isArrayBufferView");var tDt=ux("string");var Mo=ux("function");var p7e=ux("number");var lx=o(t=>t!==null&&typeof t==="object","isObject");var rDt=o(t=>t===true||t===false,"isBoolean");var nx=o(t=>{if(ox(t)!=="object"){return false}const e=yK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var nDt=Vl("Date");var iDt=Vl("File");var sDt=Vl("Blob");var aDt=Vl("FileList");var oDt=o(t=>lx(t)&&Mo(t.pipe),"isStream");var uDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Mo(t.append)&&((e=ox(t))==="formdata"||e==="object"&&Mo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var lDt=Vl("URLSearchParams");var cDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ib(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(jy(t)){for(n=0,i=t.length;n<i;n++){e.call(null,t[n],n,t)}}else{const s=r?Object.getOwnPropertyNames(t):Object.keys(t);const a=s.length;let u;for(n=0;n<a;n++){u=s[n];e.call(null,t[u],u,t)}}}o(ib,"forEach");function f7e(t,e){e=e.toLowerCase();const r=Object.keys(t);let n=r.length;let i;while(n-- >0){i=r[n];if(e===i.toLowerCase()){return i}}return null}o(f7e,"findKey");var h7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var m7e=o(t=>!rb(t)&&t!==h7e,"isContextDefined");function oK(){const{caseless:t}=m7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&f7e(e,i)||i;if(nx(e[s])&&nx(n)){e[s]=oK(e[s],n)}else if(nx(n)){e[s]=oK({},n)}else if(jy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&ib(arguments[n],r)}return e}o(oK,"merge");var dDt=o((t,e,r,{allOwnKeys:n}={})=>{ib(e,(i,s)=>{if(r&&Mo(i)){t[s]=c7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var pDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var fDt=o((t,e,r,n)=>{t.prototype=Object.create(e.prototype,n);t.prototype.constructor=t;Object.defineProperty(t,"super",{value:e.prototype});r&&Object.assign(t.prototype,r)},"inherits");var hDt=o((t,e,r,n)=>{let i;let s;let a;const u={};e=e||{};if(t==null)return e;do{i=Object.getOwnPropertyNames(t);s=i.length;while(s-- >0){a=i[s];if((!n||n(a,t,e))&&!u[a]){e[a]=t[a];u[a]=true}}t=r!==false&&yK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var mDt=o((t,e,r)=>{t=String(t);if(r===void 0||r>t.length){r=t.length}r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},"endsWith");var gDt=o(t=>{if(!t)return null;if(jy(t))return t;let e=t.length;if(!p7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var yDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&yK(Uint8Array));var vDt=o((t,e)=>{const r=t&&t[Symbol.iterator];const n=r.call(t);let i;while((i=n.next())&&!i.done){const s=i.value;e.call(t,s[0],s[1])}},"forEachEntry");var _Dt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var EDt=Vl("HTMLFormElement");var bDt=o(t=>{return t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function e(r,n,i){return n.toUpperCase()+i},"replacer"))},"toCamelCase");var HTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var wDt=Vl("RegExp");var g7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};ib(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var SDt=o(t=>{g7e(t,(e,r)=>{if(Mo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Mo(n))return;e.enumerable=false;if("writable"in e){e.writable=false;return}if(!e.set){e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}}})},"freezeMethods");var TDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");jy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var ADt=o(()=>{},"noop");var xDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var nK="abcdefghijklmnopqrstuvwxyz";var zTe="0123456789";var y7e={DIGIT:zTe,ALPHA:nK,ALPHA_DIGIT:nK+nK.toUpperCase()+zTe};var CDt=o((t=16,e=y7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function RDt(t){return!!(t&&Mo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(RDt,"isSpecCompliantForm");var ODt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(lx(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=jy(n)?[]:{};ib(n,(a,u)=>{const l=r(a,i+1);!rb(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var NDt=Vl("AsyncFunction");var IDt=o(t=>t&&(lx(t)||Mo(t))&&Mo(t.then)&&Mo(t.catch),"isThenable");var fe={isArray:jy,isArrayBuffer:d7e,isBuffer:ZPt,isFormData:uDt,isArrayBufferView:eDt,isString:tDt,isNumber:p7e,isBoolean:rDt,isObject:lx,isPlainObject:nx,isUndefined:rb,isDate:nDt,isFile:iDt,isBlob:sDt,isRegExp:wDt,isFunction:Mo,isStream:oDt,isURLSearchParams:lDt,isTypedArray:yDt,isFileList:aDt,forEach:ib,merge:oK,extend:dDt,trim:cDt,stripBOM:pDt,inherits:fDt,toFlatObject:hDt,kindOf:ox,kindOfTest:Vl,endsWith:mDt,toArray:gDt,forEachEntry:vDt,matchAll:_Dt,isHTMLForm:EDt,hasOwnProperty:HTe,hasOwnProp:HTe,reduceDescriptors:g7e,freezeMethods:SDt,toObjectSet:TDt,toCamelCase:bDt,noop:ADt,toFiniteNumber:xDt,findKey:f7e,global:h7e,isContextDefined:m7e,ALPHABET:y7e,generateString:CDt,isSpecCompliantForm:RDt,toJSONObject:ODt,isAsyncFn:NDt,isThenable:IDt};function nt(t,e,r,n,i){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=new Error().stack}this.message=t;this.name="AxiosError";e&&(this.code=e);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}o(nt,"AxiosError");fe.inherits(nt,Error,{toJSON:o(function t(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}},"toJSON")});var v7e=nt.prototype;var _7e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{_7e[t]={value:t}});Object.defineProperties(nt,_7e);Object.defineProperty(v7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(v7e);fe.toFlatObject(t,a,o(function u(l){return l!==Error.prototype},"filter"),u=>{return u!=="isAxiosError"});nt.call(a,t.message,e,r,n,i);a.cause=t;a.name=t.name;s&&Object.assign(a,s);return a};function uK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(uK,"isVisitable");function E7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(E7e,"removeBrackets");function GTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=E7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(GTe,"renderKey");function PDt(t){return fe.isArray(t)&&!t.some(uK)}o(PDt,"isFlatArray");var DDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function cx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(l7e["default"]||FormData);r=fe.toFlatObject(r,{metaTokens:true,dots:false,indexes:false},false,o(function m(g,y){return!fe.isUndefined(y[g])},"defined"));const n=r.metaTokens;const i=r.visitor||d;const s=r.dots;const a=r.indexes;const u=r.Blob||typeof Blob!=="undefined"&&Blob;const l=u&&fe.isSpecCompliantForm(e);if(!fe.isFunction(i)){throw new TypeError("visitor must be a function")}function c(m){if(m===null)return"";if(fe.isDate(m)){return m.toISOString()}if(!l&&fe.isBlob(m)){throw new nt("Blob is not supported. Use a Buffer instead.")}if(fe.isArrayBuffer(m)||fe.isTypedArray(m)){return l&&typeof Blob==="function"?new Blob([m]):Buffer.from(m)}return m}o(c,"convertValue");function d(m,g,y){let v=m;if(m&&!y&&typeof m==="object"){if(fe.endsWith(g,"{}")){g=n?g:g.slice(0,-2);m=JSON.stringify(m)}else if(fe.isArray(m)&&PDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=E7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?GTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(uK(m)){return true}e.append(GTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(DDt,{defaultVisitor:d,convertValue:c,isVisitable:uK});function h(m,g){if(fe.isUndefined(m))return;if(p.indexOf(m)!==-1){throw Error("Circular reference detected in "+g.join("."))}p.push(m);fe.forEach(m,o(function y(v,w){const E=!(fe.isUndefined(v)||v===null)&&i.call(e,v,fe.isString(w)?w.trim():w,g,f);if(E===true){h(v,g?g.concat(w):[w])}},"each"));p.pop()}o(h,"build");if(!fe.isObject(t)){throw new TypeError("data must be an object")}h(t);return e}o(cx,"toFormData");function KTe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,o(function r(n){return e[n]},"replacer"))}o(KTe,"encode$1");function b7e(t,e){this._pairs=[];t&&cx(t,this,e)}o(b7e,"AxiosURLSearchParams");var w7e=b7e.prototype;w7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");w7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,KTe)}:KTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function kDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(kDt,"encode");function vK(t,e,r){if(!e){return t}const n=r&&r.encode||kDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new b7e(e,r).toString(n)}if(s){const a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+s}return t}o(vK,"buildURL");var lK=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,r,n){this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(e){fe.forEach(this.handlers,o(function r(n){if(n!==null){e(n)}},"forEachHandler"))}};var YTe=lK;var _K={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var $Dt=GPt["default"].URLSearchParams;var LDt={isNode:true,classes:{URLSearchParams:$Dt,FormData:l7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var S7e=typeof window!=="undefined"&&typeof document!=="undefined";var qDt=(t=>{return S7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var jDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var UDt=Object.freeze({__proto__:null,hasBrowserEnv:S7e,hasStandardBrowserWebWorkerEnv:jDt,hasStandardBrowserEnv:qDt});var Bo={...UDt,...LDt};function FDt(t,e){return cx(t,new Bo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Bo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(FDt,"toURLEncodedForm");function BDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(BDt,"parsePropPath");function MDt(t){const e={};const r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++){s=r[n];e[s]=t[s]}return e}o(MDt,"arrayToObject");function T7e(t){function e(r,n,i,s){let a=r[s++];const u=Number.isFinite(+a);const l=s>=r.length;a=!a&&fe.isArray(i)?i.length:a;if(l){if(fe.hasOwnProp(i,a)){i[a]=[i[a],n]}else{i[a]=n}return!u}if(!i[a]||!fe.isObject(i[a])){i[a]=[]}const c=e(r,n,i[a],s);if(c&&fe.isArray(i[a])){i[a]=MDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(BDt(n),i,r,0)});return r}return null}o(T7e,"formDataToJSON");function VDt(t,e,r){if(fe.isString(t)){try{(e||JSON.parse)(t);return fe.trim(t)}catch(n){if(n.name!=="SyntaxError"){throw n}}}return(r||JSON.stringify)(t)}o(VDt,"stringifySafely");var EK={transitional:_K,adapter:["xhr","http"],transformRequest:[o(function t(e,r){const n=r.getContentType()||"";const i=n.indexOf("application/json")>-1;const s=fe.isObject(e);if(s&&fe.isHTMLForm(e)){e=new FormData(e)}const a=fe.isFormData(e);if(a){if(!i){return e}return i?JSON.stringify(T7e(e)):e}if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)){return e}if(fe.isArrayBufferView(e)){return e.buffer}if(fe.isURLSearchParams(e)){r.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1){return FDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return cx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return VDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||EK.transitional;const n=r&&r.forcedJSONParsing;const i=this.responseType==="json";if(e&&fe.isString(e)&&(n&&!this.responseType||i)){const s=r&&r.silentJSONParsing;const a=!s&&i;try{return JSON.parse(e)}catch(u){if(a){if(u.name==="SyntaxError"){throw nt.from(u,nt.ERR_BAD_RESPONSE,this,null,this.response)}throw u}}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bo.classes.FormData,Blob:Bo.classes.Blob},validateStatus:o(function t(e){return e>=200&&e<300},"validateStatus"),headers:{common:{"Accept":"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{EK.headers[t]={}});var bK=EK;var HDt=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var zDt=o(t=>{const e={};let r;let n;let i;t&&t.split("\n").forEach(o(function s(a){i=a.indexOf(":");r=a.substring(0,i).trim().toLowerCase();n=a.substring(i+1).trim();if(!r||e[r]&&HDt[r]){return}if(r==="set-cookie"){if(e[r]){e[r].push(n)}else{e[r]=[n]}}else{e[r]=e[r]?e[r]+", "+n:n}},"parser"));return e},"parseHeaders");var WTe=Symbol("internals");function eb(t){return t&&String(t).trim().toLowerCase()}o(eb,"normalizeHeader");function ix(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(ix):String(t)}o(ix,"normalizeValue");function GDt(t){const e=Object.create(null);const r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;while(n=r.exec(t)){e[n[1]]=n[2]}return e}o(GDt,"parseTokens");var KDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function iK(t,e,r,n,i){if(fe.isFunction(n)){return n.call(this,e,r)}if(i){e=r}if(!fe.isString(e))return;if(fe.isString(n)){return e.indexOf(n)!==-1}if(fe.isRegExp(n)){return n.test(e)}}o(iK,"matchHeaderValue");function YDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(YDt,"formatHeader");function WDt(t,e){const r=fe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:true})})}o(WDt,"buildAccessors");var $y=class{static{o(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(u,l,c){const d=eb(l);if(!d){throw new Error("header name must be a non-empty string")}const p=fe.findKey(i,d);if(!p||i[p]===void 0||c===true||c===void 0&&i[p]!==false){i[p||l]=ix(u)}}o(s,"setHeader");const a=o((u,l)=>fe.forEach(u,(c,d)=>s(c,d,l)),"setHeaders");if(fe.isPlainObject(e)||e instanceof this.constructor){a(e,r)}else if(fe.isString(e)&&(e=e.trim())&&!KDt(e)){a(zDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=eb(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return GDt(i)}if(fe.isFunction(r)){return r.call(this,i,n)}if(fe.isRegExp(r)){return r.exec(i)}throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){e=eb(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||iK(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=eb(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||iK(n,n[u],u,r))){delete n[u];i=true}}}o(s,"deleteHeader");if(fe.isArray(e)){e.forEach(s)}else{s(e)}return i}clear(e){const r=Object.keys(this);let n=r.length;let i=false;while(n--){const s=r[n];if(!e||iK(this,this[s],s,e,true)){delete this[s];i=true}}return i}normalize(e){const r=this;const n={};fe.forEach(this,(i,s)=>{const a=fe.findKey(n,s);if(a){r[a]=ix(i);delete r[s];return}const u=e?YDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=ix(i);n[u]=true});return this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);fe.forEach(this,(n,i)=>{n!=null&&n!==false&&(r[i]=e&&fe.isArray(n)?n.join(", "):n)});return r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);r.forEach(i=>n.set(i));return n}static accessor(e){const r=this[WTe]=this[WTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=eb(a);if(!n[u]){WDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};$y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors($y.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods($y);var Vo=$y;function sK(t,e){const r=this||bK;const n=e||r;const i=Vo.from(n.headers);let s=n.data;fe.forEach(t,o(function a(u){s=u.call(r,s,i.normalize(),e?e.status:void 0)},"transform"));i.normalize();return s}o(sK,"transformData");function A7e(t){return!!(t&&t.__CANCEL__)}o(A7e,"isCancel");function Pm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Pm,"CanceledError");fe.inherits(Pm,nt,{__CANCEL__:true});function tb(t,e,r){const n=r.config.validateStatus;if(!r.status||!n||n(r.status)){t(r)}else{e(new nt("Request failed with status code "+r.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}}o(tb,"settle");function JDt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(JDt,"isAbsoluteURL");function QDt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(QDt,"combineURLs");function wK(t,e){if(t&&!JDt(e)){return QDt(t,e)}return e}o(wK,"buildFullPath");var ax="1.6.2";function x7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(x7e,"parseProtocol");var XDt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ZDt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=x7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=XDt.exec(t);if(!s){throw new nt("Invalid URL",nt.ERR_INVALID_URL)}const a=s[1];const u=s[2];const l=s[3];const c=Buffer.from(decodeURIComponent(l),u?"base64":"utf8");if(e){if(!n){throw new nt("Blob is not supported",nt.ERR_NOT_SUPPORT)}return new n([c],{type:a})}return c}throw new nt("Unsupported protocol "+i,nt.ERR_NOT_SUPPORT)}o(ZDt,"fromDataURI");function ekt(t,e){let r=0;const n=1e3/e;let i=null;return o(function s(a,u){const l=Date.now();if(a||l-r>n){if(i){clearTimeout(i);i=null}r=l;return t.apply(null,u)}if(!i){i=setTimeout(()=>{i=null;r=Date.now();return t.apply(null,u)},n-(l-r))}},"throttled")}o(ekt,"throttle");function C7e(t,e){t=t||10;const r=new Array(t);const n=new Array(t);let i=0;let s=0;let a;e=e!==void 0?e:1e3;return o(function u(l){const c=Date.now();const d=n[s];if(!a){a=c}r[i]=l;n[i]=c;let p=s;let f=0;while(p!==i){f+=r[p++];p=p%t}i=(i+1)%t;if(i===s){s=(s+1)%t}if(c-a<e){return}const h=d&&c-d;return h?Math.round(f*1e3/h):void 0},"push")}o(C7e,"speedometer");var rx=Symbol("internals");var cK=class extends pf["default"].Transform{static{o(this,"AxiosTransformStream")}constructor(e){e=fe.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(u,l)=>{return!fe.isUndefined(l[u])});super({readableHighWaterMark:e.chunkSize});const r=this;const n=this[rx]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:false,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};const i=C7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=ekt(o(function u(){const l=n.length;const c=n.bytesSeen;const d=c-s;if(!d||r.destroyed)return;const p=i(d);s=c;process.nextTick(()=>{r.emit("progress",{"loaded":c,"total":l,"progress":l?c/l:void 0,"bytes":d,"rate":p?p:void 0,"estimated":p&&l&&c<=l?(l-c)/p:void 0})})},"throttledHandler"),n.ticksRate);const a=o(()=>{n.updateProgress(true)},"onFinish");this.once("end",a);this.once("error",a)}_read(e){const r=this[rx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[rx];const a=s.maxRate;const u=this.readableHighWaterMark;const l=s.timeWindow;const c=1e3/l;const d=a/c;const p=s.minChunkSize!==false?Math.max(s.minChunkSize,d*.01):0;function f(m,g){const y=Buffer.byteLength(m);s.bytesSeen+=y;s.bytes+=y;if(s.isCaptured){s.updateProgress()}if(i.push(m)){process.nextTick(g)}else{s.onReadCallback=()=>{s.onReadCallback=null;process.nextTick(g)}}}o(f,"pushChunk");const h=o((m,g)=>{const y=Buffer.byteLength(m);let v=null;let w=u;let E;let b=0;if(a){const S=Date.now();if(!s.ts||(b=S-s.ts)>=l){s.ts=S;E=d-s.bytes;s.bytes=E<0?-E:0;b=0}E=d-s.bytes}if(a){if(E<=0){return setTimeout(()=>{g(null,m)},l-b)}if(E<w){w=E}}if(w&&y>w&&y-w>p){v=m.subarray(w);m=m.subarray(0,w)}f(m,v?()=>{process.nextTick(g,null,v)}:g)},"transformChunk");h(e,o(function m(g,y){if(g){return n(g)}if(y){h(y,m)}else{n(null)}},"transformNextChunk"))}setLength(e){this[rx].length=+e;return this}};var JTe=cK;var{asyncIterator:QTe}=Symbol;var tkt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[QTe]){yield*t[QTe]()}else{yield t}},"readBlob");var R7e=tkt;var rkt=fe.ALPHABET.ALPHA_DIGIT+"-_";var nb=new o7e.TextEncoder;var ff="\r\n";var nkt=nb.encode(ff);var ikt=2;var dK=class{static{o(this,"FormDataPart")}constructor(e,r){const{escapeName:n}=this.constructor;const i=fe.isString(r);let s=`Content-Disposition: form-data; name="${n(e)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${ff}`;if(i){r=nb.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=nb.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+ikt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*R7e(e)}yield nkt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var skt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,rkt)}=r||{};if(!fe.isFormData(t)){throw TypeError("FormData instance required")}if(s.length<1||s.length>70){throw Error("boundary must be 10-70 characters long")}const a=nb.encode("--"+s+ff);const u=nb.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new dK(p,f);l+=h.size;return h});l+=a.byteLength*c.length;l=fe.toFiniteNumber(l);const d={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(l)){d["Content-Length"]=l}e&&e(d);return u7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var akt=skt;var pK=class extends pf["default"].Transform{static{o(this,"ZlibHeaderTransformStream")}__transform(e,r,n){this.push(e);n()}_transform(e,r,n){if(e.length!==0){this._transform=this.__transform;if(e[0]!==120){const i=Buffer.alloc(2);i[0]=120;i[1]=156;this.push(i,r)}}this.__transform(e,r,n)}};var okt=pK;var ukt=o((t,e)=>{return fe.isAsyncFn(t)?function(...r){const n=r.pop();t.apply(this,r).then(i=>{try{e?n(null,...e(i)):n(null,i)}catch(s){n(s)}},n)}:t},"callbackify");var lkt=ukt;var XTe={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var ckt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var ZTe=fe.isFunction(hf["default"].createBrotliDecompress);var{http:dkt,https:pkt}=JPt["default"];var fkt=/https:?/;var e7e=Bo.protocols.map(t=>{return t+":"});function hkt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(hkt,"dispatchBeforeRedirect");function O7e(t,e,r){let n=e;if(!n&&n!==false){const i=FPt.getProxyForUrl(r);if(i){n=new URL(i)}}if(n){if(n.username){n.auth=(n.username||"")+":"+(n.password||"")}if(n.auth){if(n.auth.username||n.auth.password){n.auth=(n.auth.username||"")+":"+(n.auth.password||"")}const s=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+s}t.headers.host=t.hostname+(t.port?":"+t.port:"");const i=n.hostname||n.host;t.hostname=i;t.host=i;t.port=n.port;t.path=r;if(n.protocol){t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`}}t.beforeRedirects.proxy=o(function i(s){O7e(s,e,s.href)},"beforeRedirect")}o(O7e,"setProxy");var mkt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var gkt=o(t=>{return new Promise((e,r)=>{let n;let i;const s=o((l,c)=>{if(i)return;i=true;n&&n(l,c)},"done");const a=o(l=>{s(l);e(l)},"_resolve");const u=o(l=>{s(l,true);r(l)},"_reject");t(a,u,l=>n=l).catch(u)})},"wrapAsync");var ykt=o(({address:t,family:e})=>{if(!fe.isString(t)){throw TypeError("address must be a string")}return{address:t,family:e||(t.indexOf(".")<0?6:4)}},"resolveFamily");var t7e=o((t,e)=>ykt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var vkt=mkt&&o(function t(e){return gkt(o(async function r(n,i,s){let{data:a,lookup:u,family:l}=e;const{responseType:c,responseEncoding:d}=e;const p=e.method.toUpperCase();let f;let h=false;let m;if(u){const ue=lkt(u,Ae=>fe.isArray(Ae)?Ae:[Ae]);u=o((Ae,we,Pe)=>{ue(Ae,we,(Ue,$e,ge)=>{const Je=fe.isArray($e)?$e.map(Le=>t7e(Le)):[t7e($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new QPt["default"];const y=o(()=>{if(e.cancelToken){e.cancelToken.unsubscribe(v)}if(e.signal){e.signal.removeEventListener("abort",v)}g.removeAllListeners()},"onFinished");s((ue,Ae)=>{f=true;if(Ae){h=true;y()}});function v(ue){g.emit("abort",!ue||ue.type?new Pm(null,e,m):ue)}o(v,"abort");g.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(v);if(e.signal){e.signal.aborted?v():e.signal.addEventListener("abort",v)}}const w=wK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||e7e[0];if(b==="data:"){let ue;if(p!=="GET"){return tb(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=ZDt(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(Ae){throw nt.from(Ae,nt.ERR_BAD_REQUEST,e)}if(c==="text"){ue=ue.toString(d);if(!d||d==="utf8"){ue=fe.stripBOM(ue)}}else if(c==="stream"){ue=pf["default"].Readable.from(ue)}return tb(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(e7e.indexOf(b)===-1){return i(new nt("Unsupported protocol "+b,nt.ERR_BAD_REQUEST,e))}const S=Vo.from(e.headers).normalize();S.set("User-Agent","axios/"+ax,false);const T=e.onDownloadProgress;const A=e.onUploadProgress;const P=e.maxRate;let D=void 0;let F=void 0;if(fe.isSpecCompliantForm(a)){const ue=S.getContentType(/boundary=([-_\w\d]{10,70})/i);a=akt(a,Ae=>{S.set(Ae)},{tag:`axios-${ax}-boundary`,boundary:ue&&ue[1]||void 0})}else if(fe.isFormData(a)&&fe.isFunction(a.getHeaders)){S.set(a.getHeaders());if(!S.hasContentLength()){try{const ue=await WPt["default"].promisify(a.getLength).call(a);Number.isFinite(ue)&&ue>=0&&S.setContentLength(ue)}catch(ue){}}}else if(fe.isBlob(a)){a.size&&S.setContentType(a.type||"application/octet-stream");S.setContentLength(a.size||0);a=pf["default"].Readable.from(R7e(a))}else if(a&&!fe.isStream(a)){if(Buffer.isBuffer(a));else if(fe.isArrayBuffer(a)){a=Buffer.from(new Uint8Array(a))}else if(fe.isString(a)){a=Buffer.from(a,"utf-8")}else{return i(new nt("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",nt.ERR_BAD_REQUEST,e))}S.setContentLength(a.length,false);if(e.maxBodyLength>-1&&a.length>e.maxBodyLength){return i(new nt("Request body larger than maxBodyLength limit",nt.ERR_BAD_REQUEST,e))}}const V=fe.toFiniteNumber(S.getContentLength());if(fe.isArray(P)){D=P[0];F=P[1]}else{D=F=P}if(a&&(A||D)){if(!fe.isStream(a)){a=pf["default"].Readable.from(a,{objectMode:false})}a=pf["default"].pipeline([a,new JTe({length:V,maxRate:fe.toFiniteNumber(D)})],fe.noop);A&&a.on("progress",ue=>{A(Object.assign(ue,{upload:true}))})}let j=void 0;if(e.auth){const ue=e.auth.username||"";const Ae=e.auth.password||"";j=ue+":"+Ae}if(!j&&E.username){const ue=E.username;const Ae=E.password;j=ue+":"+Ae}j&&S.delete("authorization");let Q;try{Q=vK(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ue){const Ae=new Error(ue.message);Ae.config=e;Ae.url=e.url;Ae.exists=true;return i(Ae)}S.set("Accept-Encoding","gzip, compress, deflate"+(ZTe?", br":""),false);const ae={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:b,family:l,beforeRedirect:hkt,beforeRedirects:{}};!fe.isUndefined(u)&&(ae.lookup=u);if(e.socketPath){ae.socketPath=e.socketPath}else{ae.hostname=E.hostname;ae.port=E.port;O7e(ae,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+ae.path)}let Te;const le=fkt.test(ae.protocol);ae.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?YPt["default"]:KPt["default"]}else{if(e.maxRedirects){ae.maxRedirects=e.maxRedirects}if(e.beforeRedirect){ae.beforeRedirects.config=e.beforeRedirect}Te=le?pkt:dkt}if(e.maxBodyLength>-1){ae.maxBodyLength=e.maxBodyLength}else{ae.maxBodyLength=Infinity}if(e.insecureHTTPParser){ae.insecureHTTPParser=e.insecureHTTPParser}m=Te.request(ae,o(function ue(Ae){if(m.destroyed)return;const we=[Ae];const Pe=+Ae.headers["content-length"];if(T){const Le=new JTe({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(F)});T&&Le.on("progress",Ie=>{T(Object.assign(Ie,{download:true}))});we.push(Le)}let Ue=Ae;const $e=Ae.req||m;if(e.decompress!==false&&Ae.headers["content-encoding"]){if(p==="HEAD"||Ae.statusCode===204){delete Ae.headers["content-encoding"]}switch((Ae.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":we.push(hf["default"].createUnzip(XTe));delete Ae.headers["content-encoding"];break;case"deflate":we.push(new okt);we.push(hf["default"].createUnzip(XTe));delete Ae.headers["content-encoding"];break;case"br":if(ZTe){we.push(hf["default"].createBrotliDecompress(ckt));delete Ae.headers["content-encoding"]}}}Ue=we.length>1?pf["default"].pipeline(we,fe.noop):we[0];const ge=pf["default"].finished(Ue,()=>{ge();y()});const Je={status:Ae.statusCode,statusText:Ae.statusMessage,headers:new Vo(Ae.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;tb(n,i,Je)}else{const Le=[];let Ie=0;Ue.on("data",o(function Qe(qe){Le.push(qe);Ie+=qe.length;if(e.maxContentLength>-1&&Ie>e.maxContentLength){h=true;Ue.destroy();i(new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e))}},"handleStreamData"));Ue.on("aborted",o(function Qe(){if(h){return}const qe=new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e);Ue.destroy(qe);i(qe)},"handlerStreamAborted"));Ue.on("error",o(function Qe(qe){if(m.destroyed)return;i(nt.from(qe,null,e,$e))},"handleStreamError"));Ue.on("end",o(function Qe(){try{let qe=Le.length===1?Le[0]:Buffer.concat(Le);if(c!=="arraybuffer"){qe=qe.toString(d);if(!d||d==="utf8"){qe=fe.stripBOM(qe)}}Je.data=qe}catch(qe){return i(nt.from(qe,null,e,Je.request,Je))}tb(n,i,Je)},"handleStreamEnd"))}g.once("abort",Le=>{if(!Ue.destroyed){Ue.emit("error",Le);Ue.destroy()}})},"handleResponse"));g.once("abort",ue=>{i(ue);m.destroy(ue)});m.on("error",o(function ue(Ae){i(nt.from(Ae,null,e,m))},"handleRequestError"));m.on("socket",o(function ue(Ae){Ae.setKeepAlive(true,1e3*60)},"handleRequestSocket"));if(e.timeout){const ue=parseInt(e.timeout,10);if(Number.isNaN(ue)){i(new nt("error trying to parse `config.timeout` to int",nt.ERR_BAD_OPTION_VALUE,e,m));return}m.setTimeout(ue,o(function Ae(){if(f)return;let we=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const Pe=e.transitional||_K;if(e.timeoutErrorMessage){we=e.timeoutErrorMessage}i(new nt(we,Pe.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,m));v()},"handleRequestTimeout"))}if(fe.isStream(a)){let ue=false;let Ae=false;a.on("end",()=>{ue=true});a.once("error",we=>{Ae=true;m.destroy(we)});a.on("close",()=>{if(!ue&&!Ae){v(new Pm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var _kt=Bo.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];fe.isNumber(r)&&a.push("expires="+new Date(r).toGMTString());fe.isString(n)&&a.push("path="+n);fe.isString(i)&&a.push("domain="+i);s===true&&a.push("secure");document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Ekt=Bo.hasStandardBrowserEnv?o(function t(){const e=/(msie|trident)/i.test(navigator.userAgent);const r=document.createElement("a");let n;function i(s){let a=s;if(e){r.setAttribute("href",a);a=r.href}r.setAttribute("href",a);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}o(i,"resolveURL");n=i(window.location.href);return o(function s(a){const u=fe.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():o(function t(){return o(function e(){return true},"isURLSameOrigin")},"nonStandardBrowserEnv")();function r7e(t,e){let r=0;const n=C7e(50,250);return i=>{const s=i.loaded;const a=i.lengthComputable?i.total:void 0;const u=s-r;const l=n(u);const c=s<=a;r=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:u,rate:l?l:void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:i};d[e?"download":"upload"]=true;t(d)}}o(r7e,"progressEventReducer");var bkt=typeof XMLHttpRequest!=="undefined";var wkt=bkt&&function(t){return new Promise(o(function e(r,n){let i=t.data;const s=Vo.from(t.headers).normalize();let{responseType:a,withXSRFToken:u}=t;let l;function c(){if(t.cancelToken){t.cancelToken.unsubscribe(l)}if(t.signal){t.signal.removeEventListener("abort",l)}}o(c,"done");let d;if(fe.isFormData(i)){if(Bo.hasStandardBrowserEnv||Bo.hasStandardBrowserWebWorkerEnv){s.setContentType(false)}else if((d=s.getContentType())!==false){const[g,...y]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"";const y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=wK(t.baseURL,t.url);p.open(t.method.toUpperCase(),vK(f,t.params,t.paramsSerializer),true);p.timeout=t.timeout;function h(){if(!p){return}const g=Vo.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());const y=!a||a==="text"||a==="json"?p.responseText:p.response;const v={data:y,status:p.status,statusText:p.statusText,headers:g,config:t,request:p};tb(o(function w(E){r(E);c()},"_resolve"),o(function w(E){n(E);c()},"_reject"),v);p=null}o(h,"onloadend");if("onloadend"in p){p.onloadend=h}else{p.onreadystatechange=o(function g(){if(!p||p.readyState!==4){return}if(p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)){return}setTimeout(h)},"handleLoad")}p.onabort=o(function g(){if(!p){return}n(new nt("Request aborted",nt.ECONNABORTED,t,p));p=null},"handleAbort");p.onerror=o(function g(){n(new nt("Network Error",nt.ERR_NETWORK,t,p));p=null},"handleError");p.ontimeout=o(function g(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const v=t.transitional||_K;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Bo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&Ekt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&_kt.read(t.xsrfCookieName);if(g){s.set(t.xsrfHeaderName,g)}}}i===void 0&&s.setContentType(null);if("setRequestHeader"in p){fe.forEach(s.toJSON(),o(function g(y,v){p.setRequestHeader(v,y)},"setRequestHeader"))}if(!fe.isUndefined(t.withCredentials)){p.withCredentials=!!t.withCredentials}if(a&&a!=="json"){p.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){p.addEventListener("progress",r7e(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",r7e(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Pm(null,t,p):g);p.abort();p=null},"onCanceled");t.cancelToken&&t.cancelToken.subscribe(l);if(t.signal){t.signal.aborted?l():t.signal.addEventListener("abort",l)}}const m=x7e(f);if(m&&Bo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var fK={http:vkt,xhr:wkt};fe.forEach(fK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var n7e=o(t=>`- ${t}`,"renderReason");var Skt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var N7e={getAdapter:t=>{t=fe.isArray(t)?t:[t];const{length:e}=t;let r;let n;const i={};for(let s=0;s<e;s++){r=t[s];let a;n=r;if(!Skt(r)){n=fK[(a=String(r)).toLowerCase()];if(n===void 0){throw new nt(`Unknown adapter '${a}'`)}}if(n){break}i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(([u,l])=>`adapter ${u} `+(l===false?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?"since :\n"+s.map(n7e).join("\n"):" "+n7e(s[0]):"as no adapter specified";throw new nt(`There is no suitable adapter to dispatch the request `+a,"ERR_NOT_SUPPORT")}return n},adapters:fK};function aK(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Pm(null,t)}}o(aK,"throwIfCancellationRequested");function i7e(t){aK(t);t.headers=Vo.from(t.headers);t.data=sK.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=N7e.getAdapter(t.adapter||bK.adapter);return e(t).then(o(function r(n){aK(t);n.data=sK.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!A7e(n)){aK(t);if(n&&n.response){n.response.data=sK.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(i7e,"dispatchRequest");var s7e=o(t=>t instanceof Vo?t.toJSON():t,"headersToObject");function Ly(t,e){e=e||{};const r={};function n(c,d,p){if(fe.isPlainObject(c)&&fe.isPlainObject(d)){return fe.merge.call({caseless:p},c,d)}else if(fe.isPlainObject(d)){return fe.merge({},d)}else if(fe.isArray(d)){return d.slice()}return d}o(n,"getMergedValue");function i(c,d,p){if(!fe.isUndefined(d)){return n(c,d,p)}else if(!fe.isUndefined(c)){return n(void 0,c,p)}}o(i,"mergeDeepProperties");function s(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}}o(s,"valueFromConfig2");function a(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}else if(!fe.isUndefined(c)){return n(void 0,c)}}o(a,"defaultToConfig2");function u(c,d,p){if(p in e){return n(c,d)}else if(p in t){return n(void 0,c)}}o(u,"mergeDirectKeys");const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u,headers:(c,d)=>i(s7e(c),s7e(d),true)};fe.forEach(Object.keys(Object.assign({},t,e)),o(function c(d){const p=l[d]||i;const f=p(t[d],e[d],d);fe.isUndefined(f)&&p!==u||(r[d]=f)},"computeConfigValue"));return r}o(Ly,"mergeConfig");var SK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{SK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var a7e={};SK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+ax+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}o(i,"formatMessage");return(s,a,u)=>{if(e===false){throw new nt(i(a," has been removed"+(r?" in "+r:"")),nt.ERR_DEPRECATED)}if(r&&!a7e[a]){a7e[a]=true;console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))}return e?e(s,a,u):true}},"transitional");function Tkt(t,e,r){if(typeof t!=="object"){throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE)}const n=Object.keys(t);let i=n.length;while(i-- >0){const s=n[i];const a=e[s];if(a){const u=t[s];const l=u===void 0||a(u,s,t);if(l!==true){throw new nt("option "+s+" must be "+l,nt.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new nt("Unknown option "+s,nt.ERR_BAD_OPTION)}}}o(Tkt,"assertOptions");var hK={assertOptions:Tkt,validators:SK};var df=hK.validators;var qy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new YTe,response:new YTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=Ly(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){hK.assertOptions(n,{silentJSONParsing:df.transitional(df.boolean),forcedJSONParsing:df.transitional(df.boolean),clarifyTimeoutError:df.transitional(df.boolean)},false)}if(i!=null){if(fe.isFunction(i)){r.paramsSerializer={serialize:i}}else{hK.assertOptions(i,{encode:df.function,serialize:df.function},true)}}r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]});r.headers=Vo.concat(a,s);const u=[];let l=true;this.interceptors.request.forEach(o(function m(g){if(typeof g.runWhen==="function"&&g.runWhen(r)===false){return}l=l&&g.synchronous;u.unshift(g.fulfilled,g.rejected)},"unshiftRequestInterceptors"));const c=[];this.interceptors.response.forEach(o(function m(g){c.push(g.fulfilled,g.rejected)},"pushResponseInterceptors"));let d;let p=0;let f;if(!l){const m=[i7e.bind(this),void 0];m.unshift.apply(m,u);m.push.apply(m,c);f=m.length;d=Promise.resolve(r);while(p<f){d=d.then(m[p++],m[p++])}return d}f=u.length;let h=r;p=0;while(p<f){const m=u[p++];const g=u[p++];try{h=m(h)}catch(y){g.call(this,y);break}}try{d=i7e.call(this,h)}catch(m){return Promise.reject(m)}p=0;f=c.length;while(p<f){d=d.then(c[p++],c[p++])}return d}getUri(e){e=Ly(this.defaults,e);const r=wK(e.baseURL,e.url);return vK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){qy.prototype[e]=function(r,n){return this.request(Ly(n||{},{method:e,url:r,data:(n||{}).data}))}},"forEachMethodNoData"));fe.forEach(["post","put","patch"],o(function t(e){function r(n){return o(function i(s,a,u){return this.request(Ly(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");qy.prototype[e]=r();qy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var sx=qy;var mK=class t{static{o(this,"CancelToken")}constructor(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}let r;this.promise=new Promise(o(function i(s){r=s},"promiseExecutor"));const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;while(s-- >0){n._listeners[s](i)}n._listeners=null});this.promise.then=i=>{let s;const a=new Promise(u=>{n.subscribe(u);s=u}).then(i);a.cancel=o(function u(){n.unsubscribe(s)},"reject");return a};e(o(function i(s,a,u){if(n.reason){return}n.reason=new Pm(s,a,u);r(n.reason)},"cancel"))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const r=this._listeners.indexOf(e);if(r!==-1){this._listeners.splice(r,1)}}static source(){let e;const r=new t(o(function n(i){e=i},"executor"));return{token:r,cancel:e}}};var Akt=mK;function xkt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(xkt,"spread");function Ckt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Ckt,"isAxiosError");var gK={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gK).forEach(([t,e])=>{gK[e]=t});var Rkt=gK;function I7e(t){const e=new sx(t);const r=c7e(sx.prototype.request,e);fe.extend(r,sx.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return I7e(Ly(t,i))},"create");return r}o(I7e,"createInstance");var fi=I7e(bK);fi.Axios=sx;fi.CanceledError=Pm;fi.CancelToken=Akt;fi.isCancel=A7e;fi.VERSION=ax;fi.toFormData=cx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=xkt;fi.isAxiosError=Ckt;fi.mergeConfig=Ly;fi.AxiosHeaders=Vo;fi.formToJSON=t=>T7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=N7e.getAdapter;fi.HttpStatusCode=Rkt;fi.default=fi;P7e.exports=fi});var fx=_(px=>{"use strict";Object.defineProperty(px,"__esModule",{value:true});px.CredentialsMethod=void 0;var D7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(D7e||(px.CredentialsMethod=D7e={}))});var km=_(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:true});hi.FgaRequiredParamError=hi.FgaValidationError=hi.FgaApiAuthenticationError=hi.FgaApiInternalError=hi.FgaApiRateLimitExceededError=hi.FgaApiNotFoundError=hi.FgaApiValidationError=hi.FgaApiError=hi.FgaError=void 0;var Uy=class extends Error{static{o(this,"FgaError")}constructor(e,r){super(r||typeof e==="string"?e:`FGA Error${(e===null||e===void 0?void 0:e.message)?`: ${e.message}`:""}`);this.name="FgaError";if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaError=Uy;function mx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(mx,"getRequestMetadataFromPath");var k7e="fga-request-id";function NK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(NK,"getResponseHeaders");var Dm=class extends Uy{static{o(this,"FgaApiError")}constructor(e,r){var n,i,s,a,u,l,c,d,p,f;super(r?r:e);this.name="FgaApiError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestData=(s=e.config)===null||s===void 0?void 0:s.data;this.requestURL=(a=e.config)===null||a===void 0?void 0:a.url;this.method=(u=e.config)===null||u===void 0?void 0:u.method;const{storeId:h,endpointCategory:m}=mx((l=e.request)===null||l===void 0?void 0:l.path);this.storeId=h;this.endpointCategory=m;this.apiErrorMessage=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message;this.responseData=(p=e.response)===null||p===void 0?void 0:p.data;this.responseHeader=(f=e.response)===null||f===void 0?void 0:f.headers;const g=NK(e);this.requestId=g[k7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=Dm;var TK=class extends Dm{static{o(this,"FgaApiValidationError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiValidationError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:p}=mx((s=e.request)===null||s===void 0?void 0:s.path);this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Validation Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiValidationError=TK;var AK=class extends Dm{static{o(this,"FgaApiNotFoundError")}constructor(e,r){var n,i,s,a,u,l,c;super(e);this.name="FgaApiNotFoundError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;this.message=r?r:((a=(s=e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)?`FGA API NotFound Error: ${(u=e.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=e.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:e.message}};hi.FgaApiNotFoundError=AK;var xK=class extends Dm{static{o(this,"FgaApiRateLimitExceededError")}constructor(e,r){var n,i,s;super(e);this.name="FgaApiRateLimitExceededError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:a}=mx((s=e.request)===null||s===void 0?void 0:s.path);const u=NK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=xK;var CK=class extends Dm{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=mx((n=e.request)===null||n===void 0?void 0:n.path);this.apiErrorCode=(s=(i=e.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.code;this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Internal Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiInternalError=CK;var RK=class extends Uy{static{o(this,"FgaApiAuthenticationError")}constructor(e){var r,n,i,s,a,u,l,c,d,p;super(`FGA Authentication Error.${((r=e.response)===null||r===void 0?void 0:r.statusText)?` ${e.response.statusText}`:""}`);this.name="FgaApiAuthenticationError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestURL=(s=e.config)===null||s===void 0?void 0:s.url;this.method=(a=e.config)===null||a===void 0?void 0:a.method;this.responseData=(u=e.response)===null||u===void 0?void 0:u.data;this.responseHeader=(l=e.response)===null||l===void 0?void 0:l.headers;this.apiErrorCode=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.code;const f=NK(e);this.requestId=f[k7e];let h;try{h=JSON.parse(((p=e.config)===null||p===void 0?void 0:p.data)||"{}")}catch(m){}this.clientId=h===null||h===void 0?void 0:h.client_id;this.audience=h===null||h===void 0?void 0:h.audience;this.grantType=h===null||h===void 0?void 0:h.grant_type;if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiAuthenticationError=RK;var hx=class extends Uy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=hx;var OK=class extends hx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=OK});var sb=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var Okt=km();var Nkt=o(function(t,e,r){if(r===null||r===void 0){throw new Okt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=Nkt;var Ikt=o(t=>{try{const e=new URL(t);return(e.toString()===t||e.toString()===`${t}/`)&&(e.protocol==="https:"||e.protocol==="http:")}catch(e){return false}},"isWellFormedUriString");mf.isWellFormedUriString=Ikt;var Pkt=o(t=>{var e;const r=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;return!!(typeof t==="string"&&((e=t.match(r))===null||e===void 0?void 0:e.length))},"isWellFormedUlidString");mf.isWellFormedUlidString=Pkt});var PK=_(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:true});Fy.Configuration=Fy.GetDefaultRetryParams=void 0;var ab=fx();var IK=km();var gx=sb();var Dkt=15;var kkt=100;var $kt="openfga-sdk js/0.3.0";function Lkt(t=Dkt,e=kkt){return{maxRetry:t,minWaitInMs:e}}o(Lkt,"GetDefaultRetryParams");Fy.GetDefaultRetryParams=Lkt;var yx=class{static{o(this,"Configuration")}constructor(e={}){this.apiScheme="https";this.getBasePath=()=>`${this.apiScheme}://${this.apiHost}`;this.apiScheme=e.apiScheme||this.apiScheme;this.apiHost=e.apiHost;this.storeId=e.storeId;const r=e.credentials;if(r){switch(r===null||r===void 0?void 0:r.method){case ab.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case ab.CredentialsMethod.ClientCredentials:this.credentials={method:ab.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case ab.CredentialsMethod.None:default:this.credentials={method:ab.CredentialsMethod.None};break}}const n=e.baseOptions||{};n.headers=n.headers||{};if(typeof process==="object"&&process.title==="node"&&!n.headers["User-Agent"]){n.headers["User-Agent"]=$kt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,gx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,gx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,gx.isWellFormedUriString)(this.getBasePath())){throw new IK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,gx.isWellFormedUlidString)(this.storeId)){throw new IK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new IK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};Fy.Configuration=yx;yx.sdkVersion="0.3.0"});var $7e=_(vx=>{"use strict";Object.defineProperty(vx,"__esModule",{value:true});vx.assertNever=void 0;function qkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(qkt,"assertNever");vx.assertNever=qkt});var L7e=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:true});_x.chunkArray=void 0;function jkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(jkt,"chunkArray");_x.chunkArray=jkt});var j7e=_(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:true});By.generateRandomIdWithNonUniqueFallback=By.generateRandomId=void 0;var Ex=require("crypto");function q7e(){if(typeof Ex.randomUUID==="function"){return(0,Ex.randomUUID)()}if(typeof Ex.randomBytes==="function"){return(0,Ex.randomBytes)(20).toString("hex")}return}o(q7e,"generateRandomId");By.generateRandomId=q7e;function Ukt(){return q7e()||"00000000-0000-0000-0000-000000000000"}o(Ukt,"generateRandomIdWithNonUniqueFallback");By.generateRandomIdWithNonUniqueFallback=Ukt});var U7e=_(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:true});bx.setHeaderIfNotSet=void 0;function Fkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Fkt,"setHeaderIfNotSet");bx.setHeaderIfNotSet=Fkt});var F7e=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.setNotEnumerableProperty=void 0;function Bkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(Bkt,"setNotEnumerableProperty");wx.setNotEnumerableProperty=Bkt});var DK=_(Pu=>{"use strict";var Mkt=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var ob=Pu&&Pu.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Mkt(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:true});ob($7e(),Pu);ob(L7e(),Pu);ob(j7e(),Pu);ob(U7e(),Pu);ob(F7e(),Pu)});var $K=_(yi=>{"use strict";var kK=yi&&yi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(yi,"__esModule",{value:true});yi.createRequestFunction=yi.attemptHttpRequest=yi.toPathString=yi.serializeDataIfNeeded=yi.setSearchParams=yi.setBearerAuthToObject=yi.DUMMY_BASE_URL=void 0;var Vkt=Sx();var $m=km();var Hkt=DK();yi.DUMMY_BASE_URL="https://example.com";var zkt=o(function(t,e){return kK(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=zkt;var Gkt=o(function(t,...e){const r=new URLSearchParams(t.search);for(const n of e){for(const i in n){if(Array.isArray(n[i])){r.delete(i);for(const s of n[i]){r.append(i,s)}}else{r.set(i,n[i])}}}t.search=r.toString()},"setSearchParams");yi.setSearchParams=Gkt;var Kkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Ykt=o(function(t,e){const r=typeof t!=="string";const n=r?Kkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Ykt;var Wkt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Wkt;function Jkt(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(Jkt,"isAxiosError");function Qkt(t,e){const r=Math.ceil(Math.pow(2,t)*e);const n=Math.ceil(Math.pow(2,t+1)*e);return Math.floor(Math.random()*(n-r)+r)}o(Qkt,"randomTime");function B7e(t,e,r){var n;return kK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!Jkt(s)){throw new $m.FgaError(s)}const a=(n=s===null||s===void 0?void 0:s.response)===null||n===void 0?void 0:n.status;if(a===400||a===422){throw new $m.FgaApiValidationError(s)}else if(a===401||a===403){throw new $m.FgaApiAuthenticationError(s)}else if(a===404){throw new $m.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new $m.FgaApiRateLimitExceededError(s)}else{throw new $m.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,Qkt(i,e.minWaitInMs)))}else{throw new $m.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(B7e,"attemptHttpRequest");yi.attemptHttpRequest=B7e;var Xkt=o(function(t,e,r,n){var i,s;r.isValid();const a=((i=t.options)===null||i===void 0?void 0:i.retryParams)?(s=t.options)===null||s===void 0?void 0:s.retryParams:r.retryParams;const u=a?a.maxRetry:0;const l=a?a.minWaitInMs:0;if(!n){n=Vkt.Credentials.init(r)}return(c=e)=>kK(this,void 0,void 0,function*(){yield(0,yi.setBearerAuthToObject)(t.options.headers,n);const d=Object.assign(Object.assign({},t.options),{url:r.getBasePath()+t.url});const p=yield B7e(d,{maxRetry:u,minWaitInMs:l},c);const f=typeof(p===null||p===void 0?void 0:p.data)==="undefined"?{}:p===null||p===void 0?void 0:p.data;const h=Object.assign({},f);(0,Hkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=Xkt});var V7e=_(My=>{"use strict";var LK=My&&My.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(My,"__esModule",{value:true});My.Credentials=void 0;var M7e=dx();var gf=sb();var qK=km();var Zkt=$K();var Ho=fx();var jK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=M7e.default){this.authConfig=e;this.axios=r;this.initConfig();this.isValid()}initConfig(){var e;switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.ApiToken:if(this.authConfig.config){if(!this.authConfig.config.headerName){this.authConfig.config.headerName="Authorization"}if(!this.authConfig.config.headerValuePrefix){this.authConfig.config.headerValuePrefix="Bearer"}}break;case Ho.CredentialsMethod.ClientCredentials:case Ho.CredentialsMethod.None:default:break}}isValid(){var e,r,n,i,s,a,u,l,c;const{authConfig:d}=this;switch(d===null||d===void 0?void 0:d.method){case Ho.CredentialsMethod.None:break;case Ho.CredentialsMethod.ApiToken:(0,gf.assertParamExists)("Credentials","config.token",(e=d.config)===null||e===void 0?void 0:e.token);(0,gf.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName);(0,gf.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case Ho.CredentialsMethod.ClientCredentials:(0,gf.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId);(0,gf.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret);(0,gf.assertParamExists)("Credentials","config.apiTokenIssuer",(a=d.config)===null||a===void 0?void 0:a.apiTokenIssuer);(0,gf.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience);if(!(0,gf.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`)){throw new qK.FgaValidationError(`Configuration.apiTokenIssuer does not form a valid URI (https://${(c=d.config)===null||c===void 0?void 0:c.apiTokenIssuer})`)}break}}getAccessTokenHeader(){var e;return LK(this,void 0,void 0,function*(){const r=yield this.getAccessTokenValue();switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case Ho.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var e;return LK(this,void 0,void 0,function*(){switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return this.authConfig.config.token;case Ho.CredentialsMethod.ClientCredentials:if(this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)){return this.accessToken}return this.refreshAccessToken()}})}refreshAccessToken(){var e;return LK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,Zkt.attemptHttpRequest)({url:`https://${r.apiTokenIssuer}/oauth/token`,method:"post",data:{client_id:r.clientId,client_secret:r.clientSecret,audience:r.apiAudience,grant_type:"client_credentials"}},{maxRetry:3,minWaitInMs:100},M7e.default);if(n){this.accessToken=n.data.access_token;this.accessTokenExpiryDate=new Date(Date.now()+n.data.expires_in*1e3)}return this.accessToken}catch(n){if(n instanceof qK.FgaApiError){n.constructor=qK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};My.Credentials=jK});var Sx=_(yf=>{"use strict";var e$t=yf&&yf.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var H7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))e$t(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});H7e(V7e(),yf);H7e(fx(),yf)});var FK=_(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:true});Tx.BaseAPI=void 0;var t$t=dx();var r$t=require("http");var n$t=require("https");var z7e=PK();var i$t=Sx();var s$t=1e4;var UK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof z7e.Configuration){this.configuration=e}else{this.configuration=new z7e.Configuration(e)}this.configuration.isValid();this.credentials=i$t.Credentials.init(this.configuration);if(!this.axios){const i=new r$t.Agent({keepAlive:true});const s=new n$t.Agent({keepAlive:true});this.axios=t$t.default.create({httpAgent:i,httpsAgent:s,timeout:s$t,headers:(n=this.configuration.baseOptions)===null||n===void 0?void 0:n.headers})}}get storeId(){return this.configuration.storeId}set storeId(e){this.configuration.storeId=e}};Tx.BaseAPI=UK});var MK=_(tn=>{"use strict";var Zr=tn&&tn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(tn,"__esModule",{value:true});tn.OpenFgaApi=tn.OpenFgaApiFactory=tn.OpenFgaApiFp=tn.OpenFgaApiAxiosParamCreator=void 0;var zs=dx();var a$t=FK();var We=$K();var Vn=sb();var o$t=o(function(t,e){return{check:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("check","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/check".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),createStore:(r,n={})=>Zr(this,void 0,void 0,function*(){const i="/stores";const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),deleteStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"DELETE"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),expand:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("expand","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/expand".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),getStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"GET"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),listObjects:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("listObjects","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/list-objects".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),listStores:(r,n,i={})=>Zr(this,void 0,void 0,function*(){const s="/stores";const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),read:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("read","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/read".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),readAssertions:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAuthorizationModel","id",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models/{id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModels:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),readChanges:(r,n,i,s={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const a="/stores/{store_id}/changes".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const u=new URL(a,We.DUMMY_BASE_URL);let l;if(t){l=t.baseOptions}const c=Object.assign(Object.assign({method:"GET"},l),s);const d={};const p={};if(r!==void 0){p["type"]=r}if(n!==void 0){p["page_size"]=n}if(i!==void 0){p["continuation_token"]=i}(0,We.setSearchParams)(u,p,s.query);c.headers=Object.assign(Object.assign({},d),s.headers);return{url:(0,We.toPathString)(u),options:c}}),write:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("write","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/write".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),writeAssertions:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("writeAssertions","body",n);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"PUT"},u),i);const c={};const d={};c["Content-Type"]="application/json";(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);l.data=(0,We.serializeDataIfNeeded)(n,l);return{url:(0,We.toPathString)(a),options:l}}),writeAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAuthorizationModel","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}})}},"OpenFgaApiAxiosParamCreator");tn.OpenFgaApiAxiosParamCreator=o$t;var u$t=o(function(t,e){const r=(0,tn.OpenFgaApiAxiosParamCreator)(t,e);return{check(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.check(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},createStore(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.createStore(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},deleteStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.deleteStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},expand(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.expand(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},getStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.getStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},listObjects(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.listObjects(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},listStores(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.listStores(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},read(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.read(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAssertions(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAssertions(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModels(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.readAuthorizationModels(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},readChanges(n,i,s,a){return Zr(this,void 0,void 0,function*(){const u=yield r.readChanges(n,i,s,a);return(0,We.createRequestFunction)(u,zs.default,t,e)})},write(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.write(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},writeAssertions(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.writeAssertions(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},writeAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.writeAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})}}},"OpenFgaApiFp");tn.OpenFgaApiFp=u$t;var l$t=o(function(t,e,r){const n=(0,tn.OpenFgaApiFp)(t,e);return{check(i,s){return n.check(i,s).then(a=>a(r))},createStore(i,s){return n.createStore(i,s).then(a=>a(r))},deleteStore(i){return n.deleteStore(i).then(s=>s(r))},expand(i,s){return n.expand(i,s).then(a=>a(r))},getStore(i){return n.getStore(i).then(s=>s(r))},listObjects(i,s){return n.listObjects(i,s).then(a=>a(r))},listStores(i,s,a){return n.listStores(i,s,a).then(u=>u(r))},read(i,s){return n.read(i,s).then(a=>a(r))},readAssertions(i,s){return n.readAssertions(i,s).then(a=>a(r))},readAuthorizationModel(i,s){return n.readAuthorizationModel(i,s).then(a=>a(r))},readAuthorizationModels(i,s,a){return n.readAuthorizationModels(i,s,a).then(u=>u(r))},readChanges(i,s,a,u){return n.readChanges(i,s,a,u).then(l=>l(r))},write(i,s){return n.write(i,s).then(a=>a(r))},writeAssertions(i,s,a){return n.writeAssertions(i,s,a).then(u=>u(r))},writeAuthorizationModel(i,s){return n.writeAuthorizationModel(i,s).then(a=>a(r))}}},"OpenFgaApiFactory");tn.OpenFgaApiFactory=l$t;var BK=class extends a$t.BaseAPI{static{o(this,"OpenFgaApi")}check(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).check(e,r).then(n=>n(this.axios))}createStore(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).createStore(e,r).then(n=>n(this.axios))}deleteStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).deleteStore(e).then(r=>r(this.axios))}expand(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).expand(e,r).then(n=>n(this.axios))}getStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).getStore(e).then(r=>r(this.axios))}listObjects(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listObjects(e,r).then(n=>n(this.axios))}listStores(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listStores(e,r,n).then(i=>i(this.axios))}read(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).read(e,r).then(n=>n(this.axios))}readAssertions(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAssertions(e,r).then(n=>n(this.axios))}readAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModel(e,r).then(n=>n(this.axios))}readAuthorizationModels(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModels(e,r,n).then(i=>i(this.axios))}readChanges(e,r,n,i){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readChanges(e,r,n,i).then(s=>s(this.axios))}write(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).write(e,r).then(n=>n(this.axios))}writeAssertions(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAssertions(e,r,n).then(i=>i(this.axios))}writeAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAuthorizationModel(e,r).then(n=>n(this.axios))}};tn.OpenFgaApi=BK});var K7e=_((Rmr,G7e)=>{async function*c$t(t,e,r){const n=new Set;async function i(){const[s,a]=await Promise.race(n);n.delete(s);return a}o(i,"consume");for(const s of e){const a=(async()=>await r(s,e))().then(u=>[a,u]);n.add(a);if(n.size>=t){yield await i()}}while(n.size){yield await i()}}o(c$t,"asyncPool");G7e.exports=c$t});var Y7e=_(Hl=>{"use strict";var Hn=Hl&&Hl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};var VK=Hl&&Hl.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values==="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(a){return new Promise(function(u,l){a=t[s](a),i(u,l,a.done,a.value)})}}o(n,"verb");function i(s,a,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},a)}o(i,"settle")};Object.defineProperty(Hl,"__esModule",{value:true});Hl.OpenFgaClient=Hl.ClientWriteStatus=void 0;var HK=K7e();var d$t=MK();var p$t=FK();var zK=km();var Aa=DK();var f$t=sb();var GK=10;var Vy="X-OpenFGA-Client-Method";var KK="X-OpenFGA-Client-Bulk-Request-Id";var Hy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(Hy||(Hl.ClientWriteStatus=Hy={}));var YK=class extends p$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new d$t.OpenFgaApi(this.configuration,r);this.authorizationModelId=e.authorizationModelId;this.getAuthorizationModelId()}getAuthorizationModelId(e={}){const r=(e===null||e===void 0?void 0:e.authorizationModelId)||this.authorizationModelId;if(r&&!(0,f$t.isWellFormedUlidString)(r)){throw new zK.FgaValidationError("authorizationModelId")}return r}checkValidApiConnection(e={}){return Hn(this,void 0,void 0,function*(){if(this.getAuthorizationModelId(e)){yield this.readAuthorizationModel(e)}else{yield this.readLatestAuthorizationModel(e)}})}listStores(e={}){return Hn(this,void 0,void 0,function*(){return this.api.listStores(e.pageSize,e.continuationToken,e)})}createStore(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.createStore(e,r)})}getStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.getStore(e)})}deleteStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.deleteStore(e)})}readAuthorizationModels(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAuthorizationModels(e.pageSize,e.continuationToken,e)})}writeAuthorizationModel(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAuthorizationModel(e,r)})}readAuthorizationModel(e={}){return Hn(this,void 0,void 0,function*(){const r=this.getAuthorizationModelId(e);if(!r){throw new zK.FgaRequiredParamError("ClientConfiguration","authorizationModelId")}return this.api.readAuthorizationModel(r,e)})}readLatestAuthorizationModel(e={}){var r;return Hn(this,void 0,void 0,function*(){const{headers:n={}}=e;(0,Aa.setHeaderIfNotSet)(n,Vy,"ReadLatestAuthorizationModel");const i=yield this.readAuthorizationModels(Object.assign(Object.assign({},e),{pageSize:1,headers:n}));const s=i;s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0];delete s.authorization_models;return s})}readChanges(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.readChanges(e.type,r.pageSize,r.continuationToken,r)})}read(e={},r={}){return Hn(this,void 0,void 0,function*(){const n={page_size:r.pageSize,continuation_token:r.continuationToken};if(e.user||e.object||e.relation){n.tuple_key=e}return this.api.read(n,r)})}write(e,r={}){return Hn(this,void 0,void 0,function*(){const{transaction:n={},headers:i={}}=r;const{maxPerChunk:s=1,maxParallelRequests:a=GK}=n;const{writes:u,deletes:l}=e;const c=this.getAuthorizationModelId(r);if(!(n===null||n===void 0?void 0:n.disable)){const d={authorization_model_id:c};if(u===null||u===void 0?void 0:u.length){d.writes={tuple_keys:u}}if(l===null||l===void 0?void 0:l.length){d.deletes={tuple_keys:l}}yield this.api.write(d,r);return{writes:(u===null||u===void 0?void 0:u.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Aa.setHeaderIfNotSet)(i,Vy,"Write");(0,Aa.setHeaderIfNotSet)(i,KK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=VK(HK(a,(0,Aa.chunkArray)(u,s),F=>this.writeTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V})),deletes:[]})))),S;S=yield b.next(),d=S.done,!d;E=true){h=S.value;E=false;const F=h;w.push(F.writes)}}catch(F){p={error:F}}finally{try{if(!E&&!d&&(f=b.return))yield f.call(b)}finally{if(p)throw p.error}}}const T=[];if(l===null||l===void 0?void 0:l.length){try{for(var A=true,P=VK(HK(a,(0,Aa.chunkArray)(l,s),F=>this.deleteTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:[],deletes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V}))})))),D;D=yield P.next(),m=D.done,!m;A=true){v=D.value;A=false;const F=v;T.push(F.deletes)}}catch(F){g={error:F}}finally{try{if(!A&&!m&&(y=P.return))yield y.call(P)}finally{if(g)throw g.error}}}return{writes:w.flat(),deletes:T.flat()}}))(),this.checkValidApiConnection(r)]).then(d=>d[0])})}writeTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"WriteTuples");return this.write({writes:e},Object.assign(Object.assign({},r),{headers:n}))})}deleteTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"DeleteTuples");return this.write({deletes:e},Object.assign(Object.assign({},r),{headers:n}))})}check(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:e.user,relation:e.relation,object:e.object},context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(e,r={}){return Hn(this,void 0,void 0,function*(){return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var n,i,s,a;const{headers:u={},maxParallelRequests:l=GK}=r;(0,Aa.setHeaderIfNotSet)(u,Vy,"BatchCheck");(0,Aa.setHeaderIfNotSet)(u,KK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=VK(HK(l,e,h=>this.check(h,Object.assign(Object.assign({},r),{headers:u})).then(m=>{m._request=h;return m}).catch(m=>{return{allowed:void 0,error:m,_request:h}}))),f;f=yield p.next(),n=f.done,!n;d=true){a=f.value;d=false;const h=a;c.push(h)}}catch(h){i={error:h}}finally{try{if(!d&&!n&&(s=p.return))yield s.call(p)}finally{if(i)throw i.error}}return{responses:c}}))(),this.checkValidApiConnection(r)]).then(n=>n[0])})}expand(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:e},r)})}listObjects(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:e.user,relation:e.relation,type:e.type,context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]}},r)})}listRelations(e,r={}){return Hn(this,void 0,void 0,function*(){const{user:n,object:i,relations:s,contextualTuples:a,context:u}=e;const{headers:l={},maxParallelRequests:c=GK}=r;(0,Aa.setHeaderIfNotSet)(l,Vy,"ListRelations");(0,Aa.setHeaderIfNotSet)(l,KK,(0,Aa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new zK.FgaValidationError("relations","When calling listRelations, at least one relation must be passed in the relations field")}const d=yield this.batchCheck(s.map(f=>({user:n,relation:f,object:i,contextualTuples:a,context:u})),Object.assign(Object.assign({},r),{headers:l,maxParallelRequests:c}));const p=d.responses.find(f=>f.error);if(p){throw p.error}return{relations:d.responses.filter(f=>f.allowed).map(f=>f._request.relation)}})}readAssertions(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAssertions(this.getAuthorizationModelId(e),e)})}writeAssertions(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAssertions(this.getAuthorizationModelId(r),{assertions:e.map(n=>({tuple_key:{user:n.user,relation:n.relation,object:n.object},expectation:n.expectation}))},r)})}};Hl.OpenFgaClient=YK});var tAe=_(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:true});xa.TypeName=xa.TupleOperation=xa.NullValue=xa.NotFoundErrorCode=xa.InternalErrorCode=xa.ErrorCode=void 0;var W7e;(function(t){t["NoError"]="no_error";t["ValidationError"]="validation_error";t["AuthorizationModelNotFound"]="authorization_model_not_found";t["AuthorizationModelResolutionTooComplex"]="authorization_model_resolution_too_complex";t["InvalidWriteInput"]="invalid_write_input";t["CannotAllowDuplicateTuplesInOneRequest"]="cannot_allow_duplicate_tuples_in_one_request";t["CannotAllowDuplicateTypesInOneRequest"]="cannot_allow_duplicate_types_in_one_request";t["CannotAllowMultipleReferencesToOneRelation"]="cannot_allow_multiple_references_to_one_relation";t["InvalidContinuationToken"]="invalid_continuation_token";t["InvalidTupleSet"]="invalid_tuple_set";t["InvalidCheckInput"]="invalid_check_input";t["InvalidExpandInput"]="invalid_expand_input";t["UnsupportedUserSet"]="unsupported_user_set";t["InvalidObjectFormat"]="invalid_object_format";t["WriteFailedDueToInvalidInput"]="write_failed_due_to_invalid_input";t["AuthorizationModelAssertionsNotFound"]="authorization_model_assertions_not_found";t["LatestAuthorizationModelNotFound"]="latest_authorization_model_not_found";t["TypeNotFound"]="type_not_found";t["RelationNotFound"]="relation_not_found";t["EmptyRelationDefinition"]="empty_relation_definition";t["InvalidUser"]="invalid_user";t["InvalidTuple"]="invalid_tuple";t["UnknownRelation"]="unknown_relation";t["StoreIdInvalidLength"]="store_id_invalid_length";t["AssertionsTooManyItems"]="assertions_too_many_items";t["IdTooLong"]="id_too_long";t["AuthorizationModelIdTooLong"]="authorization_model_id_too_long";t["TupleKeyValueNotSpecified"]="tuple_key_value_not_specified";t["TupleKeysTooManyOrTooFewItems"]="tuple_keys_too_many_or_too_few_items";t["PageSizeInvalid"]="page_size_invalid";t["ParamMissingValue"]="param_missing_value";t["DifferenceBaseMissingValue"]="difference_base_missing_value";t["SubtractBaseMissingValue"]="subtract_base_missing_value";t["ObjectTooLong"]="object_too_long";t["RelationTooLong"]="relation_too_long";t["TypeDefinitionsTooFewItems"]="type_definitions_too_few_items";t["TypeInvalidLength"]="type_invalid_length";t["TypeInvalidPattern"]="type_invalid_pattern";t["RelationsTooFewItems"]="relations_too_few_items";t["RelationsTooLong"]="relations_too_long";t["RelationsInvalidPattern"]="relations_invalid_pattern";t["ObjectInvalidPattern"]="object_invalid_pattern";t["QueryStringTypeContinuationTokenMismatch"]="query_string_type_continuation_token_mismatch";t["ExceededEntityLimit"]="exceeded_entity_limit";t["InvalidContextualTuple"]="invalid_contextual_tuple";t["DuplicateContextualTuple"]="duplicate_contextual_tuple";t["InvalidAuthorizationModel"]="invalid_authorization_model";t["UnsupportedSchemaVersion"]="unsupported_schema_version"})(W7e||(xa.ErrorCode=W7e={}));var J7e;(function(t){t["NoInternalError"]="no_internal_error";t["InternalError"]="internal_error";t["Cancelled"]="cancelled";t["DeadlineExceeded"]="deadline_exceeded";t["AlreadyExists"]="already_exists";t["ResourceExhausted"]="resource_exhausted";t["FailedPrecondition"]="failed_precondition";t["Aborted"]="aborted";t["OutOfRange"]="out_of_range";t["Unavailable"]="unavailable";t["DataLoss"]="data_loss"})(J7e||(xa.InternalErrorCode=J7e={}));var Q7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(Q7e||(xa.NotFoundErrorCode=Q7e={}));var X7e;(function(t){t["NullValue"]="NULL_VALUE"})(X7e||(xa.NullValue=X7e={}));var Z7e;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(Z7e||(xa.TupleOperation=Z7e={}));var eAe;(function(t){t["Unspecified"]="TYPE_NAME_UNSPECIFIED";t["Any"]="TYPE_NAME_ANY";t["Bool"]="TYPE_NAME_BOOL";t["String"]="TYPE_NAME_STRING";t["Int"]="TYPE_NAME_INT";t["Uint"]="TYPE_NAME_UINT";t["Double"]="TYPE_NAME_DOUBLE";t["Duration"]="TYPE_NAME_DURATION";t["Timestamp"]="TYPE_NAME_TIMESTAMP";t["Map"]="TYPE_NAME_MAP";t["List"]="TYPE_NAME_LIST";t["Ipaddress"]="TYPE_NAME_IPADDRESS"})(eAe||(xa.TypeName=eAe={}))});var iAe=_($i=>{"use strict";var h$t=$i&&$i.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var Ax=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))h$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Ax(MK(),$i);Ax(Y7e(),$i);Ax(tAe(),$i);var rAe=PK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return rAe.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return rAe.GetDefaultRetryParams}});var nAe=Sx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return nAe.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return nAe.CredentialsMethod}});Ax(km(),$i)});var aAe=_(zy=>{"use strict";var m$t=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zy,"__esModule",{value:true});zy.OpenFGAService=void 0;var ub=m$t(za());var sAe=iAe();var g$t=Ry();var WK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!ub.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=ub.default.OPENFGA_SERVICE_URL;this.apiHost=ub.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=ub.default.OPENFGA_STORE_ID;this.modelId=ub.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,g$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new sAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:sAe.CredentialsMethod.ApiToken,config:{token:e}}})}return this.openFGAClient}async createAccountMember(e){try{const r=await this.getOpenFgaClient();await r.write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${e}`}]})}catch(r){this.logger.warn(`RBAC failed to create account membership. Error: ${r.message}`)}}async getAccountMemberships(){const e=await this.getOpenFgaClient();const r=await e.listObjects({user:`user:${this.userSub}`,relation:"member",type:"account"});if(r){return r.objects.map(n=>n.replace(/^(account:)/,""))}return[]}async isAccountMember(e){try{const r=await this.getOpenFgaClient();const{allowed:n}=await r.check({user:`user:${this.userSub}`,relation:"member",object:`account:${e}`});if(!n){return false}return n}catch(r){this.logger.warn(`RBAC failed to check account membership. Error: ${r.message}`);return false}}async createProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({writes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to create account-project association. Error: ${n.message}`)}}async deleteProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({deletes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to delete account-project association. Error: ${n.message}`)}}};zy.OpenFGAService=WK});var lAe=_(Gy=>{"use strict";var uAe=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.TenantService=void 0;var y$t=uAe(Vu());var oAe=uAe(za());var v$t=ex();var _$t=new y$t.default({max:500,maxAge:1e3*60*50});var JK=class extends v$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!oAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(oAe.default.TENANT_API_URL,_$t,{userSub:n,logger:e.log,requestId:e.id})}};Gy.TenantService=JK});var cAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function E$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(E$t,"sizeInBytes");zl.sizeInBytes=E$t;function b$t(t){if(!t||t===null){return""}return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(e=>e.toLowerCase()).join("_")}o(b$t,"snakeCase");zl.snakeCase=b$t;function w$t(t){if(!t||t===null){return""}const e=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);if(e===null){return""}return e.map(r=>r.toLowerCase()).join("-")}o(w$t,"kebabCase");zl.kebabCase=w$t;function S$t(t){try{const e=/^(?!https?:\/\/)([a-zA-Z0-9.-]*|(\*))*\.[a-zA-Z]+$/;if(t&&!e.test(t)){return false}return true}catch(e){}return false}o(S$t,"validateHostname");zl.validateHostname=S$t});var fAe=_(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:true});G.Type=G.JsonType=G.JavaScriptTypeBuilder=G.JsonTypeBuilder=G.TypeBuilder=G.TypeBuilderError=G.TransformEncodeBuilder=G.TransformDecodeBuilder=G.TemplateLiteralDslParser=G.TemplateLiteralGenerator=G.TemplateLiteralGeneratorError=G.TemplateLiteralFinite=G.TemplateLiteralFiniteError=G.TemplateLiteralParser=G.TemplateLiteralParserError=G.TemplateLiteralResolver=G.TemplateLiteralPattern=G.TemplateLiteralPatternError=G.UnionResolver=G.KeyArrayResolver=G.KeyArrayResolverError=G.KeyResolver=G.ObjectMap=G.Intrinsic=G.IndexedAccessor=G.TypeClone=G.TypeExtends=G.TypeExtendsResult=G.TypeExtendsError=G.ExtendsUndefined=G.TypeGuard=G.TypeGuardUnknownTypeError=G.ValueGuard=G.FormatRegistry=G.TypeBoxError=G.TypeRegistry=G.PatternStringExact=G.PatternNumberExact=G.PatternBooleanExact=G.PatternString=G.PatternNumber=G.PatternBoolean=G.Kind=G.Hint=G.Optional=G.Readonly=G.Transform=void 0;G.Transform=Symbol.for("TypeBox.Transform");G.Readonly=Symbol.for("TypeBox.Readonly");G.Optional=Symbol.for("TypeBox.Optional");G.Hint=Symbol.for("TypeBox.Hint");G.Kind=Symbol.for("TypeBox.Kind");G.PatternBoolean="(true|false)";G.PatternNumber="(0|[1-9][0-9]*)";G.PatternString="(.*)";G.PatternBooleanExact=`^${G.PatternBoolean}$`;G.PatternNumberExact=`^${G.PatternNumber}$`;G.PatternStringExact=`^${G.PatternString}$`;var QK;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(QK||(G.TypeRegistry=QK={}));var Du=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Du;var dAe;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(dAe||(G.FormatRegistry=dAe={}));var Me;(function(t){function e(c){return Array.isArray(c)}o(e,"IsArray");t.IsArray=e;function r(c){return typeof c==="bigint"}o(r,"IsBigInt");t.IsBigInt=r;function n(c){return typeof c==="boolean"}o(n,"IsBoolean");t.IsBoolean=n;function i(c){return c===null}o(i,"IsNull");t.IsNull=i;function s(c){return typeof c==="number"}o(s,"IsNumber");t.IsNumber=s;function a(c){return typeof c==="object"&&c!==null}o(a,"IsObject");t.IsObject=a;function u(c){return typeof c==="string"}o(u,"IsString");t.IsString=u;function l(c){return c===void 0}o(l,"IsUndefined");t.IsUndefined=l})(Me||(G.ValueGuard=Me={}));var XK=class extends Du{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=XK;var Y;(function(t){function e(x){try{new RegExp(x);return true}catch{return false}}o(e,"IsPattern");function r(x){if(!Me.IsString(x))return false;for(let ie=0;ie<x.length;ie++){const ce=x.charCodeAt(ie);if(ce>=7&&ce<=13||ce===27||ce===127){return false}}return true}o(r,"IsControlCharacterFree");function n(x){return a(x)||J(x)}o(n,"IsAdditionalProperties");function i(x){return Me.IsUndefined(x)||Me.IsBigInt(x)}o(i,"IsOptionalBigInt");function s(x){return Me.IsUndefined(x)||Me.IsNumber(x)}o(s,"IsOptionalNumber");function a(x){return Me.IsUndefined(x)||Me.IsBoolean(x)}o(a,"IsOptionalBoolean");function u(x){return Me.IsUndefined(x)||Me.IsString(x)}o(u,"IsOptionalString");function l(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)&&e(x)}o(l,"IsOptionalPattern");function c(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)}o(c,"IsOptionalFormat");function d(x){return Me.IsUndefined(x)||J(x)}o(d,"IsOptionalSchema");function p(x){return T(x,"Any")&&u(x.$id)}o(p,"TAny");t.TAny=p;function f(x){return T(x,"Array")&&x.type==="array"&&u(x.$id)&&J(x.items)&&s(x.minItems)&&s(x.maxItems)&&a(x.uniqueItems)&&d(x.contains)&&s(x.minContains)&&s(x.maxContains)}o(f,"TArray");t.TArray=f;function h(x){return T(x,"AsyncIterator")&&x.type==="AsyncIterator"&&u(x.$id)&&J(x.items)}o(h,"TAsyncIterator");t.TAsyncIterator=h;function m(x){return T(x,"BigInt")&&x.type==="bigint"&&u(x.$id)&&i(x.exclusiveMaximum)&&i(x.exclusiveMinimum)&&i(x.maximum)&&i(x.minimum)&&i(x.multipleOf)}o(m,"TBigInt");t.TBigInt=m;function g(x){return T(x,"Boolean")&&x.type==="boolean"&&u(x.$id)}o(g,"TBoolean");t.TBoolean=g;function y(x){return T(x,"Constructor")&&x.type==="constructor"&&u(x.$id)&&Me.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(y,"TConstructor");t.TConstructor=y;function v(x){return T(x,"Date")&&x.type==="Date"&&u(x.$id)&&s(x.exclusiveMaximumTimestamp)&&s(x.exclusiveMinimumTimestamp)&&s(x.maximumTimestamp)&&s(x.minimumTimestamp)&&s(x.multipleOfTimestamp)}o(v,"TDate");t.TDate=v;function w(x){return T(x,"Function")&&x.type==="function"&&u(x.$id)&&Me.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(w,"TFunction");t.TFunction=w;function E(x){return T(x,"Integer")&&x.type==="integer"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(E,"TInteger");t.TInteger=E;function b(x){return T(x,"Intersect")&&(Me.IsString(x.type)&&x.type!=="object"?false:true)&&Me.IsArray(x.allOf)&&x.allOf.every(ie=>J(ie)&&!Le(ie))&&u(x.type)&&(a(x.unevaluatedProperties)||d(x.unevaluatedProperties))&&u(x.$id)}o(b,"TIntersect");t.TIntersect=b;function S(x){return T(x,"Iterator")&&x.type==="Iterator"&&u(x.$id)&&J(x.items)}o(S,"TIterator");t.TIterator=S;function T(x,ie){return A(x)&&x[G.Kind]===ie}o(T,"TKindOf");t.TKindOf=T;function A(x){return Me.IsObject(x)&&G.Kind in x&&Me.IsString(x[G.Kind])}o(A,"TKind");t.TKind=A;function P(x){return V(x)&&Me.IsString(x.const)}o(P,"TLiteralString");t.TLiteralString=P;function D(x){return V(x)&&Me.IsNumber(x.const)}o(D,"TLiteralNumber");t.TLiteralNumber=D;function F(x){return V(x)&&Me.IsBoolean(x.const)}o(F,"TLiteralBoolean");t.TLiteralBoolean=F;function V(x){return T(x,"Literal")&&u(x.$id)&&(Me.IsBoolean(x.const)||Me.IsNumber(x.const)||Me.IsString(x.const))}o(V,"TLiteral");t.TLiteral=V;function j(x){return T(x,"Never")&&Me.IsObject(x.not)&&Object.getOwnPropertyNames(x.not).length===0}o(j,"TNever");t.TNever=j;function Q(x){return T(x,"Not")&&J(x.not)}o(Q,"TNot");t.TNot=Q;function ae(x){return T(x,"Null")&&x.type==="null"&&u(x.$id)}o(ae,"TNull");t.TNull=ae;function Te(x){return T(x,"Number")&&x.type==="number"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(Te,"TNumber");t.TNumber=Te;function le(x){return T(x,"Object")&&x.type==="object"&&u(x.$id)&&Me.IsObject(x.properties)&&n(x.additionalProperties)&&s(x.minProperties)&&s(x.maxProperties)&&Object.entries(x.properties).every(([ie,ce])=>r(ie)&&J(ce))}o(le,"TObject");t.TObject=le;function ue(x){return T(x,"Promise")&&x.type==="Promise"&&u(x.$id)&&J(x.item)}o(ue,"TPromise");t.TPromise=ue;function Ae(x){return T(x,"Record")&&x.type==="object"&&u(x.$id)&&n(x.additionalProperties)&&Me.IsObject(x.patternProperties)&&(ie=>{const ce=Object.getOwnPropertyNames(ie.patternProperties);return ce.length===1&&e(ce[0])&&Me.IsObject(ie.patternProperties)&&J(ie.patternProperties[ce[0]])})(x)}o(Ae,"TRecord");t.TRecord=Ae;function we(x){return Me.IsObject(x)&&G.Hint in x&&x[G.Hint]==="Recursive"}o(we,"TRecursive");t.TRecursive=we;function Pe(x){return T(x,"Ref")&&u(x.$id)&&Me.IsString(x.$ref)}o(Pe,"TRef");t.TRef=Pe;function Ue(x){return T(x,"String")&&x.type==="string"&&u(x.$id)&&s(x.minLength)&&s(x.maxLength)&&l(x.pattern)&&c(x.format)}o(Ue,"TString");t.TString=Ue;function $e(x){return T(x,"Symbol")&&x.type==="symbol"&&u(x.$id)}o($e,"TSymbol");t.TSymbol=$e;function ge(x){return T(x,"TemplateLiteral")&&x.type==="string"&&Me.IsString(x.pattern)&&x.pattern[0]==="^"&&x.pattern[x.pattern.length-1]==="$"}o(ge,"TTemplateLiteral");t.TTemplateLiteral=ge;function Je(x){return T(x,"This")&&u(x.$id)&&Me.IsString(x.$ref)}o(Je,"TThis");t.TThis=Je;function Le(x){return Me.IsObject(x)&&G.Transform in x}o(Le,"TTransform");t.TTransform=Le;function Ie(x){return T(x,"Tuple")&&x.type==="array"&&u(x.$id)&&Me.IsNumber(x.minItems)&&Me.IsNumber(x.maxItems)&&x.minItems===x.maxItems&&(Me.IsUndefined(x.items)&&Me.IsUndefined(x.additionalItems)&&x.minItems===0||Me.IsArray(x.items)&&x.items.every(ie=>J(ie)))}o(Ie,"TTuple");t.TTuple=Ie;function Qe(x){return T(x,"Undefined")&&x.type==="undefined"&&u(x.$id)}o(Qe,"TUndefined");t.TUndefined=Qe;function qe(x){return C(x)&&x.anyOf.every(ie=>P(ie)||D(ie))}o(qe,"TUnionLiteral");t.TUnionLiteral=qe;function C(x){return T(x,"Union")&&u(x.$id)&&Me.IsObject(x)&&Me.IsArray(x.anyOf)&&x.anyOf.every(ie=>J(ie))}o(C,"TUnion");t.TUnion=C;function N(x){return T(x,"Uint8Array")&&x.type==="Uint8Array"&&u(x.$id)&&s(x.minByteLength)&&s(x.maxByteLength)}o(N,"TUint8Array");t.TUint8Array=N;function q(x){return T(x,"Unknown")&&u(x.$id)}o(q,"TUnknown");t.TUnknown=q;function z(x){return T(x,"Unsafe")}o(z,"TUnsafe");t.TUnsafe=z;function W(x){return T(x,"Void")&&x.type==="void"&&u(x.$id)}o(W,"TVoid");t.TVoid=W;function K(x){return Me.IsObject(x)&&x[G.Readonly]==="Readonly"}o(K,"TReadonly");t.TReadonly=K;function se(x){return Me.IsObject(x)&&x[G.Optional]==="Optional"}o(se,"TOptional");t.TOptional=se;function J(x){return Me.IsObject(x)&&(p(x)||f(x)||g(x)||m(x)||h(x)||y(x)||v(x)||w(x)||E(x)||b(x)||S(x)||V(x)||j(x)||Q(x)||ae(x)||Te(x)||le(x)||ue(x)||Ae(x)||Pe(x)||Ue(x)||$e(x)||ge(x)||Je(x)||Ie(x)||Qe(x)||C(x)||N(x)||q(x)||z(x)||W(x)||A(x)&&QK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var pAe;(function(t){function e(r){return r[G.Kind]==="Intersect"?r.allOf.every(n=>e(n)):r[G.Kind]==="Union"?r.anyOf.some(n=>e(n)):r[G.Kind]==="Undefined"?true:r[G.Kind]==="Not"?!e(r.not):false}o(e,"Check");t.Check=e})(pAe||(G.ExtendsUndefined=pAe={}));var xx=class extends Du{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=xx;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var Lm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new xx(U)}o(r,"Throw");function n(U){return Y.TNever(U)||Y.TIntersect(U)||Y.TUnion(U)||Y.TUnknown(U)||Y.TAny(U)}o(n,"IsStructuralRight");function i(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):r("StructuralRight")}o(i,"StructuralRight");function s(U,$){return Ee.True}o(s,"TAnyRight");function a(U,$){return Y.TIntersect($)?w(U,$):Y.TUnion($)&&$.anyOf.some(Ye=>Y.TAny(Ye)||Y.TUnknown(Ye))?Ee.True:Y.TUnion($)?Ee.Union:Y.TUnknown($)?Ee.True:Y.TAny($)?Ee.True:Ee.Union}o(a,"TAny");function u(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)?Ee.True:Ee.False}o(u,"TArrayRight");function l(U,$){return Y.TObject($)&&ge($)?Ee.True:n($)?i(U,$):!Y.TArray($)?Ee.False:e(ft(U.items,$.items))}o(l,"TArray");function c(U,$){return n($)?i(U,$):!Y.TAsyncIterator($)?Ee.False:e(ft(U.items,$.items))}o(c,"TAsyncIterator");function d(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBigInt($)?Ee.True:Ee.False}o(d,"TBigInt");function p(U,$){return Y.TLiteral(U)&&Me.IsBoolean(U.const)?Ee.True:Y.TBoolean(U)?Ee.True:Ee.False}o(p,"TBooleanRight");function f(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBoolean($)?Ee.True:Ee.False}o(f,"TBoolean");function h(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TConstructor($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(h,"TConstructor");function m(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TDate($)?Ee.True:Ee.False}o(m,"TDate");function g(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TFunction($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(g,"TFunction");function y(U,$){return Y.TLiteral(U)&&Me.IsNumber(U.const)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(y,"TIntegerRight");function v(U,$){return Y.TInteger($)||Y.TNumber($)?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Ee.False}o(v,"TInteger");function w(U,$){return $.allOf.every(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(w,"TIntersectRight");function E(U,$){return U.allOf.some(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(E,"TIntersect");function b(U,$){return n($)?i(U,$):!Y.TIterator($)?Ee.False:e(ft(U.items,$.items))}o(b,"TIterator");function S(U,$){return Y.TLiteral($)&&$.const===U.const?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Ee.False}o(S,"TLiteral");function T(U,$){return Ee.False}o(T,"TNeverRight");function A(U,$){return Ee.True}o(A,"TNever");function P(U){let[$,Ye]=[U,0];while(true){if(!Y.TNot($))break;$=$.not;Ye+=1}return Ye%2===0?$:G.Type.Unknown()}o(P,"UnwrapTNot");function D(U,$){return Y.TNot(U)?ft(P(U),$):Y.TNot($)?ft(U,P($)):r("Invalid fallthrough for Not")}o(D,"TNot");function F(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TNull($)?Ee.True:Ee.False}o(F,"TNull");function V(U,$){return Y.TLiteralNumber(U)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(V,"TNumberRight");function j(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TInteger($)||Y.TNumber($)?Ee.True:Ee.False}o(j,"TNumber");function Q(U,$){return Object.getOwnPropertyNames(U.properties).length===$}o(Q,"IsObjectPropertyCount");function ae(U){return ge(U)}o(ae,"IsObjectStringLike");function Te(U){return Q(U,0)||Q(U,1)&&"description"in U.properties&&Y.TUnion(U.properties.description)&&U.properties.description.anyOf.length===2&&(Y.TString(U.properties.description.anyOf[0])&&Y.TUndefined(U.properties.description.anyOf[1])||Y.TString(U.properties.description.anyOf[1])&&Y.TUndefined(U.properties.description.anyOf[0]))}o(Te,"IsObjectSymbolLike");function le(U){return Q(U,0)}o(le,"IsObjectNumberLike");function ue(U){return Q(U,0)}o(ue,"IsObjectBooleanLike");function Ae(U){return Q(U,0)}o(Ae,"IsObjectBigIntLike");function we(U){return Q(U,0)}o(we,"IsObjectDateLike");function Pe(U){return ge(U)}o(Pe,"IsObjectUint8ArrayLike");function Ue(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(Ue,"IsObjectFunctionLike");function $e(U){return Q(U,0)}o($e,"IsObjectConstructorLike");function ge(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(ge,"IsObjectArrayLike");function Je(U){const $=G.Type.Function([G.Type.Any()],G.Type.Any());return Q(U,0)||Q(U,1)&&"then"in U.properties&&e(ft(U.properties["then"],$))===Ee.True}o(Je,"IsObjectPromiseLike");function Le(U,$){return ft(U,$)===Ee.False?Ee.False:Y.TOptional(U)&&!Y.TOptional($)?Ee.False:Ee.True}o(Le,"Property");function Ie(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)||Y.TLiteralString(U)&&ae($)||Y.TLiteralNumber(U)&&le($)||Y.TLiteralBoolean(U)&&ue($)||Y.TSymbol(U)&&Te($)||Y.TBigInt(U)&&Ae($)||Y.TString(U)&&ae($)||Y.TSymbol(U)&&Te($)||Y.TNumber(U)&&le($)||Y.TInteger(U)&&le($)||Y.TBoolean(U)&&ue($)||Y.TUint8Array(U)&&Pe($)||Y.TDate(U)&&we($)||Y.TConstructor(U)&&$e($)||Y.TFunction(U)&&Ue($)?Ee.True:Y.TRecord(U)&&Y.TString(C(U))?(()=>{return $[G.Hint]==="Record"?Ee.True:Ee.False})():Y.TRecord(U)&&Y.TNumber(C(U))?(()=>{return Q($,0)?Ee.True:Ee.False})():Ee.False}o(Ie,"TObjectRight");function Qe(U,$){return n($)?i(U,$):Y.TRecord($)?q(U,$):!Y.TObject($)?Ee.False:(()=>{for(const Ye of Object.getOwnPropertyNames($.properties)){if(!(Ye in U.properties))return Ee.False;if(Le(U.properties[Ye],$.properties[Ye])===Ee.False){return Ee.False}}return Ee.True})()}o(Qe,"TObject");function qe(U,$){return n($)?i(U,$):Y.TObject($)&&Je($)?Ee.True:!Y.TPromise($)?Ee.False:e(ft(U.item,$.item))}o(qe,"TPromise");function C(U){return G.PatternNumberExact in U.patternProperties?G.Type.Number():G.PatternStringExact in U.patternProperties?G.Type.String():r("Unknown record key pattern")}o(C,"RecordKey");function N(U){return G.PatternNumberExact in U.patternProperties?U.patternProperties[G.PatternNumberExact]:G.PatternStringExact in U.patternProperties?U.patternProperties[G.PatternStringExact]:r("Unable to get record value schema")}o(N,"RecordValue");function q(U,$){const[Ye,cr]=[C($),N($)];return Y.TLiteralString(U)&&Y.TNumber(Ye)&&e(ft(U,cr))===Ee.True?Ee.True:Y.TUint8Array(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TString(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TArray(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TObject(U)?(()=>{for(const vi of Object.getOwnPropertyNames(U.properties)){if(Le(cr,U.properties[vi])===Ee.False){return Ee.False}}return Ee.True})():Ee.False}o(q,"TRecordRight");function z(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TRecord($)?Ee.False:ft(N(U),N($))}o(z,"TRecord");function W(U,$){return Y.TLiteral(U)&&Me.IsString(U.const)?Ee.True:Y.TString(U)?Ee.True:Ee.False}o(W,"TStringRight");function K(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?Ee.True:Ee.False}o(K,"TString");function se(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TSymbol($)?Ee.True:Ee.False}o(se,"TSymbol");function J(U,$){return Y.TTemplateLiteral(U)?ft(rd.Resolve(U),$):Y.TTemplateLiteral($)?ft(U,rd.Resolve($)):r("Invalid fallthrough for TemplateLiteral")}o(J,"TTemplateLiteral");function x(U,$){return Y.TArray($)&&U.items!==void 0&&U.items.every(Ye=>ft(Ye,$.items)===Ee.True)}o(x,"IsArrayOfTuple");function ie(U,$){return Y.TNever(U)?Ee.True:Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Ee.False}o(ie,"TTupleRight");function ce(U,$){return n($)?i(U,$):Y.TObject($)&&ge($)?Ee.True:Y.TArray($)&&x(U,$)?Ee.True:!Y.TTuple($)?Ee.False:Me.IsUndefined(U.items)&&!Me.IsUndefined($.items)||!Me.IsUndefined(U.items)&&Me.IsUndefined($.items)?Ee.False:Me.IsUndefined(U.items)&&!Me.IsUndefined($.items)?Ee.True:U.items.every((Ye,cr)=>ft(Ye,$.items[cr])===Ee.True)?Ee.True:Ee.False}o(ce,"TTuple");function ve(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TUint8Array($)?Ee.True:Ee.False}o(ve,"TUint8Array");function je(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TVoid($)?Et(U,$):Y.TUndefined($)?Ee.True:Ee.False}o(je,"TUndefined");function Xe(U,$){return $.anyOf.some(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(Xe,"TUnionRight");function _t(U,$){return U.anyOf.every(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(_t,"TUnion");function tr(U,$){return Ee.True}o(tr,"TUnknownRight");function lr(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TAny($)?s(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Y.TArray($)?u(U,$):Y.TTuple($)?ie(U,$):Y.TObject($)?Ie(U,$):Y.TUnknown($)?Ee.True:Ee.False}o(lr,"TUnknown");function Et(U,$){return Y.TUndefined(U)?Ee.True:Y.TUndefined(U)?Ee.True:Ee.False}o(Et,"VoidRight");function xt(U,$){return Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):Y.TObject($)?Ie(U,$):Y.TVoid($)?Ee.True:Ee.False}o(xt,"TVoid");function ft(U,$){return Y.TTemplateLiteral(U)||Y.TTemplateLiteral($)?J(U,$):Y.TNot(U)||Y.TNot($)?D(U,$):Y.TAny(U)?a(U,$):Y.TArray(U)?l(U,$):Y.TBigInt(U)?d(U,$):Y.TBoolean(U)?f(U,$):Y.TAsyncIterator(U)?c(U,$):Y.TConstructor(U)?h(U,$):Y.TDate(U)?m(U,$):Y.TFunction(U)?g(U,$):Y.TInteger(U)?v(U,$):Y.TIntersect(U)?E(U,$):Y.TIterator(U)?b(U,$):Y.TLiteral(U)?S(U,$):Y.TNever(U)?A(U,$):Y.TNull(U)?F(U,$):Y.TNumber(U)?j(U,$):Y.TObject(U)?Qe(U,$):Y.TRecord(U)?z(U,$):Y.TString(U)?K(U,$):Y.TSymbol(U)?se(U,$):Y.TTuple(U)?ce(U,$):Y.TPromise(U)?qe(U,$):Y.TUint8Array(U)?ve(U,$):Y.TUndefined(U)?je(U,$):Y.TUnion(U)?_t(U,$):Y.TUnknown(U)?lr(U,$):Y.TVoid(U)?xt(U,$):r(`Unknown left type operand '${U[G.Kind]}'`)}o(ft,"Visit");function en(U,$){return ft(U,$)}o(en,"Extends");t.Extends=en})(Lm||(G.TypeExtends=Lm={}));var ct;(function(t){function e(a){const u=Object.getOwnPropertyNames(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});const l=Object.getOwnPropertySymbols(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});return{...u,...l}}o(e,"ObjectType");function r(a){return a.map(u=>n(u))}o(r,"ArrayType");function n(a){return Me.IsArray(a)?r(a):Me.IsObject(a)?e(a):a}o(n,"Visit");function i(a){return a.map(u=>s(u))}o(i,"Rest");t.Rest=i;function s(a,u={}){return{...n(a),...u}}o(s,"Type");t.Type=s})(ct||(G.TypeClone=ct={}));var ZK;(function(t){function e(h){return h.map(m=>{const{[G.Optional]:g,...y}=ct.Type(m);return y})}o(e,"OptionalUnwrap");function r(h){return h.every(m=>Y.TOptional(m))}o(r,"IsIntersectOptional");function n(h){return h.some(m=>Y.TOptional(m))}o(n,"IsUnionOptional");function i(h){return r(h.allOf)?G.Type.Optional(G.Type.Intersect(e(h.allOf))):h}o(i,"ResolveIntersect");function s(h){return n(h.anyOf)?G.Type.Optional(G.Type.Union(e(h.anyOf))):h}o(s,"ResolveUnion");function a(h){return h[G.Kind]==="Intersect"?i(h):h[G.Kind]==="Union"?s(h):h}o(a,"ResolveOptional");function u(h,m){const g=h.allOf.reduce((y,v)=>{const w=p(v,m);return w[G.Kind]==="Never"?y:[...y,w]},[]);return a(G.Type.Intersect(g))}o(u,"TIntersect");function l(h,m){const g=h.anyOf.map(y=>p(y,m));return a(G.Type.Union(g))}o(l,"TUnion");function c(h,m){const g=h.properties[m];return Me.IsUndefined(g)?G.Type.Never():G.Type.Union([g])}o(c,"TObject");function d(h,m){const g=h.items;if(Me.IsUndefined(g))return G.Type.Never();const y=g[m];if(Me.IsUndefined(y))return G.Type.Never();return y}o(d,"TTuple");function p(h,m){return h[G.Kind]==="Intersect"?u(h,m):h[G.Kind]==="Union"?l(h,m):h[G.Kind]==="Object"?c(h,m):h[G.Kind]==="Tuple"?d(h,m):G.Type.Never()}o(p,"Visit");function f(h,m,g={}){const y=m.map(v=>p(h,v.toString()));return a(G.Type.Union(y,g))}o(f,"Resolve");t.Resolve=f})(ZK||(G.IndexedAccessor=ZK={}));var Ky;(function(t){function e(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toLowerCase()}${f}`}o(e,"Uncapitalize");function r(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toUpperCase()}${f}`}o(r,"Capitalize");function n(d){return d.toUpperCase()}o(n,"Uppercase");function i(d){return d.toLowerCase()}o(i,"Lowercase");function s(d,p){const f=Wy.ParseExact(d.pattern);const h=Jy.Check(f);if(!h)return{...d,pattern:a(d.pattern,p)};const m=[...Qy.Generate(f)];const g=m.map(w=>G.Type.Literal(w));const y=u(g,p);const v=G.Type.Union(y);return G.Type.TemplateLiteral([v])}o(s,"IntrinsicTemplateLiteral");function a(d,p){return typeof d==="string"?p==="Uncapitalize"?e(d):p==="Capitalize"?r(d):p==="Uppercase"?n(d):p==="Lowercase"?i(d):d:d.toString()}o(a,"IntrinsicLiteral");function u(d,p){if(d.length===0)return[];const[f,...h]=d;return[c(f,p),...u(h,p)]}o(u,"IntrinsicRest");function l(d,p){return Y.TTemplateLiteral(d)?s(d,p):Y.TUnion(d)?G.Type.Union(u(d.anyOf,p)):Y.TLiteral(d)?G.Type.Literal(a(d.const,p)):d}o(l,"Visit");function c(d,p){return l(d,p)}o(c,"Map");t.Map=c})(Ky||(G.Intrinsic=Ky={}));var Yy;(function(t){function e(a,u){return G.Type.Intersect(a.allOf.map(l=>i(l,u)),{...a})}o(e,"TIntersect");function r(a,u){return G.Type.Union(a.anyOf.map(l=>i(l,u)),{...a})}o(r,"TUnion");function n(a,u){return u(a)}o(n,"TObject");function i(a,u){return a[G.Kind]==="Intersect"?e(a,u):a[G.Kind]==="Union"?r(a,u):a[G.Kind]==="Object"?n(a,u):a}o(i,"Visit");function s(a,u,l){return{...i(ct.Type(a),u),...l}}o(s,"Map");t.Map=s})(Yy||(G.ObjectMap=Yy={}));var Cx;(function(t){function e(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}o(e,"UnwrapPattern");function r(c,d){return c.allOf.reduce((p,f)=>[...p,...a(f,d)],[])}o(r,"TIntersect");function n(c,d){const p=c.anyOf.map(f=>a(f,d));return[...p.reduce((f,h)=>h.map(m=>p.every(g=>g.includes(m))?f.add(m):f)[0],new Set)]}o(n,"TUnion");function i(c,d){return Object.getOwnPropertyNames(c.properties)}o(i,"TObject");function s(c,d){return d.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}o(s,"TRecord");function a(c,d){return Y.TIntersect(c)?r(c,d):Y.TUnion(c)?n(c,d):Y.TObject(c)?i(c,d):Y.TRecord(c)?s(c,d):[]}o(a,"Visit");function u(c,d){return[...new Set(a(c,d))]}o(u,"ResolveKeys");t.ResolveKeys=u;function l(c){const d=u(c,{includePatterns:true});const p=d.map(f=>`(${e(f)})`);return`^(${p.join("|")})$`}o(l,"ResolvePattern");t.ResolvePattern=l})(Cx||(G.KeyResolver=Cx={}));var Rx=class extends Du{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Rx;var lb;(function(t){function e(r){return Array.isArray(r)?r:Y.TUnionLiteral(r)?r.anyOf.map(n=>n.const.toString()):Y.TLiteral(r)?[r.const]:Y.TTemplateLiteral(r)?(()=>{const n=Wy.ParseExact(r.pattern);if(!Jy.Check(n))throw new Rx("Cannot resolve keys from infinite template expression");return[...Qy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(lb||(G.KeyArrayResolver=lb={}));var eY;(function(t){function*e(n){for(const i of n.anyOf){if(i[G.Kind]==="Union"){yield*e(i)}else{yield i}}}o(e,"TUnion");function r(n){return G.Type.Union([...e(n)],{...n})}o(r,"Resolve");t.Resolve=r})(eY||(G.UnionResolver=eY={}));var Ox=class extends Du{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Ox;var Nx;(function(t){function e(s){throw new Ox(s)}o(e,"Throw");function r(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(r,"Escape");function n(s,a){return Y.TTemplateLiteral(s)?s.pattern.slice(1,s.pattern.length-1):Y.TUnion(s)?`(${s.anyOf.map(u=>n(u,a)).join("|")})`:Y.TNumber(s)?`${a}${G.PatternNumber}`:Y.TInteger(s)?`${a}${G.PatternNumber}`:Y.TBigInt(s)?`${a}${G.PatternNumber}`:Y.TString(s)?`${a}${G.PatternString}`:Y.TLiteral(s)?`${a}${r(s.const.toString())}`:Y.TBoolean(s)?`${a}${G.PatternBoolean}`:e(`Unexpected Kind '${s[G.Kind]}'`)}o(n,"Visit");function i(s){return`^${s.map(a=>n(a,"")).join("")}$`}o(i,"Create");t.Create=i})(Nx||(G.TemplateLiteralPattern=Nx={}));var rd;(function(t){function e(r){const n=Wy.ParseExact(r.pattern);if(!Jy.Check(n))return G.Type.String();const i=[...Qy.Generate(n)].map(s=>G.Type.Literal(s));return G.Type.Union(i)}o(e,"Resolve");t.Resolve=e})(rd||(G.TemplateLiteralResolver=rd={}));var cb=class extends Du{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=cb;var Wy;(function(t){function e(h,m,g){return h[m]===g&&h.charCodeAt(m-1)!==92}o(e,"IsNonEscaped");function r(h,m){return e(h,m,"(")}o(r,"IsOpenParen");function n(h,m){return e(h,m,")")}o(n,"IsCloseParen");function i(h,m){return e(h,m,"|")}o(i,"IsSeparator");function s(h){if(!(r(h,0)&&n(h,h.length-1)))return false;let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(m===0&&g!==h.length-1)return false}return true}o(s,"IsGroup");function a(h){return h.slice(1,h.length-1)}o(a,"InGroup");function u(h){let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(i(h,g)&&m===0)return true}return false}o(u,"IsPrecedenceOr");function l(h){for(let m=0;m<h.length;m++){if(r(h,m))return true}return false}o(l,"IsPrecedenceAnd");function c(h){let[m,g]=[0,0];const y=[];for(let w=0;w<h.length;w++){if(r(h,w))m+=1;if(n(h,w))m-=1;if(i(h,w)&&m===0){const E=h.slice(g,w);if(E.length>0)y.push(p(E));g=w+1}}const v=h.slice(g);if(v.length>0)y.push(p(v));if(y.length===0)return{type:"const",const:""};if(y.length===1)return y[0];return{type:"or",expr:y}}o(c,"Or");function d(h){function m(v,w){if(!r(v,w))throw new cb(`TemplateLiteralParser: Index must point to open parens`);let E=0;for(let b=w;b<v.length;b++){if(r(v,b))E+=1;if(n(v,b))E-=1;if(E===0)return[w,b]}throw new cb(`TemplateLiteralParser: Unclosed group parens in expression`)}o(m,"Group");function g(v,w){for(let E=w;E<v.length;E++){if(r(v,E))return[w,E]}return[w,v.length]}o(g,"Range");const y=[];for(let v=0;v<h.length;v++){if(r(h,v)){const[w,E]=m(h,v);const b=h.slice(w,E+1);y.push(p(b));v=E}else{const[w,E]=g(h,v);const b=h.slice(w,E);if(b.length>0)y.push(p(b));v=E-1}}return y.length===0?{type:"const",const:""}:y.length===1?y[0]:{type:"and",expr:y}}o(d,"And");function p(h){return s(h)?p(a(h)):u(h)?c(h):l(h)?d(h):{type:"const",const:h}}o(p,"Parse");t.Parse=p;function f(h){return p(h.slice(1,h.length-1))}o(f,"ParseExact");t.ParseExact=f})(Wy||(G.TemplateLiteralParser=Wy={}));var Ix=class extends Du{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Ix;var Jy;(function(t){function e(a){throw new Ix(a)}o(e,"Throw");function r(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="0"&&a.expr[1].type==="const"&&a.expr[1].const==="[1-9][0-9]*"}o(r,"IsNumber");function n(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="true"&&a.expr[1].type==="const"&&a.expr[1].const==="false"}o(n,"IsBoolean");function i(a){return a.type==="const"&&a.const===".*"}o(i,"IsString");function s(a){return n(a)?true:r(a)||i(a)?false:a.type==="and"?a.expr.every(u=>s(u)):a.type==="or"?a.expr.every(u=>s(u)):a.type==="const"?true:e(`Unknown expression type`)}o(s,"Check");t.Check=s})(Jy||(G.TemplateLiteralFinite=Jy={}));var Px=class extends Du{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Px;var Qy;(function(t){function*e(a){if(a.length===1)return yield*a[0];for(const u of a[0]){for(const l of e(a.slice(1))){yield`${u}${l}`}}}o(e,"Reduce");function*r(a){return yield*e(a.expr.map(u=>[...s(u)]))}o(r,"And");function*n(a){for(const u of a.expr)yield*s(u)}o(n,"Or");function*i(a){return yield a.const}o(i,"Const");function*s(a){return a.type==="and"?yield*r(a):a.type==="or"?yield*n(a):a.type==="const"?yield*i(a):(()=>{throw new Px("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Qy||(G.TemplateLiteralGenerator=Qy={}));var tY;(function(t){function*e(s){const a=s.trim().replace(/"|'/g,"");return a==="boolean"?yield G.Type.Boolean():a==="number"?yield G.Type.Number():a==="bigint"?yield G.Type.BigInt():a==="string"?yield G.Type.String():yield(()=>{const u=a.split("|").map(l=>G.Type.Literal(l.trim()));return u.length===0?G.Type.Never():u.length===1?u[0]:G.Type.Union(u)})()}o(e,"ParseUnion");function*r(s){if(s[1]!=="{"){const a=G.Type.Literal("$");const u=n(s.slice(1));return yield*[a,...u]}for(let a=2;a<s.length;a++){if(s[a]==="}"){const u=e(s.slice(2,a));const l=n(s.slice(a+1));return yield*[...u,...l]}}yield G.Type.Literal(s)}o(r,"ParseTerminal");function*n(s){for(let a=0;a<s.length;a++){if(s[a]==="$"){const u=G.Type.Literal(s.slice(0,a));const l=r(s.slice(a));return yield*[u,...l]}}yield G.Type.Literal(s)}o(n,"ParseLiteral");function i(s){return[...n(s)]}o(i,"Parse");t.Parse=i})(tY||(G.TemplateLiteralDslParser=tY={}));var Dx=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new kx(this.schema,e)}};G.TransformDecodeBuilder=Dx;var kx=class{static{o(this,"TransformEncodeBuilder")}constructor(e,r){this.schema=e;this.decode=r}Encode(e){const r=ct.Type(this.schema);return Y.TTransform(r)?(()=>{const n=o(a=>r[G.Transform].Encode(e(a)),"Encode");const i=o(a=>this.decode(r[G.Transform].Decode(a)),"Decode");const s={Encode:n,Decode:i};return{...r,[G.Transform]:s}})():(()=>{const n={Decode:this.decode,Encode:e};return{...r,[G.Transform]:n}})()}};G.TransformEncodeBuilder=kx;var T$t=0;var $x=class extends Du{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=$x;var Lx=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new $x(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=Lx;var db=class extends Lx{static{o(this,"JsonTypeBuilder")}ReadonlyOptional(e){return this.Readonly(this.Optional(e))}Readonly(e){return{...ct.Type(e),[G.Readonly]:"Readonly"}}Optional(e){return{...ct.Type(e),[G.Optional]:"Optional"}}Any(e={}){return this.Create({...e,[G.Kind]:"Any"})}Array(e,r={}){return this.Create({...r,[G.Kind]:"Array",type:"array",items:ct.Type(e)})}Boolean(e={}){return this.Create({...e,[G.Kind]:"Boolean",type:"boolean"})}Capitalize(e,r={}){return{...Ky.Map(ct.Type(e),"Capitalize"),...r}}Composite(e,r){const n=G.Type.Intersect(e,{});const i=Cx.ResolveKeys(n,{includePatterns:false});const s=i.reduce((a,u)=>({...a,[u]:G.Type.Index(n,[u])}),{});return G.Type.Object(s,r)}Enum(e,r={}){const n=Object.getOwnPropertyNames(e).filter(s=>isNaN(s)).map(s=>e[s]);const i=n.map(s=>Me.IsString(s)?{[G.Kind]:"Literal",type:"string",const:s}:{[G.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[G.Kind]:"Union",anyOf:i})}Extends(e,r,n,i,s={}){switch(Lm.Extends(e,r)){case Ee.Union:return this.Union([ct.Type(n,s),ct.Type(i,s)]);case Ee.True:return ct.Type(n,s);case Ee.False:return ct.Type(i,s)}}Exclude(e,r,n={}){return Y.TTemplateLiteral(e)?this.Exclude(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.Extends(e,r)!==Ee.False?ct.Type(e,n):this.Never(n)}Index(e,r,n={}){return Y.TArray(e)&&Y.TNumber(r)?(()=>{return ct.Type(e.items,n)})():Y.TTuple(e)&&Y.TNumber(r)?(()=>{const i=Me.IsUndefined(e.items)?[]:e.items;const s=i.map(a=>ct.Type(a));return this.Union(s,n)})():(()=>{const i=lb.Resolve(r);const s=ct.Type(e);return ZK.Resolve(s,i,n)})()}Integer(e={}){return this.Create({...e,[G.Kind]:"Integer",type:"integer"})}Intersect(e,r={}){if(e.length===0)return G.Type.Never();if(e.length===1)return ct.Type(e[0],r);if(e.some(a=>Y.TTransform(a)))this.Throw("Cannot intersect transform types");const n=e.every(a=>Y.TObject(a));const i=ct.Rest(e);const s=Y.TSchema(r.unevaluatedProperties)?{unevaluatedProperties:ct.Type(r.unevaluatedProperties)}:{};return r.unevaluatedProperties===false||Y.TSchema(r.unevaluatedProperties)||n?this.Create({...r,...s,[G.Kind]:"Intersect",type:"object",allOf:i}):this.Create({...r,...s,[G.Kind]:"Intersect",allOf:i})}KeyOf(e,r={}){return Y.TRecord(e)?(()=>{const n=Object.getOwnPropertyNames(e.patternProperties)[0];return n===G.PatternNumberExact?this.Number(r):n===G.PatternStringExact?this.String(r):this.Throw("Unable to resolve key type from Record key pattern")})():Y.TTuple(e)?(()=>{const n=Me.IsUndefined(e.items)?[]:e.items;const i=n.map((s,a)=>G.Type.Literal(a.toString()));return this.Union(i,r)})():Y.TArray(e)?(()=>{return this.Number(r)})():(()=>{const n=Cx.ResolveKeys(e,{includePatterns:false});if(n.length===0)return this.Never(r);const i=n.map(s=>this.Literal(s));return this.Union(i,r)})()}Literal(e,r={}){return this.Create({...r,[G.Kind]:"Literal",const:e,type:typeof e})}Lowercase(e,r={}){return{...Ky.Map(ct.Type(e),"Lowercase"),...r}}Never(e={}){return this.Create({...e,[G.Kind]:"Never",not:{}})}Not(e,r){return this.Create({...r,[G.Kind]:"Not",not:ct.Type(e)})}Null(e={}){return this.Create({...e,[G.Kind]:"Null",type:"null"})}Number(e={}){return this.Create({...e,[G.Kind]:"Number",type:"number"})}Object(e,r={}){const n=Object.getOwnPropertyNames(e);const i=n.filter(l=>Y.TOptional(e[l]));const s=n.filter(l=>!i.includes(l));const a=Y.TSchema(r.additionalProperties)?{additionalProperties:ct.Type(r.additionalProperties)}:{};const u=n.reduce((l,c)=>({...l,[c]:ct.Type(e[c])}),{});return s.length>0?this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u,required:s}):this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u})}Omit(e,r,n={}){const i=lb.Resolve(r);return Yy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.IsArray(s.required)){s.required=s.required.filter(a=>!i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Partial(e,r={}){return Yy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Optional(n.properties[a])}},{});return this.Object(i,this.Discard(n,"required"))},r)}Pick(e,r,n={}){const i=lb.Resolve(r);return Yy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.IsArray(s.required)){s.required=s.required.filter(a=>i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(!i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Record(e,r,n={}){return Y.TTemplateLiteral(e)?(()=>{const i=Wy.ParseExact(e.pattern);return Jy.Check(i)?this.Object([...Qy.Generate(i)].reduce((s,a)=>({...s,[a]:ct.Type(r)}),{}),n):this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[e.pattern]:ct.Type(r)}})})():Y.TUnion(e)?(()=>{const i=eY.Resolve(e);if(Y.TUnionLiteral(i)){const s=i.anyOf.reduce((a,u)=>({...a,[u.const]:ct.Type(r)}),{});return this.Object(s,{...n,[G.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():Y.TLiteral(e)?(()=>{return Me.IsString(e.const)||Me.IsNumber(e.const)?this.Object({[e.const]:ct.Type(r)},n):this.Throw("Record key of type literal is not of type string or number")})():Y.TInteger(e)||Y.TNumber(e)?(()=>{return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[G.PatternNumberExact]:ct.Type(r)}})})():Y.TString(e)?(()=>{const i=Me.IsUndefined(e.pattern)?G.PatternStringExact:e.pattern;return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[i]:ct.Type(r)}})})():this.Never()}Recursive(e,r={}){if(Me.IsUndefined(r.$id))r.$id=`T${T$t++}`;const n=e({[G.Kind]:"This",$ref:`${r.$id}`});n.$id=r.$id;return this.Create({...r,[G.Hint]:"Recursive",...n})}Ref(e,r={}){if(Me.IsString(e))return this.Create({...r,[G.Kind]:"Ref",$ref:e});if(Me.IsUndefined(e.$id))this.Throw("Reference target type must specify an $id");return this.Create({...r,[G.Kind]:"Ref",$ref:e.$id})}Required(e,r={}){return Yy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Discard(n.properties[a],G.Optional)}},{});return this.Object(i,n)},r)}Rest(e){return Y.TTuple(e)&&!Me.IsUndefined(e.items)?ct.Rest(e.items):Y.TIntersect(e)?ct.Rest(e.allOf):Y.TUnion(e)?ct.Rest(e.anyOf):[]}String(e={}){return this.Create({...e,[G.Kind]:"String",type:"string"})}TemplateLiteral(e,r={}){const n=Me.IsString(e)?Nx.Create(tY.Parse(e)):Nx.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Dx(e)}Tuple(e,r={}){const[n,i,s]=[false,e.length,e.length];const a=ct.Rest(e);const u=e.length>0?{...r,[G.Kind]:"Tuple",type:"array",items:a,additionalItems:n,minItems:i,maxItems:s}:{...r,[G.Kind]:"Tuple",type:"array",minItems:i,maxItems:s};return this.Create(u)}Uncapitalize(e,r={}){return{...Ky.Map(ct.Type(e),"Uncapitalize"),...r}}Union(e,r={}){return Y.TTemplateLiteral(e)?rd.Resolve(e):(()=>{const n=e;if(n.length===0)return this.Never(r);if(n.length===1)return this.Create(ct.Type(n[0],r));const i=ct.Rest(n);return this.Create({...r,[G.Kind]:"Union",anyOf:i})})()}Unknown(e={}){return this.Create({...e,[G.Kind]:"Unknown"})}Unsafe(e={}){return this.Create({...e,[G.Kind]:e[G.Kind]||"Unsafe"})}Uppercase(e,r={}){return{...Ky.Map(ct.Type(e),"Uppercase"),...r}}};G.JsonTypeBuilder=db;var qx=class extends db{static{o(this,"JavaScriptTypeBuilder")}AsyncIterator(e,r={}){return this.Create({...r,[G.Kind]:"AsyncIterator",type:"AsyncIterator",items:ct.Type(e)})}Awaited(e,r={}){const n=o(i=>i.length>0?(()=>{const[s,...a]=i;return[this.Awaited(s),...n(a)]})():i,"Unwrap");return Y.TIntersect(e)?G.Type.Intersect(n(e.allOf)):Y.TUnion(e)?G.Type.Union(n(e.anyOf)):Y.TPromise(e)?this.Awaited(e.item):ct.Type(e,r)}BigInt(e={}){return this.Create({...e,[G.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(e,r={}){return this.Tuple([...e.parameters],{...r})}Constructor(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Constructor",type:"constructor",parameters:i,returns:s})}Date(e={}){return this.Create({...e,[G.Kind]:"Date",type:"Date"})}Function(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Function",type:"function",parameters:i,returns:s})}InstanceType(e,r={}){return ct.Type(e.returns,r)}Iterator(e,r={}){return this.Create({...r,[G.Kind]:"Iterator",type:"Iterator",items:ct.Type(e)})}Parameters(e,r={}){return this.Tuple(e.parameters,{...r})}Promise(e,r={}){return this.Create({...r,[G.Kind]:"Promise",type:"Promise",item:ct.Type(e)})}RegExp(e,r={}){const n=Me.IsString(e)?e:e.source;return this.Create({...r,[G.Kind]:"String",type:"string",pattern:n})}RegEx(e,r={}){return this.RegExp(e,r)}ReturnType(e,r={}){return ct.Type(e.returns,r)}Symbol(e){return this.Create({...e,[G.Kind]:"Symbol",type:"symbol"})}Undefined(e={}){return this.Create({...e,[G.Kind]:"Undefined",type:"undefined"})}Uint8Array(e={}){return this.Create({...e,[G.Kind]:"Uint8Array",type:"Uint8Array"})}Void(e={}){return this.Create({...e,[G.Kind]:"Void",type:"void"})}};G.JavaScriptTypeBuilder=qx;G.JsonType=new db;G.Type=new qx});var hAe=_(jx=>{"use strict";Object.defineProperty(jx,"__esModule",{value:true});jx.CustomTypeBuilder=void 0;var pb=fAe();var rY=class extends pb.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return pb.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return pb.Type.Union([e,pb.Type.Null()])}static StringEnum(e){return pb.Type.Unsafe({type:"string",enum:e})}};jx.CustomTypeBuilder=rY});var vAe=_(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:true});lt.throwIfNotNumber=lt.throwIfNotString=lt.throwIfUndefinedOrNull=lt.throwIfUndefined=lt.ArgumentTypeError=lt.ArgumentUndefinedError=lt.ValidationError=lt.withUndefinedAsNull=lt.withNullAsUndefined=lt.validateConstraint=lt.validateConstraints=lt.areFunctions=lt.isFunction=lt.isEmptyObject=lt.assertAllDefined=lt.assertIsDefined=lt.assertType=lt.isUndefinedOrNull=lt.isDefined=lt.isUndefined=lt.isBoolean=lt.isIterable=lt.isNumber=lt.isTypedArray=lt.isObject=lt.isStringArray=lt.isString=void 0;function Ux(t){return typeof t==="string"}o(Ux,"isString");lt.isString=Ux;function A$t(t){return Array.isArray(t)&&t.every(e=>Ux(e))}o(A$t,"isStringArray");lt.isStringArray=A$t;function mAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(mAe,"isObject");lt.isObject=mAe;function x$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(x$t,"isTypedArray");lt.isTypedArray=x$t;function gAe(t){return typeof t==="number"&&!isNaN(t)}o(gAe,"isNumber");lt.isNumber=gAe;function C$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(C$t,"isIterable");lt.isIterable=C$t;function R$t(t){return t===true||t===false}o(R$t,"isBoolean");lt.isBoolean=R$t;function nY(t){return typeof t==="undefined"}o(nY,"isUndefined");lt.isUndefined=nY;function O$t(t){return!Xy(t)}o(O$t,"isDefined");lt.isDefined=O$t;function Xy(t){return nY(t)||t===null}o(Xy,"isUndefinedOrNull");lt.isUndefinedOrNull=Xy;function N$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(N$t,"assertType");lt.assertType=N$t;function I$t(t){if(Xy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(I$t,"assertIsDefined");lt.assertIsDefined=I$t;function P$t(...t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(Xy(n)){throw new Error(`Assertion Failed: argument at index ${r} is undefined or null`)}e.push(n)}return e}o(P$t,"assertAllDefined");lt.assertAllDefined=P$t;var D$t=Object.prototype.hasOwnProperty;function k$t(t){if(!mAe(t)){return false}for(const e in t){if(D$t.call(t,e)){return false}}return true}o(k$t,"isEmptyObject");lt.isEmptyObject=k$t;function iY(t){return typeof t==="function"}o(iY,"isFunction");lt.isFunction=iY;function $$t(...t){return t.length>0&&t.every(iY)}o($$t,"areFunctions");lt.areFunctions=$$t;function L$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){yAe(t[n],e[n])}}o(L$t,"validateConstraints");lt.validateConstraints=L$t;function yAe(t,e){if(Ux(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(iY(e)){try{if(t instanceof e){return}}catch{}if(!Xy(t)&&t.constructor===e){return}if(e.length===1&&e.call(void 0,t)===true){return}throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`)}}o(yAe,"validateConstraint");lt.validateConstraint=yAe;function q$t(t){return t===null?void 0:t}o(q$t,"withNullAsUndefined");lt.withNullAsUndefined=q$t;function j$t(t){return typeof t==="undefined"?null:t}o(j$t,"withUndefinedAsNull");lt.withUndefinedAsNull=j$t;var fb=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=fb;var hb=class extends fb{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=hb;var mb=class extends fb{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=mb;function U$t(t,e){if(nY(t)){throw new hb(e)}return true}o(U$t,"throwIfUndefined");lt.throwIfUndefined=U$t;function sY(t,e){if(Xy(t)){throw new hb(e)}}o(sY,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=sY;function F$t(t,e){sY(t,e);if(!Ux(t)){throw new mb(e,"string")}return true}o(F$t,"throwIfNotString");lt.throwIfNotString=F$t;function B$t(t,e){sY(t,e);if(!gAe(t)){throw new mb(e,"number")}return true}o(B$t,"throwIfNotNumber");lt.throwIfNotNumber=B$t});var yb=_(xe=>{"use strict";var _Ae=xe&&xe.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var M$t=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Fx=xe&&xe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null){for(var r in t)if(r!=="default"&&Object.prototype.hasOwnProperty.call(t,r))_Ae(e,t,r)}M$t(e,t);return e};var vf=xe&&xe.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))_Ae(e,t,r)};Object.defineProperty(xe,"__esModule",{value:true});xe.getRequiredEnvVar=xe.env=xe.EnvironmentalVariableRequiredError=xe.xfs=xe.RouteValidator=xe.JsonValidator=xe.TenantService=xe.OpenFGAService=xe.DevApiService=xe.getContentApiStorageTarballPath=xe.contentApiTarballFileName=xe.ContentApiService=xe.AuthApiService=xe.getServiceAccountIdToken=xe.createApiKeyServiceClient=xe.ApiKeyService=xe.RouteVersions=xe.startsWithReservedKeyword=xe.logger=xe.createNewLogger=xe.graphQL=xe.CloudStorage=xe.fly=xe.ApiServer=xe.featureFlagsPlugin=xe.ensureZuploUserPlugin=xe.ensureZuploAdminPlugin=xe.ensureServiceAccountPlugin=xe.apiKeyAuthPlugin=xe.errorHandler=xe.DeploymentLogState=xe.signString=xe.FeatureFlags=xe.VALID_COMPATIBILITY_DATES=xe.DEFAULT_COMPATIBILITY_DATE=xe.COMPATIBILITY_FLAG_MAPPINGS=xe.WARNING_STATUS=xe.WARNING_SEVERITY=xe.GOOD_STATUS=xe.FAILURE_STATUS=xe.ERROR_SEVERITY=xe.BuildIssueError=xe.hasBlockedNotifications=xe.getDefaultFlags=xe.getBuildFlagsForDeployment=xe.CommonAuth=void 0;var aY=Fx(za());xe.env=aY.default;Object.defineProperty(xe,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return aY.EnvironmentalVariableRequiredError}});Object.defineProperty(xe,"getRequiredEnvVar",{enumerable:true,get:function(){return aY.getRequiredEnvVar}});vf(As(),xe);var V$t=tC();Object.defineProperty(xe,"CommonAuth",{enumerable:true,get:function(){return V$t.CommonAuth}});var oY=qY();Object.defineProperty(xe,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return oY.getBuildFlagsForDeployment}});Object.defineProperty(xe,"getDefaultFlags",{enumerable:true,get:function(){return oY.getDefaultFlags}});Object.defineProperty(xe,"hasBlockedNotifications",{enumerable:true,get:function(){return oY.hasBlockedNotifications}});var Zy=jY();Object.defineProperty(xe,"BuildIssueError",{enumerable:true,get:function(){return Zy.BuildIssueError}});Object.defineProperty(xe,"ERROR_SEVERITY",{enumerable:true,get:function(){return Zy.ERROR_SEVERITY}});Object.defineProperty(xe,"FAILURE_STATUS",{enumerable:true,get:function(){return Zy.FAILURE_STATUS}});Object.defineProperty(xe,"GOOD_STATUS",{enumerable:true,get:function(){return Zy.GOOD_STATUS}});Object.defineProperty(xe,"WARNING_SEVERITY",{enumerable:true,get:function(){return Zy.WARNING_SEVERITY}});Object.defineProperty(xe,"WARNING_STATUS",{enumerable:true,get:function(){return Zy.WARNING_STATUS}});var H$t=UY();Object.defineProperty(xe,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return H$t.COMPATIBILITY_FLAG_MAPPINGS}});var EAe=MY();Object.defineProperty(xe,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return EAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(xe,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return EAe.VALID_COMPATIBILITY_DATES}});var z$t=rC();Object.defineProperty(xe,"FeatureFlags",{enumerable:true,get:function(){return z$t.FeatureFlags}});var G$t=VY();Object.defineProperty(xe,"signString",{enumerable:true,get:function(){return G$t.signString}});vf(HY(),xe);var K$t=sC();Object.defineProperty(xe,"DeploymentLogState",{enumerable:true,get:function(){return K$t.DeploymentLogState}});vf(XY(),xe);vf(aC(),xe);var Y$t=oC();Object.defineProperty(xe,"errorHandler",{enumerable:true,get:function(){return Y$t.errorHandler}});var gb=pC();Object.defineProperty(xe,"apiKeyAuthPlugin",{enumerable:true,get:function(){return gb.apiKeyAuthPlugin}});Object.defineProperty(xe,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return gb.ensureServiceAccountPlugin}});Object.defineProperty(xe,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return gb.ensureZuploAdminPlugin}});Object.defineProperty(xe,"ensureZuploUserPlugin",{enumerable:true,get:function(){return gb.ensureZuploUserPlugin}});Object.defineProperty(xe,"featureFlagsPlugin",{enumerable:true,get:function(){return gb.featureFlagsPlugin}});var W$t=lge();Object.defineProperty(xe,"ApiServer",{enumerable:true,get:function(){return W$t.ApiServer}});xe.fly=Fx(pge());xe.CloudStorage=Fx(ebe());var J$t=tbe();Object.defineProperty(xe,"graphQL",{enumerable:true,get:function(){return J$t.graphQL}});vf(A5e(),xe);var bAe=Ej();Object.defineProperty(xe,"createNewLogger",{enumerable:true,get:function(){return bAe.createNewLogger}});Object.defineProperty(xe,"logger",{enumerable:true,get:function(){return bAe.logger}});var Q$t=cH();Object.defineProperty(xe,"startsWithReservedKeyword",{enumerable:true,get:function(){return Q$t.startsWithReservedKeyword}});var X$t=x5e();Object.defineProperty(xe,"RouteVersions",{enumerable:true,get:function(){return X$t.RouteVersions}});var wAe=JSe();Object.defineProperty(xe,"ApiKeyService",{enumerable:true,get:function(){return wAe.ApiKeyService}});Object.defineProperty(xe,"createApiKeyServiceClient",{enumerable:true,get:function(){return wAe.createApiKeyServiceClient}});var Z$t=Ry();Object.defineProperty(xe,"getServiceAccountIdToken",{enumerable:true,get:function(){return Z$t.getServiceAccountIdToken}});var eLt=XSe();Object.defineProperty(xe,"AuthApiService",{enumerable:true,get:function(){return eLt.AuthApiService}});var uY=rTe();Object.defineProperty(xe,"ContentApiService",{enumerable:true,get:function(){return uY.ContentApiService}});Object.defineProperty(xe,"contentApiTarballFileName",{enumerable:true,get:function(){return uY.contentApiTarballFileName}});Object.defineProperty(xe,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return uY.getContentApiStorageTarballPath}});var tLt=sTe();Object.defineProperty(xe,"DevApiService",{enumerable:true,get:function(){return tLt.DevApiService}});var rLt=aAe();Object.defineProperty(xe,"OpenFGAService",{enumerable:true,get:function(){return rLt.OpenFGAService}});var nLt=lAe();Object.defineProperty(xe,"TenantService",{enumerable:true,get:function(){return nLt.TenantService}});vf(cAe(),xe);vf(hAe(),xe);vf(vAe(),xe);var iLt=N7();Object.defineProperty(xe,"JsonValidator",{enumerable:true,get:function(){return iLt.JsonValidator}});var sLt=gH();Object.defineProperty(xe,"RouteValidator",{enumerable:true,get:function(){return sLt.RouteValidator}});xe.xfs=Fx(hM())});var vb=_(e2=>{"use strict";Object.defineProperty(e2,"__esModule",{value:true});e2.runPlugins=e2.PluginResult=void 0;var lY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};e2.PluginResult=lY;async function aLt(t,e){const r=[];const n=[];const i=new Map;for await(const s of t){try{const a=await s(e,i);n.push(...a.errors.map(u=>{if(u.pluginName===""){u.pluginName=s.name}return u}));r.push(...a.warnings);if(a.errors.length>0){break}}catch(a){n.push(a);break}}return{errors:n,warnings:r}}o(aLt,"runPlugins");e2.runPlugins=aLt});var TAe=_((Wmr,SAe)=>{"use strict";function oLt(t){return t>=55296&&t<=56319}o(oLt,"isHighSurrogate");function uLt(t){return t>=56320&&t<=57343}o(uLt,"isLowSurrogate");SAe.exports=o(function t(e,r,n){if(typeof r!=="string"){throw new Error("Input must be string")}var i=r.length;var s=0;var a;var u;for(var l=0;l<i;l+=1){a=r.charCodeAt(l);u=r[l];if(oLt(a)&&uLt(r.charCodeAt(l+1))){l+=1;u+=r[l]}s+=e(u);if(s===n){return r.slice(0,l+1)}else if(s>n){return r.slice(0,l-u.length+1)}}return r},"truncate")});var xAe=_((Qmr,AAe)=>{"use strict";var lLt=TAe();var cLt=Buffer.byteLength.bind(Buffer);AAe.exports=lLt.bind(null,cLt)});var CAe=_(t2=>{"use strict";var dLt=t2&&t2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(t2,"__esModule",{value:true});t2.sanitize=void 0;var pLt=dLt(xAe());var fLt=/[/?<>\\:*|"]/g;var hLt=/[\x00-\x1f\x80-\x9f]/g;var mLt=/^\.+$/;var gLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var yLt=/[. ]+$/;function vLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(fLt,e).replace(hLt,e).replace(mLt,e).replace(gLt,e).replace(yLt,e);return(0,pLt.default)(r,255)}o(vLt,"sanitize");t2.sanitize=vLt});var Gl=_(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:true});Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.NODE_BUILD_OUTPUT_FILE=Fe.NODE_ENTRY_NAME=Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE=Fe.WORKER_BUILD_OUTPUT_FILE=Fe.WORKER_ENTRY_NAME=Fe.ENV_MODULE_FILE=Fe.ZUPLO_SYSTEM_ENV_FILE=Fe.ENV_FILE=Fe.CACHE_DIRECTORY=Fe.BUILD_CACHE_FILE=Fe.ZUPLO_FILE_SCHEMA=Fe.NON_STANDARD_NODE_ENV=Fe.GENERATED_TYPES_DIR_NAME=Fe.GENERATED_BUILD_JSON_FILE=Fe.GENERATED_SOURCE_DIR_NAME=Fe.BUILD_OUTPUT_DIR=Fe.DEFAULT_TEST_FILE=Fe.DEFAULT_DOCS_MARKDOWN_FILE=Fe.DOCS_THEME_FILE=Fe.DOCS_SIDEBAR_FILE=Fe.ZUPLO_FALLBACK_JSON_FILE=Fe.ZUPLO_PREFERRED_JSON_FILE=Fe.DEFAULT_MODULE_FILE=Fe.OPEN_API_FILE_SUFFIX=Fe.OPEN_API_CONFIG_FILE=Fe.OPEN_API_UNVERSIONED_DIR_NAME=Fe.DEV_PORTAL_OUTPUT_DIR_NAME=Fe.DEV_PORTAL_CONFIG_FILE=Fe.POLICIES_CONFIG_FILE=Fe.ROUTES_OAS_CONFIG_FILE=Fe.LOCAL_API_KEYS_CONFIG_FILE=Fe.DEV_PORTAL_V4_PATH=Fe.USER_DOCS_DIR_NAME=Fe.USER_SCHEMAS_DIR_NAME=Fe.USER_CONFIG_DIR_NAME=Fe.USER_TEST_DIR_NAME=Fe.USER_MODULES_DIR_NAME=void 0;Fe.USER_MODULES_DIR_NAME="modules";Fe.USER_TEST_DIR_NAME="tests";Fe.USER_CONFIG_DIR_NAME="config";Fe.USER_SCHEMAS_DIR_NAME="schemas";Fe.USER_DOCS_DIR_NAME="docs";Fe.DEV_PORTAL_V4_PATH="v4";Fe.LOCAL_API_KEYS_CONFIG_FILE="api-keys.json";Fe.ROUTES_OAS_CONFIG_FILE="routes.oas.json";Fe.POLICIES_CONFIG_FILE="policies.json";Fe.DEV_PORTAL_CONFIG_FILE="dev-portal.json";Fe.DEV_PORTAL_OUTPUT_DIR_NAME="dev-portal";Fe.OPEN_API_UNVERSIONED_DIR_NAME="unversioned";Fe.OPEN_API_CONFIG_FILE="open-api.json";Fe.OPEN_API_FILE_SUFFIX=".oas.json";Fe.DEFAULT_MODULE_FILE="hello-world.ts";Fe.ZUPLO_PREFERRED_JSON_FILE="zuplo.jsonc";Fe.ZUPLO_FALLBACK_JSON_FILE="zuplo.json";Fe.DOCS_SIDEBAR_FILE="sidebar.json";Fe.DOCS_THEME_FILE="theme.css";Fe.DEFAULT_DOCS_MARKDOWN_FILE="index.md";Fe.DEFAULT_TEST_FILE="hello-world.json";Fe.BUILD_OUTPUT_DIR="dist";Fe.GENERATED_SOURCE_DIR_NAME=".zuplo";Fe.GENERATED_BUILD_JSON_FILE="build.json";Fe.GENERATED_TYPES_DIR_NAME="types";Fe.NON_STANDARD_NODE_ENV=`You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against.`;Fe.ZUPLO_FILE_SCHEMA="zuplo";Fe.BUILD_CACHE_FILE="buildstate.json";Fe.CACHE_DIRECTORY=".cache";Fe.ENV_FILE=".env";Fe.ZUPLO_SYSTEM_ENV_FILE=".env.zuplo";Fe.ENV_MODULE_FILE="environment.ts";Fe.WORKER_ENTRY_NAME="worker.ts";Fe.WORKER_BUILD_OUTPUT_FILE="worker.js";Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE="worker.js.map";Fe.NODE_ENTRY_NAME="server.ts";Fe.NODE_BUILD_OUTPUT_FILE="main.js";Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.OPEN_API_CONFIG_FILE});var IAe=_(r2=>{"use strict";var NAe=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.createProjectDirs=void 0;var RAe=NAe(require("fs/promises"));var _Lt=NAe(require("path"));var _b=Gl();var OAe=vb();var ELt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[_b.USER_MODULES_DIR_NAME,_b.USER_CONFIG_DIR_NAME,_b.USER_TEST_DIR_NAME,_b.USER_SCHEMAS_DIR_NAME,_b.USER_DOCS_DIR_NAME,".vscode"];try{await RAe.default.mkdir(t);for(const n of r){await RAe.default.mkdir(_Lt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new OAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new OAe.PluginResult},"createProjectDirs");r2.createProjectDirs=ELt});var PAe=_(dY=>{"use strict";Object.defineProperty(dY,"__esModule",{value:true});var Bx=require("perf_hooks");var cY=[];async function bLt(t,e){const r=Bx.performance.timerify(e);const n=new Bx.PerformanceObserver(i=>{const s=i.getEntries()[0];cY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(bLt,"timeFn");var wLt={mark:t=>{Bx.performance.mark(t)},measure:(t,e,r)=>{Bx.performance.measure(t,e,r)},timeFn:bLt,report:()=>{if(cY.length>0){console.table(cY)}}};dY.default=wLt});var LAe=_(n2=>{"use strict";var $Ae=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.generateFromTemplate=void 0;var SLt=require("fs");var DAe=$Ae(require("fs/promises"));var kAe=$Ae(require("path"));async function TLt(t){const e=kAe.default.resolve(__dirname,"..","templates",t);if((0,SLt.existsSync)(e)){const r=await DAe.default.readFile(e,"utf-8");return r}else{const r=kAe.default.resolve(__dirname,"templates",t);const n=await DAe.default.readFile(r,"utf-8");return n}}o(TLt,"generateFromTemplate");n2.generateFromTemplate=TLt});var Ca=_(i2=>{"use strict";var pY=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFileFromTemplate=void 0;var ALt=yb();var xLt=pY(require("fs/promises"));var CLt=pY(require("path"));var RLt=pY(PAe());var OLt=LAe();var NLt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return RLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=CLt.default.join(r,t);if(await ALt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return ILt(i,e,n)})}},"generateFileFromTemplate");i2.generateFileFromTemplate=NLt;async function ILt(t,e,r){const n=await(0,OLt.generateFromTemplate)(e);try{await xLt.default.writeFile(t,n,"utf-8");r.debug(`File written to ${t}`)}catch(i){r.error(i);const s={message:`Error creating file at ${t}`,pluginName:"generate-file",severity:"error"};return{warnings:[],errors:[s]}}return{warnings:[],errors:[]}}o(ILt,"writeTemplate")});var jAe=_(s2=>{"use strict";var PLt=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateDefaultDocsMarkdown=void 0;var DLt=PLt(require("path"));var qAe=Gl();var kLt=Ca();s2.generateDefaultDocsMarkdown=(0,kLt.generateFileFromTemplate)(DLt.default.join(qAe.USER_DOCS_DIR_NAME,qAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var FAe=_(a2=>{"use strict";var $Lt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsSidebar=void 0;var LLt=$Lt(require("path"));var UAe=Gl();var qLt=Ca();a2.generateDefaultDocsSidebar=(0,qLt.generateFileFromTemplate)(LLt.default.join(UAe.USER_DOCS_DIR_NAME,UAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var MAe=_(o2=>{"use strict";var jLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsTheme=void 0;var ULt=jLt(require("path"));var BAe=Gl();var FLt=Ca();o2.generateDefaultDocsTheme=(0,FLt.generateFileFromTemplate)(ULt.default.join(BAe.USER_DOCS_DIR_NAME,BAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var HAe=_(u2=>{"use strict";var BLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultModule=void 0;var MLt=BLt(require("path"));var VAe=Gl();var VLt=Ca();u2.generateDefaultModule=(0,VLt.generateFileFromTemplate)(MLt.default.join(VAe.USER_MODULES_DIR_NAME,VAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var GAe=_(l2=>{"use strict";var HLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDevPortalConfigJson=void 0;var zLt=HLt(require("path"));var zAe=Gl();var GLt=Ca();l2.generateDevPortalConfigJson=(0,GLt.generateFileFromTemplate)(zLt.default.join(zAe.USER_CONFIG_DIR_NAME,zAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var KAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.generateEnvironment=void 0;var KLt=Ca();Mx.generateEnvironment=(0,KLt.generateFileFromTemplate)(".env","env.template")});var YAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generateESLint=void 0;var YLt=Ca();Vx.generateESLint=(0,YLt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var WAe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generateGitignore=void 0;var WLt=Ca();Hx.generateGitignore=(0,WLt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var JAe=_(c2=>{"use strict";var JLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateLaunchJson=void 0;var QLt=JLt(require("path"));var XLt=Ca();c2.generateLaunchJson=(0,XLt.generateFileFromTemplate)(QLt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var QAe=_(d2=>{"use strict";var ZLt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateSettingsJson=void 0;var eqt=ZLt(require("path"));var tqt=Ca();d2.generateSettingsJson=(0,tqt.generateFileFromTemplate)(eqt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var ZAe=_(p2=>{"use strict";var rqt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateRouteOasConfig=void 0;var nqt=rqt(require("path"));var XAe=Gl();var iqt=Ca();p2.generateRouteOasConfig=(0,iqt.generateFileFromTemplate)(nqt.default.join(XAe.USER_CONFIG_DIR_NAME,XAe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var nxe=_(zo=>{"use strict";var exe=zo&&zo.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zo,"__esModule",{value:true});zo.updateProjectPackageJson=zo.getProjectPackageJson=zo.getPackageOverrides=zo.generateDefaultPackageJson=void 0;var sqt=yb();var txe=exe(require("fs/promises"));var fY=exe(require("path"));async function aqt(t,e=sqt.env.USE_MONOREPO_PACKAGES){const r={name:t,version:"1.0.0",author:"",copyright:"",scripts:{dev:"zup dev",test:"zup test"},dependencies:{zuplo:"latest"}};if(e){const n=rxe();r.overrides=n;r.dependencies["@zuplo/runtime"]=n["@zuplo/runtime"];if(r.devDependencies&&"@zuplo/core"in r.devDependencies){r.devDependencies["@zuplo/core"]=n["@zuplo/core"]}if("@zuplo/core"in r.dependencies){r.dependencies["@zuplo/core"]=n["@zuplo/core"]}}return r}o(aqt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=aqt;function rxe(){const t=fY.default.resolve(__dirname,"..","..");return{"@zuplo/core":`file:${t}/core`,"@zuplo/runtime":`file:${t}/runtime`,"@zuplo/debug":`file:${t}/debug`,"@zuplo/errors":`file:${t}/errors`}}o(rxe,"getPackageOverrides");zo.getPackageOverrides=rxe;async function oqt(t){const e=fY.default.join(t,"package.json");const r=await txe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(oqt,"getProjectPackageJson");zo.getProjectPackageJson=oqt;async function uqt(t,e){const r=fY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await txe.default.writeFile(r,n,"utf-8")}o(uqt,"updateProjectPackageJson");zo.updateProjectPackageJson=uqt});var axe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generatePackageJson=void 0;var ixe=nxe();var sxe=vb();var lqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,ixe.generateDefaultPackageJson)(e);try{await(0,ixe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new sxe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new sxe.PluginResult},"generatePackageJson");zx.generatePackageJson=lqt});var uxe=_(f2=>{"use strict";var cqt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generatePoliciesConfig=void 0;var dqt=cqt(require("path"));var oxe=Gl();var pqt=Ca();f2.generatePoliciesConfig=(0,pqt.generateFileFromTemplate)(dqt.default.join(oxe.USER_CONFIG_DIR_NAME,oxe.POLICIES_CONFIG_FILE),"policies.template.json")});var lxe=_(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:true});Gx.generateTSConfig=void 0;var fqt=Ca();Gx.generateTSConfig=(0,fqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var dxe=_(h2=>{"use strict";var hqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generateZuploJson=void 0;var mqt=yb();var gqt=require("fs/promises");var yqt=hqt(require("path"));var vqt=Gl();var cxe=vb();var _qt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:mqt.DEFAULT_COMPATIBILITY_DATE};const i=yqt.default.join(e,vqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,gqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new cxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new cxe.PluginResult},"generateZuploJson");h2.generateZuploJson=_qt});var fxe=_(m2=>{"use strict";var Eqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.create=void 0;var hY=yb();var bqt=require("fs/promises");var wqt=Eqt(require("path"));var Sqt=vb();var pxe=CAe();var Tqt=IAe();var Aqt=jAe();var xqt=FAe();var Cqt=MAe();var Rqt=HAe();var Oqt=GAe();var Nqt=KAe();var Iqt=YAe();var Pqt=WAe();var Dqt=JAe();var kqt=QAe();var $qt=ZAe();var Lqt=axe();var qqt=uxe();var jqt=lxe();var Uqt=dxe();async function Fqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,pxe.sanitize)(t);const s=(0,pxe.sanitize)(e);const a=wqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await hY.xfs.dirExists(a)){throw new hY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:hY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[Tqt.createProjectDirs,$qt.generateRouteOasConfig,Uqt.generateZuploJson,Oqt.generateDevPortalConfigJson,Rqt.generateDefaultModule,xqt.generateDefaultDocsSidebar,Aqt.generateDefaultDocsMarkdown,Cqt.generateDefaultDocsTheme,qqt.generatePoliciesConfig]);l.push(...[jqt.generateTSConfig,Pqt.generateGitignore,Lqt.generatePackageJson,Nqt.generateEnvironment,Iqt.generateESLint,Dqt.generateLaunchJson,kqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,Sqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,bqt.rm)(a,{recursive:true,force:true});const f=c[0];if(f instanceof Error){throw f}else{throw new Error(f.message)}}const p={sourceDirectory:a,projectName:t};return p}o(Fqt,"create");m2.create=Fqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Bqt=fxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Bqt.create}});
|
|
410
|
+
`+await t.crypto.sha256DigestHex(h);const y=await xNt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await H6(t.crypto,y,g);const w=`${RSe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,OSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(CNt,"generateAuthenticationHeaderMap")});var dG=_(jA=>{"use strict";Object.defineProperty(jA,"__esModule",{value:true});jA.AwsClient=void 0;var RNt=NSe();var ONt=lf();var z6=class extends ONt.BaseExternalAccountClient{static{o(this,"AwsClient")}constructor(e,r){super(e,r);this.environmentId=e.credential_source.environment_id;this.regionUrl=e.credential_source.region_url;this.securityCredentialsUrl=e.credential_source.url;this.regionalCredVerificationUrl=e.credential_source.regional_cred_verification_url;this.imdsV2SessionTokenUrl=e.credential_source.imdsv2_session_token_url;this.awsRequestSigner=null;this.region="";this.validateEnvironmentId()}validateEnvironmentId(){var e;const r=(e=this.environmentId)===null||e===void 0?void 0:e.match(/^(aws)(\d+)$/);if(!r||!this.regionalCredVerificationUrl){throw new Error('No valid AWS "credential_source" provided')}else if(parseInt(r[2],10)!==1){throw new Error(`aws version "${r[2]}" is not supported in the current build.`)}}async retrieveSubjectToken(){if(!this.awsRequestSigner){const i={};if(this.shouldUseMetadataServer()&&this.imdsV2SessionTokenUrl){i["x-aws-ec2-metadata-token"]=await this.getImdsV2SessionToken()}this.region=await this.getAwsRegion(i);this.awsRequestSigner=new RNt.AwsRequestSigner(async()=>{if(this.securityCredentialsFromEnv){return this.securityCredentialsFromEnv}const s=await this.getAwsRoleName(i);const a=await this.getAwsSecurityCredentials(s,i);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,token:a.Token}},this.region)}const e=await this.awsRequestSigner.getRequestOptions({url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"});const r=[];const n=Object.assign({"x-goog-cloud-target-resource":this.audience},e.headers);for(const i in n){r.push({key:i,value:n[i]})}return encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:r}))}async getImdsV2SessionToken(){const e={url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};const r=await this.transporter.request(e);return r.data}async getAwsRegion(e){if(this.regionFromEnv){return this.regionFromEnv}if(!this.regionUrl){throw new Error('Unable to determine AWS region due to missing "options.credential_source.region_url"')}const r={url:this.regionUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data.substr(0,n.data.length-1)}async getAwsRoleName(e){if(!this.securityCredentialsUrl){throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"')}const r={url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data}async getAwsSecurityCredentials(e,r){const n=await this.transporter.request({url:`${this.securityCredentialsUrl}/${e}`,responseType:"json",headers:r});return n.data}shouldUseMetadataServer(){return!this.regionFromEnv||!this.securityCredentialsFromEnv}get regionFromEnv(){return process.env["AWS_REGION"]||process.env["AWS_DEFAULT_REGION"]||null}get securityCredentialsFromEnv(){if(process.env["AWS_ACCESS_KEY_ID"]&&process.env["AWS_SECRET_ACCESS_KEY"]){return{accessKeyId:process.env["AWS_ACCESS_KEY_ID"],secretAccessKey:process.env["AWS_SECRET_ACCESS_KEY"],token:process.env["AWS_SESSION_TOKEN"]}}return null}};jA.AwsClient=z6;z6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";z6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var gG=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:true});pi.InvalidSubjectTokenError=pi.InvalidMessageFieldError=pi.InvalidCodeFieldError=pi.InvalidTokenTypeFieldError=pi.InvalidExpirationTimeFieldError=pi.InvalidSuccessFieldError=pi.InvalidVersionFieldError=pi.ExecutableResponseError=pi.ExecutableResponse=void 0;var UA="urn:ietf:params:oauth:token-type:saml2";var pG="urn:ietf:params:oauth:token-type:id_token";var fG="urn:ietf:params:oauth:token-type:jwt";var hG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new FA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new BA("Executable response must contain a 'success' field.")}this.version=e.version;this.success=e.success;if(this.success){this.expirationTime=e.expiration_time;this.tokenType=e.token_type;if(this.tokenType!==UA&&this.tokenType!==pG&&this.tokenType!==fG){throw new MA(`Executable response must contain a 'token_type' field when successful and it must be one of ${pG}, ${fG}, or ${UA}.`)}if(this.tokenType===UA){if(!e.saml_response){throw new G6(`Executable response must contain a 'saml_response' field when token_type=${UA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new G6(`Executable response must contain a 'id_token' field when token_type=${pG} or ${fG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new VA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new HA("Executable response must contain a 'message' field when unsuccessful.")}this.errorCode=e.code;this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};pi.ExecutableResponse=hG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var FA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=FA;var BA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=BA;var mG=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=mG;var MA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=MA;var VA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=VA;var HA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=HA;var G6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=G6});var ISe=_(zA=>{"use strict";Object.defineProperty(zA,"__esModule",{value:true});zA.PluggableAuthHandler=void 0;var NNt=GA();var Om=gG();var INt=require("child_process");var yG=require("fs");var vG=class t{static{o(this,"PluggableAuthHandler")}constructor(e){if(!e.command){throw new Error("No command provided.")}this.commandComponents=t.parseCommand(e.command);this.timeoutMillis=e.timeoutMillis;if(!this.timeoutMillis){throw new Error("No timeoutMillis provided.")}this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((r,n)=>{const i=INt.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}});let s="";i.stdout.on("data",u=>{s+=u});i.stderr.on("data",u=>{s+=u});const a=setTimeout(()=>{i.removeAllListeners();i.kill();return n(new Error("The executable failed to finish within the timeout specified."))},this.timeoutMillis);i.on("close",u=>{clearTimeout(a);if(u===0){try{const l=JSON.parse(s);const c=new Om.ExecutableResponse(l);return r(c)}catch(l){if(l instanceof Om.ExecutableResponseError){return n(l)}return n(new Om.ExecutableResponseError(`The executable returned an invalid response: ${s}`))}}else{return n(new NNt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await yG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await yG.promises.lstat(e)).isFile()){return void 0}const r=await yG.promises.readFile(e,{encoding:"utf8"});if(r===""){return void 0}try{const n=JSON.parse(r);const i=new Om.ExecutableResponse(n);if(i.isValid()){return new Om.ExecutableResponse(n)}return void 0}catch(n){if(n instanceof Om.ExecutableResponseError){throw n}throw new Om.ExecutableResponseError(`The output file contained an invalid response: ${r}`)}}static parseCommand(e){const r=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!r){throw new Error(`Provided command: "${e}" could not be parsed.`)}for(let n=0;n<r.length;n++){if(r[n][0]==='"'&&r[n].slice(-1)==='"'){r[n]=r[n].slice(1,-1)}}return r}};zA.PluggableAuthHandler=vG});var GA=_(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:true});Sy.PluggableAuthClient=Sy.ExecutableError=void 0;var PNt=lf();var DNt=gG();var kNt=ISe();var KA=class extends Error{static{o(this,"ExecutableError")}constructor(e,r){super(`The executable failed with exit code: ${r} and error message: ${e}.`);this.code=r;Object.setPrototypeOf(this,new.target.prototype)}};Sy.ExecutableError=KA;var $Nt=30*1e3;var PSe=5*1e3;var DSe=120*1e3;var LNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var kSe=1;var _G=class extends PNt.BaseExternalAccountClient{static{o(this,"PluggableAuthClient")}constructor(e,r){super(e,r);if(!e.credential_source.executable){throw new Error('No valid Pluggable Auth "credential_source" provided.')}this.command=e.credential_source.executable.command;if(!this.command){throw new Error('No valid Pluggable Auth "credential_source" provided.')}if(e.credential_source.executable.timeout_millis===void 0){this.timeoutMillis=$Nt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<PSe||this.timeoutMillis>DSe){throw new Error(`Timeout must be between ${PSe} and ${DSe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new kNt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[LNt]!=="1"){throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.")}let e=void 0;if(this.outputFile){e=await this.handler.retrieveCachedResponse()}if(!e){const r=new Map;r.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience);r.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType);r.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0");if(this.outputFile){r.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile)}const n=this.getServiceAccountEmail();if(n){r.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",n)}e=await this.handler.retrieveResponseFromExecutable(r)}if(e.version>kSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${kSe}.`)}if(!e.success){throw new KA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new DNt.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}}if(e.isExpired()){throw new Error("Executable response is expired.")}return e.subjectToken}};Sy.PluggableAuthClient=_G});var bG=_(YA=>{"use strict";Object.defineProperty(YA,"__esModule",{value:true});YA.ExternalAccountClient=void 0;var qNt=lf();var jNt=lG();var UNt=dG();var FNt=GA();var EG=class{static{o(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e,r){var n,i;if(e&&e.type===qNt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new UNt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new FNt.PluggableAuthClient(e,r)}else{return new jNt.IdentityPoolClient(e,r)}}else{return null}}};YA.ExternalAccountClient=EG});var LSe=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.ExternalAccountAuthorizedUserClient=Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var BNt=ny();var $Se=Xz();var MNt=Wc();var VNt=require("stream");var HNt=lf();Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var wG=class extends $Se.OAuthClientAuthHandler{static{o(this,"ExternalAccountAuthorizedUserHandler")}constructor(e,r,n){super(n);this.url=e;this.transporter=r}async refreshToken(e,r){const n=new URLSearchParams({grant_type:"refresh_token",refresh_token:e});const i={"Content-Type":"application/x-www-form-urlencoded",...r};const s={url:this.url,method:"POST",headers:i,data:n.toString(),responseType:"json"};this.applyClientAuthenticationOptions(s);try{const a=await this.transporter.request(s);const u=a.data;u.res=a;return u}catch(a){if(a instanceof MNt.GaxiosError&&a.response){throw(0,$Se.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var SG=class extends BNt.AuthClient{static{o(this,"ExternalAccountAuthorizedUserClient")}constructor(e,r){super();this.refreshToken=e.refresh_token;const n={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new wG(e.token_url,this.transporter,n);this.cachedAccessToken=null;this.quotaProjectId=e.quota_project_id;if(typeof(r===null||r===void 0?void 0:r.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=HNt.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=r.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(r===null||r===void 0?void 0:r.forceRefreshOnFailure)}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof VNt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){const e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res};if(e.refresh_token!==void 0){this.refreshToken=e.refresh_token}return this.cachedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Ty.ExternalAccountAuthorizedUserClient=SG});var USe=_(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:true});xy.GoogleAuth=xy.CLOUD_SDK_CLIENT_ID=void 0;var zNt=require("child_process");var K6=require("fs");var TG=B7();var GNt=require("os");var AG=require("path");var KNt=ty();var YNt=C6();var WNt=kH();var JNt=LH();var QNt=qH();var Ay=Gz();var xG=Yz();var WA=Jz();var XNt=bG();var Y6=lf();var qSe=LSe();xy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var jSe={NO_PROJECT_ID_FOUND:"Unable to detect a Project Id in the current environment. \nTo learn more about authentication and Google APIs, visit: \nhttps://cloud.google.com/docs/authentication/getting-started"};var JA=class{static{o(this,"GoogleAuth")}get isGCE(){return this.checkIsGCE}constructor(e){this.checkIsGCE=void 0;this.jsonContent=null;this.cachedCredential=null;e=e||{};this._cachedProjectId=e.projectId||null;this.cachedCredential=e.authClient||null;this.keyFilename=e.keyFilename||e.keyFile;this.scopes=e.scopes;this.jsonContent=e.credentials||null;this.clientOptions=e.clientOptions}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath;e.useJWTAccessWithScope=this.useJWTAccessWithScope;e.defaultScopes=this.defaultScopes}getProjectId(e){if(e){this.getProjectIdAsync().then(r=>e(null,r),e)}else{return this.getProjectIdAsync()}}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===jSe.NO_PROJECT_ID_FOUND){return null}else{throw e}}}async findAndCacheProjectId(){let e=null;e||(e=await this.getProductionProjectId());e||(e=await this.getFileProjectId());e||(e=await this.getDefaultServiceProjectId());e||(e=await this.getGCEProjectId());e||(e=await this.getExternalAccountClientProjectId());if(e){this._cachedProjectId=e;return e}else{throw new Error(jSe.NO_PROJECT_ID_FOUND)}}async getProjectIdAsync(){if(this._cachedProjectId){return this._cachedProjectId}if(!this._findProjectIdPromise){this._findProjectIdPromise=this.findAndCacheProjectId()}return this._findProjectIdPromise}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},r){let n;if(typeof e==="function"){r=e}else{n=e}if(r){this.getApplicationDefaultAsync(n).then(i=>r(null,i.credential,i.projectId),r)}else{return this.getApplicationDefaultAsync(n)}}async getApplicationDefaultAsync(e={}){if(this.cachedCredential){return await this.prepareAndCacheADC(this.cachedCredential)}const r=process.env["GOOGLE_CLOUD_QUOTA_PROJECT"];let n;n=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Y6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}n=await this._tryGetApplicationCredentialsFromWellKnownFile(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Y6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}let i;try{i=await this._checkIsGCE()}catch(s){if(s instanceof Error){s.message=`Unexpected error determining execution environment: ${s.message}`}throw s}if(!i){throw new Error("Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.")}e.scopes=this.getAnyScopes();return await this.prepareAndCacheADC(new WNt.Compute(e),r)}async prepareAndCacheADC(e,r){const n=await this.getProjectIdOptional();if(r){e.quotaProjectId=r}this.cachedCredential=e;return{credential:e,projectId:n}}async _checkIsGCE(){if(this.checkIsGCE===void 0){this.checkIsGCE=await TG.isAvailable()}return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){const r=process.env["GOOGLE_APPLICATION_CREDENTIALS"]||process.env["google_application_credentials"];if(!r||r.length===0){return null}try{return this._getApplicationCredentialsFromFilePath(r,e)}catch(n){if(n instanceof Error){n.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${n.message}`}throw n}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let r=null;if(this._isWindows()){r=process.env["APPDATA"]}else{const i=process.env["HOME"];if(i){r=AG.join(i,".config")}}if(r){r=AG.join(r,"gcloud","application_default_credentials.json");if(!K6.existsSync(r)){r=null}}if(!r){return null}const n=await this._getApplicationCredentialsFromFilePath(r,e);return n}async _getApplicationCredentialsFromFilePath(e,r={}){if(!e||e.length===0){throw new Error("The file path is invalid.")}try{e=K6.realpathSync(e);if(!K6.lstatSync(e).isFile()){throw new Error}}catch(i){if(i instanceof Error){i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`}throw i}const n=K6.createReadStream(e);return this.fromStream(n,r)}fromImpersonatedJSON(e){var r,n,i,s;if(!e){throw new Error("Must pass in a JSON object containing an impersonated refresh token")}if(e.type!==WA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${WA.IMPERSONATED_ACCOUNT_TYPE}" type`)}if(!e.source_credentials){throw new Error("The incoming JSON object does not contain a source_credentials field")}if(!e.service_account_impersonation_url){throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field")}const a=new xG.UserRefreshClient(e.source_credentials.client_id,e.source_credentials.client_secret,e.source_credentials.refresh_token);const u=(n=(r=/(?<target>[^/]+):generateAccessToken$/.exec(e.service_account_impersonation_url))===null||r===void 0?void 0:r.groups)===null||n===void 0?void 0:n.target;if(!u){throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`)}const l=(i=this.getAnyScopes())!==null&&i!==void 0?i:[];const c=new WA.Impersonated({delegates:(s=e.delegates)!==null&&s!==void 0?s:[],sourceClient:a,targetPrincipal:u,targetScopes:Array.isArray(l)?l:[l]});return c}fromJSON(e,r={}){let n;r=r||{};if(e.type===xG.USER_REFRESH_ACCOUNT_TYPE){n=new xG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===WA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===Y6.EXTERNAL_ACCOUNT_TYPE){n=XNt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===qSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new qSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new Ay.JWT(r);this.setGapicJWTValues(n);n.fromJSON(e)}return n}_cacheClientFromJSON(e,r){const n=this.fromJSON(e,r);this.jsonContent=e;this.cachedCredential=n;return n}fromStream(e,r={},n){let i={};if(typeof r==="function"){n=r}else{i=r}if(n){this.fromStreamAsync(e,i).then(s=>n(null,s),n)}else{return this.fromStreamAsync(e,i)}}fromStreamAsync(e,r){return new Promise((n,i)=>{if(!e){throw new Error("Must pass in a stream containing the Google auth settings.")}let s="";e.setEncoding("utf8").on("error",i).on("data",a=>s+=a).on("end",()=>{try{try{const a=JSON.parse(s);const u=this._cacheClientFromJSON(a,r);return n(u)}catch(a){if(!this.keyFilename)throw a;const u=new Ay.JWT({...this.clientOptions,keyFile:this.keyFilename});this.cachedCredential=u;this.setGapicJWTValues(u);return n(u)}}catch(a){return i(a)}})})}fromAPIKey(e,r){r=r||{};const n=new Ay.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=GNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,zNt.exec)("gcloud config config-helper --format json",(r,n)=>{if(!r&&n){try{const i=JSON.parse(n).configuration.properties.core.project;e(i);return}catch(i){}}e(null)})})}getProductionProjectId(){return process.env["GCLOUD_PROJECT"]||process.env["GOOGLE_CLOUD_PROJECT"]||process.env["gcloud_project"]||process.env["google_cloud_project"]}async getFileProjectId(){if(this.cachedCredential){return this.cachedCredential.projectId}if(this.keyFilename){const r=await this.getClient();if(r&&r.projectId){return r.projectId}}const e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(e){return e.projectId}else{return null}}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==Y6.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await TG.project("project-id");return e}catch(e){return null}}getCredentials(e){if(e){this.getCredentialsAsync().then(r=>e(null,r),e)}else{return this.getCredentialsAsync()}}async getCredentialsAsync(){const e=await this.getClient();if(e instanceof Y6.BaseExternalAccountClient){const i=e.getServiceAccountEmail();if(i){return{client_email:i}}}if(this.jsonContent){const i={client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key};return i}const r=await this._checkIsGCE();if(!r){throw new Error("Unknown error.")}const n=await TG.instance({property:"service-accounts/",params:{recursive:"true"}});if(!n||!n.default||!n.default.email){throw new Error("Failure from metadata server.")}return{client_email:n.default.email}}async getClient(){if(!this.cachedCredential){if(this.jsonContent){this._cacheClientFromJSON(this.jsonContent,this.clientOptions)}else if(this.keyFilename){const e=AG.resolve(this.keyFilename);const r=K6.createReadStream(e);await this.fromStreamAsync(r,this.clientOptions)}else{await this.getApplicationDefaultAsync(this.clientOptions)}}return this.cachedCredential}async getIdTokenClient(e){const r=await this.getClient();if(!("fetchIdToken"in r)){throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.")}return new JNt.IdTokenClient({targetAudience:e,idTokenProvider:r})}async getAccessToken(){const e=await this.getClient();return(await e.getAccessToken()).token}async getRequestHeaders(e){const r=await this.getClient();return r.getRequestHeaders(e)}async authorizeRequest(e){e=e||{};const r=e.url||e.uri;const n=await this.getClient();const i=await n.getRequestHeaders(r);e.headers=Object.assign(e.headers||{},i);return e}async request(e){const r=await this.getClient();return r.request(e)}getEnv(){return(0,QNt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,KNt.createCrypto)();if(r instanceof Ay.JWT&&r.key){const s=await n.sign(r.key,e);return s}const i=await this.getCredentials();if(!i.client_email){throw new Error("Cannot sign data without `client_email`.")}return this.signBlob(n,i.client_email,e)}async signBlob(e,r,n){const i=`https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${r}:signBlob`;const s=await this.request({method:"POST",url:i,data:{payload:e.encodeBase64StringUtf8(n)}});return s.data.signedBlob}};xy.GoogleAuth=JA;JA.DefaultTransporter=YNt.DefaultTransporter});var FSe=_(QA=>{"use strict";Object.defineProperty(QA,"__esModule",{value:true});QA.IAMAuth=void 0;var CG=class{static{o(this,"IAMAuth")}constructor(e,r){this.selector=e;this.token=r;this.selector=e;this.token=r}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};QA.IAMAuth=CG});var BSe=_(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:true});Nu.DownscopedClient=Nu.EXPIRATION_TIME_OFFSET=Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var ZNt=require("stream");var eIt=ny();var tIt=eG();var rIt="urn:ietf:params:oauth:grant-type:token-exchange";var nIt="urn:ietf:params:oauth:token-type:access_token";var iIt="urn:ietf:params:oauth:token-type:access_token";var sIt="https://sts.googleapis.com/v1/token";Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Nu.EXPIRATION_TIME_OFFSET=5*60*1e3;var RG=class extends eIt.AuthClient{static{o(this,"DownscopedClient")}constructor(e,r,n,i){super();this.authClient=e;this.credentialAccessBoundary=r;if(r.accessBoundary.accessBoundaryRules.length===0){throw new Error("At least one access boundary rule needs to be defined.")}else if(r.accessBoundary.accessBoundaryRules.length>Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`)}for(const s of r.accessBoundary.accessBoundaryRules){if(s.availablePermissions.length===0){throw new Error("At least one permission should be defined in access boundary rules.")}}this.stsCredential=new tIt.StsCredentials(sIt);this.cachedDownscopedAccessToken=null;if(typeof(n===null||n===void 0?void 0:n.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=Nu.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=n.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(n===null||n===void 0?void 0:n.forceRefreshOnFailure);this.quotaProjectId=i}setCredentials(e){if(!e.expiry_date){throw new Error("The access token expiry_date field is missing in the provided credentials.")}super.setCredentials(e);this.cachedDownscopedAccessToken=e}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof ZNt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){var e;const r=(await this.authClient.getAccessToken()).token;const n={grantType:rIt,requestedTokenType:nIt,subjectToken:r,subjectTokenType:iIt};const i=await this.stsCredential.exchangeToken(n,void 0,this.credentialAccessBoundary);const s=((e=this.authClient.credentials)===null||e===void 0?void 0:e.expiry_date)||null;const a=i.expires_in?new Date().getTime()+i.expires_in*1e3:s;this.cachedDownscopedAccessToken={access_token:i.access_token,expiry_date:a,res:i.res};this.credentials={};Object.assign(this.credentials,this.cachedDownscopedAccessToken);delete this.credentials.res;this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null});return this.cachedDownscopedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Nu.DownscopedClient=RG});var OG=_(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:true});Ot.GoogleAuth=Ot.auth=Ot.DefaultTransporter=Ot.PluggableAuthClient=Ot.DownscopedClient=Ot.BaseExternalAccountClient=Ot.ExternalAccountClient=Ot.IdentityPoolClient=Ot.AwsClient=Ot.UserRefreshClient=Ot.LoginTicket=Ot.OAuth2Client=Ot.CodeChallengeMethod=Ot.Impersonated=Ot.JWT=Ot.JWTAccess=Ot.IdTokenClient=Ot.IAMAuth=Ot.GCPEnv=Ot.Compute=Ot.AuthClient=void 0;var MSe=USe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return MSe.GoogleAuth}});var aIt=ny();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return aIt.AuthClient}});var oIt=kH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return oIt.Compute}});var uIt=qH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return uIt.GCPEnv}});var lIt=FSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return lIt.IAMAuth}});var cIt=LH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return cIt.IdTokenClient}});var dIt=Hz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return dIt.JWTAccess}});var pIt=Gz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return pIt.JWT}});var fIt=Jz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return fIt.Impersonated}});var VSe=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return VSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return VSe.OAuth2Client}});var hIt=IH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return hIt.LoginTicket}});var mIt=Yz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return mIt.UserRefreshClient}});var gIt=dG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return gIt.AwsClient}});var yIt=lG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return yIt.IdentityPoolClient}});var vIt=bG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return vIt.ExternalAccountClient}});var _It=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return _It.BaseExternalAccountClient}});var EIt=BSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return EIt.DownscopedClient}});var bIt=GA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return bIt.PluggableAuthClient}});var wIt=C6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return wIt.DefaultTransporter}});var SIt=new MSe.GoogleAuth;Ot.auth=SIt});var Ry=_(Cy=>{"use strict";var TIt=Cy&&Cy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Cy,"__esModule",{value:true});Cy.getServiceAccountIdToken=void 0;var AIt=OG();var xIt=TIt(Vu());var CIt=new AIt.GoogleAuth;var HSe=new xIt.default({max:50,maxAge:1e3*60*50});async function RIt(t){let e=HSe.get(t);if(!e){const r=await CIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);HSe.set(t,e)}return e}o(RIt,"getServiceAccountIdToken");Cy.getServiceAccountIdToken=RIt});var WSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Oy=As();var OIt=Ry();var NIt={"Content-Type":"application/json"};var IIt=/\/*$/;async function PIt(t){const{baseUrl:e,fetch:r=globalThis.fetch,querySerializer:n,bodySerializer:i,zuploExtensions:s,...a}=t;const u=s?.fastifyRequest.log;const l=s?.fastifyRequest.id;const c=s?.options?.userSub??s?.fastifyRequest.getUserSub();const d=new Headers({...NIt,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,OIt.getServiceAccountIdToken)(e);d.set("Authorization",`Bearer ${p}`);async function f(h,m){const{headers:g,body:y,params:v={},parseAs:w="json",querySerializer:E=n??zSe,bodySerializer:b=i??GSe,...S}=m||{};const T=KSe(h,{baseUrl:e,params:v,querySerializer:E});const A=YSe(d,g,v.header);const P={redirect:"follow",...a,...S,headers:A};if(y)P.body=b(y);if(P.body instanceof FormData)A.delete("Content-Type");const D=await r(T,P);if(D.status===404){const F=await D.json();if(F&&F.hasOwnProperty("type")&&F.hasOwnProperty("title")&&F.hasOwnProperty("status")){throw new Oy.ApiError(F)}throw new Oy.ApiError(Oy.Problems.NOT_FOUND)}if(D.status===204||D.headers.get("Content-Length")==="0"){return D.ok?{data:{},response:D}:{error:{},response:D}}if(D.ok){let F=D.body;if(w!=="stream"){const V=D.clone();F=typeof V[w]==="function"?await V[w]():await V.text()}return{data:F,response:D}}else{u.debug(`Error on internal api: path: ${T}, status: ${D.status}, headers: ${JSON.stringify(D.headers)}, body: ${await D.clone().text()}`);let F={};try{F=await D.clone().json();if(F.type&&F.status&&F.title){throw new Oy.ApiError(F)}}catch(V){}throw new Oy.ApiError(Oy.Problems.INTERNAL_SERVER_ERROR)}}o(f,"coreFetch");return{async GET(h,m){return f(h,{...m,method:"GET"})},async PUT(h,m){return f(h,{...m,method:"PUT"})},async POST(h,m){return f(h,{...m,method:"POST"})},async DELETE(h,m){return f(h,{...m,method:"DELETE"})},async OPTIONS(h,m){return f(h,{...m,method:"OPTIONS"})},async HEAD(h,m){return f(h,{...m,method:"HEAD"})},async PATCH(h,m){return f(h,{...m,method:"PATCH"})},async TRACE(h,m){return f(h,{...m,method:"TRACE"})}}}o(PIt,"createClient");Fo.createClient=PIt;function zSe(t){const e=new URLSearchParams;if(t&&typeof t==="object"){for(const[r,n]of Object.entries(t)){if(n===void 0||n===null)continue;e.set(r,n)}}return e.toString()}o(zSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=zSe;function GSe(t){return JSON.stringify(t)}o(GSe,"defaultBodySerializer");Fo.defaultBodySerializer=GSe;function KSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(IIt,""):""}${t}`;if(e.params.path){for(const[n,i]of Object.entries(e.params.path))r=r.replace(`{${n}}`,encodeURIComponent(String(i)))}if(e.params.query){const n=e.querySerializer(e.params.query);if(n)r+=`?${n}`}return r}o(KSe,"createFinalURL");Fo.createFinalURL=KSe;function YSe(...t){const e=new Headers;for(const r of t){if(!r||typeof r!=="object")continue;const n=r instanceof Headers?r.entries():Object.entries(r);for(const[i,s]of n){if(s!==void 0&&s!==null){e.set(i,s)}}}return e}o(YSe,"mergeHeaders");Fo.mergeHeaders=YSe});var JSe=_(cf=>{"use strict";var DIt=cf&&cf.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(cf,"__esModule",{value:true});cf.ApiKeyService=cf.createApiKeyServiceClient=void 0;var Ny=As();var kIt=OG();var XA=DIt(za());var $It=WSe();async function LIt(t){return(0,$It.createClient)({baseUrl:XA.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(LIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=LIt;var NG=class{static{o(this,"ApiKeyService")}logger;requestId;constructor(e){this.logger=e.log;this.requestId=e.id}async fetchGCP(e,r={}){this.logger.info(`Fetching with GCP JWT ${r.method} ${e} from Api Key Service API.`);const n=new kIt.GoogleAuth;const i=await n.getIdTokenClient(XA.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${XA.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:"GET",body:r.body,headers:{...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}}})}`);const s=await i.getRequestHeaders();const a=await i.request({url:`${XA.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:r.method||"GET",body:r.body,headers:{...s,...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}},validateStatus:u=>u>=200&&u<500});if(a.status===404){const u=await a.data;if(u&&u.hasOwnProperty("type")&&u.hasOwnProperty("title")&&u.hasOwnProperty("status")){throw new Ny.ApiError(u)}throw new Ny.ApiError(Ny.Problems.NOT_FOUND)}if(a.status>=300){this.logger.debug(`Error on api-key-service: path: ${e}, status: ${a.status}, headers: ${JSON.stringify(a.headers)}, body: ${JSON.stringify(a.data)}`);const u=a.data;if(u.type&&u.status&&u.title){throw new Ny.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Ny.ApiError(Ny.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};cf.ApiKeyService=NG});var XSe=_(Iy=>{"use strict";var qIt=Iy&&Iy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Iy,"__esModule",{value:true});Iy.AuthApiService=void 0;var Nm=As();var QSe=qIt(za());var jIt=Ry();var IG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!QSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=QSe.default.AUTH_API_URL}async getClientJWT(e,r){let n;try{n=await this.fetch(`/v1/clients/${e}`,{method:"GET"})}catch(s){if(s.status===Nm.Problems.NOT_FOUND.status){n=await this.fetch(`/v1/clients`,{method:"POST",body:JSON.stringify({client_id:e})})}else{throw s}}const i=await this.fetch(`/v1/oauth/token`,{method:"POST",body:JSON.stringify({client_id:e,client_secret:n.client_secret,grant_type:"client_credentials",custom_claims:r})});return i.access_token}async fetch(e,r){this.logger.info(`Fetching internally ${e} from Auth API V2.`);const n=new Headers({"content-type":"application/json","zp-rid":this.requestId,authorization:""});if(process.env.K_SERVICE){const s=await(0,jIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===Nm.HttpStatusCode.NOT_FOUND){throw new Nm.ApiError(Nm.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on auth-api: path: ${e}, status: ${i.status}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Nm.ApiError(s)}this.logger.error(`Error not handled on auth-api: path: ${e}, status: ${i.status}`);throw new Nm.ApiError(Nm.Problems.INTERNAL_SERVER_ERROR)}return i.clone().json()}};Iy.AuthApiService=IG});var ex=_(ZA=>{"use strict";Object.defineProperty(ZA,"__esModule",{value:true});ZA.ApiServiceClient=void 0;var Py=As();var UIt=Ry();var PG=class{static{o(this,"ApiServiceClient")}userSub;logger;requestId;baseUrl;cache;constructor(e,r,n){this.userSub=n.userSub;this.logger=n.logger;this.requestId=n.requestId;this.baseUrl=e;this.cache=r}async cachedFetch(e,r,n){if(!this.userSub||!n){throw new Error("userSub and cacheKey parameters are required to use cachedFetch")}const i=`${this.userSub}@${n}`;if(this.cache.has(i)){return this.cache.get(i)}const s=await this.fetchInternally(e,r);this.cache.set(i,s);return s}async fetchInternally(e,r){this.logger.info(`Fetching internally ${r.method} ${this.baseUrl}${e}`);const n=new Headers({...r.headers,"zuplo-user":this.userSub,"content-type":"application/json","zp-rid":this.requestId});if(process.env.K_SERVICE){const s=await(0,UIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===404){const s=await i.json();if(s&&s.hasOwnProperty("type")&&s.hasOwnProperty("title")&&s.hasOwnProperty("status")){throw new Py.ApiError(s)}throw new Py.ApiError(Py.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on internal api: path: ${e}, status: ${i.status}, headers: ${JSON.stringify(i.headers)}, body: ${JSON.stringify(i.clone().text())}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Py.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Py.ApiError(Py.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};ZA.ApiServiceClient=PG});var rTe=_(Ml=>{"use strict";var eTe=Ml&&Ml.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ml,"__esModule",{value:true});Ml.ContentApiService=Ml.getContentApiStorageTarballPath=Ml.contentApiTarballFileName=void 0;var FIt=eTe(Vu());var ZSe=eTe(za());var BIt=ex();var MIt=new FIt.default({max:500,maxAge:1e3*60*50});function tTe(t,e){return`${t}--${e}.tar.gz`}o(tTe,"contentApiTarballFileName");Ml.contentApiTarballFileName=tTe;function VIt(t,e){const r=tTe(t,e);return`${t}/builds/${r}`}o(VIt,"getContentApiStorageTarballPath");Ml.getContentApiStorageTarballPath=VIt;var DG=class extends BIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!ZSe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(ZSe.default.CONTENT_API_URL,MIt,e)}};Ml.ContentApiService=DG});var sTe=_(Dy=>{"use strict";var iTe=Dy&&Dy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Dy,"__esModule",{value:true});Dy.DevApiService=void 0;var HIt=iTe(Vu());var nTe=iTe(za());var zIt=ex();var GIt=new HIt.default({max:500,maxAge:1e3*60*50});var kG=class extends zIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!nTe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(nTe.default.DEV_API_URL,GIt,{userSub:n,logger:e.log,requestId:e.id})}};Dy.DevApiService=kG});var uTe=_((bhr,oTe)=>{var aTe=require("stream").Stream;var KIt=require("util");oTe.exports=Iu;function Iu(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(Iu,"DelayedStream");KIt.inherits(Iu,aTe);Iu.create=function(t,e){var r=new this;e=e||{};for(var n in e){r[n]=e[n]}r.source=t;var i=t.emit;t.emit=function(){r._handleEmit(arguments);return i.apply(t,arguments)};t.on("error",function(){});if(r.pauseStream){t.pause()}return r};Object.defineProperty(Iu.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});Iu.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Iu.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};Iu.prototype.pause=function(){this.source.pause()};Iu.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};Iu.prototype.pipe=function(){var t=aTe.prototype.pipe.apply(this,arguments);this.resume();return t};Iu.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}if(t[0]==="data"){this.dataSize+=t[1].length;this._checkIfMaxDataSizeExceeded()}this._bufferedEvents.push(t)};Iu.prototype._checkIfMaxDataSizeExceeded=function(){if(this._maxDataSizeExceeded){return}if(this.dataSize<=this.maxDataSize){return}this._maxDataSizeExceeded=true;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}});var pTe=_((Shr,dTe)=>{var YIt=require("util");var cTe=require("stream").Stream;var lTe=uTe();dTe.exports=Xn;function Xn(){this.writable=false;this.readable=true;this.dataSize=0;this.maxDataSize=2*1024*1024;this.pauseStreams=true;this._released=false;this._streams=[];this._currentStream=null;this._insideLoop=false;this._pendingNext=false}o(Xn,"CombinedStream");YIt.inherits(Xn,cTe);Xn.create=function(t){var e=new this;t=t||{};for(var r in t){e[r]=t[r]}return e};Xn.isStreamLike=function(t){return typeof t!=="function"&&typeof t!=="string"&&typeof t!=="boolean"&&typeof t!=="number"&&!Buffer.isBuffer(t)};Xn.prototype.append=function(t){var e=Xn.isStreamLike(t);if(e){if(!(t instanceof lTe)){var r=lTe.create(t,{maxDataSize:Infinity,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this));t=r}this._handleErrors(t);if(this.pauseStreams){t.pause()}}this._streams.push(t);return this};Xn.prototype.pipe=function(t,e){cTe.prototype.pipe.call(this,t,e);this.resume();return t};Xn.prototype._getNext=function(){this._currentStream=null;if(this._insideLoop){this._pendingNext=true;return}this._insideLoop=true;try{do{this._pendingNext=false;this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=false}};Xn.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t=="undefined"){this.end();return}if(typeof t!=="function"){this._pipeNext(t);return}var e=t;e(function(r){var n=Xn.isStreamLike(r);if(n){r.on("data",this._checkDataSize.bind(this));this._handleErrors(r)}this._pipeNext(r)}.bind(this))};Xn.prototype._pipeNext=function(t){this._currentStream=t;var e=Xn.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this));t.pipe(this,{end:false});return}var r=t;this.write(r);this._getNext()};Xn.prototype._handleErrors=function(t){var e=this;t.on("error",function(r){e._emitError(r)})};Xn.prototype.write=function(t){this.emit("data",t)};Xn.prototype.pause=function(){if(!this.pauseStreams){return}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function")this._currentStream.pause();this.emit("pause")};Xn.prototype.resume=function(){if(!this._released){this._released=true;this.writable=true;this._getNext()}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function")this._currentStream.resume();this.emit("resume")};Xn.prototype.end=function(){this._reset();this.emit("end")};Xn.prototype.destroy=function(){this._reset();this.emit("close")};Xn.prototype._reset=function(){this.writable=false;this._streams=[];this._currentStream=null};Xn.prototype._checkDataSize=function(){this._updateDataSize();if(this.dataSize<=this.maxDataSize){return}var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))};Xn.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){if(!e.dataSize){return}t.dataSize+=e.dataSize});if(this._currentStream&&this._currentStream.dataSize){this.dataSize+=this._currentStream.dataSize}};Xn.prototype._emitError=function(t){this._reset();this.emit("error",t)}});var hTe=_((Ahr,fTe)=>{fTe.exports=WIt;function WIt(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;if(e){e(t)}else{setTimeout(t,0)}}o(WIt,"defer")});var $G=_((Chr,gTe)=>{var mTe=hTe();gTe.exports=JIt;function JIt(t){var e=false;mTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{mTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(JIt,"async")});var LG=_((Ohr,yTe)=>{yTe.exports=QIt;function QIt(t){Object.keys(t.jobs).forEach(XIt.bind(t));t.jobs={}}o(QIt,"abort");function XIt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(XIt,"clean")});var qG=_((Ihr,_Te)=>{var vTe=$G();var ZIt=LG();_Te.exports=ePt;function ePt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=tPt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){ZIt(r)}else{r.results[i]=a}n(s,r.results)})}o(ePt,"iterate");function tPt(t,e,r,n){var i;if(t.length==2){i=t(r,vTe(n))}else{i=t(r,e,vTe(n))}return i}o(tPt,"runJob")});var jG=_((Dhr,ETe)=>{ETe.exports=rPt;function rPt(t,e){var r=!Array.isArray(t),n={index:0,keyedList:r||e?Object.keys(t):null,jobs:{},results:r?{}:[],size:r?Object.keys(t).length:t.length};if(e){n.keyedList.sort(r?e:function(i,s){return e(t[i],t[s])})}return n}o(rPt,"state")});var UG=_(($hr,bTe)=>{var nPt=LG();var iPt=$G();bTe.exports=sPt;function sPt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;nPt(this);iPt(t)(null,this.results)}o(sPt,"terminator")});var STe=_((qhr,wTe)=>{var aPt=qG();var oPt=jG();var uPt=UG();wTe.exports=lPt;function lPt(t,e,r){var n=oPt(t);while(n.index<(n["keyedList"]||t).length){aPt(t,e,n,function(i,s){if(i){r(i,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}});n.index++}return uPt.bind(n,r)}o(lPt,"parallel")});var FG=_((Uhr,tx)=>{var TTe=qG();var cPt=jG();var dPt=UG();tx.exports=pPt;tx.exports.ascending=ATe;tx.exports.descending=fPt;function pPt(t,e,r,n){var i=cPt(t,r);TTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){TTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return dPt.bind(i,n)}o(pPt,"serialOrdered");function ATe(t,e){return t<e?-1:t>e?1:0}o(ATe,"ascending");function fPt(t,e){return-1*ATe(t,e)}o(fPt,"descending")});var CTe=_((Bhr,xTe)=>{var hPt=FG();xTe.exports=mPt;function mPt(t,e,r){return hPt(t,e,null,r)}o(mPt,"serial")});var OTe=_((Vhr,RTe)=>{RTe.exports={parallel:STe(),serial:CTe(),serialOrdered:FG()}});var ITe=_((Hhr,NTe)=>{NTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var kTe=_((zhr,DTe)=>{var HG=pTe();var PTe=require("util");var BG=require("path");var gPt=require("http");var yPt=require("https");var vPt=require("url").parse;var _Pt=require("fs");var EPt=require("stream").Stream;var MG=AB();var bPt=OTe();var VG=ITe();DTe.exports=Fr;PTe.inherits(Fr,HG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];HG.call(this);t=t||{};for(var e in t){this[e]=t[e]}}o(Fr,"FormData");Fr.LINE_BREAK="\r\n";Fr.DEFAULT_CONTENT_TYPE="application/octet-stream";Fr.prototype.append=function(t,e,r){r=r||{};if(typeof r=="string"){r={filename:r}}var n=HG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(PTe.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(t,e,r);var s=this._multiPartFooter();n(i);n(e);n(s);this._trackLength(i,e,r)};Fr.prototype._trackLength=function(t,e,r){var n=0;if(r.knownLength!=null){n+=+r.knownLength}else if(Buffer.isBuffer(e)){n=e.length}else if(typeof e==="string"){n=Buffer.byteLength(e)}this._valueLength+=n;this._overheadLength+=Buffer.byteLength(t)+Fr.LINE_BREAK.length;if(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof EPt)){return}if(!r.knownLength){this._valuesToMeasure.push(e)}};Fr.prototype._lengthRetriever=function(t,e){if(t.hasOwnProperty("fd")){if(t.end!=void 0&&t.end!=Infinity&&t.start!=void 0){e(null,t.end+1-(t.start?t.start:0))}else{_Pt.stat(t.path,function(r,n){var i;if(r){e(r);return}i=n.size-(t.start?t.start:0);e(null,i)})}}else if(t.hasOwnProperty("httpVersion")){e(null,+t.headers["content-length"])}else if(t.hasOwnProperty("httpModule")){t.on("response",function(r){t.pause();e(null,+r.headers["content-length"])});t.resume()}else{e("Unknown stream")}};Fr.prototype._multiPartHeader=function(t,e,r){if(typeof r.header=="string"){return r.header}var n=this._getContentDisposition(e,r);var i=this._getContentType(e,r);var s="";var a={"Content-Disposition":["form-data",'name="'+t+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};if(typeof r.header=="object"){VG(a,r.header)}var u;for(var l in a){if(!a.hasOwnProperty(l))continue;u=a[l];if(u==null){continue}if(!Array.isArray(u)){u=[u]}if(u.length){s+=l+": "+u.join("; ")+Fr.LINE_BREAK}}return"--"+this.getBoundary()+Fr.LINE_BREAK+s+Fr.LINE_BREAK};Fr.prototype._getContentDisposition=function(t,e){var r,n;if(typeof e.filepath==="string"){r=BG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=BG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=BG.basename(t.client._httpMessage.path||"")}if(r){n='filename="'+r+'"'}return n};Fr.prototype._getContentType=function(t,e){var r=e.contentType;if(!r&&t.name){r=MG.lookup(t.name)}if(!r&&t.path){r=MG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=MG.lookup(e.filepath||e.filename)}if(!r&&typeof t=="object"){r=Fr.DEFAULT_CONTENT_TYPE}return r};Fr.prototype._multiPartFooter=function(){return function(t){var e=Fr.LINE_BREAK;var r=this._streams.length===0;if(r){e+=this._lastBoundary()}t(e)}.bind(this)};Fr.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Fr.LINE_BREAK};Fr.prototype.getHeaders=function(t){var e;var r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t){if(t.hasOwnProperty(e)){r[e.toLowerCase()]=t[e]}}return r};Fr.prototype.setBoundary=function(t){this._boundary=t};Fr.prototype.getBoundary=function(){if(!this._boundary){this._generateBoundary()}return this._boundary};Fr.prototype.getBuffer=function(){var t=new Buffer.alloc(0);var e=this.getBoundary();for(var r=0,n=this._streams.length;r<n;r++){if(typeof this._streams[r]!=="function"){if(Buffer.isBuffer(this._streams[r])){t=Buffer.concat([t,this._streams[r]])}else{t=Buffer.concat([t,Buffer.from(this._streams[r])])}if(typeof this._streams[r]!=="string"||this._streams[r].substring(2,e.length+2)!==e){t=Buffer.concat([t,Buffer.from(Fr.LINE_BREAK)])}}}return Buffer.concat([t,Buffer.from(this._lastBoundary())])};Fr.prototype._generateBoundary=function(){var t="--------------------------";for(var e=0;e<24;e++){t+=Math.floor(Math.random()*10).toString(16)}this._boundary=t};Fr.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;if(this._streams.length){t+=this._lastBoundary().length}if(!this.hasKnownLength()){this._error(new Error("Cannot calculate proper length in synchronous way."))}return t};Fr.prototype.hasKnownLength=function(){var t=true;if(this._valuesToMeasure.length){t=false}return t};Fr.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length){e+=this._lastBoundary().length}if(!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}bPt.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){t(r);return}n.forEach(function(i){e+=i});t(null,e)})};Fr.prototype.submit=function(t,e){var r,n,i={method:"post"};if(typeof t=="string"){t=vPt(t);n=VG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=VG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=yPt.request(n)}else{r=gPt.request(n)}this.getLength(function(s,a){if(s&&s!=="Unknown stream"){this._error(s);return}if(a){r.setHeader("Content-Length",a)}this.pipe(r);if(e){var u;var l=o(function(c,d){r.removeListener("error",l);r.removeListener("response",u);return e.call(this,c,d)},"callback");u=l.bind(this,null);r.on("error",l);r.on("response",u)}}.bind(this));return r};Fr.prototype._error=function(t){if(!this.error){this.error=t;this.pause();this.emit("error",t)}};Fr.prototype.toString=function(){return"[object FormData]"}});var LTe=_($Te=>{"use strict";var wPt=require("url").parse;var SPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var TPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function APt(t){var e=typeof t==="string"?wPt(t):t||{};var r=e.protocol;var n=e.host;var i=e.port;if(typeof n!=="string"||!n||typeof r!=="string"){return""}r=r.split(":",1)[0];n=n.replace(/:\d*$/,"");i=parseInt(i)||SPt[r]||0;if(!xPt(n,i)){return""}var s=ky("npm_config_"+r+"_proxy")||ky(r+"_proxy")||ky("npm_config_proxy")||ky("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(APt,"getProxyForUrl");function xPt(t,e){var r=(ky("npm_config_no_proxy")||ky("no_proxy")).toLowerCase();if(!r){return true}if(r==="*"){return false}return r.split(/[,\s]/).every(function(n){if(!n){return true}var i=n.match(/^(.+):(\d+)$/);var s=i?i[1]:n;var a=i?parseInt(i[2]):0;if(a&&a!==e){return true}if(!/^[.*]/.test(s)){return t!==s}if(s.charAt(0)==="*"){s=s.slice(1)}return!TPt.call(t,s)})}o(xPt,"shouldProxy");function ky(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o(ky,"getEnv");$Te.getProxyForUrl=APt});var jTe=_((Whr,qTe)=>{var W6;qTe.exports=function(){if(!W6){try{W6=Ja()("follow-redirects")}catch(t){}if(typeof W6!=="function"){W6=o(function(){},"debug")}}W6.apply(null,arguments)}});var VTe=_((Qhr,rK)=>{var X6=require("url");var J6=X6.URL;var CPt=require("http");var RPt=require("https");var WG=require("stream").Writable;var JG=require("assert");var UTe=jTe();var QG=false;try{JG(new J6)}catch(t){QG=t.code==="ERR_INVALID_URL"}var OPt=["auth","host","hostname","href","path","pathname","port","protocol","query","search"];var XG=["abort","aborted","connect","error","socket","timeout"];var ZG=Object.create(null);XG.forEach(function(t){ZG[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var GG=Z6("ERR_INVALID_URL","Invalid URL",TypeError);var KG=Z6("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var NPt=Z6("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",KG);var IPt=Z6("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var PPt=Z6("ERR_STREAM_WRITE_AFTER_END","write after end");var DPt=WG.prototype.destroy||BTe;function Ta(t,e){WG.call(this);this._sanitizeOptions(t);this._options=t;this._ended=false;this._ending=false;this._redirectCount=0;this._redirects=[];this._requestBodyLength=0;this._requestBodyBuffers=[];if(e){this.on("response",e)}var r=this;this._onNativeResponse=function(n){try{r._processResponse(n)}catch(i){r.emit("error",i instanceof KG?i:new KG({cause:i}))}};this._performRequest()}o(Ta,"RedirectableRequest");Ta.prototype=Object.create(WG.prototype);Ta.prototype.abort=function(){tK(this._currentRequest);this._currentRequest.abort();this.emit("abort")};Ta.prototype.destroy=function(t){tK(this._currentRequest,t);DPt.call(this,t);return this};Ta.prototype.write=function(t,e,r){if(this._ending){throw new PPt}if(!Im(t)&&!LPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(Q6(e)){r=e;e=null}if(t.length===0){if(r){r()}return}if(this._requestBodyLength+t.length<=this._options.maxBodyLength){this._requestBodyLength+=t.length;this._requestBodyBuffers.push({data:t,encoding:e});this._currentRequest.write(t,e,r)}else{this.emit("error",new IPt);this.abort()}};Ta.prototype.end=function(t,e,r){if(Q6(t)){r=t;t=e=null}else if(Q6(e)){r=e;e=null}if(!t){this._ended=this._ending=true;this._currentRequest.end(null,null,r)}else{var n=this;var i=this._currentRequest;this.write(t,e,function(){n._ended=true;i.end(null,null,r)});this._ending=true}};Ta.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Ta.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Ta.prototype.setTimeout=function(t,e){var r=this;function n(a){a.setTimeout(t);a.removeListener("timeout",a.destroy);a.addListener("timeout",a.destroy)}o(n,"destroyOnTimeout");function i(a){if(r._timeout){clearTimeout(r._timeout)}r._timeout=setTimeout(function(){r.emit("timeout");s()},t);n(a)}o(i,"startTimer");function s(){if(r._timeout){clearTimeout(r._timeout);r._timeout=null}r.removeListener("abort",s);r.removeListener("error",s);r.removeListener("response",s);r.removeListener("close",s);if(e){r.removeListener("timeout",e)}if(!r.socket){r._currentRequest.removeListener("socket",i)}}o(s,"clearTimer");if(e){this.on("timeout",e)}if(this.socket){i(this.socket)}else{this._currentRequest.once("socket",i)}this.on("socket",n);this.on("abort",s);this.on("error",s);this.on("response",s);this.on("close",s);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ta.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ta.prototype,t,{get:function(){return this._currentRequest[t]}})});Ta.prototype._sanitizeOptions=function(t){if(!t.headers){t.headers={}}if(t.host){if(!t.hostname){t.hostname=t.host}delete t.host}if(!t.pathname&&t.path){var e=t.path.indexOf("?");if(e<0){t.pathname=t.path}else{t.pathname=t.path.substring(0,e);t.search=t.path.substring(e)}}};Ta.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){throw new TypeError("Unsupported protocol "+t)}if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var i of XG){n.on(i,ZG[i])}this._currentUrl=/^\//.test(this._options.path)?X6.format(this._options):this._options.path;if(this._isRedirect){var s=0;var a=this;var u=this._requestBodyBuffers;o(function l(c){if(n===a._currentRequest){if(c){a.emit("error",c)}else if(s<u.length){var d=u[s++];if(!n.finished){n.write(d.data,d.encoding,l)}}else if(a._ended){n.end()}}},"writeNext")()}};Ta.prototype._processResponse=function(t){var e=t.statusCode;if(this._options.trackRedirects){this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e})}var r=t.headers.location;if(!r||this._options.followRedirects===false||e<300||e>=400){t.responseUrl=this._currentUrl;t.redirects=this._redirects;this.emit("response",t);this._requestBodyBuffers=[];return}tK(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){throw new NPt}var n;var i=this._options.beforeRedirect;if(i){n=Object.assign({Host:t.req.getHeader("host")},this._options.headers)}var s=this._options.method;if((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method)){this._options.method="GET";this._requestBodyBuffers=[];zG(/^content-/i,this._options.headers)}var a=zG(/^host$/i,this._options.headers);var u=eK(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:X6.format(Object.assign(u,{host:l}));var d=kPt(r,c);UTe("redirecting to",d.href);this._isRedirect=true;YG(d,this._options);if(d.protocol!==u.protocol&&d.protocol!=="https:"||d.host!==l&&!$Pt(d.host,l)){zG(/^(?:authorization|cookie)$/i,this._options.headers)}if(Q6(i)){var p={headers:t.headers,statusCode:e};var f={url:c,method:s,headers:n};i(this._options,p,f);this._sanitizeOptions(this._options)}this._performRequest()};function FTe(t){var e={maxRedirects:21,maxBodyLength:10*1024*1024};var r={};Object.keys(t).forEach(function(n){var i=n+":";var s=r[i]=t[n];var a=e[n]=Object.create(s);function u(c,d,p){if(qPt(c)){c=YG(c)}else if(Im(c)){c=YG(eK(c))}else{p=d;d=MTe(c);c={protocol:i}}if(Q6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Im(d.host)&&!Im(d.hostname)){d.hostname="::1"}JG.equal(d.protocol,i,"protocol mismatch");UTe("options",d);return new Ta(d,p)}o(u,"request");function l(c,d,p){var f=a.request(c,d,p);f.end();return f}o(l,"get");Object.defineProperties(a,{request:{value:u,configurable:true,enumerable:true,writable:true},get:{value:l,configurable:true,enumerable:true,writable:true}})});return e}o(FTe,"wrap");function BTe(){}o(BTe,"noop");function eK(t){var e;if(QG){e=new J6(t)}else{e=MTe(X6.parse(t));if(!Im(e.protocol)){throw new GG({input:t})}}return e}o(eK,"parseUrl");function kPt(t,e){return QG?new J6(t,e):eK(X6.resolve(e,t))}o(kPt,"resolveUrl");function MTe(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname)){throw new GG({input:t.href||t})}if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host)){throw new GG({input:t.href||t})}return t}o(MTe,"validateUrl");function YG(t,e){var r=e||{};for(var n of OPt){r[n]=t[n]}if(r.hostname.startsWith("[")){r.hostname=r.hostname.slice(1,-1)}if(r.port!==""){r.port=Number(r.port)}r.path=r.search?r.pathname+r.search:r.pathname;return r}o(YG,"spreadUrlObject");function zG(t,e){var r;for(var n in e){if(t.test(n)){r=e[n];delete e[n]}}return r===null||typeof r==="undefined"?void 0:String(r).trim()}o(zG,"removeMatchingHeaders");function Z6(t,e,r){function n(i){Error.captureStackTrace(this,this.constructor);Object.assign(this,i||{});this.code=t;this.message=this.cause?e+": "+this.cause.message:e}o(n,"CustomError");n.prototype=new(r||Error);Object.defineProperties(n.prototype,{constructor:{value:n,enumerable:false},name:{value:"Error ["+t+"]",enumerable:false}});return n}o(Z6,"createErrorType");function tK(t,e){for(var r of XG){t.removeListener(r,ZG[r])}t.on("error",BTe);t.destroy(e)}o(tK,"destroyRequest");function $Pt(t,e){JG(Im(t)&&Im(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o($Pt,"isSubdomain");function Im(t){return typeof t==="string"||t instanceof String}o(Im,"isString");function Q6(t){return typeof t==="function"}o(Q6,"isFunction");function LPt(t){return typeof t==="object"&&"length"in t}o(LPt,"isBuffer");function qPt(t){return J6&&t instanceof J6}o(qPt,"isURL");rK.exports=FTe({http:CPt,https:RPt});rK.exports.wrap=FTe});var dx=_((Zhr,P7e)=>{"use strict";var jPt=kTe();var UPt=require("url");var FPt=LTe();var BPt=require("http");var MPt=require("https");var o7e=require("util");var VPt=VTe();var HPt=require("zlib");var u7e=require("stream");var zPt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var l7e=td(jPt);var GPt=td(UPt);var KPt=td(BPt);var YPt=td(MPt);var WPt=td(o7e);var JPt=td(VPt);var hf=td(HPt);var pf=td(u7e);var QPt=td(zPt);function c7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(c7e,"bind");var{toString:XPt}=Object.prototype;var{getPrototypeOf:yK}=Object;var ox=(t=>e=>{const r=XPt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>ox(e)===t},"kindOfTest");var ux=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:jy}=Array;var rb=ux("undefined");function ZPt(t){return t!==null&&!rb(t)&&t.constructor!==null&&!rb(t.constructor)&&Mo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(ZPt,"isBuffer");var d7e=Vl("ArrayBuffer");function eDt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&d7e(t.buffer)}return e}o(eDt,"isArrayBufferView");var tDt=ux("string");var Mo=ux("function");var p7e=ux("number");var lx=o(t=>t!==null&&typeof t==="object","isObject");var rDt=o(t=>t===true||t===false,"isBoolean");var nx=o(t=>{if(ox(t)!=="object"){return false}const e=yK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var nDt=Vl("Date");var iDt=Vl("File");var sDt=Vl("Blob");var aDt=Vl("FileList");var oDt=o(t=>lx(t)&&Mo(t.pipe),"isStream");var uDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Mo(t.append)&&((e=ox(t))==="formdata"||e==="object"&&Mo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var lDt=Vl("URLSearchParams");var cDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ib(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(jy(t)){for(n=0,i=t.length;n<i;n++){e.call(null,t[n],n,t)}}else{const s=r?Object.getOwnPropertyNames(t):Object.keys(t);const a=s.length;let u;for(n=0;n<a;n++){u=s[n];e.call(null,t[u],u,t)}}}o(ib,"forEach");function f7e(t,e){e=e.toLowerCase();const r=Object.keys(t);let n=r.length;let i;while(n-- >0){i=r[n];if(e===i.toLowerCase()){return i}}return null}o(f7e,"findKey");var h7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var m7e=o(t=>!rb(t)&&t!==h7e,"isContextDefined");function oK(){const{caseless:t}=m7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&f7e(e,i)||i;if(nx(e[s])&&nx(n)){e[s]=oK(e[s],n)}else if(nx(n)){e[s]=oK({},n)}else if(jy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&ib(arguments[n],r)}return e}o(oK,"merge");var dDt=o((t,e,r,{allOwnKeys:n}={})=>{ib(e,(i,s)=>{if(r&&Mo(i)){t[s]=c7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var pDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var fDt=o((t,e,r,n)=>{t.prototype=Object.create(e.prototype,n);t.prototype.constructor=t;Object.defineProperty(t,"super",{value:e.prototype});r&&Object.assign(t.prototype,r)},"inherits");var hDt=o((t,e,r,n)=>{let i;let s;let a;const u={};e=e||{};if(t==null)return e;do{i=Object.getOwnPropertyNames(t);s=i.length;while(s-- >0){a=i[s];if((!n||n(a,t,e))&&!u[a]){e[a]=t[a];u[a]=true}}t=r!==false&&yK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var mDt=o((t,e,r)=>{t=String(t);if(r===void 0||r>t.length){r=t.length}r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},"endsWith");var gDt=o(t=>{if(!t)return null;if(jy(t))return t;let e=t.length;if(!p7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var yDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&yK(Uint8Array));var vDt=o((t,e)=>{const r=t&&t[Symbol.iterator];const n=r.call(t);let i;while((i=n.next())&&!i.done){const s=i.value;e.call(t,s[0],s[1])}},"forEachEntry");var _Dt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var EDt=Vl("HTMLFormElement");var bDt=o(t=>{return t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function e(r,n,i){return n.toUpperCase()+i},"replacer"))},"toCamelCase");var HTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var wDt=Vl("RegExp");var g7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};ib(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var SDt=o(t=>{g7e(t,(e,r)=>{if(Mo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Mo(n))return;e.enumerable=false;if("writable"in e){e.writable=false;return}if(!e.set){e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}}})},"freezeMethods");var TDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");jy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var ADt=o(()=>{},"noop");var xDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var nK="abcdefghijklmnopqrstuvwxyz";var zTe="0123456789";var y7e={DIGIT:zTe,ALPHA:nK,ALPHA_DIGIT:nK+nK.toUpperCase()+zTe};var CDt=o((t=16,e=y7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function RDt(t){return!!(t&&Mo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(RDt,"isSpecCompliantForm");var ODt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(lx(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=jy(n)?[]:{};ib(n,(a,u)=>{const l=r(a,i+1);!rb(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var NDt=Vl("AsyncFunction");var IDt=o(t=>t&&(lx(t)||Mo(t))&&Mo(t.then)&&Mo(t.catch),"isThenable");var fe={isArray:jy,isArrayBuffer:d7e,isBuffer:ZPt,isFormData:uDt,isArrayBufferView:eDt,isString:tDt,isNumber:p7e,isBoolean:rDt,isObject:lx,isPlainObject:nx,isUndefined:rb,isDate:nDt,isFile:iDt,isBlob:sDt,isRegExp:wDt,isFunction:Mo,isStream:oDt,isURLSearchParams:lDt,isTypedArray:yDt,isFileList:aDt,forEach:ib,merge:oK,extend:dDt,trim:cDt,stripBOM:pDt,inherits:fDt,toFlatObject:hDt,kindOf:ox,kindOfTest:Vl,endsWith:mDt,toArray:gDt,forEachEntry:vDt,matchAll:_Dt,isHTMLForm:EDt,hasOwnProperty:HTe,hasOwnProp:HTe,reduceDescriptors:g7e,freezeMethods:SDt,toObjectSet:TDt,toCamelCase:bDt,noop:ADt,toFiniteNumber:xDt,findKey:f7e,global:h7e,isContextDefined:m7e,ALPHABET:y7e,generateString:CDt,isSpecCompliantForm:RDt,toJSONObject:ODt,isAsyncFn:NDt,isThenable:IDt};function nt(t,e,r,n,i){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=new Error().stack}this.message=t;this.name="AxiosError";e&&(this.code=e);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}o(nt,"AxiosError");fe.inherits(nt,Error,{toJSON:o(function t(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}},"toJSON")});var v7e=nt.prototype;var _7e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{_7e[t]={value:t}});Object.defineProperties(nt,_7e);Object.defineProperty(v7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(v7e);fe.toFlatObject(t,a,o(function u(l){return l!==Error.prototype},"filter"),u=>{return u!=="isAxiosError"});nt.call(a,t.message,e,r,n,i);a.cause=t;a.name=t.name;s&&Object.assign(a,s);return a};function uK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(uK,"isVisitable");function E7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(E7e,"removeBrackets");function GTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=E7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(GTe,"renderKey");function PDt(t){return fe.isArray(t)&&!t.some(uK)}o(PDt,"isFlatArray");var DDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function cx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(l7e["default"]||FormData);r=fe.toFlatObject(r,{metaTokens:true,dots:false,indexes:false},false,o(function m(g,y){return!fe.isUndefined(y[g])},"defined"));const n=r.metaTokens;const i=r.visitor||d;const s=r.dots;const a=r.indexes;const u=r.Blob||typeof Blob!=="undefined"&&Blob;const l=u&&fe.isSpecCompliantForm(e);if(!fe.isFunction(i)){throw new TypeError("visitor must be a function")}function c(m){if(m===null)return"";if(fe.isDate(m)){return m.toISOString()}if(!l&&fe.isBlob(m)){throw new nt("Blob is not supported. Use a Buffer instead.")}if(fe.isArrayBuffer(m)||fe.isTypedArray(m)){return l&&typeof Blob==="function"?new Blob([m]):Buffer.from(m)}return m}o(c,"convertValue");function d(m,g,y){let v=m;if(m&&!y&&typeof m==="object"){if(fe.endsWith(g,"{}")){g=n?g:g.slice(0,-2);m=JSON.stringify(m)}else if(fe.isArray(m)&&PDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=E7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?GTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(uK(m)){return true}e.append(GTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(DDt,{defaultVisitor:d,convertValue:c,isVisitable:uK});function h(m,g){if(fe.isUndefined(m))return;if(p.indexOf(m)!==-1){throw Error("Circular reference detected in "+g.join("."))}p.push(m);fe.forEach(m,o(function y(v,w){const E=!(fe.isUndefined(v)||v===null)&&i.call(e,v,fe.isString(w)?w.trim():w,g,f);if(E===true){h(v,g?g.concat(w):[w])}},"each"));p.pop()}o(h,"build");if(!fe.isObject(t)){throw new TypeError("data must be an object")}h(t);return e}o(cx,"toFormData");function KTe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,o(function r(n){return e[n]},"replacer"))}o(KTe,"encode$1");function b7e(t,e){this._pairs=[];t&&cx(t,this,e)}o(b7e,"AxiosURLSearchParams");var w7e=b7e.prototype;w7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");w7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,KTe)}:KTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function kDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(kDt,"encode");function vK(t,e,r){if(!e){return t}const n=r&&r.encode||kDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new b7e(e,r).toString(n)}if(s){const a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+s}return t}o(vK,"buildURL");var lK=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,r,n){this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(e){fe.forEach(this.handlers,o(function r(n){if(n!==null){e(n)}},"forEachHandler"))}};var YTe=lK;var _K={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var $Dt=GPt["default"].URLSearchParams;var LDt={isNode:true,classes:{URLSearchParams:$Dt,FormData:l7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var S7e=typeof window!=="undefined"&&typeof document!=="undefined";var qDt=(t=>{return S7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var jDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var UDt=Object.freeze({__proto__:null,hasBrowserEnv:S7e,hasStandardBrowserWebWorkerEnv:jDt,hasStandardBrowserEnv:qDt});var Bo={...UDt,...LDt};function FDt(t,e){return cx(t,new Bo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Bo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(FDt,"toURLEncodedForm");function BDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(BDt,"parsePropPath");function MDt(t){const e={};const r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++){s=r[n];e[s]=t[s]}return e}o(MDt,"arrayToObject");function T7e(t){function e(r,n,i,s){let a=r[s++];const u=Number.isFinite(+a);const l=s>=r.length;a=!a&&fe.isArray(i)?i.length:a;if(l){if(fe.hasOwnProp(i,a)){i[a]=[i[a],n]}else{i[a]=n}return!u}if(!i[a]||!fe.isObject(i[a])){i[a]=[]}const c=e(r,n,i[a],s);if(c&&fe.isArray(i[a])){i[a]=MDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(BDt(n),i,r,0)});return r}return null}o(T7e,"formDataToJSON");function VDt(t,e,r){if(fe.isString(t)){try{(e||JSON.parse)(t);return fe.trim(t)}catch(n){if(n.name!=="SyntaxError"){throw n}}}return(r||JSON.stringify)(t)}o(VDt,"stringifySafely");var EK={transitional:_K,adapter:["xhr","http"],transformRequest:[o(function t(e,r){const n=r.getContentType()||"";const i=n.indexOf("application/json")>-1;const s=fe.isObject(e);if(s&&fe.isHTMLForm(e)){e=new FormData(e)}const a=fe.isFormData(e);if(a){if(!i){return e}return i?JSON.stringify(T7e(e)):e}if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)){return e}if(fe.isArrayBufferView(e)){return e.buffer}if(fe.isURLSearchParams(e)){r.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1){return FDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return cx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return VDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||EK.transitional;const n=r&&r.forcedJSONParsing;const i=this.responseType==="json";if(e&&fe.isString(e)&&(n&&!this.responseType||i)){const s=r&&r.silentJSONParsing;const a=!s&&i;try{return JSON.parse(e)}catch(u){if(a){if(u.name==="SyntaxError"){throw nt.from(u,nt.ERR_BAD_RESPONSE,this,null,this.response)}throw u}}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bo.classes.FormData,Blob:Bo.classes.Blob},validateStatus:o(function t(e){return e>=200&&e<300},"validateStatus"),headers:{common:{"Accept":"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{EK.headers[t]={}});var bK=EK;var HDt=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var zDt=o(t=>{const e={};let r;let n;let i;t&&t.split("\n").forEach(o(function s(a){i=a.indexOf(":");r=a.substring(0,i).trim().toLowerCase();n=a.substring(i+1).trim();if(!r||e[r]&&HDt[r]){return}if(r==="set-cookie"){if(e[r]){e[r].push(n)}else{e[r]=[n]}}else{e[r]=e[r]?e[r]+", "+n:n}},"parser"));return e},"parseHeaders");var WTe=Symbol("internals");function eb(t){return t&&String(t).trim().toLowerCase()}o(eb,"normalizeHeader");function ix(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(ix):String(t)}o(ix,"normalizeValue");function GDt(t){const e=Object.create(null);const r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;while(n=r.exec(t)){e[n[1]]=n[2]}return e}o(GDt,"parseTokens");var KDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function iK(t,e,r,n,i){if(fe.isFunction(n)){return n.call(this,e,r)}if(i){e=r}if(!fe.isString(e))return;if(fe.isString(n)){return e.indexOf(n)!==-1}if(fe.isRegExp(n)){return n.test(e)}}o(iK,"matchHeaderValue");function YDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(YDt,"formatHeader");function WDt(t,e){const r=fe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:true})})}o(WDt,"buildAccessors");var $y=class{static{o(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(u,l,c){const d=eb(l);if(!d){throw new Error("header name must be a non-empty string")}const p=fe.findKey(i,d);if(!p||i[p]===void 0||c===true||c===void 0&&i[p]!==false){i[p||l]=ix(u)}}o(s,"setHeader");const a=o((u,l)=>fe.forEach(u,(c,d)=>s(c,d,l)),"setHeaders");if(fe.isPlainObject(e)||e instanceof this.constructor){a(e,r)}else if(fe.isString(e)&&(e=e.trim())&&!KDt(e)){a(zDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=eb(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return GDt(i)}if(fe.isFunction(r)){return r.call(this,i,n)}if(fe.isRegExp(r)){return r.exec(i)}throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){e=eb(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||iK(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=eb(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||iK(n,n[u],u,r))){delete n[u];i=true}}}o(s,"deleteHeader");if(fe.isArray(e)){e.forEach(s)}else{s(e)}return i}clear(e){const r=Object.keys(this);let n=r.length;let i=false;while(n--){const s=r[n];if(!e||iK(this,this[s],s,e,true)){delete this[s];i=true}}return i}normalize(e){const r=this;const n={};fe.forEach(this,(i,s)=>{const a=fe.findKey(n,s);if(a){r[a]=ix(i);delete r[s];return}const u=e?YDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=ix(i);n[u]=true});return this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);fe.forEach(this,(n,i)=>{n!=null&&n!==false&&(r[i]=e&&fe.isArray(n)?n.join(", "):n)});return r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);r.forEach(i=>n.set(i));return n}static accessor(e){const r=this[WTe]=this[WTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=eb(a);if(!n[u]){WDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};$y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors($y.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods($y);var Vo=$y;function sK(t,e){const r=this||bK;const n=e||r;const i=Vo.from(n.headers);let s=n.data;fe.forEach(t,o(function a(u){s=u.call(r,s,i.normalize(),e?e.status:void 0)},"transform"));i.normalize();return s}o(sK,"transformData");function A7e(t){return!!(t&&t.__CANCEL__)}o(A7e,"isCancel");function Pm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Pm,"CanceledError");fe.inherits(Pm,nt,{__CANCEL__:true});function tb(t,e,r){const n=r.config.validateStatus;if(!r.status||!n||n(r.status)){t(r)}else{e(new nt("Request failed with status code "+r.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}}o(tb,"settle");function JDt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(JDt,"isAbsoluteURL");function QDt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(QDt,"combineURLs");function wK(t,e){if(t&&!JDt(e)){return QDt(t,e)}return e}o(wK,"buildFullPath");var ax="1.6.2";function x7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(x7e,"parseProtocol");var XDt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ZDt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=x7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=XDt.exec(t);if(!s){throw new nt("Invalid URL",nt.ERR_INVALID_URL)}const a=s[1];const u=s[2];const l=s[3];const c=Buffer.from(decodeURIComponent(l),u?"base64":"utf8");if(e){if(!n){throw new nt("Blob is not supported",nt.ERR_NOT_SUPPORT)}return new n([c],{type:a})}return c}throw new nt("Unsupported protocol "+i,nt.ERR_NOT_SUPPORT)}o(ZDt,"fromDataURI");function ekt(t,e){let r=0;const n=1e3/e;let i=null;return o(function s(a,u){const l=Date.now();if(a||l-r>n){if(i){clearTimeout(i);i=null}r=l;return t.apply(null,u)}if(!i){i=setTimeout(()=>{i=null;r=Date.now();return t.apply(null,u)},n-(l-r))}},"throttled")}o(ekt,"throttle");function C7e(t,e){t=t||10;const r=new Array(t);const n=new Array(t);let i=0;let s=0;let a;e=e!==void 0?e:1e3;return o(function u(l){const c=Date.now();const d=n[s];if(!a){a=c}r[i]=l;n[i]=c;let p=s;let f=0;while(p!==i){f+=r[p++];p=p%t}i=(i+1)%t;if(i===s){s=(s+1)%t}if(c-a<e){return}const h=d&&c-d;return h?Math.round(f*1e3/h):void 0},"push")}o(C7e,"speedometer");var rx=Symbol("internals");var cK=class extends pf["default"].Transform{static{o(this,"AxiosTransformStream")}constructor(e){e=fe.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(u,l)=>{return!fe.isUndefined(l[u])});super({readableHighWaterMark:e.chunkSize});const r=this;const n=this[rx]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:false,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};const i=C7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=ekt(o(function u(){const l=n.length;const c=n.bytesSeen;const d=c-s;if(!d||r.destroyed)return;const p=i(d);s=c;process.nextTick(()=>{r.emit("progress",{"loaded":c,"total":l,"progress":l?c/l:void 0,"bytes":d,"rate":p?p:void 0,"estimated":p&&l&&c<=l?(l-c)/p:void 0})})},"throttledHandler"),n.ticksRate);const a=o(()=>{n.updateProgress(true)},"onFinish");this.once("end",a);this.once("error",a)}_read(e){const r=this[rx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[rx];const a=s.maxRate;const u=this.readableHighWaterMark;const l=s.timeWindow;const c=1e3/l;const d=a/c;const p=s.minChunkSize!==false?Math.max(s.minChunkSize,d*.01):0;function f(m,g){const y=Buffer.byteLength(m);s.bytesSeen+=y;s.bytes+=y;if(s.isCaptured){s.updateProgress()}if(i.push(m)){process.nextTick(g)}else{s.onReadCallback=()=>{s.onReadCallback=null;process.nextTick(g)}}}o(f,"pushChunk");const h=o((m,g)=>{const y=Buffer.byteLength(m);let v=null;let w=u;let E;let b=0;if(a){const S=Date.now();if(!s.ts||(b=S-s.ts)>=l){s.ts=S;E=d-s.bytes;s.bytes=E<0?-E:0;b=0}E=d-s.bytes}if(a){if(E<=0){return setTimeout(()=>{g(null,m)},l-b)}if(E<w){w=E}}if(w&&y>w&&y-w>p){v=m.subarray(w);m=m.subarray(0,w)}f(m,v?()=>{process.nextTick(g,null,v)}:g)},"transformChunk");h(e,o(function m(g,y){if(g){return n(g)}if(y){h(y,m)}else{n(null)}},"transformNextChunk"))}setLength(e){this[rx].length=+e;return this}};var JTe=cK;var{asyncIterator:QTe}=Symbol;var tkt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[QTe]){yield*t[QTe]()}else{yield t}},"readBlob");var R7e=tkt;var rkt=fe.ALPHABET.ALPHA_DIGIT+"-_";var nb=new o7e.TextEncoder;var ff="\r\n";var nkt=nb.encode(ff);var ikt=2;var dK=class{static{o(this,"FormDataPart")}constructor(e,r){const{escapeName:n}=this.constructor;const i=fe.isString(r);let s=`Content-Disposition: form-data; name="${n(e)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${ff}`;if(i){r=nb.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=nb.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+ikt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*R7e(e)}yield nkt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var skt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,rkt)}=r||{};if(!fe.isFormData(t)){throw TypeError("FormData instance required")}if(s.length<1||s.length>70){throw Error("boundary must be 10-70 characters long")}const a=nb.encode("--"+s+ff);const u=nb.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new dK(p,f);l+=h.size;return h});l+=a.byteLength*c.length;l=fe.toFiniteNumber(l);const d={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(l)){d["Content-Length"]=l}e&&e(d);return u7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var akt=skt;var pK=class extends pf["default"].Transform{static{o(this,"ZlibHeaderTransformStream")}__transform(e,r,n){this.push(e);n()}_transform(e,r,n){if(e.length!==0){this._transform=this.__transform;if(e[0]!==120){const i=Buffer.alloc(2);i[0]=120;i[1]=156;this.push(i,r)}}this.__transform(e,r,n)}};var okt=pK;var ukt=o((t,e)=>{return fe.isAsyncFn(t)?function(...r){const n=r.pop();t.apply(this,r).then(i=>{try{e?n(null,...e(i)):n(null,i)}catch(s){n(s)}},n)}:t},"callbackify");var lkt=ukt;var XTe={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var ckt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var ZTe=fe.isFunction(hf["default"].createBrotliDecompress);var{http:dkt,https:pkt}=JPt["default"];var fkt=/https:?/;var e7e=Bo.protocols.map(t=>{return t+":"});function hkt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(hkt,"dispatchBeforeRedirect");function O7e(t,e,r){let n=e;if(!n&&n!==false){const i=FPt.getProxyForUrl(r);if(i){n=new URL(i)}}if(n){if(n.username){n.auth=(n.username||"")+":"+(n.password||"")}if(n.auth){if(n.auth.username||n.auth.password){n.auth=(n.auth.username||"")+":"+(n.auth.password||"")}const s=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+s}t.headers.host=t.hostname+(t.port?":"+t.port:"");const i=n.hostname||n.host;t.hostname=i;t.host=i;t.port=n.port;t.path=r;if(n.protocol){t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`}}t.beforeRedirects.proxy=o(function i(s){O7e(s,e,s.href)},"beforeRedirect")}o(O7e,"setProxy");var mkt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var gkt=o(t=>{return new Promise((e,r)=>{let n;let i;const s=o((l,c)=>{if(i)return;i=true;n&&n(l,c)},"done");const a=o(l=>{s(l);e(l)},"_resolve");const u=o(l=>{s(l,true);r(l)},"_reject");t(a,u,l=>n=l).catch(u)})},"wrapAsync");var ykt=o(({address:t,family:e})=>{if(!fe.isString(t)){throw TypeError("address must be a string")}return{address:t,family:e||(t.indexOf(".")<0?6:4)}},"resolveFamily");var t7e=o((t,e)=>ykt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var vkt=mkt&&o(function t(e){return gkt(o(async function r(n,i,s){let{data:a,lookup:u,family:l}=e;const{responseType:c,responseEncoding:d}=e;const p=e.method.toUpperCase();let f;let h=false;let m;if(u){const ue=lkt(u,Ae=>fe.isArray(Ae)?Ae:[Ae]);u=o((Ae,we,Pe)=>{ue(Ae,we,(Ue,$e,ge)=>{const Je=fe.isArray($e)?$e.map(Le=>t7e(Le)):[t7e($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new QPt["default"];const y=o(()=>{if(e.cancelToken){e.cancelToken.unsubscribe(v)}if(e.signal){e.signal.removeEventListener("abort",v)}g.removeAllListeners()},"onFinished");s((ue,Ae)=>{f=true;if(Ae){h=true;y()}});function v(ue){g.emit("abort",!ue||ue.type?new Pm(null,e,m):ue)}o(v,"abort");g.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(v);if(e.signal){e.signal.aborted?v():e.signal.addEventListener("abort",v)}}const w=wK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||e7e[0];if(b==="data:"){let ue;if(p!=="GET"){return tb(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=ZDt(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(Ae){throw nt.from(Ae,nt.ERR_BAD_REQUEST,e)}if(c==="text"){ue=ue.toString(d);if(!d||d==="utf8"){ue=fe.stripBOM(ue)}}else if(c==="stream"){ue=pf["default"].Readable.from(ue)}return tb(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(e7e.indexOf(b)===-1){return i(new nt("Unsupported protocol "+b,nt.ERR_BAD_REQUEST,e))}const S=Vo.from(e.headers).normalize();S.set("User-Agent","axios/"+ax,false);const T=e.onDownloadProgress;const A=e.onUploadProgress;const P=e.maxRate;let D=void 0;let F=void 0;if(fe.isSpecCompliantForm(a)){const ue=S.getContentType(/boundary=([-_\w\d]{10,70})/i);a=akt(a,Ae=>{S.set(Ae)},{tag:`axios-${ax}-boundary`,boundary:ue&&ue[1]||void 0})}else if(fe.isFormData(a)&&fe.isFunction(a.getHeaders)){S.set(a.getHeaders());if(!S.hasContentLength()){try{const ue=await WPt["default"].promisify(a.getLength).call(a);Number.isFinite(ue)&&ue>=0&&S.setContentLength(ue)}catch(ue){}}}else if(fe.isBlob(a)){a.size&&S.setContentType(a.type||"application/octet-stream");S.setContentLength(a.size||0);a=pf["default"].Readable.from(R7e(a))}else if(a&&!fe.isStream(a)){if(Buffer.isBuffer(a));else if(fe.isArrayBuffer(a)){a=Buffer.from(new Uint8Array(a))}else if(fe.isString(a)){a=Buffer.from(a,"utf-8")}else{return i(new nt("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",nt.ERR_BAD_REQUEST,e))}S.setContentLength(a.length,false);if(e.maxBodyLength>-1&&a.length>e.maxBodyLength){return i(new nt("Request body larger than maxBodyLength limit",nt.ERR_BAD_REQUEST,e))}}const V=fe.toFiniteNumber(S.getContentLength());if(fe.isArray(P)){D=P[0];F=P[1]}else{D=F=P}if(a&&(A||D)){if(!fe.isStream(a)){a=pf["default"].Readable.from(a,{objectMode:false})}a=pf["default"].pipeline([a,new JTe({length:V,maxRate:fe.toFiniteNumber(D)})],fe.noop);A&&a.on("progress",ue=>{A(Object.assign(ue,{upload:true}))})}let j=void 0;if(e.auth){const ue=e.auth.username||"";const Ae=e.auth.password||"";j=ue+":"+Ae}if(!j&&E.username){const ue=E.username;const Ae=E.password;j=ue+":"+Ae}j&&S.delete("authorization");let Q;try{Q=vK(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ue){const Ae=new Error(ue.message);Ae.config=e;Ae.url=e.url;Ae.exists=true;return i(Ae)}S.set("Accept-Encoding","gzip, compress, deflate"+(ZTe?", br":""),false);const ae={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:b,family:l,beforeRedirect:hkt,beforeRedirects:{}};!fe.isUndefined(u)&&(ae.lookup=u);if(e.socketPath){ae.socketPath=e.socketPath}else{ae.hostname=E.hostname;ae.port=E.port;O7e(ae,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+ae.path)}let Te;const le=fkt.test(ae.protocol);ae.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?YPt["default"]:KPt["default"]}else{if(e.maxRedirects){ae.maxRedirects=e.maxRedirects}if(e.beforeRedirect){ae.beforeRedirects.config=e.beforeRedirect}Te=le?pkt:dkt}if(e.maxBodyLength>-1){ae.maxBodyLength=e.maxBodyLength}else{ae.maxBodyLength=Infinity}if(e.insecureHTTPParser){ae.insecureHTTPParser=e.insecureHTTPParser}m=Te.request(ae,o(function ue(Ae){if(m.destroyed)return;const we=[Ae];const Pe=+Ae.headers["content-length"];if(T){const Le=new JTe({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(F)});T&&Le.on("progress",Ie=>{T(Object.assign(Ie,{download:true}))});we.push(Le)}let Ue=Ae;const $e=Ae.req||m;if(e.decompress!==false&&Ae.headers["content-encoding"]){if(p==="HEAD"||Ae.statusCode===204){delete Ae.headers["content-encoding"]}switch((Ae.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":we.push(hf["default"].createUnzip(XTe));delete Ae.headers["content-encoding"];break;case"deflate":we.push(new okt);we.push(hf["default"].createUnzip(XTe));delete Ae.headers["content-encoding"];break;case"br":if(ZTe){we.push(hf["default"].createBrotliDecompress(ckt));delete Ae.headers["content-encoding"]}}}Ue=we.length>1?pf["default"].pipeline(we,fe.noop):we[0];const ge=pf["default"].finished(Ue,()=>{ge();y()});const Je={status:Ae.statusCode,statusText:Ae.statusMessage,headers:new Vo(Ae.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;tb(n,i,Je)}else{const Le=[];let Ie=0;Ue.on("data",o(function Qe(qe){Le.push(qe);Ie+=qe.length;if(e.maxContentLength>-1&&Ie>e.maxContentLength){h=true;Ue.destroy();i(new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e))}},"handleStreamData"));Ue.on("aborted",o(function Qe(){if(h){return}const qe=new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e);Ue.destroy(qe);i(qe)},"handlerStreamAborted"));Ue.on("error",o(function Qe(qe){if(m.destroyed)return;i(nt.from(qe,null,e,$e))},"handleStreamError"));Ue.on("end",o(function Qe(){try{let qe=Le.length===1?Le[0]:Buffer.concat(Le);if(c!=="arraybuffer"){qe=qe.toString(d);if(!d||d==="utf8"){qe=fe.stripBOM(qe)}}Je.data=qe}catch(qe){return i(nt.from(qe,null,e,Je.request,Je))}tb(n,i,Je)},"handleStreamEnd"))}g.once("abort",Le=>{if(!Ue.destroyed){Ue.emit("error",Le);Ue.destroy()}})},"handleResponse"));g.once("abort",ue=>{i(ue);m.destroy(ue)});m.on("error",o(function ue(Ae){i(nt.from(Ae,null,e,m))},"handleRequestError"));m.on("socket",o(function ue(Ae){Ae.setKeepAlive(true,1e3*60)},"handleRequestSocket"));if(e.timeout){const ue=parseInt(e.timeout,10);if(Number.isNaN(ue)){i(new nt("error trying to parse `config.timeout` to int",nt.ERR_BAD_OPTION_VALUE,e,m));return}m.setTimeout(ue,o(function Ae(){if(f)return;let we=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const Pe=e.transitional||_K;if(e.timeoutErrorMessage){we=e.timeoutErrorMessage}i(new nt(we,Pe.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,m));v()},"handleRequestTimeout"))}if(fe.isStream(a)){let ue=false;let Ae=false;a.on("end",()=>{ue=true});a.once("error",we=>{Ae=true;m.destroy(we)});a.on("close",()=>{if(!ue&&!Ae){v(new Pm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var _kt=Bo.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];fe.isNumber(r)&&a.push("expires="+new Date(r).toGMTString());fe.isString(n)&&a.push("path="+n);fe.isString(i)&&a.push("domain="+i);s===true&&a.push("secure");document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Ekt=Bo.hasStandardBrowserEnv?o(function t(){const e=/(msie|trident)/i.test(navigator.userAgent);const r=document.createElement("a");let n;function i(s){let a=s;if(e){r.setAttribute("href",a);a=r.href}r.setAttribute("href",a);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}o(i,"resolveURL");n=i(window.location.href);return o(function s(a){const u=fe.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():o(function t(){return o(function e(){return true},"isURLSameOrigin")},"nonStandardBrowserEnv")();function r7e(t,e){let r=0;const n=C7e(50,250);return i=>{const s=i.loaded;const a=i.lengthComputable?i.total:void 0;const u=s-r;const l=n(u);const c=s<=a;r=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:u,rate:l?l:void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:i};d[e?"download":"upload"]=true;t(d)}}o(r7e,"progressEventReducer");var bkt=typeof XMLHttpRequest!=="undefined";var wkt=bkt&&function(t){return new Promise(o(function e(r,n){let i=t.data;const s=Vo.from(t.headers).normalize();let{responseType:a,withXSRFToken:u}=t;let l;function c(){if(t.cancelToken){t.cancelToken.unsubscribe(l)}if(t.signal){t.signal.removeEventListener("abort",l)}}o(c,"done");let d;if(fe.isFormData(i)){if(Bo.hasStandardBrowserEnv||Bo.hasStandardBrowserWebWorkerEnv){s.setContentType(false)}else if((d=s.getContentType())!==false){const[g,...y]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"";const y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=wK(t.baseURL,t.url);p.open(t.method.toUpperCase(),vK(f,t.params,t.paramsSerializer),true);p.timeout=t.timeout;function h(){if(!p){return}const g=Vo.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());const y=!a||a==="text"||a==="json"?p.responseText:p.response;const v={data:y,status:p.status,statusText:p.statusText,headers:g,config:t,request:p};tb(o(function w(E){r(E);c()},"_resolve"),o(function w(E){n(E);c()},"_reject"),v);p=null}o(h,"onloadend");if("onloadend"in p){p.onloadend=h}else{p.onreadystatechange=o(function g(){if(!p||p.readyState!==4){return}if(p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)){return}setTimeout(h)},"handleLoad")}p.onabort=o(function g(){if(!p){return}n(new nt("Request aborted",nt.ECONNABORTED,t,p));p=null},"handleAbort");p.onerror=o(function g(){n(new nt("Network Error",nt.ERR_NETWORK,t,p));p=null},"handleError");p.ontimeout=o(function g(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const v=t.transitional||_K;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Bo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&Ekt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&_kt.read(t.xsrfCookieName);if(g){s.set(t.xsrfHeaderName,g)}}}i===void 0&&s.setContentType(null);if("setRequestHeader"in p){fe.forEach(s.toJSON(),o(function g(y,v){p.setRequestHeader(v,y)},"setRequestHeader"))}if(!fe.isUndefined(t.withCredentials)){p.withCredentials=!!t.withCredentials}if(a&&a!=="json"){p.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){p.addEventListener("progress",r7e(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",r7e(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Pm(null,t,p):g);p.abort();p=null},"onCanceled");t.cancelToken&&t.cancelToken.subscribe(l);if(t.signal){t.signal.aborted?l():t.signal.addEventListener("abort",l)}}const m=x7e(f);if(m&&Bo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var fK={http:vkt,xhr:wkt};fe.forEach(fK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var n7e=o(t=>`- ${t}`,"renderReason");var Skt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var N7e={getAdapter:t=>{t=fe.isArray(t)?t:[t];const{length:e}=t;let r;let n;const i={};for(let s=0;s<e;s++){r=t[s];let a;n=r;if(!Skt(r)){n=fK[(a=String(r)).toLowerCase()];if(n===void 0){throw new nt(`Unknown adapter '${a}'`)}}if(n){break}i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(([u,l])=>`adapter ${u} `+(l===false?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?"since :\n"+s.map(n7e).join("\n"):" "+n7e(s[0]):"as no adapter specified";throw new nt(`There is no suitable adapter to dispatch the request `+a,"ERR_NOT_SUPPORT")}return n},adapters:fK};function aK(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Pm(null,t)}}o(aK,"throwIfCancellationRequested");function i7e(t){aK(t);t.headers=Vo.from(t.headers);t.data=sK.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=N7e.getAdapter(t.adapter||bK.adapter);return e(t).then(o(function r(n){aK(t);n.data=sK.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!A7e(n)){aK(t);if(n&&n.response){n.response.data=sK.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(i7e,"dispatchRequest");var s7e=o(t=>t instanceof Vo?t.toJSON():t,"headersToObject");function Ly(t,e){e=e||{};const r={};function n(c,d,p){if(fe.isPlainObject(c)&&fe.isPlainObject(d)){return fe.merge.call({caseless:p},c,d)}else if(fe.isPlainObject(d)){return fe.merge({},d)}else if(fe.isArray(d)){return d.slice()}return d}o(n,"getMergedValue");function i(c,d,p){if(!fe.isUndefined(d)){return n(c,d,p)}else if(!fe.isUndefined(c)){return n(void 0,c,p)}}o(i,"mergeDeepProperties");function s(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}}o(s,"valueFromConfig2");function a(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}else if(!fe.isUndefined(c)){return n(void 0,c)}}o(a,"defaultToConfig2");function u(c,d,p){if(p in e){return n(c,d)}else if(p in t){return n(void 0,c)}}o(u,"mergeDirectKeys");const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u,headers:(c,d)=>i(s7e(c),s7e(d),true)};fe.forEach(Object.keys(Object.assign({},t,e)),o(function c(d){const p=l[d]||i;const f=p(t[d],e[d],d);fe.isUndefined(f)&&p!==u||(r[d]=f)},"computeConfigValue"));return r}o(Ly,"mergeConfig");var SK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{SK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var a7e={};SK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+ax+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}o(i,"formatMessage");return(s,a,u)=>{if(e===false){throw new nt(i(a," has been removed"+(r?" in "+r:"")),nt.ERR_DEPRECATED)}if(r&&!a7e[a]){a7e[a]=true;console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))}return e?e(s,a,u):true}},"transitional");function Tkt(t,e,r){if(typeof t!=="object"){throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE)}const n=Object.keys(t);let i=n.length;while(i-- >0){const s=n[i];const a=e[s];if(a){const u=t[s];const l=u===void 0||a(u,s,t);if(l!==true){throw new nt("option "+s+" must be "+l,nt.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new nt("Unknown option "+s,nt.ERR_BAD_OPTION)}}}o(Tkt,"assertOptions");var hK={assertOptions:Tkt,validators:SK};var df=hK.validators;var qy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new YTe,response:new YTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=Ly(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){hK.assertOptions(n,{silentJSONParsing:df.transitional(df.boolean),forcedJSONParsing:df.transitional(df.boolean),clarifyTimeoutError:df.transitional(df.boolean)},false)}if(i!=null){if(fe.isFunction(i)){r.paramsSerializer={serialize:i}}else{hK.assertOptions(i,{encode:df.function,serialize:df.function},true)}}r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]});r.headers=Vo.concat(a,s);const u=[];let l=true;this.interceptors.request.forEach(o(function m(g){if(typeof g.runWhen==="function"&&g.runWhen(r)===false){return}l=l&&g.synchronous;u.unshift(g.fulfilled,g.rejected)},"unshiftRequestInterceptors"));const c=[];this.interceptors.response.forEach(o(function m(g){c.push(g.fulfilled,g.rejected)},"pushResponseInterceptors"));let d;let p=0;let f;if(!l){const m=[i7e.bind(this),void 0];m.unshift.apply(m,u);m.push.apply(m,c);f=m.length;d=Promise.resolve(r);while(p<f){d=d.then(m[p++],m[p++])}return d}f=u.length;let h=r;p=0;while(p<f){const m=u[p++];const g=u[p++];try{h=m(h)}catch(y){g.call(this,y);break}}try{d=i7e.call(this,h)}catch(m){return Promise.reject(m)}p=0;f=c.length;while(p<f){d=d.then(c[p++],c[p++])}return d}getUri(e){e=Ly(this.defaults,e);const r=wK(e.baseURL,e.url);return vK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){qy.prototype[e]=function(r,n){return this.request(Ly(n||{},{method:e,url:r,data:(n||{}).data}))}},"forEachMethodNoData"));fe.forEach(["post","put","patch"],o(function t(e){function r(n){return o(function i(s,a,u){return this.request(Ly(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");qy.prototype[e]=r();qy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var sx=qy;var mK=class t{static{o(this,"CancelToken")}constructor(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}let r;this.promise=new Promise(o(function i(s){r=s},"promiseExecutor"));const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;while(s-- >0){n._listeners[s](i)}n._listeners=null});this.promise.then=i=>{let s;const a=new Promise(u=>{n.subscribe(u);s=u}).then(i);a.cancel=o(function u(){n.unsubscribe(s)},"reject");return a};e(o(function i(s,a,u){if(n.reason){return}n.reason=new Pm(s,a,u);r(n.reason)},"cancel"))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const r=this._listeners.indexOf(e);if(r!==-1){this._listeners.splice(r,1)}}static source(){let e;const r=new t(o(function n(i){e=i},"executor"));return{token:r,cancel:e}}};var Akt=mK;function xkt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(xkt,"spread");function Ckt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Ckt,"isAxiosError");var gK={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(gK).forEach(([t,e])=>{gK[e]=t});var Rkt=gK;function I7e(t){const e=new sx(t);const r=c7e(sx.prototype.request,e);fe.extend(r,sx.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return I7e(Ly(t,i))},"create");return r}o(I7e,"createInstance");var fi=I7e(bK);fi.Axios=sx;fi.CanceledError=Pm;fi.CancelToken=Akt;fi.isCancel=A7e;fi.VERSION=ax;fi.toFormData=cx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=xkt;fi.isAxiosError=Ckt;fi.mergeConfig=Ly;fi.AxiosHeaders=Vo;fi.formToJSON=t=>T7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=N7e.getAdapter;fi.HttpStatusCode=Rkt;fi.default=fi;P7e.exports=fi});var fx=_(px=>{"use strict";Object.defineProperty(px,"__esModule",{value:true});px.CredentialsMethod=void 0;var D7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(D7e||(px.CredentialsMethod=D7e={}))});var km=_(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:true});hi.FgaRequiredParamError=hi.FgaValidationError=hi.FgaApiAuthenticationError=hi.FgaApiInternalError=hi.FgaApiRateLimitExceededError=hi.FgaApiNotFoundError=hi.FgaApiValidationError=hi.FgaApiError=hi.FgaError=void 0;var Uy=class extends Error{static{o(this,"FgaError")}constructor(e,r){super(r||typeof e==="string"?e:`FGA Error${(e===null||e===void 0?void 0:e.message)?`: ${e.message}`:""}`);this.name="FgaError";if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaError=Uy;function mx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(mx,"getRequestMetadataFromPath");var k7e="fga-request-id";function NK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(NK,"getResponseHeaders");var Dm=class extends Uy{static{o(this,"FgaApiError")}constructor(e,r){var n,i,s,a,u,l,c,d,p,f;super(r?r:e);this.name="FgaApiError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestData=(s=e.config)===null||s===void 0?void 0:s.data;this.requestURL=(a=e.config)===null||a===void 0?void 0:a.url;this.method=(u=e.config)===null||u===void 0?void 0:u.method;const{storeId:h,endpointCategory:m}=mx((l=e.request)===null||l===void 0?void 0:l.path);this.storeId=h;this.endpointCategory=m;this.apiErrorMessage=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message;this.responseData=(p=e.response)===null||p===void 0?void 0:p.data;this.responseHeader=(f=e.response)===null||f===void 0?void 0:f.headers;const g=NK(e);this.requestId=g[k7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=Dm;var TK=class extends Dm{static{o(this,"FgaApiValidationError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiValidationError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:p}=mx((s=e.request)===null||s===void 0?void 0:s.path);this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Validation Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiValidationError=TK;var AK=class extends Dm{static{o(this,"FgaApiNotFoundError")}constructor(e,r){var n,i,s,a,u,l,c;super(e);this.name="FgaApiNotFoundError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;this.message=r?r:((a=(s=e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)?`FGA API NotFound Error: ${(u=e.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=e.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:e.message}};hi.FgaApiNotFoundError=AK;var xK=class extends Dm{static{o(this,"FgaApiRateLimitExceededError")}constructor(e,r){var n,i,s;super(e);this.name="FgaApiRateLimitExceededError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:a}=mx((s=e.request)===null||s===void 0?void 0:s.path);const u=NK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=xK;var CK=class extends Dm{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=mx((n=e.request)===null||n===void 0?void 0:n.path);this.apiErrorCode=(s=(i=e.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.code;this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Internal Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiInternalError=CK;var RK=class extends Uy{static{o(this,"FgaApiAuthenticationError")}constructor(e){var r,n,i,s,a,u,l,c,d,p;super(`FGA Authentication Error.${((r=e.response)===null||r===void 0?void 0:r.statusText)?` ${e.response.statusText}`:""}`);this.name="FgaApiAuthenticationError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestURL=(s=e.config)===null||s===void 0?void 0:s.url;this.method=(a=e.config)===null||a===void 0?void 0:a.method;this.responseData=(u=e.response)===null||u===void 0?void 0:u.data;this.responseHeader=(l=e.response)===null||l===void 0?void 0:l.headers;this.apiErrorCode=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.code;const f=NK(e);this.requestId=f[k7e];let h;try{h=JSON.parse(((p=e.config)===null||p===void 0?void 0:p.data)||"{}")}catch(m){}this.clientId=h===null||h===void 0?void 0:h.client_id;this.audience=h===null||h===void 0?void 0:h.audience;this.grantType=h===null||h===void 0?void 0:h.grant_type;if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiAuthenticationError=RK;var hx=class extends Uy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=hx;var OK=class extends hx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=OK});var sb=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var Okt=km();var Nkt=o(function(t,e,r){if(r===null||r===void 0){throw new Okt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=Nkt;var Ikt=o(t=>{try{const e=new URL(t);return(e.toString()===t||e.toString()===`${t}/`)&&(e.protocol==="https:"||e.protocol==="http:")}catch(e){return false}},"isWellFormedUriString");mf.isWellFormedUriString=Ikt;var Pkt=o(t=>{var e;const r=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;return!!(typeof t==="string"&&((e=t.match(r))===null||e===void 0?void 0:e.length))},"isWellFormedUlidString");mf.isWellFormedUlidString=Pkt});var PK=_(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:true});Fy.Configuration=Fy.GetDefaultRetryParams=void 0;var ab=fx();var IK=km();var gx=sb();var Dkt=15;var kkt=100;var $kt="openfga-sdk js/0.3.0";function Lkt(t=Dkt,e=kkt){return{maxRetry:t,minWaitInMs:e}}o(Lkt,"GetDefaultRetryParams");Fy.GetDefaultRetryParams=Lkt;var yx=class{static{o(this,"Configuration")}constructor(e={}){this.apiScheme="https";this.getBasePath=()=>`${this.apiScheme}://${this.apiHost}`;this.apiScheme=e.apiScheme||this.apiScheme;this.apiHost=e.apiHost;this.storeId=e.storeId;const r=e.credentials;if(r){switch(r===null||r===void 0?void 0:r.method){case ab.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case ab.CredentialsMethod.ClientCredentials:this.credentials={method:ab.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case ab.CredentialsMethod.None:default:this.credentials={method:ab.CredentialsMethod.None};break}}const n=e.baseOptions||{};n.headers=n.headers||{};if(typeof process==="object"&&process.title==="node"&&!n.headers["User-Agent"]){n.headers["User-Agent"]=$kt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,gx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,gx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,gx.isWellFormedUriString)(this.getBasePath())){throw new IK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,gx.isWellFormedUlidString)(this.storeId)){throw new IK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new IK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};Fy.Configuration=yx;yx.sdkVersion="0.3.0"});var $7e=_(vx=>{"use strict";Object.defineProperty(vx,"__esModule",{value:true});vx.assertNever=void 0;function qkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(qkt,"assertNever");vx.assertNever=qkt});var L7e=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:true});_x.chunkArray=void 0;function jkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(jkt,"chunkArray");_x.chunkArray=jkt});var j7e=_(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:true});By.generateRandomIdWithNonUniqueFallback=By.generateRandomId=void 0;var Ex=require("crypto");function q7e(){if(typeof Ex.randomUUID==="function"){return(0,Ex.randomUUID)()}if(typeof Ex.randomBytes==="function"){return(0,Ex.randomBytes)(20).toString("hex")}return}o(q7e,"generateRandomId");By.generateRandomId=q7e;function Ukt(){return q7e()||"00000000-0000-0000-0000-000000000000"}o(Ukt,"generateRandomIdWithNonUniqueFallback");By.generateRandomIdWithNonUniqueFallback=Ukt});var U7e=_(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:true});bx.setHeaderIfNotSet=void 0;function Fkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Fkt,"setHeaderIfNotSet");bx.setHeaderIfNotSet=Fkt});var F7e=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.setNotEnumerableProperty=void 0;function Bkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(Bkt,"setNotEnumerableProperty");wx.setNotEnumerableProperty=Bkt});var DK=_(Pu=>{"use strict";var Mkt=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var ob=Pu&&Pu.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Mkt(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:true});ob($7e(),Pu);ob(L7e(),Pu);ob(j7e(),Pu);ob(U7e(),Pu);ob(F7e(),Pu)});var $K=_(yi=>{"use strict";var kK=yi&&yi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(yi,"__esModule",{value:true});yi.createRequestFunction=yi.attemptHttpRequest=yi.toPathString=yi.serializeDataIfNeeded=yi.setSearchParams=yi.setBearerAuthToObject=yi.DUMMY_BASE_URL=void 0;var Vkt=Sx();var $m=km();var Hkt=DK();yi.DUMMY_BASE_URL="https://example.com";var zkt=o(function(t,e){return kK(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=zkt;var Gkt=o(function(t,...e){const r=new URLSearchParams(t.search);for(const n of e){for(const i in n){if(Array.isArray(n[i])){r.delete(i);for(const s of n[i]){r.append(i,s)}}else{r.set(i,n[i])}}}t.search=r.toString()},"setSearchParams");yi.setSearchParams=Gkt;var Kkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Ykt=o(function(t,e){const r=typeof t!=="string";const n=r?Kkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Ykt;var Wkt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Wkt;function Jkt(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(Jkt,"isAxiosError");function Qkt(t,e){const r=Math.ceil(Math.pow(2,t)*e);const n=Math.ceil(Math.pow(2,t+1)*e);return Math.floor(Math.random()*(n-r)+r)}o(Qkt,"randomTime");function B7e(t,e,r){var n;return kK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!Jkt(s)){throw new $m.FgaError(s)}const a=(n=s===null||s===void 0?void 0:s.response)===null||n===void 0?void 0:n.status;if(a===400||a===422){throw new $m.FgaApiValidationError(s)}else if(a===401||a===403){throw new $m.FgaApiAuthenticationError(s)}else if(a===404){throw new $m.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new $m.FgaApiRateLimitExceededError(s)}else{throw new $m.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,Qkt(i,e.minWaitInMs)))}else{throw new $m.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(B7e,"attemptHttpRequest");yi.attemptHttpRequest=B7e;var Xkt=o(function(t,e,r,n){var i,s;r.isValid();const a=((i=t.options)===null||i===void 0?void 0:i.retryParams)?(s=t.options)===null||s===void 0?void 0:s.retryParams:r.retryParams;const u=a?a.maxRetry:0;const l=a?a.minWaitInMs:0;if(!n){n=Vkt.Credentials.init(r)}return(c=e)=>kK(this,void 0,void 0,function*(){yield(0,yi.setBearerAuthToObject)(t.options.headers,n);const d=Object.assign(Object.assign({},t.options),{url:r.getBasePath()+t.url});const p=yield B7e(d,{maxRetry:u,minWaitInMs:l},c);const f=typeof(p===null||p===void 0?void 0:p.data)==="undefined"?{}:p===null||p===void 0?void 0:p.data;const h=Object.assign({},f);(0,Hkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=Xkt});var V7e=_(My=>{"use strict";var LK=My&&My.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(My,"__esModule",{value:true});My.Credentials=void 0;var M7e=dx();var gf=sb();var qK=km();var Zkt=$K();var Ho=fx();var jK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=M7e.default){this.authConfig=e;this.axios=r;this.initConfig();this.isValid()}initConfig(){var e;switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.ApiToken:if(this.authConfig.config){if(!this.authConfig.config.headerName){this.authConfig.config.headerName="Authorization"}if(!this.authConfig.config.headerValuePrefix){this.authConfig.config.headerValuePrefix="Bearer"}}break;case Ho.CredentialsMethod.ClientCredentials:case Ho.CredentialsMethod.None:default:break}}isValid(){var e,r,n,i,s,a,u,l,c;const{authConfig:d}=this;switch(d===null||d===void 0?void 0:d.method){case Ho.CredentialsMethod.None:break;case Ho.CredentialsMethod.ApiToken:(0,gf.assertParamExists)("Credentials","config.token",(e=d.config)===null||e===void 0?void 0:e.token);(0,gf.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName);(0,gf.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case Ho.CredentialsMethod.ClientCredentials:(0,gf.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId);(0,gf.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret);(0,gf.assertParamExists)("Credentials","config.apiTokenIssuer",(a=d.config)===null||a===void 0?void 0:a.apiTokenIssuer);(0,gf.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience);if(!(0,gf.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`)){throw new qK.FgaValidationError(`Configuration.apiTokenIssuer does not form a valid URI (https://${(c=d.config)===null||c===void 0?void 0:c.apiTokenIssuer})`)}break}}getAccessTokenHeader(){var e;return LK(this,void 0,void 0,function*(){const r=yield this.getAccessTokenValue();switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case Ho.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var e;return LK(this,void 0,void 0,function*(){switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return this.authConfig.config.token;case Ho.CredentialsMethod.ClientCredentials:if(this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)){return this.accessToken}return this.refreshAccessToken()}})}refreshAccessToken(){var e;return LK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,Zkt.attemptHttpRequest)({url:`https://${r.apiTokenIssuer}/oauth/token`,method:"post",data:{client_id:r.clientId,client_secret:r.clientSecret,audience:r.apiAudience,grant_type:"client_credentials"}},{maxRetry:3,minWaitInMs:100},M7e.default);if(n){this.accessToken=n.data.access_token;this.accessTokenExpiryDate=new Date(Date.now()+n.data.expires_in*1e3)}return this.accessToken}catch(n){if(n instanceof qK.FgaApiError){n.constructor=qK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};My.Credentials=jK});var Sx=_(yf=>{"use strict";var e$t=yf&&yf.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var H7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))e$t(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});H7e(V7e(),yf);H7e(fx(),yf)});var FK=_(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:true});Tx.BaseAPI=void 0;var t$t=dx();var r$t=require("http");var n$t=require("https");var z7e=PK();var i$t=Sx();var s$t=1e4;var UK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof z7e.Configuration){this.configuration=e}else{this.configuration=new z7e.Configuration(e)}this.configuration.isValid();this.credentials=i$t.Credentials.init(this.configuration);if(!this.axios){const i=new r$t.Agent({keepAlive:true});const s=new n$t.Agent({keepAlive:true});this.axios=t$t.default.create({httpAgent:i,httpsAgent:s,timeout:s$t,headers:(n=this.configuration.baseOptions)===null||n===void 0?void 0:n.headers})}}get storeId(){return this.configuration.storeId}set storeId(e){this.configuration.storeId=e}};Tx.BaseAPI=UK});var MK=_(tn=>{"use strict";var Zr=tn&&tn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(tn,"__esModule",{value:true});tn.OpenFgaApi=tn.OpenFgaApiFactory=tn.OpenFgaApiFp=tn.OpenFgaApiAxiosParamCreator=void 0;var zs=dx();var a$t=FK();var We=$K();var Vn=sb();var o$t=o(function(t,e){return{check:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("check","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/check".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),createStore:(r,n={})=>Zr(this,void 0,void 0,function*(){const i="/stores";const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),deleteStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"DELETE"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),expand:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("expand","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/expand".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),getStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"GET"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),listObjects:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("listObjects","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/list-objects".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),listStores:(r,n,i={})=>Zr(this,void 0,void 0,function*(){const s="/stores";const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),read:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("read","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/read".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),readAssertions:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAuthorizationModel","id",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models/{id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModels:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),readChanges:(r,n,i,s={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const a="/stores/{store_id}/changes".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const u=new URL(a,We.DUMMY_BASE_URL);let l;if(t){l=t.baseOptions}const c=Object.assign(Object.assign({method:"GET"},l),s);const d={};const p={};if(r!==void 0){p["type"]=r}if(n!==void 0){p["page_size"]=n}if(i!==void 0){p["continuation_token"]=i}(0,We.setSearchParams)(u,p,s.query);c.headers=Object.assign(Object.assign({},d),s.headers);return{url:(0,We.toPathString)(u),options:c}}),write:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("write","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/write".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),writeAssertions:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("writeAssertions","body",n);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"PUT"},u),i);const c={};const d={};c["Content-Type"]="application/json";(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);l.data=(0,We.serializeDataIfNeeded)(n,l);return{url:(0,We.toPathString)(a),options:l}}),writeAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAuthorizationModel","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}})}},"OpenFgaApiAxiosParamCreator");tn.OpenFgaApiAxiosParamCreator=o$t;var u$t=o(function(t,e){const r=(0,tn.OpenFgaApiAxiosParamCreator)(t,e);return{check(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.check(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},createStore(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.createStore(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},deleteStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.deleteStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},expand(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.expand(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},getStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.getStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},listObjects(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.listObjects(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},listStores(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.listStores(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},read(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.read(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAssertions(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAssertions(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModels(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.readAuthorizationModels(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},readChanges(n,i,s,a){return Zr(this,void 0,void 0,function*(){const u=yield r.readChanges(n,i,s,a);return(0,We.createRequestFunction)(u,zs.default,t,e)})},write(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.write(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},writeAssertions(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.writeAssertions(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},writeAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.writeAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})}}},"OpenFgaApiFp");tn.OpenFgaApiFp=u$t;var l$t=o(function(t,e,r){const n=(0,tn.OpenFgaApiFp)(t,e);return{check(i,s){return n.check(i,s).then(a=>a(r))},createStore(i,s){return n.createStore(i,s).then(a=>a(r))},deleteStore(i){return n.deleteStore(i).then(s=>s(r))},expand(i,s){return n.expand(i,s).then(a=>a(r))},getStore(i){return n.getStore(i).then(s=>s(r))},listObjects(i,s){return n.listObjects(i,s).then(a=>a(r))},listStores(i,s,a){return n.listStores(i,s,a).then(u=>u(r))},read(i,s){return n.read(i,s).then(a=>a(r))},readAssertions(i,s){return n.readAssertions(i,s).then(a=>a(r))},readAuthorizationModel(i,s){return n.readAuthorizationModel(i,s).then(a=>a(r))},readAuthorizationModels(i,s,a){return n.readAuthorizationModels(i,s,a).then(u=>u(r))},readChanges(i,s,a,u){return n.readChanges(i,s,a,u).then(l=>l(r))},write(i,s){return n.write(i,s).then(a=>a(r))},writeAssertions(i,s,a){return n.writeAssertions(i,s,a).then(u=>u(r))},writeAuthorizationModel(i,s){return n.writeAuthorizationModel(i,s).then(a=>a(r))}}},"OpenFgaApiFactory");tn.OpenFgaApiFactory=l$t;var BK=class extends a$t.BaseAPI{static{o(this,"OpenFgaApi")}check(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).check(e,r).then(n=>n(this.axios))}createStore(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).createStore(e,r).then(n=>n(this.axios))}deleteStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).deleteStore(e).then(r=>r(this.axios))}expand(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).expand(e,r).then(n=>n(this.axios))}getStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).getStore(e).then(r=>r(this.axios))}listObjects(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listObjects(e,r).then(n=>n(this.axios))}listStores(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listStores(e,r,n).then(i=>i(this.axios))}read(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).read(e,r).then(n=>n(this.axios))}readAssertions(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAssertions(e,r).then(n=>n(this.axios))}readAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModel(e,r).then(n=>n(this.axios))}readAuthorizationModels(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModels(e,r,n).then(i=>i(this.axios))}readChanges(e,r,n,i){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readChanges(e,r,n,i).then(s=>s(this.axios))}write(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).write(e,r).then(n=>n(this.axios))}writeAssertions(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAssertions(e,r,n).then(i=>i(this.axios))}writeAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAuthorizationModel(e,r).then(n=>n(this.axios))}};tn.OpenFgaApi=BK});var K7e=_((Rmr,G7e)=>{async function*c$t(t,e,r){const n=new Set;async function i(){const[s,a]=await Promise.race(n);n.delete(s);return a}o(i,"consume");for(const s of e){const a=(async()=>await r(s,e))().then(u=>[a,u]);n.add(a);if(n.size>=t){yield await i()}}while(n.size){yield await i()}}o(c$t,"asyncPool");G7e.exports=c$t});var Y7e=_(Hl=>{"use strict";var Hn=Hl&&Hl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};var VK=Hl&&Hl.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values==="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(a){return new Promise(function(u,l){a=t[s](a),i(u,l,a.done,a.value)})}}o(n,"verb");function i(s,a,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},a)}o(i,"settle")};Object.defineProperty(Hl,"__esModule",{value:true});Hl.OpenFgaClient=Hl.ClientWriteStatus=void 0;var HK=K7e();var d$t=MK();var p$t=FK();var zK=km();var Aa=DK();var f$t=sb();var GK=10;var Vy="X-OpenFGA-Client-Method";var KK="X-OpenFGA-Client-Bulk-Request-Id";var Hy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(Hy||(Hl.ClientWriteStatus=Hy={}));var YK=class extends p$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new d$t.OpenFgaApi(this.configuration,r);this.authorizationModelId=e.authorizationModelId;this.getAuthorizationModelId()}getAuthorizationModelId(e={}){const r=(e===null||e===void 0?void 0:e.authorizationModelId)||this.authorizationModelId;if(r&&!(0,f$t.isWellFormedUlidString)(r)){throw new zK.FgaValidationError("authorizationModelId")}return r}checkValidApiConnection(e={}){return Hn(this,void 0,void 0,function*(){if(this.getAuthorizationModelId(e)){yield this.readAuthorizationModel(e)}else{yield this.readLatestAuthorizationModel(e)}})}listStores(e={}){return Hn(this,void 0,void 0,function*(){return this.api.listStores(e.pageSize,e.continuationToken,e)})}createStore(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.createStore(e,r)})}getStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.getStore(e)})}deleteStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.deleteStore(e)})}readAuthorizationModels(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAuthorizationModels(e.pageSize,e.continuationToken,e)})}writeAuthorizationModel(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAuthorizationModel(e,r)})}readAuthorizationModel(e={}){return Hn(this,void 0,void 0,function*(){const r=this.getAuthorizationModelId(e);if(!r){throw new zK.FgaRequiredParamError("ClientConfiguration","authorizationModelId")}return this.api.readAuthorizationModel(r,e)})}readLatestAuthorizationModel(e={}){var r;return Hn(this,void 0,void 0,function*(){const{headers:n={}}=e;(0,Aa.setHeaderIfNotSet)(n,Vy,"ReadLatestAuthorizationModel");const i=yield this.readAuthorizationModels(Object.assign(Object.assign({},e),{pageSize:1,headers:n}));const s=i;s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0];delete s.authorization_models;return s})}readChanges(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.readChanges(e.type,r.pageSize,r.continuationToken,r)})}read(e={},r={}){return Hn(this,void 0,void 0,function*(){const n={page_size:r.pageSize,continuation_token:r.continuationToken};if(e.user||e.object||e.relation){n.tuple_key=e}return this.api.read(n,r)})}write(e,r={}){return Hn(this,void 0,void 0,function*(){const{transaction:n={},headers:i={}}=r;const{maxPerChunk:s=1,maxParallelRequests:a=GK}=n;const{writes:u,deletes:l}=e;const c=this.getAuthorizationModelId(r);if(!(n===null||n===void 0?void 0:n.disable)){const d={authorization_model_id:c};if(u===null||u===void 0?void 0:u.length){d.writes={tuple_keys:u}}if(l===null||l===void 0?void 0:l.length){d.deletes={tuple_keys:l}}yield this.api.write(d,r);return{writes:(u===null||u===void 0?void 0:u.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Aa.setHeaderIfNotSet)(i,Vy,"Write");(0,Aa.setHeaderIfNotSet)(i,KK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=VK(HK(a,(0,Aa.chunkArray)(u,s),F=>this.writeTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V})),deletes:[]})))),S;S=yield b.next(),d=S.done,!d;E=true){h=S.value;E=false;const F=h;w.push(F.writes)}}catch(F){p={error:F}}finally{try{if(!E&&!d&&(f=b.return))yield f.call(b)}finally{if(p)throw p.error}}}const T=[];if(l===null||l===void 0?void 0:l.length){try{for(var A=true,P=VK(HK(a,(0,Aa.chunkArray)(l,s),F=>this.deleteTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:[],deletes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V}))})))),D;D=yield P.next(),m=D.done,!m;A=true){v=D.value;A=false;const F=v;T.push(F.deletes)}}catch(F){g={error:F}}finally{try{if(!A&&!m&&(y=P.return))yield y.call(P)}finally{if(g)throw g.error}}}return{writes:w.flat(),deletes:T.flat()}}))(),this.checkValidApiConnection(r)]).then(d=>d[0])})}writeTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"WriteTuples");return this.write({writes:e},Object.assign(Object.assign({},r),{headers:n}))})}deleteTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"DeleteTuples");return this.write({deletes:e},Object.assign(Object.assign({},r),{headers:n}))})}check(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:e.user,relation:e.relation,object:e.object},context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(e,r={}){return Hn(this,void 0,void 0,function*(){return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var n,i,s,a;const{headers:u={},maxParallelRequests:l=GK}=r;(0,Aa.setHeaderIfNotSet)(u,Vy,"BatchCheck");(0,Aa.setHeaderIfNotSet)(u,KK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=VK(HK(l,e,h=>this.check(h,Object.assign(Object.assign({},r),{headers:u})).then(m=>{m._request=h;return m}).catch(m=>{return{allowed:void 0,error:m,_request:h}}))),f;f=yield p.next(),n=f.done,!n;d=true){a=f.value;d=false;const h=a;c.push(h)}}catch(h){i={error:h}}finally{try{if(!d&&!n&&(s=p.return))yield s.call(p)}finally{if(i)throw i.error}}return{responses:c}}))(),this.checkValidApiConnection(r)]).then(n=>n[0])})}expand(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:e},r)})}listObjects(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:e.user,relation:e.relation,type:e.type,context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]}},r)})}listRelations(e,r={}){return Hn(this,void 0,void 0,function*(){const{user:n,object:i,relations:s,contextualTuples:a,context:u}=e;const{headers:l={},maxParallelRequests:c=GK}=r;(0,Aa.setHeaderIfNotSet)(l,Vy,"ListRelations");(0,Aa.setHeaderIfNotSet)(l,KK,(0,Aa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new zK.FgaValidationError("relations","When calling listRelations, at least one relation must be passed in the relations field")}const d=yield this.batchCheck(s.map(f=>({user:n,relation:f,object:i,contextualTuples:a,context:u})),Object.assign(Object.assign({},r),{headers:l,maxParallelRequests:c}));const p=d.responses.find(f=>f.error);if(p){throw p.error}return{relations:d.responses.filter(f=>f.allowed).map(f=>f._request.relation)}})}readAssertions(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAssertions(this.getAuthorizationModelId(e),e)})}writeAssertions(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAssertions(this.getAuthorizationModelId(r),{assertions:e.map(n=>({tuple_key:{user:n.user,relation:n.relation,object:n.object},expectation:n.expectation}))},r)})}};Hl.OpenFgaClient=YK});var tAe=_(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:true});xa.TypeName=xa.TupleOperation=xa.NullValue=xa.NotFoundErrorCode=xa.InternalErrorCode=xa.ErrorCode=void 0;var W7e;(function(t){t["NoError"]="no_error";t["ValidationError"]="validation_error";t["AuthorizationModelNotFound"]="authorization_model_not_found";t["AuthorizationModelResolutionTooComplex"]="authorization_model_resolution_too_complex";t["InvalidWriteInput"]="invalid_write_input";t["CannotAllowDuplicateTuplesInOneRequest"]="cannot_allow_duplicate_tuples_in_one_request";t["CannotAllowDuplicateTypesInOneRequest"]="cannot_allow_duplicate_types_in_one_request";t["CannotAllowMultipleReferencesToOneRelation"]="cannot_allow_multiple_references_to_one_relation";t["InvalidContinuationToken"]="invalid_continuation_token";t["InvalidTupleSet"]="invalid_tuple_set";t["InvalidCheckInput"]="invalid_check_input";t["InvalidExpandInput"]="invalid_expand_input";t["UnsupportedUserSet"]="unsupported_user_set";t["InvalidObjectFormat"]="invalid_object_format";t["WriteFailedDueToInvalidInput"]="write_failed_due_to_invalid_input";t["AuthorizationModelAssertionsNotFound"]="authorization_model_assertions_not_found";t["LatestAuthorizationModelNotFound"]="latest_authorization_model_not_found";t["TypeNotFound"]="type_not_found";t["RelationNotFound"]="relation_not_found";t["EmptyRelationDefinition"]="empty_relation_definition";t["InvalidUser"]="invalid_user";t["InvalidTuple"]="invalid_tuple";t["UnknownRelation"]="unknown_relation";t["StoreIdInvalidLength"]="store_id_invalid_length";t["AssertionsTooManyItems"]="assertions_too_many_items";t["IdTooLong"]="id_too_long";t["AuthorizationModelIdTooLong"]="authorization_model_id_too_long";t["TupleKeyValueNotSpecified"]="tuple_key_value_not_specified";t["TupleKeysTooManyOrTooFewItems"]="tuple_keys_too_many_or_too_few_items";t["PageSizeInvalid"]="page_size_invalid";t["ParamMissingValue"]="param_missing_value";t["DifferenceBaseMissingValue"]="difference_base_missing_value";t["SubtractBaseMissingValue"]="subtract_base_missing_value";t["ObjectTooLong"]="object_too_long";t["RelationTooLong"]="relation_too_long";t["TypeDefinitionsTooFewItems"]="type_definitions_too_few_items";t["TypeInvalidLength"]="type_invalid_length";t["TypeInvalidPattern"]="type_invalid_pattern";t["RelationsTooFewItems"]="relations_too_few_items";t["RelationsTooLong"]="relations_too_long";t["RelationsInvalidPattern"]="relations_invalid_pattern";t["ObjectInvalidPattern"]="object_invalid_pattern";t["QueryStringTypeContinuationTokenMismatch"]="query_string_type_continuation_token_mismatch";t["ExceededEntityLimit"]="exceeded_entity_limit";t["InvalidContextualTuple"]="invalid_contextual_tuple";t["DuplicateContextualTuple"]="duplicate_contextual_tuple";t["InvalidAuthorizationModel"]="invalid_authorization_model";t["UnsupportedSchemaVersion"]="unsupported_schema_version"})(W7e||(xa.ErrorCode=W7e={}));var J7e;(function(t){t["NoInternalError"]="no_internal_error";t["InternalError"]="internal_error";t["Cancelled"]="cancelled";t["DeadlineExceeded"]="deadline_exceeded";t["AlreadyExists"]="already_exists";t["ResourceExhausted"]="resource_exhausted";t["FailedPrecondition"]="failed_precondition";t["Aborted"]="aborted";t["OutOfRange"]="out_of_range";t["Unavailable"]="unavailable";t["DataLoss"]="data_loss"})(J7e||(xa.InternalErrorCode=J7e={}));var Q7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(Q7e||(xa.NotFoundErrorCode=Q7e={}));var X7e;(function(t){t["NullValue"]="NULL_VALUE"})(X7e||(xa.NullValue=X7e={}));var Z7e;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(Z7e||(xa.TupleOperation=Z7e={}));var eAe;(function(t){t["Unspecified"]="TYPE_NAME_UNSPECIFIED";t["Any"]="TYPE_NAME_ANY";t["Bool"]="TYPE_NAME_BOOL";t["String"]="TYPE_NAME_STRING";t["Int"]="TYPE_NAME_INT";t["Uint"]="TYPE_NAME_UINT";t["Double"]="TYPE_NAME_DOUBLE";t["Duration"]="TYPE_NAME_DURATION";t["Timestamp"]="TYPE_NAME_TIMESTAMP";t["Map"]="TYPE_NAME_MAP";t["List"]="TYPE_NAME_LIST";t["Ipaddress"]="TYPE_NAME_IPADDRESS"})(eAe||(xa.TypeName=eAe={}))});var iAe=_($i=>{"use strict";var h$t=$i&&$i.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var Ax=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))h$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Ax(MK(),$i);Ax(Y7e(),$i);Ax(tAe(),$i);var rAe=PK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return rAe.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return rAe.GetDefaultRetryParams}});var nAe=Sx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return nAe.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return nAe.CredentialsMethod}});Ax(km(),$i)});var aAe=_(zy=>{"use strict";var m$t=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zy,"__esModule",{value:true});zy.OpenFGAService=void 0;var ub=m$t(za());var sAe=iAe();var g$t=Ry();var WK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!ub.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=ub.default.OPENFGA_SERVICE_URL;this.apiHost=ub.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=ub.default.OPENFGA_STORE_ID;this.modelId=ub.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,g$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new sAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:sAe.CredentialsMethod.ApiToken,config:{token:e}}})}return this.openFGAClient}async createAccountMember(e){try{const r=await this.getOpenFgaClient();await r.write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${e}`}]})}catch(r){this.logger.warn(`RBAC failed to create account membership. Error: ${r.message}`)}}async getAccountMemberships(){const e=await this.getOpenFgaClient();const r=await e.listObjects({user:`user:${this.userSub}`,relation:"member",type:"account"});if(r){return r.objects.map(n=>n.replace(/^(account:)/,""))}return[]}async isAccountMember(e){try{const r=await this.getOpenFgaClient();const{allowed:n}=await r.check({user:`user:${this.userSub}`,relation:"member",object:`account:${e}`});if(!n){return false}return n}catch(r){this.logger.warn(`RBAC failed to check account membership. Error: ${r.message}`);return false}}async isZuploAdmin(){try{const e=await this.getOpenFgaClient();const{tuples:r}=await e.read({object:"role:zuplo-admin"});const n=[];r.forEach(i=>{const s=i.key.user.replace(/^(user:)/,"");n.push(s)});return n.includes(this.userSub)}catch(e){this.logger.warn(`RBAC failed to check for zuplo admin. Error: ${e.message}`);return false}}async isDeployerServiceAccount(){try{const e=await this.getOpenFgaClient();const{tuples:r}=await e.read({object:"role:zuplo-deployer"});const n=[];r.forEach(i=>{const s=i.key.user.replace(/^(user:)/,"");n.push(s)});return n.includes(this.userSub)}catch(e){this.logger.warn(`RBAC failed to check for zuplo deployer. Error: ${e.message}`);return false}}async createProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({writes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to create account-project association. Error: ${n.message}`)}}async deleteProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({deletes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to delete account-project association. Error: ${n.message}`)}}};zy.OpenFGAService=WK});var lAe=_(Gy=>{"use strict";var uAe=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.TenantService=void 0;var y$t=uAe(Vu());var oAe=uAe(za());var v$t=ex();var _$t=new y$t.default({max:500,maxAge:1e3*60*50});var JK=class extends v$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!oAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(oAe.default.TENANT_API_URL,_$t,{userSub:n,logger:e.log,requestId:e.id})}};Gy.TenantService=JK});var cAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function E$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(E$t,"sizeInBytes");zl.sizeInBytes=E$t;function b$t(t){if(!t||t===null){return""}return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(e=>e.toLowerCase()).join("_")}o(b$t,"snakeCase");zl.snakeCase=b$t;function w$t(t){if(!t||t===null){return""}const e=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);if(e===null){return""}return e.map(r=>r.toLowerCase()).join("-")}o(w$t,"kebabCase");zl.kebabCase=w$t;function S$t(t){try{const e=/^(?!https?:\/\/)([a-zA-Z0-9.-]*|(\*))*\.[a-zA-Z]+$/;if(t&&!e.test(t)){return false}return true}catch(e){}return false}o(S$t,"validateHostname");zl.validateHostname=S$t});var fAe=_(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:true});G.Type=G.JsonType=G.JavaScriptTypeBuilder=G.JsonTypeBuilder=G.TypeBuilder=G.TypeBuilderError=G.TransformEncodeBuilder=G.TransformDecodeBuilder=G.TemplateLiteralDslParser=G.TemplateLiteralGenerator=G.TemplateLiteralGeneratorError=G.TemplateLiteralFinite=G.TemplateLiteralFiniteError=G.TemplateLiteralParser=G.TemplateLiteralParserError=G.TemplateLiteralResolver=G.TemplateLiteralPattern=G.TemplateLiteralPatternError=G.UnionResolver=G.KeyArrayResolver=G.KeyArrayResolverError=G.KeyResolver=G.ObjectMap=G.Intrinsic=G.IndexedAccessor=G.TypeClone=G.TypeExtends=G.TypeExtendsResult=G.TypeExtendsError=G.ExtendsUndefined=G.TypeGuard=G.TypeGuardUnknownTypeError=G.ValueGuard=G.FormatRegistry=G.TypeBoxError=G.TypeRegistry=G.PatternStringExact=G.PatternNumberExact=G.PatternBooleanExact=G.PatternString=G.PatternNumber=G.PatternBoolean=G.Kind=G.Hint=G.Optional=G.Readonly=G.Transform=void 0;G.Transform=Symbol.for("TypeBox.Transform");G.Readonly=Symbol.for("TypeBox.Readonly");G.Optional=Symbol.for("TypeBox.Optional");G.Hint=Symbol.for("TypeBox.Hint");G.Kind=Symbol.for("TypeBox.Kind");G.PatternBoolean="(true|false)";G.PatternNumber="(0|[1-9][0-9]*)";G.PatternString="(.*)";G.PatternBooleanExact=`^${G.PatternBoolean}$`;G.PatternNumberExact=`^${G.PatternNumber}$`;G.PatternStringExact=`^${G.PatternString}$`;var QK;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(QK||(G.TypeRegistry=QK={}));var Du=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Du;var dAe;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(dAe||(G.FormatRegistry=dAe={}));var Me;(function(t){function e(c){return Array.isArray(c)}o(e,"IsArray");t.IsArray=e;function r(c){return typeof c==="bigint"}o(r,"IsBigInt");t.IsBigInt=r;function n(c){return typeof c==="boolean"}o(n,"IsBoolean");t.IsBoolean=n;function i(c){return c===null}o(i,"IsNull");t.IsNull=i;function s(c){return typeof c==="number"}o(s,"IsNumber");t.IsNumber=s;function a(c){return typeof c==="object"&&c!==null}o(a,"IsObject");t.IsObject=a;function u(c){return typeof c==="string"}o(u,"IsString");t.IsString=u;function l(c){return c===void 0}o(l,"IsUndefined");t.IsUndefined=l})(Me||(G.ValueGuard=Me={}));var XK=class extends Du{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=XK;var Y;(function(t){function e(x){try{new RegExp(x);return true}catch{return false}}o(e,"IsPattern");function r(x){if(!Me.IsString(x))return false;for(let ie=0;ie<x.length;ie++){const ce=x.charCodeAt(ie);if(ce>=7&&ce<=13||ce===27||ce===127){return false}}return true}o(r,"IsControlCharacterFree");function n(x){return a(x)||J(x)}o(n,"IsAdditionalProperties");function i(x){return Me.IsUndefined(x)||Me.IsBigInt(x)}o(i,"IsOptionalBigInt");function s(x){return Me.IsUndefined(x)||Me.IsNumber(x)}o(s,"IsOptionalNumber");function a(x){return Me.IsUndefined(x)||Me.IsBoolean(x)}o(a,"IsOptionalBoolean");function u(x){return Me.IsUndefined(x)||Me.IsString(x)}o(u,"IsOptionalString");function l(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)&&e(x)}o(l,"IsOptionalPattern");function c(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)}o(c,"IsOptionalFormat");function d(x){return Me.IsUndefined(x)||J(x)}o(d,"IsOptionalSchema");function p(x){return T(x,"Any")&&u(x.$id)}o(p,"TAny");t.TAny=p;function f(x){return T(x,"Array")&&x.type==="array"&&u(x.$id)&&J(x.items)&&s(x.minItems)&&s(x.maxItems)&&a(x.uniqueItems)&&d(x.contains)&&s(x.minContains)&&s(x.maxContains)}o(f,"TArray");t.TArray=f;function h(x){return T(x,"AsyncIterator")&&x.type==="AsyncIterator"&&u(x.$id)&&J(x.items)}o(h,"TAsyncIterator");t.TAsyncIterator=h;function m(x){return T(x,"BigInt")&&x.type==="bigint"&&u(x.$id)&&i(x.exclusiveMaximum)&&i(x.exclusiveMinimum)&&i(x.maximum)&&i(x.minimum)&&i(x.multipleOf)}o(m,"TBigInt");t.TBigInt=m;function g(x){return T(x,"Boolean")&&x.type==="boolean"&&u(x.$id)}o(g,"TBoolean");t.TBoolean=g;function y(x){return T(x,"Constructor")&&x.type==="constructor"&&u(x.$id)&&Me.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(y,"TConstructor");t.TConstructor=y;function v(x){return T(x,"Date")&&x.type==="Date"&&u(x.$id)&&s(x.exclusiveMaximumTimestamp)&&s(x.exclusiveMinimumTimestamp)&&s(x.maximumTimestamp)&&s(x.minimumTimestamp)&&s(x.multipleOfTimestamp)}o(v,"TDate");t.TDate=v;function w(x){return T(x,"Function")&&x.type==="function"&&u(x.$id)&&Me.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(w,"TFunction");t.TFunction=w;function E(x){return T(x,"Integer")&&x.type==="integer"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(E,"TInteger");t.TInteger=E;function b(x){return T(x,"Intersect")&&(Me.IsString(x.type)&&x.type!=="object"?false:true)&&Me.IsArray(x.allOf)&&x.allOf.every(ie=>J(ie)&&!Le(ie))&&u(x.type)&&(a(x.unevaluatedProperties)||d(x.unevaluatedProperties))&&u(x.$id)}o(b,"TIntersect");t.TIntersect=b;function S(x){return T(x,"Iterator")&&x.type==="Iterator"&&u(x.$id)&&J(x.items)}o(S,"TIterator");t.TIterator=S;function T(x,ie){return A(x)&&x[G.Kind]===ie}o(T,"TKindOf");t.TKindOf=T;function A(x){return Me.IsObject(x)&&G.Kind in x&&Me.IsString(x[G.Kind])}o(A,"TKind");t.TKind=A;function P(x){return V(x)&&Me.IsString(x.const)}o(P,"TLiteralString");t.TLiteralString=P;function D(x){return V(x)&&Me.IsNumber(x.const)}o(D,"TLiteralNumber");t.TLiteralNumber=D;function F(x){return V(x)&&Me.IsBoolean(x.const)}o(F,"TLiteralBoolean");t.TLiteralBoolean=F;function V(x){return T(x,"Literal")&&u(x.$id)&&(Me.IsBoolean(x.const)||Me.IsNumber(x.const)||Me.IsString(x.const))}o(V,"TLiteral");t.TLiteral=V;function j(x){return T(x,"Never")&&Me.IsObject(x.not)&&Object.getOwnPropertyNames(x.not).length===0}o(j,"TNever");t.TNever=j;function Q(x){return T(x,"Not")&&J(x.not)}o(Q,"TNot");t.TNot=Q;function ae(x){return T(x,"Null")&&x.type==="null"&&u(x.$id)}o(ae,"TNull");t.TNull=ae;function Te(x){return T(x,"Number")&&x.type==="number"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(Te,"TNumber");t.TNumber=Te;function le(x){return T(x,"Object")&&x.type==="object"&&u(x.$id)&&Me.IsObject(x.properties)&&n(x.additionalProperties)&&s(x.minProperties)&&s(x.maxProperties)&&Object.entries(x.properties).every(([ie,ce])=>r(ie)&&J(ce))}o(le,"TObject");t.TObject=le;function ue(x){return T(x,"Promise")&&x.type==="Promise"&&u(x.$id)&&J(x.item)}o(ue,"TPromise");t.TPromise=ue;function Ae(x){return T(x,"Record")&&x.type==="object"&&u(x.$id)&&n(x.additionalProperties)&&Me.IsObject(x.patternProperties)&&(ie=>{const ce=Object.getOwnPropertyNames(ie.patternProperties);return ce.length===1&&e(ce[0])&&Me.IsObject(ie.patternProperties)&&J(ie.patternProperties[ce[0]])})(x)}o(Ae,"TRecord");t.TRecord=Ae;function we(x){return Me.IsObject(x)&&G.Hint in x&&x[G.Hint]==="Recursive"}o(we,"TRecursive");t.TRecursive=we;function Pe(x){return T(x,"Ref")&&u(x.$id)&&Me.IsString(x.$ref)}o(Pe,"TRef");t.TRef=Pe;function Ue(x){return T(x,"String")&&x.type==="string"&&u(x.$id)&&s(x.minLength)&&s(x.maxLength)&&l(x.pattern)&&c(x.format)}o(Ue,"TString");t.TString=Ue;function $e(x){return T(x,"Symbol")&&x.type==="symbol"&&u(x.$id)}o($e,"TSymbol");t.TSymbol=$e;function ge(x){return T(x,"TemplateLiteral")&&x.type==="string"&&Me.IsString(x.pattern)&&x.pattern[0]==="^"&&x.pattern[x.pattern.length-1]==="$"}o(ge,"TTemplateLiteral");t.TTemplateLiteral=ge;function Je(x){return T(x,"This")&&u(x.$id)&&Me.IsString(x.$ref)}o(Je,"TThis");t.TThis=Je;function Le(x){return Me.IsObject(x)&&G.Transform in x}o(Le,"TTransform");t.TTransform=Le;function Ie(x){return T(x,"Tuple")&&x.type==="array"&&u(x.$id)&&Me.IsNumber(x.minItems)&&Me.IsNumber(x.maxItems)&&x.minItems===x.maxItems&&(Me.IsUndefined(x.items)&&Me.IsUndefined(x.additionalItems)&&x.minItems===0||Me.IsArray(x.items)&&x.items.every(ie=>J(ie)))}o(Ie,"TTuple");t.TTuple=Ie;function Qe(x){return T(x,"Undefined")&&x.type==="undefined"&&u(x.$id)}o(Qe,"TUndefined");t.TUndefined=Qe;function qe(x){return C(x)&&x.anyOf.every(ie=>P(ie)||D(ie))}o(qe,"TUnionLiteral");t.TUnionLiteral=qe;function C(x){return T(x,"Union")&&u(x.$id)&&Me.IsObject(x)&&Me.IsArray(x.anyOf)&&x.anyOf.every(ie=>J(ie))}o(C,"TUnion");t.TUnion=C;function N(x){return T(x,"Uint8Array")&&x.type==="Uint8Array"&&u(x.$id)&&s(x.minByteLength)&&s(x.maxByteLength)}o(N,"TUint8Array");t.TUint8Array=N;function q(x){return T(x,"Unknown")&&u(x.$id)}o(q,"TUnknown");t.TUnknown=q;function z(x){return T(x,"Unsafe")}o(z,"TUnsafe");t.TUnsafe=z;function W(x){return T(x,"Void")&&x.type==="void"&&u(x.$id)}o(W,"TVoid");t.TVoid=W;function K(x){return Me.IsObject(x)&&x[G.Readonly]==="Readonly"}o(K,"TReadonly");t.TReadonly=K;function se(x){return Me.IsObject(x)&&x[G.Optional]==="Optional"}o(se,"TOptional");t.TOptional=se;function J(x){return Me.IsObject(x)&&(p(x)||f(x)||g(x)||m(x)||h(x)||y(x)||v(x)||w(x)||E(x)||b(x)||S(x)||V(x)||j(x)||Q(x)||ae(x)||Te(x)||le(x)||ue(x)||Ae(x)||Pe(x)||Ue(x)||$e(x)||ge(x)||Je(x)||Ie(x)||Qe(x)||C(x)||N(x)||q(x)||z(x)||W(x)||A(x)&&QK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var pAe;(function(t){function e(r){return r[G.Kind]==="Intersect"?r.allOf.every(n=>e(n)):r[G.Kind]==="Union"?r.anyOf.some(n=>e(n)):r[G.Kind]==="Undefined"?true:r[G.Kind]==="Not"?!e(r.not):false}o(e,"Check");t.Check=e})(pAe||(G.ExtendsUndefined=pAe={}));var xx=class extends Du{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=xx;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var Lm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new xx(U)}o(r,"Throw");function n(U){return Y.TNever(U)||Y.TIntersect(U)||Y.TUnion(U)||Y.TUnknown(U)||Y.TAny(U)}o(n,"IsStructuralRight");function i(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):r("StructuralRight")}o(i,"StructuralRight");function s(U,$){return Ee.True}o(s,"TAnyRight");function a(U,$){return Y.TIntersect($)?w(U,$):Y.TUnion($)&&$.anyOf.some(Ye=>Y.TAny(Ye)||Y.TUnknown(Ye))?Ee.True:Y.TUnion($)?Ee.Union:Y.TUnknown($)?Ee.True:Y.TAny($)?Ee.True:Ee.Union}o(a,"TAny");function u(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)?Ee.True:Ee.False}o(u,"TArrayRight");function l(U,$){return Y.TObject($)&&ge($)?Ee.True:n($)?i(U,$):!Y.TArray($)?Ee.False:e(ft(U.items,$.items))}o(l,"TArray");function c(U,$){return n($)?i(U,$):!Y.TAsyncIterator($)?Ee.False:e(ft(U.items,$.items))}o(c,"TAsyncIterator");function d(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBigInt($)?Ee.True:Ee.False}o(d,"TBigInt");function p(U,$){return Y.TLiteral(U)&&Me.IsBoolean(U.const)?Ee.True:Y.TBoolean(U)?Ee.True:Ee.False}o(p,"TBooleanRight");function f(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBoolean($)?Ee.True:Ee.False}o(f,"TBoolean");function h(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TConstructor($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(h,"TConstructor");function m(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TDate($)?Ee.True:Ee.False}o(m,"TDate");function g(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TFunction($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(g,"TFunction");function y(U,$){return Y.TLiteral(U)&&Me.IsNumber(U.const)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(y,"TIntegerRight");function v(U,$){return Y.TInteger($)||Y.TNumber($)?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Ee.False}o(v,"TInteger");function w(U,$){return $.allOf.every(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(w,"TIntersectRight");function E(U,$){return U.allOf.some(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(E,"TIntersect");function b(U,$){return n($)?i(U,$):!Y.TIterator($)?Ee.False:e(ft(U.items,$.items))}o(b,"TIterator");function S(U,$){return Y.TLiteral($)&&$.const===U.const?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Ee.False}o(S,"TLiteral");function T(U,$){return Ee.False}o(T,"TNeverRight");function A(U,$){return Ee.True}o(A,"TNever");function P(U){let[$,Ye]=[U,0];while(true){if(!Y.TNot($))break;$=$.not;Ye+=1}return Ye%2===0?$:G.Type.Unknown()}o(P,"UnwrapTNot");function D(U,$){return Y.TNot(U)?ft(P(U),$):Y.TNot($)?ft(U,P($)):r("Invalid fallthrough for Not")}o(D,"TNot");function F(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TNull($)?Ee.True:Ee.False}o(F,"TNull");function V(U,$){return Y.TLiteralNumber(U)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(V,"TNumberRight");function j(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TInteger($)||Y.TNumber($)?Ee.True:Ee.False}o(j,"TNumber");function Q(U,$){return Object.getOwnPropertyNames(U.properties).length===$}o(Q,"IsObjectPropertyCount");function ae(U){return ge(U)}o(ae,"IsObjectStringLike");function Te(U){return Q(U,0)||Q(U,1)&&"description"in U.properties&&Y.TUnion(U.properties.description)&&U.properties.description.anyOf.length===2&&(Y.TString(U.properties.description.anyOf[0])&&Y.TUndefined(U.properties.description.anyOf[1])||Y.TString(U.properties.description.anyOf[1])&&Y.TUndefined(U.properties.description.anyOf[0]))}o(Te,"IsObjectSymbolLike");function le(U){return Q(U,0)}o(le,"IsObjectNumberLike");function ue(U){return Q(U,0)}o(ue,"IsObjectBooleanLike");function Ae(U){return Q(U,0)}o(Ae,"IsObjectBigIntLike");function we(U){return Q(U,0)}o(we,"IsObjectDateLike");function Pe(U){return ge(U)}o(Pe,"IsObjectUint8ArrayLike");function Ue(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(Ue,"IsObjectFunctionLike");function $e(U){return Q(U,0)}o($e,"IsObjectConstructorLike");function ge(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(ge,"IsObjectArrayLike");function Je(U){const $=G.Type.Function([G.Type.Any()],G.Type.Any());return Q(U,0)||Q(U,1)&&"then"in U.properties&&e(ft(U.properties["then"],$))===Ee.True}o(Je,"IsObjectPromiseLike");function Le(U,$){return ft(U,$)===Ee.False?Ee.False:Y.TOptional(U)&&!Y.TOptional($)?Ee.False:Ee.True}o(Le,"Property");function Ie(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)||Y.TLiteralString(U)&&ae($)||Y.TLiteralNumber(U)&&le($)||Y.TLiteralBoolean(U)&&ue($)||Y.TSymbol(U)&&Te($)||Y.TBigInt(U)&&Ae($)||Y.TString(U)&&ae($)||Y.TSymbol(U)&&Te($)||Y.TNumber(U)&&le($)||Y.TInteger(U)&&le($)||Y.TBoolean(U)&&ue($)||Y.TUint8Array(U)&&Pe($)||Y.TDate(U)&&we($)||Y.TConstructor(U)&&$e($)||Y.TFunction(U)&&Ue($)?Ee.True:Y.TRecord(U)&&Y.TString(C(U))?(()=>{return $[G.Hint]==="Record"?Ee.True:Ee.False})():Y.TRecord(U)&&Y.TNumber(C(U))?(()=>{return Q($,0)?Ee.True:Ee.False})():Ee.False}o(Ie,"TObjectRight");function Qe(U,$){return n($)?i(U,$):Y.TRecord($)?q(U,$):!Y.TObject($)?Ee.False:(()=>{for(const Ye of Object.getOwnPropertyNames($.properties)){if(!(Ye in U.properties))return Ee.False;if(Le(U.properties[Ye],$.properties[Ye])===Ee.False){return Ee.False}}return Ee.True})()}o(Qe,"TObject");function qe(U,$){return n($)?i(U,$):Y.TObject($)&&Je($)?Ee.True:!Y.TPromise($)?Ee.False:e(ft(U.item,$.item))}o(qe,"TPromise");function C(U){return G.PatternNumberExact in U.patternProperties?G.Type.Number():G.PatternStringExact in U.patternProperties?G.Type.String():r("Unknown record key pattern")}o(C,"RecordKey");function N(U){return G.PatternNumberExact in U.patternProperties?U.patternProperties[G.PatternNumberExact]:G.PatternStringExact in U.patternProperties?U.patternProperties[G.PatternStringExact]:r("Unable to get record value schema")}o(N,"RecordValue");function q(U,$){const[Ye,cr]=[C($),N($)];return Y.TLiteralString(U)&&Y.TNumber(Ye)&&e(ft(U,cr))===Ee.True?Ee.True:Y.TUint8Array(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TString(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TArray(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TObject(U)?(()=>{for(const vi of Object.getOwnPropertyNames(U.properties)){if(Le(cr,U.properties[vi])===Ee.False){return Ee.False}}return Ee.True})():Ee.False}o(q,"TRecordRight");function z(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TRecord($)?Ee.False:ft(N(U),N($))}o(z,"TRecord");function W(U,$){return Y.TLiteral(U)&&Me.IsString(U.const)?Ee.True:Y.TString(U)?Ee.True:Ee.False}o(W,"TStringRight");function K(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?Ee.True:Ee.False}o(K,"TString");function se(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TSymbol($)?Ee.True:Ee.False}o(se,"TSymbol");function J(U,$){return Y.TTemplateLiteral(U)?ft(rd.Resolve(U),$):Y.TTemplateLiteral($)?ft(U,rd.Resolve($)):r("Invalid fallthrough for TemplateLiteral")}o(J,"TTemplateLiteral");function x(U,$){return Y.TArray($)&&U.items!==void 0&&U.items.every(Ye=>ft(Ye,$.items)===Ee.True)}o(x,"IsArrayOfTuple");function ie(U,$){return Y.TNever(U)?Ee.True:Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Ee.False}o(ie,"TTupleRight");function ce(U,$){return n($)?i(U,$):Y.TObject($)&&ge($)?Ee.True:Y.TArray($)&&x(U,$)?Ee.True:!Y.TTuple($)?Ee.False:Me.IsUndefined(U.items)&&!Me.IsUndefined($.items)||!Me.IsUndefined(U.items)&&Me.IsUndefined($.items)?Ee.False:Me.IsUndefined(U.items)&&!Me.IsUndefined($.items)?Ee.True:U.items.every((Ye,cr)=>ft(Ye,$.items[cr])===Ee.True)?Ee.True:Ee.False}o(ce,"TTuple");function ve(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TUint8Array($)?Ee.True:Ee.False}o(ve,"TUint8Array");function je(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TVoid($)?Et(U,$):Y.TUndefined($)?Ee.True:Ee.False}o(je,"TUndefined");function Xe(U,$){return $.anyOf.some(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(Xe,"TUnionRight");function _t(U,$){return U.anyOf.every(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(_t,"TUnion");function tr(U,$){return Ee.True}o(tr,"TUnknownRight");function lr(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TAny($)?s(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Y.TArray($)?u(U,$):Y.TTuple($)?ie(U,$):Y.TObject($)?Ie(U,$):Y.TUnknown($)?Ee.True:Ee.False}o(lr,"TUnknown");function Et(U,$){return Y.TUndefined(U)?Ee.True:Y.TUndefined(U)?Ee.True:Ee.False}o(Et,"VoidRight");function xt(U,$){return Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):Y.TObject($)?Ie(U,$):Y.TVoid($)?Ee.True:Ee.False}o(xt,"TVoid");function ft(U,$){return Y.TTemplateLiteral(U)||Y.TTemplateLiteral($)?J(U,$):Y.TNot(U)||Y.TNot($)?D(U,$):Y.TAny(U)?a(U,$):Y.TArray(U)?l(U,$):Y.TBigInt(U)?d(U,$):Y.TBoolean(U)?f(U,$):Y.TAsyncIterator(U)?c(U,$):Y.TConstructor(U)?h(U,$):Y.TDate(U)?m(U,$):Y.TFunction(U)?g(U,$):Y.TInteger(U)?v(U,$):Y.TIntersect(U)?E(U,$):Y.TIterator(U)?b(U,$):Y.TLiteral(U)?S(U,$):Y.TNever(U)?A(U,$):Y.TNull(U)?F(U,$):Y.TNumber(U)?j(U,$):Y.TObject(U)?Qe(U,$):Y.TRecord(U)?z(U,$):Y.TString(U)?K(U,$):Y.TSymbol(U)?se(U,$):Y.TTuple(U)?ce(U,$):Y.TPromise(U)?qe(U,$):Y.TUint8Array(U)?ve(U,$):Y.TUndefined(U)?je(U,$):Y.TUnion(U)?_t(U,$):Y.TUnknown(U)?lr(U,$):Y.TVoid(U)?xt(U,$):r(`Unknown left type operand '${U[G.Kind]}'`)}o(ft,"Visit");function en(U,$){return ft(U,$)}o(en,"Extends");t.Extends=en})(Lm||(G.TypeExtends=Lm={}));var ct;(function(t){function e(a){const u=Object.getOwnPropertyNames(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});const l=Object.getOwnPropertySymbols(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});return{...u,...l}}o(e,"ObjectType");function r(a){return a.map(u=>n(u))}o(r,"ArrayType");function n(a){return Me.IsArray(a)?r(a):Me.IsObject(a)?e(a):a}o(n,"Visit");function i(a){return a.map(u=>s(u))}o(i,"Rest");t.Rest=i;function s(a,u={}){return{...n(a),...u}}o(s,"Type");t.Type=s})(ct||(G.TypeClone=ct={}));var ZK;(function(t){function e(h){return h.map(m=>{const{[G.Optional]:g,...y}=ct.Type(m);return y})}o(e,"OptionalUnwrap");function r(h){return h.every(m=>Y.TOptional(m))}o(r,"IsIntersectOptional");function n(h){return h.some(m=>Y.TOptional(m))}o(n,"IsUnionOptional");function i(h){return r(h.allOf)?G.Type.Optional(G.Type.Intersect(e(h.allOf))):h}o(i,"ResolveIntersect");function s(h){return n(h.anyOf)?G.Type.Optional(G.Type.Union(e(h.anyOf))):h}o(s,"ResolveUnion");function a(h){return h[G.Kind]==="Intersect"?i(h):h[G.Kind]==="Union"?s(h):h}o(a,"ResolveOptional");function u(h,m){const g=h.allOf.reduce((y,v)=>{const w=p(v,m);return w[G.Kind]==="Never"?y:[...y,w]},[]);return a(G.Type.Intersect(g))}o(u,"TIntersect");function l(h,m){const g=h.anyOf.map(y=>p(y,m));return a(G.Type.Union(g))}o(l,"TUnion");function c(h,m){const g=h.properties[m];return Me.IsUndefined(g)?G.Type.Never():G.Type.Union([g])}o(c,"TObject");function d(h,m){const g=h.items;if(Me.IsUndefined(g))return G.Type.Never();const y=g[m];if(Me.IsUndefined(y))return G.Type.Never();return y}o(d,"TTuple");function p(h,m){return h[G.Kind]==="Intersect"?u(h,m):h[G.Kind]==="Union"?l(h,m):h[G.Kind]==="Object"?c(h,m):h[G.Kind]==="Tuple"?d(h,m):G.Type.Never()}o(p,"Visit");function f(h,m,g={}){const y=m.map(v=>p(h,v.toString()));return a(G.Type.Union(y,g))}o(f,"Resolve");t.Resolve=f})(ZK||(G.IndexedAccessor=ZK={}));var Ky;(function(t){function e(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toLowerCase()}${f}`}o(e,"Uncapitalize");function r(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toUpperCase()}${f}`}o(r,"Capitalize");function n(d){return d.toUpperCase()}o(n,"Uppercase");function i(d){return d.toLowerCase()}o(i,"Lowercase");function s(d,p){const f=Wy.ParseExact(d.pattern);const h=Jy.Check(f);if(!h)return{...d,pattern:a(d.pattern,p)};const m=[...Qy.Generate(f)];const g=m.map(w=>G.Type.Literal(w));const y=u(g,p);const v=G.Type.Union(y);return G.Type.TemplateLiteral([v])}o(s,"IntrinsicTemplateLiteral");function a(d,p){return typeof d==="string"?p==="Uncapitalize"?e(d):p==="Capitalize"?r(d):p==="Uppercase"?n(d):p==="Lowercase"?i(d):d:d.toString()}o(a,"IntrinsicLiteral");function u(d,p){if(d.length===0)return[];const[f,...h]=d;return[c(f,p),...u(h,p)]}o(u,"IntrinsicRest");function l(d,p){return Y.TTemplateLiteral(d)?s(d,p):Y.TUnion(d)?G.Type.Union(u(d.anyOf,p)):Y.TLiteral(d)?G.Type.Literal(a(d.const,p)):d}o(l,"Visit");function c(d,p){return l(d,p)}o(c,"Map");t.Map=c})(Ky||(G.Intrinsic=Ky={}));var Yy;(function(t){function e(a,u){return G.Type.Intersect(a.allOf.map(l=>i(l,u)),{...a})}o(e,"TIntersect");function r(a,u){return G.Type.Union(a.anyOf.map(l=>i(l,u)),{...a})}o(r,"TUnion");function n(a,u){return u(a)}o(n,"TObject");function i(a,u){return a[G.Kind]==="Intersect"?e(a,u):a[G.Kind]==="Union"?r(a,u):a[G.Kind]==="Object"?n(a,u):a}o(i,"Visit");function s(a,u,l){return{...i(ct.Type(a),u),...l}}o(s,"Map");t.Map=s})(Yy||(G.ObjectMap=Yy={}));var Cx;(function(t){function e(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}o(e,"UnwrapPattern");function r(c,d){return c.allOf.reduce((p,f)=>[...p,...a(f,d)],[])}o(r,"TIntersect");function n(c,d){const p=c.anyOf.map(f=>a(f,d));return[...p.reduce((f,h)=>h.map(m=>p.every(g=>g.includes(m))?f.add(m):f)[0],new Set)]}o(n,"TUnion");function i(c,d){return Object.getOwnPropertyNames(c.properties)}o(i,"TObject");function s(c,d){return d.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}o(s,"TRecord");function a(c,d){return Y.TIntersect(c)?r(c,d):Y.TUnion(c)?n(c,d):Y.TObject(c)?i(c,d):Y.TRecord(c)?s(c,d):[]}o(a,"Visit");function u(c,d){return[...new Set(a(c,d))]}o(u,"ResolveKeys");t.ResolveKeys=u;function l(c){const d=u(c,{includePatterns:true});const p=d.map(f=>`(${e(f)})`);return`^(${p.join("|")})$`}o(l,"ResolvePattern");t.ResolvePattern=l})(Cx||(G.KeyResolver=Cx={}));var Rx=class extends Du{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Rx;var lb;(function(t){function e(r){return Array.isArray(r)?r:Y.TUnionLiteral(r)?r.anyOf.map(n=>n.const.toString()):Y.TLiteral(r)?[r.const]:Y.TTemplateLiteral(r)?(()=>{const n=Wy.ParseExact(r.pattern);if(!Jy.Check(n))throw new Rx("Cannot resolve keys from infinite template expression");return[...Qy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(lb||(G.KeyArrayResolver=lb={}));var eY;(function(t){function*e(n){for(const i of n.anyOf){if(i[G.Kind]==="Union"){yield*e(i)}else{yield i}}}o(e,"TUnion");function r(n){return G.Type.Union([...e(n)],{...n})}o(r,"Resolve");t.Resolve=r})(eY||(G.UnionResolver=eY={}));var Ox=class extends Du{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Ox;var Nx;(function(t){function e(s){throw new Ox(s)}o(e,"Throw");function r(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(r,"Escape");function n(s,a){return Y.TTemplateLiteral(s)?s.pattern.slice(1,s.pattern.length-1):Y.TUnion(s)?`(${s.anyOf.map(u=>n(u,a)).join("|")})`:Y.TNumber(s)?`${a}${G.PatternNumber}`:Y.TInteger(s)?`${a}${G.PatternNumber}`:Y.TBigInt(s)?`${a}${G.PatternNumber}`:Y.TString(s)?`${a}${G.PatternString}`:Y.TLiteral(s)?`${a}${r(s.const.toString())}`:Y.TBoolean(s)?`${a}${G.PatternBoolean}`:e(`Unexpected Kind '${s[G.Kind]}'`)}o(n,"Visit");function i(s){return`^${s.map(a=>n(a,"")).join("")}$`}o(i,"Create");t.Create=i})(Nx||(G.TemplateLiteralPattern=Nx={}));var rd;(function(t){function e(r){const n=Wy.ParseExact(r.pattern);if(!Jy.Check(n))return G.Type.String();const i=[...Qy.Generate(n)].map(s=>G.Type.Literal(s));return G.Type.Union(i)}o(e,"Resolve");t.Resolve=e})(rd||(G.TemplateLiteralResolver=rd={}));var cb=class extends Du{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=cb;var Wy;(function(t){function e(h,m,g){return h[m]===g&&h.charCodeAt(m-1)!==92}o(e,"IsNonEscaped");function r(h,m){return e(h,m,"(")}o(r,"IsOpenParen");function n(h,m){return e(h,m,")")}o(n,"IsCloseParen");function i(h,m){return e(h,m,"|")}o(i,"IsSeparator");function s(h){if(!(r(h,0)&&n(h,h.length-1)))return false;let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(m===0&&g!==h.length-1)return false}return true}o(s,"IsGroup");function a(h){return h.slice(1,h.length-1)}o(a,"InGroup");function u(h){let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(i(h,g)&&m===0)return true}return false}o(u,"IsPrecedenceOr");function l(h){for(let m=0;m<h.length;m++){if(r(h,m))return true}return false}o(l,"IsPrecedenceAnd");function c(h){let[m,g]=[0,0];const y=[];for(let w=0;w<h.length;w++){if(r(h,w))m+=1;if(n(h,w))m-=1;if(i(h,w)&&m===0){const E=h.slice(g,w);if(E.length>0)y.push(p(E));g=w+1}}const v=h.slice(g);if(v.length>0)y.push(p(v));if(y.length===0)return{type:"const",const:""};if(y.length===1)return y[0];return{type:"or",expr:y}}o(c,"Or");function d(h){function m(v,w){if(!r(v,w))throw new cb(`TemplateLiteralParser: Index must point to open parens`);let E=0;for(let b=w;b<v.length;b++){if(r(v,b))E+=1;if(n(v,b))E-=1;if(E===0)return[w,b]}throw new cb(`TemplateLiteralParser: Unclosed group parens in expression`)}o(m,"Group");function g(v,w){for(let E=w;E<v.length;E++){if(r(v,E))return[w,E]}return[w,v.length]}o(g,"Range");const y=[];for(let v=0;v<h.length;v++){if(r(h,v)){const[w,E]=m(h,v);const b=h.slice(w,E+1);y.push(p(b));v=E}else{const[w,E]=g(h,v);const b=h.slice(w,E);if(b.length>0)y.push(p(b));v=E-1}}return y.length===0?{type:"const",const:""}:y.length===1?y[0]:{type:"and",expr:y}}o(d,"And");function p(h){return s(h)?p(a(h)):u(h)?c(h):l(h)?d(h):{type:"const",const:h}}o(p,"Parse");t.Parse=p;function f(h){return p(h.slice(1,h.length-1))}o(f,"ParseExact");t.ParseExact=f})(Wy||(G.TemplateLiteralParser=Wy={}));var Ix=class extends Du{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Ix;var Jy;(function(t){function e(a){throw new Ix(a)}o(e,"Throw");function r(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="0"&&a.expr[1].type==="const"&&a.expr[1].const==="[1-9][0-9]*"}o(r,"IsNumber");function n(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="true"&&a.expr[1].type==="const"&&a.expr[1].const==="false"}o(n,"IsBoolean");function i(a){return a.type==="const"&&a.const===".*"}o(i,"IsString");function s(a){return n(a)?true:r(a)||i(a)?false:a.type==="and"?a.expr.every(u=>s(u)):a.type==="or"?a.expr.every(u=>s(u)):a.type==="const"?true:e(`Unknown expression type`)}o(s,"Check");t.Check=s})(Jy||(G.TemplateLiteralFinite=Jy={}));var Px=class extends Du{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Px;var Qy;(function(t){function*e(a){if(a.length===1)return yield*a[0];for(const u of a[0]){for(const l of e(a.slice(1))){yield`${u}${l}`}}}o(e,"Reduce");function*r(a){return yield*e(a.expr.map(u=>[...s(u)]))}o(r,"And");function*n(a){for(const u of a.expr)yield*s(u)}o(n,"Or");function*i(a){return yield a.const}o(i,"Const");function*s(a){return a.type==="and"?yield*r(a):a.type==="or"?yield*n(a):a.type==="const"?yield*i(a):(()=>{throw new Px("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Qy||(G.TemplateLiteralGenerator=Qy={}));var tY;(function(t){function*e(s){const a=s.trim().replace(/"|'/g,"");return a==="boolean"?yield G.Type.Boolean():a==="number"?yield G.Type.Number():a==="bigint"?yield G.Type.BigInt():a==="string"?yield G.Type.String():yield(()=>{const u=a.split("|").map(l=>G.Type.Literal(l.trim()));return u.length===0?G.Type.Never():u.length===1?u[0]:G.Type.Union(u)})()}o(e,"ParseUnion");function*r(s){if(s[1]!=="{"){const a=G.Type.Literal("$");const u=n(s.slice(1));return yield*[a,...u]}for(let a=2;a<s.length;a++){if(s[a]==="}"){const u=e(s.slice(2,a));const l=n(s.slice(a+1));return yield*[...u,...l]}}yield G.Type.Literal(s)}o(r,"ParseTerminal");function*n(s){for(let a=0;a<s.length;a++){if(s[a]==="$"){const u=G.Type.Literal(s.slice(0,a));const l=r(s.slice(a));return yield*[u,...l]}}yield G.Type.Literal(s)}o(n,"ParseLiteral");function i(s){return[...n(s)]}o(i,"Parse");t.Parse=i})(tY||(G.TemplateLiteralDslParser=tY={}));var Dx=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new kx(this.schema,e)}};G.TransformDecodeBuilder=Dx;var kx=class{static{o(this,"TransformEncodeBuilder")}constructor(e,r){this.schema=e;this.decode=r}Encode(e){const r=ct.Type(this.schema);return Y.TTransform(r)?(()=>{const n=o(a=>r[G.Transform].Encode(e(a)),"Encode");const i=o(a=>this.decode(r[G.Transform].Decode(a)),"Decode");const s={Encode:n,Decode:i};return{...r,[G.Transform]:s}})():(()=>{const n={Decode:this.decode,Encode:e};return{...r,[G.Transform]:n}})()}};G.TransformEncodeBuilder=kx;var T$t=0;var $x=class extends Du{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=$x;var Lx=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new $x(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=Lx;var db=class extends Lx{static{o(this,"JsonTypeBuilder")}ReadonlyOptional(e){return this.Readonly(this.Optional(e))}Readonly(e){return{...ct.Type(e),[G.Readonly]:"Readonly"}}Optional(e){return{...ct.Type(e),[G.Optional]:"Optional"}}Any(e={}){return this.Create({...e,[G.Kind]:"Any"})}Array(e,r={}){return this.Create({...r,[G.Kind]:"Array",type:"array",items:ct.Type(e)})}Boolean(e={}){return this.Create({...e,[G.Kind]:"Boolean",type:"boolean"})}Capitalize(e,r={}){return{...Ky.Map(ct.Type(e),"Capitalize"),...r}}Composite(e,r){const n=G.Type.Intersect(e,{});const i=Cx.ResolveKeys(n,{includePatterns:false});const s=i.reduce((a,u)=>({...a,[u]:G.Type.Index(n,[u])}),{});return G.Type.Object(s,r)}Enum(e,r={}){const n=Object.getOwnPropertyNames(e).filter(s=>isNaN(s)).map(s=>e[s]);const i=n.map(s=>Me.IsString(s)?{[G.Kind]:"Literal",type:"string",const:s}:{[G.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[G.Kind]:"Union",anyOf:i})}Extends(e,r,n,i,s={}){switch(Lm.Extends(e,r)){case Ee.Union:return this.Union([ct.Type(n,s),ct.Type(i,s)]);case Ee.True:return ct.Type(n,s);case Ee.False:return ct.Type(i,s)}}Exclude(e,r,n={}){return Y.TTemplateLiteral(e)?this.Exclude(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.Extends(e,r)!==Ee.False?ct.Type(e,n):this.Never(n)}Index(e,r,n={}){return Y.TArray(e)&&Y.TNumber(r)?(()=>{return ct.Type(e.items,n)})():Y.TTuple(e)&&Y.TNumber(r)?(()=>{const i=Me.IsUndefined(e.items)?[]:e.items;const s=i.map(a=>ct.Type(a));return this.Union(s,n)})():(()=>{const i=lb.Resolve(r);const s=ct.Type(e);return ZK.Resolve(s,i,n)})()}Integer(e={}){return this.Create({...e,[G.Kind]:"Integer",type:"integer"})}Intersect(e,r={}){if(e.length===0)return G.Type.Never();if(e.length===1)return ct.Type(e[0],r);if(e.some(a=>Y.TTransform(a)))this.Throw("Cannot intersect transform types");const n=e.every(a=>Y.TObject(a));const i=ct.Rest(e);const s=Y.TSchema(r.unevaluatedProperties)?{unevaluatedProperties:ct.Type(r.unevaluatedProperties)}:{};return r.unevaluatedProperties===false||Y.TSchema(r.unevaluatedProperties)||n?this.Create({...r,...s,[G.Kind]:"Intersect",type:"object",allOf:i}):this.Create({...r,...s,[G.Kind]:"Intersect",allOf:i})}KeyOf(e,r={}){return Y.TRecord(e)?(()=>{const n=Object.getOwnPropertyNames(e.patternProperties)[0];return n===G.PatternNumberExact?this.Number(r):n===G.PatternStringExact?this.String(r):this.Throw("Unable to resolve key type from Record key pattern")})():Y.TTuple(e)?(()=>{const n=Me.IsUndefined(e.items)?[]:e.items;const i=n.map((s,a)=>G.Type.Literal(a.toString()));return this.Union(i,r)})():Y.TArray(e)?(()=>{return this.Number(r)})():(()=>{const n=Cx.ResolveKeys(e,{includePatterns:false});if(n.length===0)return this.Never(r);const i=n.map(s=>this.Literal(s));return this.Union(i,r)})()}Literal(e,r={}){return this.Create({...r,[G.Kind]:"Literal",const:e,type:typeof e})}Lowercase(e,r={}){return{...Ky.Map(ct.Type(e),"Lowercase"),...r}}Never(e={}){return this.Create({...e,[G.Kind]:"Never",not:{}})}Not(e,r){return this.Create({...r,[G.Kind]:"Not",not:ct.Type(e)})}Null(e={}){return this.Create({...e,[G.Kind]:"Null",type:"null"})}Number(e={}){return this.Create({...e,[G.Kind]:"Number",type:"number"})}Object(e,r={}){const n=Object.getOwnPropertyNames(e);const i=n.filter(l=>Y.TOptional(e[l]));const s=n.filter(l=>!i.includes(l));const a=Y.TSchema(r.additionalProperties)?{additionalProperties:ct.Type(r.additionalProperties)}:{};const u=n.reduce((l,c)=>({...l,[c]:ct.Type(e[c])}),{});return s.length>0?this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u,required:s}):this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u})}Omit(e,r,n={}){const i=lb.Resolve(r);return Yy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.IsArray(s.required)){s.required=s.required.filter(a=>!i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Partial(e,r={}){return Yy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Optional(n.properties[a])}},{});return this.Object(i,this.Discard(n,"required"))},r)}Pick(e,r,n={}){const i=lb.Resolve(r);return Yy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.IsArray(s.required)){s.required=s.required.filter(a=>i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(!i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Record(e,r,n={}){return Y.TTemplateLiteral(e)?(()=>{const i=Wy.ParseExact(e.pattern);return Jy.Check(i)?this.Object([...Qy.Generate(i)].reduce((s,a)=>({...s,[a]:ct.Type(r)}),{}),n):this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[e.pattern]:ct.Type(r)}})})():Y.TUnion(e)?(()=>{const i=eY.Resolve(e);if(Y.TUnionLiteral(i)){const s=i.anyOf.reduce((a,u)=>({...a,[u.const]:ct.Type(r)}),{});return this.Object(s,{...n,[G.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():Y.TLiteral(e)?(()=>{return Me.IsString(e.const)||Me.IsNumber(e.const)?this.Object({[e.const]:ct.Type(r)},n):this.Throw("Record key of type literal is not of type string or number")})():Y.TInteger(e)||Y.TNumber(e)?(()=>{return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[G.PatternNumberExact]:ct.Type(r)}})})():Y.TString(e)?(()=>{const i=Me.IsUndefined(e.pattern)?G.PatternStringExact:e.pattern;return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[i]:ct.Type(r)}})})():this.Never()}Recursive(e,r={}){if(Me.IsUndefined(r.$id))r.$id=`T${T$t++}`;const n=e({[G.Kind]:"This",$ref:`${r.$id}`});n.$id=r.$id;return this.Create({...r,[G.Hint]:"Recursive",...n})}Ref(e,r={}){if(Me.IsString(e))return this.Create({...r,[G.Kind]:"Ref",$ref:e});if(Me.IsUndefined(e.$id))this.Throw("Reference target type must specify an $id");return this.Create({...r,[G.Kind]:"Ref",$ref:e.$id})}Required(e,r={}){return Yy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Discard(n.properties[a],G.Optional)}},{});return this.Object(i,n)},r)}Rest(e){return Y.TTuple(e)&&!Me.IsUndefined(e.items)?ct.Rest(e.items):Y.TIntersect(e)?ct.Rest(e.allOf):Y.TUnion(e)?ct.Rest(e.anyOf):[]}String(e={}){return this.Create({...e,[G.Kind]:"String",type:"string"})}TemplateLiteral(e,r={}){const n=Me.IsString(e)?Nx.Create(tY.Parse(e)):Nx.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Dx(e)}Tuple(e,r={}){const[n,i,s]=[false,e.length,e.length];const a=ct.Rest(e);const u=e.length>0?{...r,[G.Kind]:"Tuple",type:"array",items:a,additionalItems:n,minItems:i,maxItems:s}:{...r,[G.Kind]:"Tuple",type:"array",minItems:i,maxItems:s};return this.Create(u)}Uncapitalize(e,r={}){return{...Ky.Map(ct.Type(e),"Uncapitalize"),...r}}Union(e,r={}){return Y.TTemplateLiteral(e)?rd.Resolve(e):(()=>{const n=e;if(n.length===0)return this.Never(r);if(n.length===1)return this.Create(ct.Type(n[0],r));const i=ct.Rest(n);return this.Create({...r,[G.Kind]:"Union",anyOf:i})})()}Unknown(e={}){return this.Create({...e,[G.Kind]:"Unknown"})}Unsafe(e={}){return this.Create({...e,[G.Kind]:e[G.Kind]||"Unsafe"})}Uppercase(e,r={}){return{...Ky.Map(ct.Type(e),"Uppercase"),...r}}};G.JsonTypeBuilder=db;var qx=class extends db{static{o(this,"JavaScriptTypeBuilder")}AsyncIterator(e,r={}){return this.Create({...r,[G.Kind]:"AsyncIterator",type:"AsyncIterator",items:ct.Type(e)})}Awaited(e,r={}){const n=o(i=>i.length>0?(()=>{const[s,...a]=i;return[this.Awaited(s),...n(a)]})():i,"Unwrap");return Y.TIntersect(e)?G.Type.Intersect(n(e.allOf)):Y.TUnion(e)?G.Type.Union(n(e.anyOf)):Y.TPromise(e)?this.Awaited(e.item):ct.Type(e,r)}BigInt(e={}){return this.Create({...e,[G.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(e,r={}){return this.Tuple([...e.parameters],{...r})}Constructor(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Constructor",type:"constructor",parameters:i,returns:s})}Date(e={}){return this.Create({...e,[G.Kind]:"Date",type:"Date"})}Function(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Function",type:"function",parameters:i,returns:s})}InstanceType(e,r={}){return ct.Type(e.returns,r)}Iterator(e,r={}){return this.Create({...r,[G.Kind]:"Iterator",type:"Iterator",items:ct.Type(e)})}Parameters(e,r={}){return this.Tuple(e.parameters,{...r})}Promise(e,r={}){return this.Create({...r,[G.Kind]:"Promise",type:"Promise",item:ct.Type(e)})}RegExp(e,r={}){const n=Me.IsString(e)?e:e.source;return this.Create({...r,[G.Kind]:"String",type:"string",pattern:n})}RegEx(e,r={}){return this.RegExp(e,r)}ReturnType(e,r={}){return ct.Type(e.returns,r)}Symbol(e){return this.Create({...e,[G.Kind]:"Symbol",type:"symbol"})}Undefined(e={}){return this.Create({...e,[G.Kind]:"Undefined",type:"undefined"})}Uint8Array(e={}){return this.Create({...e,[G.Kind]:"Uint8Array",type:"Uint8Array"})}Void(e={}){return this.Create({...e,[G.Kind]:"Void",type:"void"})}};G.JavaScriptTypeBuilder=qx;G.JsonType=new db;G.Type=new qx});var hAe=_(jx=>{"use strict";Object.defineProperty(jx,"__esModule",{value:true});jx.CustomTypeBuilder=void 0;var pb=fAe();var rY=class extends pb.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return pb.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return pb.Type.Union([e,pb.Type.Null()])}static StringEnum(e){return pb.Type.Unsafe({type:"string",enum:e})}};jx.CustomTypeBuilder=rY});var vAe=_(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:true});lt.throwIfNotNumber=lt.throwIfNotString=lt.throwIfUndefinedOrNull=lt.throwIfUndefined=lt.ArgumentTypeError=lt.ArgumentUndefinedError=lt.ValidationError=lt.withUndefinedAsNull=lt.withNullAsUndefined=lt.validateConstraint=lt.validateConstraints=lt.areFunctions=lt.isFunction=lt.isEmptyObject=lt.assertAllDefined=lt.assertIsDefined=lt.assertType=lt.isUndefinedOrNull=lt.isDefined=lt.isUndefined=lt.isBoolean=lt.isIterable=lt.isNumber=lt.isTypedArray=lt.isObject=lt.isStringArray=lt.isString=void 0;function Ux(t){return typeof t==="string"}o(Ux,"isString");lt.isString=Ux;function A$t(t){return Array.isArray(t)&&t.every(e=>Ux(e))}o(A$t,"isStringArray");lt.isStringArray=A$t;function mAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(mAe,"isObject");lt.isObject=mAe;function x$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(x$t,"isTypedArray");lt.isTypedArray=x$t;function gAe(t){return typeof t==="number"&&!isNaN(t)}o(gAe,"isNumber");lt.isNumber=gAe;function C$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(C$t,"isIterable");lt.isIterable=C$t;function R$t(t){return t===true||t===false}o(R$t,"isBoolean");lt.isBoolean=R$t;function nY(t){return typeof t==="undefined"}o(nY,"isUndefined");lt.isUndefined=nY;function O$t(t){return!Xy(t)}o(O$t,"isDefined");lt.isDefined=O$t;function Xy(t){return nY(t)||t===null}o(Xy,"isUndefinedOrNull");lt.isUndefinedOrNull=Xy;function N$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(N$t,"assertType");lt.assertType=N$t;function I$t(t){if(Xy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(I$t,"assertIsDefined");lt.assertIsDefined=I$t;function P$t(...t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(Xy(n)){throw new Error(`Assertion Failed: argument at index ${r} is undefined or null`)}e.push(n)}return e}o(P$t,"assertAllDefined");lt.assertAllDefined=P$t;var D$t=Object.prototype.hasOwnProperty;function k$t(t){if(!mAe(t)){return false}for(const e in t){if(D$t.call(t,e)){return false}}return true}o(k$t,"isEmptyObject");lt.isEmptyObject=k$t;function iY(t){return typeof t==="function"}o(iY,"isFunction");lt.isFunction=iY;function $$t(...t){return t.length>0&&t.every(iY)}o($$t,"areFunctions");lt.areFunctions=$$t;function L$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){yAe(t[n],e[n])}}o(L$t,"validateConstraints");lt.validateConstraints=L$t;function yAe(t,e){if(Ux(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(iY(e)){try{if(t instanceof e){return}}catch{}if(!Xy(t)&&t.constructor===e){return}if(e.length===1&&e.call(void 0,t)===true){return}throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`)}}o(yAe,"validateConstraint");lt.validateConstraint=yAe;function q$t(t){return t===null?void 0:t}o(q$t,"withNullAsUndefined");lt.withNullAsUndefined=q$t;function j$t(t){return typeof t==="undefined"?null:t}o(j$t,"withUndefinedAsNull");lt.withUndefinedAsNull=j$t;var fb=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=fb;var hb=class extends fb{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=hb;var mb=class extends fb{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=mb;function U$t(t,e){if(nY(t)){throw new hb(e)}return true}o(U$t,"throwIfUndefined");lt.throwIfUndefined=U$t;function sY(t,e){if(Xy(t)){throw new hb(e)}}o(sY,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=sY;function F$t(t,e){sY(t,e);if(!Ux(t)){throw new mb(e,"string")}return true}o(F$t,"throwIfNotString");lt.throwIfNotString=F$t;function B$t(t,e){sY(t,e);if(!gAe(t)){throw new mb(e,"number")}return true}o(B$t,"throwIfNotNumber");lt.throwIfNotNumber=B$t});var yb=_(xe=>{"use strict";var _Ae=xe&&xe.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var M$t=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Fx=xe&&xe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null){for(var r in t)if(r!=="default"&&Object.prototype.hasOwnProperty.call(t,r))_Ae(e,t,r)}M$t(e,t);return e};var vf=xe&&xe.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))_Ae(e,t,r)};Object.defineProperty(xe,"__esModule",{value:true});xe.getRequiredEnvVar=xe.env=xe.EnvironmentalVariableRequiredError=xe.xfs=xe.RouteValidator=xe.JsonValidator=xe.TenantService=xe.OpenFGAService=xe.DevApiService=xe.getContentApiStorageTarballPath=xe.contentApiTarballFileName=xe.ContentApiService=xe.AuthApiService=xe.getServiceAccountIdToken=xe.createApiKeyServiceClient=xe.ApiKeyService=xe.RouteVersions=xe.startsWithReservedKeyword=xe.logger=xe.createNewLogger=xe.graphQL=xe.CloudStorage=xe.fly=xe.ApiServer=xe.featureFlagsPlugin=xe.ensureZuploUserPlugin=xe.ensureZuploAdminPlugin=xe.ensureServiceAccountPlugin=xe.apiKeyAuthPlugin=xe.errorHandler=xe.DeploymentLogState=xe.signString=xe.FeatureFlags=xe.VALID_COMPATIBILITY_DATES=xe.DEFAULT_COMPATIBILITY_DATE=xe.COMPATIBILITY_FLAG_MAPPINGS=xe.WARNING_STATUS=xe.WARNING_SEVERITY=xe.GOOD_STATUS=xe.FAILURE_STATUS=xe.ERROR_SEVERITY=xe.BuildIssueError=xe.hasBlockedNotifications=xe.getDefaultFlags=xe.getBuildFlagsForDeployment=xe.CommonAuth=void 0;var aY=Fx(za());xe.env=aY.default;Object.defineProperty(xe,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return aY.EnvironmentalVariableRequiredError}});Object.defineProperty(xe,"getRequiredEnvVar",{enumerable:true,get:function(){return aY.getRequiredEnvVar}});vf(As(),xe);var V$t=tC();Object.defineProperty(xe,"CommonAuth",{enumerable:true,get:function(){return V$t.CommonAuth}});var oY=qY();Object.defineProperty(xe,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return oY.getBuildFlagsForDeployment}});Object.defineProperty(xe,"getDefaultFlags",{enumerable:true,get:function(){return oY.getDefaultFlags}});Object.defineProperty(xe,"hasBlockedNotifications",{enumerable:true,get:function(){return oY.hasBlockedNotifications}});var Zy=jY();Object.defineProperty(xe,"BuildIssueError",{enumerable:true,get:function(){return Zy.BuildIssueError}});Object.defineProperty(xe,"ERROR_SEVERITY",{enumerable:true,get:function(){return Zy.ERROR_SEVERITY}});Object.defineProperty(xe,"FAILURE_STATUS",{enumerable:true,get:function(){return Zy.FAILURE_STATUS}});Object.defineProperty(xe,"GOOD_STATUS",{enumerable:true,get:function(){return Zy.GOOD_STATUS}});Object.defineProperty(xe,"WARNING_SEVERITY",{enumerable:true,get:function(){return Zy.WARNING_SEVERITY}});Object.defineProperty(xe,"WARNING_STATUS",{enumerable:true,get:function(){return Zy.WARNING_STATUS}});var H$t=UY();Object.defineProperty(xe,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return H$t.COMPATIBILITY_FLAG_MAPPINGS}});var EAe=MY();Object.defineProperty(xe,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return EAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(xe,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return EAe.VALID_COMPATIBILITY_DATES}});var z$t=rC();Object.defineProperty(xe,"FeatureFlags",{enumerable:true,get:function(){return z$t.FeatureFlags}});var G$t=VY();Object.defineProperty(xe,"signString",{enumerable:true,get:function(){return G$t.signString}});vf(HY(),xe);var K$t=sC();Object.defineProperty(xe,"DeploymentLogState",{enumerable:true,get:function(){return K$t.DeploymentLogState}});vf(XY(),xe);vf(aC(),xe);var Y$t=oC();Object.defineProperty(xe,"errorHandler",{enumerable:true,get:function(){return Y$t.errorHandler}});var gb=pC();Object.defineProperty(xe,"apiKeyAuthPlugin",{enumerable:true,get:function(){return gb.apiKeyAuthPlugin}});Object.defineProperty(xe,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return gb.ensureServiceAccountPlugin}});Object.defineProperty(xe,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return gb.ensureZuploAdminPlugin}});Object.defineProperty(xe,"ensureZuploUserPlugin",{enumerable:true,get:function(){return gb.ensureZuploUserPlugin}});Object.defineProperty(xe,"featureFlagsPlugin",{enumerable:true,get:function(){return gb.featureFlagsPlugin}});var W$t=lge();Object.defineProperty(xe,"ApiServer",{enumerable:true,get:function(){return W$t.ApiServer}});xe.fly=Fx(pge());xe.CloudStorage=Fx(ebe());var J$t=tbe();Object.defineProperty(xe,"graphQL",{enumerable:true,get:function(){return J$t.graphQL}});vf(A5e(),xe);var bAe=Ej();Object.defineProperty(xe,"createNewLogger",{enumerable:true,get:function(){return bAe.createNewLogger}});Object.defineProperty(xe,"logger",{enumerable:true,get:function(){return bAe.logger}});var Q$t=cH();Object.defineProperty(xe,"startsWithReservedKeyword",{enumerable:true,get:function(){return Q$t.startsWithReservedKeyword}});var X$t=x5e();Object.defineProperty(xe,"RouteVersions",{enumerable:true,get:function(){return X$t.RouteVersions}});var wAe=JSe();Object.defineProperty(xe,"ApiKeyService",{enumerable:true,get:function(){return wAe.ApiKeyService}});Object.defineProperty(xe,"createApiKeyServiceClient",{enumerable:true,get:function(){return wAe.createApiKeyServiceClient}});var Z$t=Ry();Object.defineProperty(xe,"getServiceAccountIdToken",{enumerable:true,get:function(){return Z$t.getServiceAccountIdToken}});var eLt=XSe();Object.defineProperty(xe,"AuthApiService",{enumerable:true,get:function(){return eLt.AuthApiService}});var uY=rTe();Object.defineProperty(xe,"ContentApiService",{enumerable:true,get:function(){return uY.ContentApiService}});Object.defineProperty(xe,"contentApiTarballFileName",{enumerable:true,get:function(){return uY.contentApiTarballFileName}});Object.defineProperty(xe,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return uY.getContentApiStorageTarballPath}});var tLt=sTe();Object.defineProperty(xe,"DevApiService",{enumerable:true,get:function(){return tLt.DevApiService}});var rLt=aAe();Object.defineProperty(xe,"OpenFGAService",{enumerable:true,get:function(){return rLt.OpenFGAService}});var nLt=lAe();Object.defineProperty(xe,"TenantService",{enumerable:true,get:function(){return nLt.TenantService}});vf(cAe(),xe);vf(hAe(),xe);vf(vAe(),xe);var iLt=N7();Object.defineProperty(xe,"JsonValidator",{enumerable:true,get:function(){return iLt.JsonValidator}});var sLt=gH();Object.defineProperty(xe,"RouteValidator",{enumerable:true,get:function(){return sLt.RouteValidator}});xe.xfs=Fx(hM())});var vb=_(e2=>{"use strict";Object.defineProperty(e2,"__esModule",{value:true});e2.runPlugins=e2.PluginResult=void 0;var lY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};e2.PluginResult=lY;async function aLt(t,e){const r=[];const n=[];const i=new Map;for await(const s of t){try{const a=await s(e,i);n.push(...a.errors.map(u=>{if(u.pluginName===""){u.pluginName=s.name}return u}));r.push(...a.warnings);if(a.errors.length>0){break}}catch(a){n.push(a);break}}return{errors:n,warnings:r}}o(aLt,"runPlugins");e2.runPlugins=aLt});var TAe=_((Wmr,SAe)=>{"use strict";function oLt(t){return t>=55296&&t<=56319}o(oLt,"isHighSurrogate");function uLt(t){return t>=56320&&t<=57343}o(uLt,"isLowSurrogate");SAe.exports=o(function t(e,r,n){if(typeof r!=="string"){throw new Error("Input must be string")}var i=r.length;var s=0;var a;var u;for(var l=0;l<i;l+=1){a=r.charCodeAt(l);u=r[l];if(oLt(a)&&uLt(r.charCodeAt(l+1))){l+=1;u+=r[l]}s+=e(u);if(s===n){return r.slice(0,l+1)}else if(s>n){return r.slice(0,l-u.length+1)}}return r},"truncate")});var xAe=_((Qmr,AAe)=>{"use strict";var lLt=TAe();var cLt=Buffer.byteLength.bind(Buffer);AAe.exports=lLt.bind(null,cLt)});var CAe=_(t2=>{"use strict";var dLt=t2&&t2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(t2,"__esModule",{value:true});t2.sanitize=void 0;var pLt=dLt(xAe());var fLt=/[/?<>\\:*|"]/g;var hLt=/[\x00-\x1f\x80-\x9f]/g;var mLt=/^\.+$/;var gLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var yLt=/[. ]+$/;function vLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(fLt,e).replace(hLt,e).replace(mLt,e).replace(gLt,e).replace(yLt,e);return(0,pLt.default)(r,255)}o(vLt,"sanitize");t2.sanitize=vLt});var Gl=_(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:true});Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.NODE_BUILD_OUTPUT_FILE=Fe.NODE_ENTRY_NAME=Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE=Fe.WORKER_BUILD_OUTPUT_FILE=Fe.WORKER_ENTRY_NAME=Fe.ENV_MODULE_FILE=Fe.ZUPLO_SYSTEM_ENV_FILE=Fe.ENV_FILE=Fe.CACHE_DIRECTORY=Fe.BUILD_CACHE_FILE=Fe.ZUPLO_FILE_SCHEMA=Fe.NON_STANDARD_NODE_ENV=Fe.GENERATED_TYPES_DIR_NAME=Fe.GENERATED_BUILD_JSON_FILE=Fe.GENERATED_SOURCE_DIR_NAME=Fe.BUILD_OUTPUT_DIR=Fe.DEFAULT_TEST_FILE=Fe.DEFAULT_DOCS_MARKDOWN_FILE=Fe.DOCS_THEME_FILE=Fe.DOCS_SIDEBAR_FILE=Fe.ZUPLO_FALLBACK_JSON_FILE=Fe.ZUPLO_PREFERRED_JSON_FILE=Fe.DEFAULT_MODULE_FILE=Fe.OPEN_API_FILE_SUFFIX=Fe.OPEN_API_CONFIG_FILE=Fe.OPEN_API_UNVERSIONED_DIR_NAME=Fe.DEV_PORTAL_OUTPUT_DIR_NAME=Fe.DEV_PORTAL_CONFIG_FILE=Fe.POLICIES_CONFIG_FILE=Fe.ROUTES_OAS_CONFIG_FILE=Fe.LOCAL_API_KEYS_CONFIG_FILE=Fe.DEV_PORTAL_V4_PATH=Fe.USER_DOCS_DIR_NAME=Fe.USER_SCHEMAS_DIR_NAME=Fe.USER_CONFIG_DIR_NAME=Fe.USER_TEST_DIR_NAME=Fe.USER_MODULES_DIR_NAME=void 0;Fe.USER_MODULES_DIR_NAME="modules";Fe.USER_TEST_DIR_NAME="tests";Fe.USER_CONFIG_DIR_NAME="config";Fe.USER_SCHEMAS_DIR_NAME="schemas";Fe.USER_DOCS_DIR_NAME="docs";Fe.DEV_PORTAL_V4_PATH="v4";Fe.LOCAL_API_KEYS_CONFIG_FILE="api-keys.json";Fe.ROUTES_OAS_CONFIG_FILE="routes.oas.json";Fe.POLICIES_CONFIG_FILE="policies.json";Fe.DEV_PORTAL_CONFIG_FILE="dev-portal.json";Fe.DEV_PORTAL_OUTPUT_DIR_NAME="dev-portal";Fe.OPEN_API_UNVERSIONED_DIR_NAME="unversioned";Fe.OPEN_API_CONFIG_FILE="open-api.json";Fe.OPEN_API_FILE_SUFFIX=".oas.json";Fe.DEFAULT_MODULE_FILE="hello-world.ts";Fe.ZUPLO_PREFERRED_JSON_FILE="zuplo.jsonc";Fe.ZUPLO_FALLBACK_JSON_FILE="zuplo.json";Fe.DOCS_SIDEBAR_FILE="sidebar.json";Fe.DOCS_THEME_FILE="theme.css";Fe.DEFAULT_DOCS_MARKDOWN_FILE="index.md";Fe.DEFAULT_TEST_FILE="hello-world.json";Fe.BUILD_OUTPUT_DIR="dist";Fe.GENERATED_SOURCE_DIR_NAME=".zuplo";Fe.GENERATED_BUILD_JSON_FILE="build.json";Fe.GENERATED_TYPES_DIR_NAME="types";Fe.NON_STANDARD_NODE_ENV=`You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against.`;Fe.ZUPLO_FILE_SCHEMA="zuplo";Fe.BUILD_CACHE_FILE="buildstate.json";Fe.CACHE_DIRECTORY=".cache";Fe.ENV_FILE=".env";Fe.ZUPLO_SYSTEM_ENV_FILE=".env.zuplo";Fe.ENV_MODULE_FILE="environment.ts";Fe.WORKER_ENTRY_NAME="worker.ts";Fe.WORKER_BUILD_OUTPUT_FILE="worker.js";Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE="worker.js.map";Fe.NODE_ENTRY_NAME="server.ts";Fe.NODE_BUILD_OUTPUT_FILE="main.js";Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.OPEN_API_CONFIG_FILE});var IAe=_(r2=>{"use strict";var NAe=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.createProjectDirs=void 0;var RAe=NAe(require("fs/promises"));var _Lt=NAe(require("path"));var _b=Gl();var OAe=vb();var ELt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[_b.USER_MODULES_DIR_NAME,_b.USER_CONFIG_DIR_NAME,_b.USER_TEST_DIR_NAME,_b.USER_SCHEMAS_DIR_NAME,_b.USER_DOCS_DIR_NAME,".vscode"];try{await RAe.default.mkdir(t);for(const n of r){await RAe.default.mkdir(_Lt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new OAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new OAe.PluginResult},"createProjectDirs");r2.createProjectDirs=ELt});var PAe=_(dY=>{"use strict";Object.defineProperty(dY,"__esModule",{value:true});var Bx=require("perf_hooks");var cY=[];async function bLt(t,e){const r=Bx.performance.timerify(e);const n=new Bx.PerformanceObserver(i=>{const s=i.getEntries()[0];cY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(bLt,"timeFn");var wLt={mark:t=>{Bx.performance.mark(t)},measure:(t,e,r)=>{Bx.performance.measure(t,e,r)},timeFn:bLt,report:()=>{if(cY.length>0){console.table(cY)}}};dY.default=wLt});var LAe=_(n2=>{"use strict";var $Ae=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.generateFromTemplate=void 0;var SLt=require("fs");var DAe=$Ae(require("fs/promises"));var kAe=$Ae(require("path"));async function TLt(t){const e=kAe.default.resolve(__dirname,"..","templates",t);if((0,SLt.existsSync)(e)){const r=await DAe.default.readFile(e,"utf-8");return r}else{const r=kAe.default.resolve(__dirname,"templates",t);const n=await DAe.default.readFile(r,"utf-8");return n}}o(TLt,"generateFromTemplate");n2.generateFromTemplate=TLt});var Ca=_(i2=>{"use strict";var pY=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFileFromTemplate=void 0;var ALt=yb();var xLt=pY(require("fs/promises"));var CLt=pY(require("path"));var RLt=pY(PAe());var OLt=LAe();var NLt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return RLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=CLt.default.join(r,t);if(await ALt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return ILt(i,e,n)})}},"generateFileFromTemplate");i2.generateFileFromTemplate=NLt;async function ILt(t,e,r){const n=await(0,OLt.generateFromTemplate)(e);try{await xLt.default.writeFile(t,n,"utf-8");r.debug(`File written to ${t}`)}catch(i){r.error(i);const s={message:`Error creating file at ${t}`,pluginName:"generate-file",severity:"error"};return{warnings:[],errors:[s]}}return{warnings:[],errors:[]}}o(ILt,"writeTemplate")});var jAe=_(s2=>{"use strict";var PLt=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateDefaultDocsMarkdown=void 0;var DLt=PLt(require("path"));var qAe=Gl();var kLt=Ca();s2.generateDefaultDocsMarkdown=(0,kLt.generateFileFromTemplate)(DLt.default.join(qAe.USER_DOCS_DIR_NAME,qAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var FAe=_(a2=>{"use strict";var $Lt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsSidebar=void 0;var LLt=$Lt(require("path"));var UAe=Gl();var qLt=Ca();a2.generateDefaultDocsSidebar=(0,qLt.generateFileFromTemplate)(LLt.default.join(UAe.USER_DOCS_DIR_NAME,UAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var MAe=_(o2=>{"use strict";var jLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsTheme=void 0;var ULt=jLt(require("path"));var BAe=Gl();var FLt=Ca();o2.generateDefaultDocsTheme=(0,FLt.generateFileFromTemplate)(ULt.default.join(BAe.USER_DOCS_DIR_NAME,BAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var HAe=_(u2=>{"use strict";var BLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultModule=void 0;var MLt=BLt(require("path"));var VAe=Gl();var VLt=Ca();u2.generateDefaultModule=(0,VLt.generateFileFromTemplate)(MLt.default.join(VAe.USER_MODULES_DIR_NAME,VAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var GAe=_(l2=>{"use strict";var HLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDevPortalConfigJson=void 0;var zLt=HLt(require("path"));var zAe=Gl();var GLt=Ca();l2.generateDevPortalConfigJson=(0,GLt.generateFileFromTemplate)(zLt.default.join(zAe.USER_CONFIG_DIR_NAME,zAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var KAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.generateEnvironment=void 0;var KLt=Ca();Mx.generateEnvironment=(0,KLt.generateFileFromTemplate)(".env","env.template")});var YAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generateESLint=void 0;var YLt=Ca();Vx.generateESLint=(0,YLt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var WAe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generateGitignore=void 0;var WLt=Ca();Hx.generateGitignore=(0,WLt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var JAe=_(c2=>{"use strict";var JLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateLaunchJson=void 0;var QLt=JLt(require("path"));var XLt=Ca();c2.generateLaunchJson=(0,XLt.generateFileFromTemplate)(QLt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var QAe=_(d2=>{"use strict";var ZLt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateSettingsJson=void 0;var eqt=ZLt(require("path"));var tqt=Ca();d2.generateSettingsJson=(0,tqt.generateFileFromTemplate)(eqt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var ZAe=_(p2=>{"use strict";var rqt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateRouteOasConfig=void 0;var nqt=rqt(require("path"));var XAe=Gl();var iqt=Ca();p2.generateRouteOasConfig=(0,iqt.generateFileFromTemplate)(nqt.default.join(XAe.USER_CONFIG_DIR_NAME,XAe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var nxe=_(zo=>{"use strict";var exe=zo&&zo.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zo,"__esModule",{value:true});zo.updateProjectPackageJson=zo.getProjectPackageJson=zo.getPackageOverrides=zo.generateDefaultPackageJson=void 0;var sqt=yb();var txe=exe(require("fs/promises"));var fY=exe(require("path"));async function aqt(t,e=sqt.env.USE_MONOREPO_PACKAGES){const r={name:t,version:"1.0.0",author:"",copyright:"",scripts:{dev:"zup dev",test:"zup test"},dependencies:{zuplo:"latest"}};if(e){const n=rxe();r.overrides=n;r.dependencies["@zuplo/runtime"]=n["@zuplo/runtime"];if(r.devDependencies&&"@zuplo/core"in r.devDependencies){r.devDependencies["@zuplo/core"]=n["@zuplo/core"]}if("@zuplo/core"in r.dependencies){r.dependencies["@zuplo/core"]=n["@zuplo/core"]}}return r}o(aqt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=aqt;function rxe(){const t=fY.default.resolve(__dirname,"..","..");return{"@zuplo/core":`file:${t}/core`,"@zuplo/runtime":`file:${t}/runtime`,"@zuplo/debug":`file:${t}/debug`,"@zuplo/errors":`file:${t}/errors`}}o(rxe,"getPackageOverrides");zo.getPackageOverrides=rxe;async function oqt(t){const e=fY.default.join(t,"package.json");const r=await txe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(oqt,"getProjectPackageJson");zo.getProjectPackageJson=oqt;async function uqt(t,e){const r=fY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await txe.default.writeFile(r,n,"utf-8")}o(uqt,"updateProjectPackageJson");zo.updateProjectPackageJson=uqt});var axe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generatePackageJson=void 0;var ixe=nxe();var sxe=vb();var lqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,ixe.generateDefaultPackageJson)(e);try{await(0,ixe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new sxe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new sxe.PluginResult},"generatePackageJson");zx.generatePackageJson=lqt});var uxe=_(f2=>{"use strict";var cqt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generatePoliciesConfig=void 0;var dqt=cqt(require("path"));var oxe=Gl();var pqt=Ca();f2.generatePoliciesConfig=(0,pqt.generateFileFromTemplate)(dqt.default.join(oxe.USER_CONFIG_DIR_NAME,oxe.POLICIES_CONFIG_FILE),"policies.template.json")});var lxe=_(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:true});Gx.generateTSConfig=void 0;var fqt=Ca();Gx.generateTSConfig=(0,fqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var dxe=_(h2=>{"use strict";var hqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generateZuploJson=void 0;var mqt=yb();var gqt=require("fs/promises");var yqt=hqt(require("path"));var vqt=Gl();var cxe=vb();var _qt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:mqt.DEFAULT_COMPATIBILITY_DATE};const i=yqt.default.join(e,vqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,gqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new cxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new cxe.PluginResult},"generateZuploJson");h2.generateZuploJson=_qt});var fxe=_(m2=>{"use strict";var Eqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.create=void 0;var hY=yb();var bqt=require("fs/promises");var wqt=Eqt(require("path"));var Sqt=vb();var pxe=CAe();var Tqt=IAe();var Aqt=jAe();var xqt=FAe();var Cqt=MAe();var Rqt=HAe();var Oqt=GAe();var Nqt=KAe();var Iqt=YAe();var Pqt=WAe();var Dqt=JAe();var kqt=QAe();var $qt=ZAe();var Lqt=axe();var qqt=uxe();var jqt=lxe();var Uqt=dxe();async function Fqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,pxe.sanitize)(t);const s=(0,pxe.sanitize)(e);const a=wqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await hY.xfs.dirExists(a)){throw new hY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:hY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[Tqt.createProjectDirs,$qt.generateRouteOasConfig,Uqt.generateZuploJson,Oqt.generateDevPortalConfigJson,Rqt.generateDefaultModule,xqt.generateDefaultDocsSidebar,Aqt.generateDefaultDocsMarkdown,Cqt.generateDefaultDocsTheme,qqt.generatePoliciesConfig]);l.push(...[jqt.generateTSConfig,Pqt.generateGitignore,Lqt.generatePackageJson,Nqt.generateEnvironment,Iqt.generateESLint,Dqt.generateLaunchJson,kqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,Sqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,bqt.rm)(a,{recursive:true,force:true});const f=c[0];if(f instanceof Error){throw f}else{throw new Error(f.message)}}const p={sourceDirectory:a,projectName:t};return p}o(Fqt,"create");m2.create=Fqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Bqt=fxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Bqt.create}});
|
|
411
411
|
/*! For license information please see create.index.minified.js.LEGAL.txt */
|