vibe64 0.1.33 → 0.1.34
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/bin/run.js +1717 -1648
- package/bin/server.js +81 -68
- package/bin/upgrade-state.js +5429 -5183
- package/dist/assets/{GithubBrowserTabs-2bEGbRAs.js → GithubBrowserTabs-DO5PHon-.js} +1 -1
- package/dist/assets/GithubMarkdown-BQ6MfCDJ.js +3 -0
- package/dist/assets/GithubMarkdown-U7-j-qNI.css +1 -0
- package/dist/assets/StudioErrorNotice-sQfmeR-z.js +1 -0
- package/dist/assets/VAlert-P256xaE0.js +1 -0
- package/dist/assets/VAutocomplete-BDb95qJX.js +1 -0
- package/dist/assets/VAvatar-9ilDR2r2.css +1 -0
- package/dist/assets/VAvatar-DPzqDH4r.js +1 -0
- package/dist/assets/VBtn-B2MBK2DL.js +1 -0
- package/dist/assets/VCard-mXy0k4aS.js +1 -0
- package/dist/assets/VCheckbox-C7A1ZW4D.js +1 -0
- package/dist/assets/VChip-CcI-Oo2J.js +1 -0
- package/dist/assets/VDialog-Bu3EfKb1.js +1 -0
- package/dist/assets/VDivider-BMEqUoAB.js +1 -0
- package/dist/assets/VExpansionPanels-Dgjrop0V.js +1 -0
- package/dist/assets/VMenu-C_x18lwb.js +1 -0
- package/dist/assets/VOverlay-CeMZurIN.js +1 -0
- package/dist/assets/VRadioGroup-CUu2-KIP.js +1 -0
- package/dist/assets/VRow-Cpw7OHQV.js +1 -0
- package/dist/assets/{VSelect-DY-ZuBJJ.js → VSelect-DL3HaA5m.js} +1 -1
- package/dist/assets/VSheet-DZWsu0kL.js +1 -0
- package/dist/assets/VSkeletonLoader-CttxM1tw.js +1 -0
- package/dist/assets/VSpacer-Dhmsvk4t.js +1 -0
- package/dist/assets/{VSwitch-Bm1bwl2V.js → VSwitch-BRHeDJkH.js} +1 -1
- package/dist/assets/VTextField-BR2eZeFT.js +1 -0
- package/dist/assets/VTextarea-DbqamXJd.js +1 -0
- package/dist/assets/Vibe64AsyncModuleState-Dx7YKRPp.js +1 -0
- package/dist/assets/Vibe64DashboardBackButton-DD9UR77P.css +1 -0
- package/dist/assets/Vibe64DashboardBackButton-yE6cyYg2.js +1 -0
- package/dist/assets/Vibe64DashboardPageHeader-BXQR00HK.js +1 -0
- package/dist/assets/Vibe64DashboardPageHeader-Gm1IvlHx.css +1 -0
- package/dist/assets/Vibe64DashboardShell-CuCVMhOc.js +1 -0
- package/dist/assets/Vibe64DashboardShell-MBkUHjs-.css +1 -0
- package/dist/assets/Vibe64DatabaseWorkspace-BONJdxBS.js +18 -0
- package/dist/assets/{Vibe64DatabaseWorkspace-C39Jvver.css → Vibe64DatabaseWorkspace-CR4pzzcf.css} +1 -1
- package/dist/assets/Vibe64OutputControls-DAAmA09l.js +8 -0
- package/dist/assets/{Vibe64OutputControls-CsZFv12r.css → Vibe64OutputControls-DPBsyDZM.css} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-ebUaYOU4.js → Vibe64RepositoryWorkspace-ByQlZbyO.js} +2 -2
- package/dist/assets/{Vibe64RepositoryWorkspace-Cqm6TOFk.css → Vibe64RepositoryWorkspace-CVHcT93M.css} +1 -1
- package/dist/assets/Vibe64SessionFiles-B0u9HKdF.js +107 -0
- package/dist/assets/Vibe64SessionFiles-NjOMVwPR.css +1 -0
- package/dist/assets/Vibe64TemporaryAiFixAction-BGlcrq4d.js +1 -0
- package/dist/assets/Vibe64UiStoryboardView-3WXph5bz.css +1 -0
- package/dist/assets/Vibe64UiStoryboardView-Brlwdvqi.js +7 -0
- package/dist/assets/Vibe64UnavailableSessions-zwlWlcZD.js +1 -0
- package/dist/assets/_sessionId_-CvOkQbVy.js +1 -0
- package/dist/assets/{_sessionTool_-B39BIzzZ.js → _sessionTool_-Dwod5ns9.js} +1 -1
- package/dist/assets/_slug_-B31c15cc.css +1 -0
- package/dist/assets/_slug_-Dy35qLo1.js +1 -0
- package/dist/assets/access-BVu5XYm2.js +1 -0
- package/dist/assets/app-DRXCcv05.css +1 -0
- package/dist/assets/app-zt7HwQKT.js +1 -0
- package/dist/assets/assistantRouting-CwbwfkwB.js +3 -0
- package/dist/assets/{changes-ByjS7QGx.js → changes-olY8cnFK.js} +1 -1
- package/dist/assets/{client-C-tpoG6F.js → client-BrV4QPwG.js} +1 -1
- package/dist/assets/createSimpleFunctional-CZTGuNuR.js +1 -0
- package/dist/assets/dashboard-BnXD-H4R.js +1 -0
- package/dist/assets/definitions-DaOPIkyB.js +1 -0
- package/dist/assets/env-DJhnLOH7.css +1 -0
- package/dist/assets/env-DN0vW4EI.js +1 -0
- package/dist/assets/{error-DFKtZBJ8.js → error-DgrgRbJJ.js} +1 -1
- package/dist/assets/{error-DE4zo8Lk.js → error-Dug56can.js} +1 -1
- package/dist/assets/health-7oIQODer.css +1 -0
- package/dist/assets/health-Z6m96GDr.js +1 -0
- package/dist/assets/history-BOwbCRQP.css +1 -0
- package/dist/assets/history-BxlpB-YH.js +1 -0
- package/dist/assets/incoming-BOxRVlOM.js +2 -0
- package/dist/assets/incoming-DWDrmxyH.css +1 -0
- package/dist/assets/index-BUq-MczL.js +86 -0
- package/dist/assets/{index-D4MsP3dq.css → index-DtmBqE3h.css} +1 -1
- package/dist/assets/{integrations-B4txOZfY.js → integrations-BFltGDVI.js} +1 -1
- package/dist/assets/issues-1iS5zoed.js +1 -0
- package/dist/assets/issues-XnpGgdmn.css +1 -0
- package/dist/assets/layout-BkWVNT37.js +1 -0
- package/dist/assets/lazy-NHSwD9FS.js +1 -0
- package/dist/assets/mdi-C54lQ0i_.js +1 -0
- package/dist/assets/{pages-BW2l8fNe.js → pages-DuMgH61T.js} +1 -1
- package/dist/assets/{placement-JxzrmUR3.js → placement-CwTqWLQH.js} +1 -1
- package/dist/assets/placement-DLsU3pCW.js +1 -0
- package/dist/assets/pull-requests-BJOwNL4k.js +1 -0
- package/dist/assets/pull-requests-CdbhyFOv.css +1 -0
- package/dist/assets/{repository-BTC3lkrh.js → repository-JWLVST3D.js} +1 -1
- package/dist/assets/{VAvatar-CAFvgSUo.js → ripple-BVltMmyV.js} +2 -2
- package/dist/assets/ripple-DqhAt1Ze.css +1 -0
- package/dist/assets/runtime-core.esm-bundler-DGXg_mpN.js +3 -0
- package/dist/assets/{session-CG-TUCJt.css → session-5qADMzDP.css} +1 -1
- package/dist/assets/session-C5Nj8Dlq.js +1 -0
- package/dist/assets/settings-BopLnpB0.css +1 -0
- package/dist/assets/settings-c273Ikrm.js +1 -0
- package/dist/assets/ssrBoot-Rlh6kLbD.js +1 -0
- package/dist/assets/{studioGateApi-C0GvzVlt.js → studioGateApi-DhA9IJGZ.js} +1 -1
- package/dist/assets/{studioUrls-CIab-Axb.js → studioUrls-Dj8rXeXO.js} +1 -1
- package/dist/assets/{useApi-BPuI6ZR9-Dr8wK_Co.js → useApi-BPuI6ZR9-CFWU1m37.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-CVZx2Rtm.js +1 -0
- package/dist/assets/useCommand-DWuxfAV0.js +1 -0
- package/dist/assets/useEndpointResource-MWVNfmMa.js +1 -0
- package/dist/assets/{usePaths-DVTieF_G.js → usePaths-Db88-HOm.js} +1 -1
- package/dist/assets/{useUiFeedback-Tzi-PRlX.js → useUiFeedback-0FqKuZRP.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-8cKh1eDm.js +1 -0
- package/dist/assets/useVibe64DatabaseTools-BcRG1s3i.js +1 -0
- package/dist/assets/useVibe64LearningMode-Bl0dGdCh.js +28 -0
- package/dist/assets/useVibe64LearningMode-C3PcXdVg.css +1 -0
- package/dist/assets/useVibe64ProjectScope-DOEVkBqX.js +1 -0
- package/dist/assets/useVibe64SessionData-DFTyLzci.js +1 -0
- package/dist/assets/useVibe64SessionSelection-j9lsllx4.js +1 -0
- package/dist/assets/useVibe64SystemGraph-tNkIwSBQ.js +1 -0
- package/dist/assets/{useVibe64Terminal-C2XJ9Y1K.js → useVibe64Terminal-BPnN25WH.js} +1 -1
- package/dist/assets/vibe64AssistantHost-DdE_-lZF.js +1 -0
- package/dist/assets/vibe64LessonDashboard-DlKYjisq.js +1 -0
- package/dist/assets/vibe64ProjectScope.local-DqT6e5un.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-DXk0Jai3.js +1 -0
- package/dist/assets/vibe64SessionFocus-OJ2toBd9.css +1 -0
- package/dist/assets/vibe64SessionFocus-kqPOPaOH.js +1 -0
- package/dist/assets/{vibe64SessionInfo-D8l22MFm.js → vibe64SessionInfo-BHxtTrLX.js} +1 -1
- package/dist/assets/vibe64SessionToolDefinitions-NfLd1HZI.js +1 -0
- package/dist/assets/vue-flow-core-BlVEnES8.js +26 -0
- package/dist/index.html +51 -48
- package/docs/colleague-usage/account-profile-and-appearance.md +29 -0
- package/docs/colleague-usage/ai-accounts-and-routing.md +23 -4
- package/docs/colleague-usage/ai-balance-and-allowance.md +4 -0
- package/docs/colleague-usage/architecture-explanations.md +99 -0
- package/docs/colleague-usage/auto-workflow.md +49 -11
- package/docs/colleague-usage/coding-agent-failures.md +94 -0
- package/docs/colleague-usage/coding-agent-goal-pause.md +110 -0
- package/docs/colleague-usage/coding-agent-goals.md +140 -38
- package/docs/colleague-usage/coding-agent-history.md +20 -2
- package/docs/colleague-usage/coding-agent-recovery.md +136 -0
- package/docs/colleague-usage/coding-agents.md +138 -150
- package/docs/colleague-usage/colleague-recovery.md +28 -5
- package/docs/colleague-usage/colleague-watches.md +84 -0
- package/docs/colleague-usage/colleague.md +18 -34
- package/docs/colleague-usage/connected-contributions.md +196 -0
- package/docs/colleague-usage/connected-projects.md +196 -0
- package/docs/colleague-usage/conversation-context.md +67 -1
- package/docs/colleague-usage/dashboard-navigation.md +79 -5
- package/docs/colleague-usage/database.md +11 -0
- package/docs/colleague-usage/developing-vibe64.md +137 -0
- package/docs/colleague-usage/development-copies.md +20 -0
- package/docs/colleague-usage/development-env.md +34 -0
- package/docs/colleague-usage/file-interfaces.md +156 -0
- package/docs/colleague-usage/github-work.md +88 -1
- package/docs/colleague-usage/health-checks.md +32 -0
- package/docs/colleague-usage/incoming-changes.md +94 -0
- package/docs/colleague-usage/learning-chat-retention.md +11 -2
- package/docs/colleague-usage/learning-code-questions.md +55 -0
- package/docs/colleague-usage/learning-course-catalogue.md +118 -0
- package/docs/colleague-usage/learning-diagrams-and-voice.md +97 -0
- package/docs/colleague-usage/learning-history.md +17 -9
- package/docs/colleague-usage/learning-lesson-watch.md +95 -0
- package/docs/colleague-usage/learning-mode-ui.md +187 -85
- package/docs/colleague-usage/learning-native-session.md +12 -10
- package/docs/colleague-usage/learning-practical-exercises.md +71 -0
- package/docs/colleague-usage/learning-practical-gestures.md +18 -1
- package/docs/colleague-usage/learning-practice-projects.md +55 -4
- package/docs/colleague-usage/learning-session-creation.md +7 -7
- package/docs/colleague-usage/learning-teacher-guide.md +52 -0
- package/docs/colleague-usage/learning-with-colleague.md +59 -80
- package/docs/colleague-usage/lesson-authoring.md +12 -4
- package/docs/colleague-usage/lesson-practical-assessment.md +3 -1
- package/docs/colleague-usage/managed-app-access.md +6 -0
- package/docs/colleague-usage/message-delivery-recovery.md +56 -0
- package/docs/colleague-usage/plans.md +14 -7
- package/docs/colleague-usage/preview-browser-checks.md +61 -0
- package/docs/colleague-usage/preview-lesson-presentation.md +56 -0
- package/docs/colleague-usage/preview-starting-application.md +92 -0
- package/docs/colleague-usage/preview.md +70 -96
- package/docs/colleague-usage/project-architecture.md +229 -0
- package/docs/colleague-usage/project-language-tools.md +31 -0
- package/docs/colleague-usage/project-messages.md +106 -0
- package/docs/colleague-usage/project-settings.md +22 -0
- package/docs/colleague-usage/project-setup.md +29 -2
- package/docs/colleague-usage/session-terminal.md +42 -0
- package/docs/colleague-usage/sessions.md +122 -52
- package/docs/colleague-usage/teaching-content.md +12 -6
- package/docs/colleague-usage/temporary-chat-context.md +29 -0
- package/docs/colleague-usage/temporary-chats.md +95 -2
- package/docs/colleague-usage/voice-chat.md +10 -43
- package/docs/colleague-usage/voice-face-and-speaking-voice.md +73 -0
- package/docs/colleague-usage/workspace-preparation.md +89 -0
- package/docs/training-content.md +208 -7
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/README.md +29 -0
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
- package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/kernel/package.json +1 -1
- package/node_modules/@jskit-ai/payments-core/package.json +1 -1
- package/node_modules/@jskit-ai/realtime/package.json +1 -1
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/resource-crud-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
- package/node_modules/@local/vibe64-core/package.json +1 -0
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +280 -272
- package/node_modules/@local/vibe64-genesis/README.md +15 -0
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +879 -1225
- package/node_modules/@local/vibe64-genesis/package.json +2 -1
- package/node_modules/@local/vibe64-genesis/src/server/index.js +496 -418
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +165 -146
- package/node_modules/@local/vibe64-runtime/src/server/agentSessionCommandHook.js +8 -8
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +128 -129
- package/node_modules/@local/vibe64-system-graph/README.md +136 -6
- package/node_modules/@local/vibe64-terminals/package.json +3 -0
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1527 -1326
- package/node_modules/@local/vibe64-training/package.json +6 -1
- package/node_modules/@local/vibe64-voice/package.json +1 -0
- package/package.json +16 -16
- package/server.bundle.mjs +42853 -40268
- package/dist/assets/StudioErrorNotice-Ccjvcn9C.js +0 -1
- package/dist/assets/VAlert-B7ciJKQL.js +0 -1
- package/dist/assets/VAutocomplete-QjMk5d_j.js +0 -1
- package/dist/assets/VAvatar-nHaK192T.css +0 -1
- package/dist/assets/VBtn-Kl_qcBsy.js +0 -1
- package/dist/assets/VCard-nrJPeo91.js +0 -1
- package/dist/assets/VCheckbox-DTRAWOIf.js +0 -1
- package/dist/assets/VChip-Dfs5jX0f.js +0 -1
- package/dist/assets/VDialog-Dt1VjJg1.js +0 -1
- package/dist/assets/VDivider-DFsS0OTx.js +0 -1
- package/dist/assets/VExpansionPanels-CYKU0cAr.js +0 -1
- package/dist/assets/VMenu-BLxobsuU.js +0 -1
- package/dist/assets/VOverlay-BvFVZKNS.js +0 -1
- package/dist/assets/VRadioGroup-DzQzpCfg.js +0 -1
- package/dist/assets/VRow-BR2RMCM1.js +0 -1
- package/dist/assets/VSheet-BA95RNmA.js +0 -1
- package/dist/assets/VSkeletonLoader-hpJqr0HL.js +0 -1
- package/dist/assets/VSpacer-B1l1hVvU.js +0 -1
- package/dist/assets/VTextField-CA_p3N4d.js +0 -1
- package/dist/assets/VTextarea-NyCqY4h5.js +0 -1
- package/dist/assets/Vibe64AsyncModuleState-DEFlqJ97.js +0 -1
- package/dist/assets/Vibe64DashboardShell-BNv2I-P8.js +0 -1
- package/dist/assets/Vibe64DashboardShell-w20wNTGW.css +0 -1
- package/dist/assets/Vibe64DatabaseWorkspace-CuY5lN1o.js +0 -43
- package/dist/assets/Vibe64OutputControls-D2JuYlYU.js +0 -8
- package/dist/assets/Vibe64SessionFiles-C-rWehq_.js +0 -34
- package/dist/assets/Vibe64SessionFiles-Dsr6KQNP.css +0 -1
- package/dist/assets/Vibe64SubsystemsView-BvdU_o6H.css +0 -1
- package/dist/assets/Vibe64SubsystemsView-DJCjSzQM.js +0 -1
- package/dist/assets/Vibe64SystemWorldView-B91ioQaO.js +0 -4312
- package/dist/assets/Vibe64SystemWorldView-BXiQ7_Qb.css +0 -1
- package/dist/assets/Vibe64UnavailableSessions-OvnoD3ZB.js +0 -1
- package/dist/assets/_sessionId_-JTvMh54L.js +0 -1
- package/dist/assets/_slug_-DP_heCDa.js +0 -1
- package/dist/assets/_slug_-DmBZGb0q.css +0 -1
- package/dist/assets/access-C8GQIS19.js +0 -1
- package/dist/assets/app-B83lF61Y.js +0 -1
- package/dist/assets/app-ByLIQ3SB.css +0 -1
- package/dist/assets/assistantRouting-TDtryU6o.js +0 -1
- package/dist/assets/createSimpleFunctional-DPIT6zsT.js +0 -1
- package/dist/assets/dashboard-CWGFPojJ.js +0 -1
- package/dist/assets/definitions-BeLcvOW3.js +0 -1
- package/dist/assets/display-BLmcO-5p.js +0 -1
- package/dist/assets/env-7bqFyF_E.css +0 -1
- package/dist/assets/env-BVwxNL8M.js +0 -1
- package/dist/assets/health-BzNhp7r8.js +0 -1
- package/dist/assets/health-DoHTXTGx.css +0 -1
- package/dist/assets/history-BPeZGofK.js +0 -1
- package/dist/assets/history-iMQxp5AR.css +0 -1
- package/dist/assets/httpClient-BaaZuFvF.js +0 -1
- package/dist/assets/index-5sKwLHOH.js +0 -86
- package/dist/assets/issues-DCEhGlfn.css +0 -1
- package/dist/assets/issues-wby50y9b.js +0 -3
- package/dist/assets/layout-YCn17mK1.js +0 -1
- package/dist/assets/lazy-CvQfXeLg.js +0 -1
- package/dist/assets/mdi-C31_SZp-.js +0 -1
- package/dist/assets/placement-C4R2t6rl.js +0 -1
- package/dist/assets/pull-requests-BNK6mq2u.css +0 -1
- package/dist/assets/pull-requests-lNQAigaC.js +0 -1
- package/dist/assets/runtime-core.esm-bundler-DMrccYS5.js +0 -3
- package/dist/assets/session-D38nzG41.js +0 -1
- package/dist/assets/settings-CFyUJ_kR.js +0 -1
- package/dist/assets/settings-vWsAEoE9.css +0 -1
- package/dist/assets/useArchivedVibe64Sessions-C2DSq2Z4.js +0 -1
- package/dist/assets/useCommand-BzThFLYP.js +0 -1
- package/dist/assets/useEndpointResource-C2KD4Ub_.js +0 -1
- package/dist/assets/useVibe64ConversationLog-CMUlXJtU.js +0 -1
- package/dist/assets/useVibe64DatabaseTools-DBcKhm6B.js +0 -1
- package/dist/assets/useVibe64LearningMode-BPRWM5Rp.js +0 -28
- package/dist/assets/useVibe64LearningMode-PJUv0O25.css +0 -1
- package/dist/assets/useVibe64SessionData-CdtJbAIx.js +0 -1
- package/dist/assets/useVibe64SessionSelection-aR0f6xVT.js +0 -1
- package/dist/assets/useVibe64SystemGraph-DeTPBn0e.js +0 -1
- package/dist/assets/vibe64AssistantHost-Dgyz4TrT.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-GOSMVDRi.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-t5Al8BlU.js +0 -1
- package/dist/assets/vibe64SessionFocus-CcN6Grgw.js +0 -1
- package/dist/assets/vibe64SessionFocus-ChabllPA.css +0 -1
- package/dist/assets/vibe64SessionToolDefinitions-BaO1DEup.js +0 -1
- /package/dist/assets/{vibe64RepositoryRealtime-D_mq1dFE.css → Vibe64TemporaryAiFixAction-D_mq1dFE.css} +0 -0
package/bin/run.js
CHANGED
|
@@ -1,298 +1,298 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var f=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var
|
|
5
|
-
|
|
6
|
-
e,o)&&o!==r&&
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
typeof e.toJsonSchema=="function"&&typeof e.cleanup=="function"}function
|
|
10
|
-
let{items:r}=t;if(
|
|
11
|
-
" must define items as either a Schema instance or a field definition object.`);return{kind:"definition",definition:r}}function
|
|
12
|
-
if(!Object.hasOwn(t,"values"))return null;let{values:r}=t;if(
|
|
3
|
+
var ib=Object.create;var Ni=Object.defineProperty;var sb=Object.getOwnPropertyDescriptor;var ab=Object.getOwnPropertyNames;var cb=Object.getPrototypeOf,lb=Object.prototype.hasOwnProperty;var Ne=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
4
|
+
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var f=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var te=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ub=(e,t)=>{for(var r in t)
|
|
5
|
+
Ni(e,r,{get:t[r],enumerable:!0})},db=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ab(t))!lb.call(
|
|
6
|
+
e,o)&&o!==r&&Ni(e,o,{get:()=>t[o],enumerable:!(n=sb(t,o))||n.enumerable});return e};var fb=(e,t,r)=>(r=e!=null?ib(cb(e)):{},db(t||!e||!e.__esModule?Ni(r,"default",{value:e,enumerable:!0}):r,e));function K(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||
|
|
7
|
+
pb(t)}function pb(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null&&Reflect.ownKeys(e).length===0}
|
|
8
|
+
var er=f(()=>{});function ki(e){return e!==null&&typeof e=="object"&&K(e.structure)&&K(e.operations)&&typeof e.validateWith=="function"&&
|
|
9
|
+
typeof e.toJsonSchema=="function"&&typeof e.cleanup=="function"}function Xr(e,t){if(!Object.hasOwn(t,"items"))return null;
|
|
10
|
+
let{items:r}=t;if(ki(r))return{kind:"schema",schema:r};if(!K(r)||typeof r.type!="string")throw new Error(`Array field "${e}\
|
|
11
|
+
" must define items as either a Schema instance or a field definition object.`);return{kind:"definition",definition:r}}function tr(e,t){
|
|
12
|
+
if(!Object.hasOwn(t,"values"))return null;let{values:r}=t;if(ki(r))return{kind:"schema",schema:r};if(!K(r)||typeof r.type!=
|
|
13
13
|
"string")throw new Error(`Object field "${e}" must define values as either a Schema instance or a field definition objec\
|
|
14
|
-
t.`);return{kind:"definition",definition:r}}function
|
|
14
|
+
t.`);return{kind:"definition",definition:r}}function Zr(e,t){let r=Object.hasOwn(t,"schema"),n=Object.hasOwn(t,"values"),
|
|
15
15
|
o=Object.hasOwn(t,"additionalProperties");if(r&&n)throw new Error(`Object field "${e}" cannot define both schema and val\
|
|
16
16
|
ues.`);if(o&&t.additionalProperties!==!0)throw new Error(`Object field "${e}" only supports additionalProperties: true.`);
|
|
17
17
|
if(n&&t.additionalProperties===!0)throw new Error(`Object field "${e}" cannot define both values and additionalPropertie\
|
|
18
|
-
s: true.`);if(r){if(!
|
|
19
|
-
kind:"nested",schema:t.schema,allowAdditionalProperties:t.additionalProperties===!0}}return n?{kind:"map",valuesConfig:
|
|
20
|
-
e,t)}:t.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}var
|
|
21
|
-
()=>{});function
|
|
22
|
-
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=
|
|
18
|
+
s: true.`);if(r){if(!ki(t.schema))throw new Error(`Object field "${e}" must define schema as a Schema instance.`);return{
|
|
19
|
+
kind:"nested",schema:t.schema,allowAdditionalProperties:t.additionalProperties===!0}}return n?{kind:"map",valuesConfig:tr(
|
|
20
|
+
e,t)}:t.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}var $i=f(()=>{er()});function lt(e){return e?.type==="number"||e?.type==="integer"||e?.type==="epochMilliseconds"||e?.type==="epochSeconds"}var Mi=f(
|
|
21
|
+
()=>{});function bb(e){return e%4===0&&(e%100!==0||e%400===0)}function Eb(e,t){return t===2?bb(e)?29:28:wb[t-1]}function Pl(e,t,r){
|
|
22
|
+
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=Eb(n,o)}function rr(e,t){let r=e.temporalPrecision;
|
|
23
23
|
if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(`temporalPrecision for "${t}" must be a non-negative integer\
|
|
24
|
-
.`);return r}}function
|
|
25
|
-
let t=
|
|
26
|
-
null&&
|
|
27
|
-
|
|
28
|
-
return`^${
|
|
29
|
-
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&
|
|
30
|
-
r)||r<-t||r>t?null:r===0?0:r}var
|
|
31
|
-
\\d{4}",
|
|
32
|
-
](?:${
|
|
33
|
-
new RegExp(`^${
|
|
34
|
-
|
|
35
|
-
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function
|
|
36
|
-
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function
|
|
37
|
-
let o=r?
|
|
24
|
+
.`);return r}}function Cl(e,t){return e===void 0?!0:t===void 0||e.length<=t}function Nl(e){if(typeof e!="string")return!1;
|
|
25
|
+
let t=mb.exec(e);return t!==null&&Pl(t[1],t[2],t[3])}function kl(e,t){if(typeof e!="string")return!1;let r=hb.exec(e);return r!==
|
|
26
|
+
null&&Cl(r[1],t)}function $l(e,t){if(typeof e!="string")return!1;let r=gb.exec(e);return r===null?!1:Pl(r[1],r[2],r[3])&&
|
|
27
|
+
Cl(r[4],t)}function Ml(e){return e===void 0?"(?:\\.\\d+)?":e===0?"":`(?:\\.\\d{1,${e}})?`}function Ll(e,t){let r=rr(e,t);
|
|
28
|
+
return`^${Qr}(?::${ut}${Ml(r)})?$`}function Dl(e,t){let r=rr(e,t);return`^${Rl}T${Qr}:${ut}${Ml(r)}${vl}$`}function Di(e,t){
|
|
29
|
+
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&yb.test(e))r=Number(e);else return null;return!Number.isSafeInteger(
|
|
30
|
+
r)||r<-t||r>t?null:r===0?0:r}var Li,_l,Tl,Ol,Al,ut,Qr,vl,Il,Rl,xl,mb,hb,gb,yb,wb,ji=f(()=>{Li="^(?:0|-?[1-9]\\d*)$",_l="\
|
|
31
|
+
\\d{4}",Tl="0[1-9]|1[0-2]",Ol="0[1-9]|[12]\\d|3[01]",Al="[01]\\d|2[0-3]",ut="[0-5]\\d",Qr=`(?:${Al}):${ut}`,vl=`(?:Z|[+-\
|
|
32
|
+
](?:${Al}):${ut})`,Il=`(${_l})-(${Tl})-(${Ol})`,Rl=`${_l}-(?:${Tl})-(?:${Ol})`,xl=`^${Rl}$`,mb=new RegExp(`^${Il}$`),hb=
|
|
33
|
+
new RegExp(`^${Qr}(?::${ut}(?:\\.(\\d+))?)?$`),gb=new RegExp(`^${Il}T${Qr}:${ut}(?:\\.(\\d+))?${vl}$`),yb=new RegExp(Li),
|
|
34
|
+
wb=[31,28,31,30,31,30,31,31,30,31,30,31]});function v(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function _b(e,t){if(Sb.
|
|
35
|
+
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function Tb(e){return typeof e!="string"?e:e.replace(
|
|
36
|
+
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function Bi(e,t,{normalize:r=!1,allowEmpty:n=!1}={}){
|
|
37
|
+
let o=r?Tb(e):e;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
38
38
|
dotted path string.`)}let i=o.split(".");if(i.some(s=>s===""))throw new Error(`${t}() received an invalid path "${o}".`);
|
|
39
|
-
for(let s of i)
|
|
40
|
-
[
|
|
41
|
-
ject"&&!Array.isArray(n)&&!Array.isArray(o)){
|
|
39
|
+
for(let s of i)_b(s,t);return i}var Sb,nr=f(()=>{Sb=new Set(["__proto__","prototype","constructor"])});function jl(e){return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:Li}]}}function ze(e,t){return{
|
|
40
|
+
[ke]:{[e]:t}}}function Hi(e,t){for(let r of Object.keys(t)){let n=t[r],o=e[r];if(n&&o&&typeof n=="object"&&typeof o=="ob\
|
|
41
|
+
ject"&&!Array.isArray(n)&&!Array.isArray(o)){Hi(o,n);continue}e[r]=n}}function xb(e,t){if(!t||typeof t!="object"||Array.
|
|
42
42
|
isArray(t))throw new Error("JSON Schema export hooks must return an object or null.");for(let r of Object.keys(t)){if(r===
|
|
43
|
-
|
|
44
|
-
e[r]=t[r]}}function
|
|
45
|
-
1?e:{anyOf:n}}function
|
|
46
|
-
let r=e.types[t.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=
|
|
47
|
-
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function
|
|
48
|
-
hasOwn(e.validators,t))return null;let n=e.validators[t];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=
|
|
43
|
+
ke&&e[r]&&typeof e[r]=="object"&&typeof t[r]=="object"&&!Array.isArray(e[r])&&!Array.isArray(t[r])){Hi(e[r],t[r]);continue}
|
|
44
|
+
e[r]=t[r]}}function Pb(e,t){let n=[...Array.isArray(e.anyOf)&&Object.keys(e).length===1?e.anyOf:[e],...t];return n.length===
|
|
45
|
+
1?e:{anyOf:n}}function Cb(e,t){if(!Object.hasOwn(e.types,t.type))throw new Error(`No casting function for type: ${t.type}`);
|
|
46
|
+
let r=e.types[t.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=Ib[t.type];if(!n)throw new Error(
|
|
47
|
+
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function Nb(e,t,r){if(!Object.
|
|
48
|
+
hasOwn(e.validators,t))return null;let n=e.validators[t];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=Rb[t];
|
|
49
49
|
if(o)return o;throw new Error(`Validator '${t}' on field '${r}' cannot be exported to JSON Schema without a toJsonSchema\
|
|
50
|
-
hook.`)}function
|
|
51
|
-
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function
|
|
52
|
-
void 0&&t.operation!==void 0){let r
|
|
50
|
+
hook.`)}function Bl(e){if(e===void 0)return"create";if(["create","replace","patch"].includes(e))return e;throw new Error(
|
|
51
|
+
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function kb(e,t={}){if(t.mode!==
|
|
52
|
+
void 0&&t.operation!==void 0){let r=Bl(t.mode);if(r!==t.operation)throw new Error(`Conflicting JSON Schema export option\
|
|
53
53
|
s: mode '${r}' does not match operation '${t.operation}'.`)}if(t.operation!==void 0){if(!Object.hasOwn(e.operations,t.operation))
|
|
54
|
-
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return
|
|
54
|
+
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return Bl(t.mode)}function $b(e,t={}){
|
|
55
55
|
if(t.operationName!==void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};
|
|
56
|
-
let r=
|
|
57
|
-
t,
|
|
58
|
-
e[
|
|
59
|
-
"_").replace(/^_+|_+$/g,"")||"operation"}function
|
|
60
|
-
function
|
|
61
|
-
r&&i.operation===n&&i.additionalProperties===o)||null}function
|
|
62
|
-
return e.nextDefinitionId+=1,n}function
|
|
56
|
+
let r=kb(e,t);return{operationName:r,operation:e.operations[r]}}function Mb(e={}){let t={...e};return Object.defineProperty(
|
|
57
|
+
t,Fi,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function tn(e={}){return e[Fi]?
|
|
58
|
+
e[Fi]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function Lb(e){return String(e).replace(/[^a-zA-Z0-9]+/g,
|
|
59
|
+
"_").replace(/^_+|_+$/g,"")||"operation"}function zi(e){return K(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}
|
|
60
|
+
function en(e){return zi(e)?{allOf:[e]}:e}function Db(e,t,r,n,o){return e.nodes.find(i=>i.schema===t&&i.operationName===
|
|
61
|
+
r&&i.operation===n&&i.additionalProperties===o)||null}function jb(e,t){let r=Lb(t),n=`SchemaNode_${e.nextDefinitionId}_${r}`;
|
|
62
|
+
return e.nextDefinitionId+=1,n}function Ul(e,t,r,n,o,{root:i=!1}={}){let s=tn(t),a=Db(s,e,r,n,o);if(a)return i&&(a.pointer=
|
|
63
63
|
"#",s.rootNode=a),a;let c={schema:e,operationName:r,operation:n,additionalProperties:o,status:"new",definitionName:i?null:
|
|
64
|
-
|
|
65
|
-
if(e.status==="built")return{$ref:e.pointer};if(e.status==="building")return{$ref:e.pointer};let r=
|
|
66
|
-
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=
|
|
67
|
-
return e.status="built",e.pointer==="#"?n:(r.definitions[e.definitionName]=n,{$ref:e.pointer})}function
|
|
68
|
-
let i=
|
|
69
|
-
referenceBacked:t}}function
|
|
64
|
+
jb(s,r),pointer:i?"#":null};return i?s.rootNode=c:c.pointer=`#/definitions/${c.definitionName}`,s.nodes.push(c),c}function Fl(e,t){
|
|
65
|
+
if(e.status==="built")return{$ref:e.pointer};if(e.status==="building")return{$ref:e.pointer};let r=tn(t);e.status="build\
|
|
66
|
+
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=Bb(e.schema,t,e.operationName,e.operation,e.additionalProperties);
|
|
67
|
+
return e.status="built",e.pointer==="#"?n:(r.definitions[e.definitionName]=n,{$ref:e.pointer})}function qi(e,t,r,n,o=!1){
|
|
68
|
+
let i=tn(t),s=Ul(e,t,r,n,o);return i.rootNode===s?{$ref:"#"}:Fl(s,t)}function or(e,{referenceBacked:t=!1}={}){return{schema:e,
|
|
69
|
+
referenceBacked:t}}function Bb(e,t,r,n,o=!1){let i={},s=[];for(let[c,l]of Object.entries(e.structure))v(i,c,Wi(e,c,l,t,r,
|
|
70
70
|
n)),n.enforceRequired&&l.required===!0&&s.push(c);let a={type:"object",properties:i,additionalProperties:o};return s.length>
|
|
71
|
-
0&&(a.required=s),a}function
|
|
72
|
-
n,"replace",s.schema.operations.replace,!1)),[
|
|
73
|
-
"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return
|
|
74
|
-
let s=
|
|
75
|
-
[
|
|
76
|
-
place"?e.operations.replace:i;return
|
|
77
|
-
t,r);if(a.kind==="nested")return
|
|
78
|
-
"opaque")return
|
|
79
|
-
e,t,r,n,o,i)})}let s=
|
|
71
|
+
0&&(a.required=s),a}function Ub(e,t,r,n,o,i){let s=Xr(t,r);if(!s)return null;if(s.kind==="schema")return{...en(qi(s.schema,
|
|
72
|
+
n,"replace",s.schema.operations.replace,!1)),[ke]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,
|
|
73
|
+
"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return Wi(e,`${t}[]`,r.items,n,a,c)}function Fb(e,t,r,n,o,i){
|
|
74
|
+
let s=tr(t,r);if(!s)return null;if(s.kind==="schema")return{...en(qi(s.schema,n,"replace",s.schema.operations.replace,!1)),
|
|
75
|
+
[ke]:{castType:"object"}};let a=s.definition.type==="object"&&Object.hasOwn(s.definition,"schema")?"replace":o,c=a==="re\
|
|
76
|
+
place"?e.operations.replace:i;return Wi(e,`${t}.*`,s.definition,n,a,c)}function zb(e,t,r,n,o,i){if(r.type==="object"){let a=Zr(
|
|
77
|
+
t,r);if(a.kind==="nested")return or(qi(a.schema,n,o,i,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind===
|
|
78
|
+
"opaque")return or({type:"object",additionalProperties:!0});if(a.kind==="map")return or({type:"object",additionalProperties:Fb(
|
|
79
|
+
e,t,r,n,o,i)})}let s=Cb(e,r)({schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n});if(!s||typeof s!="object"||
|
|
80
80
|
Array.isArray(s))throw new Error(`Type '${r.type}' on field '${t}' returned an invalid JSON Schema fragment.`);if(r.type===
|
|
81
|
-
"array"){let a=
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
continue;let m=
|
|
85
|
-
c[
|
|
86
|
-
let
|
|
81
|
+
"array"){let a=Ub(e,t,r,n,o,i);if(a)return or({...s,items:a},{referenceBacked:zi(s)})}return or(s,{referenceBacked:zi(s)})}
|
|
82
|
+
function Wi(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=zb(e,t,r,n,o,i),c=a.referenceBacked?
|
|
83
|
+
en(a.schema):{...a.schema},l={castType:r.type};for(let d of Object.keys(r)){if(d==="type"||!Object.hasOwn(e.validators,d))
|
|
84
|
+
continue;let m=Nb(e,d,t);if(!m)continue;let h=m({...s,parameterName:d,parameterValue:r[d],fieldSchema:{...c}});h&&xb(c,h)}
|
|
85
|
+
c[ke]&&(Hi(l,c[ke]),delete c[ke]);let u=[];r.nullable===!0&&u.push({type:"null"}),r.nullOnEmpty===!0&&u.push({const:""});
|
|
86
|
+
let p=en(Pb(c,u));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.defaultTo!="function"){let d=e._normalizeDefault(
|
|
87
87
|
r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(
|
|
88
|
-
o,i,{})});if(Object.keys(
|
|
89
|
-
nvalid (${m.code}).`)}
|
|
90
|
-
t),{operationName:n,operation:o}
|
|
91
|
-
o,i,{root:!0}),c={$schema:
|
|
92
|
-
|
|
93
|
-
ema",
|
|
94
|
-
"y","on"],
|
|
88
|
+
o,i,{})});if(Object.keys(d.errors).length>0){let m=Object.values(d.errors)[0];throw new Error(`defaultTo for "${t}" is i\
|
|
89
|
+
nvalid (${m.code}).`)}p.default=d.value}else l.defaults={providedByFunction:!0};return p[ke]=l,p}function zl(e,t={}){let r=Mb(
|
|
90
|
+
t),{operationName:n,operation:o}=$b(e,r),i=r.additionalProperties===void 0?!1:r.additionalProperties,s=tn(r),a=Ul(e,r,n,
|
|
91
|
+
o,i,{root:!0}),c={$schema:Ob,...Fl(a,r)};return Object.keys(s.definitions).length>0&&(c.definitions=s.definitions),c}var Ob,
|
|
92
|
+
ke,Ui,Fi,Ab,vb,Ib,Rb,Vl=f(()=>{$i();Mi();ji();er();nr();Ob="http://json-schema.org/draft-07/schema#",ke="x-json-rest-sch\
|
|
93
|
+
ema",Ui=["object","array","string","number","boolean"],Fi=Symbol("json-rest-schema.exportContext"),Ab=["true","1","yes",
|
|
94
|
+
"y","on"],vb=["false","0","no","n","off"];Ib={none:()=>({type:Ui}),blob:()=>({type:Ui}),serialize:()=>({type:Ui}),object:()=>({
|
|
95
95
|
type:"object"}),array:()=>({type:"array"}),file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["n\
|
|
96
|
-
umber","string"]}),integer:()=>({type:["integer","string"]}),epochMilliseconds:()=>
|
|
97
|
-
dateTime:({definition:e,fieldName:t})=>({type:"string",format:"date-time",pattern:
|
|
98
|
-
date",pattern:
|
|
99
|
-
strictBoolean===!0)return{type:"boolean"};let t=new Set([...
|
|
100
|
-
[...
|
|
101
|
-
{type:"string",enum:[...r,...t]}]}},id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},
|
|
96
|
+
umber","string"]}),integer:()=>({type:["integer","string"]}),epochMilliseconds:()=>jl(864e13),epochSeconds:()=>jl(864e10),
|
|
97
|
+
dateTime:({definition:e,fieldName:t})=>({type:"string",format:"date-time",pattern:Dl(e,t)}),date:()=>({type:"string",format:"\
|
|
98
|
+
date",pattern:xl}),time:({definition:e,fieldName:t})=>({type:"string",pattern:Ll(e,t)}),boolean:({definition:e})=>{if(e.
|
|
99
|
+
strictBoolean===!0)return{type:"boolean"};let t=new Set([...Ab,String(e.stringTrueWhen||"true").trim().toLowerCase()]),r=new Set(
|
|
100
|
+
[...vb,String(e.stringFalseWhen||"false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},
|
|
101
|
+
{type:"string",enum:[...r,...t]}]}},id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Rb={minLength:({
|
|
102
102
|
definition:e,parameterValue:t})=>e.type==="string"?{minLength:t}:null,maxLength:({definition:e,parameterValue:t})=>e.type===
|
|
103
|
-
"string"?{maxLength:t}:null,min:({definition:e,parameterValue:t})=>
|
|
103
|
+
"string"?{maxLength:t}:null,min:({definition:e,parameterValue:t})=>lt(e)?{minimum:t}:null,max:({definition:e,parameterValue:t})=>lt(
|
|
104
104
|
e)?{maximum:t}:null,pattern:({definition:e,parameterValue:t})=>e.type==="string"?{pattern:t instanceof RegExp?t.source:t}:
|
|
105
105
|
null,enum:({parameterValue:e})=>({enum:e}),notEmpty:({parameterValue:e,definition:t})=>!e||t.type==="array"?null:{minLength:1},
|
|
106
|
-
uppercase:({parameterValue:e})=>e?
|
|
107
|
-
{lowercase:!0}):null,length:({parameterValue:e})=>
|
|
108
|
-
ata",{unsigned:!0}):null,precision:({parameterValue:e})=>
|
|
109
|
-
tadata",{scale:e}),temporalPrecision:({parameterValue:e})=>
|
|
110
|
-
nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function
|
|
111
|
-
|
|
112
|
-
.${String(t)}`}function
|
|
113
|
-
startsWith(r)?e.slice(r.length):null}function
|
|
114
|
-
{...n,field:o})}return r}function
|
|
115
|
-
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||
|
|
116
|
-
return t}function
|
|
117
|
-
function
|
|
106
|
+
uppercase:({parameterValue:e})=>e?ze("transforms",{uppercase:!0}):null,lowercase:({parameterValue:e})=>e?ze("transforms",
|
|
107
|
+
{lowercase:!0}):null,length:({parameterValue:e})=>ze("transforms",{length:e}),unsigned:({parameterValue:e})=>e?ze("metad\
|
|
108
|
+
ata",{unsigned:!0}):null,precision:({parameterValue:e})=>ze("metadata",{precision:e}),scale:({parameterValue:e})=>ze("me\
|
|
109
|
+
tadata",{scale:e}),temporalPrecision:({parameterValue:e})=>ze("metadata",{temporalPrecision:e}),strictBoolean:()=>null,required:()=>null,
|
|
110
|
+
nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function Gl(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Zi(e){return e instanceof
|
|
111
|
+
pt}function Vb(){return{self:!1,children:{}}}function Hl(e){return Object.keys(e.children).length>0}function Ve(e,t){return`${e}\
|
|
112
|
+
.${String(t)}`}function Xl(e,t){return e===""?String(t):Ve(e,t)}function ql(e,t){if(e===t)return"";let r=`${t}.`;return e.
|
|
113
|
+
startsWith(r)?e.slice(r.length):null}function dt(e,t){let r={};for(let n of Object.values(e)){let o=Ve(t,n.field);v(r,o,
|
|
114
|
+
{...n,field:o})}return r}function Ji(e){return Bi(e,"validatePath")}function Wl(e){let t={};for(let r of e){let n=Ji(r),
|
|
115
|
+
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||v(o,s,Vb()),i===n.length-1&&(o[s].self=!0),o=o[s].children}}
|
|
116
|
+
return t}function Gb(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
|
|
117
|
+
function rn(e){return e===null?!0:Array.isArray(e)||K(e)?Object.keys(e).length>0:e!==void 0}function Yl(e){return[...e].
|
|
118
118
|
sort((t,r)=>{let n=/^[0-9]+$/.test(t),o=/^[0-9]+$/.test(r);return n&&o?Number(t)-Number(r):n?-1:o?1:t.localeCompare(r)})}
|
|
119
|
-
function
|
|
119
|
+
function Hb(e){return/^[0-9]+$/.test(e)}function qb(e,t=new WeakMap){if(t.has(e))return t.get(e);let r=Object.create(pt.
|
|
120
120
|
prototype);return t.set(e,r),r.structure=null,r.types=e.types,r.validators=e.validators,r.operations=e.operations,r.structure=
|
|
121
|
-
|
|
122
|
-
"object")return e;if(
|
|
121
|
+
on(nn(e.structure,t)),r._installOperationMethods(),Object.freeze(r)}function nn(e,t=new WeakMap){if(e===null||typeof e!=
|
|
122
|
+
"object")return e;if(Zi(e))return qb(e,t);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let n=new RegExp(
|
|
123
123
|
e.source,e.flags);return n.lastIndex=e.lastIndex,n}if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];t.set(e,n);
|
|
124
|
-
for(let o of e)n.push(
|
|
125
|
-
o,t));return r}function
|
|
126
|
-
isArray(e))for(let r of e)
|
|
127
|
-
return
|
|
128
|
-
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=
|
|
129
|
-
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:
|
|
130
|
-
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!
|
|
131
|
-
n,i);return o.kind==="schema"?s.length<1?null:
|
|
132
|
-
function
|
|
133
|
-
"");n.length>0?r.skipFields=n:delete r.skipFields}if(
|
|
134
|
-
let s=
|
|
135
|
-
let o=t[r];if(!n.includes(o))throw new Error(`Operation "${e}" must define ${r} as one of: ${n.join(", ")}.`)}function
|
|
124
|
+
for(let o of e)n.push(nn(o,t));return n}if(!K(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))v(r,n,nn(
|
|
125
|
+
o,t));return r}function on(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e)||Zi(e))return e;if(t.add(e),Array.
|
|
126
|
+
isArray(e))for(let r of e)on(r,t);else for(let r of Reflect.ownKeys(e))on(e[r],t);return Object.freeze(e)}function Yi(e){
|
|
127
|
+
return on(nn(e))}function Xi(e,t,r=""){if(!Zi(e)||!Array.isArray(t)||t.length<1)return null;let[n,...o]=t;if(!Object.hasOwn(
|
|
128
|
+
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=Xl(r,n);return Zl(e,i,o,s)}function Zl(e,t,r,n){
|
|
129
|
+
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:Xi(o.schema,r,n)}if(t?.type===
|
|
130
|
+
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!Hb(i))return null;let a=Ve(
|
|
131
|
+
n,i);return o.kind==="schema"?s.length<1?null:Xi(o.schema,s,a):s.length<1?o.definition:Zl(e,o.definition,s,a)}return null}
|
|
132
|
+
function ft(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>ql(o,t)).filter(o=>o!==null&&o!==
|
|
133
|
+
"");n.length>0?r.skipFields=n:delete r.skipFields}if(K(e.skipParams)){let n={};for(let[o,i]of Object.entries(e.skipParams)){
|
|
134
|
+
let s=ql(o,t);s===null||s===""||v(n,s,i)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}function Kl(e,t,r,n){
|
|
135
|
+
let o=t[r];if(!n.includes(o))throw new Error(`Operation "${e}" must define ${r} as one of: ${n.join(", ")}.`)}function Ki(e,t,r,n=!0){
|
|
136
136
|
let o=t[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${e}" must define ${r} as a boolean.`)}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
139
|
-
["validated","input"]),
|
|
137
|
+
function Yb(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);
|
|
138
|
+
return Kl(e,t,"targetFields",["schema","input"]),Ki(e,t,"enforceRequired"),Ki(e,t,"applyDefaults"),Kl(e,t,"outputFields",
|
|
139
|
+
["validated","input"]),Ki(e,t,"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.
|
|
140
140
|
enforceRequired,applyDefaults:t.applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===
|
|
141
|
-
void 0?!0:t.rejectExplicitUndefined})}function
|
|
142
|
-
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
143
|
-
entries(e))
|
|
144
|
-
e))
|
|
145
|
-
()=>{
|
|
141
|
+
void 0?!0:t.rejectExplicitUndefined})}function Kb(e={}){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(
|
|
142
|
+
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(Wb))v(t,r,n);for(let[r,n]of Object.
|
|
143
|
+
entries(e))v(t,r,Yb(r,n));return Object.freeze(t)}function Jl(e){let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
144
|
+
e))v(t,r,n);return Object.freeze(t)}function Jb(e){let t={...e};return delete t.operation,delete t.mode,t}var Wb,pt,Ql=f(
|
|
145
|
+
()=>{Vl();$i();nr();er();Wb=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,
|
|
146
146
|
outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,
|
|
147
147
|
outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,applyDefaults:!1,
|
|
148
|
-
outputFields:"input",rejectExplicitUndefined:!0})});
|
|
149
|
-
validators=
|
|
148
|
+
outputFields:"input",rejectExplicitUndefined:!0})});pt=class{constructor(t,r,n,o={}){this.structure=t,this.types=Jl(r),this.
|
|
149
|
+
validators=Jl(n),this.operations=Kb(o),this._installOperationMethods()}_typeError(t){return this._paramError(t,"TYPE_CAS\
|
|
150
150
|
T_FAILED","Value could not be cast to the required type.")}_paramError(t,r,n,o={}){let i=new Error(n);return i.errorObject=
|
|
151
151
|
{field:t,code:r,message:n,params:o},i}_paramToBeSkipped(t,r,n){return typeof r!="object"||r===null?!1:!!(Array.isArray(r[n])&&
|
|
152
152
|
r[n].includes(t))}_fieldToBeSkipped(t,r){return Array.isArray(r.skipFields)&&r.skipFields.includes(t)}_mergeErrors(t,r){
|
|
153
|
-
for(let[n,o]of Object.entries(r))
|
|
153
|
+
for(let[n,o]of Object.entries(r))v(t,n,o)}_singleErrorMap(t){let r={};return v(r,t.field,t),r}_assertSupportedOptions(t={}){
|
|
154
154
|
if(Object.hasOwn(t,"onlyObjectValues"))throw new Error("Unsupported validation option `onlyObjectValues`. Call `patch()`\
|
|
155
155
|
directly.");if(Object.hasOwn(t,"mode"))throw new Error("Unsupported validation option `mode`. Call `validateWith()` or \
|
|
156
156
|
an operation method directly.");if(Object.hasOwn(t,"operation"))throw new Error("Unsupported validation option `operatio\
|
|
157
157
|
n`. Call `validateWith()` or an operation method directly.")}_buildOperationSettings(t,r,n){return{operationName:t,operation:r,
|
|
158
158
|
targetFieldNames:r.targetFields==="input"?Object.keys(n):Object.keys(this.structure),outputFieldNames:r.outputFields==="\
|
|
159
159
|
input"?Object.keys(n):Object.keys(this.structure),enforceRequired:r.enforceRequired,applyDefaults:r.applyDefaults,rejectExplicitUndefined:r.
|
|
160
|
-
rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:o=>Object.hasOwn(n,o)}}_assertPlainObjectInput(t,r){if(!
|
|
160
|
+
rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:o=>Object.hasOwn(n,o)}}_assertPlainObjectInput(t,r){if(!K(
|
|
161
161
|
r))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidationRequest(t={}){let r=t.operation??t.mode??
|
|
162
162
|
"patch";if(Object.hasOwn(t,"operation")&&Object.hasOwn(t,"mode")&&t.operation!==t.mode)throw new Error("Path validation \
|
|
163
163
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(
|
|
164
|
-
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:
|
|
164
|
+
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:Jb(t)}}_buildOperationResult(t,r,n){
|
|
165
165
|
let o={};for(let i of n.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=n.isFieldPresent(i);(r[i]!==
|
|
166
|
-
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||
|
|
167
|
-
return
|
|
166
|
+
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||v(o,i,r[i]))}return o}_resolveObjectFieldMode(t,r){
|
|
167
|
+
return Zr(t,r)}_resolveArrayItemsConfig(t,r){return Xr(t,r)}_resolveObjectValuesConfig(t,r){return tr(t,r)}_buildArrayItemSettings(t,r){
|
|
168
168
|
return t.type==="object"&&Object.hasOwn(t,"schema")?{...r,operationName:"replace",operation:this.operations.replace}:r}_castValue(t,r,n,o,i,s,a,c){
|
|
169
169
|
let l=t.nullable===!0||a.nullable===!0,u=t.nullOnEmpty===!0||a.nullOnEmpty===!0;if(!Object.hasOwn(this.types,t.type))throw new Error(
|
|
170
|
-
`No casting function for type: ${t.type}`);let
|
|
170
|
+
`No casting function for type: ${t.type}`);let p=this.types[t.type];if(r===null)return l?(v(o,i,null),{errors:{},shouldContinue:!1}):
|
|
171
171
|
{errors:this._singleErrorMap({field:n,code:"NOT_NULLABLE",message:"Field cannot be null",params:{}}),shouldContinue:!1};
|
|
172
|
-
if(r===""&&u)return
|
|
172
|
+
if(r===""&&u)return v(o,i,null),{errors:{},shouldContinue:!1};let d={schema:this,definition:t,value:r,fieldName:n,object:o,
|
|
173
173
|
objectBeforeCast:s,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
|
|
174
|
-
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(m,h,
|
|
175
|
-
n,m,h,
|
|
176
|
-
i,m),
|
|
177
|
-
errors:{},context:
|
|
174
|
+
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(m,h,y)=>{throw this._paramError(
|
|
175
|
+
n,m,h,y)}};try{let m=p(d);if(Gl(m))throw new Error(`Type handler for "${t.type}" must be synchronous.`);m!==void 0&&(v(o,
|
|
176
|
+
i,m),d.value=m)}catch(m){if(m.errorObject)return{errors:this._singleErrorMap(m.errorObject),shouldContinue:!1};throw m}return{
|
|
177
|
+
errors:{},context:d,shouldContinue:!0}}_runFieldValidators(t,r,n,o,i,s){for(let a of Object.keys(t)){if(a==="type"||this.
|
|
178
178
|
_paramToBeSkipped(a,s.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{i.parameterName=
|
|
179
|
-
a,i.parameterValue=t[a];let l=c(i);if(
|
|
180
|
-
(
|
|
179
|
+
a,i.parameterValue=t[a];let l=c(i);if(Gl(l))throw new Error(`Validator handler for "${a}" must be synchronous.`);l!==void 0&&
|
|
180
|
+
(v(n,o,l),i.value=l)}catch(l){if(l.errorObject)return this._singleErrorMap(l.errorObject);throw l}}return{}}_normalizeAndValidateValue(t,r,n,o,i,s,a,c){
|
|
181
181
|
let l=this._castValue(t,r,n,o,i,s,a,c);if(Object.keys(l.errors).length>0)return l.errors;if(!l.shouldContinue)return{};let{
|
|
182
|
-
context:u}=l,
|
|
182
|
+
context:u}=l,p=this._validateNestedValue(t,n,o,i,a,c);return Object.keys(p).length>0?p:(u.value=o[i],this._runFieldValidators(
|
|
183
183
|
t,n,o,i,u,a))}_normalizeDefault(t,r,{fieldPath:n,currentObject:o,containerKey:i,objectBeforeCast:s,options:a,settings:c}){
|
|
184
|
-
let l={...o};return
|
|
184
|
+
let l={...o};return v(l,i,r),{errors:this._normalizeAndValidateValue(t,r,n,l,i,s,a,c),value:l[i]}}_validateNestedValue(t,r,n,o,i,s){
|
|
185
185
|
if(t.type==="object"){let c=this._resolveObjectFieldMode(r,t);return c.kind==="nested"?this._validateNestedObjectSchema(
|
|
186
186
|
c,r,n,o,i,s):c.kind==="map"?this._validateObjectValues(r,n,o,c.valuesConfig,i,s):{}}if(t.type!=="array")return{};let a=this.
|
|
187
187
|
_resolveArrayItemsConfig(r,t);return a?this._validateArrayItems(r,n,o,a,i,s):{}}_validateNestedObjectSchema(t,r,n,o,i,s){
|
|
188
188
|
let a=n[o],c=t.allowAdditionalProperties?this._extractKnownObjectFields(a,t.schema):a,l=t.schema._validateWithOperation(
|
|
189
|
-
s.operationName,s.operation,c,
|
|
190
|
-
a,t.schema,l.validatedObject):l.validatedObject),
|
|
191
|
-
entries(t))Object.hasOwn(r.structure,o)&&
|
|
192
|
-
keys(t)){if(!Object.hasOwn(r.structure,i)){
|
|
193
|
-
n))Object.hasOwn(o,i)||
|
|
194
|
-
keys(a)){let
|
|
195
|
-
_mergeErrors(l,this._singleErrorMap(this._typeError(
|
|
196
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,
|
|
197
|
-
l,
|
|
198
|
-
definition,s));this._mergeErrors(l,m)}return l}_validateArrayItems(t,r,n,o,i,s){let a=r[n],c=a.slice(),l={};
|
|
199
|
-
c.length;u++){let
|
|
200
|
-
this._mergeErrors(l,this._singleErrorMap(this._typeError(
|
|
201
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],
|
|
202
|
-
l,
|
|
203
|
-
o.definition,s));this._mergeErrors(l,
|
|
189
|
+
s.operationName,s.operation,c,ft(i,r));return v(n,o,t.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
|
|
190
|
+
a,t.schema,l.validatedObject):l.validatedObject),dt(l.errors,r)}_extractKnownObjectFields(t,r){let n={};for(let[o,i]of Object.
|
|
191
|
+
entries(t))Object.hasOwn(r.structure,o)&&v(n,o,i);return n}_mergeKnownAndPassthroughObjectFields(t,r,n){let o={};for(let i of Object.
|
|
192
|
+
keys(t)){if(!Object.hasOwn(r.structure,i)){v(o,i,t[i]);continue}Object.hasOwn(n,i)&&v(o,i,n[i])}for(let[i,s]of Object.entries(
|
|
193
|
+
n))Object.hasOwn(o,i)||v(o,i,s);return o}_validateObjectValues(t,r,n,o,i,s){let a=r[n],c={...a},l={};v(r,n,c);for(let u of Object.
|
|
194
|
+
keys(a)){let p=Ve(t,u);if(this._fieldToBeSkipped(p,i))continue;let d=c[u];if(d===void 0){s.rejectExplicitUndefined?this.
|
|
195
|
+
_mergeErrors(l,this._singleErrorMap(this._typeError(p).errorObject)):delete c[u];continue}if(o.kind==="schema"){let h=o.
|
|
196
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,d,ft(i,p));v(c,u,h.validatedObject),this._mergeErrors(
|
|
197
|
+
l,dt(h.errors,p));continue}let m=this._normalizeAndValidateValue(o.definition,d,p,c,u,a,i,this._buildArrayItemSettings(o.
|
|
198
|
+
definition,s));this._mergeErrors(l,m)}return l}_validateArrayItems(t,r,n,o,i,s){let a=r[n],c=a.slice(),l={};v(r,n,c);for(let u=0;u<
|
|
199
|
+
c.length;u++){let p=Ve(t,u);if(this._fieldToBeSkipped(p,i))continue;if(!Object.hasOwn(a,u)||c[u]===void 0){s.rejectExplicitUndefined?
|
|
200
|
+
this._mergeErrors(l,this._singleErrorMap(this._typeError(p).errorObject)):delete c[u];continue}if(o.kind==="schema"){let m=o.
|
|
201
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],ft(i,p));v(c,u,m.validatedObject),this._mergeErrors(
|
|
202
|
+
l,dt(m.errors,p));continue}let d=this._normalizeAndValidateValue(o.definition,c[u],p,c,u,a,i,this._buildArrayItemSettings(
|
|
203
|
+
o.definition,s));this._mergeErrors(l,d)}return l}_validateField(t,r,n,o,i){if(!Object.hasOwn(this.structure,t))return{};
|
|
204
204
|
let s=this.structure[t];if(this._fieldToBeSkipped(t,o))return{};let a=i.isFieldPresent(t),c=r[t],l=c===void 0;return i.enforceRequired&&
|
|
205
205
|
s.required&&(!a||l)&&!this._paramToBeSkipped("required",o.skipParams,t)?this._singleErrorMap({field:t,code:"REQUIRED",message:"\
|
|
206
206
|
Field is required",params:{}}):a?l?i.rejectExplicitUndefined?this._singleErrorMap(this._typeError(t).errorObject):{}:this.
|
|
207
207
|
_normalizeAndValidateValue(s,c,t,n,t,r,o,i):{}}_validateWithOperation(t,r,n,o){this._assertSupportedOptions(o);let i={},
|
|
208
|
-
s={...n},a=this._buildOperationSettings(t,r,n);for(let c of Object.keys(n))Object.hasOwn(this.structure,c)||
|
|
208
|
+
s={...n},a=this._buildOperationSettings(t,r,n);for(let c of Object.keys(n))Object.hasOwn(this.structure,c)||v(i,c,{field:c,
|
|
209
209
|
code:"FIELD_NOT_ALLOWED",message:"Field not allowed",params:{}});for(let c of a.targetFieldNames){let l=this._validateField(
|
|
210
210
|
c,n,s,o,a);this._mergeErrors(i,l)}if(a.applyDefaults){for(let c of Object.keys(this.structure))if(!a.isFieldPresent(c)&&
|
|
211
211
|
this.structure[c].defaultTo!==void 0){let l=this.structure[c],u=typeof l.defaultTo=="function"?l.defaultTo():l.defaultTo,
|
|
212
|
-
|
|
213
|
-
_mergeErrors(i,
|
|
214
|
-
_buildOperationResult(n,s,a),errors:i}}_validateSelectedTree(t,r,n,o,i=""){let s={},a={};for(let c of
|
|
215
|
-
let l=
|
|
212
|
+
p=this._normalizeDefault(l,u,{fieldPath:c,currentObject:s,containerKey:c,objectBeforeCast:n,options:o,settings:a});if(this.
|
|
213
|
+
_mergeErrors(i,p.errors),Object.keys(p.errors).length>0)continue;v(s,c,p.value),a.defaultedFields.add(c)}}return{validatedObject:this.
|
|
214
|
+
_buildOperationResult(n,s,a),errors:i}}_validateSelectedTree(t,r,n,o,i=""){let s={},a={};for(let c of Yl(Object.keys(t))){
|
|
215
|
+
let l=Xl(i,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${l}".`);let u=this._validateSelectedField(
|
|
216
216
|
c,t[c],r,a,n,o,l);this._mergeErrors(s,u)}return{validatedObject:a,errors:s}}_validateSelectedField(t,r,n,o,i,s,a){if(!Object.
|
|
217
|
-
hasOwn(this.structure,t))return{};let c=this.structure[t],l=r.self===!0,u=
|
|
218
|
-
let
|
|
217
|
+
hasOwn(this.structure,t))return{};let c=this.structure[t],l=r.self===!0,u=Hl(r);if(this._fieldToBeSkipped(a,i))return{};
|
|
218
|
+
let p=Object.hasOwn(n,t),d=n[t],m={};if(!p){if(l&&s.enforceRequired&&c.required&&!this._paramToBeSkipped("required",i.skipParams,
|
|
219
219
|
a)&&this._mergeErrors(m,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),l&&s.applyDefaults&&
|
|
220
|
-
c.defaultTo!==void 0){let
|
|
220
|
+
c.defaultTo!==void 0){let g=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,b=this._normalizeDefault(c,g,{fieldPath:a,
|
|
221
221
|
currentObject:o,containerKey:t,objectBeforeCast:n,options:i,settings:s});this._mergeErrors(m,b.errors),Object.keys(b.errors).
|
|
222
|
-
length===0&&
|
|
223
|
-
a).errorObject):{};let h={[t]:
|
|
224
|
-
h[t]!==void 0?
|
|
225
|
-
|
|
226
|
-
h,t,i,s);return
|
|
227
|
-
n,t);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let l=o[i];if(!
|
|
228
|
-
l))return{};let u=c.schema._validateSelectedTree(r,l,
|
|
229
|
-
|
|
222
|
+
length===0&&v(o,t,b.value)}return m}if(d===void 0)return l&&s.rejectExplicitUndefined?this._singleErrorMap(this._typeError(
|
|
223
|
+
a).errorObject):{};let h={[t]:d};if(l){let g=this._normalizeAndValidateValue(c,d,a,h,t,n,i,s);return Object.hasOwn(h,t)&&
|
|
224
|
+
h[t]!==void 0?v(o,t,h[t]):h[t]===null&&v(o,t,null),g}if(!u)return{};let y=this._castValue(c,d,a,h,t,n,i,s);if(Object.keys(
|
|
225
|
+
y.errors).length>0)return y.errors;if(!y.shouldContinue)return{};let w=this._validateSelectedDescendants(c,r.children,a,
|
|
226
|
+
h,t,i,s);return rn(h[t])&&v(o,t,h[t]),w}_validateSelectedDescendants(t,r,n,o,i,s,a){if(t.type==="object"){let c=this._resolveObjectFieldMode(
|
|
227
|
+
n,t);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let l=o[i];if(!K(
|
|
228
|
+
l))return{};let u=c.schema._validateSelectedTree(r,l,ft(s,n),{...a,defaultedFields:new Set});return v(o,i,u.validatedObject),
|
|
229
|
+
dt(u.errors,n)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(n,t);if(!c)throw new Error(`Schema path "${n}" d\
|
|
230
230
|
oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,i,c,r,s,a)}throw new Error(
|
|
231
231
|
`Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(t,r,n,o,i,s,a){let c=[],l=r[n],
|
|
232
|
-
u={};
|
|
233
|
-
id because array segments must use numeric indexes.`);let
|
|
234
|
-
m,s))continue;if(!Object.hasOwn(l,
|
|
235
|
-
if(
|
|
236
|
-
let
|
|
237
|
-
this._mergeErrors(u,
|
|
238
|
-
operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});
|
|
239
|
-
this._mergeErrors(u,
|
|
240
|
-
o.definition,
|
|
241
|
-
continue}if(!
|
|
242
|
-
u,S.errors);continue}if(!S.shouldContinue)continue;let
|
|
243
|
-
s,b);
|
|
232
|
+
u={};v(r,n,c);for(let p of Yl(Object.keys(i))){if(!/^[0-9]+$/.test(p))throw new Error(`Schema path "${Ve(t,p)}" is inval\
|
|
233
|
+
id because array segments must use numeric indexes.`);let d=Number(p),m=Ve(t,d),h=i[p],y=h.self===!0,w=Hl(h);if(this._fieldToBeSkipped(
|
|
234
|
+
m,s))continue;if(!Object.hasOwn(l,d)){y&&a.rejectExplicitUndefined&&v(u,m,this._typeError(m).errorObject);continue}let g=l[d];
|
|
235
|
+
if(g===void 0){y&&a.rejectExplicitUndefined&&v(u,m,this._typeError(m).errorObject);continue}if(o.kind==="schema"){if(y){
|
|
236
|
+
let I=o.schema._validateWithOperation("replace",o.schema.operations.replace,g,ft(s,m));rn(I.validatedObject)&&v(c,d,I.validatedObject),
|
|
237
|
+
this._mergeErrors(u,dt(I.errors,m));continue}if(!w)continue;let T=o.schema._validateSelectedTree(h.children,g,ft(s,m),{...a,
|
|
238
|
+
operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});rn(T.validatedObject)&&v(c,d,T.validatedObject),
|
|
239
|
+
this._mergeErrors(u,dt(T.errors,m));continue}let b=this._buildArrayItemSettings(o.definition,a),E=[g];if(y){let T=this._normalizeAndValidateValue(
|
|
240
|
+
o.definition,g,m,E,0,l,s,b);Object.hasOwn(E,0)&&E[0]!==void 0?v(c,d,E[0]):E[0]===null&&v(c,d,null),this._mergeErrors(u,T);
|
|
241
|
+
continue}if(!w)continue;let S=this._castValue(o.definition,g,m,E,0,l,s,b);if(Object.keys(S.errors).length>0){this._mergeErrors(
|
|
242
|
+
u,S.errors);continue}if(!S.shouldContinue)continue;let _=this._validateSelectedDescendants(o.definition,h.children,m,E,0,
|
|
243
|
+
s,b);rn(E[0])&&v(c,d,E[0]),this._mergeErrors(u,_)}return u}validateWith(t,r,n={}){if(!Object.hasOwn(this.operations,t))throw new Error(
|
|
244
244
|
`Unknown operation "${t}".`);let o=this.operations[t];return this._assertPlainObjectInput(t,r),this._validateWithOperation(
|
|
245
|
-
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=
|
|
246
|
-
_resolvePathValidationRequest(n),c=this._validateSelectedTree(
|
|
245
|
+
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=Ji(t),{operationName:i,operation:s,validationOptions:a}=this.
|
|
246
|
+
_resolvePathValidationRequest(n),c=this._validateSelectedTree(Wl([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:Gb(
|
|
247
247
|
c.validatedObject,o),errors:c.errors}}validatePaths(t,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
|
|
248
248
|
isArray(t)||t.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
|
|
249
|
-
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(
|
|
249
|
+
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(Wl(t),r,s,this.
|
|
250
250
|
_buildOperationSettings(o,i,r))}_installOperationMethods(){for(let t of Object.keys(this.operations)){if(t in this)throw new Error(
|
|
251
251
|
`Operation name "${t}" is reserved and cannot be used as a schema method.`);this[t]=(r,n={})=>this.validateWith(t,r,n)}}toJsonSchema(t={}){
|
|
252
|
-
return
|
|
253
|
-
"")throw new Error("Field path must be a non-empty string.");let r=
|
|
254
|
-
let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):
|
|
255
|
-
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&
|
|
256
|
-
t",
|
|
257
|
-
-1<t.indexOf(u)?
|
|
258
|
-
l,r);return"["+s.join(",")+"]";function l(u,
|
|
259
|
-
null)return
|
|
252
|
+
return zl(this,t)}getFieldDefinitions(){return Yi(this.structure)}getFieldDefinition(t){if(typeof t!="string"||t.trim()===
|
|
253
|
+
"")throw new Error("Field path must be a non-empty string.");let r=Xi(this,Ji(t.trim()));return r===null?null:Yi(r)}getFieldMessages(t){
|
|
254
|
+
let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):Yi(r.messages)}cleanup(t,r){
|
|
255
|
+
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&v(n,o,t[o]);return n}}});var TC,Xb,OC,Zb,Qb,eu,eE,tu,ru,nu=f(()=>{({parse:TC,stringify:Xb}=JSON),{keys:OC}=Object,Zb=String,Qb="string",eu="objec\
|
|
256
|
+
t",eE=(e,t)=>t,tu=(e,t,r)=>{let n=Zb(t.push(r)-1);return e.set(r,n),n},ru=(e,t,r)=>{let n=t&&typeof t===eu?(u,p)=>u===""||
|
|
257
|
+
-1<t.indexOf(u)?p:void 0:t||eE,o=new Map,i=[],s=[],a=+tu(o,i,n.call({"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=Xb(i[a++],
|
|
258
|
+
l,r);return"["+s.join(",")+"]";function l(u,p){if(c)return c=!c,p;let d=n.call(this,u,p);switch(typeof d){case eu:if(d===
|
|
259
|
+
null)return d;case Qb:return o.get(d)||tu(o,i,d)}return d}}});function oE(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function ou(e){if(typeof e==
|
|
260
260
|
"number")return Number.isFinite(e)?e:null;if(typeof e=="bigint"){let t=Number(e);return Number.isSafeInteger(t)?t:null}if(typeof e==
|
|
261
|
-
"string"){let t=e.trim();if(t==="")return null;let r=Number(t);return Number.isFinite(r)?r:null}return null}function
|
|
261
|
+
"string"){let t=e.trim();if(t==="")return null;let r=Number(t);return Number.isFinite(r)?r:null}return null}function Qi(e,t){
|
|
262
262
|
if(Object.is(e,t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&
|
|
263
263
|
t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(
|
|
264
|
-
e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!
|
|
264
|
+
e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!Qi(e[o],t[o]))return!1;return!0}if(e===
|
|
265
265
|
null||t===null||typeof e!="object"||typeof t!="object"||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let r=Object.
|
|
266
|
-
keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(t,o)||!
|
|
267
|
-
return!0}var
|
|
268
|
-
no","n","off"]);
|
|
266
|
+
keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(t,o)||!Qi(e[o],t[o]))return!1;
|
|
267
|
+
return!0}var rE,nE,iE,iu,su=f(()=>{nu();Mi();ji();er();rE=new Set(["true","1","yes","y","on"]),nE=new Set(["false","0","\
|
|
268
|
+
no","n","off"]);iE={install(e){let{addType:t,addValidator:r}=e;t("none",n=>n.value),t("file",n=>{let o=n.value;o==null&&
|
|
269
269
|
n.throwTypeError();let i=typeof o;if(i==="string"||i==="number"||i==="boolean"){let s=o.toString();return n.definition.noTrim?
|
|
270
270
|
s:s.trim()}n.throwTypeError()}),t("string",n=>{let o=n.value;if(o==null)return"";let i=typeof o;if(i==="string"||i==="nu\
|
|
271
271
|
mber"||i==="boolean"){let s=o.toString();return n.definition.noTrim?s:s.trim()}n.throwTypeError()}),t("blob",n=>n.value),
|
|
272
|
-
t("number",n=>{let o=
|
|
273
|
-
!Number.isInteger(o))&&n.throwTypeError(),o}),t("epochMilliseconds",n=>{let o=
|
|
274
|
-
o}),t("epochSeconds",n=>{let o=
|
|
275
|
-
n.fieldName);return
|
|
276
|
-
"time",n=>{let o=
|
|
277
|
-
type==="array"&&!Array.isArray(n.value)?[n.value]:n.value),t("object",n=>(
|
|
278
|
-
rialize",n=>{try{return JSON.stringify(n.value)}catch{try{return
|
|
272
|
+
t("number",n=>{let o=ou(n.value);return o===null&&n.throwTypeError(),o}),t("integer",n=>{let o=ou(n.value);return(o===null||
|
|
273
|
+
!Number.isInteger(o))&&n.throwTypeError(),o}),t("epochMilliseconds",n=>{let o=Di(n.value,864e13);return o===null&&n.throwTypeError(),
|
|
274
|
+
o}),t("epochSeconds",n=>{let o=Di(n.value,864e10);return o===null&&n.throwTypeError(),o}),t("dateTime",n=>{let o=rr(n.definition,
|
|
275
|
+
n.fieldName);return $l(n.value,o)||n.throwTypeError(),n.value}),t("date",n=>(Nl(n.value)||n.throwTypeError(),n.value)),t(
|
|
276
|
+
"time",n=>{let o=rr(n.definition,n.fieldName);return kl(n.value,o)||n.throwTypeError(),n.value}),t("array",n=>n.definition.
|
|
277
|
+
type==="array"&&!Array.isArray(n.value)?[n.value]:n.value),t("object",n=>(K(n.value)||n.throwTypeError(),n.value)),t("se\
|
|
278
|
+
rialize",n=>{try{return JSON.stringify(n.value)}catch{try{return ru(n.value)}catch{n.throwTypeError()}}}),t("boolean",n=>{
|
|
279
279
|
if(typeof n.value=="boolean")return n.value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;
|
|
280
280
|
n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value===1n)return!0;if(n.value===0n)return!1;n.throwTypeError()}if(typeof n.
|
|
281
281
|
value=="string"){let o=String(n.definition.stringFalseWhen||"false").trim().toLowerCase(),i=String(n.definition.stringTrueWhen||
|
|
282
|
-
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...
|
|
282
|
+
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...nE,o]),c=new Set([...rE,i]);if(a.has(s))return!1;
|
|
283
283
|
if(c.has(s))return!0}n.throwTypeError()}),t("id",n=>{if(typeof n.value=="number"){if(Number.isSafeInteger(n.value)&&n.value>
|
|
284
284
|
0)return n.value;n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value>0n&&n.value<=BigInt(Number.MAX_SAFE_INTEGER))
|
|
285
285
|
return Number(n.value);n.throwTypeError()}if(typeof n.value=="string"){let o=n.value.trim();/^[1-9][0-9]*$/.test(o)||n.throwTypeError();
|
|
286
286
|
let i=Number(o);return Number.isSafeInteger(i)||n.throwTypeError(),i}n.throwTypeError()}),r("minLength",n=>{n.value!==void 0&&
|
|
287
287
|
n.definition.type==="string"&&n.value.toString&&n.value.toString().length<n.parameterValue&&n.throwParamError("MIN_LENGT\
|
|
288
288
|
H",`Length must be at least ${n.parameterValue} characters.`,{min:n.parameterValue,actual:n.value.toString().length})}),
|
|
289
|
-
r("min",n=>{n.value!==void 0&&
|
|
289
|
+
r("min",n=>{n.value!==void 0&<(n.definition)&&typeof n.value=="number"&&n.value<n.parameterValue&&n.throwParamError("M\
|
|
290
290
|
IN_VALUE",`Value must be at least ${n.parameterValue}.`,{min:n.parameterValue,actual:n.value})}),r("maxLength",n=>{n.value!==
|
|
291
291
|
void 0&&n.definition.type==="string"&&n.value.toString&&n.value.toString().length>n.parameterValue&&n.throwParamError("M\
|
|
292
292
|
AX_LENGTH",`Length must be no more than ${n.parameterValue} characters.`,{max:n.parameterValue,actual:n.value.toString().
|
|
293
|
-
length})}),r("max",n=>{n.value!==void 0&&
|
|
293
|
+
length})}),r("max",n=>{n.value!==void 0&<(n.definition)&&typeof n.value=="number"&&n.value>n.parameterValue&&n.throwParamError(
|
|
294
294
|
"MAX_VALUE",`Value must be no more than ${n.parameterValue}.`,{max:n.parameterValue,actual:n.value})}),r("enum",n=>{if(!Array.
|
|
295
|
-
isArray(n.parameterValue))throw new Error(`Enum for ${n.fieldName} must be an array.`);n.parameterValue.some(i=>
|
|
295
|
+
isArray(n.parameterValue))throw new Error(`Enum for ${n.fieldName} must be an array.`);n.parameterValue.some(i=>Qi(i,n.value))||
|
|
296
296
|
n.throwParamError("ENUM_VALUE","Value must match one of the allowed enum values.",{allowed:n.parameterValue})}),r("patte\
|
|
297
297
|
rn",n=>{if(n.value===void 0||n.definition.type!=="string"||typeof n.value!="string")return;let o=n.parameterValue,i=o instanceof
|
|
298
298
|
RegExp?new RegExp(o.source,o.flags):typeof o=="string"?new RegExp(o):null;if(!i)throw new Error(`Pattern for ${n.fieldName}\
|
|
@@ -300,7 +300,7 @@ RegExp?new RegExp(o.source,o.flags):typeof o=="string"?new RegExp(o):null;if(!i)
|
|
|
300
300
|
{pattern:i.source})}),r("strictBoolean",n=>{if(n.parameterValue){if(n.definition.type!=="boolean")throw new Error(`stric\
|
|
301
301
|
tBoolean can only be used on boolean fields (${n.fieldName}).`);typeof n.valueBeforeCast!="boolean"&&n.throwParamError("\
|
|
302
302
|
STRICT_BOOLEAN","Value must be a boolean.")}}),r("validator",n=>{if(typeof n.parameterValue!="function")throw new Error(
|
|
303
|
-
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(
|
|
303
|
+
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(oE(o))throw new Error(
|
|
304
304
|
`Custom validator for "${n.fieldName}" must be synchronous.`);typeof o=="string"&&n.throwParamError("CUSTOM_VALIDATOR_FA\
|
|
305
305
|
ILED",o)}),r("uppercase",n=>{if(typeof n.value=="string")return n.value.toUpperCase()}),r("lowercase",n=>{if(typeof n.value==
|
|
306
306
|
"string")return n.value.toLowerCase()}),r("length",n=>{if(typeof n.value=="string")return n.value.substr(0,n.parameterValue);
|
|
@@ -310,212 +310,226 @@ length})}),r("notEmpty",n=>{n.parameterValue&&typeof n.value=="string"&&n.value=
|
|
|
310
310
|
ld cannot be empty.")}),r("required",()=>{}),r("unsigned",()=>{}),r("precision",()=>{}),r("scale",()=>{}),r("temporalPre\
|
|
311
311
|
cision",n=>{if(n.definition.type!=="time"&&n.definition.type!=="dateTime")throw new Error(`temporalPrecision can only be\
|
|
312
312
|
used on time or dateTime fields (${n.fieldName}).`)}),r("nullable",()=>{}),r("nullOnEmpty",()=>{}),r("defaultTo",()=>{})}},
|
|
313
|
-
|
|
314
|
-
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);
|
|
315
|
-
create(null);for(let[r,n]of Object.entries(e))
|
|
316
|
-
"Plugin must have an install method.");e.install(t)}function
|
|
317
|
-
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function
|
|
318
|
-
typeof e!="object"&&typeof e!="function")return null;let t=
|
|
313
|
+
iu=iE});var au=f(()=>{nr()});function sE(e,t,r){if(typeof r!="function")throw new Error(`Type handler for '${t}' must be a function.`);v(e,t,r)}function aE(e,t,r){
|
|
314
|
+
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);v(e,t,r)}function sn(e={}){let t=Object.
|
|
315
|
+
create(null);for(let[r,n]of Object.entries(e))v(t,r,n);return t}function cE(e,t){if(typeof e.install!="function")throw new Error(
|
|
316
|
+
"Plugin must have an install method.");e.install(t)}function cu(e,t,r){uu.set(e,t),du.set(e,r),Object.defineProperty(e,fu,
|
|
317
|
+
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function lE(e){if(!e||
|
|
318
|
+
typeof e!="object"&&typeof e!="function")return null;let t=uu.get(e),r=du.get(e);if(t&&r)return{types:t,validators:r};let n=e[fu];
|
|
319
319
|
return n&&typeof n.getTypes=="function"&&typeof n.getValidators=="function"?{types:n.getTypes(),validators:n.getValidators()}:
|
|
320
320
|
typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.validators=="object"&&typeof e.create=="fu\
|
|
321
321
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
322
|
-
validators}:null}function
|
|
323
|
-
for(let[n,o]of Object.entries(t)){if(Object.hasOwn(e,n)&&!
|
|
324
|
-
conflicting ${r} "${n}".`);
|
|
325
|
-
t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=
|
|
326
|
-
ust be schema instances or schema factories created by json-rest-schema.");
|
|
327
|
-
ator")}return{types:o,validators:i}}function
|
|
328
|
-
let c=new
|
|
329
|
-
|
|
330
|
-
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(
|
|
331
|
-
new WeakMap,
|
|
332
|
-
ject"||Array.isArray(e)?{...t}:e}var
|
|
333
|
-
"unknown"]);
|
|
334
|
-
auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
335
|
-
versionName:"1.0.0"})});function
|
|
336
|
-
e))
|
|
337
|
-
"function"&&typeof e.toJsonSchema=="function"}function
|
|
338
|
-
if(!
|
|
339
|
-
create",context:r="schema definition.mode"}={}){let n=
|
|
340
|
-
call(n,"mode")?
|
|
341
|
-
replace, patch.`);return i}function
|
|
342
|
-
o=
|
|
343
|
-
r)):{}}function
|
|
344
|
-
let n=
|
|
345
|
-
"string"){let a=
|
|
346
|
-
t?.code||"Invalid value.")}function
|
|
347
|
-
if(typeof i=="string"){n[s]=i;continue}let a=
|
|
348
|
-
["create","replace","patch"]),
|
|
322
|
+
validators}:null}function uE(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function dE(e,t){return e===t}function lu(e,t,r){
|
|
323
|
+
for(let[n,o]of Object.entries(t)){if(Object.hasOwn(e,n)&&!dE(e[n],o))throw new Error(`Cannot merge schema factories with\
|
|
324
|
+
conflicting ${r} "${n}".`);v(e,n,o)}}function fE(e,t,r){let n=uE(r).filter(Boolean);if(n.length<1)return{types:sn(e),validators:sn(
|
|
325
|
+
t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=lE(s);if(!a)throw new Error("Factory sources m\
|
|
326
|
+
ust be schema instances or schema factories created by json-rest-schema.");lu(o,a.types,"type"),lu(i,a.validators,"valid\
|
|
327
|
+
ator")}return{types:o,validators:i}}function pu({types:e={},validators:t={},installCore:r=!0}={}){let n=sn(e),o=sn(t),i=(s,a={})=>{
|
|
328
|
+
let c=new pt(s,n,o,a.operations);return cu(c,n,o),c};return cu(i,n,o),i.addType=(s,a)=>{sE(n,s,a)},i.addValidator=(s,a)=>{
|
|
329
|
+
aE(o,s,a)},i.use=s=>{cE(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{let a=fE(n,o,s);return pu(
|
|
330
|
+
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(iu),i}var uu,du,fu,M,mt=f(()=>{Ql();su();au();nr();uu=
|
|
331
|
+
new WeakMap,du=new WeakMap,fu=Symbol.for("json-rest-schema.registry-metadata");M=pu({installCore:!0})});var mu=f(()=>{});function H(e,{fallback:t=""}={}){return String(e||"").trim()||t}function Q(e,{fallback:t={}}={}){return!e||typeof e!="ob\
|
|
332
|
+
ject"||Array.isArray(e)?{...t}:e}var GC,HC,qC,WC,YC,de=f(()=>{GC=Object.freeze(["none","pending","committed","rolledBack",
|
|
333
|
+
"unknown"]);HC=Object.freeze(["bundled","dev_server"]),qC=Object.freeze(["capacitor"]),WC=Object.freeze({callbackPath:"/\
|
|
334
|
+
auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),YC=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
335
|
+
versionName:"1.0.0"})});function Ge(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e);for(let r of Object.getOwnPropertyNames(
|
|
336
|
+
e))Ge(e[r],t);return Object.freeze(e)}var an=f(()=>{});function cn(e){return!!e&&typeof e=="object"&&typeof e.create=="function"&&typeof e.replace=="function"&&typeof e.patch==
|
|
337
|
+
"function"&&typeof e.toJsonSchema=="function"}function hE(e=null,{context:t="schema definition.schema"}={}){let r=Q(e).schema;
|
|
338
|
+
if(!cn(r))throw new TypeError(`${t} must be a json-rest-schema schema instance.`);return r}function es(e=null,{defaultMode:t="\
|
|
339
|
+
create",context:r="schema definition.mode"}={}){let n=Q(e),o=H(t).toLowerCase()||"create",i=Object.prototype.hasOwnProperty.
|
|
340
|
+
call(n,"mode")?H(n.mode).toLowerCase():"";if(!i)return o;if(!pE.has(i))throw new TypeError(`${r} must be one of: create,\
|
|
341
|
+
replace, patch.`);return i}function hu(e=null,t,r={}){let n=hE(e,{context:`${r?.context||"schema definition"}.schema`}),
|
|
342
|
+
o=es(e,r);return n[o](t)}function gu(e=null,t=""){let r=H(t);if(!r)return{};let n=Q(e);return cn(n.schema)?Q(n.schema.getFieldMessages(
|
|
343
|
+
r)):{}}function gE(e=null,t=""){let r=H(t).split(".").filter(Boolean);return r.length<2?{}:(r.pop(),gu(e,r.join(".")))}function yE(e,t,r=null){
|
|
344
|
+
let n=H(t?.code).toUpperCase(),o=gu(r,e),i=n==="FIELD_NOT_ALLOWED"&&Object.keys(o).length<1?gE(r,e):o,s=mE[n];if(s&&typeof i[s]==
|
|
345
|
+
"string"){let a=H(i[s]);if(a)return a}if(typeof i.default=="string"){let a=H(i.default);if(a)return a}return H(t?.message||
|
|
346
|
+
t?.code||"Invalid value.")}function ts(e={},t=null){let r=Q(e),n={};for(let[o,i]of Object.entries(r)){let s=H(o);if(!s)continue;
|
|
347
|
+
if(typeof i=="string"){n[s]=i;continue}let a=yE(s,i,t);n[s]=a||"Invalid value."}return n}var pE,mE,yu=f(()=>{de();pE=new Set(
|
|
348
|
+
["create","replace","patch"]),mE=Object.freeze({REQUIRED:"required",TYPE_CAST_FAILED:"default",NOT_NULLABLE:"default",MIN_LENGTH:"\
|
|
349
349
|
minLength",MAX_LENGTH:"maxLength",MIN_VALUE:"min",MAX_VALUE:"max",PATTERN:"pattern",ENUM_VALUE:"enum",FIELD_NOT_ALLOWED:"\
|
|
350
|
-
additionalProperties",CUSTOM_VALIDATOR_FAILED:"default"})});function
|
|
351
|
-
prototype.hasOwnProperty.call(e,"mode"))}function
|
|
352
|
-
if(!
|
|
353
|
-
call(n,"schema"))throw new TypeError(`${t}.schema is required.`);if(!
|
|
354
|
-
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=
|
|
355
|
-
"patch",context:`${t}.mode`}),Object.freeze(o)}function
|
|
356
|
-
e,{context:t,defaultMode:r})}function
|
|
357
|
-
defaultMode:n});return o?
|
|
358
|
-
freeze({schema:
|
|
359
|
-
|
|
350
|
+
additionalProperties",CUSTOM_VALIDATOR_FAILED:"default"})});function wE(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&(Object.prototype.hasOwnProperty.call(e,"schema")||Object.
|
|
351
|
+
prototype.hasOwnProperty.call(e,"mode"))}function ln(e,{context:t="schema definition",defaultMode:r=""}={}){if(e==null)return null;
|
|
352
|
+
if(!wE(e))throw new TypeError(`${t} must be a schema definition object.`);let n=Q(e);if(!Object.prototype.hasOwnProperty.
|
|
353
|
+
call(n,"schema"))throw new TypeError(`${t}.schema is required.`);if(!cn(n.schema))throw new TypeError(`${t}.schema must \
|
|
354
|
+
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=H(r).toLowerCase();return o.mode=es(n,{defaultMode:i||
|
|
355
|
+
"patch",context:`${t}.mode`}),Object.freeze(o)}function wu(e,{context:t="schema definition",defaultMode:r=""}={}){return ln(
|
|
356
|
+
e,{context:t,defaultMode:r})}function rs(e,t,{context:r="schema definition",defaultMode:n=""}={}){let o=wu(e,{context:r,
|
|
357
|
+
defaultMode:n});return o?hu(o,t,{defaultMode:n||"patch",context:`${r}.mode`}):null}var ir=f(()=>{de();yu()});var bu=f(()=>{mt();de();an();ir()});var Eu=f(()=>{mt();an();ir()});var bE,EE,Su=f(()=>{mt();bE=M({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),EE=Object.
|
|
358
|
+
freeze({schema:bE,mode:"patch"})});var _u,SE,Tu=f(()=>{_u=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),
|
|
359
|
+
SE=Object.freeze({..._u,nullable:!0})});var Ou=f(()=>{});function Au({message:e="Schema validation failed.",fieldErrors:t=null,errors:r=null,cause:n,statusCode:o=null}={}){let i=new Error(
|
|
360
360
|
e,n?{cause:n}:void 0);return Number.isInteger(o)&&o>=400&&o<=599&&(i.statusCode=o),t&&typeof t=="object"?(i.fieldErrors=
|
|
361
|
-
t,i.details={...i.details||{},fieldErrors:t}):r!=null&&(i.details={...i.details||{},errors:r}),i}function
|
|
362
|
-
input",context:n="schema definition",statusCode:o=null}={}){if(e==null)return t;let i=
|
|
363
|
-
replace":"patch",context:n});if(!i)throw new TypeError(`${n}.schema must be a json-rest-schema schema instance.`);let s=
|
|
364
|
-
i?.errors,e);if(Object.keys(s).length>0)throw
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
mode:"patch"})});var
|
|
368
|
-
t,n))throw new Error(`${r}: unknown fields or noncanonical values.`);return n}var
|
|
369
|
-
|
|
370
|
-
maxLength:t,items:e,validator:r=>Array.isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),
|
|
371
|
-
required:!0,enum:[1]},
|
|
372
|
-
rubric:
|
|
373
|
-
check:{...
|
|
374
|
-
prerequisites:
|
|
375
|
-
type:"object",required:!1,schema:
|
|
376
|
-
...
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
function
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
i,s)
|
|
361
|
+
t,i.details={...i.details||{},fieldErrors:t}):r!=null&&(i.details={...i.details||{},errors:r}),i}function ns(e,t,{phase:r="\
|
|
362
|
+
input",context:n="schema definition",statusCode:o=null}={}){if(e==null)return t;let i=rs(e,t,{defaultMode:r==="output"?"\
|
|
363
|
+
replace":"patch",context:n});if(!i)throw new TypeError(`${n}.schema must be a json-rest-schema schema instance.`);let s=ts(
|
|
364
|
+
i?.errors,e);if(Object.keys(s).length>0)throw Au({fieldErrors:s,statusCode:o});return i?.validatedObject??t}var vu=f(()=>{
|
|
365
|
+
ir()});var Iu,os,_E,TE,Ru=f(()=>{mt();an();Iu="^[1-9][0-9]*$",os=Ge({type:"string",minLength:1,pattern:Iu}),_E=Ge({...os,nullable:!0}),
|
|
366
|
+
TE=Ge({schema:M({recordId:{...os,required:!0,messages:{pattern:"Record id must be a canonical positive integer string."}}}),
|
|
367
|
+
mode:"patch"})});var xu=f(()=>{});var un=f(()=>{mt();mu();bu();Eu();Su();Tu();Ou();ir();vu();Ru();xu()});import{isDeepStrictEqual as OE}from"node:util";function re(e,t,r){let n=ns({schema:e,mode:"create"},t,{context:r});if(!OE(
|
|
368
|
+
t,n))throw new Error(`${r}: unknown fields or noncanonical values.`);return n}var N,V,Y,dn,AE,vE,fn,pn,mn,Pu,sr=f(()=>{un();
|
|
369
|
+
N={type:"string",required:!0,noTrim:!0,minLength:1,maxLength:256},V={...N,maxLength:64},Y=(e,t=100)=>({type:"array",required:!0,
|
|
370
|
+
maxLength:t,items:e,validator:r=>Array.isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),dn={type:"integer",
|
|
371
|
+
required:!0,enum:[1]},AE=Y(M({code:V}),24),vE=M({id:V,kind:{...N,enum:["answer","practical"]},required:{type:"boolean",required:!0},
|
|
372
|
+
rubric:N,evidence:{type:"object",required:!1,schema:M({producer:{...N,enum:["workspace","colleague","exercise","code"]},
|
|
373
|
+
operation:V,check:{...V,required:!1},explanationRequired:{type:"boolean",required:!1},files:{...Y(N,8),required:!1,minLength:1}})}}),
|
|
374
|
+
fn=M({schemaVersion:dn,code:V,title:N,document:N,prerequisites:AE,estimatedMinutes:{type:"integer",required:!0,min:1,max:180},
|
|
375
|
+
visuals:Y(M({id:V,descriptor:N}),12),exercise:{type:"object",required:!1,schema:M({kind:{...N,enum:["bundled"]},source:N,
|
|
376
|
+
reuse:{...N,enum:["attempt","sequence"]},sequenceId:{...V,required:!1},sequenceMode:{...N,required:!1,enum:["create","co\
|
|
377
|
+
ntinue"]}})},checks:{...Y(M({id:V,file:N,assets:{...Y(N,32),required:!1},kind:{...N,required:!1,enum:["response","code"]},
|
|
378
|
+
timeoutSeconds:{type:"integer",required:!1,min:1,max:60}}),12),required:!1},appRoutes:{...Y(M({method:{...N,enum:["POST",
|
|
379
|
+
"PUT","PATCH","DELETE"]},path:{...N,maxLength:128,pattern:"^/[A-Za-z0-9._~:/-]*$"}}),16),required:!1},assessments:Y(vE,32)}),
|
|
380
|
+
pn=M({schemaVersion:dn,topicId:V,domainId:V,title:N,status:{...N,enum:["preview","released"]},outline:N,prerequisites:Y(
|
|
381
|
+
M({topicId:V}),24),lessons:Y(M({code:V,descriptor:N,status:{...N,enum:["draft","published"]},required:{type:"boolean",required:!0}}),
|
|
382
|
+
64)}),mn=M({schemaVersion:dn,courseId:V,title:N,release:N,status:{...N,enum:["preview","released"]},topics:Y(M({topicId:V,
|
|
383
|
+
release:N}),32)}),Pu=M({schemaVersion:dn,id:V,title:N,svg:N,controller:N,assets:{...Y(N,32),required:!1},initialState:V,
|
|
384
|
+
states:Y(V,32),description:{...N,maxLength:2e3},commands:Y(M({name:V,parameters:Y(M({name:V,required:{type:"boolean",required:!0},
|
|
385
|
+
maxLength:{type:"integer",required:!0,min:1,max:256}}),8),completionState:V,description:{...N,maxLength:2e3}}),32)})});import{createHash as IE}from"node:crypto";import{lstat as RE,readFile as xE,readdir as PE,realpath as Cu}from"node:fs/promises";
|
|
386
|
+
import ne from"node:path";function Te(e,t,r){let n=new Set;for(let o of e){let i=t?o[t]:o;if(!gn(i)||n.has(i))throw new Error(
|
|
387
|
+
`${r}: invalid or duplicate ID ${i}.`);n.add(i)}return n}function k(e){return Array.isArray(e)?`[${e.map(k).join(",")}]`:
|
|
388
|
+
e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${k(e[t])}`).join(",")}}`:JSON.stringify(e)}
|
|
389
|
+
function ku(e,t){let r=e.get(t.path);if(r&&(r.sha256!==t.sha256||r.bytes!==t.bytes))throw new Error(`Source changed betw\
|
|
390
|
+
een lesson snapshots: ${t.path}. Validate and retry.`);e.set(t.path,t)}function He(e){let t=new Map;for(let r of e)for(let n of r.
|
|
391
|
+
files)ku(t,n);return[...t.values()]}async function CE(e){let t=await Cu(e);async function r(i,s=t){if(typeof i!="string"||
|
|
392
|
+
!i||i.includes("\\")||ne.isAbsolute(i))throw new Error(`Invalid topic-relative path: ${i}.`);let a=ne.resolve(s,i),c=ne.
|
|
393
|
+
relative(t,a);if(c===".."||c.startsWith(`..${ne.sep}`)||ne.isAbsolute(c))throw new Error(`Path escapes topic: ${i}.`);if(await Cu(
|
|
394
|
+
a)!==a)throw new Error(`Symlink content is not supported: ${i}.`);return{filename:a,relative:c.split(ne.sep).join("/")}}
|
|
395
|
+
async function n(i,s=t){let a=await r(i,s),c=await RE(a.filename);if(!c.isFile()||c.size>1024*1024)throw new Error(`Expe\
|
|
396
|
+
cted a regular file of at most 1 MiB: ${a.relative}.`);return{...a,bytes:await xE(a.filename)}}async function o(i,s=t){let a=await n(
|
|
397
|
+
i,s);return{...a,value:JSON.parse(a.bytes.toString("utf8"))}}return{root:t,resolve:r,read:n,json:o}}function NE(e){let t=new Map(
|
|
396
398
|
e.map(i=>[i.code,i])),r=new Set,n=new Set;function o(i){if(n.has(i))throw new Error(`Prerequisite cycle at ${i}.`);if(r.
|
|
397
399
|
has(i))return;let s=t.get(i);if(!s)throw new Error(`Unknown prerequisite ${i}.`);n.add(i);for(let a of s.prerequisites)o(
|
|
398
|
-
a.code);n.delete(i),r.add(i)}for(let i of e)o(i.code)}async function
|
|
399
|
-
value,t.code);if(n.code!==t.code)throw new Error(`Lesson code mismatch: ${t.code}.`);let o=
|
|
400
|
-
function s(d){if(
|
|
401
|
-
|
|
402
|
-
s(a);let c=a.bytes.toString("utf8");
|
|
403
|
-
let l=
|
|
404
|
-
read(
|
|
405
|
-
id}"></a>$`,"mu").test(c)||
|
|
400
|
+
a.code);n.delete(i),r.add(i)}for(let i of e)o(i.code)}async function kE(e,t){let r=await e.json(t.descriptor),n=re(fn,r.
|
|
401
|
+
value,t.code);if(n.code!==t.code)throw new Error(`Lesson code mismatch: ${t.code}.`);let o=ne.dirname(r.filename),i=new Map;
|
|
402
|
+
function s(d){if(ku(i,{path:d.relative,sha256:hn(d.bytes),bytes:d.bytes.length}),i.size>512||[...i.values()].reduce((m,h)=>m+
|
|
403
|
+
h.bytes,0)>32*1024*1024)throw new Error(`Lesson ${t.code} exceeds bundle limits.`)}s(r);let a=await e.read(n.document,o);
|
|
404
|
+
s(a);let c=a.bytes.toString("utf8");Te(n.assessments,"id","Assessments"),Te(n.prerequisites,"code","Lesson prerequisites");
|
|
405
|
+
let l=Te(n.checks||[],"id","Checks");for(let d of n.checks||[]){s(await e.read(d.file,o));for(let m of d.assets||[])s(await e.
|
|
406
|
+
read(m,o))}for(let d of n.assessments){let[m,h,y]=d.rubric.split("#");if(m!==n.document||!h||y||!new RegExp(`^<a id="${d.
|
|
407
|
+
id}"></a>$`,"mu").test(c)||h!==d.id)throw new Error(`Missing explicit rubric anchor for ${d.id}.`);if(d.kind==="practica\
|
|
406
408
|
l"&&!d.evidence)throw new Error(`Practical assessment ${d.id} needs an evidence producer.`);if(d.kind==="answer"&&d.evidence)
|
|
407
409
|
throw new Error(`Answer assessment ${d.id} uses its admitted answer, not a practical producer.`);if(d.evidence?.check&&!l.
|
|
408
410
|
has(d.evidence.check))throw new Error(`Unknown check for ${d.id}.`);if(d.evidence?.producer==="exercise"&&(!n.exercise||
|
|
409
411
|
!d.evidence.check))throw new Error(`Exercise assessment ${d.id} needs its declared exercise and check.`);if(d.evidence?.
|
|
410
|
-
check
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
412
|
+
check&&!["exercise","code"].includes(d.evidence.producer))throw new Error(`Only exercise or code evidence runs a declare\
|
|
413
|
+
d check: ${d.id}.`);let w=(n.checks||[]).find(g=>g.id===d.evidence?.check)?.kind||"response";if(d.evidence?.producer==="\
|
|
414
|
+
code"){if(!n.exercise||!d.evidence.check||w!=="code"||!d.evidence.files?.length)throw new Error(`Code assessment ${d.id}\
|
|
415
|
+
needs its declared exercise, files and a code check.`)}else if(d.evidence?.files||d.evidence?.check&&w==="code")throw new Error(
|
|
416
|
+
`Only code evidence names edited files or runs a code check: ${d.id}.`)}if(n.appRoutes&&!n.exercise)throw new Error(`Les\
|
|
417
|
+
son ${t.code} can declare app routes only with its exercise.`);let u=new Set;for(let d of n.appRoutes||[]){if(d.path!=="\
|
|
418
|
+
/"&&!d.path.slice(1).split("/").every(h=>h===":id"||/^[A-Za-z0-9._~-]+$/u.test(h)))throw new Error(`Invalid app route pa\
|
|
419
|
+
th for ${t.code}: ${d.path}.`);let m=`${d.method} ${d.path}`;if(u.has(m))throw new Error(`Lesson ${t.code} has a duplica\
|
|
420
|
+
te app route: ${m}.`);u.add(m)}for(let d of n.checks||[])if(d.timeoutSeconds!==void 0&&d.kind!=="code")throw new Error(`\
|
|
421
|
+
Only a code check declares a timeout: ${d.id}.`);if(!n.assessments.some(d=>d.required))throw new Error(`Lesson ${t.code}\
|
|
422
|
+
needs a required assessment.`);Te(n.visuals,"id","Visuals");for(let d of n.visuals){let m=await e.json(d.descriptor,o),
|
|
423
|
+
h=re(Pu,m.value,d.id);if(h.id!==d.id)throw new Error(`Visual ID mismatch: ${d.id}.`);let y=Te(h.states,null,"Visual stat\
|
|
424
|
+
es");if(!y.has(h.initialState))throw new Error(`Unknown initial visual state: ${h.initialState}.`);Te(h.commands,"name",
|
|
425
|
+
"Visual commands");for(let g of h.commands)if(Te(g.parameters,"name","Command parameters"),g.completionState!=="unchange\
|
|
426
|
+
d"&&!y.has(g.completionState))throw new Error(`Unknown completion state: ${g.name}.`);s(m);let w=ne.dirname(m.filename);
|
|
427
|
+
s(await e.read(h.svg,w)),s(await e.read(h.controller,w));for(let g of h.assets||[])s(await e.read(g,w))}if(n.exercise){let d=n.
|
|
428
|
+
exercise;if(d.reuse==="sequence"){if(!d.sequenceId||!d.sequenceMode)throw new Error(`Invalid exercise sequence for ${t.code}\
|
|
429
|
+
.`)}else if(d.sequenceId||d.sequenceMode)throw new Error(`Invalid exercise sequence for ${t.code}.`);if(d.sequenceId&&!gn(
|
|
430
|
+
d.sequenceId))throw new Error("Invalid exercise sequence ID.");let m=await e.resolve(d.source,o);async function h(y){for(let w of(await PE(
|
|
431
|
+
y,{withFileTypes:!0})).sort((g,b)=>g.name<b.name?-1:g.name>b.name?1:0)){if(Nu.has(w.name))continue;let g=ne.relative(e.root,
|
|
432
|
+
ne.join(y,w.name)),b=await e.resolve(g);w.isDirectory()?await h(b.filename):s(await e.read(g))}}await h(m.filename);for(let y of n.
|
|
433
|
+
assessments){for(let w of y.evidence?.files||[]){let g=w.split("/");if(w.includes("\\")||ne.posix.isAbsolute(w)||g.some(
|
|
434
|
+
b=>!b||b==="."||b===".."||Nu.has(b))||!i.has(m.relative?`${m.relative}/${w}`:w))throw new Error(`Code assessment ${y.id}\
|
|
435
|
+
names a file outside its bundled exercise: ${w}.`)}if(new Set(y.evidence?.files||[]).size!==(y.evidence?.files||[]).length)
|
|
436
|
+
throw new Error(`Code assessment ${y.id} repeats a declared file.`)}}let p={schemaVersion:1,code:n.code,files:[...i.values()].
|
|
437
|
+
sort((d,m)=>d.path<m.path?-1:d.path>m.path?1:0)};return{lesson:n,manifest:p,hash:hn(k(p)),descriptorPath:r.relative}}async function ht(e){
|
|
438
|
+
let t=await CE(e),r=await t.json("package.json");if(!/^learn-[a-z0-9-]+$/u.test(r.value.name||"")||!/^\d+\.\d+\.\d+$/u.test(
|
|
439
|
+
r.value.version||""))throw new Error("Topic package needs a learn- name and an exact release version.");let n=re(pn,r.value.
|
|
440
|
+
vibe64Training,"Topic");if(!gn(n.topicId)||!gn(n.domainId))throw new Error("Invalid topic or domain ID.");let o=await t.
|
|
441
|
+
read(n.outline);if(Te(n.lessons,"code","Lessons"),Te(n.prerequisites,"topicId","Topic prerequisites"),!n.lessons.length)
|
|
442
|
+
throw new Error("A topic needs lessons.");if(n.status==="released"&&n.lessons.some(l=>l.required&&l.status!=="published"))
|
|
443
|
+
throw new Error("A released topic contains required draft lessons.");let i=[];for(let l of n.lessons)i.push({...await kE(
|
|
444
|
+
t,l),status:l.status,required:l.required});NE(i.map(l=>l.lesson));for(let[l,u]of i.entries())for(let{code:p}of u.lesson.
|
|
445
|
+
prerequisites){let d=i.findIndex(m=>m.lesson.code===p);if(d>=l)throw new Error(`Prerequisite ${p} must precede ${u.lesson.
|
|
446
|
+
code}.`);if(u.status==="published"&&i[d].status!=="published")throw new Error(`Published lesson ${u.lesson.code} require\
|
|
447
|
+
s draft ${p}.`)}let s=new Map;for(let{lesson:l,descriptorPath:u,status:p}of i){if(l.exercise?.reuse!=="sequence")continue;
|
|
448
|
+
let d=(await t.resolve(l.exercise.source,ne.dirname(ne.join(t.root,u)))).relative,m=s.get(l.exercise.sequenceId);if(l.exercise.
|
|
449
|
+
sequenceMode==="create"){if(m)throw new Error(`Invalid create/continue sequence: ${l.code}.`);s.set(l.exercise.sequenceId,
|
|
450
|
+
{source:d,status:p})}else if(!m||m.source!==d||p==="published"&&m.status!=="published")throw new Error(`Invalid create/c\
|
|
451
|
+
ontinue sequence: ${l.code}.`)}let a=[r,o].map(l=>({path:l.relative,sha256:hn(l.bytes),bytes:l.bytes.length})),c={schemaVersion:1,
|
|
452
|
+
topic:n,release:r.value.version,files:a,lessons:i.map(({lesson:l,hash:u,status:p,required:d})=>({code:l.code,hash:u,status:p,
|
|
453
|
+
required:d}))};return He([c,...i.map(l=>l.manifest)]),{topic:n,release:r.value.version,bundles:i,topicManifest:c,topicHash:hn(
|
|
454
|
+
k(c))}}var Nu,hn,gn,gt=f(()=>{sr();Nu=new Set([".git","node_modules",".genesis"]),hn=e=>IE("sha256").update(e).digest("h\
|
|
455
|
+
ex"),gn=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.test(e)});import{execFile as $E}from"node:child_process";import{readFile as ME}from"node:fs/promises";import $u from"node:os";import LE from"node:path";
|
|
456
|
+
import{promisify as DE}from"node:util";function yn(e=""){return String(e||"").trim()}function Mu(e=""){let t=yn(e);if(!t||
|
|
443
457
|
t.includes("/")||t.includes("\\")||t.includes(":")){let r=new Error("A valid OS username is required.");throw r.code="vi\
|
|
444
|
-
be64_invalid_os_username",r}return t}function
|
|
458
|
+
be64_invalid_os_username",r}return t}function is(e=""){let t=String(e||"").trim().split(":");if(t.length<7||!/^\d+$/u.test(
|
|
445
459
|
t[2])||!/^\d+$/u.test(t[3]))return null;let r=Number(t[2]),n=Number(t[3]);return!Number.isSafeInteger(r)||r<0||!Number.isSafeInteger(
|
|
446
460
|
n)||n<0?null:{displayName:String(t[4]||"").split(",")[0],gid:n,home:String(t[5]||""),shell:String(t[6]||""),uid:r,username:String(
|
|
447
|
-
t[0]||"")}}function
|
|
448
|
-
process.env.USER||process.env.LOGNAME),o=
|
|
461
|
+
t[0]||"")}}function wn({homedir:e=$u.homedir,userInfo:t=$u.userInfo}={}){let r=typeof t=="function"?t():{},n=yn(r?.username||
|
|
462
|
+
process.env.USER||process.env.LOGNAME),o=LE.resolve(String(r?.homedir||e()||""));return{displayName:String(r?.username||
|
|
449
463
|
n),gid:Number.isSafeInteger(r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.uid)?r.uid:
|
|
450
|
-
null,username:n}}async function
|
|
464
|
+
null,username:n}}async function bn(e="",{execFileFn:t=jE,platform:r=process.platform,readFileFn:n=ME}={}){let o=Mu(e);if(r===
|
|
451
465
|
"linux"&&!/^\d+$/u.test(o)){let l=[...(await n("/etc/nsswitch.conf","utf8").catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],
|
|
452
|
-
u=l.length===1?l[0][1].trim().split(/\s+/u):[];if(u[0]==="files"&&(u.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(u[1]))){let
|
|
453
|
-
"/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).map(
|
|
454
|
-
nt",["passwd",o],{encoding:"utf8"}),s=typeof i=="string"?i:i?.stdout,a=
|
|
455
|
-
o){let c=new Error(`OS user was not found: ${o}`);throw c.code="vibe64_os_user_not_found",c}return a}var
|
|
456
|
-
|
|
457
|
-
isSafeInteger(t)&&t>=0?t:null}function
|
|
458
|
-
"object"&&!Array.isArray(e)?e:{}}function
|
|
459
|
-
r??"")]).filter(([t])=>!!t))}function
|
|
460
|
-
has(o)||(r.add(o),t.push(o))}return t}function
|
|
461
|
-
return{displayName:
|
|
462
|
-
|
|
463
|
-
username,USER:r.username,XDG_CACHE_HOME:
|
|
464
|
-
join(r.home,".local","share")}}function
|
|
465
|
-
nction"?process.getgid():null,uid:typeof process.getuid=="function"?process.getuid():null}}var
|
|
466
|
-
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var
|
|
467
|
-
`${t} must be a string or a file URL: ${r}.`);return r},
|
|
468
|
-
e)===String.prototype,
|
|
466
|
+
u=l.length===1?l[0][1].trim().split(/\s+/u):[];if(u[0]==="files"&&(u.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(u[1]))){let d=(await n(
|
|
467
|
+
"/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).map(is).find(m=>m?.username===o);if(d)return d}}let i=await t("gete\
|
|
468
|
+
nt",["passwd",o],{encoding:"utf8"}),s=typeof i=="string"?i:i?.stdout,a=is(String(s||"").split(/\r?\n/u)[0]);if(!a||a.username!==
|
|
469
|
+
o){let c=new Error(`OS user was not found: ${o}`);throw c.code="vibe64_os_user_not_found",c}return a}var jE,En=f(()=>{jE=
|
|
470
|
+
DE($E)});var Lu=f(()=>{En()});import BE from"node:path";function x(e=""){return String(e??"").trim()}function ss(e=null){let t=Number(e);return Number.
|
|
471
|
+
isSafeInteger(t)&&t>=0?t:null}function R(e=""){let t=x(e);return t?BE.resolve(t):""}function ee(e={}){return e&&typeof e==
|
|
472
|
+
"object"&&!Array.isArray(e)?e:{}}function J(e={}){return Object.fromEntries(Object.entries(ee(e)).map(([t,r])=>[x(t),String(
|
|
473
|
+
r??"")]).filter(([t])=>!!t))}function qe(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:[e]){let o=x(n);!o||r.
|
|
474
|
+
has(o)||(r.add(o),t.push(o))}return t}function Oe(...e){for(let t of e){let r=x(t);if(r)return r}return""}var U=f(()=>{});import UE from"node:os";import as from"node:path";function Sn(e={}){let t=x(e.username),r=R(e.home||(t?`/home/${t}`:UE.homedir()));
|
|
475
|
+
return{displayName:x(e.displayName||t),gid:ss(e.gid),home:r,shell:x(e.shell),uid:ss(e.uid),username:t}}function cs(){return Sn(
|
|
476
|
+
wn())}async function ls(e="",t={}){return Sn(await bn(e,t))}function us(e={},t={}){let r=Sn(e);return{...t,HOME:r.home,LOGNAME:r.
|
|
477
|
+
username,USER:r.username,XDG_CACHE_HOME:as.join(r.home,".cache"),XDG_CONFIG_HOME:as.join(r.home,".config"),XDG_DATA_HOME:as.
|
|
478
|
+
join(r.home,".local","share")}}function ds(e={},t={}){return us(e,t)}function fs(){return{gid:typeof process.getgid=="fu\
|
|
479
|
+
nction"?process.getgid():null,uid:typeof process.getuid=="function"?process.getuid():null}}var yt=f(()=>{En();U()});function F(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||
|
|
480
|
+
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var Ae=f(()=>{});import{fileURLToPath as FE}from"node:url";var wt,zE,ps,ms,bt=f(()=>{wt=(e,t)=>{let r=ms(zE(e));if(typeof r!="string")throw new TypeError(
|
|
481
|
+
`${t} must be a string or a file URL: ${r}.`);return r},zE=e=>ps(e)?e.toString():e,ps=e=>typeof e!="string"&&e&&Object.getPrototypeOf(
|
|
482
|
+
e)===String.prototype,ms=e=>e instanceof URL?FE(e):e});var _n,hs=f(()=>{Ae();bt();_n=(e,t=[],r={})=>{let n=wt(e,"First argument"),[o,i]=F(t)?[[],t]:[t,r];if(!Array.isArray(o))
|
|
469
483
|
throw new TypeError(`Second argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c==
|
|
470
484
|
"object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(
|
|
471
|
-
c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!
|
|
472
|
-
`Last argument must be an options object: ${i}`);return[n,s,i]}});import{StringDecoder as
|
|
473
|
-
Object.prototype),
|
|
474
|
-
e.buffer,e.byteOffset,e.byteLength),
|
|
475
|
-
e,t).join(""),
|
|
476
|
-
ring"
|
|
477
|
-
map(t=>typeof t=="string"
|
|
478
|
-
|
|
479
|
-
e)&&Array.isArray(e.raw),
|
|
480
|
-
template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]},
|
|
485
|
+
c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!F(i))throw new TypeError(
|
|
486
|
+
`Last argument must be an options object: ${i}`);return[n,s,i]}});import{StringDecoder as VE}from"node:string_decoder";var Du,ju,G,ve,GE,Bu,HE,Tn,Uu,qE,ar,WE,gs,YE,oe=f(()=>{({toString:Du}=
|
|
487
|
+
Object.prototype),ju=e=>Du.call(e)==="[object ArrayBuffer]",G=e=>Du.call(e)==="[object Uint8Array]",ve=e=>new Uint8Array(
|
|
488
|
+
e.buffer,e.byteOffset,e.byteLength),GE=new TextEncoder,Bu=e=>GE.encode(e),HE=new TextDecoder,Tn=e=>HE.decode(e),Uu=(e,t)=>qE(
|
|
489
|
+
e,t).join(""),qE=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i=="string"))return e;let r=new VE(t),n=e.map(i=>typeof i=="st\
|
|
490
|
+
ring"?Bu(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[...n,o]},ar=e=>e.length===1&&G(e[0])?e[0]:gs(WE(e)),WE=e=>e.
|
|
491
|
+
map(t=>typeof t=="string"?Bu(t):t),gs=e=>{let t=new Uint8Array(YE(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},
|
|
492
|
+
YE=e=>{let t=0;for(let r of e)t+=r.length;return t}});import{ChildProcess as KE}from"node:child_process";var Gu,Hu,JE,XE,Fu,ZE,zu,Vu,QE,qu=f(()=>{Ae();oe();Gu=e=>Array.isArray(
|
|
493
|
+
e)&&Array.isArray(e.raw),Hu=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=JE({templates:e,expressions:t,tokens:r,index:i,
|
|
494
|
+
template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]},JE=({
|
|
481
495
|
templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backslash sequence:\
|
|
482
|
-
${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=
|
|
483
|
-
let l=t[n],u=Array.isArray(l)?l.map(
|
|
484
|
-
leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=
|
|
485
|
-
if(
|
|
486
|
-
`?(s-=1,a+=1):l==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=
|
|
487
|
-
leadingWhitespaces:o,trailingWhitespaces:i}},
|
|
488
|
-
`]),
|
|
489
|
-
1)],
|
|
490
|
-
e))return
|
|
496
|
+
${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=XE(o,e.raw[n]),c=zu(r,i,s);if(n===t.length)return c;
|
|
497
|
+
let l=t[n],u=Array.isArray(l)?l.map(p=>Vu(p)):[Vu(l)];return zu(c,u,a)},XE=(e,t)=>{if(t.length===0)return{nextTokens:[],
|
|
498
|
+
leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=Fu.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,a+=1){let c=t[a];
|
|
499
|
+
if(Fu.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let l=t[a+1];l===`
|
|
500
|
+
`?(s-=1,a+=1):l==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=ZE[l]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,
|
|
501
|
+
leadingWhitespaces:o,trailingWhitespaces:i}},Fu=new Set([" "," ","\r",`
|
|
502
|
+
`]),ZE={x:3,u:5},zu=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(
|
|
503
|
+
1)],Vu=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(F(e)&&("stdout"in e||"isMaxBuffer"in
|
|
504
|
+
e))return QE(e);throw e instanceof KE||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected \
|
|
491
505
|
subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected \
|
|
492
|
-
"${t}" in template expression`)},
|
|
506
|
+
"${t}" in template expression`)},QE=({stdout:e})=>{if(typeof e=="string")return e;if(G(e))return Tn(e);throw e===void 0?
|
|
493
507
|
new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" o\
|
|
494
|
-
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)}});import
|
|
495
|
-
"stdout","stderr"],
|
|
496
|
-
...e};for(let r of
|
|
497
|
-
|
|
498
|
-
for(let n of Object.keys(e).sort(
|
|
499
|
-
dout"||e==="stderr"?0:e==="all"?2:1,
|
|
508
|
+
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)}});import ys from"node:process";var fe,On,ae,An,Ie=f(()=>{fe=e=>On.includes(e),On=[ys.stdin,ys.stdout,ys.stderr],ae=["stdin",
|
|
509
|
+
"stdout","stderr"],An=e=>ae[e]??`stdio[${e}]`});import{debuglog as eS}from"node:util";var Yu,ws,tS,rS,nS,oS,Wu,iS,bs,sS,aS,cS,lS,Es,Re,xe=f(()=>{Ae();Ie();Yu=e=>{let t={
|
|
510
|
+
...e};for(let r of Es)t[r]=ws(e,r);return t},ws=(e,t)=>{let r=Array.from({length:tS(e)+1}),n=rS(e[t],r,t);return aS(n,t)},
|
|
511
|
+
tS=({stdio:e})=>Array.isArray(e)?Math.max(e.length,ae.length):ae.length,rS=(e,t,r)=>F(e)?nS(e,t,r):t.fill(e),nS=(e,t,r)=>{
|
|
512
|
+
for(let n of Object.keys(e).sort(oS))for(let o of iS(n,r,t))t[o]=e[n];return t},oS=(e,t)=>Wu(e)<Wu(t)?1:-1,Wu=e=>e==="st\
|
|
513
|
+
dout"||e==="stderr"?0:e==="all"?2:1,iS=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=bs(e);if(n===void 0||n===0)throw new TypeError(
|
|
500
514
|
`"${t}.${e}" is invalid.
|
|
501
515
|
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)
|
|
502
516
|
throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
503
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},
|
|
504
|
-
if(
|
|
505
|
-
r=>r===void 0?
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
t))??
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
`).map(t=>
|
|
512
|
-
`),
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,
|
|
517
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},bs=e=>{if(e==="all")return e;
|
|
518
|
+
if(ae.includes(e))return ae.indexOf(e);let t=sS.exec(e);if(t!==null)return Number(t[1])},sS=/^fd(\d+)$/,aS=(e,t)=>e.map(
|
|
519
|
+
r=>r===void 0?lS[t]:r),cS=eS("execa").enabled?"full":"none",lS={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:cS,stripFinalNewline:!0},
|
|
520
|
+
Es=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Re=(e,t)=>t==="ipc"?e.at(-1):e[t]});var Et,St,Ku,Ss,uS,vn,In,$e=f(()=>{xe();Et=({verbose:e},t)=>Ss(e,t)!=="none",St=({verbose:e},t)=>!["none","short"].includes(
|
|
521
|
+
Ss(e,t)),Ku=({verbose:e},t)=>{let r=Ss(e,t);return vn(r)?r:void 0},Ss=(e,t)=>t===void 0?uS(e):Re(e,t),uS=e=>e.find(t=>vn(
|
|
522
|
+
t))??In.findLast(t=>e.includes(t)),vn=e=>typeof e=="function",In=["none","short","full"]});import{platform as dS}from"node:process";import{stripVTControlCharacters as fS}from"node:util";var Ju,cr,Xu,pS,mS,hS,gS,
|
|
523
|
+
yS,wS,bS,Rn=f(()=>{Ju=(e,t)=>{let r=[e,...t],n=r.join(" "),o=r.map(i=>wS(Xu(i))).join(" ");return{command:n,escapedCommand:o}},
|
|
524
|
+
cr=e=>fS(e).split(`
|
|
525
|
+
`).map(t=>Xu(t)).join(`
|
|
526
|
+
`),Xu=e=>e.replaceAll(hS,t=>pS(t)),pS=e=>{let t=gS[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=
|
|
527
|
+
yS?`\\u${n.padStart(4,"0")}`:`\\U${n}`},mS=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},
|
|
528
|
+
hS=mS(),gS={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},yS=65535,wS=e=>bS.test(e)?e:dS==="win32"?`"${e.
|
|
529
|
+
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,bS=/^[\w./-]+$/});import Zu from"node:process";function _s(){let{env:e}=Zu,{TERM:t,TERM_PROGRAM:r}=e;return Zu.platform!=="win32"?t!=="lin\
|
|
516
530
|
ux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xter\
|
|
517
531
|
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}
|
|
518
|
-
var
|
|
532
|
+
var Qu=f(()=>{});var ed,td,ES,SS,_S,TS,OS,xn,Fk,rd=f(()=>{Qu();ed={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\
|
|
519
533
|
\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",
|
|
520
534
|
squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\
|
|
521
535
|
\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\
|
|
@@ -556,104 +570,104 @@ lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeft
|
|
|
556
570
|
\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\
|
|
557
571
|
\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\
|
|
558
572
|
\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\
|
|
559
|
-
\u2572",lineSlash:"\u2571"},
|
|
573
|
+
\u2572",lineSlash:"\u2571"},td={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\
|
|
560
574
|
\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\
|
|
561
575
|
\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\
|
|
562
576
|
\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",
|
|
563
577
|
lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",
|
|
564
|
-
nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},
|
|
578
|
+
nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},ES={tick:"\u221A",info:"i",warning:"\u203C",cross:"\
|
|
565
579
|
\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"(\
|
|
566
580
|
)",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",
|
|
567
581
|
checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\
|
|
568
582
|
\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",
|
|
569
|
-
star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},
|
|
570
|
-
...
|
|
571
|
-
|
|
572
|
-
prototype?.hasColors?.()??!1,
|
|
583
|
+
star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},SS={...ed,...td},_S={...ed,
|
|
584
|
+
...ES},TS=_s(),OS=TS?SS:_S,xn=OS,Fk=Object.entries(td)});import AS from"node:tty";var vS,O,Gk,nd,Hk,qk,Wk,Yk,Kk,Jk,Xk,Zk,Qk,e$,t$,r$,n$,o$,i$,s$,a$,c$,l$,Pn,u$,d$,f$,p$,m$,h$,g$,
|
|
585
|
+
y$,w$,od,b$,id,E$,S$,_$,T$,O$,A$,v$,I$,R$,x$,P$,C$,N$,k$,$$,M$,L$,D$,j$,B$,U$,F$,z$,V$,G$,H$,q$,Ts=f(()=>{vS=AS?.WriteStream?.
|
|
586
|
+
prototype?.hasColors?.()??!1,O=(e,t)=>{if(!vS)return o=>o;let r=`\x1B[${e}m`,n=`\x1B[${t}m`;return o=>{let i=o+"",s=i.indexOf(
|
|
573
587
|
n);if(s===-1)return r+i+n;let a=r,c=0,u=(t===22?n:"")+r;for(;s!==-1;)a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=
|
|
574
|
-
i.slice(c)+n,a}},
|
|
575
|
-
"4:5",24),
|
|
576
|
-
35,39),
|
|
577
|
-
46,49),
|
|
578
|
-
101,49),
|
|
579
|
-
|
|
580
|
-
59),
|
|
581
|
-
|
|
582
|
-
options:{reject:s=!0}})=>{let a=
|
|
583
|
-
`[${o}]`)} ${l(c)} ${l(t)}`},
|
|
584
|
-
3)}`,
|
|
585
|
-
"|":"$",output:()=>" ",ipc:()=>"*",error:
|
|
586
|
-
|
|
587
|
-
o=>o!==void 0).map(o=>
|
|
588
|
-
|
|
588
|
+
i.slice(c)+n,a}},Gk=O(0,0),nd=O(1,22),Hk=O(2,22),qk=O(3,23),Wk=O(4,24),Yk=O("4:2",24),Kk=O("4:3",24),Jk=O("4:4",24),Xk=O(
|
|
589
|
+
"4:5",24),Zk=O(53,55),Qk=O(7,27),e$=O(8,28),t$=O(9,29),r$=O(30,39),n$=O(31,39),o$=O(32,39),i$=O(33,39),s$=O(34,39),a$=O(
|
|
590
|
+
35,39),c$=O(36,39),l$=O(37,39),Pn=O(90,39),u$=O(40,49),d$=O(41,49),f$=O(42,49),p$=O(43,49),m$=O(44,49),h$=O(45,49),g$=O(
|
|
591
|
+
46,49),y$=O(47,49),w$=O(100,49),od=O(91,39),b$=O(92,39),id=O(93,39),E$=O(94,39),S$=O(95,39),_$=O(96,39),T$=O(97,39),O$=O(
|
|
592
|
+
101,49),A$=O(102,49),v$=O(103,49),I$=O(104,49),R$=O(105,49),x$=O(106,49),P$=O(107,49),C$=O("58;5;0",59),N$=O("58;5;1",59),
|
|
593
|
+
k$=O("58;5;2",59),$$=O("58;5;3",59),M$=O("58;5;4",59),L$=O("58;5;5",59),D$=O("58;5;6",59),j$=O("58;5;7",59),B$=O("58;5;8",
|
|
594
|
+
59),U$=O("58;5;9",59),F$=O("58;5;10",59),z$=O("58;5;11",59),V$=O("58;5;12",59),G$=O("58;5;13",59),H$=O("58;5;14",59),q$=
|
|
595
|
+
O("58;5;15",59)});var sd=f(()=>{Ts();Ts()});var ld,RS,Cn,ad,xS,cd,PS,ud=f(()=>{rd();sd();ld=({type:e,message:t,timestamp:r,piped:n,commandId:o,result:{failed:i=!1}={},
|
|
596
|
+
options:{reject:s=!0}})=>{let a=RS(r),c=xS[e]({failed:i,reject:s,piped:n}),l=PS[e]({reject:s});return`${Pn(`[${a}]`)} ${Pn(
|
|
597
|
+
`[${o}]`)} ${l(c)} ${l(t)}`},RS=e=>`${Cn(e.getHours(),2)}:${Cn(e.getMinutes(),2)}:${Cn(e.getSeconds(),2)}.${Cn(e.getMilliseconds(),
|
|
598
|
+
3)}`,Cn=(e,t)=>String(e).padStart(t,"0"),ad=({failed:e,reject:t})=>e?t?xn.cross:xn.warning:xn.tick,xS={command:({piped:e})=>e?
|
|
599
|
+
"|":"$",output:()=>" ",ipc:()=>"*",error:ad,duration:ad},cd=e=>e,PS={command:()=>nd,output:()=>cd,ipc:()=>cd,error:({reject:e})=>e?
|
|
600
|
+
od:id,duration:()=>Pn}});var dd,CS,NS,fd=f(()=>{$e();dd=(e,t,r)=>{let n=Ku(t,r);return e.map(({verboseLine:o,verboseObject:i})=>CS(o,i,n)).filter(
|
|
601
|
+
o=>o!==void 0).map(o=>NS(o)).join("")},CS=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},
|
|
602
|
+
NS=e=>e.endsWith(`
|
|
589
603
|
`)?e:`${e}
|
|
590
|
-
`});import{inspect as
|
|
591
|
-
verboseInfo:n,result:o})=>{let i
|
|
592
|
-
0,-1))}
|
|
593
|
-
commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i})
|
|
594
|
-
`).map(r=>
|
|
595
|
-
t).replaceAll(" "," ".repeat(
|
|
596
|
-
|
|
604
|
+
`});import{inspect as kS}from"node:util";var ye,$S,MS,LS,Nn,DS,_t=f(()=>{Rn();ud();fd();ye=({type:e,verboseMessage:t,fdNumber:r,
|
|
605
|
+
verboseInfo:n,result:o})=>{let i=$S({type:e,result:o,verboseInfo:n}),s=MS(t,i),a=dd(s,n,r);a!==""&&console.warn(a.slice(
|
|
606
|
+
0,-1))},$S=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:o=!1,...i}}})=>({type:e,escapedCommand:r,
|
|
607
|
+
commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),MS=(e,t)=>e.split(`
|
|
608
|
+
`).map(r=>LS({...t,message:r})),LS=e=>({verboseLine:ld(e),verboseObject:e}),Nn=e=>{let t=typeof e=="string"?e:kS(e);return cr(
|
|
609
|
+
t).replaceAll(" "," ".repeat(DS))},DS=2});var pd,md=f(()=>{$e();_t();pd=(e,t)=>{Et(t)&&ye({type:"command",verboseMessage:e,verboseInfo:t})}});var hd,jS,BS,US,gd=f(()=>{$e();hd=(e,t,r)=>{US(e);let n=jS(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},
|
|
610
|
+
jS=e=>Et({verbose:e})?BS++:void 0,BS=0n,US=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" optio\
|
|
597
611
|
n was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose:\
|
|
598
|
-
'short'".`);if(!
|
|
599
|
-
must not be ${t}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as
|
|
600
|
-
a=
|
|
612
|
+
'short'".`);if(!In.includes(t)&&!vn(t)){let r=In.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option \
|
|
613
|
+
must not be ${t}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as yd}from"node:process";var kn,Os,$n=f(()=>{kn=()=>yd.bigint(),Os=e=>Number(yd.bigint()-e)/1e6});var Mn,As=f(()=>{md();gd();$n();Rn();xe();Mn=(e,t,r)=>{let n=kn(),{command:o,escapedCommand:i}=Ju(e,t),s=ws(r,"verbose"),
|
|
614
|
+
a=hd(s,i,{...r});return pd(i,a),{command:o,escapedCommand:i,startTime:n,verboseInfo:a}}});var _d=te((wM,Sd)=>{Sd.exports=Ed;Ed.sync=zS;var wd=Ne("fs");function FS(e,t){var r=t.pathExt!==void 0?t.pathExt:process.
|
|
601
615
|
env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&
|
|
602
|
-
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function
|
|
603
|
-
t,r)}function
|
|
604
|
-
function
|
|
616
|
+
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function bd(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:FS(
|
|
617
|
+
t,r)}function Ed(e,t,r){wd.stat(e,function(n,o){r(n,n?!1:bd(o,e,t))})}function zS(e,t){return bd(wd.statSync(e),e,t)}});var Id=te((bM,vd)=>{vd.exports=Od;Od.sync=VS;var Td=Ne("fs");function Od(e,t,r){Td.stat(e,function(n,o){r(n,n?!1:Ad(o,t))})}
|
|
618
|
+
function VS(e,t){return Ad(Td.statSync(e),t)}function Ad(e,t){return e.isFile()&&GS(e,t)}function GS(e,t){var r=e.mode,n=e.
|
|
605
619
|
uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),
|
|
606
|
-
a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,
|
|
607
|
-
sync=
|
|
608
|
-
|
|
609
|
-
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function
|
|
610
|
-
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var
|
|
611
|
-
|
|
612
|
-
match(/\//)||
|
|
613
|
-
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=
|
|
614
|
-
""),{pathEnv:n,pathExt:i,pathExtExe:o}}
|
|
615
|
-
pathExtExe:i}=
|
|
616
|
-
test(
|
|
617
|
-
if(
|
|
618
|
-
return
|
|
619
|
-
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=
|
|
620
|
-
e)?e.slice(0,2)+l:l;for(let
|
|
621
|
-
if(t.all&&i.length)return i;if(t.nothrow)return null;throw
|
|
622
|
-
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};
|
|
620
|
+
a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,p=r&l||r&c&&o===s||r&a&&n===i||r&u&&i===0;return p}});var xd=te((SM,Rd)=>{var EM=Ne("fs"),Ln;process.platform==="win32"||global.TESTING_WINDOWS?Ln=_d():Ln=Id();Rd.exports=vs;
|
|
621
|
+
vs.sync=HS;function vs(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError(
|
|
622
|
+
"callback not provided");return new Promise(function(n,o){vs(e,t||{},function(i,s){i?o(i):n(s)})})}Ln(e,t||{},function(n,o){
|
|
623
|
+
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function HS(e,t){try{return Ln.sync(e,t||{})}catch(r){
|
|
624
|
+
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Ld=te((_M,Md)=>{var Tt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Pd=Ne("path"),
|
|
625
|
+
qS=Tt?";":":",Cd=xd(),Nd=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),kd=(e,t)=>{let r=t.colon||qS,n=e.
|
|
626
|
+
match(/\//)||Tt&&e.match(/\\/)?[""]:[...Tt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=Tt?t.pathExt||
|
|
627
|
+
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=Tt?o.split(r):[""];return Tt&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
628
|
+
""),{pathEnv:n,pathExt:i,pathExtExe:o}},$d=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
629
|
+
pathExtExe:i}=kd(e,t),s=[],a=l=>new Promise((u,p)=>{if(l===n.length)return t.all&&s.length?u(s):p(Nd(e));let d=n[l],m=/^".*"$/.
|
|
630
|
+
test(d)?d.slice(1,-1):d,h=Pd.join(m,e),y=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;u(c(y,l,0))}),c=(l,u,p)=>new Promise((d,m)=>{
|
|
631
|
+
if(p===o.length)return d(a(u+1));let h=o[p];Cd(l+h,{pathExt:i},(y,w)=>{if(!y&&w)if(t.all)s.push(l+h);else return d(l+h);
|
|
632
|
+
return d(c(l,u,p+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},WS=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=kd(
|
|
633
|
+
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=Pd.join(c,e),u=!c&&/^\.[\\\/]/.test(
|
|
634
|
+
e)?e.slice(0,2)+l:l;for(let p=0;p<n.length;p++){let d=u+n[p];try{if(Cd.sync(d,{pathExt:o}))if(t.all)i.push(d);else return d}catch{}}}
|
|
635
|
+
if(t.all&&i.length)return i;if(t.nothrow)return null;throw Nd(e)};Md.exports=$d;$d.sync=WS});var jd=te((TM,Is)=>{"use strict";var Dd=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?
|
|
636
|
+
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Is.exports=Dd;Is.exports.default=Dd});var zd=te((OM,Fd)=>{"use strict";var Bd=Ne("path"),YS=Ld(),KS=jd();function Ud(e,t){let r=e.options.env||process.env,n=process.
|
|
623
637
|
cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}
|
|
624
|
-
let s;try{s=
|
|
625
|
-
(s
|
|
626
|
-
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(
|
|
627
|
-
"^$1"),t&&(e=e.replace(
|
|
628
|
-
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
e.file),e.command=t,
|
|
632
|
-
test(t);e.command=
|
|
638
|
+
let s;try{s=YS.sync(e.command,{path:r[KS({env:r})],pathExt:t?Bd.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&
|
|
639
|
+
(s=Bd.resolve(o?e.options.cwd:"",s)),s}function JS(e){return Ud(e)||Ud(e,!0)}Fd.exports=JS});var Vd=te((AM,xs)=>{"use strict";var Rs=/([()\][%!^"`<>&|;, *?])/g;function XS(e){return e=e.replace(Rs,"^$1"),e}function ZS(e,t){
|
|
640
|
+
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Rs,
|
|
641
|
+
"^$1"),t&&(e=e.replace(Rs,"^$1")),e}xs.exports.command=XS;xs.exports.argument=ZS});var Hd=te((vM,Gd)=>{"use strict";Gd.exports=/^#!(.*)/});var Wd=te((IM,qd)=>{"use strict";var QS=Hd();qd.exports=(e="")=>{let t=e.match(QS);if(!t)return null;let[r,n]=t[0].replace(
|
|
642
|
+
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Kd=te((RM,Yd)=>{"use strict";var Ps=Ne("fs"),e_=Wd();function t_(e){let r=Buffer.alloc(150),n;try{n=Ps.openSync(e,"r"),
|
|
643
|
+
Ps.readSync(n,r,0,150,0),Ps.closeSync(n)}catch{}return e_(r.toString())}Yd.exports=t_});var Qd=te((xM,Zd)=>{"use strict";var r_=Ne("path"),Jd=zd(),Xd=Vd(),n_=Kd(),o_=process.platform==="win32",i_=/\.(?:com|exe)$/i,
|
|
644
|
+
s_=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function a_(e){e.file=Jd(e);let t=e.file&&n_(e.file);return t?(e.args.unshift(
|
|
645
|
+
e.file),e.command=t,Jd(e)):e.file}function c_(e){if(!o_)return e;let t=a_(e),r=!i_.test(t);if(e.options.forceShell||r){let n=s_.
|
|
646
|
+
test(t);e.command=r_.normalize(e.command),e.command=Xd.command(e.command),e.args=e.args.map(i=>Xd.argument(i,n));let o=[
|
|
633
647
|
e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.
|
|
634
|
-
windowsVerbatimArguments=!0}return e}function
|
|
635
|
-
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:
|
|
636
|
-
command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function
|
|
637
|
-
if(!
|
|
638
|
-
e,arguments)}}function
|
|
639
|
-
!t.file?
|
|
640
|
-
n.command,n.args,n.options);return
|
|
641
|
-
n.args,n.options);return o.error=o.error
|
|
642
|
-
sync=
|
|
643
|
-
find(n=>n.toUpperCase()==="PATH")||"Path"}var
|
|
644
|
-
import{fileURLToPath as
|
|
645
|
-
iterator](){let t=
|
|
646
|
-
|
|
647
|
-
env[
|
|
648
|
-
return r&&
|
|
649
|
-
(e,t,r)=>{for(let n of
|
|
650
|
-
n,
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
e.prototype,
|
|
654
|
-
e=>Object.prototype.toString.call(e)==="[object Error]",
|
|
655
|
-
|
|
656
|
-
t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),
|
|
648
|
+
windowsVerbatimArguments=!0}return e}function l_(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign(
|
|
649
|
+
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:c_(n)}Zd.exports=l_});var rf=te((PM,tf)=>{"use strict";var Cs=process.platform==="win32";function Ns(e,t){return Object.assign(new Error(`${t}\
|
|
650
|
+
${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function u_(e,t){
|
|
651
|
+
if(!Cs)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=ef(o,t);if(i)return r.call(e,"error",i)}return r.apply(
|
|
652
|
+
e,arguments)}}function ef(e,t){return Cs&&e===1&&!t.file?Ns(t.original,"spawn"):null}function d_(e,t){return Cs&&e===1&&
|
|
653
|
+
!t.file?Ns(t.original,"spawnSync"):null}tf.exports={hookChildProcess:u_,verifyENOENT:ef,verifyENOENTSync:d_,notFoundError:Ns}});var sf=te((CM,Ot)=>{"use strict";var nf=Ne("child_process"),ks=Qd(),$s=rf();function of(e,t,r){let n=ks(e,t,r),o=nf.spawn(
|
|
654
|
+
n.command,n.args,n.options);return $s.hookChildProcess(o,n),o}function f_(e,t,r){let n=ks(e,t,r),o=nf.spawnSync(n.command,
|
|
655
|
+
n.args,n.options);return o.error=o.error||$s.verifyENOENTSync(o.status,n),o}Ot.exports=of;Ot.exports.spawn=of;Ot.exports.
|
|
656
|
+
sync=f_;Ot.exports._parse=ks;Ot.exports._enoent=$s});function Dn(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().
|
|
657
|
+
find(n=>n.toUpperCase()==="PATH")||"Path"}var af=f(()=>{});var cf=f(()=>{});import{promisify as p_}from"node:util";import{execFile as m_,execFileSync as LM}from"node:child_process";import lf from"node:path";
|
|
658
|
+
import{fileURLToPath as h_}from"node:url";function jn(e){return e instanceof URL?h_(e):e}function uf(e){return{*[Symbol.
|
|
659
|
+
iterator](){let t=lf.resolve(jn(e)),r;for(;r!==t;)yield t,r=t,t=lf.resolve(t,"..")}}}var BM,UM,df=f(()=>{cf();BM=p_(m_);
|
|
660
|
+
UM=10*1024*1024});import Bn from"node:process";import We from"node:path";var g_,y_,w_,ff,pf=f(()=>{af();df();g_=({cwd:e=Bn.cwd(),path:t=Bn.
|
|
661
|
+
env[Dn()],preferLocal:r=!0,execPath:n=Bn.execPath,addExecPath:o=!0}={})=>{let i=We.resolve(jn(e)),s=[],a=t.split(We.delimiter);
|
|
662
|
+
return r&&y_(s,a,i),o&&w_(s,a,n,i),t===""||t===We.delimiter?`${s.join(We.delimiter)}${t}`:[...s,t].join(We.delimiter)},y_=
|
|
663
|
+
(e,t,r)=>{for(let n of uf(r)){let o=We.join(n,"node_modules/.bin");t.includes(o)||e.push(o)}},w_=(e,t,r,n)=>{let o=We.resolve(
|
|
664
|
+
n,jn(r),"..");t.includes(o)||e.push(o)},ff=({env:e=Bn.env,...t}={})=>{e={...e};let r=Dn({env:e});return t.path=e[r],e[r]=
|
|
665
|
+
g_(t),e}});var mf,pe,hf,gf,yf,Un,lr,ur,Ye=f(()=>{mf=(e,t,r)=>{let n=r?ur:lr,o=e instanceof pe?{}:{cause:e};return new n(t,o)},pe=class extends Error{},
|
|
666
|
+
hf=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(
|
|
667
|
+
e.prototype,yf,{value:!0,writable:!1,enumerable:!1,configurable:!1})},gf=e=>Un(e)&&yf in e,yf=Symbol("isExecaError"),Un=
|
|
668
|
+
e=>Object.prototype.toString.call(e)==="[object Error]",lr=class extends Error{};hf(lr,lr.name);ur=class extends Error{};
|
|
669
|
+
hf(ur,ur.name)});var wf,b_,bf,Ef,Sf=f(()=>{wf=()=>{let e=Ef-bf+1;return Array.from({length:e},b_)},b_=(e,t)=>({name:`SIGRT${t+1}`,number:bf+
|
|
670
|
+
t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),bf=34,Ef=64});var _f,Tf=f(()=>{_f=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"S\
|
|
657
671
|
IGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,
|
|
658
672
|
action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"\
|
|
659
673
|
Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"\
|
|
@@ -684,1060 +698,1075 @@ other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event"
|
|
|
684
698
|
action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"termina\
|
|
685
699
|
te",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"In\
|
|
686
700
|
valid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"\
|
|
687
|
-
other"}]});import{constants as
|
|
688
|
-
number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:s}}=
|
|
689
|
-
t,description:r,supported:a,action:n,forced:o,standard:i}}});import{constants as
|
|
690
|
-
e.map(
|
|
691
|
-
supported:n,action:o,forced:i,standard:s}],
|
|
692
|
-
assign({},...r)},
|
|
693
|
-
standard:c}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:s,forced:a,standard:c}}},
|
|
694
|
-
({name:n})=>
|
|
695
|
-
l`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return
|
|
696
|
-
()`'s argument"),
|
|
701
|
+
other"}]});import{constants as E_}from"node:os";var Ms,S_,Of=f(()=>{Tf();Sf();Ms=()=>{let e=wf();return[..._f,...e].map(S_)},S_=({name:e,
|
|
702
|
+
number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:s}}=E_,a=s!==void 0;return{name:e,number:a?s:
|
|
703
|
+
t,description:r,supported:a,action:n,forced:o,standard:i}}});import{constants as __}from"node:os";var T_,O_,Af,A_,v_,I_,nL,vf=f(()=>{Of();T_=()=>{let e=Ms();return Object.fromEntries(
|
|
704
|
+
e.map(O_))},O_=({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s})=>[e,{name:e,number:t,description:r,
|
|
705
|
+
supported:n,action:o,forced:i,standard:s}],Af=T_(),A_=()=>{let e=Ms(),t=65,r=Array.from({length:t},(n,o)=>v_(o,e));return Object.
|
|
706
|
+
assign({},...r)},v_=(e,t)=>{let r=I_(e,t);if(r===void 0)return{};let{name:n,description:o,supported:i,action:s,forced:a,
|
|
707
|
+
standard:c}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:s,forced:a,standard:c}}},I_=(e,t)=>{let r=t.find(
|
|
708
|
+
({name:n})=>__.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},nL=A_()});import{constants as dr}from"node:os";var Rf,xf,Pf,R_,x_,If,P_,Ls,C_,N_,Fn,fr=f(()=>{vf();Rf=e=>{let t="option `killSigna\
|
|
709
|
+
l`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Pf(e,t)},xf=e=>e===0?e:Pf(e,"`subprocess.kill\
|
|
710
|
+
()`'s argument"),Pf=(e,t)=>{if(Number.isInteger(e))return R_(e,t);if(typeof e=="string")return P_(e,t);throw new TypeError(
|
|
697
711
|
`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
698
|
-
${
|
|
712
|
+
${Ls()}`)},R_=(e,t)=>{if(If.has(e))return If.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not\
|
|
699
713
|
exist.
|
|
700
|
-
${
|
|
701
|
-
return e;throw e.toUpperCase()in
|
|
714
|
+
${Ls()}`)},x_=()=>new Map(Object.entries(dr.signals).reverse().map(([e,t])=>[t,e])),If=x_(),P_=(e,t)=>{if(e in dr.signals)
|
|
715
|
+
return e;throw e.toUpperCase()in dr.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'\
|
|
702
716
|
.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
703
|
-
${
|
|
704
|
-
Available signal numbers: ${
|
|
705
|
-
Object.values(
|
|
706
|
-
if(e===!0)return
|
|
707
|
-
on-negative integer, got \`${e}\` (${typeof e})`);return e}
|
|
708
|
-
onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}
|
|
709
|
-
forceKillAfterDelay:t,killSignal:r,killResult:u,context:o,controller:i}),u}
|
|
717
|
+
${Ls()}`)},Ls=()=>`Available signal names: ${C_()}.
|
|
718
|
+
Available signal numbers: ${N_()}.`,C_=()=>Object.keys(dr.signals).sort().map(e=>`'${e}'`).join(", "),N_=()=>[...new Set(
|
|
719
|
+
Object.values(dr.signals).sort((e,t)=>e-t))].join(", "),Fn=e=>Af[e].description});import{setTimeout as k_}from"node:timers/promises";var Cf,$_,Nf,M_,L_,D_,Ds,zn=f(()=>{Ye();fr();Cf=e=>{if(e===!1)return e;
|
|
720
|
+
if(e===!0)return $_;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a n\
|
|
721
|
+
on-negative integer, got \`${e}\` (${typeof e})`);return e},$_=1e3*5,Nf=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},
|
|
722
|
+
onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}=M_(s,a,r);L_(l,n);let u=e(c);return D_({kill:e,signal:c,
|
|
723
|
+
forceKillAfterDelay:t,killSignal:r,killResult:u,context:o,controller:i}),u},M_=(e,t,r)=>{let[n=r,o]=Un(e)?[void 0,e]:[e,
|
|
710
724
|
t];if(typeof n!="string"&&!Number.isInteger(n))throw new TypeError(`The first argument must be an error instance or a si\
|
|
711
|
-
gnal name string/integer: ${String(n)}`);if(o!==void 0
|
|
712
|
-
specified, it must be an error instance: ${o}`);return{signal:
|
|
713
|
-
kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{t===n&&o&&
|
|
714
|
-
context:i,controllerSignal:s.signal})},
|
|
715
|
-
try{await
|
|
716
|
-
nal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)}
|
|
717
|
-
gracefulCancel:r,context:n,controller:o})=>t===void 0||r?[]:[
|
|
718
|
-
n),r.terminationReason??="cancel",e.kill(),t.reason}});var
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
throw new Error(`${
|
|
722
|
-
`${
|
|
725
|
+
gnal name string/integer: ${String(n)}`);if(o!==void 0&&!Un(o))throw new TypeError(`The second argument is optional. If \
|
|
726
|
+
specified, it must be an error instance: ${o}`);return{signal:xf(n),error:o}},L_=(e,t)=>{e!==void 0&&t.reject(e)},D_=async({
|
|
727
|
+
kill:e,signal:t,forceKillAfterDelay:r,killSignal:n,killResult:o,context:i,controller:s})=>{t===n&&o&&Ds({kill:e,forceKillAfterDelay:r,
|
|
728
|
+
context:i,controllerSignal:s.signal})},Ds=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:n})=>{if(t!==!1)
|
|
729
|
+
try{await k_(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as j_}from"node:events";var Vn,js=f(()=>{Vn=async(e,t)=>{e.aborted||await j_(e,"abort",{signal:t})}});var kf,$f,B_,Bs=f(()=>{js();kf=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSig\
|
|
730
|
+
nal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},$f=({subprocess:e,cancelSignal:t,
|
|
731
|
+
gracefulCancel:r,context:n,controller:o})=>t===void 0||r?[]:[B_(e,t,n,o)],B_=async(e,t,r,{signal:n})=>{throw await Vn(t,
|
|
732
|
+
n),r.terminationReason??="cancel",e.kill(),t.reason}});var At,U_,Us,Mf,Lf,Gn,Df,jf,Bf,Uf,Ff,zf,F_,z_,V_,me,G_,Me,vt,It=f(()=>{At=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{
|
|
733
|
+
U_(e,t,r),Us(e,t,n)},U_=(e,t,r)=>{if(!r)throw new Error(`${me(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},
|
|
734
|
+
Us=(e,t,r)=>{if(!r)throw new Error(`${me(e,t)} cannot be used: the ${Me(t)} has already exited or disconnected.`)},Mf=e=>{
|
|
735
|
+
throw new Error(`${me("getOneMessage",e)} could not complete: the ${Me(e)} exited or disconnected.`)},Lf=e=>{throw new Error(
|
|
736
|
+
`${me("sendMessage",e)} failed: the ${Me(e)} is sending a message too, instead of listening to incoming messages.
|
|
723
737
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
724
738
|
|
|
725
739
|
const [receivedMessage] = await Promise.all([
|
|
726
|
-
${
|
|
727
|
-
${
|
|
728
|
-
]);`)},
|
|
729
|
-
|
|
730
|
-
`${
|
|
731
|
-
Signal\` aborted: the ${
|
|
732
|
-
ing the `cancelSignal` subprocess option.")},
|
|
733
|
-
`${
|
|
734
|
-
if(
|
|
735
|
-
|
|
736
|
-
["could not be cloned","circular structure","call stack size exceeded"],
|
|
737
|
-
`'s `controller.abort()`":`${
|
|
738
|
-
e.disconnect()}});var
|
|
739
|
-
t,!0),s=e.stdio[i];if(s===null)throw new TypeError(
|
|
740
|
-
get(e),i=
|
|
741
|
-
(e,t,r)=>{let n=
|
|
740
|
+
${me("getOneMessage",e)},
|
|
741
|
+
${me("sendMessage",e,"message, {strict: true}")},
|
|
742
|
+
]);`)},Gn=(e,t)=>new Error(`${me("sendMessage",t)} failed when sending an acknowledgment response to the ${Me(t)}.`,{cause:e}),
|
|
743
|
+
Df=e=>{throw new Error(`${me("sendMessage",e)} failed: the ${Me(e)} is not listening to incoming messages.`)},jf=e=>{throw new Error(
|
|
744
|
+
`${me("sendMessage",e)} failed: the ${Me(e)} exited without listening to incoming messages.`)},Bf=()=>new Error(`\`cancel\
|
|
745
|
+
Signal\` aborted: the ${Me(!0)} disconnected.`),Uf=()=>{throw new Error("`getCancelSignal()` cannot be used without sett\
|
|
746
|
+
ing the `cancelSignal` subprocess option.")},Ff=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(
|
|
747
|
+
`${me(t,r)} cannot be used: the ${Me(r)} is disconnecting.`,{cause:e})},zf=({error:e,methodName:t,isSubprocess:r,message:n})=>{
|
|
748
|
+
if(F_(e))throw new Error(`${me(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},
|
|
749
|
+
F_=({code:e,message:t})=>z_.has(e)||V_.some(r=>t.includes(r)),z_=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),V_=
|
|
750
|
+
["could not be cloned","circular structure","call stack size exceeded"],me=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal\
|
|
751
|
+
`'s `controller.abort()`":`${G_(t)}${e}(${r})`,G_=e=>e?"":"subprocess.",Me=e=>e?"parent process":"subprocess",vt=e=>{e.connected&&
|
|
752
|
+
e.disconnect()}});var we,Rt=f(()=>{we=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)}});var qn,xt,be,Vf,H_,q_,Gf,W_,Hf,pr,Hn,Le=f(()=>{xe();qn=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=be.get(e),i=Vf(o,
|
|
753
|
+
t,!0),s=e.stdio[i];if(s===null)throw new TypeError(Gf(i,t,n,!0));return s},xt=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=be.
|
|
754
|
+
get(e),i=Vf(o,t,!1),s=i==="all"?e.all:e.stdio[i];if(s==null)throw new TypeError(Gf(i,t,n,!1));return s},be=new WeakMap,Vf=
|
|
755
|
+
(e,t,r)=>{let n=H_(t,r);return q_(n,t,r,e),n},H_=(e,t)=>{let r=bs(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?
|
|
742
756
|
{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(
|
|
743
|
-
`"${
|
|
757
|
+
`"${pr(t)}" must not be "${e}".
|
|
744
758
|
It must be ${n} or "fd3", "fd4" (and so on).
|
|
745
|
-
It is optional and defaults to "${o}".`)},
|
|
759
|
+
It is optional and defaults to "${o}".`)},q_=(e,t,r,n)=>{let o=n[Hf(e)];if(o===void 0)throw new TypeError(`"${pr(r)}" mu\
|
|
746
760
|
st not be ${t}. That file descriptor does not exist.
|
|
747
761
|
Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(
|
|
748
|
-
`"${
|
|
749
|
-
`"${
|
|
750
|
-
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=
|
|
751
|
-
option is incompatible with using "${
|
|
752
|
-
Please set this option with "pipe" instead.`},
|
|
762
|
+
`"${pr(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(
|
|
763
|
+
`"${pr(r)}" must not be ${t}. It must be a writable stream, not readable.`)},Gf=(e,t,r,n)=>{if(e==="all"&&!r.all)return`\
|
|
764
|
+
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=W_(e,r);return`The "${o}: ${Hn(i)}"\
|
|
765
|
+
option is incompatible with using "${pr(n)}: ${Hn(t)}".
|
|
766
|
+
Please set this option with "pipe" instead.`},W_=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=Hf(e);return i===0&&t!==
|
|
753
767
|
void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"\
|
|
754
|
-
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},
|
|
755
|
-
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream"});import{addAbortListener as
|
|
756
|
-
POSITIVE_INFINITY||(e.setMaxListeners(n+t),
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await
|
|
760
|
-
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},
|
|
761
|
-
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{
|
|
762
|
-
ne");e.removeListener("message",o),
|
|
763
|
-
e);let n=new
|
|
764
|
-
|
|
765
|
-
ipcEmitter:e});t.on("message",o),t.once("disconnect",
|
|
766
|
-
boundOnMessage:o})),
|
|
767
|
-
channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=
|
|
768
|
-
hasListeners:s}},
|
|
769
|
-
hasListeners:!1})},
|
|
770
|
-
connected)return e;let{id:i,message:s}=e,a={id:i,type:
|
|
771
|
-
ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},
|
|
772
|
-
resolve({isDeadlock:!1,hasListeners:r}),!0},
|
|
773
|
-
try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,
|
|
774
|
-
|
|
775
|
-
pc:response"});var
|
|
776
|
-
t.id:void 0,s={onMessageSent:o,id:i};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},
|
|
777
|
-
e.delete(t),t.onMessageSent.resolve()},
|
|
778
|
-
await Promise.all(n.map(({onMessageSent:o})=>o))}},
|
|
779
|
-
e)&&!
|
|
780
|
-
ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return
|
|
781
|
-
|
|
782
|
-
isSubprocess:n,message:o,strict:i})=>{let s=
|
|
783
|
-
await
|
|
784
|
-
async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=
|
|
785
|
-
r),i(n)])}catch(s){throw
|
|
786
|
-
|
|
787
|
-
cancelSignal";return
|
|
788
|
-
message:t})},
|
|
789
|
-
|
|
790
|
-
return}
|
|
791
|
-
abort(
|
|
768
|
+
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},Hf=e=>e==="all"?1:e,pr=e=>e?"to":"from",Hn=e=>typeof e==
|
|
769
|
+
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream"});import{addAbortListener as Y_}from"node:events";var Ke,Wn=f(()=>{Ke=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.
|
|
770
|
+
POSITIVE_INFINITY||(e.setMaxListeners(n+t),Y_(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))}});var Yn,Fs,Kn,zs,qf,Wf,mr=f(()=>{Yn=(e,t)=>{t&&Fs(e)},Fs=e=>{e.refCounted()},Kn=(e,t)=>{t&&zs(e)},zs=e=>{e.unrefCounted()},
|
|
771
|
+
qf=(e,t)=>{t&&(zs(e),zs(e))},Wf=(e,t)=>{t&&(Fs(e),Fs(e))}});import{once as K_}from"node:events";import{scheduler as J_}from"node:timers/promises";var Yf,Kf,Jn,Jf=f(()=>{Zn();mr();Xn();
|
|
772
|
+
Qn();Yf=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(Zf(o)||ep(o))return;Jn.has(e)||Jn.set(e,[]);let i=Jn.
|
|
773
|
+
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Qf(e,n,o),await J_.yield();let s=await Xf({wrappedMessage:i[0],
|
|
774
|
+
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},Kf=async({anyProcess:e,
|
|
775
|
+
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{Vs();let i=Jn.get(e);for(;i?.length>0;)await K_(n,"message:do\
|
|
776
|
+
ne");e.removeListener("message",o),Wf(t,r),n.connected=!1,n.emit("disconnect")},Jn=new WeakMap});import{EventEmitter as X_}from"node:events";var De,eo,Z_,to,hr=f(()=>{Jf();mr();De=(e,t,r)=>{if(eo.has(e))return eo.get(
|
|
777
|
+
e);let n=new X_;return n.connected=!0,eo.set(e,n),Z_({ipcEmitter:n,anyProcess:e,channel:t,isSubprocess:r}),n},eo=new WeakMap,
|
|
778
|
+
Z_=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=Yf.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,
|
|
779
|
+
ipcEmitter:e});t.on("message",o),t.once("disconnect",Kf.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e,
|
|
780
|
+
boundOnMessage:o})),qf(r,n)},to=e=>{let t=eo.get(e);return t===void 0?e.channel!==null:t.connected}});import{once as Q_}from"node:events";var tp,eT,rp,Xf,Zf,np,ro,tT,no,op,Xn=f(()=>{Rt();Wn();so();It();hr();Zn();tp=({anyProcess:e,
|
|
781
|
+
channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=De(e,t,r),s=oo(e,i);return{id:eT++,type:no,message:n,
|
|
782
|
+
hasListeners:s}},eT=0n,rp=(e,t)=>{if(!(t?.type!==no||t.hasListeners))for(let{id:r}of e)r!==void 0&&ro[r].resolve({isDeadlock:!0,
|
|
783
|
+
hasListeners:!1})},Xf=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{if(e?.type!==no||!t.
|
|
784
|
+
connected)return e;let{id:i,message:s}=e,a={id:i,type:op,message:oo(t,o)};try{await io({anyProcess:t,channel:r,isSubprocess:n,
|
|
785
|
+
ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},Zf=e=>{if(e?.type!==op)return!1;let{id:t,message:r}=e;return ro[t]?.
|
|
786
|
+
resolve({isDeadlock:!1,hasListeners:r}),!0},np=async(e,t,r)=>{if(e?.type!==no)return;let n=we();ro[e.id]=n;let o=new AbortController;
|
|
787
|
+
try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,tT(t,r,o)]);i&&Lf(r),s||Df(r)}finally{o.abort(),delete ro[e.id]}},
|
|
788
|
+
ro={},tT=async(e,t,{signal:r})=>{Ke(e,1,r),await Q_(e,"disconnect",{signal:r}),jf(t)},no="execa:ipc:request",op="execa:i\
|
|
789
|
+
pc:response"});var ip,sp,Qf,gr,oo,rT,Zn=f(()=>{Rt();xe();Le();Xn();ip=(e,t,r)=>{gr.has(e)||gr.set(e,new Set);let n=gr.get(e),o=we(),i=r?
|
|
790
|
+
t.id:void 0,s={onMessageSent:o,id:i};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},sp=({outgoingMessages:e,outgoingMessage:t})=>{
|
|
791
|
+
e.delete(t),t.onMessageSent.resolve()},Qf=async(e,t,r)=>{for(;!oo(e,t)&&gr.get(e)?.size>0;){let n=[...gr.get(e)];rp(n,r),
|
|
792
|
+
await Promise.all(n.map(({onMessageSent:o})=>o))}},gr=new WeakMap,oo=(e,t)=>t.listenerCount("message")>rT(e),rT=e=>be.has(
|
|
793
|
+
e)&&!Re(be.get(e).options.buffer,"ipc")?1:0});import{promisify as nT}from"node:util";var io,oT,Hs,iT,Gs,so=f(()=>{It();Zn();Xn();io=({anyProcess:e,channel:t,isSubprocess:r,
|
|
794
|
+
ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return At({methodName:s,isSubprocess:r,ipc:n,isConnected:e.connected}),
|
|
795
|
+
oT({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},oT=async({anyProcess:e,channel:t,methodName:r,
|
|
796
|
+
isSubprocess:n,message:o,strict:i})=>{let s=tp({anyProcess:e,channel:t,isSubprocess:n,message:o,strict:i}),a=ip(e,s,i);try{
|
|
797
|
+
await Hs({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){throw vt(e),c}finally{sp(a)}},Hs=
|
|
798
|
+
async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=iT(e);try{await Promise.all([np(n,e,
|
|
799
|
+
r),i(n)])}catch(s){throw Ff({error:s,methodName:t,isSubprocess:r}),zf({error:s,methodName:t,isSubprocess:r,message:o}),s}},
|
|
800
|
+
iT=e=>{if(Gs.has(e))return Gs.get(e);let t=nT(e.send.bind(e));return Gs.set(e,t),t},Gs=new WeakMap});import{scheduler as sT}from"node:timers/promises";var cp,lp,aT,ap,ep,up,Vs,qs,Qn=f(()=>{so();hr();It();cp=(e,t)=>{let r="\
|
|
801
|
+
cancelSignal";return Us(r,!1,e.connected),Hs({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:up,message:t},
|
|
802
|
+
message:t})},lp=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await aT({anyProcess:e,channel:t,isSubprocess:r,ipc:n}),
|
|
803
|
+
qs.signal),aT=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!ap){if(ap=!0,!n){Uf();return}if(t===null){Vs();
|
|
804
|
+
return}De(e,t,r),await sT.yield()}},ap=!1,ep=e=>e?.type!==up?!1:(qs.abort(e.message),!0),up="execa:ipc:cancel",Vs=()=>{qs.
|
|
805
|
+
abort(Bf())},qs=new AbortController});var dp,fp,cT,lT,Ws=f(()=>{js();Qn();zn();dp=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)
|
|
792
806
|
throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error(
|
|
793
807
|
"The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serial\
|
|
794
|
-
ization` option cannot be 'json' when setting the `gracefulCancel` option.")}},
|
|
795
|
-
forceKillAfterDelay:n,context:o,controller:i})=>r?[
|
|
796
|
-
[],
|
|
797
|
-
t);throw await
|
|
798
|
-
fulCancel",t.reason},
|
|
799
|
-
defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t}});import{setTimeout as
|
|
808
|
+
ization` option cannot be 'json' when setting the `gracefulCancel` option.")}},fp=({subprocess:e,cancelSignal:t,gracefulCancel:r,
|
|
809
|
+
forceKillAfterDelay:n,context:o,controller:i})=>r?[cT({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:i})]:
|
|
810
|
+
[],cT=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await Vn(t,o);let i=lT(
|
|
811
|
+
t);throw await cp(e,i),Ds({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="grace\
|
|
812
|
+
fulCancel",t.reason},lT=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.
|
|
813
|
+
defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t}});import{setTimeout as uT}from"node:timers/promises";var pp,mp,dT,Ys=f(()=>{Ye();pp=({timeout:e})=>{if(e!==void 0&&(!Number.
|
|
800
814
|
isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e}\
|
|
801
|
-
)`)},
|
|
802
|
-
terminationReason??="timeout",e.kill(),new
|
|
815
|
+
)`)},mp=(e,t,r,n)=>t===0||t===void 0?[]:[dT(e,t,r,n)],dT=async(e,t,r,{signal:n})=>{throw await uT(t,void 0,{signal:n}),r.
|
|
816
|
+
terminationReason??="timeout",e.kill(),new pe}});import{execPath as fT,execArgv as pT}from"node:process";import hp from"node:path";var gp,yp,Ks=f(()=>{bt();gp=({options:e})=>{
|
|
803
817
|
if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},
|
|
804
|
-
|
|
805
|
-
void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=
|
|
806
|
-
n,'The "nodePath" option'),l=
|
|
818
|
+
yp=(e,t,{node:r=!1,nodePath:n=fT,nodeOptions:o=pT.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,...a})=>{if(s!==
|
|
819
|
+
void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=wt(
|
|
820
|
+
n,'The "nodePath" option'),l=hp.resolve(i,c),u={...a,nodePath:l,node:r,cwd:i};if(!r)return[e,t,u];if(hp.basename(e,".exe")===
|
|
807
821
|
"node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...o,
|
|
808
|
-
e,...t],{ipc:!0,...u,shell:!1}]}});import{serialize as
|
|
809
|
-
if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");
|
|
810
|
-
e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},
|
|
811
|
-
JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},
|
|
812
|
-
json:
|
|
813
|
-
`Invalid option \`encoding: ${
|
|
814
|
-
Please rename it to ${
|
|
822
|
+
e,...t],{ipc:!0,...u,shell:!1}]}});import{serialize as mT}from"node:v8";var wp,hT,gT,yT,bp,Js=f(()=>{wp=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){
|
|
823
|
+
if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");yT[r](e)}},hT=e=>{try{mT(
|
|
824
|
+
e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},gT=e=>{try{
|
|
825
|
+
JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},yT={advanced:hT,
|
|
826
|
+
json:gT},bp=async(e,t)=>{t!==void 0&&await e.sendMessage(t)}});var Sp,wT,ie,Xs,bT,Ep,ao,Je=f(()=>{Sp=({encoding:e})=>{if(Xs.has(e))return;let t=bT(e);if(t!==void 0)throw new TypeError(
|
|
827
|
+
`Invalid option \`encoding: ${ao(e)}\`.
|
|
828
|
+
Please rename it to ${ao(t)}.`);let r=[...Xs].map(n=>ao(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${ao(
|
|
815
829
|
e)}\`.
|
|
816
|
-
Please rename it to one of: ${r}.`)},
|
|
817
|
-
in1","ascii"]),
|
|
818
|
-
if(t in
|
|
819
|
-
binary:"latin1"},
|
|
820
|
-
(e=
|
|
830
|
+
Please rename it to one of: ${r}.`)},wT=new Set(["utf8","utf16le"]),ie=new Set(["buffer","hex","base64","base64url","lat\
|
|
831
|
+
in1","ascii"]),Xs=new Set([...wT,...ie]),bT=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();
|
|
832
|
+
if(t in Ep)return Ep[t];if(Xs.has(t))return t},Ep={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",
|
|
833
|
+
binary:"latin1"},ao=e=>typeof e=="string"?`"${e}"`:String(e)});import{statSync as ET}from"node:fs";import ST from"node:path";import _T from"node:process";var _p,Tp,Op,Zs=f(()=>{bt();_p=
|
|
834
|
+
(e=Tp())=>{let t=wt(e,'The "cwd" option');return ST.resolve(t)},Tp=()=>{try{return _T.cwd()}catch(e){throw e.message=`Th\
|
|
821
835
|
e current directory does not exist.
|
|
822
|
-
${e.message}`,e}},
|
|
836
|
+
${e.message}`,e}},Op=(e,t)=>{if(t===Tp())return e;let r;try{r=ET(t)}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
823
837
|
${n.message}
|
|
824
838
|
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
825
|
-
${e}`}});import
|
|
826
|
-
|
|
827
|
-
_parse(n,o,i),l=
|
|
828
|
-
u.forceKillAfterDelay=
|
|
829
|
-
"win32"&&
|
|
839
|
+
${e}`}});import TT from"node:path";import Ap from"node:process";var vp,co,OT,AT,Qs=f(()=>{vp=fb(sf(),1);pf();zn();fr();Bs();Ws();
|
|
840
|
+
Ys();Ks();Js();Je();Zs();bt();xe();co=(e,t,r)=>{r.cwd=_p(r.cwd);let[n,o,i]=yp(e,t,r),{command:s,args:a,options:c}=vp.default.
|
|
841
|
+
_parse(n,o,i),l=Yu(c),u=OT(l);return pp(u),Sp(u),wp(u),kf(u),dp(u),u.shell=ms(u.shell),u.env=AT(u),u.killSignal=Rf(u.killSignal),
|
|
842
|
+
u.forceKillAfterDelay=Cf(u.forceKillAfterDelay),u.lines=u.lines.map((p,d)=>p&&!ie.has(u.encoding)&&u.buffer[d]),Ap.platform===
|
|
843
|
+
"win32"&&TT.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},OT=({extendEnv:e=!0,preferLocal:t=!1,
|
|
830
844
|
cwd:r,localDir:n=r,encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,
|
|
831
|
-
gracefulCancel:
|
|
832
|
-
localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:
|
|
833
|
-
ipc:m,serialization:h}),
|
|
834
|
-
e;return r||n?
|
|
835
|
-
Input must be a string or a Uint8Array");return
|
|
836
|
-
-2)===
|
|
837
|
-
`,
|
|
838
|
-
e.readable===void 0)&&typeof e.pipe=="function"}function
|
|
845
|
+
gracefulCancel:p=!1,ipcInput:d,ipc:m=d!==void 0||p,serialization:h="advanced",...y})=>({...y,extendEnv:e,preferLocal:t,cwd:r,
|
|
846
|
+
localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:p,ipcInput:d,
|
|
847
|
+
ipc:m,serialization:h}),AT=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...Ap.env,...e}:
|
|
848
|
+
e;return r||n?ff({env:s,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s}});var lo,ea=f(()=>{lo=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r]});function Pt(e){if(typeof e=="string")return vT(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
849
|
+
Input must be a string or a Uint8Array");return IT(e)}var vT,IT,Ip,RT,Rp,xT,ta=f(()=>{vT=e=>e.at(-1)===Ip?e.slice(0,e.at(
|
|
850
|
+
-2)===Rp?-2:-1):e,IT=e=>e.at(-1)===RT?e.subarray(0,e.at(-2)===xT?-2:-1):e,Ip=`
|
|
851
|
+
`,RT=Ip.codePointAt(0),Rp="\r",xT=Rp.codePointAt(0)});function he(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&
|
|
852
|
+
e.readable===void 0)&&typeof e.pipe=="function"}function ra(e,{checkOpen:t=!0}={}){return he(e,{checkOpen:t})&&(e.writable||
|
|
839
853
|
!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="b\
|
|
840
|
-
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function
|
|
854
|
+
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function Xe(e,{checkOpen:t=!0}={}){return he(e,{checkOpen:t})&&
|
|
841
855
|
(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.
|
|
842
|
-
destroy=="function"&&typeof e.destroyed=="boolean"}function
|
|
843
|
-
getReader(),r=new
|
|
844
|
-
getPrototypeOf(async function*(){}).prototype),
|
|
856
|
+
destroy=="function"&&typeof e.destroyed=="boolean"}function na(e,t){return ra(e,t)&&Xe(e,t)}var Ze=f(()=>{});function xp(){return this[ia].next()}function Pp(e){return this[ia].return(e)}function sa({preventCancel:e=!1}={}){let t=this.
|
|
857
|
+
getReader(),r=new oa(t,e),n=Object.create(CT);return n[ia]=r,n}var PT,oa,ia,CT,Cp=f(()=>{PT=Object.getPrototypeOf(Object.
|
|
858
|
+
getPrototypeOf(async function*(){}).prototype),oa=class{#t;#r;#e=!1;#n=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){
|
|
845
859
|
let t=()=>this.#i();return this.#n=this.#n?this.#n.then(t,t):t(),this.#n}return(t){let r=()=>this.#o(t);return this.#n?this.#n.
|
|
846
860
|
then(r,r):r()}async#i(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#n=
|
|
847
861
|
void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),t}async#o(t){
|
|
848
862
|
if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,
|
|
849
|
-
{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},
|
|
850
|
-
ext"});Object.defineProperty(
|
|
851
|
-
value:
|
|
852
|
-
asyncIterator]=="function")return e;if(
|
|
853
|
-
first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:
|
|
854
|
-
let t=new AbortController,r={}
|
|
855
|
-
error!==void 0)throw r.error;if(!t.signal.aborted)throw n}finally{e.destroy()}}
|
|
856
|
-
e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},
|
|
857
|
-
finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l
|
|
858
|
-
|
|
859
|
-
getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(u)}catch(
|
|
860
|
-
|
|
861
|
-
e);s!==void 0&&
|
|
862
|
-
getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){
|
|
863
|
-
throw c!==void 0&&
|
|
864
|
-
g")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=
|
|
863
|
+
{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},ia=Symbol();Object.defineProperty(xp,"name",{value:"n\
|
|
864
|
+
ext"});Object.defineProperty(Pp,"name",{value:"return"});CT=Object.create(PT,{next:{enumerable:!0,configurable:!0,writable:!0,
|
|
865
|
+
value:xp},return:{enumerable:!0,configurable:!0,writable:!0,value:Pp}})});var Np=f(()=>{});var kp=f(()=>{Cp();Np()});var $p,NT,kT,$T,yr,aa=f(()=>{Ze();kp();$p=e=>{if(Xe(e,{checkOpen:!1})&&yr.on!==void 0)return kT(e);if(typeof e?.[Symbol.
|
|
866
|
+
asyncIterator]=="function")return e;if(NT.call(e)==="[object ReadableStream]")return sa.call(e);throw new TypeError("The\
|
|
867
|
+
first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:NT}=Object.prototype,kT=async function*(e){
|
|
868
|
+
let t=new AbortController,r={};$T(e,t,r);try{for await(let[n]of yr.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.
|
|
869
|
+
error!==void 0)throw r.error;if(!t.signal.aborted)throw n}finally{e.destroy()}},$T=async(e,t,r)=>{try{await yr.finished(
|
|
870
|
+
e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},yr={}});var Ct,MT,Dp,Mp,LT,Lp,Ee,wr=f(()=>{aa();Ct=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,
|
|
871
|
+
finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=$p(e),u=t();u.length=0;try{for await(let p of l){let d=LT(
|
|
872
|
+
p),m=r[d](p,u);Dp({convertedChunk:m,state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return MT({state:u,convertChunk:r,
|
|
873
|
+
getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(u)}catch(p){let d=typeof p=="object"&&p!==null?p:new Error(
|
|
874
|
+
p);throw d.bufferedData=a(u),d}},MT=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(
|
|
875
|
+
e);s!==void 0&&Dp({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},Dp=({convertedChunk:e,state:t,
|
|
876
|
+
getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){Mp(e,t,o,a);return}let c=n(e,i-t.length);
|
|
877
|
+
throw c!==void 0&&Mp(c,t,o,i),new Ee},Mp=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},LT=e=>{let t=typeof e;if(t==="strin\
|
|
878
|
+
g")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=Lp.call(
|
|
865
879
|
e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.
|
|
866
|
-
isInteger(e.byteOffset)&&
|
|
867
|
-
|
|
868
|
-
ot supported: ${String(e)}`)},
|
|
869
|
-
push(e),t),
|
|
870
|
-
truncateChunk:
|
|
871
|
-
0)}),
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
r).set(new Uint8Array(e),0),r},
|
|
876
|
-
0,t),
|
|
877
|
-
others:
|
|
878
|
-
|
|
879
|
-
decode();return t===""?void 0:t},
|
|
880
|
-
others:
|
|
881
|
-
|
|
882
|
-
if(!(e instanceof
|
|
883
|
-
e},
|
|
884
|
-
throw n.maxBufferInfo={fdNumber:"ipc"},n},
|
|
885
|
-
was larger than ${n} ${o}`},
|
|
886
|
-
s"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=
|
|
887
|
-
ut",threshold:o,unit:"messages"}:{streamName:
|
|
888
|
-
n=>n!==null&&n.length>
|
|
880
|
+
isInteger(e.byteOffset)&&Lp.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Lp}=Object.prototype,
|
|
881
|
+
Ee=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Pe,br,uo,fo,po,mo=f(()=>{Pe=e=>e,br=()=>{},uo=({contents:e})=>e,fo=e=>{throw new Error(`Streams in object mode are n\
|
|
882
|
+
ot supported: ${String(e)}`)},po=e=>e.length});async function ho(e,t){return Ct(e,UT,t)}var DT,jT,BT,UT,jp=f(()=>{wr();mo();DT=()=>({contents:[]}),jT=()=>1,BT=(e,{contents:t})=>(t.
|
|
883
|
+
push(e),t),UT={init:DT,convertChunk:{string:Pe,buffer:Pe,arrayBuffer:Pe,dataView:Pe,typedArray:Pe,others:Pe},getSize:jT,
|
|
884
|
+
truncateChunk:br,addChunk:BT,getFinalChunk:br,finalize:uo}});async function go(e,t){return Ct(e,KT,t)}var FT,zT,VT,Bp,Up,GT,HT,qT,WT,zp,Fp,YT,Vp,KT,Gp=f(()=>{wr();mo();FT=()=>({contents:new ArrayBuffer(
|
|
885
|
+
0)}),zT=e=>VT.encode(e),VT=new TextEncoder,Bp=e=>new Uint8Array(e),Up=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),
|
|
886
|
+
GT=(e,t)=>e.slice(0,t),HT=(e,{contents:t,length:r},n)=>{let o=Vp()?WT(t,n):qT(t,n);return new Uint8Array(o).set(e,r),o},
|
|
887
|
+
qT=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(zp(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},
|
|
888
|
+
WT=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:zp(t)});return new Uint8Array(
|
|
889
|
+
r).set(new Uint8Array(e),0),r},zp=e=>Fp**Math.ceil(Math.log(e)/Math.log(Fp)),Fp=2,YT=({contents:e,length:t})=>Vp()?e:e.slice(
|
|
890
|
+
0,t),Vp=()=>"resize"in ArrayBuffer.prototype,KT={init:FT,convertChunk:{string:zT,buffer:Bp,arrayBuffer:Bp,dataView:Up,typedArray:Up,
|
|
891
|
+
others:fo},getSize:po,truncateChunk:GT,addChunk:HT,getFinalChunk:br,finalize:YT}});async function wo(e,t){return Ct(e,eO,t)}var JT,yo,XT,ZT,QT,eO,Hp=f(()=>{wr();mo();JT=()=>({contents:"",textDecoder:new TextDecoder}),
|
|
892
|
+
yo=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),XT=(e,{contents:t})=>t+e,ZT=(e,t)=>e.slice(0,t),QT=({textDecoder:e})=>{let t=e.
|
|
893
|
+
decode();return t===""?void 0:t},eO={init:JT,convertChunk:{string:Pe,buffer:yo,arrayBuffer:yo,dataView:yo,typedArray:yo,
|
|
894
|
+
others:fo},getSize:po,truncateChunk:ZT,addChunk:XT,getFinalChunk:QT,finalize:uo}});var qp=f(()=>{jp();Gp();Hp();wr()});import{on as tO}from"node:events";import{finished as rO}from"node:stream/promises";var bo=f(()=>{aa();qp();Object.assign(
|
|
895
|
+
yr,{on:tO,finished:rO})});var Wp,nO,Yp,Kp,oO,Jp,Xp,Eo,Qe=f(()=>{bo();Ie();xe();Wp=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{
|
|
896
|
+
if(!(e instanceof Ee))throw e;if(i==="all")return e;let s=nO(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),
|
|
897
|
+
e},nO=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",Yp=(e,t,r)=>{if(t.length!==r)return;let n=new Ee;
|
|
898
|
+
throw n.maxBufferInfo={fdNumber:"ipc"},n},Kp=(e,t)=>{let{streamName:r,threshold:n,unit:o}=oO(e,t);return`Command's ${r} \
|
|
899
|
+
was larger than ${n} ${o}`},oO=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"byte\
|
|
900
|
+
s"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=Re(t,r);return r==="ipc"?{streamName:"IPC outp\
|
|
901
|
+
ut",threshold:o,unit:"messages"}:{streamName:An(r),threshold:o,unit:n}},Jp=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(
|
|
902
|
+
n=>n!==null&&n.length>Eo(r)),Xp=(e,t,r)=>{if(!t)return e;let n=Eo(r);return e.length>n?e.slice(0,n):e},Eo=([,e])=>e});import{inspect as iO}from"node:util";var Qp,sO,aO,cO,lO,uO,Zp,em=f(()=>{ta();oe();Zs();Rn();Qe();fr();Ye();Qp=({stdio:e,
|
|
889
903
|
all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,
|
|
890
|
-
isMaxBuffer:
|
|
891
|
-
E=
|
|
892
|
-
isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:
|
|
904
|
+
isMaxBuffer:p,isForcefullyTerminated:d,forceKillAfterDelay:m,killSignal:h,maxBuffer:y,timeout:w,cwd:g})=>{let b=n?.code,
|
|
905
|
+
E=sO({originalError:n,timedOut:c,timeout:w,isMaxBuffer:p,maxBuffer:y,errorCode:b,signal:o,signalDescription:i,exitCode:s,
|
|
906
|
+
isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:m,killSignal:h}),S=cO(n,g),_=S===void 0?
|
|
893
907
|
"":`
|
|
894
|
-
${S}`,
|
|
895
|
-
`)].map(
|
|
908
|
+
${S}`,T=`${E}: ${a}${_}`,I=t===void 0?[e[2],e[1]]:[t],A=[T,...I,...e.slice(3),r.map(P=>lO(P)).join(`
|
|
909
|
+
`)].map(P=>cr(Pt(uO(P)))).filter(Boolean).join(`
|
|
896
910
|
|
|
897
|
-
`);return{originalMessage:S,shortMessage:
|
|
898
|
-
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:
|
|
899
|
-
killSignal:m})=>{let h=
|
|
900
|
-
ully canceled with exit code ${c}`:
|
|
901
|
-
)`:l?`Command was canceled${h}`:n?`${
|
|
902
|
-
(${
|
|
903
|
-
nd failed"},
|
|
904
|
-
let r=
|
|
905
|
-
e),
|
|
906
|
-
`):
|
|
907
|
-
startTime:s})=>
|
|
911
|
+
`);return{originalMessage:S,shortMessage:T,message:A}},sO=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
912
|
+
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:d,
|
|
913
|
+
killSignal:m})=>{let h=aO(p,d);return t?`Command timed out after ${r} milliseconds${h}`:u?s===void 0?`Command was gracef\
|
|
914
|
+
ully canceled with exit code ${c}`:p?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${s} (${a}\
|
|
915
|
+
)`:l?`Command was canceled${h}`:n?`${Kp(e,o)}${h}`:i!==void 0?`Command failed with ${i}${h}`:p?`Command was killed with ${m}\
|
|
916
|
+
(${Fn(m)})${h}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
917
|
+
nd failed"},aO=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",cO=(e,t)=>{if(e instanceof pe)return;
|
|
918
|
+
let r=gf(e)?e.originalMessage:String(e?.message??e),n=cr(Op(r,t));return n===""?void 0:n},lO=e=>typeof e=="string"?e:iO(
|
|
919
|
+
e),uO=e=>Array.isArray(e)?e.map(t=>Pt(Zp(t))).filter(Boolean).join(`
|
|
920
|
+
`):Zp(e),Zp=e=>typeof e=="string"?e:G(e)?Tn(e):""});var So,Nt,Er,dO,tm,fO,Sr=f(()=>{fr();$n();Ye();em();So=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},
|
|
921
|
+
startTime:s})=>tm({command:e,escapedCommand:t,cwd:i,durationMs:Os(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,
|
|
908
922
|
isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),
|
|
909
|
-
|
|
923
|
+
Nt=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:s})=>Er({error:e,command:t,escapedCommand:r,
|
|
910
924
|
startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from(
|
|
911
|
-
{length:n.length}),ipcOutput:[],options:o,isSync:s}),
|
|
912
|
-
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:
|
|
913
|
-
timeout:
|
|
914
|
-
l,u),{originalMessage:
|
|
915
|
-
exitCode:
|
|
916
|
-
killSignal:
|
|
917
|
-
|
|
918
|
-
stdio:
|
|
919
|
-
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:
|
|
920
|
-
stdio:
|
|
921
|
-
cwd:
|
|
922
|
-
exitCode:l,signal:u,signalDescription:
|
|
923
|
-
|
|
924
|
-
t,o=n===void 0?void 0:
|
|
925
|
-
e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(
|
|
925
|
+
{length:n.length}),ipcOutput:[],options:o,isSync:s}),Er=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,
|
|
926
|
+
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:p,all:d,ipcOutput:m,options:{timeoutDuration:h,
|
|
927
|
+
timeout:y=h,forceKillAfterDelay:w,killSignal:g,cwd:b,maxBuffer:E},isSync:S})=>{let{exitCode:_,signal:T,signalDescription:I}=fO(
|
|
928
|
+
l,u),{originalMessage:A,shortMessage:P,message:j}=Qp({stdio:p,all:d,ipcOutput:m,originalError:e,signal:T,signalDescription:I,
|
|
929
|
+
exitCode:_,escapedCommand:r,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:w,
|
|
930
|
+
killSignal:g,maxBuffer:E,timeout:y,cwd:b}),B=mf(e,j,S);return Object.assign(B,dO({error:B,command:t,escapedCommand:r,startTime:n,
|
|
931
|
+
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:_,signal:T,signalDescription:I,
|
|
932
|
+
stdio:p,all:d,ipcOutput:m,cwd:b,originalMessage:A,shortMessage:P})),B},dO=({error:e,command:t,escapedCommand:r,startTime:n,
|
|
933
|
+
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:p,
|
|
934
|
+
stdio:d,all:m,ipcOutput:h,cwd:y,originalMessage:w,shortMessage:g})=>tm({shortMessage:g,originalMessage:w,command:t,escapedCommand:r,
|
|
935
|
+
cwd:y,durationMs:Os(n),failed:!0,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
936
|
+
exitCode:l,signal:u,signalDescription:p,code:e.cause?.code,stdout:d[1],stderr:d[2],all:m,stdio:d,ipcOutput:h,pipedFrom:[]}),
|
|
937
|
+
tm=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),fO=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:
|
|
938
|
+
t,o=n===void 0?void 0:Fn(t);return{exitCode:r,signal:n,signalDescription:o}}});function pO(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(
|
|
939
|
+
e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(rm(e*1e3)%1e3),nanoseconds:Math.trunc(rm(e*1e6)%1e3)}}function mO(e){
|
|
926
940
|
return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,
|
|
927
|
-
nanoseconds:0n}}function
|
|
928
|
-
e)}throw new TypeError("Expected a finite number or bigint")}var
|
|
941
|
+
nanoseconds:0n}}function ca(e){switch(typeof e){case"number":{if(Number.isFinite(e))return pO(e);break}case"bigint":return mO(
|
|
942
|
+
e)}throw new TypeError("Expected a finite number or bigint")}var rm,nm=f(()=>{rm=e=>Number.isFinite(e)?e:0});function la(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bi\
|
|
929
943
|
gint");t={...t};let n=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=
|
|
930
|
-
!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,
|
|
931
|
-
floor(u*10**
|
|
932
|
-
colonNotation&&
|
|
933
|
-
0?2:1;m="0".repeat(Math.max(0,
|
|
944
|
+
!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,p)=>{let d=Math.
|
|
945
|
+
floor(u*10**p+yO);return(Math.round(d)/10**p).toFixed(p)},s=(u,p,d,m)=>{if(!((o.length===0||!t.colonNotation)&&hO(u)&&!(t.
|
|
946
|
+
colonNotation&&d==="m"))){if(m??=String(u),t.colonNotation){let h=m.includes(".")?m.split(".")[0].length:m.length,y=o.length>
|
|
947
|
+
0?2:1;m="0".repeat(Math.max(0,y-h))+m}else m+=t.verbose?" "+gO(p,u):d;o.push(m)}},a=ca(e),c=BigInt(a.days);if(t.hideYearAndDays?
|
|
934
948
|
s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(t.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(
|
|
935
949
|
a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||
|
|
936
|
-
!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),
|
|
937
|
-
m=Number(a.nanoseconds);if(s(u,"second","s"),t.formatSubMilliseconds)s(
|
|
938
|
-
s(m,"nanosecond","ns");else{let h=d
|
|
939
|
-
0,
|
|
940
|
-
isecond","ms",b)}}else{let u=(r?Number(e%
|
|
941
|
-
1,
|
|
950
|
+
!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),p=Number(a.milliseconds),d=Number(a.microseconds),
|
|
951
|
+
m=Number(a.nanoseconds);if(s(u,"second","s"),t.formatSubMilliseconds)s(p,"millisecond","ms"),s(d,"microsecond","\xB5s"),
|
|
952
|
+
s(m,"nanosecond","ns");else{let h=p+d/1e3+m/1e6,y=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:
|
|
953
|
+
0,w=h>=1?Math.round(h):Math.ceil(h),g=1e3-10**-y,b=y?Math.min(h,g).toFixed(y):Math.min(w,g);s(Number.parseFloat(b),"mill\
|
|
954
|
+
isecond","ms",b)}}else{let u=(r?Number(e%wO):e)/1e3%60,p=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:
|
|
955
|
+
1,d=i(u,p),m=t.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");s(Number.parseFloat(m),"second","s",m)}if(o.length===0)
|
|
942
956
|
return n+"0"+(t.verbose?" milliseconds":"ms");let l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(
|
|
943
|
-
0,Math.max(t.unitCount,1))),n+o.join(l)}var
|
|
944
|
-
s`,
|
|
945
|
-
)`;
|
|
946
|
-
|
|
947
|
-
"native":
|
|
948
|
-
e.transform,{checkOpen:!1})?
|
|
949
|
-
e,t,"web TransformStream"),"webTransform"),
|
|
950
|
-
nary`,o),
|
|
951
|
-
when using a generator, not a ${r}.`)},
|
|
952
|
-
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(
|
|
953
|
-
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(
|
|
954
|
-
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!
|
|
955
|
-
ust be a generator.`);return
|
|
956
|
-
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},
|
|
957
|
-
e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",
|
|
958
|
-
ect GeneratorFunction]",
|
|
959
|
-
[object URL]",
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
ream]",
|
|
963
|
-
e?.writable),
|
|
964
|
-
|
|
965
|
-
rl","filePath","fileNumber"]),
|
|
966
|
-
["webTransform","duplex"]),
|
|
957
|
+
0,Math.max(t.unitCount,1))),n+o.join(l)}var hO,gO,yO,wO,om=f(()=>{nm();hO=e=>e===0||e===0n,gO=(e,t)=>t===1||t===1n?e:`${e}\
|
|
958
|
+
s`,yO=1e-7,wO=24n*60n*60n*1000n});var im,sm=f(()=>{_t();im=(e,t)=>{e.failed&&ye({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})}});var am,bO,cm=f(()=>{om();$e();_t();sm();am=(e,t)=>{Et(t)&&(im(e,t),bO(e,t))},bO=(e,t)=>{let r=`(done in ${la(e.durationMs)}\
|
|
959
|
+
)`;ye({type:"duration",verboseMessage:r,verboseInfo:t,result:e})}});var kt,_o=f(()=>{cm();kt=(e,t,{reject:r})=>{if(am(e,t),e.failed&&r)throw e;return e}});var dm,EO,SO,fm,pm,lm,_O,ua,um,et,mm,TO,To,hm,OO,AO,da,gm,vO,ym,Oo,IO,fa,RO,xO,wm,ce,Ao,pa,bm,Em,je,X=f(()=>{Ze();Ae();oe();
|
|
960
|
+
dm=(e,t)=>et(e)?"asyncGenerator":mm(e)?"generator":To(e)?"fileUrl":OO(e)?"filePath":IO(e)?"webStream":he(e,{checkOpen:!1})?
|
|
961
|
+
"native":G(e)?"uint8Array":RO(e)?"asyncIterable":xO(e)?"iterable":fa(e)?fm({transform:e},t):TO(e)?EO(e,t):"native",EO=(e,t)=>na(
|
|
962
|
+
e.transform,{checkOpen:!1})?SO(e,t):fa(e.transform)?fm(e,t):_O(e,t),SO=(e,t)=>(pm(e,t,"Duplex stream"),"duplex"),fm=(e,t)=>(pm(
|
|
963
|
+
e,t,"web TransformStream"),"webTransform"),pm=({final:e,binary:t,objectMode:r},n,o)=>{lm(e,`${n}.final`,o),lm(t,`${n}.bi\
|
|
964
|
+
nary`,o),ua(r,`${n}.objectMode`)},lm=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined\
|
|
965
|
+
when using a generator, not a ${r}.`)},_O=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(e!==void 0&&!um(e))throw new TypeError(
|
|
966
|
+
`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(na(t,{checkOpen:!1}))
|
|
967
|
+
throw new TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(fa(t))throw new TypeError(`The \`${o}.f\
|
|
968
|
+
inal\` option must not be a web TransformStream.`);if(t!==void 0&&!um(t))throw new TypeError(`The \`${o}.final\` option m\
|
|
969
|
+
ust be a generator.`);return ua(r,`${o}.binary`),ua(n,`${o}.objectMode`),et(e)||et(t)?"asyncGenerator":"generator"},ua=(e,t)=>{
|
|
970
|
+
if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},um=e=>et(e)||mm(e),et=
|
|
971
|
+
e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",mm=e=>Object.prototype.toString.call(e)==="[obj\
|
|
972
|
+
ect GeneratorFunction]",TO=e=>F(e)&&(e.transform!==void 0||e.final!==void 0),To=e=>Object.prototype.toString.call(e)==="\
|
|
973
|
+
[object URL]",hm=e=>To(e)&&e.protocol!=="file:",OO=e=>F(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>AO.has(t))&&
|
|
974
|
+
da(e.file),AO=new Set(["file","append"]),da=e=>typeof e=="string",gm=(e,t)=>e==="native"&&typeof t=="string"&&!vO.has(t),
|
|
975
|
+
vO=new Set(["ipc","ignore","inherit","overlapped","pipe"]),ym=e=>Object.prototype.toString.call(e)==="[object ReadableSt\
|
|
976
|
+
ream]",Oo=e=>Object.prototype.toString.call(e)==="[object WritableStream]",IO=e=>ym(e)||Oo(e),fa=e=>ym(e?.readable)&&Oo(
|
|
977
|
+
e?.writable),RO=e=>wm(e)&&typeof e[Symbol.asyncIterator]=="function",xO=e=>wm(e)&&typeof e[Symbol.iterator]=="function",
|
|
978
|
+
wm=e=>typeof e=="object"&&e!==null,ce=new Set(["generator","asyncGenerator","duplex","webTransform"]),Ao=new Set(["fileU\
|
|
979
|
+
rl","filePath","fileNumber"]),pa=new Set(["fileUrl","filePath"]),bm=new Set([...pa,"webStream","nodeStream"]),Em=new Set(
|
|
980
|
+
["webTransform","duplex"]),je={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"\
|
|
967
981
|
a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"\
|
|
968
982
|
a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterab\
|
|
969
|
-
le",string:"a string",uint8Array:"a Uint8Array"}});var
|
|
970
|
-
return{writableObjectMode:n,readableObjectMode:e??n}},
|
|
971
|
-
r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},
|
|
972
|
-
return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var
|
|
973
|
-
|
|
974
|
-
o))i[s]=
|
|
975
|
-
stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:i,encoding:s})=>t==="duplex"
|
|
976
|
-
t==="webTransform"
|
|
977
|
-
encoding:s})
|
|
983
|
+
le",string:"a string",uint8Array:"a Uint8Array"}});var ma,PO,CO,Sm,ha=f(()=>{X();ma=(e,t,r,n)=>n==="output"?PO(e,t,r):CO(e,t,r),PO=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;
|
|
984
|
+
return{writableObjectMode:n,readableObjectMode:e??n}},CO=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==
|
|
985
|
+
r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},Sm=(e,t)=>{let r=e.findLast(({type:n})=>ce.has(n));
|
|
986
|
+
return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var _m,NO,kO,$O,MO,LO,DO,Tm=f(()=>{Ae();Je();X();ha();_m=(e,t,r,n)=>[...e.filter(({type:o})=>!ce.has(o)),...NO(e,t,r,n)],
|
|
987
|
+
NO=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>ce.has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(
|
|
988
|
+
o))i[s]=kO({stdioItem:a,index:Number(s),newTransforms:i,optionName:t,direction:r,encoding:n});return DO(i,r)},kO=({stdioItem:e,
|
|
989
|
+
stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:i,encoding:s})=>t==="duplex"?$O({stdioItem:e,optionName:o}):
|
|
990
|
+
t==="webTransform"?MO({stdioItem:e,index:r,newTransforms:n,direction:i}):LO({stdioItem:e,index:r,newTransforms:n,direction:i,
|
|
991
|
+
encoding:s}),$O=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},
|
|
978
992
|
optionName:i})=>{if(o&&!n)throw new TypeError(`The \`${i}.objectMode\` option can only be \`true\` if \`new Duplex({objectMo\
|
|
979
993
|
de: true})\` is used.`);if(!o&&n)throw new TypeError(`The \`${i}.objectMode\` option cannot be \`false\` if \`new Duplex({ob\
|
|
980
|
-
jectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:n}}}
|
|
981
|
-
stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:i,objectMode:s}=
|
|
982
|
-
readableObjectMode:c}=
|
|
994
|
+
jectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:n}}},MO=({stdioItem:e,
|
|
995
|
+
stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:i,objectMode:s}=F(t)?t:{transform:t},{writableObjectMode:a,
|
|
996
|
+
readableObjectMode:c}=ma(s,r,n,o);return{...e,value:{transform:i,writableObjectMode:a,readableObjectMode:c}}},LO=({stdioItem:e,
|
|
983
997
|
stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,
|
|
984
|
-
objectMode:u}=
|
|
985
|
-
transform:s,final:a,binary:
|
|
986
|
-
e});import
|
|
998
|
+
objectMode:u}=F(t)?t:{transform:t},p=c||ie.has(i),{writableObjectMode:d,readableObjectMode:m}=ma(u,r,n,o);return{...e,value:{
|
|
999
|
+
transform:s,final:a,binary:p,preserveNewlines:l,writableObjectMode:d,readableObjectMode:m}}},DO=(e,t)=>t==="input"?e.reverse():
|
|
1000
|
+
e});import ga from"node:process";var Om,jO,BO,$t,ya,Am,UO,FO,vm=f(()=>{Ze();X();Om=(e,t,r)=>{let n=e.map(o=>jO(o,t));if(n.includes(
|
|
987
1001
|
"input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writabl\
|
|
988
|
-
e values.`);return n.find(Boolean)??
|
|
989
|
-
|
|
990
|
-
e)?"output":"input",nodeStream(e){return
|
|
991
|
-
duplex
|
|
992
|
-
stdin].includes(e))return"input";if([1,2,
|
|
993
|
-
return i?
|
|
994
|
-
to provide \`stdio\` in combination with one of ${
|
|
1002
|
+
e values.`);return n.find(Boolean)??FO},jO=({type:e,value:t},r)=>BO[r]??Am[e](t),BO=["input","output","output"],$t=()=>{},
|
|
1003
|
+
ya=()=>"input",Am={generator:$t,asyncGenerator:$t,fileUrl:$t,filePath:$t,iterable:ya,asyncIterable:ya,uint8Array:ya,webStream:e=>Oo(
|
|
1004
|
+
e)?"output":"input",nodeStream(e){return Xe(e,{checkOpen:!1})?ra(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:$t,
|
|
1005
|
+
duplex:$t,native(e){let t=UO(e);if(t!==void 0)return t;if(he(e,{checkOpen:!1}))return Am.nodeStream(e)}},UO=e=>{if([0,ga.
|
|
1006
|
+
stdin].includes(e))return"input";if([1,2,ga.stdout,ga.stderr].includes(e))return"output"},FO="output"});var Im,Rm=f(()=>{Im=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e});var xm,zO,VO,Pm,GO,HO,Cm=f(()=>{Ie();Rm();$e();xm=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=zO(e,n).map((a,c)=>Pm(a,c));
|
|
1007
|
+
return i?GO(s,r,o):Im(s,t)},zO=(e,t)=>{if(e===void 0)return ae.map(n=>t[n]);if(VO(t))throw new Error(`It's not possible \
|
|
1008
|
+
to provide \`stdio\` in combination with one of ${ae.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];
|
|
995
1009
|
if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);
|
|
996
|
-
let r=Math.max(e.length,
|
|
997
|
-
isArray(e)?e.map(r=>
|
|
998
|
-
gnore":n),
|
|
999
|
-
({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?
|
|
1000
|
-
fdNumber:n,direction:o}):
|
|
1001
|
-
let i=
|
|
1002
|
-
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},
|
|
1003
|
-
optionName:t,fdNumber:r,direction:n})=>{let o=
|
|
1004
|
-
if(
|
|
1005
|
-
s.`);return{type:"uint8Array",value:
|
|
1006
|
-
return e;let r=
|
|
1007
|
-
herit"?{type:"nodeStream",value:
|
|
1008
|
-
|
|
1009
|
-
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n}});var
|
|
1010
|
-
[{type:
|
|
1011
|
-
string";if(
|
|
1012
|
-
ble stream.")},
|
|
1010
|
+
let r=Math.max(e.length,ae.length);return Array.from({length:r},(n,o)=>e[o])},VO=e=>ae.some(t=>e[t]!==void 0),Pm=(e,t)=>Array.
|
|
1011
|
+
isArray(e)?e.map(r=>Pm(r,t)):e??(t>=ae.length?"ignore":"pipe"),GO=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!St(r,o)&&HO(n)?"i\
|
|
1012
|
+
gnore":n),HO=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe")});import{readFileSync as qO}from"node:fs";import WO from"node:tty";var km,YO,KO,JO,XO,Nm,$m=f(()=>{Ze();Ie();oe();Le();km=
|
|
1013
|
+
({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?YO({stdioItem:e,
|
|
1014
|
+
fdNumber:n,direction:o}):XO({stdioItem:e,fdNumber:n}),YO=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{
|
|
1015
|
+
let i=KO({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(he(t,{checkOpen:!1}))throw new TypeError(
|
|
1016
|
+
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},KO=({value:e,
|
|
1017
|
+
optionName:t,fdNumber:r,direction:n})=>{let o=JO(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};
|
|
1018
|
+
if(WO.isatty(o))throw new TypeError(`The \`${t}: ${Hn(e)}\` option is invalid: it cannot be a TTY with synchronous method\
|
|
1019
|
+
s.`);return{type:"uint8Array",value:ve(qO(o)),optionName:t}}},JO=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")
|
|
1020
|
+
return e;let r=On.indexOf(e);if(r!==-1)return r},XO=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="in\
|
|
1021
|
+
herit"?{type:"nodeStream",value:Nm(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:Nm(t,t,r),optionName:r}:
|
|
1022
|
+
he(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,Nm=(e,t,r)=>{let n=On[e];if(n===void 0)throw new TypeError(
|
|
1023
|
+
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n}});var Mm,ZO,QO,eA,tA,Lm=f(()=>{Ze();oe();X();Mm=({input:e,inputFile:t},r)=>r===0?[...ZO(e),...eA(t)]:[],ZO=e=>e===void 0?[]:
|
|
1024
|
+
[{type:QO(e),value:e,optionName:"input"}],QO=e=>{if(Xe(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"\
|
|
1025
|
+
string";if(G(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Reada\
|
|
1026
|
+
ble stream.")},eA=e=>e===void 0?[]:[{...tA(e),optionName:"inputFile"}],tA=e=>{if(To(e))return{type:"fileUrl",value:e};if(da(
|
|
1013
1027
|
e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file U\
|
|
1014
|
-
RL.")}});var
|
|
1015
|
-
tor"||t.type==="asyncGenerator")),
|
|
1016
|
-
let s=
|
|
1017
|
-
return
|
|
1018
|
-
|
|
1019
|
-
type:t,value:r,optionName:n,direction:o})=>{
|
|
1020
|
-
|
|
1021
|
-
find(a=>a.direction!==o);return
|
|
1022
|
-
r.file:e==="fileUrl"?t.href===r.href:t===r,
|
|
1023
|
-
transform:i}})=>i===r.transform);
|
|
1024
|
-
\` options must not target ${
|
|
1025
|
-
t,r,n).map((a,c)=>
|
|
1026
|
-
isSync:n});return t.stdio=s.map(({stdioItems:a})=>
|
|
1027
|
-
t),{stdioItems:i,isStdioArray:s}=
|
|
1028
|
-
isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=
|
|
1029
|
-
|
|
1030
|
-
s=
|
|
1031
|
-
|
|
1032
|
-
optionName:o}of e)if(
|
|
1033
|
-
"ipc"]),
|
|
1028
|
+
RL.")}});var Dm,jm,rA,nA,Bm,oA,iA,Um,Fm=f(()=>{X();Dm=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="genera\
|
|
1029
|
+
tor"||t.type==="asyncGenerator")),jm=({stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{
|
|
1030
|
+
let s=rA(o,e);if(s.length!==0){if(i){nA({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(bm.has(e))
|
|
1031
|
+
return Bm({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});Em.has(e)&&iA({otherStdioItems:s,type:e,value:t,optionName:r})}},
|
|
1032
|
+
rA=(e,t)=>e.flatMap(({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),nA=({otherStdioItems:e,
|
|
1033
|
+
type:t,value:r,optionName:n,direction:o})=>{pa.has(t)&&Bm({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},
|
|
1034
|
+
Bm=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>oA(a,r));if(i.length===0)return;let s=i.
|
|
1035
|
+
find(a=>a.direction!==o);return Um(s,n,t),o==="output"?i[0].stream:void 0},oA=({type:e,value:t},r)=>e==="filePath"?t.file===
|
|
1036
|
+
r.file:e==="fileUrl"?t.href===r.href:t===r,iA=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{
|
|
1037
|
+
transform:i}})=>i===r.transform);Um(o,n,t)},Um=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\
|
|
1038
|
+
\` options must not target ${je[r]} that is the same.`)}});var vo,sA,aA,cA,lA,uA,dA,fA,pA,mA,hA,gA,wa,yA,Io=f(()=>{Ie();Tm();ha();X();vm();Cm();$m();Lm();Fm();vo=(e,t,r,n)=>{let i=xm(
|
|
1039
|
+
t,r,n).map((a,c)=>sA({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=mA({initialFileDescriptors:i,addProperties:e,options:t,
|
|
1040
|
+
isSync:n});return t.stdio=s.map(({stdioItems:a})=>yA(a)),s},sA=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o=An(
|
|
1041
|
+
t),{stdioItems:i,isStdioArray:s}=aA({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Om(i,t,o),c=i.map(p=>km({stdioItem:p,
|
|
1042
|
+
isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=_m(c,o,a,r),u=Sm(l,a);return pA(l,u),{direction:a,objectMode:u,stdioItems:l}},
|
|
1043
|
+
aA=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).map(c=>cA(c,n)),...Mm(r,t)],
|
|
1044
|
+
s=Dm(i),a=s.length>1;return lA(s,a,n),dA(s),{stdioItems:s,isStdioArray:a}},cA=(e,t)=>({type:dm(e,t),value:e,optionName:t}),
|
|
1045
|
+
lA=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:n,
|
|
1046
|
+
optionName:o}of e)if(uA.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\`.`)}},uA=new Set(["ignore",
|
|
1047
|
+
"ipc"]),dA=e=>{for(let t of e)fA(t)},fA=({type:e,value:t,optionName:r})=>{if(hm(t))throw new TypeError(`The \`${r}: URL\`\
|
|
1034
1048
|
option must use the \`file:\` scheme.
|
|
1035
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(
|
|
1036
|
-
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},
|
|
1049
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(gm(e,t))throw new TypeError(`Th\
|
|
1050
|
+
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},pA=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>Ao.
|
|
1037
1051
|
has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectM\
|
|
1038
|
-
ode.`)},
|
|
1039
|
-
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw
|
|
1040
|
-
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>
|
|
1041
|
-
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},
|
|
1042
|
-
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=
|
|
1043
|
-
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},
|
|
1044
|
-
r)&&r.destroy()},
|
|
1045
|
-
return t==="native"?r:"pipe"}});import{readFileSync as
|
|
1046
|
-
optionName:t})=>{
|
|
1047
|
-
throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},
|
|
1048
|
-
webStream:
|
|
1049
|
-
contents:[
|
|
1050
|
-
...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...
|
|
1051
|
-
path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:
|
|
1052
|
-
uint8Array:
|
|
1053
|
-
ll"?e[1]||e[2]:e[t]});var
|
|
1054
|
-
|
|
1055
|
-
bind(void 0,t,e),final:
|
|
1052
|
+
ode.`)},mA=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(hA({fileDescriptor:i,
|
|
1053
|
+
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw wa(o),i}},hA=({fileDescriptor:{direction:e,
|
|
1054
|
+
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>gA({stdioItem:c,addProperties:o,
|
|
1055
|
+
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},gA=({stdioItem:e,addProperties:t,
|
|
1056
|
+
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=jm({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==
|
|
1057
|
+
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},wa=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!fe(
|
|
1058
|
+
r)&&r.destroy()},yA=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;
|
|
1059
|
+
return t==="native"?r:"pipe"}});import{readFileSync as zm}from"node:fs";var Gm,Se,wA,Hm,Vm,bA,qm=f(()=>{oe();Io();X();Gm=(e,t)=>vo(bA,e,t,!0),Se=({type:e,
|
|
1060
|
+
optionName:t})=>{Hm(t,je[e])},wA=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&Hm(e,`"${t}"`),{}),Hm=(e,t)=>{
|
|
1061
|
+
throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},Vm={generator(){},asyncGenerator:Se,
|
|
1062
|
+
webStream:Se,nodeStream:Se,webTransform:Se,duplex:Se,asyncIterable:Se,native:wA},bA={input:{...Vm,fileUrl:({value:e})=>({
|
|
1063
|
+
contents:[ve(zm(e))]}),filePath:({value:{file:e}})=>({contents:[ve(zm(e))]}),fileNumber:Se,iterable:({value:e})=>({contents:[
|
|
1064
|
+
...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...Vm,fileUrl:({value:e})=>({
|
|
1065
|
+
path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Se,string:Se,
|
|
1066
|
+
uint8Array:Se}}});var Ce,ba,_r=f(()=>{ta();Ce=(e,{stripFinalNewline:t},r)=>ba(t,r)&&e!==void 0&&!Array.isArray(e)?Pt(e):e,ba=(e,t)=>t==="a\
|
|
1067
|
+
ll"?e[1]||e[2]:e[t]});var Ro,Sa,Wm,Ym,EA,SA,_A,Km,TA,Ea,OA,AA,vA,xo=f(()=>{Ro=(e,t,r,n)=>e||r?void 0:Ym(t,n),Sa=(e,t,r)=>r?e.flatMap(n=>Wm(n,t)):
|
|
1068
|
+
Wm(e,t),Wm=(e,t)=>{let{transform:r,final:n}=Ym(t,{});return[...r(e),...n()]},Ym=(e,t)=>(t.previousChunks="",{transform:EA.
|
|
1069
|
+
bind(void 0,t,e),final:_A.bind(void 0,t)}),EA=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=e,
|
|
1056
1070
|
o=-1;for(let i=0;i<r.length;i+=1)if(r[i]===`
|
|
1057
|
-
`){let s=
|
|
1058
|
-
e.previousChunks=n},
|
|
1059
|
-
e.length>0&&(yield e)},
|
|
1060
|
-
void 0,n)},
|
|
1061
|
-
ing"?
|
|
1071
|
+
`){let s=SA(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=Ea(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=Ea(n,r.slice(o+1))),
|
|
1072
|
+
e.previousChunks=n},SA=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),_A=function*({previousChunks:e}){
|
|
1073
|
+
e.length>0&&(yield e)},Km=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:TA.bind(
|
|
1074
|
+
void 0,n)},TA=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="str\
|
|
1075
|
+
ing"?OA:vA;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},Ea=(e,t)=>`${e}${t}`,OA={windowsNewline:`\r
|
|
1062
1076
|
`,unixNewline:`
|
|
1063
1077
|
`,LF:`
|
|
1064
|
-
`,concatBytes:
|
|
1065
|
-
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:
|
|
1066
|
-
if(typeof t!="string"&&!
|
|
1067
|
-
true" to receive as input: ${typeof t}.`);yield t},
|
|
1068
|
-
e,t),yield t},
|
|
1069
|
-
must yield a string or an Uint8Array, not ${typeof t}.`);yield t},
|
|
1078
|
+
`,concatBytes:Ea},AA=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},vA={windowsNewline:new Uint8Array(
|
|
1079
|
+
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:AA}});import{Buffer as IA}from"node:buffer";var Jm,RA,Xm,xA,PA,Zm,Qm=f(()=>{oe();Jm=(e,t)=>e?void 0:RA.bind(void 0,t),RA=function*(e,t){
|
|
1080
|
+
if(typeof t!="string"&&!G(t)&&!IA.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: \
|
|
1081
|
+
true" to receive as input: ${typeof t}.`);yield t},Xm=(e,t)=>e?xA.bind(void 0,t):PA.bind(void 0,t),xA=function*(e,t){Zm(
|
|
1082
|
+
e,t),yield t},PA=function*(e,t){if(Zm(e,t),typeof t!="string"&&!G(t))throw new TypeError(`The \`${e}\` option's function \
|
|
1083
|
+
must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Zm=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\`\
|
|
1070
1084
|
option's function must not call \`yield ${t}\`.
|
|
1071
1085
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
1072
|
-
if (condition) { yield value; }`)}});import{Buffer as
|
|
1073
|
-
|
|
1074
|
-
void 0,n),final
|
|
1075
|
-
|
|
1076
|
-
try{for await(let o of t.currentIterable)n.push(o)}finally{delete t.currentIterable}}),
|
|
1077
|
-
t.length){yield e;return}let{transform:n=
|
|
1078
|
-
t,{final:r}]of Object.entries(e))yield*
|
|
1079
|
-
yield*
|
|
1080
|
-
|
|
1081
|
-
r=>[...
|
|
1082
|
-
e))yield*
|
|
1083
|
-
if(e!==void 0)for(let n of e())yield*
|
|
1084
|
-
|
|
1085
|
-
c=
|
|
1086
|
-
u?
|
|
1087
|
-
o),transform(
|
|
1088
|
-
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=
|
|
1089
|
-
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:
|
|
1090
|
-
n),
|
|
1091
|
-
filter(Boolean)}});var
|
|
1092
|
-
([,{direction:t}])=>t==="input").map(([t])=>Number(t))),
|
|
1086
|
+
if (condition) { yield value; }`)}});import{Buffer as CA}from"node:buffer";import{StringDecoder as NA}from"node:string_decoder";var Po,kA,$A,MA,_a=f(()=>{oe();
|
|
1087
|
+
Po=(e,t,r)=>{if(r)return;if(e)return{transform:kA.bind(void 0,new TextEncoder)};let n=new NA(t);return{transform:$A.bind(
|
|
1088
|
+
void 0,n),final:MA.bind(void 0,n)}},kA=function*(e,t){CA.isBuffer(t)?yield ve(t):typeof t=="string"?yield e.encode(t):yield t},
|
|
1089
|
+
$A=function*(e,t){yield G(t)?e.write(t):t},MA=function*(e){let t=e.end();t!==""&&(yield t)}});import{callbackify as eh}from"node:util";var Ta,Co,th,LA,rh,DA,nh=f(()=>{Ta=eh(async(e,t,r,n)=>{t.currentIterable=e(...r);
|
|
1090
|
+
try{for await(let o of t.currentIterable)n.push(o)}finally{delete t.currentIterable}}),Co=async function*(e,t,r){if(r===
|
|
1091
|
+
t.length){yield e;return}let{transform:n=DA}=t[r];for await(let o of n(e))yield*Co(o,t,r+1)},th=async function*(e){for(let[
|
|
1092
|
+
t,{final:r}]of Object.entries(e))yield*LA(r,Number(t),e)},LA=async function*(e,t,r){if(e!==void 0)for await(let n of e())
|
|
1093
|
+
yield*Co(n,r,t+1)},rh=eh(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),
|
|
1094
|
+
DA=function*(e){yield e}});var Oa,oh,tt,Tr,jA,BA,Aa=f(()=>{Oa=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},oh=(e,t)=>[...t.flatMap(
|
|
1095
|
+
r=>[...tt(r,e,0)]),...Tr(e)],tt=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=BA}=t[r];for(let o of n(
|
|
1096
|
+
e))yield*tt(o,t,r+1)},Tr=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*jA(r,Number(t),e)},jA=function*(e,t,r){
|
|
1097
|
+
if(e!==void 0)for(let n of e())yield*tt(n,r,t+1)},BA=function*(e){yield e}});import{Transform as UA,getDefaultHighWaterMark as ih}from"node:stream";var va,No,sh,ko=f(()=>{X();xo();Qm();_a();nh();Aa();
|
|
1098
|
+
va=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
1099
|
+
c=sh(e,s,i),l=et(t),u=et(r),p=l?Ta.bind(void 0,Co,a):Oa.bind(void 0,tt),d=l||u?Ta.bind(void 0,th,a):Oa.bind(void 0,Tr),m=l||
|
|
1100
|
+
u?rh.bind(void 0,a):void 0;return{stream:new UA({writableObjectMode:n,writableHighWaterMark:ih(n),readableObjectMode:o,readableHighWaterMark:ih(
|
|
1101
|
+
o),transform(y,w,g){p([y,c,0],this,g)},flush(y){d([c],this,y)},destroy:m})}},No=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
1102
|
+
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=sh(s,r,a);e=oh(c,e)}return e},sh=({transform:e,final:t,
|
|
1103
|
+
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:Jm(n,a)},Po(r,s,
|
|
1104
|
+
n),Ro(r,i,n,c),{transform:e,final:t},{transform:Xm(o,a)},Km({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
1105
|
+
filter(Boolean)}});var ah,FA,zA,VA,GA,ch=f(()=>{ko();oe();X();ah=(e,t)=>{for(let r of FA(e))zA(e,r,t)},FA=e=>new Set(Object.entries(e).filter(
|
|
1106
|
+
([,{direction:t}])=>t==="input").map(([t])=>Number(t))),zA=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==
|
|
1093
1107
|
void 0);if(o.length===0)return;if(t!==0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \
|
|
1094
|
-
\`${c}\`, can be ${
|
|
1095
|
-
let r=
|
|
1108
|
+
\`${c}\`, can be ${je[a]} with synchronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>VA(a,n));r.input=ar(s)},VA=(e,t)=>{
|
|
1109
|
+
let r=No(e,t,"utf8",!0);return GA(r),ar(r)},GA=e=>{let t=e.find(r=>typeof r!="string"&&!G(r));if(t!==void 0)throw new TypeError(
|
|
1096
1110
|
`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or \
|
|
1097
|
-
Uint8Arrays: ${t}.`)}});var
|
|
1098
|
-
|
|
1099
|
-
1||e===2,
|
|
1100
|
-
|
|
1101
|
-
verboseInfo:r})}});import{writeFileSync as
|
|
1102
|
-
|
|
1103
|
-
{length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>
|
|
1104
|
-
isMaxBuffer:n,verboseInfo:o},r)),...i}},
|
|
1105
|
-
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:
|
|
1106
|
-
objectMode:
|
|
1107
|
-
fdNumber:r});
|
|
1108
|
-
void 0;try{return n.error===void 0&&
|
|
1109
|
-
return n.error=o,e}},
|
|
1110
|
-
if(r==="buffer")return{serializedResult:
|
|
1111
|
-
{serializedResult:s}},
|
|
1112
|
-
if(
|
|
1113
|
-
|
|
1114
|
-
i)?
|
|
1115
|
-
...e,...t]:[...e,
|
|
1116
|
-
!1,[r,n]},
|
|
1117
|
-
status==="rejected"?
|
|
1118
|
-
if(!
|
|
1119
|
-
"ETIMEDOUT",a=
|
|
1120
|
-
t,r)?new
|
|
1121
|
-
|
|
1122
|
-
options:l,fileDescriptors:u}=
|
|
1123
|
-
fileDescriptors:u,startTime:a});return
|
|
1124
|
-
e,t,r),a=
|
|
1125
|
-
escapedCommand:o,startTime:i,verboseInfo:s,options:u,fileDescriptors:
|
|
1126
|
-
ipcInput:t,detached:r,cancelSignal:n})=>{t&&
|
|
1127
|
-
l")},
|
|
1128
|
-
options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:s,startTime:a})=>{let c=
|
|
1129
|
-
options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:
|
|
1130
|
-
timedOut:
|
|
1131
|
-
|
|
1132
|
-
all:
|
|
1133
|
-
fileDescriptors:i,startTime:s})=>{try{
|
|
1134
|
-
escapedCommand:o,fileDescriptors:i,options:r,startTime:s,isSync:!0})}},
|
|
1135
|
-
buffer",maxBuffer:
|
|
1136
|
-
startTime:u})=>e===void 0?
|
|
1111
|
+
Uint8Arrays: ${t}.`)}});var $o,HA,qA,lh,uh,WA,dh,Ia=f(()=>{Je();X();_t();$e();$o=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&
|
|
1112
|
+
St(r,n)&&!ie.has(t)&&HA(n)&&(e.some(({type:o,value:i})=>o==="native"&&qA.has(i))||e.every(({type:o})=>ce.has(o))),HA=e=>e===
|
|
1113
|
+
1||e===2,qA=new Set(["pipe","overlapped"]),lh=async(e,t,r,n)=>{for await(let o of e)WA(t)||dh(o,r,n)},uh=(e,t,r)=>{for(let n of e)
|
|
1114
|
+
dh(n,t,r)},WA=e=>e._readableState.pipes.length>0,dh=(e,t,r)=>{let n=Nn(e);ye({type:"output",verboseMessage:n,fdNumber:t,
|
|
1115
|
+
verboseInfo:r})}});import{writeFileSync as YA,appendFileSync as KA}from"node:fs";var fh,JA,XA,ZA,QA,ev,ph=f(()=>{Ia();ko();xo();oe();X();Qe();
|
|
1116
|
+
fh=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.from(
|
|
1117
|
+
{length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>JA({result:c,fileDescriptors:e,fdNumber:l,state:i,outputFiles:s,
|
|
1118
|
+
isMaxBuffer:n,verboseInfo:o},r)),...i}},JA=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
1119
|
+
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:p})=>{if(e===null)return;let d=Xp(e,i,p),m=ve(d),{stdioItems:h,
|
|
1120
|
+
objectMode:y}=t[r],w=XA([m],h,c,n),{serializedResult:g,finalResult:b=g}=ZA({chunks:w,objectMode:y,encoding:c,lines:l,stripFinalNewline:u,
|
|
1121
|
+
fdNumber:r});QA({serializedResult:g,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:y});let E=a[r]?b:
|
|
1122
|
+
void 0;try{return n.error===void 0&&ev(g,h,o),E}catch(S){return n.error=S,E}},XA=(e,t,r,n)=>{try{return No(e,t,r,!1)}catch(o){
|
|
1123
|
+
return n.error=o,e}},ZA=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
1124
|
+
if(r==="buffer")return{serializedResult:ar(e)};let s=Uu(e,r);return n[i]?{serializedResult:s,finalResult:Sa(s,!o[i],t)}:
|
|
1125
|
+
{serializedResult:s}},QA=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
1126
|
+
if(!$o({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=Sa(e,!1,s);try{uh(a,t,n)}catch(c){r.error??=c}},
|
|
1127
|
+
ev=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>Ao.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(
|
|
1128
|
+
i)?KA(n,e):(r.add(i),YA(n,e))}}});var mh,hh=f(()=>{oe();_r();mh=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[
|
|
1129
|
+
...e,...t]:[...e,Ce(t,r,"all")]:Array.isArray(t)?[Ce(e,r,"all"),...t]:G(e)&&G(t)?gs([e,t]):`${e}${t}`}});import{once as Ra}from"node:events";var gh,tv,yh,wh,rv,xa,Pa=f(()=>{Ye();gh=async(e,t)=>{let[r,n]=await tv(e);return t.isForcefullyTerminated??=
|
|
1130
|
+
!1,[r,n]},tv=async e=>{let[t,r]=await Promise.allSettled([Ra(e,"spawn"),Ra(e,"exit")]);return t.status==="rejected"?[]:r.
|
|
1131
|
+
status==="rejected"?yh(e):r.value},yh=async e=>{try{return await Ra(e,"exit")}catch{return yh(e)}},wh=async e=>{let[t,r]=await e;
|
|
1132
|
+
if(!rv(t,r)&&xa(t,r))throw new pe;return[t,r]},rv=(e,t)=>e===void 0&&t===void 0,xa=(e,t)=>e!==0||t!==null});var bh,nv,Eh=f(()=>{Ye();Qe();Pa();bh=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=nv(e,t,r),s=i?.code===
|
|
1133
|
+
"ETIMEDOUT",a=Jp(i,n,o);return{resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},nv=(e,t,r)=>e!==void 0?e:xa(
|
|
1134
|
+
t,r)?new pe:void 0});import{spawnSync as ov}from"node:child_process";var Sh,iv,sv,av,Mo,cv,lv,uv,dv,_h=f(()=>{As();Qs();ea();Sr();_o();qm();_r();
|
|
1135
|
+
ch();ph();Qe();hh();Eh();Sh=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,
|
|
1136
|
+
options:l,fileDescriptors:u}=iv(e,t,r),p=cv({file:n,commandArguments:o,options:l,command:i,escapedCommand:s,verboseInfo:c,
|
|
1137
|
+
fileDescriptors:u,startTime:a});return kt(p,c,l)},iv=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=Mn(
|
|
1138
|
+
e,t,r),a=sv(r),{file:c,commandArguments:l,options:u}=co(e,t,a);av(u);let p=Gm(u,s);return{file:c,commandArguments:l,command:n,
|
|
1139
|
+
escapedCommand:o,startTime:i,verboseInfo:s,options:u,fileDescriptors:p}},sv=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,av=({ipc:e,
|
|
1140
|
+
ipcInput:t,detached:r,cancelSignal:n})=>{t&&Mo("ipcInput"),e&&Mo("ipc: true"),r&&Mo("detached: true"),n&&Mo("cancelSigna\
|
|
1141
|
+
l")},Mo=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},cv=({file:e,commandArguments:t,
|
|
1142
|
+
options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:s,startTime:a})=>{let c=lv({file:e,commandArguments:t,
|
|
1143
|
+
options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:p,
|
|
1144
|
+
timedOut:d,isMaxBuffer:m}=bh(c,r),{output:h,error:y=l}=fh({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:m,verboseInfo:i}),
|
|
1145
|
+
w=h.map((b,E)=>Ce(b,r,E)),g=Ce(mh(h,r),r,"all");return dv({error:y,exitCode:u,signal:p,timedOut:d,isMaxBuffer:m,stdio:w,
|
|
1146
|
+
all:g,options:r,command:n,escapedCommand:o,startTime:a})},lv=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,
|
|
1147
|
+
fileDescriptors:i,startTime:s})=>{try{ah(i,r);let a=uv(r);return ov(...lo(e,t,a))}catch(a){return Nt({error:a,command:n,
|
|
1148
|
+
escapedCommand:o,fileDescriptors:i,options:r,startTime:s,isSync:!0})}},uv=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"\
|
|
1149
|
+
buffer",maxBuffer:Eo(t)}),dv=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:l,
|
|
1150
|
+
startTime:u})=>e===void 0?So({command:c,escapedCommand:l,stdio:i,all:s,ipcOutput:[],options:a,startTime:u}):Er({error:e,
|
|
1137
1151
|
command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,
|
|
1138
|
-
signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as
|
|
1139
|
-
ipc:n},{reference:o=!0,filter:i}={})=>(
|
|
1140
|
-
channel:t,isSubprocess:r,filter:i,reference:o})),
|
|
1141
|
-
|
|
1142
|
-
e),a}finally{s.abort(),
|
|
1143
|
-
for await(let[n]of
|
|
1144
|
-
|
|
1145
|
-
isSubprocess:r,ipc:n},{reference:o=!0}={})=>
|
|
1146
|
-
|
|
1147
|
-
ipc:n,isConnected:
|
|
1148
|
-
controller:a,state:c}),
|
|
1149
|
-
|
|
1150
|
-
controller:r,state:n})=>{try{let[o]=await
|
|
1151
|
-
anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,state:s,reference:a}){try{for await(let[c]of
|
|
1152
|
-
r,"message",{signal:i.signal}))
|
|
1153
|
-
if(e)throw e}});import
|
|
1154
|
-
()=>{let e=
|
|
1155
|
-
isSubprocess:t,ipc:r})}},
|
|
1156
|
-
getOneMessage:
|
|
1157
|
-
channel:e.channel,isSubprocess:t,ipc:r})})});import{ChildProcess as
|
|
1158
|
-
var
|
|
1159
|
-
verboseInfo:s})=>{
|
|
1160
|
-
escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:!1}),l=
|
|
1161
|
-
let r=
|
|
1162
|
-
all:s,stdio:a})},
|
|
1163
|
-
{read(){},write(){}}),
|
|
1164
|
-
Writable as
|
|
1165
|
-
optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${
|
|
1152
|
+
signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as Ca,on as fv}from"node:events";var Th,pv,mv,hv,gv,Oh=f(()=>{It();hr();mr();Th=({anyProcess:e,channel:t,isSubprocess:r,
|
|
1153
|
+
ipc:n},{reference:o=!0,filter:i}={})=>(At({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:to(e)}),pv({anyProcess:e,
|
|
1154
|
+
channel:t,isSubprocess:r,filter:i,reference:o})),pv=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{
|
|
1155
|
+
Yn(t,o);let i=De(e,t,r),s=new AbortController;try{return await Promise.race([mv(i,n,s),hv(i,r,s),gv(i,r,s)])}catch(a){throw vt(
|
|
1156
|
+
e),a}finally{s.abort(),Kn(t,o)}},mv=async(e,t,{signal:r})=>{if(t===void 0){let[n]=await Ca(e,"message",{signal:r});return n}
|
|
1157
|
+
for await(let[n]of fv(e,"message",{signal:r}))if(t(n))return n},hv=async(e,t,{signal:r})=>{await Ca(e,"disconnect",{signal:r}),
|
|
1158
|
+
Mf(t)},gv=async(e,t,{signal:r})=>{let[n]=await Ca(e,"strict:error",{signal:r});throw Gn(n,t)}});import{once as vh,on as yv}from"node:events";var Ih,Na,wv,bv,Ev,Ah,ka=f(()=>{It();hr();mr();Ih=({anyProcess:e,channel:t,
|
|
1159
|
+
isSubprocess:r,ipc:n},{reference:o=!0}={})=>Na({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),
|
|
1160
|
+
Na=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{At({methodName:"getEachMessage",isSubprocess:r,
|
|
1161
|
+
ipc:n,isConnected:to(e)}),Yn(t,i);let s=De(e,t,r),a=new AbortController,c={};return wv(e,s,a),bv({ipcEmitter:s,isSubprocess:r,
|
|
1162
|
+
controller:a,state:c}),Ev({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,controller:a,state:c,reference:i})},
|
|
1163
|
+
wv=async(e,t,r)=>{try{await vh(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},bv=async({ipcEmitter:e,isSubprocess:t,
|
|
1164
|
+
controller:r,state:n})=>{try{let[o]=await vh(e,"strict:error",{signal:r.signal});n.error=Gn(o,t),r.abort()}catch{}},Ev=async function*({
|
|
1165
|
+
anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,state:s,reference:a}){try{for await(let[c]of yv(
|
|
1166
|
+
r,"message",{signal:i.signal}))Ah(s),yield c}catch{Ah(s)}finally{i.abort(),Kn(t,a),n||vt(e),o&&await e}},Ah=({error:e})=>{
|
|
1167
|
+
if(e)throw e}});import Rh from"node:process";var xh,Ph,Ch,$a=f(()=>{so();Oh();ka();Qn();xh=(e,{ipc:t})=>{Object.assign(e,Ch(e,!1,t))},Ph=
|
|
1168
|
+
()=>{let e=Rh,t=!0,r=Rh.channel!==void 0;return{...Ch(e,t,r),getCancelSignal:lp.bind(void 0,{anyProcess:e,channel:e.channel,
|
|
1169
|
+
isSubprocess:t,ipc:r})}},Ch=(e,t,r)=>({sendMessage:io.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),
|
|
1170
|
+
getOneMessage:Th.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:Ih.bind(void 0,{anyProcess:e,
|
|
1171
|
+
channel:e.channel,isSubprocess:t,ipc:r})})});import{ChildProcess as Sv}from"node:child_process";import{PassThrough as _v,Readable as Tv,Writable as Ov,Duplex as Av}from"node:stream";
|
|
1172
|
+
var Nh,vv,Or,Iv,Rv,xv,Pv,kh=f(()=>{Io();Sr();_o();Nh=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,
|
|
1173
|
+
verboseInfo:s})=>{wa(n);let a=new Sv;vv(a,n),Object.assign(a,{readable:Iv,writable:Rv,duplex:xv});let c=Nt({error:e,command:t,
|
|
1174
|
+
escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:!1}),l=Pv(c,s,o);return{subprocess:a,promise:l}},vv=(e,t)=>{
|
|
1175
|
+
let r=Or(),n=Or(),o=Or(),i=Array.from({length:t.length-3},Or),s=Or(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,
|
|
1176
|
+
all:s,stdio:a})},Or=()=>{let e=new _v;return e.end(),e},Iv=()=>new Tv({read(){}}),Rv=()=>new Ov({write(){}}),xv=()=>new Av(
|
|
1177
|
+
{read(){},write(){}}),Pv=async(e,t,r)=>kt(e,t,r)});import{createReadStream as $h,createWriteStream as Mh}from"node:fs";import{Buffer as Cv}from"node:buffer";import{Readable as Ar,
|
|
1178
|
+
Writable as Nv,Duplex as kv}from"node:stream";var Dh,vr,Lh,$v,jh=f(()=>{ko();Io();X();Dh=(e,t)=>vo($v,e,t,!1),vr=({type:e,
|
|
1179
|
+
optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${je[e]}.`)},Lh={fileNumber:vr,generator:va,asyncGenerator:va,
|
|
1166
1180
|
nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let n=t||
|
|
1167
|
-
r;return{stream:
|
|
1168
|
-
fileUrl:({value:e})=>({stream
|
|
1169
|
-
e)}),iterable:({value:e})=>({stream:
|
|
1170
|
-
stream:
|
|
1171
|
-
e)}),filePath:({value:{file:e,append:t}})=>({stream:
|
|
1172
|
-
e)}),iterable:
|
|
1173
|
-
finished as
|
|
1174
|
-
t \`${typeof e}\`.`);for(let o of e)
|
|
1175
|
-
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var
|
|
1176
|
-
|
|
1177
|
-
return Math.max(...r)},
|
|
1178
|
-
if(
|
|
1181
|
+
r;return{stream:kv.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},$v={input:{...Lh,
|
|
1182
|
+
fileUrl:({value:e})=>({stream:$h(e)}),filePath:({value:{file:e}})=>({stream:$h(e)}),webStream:({value:e})=>({stream:Ar.fromWeb(
|
|
1183
|
+
e)}),iterable:({value:e})=>({stream:Ar.from(e)}),asyncIterable:({value:e})=>({stream:Ar.from(e)}),string:({value:e})=>({
|
|
1184
|
+
stream:Ar.from(e)}),uint8Array:({value:e})=>({stream:Ar.from(Cv.from(e))})},output:{...Lh,fileUrl:({value:e})=>({stream:Mh(
|
|
1185
|
+
e)}),filePath:({value:{file:e,append:t}})=>({stream:Mh(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:Nv.fromWeb(
|
|
1186
|
+
e)}),iterable:vr,asyncIterable:vr,string:vr,uint8Array:vr}}});import{on as Mv,once as Bh}from"node:events";import{PassThrough as Lv,getDefaultHighWaterMark as Dv}from"node:stream";import{
|
|
1187
|
+
finished as zh}from"node:stream/promises";function rt(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, go\
|
|
1188
|
+
t \`${typeof e}\`.`);for(let o of e)La(o);let t=e.some(({readableObjectMode:o})=>o),r=jv(e,t),n=new Ma({objectMode:t,writableHighWaterMark:r,
|
|
1189
|
+
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var jv,Ma,Bv,Uv,Fv,La,zv,Vv,Gv,Hv,qv,Vh,Gh,Da,Hh,Wv,Lo,Uh,Fh,
|
|
1190
|
+
Do=f(()=>{jv=(e,t)=>{if(e.length===0)return Dv(t);let r=e.filter(({readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);
|
|
1191
|
+
return Math.max(...r)},Ma=class extends Lv{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){
|
|
1192
|
+
if(La(t),this.#t.has(t))return;this.#t.add(t),this.#n??=Bv(this,this.#t,this.#i);let r=zv({passThroughStream:this,stream:t,
|
|
1179
1193
|
streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){
|
|
1180
|
-
if(
|
|
1181
|
-
|
|
1182
|
-
e,-
|
|
1183
|
-
for await(let[o]of
|
|
1184
|
-
`Expected a readable stream, got: \`${typeof e}\`.`)},
|
|
1185
|
-
onFinished:i,unpipeEvent:s})=>{
|
|
1186
|
-
stream:t,streams:r,ended:n,aborted:o,controller:a}),
|
|
1187
|
-
a.abort(),
|
|
1188
|
-
await e,r.aborted||
|
|
1189
|
-
controller:{signal:i}})=>{try{await
|
|
1190
|
-
aborted||!r.has(t))return;
|
|
1191
|
-
signal:i}})=>{if(await
|
|
1192
|
-
|
|
1193
|
-
e.writable)&&e.destroy()},
|
|
1194
|
-
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},
|
|
1195
|
-
|
|
1196
|
-
e.end()},
|
|
1197
|
-
e.readable&&e.destroy()}});var
|
|
1198
|
-
entries(t)){for(let{stream:a}of i.filter(({type:c})=>
|
|
1199
|
-
has(c)))
|
|
1200
|
-
length===1?i[0]:
|
|
1201
|
-
t),e.stdio[n]=t},
|
|
1202
|
-
if(t===void 0)return;
|
|
1203
|
-
signal:t})=>{
|
|
1204
|
-
VTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&
|
|
1205
|
-
"SIGPOLL","SIGPWR","SIGSTKFLT")});var
|
|
1194
|
+
if(La(t),!this.#t.has(t))return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},
|
|
1195
|
+
Bv=async(e,t,r)=>{Lo(e,Uh);let n=new AbortController;try{await Promise.race([Uv(e,n),Fv(e,t,r,n)])}finally{n.abort(),Lo(
|
|
1196
|
+
e,-Uh)}},Uv=async(e,{signal:t})=>{try{await zh(e,{signal:t,cleanup:!0})}catch(r){throw Vh(e,r),r}},Fv=async(e,t,r,{signal:n})=>{
|
|
1197
|
+
for await(let[o]of Mv(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},La=e=>{if(typeof e?.pipe!="function")throw new TypeError(
|
|
1198
|
+
`Expected a readable stream, got: \`${typeof e}\`.`)},zv=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
1199
|
+
onFinished:i,unpipeEvent:s})=>{Lo(e,Fh);let a=new AbortController;try{await Promise.race([Vv(i,t,a),Gv({passThroughStream:e,
|
|
1200
|
+
stream:t,streams:r,ended:n,aborted:o,controller:a}),Hv({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{
|
|
1201
|
+
a.abort(),Lo(e,-Fh)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?Da(e):qv(e))},Vv=async(e,t,{signal:r})=>{try{
|
|
1202
|
+
await e,r.aborted||Da(t)}catch(n){r.aborted||Vh(t,n)}},Gv=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
1203
|
+
controller:{signal:i}})=>{try{await zh(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.
|
|
1204
|
+
aborted||!r.has(t))return;Gh(s)?o.add(t):Hh(e,s)}},Hv=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{
|
|
1205
|
+
signal:i}})=>{if(await Bh(e,o,{signal:i}),!e.readable)return Bh(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},
|
|
1206
|
+
qv=e=>{e.writable&&e.end()},Vh=(e,t)=>{Gh(t)?Da(e):Hh(e,t)},Gh=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Da=e=>{(e.readable||
|
|
1207
|
+
e.writable)&&e.destroy()},Hh=(e,t)=>{e.destroyed||(e.once("error",Wv),e.destroy(t))},Wv=()=>{},Lo=(e,t)=>{let r=e.getMaxListeners();
|
|
1208
|
+
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},Uh=2,Fh=1});import{finished as qh}from"node:stream/promises";var Mt,Yv,ja,Kv,Ba,jo=f(()=>{Ie();Mt=(e,t)=>{e.pipe(t),Yv(e,t),Kv(e,t)},
|
|
1209
|
+
Yv=async(e,t)=>{if(!(fe(e)||fe(t))){try{await qh(e,{cleanup:!0,readable:!0,writable:!1})}catch{}ja(t)}},ja=e=>{e.writable&&
|
|
1210
|
+
e.end()},Kv=async(e,t)=>{if(!(fe(e)||fe(t))){try{await qh(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Ba(e)}},Ba=e=>{
|
|
1211
|
+
e.readable&&e.destroy()}});var Wh,Jv,Xv,Zv,Qv,eI,Yh=f(()=>{Do();Ie();Wn();X();jo();Wh=(e,t,r)=>{let n=new Map;for(let[o,{stdioItems:i,direction:s}]of Object.
|
|
1212
|
+
entries(t)){for(let{stream:a}of i.filter(({type:c})=>ce.has(c)))Jv(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!ce.
|
|
1213
|
+
has(c)))Zv({subprocess:e,stream:a,direction:s,fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.
|
|
1214
|
+
length===1?i[0]:rt(i);Mt(s,o)}},Jv=(e,t,r,n)=>{r==="output"?Mt(e.stdio[n],t):Mt(t,e.stdio[n]);let o=Xv[n];o!==void 0&&(e[o]=
|
|
1215
|
+
t),e.stdio[n]=t},Xv=["stdin","stdout","stderr"],Zv=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{
|
|
1216
|
+
if(t===void 0)return;Qv(t,i);let[s,a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},Qv=(e,{
|
|
1217
|
+
signal:t})=>{fe(e)&&Ke(e,eI,t)},eI=2});var nt,Kh=f(()=>{nt=[];nt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&nt.push("SIGALRM","SIGABRT","SIG\
|
|
1218
|
+
VTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&nt.push("SIGIO",
|
|
1219
|
+
"SIGPOLL","SIGPWR","SIGSTKFLT")});var Bo,Ua,Fa,tI,za,Uo,rI,Va,Ga,Ha,Jh,UU,FU,Xh=f(()=>{Kh();Bo=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="funct\
|
|
1206
1220
|
ion"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="functi\
|
|
1207
|
-
on"&&typeof e.pid=="number"&&typeof e.on=="function",
|
|
1208
|
-
bind(Object),
|
|
1209
|
-
if(
|
|
1221
|
+
on"&&typeof e.pid=="number"&&typeof e.on=="function",Ua=Symbol.for("signal-exit emitter"),Fa=globalThis,tI=Object.defineProperty.
|
|
1222
|
+
bind(Object),za=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){
|
|
1223
|
+
if(Fa[Ua])return Fa[Ua];tI(Fa,Ua,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(
|
|
1210
1224
|
r)}removeListener(t,r){let n=this.listeners[t],o=n.indexOf(r);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,r,n){
|
|
1211
1225
|
if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let i of this.listeners[t])o=i(r,n)===!0||o;return t==="exit"&&
|
|
1212
|
-
(o=this.emit("afterExit",r,n)||o),o}}
|
|
1213
|
-
return e.unload()}}),
|
|
1214
|
-
"win32"?"SIGINT":"SIGHUP";#r=new
|
|
1226
|
+
(o=this.emit("afterExit",r,n)||o),o}},Uo=class{},rI=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){
|
|
1227
|
+
return e.unload()}}),Va=class extends Uo{onExit(){return()=>{}}load(){}unload(){}},Ga=class extends Uo{#t=Ha.platform===
|
|
1228
|
+
"win32"?"SIGINT":"SIGHUP";#r=new za;#e;#n;#i;#o={};#s=!1;constructor(t){super(),this.#e=t,this.#o={};for(let r of nt)this.#o[r]=
|
|
1215
1229
|
()=>{let n=this.#e.listeners(r),{count:o}=this.#r,i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.
|
|
1216
1230
|
count=="number"&&(o+=i.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#r.emit("exit",null,r),a=r===
|
|
1217
|
-
"SIGHUP"?this.#t:r;s||t.kill(t.pid,a)}};this.#i=t.reallyExit,this.#n=t.emit}onExit(t,r){if(!
|
|
1231
|
+
"SIGHUP"?this.#t:r;s||t.kill(t.pid,a)}};this.#i=t.reallyExit,this.#n=t.emit}onExit(t,r){if(!Bo(this.#e))return()=>{};this.#s===
|
|
1218
1232
|
!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,t),()=>{this.#r.removeListener(n,t),this.#r.listeners.
|
|
1219
1233
|
exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;
|
|
1220
|
-
for(let t of
|
|
1221
|
-
t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,
|
|
1234
|
+
for(let t of nt)try{let r=this.#o[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(t,...r),this.#e.reallyExit=
|
|
1235
|
+
t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,nt.forEach(t=>{let r=this.#o[t];if(!r)throw new Error("Listener not defined\
|
|
1222
1236
|
for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#i,this.#r.count-=
|
|
1223
|
-
1)}#a(t){return
|
|
1224
|
-
exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&
|
|
1225
|
-
call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},
|
|
1226
|
-
process,{onExit:
|
|
1227
|
-
r)return;let o=
|
|
1228
|
-
{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=
|
|
1229
|
-
e,l),{options:m,fileDescriptors:h}=
|
|
1230
|
-
destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:i}},
|
|
1231
|
-
pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=
|
|
1232
|
-
return{destinationError:n}}},
|
|
1233
|
-
"string"||r instanceof URL||
|
|
1234
|
-
) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,i,s]=
|
|
1235
|
-
|
|
1237
|
+
1)}#a(t){return Bo(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.
|
|
1238
|
+
exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&Bo(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.
|
|
1239
|
+
call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},Ha=globalThis.
|
|
1240
|
+
process,{onExit:Jh,load:UU,unload:FU}=rI(Bo(Ha)?new Ga(Ha):new Va)});import{addAbortListener as nI}from"node:events";var Zh,Qh=f(()=>{Xh();Zh=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||
|
|
1241
|
+
r)return;let o=Jh(()=>{e.kill()});nI(n,()=>{o()})}});var tg,oI,iI,eg,sI,rg=f(()=>{hs();$n();Le();bt();tg=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=kn(),
|
|
1242
|
+
{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=oI(r,n,o),{sourceStream:p,sourceError:d}=sI(
|
|
1243
|
+
e,l),{options:m,fileDescriptors:h}=be.get(e);return{sourcePromise:t,sourceStream:p,sourceOptions:m,sourceError:d,destination:s,
|
|
1244
|
+
destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:i}},oI=(e,t,r)=>{try{let{destination:n,
|
|
1245
|
+
pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=iI(e,t,...r),a=qn(n,i);return{destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){
|
|
1246
|
+
return{destinationError:n}}},iI=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(eg,e)(r,...n),pipeOptions:e};if(typeof r==
|
|
1247
|
+
"string"||r instanceof URL||ps(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options\
|
|
1248
|
+
) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,i,s]=_n(r,...n);return{destination:t(
|
|
1249
|
+
eg)(o,i,s),pipeOptions:s}}if(be.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`comman\
|
|
1236
1250
|
d` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(
|
|
1237
|
-
`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},
|
|
1238
|
-
...e,stdin:"pipe",piped:!0}}),
|
|
1239
|
-
sourceOptions:i,startTime:s})=>{let a=
|
|
1240
|
-
throw
|
|
1241
|
-
destinationError:n})=>{if(t!==void 0&&n!==void 0)return n;if(n!==void 0)return
|
|
1242
|
-
({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>
|
|
1243
|
-
startTime:n,isSync:!1}),
|
|
1244
|
-
n)||s.pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s}});import{finished as
|
|
1245
|
-
has(t)?
|
|
1246
|
-
t,r),r},
|
|
1247
|
-
|
|
1248
|
-
mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{await
|
|
1249
|
-
anceled by `unpipeSignal` option.");throw
|
|
1250
|
-
...e.boundOptions,...t[0]}});let{destination:r,...n}=
|
|
1251
|
-
{...e,source:r,sourcePromise:o,boundOptions:{}}),o},
|
|
1252
|
-
destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=
|
|
1253
|
-
sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let
|
|
1254
|
-
try{let
|
|
1255
|
-
startTime:l})])}finally{
|
|
1256
|
-
|
|
1257
|
-
let s=new AbortController;return
|
|
1258
|
-
shouldSplit:!e.readableObjectMode,preserveNewlines:i})},
|
|
1259
|
-
onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;
|
|
1260
|
-
!i;return
|
|
1261
|
-
|
|
1262
|
-
shouldSplit:i,preserveNewlines:s})=>{let a=
|
|
1263
|
-
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},
|
|
1264
|
-
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=
|
|
1265
|
-
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*
|
|
1266
|
-
yield*
|
|
1267
|
-
Boolean)});import{setImmediate as
|
|
1251
|
+
`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},eg=({options:e})=>({options:{
|
|
1252
|
+
...e,stdin:"pipe",piped:!0}}),sI=(e,t)=>{try{return{sourceStream:xt(e,t)}}catch(r){return{sourceError:r}}}});var og,aI,qa,ng,Wa=f(()=>{Sr();jo();og=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,
|
|
1253
|
+
sourceOptions:i,startTime:s})=>{let a=aI({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)
|
|
1254
|
+
throw qa({error:a,fileDescriptors:o,sourceOptions:i,startTime:s})},aI=({sourceStream:e,sourceError:t,destinationStream:r,
|
|
1255
|
+
destinationError:n})=>{if(t!==void 0&&n!==void 0)return n;if(n!==void 0)return Ba(e),n;if(t!==void 0)return ja(r),t},qa=
|
|
1256
|
+
({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>Nt({error:e,command:ng,escapedCommand:ng,fileDescriptors:t,options:r,
|
|
1257
|
+
startTime:n,isSync:!1}),ng="source.pipe(destination)"});var ig,sg=f(()=>{ig=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:i,value:s=i}]=await e;if(s.pipedFrom.includes(
|
|
1258
|
+
n)||s.pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s}});import{finished as cI}from"node:stream/promises";var ag,lI,uI,dI,Fo,fI,pI,cg=f(()=>{Do();Wn();jo();ag=(e,t,r)=>{let n=Fo.
|
|
1259
|
+
has(t)?uI(e,t):lI(e,t);return Ke(e,fI,r.signal),Ke(t,pI,r.signal),dI(t),n},lI=(e,t)=>{let r=rt([e]);return Mt(r,t),Fo.set(
|
|
1260
|
+
t,r),r},uI=(e,t)=>{let r=Fo.get(t);return r.add(e),r},dI=async e=>{try{await cI(e,{cleanup:!0,readable:!1,writable:!0})}catch{}
|
|
1261
|
+
Fo.delete(e)},Fo=new WeakMap,fI=2,pI=1});import{aborted as mI}from"node:util";var lg,hI,ug=f(()=>{Wa();lg=(e,t)=>e===void 0?[]:[hI(e,t)],hI=async(e,{sourceStream:t,
|
|
1262
|
+
mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{await mI(e,t),await r.remove(t);let s=new Error("Pipe c\
|
|
1263
|
+
anceled by `unpipeSignal` option.");throw qa({error:s,fileDescriptors:n,sourceOptions:o,startTime:i})}});var zo,gI,yI,dg=f(()=>{Ae();rg();Wa();sg();cg();ug();zo=(e,...t)=>{if(F(t[0]))return zo.bind(void 0,{...e,boundOptions:{
|
|
1264
|
+
...e.boundOptions,...t[0]}});let{destination:r,...n}=tg(e,...t),o=gI({...n,destination:r});return o.pipe=zo.bind(void 0,
|
|
1265
|
+
{...e,source:r,sourcePromise:o,boundOptions:{}}),o},gI=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,
|
|
1266
|
+
destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=yI(e,o);og({
|
|
1267
|
+
sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let p=new AbortController;
|
|
1268
|
+
try{let d=ag(t,i,p);return await Promise.race([ig(u),...lg(a,{sourceStream:t,mergedStream:d,sourceOptions:r,fileDescriptors:c,
|
|
1269
|
+
startTime:l})])}finally{p.abort()}},yI=(e,t)=>Promise.allSettled([e,t])});import{on as wI}from"node:events";import{getDefaultHighWaterMark as bI}from"node:stream";var Vo,EI,Ya,SI,pg,Ka,fg,_I,TI,
|
|
1270
|
+
Go=f(()=>{_a();xo();Aa();Vo=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{
|
|
1271
|
+
let s=new AbortController;return EI(t,s),pg({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,
|
|
1272
|
+
shouldSplit:!e.readableObjectMode,preserveNewlines:i})},EI=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Ya=({stream:e,
|
|
1273
|
+
onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;SI(t,s,e);let a=e.readableObjectMode&&
|
|
1274
|
+
!i;return pg({stream:e,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},
|
|
1275
|
+
SI=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},pg=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,
|
|
1276
|
+
shouldSplit:i,preserveNewlines:s})=>{let a=wI(e,"data",{signal:t.signal,highWaterMark:fg,highWatermark:fg});return _I({onStdoutChunk:a,
|
|
1277
|
+
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},Ka=bI(!0),fg=Ka,_I=async function*({
|
|
1278
|
+
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=TI({binary:r,shouldEncode:n,
|
|
1279
|
+
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*tt(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{
|
|
1280
|
+
yield*Tr(a)}},TI=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[Po(e,r,!t),Ro(e,o,!n,{})].filter(
|
|
1281
|
+
Boolean)});import{setImmediate as OI}from"node:timers/promises";var mg,AI,vI,II,Ja,hg,Xa=f(()=>{bo();oe();Ia();Go();Qe();_r();mg=async({
|
|
1268
1282
|
stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{
|
|
1269
|
-
let
|
|
1270
|
-
[
|
|
1271
|
-
all([
|
|
1272
|
-
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(
|
|
1273
|
-
verboseInfo:i,fdNumber:r}))return;let a=
|
|
1274
|
-
await
|
|
1275
|
-
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await
|
|
1276
|
-
await
|
|
1277
|
-
encoding:o,fdNumber:n}))}},
|
|
1278
|
-
e):e});import{finished as
|
|
1279
|
-
stopOnExit:o=!1}={})=>{let i=
|
|
1280
|
-
signal:s.signal})])}catch(a){i.stdinCleanedUp||
|
|
1281
|
-
let n={stdinCleanedUp:!1};return e===t&&
|
|
1282
|
-
...o)}},
|
|
1283
|
-
|
|
1284
|
-
all"&&e[t].direction==="input",
|
|
1285
|
-
streamInfo:a})=>e.stdio.map((c,l)=>
|
|
1286
|
-
stripFinalNewline:i,verboseInfo:s,streamInfo:a})),
|
|
1287
|
-
allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=
|
|
1288
|
-
|
|
1289
|
-
verboseInfo:c,streamInfo:l}),u]);return
|
|
1290
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>
|
|
1291
|
-
encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed
|
|
1283
|
+
let p=AI({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!o){await Promise.all(
|
|
1284
|
+
[vI(e),p]);return}let d=ba(c,r),m=Ya({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:d,allMixed:a}),[h]=await Promise.
|
|
1285
|
+
all([II({stream:e,iterable:m,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),p]);return h},AI=async({stream:e,onStreamEnd:t,
|
|
1286
|
+
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!$o({stdioItems:s[r]?.stdioItems,encoding:n,
|
|
1287
|
+
verboseInfo:i,fdNumber:r}))return;let a=Ya({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
1288
|
+
await lh(a,e,r,i)},vI=async e=>{await OI(),e.readableFlowing===null&&e.resume()},II=async({stream:e,stream:{readableObjectMode:t},
|
|
1289
|
+
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await ho(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(
|
|
1290
|
+
await go(r,{maxBuffer:i})):await wo(r,{maxBuffer:i})}catch(a){return hg(Wp({error:a,stream:e,readableObjectMode:t,lines:s,
|
|
1291
|
+
encoding:o,fdNumber:n}))}},Ja=async e=>{try{return await e}catch(t){return hg(t)}},hg=({bufferedData:e})=>ju(e)?new Uint8Array(
|
|
1292
|
+
e):e});import{finished as RI}from"node:stream/promises";var Ir,xI,PI,CI,NI,kI,Za,Ho,gg,qo=f(()=>{Ir=async(e,t,r,{isSameDirection:n,
|
|
1293
|
+
stopOnExit:o=!1}={})=>{let i=xI(e,r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],RI(e,{cleanup:!0,
|
|
1294
|
+
signal:s.signal})])}catch(a){i.stdinCleanedUp||NI(a,t,r,n)}finally{s.abort()}},xI=(e,{originalStreams:[t],subprocess:r})=>{
|
|
1295
|
+
let n={stdinCleanedUp:!1};return e===t&&PI(e,r,n),n},PI=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{CI(t,r),n.call(e,
|
|
1296
|
+
...o)}},CI=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},NI=(e,t,r,n)=>{if(!kI(e,t,r,n))throw e},
|
|
1297
|
+
kI=(e,t,r,n=!0)=>r.propagating?gg(e)||Ho(e):(r.propagating=!0,Za(r,t)===n?gg(e):Ho(e)),Za=({fileDescriptors:e},t)=>t!=="\
|
|
1298
|
+
all"&&e[t].direction==="input",Ho=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",gg=e=>e?.code==="EPIPE"});var yg,Qa,ec=f(()=>{Xa();qo();yg=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,
|
|
1299
|
+
streamInfo:a})=>e.stdio.map((c,l)=>Qa({stream:c,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,
|
|
1300
|
+
stripFinalNewline:i,verboseInfo:s,streamInfo:a})),Qa=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,
|
|
1301
|
+
allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=Ir(e,t,l);if(Za(l,t)){await u;return}let[
|
|
1302
|
+
p]=await Promise.all([mg({stream:e,onStreamEnd:u,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,
|
|
1303
|
+
verboseInfo:c,streamInfo:l}),u]);return p}});var wg,bg,$I,MI,tc=f(()=>{Do();ec();wg=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?rt([e,t].filter(Boolean)):void 0,bg=({subprocess:e,
|
|
1304
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>Qa({...$I(e,r),fdNumber:"all",
|
|
1305
|
+
encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:MI(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),$I=({stdout:e,
|
|
1292
1306
|
stderr:t,all:r},[,n,o])=>{let i=n||o;return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,
|
|
1293
|
-
buffer:i}}
|
|
1294
|
-
if(!n)return o;let s=
|
|
1295
|
-
ipc:n,shouldAwait:!1,reference:!0}))a&&(
|
|
1296
|
-
[e]),t)});import{once as
|
|
1297
|
-
|
|
1298
|
-
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:
|
|
1299
|
-
onInternalError:
|
|
1300
|
-
S=
|
|
1301
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:m,streamInfo:E}),
|
|
1302
|
-
maxBuffer:n,ipc:u,ipcOutput:
|
|
1303
|
-
Promise.all(S),
|
|
1304
|
-
controller:
|
|
1305
|
-
return
|
|
1306
|
-
|
|
1307
|
-
filter(({value:o,stream:i=o})=>
|
|
1308
|
-
has(o),stopOnExit:o==="native"}))),
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
return!n}});import{finished as
|
|
1312
|
-
e)}catch{}},
|
|
1313
|
-
|
|
1314
|
-
r)?e.destroy(r):t&&e.destroy()}});import{Readable as
|
|
1315
|
-
|
|
1316
|
-
let s=o||
|
|
1317
|
-
a,s),{read:
|
|
1318
|
-
read:
|
|
1319
|
-
encoding:l});return
|
|
1320
|
-
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},
|
|
1321
|
-
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:
|
|
1322
|
-
|
|
1323
|
-
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){
|
|
1324
|
-
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},
|
|
1325
|
-
readable:r,subprocess:n,subprocessStdin:o})=>{try{await
|
|
1326
|
-
await
|
|
1327
|
-
t,n))},
|
|
1328
|
-
|
|
1329
|
-
e,r,t),s=new
|
|
1330
|
-
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return
|
|
1331
|
-
r,n,"writableFinal"),i=
|
|
1332
|
-
(e,t,r)=>({write:
|
|
1333
|
-
|
|
1334
|
-
await
|
|
1335
|
-
r,t),await
|
|
1336
|
-
concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||
|
|
1337
|
-
waitReadableDestroy:l}=
|
|
1338
|
-
readableObjectMode:h,readableHighWaterMark:
|
|
1339
|
-
encoding:r,preserveNewlines:s}),b=new
|
|
1340
|
-
subprocess:e,waitReadableDestroy:l,waitWritableFinal:
|
|
1341
|
-
writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:m});return
|
|
1342
|
-
onStdoutDataDone:
|
|
1343
|
-
subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([
|
|
1344
|
-
subprocess:r,waitReadableDestroy:n},s),
|
|
1345
|
-
a=
|
|
1346
|
-
try{yield*e}finally{t.readable&&t.destroy(),await r}}});var
|
|
1347
|
-
encoding:t}),e.writable
|
|
1348
|
-
encoding:t}),e.iterable=
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:
|
|
1352
|
-
promise:m}=
|
|
1353
|
-
return
|
|
1354
|
-
|
|
1355
|
-
e,t,r),u=
|
|
1356
|
-
fileDescriptors:
|
|
1357
|
-
amed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},
|
|
1358
|
-
command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=
|
|
1359
|
-
fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;
|
|
1360
|
-
let u=[...c.stdio];
|
|
1361
|
-
context:
|
|
1362
|
-
originalStreams:u,command:i,escapedCommand:s,context:
|
|
1363
|
-
|
|
1364
|
-
context:c,onInternalError:l,controller:u})=>{let[
|
|
1365
|
-
fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let
|
|
1366
|
-
b=
|
|
1367
|
-
startTime:r});return
|
|
1368
|
-
escapedCommand:l,startTime:u})=>"error"in e?
|
|
1307
|
+
buffer:i}},MI=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode});var Eg,Sg,_g=f(()=>{_t();$e();Eg=e=>St(e,"ipc"),Sg=(e,t)=>{let r=Nn(e);ye({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})}});var Tg,Og,Ag=f(()=>{Qe();_g();xe();ka();Tg=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{
|
|
1308
|
+
if(!n)return o;let s=Eg(i),a=Re(t,"ipc"),c=Re(r,"ipc");for await(let l of Na({anyProcess:e,channel:e.channel,isSubprocess:!1,
|
|
1309
|
+
ipc:n,shouldAwait:!1,reference:!0}))a&&(Yp(e,o,c),o.push(l)),s&&Sg(l,i);return o},Og=async(e,t)=>(await Promise.allSettled(
|
|
1310
|
+
[e]),t)});import{once as LI}from"node:events";var vg,DI,jI,BI,Ig=f(()=>{Ze();Ys();Bs();Ws();Ie();X();Xa();Ag();Js();tc();ec();Pa();
|
|
1311
|
+
qo();vg=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
1312
|
+
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:p},context:d,verboseInfo:m,fileDescriptors:h,originalStreams:y,
|
|
1313
|
+
onInternalError:w,controller:g})=>{let b=gh(e,d),E={originalStreams:y,fileDescriptors:h,subprocess:e,exitPromise:b,propagating:!1},
|
|
1314
|
+
S=yg({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:m,streamInfo:E}),_=bg({subprocess:e,
|
|
1315
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:m,streamInfo:E}),T=[],I=Tg({subprocess:e,buffer:r,
|
|
1316
|
+
maxBuffer:n,ipc:u,ipcOutput:T,verboseInfo:m}),A=DI(y,e,E),P=jI(h,E);try{return await Promise.race([Promise.all([{},wh(b),
|
|
1317
|
+
Promise.all(S),_,I,bp(e,p),...A,...P]),w,BI(e,g),...mp(e,i,d,g),...$f({subprocess:e,cancelSignal:s,gracefulCancel:a,context:d,
|
|
1318
|
+
controller:g}),...fp({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:d,controller:g})])}catch(j){
|
|
1319
|
+
return d.terminationReason??="other",Promise.all([{error:j},b,Promise.all(S.map(B=>Ja(B))),Ja(_),Og(I,T),Promise.allSettled(
|
|
1320
|
+
A),Promise.allSettled(P)])}},DI=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Ir(n,o,r)),jI=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
1321
|
+
filter(({value:o,stream:i=o})=>he(i,{checkOpen:!1})&&!fe(i)).map(({type:o,value:i,stream:s=i})=>Ir(s,n,t,{isSameDirection:ce.
|
|
1322
|
+
has(o),stopOnExit:o==="native"}))),BI=async(e,{signal:t})=>{let[r]=await LI(e,"error",{signal:t});throw r}});var Rg,Rr,Lt,Wo=f(()=>{Rt();Rg=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),
|
|
1323
|
+
Rr=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),i=we();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},
|
|
1324
|
+
Lt=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);
|
|
1325
|
+
return!n}});import{finished as xg}from"node:stream/promises";var rc,Pg,nc,oc,Yo,Ko,ic=f(()=>{qo();rc=async e=>{if(e!==void 0)try{await nc(
|
|
1326
|
+
e)}catch{}},Pg=async e=>{if(e!==void 0)try{await oc(e)}catch{}},nc=async e=>{await xg(e,{cleanup:!0,readable:!1,writable:!0})},
|
|
1327
|
+
oc=async e=>{await xg(e,{cleanup:!0,readable:!0,writable:!1})},Yo=async(e,t)=>{if(await e,t)throw t},Ko=(e,t,r)=>{r&&!Ho(
|
|
1328
|
+
r)?e.destroy(r):t&&e.destroy()}});import{Readable as UI}from"node:stream";import{callbackify as FI}from"node:util";var Cg,sc,ac,cc,zI,lc,uc,Ng,dc=f(()=>{Je();
|
|
1329
|
+
Le();Go();Rt();Wo();ic();Cg=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{
|
|
1330
|
+
let s=o||ie.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sc(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:p}=ac(
|
|
1331
|
+
a,s),{read:d,onStdoutDataDone:m}=cc({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),h=new UI({
|
|
1332
|
+
read:d,destroy:FI(uc.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:p,objectMode:u,
|
|
1333
|
+
encoding:l});return lc({subprocessStdout:a,onStdoutDataDone:m,readable:h,subprocess:e}),h},sc=(e,t,r)=>{let n=xt(e,t),o=Rr(
|
|
1334
|
+
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},ac=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
1335
|
+
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Ka},
|
|
1336
|
+
cc=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=we(),s=Vo({subprocessStdout:e,subprocess:t,
|
|
1337
|
+
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){zI(this,s,i)},onStdoutDataDone:i}},zI=async(e,t,r)=>{
|
|
1338
|
+
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},lc=async({subprocessStdout:e,onStdoutDataDone:t,
|
|
1339
|
+
readable:r,subprocess:n,subprocessStdin:o})=>{try{await oc(e),await n,await rc(o),await t,r.readable&&r.push(null)}catch(i){
|
|
1340
|
+
await rc(o),Ng(r,i)}},uc=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await Lt(r,t)&&(Ng(e,n),await Yo(
|
|
1341
|
+
t,n))},Ng=(e,t)=>{Ko(e,e.readable,t)}});import{Writable as VI}from"node:stream";import{callbackify as kg}from"node:util";var $g,fc,pc,GI,HI,mc,hc,Mg,gc=f(()=>{Le();
|
|
1342
|
+
Wo();ic();$g=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=fc(
|
|
1343
|
+
e,r,t),s=new VI({...pc(n,e,o),destroy:kg(hc.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),
|
|
1344
|
+
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return mc(n,s),s},fc=(e,t,r)=>{let n=qn(e,t),o=Rr(
|
|
1345
|
+
r,n,"writableFinal"),i=Rr(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},pc=
|
|
1346
|
+
(e,t,r)=>({write:GI.bind(void 0,e),final:kg(HI.bind(void 0,e,t,r))}),GI=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},
|
|
1347
|
+
HI=async(e,t,r)=>{await Lt(r,t)&&(e.writable&&e.end(),await t)},mc=async(e,t,r)=>{try{await nc(e),t.writable&&t.end()}catch(n){
|
|
1348
|
+
await Pg(r),Mg(t,n)}},hc=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await Lt(
|
|
1349
|
+
r,t),await Lt(n,t)&&(Mg(e,o),await Yo(t,o))},Mg=(e,t)=>{Ko(e,e.writable,t)}});import{Duplex as qI}from"node:stream";import{callbackify as WI}from"node:util";var Lg,YI,Dg=f(()=>{Je();dc();gc();Lg=({subprocess:e,
|
|
1350
|
+
concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||ie.has(r),{subprocessStdout:c,
|
|
1351
|
+
waitReadableDestroy:l}=sc(e,n,t),{subprocessStdin:u,waitWritableFinal:p,waitWritableDestroy:d}=fc(e,o,t),{readableEncoding:m,
|
|
1352
|
+
readableObjectMode:h,readableHighWaterMark:y}=ac(c,a),{read:w,onStdoutDataDone:g}=cc({subprocessStdout:c,subprocess:e,binary:a,
|
|
1353
|
+
encoding:r,preserveNewlines:s}),b=new qI({read:w,...pc(u,e,p),destroy:WI(YI.bind(void 0,{subprocessStdout:c,subprocessStdin:u,
|
|
1354
|
+
subprocess:e,waitReadableDestroy:l,waitWritableFinal:p,waitWritableDestroy:d})),readableHighWaterMark:y,writableHighWaterMark:u.
|
|
1355
|
+
writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:m});return lc({subprocessStdout:c,
|
|
1356
|
+
onStdoutDataDone:g,readable:b,subprocess:e,subprocessStdin:u}),mc(u,b,c),b},YI=async({subprocessStdout:e,subprocessStdin:t,
|
|
1357
|
+
subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([uc({subprocessStdout:e,
|
|
1358
|
+
subprocess:r,waitReadableDestroy:n},s),hc({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},s)])}});var yc,KI,jg=f(()=>{Je();Le();Go();yc=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||ie.has(t),s=xt(e,r),
|
|
1359
|
+
a=Vo({subprocessStdout:s,subprocess:e,binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return KI(a,s,e)},KI=async function*(e,t,r){
|
|
1360
|
+
try{yield*e}finally{t.readable&&t.destroy(),await r}}});var Bg,Ug=f(()=>{Wo();dc();gc();Dg();jg();Bg=(e,{encoding:t})=>{let r=Rg();e.readable=Cg.bind(void 0,{subprocess:e,concurrentStreams:r,
|
|
1361
|
+
encoding:t}),e.writable=$g.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Lg.bind(void 0,{subprocess:e,concurrentStreams:r,
|
|
1362
|
+
encoding:t}),e.iterable=yc.bind(void 0,e,t),e[Symbol.asyncIterator]=yc.bind(void 0,e,t,{})}});var Fg,JI,XI,zg=f(()=>{Fg=(e,t)=>{for(let[r,n]of XI){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},
|
|
1363
|
+
JI=(async()=>{})().constructor.prototype,XI=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(JI,e)])});import{setMaxListeners as ZI}from"node:events";import{spawn as QI}from"node:child_process";var Vg,eR,tR,rR,nR,oR,Gg=f(()=>{
|
|
1364
|
+
bo();As();Qs();Le();ea();$a();Sr();_o();kh();jh();_r();Yh();zn();Qh();dg();tc();Ig();Ug();Rt();zg();Vg=(e,t,r,n)=>{let{file:o,
|
|
1365
|
+
commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:p}=eR(e,t,r),{subprocess:d,
|
|
1366
|
+
promise:m}=rR({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:p});
|
|
1367
|
+
return d.pipe=zo.bind(void 0,{source:d,sourcePromise:m,boundOptions:{},createNested:n}),Fg(d,m),be.set(d,{options:u,fileDescriptors:p}),
|
|
1368
|
+
d},eR=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=Mn(e,t,r),{file:a,commandArguments:c,options:l}=co(
|
|
1369
|
+
e,t,r),u=tR(l),p=Dh(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:u,
|
|
1370
|
+
fileDescriptors:p}},tR=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been ren\
|
|
1371
|
+
amed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},rR=({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,
|
|
1372
|
+
command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=QI(...lo(e,t,r))}catch(h){return Nh({error:h,command:i,escapedCommand:s,
|
|
1373
|
+
fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;ZI(Number.POSITIVE_INFINITY,l.signal);
|
|
1374
|
+
let u=[...c.stdio];Wh(c,a,l),Zh(c,r,l);let p={},d=we();c.kill=Nf.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:d,
|
|
1375
|
+
context:p,controller:l}),c.all=wg(c,r),Bg(c,r),xh(c,r);let m=nR({subprocess:c,options:r,startTime:n,verboseInfo:o,fileDescriptors:a,
|
|
1376
|
+
originalStreams:u,command:i,escapedCommand:s,context:p,onInternalError:d,controller:l});return{subprocess:c,promise:m}},
|
|
1377
|
+
nR=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,command:s,escapedCommand:a,
|
|
1378
|
+
context:c,onInternalError:l,controller:u})=>{let[p,[d,m],h,y,w]=await vg({subprocess:e,options:t,context:c,verboseInfo:n,
|
|
1379
|
+
fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let g=h.map((S,_)=>Ce(S,t,_)),
|
|
1380
|
+
b=Ce(y,t,"all"),E=oR({errorInfo:p,exitCode:d,signal:m,stdio:g,all:b,ipcOutput:w,context:c,options:t,command:s,escapedCommand:a,
|
|
1381
|
+
startTime:r});return kt(E,n,t)},oR=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,context:s,options:a,command:c,
|
|
1382
|
+
escapedCommand:l,startTime:u})=>"error"in e?Er({error:e.error,command:c,escapedCommand:l,timedOut:s.terminationReason===
|
|
1369
1383
|
"timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason===
|
|
1370
|
-
"gracefulCancel",isMaxBuffer:e.error instanceof
|
|
1371
|
-
all:o,ipcOutput:i,options:a,startTime:u,isSync:!1}):
|
|
1372
|
-
...e,...r}},
|
|
1373
|
-
deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==void 0&&n(i,o,t),i},
|
|
1374
|
-
boundOptions:r={},setBoundExeca:n,createNested:o},i,...s)=>{if(
|
|
1375
|
-
options:l,isSync:u}=
|
|
1376
|
-
|
|
1377
|
-
...r],[s,a,c]=
|
|
1378
|
-
options:l});return{file:u,commandArguments:
|
|
1379
|
-
|
|
1380
|
-
.`);let[r,...n]=
|
|
1381
|
-
ust be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(
|
|
1382
|
-
o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},
|
|
1383
|
-
e),isSync:!0}),
|
|
1384
|
-
{stdin:"inherit"}:{},
|
|
1385
|
-
|
|
1386
|
-
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:
|
|
1387
|
-
let m=
|
|
1388
|
-
`)).trim();return{code:
|
|
1389
|
-
Number(s):null,signal:
|
|
1390
|
-
ct"&&!Array.isArray(
|
|
1391
|
-
d",r={}){let n=
|
|
1392
|
-
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var
|
|
1393
|
-
async function
|
|
1394
|
-
(t,r)=>{let n=!1,o=(i,s)=>{n||(n=!0,i(s))};e.once?.("spawn",()=>o(t)),e.once?.("error",i=>o(r,i))})}async function
|
|
1395
|
-
cwd:t="",env:r={}}={}){let n=null;try{n=await
|
|
1396
|
-
e.command,e.args,{cwd:t||void 0,detached:!0,env:r,stdio:o});await
|
|
1397
|
-
pid:Number(i.pid)}),i.once?.("exit",()=>{
|
|
1398
|
-
{execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:i.pid})}catch(o){return
|
|
1384
|
+
"gracefulCancel",isMaxBuffer:e.error instanceof Ee,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,
|
|
1385
|
+
all:o,ipcOutput:i,options:a,startTime:u,isSync:!1}):So({command:c,escapedCommand:l,stdio:n,all:o,ipcOutput:i,options:a,startTime:u})});var Jo,iR,sR,Hg=f(()=>{Ae();xe();Jo=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,iR(n,e[n],o)]));return{
|
|
1386
|
+
...e,...r}},iR=(e,t,r)=>sR.has(e)&&F(t)&&F(r)?{...t,...r}:r,sR=new Set(["env",...Es])});var Be,aR,cR,qg=f(()=>{Ae();hs();qu();_h();Gg();Hg();Be=(e,t,r,n)=>{let o=(s,a,c)=>Be(s,a,r,c),i=(...s)=>aR({mapArguments:e,
|
|
1387
|
+
deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==void 0&&n(i,o,t),i},aR=({mapArguments:e,deepOptions:t={},
|
|
1388
|
+
boundOptions:r={},setBoundExeca:n,createNested:o},i,...s)=>{if(F(i))return o(e,Jo(r,i),n);let{file:a,commandArguments:c,
|
|
1389
|
+
options:l,isSync:u}=cR({mapArguments:e,firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?Sh(a,c,l):
|
|
1390
|
+
Vg(a,c,l,o)},cR=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=Gu(t)?Hu(t,r):[t,
|
|
1391
|
+
...r],[s,a,c]=_n(...i),l=Jo(Jo(n,o),c),{file:u=s,commandArguments:p=a,options:d=l,isSync:m=!1}=e({file:s,commandArguments:a,
|
|
1392
|
+
options:l});return{file:u,commandArguments:p,options:d,isSync:m}}});var Wg,Yg,Kg,lR,uR,Jg=f(()=>{Wg=({file:e,commandArguments:t})=>Kg(e,t),Yg=({file:e,commandArguments:t})=>({...Kg(e,t),isSync:!0}),
|
|
1393
|
+
Kg=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}\
|
|
1394
|
+
.`);let[r,...n]=lR(e);return{file:r,commandArguments:n}},lR=e=>{if(typeof e!="string")throw new TypeError(`The command m\
|
|
1395
|
+
ust be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(uR)){let o=r.at(-1);o&&
|
|
1396
|
+
o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},uR=/ +/g});var Xg,Zg,dR,Qg,fR,ey,ty=f(()=>{Xg=(e,t,r)=>{e.sync=t(dR,r),e.s=e.sync},Zg=({options:e})=>Qg(e),dR=({options:e})=>({...Qg(
|
|
1397
|
+
e),isSync:!0}),Qg=e=>({options:{...fR(e),...e}}),fR=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?
|
|
1398
|
+
{stdin:"inherit"}:{},ey={preferLocal:!0}});var ry,PV,CV,NV,kV,$V,MV,LV,DV,jV,ny=f(()=>{qg();Jg();Ks();ty();$a();ry=Be(()=>({})),PV=Be(()=>({isSync:!0})),CV=Be(Wg),
|
|
1399
|
+
NV=Be(Yg),kV=Be(gp),$V=Be(Zg,{},ey,Xg),{sendMessage:MV,getOneMessage:LV,getEachMessage:DV,getCancelSignal:jV}=Ph()});function pR(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function xr({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1400
|
+
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:p=null,retryable:d=null}={}){
|
|
1401
|
+
let m=pR(r),h=String(l||""),y=String(c||""),w=String(o||[h,y].filter(Boolean).join(`
|
|
1402
|
+
`)).trim();return{code:x(e),error:x(t),exitCode:m,ok:n===null?m===0:n===!0,output:w,pid:Number.isSafeInteger(Number(s))?
|
|
1403
|
+
Number(s):null,signal:x(a),stderr:y,stdout:h,...i==="base64"?{outputEncoding:i}:{},timedOut:u===!0,...p&&typeof p=="obje\
|
|
1404
|
+
ct"&&!Array.isArray(p)?{execution:p}:{},...typeof d=="boolean"?{retryable:d}:{}}}function q(e="",t="vibe64_command_faile\
|
|
1405
|
+
d",r={}){let n=x(e)||"Vibe64 command failed.";return xr({...r,code:t,error:n,exitCode:1,ok:!1,output:x(r.output)||n,stderr:r.
|
|
1406
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var Dt=f(()=>{U()});import{spawn as mR}from"node:child_process";import{mkdir as hR,open as gR}from"node:fs/promises";import yR from"node:path";
|
|
1407
|
+
async function ER(e=""){return e?(await hR(yR.dirname(e),{recursive:!0}),gR(e,"w",384)):null}async function SR(e){return new Promise(
|
|
1408
|
+
(t,r)=>{let n=!1,o=(i,s)=>{n||(n=!0,i(s))};e.once?.("spawn",()=>o(t)),e.once?.("error",i=>o(r,i))})}async function sy(e={},{
|
|
1409
|
+
cwd:t="",env:r={}}={}){let n=null;try{n=await ER(e.logPath);let o=n?["ignore",n.fd,n.fd]:["ignore","ignore","ignore"],i=mR(
|
|
1410
|
+
e.command,e.args,{cwd:t||void 0,detached:!0,env:r,stdio:o});await SR(i);let s=e.execution?.id||"";return s&&(Xo.set(s,{child:i,
|
|
1411
|
+
pid:Number(i.pid)}),i.once?.("exit",()=>{Zo(i.pid)||Xo.set(s,{child:i,pid:Number(i.pid),scopeEmpty:!0})})),i.unref?.(),xr(
|
|
1412
|
+
{execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:i.pid})}catch(o){return q(o?.message||"De\
|
|
1399
1413
|
tached command failed to start.",o?.code||"vibe64_command_detached_failed",{execution:e.execution})}finally{await n?.close?.().
|
|
1400
|
-
catch(()=>null)}}function
|
|
1401
|
-
in32"){let r=[...
|
|
1402
|
-
kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function
|
|
1403
|
-
"win32"?[...
|
|
1404
|
-
"ESRCH")return!1;throw r}}async function
|
|
1405
|
-
r;)await new Promise(n=>setTimeout(n,25));return!
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
utf8",signal:l=null,timeout:u=15e3}={}){let d,
|
|
1409
|
-
return
|
|
1414
|
+
catch(()=>null)}}function Zo(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)return!1;if(process.platform==="w\
|
|
1415
|
+
in32"){let r=[...Xo.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&r?.child?.signalCode===null}try{return process.
|
|
1416
|
+
kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function oy(e=null,t="SIGTERM"){if(!Zo(e))return!1;try{return process.platform===
|
|
1417
|
+
"win32"?[...Xo.values()].find(n=>n.pid===Number(e))?.child?.kill?.(t):process.kill(-Number(e),t),!0}catch(r){if(r?.code===
|
|
1418
|
+
"ESRCH")return!1;throw r}}async function iy(e=null,t=0){let r=Date.now()+Math.max(0,Number(t)||0);for(;Zo(e)&&Date.now()<
|
|
1419
|
+
r;)await new Promise(n=>setTimeout(n,25));return!Zo(e)}async function Qo(e=null,{killTimeoutMs:t=bR,termTimeoutMs:r=wR}={}){
|
|
1420
|
+
oy(e,"SIGTERM");let n=await iy(e,r);return n||(oy(e,"SIGKILL"),n=await iy(e,t)),n}var Xo,wR,bR,Pr=f(()=>{Dt();Xo=new Map,
|
|
1421
|
+
wR=3e3,bR=1e3});async function Cr(e="",t=[],{cwd:r="",env:n={},execution:o=null,input:i=void 0,maxBuffer:s=void 0,onOutput:a=null,outputEncoding:c="\
|
|
1422
|
+
utf8",signal:l=null,timeout:u=15e3}={}){let p,d,m,h=Promise.withResolvers(),y=()=>{m||=d(),m.then(h.resolve)};if(l?.aborted)
|
|
1423
|
+
return q("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let b=ry(e,t,{all:!0,cwd:r,detached:process.
|
|
1410
1424
|
platform!=="win32",encoding:c,env:n,extendEnv:!1,input:i,maxBuffer:s,reject:!1,stdin:i==null?"ignore":"pipe",stripFinalNewline:!1,
|
|
1411
|
-
timeout:u}),E=Number(b.pid),S;
|
|
1412
|
-
b.then(()=>!0,()=>!0)),S=
|
|
1413
|
-
l?.aborted&&
|
|
1414
|
-
[b,h.promise.then(
|
|
1415
|
-
ommand_capture_timed_out":
|
|
1416
|
-
(
|
|
1417
|
-
|
|
1425
|
+
timeout:u}),E=Number(b.pid),S;d=()=>{if(!S){let I;process.platform!=="win32"?I=Qo(E).catch(()=>!1):(b.kill("SIGKILL"),I=
|
|
1426
|
+
b.then(()=>!0,()=>!0)),S=I.then(A=>(A||(S=null),A))}return S},o?.id&&ay.set(o.id,d),l?.addEventListener("abort",y,{once:!0}),
|
|
1427
|
+
l?.aborted&&y(),typeof a=="function"&&b.all&&b.all.on("data",I=>{try{a(String(I||""))}catch{}});let _=await Promise.race(
|
|
1428
|
+
[b,h.promise.then(I=>I?b:{exitCode:1})]),T=typeof _.exitCode=="number"?_.exitCode:1;p=xr({code:_.timedOut===!0?"vibe64_c\
|
|
1429
|
+
ommand_capture_timed_out":_.code?"vibe64_command_capture_failed":"",error:T===0?"":_.shortMessage,exitCode:T,output:_.all||
|
|
1430
|
+
(T===0?"":_.shortMessage),outputEncoding:c,signal:_.signal,stderr:_.stderr,stdout:_.stdout,timedOut:_.timedOut===!0,execution:o})}catch(b){
|
|
1431
|
+
p=q(b.message,"vibe64_command_capture_failed",{execution:o,exitCode:typeof b.exitCode=="number"?b.exitCode:1,output:b.all,
|
|
1418
1432
|
outputEncoding:c,signal:b.signal,stderr:b.stderr,stdout:b.stdout,timedOut:b.timedOut===!0})}finally{l?.removeEventListener(
|
|
1419
|
-
"abort",
|
|
1420
|
-
4_execution_drain_failed",{execution:o,output:
|
|
1421
|
-
o.id);let
|
|
1422
|
-
outputEncoding:c}):
|
|
1423
|
-
operation:i="vibe64-command",args:s=[]}={}){return
|
|
1433
|
+
"abort",y)}if(!await(m||d?.()||!0))return q("The command finished, but its execution scope did not become empty.","vibe6\
|
|
1434
|
+
4_execution_drain_failed",{execution:o,output:p?.output,outputEncoding:c,stderr:p?.stderr,stdout:p?.stdout});o?.id&&ay.delete(
|
|
1435
|
+
o.id);let g=o&&{...o,state:"finished"};return l?.aborted?q("Command cancelled.","vibe64_command_cancelled",{...p,execution:g,
|
|
1436
|
+
outputEncoding:c}):g?{...p,execution:g}:p}var ay,Nr=f(()=>{ny();Dt();Pr();ay=new Map});function uy(e={}){return{...e,schema:cy,schemaVersion:ly}}function kr({actor:e={},command:t="",cwd:r="",env:n={},input:o=void 0,
|
|
1437
|
+
operation:i="vibe64-command",args:s=[]}={}){return uy({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,
|
|
1424
1438
|
gid:e.user?.gid,home:e.user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).
|
|
1425
|
-
toString("base64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function
|
|
1439
|
+
toString("base64"),operation:i,uid:e.user?.uid,username:e.user?.username})}function $r(e={}){return e.mode==="pty"&&e.envPolicy===
|
|
1426
1440
|
"auth"&&!["assistant","codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy===
|
|
1427
1441
|
"auth"||e.purpose==="codex"&&e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"?"c\
|
|
1428
1442
|
odex-app-server":e.mode==="detached"&&e.execution?.kind==="assistant"&&e.execution?.lifecycle==="service"&&["opencode-ca\
|
|
1429
1443
|
talog","opencode-server"].includes(e.execution?.operationId)||e.mode==="capture"&&e.execution?.kind==="assistant"&&e.execution?.
|
|
1430
1444
|
operationId==="opencode-catalog"?"opencode-app-server":e.purpose==="account"?"account-status":e.purpose==="github"?"gith\
|
|
1431
|
-
ub-workflow-command":e.purpose==="github-api"?"github-api-command":e.purpose==="
|
|
1432
|
-
async function
|
|
1433
|
-
timeout:a=15e3}={}){let c={env:t,input:`${JSON.stringify(e)}
|
|
1445
|
+
ub-workflow-command":e.purpose==="github-api"?"github-api-command":e.purpose==="workspace-cache"?"workspace-cache-comman\
|
|
1446
|
+
d":e.purpose==="health"?"health-status":"vibe64-command"}async function wc(e={},{env:t=process.env,helperPath:r="",maxBuffer:n=void 0,
|
|
1447
|
+
outputEncoding:o="utf8",runCapture:i=Cr,signal:s=null,timeout:a=15e3}={}){let c={env:t,input:`${JSON.stringify(e)}
|
|
1434
1448
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
1435
|
-
udo",["-n",r||t[
|
|
1436
|
-
exec-helper.payload",
|
|
1437
|
-
upport/symlinkSafeRequire.js",import.meta.url).href,
|
|
1438
|
-
url).href});var
|
|
1439
|
-
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var
|
|
1440
|
-
import
|
|
1441
|
-
path",r=
|
|
1442
|
-
absolute path.`,r);return n}async function
|
|
1443
|
-
r):
|
|
1444
|
-
try{if(s
|
|
1445
|
-
e"],{cwd:o,env:{PATH:"/usr/bin:/bin"},stdio:["pipe","pipe","pipe",i.fd]}),c=new Promise(
|
|
1446
|
-
signal:m}))}),!await new Promise((d
|
|
1447
|
-
data",
|
|
1448
|
-
`)&&
|
|
1449
|
+
udo",["-n",r||t[ti]||ei,"execute"],c)}var ei,cy,ly,ti,ri=f(()=>{Nr();ei="/usr/lib/vibe64/vibe64-exec-helper",cy="vibe64.\
|
|
1450
|
+
exec-helper.payload",ly=1,ti="VIBE64_EXEC_HELPER_PATH"});import{createRequire as TR}from"node:module";var _R,e4,dy=f(()=>{_R=new URL("./../node_modules/@jskit-ai/kernel/server/s\
|
|
1451
|
+
upport/symlinkSafeRequire.js",import.meta.url).href,e4=TR(_R)});var bc=f(()=>{de()});var py=f(()=>{de();bc()});var Ec=f(()=>{});var Sc=f(()=>{});var u4,_c=f(()=>{Ec();Sc();u4=new URL("./../node_modules/@jskit-ai/kernel/server/support/appConfigFiles.js",import.meta.
|
|
1452
|
+
url).href});var my=f(()=>{});var b4,E4,Tc=f(()=>{de();my();Ec();b4=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),E4=Object.
|
|
1453
|
+
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var ni=f(()=>{de()});var hy=f(()=>{});var Oc=f(()=>{hy()});var Ac,C4,N4,k4,gy=f(()=>{Oc();Ac="/api",C4=`${Ac}/`,N4=`${Ac}/docs`,k4=`${Ac}/realtime`});var yy=f(()=>{bc();Oc();gy()});var G4,vc=f(()=>{de();G4=Object.freeze(["compact","medium","expanded"])});var Ic=f(()=>{Tc();de();ni();vc()});var Ey=f(()=>{yy();de();vc();Ic();ni();_c()});import{spawn as $R}from"node:child_process";import{constants as Rc}from"node:fs";import{open as MR}from"node:fs/promises";
|
|
1454
|
+
import xc from"node:path";function oi(e="",t=Pc){let r=new Error(e||"Exclusive file lock failed.");return r.code=t,r}function Sy(e="",t="\
|
|
1455
|
+
path",r=Pc){let n=String(e||"").trim();if(!n||!xc.isAbsolute(n)||xc.normalize(n)!==n)throw oi(`${t} must be a normalized\
|
|
1456
|
+
absolute path.`,r);return n}async function jt(e="",{cwd:t="",errorCode:r=Pc}={}){let n=Sy(e,"lockPath",r),o=t?Sy(t,"cwd",
|
|
1457
|
+
r):xc.dirname(n),i=await MR(n,Rc.O_CREAT|Rc.O_NOFOLLOW|Rc.O_RDWR,432),s=null,a="",c=Promise.resolve({code:null,signal:null});
|
|
1458
|
+
try{if(s=$R("/bin/sh",["-c","/usr/bin/flock --exclusive --nonblock 3 || exit 1; printf 'locked\\n'; IFS= read -r _ || tru\
|
|
1459
|
+
e"],{cwd:o,env:{PATH:"/usr/bin:/bin"},stdio:["pipe","pipe","pipe",i.fd]}),c=new Promise(p=>{s.once("close",(d,m)=>p({code:d,
|
|
1460
|
+
signal:m}))}),!await new Promise((p,d)=>{let m="",h=!1,y=(w,g)=>{h||(h=!0,w(g))};s.once("error",w=>y(d,w)),s.stderr.on("\
|
|
1461
|
+
data",w=>{a=`${a}${String(w||"")}`.slice(-4096)}),s.stdout.on("data",w=>{m+=String(w||""),m.includes(`
|
|
1462
|
+
`)&&y(p,!0)}),s.once("exit",w=>{if(w===1){y(p,!1);return}y(d,oi(`Exclusive file lock process failed${a?`: ${a.trim()}`:"\
|
|
1449
1463
|
."}`,r))})}))return await i.close(),null;let u=!1;return async()=>{if(!u){u=!0;try{if(s.stdin.end(`release
|
|
1450
|
-
`),(await c).code!==0)throw
|
|
1464
|
+
`),(await c).code!==0)throw oi(`Exclusive file lock process exited unexpectedly${a?`: ${a.trim()}`:"."}`,r)}finally{await i.
|
|
1451
1465
|
close()}}}}catch(l){throw s?.stdin?.destroy(),s?.kill?.("SIGTERM"),await c,await i.close().catch(()=>null),l?.code===r?l:
|
|
1452
|
-
|
|
1453
|
-
session?.metadata?.session_git_command_actor_user_key)}async function
|
|
1454
|
-
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:
|
|
1466
|
+
oi(l?.message||String(l||"Exclusive file lock failed."),r)}}var Pc,_y=f(()=>{Pc="file_lock_failed"});var ii=f(()=>{dy();py();_c();Sc();Tc();ni();Ey();Ic();_y()});var Ty=f(()=>{ii()});function LR(e={}){return Oe(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
1467
|
+
session?.metadata?.session_git_command_actor_user_key)}async function Oy(e={}){let t=x(e.actor)||"daemon";if(t==="daemon"||
|
|
1468
|
+
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:cs()};let r=LR(e);if(!r){let n=new Error("A user key\
|
|
1455
1469
|
is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,credentialScope:"\
|
|
1456
|
-
user",requiresRealUser:!0,user:await
|
|
1457
|
-
|
|
1470
|
+
user",requiresRealUser:!0,user:await ls(r)}}var Ay=f(()=>{U();yt()});import si from"node:path";function Bt(e={}){let t=fs();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.
|
|
1471
|
+
user?.gid}function ai(e=process.env){return!!(String(e?.VIBE64_WORKSPACE||"").trim()||String(e?.VIBE64_WORKSPACE_DAEMON_USER||
|
|
1472
|
+
"").trim())}function ci(e={},{env:t=process.env}={}){return e.requiresRealUser?ai(t)||!Bt(e):!1}function vy(e={},t={},r=""){
|
|
1473
|
+
if(!e.requiresRealUser)return;let n=R(t.session?.sourceRoot||t.session?.sourcePath),o=R(r);if(!n||!o)return;let i=si.relative(
|
|
1474
|
+
n,o);if(i&&(i.startsWith("..")||si.isAbsolute(i)))return;let s=new Error("Managed session source commands must retain th\
|
|
1475
|
+
e workspace daemon filesystem identity.");throw s.code="vibe64_command_managed_source_real_user_forbidden",s}function Iy(e={},t={}){
|
|
1476
|
+
let r=R(e.user?.home),n=R(t.HOME),o=R(t.VIBE64_CREDENTIAL_HOME);if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&si.resolve(r)!==
|
|
1477
|
+
si.resolve(n)){let i=new Error("Command HOME does not match the resolved actor home.");throw i.code="vibe64_command_home\
|
|
1478
|
+
_actor_mismatch",i}}var li=f(()=>{yt();U()});function Mr(...e){let t={};for(let r of e){let n=J(r);for(let o of Ut)n[o]!==void 0&&(t[o]=n[o])}return t}var Ut,Lr=f(()=>{
|
|
1479
|
+
U();Ut=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
1458
1480
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
1459
|
-
R","VIBE64_MYSQL_USER"])});function
|
|
1460
|
-
t}function
|
|
1461
|
-
n.name,n.userName,n.user_name),i=
|
|
1481
|
+
R","VIBE64_MYSQL_USER"])});function Cc(e="",t="vibe64"){return x(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||
|
|
1482
|
+
t}function DR(...e){for(let t of e){let r=ee(t),n=ee(r.user),o=Oe(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,
|
|
1483
|
+
n.name,n.userName,n.user_name),i=Oe(r.email,r.userEmail,r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,
|
|
1462
1484
|
n.user_email);if(o&&i)return{authorEmail:i,authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}
|
|
1463
|
-
function
|
|
1464
|
-
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"github"}}function
|
|
1465
|
-
let r=
|
|
1466
|
-
vibe64@${n}.users.vibe64.invalid`,committerName:"Vibe64",source:"fallback"}}function
|
|
1467
|
-
session:n={},userKey:o=""}={}){let i=
|
|
1468
|
-
VIBE64_GIT_USER_NAME,email:t.VIBE64_GIT_USER_EMAIL})||
|
|
1469
|
-
r.workspace,t.VIBE64_WORKSPACE,t.VIBE64_RUNTIME_NAMESPACE),userKey:
|
|
1470
|
-
t.VIBE64_USER,t.USER,t.LOGNAME)})}function
|
|
1471
|
-
[
|
|
1472
|
-
"GIT_COMMITTER_EMAIL"});import
|
|
1473
|
-
let r=
|
|
1474
|
-
function
|
|
1475
|
-
t/vibe64/runtime-packs",
|
|
1476
|
-
bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","
|
|
1477
|
-
|
|
1478
|
-
dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-
|
|
1479
|
-
"addr2line","ar","as","c++","c++filt","cc","clang","
|
|
1480
|
-
|
|
1481
|
-
"
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
binDirs:["
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
"
|
|
1490
|
-
"
|
|
1491
|
-
"
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
"
|
|
1485
|
+
function jR(e={}){let t=ee(e),r=Oe(t.name,t.displayName,t.login,t.username),n=Oe(t.email,t.publicEmail,t.verifiedEmail);
|
|
1486
|
+
return!r||!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"github"}}function Ry({tenant:e="",
|
|
1487
|
+
userKey:t=""}={}){let r=Cc(t,"user"),n=Cc(e,"local");return{authorEmail:`${r}@${n}.users.vibe64.invalid`,authorName:`${r}\
|
|
1488
|
+
via Vibe64`,committerEmail:`vibe64@${n}.users.vibe64.invalid`,committerName:"Vibe64",source:"fallback"}}function xy({actor:e={},
|
|
1489
|
+
env:t=process.env,project:r={},session:n={},userKey:o=""}={}){let i=ee(n.metadata);return DR(r.gitIdentity,r.config?.git,
|
|
1490
|
+
n.gitIdentity,i.git_identity,{name:t.VIBE64_GIT_USER_NAME,email:t.VIBE64_GIT_USER_EMAIL})||jR(r.githubUser||n.githubUser||
|
|
1491
|
+
i.github_user)||Ry({tenant:Oe(r.tenant,r.workspace,t.VIBE64_WORKSPACE,t.VIBE64_RUNTIME_NAMESPACE),userKey:Oe(o,e.user?.username,
|
|
1492
|
+
t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.LOGNAME)})}function Nc(e={}){let t=xy(e);return{[zt]:t.authorEmail,
|
|
1493
|
+
[Ft]:t.authorName,[Gt]:t.committerEmail,[Vt]:t.committerName}}var Ft,zt,Vt,Gt,Dr=f(()=>{U();Ft="GIT_AUTHOR_NAME",zt="GIT\
|
|
1494
|
+
_AUTHOR_EMAIL",Vt="GIT_COMMITTER_NAME",Gt="GIT_COMMITTER_EMAIL"});import kc from"node:path";function ot({env:e=process.env,root:t=""}={}){return R(t||e?.[$c]||Py)}function Lc(e="",t={}){
|
|
1495
|
+
let r=x(e),n=Cy[r]?.binDirs||[],o=ot(t);return n.map(i=>kc.join(o,i))}function Dc(e={}){return kc.join(ot(e),"guard-bin")}
|
|
1496
|
+
function jc(e={}){return kc.join(ot(e),"policy-bin")}var $c,Py,Cy,Mc,jr=f(()=>{U();$c="VIBE64_RUNTIME_PACK_ROOT",Py="/op\
|
|
1497
|
+
t/vibe64/runtime-packs",Cy=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:[
|
|
1498
|
+
"bubblewrap/bin"],managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","p\
|
|
1499
|
+
ackage-lock.json"],managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","compose\
|
|
1500
|
+
r.lock"],managedCommands:["composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-co\
|
|
1501
|
+
nfiguration.json","conanfile.py","conan.lock"],managedCommands:["addr2line","ar","as","c++","c++filt","cc","clang","clan\
|
|
1502
|
+
g++","cmake","cpack","cpp","ctest","g++","gcc","gcore","gdb","gdb-add-index","gdbserver","gprof","gstack","ld","ld.bfd",
|
|
1503
|
+
"ld.gold","ld.lld","ld64.lld","lld","lld-link","lldb","lldb-dap","lldb-server","make","ninja","nm","objcopy","objdump","\
|
|
1504
|
+
pkg-config","ranlib","readelf","size","strings","strip","wasm-ld"]},python:{binDirs:["python/bin"],dependencyFiles:["pyp\
|
|
1505
|
+
roject.toml","requirements.txt","requirements.lock","uv.lock","poetry.lock","Pipfile","Pipfile.lock"],managedCommands:["\
|
|
1506
|
+
python","python3","pip","pip3","virtualenv"]},ruby:{binDirs:["ruby/bin"],dependencyFiles:["Gemfile","Gemfile.lock"],managedCommands:[
|
|
1507
|
+
"ruby","gem","rake","irb","erb","ri","rdoc","bundle","bundler"]},go:{binDirs:["go/bin"],dependencyFiles:["go.mod","go.su\
|
|
1508
|
+
m","go.work","go.work.sum"],managedCommands:["go","gofmt"]},java:{binDirs:["java/bin"],dependencyFiles:["pom.xml","build\
|
|
1509
|
+
.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties"],managedCommands:["java","javac",
|
|
1510
|
+
"jar","javap","javadoc","jshell","jlink","jmod","jdeps","jpackage","jcmd","jconsole","jdb","jfr","jhsdb","jinfo","jmap",
|
|
1511
|
+
"jps","jrunscript","jstack","jstat","jstatd","keytool","rmiregistry","serialver","mvn","mvnDebug","gradle"]},kotlin:{binDirs:[
|
|
1512
|
+
"kotlin/bin"],dependencyFiles:["build.gradle.kts","settings.gradle.kts","gradle.properties"],managedCommands:["kotlin","\
|
|
1513
|
+
kotlinc","kotlinc-jvm","kotlinc-js","kapt"]},csharp:{binDirs:["csharp/bin"],dependencyFiles:["global.json","Directory.Bu\
|
|
1514
|
+
ild.props","Directory.Packages.props","packages.lock.json","NuGet.Config"],managedCommands:["dotnet"]},rust:{binDirs:["r\
|
|
1515
|
+
ust/bin"],dependencyFiles:["Cargo.toml","Cargo.lock","rust-toolchain.toml",".cargo/config.toml"],managedCommands:["rustc",
|
|
1516
|
+
"rustdoc","cargo","rustfmt","cargo-fmt","clippy-driver","cargo-clippy"]},gh:{binDirs:["gh/bin"],managedCommands:["gh"]},
|
|
1517
|
+
git:{binDirs:["git/bin"],managedCommands:["git"]},mariadb:{binDirs:["mariadb/bin"],managedCommands:["mariadb","mysql"]},
|
|
1518
|
+
mysql:{binDirs:["mariadb/bin"],managedCommands:["mariadb","mysql"]},node26:{binDirs:["node26/bin"],dependencyFiles:["pac\
|
|
1519
|
+
kage.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock"],managedCommands:["node","npm","npx","\
|
|
1520
|
+
corepack","pnpm","yarn"]},"operator-clis":{binDirs:["managed-bin","operator-clis/bin"],identityPaths:["operator-clis/lib\
|
|
1521
|
+
/node_modules/@anthropic-ai/claude-code/package.json","operator-clis/lib/node_modules/@openai/codex/package.json","opera\
|
|
1522
|
+
tor-clis/lib/node_modules/opencode-ai/package.json"],managedCommands:["claude","codex","opencode"]},php:{binDirs:["php/b\
|
|
1523
|
+
in"],managedCommands:["php"]},playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","playwright\
|
|
1524
|
+
/browsers"],managedCommands:["playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","p\
|
|
1525
|
+
g_isready","postgres","psql"]},ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:[
|
|
1526
|
+
"sqlite3"]}}),Mc=Object.freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","b\
|
|
1527
|
+
ubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"])});import{readFileSync as BR}from"node:fs";import Ny from"node:path";function My({env:e=process.env,explicitRoot:t=""}={}){
|
|
1528
|
+
return R(t||e?.[Br]||ky)}function Uc(e={}){return Ny.join(ot(e),Bc,$y)}function Ly(e={}){let t=Ny.join(ot(e),Bc,UR),r;try{
|
|
1529
|
+
r=BR(t,"utf8")}catch(o){if(o?.code==="ENOENT")return"";throw o}let n=r.split(/\r?\n/u).filter(o=>o.startsWith("playwrigh\
|
|
1530
|
+
t_version=")).map(o=>o.slice(19).trim());if(n.length!==1||!FR.test(n[0]))throw new Error(`Invalid managed Playwright run\
|
|
1531
|
+
time manifest: ${t}.`);return n[0]}function Fc(e={}){let t=My(e),r=Ly(e);return{[Br]:t,[Ur]:Uc(e),[Fr]:"1",...r?{[ui]:r}:
|
|
1532
|
+
{}}}var Br,Ur,Fr,ui,ky,Bc,$y,UR,FR,zr=f(()=>{U();jr();Br="VIBE64_SHARED_CACHE_ROOT",Ur="PLAYWRIGHT_BROWSERS_PATH",Fr="PL\
|
|
1533
|
+
AYWRIGHT_SKIP_BROWSER_DOWNLOAD",ui="VIBE64_PLAYWRIGHT_VERSION",ky="/var/cache/vibe64",Bc="playwright",$y="browsers",UR="\
|
|
1534
|
+
runtime.env",FR=/^\d+\.\d+\.\d+$/u});function Ht(e={}){for(let t of Object.keys(J(e)))if(zc.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command cal\
|
|
1535
|
+
lers cannot provide execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function di(e={},{
|
|
1536
|
+
envPolicy:t="session"}={}){let r=J(e);Ht(r);let n=Object.fromEntries(Object.entries(r).filter(([o])=>!Dy.has(o)));return t===
|
|
1537
|
+
"deployment"?n:{...n,...Mr(r)}}var zc,Dy,fi=f(()=>{U();Lr();Dr();zr();zc=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER",
|
|
1503
1538
|
"VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIM\
|
|
1504
|
-
E_DIR"]),
|
|
1505
|
-
let r=
|
|
1506
|
-
actor:e={},request:t={}}={}){let r=t.credentialHome||{},n=
|
|
1539
|
+
E_DIR"]),Dy=new Set([...Ut,zt,Ft,Gt,Vt,Ur,Fr,ui,Br])});import jy from"node:path";function zR(e=""){let t=R(e);return t==="/home"||t.startsWith("/home/")}function VR(e="",t=""){
|
|
1540
|
+
let r=R(e),n=R(t);if(!r||!n)return!1;let o=jy.relative(n,r);return!o||!o.startsWith("..")&&!jy.isAbsolute(o)}function By({
|
|
1541
|
+
actor:e={},request:t={}}={}){let r=t.credentialHome||{},n=R(r.home);if(!n)return{};let o=R(e.user?.home);if(e.requiresRealUser&&
|
|
1507
1542
|
o&&n!==o){let a=new Error("Command credential home must match the resolved real-user actor home.");throw a.code="vibe64_\
|
|
1508
|
-
command_credential_home_actor_mismatch",a}if(!e.requiresRealUser&&
|
|
1509
|
-
l directory requires a matching real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=
|
|
1510
|
-
r.username||e.user?.username);return{...
|
|
1511
|
-
r.cacheRoot)}:{},...
|
|
1512
|
-
{},...
|
|
1513
|
-
isAbsolute(o))continue;let i
|
|
1543
|
+
command_credential_home_actor_mismatch",a}if(!e.requiresRealUser&&zR(n)&&o&&!VR(n,o)){let a=new Error("A /home credentia\
|
|
1544
|
+
l directory requires a matching real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=x(
|
|
1545
|
+
r.username||e.user?.username);return{...us({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...R(r.cacheRoot)?{XDG_CACHE_HOME:R(
|
|
1546
|
+
r.cacheRoot)}:{},...R(r.configRoot)?{XDG_CONFIG_HOME:R(r.configRoot)}:{},...R(r.dataRoot)?{XDG_DATA_HOME:R(r.dataRoot)}:
|
|
1547
|
+
{},...R(r.stateRoot)?{XDG_STATE_HOME:R(r.stateRoot)}:{}}}var Uy=f(()=>{yt();U()});import Fy from"node:path";function Vy(e=[]){let t=new Set,r=[];for(let n of Array.isArray(e)?e:[e]){let o=x(n);if(!o||!Fy.
|
|
1548
|
+
isAbsolute(o))continue;let i=Fy.resolve(o);t.has(i)||(t.add(i),r.push(i))}return r}function Vr(e={},t=[]){let r={...e&&typeof e==
|
|
1514
1549
|
"object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(String(r.GIT_CONFIG_COUNT||"0"),10),o=Number.isSafeInteger(n)&&n>=0?
|
|
1515
|
-
n:0;for(let i of Array.isArray(t)?t:[]){let s=
|
|
1516
|
-
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function
|
|
1517
|
-
function
|
|
1518
|
-
0",PAGER:"cat"}}function
|
|
1519
|
-
return
|
|
1520
|
-
b.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.insteadOf",value:"ssh://git@github.com/"}]),
|
|
1521
|
-
Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin/env gh auth git-credential"}]),
|
|
1550
|
+
n:0;for(let i of Array.isArray(t)?t:[]){let s=x(i?.key);s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(
|
|
1551
|
+
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function Gy(e=[]){return Vy(e).map(t=>({key:"safe.directory",value:t}))}
|
|
1552
|
+
function Vc(e={},t=[]){return Vr(e,Gy(t))}function pi(){return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"\
|
|
1553
|
+
0",PAGER:"cat"}}function Gc(e={}){return Vr(e,zy)}function Hy(e={}){return Vr(e,GR)}function qR(e={}){return Vr(e,HR)}function Hc(e={}){
|
|
1554
|
+
return Hy(Gc(e))}function qy(e={}){return qR(Gc(e))}var zy,GR,HR,qc=f(()=>{U();zy=Object.freeze([{key:"url.https://githu\
|
|
1555
|
+
b.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.insteadOf",value:"ssh://git@github.com/"}]),GR=
|
|
1556
|
+
Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin/env gh auth git-credential"}]),HR=Object.freeze(
|
|
1522
1557
|
[{key:"credential.https://github.com.helper",value:`!f() { case "$1" in get) printf '%s\\n' username=x-access-token "pass\
|
|
1523
|
-
word=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}])});function
|
|
1524
|
-
code="vibe64_command_git_auth_token_required",t}return
|
|
1525
|
-
request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github-token"?r=
|
|
1526
|
-
github-https"||e.purpose==="github")&&(r=
|
|
1527
|
-
BE64_GIT_AUTH_TOKEN"});import
|
|
1528
|
-
let t=
|
|
1529
|
-
PM_CONFIG_PREFIX"});function
|
|
1530
|
-
runtimes:r=[],shimDirs:n=[]}={}){return
|
|
1531
|
-
t||e.PATH),...
|
|
1532
|
-
bin"});function
|
|
1533
|
-
String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!
|
|
1534
|
-
"XDG_")))}function
|
|
1535
|
-
runtimeConfigEnv,e.project?.databaseEnv]}function
|
|
1536
|
-
{...t,...
|
|
1537
|
-
|
|
1538
|
-
request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=
|
|
1539
|
-
t))
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
"function
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1558
|
+
word=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}])});function WR(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requires a gitAuthToken.");throw t.
|
|
1559
|
+
code="vibe64_command_git_auth_token_required",t}return qy({...pi(),GIT_TERMINAL_PROMPT:"0",[Wy]:e.gitAuthToken})}function Yy({
|
|
1560
|
+
request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github-token"?r=WR(e):(e.gitTransport==="\
|
|
1561
|
+
github-https"||e.purpose==="github")&&(r=Hc({...t,...pi()})),Vc(r,e.gitSafeDirectories||[])}var Wy,Wc=f(()=>{qc();Wy="VI\
|
|
1562
|
+
BE64_GIT_AUTH_TOKEN"});import Ky from"node:path";function Kc({env:e={}}={}){return R(e?.[Yc])||(R(e?.HOME)?Ky.join(R(e.HOME),".local"):"")}function Jc(e={}){
|
|
1563
|
+
let t=Kc(e);return t?{[Yc]:t}:{}}function Xc(e={}){let t=Kc(e);return t?[Ky.join(t,"bin")]:[]}var Yc,Zc=f(()=>{U();Yc="N\
|
|
1564
|
+
PM_CONFIG_PREFIX"});function Qc(e=""){return String(e||"").split(":").map(x).filter(Boolean)}function Jy({env:e=process.env,existingPath:t="",
|
|
1565
|
+
runtimes:r=[],shimDirs:n=[]}={}){return qe([...Qc(n.join(":")),jc({env:e}),...r.flatMap(o=>Lc(o,{env:e})),Dc({env:e}),...Qc(
|
|
1566
|
+
t||e.PATH),...Qc(YR)]).join(":")}var YR,Xy=f(()=>{U();jr();YR="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/\
|
|
1567
|
+
bin"});import KR from"node:path";function XR(e={}){return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(
|
|
1568
|
+
e)?e:{}).map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!JR.has(t)&&!t.startsWith("GIT_")&&!t.startsWith(
|
|
1569
|
+
"GH_")&&!t.startsWith("XDG_")))}function el(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.
|
|
1570
|
+
deployment?.env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function ZR(e={}){return el(e).reduce((t,r)=>e.envPolicy===
|
|
1571
|
+
"deployment"?(Ht(r),{...t,...J(r)}):{...t,...di(r,e)},{})}function QR(e={},t={}){return t.envPolicy==="deployment"?[]:t.
|
|
1572
|
+
envPolicy==="project"?el(t):[e,...el(t),t.project?.databaseEnv,t.session?.databaseEnv]}function qt({actor:e={},baseEnv:t=process.
|
|
1573
|
+
env,localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=Fc({env:t}),s=di(n.env,n),
|
|
1574
|
+
a=String(t.XDG_RUNTIME_DIR||"").trim(),c={...ds(e.user,XR(t)),...Bt(e)&&KR.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...Mr(...QR(
|
|
1575
|
+
t,n)),...ZR(n),...Yy({actor:e,request:n}),...Nc({actor:e,env:t,project:n.project,session:n.session,userKey:n.userKey}),...s,
|
|
1576
|
+
...By({actor:e,request:n}),...i},l={...c,...Jc({env:c}),VIBE64_DECLARED_RUNTIMES:o};return{...l,PATH:Jy({env:l,existingPath:[
|
|
1577
|
+
...Xc({env:l}),l.PATH,r].filter(Boolean).join(":"),runtimes:n.runtimes,shimDirs:n.shimDirs||[]})}}var JR,mi=f(()=>{li();
|
|
1578
|
+
yt();Lr();fi();Lr();Uy();Wc();Dr();Dr();zr();Zc();Xy();U();JR=new Set([...Ut,zt,Ft,Gt,Vt,"HOME","LOGNAME","PATH","USER",
|
|
1579
|
+
"XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"])});import{Buffer as tx}from"node:buffer";import rx from"node:crypto";import{createRequire as nx}from"node:module";function cx(){
|
|
1580
|
+
return{code:"terminal_session_not_found",error:"Terminal session not found.",ok:!1}}function ol(e=""){return String(e||"\
|
|
1581
|
+
default").trim()||"default"}function wi(e){let t=ol(e);return gi.has(t)||gi.set(t,new Map),gi.get(t)}function lx(e="defa\
|
|
1582
|
+
ult"){return ax.get(ol(e))||null}function ux(e="default"){let t=lx(e);return t?{code:t.code,error:t.error,ok:!1}:null}function dx(e=""){
|
|
1583
|
+
let t=String(e||"");return[...gi.keys()].filter(r=>r.startsWith(t))}function bi(e){let t=String(e||""),r=t.length;for(let n=0;n<
|
|
1584
|
+
ox&&(r=t.lastIndexOf(`
|
|
1585
|
+
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>Zy&&(t=t.slice(t.length-Zy)),t}function il(e={}){return e.status===
|
|
1586
|
+
"running"||e.status==="closing"}function ew(e={}){return il(e)||e.status==="exited"}function fx(e={},t=null){if(typeof t!=
|
|
1587
|
+
"function")return!0;try{return t(Wt(e))===!0}catch{return!1}}function px(e=0){let t=Math.floor(Number(e||0));return Number.
|
|
1588
|
+
isFinite(t)&&t>0?t:0}function mx(e="",{outputLimit:t=0}={}){let r=String(e||""),n=px(t);return!n||r.length<=n?{output:r,
|
|
1589
|
+
outputTruncated:!1}:{output:r.slice(r.length-n),outputTruncated:!0}}function Wt(e,t={}){let r=mx(e.output,t);return{ok:!0,
|
|
1590
|
+
closeError:e.closeError||"",cols:e.cols||tl,createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.
|
|
1555
1591
|
exitCode,inputVersion:e.inputVersion||0,lastInputAt:e.lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.
|
|
1556
1592
|
lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,
|
|
1557
|
-
outputVersion:e.outputVersion||0,rows:e.rows||
|
|
1558
|
-
Array.isArray(t)||(e.metadata={...e.metadata||{},...t},
|
|
1559
|
-
return
|
|
1560
|
-
0}function
|
|
1561
|
-
max(
|
|
1562
|
-
if(e?.subscribers?.size)return 0;let r=
|
|
1563
|
-
(clearTimeout(e.detachedCleanupTimer),e.detachedCleanupTimer=null)}function
|
|
1564
|
-
size)return;let r=
|
|
1565
|
-
()=>{e.detachedCleanupTimer=null,
|
|
1566
|
-
0)+1,e.lastOutputAt=new Date().toISOString(),e.lastOutputBytes=r)}function
|
|
1567
|
-
...e.subscribers])try{r(t)}catch{e.subscribers.delete(r)}}function
|
|
1568
|
-
e||"Terminal PTY error.");return{code:t,message:r}}function
|
|
1593
|
+
outputVersion:e.outputVersion||0,rows:e.rows||rl,status:e.status}}function hx(e,t={}){return!e||!t||typeof t!="object"||
|
|
1594
|
+
Array.isArray(t)||(e.metadata={...e.metadata||{},...t},se(e,{metadata:e.metadata,type:"metadata"})),Wt(e)}function gx(e=""){
|
|
1595
|
+
return tx.byteLength(String(e||""),"utf8")}function hi(e=""){let t=Date.parse(String(e||""));return Number.isFinite(t)?t:
|
|
1596
|
+
0}function yi(e=0){let t=Math.floor(Number(e));return!Number.isFinite(t)||t<0?0:Math.min(t,ix)}function yx(e={}){return Math.
|
|
1597
|
+
max(hi(e.lastSubscriberDetachedAt),hi(e.lastInputAt),hi(e.lastOutputAt),hi(e.createdAt))}function tw(e={},t=Date.now()){
|
|
1598
|
+
if(e?.subscribers?.size)return 0;let r=yx(e);return r>0?Math.max(0,Number(t)-r):0}function rw(e={}){e?.detachedCleanupTimer&&
|
|
1599
|
+
(clearTimeout(e.detachedCleanupTimer),e.detachedCleanupTimer=null)}function nl(e={},t="default"){if(rw(e),!ew(e)||e?.subscribers?.
|
|
1600
|
+
size)return;let r=yi(e.detachedIdleTimeoutMs);if(r<1)return;let n=Math.max(0,r-tw(e));e.detachedCleanupTimer=setTimeout(
|
|
1601
|
+
()=>{e.detachedCleanupTimer=null,xx({namespace:t})},n)}function wx(e,t=""){let r=gx(t);r<1||(e.outputVersion=Number(e.outputVersion||
|
|
1602
|
+
0)+1,e.lastOutputAt=new Date().toISOString(),e.lastOutputBytes=r)}function se(e,t){if(e?.subscribers?.size)for(let r of[
|
|
1603
|
+
...e.subscribers])try{r(t)}catch{e.subscribers.delete(r)}}function bx(e){let t=String(e?.code||""),r=String(e?.message||
|
|
1604
|
+
e||"Terminal PTY error.");return{code:t,message:r}}function Ex(e,t){if(!e)return;let r=bx(t);e.lastWriteErrorAt=new Date().
|
|
1569
1605
|
toISOString(),e.lastWriteErrorCode=r.code,e.lastWriteError=r.message,console.warn("Vibe64 terminal PTY write error.",{code:r.
|
|
1570
|
-
code,id:e.id,metadata:e.metadata||{},message:r.message,namespace:e.namespace||""}),
|
|
1571
|
-
error"})}function
|
|
1572
|
-
namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){let n=e?[
|
|
1573
|
-
values())r&&!
|
|
1574
|
-
{namespacePrefix:t,runningOnly:!0}).filter(r=>
|
|
1606
|
+
code,id:e.id,metadata:e.metadata||{},message:r.message,namespace:e.namespace||""}),se(e,{code:r.code,error:r.message,type:"\
|
|
1607
|
+
error"})}function Sx(e){let t=e?.terminal?._writeStream;!t||typeof t.on!="function"||t.on("error",r=>{Ex(e,r)})}function nw({
|
|
1608
|
+
namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){let n=e?[ol(e)]:dx(t),o=[];for(let i of n){let s=wi(i);for(let a of s.
|
|
1609
|
+
values())r&&!il(a)||o.push({namespace:i,session:a})}return o}function _x({filter:e=null,namespacePrefix:t=""}={}){return nw(
|
|
1610
|
+
{namespacePrefix:t,runningOnly:!0}).filter(r=>fx(r.session,e)).length}async function Tx(e,t){if(!(!e||e.closeHookStarted)){
|
|
1575
1611
|
if(e.closeHookStarted=!0,typeof e.onClose!="function")return null;try{return await e.onClose({exitCode:e.exitCode,id:e.id,
|
|
1576
1612
|
output:e.output,reason:t,status:e.status}),null}catch(r){let n=String(r?.message||r||"Terminal finalization failed."),o=r instanceof
|
|
1577
1613
|
Error?r:new Error(n);o.code||="terminal_close_hook_failed";let i=`\r
|
|
1578
1614
|
[studio] Terminal finalization failed: ${n}\r
|
|
1579
|
-
`;return e.closeError=n,e.output=
|
|
1615
|
+
`;return e.closeError=n,e.output=bi(`${e.output}${i}`),se(e,{chunk:i,type:"output"}),se(e,{error:n,type:"error"}),o}}}async function Ox(e,t){
|
|
1580
1616
|
if(!(!e||e.stopHookStarted)){if(e.stopHookStarted=!0,typeof e.onStop!="function")return null;try{return await e.onStop({
|
|
1581
1617
|
id:e.id,output:e.output,reason:t,status:e.status}),null}catch(r){let n=String(r?.message||r||"Terminal stop failed."),o=r instanceof
|
|
1582
1618
|
Error?r:new Error(n);o.code||="terminal_stop_hook_failed";let i=`\r
|
|
1583
1619
|
[studio] Terminal stop failed: ${n}\r
|
|
1584
|
-
`;return e.closeError=n,e.output=
|
|
1620
|
+
`;return e.closeError=n,e.output=bi(`${e.output}${i}`),se(e,{chunk:i,type:"output"}),se(e,{error:n,type:"error"}),o}}}function Yt(e,t){
|
|
1585
1621
|
let r=`${String(t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;if(e.reportedLifecycleFailures||=new Set,
|
|
1586
1622
|
e.reportedLifecycleFailures.has(r))return t;e.reportedLifecycleFailures.add(r);let n=String(t?.message||t||"Terminal cle\
|
|
1587
1623
|
anup failed."),o=`\r
|
|
1588
1624
|
[studio] ${n}\r
|
|
1589
|
-
`;return e.closeError=n,e.output=
|
|
1625
|
+
`;return e.closeError=n,e.output=bi(`${e.output}${o}`),se(e,{chunk:o,type:"output"}),se(e,{error:n,type:"error"}),t}function Qy(e,t=[]){
|
|
1590
1626
|
let r=new AggregateError(t,`Terminal session could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||
|
|
1591
|
-
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function
|
|
1592
|
-
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>
|
|
1593
|
-
return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>
|
|
1594
|
-
e.status!=="exited"&&(e.status="exited",
|
|
1595
|
-
us"}))}function
|
|
1627
|
+
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function Ax(e,t){
|
|
1628
|
+
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>Ox(e,t))),e.stopHookCompletion}function ow(e,t){
|
|
1629
|
+
return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>Tx(e,t))),e.closeHookCompletion}function iw(e){
|
|
1630
|
+
e.status!=="exited"&&(e.status="exited",se(e,{closeError:e.closeError||"",exitCode:e.exitCode,status:e.status,type:"stat\
|
|
1631
|
+
us"}))}function sw(e){return e.scopeDrainCompletion||(e.scopeDrainCompletion=(async()=>{if(process.platform!=="win32"&&!await Qo(
|
|
1596
1632
|
e.terminal.pid)){let t=new Error(`Terminal execution scope did not become empty: ${e.id}`);throw t.code="terminal_execut\
|
|
1597
|
-
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function
|
|
1598
|
-
scopeDrainCompletion}catch(t){
|
|
1599
|
-
|
|
1600
|
-
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:
|
|
1601
|
-
detachedIdleTimeoutMs:h=0}){let
|
|
1602
|
-
[...
|
|
1603
|
-
S)return{ok:!1,code:"terminal_limit",error:`Terminal limit reached (${S}).`};let
|
|
1604
|
-
o,
|
|
1605
|
-
"function"?s({args:
|
|
1606
|
-
"object"&&!Array.isArray(
|
|
1607
|
-
closePromise:null,commandPreview:
|
|
1608
|
-
h),exitCompletion:
|
|
1609
|
-
typeof
|
|
1633
|
+
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function vx(e){try{await e.
|
|
1634
|
+
scopeDrainCompletion}catch(t){Yt(e,t)}try{await Promise.all([ow(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){
|
|
1635
|
+
Yt(e,t)}iw(e)}function aw({args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s=null,
|
|
1636
|
+
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:p=null,onStop:d=null,reuseRunning:m=!1,
|
|
1637
|
+
detachedIdleTimeoutMs:h=0}){let y=ux(a);if(y)return y;let w=wi(a),g=rx.randomUUID(),b=typeof m=="function"?m:()=>!!m,E=m?
|
|
1638
|
+
[...w.values()].find(D=>il(D)&&b(D)):null;if(E)return Wt(E);let S=Number(i||0),_=c||a;if(S>0&&_x({filter:l,namespacePrefix:_})>=
|
|
1639
|
+
S)return{ok:!1,code:"terminal_limit",error:`Terminal limit reached (${S}).`};let T=typeof o=="function"?o({id:g,namespace:a}):
|
|
1640
|
+
o,I=typeof e=="function"?e({env:T,id:g,namespace:a}):e,A=typeof r=="function"?r({args:I,env:T,id:g,namespace:a}):r,P=typeof s==
|
|
1641
|
+
"function"?s({args:I,env:T,id:g,namespace:a}):s,j=sx("node-pty").spawn(t,I,{cols:tl,cwd:n,env:{...process.env,...T&&typeof T==
|
|
1642
|
+
"object"&&!Array.isArray(T)?T:{}},name:"xterm-color",rows:rl}),B,ge=new Promise(D=>{B=D}),$={id:g,closeHookCompletion:null,
|
|
1643
|
+
closePromise:null,commandPreview:A,cols:tl,createdAt:new Date().toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:yi(
|
|
1644
|
+
h),exitCompletion:ge,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().toISOString(),metadata:P&&
|
|
1645
|
+
typeof P=="object"&&!Array.isArray(P)?P:{},onClose:u,onStop:d,inputVersion:0,lastInputAt:"",lastInputBytes:0,lastOutputAt:"",
|
|
1610
1646
|
lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,processExited:!1,
|
|
1611
|
-
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:
|
|
1612
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:
|
|
1613
|
-
output+
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
e);return o?
|
|
1619
|
-
String(t||"stop"),e.status==="running"&&(e.status="closing",
|
|
1620
|
-
if(
|
|
1647
|
+
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:B,rows:rl,status:"running",stopHookCompletion:null,
|
|
1648
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:j};return Sx($),j.onData(D=>{if(wx($,D),$.output=bi($.
|
|
1649
|
+
output+D),se($,{chunk:D,lastOutputAt:$.lastOutputAt,outputVersion:$.outputVersion,type:"output"}),typeof p=="function")try{
|
|
1650
|
+
p({chunk:D,output:$.output,session:Wt($),updateMetadata(Z){return hx($,Z)}})}catch(Z){let Ci=String(Z?.message||Z||"Term\
|
|
1651
|
+
inal output hook failed.");se($,{error:Ci,type:"error"})}nl($,a)}),j.onExit(({exitCode:D})=>{$.processExited=!0,$.exitCode=
|
|
1652
|
+
D,$.status="closing",sw($),se($,{exitCode:D,status:$.status,type:"status"}),ow($,$.stopReason||"exit"),$.resolveExitCompletion(),
|
|
1653
|
+
vx($)}),w.set(g,$),nl($,a),Ix(g,{namespace:a})}function Ix(e,{namespace:t="default",outputLimit:r=0}={}){let o=wi(t).get(
|
|
1654
|
+
e);return o?Wt(o,{outputLimit:r}):cx()}async function Rx(e,t="stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=
|
|
1655
|
+
String(t||"stop"),e.status==="running"&&(e.status="closing",se(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];
|
|
1656
|
+
if(Ax(e,e.stopReason),!e.processExited&&!e.killStarted){e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;
|
|
1621
1657
|
let o=n instanceof Error?n:new Error(String(n||"Terminal process could not be killed."));o.code||="terminal_kill_failed",
|
|
1622
|
-
r.push(
|
|
1623
|
-
let r=
|
|
1624
|
-
n),!n.processExited){let c=await
|
|
1625
|
-
i.push(
|
|
1626
|
-
n.closeHookCompletion])).filter(Boolean);if(n.processExited&&
|
|
1658
|
+
r.push(Yt(e,o))}}try{await sw(e)}catch(n){r.push(Yt(e,n))}return{failures:r}}async function cw(e,{namespace:t="default"}={}){
|
|
1659
|
+
let r=wi(t),n=r.get(e);if(!n)return{ok:!0,closed:!1};if(n.closePromise)return n.closePromise;let o=(async()=>{let i=[];if(rw(
|
|
1660
|
+
n),!n.processExited){let c=await Rx(n,"close");if(c.failures.length)throw Qy(n,c.failures)}try{await n.exitCompletion}catch(c){
|
|
1661
|
+
i.push(Yt(n,c))}try{await n.scopeDrainCompletion}catch(c){i.push(Yt(n,c))}let a=(await Promise.all([n.stopHookCompletion,
|
|
1662
|
+
n.closeHookCompletion])).filter(Boolean);if(n.processExited&&iw(n),i.length>0)throw Qy(n,[...i,...a]);return r.delete(e),
|
|
1627
1663
|
{ok:!0,closed:!0,...a.length>0?{cleanupErrors:a.map(c=>String(c?.message||c))}:{}}})();n.closePromise=o;try{return await o}finally{
|
|
1628
|
-
n.closePromise===o&&(n.closePromise=null)}}async function
|
|
1629
|
-
now()}={}){let o=0;for(let{namespace:i,session:s}of
|
|
1630
|
-
continue;let a=e==null?
|
|
1631
|
-
s.id,{namespace:i})).closed&&(o+=1)}return{ok:!0,closed:o}}var
|
|
1632
|
-
"./../node_modules/@local/vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href,
|
|
1633
|
-
300,
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
"
|
|
1637
|
-
|
|
1638
|
-
n,o);
|
|
1639
|
-
e
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return fi(t)?{args:(a={})=>{let c=PR(s.helperPayloadRoot),
|
|
1647
|
-
l=iw(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,d=Ir({actor:t,args:u,command:e.command,
|
|
1648
|
-
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:xr(e)});return RR(c,`${JSON.stringify(d)}
|
|
1649
|
-
`,{mode:384}),["-n",process.env[Yo]||Wo,"execute",c]},command:"sudo",cwd:s.helperPayloadRoot,env:{}}:{args:e.args,command:e.
|
|
1650
|
-
command,cwd:o,env:iw(e,{actor:t,baseEnv:r,localPath:n,policyEnv:i})}}function iw(e={},{actor:t={},baseEnv:r={},localPath:n="",
|
|
1651
|
-
policyEnv:o={}}={}){return typeof e.envFactory!="function"?o:(i={})=>Ft({actor:t,baseEnv:r,localPath:n,request:{...e,env:H(
|
|
1652
|
-
e.envFactory(i)),envFactory:null}})}async function sw(e={},{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){try{let s=e.terminal||
|
|
1653
|
-
{},a=e.execution?.id||"",c=CR(e,{actor:t,baseEnv:r||i,localPath:n,cwd:o,env:i}),l=Qy({args:c.args,command:c.command,commandPreview:s.
|
|
1664
|
+
n.closePromise===o&&(n.closePromise=null)}}async function xx({idleMs:e=null,namespace:t="",namespacePrefix:r="",now:n=Date.
|
|
1665
|
+
now()}={}){let o=0;for(let{namespace:i,session:s}of nw({namespace:t,namespacePrefix:r})){if(!ew(s)||s.subscribers?.size)
|
|
1666
|
+
continue;let a=e==null?yi(s.detachedIdleTimeoutMs):yi(e);if(a<1&&e==null)continue;if(tw(s,n)<a){nl(s,i);continue}(await cw(
|
|
1667
|
+
s.id,{namespace:i})).closed&&(o+=1)}return{ok:!0,closed:o}}var ex,Zy,ox,tl,rl,XG,ix,ZG,gi,sx,ax,lw=f(()=>{Pr();ex=new URL(
|
|
1668
|
+
"./../node_modules/@local/vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href,Zy=256*1024,ox=
|
|
1669
|
+
300,tl=100,rl=28,XG=600*1e3,ix=1440*60*1e3,ZG=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "}),gi=new Map,
|
|
1670
|
+
sx=nx(ex),ax=new Map});import{randomUUID as Px}from"node:crypto";import{mkdirSync as Cx,writeFileSync as Nx}from"node:fs";import sl from"node:path";
|
|
1671
|
+
function kx(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required for real-user PTY\
|
|
1672
|
+
execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=sl.join(sl.resolve(t),"exec-helper-\
|
|
1673
|
+
payloads");return Cx(r,{mode:448,recursive:!0}),sl.join(r,`${process.pid}-${Date.now()}-${Px()}.json`)}function $x(e={},{
|
|
1674
|
+
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return ci(t)?{args:(a={})=>{let c=kx(s.helperPayloadRoot),
|
|
1675
|
+
l=dw(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,p=kr({actor:t,args:u,command:e.command,
|
|
1676
|
+
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:$r(e)});return Nx(c,`${JSON.stringify(p)}
|
|
1677
|
+
`,{mode:384}),["-n",process.env[ti]||ei,"execute",c]},command:"sudo",cwd:s.helperPayloadRoot,env:{}}:{args:e.args,command:e.
|
|
1678
|
+
command,cwd:o,env:dw(e,{actor:t,baseEnv:r,localPath:n,policyEnv:i})}}function dw(e={},{actor:t={},baseEnv:r={},localPath:n="",
|
|
1679
|
+
policyEnv:o={}}={}){return typeof e.envFactory!="function"?o:(i={})=>qt({actor:t,baseEnv:r,localPath:n,request:{...e,env:J(
|
|
1680
|
+
e.envFactory(i)),envFactory:null}})}async function fw(e={},{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){try{let s=e.terminal||
|
|
1681
|
+
{},a=e.execution?.id||"",c=$x(e,{actor:t,baseEnv:r||i,localPath:n,cwd:o,env:i}),l=aw({args:c.args,command:c.command,commandPreview:s.
|
|
1654
1682
|
commandPreview,cwd:c.cwd,detachedIdleTimeoutMs:s.detachedIdleTimeoutMs,env:c.env,maxRunning:s.maxRunning,metadata:s.metadata,
|
|
1655
1683
|
namespace:s.namespace,namespaceLimitPrefix:s.namespaceLimitPrefix,onClose:async u=>{try{typeof s.onClose=="function"&&await s.
|
|
1656
|
-
onClose(u)}finally{a&&
|
|
1657
|
-
reuseRunning,runningLimitFilter:s.runningLimitFilter});return l?.ok===!0&&a&&
|
|
1658
|
-
ok===!0?{...l,execution:e.execution}:l}catch(s){return
|
|
1659
|
-
nd_pty_failed",{execution:e.execution})}}var
|
|
1660
|
-
let r=
|
|
1661
|
-
e),n=(Array.isArray(t)?t:[t]).map(
|
|
1662
|
-
let s=
|
|
1663
|
-
code="vibe64_command_cwd_outside_allowed_roots",i}var
|
|
1664
|
-
id Vibe64 command request.");return r.code=t,r}function
|
|
1665
|
-
`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function
|
|
1666
|
-
capture"}={}){if(typeof e=="function"){if(t!=="pty")throw
|
|
1667
|
-
mmands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}function
|
|
1668
|
-
mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw
|
|
1669
|
-
PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let r=
|
|
1670
|
-
function
|
|
1671
|
-
commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:
|
|
1672
|
-
maxRunning,metadata:t.metadata,namespace:
|
|
1673
|
-
onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}function
|
|
1674
|
-
let t=
|
|
1675
|
-
gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:
|
|
1676
|
-
uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,username:
|
|
1677
|
-
t.userKey)}:{}}function
|
|
1678
|
-
capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function
|
|
1679
|
-
if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw
|
|
1680
|
-
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function
|
|
1681
|
-
terminal",session:o={}}={}){let i=
|
|
1682
|
-
"execution_lifecycle");if(t==="detached"&&a!=="service"||t==="pty"&&a!=="interactive"||t==="capture"&&a!=="finite")throw
|
|
1683
|
-
`Execution lifecycle ${a} is incompatible with command mode ${t}.`,"vibe64_execution_lifecycle_incompatible");let c=
|
|
1684
|
-
ownerId||o.sessionId||o.id);if(a==="service"&&!c)throw
|
|
1684
|
+
onClose(u)}finally{a&&uw.set(a,{id:u.id,namespace:s.namespace,scopeEmpty:!0})}},onOutput:s.onOutput,onStop:s.onStop,reuseRunning:s.
|
|
1685
|
+
reuseRunning,runningLimitFilter:s.runningLimitFilter});return l?.ok===!0&&a&&uw.set(a,{id:l.id,namespace:s.namespace}),l?.
|
|
1686
|
+
ok===!0?{...l,execution:e.execution}:l}catch(s){return q(s?.message||"Vibe64 PTY command failed.",s?.code||"vibe64_comma\
|
|
1687
|
+
nd_pty_failed",{execution:e.execution})}}var uw,al=f(()=>{Dt();U();mi();lw();ri();li();uw=new Map});import{realpathSync as pw}from"node:fs";import mw from"node:path";function Mx(e=""){return R(e||process.cwd())}function hw(e="",t=""){
|
|
1688
|
+
let r=mw.relative(e,t);return r===""||!r.startsWith("..")&&!mw.isAbsolute(r)}function gw(e="",{allowedRoots:t=[]}={}){let r=Mx(
|
|
1689
|
+
e),n=(Array.isArray(t)?t:[t]).map(R).filter(Boolean);if(n.length===0)return r;let o=n.filter(s=>hw(s,r));if(o.length>0){
|
|
1690
|
+
let s=pw(r);if(o.some(a=>hw(pw(a),s)))return s}let i=new Error("Vibe64 command cwd is outside the allowed roots.");throw i.
|
|
1691
|
+
code="vibe64_command_cwd_outside_allowed_roots",i}var yw=f(()=>{U()});import{randomUUID as Lx}from"node:crypto";function le(e="",t="vibe64_command_request_invalid"){let r=new Error(e||"Inval\
|
|
1692
|
+
id Vibe64 command request.");return r.code=t,r}function Ue(e="",t=[],r="",n="value"){let o=x(e)||r;if(!t.includes(o))throw le(
|
|
1693
|
+
`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function qx(e=[],{mode:t="\
|
|
1694
|
+
capture"}={}){if(typeof e=="function"){if(t!=="pty")throw le("Function-valued command args are only supported for PTY co\
|
|
1695
|
+
mmands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}function Wx(e={},{
|
|
1696
|
+
mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw le("Function-valued command env is only supported for \
|
|
1697
|
+
PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let r=J(e);return Ht(r),{env:r,envFactory:null}}
|
|
1698
|
+
function cl(e=[]){return(Array.isArray(e)?e:[e]).map(R).filter(Boolean)}function Yx(e={}){let t=ee(e);return{commandPreview:t.
|
|
1699
|
+
commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:R(t.helperPayloadRoot||t.payloadRoot),maxRunning:t.
|
|
1700
|
+
maxRunning,metadata:t.metadata,namespace:x(t.namespace),namespaceLimitPrefix:x(t.namespaceLimitPrefix),onClose:t.onClose,
|
|
1701
|
+
onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}function Kx(e={}){
|
|
1702
|
+
let t=ee(e),r=R(t.home||t.toolHomeSource);return r?{cacheRoot:R(t.cacheRoot),configRoot:R(t.configRoot),dataRoot:R(t.dataRoot),
|
|
1703
|
+
gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:x(t.scope),stateRoot:R(t.stateRoot),
|
|
1704
|
+
uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,username:x(t.username||t.ownerUserKey||
|
|
1705
|
+
t.userKey)}:{}}function Jx(e="capture"){return e==="detached"?"service":e==="pty"?"interactive":"finite"}function Xx({mode:e="\
|
|
1706
|
+
capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function Kt(e=""){let t=x(e);
|
|
1707
|
+
if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw le(`Invalid Vibe64 execution ide\
|
|
1708
|
+
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function Sw(e={},{mode:t="capture",project:r={},purpose:n="\
|
|
1709
|
+
terminal",session:o={}}={}){let i=ee(e),s=Ue(i.kind,bw,Xx({mode:t,purpose:n}),"execution_kind"),a=Ue(i.lifecycle,Ew,Jx(t),
|
|
1710
|
+
"execution_lifecycle");if(t==="detached"&&a!=="service"||t==="pty"&&a!=="interactive"||t==="capture"&&a!=="finite")throw le(
|
|
1711
|
+
`Execution lifecycle ${a} is incompatible with command mode ${t}.`,"vibe64_execution_lifecycle_incompatible");let c=Kt(i.
|
|
1712
|
+
ownerId||o.sessionId||o.id);if(a==="service"&&!c)throw le("Service execution requires a durable owner id.","vibe64_execu\
|
|
1685
1713
|
tion_owner_required");let l=i.resourceProfile;if(l!=null&&(!l||typeof l!="object"||Object.keys(l).some(u=>!["key","compa\
|
|
1686
1714
|
tibilityKey","environment"].includes(u))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l.key||"")||!/^[a-f0-9]{64}$/u.test(l.compatibilityKey||
|
|
1687
|
-
"")||!["development","test","production"].includes(l.environment)))throw
|
|
1688
|
-
"vibe64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.freeze({...l})}:{},controlGenerationId:
|
|
1689
|
-
i.controlGenerationId),...i.workflowId===void 0||i.workflowId===null||i.workflowId===""?{}:{workflowId:
|
|
1690
|
-
id
|
|
1691
|
-
projectSlug:
|
|
1692
|
-
"string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e))throw
|
|
1693
|
-
uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function
|
|
1694
|
-
e)?
|
|
1695
|
-
imes"),n=
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
"Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=
|
|
1699
|
-
void 0?t.env:t.extraEnv,{mode:n}),s=
|
|
1700
|
-
`Unsupported Vibe64 runtime: ${
|
|
1701
|
-
"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="capture"||t.actor!==
|
|
1702
|
-
|
|
1703
|
-
finite application deployment command without caller Env.","
|
|
1704
|
-
t.actor,
|
|
1705
|
-
cwd()),env:i.env,envFactory:i.envFactory,envPolicy:
|
|
1706
|
-
t.execution,{mode:n,project:c,purpose:s,session:l}),credentialHome:
|
|
1707
|
-
gitCredentials?.token),gitSafeDirectories:
|
|
1708
|
-
t.githubTransport?"github-https":"none","git_transport"),inheritProcessEnv:!u&&t.inheritProcessEnv!==!1,
|
|
1709
|
-
input,logPath:
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:
|
|
1713
|
-
var
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
freeze(["session","project","preview","auth","deployment"]),
|
|
1717
|
-
Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),
|
|
1718
|
-
|
|
1719
|
-
"bun","php","composer","cpp","
|
|
1720
|
-
"
|
|
1721
|
-
|
|
1715
|
+
"")||!["development","test","production"].includes(l.environment)))throw le("Invalid activity resource profile identity.",
|
|
1716
|
+
"vibe64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.freeze({...l})}:{},controlGenerationId:Kt(
|
|
1717
|
+
i.controlGenerationId),...i.workflowId===void 0||i.workflowId===null||i.workflowId===""?{}:{workflowId:Zx(i.workflowId)},
|
|
1718
|
+
id:Lx(),kind:s,label:x(i.label),lifecycle:a,operationId:Kt(i.operationId),ownerId:c,parentExecutionId:Kt(i.parentExecutionId),
|
|
1719
|
+
projectSlug:Kt(i.projectSlug||r.slug||r.projectSlug),sessionId:Kt(i.sessionId||o.sessionId||o.id)})}function Zx(e){if(typeof e!=
|
|
1720
|
+
"string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e))throw le("Execution req\
|
|
1721
|
+
uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function Qx(e=""){return Hx.has(
|
|
1722
|
+
e)?Mc:[]}function ww(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function eP(e={},t=""){let r=ww(e,"runt\
|
|
1723
|
+
imes"),n=ww(e,"runtime");if(!r&&!n)return qe(Qx(t));let o=r?e.runtimes:e.runtime;return qe((Array.isArray(o)?o:[o]).map(
|
|
1724
|
+
x).filter(Boolean))}function _w(e={}){let t=ee(e),r=x(t.command);if(!r)throw le("A command is required.","vibe64_command\
|
|
1725
|
+
_required");let n=Ue(t.mode,Bx,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))
|
|
1726
|
+
throw le("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=J(t.baseEnv),i=Wx(
|
|
1727
|
+
t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=Ue(t.purpose,jx,"terminal","purpose"),a=eP(t,s);for(let p of a)if(!Vx.includes(
|
|
1728
|
+
p))throw le(`Unsupported Vibe64 runtime: ${p}.`,"vibe64_command_runtime_unsupported");let c=ee(t.project),l=ee(t.session),
|
|
1729
|
+
u=t.releaseEnvironmentFile??"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="capture"||t.actor!==
|
|
1730
|
+
"app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw le("Release env\
|
|
1731
|
+
ironment files require a finite application deployment command without caller Env.","vibe64_command_release_environment_\
|
|
1732
|
+
invalid");return{actor:Ue(t.actor,Dx,"daemon","actor"),allowedRoots:cl(t.allowedRoots),args:qx(t.args,{mode:n}),baseEnv:o,
|
|
1733
|
+
command:r,cwd:R(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:Ue(t.envPolicy,Fx,"session","env_polic\
|
|
1734
|
+
y"),releaseEnvironmentFile:u,execution:Sw(t.execution,{mode:n,project:c,purpose:s,session:l}),credentialHome:Kx(t.credentialHome),
|
|
1735
|
+
gitAuthToken:x(t.gitAuthToken||t.gitCredentials?.token),gitSafeDirectories:cl(t.gitSafeDirectories||t.safeDirectories),gitTransport:Ue(
|
|
1736
|
+
t.gitTransport,zx,t.githubTransport?"github-https":"none","git_transport"),inheritProcessEnv:!u&&t.inheritProcessEnv!==!1,
|
|
1737
|
+
input:t.stdin??t.input,logPath:R(t.logPath),maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(
|
|
1738
|
+
t.maxBuffer):Gx,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,outputEncoding:Ue(t.outputEncoding,Ux,"utf\
|
|
1739
|
+
8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??null,shimDirs:cl(t.shimDirs),terminal:Yx(
|
|
1740
|
+
t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:x(
|
|
1741
|
+
t.userKey)}}var Dx,jx,Bx,Ux,Fx,zx,bw,Ew,Vx,Gx,Hx,ll=f(()=>{U();fi();jr();Dx=Object.freeze(["daemon","owner-user","named-\
|
|
1742
|
+
user","app"]),jx=Object.freeze(["account","assistant","terminal","codex","github","github-api","source-editor","preview",
|
|
1743
|
+
"output","deployment","health","workspace-cache","source"]),Bx=Object.freeze(["capture","pty","detached"]),Ux=Object.freeze(
|
|
1744
|
+
["utf8","base64"]),Fx=Object.freeze(["session","project","preview","auth","deployment"]),zx=Object.freeze(["none","githu\
|
|
1745
|
+
b-https","github-token"]),bw=Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),Ew=Object.
|
|
1746
|
+
freeze(["finite","interactive","service"]),Vx=Object.freeze(["node26","git","gh","mysql","mariadb","postgresql","sqlite",
|
|
1747
|
+
"ripgrep","bubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","pla\
|
|
1748
|
+
ywright","operator-clis"]),Gx=1e3*1e3*100,Hx=new Set(["assistant","codex","deployment","output","preview","source","term\
|
|
1749
|
+
inal"])});function ul(){return tP}function Ei(e=process.env){return["1","true"].includes(String(e?.[Tw]||"").trim().toLowerCase())}
|
|
1750
|
+
var tP,Tw,Si=f(()=>{Nr();Pr();al();Dt();tP=null,Tw="VIBE64_MANAGED_EXECUTION_REQUIRED"});async function rP(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i,requiresHelper:s}={}){return e.releaseEnvironmentFile?q("\
|
|
1722
1751
|
Release environment execution requires a managed host.","vibe64_release_environment_unavailable",{execution:e.execution}):
|
|
1723
|
-
e.mode==="pty"?
|
|
1752
|
+
e.mode==="pty"?fw(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}):e.mode==="detached"?t.requiresRealUser&&(!Bt(t)||s)?q("\
|
|
1724
1753
|
Detached real-user command execution is unsupported when the helper is required.","vibe64_command_detached_real_user_uns\
|
|
1725
|
-
upported",{execution:e.execution}):
|
|
1726
|
-
cwd:o,env:i,input:e.input,operation
|
|
1727
|
-
timeout}),execution:e.execution}:
|
|
1728
|
-
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function
|
|
1729
|
-
try{if(t=
|
|
1754
|
+
upported",{execution:e.execution}):sy(e,{actor:t,cwd:o,env:i}):s?{...await wc(kr({actor:t,args:e.args,command:e.command,
|
|
1755
|
+
cwd:o,env:i,input:e.input,operation:$r(e)}),{maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.
|
|
1756
|
+
timeout}),execution:e.execution}:Cr(e.command,e.args,{cwd:o,env:i,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,
|
|
1757
|
+
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function Gr(e={}){let t=null;
|
|
1758
|
+
try{if(t=_w(e),t.signal?.aborted)return q("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Oy(
|
|
1730
1759
|
t),n=t.inheritProcessEnv?{...process.env,...t.baseEnv}:{...t.baseEnv},o=(h={})=>({...h,VIBE64_EXECUTION_ID:t.execution.id}),
|
|
1731
|
-
i=
|
|
1732
|
-
join(":"):"",l=o(
|
|
1733
|
-
r,l);let u=
|
|
1734
|
-
t.envFactory?
|
|
1735
|
-
h,{actor:r,baseEnv:n,localPath:c,cwd:u,env:l,requiresHelper:a,...
|
|
1736
|
-
env:l,resolveArgs:
|
|
1737
|
-
ed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?
|
|
1760
|
+
i=ul(),s=Ei(n)||Ei(process.env),a=ci(r),c=!i&&!s&&!a&&!ai(n)&&!ai(process.env)&&Bt(r)?[n.PATH,process.env.PATH].filter(Boolean).
|
|
1761
|
+
join(":"):"",l=o(qt({actor:r,baseEnv:n,localPath:c,request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t}));Iy(
|
|
1762
|
+
r,l);let u=gw(t.cwd,{allowedRoots:t.allowedRoots});vy(r,t,u);let p=(h={})=>typeof t.args=="function"?t.args(h):t.args,d=(h={})=>o(
|
|
1763
|
+
t.envFactory?qt({actor:r,baseEnv:n,localPath:c,request:{...t,env:t.envFactory(h),envFactory:null}}):l),m=(h=t,y={})=>rP(
|
|
1764
|
+
h,{actor:r,baseEnv:n,localPath:c,cwd:u,env:l,requiresHelper:a,...y});return i?await i.runCommand(t,{actor:r,baseEnv:n,cwd:u,
|
|
1765
|
+
env:l,resolveArgs:p,resolveEnv:d,runLocal:m}):t.releaseEnvironmentFile?q("Release environment execution requires a manag\
|
|
1766
|
+
ed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?q("Managed execution safety is unavailable\
|
|
1738
1767
|
. Vibe64 did not start this work.","vibe64_managed_execution_provider_unavailable",{execution:t.execution,retryable:!1}):
|
|
1739
|
-
m()}catch(r){return
|
|
1740
|
-
()=>{
|
|
1768
|
+
m()}catch(r){return q(r?.message||"Vibe64 command failed.",r?.code||"vibe64_command_failed",{execution:t?.execution})}}var _i=f(
|
|
1769
|
+
()=>{Ay();mi();Nr();ri();Pr();al();yw();li();ll();Dt();Si()});var F6,z6,Ow=f(()=>{_i();F6=512*1024*1024,z6=1024*1024*1024});var nP,Aw=f(()=>{U();nP=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"])});var oP,vw=f(()=>{U();oP=64*1024});var Iw=f(()=>{});var dl=f(()=>{});var Rw,xw,sP,aP,Pw=f(()=>{dl();Rw="backups.git",xw="vibe64-atomic",sP=`backup_canonical_ref() {
|
|
1741
1770
|
vibe64_backup_repository="$1"
|
|
1742
1771
|
vibe64_source_repository="$2"
|
|
1743
1772
|
vibe64_source_ref="$3"
|
|
@@ -1755,13 +1784,13 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
1755
1784
|
' "$vibe64_source_ref" >&2
|
|
1756
1785
|
return 1
|
|
1757
1786
|
fi
|
|
1758
|
-
}`,
|
|
1787
|
+
}`,aP=`#!/bin/sh
|
|
1759
1788
|
set -eu
|
|
1760
1789
|
|
|
1761
1790
|
zero_object=0000000000000000000000000000000000000000
|
|
1762
1791
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
1763
1792
|
repository_root="$(dirname "$git_dir")"
|
|
1764
|
-
backup_repository="$repository_root/${
|
|
1793
|
+
backup_repository="$repository_root/${Rw}"
|
|
1765
1794
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
1766
1795
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
1767
1796
|
' >&2
|
|
@@ -1770,7 +1799,7 @@ fi
|
|
|
1770
1799
|
exec 8>"$repository_root/mutation.lock"
|
|
1771
1800
|
flock -x 8
|
|
1772
1801
|
|
|
1773
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
1802
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${xw}" ]; then
|
|
1774
1803
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
1775
1804
|
' >&2
|
|
1776
1805
|
exit 1
|
|
@@ -1781,7 +1810,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
1781
1810
|
exit 1
|
|
1782
1811
|
fi
|
|
1783
1812
|
|
|
1784
|
-
${
|
|
1813
|
+
${sP}
|
|
1785
1814
|
|
|
1786
1815
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
1787
1816
|
cleanup_updates_file() {
|
|
@@ -1829,265 +1858,305 @@ while read -r old_object _new_object ref_name; do
|
|
|
1829
1858
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
1830
1859
|
fi
|
|
1831
1860
|
done <"$updates_file"
|
|
1832
|
-
`});var
|
|
1833
|
-
e.js",import.meta.url).href});var
|
|
1834
|
-
ution/src/server/conversationExecution.js",import.meta.url).href,
|
|
1835
|
-
|
|
1836
|
-
e),r=async(
|
|
1837
|
-
project",gitSafeDirectories:[t],maxBuffer:
|
|
1838
|
-
if(
|
|
1839
|
-
|
|
1840
|
-
"Choose the topic repository root.");let n=await r(["rev-parse","
|
|
1841
|
-
-files=all"]))throw new Error("Commit the topic content before
|
|
1842
|
-
i=JSON.parse(await r(["show",`${n}:package.json`])),s=String(i.repository?.
|
|
1843
|
-
if(!s)throw new Error("
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
"
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1861
|
+
`});var Cw=f(()=>{zr()});var Nw=f(()=>{});var tH,kw=f(()=>{tH=new URL("./../node_modules/@local/vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSourc\
|
|
1862
|
+
e.js",import.meta.url).href});var $w=f(()=>{});var Mw=f(()=>{});import{fileURLToPath as dP}from"node:url";var uP,cH,Lw=f(()=>{_i();Si();uP=new URL("./../node_modules/@local/vibe64-exec\
|
|
1863
|
+
ution/src/server/conversationExecution.js",import.meta.url).href,cH=dP(new URL("./engines/stdioBridge.js",uP))});var Dw=f(()=>{En();Lu();yt();ri();Ty();_i();Nr();Si();ll();Ow();mi();Aw();vw();qc();Iw();Wc();Lr();fi();Zc();Dr();dl();Pw();
|
|
1864
|
+
U();zr();jr();Cw();Nw();kw();$w();Mw();Lw()});import{createHash as Bw}from"node:crypto";import{realpath as jw}from"node:fs/promises";async function Hr(e){let t=await jw(
|
|
1865
|
+
e),r=async(c,l="utf8",{input:u,maxBuffer:p=1024*1024}={})=>{let d=await Gr({actor:"daemon",allowedRoots:[t],args:["-C",t,
|
|
1866
|
+
...c],command:"git",cwd:t,envPolicy:"project",gitSafeDirectories:[t],input:u,maxBuffer:p,mode:"capture",outputEncoding:l,
|
|
1867
|
+
purpose:"source",runtimes:["git"],timeout:6e4});if(d.ok!==!0)throw Object.assign(new Error(d.error||"Git could not read \
|
|
1868
|
+
the pinned topic."),{code:d.code});return l==="base64"?Buffer.from(d.stdout,"base64"):d.stdout.trim()};if(await jw(await r(
|
|
1869
|
+
["rev-parse","--show-toplevel"]))!==t)throw new Error("Choose the topic repository root.");let n=await r(["rev-parse","H\
|
|
1870
|
+
EAD"]);if(await r(["status","--porcelain","--untracked-files=all"]))throw new Error("Commit the topic content before gen\
|
|
1871
|
+
erating a pinned course manifest.");let o=await ht(t),i=JSON.parse(await r(["show",`${n}:package.json`])),s=String(i.repository?.
|
|
1872
|
+
url||"").match(/^https:\/\/github\.com\/([a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+)\.git$/u)?.[1];if(!s)throw new Error("To\
|
|
1873
|
+
pic package needs its canonical https://github.com/<owner>/learn-<topic>.git repository URL.");let a=He([o.topicManifest,
|
|
1874
|
+
...o.bundles.map(c=>c.manifest)]);for(let c=0;c<a.length;){let l=c,u=0;do u+=a[l].bytes+Buffer.byteLength(a[l].path)+128,
|
|
1875
|
+
l+=1;while(l<a.length&&u+a[l].bytes+Buffer.byteLength(a[l].path)+128<=1024*1024);let p=a.slice(c,l),d=await r(["cat-file",
|
|
1876
|
+
"--batch","-Z"],"base64",{input:p.map(h=>`${n}:${h.path}\0`).join(""),maxBuffer:2*1024*1024}),m=0;for(let h of p){let y=d.
|
|
1877
|
+
indexOf(0,m),w=y<0?null:/^(?:[a-f0-9]{40}|[a-f0-9]{64}) blob (0|[1-9][0-9]*)$/u.exec(d.subarray(m,y).toString("ascii")),
|
|
1878
|
+
g=w?Number(w[1]):-1,b=y+1+g;if(g!==h.bytes||d[b]!==0||Bw("sha256").update(d.subarray(y+1,b)).digest("hex")!==h.sha256)throw new Error(
|
|
1879
|
+
`Topic input differs from its pinned commit: ${h.path}.`);m=b+1}if(m!==d.length)throw new Error("Unexpected trailing dat\
|
|
1880
|
+
a while reading the pinned topic.");c=l}if(await r(["rev-parse","HEAD"])!==n||await r(["status","--porcelain","--untrack\
|
|
1881
|
+
ed-files=all"]))throw new Error("Topic changed during manifest generation. Commit and retry.");return{topicId:o.topic.topicId,
|
|
1882
|
+
release:o.release,repository:s,commit:n,topicManifest:o.topicManifest,topicHash:o.topicHash}}function qr(e,t){let r=re(mn,
|
|
1883
|
+
e,"Course");if(!/^[a-z][a-z0-9-]{0,63}$/u.test(r.courseId)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!r.topics.length)throw new Error(
|
|
1884
|
+
"Course needs an ID, exact release and at least one whole topic.");let n=new Set,o=r.topics.map(i=>{if(n.has(i.topicId))
|
|
1885
|
+
throw new Error(`Duplicate course topic: ${i.topicId}.`);n.add(i.topicId);let s=t.filter(u=>u.topicId===i.topicId&&u.release===
|
|
1886
|
+
i.release);if(s.length!==1)throw new Error(`Resolve exactly one pinned topic release: ${i.topicId}@${i.release}.`);let a=s[0];
|
|
1887
|
+
if(!/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u.test(a.repository||"")||!/^[a-f0-9]{40}$/u.test(a.commit||""))throw new Error(
|
|
1888
|
+
`Topic requires a repository and immutable commit: ${i.topicId}.`);let c=a.topicManifest;if(!c||c.schemaVersion!==1||c.topic?.
|
|
1889
|
+
topicId!==i.topicId||c.release!==i.release||Bw("sha256").update(k(c)).digest("hex")!==a.topicHash)throw new Error(`Topic\
|
|
1890
|
+
manifest identity mismatch: ${i.topicId}.`);if(re(pn,c.topic,i.topicId),r.status==="released"&&c.topic.status!=="releas\
|
|
1891
|
+
ed")throw new Error(`Released course requires a released topic: ${i.topicId}.`);let l=c.topic.lessons;if(!Array.isArray(
|
|
1892
|
+
l)||!l.length||!Array.isArray(c.lessons)||l.length!==c.lessons.length)throw new Error(`Incomplete whole-topic inventory:\
|
|
1893
|
+
${i.topicId}.`);for(let[u,p]of l.entries()){let d=c.lessons[u];if(d.code!==p.code||d.status!==p.status||d.required!==p.
|
|
1894
|
+
required||!/^[a-f0-9]{64}$/u.test(d.hash||""))throw new Error(`Changed whole-topic order or lesson identity: ${i.topicId}\
|
|
1895
|
+
.`);if(r.status==="released"&&d.required&&d.status!=="published")throw new Error(`Released course includes required draf\
|
|
1896
|
+
t: ${d.code}.`)}return{topicId:i.topicId,release:i.release,repository:a.repository,commit:a.commit,manifestHash:a.topicHash,
|
|
1897
|
+
lessons:c.lessons.map(u=>({...u}))}});return{schemaVersion:1,courseId:r.courseId,release:r.release,status:r.status,topics:o}}
|
|
1898
|
+
var Ti=f(()=>{Dw();gt();sr()});import{createHash as fP}from"node:crypto";import{lstat as pP,readFile as mP,readdir as hP,realpath as gP}from"node:fs/promises";
|
|
1899
|
+
import L from"node:path";function st(e,t={}){let r=re(wP,e,"Installed topic pin");if(!it.test(r.topicId)||!fl.test(r.commit)||
|
|
1900
|
+
r.topicId!==(t.topicId??r.topicId)||r.commit!==(t.commit??r.commit)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!yP.test(r.repository)||
|
|
1901
|
+
!Yr.test(r.topicHash))throw new Error("Installed pin does not match the requested topic, commit or canonical source iden\
|
|
1867
1902
|
tity.");if(r.topicHash!==(t.topicHash??r.topicHash))throw new Error("Installed topic differs from the trusted course or \
|
|
1868
|
-
attempt pin.");return r}async function
|
|
1903
|
+
attempt pin.");return r}async function Kr(e,t){let r=await pP(e);if(r.isSymbolicLink()||await gP(e)!==e)throw new Error(
|
|
1869
1904
|
"Installed content cannot use symlink or directory aliases.");if(t?!r.isDirectory():!r.isFile())throw new Error(`Install\
|
|
1870
|
-
ed content needs a regular ${t?"directory":"file"}.`);return r}async function
|
|
1871
|
-
`Installed file exceeds its ${t}-byte limit.`);let n=await
|
|
1872
|
-
ts ${t}-byte limit.`);return n}async function
|
|
1873
|
-
o,{withFileTypes:!0})){if(++r>65536)throw new Error("Installed snapshot exceeds 65536 directory entries.");let s=
|
|
1874
|
-
o,i.name);i.isDirectory()?await n(s):(await
|
|
1875
|
-
t.sort()}function
|
|
1876
|
-
"Installed teaching content needs an absolute server-owned system root.");let r=
|
|
1877
|
-
"Draft lesson reads require a trusted server construction choice.");async function
|
|
1878
|
-
if(typeof
|
|
1879
|
-
ct 40-character lowercase Git commit.");if(typeof
|
|
1880
|
-
cter topic hash from the course or saved attempt.");
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
join(
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
"Installed
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
let h=await
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1905
|
+
ed content needs a regular ${t?"directory":"file"}.`);return r}async function Jt(e,t){if((await Kr(e,!1)).size>t)throw new Error(
|
|
1906
|
+
`Installed file exceeds its ${t}-byte limit.`);let n=await mP(e);if(n.length>t)throw new Error(`Installed file exceeds i\
|
|
1907
|
+
ts ${t}-byte limit.`);return n}async function bP(e){let t=[],r=0;async function n(o){await Kr(o,!0);for(let i of await hP(
|
|
1908
|
+
o,{withFileTypes:!0})){if(++r>65536)throw new Error("Installed snapshot exceeds 65536 directory entries.");let s=L.join(
|
|
1909
|
+
o,i.name);i.isDirectory()?await n(s):(await Kr(s,!1),t.push(L.relative(e,s).split(L.sep).join("/")))}}return await n(e),
|
|
1910
|
+
t.sort()}function Jr({systemRoot:e,allowDraftLessons:t=!1}={}){if(typeof e!="string"||!e||!L.isAbsolute(e))throw new Error(
|
|
1911
|
+
"Installed teaching content needs an absolute server-owned system root.");let r=L.resolve(e);if(typeof t!="boolean")throw new TypeError(
|
|
1912
|
+
"Draft lesson reads require a trusted server construction choice.");let n=new Map;async function o({topicId:m,commit:h,topicHash:y}={}){
|
|
1913
|
+
if(typeof m!="string"||typeof h!="string"||!it.test(m)||!fl.test(h))throw new Error("Choose a valid topic ID and its exa\
|
|
1914
|
+
ct 40-character lowercase Git commit.");if(typeof y!="string"||!Yr.test(y))throw new Error("Provide the trusted 64-chara\
|
|
1915
|
+
cter topic hash from the course or saved attempt.");let w=JSON.stringify([m,h,y]),g=n.get(w);return g||(g=i({topicId:m,commit:h,
|
|
1916
|
+
topicHash:y}).finally(()=>n.delete(w)),n.set(w,g)),structuredClone(await g)}async function i({topicId:m,commit:h,topicHash:y}){
|
|
1917
|
+
try{let w=L.join(r,"training"),g=L.join(w,"content"),b=L.join(g,m),E=L.join(b,h);for(let D of[r,w,g,b,E])await Kr(D,!0);
|
|
1918
|
+
let S=st(JSON.parse((await Jt(L.join(E,"pin.json"),4096)).toString("utf8")),{topicId:m,commit:h,topicHash:y}),_=JSON.parse(
|
|
1919
|
+
(await Jt(L.join(E,"bundle.json"),32*1024*1024)).toString("utf8")),T=L.join(E,"files"),I=await bP(T),A=await ht(T),P={schemaVersion:1,
|
|
1920
|
+
topic:A.topic,release:A.release,topicHash:A.topicHash,topicManifest:A.topicManifest,lessons:A.bundles.map(({lesson:D,hash:Z,
|
|
1921
|
+
status:Ci,required:nb,manifest:ob})=>({code:D.code,hash:Z,status:Ci,required:nb,manifest:ob}))};if(k(_)!==k(P))throw new Error(
|
|
1922
|
+
"Installed bundle is incomplete, reordered, unsupported or changed from its source files.");if(A.topic.topicId!==S.topicId||
|
|
1923
|
+
A.release!==S.release||A.topicHash!==S.topicHash)throw new Error("Installed topic identity differs from its pin.");let j=He(
|
|
1924
|
+
[A.topicManifest,...A.bundles.map(D=>D.manifest)]);if(k(I)!==k(j.map(D=>D.path).sort()))throw new Error("Installed snaps\
|
|
1925
|
+
hot has missing or unrecorded files.");let B=await Jt(L.join(T,"package.json"),1024*1024),ge=j.find(D=>D.path==="package\
|
|
1926
|
+
.json");if(B.length!==ge.bytes||Oi(B)!==ge.sha256)throw new Error("Installed source changed during reading.");if(JSON.parse(
|
|
1927
|
+
B.toString("utf8")).repository?.url!==`https://github.com/${S.repository}.git`)throw new Error("Installed package reposi\
|
|
1928
|
+
tory URL differs from its canonical pin.");return{pin:S,...A}}catch(w){let g=["ENOENT","ENOTDIR"].includes(w.code),b=new Error(
|
|
1929
|
+
g?`Pinned teaching content ${m}@${h} is missing. Ask the owner to install that exact revision.`:`Pinned teaching content\
|
|
1930
|
+
${m}@${h} is invalid: ${w.message} Ask the owner to reinstall the verified snapshot.`,{cause:w});throw b.code=g?"VIBE64\
|
|
1931
|
+
_TRAINING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",b}}async function s({pin:m,manifest:h},y,w){let g=L.join(r,
|
|
1932
|
+
"training","content",m.topicId,m.commit,"files"),b=L.resolve(g,y,w),E=L.relative(g,b).split(L.sep).join("/"),S=h.files.find(
|
|
1933
|
+
T=>T.path===E);if(!S)throw new Error("Lesson requested an unrecorded installed file.");let _=await Jt(b,1024*1024);if(_.
|
|
1934
|
+
length!==S.bytes||Oi(_)!==S.sha256)throw new Error("Installed lesson changed while reading. Ask the owner to reinstall t\
|
|
1935
|
+
he verified snapshot.");return{path:E,bytes:_}}async function a({topicId:m,commit:h,topicHash:y,lessonCode:w,lessonHash:g}={}){
|
|
1936
|
+
if(typeof m!="string"||!it.test(m)||typeof h!="string"||!fl.test(h)||typeof y!="string"||!Yr.test(y)||typeof w!="string"||
|
|
1937
|
+
!it.test(w)||typeof g!="string"||!Yr.test(g))throw new Error("Choose an exact pinned topic and lesson identity.");try{let b=L.
|
|
1938
|
+
join(r,"training"),E=L.join(b,"content"),S=L.join(E,m),_=L.join(S,h);for(let Z of[r,b,E,S,_])await Kr(Z,!0);let T=st(JSON.
|
|
1939
|
+
parse((await Jt(L.join(_,"pin.json"),4096)).toString("utf8")),{topicId:m,commit:h,topicHash:y}),I=JSON.parse((await Jt(L.
|
|
1940
|
+
join(_,"bundle.json"),32*1024*1024)).toString("utf8")),A=I.topicManifest;if(!A||Oi(k(A))!==y||A.topic.topicId!==m||A.release!==
|
|
1941
|
+
T.release)throw new Error("Installed topic manifest differs from the trusted identity.");let P=A.lessons.find(Z=>Z.code===
|
|
1942
|
+
w),j=A.topic.lessons.find(Z=>Z.code===w),B=I.lessons.find(Z=>Z.code===w);if(!P||!j||!B||P.hash!==g||Oi(k(B.manifest))!==
|
|
1943
|
+
g)throw new Error("Installed lesson manifest differs from the trusted content hash.");if(P.status!=="published"&&!t)throw new Error(
|
|
1944
|
+
`Lesson ${w} is draft and cannot be taught. Choose a published lesson.`);let ge={pin:T,manifest:B.manifest,hash:g,descriptorPath:j.
|
|
1945
|
+
descriptor},$=await s(ge,".",j.descriptor),D=re(fn,JSON.parse($.bytes.toString("utf8")),w);if(D.code!==w)throw new Error(
|
|
1946
|
+
"Installed lesson descriptor identity changed.");return{...ge,lesson:D}}catch(b){let E=new Error(`Pinned teaching identi\
|
|
1947
|
+
ty ${m}@${h} is invalid: ${b.message} Ask the owner to restore the exact snapshot.`,{cause:b});throw E.code=["ENOENT","E\
|
|
1948
|
+
NOTDIR"].includes(b.code)?"VIBE64_TRAINING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",E}}async function c({topicId:m,
|
|
1949
|
+
commit:h,topicHash:y,lessonCode:w,lessonHash:g}={}){if(typeof w!="string"||typeof g!="string"||!it.test(w)||!Yr.test(g))
|
|
1950
|
+
throw new Error("Choose a declared lesson code and its exact 64-character lowercase content hash.");let b=await o({topicId:m,
|
|
1951
|
+
commit:h,topicHash:y}),E=b.bundles.find(S=>S.lesson.code===w);if(!E)throw new Error(`Lesson ${w} is not declared in this\
|
|
1952
|
+
pinned topic.`);if(E.status!=="published"&&!t)throw new Error(`Lesson ${w} is draft and cannot be taught. Choose a publ\
|
|
1953
|
+
ished lesson.`);if(E.hash!==g)throw new Error(`Lesson ${w} content hash changed. Resume its exact pinned revision or exp\
|
|
1954
|
+
licitly start a new attempt.`);return{pin:b.pin,lesson:E.lesson,manifest:E.manifest,hash:E.hash,descriptorPath:E.descriptorPath}}
|
|
1955
|
+
async function l(m={}){let h=await c(m),y=L.dirname(h.descriptorPath);async function w(_){let T=await s(h,y,_);return{path:T.
|
|
1956
|
+
path,text:T.bytes.toString("utf8")}}let g=await w(h.lesson.document),b=h.lesson.assessments.map(_=>({id:_.id,reference:_.
|
|
1957
|
+
rubric,position:new RegExp(`^<a id="${_.id}"></a>$`,"mu").exec(g.text).index})).sort((_,T)=>_.position-T.position),E=b.map(
|
|
1958
|
+
(_,T)=>({id:_.id,reference:_.reference,text:g.text.slice(_.position,b[T+1]?.position??g.text.length)})),S=[];for(let _ of h.
|
|
1959
|
+
lesson.visuals){let T=await w(_.descriptor);S.push({id:_.id,descriptorPath:T.path,visual:JSON.parse(T.text)})}return{...h,
|
|
1960
|
+
document:g,rubrics:E,visuals:S}}async function u({topicId:m,commit:h,topicHash:y,lessonCode:w,lessonHash:g,visualId:b}={}){
|
|
1961
|
+
if(typeof b!="string"||!it.test(b))throw new Error("Choose a declared visual ID.");let E=await l({topicId:m,commit:h,topicHash:y,
|
|
1962
|
+
lessonCode:w,lessonHash:g}),S=E.visuals.find(P=>P.id===b);if(!S)throw new Error(`Visual ${b} is not declared in this pin\
|
|
1963
|
+
ned lesson.`);let _=L.dirname(S.descriptorPath),T=await s(E,_,S.visual.svg),I=await s(E,_,S.visual.controller),A=[];for(let P of S.
|
|
1964
|
+
visual.assets||[])A.push(await s(E,_,P));return{pin:E.pin,lessonCode:E.lesson.code,lessonHash:E.hash,...S,svg:T,controller:I,
|
|
1965
|
+
assets:A}}async function p({topicId:m,commit:h,topicHash:y,lessonCode:w,lessonHash:g,checkId:b}={}){if(typeof b!="string"||
|
|
1966
|
+
!it.test(b))throw new Error("Choose a declared check ID.");let E=await l({topicId:m,commit:h,topicHash:y,lessonCode:w,lessonHash:g}),
|
|
1967
|
+
S=E.lesson.checks?.find(A=>A.id===b);if(!S)throw new Error(`Check ${b} is not declared in this pinned lesson.`);let _=L.
|
|
1968
|
+
dirname(E.descriptorPath),T=await s(E,_,S.file),I=[];for(let A of S.assets||[])I.push(await s(E,_,A));return{pin:E.pin,lessonCode:E.
|
|
1969
|
+
lesson.code,lessonHash:E.hash,check:S,file:T,assets:I}}async function d({topicId:m,commit:h,topicHash:y,lessonCode:w,lessonHash:g,
|
|
1970
|
+
metadataOnly:b=!1,admissionOnly:E=!1}={}){if(E===!0&&b!==!0)throw new TypeError("Admission reads cannot supply exercise \
|
|
1971
|
+
content.");let _=await(E===!0?a:b===!0?c:l)({topicId:m,commit:h,topicHash:y,lessonCode:w,lessonHash:g}),T=_.lesson.exercise;
|
|
1972
|
+
if(!T)throw Object.assign(new Error(`Lesson ${w} has no declared bundled exercise.`),{code:"VIBE64_TRAINING_EXERCISE_MIS\
|
|
1973
|
+
SING"});let I=L.posix.join(L.posix.dirname(_.descriptorPath),T.source),A={pin:_.pin,lessonCode:_.lesson.code,lessonHash:_.
|
|
1974
|
+
hash,exercise:T,sourcePath:I};if(b===!0)return A;let P=I==="."?"":`${I}/`,j=[];for(let B of _.manifest.files){if(!B.path.
|
|
1975
|
+
startsWith(P))continue;let ge=B.path.slice(P.length),$=await s(_,I,ge);j.push({path:ge,bytes:$.bytes})}return{...A,files:j}}
|
|
1976
|
+
return{readTopic:o,readLesson:l,readAdmissionIdentity:a,readVisual:u,readCheck:p,readExercise:d}}var it,fl,Yr,yP,Wr,wP,Oi,
|
|
1977
|
+
pl=f(()=>{un();gt();sr();it=/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u,fl=/^[a-f0-9]{40}$/u,Yr=/^[a-f0-9]{64}$/u,yP=/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u,
|
|
1978
|
+
Wr={type:"string",required:!0,noTrim:!0,minLength:1,maxLength:256},wP=M({schemaVersion:{type:"integer",required:!0,enum:[
|
|
1979
|
+
1]},topicId:{...Wr,maxLength:64},release:Wr,repository:Wr,commit:{...Wr,maxLength:40},topicHash:{...Wr,maxLength:64}}),Oi=
|
|
1980
|
+
e=>fP("sha256").update(e).digest("hex")});import{randomUUID as EP}from"node:crypto";import{lstat as SP,mkdir as hl,realpath as _P,rename as TP,rm as OP,writeFile as AP}from"node:fs/promises";
|
|
1981
|
+
import W from"node:path";function Uw(e,t){if(typeof e!="string"||!W.isAbsolute(e)||W.resolve(e)!==e||e===W.parse(e).root)
|
|
1982
|
+
throw new Error(`${t} must be a normalized absolute, non-root server-owned directory.`);return e}function Fw(e,t){let r=W.
|
|
1983
|
+
relative(e,t);return!r||r!==".."&&!r.startsWith(`..${W.sep}`)&&!W.isAbsolute(r)}async function _e(e,t,r=!0){let n;try{n=
|
|
1984
|
+
await SP(e)}catch(o){if(r&&o.code==="ENOENT")return null;throw o}if(n.isSymbolicLink()||await _P(e)!==e)throw new Error(
|
|
1933
1985
|
"Training installation cannot use symlink or directory aliases.");if(t?!n.isDirectory():!n.isFile())throw new Error(`Tra\
|
|
1934
1986
|
ining installation needs a regular ${t?"directory":"file"}: ${e}.`);if(!t&&(n.nlink!==1||n.size!==0))throw new Error("Tr\
|
|
1935
|
-
aining installation lock must be an unaliased empty regular file; inspect it before retrying.");return n}async function
|
|
1936
|
-
let r=
|
|
1937
|
-
code!=="EEXIST")throw t}await
|
|
1938
|
-
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function
|
|
1939
|
-
let{topicId:r,release:n,repository:o,commit:i,topicHash:s}=await
|
|
1940
|
-
commit:i,topicHash:s},t)}function
|
|
1941
|
-
sourceRoot:o,pin:i}={}){let s={...
|
|
1942
|
-
throw new Error("Trusted topic source must be separate from the training installation namespace.");let c=
|
|
1943
|
-
nt"),l=
|
|
1944
|
-
await
|
|
1987
|
+
aining installation lock must be an unaliased empty regular file; inspect it before retrying.");return n}async function Ai(e,t=!1){
|
|
1988
|
+
let r=W.dirname(e);return r!==e&&await Ai(r,t),_e(e,!0,t)}async function vP(e){try{await hl(e,{mode:448})}catch(t){if(t.
|
|
1989
|
+
code!=="EEXIST")throw t}await _e(e,!0,!1)}function vi(e,t){if(k(e)!==k(t))throw new Error("Topic source or installed sna\
|
|
1990
|
+
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function ml(e,t){
|
|
1991
|
+
let{topicId:r,release:n,repository:o,commit:i,topicHash:s}=await Hr(e);vi({schemaVersion:1,topicId:r,release:n,repository:o,
|
|
1992
|
+
commit:i,topicHash:s},t)}function zw({systemRoot:e}={}){let t=Uw(e,"Training system root"),r=Jr({systemRoot:t});async function n({
|
|
1993
|
+
sourceRoot:o,pin:i}={}){let s={...st(i)};Uw(o,"Trusted topic source root");let a=W.join(t,"training");if(Fw(o,a)||Fw(a,o))
|
|
1994
|
+
throw new Error("Trusted topic source must be separate from the training installation namespace.");let c=W.join(a,"conte\
|
|
1995
|
+
nt"),l=W.join(c,s.topicId),u=W.join(l,s.commit),p=W.join(a,".install-locks"),d=W.join(p,`${s.topicId}-${s.commit}.lock`);
|
|
1996
|
+
await Ai(t);let m=await Ai(o,!0);for(let g of[a,c,l,p])await _e(g,!0);if(await _e(d,!1),await _e(u,!0))vi((await r.readTopic(
|
|
1945
1997
|
s)).pin,s);else{if(!m)throw new Error("Trusted topic source is missing. Prepare the approved local repository before ins\
|
|
1946
|
-
talling its pin.");await
|
|
1947
|
-
revision is being installed. Retry after the current owner operation finishes.");throw
|
|
1948
|
-
USY",
|
|
1949
|
-
readTopic(s);return
|
|
1950
|
-
|
|
1951
|
-
if(await
|
|
1952
|
-
`,{flag:"wx",mode:384}),await
|
|
1953
|
-
ination appeared during installation. Keep it unchanged and retry the verified pin.");await
|
|
1954
|
-
s);return
|
|
1955
|
-
installTopic:n}}var
|
|
1956
|
-
import
|
|
1957
|
-
let o=
|
|
1998
|
+
talling its pin.");await ml(o,s)}for(let g of[a,c,l,p])await vP(g);let y=await jt(d);if(!y){let g=new Error("This topic \
|
|
1999
|
+
revision is being installed. Retry after the current owner operation finishes.");throw g.code="VIBE64_TRAINING_INSTALL_B\
|
|
2000
|
+
USY",g.statusCode=409,g}let w;try{await _e(d,!1,!1);for(let _ of[t,a,c,l,p])await _e(_,!0,!1);if(await _e(u,!0)){let _=await r.
|
|
2001
|
+
readTopic(s);return vi(_.pin,s),{installed:!1,..._}}await Ai(o),await ml(o,s);let g=W.join(a,`.install-${EP()}`);await hl(
|
|
2002
|
+
g,{mode:448}),w=g;let b=W.join(w,"training","content",s.topicId);await hl(b,{recursive:!0,mode:448});let E=W.join(b,s.commit);
|
|
2003
|
+
if(await gl(["bundle",o,E],{write(){}}),await ml(o,s),await AP(W.join(E,"pin.json"),`${k(s)}
|
|
2004
|
+
`,{flag:"wx",mode:384}),await Jr({systemRoot:w}).readTopic(s),await _e(l,!0,!1),await _e(u,!0))throw new Error("The dest\
|
|
2005
|
+
ination appeared during installation. Keep it unchanged and retry the verified pin.");await TP(E,u);let S=await r.readTopic(
|
|
2006
|
+
s);return vi(S.pin,s),{installed:!0,...S}}finally{try{w&&await OP(w,{recursive:!0,force:!0})}finally{await y()}}}return{
|
|
2007
|
+
installTopic:n}}var Vw=f(()=>{ii();Ti();yl();gt();pl()});var Gw=f(()=>{});import{randomUUID as IP}from"node:crypto";import{mkdir as RP,readFile as SW,rename as xP,rm as PP,writeFile as CP}from"node:fs/promises";
|
|
2008
|
+
import Ii from"node:path";async function Hw(e,t,{directoryMode:r,fileMode:n}={}){await RP(Ii.dirname(e),{recursive:!0,mode:r});
|
|
2009
|
+
let o=Ii.join(Ii.dirname(e),`.${Ii.basename(e)}.${process.pid}.${IP()}.tmp`);try{await CP(o,`${JSON.stringify(t,null,2)}\
|
|
1958
2010
|
|
|
1959
|
-
`,{encoding:"utf8",flag:"wx",mode:n}),await
|
|
1960
|
-
return Object.assign(new Error(t),{code:e,...r?{statusCode:r}:{},...n?{cause:n}:
|
|
1961
|
-
e)||e<0)throw new Error("Supply the expected revision from a fresh
|
|
1962
|
-
if(typeof e!="string"||!
|
|
1963
|
-
|
|
1964
|
-
n=
|
|
1965
|
-
|
|
1966
|
-
throw
|
|
1967
|
-
"Installed catalogue paths must be canonical directories and unaliased regular
|
|
1968
|
-
n&&
|
|
1969
|
-
rootExists:
|
|
1970
|
-
h.length>32)throw new Error("The approved course lock must contain every
|
|
1971
|
-
for(let
|
|
1972
|
-
topicHash:
|
|
1973
|
-
from the approved course lock.");
|
|
1974
|
-
|
|
1975
|
-
|
|
2011
|
+
`,{encoding:"utf8",flag:"wx",mode:n}),await xP(o,e)}finally{await PP(o,{force:!0})}}var qw=f(()=>{Gw()});import{createHash as NP}from"node:crypto";import{lstat as kP,mkdir as $P,readFile as MP,realpath as LP}from"node:fs/promises";
|
|
2012
|
+
import Fe from"node:path";function ue(e,t,r,n){return Object.assign(new Error(t),{code:e,...r?{statusCode:r}:{},...n?{cause:n}:
|
|
2013
|
+
{}})}function bl(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Supply the expected revision from a fresh installe\
|
|
2014
|
+
d catalogue read.")}function El({systemRoot:e}={}){if(typeof e!="string"||!Fe.isAbsolute(e)||Fe.resolve(e)!==e||e===Fe.parse(
|
|
2015
|
+
e).root)throw new Error("Installed catalogue needs a canonical absolute, non-root server-owned system root.");let t=Fe.join(
|
|
2016
|
+
e,"training"),r=Fe.join(t,"catalogue.json"),n=Fe.join(t,"catalogue.lock"),o=Jr({systemRoot:e});async function i(){let h=[
|
|
2017
|
+
t];for(let g=e;h.unshift(g),g!==Fe.dirname(g);g=Fe.dirname(g));let y=!1,w=null;for(let g of[...h,r,n]){let b;try{b=await kP(
|
|
2018
|
+
g)}catch(S){if(S.code==="ENOENT")continue;throw S}let E=g!==r&&g!==n;if(b.isSymbolicLink()||await LP(g)!==g||(E?!b.isDirectory():
|
|
2019
|
+
!b.isFile()||b.nlink!==1))throw new Error("Installed catalogue paths must be canonical directories and unaliased regular\
|
|
2020
|
+
files.");if(g===e&&(y=!0),g===r&&(w=b),g===n&&b.size!==0)throw new Error("Installed catalogue lock contains unexplained\
|
|
2021
|
+
data. Inspect it; do not unlink it.")}return{rootExists:y,catalogueStat:w}}async function s(h){let y=h.lock.topics;if(!Array.
|
|
2022
|
+
isArray(y)||y.length!==h.course.topics.length||y.length>32)throw new Error("The approved course lock must contain every \
|
|
2023
|
+
selected whole topic in order.");let w=[],g=[],b=[];for(let S of y){let _=st({schemaVersion:1,topicId:S?.topicId,release:S?.
|
|
2024
|
+
release,repository:S?.repository,commit:S?.commit,topicHash:S?.manifestHash}),T=await o.readTopic(_);if(k(T.pin)!==k(_))
|
|
2025
|
+
throw new Error("Installed topic identity differs from the approved course lock.");b.push({topicId:_.topicId,release:_.release,
|
|
2026
|
+
title:T.topicManifest.topic.title});for(let I of T.bundles)g.push({topicId:_.topicId,topicRelease:_.release,code:I.lesson.
|
|
2027
|
+
code,hash:I.hash,title:I.lesson.title});w.push({topicId:T.pin.topicId,release:T.release,repository:T.pin.repository,commit:T.
|
|
2028
|
+
pin.commit,topicManifest:T.topicManifest,topicHash:T.topicHash})}let E=qr(h.course,w);if(k(h.lock)!==k(E))throw new Error(
|
|
1976
2029
|
"The approved course lock differs from the complete installed topic inventory. Regenerate and review its exact release.");
|
|
1977
|
-
return
|
|
1978
|
-
|
|
1979
|
-
courses:[]};if(
|
|
1980
|
-
throw new Error("Installed catalogue exceeds its 1 MiB limit.");let
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
throw new Error("Installed catalogue contains duplicate course releases.");
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
before changing the catalogue.");try{await
|
|
1988
|
-
n);if(!
|
|
1989
|
-
operation finishes.",409);return
|
|
1990
|
-
|
|
1991
|
-
if(
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2030
|
+
return{lessonTitles:g,topicTitles:b}}async function a({includeLessonTitles:h=!1}={}){if(typeof h!="boolean")throw new TypeError(
|
|
2031
|
+
"Lesson title projection requires an explicit Boolean read option.");try{let{catalogueStat:y}=await i();if(!y)return{schemaVersion:1,
|
|
2032
|
+
revision:0,courses:[]};if(y.size>wl)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let w=await MP(r);if(w.
|
|
2033
|
+
length>wl)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let g=re(DP,JSON.parse(w.toString("utf8")),"In\
|
|
2034
|
+
stalled catalogue");if(g.courses.length?g.revision<1:g.revision!==0)throw new Error("Installed catalogue revision confli\
|
|
2035
|
+
cts with its course inventory.");let b=new Set;for(let E of g.courses){let S=`${E.course.courseId}@${E.course.release}`;
|
|
2036
|
+
if(b.has(S))throw new Error("Installed catalogue contains duplicate course releases.");b.add(S);let{lessonTitles:_,topicTitles:T}=await s(
|
|
2037
|
+
E);h&&Object.assign(E,{lessonTitles:_,topicTitles:T})}return g}catch(y){throw ue("VIBE64_TRAINING_CATALOGUE_INVALID",`In\
|
|
2038
|
+
stalled catalogue is invalid: ${y.message} Keep existing state and ask the owner to restore the exact approved catalogue\
|
|
2039
|
+
or pinned content. No automatic repair was performed.`,null,y)}}async function c(){let{rootExists:h}=await i();if(!h)throw new Error(
|
|
2040
|
+
"Prepare the server-owned system root before changing the catalogue.");try{await $P(t,{mode:448})}catch(w){if(w.code!=="\
|
|
2041
|
+
EEXIST")throw w}await i();let y=await jt(n);if(!y)throw ue("VIBE64_TRAINING_CATALOGUE_BUSY","Installed catalogue is bein\
|
|
2042
|
+
g updated. Retry after the current owner operation finishes.",409);return y}function l(h,y){if(h.revision!==y)throw ue("\
|
|
2043
|
+
VIBE64_TRAINING_CATALOGUE_REVISION_CONFLICT","Installed catalogue changed. Read its current revision before deliberately\
|
|
2044
|
+
retrying this enablement change.",409)}async function u(h,y){if(h.revision===Number.MAX_SAFE_INTEGER)throw new Error("I\
|
|
2045
|
+
nstalled catalogue reached its revision limit. No change was written.");let w={...h,revision:h.revision+1};if(Buffer.byteLength(
|
|
2046
|
+
`${JSON.stringify(w,null,2)}
|
|
2047
|
+
`)>wl)throw new Error("Installed catalogue exceeds its 1 MiB limit. No change was written.");try{await Hw(r,w,{directoryMode:448,
|
|
2048
|
+
fileMode:384})}catch(g){throw ue("VIBE64_TRAINING_CATALOGUE_SAVE_UNCONFIRMED","Catalogue save was not confirmed; atomic \
|
|
1995
2049
|
rename may already have succeeded. Read the current catalogue before deliberately retrying. Do not assume the course cha\
|
|
1996
|
-
nged or remained unchanged.",null,
|
|
1997
|
-
|
|
1998
|
-
try{let
|
|
1999
|
-
|
|
2050
|
+
nged or remained unchanged.",null,g)}return{revision:w.revision,entry:y,changed:!0}}async function p({course:h,lock:y,expectedRevision:w}={}){
|
|
2051
|
+
bl(w);let g=structuredClone(re(Ww,{course:h,lock:y,enabled:!0},"Approved installed course"));await a(),await s(g);let b=await c();
|
|
2052
|
+
try{let E=await a();l(E,w),await s(g);let S=E.courses.find(_=>_.course.courseId===g.course.courseId&&_.course.release===
|
|
2053
|
+
g.course.release);if(S){if(k(S.course)!==k(g.course)||k(S.lock)!==k(g.lock))throw ue("VIBE64_TRAINING_COURSE_RELEASE_CON\
|
|
2000
2054
|
FLICT","This installed course release is immutable. Resume its approved pin or publish and approve a different course re\
|
|
2001
|
-
lease.",409);return
|
|
2002
|
-
|
|
2003
|
-
courses.push(
|
|
2004
|
-
typeof
|
|
2005
|
-
"Disable an exact installed course ID and three-part release.");if(!(await a()).courses.some(
|
|
2006
|
-
course.release===
|
|
2007
|
-
ad the current catalogue before retrying.",404);let
|
|
2008
|
-
courseId===
|
|
2009
|
-
the catalogue. Read the current catalogue before retrying.",404);return
|
|
2010
|
-
revision,entry:
|
|
2011
|
-
()
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2055
|
+
lease.",409);return S.enabled?{revision:E.revision,entry:S,changed:!1}:(S.enabled=!0,await u(E,S))}if(E.courses.length>=
|
|
2056
|
+
Ri)throw new Error("Installed catalogue reached its 16 course-release limit. No retained release was removed.");return E.
|
|
2057
|
+
courses.push(g),await u(E,g)}finally{await b()}}async function d({courseId:h,release:y,expectedRevision:w}={}){if(bl(w),
|
|
2058
|
+
typeof h!="string"||!/^[a-z][a-z0-9-]{0,63}$/u.test(h)||typeof y!="string"||!/^\d+\.\d+\.\d+$/u.test(y))throw new Error(
|
|
2059
|
+
"Disable an exact installed course ID and three-part release.");if(!(await a()).courses.some(E=>E.course.courseId===h&&E.
|
|
2060
|
+
course.release===y))throw ue("VIBE64_TRAINING_COURSE_MISSING","This course release is not installed in the catalogue. Re\
|
|
2061
|
+
ad the current catalogue before retrying.",404);let b=await c();try{let E=await a();l(E,w);let S=E.courses.find(_=>_.course.
|
|
2062
|
+
courseId===h&&_.course.release===y);if(!S)throw ue("VIBE64_TRAINING_COURSE_MISSING","This course release is no longer in\
|
|
2063
|
+
the catalogue. Read the current catalogue before retrying.",404);return S.enabled?(S.enabled=!1,await u(E,S)):{revision:E.
|
|
2064
|
+
revision,entry:S,changed:!1}}finally{await b()}}async function m({title:h,topics:y,expectedRevision:w}={}){bl(w);let g=typeof h==
|
|
2065
|
+
"string"?h.trim():"";if(!g||g.length>120)throw ue("VIBE64_TRAINING_COURSE_INVALID","Name the course with 1 to 120 charac\
|
|
2066
|
+
ters.",400);if(!Array.isArray(y)||!y.length||y.length>32||new Set(y.map(A=>`${A?.topicId}@${A?.release}`)).size!==y.length||
|
|
2067
|
+
new Set(y.map(A=>A?.topicId)).size!==y.length)throw ue("VIBE64_TRAINING_COURSE_INVALID","Choose 1 to 32 different whole \
|
|
2068
|
+
topics for the course.",400);let b=await a(),E=b.courses.filter(A=>A.enabled&&A.course.status==="released").flatMap(A=>A.
|
|
2069
|
+
lock.topics),S=[];for(let A of y){let P=E.find(B=>B.topicId===A.topicId&&B.release===A.release);if(!P)throw ue("VIBE64_T\
|
|
2070
|
+
RAINING_COURSE_TOPIC_UNAVAILABLE",`Topic ${A.topicId}@${A.release} is not part of an enabled released course. Refresh co\
|
|
2071
|
+
urses and choose an installed topic.`,404);let j=await o.readTopic(st({schemaVersion:1,topicId:P.topicId,release:P.release,
|
|
2072
|
+
repository:P.repository,commit:P.commit,topicHash:P.manifestHash}));S.push({topicId:j.pin.topicId,release:j.release,repository:j.
|
|
2073
|
+
pin.repository,commit:j.pin.commit,topicManifest:j.topicManifest,topicHash:j.topicHash})}let T={schemaVersion:1,courseId:`\
|
|
2074
|
+
custom-${g.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,48).replace(/-+$/u,"")||NP("sha256").
|
|
2075
|
+
update(g).digest("hex").slice(0,12)}`,title:g,release:"1.0.0",status:"released",topics:y.map(A=>({topicId:A.topicId,release:A.
|
|
2076
|
+
release}))},I=b.courses.find(A=>A.course.courseId===T.courseId);if(I&&k(I.course)!==k(T))throw ue("VIBE64_TRAINING_COURS\
|
|
2077
|
+
E_EXISTS","A course with this name already exists. Choose another name.",409);if(!I&&b.courses.length>=Ri)throw ue("VIBE\
|
|
2078
|
+
64_TRAINING_COURSE_LIMIT",`This installation already has ${Ri} course releases. No course was created.`,409);return p({course:T,
|
|
2079
|
+
lock:qr(T,S),expectedRevision:w})}return{readCatalogue:a,enableCourse:p,disableCourse:d,createCourse:m}}var Ri,wl,Ww,DP,
|
|
2080
|
+
Yw=f(()=>{un();ii();qw();Ti();gt();sr();pl();Ri=16,wl=1024*1024,Ww=M({course:{type:"object",required:!0,schema:mn},lock:{
|
|
2081
|
+
type:"object",required:!0},enabled:{type:"boolean",required:!0}}),DP=M({schemaVersion:{type:"integer",required:!0,enum:[
|
|
2082
|
+
1]},revision:{type:"integer",required:!0,min:0,max:Number.MAX_SAFE_INTEGER},courses:Y(Ww,Ri)})});var Xw={};ub(Xw,{runTrainingCli:()=>gl});import{mkdir as Kw,readFile as xi,realpath as Xt,rename as jP,rm as Jw,writeFile as Sl}from"node:fs/promises";
|
|
2083
|
+
import z from"node:path";import{createHash as BP,randomUUID as UP}from"node:crypto";async function gl(e,{write:t=r=>console.
|
|
2015
2084
|
log(r)}={}){if(e[0]==="install-topic"){let[,c,l]=e;if(e.length!==3||!c||!l)throw new Error("Usage: vibe64 training insta\
|
|
2016
|
-
ll-topic <committed-topic-directory> <system-root>");let u=await
|
|
2017
|
-
u),
|
|
2018
|
-
{sourceRoot:u,pin:
|
|
2019
|
-
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await
|
|
2020
|
-
{systemRoot:
|
|
2021
|
-
e[0]==="disable-course"){let[c,l,u,d
|
|
2022
|
-
Number(
|
|
2085
|
+
ll-topic <committed-topic-directory> <system-root>");let u=await Xt(c),{topicId:p,release:d,repository:m,commit:h,topicHash:y}=await Hr(
|
|
2086
|
+
u),w={schemaVersion:1,topicId:p,release:d,repository:m,commit:h,topicHash:y},g=await zw({systemRoot:z.resolve(l)}).installTopic(
|
|
2087
|
+
{sourceRoot:u,pin:w});return t(JSON.stringify({ok:!0,installed:g.installed,pin:g.pin},null,2)),0}if(e[0]==="installed-co\
|
|
2088
|
+
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await El(
|
|
2089
|
+
{systemRoot:z.resolve(e[1])}).readCatalogue();return t(JSON.stringify({ok:!0,...c},null,2)),0}if(e[0]==="enable-course"||
|
|
2090
|
+
e[0]==="disable-course"){let[c,l,u,p,d]=e;if(e.length!==5||!l||!u||!p||!/^(0|[1-9][0-9]*)$/u.test(d||"")||!Number.isSafeInteger(
|
|
2091
|
+
Number(d)))throw new Error(c==="enable-course"?"Usage: vibe64 training enable-course <course.json> <course.lock.json> <s\
|
|
2023
2092
|
ystem-root> <expected-revision>":"Usage: vibe64 training disable-course <courseId> <release> <system-root> <expected-rev\
|
|
2024
|
-
ision>");let m=
|
|
2025
|
-
l,"utf8")),lock:JSON.parse(await
|
|
2026
|
-
return t(JSON.stringify({ok:!0,...
|
|
2027
|
-
"Usage: vibe64 training publish-manifest <course.json> <committed-topic-directory...>");let u=await
|
|
2028
|
-
|
|
2029
|
-
utput must not replace its input course descriptor.");let
|
|
2030
|
-
|
|
2031
|
-
must be outside every pinned source topic.");m.push(await
|
|
2093
|
+
ision>");let m=El({systemRoot:z.resolve(p)}),h=Number(d),y=c==="enable-course"?await m.enableCourse({course:JSON.parse(await xi(
|
|
2094
|
+
l,"utf8")),lock:JSON.parse(await xi(u,"utf8")),expectedRevision:h}):await m.disableCourse({courseId:l,release:u,expectedRevision:h});
|
|
2095
|
+
return t(JSON.stringify({ok:!0,...y},null,2)),0}if(e[0]==="publish-manifest"){let[,c,...l]=e;if(!c||!l.length)throw new Error(
|
|
2096
|
+
"Usage: vibe64 training publish-manifest <course.json> <committed-topic-directory...>");let u=await Xt(c),p=z.join(await Xt(
|
|
2097
|
+
z.dirname(z.resolve(c))),"course.lock.json");if(p===u||z.basename(c)==="course.lock.json")throw new Error("Course lock o\
|
|
2098
|
+
utput must not replace its input course descriptor.");let d=JSON.parse(await xi(u,"utf8")),m=[];for(let w of l){let g=await Xt(
|
|
2099
|
+
w),b=z.relative(g,p);if(!b||!b.startsWith(`..${z.sep}`)&&b!==".."&&!z.isAbsolute(b))throw new Error("Course lock output \
|
|
2100
|
+
must be outside every pinned source topic.");m.push(await Hr(g))}let h=qr(d,m),y=`${p}.tmp-${UP()}`;try{await Sl(y,`${k(
|
|
2032
2101
|
h)}
|
|
2033
|
-
`,{flag:"wx"}),await
|
|
2034
|
-
status,lockPath:
|
|
2102
|
+
`,{flag:"wx"}),await jP(y,p)}finally{await Jw(y,{force:!0})}return t(JSON.stringify({ok:!0,courseId:h.courseId,status:h.
|
|
2103
|
+
status,lockPath:p,topics:h.topics.length},null,2)),0}let[r,n,o]=e;if(!["validate","bundle"].includes(r)||!n||r==="bundle"&&
|
|
2035
2104
|
!o||e.length!==(r==="bundle"?3:2))throw new Error("Usage: vibe64 training validate <topic-directory> | bundle <topic-dir\
|
|
2036
|
-
ectory> <new-output-directory>");let i=await
|
|
2037
|
-
topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:l,status:u,required:
|
|
2038
|
-
code,hash:l,status:u,required:
|
|
2039
|
-
c)),u=
|
|
2040
|
-
be outside the source topic.");await
|
|
2041
|
-
let m=await
|
|
2042
|
-
ng bundling: ${
|
|
2043
|
-
h,m,{flag:"wx"})}await
|
|
2044
|
-
`,{flag:"wx"})}catch(
|
|
2045
|
-
status:s.topic.status,lessons:s.bundles.map(({lesson:c,hash:l,status:u})=>({code:c.code,hash:l,status:u}))},null,2)),0}var
|
|
2046
|
-
()=>{
|
|
2047
|
-
import
|
|
2048
|
-
|
|
2049
|
-
return JSON.stringify(String(e))}function
|
|
2050
|
-
|
|
2051
|
-
function
|
|
2052
|
-
cwd(),t=
|
|
2053
|
-
platform:r=
|
|
2054
|
-
test(String(t||""))}function
|
|
2055
|
-
n=>
|
|
2056
|
-
|
|
2105
|
+
ectory> <new-output-directory>");let i=await Xt(n),s=await ht(i),a={schemaVersion:1,topic:s.topic,release:s.release,topicHash:s.
|
|
2106
|
+
topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:l,status:u,required:p,manifest:d})=>({code:c.
|
|
2107
|
+
code,hash:l,status:u,required:p,manifest:d}))};if(r==="bundle"){let c=z.resolve(o),l=z.join(await Xt(z.dirname(c)),z.basename(
|
|
2108
|
+
c)),u=z.relative(i,l);if(!u||!u.startsWith(`..${z.sep}`)&&u!==".."&&!z.isAbsolute(u))throw new Error("Bundle output must\
|
|
2109
|
+
be outside the source topic.");await Kw(l);try{let p=He([s.topicManifest,...s.bundles.map(d=>d.manifest)]);for(let d of p){
|
|
2110
|
+
let m=await xi(z.join(i,d.path));if(BP("sha256").update(m).digest("hex")!==d.sha256)throw new Error(`Source changed duri\
|
|
2111
|
+
ng bundling: ${d.path}. Validate and retry.`);let h=z.join(l,"files",d.path);await Kw(z.dirname(h),{recursive:!0}),await Sl(
|
|
2112
|
+
h,m,{flag:"wx"})}await Sl(z.join(l,"bundle.json"),`${k(a)}
|
|
2113
|
+
`,{flag:"wx"})}catch(p){throw await Jw(l,{recursive:!0,force:!0}),p}}return t(JSON.stringify({ok:!0,topicId:s.topic.topicId,
|
|
2114
|
+
status:s.topic.status,lessons:s.bundles.map(({lesson:c,hash:l,status:u})=>({code:c.code,hash:l,status:u}))},null,2)),0}var yl=f(
|
|
2115
|
+
()=>{gt();Ti();Vw();Yw()});import{spawn as Qw}from"node:child_process";import{realpathSync as eb}from"node:fs";import{release as Pi}from"node:os";import C from"node:process";
|
|
2116
|
+
import Qt from"node:path";import{fileURLToPath as zP}from"node:url";var FP=new URL("./run.js",import.meta.url).href,tb=zP(
|
|
2117
|
+
FP),VP=Qt.dirname(tb),ct=Qt.join(VP,"server.js");function Zt(e=""){return`'${String(e).replaceAll("'","'\\''")}'`}function GP(e=""){
|
|
2118
|
+
return JSON.stringify(String(e))}function at(e=""){return`"${String(e).replaceAll('"','\\"')}"`}function HP(e="",t=[]){return[
|
|
2119
|
+
at(e),...t.map(r=>at(r))].join(" ")}function Zw(e,t=eb){let r=Qt.resolve(String(e||""));try{return t(r)}catch{return r}}
|
|
2120
|
+
function qP({argv:e=C.argv,entrypointPath:t=tb,realpath:r=eb}={}){let n=e[1];return n?Zw(n,r)===Zw(t,r):!1}function rb(e=C.
|
|
2121
|
+
cwd(),t=C.platform){return(t==="win32"?Qt.win32.basename(e):Qt.basename(e))||"target"}function WP({env:e=C.env,osReleaseText:t=Pi(),
|
|
2122
|
+
platform:r=C.platform}={}){return r!=="linux"?!1:String(e.WSL_DISTRO_NAME||e.WSL_INTEROP||"").trim()?!0:/\bmicrosoft\b|\bwsl\b/iu.
|
|
2123
|
+
test(String(t||""))}function YP({nodePath:e=C.execPath,serverPath:t=ct,serverArgs:r=[]}={}){return[Zt(e),Zt(t),...r.map(
|
|
2124
|
+
n=>Zt(n))].join(" ")}function KP({cwd:e=C.cwd(),nodePath:t=C.execPath,serverPath:r=ct,serverArgs:n=[]}={}){let o=[at(t),
|
|
2125
|
+
at(r),...n.map(i=>at(i))].join(" ");return[`cd /d ${at(e)}`,"if errorlevel 1 (set VIBE64_STATUS=!ERRORLEVEL! & echo. & e\
|
|
2057
2126
|
cho Vibe64 could not enter the target directory. Exit status !VIBE64_STATUS!. & set /p VIBE64_PAUSE=Press Enter to close\
|
|
2058
2127
|
this terminal... & exit /b !VIBE64_STATUS!)",o,"if errorlevel 1 (set VIBE64_STATUS=!ERRORLEVEL! & echo. & echo Vibe64 s\
|
|
2059
2128
|
erver exited with status !VIBE64_STATUS!. & set /p VIBE64_PAUSE=Press Enter to close this terminal... & exit /b !VIBE64_\
|
|
2060
2129
|
STATUS!)","exit /b 0"].join(`\r
|
|
2061
|
-
`)}function
|
|
2130
|
+
`)}function JP({cwd:e=C.cwd(),nodePath:t=C.execPath,serverArgs:r=[],serverPath:n=ct,title:o=`Vibe64 - ${Qt.basename(C.cwd())||
|
|
2062
2131
|
"target"}`}={}){return["finish_vibe64_terminal() {",' status="$1"',' message="$2"',' if [ "$status" -ne 0 ]; then',` \
|
|
2063
2132
|
printf '\\n%s Exit status %s. Press Enter to close this terminal...' "$message" "$status"`," IFS= read -r _"," fi",
|
|
2064
|
-
' exit "$status"',"}",`cd ${
|
|
2065
|
-
e64 could not enter the target directory."',"fi",`printf '\\033]0;%s\\007' ${
|
|
2133
|
+
' exit "$status"',"}",`cd ${Zt(e)}`,"status=$?",'if [ "$status" -ne 0 ]; then',' finish_vibe64_terminal "$status" "Vib\
|
|
2134
|
+
e64 could not enter the target directory."',"fi",`printf '\\033]0;%s\\007' ${Zt(o)}`,YP({nodePath:t,serverArgs:r,serverPath:n}),
|
|
2066
2135
|
'finish_vibe64_terminal "$?" "Vibe64 server exited."'].join(`
|
|
2067
|
-
`)}function
|
|
2068
|
-
distroName:e="",shellScript:t=""}={}){let r=String(e||"").trim();return[...r?["-d",r]:[],"--","bash","-lc",
|
|
2069
|
-
cwd:e=
|
|
2136
|
+
`)}function XP(e=""){return`printf %s ${Buffer.from(String(e||""),"utf8").toString("base64")} | base64 -d | bash`}function ZP({
|
|
2137
|
+
distroName:e="",shellScript:t=""}={}){let r=String(e||"").trim();return[...r?["-d",r]:[],"--","bash","-lc",XP(t)]}function QP({
|
|
2138
|
+
cwd:e=C.cwd(),env:t=C.env,shellScript:r="",title:n=`Vibe64 - ${rb(e,"linux")}`}={}){let o=ZP({distroName:t.WSL_DISTRO_NAME,
|
|
2070
2139
|
shellScript:r});return[{command:"wt.exe",args:["new-window","--title",n,"wsl.exe",...o]},{command:"cmd.exe",args:["/d","\
|
|
2071
|
-
/c",`start ${
|
|
2072
|
-
platform:o=
|
|
2140
|
+
/c",`start ${at(n)} ${HP("wsl.exe",o)}`]}]}function eC({cwd:e=C.cwd(),env:t=C.env,nodePath:r=C.execPath,osReleaseText:n=Pi(),
|
|
2141
|
+
platform:o=C.platform,serverArgs:i=[],serverPath:s=ct}={}){let a=`Vibe64 - ${rb(e,o)}`,c=JP({cwd:e,nodePath:r,serverArgs:i,
|
|
2073
2142
|
serverPath:s,title:a});if(o==="darwin")return[{command:"osascript",args:["-e",['tell application "Terminal"',"activate",
|
|
2074
|
-
`do script ${
|
|
2075
|
-
`)]}];if(o==="win32")return[{command:"cmd.exe",args:["/c","start",a,"cmd.exe","/v:on","/c",
|
|
2143
|
+
`do script ${GP(c)}`,"end tell"].join(`
|
|
2144
|
+
`)]}];if(o==="win32")return[{command:"cmd.exe",args:["/c","start",a,"cmd.exe","/v:on","/c",KP({cwd:e,nodePath:r,serverArgs:i,
|
|
2076
2145
|
serverPath:s})]}];let l=[t.TERMINAL?{command:t.TERMINAL,args:["-e","bash","-lc",c]}:null,{command:"x-terminal-emulator",
|
|
2077
2146
|
args:["-e","bash","-lc",c]},{command:"gnome-terminal",args:["--","bash","-lc",c]},{command:"konsole",args:["-e","bash","\
|
|
2078
|
-
-lc",c]},{command:"xfce4-terminal",args:["--command",`bash -lc ${
|
|
2079
|
-
filter(Boolean);return
|
|
2080
|
-
return new Promise((n,o)=>{let i=
|
|
2081
|
-
n(i)})})}async function
|
|
2082
|
-
serverPath:s=
|
|
2083
|
-
try{return await
|
|
2084
|
-
al emulator could be started.")}async function
|
|
2085
|
-
let i=
|
|
2086
|
-
s(1);return}s(Number(c||0))})})}async function
|
|
2087
|
-
platform:o=
|
|
2147
|
+
-lc",c]},{command:"xfce4-terminal",args:["--command",`bash -lc ${Zt(c)}`]},{command:"xterm",args:["-e","bash","-lc",c]}].
|
|
2148
|
+
filter(Boolean);return WP({env:t,osReleaseText:n,platform:o})?[...QP({cwd:e,env:t,shellScript:c,title:a}),...l]:l}function tC(e,t=[],r={}){
|
|
2149
|
+
return new Promise((n,o)=>{let i=Qw(e,t,{...r,detached:!0,stdio:"ignore"});i.once("error",o),i.once("spawn",()=>{i.unref(),
|
|
2150
|
+
n(i)})})}async function rC({cwd:e=C.cwd(),env:t=C.env,nodePath:r=C.execPath,osReleaseText:n=Pi(),platform:o=C.platform,serverArgs:i=[],
|
|
2151
|
+
serverPath:s=ct}={}){let a=eC({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),c=[];for(let l of a)
|
|
2152
|
+
try{return await tC(l.command,l.args,{cwd:e,env:t}),l}catch(u){c.push(u)}throw new AggregateError(c,"No supported termin\
|
|
2153
|
+
al emulator could be started.")}async function nC({cwd:e=C.cwd(),env:t=C.env,nodePath:r=C.execPath,serverArgs:n=[],serverPath:o=ct}={}){
|
|
2154
|
+
let i=Qw(r,[o,...n],{cwd:e,env:t,stdio:"inherit"});return new Promise((s,a)=>{i.once("error",a),i.once("exit",(c,l)=>{if(l){
|
|
2155
|
+
s(1);return}s(Number(c||0))})})}async function oC({cwd:e=C.cwd(),env:t=C.env,nodePath:r=C.execPath,osReleaseText:n=Pi(),
|
|
2156
|
+
platform:o=C.platform,serverArgs:i=C.argv.slice(2),serverPath:s=ct}={}){try{return await rC({cwd:e,env:t,nodePath:r,osReleaseText:n,
|
|
2088
2157
|
platform:o,serverArgs:i,serverPath:s}),console.log("Vibe64 is starting in a new terminal window."),0}catch(a){return console.
|
|
2089
|
-
warn(`${a.message} Starting Vibe64 in this terminal instead.`),
|
|
2090
|
-
(
|
|
2091
|
-
t=>{
|
|
2092
|
-
|
|
2093
|
-
|
|
2158
|
+
warn(`${a.message} Starting Vibe64 in this terminal instead.`),nC({cwd:e,env:t,nodePath:r,serverArgs:i,serverPath:s})}}qP()&&
|
|
2159
|
+
(C.argv[2]==="training"?Promise.resolve().then(()=>(yl(),Xw)).then(({runTrainingCli:t})=>t(C.argv.slice(3))):oC()).then(
|
|
2160
|
+
t=>{C.exitCode=t}).catch(t=>{console.error("Failed to run Vibe64:",t),C.exitCode=1});export{ct as SERVER_ENTRYPOINT,qP as isDirectCliExecution,WP as isWslEnvironment,rC as launchInNewTerminal,Zt as quoteShellArg,
|
|
2161
|
+
oC as runLauncher,YP as serverShellCommand,KP as serverWindowsCommand,rb as targetNameFromCwd,eC as terminalLaunchCandidates,
|
|
2162
|
+
JP as terminalShellScript,ZP as wslServerCommandArgs,QP as wslTerminalLaunchCandidates};
|