@meirblachman/azure-pipelines-visualizer 0.2.1 → 0.2.2

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/dist/index.min.js CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import{existsSync as Pt,readFileSync as Ot}from"node:fs";import{extname as Ia,join as Nr}from"node:path";import{fileURLToPath as _a}from"node:url";import{parseArgs as Fa}from"node:util";import{createServer as Ft}from"http";import{Http2ServerRequest as Hr,constants as jt}from"http2";import{Http2ServerRequest as Qe}from"http2";import{Readable as $r}from"stream";import Wt from"crypto";var N=class extends Error{constructor(e,r){super(e,r),this.name="RequestError"}},Nt=e=>e instanceof N?e:new N(e.message,{cause:e}),Lt=global.Request,fe=class extends Lt{constructor(e,r){typeof e=="object"&&K in e&&(e=e[K]()),typeof r?.body?.getReader<"u"&&(r.duplex??="half"),super(e,r)}},Dt=e=>{let r=[],n=e.rawHeaders;for(let t=0;t<n.length;t+=2){let{[t]:i,[t+1]:s}=n;i.charCodeAt(0)!==58&&r.push([i,s])}return new Headers(r)},zr=Symbol("wrapBodyStream"),$t=(e,r,n,t,i)=>{let s={method:e,headers:n,signal:i.signal};if(e==="TRACE"){s.method="GET";let o=new fe(r,s);return Object.defineProperty(o,"method",{get(){return"TRACE"}}),o}if(!(e==="GET"||e==="HEAD"))if("rawBody"in t&&t.rawBody instanceof Buffer)s.body=new ReadableStream({start(o){o.enqueue(t.rawBody),o.close()}});else if(t[zr]){let o;s.body=new ReadableStream({async pull(a){try{o||=$r.toWeb(t).getReader();let{done:l,value:c}=await o.read();l?a.close():a.enqueue(c)}catch(l){a.error(l)}}})}else s.body=$r.toWeb(t);return new fe(r,s)},K=Symbol("getRequestCache"),Br=Symbol("requestCache"),Se=Symbol("incomingKey"),Te=Symbol("urlKey"),Mt=Symbol("headersKey"),G=Symbol("abortControllerKey"),Ht=Symbol("getAbortController"),pe={get method(){return this[Se].method||"GET"},get url(){return this[Te]},get headers(){return this[Mt]||=Dt(this[Se])},[Ht](){return this[K](),this[G]},[K](){return this[G]||=new AbortController,this[Br]||=$t(this.method,this[Te],this.headers,this[Se],this[G])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(e=>{Object.defineProperty(pe,e,{get(){return this[K]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(pe,e,{value:function(){return this[K]()[e]()}})});Object.defineProperty(pe,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,r,n){let t={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Br]};return`Request (lightweight) ${n(t,{...r,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(pe,fe.prototype);var zt=(e,r)=>{let n=Object.create(pe);n[Se]=e;let t=e.url||"";if(t[0]!=="/"&&(t.startsWith("http://")||t.startsWith("https://"))){if(e instanceof Qe)throw new N("Absolute URL for :path is not allowed in HTTP/2");try{let a=new URL(t);n[Te]=a.href}catch(a){throw new N("Invalid absolute URL",{cause:a})}return n}let i=(e instanceof Qe?e.authority:e.headers.host)||r;if(!i)throw new N("Missing host header");let s;if(e instanceof Qe){if(s=e.scheme,!(s==="http"||s==="https"))throw new N("Unsupported scheme")}else s=e.socket&&e.socket.encrypted?"https":"http";let o=new URL(`${s}://${i}${t}`);if(o.hostname.length!==i.length&&o.hostname!==i.replace(/:\d+$/,""))throw new N("Invalid host header");return n[Te]=o.href,n},er=Symbol("responseCache"),W=Symbol("getResponseCache"),L=Symbol("cache"),tr=global.Response,Y=class Ur{#r;#e;[W](){return delete this[L],this[er]||=new tr(this.#r,this.#e)}constructor(r,n){let t;if(this.#r=r,n instanceof Ur){let i=n[er];if(i){this.#e=i,this[W]();return}else this.#e=n.#e,t=new Headers(n.#e.headers)}else this.#e=n;(typeof r=="string"||typeof r?.getReader<"u"||r instanceof Blob||r instanceof Uint8Array)&&(this[L]=[n?.status||200,r,t||n?.headers])}get headers(){let r=this[L];return r?(r[2]instanceof Headers||(r[2]=new Headers(r[2]||{"content-type":"text/plain; charset=UTF-8"})),r[2]):this[W]().headers}get status(){return this[L]?.[0]??this[W]().status}get ok(){let r=this.status;return r>=200&&r<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(Y.prototype,e,{get(){return this[W]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(Y.prototype,e,{value:function(){return this[W]()[e]()}})});Object.defineProperty(Y.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,r,n){let t={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[er]};return`Response (lightweight) ${n(t,{...r,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(Y,tr);Object.setPrototypeOf(Y.prototype,tr.prototype);async function Bt(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function qr(e,r,n){let t=a=>{e.cancel(a).catch(()=>{})};return r.on("close",t),r.on("error",t),(n??e.read()).then(o,i),e.closed.finally(()=>{r.off("close",t),r.off("error",t)});function i(a){a&&r.destroy(a)}function s(){e.read().then(o,i)}function o({done:a,value:l}){try{if(a)r.end();else if(!r.write(l))r.once("drain",s);else return e.read().then(o,i)}catch(c){i(c)}}}function Ut(e,r){if(e.locked)throw new TypeError("ReadableStream is locked.");return r.destroyed?void 0:qr(e.getReader(),r)}var rr=e=>{let r={};e instanceof Headers||(e=new Headers(e??void 0));let n=[];for(let[t,i]of e)t==="set-cookie"?n.push(i):r[t]=i;return n.length>0&&(r["set-cookie"]=n),r["content-type"]??="text/plain; charset=UTF-8",r},qt="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=Wt);var ir=Symbol("outgoingEnded"),Mr=Symbol("incomingDraining"),Gt=500,Kt=64*1024*1024,Xe=e=>{let r=e;if(e.destroyed||r[Mr])return;if(r[Mr]=!0,e instanceof Hr){try{e.stream?.close?.(jt.NGHTTP2_NO_ERROR)}catch{}return}let n=0,t=()=>{clearTimeout(s),e.off("data",o),e.off("end",t),e.off("error",t)},i=()=>{t();let a=e.socket;a&&!a.destroyed&&a.destroySoon()},s=setTimeout(i,Gt);s.unref?.();let o=a=>{n+=a.length,n>Kt&&i()};e.on("data",o),e.on("end",t),e.on("error",t),e.resume()},Yt=()=>new Response(null,{status:400}),Wr=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),nr=(e,r)=>{let n=e instanceof Error?e:new Error("unknown error",{cause:e});n.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),r.headersSent||r.writeHead(500,{"Content-Type":"text/plain"}),r.end(`Error: ${n.message}`),r.destroy(n))},Gr=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},Kr=async(e,r)=>{let[n,t,i]=e[L],s=!1;if(!i)i={"content-type":"text/plain; charset=UTF-8"};else if(i instanceof Headers)s=i.has("content-length"),i=rr(i);else if(Array.isArray(i)){let o=new Headers(i);s=o.has("content-length"),i=rr(o)}else for(let o in i)if(o.length===14&&o.toLowerCase()==="content-length"){s=!0;break}s||(typeof t=="string"?i["Content-Length"]=Buffer.byteLength(t):t instanceof Uint8Array?i["Content-Length"]=t.byteLength:t instanceof Blob&&(i["Content-Length"]=t.size)),r.writeHead(n,i),typeof t=="string"||t instanceof Uint8Array?r.end(t):t instanceof Blob?r.end(new Uint8Array(await t.arrayBuffer())):(Gr(r),await Ut(t,r)?.catch(o=>nr(o,r))),r[ir]?.()},Vt=e=>typeof e.then=="function",Zt=async(e,r,n={})=>{if(Vt(e))if(n.errorHandler)try{e=await e}catch(i){let s=await n.errorHandler(i);if(!s)return;e=s}else e=await e.catch(Wr);if(L in e)return Kr(e,r);let t=rr(e.headers);if(e.body){let i=e.body.getReader(),s=[],o=!1,a;if(t["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){a||=i.read();let f=await Bt(a).catch(u=>{console.error(u),o=!0});if(!f){if(c===1){await new Promise(u=>setTimeout(u)),l=3;continue}break}if(a=void 0,f.value&&s.push(f.value),f.done){o=!0;break}}o&&!("content-length"in t)&&(t["content-length"]=s.reduce((c,f)=>c+f.length,0))}r.writeHead(e.status,t),s.forEach(l=>{r.write(l)}),o?r.end():(s.length===0&&Gr(r),await qr(i,r,a))}else t[qt]||(r.writeHead(e.status,t),r.end());r[ir]?.()},Jt=(e,r={})=>{let n=r.autoCleanupIncoming??!0;return r.overrideGlobalObjects!==!1&&global.Request!==fe&&(Object.defineProperty(global,"Request",{value:fe}),Object.defineProperty(global,"Response",{value:Y})),async(t,i)=>{let s,o;try{o=zt(t,r.hostname);let a=!n||t.method==="GET"||t.method==="HEAD";if(a||(t[zr]=!0,t.on("end",()=>{a=!0}),t instanceof Hr&&(i[ir]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{Xe(t)})})}),i.on("finish",()=>{a||Xe(t)})),i.on("close",()=>{o[G]&&(t.errored?o[G].abort(t.errored.toString()):i.writableFinished||o[G].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{Xe(t)})})}),s=e(o,{incoming:t,outgoing:i}),L in s)return Kr(s,i)}catch(a){if(s)return nr(a,i);if(r.errorHandler){if(s=await r.errorHandler(o?a:Nt(a)),!s)return}else o?s=Wr(a):s=Yt()}try{return await Zt(s,i,r)}catch(a){return nr(a,i)}}},Qt=e=>{let r=e.fetch,n=Jt(r,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming});return(e.createServer||Ft)(e.serverOptions||{},n)},Yr=(e,r)=>{let n=Qt(e);return n.listen(e?.port??3e3,e.hostname,()=>{let t=n.address();r&&r(t)}),n};var or=(e,r,n)=>(t,i)=>{let s=-1;return o(0);async function o(a){if(a<=s)throw new Error("next() called multiple times");s=a;let l,c=!1,f;if(e[a]?(f=e[a][0][0],t.req.routeIndex=a):f=a===e.length&&i||void 0,f)try{l=await f(t,()=>o(a+1))}catch(u){if(u instanceof Error&&r)t.error=u,l=await r(u,t),c=!0;else throw u}else t.finalized===!1&&n&&(l=await n(t));return l&&(t.finalized===!1||c)&&(t.res=l),t}};var Vr=Symbol();var Zr=async(e,r=Object.create(null))=>{let{all:n=!1,dot:t=!1}=r,s=(e instanceof Pe?e.raw.headers:e.headers).get("Content-Type");return s?.startsWith("multipart/form-data")||s?.startsWith("application/x-www-form-urlencoded")?Xt(e,{all:n,dot:t}):{}};async function Xt(e,r){let n=await e.formData();return n?ei(n,r):{}}function ei(e,r){let n=Object.create(null);return e.forEach((t,i)=>{r.all||i.endsWith("[]")?ri(n,i,t):n[i]=t}),r.dot&&Object.entries(n).forEach(([t,i])=>{t.includes(".")&&(ni(n,t,i),delete n[t])}),n}var ri=(e,r,n)=>{e[r]!==void 0?Array.isArray(e[r])?e[r].push(n):e[r]=[e[r],n]:r.endsWith("[]")?e[r]=[n]:e[r]=n},ni=(e,r,n)=>{if(/(?:^|\.)__proto__\./.test(r))return;let t=e,i=r.split(".");i.forEach((s,o)=>{o===i.length-1?t[s]=n:((!t[s]||typeof t[s]!="object"||Array.isArray(t[s])||t[s]instanceof File)&&(t[s]=Object.create(null)),t=t[s])})};var ar=e=>{let r=e.split("/");return r[0]===""&&r.shift(),r},Jr=e=>{let{groups:r,path:n}=ti(e),t=ar(n);return ii(t,r)},ti=e=>{let r=[];return e=e.replace(/\{[^}]+\}/g,(n,t)=>{let i=`@${t}`;return r.push([i,n]),i}),{groups:r,path:e}},ii=(e,r)=>{for(let n=r.length-1;n>=0;n--){let[t]=r[n];for(let i=e.length-1;i>=0;i--)if(e[i].includes(t)){e[i]=e[i].replace(t,r[n][1]);break}}return e},Oe={},Qr=(e,r)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let t=`${e}#${r}`;return Oe[t]||(n[2]?Oe[t]=r&&r[0]!==":"&&r[0]!=="*"?[t,n[1],new RegExp(`^${n[2]}(?=/${r})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:Oe[t]=[e,n[1],!0]),Oe[t]}return null},Ie=(e,r)=>{try{return r(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return r(n)}catch{return n}})}},oi=e=>Ie(e,decodeURI),lr=e=>{let r=e.url,n=r.indexOf("/",r.indexOf(":")+4),t=n;for(;t<r.length;t++){let i=r.charCodeAt(t);if(i===37){let s=r.indexOf("?",t),o=r.indexOf("#",t),a=s===-1?o===-1?void 0:o:o===-1?s:Math.min(s,o),l=r.slice(n,a);return oi(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(i===63||i===35)break}return r.slice(n,t)};var Xr=e=>{let r=lr(e);return r.length>1&&r.at(-1)==="/"?r.slice(0,-1):r},D=(e,r,...n)=>(n.length&&(r=D(r,...n)),`${e?.[0]==="/"?"":"/"}${e}${r==="/"?"":`${e?.at(-1)==="/"?"":"/"}${r?.[0]==="/"?r.slice(1):r}`}`),_e=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let r=e.split("/"),n=[],t="";return r.forEach(i=>{if(i!==""&&!/\:/.test(i))t+="/"+i;else if(/\:/.test(i))if(/\?/.test(i)){n.length===0&&t===""?n.push("/"):n.push(t);let s=i.replace("?","");t+="/"+s,n.push(t)}else t+="/"+i}),n.filter((i,s,o)=>o.indexOf(i)===s)},sr=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?Ie(e,cr):e):e,en=(e,r,n)=>{let t;if(!n&&r&&!/[%+]/.test(r)){let o=e.indexOf("?",8);if(o===-1)return;for(e.startsWith(r,o+1)||(o=e.indexOf(`&${r}`,o+1));o!==-1;){let a=e.charCodeAt(o+r.length+1);if(a===61){let l=o+r.length+2,c=e.indexOf("&",l);return sr(e.slice(l,c===-1?void 0:c))}else if(a==38||isNaN(a))return"";o=e.indexOf(`&${r}`,o+1)}if(t=/[%+]/.test(e),!t)return}let i={};t??=/[%+]/.test(e);let s=e.indexOf("?",8);for(;s!==-1;){let o=e.indexOf("&",s+1),a=e.indexOf("=",s);a>o&&o!==-1&&(a=-1);let l=e.slice(s+1,a===-1?o===-1?void 0:o:a);if(t&&(l=sr(l)),s=o,l==="")continue;let c;a===-1?c="":(c=e.slice(a+1,o===-1?void 0:o),t&&(c=sr(c))),n?(i[l]&&Array.isArray(i[l])||(i[l]=[]),i[l].push(c)):i[l]??=c}return r?i[r]:i},rn=en,nn=(e,r)=>en(e,r,!0),cr=decodeURIComponent;var tn=e=>Ie(e,cr),Pe=class{raw;#r;#e;routeIndex=0;path;bodyCache={};constructor(e,r="/",n=[[]]){this.raw=e,this.path=r,this.#e=n,this.#r={}}param(e){return e?this.#n(e):this.#o()}#n(e){let r=this.#e[0][this.routeIndex][1][e],n=this.#i(r);return n&&/\%/.test(n)?tn(n):n}#o(){let e={},r=Object.keys(this.#e[0][this.routeIndex][1]);for(let n of r){let t=this.#i(this.#e[0][this.routeIndex][1][n]);t!==void 0&&(e[n]=/\%/.test(t)?tn(t):t)}return e}#i(e){return this.#e[1]?this.#e[1][e]:e}query(e){return rn(this.url,e)}queries(e){return nn(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let r={};return this.raw.headers.forEach((n,t)=>{r[t]=n}),r}async parseBody(e){return this.bodyCache.parsedBody??=await Zr(this,e)}#t=e=>{let{bodyCache:r,raw:n}=this,t=r[e];if(t)return t;let i=Object.keys(r)[0];return i?r[i].then(s=>(i==="json"&&(s=JSON.stringify(s)),new Response(s)[e]())):r[e]=n[e]()};json(){return this.#t("text").then(e=>JSON.parse(e))}text(){return this.#t("text")}arrayBuffer(){return this.#t("arrayBuffer")}blob(){return this.#t("blob")}formData(){return this.#t("formData")}addValidatedData(e,r){this.#r[e]=r}valid(e){return this.#r[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[Vr](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,e]])=>e)}get routePath(){return this.#e[0].map(([[,e]])=>e)[this.routeIndex].path}};var on={Stringify:1,BeforeStream:2,Stream:3},si=(e,r)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=r,n};var ur=async(e,r,n,t,i)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let s=e.callbacks;if(!s?.length)return Promise.resolve(e);i?i[0]+=e:i=[e];let o=Promise.all(s.map(a=>a({phase:r,buffer:i,context:t}))).then(a=>Promise.all(a.filter(Boolean).map(l=>ur(l,r,!1,t,i))).then(()=>i[0]));return n?si(await o,s):o};var ai="text/plain; charset=UTF-8",fr=(e,r)=>({"Content-Type":e,...r}),de=(e,r)=>new Response(e,r),sn=class{#r;#e;env={};#n;finalized=!1;error;#o;#i;#t;#u;#l;#c;#a;#f;#p;constructor(e,r){this.#r=e,r&&(this.#i=r.executionCtx,this.env=r.env,this.#c=r.notFoundHandler,this.#p=r.path,this.#f=r.matchResult)}get req(){return this.#e??=new Pe(this.#r,this.#p,this.#f),this.#e}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;throw Error("This context has no ExecutionContext")}get res(){return this.#t||=de(null,{headers:this.#a??=new Headers})}set res(e){if(this.#t&&e){e=de(e.body,e);for(let[r,n]of this.#t.headers.entries())if(r!=="content-type")if(r==="set-cookie"){let t=this.#t.headers.getSetCookie();e.headers.delete("set-cookie");for(let i of t)e.headers.append("set-cookie",i)}else e.headers.set(r,n)}this.#t=e,this.finalized=!0}render=(...e)=>(this.#l??=r=>this.html(r),this.#l(...e));setLayout=e=>this.#u=e;getLayout=()=>this.#u;setRenderer=e=>{this.#l=e};header=(e,r,n)=>{this.finalized&&(this.#t=de(this.#t.body,this.#t));let t=this.#t?this.#t.headers:this.#a??=new Headers;r===void 0?t.delete(e):n?.append?t.append(e,r):t.set(e,r)};status=e=>{this.#o=e};set=(e,r)=>{this.#n??=new Map,this.#n.set(e,r)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#s(e,r,n){let t=this.#t?new Headers(this.#t.headers):this.#a??new Headers;if(typeof r=="object"&&"headers"in r){let s=r.headers instanceof Headers?r.headers:new Headers(r.headers);for(let[o,a]of s)o.toLowerCase()==="set-cookie"?t.append(o,a):t.set(o,a)}if(n)for(let[s,o]of Object.entries(n))if(typeof o=="string")t.set(s,o);else{t.delete(s);for(let a of o)t.append(s,a)}let i=typeof r=="number"?r:r?.status??this.#o;return de(e,{status:i,headers:t})}newResponse=(...e)=>this.#s(...e);body=(e,r,n)=>this.#s(e,r,n);text=(e,r,n)=>!this.#a&&!this.#o&&!r&&!n&&!this.finalized?new Response(e):this.#s(e,r,fr(ai,n));json=(e,r,n)=>this.#s(JSON.stringify(e),r,fr("application/json",n));html=(e,r,n)=>{let t=i=>this.#s(i,r,fr("text/html; charset=UTF-8",n));return typeof e=="object"?ur(e,on.Stringify,!1,{}).then(t):t(e)};redirect=(e,r)=>{let n=String(e);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,r??302)};notFound=()=>(this.#c??=()=>de(),this.#c(this))};var A="ALL",an="all",ln=["get","post","put","delete","options","patch"],Fe="Can not add a route since the matcher is already built.",je=class extends Error{};var cn="__COMPOSED_HANDLER";var li=e=>e.text("404 Not Found",404),un=(e,r)=>{if("getResponse"in e){let n=e.getResponse();return r.newResponse(n.body,n)}return console.error(e),r.text("Internal Server Error",500)},fn=class pn{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#r="/";routes=[];constructor(r={}){[...ln,an].forEach(s=>{this[s]=(o,...a)=>(typeof o=="string"?this.#r=o:this.#o(s,this.#r,o),a.forEach(l=>{this.#o(s,this.#r,l)}),this)}),this.on=(s,o,...a)=>{for(let l of[o].flat()){this.#r=l;for(let c of[s].flat())a.map(f=>{this.#o(c.toUpperCase(),this.#r,f)})}return this},this.use=(s,...o)=>(typeof s=="string"?this.#r=s:(this.#r="*",o.unshift(s)),o.forEach(a=>{this.#o(A,this.#r,a)}),this);let{strict:t,...i}=r;Object.assign(this,i),this.getPath=t??!0?r.getPath??lr:Xr}#e(){let r=new pn({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#n=this.#n,r.routes=this.routes,r}#n=li;errorHandler=un;route(r,n){let t=this.basePath(r);return n.routes.map(i=>{let s;n.errorHandler===un?s=i.handler:(s=async(o,a)=>(await or([],n.errorHandler)(o,()=>i.handler(o,a))).res,s[cn]=i.handler),t.#o(i.method,i.path,s)}),this}basePath(r){let n=this.#e();return n._basePath=D(this._basePath,r),n}onError=r=>(this.errorHandler=r,this);notFound=r=>(this.#n=r,this);mount(r,n,t){let i,s;t&&(typeof t=="function"?s=t:(s=t.optionHandler,t.replaceRequest===!1?i=l=>l:i=t.replaceRequest));let o=s?l=>{let c=s(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};i||=(()=>{let l=D(this._basePath,r),c=l==="/"?0:l.length;return f=>{let u=new URL(f.url);return u.pathname=u.pathname.slice(c)||"/",new Request(u,f)}})();let a=async(l,c)=>{let f=await n(i(l.req.raw),...o(l));if(f)return f;await c()};return this.#o(A,D(r,"*"),a),this}#o(r,n,t){r=r.toUpperCase(),n=D(this._basePath,n);let i={basePath:this._basePath,path:n,method:r,handler:t};this.router.add(r,n,[t,i]),this.routes.push(i)}#i(r,n){if(r instanceof Error)return this.errorHandler(r,n);throw r}#t(r,n,t,i){if(i==="HEAD")return(async()=>new Response(null,await this.#t(r,n,t,"GET")))();let s=this.getPath(r,{env:t}),o=this.router.match(i,s),a=new sn(r,{path:s,matchResult:o,env:t,executionCtx:n,notFoundHandler:this.#n});if(o[0].length===1){let c;try{c=o[0][0][0][0](a,async()=>{a.res=await this.#n(a)})}catch(f){return this.#i(f,a)}return c instanceof Promise?c.then(f=>f||(a.finalized?a.res:this.#n(a))).catch(f=>this.#i(f,a)):c??this.#n(a)}let l=or(o[0],this.errorHandler,this.#n);return(async()=>{try{let c=await l(a);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#i(c,a)}})()}fetch=(r,...n)=>this.#t(r,n[1],n[0],r.method);request=(r,n,t,i)=>r instanceof Request?this.fetch(n?new Request(r,n):r,t,i):(r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${D("/",r)}`,n),t,i));fire=()=>{addEventListener("fetch",r=>{r.respondWith(this.#t(r.request,r,void 0,r.request.method))})}};var Ne=[];function pr(e,r){let n=this.buildAllMatchers(),t=((i,s)=>{let o=n[i]||n[A],a=o[2][s];if(a)return a;let l=s.match(o[0]);if(!l)return[[],Ne];let c=l.indexOf("",1);return[o[1][c],l]});return this.match=t,t(e,r)}var Le="[^/]+",he=".*",me="(?:|/.*)",$=Symbol(),ci=new Set(".\\+*[^]$()");function ui(e,r){return e.length===1?r.length===1?e<r?-1:1:-1:r.length===1||e===he||e===me?1:r===he||r===me?-1:e===Le?1:r===Le?-1:e.length===r.length?e<r?-1:1:r.length-e.length}var dn=class dr{#r;#e;#n=Object.create(null);insert(r,n,t,i,s){if(r.length===0){if(this.#r!==void 0)throw $;if(s)return;this.#r=n;return}let[o,...a]=r,l=o==="*"?a.length===0?["","",he]:["","",Le]:o==="/*"?["","",me]:o.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),c;if(l){let f=l[1],u=l[2]||Le;if(f&&l[2]&&(u===".*"||(u=u.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(u))))throw $;if(c=this.#n[u],!c){if(Object.keys(this.#n).some(p=>p!==he&&p!==me))throw $;if(s)return;c=this.#n[u]=new dr,f!==""&&(c.#e=i.varIndex++)}!s&&f!==""&&t.push([f,c.#e])}else if(c=this.#n[o],!c){if(Object.keys(this.#n).some(f=>f.length>1&&f!==he&&f!==me))throw $;if(s)return;c=this.#n[o]=new dr}c.insert(a,n,t,i,s)}buildRegExpStr(){let n=Object.keys(this.#n).sort(ui).map(t=>{let i=this.#n[t];return(typeof i.#e=="number"?`(${t})@${i.#e}`:ci.has(t)?`\\${t}`:t)+i.buildRegExpStr()});return typeof this.#r=="number"&&n.unshift(`#${this.#r}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}};var hn=class{#r={varIndex:0};#e=new dn;insert(e,r,n){let t=[],i=[];for(let o=0;;){let a=!1;if(e=e.replace(/\{[^}]+\}/g,l=>{let c=`@\\${o}`;return i[o]=[c,l],o++,a=!0,c}),!a)break}let s=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let o=i.length-1;o>=0;o--){let[a]=i[o];for(let l=s.length-1;l>=0;l--)if(s[l].indexOf(a)!==-1){s[l]=s[l].replace(a,i[o][1]);break}}return this.#e.insert(s,r,t,this.#r,n),t}buildRegExp(){let e=this.#e.buildRegExpStr();if(e==="")return[/^$/,[],[]];let r=0,n=[],t=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,o)=>s!==void 0?(n[++r]=Number(s),"$()"):(o!==void 0&&(t[Number(o)]=++r),"")),[new RegExp(`^${e}`),n,t]}};var fi=[/^$/,[],Object.create(null)],mn=Object.create(null);function gn(e){return mn[e]??=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(r,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function pi(){mn=Object.create(null)}function di(e){let r=new hn,n=[];if(e.length===0)return fi;let t=e.map(c=>[!/\*|\/:/.test(c[0]),...c]).sort(([c,f],[u,p])=>c?1:u?-1:f.length-p.length),i=Object.create(null);for(let c=0,f=-1,u=t.length;c<u;c++){let[p,d,m]=t[c];p?i[d]=[m.map(([x])=>[x,Object.create(null)]),Ne]:f++;let y;try{y=r.insert(d,f,p)}catch(x){throw x===$?new je(d):x}p||(n[f]=m.map(([x,v])=>{let g=Object.create(null);for(v-=1;v>=0;v--){let[le,Ze]=y[v];g[le]=Ze}return[x,g]}))}let[s,o,a]=r.buildRegExp();for(let c=0,f=n.length;c<f;c++)for(let u=0,p=n[c].length;u<p;u++){let d=n[c][u]?.[1];if(!d)continue;let m=Object.keys(d);for(let y=0,x=m.length;y<x;y++)d[m[y]]=a[d[m[y]]]}let l=[];for(let c in o)l[c]=n[o[c]];return[s,l,i]}function V(e,r){if(e){for(let n of Object.keys(e).sort((t,i)=>i.length-t.length))if(gn(n).test(r))return[...e[n]]}}var De=class{name="RegExpRouter";#r;#e;constructor(){this.#r={[A]:Object.create(null)},this.#e={[A]:Object.create(null)}}add(e,r,n){let t=this.#r,i=this.#e;if(!t||!i)throw new Error(Fe);t[e]||[t,i].forEach(a=>{a[e]=Object.create(null),Object.keys(a[A]).forEach(l=>{a[e][l]=[...a[A][l]]})}),r==="/*"&&(r="*");let s=(r.match(/\/:/g)||[]).length;if(/\*$/.test(r)){let a=gn(r);e===A?Object.keys(t).forEach(l=>{t[l][r]||=V(t[l],r)||V(t[A],r)||[]}):t[e][r]||=V(t[e],r)||V(t[A],r)||[],Object.keys(t).forEach(l=>{(e===A||e===l)&&Object.keys(t[l]).forEach(c=>{a.test(c)&&t[l][c].push([n,s])})}),Object.keys(i).forEach(l=>{(e===A||e===l)&&Object.keys(i[l]).forEach(c=>a.test(c)&&i[l][c].push([n,s]))});return}let o=_e(r)||[r];for(let a=0,l=o.length;a<l;a++){let c=o[a];Object.keys(i).forEach(f=>{(e===A||e===f)&&(i[f][c]||=[...V(t[f],c)||V(t[A],c)||[]],i[f][c].push([n,s-l+a+1]))})}}match=pr;buildAllMatchers(){let e=Object.create(null);return Object.keys(this.#e).concat(Object.keys(this.#r)).forEach(r=>{e[r]||=this.#n(r)}),this.#r=this.#e=void 0,pi(),e}#n(e){let r=[],n=e===A;return[this.#r,this.#e].forEach(t=>{let i=t[e]?Object.keys(t[e]).map(s=>[s,t[e][s]]):[];i.length!==0?(n||=!0,r.push(...i)):e!==A&&r.push(...Object.keys(t[A]).map(s=>[s,t[A][s]]))}),n?di(r):null}};var hr=class{name="SmartRouter";#r=[];#e=[];constructor(e){this.#r=e.routers}add(e,r,n){if(!this.#e)throw new Error(Fe);this.#e.push([e,r,n])}match(e,r){if(!this.#e)throw new Error("Fatal error");let n=this.#r,t=this.#e,i=n.length,s=0,o;for(;s<i;s++){let a=n[s];try{for(let l=0,c=t.length;l<c;l++)a.add(...t[l]);o=a.match(e,r)}catch(l){if(l instanceof je)continue;throw l}this.match=a.match.bind(a),this.#r=[a],this.#e=void 0;break}if(s===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,o}get activeRouter(){if(this.#e||this.#r.length!==1)throw new Error("No active router has been determined yet.");return this.#r[0]}};var ge=Object.create(null),hi=e=>{for(let r in e)return!0;return!1},yn=class xn{#r;#e;#n;#o=0;#i=ge;constructor(r,n,t){if(this.#e=t||Object.create(null),this.#r=[],r&&n){let i=Object.create(null);i[r]={handler:n,possibleKeys:[],score:0},this.#r=[i]}this.#n=[]}insert(r,n,t){this.#o=++this.#o;let i=this,s=Jr(n),o=[];for(let a=0,l=s.length;a<l;a++){let c=s[a],f=s[a+1],u=Qr(c,f),p=Array.isArray(u)?u[0]:c;if(p in i.#e){i=i.#e[p],u&&o.push(u[1]);continue}i.#e[p]=new xn,u&&(i.#n.push(u),o.push(u[1])),i=i.#e[p]}return i.#r.push({[r]:{handler:t,possibleKeys:o.filter((a,l,c)=>c.indexOf(a)===l),score:this.#o}}),i}#t(r,n,t,i,s){for(let o=0,a=n.#r.length;o<a;o++){let l=n.#r[o],c=l[t]||l[A],f={};if(c!==void 0&&(c.params=Object.create(null),r.push(c),i!==ge||s&&s!==ge))for(let u=0,p=c.possibleKeys.length;u<p;u++){let d=c.possibleKeys[u],m=f[c.score];c.params[d]=s?.[d]&&!m?s[d]:i[d]??s?.[d],f[c.score]=!0}}}search(r,n){let t=[];this.#i=ge;let s=[this],o=ar(n),a=[],l=o.length,c=null;for(let f=0;f<l;f++){let u=o[f],p=f===l-1,d=[];for(let y=0,x=s.length;y<x;y++){let v=s[y],g=v.#e[u];g&&(g.#i=v.#i,p?(g.#e["*"]&&this.#t(t,g.#e["*"],r,v.#i),this.#t(t,g,r,v.#i)):d.push(g));for(let le=0,Ze=v.#n.length;le<Ze;le++){let Lr=v.#n[le],_=v.#i===ge?{}:{...v.#i};if(Lr==="*"){let q=v.#e["*"];q&&(this.#t(t,q,r,v.#i),q.#i=_,d.push(q));continue}let[_t,Dr,ce]=Lr;if(!u&&!(ce instanceof RegExp))continue;let P=v.#e[_t];if(ce instanceof RegExp){if(c===null){c=new Array(l);let ke=n[0]==="/"?1:0;for(let ue=0;ue<l;ue++)c[ue]=ke,ke+=o[ue].length+1}let q=n.substring(c[f]),Je=ce.exec(q);if(Je){if(_[Dr]=Je[0],this.#t(t,P,r,v.#i,_),hi(P.#e)){P.#i=_;let ke=Je[0].match(/\//)?.length??0;(a[ke]||=[]).push(P)}continue}}(ce===!0||ce.test(u))&&(_[Dr]=u,p?(this.#t(t,P,r,_,v.#i),P.#e["*"]&&this.#t(t,P.#e["*"],r,_,v.#i)):(P.#i=_,d.push(P)))}}let m=a.shift();s=m?d.concat(m):d}return t.length>1&&t.sort((f,u)=>f.score-u.score),[t.map(({handler:f,params:u})=>[f,u])]}};var mr=class{name="TrieRouter";#r;constructor(){this.#r=new yn}add(e,r,n){let t=_e(r);if(t){for(let i=0,s=t.length;i<s;i++)this.#r.insert(e,t[i],n);return}this.#r.insert(e,r,n)}match(e,r){return this.#r.search(e,r)}};var O=class extends fn{constructor(e={}){super(e),this.router=e.router??new hr({routers:[new De,new mr]})}};var vn=e=>{let n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...e},t=(s=>typeof s=="string"?s==="*"?()=>s:o=>s===o?o:null:typeof s=="function"?s:o=>s.includes(o)?o:null)(n.origin),i=(s=>typeof s=="function"?s:Array.isArray(s)?()=>s:()=>[])(n.allowMethods);return async function(o,a){function l(f,u){o.res.headers.set(f,u)}let c=await t(o.req.header("origin")||"",o);if(c&&l("Access-Control-Allow-Origin",c),n.credentials&&l("Access-Control-Allow-Credentials","true"),n.exposeHeaders?.length&&l("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.origin!=="*"&&l("Vary","Origin"),n.maxAge!=null&&l("Access-Control-Max-Age",n.maxAge.toString());let f=await i(o.req.header("origin")||"",o);f.length&&l("Access-Control-Allow-Methods",f.join(","));let u=n.allowHeaders;if(!u?.length){let p=o.req.header("Access-Control-Request-Headers");p&&(u=p.split(/\s*,\s*/))}return u?.length&&(l("Access-Control-Allow-Headers",u.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await a(),n.origin!=="*"&&o.header("Vary","Origin",{append:!0})}};function mi(){let{process:e,Deno:r}=globalThis;return!(typeof r?.noColor=="boolean"?r.noColor:e!==void 0?"NO_COLOR"in e?.env:!1)}async function An(){let{navigator:e}=globalThis,r="cloudflare:workers";return!(e!==void 0&&e.userAgent==="Cloudflare-Workers"?await(async()=>{try{return"NO_COLOR"in((await import(r)).env??{})}catch{return!1}})():!mi())}var gi=e=>{let[r,n]=[",","."];return e.map(i=>i.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r)).join(n)},yi=e=>{let r=Date.now()-e;return gi([r<1e3?r+"ms":Math.round(r/1e3)+"s"])},xi=async e=>{if(await An())switch(e/100|0){case 5:return`\x1B[31m${e}\x1B[0m`;case 4:return`\x1B[33m${e}\x1B[0m`;case 3:return`\x1B[36m${e}\x1B[0m`;case 2:return`\x1B[32m${e}\x1B[0m`}return`${e}`};async function bn(e,r,n,t,i=0,s){let o=r==="<--"?`${r} ${n} ${t}`:`${r} ${n} ${t} ${await xi(i)} ${s}`;e(o)}var wn=(e=console.log)=>async function(n,t){let{method:i,url:s}=n.req,o=s.slice(s.indexOf("/",8));await bn(e,"<--",i,o);let a=Date.now();await t(),await bn(e,"-->",i,o,n.res.status,yi(a))};import{existsSync as vi,readFileSync as Ai}from"node:fs";import{dirname as bi,resolve as Rn}from"node:path";import{fileURLToPath as wi}from"node:url";var Cn="apv.config.json",Z=null,En;function kn(e){En=e}function M(){if(Z)return Z;let e=process.env.APV_CONFIG,r=[En,e,Rn(process.cwd(),Cn),Rn(bi(wi(import.meta.url)),"..","..","..",Cn)].filter(Boolean);for(let n of r)if(vi(n))try{let t=Ai(n,"utf-8"),i=JSON.parse(t);return Z={cacheDir:i.cacheDir,customTaskDocs:i.customTaskDocs??{}},console.log(`Loaded config from ${n}`),Z}catch(t){console.warn(`Failed to parse ${n}:`,t)}return Z={customTaskDocs:{}},Z}function $e(e){let r=e.startsWith("/"),n=e.split("/").filter(s=>s!==""&&s!=="."),t=[];for(let s of n)s===".."?t.length>0&&t[t.length-1]!==".."?t.pop():r||t.push(s):t.push(s);let i=t.join("/");return r?`/${i}`:i}function Bn(e){return typeof e>"u"||e===null}function Ci(e){return typeof e=="object"&&e!==null}function Ei(e){return Array.isArray(e)?e:Bn(e)?[]:[e]}function ki(e,r){var n,t,i,s;if(r)for(s=Object.keys(r),n=0,t=s.length;n<t;n+=1)i=s[n],e[i]=r[i];return e}function Si(e,r){var n="",t;for(t=0;t<r;t+=1)n+=e;return n}function Ti(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Pi=Bn,Oi=Ci,Ii=Ei,_i=Si,Fi=Ti,ji=ki,w={isNothing:Pi,isObject:Oi,toArray:Ii,repeat:_i,isNegativeZero:Fi,extend:ji};function Un(e,r){var n="",t=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
2
+ import{existsSync as Pt,readFileSync as Ot}from"node:fs";import{extname as Ia,join as Nr}from"node:path";import{fileURLToPath as _a}from"node:url";import{parseArgs as Fa}from"node:util";import{createServer as Ft}from"http";import{Http2ServerRequest as zr,constants as jt}from"http2";import{Http2ServerRequest as Qe}from"http2";import{Readable as $r}from"stream";import Wt from"crypto";var N=class extends Error{constructor(e,r){super(e,r),this.name="RequestError"}},Nt=e=>e instanceof N?e:new N(e.message,{cause:e}),Lt=global.Request,fe=class extends Lt{constructor(e,r){typeof e=="object"&&K in e&&(e=e[K]()),typeof r?.body?.getReader<"u"&&(r.duplex??="half"),super(e,r)}},Dt=e=>{let r=[],n=e.rawHeaders;for(let t=0;t<n.length;t+=2){let{[t]:i,[t+1]:s}=n;i.charCodeAt(0)!==58&&r.push([i,s])}return new Headers(r)},Hr=Symbol("wrapBodyStream"),$t=(e,r,n,t,i)=>{let s={method:e,headers:n,signal:i.signal};if(e==="TRACE"){s.method="GET";let o=new fe(r,s);return Object.defineProperty(o,"method",{get(){return"TRACE"}}),o}if(!(e==="GET"||e==="HEAD"))if("rawBody"in t&&t.rawBody instanceof Buffer)s.body=new ReadableStream({start(o){o.enqueue(t.rawBody),o.close()}});else if(t[Hr]){let o;s.body=new ReadableStream({async pull(a){try{o||=$r.toWeb(t).getReader();let{done:l,value:c}=await o.read();l?a.close():a.enqueue(c)}catch(l){a.error(l)}}})}else s.body=$r.toWeb(t);return new fe(r,s)},K=Symbol("getRequestCache"),Br=Symbol("requestCache"),Se=Symbol("incomingKey"),Te=Symbol("urlKey"),Mt=Symbol("headersKey"),G=Symbol("abortControllerKey"),zt=Symbol("getAbortController"),pe={get method(){return this[Se].method||"GET"},get url(){return this[Te]},get headers(){return this[Mt]||=Dt(this[Se])},[zt](){return this[K](),this[G]},[K](){return this[G]||=new AbortController,this[Br]||=$t(this.method,this[Te],this.headers,this[Se],this[G])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(e=>{Object.defineProperty(pe,e,{get(){return this[K]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(pe,e,{value:function(){return this[K]()[e]()}})});Object.defineProperty(pe,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,r,n){let t={method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Br]};return`Request (lightweight) ${n(t,{...r,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(pe,fe.prototype);var Ht=(e,r)=>{let n=Object.create(pe);n[Se]=e;let t=e.url||"";if(t[0]!=="/"&&(t.startsWith("http://")||t.startsWith("https://"))){if(e instanceof Qe)throw new N("Absolute URL for :path is not allowed in HTTP/2");try{let a=new URL(t);n[Te]=a.href}catch(a){throw new N("Invalid absolute URL",{cause:a})}return n}let i=(e instanceof Qe?e.authority:e.headers.host)||r;if(!i)throw new N("Missing host header");let s;if(e instanceof Qe){if(s=e.scheme,!(s==="http"||s==="https"))throw new N("Unsupported scheme")}else s=e.socket&&e.socket.encrypted?"https":"http";let o=new URL(`${s}://${i}${t}`);if(o.hostname.length!==i.length&&o.hostname!==i.replace(/:\d+$/,""))throw new N("Invalid host header");return n[Te]=o.href,n},er=Symbol("responseCache"),W=Symbol("getResponseCache"),L=Symbol("cache"),tr=global.Response,Y=class Ur{#r;#e;[W](){return delete this[L],this[er]||=new tr(this.#r,this.#e)}constructor(r,n){let t;if(this.#r=r,n instanceof Ur){let i=n[er];if(i){this.#e=i,this[W]();return}else this.#e=n.#e,t=new Headers(n.#e.headers)}else this.#e=n;(typeof r=="string"||typeof r?.getReader<"u"||r instanceof Blob||r instanceof Uint8Array)&&(this[L]=[n?.status||200,r,t||n?.headers])}get headers(){let r=this[L];return r?(r[2]instanceof Headers||(r[2]=new Headers(r[2]||{"content-type":"text/plain; charset=UTF-8"})),r[2]):this[W]().headers}get status(){return this[L]?.[0]??this[W]().status}get ok(){let r=this.status;return r>=200&&r<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(Y.prototype,e,{get(){return this[W]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(Y.prototype,e,{value:function(){return this[W]()[e]()}})});Object.defineProperty(Y.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,r,n){let t={status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[er]};return`Response (lightweight) ${n(t,{...r,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(Y,tr);Object.setPrototypeOf(Y.prototype,tr.prototype);async function Bt(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function qr(e,r,n){let t=a=>{e.cancel(a).catch(()=>{})};return r.on("close",t),r.on("error",t),(n??e.read()).then(o,i),e.closed.finally(()=>{r.off("close",t),r.off("error",t)});function i(a){a&&r.destroy(a)}function s(){e.read().then(o,i)}function o({done:a,value:l}){try{if(a)r.end();else if(!r.write(l))r.once("drain",s);else return e.read().then(o,i)}catch(c){i(c)}}}function Ut(e,r){if(e.locked)throw new TypeError("ReadableStream is locked.");return r.destroyed?void 0:qr(e.getReader(),r)}var rr=e=>{let r={};e instanceof Headers||(e=new Headers(e??void 0));let n=[];for(let[t,i]of e)t==="set-cookie"?n.push(i):r[t]=i;return n.length>0&&(r["set-cookie"]=n),r["content-type"]??="text/plain; charset=UTF-8",r},qt="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=Wt);var ir=Symbol("outgoingEnded"),Mr=Symbol("incomingDraining"),Gt=500,Kt=64*1024*1024,Xe=e=>{let r=e;if(e.destroyed||r[Mr])return;if(r[Mr]=!0,e instanceof zr){try{e.stream?.close?.(jt.NGHTTP2_NO_ERROR)}catch{}return}let n=0,t=()=>{clearTimeout(s),e.off("data",o),e.off("end",t),e.off("error",t)},i=()=>{t();let a=e.socket;a&&!a.destroyed&&a.destroySoon()},s=setTimeout(i,Gt);s.unref?.();let o=a=>{n+=a.length,n>Kt&&i()};e.on("data",o),e.on("end",t),e.on("error",t),e.resume()},Yt=()=>new Response(null,{status:400}),Wr=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),nr=(e,r)=>{let n=e instanceof Error?e:new Error("unknown error",{cause:e});n.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),r.headersSent||r.writeHead(500,{"Content-Type":"text/plain"}),r.end(`Error: ${n.message}`),r.destroy(n))},Gr=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},Kr=async(e,r)=>{let[n,t,i]=e[L],s=!1;if(!i)i={"content-type":"text/plain; charset=UTF-8"};else if(i instanceof Headers)s=i.has("content-length"),i=rr(i);else if(Array.isArray(i)){let o=new Headers(i);s=o.has("content-length"),i=rr(o)}else for(let o in i)if(o.length===14&&o.toLowerCase()==="content-length"){s=!0;break}s||(typeof t=="string"?i["Content-Length"]=Buffer.byteLength(t):t instanceof Uint8Array?i["Content-Length"]=t.byteLength:t instanceof Blob&&(i["Content-Length"]=t.size)),r.writeHead(n,i),typeof t=="string"||t instanceof Uint8Array?r.end(t):t instanceof Blob?r.end(new Uint8Array(await t.arrayBuffer())):(Gr(r),await Ut(t,r)?.catch(o=>nr(o,r))),r[ir]?.()},Vt=e=>typeof e.then=="function",Zt=async(e,r,n={})=>{if(Vt(e))if(n.errorHandler)try{e=await e}catch(i){let s=await n.errorHandler(i);if(!s)return;e=s}else e=await e.catch(Wr);if(L in e)return Kr(e,r);let t=rr(e.headers);if(e.body){let i=e.body.getReader(),s=[],o=!1,a;if(t["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){a||=i.read();let f=await Bt(a).catch(u=>{console.error(u),o=!0});if(!f){if(c===1){await new Promise(u=>setTimeout(u)),l=3;continue}break}if(a=void 0,f.value&&s.push(f.value),f.done){o=!0;break}}o&&!("content-length"in t)&&(t["content-length"]=s.reduce((c,f)=>c+f.length,0))}r.writeHead(e.status,t),s.forEach(l=>{r.write(l)}),o?r.end():(s.length===0&&Gr(r),await qr(i,r,a))}else t[qt]||(r.writeHead(e.status,t),r.end());r[ir]?.()},Jt=(e,r={})=>{let n=r.autoCleanupIncoming??!0;return r.overrideGlobalObjects!==!1&&global.Request!==fe&&(Object.defineProperty(global,"Request",{value:fe}),Object.defineProperty(global,"Response",{value:Y})),async(t,i)=>{let s,o;try{o=Ht(t,r.hostname);let a=!n||t.method==="GET"||t.method==="HEAD";if(a||(t[Hr]=!0,t.on("end",()=>{a=!0}),t instanceof zr&&(i[ir]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{Xe(t)})})}),i.on("finish",()=>{a||Xe(t)})),i.on("close",()=>{o[G]&&(t.errored?o[G].abort(t.errored.toString()):i.writableFinished||o[G].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{Xe(t)})})}),s=e(o,{incoming:t,outgoing:i}),L in s)return Kr(s,i)}catch(a){if(s)return nr(a,i);if(r.errorHandler){if(s=await r.errorHandler(o?a:Nt(a)),!s)return}else o?s=Wr(a):s=Yt()}try{return await Zt(s,i,r)}catch(a){return nr(a,i)}}},Qt=e=>{let r=e.fetch,n=Jt(r,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming});return(e.createServer||Ft)(e.serverOptions||{},n)},Yr=(e,r)=>{let n=Qt(e);return n.listen(e?.port??3e3,e.hostname,()=>{let t=n.address();r&&r(t)}),n};var or=(e,r,n)=>(t,i)=>{let s=-1;return o(0);async function o(a){if(a<=s)throw new Error("next() called multiple times");s=a;let l,c=!1,f;if(e[a]?(f=e[a][0][0],t.req.routeIndex=a):f=a===e.length&&i||void 0,f)try{l=await f(t,()=>o(a+1))}catch(u){if(u instanceof Error&&r)t.error=u,l=await r(u,t),c=!0;else throw u}else t.finalized===!1&&n&&(l=await n(t));return l&&(t.finalized===!1||c)&&(t.res=l),t}};var Vr=Symbol();var Zr=async(e,r=Object.create(null))=>{let{all:n=!1,dot:t=!1}=r,s=(e instanceof Pe?e.raw.headers:e.headers).get("Content-Type");return s?.startsWith("multipart/form-data")||s?.startsWith("application/x-www-form-urlencoded")?Xt(e,{all:n,dot:t}):{}};async function Xt(e,r){let n=await e.formData();return n?ei(n,r):{}}function ei(e,r){let n=Object.create(null);return e.forEach((t,i)=>{r.all||i.endsWith("[]")?ri(n,i,t):n[i]=t}),r.dot&&Object.entries(n).forEach(([t,i])=>{t.includes(".")&&(ni(n,t,i),delete n[t])}),n}var ri=(e,r,n)=>{e[r]!==void 0?Array.isArray(e[r])?e[r].push(n):e[r]=[e[r],n]:r.endsWith("[]")?e[r]=[n]:e[r]=n},ni=(e,r,n)=>{if(/(?:^|\.)__proto__\./.test(r))return;let t=e,i=r.split(".");i.forEach((s,o)=>{o===i.length-1?t[s]=n:((!t[s]||typeof t[s]!="object"||Array.isArray(t[s])||t[s]instanceof File)&&(t[s]=Object.create(null)),t=t[s])})};var ar=e=>{let r=e.split("/");return r[0]===""&&r.shift(),r},Jr=e=>{let{groups:r,path:n}=ti(e),t=ar(n);return ii(t,r)},ti=e=>{let r=[];return e=e.replace(/\{[^}]+\}/g,(n,t)=>{let i=`@${t}`;return r.push([i,n]),i}),{groups:r,path:e}},ii=(e,r)=>{for(let n=r.length-1;n>=0;n--){let[t]=r[n];for(let i=e.length-1;i>=0;i--)if(e[i].includes(t)){e[i]=e[i].replace(t,r[n][1]);break}}return e},Oe={},Qr=(e,r)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let t=`${e}#${r}`;return Oe[t]||(n[2]?Oe[t]=r&&r[0]!==":"&&r[0]!=="*"?[t,n[1],new RegExp(`^${n[2]}(?=/${r})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:Oe[t]=[e,n[1],!0]),Oe[t]}return null},Ie=(e,r)=>{try{return r(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return r(n)}catch{return n}})}},oi=e=>Ie(e,decodeURI),lr=e=>{let r=e.url,n=r.indexOf("/",r.indexOf(":")+4),t=n;for(;t<r.length;t++){let i=r.charCodeAt(t);if(i===37){let s=r.indexOf("?",t),o=r.indexOf("#",t),a=s===-1?o===-1?void 0:o:o===-1?s:Math.min(s,o),l=r.slice(n,a);return oi(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(i===63||i===35)break}return r.slice(n,t)};var Xr=e=>{let r=lr(e);return r.length>1&&r.at(-1)==="/"?r.slice(0,-1):r},D=(e,r,...n)=>(n.length&&(r=D(r,...n)),`${e?.[0]==="/"?"":"/"}${e}${r==="/"?"":`${e?.at(-1)==="/"?"":"/"}${r?.[0]==="/"?r.slice(1):r}`}`),_e=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let r=e.split("/"),n=[],t="";return r.forEach(i=>{if(i!==""&&!/\:/.test(i))t+="/"+i;else if(/\:/.test(i))if(/\?/.test(i)){n.length===0&&t===""?n.push("/"):n.push(t);let s=i.replace("?","");t+="/"+s,n.push(t)}else t+="/"+i}),n.filter((i,s,o)=>o.indexOf(i)===s)},sr=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?Ie(e,cr):e):e,en=(e,r,n)=>{let t;if(!n&&r&&!/[%+]/.test(r)){let o=e.indexOf("?",8);if(o===-1)return;for(e.startsWith(r,o+1)||(o=e.indexOf(`&${r}`,o+1));o!==-1;){let a=e.charCodeAt(o+r.length+1);if(a===61){let l=o+r.length+2,c=e.indexOf("&",l);return sr(e.slice(l,c===-1?void 0:c))}else if(a==38||isNaN(a))return"";o=e.indexOf(`&${r}`,o+1)}if(t=/[%+]/.test(e),!t)return}let i={};t??=/[%+]/.test(e);let s=e.indexOf("?",8);for(;s!==-1;){let o=e.indexOf("&",s+1),a=e.indexOf("=",s);a>o&&o!==-1&&(a=-1);let l=e.slice(s+1,a===-1?o===-1?void 0:o:a);if(t&&(l=sr(l)),s=o,l==="")continue;let c;a===-1?c="":(c=e.slice(a+1,o===-1?void 0:o),t&&(c=sr(c))),n?(i[l]&&Array.isArray(i[l])||(i[l]=[]),i[l].push(c)):i[l]??=c}return r?i[r]:i},rn=en,nn=(e,r)=>en(e,r,!0),cr=decodeURIComponent;var tn=e=>Ie(e,cr),Pe=class{raw;#r;#e;routeIndex=0;path;bodyCache={};constructor(e,r="/",n=[[]]){this.raw=e,this.path=r,this.#e=n,this.#r={}}param(e){return e?this.#n(e):this.#o()}#n(e){let r=this.#e[0][this.routeIndex][1][e],n=this.#i(r);return n&&/\%/.test(n)?tn(n):n}#o(){let e={},r=Object.keys(this.#e[0][this.routeIndex][1]);for(let n of r){let t=this.#i(this.#e[0][this.routeIndex][1][n]);t!==void 0&&(e[n]=/\%/.test(t)?tn(t):t)}return e}#i(e){return this.#e[1]?this.#e[1][e]:e}query(e){return rn(this.url,e)}queries(e){return nn(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let r={};return this.raw.headers.forEach((n,t)=>{r[t]=n}),r}async parseBody(e){return this.bodyCache.parsedBody??=await Zr(this,e)}#t=e=>{let{bodyCache:r,raw:n}=this,t=r[e];if(t)return t;let i=Object.keys(r)[0];return i?r[i].then(s=>(i==="json"&&(s=JSON.stringify(s)),new Response(s)[e]())):r[e]=n[e]()};json(){return this.#t("text").then(e=>JSON.parse(e))}text(){return this.#t("text")}arrayBuffer(){return this.#t("arrayBuffer")}blob(){return this.#t("blob")}formData(){return this.#t("formData")}addValidatedData(e,r){this.#r[e]=r}valid(e){return this.#r[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[Vr](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,e]])=>e)}get routePath(){return this.#e[0].map(([[,e]])=>e)[this.routeIndex].path}};var on={Stringify:1,BeforeStream:2,Stream:3},si=(e,r)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=r,n};var ur=async(e,r,n,t,i)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let s=e.callbacks;if(!s?.length)return Promise.resolve(e);i?i[0]+=e:i=[e];let o=Promise.all(s.map(a=>a({phase:r,buffer:i,context:t}))).then(a=>Promise.all(a.filter(Boolean).map(l=>ur(l,r,!1,t,i))).then(()=>i[0]));return n?si(await o,s):o};var ai="text/plain; charset=UTF-8",fr=(e,r)=>({"Content-Type":e,...r}),de=(e,r)=>new Response(e,r),sn=class{#r;#e;env={};#n;finalized=!1;error;#o;#i;#t;#u;#l;#c;#a;#f;#p;constructor(e,r){this.#r=e,r&&(this.#i=r.executionCtx,this.env=r.env,this.#c=r.notFoundHandler,this.#p=r.path,this.#f=r.matchResult)}get req(){return this.#e??=new Pe(this.#r,this.#p,this.#f),this.#e}get event(){if(this.#i&&"respondWith"in this.#i)return this.#i;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#i)return this.#i;throw Error("This context has no ExecutionContext")}get res(){return this.#t||=de(null,{headers:this.#a??=new Headers})}set res(e){if(this.#t&&e){e=de(e.body,e);for(let[r,n]of this.#t.headers.entries())if(r!=="content-type")if(r==="set-cookie"){let t=this.#t.headers.getSetCookie();e.headers.delete("set-cookie");for(let i of t)e.headers.append("set-cookie",i)}else e.headers.set(r,n)}this.#t=e,this.finalized=!0}render=(...e)=>(this.#l??=r=>this.html(r),this.#l(...e));setLayout=e=>this.#u=e;getLayout=()=>this.#u;setRenderer=e=>{this.#l=e};header=(e,r,n)=>{this.finalized&&(this.#t=de(this.#t.body,this.#t));let t=this.#t?this.#t.headers:this.#a??=new Headers;r===void 0?t.delete(e):n?.append?t.append(e,r):t.set(e,r)};status=e=>{this.#o=e};set=(e,r)=>{this.#n??=new Map,this.#n.set(e,r)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#s(e,r,n){let t=this.#t?new Headers(this.#t.headers):this.#a??new Headers;if(typeof r=="object"&&"headers"in r){let s=r.headers instanceof Headers?r.headers:new Headers(r.headers);for(let[o,a]of s)o.toLowerCase()==="set-cookie"?t.append(o,a):t.set(o,a)}if(n)for(let[s,o]of Object.entries(n))if(typeof o=="string")t.set(s,o);else{t.delete(s);for(let a of o)t.append(s,a)}let i=typeof r=="number"?r:r?.status??this.#o;return de(e,{status:i,headers:t})}newResponse=(...e)=>this.#s(...e);body=(e,r,n)=>this.#s(e,r,n);text=(e,r,n)=>!this.#a&&!this.#o&&!r&&!n&&!this.finalized?new Response(e):this.#s(e,r,fr(ai,n));json=(e,r,n)=>this.#s(JSON.stringify(e),r,fr("application/json",n));html=(e,r,n)=>{let t=i=>this.#s(i,r,fr("text/html; charset=UTF-8",n));return typeof e=="object"?ur(e,on.Stringify,!1,{}).then(t):t(e)};redirect=(e,r)=>{let n=String(e);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,r??302)};notFound=()=>(this.#c??=()=>de(),this.#c(this))};var A="ALL",an="all",ln=["get","post","put","delete","options","patch"],Fe="Can not add a route since the matcher is already built.",je=class extends Error{};var cn="__COMPOSED_HANDLER";var li=e=>e.text("404 Not Found",404),un=(e,r)=>{if("getResponse"in e){let n=e.getResponse();return r.newResponse(n.body,n)}return console.error(e),r.text("Internal Server Error",500)},fn=class pn{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#r="/";routes=[];constructor(r={}){[...ln,an].forEach(s=>{this[s]=(o,...a)=>(typeof o=="string"?this.#r=o:this.#o(s,this.#r,o),a.forEach(l=>{this.#o(s,this.#r,l)}),this)}),this.on=(s,o,...a)=>{for(let l of[o].flat()){this.#r=l;for(let c of[s].flat())a.map(f=>{this.#o(c.toUpperCase(),this.#r,f)})}return this},this.use=(s,...o)=>(typeof s=="string"?this.#r=s:(this.#r="*",o.unshift(s)),o.forEach(a=>{this.#o(A,this.#r,a)}),this);let{strict:t,...i}=r;Object.assign(this,i),this.getPath=t??!0?r.getPath??lr:Xr}#e(){let r=new pn({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#n=this.#n,r.routes=this.routes,r}#n=li;errorHandler=un;route(r,n){let t=this.basePath(r);return n.routes.map(i=>{let s;n.errorHandler===un?s=i.handler:(s=async(o,a)=>(await or([],n.errorHandler)(o,()=>i.handler(o,a))).res,s[cn]=i.handler),t.#o(i.method,i.path,s)}),this}basePath(r){let n=this.#e();return n._basePath=D(this._basePath,r),n}onError=r=>(this.errorHandler=r,this);notFound=r=>(this.#n=r,this);mount(r,n,t){let i,s;t&&(typeof t=="function"?s=t:(s=t.optionHandler,t.replaceRequest===!1?i=l=>l:i=t.replaceRequest));let o=s?l=>{let c=s(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};i||=(()=>{let l=D(this._basePath,r),c=l==="/"?0:l.length;return f=>{let u=new URL(f.url);return u.pathname=u.pathname.slice(c)||"/",new Request(u,f)}})();let a=async(l,c)=>{let f=await n(i(l.req.raw),...o(l));if(f)return f;await c()};return this.#o(A,D(r,"*"),a),this}#o(r,n,t){r=r.toUpperCase(),n=D(this._basePath,n);let i={basePath:this._basePath,path:n,method:r,handler:t};this.router.add(r,n,[t,i]),this.routes.push(i)}#i(r,n){if(r instanceof Error)return this.errorHandler(r,n);throw r}#t(r,n,t,i){if(i==="HEAD")return(async()=>new Response(null,await this.#t(r,n,t,"GET")))();let s=this.getPath(r,{env:t}),o=this.router.match(i,s),a=new sn(r,{path:s,matchResult:o,env:t,executionCtx:n,notFoundHandler:this.#n});if(o[0].length===1){let c;try{c=o[0][0][0][0](a,async()=>{a.res=await this.#n(a)})}catch(f){return this.#i(f,a)}return c instanceof Promise?c.then(f=>f||(a.finalized?a.res:this.#n(a))).catch(f=>this.#i(f,a)):c??this.#n(a)}let l=or(o[0],this.errorHandler,this.#n);return(async()=>{try{let c=await l(a);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return this.#i(c,a)}})()}fetch=(r,...n)=>this.#t(r,n[1],n[0],r.method);request=(r,n,t,i)=>r instanceof Request?this.fetch(n?new Request(r,n):r,t,i):(r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${D("/",r)}`,n),t,i));fire=()=>{addEventListener("fetch",r=>{r.respondWith(this.#t(r.request,r,void 0,r.request.method))})}};var Ne=[];function pr(e,r){let n=this.buildAllMatchers(),t=((i,s)=>{let o=n[i]||n[A],a=o[2][s];if(a)return a;let l=s.match(o[0]);if(!l)return[[],Ne];let c=l.indexOf("",1);return[o[1][c],l]});return this.match=t,t(e,r)}var Le="[^/]+",he=".*",me="(?:|/.*)",$=Symbol(),ci=new Set(".\\+*[^]$()");function ui(e,r){return e.length===1?r.length===1?e<r?-1:1:-1:r.length===1||e===he||e===me?1:r===he||r===me?-1:e===Le?1:r===Le?-1:e.length===r.length?e<r?-1:1:r.length-e.length}var dn=class dr{#r;#e;#n=Object.create(null);insert(r,n,t,i,s){if(r.length===0){if(this.#r!==void 0)throw $;if(s)return;this.#r=n;return}let[o,...a]=r,l=o==="*"?a.length===0?["","",he]:["","",Le]:o==="/*"?["","",me]:o.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),c;if(l){let f=l[1],u=l[2]||Le;if(f&&l[2]&&(u===".*"||(u=u.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(u))))throw $;if(c=this.#n[u],!c){if(Object.keys(this.#n).some(p=>p!==he&&p!==me))throw $;if(s)return;c=this.#n[u]=new dr,f!==""&&(c.#e=i.varIndex++)}!s&&f!==""&&t.push([f,c.#e])}else if(c=this.#n[o],!c){if(Object.keys(this.#n).some(f=>f.length>1&&f!==he&&f!==me))throw $;if(s)return;c=this.#n[o]=new dr}c.insert(a,n,t,i,s)}buildRegExpStr(){let n=Object.keys(this.#n).sort(ui).map(t=>{let i=this.#n[t];return(typeof i.#e=="number"?`(${t})@${i.#e}`:ci.has(t)?`\\${t}`:t)+i.buildRegExpStr()});return typeof this.#r=="number"&&n.unshift(`#${this.#r}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}};var hn=class{#r={varIndex:0};#e=new dn;insert(e,r,n){let t=[],i=[];for(let o=0;;){let a=!1;if(e=e.replace(/\{[^}]+\}/g,l=>{let c=`@\\${o}`;return i[o]=[c,l],o++,a=!0,c}),!a)break}let s=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let o=i.length-1;o>=0;o--){let[a]=i[o];for(let l=s.length-1;l>=0;l--)if(s[l].indexOf(a)!==-1){s[l]=s[l].replace(a,i[o][1]);break}}return this.#e.insert(s,r,t,this.#r,n),t}buildRegExp(){let e=this.#e.buildRegExpStr();if(e==="")return[/^$/,[],[]];let r=0,n=[],t=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,o)=>s!==void 0?(n[++r]=Number(s),"$()"):(o!==void 0&&(t[Number(o)]=++r),"")),[new RegExp(`^${e}`),n,t]}};var fi=[/^$/,[],Object.create(null)],mn=Object.create(null);function gn(e){return mn[e]??=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(r,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function pi(){mn=Object.create(null)}function di(e){let r=new hn,n=[];if(e.length===0)return fi;let t=e.map(c=>[!/\*|\/:/.test(c[0]),...c]).sort(([c,f],[u,p])=>c?1:u?-1:f.length-p.length),i=Object.create(null);for(let c=0,f=-1,u=t.length;c<u;c++){let[p,d,m]=t[c];p?i[d]=[m.map(([x])=>[x,Object.create(null)]),Ne]:f++;let y;try{y=r.insert(d,f,p)}catch(x){throw x===$?new je(d):x}p||(n[f]=m.map(([x,v])=>{let g=Object.create(null);for(v-=1;v>=0;v--){let[le,Ze]=y[v];g[le]=Ze}return[x,g]}))}let[s,o,a]=r.buildRegExp();for(let c=0,f=n.length;c<f;c++)for(let u=0,p=n[c].length;u<p;u++){let d=n[c][u]?.[1];if(!d)continue;let m=Object.keys(d);for(let y=0,x=m.length;y<x;y++)d[m[y]]=a[d[m[y]]]}let l=[];for(let c in o)l[c]=n[o[c]];return[s,l,i]}function V(e,r){if(e){for(let n of Object.keys(e).sort((t,i)=>i.length-t.length))if(gn(n).test(r))return[...e[n]]}}var De=class{name="RegExpRouter";#r;#e;constructor(){this.#r={[A]:Object.create(null)},this.#e={[A]:Object.create(null)}}add(e,r,n){let t=this.#r,i=this.#e;if(!t||!i)throw new Error(Fe);t[e]||[t,i].forEach(a=>{a[e]=Object.create(null),Object.keys(a[A]).forEach(l=>{a[e][l]=[...a[A][l]]})}),r==="/*"&&(r="*");let s=(r.match(/\/:/g)||[]).length;if(/\*$/.test(r)){let a=gn(r);e===A?Object.keys(t).forEach(l=>{t[l][r]||=V(t[l],r)||V(t[A],r)||[]}):t[e][r]||=V(t[e],r)||V(t[A],r)||[],Object.keys(t).forEach(l=>{(e===A||e===l)&&Object.keys(t[l]).forEach(c=>{a.test(c)&&t[l][c].push([n,s])})}),Object.keys(i).forEach(l=>{(e===A||e===l)&&Object.keys(i[l]).forEach(c=>a.test(c)&&i[l][c].push([n,s]))});return}let o=_e(r)||[r];for(let a=0,l=o.length;a<l;a++){let c=o[a];Object.keys(i).forEach(f=>{(e===A||e===f)&&(i[f][c]||=[...V(t[f],c)||V(t[A],c)||[]],i[f][c].push([n,s-l+a+1]))})}}match=pr;buildAllMatchers(){let e=Object.create(null);return Object.keys(this.#e).concat(Object.keys(this.#r)).forEach(r=>{e[r]||=this.#n(r)}),this.#r=this.#e=void 0,pi(),e}#n(e){let r=[],n=e===A;return[this.#r,this.#e].forEach(t=>{let i=t[e]?Object.keys(t[e]).map(s=>[s,t[e][s]]):[];i.length!==0?(n||=!0,r.push(...i)):e!==A&&r.push(...Object.keys(t[A]).map(s=>[s,t[A][s]]))}),n?di(r):null}};var hr=class{name="SmartRouter";#r=[];#e=[];constructor(e){this.#r=e.routers}add(e,r,n){if(!this.#e)throw new Error(Fe);this.#e.push([e,r,n])}match(e,r){if(!this.#e)throw new Error("Fatal error");let n=this.#r,t=this.#e,i=n.length,s=0,o;for(;s<i;s++){let a=n[s];try{for(let l=0,c=t.length;l<c;l++)a.add(...t[l]);o=a.match(e,r)}catch(l){if(l instanceof je)continue;throw l}this.match=a.match.bind(a),this.#r=[a],this.#e=void 0;break}if(s===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,o}get activeRouter(){if(this.#e||this.#r.length!==1)throw new Error("No active router has been determined yet.");return this.#r[0]}};var ge=Object.create(null),hi=e=>{for(let r in e)return!0;return!1},yn=class xn{#r;#e;#n;#o=0;#i=ge;constructor(r,n,t){if(this.#e=t||Object.create(null),this.#r=[],r&&n){let i=Object.create(null);i[r]={handler:n,possibleKeys:[],score:0},this.#r=[i]}this.#n=[]}insert(r,n,t){this.#o=++this.#o;let i=this,s=Jr(n),o=[];for(let a=0,l=s.length;a<l;a++){let c=s[a],f=s[a+1],u=Qr(c,f),p=Array.isArray(u)?u[0]:c;if(p in i.#e){i=i.#e[p],u&&o.push(u[1]);continue}i.#e[p]=new xn,u&&(i.#n.push(u),o.push(u[1])),i=i.#e[p]}return i.#r.push({[r]:{handler:t,possibleKeys:o.filter((a,l,c)=>c.indexOf(a)===l),score:this.#o}}),i}#t(r,n,t,i,s){for(let o=0,a=n.#r.length;o<a;o++){let l=n.#r[o],c=l[t]||l[A],f={};if(c!==void 0&&(c.params=Object.create(null),r.push(c),i!==ge||s&&s!==ge))for(let u=0,p=c.possibleKeys.length;u<p;u++){let d=c.possibleKeys[u],m=f[c.score];c.params[d]=s?.[d]&&!m?s[d]:i[d]??s?.[d],f[c.score]=!0}}}search(r,n){let t=[];this.#i=ge;let s=[this],o=ar(n),a=[],l=o.length,c=null;for(let f=0;f<l;f++){let u=o[f],p=f===l-1,d=[];for(let y=0,x=s.length;y<x;y++){let v=s[y],g=v.#e[u];g&&(g.#i=v.#i,p?(g.#e["*"]&&this.#t(t,g.#e["*"],r,v.#i),this.#t(t,g,r,v.#i)):d.push(g));for(let le=0,Ze=v.#n.length;le<Ze;le++){let Lr=v.#n[le],_=v.#i===ge?{}:{...v.#i};if(Lr==="*"){let q=v.#e["*"];q&&(this.#t(t,q,r,v.#i),q.#i=_,d.push(q));continue}let[_t,Dr,ce]=Lr;if(!u&&!(ce instanceof RegExp))continue;let P=v.#e[_t];if(ce instanceof RegExp){if(c===null){c=new Array(l);let ke=n[0]==="/"?1:0;for(let ue=0;ue<l;ue++)c[ue]=ke,ke+=o[ue].length+1}let q=n.substring(c[f]),Je=ce.exec(q);if(Je){if(_[Dr]=Je[0],this.#t(t,P,r,v.#i,_),hi(P.#e)){P.#i=_;let ke=Je[0].match(/\//)?.length??0;(a[ke]||=[]).push(P)}continue}}(ce===!0||ce.test(u))&&(_[Dr]=u,p?(this.#t(t,P,r,_,v.#i),P.#e["*"]&&this.#t(t,P.#e["*"],r,_,v.#i)):(P.#i=_,d.push(P)))}}let m=a.shift();s=m?d.concat(m):d}return t.length>1&&t.sort((f,u)=>f.score-u.score),[t.map(({handler:f,params:u})=>[f,u])]}};var mr=class{name="TrieRouter";#r;constructor(){this.#r=new yn}add(e,r,n){let t=_e(r);if(t){for(let i=0,s=t.length;i<s;i++)this.#r.insert(e,t[i],n);return}this.#r.insert(e,r,n)}match(e,r){return this.#r.search(e,r)}};var O=class extends fn{constructor(e={}){super(e),this.router=e.router??new hr({routers:[new De,new mr]})}};var vn=e=>{let n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...e},t=(s=>typeof s=="string"?s==="*"?()=>s:o=>s===o?o:null:typeof s=="function"?s:o=>s.includes(o)?o:null)(n.origin),i=(s=>typeof s=="function"?s:Array.isArray(s)?()=>s:()=>[])(n.allowMethods);return async function(o,a){function l(f,u){o.res.headers.set(f,u)}let c=await t(o.req.header("origin")||"",o);if(c&&l("Access-Control-Allow-Origin",c),n.credentials&&l("Access-Control-Allow-Credentials","true"),n.exposeHeaders?.length&&l("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),o.req.method==="OPTIONS"){n.origin!=="*"&&l("Vary","Origin"),n.maxAge!=null&&l("Access-Control-Max-Age",n.maxAge.toString());let f=await i(o.req.header("origin")||"",o);f.length&&l("Access-Control-Allow-Methods",f.join(","));let u=n.allowHeaders;if(!u?.length){let p=o.req.header("Access-Control-Request-Headers");p&&(u=p.split(/\s*,\s*/))}return u?.length&&(l("Access-Control-Allow-Headers",u.join(",")),o.res.headers.append("Vary","Access-Control-Request-Headers")),o.res.headers.delete("Content-Length"),o.res.headers.delete("Content-Type"),new Response(null,{headers:o.res.headers,status:204,statusText:"No Content"})}await a(),n.origin!=="*"&&o.header("Vary","Origin",{append:!0})}};function mi(){let{process:e,Deno:r}=globalThis;return!(typeof r?.noColor=="boolean"?r.noColor:e!==void 0?"NO_COLOR"in e?.env:!1)}async function An(){let{navigator:e}=globalThis,r="cloudflare:workers";return!(e!==void 0&&e.userAgent==="Cloudflare-Workers"?await(async()=>{try{return"NO_COLOR"in((await import(r)).env??{})}catch{return!1}})():!mi())}var gi=e=>{let[r,n]=[",","."];return e.map(i=>i.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r)).join(n)},yi=e=>{let r=Date.now()-e;return gi([r<1e3?r+"ms":Math.round(r/1e3)+"s"])},xi=async e=>{if(await An())switch(e/100|0){case 5:return`\x1B[31m${e}\x1B[0m`;case 4:return`\x1B[33m${e}\x1B[0m`;case 3:return`\x1B[36m${e}\x1B[0m`;case 2:return`\x1B[32m${e}\x1B[0m`}return`${e}`};async function bn(e,r,n,t,i=0,s){let o=r==="<--"?`${r} ${n} ${t}`:`${r} ${n} ${t} ${await xi(i)} ${s}`;e(o)}var wn=(e=console.log)=>async function(n,t){let{method:i,url:s}=n.req,o=s.slice(s.indexOf("/",8));await bn(e,"<--",i,o);let a=Date.now();await t(),await bn(e,"-->",i,o,n.res.status,yi(a))};import{existsSync as vi,readFileSync as Ai}from"node:fs";import{dirname as bi,resolve as Rn}from"node:path";import{fileURLToPath as wi}from"node:url";var Cn="apv.config.json",Z=null,En;function kn(e){En=e}function M(){if(Z)return Z;let e=process.env.APV_CONFIG,r=[En,e,Rn(process.cwd(),Cn),Rn(bi(wi(import.meta.url)),"..","..","..",Cn)].filter(Boolean);for(let n of r)if(vi(n))try{let t=Ai(n,"utf-8"),i=JSON.parse(t);return Z={cacheDir:i.cacheDir,customTaskDocs:i.customTaskDocs??{}},console.log(`Loaded config from ${n}`),Z}catch(t){console.warn(`Failed to parse ${n}:`,t)}return Z={customTaskDocs:{}},Z}function $e(e){let r=e.startsWith("/"),n=e.split("/").filter(s=>s!==""&&s!=="."),t=[];for(let s of n)s===".."?t.length>0&&t[t.length-1]!==".."?t.pop():r||t.push(s):t.push(s);let i=t.join("/");return r?`/${i}`:i}function Bn(e){return typeof e>"u"||e===null}function Ci(e){return typeof e=="object"&&e!==null}function Ei(e){return Array.isArray(e)?e:Bn(e)?[]:[e]}function ki(e,r){var n,t,i,s;if(r)for(s=Object.keys(r),n=0,t=s.length;n<t;n+=1)i=s[n],e[i]=r[i];return e}function Si(e,r){var n="",t;for(t=0;t<r;t+=1)n+=e;return n}function Ti(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Pi=Bn,Oi=Ci,Ii=Ei,_i=Si,Fi=Ti,ji=ki,w={isNothing:Pi,isObject:Oi,toArray:Ii,repeat:_i,isNegativeZero:Fi,extend:ji};function Un(e,r){var n="",t=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
3
3
 
4
4
  `+e.mark.snippet),t+" "+n):t}function xe(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=Un(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}xe.prototype=Object.create(Error.prototype);xe.prototype.constructor=xe;xe.prototype.toString=function(r){return this.name+": "+Un(this,r)};var E=xe;function gr(e,r,n,t,i){var s="",o="",a=Math.floor(i/2)-1;return t-r>a&&(s=" ... ",r=t-a+s.length),n-t>a&&(o=" ...",n=t+a-o.length),{str:s+e.slice(r,n).replace(/\t/g,"\u2192")+o,pos:t-r+s.length}}function yr(e,r){return w.repeat(" ",r-e.length)+e}function Ni(e,r){if(r=Object.create(r||null),!e.buffer)return null;r.maxLength||(r.maxLength=79),typeof r.indent!="number"&&(r.indent=1),typeof r.linesBefore!="number"&&(r.linesBefore=3),typeof r.linesAfter!="number"&&(r.linesAfter=2);for(var n=/\r?\n|\r|\0/g,t=[0],i=[],s,o=-1;s=n.exec(e.buffer);)i.push(s.index),t.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=t.length-2);o<0&&(o=t.length-1);var a="",l,c,f=Math.min(e.line+r.linesAfter,i.length).toString().length,u=r.maxLength-(r.indent+f+3);for(l=1;l<=r.linesBefore&&!(o-l<0);l++)c=gr(e.buffer,t[o-l],i[o-l],e.position-(t[o]-t[o-l]),u),a=w.repeat(" ",r.indent)+yr((e.line-l+1).toString(),f)+" | "+c.str+`
5
5
  `+a;for(c=gr(e.buffer,t[o],i[o],e.position,u),a+=w.repeat(" ",r.indent)+yr((e.line+1).toString(),f)+" | "+c.str+`
6
6
  `,a+=w.repeat("-",r.indent+f+3+c.pos)+`^
7
7
  `,l=1;l<=r.linesAfter&&!(o+l>=i.length);l++)c=gr(e.buffer,t[o+l],i[o+l],e.position-(t[o]-t[o+l]),u),a+=w.repeat(" ",r.indent)+yr((e.line+l+1).toString(),f)+" | "+c.str+`
8
- `;return a.replace(/\n$/,"")}var Li=Ni,Di=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],$i=["scalar","sequence","mapping"];function Mi(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(t){r[String(t)]=n})}),r}function Hi(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(Di.indexOf(n)===-1)throw new E('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Mi(r.styleAliases||null),$i.indexOf(this.kind)===-1)throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var R=Hi;function Sn(e,r){var n=[];return e[r].forEach(function(t){var i=n.length;n.forEach(function(s,o){s.tag===t.tag&&s.kind===t.kind&&s.multi===t.multi&&(i=o)}),n[i]=t}),n}function zi(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},r,n;function t(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(t);return e}function vr(e){return this.extend(e)}vr.prototype.extend=function(r){var n=[],t=[];if(r instanceof R)t.push(r);else if(Array.isArray(r))t=t.concat(r);else if(r&&(Array.isArray(r.implicit)||Array.isArray(r.explicit)))r.implicit&&(n=n.concat(r.implicit)),r.explicit&&(t=t.concat(r.explicit));else throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof R))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),t.forEach(function(s){if(!(s instanceof R))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(vr.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(t),i.compiledImplicit=Sn(i,"implicit"),i.compiledExplicit=Sn(i,"explicit"),i.compiledTypeMap=zi(i.compiledImplicit,i.compiledExplicit),i};var Bi=vr,Ui=new R("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),qi=new R("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Wi=new R("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Gi=new Bi({explicit:[Ui,qi,Wi]});function Ki(e){if(e===null)return!0;var r=e.length;return r===1&&e==="~"||r===4&&(e==="null"||e==="Null"||e==="NULL")}function Yi(){return null}function Vi(e){return e===null}var Zi=new R("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ki,construct:Yi,predicate:Vi,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ji(e){if(e===null)return!1;var r=e.length;return r===4&&(e==="true"||e==="True"||e==="TRUE")||r===5&&(e==="false"||e==="False"||e==="FALSE")}function Qi(e){return e==="true"||e==="True"||e==="TRUE"}function Xi(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var eo=new R("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ji,construct:Qi,predicate:Xi,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function ro(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function no(e){return 48<=e&&e<=55}function to(e){return 48<=e&&e<=57}function io(e){if(e===null)return!1;var r=e.length,n=0,t=!1,i;if(!r)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===r)return!0;if(i=e[++n],i==="b"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;t=!0}return t&&i!=="_"}if(i==="x"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!ro(e.charCodeAt(n)))return!1;t=!0}return t&&i!=="_"}if(i==="o"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!no(e.charCodeAt(n)))return!1;t=!0}return t&&i!=="_"}}if(i==="_")return!1;for(;n<r;n++)if(i=e[n],i!=="_"){if(!to(e.charCodeAt(n)))return!1;t=!0}return!(!t||i==="_")}function oo(e){var r=e,n=1,t;if(r.indexOf("_")!==-1&&(r=r.replace(/_/g,"")),t=r[0],(t==="-"||t==="+")&&(t==="-"&&(n=-1),r=r.slice(1),t=r[0]),r==="0")return 0;if(t==="0"){if(r[1]==="b")return n*parseInt(r.slice(2),2);if(r[1]==="x")return n*parseInt(r.slice(2),16);if(r[1]==="o")return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)}function so(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!w.isNegativeZero(e)}var ao=new R("tag:yaml.org,2002:int",{kind:"scalar",resolve:io,construct:oo,predicate:so,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),lo=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function co(e){return!(e===null||!lo.test(e)||e[e.length-1]==="_")}function uo(e){var r,n;return r=e.replace(/_/g,"").toLowerCase(),n=r[0]==="-"?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),r===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:r===".nan"?NaN:n*parseFloat(r,10)}var fo=/^[-+]?[0-9]+e/;function po(e,r){var n;if(isNaN(e))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(w.isNegativeZero(e))return"-0.0";return n=e.toString(10),fo.test(n)?n.replace("e",".e"):n}function ho(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||w.isNegativeZero(e))}var mo=new R("tag:yaml.org,2002:float",{kind:"scalar",resolve:co,construct:uo,predicate:ho,represent:po,defaultStyle:"lowercase"}),go=Gi.extend({implicit:[Zi,eo,ao,mo]}),yo=go,qn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Wn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function xo(e){return e===null?!1:qn.exec(e)!==null||Wn.exec(e)!==null}function vo(e){var r,n,t,i,s,o,a,l=0,c=null,f,u,p;if(r=qn.exec(e),r===null&&(r=Wn.exec(e)),r===null)throw new Error("Date resolve error");if(n=+r[1],t=+r[2]-1,i=+r[3],!r[4])return new Date(Date.UTC(n,t,i));if(s=+r[4],o=+r[5],a=+r[6],r[7]){for(l=r[7].slice(0,3);l.length<3;)l+="0";l=+l}return r[9]&&(f=+r[10],u=+(r[11]||0),c=(f*60+u)*6e4,r[9]==="-"&&(c=-c)),p=new Date(Date.UTC(n,t,i,s,o,a,l)),c&&p.setTime(p.getTime()-c),p}function Ao(e){return e.toISOString()}var bo=new R("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:xo,construct:vo,instanceOf:Date,represent:Ao});function wo(e){return e==="<<"||e===null}var Ro=new R("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wo}),Cr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
- \r`;function Co(e){if(e===null)return!1;var r,n,t=0,i=e.length,s=Cr;for(n=0;n<i;n++)if(r=s.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;t+=6}return t%8===0}function Eo(e){var r,n,t=e.replace(/[\r\n=]/g,""),i=t.length,s=Cr,o=0,a=[];for(r=0;r<i;r++)r%4===0&&r&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(t.charAt(r));return n=i%4*6,n===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):n===18?(a.push(o>>10&255),a.push(o>>2&255)):n===12&&a.push(o>>4&255),new Uint8Array(a)}function ko(e){var r="",n=0,t,i,s=e.length,o=Cr;for(t=0;t<s;t++)t%3===0&&t&&(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]),n=(n<<8)+e[t];return i=s%3,i===0?(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]):i===2?(r+=o[n>>10&63],r+=o[n>>4&63],r+=o[n<<2&63],r+=o[64]):i===1&&(r+=o[n>>2&63],r+=o[n<<4&63],r+=o[64],r+=o[64]),r}function So(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var To=new R("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Co,construct:Eo,predicate:So,represent:ko}),Po=Object.prototype.hasOwnProperty,Oo=Object.prototype.toString;function Io(e){if(e===null)return!0;var r=[],n,t,i,s,o,a=e;for(n=0,t=a.length;n<t;n+=1){if(i=a[n],o=!1,Oo.call(i)!=="[object Object]")return!1;for(s in i)if(Po.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(r.indexOf(s)===-1)r.push(s);else return!1}return!0}function _o(e){return e!==null?e:[]}var Fo=new R("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Io,construct:_o}),jo=Object.prototype.toString;function No(e){if(e===null)return!0;var r,n,t,i,s,o=e;for(s=new Array(o.length),r=0,n=o.length;r<n;r+=1){if(t=o[r],jo.call(t)!=="[object Object]"||(i=Object.keys(t),i.length!==1))return!1;s[r]=[i[0],t[i[0]]]}return!0}function Lo(e){if(e===null)return[];var r,n,t,i,s,o=e;for(s=new Array(o.length),r=0,n=o.length;r<n;r+=1)t=o[r],i=Object.keys(t),s[r]=[i[0],t[i[0]]];return s}var Do=new R("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:No,construct:Lo}),$o=Object.prototype.hasOwnProperty;function Mo(e){if(e===null)return!0;var r,n=e;for(r in n)if($o.call(n,r)&&n[r]!==null)return!1;return!0}function Ho(e){return e!==null?e:{}}var zo=new R("tag:yaml.org,2002:set",{kind:"mapping",resolve:Mo,construct:Ho}),Gn=yo.extend({implicit:[bo,Ro],explicit:[To,Fo,Do,zo]}),j=Object.prototype.hasOwnProperty,Me=1,Kn=2,Yn=3,He=4,xr=1,Bo=2,Tn=3,Uo=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,qo=/[\x85\u2028\u2029]/,Wo=/[,\[\]\{\}]/,Vn=/^(?:!|!!|![a-z\-]+!)$/i,Zn=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Pn(e){return Object.prototype.toString.call(e)}function T(e){return e===10||e===13}function z(e){return e===9||e===32}function k(e){return e===9||e===32||e===10||e===13}function Q(e){return e===44||e===91||e===93||e===123||e===125}function Go(e){var r;return 48<=e&&e<=57?e-48:(r=e|32,97<=r&&r<=102?r-97+10:-1)}function Ko(e){return e===120?2:e===117?4:e===85?8:0}function Yo(e){return 48<=e&&e<=57?e-48:-1}function On(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
10
- `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Vo(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Jn(e,r,n){r==="__proto__"?Object.defineProperty(e,r,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[r]=n}var Qn=new Array(256),Xn=new Array(256);for(H=0;H<256;H++)Qn[H]=On(H)?1:0,Xn[H]=On(H);var H;function Zo(e,r){this.input=e,this.filename=r.filename||null,this.schema=r.schema||Gn,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function et(e,r){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Li(n),new E(r,n)}function h(e,r){throw et(e,r)}function ze(e,r){e.onWarning&&e.onWarning.call(null,et(e,r))}var In={YAML:function(r,n,t){var i,s,o;r.version!==null&&h(r,"duplication of %YAML directive"),t.length!==1&&h(r,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(t[0]),i===null&&h(r,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&h(r,"unacceptable YAML version of the document"),r.version=t[0],r.checkLineBreaks=o<2,o!==1&&o!==2&&ze(r,"unsupported YAML version of the document")},TAG:function(r,n,t){var i,s;t.length!==2&&h(r,"TAG directive accepts exactly two arguments"),i=t[0],s=t[1],Vn.test(i)||h(r,"ill-formed tag handle (first argument) of the TAG directive"),j.call(r.tagMap,i)&&h(r,'there is a previously declared suffix for "'+i+'" tag handle'),Zn.test(s)||h(r,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{h(r,"tag prefix is malformed: "+s)}r.tagMap[i]=s}};function F(e,r,n,t){var i,s,o,a;if(r<n){if(a=e.input.slice(r,n),t)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||h(e,"expected valid JSON character");else Uo.test(a)&&h(e,"the stream contains non-printable characters");e.result+=a}}function _n(e,r,n,t){var i,s,o,a;for(w.isObject(n)||h(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,a=i.length;o<a;o+=1)s=i[o],j.call(r,s)||(Jn(r,s,n[s]),t[s]=!0)}function X(e,r,n,t,i,s,o,a,l){var c,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,f=i.length;c<f;c+=1)Array.isArray(i[c])&&h(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Pn(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&Pn(i)==="[object Object]"&&(i="[object Object]"),i=String(i),r===null&&(r={}),t==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,f=s.length;c<f;c+=1)_n(e,r,s[c],n);else _n(e,r,s,n);else!e.json&&!j.call(n,i)&&j.call(r,i)&&(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,h(e,"duplicated mapping key")),Jn(r,i,s),delete n[i];return r}function Er(e){var r;r=e.input.charCodeAt(e.position),r===10?e.position++:r===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):h(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function b(e,r,n){for(var t=0,i=e.input.charCodeAt(e.position);i!==0;){for(;z(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(r&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(T(i))for(Er(e),i=e.input.charCodeAt(e.position),t++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&t!==0&&e.lineIndent<n&&ze(e,"deficient indentation"),t}function qe(e){var r=e.position,n;return n=e.input.charCodeAt(r),!!((n===45||n===46)&&n===e.input.charCodeAt(r+1)&&n===e.input.charCodeAt(r+2)&&(r+=3,n=e.input.charCodeAt(r),n===0||k(n)))}function kr(e,r){r===1?e.result+=" ":r>1&&(e.result+=w.repeat(`
11
- `,r-1))}function Jo(e,r,n){var t,i,s,o,a,l,c,f,u=e.kind,p=e.result,d;if(d=e.input.charCodeAt(e.position),k(d)||Q(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96||(d===63||d===45)&&(i=e.input.charCodeAt(e.position+1),k(i)||n&&Q(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,a=!1;d!==0;){if(d===58){if(i=e.input.charCodeAt(e.position+1),k(i)||n&&Q(i))break}else if(d===35){if(t=e.input.charCodeAt(e.position-1),k(t))break}else{if(e.position===e.lineStart&&qe(e)||n&&Q(d))break;if(T(d))if(l=e.line,c=e.lineStart,f=e.lineIndent,b(e,!1,-1),e.lineIndent>=r){a=!0,d=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=l,e.lineStart=c,e.lineIndent=f;break}}a&&(F(e,s,o,!1),kr(e,e.line-l),s=o=e.position,a=!1),z(d)||(o=e.position+1),d=e.input.charCodeAt(++e.position)}return F(e,s,o,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function Qo(e,r){var n,t,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,t=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(F(e,t,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)t=e.position,e.position++,i=e.position;else return!0;else T(n)?(F(e,t,i,!0),kr(e,b(e,!1,r)),t=i=e.position):e.position===e.lineStart&&qe(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function Xo(e,r){var n,t,i,s,o,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=t=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return F(e,n,e.position,!0),e.position++,!0;if(a===92){if(F(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),T(a))b(e,!1,r);else if(a<256&&Qn[a])e.result+=Xn[a],e.position++;else if((o=Ko(a))>0){for(i=o,s=0;i>0;i--)a=e.input.charCodeAt(++e.position),(o=Go(a))>=0?s=(s<<4)+o:h(e,"expected hexadecimal character");e.result+=Vo(s),e.position++}else h(e,"unknown escape sequence");n=t=e.position}else T(a)?(F(e,n,t,!0),kr(e,b(e,!1,r)),n=t=e.position):e.position===e.lineStart&&qe(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,t=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function es(e,r){var n=!0,t,i,s,o=e.tag,a,l=e.anchor,c,f,u,p,d,m=Object.create(null),y,x,v,g;if(g=e.input.charCodeAt(e.position),g===91)f=93,d=!1,a=[];else if(g===123)f=125,d=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),g=e.input.charCodeAt(++e.position);g!==0;){if(b(e,!0,r),g=e.input.charCodeAt(e.position),g===f)return e.position++,e.tag=o,e.anchor=l,e.kind=d?"mapping":"sequence",e.result=a,!0;n?g===44&&h(e,"expected the node content, but found ','"):h(e,"missed comma between flow collection entries"),x=y=v=null,u=p=!1,g===63&&(c=e.input.charCodeAt(e.position+1),k(c)&&(u=p=!0,e.position++,b(e,!0,r))),t=e.line,i=e.lineStart,s=e.position,ee(e,r,Me,!1,!0),x=e.tag,y=e.result,b(e,!0,r),g=e.input.charCodeAt(e.position),(p||e.line===t)&&g===58&&(u=!0,g=e.input.charCodeAt(++e.position),b(e,!0,r),ee(e,r,Me,!1,!0),v=e.result),d?X(e,a,m,x,y,v,t,i,s):u?a.push(X(e,null,m,x,y,v,t,i,s)):a.push(y),b(e,!0,r),g=e.input.charCodeAt(e.position),g===44?(n=!0,g=e.input.charCodeAt(++e.position)):n=!1}h(e,"unexpected end of the stream within a flow collection")}function rs(e,r){var n,t,i=xr,s=!1,o=!1,a=r,l=0,c=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)t=!1;else if(u===62)t=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)xr===i?i=u===43?Tn:Bo:h(e,"repeat of a chomping mode identifier");else if((f=Yo(u))>=0)f===0?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?h(e,"repeat of an indentation width identifier"):(a=r+f-1,o=!0);else break;if(z(u)){do u=e.input.charCodeAt(++e.position);while(z(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!T(u)&&u!==0)}for(;u!==0;){for(Er(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!o||e.lineIndent<a)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>a&&(a=e.lineIndent),T(u)){l++;continue}if(e.lineIndent<a){i===Tn?e.result+=w.repeat(`
8
+ `;return a.replace(/\n$/,"")}var Li=Ni,Di=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],$i=["scalar","sequence","mapping"];function Mi(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(t){r[String(t)]=n})}),r}function zi(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(Di.indexOf(n)===-1)throw new E('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Mi(r.styleAliases||null),$i.indexOf(this.kind)===-1)throw new E('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var R=zi;function Sn(e,r){var n=[];return e[r].forEach(function(t){var i=n.length;n.forEach(function(s,o){s.tag===t.tag&&s.kind===t.kind&&s.multi===t.multi&&(i=o)}),n[i]=t}),n}function Hi(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},r,n;function t(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(t);return e}function vr(e){return this.extend(e)}vr.prototype.extend=function(r){var n=[],t=[];if(r instanceof R)t.push(r);else if(Array.isArray(r))t=t.concat(r);else if(r&&(Array.isArray(r.implicit)||Array.isArray(r.explicit)))r.implicit&&(n=n.concat(r.implicit)),r.explicit&&(t=t.concat(r.explicit));else throw new E("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof R))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new E("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new E("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),t.forEach(function(s){if(!(s instanceof R))throw new E("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(vr.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(t),i.compiledImplicit=Sn(i,"implicit"),i.compiledExplicit=Sn(i,"explicit"),i.compiledTypeMap=Hi(i.compiledImplicit,i.compiledExplicit),i};var Bi=vr,Ui=new R("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),qi=new R("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Wi=new R("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Gi=new Bi({explicit:[Ui,qi,Wi]});function Ki(e){if(e===null)return!0;var r=e.length;return r===1&&e==="~"||r===4&&(e==="null"||e==="Null"||e==="NULL")}function Yi(){return null}function Vi(e){return e===null}var Zi=new R("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ki,construct:Yi,predicate:Vi,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ji(e){if(e===null)return!1;var r=e.length;return r===4&&(e==="true"||e==="True"||e==="TRUE")||r===5&&(e==="false"||e==="False"||e==="FALSE")}function Qi(e){return e==="true"||e==="True"||e==="TRUE"}function Xi(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var eo=new R("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ji,construct:Qi,predicate:Xi,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function ro(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function no(e){return 48<=e&&e<=55}function to(e){return 48<=e&&e<=57}function io(e){if(e===null)return!1;var r=e.length,n=0,t=!1,i;if(!r)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===r)return!0;if(i=e[++n],i==="b"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;t=!0}return t&&i!=="_"}if(i==="x"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!ro(e.charCodeAt(n)))return!1;t=!0}return t&&i!=="_"}if(i==="o"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!no(e.charCodeAt(n)))return!1;t=!0}return t&&i!=="_"}}if(i==="_")return!1;for(;n<r;n++)if(i=e[n],i!=="_"){if(!to(e.charCodeAt(n)))return!1;t=!0}return!(!t||i==="_")}function oo(e){var r=e,n=1,t;if(r.indexOf("_")!==-1&&(r=r.replace(/_/g,"")),t=r[0],(t==="-"||t==="+")&&(t==="-"&&(n=-1),r=r.slice(1),t=r[0]),r==="0")return 0;if(t==="0"){if(r[1]==="b")return n*parseInt(r.slice(2),2);if(r[1]==="x")return n*parseInt(r.slice(2),16);if(r[1]==="o")return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)}function so(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!w.isNegativeZero(e)}var ao=new R("tag:yaml.org,2002:int",{kind:"scalar",resolve:io,construct:oo,predicate:so,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),lo=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function co(e){return!(e===null||!lo.test(e)||e[e.length-1]==="_")}function uo(e){var r,n;return r=e.replace(/_/g,"").toLowerCase(),n=r[0]==="-"?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),r===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:r===".nan"?NaN:n*parseFloat(r,10)}var fo=/^[-+]?[0-9]+e/;function po(e,r){var n;if(isNaN(e))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(w.isNegativeZero(e))return"-0.0";return n=e.toString(10),fo.test(n)?n.replace("e",".e"):n}function ho(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||w.isNegativeZero(e))}var mo=new R("tag:yaml.org,2002:float",{kind:"scalar",resolve:co,construct:uo,predicate:ho,represent:po,defaultStyle:"lowercase"}),go=Gi.extend({implicit:[Zi,eo,ao,mo]}),yo=go,qn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Wn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function xo(e){return e===null?!1:qn.exec(e)!==null||Wn.exec(e)!==null}function vo(e){var r,n,t,i,s,o,a,l=0,c=null,f,u,p;if(r=qn.exec(e),r===null&&(r=Wn.exec(e)),r===null)throw new Error("Date resolve error");if(n=+r[1],t=+r[2]-1,i=+r[3],!r[4])return new Date(Date.UTC(n,t,i));if(s=+r[4],o=+r[5],a=+r[6],r[7]){for(l=r[7].slice(0,3);l.length<3;)l+="0";l=+l}return r[9]&&(f=+r[10],u=+(r[11]||0),c=(f*60+u)*6e4,r[9]==="-"&&(c=-c)),p=new Date(Date.UTC(n,t,i,s,o,a,l)),c&&p.setTime(p.getTime()-c),p}function Ao(e){return e.toISOString()}var bo=new R("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:xo,construct:vo,instanceOf:Date,represent:Ao});function wo(e){return e==="<<"||e===null}var Ro=new R("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wo}),Cr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
+ \r`;function Co(e){if(e===null)return!1;var r,n,t=0,i=e.length,s=Cr;for(n=0;n<i;n++)if(r=s.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;t+=6}return t%8===0}function Eo(e){var r,n,t=e.replace(/[\r\n=]/g,""),i=t.length,s=Cr,o=0,a=[];for(r=0;r<i;r++)r%4===0&&r&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(t.charAt(r));return n=i%4*6,n===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):n===18?(a.push(o>>10&255),a.push(o>>2&255)):n===12&&a.push(o>>4&255),new Uint8Array(a)}function ko(e){var r="",n=0,t,i,s=e.length,o=Cr;for(t=0;t<s;t++)t%3===0&&t&&(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]),n=(n<<8)+e[t];return i=s%3,i===0?(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]):i===2?(r+=o[n>>10&63],r+=o[n>>4&63],r+=o[n<<2&63],r+=o[64]):i===1&&(r+=o[n>>2&63],r+=o[n<<4&63],r+=o[64],r+=o[64]),r}function So(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var To=new R("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Co,construct:Eo,predicate:So,represent:ko}),Po=Object.prototype.hasOwnProperty,Oo=Object.prototype.toString;function Io(e){if(e===null)return!0;var r=[],n,t,i,s,o,a=e;for(n=0,t=a.length;n<t;n+=1){if(i=a[n],o=!1,Oo.call(i)!=="[object Object]")return!1;for(s in i)if(Po.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(r.indexOf(s)===-1)r.push(s);else return!1}return!0}function _o(e){return e!==null?e:[]}var Fo=new R("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Io,construct:_o}),jo=Object.prototype.toString;function No(e){if(e===null)return!0;var r,n,t,i,s,o=e;for(s=new Array(o.length),r=0,n=o.length;r<n;r+=1){if(t=o[r],jo.call(t)!=="[object Object]"||(i=Object.keys(t),i.length!==1))return!1;s[r]=[i[0],t[i[0]]]}return!0}function Lo(e){if(e===null)return[];var r,n,t,i,s,o=e;for(s=new Array(o.length),r=0,n=o.length;r<n;r+=1)t=o[r],i=Object.keys(t),s[r]=[i[0],t[i[0]]];return s}var Do=new R("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:No,construct:Lo}),$o=Object.prototype.hasOwnProperty;function Mo(e){if(e===null)return!0;var r,n=e;for(r in n)if($o.call(n,r)&&n[r]!==null)return!1;return!0}function zo(e){return e!==null?e:{}}var Ho=new R("tag:yaml.org,2002:set",{kind:"mapping",resolve:Mo,construct:zo}),Gn=yo.extend({implicit:[bo,Ro],explicit:[To,Fo,Do,Ho]}),j=Object.prototype.hasOwnProperty,Me=1,Kn=2,Yn=3,ze=4,xr=1,Bo=2,Tn=3,Uo=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,qo=/[\x85\u2028\u2029]/,Wo=/[,\[\]\{\}]/,Vn=/^(?:!|!!|![a-z\-]+!)$/i,Zn=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Pn(e){return Object.prototype.toString.call(e)}function T(e){return e===10||e===13}function H(e){return e===9||e===32}function k(e){return e===9||e===32||e===10||e===13}function Q(e){return e===44||e===91||e===93||e===123||e===125}function Go(e){var r;return 48<=e&&e<=57?e-48:(r=e|32,97<=r&&r<=102?r-97+10:-1)}function Ko(e){return e===120?2:e===117?4:e===85?8:0}function Yo(e){return 48<=e&&e<=57?e-48:-1}function On(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
10
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Vo(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Jn(e,r,n){r==="__proto__"?Object.defineProperty(e,r,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[r]=n}var Qn=new Array(256),Xn=new Array(256);for(z=0;z<256;z++)Qn[z]=On(z)?1:0,Xn[z]=On(z);var z;function Zo(e,r){this.input=e,this.filename=r.filename||null,this.schema=r.schema||Gn,this.onWarning=r.onWarning||null,this.legacy=r.legacy||!1,this.json=r.json||!1,this.listener=r.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function et(e,r){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Li(n),new E(r,n)}function h(e,r){throw et(e,r)}function He(e,r){e.onWarning&&e.onWarning.call(null,et(e,r))}var In={YAML:function(r,n,t){var i,s,o;r.version!==null&&h(r,"duplication of %YAML directive"),t.length!==1&&h(r,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(t[0]),i===null&&h(r,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&h(r,"unacceptable YAML version of the document"),r.version=t[0],r.checkLineBreaks=o<2,o!==1&&o!==2&&He(r,"unsupported YAML version of the document")},TAG:function(r,n,t){var i,s;t.length!==2&&h(r,"TAG directive accepts exactly two arguments"),i=t[0],s=t[1],Vn.test(i)||h(r,"ill-formed tag handle (first argument) of the TAG directive"),j.call(r.tagMap,i)&&h(r,'there is a previously declared suffix for "'+i+'" tag handle'),Zn.test(s)||h(r,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{h(r,"tag prefix is malformed: "+s)}r.tagMap[i]=s}};function F(e,r,n,t){var i,s,o,a;if(r<n){if(a=e.input.slice(r,n),t)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||h(e,"expected valid JSON character");else Uo.test(a)&&h(e,"the stream contains non-printable characters");e.result+=a}}function _n(e,r,n,t){var i,s,o,a;for(w.isObject(n)||h(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,a=i.length;o<a;o+=1)s=i[o],j.call(r,s)||(Jn(r,s,n[s]),t[s]=!0)}function X(e,r,n,t,i,s,o,a,l){var c,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,f=i.length;c<f;c+=1)Array.isArray(i[c])&&h(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Pn(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&Pn(i)==="[object Object]"&&(i="[object Object]"),i=String(i),r===null&&(r={}),t==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,f=s.length;c<f;c+=1)_n(e,r,s[c],n);else _n(e,r,s,n);else!e.json&&!j.call(n,i)&&j.call(r,i)&&(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,h(e,"duplicated mapping key")),Jn(r,i,s),delete n[i];return r}function Er(e){var r;r=e.input.charCodeAt(e.position),r===10?e.position++:r===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):h(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function b(e,r,n){for(var t=0,i=e.input.charCodeAt(e.position);i!==0;){for(;H(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(r&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(T(i))for(Er(e),i=e.input.charCodeAt(e.position),t++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&t!==0&&e.lineIndent<n&&He(e,"deficient indentation"),t}function qe(e){var r=e.position,n;return n=e.input.charCodeAt(r),!!((n===45||n===46)&&n===e.input.charCodeAt(r+1)&&n===e.input.charCodeAt(r+2)&&(r+=3,n=e.input.charCodeAt(r),n===0||k(n)))}function kr(e,r){r===1?e.result+=" ":r>1&&(e.result+=w.repeat(`
11
+ `,r-1))}function Jo(e,r,n){var t,i,s,o,a,l,c,f,u=e.kind,p=e.result,d;if(d=e.input.charCodeAt(e.position),k(d)||Q(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96||(d===63||d===45)&&(i=e.input.charCodeAt(e.position+1),k(i)||n&&Q(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,a=!1;d!==0;){if(d===58){if(i=e.input.charCodeAt(e.position+1),k(i)||n&&Q(i))break}else if(d===35){if(t=e.input.charCodeAt(e.position-1),k(t))break}else{if(e.position===e.lineStart&&qe(e)||n&&Q(d))break;if(T(d))if(l=e.line,c=e.lineStart,f=e.lineIndent,b(e,!1,-1),e.lineIndent>=r){a=!0,d=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=l,e.lineStart=c,e.lineIndent=f;break}}a&&(F(e,s,o,!1),kr(e,e.line-l),s=o=e.position,a=!1),H(d)||(o=e.position+1),d=e.input.charCodeAt(++e.position)}return F(e,s,o,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function Qo(e,r){var n,t,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,t=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(F(e,t,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)t=e.position,e.position++,i=e.position;else return!0;else T(n)?(F(e,t,i,!0),kr(e,b(e,!1,r)),t=i=e.position):e.position===e.lineStart&&qe(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function Xo(e,r){var n,t,i,s,o,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=t=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return F(e,n,e.position,!0),e.position++,!0;if(a===92){if(F(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),T(a))b(e,!1,r);else if(a<256&&Qn[a])e.result+=Xn[a],e.position++;else if((o=Ko(a))>0){for(i=o,s=0;i>0;i--)a=e.input.charCodeAt(++e.position),(o=Go(a))>=0?s=(s<<4)+o:h(e,"expected hexadecimal character");e.result+=Vo(s),e.position++}else h(e,"unknown escape sequence");n=t=e.position}else T(a)?(F(e,n,t,!0),kr(e,b(e,!1,r)),n=t=e.position):e.position===e.lineStart&&qe(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,t=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function es(e,r){var n=!0,t,i,s,o=e.tag,a,l=e.anchor,c,f,u,p,d,m=Object.create(null),y,x,v,g;if(g=e.input.charCodeAt(e.position),g===91)f=93,d=!1,a=[];else if(g===123)f=125,d=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),g=e.input.charCodeAt(++e.position);g!==0;){if(b(e,!0,r),g=e.input.charCodeAt(e.position),g===f)return e.position++,e.tag=o,e.anchor=l,e.kind=d?"mapping":"sequence",e.result=a,!0;n?g===44&&h(e,"expected the node content, but found ','"):h(e,"missed comma between flow collection entries"),x=y=v=null,u=p=!1,g===63&&(c=e.input.charCodeAt(e.position+1),k(c)&&(u=p=!0,e.position++,b(e,!0,r))),t=e.line,i=e.lineStart,s=e.position,ee(e,r,Me,!1,!0),x=e.tag,y=e.result,b(e,!0,r),g=e.input.charCodeAt(e.position),(p||e.line===t)&&g===58&&(u=!0,g=e.input.charCodeAt(++e.position),b(e,!0,r),ee(e,r,Me,!1,!0),v=e.result),d?X(e,a,m,x,y,v,t,i,s):u?a.push(X(e,null,m,x,y,v,t,i,s)):a.push(y),b(e,!0,r),g=e.input.charCodeAt(e.position),g===44?(n=!0,g=e.input.charCodeAt(++e.position)):n=!1}h(e,"unexpected end of the stream within a flow collection")}function rs(e,r){var n,t,i=xr,s=!1,o=!1,a=r,l=0,c=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)t=!1;else if(u===62)t=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)xr===i?i=u===43?Tn:Bo:h(e,"repeat of a chomping mode identifier");else if((f=Yo(u))>=0)f===0?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?h(e,"repeat of an indentation width identifier"):(a=r+f-1,o=!0);else break;if(H(u)){do u=e.input.charCodeAt(++e.position);while(H(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!T(u)&&u!==0)}for(;u!==0;){for(Er(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!o||e.lineIndent<a)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>a&&(a=e.lineIndent),T(u)){l++;continue}if(e.lineIndent<a){i===Tn?e.result+=w.repeat(`
12
12
  `,s?1+l:l):i===xr&&s&&(e.result+=`
13
- `);break}for(t?z(u)?(c=!0,e.result+=w.repeat(`
13
+ `);break}for(t?H(u)?(c=!0,e.result+=w.repeat(`
14
14
  `,s?1+l:l)):c?(c=!1,e.result+=w.repeat(`
15
15
  `,l+1)):l===0?s&&(e.result+=" "):e.result+=w.repeat(`
16
16
  `,l):e.result+=w.repeat(`
17
- `,s?1+l:l),s=!0,o=!0,l=0,n=e.position;!T(u)&&u!==0;)u=e.input.charCodeAt(++e.position);F(e,n,e.position,!1)}return!0}function Fn(e,r){var n,t=e.tag,i=e.anchor,s=[],o,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),!(l!==45||(o=e.input.charCodeAt(e.position+1),!k(o))));){if(a=!0,e.position++,b(e,!0,-1)&&e.lineIndent<=r){s.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,ee(e,r,Yn,!1,!0),s.push(e.result),b(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>r)&&l!==0)h(e,"bad indentation of a sequence entry");else if(e.lineIndent<r)break}return a?(e.tag=t,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function ns(e,r,n){var t,i,s,o,a,l,c=e.tag,f=e.anchor,u={},p=Object.create(null),d=null,m=null,y=null,x=!1,v=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),g=e.input.charCodeAt(e.position);g!==0;){if(!x&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),t=e.input.charCodeAt(e.position+1),s=e.line,(g===63||g===58)&&k(t))g===63?(x&&(X(e,u,p,d,m,null,o,a,l),d=m=y=null),v=!0,x=!0,i=!0):x?(x=!1,i=!0):h(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=t;else{if(o=e.line,a=e.lineStart,l=e.position,!ee(e,n,Kn,!1,!0))break;if(e.line===s){for(g=e.input.charCodeAt(e.position);z(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),k(g)||h(e,"a whitespace character is expected after the key-value separator within a block mapping"),x&&(X(e,u,p,d,m,null,o,a,l),d=m=y=null),v=!0,x=!1,i=!1,d=e.tag,m=e.result;else if(v)h(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=f,!0}else if(v)h(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=f,!0}if((e.line===s||e.lineIndent>r)&&(x&&(o=e.line,a=e.lineStart,l=e.position),ee(e,r,He,!0,i)&&(x?m=e.result:y=e.result),x||(X(e,u,p,d,m,y,o,a,l),d=m=y=null),b(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>r)&&g!==0)h(e,"bad indentation of a mapping entry");else if(e.lineIndent<r)break}return x&&X(e,u,p,d,m,null,o,a,l),v&&(e.tag=c,e.anchor=f,e.kind="mapping",e.result=u),v}function ts(e){var r,n=!1,t=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&h(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(t=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",r=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(r,e.position),o=e.input.charCodeAt(++e.position)):h(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!k(o);)o===33&&(t?h(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(r-1,e.position+1),Vn.test(i)||h(e,"named tag handle cannot contain such characters"),t=!0,r=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(r,e.position),Wo.test(s)&&h(e,"tag suffix cannot contain flow indicator characters")}s&&!Zn.test(s)&&h(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{h(e,"tag name is malformed: "+s)}return n?e.tag=s:j.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:h(e,'undeclared tag handle "'+i+'"'),!0}function is(e){var r,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&h(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),r=e.position;n!==0&&!k(n)&&!Q(n);)n=e.input.charCodeAt(++e.position);return e.position===r&&h(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(r,e.position),!0}function os(e){var r,n,t;if(t=e.input.charCodeAt(e.position),t!==42)return!1;for(t=e.input.charCodeAt(++e.position),r=e.position;t!==0&&!k(t)&&!Q(t);)t=e.input.charCodeAt(++e.position);return e.position===r&&h(e,"name of an alias node must contain at least one character"),n=e.input.slice(r,e.position),j.call(e.anchorMap,n)||h(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],b(e,!0,-1),!0}function ee(e,r,n,t,i){var s,o,a,l=1,c=!1,f=!1,u,p,d,m,y,x;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=a=He===n||Yn===n,t&&b(e,!0,-1)&&(c=!0,e.lineIndent>r?l=1:e.lineIndent===r?l=0:e.lineIndent<r&&(l=-1)),l===1)for(;ts(e)||is(e);)b(e,!0,-1)?(c=!0,a=s,e.lineIndent>r?l=1:e.lineIndent===r?l=0:e.lineIndent<r&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||He===n)&&(Me===n||Kn===n?y=r:y=r+1,x=e.position-e.lineStart,l===1?a&&(Fn(e,x)||ns(e,x,y))||es(e,y)?f=!0:(o&&rs(e,y)||Qo(e,y)||Xo(e,y)?f=!0:os(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&h(e,"alias node should not have any properties")):Jo(e,y,Me===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(f=a&&Fn(e,x))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&h(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(m=e.implicitTypes[u],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(j.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,d=e.typeMap.multi[e.kind||"fallback"],u=0,p=d.length;u<p;u+=1)if(e.tag.slice(0,d[u].tag.length)===d[u].tag){m=d[u];break}m||h(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&h(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):h(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function ss(e){var r=e.position,n,t,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(b(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!k(o);)o=e.input.charCodeAt(++e.position);for(t=e.input.slice(n,e.position),i=[],t.length<1&&h(e,"directive name must not be less than one character in length");o!==0;){for(;z(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!T(o));break}if(T(o))break;for(n=e.position;o!==0&&!k(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&Er(e),j.call(In,t)?In[t](e,t,i):ze(e,'unknown document directive "'+t+'"')}if(b(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,b(e,!0,-1)):s&&h(e,"directives end mark is expected"),ee(e,e.lineIndent-1,He,!1,!0),b(e,!0,-1),e.checkLineBreaks&&qo.test(e.input.slice(r,e.position))&&ze(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&qe(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,b(e,!0,-1));return}if(e.position<e.length-1)h(e,"end of the stream or a document separator is expected");else return}function rt(e,r){e=String(e),r=r||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
17
+ `,s?1+l:l),s=!0,o=!0,l=0,n=e.position;!T(u)&&u!==0;)u=e.input.charCodeAt(++e.position);F(e,n,e.position,!1)}return!0}function Fn(e,r){var n,t=e.tag,i=e.anchor,s=[],o,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),!(l!==45||(o=e.input.charCodeAt(e.position+1),!k(o))));){if(a=!0,e.position++,b(e,!0,-1)&&e.lineIndent<=r){s.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,ee(e,r,Yn,!1,!0),s.push(e.result),b(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>r)&&l!==0)h(e,"bad indentation of a sequence entry");else if(e.lineIndent<r)break}return a?(e.tag=t,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function ns(e,r,n){var t,i,s,o,a,l,c=e.tag,f=e.anchor,u={},p=Object.create(null),d=null,m=null,y=null,x=!1,v=!1,g;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),g=e.input.charCodeAt(e.position);g!==0;){if(!x&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),t=e.input.charCodeAt(e.position+1),s=e.line,(g===63||g===58)&&k(t))g===63?(x&&(X(e,u,p,d,m,null,o,a,l),d=m=y=null),v=!0,x=!0,i=!0):x?(x=!1,i=!0):h(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,g=t;else{if(o=e.line,a=e.lineStart,l=e.position,!ee(e,n,Kn,!1,!0))break;if(e.line===s){for(g=e.input.charCodeAt(e.position);H(g);)g=e.input.charCodeAt(++e.position);if(g===58)g=e.input.charCodeAt(++e.position),k(g)||h(e,"a whitespace character is expected after the key-value separator within a block mapping"),x&&(X(e,u,p,d,m,null,o,a,l),d=m=y=null),v=!0,x=!1,i=!1,d=e.tag,m=e.result;else if(v)h(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=f,!0}else if(v)h(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=f,!0}if((e.line===s||e.lineIndent>r)&&(x&&(o=e.line,a=e.lineStart,l=e.position),ee(e,r,ze,!0,i)&&(x?m=e.result:y=e.result),x||(X(e,u,p,d,m,y,o,a,l),d=m=y=null),b(e,!0,-1),g=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>r)&&g!==0)h(e,"bad indentation of a mapping entry");else if(e.lineIndent<r)break}return x&&X(e,u,p,d,m,null,o,a,l),v&&(e.tag=c,e.anchor=f,e.kind="mapping",e.result=u),v}function ts(e){var r,n=!1,t=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&h(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(t=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",r=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(r,e.position),o=e.input.charCodeAt(++e.position)):h(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!k(o);)o===33&&(t?h(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(r-1,e.position+1),Vn.test(i)||h(e,"named tag handle cannot contain such characters"),t=!0,r=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(r,e.position),Wo.test(s)&&h(e,"tag suffix cannot contain flow indicator characters")}s&&!Zn.test(s)&&h(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{h(e,"tag name is malformed: "+s)}return n?e.tag=s:j.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:h(e,'undeclared tag handle "'+i+'"'),!0}function is(e){var r,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&h(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),r=e.position;n!==0&&!k(n)&&!Q(n);)n=e.input.charCodeAt(++e.position);return e.position===r&&h(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(r,e.position),!0}function os(e){var r,n,t;if(t=e.input.charCodeAt(e.position),t!==42)return!1;for(t=e.input.charCodeAt(++e.position),r=e.position;t!==0&&!k(t)&&!Q(t);)t=e.input.charCodeAt(++e.position);return e.position===r&&h(e,"name of an alias node must contain at least one character"),n=e.input.slice(r,e.position),j.call(e.anchorMap,n)||h(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],b(e,!0,-1),!0}function ee(e,r,n,t,i){var s,o,a,l=1,c=!1,f=!1,u,p,d,m,y,x;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=a=ze===n||Yn===n,t&&b(e,!0,-1)&&(c=!0,e.lineIndent>r?l=1:e.lineIndent===r?l=0:e.lineIndent<r&&(l=-1)),l===1)for(;ts(e)||is(e);)b(e,!0,-1)?(c=!0,a=s,e.lineIndent>r?l=1:e.lineIndent===r?l=0:e.lineIndent<r&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||ze===n)&&(Me===n||Kn===n?y=r:y=r+1,x=e.position-e.lineStart,l===1?a&&(Fn(e,x)||ns(e,x,y))||es(e,y)?f=!0:(o&&rs(e,y)||Qo(e,y)||Xo(e,y)?f=!0:os(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&h(e,"alias node should not have any properties")):Jo(e,y,Me===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(f=a&&Fn(e,x))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&h(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(m=e.implicitTypes[u],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(j.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,d=e.typeMap.multi[e.kind||"fallback"],u=0,p=d.length;u<p;u+=1)if(e.tag.slice(0,d[u].tag.length)===d[u].tag){m=d[u];break}m||h(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&h(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):h(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function ss(e){var r=e.position,n,t,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(b(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!k(o);)o=e.input.charCodeAt(++e.position);for(t=e.input.slice(n,e.position),i=[],t.length<1&&h(e,"directive name must not be less than one character in length");o!==0;){for(;H(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!T(o));break}if(T(o))break;for(n=e.position;o!==0&&!k(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&Er(e),j.call(In,t)?In[t](e,t,i):He(e,'unknown document directive "'+t+'"')}if(b(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,b(e,!0,-1)):s&&h(e,"directives end mark is expected"),ee(e,e.lineIndent-1,ze,!1,!0),b(e,!0,-1),e.checkLineBreaks&&qo.test(e.input.slice(r,e.position))&&He(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&qe(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,b(e,!0,-1));return}if(e.position<e.length-1)h(e,"end of the stream or a document separator is expected");else return}function rt(e,r){e=String(e),r=r||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
18
18
  `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Zo(e,r),t=e.indexOf("\0");for(t!==-1&&(n.position=t,h(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)ss(n);return n.documents}function as(e,r,n){r!==null&&typeof r=="object"&&typeof n>"u"&&(n=r,r=null);var t=rt(e,n);if(typeof r!="function")return t;for(var i=0,s=t.length;i<s;i+=1)r(t[i])}function ls(e,r){var n=rt(e,r);if(n.length!==0){if(n.length===1)return n[0];throw new E("expected a single document in the stream, but found more")}}var cs=as,us=ls,nt={loadAll:cs,load:us},tt=Object.prototype.toString,it=Object.prototype.hasOwnProperty,Sr=65279,fs=9,ve=10,ps=13,ds=32,hs=33,ms=34,Ar=35,gs=37,ys=38,xs=39,vs=42,ot=44,As=45,Be=58,bs=61,ws=62,Rs=63,Cs=64,st=91,at=93,Es=96,lt=123,ks=124,ct=125,C={};C[0]="\\0";C[7]="\\a";C[8]="\\b";C[9]="\\t";C[10]="\\n";C[11]="\\v";C[12]="\\f";C[13]="\\r";C[27]="\\e";C[34]='\\"';C[92]="\\\\";C[133]="\\N";C[160]="\\_";C[8232]="\\L";C[8233]="\\P";var Ss=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Ts=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ps(e,r){var n,t,i,s,o,a,l;if(r===null)return{};for(n={},t=Object.keys(r),i=0,s=t.length;i<s;i+=1)o=t[i],a=String(r[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=e.compiledTypeMap.fallback[o],l&&it.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[o]=a;return n}function Os(e){var r,n,t;if(r=e.toString(16).toUpperCase(),e<=255)n="x",t=2;else if(e<=65535)n="u",t=4;else if(e<=4294967295)n="U",t=8;else throw new E("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+w.repeat("0",t-r.length)+r}var Is=1,Ae=2;function _s(e){this.schema=e.schema||Gn,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=w.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Ps(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Ae:Is,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function jn(e,r){for(var n=w.repeat(" ",r),t=0,i=-1,s="",o,a=e.length;t<a;)i=e.indexOf(`
19
19
  `,t),i===-1?(o=e.slice(t),t=a):(o=e.slice(t,i+1),t=i+1),o.length&&o!==`
20
20
  `&&(s+=n),s+=o;return s}function br(e,r){return`
@@ -29,7 +29,7 @@ import{existsSync as Pt,readFileSync as Ot}from"node:fs";import{extname as Ia,jo
29
29
  `:"")+Mn(l,r),i=s}return t}function Mn(e,r){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,t,i=0,s,o=0,a=0,l="";t=n.exec(e);)a=t.index,a-i>r&&(s=o>i?o:a,l+=`
30
30
  `+e.slice(i,s),i=s+1),o=a;return l+=`
31
31
  `,e.length-i>r&&o>i?l+=e.slice(i,o)+`
32
- `+e.slice(o+1):l+=e.slice(i),l.slice(1)}function Ms(e){for(var r="",n=0,t,i=0;i<e.length;n>=65536?i+=2:i++)n=ye(e,i),t=C[n],!t&&be(n)?(r+=e[i],n>=65536&&(r+=e[i+1])):r+=t||Os(n);return r}function Hs(e,r,n){var t="",i=e.tag,s,o,a;for(s=0,o=n.length;s<o;s+=1)a=n[s],e.replacer&&(a=e.replacer.call(n,String(s),a)),(I(e,r,a,!1,!1)||typeof a>"u"&&I(e,r,null,!1,!1))&&(t!==""&&(t+=","+(e.condenseFlow?"":" ")),t+=e.dump);e.tag=i,e.dump="["+t+"]"}function Hn(e,r,n,t){var i="",s=e.tag,o,a,l;for(o=0,a=n.length;o<a;o+=1)l=n[o],e.replacer&&(l=e.replacer.call(n,String(o),l)),(I(e,r+1,l,!0,!0,!1,!0)||typeof l>"u"&&I(e,r+1,null,!0,!0,!1,!0))&&((!t||i!=="")&&(i+=br(e,r)),e.dump&&ve===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function zs(e,r,n){var t="",i=e.tag,s=Object.keys(n),o,a,l,c,f;for(o=0,a=s.length;o<a;o+=1)f="",t!==""&&(f+=", "),e.condenseFlow&&(f+='"'),l=s[o],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),I(e,r,l,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),I(e,r,c,!1,!1)&&(f+=e.dump,t+=f));e.tag=i,e.dump="{"+t+"}"}function Bs(e,r,n,t){var i="",s=e.tag,o=Object.keys(n),a,l,c,f,u,p;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new E("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)p="",(!t||i!=="")&&(p+=br(e,r)),c=o[a],f=n[c],e.replacer&&(f=e.replacer.call(n,c,f)),I(e,r+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&ve===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=br(e,r)),I(e,r+1,f,!0,u)&&(e.dump&&ve===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=s,e.dump=i||"{}"}function zn(e,r,n){var t,i,s,o,a,l;for(i=n?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof r=="object"&&r instanceof a.instanceOf)&&(!a.predicate||a.predicate(r))){if(n?a.multi&&a.representName?e.tag=a.representName(r):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,tt.call(a.represent)==="[object Function]")t=a.represent(r,l);else if(it.call(a.represent,l))t=a.represent[l](r,l);else throw new E("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=t}return!0}return!1}function I(e,r,n,t,i,s,o){e.tag=null,e.dump=n,zn(e,n,!1)||zn(e,n,!0);var a=tt.call(e.dump),l=t,c;t&&(t=e.flowLevel<0||e.flowLevel>r);var f=a==="[object Object]"||a==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&r>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),a==="[object Object]")t&&Object.keys(e.dump).length!==0?(Bs(e,r,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(zs(e,r,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(a==="[object Array]")t&&e.dump.length!==0?(e.noArrayIndent&&!o&&r>0?Hn(e,r-1,e.dump,i):Hn(e,r,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Hs(e,r,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&Ds(e,e.dump,r,s,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new E("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function Us(e,r){var n=[],t=[],i,s;for(Rr(e,n,t),i=0,s=t.length;i<s;i+=1)r.duplicates.push(n[t[i]]);r.usedDuplicates=new Array(s)}function Rr(e,r,n){var t,i,s;if(e!==null&&typeof e=="object")if(i=r.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)Rr(e[i],r,n);else for(t=Object.keys(e),i=0,s=t.length;i<s;i+=1)Rr(e[t[i]],r,n)}function qs(e,r){r=r||{};var n=new _s(r);n.noRefs||Us(e,n);var t=e;return n.replacer&&(t=n.replacer.call({"":t},"",t)),I(n,0,t,!0,!0)?n.dump+`
32
+ `+e.slice(o+1):l+=e.slice(i),l.slice(1)}function Ms(e){for(var r="",n=0,t,i=0;i<e.length;n>=65536?i+=2:i++)n=ye(e,i),t=C[n],!t&&be(n)?(r+=e[i],n>=65536&&(r+=e[i+1])):r+=t||Os(n);return r}function zs(e,r,n){var t="",i=e.tag,s,o,a;for(s=0,o=n.length;s<o;s+=1)a=n[s],e.replacer&&(a=e.replacer.call(n,String(s),a)),(I(e,r,a,!1,!1)||typeof a>"u"&&I(e,r,null,!1,!1))&&(t!==""&&(t+=","+(e.condenseFlow?"":" ")),t+=e.dump);e.tag=i,e.dump="["+t+"]"}function zn(e,r,n,t){var i="",s=e.tag,o,a,l;for(o=0,a=n.length;o<a;o+=1)l=n[o],e.replacer&&(l=e.replacer.call(n,String(o),l)),(I(e,r+1,l,!0,!0,!1,!0)||typeof l>"u"&&I(e,r+1,null,!0,!0,!1,!0))&&((!t||i!=="")&&(i+=br(e,r)),e.dump&&ve===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function Hs(e,r,n){var t="",i=e.tag,s=Object.keys(n),o,a,l,c,f;for(o=0,a=s.length;o<a;o+=1)f="",t!==""&&(f+=", "),e.condenseFlow&&(f+='"'),l=s[o],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),I(e,r,l,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),I(e,r,c,!1,!1)&&(f+=e.dump,t+=f));e.tag=i,e.dump="{"+t+"}"}function Bs(e,r,n,t){var i="",s=e.tag,o=Object.keys(n),a,l,c,f,u,p;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new E("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)p="",(!t||i!=="")&&(p+=br(e,r)),c=o[a],f=n[c],e.replacer&&(f=e.replacer.call(n,c,f)),I(e,r+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&ve===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=br(e,r)),I(e,r+1,f,!0,u)&&(e.dump&&ve===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=s,e.dump=i||"{}"}function Hn(e,r,n){var t,i,s,o,a,l;for(i=n?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof r=="object"&&r instanceof a.instanceOf)&&(!a.predicate||a.predicate(r))){if(n?a.multi&&a.representName?e.tag=a.representName(r):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,tt.call(a.represent)==="[object Function]")t=a.represent(r,l);else if(it.call(a.represent,l))t=a.represent[l](r,l);else throw new E("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=t}return!0}return!1}function I(e,r,n,t,i,s,o){e.tag=null,e.dump=n,Hn(e,n,!1)||Hn(e,n,!0);var a=tt.call(e.dump),l=t,c;t&&(t=e.flowLevel<0||e.flowLevel>r);var f=a==="[object Object]"||a==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&r>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),a==="[object Object]")t&&Object.keys(e.dump).length!==0?(Bs(e,r,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Hs(e,r,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(a==="[object Array]")t&&e.dump.length!==0?(e.noArrayIndent&&!o&&r>0?zn(e,r-1,e.dump,i):zn(e,r,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(zs(e,r,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&Ds(e,e.dump,r,s,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new E("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function Us(e,r){var n=[],t=[],i,s;for(Rr(e,n,t),i=0,s=t.length;i<s;i+=1)r.duplicates.push(n[t[i]]);r.usedDuplicates=new Array(s)}function Rr(e,r,n){var t,i,s;if(e!==null&&typeof e=="object")if(i=r.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)Rr(e[i],r,n);else for(t=Object.keys(e),i=0,s=t.length;i<s;i+=1)Rr(e[t[i]],r,n)}function qs(e,r){r=r||{};var n=new _s(r);n.noRefs||Us(e,n);var t=e;return n.replacer&&(t=n.replacer.call({"":t},"",t)),I(n,0,t,!0,!0)?n.dump+`
33
33
  `:""}var Ws=qs,Gs={dump:Ws};function Tr(e,r){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var Pc=nt.load,Oc=nt.loadAll,Ic=Gs.dump;var _c=Tr("safeLoad","load"),Fc=Tr("safeLoadAll","loadAll"),jc=Tr("safeDump","dump");import{DefaultAzureCredential as Qs}from"@azure/identity";var Xs="499b84ac-1321-427f-aa17-267ca6975798/.default",Pr=null;function ea(){return Pr||(Pr=new Qs),Pr}async function re(){return(await ea().getToken(Xs)).token}var we=class{store=new Map;inflight=new Map;ttlMs;maxSize;constructor(r,n=1e3){this.ttlMs=r*1e3,this.maxSize=n}get(r){let n=this.store.get(r);if(n){if(Date.now()>n.expiresAt){this.store.delete(r);return}return n.value}}set(r,n){if(this.store.size>=this.maxSize&&!this.store.has(r)){let t=this.store.keys().next().value;t!==void 0&&this.store.delete(t)}this.store.set(r,{value:n,expiresAt:Date.now()+this.ttlMs})}async getOrFetch(r,n){let t=this.get(r);if(t!==void 0)return t;let i=this.inflight.get(r);if(i)return i;let s=n().then(o=>(this.set(r,o),this.inflight.delete(r),o),o=>{throw this.inflight.delete(r),o});return this.inflight.set(r,s),s}get size(){return this.store.size}clear(){this.store.clear(),this.inflight.clear()}};var ne="7.1",ra=new we(600),na=new we(120),ta=/^[0-9a-f]{7,40}$/i;async function te(e){let r=await re(),n=await fetch(e,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}});if(!n.ok){let t=await n.text();throw new Error(`Azure DevOps API error (${n.status}): ${t}`)}return n}function ie(e,r){return`https://dev.azure.com/${encodeURIComponent(e)}/${encodeURIComponent(r)}/_apis`}function B(e){return e.startsWith("refs/")||ta.test(e)?e:`refs/heads/${e}`}function oe(e){let r=B(e);return r.startsWith("refs/heads/")?{version:r.slice(11),versionType:"branch"}:r.startsWith("refs/tags/")?{version:r.slice(10),versionType:"tag"}:{version:r,versionType:"commit"}}async function We(e,r,n,t){let i=B(t),s=oe(i);if(s.versionType==="commit")return s.version;let o=`${e}/${r}/${n}/${i}`.toLowerCase();return na.getOrFetch(o,async()=>{let a=i.replace(/^refs\//,""),l=`${ie(e,r)}/git/repositories/${encodeURIComponent(n)}/refs?filter=${encodeURIComponent(a)}&api-version=${ne}`,u=(await(await te(l)).json()).value?.find(p=>p.name===i);if(!u?.objectId)throw new Error(`Git ref not found: ${i}`);return u.objectId})}async function mt(e,r){let n=`${ie(e,r)}/pipelines?api-version=${ne}`;return(await(await te(n)).json()).value}async function Or(e,r,n){let t=`${ie(e,r)}/build/definitions/${n}?api-version=${ne}`,s=await(await te(t)).json();return{id:s.id,name:s.name,path:s.process?.yamlFilename??s.path,repository:{id:s.repository?.id,name:s.repository?.name,type:s.repository?.type,defaultBranch:s.repository?.defaultBranch}}}async function gt(e,r){let n=`${ie(e,r)}/git/repositories?api-version=${ne}`;return(await(await te(n)).json()).value}async function Ge(e,r,n){let t=`${e}/${r}/${n}`.toLowerCase();return ra.getOrFetch(t,async()=>{let i=`${ie(e,r)}/git/repositories/${encodeURIComponent(n)}?api-version=${ne}`;return(await te(i)).json()})}async function yt(e,r,n,t,i){let s=t.startsWith("/")?t:`/${t}`,o=$e(s),a=`${ie(e,r)}/git/repositories/${encodeURIComponent(n)}/items?scopePath=${encodeURIComponent(o)}&api-version=${ne}&$format=text`;if(i){let c=oe(i);a+=`&versionDescriptor.version=${encodeURIComponent(c.version)}&versionDescriptor.versionType=${c.versionType}`}return(await te(a)).text()}import{createHash as ia}from"node:crypto";import{existsSync as xt}from"node:fs";import{mkdir as oa,readFile as vt,writeFile as At}from"node:fs/promises";import{homedir as sa}from"node:os";import{resolve as se}from"node:path";function aa(e){if(e)return se(e);let r=M().cacheDir;return r?se(r):se(sa(),".apv","cache","ado-file-cache")}function la(e){return ia("sha256").update(JSON.stringify(e)).digest("hex")}function ca(e,r){let n=se(e,r.slice(0,2),r.slice(2,4),r);return{dir:n,metadataPath:se(n,"metadata.json"),contentPath:se(n,"content.txt")}}async function ua(e){if(!xt(e.metadataPath)||!xt(e.contentPath))return null;let[r,n]=await Promise.all([vt(e.metadataPath,"utf-8"),vt(e.contentPath,"utf-8")]);return{metadata:JSON.parse(r),content:n}}async function fa(e,r,n){await oa(e.dir,{recursive:!0}),await Promise.all([At(e.metadataPath,JSON.stringify(r,null,2),"utf-8"),At(e.contentPath,n,"utf-8")])}async function Re(e){let r=$e(e.path.startsWith("/")?e.path:`/${e.path}`),n=B(e.ref),t=oe(n).versionType,i=aa(e.cacheRoot),s=e.resolveCommitShaFn??We,o=e.fetchFileContentFn??yt,a=await s(e.org,e.project,e.repoId,n),l={org:e.org,project:e.project,repoId:e.repoId,repoName:e.repoName,path:r,requestedRef:e.ref,normalizedRef:n,refType:t,commitSha:a},c=la(l),f=ca(i,c),u=await ua(f);if(u)return{content:u.content,path:r,repoId:e.repoId,repoName:e.repoName,requestedRef:u.metadata.requestedRef,normalizedRef:u.metadata.normalizedRef,refType:u.metadata.refType,commitSha:u.metadata.commitSha,cache:"hit"};let p=await o(e.org,e.project,e.repoId,r,a),d={...l,fetchedAt:new Date().toISOString()};return await fa(f,d,p),{content:p,path:r,repoId:e.repoId,repoName:e.repoName,requestedRef:e.ref,normalizedRef:n,refType:t,commitSha:a,cache:"miss"}}import{existsSync as Ve}from"node:fs";import{mkdir as pa,readdir as da,readFile as wt,writeFile as Ir}from"node:fs/promises";import{homedir as ha}from"node:os";import{join as U,normalize as bt,resolve as Ye}from"node:path";var ma="7.1";async function ga(e,r,n,t){let i=await re(),s=oe(t),o=`https://dev.azure.com/${encodeURIComponent(e)}/${encodeURIComponent(r)}/_apis/git/repositories/${encodeURIComponent(n)}/items?scopePath=/&download=true&$format=zip&versionDescriptor.version=${encodeURIComponent(s.version)}&versionDescriptor.versionType=${s.versionType}&api-version=${ma}`,a=await fetch(o,{headers:{Authorization:`Bearer ${i}`}});if(!a.ok){let l=await a.text();throw new Error(`Failed to download repo ZIP (${a.status}): ${l}`)}return Buffer.from(await a.arrayBuffer())}function ya(e){if(e)return Ye(e);let r=M().cacheDir;return r?Ye(r,"ado-zip-cache"):Ye(ha(),".apv","cache","ado-zip-cache")}function Rt(e,r,n,t,i){return Ye(e,r.toLowerCase(),n.toLowerCase(),t.toLowerCase(),i.toLowerCase())}function xa(e,r,n,t,i){let s=Rt(e,r,n,t,i);return Ve(U(s,".zip-cache-complete"))}async function va(e,r){await pa(r,{recursive:!0});let n=U(r,"__repo.zip");if(await Ir(n,e),await Bun.spawn(["tar","-xf",n,"-C",r],{stdout:"pipe",stderr:"pipe"}).exited!==0)if(process.platform==="win32"){let o=Bun.spawn(["powershell","-NoProfile","-Command",`Expand-Archive -Path '${n}' -DestinationPath '${r}' -Force`],{stdout:"pipe",stderr:"pipe"});if(await o.exited!==0){let l=await new Response(o.stderr).text();throw new Error(`Failed to extract ZIP: ${l}`)}}else{let o=Bun.spawn(["unzip","-o",n,"-d",r],{stdout:"pipe",stderr:"pipe"});if(await o.exited!==0){let l=await new Response(o.stderr).text();throw new Error(`Failed to extract ZIP: ${l}`)}}await Ir(U(r,".zip-cache-complete"),"","utf-8")}async function Ct(e){let r=await da(e,{withFileTypes:!0}),n=r.filter(i=>i.isDirectory()&&i.name!=="__MACOSX"&&!i.name.startsWith(".")),t=r.filter(i=>i.isFile()&&i.name!=="__repo.zip"&&i.name!==".zip-cache-complete");return n.length===1&&t.length===0?U(e,n[0].name):e}async function Aa(e){let r=U(e,".zip-cache-root");if(Ve(r)){let n=(await wt(r,"utf-8")).trim();if(n&&Ve(n))return n}return Ct(e)}var Ke=new Map;async function _r(e){let r=B(e.ref),n=`${e.org}/${e.project}/${e.repoId}/${r}`.toLowerCase(),t=Ke.get(n);if(t)return t;let i=ba(e).then(s=>(Ke.delete(n),s),s=>{throw Ke.delete(n),s});return Ke.set(n,i),i}async function ba(e){let r=ya(e.cacheRoot),n=B(e.ref),t=e.resolveCommitShaFn??We,i=e.downloadZipFn??ga,s=await t(e.org,e.project,e.repoId,n),o=Rt(r,e.org,e.project,e.repoId,s);if(xa(r,e.org,e.project,e.repoId,s))return{repoDir:await Aa(o),commitSha:s,cache:"hit"};let a=await i(e.org,e.project,e.repoId,n);await(e.extractZipFn??va)(a,o);let c=await Ct(o);return await Ir(U(o,".zip-cache-root"),c,"utf-8"),{repoDir:c,commitSha:s,cache:"miss"}}async function Fr(e){let{repoDir:r,commitSha:n,cache:t}=await _r(e),i=e.path.replace(/\\/g,"/").replace(/^\/+/,""),s=bt(U(r,i)),o=bt(r);if(!s.startsWith(o))throw new Error(`Path traversal attempt: ${e.path}`);if(!Ve(s))throw new Error(`File not found in cached repo: ${i}`);return{content:await wt(s,"utf-8"),cache:t,commitSha:n}}var ae=new O;ae.get("/:org/:project/repos",async e=>{let{org:r,project:n}=e.req.param(),t=await gt(r,n);return e.json(t)});ae.get("/:org/:project/repos/:repoId/file",async e=>{let{org:r,project:n,repoId:t}=e.req.param(),i=e.req.query("path"),s=e.req.query("branch");if(!i)return e.json({error:"path query parameter is required"},400);let o=await Ge(r,n,t),a=s||o.defaultBranch;try{let c=await Fr({org:r,project:n,repoId:o.id,path:i,ref:a});return e.json({content:c.content,path:i,repoId:o.id,repoName:o.name,branch:a,commitSha:c.commitSha,cache:`zip-${c.cache}`})}catch{}let l=await Re({org:r,project:n,repoId:o.id,repoName:o.name,path:i,ref:a});return e.json({content:l.content,path:l.path,repoId:l.repoId,repoName:l.repoName,branch:l.requestedRef,commitSha:l.commitSha,cache:l.cache})});ae.get("/:org/:project/file-by-repo-name",async e=>{let{org:r,project:n}=e.req.param(),t=e.req.query("repo"),i=e.req.query("path"),s=e.req.query("branch");if(!t||!i)return e.json({error:"repo and path query parameters are required"},400);let o=await Ge(r,n,t);if(!o)return e.json({error:`Repository not found: ${t}`},404);let a=s||o.defaultBranch;try{let c=await Fr({org:r,project:n,repoId:o.id,path:i,ref:a});return e.json({content:c.content,path:i,repoId:o.id,repoName:o.name,branch:a,commitSha:c.commitSha,cache:`zip-${c.cache}`})}catch{}let l=await Re({org:r,project:n,repoId:o.id,repoName:o.name,path:i,ref:a});return e.json({content:l.content,path:l.path,repoId:l.repoId,repoName:l.repoName,branch:l.requestedRef,commitSha:l.commitSha,cache:l.cache})});ae.post("/:org/:project/repos/:repoId/cache",async e=>{let{org:r,project:n,repoId:t}=e.req.param(),i=e.req.query("branch"),s=await Ge(r,n,t),o=i||s.defaultBranch,a=await _r({org:r,project:n,repoId:s.id,ref:o});return e.json({repoId:s.id,repoName:s.name,branch:o,commitSha:a.commitSha,cache:a.cache})});var Ce=new O;Ce.get("/:org/:project/pipelines",async e=>{let{org:r,project:n}=e.req.param(),t=await mt(r,n);return e.json(t)});Ce.get("/:org/:project/pipelines/:id",async e=>{let{org:r,project:n,id:t}=e.req.param(),i=await Or(r,n,Number(t));return e.json(i)});Ce.get("/:org/:project/pipelines/:id/yaml",async e=>{let{org:r,project:n,id:t}=e.req.param(),i=await Or(r,n,Number(t)),s=await Re({org:r,project:n,repoId:i.repository.id,repoName:i.repository.name,path:i.path,ref:i.repository.defaultBranch});return e.json({definition:i,yaml:s.content,branch:s.requestedRef,commitSha:s.commitSha,cache:s.cache})});import{existsSync as kt,mkdirSync as wa,readFileSync as Ra,statSync as Ca,writeFileSync as Ea}from"node:fs";import{dirname as St,resolve as Et}from"node:path";import{fileURLToPath as ka}from"node:url";var jr=new O,Sa=1440*60*1e3;function Tt(e){let r=Et(St(ka(import.meta.url)),"..","..","..","..");return Et(r,".cache",`task-schema-${e.toLowerCase()}.json`)}function Ta(e){let r=Tt(e);if(!kt(r))return null;try{let n=Ca(r);return Date.now()-n.mtimeMs>Sa?null:JSON.parse(Ra(r,"utf-8"))}catch{return null}}function Pa(e,r){let n=Tt(e),t=St(n);kt(t)||wa(t,{recursive:!0}),Ea(n,JSON.stringify(r,null,2))}function Oa(e){let r=e.definitions;if(!r)return[];let i=r.task?.properties?.task?.anyOf;if(!i)return[];let s=[];for(let o of i){let a=o.enum;if(!a?.length)continue;let l=a[0],c=typeof o.description=="string"?o.description:"",f=l.lastIndexOf("@"),u,p;f>0?(u=l.slice(0,f),p=parseInt(l.slice(f+1),10),Number.isNaN(p)&&(p=0)):(u=l,p=0),s.push({name:u,description:c,version:p,inputs:[]})}return s}jr.get("/:org/schema/tasks",async e=>{let{org:r}=e.req.param(),n=Ta(r);if(n)return e.json({tasks:n,cached:!0});let t=await re(),i=`https://dev.azure.com/${encodeURIComponent(r)}/_apis/distributedtask/yamlschema?api-version=7.1`,s=await fetch(i,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(!s.ok){let l=await s.text();return e.json({error:`Failed to fetch schema: ${s.status} ${l}`},s.status)}let o=await s.json(),a=Oa(o);return Pa(r,a),console.log(`Cached ${a.length} task definitions for org "${r}"`),e.json({tasks:a,cached:!1})});var{values:Ee}=Fa({options:{config:{type:"string",short:"c"},port:{type:"string",short:"p"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},strict:!0,allowPositionals:!1});Ee.help&&(console.log(`
34
34
  Azure Pipelines Visualizer
35
35
 
@@ -40,7 +40,7 @@ Options:
40
40
  -p, --port <number> Port to listen on (default: 3001)
41
41
  -h, --help Show this help message
42
42
  -v, --version Show version number
43
- `.trim()),process.exit(0));Ee.version&&(console.log("0.2.1"),process.exit(0));var ja=_a(new URL(".",import.meta.url)),It=Nr(ja,"web"),Na={".html":"text/html; charset=utf-8",".js":"application/javascript",".css":"text/css",".ttf":"font/ttf",".woff":"font/woff",".woff2":"font/woff2",".svg":"image/svg+xml",".png":"image/png",".json":"application/json"};function La(e){let r=Ia(e);return Na[r]??"application/octet-stream"}Ee.config&&kn(Ee.config);M();var S=new O;S.use("/*",wn());S.use("/*",vn({origin:"*"}));S.get("/health",e=>e.json({status:"ok"}));S.get("/api/config/task-docs",e=>{let r=M();return e.json({customTaskDocs:r.customTaskDocs??{}})});S.route("/api",Ce);S.route("/api",ae);S.route("/api",jr);S.all("/api/*",e=>e.json({error:`Not found: ${e.req.path}`},404));S.onError((e,r)=>{if(console.error("Server error:",e.message),e.message.includes("DefaultAzureCredential")||e.message.includes("authentication"))return r.json({error:"Authentication failed. Ensure you are logged in via `az login`.",details:e.message},401);let n=e.message.match(/API error \((\d+)\)/);if(n){let t=Number(n[1]);return r.json({error:e.message},t)}return r.json({error:e.message},500)});S.get("/assets/*",e=>{let r=e.req.path,n=Nr(It,r);if(!Pt(n))return e.notFound();let t=Ot(n);return e.body(t,200,{"Content-Type":La(r),"Cache-Control":"public, immutable, max-age=31536000"})});S.get("*",e=>{let r=Nr(It,"index.html");if(!Pt(r))return e.notFound();let n=Ot(r,"utf-8");return e.html(n)});var Da=Number(Ee.port)||Number(process.env.PORT)||3001;Yr({fetch:S.fetch,port:Da},e=>{console.log(`APV server listening on http://localhost:${e.port}`)});export{S as app};
43
+ `.trim()),process.exit(0));Ee.version&&(console.log("0.2.2"),process.exit(0));var ja=_a(new URL(".",import.meta.url)),It=Nr(ja,"web"),Na={".html":"text/html; charset=utf-8",".js":"application/javascript",".css":"text/css",".ttf":"font/ttf",".woff":"font/woff",".woff2":"font/woff2",".svg":"image/svg+xml",".png":"image/png",".json":"application/json"};function La(e){let r=Ia(e);return Na[r]??"application/octet-stream"}Ee.config&&kn(Ee.config);M();var S=new O;S.use("/*",wn());S.use("/*",vn({origin:"*"}));S.get("/health",e=>e.json({status:"ok"}));S.get("/api/config/task-docs",e=>{let r=M();return e.json({customTaskDocs:r.customTaskDocs??{}})});S.route("/api",Ce);S.route("/api",ae);S.route("/api",jr);S.all("/api/*",e=>e.json({error:`Not found: ${e.req.path}`},404));S.onError((e,r)=>{if(console.error("Server error:",e.message),e.message.includes("DefaultAzureCredential")||e.message.includes("authentication"))return r.json({error:"Authentication failed. Ensure you are logged in via `az login`.",details:e.message},401);let n=e.message.match(/API error \((\d+)\)/);if(n){let t=Number(n[1]);return r.json({error:e.message},t)}return r.json({error:e.message},500)});S.get("/assets/*",e=>{let r=e.req.path,n=Nr(It,r);if(!Pt(n))return e.notFound();let t=Ot(n);return e.body(t,200,{"Content-Type":La(r),"Cache-Control":"public, immutable, max-age=31536000"})});S.get("*",e=>{let r=Nr(It,"index.html");if(!Pt(r))return e.notFound();let n=Ot(r,"utf-8");return e.html(n)});var Da=Number(Ee.port)||Number(process.env.PORT)||3001;Yr({fetch:S.fetch,port:Da},e=>{console.log(`APV server listening on http://localhost:${e.port}`)});export{S as app};
44
44
  /*! Bundled license information:
45
45
 
46
46
  js-yaml/dist/js-yaml.mjs:
@@ -1,6 +1,6 @@
1
1
  import { jsx as s, jsxs as c, Fragment as et } from "react/jsx-runtime";
2
2
  import { useMemo as ze, Component as pt, createContext as ut, useContext as mt, memo as tt, useState as Z, useCallback as fe, useRef as te, useEffect as oe, createElement as ht } from "react";
3
- import { parseYaml as pe, extractTaskReferences as ft, resolveTaskDocUrl as gt, extractVariableValues as Pe, detectTemplateReferences as Se, extractParameterDefaults as De, buildAdoFileUrl as at, getEffectiveRepoAlias as re, extractDeclaredParameterNames as je, pathHasExpressions as ue, resolveExpressionPath as Ee, resolveTemplateRefPaths as nt, evaluateExpression as _t, resolveTemplateSource as st, parseTemplatePath as vt, resolveAllExpressions as yt, collapsePath as Nt, parseAdoUrl as Pt } from "@apv/core";
3
+ import { parseYaml as pe, extractTaskReferences as ft, resolveTaskDocUrl as gt, extractVariableValues as Pe, detectTemplateReferences as Se, extractParameterDefaults as De, buildAdoFileUrl as at, getEffectiveRepoAlias as re, extractDeclaredParameterNames as je, pathHasExpressions as ue, resolveExpressionPath as Ee, resolveTemplateRefPaths as nt, evaluateExpression as _t, resolveTemplateSource as st, parseTemplatePath as vt, resolveAllExpressions as yt, collapsePath as Nt, parseAdoUrl as Pt } from "@meirblachman/azure-pipelines-visualizer-core";
4
4
  import bt from "@monaco-editor/react";
5
5
  import { create as wt } from "zustand";
6
6
  import { Handle as He, Position as Ke, getBezierPath as Rt, BaseEdge as Et, EdgeLabelRenderer as xt, MarkerType as xe, useNodesState as kt, useEdgesState as At, ReactFlow as Tt, Background as $t, BackgroundVariant as Ct, Controls as St } from "@xyflow/react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meirblachman/azure-pipelines-visualizer",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Visualize Azure Pipelines template trees as interactive diagrams",
5
5
  "type": "module",
6
6
  "bin": {