@zuplo/cli 7.1.6 → 7.1.8
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/node_modules/@zuplo/core/customer.cli.minified.js +1 -1
- package/node_modules/@zuplo/core/index.minified.js +1 -1
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-CJFLOF27.js → chunk-B3D32RUX.js} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-CJFLOF27.js.map → chunk-B3D32RUX.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-Y57PFQJ3.js +382 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-Y57PFQJ3.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +82 -17
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-BBEFM7HV.js +0 -372
- package/node_modules/@zuplo/runtime/out/esm/chunk-BBEFM7HV.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-BBEFM7HV.js.LEGAL.txt → chunk-Y57PFQJ3.js.LEGAL.txt} +0 -0
|
@@ -572,7 +572,7 @@ globstar while`,s,fe,o,ae,rt),this.matchOne(s.slice(fe),o.slice(ae),f))return th
|
|
|
572
572
|
`),stderr:x.join(`
|
|
573
573
|
`),exitCode:P},"Tar process logs")}}t(aZt,"tarFolder");async function oZt({tarFilePath:s,outputDir:o,logger:f}){let d=[],y=[],x;try{await new Promise((P,F)=>{let W=fit("sh",["-c",`tar -xvf ${s} -C ${o};`]);W.stdout.on("data",V=>{let ye=V.toString().trim();ye.length>0&&d.push(ye.trim())}),W.stderr.on("data",V=>{let ye=V.toString().trim();ye.length>0&&y.push(ye.trim())}),W.on("close",V=>{x=V,V===0?P():F(new Error(`tar process exited with code ${V}`))}),W.on("error",V=>{F(V)})})}catch(P){throw new Error("Failed to untar file",{cause:P})}finally{f.info({stdout:d.join(`
|
|
574
574
|
`),stderr:y.join(`
|
|
575
|
-
`),exitCode:x},"Untar process logs")}}t(oZt,"untarFile");async function cZt(s){if(await sAe(s))return await qN.rm(s,{recursive:!0})}t(cZt,"deleteFolder");var ru=aAe;var vlt=Pp(Fst(),1);var Lst=["ai-gateway-auth-v2","ai-gateway-configuration-executor-v2","ai-gateway-fallback-model-v2","ai-gateway-metering-v2","ai-gateway-model-filtering-v2","ai-gateway-semantic-cache","ai-gateway-semantic-cache-v2","akamai-ai-firewall","akamai-ai-firewall-v2","akamai-firewall-for-ai","comet-opik-tracing-v2","galileo-tracing-v2","prompt-injection","semantic-cache"];var JV=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(s,o,f,d,y,x){this.type=s,this.name=o,this.prefix=f,this.value=d,this.suffix=y,this.modifier=x}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Ler=/[$_\p{ID_Start}]/u,Rer=/[$_\u200C\u200D\p{ID_Continue}]/u,zAe=".*";function Mer(s,o){return(o?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(s)}t(Mer,"Re");function jst(s,o=!1){let f=[],d=0;for(;d<s.length;){let y=s[d],x=t(function(P){if(!o)throw new TypeError(P);f.push({type:"INVALID_CHAR",index:d,value:s[d++]})},"c");if(y==="*"){f.push({type:"ASTERISK",index:d,value:s[d++]});continue}if(y==="+"||y==="?"){f.push({type:"OTHER_MODIFIER",index:d,value:s[d++]});continue}if(y==="\\"){f.push({type:"ESCAPED_CHAR",index:d++,value:s[d++]});continue}if(y==="{"){f.push({type:"OPEN",index:d,value:s[d++]});continue}if(y==="}"){f.push({type:"CLOSE",index:d,value:s[d++]});continue}if(y===":"){let P="",F=d+1;for(;F<s.length;){let W=s.substr(F,1);if(F===d+1&&Ler.test(W)||F!==d+1&&Rer.test(W)){P+=s[F++];continue}break}if(!P){x(`Missing parameter name at ${d}`);continue}f.push({type:"NAME",index:d,value:P}),d=F;continue}if(y==="("){let P=1,F="",W=d+1,V=!1;if(s[W]==="?"){x(`Pattern cannot start with "?" at ${W}`);continue}for(;W<s.length;){if(!Mer(s[W],!1)){x(`Invalid character '${s[W]}' at ${W}.`),V=!0;break}if(s[W]==="\\"){F+=s[W++]+s[W++];continue}if(s[W]===")"){if(P--,P===0){W++;break}}else if(s[W]==="("&&(P++,s[W+1]!=="?")){x(`Capturing groups are not allowed at ${W}`),V=!0;break}F+=s[W++]}if(V)continue;if(P){x(`Unbalanced pattern at ${d}`);continue}if(!F){x(`Missing pattern at ${d}`);continue}f.push({type:"REGEX",index:d,value:F}),d=W;continue}f.push({type:"CHAR",index:d,value:s[d++]})}return f.push({type:"END",index:d,value:""}),f}t(jst,"v");function Bst(s,o={}){let f=jst(s);o.delimiter??="/#?",o.prefixes??="./";let d=`[^${_T(o.delimiter)}]+?`,y=[],x=0,P=0,F="",W=new Set,V=t(yn=>{if(P<f.length&&f[P].type===yn)return f[P++].value},"a"),ye=t(()=>V("OTHER_MODIFIER")??V("ASTERISK"),"f"),fe=t(yn=>{let sn=V(yn);if(sn!==void 0)return sn;let{type:In,index:xr}=f[P];throw new TypeError(`Unexpected ${In} at ${xr}, expected ${yn}`)},"d"),ae=t(()=>{let yn="",sn;for(;sn=V("CHAR")??V("ESCAPED_CHAR");)yn+=sn;return yn},"T"),rt=t(yn=>yn,"Se"),Ue=o.encodePart||rt,je="",$t=t(yn=>{je+=yn},"U"),Bt=t(()=>{je.length&&(y.push(new JV(3,"","",Ue(je),"",3)),je="")},"$"),Ir=t((yn,sn,In,xr,gr)=>{let gs=3;switch(gr){case"?":gs=1;break;case"*":gs=0;break;case"+":gs=2;break}if(!sn&&!In&&gs===3){$t(yn);return}if(Bt(),!sn&&!In){if(!yn)return;y.push(new JV(3,"","",Ue(yn),"",gs));return}let si;In?In==="*"?si=zAe:si=In:si=d;let fc=2;si===d?(fc=1,si=""):si===zAe&&(fc=0,si="");let Ci;if(sn?Ci=sn:In&&(Ci=x++),W.has(Ci))throw new TypeError(`Duplicate name '${Ci}'.`);W.add(Ci),y.push(new JV(fc,Ci,Ue(yn),si,Ue(xr),gs))},"V");for(;P<f.length;){let yn=V("CHAR"),sn=V("NAME"),In=V("REGEX");if(!sn&&!In&&(In=V("ASTERISK")),sn||In){let gr=yn??"";o.prefixes.indexOf(gr)===-1&&($t(gr),gr=""),Bt();let gs=ye();Ir(gr,sn,In,"",gs);continue}let xr=yn??V("ESCAPED_CHAR");if(xr){$t(xr);continue}if(V("OPEN")){let gr=ae(),gs=V("NAME"),si=V("REGEX");!gs&&!si&&(si=V("ASTERISK"));let fc=ae();fe("CLOSE");let Ci=ye();Ir(gr,gs,si,fc,Ci);continue}Bt(),fe("END")}return y}t(Bst,"D");function _T(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(_T,"S");function Rst(s){return s&&s.ignoreCase?"ui":"u"}t(Rst,"X");function jer(s,o,f){return Ust(Bst(s,f),o,f)}t(jer,"Z");function Y9(s){switch(s){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(Y9,"k");function Ust(s,o,f={}){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let d=f.start?"^":"";for(let F of s){if(F.type===3){F.modifier===3?d+=_T(F.value):d+=`(?:${_T(F.value)})${Y9(F.modifier)}`;continue}o&&o.push(F.name);let W=`[^${_T(f.delimiter)}]+?`,V=F.value;if(F.type===1?V=W:F.type===0&&(V=zAe),!F.prefix.length&&!F.suffix.length){F.modifier===3||F.modifier===1?d+=`(${V})${Y9(F.modifier)}`:d+=`((?:${V})${Y9(F.modifier)})`;continue}if(F.modifier===3||F.modifier===1){d+=`(?:${_T(F.prefix)}(${V})${_T(F.suffix)})`,d+=Y9(F.modifier);continue}d+=`(?:${_T(F.prefix)}`,d+=`((?:${V})(?:`,d+=_T(F.suffix),d+=_T(F.prefix),d+=`(?:${V}))*)${_T(F.suffix)})`,F.modifier===0&&(d+="?")}let y=`[${_T(f.endsWith)}]|$`,x=`[${_T(f.delimiter)}]`;if(f.end)return f.strict||(d+=`${x}?`),f.endsWith.length?d+=`(?=${y})`:d+="$",new RegExp(d,Rst(f));f.strict||(d+=`(?:${x}(?=${y}))?`);let P=!1;if(s.length){let F=s[s.length-1];F.type===3&&F.modifier===3&&(P=f.delimiter.indexOf(F)>-1)}return P||(d+=`(?=${x}|${y})`),new RegExp(d,Rst(f))}t(Ust,"F");var YN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ber={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Uer={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function zer(s,o){return s.length?s[0]==="/"?!0:!o||s.length<2?!1:(s[0]=="\\"||s[0]=="{")&&s[1]=="/":!1}t(zer,"J");function zst(s,o){return s.startsWith(o)?s.substring(o.length,s.length):s}t(zst,"Q");function $er(s,o){return s.endsWith(o)?s.substr(0,s.length-o.length):s}t($er,"Ee");function $st(s){return!s||s.length<2?!1:s[0]==="["||(s[0]==="\\"||s[0]==="{")&&s[1]==="["}t($st,"W");var Jst=["ftp","file","http","https","ws","wss"];function Wst(s){if(!s)return!0;for(let o of Jst)if(s.test(o))return!0;return!1}t(Wst,"N");function Jer(s,o){if(s=zst(s,"#"),o||s==="")return s;let f=new URL("https://example.com");return f.hash=s,f.hash?f.hash.substring(1,f.hash.length):""}t(Jer,"te");function Wer(s,o){if(s=zst(s,"?"),o||s==="")return s;let f=new URL("https://example.com");return f.search=s,f.search?f.search.substring(1,f.search.length):""}t(Wer,"re");function qer(s,o){return o||s===""?s:$st(s)?Hst(s):Vst(s)}t(qer,"ne");function Ver(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.password=s,f.password}t(Ver,"se");function Her(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.username=s,f.username}t(Her,"ie");function Ger(s,o,f){if(f||s==="")return s;if(o&&!Jst.includes(o))return new URL(`${o}:${s}`).pathname;let d=s[0]=="/";return s=new URL(d?s:"/-"+s,"https://example.com").pathname,d||(s=s.substring(2,s.length)),s}t(Ger,"ae");function Yer(s,o,f){return qst(o)===s&&(s=""),f||s===""?s:Gst(s)}t(Yer,"oe");function Ker(s,o){return s=$er(s,":"),o||s===""?s:$Ae(s)}t(Ker,"ce");function qst(s){switch(s){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(qst,"_");function $Ae(s){if(s==="")return s;if(/^[-+.A-Za-z0-9]*$/.test(s))return s.toLowerCase();throw new TypeError(`Invalid protocol '${s}'.`)}t($Ae,"y");function Xer(s){if(s==="")return s;let o=new URL("https://example.com");return o.username=s,o.username}t(Xer,"le");function Zer(s){if(s==="")return s;let o=new URL("https://example.com");return o.password=s,o.password}t(Zer,"fe");function Vst(s){if(s==="")return s;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(s))throw new TypeError(`Invalid hostname '${s}'`);let o=new URL("https://example.com");return o.hostname=s,o.hostname}t(Vst,"z");function Hst(s){if(s==="")return s;if(/[^0-9a-fA-F[\]:]/g.test(s))throw new TypeError(`Invalid IPv6 hostname '${s}'`);return s.toLowerCase()}t(Hst,"j");function Gst(s){if(s===""||/^[0-9]*$/.test(s)&&parseInt(s)<=65535)return s;throw new TypeError(`Invalid port '${s}'.`)}t(Gst,"K");function Qer(s){if(s==="")return s;let o=new URL("https://example.com");return o.pathname=s[0]!=="/"?"/-"+s:s,s[0]!=="/"?o.pathname.substring(2,o.pathname.length):o.pathname}t(Qer,"he");function etr(s){return s===""?s:new URL(`data:${s}`).pathname}t(etr,"ue");function ttr(s){if(s==="")return s;let o=new URL("https://example.com");return o.search=s,o.search.substring(1,o.search.length)}t(ttr,"de");function rtr(s){if(s==="")return s;let o=new URL("https://example.com");return o.hash=s,o.hash.substring(1,o.hash.length)}t(rtr,"pe");var ntr=class{static{t(this,"H")}#e;#r=[];#t={};#n=0;#s=1;#m=0;#c=0;#u=0;#f=0;#p=!1;constructor(s){this.#e=s}get result(){return this.#t}parse(){for(this.#r=jst(this.#e,!0);this.#n<this.#r.length;this.#n+=this.#s){if(this.#s=1,this.#r[this.#n].type==="END"){if(this.#c===0){this.#o(),this.#g()?this.#a(9,1):this.#E()?this.#a(8,1):this.#a(7,0);continue}else if(this.#c===2){this.#h(5);continue}this.#a(10,0);break}if(this.#u>0)if(this.#l())this.#u-=1;else continue;if(this.#A()){this.#u+=1;continue}switch(this.#c){case 0:this.#y()&&this.#h(1);break;case 1:if(this.#y()){this.#D();let s=7,o=1;this.#b()?(s=2,o=3):this.#p&&(s=2),this.#a(s,o)}break;case 2:this.#v()?this.#h(3):(this.#S()||this.#E()||this.#g())&&this.#h(5);break;case 3:this.#C()?this.#a(4,1):this.#v()&&this.#a(5,1);break;case 4:this.#v()&&this.#a(5,1);break;case 5:this.#O()?this.#f+=1:this.#N()&&(this.#f-=1),this.#k()&&!this.#f?this.#a(6,1):this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 6:this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 7:this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 8:this.#g()&&this.#a(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="")}#a(s,o){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#w();break;case 2:break;case 3:this.#t.username=this.#w();break;case 4:this.#t.password=this.#w();break;case 5:this.#t.hostname=this.#w();break;case 6:this.#t.port=this.#w();break;case 7:this.#t.pathname=this.#w();break;case 8:this.#t.search=this.#w();break;case 9:this.#t.hash=this.#w();break;case 10:break}this.#c!==0&&s!==10&&([1,2,3,4].includes(this.#c)&&[6,7,8,9].includes(s)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#c)&&[8,9].includes(s)&&(this.#t.pathname??=this.#p?"/":""),[1,2,3,4,5,6,7].includes(this.#c)&&s===9&&(this.#t.search??="")),this.#i(s,o)}#i(s,o){this.#c=s,this.#m=this.#n+o,this.#n+=o,this.#s=0}#o(){this.#n=this.#m,this.#s=0}#h(s){this.#o(),this.#c=s}#d(s){return s<0&&(s=this.#r.length-s),s<this.#r.length?this.#r[s]:this.#r[this.#r.length-1]}#_(s,o){let f=this.#d(s);return f.value===o&&(f.type==="CHAR"||f.type==="ESCAPED_CHAR"||f.type==="INVALID_CHAR")}#y(){return this.#_(this.#n,":")}#b(){return this.#_(this.#n+1,"/")&&this.#_(this.#n+2,"/")}#v(){return this.#_(this.#n,"@")}#C(){return this.#_(this.#n,":")}#k(){return this.#_(this.#n,":")}#S(){return this.#_(this.#n,"/")}#E(){if(this.#_(this.#n,"?"))return!0;if(this.#r[this.#n].value!=="?")return!1;let s=this.#d(this.#n-1);return s.type!=="NAME"&&s.type!=="REGEX"&&s.type!=="CLOSE"&&s.type!=="ASTERISK"}#g(){return this.#_(this.#n,"#")}#A(){return this.#r[this.#n].type=="OPEN"}#l(){return this.#r[this.#n].type=="CLOSE"}#O(){return this.#_(this.#n,"[")}#N(){return this.#_(this.#n,"]")}#w(){let s=this.#r[this.#n],o=this.#d(this.#m).index;return this.#e.substring(o,s.index)}#D(){let s={};Object.assign(s,YN),s.encodePart=$Ae;let o=jer(this.#w(),void 0,s);this.#p=Wst(o)}},UAe=["protocol","username","password","hostname","port","pathname","search","hash"],GN="*";function Mst(s,o){if(typeof s!="string")throw new TypeError("parameter 1 is not of type 'string'.");let f=new URL(s,o);return{protocol:f.protocol.substring(0,f.protocol.length-1),username:f.username,password:f.password,hostname:f.hostname,port:f.port,pathname:f.pathname,search:f.search!==""?f.search.substring(1,f.search.length):void 0,hash:f.hash!==""?f.hash.substring(1,f.hash.length):void 0}}t(Mst,"ge");function UP(s,o){return o?$V(s):s}t(UP,"b");function zV(s,o,f){let d;if(typeof o.baseURL=="string")try{d=new URL(o.baseURL),o.protocol===void 0&&(s.protocol=UP(d.protocol.substring(0,d.protocol.length-1),f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&(s.username=UP(d.username,f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&o.password===void 0&&(s.password=UP(d.password,f)),o.protocol===void 0&&o.hostname===void 0&&(s.hostname=UP(d.hostname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&(s.port=UP(d.port,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&(s.pathname=UP(d.pathname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&(s.search=UP(d.search.substring(1,d.search.length),f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&o.hash===void 0&&(s.hash=UP(d.hash.substring(1,d.hash.length),f))}catch{throw new TypeError(`invalid baseURL '${o.baseURL}'.`)}if(typeof o.protocol=="string"&&(s.protocol=Ker(o.protocol,f)),typeof o.username=="string"&&(s.username=Her(o.username,f)),typeof o.password=="string"&&(s.password=Ver(o.password,f)),typeof o.hostname=="string"&&(s.hostname=qer(o.hostname,f)),typeof o.port=="string"&&(s.port=Yer(o.port,s.protocol,f)),typeof o.pathname=="string"){if(s.pathname=o.pathname,d&&!zer(s.pathname,f)){let y=d.pathname.lastIndexOf("/");y>=0&&(s.pathname=UP(d.pathname.substring(0,y+1),f)+s.pathname)}s.pathname=Ger(s.pathname,s.protocol,f)}return typeof o.search=="string"&&(s.search=Wer(o.search,f)),typeof o.hash=="string"&&(s.hash=Jer(o.hash,f)),s}t(zV,"w");function $V(s){return s.replace(/([+*?:{}()\\])/g,"\\$1")}t($V,"C");function itr(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(itr,"Oe");function str(s,o){o.delimiter??="/#?",o.prefixes??="./",o.sensitive??=!1,o.strict??=!1,o.end??=!0,o.start??=!0,o.endsWith="";let f=".*",d=`[^${itr(o.delimiter)}]+?`,y=/[$_\u200C\u200D\p{ID_Continue}]/u,x="";for(let P=0;P<s.length;++P){let F=s[P];if(F.type===3){if(F.modifier===3){x+=$V(F.value);continue}x+=`{${$V(F.value)}}${Y9(F.modifier)}`;continue}let W=F.hasCustomName(),V=!!F.suffix.length||!!F.prefix.length&&(F.prefix.length!==1||!o.prefixes.includes(F.prefix)),ye=P>0?s[P-1]:null,fe=P<s.length-1?s[P+1]:null;if(!V&&W&&F.type===1&&F.modifier===3&&fe&&!fe.prefix.length&&!fe.suffix.length)if(fe.type===3){let ae=fe.value.length>0?fe.value[0]:"";V=y.test(ae)}else V=!fe.hasCustomName();if(!V&&!F.prefix.length&&ye&&ye.type===3){let ae=ye.value[ye.value.length-1];V=o.prefixes.includes(ae)}V&&(x+="{"),x+=$V(F.prefix),W&&(x+=`:${F.name}`),F.type===2?x+=`(${F.value})`:F.type===1?W||(x+=`(${d})`):F.type===0&&(!W&&(!ye||ye.type===3||ye.modifier!==3||V||F.prefix!=="")?x+="*":x+=`(${f})`),F.type===1&&W&&F.suffix.length&&y.test(F.suffix[0])&&(x+="\\"),x+=$V(F.suffix),V&&(x+="}"),F.modifier!==3&&(x+=Y9(F.modifier))}return x}t(str,"ke");var Yst=class{static{t(this,"me")}#e;#r={};#t={};#n={};#s={};#m=!1;constructor(s={},o,f){try{let d;if(typeof o=="string"?d=o:f=o,typeof s=="string"){let F=new ntr(s);if(F.parse(),s=F.result,d===void 0&&typeof s.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");s.baseURL=d}else{if(!s||typeof s!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(d)throw new TypeError("parameter 1 is not of type 'string'.")}typeof f>"u"&&(f={ignoreCase:!1});let y={ignoreCase:f.ignoreCase===!0},x={pathname:GN,protocol:GN,username:GN,password:GN,hostname:GN,port:GN,search:GN,hash:GN};this.#e=zV(x,s,!0),qst(this.#e.protocol)===this.#e.port&&(this.#e.port="");let P;for(P of UAe){if(!(P in this.#e))continue;let F={},W=this.#e[P];switch(this.#t[P]=[],P){case"protocol":Object.assign(F,YN),F.encodePart=$Ae;break;case"username":Object.assign(F,YN),F.encodePart=Xer;break;case"password":Object.assign(F,YN),F.encodePart=Zer;break;case"hostname":Object.assign(F,Ber),$st(W)?F.encodePart=Hst:F.encodePart=Vst;break;case"port":Object.assign(F,YN),F.encodePart=Gst;break;case"pathname":Wst(this.#r.protocol)?(Object.assign(F,Uer,y),F.encodePart=Qer):(Object.assign(F,YN,y),F.encodePart=etr);break;case"search":Object.assign(F,YN,y),F.encodePart=ttr;break;case"hash":Object.assign(F,YN,y),F.encodePart=rtr;break}try{this.#s[P]=Bst(W,F),this.#r[P]=Ust(this.#s[P],this.#t[P],F),this.#n[P]=str(this.#s[P],F),this.#m=this.#m||this.#s[P].some(V=>V.type===2)}catch{throw new TypeError(`invalid ${P} pattern '${this.#e[P]}'.`)}}}catch(d){throw new TypeError(`Failed to construct 'URLPattern': ${d.message}`)}}test(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return!1;try{typeof s=="object"?f=zV(f,s,!1):f=zV(f,Mst(s,o),!1)}catch{return!1}let d;for(d of UAe)if(!this.#r[d].exec(f[d]))return!1;return!0}exec(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return;try{typeof s=="object"?f=zV(f,s,!1):f=zV(f,Mst(s,o),!1)}catch{return null}let d={};o?d.inputs=[s,o]:d.inputs=[s];let y;for(y of UAe){let x=this.#r[y].exec(f[y]);if(!x)return null;let P={};for(let[F,W]of this.#t[y].entries())if(typeof W=="string"||typeof W=="number"){let V=x[F+1];P[W]=V}d[y]={input:f[y]??"",groups:P}}return d}static compareComponent(s,o,f){let d=t((F,W)=>{for(let V of["type","modifier","prefix","value","suffix"]){if(F[V]<W[V])return-1;if(F[V]!==W[V])return 1}return 0},"o"),y=new JV(3,"","","","",3),x=new JV(0,"","","","",3),P=t((F,W)=>{let V=0;for(;V<Math.min(F.length,W.length);++V){let ye=d(F[V],W[V]);if(ye)return ye}return F.length===W.length?0:d(F[V]??y,W[V]??y)},"s");return!o.#n[s]&&!f.#n[s]?0:o.#n[s]&&!f.#n[s]?P(o.#s[s],[x]):!o.#n[s]&&f.#n[s]?P([x],f.#s[s]):P(o.#s[s],f.#s[s])}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#m}};globalThis.URLPattern||(globalThis.URLPattern=Yst);import{AssertionError as atr}from"node:assert";function zP(s,o){if(s===!1)throw new atr({message:o})}t(zP,"assert");var Wo;(function(s){s.Object="Object",s.Property="Property",s.Array="Array",s.Literal="Literal",s.TemplateString="TemplateString",s.Identifier="Identifier",s.FunctionCall="FunctionCall",s.Raw="Raw"})(Wo||(Wo={}));function K9(s){return s.type===Wo.Object}t(K9,"isAstObject");function $P(s){return s.type===Wo.Property}t($P,"isAstProperty");function JAe(s){return s.type===Wo.Array}t(JAe,"isAstArray");function dO(s){return s.type===Wo.Literal}t(dO,"isAstLiteral");function KN(s){if(s===void 0)throw new Error("Node is undefined");if(!K9(s))throw new Error("Node is not object")}t(KN,"assertAstObject");import{findNodeAtLocation as otr,getNodeValue as ctr,printParseErrorCode as ltr,visit as utr}from"jsonc-parser";var ftr={DEFAULT:{allowTrailingComma:!1}};function WV(s,o=[],f=ftr.DEFAULT){let d={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function y(W){d.type==="property"&&(d.length=W-d.offset,d=d.parent)}t(y,"ensurePropertyComplete");function x(W){return d.children?.push(W),W}t(x,"onValue"),utr(s,{onObjectBegin:t((W,V,ye)=>{d=x({type:"object",offset:W,length:-1,line:V+1,column:ye+1,parent:d,children:[]})},"onObjectBegin"),onObjectProperty:t((W,V,ye,fe,ae)=>{d=x({type:"property",offset:V,length:-1,line:fe+1,column:ae+1,parent:d,children:[]}),d.children?.push({type:"string",value:W,offset:V,length:ye,line:fe,column:ae,parent:d})},"onObjectProperty"),onObjectEnd:t((W,V)=>{y(W+V),d.length=W+V-d.offset,d=d.parent,y(W+V)},"onObjectEnd"),onArrayBegin:t((W,V,ye,fe)=>{d=x({type:"array",offset:W,length:-1,line:ye+1,column:fe+1,parent:d,children:[]})},"onArrayBegin"),onArrayEnd:t((W,V)=>{d.length=W+V-d.offset,d=d.parent,y(W+V)},"onArrayEnd"),onLiteralValue:t((W,V,ye,fe,ae)=>{x({type:_tr(W),offset:V,length:ye,line:fe+1,column:ae+1,parent:d,value:W}),y(V+ye)},"onLiteralValue"),onSeparator:t((W,V)=>{d.type==="property"&&(W===":"?d.colonOffset=V:W===","&&y(V))},"onSeparator"),onError:t((W,V,ye,fe,ae)=>{o.push({error:W,offset:V,length:ye,line:fe+1,column:ae+1})},"onError")},f);let F=d.children?.[0];return F&&delete F.parent,F}t(WV,"parse");function _tr(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(s){if(Array.isArray(s))return"array"}else return"null";return"object"}default:return"null"}}t(_tr,"getNodeType");function WAe(s,o){return otr(s,o)}t(WAe,"findNodeAtLocation");function qV(s){return ctr(s)}t(qV,"getNodeValue");function Kst(s){return ltr(s)}t(Kst,"printParseErrorCode");var VV=class{static{t(this,"AstAdapter")}parse(o){let d=WV(o,[]);if(d)return this.parseNode(d,void 0);throw new Error("Failed to parse JSON")}convert(o){return this.parseNode(o,void 0)}parseNode(o,f){switch(o.type){case"object":return this.createObject(o,f);case"array":return this.createArray(o,f);case"property":return this.createProperty(o,f);case"string":return this.createLiteral(o,f);case"number":return this.createLiteral(o,f);case"boolean":return this.createLiteral(o,f);case"null":return this.createLiteral(o,f)}}createLiteral(o,f){return{type:Wo.Literal,location:{line:o.line,column:o.column},parent:f,value:o.type==="null"?null:o.value}}createObject(o,f){let d={type:Wo.Object,children:[],parent:f,location:{line:o.line,column:o.column}};return o.children?.forEach(y=>{d.children.push(this.parseNode(y,d))}),d}createProperty(o,f){zP(o.children?.length===2,"Invalid property node");let d={type:Wo.Property,location:{line:o.line,column:o.column},parent:f,name:null,value:null};return d.name={value:o.children[0].value,location:{line:o.line,column:o.column},type:Wo.Identifier,parent:d},d.value=this.parseNode(o.children[1],d),d}createArray(o,f){let d={type:Wo.Array,location:{line:o.line,column:o.column},parent:f,children:[]};return o.children?.forEach(y=>d.children.push(this.parseNode(y,d))),d}};var PS={createLiteral:t((s,o)=>({type:Wo.Literal,parent:o,value:s}),"createLiteral"),createTemplateString:t((s,o)=>({type:Wo.TemplateString,parent:o,value:s}),"createTemplateString"),createIdentifier:t((s,o)=>({type:Wo.Identifier,value:s,parent:o}),"createIdentifier"),createProperty:t((s,o,f)=>{let d={type:Wo.Property,parent:f,name:null,value:o};return d.name={value:s,type:Wo.Identifier,parent:d},d.value.parent=d,d},"createProperty"),createArrayOfLiterals:t((s,o)=>{let f={type:Wo.Array,parent:o,children:[]};for(let d of s)f.children.push(PS.createLiteral(d,f));return f},"createArrayOfLiterals")};var ptr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,HV=class{static{t(this,"SourceGenerator")}generate(o){let f=[];return this.generateSource(f,o),f.join("")}generateSource(o,f){switch(f.type){case Wo.Array:return this.generateArray(o,f);case Wo.Object:return this.generateObject(o,f);case Wo.Property:return this.generateProperty(o,f);case Wo.Literal:return this.generateLiteral(o,f);case Wo.FunctionCall:return this.generateFunctionCall(o,f);case Wo.Identifier:return this.generateIdentifier(o,f);case Wo.Raw:return this.generateRaw(o,f);case Wo.TemplateString:return this.generateTemplateString(o,f)}}generateArray(o,f){o.push("["),f.children.map(d=>{this.generateSource(o,d),o.push(",")}),o.push("]")}generateObject(o,f){o.push("{"),f.children.forEach(d=>{this.generateSource(o,d),o.push(",")}),o.push("}")}generateProperty(o,f){this.generateIdentifier(o,f.name),o.push(":"),this.generateSource(o,f.value)}generateFunctionCall(o,f){o.push(f.name.value),o.push("("),f.children.forEach((d,y,x)=>{this.generateSource(o,d),y<x.length&&o.push(",")}),o.push(")")}generateRaw(o,f){o.push(f.value)}generateTemplateString(o,f){o.push("`"),o.push(f.value.replaceAll("`","\\`")),o.push("`")}generateLiteral(o,f){if(f.value===null)return o.push("null");switch(typeof f.value){case"number":case"boolean":return o.push(`${f.value}`);case"string":{let d=f.value,y=JSON.stringify(d);return o.push(`${y}`)}}}generateIdentifier(o,f){let d=ptr.test(f.value)?f.value:`'${f.value}'`;o.push(d)}};import dtr from"node:fs/promises";import{parse as mtr}from"@swc/core";var Xst=t(async s=>{let o=new Set;try{let f=await dtr.readFile(s,"utf-8");(await mtr(f,{syntax:"typescript"})).body.forEach(y=>{y.type==="ExportDefaultDeclaration"||y.type==="ExportDefaultExpression"?o.add("default"):y.type==="ExportDeclaration"&&y.declaration.type==="FunctionDeclaration"?o.add(y.declaration.identifier.value):y.type==="ExportDeclaration"&&y.declaration.type==="VariableDeclaration"&&y.declaration.declarations[0].id.type==="Identifier"&&o.add(y.declaration.declarations[0].id.value)})}catch{return null}return o},"getJSFileExports");var Zst={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var qAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Qst={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var VAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},mcp:{type:"object",additionalProperties:!1,properties:{enabled:{type:"boolean"}}},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var HAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},mcp:{oneOf:[{type:"object",additionalProperties:!1,properties:{type:{const:"tool"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"},includeOutputSchema:{type:"boolean"},includeStructuredContent:{type:"boolean"},annotations:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},readOnlyHint:{type:"boolean"},destructiveHint:{type:"boolean"},idempotentHint:{type:"boolean"},openWorldHint:{type:"boolean"}}},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"prompt"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"resource"},name:{type:"string"},description:{type:"string"},uri:{type:"string"},mimeType:{type:"string"},enabled:{type:"boolean"},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"graphql"},enabled:{type:"boolean"},introspectionTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}},executeTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}}},required:["type"]}]},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var clt=Pp(Zce(),1),llt=Pp(rle(),1);var nle=class s{static{t(this,"JsonValidator")}static#e=new s;static get instance(){return s.#e}ajv;constructor(){this.ajv=new clt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,llt.default)(this.ajv,{mode:"fast"})}addSchema(o,f){this.ajv.addSchema(o,f)}compile(o){let f=this.ajv.compile(o);return t(y=>({isValid:f(y),errors:this.toSimpleErrors(f.errors,y),warnings:[]}),"validator")}toSimpleErrors(o,f){let d=[];return o?.forEach(y=>{y.keyword==="enum"&&y.params.allowedValues&&Array.isArray(y.params.allowedValues)&&(y.message+=`; ${y.params.allowedValues.join(", ")}`),y.instancePath&&(y.instancePath=y.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let x={details:{}},P=y.instancePath.split("/");if(P.length>2){let W=P[1],V=P[2]?parseInt(P[2],10):0,ye=P[3],fe=Number.isNaN(V)?void 0:f[W][V][ye];x={details:{property:W,index:V,field:ye,fieldValue:fe}}}if(y.keyword==="required"&&y.params.missingProperty&&y.instancePath&&(y.message=`A 'path' is missing required property '${y.params.missingProperty}'`),y.keyword==="additionalProperties"&&y.params.additionalProperty&&y.instancePath&&(y.message=`A 'path' should NOT include property '${y.params.additionalProperty}'`),y.keyword==="type"&&y.params.type&&y.instancePath){let W=y.instancePath.split("/"),V=W[W.length-1];y.message=`Value of property '${V}' must be '${y.params.type}'`}let F=Object.assign(y,x);d.push(F)}),d}};var aI=nle.instance;aI.addSchema(VAe,"route-configuration.schema.json");aI.addSchema(Qst,"policy-configuration.schema.json");aI.addSchema(qAe,"policies.schema.json");aI.addSchema(HAe,"open-api-route-configuration.schema.json");aI.addSchema(Zst,"fragments.schema.json");var B6r=aI.compile(VAe),ult=aI.compile(HAe),lIe=aI.compile(qAe);var ile=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(o){return this.results=lIe(o),this.results}};var sle=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(o){return this.results=ult(o),this.results}};import Ucr from"node:path";var uIe=/\$import\((.*)\)/,EH=/\$env\((.*?)\)/g;var Bk=class extends Error{static{t(this,"CodeGenError")}location;constructor(o,f,d,y){super(o),this.location={file:f,namespace:"",line:d?d.line:0,column:d?d.column:0,length:0,lineText:y??"",suggestion:""}}},Bcr=t(s=>{let o=[],f=s;for(;f.parent;)o.push(f),f=f.parent;return o.reverse()},"invertTree"),VP=t((s,o)=>{if(!s)return!1;let f=Bcr(s);return o.split("/").every((x,P)=>{let F=f[P];return F?x==="*"||$P(F)&&F.name.value===x?!0:x==="{}"?F.type===Wo.Object:x==="[]"?F.type===Wo.Array:!1:!1})},"testPosition");var ale=class{static{t(this,"AstTransformer")}errors=[];transform(o){return this.visitor(o),o}visitor(o){this.visit(o),K9(o)?o.children.forEach(f=>{this.visitor(f)}):JAe(o)?o.children.forEach(f=>{this.visitor(f)}):$P(o)&&this.visitor(o.value)}},flt=t(s=>{let o=new RegExp(EH).exec(s);if(o?.length===2&&o[0]===s)return{type:"raw",value:`environment["${o[1]}"]`};{let f=s.replaceAll(new RegExp(EH),(d,y)=>`\${environment["${y}"] ? environment["${y}"] : ""}`);if(f!==s)return{type:"template",value:f}}return null},"replaceEnvInString"),_lt=t((s,o,f)=>d=>{if(dO(d)&&typeof d.value=="string"&&d.parent&&JAe(d.parent)){if(!s.some(P=>VP(d.parent,P))){EH.test(d.value)&&o.push(new Bk("An $env() statement is not expected at this location.",f,d.location,d.value));return}let x=flt(d.value);if(x){let P=d.parent,F=P.children.indexOf(d);if(F!==-1)if(x.type==="raw"){let W={type:Wo.Raw,parent:P,value:x.value};P.children[F]=W}else P.children[F]=PS.createTemplateString(x.value,d)}return}if(!$P(d)||!dO(d.value)||typeof d.value.value!="string")return;if(!s.some(x=>VP(d,x))){EH.test(d.value.value)&&o.push(new Bk("An $env() statement is not expected at this location.",f,d.location,d.value.value));return}let y=flt(d.value.value);if(y)if(y.type==="raw"){let x={type:Wo.Raw,parent:null,value:y.value};d.value=x}else d.value=PS.createTemplateString(y.value,d)},"getEnvStatementTransformer");var CH="config/routes.json",zcr=["handler/{}/options/*","handler/{}/options/*/[]","policies/[]/{}/handler/{}/options/*","policies/[]/{}/handler/{}/options/*/[]","corsPolicies/[]/{}/*","corsPolicies/[]/{}/*/[]"],$cr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","handler/{}/options/{}/onOpen/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],plt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Jcr="handler/{}/options/{}/rewritePattern",Wcr="handler/{}/options/{}/baseUrl",ole=class extends ale{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(o){this.addedImports.has(o)||this.addedImports.set(o,`__import${this.importCount++}`);let f=this.addedImports.get(o);if(!f)throw new Error("Import name is undefined. This should not happen.");return f}getImports(){let o=[];return this.addedImports.forEach((f,d)=>{o.push({name:f,path:d})}),o}visit(o){this.rewriteHandlerFunction(o),this.rewriteForwardFunction(o),this.replaceImportStatements(o),this.replaceEnvStatements(o)}rewriteHandlerFunction(o){if(!(!$P(o)||!dO(o.value)||typeof o.value.value!="string")&&VP(o,Jcr)){if(!o.parent||!K9(o.parent)){this.errors.push(new Bk("Invalid node, expected object",CH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:dlt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}rewriteForwardFunction(o){if(!(!$P(o)||!dO(o.value)||typeof o.value.value!="string")&&VP(o,Wcr)){if(!o.parent||!K9(o.parent)){this.errors.push(new Bk("Invalid node, expected object",CH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:dlt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}replaceImportStatements(o){if(!$P(o)||!dO(o.value))return;let f=o.value.value;if(typeof f!="string")return;if(!$cr.some(F=>VP(o,F))&&!plt.some(F=>VP(o,F))){if(uIe.test(f)){if(o.name.value==="$ref")return;this.errors.push(new Bk("An $import() statement is not expected at this location.",CH,o.location,f))}return}let d=uIe.exec(f);if(plt.some(F=>VP(o,F))&&!d)return;if(!d){this.errors.push(new Bk("Invalid $import() statement",CH,o.location,f));return}let y=d[1];y=y.replace(/\\/g,"/"),y.startsWith(".")&&(y=Ucr.posix.join("..",y));let x=this.getImportName(y),P={type:Wo.Identifier,parent:o.parent,value:x};o.value=P}replaceEnvStatements=_lt(zcr,this.errors,CH)};function dlt(s){return`(request, context) => {
|
|
575
|
+
`),exitCode:x},"Untar process logs")}}t(oZt,"untarFile");async function cZt(s){if(await sAe(s))return await qN.rm(s,{recursive:!0})}t(cZt,"deleteFolder");var ru=aAe;var vlt=Pp(Fst(),1);var Lst=["ai-gateway-auth-v2","ai-gateway-configuration-executor-v2","ai-gateway-configuration-loader-v2","ai-gateway-fallback-model-v2","ai-gateway-metering-v2","ai-gateway-model-filtering-v2","ai-gateway-semantic-cache","ai-gateway-semantic-cache-v2","akamai-ai-firewall","akamai-ai-firewall-v2","akamai-firewall-for-ai","comet-opik-tracing-v2","galileo-tracing-v2","prompt-injection","semantic-cache"];var JV=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(s,o,f,d,y,x){this.type=s,this.name=o,this.prefix=f,this.value=d,this.suffix=y,this.modifier=x}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Ler=/[$_\p{ID_Start}]/u,Rer=/[$_\u200C\u200D\p{ID_Continue}]/u,zAe=".*";function Mer(s,o){return(o?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(s)}t(Mer,"Re");function jst(s,o=!1){let f=[],d=0;for(;d<s.length;){let y=s[d],x=t(function(P){if(!o)throw new TypeError(P);f.push({type:"INVALID_CHAR",index:d,value:s[d++]})},"c");if(y==="*"){f.push({type:"ASTERISK",index:d,value:s[d++]});continue}if(y==="+"||y==="?"){f.push({type:"OTHER_MODIFIER",index:d,value:s[d++]});continue}if(y==="\\"){f.push({type:"ESCAPED_CHAR",index:d++,value:s[d++]});continue}if(y==="{"){f.push({type:"OPEN",index:d,value:s[d++]});continue}if(y==="}"){f.push({type:"CLOSE",index:d,value:s[d++]});continue}if(y===":"){let P="",F=d+1;for(;F<s.length;){let W=s.substr(F,1);if(F===d+1&&Ler.test(W)||F!==d+1&&Rer.test(W)){P+=s[F++];continue}break}if(!P){x(`Missing parameter name at ${d}`);continue}f.push({type:"NAME",index:d,value:P}),d=F;continue}if(y==="("){let P=1,F="",W=d+1,V=!1;if(s[W]==="?"){x(`Pattern cannot start with "?" at ${W}`);continue}for(;W<s.length;){if(!Mer(s[W],!1)){x(`Invalid character '${s[W]}' at ${W}.`),V=!0;break}if(s[W]==="\\"){F+=s[W++]+s[W++];continue}if(s[W]===")"){if(P--,P===0){W++;break}}else if(s[W]==="("&&(P++,s[W+1]!=="?")){x(`Capturing groups are not allowed at ${W}`),V=!0;break}F+=s[W++]}if(V)continue;if(P){x(`Unbalanced pattern at ${d}`);continue}if(!F){x(`Missing pattern at ${d}`);continue}f.push({type:"REGEX",index:d,value:F}),d=W;continue}f.push({type:"CHAR",index:d,value:s[d++]})}return f.push({type:"END",index:d,value:""}),f}t(jst,"v");function Bst(s,o={}){let f=jst(s);o.delimiter??="/#?",o.prefixes??="./";let d=`[^${_T(o.delimiter)}]+?`,y=[],x=0,P=0,F="",W=new Set,V=t(yn=>{if(P<f.length&&f[P].type===yn)return f[P++].value},"a"),ye=t(()=>V("OTHER_MODIFIER")??V("ASTERISK"),"f"),fe=t(yn=>{let sn=V(yn);if(sn!==void 0)return sn;let{type:In,index:xr}=f[P];throw new TypeError(`Unexpected ${In} at ${xr}, expected ${yn}`)},"d"),ae=t(()=>{let yn="",sn;for(;sn=V("CHAR")??V("ESCAPED_CHAR");)yn+=sn;return yn},"T"),rt=t(yn=>yn,"Se"),Ue=o.encodePart||rt,je="",$t=t(yn=>{je+=yn},"U"),Bt=t(()=>{je.length&&(y.push(new JV(3,"","",Ue(je),"",3)),je="")},"$"),Ir=t((yn,sn,In,xr,gr)=>{let gs=3;switch(gr){case"?":gs=1;break;case"*":gs=0;break;case"+":gs=2;break}if(!sn&&!In&&gs===3){$t(yn);return}if(Bt(),!sn&&!In){if(!yn)return;y.push(new JV(3,"","",Ue(yn),"",gs));return}let si;In?In==="*"?si=zAe:si=In:si=d;let fc=2;si===d?(fc=1,si=""):si===zAe&&(fc=0,si="");let Ci;if(sn?Ci=sn:In&&(Ci=x++),W.has(Ci))throw new TypeError(`Duplicate name '${Ci}'.`);W.add(Ci),y.push(new JV(fc,Ci,Ue(yn),si,Ue(xr),gs))},"V");for(;P<f.length;){let yn=V("CHAR"),sn=V("NAME"),In=V("REGEX");if(!sn&&!In&&(In=V("ASTERISK")),sn||In){let gr=yn??"";o.prefixes.indexOf(gr)===-1&&($t(gr),gr=""),Bt();let gs=ye();Ir(gr,sn,In,"",gs);continue}let xr=yn??V("ESCAPED_CHAR");if(xr){$t(xr);continue}if(V("OPEN")){let gr=ae(),gs=V("NAME"),si=V("REGEX");!gs&&!si&&(si=V("ASTERISK"));let fc=ae();fe("CLOSE");let Ci=ye();Ir(gr,gs,si,fc,Ci);continue}Bt(),fe("END")}return y}t(Bst,"D");function _T(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(_T,"S");function Rst(s){return s&&s.ignoreCase?"ui":"u"}t(Rst,"X");function jer(s,o,f){return Ust(Bst(s,f),o,f)}t(jer,"Z");function Y9(s){switch(s){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(Y9,"k");function Ust(s,o,f={}){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let d=f.start?"^":"";for(let F of s){if(F.type===3){F.modifier===3?d+=_T(F.value):d+=`(?:${_T(F.value)})${Y9(F.modifier)}`;continue}o&&o.push(F.name);let W=`[^${_T(f.delimiter)}]+?`,V=F.value;if(F.type===1?V=W:F.type===0&&(V=zAe),!F.prefix.length&&!F.suffix.length){F.modifier===3||F.modifier===1?d+=`(${V})${Y9(F.modifier)}`:d+=`((?:${V})${Y9(F.modifier)})`;continue}if(F.modifier===3||F.modifier===1){d+=`(?:${_T(F.prefix)}(${V})${_T(F.suffix)})`,d+=Y9(F.modifier);continue}d+=`(?:${_T(F.prefix)}`,d+=`((?:${V})(?:`,d+=_T(F.suffix),d+=_T(F.prefix),d+=`(?:${V}))*)${_T(F.suffix)})`,F.modifier===0&&(d+="?")}let y=`[${_T(f.endsWith)}]|$`,x=`[${_T(f.delimiter)}]`;if(f.end)return f.strict||(d+=`${x}?`),f.endsWith.length?d+=`(?=${y})`:d+="$",new RegExp(d,Rst(f));f.strict||(d+=`(?:${x}(?=${y}))?`);let P=!1;if(s.length){let F=s[s.length-1];F.type===3&&F.modifier===3&&(P=f.delimiter.indexOf(F)>-1)}return P||(d+=`(?=${x}|${y})`),new RegExp(d,Rst(f))}t(Ust,"F");var YN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ber={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Uer={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function zer(s,o){return s.length?s[0]==="/"?!0:!o||s.length<2?!1:(s[0]=="\\"||s[0]=="{")&&s[1]=="/":!1}t(zer,"J");function zst(s,o){return s.startsWith(o)?s.substring(o.length,s.length):s}t(zst,"Q");function $er(s,o){return s.endsWith(o)?s.substr(0,s.length-o.length):s}t($er,"Ee");function $st(s){return!s||s.length<2?!1:s[0]==="["||(s[0]==="\\"||s[0]==="{")&&s[1]==="["}t($st,"W");var Jst=["ftp","file","http","https","ws","wss"];function Wst(s){if(!s)return!0;for(let o of Jst)if(s.test(o))return!0;return!1}t(Wst,"N");function Jer(s,o){if(s=zst(s,"#"),o||s==="")return s;let f=new URL("https://example.com");return f.hash=s,f.hash?f.hash.substring(1,f.hash.length):""}t(Jer,"te");function Wer(s,o){if(s=zst(s,"?"),o||s==="")return s;let f=new URL("https://example.com");return f.search=s,f.search?f.search.substring(1,f.search.length):""}t(Wer,"re");function qer(s,o){return o||s===""?s:$st(s)?Hst(s):Vst(s)}t(qer,"ne");function Ver(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.password=s,f.password}t(Ver,"se");function Her(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.username=s,f.username}t(Her,"ie");function Ger(s,o,f){if(f||s==="")return s;if(o&&!Jst.includes(o))return new URL(`${o}:${s}`).pathname;let d=s[0]=="/";return s=new URL(d?s:"/-"+s,"https://example.com").pathname,d||(s=s.substring(2,s.length)),s}t(Ger,"ae");function Yer(s,o,f){return qst(o)===s&&(s=""),f||s===""?s:Gst(s)}t(Yer,"oe");function Ker(s,o){return s=$er(s,":"),o||s===""?s:$Ae(s)}t(Ker,"ce");function qst(s){switch(s){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(qst,"_");function $Ae(s){if(s==="")return s;if(/^[-+.A-Za-z0-9]*$/.test(s))return s.toLowerCase();throw new TypeError(`Invalid protocol '${s}'.`)}t($Ae,"y");function Xer(s){if(s==="")return s;let o=new URL("https://example.com");return o.username=s,o.username}t(Xer,"le");function Zer(s){if(s==="")return s;let o=new URL("https://example.com");return o.password=s,o.password}t(Zer,"fe");function Vst(s){if(s==="")return s;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(s))throw new TypeError(`Invalid hostname '${s}'`);let o=new URL("https://example.com");return o.hostname=s,o.hostname}t(Vst,"z");function Hst(s){if(s==="")return s;if(/[^0-9a-fA-F[\]:]/g.test(s))throw new TypeError(`Invalid IPv6 hostname '${s}'`);return s.toLowerCase()}t(Hst,"j");function Gst(s){if(s===""||/^[0-9]*$/.test(s)&&parseInt(s)<=65535)return s;throw new TypeError(`Invalid port '${s}'.`)}t(Gst,"K");function Qer(s){if(s==="")return s;let o=new URL("https://example.com");return o.pathname=s[0]!=="/"?"/-"+s:s,s[0]!=="/"?o.pathname.substring(2,o.pathname.length):o.pathname}t(Qer,"he");function etr(s){return s===""?s:new URL(`data:${s}`).pathname}t(etr,"ue");function ttr(s){if(s==="")return s;let o=new URL("https://example.com");return o.search=s,o.search.substring(1,o.search.length)}t(ttr,"de");function rtr(s){if(s==="")return s;let o=new URL("https://example.com");return o.hash=s,o.hash.substring(1,o.hash.length)}t(rtr,"pe");var ntr=class{static{t(this,"H")}#e;#r=[];#t={};#n=0;#s=1;#m=0;#c=0;#u=0;#f=0;#p=!1;constructor(s){this.#e=s}get result(){return this.#t}parse(){for(this.#r=jst(this.#e,!0);this.#n<this.#r.length;this.#n+=this.#s){if(this.#s=1,this.#r[this.#n].type==="END"){if(this.#c===0){this.#o(),this.#g()?this.#a(9,1):this.#E()?this.#a(8,1):this.#a(7,0);continue}else if(this.#c===2){this.#h(5);continue}this.#a(10,0);break}if(this.#u>0)if(this.#l())this.#u-=1;else continue;if(this.#A()){this.#u+=1;continue}switch(this.#c){case 0:this.#y()&&this.#h(1);break;case 1:if(this.#y()){this.#D();let s=7,o=1;this.#b()?(s=2,o=3):this.#p&&(s=2),this.#a(s,o)}break;case 2:this.#v()?this.#h(3):(this.#S()||this.#E()||this.#g())&&this.#h(5);break;case 3:this.#C()?this.#a(4,1):this.#v()&&this.#a(5,1);break;case 4:this.#v()&&this.#a(5,1);break;case 5:this.#O()?this.#f+=1:this.#N()&&(this.#f-=1),this.#k()&&!this.#f?this.#a(6,1):this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 6:this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 7:this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 8:this.#g()&&this.#a(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="")}#a(s,o){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#w();break;case 2:break;case 3:this.#t.username=this.#w();break;case 4:this.#t.password=this.#w();break;case 5:this.#t.hostname=this.#w();break;case 6:this.#t.port=this.#w();break;case 7:this.#t.pathname=this.#w();break;case 8:this.#t.search=this.#w();break;case 9:this.#t.hash=this.#w();break;case 10:break}this.#c!==0&&s!==10&&([1,2,3,4].includes(this.#c)&&[6,7,8,9].includes(s)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#c)&&[8,9].includes(s)&&(this.#t.pathname??=this.#p?"/":""),[1,2,3,4,5,6,7].includes(this.#c)&&s===9&&(this.#t.search??="")),this.#i(s,o)}#i(s,o){this.#c=s,this.#m=this.#n+o,this.#n+=o,this.#s=0}#o(){this.#n=this.#m,this.#s=0}#h(s){this.#o(),this.#c=s}#d(s){return s<0&&(s=this.#r.length-s),s<this.#r.length?this.#r[s]:this.#r[this.#r.length-1]}#_(s,o){let f=this.#d(s);return f.value===o&&(f.type==="CHAR"||f.type==="ESCAPED_CHAR"||f.type==="INVALID_CHAR")}#y(){return this.#_(this.#n,":")}#b(){return this.#_(this.#n+1,"/")&&this.#_(this.#n+2,"/")}#v(){return this.#_(this.#n,"@")}#C(){return this.#_(this.#n,":")}#k(){return this.#_(this.#n,":")}#S(){return this.#_(this.#n,"/")}#E(){if(this.#_(this.#n,"?"))return!0;if(this.#r[this.#n].value!=="?")return!1;let s=this.#d(this.#n-1);return s.type!=="NAME"&&s.type!=="REGEX"&&s.type!=="CLOSE"&&s.type!=="ASTERISK"}#g(){return this.#_(this.#n,"#")}#A(){return this.#r[this.#n].type=="OPEN"}#l(){return this.#r[this.#n].type=="CLOSE"}#O(){return this.#_(this.#n,"[")}#N(){return this.#_(this.#n,"]")}#w(){let s=this.#r[this.#n],o=this.#d(this.#m).index;return this.#e.substring(o,s.index)}#D(){let s={};Object.assign(s,YN),s.encodePart=$Ae;let o=jer(this.#w(),void 0,s);this.#p=Wst(o)}},UAe=["protocol","username","password","hostname","port","pathname","search","hash"],GN="*";function Mst(s,o){if(typeof s!="string")throw new TypeError("parameter 1 is not of type 'string'.");let f=new URL(s,o);return{protocol:f.protocol.substring(0,f.protocol.length-1),username:f.username,password:f.password,hostname:f.hostname,port:f.port,pathname:f.pathname,search:f.search!==""?f.search.substring(1,f.search.length):void 0,hash:f.hash!==""?f.hash.substring(1,f.hash.length):void 0}}t(Mst,"ge");function UP(s,o){return o?$V(s):s}t(UP,"b");function zV(s,o,f){let d;if(typeof o.baseURL=="string")try{d=new URL(o.baseURL),o.protocol===void 0&&(s.protocol=UP(d.protocol.substring(0,d.protocol.length-1),f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&(s.username=UP(d.username,f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&o.password===void 0&&(s.password=UP(d.password,f)),o.protocol===void 0&&o.hostname===void 0&&(s.hostname=UP(d.hostname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&(s.port=UP(d.port,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&(s.pathname=UP(d.pathname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&(s.search=UP(d.search.substring(1,d.search.length),f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&o.hash===void 0&&(s.hash=UP(d.hash.substring(1,d.hash.length),f))}catch{throw new TypeError(`invalid baseURL '${o.baseURL}'.`)}if(typeof o.protocol=="string"&&(s.protocol=Ker(o.protocol,f)),typeof o.username=="string"&&(s.username=Her(o.username,f)),typeof o.password=="string"&&(s.password=Ver(o.password,f)),typeof o.hostname=="string"&&(s.hostname=qer(o.hostname,f)),typeof o.port=="string"&&(s.port=Yer(o.port,s.protocol,f)),typeof o.pathname=="string"){if(s.pathname=o.pathname,d&&!zer(s.pathname,f)){let y=d.pathname.lastIndexOf("/");y>=0&&(s.pathname=UP(d.pathname.substring(0,y+1),f)+s.pathname)}s.pathname=Ger(s.pathname,s.protocol,f)}return typeof o.search=="string"&&(s.search=Wer(o.search,f)),typeof o.hash=="string"&&(s.hash=Jer(o.hash,f)),s}t(zV,"w");function $V(s){return s.replace(/([+*?:{}()\\])/g,"\\$1")}t($V,"C");function itr(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(itr,"Oe");function str(s,o){o.delimiter??="/#?",o.prefixes??="./",o.sensitive??=!1,o.strict??=!1,o.end??=!0,o.start??=!0,o.endsWith="";let f=".*",d=`[^${itr(o.delimiter)}]+?`,y=/[$_\u200C\u200D\p{ID_Continue}]/u,x="";for(let P=0;P<s.length;++P){let F=s[P];if(F.type===3){if(F.modifier===3){x+=$V(F.value);continue}x+=`{${$V(F.value)}}${Y9(F.modifier)}`;continue}let W=F.hasCustomName(),V=!!F.suffix.length||!!F.prefix.length&&(F.prefix.length!==1||!o.prefixes.includes(F.prefix)),ye=P>0?s[P-1]:null,fe=P<s.length-1?s[P+1]:null;if(!V&&W&&F.type===1&&F.modifier===3&&fe&&!fe.prefix.length&&!fe.suffix.length)if(fe.type===3){let ae=fe.value.length>0?fe.value[0]:"";V=y.test(ae)}else V=!fe.hasCustomName();if(!V&&!F.prefix.length&&ye&&ye.type===3){let ae=ye.value[ye.value.length-1];V=o.prefixes.includes(ae)}V&&(x+="{"),x+=$V(F.prefix),W&&(x+=`:${F.name}`),F.type===2?x+=`(${F.value})`:F.type===1?W||(x+=`(${d})`):F.type===0&&(!W&&(!ye||ye.type===3||ye.modifier!==3||V||F.prefix!=="")?x+="*":x+=`(${f})`),F.type===1&&W&&F.suffix.length&&y.test(F.suffix[0])&&(x+="\\"),x+=$V(F.suffix),V&&(x+="}"),F.modifier!==3&&(x+=Y9(F.modifier))}return x}t(str,"ke");var Yst=class{static{t(this,"me")}#e;#r={};#t={};#n={};#s={};#m=!1;constructor(s={},o,f){try{let d;if(typeof o=="string"?d=o:f=o,typeof s=="string"){let F=new ntr(s);if(F.parse(),s=F.result,d===void 0&&typeof s.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");s.baseURL=d}else{if(!s||typeof s!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(d)throw new TypeError("parameter 1 is not of type 'string'.")}typeof f>"u"&&(f={ignoreCase:!1});let y={ignoreCase:f.ignoreCase===!0},x={pathname:GN,protocol:GN,username:GN,password:GN,hostname:GN,port:GN,search:GN,hash:GN};this.#e=zV(x,s,!0),qst(this.#e.protocol)===this.#e.port&&(this.#e.port="");let P;for(P of UAe){if(!(P in this.#e))continue;let F={},W=this.#e[P];switch(this.#t[P]=[],P){case"protocol":Object.assign(F,YN),F.encodePart=$Ae;break;case"username":Object.assign(F,YN),F.encodePart=Xer;break;case"password":Object.assign(F,YN),F.encodePart=Zer;break;case"hostname":Object.assign(F,Ber),$st(W)?F.encodePart=Hst:F.encodePart=Vst;break;case"port":Object.assign(F,YN),F.encodePart=Gst;break;case"pathname":Wst(this.#r.protocol)?(Object.assign(F,Uer,y),F.encodePart=Qer):(Object.assign(F,YN,y),F.encodePart=etr);break;case"search":Object.assign(F,YN,y),F.encodePart=ttr;break;case"hash":Object.assign(F,YN,y),F.encodePart=rtr;break}try{this.#s[P]=Bst(W,F),this.#r[P]=Ust(this.#s[P],this.#t[P],F),this.#n[P]=str(this.#s[P],F),this.#m=this.#m||this.#s[P].some(V=>V.type===2)}catch{throw new TypeError(`invalid ${P} pattern '${this.#e[P]}'.`)}}}catch(d){throw new TypeError(`Failed to construct 'URLPattern': ${d.message}`)}}test(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return!1;try{typeof s=="object"?f=zV(f,s,!1):f=zV(f,Mst(s,o),!1)}catch{return!1}let d;for(d of UAe)if(!this.#r[d].exec(f[d]))return!1;return!0}exec(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return;try{typeof s=="object"?f=zV(f,s,!1):f=zV(f,Mst(s,o),!1)}catch{return null}let d={};o?d.inputs=[s,o]:d.inputs=[s];let y;for(y of UAe){let x=this.#r[y].exec(f[y]);if(!x)return null;let P={};for(let[F,W]of this.#t[y].entries())if(typeof W=="string"||typeof W=="number"){let V=x[F+1];P[W]=V}d[y]={input:f[y]??"",groups:P}}return d}static compareComponent(s,o,f){let d=t((F,W)=>{for(let V of["type","modifier","prefix","value","suffix"]){if(F[V]<W[V])return-1;if(F[V]!==W[V])return 1}return 0},"o"),y=new JV(3,"","","","",3),x=new JV(0,"","","","",3),P=t((F,W)=>{let V=0;for(;V<Math.min(F.length,W.length);++V){let ye=d(F[V],W[V]);if(ye)return ye}return F.length===W.length?0:d(F[V]??y,W[V]??y)},"s");return!o.#n[s]&&!f.#n[s]?0:o.#n[s]&&!f.#n[s]?P(o.#s[s],[x]):!o.#n[s]&&f.#n[s]?P([x],f.#s[s]):P(o.#s[s],f.#s[s])}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#m}};globalThis.URLPattern||(globalThis.URLPattern=Yst);import{AssertionError as atr}from"node:assert";function zP(s,o){if(s===!1)throw new atr({message:o})}t(zP,"assert");var Wo;(function(s){s.Object="Object",s.Property="Property",s.Array="Array",s.Literal="Literal",s.TemplateString="TemplateString",s.Identifier="Identifier",s.FunctionCall="FunctionCall",s.Raw="Raw"})(Wo||(Wo={}));function K9(s){return s.type===Wo.Object}t(K9,"isAstObject");function $P(s){return s.type===Wo.Property}t($P,"isAstProperty");function JAe(s){return s.type===Wo.Array}t(JAe,"isAstArray");function dO(s){return s.type===Wo.Literal}t(dO,"isAstLiteral");function KN(s){if(s===void 0)throw new Error("Node is undefined");if(!K9(s))throw new Error("Node is not object")}t(KN,"assertAstObject");import{findNodeAtLocation as otr,getNodeValue as ctr,printParseErrorCode as ltr,visit as utr}from"jsonc-parser";var ftr={DEFAULT:{allowTrailingComma:!1}};function WV(s,o=[],f=ftr.DEFAULT){let d={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function y(W){d.type==="property"&&(d.length=W-d.offset,d=d.parent)}t(y,"ensurePropertyComplete");function x(W){return d.children?.push(W),W}t(x,"onValue"),utr(s,{onObjectBegin:t((W,V,ye)=>{d=x({type:"object",offset:W,length:-1,line:V+1,column:ye+1,parent:d,children:[]})},"onObjectBegin"),onObjectProperty:t((W,V,ye,fe,ae)=>{d=x({type:"property",offset:V,length:-1,line:fe+1,column:ae+1,parent:d,children:[]}),d.children?.push({type:"string",value:W,offset:V,length:ye,line:fe,column:ae,parent:d})},"onObjectProperty"),onObjectEnd:t((W,V)=>{y(W+V),d.length=W+V-d.offset,d=d.parent,y(W+V)},"onObjectEnd"),onArrayBegin:t((W,V,ye,fe)=>{d=x({type:"array",offset:W,length:-1,line:ye+1,column:fe+1,parent:d,children:[]})},"onArrayBegin"),onArrayEnd:t((W,V)=>{d.length=W+V-d.offset,d=d.parent,y(W+V)},"onArrayEnd"),onLiteralValue:t((W,V,ye,fe,ae)=>{x({type:_tr(W),offset:V,length:ye,line:fe+1,column:ae+1,parent:d,value:W}),y(V+ye)},"onLiteralValue"),onSeparator:t((W,V)=>{d.type==="property"&&(W===":"?d.colonOffset=V:W===","&&y(V))},"onSeparator"),onError:t((W,V,ye,fe,ae)=>{o.push({error:W,offset:V,length:ye,line:fe+1,column:ae+1})},"onError")},f);let F=d.children?.[0];return F&&delete F.parent,F}t(WV,"parse");function _tr(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(s){if(Array.isArray(s))return"array"}else return"null";return"object"}default:return"null"}}t(_tr,"getNodeType");function WAe(s,o){return otr(s,o)}t(WAe,"findNodeAtLocation");function qV(s){return ctr(s)}t(qV,"getNodeValue");function Kst(s){return ltr(s)}t(Kst,"printParseErrorCode");var VV=class{static{t(this,"AstAdapter")}parse(o){let d=WV(o,[]);if(d)return this.parseNode(d,void 0);throw new Error("Failed to parse JSON")}convert(o){return this.parseNode(o,void 0)}parseNode(o,f){switch(o.type){case"object":return this.createObject(o,f);case"array":return this.createArray(o,f);case"property":return this.createProperty(o,f);case"string":return this.createLiteral(o,f);case"number":return this.createLiteral(o,f);case"boolean":return this.createLiteral(o,f);case"null":return this.createLiteral(o,f)}}createLiteral(o,f){return{type:Wo.Literal,location:{line:o.line,column:o.column},parent:f,value:o.type==="null"?null:o.value}}createObject(o,f){let d={type:Wo.Object,children:[],parent:f,location:{line:o.line,column:o.column}};return o.children?.forEach(y=>{d.children.push(this.parseNode(y,d))}),d}createProperty(o,f){zP(o.children?.length===2,"Invalid property node");let d={type:Wo.Property,location:{line:o.line,column:o.column},parent:f,name:null,value:null};return d.name={value:o.children[0].value,location:{line:o.line,column:o.column},type:Wo.Identifier,parent:d},d.value=this.parseNode(o.children[1],d),d}createArray(o,f){let d={type:Wo.Array,location:{line:o.line,column:o.column},parent:f,children:[]};return o.children?.forEach(y=>d.children.push(this.parseNode(y,d))),d}};var PS={createLiteral:t((s,o)=>({type:Wo.Literal,parent:o,value:s}),"createLiteral"),createTemplateString:t((s,o)=>({type:Wo.TemplateString,parent:o,value:s}),"createTemplateString"),createIdentifier:t((s,o)=>({type:Wo.Identifier,value:s,parent:o}),"createIdentifier"),createProperty:t((s,o,f)=>{let d={type:Wo.Property,parent:f,name:null,value:o};return d.name={value:s,type:Wo.Identifier,parent:d},d.value.parent=d,d},"createProperty"),createArrayOfLiterals:t((s,o)=>{let f={type:Wo.Array,parent:o,children:[]};for(let d of s)f.children.push(PS.createLiteral(d,f));return f},"createArrayOfLiterals")};var ptr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,HV=class{static{t(this,"SourceGenerator")}generate(o){let f=[];return this.generateSource(f,o),f.join("")}generateSource(o,f){switch(f.type){case Wo.Array:return this.generateArray(o,f);case Wo.Object:return this.generateObject(o,f);case Wo.Property:return this.generateProperty(o,f);case Wo.Literal:return this.generateLiteral(o,f);case Wo.FunctionCall:return this.generateFunctionCall(o,f);case Wo.Identifier:return this.generateIdentifier(o,f);case Wo.Raw:return this.generateRaw(o,f);case Wo.TemplateString:return this.generateTemplateString(o,f)}}generateArray(o,f){o.push("["),f.children.map(d=>{this.generateSource(o,d),o.push(",")}),o.push("]")}generateObject(o,f){o.push("{"),f.children.forEach(d=>{this.generateSource(o,d),o.push(",")}),o.push("}")}generateProperty(o,f){this.generateIdentifier(o,f.name),o.push(":"),this.generateSource(o,f.value)}generateFunctionCall(o,f){o.push(f.name.value),o.push("("),f.children.forEach((d,y,x)=>{this.generateSource(o,d),y<x.length&&o.push(",")}),o.push(")")}generateRaw(o,f){o.push(f.value)}generateTemplateString(o,f){o.push("`"),o.push(f.value.replaceAll("`","\\`")),o.push("`")}generateLiteral(o,f){if(f.value===null)return o.push("null");switch(typeof f.value){case"number":case"boolean":return o.push(`${f.value}`);case"string":{let d=f.value,y=JSON.stringify(d);return o.push(`${y}`)}}}generateIdentifier(o,f){let d=ptr.test(f.value)?f.value:`'${f.value}'`;o.push(d)}};import dtr from"node:fs/promises";import{parse as mtr}from"@swc/core";var Xst=t(async s=>{let o=new Set;try{let f=await dtr.readFile(s,"utf-8");(await mtr(f,{syntax:"typescript"})).body.forEach(y=>{y.type==="ExportDefaultDeclaration"||y.type==="ExportDefaultExpression"?o.add("default"):y.type==="ExportDeclaration"&&y.declaration.type==="FunctionDeclaration"?o.add(y.declaration.identifier.value):y.type==="ExportDeclaration"&&y.declaration.type==="VariableDeclaration"&&y.declaration.declarations[0].id.type==="Identifier"&&o.add(y.declaration.declarations[0].id.value)})}catch{return null}return o},"getJSFileExports");var Zst={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var qAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var Qst={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var VAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},mcp:{type:"object",additionalProperties:!1,properties:{enabled:{type:"boolean"}}},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var HAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},mcp:{oneOf:[{type:"object",additionalProperties:!1,properties:{type:{const:"tool"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"},includeOutputSchema:{type:"boolean"},includeStructuredContent:{type:"boolean"},annotations:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},readOnlyHint:{type:"boolean"},destructiveHint:{type:"boolean"},idempotentHint:{type:"boolean"},openWorldHint:{type:"boolean"}}},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"prompt"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"resource"},name:{type:"string"},description:{type:"string"},uri:{type:"string"},mimeType:{type:"string"},enabled:{type:"boolean"},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"graphql"},enabled:{type:"boolean"},introspectionTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}},executeTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}}},required:["type"]}]},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var clt=Pp(Zce(),1),llt=Pp(rle(),1);var nle=class s{static{t(this,"JsonValidator")}static#e=new s;static get instance(){return s.#e}ajv;constructor(){this.ajv=new clt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,llt.default)(this.ajv,{mode:"fast"})}addSchema(o,f){this.ajv.addSchema(o,f)}compile(o){let f=this.ajv.compile(o);return t(y=>({isValid:f(y),errors:this.toSimpleErrors(f.errors,y),warnings:[]}),"validator")}toSimpleErrors(o,f){let d=[];return o?.forEach(y=>{y.keyword==="enum"&&y.params.allowedValues&&Array.isArray(y.params.allowedValues)&&(y.message+=`; ${y.params.allowedValues.join(", ")}`),y.instancePath&&(y.instancePath=y.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let x={details:{}},P=y.instancePath.split("/");if(P.length>2){let W=P[1],V=P[2]?parseInt(P[2],10):0,ye=P[3],fe=Number.isNaN(V)?void 0:f[W][V][ye];x={details:{property:W,index:V,field:ye,fieldValue:fe}}}if(y.keyword==="required"&&y.params.missingProperty&&y.instancePath&&(y.message=`A 'path' is missing required property '${y.params.missingProperty}'`),y.keyword==="additionalProperties"&&y.params.additionalProperty&&y.instancePath&&(y.message=`A 'path' should NOT include property '${y.params.additionalProperty}'`),y.keyword==="type"&&y.params.type&&y.instancePath){let W=y.instancePath.split("/"),V=W[W.length-1];y.message=`Value of property '${V}' must be '${y.params.type}'`}let F=Object.assign(y,x);d.push(F)}),d}};var aI=nle.instance;aI.addSchema(VAe,"route-configuration.schema.json");aI.addSchema(Qst,"policy-configuration.schema.json");aI.addSchema(qAe,"policies.schema.json");aI.addSchema(HAe,"open-api-route-configuration.schema.json");aI.addSchema(Zst,"fragments.schema.json");var B6r=aI.compile(VAe),ult=aI.compile(HAe),lIe=aI.compile(qAe);var ile=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(o){return this.results=lIe(o),this.results}};var sle=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(o){return this.results=ult(o),this.results}};import Ucr from"node:path";var uIe=/\$import\((.*)\)/,EH=/\$env\((.*?)\)/g;var Bk=class extends Error{static{t(this,"CodeGenError")}location;constructor(o,f,d,y){super(o),this.location={file:f,namespace:"",line:d?d.line:0,column:d?d.column:0,length:0,lineText:y??"",suggestion:""}}},Bcr=t(s=>{let o=[],f=s;for(;f.parent;)o.push(f),f=f.parent;return o.reverse()},"invertTree"),VP=t((s,o)=>{if(!s)return!1;let f=Bcr(s);return o.split("/").every((x,P)=>{let F=f[P];return F?x==="*"||$P(F)&&F.name.value===x?!0:x==="{}"?F.type===Wo.Object:x==="[]"?F.type===Wo.Array:!1:!1})},"testPosition");var ale=class{static{t(this,"AstTransformer")}errors=[];transform(o){return this.visitor(o),o}visitor(o){this.visit(o),K9(o)?o.children.forEach(f=>{this.visitor(f)}):JAe(o)?o.children.forEach(f=>{this.visitor(f)}):$P(o)&&this.visitor(o.value)}},flt=t(s=>{let o=new RegExp(EH).exec(s);if(o?.length===2&&o[0]===s)return{type:"raw",value:`environment["${o[1]}"]`};{let f=s.replaceAll(new RegExp(EH),(d,y)=>`\${environment["${y}"] ? environment["${y}"] : ""}`);if(f!==s)return{type:"template",value:f}}return null},"replaceEnvInString"),_lt=t((s,o,f)=>d=>{if(dO(d)&&typeof d.value=="string"&&d.parent&&JAe(d.parent)){if(!s.some(P=>VP(d.parent,P))){EH.test(d.value)&&o.push(new Bk("An $env() statement is not expected at this location.",f,d.location,d.value));return}let x=flt(d.value);if(x){let P=d.parent,F=P.children.indexOf(d);if(F!==-1)if(x.type==="raw"){let W={type:Wo.Raw,parent:P,value:x.value};P.children[F]=W}else P.children[F]=PS.createTemplateString(x.value,d)}return}if(!$P(d)||!dO(d.value)||typeof d.value.value!="string")return;if(!s.some(x=>VP(d,x))){EH.test(d.value.value)&&o.push(new Bk("An $env() statement is not expected at this location.",f,d.location,d.value.value));return}let y=flt(d.value.value);if(y)if(y.type==="raw"){let x={type:Wo.Raw,parent:null,value:y.value};d.value=x}else d.value=PS.createTemplateString(y.value,d)},"getEnvStatementTransformer");var CH="config/routes.json",zcr=["handler/{}/options/*","handler/{}/options/*/[]","policies/[]/{}/handler/{}/options/*","policies/[]/{}/handler/{}/options/*/[]","corsPolicies/[]/{}/*","corsPolicies/[]/{}/*/[]"],$cr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","handler/{}/options/{}/onOpen/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],plt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],Jcr="handler/{}/options/{}/rewritePattern",Wcr="handler/{}/options/{}/baseUrl",ole=class extends ale{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(o){this.addedImports.has(o)||this.addedImports.set(o,`__import${this.importCount++}`);let f=this.addedImports.get(o);if(!f)throw new Error("Import name is undefined. This should not happen.");return f}getImports(){let o=[];return this.addedImports.forEach((f,d)=>{o.push({name:f,path:d})}),o}visit(o){this.rewriteHandlerFunction(o),this.rewriteForwardFunction(o),this.replaceImportStatements(o),this.replaceEnvStatements(o)}rewriteHandlerFunction(o){if(!(!$P(o)||!dO(o.value)||typeof o.value.value!="string")&&VP(o,Jcr)){if(!o.parent||!K9(o.parent)){this.errors.push(new Bk("Invalid node, expected object",CH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:dlt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}rewriteForwardFunction(o){if(!(!$P(o)||!dO(o.value)||typeof o.value.value!="string")&&VP(o,Wcr)){if(!o.parent||!K9(o.parent)){this.errors.push(new Bk("Invalid node, expected object",CH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:dlt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}replaceImportStatements(o){if(!$P(o)||!dO(o.value))return;let f=o.value.value;if(typeof f!="string")return;if(!$cr.some(F=>VP(o,F))&&!plt.some(F=>VP(o,F))){if(uIe.test(f)){if(o.name.value==="$ref")return;this.errors.push(new Bk("An $import() statement is not expected at this location.",CH,o.location,f))}return}let d=uIe.exec(f);if(plt.some(F=>VP(o,F))&&!d)return;if(!d){this.errors.push(new Bk("Invalid $import() statement",CH,o.location,f));return}let y=d[1];y=y.replace(/\\/g,"/"),y.startsWith(".")&&(y=Ucr.posix.join("..",y));let x=this.getImportName(y),P={type:Wo.Identifier,parent:o.parent,value:x};o.value=P}replaceEnvStatements=_lt(zcr,this.errors,CH)};function dlt(s){return`(request, context) => {
|
|
576
576
|
const { params, url, query, method, headers } = request;
|
|
577
577
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
578
578
|
const e = encodeURIComponent;
|
|
@@ -572,7 +572,7 @@ globstar while`,s,fe,o,ae,rt),this.matchOne(s.slice(fe),o.slice(ae),f))return th
|
|
|
572
572
|
`),stderr:x.join(`
|
|
573
573
|
`),exitCode:P},"Tar process logs")}}t(AZt,"tarFolder");async function NZt({tarFilePath:s,outputDir:o,logger:f}){let d=[],y=[],x;try{await new Promise((P,F)=>{let J=yit("sh",["-c",`tar -xvf ${s} -C ${o};`]);J.stdout.on("data",V=>{let ye=V.toString().trim();ye.length>0&&d.push(ye.trim())}),J.stderr.on("data",V=>{let ye=V.toString().trim();ye.length>0&&y.push(ye.trim())}),J.on("close",V=>{x=V,V===0?P():F(new Error(`tar process exited with code ${V}`))}),J.on("error",V=>{F(V)})})}catch(P){throw new Error("Failed to untar file",{cause:P})}finally{f.info({stdout:d.join(`
|
|
574
574
|
`),stderr:y.join(`
|
|
575
|
-
`),exitCode:x},"Untar process logs")}}t(NZt,"untarFile");async function IZt(s){if(await uAe(s))return await GN.rm(s,{recursive:!0})}t(IZt,"deleteFolder");var ru=fAe;var klt=B_(zst(),1);var $st=["ai-gateway-auth-v2","ai-gateway-configuration-executor-v2","ai-gateway-fallback-model-v2","ai-gateway-metering-v2","ai-gateway-model-filtering-v2","ai-gateway-semantic-cache","ai-gateway-semantic-cache-v2","akamai-ai-firewall","akamai-ai-firewall-v2","akamai-firewall-for-ai","comet-opik-tracing-v2","galileo-tracing-v2","prompt-injection","semantic-cache"];var WV=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(s,o,f,d,y,x){this.type=s,this.name=o,this.prefix=f,this.value=d,this.suffix=y,this.modifier=x}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},str=/[$_\p{ID_Start}]/u,atr=/[$_\u200C\u200D\p{ID_Continue}]/u,VAe=".*";function otr(s,o){return(o?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(s)}t(otr,"Re");function qst(s,o=!1){let f=[],d=0;for(;d<s.length;){let y=s[d],x=t(function(P){if(!o)throw new TypeError(P);f.push({type:"INVALID_CHAR",index:d,value:s[d++]})},"c");if(y==="*"){f.push({type:"ASTERISK",index:d,value:s[d++]});continue}if(y==="+"||y==="?"){f.push({type:"OTHER_MODIFIER",index:d,value:s[d++]});continue}if(y==="\\"){f.push({type:"ESCAPED_CHAR",index:d++,value:s[d++]});continue}if(y==="{"){f.push({type:"OPEN",index:d,value:s[d++]});continue}if(y==="}"){f.push({type:"CLOSE",index:d,value:s[d++]});continue}if(y===":"){let P="",F=d+1;for(;F<s.length;){let J=s.substr(F,1);if(F===d+1&&str.test(J)||F!==d+1&&atr.test(J)){P+=s[F++];continue}break}if(!P){x(`Missing parameter name at ${d}`);continue}f.push({type:"NAME",index:d,value:P}),d=F;continue}if(y==="("){let P=1,F="",J=d+1,V=!1;if(s[J]==="?"){x(`Pattern cannot start with "?" at ${J}`);continue}for(;J<s.length;){if(!otr(s[J],!1)){x(`Invalid character '${s[J]}' at ${J}.`),V=!0;break}if(s[J]==="\\"){F+=s[J++]+s[J++];continue}if(s[J]===")"){if(P--,P===0){J++;break}}else if(s[J]==="("&&(P++,s[J+1]!=="?")){x(`Capturing groups are not allowed at ${J}`),V=!0;break}F+=s[J++]}if(V)continue;if(P){x(`Unbalanced pattern at ${d}`);continue}if(!F){x(`Missing pattern at ${d}`);continue}f.push({type:"REGEX",index:d,value:F}),d=J;continue}f.push({type:"CHAR",index:d,value:s[d++]})}return f.push({type:"END",index:d,value:""}),f}t(qst,"v");function Vst(s,o={}){let f=qst(s);o.delimiter??="/#?",o.prefixes??="./";let d=`[^${pT(o.delimiter)}]+?`,y=[],x=0,P=0,F="",J=new Set,V=t(yn=>{if(P<f.length&&f[P].type===yn)return f[P++].value},"a"),ye=t(()=>V("OTHER_MODIFIER")??V("ASTERISK"),"f"),fe=t(yn=>{let sn=V(yn);if(sn!==void 0)return sn;let{type:In,index:xr}=f[P];throw new TypeError(`Unexpected ${In} at ${xr}, expected ${yn}`)},"d"),ae=t(()=>{let yn="",sn;for(;sn=V("CHAR")??V("ESCAPED_CHAR");)yn+=sn;return yn},"T"),rt=t(yn=>yn,"Se"),Ue=o.encodePart||rt,je="",$t=t(yn=>{je+=yn},"U"),Bt=t(()=>{je.length&&(y.push(new WV(3,"","",Ue(je),"",3)),je="")},"$"),Ir=t((yn,sn,In,xr,gr)=>{let gs=3;switch(gr){case"?":gs=1;break;case"*":gs=0;break;case"+":gs=2;break}if(!sn&&!In&&gs===3){$t(yn);return}if(Bt(),!sn&&!In){if(!yn)return;y.push(new WV(3,"","",Ue(yn),"",gs));return}let si;In?In==="*"?si=VAe:si=In:si=d;let fc=2;si===d?(fc=1,si=""):si===VAe&&(fc=0,si="");let Ci;if(sn?Ci=sn:In&&(Ci=x++),J.has(Ci))throw new TypeError(`Duplicate name '${Ci}'.`);J.add(Ci),y.push(new WV(fc,Ci,Ue(yn),si,Ue(xr),gs))},"V");for(;P<f.length;){let yn=V("CHAR"),sn=V("NAME"),In=V("REGEX");if(!sn&&!In&&(In=V("ASTERISK")),sn||In){let gr=yn??"";o.prefixes.indexOf(gr)===-1&&($t(gr),gr=""),Bt();let gs=ye();Ir(gr,sn,In,"",gs);continue}let xr=yn??V("ESCAPED_CHAR");if(xr){$t(xr);continue}if(V("OPEN")){let gr=ae(),gs=V("NAME"),si=V("REGEX");!gs&&!si&&(si=V("ASTERISK"));let fc=ae();fe("CLOSE");let Ci=ye();Ir(gr,gs,si,fc,Ci);continue}Bt(),fe("END")}return y}t(Vst,"D");function pT(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pT,"S");function Jst(s){return s&&s.ignoreCase?"ui":"u"}t(Jst,"X");function ctr(s,o,f){return Hst(Vst(s,f),o,f)}t(ctr,"Z");function Y9(s){switch(s){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(Y9,"k");function Hst(s,o,f={}){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let d=f.start?"^":"";for(let F of s){if(F.type===3){F.modifier===3?d+=pT(F.value):d+=`(?:${pT(F.value)})${Y9(F.modifier)}`;continue}o&&o.push(F.name);let J=`[^${pT(f.delimiter)}]+?`,V=F.value;if(F.type===1?V=J:F.type===0&&(V=VAe),!F.prefix.length&&!F.suffix.length){F.modifier===3||F.modifier===1?d+=`(${V})${Y9(F.modifier)}`:d+=`((?:${V})${Y9(F.modifier)})`;continue}if(F.modifier===3||F.modifier===1){d+=`(?:${pT(F.prefix)}(${V})${pT(F.suffix)})`,d+=Y9(F.modifier);continue}d+=`(?:${pT(F.prefix)}`,d+=`((?:${V})(?:`,d+=pT(F.suffix),d+=pT(F.prefix),d+=`(?:${V}))*)${pT(F.suffix)})`,F.modifier===0&&(d+="?")}let y=`[${pT(f.endsWith)}]|$`,x=`[${pT(f.delimiter)}]`;if(f.end)return f.strict||(d+=`${x}?`),f.endsWith.length?d+=`(?=${y})`:d+="$",new RegExp(d,Jst(f));f.strict||(d+=`(?:${x}(?=${y}))?`);let P=!1;if(s.length){let F=s[s.length-1];F.type===3&&F.modifier===3&&(P=f.delimiter.indexOf(F)>-1)}return P||(d+=`(?=${x}|${y})`),new RegExp(d,Jst(f))}t(Hst,"F");var ZN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},ltr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},utr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function ftr(s,o){return s.length?s[0]==="/"?!0:!o||s.length<2?!1:(s[0]=="\\"||s[0]=="{")&&s[1]=="/":!1}t(ftr,"J");function Gst(s,o){return s.startsWith(o)?s.substring(o.length,s.length):s}t(Gst,"Q");function _tr(s,o){return s.endsWith(o)?s.substr(0,s.length-o.length):s}t(_tr,"Ee");function Yst(s){return!s||s.length<2?!1:s[0]==="["||(s[0]==="\\"||s[0]==="{")&&s[1]==="["}t(Yst,"W");var Kst=["ftp","file","http","https","ws","wss"];function Xst(s){if(!s)return!0;for(let o of Kst)if(s.test(o))return!0;return!1}t(Xst,"N");function ptr(s,o){if(s=Gst(s,"#"),o||s==="")return s;let f=new URL("https://example.com");return f.hash=s,f.hash?f.hash.substring(1,f.hash.length):""}t(ptr,"te");function dtr(s,o){if(s=Gst(s,"?"),o||s==="")return s;let f=new URL("https://example.com");return f.search=s,f.search?f.search.substring(1,f.search.length):""}t(dtr,"re");function mtr(s,o){return o||s===""?s:Yst(s)?eat(s):Qst(s)}t(mtr,"ne");function htr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.password=s,f.password}t(htr,"se");function gtr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.username=s,f.username}t(gtr,"ie");function ytr(s,o,f){if(f||s==="")return s;if(o&&!Kst.includes(o))return new URL(`${o}:${s}`).pathname;let d=s[0]=="/";return s=new URL(d?s:"/-"+s,"https://example.com").pathname,d||(s=s.substring(2,s.length)),s}t(ytr,"ae");function vtr(s,o,f){return Zst(o)===s&&(s=""),f||s===""?s:tat(s)}t(vtr,"oe");function btr(s,o){return s=_tr(s,":"),o||s===""?s:HAe(s)}t(btr,"ce");function Zst(s){switch(s){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Zst,"_");function HAe(s){if(s==="")return s;if(/^[-+.A-Za-z0-9]*$/.test(s))return s.toLowerCase();throw new TypeError(`Invalid protocol '${s}'.`)}t(HAe,"y");function Str(s){if(s==="")return s;let o=new URL("https://example.com");return o.username=s,o.username}t(Str,"le");function Ttr(s){if(s==="")return s;let o=new URL("https://example.com");return o.password=s,o.password}t(Ttr,"fe");function Qst(s){if(s==="")return s;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(s))throw new TypeError(`Invalid hostname '${s}'`);let o=new URL("https://example.com");return o.hostname=s,o.hostname}t(Qst,"z");function eat(s){if(s==="")return s;if(/[^0-9a-fA-F[\]:]/g.test(s))throw new TypeError(`Invalid IPv6 hostname '${s}'`);return s.toLowerCase()}t(eat,"j");function tat(s){if(s===""||/^[0-9]*$/.test(s)&&parseInt(s)<=65535)return s;throw new TypeError(`Invalid port '${s}'.`)}t(tat,"K");function xtr(s){if(s==="")return s;let o=new URL("https://example.com");return o.pathname=s[0]!=="/"?"/-"+s:s,s[0]!=="/"?o.pathname.substring(2,o.pathname.length):o.pathname}t(xtr,"he");function Etr(s){return s===""?s:new URL(`data:${s}`).pathname}t(Etr,"ue");function Ctr(s){if(s==="")return s;let o=new URL("https://example.com");return o.search=s,o.search.substring(1,o.search.length)}t(Ctr,"de");function ktr(s){if(s==="")return s;let o=new URL("https://example.com");return o.hash=s,o.hash.substring(1,o.hash.length)}t(ktr,"pe");var wtr=class{static{t(this,"H")}#e;#r=[];#t={};#n=0;#s=1;#m=0;#c=0;#u=0;#f=0;#p=!1;constructor(s){this.#e=s}get result(){return this.#t}parse(){for(this.#r=qst(this.#e,!0);this.#n<this.#r.length;this.#n+=this.#s){if(this.#s=1,this.#r[this.#n].type==="END"){if(this.#c===0){this.#o(),this.#g()?this.#a(9,1):this.#E()?this.#a(8,1):this.#a(7,0);continue}else if(this.#c===2){this.#h(5);continue}this.#a(10,0);break}if(this.#u>0)if(this.#l())this.#u-=1;else continue;if(this.#A()){this.#u+=1;continue}switch(this.#c){case 0:this.#y()&&this.#h(1);break;case 1:if(this.#y()){this.#D();let s=7,o=1;this.#b()?(s=2,o=3):this.#p&&(s=2),this.#a(s,o)}break;case 2:this.#v()?this.#h(3):(this.#S()||this.#E()||this.#g())&&this.#h(5);break;case 3:this.#C()?this.#a(4,1):this.#v()&&this.#a(5,1);break;case 4:this.#v()&&this.#a(5,1);break;case 5:this.#O()?this.#f+=1:this.#N()&&(this.#f-=1),this.#k()&&!this.#f?this.#a(6,1):this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 6:this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 7:this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 8:this.#g()&&this.#a(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="")}#a(s,o){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#w();break;case 2:break;case 3:this.#t.username=this.#w();break;case 4:this.#t.password=this.#w();break;case 5:this.#t.hostname=this.#w();break;case 6:this.#t.port=this.#w();break;case 7:this.#t.pathname=this.#w();break;case 8:this.#t.search=this.#w();break;case 9:this.#t.hash=this.#w();break;case 10:break}this.#c!==0&&s!==10&&([1,2,3,4].includes(this.#c)&&[6,7,8,9].includes(s)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#c)&&[8,9].includes(s)&&(this.#t.pathname??=this.#p?"/":""),[1,2,3,4,5,6,7].includes(this.#c)&&s===9&&(this.#t.search??="")),this.#i(s,o)}#i(s,o){this.#c=s,this.#m=this.#n+o,this.#n+=o,this.#s=0}#o(){this.#n=this.#m,this.#s=0}#h(s){this.#o(),this.#c=s}#d(s){return s<0&&(s=this.#r.length-s),s<this.#r.length?this.#r[s]:this.#r[this.#r.length-1]}#_(s,o){let f=this.#d(s);return f.value===o&&(f.type==="CHAR"||f.type==="ESCAPED_CHAR"||f.type==="INVALID_CHAR")}#y(){return this.#_(this.#n,":")}#b(){return this.#_(this.#n+1,"/")&&this.#_(this.#n+2,"/")}#v(){return this.#_(this.#n,"@")}#C(){return this.#_(this.#n,":")}#k(){return this.#_(this.#n,":")}#S(){return this.#_(this.#n,"/")}#E(){if(this.#_(this.#n,"?"))return!0;if(this.#r[this.#n].value!=="?")return!1;let s=this.#d(this.#n-1);return s.type!=="NAME"&&s.type!=="REGEX"&&s.type!=="CLOSE"&&s.type!=="ASTERISK"}#g(){return this.#_(this.#n,"#")}#A(){return this.#r[this.#n].type=="OPEN"}#l(){return this.#r[this.#n].type=="CLOSE"}#O(){return this.#_(this.#n,"[")}#N(){return this.#_(this.#n,"]")}#w(){let s=this.#r[this.#n],o=this.#d(this.#m).index;return this.#e.substring(o,s.index)}#D(){let s={};Object.assign(s,ZN),s.encodePart=HAe;let o=ctr(this.#w(),void 0,s);this.#p=Xst(o)}},qAe=["protocol","username","password","hostname","port","pathname","search","hash"],XN="*";function Wst(s,o){if(typeof s!="string")throw new TypeError("parameter 1 is not of type 'string'.");let f=new URL(s,o);return{protocol:f.protocol.substring(0,f.protocol.length-1),username:f.username,password:f.password,hostname:f.hostname,port:f.port,pathname:f.pathname,search:f.search!==""?f.search.substring(1,f.search.length):void 0,hash:f.hash!==""?f.hash.substring(1,f.hash.length):void 0}}t(Wst,"ge");function JP(s,o){return o?JV(s):s}t(JP,"b");function $V(s,o,f){let d;if(typeof o.baseURL=="string")try{d=new URL(o.baseURL),o.protocol===void 0&&(s.protocol=JP(d.protocol.substring(0,d.protocol.length-1),f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&(s.username=JP(d.username,f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&o.password===void 0&&(s.password=JP(d.password,f)),o.protocol===void 0&&o.hostname===void 0&&(s.hostname=JP(d.hostname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&(s.port=JP(d.port,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&(s.pathname=JP(d.pathname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&(s.search=JP(d.search.substring(1,d.search.length),f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&o.hash===void 0&&(s.hash=JP(d.hash.substring(1,d.hash.length),f))}catch{throw new TypeError(`invalid baseURL '${o.baseURL}'.`)}if(typeof o.protocol=="string"&&(s.protocol=btr(o.protocol,f)),typeof o.username=="string"&&(s.username=gtr(o.username,f)),typeof o.password=="string"&&(s.password=htr(o.password,f)),typeof o.hostname=="string"&&(s.hostname=mtr(o.hostname,f)),typeof o.port=="string"&&(s.port=vtr(o.port,s.protocol,f)),typeof o.pathname=="string"){if(s.pathname=o.pathname,d&&!ftr(s.pathname,f)){let y=d.pathname.lastIndexOf("/");y>=0&&(s.pathname=JP(d.pathname.substring(0,y+1),f)+s.pathname)}s.pathname=ytr(s.pathname,s.protocol,f)}return typeof o.search=="string"&&(s.search=dtr(o.search,f)),typeof o.hash=="string"&&(s.hash=ptr(o.hash,f)),s}t($V,"w");function JV(s){return s.replace(/([+*?:{}()\\])/g,"\\$1")}t(JV,"C");function Dtr(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Dtr,"Oe");function Ptr(s,o){o.delimiter??="/#?",o.prefixes??="./",o.sensitive??=!1,o.strict??=!1,o.end??=!0,o.start??=!0,o.endsWith="";let f=".*",d=`[^${Dtr(o.delimiter)}]+?`,y=/[$_\u200C\u200D\p{ID_Continue}]/u,x="";for(let P=0;P<s.length;++P){let F=s[P];if(F.type===3){if(F.modifier===3){x+=JV(F.value);continue}x+=`{${JV(F.value)}}${Y9(F.modifier)}`;continue}let J=F.hasCustomName(),V=!!F.suffix.length||!!F.prefix.length&&(F.prefix.length!==1||!o.prefixes.includes(F.prefix)),ye=P>0?s[P-1]:null,fe=P<s.length-1?s[P+1]:null;if(!V&&J&&F.type===1&&F.modifier===3&&fe&&!fe.prefix.length&&!fe.suffix.length)if(fe.type===3){let ae=fe.value.length>0?fe.value[0]:"";V=y.test(ae)}else V=!fe.hasCustomName();if(!V&&!F.prefix.length&&ye&&ye.type===3){let ae=ye.value[ye.value.length-1];V=o.prefixes.includes(ae)}V&&(x+="{"),x+=JV(F.prefix),J&&(x+=`:${F.name}`),F.type===2?x+=`(${F.value})`:F.type===1?J||(x+=`(${d})`):F.type===0&&(!J&&(!ye||ye.type===3||ye.modifier!==3||V||F.prefix!=="")?x+="*":x+=`(${f})`),F.type===1&&J&&F.suffix.length&&y.test(F.suffix[0])&&(x+="\\"),x+=JV(F.suffix),V&&(x+="}"),F.modifier!==3&&(x+=Y9(F.modifier))}return x}t(Ptr,"ke");var rat=class{static{t(this,"me")}#e;#r={};#t={};#n={};#s={};#m=!1;constructor(s={},o,f){try{let d;if(typeof o=="string"?d=o:f=o,typeof s=="string"){let F=new wtr(s);if(F.parse(),s=F.result,d===void 0&&typeof s.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");s.baseURL=d}else{if(!s||typeof s!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(d)throw new TypeError("parameter 1 is not of type 'string'.")}typeof f>"u"&&(f={ignoreCase:!1});let y={ignoreCase:f.ignoreCase===!0},x={pathname:XN,protocol:XN,username:XN,password:XN,hostname:XN,port:XN,search:XN,hash:XN};this.#e=$V(x,s,!0),Zst(this.#e.protocol)===this.#e.port&&(this.#e.port="");let P;for(P of qAe){if(!(P in this.#e))continue;let F={},J=this.#e[P];switch(this.#t[P]=[],P){case"protocol":Object.assign(F,ZN),F.encodePart=HAe;break;case"username":Object.assign(F,ZN),F.encodePart=Str;break;case"password":Object.assign(F,ZN),F.encodePart=Ttr;break;case"hostname":Object.assign(F,ltr),Yst(J)?F.encodePart=eat:F.encodePart=Qst;break;case"port":Object.assign(F,ZN),F.encodePart=tat;break;case"pathname":Xst(this.#r.protocol)?(Object.assign(F,utr,y),F.encodePart=xtr):(Object.assign(F,ZN,y),F.encodePart=Etr);break;case"search":Object.assign(F,ZN,y),F.encodePart=Ctr;break;case"hash":Object.assign(F,ZN,y),F.encodePart=ktr;break}try{this.#s[P]=Vst(J,F),this.#r[P]=Hst(this.#s[P],this.#t[P],F),this.#n[P]=Ptr(this.#s[P],F),this.#m=this.#m||this.#s[P].some(V=>V.type===2)}catch{throw new TypeError(`invalid ${P} pattern '${this.#e[P]}'.`)}}}catch(d){throw new TypeError(`Failed to construct 'URLPattern': ${d.message}`)}}test(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return!1;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return!1}let d;for(d of qAe)if(!this.#r[d].exec(f[d]))return!1;return!0}exec(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return null}let d={};o?d.inputs=[s,o]:d.inputs=[s];let y;for(y of qAe){let x=this.#r[y].exec(f[y]);if(!x)return null;let P={};for(let[F,J]of this.#t[y].entries())if(typeof J=="string"||typeof J=="number"){let V=x[F+1];P[J]=V}d[y]={input:f[y]??"",groups:P}}return d}static compareComponent(s,o,f){let d=t((F,J)=>{for(let V of["type","modifier","prefix","value","suffix"]){if(F[V]<J[V])return-1;if(F[V]!==J[V])return 1}return 0},"o"),y=new WV(3,"","","","",3),x=new WV(0,"","","","",3),P=t((F,J)=>{let V=0;for(;V<Math.min(F.length,J.length);++V){let ye=d(F[V],J[V]);if(ye)return ye}return F.length===J.length?0:d(F[V]??y,J[V]??y)},"s");return!o.#n[s]&&!f.#n[s]?0:o.#n[s]&&!f.#n[s]?P(o.#s[s],[x]):!o.#n[s]&&f.#n[s]?P([x],f.#s[s]):P(o.#s[s],f.#s[s])}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#m}};globalThis.URLPattern||(globalThis.URLPattern=rat);import{AssertionError as Atr}from"node:assert";function WP(s,o){if(s===!1)throw new Atr({message:o})}t(WP,"assert");var Wo;(function(s){s.Object="Object",s.Property="Property",s.Array="Array",s.Literal="Literal",s.TemplateString="TemplateString",s.Identifier="Identifier",s.FunctionCall="FunctionCall",s.Raw="Raw"})(Wo||(Wo={}));function K9(s){return s.type===Wo.Object}t(K9,"isAstObject");function qP(s){return s.type===Wo.Property}t(qP,"isAstProperty");function GAe(s){return s.type===Wo.Array}t(GAe,"isAstArray");function hO(s){return s.type===Wo.Literal}t(hO,"isAstLiteral");function QN(s){if(s===void 0)throw new Error("Node is undefined");if(!K9(s))throw new Error("Node is not object")}t(QN,"assertAstObject");import{findNodeAtLocation as Ntr,getNodeValue as Itr,printParseErrorCode as Otr,visit as Ftr}from"jsonc-parser";var Ltr={DEFAULT:{allowTrailingComma:!1}};function qV(s,o=[],f=Ltr.DEFAULT){let d={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function y(J){d.type==="property"&&(d.length=J-d.offset,d=d.parent)}t(y,"ensurePropertyComplete");function x(J){return d.children?.push(J),J}t(x,"onValue"),Ftr(s,{onObjectBegin:t((J,V,ye)=>{d=x({type:"object",offset:J,length:-1,line:V+1,column:ye+1,parent:d,children:[]})},"onObjectBegin"),onObjectProperty:t((J,V,ye,fe,ae)=>{d=x({type:"property",offset:V,length:-1,line:fe+1,column:ae+1,parent:d,children:[]}),d.children?.push({type:"string",value:J,offset:V,length:ye,line:fe,column:ae,parent:d})},"onObjectProperty"),onObjectEnd:t((J,V)=>{y(J+V),d.length=J+V-d.offset,d=d.parent,y(J+V)},"onObjectEnd"),onArrayBegin:t((J,V,ye,fe)=>{d=x({type:"array",offset:J,length:-1,line:ye+1,column:fe+1,parent:d,children:[]})},"onArrayBegin"),onArrayEnd:t((J,V)=>{d.length=J+V-d.offset,d=d.parent,y(J+V)},"onArrayEnd"),onLiteralValue:t((J,V,ye,fe,ae)=>{x({type:Rtr(J),offset:V,length:ye,line:fe+1,column:ae+1,parent:d,value:J}),y(V+ye)},"onLiteralValue"),onSeparator:t((J,V)=>{d.type==="property"&&(J===":"?d.colonOffset=V:J===","&&y(V))},"onSeparator"),onError:t((J,V,ye,fe,ae)=>{o.push({error:J,offset:V,length:ye,line:fe+1,column:ae+1})},"onError")},f);let F=d.children?.[0];return F&&delete F.parent,F}t(qV,"parse");function Rtr(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(s){if(Array.isArray(s))return"array"}else return"null";return"object"}default:return"null"}}t(Rtr,"getNodeType");function YAe(s,o){return Ntr(s,o)}t(YAe,"findNodeAtLocation");function VV(s){return Itr(s)}t(VV,"getNodeValue");function nat(s){return Otr(s)}t(nat,"printParseErrorCode");var HV=class{static{t(this,"AstAdapter")}parse(o){let d=qV(o,[]);if(d)return this.parseNode(d,void 0);throw new Error("Failed to parse JSON")}convert(o){return this.parseNode(o,void 0)}parseNode(o,f){switch(o.type){case"object":return this.createObject(o,f);case"array":return this.createArray(o,f);case"property":return this.createProperty(o,f);case"string":return this.createLiteral(o,f);case"number":return this.createLiteral(o,f);case"boolean":return this.createLiteral(o,f);case"null":return this.createLiteral(o,f)}}createLiteral(o,f){return{type:Wo.Literal,location:{line:o.line,column:o.column},parent:f,value:o.type==="null"?null:o.value}}createObject(o,f){let d={type:Wo.Object,children:[],parent:f,location:{line:o.line,column:o.column}};return o.children?.forEach(y=>{d.children.push(this.parseNode(y,d))}),d}createProperty(o,f){WP(o.children?.length===2,"Invalid property node");let d={type:Wo.Property,location:{line:o.line,column:o.column},parent:f,name:null,value:null};return d.name={value:o.children[0].value,location:{line:o.line,column:o.column},type:Wo.Identifier,parent:d},d.value=this.parseNode(o.children[1],d),d}createArray(o,f){let d={type:Wo.Array,location:{line:o.line,column:o.column},parent:f,children:[]};return o.children?.forEach(y=>d.children.push(this.parseNode(y,d))),d}};var PS={createLiteral:t((s,o)=>({type:Wo.Literal,parent:o,value:s}),"createLiteral"),createTemplateString:t((s,o)=>({type:Wo.TemplateString,parent:o,value:s}),"createTemplateString"),createIdentifier:t((s,o)=>({type:Wo.Identifier,value:s,parent:o}),"createIdentifier"),createProperty:t((s,o,f)=>{let d={type:Wo.Property,parent:f,name:null,value:o};return d.name={value:s,type:Wo.Identifier,parent:d},d.value.parent=d,d},"createProperty"),createArrayOfLiterals:t((s,o)=>{let f={type:Wo.Array,parent:o,children:[]};for(let d of s)f.children.push(PS.createLiteral(d,f));return f},"createArrayOfLiterals")};var Mtr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,GV=class{static{t(this,"SourceGenerator")}generate(o){let f=[];return this.generateSource(f,o),f.join("")}generateSource(o,f){switch(f.type){case Wo.Array:return this.generateArray(o,f);case Wo.Object:return this.generateObject(o,f);case Wo.Property:return this.generateProperty(o,f);case Wo.Literal:return this.generateLiteral(o,f);case Wo.FunctionCall:return this.generateFunctionCall(o,f);case Wo.Identifier:return this.generateIdentifier(o,f);case Wo.Raw:return this.generateRaw(o,f);case Wo.TemplateString:return this.generateTemplateString(o,f)}}generateArray(o,f){o.push("["),f.children.map(d=>{this.generateSource(o,d),o.push(",")}),o.push("]")}generateObject(o,f){o.push("{"),f.children.forEach(d=>{this.generateSource(o,d),o.push(",")}),o.push("}")}generateProperty(o,f){this.generateIdentifier(o,f.name),o.push(":"),this.generateSource(o,f.value)}generateFunctionCall(o,f){o.push(f.name.value),o.push("("),f.children.forEach((d,y,x)=>{this.generateSource(o,d),y<x.length&&o.push(",")}),o.push(")")}generateRaw(o,f){o.push(f.value)}generateTemplateString(o,f){o.push("`"),o.push(f.value.replaceAll("`","\\`")),o.push("`")}generateLiteral(o,f){if(f.value===null)return o.push("null");switch(typeof f.value){case"number":case"boolean":return o.push(`${f.value}`);case"string":{let d=f.value,y=JSON.stringify(d);return o.push(`${y}`)}}}generateIdentifier(o,f){let d=Mtr.test(f.value)?f.value:`'${f.value}'`;o.push(d)}};import jtr from"node:fs/promises";import{parse as Btr}from"@swc/core";var iat=t(async s=>{let o=new Set;try{let f=await jtr.readFile(s,"utf-8");(await Btr(f,{syntax:"typescript"})).body.forEach(y=>{y.type==="ExportDefaultDeclaration"||y.type==="ExportDefaultExpression"?o.add("default"):y.type==="ExportDeclaration"&&y.declaration.type==="FunctionDeclaration"?o.add(y.declaration.identifier.value):y.type==="ExportDeclaration"&&y.declaration.type==="VariableDeclaration"&&y.declaration.declarations[0].id.type==="Identifier"&&o.add(y.declaration.declarations[0].id.value)})}catch{return null}return o},"getJSFileExports");var sat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var KAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var aat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var XAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},mcp:{type:"object",additionalProperties:!1,properties:{enabled:{type:"boolean"}}},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var ZAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},mcp:{oneOf:[{type:"object",additionalProperties:!1,properties:{type:{const:"tool"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"},includeOutputSchema:{type:"boolean"},includeStructuredContent:{type:"boolean"},annotations:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},readOnlyHint:{type:"boolean"},destructiveHint:{type:"boolean"},idempotentHint:{type:"boolean"},openWorldHint:{type:"boolean"}}},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"prompt"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"resource"},name:{type:"string"},description:{type:"string"},uri:{type:"string"},mimeType:{type:"string"},enabled:{type:"boolean"},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"graphql"},enabled:{type:"boolean"},introspectionTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}},executeTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}}},required:["type"]}]},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var mlt=B_(Qce(),1),hlt=B_(nle(),1);var ile=class s{static{t(this,"JsonValidator")}static#e=new s;static get instance(){return s.#e}ajv;constructor(){this.ajv=new mlt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,hlt.default)(this.ajv,{mode:"fast"})}addSchema(o,f){this.ajv.addSchema(o,f)}compile(o){let f=this.ajv.compile(o);return t(y=>({isValid:f(y),errors:this.toSimpleErrors(f.errors,y),warnings:[]}),"validator")}toSimpleErrors(o,f){let d=[];return o?.forEach(y=>{y.keyword==="enum"&&y.params.allowedValues&&Array.isArray(y.params.allowedValues)&&(y.message+=`; ${y.params.allowedValues.join(", ")}`),y.instancePath&&(y.instancePath=y.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let x={details:{}},P=y.instancePath.split("/");if(P.length>2){let J=P[1],V=P[2]?parseInt(P[2],10):0,ye=P[3],fe=Number.isNaN(V)?void 0:f[J][V][ye];x={details:{property:J,index:V,field:ye,fieldValue:fe}}}if(y.keyword==="required"&&y.params.missingProperty&&y.instancePath&&(y.message=`A 'path' is missing required property '${y.params.missingProperty}'`),y.keyword==="additionalProperties"&&y.params.additionalProperty&&y.instancePath&&(y.message=`A 'path' should NOT include property '${y.params.additionalProperty}'`),y.keyword==="type"&&y.params.type&&y.instancePath){let J=y.instancePath.split("/"),V=J[J.length-1];y.message=`Value of property '${V}' must be '${y.params.type}'`}let F=Object.assign(y,x);d.push(F)}),d}};var lI=ile.instance;lI.addSchema(XAe,"route-configuration.schema.json");lI.addSchema(aat,"policy-configuration.schema.json");lI.addSchema(KAe,"policies.schema.json");lI.addSchema(ZAe,"open-api-route-configuration.schema.json");lI.addSchema(sat,"fragments.schema.json");var lNr=lI.compile(XAe),glt=lI.compile(ZAe),dIe=lI.compile(KAe);var sle=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(o){return this.results=dIe(o),this.results}};var ale=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(o){return this.results=glt(o),this.results}};import ulr from"node:path";var mIe=/\$import\((.*)\)/,CH=/\$env\((.*?)\)/g;var zk=class extends Error{static{t(this,"CodeGenError")}location;constructor(o,f,d,y){super(o),this.location={file:f,namespace:"",line:d?d.line:0,column:d?d.column:0,length:0,lineText:y??"",suggestion:""}}},llr=t(s=>{let o=[],f=s;for(;f.parent;)o.push(f),f=f.parent;return o.reverse()},"invertTree"),YP=t((s,o)=>{if(!s)return!1;let f=llr(s);return o.split("/").every((x,P)=>{let F=f[P];return F?x==="*"||qP(F)&&F.name.value===x?!0:x==="{}"?F.type===Wo.Object:x==="[]"?F.type===Wo.Array:!1:!1})},"testPosition");var ole=class{static{t(this,"AstTransformer")}errors=[];transform(o){return this.visitor(o),o}visitor(o){this.visit(o),K9(o)?o.children.forEach(f=>{this.visitor(f)}):GAe(o)?o.children.forEach(f=>{this.visitor(f)}):qP(o)&&this.visitor(o.value)}},ylt=t(s=>{let o=new RegExp(CH).exec(s);if(o?.length===2&&o[0]===s)return{type:"raw",value:`environment["${o[1]}"]`};{let f=s.replaceAll(new RegExp(CH),(d,y)=>`\${environment["${y}"] ? environment["${y}"] : ""}`);if(f!==s)return{type:"template",value:f}}return null},"replaceEnvInString"),vlt=t((s,o,f)=>d=>{if(hO(d)&&typeof d.value=="string"&&d.parent&&GAe(d.parent)){if(!s.some(P=>YP(d.parent,P))){CH.test(d.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value));return}let x=ylt(d.value);if(x){let P=d.parent,F=P.children.indexOf(d);if(F!==-1)if(x.type==="raw"){let J={type:Wo.Raw,parent:P,value:x.value};P.children[F]=J}else P.children[F]=PS.createTemplateString(x.value,d)}return}if(!qP(d)||!hO(d.value)||typeof d.value.value!="string")return;if(!s.some(x=>YP(d,x))){CH.test(d.value.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value.value));return}let y=ylt(d.value.value);if(y)if(y.type==="raw"){let x={type:Wo.Raw,parent:null,value:y.value};d.value=x}else d.value=PS.createTemplateString(y.value,d)},"getEnvStatementTransformer");var kH="config/routes.json",flr=["handler/{}/options/*","handler/{}/options/*/[]","policies/[]/{}/handler/{}/options/*","policies/[]/{}/handler/{}/options/*/[]","corsPolicies/[]/{}/*","corsPolicies/[]/{}/*/[]"],_lr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","handler/{}/options/{}/onOpen/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],blt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],plr="handler/{}/options/{}/rewritePattern",dlr="handler/{}/options/{}/baseUrl",cle=class extends ole{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(o){this.addedImports.has(o)||this.addedImports.set(o,`__import${this.importCount++}`);let f=this.addedImports.get(o);if(!f)throw new Error("Import name is undefined. This should not happen.");return f}getImports(){let o=[];return this.addedImports.forEach((f,d)=>{o.push({name:f,path:d})}),o}visit(o){this.rewriteHandlerFunction(o),this.rewriteForwardFunction(o),this.replaceImportStatements(o),this.replaceEnvStatements(o)}rewriteHandlerFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,plr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}rewriteForwardFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,dlr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}replaceImportStatements(o){if(!qP(o)||!hO(o.value))return;let f=o.value.value;if(typeof f!="string")return;if(!_lr.some(F=>YP(o,F))&&!blt.some(F=>YP(o,F))){if(mIe.test(f)){if(o.name.value==="$ref")return;this.errors.push(new zk("An $import() statement is not expected at this location.",kH,o.location,f))}return}let d=mIe.exec(f);if(blt.some(F=>YP(o,F))&&!d)return;if(!d){this.errors.push(new zk("Invalid $import() statement",kH,o.location,f));return}let y=d[1];y=y.replace(/\\/g,"/"),y.startsWith(".")&&(y=ulr.posix.join("..",y));let x=this.getImportName(y),P={type:Wo.Identifier,parent:o.parent,value:x};o.value=P}replaceEnvStatements=vlt(flr,this.errors,kH)};function Slt(s){return`(request, context) => {
|
|
575
|
+
`),exitCode:x},"Untar process logs")}}t(NZt,"untarFile");async function IZt(s){if(await uAe(s))return await GN.rm(s,{recursive:!0})}t(IZt,"deleteFolder");var ru=fAe;var klt=B_(zst(),1);var $st=["ai-gateway-auth-v2","ai-gateway-configuration-executor-v2","ai-gateway-configuration-loader-v2","ai-gateway-fallback-model-v2","ai-gateway-metering-v2","ai-gateway-model-filtering-v2","ai-gateway-semantic-cache","ai-gateway-semantic-cache-v2","akamai-ai-firewall","akamai-ai-firewall-v2","akamai-firewall-for-ai","comet-opik-tracing-v2","galileo-tracing-v2","prompt-injection","semantic-cache"];var WV=class{static{t(this,"R")}type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(s,o,f,d,y,x){this.type=s,this.name=o,this.prefix=f,this.value=d,this.suffix=y,this.modifier=x}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},str=/[$_\p{ID_Start}]/u,atr=/[$_\u200C\u200D\p{ID_Continue}]/u,VAe=".*";function otr(s,o){return(o?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(s)}t(otr,"Re");function qst(s,o=!1){let f=[],d=0;for(;d<s.length;){let y=s[d],x=t(function(P){if(!o)throw new TypeError(P);f.push({type:"INVALID_CHAR",index:d,value:s[d++]})},"c");if(y==="*"){f.push({type:"ASTERISK",index:d,value:s[d++]});continue}if(y==="+"||y==="?"){f.push({type:"OTHER_MODIFIER",index:d,value:s[d++]});continue}if(y==="\\"){f.push({type:"ESCAPED_CHAR",index:d++,value:s[d++]});continue}if(y==="{"){f.push({type:"OPEN",index:d,value:s[d++]});continue}if(y==="}"){f.push({type:"CLOSE",index:d,value:s[d++]});continue}if(y===":"){let P="",F=d+1;for(;F<s.length;){let J=s.substr(F,1);if(F===d+1&&str.test(J)||F!==d+1&&atr.test(J)){P+=s[F++];continue}break}if(!P){x(`Missing parameter name at ${d}`);continue}f.push({type:"NAME",index:d,value:P}),d=F;continue}if(y==="("){let P=1,F="",J=d+1,V=!1;if(s[J]==="?"){x(`Pattern cannot start with "?" at ${J}`);continue}for(;J<s.length;){if(!otr(s[J],!1)){x(`Invalid character '${s[J]}' at ${J}.`),V=!0;break}if(s[J]==="\\"){F+=s[J++]+s[J++];continue}if(s[J]===")"){if(P--,P===0){J++;break}}else if(s[J]==="("&&(P++,s[J+1]!=="?")){x(`Capturing groups are not allowed at ${J}`),V=!0;break}F+=s[J++]}if(V)continue;if(P){x(`Unbalanced pattern at ${d}`);continue}if(!F){x(`Missing pattern at ${d}`);continue}f.push({type:"REGEX",index:d,value:F}),d=J;continue}f.push({type:"CHAR",index:d,value:s[d++]})}return f.push({type:"END",index:d,value:""}),f}t(qst,"v");function Vst(s,o={}){let f=qst(s);o.delimiter??="/#?",o.prefixes??="./";let d=`[^${pT(o.delimiter)}]+?`,y=[],x=0,P=0,F="",J=new Set,V=t(yn=>{if(P<f.length&&f[P].type===yn)return f[P++].value},"a"),ye=t(()=>V("OTHER_MODIFIER")??V("ASTERISK"),"f"),fe=t(yn=>{let sn=V(yn);if(sn!==void 0)return sn;let{type:In,index:xr}=f[P];throw new TypeError(`Unexpected ${In} at ${xr}, expected ${yn}`)},"d"),ae=t(()=>{let yn="",sn;for(;sn=V("CHAR")??V("ESCAPED_CHAR");)yn+=sn;return yn},"T"),rt=t(yn=>yn,"Se"),Ue=o.encodePart||rt,je="",$t=t(yn=>{je+=yn},"U"),Bt=t(()=>{je.length&&(y.push(new WV(3,"","",Ue(je),"",3)),je="")},"$"),Ir=t((yn,sn,In,xr,gr)=>{let gs=3;switch(gr){case"?":gs=1;break;case"*":gs=0;break;case"+":gs=2;break}if(!sn&&!In&&gs===3){$t(yn);return}if(Bt(),!sn&&!In){if(!yn)return;y.push(new WV(3,"","",Ue(yn),"",gs));return}let si;In?In==="*"?si=VAe:si=In:si=d;let fc=2;si===d?(fc=1,si=""):si===VAe&&(fc=0,si="");let Ci;if(sn?Ci=sn:In&&(Ci=x++),J.has(Ci))throw new TypeError(`Duplicate name '${Ci}'.`);J.add(Ci),y.push(new WV(fc,Ci,Ue(yn),si,Ue(xr),gs))},"V");for(;P<f.length;){let yn=V("CHAR"),sn=V("NAME"),In=V("REGEX");if(!sn&&!In&&(In=V("ASTERISK")),sn||In){let gr=yn??"";o.prefixes.indexOf(gr)===-1&&($t(gr),gr=""),Bt();let gs=ye();Ir(gr,sn,In,"",gs);continue}let xr=yn??V("ESCAPED_CHAR");if(xr){$t(xr);continue}if(V("OPEN")){let gr=ae(),gs=V("NAME"),si=V("REGEX");!gs&&!si&&(si=V("ASTERISK"));let fc=ae();fe("CLOSE");let Ci=ye();Ir(gr,gs,si,fc,Ci);continue}Bt(),fe("END")}return y}t(Vst,"D");function pT(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(pT,"S");function Jst(s){return s&&s.ignoreCase?"ui":"u"}t(Jst,"X");function ctr(s,o,f){return Hst(Vst(s,f),o,f)}t(ctr,"Z");function Y9(s){switch(s){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}t(Y9,"k");function Hst(s,o,f={}){f.delimiter??="/#?",f.prefixes??="./",f.sensitive??=!1,f.strict??=!1,f.end??=!0,f.start??=!0,f.endsWith="";let d=f.start?"^":"";for(let F of s){if(F.type===3){F.modifier===3?d+=pT(F.value):d+=`(?:${pT(F.value)})${Y9(F.modifier)}`;continue}o&&o.push(F.name);let J=`[^${pT(f.delimiter)}]+?`,V=F.value;if(F.type===1?V=J:F.type===0&&(V=VAe),!F.prefix.length&&!F.suffix.length){F.modifier===3||F.modifier===1?d+=`(${V})${Y9(F.modifier)}`:d+=`((?:${V})${Y9(F.modifier)})`;continue}if(F.modifier===3||F.modifier===1){d+=`(?:${pT(F.prefix)}(${V})${pT(F.suffix)})`,d+=Y9(F.modifier);continue}d+=`(?:${pT(F.prefix)}`,d+=`((?:${V})(?:`,d+=pT(F.suffix),d+=pT(F.prefix),d+=`(?:${V}))*)${pT(F.suffix)})`,F.modifier===0&&(d+="?")}let y=`[${pT(f.endsWith)}]|$`,x=`[${pT(f.delimiter)}]`;if(f.end)return f.strict||(d+=`${x}?`),f.endsWith.length?d+=`(?=${y})`:d+="$",new RegExp(d,Jst(f));f.strict||(d+=`(?:${x}(?=${y}))?`);let P=!1;if(s.length){let F=s[s.length-1];F.type===3&&F.modifier===3&&(P=f.delimiter.indexOf(F)>-1)}return P||(d+=`(?=${x}|${y})`),new RegExp(d,Jst(f))}t(Hst,"F");var ZN={delimiter:"",prefixes:"",sensitive:!0,strict:!0},ltr={delimiter:".",prefixes:"",sensitive:!0,strict:!0},utr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function ftr(s,o){return s.length?s[0]==="/"?!0:!o||s.length<2?!1:(s[0]=="\\"||s[0]=="{")&&s[1]=="/":!1}t(ftr,"J");function Gst(s,o){return s.startsWith(o)?s.substring(o.length,s.length):s}t(Gst,"Q");function _tr(s,o){return s.endsWith(o)?s.substr(0,s.length-o.length):s}t(_tr,"Ee");function Yst(s){return!s||s.length<2?!1:s[0]==="["||(s[0]==="\\"||s[0]==="{")&&s[1]==="["}t(Yst,"W");var Kst=["ftp","file","http","https","ws","wss"];function Xst(s){if(!s)return!0;for(let o of Kst)if(s.test(o))return!0;return!1}t(Xst,"N");function ptr(s,o){if(s=Gst(s,"#"),o||s==="")return s;let f=new URL("https://example.com");return f.hash=s,f.hash?f.hash.substring(1,f.hash.length):""}t(ptr,"te");function dtr(s,o){if(s=Gst(s,"?"),o||s==="")return s;let f=new URL("https://example.com");return f.search=s,f.search?f.search.substring(1,f.search.length):""}t(dtr,"re");function mtr(s,o){return o||s===""?s:Yst(s)?eat(s):Qst(s)}t(mtr,"ne");function htr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.password=s,f.password}t(htr,"se");function gtr(s,o){if(o||s==="")return s;let f=new URL("https://example.com");return f.username=s,f.username}t(gtr,"ie");function ytr(s,o,f){if(f||s==="")return s;if(o&&!Kst.includes(o))return new URL(`${o}:${s}`).pathname;let d=s[0]=="/";return s=new URL(d?s:"/-"+s,"https://example.com").pathname,d||(s=s.substring(2,s.length)),s}t(ytr,"ae");function vtr(s,o,f){return Zst(o)===s&&(s=""),f||s===""?s:tat(s)}t(vtr,"oe");function btr(s,o){return s=_tr(s,":"),o||s===""?s:HAe(s)}t(btr,"ce");function Zst(s){switch(s){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}t(Zst,"_");function HAe(s){if(s==="")return s;if(/^[-+.A-Za-z0-9]*$/.test(s))return s.toLowerCase();throw new TypeError(`Invalid protocol '${s}'.`)}t(HAe,"y");function Str(s){if(s==="")return s;let o=new URL("https://example.com");return o.username=s,o.username}t(Str,"le");function Ttr(s){if(s==="")return s;let o=new URL("https://example.com");return o.password=s,o.password}t(Ttr,"fe");function Qst(s){if(s==="")return s;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(s))throw new TypeError(`Invalid hostname '${s}'`);let o=new URL("https://example.com");return o.hostname=s,o.hostname}t(Qst,"z");function eat(s){if(s==="")return s;if(/[^0-9a-fA-F[\]:]/g.test(s))throw new TypeError(`Invalid IPv6 hostname '${s}'`);return s.toLowerCase()}t(eat,"j");function tat(s){if(s===""||/^[0-9]*$/.test(s)&&parseInt(s)<=65535)return s;throw new TypeError(`Invalid port '${s}'.`)}t(tat,"K");function xtr(s){if(s==="")return s;let o=new URL("https://example.com");return o.pathname=s[0]!=="/"?"/-"+s:s,s[0]!=="/"?o.pathname.substring(2,o.pathname.length):o.pathname}t(xtr,"he");function Etr(s){return s===""?s:new URL(`data:${s}`).pathname}t(Etr,"ue");function Ctr(s){if(s==="")return s;let o=new URL("https://example.com");return o.search=s,o.search.substring(1,o.search.length)}t(Ctr,"de");function ktr(s){if(s==="")return s;let o=new URL("https://example.com");return o.hash=s,o.hash.substring(1,o.hash.length)}t(ktr,"pe");var wtr=class{static{t(this,"H")}#e;#r=[];#t={};#n=0;#s=1;#m=0;#c=0;#u=0;#f=0;#p=!1;constructor(s){this.#e=s}get result(){return this.#t}parse(){for(this.#r=qst(this.#e,!0);this.#n<this.#r.length;this.#n+=this.#s){if(this.#s=1,this.#r[this.#n].type==="END"){if(this.#c===0){this.#o(),this.#g()?this.#a(9,1):this.#E()?this.#a(8,1):this.#a(7,0);continue}else if(this.#c===2){this.#h(5);continue}this.#a(10,0);break}if(this.#u>0)if(this.#l())this.#u-=1;else continue;if(this.#A()){this.#u+=1;continue}switch(this.#c){case 0:this.#y()&&this.#h(1);break;case 1:if(this.#y()){this.#D();let s=7,o=1;this.#b()?(s=2,o=3):this.#p&&(s=2),this.#a(s,o)}break;case 2:this.#v()?this.#h(3):(this.#S()||this.#E()||this.#g())&&this.#h(5);break;case 3:this.#C()?this.#a(4,1):this.#v()&&this.#a(5,1);break;case 4:this.#v()&&this.#a(5,1);break;case 5:this.#O()?this.#f+=1:this.#N()&&(this.#f-=1),this.#k()&&!this.#f?this.#a(6,1):this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 6:this.#S()?this.#a(7,0):this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 7:this.#E()?this.#a(8,1):this.#g()&&this.#a(9,1);break;case 8:this.#g()&&this.#a(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port="")}#a(s,o){switch(this.#c){case 0:break;case 1:this.#t.protocol=this.#w();break;case 2:break;case 3:this.#t.username=this.#w();break;case 4:this.#t.password=this.#w();break;case 5:this.#t.hostname=this.#w();break;case 6:this.#t.port=this.#w();break;case 7:this.#t.pathname=this.#w();break;case 8:this.#t.search=this.#w();break;case 9:this.#t.hash=this.#w();break;case 10:break}this.#c!==0&&s!==10&&([1,2,3,4].includes(this.#c)&&[6,7,8,9].includes(s)&&(this.#t.hostname??=""),[1,2,3,4,5,6].includes(this.#c)&&[8,9].includes(s)&&(this.#t.pathname??=this.#p?"/":""),[1,2,3,4,5,6,7].includes(this.#c)&&s===9&&(this.#t.search??="")),this.#i(s,o)}#i(s,o){this.#c=s,this.#m=this.#n+o,this.#n+=o,this.#s=0}#o(){this.#n=this.#m,this.#s=0}#h(s){this.#o(),this.#c=s}#d(s){return s<0&&(s=this.#r.length-s),s<this.#r.length?this.#r[s]:this.#r[this.#r.length-1]}#_(s,o){let f=this.#d(s);return f.value===o&&(f.type==="CHAR"||f.type==="ESCAPED_CHAR"||f.type==="INVALID_CHAR")}#y(){return this.#_(this.#n,":")}#b(){return this.#_(this.#n+1,"/")&&this.#_(this.#n+2,"/")}#v(){return this.#_(this.#n,"@")}#C(){return this.#_(this.#n,":")}#k(){return this.#_(this.#n,":")}#S(){return this.#_(this.#n,"/")}#E(){if(this.#_(this.#n,"?"))return!0;if(this.#r[this.#n].value!=="?")return!1;let s=this.#d(this.#n-1);return s.type!=="NAME"&&s.type!=="REGEX"&&s.type!=="CLOSE"&&s.type!=="ASTERISK"}#g(){return this.#_(this.#n,"#")}#A(){return this.#r[this.#n].type=="OPEN"}#l(){return this.#r[this.#n].type=="CLOSE"}#O(){return this.#_(this.#n,"[")}#N(){return this.#_(this.#n,"]")}#w(){let s=this.#r[this.#n],o=this.#d(this.#m).index;return this.#e.substring(o,s.index)}#D(){let s={};Object.assign(s,ZN),s.encodePart=HAe;let o=ctr(this.#w(),void 0,s);this.#p=Xst(o)}},qAe=["protocol","username","password","hostname","port","pathname","search","hash"],XN="*";function Wst(s,o){if(typeof s!="string")throw new TypeError("parameter 1 is not of type 'string'.");let f=new URL(s,o);return{protocol:f.protocol.substring(0,f.protocol.length-1),username:f.username,password:f.password,hostname:f.hostname,port:f.port,pathname:f.pathname,search:f.search!==""?f.search.substring(1,f.search.length):void 0,hash:f.hash!==""?f.hash.substring(1,f.hash.length):void 0}}t(Wst,"ge");function JP(s,o){return o?JV(s):s}t(JP,"b");function $V(s,o,f){let d;if(typeof o.baseURL=="string")try{d=new URL(o.baseURL),o.protocol===void 0&&(s.protocol=JP(d.protocol.substring(0,d.protocol.length-1),f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&(s.username=JP(d.username,f)),!f&&o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.username===void 0&&o.password===void 0&&(s.password=JP(d.password,f)),o.protocol===void 0&&o.hostname===void 0&&(s.hostname=JP(d.hostname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&(s.port=JP(d.port,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&(s.pathname=JP(d.pathname,f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&(s.search=JP(d.search.substring(1,d.search.length),f)),o.protocol===void 0&&o.hostname===void 0&&o.port===void 0&&o.pathname===void 0&&o.search===void 0&&o.hash===void 0&&(s.hash=JP(d.hash.substring(1,d.hash.length),f))}catch{throw new TypeError(`invalid baseURL '${o.baseURL}'.`)}if(typeof o.protocol=="string"&&(s.protocol=btr(o.protocol,f)),typeof o.username=="string"&&(s.username=gtr(o.username,f)),typeof o.password=="string"&&(s.password=htr(o.password,f)),typeof o.hostname=="string"&&(s.hostname=mtr(o.hostname,f)),typeof o.port=="string"&&(s.port=vtr(o.port,s.protocol,f)),typeof o.pathname=="string"){if(s.pathname=o.pathname,d&&!ftr(s.pathname,f)){let y=d.pathname.lastIndexOf("/");y>=0&&(s.pathname=JP(d.pathname.substring(0,y+1),f)+s.pathname)}s.pathname=ytr(s.pathname,s.protocol,f)}return typeof o.search=="string"&&(s.search=dtr(o.search,f)),typeof o.hash=="string"&&(s.hash=ptr(o.hash,f)),s}t($V,"w");function JV(s){return s.replace(/([+*?:{}()\\])/g,"\\$1")}t(JV,"C");function Dtr(s){return s.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}t(Dtr,"Oe");function Ptr(s,o){o.delimiter??="/#?",o.prefixes??="./",o.sensitive??=!1,o.strict??=!1,o.end??=!0,o.start??=!0,o.endsWith="";let f=".*",d=`[^${Dtr(o.delimiter)}]+?`,y=/[$_\u200C\u200D\p{ID_Continue}]/u,x="";for(let P=0;P<s.length;++P){let F=s[P];if(F.type===3){if(F.modifier===3){x+=JV(F.value);continue}x+=`{${JV(F.value)}}${Y9(F.modifier)}`;continue}let J=F.hasCustomName(),V=!!F.suffix.length||!!F.prefix.length&&(F.prefix.length!==1||!o.prefixes.includes(F.prefix)),ye=P>0?s[P-1]:null,fe=P<s.length-1?s[P+1]:null;if(!V&&J&&F.type===1&&F.modifier===3&&fe&&!fe.prefix.length&&!fe.suffix.length)if(fe.type===3){let ae=fe.value.length>0?fe.value[0]:"";V=y.test(ae)}else V=!fe.hasCustomName();if(!V&&!F.prefix.length&&ye&&ye.type===3){let ae=ye.value[ye.value.length-1];V=o.prefixes.includes(ae)}V&&(x+="{"),x+=JV(F.prefix),J&&(x+=`:${F.name}`),F.type===2?x+=`(${F.value})`:F.type===1?J||(x+=`(${d})`):F.type===0&&(!J&&(!ye||ye.type===3||ye.modifier!==3||V||F.prefix!=="")?x+="*":x+=`(${f})`),F.type===1&&J&&F.suffix.length&&y.test(F.suffix[0])&&(x+="\\"),x+=JV(F.suffix),V&&(x+="}"),F.modifier!==3&&(x+=Y9(F.modifier))}return x}t(Ptr,"ke");var rat=class{static{t(this,"me")}#e;#r={};#t={};#n={};#s={};#m=!1;constructor(s={},o,f){try{let d;if(typeof o=="string"?d=o:f=o,typeof s=="string"){let F=new wtr(s);if(F.parse(),s=F.result,d===void 0&&typeof s.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");s.baseURL=d}else{if(!s||typeof s!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(d)throw new TypeError("parameter 1 is not of type 'string'.")}typeof f>"u"&&(f={ignoreCase:!1});let y={ignoreCase:f.ignoreCase===!0},x={pathname:XN,protocol:XN,username:XN,password:XN,hostname:XN,port:XN,search:XN,hash:XN};this.#e=$V(x,s,!0),Zst(this.#e.protocol)===this.#e.port&&(this.#e.port="");let P;for(P of qAe){if(!(P in this.#e))continue;let F={},J=this.#e[P];switch(this.#t[P]=[],P){case"protocol":Object.assign(F,ZN),F.encodePart=HAe;break;case"username":Object.assign(F,ZN),F.encodePart=Str;break;case"password":Object.assign(F,ZN),F.encodePart=Ttr;break;case"hostname":Object.assign(F,ltr),Yst(J)?F.encodePart=eat:F.encodePart=Qst;break;case"port":Object.assign(F,ZN),F.encodePart=tat;break;case"pathname":Xst(this.#r.protocol)?(Object.assign(F,utr,y),F.encodePart=xtr):(Object.assign(F,ZN,y),F.encodePart=Etr);break;case"search":Object.assign(F,ZN,y),F.encodePart=Ctr;break;case"hash":Object.assign(F,ZN,y),F.encodePart=ktr;break}try{this.#s[P]=Vst(J,F),this.#r[P]=Hst(this.#s[P],this.#t[P],F),this.#n[P]=Ptr(this.#s[P],F),this.#m=this.#m||this.#s[P].some(V=>V.type===2)}catch{throw new TypeError(`invalid ${P} pattern '${this.#e[P]}'.`)}}}catch(d){throw new TypeError(`Failed to construct 'URLPattern': ${d.message}`)}}test(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return!1;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return!1}let d;for(d of qAe)if(!this.#r[d].exec(f[d]))return!1;return!0}exec(s={},o){let f={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof s!="string"&&o)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof s>"u")return;try{typeof s=="object"?f=$V(f,s,!1):f=$V(f,Wst(s,o),!1)}catch{return null}let d={};o?d.inputs=[s,o]:d.inputs=[s];let y;for(y of qAe){let x=this.#r[y].exec(f[y]);if(!x)return null;let P={};for(let[F,J]of this.#t[y].entries())if(typeof J=="string"||typeof J=="number"){let V=x[F+1];P[J]=V}d[y]={input:f[y]??"",groups:P}}return d}static compareComponent(s,o,f){let d=t((F,J)=>{for(let V of["type","modifier","prefix","value","suffix"]){if(F[V]<J[V])return-1;if(F[V]!==J[V])return 1}return 0},"o"),y=new WV(3,"","","","",3),x=new WV(0,"","","","",3),P=t((F,J)=>{let V=0;for(;V<Math.min(F.length,J.length);++V){let ye=d(F[V],J[V]);if(ye)return ye}return F.length===J.length?0:d(F[V]??y,J[V]??y)},"s");return!o.#n[s]&&!f.#n[s]?0:o.#n[s]&&!f.#n[s]?P(o.#s[s],[x]):!o.#n[s]&&f.#n[s]?P([x],f.#s[s]):P(o.#s[s],f.#s[s])}get protocol(){return this.#n.protocol}get username(){return this.#n.username}get password(){return this.#n.password}get hostname(){return this.#n.hostname}get port(){return this.#n.port}get pathname(){return this.#n.pathname}get search(){return this.#n.search}get hash(){return this.#n.hash}get hasRegExpGroups(){return this.#m}};globalThis.URLPattern||(globalThis.URLPattern=rat);import{AssertionError as Atr}from"node:assert";function WP(s,o){if(s===!1)throw new Atr({message:o})}t(WP,"assert");var Wo;(function(s){s.Object="Object",s.Property="Property",s.Array="Array",s.Literal="Literal",s.TemplateString="TemplateString",s.Identifier="Identifier",s.FunctionCall="FunctionCall",s.Raw="Raw"})(Wo||(Wo={}));function K9(s){return s.type===Wo.Object}t(K9,"isAstObject");function qP(s){return s.type===Wo.Property}t(qP,"isAstProperty");function GAe(s){return s.type===Wo.Array}t(GAe,"isAstArray");function hO(s){return s.type===Wo.Literal}t(hO,"isAstLiteral");function QN(s){if(s===void 0)throw new Error("Node is undefined");if(!K9(s))throw new Error("Node is not object")}t(QN,"assertAstObject");import{findNodeAtLocation as Ntr,getNodeValue as Itr,printParseErrorCode as Otr,visit as Ftr}from"jsonc-parser";var Ltr={DEFAULT:{allowTrailingComma:!1}};function qV(s,o=[],f=Ltr.DEFAULT){let d={type:"array",offset:-1,length:-1,line:-1,column:-1,children:[],parent:void 0};function y(J){d.type==="property"&&(d.length=J-d.offset,d=d.parent)}t(y,"ensurePropertyComplete");function x(J){return d.children?.push(J),J}t(x,"onValue"),Ftr(s,{onObjectBegin:t((J,V,ye)=>{d=x({type:"object",offset:J,length:-1,line:V+1,column:ye+1,parent:d,children:[]})},"onObjectBegin"),onObjectProperty:t((J,V,ye,fe,ae)=>{d=x({type:"property",offset:V,length:-1,line:fe+1,column:ae+1,parent:d,children:[]}),d.children?.push({type:"string",value:J,offset:V,length:ye,line:fe,column:ae,parent:d})},"onObjectProperty"),onObjectEnd:t((J,V)=>{y(J+V),d.length=J+V-d.offset,d=d.parent,y(J+V)},"onObjectEnd"),onArrayBegin:t((J,V,ye,fe)=>{d=x({type:"array",offset:J,length:-1,line:ye+1,column:fe+1,parent:d,children:[]})},"onArrayBegin"),onArrayEnd:t((J,V)=>{d.length=J+V-d.offset,d=d.parent,y(J+V)},"onArrayEnd"),onLiteralValue:t((J,V,ye,fe,ae)=>{x({type:Rtr(J),offset:V,length:ye,line:fe+1,column:ae+1,parent:d,value:J}),y(V+ye)},"onLiteralValue"),onSeparator:t((J,V)=>{d.type==="property"&&(J===":"?d.colonOffset=V:J===","&&y(V))},"onSeparator"),onError:t((J,V,ye,fe,ae)=>{o.push({error:J,offset:V,length:ye,line:fe+1,column:ae+1})},"onError")},f);let F=d.children?.[0];return F&&delete F.parent,F}t(qV,"parse");function Rtr(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(s){if(Array.isArray(s))return"array"}else return"null";return"object"}default:return"null"}}t(Rtr,"getNodeType");function YAe(s,o){return Ntr(s,o)}t(YAe,"findNodeAtLocation");function VV(s){return Itr(s)}t(VV,"getNodeValue");function nat(s){return Otr(s)}t(nat,"printParseErrorCode");var HV=class{static{t(this,"AstAdapter")}parse(o){let d=qV(o,[]);if(d)return this.parseNode(d,void 0);throw new Error("Failed to parse JSON")}convert(o){return this.parseNode(o,void 0)}parseNode(o,f){switch(o.type){case"object":return this.createObject(o,f);case"array":return this.createArray(o,f);case"property":return this.createProperty(o,f);case"string":return this.createLiteral(o,f);case"number":return this.createLiteral(o,f);case"boolean":return this.createLiteral(o,f);case"null":return this.createLiteral(o,f)}}createLiteral(o,f){return{type:Wo.Literal,location:{line:o.line,column:o.column},parent:f,value:o.type==="null"?null:o.value}}createObject(o,f){let d={type:Wo.Object,children:[],parent:f,location:{line:o.line,column:o.column}};return o.children?.forEach(y=>{d.children.push(this.parseNode(y,d))}),d}createProperty(o,f){WP(o.children?.length===2,"Invalid property node");let d={type:Wo.Property,location:{line:o.line,column:o.column},parent:f,name:null,value:null};return d.name={value:o.children[0].value,location:{line:o.line,column:o.column},type:Wo.Identifier,parent:d},d.value=this.parseNode(o.children[1],d),d}createArray(o,f){let d={type:Wo.Array,location:{line:o.line,column:o.column},parent:f,children:[]};return o.children?.forEach(y=>d.children.push(this.parseNode(y,d))),d}};var PS={createLiteral:t((s,o)=>({type:Wo.Literal,parent:o,value:s}),"createLiteral"),createTemplateString:t((s,o)=>({type:Wo.TemplateString,parent:o,value:s}),"createTemplateString"),createIdentifier:t((s,o)=>({type:Wo.Identifier,value:s,parent:o}),"createIdentifier"),createProperty:t((s,o,f)=>{let d={type:Wo.Property,parent:f,name:null,value:o};return d.name={value:s,type:Wo.Identifier,parent:d},d.value.parent=d,d},"createProperty"),createArrayOfLiterals:t((s,o)=>{let f={type:Wo.Array,parent:o,children:[]};for(let d of s)f.children.push(PS.createLiteral(d,f));return f},"createArrayOfLiterals")};var Mtr=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,GV=class{static{t(this,"SourceGenerator")}generate(o){let f=[];return this.generateSource(f,o),f.join("")}generateSource(o,f){switch(f.type){case Wo.Array:return this.generateArray(o,f);case Wo.Object:return this.generateObject(o,f);case Wo.Property:return this.generateProperty(o,f);case Wo.Literal:return this.generateLiteral(o,f);case Wo.FunctionCall:return this.generateFunctionCall(o,f);case Wo.Identifier:return this.generateIdentifier(o,f);case Wo.Raw:return this.generateRaw(o,f);case Wo.TemplateString:return this.generateTemplateString(o,f)}}generateArray(o,f){o.push("["),f.children.map(d=>{this.generateSource(o,d),o.push(",")}),o.push("]")}generateObject(o,f){o.push("{"),f.children.forEach(d=>{this.generateSource(o,d),o.push(",")}),o.push("}")}generateProperty(o,f){this.generateIdentifier(o,f.name),o.push(":"),this.generateSource(o,f.value)}generateFunctionCall(o,f){o.push(f.name.value),o.push("("),f.children.forEach((d,y,x)=>{this.generateSource(o,d),y<x.length&&o.push(",")}),o.push(")")}generateRaw(o,f){o.push(f.value)}generateTemplateString(o,f){o.push("`"),o.push(f.value.replaceAll("`","\\`")),o.push("`")}generateLiteral(o,f){if(f.value===null)return o.push("null");switch(typeof f.value){case"number":case"boolean":return o.push(`${f.value}`);case"string":{let d=f.value,y=JSON.stringify(d);return o.push(`${y}`)}}}generateIdentifier(o,f){let d=Mtr.test(f.value)?f.value:`'${f.value}'`;o.push(d)}};import jtr from"node:fs/promises";import{parse as Btr}from"@swc/core";var iat=t(async s=>{let o=new Set;try{let f=await jtr.readFile(s,"utf-8");(await Btr(f,{syntax:"typescript"})).body.forEach(y=>{y.type==="ExportDefaultDeclaration"||y.type==="ExportDefaultExpression"?o.add("default"):y.type==="ExportDeclaration"&&y.declaration.type==="FunctionDeclaration"?o.add(y.declaration.identifier.value):y.type==="ExportDeclaration"&&y.declaration.type==="VariableDeclaration"&&y.declaration.declarations[0].id.type==="Identifier"&&o.add(y.declaration.declarations[0].id.value)})}catch{return null}return o},"getJSFileExports");var sat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/fragments.schema.json",$defs:{corsPolicyConfiguration:{type:"object",required:["name","allowedOrigins"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},allowCredentials:{type:"boolean"},maxAge:{type:"number"},allowedOrigins:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},allowedMethods:{oneOf:[{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},{type:"string"}]},allowedHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},exposeHeaders:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]}}},handlerDefinition:{type:"object",properties:{module:{type:"string",pattern:"^\\$import\\([^ )]*?\\)$"},export:{type:"string"},options:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["module","export"]},httpMethod:{type:"string",enum:["GET","HEAD","POST","PUT","DELETE","CONNECT","OPTIONS","TRACE","PATCH"]}}};var KAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policies.schema.json",title:"Policies Config File",type:"object",additionalProperties:!1,properties:{policies:{type:"array",items:{$ref:"policy-configuration.schema.json"}},corsPolicies:{type:"array",items:{$ref:"fragments.schema.json#/$defs/corsPolicyConfiguration"}}}};var aat={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/policy-configuration.schema.json",title:"Policy Configuration Fragment",type:"object",required:["name","policyType","handler"],additionalProperties:!1,properties:{name:{type:"string",pattern:"^[0-9a-z-]+$"},policyType:{type:"string"},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},options:{type:"object",additionalProperties:!0}}};var XAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration.schema.json",title:"Route Configuration Fragment",description:"",type:"object",required:["path","methods","handler"],additionalProperties:!1,$defs:{corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"}},properties:{operationId:{type:"string"},path:{type:"string",pattern:"^/[^\\s]*$"},methods:{type:"array",items:{$ref:"fragments.schema.json#/$defs/httpMethod"}},label:{type:"string",description:"An internal user-friendly identifier of the route."},enforceOpenApi:{type:"boolean",description:"If true, schema validation found in the OpenAPI spec will be enforced on requests/responses."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{$ref:"#/$defs/corsPolicy"},custom:{},mcp:{type:"object",additionalProperties:!1,properties:{enabled:{type:"boolean"}}},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},summary:{type:"string"},description:{type:"string"},excludeFromOpenApi:{type:"boolean"},tags:{type:"array",items:{type:"string"}}}};var ZAe={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"http://schemas.zuplo.com/route-configuration-open-api.schema.json",title:"Open API Route Configuration Fragment",description:"These are the properties that can appear under the x-zuplo-route extension in a PathObject in Open API. It's a subset of what can appear in Zuplo's routes.json.",type:"object",required:["handler"],additionalProperties:!1,properties:{label:{type:"string",description:"An internal user-friendly identifier of the route."},key:{type:"string",deprecated:!0},handler:{$ref:"fragments.schema.json#/$defs/handlerDefinition"},corsPolicy:{type:"string",pattern:"^[0-9a-z-]+$"},custom:{},mcp:{oneOf:[{type:"object",additionalProperties:!1,properties:{type:{const:"tool"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"},includeOutputSchema:{type:"boolean"},includeStructuredContent:{type:"boolean"},annotations:{type:"object",additionalProperties:!1,properties:{title:{type:"string"},readOnlyHint:{type:"boolean"},destructiveHint:{type:"boolean"},idempotentHint:{type:"boolean"},openWorldHint:{type:"boolean"}}},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"prompt"},name:{type:"string"},description:{type:"string"},enabled:{type:"boolean"}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"resource"},name:{type:"string"},description:{type:"string"},uri:{type:"string"},mimeType:{type:"string"},enabled:{type:"boolean"},_meta:{type:"object",additionalProperties:!0}},required:["type"]},{type:"object",additionalProperties:!1,properties:{type:{const:"graphql"},enabled:{type:"boolean"},introspectionTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}},executeTool:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"}}}},required:["type"]}]},policies:{type:"object",additionalProperties:!1,properties:{inbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}},outbound:{type:"array",items:{type:"string",pattern:"^[0-9a-z-]+$"}}}},tags:{type:"array",items:{type:"string"}}}};var mlt=B_(Qce(),1),hlt=B_(nle(),1);var ile=class s{static{t(this,"JsonValidator")}static#e=new s;static get instance(){return s.#e}ajv;constructor(){this.ajv=new mlt.Ajv2020({allErrors:!0,allowUnionTypes:!0}),this.ajv.addKeyword("faker"),(0,hlt.default)(this.ajv,{mode:"fast"})}addSchema(o,f){this.ajv.addSchema(o,f)}compile(o){let f=this.ajv.compile(o);return t(y=>({isValid:f(y),errors:this.toSimpleErrors(f.errors,y),warnings:[]}),"validator")}toSimpleErrors(o,f){let d=[];return o?.forEach(y=>{y.keyword==="enum"&&y.params.allowedValues&&Array.isArray(y.params.allowedValues)&&(y.message+=`; ${y.params.allowedValues.join(", ")}`),y.instancePath&&(y.instancePath=y.instancePath.replaceAll(/(\/)?(~1)(\/)?/gm,"/"));let x={details:{}},P=y.instancePath.split("/");if(P.length>2){let J=P[1],V=P[2]?parseInt(P[2],10):0,ye=P[3],fe=Number.isNaN(V)?void 0:f[J][V][ye];x={details:{property:J,index:V,field:ye,fieldValue:fe}}}if(y.keyword==="required"&&y.params.missingProperty&&y.instancePath&&(y.message=`A 'path' is missing required property '${y.params.missingProperty}'`),y.keyword==="additionalProperties"&&y.params.additionalProperty&&y.instancePath&&(y.message=`A 'path' should NOT include property '${y.params.additionalProperty}'`),y.keyword==="type"&&y.params.type&&y.instancePath){let J=y.instancePath.split("/"),V=J[J.length-1];y.message=`Value of property '${V}' must be '${y.params.type}'`}let F=Object.assign(y,x);d.push(F)}),d}};var lI=ile.instance;lI.addSchema(XAe,"route-configuration.schema.json");lI.addSchema(aat,"policy-configuration.schema.json");lI.addSchema(KAe,"policies.schema.json");lI.addSchema(ZAe,"open-api-route-configuration.schema.json");lI.addSchema(sat,"fragments.schema.json");var lNr=lI.compile(XAe),glt=lI.compile(ZAe),dIe=lI.compile(KAe);var sle=class{static{t(this,"PoliciesConfigurationValidator")}results;validate(o){return this.results=dIe(o),this.results}};var ale=class{static{t(this,"OpenAPILocalizedValidator")}results;validate(o){return this.results=glt(o),this.results}};import ulr from"node:path";var mIe=/\$import\((.*)\)/,CH=/\$env\((.*?)\)/g;var zk=class extends Error{static{t(this,"CodeGenError")}location;constructor(o,f,d,y){super(o),this.location={file:f,namespace:"",line:d?d.line:0,column:d?d.column:0,length:0,lineText:y??"",suggestion:""}}},llr=t(s=>{let o=[],f=s;for(;f.parent;)o.push(f),f=f.parent;return o.reverse()},"invertTree"),YP=t((s,o)=>{if(!s)return!1;let f=llr(s);return o.split("/").every((x,P)=>{let F=f[P];return F?x==="*"||qP(F)&&F.name.value===x?!0:x==="{}"?F.type===Wo.Object:x==="[]"?F.type===Wo.Array:!1:!1})},"testPosition");var ole=class{static{t(this,"AstTransformer")}errors=[];transform(o){return this.visitor(o),o}visitor(o){this.visit(o),K9(o)?o.children.forEach(f=>{this.visitor(f)}):GAe(o)?o.children.forEach(f=>{this.visitor(f)}):qP(o)&&this.visitor(o.value)}},ylt=t(s=>{let o=new RegExp(CH).exec(s);if(o?.length===2&&o[0]===s)return{type:"raw",value:`environment["${o[1]}"]`};{let f=s.replaceAll(new RegExp(CH),(d,y)=>`\${environment["${y}"] ? environment["${y}"] : ""}`);if(f!==s)return{type:"template",value:f}}return null},"replaceEnvInString"),vlt=t((s,o,f)=>d=>{if(hO(d)&&typeof d.value=="string"&&d.parent&&GAe(d.parent)){if(!s.some(P=>YP(d.parent,P))){CH.test(d.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value));return}let x=ylt(d.value);if(x){let P=d.parent,F=P.children.indexOf(d);if(F!==-1)if(x.type==="raw"){let J={type:Wo.Raw,parent:P,value:x.value};P.children[F]=J}else P.children[F]=PS.createTemplateString(x.value,d)}return}if(!qP(d)||!hO(d.value)||typeof d.value.value!="string")return;if(!s.some(x=>YP(d,x))){CH.test(d.value.value)&&o.push(new zk("An $env() statement is not expected at this location.",f,d.location,d.value.value));return}let y=ylt(d.value.value);if(y)if(y.type==="raw"){let x={type:Wo.Raw,parent:null,value:y.value};d.value=x}else d.value=PS.createTemplateString(y.value,d)},"getEnvStatementTransformer");var kH="config/routes.json",flr=["handler/{}/options/*","handler/{}/options/*/[]","policies/[]/{}/handler/{}/options/*","policies/[]/{}/handler/{}/options/*/[]","corsPolicies/[]/{}/*","corsPolicies/[]/{}/*/[]"],_lr=["handler/{}/module","handler/{}/options/{}/policies/{}/inbound/[]/{}/module","handler/{}/options/{}/policies/{}/outbound/[]/{}/module","handler/{}/options/{}/onOpen/{}/module","policies/[]/{}/handler/{}/module","policies/[]/{}/handler/{}/options/{}/identifier/{}/module","policies/[]/{}/handler/{}/options/{}/validator"],blt=["handler/{}/options/*","policies/[]/{}/handler/{}/options/*"],plr="handler/{}/options/{}/rewritePattern",dlr="handler/{}/options/{}/baseUrl",cle=class extends ole{static{t(this,"OpenAPIRoutesFragmentAstTransformer")}importCount=0;addedImports=new Map;getImportName(o){this.addedImports.has(o)||this.addedImports.set(o,`__import${this.importCount++}`);let f=this.addedImports.get(o);if(!f)throw new Error("Import name is undefined. This should not happen.");return f}getImports(){let o=[];return this.addedImports.forEach((f,d)=>{o.push({name:f,path:d})}),o}visit(o){this.rewriteHandlerFunction(o),this.rewriteForwardFunction(o),this.replaceImportStatements(o),this.replaceEnvStatements(o)}rewriteHandlerFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,plr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}rewriteForwardFunction(o){if(!(!qP(o)||!hO(o.value)||typeof o.value.value!="string")&&YP(o,dlr)){if(!o.parent||!K9(o.parent)){this.errors.push(new zk("Invalid node, expected object",kH,o.parent?o.parent.location:o.location,void 0));return}let f=o.value.value,d={type:Wo.Raw,parent:null,value:Slt(f)},y=PS.createProperty("__rewriteFunction",d,o);o.parent.children.push(y)}}replaceImportStatements(o){if(!qP(o)||!hO(o.value))return;let f=o.value.value;if(typeof f!="string")return;if(!_lr.some(F=>YP(o,F))&&!blt.some(F=>YP(o,F))){if(mIe.test(f)){if(o.name.value==="$ref")return;this.errors.push(new zk("An $import() statement is not expected at this location.",kH,o.location,f))}return}let d=mIe.exec(f);if(blt.some(F=>YP(o,F))&&!d)return;if(!d){this.errors.push(new zk("Invalid $import() statement",kH,o.location,f));return}let y=d[1];y=y.replace(/\\/g,"/"),y.startsWith(".")&&(y=ulr.posix.join("..",y));let x=this.getImportName(y),P={type:Wo.Identifier,parent:o.parent,value:x};o.value=P}replaceEnvStatements=vlt(flr,this.errors,kH)};function Slt(s){return`(request, context) => {
|
|
576
576
|
const { params, url, query, method, headers } = request;
|
|
577
577
|
const { host, hostname, origin, pathname, port, search } = new URL(url);
|
|
578
578
|
const e = encodeURIComponent;
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
25
|
import{a as s}from"./chunk-A3QGJZO7.js";import{a}from"./chunk-UKQQD2JN.js";import{Z as i}from"./chunk-4POCC75H.js";import{a as r}from"./chunk-TYV53J3B.js";var u=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function c(e){return e.startsWith("__ZUPLO")||e.startsWith("ZUPLO_")?!u.includes(e)&&!e.startsWith("ZUPLO_PUBLIC_"):e.startsWith("ZUDOKU_")?!e.startsWith("ZUDOKU_PUBLIC_"):!1}r(c,"isRestrictedEnvVariableName");function L(e){return!!e.startsWith("ZUPLO_")}r(L,"isZuploReadableEnvVariableName");var f=new Proxy({},{get(e,t){let n=String(t);switch(n){case"ZUPLO_ENVIRONMENT_TYPE":return i.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return i.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return i.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return i.instance.accountName;case"ZUPLO_PROJECT_NAME":return i.instance.projectName;case"ZUPLO_BUILD_ID":return i.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return i.instance.build.COMPATIBILITY_DATE}if(!(c(n)&&!L(n)))return i.instance.runtime[n]}});var _=new a(Symbol("ai-gateway-app-configuration")),p={set(e,t){let n=t!==null&&typeof t=="object"&&!Object.isFrozen(t)?s(t):t;_.set(e,{configuration:n})},has(e){return _.get(e)!==void 0},get(e){return _.get(e)?.configuration},getId(e){let t=p.get(e);if(t===null||typeof t!="object")return;let n=Reflect.get(t,"id");return typeof n=="string"&&n!==""?n:void 0}};function A(e,t,n){return`_${o(`${e}_${t}_${n}`)}`}r(A,"getRawOperationDataIdentifierName");function P(e,t,n,g){return`_${o(e.toLowerCase())}_${t.toLowerCase()}_${n.toLowerCase()}_${g.toLowerCase()}`}r(P,"getIdForParameterSchema");function R(e,t,n){return`_${o(e.toLowerCase())}_${t.toLowerCase()}_rb_${o(n.toLowerCase())}`}r(R,"getIdForRequestBodySchema");function Z(e,t){return`_${o(e)}_${o(t)}`}r(Z,"getIdForRefSchema");function o(e){let t=e.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(t)||(t=`_${t}`),t}r(o,"sanitizedIdentifierName");export{c as a,L as b,f as c,p as d,A as e,P as f,R as g,Z as h,o as i};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-B3D32RUX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@zuplo/runtime/environment.ts","@zuplo/runtime/ai-gateway/app-configuration-context.ts","@zuplo/runtime/utils/open-api-utils.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;2JAEA,IAAMA,EAAmC,CACvC,qCACA,iCACA,kBACA,+BACF,EASO,SAASC,EAA4BC,EAAc,CAExD,OAAIA,EAAK,WAAW,SAAS,GAAKA,EAAK,WAAW,QAAQ,EAItD,CAACF,EAAiC,SAASE,CAAI,GAC/C,CAACA,EAAK,WAAW,eAAe,EAIhCA,EAAK,WAAW,SAAS,EACpB,CAACA,EAAK,WAAW,gBAAgB,EAEnC,EACT,CAfgBC,EAAAF,EAAA,+BAoBT,SAASG,EAA+BF,EAAc,CAC3D,MAAI,EAAAA,EAAK,WAAW,QAAQ,CAI9B,CALgBC,EAAAC,EAAA,kCAWhB,IAAMC,EAAc,IAAI,MACtB,CAAC,EACD,CACE,IAAIC,EAAQC,EAAM,CAChB,IAAMC,EAAU,OAAOD,CAAI,EAG3B,OAAQC,EAAS,CACf,IAAK,yBACH,OAAOC,EAAY,SAAS,uBAC9B,IAAK,0BACH,OAAOA,EAAY,SAAS,wBAC9B,IAAK,yBACH,OAAOA,EAAY,SAAS,QAAQ,wBACtC,IAAK,qBACH,OAAOA,EAAY,SAAS,YAC9B,IAAK,qBACH,OAAOA,EAAY,SAAS,YAC9B,IAAK,iBACH,OAAOA,EAAY,SAAS,MAAM,SACpC,IAAK,2BACH,OAAOA,EAAY,SAAS,MAAM,kBACtC,CAEA,GACE,EAAAR,EAA4BO,CAAO,GACnC,CAACJ,EAA+BI,CAAO,GAKzC,OAAOC,EAAY,SAAS,QAAQD,CAAO,CAC7C,CACF,CACF,ECpEA,IAAME,EAAmB,IAAIC,EAC3B,OAAO,8BAA8B,CACvC,
|
|
1
|
+
{"version":3,"sources":["@zuplo/runtime/environment.ts","@zuplo/runtime/ai-gateway/app-configuration-context.ts","@zuplo/runtime/utils/open-api-utils.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;2JAEA,IAAMA,EAAmC,CACvC,qCACA,iCACA,kBACA,+BACF,EASO,SAASC,EAA4BC,EAAc,CAExD,OAAIA,EAAK,WAAW,SAAS,GAAKA,EAAK,WAAW,QAAQ,EAItD,CAACF,EAAiC,SAASE,CAAI,GAC/C,CAACA,EAAK,WAAW,eAAe,EAIhCA,EAAK,WAAW,SAAS,EACpB,CAACA,EAAK,WAAW,gBAAgB,EAEnC,EACT,CAfgBC,EAAAF,EAAA,+BAoBT,SAASG,EAA+BF,EAAc,CAC3D,MAAI,EAAAA,EAAK,WAAW,QAAQ,CAI9B,CALgBC,EAAAC,EAAA,kCAWhB,IAAMC,EAAc,IAAI,MACtB,CAAC,EACD,CACE,IAAIC,EAAQC,EAAM,CAChB,IAAMC,EAAU,OAAOD,CAAI,EAG3B,OAAQC,EAAS,CACf,IAAK,yBACH,OAAOC,EAAY,SAAS,uBAC9B,IAAK,0BACH,OAAOA,EAAY,SAAS,wBAC9B,IAAK,yBACH,OAAOA,EAAY,SAAS,QAAQ,wBACtC,IAAK,qBACH,OAAOA,EAAY,SAAS,YAC9B,IAAK,qBACH,OAAOA,EAAY,SAAS,YAC9B,IAAK,iBACH,OAAOA,EAAY,SAAS,MAAM,SACpC,IAAK,2BACH,OAAOA,EAAY,SAAS,MAAM,kBACtC,CAEA,GACE,EAAAR,EAA4BO,CAAO,GACnC,CAACJ,EAA+BI,CAAO,GAKzC,OAAOC,EAAY,SAAS,QAAQD,CAAO,CAC7C,CACF,CACF,ECpEA,IAAME,EAAmB,IAAIC,EAC3B,OAAO,8BAA8B,CACvC,EAYaC,EAAyB,CAOpC,IAAIC,EAAuBC,EAA8B,CAMvD,IAAMC,EACJD,IAAkB,MAClB,OAAOA,GAAkB,UACzB,CAAC,OAAO,SAASA,CAAa,EAC1BE,EAAWF,CAAa,EACxBA,EACNJ,EAAiB,IAAIG,EAAS,CAAE,cAAeE,CAAoB,CAAC,CACtE,EAOA,IAAIF,EAAgC,CAClC,OAAOH,EAAiB,IAAIG,CAAO,IAAM,MAC3C,EAOA,IAAIA,EAAgC,CAClC,OAAOH,EAAiB,IAAIG,CAAO,GAAG,aACxC,EAOA,MAAMA,EAA2C,CAC/C,IAAMC,EAAgBF,EAAuB,IAAIC,CAAO,EACxD,GAAIC,IAAkB,MAAQ,OAAOA,GAAkB,SACrD,OAGF,IAAMG,EAAK,QAAQ,IAAIH,EAAe,IAAI,EAC1C,OAAO,OAAOG,GAAO,UAAYA,IAAO,GAAKA,EAAK,MACpD,CACF,ECzEO,SAASC,EACdC,EACAC,EACAC,EACQ,CACR,MAAO,IAAIC,EAAwB,GAAGH,CAAW,IAAIC,CAAI,IAAIC,CAAS,EAAE,CAAC,EAC3E,CANgBE,EAAAL,EAAA,qCAiBT,SAASM,EACdJ,EACAC,EACAI,EACAC,EACQ,CACR,MAAO,IAAIJ,EAAwBF,EAAK,YAAY,CAAC,CAAC,IAAIC,EAAU,YAAY,CAAC,IAAII,EAAK,YAAY,CAAC,IAAIC,EAAK,YAAY,CAAC,EAC/H,CAPgBH,EAAAC,EAAA,2BAiBT,SAASG,EACdP,EACAC,EACAO,EACQ,CACR,MAAO,IAAIN,EAAwBF,EAAK,YAAY,CAAC,CAAC,IAAIC,EAAU,YAAY,CAAC,OAAOC,EAAwBM,EAAY,YAAY,CAAC,CAAC,EAC5I,CANgBL,EAAAI,EAAA,6BAeT,SAASE,EAAkBV,EAAqBW,EAAqB,CAC1E,MAAO,IAAIR,EAAwBH,CAAW,CAAC,IAAIG,EAAwBQ,CAAG,CAAC,EACjF,CAFgBP,EAAAM,EAAA,qBAUT,SAASP,EAAwBI,EAAsB,CAE5D,IAAIK,EAAcL,EAEf,QAAQ,MAAO,YAAY,EAC3B,QAAQ,MAAO,YAAY,EAC3B,QAAQ,MAAO,UAAU,EACzB,QAAQ,MAAO,UAAU,EACzB,QAAQ,MAAO,SAAS,EACxB,QAAQ,KAAM,QAAQ,EAEtB,QAAQ,MAAO,OAAO,EACtB,QAAQ,MAAO,QAAQ,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,MAAM,EACpB,QAAQ,MAAO,UAAU,EAEzB,QAAQ,iBAAkB,GAAG,EAGhC,MAAK,aAAa,KAAKK,CAAW,IAChCA,EAAc,IAAIA,CAAW,IAGxBA,CACT,CAzBgBR,EAAAD,EAAA","names":["ALLOWED_WRITABLE_ZUPLO_VARIABLES","isRestrictedEnvVariableName","name","__name","isZuploReadableEnvVariableName","environment","target","prop","envName","Environment","appConfiguration","ContextData","AIGatewayConfiguration","context","configuration","storedConfiguration","deepFreeze","id","getRawOperationDataIdentifierName","oasFileName","path","operation","sanitizedIdentifierName","__name","getIdForParameterSchema","type","name","getIdForRequestBodySchema","contentType","getIdForRefSchema","ref","encodedName"]}
|