@makaio/framework 1.0.0-dev-1781023871421 → 1.0.0-dev-1781081952714
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.makaio-build.json +2 -2
- package/dist/{account-identity-DT5NOtFi.mjs → account-identity-CgzOqnVm.mjs} +1 -1
- package/dist/{adapter-C1eI-fGV.mjs → adapter-Dt2FDMs4.mjs} +1 -1
- package/dist/adapters/acp-client/index.d.mts +4 -4
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +24 -23
- package/dist/adapters/index.mjs +6 -13
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/ajv-BJsabpMb.mjs +8 -0
- package/dist/await-trigger-DREnXCEJ.mjs +1 -0
- package/dist/bus/index.d.mts +19 -19
- package/dist/{client-bx74gm4R.mjs → client-BBJf1mVA.mjs} +1 -1
- package/dist/contracts/adapter/index.d.mts +2 -2
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +1 -1
- package/dist/contracts/client/index.d.mts +2 -2
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +1 -1
- package/dist/contracts/config/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +3 -3
- package/dist/contracts/extension/index.mjs +1 -1
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/facet/index.mjs +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/harness/index.mjs +1 -1
- package/dist/contracts/host/index.d.mts +1 -1
- package/dist/contracts/host/index.mjs +1 -1
- package/dist/contracts/index.d.mts +425 -425
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/model-registry/index.mjs +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.mjs +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/platform/index.mjs +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/skill/index.mjs +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.mjs +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/create-static-mount-CFGo91CI.mjs +1 -0
- package/dist/cross-spawn-BL6EvJBv.mjs +1 -0
- package/dist/{cursor-storage-CtVJ3JzB.mjs → cursor-storage-C_WTAESV.mjs} +1 -1
- package/dist/{definition-CrgHIpTK.d.mts → definition-DqJOg6Lv.d.mts} +1 -1
- package/dist/descriptor-to-package-CY8oc2gl.mjs +1 -0
- package/dist/detached-extension-handle-CxEBQnSa.mjs +1 -0
- package/dist/drizzle/0000_charming_prowler.sql +443 -0
- package/dist/drizzle/0001_known_stephen_strange.sql +25 -0
- package/dist/drizzle/0002_woozy_gladiator.sql +1 -0
- package/dist/drizzle/0003_overjoyed_adam_destine.sql +1 -0
- package/dist/drizzle/0004_solid_goliath.sql +1 -0
- package/dist/drizzle/0005_round_calypso.sql +51 -0
- package/dist/drizzle/0006_free_tiger_shark.sql +4 -0
- package/dist/drizzle/0007_sparkling_terror.sql +2 -0
- package/dist/drizzle/0008_petite_deathstrike.sql +1 -0
- package/dist/drizzle/0009_lethal_malcolm_colcord.sql +6 -0
- package/dist/drizzle/0010_grey_chronomancer.sql +1 -0
- package/dist/drizzle/0011_solid_nomad.sql +1 -0
- package/dist/drizzle/meta/0000_snapshot.json +2813 -0
- package/dist/drizzle/meta/0001_snapshot.json +2820 -0
- package/dist/drizzle/meta/0002_snapshot.json +2827 -0
- package/dist/drizzle/meta/0003_snapshot.json +2834 -0
- package/dist/drizzle/meta/0004_snapshot.json +2842 -0
- package/dist/drizzle/meta/0005_snapshot.json +2849 -0
- package/dist/drizzle/meta/0006_snapshot.json +2865 -0
- package/dist/drizzle/meta/0007_snapshot.json +2879 -0
- package/dist/drizzle/meta/0008_snapshot.json +2886 -0
- package/dist/drizzle/meta/0009_snapshot.json +2901 -0
- package/dist/drizzle/meta/0010_snapshot.json +2908 -0
- package/dist/drizzle/meta/0011_snapshot.json +2915 -0
- package/dist/drizzle/meta/_journal.json +90 -0
- package/dist/esm-BdLRFEUy.mjs +3 -0
- package/dist/expression/index.d.mts +120 -0
- package/dist/expression/index.mjs +1431 -0
- package/dist/extension--5Q190u_.mjs +1 -0
- package/dist/{extension-CpIUgBKI.mjs → extension-DFIZ3FCJ.mjs} +1 -1
- package/dist/extension-discovery-CkV_VRdJ.d.mts +163 -0
- package/dist/fast-uri-BF2Xuiop.mjs +1 -0
- package/dist/{filesystem-service-B8rhBRgB.mjs → filesystem-service-DH9zlxyd.mjs} +1 -1
- package/dist/git/index.mjs +17 -17
- package/dist/globby-4SrlyIlj.mjs +1 -0
- package/dist/{handlers-CkTsQLra.mjs → handlers-Bev7-xjL.mjs} +1 -1
- package/dist/{index-472sOmsW.d.mts → index-BAhJKQLX.d.mts} +7 -7
- package/dist/{index-D9MwJ2Q8.d.mts → index-BCKRUuI2.d.mts} +2 -2
- package/dist/{index-mNec7V-9.d.mts → index-BYkOUd0x.d.mts} +12 -12
- package/dist/{index-8SZkg7s6.d.mts → index-Bibt5jAX.d.mts} +8 -8
- package/dist/{index-DBw-89vC2.d.mts → index-BmV60tMf.d.mts} +18 -18
- package/dist/{index-B_zQC98V.d.mts → index-BpniJgxu.d.mts} +4 -4
- package/dist/{index-soFznFCy2.d.mts → index-Bw_zL7Rs.d.mts} +1 -1
- package/dist/{index-CelJCBjk.d.mts → index-C3zfJg6s.d.mts} +13 -13
- package/dist/{index-Caig6TeF.d.mts → index-CNOTkyGw.d.mts} +379 -303
- package/dist/{index-Bh_Ne7LF.d.mts → index-CwKzQuIX.d.mts} +28 -28
- package/dist/{index-B3PK4FIn.d.mts → index-D6bw4qJp.d.mts} +112 -112
- package/dist/{index-Cm0dUkWL.d.mts → index-DETxgKS2.d.mts} +24 -24
- package/dist/{index-D90OmGmV.d.mts → index-Db0uJ_Cg2.d.mts} +3 -3
- package/dist/{index-Bvb2mMH6.d.mts → index-IekAD8Gp.d.mts} +44 -44
- package/dist/index-YDfOv0GT.d.mts +1133 -0
- package/dist/{index-L4GjJDKb.d.mts → index-fVgKVvta.d.mts} +3 -3
- package/dist/{index-DUaw0Dw8.d.mts → index-jlQ4IhR5.d.mts} +497 -497
- package/dist/jsonl-transport-BxNXizIm.mjs +3 -0
- package/dist/kernel/cli/index.d.mts +2 -95
- package/dist/kernel/cli/index.mjs +1 -1
- package/dist/kernel/cli/register.d.mts +2 -0
- package/dist/kernel/cli/register.mjs +1 -0
- package/dist/kernel/cli/schemas.mjs +1 -1
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/extension/index.mjs +1 -1
- package/dist/kernel/index.d.mts +5 -5
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +1 -1
- package/dist/kernel/namespace/index.mjs +1 -1
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/providers/index.mjs +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/kernel/window/index.mjs +1 -1
- package/dist/lib-B9kVK_1_.mjs +4 -0
- package/dist/lib-DPruLs5D.mjs +155 -0
- package/dist/lib-aRogYLqg.mjs +5 -0
- package/dist/load-extensions-C-TqCwzL.mjs +1 -0
- package/dist/load-extensions-D9nbDIiW.d.mts +117 -0
- package/dist/mcp-http-server/index.d.mts +561 -0
- package/dist/mcp-http-server/index.mjs +4 -0
- package/dist/{namespace-EQniz-Aw.d.mts → namespace-B60mn8J-2.d.mts} +4 -4
- package/dist/{namespace-CxhsoFUP.d.mts → namespace-BBVtD1gu.d.mts} +14 -14
- package/dist/namespace-BXqetkc3.mjs +1 -0
- package/dist/{namespace-Dr8K0MCp.d.mts → namespace-BlS_i9KT.d.mts} +17 -17
- package/dist/{namespace-5QQqbF-B.d.mts → namespace-ByyuIFpL.d.mts} +91 -91
- package/dist/{namespace-DLovh2Ws.d.mts → namespace-CHMszppN.d.mts} +6 -6
- package/dist/{namespace-BM7Djng9.d.mts → namespace-CqUGzG53.d.mts} +2 -2
- package/dist/{namespace-DD8Oiqo7.d.mts → namespace-D1Iw_d1P.d.mts} +20 -20
- package/dist/{namespace-DgqkaOVu.d.mts → namespace-DBKWNrk7.d.mts} +22 -22
- package/dist/{namespace-CaaNnKcR.d.mts → namespace-Ds6HkJEU.d.mts} +138 -138
- package/dist/namespace-DzVf1hVH.d.mts +96 -0
- package/dist/{namespace-TyiTsLFv.d.mts → namespace-aBIAWxY3.d.mts} +46 -46
- package/dist/{namespace-DuXK5AYN.mjs → namespace-h0HIuqx0.mjs} +1 -1
- package/dist/{native-session-supervisor-B1TnaPUF.mjs → native-session-supervisor-DeKpxhWO.mjs} +1 -1
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/index.mjs +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.mjs +1 -1
- package/dist/{orchestrator-shared-CIDiFJMD.mjs → orchestrator-shared-FnWrPS09.mjs} +1 -1
- package/dist/out-CvZYgczi.mjs +41 -0
- package/dist/package-1DS4bXg5.mjs +1 -0
- package/dist/package-BSnp1zOR.d.mts +372 -0
- package/dist/package.json +5 -0
- package/dist/primitive-runtime-DcYYWy_6.mjs +8 -0
- package/dist/{profile-6ynCD5k3.mjs → profile-D39-Zy_W.mjs} +1 -1
- package/dist/{provider-context-CK6B4X_8.mjs → provider-context-lfG0BpqX.mjs} +1 -1
- package/dist/quick-lru-B9nWXbXI.mjs +1 -0
- package/dist/rules/index.d.mts +27 -0
- package/dist/rules/index.mjs +1 -0
- package/dist/rules/schemas.d.mts +2 -0
- package/dist/rules/schemas.mjs +1 -0
- package/dist/runtime-bun/index.d.mts +385 -0
- package/dist/runtime-bun/index.mjs +1 -0
- package/dist/runtime-node/bus/runtime/namespace.d.mts +61 -0
- package/dist/runtime-node/bus/runtime/namespace.mjs +1 -0
- package/dist/runtime-node/bus/runtime/schemas.d.mts +54 -0
- package/dist/runtime-node/bus/runtime/schemas.mjs +1 -0
- package/dist/runtime-node/extension-discovery.d.mts +2 -0
- package/dist/runtime-node/extension-discovery.mjs +1 -0
- package/dist/runtime-node/extension-validation.d.mts +2 -0
- package/dist/runtime-node/extension-validation.mjs +1 -0
- package/dist/runtime-node/index.d.mts +745 -0
- package/dist/runtime-node/index.mjs +148 -0
- package/dist/runtime-node/makaio-config.d.mts +153 -0
- package/dist/runtime-node/makaio-config.mjs +1 -0
- package/dist/runtime-node/workflow-worker/index.d.mts +2 -0
- package/dist/runtime-node/workflow-worker/index.mjs +1 -0
- package/dist/runtime-node/workflow-worker/worker-entry.d.mts +39 -0
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -0
- package/dist/{schema-M5YTvSAG.d.mts → schema-CDL_pyyM.d.mts} +4 -4
- package/dist/{schema-e0wU_lcV.mjs → schema-DCJyzRHe.mjs} +1 -1
- package/dist/schema-introspection-CuRZPYEc.mjs +1 -0
- package/dist/{schemas-C46QfKzv.d.mts → schemas-B5ToLwIs.d.mts} +14 -14
- package/dist/schemas-C792eVAZ.d.mts +171 -0
- package/dist/{schemas-CaLhkkLn.mjs → schemas-CSUwpaNm.mjs} +1 -1
- package/dist/{schemas-DVF1A4DF.d.mts → schemas-Chyj6HuZ.d.mts} +9 -9
- package/dist/{schemas-DATniTHb.d.mts → schemas-DZUaRcYl.d.mts} +14 -14
- package/dist/{schemas-DiYVzG6e.d.mts → schemas-Exixg77V2.d.mts} +16 -16
- package/dist/{schemas-ClOOT1W6.d.mts → schemas-lqvZ6UpK.d.mts} +3 -3
- package/dist/{schemas-j7ivZ2HI.d.mts → schemas-on3_N5HP.d.mts} +138 -138
- package/dist/{schemas-wg_6PAdV.d.mts → schemas-t1VR6_b_.d.mts} +4 -4
- package/dist/semver-DhHJv6Dt.mjs +1 -0
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- package/dist/services/adapter-runtime/index.mjs +1 -1
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +2 -2
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/adapter-subsystem/namespace.mjs +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/capability/index.d.mts +1 -1
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +7 -7
- package/dist/services/context-rules/index.mjs +1 -1
- package/dist/services/execution-target/index.d.mts +3 -3
- package/dist/services/execution-target/index.mjs +1 -1
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/filesystem/index.mjs +1 -1
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/git/namespace.d.mts +6 -6
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.d.mts +6 -6
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.d.mts +12 -12
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +159 -158
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +3 -3
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.d.mts +6 -6
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.d.mts +3 -3
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/testing/index.mjs +1 -1
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +10 -10
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/clients-namespace.mjs +1 -1
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/index.mjs +1 -1
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/settings/storage/providers-namespace.mjs +1 -1
- package/dist/services/subagent/index.d.mts +1 -1
- package/dist/services/subagent/index.mjs +1 -1
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.d.mts +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +3 -3
- package/dist/services/tray-menu/index.mjs +1 -1
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/turn/schemas.d.mts +10 -10
- package/dist/{session-BoldSdNZ2.mjs → session-BnfsJoZi.mjs} +1 -1
- package/dist/{session-DuVOYctZ.mjs → session-C1Cami7U.mjs} +1 -1
- package/dist/{session-lineage-CRsc9g1x.d.mts → session-lineage-CKg6mErA.d.mts} +1 -1
- package/dist/{skill-CQO4mDqK.mjs → skill-BNQnWVIG.mjs} +1 -1
- package/dist/src-Dvp41Cg2.mjs +1 -0
- package/dist/src-Z3vAZJfw.mjs +21 -0
- package/dist/storage/drizzle/client.d.mts +1 -1
- package/dist/storage/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/storage-namespace-BXO3lDVy.mjs +1 -0
- package/dist/{storage-namespace-BXkoh5Sy.d.mts → storage-namespace-BXmMUd7a.d.mts} +20 -20
- package/dist/style.css +540 -540
- package/dist/supports-color-fVsgozsi.mjs +1 -0
- package/dist/tool-approval-service-BgNcJvKx.mjs +1 -0
- package/dist/tools-DC4KrqI1.mjs +1 -0
- package/dist/{types-CCdqjeuH.d.mts → types-B0BtvVAq.d.mts} +2 -81
- package/dist/{types-BCMUtBj1.d.mts → types-CmMesAgR.d.mts} +1 -1
- package/dist/{types-DZHvOc_Q.d.mts → types-D0fPFh-D.d.mts} +1 -1
- package/dist/{types-Dy3YTcTF.d.mts → types-DiGqpZOD.d.mts} +288 -288
- package/dist/ui-components/index.d.mts +1 -1
- package/dist/ui-components/index.mjs +2 -2
- package/dist/ui-hooks/index.d.mts +6 -6
- package/dist/ui-kernel/index.d.mts +7 -7
- package/dist/ui-kernel/pages/namespace.d.mts +8 -8
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/ui-views/index.mjs +2 -2
- package/dist/version-B4NO_fID.mjs +1 -0
- package/dist/workflow-engine/index.d.mts +6568 -0
- package/dist/workflow-engine/index.mjs +1 -0
- package/dist/workflow-engine/package.d.mts +2 -0
- package/dist/workflow-engine/package.mjs +1 -0
- package/dist/workflow-engine/workflow-orchestrator.d.mts +61 -0
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -0
- package/dist/workflow-worker-DvP753UN.mjs +1 -0
- package/package.json +65 -1
- package/dist/extension-C-4BHMRI.mjs +0 -1
- package/dist/globby-rtWVaFHv.mjs +0 -41
- package/dist/schema-introspection-Dn1jWQs1.mjs +0 -1
- package/dist/schemas-CVvwIfG4.mjs +0 -1
- package/dist/storage-namespace-DWsYLAXa.mjs +0 -1
- package/dist/tool-approval-service-BvZWhYZp.mjs +0 -1
- package/dist/tools-D-luYcDw.mjs +0 -1431
- package/dist/version-BeT3ASEe.mjs +0 -1
- /package/dist/{base-orchestrator-wyumsn3b.d.mts → base-orchestrator-M5mAB5-w.d.mts} +0 -0
- /package/dist/{capability-service-CJbmhfv9.mjs → capability-service-jjrFLM6r.mjs} +0 -0
- /package/dist/{cleanEnvForAdapter-KkYzQa1f.mjs → cleanEnvForAdapter-BlpmyXYk.mjs} +0 -0
- /package/dist/{clients-namespace-GmSJpBUV.d.mts → clients-namespace-SFk7OTop.d.mts} +0 -0
- /package/dist/{config-namespace-CPY9YsR8.d.mts → config-namespace-BzAvE2nY.d.mts} +0 -0
- /package/dist/{config-namespace-ncYg2ct_.mjs → config-namespace-DydHz9so.mjs} +0 -0
- /package/dist/{definition-BLCdXGzh.d.mts → definition-BSghHJpQ.d.mts} +0 -0
- /package/dist/{definition-pkJ6szUl.d.mts → definition-q6iLw11H.d.mts} +0 -0
- /package/dist/{drizzle-Eq8W1EbD.mjs → drizzle-DpjZFY_j.mjs} +0 -0
- /package/dist/{event-Ca2yUf5i.mjs → event-BEllCn16.mjs} +0 -0
- /package/dist/{execution-target-CRPTfZlc.mjs → execution-target-CQGYaaM2.mjs} +0 -0
- /package/dist/{extension-namespace-cMh_mMiL.mjs → extension-namespace-BBgYOttA.mjs} +0 -0
- /package/dist/{facet-BuwhrThl.mjs → facet-DMrryX_0.mjs} +0 -0
- /package/dist/{filesystem-service-p_iJVHd4.d.mts → filesystem-service-Ddngll0j.d.mts} +0 -0
- /package/dist/{harness-BRCMcvQN.mjs → harness-B8E_wRwa.mjs} +0 -0
- /package/dist/{host-Br9VuOyr.mjs → host-DbMiI5wQ.mjs} +0 -0
- /package/dist/{identity-Cz2IeEtm.mjs → identity-Bmx-8fPa.mjs} +0 -0
- /package/dist/{index-U-A8eyGT.d.mts → index-9IDJUJ4X.d.mts} +0 -0
- /package/dist/{index-CGmcS0Ma.d.mts → index-BBvcP-P0.d.mts} +0 -0
- /package/dist/{index-BGfWS6GE.d.mts → index-BKKNWqkP2.d.mts} +0 -0
- /package/dist/{index-DKia0MX1.d.mts → index-BMpRB6iE.d.mts} +0 -0
- /package/dist/{index-CHQ1SqT0.d.mts → index-BbCjtc3h.d.mts} +0 -0
- /package/dist/{index-BFg9BUpx.d.mts → index-BheaEhyI.d.mts} +0 -0
- /package/dist/{index-Cs0kZXIz2.d.mts → index-BnQSPC6c.d.mts} +0 -0
- /package/dist/{index-CCGVh9BF2.d.mts → index-BpXX9WZJ.d.mts} +0 -0
- /package/dist/{index-DMKnON5s.d.mts → index-Bsp0O_sI.d.mts} +0 -0
- /package/dist/{index-DANINzMu.d.mts → index-Buo9H8RK.d.mts} +0 -0
- /package/dist/{index-CLpjm52M.d.mts → index-BxFA1XcP.d.mts} +0 -0
- /package/dist/{index-ChunCFu4.d.mts → index-C33Tq1ei2.d.mts} +0 -0
- /package/dist/{index-DGBu6bHi2.d.mts → index-C6BhKRnH.d.mts} +0 -0
- /package/dist/{index-eemAKwsB.d.mts → index-CDU_s69P.d.mts} +0 -0
- /package/dist/{index-DKC62dY5.d.mts → index-CGJjA-hR2.d.mts} +0 -0
- /package/dist/{index-CokQYGVP.d.mts → index-Clut1ljB.d.mts} +0 -0
- /package/dist/{index-BVgfS-AJ.d.mts → index-Cz9JMjZK.d.mts} +0 -0
- /package/dist/{index-vtXJuwrz.d.mts → index-D0SUjZmU.d.mts} +0 -0
- /package/dist/{index-x_lVDp_J.d.mts → index-D6Iyvz9T.d.mts} +0 -0
- /package/dist/{index-D5d5HeWI2.d.mts → index-DOfq0qqv.d.mts} +0 -0
- /package/dist/{index-De3kPhlN.d.mts → index-DSV1aFgK.d.mts} +0 -0
- /package/dist/{index-B80L4YqA.d.mts → index-Dsq2zKvu.d.mts} +0 -0
- /package/dist/{materialization-CuUBu4XI.mjs → materialization-3QUnQLbC.mjs} +0 -0
- /package/dist/{model-registry-Scn_MC2d.mjs → model-registry-B0AIdj7O.mjs} +0 -0
- /package/dist/{model-registry-CfXytvzx.mjs → model-registry-j-rCKcik.mjs} +0 -0
- /package/dist/{namespace-CFLAmQfh.mjs → namespace-BbjCyZC9.mjs} +0 -0
- /package/dist/{namespace-BwzZJqTV.mjs → namespace-BgPoC46Q.mjs} +0 -0
- /package/dist/{namespace-Yna5-Pws.mjs → namespace-CDiM5Bcr.mjs} +0 -0
- /package/dist/{namespace-BoD94mrN.mjs → namespace-CUOGcGPG.mjs} +0 -0
- /package/dist/{namespace-LViZ-EQk.mjs → namespace-D6X67cUk.mjs} +0 -0
- /package/dist/{namespace-DkRgbZYn.mjs → namespace-ENv7H7Na.mjs} +0 -0
- /package/dist/{namespace-xcmbQlxh.mjs → namespace-FT8igkn4.mjs} +0 -0
- /package/dist/{namespace-CaoZ3S78.d.mts → namespace-XTGCaSXj.d.mts} +0 -0
- /package/dist/{namespace-CTm3nEvh.d.mts → namespace-nlsvvMtD.d.mts} +0 -0
- /package/dist/{namespace-IV1QK__V.d.mts → namespace-uuR0Fg5r.d.mts} +0 -0
- /package/dist/{orchestrator-shared-Dfa7FMyw.d.mts → orchestrator-shared-D91Wk7z-.d.mts} +0 -0
- /package/dist/{package-DKVlsMP3.mjs → package-OE9dMQsq.mjs} +0 -0
- /package/dist/{platform-DZ7z-wXD.mjs → platform-Dhv22LiX.mjs} +0 -0
- /package/dist/{providers-u8i15co9.mjs → providers-B1p0P-vB.mjs} +0 -0
- /package/dist/{providers-namespace-DSEpli4A.d.mts → providers-namespace-BqWYkydw.d.mts} +0 -0
- /package/dist/{schema-CoyE6mPt.mjs → schema-DOnJmAPw.mjs} +0 -0
- /package/dist/{schemas-Bd0OjRQf.d.mts → schemas-B77Gi8Xr.d.mts} +0 -0
- /package/dist/{schemas-jFe1AuI-.mjs → schemas-BCIuTWRl2.mjs} +0 -0
- /package/dist/{schemas-DE-GNmSD.mjs → schemas-BdAf5u58.mjs} +0 -0
- /package/dist/{schemas-CDBSjg7o.d.mts → schemas-Dyk7JuVl.d.mts} +0 -0
- /package/dist/{schemas-DaRSfYLf.d.mts → schemas-Kq33MTPY.d.mts} +0 -0
- /package/dist/{server-lifecycle-YoSGFGnU.d.mts → server-lifecycle-47mygK3E.d.mts} +0 -0
- /package/dist/{server-lifecycle-FXTPW39-.mjs → server-lifecycle-Cg47L59Q.mjs} +0 -0
- /package/dist/{shared-schemas-CPShiLNp.mjs → shared-schemas-CKe2uN4-.mjs} +0 -0
- /package/dist/{storage-namespace-definition-Bkx5rSto.d.mts → storage-namespace-definition-C3XbpiP8.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-CqSdsuCC.mjs → storage-namespace-definition-RvjfFysN.mjs} +0 -0
- /package/dist/{telemetry-CvdLBWuk.mjs → telemetry-O0394b7p.mjs} +0 -0
- /package/dist/{tray-menu-service-DuXq5k22.mjs → tray-menu-service-B5YPK_YF.mjs} +0 -0
- /package/dist/{types-C2Ob9zz_.d.mts → types-5Gw3iVpK.d.mts} +0 -0
- /package/dist/{types-dyP-bXXE.d.mts → types-BhXRffJ_.d.mts} +0 -0
- /package/dist/{types-MfJZ67e9.d.mts → types-D-bP8RRE.d.mts} +0 -0
- /package/dist/{variant-CT6XBP6T.mjs → variant-COVbYmMs.mjs} +0 -0
- /package/dist/{window-registry-CBcrGTv4.d.mts → window-registry-CfEi_Ji4.d.mts} +0 -0
- /package/dist/{window-registry-DW-dKRjQ.mjs → window-registry-XjOExitT.mjs} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{i as e,t}from"./chunk-DTipWd-i.mjs";var n=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.splitWhen=e.flatten=void 0;function t(e){return e.reduce((e,t)=>[].concat(e,t),[])}e.flatten=t;function n(e,t){let n=[[]],r=0;for(let i of e)t(i)?(r++,n[r]=[]):n[r].push(i);return n}e.splitWhen=n})),r=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isEnoentCodeError=void 0;function t(e){return e.code===`ENOENT`}e.isEnoentCodeError=t})),i=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDirentFromStats=void 0;var t=class{constructor(e,t){this.name=e,this.isBlockDevice=t.isBlockDevice.bind(t),this.isCharacterDevice=t.isCharacterDevice.bind(t),this.isDirectory=t.isDirectory.bind(t),this.isFIFO=t.isFIFO.bind(t),this.isFile=t.isFile.bind(t),this.isSocket=t.isSocket.bind(t),this.isSymbolicLink=t.isSymbolicLink.bind(t)}};function n(e,n){return new t(e,n)}e.createDirentFromStats=n})),a=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.convertPosixPathToPattern=t.convertWindowsPathToPattern=t.convertPathToPattern=t.escapePosixPath=t.escapeWindowsPath=t.escape=t.removeLeadingDotSegment=t.makeAbsolute=t.unixify=void 0;let n=e(`os`),r=e(`path`),i=n.platform()===`win32`,a=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,o=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,s=/^\\\\([.?])/,c=/\\(?![!()+@[\]{}])/g;function l(e){return e.replace(/\\/g,`/`)}t.unixify=l;function u(e,t){return r.resolve(e,t)}t.makeAbsolute=u;function d(e){if(e.charAt(0)===`.`){let t=e.charAt(1);if(t===`/`||t===`\\`)return e.slice(2)}return e}t.removeLeadingDotSegment=d,t.escape=i?f:p;function f(e){return e.replace(o,`\\$2`)}t.escapeWindowsPath=f;function p(e){return e.replace(a,`\\$2`)}t.escapePosixPath=p,t.convertPathToPattern=i?m:h;function m(e){return f(e).replace(s,`//$1`).replace(c,`/`)}t.convertWindowsPathToPattern=m;function h(e){return p(e)}t.convertPosixPathToPattern=h})),o=t(((e,t)=>{
|
|
2
|
+
/*!
|
|
3
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
6
|
+
* Licensed under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
t.exports=function(e){if(typeof e!=`string`||e===``)return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1}})),s=t(((e,t)=>{
|
|
9
|
+
/*!
|
|
10
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
13
|
+
* Released under the MIT License.
|
|
14
|
+
*/
|
|
15
|
+
var n=o(),r={"{":`}`,"(":`)`,"[":`]`},i=function(e){if(e[0]===`!`)return!0;for(var t=0,n=-2,i=-2,a=-2,o=-2,s=-2;t<e.length;){if(e[t]===`*`||e[t+1]===`?`&&/[\].+)]/.test(e[t])||i!==-1&&e[t]===`[`&&e[t+1]!==`]`&&(i<t&&(i=e.indexOf(`]`,t)),i>t&&(s===-1||s>i||(s=e.indexOf(`\\`,t),s===-1||s>i)))||a!==-1&&e[t]===`{`&&e[t+1]!==`}`&&(a=e.indexOf(`}`,t),a>t&&(s=e.indexOf(`\\`,t),s===-1||s>a))||o!==-1&&e[t]===`(`&&e[t+1]===`?`&&/[:!=]/.test(e[t+2])&&e[t+3]!==`)`&&(o=e.indexOf(`)`,t),o>t&&(s=e.indexOf(`\\`,t),s===-1||s>o))||n!==-1&&e[t]===`(`&&e[t+1]!==`|`&&(n<t&&(n=e.indexOf(`|`,t)),n!==-1&&e[n+1]!==`)`&&(o=e.indexOf(`)`,n),o>n&&(s=e.indexOf(`\\`,n),s===-1||s>o))))return!0;if(e[t]===`\\`){var c=e[t+1];t+=2;var l=r[c];if(l){var u=e.indexOf(l,t);u!==-1&&(t=u+1)}if(e[t]===`!`)return!0}else t++}return!1},a=function(e){if(e[0]===`!`)return!0;for(var t=0;t<e.length;){if(/[*?{}()[\]]/.test(e[t]))return!0;if(e[t]===`\\`){var n=e[t+1];t+=2;var i=r[n];if(i){var a=e.indexOf(i,t);a!==-1&&(t=a+1)}if(e[t]===`!`)return!0}else t++}return!1};t.exports=function(e,t){if(typeof e!=`string`||e===``)return!1;if(n(e))return!0;var r=i;return t&&t.strict===!1&&(r=a),r(e)}})),c=t(((t,n)=>{var r=s(),i=e(`path`).posix.dirname,a=e(`os`).platform()===`win32`,o=`/`,c=/\\/g,l=/[\{\[].*[\}\]]$/,u=/(^|[^\\])([\{\[]|\([^\)]+$)/,d=/\\([\!\*\?\|\[\]\(\)\{\}])/g;n.exports=function(e,t){Object.assign({flipBackslashes:!0},t).flipBackslashes&&a&&e.indexOf(o)<0&&(e=e.replace(c,o)),l.test(e)&&(e+=o),e+=`a`;do e=i(e);while(r(e)||u.test(e));return e.replace(d,`$1`)}})),l=t((e=>{e.isInteger=e=>typeof e==`number`?Number.isInteger(e):typeof e==`string`&&e.trim()!==``?Number.isInteger(Number(e)):!1,e.find=(e,t)=>e.nodes.find(e=>e.type===t),e.exceedsLimit=(t,n,r=1,i)=>i===!1||!e.isInteger(t)||!e.isInteger(n)?!1:(Number(n)-Number(t))/Number(r)>=i,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type===`open`||r.type===`close`)&&r.escaped!==!0&&(r.value=`\\`+r.value,r.escaped=!0)},e.encloseBrace=e=>e.type===`brace`?e.commas>>0+e.ranges>>0?!1:(e.invalid=!0,!0):!1,e.isInvalidBrace=e=>e.type===`brace`?e.invalid===!0||e.dollar?!0:!(e.commas>>0+e.ranges>>0)||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1:!1,e.isOpenOrClose=e=>e.type===`open`||e.type===`close`?!0:e.open===!0||e.close===!0,e.reduce=e=>e.reduce((e,t)=>(t.type===`text`&&e.push(t.value),t.type===`range`&&(t.type=`text`),e),[]),e.flatten=(...e)=>{let t=[],n=e=>{for(let r=0;r<e.length;r++){let i=e[r];if(Array.isArray(i)){n(i);continue}i!==void 0&&t.push(i)}return t};return n(e),t}})),u=t(((e,t)=>{let n=l();t.exports=(e,t={})=>{let r=(e,i={})=>{let a=t.escapeInvalid&&n.isInvalidBrace(i),o=e.invalid===!0&&t.escapeInvalid===!0,s=``;if(e.value)return(a||o)&&n.isOpenOrClose(e)?`\\`+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(let t of e.nodes)s+=r(t);return s};return r(e)}})),d=t(((e,t)=>{
|
|
16
|
+
/*!
|
|
17
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
18
|
+
*
|
|
19
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
20
|
+
* Released under the MIT License.
|
|
21
|
+
*/
|
|
22
|
+
t.exports=function(e){return typeof e==`number`?e-e===0:typeof e==`string`&&e.trim()!==``?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}})),f=t(((e,t)=>{
|
|
23
|
+
/*!
|
|
24
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
25
|
+
*
|
|
26
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
27
|
+
* Released under the MIT License.
|
|
28
|
+
*/
|
|
29
|
+
let n=d(),r=(e,t,a)=>{if(n(e)===!1)throw TypeError(`toRegexRange: expected the first argument to be a number`);if(t===void 0||e===t)return String(e);if(n(t)===!1)throw TypeError(`toRegexRange: expected the second argument to be a number.`);let o={relaxZeros:!0,...a};typeof o.strictZeros==`boolean`&&(o.relaxZeros=o.strictZeros===!1);let c=String(o.relaxZeros),l=String(o.shorthand),u=String(o.capture),d=String(o.wrap),f=e+`:`+t+`=`+c+l+u+d;if(r.cache.hasOwnProperty(f))return r.cache[f].result;let p=Math.min(e,t),m=Math.max(e,t);if(Math.abs(p-m)===1){let n=e+`|`+t;return o.capture?`(${n})`:o.wrap===!1?n:`(?:${n})`}let h=_(e)||_(t),g={min:e,max:t,a:p,b:m},v=[],y=[];return h&&(g.isPadded=h,g.maxLen=String(g.max).length),p<0&&(y=s(m<0?Math.abs(m):1,Math.abs(p),g,o),p=g.a=0),m>=0&&(v=s(p,m,g,o)),g.negatives=y,g.positives=v,g.result=i(y,v,o),o.capture===!0?g.result=`(${g.result})`:o.wrap!==!1&&v.length+y.length>1&&(g.result=`(?:${g.result})`),r.cache[f]=g,g.result};function i(e,t,n){let r=c(e,t,`-`,!1,n)||[],i=c(t,e,``,!1,n)||[],a=c(e,t,`-?`,!0,n)||[];return r.concat(a).concat(i).join(`|`)}function a(e,t){let n=1,r=1,i=p(e,n),a=new Set([t]);for(;e<=i&&i<=t;)a.add(i),n+=1,i=p(e,n);for(i=m(t+1,r)-1;e<i&&i<=t;)a.add(i),r+=1,i=m(t+1,r)-1;return a=[...a],a.sort(u),a}function o(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=l(e,t),i=r.length,a=``,o=0;for(let e=0;e<i;e++){let[t,i]=r[e];t===i?a+=t:t!==`0`||i!==`9`?a+=g(t,i,n):o++}return o&&(a+=n.shorthand===!0?`\\d`:`[0-9]`),{pattern:a,count:[o],digits:i}}function s(e,t,n,r){let i=a(e,t),s=[],c=e,l;for(let e=0;e<i.length;e++){let t=i[e],a=o(String(c),String(t),r),u=``;if(!n.isPadded&&l&&l.pattern===a.pattern){l.count.length>1&&l.count.pop(),l.count.push(a.count[0]),l.string=l.pattern+h(l.count),c=t+1;continue}n.isPadded&&(u=v(t,n,r)),a.string=u+a.pattern+h(a.count),s.push(a),c=t+1,l=a}return s}function c(e,t,n,r,i){let a=[];for(let i of e){let{string:e}=i;!r&&!f(t,`string`,e)&&a.push(n+e),r&&f(t,`string`,e)&&a.push(n+e)}return a}function l(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function u(e,t){return e>t?1:t>e?-1:0}function f(e,t,n){return e.some(e=>e[t]===n)}function p(e,t){return Number(String(e).slice(0,-t)+`9`.repeat(t))}function m(e,t){return e-e%10**t}function h(e){let[t=0,n=``]=e;return n||t>1?`{${t+(n?`,`+n:``)}}`:``}function g(e,t,n){return`[${e}${t-e===1?``:`-`}${t}]`}function _(e){return/^-?(0+)\d/.test(e)}function v(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),i=n.relaxZeros!==!1;switch(r){case 0:return``;case 1:return i?`0?`:`0`;case 2:return i?`0{0,2}`:`00`;default:return i?`0{0,${r}}`:`0{${r}}`}}r.cache={},r.clearCache=()=>r.cache={},t.exports=r})),p=t(((t,n)=>{
|
|
30
|
+
/*!
|
|
31
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
34
|
+
* Licensed under the MIT License.
|
|
35
|
+
*/
|
|
36
|
+
let r=e(`util`),i=f(),a=e=>typeof e==`object`&&!!e&&!Array.isArray(e),o=e=>t=>e===!0?Number(t):String(t),s=e=>typeof e==`number`||typeof e==`string`&&e!==``,c=e=>Number.isInteger(+e),l=e=>{let t=`${e}`,n=-1;if(t[0]===`-`&&(t=t.slice(1)),t===`0`)return!1;for(;t[++n]===`0`;);return n>0},u=(e,t,n)=>typeof e==`string`||typeof t==`string`?!0:n.stringify===!0,d=(e,t,n)=>{if(t>0){let n=e[0]===`-`?`-`:``;n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,`0`)}return n===!1?String(e):e},p=(e,t)=>{let n=e[0]===`-`?`-`:``;for(n&&(e=e.slice(1),t--);e.length<t;)e=`0`+e;return n?`-`+e:e},m=(e,t,n)=>{e.negatives.sort((e,t)=>e<t?-1:+(e>t)),e.positives.sort((e,t)=>e<t?-1:+(e>t));let r=t.capture?``:`?:`,i=``,a=``,o;return e.positives.length&&(i=e.positives.map(e=>p(String(e),n)).join(`|`)),e.negatives.length&&(a=`-(${r}${e.negatives.map(e=>p(String(e),n)).join(`|`)})`),o=i&&a?`${i}|${a}`:i||a,t.wrap?`(${r}${o})`:o},h=(e,t,n,r)=>{if(n)return i(e,t,{wrap:!1,...r});let a=String.fromCharCode(e);return e===t?a:`[${a}-${String.fromCharCode(t)}]`},g=(e,t,n)=>{if(Array.isArray(e)){let t=n.wrap===!0,r=n.capture?``:`?:`;return t?`(${r}${e.join(`|`)})`:e.join(`|`)}return i(e,t,n)},_=(...e)=>RangeError(`Invalid range arguments: `+r.inspect(...e)),v=(e,t,n)=>{if(n.strictRanges===!0)throw _([e,t]);return[]},y=(e,t)=>{if(t.strictRanges===!0)throw TypeError(`Expected step "${e}" to be a number`);return[]},b=(e,t,n=1,r={})=>{let i=Number(e),a=Number(t);if(!Number.isInteger(i)||!Number.isInteger(a)){if(r.strictRanges===!0)throw _([e,t]);return[]}i===0&&(i=0),a===0&&(a=0);let s=i>a,c=String(e),f=String(t),v=String(n);n=Math.max(Math.abs(n),1);let y=l(c)||l(f)||l(v),b=y?Math.max(c.length,f.length,v.length):0,x=y===!1&&u(e,t,r)===!1,S=r.transform||o(x);if(r.toRegex&&n===1)return h(p(e,b),p(t,b),!0,r);let C={negatives:[],positives:[]},w=e=>C[e<0?`negatives`:`positives`].push(Math.abs(e)),T=[],E=0;for(;s?i>=a:i<=a;)r.toRegex===!0&&n>1?w(i):T.push(d(S(i,E),b,x)),i=s?i-n:i+n,E++;return r.toRegex===!0?n>1?m(C,r,b):g(T,null,{wrap:!1,...r}):T},x=(e,t,n=1,r={})=>{if(!c(e)&&e.length>1||!c(t)&&t.length>1)return v(e,t,r);let i=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),o=`${t}`.charCodeAt(0),s=a>o,l=Math.min(a,o),u=Math.max(a,o);if(r.toRegex&&n===1)return h(l,u,!1,r);let d=[],f=0;for(;s?a>=o:a<=o;)d.push(i(a,f)),a=s?a-n:a+n,f++;return r.toRegex===!0?g(d,null,{wrap:!1,options:r}):d},S=(e,t,n,r={})=>{if(t==null&&s(e))return[e];if(!s(e)||!s(t))return v(e,t,r);if(typeof n==`function`)return S(e,t,1,{transform:n});if(a(n))return S(e,t,0,n);let i={...r};return i.capture===!0&&(i.wrap=!0),n=n||i.step||1,c(n)?c(e)&&c(t)?b(e,t,n,i):x(e,t,Math.max(Math.abs(n),1),i):n!=null&&!a(n)?y(n,i):S(e,t,1,n)};n.exports=S})),m=t(((e,t)=>{let n=p(),r=l();t.exports=(e,t={})=>{let i=(e,a={})=>{let o=r.isInvalidBrace(a),s=e.invalid===!0&&t.escapeInvalid===!0,c=o===!0||s===!0,l=t.escapeInvalid===!0?`\\`:``,u=``;if(e.isOpen===!0)return l+e.value;if(e.isClose===!0)return console.log(`node.isClose`,l,e.value),l+e.value;if(e.type===`open`)return c?l+e.value:`(`;if(e.type===`close`)return c?l+e.value:`)`;if(e.type===`comma`)return e.prev.type===`comma`?``:c?e.value:`|`;if(e.value)return e.value;if(e.nodes&&e.ranges>0){let i=r.reduce(e.nodes),a=n(...i,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(a.length!==0)return i.length>1&&a.length>1?`(${a})`:a}if(e.nodes)for(let t of e.nodes)u+=i(t,e);return u};return i(e)}})),h=t(((e,t)=>{let n=p(),r=u(),i=l(),a=(e=``,t=``,n=!1)=>{let r=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return n?i.flatten(t).map(e=>`{${e}}`):t;for(let i of e)if(Array.isArray(i))for(let e of i)r.push(a(e,t,n));else for(let e of t)n===!0&&typeof e==`string`&&(e=`{${e}}`),r.push(Array.isArray(e)?a(i,e,n):i+e);return i.flatten(r)};t.exports=(e,t={})=>{let o=t.rangeLimit===void 0?1e3:t.rangeLimit,s=(e,c={})=>{e.queue=[];let l=c,u=c.queue;for(;l.type!==`brace`&&l.type!==`root`&&l.parent;)l=l.parent,u=l.queue;if(e.invalid||e.dollar){u.push(a(u.pop(),r(e,t)));return}if(e.type===`brace`&&e.invalid!==!0&&e.nodes.length===2){u.push(a(u.pop(),[`{}`]));return}if(e.nodes&&e.ranges>0){let s=i.reduce(e.nodes);if(i.exceedsLimit(...s,t.step,o))throw RangeError(`expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.`);let c=n(...s,t);c.length===0&&(c=r(e,t)),u.push(a(u.pop(),c)),e.nodes=[];return}let d=i.encloseBrace(e),f=e.queue,p=e;for(;p.type!==`brace`&&p.type!==`root`&&p.parent;)p=p.parent,f=p.queue;for(let t=0;t<e.nodes.length;t++){let n=e.nodes[t];if(n.type===`comma`&&e.type===`brace`){t===1&&f.push(``),f.push(``);continue}if(n.type===`close`){u.push(a(u.pop(),f,d));continue}if(n.value&&n.type!==`open`){f.push(a(f.pop(),n.value));continue}n.nodes&&s(n,e)}return f};return i.flatten(s(e))}})),g=t(((e,t)=>{t.exports={MAX_LENGTH:1e4,CHAR_0:`0`,CHAR_9:`9`,CHAR_UPPERCASE_A:`A`,CHAR_LOWERCASE_A:`a`,CHAR_UPPERCASE_Z:`Z`,CHAR_LOWERCASE_Z:`z`,CHAR_LEFT_PARENTHESES:`(`,CHAR_RIGHT_PARENTHESES:`)`,CHAR_ASTERISK:`*`,CHAR_AMPERSAND:`&`,CHAR_AT:`@`,CHAR_BACKSLASH:`\\`,CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:`\r`,CHAR_CIRCUMFLEX_ACCENT:`^`,CHAR_COLON:`:`,CHAR_COMMA:`,`,CHAR_DOLLAR:`$`,CHAR_DOT:`.`,CHAR_DOUBLE_QUOTE:`"`,CHAR_EQUAL:`=`,CHAR_EXCLAMATION_MARK:`!`,CHAR_FORM_FEED:`\f`,CHAR_FORWARD_SLASH:`/`,CHAR_HASH:`#`,CHAR_HYPHEN_MINUS:`-`,CHAR_LEFT_ANGLE_BRACKET:`<`,CHAR_LEFT_CURLY_BRACE:`{`,CHAR_LEFT_SQUARE_BRACKET:`[`,CHAR_LINE_FEED:`
|
|
37
|
+
`,CHAR_NO_BREAK_SPACE:`\xA0`,CHAR_PERCENT:`%`,CHAR_PLUS:`+`,CHAR_QUESTION_MARK:`?`,CHAR_RIGHT_ANGLE_BRACKET:`>`,CHAR_RIGHT_CURLY_BRACE:`}`,CHAR_RIGHT_SQUARE_BRACKET:`]`,CHAR_SEMICOLON:`;`,CHAR_SINGLE_QUOTE:`'`,CHAR_SPACE:` `,CHAR_TAB:` `,CHAR_UNDERSCORE:`_`,CHAR_VERTICAL_LINE:`|`,CHAR_ZERO_WIDTH_NOBREAK_SPACE:``}})),_=t(((e,t)=>{let n=u(),{MAX_LENGTH:r,CHAR_BACKSLASH:i,CHAR_BACKTICK:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:c,CHAR_RIGHT_PARENTHESES:l,CHAR_LEFT_CURLY_BRACE:d,CHAR_RIGHT_CURLY_BRACE:f,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:m,CHAR_DOUBLE_QUOTE:h,CHAR_SINGLE_QUOTE:_,CHAR_NO_BREAK_SPACE:v,CHAR_ZERO_WIDTH_NOBREAK_SPACE:y}=g();t.exports=(e,t={})=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);let u=t||{},g=typeof u.maxLength==`number`?Math.min(r,u.maxLength):r;if(e.length>g)throw SyntaxError(`Input length (${e.length}), exceeds max characters (${g})`);let b={type:`root`,input:e,nodes:[]},x=[b],S=b,C=b,w=0,T=e.length,E=0,D=0,O,k=()=>e[E++],A=e=>{if(e.type===`text`&&C.type===`dot`&&(C.type=`text`),C&&C.type===`text`&&e.type===`text`){C.value+=e.value;return}return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e};for(A({type:`bos`});E<T;)if(S=x[x.length-1],O=k(),!(O===y||O===v)){if(O===i){A({type:`text`,value:(t.keepEscaping?O:``)+k()});continue}if(O===m){A({type:`text`,value:`\\`+O});continue}if(O===p){w++;let e;for(;E<T&&(e=k());){if(O+=e,e===p){w++;continue}if(e===i){O+=k();continue}if(e===m&&(w--,w===0))break}A({type:`text`,value:O});continue}if(O===c){S=A({type:`paren`,nodes:[]}),x.push(S),A({type:`text`,value:O});continue}if(O===l){if(S.type!==`paren`){A({type:`text`,value:O});continue}S=x.pop(),A({type:`text`,value:O}),S=x[x.length-1];continue}if(O===h||O===_||O===a){let e=O,n;for(t.keepQuotes!==!0&&(O=``);E<T&&(n=k());){if(n===i){O+=n+k();continue}if(n===e){t.keepQuotes===!0&&(O+=n);break}O+=n}A({type:`text`,value:O});continue}if(O===d){D++,S=A({type:`brace`,open:!0,close:!1,dollar:C.value&&C.value.slice(-1)===`$`||S.dollar===!0,depth:D,commas:0,ranges:0,nodes:[]}),x.push(S),A({type:`open`,value:O});continue}if(O===f){if(S.type!==`brace`){A({type:`text`,value:O});continue}S=x.pop(),S.close=!0,A({type:`close`,value:O}),D--,S=x[x.length-1];continue}if(O===o&&D>0){if(S.ranges>0){S.ranges=0;let e=S.nodes.shift();S.nodes=[e,{type:`text`,value:n(S)}]}A({type:`comma`,value:O}),S.commas++;continue}if(O===s&&D>0&&S.commas===0){let e=S.nodes;if(D===0||e.length===0){A({type:`text`,value:O});continue}if(C.type===`dot`){if(S.range=[],C.value+=O,C.type=`range`,S.nodes.length!==3&&S.nodes.length!==5){S.invalid=!0,S.ranges=0,C.type=`text`;continue}S.ranges++,S.args=[];continue}if(C.type===`range`){e.pop();let t=e[e.length-1];t.value+=C.value+O,C=t,S.ranges--;continue}A({type:`dot`,value:O});continue}A({type:`text`,value:O})}do if(S=x.pop(),S.type!==`root`){S.nodes.forEach(e=>{e.nodes||(e.type===`open`&&(e.isOpen=!0),e.type===`close`&&(e.isClose=!0),e.nodes||(e.type=`text`),e.invalid=!0)});let e=x[x.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}while(x.length>0);return A({type:`eos`}),b}})),v=t(((e,t)=>{let n=u(),r=m(),i=h(),a=_(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};o.parse=(e,t={})=>a(e,t),o.stringify=(e,t={})=>n(typeof e==`string`?o.parse(e,t):e,t),o.compile=(e,t={})=>(typeof e==`string`&&(e=o.parse(e,t)),r(e,t)),o.expand=(e,t={})=>{typeof e==`string`&&(e=o.parse(e,t));let n=i(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n},o.create=(e,t={})=>e===``||e.length<3?[e]:t.expand===!0?o.expand(e,t):o.compile(e,t),t.exports=o})),y=t(((t,n)=>{let r=e(`path`),i=`[^\\\\/]`,a=`[^/]`,o=`(?:\\/|$)`,s=`(?:^|\\/)`,c=`\\.{1,2}${o}`,l={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:a,END_ANCHOR:o,DOTS_SLASH:c,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${s}${c})`,NO_DOT_SLASH:`(?!\\.{0,1}${o})`,NO_DOTS_SLASH:`(?!${c})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${a}*?`,START_ANCHOR:s},u={...l,SLASH_LITERAL:`[\\\\/]`,QMARK:i,STAR:`${i}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`};n.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:r.sep,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?u:l}}})),b=t((t=>{let n=e(`path`),r=process.platform===`win32`,{REGEX_BACKSLASH:i,REGEX_REMOVE_BACKSLASH:a,REGEX_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_GLOBAL:s}=y();t.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),t.hasRegexChars=e=>o.test(e),t.isRegexChar=e=>e.length===1&&t.hasRegexChars(e),t.escapeRegex=e=>e.replace(s,`\\$1`),t.toPosixSlashes=e=>e.replace(i,`/`),t.removeBackslashes=e=>e.replace(a,e=>e===`\\`?``:e),t.supportsLookbehinds=()=>{let e=process.version.slice(1).split(`.`).map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10},t.isWindows=e=>e&&typeof e.windows==`boolean`?e.windows:r===!0||n.sep===`\\`,t.escapeLast=(e,n,r)=>{let i=e.lastIndexOf(n,r);return i===-1?e:e[i-1]===`\\`?t.escapeLast(e,n,i-1):`${e.slice(0,i)}\\${e.slice(i)}`},t.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},t.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r}})),x=t(((e,t)=>{let n=b(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=y(),v=e=>e===l||e===a,x=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let y=t||{},b=e.length-1,S=y.parts===!0||y.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,B=0,V,H,U={value:``,depth:0,isGlob:!1},W=()=>D>=b,G=()=>E.charCodeAt(D+1),K=()=>(V=H,E.charCodeAt(++D));for(;D<b;){H=K();let e;if(H===a){I=U.backslashes=!0,H=K(),H===u&&(F=!0);continue}if(F===!0||H===u){for(B++;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,K();continue}if(H===u){B++;continue}if(F!==!0&&H===s&&(H=K())===s){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&H===o){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===h&&(B--,B===0)){F=!1,A=U.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(H===l){if(C.push(D),w.push(U),U={value:``,depth:0,isGlob:!1},z===!0)continue;if(V===s&&D===O+1){O+=2;continue}k=D+1;continue}if(y.noext!==!0&&(H===p||H===i||H===r||H===m||H===c)&&G()===d){if(M=U.isGlob=!0,N=U.isExtglob=!0,z=!0,H===c&&D===O&&(R=!0),S===!0){for(;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,H=K();continue}if(H===g){M=U.isGlob=!0,z=!0;break}}continue}break}if(H===r){if(V===r&&(P=U.isGlobstar=!0),M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===m){if(M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===f){for(;W()!==!0&&(e=K());){if(e===a){I=U.backslashes=!0,K();continue}if(e===_){j=U.isBracket=!0,M=U.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(y.nonegate!==!0&&H===c&&D===O){L=U.negated=!0,O++;continue}if(y.noparen!==!0&&H===d){if(M=U.isGlob=!0,S===!0){for(;W()!==!0&&(H=K());){if(H===d){I=U.backslashes=!0,H=K();continue}if(H===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}y.noext===!0&&(N=!1,M=!1);let q=E,J=``,Y=``;O>0&&(J=E.slice(0,O),E=E.slice(O),k-=O),q&&M===!0&&k>0?(q=E.slice(0,k),Y=E.slice(k)):M===!0?(q=``,Y=E):q=E,q&&q!==``&&q!==`/`&&q!==E&&v(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),y.unescape===!0&&(Y&&=n.removeBackslashes(Y),q&&I===!0&&(q=n.removeBackslashes(q)));let X={prefix:J,input:e,start:O,base:q,glob:Y,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(y.tokens===!0&&(X.maxDepth=0,v(H)||w.push(U),X.tokens=w),y.parts===!0||y.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);y.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=J):w[n].value=a,x(w[n]),X.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),y.tokens&&(w[w.length-1].value=n,x(w[w.length-1]),X.maxDepth+=w[w.length-1].depth)}X.slashes=C,X.parts=T}return X}})),S=t(((e,t)=>{let n=y(),r=b(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let f={...t},p=typeof f.maxLength==`number`?Math.min(i,f.maxLength):i,m=e.length;if(m>p)throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);let h={type:`bos`,value:``,output:f.prepend||``},g=[h],_=f.capture?``:`?:`,v=r.isWindows(t),y=n.globChars(v),b=n.extglobChars(y),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:A,STAR:j,START_ANCHOR:M}=y,N=e=>`(${_}(?:(?!${M}${e.dot?T:x}).)*?)`,P=f.dot?``:E,F=f.dot?k:A,I=f.bash===!0?N(f):j;f.capture&&(I=`(${I})`),typeof f.noext==`boolean`&&(f.noextglob=f.noext);let L={input:e,index:-1,start:0,dot:f.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=r.removePrefix(e,L),m=e.length;let R=[],z=[],B=[],V=h,H,U=()=>L.index===m-1,W=L.peek=(t=1)=>e[L.index+t],G=L.advance=()=>e[++L.index]||``,K=()=>e.slice(L.index+1),q=(e=``,t=0)=>{L.consumed+=e,L.index+=t},J=e=>{L.output+=e.output==null?e.value:e.output,q(e.value)},Y=()=>{let e=1;for(;W()===`!`&&(W(2)!==`(`||W(3)===`?`);)G(),L.start++,e++;return e%2==0?!1:(L.negated=!0,L.start++,!0)},X=e=>{L[e]++,B.push(e)},Z=e=>{L[e]--,B.pop()},Q=e=>{if(V.type===`globstar`){let t=L.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||R.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(L.output=L.output.slice(0,-V.output.length),V.type=`star`,V.value=`*`,V.output=I,L.output+=V.output)}if(R.length&&e.type!==`paren`&&(R[R.length-1].inner+=e.value),(e.value||e.output)&&J(e),V&&V.type===`text`&&e.type===`text`){V.value+=e.value,V.output=(V.output||``)+e.value;return}e.prev=V,g.push(e),V=e},$=(e,t)=>{let n={...b[t],conditions:1,inner:``};n.prev=V,n.parens=L.parens,n.output=L.output;let r=(f.capture?`(`:``)+n.open;X(`parens`),Q({type:e,value:t,output:L.output?``:w}),Q({type:`paren`,extglob:!0,value:G(),output:r}),R.push(n)},ee=e=>{let n=e.close+(f.capture?`)`:``),r;if(e.type===`negate`){let i=I;e.inner&&e.inner.length>1&&e.inner.includes(`/`)&&(i=N(f)),(i!==I||U()||/^\)+$/.test(K()))&&(n=e.close=`)$))${i}`),e.inner.includes(`*`)&&(r=K())&&/^\.[^\\/.]+$/.test(r)&&(n=e.close=`)${d(r,{...t,fastpaths:!1}).output})${i})`),e.prev.type===`bos`&&(L.negatedExtglob=!0)}Q({type:`paren`,extglob:!0,value:H,output:n}),Z(`parens`)};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?k.repeat(a.length):``):o===0?F+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?I:``):I:t?e:`\\${e}`);return n===!0&&(i=f.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&f.contains===!0?(L.output=e,L):(L.output=r.wrapOutput(i,L,t),L)}for(;!U();){if(H=G(),H===`\0`)continue;if(H===`\\`){let e=W();if(e===`/`&&f.bash!==!0||e===`.`||e===`;`)continue;if(!e){H+=`\\`,Q({type:`text`,value:H});continue}let t=/^\\+/.exec(K()),n=0;if(t&&t[0].length>2&&(n=t[0].length,L.index+=n,n%2!=0&&(H+=`\\`)),f.unescape===!0?H=G():H+=G(),L.brackets===0){Q({type:`text`,value:H});continue}}if(L.brackets>0&&(H!==`]`||V.value===`[`||V.value===`[^`)){if(f.posix!==!1&&H===`:`){let e=V.value.slice(1);if(e.includes(`[`)&&(V.posix=!0,e.includes(`:`))){let e=V.value.lastIndexOf(`[`),t=V.value.slice(0,e),n=a[V.value.slice(e+2)];if(n){V.value=t+n,L.backtrack=!0,G(),!h.output&&g.indexOf(V)===1&&(h.output=w);continue}}}(H===`[`&&W()!==`:`||H===`-`&&W()===`]`)&&(H=`\\${H}`),H===`]`&&(V.value===`[`||V.value===`[^`)&&(H=`\\${H}`),f.posix===!0&&H===`!`&&V.value===`[`&&(H=`^`),V.value+=H,J({value:H});continue}if(L.quotes===1&&H!==`"`){H=r.escapeRegex(H),V.value+=H,J({value:H});continue}if(H===`"`){L.quotes=L.quotes===1?0:1,f.keepQuotes===!0&&Q({type:`text`,value:H});continue}if(H===`(`){X(`parens`),Q({type:`paren`,value:H});continue}if(H===`)`){if(L.parens===0&&f.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=R[R.length-1];if(e&&L.parens===e.parens+1){ee(R.pop());continue}Q({type:`paren`,value:H,output:L.parens?`)`:`\\)`}),Z(`parens`);continue}if(H===`[`){if(f.nobracket===!0||!K().includes(`]`)){if(f.nobracket!==!0&&f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));H=`\\${H}`}else X(`brackets`);Q({type:`bracket`,value:H});continue}if(H===`]`){if(f.nobracket===!0||V&&V.type===`bracket`&&V.value.length===1){Q({type:`text`,value:H,output:`\\${H}`});continue}if(L.brackets===0){if(f.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));Q({type:`text`,value:H,output:`\\${H}`});continue}Z(`brackets`);let e=V.value.slice(1);if(V.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(H=`/${H}`),V.value+=H,J({value:H}),f.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(V.value);if(L.output=L.output.slice(0,-V.value.length),f.literalBrackets===!0){L.output+=t,V.value=t;continue}V.value=`(${_}${t}|${V.value})`,L.output+=V.value;continue}if(H===`{`&&f.nobrace!==!0){X(`braces`);let e={type:`brace`,value:H,output:`(`,outputIndex:L.output.length,tokensIndex:L.tokens.length};z.push(e),Q(e);continue}if(H===`}`){let e=z[z.length-1];if(f.nobrace===!0||!e){Q({type:`text`,value:H,output:H});continue}let t=`)`;if(e.dots===!0){let e=g.slice(),n=[];for(let t=e.length-1;t>=0&&(g.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,f),L.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=L.output.slice(0,e.outputIndex),r=L.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,H=t=`\\}`,L.output=n;for(let e of r)L.output+=e.output||e.value}Q({type:`brace`,value:H,output:t}),Z(`braces`),z.pop();continue}if(H===`|`){R.length>0&&R[R.length-1].conditions++,Q({type:`text`,value:H});continue}if(H===`,`){let e=H,t=z[z.length-1];t&&B[B.length-1]===`braces`&&(t.comma=!0,e=`|`),Q({type:`comma`,value:H,output:e});continue}if(H===`/`){if(V.type===`dot`&&L.index===L.start+1){L.start=L.index+1,L.consumed=``,L.output=``,g.pop(),V=h;continue}Q({type:`slash`,value:H,output:C});continue}if(H===`.`){if(L.braces>0&&V.type===`dot`){V.value===`.`&&(V.output=x);let e=z[z.length-1];V.type=`dots`,V.output+=H,V.value+=H,e.dots=!0;continue}if(L.braces+L.parens===0&&V.type!==`bos`&&V.type!==`slash`){Q({type:`text`,value:H,output:x});continue}Q({type:`dot`,value:H,output:x});continue}if(H===`?`){if(!(V&&V.value===`(`)&&f.noextglob!==!0&&W()===`(`&&W(2)!==`?`){$(`qmark`,H);continue}if(V&&V.type===`paren`){let e=W(),t=H;if(e===`<`&&!r.supportsLookbehinds())throw Error(`Node.js v10 or higher is required for regex lookbehinds`);(V.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(K()))&&(t=`\\${H}`),Q({type:`text`,value:H,output:t});continue}if(f.dot!==!0&&(V.type===`slash`||V.type===`bos`)){Q({type:`qmark`,value:H,output:A});continue}Q({type:`qmark`,value:H,output:k});continue}if(H===`!`){if(f.noextglob!==!0&&W()===`(`&&(W(2)!==`?`||!/[!=<:]/.test(W(3)))){$(`negate`,H);continue}if(f.nonegate!==!0&&L.index===0){Y();continue}}if(H===`+`){if(f.noextglob!==!0&&W()===`(`&&W(2)!==`?`){$(`plus`,H);continue}if(V&&V.value===`(`||f.regex===!1){Q({type:`plus`,value:H,output:S});continue}if(V&&(V.type===`bracket`||V.type===`paren`||V.type===`brace`)||L.parens>0){Q({type:`plus`,value:H});continue}Q({type:`plus`,value:S});continue}if(H===`@`){if(f.noextglob!==!0&&W()===`(`&&W(2)!==`?`){Q({type:`at`,extglob:!0,value:H,output:``});continue}Q({type:`text`,value:H});continue}if(H!==`*`){(H===`$`||H===`^`)&&(H=`\\${H}`);let e=o.exec(K());e&&(H+=e[0],L.index+=e[0].length),Q({type:`text`,value:H});continue}if(V&&(V.type===`globstar`||V.star===!0)){V.type=`star`,V.star=!0,V.value+=H,V.output=I,L.backtrack=!0,L.globstar=!0,q(H);continue}let t=K();if(f.noextglob!==!0&&/^\([^?]/.test(t)){$(`star`,H);continue}if(V.type===`star`){if(f.noglobstar===!0){q(H);continue}let n=V.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(f.bash===!0&&(!i||t[0]&&t[0]!==`/`)){Q({type:`star`,value:H,output:``});continue}let o=L.braces>0&&(n.type===`comma`||n.type===`brace`),s=R.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){Q({type:`star`,value:H,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[L.index+4];if(n&&n!==`/`)break;t=t.slice(3),q(`/**`,3)}if(n.type===`bos`&&U()){V.type=`globstar`,V.value+=H,V.output=N(f),L.output=V.output,L.globstar=!0,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&U()){L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=N(f)+(f.strictSlashes?`)`:`|$)`),V.value+=H,L.globstar=!0,L.output+=n.output+V.output,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=`${N(f)}${C}|${C}${e})`,V.value+=H,L.output+=n.output+V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){V.type=`globstar`,V.value+=H,V.output=`(?:^|${C}|${N(f)}${C})`,L.output=V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}L.output=L.output.slice(0,-V.output.length),V.type=`globstar`,V.output=N(f),V.value+=H,L.output+=V.output,L.globstar=!0,q(H);continue}let n={type:`star`,value:H,output:I};if(f.bash===!0){n.output=`.*?`,(V.type===`bos`||V.type===`slash`)&&(n.output=P+n.output),Q(n);continue}if(V&&(V.type===`bracket`||V.type===`paren`)&&f.regex===!0){n.output=H,Q(n);continue}(L.index===L.start||V.type===`slash`||V.type===`dot`)&&(V.type===`dot`?(L.output+=D,V.output+=D):f.dot===!0?(L.output+=O,V.output+=O):(L.output+=P,V.output+=P),W()!==`*`&&(L.output+=w,V.output+=w)),Q(n)}for(;L.brackets>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L.output=r.escapeLast(L.output,`[`),Z(`brackets`)}for(;L.parens>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));L.output=r.escapeLast(L.output,`(`),Z(`parens`)}for(;L.braces>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));L.output=r.escapeLast(L.output,`{`),Z(`braces`)}if(f.strictSlashes!==!0&&(V.type===`star`||V.type===`bracket`)&&Q({type:`maybe_slash`,value:``,output:`${C}?`}),L.backtrack===!0){L.output=``;for(let e of L.tokens)L.output+=e.output==null?e.value:e.output,e.suffix&&(L.output+=e.suffix)}return L};d.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let l=r.isWindows(t),{DOT_LITERAL:u,SLASH_LITERAL:d,ONE_CHAR:f,DOTS_SLASH:p,NO_DOT:m,NO_DOTS:h,NO_DOTS_SLASH:g,STAR:_,START_ANCHOR:v}=n.globChars(l),y=a.dot?h:m,b=a.dot?g:m,x=a.capture?``:`?:`,S={negated:!1,prefix:``},C=a.bash===!0?`.*?`:_;a.capture&&(C=`(${C})`);let w=e=>e.noglobstar===!0?C:`(${x}(?:(?!${v}${e.dot?p:u}).)*?)`,T=e=>{switch(e){case`*`:return`${y}${f}${C}`;case`.*`:return`${u}${f}${C}`;case`*.*`:return`${y}${C}${u}${f}${C}`;case`*/*`:return`${y}${C}${d}${f}${b}${C}`;case`**`:return y+w(a);case`**/*`:return`(?:${y}${w(a)}${d})?${b}${f}${C}`;case`**/*.*`:return`(?:${y}${w(a)}${d})?${b}${C}${u}${f}${C}`;case`**/.*`:return`(?:${y}${w(a)}${d})?${u}${f}${C}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=T(t[1]);return n?n+u+t[2]:void 0}}},E=T(r.removePrefix(e,S));return E&&a.strictSlashes!==!0&&(E+=`${d}?`),E},t.exports=d})),C=t(((t,n)=>{let r=e(`path`),i=x(),a=S(),o=b(),s=y(),c=e=>e&&typeof e==`object`&&!Array.isArray(e),l=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>l(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=c(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=o.isWindows(t),s=r?l.compileRe(e,t):l.makeRe(e,t,!1,!0),u=s.state;delete s.state;let d=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};d=l(i.ignore,e,n)}let f=(n,r=!1)=>{let{isMatch:o,match:c,output:f}=l.test(n,s,t,{glob:e,posix:a}),p={glob:e,state:u,regex:s,posix:a,input:n,output:f,match:c,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):d(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(f.state=u),f};l.test=(e,t,n,{glob:r,posix:i}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let a=n||{},s=a.format||(i?o.toPosixSlashes:null),c=e===r,u=c&&s?s(e):e;return c===!1&&(u=s?s(e):e,c=u===r),(c===!1||a.capture===!0)&&(c=a.matchBase===!0||a.basename===!0?l.matchBase(e,t,n,i):t.exec(u)),{isMatch:!!c,match:c,output:u}},l.matchBase=(e,t,n,i=o.isWindows(n))=>(t instanceof RegExp?t:l.makeRe(t,n)).test(r.basename(e)),l.isMatch=(e,t,n)=>l(t,n)(e),l.parse=(e,t)=>Array.isArray(e)?e.map(e=>l.parse(e,t)):a(e,{...t,fastpaths:!1}),l.scan=(e,t)=>i(e,t),l.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,s=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(s=`^(?!${s}).*$`);let c=l.toRegex(s,t);return r===!0&&(c.state=e),c},l.makeRe=(e,t={},n=!1,r=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let i={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(i.output=a.fastpaths(e,t)),i.output||(i=a(e,t)),l.compileRe(i,t,n,r)},l.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},l.constants=s,n.exports=l})),w=t(((e,t)=>{t.exports=C()})),T=t(((t,n)=>{let r=e(`util`),i=v(),a=w(),o=b(),s=e=>e===``||e===`./`,c=e=>{let t=e.indexOf(`{`);return t>-1&&e.indexOf(`}`,t)>-1},l=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,i=new Set,o=new Set,s=0,c=e=>{o.add(e.output),n&&n.onResult&&n.onResult(e)};for(let o=0;o<t.length;o++){let l=a(String(t[o]),{...n,onResult:c},!0),u=l.state.negated||l.state.negatedExtglob;u&&s++;for(let t of e){let e=l(t,!0);(u?!e.isMatch:e.isMatch)&&(u?r.add(e.output):(r.delete(e.output),i.add(e.output)))}}let l=(s===t.length?[...o]:[...i]).filter(e=>!r.has(e));if(n&&l.length===0){if(n.failglob===!0)throw Error(`No matches found for "${t.join(`, `)}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(e=>e.replace(/\\/g,``)):t}return l};l.match=l,l.matcher=(e,t)=>a(e,t),l.isMatch=(e,t,n)=>a(t,n)(e),l.any=l.isMatch,l.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,i=[],a=e=>{n.onResult&&n.onResult(e),i.push(e.output)},o=new Set(l(e,t,{...n,onResult:a}));for(let e of i)o.has(e)||r.add(e);return[...r]},l.contains=(e,t,n)=>{if(typeof e!=`string`)throw TypeError(`Expected a string: "${r.inspect(e)}"`);if(Array.isArray(t))return t.some(t=>l.contains(e,t,n));if(typeof t==`string`){if(s(e)||s(t))return!1;if(e.includes(t)||e.startsWith(`./`)&&e.slice(2).includes(t))return!0}return l.isMatch(e,t,{...n,contains:!0})},l.matchKeys=(e,t,n)=>{if(!o.isObject(e))throw TypeError(`Expected the first argument to be an object`);let r=l(Object.keys(e),t,n),i={};for(let t of r)i[t]=e[t];return i},l.some=(e,t,n)=>{let r=[].concat(e);for(let e of[].concat(t)){let t=a(String(e),n);if(r.some(e=>t(e)))return!0}return!1},l.every=(e,t,n)=>{let r=[].concat(e);for(let e of[].concat(t)){let t=a(String(e),n);if(!r.every(e=>t(e)))return!1}return!0},l.all=(e,t,n)=>{if(typeof e!=`string`)throw TypeError(`Expected a string: "${r.inspect(e)}"`);return[].concat(t).every(t=>a(t,n)(e))},l.capture=(e,t,n)=>{let r=o.isWindows(n),i=a.makeRe(String(e),{...n,capture:!0}).exec(r?o.toPosixSlashes(t):t);if(i)return i.slice(1).map(e=>e===void 0?``:e)},l.makeRe=(...e)=>a.makeRe(...e),l.scan=(...e)=>a.scan(...e),l.parse=(e,t)=>{let n=[];for(let r of[].concat(e||[]))for(let e of i(String(r),t))n.push(a.parse(e,t));return n},l.braces=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);return t&&t.nobrace===!0||!c(e)?[e]:i(e,t)},l.braceExpand=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);return l.braces(e,{...t,expand:!0})},l.hasBraces=c,n.exports=l})),E=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isAbsolute=t.partitionAbsoluteAndRelative=t.removeDuplicateSlashes=t.matchAny=t.convertPatternsToRe=t.makeRe=t.getPatternParts=t.expandBraceExpansion=t.expandPatternsWithBraceExpansion=t.isAffectDepthOfReadingPattern=t.endsWithSlashGlobStar=t.hasGlobStar=t.getBaseDirectory=t.isPatternRelatedToParentDirectory=t.getPatternsOutsideCurrentDirectory=t.getPatternsInsideCurrentDirectory=t.getPositivePatterns=t.getNegativePatterns=t.isPositivePattern=t.isNegativePattern=t.convertToNegativePattern=t.convertToPositivePattern=t.isDynamicPattern=t.isStaticPattern=void 0;let n=e(`path`),r=c(),i=T(),a=/[*?]|^!/,o=/\[[^[]*]/,s=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,l=/[!*+?@]\([^(]*\)/,u=/,|\.\./,d=/(?!^)\/{2,}/g;function f(e,t={}){return!p(e,t)}t.isStaticPattern=f;function p(e,t={}){return e===``?!1:!!(t.caseSensitiveMatch===!1||e.includes(`\\`)||a.test(e)||o.test(e)||s.test(e)||t.extglob!==!1&&l.test(e)||t.braceExpansion!==!1&&m(e))}t.isDynamicPattern=p;function m(e){let t=e.indexOf(`{`);if(t===-1)return!1;let n=e.indexOf(`}`,t+1);if(n===-1)return!1;let r=e.slice(t,n);return u.test(r)}function h(e){return _(e)?e.slice(1):e}t.convertToPositivePattern=h;function g(e){return`!`+e}t.convertToNegativePattern=g;function _(e){return e.startsWith(`!`)&&e[1]!==`(`}t.isNegativePattern=_;function v(e){return!_(e)}t.isPositivePattern=v;function y(e){return e.filter(_)}t.getNegativePatterns=y;function b(e){return e.filter(v)}t.getPositivePatterns=b;function x(e){return e.filter(e=>!C(e))}t.getPatternsInsideCurrentDirectory=x;function S(e){return e.filter(C)}t.getPatternsOutsideCurrentDirectory=S;function C(e){return e.startsWith(`..`)||e.startsWith(`./..`)}t.isPatternRelatedToParentDirectory=C;function w(e){return r(e,{flipBackslashes:!1})}t.getBaseDirectory=w;function E(e){return e.includes(`**`)}t.hasGlobStar=E;function D(e){return e.endsWith(`/**`)}t.endsWithSlashGlobStar=D;function O(e){let t=n.basename(e);return D(e)||f(t)}t.isAffectDepthOfReadingPattern=O;function k(e){return e.reduce((e,t)=>e.concat(A(t)),[])}t.expandPatternsWithBraceExpansion=k;function A(e){let t=i.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort((e,t)=>e.length-t.length),t.filter(e=>e!==``)}t.expandBraceExpansion=A;function j(e,t){let{parts:n}=i.scan(e,Object.assign(Object.assign({},t),{parts:!0}));return n.length===0&&(n=[e]),n[0].startsWith(`/`)&&(n[0]=n[0].slice(1),n.unshift(``)),n}t.getPatternParts=j;function M(e,t){return i.makeRe(e,t)}t.makeRe=M;function N(e,t){return e.map(e=>M(e,t))}t.convertPatternsToRe=N;function P(e,t){return t.some(t=>t.test(e))}t.matchAny=P;function F(e){return e.replace(d,`/`)}t.removeDuplicateSlashes=F;function I(e){let t=[],n=[];for(let r of e)L(r)?t.push(r):n.push(r);return[t,n]}t.partitionAbsoluteAndRelative=I;function L(e){return n.isAbsolute(e)}t.isAbsolute=L})),D=t(((t,n)=>{let r=e(`stream`).PassThrough,i=Array.prototype.slice;n.exports=a;function a(){let e=[],t=i.call(arguments),n=!1,a=t[t.length-1];a&&!Array.isArray(a)&&a.pipe==null?t.pop():a={};let s=a.end!==!1,c=a.pipeError===!0;a.objectMode??=!0,a.highWaterMark??=64*1024;let l=r(a);function u(){for(let t=0,n=arguments.length;t<n;t++)e.push(o(arguments[t],a));return d(),this}function d(){if(n)return;n=!0;let t=e.shift();if(!t){process.nextTick(f);return}Array.isArray(t)||(t=[t]);let r=t.length+1;function i(){--r>0||(n=!1,d())}function a(e){function t(){e.removeListener(`merge2UnpipeEnd`,t),e.removeListener(`end`,t),c&&e.removeListener(`error`,n),i()}function n(e){l.emit(`error`,e)}if(e._readableState.endEmitted)return i();e.on(`merge2UnpipeEnd`,t),e.on(`end`,t),c&&e.on(`error`,n),e.pipe(l,{end:!1}),e.resume()}for(let e=0;e<t.length;e++)a(t[e]);i()}function f(){n=!1,l.emit(`queueDrain`),s&&l.end()}return l.setMaxListeners(0),l.add=u,l.on(`unpipe`,function(e){e.emit(`merge2UnpipeEnd`)}),t.length&&u.apply(null,t),l}function o(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)e[n]=o(e[n],t);else{if(!e._readableState&&e.pipe&&(e=e.pipe(r(t))),!e._readableState||!e.pause||!e.pipe)throw Error(`Only readable stream can be merged.`);e.pause()}return e}})),O=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.merge=void 0;let t=D();function n(e){let n=t(e);return e.forEach(e=>{e.once(`error`,e=>n.emit(`error`,e))}),n.once(`close`,()=>r(e)),n.once(`end`,()=>r(e)),n}e.merge=n;function r(e){e.forEach(e=>e.emit(`close`))}})),k=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isEmpty=e.isString=void 0;function t(e){return typeof e==`string`}e.isString=t;function n(e){return e===``}e.isEmpty=n})),A=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.string=e.stream=e.pattern=e.path=e.fs=e.errno=e.array=void 0,e.array=n(),e.errno=r(),e.fs=i(),e.path=a(),e.pattern=E(),e.stream=O(),e.string=k()})),j=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertPatternGroupToTask=e.convertPatternGroupsToTasks=e.groupPatternsByBaseDirectory=e.getNegativePatternsAsPositive=e.getPositivePatterns=e.convertPatternsToTasks=e.generate=void 0;let t=A();function n(e,n){let s=r(e,n),c=r(n.ignore,n),l=a(s),u=o(s,c),d=l.filter(e=>t.pattern.isStaticPattern(e,n)),f=l.filter(e=>t.pattern.isDynamicPattern(e,n)),p=i(d,u,!1),m=i(f,u,!0);return p.concat(m)}e.generate=n;function r(e,n){let r=e;return n.braceExpansion&&(r=t.pattern.expandPatternsWithBraceExpansion(r)),n.baseNameMatch&&(r=r.map(e=>e.includes(`/`)?e:`**/${e}`)),r.map(e=>t.pattern.removeDuplicateSlashes(e))}function i(e,n,r){let i=[],a=t.pattern.getPatternsOutsideCurrentDirectory(e),o=t.pattern.getPatternsInsideCurrentDirectory(e),u=s(a),d=s(o);return i.push(...c(u,n,r)),`.`in d?i.push(l(`.`,o,n,r)):i.push(...c(d,n,r)),i}e.convertPatternsToTasks=i;function a(e){return t.pattern.getPositivePatterns(e)}e.getPositivePatterns=a;function o(e,n){return t.pattern.getNegativePatterns(e).concat(n).map(t.pattern.convertToPositivePattern)}e.getNegativePatternsAsPositive=o;function s(e){return e.reduce((e,n)=>{let r=t.pattern.getBaseDirectory(n);return r in e?e[r].push(n):e[r]=[n],e},{})}e.groupPatternsByBaseDirectory=s;function c(e,t,n){return Object.keys(e).map(r=>l(r,e[r],t,n))}e.convertPatternGroupsToTasks=c;function l(e,n,r,i){return{dynamic:i,positive:n,negative:r,base:e,patterns:[].concat(n,r.map(t.pattern.convertToNegativePattern))}}e.convertPatternGroupToTask=l})),M=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.read=void 0;function t(e,t,i){t.fs.lstat(e,(a,o)=>{if(a!==null){n(i,a);return}if(!o.isSymbolicLink()||!t.followSymbolicLink){r(i,o);return}t.fs.stat(e,(e,a)=>{if(e!==null){if(t.throwErrorOnBrokenSymbolicLink){n(i,e);return}r(i,o);return}t.markSymbolicLink&&(a.isSymbolicLink=()=>!0),r(i,a)})})}e.read=t;function n(e,t){e(t)}function r(e,t){e(null,t)}})),N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.read=void 0;function t(e,t){let n=t.fs.lstatSync(e);if(!n.isSymbolicLink()||!t.followSymbolicLink)return n;try{let n=t.fs.statSync(e);return t.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(e){if(!t.throwErrorOnBrokenSymbolicLink)return n;throw e}}e.read=t})),P=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;let n=e(`fs`);t.FILE_SYSTEM_ADAPTER={lstat:n.lstat,stat:n.stat,lstatSync:n.lstatSync,statSync:n.statSync};function r(e){return e===void 0?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}t.createFileSystemAdapter=r})),F=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=P();e.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,t){return e??t}}})),I=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.statSync=e.stat=e.Settings=void 0;let t=M(),n=N(),r=F();e.Settings=r.default;function i(e,n,r){if(typeof n==`function`){t.read(e,o(),n);return}t.read(e,o(n),r)}e.stat=i;function a(e,t){let r=o(t);return n.read(e,r)}e.statSync=a;function o(e={}){return e instanceof r.default?e:new r.default(e)}})),L=t(((e,t)=>{
|
|
38
|
+
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
39
|
+
let n;t.exports=typeof queueMicrotask==`function`?queueMicrotask.bind(typeof window<`u`?window:global):e=>(n||=Promise.resolve()).then(e).catch(e=>setTimeout(()=>{throw e},0))})),R=t(((e,t)=>{
|
|
40
|
+
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
41
|
+
t.exports=r;let n=L();function r(e,t){let r,i,a,o=!0;Array.isArray(e)?(r=[],i=e.length):(a=Object.keys(e),r={},i=a.length);function s(e){function i(){t&&t(e,r),t=null}o?n(i):i()}function c(e,t,n){r[e]=n,(--i===0||t)&&s(t)}i?a?a.forEach(function(t){e[t](function(e,n){c(t,e,n)})}):e.forEach(function(e,t){e(function(e,n){c(t,e,n)})}):s(null),o=!1}})),z=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;let t=process.versions.node.split(`.`);if(t[0]===void 0||t[1]===void 0)throw Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);let n=Number.parseInt(t[0],10),r=Number.parseInt(t[1],10);e.IS_SUPPORT_READDIR_WITH_FILE_TYPES=n>10||n===10&&r>=10})),B=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDirentFromStats=void 0;var t=class{constructor(e,t){this.name=e,this.isBlockDevice=t.isBlockDevice.bind(t),this.isCharacterDevice=t.isCharacterDevice.bind(t),this.isDirectory=t.isDirectory.bind(t),this.isFIFO=t.isFIFO.bind(t),this.isFile=t.isFile.bind(t),this.isSocket=t.isSocket.bind(t),this.isSymbolicLink=t.isSymbolicLink.bind(t)}};function n(e,n){return new t(e,n)}e.createDirentFromStats=n})),V=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.fs=void 0,e.fs=B()})),H=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.joinPathSegments=void 0;function t(e,t,n){return e.endsWith(n)?e+t:e+n+t}e.joinPathSegments=t})),U=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readdir=e.readdirWithFileTypes=e.read=void 0;let t=I(),n=R(),r=z(),i=V(),a=H();function o(e,t,n){if(!t.stats&&r.IS_SUPPORT_READDIR_WITH_FILE_TYPES){s(e,t,n);return}l(e,t,n)}e.read=o;function s(e,t,r){t.fs.readdir(e,{withFileTypes:!0},(i,o)=>{if(i!==null){u(r,i);return}let s=o.map(n=>({dirent:n,name:n.name,path:a.joinPathSegments(e,n.name,t.pathSegmentSeparator)}));if(!t.followSymbolicLinks){d(r,s);return}n(s.map(e=>c(e,t)),(e,t)=>{if(e!==null){u(r,e);return}d(r,t)})})}e.readdirWithFileTypes=s;function c(e,t){return n=>{if(!e.dirent.isSymbolicLink()){n(null,e);return}t.fs.stat(e.path,(r,a)=>{if(r!==null){if(t.throwErrorOnBrokenSymbolicLink){n(r);return}n(null,e);return}e.dirent=i.fs.createDirentFromStats(e.name,a),n(null,e)})}}function l(e,r,o){r.fs.readdir(e,(s,c)=>{if(s!==null){u(o,s);return}n(c.map(n=>{let o=a.joinPathSegments(e,n,r.pathSegmentSeparator);return e=>{t.stat(o,r.fsStatSettings,(t,a)=>{if(t!==null){e(t);return}let s={name:n,path:o,dirent:i.fs.createDirentFromStats(n,a)};r.stats&&(s.stats=a),e(null,s)})}}),(e,t)=>{if(e!==null){u(o,e);return}d(o,t)})})}e.readdir=l;function u(e,t){e(t)}function d(e,t){e(null,t)}})),W=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readdir=e.readdirWithFileTypes=e.read=void 0;let t=I(),n=z(),r=V(),i=H();function a(e,t){return!t.stats&&n.IS_SUPPORT_READDIR_WITH_FILE_TYPES?o(e,t):s(e,t)}e.read=a;function o(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map(n=>{let a={dirent:n,name:n.name,path:i.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(a.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{let e=t.fs.statSync(a.path);a.dirent=r.fs.createDirentFromStats(a.name,e)}catch(e){if(t.throwErrorOnBrokenSymbolicLink)throw e}return a})}e.readdirWithFileTypes=o;function s(e,n){return n.fs.readdirSync(e).map(a=>{let o=i.joinPathSegments(e,a,n.pathSegmentSeparator),s=t.statSync(o,n.fsStatSettings),c={name:a,path:o,dirent:r.fs.createDirentFromStats(a,s)};return n.stats&&(c.stats=s),c})}e.readdir=s})),G=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;let n=e(`fs`);t.FILE_SYSTEM_ADAPTER={lstat:n.lstat,stat:n.stat,lstatSync:n.lstatSync,statSync:n.statSync,readdir:n.readdir,readdirSync:n.readdirSync};function r(e){return e===void 0?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}t.createFileSystemAdapter=r})),K=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=I(),i=G();t.default=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=i.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,n.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new r.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return e??t}}})),q=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Settings=e.scandirSync=e.scandir=void 0;let t=U(),n=W(),r=K();e.Settings=r.default;function i(e,n,r){if(typeof n==`function`){t.read(e,o(),n);return}t.read(e,o(n),r)}e.scandir=i;function a(e,t){let r=o(t);return n.read(e,r)}e.scandirSync=a;function o(e={}){return e instanceof r.default?e:new r.default(e)}})),J=t(((e,t)=>{function n(e){var t=new e,n=t;function r(){var r=t;return r.next?t=r.next:(t=new e,n=t),r.next=null,r}function i(e){n.next=e,n=e}return{get:r,release:i}}t.exports=n})),Y=t(((e,t)=>{var n=J();function r(e,t,r){if(typeof e==`function`&&(r=t,t=e,e=null),!(r>=1))throw Error(`fastqueue concurrency must be equal to or greater than 1`);var o=n(a),s=null,c=null,l=0,u=null,d={push:v,drain:i,saturated:i,pause:p,paused:!1,get concurrency(){return r},set concurrency(e){if(!(e>=1))throw Error(`fastqueue concurrency must be equal to or greater than 1`);if(r=e,!d.paused)for(;s&&l<r;)l++,b()},running:f,resume:g,idle:_,length:m,getQueue:h,unshift:y,empty:i,kill:x,killAndDrain:S,error:w,abort:C};return d;function f(){return l}function p(){d.paused=!0}function m(){for(var e=s,t=0;e;)e=e.next,t++;return t}function h(){for(var e=s,t=[];e;)t.push(e.value),e=e.next;return t}function g(){if(d.paused){if(d.paused=!1,s===null){l++,b();return}for(;s&&l<r;)l++,b()}}function _(){return l===0&&d.length()===0}function v(n,a){var f=o.get();f.context=e,f.release=b,f.value=n,f.callback=a||i,f.errorHandler=u,l>=r||d.paused?c?(c.next=f,c=f):(s=f,c=f,d.saturated()):(l++,t.call(e,f.value,f.worked))}function y(n,a){var f=o.get();f.context=e,f.release=b,f.value=n,f.callback=a||i,f.errorHandler=u,l>=r||d.paused?s?(f.next=s,s=f):(s=f,c=f,d.saturated()):(l++,t.call(e,f.value,f.worked))}function b(n){n&&o.release(n);var i=s;i&&l<=r?d.paused?l--:(c===s&&(c=null),s=i.next,i.next=null,t.call(e,i.value,i.worked),c===null&&d.empty()):--l===0&&d.drain()}function x(){s=null,c=null,d.drain=i}function S(){s=null,c=null,d.drain(),d.drain=i}function C(){var e=s;for(s=null,c=null;e;){var t=e.next,n=e.callback,r=e.errorHandler,a=e.value,o=e.context;e.value=null,e.callback=i,e.errorHandler=null,r&&r(Error(`abort`),a),n.call(o,Error(`abort`)),e.release(e),e=t}d.drain=i}function w(e){u=e}}function i(){}function a(){this.value=null,this.callback=i,this.next=null,this.release=i,this.context=null,this.errorHandler=null;var e=this;this.worked=function(t,n){var r=e.callback,a=e.errorHandler,o=e.value;e.value=null,e.callback=i,e.errorHandler&&a(t,o),r.call(e.context,t,n),e.release(e)}}function o(e,t,n){typeof e==`function`&&(n=t,t=e,e=null);function a(e,n){t.call(this,e).then(function(e){n(null,e)},n)}var o=r(e,a,n),s=o.push,c=o.unshift;return o.push=l,o.unshift=u,o.drained=d,o;function l(e){var t=new Promise(function(t,n){s(e,function(e,r){if(e){n(e);return}t(r)})});return t.catch(i),t}function u(e){var t=new Promise(function(t,n){c(e,function(e,r){if(e){n(e);return}t(r)})});return t.catch(i),t}function d(){return new Promise(function(e){process.nextTick(function(){if(o.idle())e();else{var t=o.drain;o.drain=function(){typeof t==`function`&&t(),e(),o.drain=t}}})})}}t.exports=r,t.exports.promise=o})),X=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.joinPathSegments=e.replacePathSegmentSeparator=e.isAppliedFilter=e.isFatalError=void 0;function t(e,t){return e.errorFilter===null?!0:!e.errorFilter(t)}e.isFatalError=t;function n(e,t){return e===null||e(t)}e.isAppliedFilter=n;function r(e,t){return e.split(/[/\\]/).join(t)}e.replacePathSegmentSeparator=r;function i(e,t,n){return e===``?t:e.endsWith(n)?e+t:e+n+t}e.joinPathSegments=i})),Z=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=X();e.default=class{constructor(e,n){this._root=e,this._settings=n,this._root=t.replacePathSegmentSeparator(e,n.pathSegmentSeparator)}}})),Q=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`events`),r=q(),i=Y(),a=X(),o=Z();t.default=class extends o.default{constructor(e,t){super(e,t),this._settings=t,this._scandir=r.scandir,this._emitter=new n.EventEmitter,this._queue=i(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit(`end`)}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw Error(`The reader is already destroyed`);this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on(`entry`,e)}onError(e){this._emitter.once(`error`,e)}onEnd(e){this._emitter.once(`end`,e)}_pushToQueue(e,t){let n={directory:e,base:t};this._queue.push(n,e=>{e!==null&&this._handleError(e)})}_worker(e,t){this._scandir(e.directory,this._settings.fsScandirSettings,(n,r)=>{if(n!==null){t(n,void 0);return}for(let t of r)this._handleEntry(t,e.base);t(null,void 0)})}_handleError(e){this._isDestroyed||!a.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit(`error`,e))}_handleEntry(e,t){if(this._isDestroyed||this._isFatalError)return;let n=e.path;t!==void 0&&(e.path=a.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),a.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&a.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,t===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit(`entry`,e)}}})),$=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(t=>{n(e,t)}),this._reader.onEntry(e=>{this._storage.push(e)}),this._reader.onEnd(()=>{r(e,this._storage)}),this._reader.read()}};function n(e,t){e(t)}function r(e,t){e(null,t)}})),ee=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`stream`),r=Q();t.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new r.default(this._root,this._settings),this._stream=new n.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit(`error`,e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}}})),te=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=q(),n=X(),r=Z();e.default=class extends r.default{constructor(){super(...arguments),this._scandir=t.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,t){this._queue.add({directory:e,base:t})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,t){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let e of n)this._handleEntry(e,t)}catch(e){this._handleError(e)}}_handleError(e){if(n.isFatalError(this._settings,e))throw e}_handleEntry(e,t){let r=e.path;t!==void 0&&(e.path=n.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),n.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&n.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(r,t===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}}})),ne=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=te();e.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings)}read(){return this._reader.read()}}})),re=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=q();t.default=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,1/0),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,n.sep),this.fsScandirSettings=new r.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return e??t}}})),ie=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Settings=e.walkStream=e.walkSync=e.walk=void 0;let t=$(),n=ee(),r=ne(),i=re();e.Settings=i.default;function a(e,n,r){if(typeof n==`function`){new t.default(e,c()).read(n);return}new t.default(e,c(n)).read(r)}e.walk=a;function o(e,t){let n=c(t);return new r.default(e,n).read()}e.walkSync=o;function s(e,t){let r=c(t);return new n.default(e,r).read()}e.walkStream=s;function c(e={}){return e instanceof i.default?e:new i.default(e)}})),ae=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=I(),i=A();t.default=class{constructor(e){this._settings=e,this._fsStatSettings=new r.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return n.resolve(this._settings.cwd,e)}_makeEntry(e,t){let n={name:t,path:t,dirent:i.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!i.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}}})),oe=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`stream`),r=I(),i=ie(),a=ae();t.default=class extends a.default{constructor(){super(...arguments),this._walkStream=i.walkStream,this._stat=r.stat}dynamic(e,t){return this._walkStream(e,t)}static(e,t){let r=e.map(this._getFullEntryPath,this),i=new n.PassThrough({objectMode:!0});i._write=(n,a,o)=>this._getEntry(r[n],e[n],t).then(e=>{e!==null&&t.entryFilter(e)&&i.push(e),n===r.length-1&&i.end(),o()}).catch(o);for(let e=0;e<r.length;e++)i.write(e);return i}_getEntry(e,t,n){return this._getStat(e).then(e=>this._makeEntry(e,t)).catch(e=>{if(n.errorFilter(e))return null;throw e})}_getStat(e){return new Promise((t,n)=>{this._stat(e,this._fsStatSettings,(e,r)=>e===null?t(r):n(e))})}}})),se=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=ie(),n=ae(),r=oe();e.default=class extends n.default{constructor(){super(...arguments),this._walkAsync=t.walk,this._readerStream=new r.default(this._settings)}dynamic(e,t){return new Promise((n,r)=>{this._walkAsync(e,t,(e,t)=>{e===null?n(t):r(e)})})}async static(e,t){let n=[],r=this._readerStream.static(e,t);return new Promise((e,t)=>{r.once(`error`,t),r.on(`data`,e=>n.push(e)),r.once(`end`,()=>e(n))})}}})),ce=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=A();e.default=class{constructor(e,t,n){this._patterns=e,this._settings=t,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let t=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(t);this._storage.push({complete:n.length<=1,pattern:e,segments:t,sections:n})}}_getPatternSegments(e){return t.pattern.getPatternParts(e,this._micromatchOptions).map(e=>t.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:t.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e})}_splitSegmentsIntoSections(e){return t.array.splitWhen(e,e=>e.dynamic&&t.pattern.hasGlobStar(e.pattern))}}})),le=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=ce();e.default=class extends t.default{match(e){let t=e.split(`/`),n=t.length,r=this._storage.filter(e=>!e.complete||e.segments.length>n);for(let e of r){let r=e.sections[0];if(!e.complete&&n>r.length||t.every((t,n)=>{let r=e.segments[n];return!!(r.dynamic&&r.patternRe.test(t)||!r.dynamic&&r.pattern===t)}))return!0}return!1}}})),ue=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=A(),n=le();e.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t}getFilter(e,t,n){let r=this._getMatcher(t),i=this._getNegativePatternsRe(n);return t=>this._filter(e,t,r,i)}_getMatcher(e){return new n.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let n=e.filter(t.pattern.isAffectDepthOfReadingPattern);return t.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(e,n,r,i){if(this._isSkippedByDeep(e,n.path)||this._isSkippedSymbolicLink(n))return!1;let a=t.path.removeLeadingDotSegment(n.path);return this._isSkippedByPositivePatterns(a,r)?!1:this._isSkippedByNegativePatterns(a,i)}_isSkippedByDeep(e,t){return this._settings.deep===1/0?!1:this._getEntryLevel(e,t)>=this._settings.deep}_getEntryLevel(e,t){let n=t.split(`/`).length;return e===``?n:n-e.split(`/`).length}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,t){return!this._settings.baseNameMatch&&!t.match(e)}_isSkippedByNegativePatterns(e,n){return!t.pattern.matchAny(e,n)}}})),de=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=A();e.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t,this.index=new Map}getFilter(e,n){let[r,i]=t.pattern.partitionAbsoluteAndRelative(n),a={positive:{all:t.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:t.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:t.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return e=>this._filter(e,a)}_filter(e,n){let r=t.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(r)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(r,n,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(r),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,t,n){return!(!this._isMatchToPatterns(e,t.positive.all,n)||this._isMatchToPatterns(e,t.negative.relative,n)||this._isMatchToAbsoluteNegative(e,t.negative.absolute,n))}_isMatchToAbsoluteNegative(e,n,r){if(n.length===0)return!1;let i=t.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,n,r)}_isMatchToPatterns(e,n,r){if(n.length===0)return!1;let i=t.pattern.matchAny(e,n);return!i&&r?t.pattern.matchAny(e+`/`,n):i}}})),fe=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=A();e.default=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return t.errno.isEnoentCodeError(e)||this._settings.suppressErrors}}})),pe=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=A();e.default=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let n=e.path;return this._settings.absolute&&(n=t.path.makeAbsolute(this._settings.cwd,n),n=t.path.unixify(n)),this._settings.markDirectories&&e.dirent.isDirectory()&&(n+=`/`),this._settings.objectMode?Object.assign(Object.assign({},e),{path:n}):n}}})),me=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=ue(),i=de(),a=fe(),o=pe();t.default=class{constructor(e){this._settings=e,this.errorFilter=new a.default(this._settings),this.entryFilter=new i.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new r.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new o.default(this._settings)}_getRootDirectory(e){return n.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let t=e.base===`.`?``:e.base;return{basePath:t,pathSegmentSeparator:`/`,concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(t,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}}})),he=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=se(),n=me();e.default=class extends n.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}async read(e){let t=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(t,e,n)).map(e=>n.transform(e))}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}})),ge=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`stream`),r=oe(),i=me();t.default=class extends i.default{constructor(){super(...arguments),this._reader=new r.default(this._settings)}read(e){let t=this._getRootDirectory(e),r=this._getReaderOptions(e),i=this.api(t,e,r),a=new n.Readable({objectMode:!0,read:()=>{}});return i.once(`error`,e=>a.emit(`error`,e)).on(`data`,e=>a.emit(`data`,r.transform(e))).once(`end`,()=>a.emit(`end`)),a.once(`close`,()=>i.destroy()),a}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}})),_e=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=I(),n=ie(),r=ae();e.default=class extends r.default{constructor(){super(...arguments),this._walkSync=n.walkSync,this._statSync=t.statSync}dynamic(e,t){return this._walkSync(e,t)}static(e,t){let n=[];for(let r of e){let e=this._getFullEntryPath(r),i=this._getEntry(e,r,t);i===null||!t.entryFilter(i)||n.push(i)}return n}_getEntry(e,t,n){try{let n=this._getStat(e);return this._makeEntry(n,t)}catch(e){if(n.errorFilter(e))return null;throw e}}_getStat(e){return this._statSync(e,this._fsStatSettings)}}})),ve=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=_e(),n=me();e.default=class extends n.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}read(e){let t=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(t,e,n).map(n.transform)}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}})),ye=t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;let n=e(`fs`),r=e(`os`),i=Math.max(r.cpus().length,1);t.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:n.lstat,lstatSync:n.lstatSync,stat:n.stat,statSync:n.statSync,readdir:n.readdir,readdirSync:n.readdirSync},t.default=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,i),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,t){return e===void 0?t:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},t.DEFAULT_FILE_SYSTEM_ADAPTER),e)}}})),be=t(((e,t)=>{let n=j(),r=he(),i=ge(),a=ve(),o=ye(),s=A();async function c(e,t){u(e);let n=l(e,r.default,t),i=await Promise.all(n);return s.array.flatten(i)}(function(e){e.glob=e,e.globSync=t,e.globStream=r,e.async=e;function t(e,t){u(e);let n=l(e,a.default,t);return s.array.flatten(n)}e.sync=t;function r(e,t){u(e);let n=l(e,i.default,t);return s.stream.merge(n)}e.stream=r;function c(e,t){u(e);let r=[].concat(e),i=new o.default(t);return n.generate(r,i)}e.generateTasks=c;function d(e,t){u(e);let n=new o.default(t);return s.pattern.isDynamicPattern(e,n)}e.isDynamicPattern=d;function f(e){return u(e),s.path.escape(e)}e.escapePath=f;function p(e){return u(e),s.path.convertPathToPattern(e)}e.convertPathToPattern=p,(function(e){function t(e){return u(e),s.path.escapePosixPath(e)}e.escapePath=t;function n(e){return u(e),s.path.convertPosixPathToPattern(e)}e.convertPathToPattern=n})(e.posix||={}),(function(e){function t(e){return u(e),s.path.escapeWindowsPath(e)}e.escapePath=t;function n(e){return u(e),s.path.convertWindowsPathToPattern(e)}e.convertPathToPattern=n})(e.win32||={})})(c||={});function l(e,t,r){let i=[].concat(e),a=new o.default(r),s=n.generate(i,a),c=new t(a);return s.map(c.read,c)}function u(e){if(![].concat(e).every(e=>s.string.isString(e)&&!s.string.isEmpty(e)))throw TypeError(`Patterns must be a string (non empty) or an array of strings`)}t.exports=c}));export{T as n,be as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,t as _,u as v,v as y,w as b,x,y as S}from"./primitive-runtime-DcYYWy_6.mjs";import{isAbsolute as C,resolve as w}from"node:path";import{matchesFilter as ee,matchesSubscription as te}from"@makaio/framework/bus";import{ArtifactSubjects as ne,EXECUTION_LIST_DEFAULT_LIMIT as re,EXECUTION_LIST_MAX_LIMIT as ie,EXECUTION_LIST_MIN_LIMIT as ae,ExecutionHintsSchema as oe,JsonValueSchema as se,SessionSubjects as T,WORKFLOW_CANCELLED_REASON as E,WorkerNodeSubjects as ce,WorkflowNamespace as le,WorkflowSubjects as D,WorkflowWorkerSourceSchema as ue,createWorkflowCancelSubject as de,dep as fe,extensionToken as pe}from"@makaio/framework/contracts";import{BaseService as me}from"@makaio/framework/service-base";import{and as O,asc as k,count as he,desc as A,eq as j,getTableColumns as ge,isNotNull as _e,lt as ve,or as ye,sql as M,sum as N}from"drizzle-orm";import{executeTransaction as P,registerDrizzleHandlers as be}from"@makaio/framework/storage/drizzle";import{compile as xe}from"@makaio/framework/expression";import*as Se from"node:os";import{SessionToken as Ce}from"@makaio/framework/services";function F(e){return e.type===`global`?{scopeType:`global`,scopeKind:``,scopeId:``}:e.type===`external`?{scopeType:`external`,scopeKind:e.kind,scopeId:e.id}:{scopeType:e.type,scopeKind:``,scopeId:e.id}}function I(e){switch(e.scopeType){case`global`:return{type:`global`};case`external`:if(!e.scopeKind||!e.scopeId)throw Error(`Invalid external workflow scope row: scopeKind and scopeId are required`);return{type:`external`,kind:e.scopeKind,id:e.scopeId};case`workspace`:case`session`:if(!e.scopeId)throw Error(`Invalid ${e.scopeType} workflow scope row: scopeId is required`);return{type:e.scopeType,id:e.scopeId};default:{let t=e.scopeType;throw Error(`Unknown scope type: ${String(t)}`)}}}function we(e,t){let{scopeType:n,scopeKind:r,scopeId:i}=F(t);return[j(e.scopeType,n),j(e.scopeKind,r),j(e.scopeId,i)]}function L(e){return{id:e.id,name:e.name,description:e.description??void 0,root:e.root,inputSchema:e.inputSchema??void 0,configSchema:e.configSchema??void 0,outputSchema:e.outputSchema??void 0,artifact:e.artifact??void 0,triggers:e.triggers??void 0,scope:I(e),canvasLayout:e.canvasLayout??void 0,source:e.source??void 0,executionHints:e.executionHints??void 0}}function Te(e,t){let n=F(e.scope);return{id:e.id,name:e.name??e.id,root:e.root,description:e.description??null,inputSchema:e.inputSchema??null,configSchema:e.configSchema??null,outputSchema:e.outputSchema??null,artifact:e.artifact??null,triggers:e.triggers??null,canvasLayout:e.canvasLayout??null,source:e.source??null,executionHints:e.executionHints??null,createdAt:t,updatedAt:t,...n}}function Ee(e,t){let r=ge(p),i=e.on(g.get,async e=>{let n=await t.select().from(p).where(j(p.id,e.payload.id)).limit(1);e.setResult({workflow:n[0]?L(n[0]):null})}),a=e.on(g.set,async i=>{let a=i.payload.workflow,o=Date.now(),s=Te(a,o),c=await t.insert(p).values(s).onConflictDoNothing({target:p.id}).returning();if(c.length>0){await e.emit(n.definition.created,L(c[0])),i.setResult({id:a.id});return}let[l]=await t.update(p).set({name:s.name,root:s.root,updatedAt:o,createdAt:M`COALESCE(${r.createdAt}, ${o})`,description:s.description===null?M`${r.description}`:s.description,inputSchema:s.inputSchema===null?M`${r.inputSchema}`:s.inputSchema,configSchema:s.configSchema===null?M`${r.configSchema}`:s.configSchema,outputSchema:s.outputSchema===null?M`${r.outputSchema}`:s.outputSchema,artifact:s.artifact===null?M`${r.artifact}`:s.artifact,triggers:s.triggers===null?M`${r.triggers}`:s.triggers,canvasLayout:s.canvasLayout===null?M`${r.canvasLayout}`:s.canvasLayout,source:s.source===null?M`${r.source}`:s.source,executionHints:s.executionHints===null?M`${r.executionHints}`:s.executionHints,...F(a.scope)}).where(j(p.id,a.id)).returning();l&&await e.emit(n.definition.updated,L(l)),i.setResult({id:a.id})}),o=e.on(g.delete,async r=>{let i=(await t.delete(p).where(j(p.id,r.payload.id)).returning()).length>0;i&&await e.emit(n.definition.deleted,{id:r.payload.id}),r.setResult({deleted:i})}),s=e.on(g.list,async e=>{let n=e.payload,r=n.scope?we(p,n.scope):[],i=r.length>0?await t.select().from(p).where(O(...r)):await t.select().from(p);e.setResult({workflows:i.map(L)})});return()=>{i(),a(),o(),s()}}function De(e){return{frameId:e.frameId,nodeId:e.nodeId,nodeType:e.nodeType,path:e.path,parentFrameId:e.parentFrameId??void 0,status:e.status,attempt:e.attempt,iteration:e.iteration??void 0,branchKey:e.branchKey??void 0,...e.outputPresent?{output:e.output}:{},error:e.error??void 0,startedAt:e.startedAt??void 0,completedAt:e.completedAt??void 0}}function Oe(e,t){return{frameId:t.frameId,executionId:e,nodeId:t.nodeId,nodeType:t.nodeType,path:t.path,parentFrameId:t.parentFrameId??null,status:t.status,attempt:t.attempt,iteration:t.iteration??null,branchKey:t.branchKey??null,output:t.output===void 0?null:t.output,outputPresent:t.output!==void 0,error:t.error??null,startedAt:t.startedAt??null,completedAt:t.completedAt??null}}function ke(e,t){let n=e.on(g.setFrame,async e=>{let{executionId:n,frame:r}=e.payload,i=Oe(n,r);await t.insert(u).values(i).onConflictDoUpdate({target:u.frameId,set:i}),e.setResult({frameId:r.frameId})}),r=e.on(g.getFrame,async e=>{let n=await t.select().from(u).where(j(u.frameId,e.payload.frameId)).limit(1);e.setResult({frame:n[0]?De(n[0]):null})}),i=e.on(g.listFrames,async e=>{let n=await t.select().from(u).where(j(u.executionId,e.payload.executionId)).orderBy(k(u.startedAt),k(u.frameId));e.setResult({frames:n.map(De)})});return()=>{n(),r(),i()}}function Ae(e){return`${e.executionId}:${e.nodeId}:${e.frameId}`}function R(e){return{executionId:e.executionId,nodeId:e.nodeId,frameId:e.frameId,schema:e.schema,prompt:e.prompt??void 0,status:e.status,autoAction:e.autoAction,timeoutMs:e.timeoutMs??null,...e.resumeDataPresent?{resumeData:e.resumeData}:{},createdAt:e.createdAt,resolvedAt:e.resolvedAt??void 0}}function z(e){return{id:Ae(e),executionId:e.executionId,nodeId:e.nodeId,frameId:e.frameId,schema:e.schema,prompt:e.prompt??null,status:e.status,autoAction:e.autoAction,timeoutMs:e.timeoutMs,resumeData:e.resumeData===void 0?null:e.resumeData,resumeDataPresent:e.resumeData!==void 0,createdAt:e.createdAt,resolvedAt:e.resolvedAt??null}}function je(e,t){let n=e.on(g.setGateInstance,async e=>{let n=e.payload.gate,r=z(n);await t.insert(y).values(r).onConflictDoUpdate({target:y.id,set:r}),e.setResult({id:r.id})}),i=e.on(g.resolveWaitingGateInstance,async e=>{let n=e.payload.gate,r=z(n),i=await t.update(y).set(r).where(O(j(y.id,r.id),j(y.status,`waiting`))).returning({id:y.id});e.setResult({accepted:i.length===1})}),a=e.on(g.getGateInstance,async e=>{let{executionId:n,nodeId:r,frameId:i}=e.payload,a=[j(y.executionId,n),j(y.nodeId,r)];i!==void 0&&a.push(j(y.frameId,i));let o=await t.select().from(y).where(O(...a)).limit(1);e.setResult({gate:o[0]?R(o[0]):null})}),o=e.on(g.listGateInstances,async e=>{let n=await t.select().from(y).where(j(y.executionId,e.payload.executionId));e.setResult({gates:n.map(R)})}),s=e.on(g.listPausedGateTimeouts,async e=>{let n=await t.select({gate:y}).from(y).innerJoin(r,j(y.executionId,r.id)).where(O(j(y.status,`waiting`),j(r.status,`paused`),_e(y.timeoutMs)));e.setResult({gates:n.map(e=>R(e.gate))})});return()=>{n(),i(),a(),o(),s()}}function Me(e){return{executionId:e.executionId,frameId:e.frameId,stepId:e.stepId,stepType:e.stepType,status:e.status,startedAt:e.startedAt??void 0,completedAt:e.completedAt??void 0,durationMs:e.durationMs??void 0,inputTokens:e.inputTokens??void 0,outputTokens:e.outputTokens??void 0,estimatedCost:e.estimatedCost??void 0,toolCallCount:e.toolCallCount??void 0,input:e.input??void 0,output:e.output??void 0}}function Ne(e){return{sourceExecutionId:e.sourceExecutionId,targetExecutionId:e.targetExecutionId,linkType:e.linkType,metadata:e.metadata??void 0}}function Pe(e,t){let n=e.on(g.setSpan,async e=>{let{span:n}=e.payload;await t.insert(a).values(n).onConflictDoUpdate({target:[a.executionId,a.frameId],set:n}),e.setResult({id:`${n.executionId}:${n.frameId}`})}),r=e.on(g.listSpans,async e=>{let n=await t.select().from(a).where(j(a.executionId,e.payload.executionId)).orderBy(k(a.startedAt),k(a.stepId),k(a.frameId));e.setResult({spans:n.map(Me)})}),i=e.on(g.setExecutionLink,async e=>{let{link:n}=e.payload;await t.insert(l).values(n).onConflictDoUpdate({target:[l.sourceExecutionId,l.targetExecutionId],set:n}),e.setResult({id:`${n.sourceExecutionId}:${n.targetExecutionId}`})}),o=e.on(g.listExecutionLinks,async e=>{let{sourceExecutionId:n,targetExecutionId:r}=e.payload;if(n===void 0&&r===void 0)throw Error(`Either sourceExecutionId or targetExecutionId is required to list execution links.`);let i=[...n===void 0?[]:[j(l.sourceExecutionId,n)],...r===void 0?[]:[j(l.targetExecutionId,r)]],a=t.select().from(l).where(O(...i));e.setResult({links:(await a).map(Ne)})});return()=>{n(),r(),i(),o()}}function Fe(e){switch(e.kind){case`path`:return{sourceKind:`path`,sourcePath:e.path,sourceFilename:null,sourceCode:null};case`source`:return{sourceKind:`source`,sourcePath:null,sourceFilename:e.filename,sourceCode:e.source};case`definition`:return{sourceKind:`definition`,sourcePath:null,sourceFilename:null,sourceCode:null}}}function Ie(e){switch(e.sourceKind){case`path`:if(!e.sourcePath)throw Error(`Invalid run context row: sourcePath required for kind=path`);return{kind:`path`,path:e.sourcePath};case`source`:if(!e.sourceFilename)throw Error(`Invalid run context row: sourceFilename required for kind=source`);return{kind:`source`,filename:e.sourceFilename,source:e.sourceCode??``};case`definition`:return{kind:`definition`,workflowId:e.workflowId};default:throw Error(`Unknown run context source kind: ${String(e.sourceKind)}`)}}function Le(e){return{executionId:e.executionId,workflowId:e.workflowId,coordinatorSessionId:e.coordinatorSessionId,source:Ie(e),definitionSnapshot:e.definitionSnapshot??void 0,workerManifest:e.workerManifest,inputs:e.inputs,config:e.config??{},triggerPayload:e.triggerPayload,...e.artifactRef===null?{}:{artifactRef:e.artifactRef},scope:I(e),...e.executionHints===null?{}:{executionHints:e.executionHints},...e.dispatchMetadata===null?{}:{dispatchMetadata:e.dispatchMetadata},cancelSubject:e.cancelSubject,context:e.context,env:e.env,createdAt:e.createdAt,suspensionStrategy:e.suspensionStrategy??`wait-in-process`}}function Re(e){let t=Fe(e.source),n=F(e.scope);return{executionId:e.executionId,workflowId:e.workflowId,coordinatorSessionId:e.coordinatorSessionId,...t,definitionSnapshot:e.definitionSnapshot??null,workerManifest:e.workerManifest,inputs:e.inputs,config:e.config??{},triggerPayload:e.triggerPayload,artifactRef:e.artifactRef??null,executionHints:e.executionHints??null,dispatchMetadata:e.dispatchMetadata??null,...n,cancelSubject:e.cancelSubject,context:e.context,env:e.env,createdAt:e.createdAt,suspensionStrategy:e.suspensionStrategy}}async function ze(e,t){let n=Re(t);await e.insert(S).values(n).onConflictDoUpdate({target:S.executionId,set:n})}function Be(e,t){let n=e.on(g.setRunContext,async e=>{let n=e.payload.runContext;await ze(t,n),e.setResult({executionId:n.executionId})}),r=e.on(g.getRunContext,async e=>{let{executionId:n}=e.payload,r=await t.select().from(S).where(j(S.executionId,n)),i=r[0]?Le(r[0]):null;e.setResult({runContext:i})});return()=>{n(),r()}}function Ve(e){return{executionId:e.executionId,workflowId:e.workflowId,workflowName:e.workflowName??void 0,status:e.status,startedAt:e.startedAt,completedAt:e.completedAt??void 0,durationMs:e.durationMs??void 0,totalInputTokens:e.totalInputTokens??void 0,totalOutputTokens:e.totalOutputTokens??void 0,totalEstimatedCost:e.totalEstimatedCost??void 0,error:e.error??void 0,failedNodeId:e.failedNodeId??void 0}}async function B(e,t){await e.insert(b).values(t).onConflictDoUpdate({target:b.executionId,set:t})}async function V(e,t){let n=await e.select().from(b).where(j(b.executionId,t)).limit(1);return n[0]?Ve(n[0]):null}async function He(e,t={}){let{workflowId:n,status:r,limit:i=50,offset:a=0}=t,o=[...n===void 0?[]:[j(b.workflowId,n)],...r===void 0?[]:[j(b.status,r)]],s=o.length>0?O(...o):void 0,[c,l]=await Promise.all([e.select().from(b).where(s).orderBy(A(b.startedAt)).limit(i).offset(a),e.select({count:he()}).from(b).where(s)]);return{items:c.map(Ve),total:l[0]?.count??0}}async function H(e,n){await e.insert(t).values(n).onConflictDoUpdate({target:t.frameId,set:n})}async function U(e,n){return(await e.select().from(t).where(j(t.frameId,n)).limit(1))[0]??null}async function Ue(e,t){await e.insert(x).values(t).onConflictDoUpdate({target:x.id,set:t})}function We(e,t,n,r,i){return`${e}:${t}:${n}:${r}:${i}`}async function W(t,n){await t.insert(e).values(n).onConflictDoUpdate({target:e.id,set:n})}async function Ge(t,n){return(await t.select().from(e).where(j(e.id,n)).limit(1))[0]??null}function Ke(e,t,n){return`${e}:${t}:${n}`}async function qe(e,n){let[r]=await e.select({totalInputTokens:N(t.inputTokens),totalOutputTokens:N(t.outputTokens),totalEstimatedCost:N(t.estimatedCost)}).from(t).where(j(t.executionId,n));return{totalInputTokens:r?.totalInputTokens===null?0:Number(r?.totalInputTokens),totalOutputTokens:r?.totalOutputTokens===null?0:Number(r?.totalOutputTokens),totalEstimatedCost:r?.totalEstimatedCost===null?0:Number(r?.totalEstimatedCost)}}async function Je(e,t,n,r,i){let a=await U(t,n);if(a===null||i===void 0)return null;let o=await e.requestOptional(ne.resolve,{ref:{refClass:`artifact`,kind:r.kind,id:r.id,revision:i}}).catch(()=>void 0);if(o===void 0||!o.handled||o.data.artifact===null)return null;let{kind:s,schemaVersion:c,scope:l}=o.data.artifact;return{nodeId:a.nodeId,artifact:{kind:s,schemaVersion:c,scope:l}}}const Ye={user:`rejected`,timeout:`timed-out`,cancelled:`cancelled`};async function Xe(e,t,n){await B(t,{executionId:n.executionId,workflowId:n.workflowId,workflowName:null,status:`running`,startedAt:n.startedAt??Date.now(),completedAt:null,durationMs:null,totalInputTokens:null,totalOutputTokens:null,totalEstimatedCost:null,error:null,failedNodeId:null}),await K(e,n.executionId)}async function Ze(e,t,n){let r=n.completedAt??Date.now(),i=await V(t,n.executionId);await B(t,{executionId:n.executionId,workflowId:i?.workflowId??n.executionId,workflowName:i?.workflowName??null,status:`completed`,startedAt:i?.startedAt??r-n.totalDuration,completedAt:r,durationMs:n.totalDuration,totalInputTokens:i?.totalInputTokens??null,totalOutputTokens:i?.totalOutputTokens??null,totalEstimatedCost:i?.totalEstimatedCost??null,error:null,failedNodeId:null}),await K(e,n.executionId)}async function Qe(e,t,n,r,i,a,o){let s=await V(t,n),c=s?.startedAt??o;await B(t,{executionId:n,workflowId:s?.workflowId??n,workflowName:s?.workflowName??null,status:r,startedAt:c,completedAt:o,durationMs:o-c,totalInputTokens:s?.totalInputTokens??null,totalOutputTokens:s?.totalOutputTokens??null,totalEstimatedCost:s?.totalEstimatedCost??null,error:i,failedNodeId:a}),await K(e,n)}function $e(e,t){return[e.on(n.execution.started,async n=>{let{executionId:r}=n.payload;await G(`execution.started[${r}]`,()=>Xe(e,t,n.payload))}),e.on(n.execution.completed,async n=>{let{executionId:r}=n.payload;await G(`execution.completed[${r}]`,()=>Ze(e,t,n.payload))}),e.on(n.execution.failed,async n=>{let{executionId:r,error:i,failedStepId:a}=n.payload,o=n.payload.completedAt??Date.now();await G(`execution.failed[${r}]`,()=>Qe(e,t,r,`failed`,i,a??null,o))}),e.on(n.execution.cancelled,async n=>{let{executionId:r}=n.payload,i=n.payload.completedAt??Date.now();await G(`execution.cancelled[${r}]`,()=>Qe(e,t,r,`cancelled`,null,null,i))})]}async function et(e,t,n){let r=await qe(t,n);if(r.totalInputTokens>0||r.totalOutputTokens>0||r.totalEstimatedCost>0){let e=await V(t,n);e&&await B(t,{executionId:n,workflowId:e.workflowId,workflowName:e.workflowName??null,status:e.status,startedAt:e.startedAt,completedAt:e.completedAt??null,durationMs:e.durationMs??null,totalInputTokens:r.totalInputTokens,totalOutputTokens:r.totalOutputTokens,totalEstimatedCost:r.totalEstimatedCost,error:e.error??null,failedNodeId:e.failedNodeId??null})}}function tt(e,t,n){return e===null?{nodeId:t,nodeType:`station`,path:[],attempt:0,iteration:null,branchKey:null,startedAt:n,inputTokens:null,outputTokens:null,estimatedCost:null}:{nodeId:e.nodeId,nodeType:e.nodeType,path:e.path,attempt:e.attempt,iteration:e.iteration,branchKey:e.branchKey,startedAt:e.startedAt,inputTokens:e.inputTokens,outputTokens:e.outputTokens,estimatedCost:e.estimatedCost}}async function nt(e,t,n,r,i,a,o){let s=o??Date.now();await H(t,{frameId:r,executionId:n,...tt(await U(t,r),i,a===void 0?null:s-a),status:`completed`,completedAt:s,durationMs:a??null,error:null}),await et(e,t,n),await K(e,n)}async function rt(e,t,n,r,i,a,o,s){let c=s??Date.now();await H(t,{frameId:r,executionId:n,...tt(await U(t,r),i,o===void 0?null:c-o),status:`failed`,completedAt:c,durationMs:o??null,error:a}),await K(e,n)}function it(e,t){return[e.on(n.frame.started,async n=>{let{executionId:r,frameId:i,nodeId:a,nodeType:o,path:s,startedAt:c}=n.payload;await G(`frame.started[${i}]`,async()=>{await H(t,{frameId:i,executionId:r,nodeId:a,nodeType:o,path:s,status:`running`,attempt:0,iteration:null,branchKey:null,startedAt:c??Date.now(),completedAt:null,durationMs:null,inputTokens:null,outputTokens:null,estimatedCost:null,error:null}),await K(e,r)})}),e.on(n.frame.completed,async n=>{let{executionId:r,frameId:i,nodeId:a,duration:o,completedAt:s}=n.payload;await G(`frame.completed[${i}]`,()=>nt(e,t,r,i,a,o,s))}),e.on(n.frame.failed,async n=>{let{executionId:r,frameId:i,nodeId:a,error:o,duration:s,completedAt:c}=n.payload;await G(`frame.failed[${i}]`,()=>rt(e,t,r,i,a,o,s,c))})]}function at(e,t){return[e.on(n.gate.suspended,async n=>{let{executionId:r,frameId:i,nodeId:a,prompt:o}=n.payload;await G(`gate.suspended[${i}]`,async()=>{await W(t,{id:Ke(r,a,i),executionId:r,nodeId:a,frameId:i,status:`waiting`,prompt:o??null,openedAt:Date.now(),resolvedAt:null,resumeData:null}),await K(e,r)})}),e.on(n.gate.resumed,async n=>{let{executionId:r,frameId:i,nodeId:a,resumeData:o}=n.payload;await G(`gate.resumed[${i}]`,async()=>{let n=Ke(r,a,i),s=await Ge(t,n),c=Date.now();await W(t,{id:n,executionId:r,nodeId:a,frameId:i,status:`resumed`,prompt:s?.prompt??null,openedAt:s?.openedAt??c,resolvedAt:c,resumeData:o}),await K(e,r)})}),e.on(n.gate.resolved,async n=>ot(n.payload,e,t)),e.on(n.artifact.updated,async n=>{let{executionId:r,frameId:i,artifactRef:a,revision:o}=n.payload;await G(`artifact.updated[${r}:${i}]`,async()=>{let n=await Je(e,t,i,a,o);if(n===null)return;let s=Date.now();await Ue(t,{id:We(r,i,a.kind,a.id,s),executionId:r,frameId:i,nodeId:n.nodeId,artifact:n.artifact,revision:o??null,writtenAt:s}),await K(e,r)})})]}async function ot(e,t,n){let{executionId:r,frameId:i,stepId:a,source:o}=e;o===`user`&&e.action===`approve`||await G(`gate.resolved[${i}]`,async()=>{let s=Ke(r,a,i),c=await Ge(n,s),l=Date.now();await W(n,{id:s,executionId:r,nodeId:a,frameId:i,status:o!==`cancelled`&&e.action===`approve`?`resumed`:Ye[o],prompt:c?.prompt??null,openedAt:c?.openedAt??l,resolvedAt:l,resumeData:c?.resumeData??null}),await K(t,r)})}function st(e,t){let r=[...$e(e,t),...it(e,t),...at(e,t),e.on(n.worklog.get,async e=>{let{executionId:n}=e.payload,r=await V(t,n);e.setResult({summary:r})}),e.on(n.worklog.list,async e=>{let{workflowId:n,status:r,limit:i,offset:a}=e.payload,o=await He(t,{workflowId:n,status:r,limit:i,offset:a});e.setResult(o)})];return()=>{for(let e of r)e()}}async function G(e,t){try{await t()}catch(t){console.error(`[WorklogProjection] Write failed (${e}):`,t)}}async function K(e,t){try{await e.emit(n.worklog.changed,{executionId:t})}catch(e){console.error(`[WorklogProjection] worklog.changed emit failed for ${t}:`,e)}}function ct(e){return{id:e.id,workflowId:e.workflowId,coordinatorSessionId:e.coordinatorSessionId??void 0,status:e.status,inputs:e.inputs,config:{},error:e.error??void 0,reason:e.reason??void 0,startedAt:e.startedAt,completedAt:e.completedAt??void 0,triggerPayload:e.triggerPayload??void 0,scope:I(e)}}function lt(e){let t=F(e.scope);return{id:e.id,workflowId:e.workflowId,coordinatorSessionId:e.coordinatorSessionId??null,status:e.status,inputs:e.inputs,error:e.error??null,reason:e.reason??null,startedAt:e.startedAt,completedAt:e.completedAt??null,triggerPayload:e.triggerPayload??null,...t}}function ut(e,t,n,i){let a=[...e?[j(r.workflowId,e)]:[],...n?[j(r.status,n)]:[]];if(t&&a.push(...we(r,t)),i){let e=ye(ve(r.startedAt,i.startedAt),O(j(r.startedAt,i.startedAt),ve(r.id,i.id)));e&&a.push(e)}return a}async function dt(e,t,n){if(n.executionId!==t.id)throw Error(`setExecutionStart requires execution.id to match runContext.executionId`);let i=lt(t);await P(e,async e=>{await e.insert(r).values(i).onConflictDoUpdate({target:r.id,set:i}),await ze(e,n)})}async function ft(e,t,n){if(n.executionId!==t.id)throw Error(`restorePausedGateResumeState requires execution.id to match gate.executionId`);if(t.status!==`paused`||n.status!==`waiting`)throw Error(`restorePausedGateResumeState requires a paused execution and waiting gate`);let i=lt(t),a=z(n);await P(e,async e=>{await e.insert(r).values(i).onConflictDoUpdate({target:r.id,set:i}),await e.insert(y).values(a).onConflictDoUpdate({target:y.id,set:a})})}async function pt(e,t,n,i){return P(e,async e=>{if((await e.select().from(r).where(j(r.id,t)).limit(1))[0]?.status!==`paused`)return{cancelled:!1,gates:[]};let a=(await e.select().from(y).where(O(j(y.executionId,t),j(y.status,`waiting`)))).map(e=>({...R(e),status:`cancelled`,resolvedAt:n}));await e.update(r).set({status:`cancelled`,completedAt:n,reason:i??null}).where(j(r.id,t));for(let t of a){let n=z(t);await e.update(y).set(n).where(j(y.id,n.id))}return{cancelled:!0,gates:a}})}async function mt(e,t,n,i,a,o){return P(e,async e=>{if((await e.select({id:r.id}).from(r).where(j(r.id,t)).limit(1))[0]===void 0)return!1;let s={};return n!==void 0&&(s.status=n),i!==void 0&&(s.error=i),a!==void 0&&(s.reason=a),o!==void 0&&(s.completedAt=o),Object.keys(s).length>0&&await e.update(r).set(s).where(j(r.id,t)),!0})}function ht(e,t){let n=e.on(g.getExecution,async e=>{let{executionId:n}=e.payload,i=await t.select().from(r).where(j(r.id,n));e.setResult({execution:i[0]?ct(i[0]):null})}),i=e.on(g.setExecution,async e=>{let n=e.payload.execution,i=lt(n);await t.insert(r).values(i).onConflictDoUpdate({target:r.id,set:i}),e.setResult({id:n.id})}),a=e.on(g.setExecutionStart,async e=>{let n=e.payload.execution,r=e.payload.runContext;await dt(t,n,r),e.setResult({id:n.id,executionId:n.id})}),o=e.on(g.restorePausedGateResumeState,async e=>{let n=e.payload.execution,r=e.payload.gate;await ft(t,n,r),e.setResult({executionId:n.id,gateId:r.nodeId})}),s=e.on(g.updateExecution,async e=>{let{executionId:n,status:r,error:i,reason:a,completedAt:o}=e.payload,s=await mt(t,n,r,i,a,o);e.setResult({success:s})}),c=e.on(g.cancelPausedExecution,async e=>{let{executionId:n,completedAt:r,reason:i}=e.payload;e.setResult(await pt(t,n,r,i))}),l=e.on(g.listExecutions,async e=>{let{workflowId:n,scope:i,status:a,limit:o,cursor:s}=e.payload;if(n===void 0&&i===void 0)throw Error(`Either workflowId or scope is required to list executions.`);let c=ut(n,i,a,s),l=o??re;if(!Number.isInteger(l)||l<ae||l>ie)throw Error(`Execution list limit must be an integer between ${ae} and ${ie}.`);let u=await t.select().from(r).where(O(...c)).orderBy(A(r.startedAt),A(r.id)).limit(l);e.setResult({executions:u.map(ct)})});return()=>{n(),i(),a(),o(),s(),c(),l()}}function q(e,t,n){let r=Ee(e,t),i=ht(e,t),a=ke(e,t),o=je(e,t),s=Pe(e,t),c=Be(e,t),l=st(e,t);return()=>{r(),i(),a(),o(),s(),c(),l()}}function gt(e,t){if(e.origin.local)return!0;let n=e.transport?.peer;return n?.authenticated!==!0||n.id!==t?!1:n.kind===`workflow-execution`?!0:n.kind===`e2e`&&n.encrypted===!0}function _t(e){return[e.on(n.getDefinition,async t=>{let n=await e.request(g.get,{id:t.payload.id});t.setResult(n)}),e.on(n.setDefinition,async t=>{let n=await e.request(g.set,{workflow:t.payload.workflow});t.setResult(n)}),e.on(n.deleteDefinition,async t=>{let n=await e.request(g.delete,{id:t.payload.id});t.setResult(n)}),e.on(n.listDefinitions,async t=>{let n=await e.request(g.list,t.payload);t.setResult(n)}),e.on(n.getExecution,async t=>{let n=await e.request(g.getExecution,{executionId:t.payload.executionId});t.setResult(n)}),e.on(n.listExecutions,async t=>{let n=await e.request(g.listExecutions,t.payload);t.setResult(n)}),e.on(n.listSpans,async t=>{let n=await e.request(g.listSpans,{executionId:t.payload.executionId});t.setResult(n)}),e.on(n.listGateInstances,async t=>{let n=await e.request(g.listGateInstances,{executionId:t.payload.executionId});t.setResult(n)}),e.on(n.getRunContext,async t=>{let{executionId:n}=t.payload;if(!gt(t,n))throw Error(`Unauthorized: caller is not permitted to read run context for execution: ${n}`);let{runContext:r}=await e.request(g.getRunContext,{executionId:n});if(!r)throw Error(`Run context not found for execution: ${n}`);t.setResult(r)})]}function vt(e,t){return[e.on(n.listTriggerTypes,e=>{let n=t()?.getAll()??[];e.setResult({triggerTypes:n})})]}const yt=[`darwin`,`linux`,`win32`];function bt(e){return yt.find(t=>t===e)??`linux`}function xt(e,t){return t}function St(e,t){return{...t}}function Ct(e){return e.reason instanceof Error?e.reason.message:typeof e.reason==`string`&&e.reason.length>0?e.reason:E}async function wt(e,t,n){let r=e.activeExecutions.get(t);if(!r||r.execution.status!==`running`)return;let i=e.buildFinalizerDeps(),{execution:a}=await i.bus.request(g.getExecution,{executionId:t});a?.status===`running`&&(r.execution=a,await o(i,t,Ct(n))||console.error(`[WorkflowExecutor] Failed to persist runner cancellation for ${t}: execution not active`))}async function Tt(e,t){if(t.pausedAtGateId===void 0||t.pausedAtFrameId===void 0)throw Error(`Paused runner result for '${t.executionId}' is missing gate identity`);let{bus:r}=e.buildFinalizerDeps(),{execution:i}=await r.request(g.getExecution,{executionId:t.executionId});if(i?.status!==`running`){let n=e.activeExecutions.get(t.executionId);n!==void 0&&i?.status===`paused`&&(n.execution.status=`paused`,e.activeExecutions.delete(t.executionId));return}let a={...i,status:`paused`};await r.request(g.setExecution,{execution:a});let o=e.activeExecutions.get(t.executionId);o!==void 0&&(o.execution=a),await r.emit(n.execution.paused,{executionId:t.executionId,workflowId:t.workflowId,pausedAtGateId:t.pausedAtGateId,pausedAtFrameId:t.pausedAtFrameId}),e.activeExecutions.delete(t.executionId)}async function Et(e,t){let n=e.activeExecutions.get(t.executionId);if(!n||n.execution.status!==`running`)return;let r=e.buildFinalizerDeps(),{execution:i}=await r.bus.request(g.getExecution,{executionId:t.executionId});if(i?.status===`running`){if(n.execution=i,t.status===`completed`){await v(r,n.execution,t.executionId,n.execution.startedAt);return}if(t.status===`cancelled`){await o(r,t.executionId,t.reason??E);return}if(t.status===`failed`){await f(r,n.execution,t.executionId,t.error);return}}}function Dt(e,t){let{executionId:n,workflowId:r,filePath:i,coordinatorSessionId:a,sanitizedTriggerPayload:o,scope:s,workspaceRoot:c}=t,{workflowRunner:l,workflowAbortControllers:u,executionTasks:d,activeExecutions:p,config:m}=e,h=new AbortController;u.set(n,h);let g={source:{kind:`path`,path:i},executionId:n,workflowId:r,triggerPayload:o,inputs:{},config:{},scope:s,busUrl:m.busUrl,busAuth:m.busAuth,context:e.resolveWorkflowContext(c),env:m.platformDefaults.env??{},coordinatorSessionId:a,cancelSubject:`workflow.${n}.cancel`,suspensionStrategy:`wait-in-process`};return Promise.resolve().then(()=>l.run(g,h.signal)).then(async t=>{if(t.status===`paused`){await Tt(e,t);return}await Et(e,t)}).catch(async t=>{if(h.signal.aborted){await wt(e,n,h.signal).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist file runner cancellation for ${n}:`,e)});return}let r=p.get(n);if(r){let i=t instanceof Error?t.message:String(t);await f(e.buildFinalizerDeps(),r.execution,n,i).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist file runner boot failure for ${n}:`,e)})}}).finally(()=>{u.delete(n),d.delete(n),p.delete(n)})}function Ot(e,t){let{config:n}=e;return{source:t.source,...t.source.kind===`definition`?{definition:t.workflow}:{},executionId:t.executionId,workflowId:t.workflowId,triggerPayload:t.sanitizedTriggerPayload,inputs:t.boundInputs,config:t.boundConfig,...t.artifactRef===void 0?{}:{artifactRef:t.artifactRef},...t.executionHints===void 0?{}:{executionHints:t.executionHints},scope:t.scope,busUrl:n.busUrl,busAuth:n.busAuth,context:e.resolveWorkflowContext(t.workspaceRoot),env:n.platformDefaults.env??{},coordinatorSessionId:t.coordinatorSessionId,cancelSubject:`workflow.${t.executionId}.cancel`,suspensionStrategy:t.suspensionStrategy??`wait-in-process`}}function kt(e,t){let{executionId:n}=t,{workflowRunner:r,workflowAbortControllers:i,executionTasks:a,activeExecutions:o}=e,s=new AbortController;i.set(n,s);let c=Ot(e,t),l=t.dispatchMetadata===void 0?void 0:{dispatchMetadata:t.dispatchMetadata};return Promise.resolve().then(()=>r.run(c,s.signal,void 0,l)).then(async t=>{if(t.status===`paused`){await Tt(e,t);return}await Et(e,t)}).catch(async t=>{if(s.signal.aborted){await wt(e,n,s.signal).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist runner cancellation for ${n}:`,e)});return}let r=o.get(n);if(r){let i=t instanceof Error?t.message:String(t);await f(e.buildFinalizerDeps(),r.execution,n,i).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist runner boot failure for ${n}:`,e)})}}).finally(()=>{i.delete(n),a.delete(n),o.delete(n)})}function At(e,t,n={}){let r=jt(e,n);return{executionId:e.executionId,workflowId:e.workflowId,workflow:t,source:e.source,coordinatorSessionId:e.coordinatorSessionId,sanitizedTriggerPayload:e.triggerPayload,boundInputs:e.inputs,boundConfig:e.config??{},...e.artifactRef===void 0?{}:{artifactRef:e.artifactRef},...e.executionHints===void 0?{}:{executionHints:e.executionHints},scope:e.scope,workspaceRoot:e.context.repoPath,suspensionStrategy:e.suspensionStrategy,...r===void 0?{}:{dispatchMetadata:r}}}function jt(e,t){return t.resume===!0?{...e.dispatchMetadata,resume:!0}:e.dispatchMetadata}const Mt=/(?:^|[_-])(authorization|token|cookie|password|set[_-]?cookie|api[_-]?key|secret|credential|private[_-]?key|api[_-]?secret)(?:$|[_-])/i;function Nt(e){if(!e)return;let t={remainingBytes:65536},n={},r=Object.entries(e).slice(0,100);for(let[e,i]of r){if(t.remainingBytes<=0)break;let r=Pt(e,i,0,t);r!==void 0&&(n[e]=r)}return Object.keys(n).length>0?n:void 0}function Pt(e,t,n,r){if(!(r.remainingBytes<=0||n>6)&&(r.remainingBytes-=e.length,!(r.remainingBytes<=0))){if(Mt.test(e))return r.remainingBytes-=10,`[REDACTED]`;if(t===null)return r.remainingBytes-=4,null;if(typeof t==`string`){let e=t.slice(0,2e3);return r.remainingBytes-=e.length,e}if(typeof t==`number`||typeof t==`boolean`)return r.remainingBytes-=String(t).length,t;if(Array.isArray(t)){let i=[];for(let a of t.slice(0,100)){if(r.remainingBytes<=0)break;let t=Pt(e,a,n+1,r);t!==void 0&&i.push(t)}return i}if(typeof t==`object`){let e={},i=Object.entries(t).slice(0,100);for(let[t,a]of i){if(r.remainingBytes<=0)break;let i=Pt(t,a,n+1,r);i!==void 0&&(e[t]=i)}return e}}}function Ft(e,t,n){let r=t?.requirements?.capabilities??[];if(r.length!==0)return{run:(t,i)=>e.request(ce.dispatch,{config:t,requirements:{customCapabilities:r},...n===void 0?{}:{metadata:n}},{signal:i})}}function It(e,t){let n=Ft(e.bus,t.executionHints,t.dispatchMetadata);return n===void 0?e.workflowRunner===void 0?e.runExecution(t.executionId).finally(()=>{e.executionTasks.delete(t.executionId)}):kt(e.buildRunnerTaskDeps(e.workflowRunner),t):kt(e.buildRunnerTaskDeps(n),t)}async function Lt(e,t){try{await e.emit(n.execution.started,t)}catch(e){console.error(`[WorkflowExecutor] execution.started listener failed:`,e)}}async function Rt(e,t){await e.request(T.close,{sessionId:t}).catch(e=>{console.error(`[WorkflowExecutor] Failed to close coordinator session "${t}" after launch failure:`,e)})}function zt(e,t,n,r,i,a,o,s,c){let l={id:t,workflowId:n.id,coordinatorSessionId:r,status:`running`,inputs:i,config:a,startedAt:Date.now(),triggerPayload:o,scope:s};return e.set(t,{execution:l,workflow:n,runContext:c,runtimeHandlers:new Map}),l}async function Bt(e,t,n){await e.request(g.setExecutionStart,{execution:t,runContext:n})}function Vt(e,t){let n=e?.source;if(n===void 0)return;let r=ue.parse(n);return r.kind===`path`&&!C(r.path)?{...r,path:w(t,r.path)}:r}function Ht(e,t,n){return Vt(t,n)??{kind:`definition`,workflowId:e}}async function Ut(e,t,n,r){return e.set(t,n),await r,t}async function Wt(e,t){let{workflow:n}=await e.request(g.get,{id:t});if(!n)throw Error(`Workflow not found: ${t}`);return n}function Gt(e,t){if(e===void 0&&t===void 0)return;let n=[...new Set([...e?.capabilities??[],...t?.capabilities??[]])];return{...e,...t,...n.length>0&&{capabilities:n}}}function Kt(e,t){if(e===void 0&&t===void 0)return;let n=Gt(e?.requirements,t?.requirements),r=e?.providers!==void 0||t?.providers!==void 0?{...e?.providers,...t?.providers}:void 0;return{...e,...t,...n!==void 0&&{requirements:n},...r!==void 0&&{providers:r}}}function qt(e){return{...e,input:e.input===void 0?{}:e.input,config:e.config??{}}}async function Jt(e,t,n,r){let{sessionId:i}=await e.request(T.create,{parentSessionId:t,branchKind:`coordinator`,title:`Workflow: ${n}`,targetWorkingDirectory:r});return i}async function Yt(e,t,n={}){let{bus:r,activeExecutions:i,executionTasks:a}=e,{input:o,config:s,parentSessionId:c,triggerPayload:l,artifactRef:u,executionHints:d,scopeOverride:f}=qt(n),p=await Wt(r,t),m=h(`wfx`),g=Nt(l),_=xt(p,o),v=St(p,s),y=f??p.scope,b=Kt(p.executionHints,d),x=await e.resolveExecutionWorkspaceRoot(c),S=Ht(t,b,x),C=await Jt(r,c,p.name,x),w=!1;try{let n=e.buildRunContext({executionId:m,workflowId:t,coordinatorSessionId:C,source:S,...S.kind===`definition`?{definitionSnapshot:p}:{},inputs:_,config:v,scope:y,triggerPayload:g??{},...u===void 0?{}:{artifactRef:u},...b===void 0?{}:{executionHints:b},workspaceRoot:x}),o=zt(i,m,p,C,_,v,g,y,n);await Bt(r,o,n);let s=o.startedAt,c=Lt(r,{executionId:m,workflowId:t,coordinatorSessionId:C,startedAt:s}),l=It(e,{executionId:m,workflowId:t,workflow:p,source:S,coordinatorSessionId:C,sanitizedTriggerPayload:g??{},boundInputs:_,boundConfig:v,scope:y,...u===void 0?{}:{artifactRef:u},...b===void 0?{}:{executionHints:b},workspaceRoot:x,suspensionStrategy:n.suspensionStrategy});return w=!0,Ut(a,m,l,c)}catch(e){throw w||(i.delete(m),a.delete(m),await Rt(r,C)),e}}function Xt(e,t,n,r,i){e.set(t.id,{execution:t,workflow:{id:t.workflowId,name:n,scope:r,root:{id:`${t.workflowId}-root`,type:`sequence`,nodes:[]}},runContext:i,runtimeHandlers:new Map})}async function Zt(e,t,n={}){let{bus:r,config:i,activeExecutions:a,executionTasks:o}=e,{triggerPayload:s,scopeOverride:c}=n,l=h(`wfx`),u=Nt(s),d=c??{type:`global`},f=i.platformDefaults.cwd,{sessionId:p}=await r.request(T.create,{branchKind:`coordinator`,title:`Workflow: ${t}`,targetWorkingDirectory:f}),m=l,g={id:l,workflowId:m,coordinatorSessionId:p,status:`running`,inputs:{},config:{},startedAt:Date.now(),triggerPayload:u,scope:d},_=!1;try{let{workflowRunner:n}=e;if(n===void 0)throw Error(`[WorkflowExecutor] startFileExecution called without a workflow runner`);let i=e.buildRunContext({executionId:l,workflowId:m,coordinatorSessionId:p,source:{kind:`path`,path:t},inputs:{},config:{},scope:d,triggerPayload:u??{},workspaceRoot:f});await Bt(r,g,i),Xt(a,g,t,d,i);let s=Lt(r,{executionId:l,workflowId:m,coordinatorSessionId:p,startedAt:g.startedAt}),c=Dt(e.buildRunnerTaskDeps(n),{executionId:l,workflowId:m,filePath:t,coordinatorSessionId:p,sanitizedTriggerPayload:u??{},scope:d,workspaceRoot:f});return _=!0,Ut(o,l,c,s)}catch(e){throw _||(a.delete(l),o.delete(l),await Rt(r,p)),e}}var Qt=class{bus;resumePausedExecution;handles=new Map;constructor(e,t){this.bus=e,this.resumePausedExecution=t}dispose(){for(let e of this.handles.values())clearTimeout(e);this.handles.clear()}clear(e,t,n){let r=this.makeKey(e,t,n),i=this.handles.get(r);i!==void 0&&(clearTimeout(i),this.handles.delete(r))}schedule(e){e.timeoutMs!==null&&(this.clear(e.executionId,e.nodeId,e.frameId),this.scheduleNextWakeup({...e,timeoutMs:e.timeoutMs}))}scheduleNextWakeup(e){let t=this.makeKey(e.executionId,e.nodeId,e.frameId),n=Math.max(0,e.openedAt+e.timeoutMs-Date.now()),r=setTimeout(()=>{if(this.handles.delete(t),Date.now()<e.openedAt+e.timeoutMs){this.scheduleNextWakeup(e);return}this.handleExpiredWakeup(e)},Math.min(n,2147483647));this.handles.set(t,r)}scheduleNextWakeupAfterDelay(e,t){let n=this.makeKey(e.executionId,e.nodeId,e.frameId),r=setTimeout(()=>{this.handles.delete(n),this.handleExpiredWakeup(e)},t);this.handles.set(n,r)}async handleExpiredWakeup(e){try{await this.resumeTimedOutPausedGate(e)===`retry`&&this.scheduleNextWakeupAfterDelay(e,25)}catch(t){this.scheduleFailedWakeupRetry(e,t)}}scheduleFailedWakeupRetry(e,t){let n=(e.failedWakeupAttempts??0)+1;if(n>4){console.error(`[WorkflowExecutor] Giving up on timed-out gate '${e.nodeId}' after 4 failed wakeup retries:`,t);return}let r=Math.min(250*2**(n-1),2e3);console.error(`[WorkflowExecutor] Failed to resume timed-out gate '${e.nodeId}', retrying in ${r} ms:`,t),this.scheduleNextWakeupAfterDelay({...e,failedWakeupAttempts:n},r)}makeKey(e,t,n){return`${e}:${t}:${n}`}async resumeTimedOutPausedGate(e){this.clear(e.executionId,e.nodeId,e.frameId);let{gate:t}=await this.bus.request(g.getGateInstance,{executionId:e.executionId,nodeId:e.nodeId,frameId:e.frameId});if(t===null||t.status!==`waiting`)return`settled`;let{execution:n}=await this.bus.request(g.getExecution,{executionId:e.executionId});return n?.status===`running`?`retry`:n?.status===`paused`?(await this.resumePausedExecution(e.executionId),`resumed`):`settled`}};function $t(e){if(e!==void 0)return se.parse(e)}function en(e){if(e!==void 0)return oe.parse(e)}function tn(e,t){return{repoPath:t,makaioHome:e.makaioHome??process.env.MAKAIO_HOME??`${Se.homedir()}/.makaio`,os:bt(process.platform),arch:process.arch}}function nn(e,t){return{executionId:e.executionId,workflowId:e.workflowId,source:e.source,...e.definitionSnapshot===void 0?{}:{definitionSnapshot:e.definitionSnapshot},workerManifest:{packages:[]},inputs:e.inputs,config:e.config,scope:e.scope,triggerPayload:e.triggerPayload,...e.artifactRef===void 0?{}:{artifactRef:e.artifactRef},...e.executionHints===void 0?{}:{executionHints:e.executionHints},coordinatorSessionId:e.coordinatorSessionId,cancelSubject:`workflow.${e.executionId}.cancel`,context:tn(t,e.workspaceRoot),env:t.platformDefaults.env??{},createdAt:Date.now(),suspensionStrategy:e.suspensionStrategy??`wait-in-process`}}function rn(e){return e?.status===`paused`}function an(e){return e?.status===`waiting`}async function on(e,t,n,r,i,a,o){t.delete(i.id),n.delete(i.id),r.delete(i.id);try{await e.request(g.restorePausedGateResumeState,{execution:i,gate:a})}catch(e){console.error(`[WorkflowExecutor] Failed to restore paused gate '${o}' after resume launch failure:`,e)}}async function sn(e,t){if(t.suspensionStrategy===`wait-in-process`)return;let{frames:n}=await e.request(g.listFrames,{executionId:t.executionId});if(n.length===0)throw Error(`[WorkflowExecutor] Missing resume frames for paused execution: ${t.executionId}`)}function cn(e){return{executionId:e.executionId,nodeId:e.nodeId,frameId:e.frameId,timeoutMs:e.timeoutMs,openedAt:e.createdAt}}async function ln(e,t){if(t.frameId!==void 0){let{gate:n}=await e.request(g.getGateInstance,t);return an(n)?n:null}let{gates:n}=await e.request(g.listGateInstances,{executionId:t.executionId}),r=n.filter(e=>e.nodeId===t.nodeId&&e.status===`waiting`);return r.length===1?r[0]:null}var un=class extends me{static storage={drizzle:q};config;activeExecutions=new Map;executionTasks=new Map;shellAbortControllers=new Map;activeRunnerSteps=new Map;gateTimeoutScheduler;resumeDispatches=new Set;workflowAbortControllers=new Map;workflowRunner;triggerTypeRegistry;constructor(e,t,n){super(e),this.config={...s,...t},this.workflowRunner=n,this.gateTimeoutScheduler=new Qt(e,e=>this.resumePausedExecution(e))}setTriggerTypeRegistry(e){this.triggerTypeRegistry=e}getTriggerTypeRegistry(){return this.triggerTypeRegistry}async onInit(){this.registerExecutionHandlers();for(let e of _t(this.bus))this.addCleanup(e);for(let e of vt(this.bus,()=>this.triggerTypeRegistry))this.addCleanup(e);await this.rehydratePausedGateTimeouts()}async onDestroy(){let e=this.buildFinalizerDeps();await Promise.allSettled([...this.activeExecutions.keys()].map(async t=>{await o(e,t,`Workflow engine shutdown`)&&(this.workflowAbortControllers.get(t)?.abort(),this.workflowAbortControllers.delete(t))}));for(let e of this.workflowAbortControllers.values())e.abort();this.workflowAbortControllers.clear(),await Promise.allSettled(this.executionTasks.values());for(let e of this.shellAbortControllers.values())e.abort();this.shellAbortControllers.clear();for(let e of this.activeRunnerSteps.values())e.hardKillTimer&&clearTimeout(e.hardKillTimer);this.activeRunnerSteps.clear(),this.gateTimeoutScheduler.dispose(),await this.workflowRunner?.dispose?.(),this.activeExecutions.clear()}buildFinalizerDeps(){return{bus:this.bus,activeExecutions:this.activeExecutions,shellAbortControllers:this.shellAbortControllers,activeRunnerSteps:this.activeRunnerSteps,cancelTimeoutMs:this.config.cancelTimeoutMs}}buildRunnerTaskDeps(e){return{workflowRunner:e,workflowAbortControllers:this.workflowAbortControllers,executionTasks:this.executionTasks,activeExecutions:this.activeExecutions,buildFinalizerDeps:()=>this.buildFinalizerDeps(),resolveWorkflowContext:e=>tn(this.config,e),config:this.config}}async resolveExecutionWorkspaceRoot(e){if(!e)return this.config.platformDefaults.cwd;let{session:t}=await this.bus.request(T.get,{sessionId:e});return t?.targetWorkingDirectory??this.config.platformDefaults.cwd}buildStartDeps(){return{bus:this.bus,config:this.config,activeExecutions:this.activeExecutions,executionTasks:this.executionTasks,workflowRunner:this.workflowRunner,buildRunContext:e=>nn(e,this.config),buildRunnerTaskDeps:e=>this.buildRunnerTaskDeps(e),buildFinalizerDeps:()=>this.buildFinalizerDeps(),resolveExecutionWorkspaceRoot:e=>this.resolveExecutionWorkspaceRoot(e),runExecution:e=>this.runExecution(e)}}registerExecutionHandlers(){this.registerHandler(n.start,async e=>{let{workflowId:t,input:n,config:r,parentSessionId:i,triggerPayload:a,artifactRef:o,scope:s,executionHints:c}=e.payload,l=typeof r==`object`&&r&&!Array.isArray(r)?r:{};try{let r=await Yt(this.buildStartDeps(),t,{input:$t(n),config:l,parentSessionId:i,triggerPayload:a,artifactRef:o,executionHints:en(c),scopeOverride:s});e.setResult({executionId:r})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to start workflow: ${t}`)}}),this.registerHandler(n.runFile,async e=>{if(this.workflowRunner===void 0)throw Error(`workflow.runFile requires a workflow runner — configure a ThinWorkflowPiscinaRunner or equivalent.`);let{filePath:t,triggerPayload:n,scope:r}=e.payload;try{let i=await Zt(this.buildStartDeps(),t,{triggerPayload:n,scopeOverride:r});e.setResult({executionId:i})}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to start workflow file: ${t}`)}}),this.registerHandler(n.cancel,async e=>{let{executionId:t,reason:n}=e.payload;await this.bus.emit(de(`workflow.${t}.cancel`),{executionId:t,reason:n}).catch(e=>{console.error(`[WorkflowExecutor] Failed to emit workflow cancel for ${t}:`,e)});let r=this.workflowAbortControllers.get(t);if(r){r.abort(n??E);let i=await o(this.buildFinalizerDeps(),t,n);e.setResult({cancelled:i});return}let i=await o(this.buildFinalizerDeps(),t,n);e.setResult({cancelled:i})}),this.registerGateTimeoutHandlers(),this.addCleanup(this.bus.on(n.gate.respond,async e=>{let{executionId:t,gateId:n,frameId:r,action:i,resumeData:a}=e.payload,o=await this.respondToPausedGate({executionId:t,gateId:n,frameId:r,action:i,resumeData:a});e.setResult({accepted:o})},{priority:-100}))}registerGateTimeoutHandlers(){this.addCleanup(this.bus.on(n.gate.suspended,e=>{this.gateTimeoutScheduler.schedule(e.payload)})),this.addCleanup(this.bus.on(n.gate.resolved,e=>{this.gateTimeoutScheduler.clear(e.payload.executionId,e.payload.stepId,e.payload.frameId)}))}async rehydratePausedGateTimeouts(){let{gates:e}=await this.bus.request(g.listPausedGateTimeouts,{});for(let t of e)this.gateTimeoutScheduler.schedule(cn(t))}async runExecution(e){let t=this.activeExecutions.get(e);if(!t)return;let n=new AbortController;this.workflowAbortControllers.set(e,n);try{let r;try{let a=await d({definition:t.workflow,execution:t.execution,runContext:t.runContext,bus:this.bus}),o=new i(e,t.workflow.id,t.workflow,t.execution,t.runtimeHandlers,this.bus,n.signal,void 0,a,{context:t.runContext.context,env:t.runContext.env}),s=o.buildExpressionContext();r=await _(t.workflow.root,o,s)}catch(r){if(n.signal.aborted||t.execution.status===`cancelled`){await o(this.buildFinalizerDeps(),e,E);return}let i=r instanceof Error?r.message:String(r);await f(this.buildFinalizerDeps(),t.execution,e,i);return}let a=this.buildFinalizerDeps();r.status===`cancelled`||n.signal.aborted||t.execution.status===`cancelled`?await o(a,e,E):r.status===`failed`?await f(a,t.execution,e,r.error):r.status===`paused`?(t.execution.status=`paused`,await this.bus.request(g.setExecution,{execution:t.execution}),this.activeExecutions.delete(e)):await v(a,t.execution,e,t.execution.startedAt)}finally{this.workflowAbortControllers.delete(e)}}async respondToPausedGate(e){let{execution:t}=await this.bus.request(g.getExecution,{executionId:e.executionId});if(!rn(t))return!1;let n=await ln(this.bus,{executionId:e.executionId,nodeId:e.gateId,frameId:e.frameId});if(n===null||!m(e.gateId,n.schema,e.resumeData).valid)return!1;let{runContext:r}=await this.bus.request(g.getRunContext,{executionId:e.executionId});if(r===null)throw Error(`[WorkflowExecutor] Run context not found for paused execution: ${e.executionId}`);await sn(this.bus,r);let i=e.action===`reject`?`rejected`:`resumed`,{accepted:a}=await this.bus.request(g.resolveWaitingGateInstance,{gate:{...n,status:i,resumeData:e.resumeData,resolvedAt:Date.now()}});if(!a)return!1;try{await this.resumePausedExecution(t.id)}catch(r){throw await on(this.bus,this.activeExecutions,this.executionTasks,this.workflowAbortControllers,t,n,e.gateId),r}return this.gateTimeoutScheduler.clear(e.executionId,e.gateId,n.frameId),!0}async resumePausedExecution(e){if(!this.resumeDispatches.has(e)){this.resumeDispatches.add(e);try{await this.dispatchPausedExecutionResume(e)||this.resumeDispatches.delete(e)}catch(t){throw this.resumeDispatches.delete(e),t}}}async dispatchPausedExecutionResume(e){let{runContext:t}=await this.bus.request(g.getRunContext,{executionId:e});if(t===null)throw Error(`[WorkflowExecutor] Run context not found for paused execution: ${e}`);let n=t.definitionSnapshot??(await this.bus.request(g.get,{id:t.workflowId})).workflow??(()=>{throw Error(`[WorkflowExecutor] Workflow definition not found for paused execution: ${e}`)})(),{execution:r}=await this.bus.request(g.getExecution,{executionId:e});if(r===null)throw Error(`[WorkflowExecutor] Execution not found for paused execution: ${e}`);if(r.status!==`paused`)return!1;await sn(this.bus,t),await this.bus.request(g.setExecution,{execution:{...r,status:`running`}}),this.activeExecutions.set(e,{execution:{...r,status:`running`},workflow:n,runContext:t,runtimeHandlers:new Map});let i=At(t,n,{resume:!0}),a=It(this.buildStartDeps(),i).finally(()=>{this.resumeDispatches.delete(e)});return this.executionTasks.set(e,a),!0}};function dn(e,t){try{return xe(e)}catch(n){console.error(`[BusEventTriggerEvaluator] Invalid trigger.filterExpression for workflow "${t}": "${e}"`,n);return}}function fn(e){let t=e.indexOf(`.`),n=e.indexOf(`:`),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?e:e.slice(0,r)}function pn(e){return{subject:`*`,$meta:{namespace:e,isRequest:!1}}}var mn=class{bus;cleanupFns=[];initialized=!1;triggerIndex=new Map;subscribedNamespaces=new Set;constructor(e){this.bus=e}async init(){if(!this.initialized)try{this.cleanupFns.push(this.bus.on(D.definition.created,e=>{this.indexWorkflow(e.payload)}),this.bus.on(D.definition.updated,e=>{this.removeWorkflow(e.payload.id),this.indexWorkflow(e.payload)}),this.bus.on(D.definition.deleted,e=>{this.removeWorkflow(e.payload.id)})),await this.loadExistingTriggers(),this.initialized=!0}catch(e){throw this.cleanupFns.forEach(e=>e()),this.cleanupFns.length=0,this.triggerIndex.clear(),this.subscribedNamespaces.clear(),e}}destroy(){this.initialized&&=(this.cleanupFns.forEach(e=>e()),this.cleanupFns.length=0,this.triggerIndex.clear(),this.subscribedNamespaces.clear(),!1)}getTestState(){return{initialized:this.initialized,cleanupFns:[...this.cleanupFns],subscribedNamespaces:new Set(this.subscribedNamespaces)}}async loadExistingTriggers(){let{workflows:e}=await this.bus.request(g.list,{});for(let t of e)this.indexWorkflow(t)}indexWorkflow(e){let t=e.triggers??[],n=[];for(let r of t){if(r.type!==`bus-event`)continue;let t=typeof r.filterExpression==`string`?dn(r.filterExpression,e.id):void 0;typeof r.filterExpression==`string`&&t===void 0||(n.push({workflowId:e.id,subject:r.subject,filter:r.filter,compiledFilterExpr:t}),this.ensureNamespaceSubscribed(fn(r.subject)))}n.length>0&&this.triggerIndex.set(e.id,n)}removeWorkflow(e){this.triggerIndex.delete(e)}ensureNamespaceSubscribed(e){if(this.subscribedNamespaces.has(e))return;let t=pn(e),n=this.bus.on(t,e=>{if(e.isRequest)return;let t=typeof e.payload==`object`&&e.payload!==null?e.payload:{};this.handleBusEvent(e.subject,t)});this.cleanupFns.push(n),this.subscribedNamespaces.add(e)}handleBusEvent(e,t){for(let n of this.triggerIndex.values())for(let r of n)if(te(e,r.subject)&&!(r.filter&&!ee(t,r.filter))){if(r.compiledFilterExpr){let n;try{n=r.compiledFilterExpr.evalSync({payload:t})}catch(n){console.error(`[BusEventTriggerEvaluator] filterExpression eval failed for workflow "${r.workflowId}" on subject "${e}" payload keys: [${Object.keys(t).join(`, `)}]`,n);continue}if(!n)continue}this.bus.request(D.start,{workflowId:r.workflowId,triggerPayload:t}).catch(t=>{console.error(`[BusEventTriggerEvaluator] Failed to start workflow "${r.workflowId}" triggered by "${e}":`,t)})}}};function J(e,t,n,r,i,a,o,s){return J.fromTZ(J.tp(e,t,n,r,i,a,o),s)}J.fromTZISO=(e,t,n)=>J.fromTZ(gn(e,t),n),J.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=hn(e.tz,n),i=new Date(n.getTime()-r),a=hn(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=hn(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},J.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},J.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function hn(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function gn(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?J.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):J.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}J.minitz=J;var _n=32,Y=31|_n,vn=[1,2,4,8,16],yn=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,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.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||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 e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new Z(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,Y),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.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`)}replaceAlphaMonths(e){return e.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(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|_n;else if(t===Y)this.dayOfWeek[e]=Y;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|vn[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},bn=[31,28,31,30,31,30,31,31,30,31,30,31],X=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],Z=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&Y&&vn[a-1]&r)return!0;if(r&_n){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=J.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>bn[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=J.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(J.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():bn[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&Y)t=+!!this.isNthWeekdayOfMonth(this.year,this.month,s-r,t);else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,X[n][0],e,X[n][2]);if(r>1){let i=n+1;for(;i<X.length;)this[X[i][0]]=-X[i][2],i++;if(r===3)return this[X[n][1]]++,this[X[n][0]]=-X[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=X.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):J.fromTZ(J.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function xn(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new Z(e.startAt,e.timezone),e.stopAt&&=new Z(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function Q(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function Sn(e){return Q(e)}function Cn(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var wn=30*1e3,$=[],Tn=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(Q(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(Q(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=xn(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new yn(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new Z(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new yn(e,this.options.timezone),this.name){if($.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);$.push(this)}return i!==void 0&&Sn(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}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(e){let t=this._next(e);return t?e instanceof Z||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new Z(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=$.indexOf(this);e>=0&&$.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>wn&&(t=wn),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&Cn(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new Z(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){Q(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new Z(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&Q(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new Z(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new Z(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new Z(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new Z(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}};function En(e,t){return`${e}:${t}`}function Dn(e){return e??`UTC`}var On=class{bus;cleanupFns=[];initialized=!1;jobs=new Map;constructor(e){this.bus=e}async init(){if(!this.initialized)try{this.cleanupFns.push(this.bus.on(D.definition.created,e=>{this.scheduleWorkflow(e.payload)}),this.bus.on(D.definition.updated,e=>{this.unscheduleWorkflow(e.payload.id),this.scheduleWorkflow(e.payload)}),this.bus.on(D.definition.deleted,e=>{this.unscheduleWorkflow(e.payload.id)})),await this.loadExistingTriggers(),this.initialized=!0}catch(e){throw this.cleanupFns.forEach(e=>e()),this.cleanupFns.length=0,this.stopAllJobs(),e}}destroy(){this.initialized&&=(this.cleanupFns.forEach(e=>e()),this.cleanupFns.length=0,this.stopAllJobs(),!1)}activeJobCount(){return this.jobs.size}async loadExistingTriggers(){let{workflows:e}=await this.bus.request(g.list,{});for(let t of e)this.scheduleWorkflow(t)}scheduleWorkflow(e){if(e.scope.type===`global`)return;let t=e.triggers??[];for(let n=0;n<t.length;n++){let r=t[n];if(r.type!==`cron`)continue;let i=En(e.id,n);this.stopJob(i);try{let t=Dn(r.timezone),a=new Tn(r.schedule,{timezone:t},()=>{this.fireTrigger(e.id,n)});this.jobs.set(i,{workflowId:e.id,triggerIndex:n,job:a})}catch(t){console.warn(`[CronTriggerEvaluator] Skipping invalid cron trigger key="${i}" workflowId="${e.id}" triggerIndex=${n} schedule="${r.schedule}" timezone="${r.timezone??`UTC`}"`,t)}}}unscheduleWorkflow(e){for(let[t,n]of this.jobs)n.workflowId===e&&(n.job.stop(),this.jobs.delete(t))}stopJob(e){let t=this.jobs.get(e);t&&(t.job.stop(),this.jobs.delete(e))}stopAllJobs(){for(let e of this.jobs.values())e.job.stop();this.jobs.clear()}fireTrigger(e,t){this.bus.request(D.start,{workflowId:e,triggerPayload:{firedAt:Date.now(),triggerIndex:t}}).catch(n=>{console.error(`[CronTriggerEvaluator] Failed to start workflow "${e}" for cron trigger index ${t}:`,n)})}},kn=class extends me{workflowExecutor;busEventTriggerEvaluator;cronTriggerEvaluator;constructor(e,t){super(e),this.workflowExecutor=new un(e,t?.executorConfig,t?.workflowRunner),this.busEventTriggerEvaluator=new mn(e),this.cronTriggerEvaluator=new On(e)}get executor(){return this.workflowExecutor}get cronTriggers(){return this.cronTriggerEvaluator}setTriggerTypeRegistry(e){this.workflowExecutor.setTriggerTypeRegistry(e)}getTriggerTypeRegistry(){return this.workflowExecutor.getTriggerTypeRegistry()}async onInit(){this.addCleanup(()=>this.destroyOwnedServices()),await this.workflowExecutor.init(),await this.busEventTriggerEvaluator.init(),await this.cronTriggerEvaluator.init()}async destroyOwnedServices(){let e=[];for(let t of[()=>this.cronTriggerEvaluator.destroy(),()=>this.busEventTriggerEvaluator.destroy(),()=>this.workflowExecutor.destroy()])try{await t()}catch(t){e.push(t)}if(e.length===1)throw e[0];if(e.length>1)throw AggregateError(e,`Workflow engine service teardown failed`)}};const An=pe(`makaio.workflow-engine`);function jn(e){return{name:An.name,displayName:`Workflow Engine`,version:`0.1.0`,dependencies:[fe(Ce.name)],critical:!0,namespaces:[le,c],storage:{registerHandlers:be(q)},create:t=>new kn(t.bus,e)}}const Mn=jn();export{un as a,kn as i,jn as n,q as o,Mn as r,An as t};
|