flujo-ai 3.16.0 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +36 -36
- package/.next/app-path-routes-manifest.json +7 -7
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +6 -6
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/api/backup/route.js +1 -1
- package/.next/server/app/api/backup/route.js.nft.json +1 -1
- package/.next/server/app/api/backup/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/browse/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/cwd/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/encryption/secure/route.js.nft.json +1 -1
- package/.next/server/app/api/encryption/secure/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/env/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/flow/[id]/route.js +1 -1
- package/.next/server/app/api/flow/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/flow/compile/route.js +1 -1
- package/.next/server/app/api/flow/compile/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/compile/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/flow/generate/route.js +4 -2
- package/.next/server/app/api/flow/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/generate/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/flow/prompt-renderer/route.js +2 -2
- package/.next/server/app/api/flow/prompt-renderer/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/prompt-renderer/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/flow/route.js +1 -1
- package/.next/server/app/api/flow/route.js.nft.json +1 -1
- package/.next/server/app/api/flow/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/init/route.js.nft.json +1 -1
- package/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/local-models/capability/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/local-models/pull/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/local-models/suggest/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/cancel/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/get/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/prompts/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/read/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/resources/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/status/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/[name]/tools/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/servers/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/servers/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/test-connection/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/test-connection/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp/test-connection/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/test-connection/stream/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp-registry/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/mcp-registry/spotlight/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/model/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/model/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/model/provider/route.js.nft.json +1 -1
- package/.next/server/app/api/model/provider/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/model/route.js.nft.json +1 -1
- package/.next/server/app/api/model/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/model/test/route.js.nft.json +1 -1
- package/.next/server/app/api/model/test/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/initiate/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/oauth/reset/route.js.nft.json +1 -1
- package/.next/server/app/api/oauth/reset/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/run/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/run/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/planned-executions/[id]/runs/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/[id]/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/planned-executions/preview-schedule/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/planned-executions/route.js.nft.json +1 -1
- package/.next/server/app/api/planned-executions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/restore/route.js +1 -1
- package/.next/server/app/api/restore/route.js.nft.json +1 -1
- package/.next/server/app/api/restore/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/storage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/webhooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/webhooks/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chat.html +1 -1
- package/.next/server/app/chat.rsc +1 -1
- package/.next/server/app/docs/page.js +2 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +2 -2
- package/.next/server/app/executions/page.js +1 -1
- package/.next/server/app/executions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/executions.html +1 -1
- package/.next/server/app/executions.rsc +1 -1
- package/.next/server/app/flows/page.js +2 -2
- package/.next/server/app/flows/page_client-reference-manifest.js +1 -1
- package/.next/server/app/flows.html +1 -1
- package/.next/server/app/flows.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/mcp/page_client-reference-manifest.js +1 -1
- package/.next/server/app/mcp-flows/route.js +2 -2
- package/.next/server/app/mcp-flows/route.js.nft.json +1 -1
- package/.next/server/app/mcp-flows/route_client-reference-manifest.js +1 -1
- package/.next/server/app/mcp-proxy/[server]/route.js +1 -1
- package/.next/server/app/mcp-proxy/[server]/route.js.nft.json +1 -1
- package/.next/server/app/mcp-proxy/[server]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/mcp.html +1 -1
- package/.next/server/app/mcp.rsc +1 -1
- package/.next/server/app/models/page.js +1 -1
- package/.next/server/app/models/page.js.nft.json +1 -1
- package/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +1 -1
- package/.next/server/app/v1/chat/completions/route.js +1 -2
- package/.next/server/app/v1/chat/completions/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js +2 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js +2 -2
- package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js +2 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js +2 -2
- package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/events/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/route.js +2 -2
- package/.next/server/app/v1/chat/conversations/[conversationId]/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/[conversationId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/chat/conversations/route.js +2 -2
- package/.next/server/app/v1/chat/conversations/route.js.nft.json +1 -1
- package/.next/server/app/v1/chat/conversations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/v1/models/route.js.nft.json +1 -1
- package/.next/server/app/v1/models/route_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +7 -7
- package/.next/server/chunks/1403.js +2 -2
- package/.next/server/chunks/1519.js +1 -0
- package/.next/server/chunks/1877.js +2 -1
- package/.next/server/chunks/2776.js +1 -1
- package/.next/server/chunks/2859.js +3 -3
- package/.next/server/chunks/3243.js +1 -1
- package/.next/server/chunks/{9688.js → 3309.js} +2 -2
- package/.next/server/chunks/3370.js +38 -0
- package/.next/server/chunks/3984.js +4 -4
- package/.next/server/chunks/{8367.js → 407.js} +6 -2
- package/.next/server/chunks/4681.js +1 -1
- package/.next/server/chunks/5504.js +1 -1
- package/.next/server/chunks/6936.js +4 -4
- package/.next/server/chunks/7214.js +1 -1
- package/.next/server/chunks/724.js +1 -1
- package/.next/server/chunks/7362.js +3 -3
- package/.next/server/chunks/7506.js +1 -1
- package/.next/server/chunks/7635.js +2 -2
- package/.next/server/chunks/7821.js +1 -0
- package/.next/server/chunks/7982.js +1 -0
- package/.next/server/chunks/9509.js +2 -2
- package/.next/server/chunks/9957.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/app/docs/page-fca894f60b9174e9.js +1 -0
- package/.next/static/chunks/app/flows/page-4e1ec20653e5dc86.js +1 -0
- package/.next/trace +7 -7
- package/README.md +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/6195.js +0 -37
- package/.next/server/chunks/8126.js +0 -1
- package/.next/server/chunks/8312.js +0 -5
- package/.next/server/chunks/9989.js +0 -1
- package/.next/static/chunks/app/docs/page-1d349e2d82f7b104.js +0 -1
- package/.next/static/chunks/app/flows/page-375150edff9134a3.js +0 -1
- /package/.next/static/{z7fsG7kblb_yxkUhOxn-G → KMEKXonxBXI3WzCfozXx4}/_buildManifest.js +0 -0
- /package/.next/static/{z7fsG7kblb_yxkUhOxn-G → KMEKXonxBXI3WzCfozXx4}/_ssgManifest.js +0 -0
|
@@ -96,9 +96,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
96
96
|
|| (${g} == "string" && ${e} && ${e} == +${e})`).assign(i,(0,h._)`+${e}`);return;case"integer":d.elseIf((0,h._)`${g} === "boolean" || ${e} === null
|
|
97
97
|
|| (${g} === "string" && ${e} && ${e} == +${e} && !(${e} % 1))`).assign(i,(0,h._)`+${e}`);return;case"boolean":d.elseIf((0,h._)`${e} === "false" || ${e} === 0 || ${e} === null`).assign(i,!1).elseIf((0,h._)`${e} === "true" || ${e} === 1`).assign(i,!0);return;case"null":d.elseIf((0,h._)`${e} === "" || ${e} === 0 || ${e} === false`),d.assign(i,null);return;case"array":d.elseIf((0,h._)`${g} === "string" || ${g} === "number"
|
|
98
98
|
|| ${g} === "boolean" || ${e} === null`).assign(i,(0,h._)`[${e}]`)}}(a);d.else(),o(a),d.endIf(),d.if((0,h._)`${i} !== undefined`,()=>{d.assign(e,i),function({gen:a,parentData:b,parentDataProperty:c},d){a.if((0,h._)`${b} !== undefined`,()=>a.assign((0,h._)`${b}[${c}]`,d))}(a,i)})}(a,b,l):o(a)})}return n};let k=new Set(["string","number","integer","boolean","null"]);function l(a,b,c,e=d.Correct){let f,g=e===d.Correct?h.operators.EQ:h.operators.NEQ;switch(a){case"null":return(0,h._)`${b} ${g} null`;case"array":f=(0,h._)`Array.isArray(${b})`;break;case"object":f=(0,h._)`${b} && typeof ${b} == "object" && !Array.isArray(${b})`;break;case"integer":f=i((0,h._)`!(${b} % 1) && !isNaN(${b})`);break;case"number":f=i();break;default:return(0,h._)`typeof ${b} ${g} ${a}`}return e===d.Correct?f:(0,h.not)(f);function i(a=h.nil){return(0,h.and)((0,h._)`typeof ${b} == "number"`,a,c?(0,h._)`isFinite(${b})`:h.nil)}}function m(a,b,c,d){let e;if(1===a.length)return l(a[0],b,c,d);let f=(0,i.toHash)(a);if(f.array&&f.object){let a=(0,h._)`typeof ${b} != "object"`;e=f.null?a:(0,h._)`!${b} || ${a}`,delete f.null,delete f.array,delete f.object}else e=h.nil;for(let a in f.number&&delete f.integer,f)e=(0,h.and)(e,l(a,b,c,d));return e}b.checkDataType=l,b.checkDataTypes=m;let n={message:({schema:a})=>`must be ${a}`,params:({schema:a,schemaValue:b})=>"string"==typeof a?(0,h._)`{type: ${a}}`:(0,h._)`{type: ${b}}`};function o(a){let b=function(a){let{gen:b,data:c,schema:d}=a,e=(0,i.schemaRefOrVal)(a,d,"type");return{gen:b,keyword:"type",data:c,schema:d.type,schemaCode:e,schemaValue:e,parentSchema:d,params:{},it:a}}(a);(0,g.reportError)(b,n)}b.reportTypeError=o},61275:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(31849),e=c(83593);b.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:a})=>(0,d._)`{passingSchemas: ${a.passing}}`},code(a){let{gen:b,schema:c,parentSchema:f,it:g}=a;if(!Array.isArray(c))throw Error("ajv implementation error");if(g.opts.discriminator&&f.discriminator)return;let h=b.let("valid",!1),i=b.let("passing",null),j=b.name("_valid");a.setParams({passing:i}),b.block(function(){c.forEach((c,f)=>{let k;(0,e.alwaysValidSchema)(g,c)?b.var(j,!0):k=a.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},j),f>0&&b.if((0,d._)`${j} && ${h}`).assign(h,!1).assign(i,(0,d._)`[${i}, ${f}]`).else(),b.if(j,()=>{b.assign(h,!0),b.assign(i,f),k&&a.mergeEvaluated(k,d.Name)})})}),a.result(h,()=>a.reset(),()=>a.error(!0))}}},61309:function(a,b,c){var d;d=c(67278),c(70522),d.mode.CTRGladman=function(){var a=d.lib.BlockCipherMode.extend();function b(a){if((a>>24&255)==255){var b=a>>16&255,c=a>>8&255,d=255&a;255===b?(b=0,255===c?(c=0,255===d?d=0:++d):++c):++b,a=0+(b<<16)+(c<<8)+d}else a+=0x1000000;return a}var c=a.Encryptor=a.extend({processBlock:function(a,c){var d,e=this._cipher,f=e.blockSize,g=this._iv,h=this._counter;g&&(h=this._counter=g.slice(0),this._iv=void 0),0===((d=h)[0]=b(d[0]))&&(d[1]=b(d[1]));var i=h.slice(0);e.encryptBlock(i,0);for(var j=0;j<f;j++)a[c+j]^=i[j]}});return a.Decryptor=c,a}(),a.exports=d.mode.CTRGladman},61341:a=>{"use strict";a.exports=JSON.parse('{"name":"google-auth-library","version":"10.7.0","author":"Google Inc.","description":"Google APIs Authentication Client Library for Node.js","engines":{"node":">=18"},"main":"./build/src/index.js","types":"./build/src/index.d.ts","repository":{"type":"git","directory":"packages/google-auth-library-nodejs","url":"https://github.com/googleapis/google-cloud-node-core.git"},"keywords":["google","api","google apis","client","client library"],"dependencies":{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11","gaxios":"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3","jws":"^4.0.0"},"devDependencies":{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0","c8":"^10.1.3","codecov":"^3.8.3","gts":"^6.0.2","is-docker":"^3.0.0","jsdoc":"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0","karma":"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1","keypair":"^1.0.4","mocha":"^11.1.0","mv":"^2.1.1","ncp":"^2.0.0","nock":"^14.0.5","null-loader":"^4.0.1","puppeteer":"^24.0.0","sinon":"21.0.3","ts-loader":"^9.5.2","typescript":"5.8.3","webpack":"^5.97.1","webpack-cli":"^6.0.1"},"files":["build/src","!build/src/**/*.map"],"scripts":{"test":"c8 mocha build/test","clean":"gts clean","prepare":"npm run compile","lint":"gts check --no-inline-config","compile":"tsc -p .","fix":"gts fix","pretest":"npm run compile -- --sourceMap","docs":"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap","webpack":"webpack","browser-test":"karma start","prelint":"cd samples; npm link ../; npm install"},"license":"Apache-2.0","homepage":"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/google-auth-library-nodejs"}')},61800:(a,b,c)=>{"use strict";c.d(b,{GN:()=>l,Rs:()=>j,Tt:()=>k,eS:()=>n,hO:()=>i,nB:()=>h,yg:()=>m});var d=c(18230),e=c(87507),f=c(97832);let g=(0,d.h)("backend/services/model/encryption");async function h(a){g.debug("setEncryptionKey: Entering method"),g.warn("setEncryptionKey: This function is deprecated. Use initializeDefaultEncryption or initializeEncryption from secure.ts instead.");try{return{success:await (0,f.hO)()}}catch(a){return g.warn("setEncryptionKey: Failed to set encryption key:",a),{success:!1,error:a instanceof Error?a.message:"Failed to set encryption key"}}}async function i(){g.debug("initializeDefaultEncryption: Entering method");try{let a=await (0,f.hO)();return a?g.info("initializeDefaultEncryption: Default encryption initialized successfully"):g.error("initializeDefaultEncryption: Failed to initialize default encryption"),a}catch(a){return g.error("initializeDefaultEncryption: Failed to initialize default encryption:",a),!1}}async function j(a){g.debug("encryptApiKey: Entering method");try{if(!a||""===a.trim())return g.warn("encryptApiKey: Empty API key provided"),"";if(!await m()&&(g.warn("encryptApiKey: Encryption is not configured, initializing default encryption"),!await i()))return g.error("encryptApiKey: Failed to initialize default encryption"),`encrypted_failed:${a}`;let b=await (0,f.pF)(a);if(!b)return g.error("encryptApiKey: encryptWithPassword returned null"),`encrypted_failed:${a}`;return`encrypted:${b}`}catch(b){return g.error("encryptApiKey: Failed to encrypt API key:",b),`encrypted_failed:${a}`}}async function k(a){g.debug("decryptApiKey: Entering method");try{if(a&&a.startsWith("${global:"))return(await (0,e.c)({key:a})).key;if(a&&a.startsWith("encrypted_failed:"))return a.substring(17);return await (0,f.Do)(a)}catch(a){return g.warn("decryptApiKey: Failed to decrypt API key:",a),null}}async function l(a){g.debug("resolveAndDecryptApiKey: Entering method");try{return await (0,e.G)(a)}catch(a){return g.warn("resolveAndDecryptApiKey: Failed to resolve or decrypt API key:",a),null}}async function m(){g.debug("isEncryptionConfigured: Entering method");try{return await (0,f.Gz)()}catch(a){return g.warn("isEncryptionConfigured: Failed to check encryption status:",a),!1}}async function n(){g.debug("isUserEncryptionEnabled: Entering method");try{return await (0,f.eS)()}catch(a){return g.warn("isUserEncryptionEnabled: Failed to check user encryption status:",a),!1}}},61980:(a,b,c)=>{var d;function e(a,b,c){if("function"==typeof b&&(c=b,b={}),!c){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(c,d){e(a,b||{},function(a,b){a?d(a):c(b)})})}d(a,b||{},function(a,d){a&&("EACCES"===a.code||b&&b.ignoreErrors)&&(a=null,d=!1),c(a,d)})}c(29021),d="win32"===process.platform||global.TESTING_WINDOWS?c(9583):c(40233),a.exports=e,e.sync=function(a,b){try{return d.sync(a,b||{})}catch(a){if(b&&b.ignoreErrors||"EACCES"===a.code)return!1;throw a}}},61986:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.default=[c(29539).default]},62867:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(31849),e=c(83593),f=c(73744);b.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:a})=>(0,d._)`{allowedValue: ${a}}`},code(a){let{gen:b,data:c,$data:g,schemaCode:h,schema:i}=a;g||i&&"object"==typeof i?a.fail$data((0,d._)`!${(0,e.useFunc)(b,f.default)}(${c}, ${h})`):a.fail((0,d._)`${i} !== ${c}`)}}},62888:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.IdentityPoolClient=void 0;let d=c(35294),e=c(45388),f=c(13348),g=c(73539),h=c(65905),i=c(86243),j=c(79792);class k extends d.BaseExternalAccountClient{subjectTokenSupplier;constructor(a){super(a);let b=(0,e.originalOrCamelOptions)(a),c=b.get("credential_source"),d=b.get("subject_token_supplier");if(!c&&!d)throw Error("A credential source or subject token supplier must be specified.");if(c&&d)throw Error("Only one of credential source or subject token supplier can be specified.");if(d)this.subjectTokenSupplier=d,this.credentialSourceType="programmatic";else{let a=(0,e.originalOrCamelOptions)(c),b=(0,e.originalOrCamelOptions)(a.get("format")),d=b.get("type")||"text",i=b.get("subject_token_field_name");if("json"!==d&&"text"!==d)throw Error(`Invalid credential_source format "${d}"`);if("json"===d&&!i)throw Error("Missing subject_token_field_name for JSON credential_source format");let j=a.get("file"),l=a.get("url"),m=a.get("certificate"),n=a.get("headers");if(j&&l||l&&m||j&&m)throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');if(j)this.credentialSourceType="file",this.subjectTokenSupplier=new f.FileSubjectTokenSupplier({filePath:j,formatType:d,subjectTokenFieldName:i});else if(l)this.credentialSourceType="url",this.subjectTokenSupplier=new g.UrlSubjectTokenSupplier({url:l,formatType:d,subjectTokenFieldName:i,headers:n,additionalGaxiosOptions:k.RETRY_CONFIG});else if(m){this.credentialSourceType="certificate";let a=new h.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:m.use_default_certificate_config,certificateConfigLocation:m.certificate_config_location,trustChainPath:m.trust_chain_path});this.subjectTokenSupplier=a}else throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let a=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof h.CertificateSubjectTokenSupplier){let a=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new i.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new j.Gaxios({agent:a})}),this.transporter=new j.Gaxios({...this.transporter.defaults||{},agent:a})}return a}}b.IdentityPoolClient=k},63129:(a,b,c)=>{"use strict";c.d(b,{ok:()=>f});var d=c(33873),e=c.n(d);function f(){let a=process.env.FLUJO_DATA_DIR;return a&&a.trim().length>0?e().resolve(a):process.cwd()}},63267:(a,b,c)=>{"use strict";let d=c(94735),e=c(81630),{Duplex:f}=c(27910),{createHash:g}=c(55511),h=c(339),i=c(74240),j=c(24698),k=c(15837),{CLOSE_TIMEOUT:l,GUID:m,kWebSocket:n}=c(32995),o=/^[+/0-9A-Za-z]{22}==$/;class p extends d{constructor(a,b){if(super(),null==(a={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:l,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:k,...a}).port&&!a.server&&!a.noServer||null!=a.port&&(a.server||a.noServer)||a.server&&a.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=a.port?(this._server=e.createServer((a,b)=>{let c=e.STATUS_CODES[426];b.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),b.end(c)}),this._server.listen(a.port,a.host,a.backlog,b)):a.server&&(this._server=a.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=function(a,b){for(let c of Object.keys(b))a.on(c,b[c]);return function(){for(let c of Object.keys(b))a.removeListener(c,b[c])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(b,c,d)=>{this.handleUpgrade(b,c,d,a)}})}!0===a.perMessageDeflate&&(a.perMessageDeflate={}),a.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=a,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(a){if(2===this._state){a&&this.once("close",()=>{a(Error("The server is not running"))}),process.nextTick(q,this);return}if(a&&this.once("close",a),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(q,this);else{let a=this._server;this._removeListeners(),this._removeListeners=this._server=null,a.close(()=>{q(this)})}}shouldHandle(a){if(this.options.path){let b=a.url.indexOf("?");if((-1!==b?a.url.slice(0,b):a.url)!==this.options.path)return!1}return!0}handleUpgrade(a,b,c,d){b.on("error",r);let e=a.headers["sec-websocket-key"],f=a.headers.upgrade,g=+a.headers["sec-websocket-version"];if("GET"!==a.method)return void t(this,a,b,405,"Invalid HTTP method");if(void 0===f||"websocket"!==f.toLowerCase())return void t(this,a,b,400,"Invalid Upgrade header");if(void 0===e||!o.test(e))return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==g&&8!==g)return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(a))return void s(b,400);let k=a.headers["sec-websocket-protocol"],l=new Set;if(void 0!==k)try{l=j.parse(k)}catch(c){t(this,a,b,400,"Invalid Sec-WebSocket-Protocol header");return}let m=a.headers["sec-websocket-extensions"],n={};if(this.options.perMessageDeflate&&void 0!==m){let c=new i({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let a=h.parse(m);a[i.extensionName]&&(c.accept(a[i.extensionName]),n[i.extensionName]=c)}catch(c){t(this,a,b,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:a.headers[`${8===g?"sec-websocket-origin":"origin"}`],secure:!!(a.socket.authorized||a.socket.encrypted),req:a};if(2===this.options.verifyClient.length)return void this.options.verifyClient(f,(f,g,h,i)=>{if(!f)return s(b,g||401,h,i);this.completeUpgrade(n,e,l,a,b,c,d)});if(!this.options.verifyClient(f))return s(b,401)}this.completeUpgrade(n,e,l,a,b,c,d)}completeUpgrade(a,b,c,d,e,f,j){if(!e.readable||!e.writable)return e.destroy();if(e[n])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return s(e,503);let k=g("sha1").update(b+m).digest("base64"),l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${k}`],o=new this.options.WebSocket(null,void 0,this.options);if(c.size){let a=this.options.handleProtocols?this.options.handleProtocols(c,d):c.values().next().value;a&&(l.push(`Sec-WebSocket-Protocol: ${a}`),o._protocol=a)}if(a[i.extensionName]){let b=a[i.extensionName].params,c=h.format({[i.extensionName]:[b]});l.push(`Sec-WebSocket-Extensions: ${c}`),o._extensions=a}this.emit("headers",l,d),e.write(l.concat("\r\n").join("\r\n")),e.removeListener("error",r),o.setSocket(e,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(o),o.on("close",()=>{this.clients.delete(o),this._shouldEmitClose&&!this.clients.size&&process.nextTick(q,this)})),j(o,d)}}function q(a){a._state=2,a.emit("close")}function r(){this.destroy()}function s(a,b,c,d){c=c||e.STATUS_CODES[b],d={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(c),...d},a.once("finish",a.destroy),a.end(`HTTP/1.1 ${b} ${e.STATUS_CODES[b]}\r
|
|
99
|
-
`+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function t(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,t),a.emit("wsClientError",d,c,b)}else s(c,d,e,f)}a.exports=p},63429:(a,b,c)=>{"use strict";var d;c.d(b,{fd:()=>f}),Symbol("ZodOutput"),Symbol("ZodInput");class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(a,...b){let c=b[0];return this._map.set(a,c),c&&"object"==typeof c&&"id"in c&&this._idmap.set(c.id,a),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(a){let b=this._map.get(a);return b&&"object"==typeof b&&"id"in b&&this._idmap.delete(b.id),this._map.delete(a),this}get(a){let b=a._zod.parent;if(b){let c={...this.get(b)??{}};delete c.id;let d={...c,...this._map.get(a)};return Object.keys(d).length?d:void 0}return this._map.get(a)}has(a){return this._map.has(a)}}(d=globalThis).__zod_globalRegistry??(d.__zod_globalRegistry=new e);let f=globalThis.__zod_globalRegistry},64098:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.NodeCrypto=void 0;let d=c(55511);class e{async sha256DigestBase64(a){return d.createHash("sha256").update(a).digest("base64")}randomBytesBase64(a){return d.randomBytes(a).toString("base64")}async verify(a,b,c){let e=d.createVerify("RSA-SHA256");return e.update(b),e.end(),e.verify(a,c,"base64")}async sign(a,b){let c=d.createSign("RSA-SHA256");return c.update(b),c.end(),c.sign(a,"base64")}decodeBase64StringUtf8(a){return Buffer.from(a,"base64").toString("utf-8")}encodeBase64StringUtf8(a){return Buffer.from(a,"utf-8").toString("base64")}async sha256DigestHex(a){return d.createHash("sha256").update(a).digest("hex")}async signWithHmacSha256(a,b){var c;let e="string"==typeof a?a:(c=a,Buffer.from(c));return function(a){let b=new ArrayBuffer(a.length),c=new Uint8Array(b);for(let b=0;b<a.length;++b)c[b]=a[b];return b}(d.createHmac("sha256",e).update(b).digest())}}b.NodeCrypto=e},64570:function(a,b,c){var d,e,f;a.exports=void(e=(d=c(67278)).lib.Base,f=d.enc.Utf8,d.algo.HMAC=e.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=f.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var e=this._oKey=b.clone(),g=this._iKey=b.clone(),h=e.words,i=g.words,j=0;j<c;j++)h[j]^=0x5c5c5c5c,i[j]^=0x36363636;e.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);return b.reset(),b.finalize(this._oKey.clone().concat(c))}}))},65152:a=>{"use strict";var b=Object.defineProperty||!1;if(b)try{b({},"a",{value:1})}catch(a){b=!1}a.exports=b},65325:function(a,b){"use strict";var c,d=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b),a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});var e=function(){function a(a){void 0===a&&(a="="),this._paddingCharacter=a}return a.prototype.encodedLength=function(a){return this._paddingCharacter?(a+2)/3*4|0:(8*a+5)/6|0},a.prototype.encode=function(a){for(var b="",c=0;c<a.length-2;c+=3){var d=a[c]<<16|a[c+1]<<8|a[c+2];b+=this._encodeByte(d>>>18&63),b+=this._encodeByte(d>>>12&63),b+=this._encodeByte(d>>>6&63),b+=this._encodeByte(d>>>0&63)}var e=a.length-c;if(e>0){var d=a[c]<<16|(2===e?a[c+1]<<8:0);b+=this._encodeByte(d>>>18&63),b+=this._encodeByte(d>>>12&63),2===e?b+=this._encodeByte(d>>>6&63):b+=this._paddingCharacter||"",b+=this._paddingCharacter||""}return b},a.prototype.maxDecodedLength=function(a){return this._paddingCharacter?a/4*3|0:(6*a+7)/8|0},a.prototype.decodedLength=function(a){return this.maxDecodedLength(a.length-this._getPaddingLength(a))},a.prototype.decode=function(a){if(0===a.length)return new Uint8Array(0);for(var b=this._getPaddingLength(a),c=a.length-b,d=new Uint8Array(this.maxDecodedLength(c)),e=0,f=0,g=0,h=0,i=0,j=0,k=0;f<c-4;f+=4)h=this._decodeChar(a.charCodeAt(f+0)),i=this._decodeChar(a.charCodeAt(f+1)),j=this._decodeChar(a.charCodeAt(f+2)),k=this._decodeChar(a.charCodeAt(f+3)),d[e++]=h<<2|i>>>4,d[e++]=i<<4|j>>>2,d[e++]=j<<6|k,g|=256&h,g|=256&i,g|=256&j,g|=256&k;if(f<c-1&&(h=this._decodeChar(a.charCodeAt(f)),i=this._decodeChar(a.charCodeAt(f+1)),d[e++]=h<<2|i>>>4,g|=256&h,g|=256&i),f<c-2&&(j=this._decodeChar(a.charCodeAt(f+2)),d[e++]=i<<4|j>>>2,g|=256&j),f<c-3&&(k=this._decodeChar(a.charCodeAt(f+3)),d[e++]=j<<6|k,g|=256&k),0!==g)throw Error("Base64Coder: incorrect characters for decoding");return d},a.prototype._encodeByte=function(a){var b=a;return b+=65,b+=25-a>>>8&6,b+=51-a>>>8&-75,b+=61-a>>>8&-15,String.fromCharCode(b+=62-a>>>8&3)},a.prototype._decodeChar=function(a){return 256+((42-a&a-44)>>>8&-256+a-43+62)+((46-a&a-48)>>>8&-256+a-47+63)+((47-a&a-58)>>>8&-256+a-48+52)+((64-a&a-91)>>>8&-256+a-65+0)+((96-a&a-123)>>>8&-256+a-97+26)},a.prototype._getPaddingLength=function(a){var b=0;if(this._paddingCharacter){for(var c=a.length-1;c>=0&&a[c]===this._paddingCharacter;c--)b++;if(a.length<4||b>2)throw Error("Base64Coder: incorrect padding")}return b},a}();b.Coder=e;var f=new e;b.encode=function(a){return f.encode(a)},b.decode=function(a){return f.decode(a)};var g=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return d(b,a),b.prototype._encodeByte=function(a){var b=a;return b+=65,b+=25-a>>>8&6,b+=51-a>>>8&-75,b+=61-a>>>8&-13,String.fromCharCode(b+=62-a>>>8&49)},b.prototype._decodeChar=function(a){return 256+((44-a&a-46)>>>8&-256+a-45+62)+((94-a&a-96)>>>8&-256+a-95+63)+((47-a&a-58)>>>8&-256+a-48+52)+((64-a&a-91)>>>8&-256+a-65+0)+((96-a&a-123)>>>8&-256+a-97+26)},b}(e);b.URLSafeCoder=g;var h=new g;b.encodeURLSafe=function(a){return h.encode(a)},b.decodeURLSafe=function(a){return h.decode(a)},b.encodedLength=function(a){return f.encodedLength(a)},b.maxDecodedLength=function(a){return f.maxDecodedLength(a)},b.decodedLength=function(a){return f.decodedLength(a)}},65378:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(83593);b.default={keyword:"allOf",schemaType:"array",code(a){let{gen:b,schema:c,it:e}=a;if(!Array.isArray(c))throw Error("ajv implementation error");let f=b.name("valid");c.forEach((b,c)=>{if((0,d.alwaysValidSchema)(e,b))return;let g=a.subschema({keyword:"allOf",schemaProp:c},f);a.ok(f),a.mergeEvaluated(g)})}}},65694:(a,b,c)=>{"use strict";var d=c(79428).Buffer,e=c(79428).SlowBuffer;function f(a,b){if(!d.isBuffer(a)||!d.isBuffer(b)||a.length!==b.length)return!1;for(var c=0,e=0;e<a.length;e++)c|=a[e]^b[e];return 0===c}a.exports=f,f.install=function(){d.prototype.equal=e.prototype.equal=function(a){return f(this,a)}};var g=d.prototype.equal,h=e.prototype.equal;f.restore=function(){d.prototype.equal=g,e.prototype.equal=h}},65905:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CertificateSubjectTokenSupplier=b.InvalidConfigurationError=b.CertificateSourceUnavailableError=b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;let d=c(45388),e=c(29021),f=c(55511),g=c(55591);b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";class h extends Error{constructor(a){super(a),this.name="CertificateSourceUnavailableError"}}b.CertificateSourceUnavailableError=h;class i extends Error{constructor(a){super(a),this.name="InvalidConfigurationError"}}b.InvalidConfigurationError=i;class j{certificateConfigPath;trustChainPath;cert;key;constructor(a){if(!a.useDefaultCertificateConfig&&!a.certificateConfigLocation)throw new i("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(a.useDefaultCertificateConfig&&a.certificateConfigLocation)throw new i("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=a.trustChainPath,this.certificateConfigPath=a.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new i("Cannot create mTLS Agent with missing certificate or key");return new g.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#w();let{certPath:a,keyPath:b}=await this.#x();return{cert:this.cert,key:this.key}=await this.#y(a,b),await this.#z(this.cert)}async #w(){let a=this.certificateConfigPath;if(a){if(await (0,d.isValidFile)(a))return a;throw new h(`Provided certificate config path is invalid: ${a}`)}let c=process.env[b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(c){if(await (0,d.isValidFile)(c))return c;throw new h(`Path from environment variable "${b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${c}`)}let e=(0,d.getWellKnownCertificateConfigFileLocation)();if(await (0,d.isValidFile)(e))return e;throw new h(`Could not find certificate configuration file. Searched override path, the "${b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${e}).`)}async #x(){let a,b=this.certificateConfigPath;try{a=await e.promises.readFile(b,"utf8")}catch(a){throw new h(`Failed to read certificate config file at: ${b}`)}try{let c=JSON.parse(a),d=c?.cert_configs?.workload?.cert_path,e=c?.cert_configs?.workload?.key_path;if(!d||!e)throw new i(`Certificate config file (${b}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:d,keyPath:e}}catch(a){if(a instanceof i)throw a;throw new i(`Failed to parse certificate config from ${b}: ${a.message}`)}}async #y(a,b){let c,d;try{c=await e.promises.readFile(a),new f.X509Certificate(c)}catch(c){let b=c instanceof Error?c.message:String(c);throw new h(`Failed to read certificate file at ${a}: ${b}`)}try{d=await e.promises.readFile(b),(0,f.createPrivateKey)(d)}catch(c){let a=c instanceof Error?c.message:String(c);throw new h(`Failed to read private key file at ${b}: ${a}`)}return{cert:c,key:d}}async #z(a){let b=new f.X509Certificate(a);if(!this.trustChainPath)return JSON.stringify([b.raw.toString("base64")]);try{let a,c=((await e.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((a,b)=>{try{return new f.X509Certificate(a)}catch(c){let a=c instanceof Error?c.message:String(c);throw new i(`Failed to parse certificate at index ${b} in trust chain file ${this.trustChainPath}: ${a}`)}}),d=c.findIndex(a=>b.raw.equals(a.raw));if(-1===d)a=[b,...c];else if(0===d)a=c;else throw new i(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${d}).`);return JSON.stringify(a.map(a=>a.raw.toString("base64")))}catch(b){if(b instanceof i)throw b;let a=b instanceof Error?b.message:String(b);throw new h(`Failed to process certificate chain from ${this.trustChainPath}: ${a}`)}}}b.CertificateSubjectTokenSupplier=j},66477:function(a,b,c){"use strict";var d=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(b,"__esModule",{value:!0});let e=d(c(97250)).default("https-proxy-agent:parse-proxy-response");b.default=function(a){return new Promise((b,c)=>{let d=0,f=[];function g(){let c=a.read();c?function(a){f.push(a),d+=a.length;let c=Buffer.concat(f,d);if(-1===c.indexOf("\r\n\r\n")){e("have not received end of HTTP headers yet..."),g();return}let h=c.toString("ascii",0,c.indexOf("\r\n")),i=+h.split(" ")[1];e("got proxy server response: %o",h),b({statusCode:i,buffered:c})}(c):a.once("readable",g)}function h(a){e("onclose had error %o",a)}function i(){e("onend")}a.on("error",function b(d){a.removeListener("end",i),a.removeListener("error",b),a.removeListener("close",h),a.removeListener("readable",g),e("onerror %o",d),c(d)}),a.on("close",h),a.on("end",i),g()})}},67278:function(a,b,c){var d;a.exports=d||function(a,b){if("undefined"!=typeof window&&window.crypto&&(d=window.crypto),"undefined"!=typeof self&&self.crypto&&(d=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(d=globalThis.crypto),!d&&"undefined"!=typeof window&&window.msCrypto&&(d=window.msCrypto),!d&&"undefined"!=typeof global&&global.crypto&&(d=global.crypto),!d)try{d=c(55511)}catch(a){}var d,e=function(){if(d){if("function"==typeof d.getRandomValues)try{return d.getRandomValues(new Uint32Array(1))[0]}catch(a){}if("function"==typeof d.randomBytes)try{return d.randomBytes(4).readInt32LE()}catch(a){}}throw Error("Native crypto module could not be used to get secure random number.")},f=Object.create||function(){function a(){}return function(b){var c;return a.prototype=b,c=new a,a.prototype=null,c}}(),g={},h=g.lib={},i=h.Base={extend:function(a){var b=f(this);return a&&b.mixIn(a),b.hasOwnProperty("init")&&this.init!==b.init||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},j=h.WordArray=i.extend({init:function(a,c){a=this.words=a||[],b!=c?this.sigBytes=c:this.sigBytes=4*a.length},toString:function(a){return(a||l).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;f<e;f++){var g=c[f>>>2]>>>24-f%4*8&255;b[d+f>>>2]|=g<<24-(d+f)%4*8}else for(var h=0;h<e;h+=4)b[d+h>>>2]=c[h>>>2];return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=0xffffffff<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=i.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var b=[],c=0;c<a;c+=4)b.push(e());return new j.init(b,a)}}),k=g.enc={},l=k.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new j.init(c,b/2)}},m=k.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new j.init(c,b)}},n=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(m.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return m.parse(unescape(encodeURIComponent(a)))}},o=h.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new j.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=n.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c,d=this._data,e=d.words,f=d.sigBytes,g=this.blockSize,h=f/(4*g),i=(h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0))*g,k=a.min(4*i,f);if(i){for(var l=0;l<i;l+=g)this._doProcessBlock(e,l);c=e.splice(0,i),d.sigBytes-=k}return new j.init(c,k)},clone:function(){var a=i.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});h.Hasher=o.extend({cfg:i.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){o.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new p.HMAC.init(a,c).finalize(b)}}});var p=g.algo={};return g}(Math)},67729:a=>{"use strict";var b={};function c(a,b){!b.unsigned&&--a;let c=b.unsigned?0:-Math.pow(2,a),d=Math.pow(2,a)-1,e=b.moduloBitLength?Math.pow(2,b.moduloBitLength):Math.pow(2,a),f=b.moduloBitLength?Math.pow(2,b.moduloBitLength-1):Math.pow(2,a-1);return function(a,g){g||(g={});let h=+a;if(g.enforceRange){if(!Number.isFinite(h))throw TypeError("Argument is not a finite number");if((h=(h<0?-1:1)*Math.floor(Math.abs(h)))<c||h>d)throw TypeError("Argument is not in byte range");return h}if(!isNaN(h)&&g.clamp){var i;return(h=(i=h)%1==.5&&(1&i)==0?Math.floor(i):Math.round(i))<c&&(h=c),h>d&&(h=d),h}if(!Number.isFinite(h)||0===h)return 0;if(h=(h<0?-1:1)*Math.floor(Math.abs(h))%e,!b.unsigned&&h>=f)return h-e;if(b.unsigned){if(h<0)h+=e;else if(-0===h)return 0}return h}}a.exports=b,b.void=function(){},b.boolean=function(a){return!!a},b.byte=c(8,{unsigned:!1}),b.octet=c(8,{unsigned:!0}),b.short=c(16,{unsigned:!1}),b["unsigned short"]=c(16,{unsigned:!0}),b.long=c(32,{unsigned:!1}),b["unsigned long"]=c(32,{unsigned:!0}),b["long long"]=c(32,{unsigned:!1,moduloBitLength:64}),b["unsigned long long"]=c(32,{unsigned:!0,moduloBitLength:64}),b.double=function(a){let b=+a;if(!Number.isFinite(b))throw TypeError("Argument is not a finite floating-point value");return b},b["unrestricted double"]=function(a){let b=+a;if(isNaN(b))throw TypeError("Argument is NaN");return b},b.float=b.double,b["unrestricted float"]=b["unrestricted double"],b.DOMString=function(a,b){return(b||(b={}),b.treatNullAsEmptyString&&null===a)?"":String(a)},b.ByteString=function(a,b){let c,d=String(a);for(let a=0;void 0!==(c=d.codePointAt(a));++a)if(c>255)throw TypeError("Argument is not a valid bytestring");return d},b.USVString=function(a){let b=String(a),c=b.length,d=[];for(let a=0;a<c;++a){let e=b.charCodeAt(a);if(e<55296||e>57343)d.push(String.fromCodePoint(e));else if(56320<=e&&e<=57343)d.push(String.fromCodePoint(65533));else if(a===c-1)d.push(String.fromCodePoint(65533));else{let c=b.charCodeAt(a+1);if(56320<=c&&c<=57343){let b=1023&e,f=1023&c;d.push(String.fromCodePoint(65536+1024*b+f)),++a}else d.push(String.fromCodePoint(65533))}}return d.join("")},b.Date=function(a,b){if(!(a instanceof Date))throw TypeError("Argument is not a Date object");if(!isNaN(a))return a},b.RegExp=function(a,b){return a instanceof RegExp||(a=new RegExp(a)),a}},68041:(a,b,c)=>{var d=c(14764),e=c(90126);a.exports=function(a){Object.keys(this.jobs).length&&(this.index=this.size,d(this),e(a)(null,this.results))}},68300:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(97025),e=c(31849),f=c(60359),g=c(83593);b.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,e._)`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:b,schema:c,parentSchema:h,data:i,errsCount:j,it:k}=a;if(!j)throw Error("ajv implementation error");let{allErrors:l,opts:m}=k;if(k.props=!0,"all"!==m.removeAdditional&&(0,g.alwaysValidSchema)(k,c))return;let n=(0,d.allSchemaProperties)(h.properties),o=(0,d.allSchemaProperties)(h.patternProperties);function p(a){b.code((0,e._)`delete ${i}[${a}]`)}function q(d){if("all"===m.removeAdditional||m.removeAdditional&&!1===c)return void p(d);if(!1===c){a.setParams({additionalProperty:d}),a.error(),l||b.break();return}if("object"==typeof c&&!(0,g.alwaysValidSchema)(k,c)){let c=b.name("valid");"failing"===m.removeAdditional?(r(d,c,!1),b.if((0,e.not)(c),()=>{a.reset(),p(d)})):(r(d,c),l||b.if((0,e.not)(c),()=>b.break()))}}function r(b,c,d){let e={keyword:"additionalProperties",dataProp:b,dataPropType:g.Type.Str};!1===d&&Object.assign(e,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(e,c)}b.forIn("key",i,c=>{n.length||o.length?b.if(function(c){let f;if(n.length>8){let a=(0,g.schemaRefOrVal)(k,h.properties,"properties");f=(0,d.isOwnProperty)(b,a,c)}else f=n.length?(0,e.or)(...n.map(a=>(0,e._)`${c} === ${a}`)):e.nil;return o.length&&(f=(0,e.or)(f,...o.map(b=>(0,e._)`${(0,d.usePattern)(a,b)}.test(${c})`))),(0,e.not)(f)}(c),()=>q(c)):q(c)}),a.ok((0,e._)`${j} === ${f.default.errors}`)}}},68760:(a,b,c)=>{var d=c(92878).Buffer,e=c(91781),f=c(17134),g=c(27910),h=c(86080),i=c(28354),j=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function k(a){var b=a.split(".",1)[0],c=d.from(b,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(c))return c;try{return JSON.parse(c)}catch(a){return}}function l(a){return a.split(".")[2]}function m(a){return j.test(a)&&!!k(a)}function n(a,b,c){if(!b){var d=Error("Missing algorithm parameter for jws.verify");throw d.code="MISSING_ALGORITHM",d}var e=l(a=h(a)),g=a.split(".",2).join(".");return f(b).verify(g,e,c)}function o(a,b){if(b=b||{},!m(a=h(a)))return null;var c,e,f=k(a);if(!f)return null;var g=(c=c||"utf8",e=a.split(".")[1],d.from(e,"base64").toString(c));return("JWT"===f.typ||b.json)&&(g=JSON.parse(g,b.encoding)),{header:f,payload:g,signature:l(a)}}function p(a){var b=(a=a||{}).secret;if(b=null==(b=null==b?a.publicKey:b)?a.key:b,!0===/^hs/i.test(a.algorithm)&&null==b)throw TypeError("secret must be a string or buffer or a KeyObject");var c=new e(b);this.readable=!0,this.algorithm=a.algorithm,this.encoding=a.encoding,this.secret=this.publicKey=this.key=c,this.signature=new e(a.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}i.inherits(p,g),p.prototype.verify=function(){try{var a=n(this.signature.buffer,this.algorithm,this.key.buffer),b=o(this.signature.buffer,this.encoding);return this.emit("done",a,b),this.emit("data",a),this.emit("end"),this.readable=!1,a}catch(a){this.readable=!1,this.emit("error",a),this.emit("close")}},p.decode=o,p.isValid=m,p.verify=n,a.exports=p},68824:()=>{},69088:(a,b,c)=>{"use strict";c.d(b,{VL:()=>d,aI:()=>e});let d="mcp-servers",e=300},69579:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{AppRenderSpan:function(){return i},AppRouteRouteHandlersSpan:function(){return l},BaseServerSpan:function(){return c},LoadComponentsSpan:function(){return d},LogSpanAllowList:function(){return p},MiddlewareSpan:function(){return n},NextNodeServerSpan:function(){return f},NextServerSpan:function(){return e},NextVanillaSpanAllowlist:function(){return o},NodeSpan:function(){return k},RenderSpan:function(){return h},ResolveMetadataSpan:function(){return m},RouterSpan:function(){return j},StartServerSpan:function(){return g}});var c=function(a){return a.handleRequest="BaseServer.handleRequest",a.run="BaseServer.run",a.pipe="BaseServer.pipe",a.getStaticHTML="BaseServer.getStaticHTML",a.render="BaseServer.render",a.renderToResponseWithComponents="BaseServer.renderToResponseWithComponents",a.renderToResponse="BaseServer.renderToResponse",a.renderToHTML="BaseServer.renderToHTML",a.renderError="BaseServer.renderError",a.renderErrorToResponse="BaseServer.renderErrorToResponse",a.renderErrorToHTML="BaseServer.renderErrorToHTML",a.render404="BaseServer.render404",a}(c||{}),d=function(a){return a.loadDefaultErrorComponents="LoadComponents.loadDefaultErrorComponents",a.loadComponents="LoadComponents.loadComponents",a}(d||{}),e=function(a){return a.getRequestHandler="NextServer.getRequestHandler",a.getServer="NextServer.getServer",a.getServerRequestHandler="NextServer.getServerRequestHandler",a.createServer="createServer.createServer",a}(e||{}),f=function(a){return a.compression="NextNodeServer.compression",a.getBuildId="NextNodeServer.getBuildId",a.createComponentTree="NextNodeServer.createComponentTree",a.clientComponentLoading="NextNodeServer.clientComponentLoading",a.getLayoutOrPageModule="NextNodeServer.getLayoutOrPageModule",a.generateStaticRoutes="NextNodeServer.generateStaticRoutes",a.generateFsStaticRoutes="NextNodeServer.generateFsStaticRoutes",a.generatePublicRoutes="NextNodeServer.generatePublicRoutes",a.generateImageRoutes="NextNodeServer.generateImageRoutes.route",a.sendRenderResult="NextNodeServer.sendRenderResult",a.proxyRequest="NextNodeServer.proxyRequest",a.runApi="NextNodeServer.runApi",a.render="NextNodeServer.render",a.renderHTML="NextNodeServer.renderHTML",a.imageOptimizer="NextNodeServer.imageOptimizer",a.getPagePath="NextNodeServer.getPagePath",a.getRoutesManifest="NextNodeServer.getRoutesManifest",a.findPageComponents="NextNodeServer.findPageComponents",a.getFontManifest="NextNodeServer.getFontManifest",a.getServerComponentManifest="NextNodeServer.getServerComponentManifest",a.getRequestHandler="NextNodeServer.getRequestHandler",a.renderToHTML="NextNodeServer.renderToHTML",a.renderError="NextNodeServer.renderError",a.renderErrorToHTML="NextNodeServer.renderErrorToHTML",a.render404="NextNodeServer.render404",a.startResponse="NextNodeServer.startResponse",a.route="route",a.onProxyReq="onProxyReq",a.apiResolver="apiResolver",a.internalFetch="internalFetch",a}(f||{}),g=function(a){return a.startServer="startServer.startServer",a}(g||{}),h=function(a){return a.getServerSideProps="Render.getServerSideProps",a.getStaticProps="Render.getStaticProps",a.renderToString="Render.renderToString",a.renderDocument="Render.renderDocument",a.createBodyResult="Render.createBodyResult",a}(h||{}),i=function(a){return a.renderToString="AppRender.renderToString",a.renderToReadableStream="AppRender.renderToReadableStream",a.getBodyResult="AppRender.getBodyResult",a.fetch="AppRender.fetch",a}(i||{}),j=function(a){return a.executeRoute="Router.executeRoute",a}(j||{}),k=function(a){return a.runHandler="Node.runHandler",a}(k||{}),l=function(a){return a.runHandler="AppRouteRouteHandlers.runHandler",a}(l||{}),m=function(a){return a.generateMetadata="ResolveMetadata.generateMetadata",a.generateViewport="ResolveMetadata.generateViewport",a}(m||{}),n=function(a){return a.execute="Middleware.execute",a}(n||{});let o=new Set(["Middleware.execute","BaseServer.handleRequest","Render.getServerSideProps","Render.getStaticProps","AppRender.fetch","AppRender.getBodyResult","Render.renderDocument","Node.runHandler","AppRouteRouteHandlers.runHandler","ResolveMetadata.generateMetadata","ResolveMetadata.generateViewport","NextNodeServer.createComponentTree","NextNodeServer.findPageComponents","NextNodeServer.getLayoutOrPageModule","NextNodeServer.startResponse","NextNodeServer.clientComponentLoading"]),p=new Set(["NextNodeServer.findPageComponents","NextNodeServer.createComponentTree","NextNodeServer.clientComponentLoading"])},69664:a=>{"use strict";a.exports=Number.isNaN||function(a){return a!=a}},70194:(a,b,c)=>{"use strict";var d=c(69664);a.exports=function(a){return d(a)||0===a?a:a<0?-1:1}},70428:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.extendErrors=b.resetErrorsCount=b.reportExtraError=b.reportError=b.keyword$DataError=b.keywordError=void 0;let d=c(31849),e=c(83593),f=c(60359);function g(a,b){let c=a.const("err",b);a.if((0,d._)`${f.default.vErrors} === null`,()=>a.assign(f.default.vErrors,(0,d._)`[${c}]`),(0,d._)`${f.default.vErrors}.push(${c})`),a.code((0,d._)`${f.default.errors}++`)}function h(a,b){let{gen:c,validateName:e,schemaEnv:f}=a;f.$async?c.throw((0,d._)`new ${a.ValidationError}(${b})`):(c.assign((0,d._)`${e}.errors`,b),c.return(!1))}b.keywordError={message:({keyword:a})=>(0,d.str)`must pass "${a}" keyword validation`},b.keyword$DataError={message:({keyword:a,schemaType:b})=>b?(0,d.str)`"${a}" keyword must be ${b} ($data)`:(0,d.str)`"${a}" keyword is invalid ($data)`},b.reportError=function(a,c=b.keywordError,e,f){let{it:i}=a,{gen:k,compositeRule:l,allErrors:m}=i,n=j(a,c,e);(null!=f?f:l||m)?g(k,n):h(i,(0,d._)`[${n}]`)},b.reportExtraError=function(a,c=b.keywordError,d){let{it:e}=a,{gen:i,compositeRule:k,allErrors:l}=e;g(i,j(a,c,d)),k||l||h(e,f.default.vErrors)},b.resetErrorsCount=function(a,b){a.assign(f.default.errors,b),a.if((0,d._)`${f.default.vErrors} !== null`,()=>a.if(b,()=>a.assign((0,d._)`${f.default.vErrors}.length`,b),()=>a.assign(f.default.vErrors,null)))},b.extendErrors=function({gen:a,keyword:b,schemaValue:c,data:e,errsCount:g,it:h}){if(void 0===g)throw Error("ajv implementation error");let i=a.name("err");a.forRange("i",g,f.default.errors,g=>{a.const(i,(0,d._)`${f.default.vErrors}[${g}]`),a.if((0,d._)`${i}.instancePath === undefined`,()=>a.assign((0,d._)`${i}.instancePath`,(0,d.strConcat)(f.default.instancePath,h.errorPath))),a.assign((0,d._)`${i}.schemaPath`,(0,d.str)`${h.errSchemaPath}/${b}`),h.opts.verbose&&(a.assign((0,d._)`${i}.schema`,c),a.assign((0,d._)`${i}.data`,e))})};let i={keyword:new d.Name("keyword"),schemaPath:new d.Name("schemaPath"),params:new d.Name("params"),propertyName:new d.Name("propertyName"),message:new d.Name("message"),schema:new d.Name("schema"),parentSchema:new d.Name("parentSchema")};function j(a,b,c){let{createErrors:g}=a.it;return!1===g?(0,d._)`{}`:function(a,b,c={}){let{gen:g,it:h}=a,j=[function({errorPath:a},{instancePath:b}){let c=b?(0,d.str)`${a}${(0,e.getErrorPath)(b,e.Type.Str)}`:a;return[f.default.instancePath,(0,d.strConcat)(f.default.instancePath,c)]}(h,c),function({keyword:a,it:{errSchemaPath:b}},{schemaPath:c,parentSchema:f}){let g=f?b:(0,d.str)`${b}/${a}`;return c&&(g=(0,d.str)`${g}${(0,e.getErrorPath)(c,e.Type.Str)}`),[i.schemaPath,g]}(a,c)];return function(a,{params:b,message:c},e){let{keyword:g,data:h,schemaValue:j,it:k}=a,{opts:l,propertyName:m,topSchemaRef:n,schemaPath:o}=k;e.push([i.keyword,g],[i.params,"function"==typeof b?b(a):b||(0,d._)`{}`]),l.messages&&e.push([i.message,"function"==typeof c?c(a):c]),l.verbose&&e.push([i.schema,j],[i.parentSchema,(0,d._)`${n}${o}`],[f.default.data,h]),m&&e.push([i.propertyName,m])}(a,b,j),g.object(...j)}(a,b,c)}},70522:function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;d=c(67278),c(46007),a.exports=void(d.lib.Cipher||(f=(e=d.lib).Base,g=e.WordArray,h=e.BufferedBlockAlgorithm,(i=d.enc).Utf8,j=i.Base64,k=d.algo.EvpKDF,l=e.Cipher=h.extend({cfg:f.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c),this._xformMode=a,this._key=b,this.reset()},reset:function(){h.reset.call(this),this._doReset()},process:function(a){return this._append(a),this._process()},finalize:function(a){return a&&this._append(a),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function a(a){return"string"==typeof a?u:s}return function(b){return{encrypt:function(c,d,e){return a(d).encrypt(b,c,d,e)},decrypt:function(c,d,e){return a(d).decrypt(b,c,d,e)}}}}()}),e.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),m=d.mode={},n=e.BlockCipherMode=f.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a,this._iv=b}}),o=m.CBC=function(){var a=n.extend();function b(a,b,c){var d,e=this._iv;e?(d=e,this._iv=void 0):d=this._prevBlock;for(var f=0;f<c;f++)a[b+f]^=d[f]}return a.Encryptor=a.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize;b.call(this,a,c,e),d.encryptBlock(a,c),this._prevBlock=a.slice(c,c+e)}}),a.Decryptor=a.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize,f=a.slice(c,c+e);d.decryptBlock(a,c),b.call(this,a,c,e),this._prevBlock=f}}),a}(),p=(d.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,d=c-a.sigBytes%c,e=d<<24|d<<16|d<<8|d,f=[],h=0;h<d;h+=4)f.push(e);var i=g.create(f,d);a.concat(i)},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},e.BlockCipher=l.extend({cfg:l.cfg.extend({mode:o,padding:p}),reset:function(){l.reset.call(this);var a,b=this.cfg,c=b.iv,d=b.mode;this._xformMode==this._ENC_XFORM_MODE?a=d.createEncryptor:(a=d.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==a?this._mode.init(this,c&&c.words):(this._mode=a.call(d,this,c&&c.words),this._mode.__creator=a)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a,b=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(b.pad(this._data,this.blockSize),a=this._process(!0)):(a=this._process(!0),b.unpad(a)),a},blockSize:4}),q=e.CipherParams=f.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),r=(d.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext,c=a.salt;return(c?g.create([0x53616c74,0x65645f5f]).concat(c).concat(b):b).toString(j)},parse:function(a){var b,c=j.parse(a),d=c.words;return 0x53616c74==d[0]&&0x65645f5f==d[1]&&(b=g.create(d.slice(2,4)),d.splice(0,4),c.sigBytes-=16),q.create({ciphertext:c,salt:b})}},s=e.SerializableCipher=f.extend({cfg:f.extend({format:r}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d),f=e.finalize(b),g=e.cfg;return q.create({ciphertext:f,key:c,iv:g.iv,algorithm:a,mode:g.mode,padding:g.padding,blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){return d=this.cfg.extend(d),b=this._parse(b,d.format),a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),t=(d.kdf={}).OpenSSL={execute:function(a,b,c,d,e){if(d||(d=g.random(8)),e)var f=k.create({keySize:b+c,hasher:e}).compute(a,d);else var f=k.create({keySize:b+c}).compute(a,d);var h=g.create(f.words.slice(b),4*c);return f.sigBytes=4*b,q.create({key:f,iv:h,salt:d})}},u=e.PasswordBasedCipher=s.extend({cfg:s.cfg.extend({kdf:t}),encrypt:function(a,b,c,d){var e=(d=this.cfg.extend(d)).kdf.execute(c,a.keySize,a.ivSize,d.salt,d.hasher);d.iv=e.iv;var f=s.encrypt.call(this,a,b,e.key,d);return f.mixIn(e),f},decrypt:function(a,b,c,d){d=this.cfg.extend(d),b=this._parse(b,d.format);var e=d.kdf.execute(c,a.keySize,a.ivSize,b.salt,d.hasher);return d.iv=e.iv,s.decrypt.call(this,a,b,e.key,d)}})))},70916:function(a,b,c){"use strict";let d;var e,f=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),g=this&&this.__setModuleDefault||(Object.create?function(a,b){Object.defineProperty(a,"default",{enumerable:!0,value:b})}:function(a,b){a.default=b}),h=this&&this.__importStar||(e=function(a){return(e=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[b.length]=c);return b})(a)},function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c=e(a),d=0;d<c.length;d++)"default"!==c[d]&&f(b,a,c[d]);return g(b,a),b}),i=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||f(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),b.gcpResidencyCache=b.METADATA_SERVER_DETECTION=b.HEADERS=b.HEADER_VALUE=b.HEADER_NAME=b.SECONDARY_HOST_ADDRESS=b.HOST_ADDRESS=b.BASE_PATH=void 0,b.instance=function(a){return p("instance",a)},b.project=function(a){return p("project",a)},b.universe=function(a){return p("universe",a)},b.bulk=r,b.isAvailable=s,b.resetIsAvailableCache=function(){d=void 0},b.getGCPResidency=t,b.setGCPResidency=u,b.requestTimeout=v;let j=c(79792),k=c(83346),l=c(10737),m=h(c(26981));b.BASE_PATH="/computeMetadata/v1",b.HOST_ADDRESS="http://169.254.169.254",b.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.",b.HEADER_NAME="Metadata-Flavor",b.HEADER_VALUE="Google",b.HEADERS=Object.freeze({[b.HEADER_NAME]:b.HEADER_VALUE});let n=m.log("gcp-metadata");function o(a){return a||(a=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||b.HOST_ADDRESS),/^https?:\/\//.test(a)||(a=`http://${a}`),new URL(b.BASE_PATH,a).href}async function p(a,c={},d=3,e=!1){let f=new Headers(b.HEADERS),g="",h={};("object"==typeof a?(new Headers(a.headers).forEach((a,b)=>f.set(b,a)),g=a.metadataKey,h=a.params||h,d=a.noResponseRetries||d,e=a.fastFail||e):g=a,"string"==typeof c)?g+=`/${c}`:(Object.keys(c).forEach(a=>{switch(a){case"params":case"property":case"headers":break;case"qs":throw Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw Error(`'${a}' is not a valid configuration option.`)}}),c.property&&(g+=`/${c.property}`),new Headers(c.headers).forEach((a,b)=>f.set(b,a)),h=c.params||h);let i=e?q:j.request,l={url:`${o()}/${g}`,headers:f,retryConfig:{noResponseRetries:d},params:h,responseType:"text",timeout:v()};n.info("instance request %j",l);let m=await i(l);n.info("instance metadata is %s",m.data);let r=m.headers.get(b.HEADER_NAME);if(r!==b.HEADER_VALUE)throw RangeError(`Invalid response from metadata service: incorrect ${b.HEADER_NAME} header. Expected '${b.HEADER_VALUE}', got ${r?`'${r}'`:"no header"}`);if("string"==typeof m.data)try{return k.parse(m.data)}catch{}return m.data}async function q(a){let c={...a,url:a.url?.toString().replace(o(),o(b.SECONDARY_HOST_ADDRESS))};return Promise.any([(0,j.request)(a),(0,j.request)(c)])}async function r(a){let b={};return await Promise.all(a.map(a=>(async()=>{let c=await p(a);b[a.metadataKey]=c})())),b}async function s(){if(process.env.METADATA_SERVER_DETECTION){let a=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(a in b.METADATA_SERVER_DETECTION))throw RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${a}\`, but it should be \`${Object.keys(b.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(a){case"assume-present":return!0;case"none":return!1;case"bios-only":return t()}}try{return void 0===d&&(d=p("instance",void 0,process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0,!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await d,!0}catch(a){if(process.env.DEBUG_AUTH&&console.info(a),"request-timeout"===a.type||a.response&&404===a.response.status)return!1;if(!(a.response&&404===a.response.status)&&(!a.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(a.code.toString()))){let b="UNKNOWN";a.code&&(b=a.code.toString()),process.emitWarning(`received unexpected error = ${a.message} code = ${b}`,"MetadataLookupWarning")}return!1}}function t(){return null===b.gcpResidencyCache&&u(),b.gcpResidencyCache}function u(a=null){b.gcpResidencyCache=null!==a?a:(0,l.detectGCPResidency)()}function v(){return 3e3*!t()}b.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"}),b.gcpResidencyCache=null,i(c(10737),b)},71188:(a,b,c)=>{"use strict";c.d(b,{z:()=>aV});var d=c(89850),e=c(79111),f=c(89392),g=c(18230),h=c(97832);function i(a){return Date.UTC(a.y,a.m-1,a.d,a.h,a.i,a.s)}function j(a,b){return a.y===b.y&&a.m===b.m&&a.d===b.d&&a.h===b.h&&a.i===b.i&&a.s===b.s}function k(a,b,c){return l(function(a,b){let c=new Date(Date.parse(a));if(isNaN(c))throw Error("Invalid ISO8601 passed to timezone parser.");let d=a.substring(9);return d.includes("Z")||d.includes("+")||d.includes("-")?n(c.getUTCFullYear(),c.getUTCMonth()+1,c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),"Etc/UTC"):n(c.getFullYear(),c.getMonth()+1,c.getDate(),c.getHours(),c.getMinutes(),c.getSeconds(),b)}(a,b),c)}function l(a,b){let c=new Date(i(a)),d=m(c,a.tz),e=i(a),f=i(d),g=new Date(c.getTime()+(e-f)),h=m(g,a.tz);if(j(h,a)){let b=new Date(g.getTime()-36e5);return j(m(b,a.tz),a)?b:g}let k=new Date(g.getTime()+i(a)-i(h));if(j(m(k,a.tz),a))return k;if(b)throw Error("Invalid date passed to fromTZ()");return g.getTime()>k.getTime()?g:k}function m(a,b){let c;try{c=new Intl.DateTimeFormat("en-US",{timeZone:b,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(a)}catch(c){let a=c instanceof Error?c.message:String(c);throw RangeError(`toTZ: Invalid timezone '${b}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let d={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let a of c)("year"===a.type||"month"===a.type||"day"===a.type||"hour"===a.type||"minute"===a.type||"second"===a.type)&&(d[a.type]=parseInt(a.value,10));if(isNaN(d.year)||isNaN(d.month)||isNaN(d.day)||isNaN(d.hour)||isNaN(d.minute)||isNaN(d.second))throw Error(`toTZ: Failed to parse all date components from timezone '${b}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(d)}`);return 24===d.hour&&(d.hour=0),{y:d.year,m:d.month,d:d.day,h:d.hour,i:d.minute,s:d.second,tz:b}}function n(a,b,c,d,e,f,g){return{y:a,m:b,d:c,h:d,i:e,s:f,tz:g}}var o=[1,2,4,8,16],p=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(a,b,c){this.pattern=a,this.timezone=b,this.mode=c?.mode??"auto",this.alternativeWeekdays=c?.alternativeWeekdays??!1,this.sloppyRanges=c?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!("string"==typeof this.pattern||this.pattern instanceof String))throw TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let a=this.pattern.match(/\S+/g)||[""],b=a.length;if(a.length<5||a.length>7)throw TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if("auto"!==this.mode){let a;switch(this.mode){case"5-part":a=5;break;case"6-part":a=6;break;case"7-part":a=7;break;case"5-or-6-parts":a=[5,6];break;case"6-or-7-parts":a=[6,7];break;default:a=0}if(!(Array.isArray(a)?a.includes(b):b===a)){let c=Array.isArray(a)?a.join(" or "):a.toString();throw TypeError(`CronPattern: mode '${this.mode}' requires exactly ${c} parts, but pattern '${this.pattern}' has ${b} parts.`)}}if(5===a.length&&a.unshift("0"),6===a.length&&a.push("*"),"LW"===a[3].toUpperCase()?(this.lastWeekday=!0,a[3]=""):a[3].toUpperCase().indexOf("L")>=0&&(a[3]=a[3].replace(/L/gi,""),this.lastDayOfMonth=!0),"*"==a[3]&&(this.starDOM=!0),"*"==a[6]&&(this.starYear=!0),a[4].length>=3&&(a[4]=this.replaceAlphaMonths(a[4])),a[5].length>=3&&(a[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(a[5]):this.replaceAlphaDays(a[5])),a[5].startsWith("+")&&(this.useAndLogic=!0,a[5]=a[5].substring(1),""===a[5]))throw TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch("*"==a[5]&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(a[0]=a[0].replace(/\?/g,"*"),a[1]=a[1].replace(/\?/g,"*"),a[2]=a[2].replace(/\?/g,"*"),a[3]=a[3].replace(/\?/g,"*"),a[4]=a[4].replace(/\?/g,"*"),a[5]=a[5].replace(/\?/g,"*"),a[6]&&(a[6]=a[6].replace(/\?/g,"*"))),this.mode){case"5-part":a[0]="0",a[6]="*";break;case"6-part":case"5-or-6-parts":a[6]="*"}this.throwAtIllegalCharacters(a),this.partToArray("second",a[0],0,1),this.partToArray("minute",a[1],0,1),this.partToArray("hour",a[2],0,1),this.partToArray("day",a[3],-1,1),this.partToArray("month",a[4],-1,1);let c=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",a[5],c,63),this.partToArray("year",a[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(a,b,c,d){let e=this[a],f="day"===a&&this.lastDayOfMonth,g="day"===a&&this.lastWeekday;if(""===b&&!f&&!g)throw TypeError("CronPattern: configuration entry "+a+" ("+b+") is empty, check for trailing spaces.");if("*"===b)return e.fill(d);let h=b.split(",");if(h.length>1)for(let b=0;b<h.length;b++)this.partToArray(a,h[b],c,d);else -1!==b.indexOf("-")&&-1!==b.indexOf("/")?this.handleRangeWithStepping(b,a,c,d):-1!==b.indexOf("-")?this.handleRange(b,a,c,d):-1!==b.indexOf("/")?this.handleStepping(b,a,c,d):""!==b&&this.handleNumber(b,a,c,d)}throwAtIllegalCharacters(a){for(let b=0;b<a.length;b++)if((3===b?/[^/*0-9,\-WwLl]+/:5===b?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(a[b]))throw TypeError("CronPattern: configuration entry "+b+" ("+a[b]+") contains illegal characters.")}handleNumber(a,b,c,d){let e=this.extractNth(a,b),f=a.toUpperCase().includes("W");if("day"!==b&&f)throw TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");f&&(b="nearestWeekdays");let g=parseInt(e[0],10)+c;if(isNaN(g))throw TypeError("CronPattern: "+b+" is not a number: '"+a+"'");this.setPart(b,g,e[1]||d)}setPart(a,b,c){if(!Object.prototype.hasOwnProperty.call(this,a))throw TypeError("CronPattern: Invalid part specified: "+a);if("dayOfWeek"===a){if(7===b&&(b=0),b<0||b>6)throw RangeError("CronPattern: Invalid value for dayOfWeek: "+b);this.setNthWeekdayOfMonth(b,c);return}if("second"===a||"minute"===a){if(b<0||b>=60)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("hour"===a){if(b<0||b>=24)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("day"===a||"nearestWeekdays"===a){if(b<0||b>=31)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("month"===a){if(b<0||b>=12)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("year"===a&&(b<1||b>=1e4))throw RangeError("CronPattern: Invalid value for "+a+": "+b+" (supported range: 1-9999)");this[a][b]=c}validateNotNaN(a,b){if(isNaN(a))throw TypeError(b)}validateRange(a,b,c,d,e){if(a>b)throw TypeError("CronPattern: From value is larger than to value: '"+e+"'");if(void 0!==c){if(0===c)throw TypeError("CronPattern: Syntax error, illegal stepping: 0");if(c>this[d].length)throw TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[d].length+")")}}handleRangeWithStepping(a,b,c,d){if(a.toUpperCase().includes("W"))throw TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let e=this.extractNth(a,b),f=e[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(null===f)throw TypeError("CronPattern: Syntax error, illegal range with stepping: '"+a+"'");let[,g,h,i]=f,j=parseInt(g,10)+c,k=parseInt(h,10)+c,l=parseInt(i,10);this.validateNotNaN(j,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(k,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(l,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(j,k,l,b,a);for(let a=j;a<=k;a+=l)this.setPart(b,a,e[1]||d)}extractNth(a,b){let c=a,d;if(c.includes("#")){if("dayOfWeek"!==b)throw Error("CronPattern: nth (#) only allowed in day-of-week field");d=c.split("#")[1],c=c.split("#")[0]}else if(c.toUpperCase().endsWith("L")){if("dayOfWeek"!==b)throw Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");d="L",c=c.slice(0,-1)}return[c,d]}handleRange(a,b,c,d){if(a.toUpperCase().includes("W"))throw TypeError("CronPattern: Syntax error, W is not allowed in a range.");let e=this.extractNth(a,b),f=e[0].split("-");if(2!==f.length)throw TypeError("CronPattern: Syntax error, illegal range: '"+a+"'");let g=parseInt(f[0],10)+c,h=parseInt(f[1],10)+c;this.validateNotNaN(g,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(h,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(g,h,void 0,b,a);for(let a=g;a<=h;a++)this.setPart(b,a,e[1]||d)}handleStepping(a,b,c,d){if(a.toUpperCase().includes("W"))throw TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let e=this.extractNth(a,b),f=e[0].split("/");if(2!==f.length)throw TypeError("CronPattern: Syntax error, illegal stepping: '"+a+"'");if(this.sloppyRanges)""===f[0]&&(f[0]="*");else{if(""===f[0])throw TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+a+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if("*"!==f[0])throw TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+a+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let g=0;"*"!==f[0]&&(g=parseInt(f[0],10)+c);let h=parseInt(f[1],10);this.validateNotNaN(h,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[b].length-1,h,b,a);for(let a=g;a<this[b].length;a+=h)this.setPart(b,a,e[1]||d)}replaceAlphaDays(a){return a.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(a){return a.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(a){return a.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(a){let b=a.trim().toLowerCase();if("@yearly"===b||"@annually"===b)return"0 0 1 1 *";if("@monthly"===b)return"0 0 1 * *";if("@weekly"===b)return"0 0 * * 0";if("@daily"===b||"@midnight"===b)return"0 0 * * *";if("@hourly"===b)return"0 * * * *";if("@reboot"===b)throw TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return a}setNthWeekdayOfMonth(a,b){if("number"!=typeof b&&"L"===b.toUpperCase())this.dayOfWeek[a]=32|this.dayOfWeek[a];else if(63===b)this.dayOfWeek[a]=63;else if(b<6&&b>0)this.dayOfWeek[a]=this.dayOfWeek[a]|o[b-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${b}, Type: ${typeof b}`)}},q=[31,28,31,30,31,30,31,31,30,31,30,31],r=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],s=class a{tz;ms;second;minute;hour;day;month;year;constructor(b,c){if(this.tz=c,b&&b instanceof Date)if(isNaN(b))throw TypeError("CronDate: Invalid date passed to CronDate constructor");else this.fromDate(b);else if(null==b)this.fromDate(new Date);else if(b&&"string"==typeof b)this.fromString(b);else if(b instanceof a)this.fromCronDate(b);else throw TypeError("CronDate: Invalid type ("+typeof b+") passed to CronDate constructor")}getLastDayOfMonth(a,b){return 1!==b?q[b]:new Date(Date.UTC(a,b+1,0)).getUTCDate()}getLastWeekday(a,b){let c=this.getLastDayOfMonth(a,b),d=new Date(Date.UTC(a,b,c)).getUTCDay();return 0===d?c-2:6===d?c-1:c}getNearestWeekday(a,b,c){let d=this.getLastDayOfMonth(a,b);if(c>d)return -1;let e=new Date(Date.UTC(a,b,c)).getUTCDay();return 0===e?c===d?c-2:c+1:6===e?1===c?c+2:c-1:c}isNthWeekdayOfMonth(a,b,c,d){let e=new Date(Date.UTC(a,b,c)).getUTCDay(),f=0;for(let d=1;d<=c;d++)new Date(Date.UTC(a,b,d)).getUTCDay()===e&&f++;if(63&d&&o[f-1]&d)return!0;if(32&d){let d=this.getLastDayOfMonth(a,b);for(let f=c+1;f<=d;f++)if(new Date(Date.UTC(a,b,f)).getUTCDay()===e)return!1;return!0}return!1}fromDate(a){if(void 0!==this.tz)if("number"==typeof this.tz)this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes()+this.tz,this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),this.apply();else try{let b=m(a,this.tz);this.ms=a.getMilliseconds(),this.second=b.s,this.minute=b.i,this.hour=b.h,this.day=b.d,this.month=b.m-1,this.year=b.y}catch(b){let a=b instanceof Error?b.message:String(b);throw TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${a}`)}else this.ms=a.getMilliseconds(),this.second=a.getSeconds(),this.minute=a.getMinutes(),this.hour=a.getHours(),this.day=a.getDate(),this.month=a.getMonth(),this.year=a.getFullYear()}fromCronDate(a){this.tz=a.tz,this.year=a.year,this.month=a.month,this.day=a.day,this.hour=a.hour,this.minute=a.minute,this.second=a.second,this.ms=a.ms}apply(){if(!(this.month>11)&&!(this.month<0)&&!(this.day>q[this.month])&&!(this.day<1)&&!(this.hour>59)&&!(this.minute>59)&&!(this.second>59)&&!(this.hour<0)&&!(this.minute<0)&&!(this.second<0))return!1;{let a=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes(),this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),!0}}fromString(a){if("number"!=typeof this.tz)return this.fromDate(k(a,this.tz));{let b=k(a);this.ms=b.getUTCMilliseconds(),this.second=b.getUTCSeconds(),this.minute=b.getUTCMinutes(),this.hour=b.getUTCHours(),this.day=b.getUTCDate(),this.month=b.getUTCMonth(),this.year=b.getUTCFullYear(),this.apply()}}findNext(a,b,c,d){return this._findMatch(a,b,c,d,1)}_findMatch(a,b,c,d,e){let f=this[b],g;c.lastDayOfMonth&&(g=this.getLastDayOfMonth(this.year,this.month));let h=c.starDOW||"day"!=b?void 0:new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),i=this[b]+d,j=1===e?a=>a<c[b].length:a=>a>=0;for(let k=i;j(k);k+=e){let e=c[b][k];if("day"===b&&!e){for(let a=0;a<c.nearestWeekdays.length;a++)if(c.nearestWeekdays[a]){let b=this.getNearestWeekday(this.year,this.month,a-d);if(-1===b)continue;if(b===k-d){e=1;break}}}if("day"===b&&c.lastWeekday&&k-d===this.getLastWeekday(this.year,this.month)&&(e=1),"day"===b&&c.lastDayOfMonth&&k-d==g&&(e=1),"day"===b&&!c.starDOW){let b=c.dayOfWeek[(h+(k-d-1))%7];if(b&&63&b)b=+!!this.isNthWeekdayOfMonth(this.year,this.month,k-d,b);else if(b)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${b}`);e=c.useAndLogic||a.domAndDow||c.starDOM?e&&b:e||b}if(e)return this[b]=k-d,f!==this[b]?2:1}return 3}recurse(a,b,c){if(0===c&&!a.starYear){if(this.year>=0&&this.year<a.year.length&&0===a.year[this.year]){let b=-1;for(let c=this.year+1;c<a.year.length&&c<1e4;c++)if(1===a.year[c]){b=c;break}if(-1===b)return null;this.year=b,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let d=this.findNext(b,r[c][0],a,r[c][2]);if(d>1){let e=c+1;for(;e<r.length;)this[r[e][0]]=-r[e][2],e++;if(3===d){if(this[r[c][1]]++,this[r[c][0]]=-r[c][2],this.apply(),0===c&&!a.starYear){for(;this.year>=0&&this.year<a.year.length&&0===a.year[this.year]&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=a.year.length)return null}return this.recurse(a,b,0)}if(this.apply())return this.recurse(a,b,c-1)}return(c+=1)>=r.length?this:(a.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(a,b,c)}increment(a,b,c){return this.second+=void 0!==b.interval&&b.interval>1&&c?b.interval:1,this.ms=0,this.apply(),this.recurse(a,b,0)}decrement(a,b){return this.second-=void 0!==b.interval&&b.interval>1?b.interval:1,this.ms=0,this.apply(),this.recurseBackward(a,b,0,0)}recurseBackward(a,b,c,d=0){if(d>1e4)return null;if(0===c&&!a.starYear){if(this.year>=0&&this.year<a.year.length&&0===a.year[this.year]){let b=-1;for(let c=this.year-1;c>=0;c--)if(1===a.year[c]){b=c;break}if(-1===b)return null;this.year=b,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let e=this.findPrevious(b,r[c][0],a,r[c][2]);if(e>1){let f=c+1;for(;f<r.length;){let b=r[f][0],c=r[f][2],d=this.getMaxPatternValue(b,a,c);this[b]=d,f++}if(3===e){if(this[r[c][1]]--,0===c){let a=this.getLastDayOfMonth(this.year,this.month);this.day>a&&(this.day=a)}if(1===c)if(this.day<=0)this.day=1;else{let a=this.year,b=this.month;for(;b<0;)b+=12,a--;for(;b>11;)b-=12,a++;let c=1!==b?q[b]:new Date(Date.UTC(a,b+1,0)).getUTCDate();this.day>c&&(this.day=c)}this.apply();let e=r[c][0],f=r[c][2],g=this.getMaxPatternValue(e,a,f);if("day"===e){let a=this.getLastDayOfMonth(this.year,this.month);this[e]=Math.min(g,a)}else this[e]=g;if(this.apply(),0===c){let b=r[1][2],c=Math.min(this.getMaxPatternValue("day",a,b),this.getLastDayOfMonth(this.year,this.month));c!==this.day&&(this.day=c,this.hour=this.getMaxPatternValue("hour",a,r[2][2]),this.minute=this.getMaxPatternValue("minute",a,r[3][2]),this.second=this.getMaxPatternValue("second",a,r[4][2]))}if(0===c&&!a.starYear){for(;this.year>=0&&this.year<a.year.length&&0===a.year[this.year];)this.year--;if(this.year<0)return null}return this.recurseBackward(a,b,0,d+1)}if(this.apply())return this.recurseBackward(a,b,c-1,d+1)}return(c+=1)>=r.length?this:this.year<0?null:this.recurseBackward(a,b,c,d+1)}getMaxPatternValue(a,b,c){if("day"===a&&b.lastDayOfMonth||"day"===a&&!b.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let d=b[a].length-1;d>=0;d--)if(b[a][d])return d-c;return b[a].length-1-c}findPrevious(a,b,c,d){return this._findMatch(a,b,c,d,-1)}getDate(a){return a||void 0===this.tz?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):"number"==typeof this.tz?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):l(n(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(a,b){if(!a.starYear&&(this.year<0||this.year>=a.year.length||0===a.year[this.year]))return!1;for(let c=0;c<r.length;c++){let d=r[c][0],e=r[c][2],f=this[d];if(f+e<0||f+e>=a[d].length)return!1;let g=a[d][f+e];if("day"===d){if(!g){for(let b=0;b<a.nearestWeekdays.length;b++)if(a.nearestWeekdays[b]){let a=this.getNearestWeekday(this.year,this.month,b-e);if(-1!==a&&a===f){g=1;break}}}if(a.lastWeekday&&f===this.getLastWeekday(this.year,this.month)&&(g=1),a.lastDayOfMonth&&f===this.getLastDayOfMonth(this.year,this.month)&&(g=1),!a.starDOW){let c=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),d=a.dayOfWeek[(c+(f-1))%7];d&&63&d&&(d=+!!this.isNthWeekdayOfMonth(this.year,this.month,f,d)),g=a.useAndLogic||b.domAndDow||a.starDOM?g&&d:g||d}}if(!g)return!1}return!0}};function t(a){return"[object Function]"===Object.prototype.toString.call(a)||"function"==typeof a||a instanceof Function}var u=[],v=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(a){if(void 0!==this.options.dayOffset&&0!==this.options.dayOffset){let b=24*this.options.dayOffset*36e5;return new Date(a.getTime()+b)}return a}constructor(a,b,c){let d,e;if(t(b))e=b;else if("object"==typeof b)d=b;else if(void 0!==b)throw Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(t(c))e=c;else if("object"==typeof c)d=c;else if(void 0!==c)throw Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=d?.name,this.options=function(a){if(void 0===a&&(a={}),delete a.name,void 0!==a.legacyMode&&void 0===a.domAndDow?a.domAndDow=!a.legacyMode:void 0===a.domAndDow&&(a.domAndDow=!1),a.legacyMode=!a.domAndDow,a.paused=void 0!==a.paused&&a.paused,a.maxRuns=void 0===a.maxRuns?1/0:a.maxRuns,a.catch=void 0!==a.catch&&a.catch,a.interval=void 0===a.interval?0:parseInt(a.interval.toString(),10),a.utcOffset=void 0===a.utcOffset?void 0:parseInt(a.utcOffset.toString(),10),a.dayOffset=void 0===a.dayOffset?0:parseInt(a.dayOffset.toString(),10),a.unref=void 0!==a.unref&&a.unref,a.mode=void 0===a.mode?"auto":a.mode,a.alternativeWeekdays=void 0!==a.alternativeWeekdays&&a.alternativeWeekdays,a.sloppyRanges=void 0!==a.sloppyRanges&&a.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(a.mode))throw Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(a.startAt&&(a.startAt=new s(a.startAt,a.timezone)),a.stopAt&&(a.stopAt=new s(a.stopAt,a.timezone)),null!==a.interval){if(isNaN(a.interval))throw Error("CronOptions: Supplied value for interval is not a number");if(a.interval<0)throw Error("CronOptions: Supplied value for interval can not be negative")}if(void 0!==a.utcOffset){if(isNaN(a.utcOffset))throw Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(a.utcOffset<-870||a.utcOffset>870)throw Error("CronOptions: utcOffset out of bounds.");if(void 0!==a.utcOffset&&a.timezone)throw Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(!0!==a.unref&&!1!==a.unref)throw Error("CronOptions: Unref should be either true, false or undefined(false).");if(void 0!==a.dayOffset&&0!==a.dayOffset&&isNaN(a.dayOffset))throw Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return a}(d),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:d?d.maxRuns:void 0,paused:!!d&&d.paused,pattern:new p("* * * * *",void 0,{mode:"auto"})},a&&(a instanceof Date||"string"==typeof a&&a.indexOf(":")>0)?this._states.once=new s(a,this.getTz()):this._states.pattern=new p(a,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(u.find(a=>a.name===this.name))throw Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");u.push(this)}return void 0!==e&&t(e)&&(this.fn=e,this.schedule()),this}nextRun(a){let b=this._next(a);return b?this.applyDayOffset(b.getDate(!1)):null}nextRuns(a,b){void 0!==this._states.maxRuns&&a>this._states.maxRuns&&(a=this._states.maxRuns);let c=b||this._states.currentRun||void 0;return this._enumerateRuns(a,c,"next")}previousRuns(a,b){return this._enumerateRuns(a,b||void 0,"previous")}_enumerateRuns(a,b,c){let d=[],e=b?new s(b,this.getTz()):null,f="next"===c?this._next:this._previous;for(;a--;){let a=f.call(this,e);if(!a)break;let b=a.getDate(!1);d.push(this.applyDayOffset(b)),e=a}return d}match(a){if(this._states.once){let b=new s(a,this.getTz());b.ms=0;let c=new s(this._states.once,this.getTz());return c.ms=0,b.getTime()===c.getTime()}let b=new s(a,this.getTz());return b.ms=0,b.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let a=this.nextRun(this._states.currentRun),b=!this._states.paused,c=void 0!==this.fn,d=!this._states.kill;return b&&c&&d&&null!==a}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(a){let b=this._next(a);return b?a instanceof s||a instanceof Date?b.getTime()-a.getTime():b.getTime()-new s(a).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let a=u.indexOf(this);a>=0&&u.splice(a,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(a){var b;if(a&&this.fn)throw Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");a&&(this.fn=a);let c=this.msToNext(),d=this.nextRun(this._states.currentRun);return null==c||isNaN(c)||null===d||(c>3e4&&(c=3e4),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(d),c),this._states.currentTimeout&&this.options.unref&&(b=this._states.currentTimeout,"u">typeof Deno&&"u">typeof Deno.unrefTimer?Deno.unrefTimer(b):b&&"u">typeof b.unref&&b.unref())),this}async _trigger(a){this._states.blocking=!0,this._states.currentRun=new s(void 0,this.getTz());try{if(this.options.catch)try{void 0!==this.fn&&await this.fn(this,this.options.context)}catch(a){if(t(this.options.catch))try{this.options.catch(a,this)}catch{}}else void 0!==this.fn&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new s(a,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(a){let b=new Date,c=!this._states.paused&&b.getTime()>=a.getTime(),d=this._states.blocking&&this.options.protect;c&&!d?(void 0!==this._states.maxRuns&&this._states.maxRuns--,this._trigger()):c&&d&&t(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(a){let b=!!(a||this._states.currentRun),c=!1;!a&&this.options.startAt&&this.options.interval&&([a,b]=this._calculatePreviousRun(a,b),c=!a),a=new s(a,this.getTz()),this.options.startAt&&a&&a.getTime()<this.options.startAt.getTime()&&(a=this.options.startAt);let d=this._states.once||new s(a,this.getTz());return c||d===this._states.once||(d=d.increment(this._states.pattern,this.options,b)),this._states.once&&this._states.once.getTime()<=a.getTime()||null===d||void 0!==this._states.maxRuns&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&d.getTime()>=this.options.stopAt.getTime()?null:d}_previous(a){let b=new s(a,this.getTz());this.options.stopAt&&b.getTime()>this.options.stopAt.getTime()&&(b=this.options.stopAt);let c=new s(b,this.getTz());return this._states.once?this._states.once.getTime()<b.getTime()?this._states.once:null:null===(c=c.decrement(this._states.pattern,this.options))||this.options.startAt&&c.getTime()<this.options.startAt.getTime()?null:c}_calculatePreviousRun(a,b){let c=new s(void 0,this.getTz()),d=a;if(this.options.startAt.getTime()<=c.getTime()){let a=(d=this.options.startAt).getTime()+1e3*this.options.interval;for(;a<=c.getTime();)a=(d=new s(d,this.getTz()).increment(this._states.pattern,this.options,!0)).getTime()+1e3*this.options.interval;b=!0}return null===d&&(d=void 0),[d,b]}};function w(a,b){try{let c=new v(a,{timezone:b,paused:!0});return c.nextRun(),c.stop(),{valid:!0}}catch(a){return{valid:!1,error:a instanceof Error?a.message:"Invalid cron pattern"}}}var x=c(33873),y=c.n(x),z=c(29021),A=c(79748),B=c(94735),C=c(51455),D=c(57075),E=c(76760);let F={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},G={root:".",fileFilter:a=>!0,directoryFilter:a=>!0,type:F.FILE_TYPE,lstat:!1,depth:0x80000000,alwaysStat:!1,highWaterMark:4096};Object.freeze(G);let H="READDIRP_RECURSIVE_ERROR",I=new Set(["ENOENT","EPERM","EACCES","ELOOP",H]),J=[F.DIR_TYPE,F.EVERYTHING_TYPE,F.FILE_DIR_TYPE,F.FILE_TYPE],K=new Set([F.DIR_TYPE,F.EVERYTHING_TYPE,F.FILE_DIR_TYPE]),L=new Set([F.EVERYTHING_TYPE,F.FILE_DIR_TYPE,F.FILE_TYPE]),M="win32"===process.platform,N=a=>!0,O=a=>{if(void 0===a)return N;if("function"==typeof a)return a;if("string"==typeof a){let b=a.trim();return a=>a.basename===b}if(Array.isArray(a)){let b=a.map(a=>a.trim());return a=>b.some(b=>a.basename===b)}return N};class P extends D.Readable{constructor(a={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:a.highWaterMark});let b={...G,...a},{root:c,type:d}=b;this._fileFilter=O(b.fileFilter),this._directoryFilter=O(b.directoryFilter);let e=b.lstat?C.lstat:C.stat;M?this._stat=a=>e(a,{bigint:!0}):this._stat=e,this._maxDepth=b.depth??G.depth,this._wantsDir=!!d&&K.has(d),this._wantsFile=!!d&&L.has(d),this._wantsEverything=d===F.EVERYTHING_TYPE,this._root=(0,E.resolve)(c),this._isDirent=!b.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(c,1)],this.reading=!1,this.parent=void 0}async _read(a){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&a>0;){let b=this.parent,c=b&&b.files;if(c&&c.length>0){let{path:d,depth:e}=b,f=c.splice(0,a).map(a=>this._formatEntry(a,d));for(let b of(await Promise.all(f))){if(!b)continue;if(this.destroyed)return;let c=await this._getEntryType(b);"directory"===c&&this._directoryFilter(b)?(e<=this._maxDepth&&this.parents.push(this._exploreDir(b.fullPath,e+1)),this._wantsDir&&(this.push(b),a--)):("file"===c||this._includeAsFile(b))&&this._fileFilter(b)&&this._wantsFile&&(this.push(b),a--)}}else{let a=this.parents.pop();if(!a){this.push(null);break}if(this.parent=await a,this.destroyed)return}}}catch(a){this.destroy(a)}finally{this.reading=!1}}}async _exploreDir(a,b){let c;try{c=await (0,C.readdir)(a,this._rdOptions)}catch(a){this._onError(a)}return{files:c,depth:b,path:a}}async _formatEntry(a,b){let c,d=this._isDirent?a.name:a;try{let e=(0,E.resolve)((0,E.join)(b,d));(c={path:(0,E.relative)(this._root,e),fullPath:e,basename:d})[this._statsProp]=this._isDirent?a:await this._stat(e)}catch(a){this._onError(a);return}return c}_onError(a){I.has(a.code)&&!this.destroyed?this.emit("warn",a):this.destroy(a)}async _getEntryType(a){if(!a&&this._statsProp in a)return"";let b=a[this._statsProp];if(b.isFile())return"file";if(b.isDirectory())return"directory";if(b&&b.isSymbolicLink()){let b=a.fullPath;try{let a=await (0,C.realpath)(b),c=await (0,C.lstat)(a);if(c.isFile())return"file";if(c.isDirectory()){let c=a.length;if(b.startsWith(a)&&b.substr(c,1)===E.sep){let c=Error(`Circular symlink detected: "${b}" points to "${a}"`);return c.code=H,this._onError(c)}return"directory"}}catch(a){return this._onError(a),""}}}_includeAsFile(a){let b=a&&a[this._statsProp];return b&&this._wantsEverything&&!b.isDirectory()}}var Q=c(21820);let R=()=>{},S=process.platform,T="win32"===S,U="darwin"===S,V="linux"===S,W="freebsd"===S,X="OS400"===(0,Q.type)(),Y={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},Z={lstat:A.lstat,stat:A.stat},$="listeners",_="errHandlers",aa="rawEmitters",ab=[$,_,aa],ac=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ad=(a,b)=>{a instanceof Set?a.forEach(b):b(a)},ae=(a,b,c)=>{let d=a[b];d instanceof Set||(a[b]=d=new Set([d])),d.add(c)},af=(a,b,c)=>{let d=a[b];d instanceof Set?d.delete(c):d===c&&delete a[b]},ag=a=>a instanceof Set?0===a.size:!a,ah=new Map;function ai(a,b,c,d,e){try{return(0,z.watch)(a,{persistent:b.persistent},(b,d)=>{c(a),e(b,d,{watchedPath:a}),d&&a!==d&&aj(x.resolve(a,d),$,x.join(a,d))})}catch(a){d(a);return}}let aj=(a,b,c,d,e)=>{let f=ah.get(a);f&&ad(f[b],a=>{a(c,d,e)})},ak=new Map;class al{constructor(a){this.fsw=a,this._boundHandleError=b=>a._handleError(b)}_watchWithNodeFs(a,b){let c,d=this.fsw.options,e=x.dirname(a),f=x.basename(a);this.fsw._getWatchedDir(e).add(f);let g=x.resolve(a),h={persistent:d.persistent};if(b||(b=R),d.usePolling)h.interval=d.interval!==d.binaryInterval&&ac.has(x.extname(f).slice(1).toLowerCase())?d.binaryInterval:d.interval,c=((a,b,c,d)=>{let{listener:e,rawEmitter:f}=d,g=ak.get(b),h=g&&g.options;return h&&(h.persistent<c.persistent||h.interval>c.interval)&&((0,z.unwatchFile)(b),g=void 0),g?(ae(g,$,e),ae(g,aa,f)):(g={listeners:e,rawEmitters:f,options:c,watcher:(0,z.watchFile)(b,c,(c,d)=>{ad(g.rawEmitters,a=>{a(Y.CHANGE,b,{curr:c,prev:d})});let e=c.mtimeMs;(c.size!==d.size||e>d.mtimeMs||0===e)&&ad(g.listeners,b=>b(a,c))})},ak.set(b,g)),()=>{af(g,$,e),af(g,aa,f),ag(g.listeners)&&(ak.delete(b),(0,z.unwatchFile)(b),g.options=g.watcher=void 0,Object.freeze(g))}})(a,g,h,{listener:b,rawEmitter:this.fsw._emitRaw});else c=((a,b,c,d)=>{let e,{listener:f,errHandler:g,rawEmitter:h}=d,i=ah.get(b);if(!c.persistent){if(!(e=ai(a,c,f,g,h)))return;return e.close.bind(e)}if(i)ae(i,$,f),ae(i,_,g),ae(i,aa,h);else{if(!(e=ai(a,c,aj.bind(null,b,$),g,aj.bind(null,b,aa))))return;e.on(Y.ERROR,async c=>{let d=aj.bind(null,b,_);if(i&&(i.watcherUnusable=!0),T&&"EPERM"===c.code)try{let b=await (0,A.open)(a,"r");await b.close(),d(c)}catch(a){}else d(c)}),i={listeners:f,errHandlers:g,rawEmitters:h,watcher:e},ah.set(b,i)}return()=>{let a;af(i,$,f),af(i,_,g),af(i,aa,h),ag(i.listeners)&&(i.watcher.close(),ah.delete(b),ab.forEach((a=i,b=>{let c=a[b];c instanceof Set?c.clear():delete a[b]})),i.watcher=void 0,Object.freeze(i))}})(a,g,h,{listener:b,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(a,b,c){if(this.fsw.closed)return;let d=x.dirname(a),e=x.basename(a),f=this.fsw._getWatchedDir(d),g=b;if(f.has(e))return;let h=async(b,c)=>{if(this.fsw._throttle("watch",a,5))if(c&&0!==c.mtimeMs){if(f.has(e)){let b=c.atimeMs,d=c.mtimeMs;(!b||b<=d||d!==g.mtimeMs)&&this.fsw._emit(Y.CHANGE,a,c),g=c}}else try{let c=await (0,A.stat)(a);if(this.fsw.closed)return;let d=c.atimeMs,e=c.mtimeMs;if((!d||d<=e||e!==g.mtimeMs)&&this.fsw._emit(Y.CHANGE,a,c),(U||V||W)&&g.ino!==c.ino){this.fsw._closeFile(b),g=c;let d=this._watchWithNodeFs(a,h);d&&this.fsw._addPathCloser(b,d)}else g=c}catch(a){this.fsw._remove(d,e)}},i=this._watchWithNodeFs(a,h);if(!(c&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(a)){if(!this.fsw._throttle(Y.ADD,a,0))return;this.fsw._emit(Y.ADD,a,b)}return i}async _handleSymlink(a,b,c,d){if(this.fsw.closed)return;let e=a.fullPath,f=this.fsw._getWatchedDir(b);if(!this.fsw.options.followSymlinks){let b;this.fsw._incrReadyCount();try{b=await (0,A.realpath)(c)}catch(a){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return f.has(d)?this.fsw._symlinkPaths.get(e)!==b&&(this.fsw._symlinkPaths.set(e,b),this.fsw._emit(Y.CHANGE,c,a.stats)):(f.add(d),this.fsw._symlinkPaths.set(e,b),this.fsw._emit(Y.ADD,c,a.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(e))return!0;this.fsw._symlinkPaths.set(e,!0)}_handleRead(a,b,c,d,e,f,g){if(a=x.join(a,""),!(g=this.fsw._throttle("readdir",a,1e3)))return;let h=this.fsw._getWatchedDir(c.path),i=new Set,j=this.fsw._readdirp(a,{fileFilter:a=>c.filterPath(a),directoryFilter:a=>c.filterDir(a)});if(j)return j.on("data",async g=>{if(this.fsw.closed){j=void 0;return}let k=g.path,l=x.join(a,k);if(i.add(k),!(g.stats.isSymbolicLink()&&await this._handleSymlink(g,a,l,k))){if(this.fsw.closed){j=void 0;return}k!==d&&(d||h.has(k))||(this.fsw._incrReadyCount(),l=x.join(e,x.relative(e,l)),this._addToNodeFs(l,b,c,f+1))}}).on(Y.ERROR,this._boundHandleError),new Promise((b,k)=>{if(!j)return k();j.once("end",()=>{if(this.fsw.closed){j=void 0;return}let k=!!g&&g.clear();b(void 0),h.getChildren().filter(b=>b!==a&&!i.has(b)).forEach(b=>{this.fsw._remove(a,b)}),j=void 0,k&&this._handleRead(a,!1,c,d,e,f,g)})})}async _handleDir(a,b,c,d,e,f,g){let h,i,j=this.fsw._getWatchedDir(x.dirname(a)),k=j.has(x.basename(a));c&&this.fsw.options.ignoreInitial||e||k||this.fsw._emit(Y.ADD_DIR,a,b),j.add(x.basename(a)),this.fsw._getWatchedDir(a);let l=this.fsw.options.depth;if((null==l||d<=l)&&!this.fsw._symlinkPaths.has(g)){if(!e&&(await this._handleRead(a,c,f,e,a,d,h),this.fsw.closed))return;i=this._watchWithNodeFs(a,(b,c)=>{c&&0===c.mtimeMs||this._handleRead(b,!1,f,e,a,d,h)})}return i}async _addToNodeFs(a,b,c,d,e){let f=this.fsw._emitReady;if(this.fsw._isIgnored(a)||this.fsw.closed)return f(),!1;let g=this.fsw._getWatchHelpers(a);c&&(g.filterPath=a=>c.filterPath(a),g.filterDir=a=>c.filterDir(a));try{let c,h=await Z[g.statMethod](g.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(g.watchPath,h))return f(),!1;let i=this.fsw.options.followSymlinks;if(h.isDirectory()){let f=x.resolve(a),j=i?await (0,A.realpath)(a):a;if(this.fsw.closed||(c=await this._handleDir(g.watchPath,h,b,d,e,g,j),this.fsw.closed))return;f!==j&&void 0!==j&&this.fsw._symlinkPaths.set(f,j)}else if(h.isSymbolicLink()){let e=i?await (0,A.realpath)(a):a;if(this.fsw.closed)return;let f=x.dirname(g.watchPath);if(this.fsw._getWatchedDir(f).add(g.watchPath),this.fsw._emit(Y.ADD,g.watchPath,h),c=await this._handleDir(f,h,b,d,a,g,e),this.fsw.closed)return;void 0!==e&&this.fsw._symlinkPaths.set(x.resolve(a),e)}else c=this._handleFile(g.watchPath,h,b);return f(),c&&this.fsw._addPathCloser(a,c),!1}catch(b){if(this.fsw._handleError(b))return f(),a}}}let am=/\\/g,an=/\/\//,ao=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ap=/^\.[/\\]/;function aq(a){return Array.isArray(a)?a:[a]}let ar=a=>"object"==typeof a&&null!==a&&!(a instanceof RegExp);function as(a,b,c){let d=function(a){if("string"!=typeof a)throw Error("string expected");a=(a=x.normalize(a)).replace(/\\/g,"/");let b=!1;a.startsWith("//")&&(b=!0);let c=/\/\//;for(;a.match(c);)a=a.replace(c,"/");return b&&(a="/"+a),a}(b);for(let b=0;b<a.length;b++)if((0,a[b])(d,c))return!0;return!1}let at=a=>{let b=aq(a).flat();if(!b.every(a=>"string"==typeof a))throw TypeError(`Non-string provided as watch path: ${b}`);return b.map(av)},au=a=>{let b=a.replace(am,"/"),c=!1;for(b.startsWith("//")&&(c=!0);b.match(an);)b=b.replace(an,"/");return c&&(b="/"+b),b},av=a=>au(x.normalize(au(a))),aw=(a="")=>b=>"string"==typeof b?av(x.isAbsolute(b)?b:x.join(a,b)):b,ax=Object.freeze(new Set);class ay{constructor(a,b){this.path=a,this._removeWatcher=b,this.items=new Set}add(a){let{items:b}=this;b&&"."!==a&&".."!==a&&b.add(a)}async remove(a){let{items:b}=this;if(!b||(b.delete(a),b.size>0))return;let c=this.path;try{await (0,A.readdir)(c)}catch(a){this._removeWatcher&&this._removeWatcher(x.dirname(c),x.basename(c))}}has(a){let{items:b}=this;if(b)return b.has(a)}getChildren(){let{items:a}=this;return a?[...a.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=R,this.items=ax,Object.freeze(this)}}class az{constructor(a,b,c){this.fsw=c;let d=a;this.path=a=a.replace(ap,""),this.watchPath=d,this.fullWatchPath=x.resolve(d),this.dirParts=[],this.dirParts.forEach(a=>{a.length>1&&a.pop()}),this.followSymlinks=b,this.statMethod=b?"stat":"lstat"}entryPath(a){return x.join(this.watchPath,x.relative(this.watchPath,a.fullPath))}filterPath(a){let{stats:b}=a;if(b&&b.isSymbolicLink())return this.filterDir(a);let c=this.entryPath(a);return this.fsw._isntIgnored(c,b)&&this.fsw._hasReadPermissions(b)}filterDir(a){return this.fsw._isntIgnored(this.entryPath(a),a.stats)}}class aA extends B.EventEmitter{constructor(a={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let b=a.awaitWriteFinish,c={stabilityThreshold:2e3,pollInterval:100},d={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...a,ignored:a.ignored?aq(a.ignored):aq([]),awaitWriteFinish:!0===b?c:"object"==typeof b&&{...c,...b}};X&&(d.usePolling=!0),void 0===d.atomic&&(d.atomic=!d.usePolling);let e=process.env.CHOKIDAR_USEPOLLING;if(void 0!==e){let a=e.toLowerCase();"false"===a||"0"===a?d.usePolling=!1:"true"===a||"1"===a?d.usePolling=!0:d.usePolling=!!a}let f=process.env.CHOKIDAR_INTERVAL;f&&(d.interval=Number.parseInt(f,10));let g=0;this._emitReady=()=>{++g>=this._readyCount&&(this._emitReady=R,this._readyEmitted=!0,process.nextTick(()=>this.emit(Y.READY)))},this._emitRaw=(...a)=>this.emit(Y.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=d,this._nodeFsHandler=new al(this),Object.freeze(d)}_addIgnoredPath(a){if(ar(a)){for(let b of this._ignoredPaths)if(ar(b)&&b.path===a.path&&b.recursive===a.recursive)return}this._ignoredPaths.add(a)}_removeIgnoredPath(a){if(this._ignoredPaths.delete(a),"string"==typeof a)for(let b of this._ignoredPaths)ar(b)&&b.path===a&&this._ignoredPaths.delete(b)}add(a,b,c){let{cwd:d}=this.options;this.closed=!1,this._closePromise=void 0;let e=at(a);return d&&(e=e.map(a=>x.isAbsolute(a)?a:x.join(d,a))),e.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=e.length,Promise.all(e.map(async a=>{let d=await this._nodeFsHandler._addToNodeFs(a,!c,void 0,0,b);return d&&this._emitReady(),d})).then(a=>{this.closed||a.forEach(a=>{a&&this.add(x.dirname(a),x.basename(b||a))})}),this}unwatch(a){if(this.closed)return this;let b=at(a),{cwd:c}=this.options;return b.forEach(a=>{x.isAbsolute(a)||this._closers.has(a)||(c&&(a=x.join(c,a)),a=x.resolve(a)),this._closePath(a),this._addIgnoredPath(a),this._watched.has(a)&&this._addIgnoredPath({path:a,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let a=[];return this._closers.forEach(b=>b.forEach(b=>{let c=b();c instanceof Promise&&a.push(c)})),this._streams.forEach(a=>a.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(a=>a.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=a.length?Promise.all(a).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let a={};return this._watched.forEach((b,c)=>{a[(this.options.cwd?x.relative(this.options.cwd,c):c)||"."]=b.getChildren().sort()}),a}emitWithAll(a,b){this.emit(a,...b),a!==Y.ERROR&&this.emit(Y.ALL,a,...b)}async _emit(a,b,c){let d;if(this.closed)return;let e=this.options;T&&(b=x.normalize(b)),e.cwd&&(b=x.relative(e.cwd,b));let f=[b];null!=c&&f.push(c);let g=e.awaitWriteFinish;if(g&&(d=this._pendingWrites.get(b)))return d.lastChange=new Date,this;if(e.atomic){if(a===Y.UNLINK)return this._pendingUnlinks.set(b,[a,...f]),setTimeout(()=>{this._pendingUnlinks.forEach((a,b)=>{this.emit(...a),this.emit(Y.ALL,...a),this._pendingUnlinks.delete(b)})},"number"==typeof e.atomic?e.atomic:100),this;a===Y.ADD&&this._pendingUnlinks.has(b)&&(a=Y.CHANGE,this._pendingUnlinks.delete(b))}if(g&&(a===Y.ADD||a===Y.CHANGE)&&this._readyEmitted){let c=(b,c)=>{b?(a=Y.ERROR,f[0]=b,this.emitWithAll(a,f)):c&&(f.length>1?f[1]=c:f.push(c),this.emitWithAll(a,f))};return this._awaitWriteFinish(b,g.stabilityThreshold,a,c),this}if(a===Y.CHANGE&&!this._throttle(Y.CHANGE,b,50))return this;if(e.alwaysStat&&void 0===c&&(a===Y.ADD||a===Y.ADD_DIR||a===Y.CHANGE)){let a,c=e.cwd?x.join(e.cwd,b):b;try{a=await (0,A.stat)(c)}catch(a){}if(!a||this.closed)return;f.push(a)}return this.emitWithAll(a,f),this}_handleError(a){let b=a&&a.code;return a&&"ENOENT"!==b&&"ENOTDIR"!==b&&(!this.options.ignorePermissionErrors||"EPERM"!==b&&"EACCES"!==b)&&this.emit(Y.ERROR,a),a||this.closed}_throttle(a,b,c){let d;this._throttled.has(a)||this._throttled.set(a,new Map);let e=this._throttled.get(a);if(!e)throw Error("invalid throttle");let f=e.get(b);if(f)return f.count++,!1;let g=()=>{let a=e.get(b),c=a?a.count:0;return e.delete(b),clearTimeout(d),a&&clearTimeout(a.timeoutObject),c},h={timeoutObject:d=setTimeout(g,c),clear:g,count:0};return e.set(b,h),h}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(a,b,c,d){let e,f=this.options.awaitWriteFinish;if("object"!=typeof f)return;let g=f.pollInterval,h=a;this.options.cwd&&!x.isAbsolute(a)&&(h=x.join(this.options.cwd,a));let i=new Date,j=this._pendingWrites;j.has(a)||(j.set(a,{lastChange:i,cancelWait:()=>(j.delete(a),clearTimeout(e),c)}),e=setTimeout(function c(f){(0,z.stat)(h,(h,i)=>{if(h||!j.has(a)){h&&"ENOENT"!==h.code&&d(h);return}let k=Number(new Date);f&&i.size!==f.size&&(j.get(a).lastChange=k),k-j.get(a).lastChange>=b?(j.delete(a),d(void 0,i)):e=setTimeout(c,g,i)})},g))}_isIgnored(a,b){if(this.options.atomic&&ao.test(a))return!0;if(!this._userIgnored){let{cwd:a}=this.options,b=(this.options.ignored||[]).map(aw(a)),c=[...[...this._ignoredPaths].map(aw(a)),...b];this._userIgnored=function(a,b){if(null==a)throw TypeError("anymatch: specify first argument");let c=aq(a).map(a=>"function"==typeof a?a:"string"==typeof a?b=>a===b:a instanceof RegExp?b=>a.test(b):"object"==typeof a&&null!==a?b=>{if(a.path===b)return!0;if(a.recursive){let c=x.relative(a.path,b);return!!c&&!c.startsWith("..")&&!x.isAbsolute(c)}return!1}:()=>!1);return null==b?(a,b)=>as(c,a,b):as(c,b)}(c,void 0)}return this._userIgnored(a,b)}_isntIgnored(a,b){return!this._isIgnored(a,b)}_getWatchHelpers(a){return new az(a,this.options.followSymlinks,this)}_getWatchedDir(a){let b=x.resolve(a);return this._watched.has(b)||this._watched.set(b,new ay(b,this._boundRemove)),this._watched.get(b)}_hasReadPermissions(a){return!!this.options.ignorePermissionErrors||!!(256&Number(a.mode))}_remove(a,b,c){let d=x.join(a,b),e=x.resolve(d);if(c=null!=c?c:this._watched.has(d)||this._watched.has(e),!this._throttle("remove",d,100))return;c||1!==this._watched.size||this.add(a,b,!0),this._getWatchedDir(d).getChildren().forEach(a=>this._remove(d,a));let f=this._getWatchedDir(a),g=f.has(b);f.remove(b),this._symlinkPaths.has(e)&&this._symlinkPaths.delete(e);let h=d;if(this.options.cwd&&(h=x.relative(this.options.cwd,d)),this.options.awaitWriteFinish&&this._pendingWrites.has(h)&&this._pendingWrites.get(h).cancelWait()===Y.ADD)return;this._watched.delete(d),this._watched.delete(e);let i=c?Y.UNLINK_DIR:Y.UNLINK;g&&!this._isIgnored(d)&&this._emit(i,d),this._closePath(d)}_closePath(a){this._closeFile(a);let b=x.dirname(a);this._getWatchedDir(b).remove(x.basename(a))}_closeFile(a){let b=this._closers.get(a);b&&(b.forEach(a=>a()),this._closers.delete(a))}_addPathCloser(a,b){if(!b)return;let c=this._closers.get(a);c||(c=[],this._closers.set(a,c)),c.push(b)}_readdirp(a,b){if(this.closed)return;let c=function(a,b={}){let c=b.entryType||b.type;if("both"===c&&(c=F.FILE_DIR_TYPE),c&&(b.type=c),a){if("string"!=typeof a)throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(c&&!J.includes(c))throw Error(`readdirp: Invalid type passed. Use one of ${J.join(", ")}`)}else throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");return b.root=a,new P(b)}(a,{type:Y.ALL,alwaysStat:!0,lstat:!0,...b,depth:0});return this._streams.add(c),c.once("close",()=>{c=void 0}),c.once("end",()=>{c&&(this._streams.delete(c),c=void 0)}),c}}let aB=(0,g.h)("backend/services/scheduler/triggers/fileWatch");function aC(a){let b=Math.max(5,Math.round((a??6e4)/1e3));if(b<60)return`*/${b} * * * * *`;let c=Math.max(1,Math.round(b/60));if(c<60)return`*/${c} * * * *`;let d=Math.max(1,Math.min(23,Math.round(c/60)));return`0 */${d} * * *`}var aD=c(26358);let aE=(0,g.h)("backend/services/scheduler/triggers/mcpPoll"),aF=(0,g.h)("backend/services/scheduler/triggers/urlWatch"),aG=(0,g.h)("backend/services/scheduler/runHistory"),aH=a=>`planned-execution-runs/${a}`,aI=new Map;async function aJ(a){try{return await (0,e.YM)(aH(a),[])}catch(b){return aG.error(`Failed to load run history for ${a}:`,b),[]}}async function aK(a,b){let c=(aI.get(a)??Promise.resolve()).catch(()=>{}).then(async()=>{let c=await aJ(a);c.push(b);let d=c.slice(-100);await (0,e.VH)(aH(a),d)});aI.set(a,c);try{await c}finally{aI.get(a)===c&&aI.delete(a)}}async function aL(a){let b=await aJ(a);return b.length>0?b[b.length-1]:null}async function aM(a){await (0,e.N2)(aH(a))}let aN=(0,g.h)("backend/services/scheduler/state"),aO=a=>`planned-execution-state/${a}`;async function aP(a){try{return await (0,e.YM)(aO(a),{})}catch(b){return aN.error(`Failed to load trigger state for ${a}:`,b),{}}}async function aQ(a,b){await (0,e.VH)(aO(a),b)}async function aR(a){await (0,e.N2)(aO(a))}let aS=(0,g.h)("backend/services/scheduler/index"),aT={version:1,paused:!1,executions:[]};class aU{async start(){this.started||(this.started=!0,aS.info("Starting scheduler"),await this.reconcile())}reconcile(){let a=this.reconcileChain.catch(()=>{}).then(()=>this.doReconcile());return this.reconcileChain=a,a}async doReconcile(){for(let[a,b]of this.armed)try{b.dispose()}catch(b){aS.warn(`Failed to dispose trigger for ${a}:`,b)}this.armed.clear();let a=await this.loadFile();if(this.pausedCache=a.paused,a.paused)return void aS.info("Scheduler is paused — nothing armed");for(let b of a.executions)if(b.enabled)try{await this.armExecution(b)}catch(c){let a=c instanceof Error?c.message:String(c);this.lastTriggerErrors.set(b.id,a),aS.error(`Failed to arm "${b.name}" (${b.id}):`,c)}aS.info(`Scheduler armed ${this.armed.size} execution(s)`)}async armExecution(a){let b=a.trigger;switch(b.type){case"schedule":{let c=await aP(a.id);c.lastScheduledFireAt?b.catchUp&&function(a,b){let c=new v(a.cron,{timezone:a.timezone,paused:!0});try{let a=c.nextRun(new Date(b));return null!==a&&a.getTime()<=Date.now()}finally{c.stop()}}(b,c.lastScheduledFireAt)&&(await aQ(a.id,{...c,lastScheduledFireAt:new Date().toISOString()}),aS.info(`Catch-up run for "${a.name}" (missed while closed)`),this.fire(a,{kind:"schedule-catchup",summary:"Schedule (missed while FLUJO was closed — ran once at startup)"})):await aQ(a.id,{...c,lastScheduledFireAt:new Date().toISOString()}),this.armed.set(a.id,function(a,b){let c=new v(a.cron,{timezone:a.timezone,unref:!0},b);return{dispose:()=>c.stop(),nextRun:()=>c.nextRun()?.toISOString()??null}}(b,()=>{(async()=>{let b=await aP(a.id);await aQ(a.id,{...b,lastScheduledFireAt:new Date().toISOString()}),await this.fire(a,{kind:"schedule",summary:"Schedule"})})().catch(b=>aS.error(`Scheduled fire failed for ${a.id}:`,b))}));break}case"webhook":break;case"file-watch":this.armed.set(a.id,function(a,b,c){let d,e=a.debounceMs??2e3,f=new Set(a.events),g=a.glob?.trim()?function(a){let b=a.replace(/\\/g,"/"),c="";for(let a=0;a<b.length;a++){let d=b[a];"*"===d?"*"===b[a+1]?"/"===b[++a+1]?(a++,c+="(?:.*/)?"):c+=".*":c+="[^/]*":"?"===d?c+="[^/]":c+=d.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return RegExp(`^${c}$`)}(a.glob.trim()):null;try{d=z.realpathSync.native(a.path)}catch(d){let b=d instanceof Error?d.message:String(d);return aB.warn(`Cannot watch "${a.path}": ${b}`),c(`Cannot watch "${a.path}": ${b}`),{dispose:()=>void 0}}let h=[],i=!1,j=null,k=!1,l=()=>{if(j=null,k||0===h.length)return;let a=h;i&&aB.info("File-watch batch overflowed; reporting first 50 events"),h=[],i=!1,b({events:a})},m=function(a,b={}){let c=new aA(b);return c.add(a),c}(d,{ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500,pollInterval:100}});return m.on("all",(a,b)=>{if(!k&&("add"===a||"change"===a||"unlink"===a)&&f.has(a)){if(g){let a=y().relative(d,b).replace(/\\/g,"/")||y().basename(b);if(!g.test(a))return}h.length>=50?i=!0:h.push({event:a,path:b}),j&&clearTimeout(j),j=setTimeout(l,e),j.unref?.()}}),m.on("error",a=>{let b=a instanceof Error?a.message:String(a);aB.warn(`Watcher error for ${d}: ${b}`),c(b)}),{dispose:()=>{k=!0,j&&(clearTimeout(j),j=null),h=[],m.close().catch(a=>aB.warn(`Failed to close watcher for ${d}:`,a))}}}(b,({events:c})=>{this.lastTriggerErrors.delete(a.id),this.fire(a,{kind:"file",summary:1===c.length?`File ${"unlink"===c[0].event?"deleted":"add"===c[0].event?"added":"changed"}`:`${c.length} file changes`,context:{watchedPath:b.path,events:c}})},b=>this.lastTriggerErrors.set(a.id,b)));break;case"mcp-poll":Promise.resolve().then(c.bind(c,99924)).then(async({mcpService:c})=>{await c.isServerDisabled(b.serverName)&&this.lastTriggerErrors.set(a.id,`MCP server '${b.serverName}' is disabled — enable it on the MCP page or change the trigger`)}).catch(b=>aS.warn(`Arm-time disabled-server check failed for ${a.id}:`,b)),this.armed.set(a.id,function(a,b){let c=a.cron||aC(a.intervalMs),d=!1,e=!1,f=0,g=0,h=async()=>{if(!e&&!d){if(g>0)return void g--;d=!0;try{let c,d=await b.callTool(a.serverName,a.toolName,a.args);if(!d.success)throw Error(d.error||"Tool call failed");f=0;let g=await b.loadState(),h=a.evaluate;if(c="on-change"===h.mode?(0,aD.Jl)(d.data,g):"new-items"===h.mode?(0,aD.A1)(d.data,h.itemsPath,h.idField,g):b.evaluateAiGate?await b.evaluateAiGate(d.data,h,g):{fire:!1,newState:{},error:'The "AI decides" condition is not available yet'},e)return;if(Object.keys(c.newState).length>0&&await b.saveState(c.newState),c.error)b.onError(c.error);else if(c.fire){let{status:d}=await b.onFire({summary:`Watched tool: ${c.summary??"condition met"}`,context:{server:a.serverName,tool:a.toolName,..."object"==typeof c.context&&null!==c.context?c.context:{result:c.context}}});if(e)return;if(c.pendingState){let{giveUpError:a}=await (0,aD.vV)({status:d,pendingState:c.pendingState,priorFailures:g.pendingFailures??0,saveState:b.saveState});a&&b.onError(a)}}else b.onSuccess?.()}catch(d){f++,g=Math.min(2**(f-1),8);let c=d instanceof Error?d.message:String(d);aE.warn(`Poll failed for ${a.serverName}/${a.toolName} (backing off ${g} check(s)): ${c}`),b.onError(c)}finally{d=!1}}},i=new v(c,{timezone:a.timezone,unref:!0},()=>void h());return h(),{dispose:()=>{e=!0,i.stop()},nextRun:()=>i.nextRun()?.toISOString()??null}}(b,{callTool:async(a,b,d)=>{let{mcpService:e}=await Promise.resolve().then(c.bind(c,99924)),f=await e.callTool(a,b,d);return{success:!0===f.success,data:f.data,error:"string"==typeof f.error?f.error:void 0}},loadState:()=>aP(a.id),saveState:async b=>{let c=await aP(a.id);await aQ(a.id,{...c,...b})},onFire:async({summary:b,context:c})=>(this.lastTriggerErrors.delete(a.id),{status:(await this.fire(a,{kind:"mcp-poll",summary:b,context:c})).status}),onError:b=>this.lastTriggerErrors.set(a.id,b),onSuccess:()=>this.lastTriggerErrors.delete(a.id),evaluateAiGate:async(a,b,d)=>{let{evaluateAiGate:e}=await c.e(701).then(c.bind(c,90701));return e(a,b,d)}}));break;case"url-watch":this.armed.set(a.id,function(a,b){let c=b.fetchImpl??fetch,d=!1,e=!1,f=async()=>{if(!e&&!d){d=!0;try{let d=await c(a.url,{redirect:"follow",headers:{"User-Agent":"FLUJO-url-watch"},signal:AbortSignal.timeout(3e4)});if(!d.ok)return void b.onError(`The URL answered with HTTP ${d.status}`);let f=await d.text(),g=(0,aD.qq)(f),h=await b.loadState();if(e)return;if(!h.lastHash){await b.saveState({lastHash:g}),b.onSuccess?.();return}if(h.lastHash===g)return void b.onSuccess?.();let{status:i}=await b.onFire({summary:"Online content changed",context:{url:a.url,status:d.status,contentType:d.headers.get("content-type")??void 0,content:f.length>8192?`${f.slice(0,8192)}… (truncated, ${f.length} chars total)`:f}});if(e)return;let{giveUpError:j}=await (0,aD.vV)({status:i,pendingState:{lastHash:g},priorFailures:h.pendingFailures??0,saveState:b.saveState});j&&b.onError(j)}catch(d){let c=d instanceof Error&&"TimeoutError"===d.name?"The URL did not answer within 30s":d instanceof Error?d.message:String(d);aF.warn(`URL check failed for ${a.url}: ${c}`),b.onError(c)}finally{d=!1}}},g=new v(a.cron,{timezone:a.timezone,unref:!0},()=>void f());return f(),{dispose:()=>{e=!0,g.stop()},nextRun:()=>g.nextRun()?.toISOString()??null}}(b,{loadState:()=>aP(a.id),saveState:async b=>{let c=await aP(a.id);await aQ(a.id,{...c,...b})},onFire:async({summary:b,context:c})=>(this.lastTriggerErrors.delete(a.id),{status:(await this.fire(a,{kind:"url-watch",summary:b,context:c})).status}),onError:b=>this.lastTriggerErrors.set(a.id,b),onSuccess:()=>this.lastTriggerErrors.delete(a.id)}));break;default:aS.warn(`Trigger type "${b.type}" is not implemented — "${a.name}" not armed`)}}async loadFile(){let a=await (0,e.YM)(f.Z.PLANNED_EXECUTIONS,aT);return{version:1,paused:!0===a.paused,executions:Array.isArray(a.executions)?a.executions:[]}}async saveFile(a){await (0,e.VH)(f.Z.PLANNED_EXECUTIONS,a)}async isPaused(){return(await this.loadFile()).paused}async setPaused(a){let b=await this.loadFile();await this.saveFile({...b,paused:a}),await this.reconcile()}async list(){return Promise.all((await this.loadFile()).executions.map(async a=>({execution:a,status:this.getStatus(a),lastRun:await aL(a.id)})))}async get(a){return(await this.loadFile()).executions.find(b=>b.id===a)??null}async create(a){let b=this.validateInput(a);if(b)return{error:b};if(void 0!==a.id&&!/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(a.id))return{error:"The id must be a UUID"};let c=new Date().toISOString(),e={...a,trigger:this.normalizeTrigger(a.trigger),id:a.id??(0,d.A)(),createdAt:c,updatedAt:c},f=await this.loadFile();return f.executions.some(a=>a.id===e.id)?{error:`A planned execution with id "${e.id}" already exists`}:(await this.saveFile({...f,executions:[...f.executions,e]}),await this.reconcile(),{execution:e})}async update(a,b){let c=await this.loadFile(),d=c.executions.findIndex(b=>b.id===a);if(d<0)return{error:`No planned execution with id "${a}"`};let e={...c.executions[d],...b,...b.trigger?{trigger:this.normalizeTrigger(b.trigger)}:{},id:a,createdAt:c.executions[d].createdAt,updatedAt:new Date().toISOString()},f=this.validateInput(e);if(f)return{error:f};let g=[...c.executions];return g[d]=e,await this.saveFile({...c,executions:g}),await this.reconcile(),{execution:e}}async delete(a){let b=await this.loadFile();return b.executions.some(b=>b.id===a)?(await this.saveFile({...b,executions:b.executions.filter(b=>b.id!==a)}),await this.reconcile(),this.lastTriggerErrors.delete(a),await aM(a),await aR(a),{success:!0}):{success:!1,error:`No planned execution with id "${a}"`}}normalizeTrigger(a){return a?.type!=="webhook"||a.token?a?.type!=="mcp-poll"||a.cron?a:{...a,cron:aC(a.intervalMs)}:{...a,token:(0,d.A)()}}validateInput(a){if(!a.name?.trim())return"A name is required";if(!a.flowId)return"A flow is required";if("string"!=typeof a.prompt)return"A prompt is required (may be empty)";let b=a.trigger;if(!b||"object"!=typeof b)return"A trigger is required";switch(b.type){case"schedule":{let a=w(b.cron,b.timezone);return a.valid?null:`Invalid schedule: ${a.error}`}case"webhook":return null;case"file-watch":if(!b.path?.trim())return"A folder or file path to watch is required";if(!Array.isArray(b.events)||0===b.events.length)return"At least one file event is required";return null;case"mcp-poll":if(!b.serverName||!b.toolName)return"A server and tool are required";if(b.cron){let a=w(b.cron,b.timezone);if(!a.valid)return`Invalid schedule: ${a.error}`}if(b.evaluate?.mode==="new-items"&&!b.evaluate.idField?.trim())return"An id field is required to detect new items";if((b.evaluate?.mode==="llm-gate"||b.evaluate?.mode==="flow-gate")&&!b.evaluate.condition?.trim())return"A condition is required for the AI to check";if(b.evaluate?.mode==="llm-gate"&&!b.evaluate.modelId)return"A model is required to check the condition";if(b.evaluate?.mode==="flow-gate"&&!b.evaluate.flowId)return"A flow is required to check the condition";return null;case"url-watch":{try{let a=new URL(b.url??"");if("http:"!==a.protocol&&"https:"!==a.protocol)return"The URL must start with http:// or https://"}catch{return"A valid URL is required"}let a=w(b.cron,b.timezone);return a.valid?null:`Invalid schedule: ${a.error}`}default:return"Unknown trigger type"}}getStatus(a){let b=this.armed.get(a.id),c=void 0!==b||a.enabled&&"webhook"===a.trigger.type&&this.started&&!this.pausedCache,d=this.running.get(a.id);return{armed:c,nextRun:b?.nextRun?b.nextRun():void 0,lastTriggerError:this.lastTriggerErrors.get(a.id),running:void 0!==d,runningSince:d}}async runNow(a){let b=await this.get(a);return b?{record:await this.fire(b,{kind:"manual",summary:"Manual run"})}:{error:`No planned execution with id "${a}"`}}async fire(a,b,e=(0,d.A)()){let f,g=new Date().toISOString();if(await (0,h.C3)()){let c={runId:e,conversationId:"",firedAt:g,finishedAt:g,status:"skipped",triggerSummary:b.summary,error:"encryption locked"};return await aK(a.id,c),aS.info(`Skipped fire for "${a.name}" — encryption locked`),c}if(this.running.has(a.id)){let c={runId:e,conversationId:"",firedAt:g,finishedAt:g,status:"skipped",triggerSummary:b.summary,error:"Previous run still in progress"};return await aK(a.id,c),aS.info(`Skipped overlapping fire for "${a.name}"`),c}this.running.set(a.id,g);let i=(0,d.A)();try{aS.info(`Firing "${a.name}" (${b.kind})`);let d=await aL(a.id),h={executionName:a.name,trigger:b.kind,now:g,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,lastRun:d?{at:d.firedAt,status:d.status}:null,nextPlannedRun:this.getStatus(a).nextRun??null},{runFlow:j}=await Promise.all([c.e(3304),c.e(6936)]).then(c.bind(c,67463)),k=await j({flowId:a.flowId,prompt:this.composePrompt(a.prompt,b,h),mode:a.saveConversations?"conversation":"ephemeral",conversationId:i,requireApproval:!1,debug:!1,userTurn:!0});f={runId:e,conversationId:i,firedAt:g,finishedAt:new Date().toISOString(),status:"completed"===k.status?"completed":"error",triggerSummary:b.summary,outputText:this.truncateOutput(k.outputText),usage:k.usage,error:"completed"===k.status?void 0:k.error?.message??`Run ended with status "${k.status}"`}}catch(c){f={runId:e,conversationId:i,firedAt:g,finishedAt:new Date().toISOString(),status:"error",triggerSummary:b.summary,error:c instanceof Error?c.message:String(c)},aS.error(`Run crashed for "${a.name}":`,c)}finally{this.running.delete(a.id)}return await aK(a.id,f),f}composePrompt(a,b,c){let d=JSON.stringify(void 0===b.context?c:{...c,data:b.context},null,2);return`${a}
|
|
99
|
+
`+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function t(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,t),a.emit("wsClientError",d,c,b)}else s(c,d,e,f)}a.exports=p},63429:(a,b,c)=>{"use strict";var d;c.d(b,{fd:()=>f}),Symbol("ZodOutput"),Symbol("ZodInput");class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(a,...b){let c=b[0];return this._map.set(a,c),c&&"object"==typeof c&&"id"in c&&this._idmap.set(c.id,a),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(a){let b=this._map.get(a);return b&&"object"==typeof b&&"id"in b&&this._idmap.delete(b.id),this._map.delete(a),this}get(a){let b=a._zod.parent;if(b){let c={...this.get(b)??{}};delete c.id;let d={...c,...this._map.get(a)};return Object.keys(d).length?d:void 0}return this._map.get(a)}has(a){return this._map.has(a)}}(d=globalThis).__zod_globalRegistry??(d.__zod_globalRegistry=new e);let f=globalThis.__zod_globalRegistry},64098:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.NodeCrypto=void 0;let d=c(55511);class e{async sha256DigestBase64(a){return d.createHash("sha256").update(a).digest("base64")}randomBytesBase64(a){return d.randomBytes(a).toString("base64")}async verify(a,b,c){let e=d.createVerify("RSA-SHA256");return e.update(b),e.end(),e.verify(a,c,"base64")}async sign(a,b){let c=d.createSign("RSA-SHA256");return c.update(b),c.end(),c.sign(a,"base64")}decodeBase64StringUtf8(a){return Buffer.from(a,"base64").toString("utf-8")}encodeBase64StringUtf8(a){return Buffer.from(a,"utf-8").toString("base64")}async sha256DigestHex(a){return d.createHash("sha256").update(a).digest("hex")}async signWithHmacSha256(a,b){var c;let e="string"==typeof a?a:(c=a,Buffer.from(c));return function(a){let b=new ArrayBuffer(a.length),c=new Uint8Array(b);for(let b=0;b<a.length;++b)c[b]=a[b];return b}(d.createHmac("sha256",e).update(b).digest())}}b.NodeCrypto=e},64570:function(a,b,c){var d,e,f;a.exports=void(e=(d=c(67278)).lib.Base,f=d.enc.Utf8,d.algo.HMAC=e.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=f.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var e=this._oKey=b.clone(),g=this._iKey=b.clone(),h=e.words,i=g.words,j=0;j<c;j++)h[j]^=0x5c5c5c5c,i[j]^=0x36363636;e.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);return b.reset(),b.finalize(this._oKey.clone().concat(c))}}))},65152:a=>{"use strict";var b=Object.defineProperty||!1;if(b)try{b({},"a",{value:1})}catch(a){b=!1}a.exports=b},65325:function(a,b){"use strict";var c,d=this&&this.__extends||(c=function(a,b){return(c=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(a,b)},function(a,b){function d(){this.constructor=a}c(a,b),a.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)});Object.defineProperty(b,"__esModule",{value:!0});var e=function(){function a(a){void 0===a&&(a="="),this._paddingCharacter=a}return a.prototype.encodedLength=function(a){return this._paddingCharacter?(a+2)/3*4|0:(8*a+5)/6|0},a.prototype.encode=function(a){for(var b="",c=0;c<a.length-2;c+=3){var d=a[c]<<16|a[c+1]<<8|a[c+2];b+=this._encodeByte(d>>>18&63),b+=this._encodeByte(d>>>12&63),b+=this._encodeByte(d>>>6&63),b+=this._encodeByte(d>>>0&63)}var e=a.length-c;if(e>0){var d=a[c]<<16|(2===e?a[c+1]<<8:0);b+=this._encodeByte(d>>>18&63),b+=this._encodeByte(d>>>12&63),2===e?b+=this._encodeByte(d>>>6&63):b+=this._paddingCharacter||"",b+=this._paddingCharacter||""}return b},a.prototype.maxDecodedLength=function(a){return this._paddingCharacter?a/4*3|0:(6*a+7)/8|0},a.prototype.decodedLength=function(a){return this.maxDecodedLength(a.length-this._getPaddingLength(a))},a.prototype.decode=function(a){if(0===a.length)return new Uint8Array(0);for(var b=this._getPaddingLength(a),c=a.length-b,d=new Uint8Array(this.maxDecodedLength(c)),e=0,f=0,g=0,h=0,i=0,j=0,k=0;f<c-4;f+=4)h=this._decodeChar(a.charCodeAt(f+0)),i=this._decodeChar(a.charCodeAt(f+1)),j=this._decodeChar(a.charCodeAt(f+2)),k=this._decodeChar(a.charCodeAt(f+3)),d[e++]=h<<2|i>>>4,d[e++]=i<<4|j>>>2,d[e++]=j<<6|k,g|=256&h,g|=256&i,g|=256&j,g|=256&k;if(f<c-1&&(h=this._decodeChar(a.charCodeAt(f)),i=this._decodeChar(a.charCodeAt(f+1)),d[e++]=h<<2|i>>>4,g|=256&h,g|=256&i),f<c-2&&(j=this._decodeChar(a.charCodeAt(f+2)),d[e++]=i<<4|j>>>2,g|=256&j),f<c-3&&(k=this._decodeChar(a.charCodeAt(f+3)),d[e++]=j<<6|k,g|=256&k),0!==g)throw Error("Base64Coder: incorrect characters for decoding");return d},a.prototype._encodeByte=function(a){var b=a;return b+=65,b+=25-a>>>8&6,b+=51-a>>>8&-75,b+=61-a>>>8&-15,String.fromCharCode(b+=62-a>>>8&3)},a.prototype._decodeChar=function(a){return 256+((42-a&a-44)>>>8&-256+a-43+62)+((46-a&a-48)>>>8&-256+a-47+63)+((47-a&a-58)>>>8&-256+a-48+52)+((64-a&a-91)>>>8&-256+a-65+0)+((96-a&a-123)>>>8&-256+a-97+26)},a.prototype._getPaddingLength=function(a){var b=0;if(this._paddingCharacter){for(var c=a.length-1;c>=0&&a[c]===this._paddingCharacter;c--)b++;if(a.length<4||b>2)throw Error("Base64Coder: incorrect padding")}return b},a}();b.Coder=e;var f=new e;b.encode=function(a){return f.encode(a)},b.decode=function(a){return f.decode(a)};var g=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return d(b,a),b.prototype._encodeByte=function(a){var b=a;return b+=65,b+=25-a>>>8&6,b+=51-a>>>8&-75,b+=61-a>>>8&-13,String.fromCharCode(b+=62-a>>>8&49)},b.prototype._decodeChar=function(a){return 256+((44-a&a-46)>>>8&-256+a-45+62)+((94-a&a-96)>>>8&-256+a-95+63)+((47-a&a-58)>>>8&-256+a-48+52)+((64-a&a-91)>>>8&-256+a-65+0)+((96-a&a-123)>>>8&-256+a-97+26)},b}(e);b.URLSafeCoder=g;var h=new g;b.encodeURLSafe=function(a){return h.encode(a)},b.decodeURLSafe=function(a){return h.decode(a)},b.encodedLength=function(a){return f.encodedLength(a)},b.maxDecodedLength=function(a){return f.maxDecodedLength(a)},b.decodedLength=function(a){return f.decodedLength(a)}},65378:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(83593);b.default={keyword:"allOf",schemaType:"array",code(a){let{gen:b,schema:c,it:e}=a;if(!Array.isArray(c))throw Error("ajv implementation error");let f=b.name("valid");c.forEach((b,c)=>{if((0,d.alwaysValidSchema)(e,b))return;let g=a.subschema({keyword:"allOf",schemaProp:c},f);a.ok(f),a.mergeEvaluated(g)})}}},65694:(a,b,c)=>{"use strict";var d=c(79428).Buffer,e=c(79428).SlowBuffer;function f(a,b){if(!d.isBuffer(a)||!d.isBuffer(b)||a.length!==b.length)return!1;for(var c=0,e=0;e<a.length;e++)c|=a[e]^b[e];return 0===c}a.exports=f,f.install=function(){d.prototype.equal=e.prototype.equal=function(a){return f(this,a)}};var g=d.prototype.equal,h=e.prototype.equal;f.restore=function(){d.prototype.equal=g,e.prototype.equal=h}},65905:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CertificateSubjectTokenSupplier=b.InvalidConfigurationError=b.CertificateSourceUnavailableError=b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;let d=c(45388),e=c(29021),f=c(55511),g=c(55591);b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";class h extends Error{constructor(a){super(a),this.name="CertificateSourceUnavailableError"}}b.CertificateSourceUnavailableError=h;class i extends Error{constructor(a){super(a),this.name="InvalidConfigurationError"}}b.InvalidConfigurationError=i;class j{certificateConfigPath;trustChainPath;cert;key;constructor(a){if(!a.useDefaultCertificateConfig&&!a.certificateConfigLocation)throw new i("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(a.useDefaultCertificateConfig&&a.certificateConfigLocation)throw new i("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=a.trustChainPath,this.certificateConfigPath=a.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new i("Cannot create mTLS Agent with missing certificate or key");return new g.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#w();let{certPath:a,keyPath:b}=await this.#x();return{cert:this.cert,key:this.key}=await this.#y(a,b),await this.#z(this.cert)}async #w(){let a=this.certificateConfigPath;if(a){if(await (0,d.isValidFile)(a))return a;throw new h(`Provided certificate config path is invalid: ${a}`)}let c=process.env[b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(c){if(await (0,d.isValidFile)(c))return c;throw new h(`Path from environment variable "${b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${c}`)}let e=(0,d.getWellKnownCertificateConfigFileLocation)();if(await (0,d.isValidFile)(e))return e;throw new h(`Could not find certificate configuration file. Searched override path, the "${b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${e}).`)}async #x(){let a,b=this.certificateConfigPath;try{a=await e.promises.readFile(b,"utf8")}catch(a){throw new h(`Failed to read certificate config file at: ${b}`)}try{let c=JSON.parse(a),d=c?.cert_configs?.workload?.cert_path,e=c?.cert_configs?.workload?.key_path;if(!d||!e)throw new i(`Certificate config file (${b}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:d,keyPath:e}}catch(a){if(a instanceof i)throw a;throw new i(`Failed to parse certificate config from ${b}: ${a.message}`)}}async #y(a,b){let c,d;try{c=await e.promises.readFile(a),new f.X509Certificate(c)}catch(c){let b=c instanceof Error?c.message:String(c);throw new h(`Failed to read certificate file at ${a}: ${b}`)}try{d=await e.promises.readFile(b),(0,f.createPrivateKey)(d)}catch(c){let a=c instanceof Error?c.message:String(c);throw new h(`Failed to read private key file at ${b}: ${a}`)}return{cert:c,key:d}}async #z(a){let b=new f.X509Certificate(a);if(!this.trustChainPath)return JSON.stringify([b.raw.toString("base64")]);try{let a,c=((await e.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((a,b)=>{try{return new f.X509Certificate(a)}catch(c){let a=c instanceof Error?c.message:String(c);throw new i(`Failed to parse certificate at index ${b} in trust chain file ${this.trustChainPath}: ${a}`)}}),d=c.findIndex(a=>b.raw.equals(a.raw));if(-1===d)a=[b,...c];else if(0===d)a=c;else throw new i(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${d}).`);return JSON.stringify(a.map(a=>a.raw.toString("base64")))}catch(b){if(b instanceof i)throw b;let a=b instanceof Error?b.message:String(b);throw new h(`Failed to process certificate chain from ${this.trustChainPath}: ${a}`)}}}b.CertificateSubjectTokenSupplier=j},66477:function(a,b,c){"use strict";var d=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(b,"__esModule",{value:!0});let e=d(c(97250)).default("https-proxy-agent:parse-proxy-response");b.default=function(a){return new Promise((b,c)=>{let d=0,f=[];function g(){let c=a.read();c?function(a){f.push(a),d+=a.length;let c=Buffer.concat(f,d);if(-1===c.indexOf("\r\n\r\n")){e("have not received end of HTTP headers yet..."),g();return}let h=c.toString("ascii",0,c.indexOf("\r\n")),i=+h.split(" ")[1];e("got proxy server response: %o",h),b({statusCode:i,buffered:c})}(c):a.once("readable",g)}function h(a){e("onclose had error %o",a)}function i(){e("onend")}a.on("error",function b(d){a.removeListener("end",i),a.removeListener("error",b),a.removeListener("close",h),a.removeListener("readable",g),e("onerror %o",d),c(d)}),a.on("close",h),a.on("end",i),g()})}},67278:function(a,b,c){var d;a.exports=d||function(a,b){if("undefined"!=typeof window&&window.crypto&&(d=window.crypto),"undefined"!=typeof self&&self.crypto&&(d=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(d=globalThis.crypto),!d&&"undefined"!=typeof window&&window.msCrypto&&(d=window.msCrypto),!d&&"undefined"!=typeof global&&global.crypto&&(d=global.crypto),!d)try{d=c(55511)}catch(a){}var d,e=function(){if(d){if("function"==typeof d.getRandomValues)try{return d.getRandomValues(new Uint32Array(1))[0]}catch(a){}if("function"==typeof d.randomBytes)try{return d.randomBytes(4).readInt32LE()}catch(a){}}throw Error("Native crypto module could not be used to get secure random number.")},f=Object.create||function(){function a(){}return function(b){var c;return a.prototype=b,c=new a,a.prototype=null,c}}(),g={},h=g.lib={},i=h.Base={extend:function(a){var b=f(this);return a&&b.mixIn(a),b.hasOwnProperty("init")&&this.init!==b.init||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},j=h.WordArray=i.extend({init:function(a,c){a=this.words=a||[],b!=c?this.sigBytes=c:this.sigBytes=4*a.length},toString:function(a){return(a||l).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;f<e;f++){var g=c[f>>>2]>>>24-f%4*8&255;b[d+f>>>2]|=g<<24-(d+f)%4*8}else for(var h=0;h<e;h+=4)b[d+h>>>2]=c[h>>>2];return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=0xffffffff<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=i.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var b=[],c=0;c<a;c+=4)b.push(e());return new j.init(b,a)}}),k=g.enc={},l=k.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new j.init(c,b/2)}},m=k.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;e<c;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d<b;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new j.init(c,b)}},n=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(m.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return m.parse(unescape(encodeURIComponent(a)))}},o=h.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new j.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=n.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c,d=this._data,e=d.words,f=d.sigBytes,g=this.blockSize,h=f/(4*g),i=(h=b?a.ceil(h):a.max((0|h)-this._minBufferSize,0))*g,k=a.min(4*i,f);if(i){for(var l=0;l<i;l+=g)this._doProcessBlock(e,l);c=e.splice(0,i),d.sigBytes-=k}return new j.init(c,k)},clone:function(){var a=i.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});h.Hasher=o.extend({cfg:i.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){o.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){return a&&this._append(a),this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new p.HMAC.init(a,c).finalize(b)}}});var p=g.algo={};return g}(Math)},67729:a=>{"use strict";var b={};function c(a,b){!b.unsigned&&--a;let c=b.unsigned?0:-Math.pow(2,a),d=Math.pow(2,a)-1,e=b.moduloBitLength?Math.pow(2,b.moduloBitLength):Math.pow(2,a),f=b.moduloBitLength?Math.pow(2,b.moduloBitLength-1):Math.pow(2,a-1);return function(a,g){g||(g={});let h=+a;if(g.enforceRange){if(!Number.isFinite(h))throw TypeError("Argument is not a finite number");if((h=(h<0?-1:1)*Math.floor(Math.abs(h)))<c||h>d)throw TypeError("Argument is not in byte range");return h}if(!isNaN(h)&&g.clamp){var i;return(h=(i=h)%1==.5&&(1&i)==0?Math.floor(i):Math.round(i))<c&&(h=c),h>d&&(h=d),h}if(!Number.isFinite(h)||0===h)return 0;if(h=(h<0?-1:1)*Math.floor(Math.abs(h))%e,!b.unsigned&&h>=f)return h-e;if(b.unsigned){if(h<0)h+=e;else if(-0===h)return 0}return h}}a.exports=b,b.void=function(){},b.boolean=function(a){return!!a},b.byte=c(8,{unsigned:!1}),b.octet=c(8,{unsigned:!0}),b.short=c(16,{unsigned:!1}),b["unsigned short"]=c(16,{unsigned:!0}),b.long=c(32,{unsigned:!1}),b["unsigned long"]=c(32,{unsigned:!0}),b["long long"]=c(32,{unsigned:!1,moduloBitLength:64}),b["unsigned long long"]=c(32,{unsigned:!0,moduloBitLength:64}),b.double=function(a){let b=+a;if(!Number.isFinite(b))throw TypeError("Argument is not a finite floating-point value");return b},b["unrestricted double"]=function(a){let b=+a;if(isNaN(b))throw TypeError("Argument is NaN");return b},b.float=b.double,b["unrestricted float"]=b["unrestricted double"],b.DOMString=function(a,b){return(b||(b={}),b.treatNullAsEmptyString&&null===a)?"":String(a)},b.ByteString=function(a,b){let c,d=String(a);for(let a=0;void 0!==(c=d.codePointAt(a));++a)if(c>255)throw TypeError("Argument is not a valid bytestring");return d},b.USVString=function(a){let b=String(a),c=b.length,d=[];for(let a=0;a<c;++a){let e=b.charCodeAt(a);if(e<55296||e>57343)d.push(String.fromCodePoint(e));else if(56320<=e&&e<=57343)d.push(String.fromCodePoint(65533));else if(a===c-1)d.push(String.fromCodePoint(65533));else{let c=b.charCodeAt(a+1);if(56320<=c&&c<=57343){let b=1023&e,f=1023&c;d.push(String.fromCodePoint(65536+1024*b+f)),++a}else d.push(String.fromCodePoint(65533))}}return d.join("")},b.Date=function(a,b){if(!(a instanceof Date))throw TypeError("Argument is not a Date object");if(!isNaN(a))return a},b.RegExp=function(a,b){return a instanceof RegExp||(a=new RegExp(a)),a}},68041:(a,b,c)=>{var d=c(14764),e=c(90126);a.exports=function(a){Object.keys(this.jobs).length&&(this.index=this.size,d(this),e(a)(null,this.results))}},68300:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(97025),e=c(31849),f=c(60359),g=c(83593);b.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,e._)`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:b,schema:c,parentSchema:h,data:i,errsCount:j,it:k}=a;if(!j)throw Error("ajv implementation error");let{allErrors:l,opts:m}=k;if(k.props=!0,"all"!==m.removeAdditional&&(0,g.alwaysValidSchema)(k,c))return;let n=(0,d.allSchemaProperties)(h.properties),o=(0,d.allSchemaProperties)(h.patternProperties);function p(a){b.code((0,e._)`delete ${i}[${a}]`)}function q(d){if("all"===m.removeAdditional||m.removeAdditional&&!1===c)return void p(d);if(!1===c){a.setParams({additionalProperty:d}),a.error(),l||b.break();return}if("object"==typeof c&&!(0,g.alwaysValidSchema)(k,c)){let c=b.name("valid");"failing"===m.removeAdditional?(r(d,c,!1),b.if((0,e.not)(c),()=>{a.reset(),p(d)})):(r(d,c),l||b.if((0,e.not)(c),()=>b.break()))}}function r(b,c,d){let e={keyword:"additionalProperties",dataProp:b,dataPropType:g.Type.Str};!1===d&&Object.assign(e,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(e,c)}b.forIn("key",i,c=>{n.length||o.length?b.if(function(c){let f;if(n.length>8){let a=(0,g.schemaRefOrVal)(k,h.properties,"properties");f=(0,d.isOwnProperty)(b,a,c)}else f=n.length?(0,e.or)(...n.map(a=>(0,e._)`${c} === ${a}`)):e.nil;return o.length&&(f=(0,e.or)(f,...o.map(b=>(0,e._)`${(0,d.usePattern)(a,b)}.test(${c})`))),(0,e.not)(f)}(c),()=>q(c)):q(c)}),a.ok((0,e._)`${j} === ${f.default.errors}`)}}},68760:(a,b,c)=>{var d=c(92878).Buffer,e=c(91781),f=c(17134),g=c(27910),h=c(86080),i=c(28354),j=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function k(a){var b=a.split(".",1)[0],c=d.from(b,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(c))return c;try{return JSON.parse(c)}catch(a){return}}function l(a){return a.split(".")[2]}function m(a){return j.test(a)&&!!k(a)}function n(a,b,c){if(!b){var d=Error("Missing algorithm parameter for jws.verify");throw d.code="MISSING_ALGORITHM",d}var e=l(a=h(a)),g=a.split(".",2).join(".");return f(b).verify(g,e,c)}function o(a,b){if(b=b||{},!m(a=h(a)))return null;var c,e,f=k(a);if(!f)return null;var g=(c=c||"utf8",e=a.split(".")[1],d.from(e,"base64").toString(c));return("JWT"===f.typ||b.json)&&(g=JSON.parse(g,b.encoding)),{header:f,payload:g,signature:l(a)}}function p(a){var b=(a=a||{}).secret;if(b=null==(b=null==b?a.publicKey:b)?a.key:b,!0===/^hs/i.test(a.algorithm)&&null==b)throw TypeError("secret must be a string or buffer or a KeyObject");var c=new e(b);this.readable=!0,this.algorithm=a.algorithm,this.encoding=a.encoding,this.secret=this.publicKey=this.key=c,this.signature=new e(a.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}i.inherits(p,g),p.prototype.verify=function(){try{var a=n(this.signature.buffer,this.algorithm,this.key.buffer),b=o(this.signature.buffer,this.encoding);return this.emit("done",a,b),this.emit("data",a),this.emit("end"),this.readable=!1,a}catch(a){this.readable=!1,this.emit("error",a),this.emit("close")}},p.decode=o,p.isValid=m,p.verify=n,a.exports=p},68824:()=>{},69088:(a,b,c)=>{"use strict";c.d(b,{VL:()=>d,aI:()=>e});let d="mcp-servers",e=300},69579:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{AppRenderSpan:function(){return i},AppRouteRouteHandlersSpan:function(){return l},BaseServerSpan:function(){return c},LoadComponentsSpan:function(){return d},LogSpanAllowList:function(){return p},MiddlewareSpan:function(){return n},NextNodeServerSpan:function(){return f},NextServerSpan:function(){return e},NextVanillaSpanAllowlist:function(){return o},NodeSpan:function(){return k},RenderSpan:function(){return h},ResolveMetadataSpan:function(){return m},RouterSpan:function(){return j},StartServerSpan:function(){return g}});var c=function(a){return a.handleRequest="BaseServer.handleRequest",a.run="BaseServer.run",a.pipe="BaseServer.pipe",a.getStaticHTML="BaseServer.getStaticHTML",a.render="BaseServer.render",a.renderToResponseWithComponents="BaseServer.renderToResponseWithComponents",a.renderToResponse="BaseServer.renderToResponse",a.renderToHTML="BaseServer.renderToHTML",a.renderError="BaseServer.renderError",a.renderErrorToResponse="BaseServer.renderErrorToResponse",a.renderErrorToHTML="BaseServer.renderErrorToHTML",a.render404="BaseServer.render404",a}(c||{}),d=function(a){return a.loadDefaultErrorComponents="LoadComponents.loadDefaultErrorComponents",a.loadComponents="LoadComponents.loadComponents",a}(d||{}),e=function(a){return a.getRequestHandler="NextServer.getRequestHandler",a.getServer="NextServer.getServer",a.getServerRequestHandler="NextServer.getServerRequestHandler",a.createServer="createServer.createServer",a}(e||{}),f=function(a){return a.compression="NextNodeServer.compression",a.getBuildId="NextNodeServer.getBuildId",a.createComponentTree="NextNodeServer.createComponentTree",a.clientComponentLoading="NextNodeServer.clientComponentLoading",a.getLayoutOrPageModule="NextNodeServer.getLayoutOrPageModule",a.generateStaticRoutes="NextNodeServer.generateStaticRoutes",a.generateFsStaticRoutes="NextNodeServer.generateFsStaticRoutes",a.generatePublicRoutes="NextNodeServer.generatePublicRoutes",a.generateImageRoutes="NextNodeServer.generateImageRoutes.route",a.sendRenderResult="NextNodeServer.sendRenderResult",a.proxyRequest="NextNodeServer.proxyRequest",a.runApi="NextNodeServer.runApi",a.render="NextNodeServer.render",a.renderHTML="NextNodeServer.renderHTML",a.imageOptimizer="NextNodeServer.imageOptimizer",a.getPagePath="NextNodeServer.getPagePath",a.getRoutesManifest="NextNodeServer.getRoutesManifest",a.findPageComponents="NextNodeServer.findPageComponents",a.getFontManifest="NextNodeServer.getFontManifest",a.getServerComponentManifest="NextNodeServer.getServerComponentManifest",a.getRequestHandler="NextNodeServer.getRequestHandler",a.renderToHTML="NextNodeServer.renderToHTML",a.renderError="NextNodeServer.renderError",a.renderErrorToHTML="NextNodeServer.renderErrorToHTML",a.render404="NextNodeServer.render404",a.startResponse="NextNodeServer.startResponse",a.route="route",a.onProxyReq="onProxyReq",a.apiResolver="apiResolver",a.internalFetch="internalFetch",a}(f||{}),g=function(a){return a.startServer="startServer.startServer",a}(g||{}),h=function(a){return a.getServerSideProps="Render.getServerSideProps",a.getStaticProps="Render.getStaticProps",a.renderToString="Render.renderToString",a.renderDocument="Render.renderDocument",a.createBodyResult="Render.createBodyResult",a}(h||{}),i=function(a){return a.renderToString="AppRender.renderToString",a.renderToReadableStream="AppRender.renderToReadableStream",a.getBodyResult="AppRender.getBodyResult",a.fetch="AppRender.fetch",a}(i||{}),j=function(a){return a.executeRoute="Router.executeRoute",a}(j||{}),k=function(a){return a.runHandler="Node.runHandler",a}(k||{}),l=function(a){return a.runHandler="AppRouteRouteHandlers.runHandler",a}(l||{}),m=function(a){return a.generateMetadata="ResolveMetadata.generateMetadata",a.generateViewport="ResolveMetadata.generateViewport",a}(m||{}),n=function(a){return a.execute="Middleware.execute",a}(n||{});let o=new Set(["Middleware.execute","BaseServer.handleRequest","Render.getServerSideProps","Render.getStaticProps","AppRender.fetch","AppRender.getBodyResult","Render.renderDocument","Node.runHandler","AppRouteRouteHandlers.runHandler","ResolveMetadata.generateMetadata","ResolveMetadata.generateViewport","NextNodeServer.createComponentTree","NextNodeServer.findPageComponents","NextNodeServer.getLayoutOrPageModule","NextNodeServer.startResponse","NextNodeServer.clientComponentLoading"]),p=new Set(["NextNodeServer.findPageComponents","NextNodeServer.createComponentTree","NextNodeServer.clientComponentLoading"])},69664:a=>{"use strict";a.exports=Number.isNaN||function(a){return a!=a}},70194:(a,b,c)=>{"use strict";var d=c(69664);a.exports=function(a){return d(a)||0===a?a:a<0?-1:1}},70428:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.extendErrors=b.resetErrorsCount=b.reportExtraError=b.reportError=b.keyword$DataError=b.keywordError=void 0;let d=c(31849),e=c(83593),f=c(60359);function g(a,b){let c=a.const("err",b);a.if((0,d._)`${f.default.vErrors} === null`,()=>a.assign(f.default.vErrors,(0,d._)`[${c}]`),(0,d._)`${f.default.vErrors}.push(${c})`),a.code((0,d._)`${f.default.errors}++`)}function h(a,b){let{gen:c,validateName:e,schemaEnv:f}=a;f.$async?c.throw((0,d._)`new ${a.ValidationError}(${b})`):(c.assign((0,d._)`${e}.errors`,b),c.return(!1))}b.keywordError={message:({keyword:a})=>(0,d.str)`must pass "${a}" keyword validation`},b.keyword$DataError={message:({keyword:a,schemaType:b})=>b?(0,d.str)`"${a}" keyword must be ${b} ($data)`:(0,d.str)`"${a}" keyword is invalid ($data)`},b.reportError=function(a,c=b.keywordError,e,f){let{it:i}=a,{gen:k,compositeRule:l,allErrors:m}=i,n=j(a,c,e);(null!=f?f:l||m)?g(k,n):h(i,(0,d._)`[${n}]`)},b.reportExtraError=function(a,c=b.keywordError,d){let{it:e}=a,{gen:i,compositeRule:k,allErrors:l}=e;g(i,j(a,c,d)),k||l||h(e,f.default.vErrors)},b.resetErrorsCount=function(a,b){a.assign(f.default.errors,b),a.if((0,d._)`${f.default.vErrors} !== null`,()=>a.if(b,()=>a.assign((0,d._)`${f.default.vErrors}.length`,b),()=>a.assign(f.default.vErrors,null)))},b.extendErrors=function({gen:a,keyword:b,schemaValue:c,data:e,errsCount:g,it:h}){if(void 0===g)throw Error("ajv implementation error");let i=a.name("err");a.forRange("i",g,f.default.errors,g=>{a.const(i,(0,d._)`${f.default.vErrors}[${g}]`),a.if((0,d._)`${i}.instancePath === undefined`,()=>a.assign((0,d._)`${i}.instancePath`,(0,d.strConcat)(f.default.instancePath,h.errorPath))),a.assign((0,d._)`${i}.schemaPath`,(0,d.str)`${h.errSchemaPath}/${b}`),h.opts.verbose&&(a.assign((0,d._)`${i}.schema`,c),a.assign((0,d._)`${i}.data`,e))})};let i={keyword:new d.Name("keyword"),schemaPath:new d.Name("schemaPath"),params:new d.Name("params"),propertyName:new d.Name("propertyName"),message:new d.Name("message"),schema:new d.Name("schema"),parentSchema:new d.Name("parentSchema")};function j(a,b,c){let{createErrors:g}=a.it;return!1===g?(0,d._)`{}`:function(a,b,c={}){let{gen:g,it:h}=a,j=[function({errorPath:a},{instancePath:b}){let c=b?(0,d.str)`${a}${(0,e.getErrorPath)(b,e.Type.Str)}`:a;return[f.default.instancePath,(0,d.strConcat)(f.default.instancePath,c)]}(h,c),function({keyword:a,it:{errSchemaPath:b}},{schemaPath:c,parentSchema:f}){let g=f?b:(0,d.str)`${b}/${a}`;return c&&(g=(0,d.str)`${g}${(0,e.getErrorPath)(c,e.Type.Str)}`),[i.schemaPath,g]}(a,c)];return function(a,{params:b,message:c},e){let{keyword:g,data:h,schemaValue:j,it:k}=a,{opts:l,propertyName:m,topSchemaRef:n,schemaPath:o}=k;e.push([i.keyword,g],[i.params,"function"==typeof b?b(a):b||(0,d._)`{}`]),l.messages&&e.push([i.message,"function"==typeof c?c(a):c]),l.verbose&&e.push([i.schema,j],[i.parentSchema,(0,d._)`${n}${o}`],[f.default.data,h]),m&&e.push([i.propertyName,m])}(a,b,j),g.object(...j)}(a,b,c)}},70522:function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;d=c(67278),c(46007),a.exports=void(d.lib.Cipher||(f=(e=d.lib).Base,g=e.WordArray,h=e.BufferedBlockAlgorithm,(i=d.enc).Utf8,j=i.Base64,k=d.algo.EvpKDF,l=e.Cipher=h.extend({cfg:f.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c),this._xformMode=a,this._key=b,this.reset()},reset:function(){h.reset.call(this),this._doReset()},process:function(a){return this._append(a),this._process()},finalize:function(a){return a&&this._append(a),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function a(a){return"string"==typeof a?u:s}return function(b){return{encrypt:function(c,d,e){return a(d).encrypt(b,c,d,e)},decrypt:function(c,d,e){return a(d).decrypt(b,c,d,e)}}}}()}),e.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),m=d.mode={},n=e.BlockCipherMode=f.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a,this._iv=b}}),o=m.CBC=function(){var a=n.extend();function b(a,b,c){var d,e=this._iv;e?(d=e,this._iv=void 0):d=this._prevBlock;for(var f=0;f<c;f++)a[b+f]^=d[f]}return a.Encryptor=a.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize;b.call(this,a,c,e),d.encryptBlock(a,c),this._prevBlock=a.slice(c,c+e)}}),a.Decryptor=a.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize,f=a.slice(c,c+e);d.decryptBlock(a,c),b.call(this,a,c,e),this._prevBlock=f}}),a}(),p=(d.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,d=c-a.sigBytes%c,e=d<<24|d<<16|d<<8|d,f=[],h=0;h<d;h+=4)f.push(e);var i=g.create(f,d);a.concat(i)},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},e.BlockCipher=l.extend({cfg:l.cfg.extend({mode:o,padding:p}),reset:function(){l.reset.call(this);var a,b=this.cfg,c=b.iv,d=b.mode;this._xformMode==this._ENC_XFORM_MODE?a=d.createEncryptor:(a=d.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==a?this._mode.init(this,c&&c.words):(this._mode=a.call(d,this,c&&c.words),this._mode.__creator=a)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a,b=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(b.pad(this._data,this.blockSize),a=this._process(!0)):(a=this._process(!0),b.unpad(a)),a},blockSize:4}),q=e.CipherParams=f.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),r=(d.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext,c=a.salt;return(c?g.create([0x53616c74,0x65645f5f]).concat(c).concat(b):b).toString(j)},parse:function(a){var b,c=j.parse(a),d=c.words;return 0x53616c74==d[0]&&0x65645f5f==d[1]&&(b=g.create(d.slice(2,4)),d.splice(0,4),c.sigBytes-=16),q.create({ciphertext:c,salt:b})}},s=e.SerializableCipher=f.extend({cfg:f.extend({format:r}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d),f=e.finalize(b),g=e.cfg;return q.create({ciphertext:f,key:c,iv:g.iv,algorithm:a,mode:g.mode,padding:g.padding,blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){return d=this.cfg.extend(d),b=this._parse(b,d.format),a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),t=(d.kdf={}).OpenSSL={execute:function(a,b,c,d,e){if(d||(d=g.random(8)),e)var f=k.create({keySize:b+c,hasher:e}).compute(a,d);else var f=k.create({keySize:b+c}).compute(a,d);var h=g.create(f.words.slice(b),4*c);return f.sigBytes=4*b,q.create({key:f,iv:h,salt:d})}},u=e.PasswordBasedCipher=s.extend({cfg:s.cfg.extend({kdf:t}),encrypt:function(a,b,c,d){var e=(d=this.cfg.extend(d)).kdf.execute(c,a.keySize,a.ivSize,d.salt,d.hasher);d.iv=e.iv;var f=s.encrypt.call(this,a,b,e.key,d);return f.mixIn(e),f},decrypt:function(a,b,c,d){d=this.cfg.extend(d),b=this._parse(b,d.format);var e=d.kdf.execute(c,a.keySize,a.ivSize,b.salt,d.hasher);return d.iv=e.iv,s.decrypt.call(this,a,b,e.key,d)}})))},70916:function(a,b,c){"use strict";let d;var e,f=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),g=this&&this.__setModuleDefault||(Object.create?function(a,b){Object.defineProperty(a,"default",{enumerable:!0,value:b})}:function(a,b){a.default=b}),h=this&&this.__importStar||(e=function(a){return(e=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[b.length]=c);return b})(a)},function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c=e(a),d=0;d<c.length;d++)"default"!==c[d]&&f(b,a,c[d]);return g(b,a),b}),i=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||f(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),b.gcpResidencyCache=b.METADATA_SERVER_DETECTION=b.HEADERS=b.HEADER_VALUE=b.HEADER_NAME=b.SECONDARY_HOST_ADDRESS=b.HOST_ADDRESS=b.BASE_PATH=void 0,b.instance=function(a){return p("instance",a)},b.project=function(a){return p("project",a)},b.universe=function(a){return p("universe",a)},b.bulk=r,b.isAvailable=s,b.resetIsAvailableCache=function(){d=void 0},b.getGCPResidency=t,b.setGCPResidency=u,b.requestTimeout=v;let j=c(79792),k=c(83346),l=c(10737),m=h(c(26981));b.BASE_PATH="/computeMetadata/v1",b.HOST_ADDRESS="http://169.254.169.254",b.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.",b.HEADER_NAME="Metadata-Flavor",b.HEADER_VALUE="Google",b.HEADERS=Object.freeze({[b.HEADER_NAME]:b.HEADER_VALUE});let n=m.log("gcp-metadata");function o(a){return a||(a=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||b.HOST_ADDRESS),/^https?:\/\//.test(a)||(a=`http://${a}`),new URL(b.BASE_PATH,a).href}async function p(a,c={},d=3,e=!1){let f=new Headers(b.HEADERS),g="",h={};("object"==typeof a?(new Headers(a.headers).forEach((a,b)=>f.set(b,a)),g=a.metadataKey,h=a.params||h,d=a.noResponseRetries||d,e=a.fastFail||e):g=a,"string"==typeof c)?g+=`/${c}`:(Object.keys(c).forEach(a=>{switch(a){case"params":case"property":case"headers":break;case"qs":throw Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw Error(`'${a}' is not a valid configuration option.`)}}),c.property&&(g+=`/${c.property}`),new Headers(c.headers).forEach((a,b)=>f.set(b,a)),h=c.params||h);let i=e?q:j.request,l={url:`${o()}/${g}`,headers:f,retryConfig:{noResponseRetries:d},params:h,responseType:"text",timeout:v()};n.info("instance request %j",l);let m=await i(l);n.info("instance metadata is %s",m.data);let r=m.headers.get(b.HEADER_NAME);if(r!==b.HEADER_VALUE)throw RangeError(`Invalid response from metadata service: incorrect ${b.HEADER_NAME} header. Expected '${b.HEADER_VALUE}', got ${r?`'${r}'`:"no header"}`);if("string"==typeof m.data)try{return k.parse(m.data)}catch{}return m.data}async function q(a){let c={...a,url:a.url?.toString().replace(o(),o(b.SECONDARY_HOST_ADDRESS))};return Promise.any([(0,j.request)(a),(0,j.request)(c)])}async function r(a){let b={};return await Promise.all(a.map(a=>(async()=>{let c=await p(a);b[a.metadataKey]=c})())),b}async function s(){if(process.env.METADATA_SERVER_DETECTION){let a=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(a in b.METADATA_SERVER_DETECTION))throw RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${a}\`, but it should be \`${Object.keys(b.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(a){case"assume-present":return!0;case"none":return!1;case"bios-only":return t()}}try{return void 0===d&&(d=p("instance",void 0,process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0,!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await d,!0}catch(a){if(process.env.DEBUG_AUTH&&console.info(a),"request-timeout"===a.type||a.response&&404===a.response.status)return!1;if(!(a.response&&404===a.response.status)&&(!a.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(a.code.toString()))){let b="UNKNOWN";a.code&&(b=a.code.toString()),process.emitWarning(`received unexpected error = ${a.message} code = ${b}`,"MetadataLookupWarning")}return!1}}function t(){return null===b.gcpResidencyCache&&u(),b.gcpResidencyCache}function u(a=null){b.gcpResidencyCache=null!==a?a:(0,l.detectGCPResidency)()}function v(){return 3e3*!t()}b.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"}),b.gcpResidencyCache=null,i(c(10737),b)},71188:(a,b,c)=>{"use strict";c.d(b,{z:()=>aV});var d=c(89850),e=c(79111),f=c(89392),g=c(18230),h=c(97832);function i(a){return Date.UTC(a.y,a.m-1,a.d,a.h,a.i,a.s)}function j(a,b){return a.y===b.y&&a.m===b.m&&a.d===b.d&&a.h===b.h&&a.i===b.i&&a.s===b.s}function k(a,b,c){return l(function(a,b){let c=new Date(Date.parse(a));if(isNaN(c))throw Error("Invalid ISO8601 passed to timezone parser.");let d=a.substring(9);return d.includes("Z")||d.includes("+")||d.includes("-")?n(c.getUTCFullYear(),c.getUTCMonth()+1,c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),"Etc/UTC"):n(c.getFullYear(),c.getMonth()+1,c.getDate(),c.getHours(),c.getMinutes(),c.getSeconds(),b)}(a,b),c)}function l(a,b){let c=new Date(i(a)),d=m(c,a.tz),e=i(a),f=i(d),g=new Date(c.getTime()+(e-f)),h=m(g,a.tz);if(j(h,a)){let b=new Date(g.getTime()-36e5);return j(m(b,a.tz),a)?b:g}let k=new Date(g.getTime()+i(a)-i(h));if(j(m(k,a.tz),a))return k;if(b)throw Error("Invalid date passed to fromTZ()");return g.getTime()>k.getTime()?g:k}function m(a,b){let c;try{c=new Intl.DateTimeFormat("en-US",{timeZone:b,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(a)}catch(c){let a=c instanceof Error?c.message:String(c);throw RangeError(`toTZ: Invalid timezone '${b}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let d={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let a of c)("year"===a.type||"month"===a.type||"day"===a.type||"hour"===a.type||"minute"===a.type||"second"===a.type)&&(d[a.type]=parseInt(a.value,10));if(isNaN(d.year)||isNaN(d.month)||isNaN(d.day)||isNaN(d.hour)||isNaN(d.minute)||isNaN(d.second))throw Error(`toTZ: Failed to parse all date components from timezone '${b}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(d)}`);return 24===d.hour&&(d.hour=0),{y:d.year,m:d.month,d:d.day,h:d.hour,i:d.minute,s:d.second,tz:b}}function n(a,b,c,d,e,f,g){return{y:a,m:b,d:c,h:d,i:e,s:f,tz:g}}var o=[1,2,4,8,16],p=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(a,b,c){this.pattern=a,this.timezone=b,this.mode=c?.mode??"auto",this.alternativeWeekdays=c?.alternativeWeekdays??!1,this.sloppyRanges=c?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!("string"==typeof this.pattern||this.pattern instanceof String))throw TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let a=this.pattern.match(/\S+/g)||[""],b=a.length;if(a.length<5||a.length>7)throw TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five, six, or seven space separated parts are required.");if("auto"!==this.mode){let a;switch(this.mode){case"5-part":a=5;break;case"6-part":a=6;break;case"7-part":a=7;break;case"5-or-6-parts":a=[5,6];break;case"6-or-7-parts":a=[6,7];break;default:a=0}if(!(Array.isArray(a)?a.includes(b):b===a)){let c=Array.isArray(a)?a.join(" or "):a.toString();throw TypeError(`CronPattern: mode '${this.mode}' requires exactly ${c} parts, but pattern '${this.pattern}' has ${b} parts.`)}}if(5===a.length&&a.unshift("0"),6===a.length&&a.push("*"),"LW"===a[3].toUpperCase()?(this.lastWeekday=!0,a[3]=""):a[3].toUpperCase().indexOf("L")>=0&&(a[3]=a[3].replace(/L/gi,""),this.lastDayOfMonth=!0),"*"==a[3]&&(this.starDOM=!0),"*"==a[6]&&(this.starYear=!0),a[4].length>=3&&(a[4]=this.replaceAlphaMonths(a[4])),a[5].length>=3&&(a[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(a[5]):this.replaceAlphaDays(a[5])),a[5].startsWith("+")&&(this.useAndLogic=!0,a[5]=a[5].substring(1),""===a[5]))throw TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");switch("*"==a[5]&&(this.starDOW=!0),this.pattern.indexOf("?")>=0&&(a[0]=a[0].replace(/\?/g,"*"),a[1]=a[1].replace(/\?/g,"*"),a[2]=a[2].replace(/\?/g,"*"),a[3]=a[3].replace(/\?/g,"*"),a[4]=a[4].replace(/\?/g,"*"),a[5]=a[5].replace(/\?/g,"*"),a[6]&&(a[6]=a[6].replace(/\?/g,"*"))),this.mode){case"5-part":a[0]="0",a[6]="*";break;case"6-part":case"5-or-6-parts":a[6]="*"}this.throwAtIllegalCharacters(a),this.partToArray("second",a[0],0,1),this.partToArray("minute",a[1],0,1),this.partToArray("hour",a[2],0,1),this.partToArray("day",a[3],-1,1),this.partToArray("month",a[4],-1,1);let c=this.alternativeWeekdays?-1:0;this.partToArray("dayOfWeek",a[5],c,63),this.partToArray("year",a[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(a,b,c,d){let e=this[a],f="day"===a&&this.lastDayOfMonth,g="day"===a&&this.lastWeekday;if(""===b&&!f&&!g)throw TypeError("CronPattern: configuration entry "+a+" ("+b+") is empty, check for trailing spaces.");if("*"===b)return e.fill(d);let h=b.split(",");if(h.length>1)for(let b=0;b<h.length;b++)this.partToArray(a,h[b],c,d);else -1!==b.indexOf("-")&&-1!==b.indexOf("/")?this.handleRangeWithStepping(b,a,c,d):-1!==b.indexOf("-")?this.handleRange(b,a,c,d):-1!==b.indexOf("/")?this.handleStepping(b,a,c,d):""!==b&&this.handleNumber(b,a,c,d)}throwAtIllegalCharacters(a){for(let b=0;b<a.length;b++)if((3===b?/[^/*0-9,\-WwLl]+/:5===b?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(a[b]))throw TypeError("CronPattern: configuration entry "+b+" ("+a[b]+") contains illegal characters.")}handleNumber(a,b,c,d){let e=this.extractNth(a,b),f=a.toUpperCase().includes("W");if("day"!==b&&f)throw TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");f&&(b="nearestWeekdays");let g=parseInt(e[0],10)+c;if(isNaN(g))throw TypeError("CronPattern: "+b+" is not a number: '"+a+"'");this.setPart(b,g,e[1]||d)}setPart(a,b,c){if(!Object.prototype.hasOwnProperty.call(this,a))throw TypeError("CronPattern: Invalid part specified: "+a);if("dayOfWeek"===a){if(7===b&&(b=0),b<0||b>6)throw RangeError("CronPattern: Invalid value for dayOfWeek: "+b);this.setNthWeekdayOfMonth(b,c);return}if("second"===a||"minute"===a){if(b<0||b>=60)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("hour"===a){if(b<0||b>=24)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("day"===a||"nearestWeekdays"===a){if(b<0||b>=31)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("month"===a){if(b<0||b>=12)throw RangeError("CronPattern: Invalid value for "+a+": "+b)}else if("year"===a&&(b<1||b>=1e4))throw RangeError("CronPattern: Invalid value for "+a+": "+b+" (supported range: 1-9999)");this[a][b]=c}validateNotNaN(a,b){if(isNaN(a))throw TypeError(b)}validateRange(a,b,c,d,e){if(a>b)throw TypeError("CronPattern: From value is larger than to value: '"+e+"'");if(void 0!==c){if(0===c)throw TypeError("CronPattern: Syntax error, illegal stepping: 0");if(c>this[d].length)throw TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[d].length+")")}}handleRangeWithStepping(a,b,c,d){if(a.toUpperCase().includes("W"))throw TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");let e=this.extractNth(a,b),f=e[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(null===f)throw TypeError("CronPattern: Syntax error, illegal range with stepping: '"+a+"'");let[,g,h,i]=f,j=parseInt(g,10)+c,k=parseInt(h,10)+c,l=parseInt(i,10);this.validateNotNaN(j,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(k,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateNotNaN(l,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(j,k,l,b,a);for(let a=j;a<=k;a+=l)this.setPart(b,a,e[1]||d)}extractNth(a,b){let c=a,d;if(c.includes("#")){if("dayOfWeek"!==b)throw Error("CronPattern: nth (#) only allowed in day-of-week field");d=c.split("#")[1],c=c.split("#")[0]}else if(c.toUpperCase().endsWith("L")){if("dayOfWeek"!==b)throw Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");d="L",c=c.slice(0,-1)}return[c,d]}handleRange(a,b,c,d){if(a.toUpperCase().includes("W"))throw TypeError("CronPattern: Syntax error, W is not allowed in a range.");let e=this.extractNth(a,b),f=e[0].split("-");if(2!==f.length)throw TypeError("CronPattern: Syntax error, illegal range: '"+a+"'");let g=parseInt(f[0],10)+c,h=parseInt(f[1],10)+c;this.validateNotNaN(g,"CronPattern: Syntax error, illegal lower range (NaN)"),this.validateNotNaN(h,"CronPattern: Syntax error, illegal upper range (NaN)"),this.validateRange(g,h,void 0,b,a);for(let a=g;a<=h;a++)this.setPart(b,a,e[1]||d)}handleStepping(a,b,c,d){if(a.toUpperCase().includes("W"))throw TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");let e=this.extractNth(a,b),f=e[0].split("/");if(2!==f.length)throw TypeError("CronPattern: Syntax error, illegal stepping: '"+a+"'");if(this.sloppyRanges)""===f[0]&&(f[0]="*");else{if(""===f[0])throw TypeError("CronPattern: Syntax error, stepping with missing prefix ('"+a+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");if("*"!==f[0])throw TypeError("CronPattern: Syntax error, stepping with numeric prefix ('"+a+"') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.")}let g=0;"*"!==f[0]&&(g=parseInt(f[0],10)+c);let h=parseInt(f[1],10);this.validateNotNaN(h,"CronPattern: Syntax error, illegal stepping: (NaN)"),this.validateRange(0,this[b].length-1,h,b,a);for(let a=g;a<this[b].length;a+=h)this.setPart(b,a,e[1]||d)}replaceAlphaDays(a){return a.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaDaysQuartz(a){return a.replace(/sun/gi,"1").replace(/mon/gi,"2").replace(/tue/gi,"3").replace(/wed/gi,"4").replace(/thu/gi,"5").replace(/fri/gi,"6").replace(/sat/gi,"7")}replaceAlphaMonths(a){return a.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames(a){let b=a.trim().toLowerCase();if("@yearly"===b||"@annually"===b)return"0 0 1 1 *";if("@monthly"===b)return"0 0 1 * *";if("@weekly"===b)return"0 0 * * 0";if("@daily"===b||"@midnight"===b)return"0 0 * * *";if("@hourly"===b)return"0 * * * *";if("@reboot"===b)throw TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");return a}setNthWeekdayOfMonth(a,b){if("number"!=typeof b&&"L"===b.toUpperCase())this.dayOfWeek[a]=32|this.dayOfWeek[a];else if(63===b)this.dayOfWeek[a]=63;else if(b<6&&b>0)this.dayOfWeek[a]=this.dayOfWeek[a]|o[b-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${b}, Type: ${typeof b}`)}},q=[31,28,31,30,31,30,31,31,30,31,30,31],r=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]],s=class a{tz;ms;second;minute;hour;day;month;year;constructor(b,c){if(this.tz=c,b&&b instanceof Date)if(isNaN(b))throw TypeError("CronDate: Invalid date passed to CronDate constructor");else this.fromDate(b);else if(null==b)this.fromDate(new Date);else if(b&&"string"==typeof b)this.fromString(b);else if(b instanceof a)this.fromCronDate(b);else throw TypeError("CronDate: Invalid type ("+typeof b+") passed to CronDate constructor")}getLastDayOfMonth(a,b){return 1!==b?q[b]:new Date(Date.UTC(a,b+1,0)).getUTCDate()}getLastWeekday(a,b){let c=this.getLastDayOfMonth(a,b),d=new Date(Date.UTC(a,b,c)).getUTCDay();return 0===d?c-2:6===d?c-1:c}getNearestWeekday(a,b,c){let d=this.getLastDayOfMonth(a,b);if(c>d)return -1;let e=new Date(Date.UTC(a,b,c)).getUTCDay();return 0===e?c===d?c-2:c+1:6===e?1===c?c+2:c-1:c}isNthWeekdayOfMonth(a,b,c,d){let e=new Date(Date.UTC(a,b,c)).getUTCDay(),f=0;for(let d=1;d<=c;d++)new Date(Date.UTC(a,b,d)).getUTCDay()===e&&f++;if(63&d&&o[f-1]&d)return!0;if(32&d){let d=this.getLastDayOfMonth(a,b);for(let f=c+1;f<=d;f++)if(new Date(Date.UTC(a,b,f)).getUTCDay()===e)return!1;return!0}return!1}fromDate(a){if(void 0!==this.tz)if("number"==typeof this.tz)this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes()+this.tz,this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),this.apply();else try{let b=m(a,this.tz);this.ms=a.getMilliseconds(),this.second=b.s,this.minute=b.i,this.hour=b.h,this.day=b.d,this.month=b.m-1,this.year=b.y}catch(b){let a=b instanceof Error?b.message:String(b);throw TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${a}`)}else this.ms=a.getMilliseconds(),this.second=a.getSeconds(),this.minute=a.getMinutes(),this.hour=a.getHours(),this.day=a.getDate(),this.month=a.getMonth(),this.year=a.getFullYear()}fromCronDate(a){this.tz=a.tz,this.year=a.year,this.month=a.month,this.day=a.day,this.hour=a.hour,this.minute=a.minute,this.second=a.second,this.ms=a.ms}apply(){if(!(this.month>11)&&!(this.month<0)&&!(this.day>q[this.month])&&!(this.day<1)&&!(this.hour>59)&&!(this.minute>59)&&!(this.second>59)&&!(this.hour<0)&&!(this.minute<0)&&!(this.second<0))return!1;{let a=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=a.getUTCMilliseconds(),this.second=a.getUTCSeconds(),this.minute=a.getUTCMinutes(),this.hour=a.getUTCHours(),this.day=a.getUTCDate(),this.month=a.getUTCMonth(),this.year=a.getUTCFullYear(),!0}}fromString(a){if("number"!=typeof this.tz)return this.fromDate(k(a,this.tz));{let b=k(a);this.ms=b.getUTCMilliseconds(),this.second=b.getUTCSeconds(),this.minute=b.getUTCMinutes(),this.hour=b.getUTCHours(),this.day=b.getUTCDate(),this.month=b.getUTCMonth(),this.year=b.getUTCFullYear(),this.apply()}}findNext(a,b,c,d){return this._findMatch(a,b,c,d,1)}_findMatch(a,b,c,d,e){let f=this[b],g;c.lastDayOfMonth&&(g=this.getLastDayOfMonth(this.year,this.month));let h=c.starDOW||"day"!=b?void 0:new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),i=this[b]+d,j=1===e?a=>a<c[b].length:a=>a>=0;for(let k=i;j(k);k+=e){let e=c[b][k];if("day"===b&&!e){for(let a=0;a<c.nearestWeekdays.length;a++)if(c.nearestWeekdays[a]){let b=this.getNearestWeekday(this.year,this.month,a-d);if(-1===b)continue;if(b===k-d){e=1;break}}}if("day"===b&&c.lastWeekday&&k-d===this.getLastWeekday(this.year,this.month)&&(e=1),"day"===b&&c.lastDayOfMonth&&k-d==g&&(e=1),"day"===b&&!c.starDOW){let b=c.dayOfWeek[(h+(k-d-1))%7];if(b&&63&b)b=+!!this.isNthWeekdayOfMonth(this.year,this.month,k-d,b);else if(b)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${b}`);e=c.useAndLogic||a.domAndDow||c.starDOM?e&&b:e||b}if(e)return this[b]=k-d,f!==this[b]?2:1}return 3}recurse(a,b,c){if(0===c&&!a.starYear){if(this.year>=0&&this.year<a.year.length&&0===a.year[this.year]){let b=-1;for(let c=this.year+1;c<a.year.length&&c<1e4;c++)if(1===a.year[c]){b=c;break}if(-1===b)return null;this.year=b,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let d=this.findNext(b,r[c][0],a,r[c][2]);if(d>1){let e=c+1;for(;e<r.length;)this[r[e][0]]=-r[e][2],e++;if(3===d){if(this[r[c][1]]++,this[r[c][0]]=-r[c][2],this.apply(),0===c&&!a.starYear){for(;this.year>=0&&this.year<a.year.length&&0===a.year[this.year]&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=a.year.length)return null}return this.recurse(a,b,0)}if(this.apply())return this.recurse(a,b,c-1)}return(c+=1)>=r.length?this:(a.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(a,b,c)}increment(a,b,c){return this.second+=void 0!==b.interval&&b.interval>1&&c?b.interval:1,this.ms=0,this.apply(),this.recurse(a,b,0)}decrement(a,b){return this.second-=void 0!==b.interval&&b.interval>1?b.interval:1,this.ms=0,this.apply(),this.recurseBackward(a,b,0,0)}recurseBackward(a,b,c,d=0){if(d>1e4)return null;if(0===c&&!a.starYear){if(this.year>=0&&this.year<a.year.length&&0===a.year[this.year]){let b=-1;for(let c=this.year-1;c>=0;c--)if(1===a.year[c]){b=c;break}if(-1===b)return null;this.year=b,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let e=this.findPrevious(b,r[c][0],a,r[c][2]);if(e>1){let f=c+1;for(;f<r.length;){let b=r[f][0],c=r[f][2],d=this.getMaxPatternValue(b,a,c);this[b]=d,f++}if(3===e){if(this[r[c][1]]--,0===c){let a=this.getLastDayOfMonth(this.year,this.month);this.day>a&&(this.day=a)}if(1===c)if(this.day<=0)this.day=1;else{let a=this.year,b=this.month;for(;b<0;)b+=12,a--;for(;b>11;)b-=12,a++;let c=1!==b?q[b]:new Date(Date.UTC(a,b+1,0)).getUTCDate();this.day>c&&(this.day=c)}this.apply();let e=r[c][0],f=r[c][2],g=this.getMaxPatternValue(e,a,f);if("day"===e){let a=this.getLastDayOfMonth(this.year,this.month);this[e]=Math.min(g,a)}else this[e]=g;if(this.apply(),0===c){let b=r[1][2],c=Math.min(this.getMaxPatternValue("day",a,b),this.getLastDayOfMonth(this.year,this.month));c!==this.day&&(this.day=c,this.hour=this.getMaxPatternValue("hour",a,r[2][2]),this.minute=this.getMaxPatternValue("minute",a,r[3][2]),this.second=this.getMaxPatternValue("second",a,r[4][2]))}if(0===c&&!a.starYear){for(;this.year>=0&&this.year<a.year.length&&0===a.year[this.year];)this.year--;if(this.year<0)return null}return this.recurseBackward(a,b,0,d+1)}if(this.apply())return this.recurseBackward(a,b,c-1,d+1)}return(c+=1)>=r.length?this:this.year<0?null:this.recurseBackward(a,b,c,d+1)}getMaxPatternValue(a,b,c){if("day"===a&&b.lastDayOfMonth||"day"===a&&!b.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let d=b[a].length-1;d>=0;d--)if(b[a][d])return d-c;return b[a].length-1-c}findPrevious(a,b,c,d){return this._findMatch(a,b,c,d,-1)}getDate(a){return a||void 0===this.tz?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):"number"==typeof this.tz?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):l(n(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(a,b){if(!a.starYear&&(this.year<0||this.year>=a.year.length||0===a.year[this.year]))return!1;for(let c=0;c<r.length;c++){let d=r[c][0],e=r[c][2],f=this[d];if(f+e<0||f+e>=a[d].length)return!1;let g=a[d][f+e];if("day"===d){if(!g){for(let b=0;b<a.nearestWeekdays.length;b++)if(a.nearestWeekdays[b]){let a=this.getNearestWeekday(this.year,this.month,b-e);if(-1!==a&&a===f){g=1;break}}}if(a.lastWeekday&&f===this.getLastWeekday(this.year,this.month)&&(g=1),a.lastDayOfMonth&&f===this.getLastDayOfMonth(this.year,this.month)&&(g=1),!a.starDOW){let c=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),d=a.dayOfWeek[(c+(f-1))%7];d&&63&d&&(d=+!!this.isNthWeekdayOfMonth(this.year,this.month,f,d)),g=a.useAndLogic||b.domAndDow||a.starDOM?g&&d:g||d}}if(!g)return!1}return!0}};function t(a){return"[object Function]"===Object.prototype.toString.call(a)||"function"==typeof a||a instanceof Function}var u=[],v=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(a){if(void 0!==this.options.dayOffset&&0!==this.options.dayOffset){let b=24*this.options.dayOffset*36e5;return new Date(a.getTime()+b)}return a}constructor(a,b,c){let d,e;if(t(b))e=b;else if("object"==typeof b)d=b;else if(void 0!==b)throw Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(t(c))e=c;else if("object"==typeof c)d=c;else if(void 0!==c)throw Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=d?.name,this.options=function(a){if(void 0===a&&(a={}),delete a.name,void 0!==a.legacyMode&&void 0===a.domAndDow?a.domAndDow=!a.legacyMode:void 0===a.domAndDow&&(a.domAndDow=!1),a.legacyMode=!a.domAndDow,a.paused=void 0!==a.paused&&a.paused,a.maxRuns=void 0===a.maxRuns?1/0:a.maxRuns,a.catch=void 0!==a.catch&&a.catch,a.interval=void 0===a.interval?0:parseInt(a.interval.toString(),10),a.utcOffset=void 0===a.utcOffset?void 0:parseInt(a.utcOffset.toString(),10),a.dayOffset=void 0===a.dayOffset?0:parseInt(a.dayOffset.toString(),10),a.unref=void 0!==a.unref&&a.unref,a.mode=void 0===a.mode?"auto":a.mode,a.alternativeWeekdays=void 0!==a.alternativeWeekdays&&a.alternativeWeekdays,a.sloppyRanges=void 0!==a.sloppyRanges&&a.sloppyRanges,!["auto","5-part","6-part","7-part","5-or-6-parts","6-or-7-parts"].includes(a.mode))throw Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");if(a.startAt&&(a.startAt=new s(a.startAt,a.timezone)),a.stopAt&&(a.stopAt=new s(a.stopAt,a.timezone)),null!==a.interval){if(isNaN(a.interval))throw Error("CronOptions: Supplied value for interval is not a number");if(a.interval<0)throw Error("CronOptions: Supplied value for interval can not be negative")}if(void 0!==a.utcOffset){if(isNaN(a.utcOffset))throw Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if(a.utcOffset<-870||a.utcOffset>870)throw Error("CronOptions: utcOffset out of bounds.");if(void 0!==a.utcOffset&&a.timezone)throw Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if(!0!==a.unref&&!1!==a.unref)throw Error("CronOptions: Unref should be either true, false or undefined(false).");if(void 0!==a.dayOffset&&0!==a.dayOffset&&isNaN(a.dayOffset))throw Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");return a}(d),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:d?d.maxRuns:void 0,paused:!!d&&d.paused,pattern:new p("* * * * *",void 0,{mode:"auto"})},a&&(a instanceof Date||"string"==typeof a&&a.indexOf(":")>0)?this._states.once=new s(a,this.getTz()):this._states.pattern=new p(a,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(u.find(a=>a.name===this.name))throw Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");u.push(this)}return void 0!==e&&t(e)&&(this.fn=e,this.schedule()),this}nextRun(a){let b=this._next(a);return b?this.applyDayOffset(b.getDate(!1)):null}nextRuns(a,b){void 0!==this._states.maxRuns&&a>this._states.maxRuns&&(a=this._states.maxRuns);let c=b||this._states.currentRun||void 0;return this._enumerateRuns(a,c,"next")}previousRuns(a,b){return this._enumerateRuns(a,b||void 0,"previous")}_enumerateRuns(a,b,c){let d=[],e=b?new s(b,this.getTz()):null,f="next"===c?this._next:this._previous;for(;a--;){let a=f.call(this,e);if(!a)break;let b=a.getDate(!1);d.push(this.applyDayOffset(b)),e=a}return d}match(a){if(this._states.once){let b=new s(a,this.getTz());b.ms=0;let c=new s(this._states.once,this.getTz());return c.ms=0,b.getTime()===c.getTime()}let b=new s(a,this.getTz());return b.ms=0,b.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let a=this.nextRun(this._states.currentRun),b=!this._states.paused,c=void 0!==this.fn,d=!this._states.kill;return b&&c&&d&&null!==a}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(a){let b=this._next(a);return b?a instanceof s||a instanceof Date?b.getTime()-a.getTime():b.getTime()-new s(a).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let a=u.indexOf(this);a>=0&&u.splice(a,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(a){var b;if(a&&this.fn)throw Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");a&&(this.fn=a);let c=this.msToNext(),d=this.nextRun(this._states.currentRun);return null==c||isNaN(c)||null===d||(c>3e4&&(c=3e4),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(d),c),this._states.currentTimeout&&this.options.unref&&(b=this._states.currentTimeout,"u">typeof Deno&&"u">typeof Deno.unrefTimer?Deno.unrefTimer(b):b&&"u">typeof b.unref&&b.unref())),this}async _trigger(a){this._states.blocking=!0,this._states.currentRun=new s(void 0,this.getTz());try{if(this.options.catch)try{void 0!==this.fn&&await this.fn(this,this.options.context)}catch(a){if(t(this.options.catch))try{this.options.catch(a,this)}catch{}}else void 0!==this.fn&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new s(a,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(a){let b=new Date,c=!this._states.paused&&b.getTime()>=a.getTime(),d=this._states.blocking&&this.options.protect;c&&!d?(void 0!==this._states.maxRuns&&this._states.maxRuns--,this._trigger()):c&&d&&t(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(a){let b=!!(a||this._states.currentRun),c=!1;!a&&this.options.startAt&&this.options.interval&&([a,b]=this._calculatePreviousRun(a,b),c=!a),a=new s(a,this.getTz()),this.options.startAt&&a&&a.getTime()<this.options.startAt.getTime()&&(a=this.options.startAt);let d=this._states.once||new s(a,this.getTz());return c||d===this._states.once||(d=d.increment(this._states.pattern,this.options,b)),this._states.once&&this._states.once.getTime()<=a.getTime()||null===d||void 0!==this._states.maxRuns&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&d.getTime()>=this.options.stopAt.getTime()?null:d}_previous(a){let b=new s(a,this.getTz());this.options.stopAt&&b.getTime()>this.options.stopAt.getTime()&&(b=this.options.stopAt);let c=new s(b,this.getTz());return this._states.once?this._states.once.getTime()<b.getTime()?this._states.once:null:null===(c=c.decrement(this._states.pattern,this.options))||this.options.startAt&&c.getTime()<this.options.startAt.getTime()?null:c}_calculatePreviousRun(a,b){let c=new s(void 0,this.getTz()),d=a;if(this.options.startAt.getTime()<=c.getTime()){let a=(d=this.options.startAt).getTime()+1e3*this.options.interval;for(;a<=c.getTime();)a=(d=new s(d,this.getTz()).increment(this._states.pattern,this.options,!0)).getTime()+1e3*this.options.interval;b=!0}return null===d&&(d=void 0),[d,b]}};function w(a,b){try{let c=new v(a,{timezone:b,paused:!0});return c.nextRun(),c.stop(),{valid:!0}}catch(a){return{valid:!1,error:a instanceof Error?a.message:"Invalid cron pattern"}}}var x=c(33873),y=c.n(x),z=c(29021),A=c(79748),B=c(94735),C=c(51455),D=c(57075),E=c(76760);let F={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},G={root:".",fileFilter:a=>!0,directoryFilter:a=>!0,type:F.FILE_TYPE,lstat:!1,depth:0x80000000,alwaysStat:!1,highWaterMark:4096};Object.freeze(G);let H="READDIRP_RECURSIVE_ERROR",I=new Set(["ENOENT","EPERM","EACCES","ELOOP",H]),J=[F.DIR_TYPE,F.EVERYTHING_TYPE,F.FILE_DIR_TYPE,F.FILE_TYPE],K=new Set([F.DIR_TYPE,F.EVERYTHING_TYPE,F.FILE_DIR_TYPE]),L=new Set([F.EVERYTHING_TYPE,F.FILE_DIR_TYPE,F.FILE_TYPE]),M="win32"===process.platform,N=a=>!0,O=a=>{if(void 0===a)return N;if("function"==typeof a)return a;if("string"==typeof a){let b=a.trim();return a=>a.basename===b}if(Array.isArray(a)){let b=a.map(a=>a.trim());return a=>b.some(b=>a.basename===b)}return N};class P extends D.Readable{constructor(a={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:a.highWaterMark});let b={...G,...a},{root:c,type:d}=b;this._fileFilter=O(b.fileFilter),this._directoryFilter=O(b.directoryFilter);let e=b.lstat?C.lstat:C.stat;M?this._stat=a=>e(a,{bigint:!0}):this._stat=e,this._maxDepth=b.depth??G.depth,this._wantsDir=!!d&&K.has(d),this._wantsFile=!!d&&L.has(d),this._wantsEverything=d===F.EVERYTHING_TYPE,this._root=(0,E.resolve)(c),this._isDirent=!b.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(c,1)],this.reading=!1,this.parent=void 0}async _read(a){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&a>0;){let b=this.parent,c=b&&b.files;if(c&&c.length>0){let{path:d,depth:e}=b,f=c.splice(0,a).map(a=>this._formatEntry(a,d));for(let b of(await Promise.all(f))){if(!b)continue;if(this.destroyed)return;let c=await this._getEntryType(b);"directory"===c&&this._directoryFilter(b)?(e<=this._maxDepth&&this.parents.push(this._exploreDir(b.fullPath,e+1)),this._wantsDir&&(this.push(b),a--)):("file"===c||this._includeAsFile(b))&&this._fileFilter(b)&&this._wantsFile&&(this.push(b),a--)}}else{let a=this.parents.pop();if(!a){this.push(null);break}if(this.parent=await a,this.destroyed)return}}}catch(a){this.destroy(a)}finally{this.reading=!1}}}async _exploreDir(a,b){let c;try{c=await (0,C.readdir)(a,this._rdOptions)}catch(a){this._onError(a)}return{files:c,depth:b,path:a}}async _formatEntry(a,b){let c,d=this._isDirent?a.name:a;try{let e=(0,E.resolve)((0,E.join)(b,d));(c={path:(0,E.relative)(this._root,e),fullPath:e,basename:d})[this._statsProp]=this._isDirent?a:await this._stat(e)}catch(a){this._onError(a);return}return c}_onError(a){I.has(a.code)&&!this.destroyed?this.emit("warn",a):this.destroy(a)}async _getEntryType(a){if(!a&&this._statsProp in a)return"";let b=a[this._statsProp];if(b.isFile())return"file";if(b.isDirectory())return"directory";if(b&&b.isSymbolicLink()){let b=a.fullPath;try{let a=await (0,C.realpath)(b),c=await (0,C.lstat)(a);if(c.isFile())return"file";if(c.isDirectory()){let c=a.length;if(b.startsWith(a)&&b.substr(c,1)===E.sep){let c=Error(`Circular symlink detected: "${b}" points to "${a}"`);return c.code=H,this._onError(c)}return"directory"}}catch(a){return this._onError(a),""}}}_includeAsFile(a){let b=a&&a[this._statsProp];return b&&this._wantsEverything&&!b.isDirectory()}}var Q=c(21820);let R=()=>{},S=process.platform,T="win32"===S,U="darwin"===S,V="linux"===S,W="freebsd"===S,X="OS400"===(0,Q.type)(),Y={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},Z={lstat:A.lstat,stat:A.stat},$="listeners",_="errHandlers",aa="rawEmitters",ab=[$,_,aa],ac=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ad=(a,b)=>{a instanceof Set?a.forEach(b):b(a)},ae=(a,b,c)=>{let d=a[b];d instanceof Set||(a[b]=d=new Set([d])),d.add(c)},af=(a,b,c)=>{let d=a[b];d instanceof Set?d.delete(c):d===c&&delete a[b]},ag=a=>a instanceof Set?0===a.size:!a,ah=new Map;function ai(a,b,c,d,e){try{return(0,z.watch)(a,{persistent:b.persistent},(b,d)=>{c(a),e(b,d,{watchedPath:a}),d&&a!==d&&aj(x.resolve(a,d),$,x.join(a,d))})}catch(a){d(a);return}}let aj=(a,b,c,d,e)=>{let f=ah.get(a);f&&ad(f[b],a=>{a(c,d,e)})},ak=new Map;class al{constructor(a){this.fsw=a,this._boundHandleError=b=>a._handleError(b)}_watchWithNodeFs(a,b){let c,d=this.fsw.options,e=x.dirname(a),f=x.basename(a);this.fsw._getWatchedDir(e).add(f);let g=x.resolve(a),h={persistent:d.persistent};if(b||(b=R),d.usePolling)h.interval=d.interval!==d.binaryInterval&&ac.has(x.extname(f).slice(1).toLowerCase())?d.binaryInterval:d.interval,c=((a,b,c,d)=>{let{listener:e,rawEmitter:f}=d,g=ak.get(b),h=g&&g.options;return h&&(h.persistent<c.persistent||h.interval>c.interval)&&((0,z.unwatchFile)(b),g=void 0),g?(ae(g,$,e),ae(g,aa,f)):(g={listeners:e,rawEmitters:f,options:c,watcher:(0,z.watchFile)(b,c,(c,d)=>{ad(g.rawEmitters,a=>{a(Y.CHANGE,b,{curr:c,prev:d})});let e=c.mtimeMs;(c.size!==d.size||e>d.mtimeMs||0===e)&&ad(g.listeners,b=>b(a,c))})},ak.set(b,g)),()=>{af(g,$,e),af(g,aa,f),ag(g.listeners)&&(ak.delete(b),(0,z.unwatchFile)(b),g.options=g.watcher=void 0,Object.freeze(g))}})(a,g,h,{listener:b,rawEmitter:this.fsw._emitRaw});else c=((a,b,c,d)=>{let e,{listener:f,errHandler:g,rawEmitter:h}=d,i=ah.get(b);if(!c.persistent){if(!(e=ai(a,c,f,g,h)))return;return e.close.bind(e)}if(i)ae(i,$,f),ae(i,_,g),ae(i,aa,h);else{if(!(e=ai(a,c,aj.bind(null,b,$),g,aj.bind(null,b,aa))))return;e.on(Y.ERROR,async c=>{let d=aj.bind(null,b,_);if(i&&(i.watcherUnusable=!0),T&&"EPERM"===c.code)try{let b=await (0,A.open)(a,"r");await b.close(),d(c)}catch(a){}else d(c)}),i={listeners:f,errHandlers:g,rawEmitters:h,watcher:e},ah.set(b,i)}return()=>{let a;af(i,$,f),af(i,_,g),af(i,aa,h),ag(i.listeners)&&(i.watcher.close(),ah.delete(b),ab.forEach((a=i,b=>{let c=a[b];c instanceof Set?c.clear():delete a[b]})),i.watcher=void 0,Object.freeze(i))}})(a,g,h,{listener:b,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return c}_handleFile(a,b,c){if(this.fsw.closed)return;let d=x.dirname(a),e=x.basename(a),f=this.fsw._getWatchedDir(d),g=b;if(f.has(e))return;let h=async(b,c)=>{if(this.fsw._throttle("watch",a,5))if(c&&0!==c.mtimeMs){if(f.has(e)){let b=c.atimeMs,d=c.mtimeMs;(!b||b<=d||d!==g.mtimeMs)&&this.fsw._emit(Y.CHANGE,a,c),g=c}}else try{let c=await (0,A.stat)(a);if(this.fsw.closed)return;let d=c.atimeMs,e=c.mtimeMs;if((!d||d<=e||e!==g.mtimeMs)&&this.fsw._emit(Y.CHANGE,a,c),(U||V||W)&&g.ino!==c.ino){this.fsw._closeFile(b),g=c;let d=this._watchWithNodeFs(a,h);d&&this.fsw._addPathCloser(b,d)}else g=c}catch(a){this.fsw._remove(d,e)}},i=this._watchWithNodeFs(a,h);if(!(c&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(a)){if(!this.fsw._throttle(Y.ADD,a,0))return;this.fsw._emit(Y.ADD,a,b)}return i}async _handleSymlink(a,b,c,d){if(this.fsw.closed)return;let e=a.fullPath,f=this.fsw._getWatchedDir(b);if(!this.fsw.options.followSymlinks){let b;this.fsw._incrReadyCount();try{b=await (0,A.realpath)(c)}catch(a){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return f.has(d)?this.fsw._symlinkPaths.get(e)!==b&&(this.fsw._symlinkPaths.set(e,b),this.fsw._emit(Y.CHANGE,c,a.stats)):(f.add(d),this.fsw._symlinkPaths.set(e,b),this.fsw._emit(Y.ADD,c,a.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(e))return!0;this.fsw._symlinkPaths.set(e,!0)}_handleRead(a,b,c,d,e,f,g){if(a=x.join(a,""),!(g=this.fsw._throttle("readdir",a,1e3)))return;let h=this.fsw._getWatchedDir(c.path),i=new Set,j=this.fsw._readdirp(a,{fileFilter:a=>c.filterPath(a),directoryFilter:a=>c.filterDir(a)});if(j)return j.on("data",async g=>{if(this.fsw.closed){j=void 0;return}let k=g.path,l=x.join(a,k);if(i.add(k),!(g.stats.isSymbolicLink()&&await this._handleSymlink(g,a,l,k))){if(this.fsw.closed){j=void 0;return}k!==d&&(d||h.has(k))||(this.fsw._incrReadyCount(),l=x.join(e,x.relative(e,l)),this._addToNodeFs(l,b,c,f+1))}}).on(Y.ERROR,this._boundHandleError),new Promise((b,k)=>{if(!j)return k();j.once("end",()=>{if(this.fsw.closed){j=void 0;return}let k=!!g&&g.clear();b(void 0),h.getChildren().filter(b=>b!==a&&!i.has(b)).forEach(b=>{this.fsw._remove(a,b)}),j=void 0,k&&this._handleRead(a,!1,c,d,e,f,g)})})}async _handleDir(a,b,c,d,e,f,g){let h,i,j=this.fsw._getWatchedDir(x.dirname(a)),k=j.has(x.basename(a));c&&this.fsw.options.ignoreInitial||e||k||this.fsw._emit(Y.ADD_DIR,a,b),j.add(x.basename(a)),this.fsw._getWatchedDir(a);let l=this.fsw.options.depth;if((null==l||d<=l)&&!this.fsw._symlinkPaths.has(g)){if(!e&&(await this._handleRead(a,c,f,e,a,d,h),this.fsw.closed))return;i=this._watchWithNodeFs(a,(b,c)=>{c&&0===c.mtimeMs||this._handleRead(b,!1,f,e,a,d,h)})}return i}async _addToNodeFs(a,b,c,d,e){let f=this.fsw._emitReady;if(this.fsw._isIgnored(a)||this.fsw.closed)return f(),!1;let g=this.fsw._getWatchHelpers(a);c&&(g.filterPath=a=>c.filterPath(a),g.filterDir=a=>c.filterDir(a));try{let c,h=await Z[g.statMethod](g.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(g.watchPath,h))return f(),!1;let i=this.fsw.options.followSymlinks;if(h.isDirectory()){let f=x.resolve(a),j=i?await (0,A.realpath)(a):a;if(this.fsw.closed||(c=await this._handleDir(g.watchPath,h,b,d,e,g,j),this.fsw.closed))return;f!==j&&void 0!==j&&this.fsw._symlinkPaths.set(f,j)}else if(h.isSymbolicLink()){let e=i?await (0,A.realpath)(a):a;if(this.fsw.closed)return;let f=x.dirname(g.watchPath);if(this.fsw._getWatchedDir(f).add(g.watchPath),this.fsw._emit(Y.ADD,g.watchPath,h),c=await this._handleDir(f,h,b,d,a,g,e),this.fsw.closed)return;void 0!==e&&this.fsw._symlinkPaths.set(x.resolve(a),e)}else c=this._handleFile(g.watchPath,h,b);return f(),c&&this.fsw._addPathCloser(a,c),!1}catch(b){if(this.fsw._handleError(b))return f(),a}}}let am=/\\/g,an=/\/\//,ao=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ap=/^\.[/\\]/;function aq(a){return Array.isArray(a)?a:[a]}let ar=a=>"object"==typeof a&&null!==a&&!(a instanceof RegExp);function as(a,b,c){let d=function(a){if("string"!=typeof a)throw Error("string expected");a=(a=x.normalize(a)).replace(/\\/g,"/");let b=!1;a.startsWith("//")&&(b=!0);let c=/\/\//;for(;a.match(c);)a=a.replace(c,"/");return b&&(a="/"+a),a}(b);for(let b=0;b<a.length;b++)if((0,a[b])(d,c))return!0;return!1}let at=a=>{let b=aq(a).flat();if(!b.every(a=>"string"==typeof a))throw TypeError(`Non-string provided as watch path: ${b}`);return b.map(av)},au=a=>{let b=a.replace(am,"/"),c=!1;for(b.startsWith("//")&&(c=!0);b.match(an);)b=b.replace(an,"/");return c&&(b="/"+b),b},av=a=>au(x.normalize(au(a))),aw=(a="")=>b=>"string"==typeof b?av(x.isAbsolute(b)?b:x.join(a,b)):b,ax=Object.freeze(new Set);class ay{constructor(a,b){this.path=a,this._removeWatcher=b,this.items=new Set}add(a){let{items:b}=this;b&&"."!==a&&".."!==a&&b.add(a)}async remove(a){let{items:b}=this;if(!b||(b.delete(a),b.size>0))return;let c=this.path;try{await (0,A.readdir)(c)}catch(a){this._removeWatcher&&this._removeWatcher(x.dirname(c),x.basename(c))}}has(a){let{items:b}=this;if(b)return b.has(a)}getChildren(){let{items:a}=this;return a?[...a.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=R,this.items=ax,Object.freeze(this)}}class az{constructor(a,b,c){this.fsw=c;let d=a;this.path=a=a.replace(ap,""),this.watchPath=d,this.fullWatchPath=x.resolve(d),this.dirParts=[],this.dirParts.forEach(a=>{a.length>1&&a.pop()}),this.followSymlinks=b,this.statMethod=b?"stat":"lstat"}entryPath(a){return x.join(this.watchPath,x.relative(this.watchPath,a.fullPath))}filterPath(a){let{stats:b}=a;if(b&&b.isSymbolicLink())return this.filterDir(a);let c=this.entryPath(a);return this.fsw._isntIgnored(c,b)&&this.fsw._hasReadPermissions(b)}filterDir(a){return this.fsw._isntIgnored(this.entryPath(a),a.stats)}}class aA extends B.EventEmitter{constructor(a={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let b=a.awaitWriteFinish,c={stabilityThreshold:2e3,pollInterval:100},d={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...a,ignored:a.ignored?aq(a.ignored):aq([]),awaitWriteFinish:!0===b?c:"object"==typeof b&&{...c,...b}};X&&(d.usePolling=!0),void 0===d.atomic&&(d.atomic=!d.usePolling);let e=process.env.CHOKIDAR_USEPOLLING;if(void 0!==e){let a=e.toLowerCase();"false"===a||"0"===a?d.usePolling=!1:"true"===a||"1"===a?d.usePolling=!0:d.usePolling=!!a}let f=process.env.CHOKIDAR_INTERVAL;f&&(d.interval=Number.parseInt(f,10));let g=0;this._emitReady=()=>{++g>=this._readyCount&&(this._emitReady=R,this._readyEmitted=!0,process.nextTick(()=>this.emit(Y.READY)))},this._emitRaw=(...a)=>this.emit(Y.RAW,...a),this._boundRemove=this._remove.bind(this),this.options=d,this._nodeFsHandler=new al(this),Object.freeze(d)}_addIgnoredPath(a){if(ar(a)){for(let b of this._ignoredPaths)if(ar(b)&&b.path===a.path&&b.recursive===a.recursive)return}this._ignoredPaths.add(a)}_removeIgnoredPath(a){if(this._ignoredPaths.delete(a),"string"==typeof a)for(let b of this._ignoredPaths)ar(b)&&b.path===a&&this._ignoredPaths.delete(b)}add(a,b,c){let{cwd:d}=this.options;this.closed=!1,this._closePromise=void 0;let e=at(a);return d&&(e=e.map(a=>x.isAbsolute(a)?a:x.join(d,a))),e.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=e.length,Promise.all(e.map(async a=>{let d=await this._nodeFsHandler._addToNodeFs(a,!c,void 0,0,b);return d&&this._emitReady(),d})).then(a=>{this.closed||a.forEach(a=>{a&&this.add(x.dirname(a),x.basename(b||a))})}),this}unwatch(a){if(this.closed)return this;let b=at(a),{cwd:c}=this.options;return b.forEach(a=>{x.isAbsolute(a)||this._closers.has(a)||(c&&(a=x.join(c,a)),a=x.resolve(a)),this._closePath(a),this._addIgnoredPath(a),this._watched.has(a)&&this._addIgnoredPath({path:a,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let a=[];return this._closers.forEach(b=>b.forEach(b=>{let c=b();c instanceof Promise&&a.push(c)})),this._streams.forEach(a=>a.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(a=>a.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=a.length?Promise.all(a).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let a={};return this._watched.forEach((b,c)=>{a[(this.options.cwd?x.relative(this.options.cwd,c):c)||"."]=b.getChildren().sort()}),a}emitWithAll(a,b){this.emit(a,...b),a!==Y.ERROR&&this.emit(Y.ALL,a,...b)}async _emit(a,b,c){let d;if(this.closed)return;let e=this.options;T&&(b=x.normalize(b)),e.cwd&&(b=x.relative(e.cwd,b));let f=[b];null!=c&&f.push(c);let g=e.awaitWriteFinish;if(g&&(d=this._pendingWrites.get(b)))return d.lastChange=new Date,this;if(e.atomic){if(a===Y.UNLINK)return this._pendingUnlinks.set(b,[a,...f]),setTimeout(()=>{this._pendingUnlinks.forEach((a,b)=>{this.emit(...a),this.emit(Y.ALL,...a),this._pendingUnlinks.delete(b)})},"number"==typeof e.atomic?e.atomic:100),this;a===Y.ADD&&this._pendingUnlinks.has(b)&&(a=Y.CHANGE,this._pendingUnlinks.delete(b))}if(g&&(a===Y.ADD||a===Y.CHANGE)&&this._readyEmitted){let c=(b,c)=>{b?(a=Y.ERROR,f[0]=b,this.emitWithAll(a,f)):c&&(f.length>1?f[1]=c:f.push(c),this.emitWithAll(a,f))};return this._awaitWriteFinish(b,g.stabilityThreshold,a,c),this}if(a===Y.CHANGE&&!this._throttle(Y.CHANGE,b,50))return this;if(e.alwaysStat&&void 0===c&&(a===Y.ADD||a===Y.ADD_DIR||a===Y.CHANGE)){let a,c=e.cwd?x.join(e.cwd,b):b;try{a=await (0,A.stat)(c)}catch(a){}if(!a||this.closed)return;f.push(a)}return this.emitWithAll(a,f),this}_handleError(a){let b=a&&a.code;return a&&"ENOENT"!==b&&"ENOTDIR"!==b&&(!this.options.ignorePermissionErrors||"EPERM"!==b&&"EACCES"!==b)&&this.emit(Y.ERROR,a),a||this.closed}_throttle(a,b,c){let d;this._throttled.has(a)||this._throttled.set(a,new Map);let e=this._throttled.get(a);if(!e)throw Error("invalid throttle");let f=e.get(b);if(f)return f.count++,!1;let g=()=>{let a=e.get(b),c=a?a.count:0;return e.delete(b),clearTimeout(d),a&&clearTimeout(a.timeoutObject),c},h={timeoutObject:d=setTimeout(g,c),clear:g,count:0};return e.set(b,h),h}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(a,b,c,d){let e,f=this.options.awaitWriteFinish;if("object"!=typeof f)return;let g=f.pollInterval,h=a;this.options.cwd&&!x.isAbsolute(a)&&(h=x.join(this.options.cwd,a));let i=new Date,j=this._pendingWrites;j.has(a)||(j.set(a,{lastChange:i,cancelWait:()=>(j.delete(a),clearTimeout(e),c)}),e=setTimeout(function c(f){(0,z.stat)(h,(h,i)=>{if(h||!j.has(a)){h&&"ENOENT"!==h.code&&d(h);return}let k=Number(new Date);f&&i.size!==f.size&&(j.get(a).lastChange=k),k-j.get(a).lastChange>=b?(j.delete(a),d(void 0,i)):e=setTimeout(c,g,i)})},g))}_isIgnored(a,b){if(this.options.atomic&&ao.test(a))return!0;if(!this._userIgnored){let{cwd:a}=this.options,b=(this.options.ignored||[]).map(aw(a)),c=[...[...this._ignoredPaths].map(aw(a)),...b];this._userIgnored=function(a,b){if(null==a)throw TypeError("anymatch: specify first argument");let c=aq(a).map(a=>"function"==typeof a?a:"string"==typeof a?b=>a===b:a instanceof RegExp?b=>a.test(b):"object"==typeof a&&null!==a?b=>{if(a.path===b)return!0;if(a.recursive){let c=x.relative(a.path,b);return!!c&&!c.startsWith("..")&&!x.isAbsolute(c)}return!1}:()=>!1);return null==b?(a,b)=>as(c,a,b):as(c,b)}(c,void 0)}return this._userIgnored(a,b)}_isntIgnored(a,b){return!this._isIgnored(a,b)}_getWatchHelpers(a){return new az(a,this.options.followSymlinks,this)}_getWatchedDir(a){let b=x.resolve(a);return this._watched.has(b)||this._watched.set(b,new ay(b,this._boundRemove)),this._watched.get(b)}_hasReadPermissions(a){return!!this.options.ignorePermissionErrors||!!(256&Number(a.mode))}_remove(a,b,c){let d=x.join(a,b),e=x.resolve(d);if(c=null!=c?c:this._watched.has(d)||this._watched.has(e),!this._throttle("remove",d,100))return;c||1!==this._watched.size||this.add(a,b,!0),this._getWatchedDir(d).getChildren().forEach(a=>this._remove(d,a));let f=this._getWatchedDir(a),g=f.has(b);f.remove(b),this._symlinkPaths.has(e)&&this._symlinkPaths.delete(e);let h=d;if(this.options.cwd&&(h=x.relative(this.options.cwd,d)),this.options.awaitWriteFinish&&this._pendingWrites.has(h)&&this._pendingWrites.get(h).cancelWait()===Y.ADD)return;this._watched.delete(d),this._watched.delete(e);let i=c?Y.UNLINK_DIR:Y.UNLINK;g&&!this._isIgnored(d)&&this._emit(i,d),this._closePath(d)}_closePath(a){this._closeFile(a);let b=x.dirname(a);this._getWatchedDir(b).remove(x.basename(a))}_closeFile(a){let b=this._closers.get(a);b&&(b.forEach(a=>a()),this._closers.delete(a))}_addPathCloser(a,b){if(!b)return;let c=this._closers.get(a);c||(c=[],this._closers.set(a,c)),c.push(b)}_readdirp(a,b){if(this.closed)return;let c=function(a,b={}){let c=b.entryType||b.type;if("both"===c&&(c=F.FILE_DIR_TYPE),c&&(b.type=c),a){if("string"!=typeof a)throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(c&&!J.includes(c))throw Error(`readdirp: Invalid type passed. Use one of ${J.join(", ")}`)}else throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");return b.root=a,new P(b)}(a,{type:Y.ALL,alwaysStat:!0,lstat:!0,...b,depth:0});return this._streams.add(c),c.once("close",()=>{c=void 0}),c.once("end",()=>{c&&(this._streams.delete(c),c=void 0)}),c}}let aB=(0,g.h)("backend/services/scheduler/triggers/fileWatch");function aC(a){let b=Math.max(5,Math.round((a??6e4)/1e3));if(b<60)return`*/${b} * * * * *`;let c=Math.max(1,Math.round(b/60));if(c<60)return`*/${c} * * * *`;let d=Math.max(1,Math.min(23,Math.round(c/60)));return`0 */${d} * * *`}var aD=c(26358);let aE=(0,g.h)("backend/services/scheduler/triggers/mcpPoll"),aF=(0,g.h)("backend/services/scheduler/triggers/urlWatch"),aG=(0,g.h)("backend/services/scheduler/runHistory"),aH=a=>`planned-execution-runs/${a}`,aI=new Map;async function aJ(a){try{return await (0,e.YM)(aH(a),[])}catch(b){return aG.error(`Failed to load run history for ${a}:`,b),[]}}async function aK(a,b){let c=(aI.get(a)??Promise.resolve()).catch(()=>{}).then(async()=>{let c=await aJ(a);c.push(b);let d=c.slice(-100);await (0,e.VH)(aH(a),d)});aI.set(a,c);try{await c}finally{aI.get(a)===c&&aI.delete(a)}}async function aL(a){let b=await aJ(a);return b.length>0?b[b.length-1]:null}async function aM(a){await (0,e.N2)(aH(a))}let aN=(0,g.h)("backend/services/scheduler/state"),aO=a=>`planned-execution-state/${a}`;async function aP(a){try{return await (0,e.YM)(aO(a),{})}catch(b){return aN.error(`Failed to load trigger state for ${a}:`,b),{}}}async function aQ(a,b){await (0,e.VH)(aO(a),b)}async function aR(a){await (0,e.N2)(aO(a))}let aS=(0,g.h)("backend/services/scheduler/index"),aT={version:1,paused:!1,executions:[]};class aU{async start(){this.started||(this.started=!0,aS.info("Starting scheduler"),await this.reconcile())}reconcile(){let a=this.reconcileChain.catch(()=>{}).then(()=>this.doReconcile());return this.reconcileChain=a,a}async doReconcile(){for(let[a,b]of this.armed)try{b.dispose()}catch(b){aS.warn(`Failed to dispose trigger for ${a}:`,b)}this.armed.clear();let a=await this.loadFile();if(this.pausedCache=a.paused,a.paused)return void aS.info("Scheduler is paused — nothing armed");for(let b of a.executions)if(b.enabled)try{await this.armExecution(b)}catch(c){let a=c instanceof Error?c.message:String(c);this.lastTriggerErrors.set(b.id,a),aS.error(`Failed to arm "${b.name}" (${b.id}):`,c)}aS.info(`Scheduler armed ${this.armed.size} execution(s)`)}async armExecution(a){let b=a.trigger;switch(b.type){case"schedule":{let c=await aP(a.id);c.lastScheduledFireAt?b.catchUp&&function(a,b){let c=new v(a.cron,{timezone:a.timezone,paused:!0});try{let a=c.nextRun(new Date(b));return null!==a&&a.getTime()<=Date.now()}finally{c.stop()}}(b,c.lastScheduledFireAt)&&(await aQ(a.id,{...c,lastScheduledFireAt:new Date().toISOString()}),aS.info(`Catch-up run for "${a.name}" (missed while closed)`),this.fire(a,{kind:"schedule-catchup",summary:"Schedule (missed while FLUJO was closed — ran once at startup)"})):await aQ(a.id,{...c,lastScheduledFireAt:new Date().toISOString()}),this.armed.set(a.id,function(a,b){let c=new v(a.cron,{timezone:a.timezone,unref:!0},b);return{dispose:()=>c.stop(),nextRun:()=>c.nextRun()?.toISOString()??null}}(b,()=>{(async()=>{let b=await aP(a.id);await aQ(a.id,{...b,lastScheduledFireAt:new Date().toISOString()}),await this.fire(a,{kind:"schedule",summary:"Schedule"})})().catch(b=>aS.error(`Scheduled fire failed for ${a.id}:`,b))}));break}case"webhook":break;case"file-watch":this.armed.set(a.id,function(a,b,c){let d,e=a.debounceMs??2e3,f=new Set(a.events),g=a.glob?.trim()?function(a){let b=a.replace(/\\/g,"/"),c="";for(let a=0;a<b.length;a++){let d=b[a];"*"===d?"*"===b[a+1]?"/"===b[++a+1]?(a++,c+="(?:.*/)?"):c+=".*":c+="[^/]*":"?"===d?c+="[^/]":c+=d.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return RegExp(`^${c}$`)}(a.glob.trim()):null;try{d=z.realpathSync.native(a.path)}catch(d){let b=d instanceof Error?d.message:String(d);return aB.warn(`Cannot watch "${a.path}": ${b}`),c(`Cannot watch "${a.path}": ${b}`),{dispose:()=>void 0}}let h=[],i=!1,j=null,k=!1,l=()=>{if(j=null,k||0===h.length)return;let a=h;i&&aB.info("File-watch batch overflowed; reporting first 50 events"),h=[],i=!1,b({events:a})},m=function(a,b={}){let c=new aA(b);return c.add(a),c}(d,{ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500,pollInterval:100}});return m.on("all",(a,b)=>{if(!k&&("add"===a||"change"===a||"unlink"===a)&&f.has(a)){if(g){let a=y().relative(d,b).replace(/\\/g,"/")||y().basename(b);if(!g.test(a))return}h.length>=50?i=!0:h.push({event:a,path:b}),j&&clearTimeout(j),j=setTimeout(l,e),j.unref?.()}}),m.on("error",a=>{let b=a instanceof Error?a.message:String(a);aB.warn(`Watcher error for ${d}: ${b}`),c(b)}),{dispose:()=>{k=!0,j&&(clearTimeout(j),j=null),h=[],m.close().catch(a=>aB.warn(`Failed to close watcher for ${d}:`,a))}}}(b,({events:c})=>{this.lastTriggerErrors.delete(a.id),this.fire(a,{kind:"file",summary:1===c.length?`File ${"unlink"===c[0].event?"deleted":"add"===c[0].event?"added":"changed"}`:`${c.length} file changes`,context:{watchedPath:b.path,events:c}})},b=>this.lastTriggerErrors.set(a.id,b)));break;case"mcp-poll":Promise.resolve().then(c.bind(c,99924)).then(async({mcpService:c})=>{await c.isServerDisabled(b.serverName)&&this.lastTriggerErrors.set(a.id,`MCP server '${b.serverName}' is disabled — enable it on the MCP page or change the trigger`)}).catch(b=>aS.warn(`Arm-time disabled-server check failed for ${a.id}:`,b)),this.armed.set(a.id,function(a,b){let c=a.cron||aC(a.intervalMs),d=!1,e=!1,f=0,g=0,h=async()=>{if(!e&&!d){if(g>0)return void g--;d=!0;try{let c,d=await b.callTool(a.serverName,a.toolName,a.args);if(!d.success)throw Error(d.error||"Tool call failed");f=0;let g=await b.loadState(),h=a.evaluate;if(c="on-change"===h.mode?(0,aD.Jl)(d.data,g):"new-items"===h.mode?(0,aD.A1)(d.data,h.itemsPath,h.idField,g):b.evaluateAiGate?await b.evaluateAiGate(d.data,h,g):{fire:!1,newState:{},error:'The "AI decides" condition is not available yet'},e)return;if(Object.keys(c.newState).length>0&&await b.saveState(c.newState),c.error)b.onError(c.error);else if(c.fire){let{status:d}=await b.onFire({summary:`Watched tool: ${c.summary??"condition met"}`,context:{server:a.serverName,tool:a.toolName,..."object"==typeof c.context&&null!==c.context?c.context:{result:c.context}}});if(e)return;if(c.pendingState){let{giveUpError:a}=await (0,aD.vV)({status:d,pendingState:c.pendingState,priorFailures:g.pendingFailures??0,saveState:b.saveState});a&&b.onError(a)}}else b.onSuccess?.()}catch(d){f++,g=Math.min(2**(f-1),8);let c=d instanceof Error?d.message:String(d);aE.warn(`Poll failed for ${a.serverName}/${a.toolName} (backing off ${g} check(s)): ${c}`),b.onError(c)}finally{d=!1}}},i=new v(c,{timezone:a.timezone,unref:!0},()=>void h());return h(),{dispose:()=>{e=!0,i.stop()},nextRun:()=>i.nextRun()?.toISOString()??null}}(b,{callTool:async(a,b,d)=>{let{mcpService:e}=await Promise.resolve().then(c.bind(c,99924)),f=await e.callTool(a,b,d);return{success:!0===f.success,data:f.data,error:"string"==typeof f.error?f.error:void 0}},loadState:()=>aP(a.id),saveState:async b=>{let c=await aP(a.id);await aQ(a.id,{...c,...b})},onFire:async({summary:b,context:c})=>(this.lastTriggerErrors.delete(a.id),{status:(await this.fire(a,{kind:"mcp-poll",summary:b,context:c})).status}),onError:b=>this.lastTriggerErrors.set(a.id,b),onSuccess:()=>this.lastTriggerErrors.delete(a.id),evaluateAiGate:async(a,b,d)=>{let{evaluateAiGate:e}=await c.e(701).then(c.bind(c,90701));return e(a,b,d)}}));break;case"url-watch":this.armed.set(a.id,function(a,b){let c=b.fetchImpl??fetch,d=!1,e=!1,f=async()=>{if(!e&&!d){d=!0;try{let d=await c(a.url,{redirect:"follow",headers:{"User-Agent":"FLUJO-url-watch"},signal:AbortSignal.timeout(3e4)});if(!d.ok)return void b.onError(`The URL answered with HTTP ${d.status}`);let f=await d.text(),g=(0,aD.qq)(f),h=await b.loadState();if(e)return;if(!h.lastHash){await b.saveState({lastHash:g}),b.onSuccess?.();return}if(h.lastHash===g)return void b.onSuccess?.();let{status:i}=await b.onFire({summary:"Online content changed",context:{url:a.url,status:d.status,contentType:d.headers.get("content-type")??void 0,content:f.length>8192?`${f.slice(0,8192)}… (truncated, ${f.length} chars total)`:f}});if(e)return;let{giveUpError:j}=await (0,aD.vV)({status:i,pendingState:{lastHash:g},priorFailures:h.pendingFailures??0,saveState:b.saveState});j&&b.onError(j)}catch(d){let c=d instanceof Error&&"TimeoutError"===d.name?"The URL did not answer within 30s":d instanceof Error?d.message:String(d);aF.warn(`URL check failed for ${a.url}: ${c}`),b.onError(c)}finally{d=!1}}},g=new v(a.cron,{timezone:a.timezone,unref:!0},()=>void f());return f(),{dispose:()=>{e=!0,g.stop()},nextRun:()=>g.nextRun()?.toISOString()??null}}(b,{loadState:()=>aP(a.id),saveState:async b=>{let c=await aP(a.id);await aQ(a.id,{...c,...b})},onFire:async({summary:b,context:c})=>(this.lastTriggerErrors.delete(a.id),{status:(await this.fire(a,{kind:"url-watch",summary:b,context:c})).status}),onError:b=>this.lastTriggerErrors.set(a.id,b),onSuccess:()=>this.lastTriggerErrors.delete(a.id)}));break;default:aS.warn(`Trigger type "${b.type}" is not implemented — "${a.name}" not armed`)}}async loadFile(){let a=await (0,e.YM)(f.Z.PLANNED_EXECUTIONS,aT);return{version:1,paused:!0===a.paused,executions:Array.isArray(a.executions)?a.executions:[]}}async saveFile(a){await (0,e.VH)(f.Z.PLANNED_EXECUTIONS,a)}async isPaused(){return(await this.loadFile()).paused}async setPaused(a){let b=await this.loadFile();await this.saveFile({...b,paused:a}),await this.reconcile()}async list(){return Promise.all((await this.loadFile()).executions.map(async a=>({execution:a,status:this.getStatus(a),lastRun:await aL(a.id)})))}async get(a){return(await this.loadFile()).executions.find(b=>b.id===a)??null}async create(a){let b=this.validateInput(a);if(b)return{error:b};if(void 0!==a.id&&!/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(a.id))return{error:"The id must be a UUID"};let c=new Date().toISOString(),e={...a,trigger:this.normalizeTrigger(a.trigger),id:a.id??(0,d.A)(),createdAt:c,updatedAt:c},f=await this.loadFile();return f.executions.some(a=>a.id===e.id)?{error:`A planned execution with id "${e.id}" already exists`}:(await this.saveFile({...f,executions:[...f.executions,e]}),await this.reconcile(),{execution:e})}async update(a,b){let c=await this.loadFile(),d=c.executions.findIndex(b=>b.id===a);if(d<0)return{error:`No planned execution with id "${a}"`};let e={...c.executions[d],...b,...b.trigger?{trigger:this.normalizeTrigger(b.trigger)}:{},id:a,createdAt:c.executions[d].createdAt,updatedAt:new Date().toISOString()},f=this.validateInput(e);if(f)return{error:f};let g=[...c.executions];return g[d]=e,await this.saveFile({...c,executions:g}),await this.reconcile(),{execution:e}}async delete(a){let b=await this.loadFile();return b.executions.some(b=>b.id===a)?(await this.saveFile({...b,executions:b.executions.filter(b=>b.id!==a)}),await this.reconcile(),this.lastTriggerErrors.delete(a),await aM(a),await aR(a),{success:!0}):{success:!1,error:`No planned execution with id "${a}"`}}normalizeTrigger(a){return a?.type!=="webhook"||a.token?a?.type!=="mcp-poll"||a.cron?a:{...a,cron:aC(a.intervalMs)}:{...a,token:(0,d.A)()}}validateInput(a){if(!a.name?.trim())return"A name is required";if(!a.flowId)return"A flow is required";if("string"!=typeof a.prompt)return"A prompt is required (may be empty)";let b=a.trigger;if(!b||"object"!=typeof b)return"A trigger is required";switch(b.type){case"schedule":{let a=w(b.cron,b.timezone);return a.valid?null:`Invalid schedule: ${a.error}`}case"webhook":return null;case"file-watch":if(!b.path?.trim())return"A folder or file path to watch is required";if(!Array.isArray(b.events)||0===b.events.length)return"At least one file event is required";return null;case"mcp-poll":if(!b.serverName||!b.toolName)return"A server and tool are required";if(b.cron){let a=w(b.cron,b.timezone);if(!a.valid)return`Invalid schedule: ${a.error}`}if(b.evaluate?.mode==="new-items"&&!b.evaluate.idField?.trim())return"An id field is required to detect new items";if((b.evaluate?.mode==="llm-gate"||b.evaluate?.mode==="flow-gate")&&!b.evaluate.condition?.trim())return"A condition is required for the AI to check";if(b.evaluate?.mode==="llm-gate"&&!b.evaluate.modelId)return"A model is required to check the condition";if(b.evaluate?.mode==="flow-gate"&&!b.evaluate.flowId)return"A flow is required to check the condition";return null;case"url-watch":{try{let a=new URL(b.url??"");if("http:"!==a.protocol&&"https:"!==a.protocol)return"The URL must start with http:// or https://"}catch{return"A valid URL is required"}let a=w(b.cron,b.timezone);return a.valid?null:`Invalid schedule: ${a.error}`}default:return"Unknown trigger type"}}getStatus(a){let b=this.armed.get(a.id),c=void 0!==b||a.enabled&&"webhook"===a.trigger.type&&this.started&&!this.pausedCache,d=this.running.get(a.id);return{armed:c,nextRun:b?.nextRun?b.nextRun():void 0,lastTriggerError:this.lastTriggerErrors.get(a.id),running:void 0!==d,runningSince:d}}async runNow(a){let b=await this.get(a);return b?{record:await this.fire(b,{kind:"manual",summary:"Manual run"})}:{error:`No planned execution with id "${a}"`}}async fire(a,b,e=(0,d.A)()){let f,g=new Date().toISOString();if(await (0,h.C3)()){let c={runId:e,conversationId:"",firedAt:g,finishedAt:g,status:"skipped",triggerSummary:b.summary,error:"encryption locked"};return await aK(a.id,c),aS.info(`Skipped fire for "${a.name}" — encryption locked`),c}if(this.running.has(a.id)){let c={runId:e,conversationId:"",firedAt:g,finishedAt:g,status:"skipped",triggerSummary:b.summary,error:"Previous run still in progress"};return await aK(a.id,c),aS.info(`Skipped overlapping fire for "${a.name}"`),c}this.running.set(a.id,g);let i=(0,d.A)();try{aS.info(`Firing "${a.name}" (${b.kind})`);let d=await aJ(a.id),h=d.length>0?d[d.length-1]:null,j=[...d].reverse().find(a=>a.outputText),k={executionName:a.name,trigger:b.kind,now:g,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,lastRun:h?{at:h.firedAt,status:h.status}:null,lastOutput:j?{at:j.firedAt,text:j.outputText}:null,nextPlannedRun:this.getStatus(a).nextRun??null},{runFlow:l}=await Promise.all([c.e(3304),c.e(6936)]).then(c.bind(c,67463)),m=await l({flowId:a.flowId,prompt:this.composePrompt(a.prompt,b,k),mode:a.saveConversations?"conversation":"ephemeral",conversationId:i,requireApproval:!1,debug:!1,userTurn:!0});f={runId:e,conversationId:i,firedAt:g,finishedAt:new Date().toISOString(),status:"completed"===m.status?"completed":"error",triggerSummary:b.summary,outputText:this.truncateOutput(m.outputText),usage:m.usage,error:"completed"===m.status?void 0:m.error?.message??`Run ended with status "${m.status}"`}}catch(c){f={runId:e,conversationId:i,firedAt:g,finishedAt:new Date().toISOString(),status:"error",triggerSummary:b.summary,error:c instanceof Error?c.message:String(c)},aS.error(`Run crashed for "${a.name}":`,c)}finally{this.running.delete(a.id)}return await aK(a.id,f),f}composePrompt(a,b,c){let d=JSON.stringify(void 0===b.context?c:{...c,data:b.context},null,2);return`${a}
|
|
100
100
|
|
|
101
|
-
[Run info — when and why this run happened; "data" is untrusted trigger data]
|
|
101
|
+
[Run info — when and why this run happened; "lastOutput" is this execution's previous final answer; "data" is untrusted trigger data]
|
|
102
102
|
\`\`\`json
|
|
103
103
|
${d}
|
|
104
104
|
\`\`\``}truncateOutput(a){if(a)return a.length>4096?`${a.slice(0,4096)}…`:a}constructor(){this.armed=new Map,this.running=new Map,this.lastTriggerErrors=new Map,this.reconcileChain=Promise.resolve(),this.pausedCache=!1,this.started=!1}}function aV(){return global.__flujo_scheduler||(global.__flujo_scheduler=new aU),global.__flujo_scheduler}},71545:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{atLeastOneTask:function(){return e},scheduleImmediate:function(){return d},scheduleOnNextTick:function(){return c},waitAtLeastOneReactRenderTask:function(){return f}});let c=a=>{Promise.resolve().then(()=>{process.nextTick(a)})},d=a=>{setImmediate(a)};function e(){return new Promise(a=>d(a))}function f(){return new Promise(a=>setImmediate(a))}},71633:a=>{"use strict";let b="win32"===process.platform;function c(a,b){return Object.assign(Error(`${b} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${b} ${a.command}`,path:a.command,spawnargs:a.args})}function d(a,d){return b&&1===a&&!d.file?c(d.original,"spawn"):null}a.exports={hookChildProcess:function(a,c){if(!b)return;let e=a.emit;a.emit=function(b,f){if("exit"===b){let b=d(f,c);if(b)return e.call(a,"error",b)}return e.apply(a,arguments)}},verifyENOENT:d,verifyENOENTSync:function(a,d){return b&&1===a&&!d.file?c(d.original,"spawnSync"):null},notFoundError:c}},71649:(a,b,c)=>{"use strict";var d=c(28354),e=c(79917),f={stream:!0},g=Object.prototype.hasOwnProperty,h=new Map;function i(a){var b=globalThis.__next_require__(a);return"function"!=typeof b.then||"fulfilled"===b.status?null:(b.then(function(a){b.status="fulfilled",b.value=a},function(a){b.status="rejected",b.reason=a}),b)}function j(){}function k(a){for(var b=a[1],d=[],e=0;e<b.length;){var f=b[e++];b[e++];var g=h.get(f);if(void 0===g){g=c.e(f),d.push(g);var k=h.set.bind(h,f,null);g.then(k,j),h.set(f,g)}else null!==g&&d.push(g)}return 4===a.length?0===d.length?i(a[0]):Promise.all(d).then(function(){return i(a[0])}):0<d.length?Promise.all(d):null}function l(a){var b=globalThis.__next_require__(a[0]);if(4===a.length&&"function"==typeof b.then)if("fulfilled"===b.status)b=b.value;else throw b.reason;return"*"===a[2]?b:""===a[2]?b.__esModule?b.default:b:g.call(b,a[2])?b[a[2]]:void 0}var m=e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,n=Symbol.for("react.transitional.element"),o=Symbol.for("react.lazy"),p=Symbol.iterator,q=Symbol.asyncIterator,r=Array.isArray,s=Object.getPrototypeOf,t=Object.prototype,u=new WeakMap;function v(a,b,c,d,e){function f(a,c){c=new Blob([new Uint8Array(c.buffer,c.byteOffset,c.byteLength)]);var d=i++;return null===k&&(k=new FormData),k.append(b+d,c),"$"+a+d.toString(16)}function g(a,v){if(null===v)return null;if("object"==typeof v){switch(v.$$typeof){case n:if(void 0!==c&&-1===a.indexOf(":")){var w,x,y,z,A,B=l.get(this);if(void 0!==B)return c.set(B+":"+a,v),"$T"}throw Error("React Element cannot be passed to Server Functions from the Client without a temporary reference set. Pass a TemporaryReferenceSet to the options.");case o:B=v._payload;var C=v._init;null===k&&(k=new FormData),j++;try{var D=C(B),E=i++,F=h(D,E);return k.append(b+E,F),"$"+E.toString(16)}catch(a){if("object"==typeof a&&null!==a&&"function"==typeof a.then){j++;var G=i++;return B=function(){try{var a=h(v,G),c=k;c.append(b+G,a),j--,0===j&&d(c)}catch(a){e(a)}},a.then(B,B),"$"+G.toString(16)}return e(a),null}finally{j--}}if(B=l.get(v),"function"==typeof v.then){if(void 0!==B)if(m!==v)return B;else m=null;null===k&&(k=new FormData),j++;var H=i++;return a="$@"+H.toString(16),l.set(v,a),v.then(function(a){try{var c=l.get(a),f=void 0!==c?JSON.stringify(c):h(a,H);(a=k).append(b+H,f),j--,0===j&&d(a)}catch(a){e(a)}},e),a}if(void 0!==B)if(m!==v)return B;else m=null;else -1===a.indexOf(":")&&void 0!==(B=l.get(this))&&(a=B+":"+a,l.set(v,a),void 0!==c&&c.set(a,v));if(r(v))return v;if(v instanceof FormData){null===k&&(k=new FormData);var I=k,J=b+"_"+(a=i++)+"_";return v.forEach(function(a,b){I.append(J+b,a)}),"$K"+a.toString(16)}if(v instanceof Map)return a=i++,B=h(Array.from(v),a),null===k&&(k=new FormData),k.append(b+a,B),"$Q"+a.toString(16);if(v instanceof Set)return a=i++,B=h(Array.from(v),a),null===k&&(k=new FormData),k.append(b+a,B),"$W"+a.toString(16);if(v instanceof ArrayBuffer)return a=new Blob([v]),B=i++,null===k&&(k=new FormData),k.append(b+B,a),"$A"+B.toString(16);if(v instanceof Int8Array)return f("O",v);if(v instanceof Uint8Array)return f("o",v);if(v instanceof Uint8ClampedArray)return f("U",v);if(v instanceof Int16Array)return f("S",v);if(v instanceof Uint16Array)return f("s",v);if(v instanceof Int32Array)return f("L",v);if(v instanceof Uint32Array)return f("l",v);if(v instanceof Float32Array)return f("G",v);if(v instanceof Float64Array)return f("g",v);if(v instanceof BigInt64Array)return f("M",v);if(v instanceof BigUint64Array)return f("m",v);if(v instanceof DataView)return f("V",v);if("function"==typeof Blob&&v instanceof Blob)return null===k&&(k=new FormData),a=i++,k.append(b+a,v),"$B"+a.toString(16);if(a=null===(w=v)||"object"!=typeof w?null:"function"==typeof(w=p&&w[p]||w["@@iterator"])?w:null)return(B=a.call(v))===v?(a=i++,B=h(Array.from(B),a),null===k&&(k=new FormData),k.append(b+a,B),"$i"+a.toString(16)):Array.from(B);if("function"==typeof ReadableStream&&v instanceof ReadableStream)return function(a){try{var c,f,h,l,m,n,o,p=a.getReader({mode:"byob"})}catch(l){return c=a.getReader(),null===k&&(k=new FormData),f=k,j++,h=i++,c.read().then(function a(i){if(i.done)f.append(b+h,"C"),0==--j&&d(f);else try{var k=JSON.stringify(i.value,g);f.append(b+h,k),c.read().then(a,e)}catch(a){e(a)}},e),"$R"+h.toString(16)}return l=p,null===k&&(k=new FormData),m=k,j++,n=i++,o=[],l.read(new Uint8Array(1024)).then(function a(c){c.done?(c=i++,m.append(b+c,new Blob(o)),m.append(b+n,'"$o'+c.toString(16)+'"'),m.append(b+n,"C"),0==--j&&d(m)):(o.push(c.value),l.read(new Uint8Array(1024)).then(a,e))},e),"$r"+n.toString(16)}(v);if("function"==typeof(a=v[q]))return x=v,y=a.call(v),null===k&&(k=new FormData),z=k,j++,A=i++,x=x===y,y.next().then(function a(c){if(c.done){if(void 0===c.value)z.append(b+A,"C");else try{var f=JSON.stringify(c.value,g);z.append(b+A,"C"+f)}catch(a){e(a);return}0==--j&&d(z)}else try{var h=JSON.stringify(c.value,g);z.append(b+A,h),y.next().then(a,e)}catch(a){e(a)}},e),"$"+(x?"x":"X")+A.toString(16);if((a=s(v))!==t&&(null===a||null!==s(a))){if(void 0===c)throw Error("Only plain objects, and a few built-ins, can be passed to Server Functions. Classes or null prototypes are not supported.");return"$T"}return v}if("string"==typeof v)return"Z"===v[v.length-1]&&this[a]instanceof Date?"$D"+v:a="$"===v[0]?"$"+v:v;if("boolean"==typeof v)return v;if("number"==typeof v)return Number.isFinite(v)?0===v&&-1/0==1/v?"$-0":v:1/0===v?"$Infinity":-1/0===v?"$-Infinity":"$NaN";if(void 0===v)return"$undefined";if("function"==typeof v){if(void 0!==(B=u.get(v)))return void 0!==(a=l.get(v))||(a=JSON.stringify({id:B.id,bound:B.bound},g),null===k&&(k=new FormData),B=i++,k.set(b+B,a),a="$h"+B.toString(16),l.set(v,a)),a;if(void 0!==c&&-1===a.indexOf(":")&&void 0!==(B=l.get(this)))return c.set(B+":"+a,v),"$T";throw Error("Client Functions cannot be passed directly to Server Functions. Only Functions passed from the Server can be passed back again.")}if("symbol"==typeof v){if(void 0!==c&&-1===a.indexOf(":")&&void 0!==(B=l.get(this)))return c.set(B+":"+a,v),"$T";throw Error("Symbols cannot be passed to a Server Function without a temporary reference set. Pass a TemporaryReferenceSet to the options.")}if("bigint"==typeof v)return"$n"+v.toString(10);throw Error("Type "+typeof v+" is not supported as an argument to a Server Function.")}function h(a,b){return"object"==typeof a&&null!==a&&(b="$"+b.toString(16),l.set(a,b),void 0!==c&&c.set(b,a)),m=a,JSON.stringify(a,g)}var i=1,j=0,k=null,l=new WeakMap,m=a,v=h(a,0);return null===k?d(v):(k.set(b+"0",v),0===j&&d(k)),function(){0<j&&(j=0,null===k?d(v):d(k))}}var w=new WeakMap;function x(a){var b=u.get(this);if(!b)throw Error("Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React.");var c=null;if(null!==b.bound){if((c=w.get(b))||(d={id:b.id,bound:b.bound},g=new Promise(function(a,b){e=a,f=b}),v(d,"",void 0,function(a){if("string"==typeof a){var b=new FormData;b.append("0",a),a=b}g.status="fulfilled",g.value=a,e(a)},function(a){g.status="rejected",g.reason=a,f(a)}),c=g,w.set(b,c)),"rejected"===c.status)throw c.reason;if("fulfilled"!==c.status)throw c;b=c.value;var d,e,f,g,h=new FormData;b.forEach(function(b,c){h.append("$ACTION_"+a+":"+c,b)}),c=h,b="$ACTION_REF_"+a}else b="$ACTION_ID_"+b.id;return{name:b,method:"POST",encType:"multipart/form-data",data:c}}function y(a,b){var c=u.get(this);if(!c)throw Error("Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React.");if(c.id!==a)return!1;var d=c.bound;if(null===d)return 0===b;switch(d.status){case"fulfilled":return d.value.length===b;case"pending":throw d;case"rejected":throw d.reason;default:throw"string"!=typeof d.status&&(d.status="pending",d.then(function(a){d.status="fulfilled",d.value=a},function(a){d.status="rejected",d.reason=a})),d}}function z(a,b,c,d){u.has(a)||(u.set(a,{id:b,originalBind:a.bind,bound:c}),Object.defineProperties(a,{$$FORM_ACTION:{value:void 0===d?x:function(){var a=u.get(this);if(!a)throw Error("Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React.");var b=a.bound;return null===b&&(b=Promise.resolve([])),d(a.id,b)}},$$IS_SIGNATURE_EQUAL:{value:y},bind:{value:C}}))}var A=Function.prototype.bind,B=Array.prototype.slice;function C(){var a=u.get(this);if(!a)return A.apply(this,arguments);var b=a.originalBind.apply(this,arguments),c=B.call(arguments,1),d=null;return d=null!==a.bound?Promise.resolve(a.bound).then(function(a){return a.concat(c)}):Promise.resolve(c),u.set(b,{id:a.id,originalBind:b.bind,bound:d}),Object.defineProperties(b,{$$FORM_ACTION:{value:this.$$FORM_ACTION},$$IS_SIGNATURE_EQUAL:{value:y},bind:{value:C}}),b}function D(a,b,c){this.status=a,this.value=b,this.reason=c}function E(a){switch(a.status){case"resolved_model":P(a);break;case"resolved_module":Q(a)}switch(a.status){case"fulfilled":return a.value;case"pending":case"blocked":case"halted":throw a;default:throw a.reason}}function F(a,b){for(var c=0;c<a.length;c++){var d=a[c];"function"==typeof d?d(b):U(d,b)}}function G(a,b){for(var c=0;c<a.length;c++){var d=a[c];"function"==typeof d?d(b):V(d,b)}}function H(a,b){var c=b.handler.chunk;if(null===c)return null;if(c===a)return b.handler;if(null!==(b=c.value))for(c=0;c<b.length;c++){var d=b[c];if("function"!=typeof d&&null!==(d=H(a,d)))return d}return null}function I(a,b,c){switch(a.status){case"fulfilled":F(b,a.value);break;case"blocked":for(var d=0;d<b.length;d++){var e=b[d];if("function"!=typeof e){var f=H(a,e);if(null!==f)switch(U(e,f.value),b.splice(d,1),d--,null!==c&&-1!==(e=c.indexOf(e))&&c.splice(e,1),a.status){case"fulfilled":F(b,a.value);return;case"rejected":null!==c&&G(c,a.reason);return}}}case"pending":if(a.value)for(d=0;d<b.length;d++)a.value.push(b[d]);else a.value=b;if(a.reason){if(c)for(b=0;b<c.length;b++)a.reason.push(c[b])}else a.reason=c;break;case"rejected":c&&G(c,a.reason)}}function J(a,b,c){"pending"!==b.status&&"blocked"!==b.status?b.reason.error(c):(a=b.reason,b.status="rejected",b.reason=c,null!==a&&G(a,c))}function K(a,b,c){return new D("resolved_model",(c?'{"done":true,"value":':'{"done":false,"value":')+b+"}",a)}function L(a,b,c,d){M(a,b,(d?'{"done":true,"value":':'{"done":false,"value":')+c+"}")}function M(a,b,c){if("pending"!==b.status)b.reason.enqueueModel(c);else{var d=b.value,e=b.reason;b.status="resolved_model",b.value=c,b.reason=a,null!==d&&(P(b),I(b,d,e))}}function N(a,b,c){if("pending"===b.status||"blocked"===b.status){a=b.value;var d=b.reason;b.status="resolved_module",b.value=c,b.reason=null,null!==a&&(Q(b),I(b,a,d))}}D.prototype=Object.create(Promise.prototype),D.prototype.then=function(a,b){switch(this.status){case"resolved_model":P(this);break;case"resolved_module":Q(this)}switch(this.status){case"fulfilled":"function"==typeof a&&a(this.value);break;case"pending":case"blocked":"function"==typeof a&&(null===this.value&&(this.value=[]),this.value.push(a)),"function"==typeof b&&(null===this.reason&&(this.reason=[]),this.reason.push(b));break;case"halted":break;default:"function"==typeof b&&b(this.reason)}};var O=null;function P(a){var b=O;O=null;var c=a.value,d=a.reason;a.status="blocked",a.value=null,a.reason=null;try{var e=JSON.parse(c,d._fromJSON),f=a.value;if(null!==f&&(a.value=null,a.reason=null,F(f,e)),null!==O){if(O.errored)throw O.reason;if(0<O.deps){O.value=e,O.reason=null,O.chunk=a;return}}a.status="fulfilled",a.value=e,a.reason=null}catch(b){a.status="rejected",a.reason=b}finally{O=b}}function Q(a){try{var b=l(a.value);a.status="fulfilled",a.value=b,a.reason=null}catch(b){a.status="rejected",a.reason=b}}function R(a,b){a._closed=!0,a._closedReason=b,a._chunks.forEach(function(c){"pending"===c.status?J(a,c,b):"fulfilled"===c.status&&null!==c.reason&&c.reason.error(b)})}function S(a){return{$$typeof:o,_payload:a,_init:E}}function T(a,b){var c=a._chunks,d=c.get(b);return d||(d=a._closed?new D("rejected",null,a._closedReason):new D("pending",null,null),c.set(b,d)),d}function U(a,b){var c=a.response,d=a.handler,e=a.parentObject,f=a.key,h=a.map,i=a.path;try{for(var j=1;j<i.length;j++){for(;b.$$typeof===o;){var k=b._payload;if(k===d.chunk)b=d.value;else{switch(k.status){case"resolved_model":P(k);break;case"resolved_module":Q(k)}switch(k.status){case"fulfilled":b=k.value;continue;case"blocked":var l=H(k,a);if(null!==l){b=l.value;continue}case"pending":i.splice(0,j-1),null===k.value?k.value=[a]:k.value.push(a),null===k.reason?k.reason=[a]:k.reason.push(a);return;case"halted":return;default:V(a,k.reason);return}}}var m=i[j];if("object"==typeof b&&null!==b&&g.call(b,m))b=b[m];else throw Error("Invalid reference.")}var p=h(c,b,e,f);if("__proto__"!==f&&(e[f]=p),""===f&&null===d.value&&(d.value=p),e[0]===n&&"object"==typeof d.value&&null!==d.value&&d.value.$$typeof===n){var q=d.value;"3"===f&&(q.props=p)}}catch(b){V(a,b);return}d.deps--,0===d.deps&&null!==(a=d.chunk)&&"blocked"===a.status&&(b=a.value,a.status="fulfilled",a.value=d.value,a.reason=d.reason,null!==b&&F(b,d.value))}function V(a,b){var c=a.handler;a=a.response,c.errored||(c.errored=!0,c.value=null,c.reason=b,null!==(c=c.chunk)&&"blocked"===c.status&&J(a,c,b))}function W(a,b,c,d,e,f){if(O){var g=O;g.deps++}else g=O={parent:null,chunk:null,value:null,reason:null,deps:1,errored:!1};return b={response:d,handler:g,parentObject:b,key:c,map:e,path:f},null===a.value?a.value=[b]:a.value.push(b),null===a.reason?a.reason=[b]:a.reason.push(b),null}function X(a,b,c,d){if(!a._serverReferenceConfig)return function(a,b,c){function d(){var a=Array.prototype.slice.call(arguments);return f?"fulfilled"===f.status?b(e,f.value.concat(a)):Promise.resolve(f).then(function(c){return b(e,c.concat(a))}):b(e,a)}var e=a.id,f=a.bound;return z(d,e,f,c),d}(b,a._callServer,a._encodeFormAction);var e=function(a,b){var c="",d=a[b];if(d)c=d.name;else{var e=b.lastIndexOf("#");if(-1!==e&&(c=b.slice(e+1),d=a[b.slice(0,e)]),!d)throw Error('Could not find the module "'+b+'" in the React Server Manifest. This is probably a bug in the React Server Components bundler.')}return d.async?[d.id,d.chunks,c,1]:[d.id,d.chunks,c]}(a._serverReferenceConfig,b.id),f=k(e);if(f)b.bound&&(f=Promise.all([f,b.bound]));else{if(!b.bound)return z(f=l(e),b.id,b.bound,a._encodeFormAction),f;f=Promise.resolve(b.bound)}if(O){var g=O;g.deps++}else g=O={parent:null,chunk:null,value:null,reason:null,deps:1,errored:!1};return f.then(function(){var f=l(e);if(b.bound){var h=b.bound.value.slice(0);h.unshift(null),f=f.bind.apply(f,h)}z(f,b.id,b.bound,a._encodeFormAction),"__proto__"!==d&&(c[d]=f),""===d&&null===g.value&&(g.value=f),c[0]===n&&"object"==typeof g.value&&null!==g.value&&g.value.$$typeof===n&&(h=g.value,"3"===d)&&(h.props=f),g.deps--,0===g.deps&&null!==(f=g.chunk)&&"blocked"===f.status&&(h=f.value,f.status="fulfilled",f.value=g.value,f.reason=null,null!==h&&F(h,g.value))},function(b){if(!g.errored){g.errored=!0,g.value=null,g.reason=b;var c=g.chunk;null!==c&&"blocked"===c.status&&J(a,c,b)}}),null}function Y(a,b,c,d,e){var f=parseInt((b=b.split(":"))[0],16);switch((f=T(a,f)).status){case"resolved_model":P(f);break;case"resolved_module":Q(f)}switch(f.status){case"fulfilled":var g=f.value;for(f=1;f<b.length;f++){for(;g.$$typeof===o;){switch((g=g._payload).status){case"resolved_model":P(g);break;case"resolved_module":Q(g)}switch(g.status){case"fulfilled":g=g.value;break;case"blocked":case"pending":return W(g,c,d,a,e,b.slice(f-1));case"halted":return O?(a=O,a.deps++):O={parent:null,chunk:null,value:null,reason:null,deps:1,errored:!1},null;default:return O?(O.errored=!0,O.value=null,O.reason=g.reason):O={parent:null,chunk:null,value:null,reason:g.reason,deps:0,errored:!0},null}}g=g[b[f]]}return e(a,g,c,d);case"pending":case"blocked":return W(f,c,d,a,e,b);case"halted":return O?(a=O,a.deps++):O={parent:null,chunk:null,value:null,reason:null,deps:1,errored:!1},null;default:return O?(O.errored=!0,O.value=null,O.reason=f.reason):O={parent:null,chunk:null,value:null,reason:f.reason,deps:0,errored:!0},null}}function Z(a,b){return new Map(b)}function $(a,b){return new Set(b)}function _(a,b){return new Blob(b.slice(1),{type:b[0]})}function aa(a,b){a=new FormData;for(var c=0;c<b.length;c++)a.append(b[c][0],b[c][1]);return a}function ab(a,b){return b[Symbol.iterator]()}function ac(a,b){return b}function ad(){throw Error('Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.')}function ae(a,b,c,e,f,g,h){var i,j=new Map;this._bundlerConfig=a,this._serverReferenceConfig=b,this._moduleLoading=c,this._callServer=void 0!==e?e:ad,this._encodeFormAction=f,this._nonce=g,this._chunks=j,this._stringDecoder=new d.TextDecoder,this._fromJSON=null,this._closed=!1,this._closedReason=null,this._tempRefs=h,this._fromJSON=(i=this,function(a,b){if("__proto__"!==a){if("string"==typeof b){var c=i,d=this,e=a,f=b;if("$"===f[0]){if("$"===f)return null!==O&&"0"===e&&(O={parent:O,chunk:null,value:null,reason:null,deps:0,errored:!1}),n;switch(f[1]){case"$":return f.slice(1);case"L":return S(c=T(c,d=parseInt(f.slice(2),16)));case"@":return T(c,d=parseInt(f.slice(2),16));case"S":return Symbol.for(f.slice(2));case"h":return Y(c,f=f.slice(2),d,e,X);case"T":if(d="$"+f.slice(2),null==(c=c._tempRefs))throw Error("Missing a temporary reference set but the RSC response returned a temporary reference. Pass a temporaryReference option with the set that was used with the reply.");return c.get(d);case"Q":return Y(c,f=f.slice(2),d,e,Z);case"W":return Y(c,f=f.slice(2),d,e,$);case"B":return Y(c,f=f.slice(2),d,e,_);case"K":return Y(c,f=f.slice(2),d,e,aa);case"Z":return al();case"i":return Y(c,f=f.slice(2),d,e,ab);case"I":return 1/0;case"-":return"$-0"===f?-0:-1/0;case"N":return NaN;case"u":return;case"D":return new Date(Date.parse(f.slice(2)));case"n":return BigInt(f.slice(2));default:return Y(c,f=f.slice(1),d,e,ac)}}return f}if("object"==typeof b&&null!==b){if(b[0]===n){if(a={$$typeof:n,type:b[1],key:b[2],ref:null,props:b[3]},null!==O){if(O=(b=O).parent,b.errored)a=S(a=new D("rejected",null,b.reason));else if(0<b.deps){var g=new D("blocked",null,null);b.value=a,b.chunk=g,a=S(g)}}}else a=b;return a}return b}})}function af(){return{_rowState:0,_rowID:0,_rowTag:0,_rowLength:0,_buffer:[]}}function ag(a,b,c){var d=(a=a._chunks).get(b);d&&"pending"!==d.status?d.reason.enqueueValue(c):a.set(b,new D("fulfilled",c,null))}function ah(a,b,c,d){var e=a._chunks;(a=e.get(b))?"pending"===a.status&&(b=a.value,a.status="fulfilled",a.value=c,a.reason=d,null!==b&&F(b,a.value)):e.set(b,new D("fulfilled",c,d))}function ai(a,b,c){var d=null,e=!1;c=new ReadableStream({type:c,start:function(a){d=a}});var f=null;ah(a,b,c,{enqueueValue:function(a){null===f?d.enqueue(a):f.then(function(){d.enqueue(a)})},enqueueModel:function(b){if(null===f){var c=new D("resolved_model",b,a);P(c),"fulfilled"===c.status?d.enqueue(c.value):(c.then(function(a){return d.enqueue(a)},function(a){return d.error(a)}),f=c)}else{c=f;var e=new D("pending",null,null);e.then(function(a){return d.enqueue(a)},function(a){return d.error(a)}),f=e,c.then(function(){f===e&&(f=null),M(a,e,b)})}},close:function(){if(!e)if(e=!0,null===f)d.close();else{var a=f;f=null,a.then(function(){return d.close()})}},error:function(a){if(!e)if(e=!0,null===f)d.error(a);else{var b=f;f=null,b.then(function(){return d.error(a)})}}})}function aj(){return this}function ak(a,b,c){var d=[],e=!1,f=0,g={};g[q]=function(){var a,b=0;return(a={next:a=function(a){if(void 0!==a)throw Error("Values cannot be passed to next() of AsyncIterables passed to Client Components.");if(b===d.length){if(e)return new D("fulfilled",{done:!0,value:void 0},null);d[b]=new D("pending",null,null)}return d[b++]}})[q]=aj,a},ah(a,b,c?g[q]():g,{enqueueValue:function(a){if(f===d.length)d[f]=new D("fulfilled",{done:!1,value:a},null);else{var b=d[f],c=b.value,e=b.reason;b.status="fulfilled",b.value={done:!1,value:a},b.reason=null,null!==c&&I(b,c,e)}f++},enqueueModel:function(b){f===d.length?d[f]=K(a,b,!1):L(a,d[f],b,!1),f++},close:function(b){if(!e)for(e=!0,f===d.length?d[f]=K(a,b,!0):L(a,d[f],b,!0),f++;f<d.length;)L(a,d[f++],'"$undefined"',!0)},error:function(b){if(!e)for(e=!0,f===d.length&&(d[f]=new D("pending",null,null));f<d.length;)J(a,d[f++],b)}})}function al(){var a=Error("An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.");return a.stack="Error: "+a.message,a}function am(a,b){for(var c=a.length,d=b.length,e=0;e<c;e++)d+=a[e].byteLength;d=new Uint8Array(d);for(var f=e=0;f<c;f++){var g=a[f];d.set(g,e),e+=g.byteLength}return d.set(b,e),d}function an(a,b,c,d,e,f){ag(a,b,e=new e((c=0===c.length&&0==d.byteOffset%f?d:am(c,d)).buffer,c.byteOffset,c.byteLength/f))}function ao(a,b,c,d){switch(c){case 73:var e=a,f=b,g=d,h=e._chunks,i=h.get(f);g=JSON.parse(g,e._fromJSON);var j=function(a,b){if(a){var c=a[b[0]];if(a=c&&c[b[2]])c=a.name;else{if(!(a=c&&c["*"]))throw Error('Could not find the module "'+b[0]+'" in the React Server Consumer Manifest. This is probably a bug in the React Server Components bundler.');c=b[2]}return 4===b.length?[a.id,a.chunks,c,1]:[a.id,a.chunks,c]}return b}(e._bundlerConfig,g);if(!function(a,b,c){if(null!==a)for(var d=1;d<b.length;d+=2){var e=m.d,f=e.X,g=a.prefix+b[d],h=a.crossOrigin;h="string"==typeof h?"use-credentials"===h?h:"":void 0,f.call(e,g,{crossOrigin:h,nonce:c})}}(e._moduleLoading,g[1],e._nonce),g=k(j)){if(i){var l=i;l.status="blocked"}else l=new D("blocked",null,null),h.set(f,l);g.then(function(){return N(e,l,j)},function(a){return J(e,l,a)})}else i?N(e,i,j):h.set(f,new D("resolved_module",j,null));break;case 72:switch(b=d[0],a=JSON.parse(d=d.slice(1),a._fromJSON),d=m.d,b){case"D":d.D(a);break;case"C":"string"==typeof a?d.C(a):d.C(a[0],a[1]);break;case"L":b=a[0],c=a[1],3===a.length?d.L(b,c,a[2]):d.L(b,c);break;case"m":"string"==typeof a?d.m(a):d.m(a[0],a[1]);break;case"X":"string"==typeof a?d.X(a):d.X(a[0],a[1]);break;case"S":"string"==typeof a?d.S(a):d.S(a[0],0===a[1]?void 0:a[1],3===a.length?a[2]:void 0);break;case"M":"string"==typeof a?d.M(a):d.M(a[0],a[1])}break;case 69:var n=(c=a._chunks).get(b);d=JSON.parse(d);var o=al();o.digest=d.digest,n?J(a,n,o):c.set(b,new D("rejected",null,o));break;case 84:(c=(a=a._chunks).get(b))&&"pending"!==c.status?c.reason.enqueueValue(d):a.set(b,new D("fulfilled",d,null));break;case 78:case 68:case 74:case 87:throw Error("Failed to read a RSC payload created by a development version of React on the server while using a production version on the client. Always use matching versions on the server and the client.");case 82:ai(a,b,void 0);break;case 114:ai(a,b,"bytes");break;case 88:ak(a,b,!1);break;case 120:ak(a,b,!0);break;case 67:(a=a._chunks.get(b))&&"fulfilled"===a.status&&a.reason.close(""===d?'"$undefined"':d);break;default:(n=(c=a._chunks).get(b))?M(a,n,d):c.set(b,new D("resolved_model",d,a))}}function ap(a,b,c){for(var d=0,e=b._rowState,g=b._rowID,h=b._rowTag,i=b._rowLength,j=b._buffer,k=c.length;d<k;){var l=-1;switch(e){case 0:58===(l=c[d++])?e=1:g=g<<4|(96<l?l-87:l-48);continue;case 1:84===(e=c[d])||65===e||79===e||111===e||85===e||83===e||115===e||76===e||108===e||71===e||103===e||77===e||109===e||86===e?(h=e,e=2,d++):64<e&&91>e||35===e||114===e||120===e?(h=e,e=3,d++):(h=0,e=3);continue;case 2:44===(l=c[d++])?e=4:i=i<<4|(96<l?l-87:l-48);continue;case 3:l=c.indexOf(10,d);break;case 4:(l=d+i)>c.length&&(l=-1)}var m=c.byteOffset+d;if(-1<l)(function(a,b,c,d,e){switch(c){case 65:ag(a,b,am(d,e).buffer);return;case 79:an(a,b,d,e,Int8Array,1);return;case 111:ag(a,b,0===d.length?e:am(d,e));return;case 85:an(a,b,d,e,Uint8ClampedArray,1);return;case 83:an(a,b,d,e,Int16Array,2);return;case 115:an(a,b,d,e,Uint16Array,2);return;case 76:an(a,b,d,e,Int32Array,4);return;case 108:an(a,b,d,e,Uint32Array,4);return;case 71:an(a,b,d,e,Float32Array,4);return;case 103:an(a,b,d,e,Float64Array,8);return;case 77:an(a,b,d,e,BigInt64Array,8);return;case 109:an(a,b,d,e,BigUint64Array,8);return;case 86:an(a,b,d,e,DataView,1);return}for(var g=a._stringDecoder,h="",i=0;i<d.length;i++)h+=g.decode(d[i],f);ao(a,b,c,h+=g.decode(e))})(a,g,h,j,i=new Uint8Array(c.buffer,m,l-d)),d=l,3===e&&d++,i=g=h=e=0,j.length=0;else{a=new Uint8Array(c.buffer,m,c.byteLength-d),j.push(a),i-=a.byteLength;break}}b._rowState=e,b._rowID=g,b._rowTag=h,b._rowLength=i}function aq(a){R(a,Error("Connection closed."))}function ar(){throw Error("Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead.")}function as(a){return new ae(a.serverConsumerManifest.moduleMap,a.serverConsumerManifest.serverModuleMap,a.serverConsumerManifest.moduleLoading,ar,a.encodeFormAction,"string"==typeof a.nonce?a.nonce:void 0,a&&a.temporaryReferences?a.temporaryReferences:void 0)}function at(a,b){function c(b){R(a,b)}var d=af(),e=b.getReader();e.read().then(function b(f){var g=f.value;if(!f.done)return ap(a,d,g),e.read().then(b).catch(c);aq(a)}).catch(c)}function au(){throw Error("Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead.")}b.createFromFetch=function(a,b){var c=as(b);return a.then(function(a){at(c,a.body)},function(a){R(c,a)}),T(c,0)},b.createFromNodeStream=function(a,b,c){var d=new ae(b.moduleMap,b.serverModuleMap,b.moduleLoading,au,c?c.encodeFormAction:void 0,c&&"string"==typeof c.nonce?c.nonce:void 0,void 0),e=af();return a.on("data",function(a){if("string"==typeof a){for(var b=0,c=e._rowState,f=e._rowID,g=e._rowTag,h=e._rowLength,i=e._buffer,j=a.length;b<j;){var k=-1;switch(c){case 0:58===(k=a.charCodeAt(b++))?c=1:f=f<<4|(96<k?k-87:k-48);continue;case 1:84===(c=a.charCodeAt(b))||65===c||79===c||111===c||85===c||83===c||115===c||76===c||108===c||71===c||103===c||77===c||109===c||86===c?(g=c,c=2,b++):64<c&&91>c||114===c||120===c?(g=c,c=3,b++):(g=0,c=3);continue;case 2:44===(k=a.charCodeAt(b++))?c=4:h=h<<4|(96<k?k-87:k-48);continue;case 3:k=a.indexOf("\n",b);break;case 4:if(84!==g)throw Error("Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams.");if(h<a.length||a.length>3*h)throw Error("String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams.");k=a.length}if(-1<k){if(0<i.length)throw Error("String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams.");ao(d,f,g,b=a.slice(b,k)),b=k,3===c&&b++,h=f=g=c=0,i.length=0}else if(a.length!==b)throw Error("String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams.")}e._rowState=c,e._rowID=f,e._rowTag=g,e._rowLength=h}else ap(d,e,a)}),a.on("error",function(a){R(d,a)}),a.on("end",function(){return aq(d)}),T(d,0)},b.createFromReadableStream=function(a,b){return at(b=as(b),a),T(b,0)},b.createServerReference=function(a){function b(){var b=Array.prototype.slice.call(arguments);return ar(a,b)}return z(b,a,null,void 0),b},b.createTemporaryReferenceSet=function(){return new Map},b.encodeReply=function(a,b){return new Promise(function(c,d){var e=v(a,"",b&&b.temporaryReferences?b.temporaryReferences:void 0,c,d);if(b&&b.signal){var f=b.signal;if(f.aborted)e(f.reason);else{var g=function(){e(f.reason),f.removeEventListener("abort",g)};f.addEventListener("abort",g)}}})},b.registerServerReference=function(a,b,c){return z(a,b,null,c),a}},72216:function(a,b,c){var d,e,f;d=c(67278),c(70522),d.mode.CTR=(f=(e=d.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=this._iv,f=this._counter;e&&(f=this._counter=e.slice(0),this._iv=void 0);var g=f.slice(0);c.encryptBlock(g,0),f[d-1]=f[d-1]+1|0;for(var h=0;h<d;h++)a[b+h]^=g[h]}}),e.Decryptor=f,e),a.exports=d.mode.CTR},72424:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(59504),e=c(26285),f=c(31849),g=new f.Name("fullFormats"),h=new f.Name("fastFormats"),i=(a,b={keywords:!0})=>{if(Array.isArray(b))return j(a,b,d.fullFormats,g),a;let[c,f]="fast"===b.mode?[d.fastFormats,h]:[d.fullFormats,g];return j(a,b.formats||d.formatNames,c,f),b.keywords&&(0,e.default)(a),a};function j(a,b,c,d){var e;for(let g of(null!=(e=a.opts.code).formats||(e.formats=(0,f._)`require("ajv-formats/dist/formats").${d}`),b))a.addFormat(g,c[g])}i.get=(a,b="full")=>{let c=("fast"===b?d.fastFormats:d.fullFormats)[a];if(!c)throw Error(`Unknown format "${a}"`);return c},a.exports=b=i,Object.defineProperty(b,"__esModule",{value:!0}),b.default=i},72652:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{BailoutToCSRError:function(){return d},isBailoutToCSRError:function(){return e}});let c="BAILOUT_TO_CLIENT_SIDE_RENDERING";class d extends Error{constructor(a){super("Bail out to client-side rendering: "+a),this.reason=a,this.digest=c}}function e(a){return"object"==typeof a&&null!==a&&"digest"in a&&a.digest===c}},72748:(a,b,c)=>{"use strict";c.d(b,{$O:()=>w,$S:()=>_,Au:()=>P,Be:()=>j,Bj:()=>r,Ct:()=>s,Dl:()=>p,ER:()=>aa,Eb:()=>U,F7:()=>H,FO:()=>ai,Fk:()=>X,Fn:()=>n,G1:()=>D,G8:()=>O,Hi:()=>T,Il:()=>ae,KA:()=>M,KB:()=>B,Kn:()=>F,LK:()=>J,MB:()=>ak,Mu:()=>h,Ny:()=>v,Pw:()=>t,Rl:()=>g,TL:()=>ag,Tx:()=>R,Uy:()=>x,WN:()=>ad,YA:()=>W,Zm:()=>Q,_L:()=>K,_z:()=>u,aC:()=>o,bS:()=>ab,cU:()=>A,dR:()=>$,dZ:()=>ah,db:()=>E,em:()=>N,f2:()=>G,fU:()=>aj,fs:()=>q,gP:()=>y,hH:()=>Y,jw:()=>L,lo:()=>ac,m9:()=>V,mI:()=>am,nA:()=>k,pY:()=>l,q0:()=>al,qF:()=>Z,qG:()=>I,qm:()=>S,rk:()=>C,rt:()=>z,tB:()=>i,wA:()=>m,xY:()=>af});var d=c(44795),e=c(63429),f=c(73580);function g(a,b){return new a({type:"string",...f.A2(b)})}function h(a,b){return new a({type:"string",format:"email",check:"string_format",abort:!1,...f.A2(b)})}function i(a,b){return new a({type:"string",format:"guid",check:"string_format",abort:!1,...f.A2(b)})}function j(a,b){return new a({type:"string",format:"uuid",check:"string_format",abort:!1,...f.A2(b)})}function k(a,b){return new a({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f.A2(b)})}function l(a,b){return new a({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f.A2(b)})}function m(a,b){return new a({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f.A2(b)})}function n(a,b){return new a({type:"string",format:"url",check:"string_format",abort:!1,...f.A2(b)})}function o(a,b){return new a({type:"string",format:"emoji",check:"string_format",abort:!1,...f.A2(b)})}function p(a,b){return new a({type:"string",format:"nanoid",check:"string_format",abort:!1,...f.A2(b)})}function q(a,b){return new a({type:"string",format:"cuid",check:"string_format",abort:!1,...f.A2(b)})}function r(a,b){return new a({type:"string",format:"cuid2",check:"string_format",abort:!1,...f.A2(b)})}function s(a,b){return new a({type:"string",format:"ulid",check:"string_format",abort:!1,...f.A2(b)})}function t(a,b){return new a({type:"string",format:"xid",check:"string_format",abort:!1,...f.A2(b)})}function u(a,b){return new a({type:"string",format:"ksuid",check:"string_format",abort:!1,...f.A2(b)})}function v(a,b){return new a({type:"string",format:"ipv4",check:"string_format",abort:!1,...f.A2(b)})}function w(a,b){return new a({type:"string",format:"ipv6",check:"string_format",abort:!1,...f.A2(b)})}function x(a,b){return new a({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f.A2(b)})}function y(a,b){return new a({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f.A2(b)})}function z(a,b){return new a({type:"string",format:"base64",check:"string_format",abort:!1,...f.A2(b)})}function A(a,b){return new a({type:"string",format:"base64url",check:"string_format",abort:!1,...f.A2(b)})}function B(a,b){return new a({type:"string",format:"e164",check:"string_format",abort:!1,...f.A2(b)})}function C(a,b){return new a({type:"string",format:"jwt",check:"string_format",abort:!1,...f.A2(b)})}function D(a,b){return new a({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f.A2(b)})}function E(a,b){return new a({type:"string",format:"date",check:"string_format",...f.A2(b)})}function F(a,b){return new a({type:"string",format:"time",check:"string_format",precision:null,...f.A2(b)})}function G(a,b){return new a({type:"string",format:"duration",check:"string_format",...f.A2(b)})}function H(a,b){return new a({type:"number",checks:[],...f.A2(b)})}function I(a,b){return new a({type:"number",coerce:!0,checks:[],...f.A2(b)})}function J(a,b){return new a({type:"number",check:"number_format",abort:!1,format:"safeint",...f.A2(b)})}function K(a,b){return new a({type:"boolean",...f.A2(b)})}function L(a,b){return new a({type:"null",...f.A2(b)})}function M(a){return new a({type:"any"})}function N(a){return new a({type:"unknown"})}function O(a,b){return new a({type:"never",...f.A2(b)})}function P(a,b){return new d.sm({check:"less_than",...f.A2(b),value:a,inclusive:!1})}function Q(a,b){return new d.sm({check:"less_than",...f.A2(b),value:a,inclusive:!0})}function R(a,b){return new d.J_({check:"greater_than",...f.A2(b),value:a,inclusive:!1})}function S(a,b){return new d.J_({check:"greater_than",...f.A2(b),value:a,inclusive:!0})}function T(a,b){return new d.Jk({check:"multiple_of",...f.A2(b),value:a})}function U(a,b){return new d.Yk({check:"max_length",...f.A2(b),maximum:a})}function V(a,b){return new d.Kk({check:"min_length",...f.A2(b),minimum:a})}function W(a,b){return new d.RM({check:"length_equals",...f.A2(b),length:a})}function X(a,b){return new d.DG({check:"string_format",format:"regex",...f.A2(b),pattern:a})}function Y(a){return new d.NI({check:"string_format",format:"lowercase",...f.A2(a)})}function Z(a){return new d.kH({check:"string_format",format:"uppercase",...f.A2(a)})}function $(a,b){return new d.Tt({check:"string_format",format:"includes",...f.A2(b),includes:a})}function _(a,b){return new d.J({check:"string_format",format:"starts_with",...f.A2(b),prefix:a})}function aa(a,b){return new d.E6({check:"string_format",format:"ends_with",...f.A2(b),suffix:a})}function ab(a){return new d.v$({check:"overwrite",tx:a})}function ac(a){return ab(b=>b.normalize(a))}function ad(){return ab(a=>a.trim())}function ae(){return ab(a=>a.toLowerCase())}function af(){return ab(a=>a.toUpperCase())}function ag(){return ab(a=>f.Yv(a))}function ah(a,b,c){return new a({type:"array",element:b,...f.A2(c)})}function ai(a,b,c){let d=f.A2(c);return d.abort??(d.abort=!0),new a({type:"custom",check:"custom",fn:b,...d})}function aj(a,b,c){return new a({type:"custom",check:"custom",fn:b,...f.A2(c)})}function ak(a,b){let c=function(a,b){let c=new d.QP({check:"custom",...f.A2(b)});return c._zod.check=a,c}(b=>(b.addIssue=a=>{"string"==typeof a?b.issues.push(f.sn(a,b.value,c._zod.def)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=b.value),a.inst??(a.inst=c),a.continue??(a.continue=!c._zod.def.abort),b.issues.push(f.sn(a)))},a(b.value,b)),b);return c}function al(a){let b=new d.QP({check:"describe"});return b._zod.onattach=[b=>{let c=e.fd.get(b)??{};e.fd.add(b,{...c,description:a})}],b._zod.check=()=>{},b}function am(a){let b=new d.QP({check:"meta"});return b._zod.onattach=[b=>{let c=e.fd.get(b)??{};e.fd.add(b,{...c,...a})}],b._zod.check=()=>{},b}},72886:(a,b,c)=>{"use strict";a.exports=c(10846)},72906:(a,b)=>{"use strict";async function c(a){var b;let c=e(a);if(!a||!a.config||!c&&!a.config.retry)return{shouldRetry:!1};(c=c||{}).currentRetryAttempt=c.currentRetryAttempt||0,c.retry=void 0===c.retry||null===c.retry?3:c.retry,c.httpMethodsToRetry=c.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],c.noResponseRetries=void 0===c.noResponseRetries||null===c.noResponseRetries?2:c.noResponseRetries,c.retryDelayMultiplier=c.retryDelayMultiplier?c.retryDelayMultiplier:2,c.timeOfFirstRequest=c.timeOfFirstRequest?c.timeOfFirstRequest:Date.now(),c.totalTimeout=c.totalTimeout?c.totalTimeout:Number.MAX_SAFE_INTEGER,c.maxRetryDelay=c.maxRetryDelay?c.maxRetryDelay:Number.MAX_SAFE_INTEGER,c.statusCodesToRetry=c.statusCodesToRetry||[[100,199],[408,408],[429,429],[500,599]],a.config.retryConfig=c;let f=c.shouldRetry||d;if(!await f(a))return{shouldRetry:!1,config:a.config};let g=Math.min(((b=c).currentRetryAttempt?0:b.retryDelay??100)+(Math.pow(b.retryDelayMultiplier,b.currentRetryAttempt)-1)/2*1e3,b.totalTimeout-(Date.now()-b.timeOfFirstRequest),b.maxRetryDelay);a.config.retryConfig.currentRetryAttempt+=1;let h=c.retryBackoff?c.retryBackoff(a,g):new Promise(a=>{setTimeout(a,g)});return c.onRetryAttempt&&await c.onRetryAttempt(a),await h,{shouldRetry:!0,config:a.config}}function d(a){let b=e(a);if(a.config.signal?.aborted&&"TimeoutError"!==a.code||"AbortError"===a.code||!b||0===b.retry||!a.response&&(b.currentRetryAttempt||0)>=b.noResponseRetries||!b.httpMethodsToRetry||!b.httpMethodsToRetry.includes(a.config.method?.toUpperCase()||"GET"))return!1;if(a.response&&a.response.status){let c=!1;for(let[d,e]of b.statusCodesToRetry){let b=a.response.status;if(b>=d&&b<=e){c=!0;break}}if(!c)return!1}return b.currentRetryAttempt=b.currentRetryAttempt||0,!(b.currentRetryAttempt>=b.retry)}function e(a){if(a&&a.config&&a.config.retryConfig)return a.config.retryConfig}Object.defineProperty(b,"__esModule",{value:!0}),b.getRetryConfig=c},73214:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.getToken=e;let d=c(51508);async function e(a){if(!a.transporter)throw Error("No transporter set.");try{let b={method:"POST",url:"https://oauth2.googleapis.com/token",data:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:(0,d.getJwsSign)(a)}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}};return(await a.transporter.request(b)).data}catch(b){let a=b.response?.data;throw a?.error&&(b.message=`${a.error}: ${a.error_description}`),b}}},73315:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.resolveSchema=b.getCompilingSchema=b.resolveRef=b.compileSchema=b.SchemaEnv=void 0;let d=c(31849),e=c(39590),f=c(60359),g=c(53707),h=c(83593),i=c(31638);class j{constructor(a){var b;let c;this.refs={},this.dynamicAnchors={},"object"==typeof a.schema&&(c=a.schema),this.schema=a.schema,this.schemaId=a.schemaId,this.root=a.root||this,this.baseId=null!=(b=a.baseId)?b:(0,g.normalizeId)(null==c?void 0:c[a.schemaId||"$id"]),this.schemaPath=a.schemaPath,this.localRefs=a.localRefs,this.meta=a.meta,this.$async=null==c?void 0:c.$async,this.refs={}}}function k(a){let b,c,h=m.call(this,a);if(h)return h;let j=(0,g.getFullPath)(this.opts.uriResolver,a.root.baseId),{es5:k,lines:l}=this.opts.code,{ownProperties:n}=this.opts,o=new d.CodeGen(this.scope,{es5:k,lines:l,ownProperties:n});a.$async&&(b=o.scopeValue("Error",{ref:e.default,code:(0,d._)`require("ajv/dist/runtime/validation_error").default`}));let p=o.scopeName("validate");a.validateName=p;let q={gen:o,allErrors:this.opts.allErrors,data:f.default.data,parentData:f.default.parentData,parentDataProperty:f.default.parentDataProperty,dataNames:[f.default.data],dataPathArr:[d.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",!0===this.opts.code.source?{ref:a.schema,code:(0,d.stringify)(a.schema)}:{ref:a.schema}),validateName:p,ValidationError:b,schema:a.schema,schemaEnv:a,rootId:j,baseId:a.baseId||j,schemaPath:d.nil,errSchemaPath:a.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,d._)`""`,opts:this.opts,self:this};try{this._compilations.add(a),(0,i.validateFunctionCode)(q),o.optimize(this.opts.code.optimize);let b=o.toString();c=`${o.scopeRefs(f.default.scope)}return ${b}`,this.opts.code.process&&(c=this.opts.code.process(c,a));let e=Function(`${f.default.self}`,`${f.default.scope}`,c)(this,this.scope.get());if(this.scope.value(p,{ref:e}),e.errors=null,e.schema=a.schema,e.schemaEnv=a,a.$async&&(e.$async=!0),!0===this.opts.code.source&&(e.source={validateName:p,validateCode:b,scopeValues:o._values}),this.opts.unevaluated){let{props:a,items:b}=q;e.evaluated={props:a instanceof d.Name?void 0:a,items:b instanceof d.Name?void 0:b,dynamicProps:a instanceof d.Name,dynamicItems:b instanceof d.Name},e.source&&(e.source.evaluated=(0,d.stringify)(e.evaluated))}return a.validate=e,a}catch(b){throw delete a.validate,delete a.validateName,c&&this.logger.error("Error compiling schema, function code:",c),b}finally{this._compilations.delete(a)}}function l(a){return(0,g.inlineRef)(a.schema,this.opts.inlineRefs)?a.schema:a.validate?a:k.call(this,a)}function m(a){for(let d of this._compilations){var b,c;if(b=d,c=a,b.schema===c.schema&&b.root===c.root&&b.baseId===c.baseId)return d}}function n(a,b){let c;for(;"string"==typeof(c=this.refs[b]);)b=c;return c||this.schemas[b]||o.call(this,a,b)}function o(a,b){let c=this.opts.uriResolver.parse(b),d=(0,g._getFullPath)(this.opts.uriResolver,c),e=(0,g.getFullPath)(this.opts.uriResolver,a.baseId,void 0);if(Object.keys(a.schema).length>0&&d===e)return q.call(this,c,a);let f=(0,g.normalizeId)(d),h=this.refs[f]||this.schemas[f];if("string"==typeof h){let b=o.call(this,a,h);if("object"!=typeof(null==b?void 0:b.schema))return;return q.call(this,c,b)}if("object"==typeof(null==h?void 0:h.schema)){if(h.validate||k.call(this,h),f===(0,g.normalizeId)(b)){let{schema:b}=h,{schemaId:c}=this.opts,d=b[c];return d&&(e=(0,g.resolveUrl)(this.opts.uriResolver,e,d)),new j({schema:b,schemaId:c,root:a,baseId:e})}return q.call(this,c,h)}}b.SchemaEnv=j,b.compileSchema=k,b.resolveRef=function(a,b,c){var d;c=(0,g.resolveUrl)(this.opts.uriResolver,b,c);let e=a.refs[c];if(e)return e;let f=n.call(this,a,c);if(void 0===f){let e=null==(d=a.localRefs)?void 0:d[c],{schemaId:g}=this.opts;e&&(f=new j({schema:e,schemaId:g,root:a,baseId:b}))}if(void 0!==f)return a.refs[c]=l.call(this,f)},b.getCompilingSchema=m,b.resolveSchema=o;let p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function q(a,{baseId:b,schema:c,root:d}){var e;let f;if((null==(e=a.fragment)?void 0:e[0])!=="/")return;for(let d of a.fragment.slice(1).split("/")){if("boolean"==typeof c)return;let a=c[(0,h.unescapeFragment)(d)];if(void 0===a)return;let e="object"==typeof(c=a)&&c[this.opts.schemaId];!p.has(d)&&e&&(b=(0,g.resolveUrl)(this.opts.uriResolver,b,e))}if("boolean"!=typeof c&&c.$ref&&!(0,h.schemaHasRulesButRef)(c,this.RULES)){let a=(0,g.resolveUrl)(this.opts.uriResolver,b,c.$ref);f=o.call(this,d,a)}let{schemaId:i}=this.opts;if((f=f||new j({schema:c,schemaId:i,root:d,baseId:b})).schema!==f.root.schema)return f}},73359:(a,b,c)=>{"use strict";let d;Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{BubbledError:function(){return n},SpanKind:function(){return l},SpanStatusCode:function(){return k},getTracer:function(){return v},isBubbledError:function(){return o}});let e=c(69579),f=c(35404),g=process.env.NEXT_OTEL_PERFORMANCE_PREFIX;try{d=c(14139)}catch(a){d=c(14139)}let{context:h,propagation:i,trace:j,SpanStatusCode:k,SpanKind:l,ROOT_CONTEXT:m}=d;class n extends Error{constructor(a,b){super(),this.bubble=a,this.result=b}}function o(a){return"object"==typeof a&&null!==a&&a instanceof n}let p=(a,b)=>{o(b)&&b.bubble?a.setAttribute("next.bubble",!0):(b&&(a.recordException(b),a.setAttribute("error.type",b.name)),a.setStatus({code:k.ERROR,message:null==b?void 0:b.message})),a.end()},q=new Map,r=d.createContextKey("next.rootSpanId"),s=0,t={set(a,b,c){a.push({key:b,value:c})}};class u{getTracerInstance(){return j.getTracer("next.js","0.0.1")}getContext(){return h}getTracePropagationData(){let a=h.active(),b=[];return i.inject(a,b,t),b}getActiveScopeSpan(){return j.getSpan(null==h?void 0:h.active())}withPropagatedContext(a,b,c){let d=h.active();if(j.getSpanContext(d))return b();let e=i.extract(d,a,c);return h.with(e,b)}trace(...a){var b;let[c,d,i]=a,{fn:k,options:l}="function"==typeof d?{fn:d,options:{}}:{fn:i,options:{...d}},n=l.spanName??c;if(!e.NextVanillaSpanAllowlist.has(c)&&"1"!==process.env.NEXT_OTEL_VERBOSE||l.hideSpan)return k();let o=this.getSpanContext((null==l?void 0:l.parentSpan)??this.getActiveScopeSpan()),t=!1;o?(null==(b=j.getSpanContext(o))?void 0:b.isRemote)&&(t=!0):(o=(null==h?void 0:h.active())??m,t=!0);let u=s++;return l.attributes={"next.span_name":n,"next.span_type":c,...l.attributes},h.with(o.setValue(r,u),()=>this.getTracerInstance().startActiveSpan(n,l,a=>{let b;g&&c&&e.LogSpanAllowList.has(c)&&(b="performance"in globalThis&&"measure"in performance?globalThis.performance.now():void 0);let d=!1,h=()=>{!d&&(d=!0,q.delete(u),b&&performance.measure(`${g}:next-${(c.split(".").pop()||"").replace(/[A-Z]/g,a=>"-"+a.toLowerCase())}`,{start:b,end:performance.now()}))};if(t&&q.set(u,new Map(Object.entries(l.attributes??{}))),k.length>1)try{return k(a,b=>p(a,b))}catch(b){throw p(a,b),b}finally{h()}try{let b=k(a);if((0,f.isThenable)(b))return b.then(b=>(a.end(),b)).catch(b=>{throw p(a,b),b}).finally(h);return a.end(),h(),b}catch(b){throw p(a,b),h(),b}}))}wrap(...a){let b=this,[c,d,f]=3===a.length?a:[a[0],{},a[1]];return e.NextVanillaSpanAllowlist.has(c)||"1"===process.env.NEXT_OTEL_VERBOSE?function(){let a=d;"function"==typeof a&&"function"==typeof f&&(a=a.apply(this,arguments));let e=arguments.length-1,g=arguments[e];if("function"!=typeof g)return b.trace(c,a,()=>f.apply(this,arguments));{let d=b.getContext().bind(h.active(),g);return b.trace(c,a,(a,b)=>(arguments[e]=function(a){return null==b||b(a),d.apply(this,arguments)},f.apply(this,arguments)))}}:f}startSpan(...a){let[b,c]=a,d=this.getSpanContext((null==c?void 0:c.parentSpan)??this.getActiveScopeSpan());return this.getTracerInstance().startSpan(b,c,d)}getSpanContext(a){return a?j.setSpan(h.active(),a):void 0}getRootSpanAttributes(){let a=h.active().getValue(r);return q.get(a)}setRootSpanAttribute(a,b){let c=h.active().getValue(r),d=q.get(c);d&&d.set(a,b)}}let v=(()=>{let a=new u;return()=>a})()},73539:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UrlSubjectTokenSupplier=void 0;let d=c(49502);class e{url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(a){this.url=a.url,this.formatType=a.formatType,this.subjectTokenFieldName=a.subjectTokenFieldName,this.headers=a.headers,this.additionalGaxiosOptions=a.additionalGaxiosOptions}async getSubjectToken(a){let b,c={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType};if(d.AuthClient.setMethodName(c,"getSubjectToken"),"text"===this.formatType?b=(await a.transporter.request(c)).data:"json"===this.formatType&&this.subjectTokenFieldName&&(b=(await a.transporter.request(c)).data[this.subjectTokenFieldName]),!b)throw Error("Unable to parse the subject_token from the credential_source URL");return b}}b.UrlSubjectTokenSupplier=e},73580:(a,b,c)=>{"use strict";c.d(b,{$f:()=>w,A2:()=>y,Gv:()=>r,LG:()=>j,NM:()=>z,OH:()=>G,PO:()=>g,QH:()=>I,Qd:()=>t,Rc:()=>N,UQ:()=>o,Up:()=>B,W0:()=>E,X$:()=>D,Yv:()=>p,cJ:()=>C,cl:()=>h,gJ:()=>l,gx:()=>q,h1:()=>F,hI:()=>s,iR:()=>M,k8:()=>f,lQ:()=>K,mw:()=>H,o8:()=>x,p6:()=>i,qQ:()=>v,rL:()=>J,sn:()=>O,w5:()=>e,yG:()=>u,zH:()=>A,zM:()=>n});var d=c(86709);function e(a){let b=Object.values(a).filter(a=>"number"==typeof a);return Object.entries(a).filter(([a,c])=>-1===b.indexOf(+a)).map(([a,b])=>b)}function f(a,b){return"bigint"==typeof b?b.toString():b}function g(a){return{get value(){{let b=a();return Object.defineProperty(this,"value",{value:b}),b}}}}function h(a){return null==a}function i(a){let b=+!!a.startsWith("^"),c=a.endsWith("$")?a.length-1:a.length;return a.slice(b,c)}function j(a,b){let c=a/b,d=Math.round(c),e=Number.EPSILON*Math.max(Math.abs(c),1);return Math.abs(c-d)<e?0:c-d}let k=Symbol("evaluating");function l(a,b,c){let d;Object.defineProperty(a,b,{get(){if(d!==k)return void 0===d&&(d=k,d=c()),d},set(c){Object.defineProperty(a,b,{value:c})},configurable:!0})}function m(a,b,c){Object.defineProperty(a,b,{value:c,writable:!0,enumerable:!0,configurable:!0})}function n(...a){let b={};for(let c of a)Object.assign(b,Object.getOwnPropertyDescriptors(c));return Object.defineProperties({},b)}function o(a){return JSON.stringify(a)}function p(a){return a.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}let q="captureStackTrace"in Error?Error.captureStackTrace:(...a)=>{};function r(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}let s=g(()=>{if(d.cr.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(a){return!1}});function t(a){if(!1===r(a))return!1;let b=a.constructor;if(void 0===b||"function"!=typeof b)return!0;let c=b.prototype;return!1!==r(c)&&!1!==Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")}function u(a){return t(a)?{...a}:Array.isArray(a)?[...a]:a instanceof Map?new Map(a):a instanceof Set?new Set(a):a}let v=new Set(["string","number","symbol"]);function w(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(a,b,c){let d=new a._zod.constr(b??a._zod.def);return(!b||c?.parent)&&(d._zod.parent=a),d}function y(a){if(!a)return{};if("string"==typeof a)return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");a.error=a.message}return(delete a.message,"string"==typeof a.error)?{...a,error:()=>a.error}:a}function z(a){return Object.keys(a).filter(b=>"optional"===a[b]._zod.optin&&"optional"===a[b]._zod.optout)}let A={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function B(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let e=n(a._zod.def,{get shape(){let a={};for(let d in b){if(!(d in c.shape))throw Error(`Unrecognized key: "${d}"`);b[d]&&(a[d]=c.shape[d])}return m(this,"shape",a),a},checks:[]});return x(a,e)}function C(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let e=n(a._zod.def,{get shape(){let d={...a._zod.def.shape};for(let a in b){if(!(a in c.shape))throw Error(`Unrecognized key: "${a}"`);b[a]&&delete d[a]}return m(this,"shape",d),d},checks:[]});return x(a,e)}function D(a,b){if(!t(b))throw Error("Invalid input to extend: expected a plain object");let c=a._zod.def.checks;if(c&&c.length>0){let c=a._zod.def.shape;for(let a in b)if(void 0!==Object.getOwnPropertyDescriptor(c,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let d=n(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return m(this,"shape",c),c}});return x(a,d)}function E(a,b){if(!t(b))throw Error("Invalid input to safeExtend: expected a plain object");let c=n(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return m(this,"shape",c),c}});return x(a,c)}function F(a,b){if(a._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let c=n(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b._zod.def.shape};return m(this,"shape",c),c},get catchall(){return b._zod.def.catchall},checks:b._zod.def.checks??[]});return x(a,c)}function G(a,b,c){let d=b._zod.def.checks;if(d&&d.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=n(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in d))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=a?new a({type:"optional",innerType:d[b]}):d[b])}else for(let b in d)e[b]=a?new a({type:"optional",innerType:d[b]}):d[b];return m(this,"shape",e),e},checks:[]});return x(b,e)}function H(a,b,c){let d=n(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in e))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=new a({type:"nonoptional",innerType:d[b]}))}else for(let b in d)e[b]=new a({type:"nonoptional",innerType:d[b]});return m(this,"shape",e),e}});return x(b,d)}function I(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue!==!0)return!0;return!1}function J(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue===!1)return!0;return!1}function K(a,b){return b.map(b=>(b.path??(b.path=[]),b.path.unshift(a),b))}function L(a){return"string"==typeof a?a:a?.message}function M(a,b,c){let d=a.message?a.message:L(a.inst?._zod.def?.error?.(a))??L(b?.error?.(a))??L(c.customError?.(a))??L(c.localeError?.(a))??"Invalid input",{inst:e,continue:f,input:g,...h}=a;return h.path??(h.path=[]),h.message=d,b?.reportInput&&(h.input=g),h}function N(a){return Array.isArray(a)?"array":"string"==typeof a?"string":"unknown"}function O(...a){let[b,c,d]=a;return"string"==typeof b?{message:b,code:"custom",input:c,inst:d}:{...b}}},73744:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});let d=c(22666);d.code='require("ajv/dist/runtime/equal").default',b.default=d},73858:a=>{"use strict";a.exports=URIError},73907:function(a,b,c){var d,e;d=c(67278),c(70522),d.mode.ECB=((e=d.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(a,b){this._cipher.encryptBlock(a,b)}}),e.Decryptor=e.extend({processBlock:function(a,b){this._cipher.decryptBlock(a,b)}}),e),a.exports=d.mode.ECB},73919:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GoogleToken=void 0;let d=c(79792),e=c(87836),f=c(39794);class g{tokenOptions;tokenHandler;constructor(a){this.tokenOptions=a||{},this.tokenOptions.transporter=this.tokenOptions.transporter||{request:a=>(0,d.request)(a)},this.tokenOptions.iss||(this.tokenOptions.iss=this.tokenOptions.email),"object"==typeof this.tokenOptions.scope&&(this.tokenOptions.scope=this.tokenOptions.scope.join(" ")),this.tokenHandler=new e.TokenHandler(this.tokenOptions)}get expiresAt(){return this.tokenHandler.tokenExpiresAt}get accessToken(){return this.tokenHandler.token?.access_token}get idToken(){return this.tokenHandler.token?.id_token}get tokenType(){return this.tokenHandler.token?.token_type}get refreshToken(){return this.tokenHandler.token?.refresh_token}hasExpired(){return this.tokenHandler.hasExpired()}isTokenExpiring(){return this.tokenHandler.isTokenExpiring()}getToken(a,b={forceRefresh:!1}){let c;"function"==typeof a?c=a:"object"==typeof a&&(b=a);let d=this.tokenHandler.getToken(b.forceRefresh??!1);return c&&d.then(a=>c(null,a),c),d}revokeToken(a){if(!this.accessToken)return Promise.reject(Error("No token to revoke."));let b=(0,f.revokeToken)(this.accessToken,this.tokenOptions.transporter);a&&b.then(()=>a(),a),this.tokenHandler=new e.TokenHandler(this.tokenOptions)}get googleTokenOptions(){return this.tokenOptions}}b.GoogleToken=g},73925:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AwsClient=void 0;let d=c(19553),e=c(35294),f=c(25785),g=c(45388),h=c(79792);class i extends e.BaseExternalAccountClient{environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static #A="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(a){super(a);let b=(0,g.originalOrCamelOptions)(a),c=b.get("credential_source"),d=b.get("aws_security_credentials_supplier");if(!c&&!d)throw Error("A credential source or AWS security credentials supplier must be specified.");if(c&&d)throw Error("Only one of credential source or AWS security credentials supplier can be specified.");if(d)this.awsSecurityCredentialsSupplier=d,this.regionalCredVerificationUrl=i.#A,this.credentialSourceType="programmatic";else{let a=(0,g.originalOrCamelOptions)(c);this.environmentId=a.get("environment_id");let b=a.get("region_url"),d=a.get("url"),e=a.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new f.DefaultAwsSecurityCredentialsSupplier({regionUrl:b,securityCredentialsUrl:d,imdsV2SessionTokenUrl:e}),this.regionalCredVerificationUrl=a.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let a=this.environmentId?.match(/^(aws)(\d+)$/);if(a&&this.regionalCredVerificationUrl){if(1!==parseInt(a[2],10))throw Error(`aws version "${a[2]}" is not supported in the current build.`)}else throw Error('No valid AWS "credential_source" provided')}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new d.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let a=await this.awsRequestSigner.getRequestOptions({...i.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),b=[];return h.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},a.headers).forEach((a,c)=>b.push({key:c,value:a})),encodeURIComponent(JSON.stringify({url:a.url,method:a.method,headers:b}))}}b.AwsClient=i},74149:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{StaticGenBailoutError:function(){return d},isStaticGenBailoutError:function(){return e}});let c="NEXT_STATIC_GEN_BAILOUT";class d extends Error{constructor(...a){super(...a),this.code=c}}function e(a){return"object"==typeof a&&null!==a&&"code"in a&&a.code===c}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},74240:(a,b,c)=>{"use strict";let d,e=c(74075),f=c(27047),g=c(84296),{kStatusCode:h}=c(32995),i=Buffer[Symbol.species],j=Buffer.from([0,0,255,255]),k=Symbol("permessage-deflate"),l=Symbol("total-length"),m=Symbol("callback"),n=Symbol("buffers"),o=Symbol("error");class p{constructor(a){this._options=a||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,d||(d=new g(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let a={};return this._options.serverNoContextTakeover&&(a.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(a.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(a.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?a.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(a.client_max_window_bits=!0),a}accept(a){return a=this.normalizeParams(a),this.params=this._isServer?this.acceptAsServer(a):this.acceptAsClient(a),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let a=this._deflate[m];this._deflate.close(),this._deflate=null,a&&a(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(a){let b=this._options,c=a.find(a=>(!1!==b.serverNoContextTakeover||!a.server_no_context_takeover)&&(!a.server_max_window_bits||!1!==b.serverMaxWindowBits&&("number"!=typeof b.serverMaxWindowBits||!(b.serverMaxWindowBits>a.server_max_window_bits)))&&("number"!=typeof b.clientMaxWindowBits||!!a.client_max_window_bits));if(!c)throw Error("None of the extension offers can be accepted");return b.serverNoContextTakeover&&(c.server_no_context_takeover=!0),b.clientNoContextTakeover&&(c.client_no_context_takeover=!0),"number"==typeof b.serverMaxWindowBits&&(c.server_max_window_bits=b.serverMaxWindowBits),"number"==typeof b.clientMaxWindowBits?c.client_max_window_bits=b.clientMaxWindowBits:(!0===c.client_max_window_bits||!1===b.clientMaxWindowBits)&&delete c.client_max_window_bits,c}acceptAsClient(a){let b=a[0];if(!1===this._options.clientNoContextTakeover&&b.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(b.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&b.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(b.client_max_window_bits=this._options.clientMaxWindowBits);return b}normalizeParams(a){return a.forEach(a=>{Object.keys(a).forEach(b=>{let c=a[b];if(c.length>1)throw Error(`Parameter "${b}" must have only a single value`);if(c=c[0],"client_max_window_bits"===b){if(!0!==c){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else if("server_max_window_bits"===b){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if("client_no_context_takeover"===b||"server_no_context_takeover"===b){if(!0!==c)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else throw Error(`Unknown parameter "${b}"`);a[b]=c})}),a}decompress(a,b,c){d.add(d=>{this._decompress(a,b,(a,b)=>{d(),c(a,b)})})}compress(a,b,c){d.add(d=>{this._compress(a,b,(a,b)=>{d(),c(a,b)})})}_decompress(a,b,c){let d=this._isServer?"client":"server";if(!this._inflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:b}),this._inflate[k]=this,this._inflate[l]=0,this._inflate[n]=[],this._inflate.on("error",s),this._inflate.on("data",r)}this._inflate[m]=c,this._inflate.write(a),b&&this._inflate.write(j),this._inflate.flush(()=>{let a=this._inflate[o];if(a){this._inflate.close(),this._inflate=null,c(a);return}let e=f.concat(this._inflate[n],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._inflate.reset()),c(null,e)})}_compress(a,b,c){let d=this._isServer?"server":"client";if(!this._deflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:b}),this._deflate[l]=0,this._deflate[n]=[],this._deflate.on("data",q)}this._deflate[m]=c,this._deflate.write(a),this._deflate.flush(e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=f.concat(this._deflate[n],this._deflate[l]);b&&(a=new i(a.buffer,a.byteOffset,a.length-4)),this._deflate[m]=null,this._deflate[l]=0,this._deflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._deflate.reset(),c(null,a)})}}function q(a){this[n].push(a),this[l]+=a.length}function r(a){if(this[l]+=a.length,this[k]._maxPayload<1||this[l]<=this[k]._maxPayload)return void this[n].push(a);this[o]=RangeError("Max payload size exceeded"),this[o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[o][h]=1009,this.removeListener("data",r),this.reset()}function s(a){if(this[k]._inflate=null,this[o])return void this[m](this[o]);a[h]=1007,this[m](a)}a.exports=p},74829:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.JWT=void 0;let d=c(73919),e=c(28627),f=c(58838),g=c(49633),h=c(49502);class i extends g.OAuth2Client{email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(a={}){super(a),this.email=a.email,this.keyFile=a.keyFile,this.key=a.key,this.keyId=a.keyId,this.scopes=a.scopes,this.subject=a.subject,this.additionalClaims=a.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(a){let b=new i(this);return b.scopes=a,b}async getRequestMetadataAsync(a){a=this.defaultServicePath?`https://${this.defaultServicePath}/`:a;let b=!this.hasUserScopes()&&a||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==h.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==h.DEFAULT_UNIVERSE)throw RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${h.DEFAULT_UNIVERSE}`);if(!this.apiKey&&b)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:a}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${a.id_token}`}))}}else{let b;this.access||(this.access=new f.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis)),this.hasUserScopes()?b=this.scopes:a||(b=this.defaultScopes);let c=this.useJWTAccessWithScope||this.universeDomain!==h.DEFAULT_UNIVERSE,d=await this.access.getRequestHeaders(a??void 0,this.additionalClaims,c?b:void 0);return{headers:this.addSharedMetadataHeaders(d)}}return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(a):{headers:new Headers}}async fetchIdToken(a){let b=new d.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:a},transporter:this.transporter});if(await b.getToken({forceRefresh:!0}),!b.idToken)throw Error("Unknown error: Failed to fetch ID token");return b.idToken}hasUserScopes(){return!!this.scopes&&this.scopes.length>0}hasAnyScopes(){return!!this.scopes&&!!(this.scopes.length>0)||!!this.defaultScopes&&!!(this.defaultScopes.length>0)}authorize(a){if(!a)return this.authorizeAsync();this.authorizeAsync().then(b=>a(null,b),a)}async authorizeAsync(){let a=await this.refreshToken();if(!a)throw Error("No result returned");return this.credentials=a.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.googleTokenOptions?.key,this.email=this.gtoken.googleTokenOptions?.iss,a.tokens}async refreshTokenNoCache(){let a=this.createGToken(),b={access_token:(await a.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:a.expiresAt,id_token:a.idToken};return this.emit("tokens",b),{res:null,tokens:b}}createGToken(){return this.gtoken||(this.gtoken=new d.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})),this.gtoken}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!a.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!a.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=a.client_email,this.key=a.private_key,this.keyId=a.private_key_id,this.projectId=a.project_id,this.quotaProjectId=a.quota_project_id,this.universeDomain=a.universe_domain||this.universeDomain}fromStream(a,b){if(!b)return this.fromStreamAsync(a);this.fromStreamAsync(a).then(()=>b(),b)}fromStreamAsync(a){return new Promise((b,c)=>{if(!a)throw Error("Must pass in a stream containing the service account auth settings.");let d="";a.setEncoding("utf8").on("error",c).on("data",a=>d+=a).on("end",()=>{try{let a=JSON.parse(d);this.fromJSON(a),b()}catch(a){c(a)}})})}fromAPIKey(a){if("string"!=typeof a)throw Error("Must provide an API Key string.");this.apiKey=a}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){this.createGToken();let a=await (0,e.getCredentials)(this.keyFile);return{private_key:a.privateKey,client_email:a.clientEmail}}throw Error("A key or a keyFile must be provided to getCredentials.")}}b.JWT=i},74994:function(a,b,c){var d;d=c(67278),c(33263),c(52117),c(46007),c(70522),function(){var a=d.lib.StreamCipher,b=d.algo,c=b.RC4=a.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes,d=this._S=[],e=0;e<256;e++)d[e]=e;for(var e=0,f=0;e<256;e++){var g=e%c,h=b[g>>>2]>>>24-g%4*8&255;f=(f+d[e]+h)%256;var i=d[e];d[e]=d[f],d[f]=i}this._i=this._j=0},_doProcessBlock:function(a,b){a[b]^=e.call(this)},keySize:8,ivSize:0});function e(){for(var a=this._S,b=this._i,c=this._j,d=0,e=0;e<4;e++){c=(c+a[b=(b+1)%256])%256;var f=a[b];a[b]=a[c],a[c]=f,d|=a[(a[b]+a[c])%256]<<24-8*e}return this._i=b,this._j=c,d}d.RC4=a._createHelper(c);var f=b.RC4Drop=c.extend({cfg:c.cfg.extend({drop:192}),_doReset:function(){c._doReset.call(this);for(var a=this.cfg.drop;a>0;a--)e.call(this)}});d.RC4Drop=a._createHelper(f)}(),a.exports=d.RC4},75786:(a,b,c)=>{"use strict";var d=Function.prototype.call,e=Object.prototype.hasOwnProperty;a.exports=c(77776).call(d,e)},76077:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),!function(a,b){for(var c in b)Object.defineProperty(a,c,{enumerable:!0,get:b[c]})}(b,{Postpone:function(){return A},PreludeState:function(){return V},abortAndThrowOnSynchronousRequestDataAccess:function(){return x},abortOnSynchronousPlatformIOAccess:function(){return v},accessedDynamicData:function(){return I},annotateDynamicAccess:function(){return N},consumeDynamicAccess:function(){return J},createDynamicTrackingState:function(){return o},createDynamicValidationState:function(){return p},createHangingInputAbortSignal:function(){return M},createRenderInBrowserAbortSignal:function(){return L},delayUntilRuntimeStage:function(){return Y},formatDynamicAPIAccesses:function(){return K},getFirstDynamicReason:function(){return q},isDynamicPostpone:function(){return D},isPrerenderInterruptedError:function(){return H},logDisallowedDynamicError:function(){return W},markCurrentScopeAsDynamic:function(){return r},postponeWithTracking:function(){return B},throwIfDisallowedDynamic:function(){return X},throwToInterruptStaticGeneration:function(){return s},trackAllowedDynamicAccess:function(){return U},trackDynamicDataInDynamicRender:function(){return t},trackSynchronousPlatformIOAccessInDev:function(){return w},trackSynchronousRequestDataAccessInDev:function(){return z},useDynamicRouteParams:function(){return O},warnOnSyncDynamicError:function(){return y}});let d=function(a){return a&&a.__esModule?a:{default:a}}(c(8654)),e=c(44323),f=c(74149),g=c(63033),h=c(29294),i=c(27266),j=c(51459),k=c(71545),l=c(72652),m=c(52229),n="function"==typeof d.default.unstable_postpone;function o(a){return{isDebugDynamicAccesses:a,dynamicAccesses:[],syncDynamicErrorWithStack:null}}function p(){return{hasSuspenseAboveBody:!1,hasDynamicMetadata:!1,hasDynamicViewport:!1,hasAllowedDynamic:!1,dynamicErrors:[]}}function q(a){var b;return null==(b=a.dynamicAccesses[0])?void 0:b.expression}function r(a,b,c){if(b)switch(b.type){case"cache":case"unstable-cache":case"private-cache":return}if(!a.forceDynamic&&!a.forceStatic){if(a.dynamicShouldError)throw Object.defineProperty(new f.StaticGenBailoutError(`Route ${a.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${c}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`),"__NEXT_ERROR_CODE",{value:"E553",enumerable:!1,configurable:!0});if(b)switch(b.type){case"prerender-ppr":return B(a.route,c,b.dynamicTracking);case"prerender-legacy":b.revalidate=0;let d=Object.defineProperty(new e.DynamicServerError(`Route ${a.route} couldn't be rendered statically because it used ${c}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E550",enumerable:!1,configurable:!0});throw a.dynamicUsageDescription=c,a.dynamicUsageStack=d.stack,d}}}function s(a,b,c){let d=Object.defineProperty(new e.DynamicServerError(`Route ${b.route} couldn't be rendered statically because it used \`${a}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`),"__NEXT_ERROR_CODE",{value:"E558",enumerable:!1,configurable:!0});throw c.revalidate=0,b.dynamicUsageDescription=a,b.dynamicUsageStack=d.stack,d}function t(a){switch(a.type){case"cache":case"unstable-cache":case"private-cache":return}}function u(a,b,c){let d=G(`Route ${a} needs to bail out of prerendering at this point because it used ${b}.`);c.controller.abort(d);let e=c.dynamicTracking;e&&e.dynamicAccesses.push({stack:e.isDebugDynamicAccesses?Error().stack:void 0,expression:b})}function v(a,b,c,d){let e=d.dynamicTracking;u(a,b,d),e&&null===e.syncDynamicErrorWithStack&&(e.syncDynamicErrorWithStack=c)}function w(a){a.prerenderPhase=!1}function x(a,b,c,d){if(!1===d.controller.signal.aborted){u(a,b,d);let e=d.dynamicTracking;e&&null===e.syncDynamicErrorWithStack&&(e.syncDynamicErrorWithStack=c)}throw G(`Route ${a} needs to bail out of prerendering at this point because it used ${b}.`)}function y(a){a.syncDynamicErrorWithStack&&console.error(a.syncDynamicErrorWithStack)}let z=w;function A({reason:a,route:b}){let c=g.workUnitAsyncStorage.getStore();B(b,a,c&&"prerender-ppr"===c.type?c.dynamicTracking:null)}function B(a,b,c){(function(){if(!n)throw Object.defineProperty(Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E224",enumerable:!1,configurable:!0})})(),c&&c.dynamicAccesses.push({stack:c.isDebugDynamicAccesses?Error().stack:void 0,expression:b}),d.default.unstable_postpone(C(a,b))}function C(a,b){return`Route ${a} needs to bail out of prerendering at this point because it used ${b}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`}function D(a){return"object"==typeof a&&null!==a&&"string"==typeof a.message&&E(a.message)}function E(a){return a.includes("needs to bail out of prerendering at this point because it used")&&a.includes("Learn more: https://nextjs.org/docs/messages/ppr-caught-error")}if(!1===E(C("%%%","^^^")))throw Object.defineProperty(Error("Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js"),"__NEXT_ERROR_CODE",{value:"E296",enumerable:!1,configurable:!0});let F="NEXT_PRERENDER_INTERRUPTED";function G(a){let b=Object.defineProperty(Error(a),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return b.digest=F,b}function H(a){return"object"==typeof a&&null!==a&&a.digest===F&&"name"in a&&"message"in a&&a instanceof Error}function I(a){return a.length>0}function J(a,b){return a.dynamicAccesses.push(...b.dynamicAccesses),a.dynamicAccesses}function K(a){return a.filter(a=>"string"==typeof a.stack&&a.stack.length>0).map(({expression:a,stack:b})=>(b=b.split("\n").slice(4).filter(a=>!(a.includes("node_modules/next/")||a.includes(" (<anonymous>)")||a.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${a}:
|
|
@@ -151,4 +151,4 @@ ${d}`:f}let cl=["OAuth authentication required","UnauthorizedError","invalid_tok
|
|
|
151
151
|
`)?i.slice(0,-1):i}),h=void 0,i="",j="");if(a.startsWith(":")){e&&e(a.slice(a.startsWith(": ")?2:1));return}let c=a.indexOf(":");if(-1!==c){let b=a.slice(0,c),d=" "===a[c+1]?2:1;l(b,a.slice(c+d),a);return}l(a,"",a)}function l(a,b,e){switch(a){case"event":j=b;break;case"data":i=`${i}${b}
|
|
152
152
|
`;break;case"id":h=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?d(parseInt(b,10)):c(new dI(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:e}));break;default:c(new dI(`Unknown field "${a.length>20?`${a.slice(0,20)}\u2026`:a}"`,{type:"unknown-field",field:a,value:b,line:e}))}}return{feed:function(a){let b=g?a.replace(/^\xEF\xBB\xBF/,""):a,[c,d]=function(a){let b=[],c="",d=0;for(;d<a.length;){let e=a.indexOf("\r",d),f=a.indexOf(`
|
|
153
153
|
`,d),g=-1;if(-1!==e&&-1!==f?g=Math.min(e,f):-1!==e?g=e===a.length-1?-1:e:-1!==f&&(g=f),-1===g){c=a.slice(d);break}{let c=a.slice(d,g);b.push(c),"\r"===a[(d=g+1)-1]&&a[d]===`
|
|
154
|
-
`&&d++}}return[b,c]}(`${f}${b}`);for(let a of c)k(a);f=d,g=!1},reset:function(a={}){f&&a.consume&&k(f),g=!0,h=void 0,i="",j="",f=""}}}class dL extends TransformStream{constructor({onError:a,onRetry:b,onComment:c}={}){let d;super({start(e){d=dK({onEvent:a=>{e.enqueue(a)},onError(b){"terminate"===a?e.error(b):"function"==typeof a&&a(b)},onRetry:b,onComment:c})},transform(a){d.feed(a)}})}}let dM={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class dN extends Error{constructor(a,b){super(`Streamable HTTP error: ${b}`),this.code=a}}class dO{constructor(a,b){this._hasCompletedAuthFlow=!1,this._url=a,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=b?.requestInit,this._authProvider=b?.authProvider,this._fetch=b?.fetch,this._fetchWithInit=cM(b?.fetch,b?.requestInit),this._sessionId=b?.sessionId,this._reconnectionOptions=b?.reconnectionOptions??dM}async _authThenStart(){let a;if(!this._authProvider)throw new dn("No auth provider");try{a=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw this.onerror?.(a),a}if("AUTHORIZED"!==a)throw new dn;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let a={};if(this._authProvider){let b=await this._authProvider.tokens();b&&(a.Authorization=`Bearer ${b.access_token}`)}this._sessionId&&(a["mcp-session-id"]=this._sessionId),this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);let b=cL(this._requestInit?.headers);return new Headers({...a,...b})}async _startOrAuthSse(a){let{resumptionToken:b}=a;try{let c=await this._commonHeaders();c.set("Accept","text/event-stream"),b&&c.set("last-event-id",b);let d=await (this._fetch??fetch)(this._url,{method:"GET",headers:c,signal:this._abortController?.signal});if(!d.ok){if(await d.body?.cancel(),401===d.status&&this._authProvider)return await this._authThenStart();if(405===d.status)return;throw new dN(d.status,`Failed to open SSE stream: ${d.statusText}`)}this._handleSseStream(d.body,a,!0)}catch(a){throw this.onerror?.(a),a}}_getNextReconnectionDelay(a){if(void 0!==this._serverRetryMs)return this._serverRetryMs;let b=this._reconnectionOptions.initialReconnectionDelay;return Math.min(b*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,a),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(a,b=0){let c=this._reconnectionOptions.maxRetries;if(b>=c)return void this.onerror?.(Error(`Maximum reconnection attempts (${c}) exceeded.`));let d=this._getNextReconnectionDelay(b);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(a).catch(c=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${c instanceof Error?c.message:String(c)}`)),this._scheduleReconnection(a,b+1)})},d)}_handleSseStream(a,b,c){let d;if(!a)return;let{onresumptiontoken:e,replayMessageId:f}=b,g=!1,h=!1;(async()=>{try{let b=a.pipeThrough(new TextDecoderStream).pipeThrough(new dL({onRetry:a=>{this._serverRetryMs=a}})).getReader();for(;;){let{value:a,done:c}=await b.read();if(c)break;if((a.id&&(d=a.id,g=!0,e?.(a.id)),a.data)&&(!a.event||"message"===a.event))try{let b=F.parse(JSON.parse(a.data));D(b)&&(h=!0,void 0!==f&&(b.id=f)),this.onmessage?.(b)}catch(a){this.onerror?.(a)}}(c||g)&&!h&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:d,onresumptiontoken:e,replayMessageId:f},0)}catch(a){if(this.onerror?.(Error(`SSE stream disconnected: ${a}`)),(c||g)&&!h&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:d,onresumptiontoken:e,replayMessageId:f},0)}catch(a){this.onerror?.(Error(`Failed to reconnect: ${a instanceof Error?a.message:String(a)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(a){if(!this._authProvider)throw new dn("No auth provider");if("AUTHORIZED"!==await ds(this._authProvider,{serverUrl:this._url,authorizationCode:a,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new dn("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(a,b){try{let{resumptionToken:c,onresumptiontoken:d}=b||{};if(c)return void this._startOrAuthSse({resumptionToken:c,replayMessageId:A(a)?a.id:void 0}).catch(a=>this.onerror?.(a));let e=await this._commonHeaders();e.set("content-type","application/json"),e.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:e,body:JSON.stringify(a),signal:this._abortController?.signal},g=await (this._fetch??fetch)(this._url,f),h=g.headers.get("mcp-session-id");if(h&&(this._sessionId=h),!g.ok){let b=await g.text().catch(()=>null);if(401===g.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new dN(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:b,scope:c}=dv(g);this._resourceMetadataUrl=b,this._scope=c;let d=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==d)throw new dn;return this._hasCompletedAuthFlow=!0,this.send(a)}if(403===g.status&&this._authProvider){let{resourceMetadataUrl:b,scope:c,error:d}=dv(g);if("insufficient_scope"===d){let d=g.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===d)throw new dN(403,"Server returned 403 after trying upscoping");c&&(this._scope=c),b&&(this._resourceMetadataUrl=b),this._lastUpscopingHeader=d??void 0;let e=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch});if("AUTHORIZED"!==e)throw new dn;return this.send(a)}}throw new dN(g.status,`Error POSTing to endpoint: ${b}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===g.status){await g.body?.cancel(),W.safeParse(a).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(a=>this.onerror?.(a));return}let i=(Array.isArray(a)?a:[a]).filter(a=>"method"in a&&"id"in a&&void 0!==a.id).length>0,j=g.headers.get("content-type");if(i)if(j?.includes("text/event-stream"))this._handleSseStream(g.body,{onresumptiontoken:d},!1);else if(j?.includes("application/json")){let a=await g.json();for(let b of Array.isArray(a)?a.map(a=>F.parse(a)):[F.parse(a)])this.onmessage?.(b)}else throw await g.body?.cancel(),new dN(-1,`Unexpected content type: ${j}`);else await g.body?.cancel()}catch(a){throw this.onerror?.(a),a}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let a=await this._commonHeaders(),b={...this._requestInit,method:"DELETE",headers:a,signal:this._abortController?.signal},c=await (this._fetch??fetch)(this._url,b);if(await c.body?.cancel(),!c.ok&&405!==c.status)throw new dN(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(a){throw this.onerror?.(a),a}}setProtocolVersion(a){this._protocolVersion=a}get protocolVersion(){return this._protocolVersion}async resumeStream(a,b){await this._startOrAuthSse({resumptionToken:a,onresumptiontoken:b?.onresumptiontoken})}}class dP extends Event{constructor(a,b){var c,d;super(a),this.code=null!=(c=null==b?void 0:b.code)?c:void 0,this.message=null!=(d=null==b?void 0:b.message)?d:void 0}[Symbol.for("nodejs.util.inspect.custom")](a,b,c){return c(dQ(this),b)}[Symbol.for("Deno.customInspect")](a,b){return a(dQ(this),b)}}function dQ(a){return{type:a.type,message:a.message,code:a.code,defaultPrevented:a.defaultPrevented,cancelable:a.cancelable,timeStamp:a.timeStamp}}var dR,dS,dT,dU,dV,dW,dX,dY,dZ,d$,d_,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,ea,eb,ec,ed,ee=a=>{throw TypeError(a)},ef=(a,b,c)=>b.has(a)||ee("Cannot "+c),eg=(a,b,c)=>(ef(a,b,"read from private field"),c?c.call(a):b.get(a)),eh=(a,b,c)=>b.has(a)?ee("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),ei=(a,b,c,d)=>(ef(a,b,"write to private field"),b.set(a,c),c),ej=(a,b,c)=>(ef(a,b,"access private method"),c);class ek extends EventTarget{constructor(a,b){var c,d;super(),eh(this,d4),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,eh(this,dT),eh(this,dU),eh(this,dV),eh(this,dW),eh(this,dX),eh(this,dY),eh(this,dZ),eh(this,d$,null),eh(this,d_),eh(this,d0),eh(this,d1,null),eh(this,d2,null),eh(this,d3,null),eh(this,d6,async a=>{var b;eg(this,d0).reset();let{body:c,redirected:d,status:e,headers:f}=a;if(204===e){ej(this,d4,eb).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(d?ei(this,dV,new URL(a.url)):ei(this,dV,void 0),200!==e)return void ej(this,d4,eb).call(this,`Non-200 status code (${e})`,e);if(!(f.get("content-type")||"").startsWith("text/event-stream"))return void ej(this,d4,eb).call(this,'Invalid content type, expected "text/event-stream"',e);if(eg(this,dT)===this.CLOSED)return;ei(this,dT,this.OPEN);let g=new Event("open");if(null==(b=eg(this,d3))||b.call(this,g),this.dispatchEvent(g),"object"!=typeof c||!c||!("getReader"in c)){ej(this,d4,eb).call(this,"Invalid response body, expected a web ReadableStream",e),this.close();return}let h=new TextDecoder,i=c.getReader(),j=!0;do{let{done:a,value:b}=await i.read();b&&eg(this,d0).feed(h.decode(b,{stream:!a})),a&&(j=!1,eg(this,d0).reset(),ej(this,d4,ec).call(this))}while(j)}),eh(this,d7,a=>{ei(this,d_,void 0),"AbortError"!==a.name&&"aborted"!==a.type&&ej(this,d4,ec).call(this,function a(b){return b instanceof Error?"errors"in b&&Array.isArray(b.errors)?b.errors.map(a).join(", "):"cause"in b&&b.cause instanceof Error?`${b}: ${a(b.cause)}`:b.message:`${b}`}(a))}),eh(this,d9,a=>{"string"==typeof a.id&&ei(this,d$,a.id);let b=new MessageEvent(a.event||"message",{data:a.data,origin:eg(this,dV)?eg(this,dV).origin:eg(this,dU).origin,lastEventId:a.id||""});eg(this,d2)&&(!a.event||"message"===a.event)&&eg(this,d2).call(this,b),this.dispatchEvent(b)}),eh(this,ea,a=>{ei(this,dY,a)}),eh(this,ed,()=>{ei(this,dZ,void 0),eg(this,dT)===this.CONNECTING&&ej(this,d4,d5).call(this)});try{if(a instanceof URL)ei(this,dU,a);else if("string"==typeof a)ei(this,dU,new URL(a,function(){let a="document"in globalThis?globalThis.document:void 0;return a&&"object"==typeof a&&"baseURI"in a&&"string"==typeof a.baseURI?a.baseURI:void 0}()));else throw Error("Invalid URL")}catch{throw function(a){let b=globalThis.DOMException;return"function"==typeof b?new b(a,"SyntaxError"):SyntaxError(a)}("An invalid or illegal string was specified")}ei(this,d0,dK({onEvent:eg(this,d9),onRetry:eg(this,ea)})),ei(this,dT,this.CONNECTING),ei(this,dY,3e3),ei(this,dX,null!=(c=null==b?void 0:b.fetch)?c:globalThis.fetch),ei(this,dW,null!=(d=null==b?void 0:b.withCredentials)&&d),ej(this,d4,d5).call(this)}get readyState(){return eg(this,dT)}get url(){return eg(this,dU).href}get withCredentials(){return eg(this,dW)}get onerror(){return eg(this,d1)}set onerror(a){ei(this,d1,a)}get onmessage(){return eg(this,d2)}set onmessage(a){ei(this,d2,a)}get onopen(){return eg(this,d3)}set onopen(a){ei(this,d3,a)}addEventListener(a,b,c){super.addEventListener(a,b,c)}removeEventListener(a,b,c){super.removeEventListener(a,b,c)}close(){eg(this,dZ)&&clearTimeout(eg(this,dZ)),eg(this,dT)!==this.CLOSED&&(eg(this,d_)&&eg(this,d_).abort(),ei(this,dT,this.CLOSED),ei(this,d_,void 0))}}dT=new WeakMap,dU=new WeakMap,dV=new WeakMap,dW=new WeakMap,dX=new WeakMap,dY=new WeakMap,dZ=new WeakMap,d$=new WeakMap,d_=new WeakMap,d0=new WeakMap,d1=new WeakMap,d2=new WeakMap,d3=new WeakMap,d4=new WeakSet,d5=function(){ei(this,dT,this.CONNECTING),ei(this,d_,new AbortController),eg(this,dX)(eg(this,dU),ej(this,d4,d8).call(this)).then(eg(this,d6)).catch(eg(this,d7))},d6=new WeakMap,d7=new WeakMap,d8=function(){var a;let b={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...eg(this,d$)?{"Last-Event-ID":eg(this,d$)}:void 0},cache:"no-store",signal:null==(a=eg(this,d_))?void 0:a.signal};return"window"in globalThis&&(b.credentials=this.withCredentials?"include":"same-origin"),b},d9=new WeakMap,ea=new WeakMap,eb=function(a,b){var c;eg(this,dT)!==this.CLOSED&&ei(this,dT,this.CLOSED);let d=new dP("error",{code:b,message:a});null==(c=eg(this,d1))||c.call(this,d),this.dispatchEvent(d)},ec=function(a,b){var c;if(eg(this,dT)===this.CLOSED)return;ei(this,dT,this.CONNECTING);let d=new dP("error",{code:b,message:a});null==(c=eg(this,d1))||c.call(this,d),this.dispatchEvent(d),ei(this,dZ,setTimeout(eg(this,ed),eg(this,dY)))},ed=new WeakMap,ek.CONNECTING=0,ek.OPEN=1,ek.CLOSED=2;class el extends Error{constructor(a,b,c){super(`SSE error: ${b}`),this.code=a,this.event=c}}class em{constructor(a,b){this._url=a,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=b?.eventSourceInit,this._requestInit=b?.requestInit,this._authProvider=b?.authProvider,this._fetch=b?.fetch,this._fetchWithInit=cM(b?.fetch,b?.requestInit)}async _authThenStart(){let a;if(!this._authProvider)throw new dn("No auth provider");try{a=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw this.onerror?.(a),a}if("AUTHORIZED"!==a)throw new dn;return await this._startOrAuth()}async _commonHeaders(){let a={};if(this._authProvider){let b=await this._authProvider.tokens();b&&(a.Authorization=`Bearer ${b.access_token}`)}this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);let b=cL(this._requestInit?.headers);return new Headers({...a,...b})}_startOrAuth(){let a=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((b,c)=>{this._eventSource=new ek(this._url.href,{...this._eventSourceInit,fetch:async(b,c)=>{let d=await this._commonHeaders();d.set("Accept","text/event-stream");let e=await a(b,{...c,headers:d});if(401===e.status&&e.headers.has("www-authenticate")){let{resourceMetadataUrl:a,scope:b}=dv(e);this._resourceMetadataUrl=a,this._scope=b}return e}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{if(401===a.code&&this._authProvider)return void this._authThenStart().then(b,c);let d=new el(a.code,a.message,a);c(d),this.onerror?.(d)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{try{if(this._endpoint=new URL(a.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){c(a),this.onerror?.(a),this.close();return}b()}),this._eventSource.onmessage=a=>{let b;try{b=F.parse(JSON.parse(a.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(b)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(a){if(!this._authProvider)throw new dn("No auth provider");if("AUTHORIZED"!==await ds(this._authProvider,{serverUrl:this._url,authorizationCode:a,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new dn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(a){if(!this._endpoint)throw Error("Not connected");try{let b=await this._commonHeaders();b.set("content-type","application/json");let c={...this._requestInit,method:"POST",headers:b,body:JSON.stringify(a),signal:this._abortController?.signal},d=await (this._fetch??fetch)(this._endpoint,c);if(!d.ok){let b=await d.text().catch(()=>null);if(401===d.status&&this._authProvider){let{resourceMetadataUrl:b,scope:c}=dv(d);this._resourceMetadataUrl=b,this._scope=c;let e=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==e)throw new dn;return this.send(a)}throw Error(`Error POSTing to endpoint (HTTP ${d.status}): ${b}`)}await d.body?.cancel()}catch(a){throw this.onerror?.(a),a}}setProtocolVersion(a){this._protocolVersion=a}}let en=(0,bY.h)("backend/services/mcp/oauth");class eo{constructor(a,b){this.config=a,this._redirectUrl=b,this._clientMetadata={redirect_uris:[b],client_name:`FLUJO MCP Client - ${a.name}`,client_uri:"https://github.com/mario-andreschak/FLUJO",grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"client_secret_post",scope:a.oauthScopes?.join(" ")||"read"},en.info(`Created OAuth client provider for ${a.name}`),en.verbose("OAuth client metadata",JSON.stringify(this._clientMetadata))}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return encodeURIComponent(JSON.stringify({serverName:this.config.name}))}async clientInformation(){if(this.config.oauthClientInformation)return en.debug(`Returning stored client information for ${this.config.name}`),this.config.oauthClientInformation;if(this.config.oauthClientId){let a=this.config.oauthClientSecret?await (0,b_.G)(this.config.oauthClientSecret)??void 0:void 0;return en.debug(`Created client information from config for ${this.config.name}`),{client_id:this.config.oauthClientId,client_secret:a}}en.debug(`No client information available for ${this.config.name}`)}async persist(){let a=await (0,b$.loadServerConfigs)();if(!Array.isArray(a))return void en.warn(`persist: failed to load server configs for ${this.config.name}, cannot persist OAuth state`);let b=new Map(a.map(a=>[a.name,a]));b.set(this.config.name,this.config);let c=await (0,b$.q)(b);c.success||en.warn(`persist: failed to save OAuth state for ${this.config.name}: ${c.error}`)}async invalidateCredentials(a){en.info(`Invalidating OAuth credentials for ${this.config.name} (scope: ${a})`),("all"===a||"tokens"===a)&&(this.config.oauthTokens=void 0),("all"===a||"client"===a)&&(this.config.oauthClientInformation=void 0,this.config.oauthClientMetadata=void 0),("all"===a||"verifier"===a)&&(this.config.oauthCodeVerifier=void 0),await this.persist()}async saveClientInformation(a){en.info(`Saving client information for ${this.config.name}`),en.verbose("Client information to save",JSON.stringify(a)),this.config.oauthClientInformation={client_id:a.client_id,client_secret:a.client_secret,client_id_issued_at:a.client_id_issued_at,client_secret_expires_at:a.client_secret_expires_at},this.config.oauthClientMetadata={redirect_uris:a.redirect_uris,client_name:a.client_name,client_uri:a.client_uri,grant_types:a.grant_types,response_types:a.response_types,token_endpoint_auth_method:a.token_endpoint_auth_method,scope:a.scope,contacts:a.contacts,tos_uri:a.tos_uri,policy_uri:a.policy_uri,jwks_uri:a.jwks_uri,jwks:a.jwks,software_id:a.software_id,software_version:a.software_version},await this.persist(),en.info(`Client information saved for ${this.config.name}`)}async tokens(){if(this.config.oauthTokens){if(en.debug(`Returning stored tokens for ${this.config.name}`),this.config.oauthTokens.expires_in&&this.config.oauthTokens.issued_at){let a=this.config.oauthTokens.issued_at,b=this.config.oauthTokens.expires_in,c=Math.floor(Date.now()/1e3),d=a+b;c>=d?en.info(`Access token for ${this.config.name} has expired (issued: ${a}, expires: ${d}, current: ${c}); SDK will refresh via refresh_token`):en.debug(`Tokens for ${this.config.name} are valid (expires in ${d-c} seconds)`)}return this.config.oauthTokens}en.debug(`No tokens available for ${this.config.name}`)}async saveTokens(a){en.info(`Saving OAuth tokens for ${this.config.name}`),en.verbose("Tokens to save",JSON.stringify({...a,access_token:a.access_token?"[REDACTED]":void 0,refresh_token:a.refresh_token?"[REDACTED]":void 0}));let b={...a,issued_at:Math.floor(Date.now()/1e3)};this.config.oauthTokens=b,await this.persist(),en.info(`OAuth tokens saved for ${this.config.name}`)}async redirectToAuthorization(a){en.info(`Authorization required for ${this.config.name}`),en.info(`Authorization URL: ${a.toString()}`),this.config.authorizationUrl=a.toString();let b=Error(`OAuth authentication required for ${this.config.name}. Please complete the OAuth flow.`);throw b.name="OAuthAuthenticationRequired",b}async saveCodeVerifier(a){en.debug(`Saving code verifier for ${this.config.name}`),this.config.oauthCodeVerifier=a,await this.persist(),en.debug(`Code verifier saved for ${this.config.name}`)}async codeVerifier(){if(!this.config.oauthCodeVerifier){let a=`No code verifier found for ${this.config.name}`;throw en.error(a),Error(a)}return en.debug(`Returning code verifier for ${this.config.name}`),this.config.oauthCodeVerifier}}let ep=new Set(["node","npm","npx"]);var eq=c(79551);let er=(0,bY.h)("backend/services/mcp/roots");function es(){return global.__mcp_node_roots}function et(a){let b=[];for(let c of es().values())if(c.serverName===a)for(let a of c.roots)b.includes(a)||b.push(a);return b}async function eu(a){let b=function(a){let b=a.trim();if(!b)return null;if(b.startsWith("file://"))return b;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(b))return er.warn(`Ignoring non-file root URI: ${b}`),null;try{return(0,eq.pathToFileURL)(b).href}catch(a){return er.warn(`Could not convert root "${b}" to a file URI:`,a),null}}(await (0,b_.c)(a));return b?{uri:b,name:function(a){try{let b=new URL(a).pathname.replace(/\/+$/,"").split("/").pop();return b?decodeURIComponent(b):void 0}catch{return}}(b)}:null}async function ev(a){let b=a.roots,c=[...Array.isArray(b)?b:[],...et(a.name)],d=[],e=new Set;for(let a of c){if("string"!=typeof a||!a.trim())continue;let b=await eu(a);b&&!e.has(b.uri)&&(e.add(b.uri),d.push(b))}if(0===d.length&&"string"==typeof a.rootPath&&a.rootPath.trim()){let b=await eu(a.rootPath);if(b)return[b]}return d}async function ew(a){try{let{loadServerConfigs:b}=await Promise.resolve().then(c.bind(c,6544)),d=await b();if(Array.isArray(d)){let b=d.find(b=>b.name===a.name);if(b)return b}}catch(b){er.warn(`Could not re-load config for ${a.name}, using connect-time config:`,b)}return a}void 0===global.__mcp_node_roots&&(global.__mcp_node_roots=new Map);var ex=c(12763),ey=c(31351);let ez=(0,bY.h)("backend/services/mcp/sampling");function eA(a){return a.sampling}function eB(a){let b=eA(a);return b?.enabled?JSON.stringify({m:b.modelId,t:b.maxTokens,r:b.maxCallsPerMinute}):""}let eC=(0,bY.h)("backend/services/mcp/connection");async function eD(a){if("streamable"!==a.transport&&"sse"!==a.transport||!a.headers||"object"!=typeof a.headers)return a;let b={};for(let[c,d]of Object.entries(a.headers)){if(!c)continue;let{value:a}=cq(d,c);if(!a)continue;let e=await (0,b_.G)(a);e&&(b[c]=e)}return{...a,headers:b}}function eE(a){let b={};for(let[c,d]of Object.entries(a)){if(!c)continue;let{value:a}=cq(d,c);"string"==typeof a&&a.length>0&&(b[c]=a)}return b}function eF(a){let b={};if(a)for(let[c,d]of Object.entries(a))d&&"object"==typeof d&&"value"in d?b[c]=d.value:b[c]=d;return b}function eG(a){return JSON.stringify({command:a.command,args:a.args??[],env:eF(a.env),cwd:String(a.cwd??""),rootPath:a.rootPath??""})}function eH(a){return JSON.stringify({transport:a.transport,url:a.serverUrl??"",headers:a.headers??{},requestInit:a.requestInit??{},eventSourceInit:a.eventSourceInit??{},reconnectionOptions:a.reconnectionOptions??{},sessionId:a.sessionId??"",oauthClientId:a.oauthClientId??"",oauthClientInformation:a.oauthClientInformation??{},oauthClientSecret:a.oauthClientSecret??"",oauthTokens:a.oauthTokens??{}})}function eI(a){eC.debug("Entering createNewClient method");let b=function(a){let b=eA(a);return!!(b?.enabled&&b.modelId)}(a),c=new cJ({name:`flujo-${a.name}-client`,version:"3.16.0"},{capabilities:{experimental:{},roots:{listChanged:!0},...b?{sampling:{}}:{}}});return c.setRequestHandler(bL,async()=>{let b=await ev(await ew(a));return er.debug(`roots/list for ${a.name}: ${b.length} root(s)`),{roots:b}}),b&&function(a,b){let c=[];a.setRequestHandler(bj,async a=>{let d=eA(b);if(!d?.enabled||!d.modelId)throw new bO(dR.InvalidRequest,"Sampling is not enabled for this server");let e=d.maxCallsPerMinute??10,f=Date.now(),g=f-6e4;for(;c.length>0&&c[0]<g;)c.shift();if(c.length>=e)throw ez.warn(`Sampling rate limit (${e}/min) hit for ${b.name}`),new bO(dR.InvalidRequest,`Sampling rate limit of ${e}/min exceeded`);c.push(f);let h=await ex.modelService.getModel(d.modelId);if(!h)throw new bO(dR.InternalError,`Sampling model not found: ${d.modelId}`);let i=await ex.modelService.resolveAndDecryptApiKey(h.ApiKey);if(!i)throw new bO(dR.InternalError,"Could not resolve the sampling model API key");let j=a.params,k=function(a){let b=[];for(let c of(a.systemPrompt&&b.push({role:"system",content:a.systemPrompt}),a.messages||[])){let a=c.content,d=a?.type==="text"&&"string"==typeof a.text?a.text:`[unsupported ${a?.type||"non-text"} content omitted]`;b.push({role:c.role,content:d})}return b}(j),l="number"==typeof j.temperature?j.temperature:.7;ez.info(`Sampling for ${b.name} via model ${h.name} (${k.length} messages)`);let m=(0,ey.getCompletionAdapter)(h),{completion:n}=await m.createCompletion({model:h,apiKey:i,messages:k,temperature:l}),o=n.choices?.[0]?.message?.content;return{role:"assistant",content:{type:"text",text:"string"==typeof o?o:""},model:h.name,stopReason:"endTurn"}})}(c,a),c.__flujoCapKey=eB(a),c}function eJ(a){if(eC.debug("Entering createTransport method"),"streamable"===a.transport){eC.info(`Creating streamable http transport for server ${a.name} with URL ${a.serverUrl}`);let b={};if(a.requestInit&&"object"==typeof a.requestInit&&(b.requestInit=a.requestInit),a.reconnectionOptions&&"object"==typeof a.reconnectionOptions&&(b.reconnectionOptions=a.reconnectionOptions),"string"==typeof a.sessionId&&a.sessionId.length>0&&(b.sessionId=a.sessionId),a.headers&&"object"==typeof a.headers){let c=eE(a.headers);Object.keys(c).length>0&&(b.requestInit={...b.requestInit||{},headers:{...b.requestInit?.headers||{},...c}},eC.info(`Applied ${Object.keys(c).length} custom header(s) for ${a.name}: ${Object.keys(c).join(", ")}`))}a.oauthClientId||a.oauthClientInformation?(eC.info(`Setting up OAuth authentication for ${a.name}`),b.authProvider=function(a,b="http://localhost:4200/api/oauth/callback"){return new eo(a,b)}(a),a.oauthTokens?.access_token?(eC.debug(`OAuth provider configured for ${a.name} with existing tokens`),eC.debug(`Token expires in: ${a.oauthTokens.expires_in} seconds`)):eC.debug(`OAuth provider configured for ${a.name} - will initiate OAuth flow if needed`)):eC.debug(`No OAuth configuration found for ${a.name}`);let c=new dO(new URL(a.serverUrl),b);return c.__flujoHttpKey=eH(a),c}if("sse"===a.transport){eC.info(`Creating legacy sse transport for server ${a.name} with URL ${a.serverUrl}`);let b={};if(a.requestInit&&"object"==typeof a.requestInit&&(b.requestInit=a.requestInit),a.eventSourceInit&&"object"==typeof a.eventSourceInit&&(b.eventSourceInit=a.eventSourceInit),a.headers&&"object"==typeof a.headers){let c=eE(a.headers);Object.keys(c).length>0&&(b.requestInit={...b.requestInit||{},headers:{...b.requestInit?.headers||{},...c}},eC.info(`Applied ${Object.keys(c).length} custom header(s) for ${a.name}: ${Object.keys(c).join(", ")}`))}let c=new em(new URL(a.serverUrl),b);return c.__flujoHttpKey=eH(a),c}return"websocket"===a.transport?(eC.info(`Creating WebSocket transport for server ${a.name} with URL ${a.websocketUrl}`),new cK(new URL(a.websocketUrl))):function(a){if(eC.debug("Entering createStdioTransport method"),"stdio"!==a.transport)throw Error("Cannot create stdio transport for non-stdio config");let b=a.command,c=a.args?[...a.args]:[],d=`${cd.VL}/${a.name}`;eC.info(`Creating stdio transport for server ${a.name}`),eC.debug(`Original command: ${b}`),eC.debug(`Original args: ${JSON.stringify(c)}`),eC.debug(`Server directory: ${d}`);let e=!bW.isAbsolute(b)&&(b.includes("/")||b.includes("\\")),f=!b.includes("/")&&!b.includes("\\");if(eC.debug(`Is relative path: ${e}`),eC.debug(`Is just filename: ${f}`),"win32"===cc.platform()&&b.toLowerCase().endsWith(".bat"))if(eC.debug(`Detected .bat file on Windows: ${b}`),f){let a=bW.join((0,bZ.ok)(),d,b);eC.debug(`Checking if file exists at: ${a}`);let e=cb.existsSync(a);eC.debug(`File exists: ${e}`),e?(eC.debug(`Using full path to .bat file: ${a}`),c=["/c",a,...c]):(eC.warn(`WARNING: .bat file not found at ${a}`),c=["/c",b,...c]),b="cmd.exe"}else eC.debug(`Using cmd.exe with path as provided: ${b}`),c=["/c",b,...c],b="cmd.exe";let g=function(a,b){if(!a||!(!a.includes("/")&&!a.includes("\\")))return a;let c=a.toLowerCase();if(!ep.has(c))return a;if("node"===c)return b.execPath||a;if(!b.execPath)return a;let d=b.dirname(b.execPath);for(let a of"win32"===b.platform?[`${c}.cmd`,`${c}.exe`,c]:[c]){let c=b.joinPath(d,a);if(b.fileExists(c))return c}return a}(b,{execPath:process.execPath,platform:cc.platform(),dirname:bW.dirname,joinPath:bW.join,fileExists:cb.existsSync});g!==b&&(eC.debug(`Resolved Node toolchain command "${b}" to absolute path: ${g}`),b=g),eC.debug(`Final command: ${b}`),eC.debug(`Final args: ${JSON.stringify(c)}`);let h=function({command:a,args:b=[],rootPath:c,cwd:d,serverName:e,defaultCwd:f}){let g=c||d||f;return e&&cu(a,b)&&(g.split(/[\\/]/).filter(Boolean).pop()||"")===e&&function(a){let b=a.match(/^(.*[\\/])[^\\/]+[\\/]*$/);return b?b[1].replace(/[\\/]+$/,""):""}(g)||g}({command:a.command,args:a.args,rootPath:a.rootPath,cwd:a.cwd,serverName:a.name,defaultCwd:`${cd.VL}/${a.name}`}),i=bW.isAbsolute(h)?h:bW.join((0,bZ.ok)(),h);eC.debug(`cwd: ${i}`),eC.debug(`env: ${JSON.stringify(a.env)}`),eC.info(`Creating StdioClientTransport for ${a.name} with stderr: 'pipe'`);let j=eF(a.env);eC.verbose("Transformed environment variables",JSON.stringify(j));let k=new bS({command:b,args:c,env:j,cwd:i,stderr:"pipe"});return k.__flujoStdioKey=eG(a),k.stderr?eC.info(`Stderr stream is available for ${a.name}`):eC.warn(`Stderr stream is NOT available for ${a.name}`),k}(a)}function eK(a,b){return null!==a.exitCode||null!==a.signalCode?Promise.resolve(!0):new Promise(c=>{let d=()=>{clearTimeout(e),c(!0)},e=setTimeout(()=>{a.removeListener("exit",d),c(!1)},b);e.unref?.(),a.once("exit",d)})}async function eL(a,b,c,d){eC.debug("Entering safelyCloseClient method");let e=d?.gracePeriodMs??15e3,f=d?.killEscalationMs??5e3;try{if(a.transport instanceof bS){let c=a.transport._process;if(c&&null===c.exitCode&&null===c.signalCode){try{c.stdin&&!c.stdin.destroyed&&(c.stdin.end(),eC.debug(`Closed stdin for graceful shutdown for ${b}`))}catch(a){eC.warn(`Error closing stdin for ${b}:`,a)}let a=await eK(c,e);if(!a){eC.warn(`Process did not exit within ${e}ms after stdin close, sending SIGTERM for ${b}`);try{c.kill("SIGTERM")}catch(a){eC.error(`Error sending SIGTERM for ${b}:`,a)}a=await eK(c,f)}if(a)eC.info(`Process exited gracefully for ${b}`);else{eC.warn(`Process did not respond to SIGTERM, sending SIGKILL for ${b}`);try{c.kill("SIGKILL")}catch(a){eC.error(`Error sending SIGKILL for ${b}:`,a)}}}}await a.close(),eC.info(`Client closed successfully for ${b}`)}catch(a){eC.warn(`Error closing client for ${b}:`,a)}}var eM=c(92018);void 0===global.__mcp_clients&&(global.__mcp_clients=new Map),void 0===global.__mcp_connecting&&(global.__mcp_connecting=new Set),void 0===global.__mcp_starting_up&&(global.__mcp_starting_up=!0),void 0===global.__mcp_active_transports&&(global.__mcp_active_transports=new Map);let eN=(0,bY.h)("backend/services/mcp/index");class eO{get clients(){return global.__mcp_clients}get connectingServers(){return global.__mcp_connecting}get activeTransports(){return global.__mcp_active_transports}static{this.MAX_STDERR_LOG_ENTRIES=200}appendStderrLog(a,b){let c=this.stderrLogs.get(a)||[];c.push(b),c.length>eO.MAX_STDERR_LOG_ENTRIES&&c.splice(0,c.length-eO.MAX_STDERR_LOG_ENTRIES),this.stderrLogs.set(a,c)}deregisterClient(a){this.clients.delete(a),this.activeTransports.delete(a)}clearRetryTimer(a){let b=this.connectionRetryTimers.get(a);b&&(clearTimeout(b),this.connectionRetryTimers.delete(a),eN.debug(`Cleared retry timer for server ${a}`))}scheduleConnectionRetry(a,b){this.clearRetryTimer(a);let c=this.connectionRetryAttempts.get(a)||0;if(c>=5){eN.warn(`Maximum retry attempts (5) reached for server ${a}, stopping retries`),this.connectionRetryAttempts.delete(a);return}let d=Math.min(5e3*Math.pow(2,c),3e5);eN.info(`Scheduling connection retry for server ${a} in ${d}ms (attempt ${c+1}/5)`);let e=setTimeout(async()=>{eN.info(`Attempting to reconnect server ${a} (attempt ${c+1}/5)`);let b=await this.getServerConfig(a);if(!b){eN.info(`Server ${a} configuration not found, stopping retry attempts`),this.connectionRetryAttempts.delete(a);return}if(b.disabled){eN.info(`Server ${a} is now disabled, stopping retry attempts`),this.connectionRetryAttempts.delete(a);return}let d=this.getClient(a);if(d)try{await d.ping({timeout:5e3}),eN.info(`Server ${a} is already connected and responsive, cancelling retry`),this.connectionRetryAttempts.delete(a);return}catch(b){eN.warn(`Server ${a} has a registered client but ping failed (${b instanceof Error?b.message:String(b)}); reconnecting from scratch`)}this.connectionRetryAttempts.set(a,c+1);try{let e=d?await this.forceReconnect(a):await this.connectServer(b);if(e.success)eN.info(`Successfully reconnected server ${a} after ${c+1} attempts`),this.connectionRetryAttempts.delete(a);else{if(eN.warn(`Failed to reconnect server ${a}: ${e.error}`),e.requiresAuthentication){eN.info(`Server ${a} requires authentication, stopping retry attempts`),this.connectionRetryAttempts.delete(a);return}this.scheduleConnectionRetry(a,b)}}catch(c){eN.error(`Error during retry connection for server ${a}:`,c),this.scheduleConnectionRetry(a,b)}},d);this.connectionRetryTimers.set(a,e)}isStartingUp(){return!0===global.__mcp_starting_up}setStartingUp(a){global.__mcp_starting_up=a,eN.info(`Backend startup state set to: ${a?"starting":"complete"}`)}getClient(a){let b=this.clients.get(a);if(b&&cf(b)){eN.warn(`getClient: client for ${a} has a closed/aborted connection — evicting it`),this.clients.delete(a);return}return eN.debug(`getClient: Looking for client: ${a}`,b?"Found":"Not found"),b}async loadServerConfigs(){eN.debug("loadServerConfigs: Entering method");try{let a=await (0,b$.loadServerConfigs)();if(!Array.isArray(a))return eN.warn("loadServerConfigs: Received non-array response",a),a;return a.some(a=>a.name===eM._)?eN.warn(`loadServerConfigs: A stored server is named "${eM._}" — it shadows FLUJO's built-in server`):a.push((0,eM.z)()),eN.debug(`loadServerConfigs: Loaded ${a.length} server configs`),a}catch(a){return eN.warn("loadServerConfigs: Failed to load server configs:",a),{success:!1,error:`Failed to load server configs: ${a instanceof Error?a.message:"Unknown error"}`}}}async getServerConfig(a){eN.debug(`getServerConfig: Looking up config for server ${a}`);let b=await this.loadServerConfigs();if(!Array.isArray(b))return eN.warn(`getServerConfig: Failed to load configs for ${a}:`,b.error),null;let c=b.find(b=>b.name===a);return c||(eN.warn(`getServerConfig: Server ${a} not found in configs`),null)}async isServerDisabled(a){let b=await this.getServerConfig(a);return b?.disabled===!0}async isInternalServer(a){if(a!==eM._)return!1;let b=await (0,b$.loadServerConfigs)();return!Array.isArray(b)||!b.some(a=>a.name===eM._)}async connectServer(a){let b="string"==typeof a?a:a.name;if(b===eM._&&("string"!=typeof a?!0===a.builtIn:await this.isInternalServer(b)))return this.connectingServers.delete(b),{success:!0};let c=this.inFlightConnects.get(b);if(c)return eN.debug(`connectServer: reusing in-flight connection attempt for ${b}`),c;let d=this.connectServerInternal(a).finally(()=>{this.inFlightConnects.delete(b)});return this.inFlightConnects.set(b,d),d}async connectServerInternal(a){let b;if("string"==typeof a){eN.info(`connectServer: Looking up config for server ${a}`);let c=await this.getServerConfig(a);if(!c)return eN.warn(`connectServer: Server ${a} not found in configs`),{success:!1,error:`Server configuration for "${a}" not found. The server may have been deleted or not properly configured.`};b=c}else b=a;if((("string"==typeof a?b:await this.getServerConfig(b.name))??b).disabled)return eN.info(`connectServer: Server ${b.name} is disabled — refusing to create a client/transport`),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name),{success:!1,error:`Server '${b.name}' is disabled. Enable it on the MCP page to use it.`};let c=(0,bT.A)();eN.info(`connectServer: Starting connection for server ${b.name} [RequestID: ${c}]`),this.connectingServers.add(b.name);try{this.stderrLogs.set(b.name,[]),b=await eD(b);let a=this.clients.get(b.name);if(a){let{needsNewClient:c,reason:d}=function(a,b){if(eC.debug("Entering shouldRecreateClient method"),cf(a))return{needsNewClient:!0,reason:"Existing connection is closed"};if((a.__flujoCapKey??"")!==eB(b))return{needsNewClient:!0,reason:"Client capabilities (sampling) changed"};if("websocket"===b.transport){if(!(a.transport instanceof cK))return{needsNewClient:!0,reason:"Transport type changed to websocket"}}else if("streamable"===b.transport){if(!(a.transport instanceof dO))return{needsNewClient:!0,reason:"Transport type changed to streamable"};let c=a.transport,d=c._url?.toString();if(void 0!==d&&d!==new URL(b.serverUrl).toString())return{needsNewClient:!0,reason:"Streamable server URL changed"};let e=c.__flujoHttpKey;if(!e)return{needsNewClient:!0,reason:"Existing streamable transport has no config key"};if(e!==eH(b))return{needsNewClient:!0,reason:"Streamable auth/connection parameters changed"}}else if("sse"===b.transport){if(!(a.transport instanceof em))return{needsNewClient:!0,reason:"Transport type changed to sse"};let c=a.transport,d=c._url?.toString();if(void 0!==d&&d!==new URL(b.serverUrl).toString())return{needsNewClient:!0,reason:"SSE server URL changed"};let e=c.__flujoHttpKey;if(!e)return{needsNewClient:!0,reason:"Existing sse transport has no config key"};if(e!==eH(b))return{needsNewClient:!0,reason:"SSE auth/connection parameters changed"}}else{if(!(a.transport instanceof bS))return{needsNewClient:!0,reason:"Transport type changed to stdio"};if("stdio"!==b.transport)return{needsNewClient:!0,reason:"Transport type changed from stdio"};let c=a.transport.__flujoStdioKey;if(!c)return{needsNewClient:!0,reason:"Existing stdio transport has no config key"};if(c!==eG(b))return{needsNewClient:!0,reason:"Connection parameters changed"}}return{needsNewClient:!1}}(a,b);if(!c)return eN.info(`connectServer: Server ${b.name} is already connected`),this.lastConnectionError.delete(b.name),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name),{success:!0};eN.info(`connectServer: Existing client for ${b.name} is stale (${d}), recreating`),this.deregisterClient(b.name);try{await eL(a,b.name,b)}catch(a){eN.debug(`connectServer: error closing stale client for ${b.name}: ${a instanceof Error?a.message:String(a)}`)}a=void 0}a=eI(b);let c=eJ(b);if(c instanceof bS&&c.stderr){let a=b.name;c.stderr.on("data",b=>{let c=b.toString();eN.warn(`stderr: [${a}]: ${c}`),this.appendStderrLog(a,c)})}return c.onclose=()=>{if(this.activeTransports.get(b.name)!==c)return void eN.debug(`connectServer: ignoring close event from a stale/deregistered transport for ${b.name}`);eN.warn(`connectServer: Connection closed for server ${b.name}`),this.deregisterClient(b.name),this.getServerConfig(b.name).then(a=>{if(!a||a.disabled)return void eN.info(`Server ${b.name} is now disabled, skipping reconnection logic`);eN.info(`Connection closed for enabled server ${b.name}, scheduling reconnection`),this.scheduleConnectionRetry(b.name,a)}).catch(a=>{eN.warn(`Error checking server config for ${b.name} during onclose:`,a)})},c.onerror=a=>{if(function(a){let b=a instanceof Error?a.message:String(a);return b.includes("SSE stream disconnected")||b.includes("Failed to reconnect SSE stream")||b.includes("Maximum reconnection attempts")||/\bterminated\b/i.test(b)}(a))return void eN.debug(`connectServer: transient SSE stream disconnect for ${b.name} (self-healing, ignored): ${a instanceof Error?a.message:String(a)}`);if(this.activeTransports.get(b.name)!==c)return void eN.debug(`connectServer: ignoring error event from a stale/deregistered transport for ${b.name}`);if(eN.error(`connectServer: Transport error for server ${b.name}:`),a instanceof Error){eN.error(`Error name: ${a.name}`),eN.error(`Error message: ${a.message}`),eN.error(`Error stack: ${a.stack}`);let b=a.code;void 0!==b&&eN.error(`Error code: ${b}`),eN.error(`Error chain: ${cj(a)}`)}else if(a&&"object"==typeof a){eN.error(`Error type: ${typeof a}`),eN.error(`Error constructor: ${a.constructor?.name||"Unknown"}`);let b=Object.getOwnPropertyNames(a);b.length>0?(eN.error(`Error properties: ${b.join(", ")}`),b.forEach(b=>{try{let c=a[b];eN.error(` ${b}: ${"function"==typeof c?"[Function]":JSON.stringify(c)}`)}catch(a){eN.error(` ${b}: [Unable to serialize: ${a}]`)}})):eN.error("Error object has no enumerable properties");try{let b=JSON.stringify(a);eN.error(`JSON stringified error: ${b}`)}catch(a){eN.error(`Cannot JSON stringify error: ${a}`)}}else eN.error(`Error value: ${String(a)} (type: ${typeof a})`);this.appendStderrLog(b.name,`Transport error: ${cj(a)}`),this.deregisterClient(b.name),this.getServerConfig(b.name).then(a=>{if(!a||a.disabled)return void eN.info(`Server ${b.name} is now disabled, skipping reconnection after transport error`);eN.info(`Transport error for enabled server ${b.name}, scheduling reconnection`),this.scheduleConnectionRetry(b.name,a)}).catch(a=>{eN.warn(`Error checking server config for ${b.name} during onerror:`,a)})},await a.connect(c),this.clients.set(b.name,a),this.activeTransports.set(b.name,c),this.lastConnectionError.delete(b.name),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name),eN.info(`connectServer: Successfully connected to ${b.name}`),{success:!0}}catch(f){eN.error(`connectServer: Failed to connect to server ${b.name}:`,f);let a=f instanceof Error?f.message:String(f),c=f instanceof Error?f.name:"";if(a.includes("OAuth authentication required")||"OAuthAuthenticationRequired"===c){if(eN.info(`OAuth authentication required for server ${b.name}`),"streamable"===b.transport){let a=b;a.authorizationUrl&&eN.info(`Authorization URL available for ${b.name}: ${a.authorizationUrl}`)}return{success:!1,error:a,requiresAuthentication:!0}}if(cm(f)){if(eN.info(`OAuth authentication error detected for server ${b.name}: ${a}`),"streamable"===b.transport){let a=b;if(!a.oauthScopes||0===a.oauthScopes.length){eN.info(`Dynamically enabling OAuth for server ${b.name} due to authentication error`);try{let c={...a,oauthScopes:["read"]},d=await this.loadServerConfigs();if(Array.isArray(d)){let a=d.findIndex(a=>a.name===b.name);-1!==a&&(d[a]=c,await (0,b$.q)(new Map(d.map(a=>[a.name,a]))),eN.info(`Updated config for ${b.name} to enable OAuth`))}}catch(a){eN.warn(`Failed to update config for ${b.name} to enable OAuth:`,a)}}}return{success:!1,error:"OAuth authentication failed or tokens have expired. Please re-authenticate.",requiresAuthentication:!0}}let d=this.stderrLogs.get(b.name)||[],e=ck(f,b,d);return this.lastConnectionError.set(b.name,e),{success:!1,error:e}}finally{this.connectingServers.delete(b.name)}}async testConnection(a,b){eN.info(`testConnection: Testing connection to ${a.name||"(unnamed)"} via ${a.transport} transport`);let c=a=>{try{b?.(a)}catch{}},d=[],e=null,f=null;try{let b,g=await eD(a);e=eI(g),(f=eJ(g))instanceof bS&&f.stderr&&f.stderr.on("data",a=>{let b=a.toString();d.push(b),c({type:"stderr",data:b})}),f.onerror=a=>{let b=`Transport error: ${cj(a)}`;d.push(b),c({type:"stderr",data:b+"\n"})},c({type:"status",phase:"spawning",message:"Starting server / opening transport..."});let h=cv(a)?9e4:15e3,i=cv(a),j=new Promise((a,c)=>{b=setTimeout(()=>c(Error(`Connection timeout after ${h/1e3}s`+(i?" — the package may still be downloading via npx/uvx. Try running the Test again (the package is cached after the first download), or verify the command and network access.":""))),h)});c({type:"status",phase:"handshaking",message:"Performing MCP handshake..."});try{await Promise.race([e.connect(f),j])}finally{b&&clearTimeout(b)}c({type:"status",phase:"listing-tools",message:"Handshake OK — listing tools..."});let k=0;try{let a=await e.listTools();k=Array.isArray(a?.tools)?a.tools.length:0}catch(b){eN.debug(`testConnection: connected to ${a.name} but listTools failed: ${b instanceof Error?b.message:String(b)}`)}return eN.info(`testConnection: Successfully connected to ${a.name} (${k} tools)`),c({type:"result",success:!0,data:{toolCount:k}}),{success:!0,data:{toolCount:k}}}catch(f){eN.warn(`testConnection: Failed to connect to ${a.name}:`,f);let b=cm(f),e=ck(f,a,d);return c({type:"result",success:!1,error:e,requiresAuthentication:b}),{success:!1,error:e,requiresAuthentication:b}}finally{if(e)try{await eL(e,a.name,a,{gracePeriodMs:3e3,killEscalationMs:2e3})}catch(b){eN.debug(`testConnection: error closing test client for ${a.name}: ${b instanceof Error?b.message:String(b)}`)}}}setNodeRoots(a,b,c){for(let d of function(a,b,c){let d=(c??[]).filter(a=>"string"==typeof a&&a.trim().length>0),e=es().get(b),f=new Set([a]);e&&f.add(e.serverName);let g=new Map;for(let a of f)g.set(a,et(a));0===d.length?es().delete(b)&&er.debug(`Cleared node roots for node ${b}`):(es().set(b,{serverName:a,roots:d}),er.debug(`Registered ${d.length} node root(s) for node ${b} on server ${a}`));let h=[];for(let a of f){let b=et(a),c=g.get(a)??[];(b.length!==c.length||b.some((a,b)=>a!==c[b]))&&h.push(a)}return h}(a,b,c))this.notifyRootsChanged(d)}notifyRootsChanged(a){let b=this.getClient(a);if(!b)return void eN.debug(`notifyRootsChanged: ${a} not connected, skipping notification`);try{b.sendRootsListChanged().catch(b=>{eN.warn(`notifyRootsChanged: failed to notify ${a}:`,b)}),eN.debug(`notifyRootsChanged: sent roots/list_changed to ${a}`)}catch(b){eN.warn(`notifyRootsChanged: failed to notify ${a}:`,b)}}async disconnectServer(a){if(eN.debug(`disconnectServer: Entering method for server ${a}`),await this.isInternalServer(a))return{success:!0};this.clearRetryTimer(a),this.connectionRetryAttempts.delete(a);let b=this.getClient(a);if(!b)return eN.warn(`disconnectServer: Server ${a} not found in clients map`),this.deregisterClient(a),{success:!1,error:`Server ${a} not found`};this.deregisterClient(a);try{let c=await this.getServerConfig(a);return await eL(b,a,c||void 0),eN.info(`disconnectServer: Disconnected server ${a}`),{success:!0}}catch(b){return eN.warn(`disconnectServer: Failed to disconnect server ${a}:`,b),{success:!1,error:`Failed to disconnect server: ${b instanceof Error?b.message:"Unknown error"}`}}}async forceReconnect(a){if(eN.info(`forceReconnect: Forcing fresh connection for server ${a}`),await this.isInternalServer(a))return{success:!0};let b=this.clients.get(a);if(b){this.deregisterClient(a);let c=await this.getServerConfig(a);try{await eL(b,a,c||void 0)}catch(b){eN.debug(`forceReconnect: error closing stale client for ${a}: ${b instanceof Error?b.message:String(b)}`)}}return this.connectServer(a)}async listServerTools(a){if(eN.debug(`listServerTools: Entering method for server ${a}`),await this.isInternalServer(a)){let{internalToolDefinitions:a}=await Promise.all([c.e(3304),c.e(6936),c.e(6195)]).then(c.bind(c,76195));return{tools:a()}}if(await this.isServerDisabled(a)){let b=`Server '${a}' is disabled. Enable it on the MCP page to use it.`;return eN.warn(`listServerTools: ${b}`),{tools:[],error:b}}let b=this.getClient(a);b||eN.warn(`listServerTools: Client not found for ${a}`);let d=await b2(b,a);if(d.error){eN.warn(`listServerTools: Listing tools for ${a} failed (${d.error}); forcing reconnect and retrying once`);let c=await this.forceReconnect(a);if(!c.success)return eN.warn(`listServerTools: Reconnect for ${a} failed: ${c.error}`),{tools:[],error:c.error||d.error};b=this.clients.get(a),(d=await b2(b,a)).error?eN.warn(`listServerTools: Retry after reconnect still failed for ${a}:`,d.error):eN.info(`listServerTools: Recovered after reconnect for ${a}; listed ${d.tools.length} tools`)}else eN.info(`listServerTools: Listed ${d.tools.length} tools for ${a}`);return d}async callTool(a,b,d,e,f){if(eN.debug(`callTool: Entering method for server ${a}, tool ${b}`),await this.isInternalServer(a)){let{internalCallTool:a}=await Promise.all([c.e(3304),c.e(6936),c.e(6195)]).then(c.bind(c,76195)),e=await a(this,b,d);return eN.info(`callTool: Dispatched internal tool ${b}`),{success:!0,data:e}}if(await this.isServerDisabled(a)){let b=`Server '${a}' is disabled. Enable it on the MCP page to use it.`;return eN.warn(`callTool: ${b}`),{success:!1,error:b}}let g=this.getClient(a);if(!g){eN.warn(`callTool: No client for ${a}; forcing reconnect before calling ${b}`);let c=await this.forceReconnect(a);c.success?g=this.clients.get(a):eN.warn(`callTool: Reconnect for ${a} failed: ${c.error}`)}let h=await b3(g,a,b,d,e,f);return eN.info(`callTool: Called tool ${b} on ${a}`),h}async listWithReconnect(a,b,c){if(await this.isInternalServer(a))return c;if(await this.isServerDisabled(a)){let b=`Server '${a}' is disabled. Enable it on the MCP page to use it.`;return eN.warn(`listWithReconnect: ${b}`),{...c,error:b}}let d=this.getClient(a);d||eN.warn(`listWithReconnect: Client not found for ${a}`);let e=await b(d,a);if(!e.error)return e;eN.warn(`listWithReconnect: Listing for ${a} failed (${e.error}); forcing reconnect and retrying once`);let f=await this.forceReconnect(a);return f.success?(d=this.clients.get(a),(e=await b(d,a)).error?eN.warn(`listWithReconnect: Retry after reconnect still failed for ${a}:`,e.error):eN.info(`listWithReconnect: Recovered after reconnect for ${a}`),e):(eN.warn(`listWithReconnect: Reconnect for ${a} failed: ${f.error}`),{...c,error:f.error||e.error})}async listServerResources(a){return eN.debug(`listServerResources: Entering method for server ${a}`),this.listWithReconnect(a,b5,{resources:[]})}async listServerResourceTemplates(a){return eN.debug(`listServerResourceTemplates: Entering method for server ${a}`),this.listWithReconnect(a,b6,{resourceTemplates:[]})}async readResource(a,b){eN.debug(`readResource: Entering method for server ${a}, uri ${b}`);let c=this.getClient(a);c||eN.warn(`readResource: Client not found for ${a}`);let d=await b7(c,a,b);return eN.info(`readResource: Read resource ${b} on ${a}`),d}async listServerPrompts(a){return eN.debug(`listServerPrompts: Entering method for server ${a}`),this.listWithReconnect(a,b9,{prompts:[]})}async getPrompt(a,b,c){eN.debug(`getPrompt: Entering method for server ${a}, prompt ${b}`);let d=this.getClient(a);d||eN.warn(`getPrompt: Client not found for ${a}`);let e=await ca(d,a,b,c);return eN.info(`getPrompt: Got prompt ${b} on ${a}`),e}async resolveOAuthSecretForSave(a,b){return a===co.RJ?b??"":a?a.startsWith("${global:")||a.startsWith("encrypted:")||a.startsWith("encrypted_failed:")?a:await (0,cn.Rs)(a):""}async resolveHeadersForSave(a,b){let c={};for(let[d,e]of Object.entries(a||{})){if(!d)continue;let{value:a,isSecret:f}=cq(e,d);if(!f){""!==a&&(c[d]={value:a,metadata:{isSecret:!1}});continue}if(a===co.RJ||a===co.gF){let a=b?.[d];void 0!==a&&(c[d]=a);continue}if(a){if("string"==typeof a&&a.startsWith("${global:")||a.startsWith("encrypted:")||a.startsWith("encrypted_failed:")){c[d]={value:a,metadata:{isSecret:!0}};continue}c[d]={value:await (0,cn.Rs)(a),metadata:{isSecret:!0}}}}return c}async ensureRemoteServerRootDir(a){try{if(!["streamable","sse","websocket"].includes(a.transport))return;let b=(a.rootPath||"").trim();if(!b)return;let c=bX().resolve((0,bZ.ok)(),b);if(bX().dirname(c)===c)return;await bV().mkdir(c,{recursive:!0}),eN.debug(`ensureRemoteServerRootDir: ensured ${c} for ${a.name}`)}catch(b){eN.warn(`ensureRemoteServerRootDir: could not create root dir for ${a.name}:`,b)}}async updateServerConfig(a,b){if(eN.debug(`updateServerConfig: Entering method for server ${a}`),await this.isInternalServer(a))return{success:!1,error:`"${eM._}" is FLUJO's built-in server and cannot be created or edited.`};let c=await this.loadServerConfigs();if(!Array.isArray(c))return eN.warn("updateServerConfig: Failed to load configs:",c.error),c;let d=c.find(b=>b.name===a),e=!!d&&"string"==typeof b.name&&b.name!==a;if(e&&c.some(a=>a.name===b.name))return eN.warn(`updateServerConfig: Refusing to rename ${a} -> ${b.name}: name already in use`),{success:!1,error:`A server named "${b.name}" already exists`};if(!d&&b.name)eN.info(`updateServerConfig: Creating new server config for ${b.name}`),d={name:b.name,transport:"stdio",command:"",args:[],env:{},disabled:!1,autoApprove:[],_buildCommand:"",_installCommand:"",rootPath:""},c.push(d);else if(!d)return eN.warn(`updateServerConfig: Server ${a} not found`),{success:!1,error:`Server ${a} not found`};if(b.env){eN.debug(`updateServerConfig: Resolving global variables in env for ${a}`);try{eN.debug(`Original env variables for ${a}:`,JSON.stringify(b.env,null,2)),b.env=await (0,b_.c)(b.env),eN.debug(`Resolved env variables for ${a}:`,JSON.stringify(b.env,null,2)),eN.debug(`updateServerConfig: Successfully resolved global variables for ${a}`)}catch(b){eN.warn(`updateServerConfig: Error resolving global variables for ${a}:`,b)}}let f=b.oauthClientSecret;if(void 0!==f){let a=d.oauthClientSecret;b.oauthClientSecret=await this.resolveOAuthSecretForSave(f,a)}let g=b.headers;if(void 0!==g){let a=d.headers;b.headers=await this.resolveHeadersForSave(g,a)}let h={...d};h={...d,...b};let i=JSON.stringify(d.roots??[])!==JSON.stringify(h.roots??[])||(d.rootPath??"")!==(h.rootPath??""),j=c.findIndex(b=>b.name===a);-1!==j?c[j]=h:h.name&&c.push(h);let k=await (0,b$.q)(new Map(c.map(a=>[a.name,a])));return k.success?(await this.ensureRemoteServerRootDir(h),e?(this.clients.has(a)?await this.disconnectServer(a):(this.clearRetryTimer(a),this.connectionRetryAttempts.delete(a)),this.stderrLogs.delete(a),this.lastConnectionError.delete(a),await this.handleConnectionStateChange(h.name,h)):await this.handleConnectionStateChange(a,h),i&&this.notifyRootsChanged(h.name),eN.info(`updateServerConfig: Successfully updated config for ${a}${e?` (renamed to ${h.name})`:""}`),h):(eN.warn(`updateServerConfig: Failed to save config for ${a}:`,k.error),k)}async handleConnectionStateChange(a,b){eN.debug(`handleConnectionStateChange: Entering method for server ${a}`);let c=!!this.getClient(a),d=!b.disabled;if(c&&!d){eN.info(`handleConnectionStateChange: Disconnecting disabled server ${a}`);try{await this.disconnectServer(a)}catch(b){eN.warn(`handleConnectionStateChange: Failed to disconnect server ${a} during update:`,b)}}else!c&&d?(eN.info(`handleConnectionStateChange: Connecting previously disabled server ${a}`),await this.connectServer(b)):c&&d?(eN.info(`handleConnectionStateChange: Re-applying config to connected server ${a}`),await this.connectServer(b)):d||(eN.info(`handleConnectionStateChange: Clearing retry timers for disabled server ${a}`),this.clearRetryTimer(a),this.connectionRetryAttempts.delete(a))}async clearRetryTimersForDisabledServers(){eN.debug("clearRetryTimersForDisabledServers: Checking for disabled servers with active retry timers");try{let a=await this.loadServerConfigs();if(!Array.isArray(a))return void eN.warn("clearRetryTimersForDisabledServers: Failed to load server configs");for(let b of a.filter(a=>a.disabled))this.connectionRetryTimers.has(b.name)&&(eN.info(`clearRetryTimersForDisabledServers: Clearing retry timer for disabled server ${b.name}`),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name))}catch(a){eN.error("clearRetryTimersForDisabledServers: Error clearing retry timers:",a)}}async deleteServerConfig(a){if(eN.debug(`deleteServerConfig: Entering method for server ${a}`),await this.isInternalServer(a))return{success:!1,error:`"${eM._}" is FLUJO's built-in server and cannot be deleted.`};this.clients.has(a)&&(eN.info(`deleteServerConfig: Disconnecting server ${a} before deletion`),await this.disconnectServer(a));let b=await this.loadServerConfigs();if(!Array.isArray(b))return eN.warn("deleteServerConfig: Failed to load configs:",b.error),b;let c=b.findIndex(b=>b.name===a);if(-1===c)return eN.warn(`deleteServerConfig: Server ${a} not found in configs`),{success:!1,error:`Server ${a} not found`};b.splice(c,1),eN.debug(`deleteServerConfig: Saving updated configs after deleting ${a}`);let d=await (0,b$.q)(new Map(b.map(a=>[a.name,a])));return d.success?eN.info(`deleteServerConfig: Successfully deleted server ${a}`):eN.warn(`deleteServerConfig: Error saving configs after deleting ${a}:`,d.error),d}async getServerStatus(a){if(await this.isInternalServer(a))return{status:"connected"};let b=await this.getServerConfig(a);if(!b)return eN.warn(`getServerStatus: Server ${a} not found`),{status:"error",message:`Server ${a} configuration not found. The server may have been deleted or not properly configured.`};if(b.disabled)return eN.debug(`getServerStatus: Server ${a} is disabled`),{status:"disconnected"};if("streamable"===b.transport&&b.oauthScopes&&b.oauthScopes.length>0){if(!b.oauthTokens||!b.oauthTokens.access_token)return eN.info(`getServerStatus: Server ${a} requires OAuth authentication but has no valid tokens`),{status:"requires_authentication",message:"OAuth authentication required. Click the authenticate button to complete the OAuth flow."};if(!b.oauthTokens.refresh_token&&b.oauthTokens.expires_in&&b.oauthTokens.issued_at){let c=b.oauthTokens.issued_at,d=b.oauthTokens.expires_in;if(Math.floor(Date.now()/1e3)>=c+d)return eN.info(`getServerStatus: OAuth tokens for ${a} have expired and no refresh token is available`),{status:"requires_authentication",message:"OAuth tokens have expired. Please re-authenticate."}}}let c=(this.stderrLogs.get(a)||[]).join("\n").trim(),d=this.lastConnectionError.get(a);if(this.getClient(a))return eN.info(`getServerStatus: Server ${a} is connected`),{status:"connected",stderrOutput:c||void 0};{let b=this.isStartingUp()&&!this.lastConnectionError.has(a);if(this.connectingServers.has(a)||b)return eN.info(`getServerStatus: Server ${a} is still connecting`),{status:"connecting",message:"Server is starting up. This may take a few moments."};if(c&&(c.includes("OAuth authentication required")||c.includes("invalid_token")))return eN.info(`getServerStatus: OAuth authentication error detected for ${a}`),{status:"requires_authentication",message:"OAuth authentication required. Please complete the OAuth flow.",stderrOutput:c};let e=c||d;return e?(eN.info(`getServerStatus: Using ${c?"stderr output":"persisted connection error"} as error message for ${a}`),{status:"error",message:e,stderrOutput:c||void 0}):(eN.info(`getServerStatus: No specific error details available for ${a}`),{status:"error",message:`Server ${a} is configured but not connected. The server process may have crashed or been terminated.`,stderrOutput:void 0})}}async startEnabledServers(){eN.info("Starting all enabled servers"),this.setStartingUp(!0);try{await this.clearRetryTimersForDisabledServers();let a=await this.loadServerConfigs();if(!Array.isArray(a))return void eN.warn("Failed to load server configs, cannot start servers");let b=a.filter(a=>!a.disabled);eN.info(`Found ${b.length} enabled servers to start`),eN.debug(`${b}`),b.forEach(a=>this.connectingServers.add(a.name)),await Promise.all(b.map(a=>(eN.info(`Starting server: ${a.name}`),this.connectServer(a).catch(b=>{eN.error(`Failed to start server ${a.name}:`,b)}))))}finally{this.setStartingUp(!1)}}async getAvailableClients(){try{let a=await this.loadServerConfigs();if(!a||"error"in a)return eN.warn("getAvailableClients: Failed to load server configs:",a?.error),[];return(await Promise.all(a.map(async a=>{try{let b=await this.getServerStatus(a.name);return{name:a.name,status:"string"==typeof b?b:b.status,connected:"string"==typeof b?"connected"===b:"connected"===b.status}}catch(b){return eN.warn(`getAvailableClients: Error getting status for ${a.name}:`,b),{name:a.name,status:"error",connected:!1}}}))).map(a=>`${a.name} (${a.status})`)}catch(a){return eN.error("getAvailableClients: Error getting available clients:",a),[]}}constructor(){this.stderrLogs=new Map,this.lastConnectionError=new Map,this.inFlightConnects=new Map,this.connectionRetryTimers=new Map,this.connectionRetryAttempts=new Map}}let eP=new eO},99925:(a,b,c)=>{"use strict";let d=c(67729),e=c(97161),f=c(24860),g=e.implSymbol;function h(b){if(!this||this[g]||!(this instanceof h))throw TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");if(arguments.length<1)throw TypeError("Failed to construct 'URL': 1 argument required, but only "+arguments.length+" present.");let c=[];for(let a=0;a<arguments.length&&a<2;++a)c[a]=arguments[a];c[0]=d.USVString(c[0]),void 0!==c[1]&&(c[1]=d.USVString(c[1])),a.exports.setup(this,c)}h.prototype.toJSON=function(){if(!this||!a.exports.is(this))throw TypeError("Illegal invocation");let b=[];for(let a=0;a<arguments.length&&a<0;++a)b[a]=arguments[a];return this[g].toJSON.apply(this[g],b)},Object.defineProperty(h.prototype,"href",{get(){return this[g].href},set(a){a=d.USVString(a),this[g].href=a},enumerable:!0,configurable:!0}),h.prototype.toString=function(){if(!this||!a.exports.is(this))throw TypeError("Illegal invocation");return this.href},Object.defineProperty(h.prototype,"origin",{get(){return this[g].origin},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"protocol",{get(){return this[g].protocol},set(a){a=d.USVString(a),this[g].protocol=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"username",{get(){return this[g].username},set(a){a=d.USVString(a),this[g].username=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"password",{get(){return this[g].password},set(a){a=d.USVString(a),this[g].password=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"host",{get(){return this[g].host},set(a){a=d.USVString(a),this[g].host=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"hostname",{get(){return this[g].hostname},set(a){a=d.USVString(a),this[g].hostname=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"port",{get(){return this[g].port},set(a){a=d.USVString(a),this[g].port=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"pathname",{get(){return this[g].pathname},set(a){a=d.USVString(a),this[g].pathname=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"search",{get(){return this[g].search},set(a){a=d.USVString(a),this[g].search=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"hash",{get(){return this[g].hash},set(a){a=d.USVString(a),this[g].hash=a},enumerable:!0,configurable:!0}),a.exports={is:a=>!!a&&a[g]instanceof f.implementation,create(a,b){let c=Object.create(h.prototype);return this.setup(c,a,b),c},setup(a,b,c){c||(c={}),c.wrapper=a,a[g]=new f.implementation(b,c),a[g][e.wrapperSymbol]=a},interface:h,expose:{Window:{URL:h},Worker:{URL:h}}}}};
|
|
154
|
+
`&&d++}}return[b,c]}(`${f}${b}`);for(let a of c)k(a);f=d,g=!1},reset:function(a={}){f&&a.consume&&k(f),g=!0,h=void 0,i="",j="",f=""}}}class dL extends TransformStream{constructor({onError:a,onRetry:b,onComment:c}={}){let d;super({start(e){d=dK({onEvent:a=>{e.enqueue(a)},onError(b){"terminate"===a?e.error(b):"function"==typeof a&&a(b)},onRetry:b,onComment:c})},transform(a){d.feed(a)}})}}let dM={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class dN extends Error{constructor(a,b){super(`Streamable HTTP error: ${b}`),this.code=a}}class dO{constructor(a,b){this._hasCompletedAuthFlow=!1,this._url=a,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=b?.requestInit,this._authProvider=b?.authProvider,this._fetch=b?.fetch,this._fetchWithInit=cM(b?.fetch,b?.requestInit),this._sessionId=b?.sessionId,this._reconnectionOptions=b?.reconnectionOptions??dM}async _authThenStart(){let a;if(!this._authProvider)throw new dn("No auth provider");try{a=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw this.onerror?.(a),a}if("AUTHORIZED"!==a)throw new dn;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let a={};if(this._authProvider){let b=await this._authProvider.tokens();b&&(a.Authorization=`Bearer ${b.access_token}`)}this._sessionId&&(a["mcp-session-id"]=this._sessionId),this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);let b=cL(this._requestInit?.headers);return new Headers({...a,...b})}async _startOrAuthSse(a){let{resumptionToken:b}=a;try{let c=await this._commonHeaders();c.set("Accept","text/event-stream"),b&&c.set("last-event-id",b);let d=await (this._fetch??fetch)(this._url,{method:"GET",headers:c,signal:this._abortController?.signal});if(!d.ok){if(await d.body?.cancel(),401===d.status&&this._authProvider)return await this._authThenStart();if(405===d.status)return;throw new dN(d.status,`Failed to open SSE stream: ${d.statusText}`)}this._handleSseStream(d.body,a,!0)}catch(a){throw this.onerror?.(a),a}}_getNextReconnectionDelay(a){if(void 0!==this._serverRetryMs)return this._serverRetryMs;let b=this._reconnectionOptions.initialReconnectionDelay;return Math.min(b*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,a),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(a,b=0){let c=this._reconnectionOptions.maxRetries;if(b>=c)return void this.onerror?.(Error(`Maximum reconnection attempts (${c}) exceeded.`));let d=this._getNextReconnectionDelay(b);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(a).catch(c=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${c instanceof Error?c.message:String(c)}`)),this._scheduleReconnection(a,b+1)})},d)}_handleSseStream(a,b,c){let d;if(!a)return;let{onresumptiontoken:e,replayMessageId:f}=b,g=!1,h=!1;(async()=>{try{let b=a.pipeThrough(new TextDecoderStream).pipeThrough(new dL({onRetry:a=>{this._serverRetryMs=a}})).getReader();for(;;){let{value:a,done:c}=await b.read();if(c)break;if((a.id&&(d=a.id,g=!0,e?.(a.id)),a.data)&&(!a.event||"message"===a.event))try{let b=F.parse(JSON.parse(a.data));D(b)&&(h=!0,void 0!==f&&(b.id=f)),this.onmessage?.(b)}catch(a){this.onerror?.(a)}}(c||g)&&!h&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:d,onresumptiontoken:e,replayMessageId:f},0)}catch(a){if(this.onerror?.(Error(`SSE stream disconnected: ${a}`)),(c||g)&&!h&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:d,onresumptiontoken:e,replayMessageId:f},0)}catch(a){this.onerror?.(Error(`Failed to reconnect: ${a instanceof Error?a.message:String(a)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(a){if(!this._authProvider)throw new dn("No auth provider");if("AUTHORIZED"!==await ds(this._authProvider,{serverUrl:this._url,authorizationCode:a,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new dn("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(a,b){try{let{resumptionToken:c,onresumptiontoken:d}=b||{};if(c)return void this._startOrAuthSse({resumptionToken:c,replayMessageId:A(a)?a.id:void 0}).catch(a=>this.onerror?.(a));let e=await this._commonHeaders();e.set("content-type","application/json"),e.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:e,body:JSON.stringify(a),signal:this._abortController?.signal},g=await (this._fetch??fetch)(this._url,f),h=g.headers.get("mcp-session-id");if(h&&(this._sessionId=h),!g.ok){let b=await g.text().catch(()=>null);if(401===g.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new dN(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:b,scope:c}=dv(g);this._resourceMetadataUrl=b,this._scope=c;let d=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==d)throw new dn;return this._hasCompletedAuthFlow=!0,this.send(a)}if(403===g.status&&this._authProvider){let{resourceMetadataUrl:b,scope:c,error:d}=dv(g);if("insufficient_scope"===d){let d=g.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===d)throw new dN(403,"Server returned 403 after trying upscoping");c&&(this._scope=c),b&&(this._resourceMetadataUrl=b),this._lastUpscopingHeader=d??void 0;let e=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch});if("AUTHORIZED"!==e)throw new dn;return this.send(a)}}throw new dN(g.status,`Error POSTing to endpoint: ${b}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===g.status){await g.body?.cancel(),W.safeParse(a).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(a=>this.onerror?.(a));return}let i=(Array.isArray(a)?a:[a]).filter(a=>"method"in a&&"id"in a&&void 0!==a.id).length>0,j=g.headers.get("content-type");if(i)if(j?.includes("text/event-stream"))this._handleSseStream(g.body,{onresumptiontoken:d},!1);else if(j?.includes("application/json")){let a=await g.json();for(let b of Array.isArray(a)?a.map(a=>F.parse(a)):[F.parse(a)])this.onmessage?.(b)}else throw await g.body?.cancel(),new dN(-1,`Unexpected content type: ${j}`);else await g.body?.cancel()}catch(a){throw this.onerror?.(a),a}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let a=await this._commonHeaders(),b={...this._requestInit,method:"DELETE",headers:a,signal:this._abortController?.signal},c=await (this._fetch??fetch)(this._url,b);if(await c.body?.cancel(),!c.ok&&405!==c.status)throw new dN(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(a){throw this.onerror?.(a),a}}setProtocolVersion(a){this._protocolVersion=a}get protocolVersion(){return this._protocolVersion}async resumeStream(a,b){await this._startOrAuthSse({resumptionToken:a,onresumptiontoken:b?.onresumptiontoken})}}class dP extends Event{constructor(a,b){var c,d;super(a),this.code=null!=(c=null==b?void 0:b.code)?c:void 0,this.message=null!=(d=null==b?void 0:b.message)?d:void 0}[Symbol.for("nodejs.util.inspect.custom")](a,b,c){return c(dQ(this),b)}[Symbol.for("Deno.customInspect")](a,b){return a(dQ(this),b)}}function dQ(a){return{type:a.type,message:a.message,code:a.code,defaultPrevented:a.defaultPrevented,cancelable:a.cancelable,timeStamp:a.timeStamp}}var dR,dS,dT,dU,dV,dW,dX,dY,dZ,d$,d_,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,ea,eb,ec,ed,ee=a=>{throw TypeError(a)},ef=(a,b,c)=>b.has(a)||ee("Cannot "+c),eg=(a,b,c)=>(ef(a,b,"read from private field"),c?c.call(a):b.get(a)),eh=(a,b,c)=>b.has(a)?ee("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),ei=(a,b,c,d)=>(ef(a,b,"write to private field"),b.set(a,c),c),ej=(a,b,c)=>(ef(a,b,"access private method"),c);class ek extends EventTarget{constructor(a,b){var c,d;super(),eh(this,d4),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,eh(this,dT),eh(this,dU),eh(this,dV),eh(this,dW),eh(this,dX),eh(this,dY),eh(this,dZ),eh(this,d$,null),eh(this,d_),eh(this,d0),eh(this,d1,null),eh(this,d2,null),eh(this,d3,null),eh(this,d6,async a=>{var b;eg(this,d0).reset();let{body:c,redirected:d,status:e,headers:f}=a;if(204===e){ej(this,d4,eb).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(d?ei(this,dV,new URL(a.url)):ei(this,dV,void 0),200!==e)return void ej(this,d4,eb).call(this,`Non-200 status code (${e})`,e);if(!(f.get("content-type")||"").startsWith("text/event-stream"))return void ej(this,d4,eb).call(this,'Invalid content type, expected "text/event-stream"',e);if(eg(this,dT)===this.CLOSED)return;ei(this,dT,this.OPEN);let g=new Event("open");if(null==(b=eg(this,d3))||b.call(this,g),this.dispatchEvent(g),"object"!=typeof c||!c||!("getReader"in c)){ej(this,d4,eb).call(this,"Invalid response body, expected a web ReadableStream",e),this.close();return}let h=new TextDecoder,i=c.getReader(),j=!0;do{let{done:a,value:b}=await i.read();b&&eg(this,d0).feed(h.decode(b,{stream:!a})),a&&(j=!1,eg(this,d0).reset(),ej(this,d4,ec).call(this))}while(j)}),eh(this,d7,a=>{ei(this,d_,void 0),"AbortError"!==a.name&&"aborted"!==a.type&&ej(this,d4,ec).call(this,function a(b){return b instanceof Error?"errors"in b&&Array.isArray(b.errors)?b.errors.map(a).join(", "):"cause"in b&&b.cause instanceof Error?`${b}: ${a(b.cause)}`:b.message:`${b}`}(a))}),eh(this,d9,a=>{"string"==typeof a.id&&ei(this,d$,a.id);let b=new MessageEvent(a.event||"message",{data:a.data,origin:eg(this,dV)?eg(this,dV).origin:eg(this,dU).origin,lastEventId:a.id||""});eg(this,d2)&&(!a.event||"message"===a.event)&&eg(this,d2).call(this,b),this.dispatchEvent(b)}),eh(this,ea,a=>{ei(this,dY,a)}),eh(this,ed,()=>{ei(this,dZ,void 0),eg(this,dT)===this.CONNECTING&&ej(this,d4,d5).call(this)});try{if(a instanceof URL)ei(this,dU,a);else if("string"==typeof a)ei(this,dU,new URL(a,function(){let a="document"in globalThis?globalThis.document:void 0;return a&&"object"==typeof a&&"baseURI"in a&&"string"==typeof a.baseURI?a.baseURI:void 0}()));else throw Error("Invalid URL")}catch{throw function(a){let b=globalThis.DOMException;return"function"==typeof b?new b(a,"SyntaxError"):SyntaxError(a)}("An invalid or illegal string was specified")}ei(this,d0,dK({onEvent:eg(this,d9),onRetry:eg(this,ea)})),ei(this,dT,this.CONNECTING),ei(this,dY,3e3),ei(this,dX,null!=(c=null==b?void 0:b.fetch)?c:globalThis.fetch),ei(this,dW,null!=(d=null==b?void 0:b.withCredentials)&&d),ej(this,d4,d5).call(this)}get readyState(){return eg(this,dT)}get url(){return eg(this,dU).href}get withCredentials(){return eg(this,dW)}get onerror(){return eg(this,d1)}set onerror(a){ei(this,d1,a)}get onmessage(){return eg(this,d2)}set onmessage(a){ei(this,d2,a)}get onopen(){return eg(this,d3)}set onopen(a){ei(this,d3,a)}addEventListener(a,b,c){super.addEventListener(a,b,c)}removeEventListener(a,b,c){super.removeEventListener(a,b,c)}close(){eg(this,dZ)&&clearTimeout(eg(this,dZ)),eg(this,dT)!==this.CLOSED&&(eg(this,d_)&&eg(this,d_).abort(),ei(this,dT,this.CLOSED),ei(this,d_,void 0))}}dT=new WeakMap,dU=new WeakMap,dV=new WeakMap,dW=new WeakMap,dX=new WeakMap,dY=new WeakMap,dZ=new WeakMap,d$=new WeakMap,d_=new WeakMap,d0=new WeakMap,d1=new WeakMap,d2=new WeakMap,d3=new WeakMap,d4=new WeakSet,d5=function(){ei(this,dT,this.CONNECTING),ei(this,d_,new AbortController),eg(this,dX)(eg(this,dU),ej(this,d4,d8).call(this)).then(eg(this,d6)).catch(eg(this,d7))},d6=new WeakMap,d7=new WeakMap,d8=function(){var a;let b={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...eg(this,d$)?{"Last-Event-ID":eg(this,d$)}:void 0},cache:"no-store",signal:null==(a=eg(this,d_))?void 0:a.signal};return"window"in globalThis&&(b.credentials=this.withCredentials?"include":"same-origin"),b},d9=new WeakMap,ea=new WeakMap,eb=function(a,b){var c;eg(this,dT)!==this.CLOSED&&ei(this,dT,this.CLOSED);let d=new dP("error",{code:b,message:a});null==(c=eg(this,d1))||c.call(this,d),this.dispatchEvent(d)},ec=function(a,b){var c;if(eg(this,dT)===this.CLOSED)return;ei(this,dT,this.CONNECTING);let d=new dP("error",{code:b,message:a});null==(c=eg(this,d1))||c.call(this,d),this.dispatchEvent(d),ei(this,dZ,setTimeout(eg(this,ed),eg(this,dY)))},ed=new WeakMap,ek.CONNECTING=0,ek.OPEN=1,ek.CLOSED=2;class el extends Error{constructor(a,b,c){super(`SSE error: ${b}`),this.code=a,this.event=c}}class em{constructor(a,b){this._url=a,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=b?.eventSourceInit,this._requestInit=b?.requestInit,this._authProvider=b?.authProvider,this._fetch=b?.fetch,this._fetchWithInit=cM(b?.fetch,b?.requestInit)}async _authThenStart(){let a;if(!this._authProvider)throw new dn("No auth provider");try{a=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw this.onerror?.(a),a}if("AUTHORIZED"!==a)throw new dn;return await this._startOrAuth()}async _commonHeaders(){let a={};if(this._authProvider){let b=await this._authProvider.tokens();b&&(a.Authorization=`Bearer ${b.access_token}`)}this._protocolVersion&&(a["mcp-protocol-version"]=this._protocolVersion);let b=cL(this._requestInit?.headers);return new Headers({...a,...b})}_startOrAuth(){let a=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((b,c)=>{this._eventSource=new ek(this._url.href,{...this._eventSourceInit,fetch:async(b,c)=>{let d=await this._commonHeaders();d.set("Accept","text/event-stream");let e=await a(b,{...c,headers:d});if(401===e.status&&e.headers.has("www-authenticate")){let{resourceMetadataUrl:a,scope:b}=dv(e);this._resourceMetadataUrl=a,this._scope=b}return e}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{if(401===a.code&&this._authProvider)return void this._authThenStart().then(b,c);let d=new el(a.code,a.message,a);c(d),this.onerror?.(d)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{try{if(this._endpoint=new URL(a.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){c(a),this.onerror?.(a),this.close();return}b()}),this._eventSource.onmessage=a=>{let b;try{b=F.parse(JSON.parse(a.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(b)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(a){if(!this._authProvider)throw new dn("No auth provider");if("AUTHORIZED"!==await ds(this._authProvider,{serverUrl:this._url,authorizationCode:a,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new dn("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(a){if(!this._endpoint)throw Error("Not connected");try{let b=await this._commonHeaders();b.set("content-type","application/json");let c={...this._requestInit,method:"POST",headers:b,body:JSON.stringify(a),signal:this._abortController?.signal},d=await (this._fetch??fetch)(this._endpoint,c);if(!d.ok){let b=await d.text().catch(()=>null);if(401===d.status&&this._authProvider){let{resourceMetadataUrl:b,scope:c}=dv(d);this._resourceMetadataUrl=b,this._scope=c;let e=await ds(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==e)throw new dn;return this.send(a)}throw Error(`Error POSTing to endpoint (HTTP ${d.status}): ${b}`)}await d.body?.cancel()}catch(a){throw this.onerror?.(a),a}}setProtocolVersion(a){this._protocolVersion=a}}let en=(0,bY.h)("backend/services/mcp/oauth");class eo{constructor(a,b){this.config=a,this._redirectUrl=b,this._clientMetadata={redirect_uris:[b],client_name:`FLUJO MCP Client - ${a.name}`,client_uri:"https://github.com/mario-andreschak/FLUJO",grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"client_secret_post",scope:a.oauthScopes?.join(" ")||"read"},en.info(`Created OAuth client provider for ${a.name}`),en.verbose("OAuth client metadata",JSON.stringify(this._clientMetadata))}get redirectUrl(){return this._redirectUrl}get clientMetadata(){return this._clientMetadata}state(){return encodeURIComponent(JSON.stringify({serverName:this.config.name}))}async clientInformation(){if(this.config.oauthClientInformation)return en.debug(`Returning stored client information for ${this.config.name}`),this.config.oauthClientInformation;if(this.config.oauthClientId){let a=this.config.oauthClientSecret?await (0,b_.G)(this.config.oauthClientSecret)??void 0:void 0;return en.debug(`Created client information from config for ${this.config.name}`),{client_id:this.config.oauthClientId,client_secret:a}}en.debug(`No client information available for ${this.config.name}`)}async persist(){let a=await (0,b$.loadServerConfigs)();if(!Array.isArray(a))return void en.warn(`persist: failed to load server configs for ${this.config.name}, cannot persist OAuth state`);let b=new Map(a.map(a=>[a.name,a]));b.set(this.config.name,this.config);let c=await (0,b$.q)(b);c.success||en.warn(`persist: failed to save OAuth state for ${this.config.name}: ${c.error}`)}async invalidateCredentials(a){en.info(`Invalidating OAuth credentials for ${this.config.name} (scope: ${a})`),("all"===a||"tokens"===a)&&(this.config.oauthTokens=void 0),("all"===a||"client"===a)&&(this.config.oauthClientInformation=void 0,this.config.oauthClientMetadata=void 0),("all"===a||"verifier"===a)&&(this.config.oauthCodeVerifier=void 0),await this.persist()}async saveClientInformation(a){en.info(`Saving client information for ${this.config.name}`),en.verbose("Client information to save",JSON.stringify(a)),this.config.oauthClientInformation={client_id:a.client_id,client_secret:a.client_secret,client_id_issued_at:a.client_id_issued_at,client_secret_expires_at:a.client_secret_expires_at},this.config.oauthClientMetadata={redirect_uris:a.redirect_uris,client_name:a.client_name,client_uri:a.client_uri,grant_types:a.grant_types,response_types:a.response_types,token_endpoint_auth_method:a.token_endpoint_auth_method,scope:a.scope,contacts:a.contacts,tos_uri:a.tos_uri,policy_uri:a.policy_uri,jwks_uri:a.jwks_uri,jwks:a.jwks,software_id:a.software_id,software_version:a.software_version},await this.persist(),en.info(`Client information saved for ${this.config.name}`)}async tokens(){if(this.config.oauthTokens){if(en.debug(`Returning stored tokens for ${this.config.name}`),this.config.oauthTokens.expires_in&&this.config.oauthTokens.issued_at){let a=this.config.oauthTokens.issued_at,b=this.config.oauthTokens.expires_in,c=Math.floor(Date.now()/1e3),d=a+b;c>=d?en.info(`Access token for ${this.config.name} has expired (issued: ${a}, expires: ${d}, current: ${c}); SDK will refresh via refresh_token`):en.debug(`Tokens for ${this.config.name} are valid (expires in ${d-c} seconds)`)}return this.config.oauthTokens}en.debug(`No tokens available for ${this.config.name}`)}async saveTokens(a){en.info(`Saving OAuth tokens for ${this.config.name}`),en.verbose("Tokens to save",JSON.stringify({...a,access_token:a.access_token?"[REDACTED]":void 0,refresh_token:a.refresh_token?"[REDACTED]":void 0}));let b={...a,issued_at:Math.floor(Date.now()/1e3)};this.config.oauthTokens=b,await this.persist(),en.info(`OAuth tokens saved for ${this.config.name}`)}async redirectToAuthorization(a){en.info(`Authorization required for ${this.config.name}`),en.info(`Authorization URL: ${a.toString()}`),this.config.authorizationUrl=a.toString();let b=Error(`OAuth authentication required for ${this.config.name}. Please complete the OAuth flow.`);throw b.name="OAuthAuthenticationRequired",b}async saveCodeVerifier(a){en.debug(`Saving code verifier for ${this.config.name}`),this.config.oauthCodeVerifier=a,await this.persist(),en.debug(`Code verifier saved for ${this.config.name}`)}async codeVerifier(){if(!this.config.oauthCodeVerifier){let a=`No code verifier found for ${this.config.name}`;throw en.error(a),Error(a)}return en.debug(`Returning code verifier for ${this.config.name}`),this.config.oauthCodeVerifier}}let ep=new Set(["node","npm","npx"]);var eq=c(79551);let er=(0,bY.h)("backend/services/mcp/roots");function es(){return global.__mcp_node_roots}function et(a){let b=[];for(let c of es().values())if(c.serverName===a)for(let a of c.roots)b.includes(a)||b.push(a);return b}async function eu(a){let b=function(a){let b=a.trim();if(!b)return null;if(b.startsWith("file://"))return b;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(b))return er.warn(`Ignoring non-file root URI: ${b}`),null;try{return(0,eq.pathToFileURL)(b).href}catch(a){return er.warn(`Could not convert root "${b}" to a file URI:`,a),null}}(await (0,b_.c)(a));return b?{uri:b,name:function(a){try{let b=new URL(a).pathname.replace(/\/+$/,"").split("/").pop();return b?decodeURIComponent(b):void 0}catch{return}}(b)}:null}async function ev(a){let b=a.roots,c=[...Array.isArray(b)?b:[],...et(a.name)],d=[],e=new Set;for(let a of c){if("string"!=typeof a||!a.trim())continue;let b=await eu(a);b&&!e.has(b.uri)&&(e.add(b.uri),d.push(b))}if(0===d.length&&"string"==typeof a.rootPath&&a.rootPath.trim()){let b=await eu(a.rootPath);if(b)return[b]}return d}async function ew(a){try{let{loadServerConfigs:b}=await Promise.resolve().then(c.bind(c,6544)),d=await b();if(Array.isArray(d)){let b=d.find(b=>b.name===a.name);if(b)return b}}catch(b){er.warn(`Could not re-load config for ${a.name}, using connect-time config:`,b)}return a}void 0===global.__mcp_node_roots&&(global.__mcp_node_roots=new Map);var ex=c(12763),ey=c(31351);let ez=(0,bY.h)("backend/services/mcp/sampling");function eA(a){return a.sampling}function eB(a){let b=eA(a);return b?.enabled?JSON.stringify({m:b.modelId,t:b.maxTokens,r:b.maxCallsPerMinute}):""}let eC=(0,bY.h)("backend/services/mcp/connection");async function eD(a){if("streamable"!==a.transport&&"sse"!==a.transport||!a.headers||"object"!=typeof a.headers)return a;let b={};for(let[c,d]of Object.entries(a.headers)){if(!c)continue;let{value:a}=cq(d,c);if(!a)continue;let e=await (0,b_.G)(a);e&&(b[c]=e)}return{...a,headers:b}}function eE(a){let b={};for(let[c,d]of Object.entries(a)){if(!c)continue;let{value:a}=cq(d,c);"string"==typeof a&&a.length>0&&(b[c]=a)}return b}function eF(a){let b={};if(a)for(let[c,d]of Object.entries(a))d&&"object"==typeof d&&"value"in d?b[c]=d.value:b[c]=d;return b}function eG(a){return JSON.stringify({command:a.command,args:a.args??[],env:eF(a.env),cwd:String(a.cwd??""),rootPath:a.rootPath??""})}function eH(a){return JSON.stringify({transport:a.transport,url:a.serverUrl??"",headers:a.headers??{},requestInit:a.requestInit??{},eventSourceInit:a.eventSourceInit??{},reconnectionOptions:a.reconnectionOptions??{},sessionId:a.sessionId??"",oauthClientId:a.oauthClientId??"",oauthClientInformation:a.oauthClientInformation??{},oauthClientSecret:a.oauthClientSecret??"",oauthTokens:a.oauthTokens??{}})}function eI(a){eC.debug("Entering createNewClient method");let b=function(a){let b=eA(a);return!!(b?.enabled&&b.modelId)}(a),c=new cJ({name:`flujo-${a.name}-client`,version:"3.17.0"},{capabilities:{experimental:{},roots:{listChanged:!0},...b?{sampling:{}}:{}}});return c.setRequestHandler(bL,async()=>{let b=await ev(await ew(a));return er.debug(`roots/list for ${a.name}: ${b.length} root(s)`),{roots:b}}),b&&function(a,b){let c=[];a.setRequestHandler(bj,async a=>{let d=eA(b);if(!d?.enabled||!d.modelId)throw new bO(dR.InvalidRequest,"Sampling is not enabled for this server");let e=d.maxCallsPerMinute??10,f=Date.now(),g=f-6e4;for(;c.length>0&&c[0]<g;)c.shift();if(c.length>=e)throw ez.warn(`Sampling rate limit (${e}/min) hit for ${b.name}`),new bO(dR.InvalidRequest,`Sampling rate limit of ${e}/min exceeded`);c.push(f);let h=await ex.modelService.getModel(d.modelId);if(!h)throw new bO(dR.InternalError,`Sampling model not found: ${d.modelId}`);let i=await ex.modelService.resolveAndDecryptApiKey(h.ApiKey);if(!i)throw new bO(dR.InternalError,"Could not resolve the sampling model API key");let j=a.params,k=function(a){let b=[];for(let c of(a.systemPrompt&&b.push({role:"system",content:a.systemPrompt}),a.messages||[])){let a=c.content,d=a?.type==="text"&&"string"==typeof a.text?a.text:`[unsupported ${a?.type||"non-text"} content omitted]`;b.push({role:c.role,content:d})}return b}(j),l="number"==typeof j.temperature?j.temperature:.7;ez.info(`Sampling for ${b.name} via model ${h.name} (${k.length} messages)`);let m=(0,ey.getCompletionAdapter)(h),{completion:n}=await m.createCompletion({model:h,apiKey:i,messages:k,temperature:l}),o=n.choices?.[0]?.message?.content;return{role:"assistant",content:{type:"text",text:"string"==typeof o?o:""},model:h.name,stopReason:"endTurn"}})}(c,a),c.__flujoCapKey=eB(a),c}function eJ(a){if(eC.debug("Entering createTransport method"),"streamable"===a.transport){eC.info(`Creating streamable http transport for server ${a.name} with URL ${a.serverUrl}`);let b={};if(a.requestInit&&"object"==typeof a.requestInit&&(b.requestInit=a.requestInit),a.reconnectionOptions&&"object"==typeof a.reconnectionOptions&&(b.reconnectionOptions=a.reconnectionOptions),"string"==typeof a.sessionId&&a.sessionId.length>0&&(b.sessionId=a.sessionId),a.headers&&"object"==typeof a.headers){let c=eE(a.headers);Object.keys(c).length>0&&(b.requestInit={...b.requestInit||{},headers:{...b.requestInit?.headers||{},...c}},eC.info(`Applied ${Object.keys(c).length} custom header(s) for ${a.name}: ${Object.keys(c).join(", ")}`))}a.oauthClientId||a.oauthClientInformation?(eC.info(`Setting up OAuth authentication for ${a.name}`),b.authProvider=function(a,b="http://localhost:4200/api/oauth/callback"){return new eo(a,b)}(a),a.oauthTokens?.access_token?(eC.debug(`OAuth provider configured for ${a.name} with existing tokens`),eC.debug(`Token expires in: ${a.oauthTokens.expires_in} seconds`)):eC.debug(`OAuth provider configured for ${a.name} - will initiate OAuth flow if needed`)):eC.debug(`No OAuth configuration found for ${a.name}`);let c=new dO(new URL(a.serverUrl),b);return c.__flujoHttpKey=eH(a),c}if("sse"===a.transport){eC.info(`Creating legacy sse transport for server ${a.name} with URL ${a.serverUrl}`);let b={};if(a.requestInit&&"object"==typeof a.requestInit&&(b.requestInit=a.requestInit),a.eventSourceInit&&"object"==typeof a.eventSourceInit&&(b.eventSourceInit=a.eventSourceInit),a.headers&&"object"==typeof a.headers){let c=eE(a.headers);Object.keys(c).length>0&&(b.requestInit={...b.requestInit||{},headers:{...b.requestInit?.headers||{},...c}},eC.info(`Applied ${Object.keys(c).length} custom header(s) for ${a.name}: ${Object.keys(c).join(", ")}`))}let c=new em(new URL(a.serverUrl),b);return c.__flujoHttpKey=eH(a),c}return"websocket"===a.transport?(eC.info(`Creating WebSocket transport for server ${a.name} with URL ${a.websocketUrl}`),new cK(new URL(a.websocketUrl))):function(a){if(eC.debug("Entering createStdioTransport method"),"stdio"!==a.transport)throw Error("Cannot create stdio transport for non-stdio config");let b=a.command,c=a.args?[...a.args]:[],d=`${cd.VL}/${a.name}`;eC.info(`Creating stdio transport for server ${a.name}`),eC.debug(`Original command: ${b}`),eC.debug(`Original args: ${JSON.stringify(c)}`),eC.debug(`Server directory: ${d}`);let e=!bW.isAbsolute(b)&&(b.includes("/")||b.includes("\\")),f=!b.includes("/")&&!b.includes("\\");if(eC.debug(`Is relative path: ${e}`),eC.debug(`Is just filename: ${f}`),"win32"===cc.platform()&&b.toLowerCase().endsWith(".bat"))if(eC.debug(`Detected .bat file on Windows: ${b}`),f){let a=bW.join((0,bZ.ok)(),d,b);eC.debug(`Checking if file exists at: ${a}`);let e=cb.existsSync(a);eC.debug(`File exists: ${e}`),e?(eC.debug(`Using full path to .bat file: ${a}`),c=["/c",a,...c]):(eC.warn(`WARNING: .bat file not found at ${a}`),c=["/c",b,...c]),b="cmd.exe"}else eC.debug(`Using cmd.exe with path as provided: ${b}`),c=["/c",b,...c],b="cmd.exe";let g=function(a,b){if(!a||!(!a.includes("/")&&!a.includes("\\")))return a;let c=a.toLowerCase();if(!ep.has(c))return a;if("node"===c)return b.execPath||a;if(!b.execPath)return a;let d=b.dirname(b.execPath);for(let a of"win32"===b.platform?[`${c}.cmd`,`${c}.exe`,c]:[c]){let c=b.joinPath(d,a);if(b.fileExists(c))return c}return a}(b,{execPath:process.execPath,platform:cc.platform(),dirname:bW.dirname,joinPath:bW.join,fileExists:cb.existsSync});g!==b&&(eC.debug(`Resolved Node toolchain command "${b}" to absolute path: ${g}`),b=g),eC.debug(`Final command: ${b}`),eC.debug(`Final args: ${JSON.stringify(c)}`);let h=function({command:a,args:b=[],rootPath:c,cwd:d,serverName:e,defaultCwd:f}){let g=c||d||f;return e&&cu(a,b)&&(g.split(/[\\/]/).filter(Boolean).pop()||"")===e&&function(a){let b=a.match(/^(.*[\\/])[^\\/]+[\\/]*$/);return b?b[1].replace(/[\\/]+$/,""):""}(g)||g}({command:a.command,args:a.args,rootPath:a.rootPath,cwd:a.cwd,serverName:a.name,defaultCwd:`${cd.VL}/${a.name}`}),i=bW.isAbsolute(h)?h:bW.join((0,bZ.ok)(),h);eC.debug(`cwd: ${i}`),eC.debug(`env: ${JSON.stringify(a.env)}`),eC.info(`Creating StdioClientTransport for ${a.name} with stderr: 'pipe'`);let j=eF(a.env);eC.verbose("Transformed environment variables",JSON.stringify(j));let k=new bS({command:b,args:c,env:j,cwd:i,stderr:"pipe"});return k.__flujoStdioKey=eG(a),k.stderr?eC.info(`Stderr stream is available for ${a.name}`):eC.warn(`Stderr stream is NOT available for ${a.name}`),k}(a)}function eK(a,b){return null!==a.exitCode||null!==a.signalCode?Promise.resolve(!0):new Promise(c=>{let d=()=>{clearTimeout(e),c(!0)},e=setTimeout(()=>{a.removeListener("exit",d),c(!1)},b);e.unref?.(),a.once("exit",d)})}async function eL(a,b,c,d){eC.debug("Entering safelyCloseClient method");let e=d?.gracePeriodMs??15e3,f=d?.killEscalationMs??5e3;try{if(a.transport instanceof bS){let c=a.transport._process;if(c&&null===c.exitCode&&null===c.signalCode){try{c.stdin&&!c.stdin.destroyed&&(c.stdin.end(),eC.debug(`Closed stdin for graceful shutdown for ${b}`))}catch(a){eC.warn(`Error closing stdin for ${b}:`,a)}let a=await eK(c,e);if(!a){eC.warn(`Process did not exit within ${e}ms after stdin close, sending SIGTERM for ${b}`);try{c.kill("SIGTERM")}catch(a){eC.error(`Error sending SIGTERM for ${b}:`,a)}a=await eK(c,f)}if(a)eC.info(`Process exited gracefully for ${b}`);else{eC.warn(`Process did not respond to SIGTERM, sending SIGKILL for ${b}`);try{c.kill("SIGKILL")}catch(a){eC.error(`Error sending SIGKILL for ${b}:`,a)}}}}await a.close(),eC.info(`Client closed successfully for ${b}`)}catch(a){eC.warn(`Error closing client for ${b}:`,a)}}var eM=c(92018);void 0===global.__mcp_clients&&(global.__mcp_clients=new Map),void 0===global.__mcp_connecting&&(global.__mcp_connecting=new Set),void 0===global.__mcp_starting_up&&(global.__mcp_starting_up=!0),void 0===global.__mcp_active_transports&&(global.__mcp_active_transports=new Map);let eN=(0,bY.h)("backend/services/mcp/index");class eO{get clients(){return global.__mcp_clients}get connectingServers(){return global.__mcp_connecting}get activeTransports(){return global.__mcp_active_transports}static{this.MAX_STDERR_LOG_ENTRIES=200}appendStderrLog(a,b){let c=this.stderrLogs.get(a)||[];c.push(b),c.length>eO.MAX_STDERR_LOG_ENTRIES&&c.splice(0,c.length-eO.MAX_STDERR_LOG_ENTRIES),this.stderrLogs.set(a,c)}deregisterClient(a){this.clients.delete(a),this.activeTransports.delete(a)}clearRetryTimer(a){let b=this.connectionRetryTimers.get(a);b&&(clearTimeout(b),this.connectionRetryTimers.delete(a),eN.debug(`Cleared retry timer for server ${a}`))}scheduleConnectionRetry(a,b){this.clearRetryTimer(a);let c=this.connectionRetryAttempts.get(a)||0;if(c>=5){eN.warn(`Maximum retry attempts (5) reached for server ${a}, stopping retries`),this.connectionRetryAttempts.delete(a);return}let d=Math.min(5e3*Math.pow(2,c),3e5);eN.info(`Scheduling connection retry for server ${a} in ${d}ms (attempt ${c+1}/5)`);let e=setTimeout(async()=>{eN.info(`Attempting to reconnect server ${a} (attempt ${c+1}/5)`);let b=await this.getServerConfig(a);if(!b){eN.info(`Server ${a} configuration not found, stopping retry attempts`),this.connectionRetryAttempts.delete(a);return}if(b.disabled){eN.info(`Server ${a} is now disabled, stopping retry attempts`),this.connectionRetryAttempts.delete(a);return}let d=this.getClient(a);if(d)try{await d.ping({timeout:5e3}),eN.info(`Server ${a} is already connected and responsive, cancelling retry`),this.connectionRetryAttempts.delete(a);return}catch(b){eN.warn(`Server ${a} has a registered client but ping failed (${b instanceof Error?b.message:String(b)}); reconnecting from scratch`)}this.connectionRetryAttempts.set(a,c+1);try{let e=d?await this.forceReconnect(a):await this.connectServer(b);if(e.success)eN.info(`Successfully reconnected server ${a} after ${c+1} attempts`),this.connectionRetryAttempts.delete(a);else{if(eN.warn(`Failed to reconnect server ${a}: ${e.error}`),e.requiresAuthentication){eN.info(`Server ${a} requires authentication, stopping retry attempts`),this.connectionRetryAttempts.delete(a);return}this.scheduleConnectionRetry(a,b)}}catch(c){eN.error(`Error during retry connection for server ${a}:`,c),this.scheduleConnectionRetry(a,b)}},d);this.connectionRetryTimers.set(a,e)}isStartingUp(){return!0===global.__mcp_starting_up}setStartingUp(a){global.__mcp_starting_up=a,eN.info(`Backend startup state set to: ${a?"starting":"complete"}`)}getClient(a){let b=this.clients.get(a);if(b&&cf(b)){eN.warn(`getClient: client for ${a} has a closed/aborted connection — evicting it`),this.clients.delete(a);return}return eN.debug(`getClient: Looking for client: ${a}`,b?"Found":"Not found"),b}async loadServerConfigs(){eN.debug("loadServerConfigs: Entering method");try{let a=await (0,b$.loadServerConfigs)();if(!Array.isArray(a))return eN.warn("loadServerConfigs: Received non-array response",a),a;return a.some(a=>a.name===eM._)?eN.warn(`loadServerConfigs: A stored server is named "${eM._}" — it shadows FLUJO's built-in server`):a.push((0,eM.z)()),eN.debug(`loadServerConfigs: Loaded ${a.length} server configs`),a}catch(a){return eN.warn("loadServerConfigs: Failed to load server configs:",a),{success:!1,error:`Failed to load server configs: ${a instanceof Error?a.message:"Unknown error"}`}}}async getServerConfig(a){eN.debug(`getServerConfig: Looking up config for server ${a}`);let b=await this.loadServerConfigs();if(!Array.isArray(b))return eN.warn(`getServerConfig: Failed to load configs for ${a}:`,b.error),null;let c=b.find(b=>b.name===a);return c||(eN.warn(`getServerConfig: Server ${a} not found in configs`),null)}async isServerDisabled(a){let b=await this.getServerConfig(a);return b?.disabled===!0}async isInternalServer(a){if(a!==eM._)return!1;let b=await (0,b$.loadServerConfigs)();return!Array.isArray(b)||!b.some(a=>a.name===eM._)}async connectServer(a){let b="string"==typeof a?a:a.name;if(b===eM._&&("string"!=typeof a?!0===a.builtIn:await this.isInternalServer(b)))return this.connectingServers.delete(b),{success:!0};let c=this.inFlightConnects.get(b);if(c)return eN.debug(`connectServer: reusing in-flight connection attempt for ${b}`),c;let d=this.connectServerInternal(a).finally(()=>{this.inFlightConnects.delete(b)});return this.inFlightConnects.set(b,d),d}async connectServerInternal(a){let b;if("string"==typeof a){eN.info(`connectServer: Looking up config for server ${a}`);let c=await this.getServerConfig(a);if(!c)return eN.warn(`connectServer: Server ${a} not found in configs`),{success:!1,error:`Server configuration for "${a}" not found. The server may have been deleted or not properly configured.`};b=c}else b=a;if((("string"==typeof a?b:await this.getServerConfig(b.name))??b).disabled)return eN.info(`connectServer: Server ${b.name} is disabled — refusing to create a client/transport`),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name),{success:!1,error:`Server '${b.name}' is disabled. Enable it on the MCP page to use it.`};let c=(0,bT.A)();eN.info(`connectServer: Starting connection for server ${b.name} [RequestID: ${c}]`),this.connectingServers.add(b.name);try{this.stderrLogs.set(b.name,[]),b=await eD(b);let a=this.clients.get(b.name);if(a){let{needsNewClient:c,reason:d}=function(a,b){if(eC.debug("Entering shouldRecreateClient method"),cf(a))return{needsNewClient:!0,reason:"Existing connection is closed"};if((a.__flujoCapKey??"")!==eB(b))return{needsNewClient:!0,reason:"Client capabilities (sampling) changed"};if("websocket"===b.transport){if(!(a.transport instanceof cK))return{needsNewClient:!0,reason:"Transport type changed to websocket"}}else if("streamable"===b.transport){if(!(a.transport instanceof dO))return{needsNewClient:!0,reason:"Transport type changed to streamable"};let c=a.transport,d=c._url?.toString();if(void 0!==d&&d!==new URL(b.serverUrl).toString())return{needsNewClient:!0,reason:"Streamable server URL changed"};let e=c.__flujoHttpKey;if(!e)return{needsNewClient:!0,reason:"Existing streamable transport has no config key"};if(e!==eH(b))return{needsNewClient:!0,reason:"Streamable auth/connection parameters changed"}}else if("sse"===b.transport){if(!(a.transport instanceof em))return{needsNewClient:!0,reason:"Transport type changed to sse"};let c=a.transport,d=c._url?.toString();if(void 0!==d&&d!==new URL(b.serverUrl).toString())return{needsNewClient:!0,reason:"SSE server URL changed"};let e=c.__flujoHttpKey;if(!e)return{needsNewClient:!0,reason:"Existing sse transport has no config key"};if(e!==eH(b))return{needsNewClient:!0,reason:"SSE auth/connection parameters changed"}}else{if(!(a.transport instanceof bS))return{needsNewClient:!0,reason:"Transport type changed to stdio"};if("stdio"!==b.transport)return{needsNewClient:!0,reason:"Transport type changed from stdio"};let c=a.transport.__flujoStdioKey;if(!c)return{needsNewClient:!0,reason:"Existing stdio transport has no config key"};if(c!==eG(b))return{needsNewClient:!0,reason:"Connection parameters changed"}}return{needsNewClient:!1}}(a,b);if(!c)return eN.info(`connectServer: Server ${b.name} is already connected`),this.lastConnectionError.delete(b.name),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name),{success:!0};eN.info(`connectServer: Existing client for ${b.name} is stale (${d}), recreating`),this.deregisterClient(b.name);try{await eL(a,b.name,b)}catch(a){eN.debug(`connectServer: error closing stale client for ${b.name}: ${a instanceof Error?a.message:String(a)}`)}a=void 0}a=eI(b);let c=eJ(b);if(c instanceof bS&&c.stderr){let a=b.name;c.stderr.on("data",b=>{let c=b.toString();eN.warn(`stderr: [${a}]: ${c}`),this.appendStderrLog(a,c)})}return c.onclose=()=>{if(this.activeTransports.get(b.name)!==c)return void eN.debug(`connectServer: ignoring close event from a stale/deregistered transport for ${b.name}`);eN.warn(`connectServer: Connection closed for server ${b.name}`),this.deregisterClient(b.name),this.getServerConfig(b.name).then(a=>{if(!a||a.disabled)return void eN.info(`Server ${b.name} is now disabled, skipping reconnection logic`);eN.info(`Connection closed for enabled server ${b.name}, scheduling reconnection`),this.scheduleConnectionRetry(b.name,a)}).catch(a=>{eN.warn(`Error checking server config for ${b.name} during onclose:`,a)})},c.onerror=a=>{if(function(a){let b=a instanceof Error?a.message:String(a);return b.includes("SSE stream disconnected")||b.includes("Failed to reconnect SSE stream")||b.includes("Maximum reconnection attempts")||/\bterminated\b/i.test(b)}(a))return void eN.debug(`connectServer: transient SSE stream disconnect for ${b.name} (self-healing, ignored): ${a instanceof Error?a.message:String(a)}`);if(this.activeTransports.get(b.name)!==c)return void eN.debug(`connectServer: ignoring error event from a stale/deregistered transport for ${b.name}`);if(eN.error(`connectServer: Transport error for server ${b.name}:`),a instanceof Error){eN.error(`Error name: ${a.name}`),eN.error(`Error message: ${a.message}`),eN.error(`Error stack: ${a.stack}`);let b=a.code;void 0!==b&&eN.error(`Error code: ${b}`),eN.error(`Error chain: ${cj(a)}`)}else if(a&&"object"==typeof a){eN.error(`Error type: ${typeof a}`),eN.error(`Error constructor: ${a.constructor?.name||"Unknown"}`);let b=Object.getOwnPropertyNames(a);b.length>0?(eN.error(`Error properties: ${b.join(", ")}`),b.forEach(b=>{try{let c=a[b];eN.error(` ${b}: ${"function"==typeof c?"[Function]":JSON.stringify(c)}`)}catch(a){eN.error(` ${b}: [Unable to serialize: ${a}]`)}})):eN.error("Error object has no enumerable properties");try{let b=JSON.stringify(a);eN.error(`JSON stringified error: ${b}`)}catch(a){eN.error(`Cannot JSON stringify error: ${a}`)}}else eN.error(`Error value: ${String(a)} (type: ${typeof a})`);this.appendStderrLog(b.name,`Transport error: ${cj(a)}`),this.deregisterClient(b.name),this.getServerConfig(b.name).then(a=>{if(!a||a.disabled)return void eN.info(`Server ${b.name} is now disabled, skipping reconnection after transport error`);eN.info(`Transport error for enabled server ${b.name}, scheduling reconnection`),this.scheduleConnectionRetry(b.name,a)}).catch(a=>{eN.warn(`Error checking server config for ${b.name} during onerror:`,a)})},await a.connect(c),this.clients.set(b.name,a),this.activeTransports.set(b.name,c),this.lastConnectionError.delete(b.name),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name),eN.info(`connectServer: Successfully connected to ${b.name}`),{success:!0}}catch(f){eN.error(`connectServer: Failed to connect to server ${b.name}:`,f);let a=f instanceof Error?f.message:String(f),c=f instanceof Error?f.name:"";if(a.includes("OAuth authentication required")||"OAuthAuthenticationRequired"===c){if(eN.info(`OAuth authentication required for server ${b.name}`),"streamable"===b.transport){let a=b;a.authorizationUrl&&eN.info(`Authorization URL available for ${b.name}: ${a.authorizationUrl}`)}return{success:!1,error:a,requiresAuthentication:!0}}if(cm(f)){if(eN.info(`OAuth authentication error detected for server ${b.name}: ${a}`),"streamable"===b.transport){let a=b;if(!a.oauthScopes||0===a.oauthScopes.length){eN.info(`Dynamically enabling OAuth for server ${b.name} due to authentication error`);try{let c={...a,oauthScopes:["read"]},d=await this.loadServerConfigs();if(Array.isArray(d)){let a=d.findIndex(a=>a.name===b.name);-1!==a&&(d[a]=c,await (0,b$.q)(new Map(d.map(a=>[a.name,a]))),eN.info(`Updated config for ${b.name} to enable OAuth`))}}catch(a){eN.warn(`Failed to update config for ${b.name} to enable OAuth:`,a)}}}return{success:!1,error:"OAuth authentication failed or tokens have expired. Please re-authenticate.",requiresAuthentication:!0}}let d=this.stderrLogs.get(b.name)||[],e=ck(f,b,d);return this.lastConnectionError.set(b.name,e),{success:!1,error:e}}finally{this.connectingServers.delete(b.name)}}async testConnection(a,b){eN.info(`testConnection: Testing connection to ${a.name||"(unnamed)"} via ${a.transport} transport`);let c=a=>{try{b?.(a)}catch{}},d=[],e=null,f=null;try{let b,g=await eD(a);e=eI(g),(f=eJ(g))instanceof bS&&f.stderr&&f.stderr.on("data",a=>{let b=a.toString();d.push(b),c({type:"stderr",data:b})}),f.onerror=a=>{let b=`Transport error: ${cj(a)}`;d.push(b),c({type:"stderr",data:b+"\n"})},c({type:"status",phase:"spawning",message:"Starting server / opening transport..."});let h=cv(a)?9e4:15e3,i=cv(a),j=new Promise((a,c)=>{b=setTimeout(()=>c(Error(`Connection timeout after ${h/1e3}s`+(i?" — the package may still be downloading via npx/uvx. Try running the Test again (the package is cached after the first download), or verify the command and network access.":""))),h)});c({type:"status",phase:"handshaking",message:"Performing MCP handshake..."});try{await Promise.race([e.connect(f),j])}finally{b&&clearTimeout(b)}c({type:"status",phase:"listing-tools",message:"Handshake OK — listing tools..."});let k=0;try{let a=await e.listTools();k=Array.isArray(a?.tools)?a.tools.length:0}catch(b){eN.debug(`testConnection: connected to ${a.name} but listTools failed: ${b instanceof Error?b.message:String(b)}`)}return eN.info(`testConnection: Successfully connected to ${a.name} (${k} tools)`),c({type:"result",success:!0,data:{toolCount:k}}),{success:!0,data:{toolCount:k}}}catch(f){eN.warn(`testConnection: Failed to connect to ${a.name}:`,f);let b=cm(f),e=ck(f,a,d);return c({type:"result",success:!1,error:e,requiresAuthentication:b}),{success:!1,error:e,requiresAuthentication:b}}finally{if(e)try{await eL(e,a.name,a,{gracePeriodMs:3e3,killEscalationMs:2e3})}catch(b){eN.debug(`testConnection: error closing test client for ${a.name}: ${b instanceof Error?b.message:String(b)}`)}}}setNodeRoots(a,b,c){for(let d of function(a,b,c){let d=(c??[]).filter(a=>"string"==typeof a&&a.trim().length>0),e=es().get(b),f=new Set([a]);e&&f.add(e.serverName);let g=new Map;for(let a of f)g.set(a,et(a));0===d.length?es().delete(b)&&er.debug(`Cleared node roots for node ${b}`):(es().set(b,{serverName:a,roots:d}),er.debug(`Registered ${d.length} node root(s) for node ${b} on server ${a}`));let h=[];for(let a of f){let b=et(a),c=g.get(a)??[];(b.length!==c.length||b.some((a,b)=>a!==c[b]))&&h.push(a)}return h}(a,b,c))this.notifyRootsChanged(d)}notifyRootsChanged(a){let b=this.getClient(a);if(!b)return void eN.debug(`notifyRootsChanged: ${a} not connected, skipping notification`);try{b.sendRootsListChanged().catch(b=>{eN.warn(`notifyRootsChanged: failed to notify ${a}:`,b)}),eN.debug(`notifyRootsChanged: sent roots/list_changed to ${a}`)}catch(b){eN.warn(`notifyRootsChanged: failed to notify ${a}:`,b)}}async disconnectServer(a){if(eN.debug(`disconnectServer: Entering method for server ${a}`),await this.isInternalServer(a))return{success:!0};this.clearRetryTimer(a),this.connectionRetryAttempts.delete(a);let b=this.getClient(a);if(!b)return eN.warn(`disconnectServer: Server ${a} not found in clients map`),this.deregisterClient(a),{success:!1,error:`Server ${a} not found`};this.deregisterClient(a);try{let c=await this.getServerConfig(a);return await eL(b,a,c||void 0),eN.info(`disconnectServer: Disconnected server ${a}`),{success:!0}}catch(b){return eN.warn(`disconnectServer: Failed to disconnect server ${a}:`,b),{success:!1,error:`Failed to disconnect server: ${b instanceof Error?b.message:"Unknown error"}`}}}async forceReconnect(a){if(eN.info(`forceReconnect: Forcing fresh connection for server ${a}`),await this.isInternalServer(a))return{success:!0};let b=this.clients.get(a);if(b){this.deregisterClient(a);let c=await this.getServerConfig(a);try{await eL(b,a,c||void 0)}catch(b){eN.debug(`forceReconnect: error closing stale client for ${a}: ${b instanceof Error?b.message:String(b)}`)}}return this.connectServer(a)}async listServerTools(a){if(eN.debug(`listServerTools: Entering method for server ${a}`),await this.isInternalServer(a)){let{internalToolDefinitions:a}=await Promise.all([c.e(3304),c.e(6936),c.e(3370)]).then(c.bind(c,3370));return{tools:a()}}if(await this.isServerDisabled(a)){let b=`Server '${a}' is disabled. Enable it on the MCP page to use it.`;return eN.warn(`listServerTools: ${b}`),{tools:[],error:b}}let b=this.getClient(a);b||eN.warn(`listServerTools: Client not found for ${a}`);let d=await b2(b,a);if(d.error){eN.warn(`listServerTools: Listing tools for ${a} failed (${d.error}); forcing reconnect and retrying once`);let c=await this.forceReconnect(a);if(!c.success)return eN.warn(`listServerTools: Reconnect for ${a} failed: ${c.error}`),{tools:[],error:c.error||d.error};b=this.clients.get(a),(d=await b2(b,a)).error?eN.warn(`listServerTools: Retry after reconnect still failed for ${a}:`,d.error):eN.info(`listServerTools: Recovered after reconnect for ${a}; listed ${d.tools.length} tools`)}else eN.info(`listServerTools: Listed ${d.tools.length} tools for ${a}`);return d}async callTool(a,b,d,e,f){if(eN.debug(`callTool: Entering method for server ${a}, tool ${b}`),await this.isInternalServer(a)){let{internalCallTool:a}=await Promise.all([c.e(3304),c.e(6936),c.e(3370)]).then(c.bind(c,3370)),e=await a(this,b,d);return eN.info(`callTool: Dispatched internal tool ${b}`),{success:!0,data:e}}if(await this.isServerDisabled(a)){let b=`Server '${a}' is disabled. Enable it on the MCP page to use it.`;return eN.warn(`callTool: ${b}`),{success:!1,error:b}}let g=this.getClient(a);if(!g){eN.warn(`callTool: No client for ${a}; forcing reconnect before calling ${b}`);let c=await this.forceReconnect(a);c.success?g=this.clients.get(a):eN.warn(`callTool: Reconnect for ${a} failed: ${c.error}`)}let h=await b3(g,a,b,d,e,f);return eN.info(`callTool: Called tool ${b} on ${a}`),h}async listWithReconnect(a,b,c){if(await this.isInternalServer(a))return c;if(await this.isServerDisabled(a)){let b=`Server '${a}' is disabled. Enable it on the MCP page to use it.`;return eN.warn(`listWithReconnect: ${b}`),{...c,error:b}}let d=this.getClient(a);d||eN.warn(`listWithReconnect: Client not found for ${a}`);let e=await b(d,a);if(!e.error)return e;eN.warn(`listWithReconnect: Listing for ${a} failed (${e.error}); forcing reconnect and retrying once`);let f=await this.forceReconnect(a);return f.success?(d=this.clients.get(a),(e=await b(d,a)).error?eN.warn(`listWithReconnect: Retry after reconnect still failed for ${a}:`,e.error):eN.info(`listWithReconnect: Recovered after reconnect for ${a}`),e):(eN.warn(`listWithReconnect: Reconnect for ${a} failed: ${f.error}`),{...c,error:f.error||e.error})}async listServerResources(a){return eN.debug(`listServerResources: Entering method for server ${a}`),this.listWithReconnect(a,b5,{resources:[]})}async listServerResourceTemplates(a){return eN.debug(`listServerResourceTemplates: Entering method for server ${a}`),this.listWithReconnect(a,b6,{resourceTemplates:[]})}async readResource(a,b){eN.debug(`readResource: Entering method for server ${a}, uri ${b}`);let c=this.getClient(a);c||eN.warn(`readResource: Client not found for ${a}`);let d=await b7(c,a,b);return eN.info(`readResource: Read resource ${b} on ${a}`),d}async listServerPrompts(a){return eN.debug(`listServerPrompts: Entering method for server ${a}`),this.listWithReconnect(a,b9,{prompts:[]})}async getPrompt(a,b,c){eN.debug(`getPrompt: Entering method for server ${a}, prompt ${b}`);let d=this.getClient(a);d||eN.warn(`getPrompt: Client not found for ${a}`);let e=await ca(d,a,b,c);return eN.info(`getPrompt: Got prompt ${b} on ${a}`),e}async resolveOAuthSecretForSave(a,b){return a===co.RJ?b??"":a?a.startsWith("${global:")||a.startsWith("encrypted:")||a.startsWith("encrypted_failed:")?a:await (0,cn.Rs)(a):""}async resolveHeadersForSave(a,b){let c={};for(let[d,e]of Object.entries(a||{})){if(!d)continue;let{value:a,isSecret:f}=cq(e,d);if(!f){""!==a&&(c[d]={value:a,metadata:{isSecret:!1}});continue}if(a===co.RJ||a===co.gF){let a=b?.[d];void 0!==a&&(c[d]=a);continue}if(a){if("string"==typeof a&&a.startsWith("${global:")||a.startsWith("encrypted:")||a.startsWith("encrypted_failed:")){c[d]={value:a,metadata:{isSecret:!0}};continue}c[d]={value:await (0,cn.Rs)(a),metadata:{isSecret:!0}}}}return c}async ensureRemoteServerRootDir(a){try{if(!["streamable","sse","websocket"].includes(a.transport))return;let b=(a.rootPath||"").trim();if(!b)return;let c=bX().resolve((0,bZ.ok)(),b);if(bX().dirname(c)===c)return;await bV().mkdir(c,{recursive:!0}),eN.debug(`ensureRemoteServerRootDir: ensured ${c} for ${a.name}`)}catch(b){eN.warn(`ensureRemoteServerRootDir: could not create root dir for ${a.name}:`,b)}}async updateServerConfig(a,b){if(eN.debug(`updateServerConfig: Entering method for server ${a}`),await this.isInternalServer(a))return{success:!1,error:`"${eM._}" is FLUJO's built-in server and cannot be created or edited.`};let c=await this.loadServerConfigs();if(!Array.isArray(c))return eN.warn("updateServerConfig: Failed to load configs:",c.error),c;let d=c.find(b=>b.name===a),e=!!d&&"string"==typeof b.name&&b.name!==a;if(e&&c.some(a=>a.name===b.name))return eN.warn(`updateServerConfig: Refusing to rename ${a} -> ${b.name}: name already in use`),{success:!1,error:`A server named "${b.name}" already exists`};if(!d&&b.name)eN.info(`updateServerConfig: Creating new server config for ${b.name}`),d={name:b.name,transport:"stdio",command:"",args:[],env:{},disabled:!1,autoApprove:[],_buildCommand:"",_installCommand:"",rootPath:""},c.push(d);else if(!d)return eN.warn(`updateServerConfig: Server ${a} not found`),{success:!1,error:`Server ${a} not found`};if(b.env){eN.debug(`updateServerConfig: Resolving global variables in env for ${a}`);try{eN.debug(`Original env variables for ${a}:`,JSON.stringify(b.env,null,2)),b.env=await (0,b_.c)(b.env),eN.debug(`Resolved env variables for ${a}:`,JSON.stringify(b.env,null,2)),eN.debug(`updateServerConfig: Successfully resolved global variables for ${a}`)}catch(b){eN.warn(`updateServerConfig: Error resolving global variables for ${a}:`,b)}}let f=b.oauthClientSecret;if(void 0!==f){let a=d.oauthClientSecret;b.oauthClientSecret=await this.resolveOAuthSecretForSave(f,a)}let g=b.headers;if(void 0!==g){let a=d.headers;b.headers=await this.resolveHeadersForSave(g,a)}let h={...d};h={...d,...b};let i=JSON.stringify(d.roots??[])!==JSON.stringify(h.roots??[])||(d.rootPath??"")!==(h.rootPath??""),j=c.findIndex(b=>b.name===a);-1!==j?c[j]=h:h.name&&c.push(h);let k=await (0,b$.q)(new Map(c.map(a=>[a.name,a])));return k.success?(await this.ensureRemoteServerRootDir(h),e?(this.clients.has(a)?await this.disconnectServer(a):(this.clearRetryTimer(a),this.connectionRetryAttempts.delete(a)),this.stderrLogs.delete(a),this.lastConnectionError.delete(a),await this.handleConnectionStateChange(h.name,h)):await this.handleConnectionStateChange(a,h),i&&this.notifyRootsChanged(h.name),eN.info(`updateServerConfig: Successfully updated config for ${a}${e?` (renamed to ${h.name})`:""}`),h):(eN.warn(`updateServerConfig: Failed to save config for ${a}:`,k.error),k)}async handleConnectionStateChange(a,b){eN.debug(`handleConnectionStateChange: Entering method for server ${a}`);let c=!!this.getClient(a),d=!b.disabled;if(c&&!d){eN.info(`handleConnectionStateChange: Disconnecting disabled server ${a}`);try{await this.disconnectServer(a)}catch(b){eN.warn(`handleConnectionStateChange: Failed to disconnect server ${a} during update:`,b)}}else!c&&d?(eN.info(`handleConnectionStateChange: Connecting previously disabled server ${a}`),await this.connectServer(b)):c&&d?(eN.info(`handleConnectionStateChange: Re-applying config to connected server ${a}`),await this.connectServer(b)):d||(eN.info(`handleConnectionStateChange: Clearing retry timers for disabled server ${a}`),this.clearRetryTimer(a),this.connectionRetryAttempts.delete(a))}async clearRetryTimersForDisabledServers(){eN.debug("clearRetryTimersForDisabledServers: Checking for disabled servers with active retry timers");try{let a=await this.loadServerConfigs();if(!Array.isArray(a))return void eN.warn("clearRetryTimersForDisabledServers: Failed to load server configs");for(let b of a.filter(a=>a.disabled))this.connectionRetryTimers.has(b.name)&&(eN.info(`clearRetryTimersForDisabledServers: Clearing retry timer for disabled server ${b.name}`),this.clearRetryTimer(b.name),this.connectionRetryAttempts.delete(b.name))}catch(a){eN.error("clearRetryTimersForDisabledServers: Error clearing retry timers:",a)}}async deleteServerConfig(a){if(eN.debug(`deleteServerConfig: Entering method for server ${a}`),await this.isInternalServer(a))return{success:!1,error:`"${eM._}" is FLUJO's built-in server and cannot be deleted.`};this.clients.has(a)&&(eN.info(`deleteServerConfig: Disconnecting server ${a} before deletion`),await this.disconnectServer(a));let b=await this.loadServerConfigs();if(!Array.isArray(b))return eN.warn("deleteServerConfig: Failed to load configs:",b.error),b;let c=b.findIndex(b=>b.name===a);if(-1===c)return eN.warn(`deleteServerConfig: Server ${a} not found in configs`),{success:!1,error:`Server ${a} not found`};b.splice(c,1),eN.debug(`deleteServerConfig: Saving updated configs after deleting ${a}`);let d=await (0,b$.q)(new Map(b.map(a=>[a.name,a])));return d.success?eN.info(`deleteServerConfig: Successfully deleted server ${a}`):eN.warn(`deleteServerConfig: Error saving configs after deleting ${a}:`,d.error),d}async getServerStatus(a){if(await this.isInternalServer(a))return{status:"connected"};let b=await this.getServerConfig(a);if(!b)return eN.warn(`getServerStatus: Server ${a} not found`),{status:"error",message:`Server ${a} configuration not found. The server may have been deleted or not properly configured.`};if(b.disabled)return eN.debug(`getServerStatus: Server ${a} is disabled`),{status:"disconnected"};if("streamable"===b.transport&&b.oauthScopes&&b.oauthScopes.length>0){if(!b.oauthTokens||!b.oauthTokens.access_token)return eN.info(`getServerStatus: Server ${a} requires OAuth authentication but has no valid tokens`),{status:"requires_authentication",message:"OAuth authentication required. Click the authenticate button to complete the OAuth flow."};if(!b.oauthTokens.refresh_token&&b.oauthTokens.expires_in&&b.oauthTokens.issued_at){let c=b.oauthTokens.issued_at,d=b.oauthTokens.expires_in;if(Math.floor(Date.now()/1e3)>=c+d)return eN.info(`getServerStatus: OAuth tokens for ${a} have expired and no refresh token is available`),{status:"requires_authentication",message:"OAuth tokens have expired. Please re-authenticate."}}}let c=(this.stderrLogs.get(a)||[]).join("\n").trim(),d=this.lastConnectionError.get(a);if(this.getClient(a))return eN.info(`getServerStatus: Server ${a} is connected`),{status:"connected",stderrOutput:c||void 0};{let b=this.isStartingUp()&&!this.lastConnectionError.has(a);if(this.connectingServers.has(a)||b)return eN.info(`getServerStatus: Server ${a} is still connecting`),{status:"connecting",message:"Server is starting up. This may take a few moments."};if(c&&(c.includes("OAuth authentication required")||c.includes("invalid_token")))return eN.info(`getServerStatus: OAuth authentication error detected for ${a}`),{status:"requires_authentication",message:"OAuth authentication required. Please complete the OAuth flow.",stderrOutput:c};let e=c||d;return e?(eN.info(`getServerStatus: Using ${c?"stderr output":"persisted connection error"} as error message for ${a}`),{status:"error",message:e,stderrOutput:c||void 0}):(eN.info(`getServerStatus: No specific error details available for ${a}`),{status:"error",message:`Server ${a} is configured but not connected. The server process may have crashed or been terminated.`,stderrOutput:void 0})}}async startEnabledServers(){eN.info("Starting all enabled servers"),this.setStartingUp(!0);try{await this.clearRetryTimersForDisabledServers();let a=await this.loadServerConfigs();if(!Array.isArray(a))return void eN.warn("Failed to load server configs, cannot start servers");let b=a.filter(a=>!a.disabled);eN.info(`Found ${b.length} enabled servers to start`),eN.debug(`${b}`),b.forEach(a=>this.connectingServers.add(a.name)),await Promise.all(b.map(a=>(eN.info(`Starting server: ${a.name}`),this.connectServer(a).catch(b=>{eN.error(`Failed to start server ${a.name}:`,b)}))))}finally{this.setStartingUp(!1)}}async getAvailableClients(){try{let a=await this.loadServerConfigs();if(!a||"error"in a)return eN.warn("getAvailableClients: Failed to load server configs:",a?.error),[];return(await Promise.all(a.map(async a=>{try{let b=await this.getServerStatus(a.name);return{name:a.name,status:"string"==typeof b?b:b.status,connected:"string"==typeof b?"connected"===b:"connected"===b.status}}catch(b){return eN.warn(`getAvailableClients: Error getting status for ${a.name}:`,b),{name:a.name,status:"error",connected:!1}}}))).map(a=>`${a.name} (${a.status})`)}catch(a){return eN.error("getAvailableClients: Error getting available clients:",a),[]}}constructor(){this.stderrLogs=new Map,this.lastConnectionError=new Map,this.inFlightConnects=new Map,this.connectionRetryTimers=new Map,this.connectionRetryAttempts=new Map}}let eP=new eO},99925:(a,b,c)=>{"use strict";let d=c(67729),e=c(97161),f=c(24860),g=e.implSymbol;function h(b){if(!this||this[g]||!(this instanceof h))throw TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");if(arguments.length<1)throw TypeError("Failed to construct 'URL': 1 argument required, but only "+arguments.length+" present.");let c=[];for(let a=0;a<arguments.length&&a<2;++a)c[a]=arguments[a];c[0]=d.USVString(c[0]),void 0!==c[1]&&(c[1]=d.USVString(c[1])),a.exports.setup(this,c)}h.prototype.toJSON=function(){if(!this||!a.exports.is(this))throw TypeError("Illegal invocation");let b=[];for(let a=0;a<arguments.length&&a<0;++a)b[a]=arguments[a];return this[g].toJSON.apply(this[g],b)},Object.defineProperty(h.prototype,"href",{get(){return this[g].href},set(a){a=d.USVString(a),this[g].href=a},enumerable:!0,configurable:!0}),h.prototype.toString=function(){if(!this||!a.exports.is(this))throw TypeError("Illegal invocation");return this.href},Object.defineProperty(h.prototype,"origin",{get(){return this[g].origin},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"protocol",{get(){return this[g].protocol},set(a){a=d.USVString(a),this[g].protocol=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"username",{get(){return this[g].username},set(a){a=d.USVString(a),this[g].username=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"password",{get(){return this[g].password},set(a){a=d.USVString(a),this[g].password=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"host",{get(){return this[g].host},set(a){a=d.USVString(a),this[g].host=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"hostname",{get(){return this[g].hostname},set(a){a=d.USVString(a),this[g].hostname=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"port",{get(){return this[g].port},set(a){a=d.USVString(a),this[g].port=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"pathname",{get(){return this[g].pathname},set(a){a=d.USVString(a),this[g].pathname=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"search",{get(){return this[g].search},set(a){a=d.USVString(a),this[g].search=a},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"hash",{get(){return this[g].hash},set(a){a=d.USVString(a),this[g].hash=a},enumerable:!0,configurable:!0}),a.exports={is:a=>!!a&&a[g]instanceof f.implementation,create(a,b){let c=Object.create(h.prototype);return this.setup(c,a,b),c},setup(a,b,c){c||(c={}),c.wrapper=a,a[g]=new f.implementation(b,c),a[g][e.wrapperSymbol]=a},interface:h,expose:{Window:{URL:h},Worker:{URL:h}}}}};
|