@zuplo/core 5.1965.0 → 5.1968.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.minified.js +1 -1
- package/package.json +1 -1
package/index.minified.js
CHANGED
|
@@ -617,7 +617,7 @@ https://cloud.google.com/docs/authentication/getting-started`},fJ=class{static{a
|
|
|
617
617
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[nxt]=this[nxt]={accessors:{}}).accessors,i=this.prototype;function s(o){let u=NF(o);n[u]||(Lxn(i,o),n[u]=!0)}return a(s,"defineAccessor"),Je.isArray(t)?t.forEach(s):s(t),this}};aP.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Je.reduceDescriptors(aP.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Je.freezeMethods(aP);var Ff=aP;function TRe(e,t){let r=this||jRe,n=t||r,i=Ff.from(n.headers),s=n.data;return Je.forEach(e,a(function(u){s=u.call(r,s,i.normalize(),t?t.status:void 0)},"transform")),i.normalize(),s}a(TRe,"transformData");function kxt(e){return!!(e&&e.__CANCEL__)}a(kxt,"isCancel");function QA(e,t,r){_r.call(this,e??"canceled",_r.ERR_CANCELED,t,r),this.name="CanceledError"}a(QA,"CanceledError");Je.inherits(QA,_r,{__CANCEL__:!0});function IF(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new _r("Request failed with status code "+r.status,[_r.ERR_BAD_REQUEST,_r.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}a(IF,"settle");function Fxn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}a(Fxn,"isAbsoluteURL");function Bxn(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}a(Bxn,"combineURLs");function GRe(e,t){return e&&!Fxn(t)?Bxn(e,t):t}a(GRe,"buildFullPath");var SJ="1.6.2";function Dxt(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}a(Dxt,"parseProtocol");var Mxn=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function qxn(e,t,r){let n=r&&r.Blob||Df.classes.Blob,i=Dxt(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let s=Mxn.exec(e);if(!s)throw new _r("Invalid URL",_r.ERR_INVALID_URL);let o=s[1],u=s[2],l=s[3],c=Buffer.from(decodeURIComponent(l),u?"base64":"utf8");if(t){if(!n)throw new _r("Blob is not supported",_r.ERR_NOT_SUPPORT);return new n([c],{type:o})}return c}throw new _r("Unsupported protocol "+i,_r.ERR_NOT_SUPPORT)}a(qxn,"fromDataURI");function Uxn(e,t){let r=0,n=1e3/t,i=null;return a(function(o,u){let l=Date.now();if(o||l-r>n)return i&&(clearTimeout(i),i=null),r=l,e.apply(null,u);i||(i=setTimeout(()=>(i=null,r=Date.now(),e.apply(null,u)),n-(l-r)))},"throttled")}a(Uxn,"throttle");function Lxt(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,s=0,o;return t=t!==void 0?t:1e3,a(function(l){let c=Date.now(),d=n[s];o||(o=c),r[i]=l,n[i]=c;let p=s,f=0;for(;p!==i;)f+=r[p++],p=p%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;let m=d&&c-d;return m?Math.round(f*1e3/m):void 0},"push")}a(Lxt,"speedometer");var _J=Symbol("internals"),NRe=class extends UE.default.Transform{static{a(this,"AxiosTransformStream")}constructor(t){t=Je.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(u,l)=>!Je.isUndefined(l[u])),super({readableHighWaterMark:t.chunkSize});let r=this,n=this[_J]={length:t.length,timeWindow:t.timeWindow,ticksRate:t.ticksRate,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},i=Lxt(n.ticksRate*t.samplesCount,n.timeWindow);this.on("newListener",u=>{u==="progress"&&(n.isCaptured||(n.isCaptured=!0))});let s=0;n.updateProgress=Uxn(a(function(){let l=n.length,c=n.bytesSeen,d=c-s;if(!d||r.destroyed)return;let p=i(d);s=c,process.nextTick(()=>{r.emit("progress",{loaded:c,total:l,progress:l?c/l:void 0,bytes:d,rate:p||void 0,estimated:p&&l&&c<=l?(l-c)/p:void 0})})},"throttledHandler"),n.ticksRate);let o=a(()=>{n.updateProgress(!0)},"onFinish");this.once("end",o),this.once("error",o)}_read(t){let r=this[_J];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this,s=this[_J],o=s.maxRate,u=this.readableHighWaterMark,l=s.timeWindow,c=1e3/l,d=o/c,p=s.minChunkSize!==!1?Math.max(s.minChunkSize,d*.01):0;function f(h,g){let _=Buffer.byteLength(h);s.bytesSeen+=_,s.bytes+=_,s.isCaptured&&s.updateProgress(),i.push(h)?process.nextTick(g):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(g)}}a(f,"pushChunk");let m=a((h,g)=>{let _=Buffer.byteLength(h),v=null,S=u,E,b=0;if(o){let A=Date.now();(!s.ts||(b=A-s.ts)>=l)&&(s.ts=A,E=d-s.bytes,s.bytes=E<0?-E:0,b=0),E=d-s.bytes}if(o){if(E<=0)return setTimeout(()=>{g(null,h)},l-b);E<S&&(S=E)}S&&_>S&&_-S>p&&(v=h.subarray(S),h=h.subarray(0,S)),f(h,v?()=>{process.nextTick(g,null,v)}:g)},"transformChunk");m(t,a(function h(g,_){if(g)return n(g);_?m(_,h):n(null)},"transformNextChunk"))}setLength(t){return this[_J].length=+t,this}},ixt=NRe,{asyncIterator:sxt}=Symbol,$xn=a(async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[sxt]?yield*e[sxt]():yield e},"readBlob"),Fxt=$xn,jxn=Je.ALPHABET.ALPHA_DIGIT+"-_",DF=new hxt.TextEncoder,$E=`\r
|
|
618
618
|
`,Gxn=DF.encode($E),Hxn=2,IRe=class{static{a(this,"FormDataPart")}constructor(t,r){let{escapeName:n}=this.constructor,i=Je.isString(r),s=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${$E}`;i?r=DF.encode(String(r).replace(/\r?\n|\r\n?/g,$E)):s+=`Content-Type: ${r.type||"application/octet-stream"}${$E}`,this.headers=DF.encode(s+$E),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+Hxn,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Je.isTypedArray(t)?yield t:yield*Fxt(t),yield Gxn}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},Vxn=a((e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+Je.generateString(i,jxn)}=r||{};if(!Je.isFormData(e))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");let o=DF.encode("--"+s+$E),u=DF.encode("--"+s+"--"+$E+$E),l=u.byteLength,c=Array.from(e.entries()).map(([p,f])=>{let m=new IRe(p,f);return l+=m.size,m});l+=o.byteLength*c.length,l=Je.toFiniteNumber(l);let d={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(l)&&(d["Content-Length"]=l),t&&t(d),gxt.Readable.from(async function*(){for(let p of c)yield o,yield*p.encode();yield u}())},"formDataToStream"),zxn=Vxn,kRe=class extends UE.default.Transform{static{a(this,"ZlibHeaderTransformStream")}__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},Kxn=kRe,Wxn=a((e,t)=>Je.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(s){n(s)}},n)}:e,"callbackify"),Yxn=Wxn,axt={flush:jE.default.constants.Z_SYNC_FLUSH,finishFlush:jE.default.constants.Z_SYNC_FLUSH},Xxn={flush:jE.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:jE.default.constants.BROTLI_OPERATION_FLUSH},oxt=Je.isFunction(jE.default.createBrotliDecompress),{http:Jxn,https:Qxn}=FTn.default,Zxn=/https:?/,uxt=Df.protocols.map(e=>e+":");function eRn(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}a(eRn,"dispatchBeforeRedirect");function Bxt(e,t,r){let n=t;if(!n&&n!==!1){let i=TTn.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let s=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+s}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=a(function(s){Bxt(s,t,s.href)},"beforeRedirect")}a(Bxt,"setProxy");var tRn=typeof process<"u"&&Je.kindOf(process)==="process",rRn=a(e=>new Promise((t,r)=>{let n,i,s=a((l,c)=>{i||(i=!0,n&&n(l,c))},"done"),o=a(l=>{s(l),t(l)},"_resolve"),u=a(l=>{s(l,!0),r(l)},"_reject");e(o,u,l=>n=l).catch(u)}),"wrapAsync"),nRn=a(({address:e,family:t})=>{if(!Je.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},"resolveFamily"),lxt=a((e,t)=>nRn(Je.isObject(e)?e:{address:e,family:t}),"buildAddressEntry"),iRn=tRn&&a(function(t){return rRn(a(async function(n,i,s){let{data:o,lookup:u,family:l}=t,{responseType:c,responseEncoding:d}=t,p=t.method.toUpperCase(),f,m=!1,h;if(u){let he=Yxn(u,Fe=>Je.isArray(Fe)?Fe:[Fe]);u=a((Fe,Oe,M)=>{he(Fe,Oe,(Z,fe,B)=>{let ye=Je.isArray(fe)?fe.map(De=>lxt(De)):[lxt(fe,B)];Oe.all?M(Z,ye):M(Z,ye[0].address,ye[0].family)})},"lookup")}let g=new BTn.default,_=a(()=>{t.cancelToken&&t.cancelToken.unsubscribe(v),t.signal&&t.signal.removeEventListener("abort",v),g.removeAllListeners()},"onFinished");s((he,Fe)=>{f=!0,Fe&&(m=!0,_())});function v(he){g.emit("abort",!he||he.type?new QA(null,t,h):he)}a(v,"abort"),g.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(v),t.signal&&(t.signal.aborted?v():t.signal.addEventListener("abort",v)));let S=GRe(t.baseURL,t.url),E=new URL(S,"http://localhost"),b=E.protocol||uxt[0];if(b==="data:"){let he;if(p!=="GET")return IF(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{he=qxn(t.url,c==="blob",{Blob:t.env&&t.env.Blob})}catch(Fe){throw _r.from(Fe,_r.ERR_BAD_REQUEST,t)}return c==="text"?(he=he.toString(d),(!d||d==="utf8")&&(he=Je.stripBOM(he))):c==="stream"&&(he=UE.default.Readable.from(he)),IF(n,i,{data:he,status:200,statusText:"OK",headers:new Ff,config:t})}if(uxt.indexOf(b)===-1)return i(new _r("Unsupported protocol "+b,_r.ERR_BAD_REQUEST,t));let A=Ff.from(t.headers).normalize();A.set("User-Agent","axios/"+SJ,!1);let C=t.onDownloadProgress,T=t.onUploadProgress,O=t.maxRate,P,R;if(Je.isSpecCompliantForm(o)){let he=A.getContentType(/boundary=([-_\w\d]{10,70})/i);o=zxn(o,Fe=>{A.set(Fe)},{tag:`axios-${SJ}-boundary`,boundary:he&&he[1]||void 0})}else if(Je.isFormData(o)&&Je.isFunction(o.getHeaders)){if(A.set(o.getHeaders()),!A.hasContentLength())try{let he=await LTn.default.promisify(o.getLength).call(o);Number.isFinite(he)&&he>=0&&A.setContentLength(he)}catch{}}else if(Je.isBlob(o))o.size&&A.setContentType(o.type||"application/octet-stream"),A.setContentLength(o.size||0),o=UE.default.Readable.from(Fxt(o));else if(o&&!Je.isStream(o)){if(!Buffer.isBuffer(o))if(Je.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Je.isString(o))o=Buffer.from(o,"utf-8");else return i(new _r("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",_r.ERR_BAD_REQUEST,t));if(A.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new _r("Request body larger than maxBodyLength limit",_r.ERR_BAD_REQUEST,t))}let I=Je.toFiniteNumber(A.getContentLength());Je.isArray(O)?(P=O[0],R=O[1]):P=R=O,o&&(T||P)&&(Je.isStream(o)||(o=UE.default.Readable.from(o,{objectMode:!1})),o=UE.default.pipeline([o,new ixt({length:I,maxRate:Je.toFiniteNumber(P)})],Je.noop),T&&o.on("progress",he=>{T(Object.assign(he,{upload:!0}))}));let D;if(t.auth){let he=t.auth.username||"",Fe=t.auth.password||"";D=he+":"+Fe}if(!D&&E.username){let he=E.username,Fe=E.password;D=he+":"+Fe}D&&A.delete("authorization");let U;try{U=qRe(E.pathname+E.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(he){let Fe=new Error(he.message);return Fe.config=t,Fe.url=t.url,Fe.exists=!0,i(Fe)}A.set("Accept-Encoding","gzip, compress, deflate"+(oxt?", br":""),!1);let te={path:U,method:p,headers:A.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:D,protocol:b,family:l,beforeRedirect:eRn,beforeRedirects:{}};!Je.isUndefined(u)&&(te.lookup=u),t.socketPath?te.socketPath=t.socketPath:(te.hostname=E.hostname,te.port=E.port,Bxt(te,t.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+te.path));let ve,me=Zxn.test(te.protocol);if(te.agent=me?t.httpsAgent:t.httpAgent,t.transport?ve=t.transport:t.maxRedirects===0?ve=me?DTn.default:kTn.default:(t.maxRedirects&&(te.maxRedirects=t.maxRedirects),t.beforeRedirect&&(te.beforeRedirects.config=t.beforeRedirect),ve=me?Qxn:Jxn),t.maxBodyLength>-1?te.maxBodyLength=t.maxBodyLength:te.maxBodyLength=1/0,t.insecureHTTPParser&&(te.insecureHTTPParser=t.insecureHTTPParser),h=ve.request(te,a(function(Fe){if(h.destroyed)return;let Oe=[Fe],M=+Fe.headers["content-length"];if(C){let De=new ixt({length:Je.toFiniteNumber(M),maxRate:Je.toFiniteNumber(R)});C&&De.on("progress",$e=>{C(Object.assign($e,{download:!0}))}),Oe.push(De)}let Z=Fe,fe=Fe.req||h;if(t.decompress!==!1&&Fe.headers["content-encoding"])switch((p==="HEAD"||Fe.statusCode===204)&&delete Fe.headers["content-encoding"],(Fe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Oe.push(jE.default.createUnzip(axt)),delete Fe.headers["content-encoding"];break;case"deflate":Oe.push(new Kxn),Oe.push(jE.default.createUnzip(axt)),delete Fe.headers["content-encoding"];break;case"br":oxt&&(Oe.push(jE.default.createBrotliDecompress(Xxn)),delete Fe.headers["content-encoding"])}Z=Oe.length>1?UE.default.pipeline(Oe,Je.noop):Oe[0];let B=UE.default.finished(Z,()=>{B(),_()}),ye={status:Fe.statusCode,statusText:Fe.statusMessage,headers:new Ff(Fe.headers),config:t,request:fe};if(c==="stream")ye.data=Z,IF(n,i,ye);else{let De=[],$e=0;Z.on("data",a(function(ot){De.push(ot),$e+=ot.length,t.maxContentLength>-1&&$e>t.maxContentLength&&(m=!0,Z.destroy(),i(new _r("maxContentLength size of "+t.maxContentLength+" exceeded",_r.ERR_BAD_RESPONSE,t,fe)))},"handleStreamData")),Z.on("aborted",a(function(){if(m)return;let ot=new _r("maxContentLength size of "+t.maxContentLength+" exceeded",_r.ERR_BAD_RESPONSE,t,fe);Z.destroy(ot),i(ot)},"handlerStreamAborted")),Z.on("error",a(function(ot){h.destroyed||i(_r.from(ot,null,t,fe))},"handleStreamError")),Z.on("end",a(function(){try{let ot=De.length===1?De[0]:Buffer.concat(De);c!=="arraybuffer"&&(ot=ot.toString(d),(!d||d==="utf8")&&(ot=Je.stripBOM(ot))),ye.data=ot}catch(ot){return i(_r.from(ot,null,t,ye.request,ye))}IF(n,i,ye)},"handleStreamEnd"))}g.once("abort",De=>{Z.destroyed||(Z.emit("error",De),Z.destroy())})},"handleResponse")),g.once("abort",he=>{i(he),h.destroy(he)}),h.on("error",a(function(Fe){i(_r.from(Fe,null,t,h))},"handleRequestError")),h.on("socket",a(function(Fe){Fe.setKeepAlive(!0,1e3*60)},"handleRequestSocket")),t.timeout){let he=parseInt(t.timeout,10);if(Number.isNaN(he)){i(new _r("error trying to parse `config.timeout` to int",_r.ERR_BAD_OPTION_VALUE,t,h));return}h.setTimeout(he,a(function(){if(f)return;let Oe=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",M=t.transitional||URe;t.timeoutErrorMessage&&(Oe=t.timeoutErrorMessage),i(new _r(Oe,M.clarifyTimeoutError?_r.ETIMEDOUT:_r.ECONNABORTED,t,h)),v()},"handleRequestTimeout"))}if(Je.isStream(o)){let he=!1,Fe=!1;o.on("end",()=>{he=!0}),o.once("error",Oe=>{Fe=!0,h.destroy(Oe)}),o.on("close",()=>{!he&&!Fe&&v(new QA("Request stream has been aborted",t,h))}),o.pipe(h)}else h.end(o)},"dispatchHttpRequest"))},"httpAdapter"),sRn=Df.hasStandardBrowserEnv?{write(e,t,r,n,i,s){let o=[e+"="+encodeURIComponent(t)];Je.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Je.isString(n)&&o.push("path="+n),Je.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}},aRn=Df.hasStandardBrowserEnv?a(function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){let o=s;return t&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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}}return a(i,"resolveURL"),n=i(window.location.href),a(function(o){let u=Je.isString(o)?i(o):o;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():a(function(){return a(function(){return!0},"isURLSameOrigin")},"nonStandardBrowserEnv")();function cxt(e,t){let r=0,n=Lxt(50,250);return i=>{let s=i.loaded,o=i.lengthComputable?i.total:void 0,u=s-r,l=n(u),c=s<=o;r=s;let d={loaded:s,total:o,progress:o?s/o:void 0,bytes:u,rate:l||void 0,estimated:l&&o&&c?(o-s)/l:void 0,event:i};d[t?"download":"upload"]=!0,e(d)}}a(cxt,"progressEventReducer");var oRn=typeof XMLHttpRequest<"u",uRn=oRn&&function(e){return new Promise(a(function(r,n){let i=e.data,s=Ff.from(e.headers).normalize(),{responseType:o,withXSRFToken:u}=e,l;function c(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}a(c,"done");let d;if(Je.isFormData(i)){if(Df.hasStandardBrowserEnv||Df.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((d=s.getContentType())!==!1){let[g,..._]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",..._].join("; "))}}let p=new XMLHttpRequest;if(e.auth){let g=e.auth.username||"",_=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+_))}let f=GRe(e.baseURL,e.url);p.open(e.method.toUpperCase(),qRe(f,e.params,e.paramsSerializer),!0),p.timeout=e.timeout;function m(){if(!p)return;let g=Ff.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),v={data:!o||o==="text"||o==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:g,config:e,request:p};IF(a(function(E){r(E),c()},"_resolve"),a(function(E){n(E),c()},"_reject"),v),p=null}if(a(m,"onloadend"),"onloadend"in p?p.onloadend=m:p.onreadystatechange=a(function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(m)},"handleLoad"),p.onabort=a(function(){p&&(n(new _r("Request aborted",_r.ECONNABORTED,e,p)),p=null)},"handleAbort"),p.onerror=a(function(){n(new _r("Network Error",_r.ERR_NETWORK,e,p)),p=null},"handleError"),p.ontimeout=a(function(){let _=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",v=e.transitional||URe;e.timeoutErrorMessage&&(_=e.timeoutErrorMessage),n(new _r(_,v.clarifyTimeoutError?_r.ETIMEDOUT:_r.ECONNABORTED,e,p)),p=null},"handleTimeout"),Df.hasStandardBrowserEnv&&(u&&Je.isFunction(u)&&(u=u(e)),u||u!==!1&&aRn(f))){let g=e.xsrfHeaderName&&e.xsrfCookieName&&sRn.read(e.xsrfCookieName);g&&s.set(e.xsrfHeaderName,g)}i===void 0&&s.setContentType(null),"setRequestHeader"in p&&Je.forEach(s.toJSON(),a(function(_,v){p.setRequestHeader(v,_)},"setRequestHeader")),Je.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),o&&o!=="json"&&(p.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&p.addEventListener("progress",cxt(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",cxt(e.onUploadProgress)),(e.cancelToken||e.signal)&&(l=a(g=>{p&&(n(!g||g.type?new QA(null,e,p):g),p.abort(),p=null)},"onCanceled"),e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l)));let h=Dxt(f);if(h&&Df.protocols.indexOf(h)===-1){n(new _r("Unsupported protocol "+h+":",_r.ERR_BAD_REQUEST,e));return}p.send(i||null)},"dispatchXhrRequest"))},DRe={http:iRn,xhr:uRn};Je.forEach(DRe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var dxt=a(e=>`- ${e}`,"renderReason"),lRn=a(e=>Je.isFunction(e)||e===null||e===!1,"isResolvedHandle"),Mxt={getAdapter:e=>{e=Je.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let s=0;s<t;s++){r=e[s];let o;if(n=r,!lRn(r)&&(n=DRe[(o=String(r)).toLowerCase()],n===void 0))throw new _r(`Unknown adapter '${o}'`);if(n)break;i[o||"#"+s]=n}if(!n){let s=Object.entries(i).map(([u,l])=>`adapter ${u} `+(l===!1?"is not supported by the environment":"is not available in the build")),o=t?s.length>1?`since :
|
|
619
619
|
`+s.map(dxt).join(`
|
|
620
|
-
`):" "+dxt(s[0]):"as no adapter specified";throw new _r("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:DRe};function xRe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new QA(null,e)}a(xRe,"throwIfCancellationRequested");function pxt(e){return xRe(e),e.headers=Ff.from(e.headers),e.data=TRe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Mxt.getAdapter(e.adapter||jRe.adapter)(e).then(a(function(n){return xRe(e),n.data=TRe.call(e,e.transformResponse,n),n.headers=Ff.from(n.headers),n},"onAdapterResolution"),a(function(n){return kxt(n)||(xRe(e),n&&n.response&&(n.response.data=TRe.call(e,e.transformResponse,n.response),n.response.headers=Ff.from(n.response.headers))),Promise.reject(n)},"onAdapterRejection"))}a(pxt,"dispatchRequest");var fxt=a(e=>e instanceof Ff?e.toJSON():e,"headersToObject");function oP(e,t){t=t||{};let r={};function n(c,d,p){return Je.isPlainObject(c)&&Je.isPlainObject(d)?Je.merge.call({caseless:p},c,d):Je.isPlainObject(d)?Je.merge({},d):Je.isArray(d)?d.slice():d}a(n,"getMergedValue");function i(c,d,p){if(Je.isUndefined(d)){if(!Je.isUndefined(c))return n(void 0,c,p)}else return n(c,d,p)}a(i,"mergeDeepProperties");function s(c,d){if(!Je.isUndefined(d))return n(void 0,d)}a(s,"valueFromConfig2");function o(c,d){if(Je.isUndefined(d)){if(!Je.isUndefined(c))return n(void 0,c)}else return n(void 0,d)}a(o,"defaultToConfig2");function u(c,d,p){if(p in t)return n(c,d);if(p in e)return n(void 0,c)}a(u,"mergeDirectKeys");let l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(c,d)=>i(fxt(c),fxt(d),!0)};return Je.forEach(Object.keys(Object.assign({},e,t)),a(function(d){let p=l[d]||i,f=p(e[d],t[d],d);Je.isUndefined(f)&&p!==u||(r[d]=f)},"computeConfigValue")),r}a(oP,"mergeConfig");var HRe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{HRe[e]=a(function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e},"validator")});var mxt={};HRe.transitional=a(function(t,r,n){function i(s,o){return"[Axios v"+SJ+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return a(i,"formatMessage"),(s,o,u)=>{if(t===!1)throw new _r(i(o," has been removed"+(r?" in "+r:"")),_r.ERR_DEPRECATED);return r&&!mxt[o]&&(mxt[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,o,u):!0}},"transitional");function cRn(e,t,r){if(typeof e!="object")throw new _r("options must be an object",_r.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let s=n[i],o=t[s];if(o){let u=e[s],l=u===void 0||o(u,s,e);if(l!==!0)throw new _r("option "+s+" must be "+l,_r.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new _r("Unknown option "+s,_r.ERR_BAD_OPTION)}}a(cRn,"assertOptions");var LRe={assertOptions:cRn,validators:HRe},qE=LRe.validators,uP=class{static{a(this,"Axios")}constructor(t){this.defaults=t,this.interceptors={request:new rxt,response:new rxt}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=oP(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&LRe.assertOptions(n,{silentJSONParsing:qE.transitional(qE.boolean),forcedJSONParsing:qE.transitional(qE.boolean),clarifyTimeoutError:qE.transitional(qE.boolean)},!1),i!=null&&(Je.isFunction(i)?r.paramsSerializer={serialize:i}:LRe.assertOptions(i,{encode:qE.function,serialize:qE.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Je.merge(s.common,s[r.method]);s&&Je.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),r.headers=Ff.concat(o,s);let u=[],l=!0;this.interceptors.request.forEach(a(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(l=l&&g.synchronous,u.unshift(g.fulfilled,g.rejected))},"unshiftRequestInterceptors"));let c=[];this.interceptors.response.forEach(a(function(g){c.push(g.fulfilled,g.rejected)},"pushResponseInterceptors"));let d,p=0,f;if(!l){let h=[pxt.bind(this),void 0];for(h.unshift.apply(h,u),h.push.apply(h,c),f=h.length,d=Promise.resolve(r);p<f;)d=d.then(h[p++],h[p++]);return d}f=u.length;let m=r;for(p=0;p<f;){let h=u[p++],g=u[p++];try{m=h(m)}catch(_){g.call(this,_);break}}try{d=pxt.call(this,m)}catch(h){return Promise.reject(h)}for(p=0,f=c.length;p<f;)d=d.then(c[p++],c[p++]);return d}getUri(t){t=oP(this.defaults,t);let r=GRe(t.baseURL,t.url);return qRe(r,t.params,t.paramsSerializer)}};Je.forEach(["delete","get","head","options"],a(function(t){uP.prototype[t]=function(r,n){return this.request(oP(n||{},{method:t,url:r,data:(n||{}).data}))}},"forEachMethodNoData"));Je.forEach(["post","put","patch"],a(function(t){function r(n){return a(function(s,o,u){return this.request(oP(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}a(r,"generateHTTPMethod"),uP.prototype[t]=r(),uP.prototype[t+"Form"]=r(!0)},"forEachMethodWithData"));var bJ=uP,FRe=class e{static{a(this,"CancelToken")}constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(a(function(s){r=s},"promiseExecutor"));let n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(u=>{n.subscribe(u),s=u}).then(i);return o.cancel=a(function(){n.unsubscribe(s)},"reject"),o},t(a(function(s,o,u){n.reason||(n.reason=new QA(s,o,u),r(n.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new e(a(function(i){t=i},"executor")),cancel:t}}},dRn=FRe;function pRn(e){return a(function(r){return e.apply(null,r)},"wrap")}a(pRn,"spread");function fRn(e){return Je.isObject(e)&&e.isAxiosError===!0}a(fRn,"isAxiosError");var BRe={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(BRe).forEach(([e,t])=>{BRe[t]=e});var mRn=BRe;function qxt(e){let t=new bJ(e),r=_xt(bJ.prototype.request,t);return Je.extend(r,bJ.prototype,t,{allOwnKeys:!0}),Je.extend(r,t,null,{allOwnKeys:!0}),r.create=a(function(i){return qxt(oP(e,i))},"create"),r}a(qxt,"createInstance");var Fo=qxt(jRe);Fo.Axios=bJ;Fo.CanceledError=QA;Fo.CancelToken=dRn;Fo.isCancel=kxt;Fo.VERSION=SJ;Fo.toFormData=TJ;Fo.AxiosError=_r;Fo.Cancel=Fo.CanceledError;Fo.all=a(function(t){return Promise.all(t)},"all");Fo.spread=pRn;Fo.isAxiosError=fRn;Fo.mergeConfig=oP;Fo.AxiosHeaders=Ff;Fo.formToJSON=e=>Ixt(Je.isHTMLForm(e)?new FormData(e):e);Fo.getAdapter=Mxt.getAdapter;Fo.HttpStatusCode=mRn;Fo.default=Fo;Uxt.exports=Fo});var OJ=y(RJ=>{"use strict";Object.defineProperty(RJ,"__esModule",{value:!0});RJ.CredentialsMethod=void 0;var $xt;(function(e){e.None="none",e.ApiToken="api_token",e.ClientCredentials="client_credentials"})($xt||(RJ.CredentialsMethod=$xt={}))});var eC=y(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.FgaRequiredParamError=Bo.FgaValidationError=Bo.FgaApiAuthenticationError=Bo.FgaApiInternalError=Bo.FgaApiRateLimitExceededError=Bo.FgaApiNotFoundError=Bo.FgaApiValidationError=Bo.FgaApiError=Bo.FgaError=void 0;var cP=class extends Error{static{a(this,"FgaError")}constructor(t,r){super(r||typeof t=="string"?t:`FGA Error${t?.message?`: ${t.message}`:""}`),this.name="FgaError",t?.stack&&(this.stack=t.stack)}};Bo.FgaError=cP;function NJ(e){let t=(e||"").split("/");t.length<4&&(t=[]);let r=t[2]||"",n=t[3]||"";return{storeId:r,endpointCategory:n}}a(NJ,"getRequestMetadataFromPath");var jxt="fga-request-id";function JRe(e){return e.response?Object.fromEntries(Object.entries(e.response.headers).map(([t,r])=>[t.toLowerCase(),r])):{}}a(JRe,"getResponseHeaders");var ZA=class extends cP{static{a(this,"FgaApiError")}constructor(t,r){var n,i,s,o,u,l,c,d,p,f;super(r||t),this.name="FgaApiError",this.statusCode=(n=t.response)===null||n===void 0?void 0:n.status,this.statusText=(i=t.response)===null||i===void 0?void 0:i.statusText,this.requestData=(s=t.config)===null||s===void 0?void 0:s.data,this.requestURL=(o=t.config)===null||o===void 0?void 0:o.url,this.method=(u=t.config)===null||u===void 0?void 0:u.method;let{storeId:m,endpointCategory:h}=NJ((l=t.request)===null||l===void 0?void 0:l.path);this.storeId=m,this.endpointCategory=h,this.apiErrorMessage=(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message,this.responseData=(p=t.response)===null||p===void 0?void 0:p.data,this.responseHeader=(f=t.response)===null||f===void 0?void 0:f.headers;let g=JRe(t);this.requestId=g[jxt],t?.stack&&(this.stack=t.stack)}};Bo.FgaApiError=ZA;var VRe=class extends ZA{static{a(this,"FgaApiValidationError")}constructor(t,r){var n,i,s,o,u,l,c,d;super(t),this.name="FgaApiValidationError",this.apiErrorCode=(i=(n=t.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;let{endpointCategory:p}=NJ((s=t.request)===null||s===void 0?void 0:s.path);this.message=r||(!((u=(o=t.response)===null||o===void 0?void 0:o.data)===null||u===void 0)&&u.message?`FGA API Validation Error: ${(l=t.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:t.message)}};Bo.FgaApiValidationError=VRe;var zRe=class extends ZA{static{a(this,"FgaApiNotFoundError")}constructor(t,r){var n,i,s,o,u,l,c;super(t),this.name="FgaApiNotFoundError",this.apiErrorCode=(i=(n=t.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code,this.message=r||(!((o=(s=t.response)===null||s===void 0?void 0:s.data)===null||o===void 0)&&o.message?`FGA API NotFound Error: ${(u=t.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=t.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:t.message)}};Bo.FgaApiNotFoundError=zRe;var KRe=class extends ZA{static{a(this,"FgaApiRateLimitExceededError")}constructor(t,r){var n,i,s;super(t),this.name="FgaApiRateLimitExceededError",this.apiErrorCode=(i=(n=t.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;let{endpointCategory:o}=NJ((s=t.request)===null||s===void 0?void 0:s.path),u=JRe(t);this.message=r||`FGA API Rate Limit Error for ${this.method} ${o}`}};Bo.FgaApiRateLimitExceededError=KRe;var WRe=class extends ZA{static{a(this,"FgaApiInternalError")}constructor(t,r){var n,i,s,o,u,l,c,d;super(t),this.name="FgaApiInternalError";let{endpointCategory:p}=NJ((n=t.request)===null||n===void 0?void 0:n.path);this.apiErrorCode=(s=(i=t.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.code,this.message=r||(!((u=(o=t.response)===null||o===void 0?void 0:o.data)===null||u===void 0)&&u.message?`FGA API Internal Error: ${(l=t.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:t.message)}};Bo.FgaApiInternalError=WRe;var YRe=class extends cP{static{a(this,"FgaApiAuthenticationError")}constructor(t){var r,n,i,s,o,u,l,c,d,p;super(`FGA Authentication Error.${!((r=t.response)===null||r===void 0)&&r.statusText?` ${t.response.statusText}`:""}`),this.name="FgaApiAuthenticationError",this.statusCode=(n=t.response)===null||n===void 0?void 0:n.status,this.statusText=(i=t.response)===null||i===void 0?void 0:i.statusText,this.requestURL=(s=t.config)===null||s===void 0?void 0:s.url,this.method=(o=t.config)===null||o===void 0?void 0:o.method,this.responseData=(u=t.response)===null||u===void 0?void 0:u.data,this.responseHeader=(l=t.response)===null||l===void 0?void 0:l.headers,this.apiErrorCode=(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.code;let f=JRe(t);this.requestId=f[jxt];let m;try{m=JSON.parse(((p=t.config)===null||p===void 0?void 0:p.data)||"{}")}catch{}this.clientId=m?.client_id,this.audience=m?.audience,this.grantType=m?.grant_type,t?.stack&&(this.stack=t.stack)}};Bo.FgaApiAuthenticationError=YRe;var PJ=class extends cP{static{a(this,"FgaValidationError")}constructor(t,r){super(r),this.field=t,this.name="FgaValidationError"}};Bo.FgaValidationError=PJ;var XRe=class extends PJ{static{a(this,"FgaRequiredParamError")}constructor(t,r,n){super(r,n),this.functionName=t,this.name="FgaRequiredParamError"}};Bo.FgaRequiredParamError=XRe});var FF=y(GE=>{"use strict";Object.defineProperty(GE,"__esModule",{value:!0});GE.isWellFormedUlidString=GE.isWellFormedUriString=GE.assertParamExists=void 0;var hRn=eC(),gRn=a(function(e,t,r){if(r==null)throw new hRn.FgaRequiredParamError(e,t,`Required parameter ${t} was null or undefined when calling ${e}.`)},"assertParamExists");GE.assertParamExists=gRn;var yRn=a(e=>{try{let t=new URL(e);return(t.toString()===e||t.toString()===`${e}/`)&&(t.protocol==="https:"||t.protocol==="http:")}catch{return!1}},"isWellFormedUriString");GE.isWellFormedUriString=yRn;var _Rn=a(e=>{var t;let r=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;return!!(typeof e=="string"&&(!((t=e.match(r))===null||t===void 0)&&t.length))},"isWellFormedUlidString");GE.isWellFormedUlidString=_Rn});var ZRe=y(dP=>{"use strict";Object.defineProperty(dP,"__esModule",{value:!0});dP.Configuration=dP.GetDefaultRetryParams=void 0;var BF=OJ(),QRe=eC(),IJ=FF(),vRn=15,ERn=100,bRn="openfga-sdk js/0.3.0";function SRn(e=vRn,t=ERn){return{maxRetry:e,minWaitInMs:t}}a(SRn,"GetDefaultRetryParams");dP.GetDefaultRetryParams=SRn;var kJ=class{static{a(this,"Configuration")}constructor(t={}){this.apiScheme="https",this.getBasePath=()=>`${this.apiScheme}://${this.apiHost}`,this.apiScheme=t.apiScheme||this.apiScheme,this.apiHost=t.apiHost,this.storeId=t.storeId;let r=t.credentials;if(r)switch(r?.method){case BF.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case BF.CredentialsMethod.ClientCredentials:this.credentials={method:BF.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case BF.CredentialsMethod.None:default:this.credentials={method:BF.CredentialsMethod.None};break}let n=t.baseOptions||{};n.headers=n.headers||{},typeof process=="object"&&process.title==="node"&&!n.headers["User-Agent"]&&(n.headers["User-Agent"]=bRn),this.baseOptions=n,this.retryParams=t.retryParams}isValid(){var t;if((0,IJ.assertParamExists)("Configuration","apiScheme",this.apiScheme),(0,IJ.assertParamExists)("Configuration","apiHost",this.apiHost),!(0,IJ.isWellFormedUriString)(this.getBasePath()))throw new QRe.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`);if(this.storeId&&!(0,IJ.isWellFormedUlidString)(this.storeId))throw new QRe.FgaValidationError("storeId");if(!((t=this.retryParams)===null||t===void 0)&&t.maxRetry&&this.retryParams.maxRetry>15)throw new QRe.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15");return!0}};dP.Configuration=kJ;kJ.sdkVersion="0.3.0"});var Gxt=y(DJ=>{"use strict";Object.defineProperty(DJ,"__esModule",{value:!0});DJ.assertNever=void 0;function ARn(e){throw new Error(`Assertion failed. Unacceptable value: '${e}'`)}a(ARn,"assertNever");DJ.assertNever=ARn});var Hxt=y(LJ=>{"use strict";Object.defineProperty(LJ,"__esModule",{value:!0});LJ.chunkArray=void 0;function CRn(e,t){let r=[],n=[...e];for(;n.length>0;)r.push(n.splice(0,t));return r}a(CRn,"chunkArray");LJ.chunkArray=CRn});var zxt=y(pP=>{"use strict";Object.defineProperty(pP,"__esModule",{value:!0});pP.generateRandomIdWithNonUniqueFallback=pP.generateRandomId=void 0;var FJ=require("crypto");function Vxt(){if(typeof FJ.randomUUID=="function")return(0,FJ.randomUUID)();if(typeof FJ.randomBytes=="function")return(0,FJ.randomBytes)(20).toString("hex")}a(Vxt,"generateRandomId");pP.generateRandomId=Vxt;function wRn(){return Vxt()||"00000000-0000-0000-0000-000000000000"}a(wRn,"generateRandomIdWithNonUniqueFallback");pP.generateRandomIdWithNonUniqueFallback=wRn});var Kxt=y(BJ=>{"use strict";Object.defineProperty(BJ,"__esModule",{value:!0});BJ.setHeaderIfNotSet=void 0;function TRn(e,t,r){!e[t]&&r&&(e[t]=r)}a(TRn,"setHeaderIfNotSet");BJ.setHeaderIfNotSet=TRn});var Wxt=y(MJ=>{"use strict";Object.defineProperty(MJ,"__esModule",{value:!0});MJ.setNotEnumerableProperty=void 0;function xRn(e,t,r){Object.defineProperty(e,t,{enumerable:!1,writable:!1,value:r})}a(xRn,"setNotEnumerableProperty");MJ.setNotEnumerableProperty=xRn});var eOe=y(mh=>{"use strict";var RRn=mh&&mh.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),MF=mh&&mh.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&RRn(t,e,r)};Object.defineProperty(mh,"__esModule",{value:!0});MF(Gxt(),mh);MF(Hxt(),mh);MF(zxt(),mh);MF(Kxt(),mh);MF(Wxt(),mh)});var rOe=y(tu=>{"use strict";var tOe=tu&&tu.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})};Object.defineProperty(tu,"__esModule",{value:!0});tu.createRequestFunction=tu.attemptHttpRequest=tu.toPathString=tu.serializeDataIfNeeded=tu.setSearchParams=tu.setBearerAuthToObject=tu.DUMMY_BASE_URL=void 0;var ORn=qJ(),tC=eC(),PRn=eOe();tu.DUMMY_BASE_URL="https://example.com";var NRn=a(function(e,t){return tOe(this,void 0,void 0,function*(){let r=yield t.getAccessTokenHeader();r&&!e[r.name]&&(e[r.name]=r.value)})},"setBearerAuthToObject");tu.setBearerAuthToObject=NRn;var IRn=a(function(e,...t){let r=new URLSearchParams(e.search);for(let n of t)for(let i in n)if(Array.isArray(n[i])){r.delete(i);for(let s of n[i])r.append(i,s)}else r.set(i,n[i]);e.search=r.toString()},"setSearchParams");tu.setSearchParams=IRn;var kRn=a(e=>{let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return e!==null&&(t.test(e)||e.toLowerCase()==="application/json-patch+json")},"isJsonMime"),DRn=a(function(e,t){let r=typeof e!="string";return r&&kRn(t.headers["Content-Type"])?JSON.stringify(e!==void 0?e:{}):e||""},"serializeDataIfNeeded");tu.serializeDataIfNeeded=DRn;var LRn=a(function(e){return e.pathname+e.search+e.hash},"toPathString");tu.toPathString=LRn;function FRn(e){return e&&typeof e=="object"&&e.isAxiosError===!0}a(FRn,"isAxiosError");function BRn(e,t){let r=Math.ceil(Math.pow(2,e)*t),n=Math.ceil(Math.pow(2,e+1)*t);return Math.floor(Math.random()*(n-r)+r)}a(BRn,"randomTime");function Yxt(e,t,r){var n;return tOe(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(e)}catch(s){if(!FRn(s))throw new tC.FgaError(s);let o=(n=s?.response)===null||n===void 0?void 0:n.status;if(o===400||o===422)throw new tC.FgaApiValidationError(s);if(o===401||o===403)throw new tC.FgaApiAuthenticationError(s);if(o===404)throw new tC.FgaApiNotFoundError(s);if(o===429||o>=500){if(i>=t.maxRetry)throw o===429?new tC.FgaApiRateLimitExceededError(s):new tC.FgaApiInternalError(s);yield new Promise(u=>setTimeout(u,BRn(i,t.minWaitInMs)))}else throw new tC.FgaApiError(s)}}while(i<t.maxRetry+1)})}a(Yxt,"attemptHttpRequest");tu.attemptHttpRequest=Yxt;var MRn=a(function(e,t,r,n){var i,s;r.isValid();let o=!((i=e.options)===null||i===void 0)&&i.retryParams?(s=e.options)===null||s===void 0?void 0:s.retryParams:r.retryParams,u=o?o.maxRetry:0,l=o?o.minWaitInMs:0;return n||(n=ORn.Credentials.init(r)),(c=t)=>tOe(this,void 0,void 0,function*(){yield(0,tu.setBearerAuthToObject)(e.options.headers,n);let d=Object.assign(Object.assign({},e.options),{url:r.getBasePath()+e.url}),p=yield Yxt(d,{maxRetry:u,minWaitInMs:l},c),f=typeof p?.data>"u"?{}:p?.data,m=Object.assign({},f);return(0,PRn.setNotEnumerableProperty)(m,"$response",p),m})},"createRequestFunction");tu.createRequestFunction=MRn});var Jxt=y(fP=>{"use strict";var nOe=fP&&fP.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})};Object.defineProperty(fP,"__esModule",{value:!0});fP.Credentials=void 0;var Xxt=xJ(),HE=FF(),iOe=eC(),qRn=rOe(),Bf=OJ(),sOe=class e{static{a(this,"Credentials")}static init(t){return new e(t.credentials)}constructor(t,r=Xxt.default){this.authConfig=t,this.axios=r,this.initConfig(),this.isValid()}initConfig(){var t;switch((t=this.authConfig)===null||t===void 0?void 0:t.method){case Bf.CredentialsMethod.ApiToken:this.authConfig.config&&(this.authConfig.config.headerName||(this.authConfig.config.headerName="Authorization"),this.authConfig.config.headerValuePrefix||(this.authConfig.config.headerValuePrefix="Bearer"));break;case Bf.CredentialsMethod.ClientCredentials:case Bf.CredentialsMethod.None:default:break}}isValid(){var t,r,n,i,s,o,u,l,c;let{authConfig:d}=this;switch(d?.method){case Bf.CredentialsMethod.None:break;case Bf.CredentialsMethod.ApiToken:(0,HE.assertParamExists)("Credentials","config.token",(t=d.config)===null||t===void 0?void 0:t.token),(0,HE.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName),(0,HE.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case Bf.CredentialsMethod.ClientCredentials:if((0,HE.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId),(0,HE.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret),(0,HE.assertParamExists)("Credentials","config.apiTokenIssuer",(o=d.config)===null||o===void 0?void 0:o.apiTokenIssuer),(0,HE.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience),!(0,HE.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`))throw new iOe.FgaValidationError(`Configuration.apiTokenIssuer does not form a valid URI (https://${(c=d.config)===null||c===void 0?void 0:c.apiTokenIssuer})`);break}}getAccessTokenHeader(){var t;return nOe(this,void 0,void 0,function*(){let r=yield this.getAccessTokenValue();switch((t=this.authConfig)===null||t===void 0?void 0:t.method){case Bf.CredentialsMethod.None:return;case Bf.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case Bf.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var t;return nOe(this,void 0,void 0,function*(){switch((t=this.authConfig)===null||t===void 0?void 0:t.method){case Bf.CredentialsMethod.None:return;case Bf.CredentialsMethod.ApiToken:return this.authConfig.config.token;case Bf.CredentialsMethod.ClientCredentials:return this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)?this.accessToken:this.refreshAccessToken()}})}refreshAccessToken(){var t;return nOe(this,void 0,void 0,function*(){let r=(t=this.authConfig)===null||t===void 0?void 0:t.config;try{let n=yield(0,qRn.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},Xxt.default);return n&&(this.accessToken=n.data.access_token,this.accessTokenExpiryDate=new Date(Date.now()+n.data.expires_in*1e3)),this.accessToken}catch(n){throw n instanceof iOe.FgaApiError&&(n.constructor=iOe.FgaApiAuthenticationError,n.name="FgaApiAuthenticationError",n.clientId=r.clientId,n.audience=r.apiAudience,n.grantType="client_credentials"),n}})}};fP.Credentials=sOe});var qJ=y(VE=>{"use strict";var URn=VE&&VE.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Qxt=VE&&VE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&URn(t,e,r)};Object.defineProperty(VE,"__esModule",{value:!0});Qxt(Jxt(),VE);Qxt(OJ(),VE)});var oOe=y(UJ=>{"use strict";Object.defineProperty(UJ,"__esModule",{value:!0});UJ.BaseAPI=void 0;var $Rn=xJ(),jRn=require("http"),GRn=require("https"),Zxt=ZRe(),HRn=qJ(),VRn=1e4,aOe=class{static{a(this,"BaseAPI")}constructor(t,r){var n;if(this.axios=r,t instanceof Zxt.Configuration?this.configuration=t:this.configuration=new Zxt.Configuration(t),this.configuration.isValid(),this.credentials=HRn.Credentials.init(this.configuration),!this.axios){let i=new jRn.Agent({keepAlive:!0}),s=new GRn.Agent({keepAlive:!0});this.axios=$Rn.default.create({httpAgent:i,httpsAgent:s,timeout:VRn,headers:(n=this.configuration.baseOptions)===null||n===void 0?void 0:n.headers})}}get storeId(){return this.configuration.storeId}set storeId(t){this.configuration.storeId=t}};UJ.BaseAPI=aOe});var lOe=y(ws=>{"use strict";var As=ws&&ws.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})};Object.defineProperty(ws,"__esModule",{value:!0});ws.OpenFgaApi=ws.OpenFgaApiFactory=ws.OpenFgaApiFp=ws.OpenFgaApiAxiosParamCreator=void 0;var wc=xJ(),zRn=oOe(),ar=rOe(),Va=FF(),KRn=a(function(e,t){return{check:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("check","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/check".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),createStore:(r,n={})=>As(this,void 0,void 0,function*(){let i="/stores",s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),deleteStore:(r={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let n="/stores/{store_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))),i=new URL(n,ar.DUMMY_BASE_URL),s;e&&(s=e.baseOptions);let o=Object.assign(Object.assign({method:"DELETE"},s),r),u={},l={};return(0,ar.setSearchParams)(i,l,r.query),o.headers=Object.assign(Object.assign({},u),r.headers),{url:(0,ar.toPathString)(i),options:o}}),expand:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("expand","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/expand".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),getStore:(r={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let n="/stores/{store_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))),i=new URL(n,ar.DUMMY_BASE_URL),s;e&&(s=e.baseOptions);let o=Object.assign(Object.assign({method:"GET"},s),r),u={},l={};return(0,ar.setSearchParams)(i,l,r.query),o.headers=Object.assign(Object.assign({},u),r.headers),{url:(0,ar.toPathString)(i),options:o}}),listObjects:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("listObjects","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/list-objects".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),listStores:(r,n,i={})=>As(this,void 0,void 0,function*(){let s="/stores",o=new URL(s,ar.DUMMY_BASE_URL),u;e&&(u=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},u),i),c={},d={};return r!==void 0&&(d.page_size=r),n!==void 0&&(d.continuation_token=n),(0,ar.setSearchParams)(o,d,i.query),l.headers=Object.assign(Object.assign({},c),i.headers),{url:(0,ar.toPathString)(o),options:l}}),read:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("read","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/read".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),readAssertions:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("readAssertions","authorizationModelId",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/assertions/{authorization_model_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))).replace("{authorization_model_id}",encodeURIComponent(String(r))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"GET"},o),n),l={},c={};return(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),{url:(0,ar.toPathString)(s),options:u}}),readAuthorizationModel:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("readAuthorizationModel","id",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/authorization-models/{id}".replace("{store_id}",encodeURIComponent(String(e.storeId))).replace("{id}",encodeURIComponent(String(r))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"GET"},o),n),l={},c={};return(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),{url:(0,ar.toPathString)(s),options:u}}),readAuthorizationModels:(r,n,i={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let s="/stores/{store_id}/authorization-models".replace("{store_id}",encodeURIComponent(String(e.storeId))),o=new URL(s,ar.DUMMY_BASE_URL),u;e&&(u=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},u),i),c={},d={};return r!==void 0&&(d.page_size=r),n!==void 0&&(d.continuation_token=n),(0,ar.setSearchParams)(o,d,i.query),l.headers=Object.assign(Object.assign({},c),i.headers),{url:(0,ar.toPathString)(o),options:l}}),readChanges:(r,n,i,s={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let o="/stores/{store_id}/changes".replace("{store_id}",encodeURIComponent(String(e.storeId))),u=new URL(o,ar.DUMMY_BASE_URL),l;e&&(l=e.baseOptions);let c=Object.assign(Object.assign({method:"GET"},l),s),d={},p={};return r!==void 0&&(p.type=r),n!==void 0&&(p.page_size=n),i!==void 0&&(p.continuation_token=i),(0,ar.setSearchParams)(u,p,s.query),c.headers=Object.assign(Object.assign({},d),s.headers),{url:(0,ar.toPathString)(u),options:c}}),write:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("write","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/write".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),writeAssertions:(r,n,i={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("writeAssertions","authorizationModelId",r),(0,Va.assertParamExists)("writeAssertions","body",n),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let s="/stores/{store_id}/assertions/{authorization_model_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))).replace("{authorization_model_id}",encodeURIComponent(String(r))),o=new URL(s,ar.DUMMY_BASE_URL),u;e&&(u=e.baseOptions);let l=Object.assign(Object.assign({method:"PUT"},u),i),c={},d={};return c["Content-Type"]="application/json",(0,ar.setSearchParams)(o,d,i.query),l.headers=Object.assign(Object.assign({},c),i.headers),l.data=(0,ar.serializeDataIfNeeded)(n,l),{url:(0,ar.toPathString)(o),options:l}}),writeAuthorizationModel:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("writeAuthorizationModel","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/authorization-models".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}})}},"OpenFgaApiAxiosParamCreator");ws.OpenFgaApiAxiosParamCreator=KRn;var WRn=a(function(e,t){let r=(0,ws.OpenFgaApiAxiosParamCreator)(e,t);return{check(n,i){return As(this,void 0,void 0,function*(){let s=yield r.check(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},createStore(n,i){return As(this,void 0,void 0,function*(){let s=yield r.createStore(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},deleteStore(n){return As(this,void 0,void 0,function*(){let i=yield r.deleteStore(n);return(0,ar.createRequestFunction)(i,wc.default,e,t)})},expand(n,i){return As(this,void 0,void 0,function*(){let s=yield r.expand(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},getStore(n){return As(this,void 0,void 0,function*(){let i=yield r.getStore(n);return(0,ar.createRequestFunction)(i,wc.default,e,t)})},listObjects(n,i){return As(this,void 0,void 0,function*(){let s=yield r.listObjects(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},listStores(n,i,s){return As(this,void 0,void 0,function*(){let o=yield r.listStores(n,i,s);return(0,ar.createRequestFunction)(o,wc.default,e,t)})},read(n,i){return As(this,void 0,void 0,function*(){let s=yield r.read(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},readAssertions(n,i){return As(this,void 0,void 0,function*(){let s=yield r.readAssertions(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},readAuthorizationModel(n,i){return As(this,void 0,void 0,function*(){let s=yield r.readAuthorizationModel(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},readAuthorizationModels(n,i,s){return As(this,void 0,void 0,function*(){let o=yield r.readAuthorizationModels(n,i,s);return(0,ar.createRequestFunction)(o,wc.default,e,t)})},readChanges(n,i,s,o){return As(this,void 0,void 0,function*(){let u=yield r.readChanges(n,i,s,o);return(0,ar.createRequestFunction)(u,wc.default,e,t)})},write(n,i){return As(this,void 0,void 0,function*(){let s=yield r.write(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},writeAssertions(n,i,s){return As(this,void 0,void 0,function*(){let o=yield r.writeAssertions(n,i,s);return(0,ar.createRequestFunction)(o,wc.default,e,t)})},writeAuthorizationModel(n,i){return As(this,void 0,void 0,function*(){let s=yield r.writeAuthorizationModel(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})}}},"OpenFgaApiFp");ws.OpenFgaApiFp=WRn;var YRn=a(function(e,t,r){let n=(0,ws.OpenFgaApiFp)(e,t);return{check(i,s){return n.check(i,s).then(o=>o(r))},createStore(i,s){return n.createStore(i,s).then(o=>o(r))},deleteStore(i){return n.deleteStore(i).then(s=>s(r))},expand(i,s){return n.expand(i,s).then(o=>o(r))},getStore(i){return n.getStore(i).then(s=>s(r))},listObjects(i,s){return n.listObjects(i,s).then(o=>o(r))},listStores(i,s,o){return n.listStores(i,s,o).then(u=>u(r))},read(i,s){return n.read(i,s).then(o=>o(r))},readAssertions(i,s){return n.readAssertions(i,s).then(o=>o(r))},readAuthorizationModel(i,s){return n.readAuthorizationModel(i,s).then(o=>o(r))},readAuthorizationModels(i,s,o){return n.readAuthorizationModels(i,s,o).then(u=>u(r))},readChanges(i,s,o,u){return n.readChanges(i,s,o,u).then(l=>l(r))},write(i,s){return n.write(i,s).then(o=>o(r))},writeAssertions(i,s,o){return n.writeAssertions(i,s,o).then(u=>u(r))},writeAuthorizationModel(i,s){return n.writeAuthorizationModel(i,s).then(o=>o(r))}}},"OpenFgaApiFactory");ws.OpenFgaApiFactory=YRn;var uOe=class extends zRn.BaseAPI{static{a(this,"OpenFgaApi")}check(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).check(t,r).then(n=>n(this.axios))}createStore(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).createStore(t,r).then(n=>n(this.axios))}deleteStore(t){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).deleteStore(t).then(r=>r(this.axios))}expand(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).expand(t,r).then(n=>n(this.axios))}getStore(t){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).getStore(t).then(r=>r(this.axios))}listObjects(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).listObjects(t,r).then(n=>n(this.axios))}listStores(t,r,n){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).listStores(t,r,n).then(i=>i(this.axios))}read(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).read(t,r).then(n=>n(this.axios))}readAssertions(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readAssertions(t,r).then(n=>n(this.axios))}readAuthorizationModel(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModel(t,r).then(n=>n(this.axios))}readAuthorizationModels(t,r,n){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModels(t,r,n).then(i=>i(this.axios))}readChanges(t,r,n,i){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readChanges(t,r,n,i).then(s=>s(this.axios))}write(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).write(t,r).then(n=>n(this.axios))}writeAssertions(t,r,n){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).writeAssertions(t,r,n).then(i=>i(this.axios))}writeAuthorizationModel(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).writeAuthorizationModel(t,r).then(n=>n(this.axios))}};ws.OpenFgaApi=uOe});var tRt=y((n5s,eRt)=>{async function*XRn(e,t,r){let n=new Set;async function i(){let[s,o]=await Promise.race(n);return n.delete(s),o}a(i,"consume");for(let s of t){let o=(async()=>await r(s,t))().then(u=>[o,u]);n.add(o),n.size>=e&&(yield await i())}for(;n.size;)yield await i()}a(XRn,"asyncPool");eRt.exports=XRn});var rRt=y(ng=>{"use strict";var za=ng&&ng.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})},cOe=ng&&ng.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(o){return new Promise(function(u,l){o=e[s](o),i(u,l,o.done,o.value)})}}function i(s,o,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},o)}};Object.defineProperty(ng,"__esModule",{value:!0});ng.OpenFgaClient=ng.ClientWriteStatus=void 0;var dOe=tRt(),JRn=lOe(),QRn=oOe(),pOe=eC(),yd=eOe(),ZRn=FF(),fOe=10,mP="X-OpenFGA-Client-Method",mOe="X-OpenFGA-Client-Bulk-Request-Id",hP;(function(e){e.SUCCESS="success",e.FAILURE="failure"})(hP||(ng.ClientWriteStatus=hP={}));var hOe=class extends QRn.BaseAPI{static{a(this,"OpenFgaClient")}constructor(t,r){super(t,r),this.axios=r,this.api=new JRn.OpenFgaApi(this.configuration,r),this.authorizationModelId=t.authorizationModelId,this.getAuthorizationModelId()}getAuthorizationModelId(t={}){let r=t?.authorizationModelId||this.authorizationModelId;if(r&&!(0,ZRn.isWellFormedUlidString)(r))throw new pOe.FgaValidationError("authorizationModelId");return r}checkValidApiConnection(t={}){return za(this,void 0,void 0,function*(){this.getAuthorizationModelId(t)?yield this.readAuthorizationModel(t):yield this.readLatestAuthorizationModel(t)})}listStores(t={}){return za(this,void 0,void 0,function*(){return this.api.listStores(t.pageSize,t.continuationToken,t)})}createStore(t,r={}){return za(this,void 0,void 0,function*(){return this.api.createStore(t,r)})}getStore(t={}){return za(this,void 0,void 0,function*(){return this.api.getStore(t)})}deleteStore(t={}){return za(this,void 0,void 0,function*(){return this.api.deleteStore(t)})}readAuthorizationModels(t={}){return za(this,void 0,void 0,function*(){return this.api.readAuthorizationModels(t.pageSize,t.continuationToken,t)})}writeAuthorizationModel(t,r={}){return za(this,void 0,void 0,function*(){return this.api.writeAuthorizationModel(t,r)})}readAuthorizationModel(t={}){return za(this,void 0,void 0,function*(){let r=this.getAuthorizationModelId(t);if(!r)throw new pOe.FgaRequiredParamError("ClientConfiguration","authorizationModelId");return this.api.readAuthorizationModel(r,t)})}readLatestAuthorizationModel(t={}){var r;return za(this,void 0,void 0,function*(){let{headers:n={}}=t;(0,yd.setHeaderIfNotSet)(n,mP,"ReadLatestAuthorizationModel");let i=yield this.readAuthorizationModels(Object.assign(Object.assign({},t),{pageSize:1,headers:n})),s=i;return s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0],delete s.authorization_models,s})}readChanges(t,r={}){return za(this,void 0,void 0,function*(){return this.api.readChanges(t.type,r.pageSize,r.continuationToken,r)})}read(t={},r={}){return za(this,void 0,void 0,function*(){let n={page_size:r.pageSize,continuation_token:r.continuationToken};return(t.user||t.object||t.relation)&&(n.tuple_key=t),this.api.read(n,r)})}write(t,r={}){return za(this,void 0,void 0,function*(){let{transaction:n={},headers:i={}}=r,{maxPerChunk:s=1,maxParallelRequests:o=fOe}=n,{writes:u,deletes:l}=t,c=this.getAuthorizationModelId(r);if(!n?.disable){let d={authorization_model_id:c};return u?.length&&(d.writes={tuple_keys:u}),l?.length&&(d.deletes={tuple_keys:l}),yield this.api.write(d,r),{writes:u?.map(p=>({tuple_key:p,status:hP.SUCCESS}))||[],deletes:l?.map(p=>({tuple_key:p,status:hP.SUCCESS}))||[]}}return Promise.all([(()=>za(this,void 0,void 0,function*(){var d,p,f,m,h,g,_,v;(0,yd.setHeaderIfNotSet)(i,mP,"Write"),(0,yd.setHeaderIfNotSet)(i,mOe,(0,yd.generateRandomIdWithNonUniqueFallback)());let S=[];if(u?.length)try{for(var E=!0,b=cOe(dOe(o,(0,yd.chunkArray)(u,s),R=>this.writeTuples(R,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(I=>({writes:R.map(D=>({tuple_key:D,status:hP.FAILURE,err:I})),deletes:[]})))),A;A=yield b.next(),d=A.done,!d;E=!0){m=A.value,E=!1;let R=m;S.push(R.writes)}}catch(R){p={error:R}}finally{try{!E&&!d&&(f=b.return)&&(yield f.call(b))}finally{if(p)throw p.error}}let C=[];if(l?.length)try{for(var T=!0,O=cOe(dOe(o,(0,yd.chunkArray)(l,s),R=>this.deleteTuples(R,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(I=>({writes:[],deletes:R.map(D=>({tuple_key:D,status:hP.FAILURE,err:I}))})))),P;P=yield O.next(),h=P.done,!h;T=!0){v=P.value,T=!1;let R=v;C.push(R.deletes)}}catch(R){g={error:R}}finally{try{!T&&!h&&(_=O.return)&&(yield _.call(O))}finally{if(g)throw g.error}}return{writes:S.flat(),deletes:C.flat()}}))(),this.checkValidApiConnection(r)]).then(d=>d[0])})}writeTuples(t,r={}){return za(this,void 0,void 0,function*(){let{headers:n={}}=r;return(0,yd.setHeaderIfNotSet)(n,mP,"WriteTuples"),this.write({writes:t},Object.assign(Object.assign({},r),{headers:n}))})}deleteTuples(t,r={}){return za(this,void 0,void 0,function*(){let{headers:n={}}=r;return(0,yd.setHeaderIfNotSet)(n,mP,"DeleteTuples"),this.write({deletes:t},Object.assign(Object.assign({},r),{headers:n}))})}check(t,r={}){return za(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:t.user,relation:t.relation,object:t.object},context:t.context,contextual_tuples:{tuple_keys:t.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(t,r={}){return za(this,void 0,void 0,function*(){return Promise.all([(()=>za(this,void 0,void 0,function*(){var n,i,s,o;let{headers:u={},maxParallelRequests:l=fOe}=r;(0,yd.setHeaderIfNotSet)(u,mP,"BatchCheck"),(0,yd.setHeaderIfNotSet)(u,mOe,(0,yd.generateRandomIdWithNonUniqueFallback)());let c=[];try{for(var d=!0,p=cOe(dOe(l,t,m=>this.check(m,Object.assign(Object.assign({},r),{headers:u})).then(h=>(h._request=m,h)).catch(h=>({allowed:void 0,error:h,_request:m})))),f;f=yield p.next(),n=f.done,!n;d=!0){o=f.value,d=!1;let m=o;c.push(m)}}catch(m){i={error:m}}finally{try{!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(t,r={}){return za(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:t},r)})}listObjects(t,r={}){return za(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:t.user,relation:t.relation,type:t.type,context:t.context,contextual_tuples:{tuple_keys:t.contextualTuples||[]}},r)})}listRelations(t,r={}){return za(this,void 0,void 0,function*(){let{user:n,object:i,relations:s,contextualTuples:o,context:u}=t,{headers:l={},maxParallelRequests:c=fOe}=r;if((0,yd.setHeaderIfNotSet)(l,mP,"ListRelations"),(0,yd.setHeaderIfNotSet)(l,mOe,(0,yd.generateRandomIdWithNonUniqueFallback)()),!s?.length)throw new pOe.FgaValidationError("relations","When calling listRelations, at least one relation must be passed in the relations field");let d=yield this.batchCheck(s.map(f=>({user:n,relation:f,object:i,contextualTuples:o,context:u})),Object.assign(Object.assign({},r),{headers:l,maxParallelRequests:c})),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(t={}){return za(this,void 0,void 0,function*(){return this.api.readAssertions(this.getAuthorizationModelId(t),t)})}writeAssertions(t,r={}){return za(this,void 0,void 0,function*(){return this.api.writeAssertions(this.getAuthorizationModelId(r),{assertions:t.map(n=>({tuple_key:{user:n.user,relation:n.relation,object:n.object},expectation:n.expectation}))},r)})}};ng.OpenFgaClient=hOe});var lRt=y(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.TypeName=_d.TupleOperation=_d.NullValue=_d.NotFoundErrorCode=_d.InternalErrorCode=_d.ErrorCode=void 0;var nRt;(function(e){e.NoError="no_error",e.ValidationError="validation_error",e.AuthorizationModelNotFound="authorization_model_not_found",e.AuthorizationModelResolutionTooComplex="authorization_model_resolution_too_complex",e.InvalidWriteInput="invalid_write_input",e.CannotAllowDuplicateTuplesInOneRequest="cannot_allow_duplicate_tuples_in_one_request",e.CannotAllowDuplicateTypesInOneRequest="cannot_allow_duplicate_types_in_one_request",e.CannotAllowMultipleReferencesToOneRelation="cannot_allow_multiple_references_to_one_relation",e.InvalidContinuationToken="invalid_continuation_token",e.InvalidTupleSet="invalid_tuple_set",e.InvalidCheckInput="invalid_check_input",e.InvalidExpandInput="invalid_expand_input",e.UnsupportedUserSet="unsupported_user_set",e.InvalidObjectFormat="invalid_object_format",e.WriteFailedDueToInvalidInput="write_failed_due_to_invalid_input",e.AuthorizationModelAssertionsNotFound="authorization_model_assertions_not_found",e.LatestAuthorizationModelNotFound="latest_authorization_model_not_found",e.TypeNotFound="type_not_found",e.RelationNotFound="relation_not_found",e.EmptyRelationDefinition="empty_relation_definition",e.InvalidUser="invalid_user",e.InvalidTuple="invalid_tuple",e.UnknownRelation="unknown_relation",e.StoreIdInvalidLength="store_id_invalid_length",e.AssertionsTooManyItems="assertions_too_many_items",e.IdTooLong="id_too_long",e.AuthorizationModelIdTooLong="authorization_model_id_too_long",e.TupleKeyValueNotSpecified="tuple_key_value_not_specified",e.TupleKeysTooManyOrTooFewItems="tuple_keys_too_many_or_too_few_items",e.PageSizeInvalid="page_size_invalid",e.ParamMissingValue="param_missing_value",e.DifferenceBaseMissingValue="difference_base_missing_value",e.SubtractBaseMissingValue="subtract_base_missing_value",e.ObjectTooLong="object_too_long",e.RelationTooLong="relation_too_long",e.TypeDefinitionsTooFewItems="type_definitions_too_few_items",e.TypeInvalidLength="type_invalid_length",e.TypeInvalidPattern="type_invalid_pattern",e.RelationsTooFewItems="relations_too_few_items",e.RelationsTooLong="relations_too_long",e.RelationsInvalidPattern="relations_invalid_pattern",e.ObjectInvalidPattern="object_invalid_pattern",e.QueryStringTypeContinuationTokenMismatch="query_string_type_continuation_token_mismatch",e.ExceededEntityLimit="exceeded_entity_limit",e.InvalidContextualTuple="invalid_contextual_tuple",e.DuplicateContextualTuple="duplicate_contextual_tuple",e.InvalidAuthorizationModel="invalid_authorization_model",e.UnsupportedSchemaVersion="unsupported_schema_version"})(nRt||(_d.ErrorCode=nRt={}));var iRt;(function(e){e.NoInternalError="no_internal_error",e.InternalError="internal_error",e.Cancelled="cancelled",e.DeadlineExceeded="deadline_exceeded",e.AlreadyExists="already_exists",e.ResourceExhausted="resource_exhausted",e.FailedPrecondition="failed_precondition",e.Aborted="aborted",e.OutOfRange="out_of_range",e.Unavailable="unavailable",e.DataLoss="data_loss"})(iRt||(_d.InternalErrorCode=iRt={}));var sRt;(function(e){e.NoNotFoundError="no_not_found_error",e.UndefinedEndpoint="undefined_endpoint",e.StoreIdNotFound="store_id_not_found",e.Unimplemented="unimplemented"})(sRt||(_d.NotFoundErrorCode=sRt={}));var aRt;(function(e){e.NullValue="NULL_VALUE"})(aRt||(_d.NullValue=aRt={}));var oRt;(function(e){e.Write="TUPLE_OPERATION_WRITE",e.Delete="TUPLE_OPERATION_DELETE"})(oRt||(_d.TupleOperation=oRt={}));var uRt;(function(e){e.Unspecified="TYPE_NAME_UNSPECIFIED",e.Any="TYPE_NAME_ANY",e.Bool="TYPE_NAME_BOOL",e.String="TYPE_NAME_STRING",e.Int="TYPE_NAME_INT",e.Uint="TYPE_NAME_UINT",e.Double="TYPE_NAME_DOUBLE",e.Duration="TYPE_NAME_DURATION",e.Timestamp="TYPE_NAME_TIMESTAMP",e.Map="TYPE_NAME_MAP",e.List="TYPE_NAME_LIST",e.Ipaddress="TYPE_NAME_IPADDRESS"})(uRt||(_d.TypeName=uRt={}))});var pRt=y(Au=>{"use strict";var eOn=Au&&Au.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$J=Au&&Au.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&eOn(t,e,r)};Object.defineProperty(Au,"__esModule",{value:!0});Au.CredentialsMethod=Au.Credentials=Au.GetDefaultRetryParams=Au.Configuration=void 0;$J(lOe(),Au);$J(rRt(),Au);$J(lRt(),Au);var cRt=ZRe();Object.defineProperty(Au,"Configuration",{enumerable:!0,get:function(){return cRt.Configuration}});Object.defineProperty(Au,"GetDefaultRetryParams",{enumerable:!0,get:function(){return cRt.GetDefaultRetryParams}});var dRt=qJ();Object.defineProperty(Au,"Credentials",{enumerable:!0,get:function(){return dRt.Credentials}});Object.defineProperty(Au,"CredentialsMethod",{enumerable:!0,get:function(){return dRt.CredentialsMethod}});$J(eC(),Au)});var mRt=y(gP=>{"use strict";var tOn=gP&&gP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gP,"__esModule",{value:!0});gP.OpenFGAService=void 0;var qF=tOn(sc()),fRt=pRt(),rOn=JO(),nOn="deployer-app@zuplo",gOe=class{static{a(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(t,r){if(!qF.default.OPENFGA_SERVICE_URL)throw new Error("OPENFGA_SERVICE_URL is not set");this.userSub=r&&r.userSub?r.userSub:t.getUserSub(),this.baseUrl=qF.default.OPENFGA_SERVICE_URL,this.apiHost=qF.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,""),this.storeId=qF.default.OPENFGA_STORE_ID,this.modelId=qF.default.OPENFGA_MODEL_ID,this.logger=t.log}async getOpenFgaClient(){if(!this.openFGAClient){let t=await(0,rOn.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new fRt.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:fRt.CredentialsMethod.ApiToken,config:{token:t}}})}return this.openFGAClient}async createAccountMember(t){try{await(await this.getOpenFgaClient()).write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${t}`}]})}catch(r){this.logger.warn(`RBAC failed to create account membership. Error: ${r.message}`)}}async getAccountMemberships(){let r=await(await this.getOpenFgaClient()).listObjects({user:`user:${this.userSub}`,relation:"member",type:"account"});return r?r.objects.map(n=>n.replace(/^(account:)/,"")):[]}async isAccountMember(t){try{let r=await this.getOpenFgaClient(),{allowed:n}=await r.check({user:`user:${this.userSub}`,relation:"member",object:`account:${t}`});return n||!1}catch(r){return this.logger.warn(`RBAC failed to check account membership. Error: ${r.message}`),!1}}async isZuploAdmin(){try{let t=await this.getOpenFgaClient(),{tuples:r}=await t.read({object:"role:zuplo-admin"}),n=[];return r.forEach(i=>{let s=i.key.user.replace(/^(user:)/,"");n.push(s)}),n.includes(this.userSub)}catch(t){return this.logger.warn(`RBAC failed to check for zuplo admin. Error: ${t.message}`),!1}}async isDeployerServiceAccount(){try{let t=await this.getOpenFgaClient(),{tuples:r}=await t.read({object:"role:zuplo-deployer"}),n=[];return r.forEach(i=>{let s=i.key.user.replace(/^(user:)/,"");n.push(s)}),n.includes(this.userSub)}catch(t){return this.logger.warn(`RBAC failed to check for zuplo deployer. Error: ${t.message}`),nOn===this.userSub}}async createProjectAccountAssociation(t,r){try{await(await this.getOpenFgaClient()).write({writes:[{user:`account:${t}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to create account-project association. Error: ${n.message}`)}}async deleteProjectAccountAssociation(t,r){try{await(await this.getOpenFgaClient()).write({deletes:[{user:`account:${t}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to delete account-project association. Error: ${n.message}`)}}};gP.OpenFGAService=gOe});var yRt=y(yP=>{"use strict";var gRt=yP&&yP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yP,"__esModule",{value:!0});yP.TenantService=void 0;var iOn=gRt(Lm()),hRt=gRt(sc()),sOn=wF(),aOn=new iOn.default({max:500,maxAge:1e3*60*50}),yOe=class extends sOn.ApiServiceClient{static{a(this,"TenantService")}constructor(t,r){if(!hRt.default.TENANT_API_URL)throw new Error("TENANT_API_URL is not set");let n=r&&r.userSub?r.userSub:t.getUserSub();super(hRt.default.TENANT_API_URL,aOn,{userSub:n,logger:t.log,requestId:t.id})}};yP.TenantService=yOe});var _Rt=y(ig=>{"use strict";Object.defineProperty(ig,"__esModule",{value:!0});ig.validateHostname=ig.kebabCase=ig.snakeCase=ig.sizeInBytes=void 0;function oOn(e){return new TextEncoder().encode(JSON.stringify(e)).length}a(oOn,"sizeInBytes");ig.sizeInBytes=oOn;function uOn(e){return!e||e===null?"":e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(t=>t.toLowerCase()).join("_")}a(uOn,"snakeCase");ig.snakeCase=uOn;function lOn(e){if(!e||e===null)return"";let t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t===null?"":t.map(r=>r.toLowerCase()).join("-")}a(lOn,"kebabCase");ig.kebabCase=lOn;function cOn(e){try{return!(e&&!/^(?!https?:\/\/)([a-zA-Z0-9.-]*|(\*))*\.[a-zA-Z]+$/.test(e))}catch{}return!1}a(cOn,"validateHostname");ig.validateHostname=cOn});var bRt=y(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.Type=_e.JsonType=_e.JavaScriptTypeBuilder=_e.JsonTypeBuilder=_e.TypeBuilder=_e.TypeBuilderError=_e.TransformEncodeBuilder=_e.TransformDecodeBuilder=_e.TemplateLiteralDslParser=_e.TemplateLiteralGenerator=_e.TemplateLiteralGeneratorError=_e.TemplateLiteralFinite=_e.TemplateLiteralFiniteError=_e.TemplateLiteralParser=_e.TemplateLiteralParserError=_e.TemplateLiteralResolver=_e.TemplateLiteralPattern=_e.TemplateLiteralPatternError=_e.UnionResolver=_e.KeyArrayResolver=_e.KeyArrayResolverError=_e.KeyResolver=_e.ObjectMap=_e.Intrinsic=_e.IndexedAccessor=_e.TypeClone=_e.TypeExtends=_e.TypeExtendsResult=_e.TypeExtendsError=_e.ExtendsUndefined=_e.TypeGuard=_e.TypeGuardUnknownTypeError=_e.ValueGuard=_e.FormatRegistry=_e.TypeBoxError=_e.TypeRegistry=_e.PatternStringExact=_e.PatternNumberExact=_e.PatternBooleanExact=_e.PatternString=_e.PatternNumber=_e.PatternBoolean=_e.Kind=_e.Hint=_e.Optional=_e.Readonly=_e.Transform=void 0;_e.Transform=Symbol.for("TypeBox.Transform");_e.Readonly=Symbol.for("TypeBox.Readonly");_e.Optional=Symbol.for("TypeBox.Optional");_e.Hint=Symbol.for("TypeBox.Hint");_e.Kind=Symbol.for("TypeBox.Kind");_e.PatternBoolean="(true|false)";_e.PatternNumber="(0|[1-9][0-9]*)";_e.PatternString="(.*)";_e.PatternBooleanExact=`^${_e.PatternBoolean}$`;_e.PatternNumberExact=`^${_e.PatternNumber}$`;_e.PatternStringExact=`^${_e.PatternString}$`;var _Oe;(function(e){let t=new Map;function r(){return new Map(t)}a(r,"Entries"),e.Entries=r;function n(){return t.clear()}a(n,"Clear"),e.Clear=n;function i(l){return t.delete(l)}a(i,"Delete"),e.Delete=i;function s(l){return t.has(l)}a(s,"Has"),e.Has=s;function o(l,c){t.set(l,c)}a(o,"Set"),e.Set=o;function u(l){return t.get(l)}a(u,"Get"),e.Get=u})(_Oe||(_e.TypeRegistry=_Oe={}));var hh=class extends Error{static{a(this,"TypeBoxError")}constructor(t){super(t)}};_e.TypeBoxError=hh;var vRt;(function(e){let t=new Map;function r(){return new Map(t)}a(r,"Entries"),e.Entries=r;function n(){return t.clear()}a(n,"Clear"),e.Clear=n;function i(l){return t.delete(l)}a(i,"Delete"),e.Delete=i;function s(l){return t.has(l)}a(s,"Has"),e.Has=s;function o(l,c){t.set(l,c)}a(o,"Set"),e.Set=o;function u(l){return t.get(l)}a(u,"Get"),e.Get=u})(vRt||(_e.FormatRegistry=vRt={}));var Jt;(function(e){function t(c){return Array.isArray(c)}a(t,"IsArray"),e.IsArray=t;function r(c){return typeof c=="bigint"}a(r,"IsBigInt"),e.IsBigInt=r;function n(c){return typeof c=="boolean"}a(n,"IsBoolean"),e.IsBoolean=n;function i(c){return c===null}a(i,"IsNull"),e.IsNull=i;function s(c){return typeof c=="number"}a(s,"IsNumber"),e.IsNumber=s;function o(c){return typeof c=="object"&&c!==null}a(o,"IsObject"),e.IsObject=o;function u(c){return typeof c=="string"}a(u,"IsString"),e.IsString=u;function l(c){return c===void 0}a(l,"IsUndefined"),e.IsUndefined=l})(Jt||(_e.ValueGuard=Jt={}));var vOe=class extends hh{static{a(this,"TypeGuardUnknownTypeError")}};_e.TypeGuardUnknownTypeError=vOe;var Ee;(function(e){function t(L){try{return new RegExp(L),!0}catch{return!1}}a(t,"IsPattern");function r(L){if(!Jt.IsString(L))return!1;for(let Se=0;Se<L.length;Se++){let Le=L.charCodeAt(Se);if(Le>=7&&Le<=13||Le===27||Le===127)return!1}return!0}a(r,"IsControlCharacterFree");function n(L){return o(L)||se(L)}a(n,"IsAdditionalProperties");function i(L){return Jt.IsUndefined(L)||Jt.IsBigInt(L)}a(i,"IsOptionalBigInt");function s(L){return Jt.IsUndefined(L)||Jt.IsNumber(L)}a(s,"IsOptionalNumber");function o(L){return Jt.IsUndefined(L)||Jt.IsBoolean(L)}a(o,"IsOptionalBoolean");function u(L){return Jt.IsUndefined(L)||Jt.IsString(L)}a(u,"IsOptionalString");function l(L){return Jt.IsUndefined(L)||Jt.IsString(L)&&r(L)&&t(L)}a(l,"IsOptionalPattern");function c(L){return Jt.IsUndefined(L)||Jt.IsString(L)&&r(L)}a(c,"IsOptionalFormat");function d(L){return Jt.IsUndefined(L)||se(L)}a(d,"IsOptionalSchema");function p(L){return C(L,"Any")&&u(L.$id)}a(p,"TAny"),e.TAny=p;function f(L){return C(L,"Array")&&L.type==="array"&&u(L.$id)&&se(L.items)&&s(L.minItems)&&s(L.maxItems)&&o(L.uniqueItems)&&d(L.contains)&&s(L.minContains)&&s(L.maxContains)}a(f,"TArray"),e.TArray=f;function m(L){return C(L,"AsyncIterator")&&L.type==="AsyncIterator"&&u(L.$id)&&se(L.items)}a(m,"TAsyncIterator"),e.TAsyncIterator=m;function h(L){return C(L,"BigInt")&&L.type==="bigint"&&u(L.$id)&&i(L.exclusiveMaximum)&&i(L.exclusiveMinimum)&&i(L.maximum)&&i(L.minimum)&&i(L.multipleOf)}a(h,"TBigInt"),e.TBigInt=h;function g(L){return C(L,"Boolean")&&L.type==="boolean"&&u(L.$id)}a(g,"TBoolean"),e.TBoolean=g;function _(L){return C(L,"Constructor")&&L.type==="constructor"&&u(L.$id)&&Jt.IsArray(L.parameters)&&L.parameters.every(Se=>se(Se))&&se(L.returns)}a(_,"TConstructor"),e.TConstructor=_;function v(L){return C(L,"Date")&&L.type==="Date"&&u(L.$id)&&s(L.exclusiveMaximumTimestamp)&&s(L.exclusiveMinimumTimestamp)&&s(L.maximumTimestamp)&&s(L.minimumTimestamp)&&s(L.multipleOfTimestamp)}a(v,"TDate"),e.TDate=v;function S(L){return C(L,"Function")&&L.type==="function"&&u(L.$id)&&Jt.IsArray(L.parameters)&&L.parameters.every(Se=>se(Se))&&se(L.returns)}a(S,"TFunction"),e.TFunction=S;function E(L){return C(L,"Integer")&&L.type==="integer"&&u(L.$id)&&s(L.exclusiveMaximum)&&s(L.exclusiveMinimum)&&s(L.maximum)&&s(L.minimum)&&s(L.multipleOf)}a(E,"TInteger"),e.TInteger=E;function b(L){return C(L,"Intersect")&&!(Jt.IsString(L.type)&&L.type!=="object")&&Jt.IsArray(L.allOf)&&L.allOf.every(Se=>se(Se)&&!De(Se))&&u(L.type)&&(o(L.unevaluatedProperties)||d(L.unevaluatedProperties))&&u(L.$id)}a(b,"TIntersect"),e.TIntersect=b;function A(L){return C(L,"Iterator")&&L.type==="Iterator"&&u(L.$id)&&se(L.items)}a(A,"TIterator"),e.TIterator=A;function C(L,Se){return T(L)&&L[_e.Kind]===Se}a(C,"TKindOf"),e.TKindOf=C;function T(L){return Jt.IsObject(L)&&_e.Kind in L&&Jt.IsString(L[_e.Kind])}a(T,"TKind"),e.TKind=T;function O(L){return I(L)&&Jt.IsString(L.const)}a(O,"TLiteralString"),e.TLiteralString=O;function P(L){return I(L)&&Jt.IsNumber(L.const)}a(P,"TLiteralNumber"),e.TLiteralNumber=P;function R(L){return I(L)&&Jt.IsBoolean(L.const)}a(R,"TLiteralBoolean"),e.TLiteralBoolean=R;function I(L){return C(L,"Literal")&&u(L.$id)&&(Jt.IsBoolean(L.const)||Jt.IsNumber(L.const)||Jt.IsString(L.const))}a(I,"TLiteral"),e.TLiteral=I;function D(L){return C(L,"Never")&&Jt.IsObject(L.not)&&Object.getOwnPropertyNames(L.not).length===0}a(D,"TNever"),e.TNever=D;function U(L){return C(L,"Not")&&se(L.not)}a(U,"TNot"),e.TNot=U;function te(L){return C(L,"Null")&&L.type==="null"&&u(L.$id)}a(te,"TNull"),e.TNull=te;function ve(L){return C(L,"Number")&&L.type==="number"&&u(L.$id)&&s(L.exclusiveMaximum)&&s(L.exclusiveMinimum)&&s(L.maximum)&&s(L.minimum)&&s(L.multipleOf)}a(ve,"TNumber"),e.TNumber=ve;function me(L){return C(L,"Object")&&L.type==="object"&&u(L.$id)&&Jt.IsObject(L.properties)&&n(L.additionalProperties)&&s(L.minProperties)&&s(L.maxProperties)&&Object.entries(L.properties).every(([Se,Le])=>r(Se)&&se(Le))}a(me,"TObject"),e.TObject=me;function he(L){return C(L,"Promise")&&L.type==="Promise"&&u(L.$id)&&se(L.item)}a(he,"TPromise"),e.TPromise=he;function Fe(L){return C(L,"Record")&&L.type==="object"&&u(L.$id)&&n(L.additionalProperties)&&Jt.IsObject(L.patternProperties)&&(Se=>{let Le=Object.getOwnPropertyNames(Se.patternProperties);return Le.length===1&&t(Le[0])&&Jt.IsObject(Se.patternProperties)&&se(Se.patternProperties[Le[0]])})(L)}a(Fe,"TRecord"),e.TRecord=Fe;function Oe(L){return Jt.IsObject(L)&&_e.Hint in L&&L[_e.Hint]==="Recursive"}a(Oe,"TRecursive"),e.TRecursive=Oe;function M(L){return C(L,"Ref")&&u(L.$id)&&Jt.IsString(L.$ref)}a(M,"TRef"),e.TRef=M;function Z(L){return C(L,"String")&&L.type==="string"&&u(L.$id)&&s(L.minLength)&&s(L.maxLength)&&l(L.pattern)&&c(L.format)}a(Z,"TString"),e.TString=Z;function fe(L){return C(L,"Symbol")&&L.type==="symbol"&&u(L.$id)}a(fe,"TSymbol"),e.TSymbol=fe;function B(L){return C(L,"TemplateLiteral")&&L.type==="string"&&Jt.IsString(L.pattern)&&L.pattern[0]==="^"&&L.pattern[L.pattern.length-1]==="$"}a(B,"TTemplateLiteral"),e.TTemplateLiteral=B;function ye(L){return C(L,"This")&&u(L.$id)&&Jt.IsString(L.$ref)}a(ye,"TThis"),e.TThis=ye;function De(L){return Jt.IsObject(L)&&_e.Transform in L}a(De,"TTransform"),e.TTransform=De;function $e(L){return C(L,"Tuple")&&L.type==="array"&&u(L.$id)&&Jt.IsNumber(L.minItems)&&Jt.IsNumber(L.maxItems)&&L.minItems===L.maxItems&&(Jt.IsUndefined(L.items)&&Jt.IsUndefined(L.additionalItems)&&L.minItems===0||Jt.IsArray(L.items)&&L.items.every(Se=>se(Se)))}a($e,"TTuple"),e.TTuple=$e;function gt(L){return C(L,"Undefined")&&L.type==="undefined"&&u(L.$id)}a(gt,"TUndefined"),e.TUndefined=gt;function ot(L){return F(L)&&L.anyOf.every(Se=>O(Se)||P(Se))}a(ot,"TUnionLiteral"),e.TUnionLiteral=ot;function F(L){return C(L,"Union")&&u(L.$id)&&Jt.IsObject(L)&&Jt.IsArray(L.anyOf)&&L.anyOf.every(Se=>se(Se))}a(F,"TUnion"),e.TUnion=F;function G(L){return C(L,"Uint8Array")&&L.type==="Uint8Array"&&u(L.$id)&&s(L.minByteLength)&&s(L.maxByteLength)}a(G,"TUint8Array"),e.TUint8Array=G;function $(L){return C(L,"Unknown")&&u(L.$id)}a($,"TUnknown"),e.TUnknown=$;function W(L){return C(L,"Unsafe")}a(W,"TUnsafe"),e.TUnsafe=W;function pe(L){return C(L,"Void")&&L.type==="void"&&u(L.$id)}a(pe,"TVoid"),e.TVoid=pe;function H(L){return Jt.IsObject(L)&&L[_e.Readonly]==="Readonly"}a(H,"TReadonly"),e.TReadonly=H;function de(L){return Jt.IsObject(L)&&L[_e.Optional]==="Optional"}a(de,"TOptional"),e.TOptional=de;function se(L){return Jt.IsObject(L)&&(p(L)||f(L)||g(L)||h(L)||m(L)||_(L)||v(L)||S(L)||E(L)||b(L)||A(L)||I(L)||D(L)||U(L)||te(L)||ve(L)||me(L)||he(L)||Fe(L)||M(L)||Z(L)||fe(L)||B(L)||ye(L)||$e(L)||gt(L)||F(L)||G(L)||$(L)||W(L)||pe(L)||T(L)&&_Oe.Has(L[_e.Kind]))}a(se,"TSchema"),e.TSchema=se})(Ee||(_e.TypeGuard=Ee={}));var ERt;(function(e){function t(r){return r[_e.Kind]==="Intersect"?r.allOf.every(n=>t(n)):r[_e.Kind]==="Union"?r.anyOf.some(n=>t(n)):r[_e.Kind]==="Undefined"?!0:r[_e.Kind]==="Not"?!t(r.not):!1}a(t,"Check"),e.Check=t})(ERt||(_e.ExtendsUndefined=ERt={}));var jJ=class extends hh{static{a(this,"TypeExtendsError")}};_e.TypeExtendsError=jJ;var at;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(at||(_e.TypeExtendsResult=at={}));var rC;(function(e){function t(N){return N===at.False?N:at.True}a(t,"IntoBooleanResult");function r(N){throw new jJ(N)}a(r,"Throw");function n(N){return Ee.TNever(N)||Ee.TIntersect(N)||Ee.TUnion(N)||Ee.TUnknown(N)||Ee.TAny(N)}a(n,"IsStructuralRight");function i(N,k){return Ee.TNever(k)?C(N,k):Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)?Mt(N,k):Ee.TUnknown(k)?Ur(N,k):Ee.TAny(k)?s(N,k):r("StructuralRight")}a(i,"StructuralRight");function s(N,k){return at.True}a(s,"TAnyRight");function o(N,k){return Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)&&k.anyOf.some(Ae=>Ee.TAny(Ae)||Ee.TUnknown(Ae))?at.True:Ee.TUnion(k)?at.Union:Ee.TUnknown(k)||Ee.TAny(k)?at.True:at.Union}a(o,"TAny");function u(N,k){return Ee.TUnknown(N)?at.False:Ee.TAny(N)?at.Union:Ee.TNever(N)?at.True:at.False}a(u,"TArrayRight");function l(N,k){return Ee.TObject(k)&&B(k)?at.True:n(k)?i(N,k):Ee.TArray(k)?t(J(N.items,k.items)):at.False}a(l,"TArray");function c(N,k){return n(k)?i(N,k):Ee.TAsyncIterator(k)?t(J(N.items,k.items)):at.False}a(c,"TAsyncIterator");function d(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TBigInt(k)?at.True:at.False}a(d,"TBigInt");function p(N,k){return Ee.TLiteral(N)&&Jt.IsBoolean(N.const)||Ee.TBoolean(N)?at.True:at.False}a(p,"TBooleanRight");function f(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TBoolean(k)?at.True:at.False}a(f,"TBoolean");function m(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TConstructor(k)?N.parameters.length>k.parameters.length?at.False:N.parameters.every((Ae,Me)=>t(J(k.parameters[Me],Ae))===at.True)?t(J(N.returns,k.returns)):at.False:at.False}a(m,"TConstructor");function h(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TDate(k)?at.True:at.False}a(h,"TDate");function g(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TFunction(k)?N.parameters.length>k.parameters.length?at.False:N.parameters.every((Ae,Me)=>t(J(k.parameters[Me],Ae))===at.True)?t(J(N.returns,k.returns)):at.False:at.False}a(g,"TFunction");function _(N,k){return Ee.TLiteral(N)&&Jt.IsNumber(N.const)||Ee.TNumber(N)||Ee.TInteger(N)?at.True:at.False}a(_,"TIntegerRight");function v(N,k){return Ee.TInteger(k)||Ee.TNumber(k)?at.True:n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):at.False}a(v,"TInteger");function S(N,k){return k.allOf.every(Ae=>J(N,Ae)===at.True)?at.True:at.False}a(S,"TIntersectRight");function E(N,k){return N.allOf.some(Ae=>J(Ae,k)===at.True)?at.True:at.False}a(E,"TIntersect");function b(N,k){return n(k)?i(N,k):Ee.TIterator(k)?t(J(N.items,k.items)):at.False}a(b,"TIterator");function A(N,k){return Ee.TLiteral(k)&&k.const===N.const?at.True:n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TString(k)?pe(N,k):Ee.TNumber(k)?I(N,k):Ee.TInteger(k)?_(N,k):Ee.TBoolean(k)?p(N,k):at.False}a(A,"TLiteral");function C(N,k){return at.False}a(C,"TNeverRight");function T(N,k){return at.True}a(T,"TNever");function O(N){let[k,Ae]=[N,0];for(;Ee.TNot(k);)k=k.not,Ae+=1;return Ae%2===0?k:_e.Type.Unknown()}a(O,"UnwrapTNot");function P(N,k){return Ee.TNot(N)?J(O(N),k):Ee.TNot(k)?J(N,O(k)):r("Invalid fallthrough for Not")}a(P,"TNot");function R(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TNull(k)?at.True:at.False}a(R,"TNull");function I(N,k){return Ee.TLiteralNumber(N)||Ee.TNumber(N)||Ee.TInteger(N)?at.True:at.False}a(I,"TNumberRight");function D(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TInteger(k)||Ee.TNumber(k)?at.True:at.False}a(D,"TNumber");function U(N,k){return Object.getOwnPropertyNames(N.properties).length===k}a(U,"IsObjectPropertyCount");function te(N){return B(N)}a(te,"IsObjectStringLike");function ve(N){return U(N,0)||U(N,1)&&"description"in N.properties&&Ee.TUnion(N.properties.description)&&N.properties.description.anyOf.length===2&&(Ee.TString(N.properties.description.anyOf[0])&&Ee.TUndefined(N.properties.description.anyOf[1])||Ee.TString(N.properties.description.anyOf[1])&&Ee.TUndefined(N.properties.description.anyOf[0]))}a(ve,"IsObjectSymbolLike");function me(N){return U(N,0)}a(me,"IsObjectNumberLike");function he(N){return U(N,0)}a(he,"IsObjectBooleanLike");function Fe(N){return U(N,0)}a(Fe,"IsObjectBigIntLike");function Oe(N){return U(N,0)}a(Oe,"IsObjectDateLike");function M(N){return B(N)}a(M,"IsObjectUint8ArrayLike");function Z(N){let k=_e.Type.Number();return U(N,0)||U(N,1)&&"length"in N.properties&&t(J(N.properties.length,k))===at.True}a(Z,"IsObjectFunctionLike");function fe(N){return U(N,0)}a(fe,"IsObjectConstructorLike");function B(N){let k=_e.Type.Number();return U(N,0)||U(N,1)&&"length"in N.properties&&t(J(N.properties.length,k))===at.True}a(B,"IsObjectArrayLike");function ye(N){let k=_e.Type.Function([_e.Type.Any()],_e.Type.Any());return U(N,0)||U(N,1)&&"then"in N.properties&&t(J(N.properties.then,k))===at.True}a(ye,"IsObjectPromiseLike");function De(N,k){return J(N,k)===at.False||Ee.TOptional(N)&&!Ee.TOptional(k)?at.False:at.True}a(De,"Property");function $e(N,k){return Ee.TUnknown(N)?at.False:Ee.TAny(N)?at.Union:Ee.TNever(N)||Ee.TLiteralString(N)&&te(k)||Ee.TLiteralNumber(N)&&me(k)||Ee.TLiteralBoolean(N)&&he(k)||Ee.TSymbol(N)&&ve(k)||Ee.TBigInt(N)&&Fe(k)||Ee.TString(N)&&te(k)||Ee.TSymbol(N)&&ve(k)||Ee.TNumber(N)&&me(k)||Ee.TInteger(N)&&me(k)||Ee.TBoolean(N)&&he(k)||Ee.TUint8Array(N)&&M(k)||Ee.TDate(N)&&Oe(k)||Ee.TConstructor(N)&&fe(k)||Ee.TFunction(N)&&Z(k)?at.True:Ee.TRecord(N)&&Ee.TString(F(N))?(()=>k[_e.Hint]==="Record"?at.True:at.False)():Ee.TRecord(N)&&Ee.TNumber(F(N))?(()=>U(k,0)?at.True:at.False)():at.False}a($e,"TObjectRight");function gt(N,k){return n(k)?i(N,k):Ee.TRecord(k)?$(N,k):Ee.TObject(k)?(()=>{for(let Ae of Object.getOwnPropertyNames(k.properties))if(!(Ae in N.properties)||De(N.properties[Ae],k.properties[Ae])===at.False)return at.False;return at.True})():at.False}a(gt,"TObject");function ot(N,k){return n(k)?i(N,k):Ee.TObject(k)&&ye(k)?at.True:Ee.TPromise(k)?t(J(N.item,k.item)):at.False}a(ot,"TPromise");function F(N){return _e.PatternNumberExact in N.patternProperties?_e.Type.Number():_e.PatternStringExact in N.patternProperties?_e.Type.String():r("Unknown record key pattern")}a(F,"RecordKey");function G(N){return _e.PatternNumberExact in N.patternProperties?N.patternProperties[_e.PatternNumberExact]:_e.PatternStringExact in N.patternProperties?N.patternProperties[_e.PatternStringExact]:r("Unable to get record value schema")}a(G,"RecordValue");function $(N,k){let[Ae,Me]=[F(k),G(k)];return Ee.TLiteralString(N)&&Ee.TNumber(Ae)&&t(J(N,Me))===at.True?at.True:Ee.TUint8Array(N)&&Ee.TNumber(Ae)||Ee.TString(N)&&Ee.TNumber(Ae)||Ee.TArray(N)&&Ee.TNumber(Ae)?J(N,Me):Ee.TObject(N)?(()=>{for(let et of Object.getOwnPropertyNames(N.properties))if(De(Me,N.properties[et])===at.False)return at.False;return at.True})():at.False}a($,"TRecordRight");function W(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?J(G(N),G(k)):at.False}a(W,"TRecord");function pe(N,k){return Ee.TLiteral(N)&&Jt.IsString(N.const)||Ee.TString(N)?at.True:at.False}a(pe,"TStringRight");function H(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TString(k)?at.True:at.False}a(H,"TString");function de(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TSymbol(k)?at.True:at.False}a(de,"TSymbol");function se(N,k){return Ee.TTemplateLiteral(N)?J(xy.Resolve(N),k):Ee.TTemplateLiteral(k)?J(N,xy.Resolve(k)):r("Invalid fallthrough for TemplateLiteral")}a(se,"TTemplateLiteral");function L(N,k){return Ee.TArray(k)&&N.items!==void 0&&N.items.every(Ae=>J(Ae,k.items)===at.True)}a(L,"IsArrayOfTuple");function Se(N,k){return Ee.TNever(N)?at.True:Ee.TUnknown(N)?at.False:Ee.TAny(N)?at.Union:at.False}a(Se,"TTupleRight");function Le(N,k){return n(k)?i(N,k):Ee.TObject(k)&&B(k)||Ee.TArray(k)&&L(N,k)?at.True:Ee.TTuple(k)?Jt.IsUndefined(N.items)&&!Jt.IsUndefined(k.items)||!Jt.IsUndefined(N.items)&&Jt.IsUndefined(k.items)?at.False:Jt.IsUndefined(N.items)&&!Jt.IsUndefined(k.items)||N.items.every((Ae,Me)=>J(Ae,k.items[Me])===at.True)?at.True:at.False:at.False}a(Le,"TTuple");function Ke(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TUint8Array(k)?at.True:at.False}a(Ke,"TUint8Array");function St(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TVoid(k)?j(N,k):Ee.TUndefined(k)?at.True:at.False}a(St,"TUndefined");function Mt(N,k){return k.anyOf.some(Ae=>J(N,Ae)===at.True)?at.True:at.False}a(Mt,"TUnionRight");function vr(N,k){return N.anyOf.every(Ae=>J(Ae,k)===at.True)?at.True:at.False}a(vr,"TUnion");function Ur(N,k){return at.True}a(Ur,"TUnknownRight");function Ve(N,k){return Ee.TNever(k)?C(N,k):Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)?Mt(N,k):Ee.TAny(k)?s(N,k):Ee.TString(k)?pe(N,k):Ee.TNumber(k)?I(N,k):Ee.TInteger(k)?_(N,k):Ee.TBoolean(k)?p(N,k):Ee.TArray(k)?u(N,k):Ee.TTuple(k)?Se(N,k):Ee.TObject(k)?$e(N,k):Ee.TUnknown(k)?at.True:at.False}a(Ve,"TUnknown");function j(N,k){return Ee.TUndefined(N)||Ee.TUndefined(N)?at.True:at.False}a(j,"VoidRight");function q(N,k){return Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)?Mt(N,k):Ee.TUnknown(k)?Ur(N,k):Ee.TAny(k)?s(N,k):Ee.TObject(k)?$e(N,k):Ee.TVoid(k)?at.True:at.False}a(q,"TVoid");function J(N,k){return Ee.TTemplateLiteral(N)||Ee.TTemplateLiteral(k)?se(N,k):Ee.TNot(N)||Ee.TNot(k)?P(N,k):Ee.TAny(N)?o(N,k):Ee.TArray(N)?l(N,k):Ee.TBigInt(N)?d(N,k):Ee.TBoolean(N)?f(N,k):Ee.TAsyncIterator(N)?c(N,k):Ee.TConstructor(N)?m(N,k):Ee.TDate(N)?h(N,k):Ee.TFunction(N)?g(N,k):Ee.TInteger(N)?v(N,k):Ee.TIntersect(N)?E(N,k):Ee.TIterator(N)?b(N,k):Ee.TLiteral(N)?A(N,k):Ee.TNever(N)?T(N,k):Ee.TNull(N)?R(N,k):Ee.TNumber(N)?D(N,k):Ee.TObject(N)?gt(N,k):Ee.TRecord(N)?W(N,k):Ee.TString(N)?H(N,k):Ee.TSymbol(N)?de(N,k):Ee.TTuple(N)?Le(N,k):Ee.TPromise(N)?ot(N,k):Ee.TUint8Array(N)?Ke(N,k):Ee.TUndefined(N)?St(N,k):Ee.TUnion(N)?vr(N,k):Ee.TUnknown(N)?Ve(N,k):Ee.TVoid(N)?q(N,k):r(`Unknown left type operand '${N[_e.Kind]}'`)}a(J,"Visit");function ae(N,k){return J(N,k)}a(ae,"Extends"),e.Extends=ae})(rC||(_e.TypeExtends=rC={}));var Rr;(function(e){function t(o){let u=Object.getOwnPropertyNames(o).reduce((c,d)=>({...c,[d]:n(o[d])}),{}),l=Object.getOwnPropertySymbols(o).reduce((c,d)=>({...c,[d]:n(o[d])}),{});return{...u,...l}}a(t,"ObjectType");function r(o){return o.map(u=>n(u))}a(r,"ArrayType");function n(o){return Jt.IsArray(o)?r(o):Jt.IsObject(o)?t(o):o}a(n,"Visit");function i(o){return o.map(u=>s(u))}a(i,"Rest"),e.Rest=i;function s(o,u={}){return{...n(o),...u}}a(s,"Type"),e.Type=s})(Rr||(_e.TypeClone=Rr={}));var EOe;(function(e){function t(m){return m.map(h=>{let{[_e.Optional]:g,..._}=Rr.Type(h);return _})}a(t,"OptionalUnwrap");function r(m){return m.every(h=>Ee.TOptional(h))}a(r,"IsIntersectOptional");function n(m){return m.some(h=>Ee.TOptional(h))}a(n,"IsUnionOptional");function i(m){return r(m.allOf)?_e.Type.Optional(_e.Type.Intersect(t(m.allOf))):m}a(i,"ResolveIntersect");function s(m){return n(m.anyOf)?_e.Type.Optional(_e.Type.Union(t(m.anyOf))):m}a(s,"ResolveUnion");function o(m){return m[_e.Kind]==="Intersect"?i(m):m[_e.Kind]==="Union"?s(m):m}a(o,"ResolveOptional");function u(m,h){let g=m.allOf.reduce((_,v)=>{let S=p(v,h);return S[_e.Kind]==="Never"?_:[..._,S]},[]);return o(_e.Type.Intersect(g))}a(u,"TIntersect");function l(m,h){let g=m.anyOf.map(_=>p(_,h));return o(_e.Type.Union(g))}a(l,"TUnion");function c(m,h){let g=m.properties[h];return Jt.IsUndefined(g)?_e.Type.Never():_e.Type.Union([g])}a(c,"TObject");function d(m,h){let g=m.items;if(Jt.IsUndefined(g))return _e.Type.Never();let _=g[h];return Jt.IsUndefined(_)?_e.Type.Never():_}a(d,"TTuple");function p(m,h){return m[_e.Kind]==="Intersect"?u(m,h):m[_e.Kind]==="Union"?l(m,h):m[_e.Kind]==="Object"?c(m,h):m[_e.Kind]==="Tuple"?d(m,h):_e.Type.Never()}a(p,"Visit");function f(m,h,g={}){let _=h.map(v=>p(m,v.toString()));return o(_e.Type.Union(_,g))}a(f,"Resolve"),e.Resolve=f})(EOe||(_e.IndexedAccessor=EOe={}));var _P;(function(e){function t(d){let[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toLowerCase()}${f}`}a(t,"Uncapitalize");function r(d){let[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toUpperCase()}${f}`}a(r,"Capitalize");function n(d){return d.toUpperCase()}a(n,"Uppercase");function i(d){return d.toLowerCase()}a(i,"Lowercase");function s(d,p){let f=EP.ParseExact(d.pattern);if(!bP.Check(f))return{...d,pattern:o(d.pattern,p)};let g=[...SP.Generate(f)].map(S=>_e.Type.Literal(S)),_=u(g,p),v=_e.Type.Union(_);return _e.Type.TemplateLiteral([v])}a(s,"IntrinsicTemplateLiteral");function o(d,p){return typeof d=="string"?p==="Uncapitalize"?t(d):p==="Capitalize"?r(d):p==="Uppercase"?n(d):p==="Lowercase"?i(d):d:d.toString()}a(o,"IntrinsicLiteral");function u(d,p){if(d.length===0)return[];let[f,...m]=d;return[c(f,p),...u(m,p)]}a(u,"IntrinsicRest");function l(d,p){return Ee.TTemplateLiteral(d)?s(d,p):Ee.TUnion(d)?_e.Type.Union(u(d.anyOf,p)):Ee.TLiteral(d)?_e.Type.Literal(o(d.const,p)):d}a(l,"Visit");function c(d,p){return l(d,p)}a(c,"Map"),e.Map=c})(_P||(_e.Intrinsic=_P={}));var vP;(function(e){function t(o,u){return _e.Type.Intersect(o.allOf.map(l=>i(l,u)),{...o})}a(t,"TIntersect");function r(o,u){return _e.Type.Union(o.anyOf.map(l=>i(l,u)),{...o})}a(r,"TUnion");function n(o,u){return u(o)}a(n,"TObject");function i(o,u){return o[_e.Kind]==="Intersect"?t(o,u):o[_e.Kind]==="Union"?r(o,u):o[_e.Kind]==="Object"?n(o,u):o}a(i,"Visit");function s(o,u,l){return{...i(Rr.Type(o),u),...l}}a(s,"Map"),e.Map=s})(vP||(_e.ObjectMap=vP={}));var GJ;(function(e){function t(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}a(t,"UnwrapPattern");function r(c,d){return c.allOf.reduce((p,f)=>[...p,...o(f,d)],[])}a(r,"TIntersect");function n(c,d){let p=c.anyOf.map(f=>o(f,d));return[...p.reduce((f,m)=>m.map(h=>p.every(g=>g.includes(h))?f.add(h):f)[0],new Set)]}a(n,"TUnion");function i(c,d){return Object.getOwnPropertyNames(c.properties)}a(i,"TObject");function s(c,d){return d.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}a(s,"TRecord");function o(c,d){return Ee.TIntersect(c)?r(c,d):Ee.TUnion(c)?n(c,d):Ee.TObject(c)?i(c,d):Ee.TRecord(c)?s(c,d):[]}a(o,"Visit");function u(c,d){return[...new Set(o(c,d))]}a(u,"ResolveKeys"),e.ResolveKeys=u;function l(c){return`^(${u(c,{includePatterns:!0}).map(f=>`(${t(f)})`).join("|")})$`}a(l,"ResolvePattern"),e.ResolvePattern=l})(GJ||(_e.KeyResolver=GJ={}));var HJ=class extends hh{static{a(this,"KeyArrayResolverError")}};_e.KeyArrayResolverError=HJ;var UF;(function(e){function t(r){return Array.isArray(r)?r:Ee.TUnionLiteral(r)?r.anyOf.map(n=>n.const.toString()):Ee.TLiteral(r)?[r.const]:Ee.TTemplateLiteral(r)?(()=>{let n=EP.ParseExact(r.pattern);if(!bP.Check(n))throw new HJ("Cannot resolve keys from infinite template expression");return[...SP.Generate(n)]})():[]}a(t,"Resolve"),e.Resolve=t})(UF||(_e.KeyArrayResolver=UF={}));var bOe;(function(e){function*t(n){for(let i of n.anyOf)i[_e.Kind]==="Union"?yield*t(i):yield i}a(t,"TUnion");function r(n){return _e.Type.Union([...t(n)],{...n})}a(r,"Resolve"),e.Resolve=r})(bOe||(_e.UnionResolver=bOe={}));var VJ=class extends hh{static{a(this,"TemplateLiteralPatternError")}};_e.TemplateLiteralPatternError=VJ;var zJ;(function(e){function t(s){throw new VJ(s)}a(t,"Throw");function r(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(r,"Escape");function n(s,o){return Ee.TTemplateLiteral(s)?s.pattern.slice(1,s.pattern.length-1):Ee.TUnion(s)?`(${s.anyOf.map(u=>n(u,o)).join("|")})`:Ee.TNumber(s)?`${o}${_e.PatternNumber}`:Ee.TInteger(s)?`${o}${_e.PatternNumber}`:Ee.TBigInt(s)?`${o}${_e.PatternNumber}`:Ee.TString(s)?`${o}${_e.PatternString}`:Ee.TLiteral(s)?`${o}${r(s.const.toString())}`:Ee.TBoolean(s)?`${o}${_e.PatternBoolean}`:t(`Unexpected Kind '${s[_e.Kind]}'`)}a(n,"Visit");function i(s){return`^${s.map(o=>n(o,"")).join("")}$`}a(i,"Create"),e.Create=i})(zJ||(_e.TemplateLiteralPattern=zJ={}));var xy;(function(e){function t(r){let n=EP.ParseExact(r.pattern);if(!bP.Check(n))return _e.Type.String();let i=[...SP.Generate(n)].map(s=>_e.Type.Literal(s));return _e.Type.Union(i)}a(t,"Resolve"),e.Resolve=t})(xy||(_e.TemplateLiteralResolver=xy={}));var $F=class extends hh{static{a(this,"TemplateLiteralParserError")}};_e.TemplateLiteralParserError=$F;var EP;(function(e){function t(m,h,g){return m[h]===g&&m.charCodeAt(h-1)!==92}a(t,"IsNonEscaped");function r(m,h){return t(m,h,"(")}a(r,"IsOpenParen");function n(m,h){return t(m,h,")")}a(n,"IsCloseParen");function i(m,h){return t(m,h,"|")}a(i,"IsSeparator");function s(m){if(!(r(m,0)&&n(m,m.length-1)))return!1;let h=0;for(let g=0;g<m.length;g++)if(r(m,g)&&(h+=1),n(m,g)&&(h-=1),h===0&&g!==m.length-1)return!1;return!0}a(s,"IsGroup");function o(m){return m.slice(1,m.length-1)}a(o,"InGroup");function u(m){let h=0;for(let g=0;g<m.length;g++)if(r(m,g)&&(h+=1),n(m,g)&&(h-=1),i(m,g)&&h===0)return!0;return!1}a(u,"IsPrecedenceOr");function l(m){for(let h=0;h<m.length;h++)if(r(m,h))return!0;return!1}a(l,"IsPrecedenceAnd");function c(m){let[h,g]=[0,0],_=[];for(let S=0;S<m.length;S++)if(r(m,S)&&(h+=1),n(m,S)&&(h-=1),i(m,S)&&h===0){let E=m.slice(g,S);E.length>0&&_.push(p(E)),g=S+1}let v=m.slice(g);return v.length>0&&_.push(p(v)),_.length===0?{type:"const",const:""}:_.length===1?_[0]:{type:"or",expr:_}}a(c,"Or");function d(m){function h(v,S){if(!r(v,S))throw new $F("TemplateLiteralParser: Index must point to open parens");let E=0;for(let b=S;b<v.length;b++)if(r(v,b)&&(E+=1),n(v,b)&&(E-=1),E===0)return[S,b];throw new $F("TemplateLiteralParser: Unclosed group parens in expression")}a(h,"Group");function g(v,S){for(let E=S;E<v.length;E++)if(r(v,E))return[S,E];return[S,v.length]}a(g,"Range");let _=[];for(let v=0;v<m.length;v++)if(r(m,v)){let[S,E]=h(m,v),b=m.slice(S,E+1);_.push(p(b)),v=E}else{let[S,E]=g(m,v),b=m.slice(S,E);b.length>0&&_.push(p(b)),v=E-1}return _.length===0?{type:"const",const:""}:_.length===1?_[0]:{type:"and",expr:_}}a(d,"And");function p(m){return s(m)?p(o(m)):u(m)?c(m):l(m)?d(m):{type:"const",const:m}}a(p,"Parse"),e.Parse=p;function f(m){return p(m.slice(1,m.length-1))}a(f,"ParseExact"),e.ParseExact=f})(EP||(_e.TemplateLiteralParser=EP={}));var KJ=class extends hh{static{a(this,"TemplateLiteralFiniteError")}};_e.TemplateLiteralFiniteError=KJ;var bP;(function(e){function t(o){throw new KJ(o)}a(t,"Throw");function r(o){return o.type==="or"&&o.expr.length===2&&o.expr[0].type==="const"&&o.expr[0].const==="0"&&o.expr[1].type==="const"&&o.expr[1].const==="[1-9][0-9]*"}a(r,"IsNumber");function n(o){return o.type==="or"&&o.expr.length===2&&o.expr[0].type==="const"&&o.expr[0].const==="true"&&o.expr[1].type==="const"&&o.expr[1].const==="false"}a(n,"IsBoolean");function i(o){return o.type==="const"&&o.const===".*"}a(i,"IsString");function s(o){return n(o)?!0:r(o)||i(o)?!1:o.type==="and"?o.expr.every(u=>s(u)):o.type==="or"?o.expr.every(u=>s(u)):o.type==="const"?!0:t("Unknown expression type")}a(s,"Check"),e.Check=s})(bP||(_e.TemplateLiteralFinite=bP={}));var WJ=class extends hh{static{a(this,"TemplateLiteralGeneratorError")}};_e.TemplateLiteralGeneratorError=WJ;var SP;(function(e){function*t(o){if(o.length===1)return yield*o[0];for(let u of o[0])for(let l of t(o.slice(1)))yield`${u}${l}`}a(t,"Reduce");function*r(o){return yield*t(o.expr.map(u=>[...s(u)]))}a(r,"And");function*n(o){for(let u of o.expr)yield*s(u)}a(n,"Or");function*i(o){return yield o.const}a(i,"Const");function*s(o){return o.type==="and"?yield*r(o):o.type==="or"?yield*n(o):o.type==="const"?yield*i(o):(()=>{throw new WJ("Unknown expression")})()}a(s,"Generate"),e.Generate=s})(SP||(_e.TemplateLiteralGenerator=SP={}));var SOe;(function(e){function*t(s){let o=s.trim().replace(/"|'/g,"");return o==="boolean"?yield _e.Type.Boolean():o==="number"?yield _e.Type.Number():o==="bigint"?yield _e.Type.BigInt():o==="string"?yield _e.Type.String():yield(()=>{let u=o.split("|").map(l=>_e.Type.Literal(l.trim()));return u.length===0?_e.Type.Never():u.length===1?u[0]:_e.Type.Union(u)})()}a(t,"ParseUnion");function*r(s){if(s[1]!=="{"){let o=_e.Type.Literal("$"),u=n(s.slice(1));return yield*[o,...u]}for(let o=2;o<s.length;o++)if(s[o]==="}"){let u=t(s.slice(2,o)),l=n(s.slice(o+1));return yield*[...u,...l]}yield _e.Type.Literal(s)}a(r,"ParseTerminal");function*n(s){for(let o=0;o<s.length;o++)if(s[o]==="$"){let u=_e.Type.Literal(s.slice(0,o)),l=r(s.slice(o));return yield*[u,...l]}yield _e.Type.Literal(s)}a(n,"ParseLiteral");function i(s){return[...n(s)]}a(i,"Parse"),e.Parse=i})(SOe||(_e.TemplateLiteralDslParser=SOe={}));var YJ=class{static{a(this,"TransformDecodeBuilder")}constructor(t){this.schema=t}Decode(t){return new XJ(this.schema,t)}};_e.TransformDecodeBuilder=YJ;var XJ=class{static{a(this,"TransformEncodeBuilder")}constructor(t,r){this.schema=t,this.decode=r}Encode(t){let r=Rr.Type(this.schema);return Ee.TTransform(r)?(()=>{let s={Encode:a(o=>r[_e.Transform].Encode(t(o)),"Encode"),Decode:a(o=>this.decode(r[_e.Transform].Decode(o)),"Decode")};return{...r,[_e.Transform]:s}})():(()=>{let n={Decode:this.decode,Encode:t};return{...r,[_e.Transform]:n}})()}};_e.TransformEncodeBuilder=XJ;var dOn=0,JJ=class extends hh{static{a(this,"TypeBuilderError")}};_e.TypeBuilderError=JJ;var QJ=class{static{a(this,"TypeBuilder")}Create(t){return t}Throw(t){throw new JJ(t)}Discard(t,r){let{[r]:n,...i}=t;return i}Strict(t){return JSON.parse(JSON.stringify(t))}};_e.TypeBuilder=QJ;var jF=class extends QJ{static{a(this,"JsonTypeBuilder")}ReadonlyOptional(t){return this.Readonly(this.Optional(t))}Readonly(t){return{...Rr.Type(t),[_e.Readonly]:"Readonly"}}Optional(t){return{...Rr.Type(t),[_e.Optional]:"Optional"}}Any(t={}){return this.Create({...t,[_e.Kind]:"Any"})}Array(t,r={}){return this.Create({...r,[_e.Kind]:"Array",type:"array",items:Rr.Type(t)})}Boolean(t={}){return this.Create({...t,[_e.Kind]:"Boolean",type:"boolean"})}Capitalize(t,r={}){return{..._P.Map(Rr.Type(t),"Capitalize"),...r}}Composite(t,r){let n=_e.Type.Intersect(t,{}),s=GJ.ResolveKeys(n,{includePatterns:!1}).reduce((o,u)=>({...o,[u]:_e.Type.Index(n,[u])}),{});return _e.Type.Object(s,r)}Enum(t,r={}){let i=Object.getOwnPropertyNames(t).filter(s=>isNaN(s)).map(s=>t[s]).map(s=>Jt.IsString(s)?{[_e.Kind]:"Literal",type:"string",const:s}:{[_e.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[_e.Kind]:"Union",anyOf:i})}Extends(t,r,n,i,s={}){switch(rC.Extends(t,r)){case at.Union:return this.Union([Rr.Type(n,s),Rr.Type(i,s)]);case at.True:return Rr.Type(n,s);case at.False:return Rr.Type(i,s)}}Exclude(t,r,n={}){return Ee.TTemplateLiteral(t)?this.Exclude(xy.Resolve(t),r,n):Ee.TTemplateLiteral(r)?this.Exclude(t,xy.Resolve(r),n):Ee.TUnion(t)?(()=>{let i=t.anyOf.filter(s=>rC.Extends(s,r)===at.False);return i.length===1?Rr.Type(i[0],n):this.Union(i,n)})():rC.Extends(t,r)!==at.False?this.Never(n):Rr.Type(t,n)}Extract(t,r,n={}){return Ee.TTemplateLiteral(t)?this.Extract(xy.Resolve(t),r,n):Ee.TTemplateLiteral(r)?this.Extract(t,xy.Resolve(r),n):Ee.TUnion(t)?(()=>{let i=t.anyOf.filter(s=>rC.Extends(s,r)!==at.False);return i.length===1?Rr.Type(i[0],n):this.Union(i,n)})():rC.Extends(t,r)!==at.False?Rr.Type(t,n):this.Never(n)}Index(t,r,n={}){return Ee.TArray(t)&&Ee.TNumber(r)?(()=>Rr.Type(t.items,n))():Ee.TTuple(t)&&Ee.TNumber(r)?(()=>{let s=(Jt.IsUndefined(t.items)?[]:t.items).map(o=>Rr.Type(o));return this.Union(s,n)})():(()=>{let i=UF.Resolve(r),s=Rr.Type(t);return EOe.Resolve(s,i,n)})()}Integer(t={}){return this.Create({...t,[_e.Kind]:"Integer",type:"integer"})}Intersect(t,r={}){if(t.length===0)return _e.Type.Never();if(t.length===1)return Rr.Type(t[0],r);t.some(o=>Ee.TTransform(o))&&this.Throw("Cannot intersect transform types");let n=t.every(o=>Ee.TObject(o)),i=Rr.Rest(t),s=Ee.TSchema(r.unevaluatedProperties)?{unevaluatedProperties:Rr.Type(r.unevaluatedProperties)}:{};return r.unevaluatedProperties===!1||Ee.TSchema(r.unevaluatedProperties)||n?this.Create({...r,...s,[_e.Kind]:"Intersect",type:"object",allOf:i}):this.Create({...r,...s,[_e.Kind]:"Intersect",allOf:i})}KeyOf(t,r={}){return Ee.TRecord(t)?(()=>{let n=Object.getOwnPropertyNames(t.patternProperties)[0];return n===_e.PatternNumberExact?this.Number(r):n===_e.PatternStringExact?this.String(r):this.Throw("Unable to resolve key type from Record key pattern")})():Ee.TTuple(t)?(()=>{let i=(Jt.IsUndefined(t.items)?[]:t.items).map((s,o)=>_e.Type.Literal(o.toString()));return this.Union(i,r)})():Ee.TArray(t)?(()=>this.Number(r))():(()=>{let n=GJ.ResolveKeys(t,{includePatterns:!1});if(n.length===0)return this.Never(r);let i=n.map(s=>this.Literal(s));return this.Union(i,r)})()}Literal(t,r={}){return this.Create({...r,[_e.Kind]:"Literal",const:t,type:typeof t})}Lowercase(t,r={}){return{..._P.Map(Rr.Type(t),"Lowercase"),...r}}Never(t={}){return this.Create({...t,[_e.Kind]:"Never",not:{}})}Not(t,r){return this.Create({...r,[_e.Kind]:"Not",not:Rr.Type(t)})}Null(t={}){return this.Create({...t,[_e.Kind]:"Null",type:"null"})}Number(t={}){return this.Create({...t,[_e.Kind]:"Number",type:"number"})}Object(t,r={}){let n=Object.getOwnPropertyNames(t),i=n.filter(l=>Ee.TOptional(t[l])),s=n.filter(l=>!i.includes(l)),o=Ee.TSchema(r.additionalProperties)?{additionalProperties:Rr.Type(r.additionalProperties)}:{},u=n.reduce((l,c)=>({...l,[c]:Rr.Type(t[c])}),{});return s.length>0?this.Create({...r,...o,[_e.Kind]:"Object",type:"object",properties:u,required:s}):this.Create({...r,...o,[_e.Kind]:"Object",type:"object",properties:u})}Omit(t,r,n={}){let i=UF.Resolve(r);return vP.Map(this.Discard(Rr.Type(t),_e.Transform),s=>{Jt.IsArray(s.required)&&(s.required=s.required.filter(o=>!i.includes(o)),s.required.length===0&&delete s.required);for(let o of Object.getOwnPropertyNames(s.properties))i.includes(o)&&delete s.properties[o];return this.Create(s)},n)}Partial(t,r={}){return vP.Map(this.Discard(Rr.Type(t),_e.Transform),n=>{let i=Object.getOwnPropertyNames(n.properties).reduce((s,o)=>({...s,[o]:this.Optional(n.properties[o])}),{});return this.Object(i,this.Discard(n,"required"))},r)}Pick(t,r,n={}){let i=UF.Resolve(r);return vP.Map(this.Discard(Rr.Type(t),_e.Transform),s=>{Jt.IsArray(s.required)&&(s.required=s.required.filter(o=>i.includes(o)),s.required.length===0&&delete s.required);for(let o of Object.getOwnPropertyNames(s.properties))i.includes(o)||delete s.properties[o];return this.Create(s)},n)}Record(t,r,n={}){return Ee.TTemplateLiteral(t)?(()=>{let i=EP.ParseExact(t.pattern);return bP.Check(i)?this.Object([...SP.Generate(i)].reduce((s,o)=>({...s,[o]:Rr.Type(r)}),{}),n):this.Create({...n,[_e.Kind]:"Record",type:"object",patternProperties:{[t.pattern]:Rr.Type(r)}})})():Ee.TUnion(t)?(()=>{let i=bOe.Resolve(t);if(Ee.TUnionLiteral(i)){let s=i.anyOf.reduce((o,u)=>({...o,[u.const]:Rr.Type(r)}),{});return this.Object(s,{...n,[_e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():Ee.TLiteral(t)?(()=>Jt.IsString(t.const)||Jt.IsNumber(t.const)?this.Object({[t.const]:Rr.Type(r)},n):this.Throw("Record key of type literal is not of type string or number"))():Ee.TInteger(t)||Ee.TNumber(t)?(()=>this.Create({...n,[_e.Kind]:"Record",type:"object",patternProperties:{[_e.PatternNumberExact]:Rr.Type(r)}}))():Ee.TString(t)?(()=>{let i=Jt.IsUndefined(t.pattern)?_e.PatternStringExact:t.pattern;return this.Create({...n,[_e.Kind]:"Record",type:"object",patternProperties:{[i]:Rr.Type(r)}})})():this.Never()}Recursive(t,r={}){Jt.IsUndefined(r.$id)&&(r.$id=`T${dOn++}`);let n=t({[_e.Kind]:"This",$ref:`${r.$id}`});return n.$id=r.$id,this.Create({...r,[_e.Hint]:"Recursive",...n})}Ref(t,r={}){return Jt.IsString(t)?this.Create({...r,[_e.Kind]:"Ref",$ref:t}):(Jt.IsUndefined(t.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...r,[_e.Kind]:"Ref",$ref:t.$id}))}Required(t,r={}){return vP.Map(this.Discard(Rr.Type(t),_e.Transform),n=>{let i=Object.getOwnPropertyNames(n.properties).reduce((s,o)=>({...s,[o]:this.Discard(n.properties[o],_e.Optional)}),{});return this.Object(i,n)},r)}Rest(t){return Ee.TTuple(t)&&!Jt.IsUndefined(t.items)?Rr.Rest(t.items):Ee.TIntersect(t)?Rr.Rest(t.allOf):Ee.TUnion(t)?Rr.Rest(t.anyOf):[]}String(t={}){return this.Create({...t,[_e.Kind]:"String",type:"string"})}TemplateLiteral(t,r={}){let n=Jt.IsString(t)?zJ.Create(SOe.Parse(t)):zJ.Create(t);return this.Create({...r,[_e.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(t){return new YJ(t)}Tuple(t,r={}){let[n,i,s]=[!1,t.length,t.length],o=Rr.Rest(t),u=t.length>0?{...r,[_e.Kind]:"Tuple",type:"array",items:o,additionalItems:n,minItems:i,maxItems:s}:{...r,[_e.Kind]:"Tuple",type:"array",minItems:i,maxItems:s};return this.Create(u)}Uncapitalize(t,r={}){return{..._P.Map(Rr.Type(t),"Uncapitalize"),...r}}Union(t,r={}){return Ee.TTemplateLiteral(t)?xy.Resolve(t):(()=>{let n=t;if(n.length===0)return this.Never(r);if(n.length===1)return this.Create(Rr.Type(n[0],r));let i=Rr.Rest(n);return this.Create({...r,[_e.Kind]:"Union",anyOf:i})})()}Unknown(t={}){return this.Create({...t,[_e.Kind]:"Unknown"})}Unsafe(t={}){return this.Create({...t,[_e.Kind]:t[_e.Kind]||"Unsafe"})}Uppercase(t,r={}){return{..._P.Map(Rr.Type(t),"Uppercase"),...r}}};_e.JsonTypeBuilder=jF;var ZJ=class extends jF{static{a(this,"JavaScriptTypeBuilder")}AsyncIterator(t,r={}){return this.Create({...r,[_e.Kind]:"AsyncIterator",type:"AsyncIterator",items:Rr.Type(t)})}Awaited(t,r={}){let n=a(i=>i.length>0?(()=>{let[s,...o]=i;return[this.Awaited(s),...n(o)]})():i,"Unwrap");return Ee.TIntersect(t)?_e.Type.Intersect(n(t.allOf)):Ee.TUnion(t)?_e.Type.Union(n(t.anyOf)):Ee.TPromise(t)?this.Awaited(t.item):Rr.Type(t,r)}BigInt(t={}){return this.Create({...t,[_e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(t,r={}){return this.Tuple([...t.parameters],{...r})}Constructor(t,r,n){let[i,s]=[Rr.Rest(t),Rr.Type(r)];return this.Create({...n,[_e.Kind]:"Constructor",type:"constructor",parameters:i,returns:s})}Date(t={}){return this.Create({...t,[_e.Kind]:"Date",type:"Date"})}Function(t,r,n){let[i,s]=[Rr.Rest(t),Rr.Type(r)];return this.Create({...n,[_e.Kind]:"Function",type:"function",parameters:i,returns:s})}InstanceType(t,r={}){return Rr.Type(t.returns,r)}Iterator(t,r={}){return this.Create({...r,[_e.Kind]:"Iterator",type:"Iterator",items:Rr.Type(t)})}Parameters(t,r={}){return this.Tuple(t.parameters,{...r})}Promise(t,r={}){return this.Create({...r,[_e.Kind]:"Promise",type:"Promise",item:Rr.Type(t)})}RegExp(t,r={}){let n=Jt.IsString(t)?t:t.source;return this.Create({...r,[_e.Kind]:"String",type:"string",pattern:n})}RegEx(t,r={}){return this.RegExp(t,r)}ReturnType(t,r={}){return Rr.Type(t.returns,r)}Symbol(t){return this.Create({...t,[_e.Kind]:"Symbol",type:"symbol"})}Undefined(t={}){return this.Create({...t,[_e.Kind]:"Undefined",type:"undefined"})}Uint8Array(t={}){return this.Create({...t,[_e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(t={}){return this.Create({...t,[_e.Kind]:"Void",type:"void"})}};_e.JavaScriptTypeBuilder=ZJ;_e.JsonType=new jF;_e.Type=new ZJ});var SRt=y(eQ=>{"use strict";Object.defineProperty(eQ,"__esModule",{value:!0});eQ.CustomTypeBuilder=void 0;var GF=bRt(),AOe=class extends GF.TypeBuilder{static{a(this,"CustomTypeBuilder")}static Date(){return GF.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(t){return GF.Type.Union([t,GF.Type.Null()])}static StringEnum(t){return GF.Type.Unsafe({type:"string",enum:t})}};eQ.CustomTypeBuilder=AOe});var _n=y(ht=>{"use strict";var ARt=ht&&ht.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),pOn=ht&&ht.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),COe=ht&&ht.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ARt(t,e,r);return pOn(t,e),t},Ry=ht&&ht.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ARt(t,e,r)};Object.defineProperty(ht,"__esModule",{value:!0});ht.getRequiredEnvVar=ht.env=ht.EnvironmentalVariableRequiredError=ht.xfs=ht.RouteValidator=ht.JsonValidator=ht.TenantService=ht.OpenFGAService=ht.MeteringService=ht.DevApiService=ht.getContentApiStorageTarballPath=ht.contentApiTarballFileName=ht.ContentApiService=ht.AuthApiService=ht.getServiceAccountIdToken=ht.createApiKeyServiceClient=ht.ApiKeyService=ht.RouteVersions=ht.startsWithReservedKeyword=ht.conditionallyUploadToGCPStorageDevPortalBucket=ht.logger=ht.createNewLogger=ht.graphQL=ht.CloudStorage=ht.ApiServer=ht.featureFlagsPlugin=ht.ensureZuploUserPlugin=ht.ensureZuploAdminPlugin=ht.apiKeyAuthPlugin=ht.errorHandler=ht.DeploymentLogState=ht.signString=ht.FeatureFlags=ht.VALID_COMPATIBILITY_DATES=ht.DEFAULT_COMPATIBILITY_DATE=ht.COMPATIBILITY_FLAG_MAPPINGS=ht.WARNING_STATUS=ht.WARNING_SEVERITY=ht.GOOD_STATUS=ht.FAILURE_STATUS=ht.ERROR_SEVERITY=ht.BuildIssueError=ht.hasBlockedNotifications=ht.getBuildFlags=ht.CommonAuth=void 0;var wOe=COe(sc());ht.env=wOe.default;Object.defineProperty(ht,"EnvironmentalVariableRequiredError",{enumerable:!0,get:function(){return wOe.EnvironmentalVariableRequiredError}});Object.defineProperty(ht,"getRequiredEnvVar",{enumerable:!0,get:function(){return wOe.getRequiredEnvVar}});Ry(Vc(),ht);var fOn=Dce();Object.defineProperty(ht,"CommonAuth",{enumerable:!0,get:function(){return fOn.CommonAuth}});var CRt=DGe();Object.defineProperty(ht,"getBuildFlags",{enumerable:!0,get:function(){return CRt.getBuildFlags}});Object.defineProperty(ht,"hasBlockedNotifications",{enumerable:!0,get:function(){return CRt.hasBlockedNotifications}});var AP=Fce();Object.defineProperty(ht,"BuildIssueError",{enumerable:!0,get:function(){return AP.BuildIssueError}});Object.defineProperty(ht,"ERROR_SEVERITY",{enumerable:!0,get:function(){return AP.ERROR_SEVERITY}});Object.defineProperty(ht,"FAILURE_STATUS",{enumerable:!0,get:function(){return AP.FAILURE_STATUS}});Object.defineProperty(ht,"GOOD_STATUS",{enumerable:!0,get:function(){return AP.GOOD_STATUS}});Object.defineProperty(ht,"WARNING_SEVERITY",{enumerable:!0,get:function(){return AP.WARNING_SEVERITY}});Object.defineProperty(ht,"WARNING_STATUS",{enumerable:!0,get:function(){return AP.WARNING_STATUS}});var wRt=LGe();Object.defineProperty(ht,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:!0,get:function(){return wRt.COMPATIBILITY_FLAG_MAPPINGS}});Object.defineProperty(ht,"DEFAULT_COMPATIBILITY_DATE",{enumerable:!0,get:function(){return wRt.DEFAULT_COMPATIBILITY_DATE}});var mOn=BGe();Object.defineProperty(ht,"VALID_COMPATIBILITY_DATES",{enumerable:!0,get:function(){return mOn.VALID_COMPATIBILITY_DATES}});var hOn=MGe();Object.defineProperty(ht,"FeatureFlags",{enumerable:!0,get:function(){return hOn.FeatureFlags}});var gOn=qGe();Object.defineProperty(ht,"signString",{enumerable:!0,get:function(){return gOn.signString}});Ry(UGe(),ht);var yOn=Mce();Object.defineProperty(ht,"DeploymentLogState",{enumerable:!0,get:function(){return yOn.DeploymentLogState}});Ry(WGe(),ht);Ry(qce(),ht);var _On=Uce();Object.defineProperty(ht,"errorHandler",{enumerable:!0,get:function(){return _On.errorHandler}});var tQ=Vce();Object.defineProperty(ht,"apiKeyAuthPlugin",{enumerable:!0,get:function(){return tQ.apiKeyAuthPlugin}});Object.defineProperty(ht,"ensureZuploAdminPlugin",{enumerable:!0,get:function(){return tQ.ensureZuploAdminPlugin}});Object.defineProperty(ht,"ensureZuploUserPlugin",{enumerable:!0,get:function(){return tQ.ensureZuploUserPlugin}});Object.defineProperty(ht,"featureFlagsPlugin",{enumerable:!0,get:function(){return tQ.featureFlagsPlugin}});var vOn=lft();Object.defineProperty(ht,"ApiServer",{enumerable:!0,get:function(){return vOn.ApiServer}});ht.CloudStorage=COe(XSe());var EOn=W_t();Object.defineProperty(ht,"graphQL",{enumerable:!0,get:function(){return EOn.graphQL}});Ry(m2t(),ht);var TRt=rEe();Object.defineProperty(ht,"createNewLogger",{enumerable:!0,get:function(){return TRt.createNewLogger}});Object.defineProperty(ht,"logger",{enumerable:!0,get:function(){return TRt.logger}});Ry(v2t(),ht);var bOn=Zwt();Object.defineProperty(ht,"conditionallyUploadToGCPStorageDevPortalBucket",{enumerable:!0,get:function(){return bOn.conditionallyUploadToGCPStorageDevPortalBucket}});var SOn=JSe();Object.defineProperty(ht,"startsWithReservedKeyword",{enumerable:!0,get:function(){return SOn.startsWithReservedKeyword}});var AOn=eTt();Object.defineProperty(ht,"RouteVersions",{enumerable:!0,get:function(){return AOn.RouteVersions}});var xRt=aTt();Object.defineProperty(ht,"ApiKeyService",{enumerable:!0,get:function(){return xRt.ApiKeyService}});Object.defineProperty(ht,"createApiKeyServiceClient",{enumerable:!0,get:function(){return xRt.createApiKeyServiceClient}});var COn=JO();Object.defineProperty(ht,"getServiceAccountIdToken",{enumerable:!0,get:function(){return COn.getServiceAccountIdToken}});var wOn=uTt();Object.defineProperty(ht,"AuthApiService",{enumerable:!0,get:function(){return wOn.AuthApiService}});var TOe=Yxe();Object.defineProperty(ht,"ContentApiService",{enumerable:!0,get:function(){return TOe.ContentApiService}});Object.defineProperty(ht,"contentApiTarballFileName",{enumerable:!0,get:function(){return TOe.contentApiTarballFileName}});Object.defineProperty(ht,"getContentApiStorageTarballPath",{enumerable:!0,get:function(){return TOe.getContentApiStorageTarballPath}});var TOn=dTt();Object.defineProperty(ht,"DevApiService",{enumerable:!0,get:function(){return TOn.DevApiService}});var xOn=fTt();Object.defineProperty(ht,"MeteringService",{enumerable:!0,get:function(){return xOn.MeteringService}});var ROn=mRt();Object.defineProperty(ht,"OpenFGAService",{enumerable:!0,get:function(){return ROn.OpenFGAService}});var OOn=yRt();Object.defineProperty(ht,"TenantService",{enumerable:!0,get:function(){return OOn.TenantService}});Ry(_Rt(),ht);Ry(SRt(),ht);Ry(awe(),ht);var POn=zCe();Object.defineProperty(ht,"JsonValidator",{enumerable:!0,get:function(){return POn.JsonValidator}});var NOn=ZCe();Object.defineProperty(ht,"RouteValidator",{enumerable:!0,get:function(){return NOn.RouteValidator}});ht.xfs=COe(nY())});var Bn=y(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.NODE_BUILD_OPEN_API_OUTPUT_FILE=Vt.NODE_BUILD_OUTPUT_FILE=Vt.NODE_ENTRY_NAME=Vt.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE=Vt.WORKER_BUILD_OUTPUT_FILE=Vt.WORKER_ENTRY_NAME=Vt.ENV_MODULE_FILE=Vt.ZUPLO_SYSTEM_ENV_FILE=Vt.ENV_FILE=Vt.CACHE_DIRECTORY=Vt.BUILD_CACHE_FILE=Vt.ZUPLO_FILE_SCHEMA=Vt.NON_STANDARD_NODE_ENV=Vt.GENERATED_TYPES_DIR_NAME=Vt.GENERATED_BUILD_JSON_FILE=Vt.GENERATED_SOURCE_DIR_NAME=Vt.BUILD_OUTPUT_DIR=Vt.DEFAULT_TEST_FILE=Vt.DEFAULT_DOCS_MARKDOWN_FILE=Vt.DOCS_THEME_FILE=Vt.DOCS_SIDEBAR_FILE=Vt.ZUPLO_FALLBACK_JSON_FILE=Vt.ZUPLO_PREFERRED_JSON_FILE=Vt.DEFAULT_MODULE_FILE=Vt.OPEN_API_FILE_SUFFIX=Vt.OPEN_API_CONFIG_FILE=Vt.OPEN_API_UNVERSIONED_DIR_NAME=Vt.DEV_PORTAL_OUTPUT_DIR_NAME=Vt.DEV_PORTAL_CONFIG_FILE=Vt.POLICIES_CONFIG_FILE=Vt.ROUTES_OAS_CONFIG_FILE=Vt.LOCAL_API_KEYS_CONFIG_FILE=Vt.DEV_PORTAL_V4_PATH=Vt.USER_DOCS_DIR_NAME=Vt.USER_SCHEMAS_DIR_NAME=Vt.USER_CONFIG_DIR_NAME=Vt.USER_TEST_DIR_NAME=Vt.USER_MODULES_DIR_NAME=void 0;Vt.USER_MODULES_DIR_NAME="modules";Vt.USER_TEST_DIR_NAME="tests";Vt.USER_CONFIG_DIR_NAME="config";Vt.USER_SCHEMAS_DIR_NAME="schemas";Vt.USER_DOCS_DIR_NAME="docs";Vt.DEV_PORTAL_V4_PATH="v4";Vt.LOCAL_API_KEYS_CONFIG_FILE="api-keys.json";Vt.ROUTES_OAS_CONFIG_FILE="routes.oas.json";Vt.POLICIES_CONFIG_FILE="policies.json";Vt.DEV_PORTAL_CONFIG_FILE="dev-portal.json";Vt.DEV_PORTAL_OUTPUT_DIR_NAME="dev-portal";Vt.OPEN_API_UNVERSIONED_DIR_NAME="unversioned";Vt.OPEN_API_CONFIG_FILE="open-api.json";Vt.OPEN_API_FILE_SUFFIX=".oas.json";Vt.DEFAULT_MODULE_FILE="hello-world.ts";Vt.ZUPLO_PREFERRED_JSON_FILE="zuplo.jsonc";Vt.ZUPLO_FALLBACK_JSON_FILE="zuplo.json";Vt.DOCS_SIDEBAR_FILE="sidebar.json";Vt.DOCS_THEME_FILE="theme.css";Vt.DEFAULT_DOCS_MARKDOWN_FILE="index.md";Vt.DEFAULT_TEST_FILE="hello-world.json";Vt.BUILD_OUTPUT_DIR="dist";Vt.GENERATED_SOURCE_DIR_NAME=".zuplo";Vt.GENERATED_BUILD_JSON_FILE="build.json";Vt.GENERATED_TYPES_DIR_NAME="types";Vt.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.';Vt.ZUPLO_FILE_SCHEMA="zuplo";Vt.BUILD_CACHE_FILE="buildstate.json";Vt.CACHE_DIRECTORY=".cache";Vt.ENV_FILE=".env";Vt.ZUPLO_SYSTEM_ENV_FILE=".env.zuplo";Vt.ENV_MODULE_FILE="environment.ts";Vt.WORKER_ENTRY_NAME="worker.ts";Vt.WORKER_BUILD_OUTPUT_FILE="worker.js";Vt.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE="worker.js.map";Vt.NODE_ENTRY_NAME="server.ts";Vt.NODE_BUILD_OUTPUT_FILE="main.js";Vt.NODE_BUILD_OPEN_API_OUTPUT_FILE=Vt.OPEN_API_CONFIG_FILE});var ru=y(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0});CP.runPlugins=CP.PluginResult=void 0;var xOe=class{static{a(this,"PluginResult")}errors=[];warnings=[];constructor(t){t&&this.errors.push(t)}};CP.PluginResult=xOe;async function IOn(e,t){let r=[],n=[],i=new Map;for await(let s of e)try{let o=await s(t,i);if(n.push(...o.errors.map(u=>(u.pluginName===""&&(u.pluginName=s.name),u))),r.push(...o.warnings),o.errors.length>0)break}catch(o){n.push(o);break}return{errors:n,warnings:r}}a(IOn,"runPlugins");CP.runPlugins=IOn});var Ts=y(OOe=>{"use strict";Object.defineProperty(OOe,"__esModule",{value:!0});var HF=require("perf_hooks"),ROe=[];async function kOn(e,t){let r=HF.performance.timerify(t),n=new HF.PerformanceObserver(i=>{let s=i.getEntries()[0];ROe.push({name:e,duration:s.duration}),n.disconnect()});return n.observe({entryTypes:["function"]}),r()}a(kOn,"timeFn");var DOn={mark:e=>{HF.performance.mark(e)},measure:(e,t,r)=>{HF.performance.measure(e,t,r)},timeFn:kOn,report:()=>{ROe.length>0&&console.table(ROe)},getDuration:e=>{let t=HF.performance.getEntriesByName(e);return t.length===0?0:t[0].duration}};OOe.default=DOn});var POe=y(wP=>{"use strict";var LOn=wP&&wP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wP,"__esModule",{value:!0});wP.getZuploConfig=void 0;var gh=_n(),FOn=require("jsonc-parser"),BOn=require("fs/promises"),RRt=LOn(require("path")),ORt=Bn();async function MOn(e){let t=RRt.default.join(e,ORt.ZUPLO_PREFERRED_JSON_FILE),r=RRt.default.join(e,ORt.ZUPLO_FALLBACK_JSON_FILE),n=!1,i=t;await gh.xfs.fileExists(t)?(n=!0,i=t):await gh.xfs.fileExists(r)&&(n=!0,i=r);let s={flags:(0,gh.getBuildFlags)(void 0,void 0)};if(n){let o=await(0,BOn.readFile)(i,"utf-8"),u=[],l=(0,FOn.parse)(o,u);if(typeof l!="object"){let c={message:"Invalid zuplo.jsonc file.",detail:"The zuplo.jsonc file is not a valid JSON object",pluginName:"buildData",severity:"error"};return{status:gh.FAILURE_STATUS,errors:[c]}}if("version"in l&&l.version!==1){let c={message:"Invalid version set in zuplo.jsonc file.",detail:"version in zuplo.jsonc must be set to 1",pluginName:"buildData",severity:"error"};return{status:gh.FAILURE_STATUS,errors:[c]}}if("compatibilityDate"in l&&gh.VALID_COMPATIBILITY_DATES&&typeof l.compatibilityDate=="string"){if(!gh.VALID_COMPATIBILITY_DATES.includes(l.compatibilityDate)){let c={message:"Invalid compatibilityDate set in zuplo.jsonc file.",detail:`compatibilityDate was set to ${l.compatibilityDate}. Valid compatibility dates are ${gh.VALID_COMPATIBILITY_DATES.join(", ")}`,pluginName:"buildData",severity:"error"};return{status:gh.FAILURE_STATUS,errors:[c]}}s.compatibilityDate=l.compatibilityDate}"flags"in l&&typeof l=="object"&&(s.flags=(0,gh.getBuildFlags)(s.compatibilityDate,l.flags))}return{status:gh.GOOD_STATUS,config:s}}a(MOn,"getZuploConfig");wP.getZuploConfig=MOn});var VF=y(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});rQ.TargetPlatform=void 0;var PRt;(function(e){e.Worker="worker"})(PRt||(rQ.TargetPlatform=PRt={}))});var IRt=y(TP=>{"use strict";var NRt=TP&&TP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(TP,"__esModule",{value:!0});TP.cleanOutput=void 0;var qOn=NRt(require("fs/promises")),UOn=NRt(Ts()),$On=a(async function({outputDirectory:e,systemDirectory:t,logger:r}){return UOn.default.timeFn("Cleaning output",async()=>{r.debug("Cleaning output");let n=[e,t];for await(let i of n)try{await qOn.default.rm(i,{recursive:!0,force:!0})}catch(s){r.error(s)}return{warnings:[],errors:[]}})},"cleanOutput");TP.cleanOutput=$On});var DRt=y(xP=>{"use strict";var kRt=xP&&xP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xP,"__esModule",{value:!0});xP.createSystemDir=void 0;var jOn=_n(),GOn=kRt(require("fs/promises")),HOn=kRt(Ts()),VOn=a(async function({systemDirectory:e,logger:t}){return HOn.default.timeFn("Creating system directory",async()=>{t.debug("Creating system directory");try{if(await jOn.xfs.dirExists(e))return t.debug("System directory already exists, skipping"),{warnings:[],errors:[]};await GOn.default.mkdir(e)}catch(r){return t.error(r),{warnings:[],errors:[]}}return{warnings:[],errors:[]}})},"createSystemDir");xP.createSystemDir=VOn});var LRt=y(RP=>{"use strict";var zOn=RP&&RP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(RP,"__esModule",{value:!0});RP.checkForDeprecations=void 0;var KOn=zOn(Ts()),WOn=a(async function({logger:e}){return KOn.default.timeFn("Checking for breaking changes",async()=>(e.debug("Checking for breaking changes"),{warnings:[],errors:[]}))},"checkForDeprecations");RP.checkForDeprecations=WOn});var qRt=y(OP=>{"use strict";var MRt=OP&&OP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(OP,"__esModule",{value:!0});OP.generateBuildData=void 0;var nQ=_n(),FRt=require("fs/promises"),BRt=MRt(require("path")),YOn=Bn(),XOn=MRt(Ts()),JOn=a(async function({systemDirectory:e,buildId:t,logger:r,config:n,publicZuploEnvironmentVariables:i}){return XOn.default.timeFn("Generating build data",async()=>{r.debug("Generating build data");let s=await(0,FRt.readFile)(BRt.default.resolve(__dirname,"../../../package.json"),"utf-8"),o=JSON.parse(s),u={BUILD_ID:t??"",GIT_SHA:process.env.GIT_SHA,TIMESTAMP:new Date().toISOString(),IS_PRODUCTION:nQ.env.isProduction(),BUILD_ENV:nQ.env.NODE_ENV,ZUPLO_VERSION:o.version,API_VERSION:process.env.API_VERSION,COMPATIBILITY_DATE:n?.compatibilityDate,ACCOUNT_NAME:i?.ZUPLO_ACCOUNT_NAME,PROJECT_NAME:i?.ZUPLO_PROJECT_NAME,ENVIRONMENT_TYPE:i?.ZUPLO_ENVIRONMENT_TYPE,COMPATIBILITY_FLAGS:nQ.COMPATIBILITY_FLAG_MAPPINGS?nQ.COMPATIBILITY_FLAG_MAPPINGS[n?.compatibilityDate??"none"]:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1}},l=JSON.stringify(u,void 0,2),c=BRt.default.join(e,YOn.GENERATED_BUILD_JSON_FILE);try{await(0,FRt.writeFile)(c,l.trimStart(),"utf-8")}catch(d){r.error(d);let p={message:`Error creating file at ${c}`,pluginName:"buildData",severity:"error"};return{warnings:[],errors:[p]}}return{warnings:[],errors:[]}})},"generateBuildData");OP.generateBuildData=JOn});var URt=y(PP=>{"use strict";var NOe=PP&&PP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(PP,"__esModule",{value:!0});PP.generateWorker=void 0;var QOn=NOe(require("fs/promises")),ZOn=NOe(require("path")),zF=Bn(),ePn=NOe(Ts()),tPn=`import { Handler, ServiceProviderImpl } from "@zuplo/runtime";
|
|
620
|
+
`):" "+dxt(s[0]):"as no adapter specified";throw new _r("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n},adapters:DRe};function xRe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new QA(null,e)}a(xRe,"throwIfCancellationRequested");function pxt(e){return xRe(e),e.headers=Ff.from(e.headers),e.data=TRe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Mxt.getAdapter(e.adapter||jRe.adapter)(e).then(a(function(n){return xRe(e),n.data=TRe.call(e,e.transformResponse,n),n.headers=Ff.from(n.headers),n},"onAdapterResolution"),a(function(n){return kxt(n)||(xRe(e),n&&n.response&&(n.response.data=TRe.call(e,e.transformResponse,n.response),n.response.headers=Ff.from(n.response.headers))),Promise.reject(n)},"onAdapterRejection"))}a(pxt,"dispatchRequest");var fxt=a(e=>e instanceof Ff?e.toJSON():e,"headersToObject");function oP(e,t){t=t||{};let r={};function n(c,d,p){return Je.isPlainObject(c)&&Je.isPlainObject(d)?Je.merge.call({caseless:p},c,d):Je.isPlainObject(d)?Je.merge({},d):Je.isArray(d)?d.slice():d}a(n,"getMergedValue");function i(c,d,p){if(Je.isUndefined(d)){if(!Je.isUndefined(c))return n(void 0,c,p)}else return n(c,d,p)}a(i,"mergeDeepProperties");function s(c,d){if(!Je.isUndefined(d))return n(void 0,d)}a(s,"valueFromConfig2");function o(c,d){if(Je.isUndefined(d)){if(!Je.isUndefined(c))return n(void 0,c)}else return n(void 0,d)}a(o,"defaultToConfig2");function u(c,d,p){if(p in t)return n(c,d);if(p in e)return n(void 0,c)}a(u,"mergeDirectKeys");let l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u,headers:(c,d)=>i(fxt(c),fxt(d),!0)};return Je.forEach(Object.keys(Object.assign({},e,t)),a(function(d){let p=l[d]||i,f=p(e[d],t[d],d);Je.isUndefined(f)&&p!==u||(r[d]=f)},"computeConfigValue")),r}a(oP,"mergeConfig");var HRe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{HRe[e]=a(function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e},"validator")});var mxt={};HRe.transitional=a(function(t,r,n){function i(s,o){return"[Axios v"+SJ+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return a(i,"formatMessage"),(s,o,u)=>{if(t===!1)throw new _r(i(o," has been removed"+(r?" in "+r:"")),_r.ERR_DEPRECATED);return r&&!mxt[o]&&(mxt[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,o,u):!0}},"transitional");function cRn(e,t,r){if(typeof e!="object")throw new _r("options must be an object",_r.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let s=n[i],o=t[s];if(o){let u=e[s],l=u===void 0||o(u,s,e);if(l!==!0)throw new _r("option "+s+" must be "+l,_r.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new _r("Unknown option "+s,_r.ERR_BAD_OPTION)}}a(cRn,"assertOptions");var LRe={assertOptions:cRn,validators:HRe},qE=LRe.validators,uP=class{static{a(this,"Axios")}constructor(t){this.defaults=t,this.interceptors={request:new rxt,response:new rxt}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=oP(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&LRe.assertOptions(n,{silentJSONParsing:qE.transitional(qE.boolean),forcedJSONParsing:qE.transitional(qE.boolean),clarifyTimeoutError:qE.transitional(qE.boolean)},!1),i!=null&&(Je.isFunction(i)?r.paramsSerializer={serialize:i}:LRe.assertOptions(i,{encode:qE.function,serialize:qE.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&Je.merge(s.common,s[r.method]);s&&Je.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),r.headers=Ff.concat(o,s);let u=[],l=!0;this.interceptors.request.forEach(a(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(l=l&&g.synchronous,u.unshift(g.fulfilled,g.rejected))},"unshiftRequestInterceptors"));let c=[];this.interceptors.response.forEach(a(function(g){c.push(g.fulfilled,g.rejected)},"pushResponseInterceptors"));let d,p=0,f;if(!l){let h=[pxt.bind(this),void 0];for(h.unshift.apply(h,u),h.push.apply(h,c),f=h.length,d=Promise.resolve(r);p<f;)d=d.then(h[p++],h[p++]);return d}f=u.length;let m=r;for(p=0;p<f;){let h=u[p++],g=u[p++];try{m=h(m)}catch(_){g.call(this,_);break}}try{d=pxt.call(this,m)}catch(h){return Promise.reject(h)}for(p=0,f=c.length;p<f;)d=d.then(c[p++],c[p++]);return d}getUri(t){t=oP(this.defaults,t);let r=GRe(t.baseURL,t.url);return qRe(r,t.params,t.paramsSerializer)}};Je.forEach(["delete","get","head","options"],a(function(t){uP.prototype[t]=function(r,n){return this.request(oP(n||{},{method:t,url:r,data:(n||{}).data}))}},"forEachMethodNoData"));Je.forEach(["post","put","patch"],a(function(t){function r(n){return a(function(s,o,u){return this.request(oP(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))},"httpMethod")}a(r,"generateHTTPMethod"),uP.prototype[t]=r(),uP.prototype[t+"Form"]=r(!0)},"forEachMethodWithData"));var bJ=uP,FRe=class e{static{a(this,"CancelToken")}constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(a(function(s){r=s},"promiseExecutor"));let n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(u=>{n.subscribe(u),s=u}).then(i);return o.cancel=a(function(){n.unsubscribe(s)},"reject"),o},t(a(function(s,o,u){n.reason||(n.reason=new QA(s,o,u),r(n.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new e(a(function(i){t=i},"executor")),cancel:t}}},dRn=FRe;function pRn(e){return a(function(r){return e.apply(null,r)},"wrap")}a(pRn,"spread");function fRn(e){return Je.isObject(e)&&e.isAxiosError===!0}a(fRn,"isAxiosError");var BRe={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(BRe).forEach(([e,t])=>{BRe[t]=e});var mRn=BRe;function qxt(e){let t=new bJ(e),r=_xt(bJ.prototype.request,t);return Je.extend(r,bJ.prototype,t,{allOwnKeys:!0}),Je.extend(r,t,null,{allOwnKeys:!0}),r.create=a(function(i){return qxt(oP(e,i))},"create"),r}a(qxt,"createInstance");var Fo=qxt(jRe);Fo.Axios=bJ;Fo.CanceledError=QA;Fo.CancelToken=dRn;Fo.isCancel=kxt;Fo.VERSION=SJ;Fo.toFormData=TJ;Fo.AxiosError=_r;Fo.Cancel=Fo.CanceledError;Fo.all=a(function(t){return Promise.all(t)},"all");Fo.spread=pRn;Fo.isAxiosError=fRn;Fo.mergeConfig=oP;Fo.AxiosHeaders=Ff;Fo.formToJSON=e=>Ixt(Je.isHTMLForm(e)?new FormData(e):e);Fo.getAdapter=Mxt.getAdapter;Fo.HttpStatusCode=mRn;Fo.default=Fo;Uxt.exports=Fo});var OJ=y(RJ=>{"use strict";Object.defineProperty(RJ,"__esModule",{value:!0});RJ.CredentialsMethod=void 0;var $xt;(function(e){e.None="none",e.ApiToken="api_token",e.ClientCredentials="client_credentials"})($xt||(RJ.CredentialsMethod=$xt={}))});var eC=y(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.FgaRequiredParamError=Bo.FgaValidationError=Bo.FgaApiAuthenticationError=Bo.FgaApiInternalError=Bo.FgaApiRateLimitExceededError=Bo.FgaApiNotFoundError=Bo.FgaApiValidationError=Bo.FgaApiError=Bo.FgaError=void 0;var cP=class extends Error{static{a(this,"FgaError")}constructor(t,r){super(r||typeof t=="string"?t:`FGA Error${t?.message?`: ${t.message}`:""}`),this.name="FgaError",t?.stack&&(this.stack=t.stack)}};Bo.FgaError=cP;function NJ(e){let t=(e||"").split("/");t.length<4&&(t=[]);let r=t[2]||"",n=t[3]||"";return{storeId:r,endpointCategory:n}}a(NJ,"getRequestMetadataFromPath");var jxt="fga-request-id";function JRe(e){return e.response?Object.fromEntries(Object.entries(e.response.headers).map(([t,r])=>[t.toLowerCase(),r])):{}}a(JRe,"getResponseHeaders");var ZA=class extends cP{static{a(this,"FgaApiError")}constructor(t,r){var n,i,s,o,u,l,c,d,p,f;super(r||t),this.name="FgaApiError",this.statusCode=(n=t.response)===null||n===void 0?void 0:n.status,this.statusText=(i=t.response)===null||i===void 0?void 0:i.statusText,this.requestData=(s=t.config)===null||s===void 0?void 0:s.data,this.requestURL=(o=t.config)===null||o===void 0?void 0:o.url,this.method=(u=t.config)===null||u===void 0?void 0:u.method;let{storeId:m,endpointCategory:h}=NJ((l=t.request)===null||l===void 0?void 0:l.path);this.storeId=m,this.endpointCategory=h,this.apiErrorMessage=(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message,this.responseData=(p=t.response)===null||p===void 0?void 0:p.data,this.responseHeader=(f=t.response)===null||f===void 0?void 0:f.headers;let g=JRe(t);this.requestId=g[jxt],t?.stack&&(this.stack=t.stack)}};Bo.FgaApiError=ZA;var VRe=class extends ZA{static{a(this,"FgaApiValidationError")}constructor(t,r){var n,i,s,o,u,l,c,d;super(t),this.name="FgaApiValidationError",this.apiErrorCode=(i=(n=t.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;let{endpointCategory:p}=NJ((s=t.request)===null||s===void 0?void 0:s.path);this.message=r||(!((u=(o=t.response)===null||o===void 0?void 0:o.data)===null||u===void 0)&&u.message?`FGA API Validation Error: ${(l=t.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:t.message)}};Bo.FgaApiValidationError=VRe;var zRe=class extends ZA{static{a(this,"FgaApiNotFoundError")}constructor(t,r){var n,i,s,o,u,l,c;super(t),this.name="FgaApiNotFoundError",this.apiErrorCode=(i=(n=t.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code,this.message=r||(!((o=(s=t.response)===null||s===void 0?void 0:s.data)===null||o===void 0)&&o.message?`FGA API NotFound Error: ${(u=t.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=t.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:t.message)}};Bo.FgaApiNotFoundError=zRe;var KRe=class extends ZA{static{a(this,"FgaApiRateLimitExceededError")}constructor(t,r){var n,i,s;super(t),this.name="FgaApiRateLimitExceededError",this.apiErrorCode=(i=(n=t.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;let{endpointCategory:o}=NJ((s=t.request)===null||s===void 0?void 0:s.path),u=JRe(t);this.message=r||`FGA API Rate Limit Error for ${this.method} ${o}`}};Bo.FgaApiRateLimitExceededError=KRe;var WRe=class extends ZA{static{a(this,"FgaApiInternalError")}constructor(t,r){var n,i,s,o,u,l,c,d;super(t),this.name="FgaApiInternalError";let{endpointCategory:p}=NJ((n=t.request)===null||n===void 0?void 0:n.path);this.apiErrorCode=(s=(i=t.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.code,this.message=r||(!((u=(o=t.response)===null||o===void 0?void 0:o.data)===null||u===void 0)&&u.message?`FGA API Internal Error: ${(l=t.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:t.message)}};Bo.FgaApiInternalError=WRe;var YRe=class extends cP{static{a(this,"FgaApiAuthenticationError")}constructor(t){var r,n,i,s,o,u,l,c,d,p;super(`FGA Authentication Error.${!((r=t.response)===null||r===void 0)&&r.statusText?` ${t.response.statusText}`:""}`),this.name="FgaApiAuthenticationError",this.statusCode=(n=t.response)===null||n===void 0?void 0:n.status,this.statusText=(i=t.response)===null||i===void 0?void 0:i.statusText,this.requestURL=(s=t.config)===null||s===void 0?void 0:s.url,this.method=(o=t.config)===null||o===void 0?void 0:o.method,this.responseData=(u=t.response)===null||u===void 0?void 0:u.data,this.responseHeader=(l=t.response)===null||l===void 0?void 0:l.headers,this.apiErrorCode=(d=(c=t.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.code;let f=JRe(t);this.requestId=f[jxt];let m;try{m=JSON.parse(((p=t.config)===null||p===void 0?void 0:p.data)||"{}")}catch{}this.clientId=m?.client_id,this.audience=m?.audience,this.grantType=m?.grant_type,t?.stack&&(this.stack=t.stack)}};Bo.FgaApiAuthenticationError=YRe;var PJ=class extends cP{static{a(this,"FgaValidationError")}constructor(t,r){super(r),this.field=t,this.name="FgaValidationError"}};Bo.FgaValidationError=PJ;var XRe=class extends PJ{static{a(this,"FgaRequiredParamError")}constructor(t,r,n){super(r,n),this.functionName=t,this.name="FgaRequiredParamError"}};Bo.FgaRequiredParamError=XRe});var FF=y(GE=>{"use strict";Object.defineProperty(GE,"__esModule",{value:!0});GE.isWellFormedUlidString=GE.isWellFormedUriString=GE.assertParamExists=void 0;var hRn=eC(),gRn=a(function(e,t,r){if(r==null)throw new hRn.FgaRequiredParamError(e,t,`Required parameter ${t} was null or undefined when calling ${e}.`)},"assertParamExists");GE.assertParamExists=gRn;var yRn=a(e=>{try{let t=new URL(e);return(t.toString()===e||t.toString()===`${e}/`)&&(t.protocol==="https:"||t.protocol==="http:")}catch{return!1}},"isWellFormedUriString");GE.isWellFormedUriString=yRn;var _Rn=a(e=>{var t;let r=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;return!!(typeof e=="string"&&(!((t=e.match(r))===null||t===void 0)&&t.length))},"isWellFormedUlidString");GE.isWellFormedUlidString=_Rn});var ZRe=y(dP=>{"use strict";Object.defineProperty(dP,"__esModule",{value:!0});dP.Configuration=dP.GetDefaultRetryParams=void 0;var BF=OJ(),QRe=eC(),IJ=FF(),vRn=15,ERn=100,bRn="openfga-sdk js/0.3.0";function SRn(e=vRn,t=ERn){return{maxRetry:e,minWaitInMs:t}}a(SRn,"GetDefaultRetryParams");dP.GetDefaultRetryParams=SRn;var kJ=class{static{a(this,"Configuration")}constructor(t={}){this.apiScheme="https",this.getBasePath=()=>`${this.apiScheme}://${this.apiHost}`,this.apiScheme=t.apiScheme||this.apiScheme,this.apiHost=t.apiHost,this.storeId=t.storeId;let r=t.credentials;if(r)switch(r?.method){case BF.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case BF.CredentialsMethod.ClientCredentials:this.credentials={method:BF.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case BF.CredentialsMethod.None:default:this.credentials={method:BF.CredentialsMethod.None};break}let n=t.baseOptions||{};n.headers=n.headers||{},typeof process=="object"&&process.title==="node"&&!n.headers["User-Agent"]&&(n.headers["User-Agent"]=bRn),this.baseOptions=n,this.retryParams=t.retryParams}isValid(){var t;if((0,IJ.assertParamExists)("Configuration","apiScheme",this.apiScheme),(0,IJ.assertParamExists)("Configuration","apiHost",this.apiHost),!(0,IJ.isWellFormedUriString)(this.getBasePath()))throw new QRe.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`);if(this.storeId&&!(0,IJ.isWellFormedUlidString)(this.storeId))throw new QRe.FgaValidationError("storeId");if(!((t=this.retryParams)===null||t===void 0)&&t.maxRetry&&this.retryParams.maxRetry>15)throw new QRe.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15");return!0}};dP.Configuration=kJ;kJ.sdkVersion="0.3.0"});var Gxt=y(DJ=>{"use strict";Object.defineProperty(DJ,"__esModule",{value:!0});DJ.assertNever=void 0;function ARn(e){throw new Error(`Assertion failed. Unacceptable value: '${e}'`)}a(ARn,"assertNever");DJ.assertNever=ARn});var Hxt=y(LJ=>{"use strict";Object.defineProperty(LJ,"__esModule",{value:!0});LJ.chunkArray=void 0;function CRn(e,t){let r=[],n=[...e];for(;n.length>0;)r.push(n.splice(0,t));return r}a(CRn,"chunkArray");LJ.chunkArray=CRn});var zxt=y(pP=>{"use strict";Object.defineProperty(pP,"__esModule",{value:!0});pP.generateRandomIdWithNonUniqueFallback=pP.generateRandomId=void 0;var FJ=require("crypto");function Vxt(){if(typeof FJ.randomUUID=="function")return(0,FJ.randomUUID)();if(typeof FJ.randomBytes=="function")return(0,FJ.randomBytes)(20).toString("hex")}a(Vxt,"generateRandomId");pP.generateRandomId=Vxt;function wRn(){return Vxt()||"00000000-0000-0000-0000-000000000000"}a(wRn,"generateRandomIdWithNonUniqueFallback");pP.generateRandomIdWithNonUniqueFallback=wRn});var Kxt=y(BJ=>{"use strict";Object.defineProperty(BJ,"__esModule",{value:!0});BJ.setHeaderIfNotSet=void 0;function TRn(e,t,r){!e[t]&&r&&(e[t]=r)}a(TRn,"setHeaderIfNotSet");BJ.setHeaderIfNotSet=TRn});var Wxt=y(MJ=>{"use strict";Object.defineProperty(MJ,"__esModule",{value:!0});MJ.setNotEnumerableProperty=void 0;function xRn(e,t,r){Object.defineProperty(e,t,{enumerable:!1,writable:!1,value:r})}a(xRn,"setNotEnumerableProperty");MJ.setNotEnumerableProperty=xRn});var eOe=y(mh=>{"use strict";var RRn=mh&&mh.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),MF=mh&&mh.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&RRn(t,e,r)};Object.defineProperty(mh,"__esModule",{value:!0});MF(Gxt(),mh);MF(Hxt(),mh);MF(zxt(),mh);MF(Kxt(),mh);MF(Wxt(),mh)});var rOe=y(tu=>{"use strict";var tOe=tu&&tu.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})};Object.defineProperty(tu,"__esModule",{value:!0});tu.createRequestFunction=tu.attemptHttpRequest=tu.toPathString=tu.serializeDataIfNeeded=tu.setSearchParams=tu.setBearerAuthToObject=tu.DUMMY_BASE_URL=void 0;var ORn=qJ(),tC=eC(),PRn=eOe();tu.DUMMY_BASE_URL="https://example.com";var NRn=a(function(e,t){return tOe(this,void 0,void 0,function*(){let r=yield t.getAccessTokenHeader();r&&!e[r.name]&&(e[r.name]=r.value)})},"setBearerAuthToObject");tu.setBearerAuthToObject=NRn;var IRn=a(function(e,...t){let r=new URLSearchParams(e.search);for(let n of t)for(let i in n)if(Array.isArray(n[i])){r.delete(i);for(let s of n[i])r.append(i,s)}else r.set(i,n[i]);e.search=r.toString()},"setSearchParams");tu.setSearchParams=IRn;var kRn=a(e=>{let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return e!==null&&(t.test(e)||e.toLowerCase()==="application/json-patch+json")},"isJsonMime"),DRn=a(function(e,t){let r=typeof e!="string";return r&&kRn(t.headers["Content-Type"])?JSON.stringify(e!==void 0?e:{}):e||""},"serializeDataIfNeeded");tu.serializeDataIfNeeded=DRn;var LRn=a(function(e){return e.pathname+e.search+e.hash},"toPathString");tu.toPathString=LRn;function FRn(e){return e&&typeof e=="object"&&e.isAxiosError===!0}a(FRn,"isAxiosError");function BRn(e,t){let r=Math.ceil(Math.pow(2,e)*t),n=Math.ceil(Math.pow(2,e+1)*t);return Math.floor(Math.random()*(n-r)+r)}a(BRn,"randomTime");function Yxt(e,t,r){var n;return tOe(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(e)}catch(s){if(!FRn(s))throw new tC.FgaError(s);let o=(n=s?.response)===null||n===void 0?void 0:n.status;if(o===400||o===422)throw new tC.FgaApiValidationError(s);if(o===401||o===403)throw new tC.FgaApiAuthenticationError(s);if(o===404)throw new tC.FgaApiNotFoundError(s);if(o===429||o>=500){if(i>=t.maxRetry)throw o===429?new tC.FgaApiRateLimitExceededError(s):new tC.FgaApiInternalError(s);yield new Promise(u=>setTimeout(u,BRn(i,t.minWaitInMs)))}else throw new tC.FgaApiError(s)}}while(i<t.maxRetry+1)})}a(Yxt,"attemptHttpRequest");tu.attemptHttpRequest=Yxt;var MRn=a(function(e,t,r,n){var i,s;r.isValid();let o=!((i=e.options)===null||i===void 0)&&i.retryParams?(s=e.options)===null||s===void 0?void 0:s.retryParams:r.retryParams,u=o?o.maxRetry:0,l=o?o.minWaitInMs:0;return n||(n=ORn.Credentials.init(r)),(c=t)=>tOe(this,void 0,void 0,function*(){yield(0,tu.setBearerAuthToObject)(e.options.headers,n);let d=Object.assign(Object.assign({},e.options),{url:r.getBasePath()+e.url}),p=yield Yxt(d,{maxRetry:u,minWaitInMs:l},c),f=typeof p?.data>"u"?{}:p?.data,m=Object.assign({},f);return(0,PRn.setNotEnumerableProperty)(m,"$response",p),m})},"createRequestFunction");tu.createRequestFunction=MRn});var Jxt=y(fP=>{"use strict";var nOe=fP&&fP.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})};Object.defineProperty(fP,"__esModule",{value:!0});fP.Credentials=void 0;var Xxt=xJ(),HE=FF(),iOe=eC(),qRn=rOe(),Bf=OJ(),sOe=class e{static{a(this,"Credentials")}static init(t){return new e(t.credentials)}constructor(t,r=Xxt.default){this.authConfig=t,this.axios=r,this.initConfig(),this.isValid()}initConfig(){var t;switch((t=this.authConfig)===null||t===void 0?void 0:t.method){case Bf.CredentialsMethod.ApiToken:this.authConfig.config&&(this.authConfig.config.headerName||(this.authConfig.config.headerName="Authorization"),this.authConfig.config.headerValuePrefix||(this.authConfig.config.headerValuePrefix="Bearer"));break;case Bf.CredentialsMethod.ClientCredentials:case Bf.CredentialsMethod.None:default:break}}isValid(){var t,r,n,i,s,o,u,l,c;let{authConfig:d}=this;switch(d?.method){case Bf.CredentialsMethod.None:break;case Bf.CredentialsMethod.ApiToken:(0,HE.assertParamExists)("Credentials","config.token",(t=d.config)===null||t===void 0?void 0:t.token),(0,HE.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName),(0,HE.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case Bf.CredentialsMethod.ClientCredentials:if((0,HE.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId),(0,HE.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret),(0,HE.assertParamExists)("Credentials","config.apiTokenIssuer",(o=d.config)===null||o===void 0?void 0:o.apiTokenIssuer),(0,HE.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience),!(0,HE.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`))throw new iOe.FgaValidationError(`Configuration.apiTokenIssuer does not form a valid URI (https://${(c=d.config)===null||c===void 0?void 0:c.apiTokenIssuer})`);break}}getAccessTokenHeader(){var t;return nOe(this,void 0,void 0,function*(){let r=yield this.getAccessTokenValue();switch((t=this.authConfig)===null||t===void 0?void 0:t.method){case Bf.CredentialsMethod.None:return;case Bf.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case Bf.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var t;return nOe(this,void 0,void 0,function*(){switch((t=this.authConfig)===null||t===void 0?void 0:t.method){case Bf.CredentialsMethod.None:return;case Bf.CredentialsMethod.ApiToken:return this.authConfig.config.token;case Bf.CredentialsMethod.ClientCredentials:return this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)?this.accessToken:this.refreshAccessToken()}})}refreshAccessToken(){var t;return nOe(this,void 0,void 0,function*(){let r=(t=this.authConfig)===null||t===void 0?void 0:t.config;try{let n=yield(0,qRn.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},Xxt.default);return n&&(this.accessToken=n.data.access_token,this.accessTokenExpiryDate=new Date(Date.now()+n.data.expires_in*1e3)),this.accessToken}catch(n){throw n instanceof iOe.FgaApiError&&(n.constructor=iOe.FgaApiAuthenticationError,n.name="FgaApiAuthenticationError",n.clientId=r.clientId,n.audience=r.apiAudience,n.grantType="client_credentials"),n}})}};fP.Credentials=sOe});var qJ=y(VE=>{"use strict";var URn=VE&&VE.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Qxt=VE&&VE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&URn(t,e,r)};Object.defineProperty(VE,"__esModule",{value:!0});Qxt(Jxt(),VE);Qxt(OJ(),VE)});var oOe=y(UJ=>{"use strict";Object.defineProperty(UJ,"__esModule",{value:!0});UJ.BaseAPI=void 0;var $Rn=xJ(),jRn=require("http"),GRn=require("https"),Zxt=ZRe(),HRn=qJ(),VRn=1e4,aOe=class{static{a(this,"BaseAPI")}constructor(t,r){var n;if(this.axios=r,t instanceof Zxt.Configuration?this.configuration=t:this.configuration=new Zxt.Configuration(t),this.configuration.isValid(),this.credentials=HRn.Credentials.init(this.configuration),!this.axios){let i=new jRn.Agent({keepAlive:!0}),s=new GRn.Agent({keepAlive:!0});this.axios=$Rn.default.create({httpAgent:i,httpsAgent:s,timeout:VRn,headers:(n=this.configuration.baseOptions)===null||n===void 0?void 0:n.headers})}}get storeId(){return this.configuration.storeId}set storeId(t){this.configuration.storeId=t}};UJ.BaseAPI=aOe});var lOe=y(ws=>{"use strict";var As=ws&&ws.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})};Object.defineProperty(ws,"__esModule",{value:!0});ws.OpenFgaApi=ws.OpenFgaApiFactory=ws.OpenFgaApiFp=ws.OpenFgaApiAxiosParamCreator=void 0;var wc=xJ(),zRn=oOe(),ar=rOe(),Va=FF(),KRn=a(function(e,t){return{check:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("check","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/check".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),createStore:(r,n={})=>As(this,void 0,void 0,function*(){let i="/stores",s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),deleteStore:(r={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let n="/stores/{store_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))),i=new URL(n,ar.DUMMY_BASE_URL),s;e&&(s=e.baseOptions);let o=Object.assign(Object.assign({method:"DELETE"},s),r),u={},l={};return(0,ar.setSearchParams)(i,l,r.query),o.headers=Object.assign(Object.assign({},u),r.headers),{url:(0,ar.toPathString)(i),options:o}}),expand:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("expand","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/expand".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),getStore:(r={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let n="/stores/{store_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))),i=new URL(n,ar.DUMMY_BASE_URL),s;e&&(s=e.baseOptions);let o=Object.assign(Object.assign({method:"GET"},s),r),u={},l={};return(0,ar.setSearchParams)(i,l,r.query),o.headers=Object.assign(Object.assign({},u),r.headers),{url:(0,ar.toPathString)(i),options:o}}),listObjects:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("listObjects","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/list-objects".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),listStores:(r,n,i={})=>As(this,void 0,void 0,function*(){let s="/stores",o=new URL(s,ar.DUMMY_BASE_URL),u;e&&(u=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},u),i),c={},d={};return r!==void 0&&(d.page_size=r),n!==void 0&&(d.continuation_token=n),(0,ar.setSearchParams)(o,d,i.query),l.headers=Object.assign(Object.assign({},c),i.headers),{url:(0,ar.toPathString)(o),options:l}}),read:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("read","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/read".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),readAssertions:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("readAssertions","authorizationModelId",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/assertions/{authorization_model_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))).replace("{authorization_model_id}",encodeURIComponent(String(r))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"GET"},o),n),l={},c={};return(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),{url:(0,ar.toPathString)(s),options:u}}),readAuthorizationModel:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("readAuthorizationModel","id",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/authorization-models/{id}".replace("{store_id}",encodeURIComponent(String(e.storeId))).replace("{id}",encodeURIComponent(String(r))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"GET"},o),n),l={},c={};return(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),{url:(0,ar.toPathString)(s),options:u}}),readAuthorizationModels:(r,n,i={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let s="/stores/{store_id}/authorization-models".replace("{store_id}",encodeURIComponent(String(e.storeId))),o=new URL(s,ar.DUMMY_BASE_URL),u;e&&(u=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},u),i),c={},d={};return r!==void 0&&(d.page_size=r),n!==void 0&&(d.continuation_token=n),(0,ar.setSearchParams)(o,d,i.query),l.headers=Object.assign(Object.assign({},c),i.headers),{url:(0,ar.toPathString)(o),options:l}}),readChanges:(r,n,i,s={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let o="/stores/{store_id}/changes".replace("{store_id}",encodeURIComponent(String(e.storeId))),u=new URL(o,ar.DUMMY_BASE_URL),l;e&&(l=e.baseOptions);let c=Object.assign(Object.assign({method:"GET"},l),s),d={},p={};return r!==void 0&&(p.type=r),n!==void 0&&(p.page_size=n),i!==void 0&&(p.continuation_token=i),(0,ar.setSearchParams)(u,p,s.query),c.headers=Object.assign(Object.assign({},d),s.headers),{url:(0,ar.toPathString)(u),options:c}}),write:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("write","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/write".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}}),writeAssertions:(r,n,i={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("writeAssertions","authorizationModelId",r),(0,Va.assertParamExists)("writeAssertions","body",n),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let s="/stores/{store_id}/assertions/{authorization_model_id}".replace("{store_id}",encodeURIComponent(String(e.storeId))).replace("{authorization_model_id}",encodeURIComponent(String(r))),o=new URL(s,ar.DUMMY_BASE_URL),u;e&&(u=e.baseOptions);let l=Object.assign(Object.assign({method:"PUT"},u),i),c={},d={};return c["Content-Type"]="application/json",(0,ar.setSearchParams)(o,d,i.query),l.headers=Object.assign(Object.assign({},c),i.headers),l.data=(0,ar.serializeDataIfNeeded)(n,l),{url:(0,ar.toPathString)(o),options:l}}),writeAuthorizationModel:(r,n={})=>As(this,void 0,void 0,function*(){(0,Va.assertParamExists)("writeAuthorizationModel","body",r),(0,Va.assertParamExists)("Configuration","storeId",e.storeId);let i="/stores/{store_id}/authorization-models".replace("{store_id}",encodeURIComponent(String(e.storeId))),s=new URL(i,ar.DUMMY_BASE_URL),o;e&&(o=e.baseOptions);let u=Object.assign(Object.assign({method:"POST"},o),n),l={},c={};return l["Content-Type"]="application/json",(0,ar.setSearchParams)(s,c,n.query),u.headers=Object.assign(Object.assign({},l),n.headers),u.data=(0,ar.serializeDataIfNeeded)(r,u),{url:(0,ar.toPathString)(s),options:u}})}},"OpenFgaApiAxiosParamCreator");ws.OpenFgaApiAxiosParamCreator=KRn;var WRn=a(function(e,t){let r=(0,ws.OpenFgaApiAxiosParamCreator)(e,t);return{check(n,i){return As(this,void 0,void 0,function*(){let s=yield r.check(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},createStore(n,i){return As(this,void 0,void 0,function*(){let s=yield r.createStore(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},deleteStore(n){return As(this,void 0,void 0,function*(){let i=yield r.deleteStore(n);return(0,ar.createRequestFunction)(i,wc.default,e,t)})},expand(n,i){return As(this,void 0,void 0,function*(){let s=yield r.expand(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},getStore(n){return As(this,void 0,void 0,function*(){let i=yield r.getStore(n);return(0,ar.createRequestFunction)(i,wc.default,e,t)})},listObjects(n,i){return As(this,void 0,void 0,function*(){let s=yield r.listObjects(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},listStores(n,i,s){return As(this,void 0,void 0,function*(){let o=yield r.listStores(n,i,s);return(0,ar.createRequestFunction)(o,wc.default,e,t)})},read(n,i){return As(this,void 0,void 0,function*(){let s=yield r.read(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},readAssertions(n,i){return As(this,void 0,void 0,function*(){let s=yield r.readAssertions(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},readAuthorizationModel(n,i){return As(this,void 0,void 0,function*(){let s=yield r.readAuthorizationModel(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},readAuthorizationModels(n,i,s){return As(this,void 0,void 0,function*(){let o=yield r.readAuthorizationModels(n,i,s);return(0,ar.createRequestFunction)(o,wc.default,e,t)})},readChanges(n,i,s,o){return As(this,void 0,void 0,function*(){let u=yield r.readChanges(n,i,s,o);return(0,ar.createRequestFunction)(u,wc.default,e,t)})},write(n,i){return As(this,void 0,void 0,function*(){let s=yield r.write(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})},writeAssertions(n,i,s){return As(this,void 0,void 0,function*(){let o=yield r.writeAssertions(n,i,s);return(0,ar.createRequestFunction)(o,wc.default,e,t)})},writeAuthorizationModel(n,i){return As(this,void 0,void 0,function*(){let s=yield r.writeAuthorizationModel(n,i);return(0,ar.createRequestFunction)(s,wc.default,e,t)})}}},"OpenFgaApiFp");ws.OpenFgaApiFp=WRn;var YRn=a(function(e,t,r){let n=(0,ws.OpenFgaApiFp)(e,t);return{check(i,s){return n.check(i,s).then(o=>o(r))},createStore(i,s){return n.createStore(i,s).then(o=>o(r))},deleteStore(i){return n.deleteStore(i).then(s=>s(r))},expand(i,s){return n.expand(i,s).then(o=>o(r))},getStore(i){return n.getStore(i).then(s=>s(r))},listObjects(i,s){return n.listObjects(i,s).then(o=>o(r))},listStores(i,s,o){return n.listStores(i,s,o).then(u=>u(r))},read(i,s){return n.read(i,s).then(o=>o(r))},readAssertions(i,s){return n.readAssertions(i,s).then(o=>o(r))},readAuthorizationModel(i,s){return n.readAuthorizationModel(i,s).then(o=>o(r))},readAuthorizationModels(i,s,o){return n.readAuthorizationModels(i,s,o).then(u=>u(r))},readChanges(i,s,o,u){return n.readChanges(i,s,o,u).then(l=>l(r))},write(i,s){return n.write(i,s).then(o=>o(r))},writeAssertions(i,s,o){return n.writeAssertions(i,s,o).then(u=>u(r))},writeAuthorizationModel(i,s){return n.writeAuthorizationModel(i,s).then(o=>o(r))}}},"OpenFgaApiFactory");ws.OpenFgaApiFactory=YRn;var uOe=class extends zRn.BaseAPI{static{a(this,"OpenFgaApi")}check(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).check(t,r).then(n=>n(this.axios))}createStore(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).createStore(t,r).then(n=>n(this.axios))}deleteStore(t){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).deleteStore(t).then(r=>r(this.axios))}expand(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).expand(t,r).then(n=>n(this.axios))}getStore(t){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).getStore(t).then(r=>r(this.axios))}listObjects(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).listObjects(t,r).then(n=>n(this.axios))}listStores(t,r,n){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).listStores(t,r,n).then(i=>i(this.axios))}read(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).read(t,r).then(n=>n(this.axios))}readAssertions(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readAssertions(t,r).then(n=>n(this.axios))}readAuthorizationModel(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModel(t,r).then(n=>n(this.axios))}readAuthorizationModels(t,r,n){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModels(t,r,n).then(i=>i(this.axios))}readChanges(t,r,n,i){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).readChanges(t,r,n,i).then(s=>s(this.axios))}write(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).write(t,r).then(n=>n(this.axios))}writeAssertions(t,r,n){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).writeAssertions(t,r,n).then(i=>i(this.axios))}writeAuthorizationModel(t,r){return(0,ws.OpenFgaApiFp)(this.configuration,this.credentials).writeAuthorizationModel(t,r).then(n=>n(this.axios))}};ws.OpenFgaApi=uOe});var tRt=y((n5s,eRt)=>{async function*XRn(e,t,r){let n=new Set;async function i(){let[s,o]=await Promise.race(n);return n.delete(s),o}a(i,"consume");for(let s of t){let o=(async()=>await r(s,t))().then(u=>[o,u]);n.add(o),n.size>=e&&(yield await i())}for(;n.size;)yield await i()}a(XRn,"asyncPool");eRt.exports=XRn});var rRt=y(ng=>{"use strict";var za=ng&&ng.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function u(d){try{c(n.next(d))}catch(p){o(p)}}a(u,"fulfilled");function l(d){try{c(n.throw(d))}catch(p){o(p)}}a(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}a(c,"step"),c((n=n.apply(e,t||[])).next())})},cOe=ng&&ng.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values=="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(o){return new Promise(function(u,l){o=e[s](o),i(u,l,o.done,o.value)})}}function i(s,o,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},o)}};Object.defineProperty(ng,"__esModule",{value:!0});ng.OpenFgaClient=ng.ClientWriteStatus=void 0;var dOe=tRt(),JRn=lOe(),QRn=oOe(),pOe=eC(),yd=eOe(),ZRn=FF(),fOe=10,mP="X-OpenFGA-Client-Method",mOe="X-OpenFGA-Client-Bulk-Request-Id",hP;(function(e){e.SUCCESS="success",e.FAILURE="failure"})(hP||(ng.ClientWriteStatus=hP={}));var hOe=class extends QRn.BaseAPI{static{a(this,"OpenFgaClient")}constructor(t,r){super(t,r),this.axios=r,this.api=new JRn.OpenFgaApi(this.configuration,r),this.authorizationModelId=t.authorizationModelId,this.getAuthorizationModelId()}getAuthorizationModelId(t={}){let r=t?.authorizationModelId||this.authorizationModelId;if(r&&!(0,ZRn.isWellFormedUlidString)(r))throw new pOe.FgaValidationError("authorizationModelId");return r}checkValidApiConnection(t={}){return za(this,void 0,void 0,function*(){this.getAuthorizationModelId(t)?yield this.readAuthorizationModel(t):yield this.readLatestAuthorizationModel(t)})}listStores(t={}){return za(this,void 0,void 0,function*(){return this.api.listStores(t.pageSize,t.continuationToken,t)})}createStore(t,r={}){return za(this,void 0,void 0,function*(){return this.api.createStore(t,r)})}getStore(t={}){return za(this,void 0,void 0,function*(){return this.api.getStore(t)})}deleteStore(t={}){return za(this,void 0,void 0,function*(){return this.api.deleteStore(t)})}readAuthorizationModels(t={}){return za(this,void 0,void 0,function*(){return this.api.readAuthorizationModels(t.pageSize,t.continuationToken,t)})}writeAuthorizationModel(t,r={}){return za(this,void 0,void 0,function*(){return this.api.writeAuthorizationModel(t,r)})}readAuthorizationModel(t={}){return za(this,void 0,void 0,function*(){let r=this.getAuthorizationModelId(t);if(!r)throw new pOe.FgaRequiredParamError("ClientConfiguration","authorizationModelId");return this.api.readAuthorizationModel(r,t)})}readLatestAuthorizationModel(t={}){var r;return za(this,void 0,void 0,function*(){let{headers:n={}}=t;(0,yd.setHeaderIfNotSet)(n,mP,"ReadLatestAuthorizationModel");let i=yield this.readAuthorizationModels(Object.assign(Object.assign({},t),{pageSize:1,headers:n})),s=i;return s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0],delete s.authorization_models,s})}readChanges(t,r={}){return za(this,void 0,void 0,function*(){return this.api.readChanges(t.type,r.pageSize,r.continuationToken,r)})}read(t={},r={}){return za(this,void 0,void 0,function*(){let n={page_size:r.pageSize,continuation_token:r.continuationToken};return(t.user||t.object||t.relation)&&(n.tuple_key=t),this.api.read(n,r)})}write(t,r={}){return za(this,void 0,void 0,function*(){let{transaction:n={},headers:i={}}=r,{maxPerChunk:s=1,maxParallelRequests:o=fOe}=n,{writes:u,deletes:l}=t,c=this.getAuthorizationModelId(r);if(!n?.disable){let d={authorization_model_id:c};return u?.length&&(d.writes={tuple_keys:u}),l?.length&&(d.deletes={tuple_keys:l}),yield this.api.write(d,r),{writes:u?.map(p=>({tuple_key:p,status:hP.SUCCESS}))||[],deletes:l?.map(p=>({tuple_key:p,status:hP.SUCCESS}))||[]}}return Promise.all([(()=>za(this,void 0,void 0,function*(){var d,p,f,m,h,g,_,v;(0,yd.setHeaderIfNotSet)(i,mP,"Write"),(0,yd.setHeaderIfNotSet)(i,mOe,(0,yd.generateRandomIdWithNonUniqueFallback)());let S=[];if(u?.length)try{for(var E=!0,b=cOe(dOe(o,(0,yd.chunkArray)(u,s),R=>this.writeTuples(R,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(I=>({writes:R.map(D=>({tuple_key:D,status:hP.FAILURE,err:I})),deletes:[]})))),A;A=yield b.next(),d=A.done,!d;E=!0){m=A.value,E=!1;let R=m;S.push(R.writes)}}catch(R){p={error:R}}finally{try{!E&&!d&&(f=b.return)&&(yield f.call(b))}finally{if(p)throw p.error}}let C=[];if(l?.length)try{for(var T=!0,O=cOe(dOe(o,(0,yd.chunkArray)(l,s),R=>this.deleteTuples(R,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(I=>({writes:[],deletes:R.map(D=>({tuple_key:D,status:hP.FAILURE,err:I}))})))),P;P=yield O.next(),h=P.done,!h;T=!0){v=P.value,T=!1;let R=v;C.push(R.deletes)}}catch(R){g={error:R}}finally{try{!T&&!h&&(_=O.return)&&(yield _.call(O))}finally{if(g)throw g.error}}return{writes:S.flat(),deletes:C.flat()}}))(),this.checkValidApiConnection(r)]).then(d=>d[0])})}writeTuples(t,r={}){return za(this,void 0,void 0,function*(){let{headers:n={}}=r;return(0,yd.setHeaderIfNotSet)(n,mP,"WriteTuples"),this.write({writes:t},Object.assign(Object.assign({},r),{headers:n}))})}deleteTuples(t,r={}){return za(this,void 0,void 0,function*(){let{headers:n={}}=r;return(0,yd.setHeaderIfNotSet)(n,mP,"DeleteTuples"),this.write({deletes:t},Object.assign(Object.assign({},r),{headers:n}))})}check(t,r={}){return za(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:t.user,relation:t.relation,object:t.object},context:t.context,contextual_tuples:{tuple_keys:t.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(t,r={}){return za(this,void 0,void 0,function*(){return Promise.all([(()=>za(this,void 0,void 0,function*(){var n,i,s,o;let{headers:u={},maxParallelRequests:l=fOe}=r;(0,yd.setHeaderIfNotSet)(u,mP,"BatchCheck"),(0,yd.setHeaderIfNotSet)(u,mOe,(0,yd.generateRandomIdWithNonUniqueFallback)());let c=[];try{for(var d=!0,p=cOe(dOe(l,t,m=>this.check(m,Object.assign(Object.assign({},r),{headers:u})).then(h=>(h._request=m,h)).catch(h=>({allowed:void 0,error:h,_request:m})))),f;f=yield p.next(),n=f.done,!n;d=!0){o=f.value,d=!1;let m=o;c.push(m)}}catch(m){i={error:m}}finally{try{!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(t,r={}){return za(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:t},r)})}listObjects(t,r={}){return za(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:t.user,relation:t.relation,type:t.type,context:t.context,contextual_tuples:{tuple_keys:t.contextualTuples||[]}},r)})}listRelations(t,r={}){return za(this,void 0,void 0,function*(){let{user:n,object:i,relations:s,contextualTuples:o,context:u}=t,{headers:l={},maxParallelRequests:c=fOe}=r;if((0,yd.setHeaderIfNotSet)(l,mP,"ListRelations"),(0,yd.setHeaderIfNotSet)(l,mOe,(0,yd.generateRandomIdWithNonUniqueFallback)()),!s?.length)throw new pOe.FgaValidationError("relations","When calling listRelations, at least one relation must be passed in the relations field");let d=yield this.batchCheck(s.map(f=>({user:n,relation:f,object:i,contextualTuples:o,context:u})),Object.assign(Object.assign({},r),{headers:l,maxParallelRequests:c})),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(t={}){return za(this,void 0,void 0,function*(){return this.api.readAssertions(this.getAuthorizationModelId(t),t)})}writeAssertions(t,r={}){return za(this,void 0,void 0,function*(){return this.api.writeAssertions(this.getAuthorizationModelId(r),{assertions:t.map(n=>({tuple_key:{user:n.user,relation:n.relation,object:n.object},expectation:n.expectation}))},r)})}};ng.OpenFgaClient=hOe});var lRt=y(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});_d.TypeName=_d.TupleOperation=_d.NullValue=_d.NotFoundErrorCode=_d.InternalErrorCode=_d.ErrorCode=void 0;var nRt;(function(e){e.NoError="no_error",e.ValidationError="validation_error",e.AuthorizationModelNotFound="authorization_model_not_found",e.AuthorizationModelResolutionTooComplex="authorization_model_resolution_too_complex",e.InvalidWriteInput="invalid_write_input",e.CannotAllowDuplicateTuplesInOneRequest="cannot_allow_duplicate_tuples_in_one_request",e.CannotAllowDuplicateTypesInOneRequest="cannot_allow_duplicate_types_in_one_request",e.CannotAllowMultipleReferencesToOneRelation="cannot_allow_multiple_references_to_one_relation",e.InvalidContinuationToken="invalid_continuation_token",e.InvalidTupleSet="invalid_tuple_set",e.InvalidCheckInput="invalid_check_input",e.InvalidExpandInput="invalid_expand_input",e.UnsupportedUserSet="unsupported_user_set",e.InvalidObjectFormat="invalid_object_format",e.WriteFailedDueToInvalidInput="write_failed_due_to_invalid_input",e.AuthorizationModelAssertionsNotFound="authorization_model_assertions_not_found",e.LatestAuthorizationModelNotFound="latest_authorization_model_not_found",e.TypeNotFound="type_not_found",e.RelationNotFound="relation_not_found",e.EmptyRelationDefinition="empty_relation_definition",e.InvalidUser="invalid_user",e.InvalidTuple="invalid_tuple",e.UnknownRelation="unknown_relation",e.StoreIdInvalidLength="store_id_invalid_length",e.AssertionsTooManyItems="assertions_too_many_items",e.IdTooLong="id_too_long",e.AuthorizationModelIdTooLong="authorization_model_id_too_long",e.TupleKeyValueNotSpecified="tuple_key_value_not_specified",e.TupleKeysTooManyOrTooFewItems="tuple_keys_too_many_or_too_few_items",e.PageSizeInvalid="page_size_invalid",e.ParamMissingValue="param_missing_value",e.DifferenceBaseMissingValue="difference_base_missing_value",e.SubtractBaseMissingValue="subtract_base_missing_value",e.ObjectTooLong="object_too_long",e.RelationTooLong="relation_too_long",e.TypeDefinitionsTooFewItems="type_definitions_too_few_items",e.TypeInvalidLength="type_invalid_length",e.TypeInvalidPattern="type_invalid_pattern",e.RelationsTooFewItems="relations_too_few_items",e.RelationsTooLong="relations_too_long",e.RelationsInvalidPattern="relations_invalid_pattern",e.ObjectInvalidPattern="object_invalid_pattern",e.QueryStringTypeContinuationTokenMismatch="query_string_type_continuation_token_mismatch",e.ExceededEntityLimit="exceeded_entity_limit",e.InvalidContextualTuple="invalid_contextual_tuple",e.DuplicateContextualTuple="duplicate_contextual_tuple",e.InvalidAuthorizationModel="invalid_authorization_model",e.UnsupportedSchemaVersion="unsupported_schema_version"})(nRt||(_d.ErrorCode=nRt={}));var iRt;(function(e){e.NoInternalError="no_internal_error",e.InternalError="internal_error",e.Cancelled="cancelled",e.DeadlineExceeded="deadline_exceeded",e.AlreadyExists="already_exists",e.ResourceExhausted="resource_exhausted",e.FailedPrecondition="failed_precondition",e.Aborted="aborted",e.OutOfRange="out_of_range",e.Unavailable="unavailable",e.DataLoss="data_loss"})(iRt||(_d.InternalErrorCode=iRt={}));var sRt;(function(e){e.NoNotFoundError="no_not_found_error",e.UndefinedEndpoint="undefined_endpoint",e.StoreIdNotFound="store_id_not_found",e.Unimplemented="unimplemented"})(sRt||(_d.NotFoundErrorCode=sRt={}));var aRt;(function(e){e.NullValue="NULL_VALUE"})(aRt||(_d.NullValue=aRt={}));var oRt;(function(e){e.Write="TUPLE_OPERATION_WRITE",e.Delete="TUPLE_OPERATION_DELETE"})(oRt||(_d.TupleOperation=oRt={}));var uRt;(function(e){e.Unspecified="TYPE_NAME_UNSPECIFIED",e.Any="TYPE_NAME_ANY",e.Bool="TYPE_NAME_BOOL",e.String="TYPE_NAME_STRING",e.Int="TYPE_NAME_INT",e.Uint="TYPE_NAME_UINT",e.Double="TYPE_NAME_DOUBLE",e.Duration="TYPE_NAME_DURATION",e.Timestamp="TYPE_NAME_TIMESTAMP",e.Map="TYPE_NAME_MAP",e.List="TYPE_NAME_LIST",e.Ipaddress="TYPE_NAME_IPADDRESS"})(uRt||(_d.TypeName=uRt={}))});var pRt=y(Au=>{"use strict";var eOn=Au&&Au.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),$J=Au&&Au.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&eOn(t,e,r)};Object.defineProperty(Au,"__esModule",{value:!0});Au.CredentialsMethod=Au.Credentials=Au.GetDefaultRetryParams=Au.Configuration=void 0;$J(lOe(),Au);$J(rRt(),Au);$J(lRt(),Au);var cRt=ZRe();Object.defineProperty(Au,"Configuration",{enumerable:!0,get:function(){return cRt.Configuration}});Object.defineProperty(Au,"GetDefaultRetryParams",{enumerable:!0,get:function(){return cRt.GetDefaultRetryParams}});var dRt=qJ();Object.defineProperty(Au,"Credentials",{enumerable:!0,get:function(){return dRt.Credentials}});Object.defineProperty(Au,"CredentialsMethod",{enumerable:!0,get:function(){return dRt.CredentialsMethod}});$J(eC(),Au)});var mRt=y(gP=>{"use strict";var tOn=gP&&gP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gP,"__esModule",{value:!0});gP.OpenFGAService=void 0;var qF=tOn(sc()),fRt=pRt(),rOn=JO(),nOn="deployer-app@zuplo",gOe=class{static{a(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(t,r){if(!qF.default.OPENFGA_SERVICE_URL)throw new Error("OPENFGA_SERVICE_URL is not set");this.userSub=r&&r.userSub?r.userSub:t.getUserSub(),this.baseUrl=qF.default.OPENFGA_SERVICE_URL,this.apiHost=qF.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,""),this.storeId=qF.default.OPENFGA_STORE_ID,this.modelId=qF.default.OPENFGA_MODEL_ID,this.logger=t.log}async getOpenFgaClient(){if(!this.openFGAClient){let t=await(0,rOn.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new fRt.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:fRt.CredentialsMethod.ApiToken,config:{token:t}}})}return this.openFGAClient}async createAccountMember(t){try{await(await this.getOpenFgaClient()).write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${t}`}]})}catch(r){this.logger.warn(`RBAC failed to create account membership. Error: ${r.message}`)}}async getAccountMemberships(){let r=await(await this.getOpenFgaClient()).listObjects({user:`user:${this.userSub}`,relation:"member",type:"account"});return r?r.objects.map(n=>n.replace(/^(account:)/,"")):[]}async isAccountMember(t){try{let r=await this.getOpenFgaClient(),{allowed:n}=await r.check({user:`user:${this.userSub}`,relation:"member",object:`account:${t}`});return n||!1}catch(r){return this.logger.warn(`RBAC failed to check account membership. Error: ${r.message}`),!1}}async isZuploAdmin(){try{let t=await this.getOpenFgaClient(),{tuples:r}=await t.read({object:"role:zuplo-admin"}),n=[];return r.forEach(i=>{let s=i.key.user.replace(/^(user:)/,"");n.push(s)}),n.includes(this.userSub)}catch(t){return this.logger.warn(`RBAC failed to check for zuplo admin. Error: ${t.message}`),!1}}async isDeployerServiceAccount(){try{let t=await this.getOpenFgaClient(),{tuples:r}=await t.read({object:"role:zuplo-deployer"}),n=[];return r.forEach(i=>{let s=i.key.user.replace(/^(user:)/,"");n.push(s)}),n.includes(this.userSub)}catch(t){return this.logger.warn(`RBAC failed to check for zuplo deployer. Error: ${t.message}`),nOn===this.userSub}}async createProjectAccountAssociation(t,r){try{await(await this.getOpenFgaClient()).write({writes:[{user:`account:${t}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to create account-project association. Error: ${n.message}`)}}async deleteProjectAccountAssociation(t,r){try{await(await this.getOpenFgaClient()).write({deletes:[{user:`account:${t}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to delete account-project association. Error: ${n.message}`)}}};gP.OpenFGAService=gOe});var yRt=y(yP=>{"use strict";var gRt=yP&&yP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yP,"__esModule",{value:!0});yP.TenantService=void 0;var iOn=gRt(Lm()),hRt=gRt(sc()),sOn=wF(),aOn=new iOn.default({max:500,maxAge:1e3*60*50}),yOe=class extends sOn.ApiServiceClient{static{a(this,"TenantService")}constructor(t,r){if(!hRt.default.TENANT_API_URL)throw new Error("TENANT_API_URL is not set");let n=r&&r.userSub?r.userSub:t.getUserSub();super(hRt.default.TENANT_API_URL,aOn,{userSub:n,logger:t.log,requestId:t.id})}};yP.TenantService=yOe});var _Rt=y(ig=>{"use strict";Object.defineProperty(ig,"__esModule",{value:!0});ig.validateHostname=ig.kebabCase=ig.snakeCase=ig.sizeInBytes=void 0;function oOn(e){return new TextEncoder().encode(JSON.stringify(e)).length}a(oOn,"sizeInBytes");ig.sizeInBytes=oOn;function uOn(e){return!e||e===null?"":e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(t=>t.toLowerCase()).join("_")}a(uOn,"snakeCase");ig.snakeCase=uOn;function lOn(e){if(!e||e===null)return"";let t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t===null?"":t.map(r=>r.toLowerCase()).join("-")}a(lOn,"kebabCase");ig.kebabCase=lOn;function cOn(e){try{return!(e&&!/^(?!https?:\/\/)([a-zA-Z0-9.-]*|(\*))*\.[a-zA-Z]+$/.test(e))}catch{}return!1}a(cOn,"validateHostname");ig.validateHostname=cOn});var bRt=y(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.Type=_e.JsonType=_e.JavaScriptTypeBuilder=_e.JsonTypeBuilder=_e.TypeBuilder=_e.TypeBuilderError=_e.TransformEncodeBuilder=_e.TransformDecodeBuilder=_e.TemplateLiteralDslParser=_e.TemplateLiteralGenerator=_e.TemplateLiteralGeneratorError=_e.TemplateLiteralFinite=_e.TemplateLiteralFiniteError=_e.TemplateLiteralParser=_e.TemplateLiteralParserError=_e.TemplateLiteralResolver=_e.TemplateLiteralPattern=_e.TemplateLiteralPatternError=_e.UnionResolver=_e.KeyArrayResolver=_e.KeyArrayResolverError=_e.KeyResolver=_e.ObjectMap=_e.Intrinsic=_e.IndexedAccessor=_e.TypeClone=_e.TypeExtends=_e.TypeExtendsResult=_e.TypeExtendsError=_e.ExtendsUndefined=_e.TypeGuard=_e.TypeGuardUnknownTypeError=_e.ValueGuard=_e.FormatRegistry=_e.TypeBoxError=_e.TypeRegistry=_e.PatternStringExact=_e.PatternNumberExact=_e.PatternBooleanExact=_e.PatternString=_e.PatternNumber=_e.PatternBoolean=_e.Kind=_e.Hint=_e.Optional=_e.Readonly=_e.Transform=void 0;_e.Transform=Symbol.for("TypeBox.Transform");_e.Readonly=Symbol.for("TypeBox.Readonly");_e.Optional=Symbol.for("TypeBox.Optional");_e.Hint=Symbol.for("TypeBox.Hint");_e.Kind=Symbol.for("TypeBox.Kind");_e.PatternBoolean="(true|false)";_e.PatternNumber="(0|[1-9][0-9]*)";_e.PatternString="(.*)";_e.PatternBooleanExact=`^${_e.PatternBoolean}$`;_e.PatternNumberExact=`^${_e.PatternNumber}$`;_e.PatternStringExact=`^${_e.PatternString}$`;var _Oe;(function(e){let t=new Map;function r(){return new Map(t)}a(r,"Entries"),e.Entries=r;function n(){return t.clear()}a(n,"Clear"),e.Clear=n;function i(l){return t.delete(l)}a(i,"Delete"),e.Delete=i;function s(l){return t.has(l)}a(s,"Has"),e.Has=s;function o(l,c){t.set(l,c)}a(o,"Set"),e.Set=o;function u(l){return t.get(l)}a(u,"Get"),e.Get=u})(_Oe||(_e.TypeRegistry=_Oe={}));var hh=class extends Error{static{a(this,"TypeBoxError")}constructor(t){super(t)}};_e.TypeBoxError=hh;var vRt;(function(e){let t=new Map;function r(){return new Map(t)}a(r,"Entries"),e.Entries=r;function n(){return t.clear()}a(n,"Clear"),e.Clear=n;function i(l){return t.delete(l)}a(i,"Delete"),e.Delete=i;function s(l){return t.has(l)}a(s,"Has"),e.Has=s;function o(l,c){t.set(l,c)}a(o,"Set"),e.Set=o;function u(l){return t.get(l)}a(u,"Get"),e.Get=u})(vRt||(_e.FormatRegistry=vRt={}));var Jt;(function(e){function t(c){return Array.isArray(c)}a(t,"IsArray"),e.IsArray=t;function r(c){return typeof c=="bigint"}a(r,"IsBigInt"),e.IsBigInt=r;function n(c){return typeof c=="boolean"}a(n,"IsBoolean"),e.IsBoolean=n;function i(c){return c===null}a(i,"IsNull"),e.IsNull=i;function s(c){return typeof c=="number"}a(s,"IsNumber"),e.IsNumber=s;function o(c){return typeof c=="object"&&c!==null}a(o,"IsObject"),e.IsObject=o;function u(c){return typeof c=="string"}a(u,"IsString"),e.IsString=u;function l(c){return c===void 0}a(l,"IsUndefined"),e.IsUndefined=l})(Jt||(_e.ValueGuard=Jt={}));var vOe=class extends hh{static{a(this,"TypeGuardUnknownTypeError")}};_e.TypeGuardUnknownTypeError=vOe;var Ee;(function(e){function t(L){try{return new RegExp(L),!0}catch{return!1}}a(t,"IsPattern");function r(L){if(!Jt.IsString(L))return!1;for(let Se=0;Se<L.length;Se++){let Le=L.charCodeAt(Se);if(Le>=7&&Le<=13||Le===27||Le===127)return!1}return!0}a(r,"IsControlCharacterFree");function n(L){return o(L)||se(L)}a(n,"IsAdditionalProperties");function i(L){return Jt.IsUndefined(L)||Jt.IsBigInt(L)}a(i,"IsOptionalBigInt");function s(L){return Jt.IsUndefined(L)||Jt.IsNumber(L)}a(s,"IsOptionalNumber");function o(L){return Jt.IsUndefined(L)||Jt.IsBoolean(L)}a(o,"IsOptionalBoolean");function u(L){return Jt.IsUndefined(L)||Jt.IsString(L)}a(u,"IsOptionalString");function l(L){return Jt.IsUndefined(L)||Jt.IsString(L)&&r(L)&&t(L)}a(l,"IsOptionalPattern");function c(L){return Jt.IsUndefined(L)||Jt.IsString(L)&&r(L)}a(c,"IsOptionalFormat");function d(L){return Jt.IsUndefined(L)||se(L)}a(d,"IsOptionalSchema");function p(L){return C(L,"Any")&&u(L.$id)}a(p,"TAny"),e.TAny=p;function f(L){return C(L,"Array")&&L.type==="array"&&u(L.$id)&&se(L.items)&&s(L.minItems)&&s(L.maxItems)&&o(L.uniqueItems)&&d(L.contains)&&s(L.minContains)&&s(L.maxContains)}a(f,"TArray"),e.TArray=f;function m(L){return C(L,"AsyncIterator")&&L.type==="AsyncIterator"&&u(L.$id)&&se(L.items)}a(m,"TAsyncIterator"),e.TAsyncIterator=m;function h(L){return C(L,"BigInt")&&L.type==="bigint"&&u(L.$id)&&i(L.exclusiveMaximum)&&i(L.exclusiveMinimum)&&i(L.maximum)&&i(L.minimum)&&i(L.multipleOf)}a(h,"TBigInt"),e.TBigInt=h;function g(L){return C(L,"Boolean")&&L.type==="boolean"&&u(L.$id)}a(g,"TBoolean"),e.TBoolean=g;function _(L){return C(L,"Constructor")&&L.type==="constructor"&&u(L.$id)&&Jt.IsArray(L.parameters)&&L.parameters.every(Se=>se(Se))&&se(L.returns)}a(_,"TConstructor"),e.TConstructor=_;function v(L){return C(L,"Date")&&L.type==="Date"&&u(L.$id)&&s(L.exclusiveMaximumTimestamp)&&s(L.exclusiveMinimumTimestamp)&&s(L.maximumTimestamp)&&s(L.minimumTimestamp)&&s(L.multipleOfTimestamp)}a(v,"TDate"),e.TDate=v;function S(L){return C(L,"Function")&&L.type==="function"&&u(L.$id)&&Jt.IsArray(L.parameters)&&L.parameters.every(Se=>se(Se))&&se(L.returns)}a(S,"TFunction"),e.TFunction=S;function E(L){return C(L,"Integer")&&L.type==="integer"&&u(L.$id)&&s(L.exclusiveMaximum)&&s(L.exclusiveMinimum)&&s(L.maximum)&&s(L.minimum)&&s(L.multipleOf)}a(E,"TInteger"),e.TInteger=E;function b(L){return C(L,"Intersect")&&!(Jt.IsString(L.type)&&L.type!=="object")&&Jt.IsArray(L.allOf)&&L.allOf.every(Se=>se(Se)&&!De(Se))&&u(L.type)&&(o(L.unevaluatedProperties)||d(L.unevaluatedProperties))&&u(L.$id)}a(b,"TIntersect"),e.TIntersect=b;function A(L){return C(L,"Iterator")&&L.type==="Iterator"&&u(L.$id)&&se(L.items)}a(A,"TIterator"),e.TIterator=A;function C(L,Se){return T(L)&&L[_e.Kind]===Se}a(C,"TKindOf"),e.TKindOf=C;function T(L){return Jt.IsObject(L)&&_e.Kind in L&&Jt.IsString(L[_e.Kind])}a(T,"TKind"),e.TKind=T;function O(L){return I(L)&&Jt.IsString(L.const)}a(O,"TLiteralString"),e.TLiteralString=O;function P(L){return I(L)&&Jt.IsNumber(L.const)}a(P,"TLiteralNumber"),e.TLiteralNumber=P;function R(L){return I(L)&&Jt.IsBoolean(L.const)}a(R,"TLiteralBoolean"),e.TLiteralBoolean=R;function I(L){return C(L,"Literal")&&u(L.$id)&&(Jt.IsBoolean(L.const)||Jt.IsNumber(L.const)||Jt.IsString(L.const))}a(I,"TLiteral"),e.TLiteral=I;function D(L){return C(L,"Never")&&Jt.IsObject(L.not)&&Object.getOwnPropertyNames(L.not).length===0}a(D,"TNever"),e.TNever=D;function U(L){return C(L,"Not")&&se(L.not)}a(U,"TNot"),e.TNot=U;function te(L){return C(L,"Null")&&L.type==="null"&&u(L.$id)}a(te,"TNull"),e.TNull=te;function ve(L){return C(L,"Number")&&L.type==="number"&&u(L.$id)&&s(L.exclusiveMaximum)&&s(L.exclusiveMinimum)&&s(L.maximum)&&s(L.minimum)&&s(L.multipleOf)}a(ve,"TNumber"),e.TNumber=ve;function me(L){return C(L,"Object")&&L.type==="object"&&u(L.$id)&&Jt.IsObject(L.properties)&&n(L.additionalProperties)&&s(L.minProperties)&&s(L.maxProperties)&&Object.entries(L.properties).every(([Se,Le])=>r(Se)&&se(Le))}a(me,"TObject"),e.TObject=me;function he(L){return C(L,"Promise")&&L.type==="Promise"&&u(L.$id)&&se(L.item)}a(he,"TPromise"),e.TPromise=he;function Fe(L){return C(L,"Record")&&L.type==="object"&&u(L.$id)&&n(L.additionalProperties)&&Jt.IsObject(L.patternProperties)&&(Se=>{let Le=Object.getOwnPropertyNames(Se.patternProperties);return Le.length===1&&t(Le[0])&&Jt.IsObject(Se.patternProperties)&&se(Se.patternProperties[Le[0]])})(L)}a(Fe,"TRecord"),e.TRecord=Fe;function Oe(L){return Jt.IsObject(L)&&_e.Hint in L&&L[_e.Hint]==="Recursive"}a(Oe,"TRecursive"),e.TRecursive=Oe;function M(L){return C(L,"Ref")&&u(L.$id)&&Jt.IsString(L.$ref)}a(M,"TRef"),e.TRef=M;function Z(L){return C(L,"String")&&L.type==="string"&&u(L.$id)&&s(L.minLength)&&s(L.maxLength)&&l(L.pattern)&&c(L.format)}a(Z,"TString"),e.TString=Z;function fe(L){return C(L,"Symbol")&&L.type==="symbol"&&u(L.$id)}a(fe,"TSymbol"),e.TSymbol=fe;function B(L){return C(L,"TemplateLiteral")&&L.type==="string"&&Jt.IsString(L.pattern)&&L.pattern[0]==="^"&&L.pattern[L.pattern.length-1]==="$"}a(B,"TTemplateLiteral"),e.TTemplateLiteral=B;function ye(L){return C(L,"This")&&u(L.$id)&&Jt.IsString(L.$ref)}a(ye,"TThis"),e.TThis=ye;function De(L){return Jt.IsObject(L)&&_e.Transform in L}a(De,"TTransform"),e.TTransform=De;function $e(L){return C(L,"Tuple")&&L.type==="array"&&u(L.$id)&&Jt.IsNumber(L.minItems)&&Jt.IsNumber(L.maxItems)&&L.minItems===L.maxItems&&(Jt.IsUndefined(L.items)&&Jt.IsUndefined(L.additionalItems)&&L.minItems===0||Jt.IsArray(L.items)&&L.items.every(Se=>se(Se)))}a($e,"TTuple"),e.TTuple=$e;function gt(L){return C(L,"Undefined")&&L.type==="undefined"&&u(L.$id)}a(gt,"TUndefined"),e.TUndefined=gt;function ot(L){return F(L)&&L.anyOf.every(Se=>O(Se)||P(Se))}a(ot,"TUnionLiteral"),e.TUnionLiteral=ot;function F(L){return C(L,"Union")&&u(L.$id)&&Jt.IsObject(L)&&Jt.IsArray(L.anyOf)&&L.anyOf.every(Se=>se(Se))}a(F,"TUnion"),e.TUnion=F;function G(L){return C(L,"Uint8Array")&&L.type==="Uint8Array"&&u(L.$id)&&s(L.minByteLength)&&s(L.maxByteLength)}a(G,"TUint8Array"),e.TUint8Array=G;function $(L){return C(L,"Unknown")&&u(L.$id)}a($,"TUnknown"),e.TUnknown=$;function W(L){return C(L,"Unsafe")}a(W,"TUnsafe"),e.TUnsafe=W;function pe(L){return C(L,"Void")&&L.type==="void"&&u(L.$id)}a(pe,"TVoid"),e.TVoid=pe;function H(L){return Jt.IsObject(L)&&L[_e.Readonly]==="Readonly"}a(H,"TReadonly"),e.TReadonly=H;function de(L){return Jt.IsObject(L)&&L[_e.Optional]==="Optional"}a(de,"TOptional"),e.TOptional=de;function se(L){return Jt.IsObject(L)&&(p(L)||f(L)||g(L)||h(L)||m(L)||_(L)||v(L)||S(L)||E(L)||b(L)||A(L)||I(L)||D(L)||U(L)||te(L)||ve(L)||me(L)||he(L)||Fe(L)||M(L)||Z(L)||fe(L)||B(L)||ye(L)||$e(L)||gt(L)||F(L)||G(L)||$(L)||W(L)||pe(L)||T(L)&&_Oe.Has(L[_e.Kind]))}a(se,"TSchema"),e.TSchema=se})(Ee||(_e.TypeGuard=Ee={}));var ERt;(function(e){function t(r){return r[_e.Kind]==="Intersect"?r.allOf.every(n=>t(n)):r[_e.Kind]==="Union"?r.anyOf.some(n=>t(n)):r[_e.Kind]==="Undefined"?!0:r[_e.Kind]==="Not"?!t(r.not):!1}a(t,"Check"),e.Check=t})(ERt||(_e.ExtendsUndefined=ERt={}));var jJ=class extends hh{static{a(this,"TypeExtendsError")}};_e.TypeExtendsError=jJ;var at;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(at||(_e.TypeExtendsResult=at={}));var rC;(function(e){function t(N){return N===at.False?N:at.True}a(t,"IntoBooleanResult");function r(N){throw new jJ(N)}a(r,"Throw");function n(N){return Ee.TNever(N)||Ee.TIntersect(N)||Ee.TUnion(N)||Ee.TUnknown(N)||Ee.TAny(N)}a(n,"IsStructuralRight");function i(N,k){return Ee.TNever(k)?C(N,k):Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)?Mt(N,k):Ee.TUnknown(k)?Ur(N,k):Ee.TAny(k)?s(N,k):r("StructuralRight")}a(i,"StructuralRight");function s(N,k){return at.True}a(s,"TAnyRight");function o(N,k){return Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)&&k.anyOf.some(Ae=>Ee.TAny(Ae)||Ee.TUnknown(Ae))?at.True:Ee.TUnion(k)?at.Union:Ee.TUnknown(k)||Ee.TAny(k)?at.True:at.Union}a(o,"TAny");function u(N,k){return Ee.TUnknown(N)?at.False:Ee.TAny(N)?at.Union:Ee.TNever(N)?at.True:at.False}a(u,"TArrayRight");function l(N,k){return Ee.TObject(k)&&B(k)?at.True:n(k)?i(N,k):Ee.TArray(k)?t(J(N.items,k.items)):at.False}a(l,"TArray");function c(N,k){return n(k)?i(N,k):Ee.TAsyncIterator(k)?t(J(N.items,k.items)):at.False}a(c,"TAsyncIterator");function d(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TBigInt(k)?at.True:at.False}a(d,"TBigInt");function p(N,k){return Ee.TLiteral(N)&&Jt.IsBoolean(N.const)||Ee.TBoolean(N)?at.True:at.False}a(p,"TBooleanRight");function f(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TBoolean(k)?at.True:at.False}a(f,"TBoolean");function m(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TConstructor(k)?N.parameters.length>k.parameters.length?at.False:N.parameters.every((Ae,Me)=>t(J(k.parameters[Me],Ae))===at.True)?t(J(N.returns,k.returns)):at.False:at.False}a(m,"TConstructor");function h(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TDate(k)?at.True:at.False}a(h,"TDate");function g(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TFunction(k)?N.parameters.length>k.parameters.length?at.False:N.parameters.every((Ae,Me)=>t(J(k.parameters[Me],Ae))===at.True)?t(J(N.returns,k.returns)):at.False:at.False}a(g,"TFunction");function _(N,k){return Ee.TLiteral(N)&&Jt.IsNumber(N.const)||Ee.TNumber(N)||Ee.TInteger(N)?at.True:at.False}a(_,"TIntegerRight");function v(N,k){return Ee.TInteger(k)||Ee.TNumber(k)?at.True:n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):at.False}a(v,"TInteger");function S(N,k){return k.allOf.every(Ae=>J(N,Ae)===at.True)?at.True:at.False}a(S,"TIntersectRight");function E(N,k){return N.allOf.some(Ae=>J(Ae,k)===at.True)?at.True:at.False}a(E,"TIntersect");function b(N,k){return n(k)?i(N,k):Ee.TIterator(k)?t(J(N.items,k.items)):at.False}a(b,"TIterator");function A(N,k){return Ee.TLiteral(k)&&k.const===N.const?at.True:n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TString(k)?pe(N,k):Ee.TNumber(k)?I(N,k):Ee.TInteger(k)?_(N,k):Ee.TBoolean(k)?p(N,k):at.False}a(A,"TLiteral");function C(N,k){return at.False}a(C,"TNeverRight");function T(N,k){return at.True}a(T,"TNever");function O(N){let[k,Ae]=[N,0];for(;Ee.TNot(k);)k=k.not,Ae+=1;return Ae%2===0?k:_e.Type.Unknown()}a(O,"UnwrapTNot");function P(N,k){return Ee.TNot(N)?J(O(N),k):Ee.TNot(k)?J(N,O(k)):r("Invalid fallthrough for Not")}a(P,"TNot");function R(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TNull(k)?at.True:at.False}a(R,"TNull");function I(N,k){return Ee.TLiteralNumber(N)||Ee.TNumber(N)||Ee.TInteger(N)?at.True:at.False}a(I,"TNumberRight");function D(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TInteger(k)||Ee.TNumber(k)?at.True:at.False}a(D,"TNumber");function U(N,k){return Object.getOwnPropertyNames(N.properties).length===k}a(U,"IsObjectPropertyCount");function te(N){return B(N)}a(te,"IsObjectStringLike");function ve(N){return U(N,0)||U(N,1)&&"description"in N.properties&&Ee.TUnion(N.properties.description)&&N.properties.description.anyOf.length===2&&(Ee.TString(N.properties.description.anyOf[0])&&Ee.TUndefined(N.properties.description.anyOf[1])||Ee.TString(N.properties.description.anyOf[1])&&Ee.TUndefined(N.properties.description.anyOf[0]))}a(ve,"IsObjectSymbolLike");function me(N){return U(N,0)}a(me,"IsObjectNumberLike");function he(N){return U(N,0)}a(he,"IsObjectBooleanLike");function Fe(N){return U(N,0)}a(Fe,"IsObjectBigIntLike");function Oe(N){return U(N,0)}a(Oe,"IsObjectDateLike");function M(N){return B(N)}a(M,"IsObjectUint8ArrayLike");function Z(N){let k=_e.Type.Number();return U(N,0)||U(N,1)&&"length"in N.properties&&t(J(N.properties.length,k))===at.True}a(Z,"IsObjectFunctionLike");function fe(N){return U(N,0)}a(fe,"IsObjectConstructorLike");function B(N){let k=_e.Type.Number();return U(N,0)||U(N,1)&&"length"in N.properties&&t(J(N.properties.length,k))===at.True}a(B,"IsObjectArrayLike");function ye(N){let k=_e.Type.Function([_e.Type.Any()],_e.Type.Any());return U(N,0)||U(N,1)&&"then"in N.properties&&t(J(N.properties.then,k))===at.True}a(ye,"IsObjectPromiseLike");function De(N,k){return J(N,k)===at.False||Ee.TOptional(N)&&!Ee.TOptional(k)?at.False:at.True}a(De,"Property");function $e(N,k){return Ee.TUnknown(N)?at.False:Ee.TAny(N)?at.Union:Ee.TNever(N)||Ee.TLiteralString(N)&&te(k)||Ee.TLiteralNumber(N)&&me(k)||Ee.TLiteralBoolean(N)&&he(k)||Ee.TSymbol(N)&&ve(k)||Ee.TBigInt(N)&&Fe(k)||Ee.TString(N)&&te(k)||Ee.TSymbol(N)&&ve(k)||Ee.TNumber(N)&&me(k)||Ee.TInteger(N)&&me(k)||Ee.TBoolean(N)&&he(k)||Ee.TUint8Array(N)&&M(k)||Ee.TDate(N)&&Oe(k)||Ee.TConstructor(N)&&fe(k)||Ee.TFunction(N)&&Z(k)?at.True:Ee.TRecord(N)&&Ee.TString(F(N))?(()=>k[_e.Hint]==="Record"?at.True:at.False)():Ee.TRecord(N)&&Ee.TNumber(F(N))?(()=>U(k,0)?at.True:at.False)():at.False}a($e,"TObjectRight");function gt(N,k){return n(k)?i(N,k):Ee.TRecord(k)?$(N,k):Ee.TObject(k)?(()=>{for(let Ae of Object.getOwnPropertyNames(k.properties))if(!(Ae in N.properties)||De(N.properties[Ae],k.properties[Ae])===at.False)return at.False;return at.True})():at.False}a(gt,"TObject");function ot(N,k){return n(k)?i(N,k):Ee.TObject(k)&&ye(k)?at.True:Ee.TPromise(k)?t(J(N.item,k.item)):at.False}a(ot,"TPromise");function F(N){return _e.PatternNumberExact in N.patternProperties?_e.Type.Number():_e.PatternStringExact in N.patternProperties?_e.Type.String():r("Unknown record key pattern")}a(F,"RecordKey");function G(N){return _e.PatternNumberExact in N.patternProperties?N.patternProperties[_e.PatternNumberExact]:_e.PatternStringExact in N.patternProperties?N.patternProperties[_e.PatternStringExact]:r("Unable to get record value schema")}a(G,"RecordValue");function $(N,k){let[Ae,Me]=[F(k),G(k)];return Ee.TLiteralString(N)&&Ee.TNumber(Ae)&&t(J(N,Me))===at.True?at.True:Ee.TUint8Array(N)&&Ee.TNumber(Ae)||Ee.TString(N)&&Ee.TNumber(Ae)||Ee.TArray(N)&&Ee.TNumber(Ae)?J(N,Me):Ee.TObject(N)?(()=>{for(let et of Object.getOwnPropertyNames(N.properties))if(De(Me,N.properties[et])===at.False)return at.False;return at.True})():at.False}a($,"TRecordRight");function W(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?J(G(N),G(k)):at.False}a(W,"TRecord");function pe(N,k){return Ee.TLiteral(N)&&Jt.IsString(N.const)||Ee.TString(N)?at.True:at.False}a(pe,"TStringRight");function H(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TString(k)?at.True:at.False}a(H,"TString");function de(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TSymbol(k)?at.True:at.False}a(de,"TSymbol");function se(N,k){return Ee.TTemplateLiteral(N)?J(xy.Resolve(N),k):Ee.TTemplateLiteral(k)?J(N,xy.Resolve(k)):r("Invalid fallthrough for TemplateLiteral")}a(se,"TTemplateLiteral");function L(N,k){return Ee.TArray(k)&&N.items!==void 0&&N.items.every(Ae=>J(Ae,k.items)===at.True)}a(L,"IsArrayOfTuple");function Se(N,k){return Ee.TNever(N)?at.True:Ee.TUnknown(N)?at.False:Ee.TAny(N)?at.Union:at.False}a(Se,"TTupleRight");function Le(N,k){return n(k)?i(N,k):Ee.TObject(k)&&B(k)||Ee.TArray(k)&&L(N,k)?at.True:Ee.TTuple(k)?Jt.IsUndefined(N.items)&&!Jt.IsUndefined(k.items)||!Jt.IsUndefined(N.items)&&Jt.IsUndefined(k.items)?at.False:Jt.IsUndefined(N.items)&&!Jt.IsUndefined(k.items)||N.items.every((Ae,Me)=>J(Ae,k.items[Me])===at.True)?at.True:at.False:at.False}a(Le,"TTuple");function Ke(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TUint8Array(k)?at.True:at.False}a(Ke,"TUint8Array");function St(N,k){return n(k)?i(N,k):Ee.TObject(k)?$e(N,k):Ee.TRecord(k)?$(N,k):Ee.TVoid(k)?j(N,k):Ee.TUndefined(k)?at.True:at.False}a(St,"TUndefined");function Mt(N,k){return k.anyOf.some(Ae=>J(N,Ae)===at.True)?at.True:at.False}a(Mt,"TUnionRight");function vr(N,k){return N.anyOf.every(Ae=>J(Ae,k)===at.True)?at.True:at.False}a(vr,"TUnion");function Ur(N,k){return at.True}a(Ur,"TUnknownRight");function Ve(N,k){return Ee.TNever(k)?C(N,k):Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)?Mt(N,k):Ee.TAny(k)?s(N,k):Ee.TString(k)?pe(N,k):Ee.TNumber(k)?I(N,k):Ee.TInteger(k)?_(N,k):Ee.TBoolean(k)?p(N,k):Ee.TArray(k)?u(N,k):Ee.TTuple(k)?Se(N,k):Ee.TObject(k)?$e(N,k):Ee.TUnknown(k)?at.True:at.False}a(Ve,"TUnknown");function j(N,k){return Ee.TUndefined(N)||Ee.TUndefined(N)?at.True:at.False}a(j,"VoidRight");function q(N,k){return Ee.TIntersect(k)?S(N,k):Ee.TUnion(k)?Mt(N,k):Ee.TUnknown(k)?Ur(N,k):Ee.TAny(k)?s(N,k):Ee.TObject(k)?$e(N,k):Ee.TVoid(k)?at.True:at.False}a(q,"TVoid");function J(N,k){return Ee.TTemplateLiteral(N)||Ee.TTemplateLiteral(k)?se(N,k):Ee.TNot(N)||Ee.TNot(k)?P(N,k):Ee.TAny(N)?o(N,k):Ee.TArray(N)?l(N,k):Ee.TBigInt(N)?d(N,k):Ee.TBoolean(N)?f(N,k):Ee.TAsyncIterator(N)?c(N,k):Ee.TConstructor(N)?m(N,k):Ee.TDate(N)?h(N,k):Ee.TFunction(N)?g(N,k):Ee.TInteger(N)?v(N,k):Ee.TIntersect(N)?E(N,k):Ee.TIterator(N)?b(N,k):Ee.TLiteral(N)?A(N,k):Ee.TNever(N)?T(N,k):Ee.TNull(N)?R(N,k):Ee.TNumber(N)?D(N,k):Ee.TObject(N)?gt(N,k):Ee.TRecord(N)?W(N,k):Ee.TString(N)?H(N,k):Ee.TSymbol(N)?de(N,k):Ee.TTuple(N)?Le(N,k):Ee.TPromise(N)?ot(N,k):Ee.TUint8Array(N)?Ke(N,k):Ee.TUndefined(N)?St(N,k):Ee.TUnion(N)?vr(N,k):Ee.TUnknown(N)?Ve(N,k):Ee.TVoid(N)?q(N,k):r(`Unknown left type operand '${N[_e.Kind]}'`)}a(J,"Visit");function ae(N,k){return J(N,k)}a(ae,"Extends"),e.Extends=ae})(rC||(_e.TypeExtends=rC={}));var Rr;(function(e){function t(o){let u=Object.getOwnPropertyNames(o).reduce((c,d)=>({...c,[d]:n(o[d])}),{}),l=Object.getOwnPropertySymbols(o).reduce((c,d)=>({...c,[d]:n(o[d])}),{});return{...u,...l}}a(t,"ObjectType");function r(o){return o.map(u=>n(u))}a(r,"ArrayType");function n(o){return Jt.IsArray(o)?r(o):Jt.IsObject(o)?t(o):o}a(n,"Visit");function i(o){return o.map(u=>s(u))}a(i,"Rest"),e.Rest=i;function s(o,u={}){return{...n(o),...u}}a(s,"Type"),e.Type=s})(Rr||(_e.TypeClone=Rr={}));var EOe;(function(e){function t(m){return m.map(h=>{let{[_e.Optional]:g,..._}=Rr.Type(h);return _})}a(t,"OptionalUnwrap");function r(m){return m.every(h=>Ee.TOptional(h))}a(r,"IsIntersectOptional");function n(m){return m.some(h=>Ee.TOptional(h))}a(n,"IsUnionOptional");function i(m){return r(m.allOf)?_e.Type.Optional(_e.Type.Intersect(t(m.allOf))):m}a(i,"ResolveIntersect");function s(m){return n(m.anyOf)?_e.Type.Optional(_e.Type.Union(t(m.anyOf))):m}a(s,"ResolveUnion");function o(m){return m[_e.Kind]==="Intersect"?i(m):m[_e.Kind]==="Union"?s(m):m}a(o,"ResolveOptional");function u(m,h){let g=m.allOf.reduce((_,v)=>{let S=p(v,h);return S[_e.Kind]==="Never"?_:[..._,S]},[]);return o(_e.Type.Intersect(g))}a(u,"TIntersect");function l(m,h){let g=m.anyOf.map(_=>p(_,h));return o(_e.Type.Union(g))}a(l,"TUnion");function c(m,h){let g=m.properties[h];return Jt.IsUndefined(g)?_e.Type.Never():_e.Type.Union([g])}a(c,"TObject");function d(m,h){let g=m.items;if(Jt.IsUndefined(g))return _e.Type.Never();let _=g[h];return Jt.IsUndefined(_)?_e.Type.Never():_}a(d,"TTuple");function p(m,h){return m[_e.Kind]==="Intersect"?u(m,h):m[_e.Kind]==="Union"?l(m,h):m[_e.Kind]==="Object"?c(m,h):m[_e.Kind]==="Tuple"?d(m,h):_e.Type.Never()}a(p,"Visit");function f(m,h,g={}){let _=h.map(v=>p(m,v.toString()));return o(_e.Type.Union(_,g))}a(f,"Resolve"),e.Resolve=f})(EOe||(_e.IndexedAccessor=EOe={}));var _P;(function(e){function t(d){let[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toLowerCase()}${f}`}a(t,"Uncapitalize");function r(d){let[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toUpperCase()}${f}`}a(r,"Capitalize");function n(d){return d.toUpperCase()}a(n,"Uppercase");function i(d){return d.toLowerCase()}a(i,"Lowercase");function s(d,p){let f=EP.ParseExact(d.pattern);if(!bP.Check(f))return{...d,pattern:o(d.pattern,p)};let g=[...SP.Generate(f)].map(S=>_e.Type.Literal(S)),_=u(g,p),v=_e.Type.Union(_);return _e.Type.TemplateLiteral([v])}a(s,"IntrinsicTemplateLiteral");function o(d,p){return typeof d=="string"?p==="Uncapitalize"?t(d):p==="Capitalize"?r(d):p==="Uppercase"?n(d):p==="Lowercase"?i(d):d:d.toString()}a(o,"IntrinsicLiteral");function u(d,p){if(d.length===0)return[];let[f,...m]=d;return[c(f,p),...u(m,p)]}a(u,"IntrinsicRest");function l(d,p){return Ee.TTemplateLiteral(d)?s(d,p):Ee.TUnion(d)?_e.Type.Union(u(d.anyOf,p)):Ee.TLiteral(d)?_e.Type.Literal(o(d.const,p)):d}a(l,"Visit");function c(d,p){return l(d,p)}a(c,"Map"),e.Map=c})(_P||(_e.Intrinsic=_P={}));var vP;(function(e){function t(o,u){return _e.Type.Intersect(o.allOf.map(l=>i(l,u)),{...o})}a(t,"TIntersect");function r(o,u){return _e.Type.Union(o.anyOf.map(l=>i(l,u)),{...o})}a(r,"TUnion");function n(o,u){return u(o)}a(n,"TObject");function i(o,u){return o[_e.Kind]==="Intersect"?t(o,u):o[_e.Kind]==="Union"?r(o,u):o[_e.Kind]==="Object"?n(o,u):o}a(i,"Visit");function s(o,u,l){return{...i(Rr.Type(o),u),...l}}a(s,"Map"),e.Map=s})(vP||(_e.ObjectMap=vP={}));var GJ;(function(e){function t(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}a(t,"UnwrapPattern");function r(c,d){return c.allOf.reduce((p,f)=>[...p,...o(f,d)],[])}a(r,"TIntersect");function n(c,d){let p=c.anyOf.map(f=>o(f,d));return[...p.reduce((f,m)=>m.map(h=>p.every(g=>g.includes(h))?f.add(h):f)[0],new Set)]}a(n,"TUnion");function i(c,d){return Object.getOwnPropertyNames(c.properties)}a(i,"TObject");function s(c,d){return d.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}a(s,"TRecord");function o(c,d){return Ee.TIntersect(c)?r(c,d):Ee.TUnion(c)?n(c,d):Ee.TObject(c)?i(c,d):Ee.TRecord(c)?s(c,d):[]}a(o,"Visit");function u(c,d){return[...new Set(o(c,d))]}a(u,"ResolveKeys"),e.ResolveKeys=u;function l(c){return`^(${u(c,{includePatterns:!0}).map(f=>`(${t(f)})`).join("|")})$`}a(l,"ResolvePattern"),e.ResolvePattern=l})(GJ||(_e.KeyResolver=GJ={}));var HJ=class extends hh{static{a(this,"KeyArrayResolverError")}};_e.KeyArrayResolverError=HJ;var UF;(function(e){function t(r){return Array.isArray(r)?r:Ee.TUnionLiteral(r)?r.anyOf.map(n=>n.const.toString()):Ee.TLiteral(r)?[r.const]:Ee.TTemplateLiteral(r)?(()=>{let n=EP.ParseExact(r.pattern);if(!bP.Check(n))throw new HJ("Cannot resolve keys from infinite template expression");return[...SP.Generate(n)]})():[]}a(t,"Resolve"),e.Resolve=t})(UF||(_e.KeyArrayResolver=UF={}));var bOe;(function(e){function*t(n){for(let i of n.anyOf)i[_e.Kind]==="Union"?yield*t(i):yield i}a(t,"TUnion");function r(n){return _e.Type.Union([...t(n)],{...n})}a(r,"Resolve"),e.Resolve=r})(bOe||(_e.UnionResolver=bOe={}));var VJ=class extends hh{static{a(this,"TemplateLiteralPatternError")}};_e.TemplateLiteralPatternError=VJ;var zJ;(function(e){function t(s){throw new VJ(s)}a(t,"Throw");function r(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(r,"Escape");function n(s,o){return Ee.TTemplateLiteral(s)?s.pattern.slice(1,s.pattern.length-1):Ee.TUnion(s)?`(${s.anyOf.map(u=>n(u,o)).join("|")})`:Ee.TNumber(s)?`${o}${_e.PatternNumber}`:Ee.TInteger(s)?`${o}${_e.PatternNumber}`:Ee.TBigInt(s)?`${o}${_e.PatternNumber}`:Ee.TString(s)?`${o}${_e.PatternString}`:Ee.TLiteral(s)?`${o}${r(s.const.toString())}`:Ee.TBoolean(s)?`${o}${_e.PatternBoolean}`:t(`Unexpected Kind '${s[_e.Kind]}'`)}a(n,"Visit");function i(s){return`^${s.map(o=>n(o,"")).join("")}$`}a(i,"Create"),e.Create=i})(zJ||(_e.TemplateLiteralPattern=zJ={}));var xy;(function(e){function t(r){let n=EP.ParseExact(r.pattern);if(!bP.Check(n))return _e.Type.String();let i=[...SP.Generate(n)].map(s=>_e.Type.Literal(s));return _e.Type.Union(i)}a(t,"Resolve"),e.Resolve=t})(xy||(_e.TemplateLiteralResolver=xy={}));var $F=class extends hh{static{a(this,"TemplateLiteralParserError")}};_e.TemplateLiteralParserError=$F;var EP;(function(e){function t(m,h,g){return m[h]===g&&m.charCodeAt(h-1)!==92}a(t,"IsNonEscaped");function r(m,h){return t(m,h,"(")}a(r,"IsOpenParen");function n(m,h){return t(m,h,")")}a(n,"IsCloseParen");function i(m,h){return t(m,h,"|")}a(i,"IsSeparator");function s(m){if(!(r(m,0)&&n(m,m.length-1)))return!1;let h=0;for(let g=0;g<m.length;g++)if(r(m,g)&&(h+=1),n(m,g)&&(h-=1),h===0&&g!==m.length-1)return!1;return!0}a(s,"IsGroup");function o(m){return m.slice(1,m.length-1)}a(o,"InGroup");function u(m){let h=0;for(let g=0;g<m.length;g++)if(r(m,g)&&(h+=1),n(m,g)&&(h-=1),i(m,g)&&h===0)return!0;return!1}a(u,"IsPrecedenceOr");function l(m){for(let h=0;h<m.length;h++)if(r(m,h))return!0;return!1}a(l,"IsPrecedenceAnd");function c(m){let[h,g]=[0,0],_=[];for(let S=0;S<m.length;S++)if(r(m,S)&&(h+=1),n(m,S)&&(h-=1),i(m,S)&&h===0){let E=m.slice(g,S);E.length>0&&_.push(p(E)),g=S+1}let v=m.slice(g);return v.length>0&&_.push(p(v)),_.length===0?{type:"const",const:""}:_.length===1?_[0]:{type:"or",expr:_}}a(c,"Or");function d(m){function h(v,S){if(!r(v,S))throw new $F("TemplateLiteralParser: Index must point to open parens");let E=0;for(let b=S;b<v.length;b++)if(r(v,b)&&(E+=1),n(v,b)&&(E-=1),E===0)return[S,b];throw new $F("TemplateLiteralParser: Unclosed group parens in expression")}a(h,"Group");function g(v,S){for(let E=S;E<v.length;E++)if(r(v,E))return[S,E];return[S,v.length]}a(g,"Range");let _=[];for(let v=0;v<m.length;v++)if(r(m,v)){let[S,E]=h(m,v),b=m.slice(S,E+1);_.push(p(b)),v=E}else{let[S,E]=g(m,v),b=m.slice(S,E);b.length>0&&_.push(p(b)),v=E-1}return _.length===0?{type:"const",const:""}:_.length===1?_[0]:{type:"and",expr:_}}a(d,"And");function p(m){return s(m)?p(o(m)):u(m)?c(m):l(m)?d(m):{type:"const",const:m}}a(p,"Parse"),e.Parse=p;function f(m){return p(m.slice(1,m.length-1))}a(f,"ParseExact"),e.ParseExact=f})(EP||(_e.TemplateLiteralParser=EP={}));var KJ=class extends hh{static{a(this,"TemplateLiteralFiniteError")}};_e.TemplateLiteralFiniteError=KJ;var bP;(function(e){function t(o){throw new KJ(o)}a(t,"Throw");function r(o){return o.type==="or"&&o.expr.length===2&&o.expr[0].type==="const"&&o.expr[0].const==="0"&&o.expr[1].type==="const"&&o.expr[1].const==="[1-9][0-9]*"}a(r,"IsNumber");function n(o){return o.type==="or"&&o.expr.length===2&&o.expr[0].type==="const"&&o.expr[0].const==="true"&&o.expr[1].type==="const"&&o.expr[1].const==="false"}a(n,"IsBoolean");function i(o){return o.type==="const"&&o.const===".*"}a(i,"IsString");function s(o){return n(o)?!0:r(o)||i(o)?!1:o.type==="and"?o.expr.every(u=>s(u)):o.type==="or"?o.expr.every(u=>s(u)):o.type==="const"?!0:t("Unknown expression type")}a(s,"Check"),e.Check=s})(bP||(_e.TemplateLiteralFinite=bP={}));var WJ=class extends hh{static{a(this,"TemplateLiteralGeneratorError")}};_e.TemplateLiteralGeneratorError=WJ;var SP;(function(e){function*t(o){if(o.length===1)return yield*o[0];for(let u of o[0])for(let l of t(o.slice(1)))yield`${u}${l}`}a(t,"Reduce");function*r(o){return yield*t(o.expr.map(u=>[...s(u)]))}a(r,"And");function*n(o){for(let u of o.expr)yield*s(u)}a(n,"Or");function*i(o){return yield o.const}a(i,"Const");function*s(o){return o.type==="and"?yield*r(o):o.type==="or"?yield*n(o):o.type==="const"?yield*i(o):(()=>{throw new WJ("Unknown expression")})()}a(s,"Generate"),e.Generate=s})(SP||(_e.TemplateLiteralGenerator=SP={}));var SOe;(function(e){function*t(s){let o=s.trim().replace(/"|'/g,"");return o==="boolean"?yield _e.Type.Boolean():o==="number"?yield _e.Type.Number():o==="bigint"?yield _e.Type.BigInt():o==="string"?yield _e.Type.String():yield(()=>{let u=o.split("|").map(l=>_e.Type.Literal(l.trim()));return u.length===0?_e.Type.Never():u.length===1?u[0]:_e.Type.Union(u)})()}a(t,"ParseUnion");function*r(s){if(s[1]!=="{"){let o=_e.Type.Literal("$"),u=n(s.slice(1));return yield*[o,...u]}for(let o=2;o<s.length;o++)if(s[o]==="}"){let u=t(s.slice(2,o)),l=n(s.slice(o+1));return yield*[...u,...l]}yield _e.Type.Literal(s)}a(r,"ParseTerminal");function*n(s){for(let o=0;o<s.length;o++)if(s[o]==="$"){let u=_e.Type.Literal(s.slice(0,o)),l=r(s.slice(o));return yield*[u,...l]}yield _e.Type.Literal(s)}a(n,"ParseLiteral");function i(s){return[...n(s)]}a(i,"Parse"),e.Parse=i})(SOe||(_e.TemplateLiteralDslParser=SOe={}));var YJ=class{static{a(this,"TransformDecodeBuilder")}constructor(t){this.schema=t}Decode(t){return new XJ(this.schema,t)}};_e.TransformDecodeBuilder=YJ;var XJ=class{static{a(this,"TransformEncodeBuilder")}constructor(t,r){this.schema=t,this.decode=r}Encode(t){let r=Rr.Type(this.schema);return Ee.TTransform(r)?(()=>{let s={Encode:a(o=>r[_e.Transform].Encode(t(o)),"Encode"),Decode:a(o=>this.decode(r[_e.Transform].Decode(o)),"Decode")};return{...r,[_e.Transform]:s}})():(()=>{let n={Decode:this.decode,Encode:t};return{...r,[_e.Transform]:n}})()}};_e.TransformEncodeBuilder=XJ;var dOn=0,JJ=class extends hh{static{a(this,"TypeBuilderError")}};_e.TypeBuilderError=JJ;var QJ=class{static{a(this,"TypeBuilder")}Create(t){return t}Throw(t){throw new JJ(t)}Discard(t,r){let{[r]:n,...i}=t;return i}Strict(t){return JSON.parse(JSON.stringify(t))}};_e.TypeBuilder=QJ;var jF=class extends QJ{static{a(this,"JsonTypeBuilder")}ReadonlyOptional(t){return this.Readonly(this.Optional(t))}Readonly(t){return{...Rr.Type(t),[_e.Readonly]:"Readonly"}}Optional(t){return{...Rr.Type(t),[_e.Optional]:"Optional"}}Any(t={}){return this.Create({...t,[_e.Kind]:"Any"})}Array(t,r={}){return this.Create({...r,[_e.Kind]:"Array",type:"array",items:Rr.Type(t)})}Boolean(t={}){return this.Create({...t,[_e.Kind]:"Boolean",type:"boolean"})}Capitalize(t,r={}){return{..._P.Map(Rr.Type(t),"Capitalize"),...r}}Composite(t,r){let n=_e.Type.Intersect(t,{}),s=GJ.ResolveKeys(n,{includePatterns:!1}).reduce((o,u)=>({...o,[u]:_e.Type.Index(n,[u])}),{});return _e.Type.Object(s,r)}Enum(t,r={}){let i=Object.getOwnPropertyNames(t).filter(s=>isNaN(s)).map(s=>t[s]).map(s=>Jt.IsString(s)?{[_e.Kind]:"Literal",type:"string",const:s}:{[_e.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[_e.Kind]:"Union",anyOf:i})}Extends(t,r,n,i,s={}){switch(rC.Extends(t,r)){case at.Union:return this.Union([Rr.Type(n,s),Rr.Type(i,s)]);case at.True:return Rr.Type(n,s);case at.False:return Rr.Type(i,s)}}Exclude(t,r,n={}){return Ee.TTemplateLiteral(t)?this.Exclude(xy.Resolve(t),r,n):Ee.TTemplateLiteral(r)?this.Exclude(t,xy.Resolve(r),n):Ee.TUnion(t)?(()=>{let i=t.anyOf.filter(s=>rC.Extends(s,r)===at.False);return i.length===1?Rr.Type(i[0],n):this.Union(i,n)})():rC.Extends(t,r)!==at.False?this.Never(n):Rr.Type(t,n)}Extract(t,r,n={}){return Ee.TTemplateLiteral(t)?this.Extract(xy.Resolve(t),r,n):Ee.TTemplateLiteral(r)?this.Extract(t,xy.Resolve(r),n):Ee.TUnion(t)?(()=>{let i=t.anyOf.filter(s=>rC.Extends(s,r)!==at.False);return i.length===1?Rr.Type(i[0],n):this.Union(i,n)})():rC.Extends(t,r)!==at.False?Rr.Type(t,n):this.Never(n)}Index(t,r,n={}){return Ee.TArray(t)&&Ee.TNumber(r)?(()=>Rr.Type(t.items,n))():Ee.TTuple(t)&&Ee.TNumber(r)?(()=>{let s=(Jt.IsUndefined(t.items)?[]:t.items).map(o=>Rr.Type(o));return this.Union(s,n)})():(()=>{let i=UF.Resolve(r),s=Rr.Type(t);return EOe.Resolve(s,i,n)})()}Integer(t={}){return this.Create({...t,[_e.Kind]:"Integer",type:"integer"})}Intersect(t,r={}){if(t.length===0)return _e.Type.Never();if(t.length===1)return Rr.Type(t[0],r);t.some(o=>Ee.TTransform(o))&&this.Throw("Cannot intersect transform types");let n=t.every(o=>Ee.TObject(o)),i=Rr.Rest(t),s=Ee.TSchema(r.unevaluatedProperties)?{unevaluatedProperties:Rr.Type(r.unevaluatedProperties)}:{};return r.unevaluatedProperties===!1||Ee.TSchema(r.unevaluatedProperties)||n?this.Create({...r,...s,[_e.Kind]:"Intersect",type:"object",allOf:i}):this.Create({...r,...s,[_e.Kind]:"Intersect",allOf:i})}KeyOf(t,r={}){return Ee.TRecord(t)?(()=>{let n=Object.getOwnPropertyNames(t.patternProperties)[0];return n===_e.PatternNumberExact?this.Number(r):n===_e.PatternStringExact?this.String(r):this.Throw("Unable to resolve key type from Record key pattern")})():Ee.TTuple(t)?(()=>{let i=(Jt.IsUndefined(t.items)?[]:t.items).map((s,o)=>_e.Type.Literal(o.toString()));return this.Union(i,r)})():Ee.TArray(t)?(()=>this.Number(r))():(()=>{let n=GJ.ResolveKeys(t,{includePatterns:!1});if(n.length===0)return this.Never(r);let i=n.map(s=>this.Literal(s));return this.Union(i,r)})()}Literal(t,r={}){return this.Create({...r,[_e.Kind]:"Literal",const:t,type:typeof t})}Lowercase(t,r={}){return{..._P.Map(Rr.Type(t),"Lowercase"),...r}}Never(t={}){return this.Create({...t,[_e.Kind]:"Never",not:{}})}Not(t,r){return this.Create({...r,[_e.Kind]:"Not",not:Rr.Type(t)})}Null(t={}){return this.Create({...t,[_e.Kind]:"Null",type:"null"})}Number(t={}){return this.Create({...t,[_e.Kind]:"Number",type:"number"})}Object(t,r={}){let n=Object.getOwnPropertyNames(t),i=n.filter(l=>Ee.TOptional(t[l])),s=n.filter(l=>!i.includes(l)),o=Ee.TSchema(r.additionalProperties)?{additionalProperties:Rr.Type(r.additionalProperties)}:{},u=n.reduce((l,c)=>({...l,[c]:Rr.Type(t[c])}),{});return s.length>0?this.Create({...r,...o,[_e.Kind]:"Object",type:"object",properties:u,required:s}):this.Create({...r,...o,[_e.Kind]:"Object",type:"object",properties:u})}Omit(t,r,n={}){let i=UF.Resolve(r);return vP.Map(this.Discard(Rr.Type(t),_e.Transform),s=>{Jt.IsArray(s.required)&&(s.required=s.required.filter(o=>!i.includes(o)),s.required.length===0&&delete s.required);for(let o of Object.getOwnPropertyNames(s.properties))i.includes(o)&&delete s.properties[o];return this.Create(s)},n)}Partial(t,r={}){return vP.Map(this.Discard(Rr.Type(t),_e.Transform),n=>{let i=Object.getOwnPropertyNames(n.properties).reduce((s,o)=>({...s,[o]:this.Optional(n.properties[o])}),{});return this.Object(i,this.Discard(n,"required"))},r)}Pick(t,r,n={}){let i=UF.Resolve(r);return vP.Map(this.Discard(Rr.Type(t),_e.Transform),s=>{Jt.IsArray(s.required)&&(s.required=s.required.filter(o=>i.includes(o)),s.required.length===0&&delete s.required);for(let o of Object.getOwnPropertyNames(s.properties))i.includes(o)||delete s.properties[o];return this.Create(s)},n)}Record(t,r,n={}){return Ee.TTemplateLiteral(t)?(()=>{let i=EP.ParseExact(t.pattern);return bP.Check(i)?this.Object([...SP.Generate(i)].reduce((s,o)=>({...s,[o]:Rr.Type(r)}),{}),n):this.Create({...n,[_e.Kind]:"Record",type:"object",patternProperties:{[t.pattern]:Rr.Type(r)}})})():Ee.TUnion(t)?(()=>{let i=bOe.Resolve(t);if(Ee.TUnionLiteral(i)){let s=i.anyOf.reduce((o,u)=>({...o,[u.const]:Rr.Type(r)}),{});return this.Object(s,{...n,[_e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():Ee.TLiteral(t)?(()=>Jt.IsString(t.const)||Jt.IsNumber(t.const)?this.Object({[t.const]:Rr.Type(r)},n):this.Throw("Record key of type literal is not of type string or number"))():Ee.TInteger(t)||Ee.TNumber(t)?(()=>this.Create({...n,[_e.Kind]:"Record",type:"object",patternProperties:{[_e.PatternNumberExact]:Rr.Type(r)}}))():Ee.TString(t)?(()=>{let i=Jt.IsUndefined(t.pattern)?_e.PatternStringExact:t.pattern;return this.Create({...n,[_e.Kind]:"Record",type:"object",patternProperties:{[i]:Rr.Type(r)}})})():this.Never()}Recursive(t,r={}){Jt.IsUndefined(r.$id)&&(r.$id=`T${dOn++}`);let n=t({[_e.Kind]:"This",$ref:`${r.$id}`});return n.$id=r.$id,this.Create({...r,[_e.Hint]:"Recursive",...n})}Ref(t,r={}){return Jt.IsString(t)?this.Create({...r,[_e.Kind]:"Ref",$ref:t}):(Jt.IsUndefined(t.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...r,[_e.Kind]:"Ref",$ref:t.$id}))}Required(t,r={}){return vP.Map(this.Discard(Rr.Type(t),_e.Transform),n=>{let i=Object.getOwnPropertyNames(n.properties).reduce((s,o)=>({...s,[o]:this.Discard(n.properties[o],_e.Optional)}),{});return this.Object(i,n)},r)}Rest(t){return Ee.TTuple(t)&&!Jt.IsUndefined(t.items)?Rr.Rest(t.items):Ee.TIntersect(t)?Rr.Rest(t.allOf):Ee.TUnion(t)?Rr.Rest(t.anyOf):[]}String(t={}){return this.Create({...t,[_e.Kind]:"String",type:"string"})}TemplateLiteral(t,r={}){let n=Jt.IsString(t)?zJ.Create(SOe.Parse(t)):zJ.Create(t);return this.Create({...r,[_e.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(t){return new YJ(t)}Tuple(t,r={}){let[n,i,s]=[!1,t.length,t.length],o=Rr.Rest(t),u=t.length>0?{...r,[_e.Kind]:"Tuple",type:"array",items:o,additionalItems:n,minItems:i,maxItems:s}:{...r,[_e.Kind]:"Tuple",type:"array",minItems:i,maxItems:s};return this.Create(u)}Uncapitalize(t,r={}){return{..._P.Map(Rr.Type(t),"Uncapitalize"),...r}}Union(t,r={}){return Ee.TTemplateLiteral(t)?xy.Resolve(t):(()=>{let n=t;if(n.length===0)return this.Never(r);if(n.length===1)return this.Create(Rr.Type(n[0],r));let i=Rr.Rest(n);return this.Create({...r,[_e.Kind]:"Union",anyOf:i})})()}Unknown(t={}){return this.Create({...t,[_e.Kind]:"Unknown"})}Unsafe(t={}){return this.Create({...t,[_e.Kind]:t[_e.Kind]||"Unsafe"})}Uppercase(t,r={}){return{..._P.Map(Rr.Type(t),"Uppercase"),...r}}};_e.JsonTypeBuilder=jF;var ZJ=class extends jF{static{a(this,"JavaScriptTypeBuilder")}AsyncIterator(t,r={}){return this.Create({...r,[_e.Kind]:"AsyncIterator",type:"AsyncIterator",items:Rr.Type(t)})}Awaited(t,r={}){let n=a(i=>i.length>0?(()=>{let[s,...o]=i;return[this.Awaited(s),...n(o)]})():i,"Unwrap");return Ee.TIntersect(t)?_e.Type.Intersect(n(t.allOf)):Ee.TUnion(t)?_e.Type.Union(n(t.anyOf)):Ee.TPromise(t)?this.Awaited(t.item):Rr.Type(t,r)}BigInt(t={}){return this.Create({...t,[_e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(t,r={}){return this.Tuple([...t.parameters],{...r})}Constructor(t,r,n){let[i,s]=[Rr.Rest(t),Rr.Type(r)];return this.Create({...n,[_e.Kind]:"Constructor",type:"constructor",parameters:i,returns:s})}Date(t={}){return this.Create({...t,[_e.Kind]:"Date",type:"Date"})}Function(t,r,n){let[i,s]=[Rr.Rest(t),Rr.Type(r)];return this.Create({...n,[_e.Kind]:"Function",type:"function",parameters:i,returns:s})}InstanceType(t,r={}){return Rr.Type(t.returns,r)}Iterator(t,r={}){return this.Create({...r,[_e.Kind]:"Iterator",type:"Iterator",items:Rr.Type(t)})}Parameters(t,r={}){return this.Tuple(t.parameters,{...r})}Promise(t,r={}){return this.Create({...r,[_e.Kind]:"Promise",type:"Promise",item:Rr.Type(t)})}RegExp(t,r={}){let n=Jt.IsString(t)?t:t.source;return this.Create({...r,[_e.Kind]:"String",type:"string",pattern:n})}RegEx(t,r={}){return this.RegExp(t,r)}ReturnType(t,r={}){return Rr.Type(t.returns,r)}Symbol(t){return this.Create({...t,[_e.Kind]:"Symbol",type:"symbol"})}Undefined(t={}){return this.Create({...t,[_e.Kind]:"Undefined",type:"undefined"})}Uint8Array(t={}){return this.Create({...t,[_e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(t={}){return this.Create({...t,[_e.Kind]:"Void",type:"void"})}};_e.JavaScriptTypeBuilder=ZJ;_e.JsonType=new jF;_e.Type=new ZJ});var SRt=y(eQ=>{"use strict";Object.defineProperty(eQ,"__esModule",{value:!0});eQ.CustomTypeBuilder=void 0;var GF=bRt(),AOe=class extends GF.TypeBuilder{static{a(this,"CustomTypeBuilder")}static Date(){return GF.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(t){return GF.Type.Union([t,GF.Type.Null()])}static StringEnum(t){return GF.Type.Unsafe({type:"string",enum:t})}};eQ.CustomTypeBuilder=AOe});var _n=y(ht=>{"use strict";var ARt=ht&&ht.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),pOn=ht&&ht.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),COe=ht&&ht.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&ARt(t,e,r);return pOn(t,e),t},Ry=ht&&ht.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ARt(t,e,r)};Object.defineProperty(ht,"__esModule",{value:!0});ht.getRequiredEnvVar=ht.env=ht.EnvironmentalVariableRequiredError=ht.xfs=ht.RouteValidator=ht.JsonValidator=ht.TenantService=ht.OpenFGAService=ht.MeteringService=ht.DevApiService=ht.getContentApiStorageTarballPath=ht.contentApiTarballFileName=ht.ContentApiService=ht.AuthApiService=ht.getServiceAccountIdToken=ht.createApiKeyServiceClient=ht.ApiKeyService=ht.RouteVersions=ht.startsWithReservedKeyword=ht.conditionallyUploadToGCPStorageDevPortalBucket=ht.logger=ht.createNewLogger=ht.graphQL=ht.CloudStorage=ht.ApiServer=ht.featureFlagsPlugin=ht.ensureZuploUserPlugin=ht.ensureZuploAdminPlugin=ht.apiKeyAuthPlugin=ht.errorHandler=ht.DeploymentLogState=ht.signString=ht.FeatureFlags=ht.VALID_COMPATIBILITY_DATES=ht.DEFAULT_COMPATIBILITY_DATE=ht.COMPATIBILITY_FLAG_MAPPINGS=ht.WARNING_STATUS=ht.WARNING_SEVERITY=ht.GOOD_STATUS=ht.FAILURE_STATUS=ht.ERROR_SEVERITY=ht.BuildIssueError=ht.hasBlockedNotifications=ht.getBuildFlags=ht.CommonAuth=void 0;var wOe=COe(sc());ht.env=wOe.default;Object.defineProperty(ht,"EnvironmentalVariableRequiredError",{enumerable:!0,get:function(){return wOe.EnvironmentalVariableRequiredError}});Object.defineProperty(ht,"getRequiredEnvVar",{enumerable:!0,get:function(){return wOe.getRequiredEnvVar}});Ry(Vc(),ht);var fOn=Dce();Object.defineProperty(ht,"CommonAuth",{enumerable:!0,get:function(){return fOn.CommonAuth}});var CRt=DGe();Object.defineProperty(ht,"getBuildFlags",{enumerable:!0,get:function(){return CRt.getBuildFlags}});Object.defineProperty(ht,"hasBlockedNotifications",{enumerable:!0,get:function(){return CRt.hasBlockedNotifications}});var AP=Fce();Object.defineProperty(ht,"BuildIssueError",{enumerable:!0,get:function(){return AP.BuildIssueError}});Object.defineProperty(ht,"ERROR_SEVERITY",{enumerable:!0,get:function(){return AP.ERROR_SEVERITY}});Object.defineProperty(ht,"FAILURE_STATUS",{enumerable:!0,get:function(){return AP.FAILURE_STATUS}});Object.defineProperty(ht,"GOOD_STATUS",{enumerable:!0,get:function(){return AP.GOOD_STATUS}});Object.defineProperty(ht,"WARNING_SEVERITY",{enumerable:!0,get:function(){return AP.WARNING_SEVERITY}});Object.defineProperty(ht,"WARNING_STATUS",{enumerable:!0,get:function(){return AP.WARNING_STATUS}});var wRt=LGe();Object.defineProperty(ht,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:!0,get:function(){return wRt.COMPATIBILITY_FLAG_MAPPINGS}});Object.defineProperty(ht,"DEFAULT_COMPATIBILITY_DATE",{enumerable:!0,get:function(){return wRt.DEFAULT_COMPATIBILITY_DATE}});var mOn=BGe();Object.defineProperty(ht,"VALID_COMPATIBILITY_DATES",{enumerable:!0,get:function(){return mOn.VALID_COMPATIBILITY_DATES}});var hOn=MGe();Object.defineProperty(ht,"FeatureFlags",{enumerable:!0,get:function(){return hOn.FeatureFlags}});var gOn=qGe();Object.defineProperty(ht,"signString",{enumerable:!0,get:function(){return gOn.signString}});Ry(UGe(),ht);var yOn=Mce();Object.defineProperty(ht,"DeploymentLogState",{enumerable:!0,get:function(){return yOn.DeploymentLogState}});Ry(WGe(),ht);Ry(qce(),ht);var _On=Uce();Object.defineProperty(ht,"errorHandler",{enumerable:!0,get:function(){return _On.errorHandler}});var tQ=Vce();Object.defineProperty(ht,"apiKeyAuthPlugin",{enumerable:!0,get:function(){return tQ.apiKeyAuthPlugin}});Object.defineProperty(ht,"ensureZuploAdminPlugin",{enumerable:!0,get:function(){return tQ.ensureZuploAdminPlugin}});Object.defineProperty(ht,"ensureZuploUserPlugin",{enumerable:!0,get:function(){return tQ.ensureZuploUserPlugin}});Object.defineProperty(ht,"featureFlagsPlugin",{enumerable:!0,get:function(){return tQ.featureFlagsPlugin}});var vOn=lft();Object.defineProperty(ht,"ApiServer",{enumerable:!0,get:function(){return vOn.ApiServer}});ht.CloudStorage=COe(XSe());var EOn=W_t();Object.defineProperty(ht,"graphQL",{enumerable:!0,get:function(){return EOn.graphQL}});Ry(m2t(),ht);var TRt=rEe();Object.defineProperty(ht,"createNewLogger",{enumerable:!0,get:function(){return TRt.createNewLogger}});Object.defineProperty(ht,"logger",{enumerable:!0,get:function(){return TRt.logger}});Ry(v2t(),ht);var bOn=Zwt();Object.defineProperty(ht,"conditionallyUploadToGCPStorageDevPortalBucket",{enumerable:!0,get:function(){return bOn.conditionallyUploadToGCPStorageDevPortalBucket}});var SOn=JSe();Object.defineProperty(ht,"startsWithReservedKeyword",{enumerable:!0,get:function(){return SOn.startsWithReservedKeyword}});var AOn=eTt();Object.defineProperty(ht,"RouteVersions",{enumerable:!0,get:function(){return AOn.RouteVersions}});var xRt=aTt();Object.defineProperty(ht,"ApiKeyService",{enumerable:!0,get:function(){return xRt.ApiKeyService}});Object.defineProperty(ht,"createApiKeyServiceClient",{enumerable:!0,get:function(){return xRt.createApiKeyServiceClient}});var COn=JO();Object.defineProperty(ht,"getServiceAccountIdToken",{enumerable:!0,get:function(){return COn.getServiceAccountIdToken}});var wOn=uTt();Object.defineProperty(ht,"AuthApiService",{enumerable:!0,get:function(){return wOn.AuthApiService}});var TOe=Yxe();Object.defineProperty(ht,"ContentApiService",{enumerable:!0,get:function(){return TOe.ContentApiService}});Object.defineProperty(ht,"contentApiTarballFileName",{enumerable:!0,get:function(){return TOe.contentApiTarballFileName}});Object.defineProperty(ht,"getContentApiStorageTarballPath",{enumerable:!0,get:function(){return TOe.getContentApiStorageTarballPath}});var TOn=dTt();Object.defineProperty(ht,"DevApiService",{enumerable:!0,get:function(){return TOn.DevApiService}});var xOn=fTt();Object.defineProperty(ht,"MeteringService",{enumerable:!0,get:function(){return xOn.MeteringService}});var ROn=mRt();Object.defineProperty(ht,"OpenFGAService",{enumerable:!0,get:function(){return ROn.OpenFGAService}});var OOn=yRt();Object.defineProperty(ht,"TenantService",{enumerable:!0,get:function(){return OOn.TenantService}});Ry(_Rt(),ht);Ry(SRt(),ht);Ry(awe(),ht);var POn=zCe();Object.defineProperty(ht,"JsonValidator",{enumerable:!0,get:function(){return POn.JsonValidator}});var NOn=ZCe();Object.defineProperty(ht,"RouteValidator",{enumerable:!0,get:function(){return NOn.RouteValidator}});ht.xfs=COe(nY())});var Bn=y(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.NODE_BUILD_OPEN_API_OUTPUT_FILE=Vt.NODE_BUILD_OUTPUT_FILE=Vt.NODE_ENTRY_NAME=Vt.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE=Vt.WORKER_BUILD_OUTPUT_FILE=Vt.WORKER_ENTRY_NAME=Vt.ENV_MODULE_FILE=Vt.ZUPLO_SYSTEM_ENV_FILE=Vt.ENV_FILE=Vt.CACHE_DIRECTORY=Vt.BUILD_CACHE_FILE=Vt.ZUPLO_FILE_SCHEMA=Vt.NON_STANDARD_NODE_ENV=Vt.GENERATED_TYPES_DIR_NAME=Vt.GENERATED_BUILD_JSON_FILE=Vt.GENERATED_SOURCE_DIR_NAME=Vt.BUILD_OUTPUT_DIR=Vt.DEFAULT_TEST_FILE=Vt.DEFAULT_DOCS_MARKDOWN_FILE=Vt.DOCS_THEME_FILE=Vt.DOCS_SIDEBAR_FILE=Vt.ZUPLO_FALLBACK_JSON_FILE=Vt.ZUPLO_PREFERRED_JSON_FILE=Vt.DEFAULT_MODULE_FILE=Vt.OPEN_API_FILE_SUFFIX=Vt.OPEN_API_CONFIG_FILE=Vt.OPEN_API_UNVERSIONED_DIR_NAME=Vt.DEV_PORTAL_OUTPUT_DIR_NAME=Vt.DEV_PORTAL_CONFIG_FILE=Vt.POLICIES_CONFIG_FILE=Vt.ROUTES_OAS_CONFIG_FILE=Vt.LOCAL_API_KEYS_CONFIG_FILE=Vt.DEV_PORTAL_V4_PATH=Vt.USER_DOCS_DIR_NAME=Vt.USER_SCHEMAS_DIR_NAME=Vt.USER_CONFIG_DIR_NAME=Vt.USER_TEST_DIR_NAME=Vt.USER_MODULES_DIR_NAME=void 0;Vt.USER_MODULES_DIR_NAME="modules";Vt.USER_TEST_DIR_NAME="tests";Vt.USER_CONFIG_DIR_NAME="config";Vt.USER_SCHEMAS_DIR_NAME="schemas";Vt.USER_DOCS_DIR_NAME="docs";Vt.DEV_PORTAL_V4_PATH="v4";Vt.LOCAL_API_KEYS_CONFIG_FILE="api-keys.json";Vt.ROUTES_OAS_CONFIG_FILE="routes.oas.json";Vt.POLICIES_CONFIG_FILE="policies.json";Vt.DEV_PORTAL_CONFIG_FILE="dev-portal.json";Vt.DEV_PORTAL_OUTPUT_DIR_NAME="dev-portal";Vt.OPEN_API_UNVERSIONED_DIR_NAME="unversioned";Vt.OPEN_API_CONFIG_FILE="open-api.json";Vt.OPEN_API_FILE_SUFFIX=".oas.json";Vt.DEFAULT_MODULE_FILE="hello-world.ts";Vt.ZUPLO_PREFERRED_JSON_FILE="zuplo.jsonc";Vt.ZUPLO_FALLBACK_JSON_FILE="zuplo.json";Vt.DOCS_SIDEBAR_FILE="sidebar.json";Vt.DOCS_THEME_FILE="theme.css";Vt.DEFAULT_DOCS_MARKDOWN_FILE="index.md";Vt.DEFAULT_TEST_FILE="hello-world.json";Vt.BUILD_OUTPUT_DIR="dist";Vt.GENERATED_SOURCE_DIR_NAME=".zuplo";Vt.GENERATED_BUILD_JSON_FILE="build.json";Vt.GENERATED_TYPES_DIR_NAME="types";Vt.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.';Vt.ZUPLO_FILE_SCHEMA="zuplo";Vt.BUILD_CACHE_FILE="buildstate.json";Vt.CACHE_DIRECTORY=".cache";Vt.ENV_FILE=".env";Vt.ZUPLO_SYSTEM_ENV_FILE=".env.zuplo";Vt.ENV_MODULE_FILE="environment.ts";Vt.WORKER_ENTRY_NAME="worker.ts";Vt.WORKER_BUILD_OUTPUT_FILE="worker.js";Vt.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE="worker.js.map";Vt.NODE_ENTRY_NAME="server.ts";Vt.NODE_BUILD_OUTPUT_FILE="main.js";Vt.NODE_BUILD_OPEN_API_OUTPUT_FILE=Vt.OPEN_API_CONFIG_FILE});var ru=y(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0});CP.runPlugins=CP.PluginResult=void 0;var xOe=class{static{a(this,"PluginResult")}errors=[];warnings=[];constructor(t){t&&this.errors.push(t)}};CP.PluginResult=xOe;async function IOn(e,t){let r=[],n=[],i=new Map;for await(let s of e)try{let o=await s(t,i);if(n.push(...o.errors.map(u=>(u.pluginName===""&&(u.pluginName=s.name),u))),r.push(...o.warnings),o.errors.length>0)break}catch(o){n.push(o);break}return{errors:n,warnings:r}}a(IOn,"runPlugins");CP.runPlugins=IOn});var Ts=y(OOe=>{"use strict";Object.defineProperty(OOe,"__esModule",{value:!0});var HF=require("perf_hooks"),ROe=[];async function kOn(e,t){let r=HF.performance.timerify(t),n=new HF.PerformanceObserver(i=>{let s=i.getEntries()[0];ROe.push({name:e,duration:s.duration}),n.disconnect()});return n.observe({entryTypes:["function"]}),r()}a(kOn,"timeFn");var DOn={mark:e=>{HF.performance.mark(e)},measure:(e,t,r)=>{HF.performance.measure(e,t,r)},timeFn:kOn,report:()=>{ROe.length>0&&console.table(ROe)},getDuration:e=>{let t=HF.performance.getEntriesByName(e);return t.length===0?0:t[0].duration}};OOe.default=DOn});var POe=y(wP=>{"use strict";var LOn=wP&&wP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wP,"__esModule",{value:!0});wP.getZuploConfig=void 0;var gh=_n(),FOn=require("jsonc-parser"),BOn=require("fs/promises"),RRt=LOn(require("path")),ORt=Bn();async function MOn(e){let t=RRt.default.join(e,ORt.ZUPLO_PREFERRED_JSON_FILE),r=RRt.default.join(e,ORt.ZUPLO_FALLBACK_JSON_FILE),n=!1,i=t;await gh.xfs.fileExists(t)?(n=!0,i=t):await gh.xfs.fileExists(r)&&(n=!0,i=r);let s,o;if(n){let l=await(0,BOn.readFile)(i,"utf-8"),c=[],d=(0,FOn.parse)(l,c);if(typeof d!="object"){let p={message:"Invalid zuplo.jsonc file.",detail:"The zuplo.jsonc file is not a valid JSON object",pluginName:"buildData",severity:"error"};return{status:gh.FAILURE_STATUS,errors:[p]}}if("version"in d&&d.version!==1){let p={message:"Invalid version set in zuplo.jsonc file.",detail:"version in zuplo.jsonc must be set to 1",pluginName:"buildData",severity:"error"};return{status:gh.FAILURE_STATUS,errors:[p]}}if("compatibilityDate"in d&&gh.VALID_COMPATIBILITY_DATES&&typeof d.compatibilityDate=="string"){if(!gh.VALID_COMPATIBILITY_DATES.includes(d.compatibilityDate)){let p={message:"Invalid compatibilityDate set in zuplo.jsonc file.",detail:`compatibilityDate was set to ${d.compatibilityDate}. Valid compatibility dates are ${gh.VALID_COMPATIBILITY_DATES.join(", ")}`,pluginName:"buildData",severity:"error"};return{status:gh.FAILURE_STATUS,errors:[p]}}s=d.compatibilityDate}o=(0,gh.getBuildFlags)(s,d.flags)}else o=(0,gh.getBuildFlags)(void 0,void 0);let u={version:1,compatibilityDate:s,flags:o};return{status:gh.GOOD_STATUS,config:u}}a(MOn,"getZuploConfig");wP.getZuploConfig=MOn});var VF=y(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});rQ.TargetPlatform=void 0;var PRt;(function(e){e.Worker="worker"})(PRt||(rQ.TargetPlatform=PRt={}))});var IRt=y(TP=>{"use strict";var NRt=TP&&TP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(TP,"__esModule",{value:!0});TP.cleanOutput=void 0;var qOn=NRt(require("fs/promises")),UOn=NRt(Ts()),$On=a(async function({outputDirectory:e,systemDirectory:t,logger:r}){return UOn.default.timeFn("Cleaning output",async()=>{r.debug("Cleaning output");let n=[e,t];for await(let i of n)try{await qOn.default.rm(i,{recursive:!0,force:!0})}catch(s){r.error(s)}return{warnings:[],errors:[]}})},"cleanOutput");TP.cleanOutput=$On});var DRt=y(xP=>{"use strict";var kRt=xP&&xP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xP,"__esModule",{value:!0});xP.createSystemDir=void 0;var jOn=_n(),GOn=kRt(require("fs/promises")),HOn=kRt(Ts()),VOn=a(async function({systemDirectory:e,logger:t}){return HOn.default.timeFn("Creating system directory",async()=>{t.debug("Creating system directory");try{if(await jOn.xfs.dirExists(e))return t.debug("System directory already exists, skipping"),{warnings:[],errors:[]};await GOn.default.mkdir(e)}catch(r){return t.error(r),{warnings:[],errors:[]}}return{warnings:[],errors:[]}})},"createSystemDir");xP.createSystemDir=VOn});var LRt=y(RP=>{"use strict";var zOn=RP&&RP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(RP,"__esModule",{value:!0});RP.checkForDeprecations=void 0;var KOn=zOn(Ts()),WOn=a(async function({logger:e}){return KOn.default.timeFn("Checking for breaking changes",async()=>(e.debug("Checking for breaking changes"),{warnings:[],errors:[]}))},"checkForDeprecations");RP.checkForDeprecations=WOn});var qRt=y(OP=>{"use strict";var MRt=OP&&OP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(OP,"__esModule",{value:!0});OP.generateBuildData=void 0;var nQ=_n(),FRt=require("fs/promises"),BRt=MRt(require("path")),YOn=Bn(),XOn=MRt(Ts()),JOn=a(async function({systemDirectory:e,buildId:t,logger:r,config:n,publicZuploEnvironmentVariables:i}){return XOn.default.timeFn("Generating build data",async()=>{r.debug("Generating build data");let s=await(0,FRt.readFile)(BRt.default.resolve(__dirname,"../../../package.json"),"utf-8"),o=JSON.parse(s),u={BUILD_ID:t??"",GIT_SHA:process.env.GIT_SHA,TIMESTAMP:new Date().toISOString(),IS_PRODUCTION:nQ.env.isProduction(),BUILD_ENV:nQ.env.NODE_ENV,ZUPLO_VERSION:o.version,API_VERSION:process.env.API_VERSION,COMPATIBILITY_DATE:n?.compatibilityDate,ACCOUNT_NAME:i?.ZUPLO_ACCOUNT_NAME,PROJECT_NAME:i?.ZUPLO_PROJECT_NAME,ENVIRONMENT_TYPE:i?.ZUPLO_ENVIRONMENT_TYPE,COMPATIBILITY_FLAGS:nQ.COMPATIBILITY_FLAG_MAPPINGS?nQ.COMPATIBILITY_FLAG_MAPPINGS[n?.compatibilityDate??"none"]:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1}},l=JSON.stringify(u,void 0,2),c=BRt.default.join(e,YOn.GENERATED_BUILD_JSON_FILE);try{await(0,FRt.writeFile)(c,l.trimStart(),"utf-8")}catch(d){r.error(d);let p={message:`Error creating file at ${c}`,pluginName:"buildData",severity:"error"};return{warnings:[],errors:[p]}}return{warnings:[],errors:[]}})},"generateBuildData");OP.generateBuildData=JOn});var URt=y(PP=>{"use strict";var NOe=PP&&PP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(PP,"__esModule",{value:!0});PP.generateWorker=void 0;var QOn=NOe(require("fs/promises")),ZOn=NOe(require("path")),zF=Bn(),ePn=NOe(Ts()),tPn=`import { Handler, ServiceProviderImpl } from "@zuplo/runtime";
|
|
621
621
|
import routeLoader from "../config/routes.json";
|
|
622
622
|
import * as schemaValidations from "./ajv-schema.json";
|
|
623
623
|
import { runtimeInit } from "../modules/zuplo.runtime.ts";
|