@zuplo/core 5.1595.0 → 5.1597.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.
@@ -407,5 +407,5 @@ ${p}
407
407
  ${f}`;const m=`${a}/${t.region}/${n}/${yNt}`;const g=`${ySe}
408
408
  ${s}
409
409
  ${m}
410
- `+await t.crypto.sha256DigestHex(h);const y=await vNt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await H6(t.crypto,y,g);const w=`${ySe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,vSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(_Nt,"generateAuthenticationHeaderMap")});var uG=_(LA=>{"use strict";Object.defineProperty(LA,"__esModule",{value:true});LA.AwsClient=void 0;var ENt=_Se();var bNt=lf();var z6=class extends bNt.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 ENt.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}};LA.AwsClient=z6;z6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";z6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var fG=_(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 qA="urn:ietf:params:oauth:token-type:saml2";var lG="urn:ietf:params:oauth:token-type:id_token";var cG="urn:ietf:params:oauth:token-type:jwt";var dG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new jA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new UA("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!==qA&&this.tokenType!==lG&&this.tokenType!==cG){throw new FA(`Executable response must contain a 'token_type' field when successful and it must be one of ${lG}, ${cG}, or ${qA}.`)}if(this.tokenType===qA){if(!e.saml_response){throw new G6(`Executable response must contain a 'saml_response' field when token_type=${qA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new G6(`Executable response must contain a 'id_token' field when token_type=${lG} or ${cG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new BA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new MA("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=dG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var jA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=jA;var UA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=UA;var pG=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=pG;var FA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=FA;var BA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=BA;var MA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=MA;var G6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=G6});var ESe=_(VA=>{"use strict";Object.defineProperty(VA,"__esModule",{value:true});VA.PluggableAuthHandler=void 0;var wNt=HA();var Om=fG();var SNt=require("child_process");var hG=require("fs");var mG=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=SNt.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 wNt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await hG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await hG.promises.lstat(e)).isFile()){return void 0}const r=await hG.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}};VA.PluggableAuthHandler=mG});var HA=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.PluggableAuthClient=Ty.ExecutableError=void 0;var TNt=lf();var ANt=fG();var xNt=ESe();var zA=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)}};Ty.ExecutableError=zA;var CNt=30*1e3;var bSe=5*1e3;var wSe=120*1e3;var RNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var SSe=1;var gG=class extends TNt.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=CNt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<bSe||this.timeoutMillis>wSe){throw new Error(`Timeout must be between ${bSe} and ${wSe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new xNt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[RNt]!=="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>SSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${SSe}.`)}if(!e.success){throw new zA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new ANt.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}};Ty.PluggableAuthClient=gG});var vG=_(GA=>{"use strict";Object.defineProperty(GA,"__esModule",{value:true});GA.ExternalAccountClient=void 0;var ONt=lf();var NNt=aG();var INt=uG();var PNt=HA();var yG=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===ONt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new INt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new PNt.PluggableAuthClient(e,r)}else{return new NNt.IdentityPoolClient(e,r)}}else{return null}}};GA.ExternalAccountClient=yG});var ASe=_(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:true});Ay.ExternalAccountAuthorizedUserClient=Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var DNt=iy();var TSe=Wz();var kNt=Wc();var $Nt=require("stream");var LNt=lf();Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var _G=class extends TSe.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 kNt.GaxiosError&&a.response){throw(0,TSe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var EG=class extends DNt.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 _G(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=LNt.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 $Nt.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}};Ay.ExternalAccountAuthorizedUserClient=EG});var RSe=_(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:true});Cy.GoogleAuth=Cy.CLOUD_SDK_CLIENT_ID=void 0;var qNt=require("child_process");var K6=require("fs");var bG=U7();var jNt=require("os");var wG=require("path");var UNt=ry();var FNt=C6();var BNt=IH();var MNt=DH();var VNt=kH();var xy=Vz();var SG=zz();var KA=Kz();var HNt=vG();var Y6=lf();var xSe=ASe();Cy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var CSe={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 YA=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===CSe.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(CSe.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 xy.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 xy.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 BNt.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 bG.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=wG.join(i,".config")}}if(r){r=wG.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!==KA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${KA.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 SG.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 KA.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===SG.USER_REFRESH_ACCOUNT_TYPE){n=new SG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===KA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===Y6.EXTERNAL_ACCOUNT_TYPE){n=HNt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===xSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new xSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new xy.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 xy.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 xy.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=jNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,qNt.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 bG.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 bG.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=wG.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 MNt.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,VNt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,UNt.createCrypto)();if(r instanceof xy.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}};Cy.GoogleAuth=YA;YA.DefaultTransporter=FNt.DefaultTransporter});var OSe=_(WA=>{"use strict";Object.defineProperty(WA,"__esModule",{value:true});WA.IAMAuth=void 0;var TG=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}}};WA.IAMAuth=TG});var NSe=_(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 GNt=iy();var KNt=Qz();var YNt="urn:ietf:params:oauth:grant-type:token-exchange";var WNt="urn:ietf:params:oauth:token-type:access_token";var JNt="urn:ietf:params:oauth:token-type:access_token";var QNt="https://sts.googleapis.com/v1/token";Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Nu.EXPIRATION_TIME_OFFSET=5*60*1e3;var AG=class extends GNt.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 KNt.StsCredentials(QNt);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:YNt,requestedTokenType:WNt,subjectToken:r,subjectTokenType:JNt};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=AG});var xG=_(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 ISe=RSe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return ISe.GoogleAuth}});var XNt=iy();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return XNt.AuthClient}});var ZNt=IH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return ZNt.Compute}});var eIt=kH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return eIt.GCPEnv}});var tIt=OSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return tIt.IAMAuth}});var rIt=DH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return rIt.IdTokenClient}});var nIt=Bz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return nIt.JWTAccess}});var iIt=Vz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return iIt.JWT}});var sIt=Kz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return sIt.Impersonated}});var PSe=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return PSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return PSe.OAuth2Client}});var aIt=RH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return aIt.LoginTicket}});var oIt=zz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return oIt.UserRefreshClient}});var uIt=uG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return uIt.AwsClient}});var lIt=aG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return lIt.IdentityPoolClient}});var cIt=vG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return cIt.ExternalAccountClient}});var dIt=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return dIt.BaseExternalAccountClient}});var pIt=NSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return pIt.DownscopedClient}});var fIt=HA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return fIt.PluggableAuthClient}});var hIt=C6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return hIt.DefaultTransporter}});var mIt=new ISe.GoogleAuth;Ot.auth=mIt});var Oy=_(Ry=>{"use strict";var gIt=Ry&&Ry.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ry,"__esModule",{value:true});Ry.getServiceAccountIdToken=void 0;var yIt=xG();var vIt=gIt(Vu());var _It=new yIt.GoogleAuth;var DSe=new vIt.default({max:50,maxAge:1e3*60*50});async function EIt(t){let e=DSe.get(t);if(!e){const r=await _It.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);DSe.set(t,e)}return e}o(EIt,"getServiceAccountIdToken");Ry.getServiceAccountIdToken=EIt});var jSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Ny=As();var bIt=Oy();var wIt={"Content-Type":"application/json"};var SIt=/\/*$/;async function TIt(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({...wIt,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,bIt.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??kSe,bodySerializer:b=i??$Se,...S}=m||{};const T=LSe(h,{baseUrl:e,params:v,querySerializer:E});const A=qSe(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 Ny.ApiError(F)}throw new Ny.ApiError(Ny.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 Ny.ApiError(F)}}catch(V){}throw new Ny.ApiError(Ny.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(TIt,"createClient");Fo.createClient=TIt;function kSe(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(kSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=kSe;function $Se(t){return JSON.stringify(t)}o($Se,"defaultBodySerializer");Fo.defaultBodySerializer=$Se;function LSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(SIt,""):""}${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(LSe,"createFinalURL");Fo.createFinalURL=LSe;function qSe(...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(qSe,"mergeHeaders");Fo.mergeHeaders=qSe});var USe=_(cf=>{"use strict";var AIt=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 Iy=As();var xIt=xG();var JA=AIt(Ha());var CIt=jSe();async function RIt(t){return(0,CIt.createClient)({baseUrl:JA.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(RIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=RIt;var CG=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 xIt.GoogleAuth;const i=await n.getIdTokenClient(JA.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${JA.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:`${JA.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 Iy.ApiError(u)}throw new Iy.ApiError(Iy.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 Iy.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Iy.ApiError(Iy.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};cf.ApiKeyService=CG});var BSe=_(Py=>{"use strict";var OIt=Py&&Py.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Py,"__esModule",{value:true});Py.AuthApiService=void 0;var Nm=As();var FSe=OIt(Ha());var NIt=Oy();var RG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!FSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=FSe.default.AUTH_API_URL}async getClientJWT(e){let r;try{r=await this.fetch(`/v1/clients/${e}`,{method:"GET"})}catch(i){if(i.status===Nm.Problems.NOT_FOUND.status){r=await this.fetch(`/v1/clients`,{method:"POST",body:JSON.stringify({client_id:e})})}else{throw i}}const n=await this.fetch(`/v1/oauth/token`,{method:"POST",body:JSON.stringify({client_id:e,client_secret:r.client_secret,grant_type:"client_credentials"})});return n.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,NIt.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()}};Py.AuthApiService=RG});var XA=_(QA=>{"use strict";Object.defineProperty(QA,"__esModule",{value:true});QA.ApiServiceClient=void 0;var Dy=As();var IIt=Oy();var OG=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,IIt.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 Dy.ApiError(s)}throw new Dy.ApiError(Dy.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 Dy.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Dy.ApiError(Dy.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};QA.ApiServiceClient=OG});var zSe=_(Ml=>{"use strict";var VSe=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 PIt=VSe(Vu());var MSe=VSe(Ha());var DIt=XA();var kIt=new PIt.default({max:500,maxAge:1e3*60*50});function HSe(t,e){return`${t}--${e}.tar.gz`}o(HSe,"contentApiTarballFileName");Ml.contentApiTarballFileName=HSe;function $It(t,e){const r=HSe(t,e);return`${t}/builds/${r}`}o($It,"getContentApiStorageTarballPath");Ml.getContentApiStorageTarballPath=$It;var NG=class extends DIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!MSe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(MSe.default.CONTENT_API_URL,kIt,e)}};Ml.ContentApiService=NG});var YSe=_(ky=>{"use strict";var KSe=ky&&ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(ky,"__esModule",{value:true});ky.DevApiService=void 0;var LIt=KSe(Vu());var GSe=KSe(Ha());var qIt=XA();var jIt=new LIt.default({max:500,maxAge:1e3*60*50});var IG=class extends qIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!GSe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(GSe.default.DEV_API_URL,jIt,{userSub:n,logger:e.log,requestId:e.id})}};ky.DevApiService=IG});var QSe=_((uhr,JSe)=>{var WSe=require("stream").Stream;var UIt=require("util");JSe.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");UIt.inherits(Iu,WSe);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=WSe.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 tTe=_((chr,eTe)=>{var FIt=require("util");var ZSe=require("stream").Stream;var XSe=QSe();eTe.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");FIt.inherits(Xn,ZSe);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 XSe)){var r=XSe.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){ZSe.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 nTe=_((phr,rTe)=>{rTe.exports=BIt;function BIt(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(BIt,"defer")});var PG=_((hhr,sTe)=>{var iTe=nTe();sTe.exports=MIt;function MIt(t){var e=false;iTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{iTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(MIt,"async")});var DG=_((ghr,aTe)=>{aTe.exports=VIt;function VIt(t){Object.keys(t.jobs).forEach(HIt.bind(t));t.jobs={}}o(VIt,"abort");function HIt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(HIt,"clean")});var kG=_((vhr,uTe)=>{var oTe=PG();var zIt=DG();uTe.exports=GIt;function GIt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=KIt(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(GIt,"iterate");function KIt(t,e,r,n){var i;if(t.length==2){i=t(r,oTe(n))}else{i=t(r,e,oTe(n))}return i}o(KIt,"runJob")});var $G=_((Ehr,lTe)=>{lTe.exports=YIt;function YIt(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(YIt,"state")});var LG=_((whr,cTe)=>{var WIt=DG();var JIt=PG();cTe.exports=QIt;function QIt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;WIt(this);JIt(t)(null,this.results)}o(QIt,"terminator")});var pTe=_((Thr,dTe)=>{var XIt=kG();var ZIt=$G();var ePt=LG();dTe.exports=tPt;function tPt(t,e,r){var n=ZIt(t);while(n.index<(n["keyedList"]||t).length){XIt(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 ePt.bind(n,r)}o(tPt,"parallel")});var qG=_((xhr,ZA)=>{var fTe=kG();var rPt=$G();var nPt=LG();ZA.exports=iPt;ZA.exports.ascending=hTe;ZA.exports.descending=sPt;function iPt(t,e,r,n){var i=rPt(t,r);fTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){fTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return nPt.bind(i,n)}o(iPt,"serialOrdered");function hTe(t,e){return t<e?-1:t>e?1:0}o(hTe,"ascending");function sPt(t,e){return-1*hTe(t,e)}o(sPt,"descending")});var gTe=_((Rhr,mTe)=>{var aPt=qG();mTe.exports=oPt;function oPt(t,e,r){return aPt(t,e,null,r)}o(oPt,"serial")});var vTe=_((Nhr,yTe)=>{yTe.exports={parallel:pTe(),serial:gTe(),serialOrdered:qG()}});var ETe=_((Ihr,_Te)=>{_Te.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var STe=_((Phr,wTe)=>{var BG=tTe();var bTe=require("util");var jG=require("path");var uPt=require("http");var lPt=require("https");var cPt=require("url").parse;var dPt=require("fs");var pPt=require("stream").Stream;var UG=wB();var fPt=vTe();var FG=ETe();wTe.exports=Fr;bTe.inherits(Fr,BG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];BG.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=BG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(bTe.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 pPt)){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{dPt.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"){FG(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=jG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=jG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=jG.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=UG.lookup(t.name)}if(!r&&t.path){r=UG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=UG.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}fPt.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=cPt(t);n=FG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=FG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=lPt.request(n)}else{r=uPt.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 ATe=_(TTe=>{"use strict";var hPt=require("url").parse;var mPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var gPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function yPt(t){var e=typeof t==="string"?hPt(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)||mPt[r]||0;if(!vPt(n,i)){return""}var s=$y("npm_config_"+r+"_proxy")||$y(r+"_proxy")||$y("npm_config_proxy")||$y("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(yPt,"getProxyForUrl");function vPt(t,e){var r=($y("npm_config_no_proxy")||$y("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!gPt.call(t,s)})}o(vPt,"shouldProxy");function $y(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o($y,"getEnv");TTe.getProxyForUrl=yPt});var CTe=_((Lhr,xTe)=>{var W6;xTe.exports=function(){if(!W6){try{W6=Ja()("follow-redirects")}catch(t){}if(typeof W6!=="function"){W6=o(function(){},"debug")}}W6.apply(null,arguments)}});var $Te=_((jhr,GG)=>{var Im=require("url");var MG=Im.URL;var _Pt=require("http");var EPt=require("https");var NTe=require("stream").Writable;var ITe=require("assert");var PTe=CTe();var HG=["abort","aborted","connect","error","socket","timeout"];var zG=Object.create(null);HG.forEach(function(t){zG[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var bPt=Q6("ERR_INVALID_URL","Invalid URL",TypeError);var RTe=Q6("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var wPt=Q6("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded");var SPt=Q6("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var TPt=Q6("ERR_STREAM_WRITE_AFTER_END","write after end");function Ua(t,e){NTe.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){r._processResponse(n)};this._performRequest()}o(Ua,"RedirectableRequest");Ua.prototype=Object.create(NTe.prototype);Ua.prototype.abort=function(){kTe(this._currentRequest);this.emit("abort")};Ua.prototype.write=function(t,e,r){if(this._ending){throw new TPt}if(!Pm(t)&&!CPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(J6(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 SPt);this.abort()}};Ua.prototype.end=function(t,e,r){if(J6(t)){r=t;t=e=null}else if(J6(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}};Ua.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Ua.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Ua.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);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);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ua.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ua.prototype,t,{get:function(){return this._currentRequest[t]}})});Ua.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)}}};Ua.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}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 HG){n.on(i,zG[i])}this._currentUrl=/^\//.test(this._options.path)?Im.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")()}};Ua.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}kTe(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){this.emit("error",new wPt);return}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=[];VG(/^content-/i,this._options.headers)}var a=VG(/^host$/i,this._options.headers);var u=Im.parse(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:Im.format(Object.assign(u,{host:l}));var d;try{d=Im.resolve(c,r)}catch(m){this.emit("error",new RTe({cause:m}));return}PTe("redirecting to",d);this._isRedirect=true;var p=Im.parse(d);Object.assign(this._options,p);if(p.protocol!==u.protocol&&p.protocol!=="https:"||p.host!==l&&!xPt(p.host,l)){VG(/^(?:authorization|cookie)$/i,this._options.headers)}if(J6(i)){var f={headers:t.headers,statusCode:e};var h={url:c,method:s,headers:n};try{i(this._options,f,h)}catch(m){this.emit("error",m);return}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(m){this.emit("error",new RTe({cause:m}))}};function DTe(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(Pm(c)){var f;try{f=OTe(new MG(c))}catch(h){f=Im.parse(c)}if(!Pm(f.protocol)){throw new bPt({input:c})}c=f}else if(MG&&c instanceof MG){c=OTe(c)}else{p=d;d=c;c={protocol:i}}if(J6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Pm(d.host)&&!Pm(d.hostname)){d.hostname="::1"}ITe.equal(d.protocol,i,"protocol mismatch");PTe("options",d);return new Ua(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(DTe,"wrap");function APt(){}o(APt,"noop");function OTe(t){var e={protocol:t.protocol,hostname:t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:t.pathname+t.search,href:t.href};if(t.port!==""){e.port=Number(t.port)}return e}o(OTe,"urlToOptions");function VG(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(VG,"removeMatchingHeaders");function Q6(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);n.prototype.constructor=n;n.prototype.name="Error ["+t+"]";return n}o(Q6,"createErrorType");function kTe(t){for(var e of HG){t.removeListener(e,zG[e])}t.on("error",APt);t.abort()}o(kTe,"abortRequest");function xPt(t,e){ITe(Pm(t)&&Pm(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(xPt,"isSubdomain");function Pm(t){return typeof t==="string"||t instanceof String}o(Pm,"isString");function J6(t){return typeof t==="function"}o(J6,"isFunction");function CPt(t){return typeof t==="object"&&"length"in t}o(CPt,"isBuffer");GG.exports=DTe({http:_Pt,https:EPt});GG.exports.wrap=DTe});var lx=_((Fhr,T7e)=>{"use strict";var RPt=STe();var OPt=require("url");var NPt=ATe();var IPt=require("http");var PPt=require("https");var ZTe=require("util");var DPt=$Te();var kPt=require("zlib");var e7e=require("stream");var $Pt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var t7e=td(RPt);var LPt=td(OPt);var qPt=td(IPt);var jPt=td(PPt);var UPt=td(ZTe);var FPt=td(DPt);var hf=td(kPt);var pf=td(e7e);var BPt=td($Pt);function r7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(r7e,"bind");var{toString:MPt}=Object.prototype;var{getPrototypeOf:oK}=Object;var sx=(t=>e=>{const r=MPt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>sx(e)===t},"kindOfTest");var ax=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:Uy}=Array;var e3=ax("undefined");function VPt(t){return t!==null&&!e3(t)&&t.constructor!==null&&!e3(t.constructor)&&Mo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(VPt,"isBuffer");var n7e=Vl("ArrayBuffer");function HPt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&n7e(t.buffer)}return e}o(HPt,"isArrayBufferView");var zPt=ax("string");var Mo=ax("function");var i7e=ax("number");var ox=o(t=>t!==null&&typeof t==="object","isObject");var GPt=o(t=>t===true||t===false,"isBoolean");var tx=o(t=>{if(sx(t)!=="object"){return false}const e=oK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var KPt=Vl("Date");var YPt=Vl("File");var WPt=Vl("Blob");var JPt=Vl("FileList");var QPt=o(t=>ox(t)&&Mo(t.pipe),"isStream");var XPt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Mo(t.append)&&((e=sx(t))==="formdata"||e==="object"&&Mo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var ZPt=Vl("URLSearchParams");var eDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function r3(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(Uy(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(r3,"forEach");function s7e(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(s7e,"findKey");var a7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var o7e=o(t=>!e3(t)&&t!==a7e,"isContextDefined");function QG(){const{caseless:t}=o7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&s7e(e,i)||i;if(tx(e[s])&&tx(n)){e[s]=QG(e[s],n)}else if(tx(n)){e[s]=QG({},n)}else if(Uy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&r3(arguments[n],r)}return e}o(QG,"merge");var tDt=o((t,e,r,{allOwnKeys:n}={})=>{r3(e,(i,s)=>{if(r&&Mo(i)){t[s]=r7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var rDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var nDt=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 iDt=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&&oK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var sDt=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 aDt=o(t=>{if(!t)return null;if(Uy(t))return t;let e=t.length;if(!i7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var oDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&oK(Uint8Array));var uDt=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 lDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var cDt=Vl("HTMLFormElement");var dDt=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 LTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var pDt=Vl("RegExp");var u7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};r3(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var fDt=o(t=>{u7e(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 hDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");Uy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var mDt=o(()=>{},"noop");var gDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var KG="abcdefghijklmnopqrstuvwxyz";var qTe="0123456789";var l7e={DIGIT:qTe,ALPHA:KG,ALPHA_DIGIT:KG+KG.toUpperCase()+qTe};var yDt=o((t=16,e=l7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function vDt(t){return!!(t&&Mo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(vDt,"isSpecCompliantForm");var _Dt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(ox(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=Uy(n)?[]:{};r3(n,(a,u)=>{const l=r(a,i+1);!e3(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var EDt=Vl("AsyncFunction");var bDt=o(t=>t&&(ox(t)||Mo(t))&&Mo(t.then)&&Mo(t.catch),"isThenable");var fe={isArray:Uy,isArrayBuffer:n7e,isBuffer:VPt,isFormData:XPt,isArrayBufferView:HPt,isString:zPt,isNumber:i7e,isBoolean:GPt,isObject:ox,isPlainObject:tx,isUndefined:e3,isDate:KPt,isFile:YPt,isBlob:WPt,isRegExp:pDt,isFunction:Mo,isStream:QPt,isURLSearchParams:ZPt,isTypedArray:oDt,isFileList:JPt,forEach:r3,merge:QG,extend:tDt,trim:eDt,stripBOM:rDt,inherits:nDt,toFlatObject:iDt,kindOf:sx,kindOfTest:Vl,endsWith:sDt,toArray:aDt,forEachEntry:uDt,matchAll:lDt,isHTMLForm:cDt,hasOwnProperty:LTe,hasOwnProp:LTe,reduceDescriptors:u7e,freezeMethods:fDt,toObjectSet:hDt,toCamelCase:dDt,noop:mDt,toFiniteNumber:gDt,findKey:s7e,global:a7e,isContextDefined:o7e,ALPHABET:l7e,generateString:yDt,isSpecCompliantForm:vDt,toJSONObject:_Dt,isAsyncFn:EDt,isThenable:bDt};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 c7e=nt.prototype;var d7e={};["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=>{d7e[t]={value:t}});Object.defineProperties(nt,d7e);Object.defineProperty(c7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(c7e);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 XG(t){return fe.isPlainObject(t)||fe.isArray(t)}o(XG,"isVisitable");function p7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(p7e,"removeBrackets");function jTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=p7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(jTe,"renderKey");function wDt(t){return fe.isArray(t)&&!t.some(XG)}o(wDt,"isFlatArray");var SDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function ux(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(t7e["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)&&wDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=p7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?jTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(XG(m)){return true}e.append(jTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(SDt,{defaultVisitor:d,convertValue:c,isVisitable:XG});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(ux,"toFormData");function UTe(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(UTe,"encode$1");function f7e(t,e){this._pairs=[];t&&ux(t,this,e)}o(f7e,"AxiosURLSearchParams");var h7e=f7e.prototype;h7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");h7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,UTe)}:UTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function TDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(TDt,"encode");function uK(t,e,r){if(!e){return t}const n=r&&r.encode||TDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new f7e(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(uK,"buildURL");var ZG=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 FTe=ZG;var lK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var ADt=LPt["default"].URLSearchParams;var xDt={isNode:true,classes:{URLSearchParams:ADt,FormData:t7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var m7e=typeof window!=="undefined"&&typeof document!=="undefined";var CDt=(t=>{return m7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var RDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var ODt=Object.freeze({__proto__:null,hasBrowserEnv:m7e,hasStandardBrowserWebWorkerEnv:RDt,hasStandardBrowserEnv:CDt});var Bo={...ODt,...xDt};function NDt(t,e){return ux(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(NDt,"toURLEncodedForm");function IDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(IDt,"parsePropPath");function PDt(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(PDt,"arrayToObject");function g7e(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]=PDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(IDt(n),i,r,0)});return r}return null}o(g7e,"formDataToJSON");function DDt(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(DDt,"stringifySafely");var cK={transitional:lK,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(g7e(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 NDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ux(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return DDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||cK.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=>{cK.headers[t]={}});var dK=cK;var kDt=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 $Dt=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]&&kDt[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 BTe=Symbol("internals");function X6(t){return t&&String(t).trim().toLowerCase()}o(X6,"normalizeHeader");function rx(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(rx):String(t)}o(rx,"normalizeValue");function LDt(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(LDt,"parseTokens");var qDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function YG(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(YG,"matchHeaderValue");function jDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(jDt,"formatHeader");function UDt(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(UDt,"buildAccessors");var Ly=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=X6(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]=rx(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())&&!qDt(e)){a($Dt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=X6(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return LDt(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=X6(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||YG(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=X6(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||YG(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||YG(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]=rx(i);delete r[s];return}const u=e?jDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=rx(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[BTe]=this[BTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=X6(a);if(!n[u]){UDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};Ly.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(Ly.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods(Ly);var Vo=Ly;function WG(t,e){const r=this||dK;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(WG,"transformData");function y7e(t){return!!(t&&t.__CANCEL__)}o(y7e,"isCancel");function Dm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Dm,"CanceledError");fe.inherits(Dm,nt,{__CANCEL__:true});function Z6(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(Z6,"settle");function FDt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(FDt,"isAbsoluteURL");function BDt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(BDt,"combineURLs");function pK(t,e){if(t&&!FDt(e)){return BDt(t,e)}return e}o(pK,"buildFullPath");var ix="1.6.2";function v7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(v7e,"parseProtocol");var MDt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function VDt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=v7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=MDt.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(VDt,"fromDataURI");function HDt(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(HDt,"throttle");function _7e(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(_7e,"speedometer");var ex=Symbol("internals");var eK=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[ex]={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=_7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=HDt(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[ex];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[ex];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[ex].length=+e;return this}};var MTe=eK;var{asyncIterator:VTe}=Symbol;var zDt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[VTe]){yield*t[VTe]()}else{yield t}},"readBlob");var E7e=zDt;var GDt=fe.ALPHABET.ALPHA_DIGIT+"-_";var t3=new ZTe.TextEncoder;var ff="\r\n";var KDt=t3.encode(ff);var YDt=2;var tK=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=t3.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=t3.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+YDt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*E7e(e)}yield KDt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var WDt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,GDt)}=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=t3.encode("--"+s+ff);const u=t3.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new tK(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 e7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var JDt=WDt;var rK=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 QDt=rK;var XDt=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 ZDt=XDt;var HTe={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var ekt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var zTe=fe.isFunction(hf["default"].createBrotliDecompress);var{http:tkt,https:rkt}=FPt["default"];var nkt=/https:?/;var GTe=Bo.protocols.map(t=>{return t+":"});function ikt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(ikt,"dispatchBeforeRedirect");function b7e(t,e,r){let n=e;if(!n&&n!==false){const i=NPt.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){b7e(s,e,s.href)},"beforeRedirect")}o(b7e,"setProxy");var skt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var akt=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 okt=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 KTe=o((t,e)=>okt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var ukt=skt&&o(function t(e){return akt(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=ZDt(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=>KTe(Le)):[KTe($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new BPt["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 Dm(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=pK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||GTe[0];if(b==="data:"){let ue;if(p!=="GET"){return Z6(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=VDt(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 Z6(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(GTe.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/"+ix,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=JDt(a,Ae=>{S.set(Ae)},{tag:`axios-${ix}-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 UPt["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(E7e(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 MTe({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=uK(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:ikt,beforeRedirects:{}};!fe.isUndefined(u)&&(ae.lookup=u);if(e.socketPath){ae.socketPath=e.socketPath}else{ae.hostname=E.hostname;ae.port=E.port;b7e(ae,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+ae.path)}let Te;const le=nkt.test(ae.protocol);ae.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?jPt["default"]:qPt["default"]}else{if(e.maxRedirects){ae.maxRedirects=e.maxRedirects}if(e.beforeRedirect){ae.beforeRedirects.config=e.beforeRedirect}Te=le?rkt:tkt}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 MTe({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(HTe));delete Ae.headers["content-encoding"];break;case"deflate":we.push(new QDt);we.push(hf["default"].createUnzip(HTe));delete Ae.headers["content-encoding"];break;case"br":if(zTe){we.push(hf["default"].createBrotliDecompress(ekt));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;Z6(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))}Z6(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||lK;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 Dm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var lkt=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 ckt=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 YTe(t,e){let r=0;const n=_7e(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(YTe,"progressEventReducer");var dkt=typeof XMLHttpRequest!=="undefined";var pkt=dkt&&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=pK(t.baseURL,t.url);p.open(t.method.toUpperCase(),uK(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};Z6(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||lK;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&&ckt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&lkt.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",YTe(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",YTe(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Dm(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=v7e(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 nK={http:ukt,xhr:pkt};fe.forEach(nK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var WTe=o(t=>`- ${t}`,"renderReason");var fkt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var w7e={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(!fkt(r)){n=nK[(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(WTe).join("\n"):" "+WTe(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:nK};function JG(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Dm(null,t)}}o(JG,"throwIfCancellationRequested");function JTe(t){JG(t);t.headers=Vo.from(t.headers);t.data=WG.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=w7e.getAdapter(t.adapter||dK.adapter);return e(t).then(o(function r(n){JG(t);n.data=WG.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!y7e(n)){JG(t);if(n&&n.response){n.response.data=WG.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(JTe,"dispatchRequest");var QTe=o(t=>t instanceof Vo?t.toJSON():t,"headersToObject");function qy(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(QTe(c),QTe(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(qy,"mergeConfig");var fK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{fK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var XTe={};fK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+ix+"] 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&&!XTe[a]){XTe[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 hkt(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(hkt,"assertOptions");var iK={assertOptions:hkt,validators:fK};var df=iK.validators;var jy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new FTe,response:new FTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=qy(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){iK.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{iK.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=[JTe.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=JTe.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=qy(this.defaults,e);const r=pK(e.baseURL,e.url);return uK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){jy.prototype[e]=function(r,n){return this.request(qy(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(qy(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");jy.prototype[e]=r();jy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var nx=jy;var sK=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 Dm(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 mkt=sK;function gkt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(gkt,"spread");function ykt(t){return fe.isObject(t)&&t.isAxiosError===true}o(ykt,"isAxiosError");var aK={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(aK).forEach(([t,e])=>{aK[e]=t});var vkt=aK;function S7e(t){const e=new nx(t);const r=r7e(nx.prototype.request,e);fe.extend(r,nx.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return S7e(qy(t,i))},"create");return r}o(S7e,"createInstance");var fi=S7e(dK);fi.Axios=nx;fi.CanceledError=Dm;fi.CancelToken=mkt;fi.isCancel=y7e;fi.VERSION=ix;fi.toFormData=ux;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=gkt;fi.isAxiosError=ykt;fi.mergeConfig=qy;fi.AxiosHeaders=Vo;fi.formToJSON=t=>g7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=w7e.getAdapter;fi.HttpStatusCode=vkt;fi.default=fi;T7e.exports=fi});var dx=_(cx=>{"use strict";Object.defineProperty(cx,"__esModule",{value:true});cx.CredentialsMethod=void 0;var A7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(A7e||(cx.CredentialsMethod=A7e={}))});var $m=_(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 Fy=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=Fy;function fx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(fx,"getRequestMetadataFromPath");var x7e="fga-request-id";function EK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(EK,"getResponseHeaders");var km=class extends Fy{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}=fx((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=EK(e);this.requestId=g[x7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=km;var hK=class extends km{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}=fx((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=hK;var mK=class extends km{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=mK;var gK=class extends km{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}=fx((s=e.request)===null||s===void 0?void 0:s.path);const u=EK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=gK;var yK=class extends km{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=fx((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=yK;var vK=class extends Fy{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=EK(e);this.requestId=f[x7e];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=vK;var px=class extends Fy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=px;var _K=class extends px{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=_K});var n3=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var _kt=$m();var Ekt=o(function(t,e,r){if(r===null||r===void 0){throw new _kt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=Ekt;var bkt=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=bkt;var wkt=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=wkt});var wK=_(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:true});By.Configuration=By.GetDefaultRetryParams=void 0;var i3=dx();var bK=$m();var hx=n3();var Skt=15;var Tkt=100;var Akt="openfga-sdk js/0.3.0";function xkt(t=Skt,e=Tkt){return{maxRetry:t,minWaitInMs:e}}o(xkt,"GetDefaultRetryParams");By.GetDefaultRetryParams=xkt;var mx=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 i3.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case i3.CredentialsMethod.ClientCredentials:this.credentials={method:i3.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case i3.CredentialsMethod.None:default:this.credentials={method:i3.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"]=Akt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,hx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,hx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,hx.isWellFormedUriString)(this.getBasePath())){throw new bK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,hx.isWellFormedUlidString)(this.storeId)){throw new bK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new bK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};By.Configuration=mx;mx.sdkVersion="0.3.0"});var C7e=_(gx=>{"use strict";Object.defineProperty(gx,"__esModule",{value:true});gx.assertNever=void 0;function Ckt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Ckt,"assertNever");gx.assertNever=Ckt});var R7e=_(yx=>{"use strict";Object.defineProperty(yx,"__esModule",{value:true});yx.chunkArray=void 0;function Rkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Rkt,"chunkArray");yx.chunkArray=Rkt});var N7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var vx=require("crypto");function O7e(){if(typeof vx.randomUUID==="function"){return(0,vx.randomUUID)()}if(typeof vx.randomBytes==="function"){return(0,vx.randomBytes)(20).toString("hex")}return}o(O7e,"generateRandomId");My.generateRandomId=O7e;function Okt(){return O7e()||"00000000-0000-0000-0000-000000000000"}o(Okt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Okt});var I7e=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:true});_x.setHeaderIfNotSet=void 0;function Nkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Nkt,"setHeaderIfNotSet");_x.setHeaderIfNotSet=Nkt});var P7e=_(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:true});Ex.setNotEnumerableProperty=void 0;function Ikt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(Ikt,"setNotEnumerableProperty");Ex.setNotEnumerableProperty=Ikt});var SK=_(Pu=>{"use strict";var Pkt=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 s3=Pu&&Pu.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Pkt(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:true});s3(C7e(),Pu);s3(R7e(),Pu);s3(N7e(),Pu);s3(I7e(),Pu);s3(P7e(),Pu)});var AK=_(yi=>{"use strict";var TK=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 Dkt=bx();var Lm=$m();var kkt=SK();yi.DUMMY_BASE_URL="https://example.com";var $kt=o(function(t,e){return TK(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=$kt;var Lkt=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=Lkt;var qkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var jkt=o(function(t,e){const r=typeof t!=="string";const n=r?qkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=jkt;var Ukt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Ukt;function Fkt(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(Fkt,"isAxiosError");function Bkt(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(Bkt,"randomTime");function D7e(t,e,r){var n;return TK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!Fkt(s)){throw new Lm.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 Lm.FgaApiValidationError(s)}else if(a===401||a===403){throw new Lm.FgaApiAuthenticationError(s)}else if(a===404){throw new Lm.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new Lm.FgaApiRateLimitExceededError(s)}else{throw new Lm.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,Bkt(i,e.minWaitInMs)))}else{throw new Lm.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(D7e,"attemptHttpRequest");yi.attemptHttpRequest=D7e;var Mkt=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=Dkt.Credentials.init(r)}return(c=e)=>TK(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 D7e(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,kkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=Mkt});var $7e=_(Vy=>{"use strict";var xK=Vy&&Vy.__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(Vy,"__esModule",{value:true});Vy.Credentials=void 0;var k7e=lx();var gf=n3();var CK=$m();var Vkt=AK();var Ho=dx();var RK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=k7e.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 CK.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 xK(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 xK(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 xK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,Vkt.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},k7e.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 CK.FgaApiError){n.constructor=CK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};Vy.Credentials=RK});var bx=_(yf=>{"use strict";var Hkt=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 L7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Hkt(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});L7e($7e(),yf);L7e(dx(),yf)});var NK=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.BaseAPI=void 0;var zkt=lx();var Gkt=require("http");var Kkt=require("https");var q7e=wK();var Ykt=bx();var Wkt=1e4;var OK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof q7e.Configuration){this.configuration=e}else{this.configuration=new q7e.Configuration(e)}this.configuration.isValid();this.credentials=Ykt.Credentials.init(this.configuration);if(!this.axios){const i=new Gkt.Agent({keepAlive:true});const s=new Kkt.Agent({keepAlive:true});this.axios=zkt.default.create({httpAgent:i,httpsAgent:s,timeout:Wkt,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}};wx.BaseAPI=OK});var PK=_(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=lx();var Jkt=NK();var We=AK();var Vn=n3();var Qkt=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=Qkt;var Xkt=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=Xkt;var Zkt=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=Zkt;var IK=class extends Jkt.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=IK});var U7e=_((mmr,j7e)=>{async function*e$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(e$t,"asyncPool");j7e.exports=e$t});var F7e=_(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 DK=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 kK=U7e();var t$t=PK();var r$t=NK();var $K=$m();var Sa=SK();var n$t=n3();var LK=10;var Hy="X-OpenFGA-Client-Method";var qK="X-OpenFGA-Client-Bulk-Request-Id";var zy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(zy||(Hl.ClientWriteStatus=zy={}));var jK=class extends r$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new t$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,n$t.isWellFormedUlidString)(r)){throw new $K.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 $K.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,Sa.setHeaderIfNotSet)(n,Hy,"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=LK}=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:zy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:zy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Sa.setHeaderIfNotSet)(i,Hy,"Write");(0,Sa.setHeaderIfNotSet)(i,qK,(0,Sa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=DK(kK(a,(0,Sa.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:zy.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=DK(kK(a,(0,Sa.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:zy.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,Sa.setHeaderIfNotSet)(n,Hy,"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,Sa.setHeaderIfNotSet)(n,Hy,"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=LK}=r;(0,Sa.setHeaderIfNotSet)(u,Hy,"BatchCheck");(0,Sa.setHeaderIfNotSet)(u,qK,(0,Sa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=DK(kK(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=LK}=r;(0,Sa.setHeaderIfNotSet)(l,Hy,"ListRelations");(0,Sa.setHeaderIfNotSet)(l,qK,(0,Sa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new $K.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=jK});var K7e=_(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:true});Ta.TypeName=Ta.TupleOperation=Ta.NullValue=Ta.NotFoundErrorCode=Ta.InternalErrorCode=Ta.ErrorCode=void 0;var B7e;(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"})(B7e||(Ta.ErrorCode=B7e={}));var M7e;(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"})(M7e||(Ta.InternalErrorCode=M7e={}));var V7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(V7e||(Ta.NotFoundErrorCode=V7e={}));var H7e;(function(t){t["NullValue"]="NULL_VALUE"})(H7e||(Ta.NullValue=H7e={}));var z7e;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(z7e||(Ta.TupleOperation=z7e={}));var G7e;(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"})(G7e||(Ta.TypeName=G7e={}))});var J7e=_($i=>{"use strict";var i$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 Sx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))i$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Sx(PK(),$i);Sx(F7e(),$i);Sx(K7e(),$i);var Y7e=wK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return Y7e.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return Y7e.GetDefaultRetryParams}});var W7e=bx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return W7e.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return W7e.CredentialsMethod}});Sx($m(),$i)});var X7e=_(Gy=>{"use strict";var s$t=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.OpenFGAService=void 0;var a3=s$t(Ha());var Q7e=J7e();var a$t=Oy();var UK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!a3.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=a3.default.OPENFGA_SERVICE_URL;this.apiHost=a3.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=a3.default.OPENFGA_STORE_ID;this.modelId=a3.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,a$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new Q7e.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:Q7e.CredentialsMethod.ApiToken,config:{token:e}}})}return this.openFGAClient}async createAccountMember(e){const r=await this.getOpenFgaClient();await r.write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${e}`}]})}};Gy.OpenFGAService=UK});var tAe=_(Ky=>{"use strict";var eAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.TenantService=void 0;var o$t=eAe(Vu());var Z7e=eAe(Ha());var u$t=XA();var l$t=new o$t.default({max:500,maxAge:1e3*60*50});var FK=class extends u$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!Z7e.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(Z7e.default.TENANT_API_URL,l$t,{userSub:n,logger:e.log,requestId:e.id})}};Ky.TenantService=FK});var rAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function c$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(c$t,"sizeInBytes");zl.sizeInBytes=c$t;function d$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(d$t,"snakeCase");zl.snakeCase=d$t;function p$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(p$t,"kebabCase");zl.kebabCase=p$t;function f$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(f$t,"validateHostname");zl.validateHostname=f$t});var sAe=_(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 BK;(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})(BK||(G.TypeRegistry=BK={}));var Du=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Du;var nAe;(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})(nAe||(G.FormatRegistry=nAe={}));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 MK=class extends Du{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=MK;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)&&BK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var iAe;(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})(iAe||(G.ExtendsUndefined=iAe={}));var Tx=class extends Du{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Tx;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var qm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new Tx(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})(qm||(G.TypeExtends=qm={}));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 VK;(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})(VK||(G.IndexedAccessor=VK={}));var Yy;(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=Jy.ParseExact(d.pattern);const h=Qy.Check(f);if(!h)return{...d,pattern:a(d.pattern,p)};const m=[...Xy.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})(Yy||(G.Intrinsic=Yy={}));var Wy;(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})(Wy||(G.ObjectMap=Wy={}));var Ax;(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})(Ax||(G.KeyResolver=Ax={}));var xx=class extends Du{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=xx;var o3;(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=Jy.ParseExact(r.pattern);if(!Qy.Check(n))throw new xx("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(o3||(G.KeyArrayResolver=o3={}));var HK;(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})(HK||(G.UnionResolver=HK={}));var Cx=class extends Du{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Cx;var Rx;(function(t){function e(s){throw new Cx(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})(Rx||(G.TemplateLiteralPattern=Rx={}));var rd;(function(t){function e(r){const n=Jy.ParseExact(r.pattern);if(!Qy.Check(n))return G.Type.String();const i=[...Xy.Generate(n)].map(s=>G.Type.Literal(s));return G.Type.Union(i)}o(e,"Resolve");t.Resolve=e})(rd||(G.TemplateLiteralResolver=rd={}));var u3=class extends Du{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=u3;var Jy;(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 u3(`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 u3(`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})(Jy||(G.TemplateLiteralParser=Jy={}));var Ox=class extends Du{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Ox;var Qy;(function(t){function e(a){throw new Ox(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})(Qy||(G.TemplateLiteralFinite=Qy={}));var Nx=class extends Du{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Nx;var Xy;(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 Nx("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var zK;(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})(zK||(G.TemplateLiteralDslParser=zK={}));var Ix=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new Px(this.schema,e)}};G.TransformDecodeBuilder=Ix;var Px=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=Px;var h$t=0;var Dx=class extends Du{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=Dx;var kx=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new Dx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=kx;var l3=class extends kx{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{...Yy.Map(ct.Type(e),"Capitalize"),...r}}Composite(e,r){const n=G.Type.Intersect(e,{});const i=Ax.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(qm.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=>qm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.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=>qm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.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=o3.Resolve(r);const s=ct.Type(e);return VK.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=Ax.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{...Yy.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=o3.Resolve(r);return Wy.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 Wy.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=o3.Resolve(r);return Wy.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=Jy.ParseExact(e.pattern);return Qy.Check(i)?this.Object([...Xy.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=HK.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${h$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 Wy.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)?Rx.Create(zK.Parse(e)):Rx.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Ix(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{...Yy.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{...Yy.Map(ct.Type(e),"Uppercase"),...r}}};G.JsonTypeBuilder=l3;var $x=class extends l3{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=$x;G.JsonType=new l3;G.Type=new $x});var aAe=_(Lx=>{"use strict";Object.defineProperty(Lx,"__esModule",{value:true});Lx.CustomTypeBuilder=void 0;var c3=sAe();var GK=class extends c3.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return c3.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return c3.Type.Union([e,c3.Type.Null()])}static StringEnum(e){return c3.Type.Unsafe({type:"string",enum:e})}};Lx.CustomTypeBuilder=GK});var cAe=_(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 qx(t){return typeof t==="string"}o(qx,"isString");lt.isString=qx;function m$t(t){return Array.isArray(t)&&t.every(e=>qx(e))}o(m$t,"isStringArray");lt.isStringArray=m$t;function oAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(oAe,"isObject");lt.isObject=oAe;function g$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(g$t,"isTypedArray");lt.isTypedArray=g$t;function uAe(t){return typeof t==="number"&&!isNaN(t)}o(uAe,"isNumber");lt.isNumber=uAe;function y$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(y$t,"isIterable");lt.isIterable=y$t;function v$t(t){return t===true||t===false}o(v$t,"isBoolean");lt.isBoolean=v$t;function KK(t){return typeof t==="undefined"}o(KK,"isUndefined");lt.isUndefined=KK;function _$t(t){return!Zy(t)}o(_$t,"isDefined");lt.isDefined=_$t;function Zy(t){return KK(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function E$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(E$t,"assertType");lt.assertType=E$t;function b$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(b$t,"assertIsDefined");lt.assertIsDefined=b$t;function w$t(...t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(Zy(n)){throw new Error(`Assertion Failed: argument at index ${r} is undefined or null`)}e.push(n)}return e}o(w$t,"assertAllDefined");lt.assertAllDefined=w$t;var S$t=Object.prototype.hasOwnProperty;function T$t(t){if(!oAe(t)){return false}for(const e in t){if(S$t.call(t,e)){return false}}return true}o(T$t,"isEmptyObject");lt.isEmptyObject=T$t;function YK(t){return typeof t==="function"}o(YK,"isFunction");lt.isFunction=YK;function A$t(...t){return t.length>0&&t.every(YK)}o(A$t,"areFunctions");lt.areFunctions=A$t;function x$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){lAe(t[n],e[n])}}o(x$t,"validateConstraints");lt.validateConstraints=x$t;function lAe(t,e){if(qx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(YK(e)){try{if(t instanceof e){return}}catch{}if(!Zy(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(lAe,"validateConstraint");lt.validateConstraint=lAe;function C$t(t){return t===null?void 0:t}o(C$t,"withNullAsUndefined");lt.withNullAsUndefined=C$t;function R$t(t){return typeof t==="undefined"?null:t}o(R$t,"withUndefinedAsNull");lt.withUndefinedAsNull=R$t;var d3=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=d3;var p3=class extends d3{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=p3;var f3=class extends d3{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=f3;function O$t(t,e){if(KK(t)){throw new p3(e)}return true}o(O$t,"throwIfUndefined");lt.throwIfUndefined=O$t;function WK(t,e){if(Zy(t)){throw new p3(e)}}o(WK,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=WK;function N$t(t,e){WK(t,e);if(!qx(t)){throw new f3(e,"string")}return true}o(N$t,"throwIfNotString");lt.throwIfNotString=N$t;function I$t(t,e){WK(t,e);if(!uAe(t)){throw new f3(e,"number")}return true}o(I$t,"throwIfNotNumber");lt.throwIfNotNumber=I$t});var g3=_(xe=>{"use strict";var dAe=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 P$t=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var jx=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))dAe(e,t,r)}P$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))dAe(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.WARNING_STATUS=xe.WARNING_SEVERITY=xe.GOOD_STATUS=xe.FAILURE_STATUS=xe.ERROR_SEVERITY=xe.hasBlockedNotifications=xe.getDefaultFlags=xe.getBuildFlagsForDeployment=xe.CommonAuth=void 0;var JK=jx(Ha());xe.env=JK.default;Object.defineProperty(xe,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return JK.EnvironmentalVariableRequiredError}});Object.defineProperty(xe,"getRequiredEnvVar",{enumerable:true,get:function(){return JK.getRequiredEnvVar}});vf(As(),xe);var D$t=Zx();Object.defineProperty(xe,"CommonAuth",{enumerable:true,get:function(){return D$t.CommonAuth}});var QK=CY();Object.defineProperty(xe,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return QK.getBuildFlagsForDeployment}});Object.defineProperty(xe,"getDefaultFlags",{enumerable:true,get:function(){return QK.getDefaultFlags}});Object.defineProperty(xe,"hasBlockedNotifications",{enumerable:true,get:function(){return QK.hasBlockedNotifications}});var h3=RY();Object.defineProperty(xe,"ERROR_SEVERITY",{enumerable:true,get:function(){return h3.ERROR_SEVERITY}});Object.defineProperty(xe,"FAILURE_STATUS",{enumerable:true,get:function(){return h3.FAILURE_STATUS}});Object.defineProperty(xe,"GOOD_STATUS",{enumerable:true,get:function(){return h3.GOOD_STATUS}});Object.defineProperty(xe,"WARNING_SEVERITY",{enumerable:true,get:function(){return h3.WARNING_SEVERITY}});Object.defineProperty(xe,"WARNING_STATUS",{enumerable:true,get:function(){return h3.WARNING_STATUS}});var pAe=IY();Object.defineProperty(xe,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return pAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(xe,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return pAe.VALID_COMPATIBILITY_DATES}});var k$t=eC();Object.defineProperty(xe,"FeatureFlags",{enumerable:true,get:function(){return k$t.FeatureFlags}});var $$t=PY();Object.defineProperty(xe,"signString",{enumerable:true,get:function(){return $$t.signString}});vf(DY(),xe);var L$t=rC();Object.defineProperty(xe,"DeploymentLogState",{enumerable:true,get:function(){return L$t.DeploymentLogState}});vf(BY(),xe);vf(nC(),xe);var q$t=iC();Object.defineProperty(xe,"errorHandler",{enumerable:true,get:function(){return q$t.errorHandler}});var m3=lC();Object.defineProperty(xe,"apiKeyAuthPlugin",{enumerable:true,get:function(){return m3.apiKeyAuthPlugin}});Object.defineProperty(xe,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return m3.ensureServiceAccountPlugin}});Object.defineProperty(xe,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return m3.ensureZuploAdminPlugin}});Object.defineProperty(xe,"ensureZuploUserPlugin",{enumerable:true,get:function(){return m3.ensureZuploUserPlugin}});Object.defineProperty(xe,"featureFlagsPlugin",{enumerable:true,get:function(){return m3.featureFlagsPlugin}});var j$t=X1e();Object.defineProperty(xe,"ApiServer",{enumerable:true,get:function(){return j$t.ApiServer}});xe.fly=jx(tge());xe.CloudStorage=jx(V6e());var U$t=H6e();Object.defineProperty(xe,"graphQL",{enumerable:true,get:function(){return U$t.graphQL}});vf(h5e(),xe);var fAe=yj();Object.defineProperty(xe,"createNewLogger",{enumerable:true,get:function(){return fAe.createNewLogger}});Object.defineProperty(xe,"logger",{enumerable:true,get:function(){return fAe.logger}});var F$t=oH();Object.defineProperty(xe,"startsWithReservedKeyword",{enumerable:true,get:function(){return F$t.startsWithReservedKeyword}});var B$t=m5e();Object.defineProperty(xe,"RouteVersions",{enumerable:true,get:function(){return B$t.RouteVersions}});var hAe=USe();Object.defineProperty(xe,"ApiKeyService",{enumerable:true,get:function(){return hAe.ApiKeyService}});Object.defineProperty(xe,"createApiKeyServiceClient",{enumerable:true,get:function(){return hAe.createApiKeyServiceClient}});var M$t=Oy();Object.defineProperty(xe,"getServiceAccountIdToken",{enumerable:true,get:function(){return M$t.getServiceAccountIdToken}});var V$t=BSe();Object.defineProperty(xe,"AuthApiService",{enumerable:true,get:function(){return V$t.AuthApiService}});var XK=zSe();Object.defineProperty(xe,"ContentApiService",{enumerable:true,get:function(){return XK.ContentApiService}});Object.defineProperty(xe,"contentApiTarballFileName",{enumerable:true,get:function(){return XK.contentApiTarballFileName}});Object.defineProperty(xe,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return XK.getContentApiStorageTarballPath}});var H$t=YSe();Object.defineProperty(xe,"DevApiService",{enumerable:true,get:function(){return H$t.DevApiService}});var z$t=X7e();Object.defineProperty(xe,"OpenFGAService",{enumerable:true,get:function(){return z$t.OpenFGAService}});var G$t=tAe();Object.defineProperty(xe,"TenantService",{enumerable:true,get:function(){return G$t.TenantService}});vf(rAe(),xe);vf(aAe(),xe);vf(cAe(),xe);var K$t=R7();Object.defineProperty(xe,"JsonValidator",{enumerable:true,get:function(){return K$t.JsonValidator}});var Y$t=fH();Object.defineProperty(xe,"RouteValidator",{enumerable:true,get:function(){return Y$t.RouteValidator}});xe.xfs=jx(dM())});var y3=_(e2=>{"use strict";Object.defineProperty(e2,"__esModule",{value:true});e2.runPlugins=e2.PluginResult=void 0;var ZK=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};e2.PluginResult=ZK;async function W$t(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(W$t,"runPlugins");e2.runPlugins=W$t});var gAe=_((Lmr,mAe)=>{"use strict";function J$t(t){return t>=55296&&t<=56319}o(J$t,"isHighSurrogate");function Q$t(t){return t>=56320&&t<=57343}o(Q$t,"isLowSurrogate");mAe.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(J$t(a)&&Q$t(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 vAe=_((jmr,yAe)=>{"use strict";var X$t=gAe();var Z$t=Buffer.byteLength.bind(Buffer);yAe.exports=X$t.bind(null,Z$t)});var _Ae=_(t2=>{"use strict";var eLt=t2&&t2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(t2,"__esModule",{value:true});t2.sanitize=void 0;var tLt=eLt(vAe());var rLt=/[/?<>\\:*|"]/g;var nLt=/[\x00-\x1f\x80-\x9f]/g;var iLt=/^\.+$/;var sLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var aLt=/[. ]+$/;function oLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(rLt,e).replace(nLt,e).replace(iLt,e).replace(sLt,e).replace(aLt,e);return(0,tLt.default)(r,255)}o(oLt,"sanitize");t2.sanitize=oLt});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 SAe=_(r2=>{"use strict";var wAe=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.createProjectDirs=void 0;var EAe=wAe(require("fs/promises"));var uLt=wAe(require("path"));var v3=Gl();var bAe=y3();var lLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[v3.USER_MODULES_DIR_NAME,v3.USER_CONFIG_DIR_NAME,v3.USER_TEST_DIR_NAME,v3.USER_SCHEMAS_DIR_NAME,v3.USER_DOCS_DIR_NAME,".vscode"];try{await EAe.default.mkdir(t);for(const n of r){await EAe.default.mkdir(uLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new bAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new bAe.PluginResult},"createProjectDirs");r2.createProjectDirs=lLt});var TAe=_(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:true});var Ux=require("perf_hooks");var eY=[];async function cLt(t,e){const r=Ux.performance.timerify(e);const n=new Ux.PerformanceObserver(i=>{const s=i.getEntries()[0];eY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(cLt,"timeFn");var dLt={mark:t=>{Ux.performance.mark(t)},measure:(t,e,r)=>{Ux.performance.measure(t,e,r)},timeFn:cLt,report:()=>{if(eY.length>0){console.table(eY)}}};tY.default=dLt});var RAe=_(n2=>{"use strict";var CAe=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.generateFromTemplate=void 0;var pLt=require("fs");var AAe=CAe(require("fs/promises"));var xAe=CAe(require("path"));async function fLt(t){const e=xAe.default.resolve(__dirname,"..","templates",t);if((0,pLt.existsSync)(e)){const r=await AAe.default.readFile(e,"utf-8");return r}else{const r=xAe.default.resolve(__dirname,"templates",t);const n=await AAe.default.readFile(r,"utf-8");return n}}o(fLt,"generateFromTemplate");n2.generateFromTemplate=fLt});var Aa=_(i2=>{"use strict";var rY=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFileFromTemplate=void 0;var hLt=g3();var mLt=rY(require("fs/promises"));var gLt=rY(require("path"));var yLt=rY(TAe());var vLt=RAe();var _Lt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return yLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=gLt.default.join(r,t);if(await hLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return ELt(i,e,n)})}},"generateFileFromTemplate");i2.generateFileFromTemplate=_Lt;async function ELt(t,e,r){const n=await(0,vLt.generateFromTemplate)(e);try{await mLt.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(ELt,"writeTemplate")});var NAe=_(s2=>{"use strict";var bLt=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateDefaultDocsMarkdown=void 0;var wLt=bLt(require("path"));var OAe=Gl();var SLt=Aa();s2.generateDefaultDocsMarkdown=(0,SLt.generateFileFromTemplate)(wLt.default.join(OAe.USER_DOCS_DIR_NAME,OAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var PAe=_(a2=>{"use strict";var TLt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsSidebar=void 0;var ALt=TLt(require("path"));var IAe=Gl();var xLt=Aa();a2.generateDefaultDocsSidebar=(0,xLt.generateFileFromTemplate)(ALt.default.join(IAe.USER_DOCS_DIR_NAME,IAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var kAe=_(o2=>{"use strict";var CLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsTheme=void 0;var RLt=CLt(require("path"));var DAe=Gl();var OLt=Aa();o2.generateDefaultDocsTheme=(0,OLt.generateFileFromTemplate)(RLt.default.join(DAe.USER_DOCS_DIR_NAME,DAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var LAe=_(u2=>{"use strict";var NLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultModule=void 0;var ILt=NLt(require("path"));var $Ae=Gl();var PLt=Aa();u2.generateDefaultModule=(0,PLt.generateFileFromTemplate)(ILt.default.join($Ae.USER_MODULES_DIR_NAME,$Ae.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var jAe=_(l2=>{"use strict";var DLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDevPortalConfigJson=void 0;var kLt=DLt(require("path"));var qAe=Gl();var $Lt=Aa();l2.generateDevPortalConfigJson=(0,$Lt.generateFileFromTemplate)(kLt.default.join(qAe.USER_CONFIG_DIR_NAME,qAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var UAe=_(Fx=>{"use strict";Object.defineProperty(Fx,"__esModule",{value:true});Fx.generateEnvironment=void 0;var LLt=Aa();Fx.generateEnvironment=(0,LLt.generateFileFromTemplate)(".env","env.template")});var FAe=_(Bx=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:true});Bx.generateESLint=void 0;var qLt=Aa();Bx.generateESLint=(0,qLt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var BAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.generateGitignore=void 0;var jLt=Aa();Mx.generateGitignore=(0,jLt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var MAe=_(c2=>{"use strict";var ULt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateLaunchJson=void 0;var FLt=ULt(require("path"));var BLt=Aa();c2.generateLaunchJson=(0,BLt.generateFileFromTemplate)(FLt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var VAe=_(d2=>{"use strict";var MLt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateSettingsJson=void 0;var VLt=MLt(require("path"));var HLt=Aa();d2.generateSettingsJson=(0,HLt.generateFileFromTemplate)(VLt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var zAe=_(p2=>{"use strict";var zLt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateRouteOasConfig=void 0;var GLt=zLt(require("path"));var HAe=Gl();var KLt=Aa();p2.generateRouteOasConfig=(0,KLt.generateFileFromTemplate)(GLt.default.join(HAe.USER_CONFIG_DIR_NAME,HAe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var WAe=_(zo=>{"use strict";var GAe=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 YLt=g3();var KAe=GAe(require("fs/promises"));var nY=GAe(require("path"));async function WLt(t,e=YLt.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=YAe();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(WLt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=WLt;function YAe(){const t=nY.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(YAe,"getPackageOverrides");zo.getPackageOverrides=YAe;async function JLt(t){const e=nY.default.join(t,"package.json");const r=await KAe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(JLt,"getProjectPackageJson");zo.getProjectPackageJson=JLt;async function QLt(t,e){const r=nY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await KAe.default.writeFile(r,n,"utf-8")}o(QLt,"updateProjectPackageJson");zo.updateProjectPackageJson=QLt});var XAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generatePackageJson=void 0;var JAe=WAe();var QAe=y3();var XLt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,JAe.generateDefaultPackageJson)(e);try{await(0,JAe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new QAe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new QAe.PluginResult},"generatePackageJson");Vx.generatePackageJson=XLt});var exe=_(f2=>{"use strict";var ZLt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generatePoliciesConfig=void 0;var eqt=ZLt(require("path"));var ZAe=Gl();var tqt=Aa();f2.generatePoliciesConfig=(0,tqt.generateFileFromTemplate)(eqt.default.join(ZAe.USER_CONFIG_DIR_NAME,ZAe.POLICIES_CONFIG_FILE),"policies.template.json")});var txe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generateTSConfig=void 0;var rqt=Aa();Hx.generateTSConfig=(0,rqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var nxe=_(h2=>{"use strict";var nqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generateZuploJson=void 0;var iqt=g3();var sqt=require("fs/promises");var aqt=nqt(require("path"));var oqt=Gl();var rxe=y3();var uqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:iqt.DEFAULT_COMPATIBILITY_DATE};const i=aqt.default.join(e,oqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,sqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new rxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new rxe.PluginResult},"generateZuploJson");h2.generateZuploJson=uqt});var sxe=_(m2=>{"use strict";var lqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.create=void 0;var iY=g3();var cqt=require("fs/promises");var dqt=lqt(require("path"));var pqt=y3();var ixe=_Ae();var fqt=SAe();var hqt=NAe();var mqt=PAe();var gqt=kAe();var yqt=LAe();var vqt=jAe();var _qt=UAe();var Eqt=FAe();var bqt=BAe();var wqt=MAe();var Sqt=VAe();var Tqt=zAe();var Aqt=XAe();var xqt=exe();var Cqt=txe();var Rqt=nxe();async function Oqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,ixe.sanitize)(t);const s=(0,ixe.sanitize)(e);const a=dqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await iY.xfs.dirExists(a)){throw new iY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:iY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[fqt.createProjectDirs,Tqt.generateRouteOasConfig,Rqt.generateZuploJson,vqt.generateDevPortalConfigJson,yqt.generateDefaultModule,mqt.generateDefaultDocsSidebar,hqt.generateDefaultDocsMarkdown,gqt.generateDefaultDocsTheme,xqt.generatePoliciesConfig]);l.push(...[Cqt.generateTSConfig,bqt.generateGitignore,Aqt.generatePackageJson,_qt.generateEnvironment,Eqt.generateESLint,wqt.generateLaunchJson,Sqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,pqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,cqt.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(Oqt,"create");m2.create=Oqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Nqt=sxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Nqt.create}});
410
+ `+await t.crypto.sha256DigestHex(h);const y=await vNt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await H6(t.crypto,y,g);const w=`${ySe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,vSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(_Nt,"generateAuthenticationHeaderMap")});var uG=_(LA=>{"use strict";Object.defineProperty(LA,"__esModule",{value:true});LA.AwsClient=void 0;var ENt=_Se();var bNt=lf();var z6=class extends bNt.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 ENt.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}};LA.AwsClient=z6;z6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";z6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var fG=_(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 qA="urn:ietf:params:oauth:token-type:saml2";var lG="urn:ietf:params:oauth:token-type:id_token";var cG="urn:ietf:params:oauth:token-type:jwt";var dG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new jA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new UA("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!==qA&&this.tokenType!==lG&&this.tokenType!==cG){throw new FA(`Executable response must contain a 'token_type' field when successful and it must be one of ${lG}, ${cG}, or ${qA}.`)}if(this.tokenType===qA){if(!e.saml_response){throw new G6(`Executable response must contain a 'saml_response' field when token_type=${qA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new G6(`Executable response must contain a 'id_token' field when token_type=${lG} or ${cG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new BA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new MA("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=dG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var jA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=jA;var UA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=UA;var pG=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=pG;var FA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=FA;var BA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=BA;var MA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=MA;var G6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=G6});var ESe=_(VA=>{"use strict";Object.defineProperty(VA,"__esModule",{value:true});VA.PluggableAuthHandler=void 0;var wNt=HA();var Om=fG();var SNt=require("child_process");var hG=require("fs");var mG=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=SNt.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 wNt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await hG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await hG.promises.lstat(e)).isFile()){return void 0}const r=await hG.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}};VA.PluggableAuthHandler=mG});var HA=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.PluggableAuthClient=Ty.ExecutableError=void 0;var TNt=lf();var ANt=fG();var xNt=ESe();var zA=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)}};Ty.ExecutableError=zA;var CNt=30*1e3;var bSe=5*1e3;var wSe=120*1e3;var RNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var SSe=1;var gG=class extends TNt.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=CNt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<bSe||this.timeoutMillis>wSe){throw new Error(`Timeout must be between ${bSe} and ${wSe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new xNt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[RNt]!=="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>SSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${SSe}.`)}if(!e.success){throw new zA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new ANt.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}};Ty.PluggableAuthClient=gG});var vG=_(GA=>{"use strict";Object.defineProperty(GA,"__esModule",{value:true});GA.ExternalAccountClient=void 0;var ONt=lf();var NNt=aG();var INt=uG();var PNt=HA();var yG=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===ONt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new INt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new PNt.PluggableAuthClient(e,r)}else{return new NNt.IdentityPoolClient(e,r)}}else{return null}}};GA.ExternalAccountClient=yG});var ASe=_(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:true});Ay.ExternalAccountAuthorizedUserClient=Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var DNt=iy();var TSe=Wz();var kNt=Wc();var $Nt=require("stream");var LNt=lf();Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var _G=class extends TSe.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 kNt.GaxiosError&&a.response){throw(0,TSe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var EG=class extends DNt.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 _G(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=LNt.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 $Nt.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}};Ay.ExternalAccountAuthorizedUserClient=EG});var RSe=_(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:true});Cy.GoogleAuth=Cy.CLOUD_SDK_CLIENT_ID=void 0;var qNt=require("child_process");var K6=require("fs");var bG=U7();var jNt=require("os");var wG=require("path");var UNt=ry();var FNt=C6();var BNt=IH();var MNt=DH();var VNt=kH();var xy=Vz();var SG=zz();var KA=Kz();var HNt=vG();var Y6=lf();var xSe=ASe();Cy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var CSe={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 YA=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===CSe.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(CSe.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 xy.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 xy.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 BNt.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 bG.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=wG.join(i,".config")}}if(r){r=wG.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!==KA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${KA.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 SG.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 KA.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===SG.USER_REFRESH_ACCOUNT_TYPE){n=new SG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===KA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===Y6.EXTERNAL_ACCOUNT_TYPE){n=HNt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===xSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new xSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new xy.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 xy.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 xy.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=jNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,qNt.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 bG.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 bG.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=wG.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 MNt.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,VNt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,UNt.createCrypto)();if(r instanceof xy.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}};Cy.GoogleAuth=YA;YA.DefaultTransporter=FNt.DefaultTransporter});var OSe=_(WA=>{"use strict";Object.defineProperty(WA,"__esModule",{value:true});WA.IAMAuth=void 0;var TG=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}}};WA.IAMAuth=TG});var NSe=_(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 GNt=iy();var KNt=Qz();var YNt="urn:ietf:params:oauth:grant-type:token-exchange";var WNt="urn:ietf:params:oauth:token-type:access_token";var JNt="urn:ietf:params:oauth:token-type:access_token";var QNt="https://sts.googleapis.com/v1/token";Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Nu.EXPIRATION_TIME_OFFSET=5*60*1e3;var AG=class extends GNt.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 KNt.StsCredentials(QNt);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:YNt,requestedTokenType:WNt,subjectToken:r,subjectTokenType:JNt};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=AG});var xG=_(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 ISe=RSe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return ISe.GoogleAuth}});var XNt=iy();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return XNt.AuthClient}});var ZNt=IH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return ZNt.Compute}});var eIt=kH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return eIt.GCPEnv}});var tIt=OSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return tIt.IAMAuth}});var rIt=DH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return rIt.IdTokenClient}});var nIt=Bz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return nIt.JWTAccess}});var iIt=Vz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return iIt.JWT}});var sIt=Kz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return sIt.Impersonated}});var PSe=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return PSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return PSe.OAuth2Client}});var aIt=RH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return aIt.LoginTicket}});var oIt=zz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return oIt.UserRefreshClient}});var uIt=uG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return uIt.AwsClient}});var lIt=aG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return lIt.IdentityPoolClient}});var cIt=vG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return cIt.ExternalAccountClient}});var dIt=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return dIt.BaseExternalAccountClient}});var pIt=NSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return pIt.DownscopedClient}});var fIt=HA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return fIt.PluggableAuthClient}});var hIt=C6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return hIt.DefaultTransporter}});var mIt=new ISe.GoogleAuth;Ot.auth=mIt});var Oy=_(Ry=>{"use strict";var gIt=Ry&&Ry.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ry,"__esModule",{value:true});Ry.getServiceAccountIdToken=void 0;var yIt=xG();var vIt=gIt(Vu());var _It=new yIt.GoogleAuth;var DSe=new vIt.default({max:50,maxAge:1e3*60*50});async function EIt(t){let e=DSe.get(t);if(!e){const r=await _It.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);DSe.set(t,e)}return e}o(EIt,"getServiceAccountIdToken");Ry.getServiceAccountIdToken=EIt});var jSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Ny=As();var bIt=Oy();var wIt={"Content-Type":"application/json"};var SIt=/\/*$/;async function TIt(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({...wIt,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,bIt.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??kSe,bodySerializer:b=i??$Se,...S}=m||{};const T=LSe(h,{baseUrl:e,params:v,querySerializer:E});const A=qSe(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 Ny.ApiError(F)}throw new Ny.ApiError(Ny.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 Ny.ApiError(F)}}catch(V){}throw new Ny.ApiError(Ny.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(TIt,"createClient");Fo.createClient=TIt;function kSe(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(kSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=kSe;function $Se(t){return JSON.stringify(t)}o($Se,"defaultBodySerializer");Fo.defaultBodySerializer=$Se;function LSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(SIt,""):""}${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(LSe,"createFinalURL");Fo.createFinalURL=LSe;function qSe(...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(qSe,"mergeHeaders");Fo.mergeHeaders=qSe});var USe=_(cf=>{"use strict";var AIt=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 Iy=As();var xIt=xG();var JA=AIt(Ha());var CIt=jSe();async function RIt(t){return(0,CIt.createClient)({baseUrl:JA.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(RIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=RIt;var CG=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 xIt.GoogleAuth;const i=await n.getIdTokenClient(JA.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${JA.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:`${JA.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 Iy.ApiError(u)}throw new Iy.ApiError(Iy.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 Iy.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Iy.ApiError(Iy.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};cf.ApiKeyService=CG});var BSe=_(Py=>{"use strict";var OIt=Py&&Py.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Py,"__esModule",{value:true});Py.AuthApiService=void 0;var Nm=As();var FSe=OIt(Ha());var NIt=Oy();var RG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!FSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=FSe.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,NIt.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()}};Py.AuthApiService=RG});var XA=_(QA=>{"use strict";Object.defineProperty(QA,"__esModule",{value:true});QA.ApiServiceClient=void 0;var Dy=As();var IIt=Oy();var OG=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,IIt.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 Dy.ApiError(s)}throw new Dy.ApiError(Dy.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 Dy.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Dy.ApiError(Dy.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};QA.ApiServiceClient=OG});var zSe=_(Ml=>{"use strict";var VSe=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 PIt=VSe(Vu());var MSe=VSe(Ha());var DIt=XA();var kIt=new PIt.default({max:500,maxAge:1e3*60*50});function HSe(t,e){return`${t}--${e}.tar.gz`}o(HSe,"contentApiTarballFileName");Ml.contentApiTarballFileName=HSe;function $It(t,e){const r=HSe(t,e);return`${t}/builds/${r}`}o($It,"getContentApiStorageTarballPath");Ml.getContentApiStorageTarballPath=$It;var NG=class extends DIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!MSe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(MSe.default.CONTENT_API_URL,kIt,e)}};Ml.ContentApiService=NG});var YSe=_(ky=>{"use strict";var KSe=ky&&ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(ky,"__esModule",{value:true});ky.DevApiService=void 0;var LIt=KSe(Vu());var GSe=KSe(Ha());var qIt=XA();var jIt=new LIt.default({max:500,maxAge:1e3*60*50});var IG=class extends qIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!GSe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(GSe.default.DEV_API_URL,jIt,{userSub:n,logger:e.log,requestId:e.id})}};ky.DevApiService=IG});var QSe=_((uhr,JSe)=>{var WSe=require("stream").Stream;var UIt=require("util");JSe.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");UIt.inherits(Iu,WSe);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=WSe.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 tTe=_((chr,eTe)=>{var FIt=require("util");var ZSe=require("stream").Stream;var XSe=QSe();eTe.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");FIt.inherits(Xn,ZSe);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 XSe)){var r=XSe.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){ZSe.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 nTe=_((phr,rTe)=>{rTe.exports=BIt;function BIt(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(BIt,"defer")});var PG=_((hhr,sTe)=>{var iTe=nTe();sTe.exports=MIt;function MIt(t){var e=false;iTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{iTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(MIt,"async")});var DG=_((ghr,aTe)=>{aTe.exports=VIt;function VIt(t){Object.keys(t.jobs).forEach(HIt.bind(t));t.jobs={}}o(VIt,"abort");function HIt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(HIt,"clean")});var kG=_((vhr,uTe)=>{var oTe=PG();var zIt=DG();uTe.exports=GIt;function GIt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=KIt(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(GIt,"iterate");function KIt(t,e,r,n){var i;if(t.length==2){i=t(r,oTe(n))}else{i=t(r,e,oTe(n))}return i}o(KIt,"runJob")});var $G=_((Ehr,lTe)=>{lTe.exports=YIt;function YIt(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(YIt,"state")});var LG=_((whr,cTe)=>{var WIt=DG();var JIt=PG();cTe.exports=QIt;function QIt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;WIt(this);JIt(t)(null,this.results)}o(QIt,"terminator")});var pTe=_((Thr,dTe)=>{var XIt=kG();var ZIt=$G();var ePt=LG();dTe.exports=tPt;function tPt(t,e,r){var n=ZIt(t);while(n.index<(n["keyedList"]||t).length){XIt(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 ePt.bind(n,r)}o(tPt,"parallel")});var qG=_((xhr,ZA)=>{var fTe=kG();var rPt=$G();var nPt=LG();ZA.exports=iPt;ZA.exports.ascending=hTe;ZA.exports.descending=sPt;function iPt(t,e,r,n){var i=rPt(t,r);fTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){fTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return nPt.bind(i,n)}o(iPt,"serialOrdered");function hTe(t,e){return t<e?-1:t>e?1:0}o(hTe,"ascending");function sPt(t,e){return-1*hTe(t,e)}o(sPt,"descending")});var gTe=_((Rhr,mTe)=>{var aPt=qG();mTe.exports=oPt;function oPt(t,e,r){return aPt(t,e,null,r)}o(oPt,"serial")});var vTe=_((Nhr,yTe)=>{yTe.exports={parallel:pTe(),serial:gTe(),serialOrdered:qG()}});var ETe=_((Ihr,_Te)=>{_Te.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var STe=_((Phr,wTe)=>{var BG=tTe();var bTe=require("util");var jG=require("path");var uPt=require("http");var lPt=require("https");var cPt=require("url").parse;var dPt=require("fs");var pPt=require("stream").Stream;var UG=wB();var fPt=vTe();var FG=ETe();wTe.exports=Fr;bTe.inherits(Fr,BG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];BG.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=BG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(bTe.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 pPt)){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{dPt.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"){FG(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=jG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=jG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=jG.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=UG.lookup(t.name)}if(!r&&t.path){r=UG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=UG.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}fPt.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=cPt(t);n=FG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=FG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=lPt.request(n)}else{r=uPt.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 ATe=_(TTe=>{"use strict";var hPt=require("url").parse;var mPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var gPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function yPt(t){var e=typeof t==="string"?hPt(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)||mPt[r]||0;if(!vPt(n,i)){return""}var s=$y("npm_config_"+r+"_proxy")||$y(r+"_proxy")||$y("npm_config_proxy")||$y("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(yPt,"getProxyForUrl");function vPt(t,e){var r=($y("npm_config_no_proxy")||$y("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!gPt.call(t,s)})}o(vPt,"shouldProxy");function $y(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o($y,"getEnv");TTe.getProxyForUrl=yPt});var CTe=_((Lhr,xTe)=>{var W6;xTe.exports=function(){if(!W6){try{W6=Ja()("follow-redirects")}catch(t){}if(typeof W6!=="function"){W6=o(function(){},"debug")}}W6.apply(null,arguments)}});var $Te=_((jhr,GG)=>{var Im=require("url");var MG=Im.URL;var _Pt=require("http");var EPt=require("https");var NTe=require("stream").Writable;var ITe=require("assert");var PTe=CTe();var HG=["abort","aborted","connect","error","socket","timeout"];var zG=Object.create(null);HG.forEach(function(t){zG[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var bPt=Q6("ERR_INVALID_URL","Invalid URL",TypeError);var RTe=Q6("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var wPt=Q6("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded");var SPt=Q6("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var TPt=Q6("ERR_STREAM_WRITE_AFTER_END","write after end");function Ua(t,e){NTe.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){r._processResponse(n)};this._performRequest()}o(Ua,"RedirectableRequest");Ua.prototype=Object.create(NTe.prototype);Ua.prototype.abort=function(){kTe(this._currentRequest);this.emit("abort")};Ua.prototype.write=function(t,e,r){if(this._ending){throw new TPt}if(!Pm(t)&&!CPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(J6(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 SPt);this.abort()}};Ua.prototype.end=function(t,e,r){if(J6(t)){r=t;t=e=null}else if(J6(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}};Ua.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Ua.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Ua.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);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);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ua.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ua.prototype,t,{get:function(){return this._currentRequest[t]}})});Ua.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)}}};Ua.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}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 HG){n.on(i,zG[i])}this._currentUrl=/^\//.test(this._options.path)?Im.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")()}};Ua.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}kTe(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){this.emit("error",new wPt);return}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=[];VG(/^content-/i,this._options.headers)}var a=VG(/^host$/i,this._options.headers);var u=Im.parse(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:Im.format(Object.assign(u,{host:l}));var d;try{d=Im.resolve(c,r)}catch(m){this.emit("error",new RTe({cause:m}));return}PTe("redirecting to",d);this._isRedirect=true;var p=Im.parse(d);Object.assign(this._options,p);if(p.protocol!==u.protocol&&p.protocol!=="https:"||p.host!==l&&!xPt(p.host,l)){VG(/^(?:authorization|cookie)$/i,this._options.headers)}if(J6(i)){var f={headers:t.headers,statusCode:e};var h={url:c,method:s,headers:n};try{i(this._options,f,h)}catch(m){this.emit("error",m);return}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(m){this.emit("error",new RTe({cause:m}))}};function DTe(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(Pm(c)){var f;try{f=OTe(new MG(c))}catch(h){f=Im.parse(c)}if(!Pm(f.protocol)){throw new bPt({input:c})}c=f}else if(MG&&c instanceof MG){c=OTe(c)}else{p=d;d=c;c={protocol:i}}if(J6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Pm(d.host)&&!Pm(d.hostname)){d.hostname="::1"}ITe.equal(d.protocol,i,"protocol mismatch");PTe("options",d);return new Ua(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(DTe,"wrap");function APt(){}o(APt,"noop");function OTe(t){var e={protocol:t.protocol,hostname:t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:t.pathname+t.search,href:t.href};if(t.port!==""){e.port=Number(t.port)}return e}o(OTe,"urlToOptions");function VG(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(VG,"removeMatchingHeaders");function Q6(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);n.prototype.constructor=n;n.prototype.name="Error ["+t+"]";return n}o(Q6,"createErrorType");function kTe(t){for(var e of HG){t.removeListener(e,zG[e])}t.on("error",APt);t.abort()}o(kTe,"abortRequest");function xPt(t,e){ITe(Pm(t)&&Pm(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(xPt,"isSubdomain");function Pm(t){return typeof t==="string"||t instanceof String}o(Pm,"isString");function J6(t){return typeof t==="function"}o(J6,"isFunction");function CPt(t){return typeof t==="object"&&"length"in t}o(CPt,"isBuffer");GG.exports=DTe({http:_Pt,https:EPt});GG.exports.wrap=DTe});var lx=_((Fhr,T7e)=>{"use strict";var RPt=STe();var OPt=require("url");var NPt=ATe();var IPt=require("http");var PPt=require("https");var ZTe=require("util");var DPt=$Te();var kPt=require("zlib");var e7e=require("stream");var $Pt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var t7e=td(RPt);var LPt=td(OPt);var qPt=td(IPt);var jPt=td(PPt);var UPt=td(ZTe);var FPt=td(DPt);var hf=td(kPt);var pf=td(e7e);var BPt=td($Pt);function r7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(r7e,"bind");var{toString:MPt}=Object.prototype;var{getPrototypeOf:oK}=Object;var sx=(t=>e=>{const r=MPt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>sx(e)===t},"kindOfTest");var ax=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:Uy}=Array;var e3=ax("undefined");function VPt(t){return t!==null&&!e3(t)&&t.constructor!==null&&!e3(t.constructor)&&Mo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(VPt,"isBuffer");var n7e=Vl("ArrayBuffer");function HPt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&n7e(t.buffer)}return e}o(HPt,"isArrayBufferView");var zPt=ax("string");var Mo=ax("function");var i7e=ax("number");var ox=o(t=>t!==null&&typeof t==="object","isObject");var GPt=o(t=>t===true||t===false,"isBoolean");var tx=o(t=>{if(sx(t)!=="object"){return false}const e=oK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var KPt=Vl("Date");var YPt=Vl("File");var WPt=Vl("Blob");var JPt=Vl("FileList");var QPt=o(t=>ox(t)&&Mo(t.pipe),"isStream");var XPt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Mo(t.append)&&((e=sx(t))==="formdata"||e==="object"&&Mo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var ZPt=Vl("URLSearchParams");var eDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function r3(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(Uy(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(r3,"forEach");function s7e(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(s7e,"findKey");var a7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var o7e=o(t=>!e3(t)&&t!==a7e,"isContextDefined");function QG(){const{caseless:t}=o7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&s7e(e,i)||i;if(tx(e[s])&&tx(n)){e[s]=QG(e[s],n)}else if(tx(n)){e[s]=QG({},n)}else if(Uy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&r3(arguments[n],r)}return e}o(QG,"merge");var tDt=o((t,e,r,{allOwnKeys:n}={})=>{r3(e,(i,s)=>{if(r&&Mo(i)){t[s]=r7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var rDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var nDt=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 iDt=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&&oK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var sDt=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 aDt=o(t=>{if(!t)return null;if(Uy(t))return t;let e=t.length;if(!i7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var oDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&oK(Uint8Array));var uDt=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 lDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var cDt=Vl("HTMLFormElement");var dDt=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 LTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var pDt=Vl("RegExp");var u7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};r3(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var fDt=o(t=>{u7e(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 hDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");Uy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var mDt=o(()=>{},"noop");var gDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var KG="abcdefghijklmnopqrstuvwxyz";var qTe="0123456789";var l7e={DIGIT:qTe,ALPHA:KG,ALPHA_DIGIT:KG+KG.toUpperCase()+qTe};var yDt=o((t=16,e=l7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function vDt(t){return!!(t&&Mo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(vDt,"isSpecCompliantForm");var _Dt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(ox(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=Uy(n)?[]:{};r3(n,(a,u)=>{const l=r(a,i+1);!e3(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var EDt=Vl("AsyncFunction");var bDt=o(t=>t&&(ox(t)||Mo(t))&&Mo(t.then)&&Mo(t.catch),"isThenable");var fe={isArray:Uy,isArrayBuffer:n7e,isBuffer:VPt,isFormData:XPt,isArrayBufferView:HPt,isString:zPt,isNumber:i7e,isBoolean:GPt,isObject:ox,isPlainObject:tx,isUndefined:e3,isDate:KPt,isFile:YPt,isBlob:WPt,isRegExp:pDt,isFunction:Mo,isStream:QPt,isURLSearchParams:ZPt,isTypedArray:oDt,isFileList:JPt,forEach:r3,merge:QG,extend:tDt,trim:eDt,stripBOM:rDt,inherits:nDt,toFlatObject:iDt,kindOf:sx,kindOfTest:Vl,endsWith:sDt,toArray:aDt,forEachEntry:uDt,matchAll:lDt,isHTMLForm:cDt,hasOwnProperty:LTe,hasOwnProp:LTe,reduceDescriptors:u7e,freezeMethods:fDt,toObjectSet:hDt,toCamelCase:dDt,noop:mDt,toFiniteNumber:gDt,findKey:s7e,global:a7e,isContextDefined:o7e,ALPHABET:l7e,generateString:yDt,isSpecCompliantForm:vDt,toJSONObject:_Dt,isAsyncFn:EDt,isThenable:bDt};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 c7e=nt.prototype;var d7e={};["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=>{d7e[t]={value:t}});Object.defineProperties(nt,d7e);Object.defineProperty(c7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(c7e);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 XG(t){return fe.isPlainObject(t)||fe.isArray(t)}o(XG,"isVisitable");function p7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(p7e,"removeBrackets");function jTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=p7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(jTe,"renderKey");function wDt(t){return fe.isArray(t)&&!t.some(XG)}o(wDt,"isFlatArray");var SDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function ux(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(t7e["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)&&wDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=p7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?jTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(XG(m)){return true}e.append(jTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(SDt,{defaultVisitor:d,convertValue:c,isVisitable:XG});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(ux,"toFormData");function UTe(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(UTe,"encode$1");function f7e(t,e){this._pairs=[];t&&ux(t,this,e)}o(f7e,"AxiosURLSearchParams");var h7e=f7e.prototype;h7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");h7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,UTe)}:UTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function TDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(TDt,"encode");function uK(t,e,r){if(!e){return t}const n=r&&r.encode||TDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new f7e(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(uK,"buildURL");var ZG=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 FTe=ZG;var lK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var ADt=LPt["default"].URLSearchParams;var xDt={isNode:true,classes:{URLSearchParams:ADt,FormData:t7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var m7e=typeof window!=="undefined"&&typeof document!=="undefined";var CDt=(t=>{return m7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var RDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var ODt=Object.freeze({__proto__:null,hasBrowserEnv:m7e,hasStandardBrowserWebWorkerEnv:RDt,hasStandardBrowserEnv:CDt});var Bo={...ODt,...xDt};function NDt(t,e){return ux(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(NDt,"toURLEncodedForm");function IDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(IDt,"parsePropPath");function PDt(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(PDt,"arrayToObject");function g7e(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]=PDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(IDt(n),i,r,0)});return r}return null}o(g7e,"formDataToJSON");function DDt(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(DDt,"stringifySafely");var cK={transitional:lK,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(g7e(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 NDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ux(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return DDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||cK.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=>{cK.headers[t]={}});var dK=cK;var kDt=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 $Dt=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]&&kDt[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 BTe=Symbol("internals");function X6(t){return t&&String(t).trim().toLowerCase()}o(X6,"normalizeHeader");function rx(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(rx):String(t)}o(rx,"normalizeValue");function LDt(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(LDt,"parseTokens");var qDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function YG(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(YG,"matchHeaderValue");function jDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(jDt,"formatHeader");function UDt(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(UDt,"buildAccessors");var Ly=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=X6(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]=rx(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())&&!qDt(e)){a($Dt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=X6(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return LDt(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=X6(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||YG(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=X6(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||YG(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||YG(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]=rx(i);delete r[s];return}const u=e?jDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=rx(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[BTe]=this[BTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=X6(a);if(!n[u]){UDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};Ly.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(Ly.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods(Ly);var Vo=Ly;function WG(t,e){const r=this||dK;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(WG,"transformData");function y7e(t){return!!(t&&t.__CANCEL__)}o(y7e,"isCancel");function Dm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Dm,"CanceledError");fe.inherits(Dm,nt,{__CANCEL__:true});function Z6(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(Z6,"settle");function FDt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(FDt,"isAbsoluteURL");function BDt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(BDt,"combineURLs");function pK(t,e){if(t&&!FDt(e)){return BDt(t,e)}return e}o(pK,"buildFullPath");var ix="1.6.2";function v7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(v7e,"parseProtocol");var MDt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function VDt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=v7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=MDt.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(VDt,"fromDataURI");function HDt(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(HDt,"throttle");function _7e(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(_7e,"speedometer");var ex=Symbol("internals");var eK=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[ex]={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=_7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=HDt(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[ex];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[ex];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[ex].length=+e;return this}};var MTe=eK;var{asyncIterator:VTe}=Symbol;var zDt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[VTe]){yield*t[VTe]()}else{yield t}},"readBlob");var E7e=zDt;var GDt=fe.ALPHABET.ALPHA_DIGIT+"-_";var t3=new ZTe.TextEncoder;var ff="\r\n";var KDt=t3.encode(ff);var YDt=2;var tK=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=t3.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=t3.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+YDt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*E7e(e)}yield KDt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var WDt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,GDt)}=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=t3.encode("--"+s+ff);const u=t3.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new tK(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 e7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var JDt=WDt;var rK=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 QDt=rK;var XDt=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 ZDt=XDt;var HTe={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var ekt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var zTe=fe.isFunction(hf["default"].createBrotliDecompress);var{http:tkt,https:rkt}=FPt["default"];var nkt=/https:?/;var GTe=Bo.protocols.map(t=>{return t+":"});function ikt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(ikt,"dispatchBeforeRedirect");function b7e(t,e,r){let n=e;if(!n&&n!==false){const i=NPt.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){b7e(s,e,s.href)},"beforeRedirect")}o(b7e,"setProxy");var skt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var akt=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 okt=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 KTe=o((t,e)=>okt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var ukt=skt&&o(function t(e){return akt(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=ZDt(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=>KTe(Le)):[KTe($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new BPt["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 Dm(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=pK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||GTe[0];if(b==="data:"){let ue;if(p!=="GET"){return Z6(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=VDt(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 Z6(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(GTe.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/"+ix,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=JDt(a,Ae=>{S.set(Ae)},{tag:`axios-${ix}-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 UPt["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(E7e(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 MTe({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=uK(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:ikt,beforeRedirects:{}};!fe.isUndefined(u)&&(ae.lookup=u);if(e.socketPath){ae.socketPath=e.socketPath}else{ae.hostname=E.hostname;ae.port=E.port;b7e(ae,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+ae.path)}let Te;const le=nkt.test(ae.protocol);ae.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?jPt["default"]:qPt["default"]}else{if(e.maxRedirects){ae.maxRedirects=e.maxRedirects}if(e.beforeRedirect){ae.beforeRedirects.config=e.beforeRedirect}Te=le?rkt:tkt}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 MTe({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(HTe));delete Ae.headers["content-encoding"];break;case"deflate":we.push(new QDt);we.push(hf["default"].createUnzip(HTe));delete Ae.headers["content-encoding"];break;case"br":if(zTe){we.push(hf["default"].createBrotliDecompress(ekt));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;Z6(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))}Z6(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||lK;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 Dm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var lkt=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 ckt=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 YTe(t,e){let r=0;const n=_7e(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(YTe,"progressEventReducer");var dkt=typeof XMLHttpRequest!=="undefined";var pkt=dkt&&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=pK(t.baseURL,t.url);p.open(t.method.toUpperCase(),uK(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};Z6(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||lK;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&&ckt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&lkt.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",YTe(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",YTe(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Dm(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=v7e(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 nK={http:ukt,xhr:pkt};fe.forEach(nK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var WTe=o(t=>`- ${t}`,"renderReason");var fkt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var w7e={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(!fkt(r)){n=nK[(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(WTe).join("\n"):" "+WTe(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:nK};function JG(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Dm(null,t)}}o(JG,"throwIfCancellationRequested");function JTe(t){JG(t);t.headers=Vo.from(t.headers);t.data=WG.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=w7e.getAdapter(t.adapter||dK.adapter);return e(t).then(o(function r(n){JG(t);n.data=WG.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!y7e(n)){JG(t);if(n&&n.response){n.response.data=WG.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(JTe,"dispatchRequest");var QTe=o(t=>t instanceof Vo?t.toJSON():t,"headersToObject");function qy(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(QTe(c),QTe(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(qy,"mergeConfig");var fK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{fK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var XTe={};fK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+ix+"] 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&&!XTe[a]){XTe[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 hkt(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(hkt,"assertOptions");var iK={assertOptions:hkt,validators:fK};var df=iK.validators;var jy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new FTe,response:new FTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=qy(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){iK.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{iK.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=[JTe.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=JTe.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=qy(this.defaults,e);const r=pK(e.baseURL,e.url);return uK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){jy.prototype[e]=function(r,n){return this.request(qy(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(qy(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");jy.prototype[e]=r();jy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var nx=jy;var sK=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 Dm(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 mkt=sK;function gkt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(gkt,"spread");function ykt(t){return fe.isObject(t)&&t.isAxiosError===true}o(ykt,"isAxiosError");var aK={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(aK).forEach(([t,e])=>{aK[e]=t});var vkt=aK;function S7e(t){const e=new nx(t);const r=r7e(nx.prototype.request,e);fe.extend(r,nx.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return S7e(qy(t,i))},"create");return r}o(S7e,"createInstance");var fi=S7e(dK);fi.Axios=nx;fi.CanceledError=Dm;fi.CancelToken=mkt;fi.isCancel=y7e;fi.VERSION=ix;fi.toFormData=ux;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=gkt;fi.isAxiosError=ykt;fi.mergeConfig=qy;fi.AxiosHeaders=Vo;fi.formToJSON=t=>g7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=w7e.getAdapter;fi.HttpStatusCode=vkt;fi.default=fi;T7e.exports=fi});var dx=_(cx=>{"use strict";Object.defineProperty(cx,"__esModule",{value:true});cx.CredentialsMethod=void 0;var A7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(A7e||(cx.CredentialsMethod=A7e={}))});var $m=_(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 Fy=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=Fy;function fx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(fx,"getRequestMetadataFromPath");var x7e="fga-request-id";function EK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(EK,"getResponseHeaders");var km=class extends Fy{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}=fx((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=EK(e);this.requestId=g[x7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=km;var hK=class extends km{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}=fx((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=hK;var mK=class extends km{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=mK;var gK=class extends km{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}=fx((s=e.request)===null||s===void 0?void 0:s.path);const u=EK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=gK;var yK=class extends km{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=fx((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=yK;var vK=class extends Fy{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=EK(e);this.requestId=f[x7e];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=vK;var px=class extends Fy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=px;var _K=class extends px{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=_K});var n3=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var _kt=$m();var Ekt=o(function(t,e,r){if(r===null||r===void 0){throw new _kt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=Ekt;var bkt=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=bkt;var wkt=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=wkt});var wK=_(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:true});By.Configuration=By.GetDefaultRetryParams=void 0;var i3=dx();var bK=$m();var hx=n3();var Skt=15;var Tkt=100;var Akt="openfga-sdk js/0.3.0";function xkt(t=Skt,e=Tkt){return{maxRetry:t,minWaitInMs:e}}o(xkt,"GetDefaultRetryParams");By.GetDefaultRetryParams=xkt;var mx=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 i3.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case i3.CredentialsMethod.ClientCredentials:this.credentials={method:i3.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case i3.CredentialsMethod.None:default:this.credentials={method:i3.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"]=Akt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,hx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,hx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,hx.isWellFormedUriString)(this.getBasePath())){throw new bK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,hx.isWellFormedUlidString)(this.storeId)){throw new bK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new bK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};By.Configuration=mx;mx.sdkVersion="0.3.0"});var C7e=_(gx=>{"use strict";Object.defineProperty(gx,"__esModule",{value:true});gx.assertNever=void 0;function Ckt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Ckt,"assertNever");gx.assertNever=Ckt});var R7e=_(yx=>{"use strict";Object.defineProperty(yx,"__esModule",{value:true});yx.chunkArray=void 0;function Rkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Rkt,"chunkArray");yx.chunkArray=Rkt});var N7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var vx=require("crypto");function O7e(){if(typeof vx.randomUUID==="function"){return(0,vx.randomUUID)()}if(typeof vx.randomBytes==="function"){return(0,vx.randomBytes)(20).toString("hex")}return}o(O7e,"generateRandomId");My.generateRandomId=O7e;function Okt(){return O7e()||"00000000-0000-0000-0000-000000000000"}o(Okt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Okt});var I7e=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:true});_x.setHeaderIfNotSet=void 0;function Nkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Nkt,"setHeaderIfNotSet");_x.setHeaderIfNotSet=Nkt});var P7e=_(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:true});Ex.setNotEnumerableProperty=void 0;function Ikt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(Ikt,"setNotEnumerableProperty");Ex.setNotEnumerableProperty=Ikt});var SK=_(Pu=>{"use strict";var Pkt=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 s3=Pu&&Pu.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Pkt(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:true});s3(C7e(),Pu);s3(R7e(),Pu);s3(N7e(),Pu);s3(I7e(),Pu);s3(P7e(),Pu)});var AK=_(yi=>{"use strict";var TK=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 Dkt=bx();var Lm=$m();var kkt=SK();yi.DUMMY_BASE_URL="https://example.com";var $kt=o(function(t,e){return TK(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=$kt;var Lkt=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=Lkt;var qkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var jkt=o(function(t,e){const r=typeof t!=="string";const n=r?qkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=jkt;var Ukt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Ukt;function Fkt(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(Fkt,"isAxiosError");function Bkt(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(Bkt,"randomTime");function D7e(t,e,r){var n;return TK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!Fkt(s)){throw new Lm.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 Lm.FgaApiValidationError(s)}else if(a===401||a===403){throw new Lm.FgaApiAuthenticationError(s)}else if(a===404){throw new Lm.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new Lm.FgaApiRateLimitExceededError(s)}else{throw new Lm.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,Bkt(i,e.minWaitInMs)))}else{throw new Lm.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(D7e,"attemptHttpRequest");yi.attemptHttpRequest=D7e;var Mkt=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=Dkt.Credentials.init(r)}return(c=e)=>TK(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 D7e(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,kkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=Mkt});var $7e=_(Vy=>{"use strict";var xK=Vy&&Vy.__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(Vy,"__esModule",{value:true});Vy.Credentials=void 0;var k7e=lx();var gf=n3();var CK=$m();var Vkt=AK();var Ho=dx();var RK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=k7e.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 CK.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 xK(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 xK(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 xK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,Vkt.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},k7e.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 CK.FgaApiError){n.constructor=CK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};Vy.Credentials=RK});var bx=_(yf=>{"use strict";var Hkt=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 L7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Hkt(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});L7e($7e(),yf);L7e(dx(),yf)});var NK=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.BaseAPI=void 0;var zkt=lx();var Gkt=require("http");var Kkt=require("https");var q7e=wK();var Ykt=bx();var Wkt=1e4;var OK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof q7e.Configuration){this.configuration=e}else{this.configuration=new q7e.Configuration(e)}this.configuration.isValid();this.credentials=Ykt.Credentials.init(this.configuration);if(!this.axios){const i=new Gkt.Agent({keepAlive:true});const s=new Kkt.Agent({keepAlive:true});this.axios=zkt.default.create({httpAgent:i,httpsAgent:s,timeout:Wkt,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}};wx.BaseAPI=OK});var PK=_(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=lx();var Jkt=NK();var We=AK();var Vn=n3();var Qkt=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=Qkt;var Xkt=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=Xkt;var Zkt=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=Zkt;var IK=class extends Jkt.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=IK});var U7e=_((mmr,j7e)=>{async function*e$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(e$t,"asyncPool");j7e.exports=e$t});var F7e=_(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 DK=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 kK=U7e();var t$t=PK();var r$t=NK();var $K=$m();var Sa=SK();var n$t=n3();var LK=10;var Hy="X-OpenFGA-Client-Method";var qK="X-OpenFGA-Client-Bulk-Request-Id";var zy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(zy||(Hl.ClientWriteStatus=zy={}));var jK=class extends r$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new t$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,n$t.isWellFormedUlidString)(r)){throw new $K.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 $K.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,Sa.setHeaderIfNotSet)(n,Hy,"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=LK}=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:zy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:zy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Sa.setHeaderIfNotSet)(i,Hy,"Write");(0,Sa.setHeaderIfNotSet)(i,qK,(0,Sa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=DK(kK(a,(0,Sa.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:zy.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=DK(kK(a,(0,Sa.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:zy.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,Sa.setHeaderIfNotSet)(n,Hy,"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,Sa.setHeaderIfNotSet)(n,Hy,"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=LK}=r;(0,Sa.setHeaderIfNotSet)(u,Hy,"BatchCheck");(0,Sa.setHeaderIfNotSet)(u,qK,(0,Sa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=DK(kK(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=LK}=r;(0,Sa.setHeaderIfNotSet)(l,Hy,"ListRelations");(0,Sa.setHeaderIfNotSet)(l,qK,(0,Sa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new $K.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=jK});var K7e=_(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:true});Ta.TypeName=Ta.TupleOperation=Ta.NullValue=Ta.NotFoundErrorCode=Ta.InternalErrorCode=Ta.ErrorCode=void 0;var B7e;(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"})(B7e||(Ta.ErrorCode=B7e={}));var M7e;(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"})(M7e||(Ta.InternalErrorCode=M7e={}));var V7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(V7e||(Ta.NotFoundErrorCode=V7e={}));var H7e;(function(t){t["NullValue"]="NULL_VALUE"})(H7e||(Ta.NullValue=H7e={}));var z7e;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(z7e||(Ta.TupleOperation=z7e={}));var G7e;(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"})(G7e||(Ta.TypeName=G7e={}))});var J7e=_($i=>{"use strict";var i$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 Sx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))i$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Sx(PK(),$i);Sx(F7e(),$i);Sx(K7e(),$i);var Y7e=wK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return Y7e.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return Y7e.GetDefaultRetryParams}});var W7e=bx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return W7e.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return W7e.CredentialsMethod}});Sx($m(),$i)});var X7e=_(Gy=>{"use strict";var s$t=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.OpenFGAService=void 0;var a3=s$t(Ha());var Q7e=J7e();var a$t=Oy();var UK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!a3.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=a3.default.OPENFGA_SERVICE_URL;this.apiHost=a3.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=a3.default.OPENFGA_STORE_ID;this.modelId=a3.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,a$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new Q7e.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:Q7e.CredentialsMethod.ApiToken,config:{token:e}}})}return this.openFGAClient}async createAccountMember(e){const r=await this.getOpenFgaClient();await r.write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${e}`}]})}};Gy.OpenFGAService=UK});var tAe=_(Ky=>{"use strict";var eAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.TenantService=void 0;var o$t=eAe(Vu());var Z7e=eAe(Ha());var u$t=XA();var l$t=new o$t.default({max:500,maxAge:1e3*60*50});var FK=class extends u$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!Z7e.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(Z7e.default.TENANT_API_URL,l$t,{userSub:n,logger:e.log,requestId:e.id})}};Ky.TenantService=FK});var rAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function c$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(c$t,"sizeInBytes");zl.sizeInBytes=c$t;function d$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(d$t,"snakeCase");zl.snakeCase=d$t;function p$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(p$t,"kebabCase");zl.kebabCase=p$t;function f$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(f$t,"validateHostname");zl.validateHostname=f$t});var sAe=_(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 BK;(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})(BK||(G.TypeRegistry=BK={}));var Du=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Du;var nAe;(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})(nAe||(G.FormatRegistry=nAe={}));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 MK=class extends Du{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=MK;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)&&BK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var iAe;(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})(iAe||(G.ExtendsUndefined=iAe={}));var Tx=class extends Du{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Tx;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var qm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new Tx(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})(qm||(G.TypeExtends=qm={}));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 VK;(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})(VK||(G.IndexedAccessor=VK={}));var Yy;(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=Jy.ParseExact(d.pattern);const h=Qy.Check(f);if(!h)return{...d,pattern:a(d.pattern,p)};const m=[...Xy.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})(Yy||(G.Intrinsic=Yy={}));var Wy;(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})(Wy||(G.ObjectMap=Wy={}));var Ax;(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})(Ax||(G.KeyResolver=Ax={}));var xx=class extends Du{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=xx;var o3;(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=Jy.ParseExact(r.pattern);if(!Qy.Check(n))throw new xx("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(o3||(G.KeyArrayResolver=o3={}));var HK;(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})(HK||(G.UnionResolver=HK={}));var Cx=class extends Du{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Cx;var Rx;(function(t){function e(s){throw new Cx(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})(Rx||(G.TemplateLiteralPattern=Rx={}));var rd;(function(t){function e(r){const n=Jy.ParseExact(r.pattern);if(!Qy.Check(n))return G.Type.String();const i=[...Xy.Generate(n)].map(s=>G.Type.Literal(s));return G.Type.Union(i)}o(e,"Resolve");t.Resolve=e})(rd||(G.TemplateLiteralResolver=rd={}));var u3=class extends Du{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=u3;var Jy;(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 u3(`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 u3(`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})(Jy||(G.TemplateLiteralParser=Jy={}));var Ox=class extends Du{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Ox;var Qy;(function(t){function e(a){throw new Ox(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})(Qy||(G.TemplateLiteralFinite=Qy={}));var Nx=class extends Du{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Nx;var Xy;(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 Nx("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var zK;(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})(zK||(G.TemplateLiteralDslParser=zK={}));var Ix=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new Px(this.schema,e)}};G.TransformDecodeBuilder=Ix;var Px=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=Px;var h$t=0;var Dx=class extends Du{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=Dx;var kx=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new Dx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=kx;var l3=class extends kx{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{...Yy.Map(ct.Type(e),"Capitalize"),...r}}Composite(e,r){const n=G.Type.Intersect(e,{});const i=Ax.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(qm.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=>qm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.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=>qm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.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=o3.Resolve(r);const s=ct.Type(e);return VK.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=Ax.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{...Yy.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=o3.Resolve(r);return Wy.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 Wy.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=o3.Resolve(r);return Wy.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=Jy.ParseExact(e.pattern);return Qy.Check(i)?this.Object([...Xy.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=HK.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${h$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 Wy.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)?Rx.Create(zK.Parse(e)):Rx.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Ix(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{...Yy.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{...Yy.Map(ct.Type(e),"Uppercase"),...r}}};G.JsonTypeBuilder=l3;var $x=class extends l3{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=$x;G.JsonType=new l3;G.Type=new $x});var aAe=_(Lx=>{"use strict";Object.defineProperty(Lx,"__esModule",{value:true});Lx.CustomTypeBuilder=void 0;var c3=sAe();var GK=class extends c3.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return c3.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return c3.Type.Union([e,c3.Type.Null()])}static StringEnum(e){return c3.Type.Unsafe({type:"string",enum:e})}};Lx.CustomTypeBuilder=GK});var cAe=_(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 qx(t){return typeof t==="string"}o(qx,"isString");lt.isString=qx;function m$t(t){return Array.isArray(t)&&t.every(e=>qx(e))}o(m$t,"isStringArray");lt.isStringArray=m$t;function oAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(oAe,"isObject");lt.isObject=oAe;function g$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(g$t,"isTypedArray");lt.isTypedArray=g$t;function uAe(t){return typeof t==="number"&&!isNaN(t)}o(uAe,"isNumber");lt.isNumber=uAe;function y$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(y$t,"isIterable");lt.isIterable=y$t;function v$t(t){return t===true||t===false}o(v$t,"isBoolean");lt.isBoolean=v$t;function KK(t){return typeof t==="undefined"}o(KK,"isUndefined");lt.isUndefined=KK;function _$t(t){return!Zy(t)}o(_$t,"isDefined");lt.isDefined=_$t;function Zy(t){return KK(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function E$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(E$t,"assertType");lt.assertType=E$t;function b$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(b$t,"assertIsDefined");lt.assertIsDefined=b$t;function w$t(...t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(Zy(n)){throw new Error(`Assertion Failed: argument at index ${r} is undefined or null`)}e.push(n)}return e}o(w$t,"assertAllDefined");lt.assertAllDefined=w$t;var S$t=Object.prototype.hasOwnProperty;function T$t(t){if(!oAe(t)){return false}for(const e in t){if(S$t.call(t,e)){return false}}return true}o(T$t,"isEmptyObject");lt.isEmptyObject=T$t;function YK(t){return typeof t==="function"}o(YK,"isFunction");lt.isFunction=YK;function A$t(...t){return t.length>0&&t.every(YK)}o(A$t,"areFunctions");lt.areFunctions=A$t;function x$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){lAe(t[n],e[n])}}o(x$t,"validateConstraints");lt.validateConstraints=x$t;function lAe(t,e){if(qx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(YK(e)){try{if(t instanceof e){return}}catch{}if(!Zy(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(lAe,"validateConstraint");lt.validateConstraint=lAe;function C$t(t){return t===null?void 0:t}o(C$t,"withNullAsUndefined");lt.withNullAsUndefined=C$t;function R$t(t){return typeof t==="undefined"?null:t}o(R$t,"withUndefinedAsNull");lt.withUndefinedAsNull=R$t;var d3=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=d3;var p3=class extends d3{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=p3;var f3=class extends d3{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=f3;function O$t(t,e){if(KK(t)){throw new p3(e)}return true}o(O$t,"throwIfUndefined");lt.throwIfUndefined=O$t;function WK(t,e){if(Zy(t)){throw new p3(e)}}o(WK,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=WK;function N$t(t,e){WK(t,e);if(!qx(t)){throw new f3(e,"string")}return true}o(N$t,"throwIfNotString");lt.throwIfNotString=N$t;function I$t(t,e){WK(t,e);if(!uAe(t)){throw new f3(e,"number")}return true}o(I$t,"throwIfNotNumber");lt.throwIfNotNumber=I$t});var g3=_(xe=>{"use strict";var dAe=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 P$t=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var jx=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))dAe(e,t,r)}P$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))dAe(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.WARNING_STATUS=xe.WARNING_SEVERITY=xe.GOOD_STATUS=xe.FAILURE_STATUS=xe.ERROR_SEVERITY=xe.hasBlockedNotifications=xe.getDefaultFlags=xe.getBuildFlagsForDeployment=xe.CommonAuth=void 0;var JK=jx(Ha());xe.env=JK.default;Object.defineProperty(xe,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return JK.EnvironmentalVariableRequiredError}});Object.defineProperty(xe,"getRequiredEnvVar",{enumerable:true,get:function(){return JK.getRequiredEnvVar}});vf(As(),xe);var D$t=Zx();Object.defineProperty(xe,"CommonAuth",{enumerable:true,get:function(){return D$t.CommonAuth}});var QK=CY();Object.defineProperty(xe,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return QK.getBuildFlagsForDeployment}});Object.defineProperty(xe,"getDefaultFlags",{enumerable:true,get:function(){return QK.getDefaultFlags}});Object.defineProperty(xe,"hasBlockedNotifications",{enumerable:true,get:function(){return QK.hasBlockedNotifications}});var h3=RY();Object.defineProperty(xe,"ERROR_SEVERITY",{enumerable:true,get:function(){return h3.ERROR_SEVERITY}});Object.defineProperty(xe,"FAILURE_STATUS",{enumerable:true,get:function(){return h3.FAILURE_STATUS}});Object.defineProperty(xe,"GOOD_STATUS",{enumerable:true,get:function(){return h3.GOOD_STATUS}});Object.defineProperty(xe,"WARNING_SEVERITY",{enumerable:true,get:function(){return h3.WARNING_SEVERITY}});Object.defineProperty(xe,"WARNING_STATUS",{enumerable:true,get:function(){return h3.WARNING_STATUS}});var pAe=IY();Object.defineProperty(xe,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return pAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(xe,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return pAe.VALID_COMPATIBILITY_DATES}});var k$t=eC();Object.defineProperty(xe,"FeatureFlags",{enumerable:true,get:function(){return k$t.FeatureFlags}});var $$t=PY();Object.defineProperty(xe,"signString",{enumerable:true,get:function(){return $$t.signString}});vf(DY(),xe);var L$t=rC();Object.defineProperty(xe,"DeploymentLogState",{enumerable:true,get:function(){return L$t.DeploymentLogState}});vf(BY(),xe);vf(nC(),xe);var q$t=iC();Object.defineProperty(xe,"errorHandler",{enumerable:true,get:function(){return q$t.errorHandler}});var m3=lC();Object.defineProperty(xe,"apiKeyAuthPlugin",{enumerable:true,get:function(){return m3.apiKeyAuthPlugin}});Object.defineProperty(xe,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return m3.ensureServiceAccountPlugin}});Object.defineProperty(xe,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return m3.ensureZuploAdminPlugin}});Object.defineProperty(xe,"ensureZuploUserPlugin",{enumerable:true,get:function(){return m3.ensureZuploUserPlugin}});Object.defineProperty(xe,"featureFlagsPlugin",{enumerable:true,get:function(){return m3.featureFlagsPlugin}});var j$t=X1e();Object.defineProperty(xe,"ApiServer",{enumerable:true,get:function(){return j$t.ApiServer}});xe.fly=jx(tge());xe.CloudStorage=jx(V6e());var U$t=H6e();Object.defineProperty(xe,"graphQL",{enumerable:true,get:function(){return U$t.graphQL}});vf(h5e(),xe);var fAe=yj();Object.defineProperty(xe,"createNewLogger",{enumerable:true,get:function(){return fAe.createNewLogger}});Object.defineProperty(xe,"logger",{enumerable:true,get:function(){return fAe.logger}});var F$t=oH();Object.defineProperty(xe,"startsWithReservedKeyword",{enumerable:true,get:function(){return F$t.startsWithReservedKeyword}});var B$t=m5e();Object.defineProperty(xe,"RouteVersions",{enumerable:true,get:function(){return B$t.RouteVersions}});var hAe=USe();Object.defineProperty(xe,"ApiKeyService",{enumerable:true,get:function(){return hAe.ApiKeyService}});Object.defineProperty(xe,"createApiKeyServiceClient",{enumerable:true,get:function(){return hAe.createApiKeyServiceClient}});var M$t=Oy();Object.defineProperty(xe,"getServiceAccountIdToken",{enumerable:true,get:function(){return M$t.getServiceAccountIdToken}});var V$t=BSe();Object.defineProperty(xe,"AuthApiService",{enumerable:true,get:function(){return V$t.AuthApiService}});var XK=zSe();Object.defineProperty(xe,"ContentApiService",{enumerable:true,get:function(){return XK.ContentApiService}});Object.defineProperty(xe,"contentApiTarballFileName",{enumerable:true,get:function(){return XK.contentApiTarballFileName}});Object.defineProperty(xe,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return XK.getContentApiStorageTarballPath}});var H$t=YSe();Object.defineProperty(xe,"DevApiService",{enumerable:true,get:function(){return H$t.DevApiService}});var z$t=X7e();Object.defineProperty(xe,"OpenFGAService",{enumerable:true,get:function(){return z$t.OpenFGAService}});var G$t=tAe();Object.defineProperty(xe,"TenantService",{enumerable:true,get:function(){return G$t.TenantService}});vf(rAe(),xe);vf(aAe(),xe);vf(cAe(),xe);var K$t=R7();Object.defineProperty(xe,"JsonValidator",{enumerable:true,get:function(){return K$t.JsonValidator}});var Y$t=fH();Object.defineProperty(xe,"RouteValidator",{enumerable:true,get:function(){return Y$t.RouteValidator}});xe.xfs=jx(dM())});var y3=_(e2=>{"use strict";Object.defineProperty(e2,"__esModule",{value:true});e2.runPlugins=e2.PluginResult=void 0;var ZK=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};e2.PluginResult=ZK;async function W$t(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(W$t,"runPlugins");e2.runPlugins=W$t});var gAe=_((Lmr,mAe)=>{"use strict";function J$t(t){return t>=55296&&t<=56319}o(J$t,"isHighSurrogate");function Q$t(t){return t>=56320&&t<=57343}o(Q$t,"isLowSurrogate");mAe.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(J$t(a)&&Q$t(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 vAe=_((jmr,yAe)=>{"use strict";var X$t=gAe();var Z$t=Buffer.byteLength.bind(Buffer);yAe.exports=X$t.bind(null,Z$t)});var _Ae=_(t2=>{"use strict";var eLt=t2&&t2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(t2,"__esModule",{value:true});t2.sanitize=void 0;var tLt=eLt(vAe());var rLt=/[/?<>\\:*|"]/g;var nLt=/[\x00-\x1f\x80-\x9f]/g;var iLt=/^\.+$/;var sLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var aLt=/[. ]+$/;function oLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(rLt,e).replace(nLt,e).replace(iLt,e).replace(sLt,e).replace(aLt,e);return(0,tLt.default)(r,255)}o(oLt,"sanitize");t2.sanitize=oLt});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 SAe=_(r2=>{"use strict";var wAe=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.createProjectDirs=void 0;var EAe=wAe(require("fs/promises"));var uLt=wAe(require("path"));var v3=Gl();var bAe=y3();var lLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[v3.USER_MODULES_DIR_NAME,v3.USER_CONFIG_DIR_NAME,v3.USER_TEST_DIR_NAME,v3.USER_SCHEMAS_DIR_NAME,v3.USER_DOCS_DIR_NAME,".vscode"];try{await EAe.default.mkdir(t);for(const n of r){await EAe.default.mkdir(uLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new bAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new bAe.PluginResult},"createProjectDirs");r2.createProjectDirs=lLt});var TAe=_(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:true});var Ux=require("perf_hooks");var eY=[];async function cLt(t,e){const r=Ux.performance.timerify(e);const n=new Ux.PerformanceObserver(i=>{const s=i.getEntries()[0];eY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(cLt,"timeFn");var dLt={mark:t=>{Ux.performance.mark(t)},measure:(t,e,r)=>{Ux.performance.measure(t,e,r)},timeFn:cLt,report:()=>{if(eY.length>0){console.table(eY)}}};tY.default=dLt});var RAe=_(n2=>{"use strict";var CAe=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.generateFromTemplate=void 0;var pLt=require("fs");var AAe=CAe(require("fs/promises"));var xAe=CAe(require("path"));async function fLt(t){const e=xAe.default.resolve(__dirname,"..","templates",t);if((0,pLt.existsSync)(e)){const r=await AAe.default.readFile(e,"utf-8");return r}else{const r=xAe.default.resolve(__dirname,"templates",t);const n=await AAe.default.readFile(r,"utf-8");return n}}o(fLt,"generateFromTemplate");n2.generateFromTemplate=fLt});var Aa=_(i2=>{"use strict";var rY=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFileFromTemplate=void 0;var hLt=g3();var mLt=rY(require("fs/promises"));var gLt=rY(require("path"));var yLt=rY(TAe());var vLt=RAe();var _Lt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return yLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=gLt.default.join(r,t);if(await hLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return ELt(i,e,n)})}},"generateFileFromTemplate");i2.generateFileFromTemplate=_Lt;async function ELt(t,e,r){const n=await(0,vLt.generateFromTemplate)(e);try{await mLt.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(ELt,"writeTemplate")});var NAe=_(s2=>{"use strict";var bLt=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateDefaultDocsMarkdown=void 0;var wLt=bLt(require("path"));var OAe=Gl();var SLt=Aa();s2.generateDefaultDocsMarkdown=(0,SLt.generateFileFromTemplate)(wLt.default.join(OAe.USER_DOCS_DIR_NAME,OAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var PAe=_(a2=>{"use strict";var TLt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsSidebar=void 0;var ALt=TLt(require("path"));var IAe=Gl();var xLt=Aa();a2.generateDefaultDocsSidebar=(0,xLt.generateFileFromTemplate)(ALt.default.join(IAe.USER_DOCS_DIR_NAME,IAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var kAe=_(o2=>{"use strict";var CLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsTheme=void 0;var RLt=CLt(require("path"));var DAe=Gl();var OLt=Aa();o2.generateDefaultDocsTheme=(0,OLt.generateFileFromTemplate)(RLt.default.join(DAe.USER_DOCS_DIR_NAME,DAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var LAe=_(u2=>{"use strict";var NLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultModule=void 0;var ILt=NLt(require("path"));var $Ae=Gl();var PLt=Aa();u2.generateDefaultModule=(0,PLt.generateFileFromTemplate)(ILt.default.join($Ae.USER_MODULES_DIR_NAME,$Ae.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var jAe=_(l2=>{"use strict";var DLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDevPortalConfigJson=void 0;var kLt=DLt(require("path"));var qAe=Gl();var $Lt=Aa();l2.generateDevPortalConfigJson=(0,$Lt.generateFileFromTemplate)(kLt.default.join(qAe.USER_CONFIG_DIR_NAME,qAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var UAe=_(Fx=>{"use strict";Object.defineProperty(Fx,"__esModule",{value:true});Fx.generateEnvironment=void 0;var LLt=Aa();Fx.generateEnvironment=(0,LLt.generateFileFromTemplate)(".env","env.template")});var FAe=_(Bx=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:true});Bx.generateESLint=void 0;var qLt=Aa();Bx.generateESLint=(0,qLt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var BAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.generateGitignore=void 0;var jLt=Aa();Mx.generateGitignore=(0,jLt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var MAe=_(c2=>{"use strict";var ULt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateLaunchJson=void 0;var FLt=ULt(require("path"));var BLt=Aa();c2.generateLaunchJson=(0,BLt.generateFileFromTemplate)(FLt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var VAe=_(d2=>{"use strict";var MLt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateSettingsJson=void 0;var VLt=MLt(require("path"));var HLt=Aa();d2.generateSettingsJson=(0,HLt.generateFileFromTemplate)(VLt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var zAe=_(p2=>{"use strict";var zLt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateRouteOasConfig=void 0;var GLt=zLt(require("path"));var HAe=Gl();var KLt=Aa();p2.generateRouteOasConfig=(0,KLt.generateFileFromTemplate)(GLt.default.join(HAe.USER_CONFIG_DIR_NAME,HAe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var WAe=_(zo=>{"use strict";var GAe=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 YLt=g3();var KAe=GAe(require("fs/promises"));var nY=GAe(require("path"));async function WLt(t,e=YLt.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=YAe();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(WLt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=WLt;function YAe(){const t=nY.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(YAe,"getPackageOverrides");zo.getPackageOverrides=YAe;async function JLt(t){const e=nY.default.join(t,"package.json");const r=await KAe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(JLt,"getProjectPackageJson");zo.getProjectPackageJson=JLt;async function QLt(t,e){const r=nY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await KAe.default.writeFile(r,n,"utf-8")}o(QLt,"updateProjectPackageJson");zo.updateProjectPackageJson=QLt});var XAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generatePackageJson=void 0;var JAe=WAe();var QAe=y3();var XLt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,JAe.generateDefaultPackageJson)(e);try{await(0,JAe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new QAe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new QAe.PluginResult},"generatePackageJson");Vx.generatePackageJson=XLt});var exe=_(f2=>{"use strict";var ZLt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generatePoliciesConfig=void 0;var eqt=ZLt(require("path"));var ZAe=Gl();var tqt=Aa();f2.generatePoliciesConfig=(0,tqt.generateFileFromTemplate)(eqt.default.join(ZAe.USER_CONFIG_DIR_NAME,ZAe.POLICIES_CONFIG_FILE),"policies.template.json")});var txe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generateTSConfig=void 0;var rqt=Aa();Hx.generateTSConfig=(0,rqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var nxe=_(h2=>{"use strict";var nqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generateZuploJson=void 0;var iqt=g3();var sqt=require("fs/promises");var aqt=nqt(require("path"));var oqt=Gl();var rxe=y3();var uqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:iqt.DEFAULT_COMPATIBILITY_DATE};const i=aqt.default.join(e,oqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,sqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new rxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new rxe.PluginResult},"generateZuploJson");h2.generateZuploJson=uqt});var sxe=_(m2=>{"use strict";var lqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.create=void 0;var iY=g3();var cqt=require("fs/promises");var dqt=lqt(require("path"));var pqt=y3();var ixe=_Ae();var fqt=SAe();var hqt=NAe();var mqt=PAe();var gqt=kAe();var yqt=LAe();var vqt=jAe();var _qt=UAe();var Eqt=FAe();var bqt=BAe();var wqt=MAe();var Sqt=VAe();var Tqt=zAe();var Aqt=XAe();var xqt=exe();var Cqt=txe();var Rqt=nxe();async function Oqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,ixe.sanitize)(t);const s=(0,ixe.sanitize)(e);const a=dqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await iY.xfs.dirExists(a)){throw new iY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:iY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[fqt.createProjectDirs,Tqt.generateRouteOasConfig,Rqt.generateZuploJson,vqt.generateDevPortalConfigJson,yqt.generateDefaultModule,mqt.generateDefaultDocsSidebar,hqt.generateDefaultDocsMarkdown,gqt.generateDefaultDocsTheme,xqt.generatePoliciesConfig]);l.push(...[Cqt.generateTSConfig,bqt.generateGitignore,Aqt.generatePackageJson,_qt.generateEnvironment,Eqt.generateESLint,wqt.generateLaunchJson,Sqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,pqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,cqt.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(Oqt,"create");m2.create=Oqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Nqt=sxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Nqt.create}});
411
411
  /*! For license information please see create.index.minified.js.LEGAL.txt */