@kern0x1b/penstock-cli 26.11.0 → 26.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +16 -16
- package/dist/chunk-account-BaYNvO18.js +1 -0
- package/dist/{chunk-agentLaunch-D21uPuMr.js → chunk-agentLaunch-BnrpVME4.js} +1 -1
- package/dist/chunk-agentServe-BeOh1rjE.js +10 -0
- package/dist/chunk-agents-CZJoU2u2.js +1 -0
- package/dist/chunk-agentsMigrate-DnrqoXNz.js +2 -0
- package/dist/{chunk-analyze-BG-rlggA.js → chunk-analyze-ClE2LBCj.js} +1 -1
- package/dist/chunk-analyze-DgQqzEgb.js +1 -0
- package/dist/{chunk-analyzeFlow-2cYPgjh-.js → chunk-analyzeFlow-F2ZFmJhv.js} +1 -1
- package/dist/chunk-apiTemplates-Cl_z63FA.js +1 -0
- package/dist/{chunk-bot-DlhStBoG.js → chunk-bot-C2k8yaXA.js} +5 -5
- package/dist/chunk-cmmnFindings-DKpYqUZN.js +1 -0
- package/dist/{chunk-codeFactSet-LxSnQy8K.js → chunk-codeFactSet-DiAYqvbb.js} +1 -1
- package/dist/{chunk-codeIndex-N1gnP_sW.js → chunk-codeIndex-vStNh6Bm.js} +1 -1
- package/dist/chunk-codeLinks-BVpn4_Sr.js +1 -0
- package/dist/chunk-codeLinks-BrGduhsm.js +1 -0
- package/dist/chunk-command-8s6m3ZUw.js +5 -0
- package/dist/chunk-command-aMxPQdiV.js +1 -0
- package/dist/chunk-command-vH1_y5F0.js +1 -0
- package/dist/chunk-commands-B8YVT41b.js +5 -0
- package/dist/{chunk-commands-DcjlDt7B.js → chunk-commands-CJCSznbv.js} +1 -1
- package/dist/chunk-compose-BUJTvoFX.js +4 -0
- package/dist/chunk-connections-Drr67X9U.js +1 -0
- package/dist/chunk-connectors-DcMqy0u8.js +1 -0
- package/dist/chunk-convert-Ce1MZmsE.js +3 -0
- package/dist/chunk-convert-FkMnlxyi.js +1 -0
- package/dist/chunk-deploy-BHg8pB9x.js +1 -0
- package/dist/chunk-deploy-DZgCTgaY.js +6 -0
- package/dist/{chunk-diagrams-BukAOL0g.js → chunk-diagrams-CtGMGTa8.js} +1 -1
- package/dist/chunk-diff-9hjavV6V.js +1 -0
- package/dist/chunk-diff-Dp3fUALc.js +1 -0
- package/dist/chunk-dispatch-o-eqJb9Y.js +7 -0
- package/dist/chunk-dmnTests-BOxutoRs.js +1 -0
- package/dist/{chunk-dmnTests-ChwX1YVo.js → chunk-dmnTests-BzNA-u2k.js} +1 -1
- package/dist/{chunk-docs-D7yEDpa4.js → chunk-docs-B3C3pZpY.js} +17 -17
- package/dist/chunk-doctor-CRxbsAm7.js +1 -0
- package/dist/{chunk-editPreview-CC2vwhIW.js → chunk-editPreview-DCUnMkTU.js} +1 -1
- package/dist/chunk-evidence-ny_2ltVe.js +23 -0
- package/dist/{chunk-examples-0HkF-frb.js → chunk-examples-BG0lGXcZ.js} +9 -9
- package/dist/chunk-export-Blwjf23H.js +1 -0
- package/dist/chunk-export-kt3sBTZu.js +20 -0
- package/dist/{chunk-facts-DSVaURw5.js → chunk-facts-Dl5lLriU.js} +1 -1
- package/dist/chunk-failure-BRyRvObj.js +1 -0
- package/dist/{chunk-file-BswMa3FN.js → chunk-file-1YhfNmPn.js} +1 -1
- package/dist/chunk-import-Dh3az4BC.js +6 -0
- package/dist/chunk-importCommand-Dhikkmo0.js +1 -0
- package/dist/chunk-incident-LJe2-ohi.js +1 -0
- package/dist/chunk-init-D34Q4YA8.js +227 -0
- package/dist/chunk-lint-CnEhoYRB.js +1 -0
- package/dist/{chunk-lsp-7vA_mIt1.js → chunk-lsp-BzeJkpmf.js} +1 -1
- package/dist/chunk-main-BZF-ErAx.js +1 -0
- package/dist/chunk-mcp-B_B9bet5.js +95 -0
- package/dist/{chunk-mcpLaunch-LyfmIF_Z.js → chunk-mcpLaunch-BS709697.js} +1 -1
- package/dist/chunk-migrate-DVfXC-iJ.js +1 -0
- package/dist/chunk-migrate-DwWg0k5_.js +16 -0
- package/dist/{chunk-migrateApply-CzOkgKhB.js → chunk-migrateApply-e8O9oZXP.js} +3 -3
- package/dist/chunk-migrateVerify-oIBf-PM3.js +1 -0
- package/dist/{chunk-model-f8AzYUK7.js → chunk-model-BulEKnY1.js} +2 -2
- package/dist/{chunk-parse-B-uKGDy-.js → chunk-parse-DiOcpdOU.js} +1 -1
- package/dist/{chunk-penstockCli-CKMvaZ0O.js → chunk-penstockCli-C41P_G7i.js} +1 -1
- package/dist/chunk-policy-BVb7c7G_.js +1 -0
- package/dist/chunk-policyGate-BOgKsqLq.js +2 -0
- package/dist/chunk-pr-1jKcTNnP.js +1 -0
- package/dist/{chunk-project-DBYOlYRi.js → chunk-project-COaBZhMt.js} +1 -1
- package/dist/chunk-project-lO_6DX8G.js +1 -0
- package/dist/chunk-promotion-CTMPjXjZ.js +2 -0
- package/dist/chunk-promotion-DDLrgBqZ.js +1 -0
- package/dist/{chunk-promotion-DchO6xoC.js → chunk-promotion-NeRj4uTP.js} +1 -1
- package/dist/chunk-receipt-C4NqnSkH.js +1 -0
- package/dist/chunk-receiptDeps-B7MehyHT.js +1 -0
- package/dist/chunk-receiptGate-BZCKCMTV.js +1 -0
- package/dist/chunk-receiptGate-DRcw327y.js +1 -0
- package/dist/{chunk-receiptSnapshot-B6ruXw8z.js → chunk-receiptSnapshot-CHSk3_4N.js} +1 -1
- package/dist/{chunk-receiptStore-Cy-L0H1u.js → chunk-receiptStore-DhROtI2h.js} +1 -1
- package/dist/chunk-refactor-CO3qyIEv.js +17 -0
- package/dist/chunk-refactor-CWeCOl7w.js +1 -0
- package/dist/{chunk-render-Ci5d6mg4.js → chunk-render-DZd5hScS.js} +1 -1
- package/dist/chunk-report-w7YZwhyg.js +1 -0
- package/dist/chunk-review-DYMgFDSy.js +1 -0
- package/dist/chunk-say-CP1IyOSv.js +1 -0
- package/dist/{chunk-security-VgKwtohm.js → chunk-security-pgip-kdY.js} +2 -2
- package/dist/chunk-serve-CKt2rO05.js +10 -0
- package/dist/{chunk-share-CBV2FuKq.js → chunk-share-rsL0itIM.js} +18 -18
- package/dist/chunk-stages-B2sBBxUc.js +3 -0
- package/dist/chunk-systemError-O3vQ8hLb.js +1 -0
- package/dist/chunk-systemError-n2E6isvg.js +1 -0
- package/dist/chunk-taskTest-DWoME1mY.js +2 -0
- package/dist/chunk-taskTest-JErgWO6t.js +1 -0
- package/dist/{chunk-templateDiagnostics-BwH7RNkz.js → chunk-templateDiagnostics-6txfKwas.js} +2 -2
- package/dist/chunk-templates-Y3xfCO_3.js +1 -0
- package/dist/chunk-testCases-BwimUfDC.js +4 -0
- package/dist/chunk-testCases-DO2Rkyvd.js +1 -0
- package/dist/chunk-tests-Cy325OGw.js +1 -0
- package/dist/chunk-tests-DNkORsqB.js +23 -0
- package/dist/{chunk-trust-DXcsUJaK.js → chunk-trust-DSX-k3by.js} +1 -1
- package/dist/{chunk-trust-DubjEjlN.js → chunk-trust-Di4EYPah.js} +1 -1
- package/dist/{chunk-variableChecks-KnECGMR3.js → chunk-variableChecks-CBDpmI4d.js} +1 -1
- package/dist/{chunk-workerVariables-CajAcbwl.js → chunk-workerVariables-CNnCRijJ.js} +1 -1
- package/dist/{chunk-workerVariables-DIDoUpHF.js → chunk-workerVariables-CulLc3YH.js} +1 -1
- package/dist/chunk-wrapper-CGYED7G2.js +1 -0
- package/dist/chunk-wrapper-CK7Xtes6.js +3 -0
- package/dist/grammars/web-tree-sitter.wasm +0 -0
- package/dist/penstock.js +1 -1
- package/dist/web/assets/{AgentSettings-Cn5Vcph3.js → AgentSettings-D24jOuht.js} +1 -1
- package/dist/web/assets/{AgentsDialog-C6WqzlxZ.js → AgentsDialog-BMWv3Gyk.js} +1 -1
- package/dist/web/assets/{AgentsDialog-dpbwVSxk.js → AgentsDialog-DbY2O6O5.js} +1 -1
- package/dist/web/assets/{AgentsTab-C34OhVkw.js → AgentsTab-D6LbK6sG.js} +2 -2
- package/dist/web/assets/{BpmnCanvas-yur9daZa.js → BpmnCanvas-BcQRQ2Br.js} +27 -27
- package/dist/web/assets/BpmnDocument-Ce5F4K1e.js +27 -0
- package/dist/web/assets/CmmnDocument-C_UlPowC.js +17 -0
- package/dist/web/assets/{ConflictDialog-Bb5kduaR.js → ConflictDialog-DfFp8F7n.js} +1 -1
- package/dist/web/assets/{ConnectionsDialog-qtF7yDFw.js → ConnectionsDialog-BaYtHD5h.js} +1 -1
- package/dist/web/assets/{DiffDocument-LHOif5Ac.js → DiffDocument-BOPdBEN3.js} +1 -1
- package/dist/web/assets/{DmnDocument-0f5uS67x.css → DmnDocument-DZ9u2uk2.css} +1 -1
- package/dist/web/assets/DmnDocument-vtnARy7Q.js +41 -0
- package/dist/web/assets/{DriftDialog-Chl6BX6k.js → DriftDialog-dIbCbSK2.js} +1 -1
- package/dist/web/assets/FormDocument-B0q8DF9v.css +1 -0
- package/dist/web/assets/FormDocument-DHBUBUzO.js +32 -0
- package/dist/web/assets/FormStepView-CbHb32_8.js +1 -0
- package/dist/web/assets/{GraphAwareLayoutService-wsos3yPD.js → GraphAwareLayoutService-C5N8K9dm.js} +1 -1
- package/dist/web/assets/{MigrationDialog-CBJU7Oe3.js → MigrationDialog-DA3Vrzgw.js} +1 -1
- package/dist/web/assets/{NewFileDialog-B7075LWG.js → NewFileDialog-Dev41oA1.js} +1 -1
- package/dist/web/assets/PolicyDialog-qR19Csji.js +1 -0
- package/dist/web/assets/{QuickOpen-DJQrI7Od.js → QuickOpen-ps-rMjiS.js} +1 -1
- package/dist/web/assets/ScriptPane-BQLMNYzc.js +2 -0
- package/dist/web/assets/{ScriptRunDialog-BwE4cXnp.js → ScriptRunDialog-YivjHB6j.js} +1 -1
- package/dist/web/assets/{SettingsDialog-c307wPsg.js → SettingsDialog-DI0vZ6Ay.js} +1 -1
- package/dist/web/assets/ShortcutsDialog-DLXnv4Vm.js +1 -0
- package/dist/web/assets/SourceDocument-Cj8cGsoS.js +1 -0
- package/dist/web/assets/TemplateDocument-BRyFsofH.js +7 -0
- package/dist/web/assets/TextDocument-DB2hEuMA.js +1 -0
- package/dist/web/assets/{UnreadableFileLayer-CUP_30X8.js → UnreadableFileLayer-CRW3MM7w.js} +1 -1
- package/dist/web/assets/{UploadDialog-CaVBOxUL.js → UploadDialog-D-X6GG98.js} +1 -1
- package/dist/web/assets/Viewer-BcpDlvg_.js +4 -0
- package/dist/web/assets/apply-Nsj6ek02.js +1 -0
- package/dist/web/assets/{bpmnTheme-CZ7xp4R5.js → bpmnTheme-pKgl9Mrn.js} +2 -2
- package/dist/web/assets/{data-ZauKnQ2Z.js → data-CdiToGOq.js} +2 -2
- package/dist/web/assets/{data-Da5Nxzev.js → data-wU6sw6RY.js} +1 -1
- package/dist/web/assets/{dialog-DSLu1Bbo.js → dialog-BDJ5dDiU.js} +1 -1
- package/dist/web/assets/{diff-C4hitkRR.js → diff-BhYqTg4l.js} +1 -1
- package/dist/web/assets/dist-27z6Phtg.js +23 -0
- package/dist/web/assets/{dist-CofBTWz1.js → dist-B7TL-7R3.js} +4 -4
- package/dist/web/assets/dist-BEpeEbIu.js +1 -0
- package/dist/web/assets/{dist-CYCbBoYQ.js → dist-BTf7NfeQ.js} +1 -1
- package/dist/web/assets/{dist-CJKVV2_S.js → dist-BqGv7f4M.js} +10 -10
- package/dist/web/assets/dist-C-q1IWjr.js +6 -0
- package/dist/web/assets/{dist-Blylfrak.js → dist-CJx_2eBF.js} +2 -2
- package/dist/web/assets/dist-COUY_jv5.js +1 -0
- package/dist/web/assets/{dist-DpDu6Wz_.js → dist-CWjAtsKe.js} +1 -1
- package/dist/web/assets/{dist-gb3IfUZi.js → dist-Cv8_A_95.js} +2 -2
- package/dist/web/assets/dist-DDE6BjgI.js +5 -0
- package/dist/web/assets/{dist-7VC_hKpw.js → dist-DDNYYQtV.js} +1 -1
- package/dist/web/assets/dist-DW-S9iZN.js +1 -0
- package/dist/web/assets/dist-OnU5n5o1.js +1 -0
- package/dist/web/assets/dmn-Cgoh6wXm.js +3 -0
- package/dist/web/assets/{documentBridge-1Eg7H9yI.js → documentBridge-CHw4XsZH.js} +3 -3
- package/dist/web/assets/{documents-LG-7CTrn.js → documents-CEtohzAC.js} +1 -1
- package/dist/web/assets/duplicate-D_ic-m62.js +342 -0
- package/dist/web/assets/{engines-DhO6OW1S.js → engines-lyEvb0pH.js} +1 -1
- package/dist/web/assets/{executable-BTarDLry.js → executable--4381_Lf.js} +1 -1
- package/dist/web/assets/{file-CIeVSOHy.js → file-BbVBUuIH.js} +1 -1
- package/dist/web/assets/formChecks-CSClH9sH.js +1 -0
- package/dist/web/assets/frontend-uXAWaalt.js +1 -0
- package/dist/web/assets/{httpHost-DBSjdVth.js → httpHost-C973OTRe.js} +1 -1
- package/dist/web/assets/{index.es-pigASDxC.js → index.es-CMvq8Bhe.js} +3 -3
- package/dist/web/assets/index.es-GbdJvMnO.js +78 -0
- package/dist/web/assets/{index.esm-CTLpq4ik.js → index.esm-Ba6q0zSu.js} +1 -1
- package/dist/web/assets/{intelligence-_1C71hkQ.js → intelligence-DNqJNmdB.js} +3 -3
- package/dist/web/assets/{jspdf.es.min-PgZzOmkT.js → jspdf.es.min-C0L4zezU.js} +6 -6
- package/dist/web/assets/{kind-X3_nabTt.js → kind-DDHnk6dW.js} +1 -1
- package/dist/web/assets/{lib-BmLAen_d.js → lib-DrkEMJ65.js} +1 -1
- package/dist/web/assets/{list-DovB9lWV.js → list-TmXvCwja.js} +1 -1
- package/dist/web/assets/{migrationHost-BcguK4K5.js → migrationHost-DCWBb3L6.js} +1 -1
- package/dist/web/assets/moddle-f0Q4Guwd.js +1 -0
- package/dist/web/assets/{model--Bj28IOj.js → model-afHgSxJs.js} +1 -1
- package/dist/web/assets/{nudges-UF9_cBuO.js → nudges-DPG3WpyV.js} +1 -1
- package/dist/web/assets/{open-C9Kt9JLw.js → open-Vkx72dYx.js} +1 -1
- package/dist/web/assets/platform-G53Cenyw.js +2 -0
- package/dist/web/assets/{preload-helper-VRuDKI9K.js → preload-helper-DExCAR_V.js} +1 -1
- package/dist/web/assets/{run-BZgz1U9U.js → run-BMfRBe5O.js} +1 -1
- package/dist/web/assets/samples-BL3jA_Vd.js +1 -0
- package/dist/web/assets/{say-WvEHqIbO.js → say-BkdZMivA.js} +1 -1
- package/dist/web/assets/{say-ChFGKK2E.js → say-C7KqKcFr.js} +1 -1
- package/dist/web/assets/{sections-N6WYk7b8.js → sections-LJKSRDTS.js} +1 -1
- package/dist/web/assets/sharedReader-BsXfiBT8.js +1 -0
- package/dist/web/assets/{source-frame-DcptKpVq.js → source-frame-DC4W0A5-.js} +2 -2
- package/dist/web/assets/{syntax-DW10Wzg4.js → syntax-00Hk6Xv7.js} +4 -4
- package/dist/web/assets/{template-CMl68jPp.js → template-BQP7ZXdK.js} +1 -1
- package/dist/web/assets/testCaseRuns-liAhWMg7.js +1 -0
- package/dist/web/assets/{trace-DLziNpe2.js → trace-DXQU2N_l.js} +1 -1
- package/dist/web/assets/{translator-DLDFsUlE.js → translator-BLCeE6UY.js} +1 -1
- package/dist/web/assets/ui-BLtm3Y1J.js +1 -0
- package/dist/web/assets/{useTrace-UYBskc2k.js → useTrace-dZdQ805W.js} +1 -1
- package/dist/web/assets/web-C4k0NLZ9.js +982 -0
- package/dist/web/assets/web-CnDpD6qy.css +1 -0
- package/dist/web/assets/{workerVariables-DURgyUbG.js → workerVariables-O6VqwDzr.js} +1 -1
- package/dist/web/assets/xml-DIWt4von.js +1 -0
- package/dist/web/index.html +39 -40
- package/package.json +5 -5
- package/dist/chunk-account-CpZu-RTg.js +0 -1
- package/dist/chunk-agentServe-BYRtgGGD.js +0 -10
- package/dist/chunk-agents-B9oxdPTA.js +0 -1
- package/dist/chunk-agentsMigrate-BV8TeRXq.js +0 -2
- package/dist/chunk-analyze-pgzR-Cx-.js +0 -1
- package/dist/chunk-apiTemplates-cU7C8vap.js +0 -1
- package/dist/chunk-cmmnFindings-S2TGSnEp.js +0 -1
- package/dist/chunk-codeLinks-C8N6e8k3.js +0 -1
- package/dist/chunk-codeLinks-o0a8tBGk.js +0 -1
- package/dist/chunk-command-Bqlbgo-2.js +0 -1
- package/dist/chunk-command-DT84ioJb.js +0 -5
- package/dist/chunk-command-DrGP2kg8.js +0 -1
- package/dist/chunk-commands-B4PoZbpX.js +0 -5
- package/dist/chunk-compose-CWKKVtN5.js +0 -4
- package/dist/chunk-connections-DQpKbIGD.js +0 -1
- package/dist/chunk-connectors-PtAvE91B.js +0 -1
- package/dist/chunk-convert-CpgtOlZk.js +0 -1
- package/dist/chunk-convert-HbFpg8ab.js +0 -3
- package/dist/chunk-deploy-l4MdFfn8.js +0 -6
- package/dist/chunk-deploy-qRaaKGZb.js +0 -1
- package/dist/chunk-diff-BhTFlCE3.js +0 -1
- package/dist/chunk-diff-kBF83vzM.js +0 -1
- package/dist/chunk-dispatch-BnO-QhMh.js +0 -7
- package/dist/chunk-dmnTests-0x_yUH6S.js +0 -1
- package/dist/chunk-doctor-BuHK1dTm.js +0 -1
- package/dist/chunk-evidence-oLw_C6j8.js +0 -23
- package/dist/chunk-export-cIFHDXug.js +0 -1
- package/dist/chunk-export-jBVxtmCH.js +0 -20
- package/dist/chunk-failure-D5brrYW2.js +0 -1
- package/dist/chunk-import-BBOe-5RZ.js +0 -6
- package/dist/chunk-importCommand-DRjYoljA.js +0 -1
- package/dist/chunk-incident-BK1h37CD.js +0 -1
- package/dist/chunk-init-_OALJuKm.js +0 -227
- package/dist/chunk-lint-7KJFxyCN.js +0 -1
- package/dist/chunk-main-Cw2JXCil.js +0 -1
- package/dist/chunk-mcp-K63bhqnF.js +0 -95
- package/dist/chunk-migrate-BMwBV5sc.js +0 -16
- package/dist/chunk-migrate-CxfVmKt0.js +0 -1
- package/dist/chunk-migrateVerify-DSEXSpfR.js +0 -1
- package/dist/chunk-policy-BX0Ftdws.js +0 -1
- package/dist/chunk-policyGate-dmcufnwB.js +0 -2
- package/dist/chunk-pr-ByrGcfam.js +0 -1
- package/dist/chunk-project-DA3KnAZH.js +0 -1
- package/dist/chunk-promotion-Boedyq43.js +0 -1
- package/dist/chunk-promotion-D8Ti-vxp.js +0 -2
- package/dist/chunk-receipt-CusJaqNn.js +0 -1
- package/dist/chunk-receiptDeps-oVbX156d.js +0 -1
- package/dist/chunk-receiptGate-DrGChj7i.js +0 -1
- package/dist/chunk-receiptGate-xldHKMyJ.js +0 -1
- package/dist/chunk-refactor-B1W_MGTp.js +0 -1
- package/dist/chunk-refactor-BJXxEtVs.js +0 -17
- package/dist/chunk-report-D9pM09Nu.js +0 -1
- package/dist/chunk-review-UcqS5AAi.js +0 -1
- package/dist/chunk-say-CYb4HeJD.js +0 -1
- package/dist/chunk-serve-Dmqen1yd.js +0 -10
- package/dist/chunk-stages-BTQJrAMF.js +0 -3
- package/dist/chunk-systemError-BYrMzp2o.js +0 -1
- package/dist/chunk-systemError-CXvnhNPK.js +0 -1
- package/dist/chunk-taskTest-9gMsx0zu.js +0 -2
- package/dist/chunk-taskTest-BjXYpG5p.js +0 -1
- package/dist/chunk-templates-D3ouIwHD.js +0 -1
- package/dist/chunk-testCases-9jwT_Y7z.js +0 -4
- package/dist/chunk-testCases-BcpBPg9L.js +0 -1
- package/dist/chunk-tests-CEEXnWOp.js +0 -23
- package/dist/chunk-tests-CRVosdWp.js +0 -1
- package/dist/chunk-wrapper-B2WnOIoB.js +0 -3
- package/dist/chunk-wrapper-DiKCKZti.js +0 -1
- package/dist/web/assets/BpmnDocument-C247Rqim.js +0 -27
- package/dist/web/assets/CmmnDocument-Dj48bsUd.js +0 -17
- package/dist/web/assets/DmnDocument-Cb9Zi9fS.js +0 -41
- package/dist/web/assets/FormDocument-DoZaxWd-.js +0 -32
- package/dist/web/assets/FormDocument-URLcKn84.css +0 -1
- package/dist/web/assets/FormStepView-D8MFcpeI.js +0 -1
- package/dist/web/assets/PolicyDialog-CGdglmDn.js +0 -1
- package/dist/web/assets/ScriptPane-T6M5f6fc.js +0 -2
- package/dist/web/assets/ShortcutsDialog-BAoL9EHu.js +0 -1
- package/dist/web/assets/SourceDocument-C9KIzBA5.js +0 -1
- package/dist/web/assets/TemplateDocument-CNt2turg.js +0 -7
- package/dist/web/assets/TextDocument-CtkHoEqN.js +0 -1
- package/dist/web/assets/Viewer-DZske1C5.js +0 -4
- package/dist/web/assets/apply-nnKP9HIM.js +0 -1
- package/dist/web/assets/dist--PmHUHDp.js +0 -1
- package/dist/web/assets/dist-BoPrKCf2.js +0 -5
- package/dist/web/assets/dist-C1m02xAO.js +0 -1
- package/dist/web/assets/dist-CLqJMzT-.js +0 -1
- package/dist/web/assets/dist-D3jqq0XS.js +0 -1
- package/dist/web/assets/dist-DA-9F0U9.js +0 -1
- package/dist/web/assets/dist-DojzF5q2.js +0 -6
- package/dist/web/assets/dist-yvjzrXXf.js +0 -23
- package/dist/web/assets/dmn-DwdcYXGr.js +0 -3
- package/dist/web/assets/duplicate-D-ilQqKz.js +0 -342
- package/dist/web/assets/formChecks-CGox1z7R.js +0 -1
- package/dist/web/assets/frontend-Qq5hBH0U.js +0 -1
- package/dist/web/assets/index.es-CcNNw3VB.js +0 -78
- package/dist/web/assets/moddle-DJxj0oEU.js +0 -1
- package/dist/web/assets/platform-BLPhsye9.js +0 -2
- package/dist/web/assets/samples-oeXBsJ9Y.js +0 -1
- package/dist/web/assets/sharedReader-Bopy7Uk9.js +0 -1
- package/dist/web/assets/testCaseRuns-B_XdqGFh.js +0 -1
- package/dist/web/assets/ui-BTKMbWYG.js +0 -1
- package/dist/web/assets/web-FzNBw1kZ.css +0 -1
- package/dist/web/assets/web-jPMZVwbQ.js +0 -982
- package/dist/web/assets/xml-DTgZ-B-l.js +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FormStepView-CbHb32_8.js","./rolldown-runtime-B8BYMn-z.js","./vendor-NJP34MHU.js","./index.es-GbdJvMnO.js","./dist-BqwyxNP3.js","./dist-CRJyslwo.js","./lib-DrkEMJ65.js","./translator-BLCeE6UY.js","./preload-helper-DExCAR_V.js","./dist-DHrd1AHo.js","./dist-CdHwU8_m.js","./purify.es-DBLk-NVl.js","./dist-C-q1IWjr.js","./bridgeInstance-qzSInqLW.js","./platform-G53Cenyw.js","./frontend-uXAWaalt.js","./dialog-BDJ5dDiU.js","./xml-DIWt4von.js","./dist-BT_v6mN5.js","./httpHost-C973OTRe.js","./ui-BLtm3Y1J.js","./docs-B2ZDPeJU.js","./AgentsTab-D6LbK6sG.js","./model-afHgSxJs.js","./dist-DDE6BjgI.js","./dist-BrFvWnvj.js","./dist-Bb5-DGtZ.js","./data-wU6sw6RY.js","./moddle-f0Q4Guwd.js","./dist-B7TL-7R3.js","./descriptors-B5VIyY5g.js","./sharedReader-BsXfiBT8.js","./workerVariables-O6VqwDzr.js","./dmn-Cgoh6wXm.js","./steps-BB_6M1MU.js","./data-CdiToGOq.js","./file-BbVBUuIH.js","./testCaseRuns-liAhWMg7.js","./engines-lyEvb0pH.js","./list-TmXvCwja.js","./say-C7KqKcFr.js","./Viewer-BcpDlvg_.js","./GraphAwareLayoutService-C5N8K9dm.js","./pathGeometry-DJTK9no3.js","./jspdf.es.min-C0L4zezU.js","./useTrace-dZdQ805W.js","./trace-DXQU2N_l.js","./shortcut-BRxHV_3d.js","./documentBridge-CHw4XsZH.js","./preferences-BcLlKYFq.js","./AgentSettings-D24jOuht.js","./typing-CXvbBSPr.js","./dockLayout-CxOMo-Nl.js","./web-C4k0NLZ9.js","./documents-CEtohzAC.js","./files-DI8LgQfb.js","./duplicate-D_ic-m62.js","./bpmnTheme-pKgl9Mrn.js","./dist-DDNYYQtV.js","./dist-BEpeEbIu.js","./dist-_eOLjmnv.js","./dist-CWjAtsKe.js","./BpmnCanvas-BcQRQ2Br.js","./kind-DDHnk6dW.js","./stackblur-es-Djj-lnDR.js","./array-move-Bc4mVEdq.js","./dist-DN6jzqTC.js","./dist-CJx_2eBF.js","./groovy-DASguM_i.js","./dist-27z6Phtg.js","./apply-Nsj6ek02.js","./commands-GT3J_YEC.js","./executable--4381_Lf.js","./types-BL-9oaVm.js","./web-CnDpD6qy.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-B8BYMn-z.js";import{_ as t,c as n,d as r,f as i,g as a,h as o,i as s,m as c,o as l,r as u,s as d,u as f}from"./vendor-NJP34MHU.js";import{Bt as p,C as m,D as h,F as g,I as _,J as v,L as y,Lt as b,R as x,Rt as S,U as C,V as w,Vt as T,W as E,Y as D,_t as O,a as k,f as A,i as j,k as M,l as N,n as P,p as F,q as I,r as L,s as R,t as z,v as B,z as V,zt as H}from"./web-C4k0NLZ9.js";import{C as U,R as W}from"./frontend-uXAWaalt.js";import{t as G}from"./bridgeInstance-qzSInqLW.js";import{C as ee,D as K,E as te,O as ne,S as re,T as ie,_ as ae,b as oe,c as se,d as ce,g as q,h as le,i as ue,k as de,l as fe,m as pe,n as me,o as he,r as ge,s as _e,t as ve,u as ye,v as be,w as xe,x as Se,y as Ce}from"./documentBridge-CHw4XsZH.js";import{$ as we,A as Te,B as Ee,C as De,Ct as Oe,D as ke,E as Ae,Et as je,F as Me,G as Ne,H as Pe,I as Fe,J as Ie,K as Le,L as Re,M as ze,N as Be,O as Ve,P as He,Q as Ue,R as We,S as Ge,St as Ke,T as qe,Tt as Je,U as Ye,V as Xe,W as Ze,X as Qe,Y as $e,Z as et,_ as tt,_t as nt,a as rt,at as it,b as ot,bt as st,c as ct,ct as lt,d as ut,dt,et as ft,f as J,ft as pt,g as mt,gt as ht,h as gt,ht as _t,i as vt,it as yt,j as bt,k as xt,l as St,lt as Ct,m as wt,mt as Tt,n as Et,nt as Dt,o as Ot,ot as kt,p as At,pt as jt,q as Mt,r as Nt,rt as Pt,s as Ft,st as It,t as Lt,tt as Rt,u as zt,ut as Bt,v as Vt,vt as Ht,w as Ut,wt as Wt,x as Gt,xt as Kt,y as qt,yt as Jt,z as Yt}from"./BpmnCanvas-BcQRQ2Br.js";import{l as Xt}from"./dist-Bb5-DGtZ.js";import{Ct as Zt,I as Qt,P as $t,Q as en,St as tn,Tt as nn,ht as rn,vt as an,z as on}from"./dist-BrFvWnvj.js";import{i as Y}from"./translator-BLCeE6UY.js";import{_ as sn,d as X,f as cn,h as ln,i as un,m as dn,o as fn,p as pn,s as Z,u as mn}from"./ui-BLtm3Y1J.js";import{a as hn,i as gn,o as _n,r as vn}from"./preferences-BcLlKYFq.js";import{a as yn,c as bn,i as xn,l as Sn,o as Cn,s as wn,t as Tn}from"./samples-BL3jA_Vd.js";import{a as En,n as Dn,r as On}from"./moddle-f0Q4Guwd.js";import{C as kn,S as An,_ as jn,c as Q,f as Mn,g as Nn,h as Pn,i as Fn,m as In,o as Ln,p as Rn,r as zn,s as Bn,v as Vn,w as Hn,y as Un}from"./workerVariables-O6VqwDzr.js";import{A as Wn,C as Gn,D as Kn,E as qn,F as Jn,M as Yn,N as Xn,O as Zn,P as Qn,S as $n,T as er,_ as tr,b as nr,f as rr,g as ir,h as ar,j as or,k as sr,r as cr,t as lr,v as ur,w as dr,x as fr}from"./migrationHost-DCWBb3L6.js";import{i as pr,r as mr,s as hr}from"./dockLayout-CxOMo-Nl.js";import{A as gr,D as _r,M as vr,N as yr,O as br,S as xr,_ as Sr,a as Cr,b as wr,c as Tr,d as Er,f as Dr,g as Or,h as kr,i as Ar,j as jr,k as Mr,m as Nr,n as Pr,o as Fr,p as Ir,r as Lr,s as Rr,t as zr,u as Br,v as Vr,w as Hr,x as Ur,y as Wr}from"./useTrace-dZdQ805W.js";import{C as Gr,D as Kr,E as qr,S as Jr,T as Yr,a as Xr,b as Zr,c as Qr,d as $r,f as ei,i as ti,l as ni,m as ri,n as ii,o as ai,r as oi,s as si,t as ci,u as li,v as ui,w as di,x as fi}from"./testCaseRuns-liAhWMg7.js";import{t as pi}from"./list-TmXvCwja.js";import{a as mi,r as $,t as hi}from"./platform-G53Cenyw.js";import{a as gi,c as _i,d as vi,l as yi,o as bi,u as xi}from"./file-BbVBUuIH.js";import{C as Si,_ as Ci,c as wi,g as Ti,p as Ei,s as Di,v as Oi,w as ki,x as Ai,y as ji}from"./descriptors-B5VIyY5g.js";import{i as Mi,o as Ni,s as Pi}from"./dialog-BDJ5dDiU.js";import{t as Fi}from"./steps-BB_6M1MU.js";import{a as Ii,n as Li,r as Ri,s as zi,t as Bi}from"./bpmnTheme-pKgl9Mrn.js";import{t as Vi}from"./preload-helper-DExCAR_V.js";import{n as Hi,r as Ui}from"./docs-B2ZDPeJU.js";import{i as Wi,n as Gi,r as Ki,t as qi}from"./say-C7KqKcFr.js";import{t as Ji}from"./kind-DDHnk6dW.js";import{A as Yi,D as Xi,O as Zi,b as Qi,d as $i,f as ea,g as ta,h as na,k as ra,l as ia,o as aa,t as oa,u as sa,v as ca,x as la,y as ua}from"./pathGeometry-DJTK9no3.js";import{a as da,c as fa,f as pa,i as ma,l as ha,n as ga,o as _a,s as va,t as ya,u as ba}from"./engines-lyEvb0pH.js";import{c as xa}from"./AgentSettings-D24jOuht.js";import{i as Sa,o as Ca,p as wa,s as Ta,t as Ea}from"./trace-DXQU2N_l.js";import{K as Da}from"./Viewer-BcpDlvg_.js";import{l as Oa,t as ka,u as Aa}from"./apply-Nsj6ek02.js";import{a as ja,i as Ma,n as Na,r as Pa}from"./dmn-Cgoh6wXm.js";import{t as Fa}from"./formChecks-CSClH9sH.js";import{t as Ia}from"./typing-CXvbBSPr.js";import{a as La,i as Ra,n as za,o as Ba,r as Va,t as Ha}from"./open-Vkx72dYx.js";import{n as Ua,t as Wa}from"./nudges-DPG3WpyV.js";import{r as Ga}from"./duplicate-D_ic-m62.js";import{a as Ka,i as qa,o as Ja,r as Ya,s as Xa,t as Za}from"./xml-DIWt4von.js";import{i as Qa,n as $a,r as eo}from"./template-BQP7ZXdK.js";import{i as to,t as no}from"./sharedReader-BsXfiBT8.js";import{n as ro,t as io}from"./say-BkdZMivA.js";import{i as ao,n as oo,s as so}from"./model-afHgSxJs.js";import{a as co,t as lo}from"./shortcut-BRxHV_3d.js";function compareVariables(e,t){let n=new Set(t),r=new Set,i=new Map;for(let t of e){if(!t.name.trim()||(r.add(t.name),t.writes))continue;let e=i.get(t.name)??[];e.some(e=>e.elementId===t.elementId&&e.where===t.where)||e.push({elementId:t.elementId,where:t.where}),i.set(t.name,e)}let a=[...new Set(t.map(e=>e.trim()).filter(e=>e&&!r.has(e)))].sort(),o=[...i.entries()].filter(([e])=>!n.has(e)).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({name:e,elements:t}));return{unused:a.map(e=>({name:e,elements:[]})),neverSet:o}}function reached$1(e=[],t=[]){return{elements:new Set(e),flows:new Set(t)}}e(reached$1,`reached`);function join(e,t){return reached$1([...e.elements,...t.elements],[...e.flows,...t.flows])}function strings$1(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim()!==``):[]}e(strings$1,`strings`);function items(e){return Array.isArray(e)?e:[]}function add(e,t,n,r){if(typeof t!=`string`||!t)return;let i=e.get(t)??{processId:t,all:reached$1(),tests:new Map};i.all=join(i.all,r),n&&i.tests.set(n,join(i.tests.get(n)??reached$1(),r)),e.set(t,i)}function camunda8$2(e){return reached$1(strings$1(e?.completedElements),strings$1(e?.takenSequenceFlows))}e(camunda8$2,`camunda8`);function eventsByProcess(e){let t=new Map;return items(e).forEach(e=>{let n=typeof e?.modelKey==`string`?e.modelKey:``,r=t.get(n)??reached$1();e?.source===`FLOW_NODE`&&e?.type===`END`&&e.definitionKey&&r.elements.add(e.definitionKey),e?.source===`SEQUENCE_FLOW`&&e.definitionKey&&r.flows.add(e.definitionKey),t.set(n,r)}),t}function readCoverage(e){let t=new Map,n;try{n=JSON.parse(e)}catch{return t}return items(n?.suites).forEach(e=>{let n=String(e?.name??``).split(`.`).pop()??``;items(e?.runs).forEach(e=>{let r=[n,String(e?.name??``)].filter(e=>e).join(`.`);items(e?.processCoverages).forEach(e=>add(t,e?.processDefinitionId,r,camunda8$2(e))),eventsByProcess(e?.events).forEach((e,n)=>add(t,n,r,e))})}),items(n?.processCoverages).forEach(e=>add(t,e?.processDefinitionId,null,camunda8$2(e))),t}function mergeCoverage(e){let t=new Map;return e.forEach(e=>e.forEach(e=>{add(t,e.processId,null,e.all),e.tests.forEach((n,r)=>add(t,e.processId,r,n))})),t}function projectCoverage(e,t){return{reach:mergeCoverage(t.map(e=>readCoverage(e.text))),reports:t.map(t=>to(e,t.path)),updatedAt:t.length>0?Math.max(...t.map(e=>e.stamp)):null}}var uo=4,fo=2;function distanceWithin(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=n+1,i=t.length+1,a=Array(i).fill(r),o=Array(i).fill(r);for(let e=0;e<=Math.min(n,t.length);e+=1)a[e]=e;for(let s=0;s<e.length;s+=1){let c=Math.max(0,s-n),l=Math.min(t.length-1,s+n);c>0&&(o[c]=r),o[0]=s+1<=n?s+1:r;let u=c===0?o[0]:r;for(let n=c;n<=l;n+=1){let i=Math.min(a[n+1]+1,o[n]+1,a[n]+(e[s]===t[n]?0:1),r);o[n+1]=i,i<u&&(u=i)}if(l+2<i&&(o[l+2]=r),u>n)return r;[a,o]=[o,a]}return Math.min(a[t.length],r)}function closest(e,t){let n=new Set(t),r=e.toLowerCase(),i=[...n].find(t=>t!==e&&t.toLowerCase()===r);if(i)return i;if(e.length<uo)return null;let a=null,o=1/0;return n.forEach(t=>{let n=distanceWithin(t.toLowerCase(),e.toLowerCase(),fo);n>=1&&n<=fo&&n<o&&(a=t,o=n)}),a}function folderAndName(e){return e.replace(/\\/g,`/`).split(`/`).filter(Boolean).slice(-2).join(`/`)}function parse$1(e){if(!e)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t[0]??null:t}catch{return null}}e(parse$1,`parse`);async function loadTemplates(e){let t=new Map;for(let n of await e.list()){let r=parse$1(await e.read(n));r?.id&&t.set(r.id,{path:n,template:r})}return t}function readsOf$1(e){return e.properties.filter(e=>e.binding?.type===`zeebe:input`||e.binding?.type===`camunda:inputParameter`||e.binding?.type===`camunda:inputOutput`).map(e=>e.binding?.name).filter(e=>!!e)}e(readsOf$1,`readsOf`);function writesOf(e){return e.properties.filter(e=>e.binding?.type===`zeebe:output`).map(e=>$a(e)).filter(e=>!!e)}function valueOf$1(e){let t=e.elementType??{};return t[`zeebe:taskDefinition`]??t[`camunda:topic`]??e.id}e(valueOf$1,`valueOf`);function factsFor(e){return{className:``,packageName:null,shape:`unknown`,reads:readsOf$1(e),writes:writesOf(e),errors:[],usesBusinessKey:!1,usesEngineServices:[],readsAllVariables:!1,line:1}}function workerFromTemplate(e,t,n=`8.8`){let r=valueOf$1(e);return sr({kind:`class`,value:r,role:`task`,elementId:``,where:``,jobType:r},factsFor(e),t,n)}var po=[`JOB_TYPE`,`TOPIC`,`CLASS`,`BEAN`,`MESSAGE`,`ERROR`];function attribute$1(e,t){let n=e?.get?.(t)??e?.$attrs?.[t];return typeof n==`string`&&n.trim()?n:void 0}e(attribute$1,`attribute`);function extensions(e,t){return(e?.extensionElements?.values??[]).filter(e=>e.$type===t)}function eachElement(e,t){let walk=e=>{e?.id&&t(e),(e?.flowElements??[]).forEach(walk)};processesOf(e).forEach(e=>(e.flowElements??[]).forEach(walk))}function processesOf(e){return(e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`)}function lostUpdates(e){let t=[];return eachElement(e,e=>{extensions(e,`zeebe:LoopCharacteristics`).forEach(n=>{let r=attribute$1(n,`outputCollection`);r&&!attribute$1(n,`outputElement`)&&t.push({elementId:e.id,collection:r})})}),t}function mappingOrder(e){let t=[];return eachElement(e,e=>{extensions(e,`zeebe:IoMapping`).forEach(n=>{let r=[];[...n.inputParameters??[],...n.outputParameters??[]].forEach(n=>{let i=attribute$1(n,`target`);if(!i)return;let a=attribute$1(n,`source`)?.replace(/^=+/,``);if(a){let n=r.find(e=>e===a||e.startsWith(`${a}.`)||a.startsWith(`${e}.`));n&&t.push({elementId:e.id,path:a,target:n})}r.push(i)})})}),t}function nearNames(e,t){if(!t)return[];let n=[];return po.forEach(r=>{let i=t[r]??[];i.length!==0&&e.filter(e=>e.kind===r&&!!e.elementId).forEach(e=>{if(i.includes(e.value))return;let t=closest(e.value,i);if(!t)return;let a={kind:r,name:e.value,near:t,caseOnly:t.toLowerCase()===e.value.toLowerCase()};n.some(t=>t.elementId===e.elementId&&t.near.kind===r)||n.push({elementId:e.elementId,near:a})})}),n}function workerContract(e){let{model:t,targets:n,answer:r,order:i,definitions:a,codeNames:o}=e,s=new Map,entryOf=e=>{let t=s.get(e);if(t)return t;let n={elementId:e,unfetched:[],unread:[],lateReads:[],near:[],lostUpdate:null,mappingOrder:[],implicit:[]};return s.set(e,n),n},c=new Map,l=new Map;t.variables.forEach(e=>{let t=e.writes?l:c,n=t.get(e.name)??new Set;n.add(e.elementId),t.set(e.name,n)});let writtenBefore=(e,t)=>{let n=l.get(e);if(!n)return!1;for(let e of n)if(e!==t&&Rn(i,e,t))return!0;return!1};return(r?.variables??[]).filter(e=>e.writes).forEach(e=>{let t=i.get(e.elementId)??new Set;[...c.get(e.name)??new Set].every(e=>!t.has(e))&&entryOf(e.elementId).unread.push(e.name)}),(r?.variables??[]).filter(e=>!e.writes).forEach(e=>{writtenBefore(e.name,e.elementId)||entryOf(e.elementId).lateReads.push(e.name);let t=zn(r,e.elementId).find(e=>e.declared);t&&!t.names.includes(e.name)&&entryOf(e.elementId).unfetched.push({name:e.name,closest:closest(e.name,t.names)})}),(r?.implicitJobTypes??[]).forEach(e=>{entryOf(e.elementId).implicit.push({jobType:e.jobType,method:e.method})}),lostUpdates(a).forEach(({elementId:e,collection:t})=>{entryOf(e).lostUpdate=t}),mappingOrder(a).forEach(e=>{entryOf(e.elementId).mappingOrder.push({path:e.path,target:e.target})}),nearNames(n,o).forEach(e=>entryOf(e.elementId).near.push(e.near)),[...s.values()].filter(interesting)}function interesting(e){return e.unfetched.length>0||e.unread.length>0||e.lateReads.length>0||e.near.length>0||e.lostUpdate!==null||e.mappingOrder.length>0||e.implicit.length>0}var mo=/^(serviceTask|sendTask|receiveTask|scriptTask)$/;function missingField(e,t,n){let r=t,i=e;for(let e of n){if(e.kind===`index`){if(r.kind!==`collection`)return null;r=r.element,i+=`[]`;continue}if(r.kind!==`object`)return null;let t=Bt(r.fields,e.name);if(!t)return{variable:i,field:e.name,type:r.name,fields:r.fields.filter(e=>e.serialised).map(e=>e.name)};if(!t.serialised)return null;r=t.type,i+=`.${e.name}`}return null}function writtenAt(e){let t=e.writers.find(e=>e.path!==null);return t&&t.path!==null?`${t.path}:${t.line??0}`:null}function variableFindings(e){let t={fields:[],names:[]};if(!e.entitled||e.mode===`off`)return t;let{model:n,definitions:r,order:i,types:a,inputs:o,linked:s}=e,c=Nn(r),anchorOf=e=>c.flows.get(e)?.target??e,l=new Map,scopeAt=e=>{let t=l.get(e);if(t)return t;let r=new Map(Ct({model:n,order:i,types:a,inputs:o},e,{wholeProcess:!0}).variables.map(e=>[e.name,e]));return l.set(e,r),r},u=[],d=new Set;for(let e of Vn(r))for(let t of Hn(e.expression)){let n=kn(t),r=scopeAt(anchorOf(e.elementId)).get(n.root);if(!r||r.certainty!==`exact`)continue;let i=missingField(n.root,r.shape,n.steps);if(!i)continue;let a=[e.elementId,i.variable,i.field].join(`\0`);d.has(a)||(d.add(a),u.push({elementId:e.elementId,...i,from:writtenAt(r)}))}let f=[];if(e.mode===`names`&&s.size>0){let e=new Set(n.variables.filter(e=>e.writes).map(e=>e.name)),t=new Set(o),r=n.elements.filter(e=>mo.test(e.type)).map(e=>e.id),a=new Map;for(let e of n.variables.filter(e=>!e.writes))a.set(e.elementId,new Set([...a.get(e.elementId)??[],e.name]));for(let[n,o]of a){let a=anchorOf(n);if(!r.some(e=>e!==a&&Rn(i,e,a)&&!s.has(e)))for(let r of o)e.has(r)||t.has(r)||f.push({elementId:n,name:r})}}return{fields:u,names:f}}function fieldFindingTitle(e){return e.fields.length===0?Y(`app.code.finding.variableFieldNone`,{variable:e.variable,field:e.field,type:e.type}):Y(`app.code.finding.variableField`,{variable:e.variable,field:e.field,type:e.type,fields:e.fields.join(`, `)})}function fieldFindingWhere(e){return e.from===null?Y(`app.code.finding.variableFieldWhereUnknown`):Y(`app.code.finding.variableFieldWhere`,{from:e.from})}function nameFindingTitle(e){return Y(`app.code.finding.variableUnknown`,{name:e})}function nameFindingWhere(){return Y(`app.code.finding.variableUnknownWhere`)}function onePerName(e,t,n){let r=new Set(e.map(e=>e.name)),i=t.filter(e=>!r.has(e.name));return i.forEach(e=>r.add(e.name)),{unset:i,late:n.filter(e=>!r.has(e))}}function none(){return{unfetched:[],unread:[],lateReads:[],near:[],lostUpdate:null,mappingOrder:[],implicit:[],unknownFields:[],unknownNames:[]}}function titleOf$2(e,t){return e.elements.find(e=>e.id===t)?.label??e.processes.find(e=>e.id===t)?.label??e.decisions.find(e=>e.id===t)?.label??t}e(titleOf$2,`titleOf`);function elementInsight({model:e,code:t},n){let r=Yn(t,Jn(e,n)),i=r.filter(e=>e.test);return{elementId:n,title:titleOf$2(e,n),implementations:r.filter(e=>e.implements),tests:i,usages:r.filter(e=>!e.implements&&!e.test),...none()}}function diagramInsight(e){let{model:t,files:n,targets:r,code:i,order:a,definitions:o,workers:s,codeNames:c,variables:l,codeLinks:u}=e,d=new Map(workerContract({model:t,targets:r,answer:s&&!u?{...s,variables:[]}:s??null,order:a??new Map,definitions:o,codeNames:c}).map(e=>[e.elementId,e])),f=variableFindings({model:t,definitions:o,order:a??new Map,types:s?.types??[],inputs:l?.inputs??[],linked:new Set((s?.fetches??[]).map(e=>e.elementId)),mode:l?.mode??`off`,entitled:l?.entitled??!1}),p=new Map;f.fields.forEach(e=>p.set(e.elementId,[...p.get(e.elementId)??[],e]));let m=new Map;if(f.names.forEach(e=>m.set(e.elementId,[...m.get(e.elementId)??[],e.name])),!i)return[...new Set([...d.keys(),...p.keys(),...m.keys()])].map(t=>{let n=d.get(t)??{elementId:t,...none()};return{...elementInsight(e,t),missingImplementation:!1,neverThrown:!1,unsetReads:[],...n,unknownFields:p.get(t)??[],unknownNames:m.get(t)??[]}});let h=new Set(r.filter(e=>e.kind===`VARIABLE`&&e.writes).map(e=>e.value)),setInCode=e=>!i.precise||Yn(i,[{kind:`VARIABLE`,value:e}]).some(e=>e.implements),g=or(n,r).filter(Xn).some(e=>Yn(i,[e]).some(e=>e.implements)),_=or(n,r).filter(e=>e.kind===`ERROR`),v=i.precise&&_.some(e=>Yn(i,[e]).some(e=>e.implements)),y=new Set(n.flatMap(e=>e.model.errors.filter(e=>!e.catches&&e.code).map(e=>e.code)));return t.elements.flatMap(n=>{let r=elementInsight(e,n.id),a=[...new Set(t.variables.filter(e=>e.elementId===n.id&&!e.writes).map(e=>e.name))],o=i.precise&&Jn(t,n.id).some(Xn)&&r.implementations.length===0&&g,s=a.filter(e=>!h.has(e)&&!setInCode(e)).map(e=>({name:e,closest:closest(e,h)})),c=t.errors.find(e=>e.elementId===n.id&&e.catches&&e.code)?.code,l=!!c&&v&&r.implementations.length===0&&!y.has(c),u=d.get(n.id)??{elementId:n.id,...none()},f=onePerName(u.unfetched,s,u.lateReads),_=p.get(n.id)??[],b=(m.get(n.id)??[]).filter(e=>!f.unset.some(t=>t.name===e));return r.implementations.length>0||r.tests.length>0||r.usages.length>0||o||l||f.unset.length>0||u.unfetched.length>0||u.unread.length>0||f.late.length>0||u.near.length>0||u.lostUpdate!==null||u.mappingOrder.length>0||u.implicit.length>0||_.length>0||b.length>0?[{...r,missingImplementation:o,neverThrown:l,unsetReads:f.unset,...u,lateReads:f.late,unknownFields:_,unknownNames:b}]:[]})}var ho=100,Refused=class extends Error{};function json$2(e){if(e.status<200||e.status>=300)throw new Refused(e.status===401||e.status===403?Y(`app.live.credentialsMayNotAllow`,{status:e.status}):e.status===0?e.body:Y(`app.live.answeredStatus`,{status:e.status}));try{return JSON.parse(e.body)}catch{throw new Refused(Y(`app.live.answeredNotJson`))}}e(json$2,`json`);function count$1(e){return typeof e==`number`&&Number.isFinite(e)?e:0}e(count$1,`count`);function list$2(e){return Array.isArray(e)?e:[]}e(list$2,`list`);async function camunda8$1(e,t){let n=json$2(await t({method:`POST`,path:`/process-definitions/search`,body:JSON.stringify({filter:{processDefinitionId:e},sort:[{field:`version`,order:`desc`}],page:{limit:1}})}))?.items?.[0];if(!n?.processDefinitionKey)return{process:{processId:e,key:null,version:null,deployed:!1,elements:new Map},incidents:[]};let r=String(n.processDefinitionKey),[i,a]=await Promise.all([t({method:`POST`,path:`/process-definitions/${encodeURIComponent(r)}/statistics/element-instances`,body:`{}`}).then(json$2),t({method:`POST`,path:`/incidents/search`,body:JSON.stringify({filter:{processDefinitionKey:r,state:`ACTIVE`},page:{limit:ho}})}).then(json$2)]),o=new Map(list$2(i?.items).map(e=>[String(e?.elementId),{waiting:count$1(e?.active)+count$1(e?.incidents),incidents:count$1(e?.incidents),completed:count$1(e?.completed)}]));return{process:{processId:e,key:r,version:typeof n.version==`number`?n.version:null,deployed:!0,elements:o},incidents:list$2(a?.items).map(t=>{let n={processId:e,elementId:String(t?.elementId??``),type:String(t?.errorType??``),message:String(t?.errorMessage??``),instance:String(t?.processInstanceKey??``)},r=t?.incidentKey??t?.key??t?.id;return r!=null&&(n.id=String(r)),n})}}e(camunda8$1,`camunda8`);async function camunda7$1(e,t){let n=await t({method:`GET`,path:`/process-definition/key/${encodeURIComponent(e)}`});if(n.status===404)return{process:{processId:e,key:null,version:null,deployed:!1,elements:new Map},incidents:[]};let r=json$2(n),i=encodeURIComponent(String(r?.id??``)),[a,o]=await Promise.all([t({method:`GET`,path:`/process-definition/${i}/statistics?incidents=true`}).then(json$2),t({method:`GET`,path:`/incident?processDefinitionId=${i}&maxResults=${ho}`}).then(json$2)]),s=new Map(list$2(a).map(e=>[String(e?.id),{waiting:count$1(e?.instances),incidents:list$2(e?.incidents).reduce((e,t)=>e+count$1(t?.incidentCount),0),completed:null}]));return{process:{processId:e,key:String(r?.id??``),version:typeof r?.version==`number`?r.version:null,deployed:!0,elements:s},incidents:list$2(o).map(t=>{let n={processId:e,elementId:String(t?.activityId??``),type:String(t?.incidentType??``),message:String(t?.incidentMessage??``),instance:String(t?.processInstanceId??``)};return t?.id!==void 0&&t?.id!==null&&(n.id=String(t.id)),n})}}e(camunda7$1,`camunda7`);async function readLive(e,t,n){try{let r=e===`CAMUNDA_8`?camunda8$1:camunda7$1,i=await Promise.all(t.map(e=>r(e,n)));return{processes:i.map(e=>e.process),incidents:i.flatMap(e=>e.incidents),problem:null}}catch(e){return{processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}}}function liveOf(e,t){for(let n of e?.processes??[]){let e=n.elements.get(t);if(e)return e}return null}function parseJson$1(e){if(e.status<200||e.status>=300){let t=e.status===401||e.status===403?Y(`app.live.credentialsMayNotAllow`,{status:e.status}):Y(`app.live.answeredStatus`,{status:e.status});throw Error(t)}try{return JSON.parse(e.body)}catch{throw Error(Y(`app.live.answeredNotJson`))}}e(parseJson$1,`parseJson`);function isRecord$2(e){return typeof e==`object`&&!!e}e(isRecord$2,`isRecord`);function timeOf$2(e){return e?Date.parse(e.replace(/([+-]\d\d)(\d\d)$/,`$1:$2`)):NaN}e(timeOf$2,`timeOf`);function historyInstancesCall(e,t,n=10){if(e===`CAMUNDA_8`){let e=typeof t==`string`?t:t.key??t.id??``,r={state:{$in:[`COMPLETED`,`TERMINATED`]}};return e&&(/^\d+$/.test(e)?r.processDefinitionKey=e:r.processDefinitionId=e),{method:`POST`,path:`/process-instances/search`,body:JSON.stringify({filter:r,sort:[{field:`endDate`,order:`desc`}],page:{limit:Math.max(1,n)}})}}let r=typeof t==`string`?t:t.key,i=typeof t==`object`?t.id:void 0;return{method:`GET`,path:`/history/process-instance?${i?`processDefinitionId=${encodeURIComponent(i)}`:`processDefinitionKey=${encodeURIComponent(r??``)}`}&finished=true&sortBy=endTime&sortOrder=desc&maxResults=${Math.max(1,n)}`}}function parseHistoryInstances(e,t){let n=parseJson$1(t);return e===`CAMUNDA_8`?(Array.isArray(n?.items)?n.items:[]).filter(isRecord$2).map(e=>{let t=String(e.processInstanceKey??e.key??``),n=e.businessKey??e.businessId??null,r=e.state===`TERMINATED`||e.state===`CANCELED`?`CANCELED`:`COMPLETED`,i=String(e.startDate??``),a=String(e.endDate??``),o=timeOf$2(i),s=timeOf$2(a);return{id:t,businessKey:n,state:r,startTime:i,endTime:a,durationMs:Number.isFinite(o)&&Number.isFinite(s)&&s>=o?s-o:0}}):(Array.isArray(n)?n:[]).filter(isRecord$2).map(e=>{let t=String(e.id??``),n=e.businessKey??null,r=e.state===`COMPLETED`&&!e.deleteReason?`COMPLETED`:`CANCELED`,i=String(e.startTime??``),a=String(e.endTime??``),o=typeof e.durationInMillis==`number`&&e.durationInMillis>0?e.durationInMillis:0;if(o<=0){let e=timeOf$2(i),t=timeOf$2(a);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(o=t-e)}return{id:t,businessKey:n,state:r,startTime:i,endTime:a,durationMs:o}})}function instancePathCall(e,t){return e===`CAMUNDA_8`?{method:`POST`,path:`/element-instances/search`,body:JSON.stringify({filter:{processInstanceKey:t},sort:[{field:`startDate`,order:`asc`}],page:{limit:500}})}:{method:`GET`,path:`/history/activity-instance?processInstanceId=${encodeURIComponent(t)}&sortBy=occurrence&sortOrder=asc`}}function parseInstancePath(e,t,n){let r=parseJson$1(n);if(e===`CAMUNDA_8`){let e=(Array.isArray(r?.items)?r.items:[]).filter(e=>e?.state===`COMPLETED`&&e?.type!==`PROCESS`).map(e=>({elementId:String(e.elementId??``),state:`COMPLETED`,mocked:!1,startedAt:e.startDate?String(e.startDate):null,endedAt:e.endDate?String(e.endDate):null}));return{instanceId:t,activityIds:e.map(e=>e.elementId),steps:e}}let i=(Array.isArray(r)?r:[]).filter(e=>e?.endTime&&!e?.canceled&&e?.activityType!==`process`).map(e=>({elementId:String(e.activityId??``),state:`COMPLETED`,mocked:!1,startedAt:e.startTime?String(e.startTime):null,endedAt:e.endTime?String(e.endTime):null}));return{instanceId:t,activityIds:i.map(e=>e.elementId),steps:i}}async function readFinishedInstances(e,t,n,r){return parseHistoryInstances(e,await r(historyInstancesCall(e,t,n)))}async function readInstancePath(e,t,n){return parseInstancePath(e,t,await n(instancePathCall(e,t)))}function jobTypeOf$2(e){return e.job??e.external??null}e(jobTypeOf$2,`jobTypeOf`);function waitingSteps(e){let t=[];for(let n of e.values()){let e=n.name??n.id,r=jobTypeOf$2(n);r?t.push({id:n.id,name:e,kind:`job`,jobType:r}):n.delegateClass||n.delegateExpression||n.expression?t.push({id:n.id,name:e,kind:`delegate`,jobType:null}):n.event===`timer`&&t.push({id:n.id,name:e,kind:`timer`,jobType:null})}return t}function adHocTestCase(e,t,n,r,i){let a=[{type:`CREATE_PROCESS_INSTANCE`,processDefinitionSelector:{processDefinitionId:e},variables:t}],o={},s=new Map;r.forEach(e=>{let t=jobTypeOf$2(e);t&&s.set(t,(s.get(t)??0)+1)});for(let[e,t]of n){let n=r.get(e);if(!n||t.kind===`real`)continue;let i=jobTypeOf$2(n),c=!!i&&s.get(i)===1;t.kind===`fire`?o[e]={then:`fire`}:t.kind===`ask`?o[e]={then:`hold`}:t.kind===`fail`?o[e]={then:`complete`,fail:t.times,variables:t.variables}:t.kind===`error`?c?a.push({type:`MOCK_JOB_WORKER_THROW_BPMN_ERROR`,jobType:i,errorCode:t.errorCode,variables:t.variables}):o[e]={then:`error`,errorCode:t.errorCode,variables:t.variables}:c?a.push({type:`MOCK_JOB_WORKER_COMPLETE_JOB`,jobType:i,variables:t.variables}):o[e]={then:`complete`,variables:t.variables}}let c={name:i,instructions:a};return Object.keys(o).length&&(c[`x-penstock`]={behaviours:o}),c}function writtenVariables(e){let t=new Map;for(let n of e.steps)for(let e of n.changed)t.set(e.name,e.value);return[...t].map(([e,t])=>({name:e,value:t}))}function recordedTestCase(e,t,n,r){let[i,...a]=e.testCase.instructions,o=[i,...a.filter(e=>e.type===`MOCK_JOB_WORKER_COMPLETE_JOB`||e.type===`MOCK_JOB_WORKER_THROW_BPMN_ERROR`),...e.recorded],s=e.trace,c={processDefinitionId:i.processDefinitionSelector.processDefinitionId};if(s){let e=s.steps.filter(e=>e.state===`COMPLETED`).map(e=>({elementId:e.elementId})),t=s.steps.filter(e=>e.state===`ACTIVE`).map(e=>({elementId:e.elementId}));e.length&&o.push({type:`ASSERT_ELEMENT_INSTANCES`,processInstanceSelector:c,elementSelectors:e,state:`IS_COMPLETED`}),t.length&&o.push({type:`ASSERT_ELEMENT_INSTANCES`,processInstanceSelector:c,elementSelectors:t,state:`IS_ACTIVE`});let r=new Map(writtenVariables(s).map(e=>[e.name,e.value])),i=Object.fromEntries(n.filter(e=>r.has(e)).map(e=>[e,r.get(e)]));Object.keys(i).length&&o.push({type:`ASSERT_VARIABLES`,processInstanceSelector:c,variables:i}),o.push({type:`ASSERT_PROCESS_INSTANCE`,processInstanceSelector:c,state:s.state===`COMPLETED`?`IS_COMPLETED`:s.state===`TERMINATED`?`IS_TERMINATED`:`IS_ACTIVE`})}let l=Object.fromEntries(Object.entries(e.testCase[`x-penstock`]?.behaviours??{}).filter(([,e])=>e.then!==`hold`)),u={};Object.keys(l).length&&(u.behaviours=l),s&&(u.recorded={from:`run`,instance:s.instance,engine:Ei(s.engine)??`camunda-7`,at:r.toISOString()});let d={name:t,instructions:o};return Object.keys(u).length&&(d[`x-penstock`]=u),d}function isPlain(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mergeVariables(e,t){let n={...e};for(let[e,r]of Object.entries(t)){if(e===`__proto__`)continue;let t=n[e];n[e]=isPlain(t)&&isPlain(r)?mergeVariables(t,r):r}return n}function isJob(e){return!!(e.job||e.external)}function delegated(e){return!!(e.delegateClass||e.delegateExpression||e.expression)}function touches(e,t){let n=e;if((n.jobSelector??n.userTaskSelector)?.elementId===t.id)return!0;let r=t.job??t.external;return n.type===`MOCK_JOB_WORKER_COMPLETE_JOB`&&!!r&&n.jobType===r}function shaped(e,t,n){let r={...e[`x-penstock`]?.behaviours??{}},i=e.instructions.filter(e=>touches(e,t)),a=e.instructions.filter(e=>!i.includes(e)),o=t.type===`bpmn:UserTask`&&!isJob(t);if(n.kind===`hold`)delegated(t)&&(r[t.id]={then:`hold`});else if(n.kind===`error`){if(o)return{problem:Y(`app.testCases.taskTest.cannotThrow`,{element:t.id})};isJob(t)?a=[...a,{type:`THROW_BPMN_ERROR_FROM_JOB`,jobSelector:{elementId:t.id},errorCode:n.errorCode,...n.variables?{variables:n.variables}:{}}]:r[t.id]={then:`error`,errorCode:n.errorCode,...n.variables?{variables:n.variables}:{}}}else{let e=n.variables&&Object.keys(n.variables).length?{variables:n.variables}:{};o?a=[...a,{type:`COMPLETE_USER_TASK`,userTaskSelector:{elementId:t.id},...e}]:isJob(t)?a=[...a,{type:`COMPLETE_JOB`,jobSelector:{elementId:t.id},...e}]:delegated(t)?r[t.id]={then:`complete`,...e}:a=[...a,...i]}let s={name:e.name,instructions:a};return e.description&&(s.description=e.description),Object.keys(r).length&&(s[`x-penstock`]={behaviours:r}),s}function reaching(e,t,n){let r=e.filter(e=>!n||e.process===n).filter(e=>e.startId===t||e.stepIds.includes(t)||e.endIds.includes(t)),length=e=>e.startId===t?0:e.stepIds.indexOf(t)>=0?e.stepIds.indexOf(t):e.stepIds.length;return[...r].sort((e,t)=>length(e)-length(t)||e.decisions.length-t.decisions.length)[0]??null}function cut(e,t){let n=e.stepIds.indexOf(t),r=e.endIds.includes(t);return{...e,stepIds:e.startId===t?[]:n>=0?e.stepIds.slice(0,n+1):e.stepIds,endIds:r?[t]:[]}}function taskTestPlan(e,t){let n=Fi(e),r=new Set((e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`&&e.isExecutable!==!1).map(e=>String(e.id)));if(r.size===0)return{problem:Y(`app.testCases.taskTest.noProcess`)};let i=di(e,256),a=reaching(i.scenarios.filter(e=>r.has(e.process)),t.element,t.process);if(!a)return{problem:n.has(t.element)||i.scenarios.some(e=>e.startId===t.element)?Y(`app.testCases.taskTest.noWay`,{element:t.element}):Y(`app.testCases.taskTest.notFound`,{element:t.element})};let o=cut(a,t.element),s=gr(a,n).values,c=mergeVariables(Mr(s),t.variables??{}),l=jr(o,n,c);if(`problem`in l)return{problem:l.problem};let u=l.testCase,d={...u,name:Y(`app.testCases.taskTest.name`,{element:t.element}),instructions:u.instructions.filter(e=>!String(e.type).startsWith(`ASSERT_`))};delete d.description;let f=n.get(t.element),p=f?shaped(d,f,t.mode??{kind:`complete`}):d;return`instructions`in p?{testCase:p,process:a.process,path:[a.startId,...o.stepIds]}:{problem:p.problem}}var go=2e3,_o=800;function clipped(e){return e.length<=go?e:`${e.slice(0,_o)}\n...\n${e.slice(-1200)}`}function json$1(e){if(e.status<200||e.status>=300)throw new ya(Y(`app.incident.read.answered`,{status:e.status}),e.status);try{return JSON.parse(e.body)}catch{throw new ya(Y(`app.incident.read.notJson`),e.status)}}e(json$1,`json`);function incidentOf(e,t,n){let r=e===`CAMUNDA_8`,i={processId:n,elementId:String((r?t?.elementId:t?.activityId)??``),type:String((r?t?.errorType:t?.incidentType)??``),message:String((r?t?.errorMessage:t?.incidentMessage)??``),instance:String((r?t?.processInstanceKey:t?.processInstanceId)??``)},a=r?t?.incidentKey??t?.key:t?.id;return a!=null&&(i.id=String(a)),i}function incidentCall$1(e,t){return{method:`GET`,path:e===`CAMUNDA_8`?`/incidents/${encodeURIComponent(t)}`:`/incident/${encodeURIComponent(t)}`}}e(incidentCall$1,`incidentCall`);function instanceCall(e,t){return{method:`GET`,path:e===`CAMUNDA_8`?`/process-instances/${encodeURIComponent(t)}`:`/history/process-instance/${encodeURIComponent(t)}`}}function detailCall(e,t){if(e===`CAMUNDA_8`)return null;let n=typeof t?.configuration==`string`?t.configuration:``;return n?t.incidentType===`failedJob`?{method:`GET`,path:`/job/${encodeURIComponent(n)}/stacktrace`}:t.incidentType===`failedExternalTask`?{method:`GET`,path:`/external-task/${encodeURIComponent(n)}/errorDetails`}:null:null}async function found(e,t){let n=await e(t);return n.status===404?null:json$1(n)}async function readEvidence(e,t,n){try{let r=ma(e,n),i=null;try{i=await found(n,incidentCall$1(e,t))}catch(e){if(!(e instanceof ya)||e.status<400||e.status>=500)throw e}let a=i?String((e===`CAMUNDA_8`?i.processInstanceKey:i.processInstanceId)??``):t;if(!a)return{ok:!1,reason:Y(`app.incident.read.noInstance`,{key:t})};let o=await found(n,instanceCall(e,a));if(!o)return{ok:!1,reason:Y(`app.incident.read.noSuchInstance`,{key:t})};let s=String((e===`CAMUNDA_8`?o.processDefinitionId:o.processDefinitionKey)??``),c=await r.snapshot(a),l=e===`CAMUNDA_8`?[]:json$1(await n({method:`GET`,path:`/incident?processInstanceId=${encodeURIComponent(a)}`})),u=c.incidents.map(e=>({processId:s,elementId:e.elementId,type:e.type??``,message:e.message,instance:a,...e.id===void 0?{}:{id:e.id}})),d=i?incidentOf(e,i,s):u[0];if(!d)return{ok:!1,reason:Y(`app.incident.read.noIncident`,{key:t})};let f=u.filter(e=>e.elementId!==d.elementId||e.message!==d.message||e.type!==d.type),p=i??l.find(e=>String(e?.activityId)===d.elementId)??null,m=p?detailCall(e,p):null,h=null;if(m){let e=await n(m);e.status>=200&&e.status<300&&e.body.trim()&&(h=clipped(fr(e.body).trim()))}return{ok:!0,evidence:{engine:e,incident:d,others:f,variables:c.variables,path:c.elements,detail:h,variablesAreCurrent:!0}}}catch(e){return{ok:!1,reason:e instanceof Error?e.message:String(e)}}}var vo=200,yo=/(?:[A-Za-z0-9_.-]+:\d+:)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g,bo=`[A-Za-z0-9_.:-]+`;function plainPattern(e){return An(e).replace(/\d{5,}/g,`\\d+`).replace(/ /g,`\\s+`)}var xo=/[A-Za-z0-9_.:-]/;function withoutIdChars(e,t){let n=t?e.length:0;for(;t?n>0&&xo.test(e[n-1]):n<e.length&&xo.test(e[n]);)n+=t?-1:1;return t?e.slice(0,n):e.slice(n)}function literalPattern(e){let t=[...e.matchAll(yo)];if(t.length===0)return plainPattern(e);let n=[],r=0;for(let[i,a]of t.entries()){let t=e.slice(r,a.index);i>0&&(t=withoutIdChars(t,!1)),t=withoutIdChars(t,!0),t&&n.push(plainPattern(t)),(n.length===0||n[n.length-1]!==bo)&&n.push(bo),r=a.index+a[0].length}let i=withoutIdChars(e.slice(r),!1);return i&&n.push(plainPattern(i)),n.join(``)}function messagePattern(e){let t=fr(e).replace(/\s+/g,` `).trim().slice(0,vo).split(`***`);return t.map((e,n)=>{let r=n===0?e:e.trimStart();return n===t.length-1?r:r.trimEnd()}).filter(e=>e.length>0).map(literalPattern).join(`.*`)}function correlationKeyOf(e,t){let n=e.correlationKey?.trim();if(!n)return;if(!n.startsWith(`=`))return n;let r=/^=\s*([A-Za-z_]\w*)\s*$/.exec(n)?.[1],i=r?t[r]:void 0;return i==null||typeof i==`object`?void 0:String(i)}var So=new Set([`bpmn:IntermediateCatchEvent`,`bpmn:ReceiveTask`,`bpmn:BoundaryEvent`]);function buildScenario(e,t){let{incident:n}=e,r=[],i=nr(e.variables),labelOf=e=>t.get(e)?.name??e,a=[{type:`CREATE_PROCESS_INSTANCE`,processDefinitionSelector:{processDefinitionId:n.processId},variables:i.values}],o={},s=new Set,c=new Set,l=[],u=!1,d=!1;for(let r of e.path){if(r.state!==`COMPLETED`||r.elementId===n.elementId)continue;let e=t.get(r.elementId);if(!e){l.includes(r.elementId)||l.push(r.elementId);continue}let f=e.job??e.external;if(f&&e.type!==`bpmn:UserTask`)s.has(f)||(s.add(f),a.push({type:`MOCK_JOB_WORKER_COMPLETE_JOB`,jobType:f}));else if(e.type===`bpmn:UserTask`)a.push({type:`COMPLETE_USER_TASK`,userTaskSelector:{elementId:e.id},variables:{}}),u=!0;else if(e.type!==`bpmn:StartEvent`&&So.has(e.type)){if(e.event===`message`&&e.message){if(c.has(`m:${e.id}`))continue;c.add(`m:${e.id}`);let t=correlationKeyOf(e,i.values);e.correlationKey&&t===void 0&&(d=!0),a.push({type:`CORRELATE_MESSAGE`,name:e.message,...t===void 0?{}:{correlationKey:t}})}else e.event===`signal`&&e.signal?a.push({type:`BROADCAST_SIGNAL`,signalName:e.signal}):e.event===`timer`&&(o[e.id]={then:`fire`})}}let f=t.get(n.elementId),p=!!f&&!!(f.job??f.external)&&f.type!==`bpmn:UserTask`;p&&(o[n.elementId]={then:`incident`,errorMessage:fr(n.message).slice(0,1e3)}),f||r.push(Y(`app.incident.note.elementGone`,{element:n.elementId})),l.length&&r.push(Y(`app.incident.note.pathElementsGone`,{elements:l.join(`, `)})),i.names.length&&r.push(Y(`app.incident.note.redacted`,{names:i.names.join(`, `)})),e.variablesAreCurrent&&r.push(Y(`app.incident.note.currentVariables`)),u&&r.push(Y(`app.incident.note.taskVariables`)),d&&r.push(Y(`app.incident.note.correlationKey`)),t.get(n.elementId)?.calledProcess&&r.push(Y(`app.incident.note.calledProcess`,{element:labelOf(n.elementId)})),e.others.length&&r.push(Y(`app.incident.note.otherIncidents`,{count:e.others.length})),p||r.push(Y(`app.incident.note.mustHappenByItself`,{element:labelOf(n.elementId)})),a.push({type:`ASSERT_PROCESS_INSTANCE`,processInstanceSelector:{processDefinitionId:n.processId},state:`IS_ACTIVE`,hasActiveIncidents:!0});let m={elementId:n.elementId,...n.type?{type:n.type}:{},message:messagePattern(n.message)};n.id&&(m.incident=n.id);let h=ki(e.engine)?.key;return{testCase:{name:Y(`app.incident.scenarioName`,{element:labelOf(n.elementId),type:n.type||Y(`app.incident.noType`)}),description:Y(`app.incident.scenarioDescription`,{instance:n.instance}),instructions:a,"x-penstock":{...h?{engines:[h]}:{},...Object.keys(o).length?{behaviours:o}:{},reproduces:m}},notes:r,redacted:i.names,processId:n.processId}}function fixCase(e){let t=e[`x-penstock`]??{},n={};for(let[e,r]of Object.entries(t.behaviours??{}))n[e]=r.then===`incident`?{then:`complete`}:r;let r={...t};delete r.reproduces,delete r.behaviours;let i=e.instructions.filter(e=>e.type!==`ASSERT_PROCESS_INSTANCE`||e.hasActiveIncidents!==!0),a=i.find(e=>e.type===`CREATE_PROCESS_INSTANCE`),o=a?.type===`CREATE_PROCESS_INSTANCE`?a.processDefinitionSelector.processDefinitionId:``;return i.push({type:`ASSERT_PROCESS_INSTANCE`,processInstanceSelector:{processDefinitionId:o},hasActiveIncidents:!1}),{...e,name:Y(`app.incident.fixName`,{name:e.name}),instructions:i,"x-penstock":{...r,...Object.keys(n).length?{behaviours:n}:{}}}}async function reproduceIncident(e,t){let n=await er(e,t);return{verdict:n.outcome===`passed`?`reproduced`:n.outcome===`failed`?`notReproduced`:`skipped`,message:n.message??null,result:n}}async function verifyFix(e,t){let n=await er(fixCase(e),t);return{verdict:n.outcome===`passed`?`passes`:n.outcome===`failed`?`fails`:`skipped`,message:n.message??null,result:n}}var Co=4e3,wo=8e3;function fixPrompt(e){let{evidence:t,testCase:n}=e,r=t.incident,i=JSON.stringify(nr(t.variables).values,null,2).slice(0,Co),a=yi({testCases:[n]}).slice(0,wo);return[Y(`app.incident.prompt.intro`,{file:e.file,element:r.elementId,type:r.type||Y(`app.incident.noType`)}),``,Y(`app.incident.prompt.message`,{message:fr(r.message).slice(0,1e3)}),...t.detail?[``,Y(`app.incident.prompt.detail`,{detail:t.detail})]:[],``,Y(`app.incident.prompt.variables`,{variables:i}),``,Y(`app.incident.prompt.scenario`,{scenario:a}),...e.notes.length?[``,Y(`app.incident.prompt.notes`,{notes:e.notes.map(e=>`- ${e}`).join(`
|
|
3
|
+
`)})]:[],``,Y(`app.incident.prompt.task`)].join(`
|
|
4
|
+
`)}function scenarioSteps(e){let t=[],n=e[`x-penstock`];for(let n of e.instructions)switch(n.type){case`CREATE_PROCESS_INSTANCE`:{let e=Object.keys(n.variables??{});t.push(e.length?Y(`app.incident.step.start`,{process:n.processDefinitionSelector.processDefinitionId,names:pi(e)}):Y(`app.incident.step.startEmpty`,{process:n.processDefinitionSelector.processDefinitionId}));break}case`MOCK_JOB_WORKER_COMPLETE_JOB`:t.push(Y(`app.incident.step.mock`,{type:n.jobType}));break;case`COMPLETE_USER_TASK`:t.push(Y(`app.incident.step.task`,{element:n.userTaskSelector.elementId??n.userTaskSelector.taskName??``}));break;case`CORRELATE_MESSAGE`:t.push(Y(`app.incident.step.message`,{name:n.name}));break;case`BROADCAST_SIGNAL`:t.push(Y(`app.incident.step.signal`,{name:n.signalName}))}for(let[e,r]of Object.entries(n?.behaviours??{}))r.then===`fire`&&t.push(Y(`app.incident.step.timer`,{element:e})),r.then===`incident`&&t.push(Y(`app.incident.step.fail`,{element:e}));let r=n?.reproduces;return r&&t.push(r.type?Y(`app.incident.step.expect`,{element:r.elementId,type:r.type}):Y(`app.incident.step.expectAny`,{element:r.elementId})),t}var To=[`1h`,`24h`,`7d`,`30d`],Eo=36e5,Do={"1h":Eo,"24h":24*Eo,"7d":168*Eo,"30d":720*Eo};function isPeriod(e){return typeof e==`string`&&To.includes(e)}function sinceOf(e,t){if(!Number.isFinite(t))throw RangeError(`now`);return new Date(t-Do[e]).toISOString()}function camunda7Time(e){return e.replace(/Z$/,`+0000`)}var Oo=5e3,ko=/[\u0000-\u001f\u007f]/,Ao=encodeURIComponent;function validProcessId(e){return typeof e==`string`&&e.length>0&&e.length<=256&&!ko.test(e)}function after(e){return e.cursor===null?{limit:500}:{limit:500,after:e.cursor}}function versionsCall(e){return{method:`GET`,path:`/process-definition?key=${Ao(e)}&sortBy=version&sortOrder=desc&maxResults=5`}}function activitiesCall(e,t,n,r,i){return e===`CAMUNDA_8`?{method:`POST`,path:`/element-instances/search`,body:JSON.stringify({filter:{processDefinitionId:t,startDate:{$gte:r}},sort:[{field:`startDate`,order:`asc`}],page:after(i)})}:{method:`GET`,path:`/history/activity-instance?processDefinitionId=${Ao(n)}&startedAfter=${Ao(camunda7Time(r))}&sortBy=startTime&sortOrder=asc&firstResult=${i.offset}&maxResults=500`}}function incidentsCall(e,t,n,r){return e===`CAMUNDA_8`?{method:`POST`,path:`/incidents/search`,body:JSON.stringify({filter:{processDefinitionId:t,creationTime:{$gte:n}},sort:[{field:`creationTime`,order:`asc`}],page:after(r)})}:{method:`GET`,path:`/history/incident?processDefinitionKeyIn=${Ao(t)}&createTimeAfter=${Ao(camunda7Time(n))}&sortBy=createTime&sortOrder=asc&firstResult=${r.offset}&maxResults=500`}}var jo=1024,HeatmapRefused=class extends Error{};function json(e){if(e.status<200||e.status>=300)throw new HeatmapRefused(e.status===401||e.status===403?Y(`app.live.credentialsMayNotAllow`,{status:e.status}):e.status===0?e.body.slice(0,300):Y(`app.live.answeredStatus`,{status:e.status}));try{return JSON.parse(e.body)}catch{throw new HeatmapRefused(Y(`app.live.answeredNotJson`))}}function records(e){return Array.isArray(e)?e.slice(0,500).filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)):[]}function rawCount(e){return Array.isArray(e)?Math.min(e.length,500):0}function timeOf$1(e){return typeof e!=`string`||e.length>64?NaN:Date.parse(e.replace(/([+-]\d\d)(\d\d)$/,`$1:$2`))}e(timeOf$1,`timeOf`);function idOf(e){return typeof e==`string`&&e.length>0&&e.length<=256?e:null}function duration(e){return Number.isFinite(e)&&e>=0&&e<=31536e7?Math.round(e):null}function between(e,t){let n=timeOf$1(e),r=timeOf$1(t);return Number.isFinite(n)&&Number.isFinite(r)?duration(r-n):null}function cursorOf(e){let t=typeof e==`object`&&e?e.page:null,n=typeof t==`object`&&t?t.endCursor:null;return typeof n==`string`&&n.length>0&&n.length<=jo?n:null}function itemsOf(e,t){return e===`CAMUNDA_8`?typeof t==`object`&&t?t.items:null:t}function parseVersions(e){return records(json(e)).flatMap(e=>{let t=idOf(e.id);return t===null?[]:[{id:t}]})}function parseActivities(e,t){let n=json(t),r=records(itemsOf(e,n)),i=rawCount(itemsOf(e,n)),a=[];for(let t of r){if(e===`CAMUNDA_8`){let e=idOf(t.elementId);if(e===null||t.type===`PROCESS`)continue;let n=t.state===`TERMINATED`||t.state===`CANCELED`;a.push({elementId:e,canceled:n,durationMs:t.state===`COMPLETED`?between(t.startDate,t.endDate):null});continue}let n=idOf(t.activityId);if(n===null||t.activityType===`multiInstanceBody`)continue;let r=t.canceled===!0,i=typeof t.durationInMillis==`number`?duration(t.durationInMillis):null,o=typeof t.endTime==`string`&&t.endTime!==``;a.push({elementId:n,canceled:r,durationMs:r||!o?null:i??between(t.startTime,t.endTime)})}return{rows:a,raw:i,cursor:e===`CAMUNDA_8`?cursorOf(n):null}}function parseIncidents(e,t,n){let r=json(t),i=records(itemsOf(e,r)),a=rawCount(itemsOf(e,r)),o=[];for(let t of i){let r=idOf(e===`CAMUNDA_8`?t.elementId:t.activityId),i=timeOf$1(e===`CAMUNDA_8`?t.creationTime:t.createTime);r===null||!Number.isFinite(i)||i<n||o.push({elementId:r})}return{rows:o,raw:a,cursor:e===`CAMUNDA_8`?cursorOf(r):null}}function percentile95(e){return e.length===0?null:e[Math.max(0,Math.ceil(.95*e.length)-1)]}function aggregate(e,t){let n=new Map,r=!1,tally=e=>{let t=n.get(e);if(t)return t;if(n.size>=2e3)return r=!0,null;let i={visits:0,canceled:0,incidents:0,durations:[]};return n.set(e,i),i};for(let t of e){let e=tally(t.elementId);e&&(e.visits+=1,t.canceled&&(e.canceled+=1),t.durationMs!==null&&e.durations.push(t.durationMs))}for(let e of t){let t=tally(e.elementId);t&&(t.incidents+=1)}let i=[];for(let[e,t]of n){let n=t.durations.slice().sort((e,t)=>e-t),r=t.canceled+t.incidents;i.push({elementId:e,visits:t.visits,completed:n.length,canceled:t.canceled,incidents:t.incidents,avgMs:n.length===0?null:Math.round(n.reduce((e,t)=>e+t,0)/n.length),p95Ms:percentile95(n),failureRate:t.visits>0?Math.min(1,r/t.visits):+(r>0)})}return{elements:i.sort((e,t)=>e.elementId<t.elementId?-1:+(e.elementId>t.elementId)),dropped:r}}function within(e,t){return t?e.filter(e=>t.has(e.elementId)):e}function slowest(e,t,n=10){return within(e,t).filter(e=>e.p95Ms!==null).sort((e,t)=>t.p95Ms-e.p95Ms||t.avgMs-e.avgMs||(e.elementId<t.elementId?-1:1)).slice(0,Math.max(0,n))}function mostFailing(e,t,n=10){return within(e,t).filter(e=>e.canceled+e.incidents>0).sort((e,t)=>t.failureRate-e.failureRate||t.canceled+t.incidents-(e.canceled+e.incidents)||(e.elementId<t.elementId?-1:1)).slice(0,Math.max(0,n))}function valueOf(e,t){return t===`count`?e.visits:t===`duration`?e.p95Ms??0:e.failureRate}function levels$1(e,t){let n=new Map,r=e.reduce((e,n)=>Math.max(e,valueOf(n,t)),0);if(r<=0)return n;for(let i of e){let e=valueOf(i,t);e<=0||n.set(i.elementId,Math.min(4,Math.max(1,Math.ceil(e/r*4))))}return n}e(levels$1,`levels`);async function collect$3(e,t,n){let r=[],i={offset:0,cursor:null};for(let a=0;a<10;a+=1){if(e.left<=0)return{rows:r,truncated:!0};let a=await n(i),o=Math.min(a.rows.length,e.left);for(let e=0;e<o;e+=1)r.push(a.rows[e]);if(e.left-=o,a.raw<500)return{rows:r,truncated:!1};if(a.rows.length>o||t&&a.cursor===null)return{rows:r,truncated:!0};i={offset:i.offset+500,cursor:a.cursor}}return{rows:r,truncated:!0}}e(collect$3,`collect`);async function readHeatmap(e,t,n,r,i=Date.now()){if(!validProcessId(t))return{ok:!1,reason:Y(`app.heatmap.problem.badProcess`)};try{let a=sinceOf(n,i),o=timeOf$1(a),run=e=>r(e),s=[``];if(e!==`CAMUNDA_8`&&(s=parseVersions(await run(versionsCall(t))).map(e=>e.id),s.length===0))return{ok:!1,reason:Y(`app.heatmap.problem.notDeployed`,{process:t})};let c={left:Oo},l=[],u=!1,d=e===`CAMUNDA_8`;for(let[n,r]of s.entries()){let i=await collect$3(c,d,async n=>parseActivities(e,await run(activitiesCall(e,t,r,a,n))));if(l.push(...i.rows),u||=i.truncated,c.left<=0){u||=n<s.length-1;break}}let f=await collect$3({left:Oo},d,async n=>parseIncidents(e,await run(incidentsCall(e,t,a,n)),o));u||=f.truncated;let{elements:p,dropped:m}=aggregate(l,f.rows);return{ok:!0,heatmap:{engine:e,processId:t,period:n,since:a,rows:l.length,versions:s.length,truncated:u||m,elements:p}}}catch(e){return e instanceof HeatmapRefused?{ok:!1,reason:e.message}:{ok:!1,reason:e instanceof Error?e.message:String(e)}}}var Mo=500,No=/[\u0000-\u001f\u007f]/,Po=`__proto__`;function validInstanceId(e){return typeof e==`string`&&e.length>0&&e.length<=256&&!No.test(e)}function timeOf(e){return e?Date.parse(e.replace(/([+-]\d\d)(\d\d)$/,`$1:$2`)):NaN}function plain$2(e){let t=Object.create(null);for(let[n,r]of e)if(!(n===Po||n.length>256||No.test(n))){if(Object.keys(t).length>=200&&!(n in t))break;t[n]=r}return t}e(plain$2,`plain`);function shown$7(e){let t=plain$2(Object.entries(e)),n=nr(t),r=plain$2(Object.entries(n.values)),i=0;try{i=JSON.stringify(r).length}catch{i=65537}return i>65536?{values:plain$2([]),secrets:n.names,cut:!0}:{values:r,secrets:n.names,cut:!1}}e(shown$7,`shown`);function before(e){return plain$2(e.in.map(e=>[e.name,e.value]))}async function currentVariables(e,t,n){if(e===`CAMUNDA_8`)return bn(e,t,n);let r=await n({method:`GET`,path:`/history/variable-instance?processInstanceId=${encodeURIComponent(t)}&deserializeValues=false&maxResults=200`});if(r.status<200||r.status>=300)return{};let i;try{i=JSON.parse(r.body)}catch{return{}}let a=Object.create(null);for(let e of(Array.isArray(i)?i:[]).slice(0,200)){if(typeof e!=`object`||!e||typeof e.name!=`string`)continue;let t=e.name;t!==Po&&(a[t]={value:e.value,type:String(e.type??``)})}return ga(a)}function replayOf(e,t,n){let r=t.steps.length>500,i=e===`CAMUNDA_8`||n!==null?`current`:`history`,a=n===null?null:shown$7(n),o=t.steps.slice(0,500).map((e,t)=>{let n=a??shown$7(before(e)),r=timeOf(e.startedAt),i=timeOf(e.endedAt);return{index:t,elementId:e.elementId,elementType:e.elementType,state:e.state,startedAt:e.startedAt,endedAt:e.endedAt,durationMs:Number.isFinite(r)&&Number.isFinite(i)&&i>=r?i-r:null,variables:n.values,changed:e.changed.map(e=>e.name).filter(e=>e!==Po).slice(0,200),secrets:n.secrets,cut:n.cut}});return{engine:e,instance:t.instance,state:t.state,source:i,steps:o,truncated:r,incidents:t.incidents.slice(0,20).map(e=>({elementId:e.elementId,message:fr(e.message).slice(0,Mo)}))}}async function readReplay(e,t,n){if(!validInstanceId(t))return{ok:!1,reason:Y(`app.replay.problem.badInstance`)};try{let r=await qn(e,n,t,{runId:`replay`,limit:501});if(r.steps.length===0){let e=r.log.find(e=>e.error);return{ok:!1,reason:e?fr(e.text).slice(0,Mo):Y(`app.replay.problem.noSteps`,{instance:t})}}let i=r.steps.some(e=>e.in.length>0||e.out.length>0||e.changed.length>0);return{ok:!0,replay:replayOf(e,r,e===`CAMUNDA_8`||!i?await currentVariables(e,t,n):null)}}catch(e){return{ok:!1,reason:e instanceof Error?fr(e.message).slice(0,Mo):String(e).slice(0,Mo)}}}var Fo=/[\u0000-\u001f\u007f]/,Io=32;function startAtCall(e,t,n,r,i){if(e===`CAMUNDA_8`){let e={processDefinitionId:t,startInstructions:[{elementId:n}]};return i&&(e.tenantId=i),Object.keys(r).length>0&&(e.variables=r),{method:`POST`,path:`/process-instances`,body:JSON.stringify(e)}}let a={startInstructions:[{type:`startBeforeActivity`,activityId:n}]};return Object.keys(r).length>0&&(a.variables=ha(r)),{method:`POST`,path:`/process-definition/key/${encodeURIComponent(t)}${i?`/tenant-id/${encodeURIComponent(i)}`:``}/start`,body:JSON.stringify(a)}}function sound(e){return typeof e==`string`&&e.length>0&&e.length<=256&&!Fo.test(e)}function holdsRedacted(e,t){return e===`<redacted>`?!0:typeof e==`string`?e.includes(ur):t>Io?!0:Array.isArray(e)?e.some(e=>holdsRedacted(e,t+1)):typeof e==`object`&&e?Object.values(e).some(e=>holdsRedacted(e,t+1)):!1}function variablesOf$1(e){if(e.length>262144)return{ok:!1,reason:Y(`app.replay.problem.variablesTooLarge`)};let t=e.trim();if(t===``)return{ok:!0,variables:Object.create(null)};let n;try{n=JSON.parse(t)}catch{return{ok:!1,reason:Y(`app.live.variablesInvalidJson`)}}if(typeof n!=`object`||!n||Array.isArray(n))return{ok:!1,reason:Y(`app.live.variablesMustBeObject`)};let r=Object.entries(n);if(r.length>200)return{ok:!1,reason:Y(`app.replay.problem.tooManyVariables`,{limit:200})};let i=Object.create(null);for(let[e,t]of r){if(!sound(e)||e===`__proto__`)return{ok:!1,reason:Y(`app.replay.problem.badVariableName`)};if(holdsRedacted(t,0))return{ok:!1,reason:Y(`app.replay.problem.redacted`,{name:e})};i[e]=t}return{ok:!0,variables:i}}e(variablesOf$1,`variablesOf`);function planWhatIf(e){if(!sound(e.processId))return{ok:!1,reason:Y(`app.replay.problem.badProcess`)};if(!sound(e.elementId)||e.elements!==void 0&&!e.elements.has(e.elementId))return{ok:!1,reason:Y(`app.replay.problem.badElement`,{element:String(e.elementId).slice(0,80)})};let t=Zr(e.target);if(t===`refused`)return{ok:!1,reason:fi(e.target.url)};let n=variablesOf$1(e.variablesText);return n.ok?{ok:!0,plan:{call:startAtCall(e.engine,e.processId,e.elementId,n.variables,e.target.tenantId),processId:e.processId,elementId:e.elementId,variables:n.variables,names:Object.keys(n.variables).sort(),permission:t}}:n}async function startWhatIf(e,t,n){try{return{ok:!0,instance:_a(await n(t.call),e)}}catch(e){return{ok:!1,reason:e instanceof Error?e.message.slice(0,500):String(e).slice(0,500)}}}var Lo=[`reproduce`,`fix`,`verify`,`deploy`,`retry`],Ro=600;function shown$6(e){return fr(e instanceof Error?e.message:String(e)).slice(0,Ro)}e(shown$6,`shown`);async function runLoop(e,t){let n=new Map(Lo.map(e=>[e,{step:e,state:`pending`,text:``}])),r=null,i=!1,a=!1,emit=(e,r,i=``)=>{let a={step:e,state:r,text:i.slice(0,Ro)};n.set(e,a),t.onLine?.(a)},stop=(e,t,n)=>{emit(e,t,n),r=e},aborted=()=>t.signal?.aborted===!0,guarded=async(e,t)=>{try{return await t()}catch(t){return stop(e,`failed`,shown$6(t)),null}},restore=async()=>{if(a)try{await e.restoreFix(),i=!0}catch(e){emit(`fix`,`failed`,Y(`app.incidentLoop.rollbackFailed`,{reason:shown$6(e)}))}};emit(`reproduce`,`running`);let o=await guarded(`reproduce`,()=>e.reproduce());o&&(o.verdict===`reproduced`?emit(`reproduce`,`done`,Y(`app.cli.incident.reproduced`)):stop(`reproduce`,`failed`,o.verdict===`notReproduced`?Y(`app.cli.incident.notReproduced`,{reason:shown$6(o.message)}):Y(`app.cli.incident.notRun`,{reason:shown$6(o.message)})));let interrupted=e=>r!==null||!aborted()?r!==null:(stop(e,`failed`,Y(`app.incidentLoop.aborted`)),!0),s=``;if(!interrupted(`fix`)){emit(`fix`,`running`);let n=await guarded(`fix`,()=>e.readFix());if(n){if(!n.ok)stop(`fix`,`failed`,shown$6(n.reason));else if(s=n.xml,!t.apply)emit(`fix`,`wouldDo`,Y(`app.incidentLoop.fix.would`,{file:shown$6(n.label)}));else{let t=await guarded(`fix`,()=>e.confirm(`fix`,Y(`app.incidentLoop.confirm.fix`,{file:shown$6(n.label)})));t===!1?stop(`fix`,`declined`,Y(`app.incidentLoop.declined`)):t&&await guarded(`fix`,async()=>(await e.applyFix(s),!0))&&(a=!0,emit(`fix`,`done`,Y(`app.incidentLoop.fix.applied`,{file:shown$6(n.label)})))}}}if(!interrupted(`verify`)){emit(`verify`,`running`);let t=await guarded(`verify`,()=>e.verify(s));t&&(t.verdict===`passes`?emit(`verify`,`done`,Y(`app.incidentLoop.verify.passes`)):stop(`verify`,`failed`,t.verdict===`fails`?Y(`app.incidentLoop.verify.fails`,{reason:shown$6(t.message)}):Y(`app.cli.incident.notRun`,{reason:shown$6(t.message)}))),r!==null&&(await restore(),i&&emit(`verify`,`failed`,`${n.get(`verify`)?.text??``} ${Y(`app.incidentLoop.rolledBack`)}`.trim()))}if(!interrupted(`deploy`)){emit(`deploy`,`running`);let n=await guarded(`deploy`,()=>e.deploy(!0,s));if(n){if(n.state===`unchanged`)stop(`deploy`,`skipped`,shown$6(n.message));else if(n.state!==`wouldSend`)stop(`deploy`,`failed`,shown$6(n.message));else if(!t.apply)emit(`deploy`,`wouldDo`,shown$6(n.message));else{let t=await guarded(`deploy`,()=>e.confirm(`deploy`,Y(`app.incidentLoop.confirm.deploy`,{what:shown$6(n.message)})));if(t===!1)stop(`deploy`,`declined`,Y(`app.incidentLoop.declined`));else if(t){let t=await guarded(`deploy`,()=>e.deploy(!1,s));t&&(t.state===`sent`?emit(`deploy`,`done`,shown$6(t.message)):stop(`deploy`,t.state===`unchanged`?`skipped`:`failed`,shown$6(t.message)))}}}}if(!interrupted(`retry`)){emit(`retry`,`running`);let n=await guarded(`retry`,()=>e.retry(!0));if(n){if(n.state!==`wouldDo`)stop(`retry`,`failed`,shown$6(n.message));else if(!t.apply)emit(`retry`,`wouldDo`,shown$6(n.message));else{let t=await guarded(`retry`,()=>e.confirm(`retry`,Y(`app.incidentLoop.confirm.retry`,{what:shown$6(n.message)})));if(t===!1)stop(`retry`,`declined`,Y(`app.incidentLoop.declined`));else if(t){let t=await guarded(`retry`,()=>e.retry(!1));t&&(t.state===`done`?emit(`retry`,`done`,shown$6(t.message)):stop(`retry`,`failed`,shown$6(t.message)))}}}}let c=r;return{apply:t.apply,lines:Lo.map(e=>n.get(e)),ok:c===null,stoppedAt:c,rolledBack:i}}function cancelInstanceCall(e,t){return e===`CAMUNDA_8`?{method:`POST`,path:`/process-instances/${encodeURIComponent(t)}/cancellation`,body:`{}`}:{method:`DELETE`,path:`/process-instance/${encodeURIComponent(t)}`}}function retryIncidentCall(e,t){return{method:`POST`,path:`/incidents/${encodeURIComponent(t??e)}/resolution`,body:`{}`}}function retryJobCall(e,t=1){return{method:`PUT`,path:`/job/${encodeURIComponent(e)}/retries`,body:JSON.stringify({retries:t})}}function retryExternalTaskCall(e,t=1){return{method:`PUT`,path:`/external-task/${encodeURIComponent(e)}/retries`,body:JSON.stringify({retries:t})}}function publishMessageCall(e,t){if(e===`CAMUNDA_8`){let e={name:t.name};return t.correlationKey!==void 0&&(e.correlationKey=t.correlationKey),t.variables!==void 0&&(e.variables=t.variables),t.timeToLive!==void 0&&(e.timeToLive=t.timeToLive),t.tenantId&&(e.tenantId=t.tenantId),{method:`POST`,path:`/messages/publication`,body:JSON.stringify(e)}}let n={messageName:t.name};return t.correlationKey!==void 0&&(n.businessKey=t.correlationKey),t.variables!==void 0&&(n.processVariables=da(t.variables)),t.tenantId&&(n.tenantId=t.tenantId),{method:`POST`,path:`/message`,body:JSON.stringify(n)}}function broadcastSignalCall(e,t){if(e===`CAMUNDA_8`){let e={signalName:t.name};return t.variables!==void 0&&(e.variables=t.variables),t.tenantId&&(e.tenantId=t.tenantId),{method:`POST`,path:`/signals/broadcast`,body:JSON.stringify(e)}}let n={name:t.name};return t.variables!==void 0&&(n.variables=da(t.variables)),t.tenantId&&(n.tenantId=t.tenantId),{method:`POST`,path:`/signal`,body:JSON.stringify(n)}}function parseBody(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function reasonOf$3(e){if(e.status===0)return e.body;try{let t=JSON.parse(e.body),n=[t.message,t.detail,t.title,t.errorMessage].find(e=>typeof e==`string`);if(typeof n==`string`)return n}catch{return e.body.slice(0,300)}return e.body.slice(0,300)}e(reasonOf$3,`reasonOf`);function parseEngineAnswer(e){if(e.status>=200&&e.status<300)return{ok:!0,status:e.status,data:parseBody(e.body)};let t=reasonOf$3(e),n=e.status===401||e.status===403?Y(`app.live.credentialsMayNotAllow`,{status:e.status}):t||Y(`app.live.answeredStatus`,{status:e.status});return{ok:!1,status:e.status,problem:n}}var zo=/^[A-Za-z0-9_:.-]+$/,Bo=300;function soundId(e){return typeof e==`string`&&e.length>0&&e.length<=256&&zo.test(e)&&!e.includes(`..`)}function parsed(e){if(e.status<200||e.status>=300||e.body.length>1048576)return null;try{return JSON.parse(e.body)}catch{return null}}function refusal$1(e){return fr(e instanceof Error?e.message:String(e)).slice(0,Bo)}e(refusal$1,`refusal`);async function camunda7(e,t){if(!soundId(e.id))return{ok:!1,reason:Y(`app.incidentLoop.problem.noIncidentId`)};let n=parsed(await t({method:`GET`,path:`/incident/${encodeURIComponent(e.id)}`})),r=n?.configuration;return!n||!soundId(r)?{ok:!1,reason:Y(`app.incidentLoop.problem.noJob`,{incident:e.id})}:n.incidentType===`failedJob`?{ok:!0,plan:{calls:[retryJobCall(r,1)],what:Y(`app.incidentLoop.what.job`,{id:r})}}:n.incidentType===`failedExternalTask`?{ok:!0,plan:{calls:[retryExternalTaskCall(r,1)],what:Y(`app.incidentLoop.what.externalTask`,{id:r})}}:{ok:!1,reason:Y(`app.incidentLoop.problem.noRetryFor`,{type:String(n.incidentType??``).slice(0,80)})}}async function camunda8(e,t){if(!soundId(e.id))return{ok:!1,reason:Y(`app.incidentLoop.problem.noIncidentId`)};let n=[];if(e.type===`JOB_NO_RETRIES`){let r=parsed(await t({method:`GET`,path:`/incidents/${encodeURIComponent(e.id)}`})),i=r?.errorType===`JOB_NO_RETRIES`&&r.jobKey!==void 0&&r.jobKey!==null?String(r.jobKey):null;if(i===null||!soundId(i))return{ok:!1,reason:Y(`app.incidentLoop.problem.noJob`,{incident:e.id})};n.push({method:`PATCH`,path:`/jobs/${encodeURIComponent(i)}`,body:JSON.stringify({changeset:{retries:1}})})}return n.push(retryIncidentCall(e.id)),{ok:!0,plan:{calls:n,what:Y(`app.incidentLoop.what.incident`,{id:e.id})}}}async function planRetry(e,t,n){try{return e===`CAMUNDA_8`?await camunda8(t,n):await camunda7(t,n)}catch(e){return{ok:!1,reason:refusal$1(e)}}}async function runRetry(e,t){try{for(let n of e.calls){let r=await t(n);if(r.status<200||r.status>=300)return{ok:!1,reason:Y(`app.incidentLoop.problem.retryRefused`,{status:r.status,what:e.what})}}return{ok:!0,message:Y(`app.incidentLoop.retried`,{what:e.what})}}catch(e){return{ok:!1,reason:refusal$1(e)}}}var Vo=`__debug`,Ho=`penstock-debug-`,Uo=`element`,Wo=`penstockElement`,Go=`P1D`,Ko=`Penstock debugger`,qo=new Set([`bpmn:ParallelGateway`,`bpmn:InclusiveGateway`,`bpmn:ComplexGateway`]),Jo=/\sid="([^"]*)"/g,InstrumentError=class extends Error{};function debugProcessId(e){return`${e}${Vo}`}function debugTopic(e){return`${Ho}${safeSession(e)}`}function safeSession(e){let t=e.replace(/[^A-Za-z0-9-]+/g,`-`).replace(/^-+|-+$/g,``);return t===``?`session`:t}function canHaveBreakpoint(e){let t=e?.$type;return typeof t!=`string`||typeof e?.id!=`string`||e.id===``||e.isForCompensation===!0||t===`bpmn:SubProcess`&&e.triggeredByEvent===!0?!1:t.endsWith(`Task`)||t.endsWith(`SubProcess`)||t===`bpmn:Transaction`||t===`bpmn:CallActivity`||t.endsWith(`Gateway`)||t===`bpmn:IntermediateCatchEvent`||t===`bpmn:IntermediateThrowEvent`}function hasFlowElements(e){return Array.isArray(e?.flowElements)}function idsIn(e){let t=new Set;for(let n of e.matchAll(Jo))t.add(n[1]);return t}function fresh$2(e,t){let n=t;for(let r=2;e.has(n);r+=1)n=`${t}_${r}`;return e.add(n),n}e(fresh$2,`fresh`);function removeFrom(e,t){if(!e)return;let n=e.indexOf(t);n>=0&&e.splice(n,1)}function executable(e){return e.isExecutable!==!1}function planes(e){return(e.diagrams??[]).map(e=>e?.plane).filter(Boolean)}function dropFromDiagrams(e,t){if(t.size!==0)for(let n of planes(e))Array.isArray(n.planeElement)&&(n.planeElement=n.planeElement.filter(e=>!t.has(e?.bpmnElement)))}function dropTriggers(e){let t=new Set,n=[],r=e.flowElements??[],i=r.filter(e=>e.$type===`bpmn:StartEvent`),typed=e=>Array.isArray(e.eventDefinitions)&&e.eventDefinitions.length>0,a=i.find(e=>!typed(e))??i[0];if(!a)return{dropped:n,removed:t};typed(a)&&(a.set(`eventDefinitions`,void 0),n.push(a.id));for(let e of i)if(e!==a&&typed(e)){n.push(e.id),t.add(e);for(let n of r)n.$type===`bpmn:SequenceFlow`&&n.sourceRef===e&&(t.add(n),removeFrom(n.targetRef?.incoming,n))}return t.size>0&&(e.flowElements=r.filter(e=>!t.has(e))),{dropped:n,removed:t}}function breakpointTask(e,t,n){let{moddle:r}=e;if(e.camunda8){let i=r.create(`zeebe:TaskDefinition`,{type:e.topic}),a=r.create(`zeebe:Header`,{key:Uo,value:n.id}),o=r.create(`zeebe:TaskHeaders`,{values:[a]}),s=r.create(`bpmn:ExtensionElements`,{values:[i,o]});return r.create(`bpmn:ServiceTask`,{id:t,extensionElements:s})}let i=r.create(`camunda:InputParameter`,{name:Wo,value:n.id}),a=r.create(`camunda:InputOutput`,{inputParameters:[i]}),o=r.create(`bpmn:ExtensionElements`,{values:[a]}),s=r.create(`bpmn:ServiceTask`,{id:t,extensionElements:o});return s.set(`camunda:type`,`external`),s.set(`camunda:topic`,e.topic),s}function guard(e,t,n,r,i,a){let o=fresh$2(e.used,`${n.id}__breakpoint${i}`),s=breakpointTask(e,o,n),c=e.moddle.create(`bpmn:SequenceFlow`,{id:fresh$2(e.used,`${o}__flow`),sourceRef:s,targetRef:n});s.$parent=t,c.$parent=t;let l=s.get(`incoming`);for(let e of r)e.targetRef=s,l.push(e);return s.get(`outgoing`).push(c),a.push(s,c),e.breakpoints.set(o,n.id),c}function instrumentScope(e,t,n){let r=t.flowElements??=[],i=new Map;for(let e of r){if(e.$type!==`bpmn:SequenceFlow`||!e.targetRef)continue;let t=i.get(e.targetRef);t?t.push(e):i.set(e.targetRef,[e])}let a=[];for(let o of r){if(hasFlowElements(o)&&n.push(o),!canHaveBreakpoint(o)||e.only&&!e.only.has(o.id))continue;let r=i.get(o);if(!r||r.length===0||r.some(e=>e.sourceRef?.$type===`bpmn:EventBasedGateway`))continue;e.elements.push(o.id);let s=qo.has(o.$type)&&r.length>1?r.map((n,r)=>guard(e,t,o,[n],`_${r+1}`,a)):[guard(e,t,o,r,``,a)],c=new Set(r);o.incoming=[...(o.incoming??[]).filter(e=>!c.has(e)),...s]}for(let e of a)r.push(e)}function pointCallsAtCopies(e,t){let n=[...e];for(;n.length>0;){let e=n.pop();for(let r of e.flowElements??[]){if(hasFlowElements(r)&&n.push(r),r.$type!==`bpmn:CallActivity`)continue;let e=r.calledElement;typeof e==`string`&&t.has(e)&&(r.calledElement=t.get(e));let i=r.extensionElements?.values?.find(e=>e.$type===`zeebe:CalledElement`);i&&typeof i.processId==`string`&&t.has(i.processId)&&(i.processId=t.get(i.processId))}}}function copyIds(e,t){let n=new Set(e.map(e=>e.id)),r=new Map,i=new Set;for(let a of e){let e=debugProcessId(a.id);for(;t.has(e)&&!n.has(e)||i.has(e);)e=`${e}_`;i.add(e),r.set(a.id,e)}return i.forEach(e=>t.add(e)),r}async function instrument(e,t){let n=await On(e,Si(t.engine));if(!n)throw new InstrumentError(Y(`app.processDebug.problem.unreadable`));let r=(n.rootElements??[]).filter(e=>e.$type===`bpmn:Process`),i=r.filter(executable);if(i.length===0)throw new InstrumentError(Y(`app.processDebug.problem.noProcess`));let a=t.processId===void 0?i[0]:i.find(e=>e.id===t.processId);if(!a)throw new InstrumentError(Y(`app.processDebug.problem.unknownProcess`,{process:t.processId??``}));let o=idsIn(e),s=copyIds(r,o),c=a.id,l=debugTopic(t.sessionId),u={moddle:Dn(n),topic:l,used:o,only:t.only,breakpoints:new Map,elements:[],camunda8:ji(t.engine)},d=[];for(let e of r){if(!executable(e))continue;let{dropped:t,removed:r}=dropTriggers(e);d.push(...t),dropFromDiagrams(n,r);let i=[e];for(;i.length>0;)instrumentScope(u,i.pop(),i);!u.camunda8&&!e.get(`camunda:historyTimeToLive`)&&e.set(`camunda:historyTimeToLive`,Go)}pointCallsAtCopies(r,s);for(let e of r)e.id=s.get(e.id);return n.set(`exporter`,Ko),n.set(`exporterVersion`,safeSession(t.sessionId)),{xml:await En(n),sourceProcessId:c,processId:s.get(c),topic:l,breakpoints:u.breakpoints,elements:u.elements,triggersRemoved:d}}var Yo=`penstock-debug`,Xo=432e5,DebugEngineError=class extends Error{status;constructor(e,t){super(e),this.status=t}},Zo=encodeURIComponent;function reasonOf$2(e){if(e.status===0)return e.body;try{let t=JSON.parse(e.body),n=[t.message,t.detail,t.title].find(e=>typeof e==`string`);if(typeof n==`string`&&n!==``)return n}catch{return e.body.slice(0,200)}return e.body.slice(0,200)}e(reasonOf$2,`reasonOf`);function refusal(e){if(e.status===0)return new DebugEngineError(e.body||Y(`app.processDebug.problem.unreachable`),0);if(e.status===401||e.status===403)return new DebugEngineError(Y(`app.live.credentialsMayNotAllow`,{status:e.status}),e.status);let t=reasonOf$2(e);return new DebugEngineError(t?Y(`app.live.answeredStatus`,{status:e.status})+`: ${t}`:Y(`app.live.answeredStatus`,{status:e.status}),e.status)}function succeeded(e){if(e.status<200||e.status>=300)throw refusal(e);return e}function bodyOf$1(e){if(succeeded(e),e.body.trim()===``)return null;try{return JSON.parse(e.body)}catch{throw new DebugEngineError(Y(`app.live.answeredNotJson`),e.status)}}e(bodyOf$1,`bodyOf`);function list$1(e){return Array.isArray(e)?e:[]}e(list$1,`list`);function text$1(e){return e==null?``:String(e)}e(text$1,`text`);function debugDeployCall(e,t,n,r){return pa({engine:e,name:t,source:`penstock-debug`,changedOnly:!1,tenantId:r??null},[{name:`${t}.bpmn`,content:n}])}function parseDebugDeployment(e,t,n){succeeded(n);let r=ba(e,n.body).filter(e=>e.kind===`process`),i=r.find(e=>e.key===t);if(!i||i.id===``)throw new DebugEngineError(Y(`app.processDebug.problem.notDeployed`,{process:t}),n.status);if(e===`CAMUNDA_8`)return{deployment:r.map(e=>e.id).filter(Boolean).join(`,`),definition:i.id};let a=``;try{a=text$1(JSON.parse(n.body).id)}catch{a=``}if(a===``)throw new DebugEngineError(Y(`app.live.answeredNotJson`),n.status);return{deployment:a,definition:i.id}}function debugStartCall(e,t,n,r){return fa(e,t,n,r)}function parseDebugStart(e,t){succeeded(t);try{return _a(e,t)}catch(e){throw new DebugEngineError(e instanceof Error?e.message:String(e),t.status)}}function fetchBreakpointsCall(e,t,n=10,r){return e===`CAMUNDA_8`?{method:`POST`,path:`/jobs/activation`,body:JSON.stringify({type:t,worker:Yo,timeout:Xo,maxJobsToActivate:n,requestTimeout:-1,...r?{tenantIds:[r]}:{}})}:{method:`POST`,path:`/external-task/fetchAndLock`,body:JSON.stringify({workerId:Yo,maxTasks:n,topics:[{topicName:t,lockDuration:Xo,deserializeValues:!1,...r?{tenantIdIn:[r]}:{}}]})}}function parseBreakpoints(e,t,n){let r=bodyOf$1(t);return e===`CAMUNDA_8`?(r&&typeof r==`object`?list$1(r.jobs):[]).map(e=>{let t=text$1(e?.elementId),r=e?.customHeaders?.[Uo],i=e?.variables&&typeof e.variables==`object`&&!Array.isArray(e.variables)?{...e.variables}:{};return{key:text$1(e?.jobKey),element:typeof r==`string`&&r!==``?r:n.get(t)??``,breakpoint:t,instance:text$1(e?.processInstanceKey),variables:i}}).filter(e=>e.key!==``):list$1(r).map(e=>{let t=ga(e?.variables),r=t[Wo];delete t[Wo];let i=text$1(e?.activityId);return{key:text$1(e?.id),element:n.get(i)??(typeof r==`string`?r:``),breakpoint:i,instance:text$1(e?.processInstanceId),variables:t}}).filter(e=>e.key!==``)}function completeBreakpointCall(e,t,n){return e===`CAMUNDA_8`?{method:`POST`,path:`/jobs/${Zo(t.key)}/completion`,body:JSON.stringify(Object.keys(n).length>0?{variables:n}:{})}:{method:`POST`,path:`/external-task/${Zo(t.key)}/complete`,body:JSON.stringify({workerId:Yo,variables:da(n)})}}function changedVariables(e,t){let n={};for(let r of Object.keys(t))Object.hasOwn(e,r)&&JSON.stringify(e[r])===JSON.stringify(t[r])||Object.defineProperty(n,r,{value:t[r],enumerable:!0,writable:!0,configurable:!0});return n}function instanceStatusCall(e,t){return e===`CAMUNDA_8`?{method:`GET`,path:`/process-instances/${Zo(t)}`}:{method:`GET`,path:`/process-instance/${Zo(t)}`}}function parseInstanceStatus(e,t){if(e!==`CAMUNDA_8`&&t.status===404)return{state:`finished`};let n=bodyOf$1(t);if(e===`CAMUNDA_8`){let e=text$1(n?.state);return e===`COMPLETED`||e===`TERMINATED`||e===`CANCELED`?{state:`finished`}:n?.hasIncident===!0?{state:`incident`}:{state:`active`}}return n?.ended===!0?{state:`finished`}:{state:`active`}}function incidentCall(e,t){return e===`CAMUNDA_8`?{method:`POST`,path:`/incidents/search`,body:JSON.stringify({filter:{processInstanceKey:t,state:`ACTIVE`},page:{limit:1}})}:{method:`GET`,path:`/incident?processInstanceId=${Zo(t)}&maxResults=1`}}function parseIncident(e,t){let n=bodyOf$1(t),r=e===`CAMUNDA_8`?list$1(n?.items)[0]:list$1(n)[0];if(!r)return null;let i=e===`CAMUNDA_8`?r.errorMessage??r.errorType:r.incidentMessage??r.incidentType;return typeof i==`string`&&i!==``?i:Y(`app.processDebug.problem.incident`)}function findInstancesCall(e,t){return e===`CAMUNDA_8`?{method:`POST`,path:`/process-instances/search`,body:JSON.stringify({filter:{processDefinitionKey:t,state:`ACTIVE`},page:{limit:100}})}:{method:`GET`,path:`/process-instance?processDefinitionId=${Zo(t)}&maxResults=100`}}function parseInstances(e,t){let n=bodyOf$1(t);return(e===`CAMUNDA_8`?list$1(n?.items).map(e=>e?.processInstanceKey):list$1(n).map(e=>e?.id)).map(text$1).filter(e=>e!==``)}function cancelDebugInstanceCall(e,t){return cancelInstanceCall(e,t)}function deleteDebugDeploymentCalls(e,t){return e===`CAMUNDA_8`?t.split(`,`).filter(Boolean).map(e=>({method:`POST`,path:`/resources/${Zo(e)}/deletion`,body:`{}`})):t===``?[]:[{method:`DELETE`,path:`/deployment/${Zo(t)}?cascade=true`}]}var Qo=new Set([404,409]);function reasonOf$1(e){return refusal(e).message}e(reasonOf$1,`reasonOf`);async function removeCopy(e,t){let n=[],r=new Set(t.instances.filter(Boolean)),i=ji(e.engine)?t.definition?[t.definition]:t.deployment.split(`,`):t.definition?[t.definition]:[];for(let t of i.filter(Boolean)){let i=await e.call(findInstancesCall(e.engine,t));if(i.status!==404)try{parseInstances(e.engine,i).forEach(e=>r.add(e))}catch(e){n.push(Y(`app.processDebug.cleanup.searchFailed`,{reason:e instanceof Error?e.message:String(e)}))}}let a=[];for(let t of r){let n=await e.call(cancelDebugInstanceCall(e.engine,t));n.status>=200&&n.status<300||Qo.has(n.status)||a.push(Y(`app.processDebug.cleanup.cancelFailed`,{instance:t,reason:reasonOf$1(n)}))}let o=e.attempts??3,s=deleteDebugDeploymentCalls(e.engine,t.deployment),c=null;for(let n=1;n<=o;n+=1){c=null;for(let n of s){let r=await e.call(n);if(!(r.status>=200&&r.status<300)&&r.status!==404){c=Y(`app.processDebug.cleanup.deleteFailed`,{deployment:t.deployment,reason:reasonOf$1(r)});break}}if(c===null)break;n<o&&await e.sleep((e.backoffMs??500)*n)}return(ji(e.engine)||c!==null)&&n.push(...a),c!==null&&n.push(c),n}async function sweepDebugLeftovers(e,t,n){let r=[],i=[];for(let a of await t.list())n-a.at<=3e5||((await removeCopy(e,{deployment:a.deployment,instances:a.instance?[a.instance]:[]})).length===0?(await t.drop(a.deployment),r.push(a.deployment)):i.push(a.deployment));return{removed:r,kept:i}}var $o={now:()=>Date.now(),sleep:(e,t)=>new Promise(n=>{if(t?.aborted){n();return}let r=setTimeout(done,e);function done(){clearTimeout(r),t?.removeEventListener(`abort`,done),n()}t?.addEventListener(`abort`,done,{once:!0})})},es={minMs:300,maxMs:2e3,factor:1.5,requestMs:2e4,pausedMs:3e3,touchMs:6e4,failures:3,waitingAfter:5};function newSessionId(){return`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`}function messageOf$1(e){return e instanceof Error?e.message:String(e)}e(messageOf$1,`messageOf`);function transient(e){return e instanceof DebugEngineError&&(e.status===0||e.status>=500||e.status===429)}var DebugSession=class{sessionId;options;clock;pace;abort=new AbortController;user;listeners=new Set;settledWaiters=[];state;plan=null;deployment=null;definition=null;instance=null;mode;current=null;queue=[];command=null;wake=null;loop=null;cleaning=null;starting=!1;starter=null;touched=0;passed=0;constructor(e){this.options=e,this.sessionId=safeSession(e.sessionId??newSessionId()),this.clock=e.clock??$o,this.pace={...es,...e.pace},this.user=new Set(e.breakpoints??[]),this.mode=e.mode??`continue`,this.state={phase:`idle`,processId:e.processId,debugProcessId:null,instance:null,element:null,variables:{},atBreakpoint:!1,waiting:!1,message:null,cleanup:`none`,cleanupProblems:[],leftover:null,visited:0}}get snapshot(){return this.state}get processId(){return this.options.processId}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}setBreakpoints(e){this.user.clear();for(let t of e)this.user.add(t)}settled(){return this.isSettled()?Promise.resolve(this.state):new Promise(e=>this.settledWaiters.push(e))}async start(){return this.starting||this.state.phase!==`idle`||(this.starting=!0,this.update({phase:`deploying`,message:null}),this.starter=this.begin().catch(e=>this.fail(e instanceof InstrumentError?e.message:messageOf$1(e))),await this.starter),this.state}continue(e){return this.resume(`continue`,e)}step(e){return this.resume(`step`,e)}async stop(){return this.abort.abort(),this.release(),await this.starter?.catch(()=>void 0),await this.loop?.catch(()=>void 0),this.terminal()||this.update({phase:`stopped`,message:Y(`app.processDebug.message.stopped`),element:null,variables:{},atBreakpoint:!1,waiting:!1,visited:this.passed}),await this.cleanup(),this.state}async retryCleanup(){return this.state.cleanup===`failed`&&(this.cleaning=null,await this.cleanup()),this.state}terminal(){return this.state.phase===`finished`||this.state.phase===`failed`||this.state.phase===`stopped`}isSettled(){return this.state.phase===`paused`||this.terminal()}update(e){let t={...this.state,...e};if(!Object.keys(e).every(e=>JSON.stringify(this.state[e])===JSON.stringify(t[e]))){this.state=t;for(let e of[...this.listeners])try{e(t)}catch{this.listeners.delete(e)}this.isSettled()&&this.settledWaiters.splice(0).forEach(e=>e(t))}}release(){let e=this.wake;this.wake=null,e?.()}async call(e){let t=Promise.resolve().then(()=>this.options.ask(e)).catch(e=>({status:0,body:messageOf$1(e)})),n=new AbortController,r=this.clock.sleep(this.pace.requestMs,n.signal).then(()=>n.signal.aborted?new Promise(()=>void 0):{status:0,body:Y(`app.processDebug.problem.timedOut`,{seconds:Math.round(this.pace.requestMs/1e3)})});try{return await Promise.race([t,r])}finally{n.abort()}}async begin(){let{engine:e,processId:t,xml:n}=this.options,r=await instrument(n,{engine:e,sessionId:this.sessionId,processId:t});if(this.plan=r,this.update({debugProcessId:r.processId}),this.abort.signal.aborted)return;let i=parseDebugDeployment(e,r.processId,await this.call(debugDeployCall(e,r.processId,r.xml,this.options.tenantId)));this.deployment=i.deployment,this.definition=i.definition,await this.remember(),this.update({leftover:{deployment:i.deployment,instance:null}}),this.abort.signal.aborted||(this.instance=parseDebugStart(e,await this.call(debugStartCall(e,r.processId,this.options.variables??{},this.options.tenantId))),await this.remember(),this.update({instance:this.instance,leftover:{deployment:i.deployment,instance:this.instance}}),this.abort.signal.aborted||(this.update({phase:`running`}),this.loop=this.run()))}async remember(){this.options.ledger&&this.deployment&&(this.touched=this.clock.now(),await this.options.ledger.add({deployment:this.deployment,at:this.touched,...this.instance?{instance:this.instance}:{}}).catch(()=>void 0))}async touch(){this.clock.now()-this.touched>=this.pace.touchMs&&await this.remember()}resume(e,t){return this.state.phase!==`paused`||this.command?Promise.resolve(this.state):(this.command={mode:e,variables:t??null},this.release(),this.settledAfter())}settledAfter(){return new Promise(e=>{this.settledWaiters.push(e)})}async fail(e){this.terminal()||this.update({phase:`failed`,message:e,element:null,variables:{},atBreakpoint:!1,waiting:!1,visited:this.passed}),await this.cleanup()}async finish(e){this.terminal()||this.update({phase:`finished`,message:e,element:null,variables:{},atBreakpoint:!1,waiting:!1,visited:this.passed}),await this.cleanup()}cleanup(){return this.cleaning??=this.removeCopy(),this.cleaning}async removeCopy(){if(!this.deployment){this.update({cleanup:`none`});return}this.update({cleanup:`pending`,cleanupProblems:[]});let e=this.deployment,t;try{t=await removeCopy({engine:this.options.engine,call:e=>this.call(e),sleep:e=>this.clock.sleep(e)},{deployment:e,definition:this.definition??void 0,instances:this.instance?[this.instance]:[]})}catch(e){t=[messageOf$1(e)]}t.length===0?(await this.options.ledger?.drop(e).catch(()=>void 0),this.update({cleanup:`done`,cleanupProblems:[],leftover:null})):this.update({cleanup:`failed`,cleanupProblems:t})}async run(){let e=this.pace.minMs,t=0,n=0;for(;!this.abort.signal.aborted&&!this.terminal();)try{let r=await this.tick();if(t=0,r===`ended`)return;r===`idle`?(n+=1,n>=this.pace.waitingAfter&&this.update({waiting:!0}),e=Math.min(Math.round(e*this.pace.factor),this.pace.maxMs),await this.touch(),await this.clock.sleep(e,this.abort.signal)):(n=0,e=this.pace.minMs,this.state.waiting&&this.update({waiting:!1}))}catch(n){if(this.abort.signal.aborted)return;if(transient(n)&&t+1<this.pace.failures){t+=1,await this.clock.sleep(e,this.abort.signal);continue}let r=transient(n)?Y(`app.processDebug.problem.unreachableAfter`,{attempts:t+1,reason:messageOf$1(n)}):messageOf$1(n);await this.fail(r);return}}async tick(){let{engine:e}=this.options,t=this.instance;if(this.state.phase===`paused`)return this.whilePaused();if(this.queue.length===0){let t=parseBreakpoints(e,await this.call(fetchBreakpointsCall(e,this.plan.topic,void 0,this.options.tenantId)),this.plan.breakpoints);if(this.abort.signal.aborted)return`ended`;this.queue.push(...t)}if(this.queue.length>0)return this.reach(this.queue[0]);let n=parseInstanceStatus(e,await this.call(instanceStatusCall(e,t)));if(this.abort.signal.aborted)return`ended`;if(n.state===`finished`)return await this.finish(Y(`app.processDebug.message.finished`)),`ended`;if(n.state===`incident`||e!==`CAMUNDA_8`){let n=parseIncident(e,await this.call(incidentCall(e,t)));if(this.abort.signal.aborted)return`ended`;if(n!==null)return await this.fail(Y(`app.processDebug.message.incident`,{reason:n})),`ended`}return`idle`}async reach(e){return e.element===``||this.mode!==`step`&&!this.user.has(e.element)?(await this.complete(e,{}),this.abort.signal.aborted?`ended`:(this.queue.shift(),this.passed+=1,`worked`)):(this.queue.shift(),this.passed+=1,this.current=e,this.update({phase:`paused`,element:e.element,variables:e.variables,atBreakpoint:this.user.has(e.element),waiting:!1,message:null,visited:this.passed}),`paused`)}async complete(e,t){let n=await this.call(completeBreakpointCall(this.options.engine,e,t));n.status!==404&&succeeded(n)}async whilePaused(){let{engine:e}=this.options;for(;!this.abort.signal.aborted;){if(!this.command){let e=new AbortController;await new Promise(t=>{this.wake=t,this.clock.sleep(this.pace.pausedMs,e.signal).then(()=>t())}),e.abort(),this.wake=null}if(this.abort.signal.aborted)return`ended`;let t=this.command;if(t){let e=this.current,n=t.variables?changedVariables(e.variables,t.variables):{};return await this.complete(e,n),this.abort.signal.aborted?`ended`:(this.command=null,this.mode=t.mode,this.current=null,this.update({phase:`running`,element:null,variables:{},atBreakpoint:!1}),`worked`)}await this.touch();let n=parseInstanceStatus(e,await this.call(instanceStatusCall(e,this.instance)));if(this.abort.signal.aborted)return`ended`;if(n.state===`finished`)return await this.finish(Y(`app.processDebug.message.endedElsewhere`)),`ended`}return`ended`}},DebugSessions=class{sessions=new Map;async begin(e){let t=this.sessions.get(e.processId);t&&await t.stop();let n=new DebugSession(e);return this.sessions.set(e.processId,n),n}get(e){return this.sessions.get(e)}async disposeAll(){let e=[...this.sessions.values()];this.sessions.clear(),await Promise.all(e.map(e=>e.stop().catch(()=>void 0)))}},ts=`https://api.github.com/repos/camunda/connectors/releases?per_page=100`,ns=/^[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}$/,rs=/^[A-Za-z0-9._-]+$/,is=/^(\d+)\.(\d+)\.(\d+)$/,as=/^[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}$/,os=/^[^/]+\/(connectors\/(?:[^/]+\/)+element-templates\/(?:[^/]+\/)*[^/]+\.json)$/,ss=new Set([`src`,`test`,`tests`,`test-resources`,`testdata`,`fixtures`]),cs=/^data:image\/(?:png|jpe?g|gif|webp|svg\+xml|x-icon|vnd\.microsoft\.icon)[;,]/i,ls=/^\.tmp-(.+)-(\d{13})-[a-z0-9]+$/,us=36e5,ds=24*us,fs=6e4,ps=536870912,ms=8388608,hs=1048576,gs=262144,_s=2,vs=`.index.json`,ys=`.state.json`,bs=new TextDecoder,xs=new TextEncoder;function archiveUrl(e){if(!ns.test(e))throw Error(`Not a release tag: ${e}`);return`https://codeload.github.com/camunda/connectors/tar.gz/refs/tags/${e}`}function pickReleaseTag(e){if(!Array.isArray(e))throw Error(`GitHub did not return a list of releases`);let t=null;for(let n of e){if(!n||typeof n!=`object`)continue;let{tag_name:e,draft:r,prerelease:i}=n;if(r!==!1||i!==!1||typeof e!=`string`||!rs.test(e))continue;let a=is.exec(e);if(!a)continue;let o=a.slice(1).map(Number);(!t||compareParts(o,t.parts)>0)&&(t={tag:e,parts:o})}if(!t)throw Error(`GitHub lists no final camunda/connectors release`);return t.tag}function compareParts(e,t){for(let n=0;n<Math.max(e.length,t.length);n++){let r=(e[n]??0)-(t[n]??0);if(r!==0)return r}return 0}function templatePathOf(e){let t=os.exec(e);if(!t)return null;let n=t[1];return n.split(`/`).some(e=>!as.test(e)||ss.has(e.toLowerCase()))?null:n}function pastTime(e,t){if(!e)return null;let n=Date.parse(e);return Number.isNaN(n)||n>t+fs?null:n}function retryDelay(e){return e<=1?us:ds}function refreshDue(e,t){let n=pastTime(e.checkedAt,t),r=pastTime(e.failedAt,t);return r!==null&&e.failures>0&&(n===null||r>=n)?t-r>=retryDelay(e.failures):n===null||t-n>=ds}function nextAttemptOf(e,t){let n=pastTime(e.failedAt,t);return n===null||e.failures===0?null:new Date(n+retryDelay(e.failures)).toISOString()}var Ss={ref:null,previousRef:null,checkedAt:null,failedAt:null,failures:0,lastError:null};function stringOrNull(e){return typeof e==`string`?e:null}function refOrNull(e){return typeof e==`string`&&ns.test(e)?e:null}async function readState(e){try{let t=(await e.file(`read`,ys)).content;if(!t)return{...Ss};let n=JSON.parse(bs.decode(t));return{ref:refOrNull(n.ref),previousRef:refOrNull(n.previousRef),checkedAt:stringOrNull(n.checkedAt),failedAt:stringOrNull(n.failedAt),failures:typeof n.failures==`number`&&Number.isInteger(n.failures)&&n.failures>0?n.failures:0,lastError:stringOrNull(n.lastError)}}catch{return{...Ss}}}async function writeState(e,t){await e.file(`write`,ys,xs.encode(JSON.stringify(t,null,2)))}function isTemplate(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!(typeof t.id!=`string`||!t.id||t.id.length>256||typeof t.name!=`string`||!t.name||t.version!==void 0&&!(Number.isInteger(t.version)&&t.version>=0)||t.appliesTo!==void 0&&!(Array.isArray(t.appliesTo)&&t.appliesTo.every(e=>typeof e==`string`)))}function templatesIn(e){try{let t=JSON.parse(bs.decode(e));return(Array.isArray(t)?t:[t]).filter(isTemplate)}catch{return[]}}function variantOf$1(e){return(typeof e.elementType==`string`?e.elementType:e.elementType?.value)||(e.appliesTo??[]).join(`|`)}e(variantOf$1,`variantOf`);function keyOf$3(e,t,n){return`${e}@${t??`_`}#${n}`}e(keyOf$3,`keyOf`);function strings(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function summarize(e,t,n){let r=e.version??null,i=typeof e.elementType?.value==`string`?e.elementType.value:null,a={},o=e.engines,s=typeof o==`object`&&o&&!Array.isArray(o)?o:{};for(let[e,t]of Object.entries(s))typeof t==`string`&&(a[e]=t);let c=e.icon?.contents,l=e.documentationRef;return{key:keyOf$3(e.id,r,variantOf$1(e)),ref:n,path:t,id:e.id,version:r,name:e.name,description:typeof e.description==`string`?e.description:null,appliesTo:strings(e.appliesTo),elementType:i,engines:a,category:typeof e.category?.name==`string`?e.category.name:null,keywords:[...new Set([...strings(e.keywords),...strings(e.metadata?.keywords)])],icon:typeof c==`string`&&c.length<=gs&&cs.test(c)?c:null,documentationRef:typeof l==`string`&&l.startsWith(`https://`)?l:null,deprecated:e.deprecated!==void 0&&e.deprecated!==!1,deprecatedMessage:typeof e.deprecated==`object`&&e.deprecated!==null&&typeof e.deprecated.message==`string`?e.deprecated.message:null}}function isSummary(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.key==`string`&&typeof t.id==`string`&&typeof t.name==`string`&&typeof t.path==`string`&&templatePathOf(`x/${t.path}`)===t.path&&Array.isArray(t.appliesTo)&&Array.isArray(t.keywords)}async function loadIndex(e,t){if(!ns.test(t))return null;try{let n=(await e.file(`read`,`${t}/${vs}`)).content;if(!n)return null;let r=JSON.parse(bs.decode(n));if(r.format!==_s||r.ref!==t||!Array.isArray(r.templates))return null;let i=r.templates.filter(isSummary).map(e=>({...e,ref:t}));return i.length>0?i:null}catch{return null}}function newestOf(e){let t=new Map;for(let n of e){let e=`${n.id}#${variantOf$1(n)}`,r=t.get(e);(!r||(r.version??-1)<(n.version??-1))&&t.set(e,n)}return[...t.values()].sort((e,t)=>e.name.localeCompare(t.name)||(e.elementType??``).localeCompare(t.elementType??``))}function buildCatalog(e,t,n){return{ref:e,checkedAt:n,templates:t,newest:newestOf(t)}}var Cs=new WeakMap,ws=new WeakMap;async function cachedCatalog(e,t){if(!t.ref)return null;let n=Cs.get(e);if(n&&n.ref===t.ref)return n;let r=await loadIndex(e,t.ref);if(!r)return null;let i=buildCatalog(t.ref,r,t.checkedAt);return Cs.set(e,i),i}function messageOf(e){return e instanceof Error?e.message:String(e)}async function fetchChecked(e,t){let n=await e.fetch(t);if(n.failure)throw Error(n.failure);if(n.status===403||n.status===429)throw Error(Y(`app.connectors.githubRefused`,{status:n.status}));if(n.status!==200)throw Error(Y(`app.connectors.githubAnswered`,{status:n.status}));if(n.body.byteLength>67108864)throw Error(Y(`app.connectors.responseTooLarge`));return n.body}async function*gunzip(e,t){let n=new ReadableStream({start(t){t.enqueue(e),t.close()}}).pipeThrough(new DecompressionStream(`gzip`)).getReader(),r=0;try{for(;;){let e;try{e=await n.read()}catch{throw Error(Y(`app.connectors.archiveDamaged`))}if(e.done)return;if(r+=e.value.byteLength,r>t)throw Error(Y(`app.connectors.archiveTooLarge`));yield e.value}}finally{await n.cancel().catch(()=>void 0)}}var ByteQueue=class{chunks=[];offset=0;length=0;push(e){e.byteLength!==0&&(this.chunks.push(e),this.length+=e.byteLength)}take(e){let t=new Uint8Array(e),n=0;for(;n<e;){let r=this.chunks[0],i=r.byteLength-this.offset,a=Math.min(i,e-n);t.set(r.subarray(this.offset,this.offset+a),n),n+=a,this.consume(a,i)}return t}drop(e){let t=0;for(;t<e&&this.chunks.length>0;){let n=this.chunks[0].byteLength-this.offset,r=Math.min(n,e-t);t+=r,this.consume(r,n)}return t}consume(e,t){this.length-=e,e===t?(this.chunks.shift(),this.offset=0):this.offset+=e}};function field(e,t,n){let r=e.subarray(t,t+n),i=r.indexOf(0);return bs.decode(i<0?r:r.subarray(0,i))}function octal(e,t,n){let r=field(e,t,n).trim();return/^[0-7]+$/.test(r)?parseInt(r,8):NaN}function checksumMatches(e){let t=0;for(let n=0;n<512;n++)t+=n>=148&&n<156?32:e[n];return octal(e,148,8)===t}function paxPath(e){let t=null;for(let n of bs.decode(e).split(`
|
|
5
|
+
`)){let e=/^\d+ path=(.*)$/.exec(n);e&&(t=e[1])}return t}async function*tarEntries(e,t){let n=e[Symbol.asyncIterator](),r=new ByteQueue,damaged=()=>Error(Y(`app.connectors.archiveDamaged`)),fill=async e=>{for(;r.length<e;){let e=await n.next();if(e.done)return!1;r.push(e.value)}return!0},skip=async e=>{let t=e;for(;t>0;){if(r.length===0&&!await fill(1))throw damaged();t-=r.drop(t)}},read=async e=>{if(!await fill(e))throw damaged();return r.take(e)},i=null;try{for(;;){if(!await fill(512))throw damaged();let e=r.take(512);if(e.every(e=>e===0))return;if(!checksumMatches(e))throw damaged();let n=octal(e,124,12);if(!Number.isSafeInteger(n))throw damaged();let a=Math.ceil(n/512)*512,o=String.fromCharCode(e[156]);if(o===`x`||o===`L`){if(n>hs)throw damaged();let e=await read(n);i=o===`x`?paxPath(e)??i:bs.decode(e).replace(/\0.*$/s,``),await skip(a-n);continue}if(o===`g`){await skip(a);continue}let s=field(e,345,155),c=field(e,0,100),l=i??(s?`${s}/${c}`:c);if(i=null,(o===`0`||o===`\0`||o===`7`)&&n<=ms&&t(l)){let e=await read(n);await skip(a-n),yield{path:l,data:e}}else await skip(a)}}finally{await n.return?.(void 0)}}async function exists$1(e,t){return(await e.file(`exists`,t)).pathExists===!0}e(exists$1,`exists`);async function commit(e,t,n){try{await e.file(`rename`,t,void 0,n);return}catch(r){if(await loadIndex(e,n)){await e.file(`delete`,t).catch(()=>void 0);return}if(!await exists$1(e,n))throw r}await e.file(`delete`,n),await e.file(`rename`,t,void 0,n)}async function download(e,t,n){let r=await fetchChecked(e,archiveUrl(t)),i=`.tmp-${t}-${n()}-${Math.random().toString(36).slice(2,10)||`x`}`;await e.file(`mkdirs`,i);try{let n=new Map,a=tarEntries(gunzip(r,ps),e=>templatePathOf(e)!==null);for await(let r of a){let a=templatePathOf(r.path),o=templatesIn(r.data);if(a&&o.length!==0){await e.file(`write`,`${i}/${a}`,r.data);for(let e of o){let r=summarize(e,a,t);n.has(r.key)||n.set(r.key,r)}}}if(n.size===0)throw Error(Y(`app.connectors.archiveHasNoTemplates`));let o=[...n.values()],s={format:_s,ref:t,templates:o.map(e=>({...e,ref:void 0}))};return await e.file(`write`,`${i}/${vs}`,xs.encode(JSON.stringify(s))),await commit(e,i,t),o}catch(t){throw await e.file(`delete`,i).catch(()=>void 0),t}}async function prune(e,t,n){let r=(await e.file(`list`,``)).entries??[];for(let i of r){let r=ls.exec(i);(i.startsWith(`.tmp-`)?!r||n-Number(r[2])>us:!i.startsWith(`.`)&&ns.test(i)&&i!==t.ref&&i!==t.previousRef)&&await e.file(`delete`,i).catch(()=>void 0)}}async function refresh(e,t,n){let r=await fetchChecked(e,ts),i;try{i=JSON.parse(bs.decode(r))}catch{throw Error(`GitHub returned something that is not JSON`)}let a=pickReleaseTag(i),o=await loadIndex(e,a)??await download(e,a,n),s=t.previousRef===a?null:t.previousRef;t.ref&&t.ref!==a&&(s=t.ref);let c={ref:a,previousRef:s,checkedAt:new Date(n()).toISOString(),failedAt:null,failures:0,lastError:null};await writeState(e,c),await prune(e,c,n()).catch(()=>void 0);let l=buildCatalog(a,o,c.checkedAt);return Cs.set(e,l),l}async function load$1(e,t,n){let r=await readState(e);if(!t&&!refreshDue(r,n())){let t=await cachedCatalog(e,r);if(t)return{catalog:t,error:null,nextAttempt:null};if(r.failures>0)return{catalog:null,error:r.lastError??Y(`app.connectors.couldNotBeDownloaded`),nextAttempt:nextAttemptOf(r,n())}}try{return{catalog:await refresh(e,r,n),error:null,nextAttempt:null}}catch(t){let i={...r,failedAt:new Date(n()).toISOString(),failures:r.failures+1,lastError:messageOf(t)};return await writeState(e,i).catch(()=>void 0),{catalog:await cachedCatalog(e,r).catch(()=>null),error:i.lastError,nextAttempt:nextAttemptOf(i,n())}}}e(load$1,`load`);function getCatalog(e,t={}){let n=ws.get(e);if(n)return n;let r=load$1(e,t.forceRefresh===!0,t.now??Date.now).finally(()=>{ws.get(e)===r&&ws.delete(e)});return ws.set(e,r),r}function pick(e,t){return e.length===0?null:t?e.find(e=>e.elementType===t)??e.find(e=>e.appliesTo.includes(t))??e[0]:e[0]}async function loadTemplate(e,t){if(!ns.test(t.ref)||templatePathOf(`x/${t.path}`)!==t.path)return null;let n=(await e.file(`read`,`${t.ref}/${t.path}`)).content;return n?templatesIn(n).find(e=>keyOf$3(e.id,e.version??null,variantOf$1(e))===t.key)??null:null}async function resolveTemplates(e,t){let n=await readState(e),r=[],i=await cachedCatalog(e,n).catch(()=>null);i&&r.push(i.templates);let a=n.previousRef?await loadIndex(e,n.previousRef):null;a&&r.push(a);let o=new Map,s=[];for(let n of t){let t=null;for(let i of r){let r=pick(i.filter(e=>e.id===n.id&&e.version===n.version),n.elementType);if(r&&(t=o.get(r.key)??await loadTemplate(e,r).catch(()=>null),t)){o.set(r.key,t);break}}t||s.push(n)}return{templates:[...o.values()],missing:s}}function versionOf(e){let t=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(e.trim());return t?[Number(t[1]),Number(t[2]??0),Number(t[3]??0)]:null}function comparator(e,t){if(e===`*`||e.toLowerCase()===`x`)return!0;let n=/^(\^|~|>=|<=|>|<|=)?v?(\d+)(?:\.(\d+|x|\*))?(?:\.(\d+|x|\*))?(?:-[0-9A-Za-z.-]+)?$/i.exec(e);if(!n)return null;let[,r=`=`,i,a,o]=n,numeric=e=>e===void 0||!/^\d+$/.test(e)?void 0:Number(e),s=Number(i),c=numeric(a),l=c===void 0?void 0:numeric(o),u=[s,c??0,l??0],nextOf=()=>c===void 0?[s+1,0,0]:l===void 0?[s,c+1,0]:[s,c,l+1],at=e=>compareParts(t,e);switch(r){case`^`:{let e=s>0?[s+1,0,0]:c!==void 0&&c>0?[0,c+1,0]:nextOf();return at(u)>=0&&at(e)<0}case`~`:return at(u)>=0&&at(c===void 0?[s+1,0,0]:[s,c+1,0])<0;case`>=`:return at(u)>=0;case`>`:return at(nextOf())>=0;case`<`:return at(u)<0;case`<=`:return at(nextOf())<0;default:return at(u)>=0&&at(nextOf())<0}}function satisfiesEngine(e,t){let n=versionOf(t);if(!n)return null;let r=!1;for(let t of e.split(`||`).map(e=>e.trim()).filter(Boolean)){let e=t.split(/\s+/).map(e=>comparator(e,n));if(!e.some(e=>e===null)&&(r=!0,e.every(e=>e===!0)))return!0}return!r&&null}function centreOf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function contains(e,t){return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height}function area(e){return e.width*e.height}function distanceToRect(e,t){let n=Math.max(e.x-t.x,0,t.x-(e.x+e.width)),r=Math.max(e.y-t.y,0,t.y-(e.y+e.height));return Math.hypot(n,r)}var Ts=new Set([`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`,`boundaryEvent`]);function isRound(e){return Ts.has(e.kind)}function isDiamond(e){return e.kind.endsWith(`Gateway`)}function borderPoint(e,t){let n=centreOf(e),r=t.x-n.x,i=t.y-n.y;if(r===0&&i===0)return n;let a;return a=isRound(e)?Math.min(e.width,e.height)/2/Math.hypot(r,i):isDiamond(e)?1/(Math.abs(r)/(e.width/2)+Math.abs(i)/(e.height/2)):Math.min(r===0?1/0:e.width/2/Math.abs(r),i===0?1/0:e.height/2/Math.abs(i)),{x:n.x+r*a,y:n.y+i*a}}function stepRoute(e,t){let n=centreOf(e),r=centreOf(t),horizontal=(e,t,n,r)=>{let i={x:e.x+e.width,y:n.y},a={x:t.x,y:r.y};if(Math.abs(n.y-r.y)<1)return[i,{x:a.x,y:i.y}];let o=(i.x+a.x)/2;return[i,{x:o,y:i.y},{x:o,y:a.y},a]},vertical=(e,t,n,r)=>{let i={x:n.x,y:e.y+e.height},a={x:r.x,y:t.y};if(Math.abs(n.x-r.x)<1)return[i,{x:i.x,y:a.y}];let o=(i.y+a.y)/2;return[i,{x:i.x,y:o},{x:a.x,y:o},a]};return t.x>=e.x+e.width?horizontal(e,t,n,r):e.x>=t.x+t.width?horizontal(t,e,r,n).reverse():t.y>=e.y+e.height?vertical(e,t,n,r):e.y>=t.y+t.height?vertical(t,e,r,n).reverse():null}function nestLanes(e){let t=e.filter(e=>e.kind===`pool`);for(let e of t)t.some(t=>t!==e&&contains(t,centreOf(e))&&area(t)>area(e))&&(e.kind=`lane`)}var Es=`http://www.omg.org/spec/BPMN/20100524/MODEL`,Ds=`http://www.omg.org/spec/BPMN/20100524/DI`,Os=`http://www.omg.org/spec/DD/20100524/DC`,ks=`http://www.omg.org/spec/DD/20100524/DI`,As=new Set([`subProcess`,`transaction`,`eventSubProcess`]),js=new Set([`task`,`callActivity`,`subProcess`,`transaction`,`eventSubProcess`]),Ms=new Set([`pool`,`lane`,`subProcess`,`transaction`,`eventSubProcess`]),Ns=new Set([`dataObject`,`dataStore`]),Ps=new Set([`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`,`boundaryEvent`]),Fs=25,Is={task:`task`,user:`userTask`,service:`serviceTask`,script:`scriptTask`,send:`sendTask`,receive:`receiveTask`,manual:`manualTask`,businessRule:`businessRuleTask`},Ls={message:`messageEventDefinition`,timer:`timerEventDefinition`,error:`errorEventDefinition`,escalation:`escalationEventDefinition`,signal:`signalEventDefinition`,conditional:`conditionalEventDefinition`,link:`linkEventDefinition`,compensation:`compensateEventDefinition`,cancel:`cancelEventDefinition`,terminate:`terminateEventDefinition`},Rs={task:`Activity`,callActivity:`Activity`,subProcess:`Activity`,transaction:`Activity`,eventSubProcess:`Activity`,startEvent:`Event`,endEvent:`Event`,intermediateCatchEvent:`Event`,intermediateThrowEvent:`Event`,boundaryEvent:`Event`,exclusiveGateway:`Gateway`,parallelGateway:`Gateway`,inclusiveGateway:`Gateway`,complexGateway:`Gateway`,eventBasedGateway:`Gateway`,dataObject:`DataObjectReference`,dataStore:`DataStoreReference`,textAnnotation:`TextAnnotation`,pool:`Participant`,lane:`Lane`};function escapeAttribute(e){return qa(e).replace(/\r/g,``).replace(/\n/g,` `).replace(/\t/g,`	`)}function tag(e,t,n=``){let r=Object.entries(t).filter(e=>e[1]!==void 0).map(([e,t])=>` ${e}="${escapeAttribute(t)}"`).join(``);return n?`<bpmn:${e}${r}>${n}</bpmn:${e}>`:`<bpmn:${e}${r}/>`}function documentation(e){return e?.trim()?`<bpmn:documentation>${Ya(e.trim())}</bpmn:documentation>`:``}function round(e){return String(Math.round(e))}function buildBpmn(e){let t=[...e.notes],note=(e,n)=>t.push({level:e,message:n}),n=new Set,unique=(e,t)=>{let r=`${e}_${t.replace(/[^A-Za-z0-9_.-]/g,`_`)||`1`}`,i=r;for(let e=2;n.has(i);e+=1)i=`${r}_${e}`;return n.add(i),i},labelOf=e=>e.name.replace(/\s+$/g,``),describe=e=>e.name.trim()?`"${e.name.replace(/\s+/g,` `).trim()}"`:Y(`app.import.note.unnamed`,{kind:Y(`app.import.kind.${e.kind}`)}),r=e.nodes.map(e=>({...e,bpmnId:``})),i=new Map(r.map(e=>[e.id,e]));for(let e of r)e.kind===`lane`&&!r.some(t=>t!==e&&(t.kind===`pool`||t.kind===`lane`)&&contains(t,centreOf(e))&&area(t)>area(e))&&!(e.parent&&i.get(e.parent)?.kind===`pool`)&&(e.kind=`pool`,note(`assumed`,Y(`app.import.note.laneAsPool`,{node:describe(e)})));let a=r.filter(e=>Ms.has(e.kind)),ownerOf=e=>{if(e.kind===`pool`)return;let t=e.parent?i.get(e.parent):void 0,allowed=t=>t===e||!Ms.has(t.kind)?!1:e.kind!==`lane`||t.kind===`pool`||t.kind===`lane`;if(t&&allowed(t)&&area(t)>area(e))return t;let n=centreOf(e);return a.filter(t=>allowed(t)&&contains(t,n)&&(!Ms.has(e.kind)||area(t)>area(e))).sort((e,t)=>area(e)-area(t))[0]};for(let e of r)e.owner=ownerOf(e);let o=r.filter(e=>js.has(e.kind));for(let e of r){if(e.kind!==`boundaryEvent`)continue;let t=e.host?i.get(e.host):void 0,n=centreOf(e),r=o.filter(t=>t!==e).map(e=>({candidate:e,distance:distanceToRect(e,n)})).filter(e=>e.distance<=Fs).sort((e,t)=>e.distance-t.distance)[0],a=t&&js.has(t.kind)?t:r?.candidate;a?(e.hostNode=a,e.owner=a.owner):(e.kind=`intermediateCatchEvent`,note(`assumed`,Y(`app.import.note.boundaryEvent`,{node:describe(e)})))}let poolOf=e=>{for(let t=e;t;t=t.owner)if(t.kind===`pool`)return t},s=r.filter(e=>e.kind===`pool`);if(s.length>0){let e=[];for(let t of r){if(t.kind===`pool`||poolOf(t))continue;let n=s.map(e=>({pool:e,distance:distanceToRect(e,centreOf(t))})).sort((e,t)=>e.distance-t.distance)[0].pool;t.owner=t.kind===`lane`?n:t.owner??n,t.kind!==`lane`&&t.owner&&t.owner!==n||e.push(t)}if(e.length>0){let t=e.slice(0,5).map(describe).join(`, `);note(`assumed`,Y(`app.import.note.outsidePools`,{count:e.length,names:`${t}${e.length>5?`, ...`:``}`}))}}let laneOf=e=>{let t=e.owner;return t?.kind===`lane`?t:void 0},flowContainerOf=e=>{for(let t=e.owner;t;t=t.owner)if(t.kind===`pool`||As.has(t.kind))return t};for(let e of r)e.bpmnId=unique(e.kind===`pool`?`Participant`:e.kind===`lane`?`Lane`:Rs[e.kind]??`Element`,e.id);let c=[],flowNote=e=>e.name.trim()?`"${e.name.replace(/\s+/g,` `).trim()}"`:Y(`app.import.unnamedConnector`);for(let t of e.flows){let e=i.get(t.source),n=i.get(t.target);if(!e||!n){note(`unmapped`,Y(`app.import.note.flowNotAttached`,{flow:flowNote(t)}));continue}if(e.kind===`lane`||n.kind===`lane`){note(`unmapped`,Y(`app.import.note.flowOnLane`,{flow:flowNote(t)}));continue}let r=t.kind===`sequence`?`sequence`:t.kind===`message`?`message`:`association`,a=Ns.has(e.kind),o=Ns.has(n.kind);if(e.kind===`textAnnotation`||n.kind===`textAnnotation`)r=`association`;else if(a||o){let t=a?n:e,i=Ps.has(t.kind),s=t.kind===`endEvent`||t.kind===`intermediateThrowEvent`,c=js.has(t.kind)||i&&(a?s:!s);a&&o?r=`association`:c&&r!==`message`?r=a?`dataInput`:`dataOutput`:(r=`association`,note(`assumed`,Y(`app.import.note.dataAssociation`,{node:describe(t)})))}else if(e.kind===`pool`||n.kind===`pool`)r!==`message`&¬e(`assumed`,Y(`app.import.note.flowToPool`,{flow:flowNote(t)})),r=`message`;else{let i=poolOf(e)!==poolOf(n);r===`sequence`&&i?(r=`message`,note(`assumed`,Y(`app.import.note.flowAcrossPools`,{flow:flowNote(t),from:describe(e),to:describe(n)}))):r===`message`&&!i?(r=`association`,note(`assumed`,Y(`app.import.note.messageInsidePool`,{flow:flowNote(t)}))):r===`sequence`&&flowContainerOf(e)!==flowContainerOf(n)&&(r=`association`,note(`assumed`,Y(`app.import.note.flowAcrossSubProcess`,{flow:flowNote(t)})))}c.push({flow:t,bpmnId:``,kind:r,source:e,target:n})}for(let e of c){let t={sequence:`Flow`,message:`Flow`,association:`Association`,dataInput:`DataInputAssociation`,dataOutput:`DataOutputAssociation`}[e.kind];if(e.bpmnId=unique(t,e.flow.id),e.kind===`sequence`)e.container=flowContainerOf(e.source);else if(e.kind===`association`){let t=flowContainerOf(e.source);e.container=t===flowContainerOf(e.target)?t:void 0}}let l=new Map,u=new Map;for(let e of c)e.kind===`sequence`&&e.flow.isDefault&&u.set(e.source,e);let childrenOf=e=>r.filter(t=>flowContainerOf(t)===e&&t.kind!==`pool`&&t.kind!==`lane`),eventDefinitionXml=e=>{if(!e.definition)return``;let t=Ls[e.definition];return t?e.definition===`conditional`?`<bpmn:conditionalEventDefinition><bpmn:condition xsi:type="bpmn:tFormalExpression"/></bpmn:conditionalEventDefinition>`:e.definition===`link`?tag(t,{name:e.name.trim()||`link`}):tag(t,{}):(note(`lost`,Y(`app.import.note.multipleEvent`,{node:describe(e),kind:e.definition===`multiple`?`multiple`:Y(`app.import.parallelMultiple`)})),``)},loopXml=e=>e.loop===`standard`?`<bpmn:standardLoopCharacteristics/>`:e.loop===`parallel`?`<bpmn:multiInstanceLoopCharacteristics/>`:e.loop===`sequential`?`<bpmn:multiInstanceLoopCharacteristics isSequential="true"/>`:``,dataXml=e=>{let t=c.filter(t=>t.kind===`dataInput`&&t.target===e||t.kind===`dataOutput`&&t.source===e),n=c.filter(t=>t.kind===`dataInput`&&t.target===e),r=c.filter(t=>t.kind===`dataOutput`&&t.source===e);if(t.length===0)return``;let i=n.length>0?unique(`Property`,e.id):``;return i&&l.set(e.id,i),(i?`<bpmn:property id="${i}" name="__targetRef_placeholder"/>`:``)+n.map(e=>`<bpmn:dataInputAssociation id="${e.bpmnId}"><bpmn:sourceRef>${e.source.bpmnId}</bpmn:sourceRef><bpmn:targetRef>${i}</bpmn:targetRef></bpmn:dataInputAssociation>`).join(``)+r.map(e=>`<bpmn:dataOutputAssociation id="${e.bpmnId}"><bpmn:targetRef>${e.target.bpmnId}</bpmn:targetRef></bpmn:dataOutputAssociation>`).join(``)},nodeXml=e=>{let t={id:e.bpmnId,name:labelOf(e)||void 0},n=u.get(e),r=n?{...t,default:n.bpmnId}:t,i=documentation(e.documentation);switch(e.kind){case`task`:return tag(Is[e.taskType??`task`],r,i+dataXml(e)+loopXml(e));case`callActivity`:return tag(`callActivity`,r,i+dataXml(e)+loopXml(e));case`subProcess`:case`transaction`:case`eventSubProcess`:return tag(e.kind===`transaction`?`transaction`:`subProcess`,{...r,triggeredByEvent:e.kind===`eventSubProcess`?`true`:void 0},i+dataXml(e)+loopXml(e)+containerXml(e));case`startEvent`:return tag(`startEvent`,{...t,isInterrupting:e.interrupting===!1?`false`:void 0},i+dataXml(e)+eventDefinitionXml(e));case`endEvent`:return tag(`endEvent`,t,i+dataXml(e)+eventDefinitionXml(e));case`intermediateCatchEvent`:return tag(`intermediateCatchEvent`,t,i+dataXml(e)+eventDefinitionXml(e));case`intermediateThrowEvent`:return tag(`intermediateThrowEvent`,t,i+dataXml(e)+eventDefinitionXml(e));case`boundaryEvent`:return tag(`boundaryEvent`,{...t,cancelActivity:e.interrupting===!1?`false`:void 0,attachedToRef:e.hostNode?.bpmnId},i+dataXml(e)+eventDefinitionXml(e));case`exclusiveGateway`:case`parallelGateway`:case`inclusiveGateway`:case`complexGateway`:case`eventBasedGateway`:return tag(e.kind,r,i);case`dataObject`:return`${tag(`dataObject`,{id:`${e.bpmnId}_object`})}${tag(`dataObjectReference`,{...t,dataObjectRef:`${e.bpmnId}_object`},``)}`;case`dataStore`:return tag(`dataStoreReference`,t,i);default:return``}},artifactXml=e=>{let t=childrenOf(e).filter(e=>e.kind===`textAnnotation`),n=c.filter(t=>t.kind===`association`&&t.container===e);return t.map(e=>tag(`textAnnotation`,{id:e.bpmnId},`<bpmn:text>${Ya(e.name.trim())}</bpmn:text>`)).join(``)+n.map(e=>tag(`association`,{id:e.bpmnId,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``)},flowElementsXml=e=>{let t=childrenOf(e).filter(e=>e.kind!==`textAnnotation`),n=c.filter(t=>t.kind===`sequence`&&t.container===e);return t.map(nodeXml).join(``)+n.map(e=>tag(`sequenceFlow`,{id:e.bpmnId,name:e.flow.name.trim()||void 0,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``)};function containerXml(e){return flowElementsXml(e)+artifactXml(e)}let laneSetXml=e=>{let lanes=e=>r.filter(t=>t.kind===`lane`&&t.owner===e).map(e=>{let t=r.filter(t=>laneOf(t)===e&&t.kind!==`textAnnotation`&&t.kind!==`pool`&&t.kind!==`lane`&&!Ns.has(t.kind)).map(e=>`<bpmn:flowNodeRef>${e.bpmnId}</bpmn:flowNodeRef>`).join(``),n=lanes(e);return tag(`lane`,{id:e.bpmnId,name:labelOf(e)||void 0},t+(n?`<bpmn:childLaneSet id="${e.bpmnId}_children">${n}</bpmn:childLaneSet>`:``))}).join(``),t=lanes(e);return t?`<bpmn:laneSet id="${e.bpmnId}_lanes">${t}</bpmn:laneSet>`:``},d=s.length>0,f=new Map,p=``,m=``;if(d){m=unique(`Collaboration`,`1`);let e=[];for(let t of s)if(r.some(e=>e!==t&&poolOf(e)===t&&e.kind!==`lane`)||r.some(e=>e.kind===`lane`&&poolOf(e)===t)){let n=unique(`Process`,t.id);f.set(t,n),e.push(tag(`participant`,{id:t.bpmnId,name:labelOf(t)||void 0,processRef:n})),p+=tag(`process`,{id:n,isExecutable:`false`},documentation(t.documentation)+laneSetXml(t)+containerXml(t))}else e.push(tag(`participant`,{id:t.bpmnId,name:labelOf(t)||void 0}));let t=c.filter(e=>e.kind===`message`).map(e=>tag(`messageFlow`,{id:e.bpmnId,name:e.flow.name.trim()||void 0,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``),n=c.filter(e=>e.kind===`association`&&!e.container).map(e=>tag(`association`,{id:e.bpmnId,sourceRef:e.source.bpmnId,targetRef:e.target.bpmnId})).join(``);p=tag(`collaboration`,{id:m},e.join(``)+t+n)+p}else{let e=unique(`Process`,`1`);f.set(void 0,e),m=e,p=tag(`process`,{id:e,isExecutable:`false`},containerXml(void 0))}let order=e=>e.kind===`pool`?0:e.kind===`lane`?1:As.has(e.kind)?2:3,expanded=e=>r.some(t=>t.owner===e),h=[...r].sort((e,t)=>order(e)-order(t)).map(e=>{let t={id:`${e.bpmnId}_di`,bpmnElement:e.bpmnId};(e.kind===`pool`||e.kind===`lane`)&&(t.isHorizontal=e.horizontal===!1?`false`:`true`),As.has(e.kind)&&(t.isExpanded=expanded(e)?`true`:`false`),e.kind===`exclusiveGateway`&&(t.isMarkerVisible=`true`);let n=`<dc:Bounds x="${round(e.x)}" y="${round(e.y)}" width="${round(e.width)}" height="${round(e.height)}"/>`;return`<bpmndi:BPMNShape${Object.entries(t).filter(e=>e[1]!==void 0).map(([e,t])=>` ${e}="${escapeAttribute(t)}"`).join(``)}>${n}</bpmndi:BPMNShape>`}).join(``),waypointsOf=e=>{let{source:t,target:n,flow:r}=e,i=r.points??[];if(i.length===0&&r.orthogonal){let e=stepRoute(t,n);if(e)return e}let a=borderPoint(t,i[0]??centreOf(n)),o=borderPoint(n,i[i.length-1]??centreOf(t));return[a,...i,o]},g=c.map(e=>{let t=waypointsOf(e).map(e=>`<di:waypoint x="${round(e.x)}" y="${round(e.y)}"/>`).join(``);return`<bpmndi:BPMNEdge id="${e.bpmnId}_di" bpmnElement="${e.bpmnId}">${t}</bpmndi:BPMNEdge>`}).join(``),_=m;return{xml:`<?xml version="1.0" encoding="UTF-8"?>\n<bpmn:definitions xmlns:bpmn="${Es}" xmlns:bpmndi="${Ds}" xmlns:dc="${Os}" xmlns:di="${ks}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="${unique(`Definitions`,`1`)}" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Penstock">\n${p}\n<bpmndi:BPMNDiagram id="${unique(`BPMNDiagram`,`1`)}"><bpmndi:BPMNPlane id="${unique(`BPMNPlane`,`1`)}" bpmnElement="${_}">${h}${g}</bpmndi:BPMNPlane></bpmndi:BPMNDiagram>\n</bpmn:definitions>\n`,notes:t,summary:{elements:r.filter(e=>e.kind!==`pool`&&e.kind!==`lane`).length,flows:c.length,pools:s.length,lanes:r.filter(e=>e.kind===`lane`).length}}}var zs=80;function isControl(e){return e<32||e>=127&&e<=159||e===1564||e===6158||e>=8203&&e<=8207||e>=8232&&e<=8238||e>=8288&&e<=8303||e===65279||e>=65529&&e<=65531}function plainName(e,t=zs){let n=``;for(let r of e.slice(0,t))n+=isControl(r.codePointAt(0)??0)?`?`:r;return n}var Bs=`http://flowable.org/bpmn`,Vs=`http://www.omg.org/spec/BPMN/20100524/MODEL`,Hs=`http://camunda.org/schema/1.0/bpmn`,Us=`http://camunda.org/schema/zeebe/1.0`,Ws=20,Gs=512,Ks=/^[$#]\{\s*([A-Za-z_]\w*)\s*\}$/,qs=[`camunda7`,`camunda8`],Js={camunda7:`Camunda 7`,camunda8:`Camunda 8`},Ys=new Set([`assignee`,`candidateUsers`,`candidateGroups`,`dueDate`,`priority`,`formKey`,`class`,`delegateExpression`,`expression`,`resultVariable`,`exclusive`,`collection`,`elementVariable`,`initiator`,`candidateStarterUsers`,`candidateStarterGroups`]),Xs=new Set([`executionListener`,`taskListener`,`in`,`out`,`failedJobRetryTimeCycle`]),Zs=new Set([`userTask`,`serviceTask`,`sendTask`,`businessRuleTask`]);function isFlowable(e){for(let t of e.scope.values())if(t===`http://flowable.org/bpmn`)return!0;return!1}var Tally=class{counts=new Map;add(e){let t=plainName(e);this.counts.set(t,(this.counts.get(t)??0)+1)}get total(){let e=0;for(let t of this.counts.values())e+=t;return e}list(){let e=[...this.counts.keys()].sort(),t=e.slice(0,Ws).map(e=>(this.counts.get(e)??0)>1?`${e} (${this.counts.get(e)})`:e);return e.length>Ws?`${t.join(`, `)}, …`:t.join(`, `)}};function entriesOf(e){let t=[],n=[{node:e,parent:null}];for(let e=n.pop();e;e=n.pop()){t.push(e);for(let t=e.node.children.length-1;t>=0;--t)n.push({node:e.node.children[t],parent:e.node})}return t}function prefixesIn(e){let t=new Set;for(let{node:n}of e){t.add(n.prefix);for(let e of Object.keys(n.attrs))e.startsWith(`xmlns:`)&&t.add(e.slice(6))}return t}function prefixFor(e,t,n){for(let[n,r]of Object.entries(e.root.attrs))if(n.startsWith(`xmlns:`)&&r===t)return n.slice(6);for(let[n,r]of e.added)if(r===t)return n;let r=n;for(let t=1;e.taken.has(r);t+=1)r=`${n}${t}`;return e.taken.add(r),e.added.set(r,t),e.root.attrs[`xmlns:${r}`]=t,r}function make(e,t,n,r,i){return{name:t?`${t}:${n}`:n,local:n,prefix:t,ns:r,attrs:i,children:[],text:``,scope:e.scope}}function flowableAttributes(e){let t=[];for(let n of Object.keys(e.attrs)){let r=n.indexOf(`:`);r<0||n.startsWith(`xmlns`)||e.scope.get(n.slice(0,r))===`http://flowable.org/bpmn`&&t.push({key:n,local:n.slice(r+1)})}return t}function extensionsOf(e,t){let n=t.children.find(e=>e.local===`extensionElements`&&e.ns===Vs);if(n)return n;let r=0;for(;r<t.children.length&&t.children[r].local===`documentation`&&t.children[r].ns===Vs;)r+=1;let i=make(t,t.prefix,`extensionElements`,Vs,{});return t.children.splice(r,0,i),i}function zeebeChild(e,t,n,r){let i=extensionsOf(e,t);return!i.children.some(e=>e.ns===Us&&e.local===n)&&(i.children.push(make(i,prefixFor(e,Us,`zeebe`),n,Us,r)),!0)}function removeChild(e,t){e.children.splice(e.children.indexOf(t),1)}function rename(e,t){let n=prefixFor(e,Hs,`camunda`);t.prefix=n,t.name=`${n}:${t.local}`,t.ns=Hs}function literalOrFeel(e,t){let n=t.trim();if(n===``||n.length>Gs)return null;if(!n.includes("${")&&!n.includes(`#{`))return n.startsWith(`=`)?null:n;let r=ir(n);return r.ok?(e.expressions.add(n),r.feel):null}function jobTypeOf$1(e,t){let n=t.trim();if(n===``||n.length>Gs)return null;if(e===`class`)return n.includes("${")||n.includes(`#{`)?null:tr(`class`,n);let r=Ks.exec(n)?.[1];return r?tr(`bean`,r):null}e(jobTypeOf$1,`jobTypeOf`);function camunda7Attributes(e,t){for(let{key:n,local:r}of flowableAttributes(t)){let i=r===`async`?`asyncBefore`:Ys.has(r)?r:null;if(!i)continue;let a=t.attrs[n];delete t.attrs[n],t.attrs[`${prefixFor(e,Hs,`camunda`)}:${i}`]=a,e.converted+=1}}function camunda7FormProperty(e,t,n){let r=t.attrs.id;if(!r)return!1;let i=prefixFor(e,Hs,`camunda`),a=n.children.find(e=>e.ns===Hs&&e.local===`formData`);a||(a=make(n,i,`formData`,Hs,{}),n.children.push(a));let o={id:r};t.attrs.name&&(o.label=t.attrs.name),t.attrs.type&&(o.type=t.attrs.type),t.attrs.default&&(o.defaultValue=t.attrs.default);let s=make(a,i,`formField`,Hs,o);for(let[n,r]of Object.entries(t.attrs))[`id`,`name`,`type`,`default`,`required`].includes(n)||(s.attrs[`${t.prefix}:${n}`]=r,e.kept.add(`flowable:formProperty.${n}`));if(t.attrs.required===`true`){let e=make(s,i,`validation`,Hs,{});e.children.push(make(e,i,`constraint`,Hs,{name:`required`,config:`true`})),s.children.push(e)}for(let n of t.children)n.ns===`http://flowable.org/bpmn`&&n.local===`value`?s.children.push(make(s,i,`value`,Hs,{...n.attrs})):e.kept.add(`flowable:${n.local}`);return a.children.push(s),removeChild(n,t),e.converted+=1,!0}function camunda7Element(e,t,n,r){let i=n.local===`extensionElements`&&n.ns===Vs;if(t.local===`formProperty`)return i&&camunda7FormProperty(e,t,n);let a=r.has(n)&&(n.local===`executionListener`||n.local===`taskListener`);return(Xs.has(t.local)?i:t.local===`field`?i||a:(t.local===`string`||t.local===`expression`)&&r.has(n)&&n.local===`field`)?(rename(e,t),r.add(t),e.converted+=1,!0):!1}function camunda8Attributes(e,t){if(!Zs.has(t.local)||t.ns!==Vs)return;let n=new Map(flowableAttributes(t).map(({key:e,local:t})=>[t,e])),read=e=>{let r=n.get(e);return r===void 0?void 0:t.attrs[r]},drop=r=>{let i=n.get(r);i!==void 0&&delete t.attrs[i],n.delete(r),e.converted+=1};if(t.local===`userTask`){let n={},r=[];for(let t of[`assignee`,`candidateUsers`,`candidateGroups`]){let i=read(t),a=i===void 0?null:literalOrFeel(e,i);a!==null&&(n[t]=a,r.push(t))}r.length>0&&zeebeChild(e,t,`assignmentDefinition`,n)&&r.forEach(drop);let i=read(`dueDate`),a=i===void 0?null:literalOrFeel(e,i);a!==null&&zeebeChild(e,t,`taskSchedule`,{dueDate:a})&&drop(`dueDate`);let o=read(`formKey`),s=o===void 0?null:literalOrFeel(e,o);s!==null&&zeebeChild(e,t,`formDefinition`,{formKey:s})&&drop(`formKey`);return}let r=read(`class`)===void 0?`delegateExpression`:`class`,i=read(r),a=i===void 0?null:jobTypeOf$1(r,i);a!==null&&zeebeChild(e,t,`taskDefinition`,{type:a})&&(drop(r),e.jobTypes.add(a))}function camunda8Element(e,t,n){if(t.local!==`executionListener`||n.local!==`extensionElements`||n.ns!==Vs)return!1;let r=t.attrs.event,i=t.attrs.class===void 0?t.attrs.delegateExpression===void 0?null:jobTypeOf$1(`delegateExpression`,t.attrs.delegateExpression):jobTypeOf$1(`class`,t.attrs.class),a=Object.keys(t.attrs).some(e=>![`event`,`class`,`delegateExpression`].includes(e));if(r!==`start`&&r!==`end`||i===null||a||t.children.length>0)return!1;let o=n.children.find(e=>e.ns===Us&&e.local===`executionListeners`);return o||(o=make(n,prefixFor(e,Us,`zeebe`),`executionListeners`,Us,{}),n.children.push(o)),o.children.push(make(o,o.prefix,`executionListener`,Us,{eventType:r,type:i})),removeChild(n,t),e.listeners.add(i),e.converted+=1,!0}function dropUnusedDeclarations(e){if(!e.some(({node:e})=>e.ns===`http://flowable.org/bpmn`||flowableAttributes(e).length>0))for(let{node:t}of e)for(let e of Object.keys(t.attrs))e.startsWith(`xmlns:`)&&t.attrs[e]===`http://flowable.org/bpmn`&&(delete t.attrs[e],t.scope.delete(e.slice(6)))}function convertFlowable(e,t){let n=entriesOf(e),r={root:e,target:t,taken:prefixesIn(n),added:new Map,converted:0,kept:new Tally,jobTypes:new Tally,listeners:new Tally,expressions:new Tally},i=new Set,a=new Set,o=new Set;for(let{node:e,parent:s}of n)if(o.has(e)||s&&(a.has(s)||o.has(s)))s&&a.has(s)&&a.add(e),s&&o.has(s)&&o.add(e);else if(e.ns===`http://flowable.org/bpmn`&&s){let n=t===`camunda7`?camunda7Element(r,e,s,i):camunda8Element(r,e,s);n&&!s.children.includes(e)&&o.add(e),n||(r.kept.add(`flowable:${e.local}`),a.add(e))}else{t===`camunda7`?camunda7Attributes(r,e):camunda8Attributes(r,e);for(let{local:t}of flowableAttributes(e))r.kept.add(`flowable:${t}`)}if(r.added.size>0)for(let{node:t}of entriesOf(e))for(let[e,n]of r.added)t.scope.set(e,n);dropUnusedDeclarations(entriesOf(e));let s=Js[t],c=[];return r.jobTypes.total>0&&c.push({level:`assumed`,message:Y(`app.import.flowable.jobTypes`,{count:r.jobTypes.total,list:r.jobTypes.list()})}),r.listeners.total>0&&c.push({level:`assumed`,message:Y(`app.import.flowable.listeners`,{count:r.listeners.total,list:r.listeners.list()})}),r.expressions.total>0&&c.push({level:`assumed`,message:Y(`app.import.flowable.expressions`,{count:r.expressions.total,list:r.expressions.list()})}),r.kept.total>0&&c.push({level:`unmapped`,message:Y(`app.import.flowable.kept`,{count:r.kept.total,target:s,list:r.kept.list()})}),{notes:c,converted:r.converted}}function flowableTargetName(e){return Js[e]}function refusalForSize(e,t){return t>67108864?Y(`app.import.failure.entryTooLarge`,{name:e}):null}function refusalForEntities(e){return e.includes(`<!ENTITY`)?Y(`app.import.failure.entities`):null}function refusalForText(e){return e.length>16777216?Y(`app.import.failure.tooComplex`):refusalForEntities(e)}function refusalForTree(e){let t=0,n=[{node:e,depth:1}];for(let e=n.pop();e;e=n.pop()){if(t+=1,t>1e6||e.depth>256)return Y(`app.import.failure.tooComplex`);for(let t of e.node.children)n.push({node:t,depth:e.depth+1})}return null}var DialectError=class extends Error{},Qs=`http://www.omg.org/spec/BPMN/20100524/MODEL`,$s=new Set([Qs,`http://www.omg.org/spec/BPMN/20100524/DI`,`http://www.omg.org/spec/DD/20100524/DC`,`http://www.omg.org/spec/DD/20100524/DI`,`http://www.w3.org/2001/XMLSchema-instance`,`http://www.w3.org/XML/1998/namespace`,`http://camunda.org/schema/1.0/bpmn`,`http://camunda.org/schema/zeebe/1.0`,`http://camunda.org/schema/modeler/1.0`,`http://bpmn.io/schema/bpmn/biocolor/1.0`,`http://www.omg.org/spec/BPMN/non-normative/color/1.0`]),ec=`http://camunda.org/schema/1.0/bpmn`,tc=`http://camunda.org/schema/zeebe/1.0`;function countExtensions(e,t){let n=0,r=[e];for(let e=r.pop();e;e=r.pop()){e.ns===t&&(n+=1);for(let r of Object.keys(e.attrs)){let i=r.indexOf(`:`);i>0&&!r.startsWith(`xmlns`)&&e.scope.get(r.slice(0,i))===t&&(n+=1)}r.push(...e.children)}return n}function vendorOf(e,t){if(isFlowable(e))return`Flowable`;let n=`${t.slice(0,4e3)} ${e.attrs.exporter??``}`.toLowerCase();return n.includes(`signavio`)?`Signavio`:n.includes(`bizagi`)?`Bizagi`:`BPMN 2.0`}function vendorName(e){let t=e.toLowerCase();return t.includes(`signavio`)?`Signavio`:t.includes(`bizagi`)?`Bizagi`:e}function keptVendor(e){let t=vendorName(e);return t===`Signavio`||t===`Bizagi`}function attributeNamespace(e,t){let n=t.indexOf(`:`);return n<0||t.startsWith(`xmlns`)?null:e.scope.get(t.slice(0,n))??``}function meaningful(e){return e.text.trim()!==``||e.children.length>0||Object.entries(e.attrs).some(([e,t])=>!e.startsWith(`xmlns`)&&t.trim()!==``)}function fromBpmnDialect(e,t={}){let n=refusalForText(e);if(n)throw new DialectError(n);let r=Ja(e),i=refusalForTree(r);if(i)throw new DialectError(i);if(r.local!==`definitions`||r.ns!==Qs)throw new DialectError(Y(`app.import.failure.notBpmnXml`));let a=vendorOf(r,e),o=new Set($s),s=countExtensions(r,ec),c=countExtensions(r,tc),l=a===`Flowable`?convertFlowable(r,t.target??`camunda7`):null;l&&o.add(Bs);let u=new Map,d=new Map,drop=(e,t)=>{let n=plainName(vendorName(e)),r=keptVendor(e)?d:u,i=r.get(n)??new Map,a=plainName(t);i.set(a,(i.get(a)??0)+1),r.set(n,i)},clean=e=>{for(let t of Object.keys(e.attrs)){let n=attributeNamespace(e,t);n===null||o.has(n)||(e.attrs[t].trim()!==``&&drop(n,t),keptVendor(n)||delete e.attrs[t])}e.children=e.children.filter(e=>{if(o.has(e.ns))return!0;if(e.local===`signavioMetaData`||e.local===`signavioDiagramMetaData`)(e.attrs.metaValue??``).trim()!==``&&drop(e.ns,e.attrs.metaKey??e.local);else if(meaningful(e)){let t=e.children.filter(e=>meaningful(e)),n=Object.entries(e.attrs).filter(([e,t])=>!e.startsWith(`xmlns`)&&t.trim()!==``).map(([e])=>e);if(n.length>0)for(let t of n)drop(e.ns,t.includes(`:`)?t.slice(t.indexOf(`:`)+1):t);else if(t.length>0)for(let n of t)drop(e.ns,n.local);else drop(e.ns,e.local)}return keptVendor(e.ns)});for(let t of e.children)keptVendor(t.ns)||clean(t);e.children=e.children.filter(e=>e.local!==`extensionElements`||e.ns!==Qs||e.children.length!==0||e.text.trim()!==``)};clean(r);let f=new Set,collect=e=>{f.add(e.prefix);for(let t of Object.keys(e.attrs))t.includes(`:`)&&!t.startsWith(`xmlns`)&&f.add(t.slice(0,t.indexOf(`:`)));e.children.forEach(collect)};collect(r);let prune=e=>{for(let t of Object.keys(e.attrs))t.startsWith(`xmlns:`)&&(o.has(e.attrs[t])||keptVendor(e.attrs[t])||f.has(t.slice(6))||delete e.attrs[t]);e.children.forEach(prune)};prune(r);let p=l?[...l.notes]:[],m=new Set(findElements(r,`BPMNShape`).map(e=>e.attrs.bpmnElement));if(m.size===0||findElements(r,`BPMNPlane`).length===0)throw new DialectError(Y(`app.import.failure.noPositions`));let h=findElements(r,`dataObject`).filter(e=>m.has(e.attrs.id));if(h.length>0){for(let e of h){let t={id:`${e.attrs.id}_reference`,dataObjectRef:e.attrs.id};e.attrs.name&&(t.name=e.attrs.name);let n={...e,name:prefixed(e,`dataObjectReference`),local:`dataObjectReference`,attrs:t,children:[]};delete e.attrs.name;let i=findParent(r,e);i?.children.splice(i.children.indexOf(e)+1,0,n);for(let t of findElements(r,`BPMNShape`))t.attrs.bpmnElement===e.attrs.id&&(t.attrs.bpmnElement=n.attrs.id);for(let t of[...findElements(r,`association`),...findElements(r,`sourceRef`),...findElements(r,`targetRef`)])t.attrs.sourceRef===e.attrs.id&&(t.attrs.sourceRef=n.attrs.id),t.attrs.targetRef===e.attrs.id&&(t.attrs.targetRef=n.attrs.id),t.text.trim()===e.attrs.id&&(t.text=n.attrs.id)}p.push({level:`assumed`,message:Y(`app.import.note.dataObjects`,{count:h.length})})}for(let[e,t]of u){let n=[...t.values()].reduce((e,t)=>e+t,0),r=[...t.entries()].map(([e,t])=>t>1?`${e} (${t})`:e).join(`, `);p.push({level:`lost`,message:Y(`app.import.note.vendorData`,{vendor:e,total:n,list:r})})}for(let[e,t]of d){let n=[...t.values()].reduce((e,t)=>e+t,0),r=[...t.entries()].map(([e,t])=>t>1?`${e} (${t})`:e).join(`, `);p.push({level:`unmapped`,message:Y(`app.import.note.vendorKept`,{vendor:e,total:n,list:r})})}r.attrs.id||(r.attrs.id=`Definitions_1`);let g=[];return l&&l.converted>0&&g.push({kind:`converted`,count:l.converted,target:flowableTargetName(t.target??`camunda7`)}),s>0&&g.push({kind:`camunda`,count:s}),c>0&&g.push({kind:`zeebe`,count:c}),{xml:`<?xml version="1.0" encoding="UTF-8"?>\n${Xa(r)}\n`,format:a,notes:p,details:g}}function prefixed(e,t){return e.prefix?`${e.prefix}:${t}`:t}function findElements(e,t){let n=[],visit=e=>{e.local===t&&n.push(e),e.children.forEach(visit)};return visit(e),n}function findParent(e,t){if(e.children.includes(t))return e;for(let n of e.children){let e=findParent(n,t);if(e)return e}}var nc={nbsp:` `,lt:`<`,gt:`>`,quot:`"`,apos:`'`,amp:`&`};function decodeEntities(e){return e.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(e,t)=>t.startsWith(`#x`)||t.startsWith(`#X`)?String.fromCodePoint(parseInt(t.slice(2),16)):t.startsWith(`#`)?String.fromCodePoint(parseInt(t.slice(1),10)):nc[t.toLowerCase()]??e)}function htmlToText(e){return decodeEntities(e.replace(/<br\s*\/?>/gi,`
|
|
6
|
+
`).replace(/<\/(div|p|li|h[1-6]|tr)>/gi,`
|
|
7
|
+
`).replace(/<[^>]*>/g,``)).replace(/ /g,` `).replace(/[ \t]+\n/g,`
|
|
8
|
+
`).replace(/\n{3,}/g,`
|
|
9
|
+
|
|
10
|
+
`).trim()}function plainLabel(e,t){return t?htmlToText(e):e.trim()}var DrawioError=class extends Error{},rc=33554432;function inflateLimited(e){let t=[],n=0;new Ur(e=>{if(n+=e.length,n>rc)throw new DrawioError(Y(`app.import.failure.pageTooLarge`));t.push(e)}).push(e,!0);let r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function styleOf(e){let t=new Map,n=new Set;for(let r of e.split(`;`)){if(!r.trim())continue;let e=r.indexOf(`=`);e<0?n.add(r.trim().toLowerCase()):t.set(r.slice(0,e).trim(),r.slice(e+1).trim())}return{map:t,tokens:n}}function bytesOfBase64(e){let t=atob(e.replace(/\s+/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function graphModelOf(e){let t=e.children.find(e=>e.local===`mxGraphModel`);if(t)return t;let n=e.text.trim();if(!n)throw new DrawioError(Y(`app.import.failure.pageEmpty`));try{return n.startsWith(`<`)?Ja(n):n.startsWith(`%3C`)?Ja(decodeURIComponent(n)):Ja(decodeURIComponent(xr(inflateLimited(bytesOfBase64(n)))))}catch(e){throw e instanceof DrawioError?e:new DrawioError(Y(`app.import.failure.compressedPage`))}}var number=(e,t=0)=>{let n=Number(e);return e!==void 0&&e!==``&&Number.isFinite(n)?n:t};function cellsOf$1(e){let t=e.children.find(e=>e.local===`root`);if(!t)throw new DrawioError(Y(`app.import.failure.pageNoCells`));let n=[];for(let e of t.children){let t=e.local===`object`||e.local===`UserObject`,r=t?e.children.find(e=>e.local===`mxCell`):e.local===`mxCell`?e:void 0;if(!r)continue;let i=r.children.find(e=>e.local===`mxGeometry`),a=(i?.children.find(e=>e.local===`Array`&&e.attrs.as===`points`)?.children??[]).filter(e=>e.local===`mxPoint`).map(e=>({x:number(e.attrs.x),y:number(e.attrs.y)})),o={};if(t)for(let[t,n]of Object.entries(e.attrs))[`id`,`label`].includes(t)||(o[t]=n);n.push({id:(t?e.attrs.id:r.attrs.id)??``,value:t?e.attrs.label??r.attrs.value??``:r.attrs.value??``,style:r.attrs.style??``,vertex:r.attrs.vertex===`1`,edge:r.attrs.edge===`1`,parent:r.attrs.parent??``,source:r.attrs.source??``,target:r.attrs.target??``,geometry:{x:number(i?.attrs.x),y:number(i?.attrs.y),width:number(i?.attrs.width),height:number(i?.attrs.height),points:a},properties:o,hidden:r.attrs.visible===`0`})}return n}e(cellsOf$1,`cellsOf`);var ic={service:`service`,user:`user`,script:`script`,send:`send`,receive:`receive`,manual:`manual`,businessrule:`businessRule`},ac={general:void 0,none:void 0,message:`message`,timer:`timer`,escalation:`escalation`,conditional:`conditional`,link:`link`,error:`error`,cancel:`cancel`,compensation:`compensation`,signal:`signal`,multiple:`multiple`,parallelmultiple:`parallelMultiple`,terminate:`terminate`},oc=new Set([``,`rect`,`rectangle`,`ellipse`,`rhombus`,`text`,`note`,`swimlane`,`partialrectangle`,`table`,`tablerow`]);function gatewayKind(e){let t=(e.map.get(`symbol`)??``).toLowerCase(),n=(e.map.get(`outline`)??``).toLowerCase();return t.includes(`parallelmultiple`)||t.includes(`event`)||t.includes(`multiple`)&&n!==`none`?`eventBasedGateway`:t.includes(`exclusive`)?`exclusiveGateway`:t.includes(`parallel`)?`parallelGateway`:t.includes(`complex`)?`complexGateway`:t.includes(`inclusive`)||n===`end`?`inclusiveGateway`:n===`catching`?`eventBasedGateway`:`exclusiveGateway`}function eventFields(e){let t=(e.map.get(`outline`)??`standard`).toLowerCase(),n=(e.map.get(`symbol`)??`general`).toLowerCase(),r=n in ac,i=r?ac[n]:void 0,a={standard:[`startEvent`],eventint:[`startEvent`],eventnonint:[`startEvent`,!1],end:[`endEvent`],throwing:[`intermediateThrowEvent`],catching:[`intermediateCatchEvent`],boundint:[`boundaryEvent`],boundnonint:[`boundaryEvent`,!1]},[o,s]=a[t]??a.standard;return{kind:o,fields:{definition:i,interrupting:s},unknownSymbol:r?void 0:n}}function loopOf$1(e){if(e.map.get(`isLoopMultiInstance`)===`1`)return e.map.get(`isSequential`)===`1`?`sequential`:`parallel`;if(e.map.get(`isLoopStandard`)===`1`)return`standard`}e(loopOf$1,`loopOf`);function classify$1(e,t){let n=(t.map.get(`shape`)??``).toLowerCase(),{tokens:r}=t,i=n.startsWith(`mxgraph.bpmn.`);if(r.has(`swimlane`)||n===`swimlane`||n===`table`)return{kind:`pool`,fields:{horizontal:t.map.get(`horizontal`)===`0`||n===`table`}};if(n===`tablerow`)return{kind:`lane`,fields:{horizontal:!0}};if(n.startsWith(`mxgraph.bpmn.shape`)||n.startsWith(`mxgraph.bpmn.event`)){let e=eventFields(t);return{kind:e.kind,fields:e.fields,note:e.unknownSymbol?{level:`lost`,message:Y(`app.import.note.unknownEvent`,{symbol:e.unknownSymbol})}:void 0}}return n.startsWith(`mxgraph.bpmn.gateway`)?{kind:gatewayKind(t)}:n===`datastore`||i&&/store/.test(n)?{kind:`dataStore`}:i&&n.startsWith(`mxgraph.bpmn.data`)?{kind:`dataObject`,fields:{collection:t.map.get(`isCollection`)===`1`}}:i&&n.startsWith(`mxgraph.bpmn.annotation`)||n===`partialrectangle`?{kind:`textAnnotation`}:i&&n.startsWith(`mxgraph.bpmn.task`)?taskClass(t):n===`ext`?t.map.get(`double`)===`1`?{kind:`transaction`}:number(t.map.get(`strokeWidth`))>=3?{kind:`callActivity`}:t.map.get(`dashed`)===`1`?{kind:`eventSubProcess`}:taskClass(t):oc.has(n)?r.has(`rhombus`)||n===`rhombus`?{kind:`exclusiveGateway`,note:{level:`assumed`,message:Y(`app.import.note.diamond`,{shape:quoted$1(e)})}}:r.has(`ellipse`)||n===`ellipse`?{pending:`event`}:r.has(`text`)||n===`text`?{kind:`textAnnotation`,note:{level:`assumed`,message:Y(`app.import.note.freeText`,{shape:quoted$1(e)})}}:n===`note`?{kind:`textAnnotation`,note:{level:`assumed`,message:Y(`app.import.note.noteShape`,{shape:quoted$1(e)})}}:t.map.get(`rounded`)===`1`?taskClass(t):{kind:`task`,note:{level:`assumed`,message:Y(`app.import.note.rectangle`,{shape:quoted$1(e)})}}:{}}e(classify$1,`classify`);function taskClass(e){let t=(e.map.get(`bpmnShapeType`)??``).toLowerCase();if(t===`call`)return{kind:`callActivity`,fields:{loop:loopOf$1(e)}};if(t===`transaction`)return{kind:`transaction`};if(t===`subprocess`)return{kind:`subProcess`};if(t===`event`)return{kind:`eventSubProcess`};let n=(e.map.get(`taskMarker`)??``).toLowerCase();return{kind:`task`,fields:{taskType:Wn(ic,n)??`task`,loop:loopOf$1(e)}}}function quoted$1(e){let t=plainLabel(e.value,!0).replace(/\s+/g,` `);return t?`"${t}"`:Y(`app.import.note.anUnlabelledShape`)}e(quoted$1,`quoted`);function describeUnmapped(e,t){let n=t.map.get(`shape`)??[...t.tokens][0]??`rectangle`,r=plainLabel(e.value,!0).replace(/\s+/g,` `);return r?Y(`app.import.note.unmappedLabelled`,{label:r,shape:n}):Y(`app.import.note.unlabelledShape`,{shape:n,count:1})}function kindOfEdge(e){let t=e.map.get(`dashed`)===`1`,n=e.map.get(`startArrow`)??``,r=e.map.get(`endArrow`)??`classic`;return t&&(n===`oval`||e.map.get(`endFill`)===`0`&&r!==`none`)?`message`:t?`association`:`sequence`}function fromDrawio(e){let t=Ja(e),n=[],r;if(t.local===`mxGraphModel`)r=t;else{let e=t.children.filter(e=>e.local===`diagram`);if(e.length===0)throw new DrawioError(Y(`app.import.failure.noPages`));let i=e.map(e=>({page:e,model:graphModelOf(e)})),a=i.find(e=>cellsOf$1(e.model).some(e=>e.vertex))??i[0];r=a.model;for(let e of i){if(e===a)continue;let t=cellsOf$1(e.model).filter(e=>e.vertex).length;n.push({level:`unmapped`,message:Y(`app.import.note.otherPage`,{page:e.page.attrs.name??Y(`app.import.note.untitled`),shapes:t,count:t})})}}let i=cellsOf$1(r).filter(e=>e.id!==``&&!e.hidden),a=new Map(i.map(e=>[e.id,e])),o=new Map(i.map(e=>[e.id,styleOf(e.style)])),s=new Map,originOf=(e,t=0)=>{let n=s.get(e.id);if(n)return n;let r=a.get(e.parent),i=r&&r.vertex&&t<50?originOf(r,t+1):{x:0,y:0},o={x:i.x+e.geometry.x,y:i.y+e.geometry.y};return s.set(e.id,o),o},offsetOf=e=>{let t=a.get(e.parent);return t&&t.vertex?originOf(t):{x:0,y:0}},c=new Map,l=new Set;for(let e of i){let t=o.get(e.id);e.vertex&&t.tokens.has(`edgelabel`)&&a.get(e.parent)?.edge&&c.set(e.parent,plainLabel(e.value,t.map.get(`html`)===`1`));let n=a.get(e.parent);e.vertex&&n&&(o.get(n.id)?.map.get(`shape`)??``).toLowerCase()===`tablerow`&&l.add(e.id)}let u=[],d=[],f=[],p=new Map,m=0;for(let e of i){if(!e.vertex)continue;let t=o.get(e.id);if(t.tokens.has(`edgelabel`)&&a.get(e.parent)?.edge)continue;let r=a.get(e.parent);if(l.has(e.id)&&(o.get(e.id)?.map.get(`shape`)??``).toLowerCase()===`partialrectangle`){let n=u.find(e=>e.id===r?.id);n&&!n.name&&e.value&&(n.name=plainLabel(e.value,t.map.get(`html`)===`1`));continue}let i=classify$1(e,t);if(!i.kind&&!i.pending){let n=t.map.get(`shape`)??[...t.tokens][0]??`rectangle`;f.push({text:describeUnmapped(e,t),shape:n,labelled:plainLabel(e.value,!0)!==``});continue}i.note&&n.push(i.note);let s=originOf(e),c=t.map.get(`html`)===`1`,h=e.properties.documentation??e.properties.tooltip,g={id:e.id,kind:i.kind??`startEvent`,name:plainLabel(e.value,c),x:s.x,y:s.y,width:e.geometry.width||100,height:e.geometry.height||80,parent:r&&r.vertex?r.id:void 0,documentation:h?plainLabel(h,!1):void 0,...i.fields};u.push(g),i.pending&&d.push(g);let _=Object.keys(e.properties).filter(e=>![`documentation`,`tooltip`,`placeholders`,`link`].includes(e));if(_.length>0){m+=1;for(let e of _)p.set(e,(p.get(e)??0)+1)}}nestLanes(u);let h=[];for(let e of i){if(!e.edge)continue;let t=o.get(e.id),n=plainLabel(e.value,t.map.get(`html`)===`1`)||c.get(e.id)||``,r=offsetOf(e),i=(t.map.get(`edgeStyle`)??``).toLowerCase(),a=t.map.get(`startArrow`)??``;h.push({id:e.id,kind:kindOfEdge(t),source:e.source,target:e.target,name:n,points:e.geometry.points.map(e=>({x:e.x+r.x,y:e.y+r.y})),orthogonal:i.includes(`orthogonal`)||i.includes(`elbow`),isDefault:a===`dash`||a===`dashThin`,documentation:e.properties.documentation})}for(let e of d){let t=h.filter(t=>t.target===e.id&&t.kind===`sequence`).length,r=h.filter(t=>t.source===e.id&&t.kind===`sequence`).length;e.kind=t===0&&r>0?`startEvent`:r===0&&t>0?`endEvent`:`intermediateThrowEvent`,(e.width>80||e.height>80)&&(e.width=e.height=36);let i=e.kind===`startEvent`?Y(`app.import.note.aStartEvent`):e.kind===`endEvent`?Y(`app.import.note.anEndEvent`):Y(`app.import.note.anIntermediateEvent`);n.push({level:`assumed`,message:Y(`app.import.note.circle`,{shape:e.name?`"${e.name.replace(/\s+/g,` `)}"`:Y(`app.import.note.anUnlabelledCircle`),kind:i})})}let g=f.filter(e=>e.labelled);for(let e of g)n.push({level:`unmapped`,message:e.text});let _=f.filter(e=>!e.labelled),v=new Map;for(let e of _)v.set(e.shape,(v.get(e.shape)??0)+1);for(let[e,t]of v)n.push({level:`unmapped`,message:Y(`app.import.note.unlabelledShape`,{count:t,shape:e})});return p.size>0&&n.push({level:`lost`,message:Y(`app.import.note.customData`,{count:m,keys:[...p.keys()].join(`, `)})}),{nodes:u,flows:h,notes:n}}var sc=67108864,cc=268435456,ZipError=class extends Error{};function isZip(e){return e.length>4&&e[0]===80&&e[1]===75&&(e[2]===3||e[2]===5)&&(e[3]===4||e[3]===6)}function isOleFile(e){return e.length>8&&[208,207,17,224,161,177,26,225].every((t,n)=>e[n]===t)}function readZip(e,t){let n=0;try{let r=Hr(e,{filter(e){if(!t(e.name))return!1;if(e.originalSize>sc)throw new ZipError(Y(`app.import.failure.entryTooLarge`,{name:e.name}));if(n+=e.originalSize,n>cc)throw new ZipError(Y(`app.import.failure.archiveTooLarge`));return!0}});return new Map(Object.entries(r))}catch(e){throw e instanceof ZipError?e:new ZipError(Y(`app.import.failure.notZip`))}}function textOfEntry(e,t){let n=e.get(t);return n?xr(n).replace(/^/,``):void 0}var VisioError=class extends Error{},lc=96,uc=8.5,dc=25,key=e=>e.toLowerCase().replace(/[^a-z0-9]/g,``);function cellsOf(e){let t=new Map;for(let n of e.children){if(n.local!==`Cell`||!n.attrs.N)continue;let e=Number(n.attrs.V);n.attrs.V!==void 0&&n.attrs.V!==``&&Number.isFinite(e)&&t.set(n.attrs.N,e)}return t}function propsOf(e){let t=new Map;for(let n of e.children.filter(e=>e.local===`Section`&&e.attrs.N===`Property`))for(let e of n.children.filter(e=>e.local===`Row`)){let n=e.children.find(e=>e.local===`Cell`&&e.attrs.N===`Value`);e.attrs.N&&n?.attrs.V!==void 0&&t.set(key(e.attrs.N),n.attrs.V)}return t}function rowsOf$2(e){let t=e.children.find(e=>e.local===`Section`&&e.attrs.N===`Geometry`);if(!t)return[];let n=[];for(let e of t.children.filter(e=>e.local===`Row`)){let t=e.attrs.T??``;if(!e.attrs.T&&e.attrs.N)continue;if(t!==`MoveTo`&&t!==`LineTo`)return null;let r=cellsOf(e);n.push({type:t,x:r.get(`X`)??0,y:r.get(`Y`)??0})}return n}e(rowsOf$2,`rowsOf`);function relationTargets(e,t){let n=new Map,r=textOfEntry(e,t);if(!r)return n;for(let e of Ja(r).children.filter(e=>e.local===`Relationship`))e.attrs.Id&&e.attrs.Target&&n.set(e.attrs.Id,e.attrs.Target);return n}function shapesOf$1(e,t,n,r){if(e)for(let i of e.children.filter(e=>e.local===`Shape`)){let e=cellsOf(i),a={x:(e.get(`PinX`)??0)-(e.get(`LocPinX`)??0),y:(e.get(`PinY`)??0)-(e.get(`LocPinY`)??0)},o=i.attrs.Master??i.attrs.MasterShape,s=i.children.find(e=>e.local===`Shapes`);r.push({id:i.attrs.ID,master:(o?t.get(o):void 0)??(i.attrs.NameU??i.attrs.Name??``).replace(/\.\d+$/,``),text:(i.children.find(e=>e.local===`Text`)?.text??``).replace(/\s+$/g,``).replace(/^\s+/,``),cells:e,props:propsOf(i),rows:rowsOf$2(i)??[],node:i,origin:n,group:i.attrs.Type===`Group`}),s&&shapesOf$1(s,t,{x:n.x+a.x,y:n.y+a.y},r)}}e(shapesOf$1,`shapesOf`);var fc=[[`parallelmultiple`,`parallelMultiple`],[`multiple`,`multiple`],[`message`,`message`],[`timer`,`timer`],[`error`,`error`],[`escalation`,`escalation`],[`cancel`,`cancel`],[`compensation`,`compensation`],[`conditional`,`conditional`],[`rule`,`conditional`],[`link`,`link`],[`signal`,`signal`],[`terminate`,`terminate`]],pc=[[`service`,`service`],[`send`,`send`],[`receive`,`receive`],[`user`,`user`],[`manual`,`manual`],[`businessrule`,`businessRule`],[`script`,`script`]];function first(e,t){for(let n of t){let t=e.get(n);if(t!==void 0)return key(t)}return``}function loopOf(e){let t=first(e,[`looptype`,`loop`,`loopcharacteristics`]);if(t.includes(`multi`)||t.includes(`parallel`))return`parallel`;if(t.includes(`sequential`))return`sequential`;if(t.includes(`standard`)||t===`loop`)return`standard`}function gatewayOf(e,t){let n=first(e,[`gatewaytype`,`type`])||key(t);return n.includes(`event`)?`eventBasedGateway`:n.includes(`parallel`)?`parallelGateway`:n.includes(`inclusive`)?`inclusiveGateway`:n.includes(`complex`)?`complexGateway`:`exclusiveGateway`}function classify(e){let t=key(e.master);if(e.cells.has(`BeginX`)&&e.cells.has(`EndX`))return t.includes(`message`)?{flow:`message`}:t.includes(`association`)?{flow:`association`}:t.includes(`default`)?{flow:`sequence`,isDefault:!0}:t.includes(`sequence`)||t.includes(`conditional`)?{flow:`sequence`}:{flow:`sequence`,generic:!0};if(t.includes(`pool`)||t.includes(`swimlane`))return{kind:`pool`,fields:{horizontal:(e.cells.get(`Width`)??0)>=(e.cells.get(`Height`)??0)}};if(t===`lane`||t.startsWith(`lane`))return{kind:`lane`,fields:{horizontal:!0}};if(t.includes(`startevent`)||t.includes(`intermediateevent`)||t.includes(`endevent`)||t===`event`){let n=first(e.props,[`eventtype`,`type`]),r=t.includes(`start`)||n===`start`?`start`:t.includes(`end`)||n===`end`?`end`:`intermediate`,i=first(e.props,[`triggerorresult`,`trigger`,`result`,`eventtrigger`,`eventdefinition`]),a=fc.find(([e])=>i.includes(e))?.[1],o=[...e.props.entries()].some(([e,t])=>(e.includes(`throw`)||key(t).includes(`throw`))&&key(t)!==`false`&&key(t)!==`no`),s=r===`start`?`startEvent`:r===`end`?`endEvent`:o?`intermediateThrowEvent`:`intermediateCatchEvent`,c=first(e.props,[`interrupting`,`iscancelactivity`]);return{kind:s,fields:{definition:a,interrupting:c===`false`||c===`no`?!1:void 0}}}if(t.includes(`gateway`))return{kind:gatewayOf(e.props,e.master)};if(t.includes(`callactivity`))return{kind:`callActivity`,fields:{loop:loopOf(e.props)}};if(t.includes(`subprocess`)){let t=first(e.props,[`subprocesstype`,`type`]);return{kind:t.includes(`transaction`)?`transaction`:t.includes(`event`)?`eventSubProcess`:`subProcess`,fields:{loop:loopOf(e.props)}}}if(t===`task`||t.startsWith(`task`)){let t=first(e.props,[`tasktype`,`type`]);return{kind:`task`,fields:{taskType:pc.find(([e])=>t.includes(e))?.[1]??`task`,loop:loopOf(e.props)}}}return t.includes(`datastore`)?{kind:`dataStore`}:t.includes(`dataobject`)||t.includes(`datainput`)||t.includes(`dataoutput`)?{kind:`dataObject`,fields:{collection:first(e.props,[`iscollection`,`collection`])===`true`}}:t.includes(`annotation`)?{kind:`textAnnotation`}:null}function pixels(e){return e*lc}function fromVisio(e){let t=readZip(e,e=>/^visio\/.*\.(xml|rels)$/i.test(e));if(!t.has(`visio/document.xml`))throw new VisioError(Y(`app.import.failure.notVisio`));let n=textOfEntry(t,`visio/pages/pages.xml`);if(!n)throw new VisioError(Y(`app.import.failure.noVisioPages`));let r=new Map,i=textOfEntry(t,`visio/masters/masters.xml`);if(i)for(let e of Ja(i).children.filter(e=>e.local===`Master`))r.set(e.attrs.ID,e.attrs.NameU??e.attrs.Name??``);let a=relationTargets(t,`visio/pages/_rels/pages.xml.rels`),o=Ja(n).children.filter(e=>e.local===`Page`).map(e=>{let t=e.children.find(e=>e.local===`PageSheet`),n=e.children.find(e=>e.local===`Rel`),r=n?a.get(n.attrs[`r:id`]??n.attrs.id??``):void 0,i=r?`visio/pages/${r.replace(/^\.?\//,``)}`:``;return{name:e.attrs.NameU??e.attrs.Name??`untitled`,height:(t?cellsOf(t).get(`PageHeight`):void 0)??uc,file:i}}).map(e=>({page:e,text:textOfEntry(t,e.file)})).filter(e=>e.text!==void 0).map(e=>({...e,root:Ja(e.text)})).map(e=>({...e,shapes:[]}));for(let e of o)shapesOf$1(e.root.children.find(e=>e.local===`Shapes`),r,{x:0,y:0},e.shapes);let s=o.find(e=>e.shapes.length>0);if(!s)throw new VisioError(Y(`app.import.failure.noShapes`));let c=[];for(let e of o)e!==s&&e.shapes.length!==0&&c.push({level:`unmapped`,message:Y(`app.import.note.otherVisioPage`,{page:e.page.name,shapes:e.shapes.length,count:e.shapes.length})});let l=s.page.height,u=[],d=[],f=new Map,p=s.root.children.find(e=>e.local===`Connects`);for(let e of p?.children.filter(e=>e.local===`Connect`)??[]){let t=e.attrs.FromSheet,n=f.get(t)??{};(e.attrs.FromCell??``).startsWith(`Begin`)&&(n.source=e.attrs.ToSheet),(e.attrs.FromCell??``).startsWith(`End`)&&(n.target=e.attrs.ToSheet),f.set(t,n)}let m=0,h=0,g=[],label=e=>e.text.replace(/\s+/g,` `);for(let e of s.shapes){(e.cells.get(`Angle`)??0)!==0&&(h+=1);let t=classify(e);if(t&&`flow`in t){let n={x:pixels(e.cells.get(`BeginX`)??0),y:pixels(l-(e.cells.get(`BeginY`)??0))},r={x:pixels(e.cells.get(`EndX`)??0),y:pixels(l-(e.cells.get(`EndY`)??0))},i=e.origin.x+(e.cells.get(`PinX`)??0)-(e.cells.get(`LocPinX`)??0),a=e.origin.y+(e.cells.get(`PinY`)??0)-(e.cells.get(`LocPinY`)??0),o=e.rows.slice(1,-1).map(e=>({x:pixels(i+e.x),y:pixels(l-(a+e.y))})).filter(e=>!(Math.abs(e.x-n.x)<.5&&Math.abs(e.y-n.y)<.5)&&!(Math.abs(e.x-r.x)<.5&&Math.abs(e.y-r.y)<.5));t.generic&&(m+=1);let s=f.get(e.id)??{};d.push({id:e.id,kind:t.flow,source:s.source??``,target:s.target??``,name:label(e),points:o,isDefault:t.isDefault})}else if(t&&`kind`in t){let n=e.cells.get(`Width`)??1,r=e.cells.get(`Height`)??1,i=e.origin.x+(e.cells.get(`PinX`)??0)-(e.cells.get(`LocPinX`)??n/2),a=e.origin.y+(e.cells.get(`PinY`)??0)-(e.cells.get(`LocPinY`)??r/2);u.push({id:e.id,kind:t.kind,name:label(e),x:pixels(i),y:pixels(l-a-r),width:pixels(n),height:pixels(r),...t.fields})}else(!e.group||t)&&g.push(label(e)?Y(`app.import.note.unmappedLabelled`,{label:label(e),shape:e.master||Y(`app.import.note.aShape`)}):Y(`app.import.note.unlabelledMaster`,{shape:e.master||Y(`app.import.note.shape`)}))}c.push(...g.map(e=>({level:`unmapped`,message:e}))),m>0&&c.push({level:`assumed`,message:Y(`app.import.note.genericConnectors`,{count:m})}),h>0&&c.push({level:`lost`,message:Y(`app.import.note.rotated`,{count:h})}),nestLanes(u);let _=u.filter(e=>[`task`,`callActivity`,`subProcess`,`transaction`,`eventSubProcess`].includes(e.kind));for(let e of u){if(e.kind!==`intermediateCatchEvent`||d.some(t=>t.kind===`sequence`&&t.target===e.id))continue;let t=centreOf(e),n=_.map(e=>({candidate:e,distance:distanceToRect(e,t)})).filter(e=>e.distance<=dc).sort((e,t)=>e.distance-t.distance)[0];n&&(e.kind=`boundaryEvent`,e.host=n.candidate.id)}return{nodes:u,flows:d,notes:c}}var mc=[`modeler`,`signavio`,`bizagi`,`flowable`];function isImportSource(e){return mc.includes(e)}var hc={modeler:`Camunda Modeler`,signavio:`Signavio`,bizagi:`Bizagi`,flowable:`Flowable`},gc={modeler:`BPMN 2.0`,signavio:`Signavio`,bizagi:`Bizagi`,flowable:`Flowable`};function textOf$3(e){return(typeof e==`string`?e:new TextDecoder(`utf-8`).decode(e)).replace(/^/,``)}e(textOf$3,`textOf`);function refuse(e,t=[]){return{ok:!1,message:e,notes:t}}function finish(e,t){if(t.nodes.length===0)return refuse(Y(`app.import.failure.nothingToImport`,{format:e}),t.notes);let n=buildBpmn(t);return{ok:!0,bpmn:n.xml,report:{format:e,summary:n.summary,notes:n.notes,needsLayout:!1}}}function bizagiPackage(){return Y(`app.import.failure.bizagiPackage`)}var _c=/\.(bpmn|bpmn20\.xml)$/i;function dialect(e,t,n=[]){let r=fromBpmnDialect(e,{target:t.target}),i=[...n,...r.notes],a={format:r.format,summary:summaryOf(r.xml),notes:i,needsLayout:!1,...r.details.length>0?{details:r.details}:{}};return{ok:!0,bpmn:r.xml,report:a}}function expected(e,t,n){return!e.ok||!n.from||e.report.format===gc[n.from]?e:refuse(Y(`app.import.failure.notFrom`,{name:plainName(t),format:e.report.format,from:n.from}))}function summaryOf(e){let t=Ja(e),count=e=>Ka(t,e).length;return{elements:[`task`,`userTask`,`serviceTask`,`scriptTask`,`sendTask`,`receiveTask`,`manualTask`,`businessRuleTask`,`callActivity`,`subProcess`,`transaction`,`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`,`boundaryEvent`,`exclusiveGateway`,`parallelGateway`,`inclusiveGateway`,`complexGateway`,`eventBasedGateway`].reduce((e,t)=>e+count(t),0),flows:count(`sequenceFlow`)+count(`messageFlow`),pools:count(`participant`),lanes:count(`lane`)}}function importDiagram(e,t={}){let n=refusalForSize(e.name,e.data.length);return n?refuse(n):expected(readDiagram(e,t),e.name,t)}function readDiagram(e,t){try{if(typeof e.data!=`string`){if(isOleFile(e.data))return refuse(Y(`app.import.failure.visioBinary`,{name:e.name}));if(isZip(e.data)){if(/\.bpm$/i.test(e.name)){let n=readZip(e.data,e=>_c.test(e)),r=[...n.keys()].sort()[0],i=r?textOfEntry(n,r):void 0;return i?dialect(i,t,[{level:`assumed`,message:Y(`app.import.note.packageImported`,{name:plainName(r??``)})}]):refuse(bizagiPackage())}return finish(`Visio`,fromVisio(e.data))}}let n=textOf$3(e.data),r=refusalForEntities(n);if(r)return refuse(r);if(/\.bpm$/i.test(e.name)&&!/^\s*</.test(n))return refuse(bizagiPackage());let i=Ja(n);return i.local===`mxfile`||i.local===`mxGraphModel`?finish(`draw.io`,fromDrawio(n)):i.local===`definitions`?dialect(n,t):i.local===`Package`&&i.ns.toLowerCase().includes(`xpdl`)?refuse(Y(`app.import.failure.xpdl`)):refuse(Y(`app.import.failure.unknownFormat`,{name:e.name}))}catch(e){if(e instanceof DrawioError||e instanceof VisioError||e instanceof DialectError||e instanceof ZipError||e instanceof Za)return refuse(e.message);throw e}}function groupedNotes(e){let pick=t=>e.notes.filter(e=>e.level===t).map(e=>e.message);return{unmapped:pick(`unmapped`),assumed:pick(`assumed`),lost:pick(`lost`)}}var vc={elements:`element`,flows:`flow`,pools:`pool`,lanes:`lane`};function title(e){return Y(`app.import.noteTitle.${e}`)}function part(e,t){return Y(`app.import.count.${vc[t]}`,{count:e})}function summaryLine(e){let{elements:t,flows:n,pools:r,lanes:i}=e.summary,a=[part(t,`elements`),part(n,`flows`)];return r>0&&a.push(part(r,`pools`)),i>0&&a.push(part(i,`lanes`)),Y(`app.import.summary`,{format:e.format,counts:a.join(`, `)})}function noteHeading(e,t){return Y(`app.import.noteHeading`,{count:t,title:title(e).toLowerCase()})}function importedFileName(e){let t=e.split(/[\\/]/).pop()??``;return/\.bpmn$/i.test(t)?`${t.replace(/\.bpmn$/i,``)}.penstock.bpmn`:`${t.replace(/\.(drawio|dio|vsdx|bpmn20\.xml|bpm|xml|xpdl)$/i,``)||Y(`app.import.importedName`)}.bpmn`}function tasklistUrl(e,t,n){if(!t||typeof t!=`string`||!t.trim()||!e||typeof e!=`string`||!e.trim())return null;let r=t.trim(),i;try{i=new URL(r)}catch{return null}if(i.protocol!==`http:`&&i.protocol!==`https:`)return null;if(Oi(e)){let e=i.pathname.replace(/\/app\/tasklist\/?.*$/,``).replace(/\/deployment\/create\/?$/,``).replace(/\/engine-rest\/?$/,``).replace(/\/camunda\/?$/,``).replace(/\/+$/,``),t=`${i.origin}${e}`.replace(/\/+$/,``);return n?.taskId?`${t}/camunda/app/tasklist/default/#/?task=${encodeURIComponent(n.taskId)}`:n?.instanceId?`${t}/camunda/app/tasklist/default/#/?processInstance=${encodeURIComponent(n.instanceId)}`:`${t}/camunda/app/tasklist/`}if(ji(e)){let e=i.hostname.toLowerCase();if(e.endsWith(`.camunda.io`)){let t=e.split(`.`),n=t.indexOf(`zeebe`);if(n<1||t.length!==n+3)return null;let r=t[n-1],a=n>=2?t.slice(0,n-1).join(`.`):/^\/([0-9a-zA-Z_-]+)/.exec(i.pathname)?.[1];return a?`https://${r}.tasklist.camunda.io/${a}`:null}let t=i.pathname.replace(/\/tasklist\/?.*$/,``).replace(/\/v2\/deployments\/?$/,``).replace(/\/v2\/?$/,``).replace(/\/deployments\/?$/,``).replace(/\/+$/,``),r=`${i.origin}${t}/tasklist`;return n?.taskId?`${r}/${encodeURIComponent(n.taskId)}`:r}return null}function tasklistDef(e){return{id:`open-tasklist`,title:`Open in Tasklist`,section:`Check & run`,icon:`share`,keywords:[`tasklist`,`tasks`,`user tasks`,`camunda`,`work`],place:`menu`,tooltip:`Open Tasklist in your browser`,available:t=>!(!t.commands?.openTasklist||e&&!e(t)),run:e=>e.commands.openTasklist?.()}}var yc=[de(e=>e.drawn),te(e=>e.drawn),{id:`auto-layout`,title:`Auto layout`,section:`Layout & convert`,icon:`auto-layout`,keywords:[`arrange`,`reflow`,`tidy`,`align`,`organise`,`organize`,`left to right`],place:`pinned`,presentation:`text`,tier:`Pro`,tooltip:`Lay the diagram out again`,enabled:e=>e.drawn,run:e=>e.commands.autoLayout()},{id:`diagram-check`,title:`Check`,section:`Check & run`,icon:`diagram-check`,keywords:[`bpmnlint`,`lint`,`validate`,`problems`,`errors`,`warnings`,`conventions`,`analyze`],place:`pinned`,presentation:`text`,tooltip:`Check the diagram for problems`,enabled:e=>e.drawn,checked:e=>e.open.check,run:e=>e.commands.openProblems()},{id:`token-simulation`,title:`Simulate`,section:`Check & run`,icon:`token-simulation`,keywords:[`tokens`,`play`,`run through`,`simulation`,`walk`],place:`pinned`,presentation:`text`,tooltip:`Run tokens through the process`,enabled:e=>e.drawn,checked:e=>e.open.simulation,run:e=>e.commands.toggleSimulation()},{id:`coverage`,title:`Coverage`,section:`Check & run`,icon:`coverage`,keywords:[`tests`,`reached`,`paths`],place:`pinned`,presentation:`text`,tooltip:`Show what the process tests reach`,enabled:e=>e.drawn,available:e=>e.coverageShown||e.open.coverage,checked:e=>e.open.coverage,run:e=>e.commands.toggleCoverage()},{id:`live`,title:`Monitor`,section:`Check & run`,icon:`live`,keywords:[`instances`,`incidents`,`live`,`running`],place:`pinned`,presentation:`text`,tooltip:`What the engine is doing with this diagram now: instances waiting at each step and incidents`,checked:e=>e.open.monitor,run:e=>e.commands.openMonitor()},{id:`timeline`,title:`Timeline`,section:`Check & run`,icon:`runs`,keywords:[`history`,`trace`,`playhead`,`replay`,`steps`,`gantt`,`time machine`],place:`menu`,tooltip:`Scrub through the steps of a run: an engine instance chosen in Monitor, or a scenario run`,available:e=>e.camunda7||e.camunda8,checked:e=>e.open.timeline,run:e=>e.commands.toggleTimeline()},{id:`debug-process`,title:`Debug process`,section:`Check & run`,icon:`debug`,keywords:[`breakpoint`,`step`,`pause`,`debugger`,`variables`,`stop`],place:`menu`,tooltip:`Run a copy of this process on a local engine and stop at breakpoints to read and change its variables`,available:e=>e.camunda7||e.camunda8,checked:e=>e.open.debug,run:e=>e.commands.openDebug()},{id:`toggle-breakpoint`,title:`Toggle breakpoint`,section:`Check & run`,icon:`breakpoint`,keywords:[`breakpoint`,`stop here`,`pause`,`debugger`],place:`menu`,tooltip:`Stop the debugger before the selected step`,available:e=>e.camunda7||e.camunda8,enabled:e=>e.breakpointable,run:e=>e.commands.toggleBreakpoint()},{id:`runs`,title:`Scenarios`,section:`Check & run`,icon:`runs`,keywords:[`test cases`,`junit`,`trace`],place:`pinned`,presentation:`text`,tooltip:`Run this diagram's scenarios on a local engine and see every step`,available:e=>e.camunda7||e.camunda8,checked:e=>e.open.scenarios,run:e=>e.commands.openScenarios()},{id:`migration`,title:`Migrate to Camunda 8`,section:`Layout & convert`,icon:`migration`,keywords:[`c8`,`camunda 8`,`convert`,`upgrade`,`zeebe`,`c7`,`migration`],place:`pinned`,presentation:`text`,tooltip:`What does not carry over to Camunda 8, and converting it`,available:e=>e.camunda7,checked:e=>e.open.migration&&e.open.check,run:e=>e.commands.toggleMigration()},{id:`convert-operaton`,title:`Convert to Operaton`,section:`Layout & convert`,icon:`migration`,keywords:[`operaton`,`convert`,`namespace`,`cib seven`,`cibseven`,`camunda 7`],place:`menu`,tooltip:`Move a Camunda 7 or CIB seven diagram to the operaton: namespace`,available:e=>e.convertible,run:e=>e.commands.convertToOperaton()},Ba(e=>e.camunda7||e.camunda8),tasklistDef(),ae(e=>e.drawn),{id:`start-instance`,title:`Start instance…`,section:`Check & run`,icon:`live`,keywords:[`start`,`run`,`instance`,`process`,`trigger`,`launch`],place:`menu`,tooltip:`Start a process instance on the connected engine`,available:e=>!!e.commands?.startInstance,run:e=>e.commands.startInstance?.()},{id:`test-task`,title:`Test task…`,section:`Check & run`,icon:`runs`,keywords:[`test`,`task`,`element`,`mock`,`run`,`selected`,`path`],place:`menu`,tooltip:`Run the selected element on a local engine: the path before it is completed or mocked, and what it did is shown in Scenarios`,available:e=>!!e.commands?.testTask,run:e=>e.commands.testTask?.()},ne(),ie(),{id:`fit-diagram`,title:`Fit diagram`,section:`View`,icon:`fit`,keywords:[`zoom`,`reset`,`whole`,`center`,`centre`],place:`menu`,shortcut:`Mod+0`,tooltip:`Show the whole diagram in the canvas`,enabled:e=>e.drawn,run:e=>e.commands.fit()},{id:`zoom-in`,title:`Zoom in`,section:`View`,icon:`zoom-in`,keywords:[`bigger`,`magnify`,`closer`],place:`menu`,enabled:e=>e.drawn,run:e=>e.commands.zoomIn()},{id:`zoom-out`,title:`Zoom out`,section:`View`,icon:`zoom-out`,keywords:[`smaller`,`farther`,`further`],place:`menu`,enabled:e=>e.drawn,run:e=>e.commands.zoomOut()},{id:`transaction-boundaries`,title:`Transaction boundaries`,section:`View`,icon:`transaction`,keywords:[`commit`,`wait state`,`async`,`asynchronous`,`continuation`],place:`menu`,tooltip:`Show where the engine commits a transaction: wait states and asynchronous continuations`,enabled:e=>e.drawn,available:e=>e.camunda7,checked:e=>e.open.boundaries,run:e=>e.commands.toggleBoundaries()},{id:`minimap`,title:`Minimap`,section:`View`,icon:`minimap`,keywords:[`overview`,`navigator`,`map`],place:`menu`,enabled:e=>e.drawn,checked:e=>e.open.minimap,run:e=>e.commands.toggleMinimap()},{id:`trace-paths`,title:`Trace paths`,section:`View`,icon:`trace-paths`,keywords:[`reachability`,`reachable`,`before`,`after`,`upstream`,`downstream`,`highlight`,`what leads here`,`what follows`],place:`menu`,shortcut:wr,keymap:!0,tooltip:e=>e.open.traceable?Y(`app.actions.trace-paths.tooltipOn`):Y(`app.actions.trace-paths.tooltipOff`),enabled:e=>e.open.traceable,checked:e=>e.open.trace,run:e=>e.commands.toggleTrace()},{id:`sketchy`,title:`Sketchy drawing`,section:`View`,icon:`sketchy`,keywords:[`hand drawn`,`rough`,`style`,`rendering`],place:`menu`,enabled:e=>e.drawn,checked:e=>e.open.sketchy,run:e=>e.commands.toggleSketchy()},{id:`show-comment-badges`,title:`Show comment badges`,section:`View`,icon:`comments`,keywords:[`comments`,`notes`,`badge`,`count`,`annotations`],place:`menu`,tooltip:`Draw the number of open comments on each element that has some`,checked:e=>e.open.commentBadges,run:e=>e.commands.toggleCommentBadges()},{id:`show-code-badges`,title:`Show code badges`,section:`View`,icon:`code`,keywords:[`code`,`worker`,`delegate`,`bean`,`badge`,`missing`],place:`menu`,tooltip:`Draw a mark on each task that says whether its code was found in the project`,checked:e=>e.open.codeBadges,run:e=>e.commands.toggleCodeBadges()},{id:`export`,title:`Export…`,section:`File`,icon:`export`,keywords:[`png`,`svg`,`pdf`,`image`,`picture`,`copy as image`],place:`menu`,shortcut:`Mod+Shift+C`,keymap:!0,tooltip:`Save the diagram as SVG, PNG or PDF, or copy it as a picture`,enabled:e=>e.drawn,run:e=>e.commands.exportDialog()},{id:`marketplace`,title:`Templates…`,section:`File`,icon:`marketplace`,keywords:[`connectors`,`element templates`,`marketplace`,`catalogue`,`catalog`],place:`menu`,available:e=>e.camunda8,run:e=>e.commands.templates()},{id:`import`,title:`Import from another tool…`,section:`File`,icon:`import`,keywords:[`draw.io`,`drawio`,`visio`,`signavio`,`bizagi`,`flowable`,`convert`],place:`menu`,tooltip:`Turn a draw.io, Visio, Signavio, Bizagi or Flowable diagram into BPMN, and see what carries over before anything is written`,run:e=>e.commands.importDiagram()},K(e=>e.drawn),{id:`copy`,title:`Copy`,section:`Edit`,icon:`copy`,keywords:[`duplicate`],place:`menu`,enabled:e=>e.drawn,run:e=>e.commands.copy()},{id:`paste`,title:`Paste`,section:`Edit`,icon:`paste`,keywords:[],place:`menu`,enabled:e=>e.drawn,run:e=>e.commands.paste()},{id:`tour`,title:`Show the tour again`,section:`Help`,icon:`tour`,keywords:[`welcome`,`introduction`,`guide`,`onboarding`,`first run`],place:`menu`,run:e=>e.commands.tour()},La(),re(),Se(),xe(),oe(),be(),Ce()],bc=[`<=`,`>=`,`!=`,`==`,`&&`,`||`,`<`,`>`,`=`,`(`,`)`,`!`];function tokenise(e){let t=[],n=0;for(;n<e.length;){let r=e.slice(n),i=/^\s+/.exec(r);if(i){n+=i[0].length;continue}let a=/^"((?:[^"\\]|\\.)*)"|^'((?:[^'\\]|\\.)*)'/.exec(r);if(a){t.push({kind:`string`,value:(a[1]??a[2]).replace(/\\(.)/g,`$1`)}),n+=a[0].length;continue}let o=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(r);if(o){t.push({kind:`number`,value:Number(o[0])}),n+=o[0].length;continue}let s=/^[A-Za-z_][\w.]*/.exec(r);if(s){t.push({kind:`word`,value:s[0]}),n+=s[0].length;continue}let c=bc.find(e=>r.startsWith(e));if(!c)return null;t.push({kind:`op`,value:c}),n+=c.length}return t}var xc=new Set([`<=`,`>=`,`!=`,`==`,`=`,`<`,`>`]),Sc=new Set([`and`,`or`,`not`]),Unreadable=class extends Error{};function kindOf$1(e){return e===null?`null`:Array.isArray(e)?`list`:typeof e}e(kindOf$1,`kindOf`);function shown$5(e){return typeof e==`string`?`"${e}"`:JSON.stringify(e)}e(shown$5,`shown`);function kindName(e){let t=kindOf$1(e);return t===`string`?Y(`app.scenarios.valueKind.text`):t===`number`?Y(`app.scenarios.valueKind.number`):t===`boolean`?Y(`app.scenarios.valueKind.boolean`):t===`null`?Y(`app.scenarios.valueKind.null`):Y(`app.scenarios.valueKind.other`,{kind:t})}function withValue(e){return typeof e==`string`?Y(`app.scenarios.value.text`,{value:shown$5(e)}):kindName(e)}function compare(e,t,n,r){let i=t===`=`||t===`==`||t===`!=`,a=[kindOf$1(e.value),kindOf$1(n.value)];if(i&&(a[0]===`null`||a[1]===`null`)){let e=a[0]===a[1];return t===`!=`?!e:e}if(a[0]!==a[1]||a[0]===`null`){let[t,i]=e.variable||!n.variable?[e,n]:[n,e];return r.push(Y(`app.scenarios.note.otherKind`,{name:t.variable??shown$5(t.value),value:withValue(t.value),other:kindName(i.value)})),null}if(i){let r=e.value===n.value;return t===`!=`?!r:r}if(a[0]!==`number`)return r.push(a[0]===`string`?Y(`app.scenarios.note.noTextOrder`):Y(`app.scenarios.note.noOrder`,{kind:a[0]})),null;let o=e.value,s=n.value;return t===`<`?o<s:t===`<=`?o<=s:t===`>`?o>s:o>=s}var Reader=class{at=0;tokens;values;used=new Map;missing=new Set;notes=[];constructor(e,t){this.tokens=e,this.values=t}isOp(...e){let t=this.tokens[this.at];return t?.kind===`op`&&e.includes(t.value)}isWord(...e){let t=this.tokens[this.at];return t?.kind===`word`&&e.includes(t.value)}done(){return this.at>=this.tokens.length}or(){let e=this.and();for(;this.isOp(`||`)||this.isWord(`or`);){this.at+=1;let t=this.and();e=e===!0||t===!0?!0:e===null||t===null?null:!1}return e}and(){let e=this.unary();for(;this.isOp(`&&`)||this.isWord(`and`);){this.at+=1;let t=this.unary();e=e===!1||t===!1?!1:e===null||t===null?null:!0}return e}unary(){if(this.isOp(`!`)){this.at+=1;let e=this.unary();return e===null?null:!e}if(this.isWord(`not`)){if(this.at+=1,!this.isOp(`(`))throw new Unreadable;let e=this.unary();return e===null?null:!e}if(this.isOp(`(`)){this.at+=1;let e=this.or();if(!this.isOp(`)`))throw new Unreadable;return this.at+=1,e}return this.comparison()}operand(){let e=this.tokens[this.at];if(!e)throw new Unreadable;if(this.at+=1,e.kind===`number`||e.kind===`string`)return{value:e.value,known:!0,variable:null};if(e.kind!==`word`||Sc.has(e.value))throw new Unreadable;if(e.value===`true`)return{value:!0,known:!0,variable:null};if(e.value===`false`)return{value:!1,known:!0,variable:null};if(e.value===`null`)return{value:null,known:!0,variable:null};let t=Sr(this.values,e.value);return t===void 0?(this.missing.add(e.value),{value:void 0,known:!1,variable:e.value}):(this.used.set(e.value,t),{value:t,known:!0,variable:e.value})}comparison(){let e=this.operand(),t=this.tokens[this.at];if(!(t?.kind===`op`&&xc.has(t.value))){if(!e.variable&&typeof e.value!=`boolean`)throw new Unreadable;return e.known?typeof e.value==`boolean`?e.value:(this.notes.push(Y(`app.scenarios.note.notBoolean`,{name:e.variable,value:withValue(e.value)})),null):null}this.at+=1;let n=this.operand();return!e.known||!n.known?null:compare(e,t.value,n,this.notes)}};function conditionText(e){if(!e)return``;let t=``,n=``;for(let r of Kr(e).trim())n?(t+=r,r===n&&(n=``)):r===`"`||r===`'`?(n=r,t+=r):t+=/\s/.test(r)?t.endsWith(` `)?``:` `:r;return t}function evaluateCondition(e,t){let n=conditionText(e),r={result:null,text:n,used:[],missing:[],notes:[],readable:!1};if(!n)return r;let i=tokenise(n);if(!i||i.length===0)return r;let a=new Reader(i,t);try{let e=a.or();return a.done()?{result:e,text:n,used:[...a.used].map(([e,t])=>({name:e,value:t})),missing:[...a.missing],notes:a.notes,readable:!0}:r}catch(e){if(e instanceof Unreadable||e instanceof RangeError)return r;throw e}}function usedText(e){return e.length>0?` (${e.map(e=>`${e.name} = ${Vr(e.value)}`).join(`, `)})`:``}function hintOf(e,t){return e.isDefault?Y(`app.scenarios.gatewayHint.default`):t?t.readable?t.result===!0?Y(`app.scenarios.gatewayHint.isTrue`,{text:t.text,used:usedText(t.used)}):t.result===!1?Y(`app.scenarios.gatewayHint.isFalse`,{text:t.text,used:usedText(t.used)}):t.missing.length===0&&t.notes.length>0?Y(`app.scenarios.gatewayHint.undecided`,{text:t.text,notes:t.notes.join(`; `)}):Y(`app.scenarios.gatewayHint.chooseVariables`,{text:t.text}):Y(`app.scenarios.gatewayHint.cannotCheck`,{text:t.text}):Y(`app.scenarios.gatewayHint.noCondition`)}function readGateway(e,t,n){let r=t.map(e=>{let t=!e.isDefault&&e.condition?.trim()?evaluateCondition(e.condition,n):null,r=e.isDefault?null:!t||t.result;return{flowId:e.id,name:e.name,label:e.label,condition:t?.text??``,isDefault:e.isDefault,result:r,used:t?.used??[],hint:hintOf(e,t)}}),i=r.filter(e=>!e.isDefault),a=r.find(e=>e.isDefault),o=i.find(e=>e.result===null),s=[],c=null,l=[];if(e===`exclusive`){let e=i.find(e=>e.result!==!1);if(e?.result===!0){s.push(e.flowId);let t=i.filter(e=>e.result===!0);t.length>1&&(l=t.map(e=>e.label))}else e&&(c=e.hint)}else s.push(...i.filter(e=>e.result===!0).map(e=>e.flowId)),o&&(c=o.hint);s.length===0&&!c&&a&&s.push(a.flowId);let u=s.length===0&&!c&&i.length>0&&i.every(e=>e.result===!1);return{flows:r,takes:s,unresolved:c,noWay:u,overlap:l}}function scenarioPath(e){let t=new Map;return e.firedIds.forEach((e,n)=>t.set(e,[...t.get(e)??[],n+1])),{elementIds:[...t.keys()],flowIds:[...new Set(e.flowIds)],numbers:t,order:e.firedIds}}function numberLabel(e){return(e??[]).join(`, `)}function scenarioKey(e){let t=e.decisions.map(e=>`${e.decisionId}:${e.flowIds.join(`+`)}:${e.boundaryId??``}`);return[e.process,e.startId,...t,e.endIds.join(`+`)].join(`|`)}function scenarioCoverage(e,t){let n=[],r=[],i=[],a=vr(e),visit=e=>{for(let t of e??[]){if(!t.id)continue;t.$type===`bpmn:SequenceFlow`?n.push(t.id):t.$type===`bpmn:EndEvent`&&r.push(t.id);let e=a.get(t.id);t.flowElements&&e&&(e.followed?visit(t.flowElements):e.type!==`bpmn:CallActivity`&&i.push({id:e.id,name:e.name,why:e.why??`this kind of sub-process`}))}};for(let t of e?.rootElements??[])t.$type===`bpmn:Process`&&t.isExecutable!==!1&&visit(t.flowElements);let o=new Set(t.flatMap(e=>e.flowIds)),s=new Set(t.flatMap(e=>e.elementIds)),c=new Set(i.map(e=>e.id)),inside=e=>c.has(e);return{flows:n.length,ends:r.length,unreachedFlows:n.filter(e=>!o.has(e)&&!inside(e)),unreachedEnds:r.filter(e=>!s.has(e)&&!inside(e)),unfollowed:i}}function coverageLine(e,t=!1){let n=[],r=[];e.unreachedFlows.length>0&&r.push(Y(`app.scenarios.coverage.flows`,{unreached:e.unreachedFlows.length,total:e.flows})),e.unreachedEnds.length>0&&r.push(Y(`app.scenarios.coverage.endEvents`,{unreached:e.unreachedEnds.length,total:e.ends})),r.length>0?n.push(Y(`app.scenarios.coverage.noScenarioReaches`,{parts:pi(r)})):t&&n.push(Y(`app.scenarios.coverage.capped`,{cap:64}));for(let t of e.unfollowed)n.push(Y(`app.scenarios.coverage.doesNotFollow`,{name:t.name||t.id,why:t.why}));return n.length>0?n.join(`. `).replace(/\.\.$/,`.`):null}function fields(e){return e}function plain$1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e(plain$1,`plain`);function soundCase(e){let t=(Array.isArray(e.instructions)?e.instructions:[]).filter(e=>plain$1(e)&&typeof e.type==`string`),n={...e,name:typeof e.name==`string`?e.name:``,instructions:t},r=e[`x-penstock`];return r!==void 0&&!plain$1(r)?delete n[`x-penstock`]:plain$1(r)&&r.behaviours!==void 0&&!plain$1(r.behaviours)&&(n[`x-penstock`]={...r,behaviours:void 0}),n}function selectorId(e,t){return fields(e)[t]?.elementId}function selectorType(e){return fields(e).jobSelector?.jobType}function jobTypeOf(e){return e.job??e.external}function throwsFor(e,t){let n=jobTypeOf(t);return e.type===`THROW_BPMN_ERROR_FROM_JOB`?selectorId(e,`jobSelector`)===t.id||!!n&&selectorType(e)===n:e.type===`MOCK_JOB_WORKER_THROW_BPMN_ERROR`&&!!n&&fields(e).jobType===n}function failureOf(e,t){let n=e.instructions.find(e=>throwsFor(e,t));if(n)return String(fields(n).errorCode??``);let r=e[`x-penstock`]?.behaviours?.[t.id];if(r?.then===`error`)return r.errorCode??r.errorMessage??`error`;if(r?.errorMessage)return r.errorMessage}function selectorTaskName(e){return fields(e).userTaskSelector?.taskName}function answerIndex(e,t,n){let at=t=>e.instructions.findIndex(t),r=jobTypeOf(t);if(t.host){if(t.event===`error`){let e=at(e=>e.type===`THROW_BPMN_ERROR_FROM_JOB`&&selectorId(e,`jobSelector`)===t.host);return e>=0||!n?e:at(e=>throwsFor(e,n)&&(!t.errorCode||!fields(e).errorCode||fields(e).errorCode===t.errorCode))}return t.event===`timer`?at(e=>e.type===`INCREASE_TIME`):t.event===`message`&&t.message?at(e=>(e.type===`CORRELATE_MESSAGE`||e.type===`PUBLISH_MESSAGE`)&&fields(e).name===t.message):t.event===`signal`&&t.signal?at(e=>e.type===`BROADCAST_SIGNAL`&&fields(e).signalName===t.signal):-1}if(t.event===`timer`)return at(e=>e.type===`INCREASE_TIME`);if(r){let e=at(e=>e.type===`COMPLETE_JOB`&&selectorId(e,`jobSelector`)===t.id);if(e>=0)return e;let n=at(e=>e.type===`COMPLETE_JOB`&&selectorType(e)===r);if(n>=0)return n;let i=at(e=>e.type===`MOCK_JOB_WORKER_COMPLETE_JOB`&&fields(e).jobType===r);if(i>=0)return i;let a=at(e=>(e.type===`MOCK_JOB_WORKER_THROW_BPMN_ERROR`||e.type===`THROW_BPMN_ERROR_FROM_JOB`)&&throwsFor(e,t));return a>=0?a:-1}return t.type===`bpmn:UserTask`?at(e=>e.type===`COMPLETE_USER_TASK`&&(selectorId(e,`userTaskSelector`)===t.id||!!t.name&&selectorTaskName(e)===t.name)):t.event===`message`&&t.message?at(e=>(e.type===`CORRELATE_MESSAGE`||e.type===`PUBLISH_MESSAGE`)&&fields(e).name===t.message):t.event===`signal`&&t.signal?at(e=>e.type===`BROADCAST_SIGNAL`&&fields(e).signalName===t.signal):-1}function returnsOf(e,t){let n=answerIndex(e,t);return n>=0?fields(e.instructions[n]).variables:e[`x-penstock`]?.behaviours?.[t.id]?.variables}function canAnswer(e,t){return answerIndex(e,t)>=0||!!e[`x-penstock`]?.behaviours?.[t.id]||t.type===`bpmn:UserTask`||t.event===`timer`||!!jobTypeOf(t)}function insertBeforeAssertions(e,t){let n=e.findIndex(e=>typeof e.type==`string`&&e.type.startsWith(`ASSERT_`));return n>=0?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}function withReturns(e,t,n){let r=!n||Object.keys(n).length===0,i=answerIndex(e,t);if(i>=0){let t=e.instructions.map((e,t)=>{if(t!==i)return e;let{variables:a,...o}=fields(e);return r?o:{...o,variables:n}});return{...e,instructions:t}}if(t.type===`bpmn:UserTask`)return{...e,instructions:insertBeforeAssertions(e.instructions,{type:`COMPLETE_USER_TASK`,userTaskSelector:{elementId:t.id},...r?{}:{variables:n}})};let a=jobTypeOf(t);if(a)return{...e,instructions:insertBeforeAssertions(e.instructions,{type:`MOCK_JOB_WORKER_COMPLETE_JOB`,jobType:a,...r?{}:{variables:n}})};let o=e[`x-penstock`]?.behaviours?.[t.id];if(!o)return e;let{variables:s,...c}=o,l=r?c:{...c,variables:n};return{...e,"x-penstock":{...e[`x-penstock`],behaviours:{...e[`x-penstock`]?.behaviours,[t.id]:l}}}}function startOf(e){let t=e.instructions.find(e=>e.type===`CREATE_PROCESS_INSTANCE`),n=t&&fields(t).variables;return plain$1(n)?n:{}}function withStart(e,t){let n=Object.keys(t).length===0;return{...e,instructions:e.instructions.map(e=>{if(e.type!==`CREATE_PROCESS_INSTANCE`)return e;let{variables:r,...i}=fields(e);return n?i:{...i,variables:t}})}}function expectedOf(e){let t={};for(let n of e.instructions)if(n.type===`ASSERT_VARIABLES`&&!fields(n).elementSelector){let e=fields(n).variables;plain$1(e)&&Object.assign(t,e)}return t}function withExpected(e,t){let n=e.instructions.filter(e=>!(e.type===`ASSERT_VARIABLES`&&!fields(e).elementSelector));if(Object.keys(t).length===0)return{...e,instructions:n};let r=e.instructions.find(e=>e.type===`CREATE_PROCESS_INSTANCE`)?.processDefinitionSelector?.processDefinitionId,i={type:`ASSERT_VARIABLES`,...r?{processInstanceSelector:{processDefinitionId:r}}:{},variables:t},a=n.length-1,o=a>=0&&n[a].type===`ASSERT_PROCESS_INSTANCE`;return{...e,instructions:o?[...n.slice(0,a),i,n[a]]:[...n,i]}}function assertedElements(e){let t=[];for(let n of e.instructions){let e=fields(n);if(n.type===`ASSERT_ELEMENT_INSTANCES`&&e.state===`IS_COMPLETED`)for(let n of Array.isArray(e.elementSelectors)?e.elementSelectors:[])n?.elementId&&t.push(n.elementId);if(n.type===`ASSERT_ELEMENT_INSTANCE`&&e.state===`IS_COMPLETED`){let n=e.elementSelector?.elementId;n&&t.push(n)}}return[...new Set(t)]}function firesBoundary(e,t,n){return e[`x-penstock`]?.behaviours?.[t.id]?.then===`fire`||answerIndex(e,t,n)>=0}function scopeAlong(e,t,n,r){let i={...startOf(e)};for(let a of n){let n=t.get(a);n&&Object.assign(i,returnsOf(e,n)??{},r?.(a,i)??{})}return i}function firesTimer(e,t){return e[`x-penstock`]?.behaviours?.[t.id]?.then===`fire`||e.instructions.some(e=>e.type===`INCREASE_TIME`)}var Cc=/^-?P(?=\d|T\d)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$/;function isDuration(e){return Cc.test(e.trim())}function timerDuration(e,t){let n=e.instructions.find(e=>e.type===`INCREASE_TIME`);return n?String(fields(n).duration??``):t.timer}function withTimerFires(e,t,n){let r=n||t.timer||`PT1S`,i=e.instructions.findIndex(e=>e.type===`INCREASE_TIME`);if(i>=0){let t=e.instructions.map((e,t)=>t===i?{...fields(e),duration:r}:e);return{...e,instructions:t}}return{...e,instructions:insertBeforeAssertions(e.instructions,{type:`INCREASE_TIME`,duration:r})}}function withoutTimerFires(e,t){let n=e.instructions.filter(e=>e.type!==`INCREASE_TIME`),r=e[`x-penstock`];if(r?.behaviours?.[t.id]){let{[t.id]:e,...n}=r.behaviours;r=Object.keys(n).length>0?{...r,behaviours:n}:{...r,behaviours:void 0}}return{...e,instructions:n,...r?{"x-penstock":r}:{}}}function workerMockOf(e,t){let n=jobTypeOf(t);if(n){let r=e.instructions.find(e=>e.type===`MOCK_JOB_WORKER_COMPLETE_JOB`&&fields(e).jobType===n||e.type===`COMPLETE_JOB`&&(selectorId(e,`jobSelector`)===t.id||selectorType(e)===n));if(r)return{kind:`complete`,variables:fields(r).variables};let i=e.instructions.find(e=>(e.type===`MOCK_JOB_WORKER_THROW_BPMN_ERROR`||e.type===`THROW_BPMN_ERROR_FROM_JOB`)&&throwsFor(e,t));if(i)return{kind:`error`,errorCode:String(fields(i).errorCode??``),errorMessage:fields(i).errorMessage,variables:fields(i).variables}}let r=e[`x-penstock`]?.behaviours?.[t.id];if(r){if(r.then===`error`)return{kind:`error`,errorCode:r.errorCode??`error`,errorMessage:r.errorMessage,variables:r.variables};if(r.fail!==void 0||r.errorMessage)return{kind:`fail`,errorMessage:r.errorMessage,retries:r.fail};if(r.then===`complete`)return{kind:`complete`,variables:r.variables}}}function withWorkerMock(e,t,n){let r=jobTypeOf(t),i=withoutWorkerMock(e,t);if(r&&n.kind!==`fail`){let e;return e=n.kind===`complete`?{type:`MOCK_JOB_WORKER_COMPLETE_JOB`,jobType:r,...n.variables&&Object.keys(n.variables).length>0?{variables:n.variables}:{}}:{type:`MOCK_JOB_WORKER_THROW_BPMN_ERROR`,jobType:r,errorCode:n.errorCode||`error`,...n.errorMessage?{errorMessage:n.errorMessage}:{},...n.variables&&Object.keys(n.variables).length>0?{variables:n.variables}:{}},{...i,instructions:insertBeforeAssertions(i.instructions,e)}}let a=n.kind===`complete`?{then:`complete`,...n.variables?{variables:n.variables}:{}}:n.kind===`error`?{then:`error`,errorCode:n.errorCode||`error`,...n.errorMessage?{errorMessage:n.errorMessage}:{},...n.variables?{variables:n.variables}:{}}:{then:`complete`,fail:n.retries??1,...n.errorMessage?{errorMessage:n.errorMessage}:{}};return{...i,"x-penstock":{...i[`x-penstock`],behaviours:{...i[`x-penstock`]?.behaviours,[t.id]:a}}}}function withoutWorkerMock(e,t){let n=jobTypeOf(t),r=e.instructions.filter(e=>!n||!(e.type===`MOCK_JOB_WORKER_COMPLETE_JOB`&&fields(e).jobType===n||e.type===`COMPLETE_JOB`&&(selectorId(e,`jobSelector`)===t.id||selectorType(e)===n)||(e.type===`MOCK_JOB_WORKER_THROW_BPMN_ERROR`||e.type===`THROW_BPMN_ERROR_FROM_JOB`)&&throwsFor(e,t))),i=e[`x-penstock`];if(i?.behaviours?.[t.id]){let{[t.id]:e,...n}=i.behaviours;i=Object.keys(n).length>0?{...i,behaviours:n}:{...i,behaviours:void 0}}return{...e,instructions:r,...i?{"x-penstock":i}:{}}}function contextOf$2(e,t=new Map){return{definitions:e,index:Nn(e),tables:t}}e(contextOf$2,`contextOf`);function producedBy(e){return(t,n)=>{let r=e.index.steps.get(t),i=r?.decision?e.tables.get(r.decision):void 0;if(r&&i)return Fr(i,Ar(i,n),r.resultVariable)}}function eventFired(e,t,n){let r=e.index.steps.get(n);return r?t[`x-penstock`]?.behaviours?.[n]?.then===`fire`||answerIndex(t,r,r.host?e.index.steps.get(r.host):void 0)>=0:!1}function deciderFor(e,t,n=[]){let r=producedBy(e);return(i,a)=>{let o=[...n,...a],s=e.index.nodes.get(i[0].nodeId),c=i.findIndex(n=>{let r=n.boundaryId?e.index.steps.get(n.boundaryId):void 0;return!!r&&firesBoundary(t,r,r.host?e.index.steps.get(r.host):void 0)});if(c>=0)return c;let l=i.findIndex(e=>!e.boundaryId);if(!s)return Math.max(l,0);if(s.type===`bpmn:EventBasedGateway`){let n=i.findIndex(n=>n.flowIds.some(n=>eventFired(e,t,e.index.flows.get(n)?.target??``)));return n>=0?n:Math.max(l,0)}let u=scopeAlong(t,e.index.steps,o,r),d=readGateway(jn(s.type)?Pn(s.type):`inclusive`,In(e.index,s.id),u);if(d.noWay)return-1;let f=new Set(d.takes),p=f.size===0?-1:i.findIndex(e=>!e.boundaryId&&e.flowIds.length===f.size&&e.flowIds.every(e=>f.has(e)));return p>=0?p:Math.max(l,0)}}function createOf(e){return e.instructions.find(e=>e.type===`CREATE_PROCESS_INSTANCE`)}function withVariables(e,t){return{...e,instructions:e.instructions.map(e=>e.type===`CREATE_PROCESS_INSTANCE`?{...e,variables:t}:e)}}function withDecisionInputs(e,t){if(e.tables.size===0)return t;let n=t.testCase;for(let r of t.scenario.stepIds){let i=e.index.steps.get(r),a=i?.decision?e.tables.get(i.decision):void 0,o=i?.resultVariable;if(!a||!o)continue;let s=Dr(createOf(n)?.variables),c=Object.fromEntries(Object.entries(s).filter(([e])=>e!==o&&!e.startsWith(`${o}.`)));if(Object.keys(c).length===Object.keys(s).length)continue;let l=[c];for(let e=0;e<a.rules.length;e+=1){let t=Rr(a,e);t&&l.push({...c,...t})}for(let r of l){if(Ar(a,Wr(r)).rules.length===0)continue;let i=withVariables(n,Wr(r)),o=resolveCase(e,i,`generated`);if(`planned`in o&&o.planned.key===t.key&&o.planned.complete&&o.planned.notes.length===0){n=i;break}}}return n===t.testCase?t:{...t,testCase:n}}function generatedSet(e,t){let n=br(e.definitions,t);return{capped:n.capped,unplannable:n.unplannable,planned:n.items.map(({scenario:t,testCase:n})=>withDecisionInputs(e,{key:scenarioKey(t),name:n.name,origin:`generated`,scenario:t,testCase:n,complete:!0,notes:[]}))}}function listed(e){return e.join(`, `)}function chooseProcess(e,t,n){let r=Gr(e.definitions);return t?[...e.index.nodes.values()].some(e=>e.process===t)?r.includes(t)?{process:t}:{problem:Y(`app.scenarios.processNotExecutable`,{process:t})}:{problem:Y(`app.scenarios.processNotInDiagram`,{process:t})}:r.length===1?{process:r[0]}:r.length===0?{problem:Y(`app.scenarios.noExecutableProcess`)}:{problem:n??Y(`app.scenarios.chooseAProcess`,{processes:listed(r)})}}function walkAll(e,t,n,r){let i=qr(e.definitions,deciderFor(e,t),{process:n,startId:r});if(!i)return null;let a=yr(e.definitions,i.scenario,(n,r)=>qr(e.definitions,deciderFor(e,t,r),{process:n})?.scenario??null);return{...i,scenario:a}}function blockedNote(e,t){if(!t)return[];let n=e.index.nodes.get(t);return[Y(`app.scenarios.noConditionAtGateway`,{where:n?.name?Y(`app.scenarios.quoted`,{name:n.name}):Y(`app.scenarios.aGateway`)})]}function reached(e){return new Set([...e.stepIds,...e.endIds])}function resolveCase(e,t,n=`file`,r){let i=soundCase(t),a=i.instructions.find(e=>e.type===`CREATE_PROCESS_INSTANCE`)?.processDefinitionSelector?.processDefinitionId,o=chooseProcess(e,a||void 0,Y(`app.scenarios.namesNoProcess`,{processes:listed(Gr(e.definitions))}));if(`problem`in o)return o;let s=walkAll(e,i,o.process);if(!s)return{problem:Y(`app.scenarios.cannotFollow`,{process:o.process})};let c=assertedElements(i),l=s.scenario,u=s.complete,d=[...blockedNote(e,s.blockedAt)];if(c.length>0){let covers=e=>c.every(t=>reached(e).has(t));if(!covers(l)){let t=(r??br(e.definitions).items.map(e=>e.scenario)).filter(e=>e.process===l.process&&covers(e)).sort((e,t)=>reached(e).size-reached(t).size)[0];t?(l=t,u=!0,d.length=0,d.push(Y(`app.scenarios.takesAnotherWay`))):d.push(Y(`app.scenarios.checksUnreachedElements`))}}return{planned:{key:scenarioKey(l),name:i.name,origin:n,scenario:l,testCase:i,complete:u,notes:d}}}function resolveValues(e,t,n,r={}){let i=chooseProcess(e,r.process,null);if(`problem`in i)return i;let a=walkAll(e,{name:t,instructions:[{type:`CREATE_PROCESS_INSTANCE`,processDefinitionSelector:{processDefinitionId:i.process},variables:n}]},i.process,r.startId);if(!a)return{problem:Y(`app.scenarios.cannotFollow`,{process:i.process})};let o=jr(a.scenario,e.index.steps,n);if(`problem`in o)return{problem:o.problem};let s=a.complete?[]:a.blockedAt?blockedNote(e,a.blockedAt):[Y(`app.scenarios.doesNotReachAnEnd`)],c=t.trim()||_r(a.scenario);return{planned:{key:scenarioKey(a.scenario),name:c,origin:`added`,scenario:a.scenario,testCase:{...o.testCase,name:c},complete:a.complete,notes:s}}}function isEdited(e){return e?!!e.name||!Nr(e.start)||!Nr(e.expected)||Object.values(e.returns??{}).some(e=>!Nr(e))||Object.keys(e.mocks??{}).length>0:!1}function applyEdits(e,t,n){if(!t)return e;let r=soundCase(e);Nr(t.start)||(r=withStart(r,Er(startOf(r),t.start)));for(let[e,i]of Object.entries(t.returns??{})){let t=n.get(e);t&&!Nr(i)&&(r=withReturns(r,t,Er(returnsOf(r,t)??{},i)))}for(let[e,i]of Object.entries(t.mocks??{})){let t=n.get(e);t&&(r=i===null?t.event===`timer`?withoutTimerFires(r,t):withoutWorkerMock(r,t):i.kind===`timer`?withTimerFires(r,t,i.duration):withWorkerMock(r,t,i))}return Nr(t.expected)||(r=withExpected(r,Br(expectedOf(r),t.expected))),t.name?{...r,name:t.name}:r}function valuesOfRows(e){let t={};for(let n of e)n.name.trim()!==``&&(t[n.name.trim()]=n.value);return t}function editsForRows(e,t,n,r){let i=valuesOfRows(r.rows);if(r.role===`start`)return{...n,start:Or(Dr(startOf(e)),i)};if(r.role===`expected`)return{...n,expected:Or(expectedOf(e),i)};let a=t.get(r.elementId),o=Dr(a?returnsOf(e,a):void 0);return{...n,returns:{...n.returns,[r.elementId]:Or(o,i)}}}function quoted(e,t){return e?Y(`app.scenarios.quoted`,{name:e}):t}function humanType(e){return e.replace(`bpmn:`,``).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase()}function elementOf(e){return Y(`app.scenarios.theElement`,{type:humanType(e?.type??`element`)})}function rowsOf$1(e,t=!0){return Object.entries(t?Dr(e):e??{}).map(([e,t])=>({name:e,value:t}))}e(rowsOf$1,`rowsOf`);function listOf$2(e){return e.map(e=>`${e.name} = ${Vr(e.value)}`).join(`, `)}e(listOf$2,`listOf`);function kindOf(e,t,n){let r=e?.type??t?.type??``;return r===`bpmn:StartEvent`||n&&!r?`start`:r===`bpmn:EndEvent`?`end`:r===`bpmn:EventBasedGateway`?(e?.outgoing.length??0)>1?`eventGateway`:`join`:/^bpmn:(SubProcess|Transaction|AdHocSubProcess)$/.test(r)?`subprocess`:r===`bpmn:ParallelGateway`?(e?.outgoing.length??0)>1?`parallel`:`join`:jn(r)?(e?.outgoing.length??0)>1?`gateway`:`join`:t?.host&&t.event===`error`?`error`:t?.event===`timer`?`timer`:t?.event===`signal`?`signal`:t?.event===`message`?`message`:r===`bpmn:BusinessRuleTask`||t?.decision?`decision`:r===`bpmn:CallActivity`||t?.calledProcess?`call`:r===`bpmn:UserTask`&&!t?.job&&!t?.external?`user`:t?.job||t?.external?`worker`:t?.delegateClass||t?.delegateExpression||t?.expression?`delegate`:`task`}function depthOf$1(e,t){let n=0;for(let r=e.nodes.get(t)?.parent??null;r;r=e.nodes.get(r)?.parent??null)n+=1;return n}e(depthOf$1,`depthOf`);function describeEvent(e,t){let n=e.nodes.get(t),r=e.steps.get(t),i=n?.name?Y(`app.scenarios.quoted`,{name:n.name}):Y(`app.scenarios.theType`,{type:humanType(n?.type??`bpmn:Event`)});return r?.event===`message`?Y(`app.scenarios.event.message`,{name:i,message:r.message??``}).replace(` )`,`)`):r?.event===`timer`?Y(`app.scenarios.event.timer`,{name:i,timer:r.timer??``}).replace(` )`,`)`):r?.event===`signal`?Y(`app.scenarios.event.signal`,{name:i,signal:r.signal??``}).replace(` )`,`)`):i}function joined(e){return e.length<3?e.join(Y(`app.scenarios.listSeparator.two`)):`${e.slice(0,-1).join(`, `)}${Y(`app.scenarios.listSeparator.many`)}${e[e.length-1]}`}function describeSteps(e,t,n){let r=soundCase(n),{index:i}=e,a=vr(e.definitions),o=[],s={...startOf(r)},c=new Map;for(let e of t.decisions)c.set(e.decisionId,[...c.get(e.decisionId)??[],e]);let l=new Map,u=t.firedIds.length-1;return t.firedIds.forEach((n,d)=>{let f=i.nodes.get(n),p=i.steps.get(n),m=f?.name??``,h=kindOf(f,p,d===0),g=[],_={},v={number:d+1,depth:depthOf$1(i,n),elementId:n,name:m||humanType(f?.type??`element`),kind:h,text:``,issues:g,links:_,scope:{}},y=quoted(m,elementOf(f)),slotOf=(e,t,r,i)=>({role:e,elementId:n,title:t,rows:rowsOf$1(r,e!==`expected`),empty:i}),b=p?returnsOf(r,p):void 0;if(h===`start`&&v.depth>0)v.text=Y(`app.scenarios.step.subProcessStartsAt`,{label:y});else if(h===`start`){let e=startOf(r);v.text=Object.keys(e).length>0?Y(`app.scenarios.step.startsWithVariables`,{label:y}):Y(`app.scenarios.step.startsWithoutVariables`,{label:y}),v.values=slotOf(`start`,Y(`app.scenarios.slot.startVariables`),e,Y(`app.scenarios.slot.noVariablesAdd`))}else if(h===`gateway`){let e=l.get(n)??0;l.set(n,e+1);let t=c.get(n)?.[e],r=readGateway(Pn(f?.type??``),In(i,n),s),a=t?.flowIds??[],o=new Map(r.flows.map(e=>[e.flowId,e])),u=new Set(r.takes);v.branches=r.flows.map(e=>({flowId:e.flowId,name:e.name,condition:e.condition,hint:e.hint,planned:a.includes(e.flowId),wouldTake:u.has(e.flowId),isDefault:e.isDefault}));let d=a.map(e=>o.get(e)).filter(e=>!!e),p=d.map(e=>e.label).join(Y(`app.scenarios.listSeparator.two`)),h=a.length===u.size&&a.every(e=>u.has(e));if(d.length===0&&r.noWay)v.text=Y(`app.scenarios.step.noConditionNoDefault`),g.push({kind:`stuck`,text:Y(`app.scenarios.issue.stuckAtGateway`)});else if(d.length===0)v.text=m?Y(`app.scenarios.step.labelSendsOn`,{label:y}):Y(`app.scenarios.step.gatewaySendsOn`);else if(r.unresolved&&r.takes.length===0)v.text=Y(`app.scenarios.step.takesBecause`,{names:p,because:r.unresolved}),g.push({kind:`unresolved`,text:r.unresolved});else if(h)v.text=Y(`app.scenarios.step.takesBecause`,{names:p,because:d.map(e=>e.hint).join(`; `)});else{let e=r.takes.map(e=>o.get(e)?.label??e).join(Y(`app.scenarios.listSeparator.two`))||Y(`app.scenarios.step.noBranch`);v.text=Y(`app.scenarios.step.takesButValues`,{names:p,other:e});let t=d.filter(e=>!u.has(e.flowId));if(t.length>0)g.push({kind:`mismatch`,text:Y(`app.scenarios.issue.valuesDoNotTake`,{hints:t.map(e=>e.hint).join(`; `),names:t.map(e=>e.label).join(Y(`app.scenarios.listSeparator.two`))})});else{let e=r.flows.filter(e=>u.has(e.flowId)&&!a.includes(e.flowId));g.push({kind:`mismatch`,text:Y(`app.scenarios.issue.valuesTakeMore`,{hints:e.map(e=>e.hint).join(`; `),names:e.map(e=>e.label).join(Y(`app.scenarios.listSeparator.two`))})})}}if(r.overlap.length>1){let e=[...new Map(r.flows.filter(e=>r.overlap.includes(e.label)).flatMap(e=>e.used.map(e=>[e.name,e]))).values()].map(e=>`${e.name} = ${Vr(e.value)}`).join(`, `),[t,...n]=r.overlap,i=n.length===1?Y(`app.scenarios.step.neverTakenOne`,{name:n[0]}):Y(`app.scenarios.step.neverTakenMany`,{names:n.join(`, `)});g.push({kind:`mismatch`,text:Y(`app.scenarios.issue.overlap`,{first:r.overlap.slice(0,-1).join(`, `),last:r.overlap[r.overlap.length-1],values:e?` (${e})`:``,taken:t,never:i})})}}else if(h===`eventGateway`){let e=l.get(n)??0;l.set(n,e+1);let t=c.get(n)?.[e],r=(f?.outgoing??[]).map(e=>i.flows.get(e)?.target??``);v.text=Y(`app.scenarios.step.waitsForFirst`,{targets:joined(r.map(e=>describeEvent(i,e)))});let a=t?.flowIds[0]?i.flows.get(t.flowIds[0])?.target:void 0;a&&(v.text+=Y(`app.scenarios.step.comesFirst`,{target:describeEvent(i,a).replace(/ \(.*\)$/,``)}))}else if(h===`subprocess`){let e=a.get(n),r=t.firedIds[d+1]!==void 0&&i.nodes.get(t.firedIds[d+1])?.parent===n;if(e&&!e.followed){v.text=Y(`app.scenarios.step.runs`,{label:y});let t=e.why??Y(`app.scenarios.thisKindOfSubProcess`);g.push({kind:`unfollowed`,text:Y(`app.scenarios.issue.doesNotFollowInside`,{label:y,why:t})})}else v.text=r?Y(`app.scenarios.step.runsStepsFollow`,{label:y,repeats:e?.repeats?Y(`app.scenarios.step.repeatsPerItem`):``}):Y(`app.scenarios.step.runs`,{label:y})}else if(h===`parallel`)v.text=Y(`app.scenarios.step.splitsInto`,{number:f?.outgoing.length??0});else if(h===`join`)v.text=(f?.incoming.length??0)>1&&/^bpmn:(Parallel|Inclusive)Gateway$/.test(f?.type??``)?Y(`app.scenarios.step.waitsForBranches`,{number:f?.incoming.length}):Y(`app.scenarios.step.passesThrough`,{label:y});else if(h===`worker`&&p){let e=p.job??p.external??``,t=failureOf(r,p),i=t===void 0?Object.keys(b??{}).length>0?Y(`app.scenarios.step.returns`,{values:listOf$2(rowsOf$1(b))}):Y(`app.scenarios.step.returnsNothing`):Y(`app.scenarios.step.failsWithError`,{code:t});v.text=Y(`app.scenarios.step.workerOf`,{label:y,kind:p.external?Y(`app.scenarios.workerKind.topic`):Y(`app.scenarios.workerKind.jobType`),type:e,what:i}),canAnswer(r,p)&&(v.values=slotOf(`returns`,Y(`app.scenarios.slot.workerReturns`),b,Y(`app.scenarios.slot.returnsNothingAdd`))),_.worker=n}else if(h===`delegate`&&p){let e=p.delegateClass??p.delegateBean??p.expression??p.delegateExpression??``;v.text=Y(`app.scenarios.step.runsAndCompletes`,{label:y,which:e}),canAnswer(r,p)&&(v.values=slotOf(`returns`,Y(`app.scenarios.slot.itReturns`),b,Y(`app.scenarios.slot.returnsNothingAdd`))),_.worker=n}else if(h===`user`&&p)v.text=Y(`app.scenarios.step.personCompletes`,{label:y,with:Object.keys(b??{}).length>0?Y(`app.scenarios.step.with`,{values:listOf$2(rowsOf$1(b))}):``}),canAnswer(r,p)&&(v.values=slotOf(`returns`,Y(`app.scenarios.slot.theyCompleteWith`),b,Y(`app.scenarios.slot.completesWithNothing`))),(p.form||p.formKey)&&(_.form=p.form??p.formKey);else if(h===`decision`&&p){let t=p.decision?e.tables.get(p.decision):void 0;if(t){let e=Ar(t,s);v.decision={why:e.why,rules:e.rules},v.text=e.why,e.unreadInputs.length>0?g.push({kind:`unreadable`,text:e.why}):e.rules.length===0&&g.push({kind:e.missing.length>0?`unresolved`:`mismatch`,text:e.why}),e.problems.forEach(e=>g.push({kind:`mismatch`,text:e})),Object.assign(s,Fr(t,e,p.resultVariable)),_.decision={id:t.decisionId,name:t.name,file:t.file}}else v.text=Y(`app.scenarios.step.evaluatesTheDecision`,{decision:p.decision?Y(`app.scenarios.quoted`,{name:p.decision}):y}),p.decision&&(_.decision={id:p.decision,name:p.decision})}else if(h===`call`&&p)v.text=Y(`app.scenarios.step.callsTheProcess`,{process:p.calledProcess?Y(`app.scenarios.quoted`,{name:p.calledProcess}):y}),p.calledProcess&&(_.called=p.calledProcess);else if(h===`message`&&p){let e=p.correlationKey?Y(`app.scenarios.step.correlationKey`,{key:p.correlationKey.replace(/^=/,``)}):``;v.text=p.host?Y(`app.scenarios.step.messageCaught`,{message:p.message??m,label:y,key:e}):Y(`app.scenarios.step.messageArrives`,{message:p.message??m,key:e}),canAnswer(r,p)&&(v.values=slotOf(`returns`,Y(`app.scenarios.slot.messageCarries`),b,Y(`app.scenarios.slot.carriesNothing`)))}else h===`signal`&&p?(v.text=Y(`app.scenarios.step.signalIsBroadcast`,{signal:p.signal??m,caught:p.host?Y(`app.scenarios.step.labelCatchesIt`,{label:y}):``}),canAnswer(r,p)&&(v.values=slotOf(`returns`,Y(`app.scenarios.slot.signalCarries`),b,Y(`app.scenarios.slot.carriesNothing`)))):v.text=h===`timer`&&p?Y(`app.scenarios.step.timerFires`,{label:y,when:p.timer?` (${p.timer})`:``}):h===`error`&&p?Y(`app.scenarios.step.taskFailsWithError`,{code:p.errorCode??Y(`app.scenarios.step.code`),label:y}):h===`end`?v.depth>0?Y(`app.scenarios.step.subProcessEndsAt`,{label:y}):Y(`app.scenarios.step.processEndsAt`,{label:y}):Y(`app.scenarios.step.runs`,{label:y});h===`end`&&d===u&&(v.values=slotOf(`expected`,Y(`app.scenarios.slot.expectedAtTheEnd`),expectedOf(r),Y(`app.scenarios.slot.nothingChecked`))),p?.host&&!firesBoundary(r,p,i.steps.get(p.host))&&(h===`timer`||h===`message`||h===`signal`||h===`error`)&&g.push({kind:`stuck`,text:Y(`app.scenarios.issue.nothingMakesTheEventHappen`)});let x=t.firedIds.some(e=>i.steps.get(e)?.host===n);p&&!p.host&&!x&&!canAnswer(r,p)&&((h===`worker`||h===`user`||h===`message`||h===`signal`)&&g.push({kind:`stuck`,text:Y(`app.scenarios.issue.nothingCompletesTheStep`)}),h===`timer`&&g.push({kind:`stuck`,text:Y(`app.scenarios.issue.timerNeverFires`)})),p&&Object.assign(s,b??{}),v.scope={...s},o.push(v)}),o}var wc=10;function at$2(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}e(at$2,`at`);function departuresOf(e){let t=[],n=0;for(let{step:r,index:i}of e){if(r.state!==`COMPLETED`)continue;let e=at$2(r.endedAt);e===null?n+=1:t.push({left:e,index:i})}return t.sort((e,t)=>e.left-t.left||e.index-t.index),{lefts:t.map(e=>e.left),indexes:t.map(e=>e.index),unknown:n}}function gapFrom(e,t){let n=at$2(t.startedAt);if(n===null)return e.lefts.length+e.unknown>0?{gap:null,from:null}:null;let r=0,i=e.lefts.length;for(;r<i;){let t=r+i>>1;e.lefts[t]<=n+wc?r=t+1:i=t}return r>0?{gap:n-e.lefts[r-1],from:e.indexes[r-1]}:e.unknown>0?{gap:null,from:null}:null}function handedOver(e){if(e.length===0)return[];if(e.every(e=>e.flow.joins))return e;if(e.length===1)return[e[0]];if(e.some(e=>e.gap===null))return[];let t=[...e].sort((e,t)=>e.gap-t.gap);return t[1].gap-t[0].gap>wc?[t[0]]:[]}function answeredAny(e,t){let n=departuresOf(e),r=departuresOf(t);return n.lefts.length+n.unknown===0||r.lefts.length+r.unknown===0?!1:n.unknown>0||r.unknown>0||r.lefts[r.lefts.length-1]+wc>=n.lefts[0]}function indexed(e){let t=new Map;return e.forEach((e,n)=>{let r=t.get(e.elementId);r?r.push({step:e,index:n}):t.set(e.elementId,[{step:e,index:n}])}),t}function handovers(e,t){let n=indexed(e),r=t.filter(e=>!e.message),i=new Map;for(let e of r){let t=i.get(e.targetId);t?t.push(e):i.set(e.targetId,[e])}let a=new Map,departuresFrom=e=>{let t=a.get(e);return t||(t=departuresOf(n.get(e)??[]),a.set(e,t)),t},o=[];for(let[e,t]of i)for(let{step:r,index:i}of n.get(e)??[]){let e=t.flatMap(e=>{let t=gapFrom(departuresFrom(e.sourceId),r);return t?[{flow:e,gap:t.gap,from:t.from}]:[]});for(let t of handedOver(e))o.push({arrival:i,flow:t.flow,from:t.from})}return o}function takenFlows(e,t){let n=indexed(e),r=new Set;for(let e of t)n.has(e.id)&&r.add(e.id);for(let n of handovers(e,t))r.add(n.flow.id);let i=new Map;for(let e of t.filter(e=>e.message)){let t=`${e.sourceId}\u0000${e.targetId}`,n=i.get(t);n?n.push(e):i.set(t,[e])}for(let e of i.values()){if(e.length!==1)continue;let[t]=e;answeredAny(n.get(t.sourceId)??[],n.get(t.targetId)??[])&&r.add(t.id)}return t.filter(e=>r.has(e.id)).map(e=>e.id)}function isGatewayStep(e){return/gateway/i.test(e.elementType)}function finalValues(e){let t=new Map,n=[...e.steps].sort((e,t)=>Date.parse(e.endedAt??e.startedAt)-Date.parse(t.endedAt??t.startedAt));for(let e of n)for(let n of[...e.out,...e.changed])t.set(n.name,{value:n.value,elementId:e.elementId});return t}function comparePlan(e,t,n,r){if(!r)return null;let i=[],add=(e,t,n)=>{i.some(r=>r.kind===e&&r.elementId===t&&r.text===n)||i.push({kind:e,elementId:t,text:n})},a=new Set(r.steps.map(e=>e.elementId)),o=new Set(takenFlows(r.steps.map(e=>({elementId:e.elementId,state:e.state,startedAt:e.startedAt,endedAt:e.endedAt})),[...e.index.flows.values()].map(t=>({id:t.id,sourceId:t.source,targetId:t.target,message:!1,joins:/^bpmn:(Parallel|Inclusive)Gateway$/.test(e.index.nodes.get(t.target)?.type??``)})))),s=new Set(t.firedIds),c=r.steps.some(isGatewayStep);for(let t of s){let n=e.index.nodes.get(t);a.has(t)||n&&/Gateway$/.test(n.type)&&!c||add(`unreached`,t,Y(`app.scenarios.difference.plannedButNotRun`))}for(let t of a){let n=e.index.nodes.get(t);s.has(t)||!n||/Gateway$/.test(n.type)||add(`unexpected`,t,Y(`app.scenarios.difference.ranButNotPlanned`))}for(let e of n){if(e.kind!==`gateway`||!e.branches)continue;let t=e.branches.filter(e=>e.planned);if(t.length===0)continue;let n=e.branches.filter(e=>o.has(e.flowId));n.length!==0&&(n.length===t.length&&n.every(e=>e.planned)||add(`branch`,e.elementId,Y(`app.scenarios.difference.branch`,{expected:t.map(e=>Y(`app.scenarios.quoted`,{name:e.name})).join(Y(`app.scenarios.listSeparator.two`)),took:n.map(e=>Y(`app.scenarios.quoted`,{name:e.name})).join(Y(`app.scenarios.listSeparator.two`))})))}let l=finalValues(r),u=new Set;for(let e of n)if(e.values?.role===`returns`)for(let t of e.values.rows){let n=r.steps.find(t=>t.elementId===e.elementId)?.out.find(e=>e.name===t.name);n&&!Zn(n.value,t.value)&&(add(`value`,e.elementId,Y(`app.scenarios.difference.value`,{name:t.name,expected:Vr(t.value),got:Vr(n.value)})),u.add(t.name))}let d=n[n.length-1];for(let e of d?.values?.role===`expected`?d.values.rows:[]){let t=l.get(e.name);if(t&&Zn(t.value,e.value))continue;let n=Y(`app.scenarios.difference.value`,{name:e.name,expected:Vr(e.value),got:t?Vr(t.value):Y(`app.scenarios.difference.notSet`)});add(`value`,t&&s.has(t.elementId)?t.elementId:d.elementId,n),t&&t.elementId!==d.elementId&&s.has(t.elementId)&&add(`value`,d.elementId,n)}for(let e of r.incidents)add(`incident`,e.elementId,e.message);let f=new Map;for(let e of i)f.set(e.elementId,[...f.get(e.elementId)??[],e]);let p=d?.values?.role===`expected`&&d.values.rows.length>0;return{matches:i.length===0,against:Y(p?`app.scenarios.difference.againstStepsAndVariables`:`app.scenarios.difference.againstSteps`),differences:i,byElement:f}}function withUniqueName(e,t){let n=uniqueName(e.planned.name,t);return n===e.planned.name?e:{planned:{...e.planned,name:n,testCase:{...e.planned.testCase,name:n}}}}function uniqueName(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e} (${n})`);)n+=1;return`${e} (${n})`}var Tc={elementIds:[],flowIds:[],numbers:new Map,order:[]};function itemOf(e,t,n,r,i,a){let o=applyEdits(t.testCase,r,e.index.steps),s=describeSteps(e,t.scenario,o),c=s.filter(e=>e.issues.length>0).length+ +!t.complete;return{id:n,origin:t.origin,name:o.name,ticked:i&&!a,inFile:a,edited:isEdited(r),planned:t,unplannable:null,baseCase:t.testCase,testCase:o,steps:s,path:scenarioPath(t.scenario),problems:c,notes:t.notes}}function unplannable(e,t,n,r,i){return{id:t,origin:r,name:e.name,ticked:!1,inFile:i,edited:!1,planned:null,unplannable:n,baseCase:e,testCase:e,steps:[],path:Tc,problems:1,notes:[n]}}function fileIds(e){let t=new Map;return e.map(e=>{let n=(t.get(e.name)??0)+1;return t.set(e.name,n),n===1?`file:${e.name}`:`file:${e.name}#${n}`})}function reviewOf(e,t){let n=new Set(t.unticked),r=t.existing.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).map(soundCase);if(t.mode===`file`){let i=fileIds(r);return{items:r.map((r,a)=>{let o=resolveCase(e,r,`file`);return`planned`in o?itemOf(e,o.planned,i[a],t.edits[i[a]],!n.has(i[a]),!1):unplannable(r,i[a],o.problem,`file`,!1)}),capped:!1}}let i=new Map(r.map(e=>[e.name,e])),a=generatedSet(e),o=a.planned.map(r=>{let a=t.edits[r.key],o=a?.name||r.name,s=i.get(o);if(!s)return itemOf(e,r,r.key,a,!n.has(r.key),!1);let c=resolveCase(e,s,`file`);return`planned`in c?itemOf(e,c.planned,r.key,void 0,!1,!0):unplannable(s,r.key,c.problem,`generated`,!0)});for(let e of a.unplannable){let t=scenarioKey(e.scenario);o.push(unplannable({name:_r(e.scenario),instructions:[]},t,e.problem,`generated`,!1))}let s=new Set([...i.keys(),...o.map(e=>e.name)]);for(let r of t.added){let i=`added:${r.id}`,a=resolveValues(e,r.name,r.values,{process:r.process,startId:r.startId}),c=`planned`in a?withUniqueName(a,s):a;`planned`in c?(s.add(c.planned.name),o.push(itemOf(e,c.planned,i,t.edits[i],!n.has(i)&&c.planned.complete,!1))):o.push(unplannable({name:r.name||Y(`app.scenarios.addedScenario`),instructions:[]},i,c.problem,`added`,!1))}return{items:o,capped:a.capped}}function toWrite(e){return e.filter(e=>e.ticked&&!e.inFile&&!e.unplannable).map(e=>e.testCase)}function reviewCoverage(e,t){return scenarioCoverage(e,t.filter(e=>(e.ticked||e.inFile)&&!e.unplannable).map(e=>e.path))}function conditionStyleOf(e,t){for(let t of e.flows.values()){let e=t.condition?.trim()??``;if(e.startsWith(`=`))return`feel`;if(/^[$#]\{/.test(e))return`juel`}return t}function writeCondition(e,t){let n=e.trim();if(n!==``)return t===`feel`?n.startsWith(`=`)?n:`=${n}`:/^[$#]\{[\s\S]*\}$/.test(n)?n:`\${${n}}`}function conditionVariables(e){let t=new Set,n=new Set([...e.steps.values()].flatMap(e=>e.resultVariable?[e.resultVariable]:[]));for(let r of e.flows.values())if(r.condition)for(let e of evaluateCondition(r.condition,{}).missing)n.has(e)||t.add(e);return[...t]}function sameCondition(e,t){return conditionText(e)===conditionText(t)}function conditionEditProblem(e,t,n,r){if(n.trim()!==``||r!==`feel`)return null;let i=e.flows.get(t),a=i?e.nodes.get(i.source):void 0;return!i||a?.type!==`bpmn:ExclusiveGateway`||a.defaultFlow===t?null:Y(`app.scenarios.gatewayNeedsCondition`)}var Ec=300;function apart(e,t){let n=e.split(`/`),r=t.split(`/`),i=0;for(;i<n.length-1&&i<r.length-1&&n[i]===r[i];)i+=1;return[n.slice(i).join(`/`),r.slice(i).join(`/`)]}async function parse(e,t){let n=await t(e).catch(()=>null);if(!n)return{tables:[],form:null};if(/\.dmn$/i.test(e))return{tables:await Cr(n,e),form:null};try{let e=JSON.parse(n).id;return{tables:[],form:typeof e==`string`?e:null}}catch{return{tables:[],form:null}}}async function collectTargets(e,t,n=new Map){let r=e.filter(e=>/\.(dmn|form)$/i.test(e.path)).sort((e,t)=>e.path.localeCompare(t.path)).slice(0,Ec),i=await Promise.all(r.map(async e=>{let r=`${e.path}#${e.stamp}`,i=n.get(r);if(i)return i;let a=await parse(e.path,t);return n.set(r,a),a})),a={tables:new Map,forms:new Map,duplicates:[]};return i.forEach((e,t)=>{for(let n of e.tables){let e=a.tables.get(n.decisionId);if(e){let[i,o]=apart(e.file??``,r[t].path);a.duplicates.push(Y(`app.scenarios.duplicateDecision`,{id:n.decisionId,used:i,other:o}))}else a.tables.set(n.decisionId,n)}e.form&&!a.forms.has(e.form)&&a.forms.set(e.form,r[t].path)}),a}function needsPan(e,t,n){let r=e.width*(1-n)/2,i=e.height*(1-n)/2,a=t.x>=e.x+r&&t.y>=e.y+i&&t.x+t.width<=e.x+e.width-r&&t.y+t.height<=e.y+e.height-i;return n>=1?t.x>=e.x+e.width||t.y>=e.y+e.height||t.x+t.width<=e.x||t.y+t.height<=e.y:!a}function panTarget(e,t,n){let r=e.width-n.left-n.right,i=t.x+t.width/2,a=t.y+t.height/2;return{x:i-n.left-r/2,y:a-e.height/2,width:e.width,height:e.height}}function stepsFor(e,t){return e.flatMap((e,n)=>e.elementId===t?[n]:[])}function barText(e,t){return e<0?Y(`app.scenarios.barText.steps`,{count:t}):Y(`app.scenarios.barText.stepOf`,{at:e+1,total:t})}function moveStep(e,t,n){return t===0?-1:e<0?0:Math.min(t-1,Math.max(0,e+n))}function parseJson(e){try{return JSON.parse(e)}catch{return null}}function reasonOf(e){if(e.status===0)return e.body||Y(`app.live.unableToConnect`);let t=parseJson(e.body);if(t&&typeof t==`object`){let e=[t.message,t.detail,t.title].find(e=>typeof e==`string`);if(typeof e==`string`)return e}return e.body?e.body.slice(0,300):Y(`app.live.unableToCompleteTask`,{status:e.status})}function listUserTasksCall(e,t){if(e===`CAMUNDA_8`){let e={state:`CREATED`};return t&&(e.processInstanceKey=t),{method:`POST`,path:`/user-tasks/search`,body:JSON.stringify({filter:e})}}return{method:`GET`,path:`/task${t?`?processInstanceId=${encodeURIComponent(t)}`:``}`}}function parseUserTasks(e,t){if(t.status<200||t.status>=300)return[];let n=parseJson(t.body);return e===`CAMUNDA_8`?(Array.isArray(n?.items)?n.items:[]).map(e=>({id:String(e?.userTaskKey??e?.key??``),elementId:String(e?.elementId??``),name:typeof e?.name==`string`?e.name:null,processInstanceId:String(e?.processInstanceKey??e?.processInstanceId??``),assignee:typeof e?.assignee==`string`?e.assignee:null,formKey:typeof e?.formKey==`string`?e.formKey:null})).filter(e=>!!e.id):(Array.isArray(n)?n:[]).map(e=>({id:String(e?.id??``),elementId:String(e?.taskDefinitionKey??e?.elementId??``),name:typeof e?.name==`string`?e.name:null,processInstanceId:String(e?.processInstanceId??``),assignee:typeof e?.assignee==`string`?e.assignee:null,formKey:typeof e?.formKey==`string`?e.formKey:null})).filter(e=>!!e.id)}function readUserTaskCall(e,t){return e===`CAMUNDA_8`?{method:`GET`,path:`/user-tasks/${encodeURIComponent(t)}`}:{method:`GET`,path:`/task/${encodeURIComponent(t)}`}}function parseUserTask(e,t){if(t.status<200||t.status>=300)return null;let n=parseJson(t.body);if(!n||typeof n!=`object`)return null;if(e===`CAMUNDA_8`){let e=String(n.userTaskKey??n.key??``);return e?{id:e,elementId:String(n.elementId??``),name:typeof n.name==`string`?n.name:null,processInstanceId:String(n.processInstanceKey??n.processInstanceId??``),assignee:typeof n.assignee==`string`?n.assignee:null,formKey:typeof n.formKey==`string`?n.formKey:null}:null}let r=String(n.id??``);return r?{id:r,elementId:String(n.taskDefinitionKey??n.elementId??``),name:typeof n.name==`string`?n.name:null,processInstanceId:String(n.processInstanceId??``),assignee:typeof n.assignee==`string`?n.assignee:null,formKey:typeof n.formKey==`string`?n.formKey:null}:null}function readTaskDeployedFormCall(e){return{method:`GET`,path:`/task/${encodeURIComponent(e)}/deployed-form`}}function parseDeployedForm(e){if(e.status<200||e.status>=300)return null;let t=parseJson(e.body);return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function readTaskFormKeyCall(e){return{method:`GET`,path:`/task/${encodeURIComponent(e)}/form`}}function parseTaskFormKey(e){if(e.status<200||e.status>=300)return null;let t=parseJson(e.body);return typeof t?.key==`string`?t.key:null}function completeUserTaskCall(e,t,n){return e===`CAMUNDA_8`?{method:`POST`,path:`/user-tasks/${encodeURIComponent(t)}/completion`,body:JSON.stringify({variables:n})}:{method:`POST`,path:`/task/${encodeURIComponent(t)}/complete`,body:JSON.stringify({variables:da(n)})}}function parseTaskCompletion(e){return e.status>=200&&e.status<300?{ok:!0}:{ok:!1,problem:reasonOf(e)}}var Dc=60;function boxGap(e,t){let n=Math.max(0,e.x-(t.x+t.width),t.x-(e.x+e.width)),r=Math.max(0,e.y-(t.y+t.height),t.y-(e.y+e.height));return Math.round(Math.hypot(n,r))}function pathSegments(e){let t=[];for(let n=1;n<e.length;n++)t.push([e[n-1],e[n]]);return t}function segmentsCross(e,t,n,r){let i=e.y===t.y;if(i===(n.y===r.y))return!1;let[a,o,s,c]=i?[e,t,n,r]:[n,r,e,t],l=a.y,u=s.x,d=Math.min(a.x,o.x),f=Math.max(a.x,o.x),p=Math.min(s.y,c.y),m=Math.max(s.y,c.y);return u>d+.5&&u<f-.5&&l>p+.5&&l<m-.5}var Oc=300,kc=2,Ac=40,jc=[`DANGLING-CONNECTION`,`LOST-CONNECTION`,`CONTAINMENT`,`OVERLAP`,`EDGE-THROUGH-NODE`,`EDGE-THROUGH-BOUNDARY`,`CROSSING`,`DETACHED-EDGE`,`BOUNDARY-OFF-HOST`,`LABEL-ADRIFT`,`DIAGONAL-EDGE`,`LABEL-OVERLAP`,`MERGED-EDGE`,`NOTE-ADRIFT`,`SEMANTIC-DRIFT`,`BACKTRACK`,`EDGE-THROUGH-LABEL`,`EDGE-ALONG-SHAPE`,`DETOUR`,`JOG`];function countsOf$2(e){return Object.fromEntries(jc.map(t=>[t,e.filter(e=>e.kind===t).length]))}e(countsOf$2,`countsOf`);function wiringOf(e){return`${e.source?.id??``}>${e.target?.id??``}`}function measureElements(e,t,n={}){let{before:r,modelDefects:i,log:a,settled:o}=n,bothSettled=(e,t)=>!!o&&o.has(e.id)&&o.has(t.id);function*pairsOf(e){let t=o?e.map((e,t)=>o.has(e.id)?-1:t).filter(e=>e>=0):[];for(let n=0;n<e.length;n++)if(o&&o.has(e[n].id))for(let r of t)r>n&&(yield[e[n],e[r]]);else for(let t=n+1;t<e.length;t++)yield[e[n],e[t]]}let s=[],note=e=>a?.(e),record=(e,t,n)=>{s.push({kind:e,detail:t,elements:n}),note(`${e}: ${t}`)},c=Xi(t),l=t.filter(e=>!c.includes(e)),u=e.filter(e=>!ra(e)&&!Yi(e)&&!Zi(e)&&e.type!==`bpmn:Lane`),d=e.filter(Zi);r&&[...e.map(e=>[e,`parent:${e.parent?.id??``}`]),...t.map(e=>[e,`wire:${wiringOf(e)}`])].forEach(([e,t])=>{let n=r.get(e.id);n!==void 0&&n!==t&&record(`SEMANTIC-DRIFT`,Y(`app.rules.defects.semanticDrift`,{id:e.id,was:n,now:t}),[e.id])});let f=1/0,p=1/0,m=-1/0,h=-1/0;u.forEach(e=>{f=Math.min(f,e.x),p=Math.min(p,e.y),m=Math.max(m,e.x+e.width),h=Math.max(h,e.y+e.height)});let g=u.length===0?{width:0,height:0}:{width:Math.round(m-f),height:Math.round(h-p)};note(`bounding box: ${g.width} x ${g.height}`);let chainOf=e=>{let t=new Set,n=e?.parent;for(;n;)t.add(n.id),n=n.parent;return t};i&&s.push(...i);let _=0,v=[...u,...d];for(let[e,t]of pairsOf(v)){if(e.host?.id===t.id||t.host?.id===e.id||chainOf(e).has(t.id)||chainOf(t).has(e.id)||e.type===`bpmn:Group`||t.type===`bpmn:Group`)continue;let n=new Set([`bpmn:TextAnnotation`,`bpmn:Group`]),r=new Set([`bpmn:Participant`,`bpmn:Lane`,`bpmn:SubProcess`]);if(n.has(e.type??``)&&r.has(t.type??``)||n.has(t.type??``)&&r.has(e.type??``))continue;let i=e.type===`bpmn:Participant`&&t.type===`bpmn:Participant`,a=new Set([`bpmn:TextAnnotation`,`bpmn:DataObjectReference`,`bpmn:DataStoreReference`]),o=a.has(e.type??``)||a.has(t.type??``);(i||o||e.parent===t.parent||e.type===`bpmn:Participant`||t.type===`bpmn:Participant`)&&na(e,t)&&(record(`OVERLAP`,Y(`app.rules.defects.overlap`,{a:e.id,b:t.id}),[e.id,t.id]),_++)}note(_===0?`no overlaps`:`${_} overlap(s) found`);let ancestorIds=e=>{let t=new Set,n=e?.parent;for(;n;)t.add(n.id),n=n.parent;return t},y=new Set([`bpmn:TextAnnotation`,`bpmn:Group`]),covers=(e,t)=>!!e&&y.has(e.type??``)&&e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height,b=0;l.forEach(e=>{if(!e.waypoints||e.waypoints.length<2)return;let t=pathSegments(e.waypoints),n=ancestorIds(e.source),r=ancestorIds(e.target);u.forEach(i=>{i.id!==e.source?.id&&i.id!==e.target?.id&&(bothSettled(e,i)||n.has(i.id)||r.has(i.id)||y.has(i.type??``)||covers(e.source,i)||covers(e.target,i)||t.forEach(([t,n])=>{ta(t,n,i,2)&&(record(`EDGE-THROUGH-NODE`,Y(`app.rules.defects.edgeThroughNode`,{connection:e.id,shape:i.id}),[e.id,i.id]),b++)}))})}),note(b===0?`no edges cut through nodes`:`${b} violation(s) found`);let x=0;l.forEach(e=>{if(!e.waypoints||e.waypoints.length<2)return;let t=pathSegments(e.waypoints);d.forEach(n=>{n.id!==e.source?.id&&n.id!==e.target?.id&&t.some(([e,t])=>ta(e,t,n,2))&&(record(`EDGE-THROUGH-BOUNDARY`,Y(`app.rules.defects.edgeThroughBoundary`,{connection:e.id,event:n.id,host:n.host?.id}),[e.id,n.id]),x++)})}),note(x===0?`no edges through boundary events`:`${x} edge(s) through a boundary event`);let S=0;for(let[e,t]of pairsOf(l)){let n=pathSegments(e.waypoints||[]),r=pathSegments(t.waypoints||[]),i=!1;n.forEach(([n,a])=>{r.forEach(([r,o])=>{!i&&segmentsCross(n,a,r,o)&&(i=!0,record(`CROSSING`,Y(`app.rules.defects.crossing`,{aType:e.type,bType:t.type,a:e.id,aFrom:e.source?.id,aTo:e.target?.id,b:t.id,bFrom:t.source?.id,bTo:t.target?.id}),[e.id,t.id]),S++)})})}note(S===0?`no crossings`:`${S} crossing(s) found`);let C=0;for(let[e,t]of pairsOf(l)){let n=la(e.waypoints||[],t.waypoints||[]),r=n.across+n.down;r<40||(record(`MERGED-EDGE`,Y(`app.rules.defects.mergedEdge`,{aType:e.type,bType:t.type,axis:n.across>=n.down?`across`:`down`,a:e.id,aFrom:e.source?.id,aTo:e.target?.id,b:t.id,bFrom:t.source?.id,bTo:t.target?.id,run:Math.round(r)}),[e.id,t.id]),C++)}note(C===0?`no merged edges`:`${C} merged edge pair(s) found`);let w=u.filter(e=>(e.children??[]).filter(e=>!ra(e)).length===0),segmentClear=(e,t,n)=>!w.some(r=>r.id!==n.source?.id&&r.id!==n.target?.id&&ta(e,t,r,2)),T=0;l.forEach(e=>{if(e.type!==`bpmn:Association`&&e.type!==`bpmn:DataInputAssociation`&&e.type!==`bpmn:DataOutputAssociation`)return;let t=e.waypoints??[];if(t.length<2)return;let n=ia(t);n<=Oc||(record(`NOTE-ADRIFT`,Y(`app.rules.defects.noteAdrift`,{id:e.id,from:e.source?.id,to:e.target?.id,span:Math.round(n)}),[e.id]),T++)}),note(T===0?`no notes adrift`:`${T} note(s) adrift`);let E=0;l.forEach(e=>{let t=ua(e.waypoints||[]);for(let n=0;n<t;n++)record(`BACKTRACK`,Y(`app.rules.defects.wire`,{id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),E++}),note(E===0?`no backtracks`:`${E} backtrack(s) found`);let D=0,O=e.filter(e=>e.label&&e.label.width>0&&e.label.height>0).map(e=>({owner:e,rect:e.label}));l.forEach(e=>{let t=pathSegments(e.waypoints||[]);O.forEach(({owner:n,rect:r})=>{n.id!==e.id&&t.some(([e,t])=>ta(e,t,r,1))&&(record(`EDGE-THROUGH-LABEL`,Y(`app.rules.defects.edgeOverLabel`,{connection:e.id,owner:n.id}),[e.id,n.id]),D+=1)})}),note(D===0?`no edges over labels`:`${D} edge(s) over a label`);let k=0,A=o?u.filter(e=>!o.has(e.id)):[];l.forEach(e=>{let t=e.waypoints||[],n=new Set([e.source?.id,e.target?.id,...ancestorIds(e.source),...ancestorIds(e.target)]),r=!!o&&o.has(e.id),grazing=(e,t)=>!n.has(e.id)&&!y.has(e.type??``)&&aa(t,e);for(let n=0;n+1<t.length;n++){let i=oa(t[n],t[n+1]);if(!i||r&&!A.some(e=>grazing(e,i)))continue;let a=u.find(e=>grazing(e,i));a&&!(r&&o.has(a.id))&&(record(`EDGE-ALONG-SHAPE`,Y(`app.rules.defects.edgeAlongShape`,{connection:e.id,shape:a.id}),[e.id,a.id]),k+=1)}}),note(k===0?`no edges along a shape border`:`${k} edge(s) along a shape border`);let j=0;l.forEach(e=>{let t=e.waypoints??[];if(t.length<2||!e.source||!e.target||e.type!==`bpmn:MessageFlow`&&e.type!==`bpmn:SequenceFlow`)return;let n=ia(t),r=Math.abs(e.source.x+e.source.width/2-(e.target.x+e.target.width/2))+Math.abs(e.source.y+e.source.height/2-(e.target.y+e.target.height/2));r<Ac||n<=r*kc||(record(`DETOUR`,Y(`app.rules.defects.detour`,{type:e.type,id:e.id,run:Math.round(n),apart:Math.round(r)}),[e.id]),j++)}),note(j===0?`no detours`:`${j} detour(s) found`);let M=0;l.forEach(e=>{let seatOk=(t,n)=>{let r=n===0?e.source:e.target;return!r||ca(t,r,2)},t=Qi(e.waypoints||[],(t,n)=>segmentClear(t,n,e),40,seatOk);for(let n=0;n<t;n++)record(`JOG`,Y(`app.rules.defects.typedWire`,{type:e.type,id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),M++}),note(M===0?`no jogs`:`${M} jog(s) found`);let onShape=(e,t)=>{if(!t)return!0;let n=t.waypoints;if(n&&n.length>=2){for(let t=0;t+1<n.length;t++){let r=sa(e,n[t],n[t+1]);if(Math.abs(r.x-e.x)<=2&&Math.abs(r.y-e.y)<=2)return!0}return!1}return ca(e,t,2)},N=0,P=0;l.forEach(e=>{let t=e.waypoints;if(!(!t||t.length<2)){onShape(t[0],e.source)&&onShape(t[t.length-1],e.target)||(record(`DETACHED-EDGE`,Y(`app.rules.defects.wire`,{id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),N++);for(let n=0;n+1<t.length;n++)if(Math.abs(t[n].x-t[n+1].x)>.5&&Math.abs(t[n].y-t[n+1].y)>.5){record(`DIAGONAL-EDGE`,Y(`app.rules.defects.wire`,{id:e.id,from:e.source?.id,to:e.target?.id}),[e.id]),P++;break}}}),note(N===0?`no detached edges`:`${N} detached edge(s) found`),note(P===0?`no diagonal edges`:`${P} diagonal edge(s) found`);let F=0,I=v.filter(e=>e.type===`bpmn:Participant`||e.type===`bpmn:SubProcess`||e.type===`bpmn:Lane`);v.forEach(e=>{if(e.type===`bpmn:Participant`||e.type===`bpmn:Lane`)return;let t=chainOf(e);I.forEach(n=>{if(n.id===e.id||e.host?.id===n.id||chainOf(n).has(e.id))return;let r=ea(n,e),i=$i(e,n);if(e.type===`bpmn:Group`)return;let a=e.type===`bpmn:TextAnnotation`;(a?!r&&!i:t.has(n.id)?!r:!i)&&(record(`CONTAINMENT`,Y(`app.rules.defects.containment`,{id:e.id,relation:a?Y(`app.rules.defects.straddles`):t.has(n.id)?Y(`app.rules.defects.outsideIts`):Y(`app.rules.defects.insideForeign`),box:n.id}),[e.id,n.id]),F++)})}),note(F===0?`containment ok`:`${F} containment break(s)`),v.filter(Zi).forEach(e=>{let t=e.host;if(!t)return;let n=e.x+e.width/2,r=e.y+e.height/2,i=Math.abs(n-t.x)<=2||Math.abs(n-(t.x+t.width))<=2,a=Math.abs(r-t.y)<=2||Math.abs(r-(t.y+t.height))<=2,o=n>=t.x-2&&n<=t.x+t.width+2,s=r>=t.y-2&&r<=t.y+t.height+2;i&&s||a&&o||record(`BOUNDARY-OFF-HOST`,Y(`app.rules.defects.boundaryOffHost`,{event:e.id,host:t.id}),[e.id,t.id])}),v.filter(e=>e.label).forEach(e=>{let t=e.label;t.x+t.width>=e.x-Dc&&t.x<=e.x+e.width+Dc&&t.y+t.height>=e.y-Dc&&t.y<=e.y+e.height+Dc||record(`LABEL-ADRIFT`,Y(`app.rules.defects.labelFromShape`,{id:e.id,gap:boxGap(e,t)}),[e.id])}),l.filter(e=>e.label).forEach(e=>{let t=e.label,n=e.waypoints??[];if(n.length<2)return;let r=t.x+t.width/2,i=t.y+t.height/2,a=1/0;for(let e=0;e+1<n.length;e++){let t=sa({x:r,y:i},n[e],n[e+1]);a=Math.min(a,Math.abs(r-t.x)+Math.abs(i-t.y))}a>Dc&&record(`LABEL-ADRIFT`,Y(`app.rules.defects.labelFromLine`,{id:e.id,gap:Math.round(a)}),[e.id])});let L=[...v,...l].filter(e=>e.label&&e.type!==`bpmn:Group`).map(e=>({owner:e,rect:e.label})),R=0;L.forEach(({owner:e,rect:t},n)=>{v.forEach(n=>{let r=ancestorIds(e).has(n.id)||ancestorIds(e.source).has(n.id)||ancestorIds(e.target).has(n.id),i=e.type===`bpmn:TextAnnotation`||e.type===`bpmn:Group`,a=[`bpmn:Participant`,`bpmn:Lane`,`bpmn:SubProcess`].includes(n.type??``);n.id===e.id||r||n.type===`bpmn:Group`||i&&a||na(t,n)&&(record(`LABEL-OVERLAP`,Y(`app.rules.defects.labelOverShape`,{owner:e.id,shape:n.id}),[e.id,n.id]),R++)}),L.slice(n+1).forEach(n=>{bothSettled(e,n.owner)||na(t,n.rect)&&(record(`LABEL-OVERLAP`,Y(`app.rules.defects.labelOverLabel`,{owner:e.id,other:n.owner.id}),[e.id,n.owner.id]),R++)})}),note(R===0?`no label overlaps`:`${R} label overlap(s) found`);let z=l.filter(e=>e.type===`bpmn:SequenceFlow`&&(e.waypoints?.length??0)>1);if(z.length>0){let compass=(e,t)=>{let n=(Math.atan2(-(t.y-e.y),t.x-e.x)*180/Math.PI+360)%360,near=e=>Math.min(Math.abs(n-e),360-Math.abs(n-e))<=67.5,r=[`E`,`N`,`W`,`S`].filter((e,t)=>near(t*90));return r.length?r:[`E`]},e=new Map;z.forEach(t=>{let n=t.waypoints;compass(n[0],n[n.length-1]).forEach(t=>e.set(t,(e.get(t)??0)+1))});let t=[...e.entries()].sort((e,t)=>t[1]-e[1])[0][0],n=z.filter(e=>{let n=e.waypoints;return compass(n[0],n[n.length-1]).includes(t)}).length,r=z.reduce((e,t)=>e+ia(t.waypoints),0),i=z.reduce((e,t)=>e+Math.max(0,t.waypoints.length-2),0),a=v.filter(e=>e.width>0&&e.height>0),o=Math.min(...a.map(e=>e.x)),s=Math.min(...a.map(e=>e.y)),c=Math.max(...a.map(e=>e.x+e.width)),l=Math.max(...a.map(e=>e.y+e.height));note(`readability: cons=${(n/z.length).toFixed(2)} span=${Math.round(r/z.length)} bends=${(i/z.length).toFixed(2)} shape=${((c-o)/(l-s)).toFixed(2)}`)}let B=countsOf$2(s),V={edges:0,bends:0,length:0,forward:0,area:g.width*g.height};return l.forEach(e=>{let t=e.waypoints??[];t.length<2||(V.edges+=1,V.bends+=t.length-2,V.length+=ia(t),t[t.length-1].x>=t[0].x&&(V.forward+=1))}),V.length=Math.round(V.length),note(`quality: bends=${(V.bends/Math.max(1,V.edges)).toFixed(2)} length=${Math.round(V.length/Math.max(1,V.edges))} forward=${Math.round(100*V.forward/Math.max(1,V.edges))}%`),{defects:s,counts:B,box:g,quality:V}}var Mc=new Set([`DANGLING-CONNECTION`,`LOST-CONNECTION`,`SEMANTIC-DRIFT`]);function labelOf$1(e,t){let n=(e?.businessObject)?.name?.trim();if(n)return n;let r=e?.type?.replace(`bpmn:`,``);return r?Y(`app.rules.drawing.theElement`,{type:qi(r)}):t}e(labelOf$1,`labelOf`);function nameOf$9(e,t){let n=e.get(t),r=(n?.businessObject)?.name?.trim();if(r)return r;if(n&&ra(n)){let e=labelOf$1(n.source,n.source?.id??``),t=labelOf$1(n.target,n.target?.id??``);return Y(`app.rules.drawing.theConnection`,{from:e,to:t})}return labelOf$1(n,t)}e(nameOf$9,`nameOf`);function checkDiagram(e){let t={defects:[],errors:0,readability:0,checkedElements:0};if(!e)return t;let n,r,i,a;try{if(n=e.get(`elementRegistry`),!n)return t;let o=n.getAll();if(r=o.filter(e=>!ra(e)&&!Yi(e)&&!!e.parent),i=o.filter(ra),!r.length&&!i.length)return t;a=measureElements(r,i)}catch{return t}let o=n,s=a.defects.filter(e=>!Mc.has(e.kind)).map(e=>({kind:e.kind,severity:Hi(`drawing`,e.kind)?.severity===`error`?`error`:`readability`,title:Ki(`drawing`,e.kind),detail:e.detail,where:pi(e.elements.map(e=>nameOf$9(o,e))),elements:e.elements}));return{defects:s,errors:s.filter(e=>e.severity===`error`).length,readability:s.filter(e=>e.severity===`readability`).length,checkedElements:r.length+i.length}}var Nc=`diagram-check-flag`,Pc=`diagram-check-hit`,Fc=`diagram-check-peek`;function withCanvas(e){if(!e)return null;try{let t=e.get(`canvas`),n=e.get(`elementRegistry`);return!t||!n?null:{canvas:t,registry:n}}catch{return null}}function shapeFor(e,t){return e.get(t)||e.getAll().find(e=>{let n=e.businessObject?.processRef;return e.type===`bpmn:Participant`&&n?.id===t})}function markElements(e,t,n){let r=withCanvas(e);r&&t.forEach(e=>{let t=shapeFor(r.registry,e);t&&r.canvas.addMarker(t,n)})}function clearMarker(e,t){let n=withCanvas(e);n&&n.registry.getAll().forEach(e=>n.canvas.removeMarker(e,t))}function focusDefect(e,t){let n=withCanvas(e);if(!n||!t.length)return;let r=t.map(e=>shapeFor(n.registry,e)).filter(e=>!!e);if(r.length){clearMarker(e,Pc),markElements(e,t,Pc);try{n.canvas.scrollToElement(r[0],{top:140,right:440,bottom:400,left:140}),(e?.get(`selection`))?.select(r)}catch{return}}}function revealElement(e,t){let n=e.get(`elementRegistry`),r=e.get(`canvas`),i=shapeFor(n,t);if(!i)return!1;let a=r.findRoot(i);return a&&a!==r.getRootElement()&&r.setRootElement(a),e.get(`selection`).select(i),r.scrollToElement(i,{top:120,bottom:120,left:120,right:120}),!0}var Ic=null;function codeLinksReloaded(){let e=Ic;Ic=null,e&&e()}async function explainedCodeLinks(e){let t=G(),n=await t.getLicense().catch(()=>null);return!D(n)&&(await t.requestFeature(U.CODE_LINKS)&&(Ic=e),!0)}function useTheme(){let[e,t]=n(H);return f(()=>{S(e)},[e]),{theme:e,setTheme:r(e=>{t(e)},[]),toggleDark:r(()=>{let e=p();t(e)},[]),isDark:b[e].isDark,availableThemes:b}}var Lc=a(void 0);function ThemeProvider({children:e}){let t=useTheme();return u(Lc.Provider,{value:t,children:e})}var Rc={"label-required":[`name`],"compat/implementation":[`taskDefinitionType`,`scriptExpression`,`decisionId`],"compat/sequence-flow-condition":[`conditionExpression`,`conditionType`],"compat/user-task-definition":[`formType`],"compat/zeebe-user-task":[`userTaskImplementation`],"compat/user-task-form":[`formType`,`formId`,`customFormKey`],"compat/start-event-form":[`formId`,`customFormKey`],"compat/called-element":[`targetProcessId`],"compat/subscription":[`messageSubscriptionCorrelationKey`],"compat/history-time-to-live":[`historyTimeToLive`],"compat/message-reference":[`messageRef`,`messageName`],"compat/signal-reference":[`signalRef`,`signalName`],"compat/error-reference":[`errorRef`,`errorCode`],"compat/escalation-reference":[`escalationRef`,`escalationCode`],"compat/timer":[`timerEventDefinitionValue`,`timerEventDefinitionType`],"conditional-flows":[`conditionExpression`],"missing-implementation":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`,`expression`],"never-thrown":[`errorRef`,`errorCode`],"worker-fetch":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"writer-unread":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"lost-update":[`loopCondition`,`loopMaximum`,`loopTestBefore`],"late-read":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"near-name":[`taskDefinitionType`,`externalTopic`,`javaClass`,`delegateExpression`],"mapping-order":[`inputMapping`,`outputMapping`],"implicit-job-type":[`taskDefinitionType`],"variable-field":[`inputMapping`,`outputMapping`,`conditionExpression`],"variable-unknown":[`inputMapping`,`outputMapping`,`conditionExpression`]};function entriesFor(e){return Rc[e]??[]}var zc=`.bio-properties-panel-input, textarea, select, [contenteditable="true"], button:not(.bio-properties-panel-feel-icon)`;function focusEntry(e,t){for(let n of t){let t=e.querySelector(`[data-entry-id="${n}"]`);if(!t)continue;let r=t.closest(`.bio-properties-panel-group`),i=!!r&&!r.querySelector(`.bio-properties-panel-group-entries.open`);i&&r.querySelector(`.bio-properties-panel-group-header`)?.click(),t.scrollIntoView?.({block:`center`});let focus=()=>t.querySelector(zc)?.focus();return i&&r?focusWhenShown(r,focus,Bc):focus(),!0}return!1}var Bc=30;function focusWhenShown(e,t,n){requestAnimationFrame(()=>{n<=0||e.querySelector(`.bio-properties-panel-group-entries.open`)?t():focusWhenShown(e,t,n-1)})}var Vc=[`input`,`keyup`,`mouseup`,`select`];function plainInput(e,t){let n=e.parentElement,r=document.createElement(`span`),i=document.createElement(`span`),a=document.createElement(`span`);r.className=e.tagName===`TEXTAREA`?`suggestion-ghost suggestion-ghost--block type-input`:`suggestion-ghost suggestion-ghost--line type-input`,r.setAttribute(`aria-hidden`,`true`),i.className=`suggestion-ghost__typed`,a.className=`suggestion-ghost__rest`,r.append(i,a),r.hidden=!0,e.after(r),n?.classList.add(`suggestion-host`);let place=()=>{let t=getComputedStyle(e);r.style.top=`${e.offsetTop}px`,r.style.left=`${e.offsetLeft}px`,r.style.width=`${e.offsetWidth}px`,r.style.height=`${e.offsetHeight}px`,r.style.padding=t.padding,r.style.borderWidth=t.borderWidth,r.style.borderStyle=`solid`,r.style.borderColor=`transparent`,r.style.boxSizing=`border-box`,r.style.whiteSpace=e.tagName===`TEXTAREA`?`pre-wrap`:`pre`},caretAtEnd=()=>{let t=e.value.length;return(e.selectionStart??t)===t&&(e.selectionEnd??t)===t};for(let n of Vc)e.addEventListener(n,t);return{anchor:e,text:()=>e.value,caretAtEnd,busy:()=>!1,append(t){e.value=`${e.value}${t}`,e.dispatchEvent(new Event(`input`,{bubbles:!0}))},showGhost(t){r.hidden&&place(),i.textContent=e.value,a.textContent=t,r.hidden=!1,r.scrollLeft=e.scrollLeft,r.scrollTop=e.scrollTop},hideGhost(){r.hidden=!0},dispose(){for(let n of Vc)e.removeEventListener(n,t);r.remove(),n?.classList.remove(`suggestion-host`)}}}var Hc=tn.define(),Uc=Zt.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(Hc))return e.value;return e}}),GhostWidget=class extends on{suffix;constructor(e){super(),this.suffix=e}eq(e){return e.suffix===this.suffix}toDOM(){let e=document.createElement(`span`);return e.className=`suggestion-ghost suggestion-ghost--inline`,e.setAttribute(`aria-hidden`,`true`),e.textContent=this.suffix,e}ignoreEvent(){return!0}},Wc=Qt.decorations.compute([Uc],e=>{let t=e.field(Uc);return t===null?$t.none:$t.set($t.widget({widget:new GhostWidget(t),side:1}).range(e.doc.length))}),Gc=new WeakMap,Kc=[Uc,Wc,Qt.updateListener.of(e=>{if(e.docChanged||e.selectionSet||e.focusChanged){let t=e.view;queueMicrotask(()=>Gc.get(t)?.())}})],qc=new WeakSet;function expressionEditor(e,t){return qc.has(e)||(qc.add(e),e.dispatch({effects:tn.appendConfig.of(Kc)})),Gc.set(e,t),{anchor:e.dom,text:()=>e.state.doc.toString(),caretAtEnd(){let{main:t}=e.state.selection;return t.empty&&t.head===e.state.doc.length},busy:()=>Xt(e.state)===`active`,append(t){let n=e.state.doc.length;e.dispatch({changes:{from:n,insert:t},selection:{anchor:n+t.length},userEvent:`input.complete`})},showGhost(t){e.state.field(Uc,!1)!==t&&e.dispatch({effects:Hc.of(t)})},hideGhost(){e.state.field(Uc,!1)&&e.dispatch({effects:Hc.of(null)})},dispose(){Gc.delete(e),e.dom.isConnected&&e.state.field(Uc,!1)&&e.dispatch({effects:Hc.of(null)})}}}function textOf$2(e){return e.tagName===`INPUT`||e.tagName===`TEXTAREA`?e.value:Qt.findFromDOM(e)?.state.doc.toString()??null}e(textOf$2,`textOf`);function adapterFor(e,t){if(e.tagName===`INPUT`||e.tagName===`TEXTAREA`)return plainInput(e,t);let n=Qt.findFromDOM(e);return n?expressionEditor(n,t):null}function certaintyOf(e){return e.probability??1}function topSuggestion(e){let t=null;for(let n of e)(t===null||certaintyOf(n)>certaintyOf(t))&&(t=n);return t}var Jc=/^=\s*/;function ghostSuffix(e,t){let n=e.replace(Jc,``);return t.length>n.length&&t.startsWith(n)?t.slice(n.length):null}function suggestionKey(e,t){return JSON.stringify([e,t])}var SuggestedField=class{adapter;spec;entryId;host;suggestion=null;key=null;showing=null;focused=!1;cancel=null;constructor(e,t,n,r){this.adapter=e,this.spec=t,this.entryId=n,this.host=r}focusIn(){this.focused||(this.focused=!0,this.restart())}focusOut(){this.focused&&(this.focused=!1,this.stop())}restart(){this.stop(),this.focused&&this.host.enabled()&&(this.cancel=this.host.schedule(()=>this.ask(),150))}stop(){this.cancel?.(),this.cancel=null,this.suggestion=null,this.key=null,this.hide()}input(){this.refresh()}accept(){if(this.showing===null||this.suggestion===null)return!1;let{value:e}=this.suggestion;return this.adapter.append(this.showing),this.suggestion=null,this.hide(),this.host.announce(Y(`app.suggestions.status.added`,{value:e})),!0}dismiss(){return this.showing===null||this.key===null?!1:(this.host.dismiss(this.key),this.suggestion=null,this.key=null,this.hide(),this.host.announce(Y(`app.suggestions.status.dismissed`)),!0)}explain(){return this.showing===null||this.suggestion===null?!1:(this.host.explain(this,this.suggestion),!0)}dispose(){this.stop(),this.focused=!1,this.adapter.dispose()}ask(){if(this.cancel=null,!this.focused||!this.host.enabled())return;let e=this.host.elementId(),t=this.host.provider();if(e===null||t===null)return;let n=suggestionKey(e,this.entryId);if(this.host.dismissed(n))return;let r=this.spec.named===null?this.adapter.text():this.host.namedText(this.spec.named);r!==null&&(this.key=n,this.suggestion=this.suggestionFor(t,e,r),this.refresh())}suggestionFor(e,t,n){if(this.spec.transform===!0){let r=topSuggestion(e.suggest({task:`expression`,elementId:t,field:n}));if(r!==null)return r}return topSuggestion(e.suggest({task:this.spec.task,elementId:t,field:n}))}refresh(){if(!this.focused||!this.host.enabled()||this.suggestion===null||this.adapter.busy()||!this.adapter.caretAtEnd()){this.hide();return}let e=ghostSuffix(this.adapter.text(),this.suggestion.value);if(e===null){this.hide();return}let t=this.showing===null;this.showing=e,this.adapter.showGhost(e),t&&this.host.announce(Y(`app.suggestions.status.offered`,{value:this.suggestion.value}))}hide(){this.showing!==null&&(this.showing=null,this.adapter.hideGhost())}},Yc=new Set([`resultVariable`,`expressionResultVariable`,`decisionRefResultVariable`,`scriptResultVariable`]),Xc=[/-output-\d+-target$/,/-outMapping-\d+-target$/,/-outputParameter-\d+-name$/,/-dataOutput-\d+-name$/],Zc=/^(.*-input-\d+)-source$/,Qc=/^(.*-inMapping-\d+)-source$/,$c=/^(.*-inMapping-\d+)-sourceExpression$/;function fieldSpecFor(e){if(Yc.has(e)||Xc.some(t=>t.test(e)))return{task:`output-name`,named:null};let t=Zc.exec(e);if(t)return{task:`input-source`,named:`${t[1]}-target`,transform:!0};let n=Qc.exec(e);if(n)return{task:`input-source`,named:`${n[1]}-target`};let r=$c.exec(e);return r?{task:`expression`,named:`${r[1]}-target`}:null}function controlOf(e){return e.querySelector(`.cm-editor`)??e.querySelector(`input[type="text"], input:not([type]), textarea`)}var unitLabel=(e,t)=>e===null?``:t(`app.suggestions.unit.${e}`);function conversionLine(e,t){return t(`app.suggestions.reason.kindConvert`,{from:unitLabel(e.from,t),to:unitLabel(e.to,t),factor:e.factor??``})}function recognitionLines(e,t){switch(e.kind){case`convert`:return[conversionLine(e,t)];case`wholeMinorUnits`:return[conversionLine(e,t),t(`app.suggestions.reason.kindWholeMinorUnits`,{to:unitLabel(e.to,t)})];case`isoDuration`:return[...e.from===e.to?[]:[conversionLine(e,t)],t(`app.suggestions.reason.kindIsoDuration`)];case`durationText`:return[t(`app.suggestions.reason.kindDurationText`)];case`numberFromText`:return[t(`app.suggestions.reason.kindNumberFromText`)];case`textFromValue`:return[t(`app.suggestions.reason.kindTextFromValue`)];case`durationFromText`:return[t(`app.suggestions.reason.kindDurationFromText`)];case`constant`:return[t(e.constantOrigin===`diagram`?`app.suggestions.reason.constantInDiagram`:`app.suggestions.reason.constantInProject`,{text:e.constant??``})];case`identity`:return[]}}var el=4;function wordFor(e){let t=`app.suggestions.reason.${e}`,n=Y(t);return n===t?Y(`app.suggestions.reason.other`):n}function percentOf(e){return Math.round(e*100)}function explanationLines(e){if(e.recognition)return recognitionLines(e.recognition,Y);let t=[...e.reasons].sort((e,t)=>Math.abs(t.contribution)-Math.abs(e.contribution));return[...new Set(t.map(e=>wordFor(e.feature)))].slice(0,el)}function Explanation({anchor:e,suggestion:t,onClose:n}){let r=explanationLines(t);return u(mn,{anchor:e,label:Y(`app.suggestions.explain.title`),onClose:n,width:280,class:`suggestion-explain`,children:[u(`p`,{class:`suggestion-explain__title type-section-heading`,children:Y(`app.suggestions.explain.title`)}),u(`p`,{class:`suggestion-explain__value type-input`,children:t.value}),u(`p`,{class:`suggestion-explain__origin type-help`,children:Y(`app.suggestions.origin.${t.origin}`)}),t.probability!==null&&u(`p`,{class:`suggestion-explain__likelihood type-help`,children:Y(`app.suggestions.explain.likelihood`,{percent:percentOf(t.probability)})}),r.length>0&&u(`ul`,{class:`suggestion-explain__reasons`,children:r.map(e=>u(`li`,{class:`type-help`,children:e}))}),u(`p`,{class:`suggestion-explain__keys type-help`,children:Y(`app.suggestions.explain.keys`)})]})}function windowSchedule(e,t){let n=window.setTimeout(e,t);return()=>window.clearTimeout(n)}function plain(e){return!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey}function explainKey(e){return e.code===`KeyE`&&e.altKey&&e.shiftKey&&!e.ctrlKey&&!e.metaKey}var FieldSuggestions=class{options;fields=new Map;dismissedKeys=new Set;root=null;observer=null;focused=null;open=null;on;constructor(e){this.options=e,this.on=e.enabled??A()}attach(e){this.root=e,e.addEventListener(`focusin`,this.onFocusIn),e.addEventListener(`focusout`,this.onFocusOut),window.addEventListener(`keydown`,this.onKeyDown,!0),this.observer=new MutationObserver(()=>this.scan()),this.observer.observe(e,{childList:!0,subtree:!0}),this.scan()}dispose(){this.observer?.disconnect(),this.observer=null,this.root?.removeEventListener(`focusin`,this.onFocusIn),this.root?.removeEventListener(`focusout`,this.onFocusOut),this.root=null,window.removeEventListener(`keydown`,this.onKeyDown,!0),this.closeExplanation();for(let e of this.fields.values())e.dispose();this.fields.clear(),this.focused=null}setEnabled(e){this.on=e,e||this.closeExplanation();for(let e of this.fields.values())e.stop();this.focused?.restart()}provider(){return(this.options.provider??z)()}elementId(){return this.options.elementId()}enabled(){return this.on}dismissed(e){return this.dismissedKeys.has(e)}dismiss(e){this.dismissedKeys.add(e)}announce(e){this.options.announce(e)}schedule(e,t){return(this.options.schedule??windowSchedule)(e,t)}explain(e,t){this.openExplanation(e,t)}namedText(e){let t=[...this.root?.querySelectorAll(`[data-entry-id]`)??[]].find(t=>t.dataset.entryId===e),n=t?controlOf(t):null;return n?textOf$2(n):null}scan(){let e=this.root;if(e!==null){for(let t of e.querySelectorAll(`[data-entry-id]`)){let e=t.dataset.entryId??``,n=fieldSpecFor(e);if(n===null)continue;let r=controlOf(t);if(r===null||this.fields.has(r))continue;let i=adapterFor(r,()=>this.fields.get(r)?.input());if(i===null)continue;let a=new SuggestedField(i,n,e,this);this.fields.set(r,a),r.contains(document.activeElement)&&(this.focused=a,a.focusIn())}for(let[t,n]of this.fields)e.contains(t)||(this.focused===n&&(this.focused=null),n.dispose(),this.fields.delete(t))}}fieldAt(e){if(!(e instanceof Node))return null;for(let[t,n]of this.fields)if(t.contains(e))return n;return null}onFocusIn=e=>{let t=this.fieldAt(e.target);t!==null&&(this.focused=t,t.focusIn())};onFocusOut=e=>{let t=this.fieldAt(e.target);t!==null&&(e.relatedTarget instanceof Node&&t.adapter.anchor.contains(e.relatedTarget)||(this.focused===t&&(this.focused=null),t.focusOut(),this.open?.field===t&&this.closeExplanation()))};onKeyDown=e=>{if(e.isComposing)return;if(this.open!==null&&e.key===`Escape`){this.consume(e),this.closeExplanation();return}let t=this.fieldAt(e.target);if(t===null)return;let n=!1;e.key===`Tab`&&plain(e)?n=t.accept():e.key===`Escape`&&plain(e)?n=t.dismiss():explainKey(e)&&(n=t.explain()),n&&this.consume(e)};consume(e){e.preventDefault(),e.stopPropagation()}openExplanation(e,t){this.closeExplanation();let n=document.createElement(`div`);document.body.append(n),this.open={field:e,host:n},c(u(Explanation,{anchor:e.adapter.anchor,suggestion:t,onClose:()=>this.closeExplanation()}),n)}closeExplanation(){if(this.open===null)return;let{host:e}=this.open;this.open=null,c(null,e),e.remove()}};function useFieldSuggestions(e,t,n){let r=s(t);r.current=t;let i=s(n);i.current=n,f(()=>{let t=e.current;if(!t)return;let n=new FieldSuggestions({elementId:()=>r.current,announce:e=>i.current(e)});n.attach(t);let a=vn(()=>n.setEnabled(A()));return()=>{a(),n.dispose()}},[e])}var tl=`aeiou`,nl=[[`ational`,`ate`],[`tional`,`tion`],[`enci`,`ence`],[`anci`,`ance`],[`izer`,`ize`],[`abli`,`able`],[`alli`,`al`],[`entli`,`ent`],[`eli`,`e`],[`ousli`,`ous`],[`ization`,`ize`],[`ation`,`ate`],[`ator`,`ate`],[`alism`,`al`],[`iveness`,`ive`],[`fulness`,`ful`],[`ousness`,`ous`],[`aliti`,`al`],[`iviti`,`ive`],[`biliti`,`ble`]],rl=[[`icate`,`ic`],[`ative`,``],[`alize`,`al`],[`iciti`,`ic`],[`ical`,`ic`],[`ful`,``],[`ness`,``]],il=[`al`,`ance`,`ence`,`er`,`ic`,`able`,`ible`,`ant`,`ement`,`ment`,`ent`,`ion`,`ou`,`ism`,`ate`,`iti`,`ous`,`ive`,`ize`],al=new Set([`s`,`t`]);function isConsonant(e,t){return tl.includes(e[t])?!1:e[t]!==`y`||t===0||!isConsonant(e,t-1)}function measure(e){let t=0,n=0;for(;n<e.length&&isConsonant(e,n);)n+=1;for(;n<e.length;){for(;n<e.length&&!isConsonant(e,n);)n+=1;if(n>=e.length)break;for(;n<e.length&&isConsonant(e,n);)n+=1;t+=1}return t}function hasVowel(e){return[...e].some((t,n)=>!isConsonant(e,n))}function endsDoubleConsonant(e){let t=e.length;return t>=2&&e[t-1]===e[t-2]&&isConsonant(e,t-1)}function endsConsonantVowelConsonant(e){let t=e.length;return t>=3&&isConsonant(e,t-3)&&!isConsonant(e,t-2)&&isConsonant(e,t-1)&&!`wxy`.includes(e[t-1])}function replaceSuffix(e,t,n){return e.slice(0,e.length-t.length)+n}function stepOneA(e){return e.endsWith(`sses`)?replaceSuffix(e,`sses`,`ss`):e.endsWith(`ies`)?replaceSuffix(e,`ies`,`i`):e.endsWith(`ss`)||e.endsWith(`us`)||e.endsWith(`is`)?e:e.endsWith(`s`)?e.slice(0,-1):e}function tidyAfterSuffix(e){return[`at`,`bl`,`iz`].some(t=>e.endsWith(t))?e+`e`:endsDoubleConsonant(e)&&!`lsz`.includes(e[e.length-1])?e.slice(0,-1):measure(e)===1&&endsConsonantVowelConsonant(e)?e+`e`:e}function stepOneB(e){if(e.endsWith(`eed`)){let t=e.slice(0,-3);return measure(t)>0?t+`ee`:e}for(let t of[`ed`,`ing`])if(e.endsWith(t)&&hasVowel(e.slice(0,-t.length)))return tidyAfterSuffix(e.slice(0,-t.length));return e}function stepOneC(e){return e.endsWith(`y`)&&hasVowel(e.slice(0,-1))?e.slice(0,-1)+`i`:e}function applyFirstRule(e,t){let n=t.find(([t])=>e.endsWith(t));if(!n)return e;let r=e.slice(0,e.length-n[0].length);return measure(r)>0?r+n[1]:e}function stepFour(e){let t=il.find(t=>e.endsWith(t));if(!t)return e;let n=e.slice(0,e.length-t.length);return measure(n)<=1||t===`ion`&&!al.has(n.slice(-1))?e:n}function stepFive(e){let t=e;if(t.endsWith(`e`)){let e=t.slice(0,-1),n=measure(e);(n>1||n===1&&!endsConsonantVowelConsonant(e))&&(t=e)}return measure(t)>1&&t.endsWith(`ll`)&&(t=t.slice(0,-1)),t}var ol=new Map,sl=1e4;function stemOf(e){if(e.length<=2)return e;let t=ol.get(e);if(t!==void 0)return t;let n=stepFive(stepFour(applyFirstRule(applyFirstRule(stepOneC(stepOneB(stepOneA(e))),nl),rl)));return ol.size>=sl&&ol.clear(),ol.set(e,n),n}var cl={version:1,stopWords:[`a`,`an`,`the`,`of`],abbreviations:{addr:[`address`],amt:[`amount`],cnt:[`count`],desc:[`description`],dob:[`birth`,`date`],dt:[`date`],id:[`identifier`],img:[`image`],max:[`maximum`],min:[`minimum`],msg:[`message`],no:[`number`],nr:[`number`],num:[`number`],pct:[`percent`],perc:[`percent`],qty:[`quantity`],tel:[`telephone`],tot:[`total`],ts:[`timestamp`],val:[`value`]},families:{number:[`int`,`integer`,`int32`,`int64`,`long`,`short`,`byte`,`double`,`float`,`float32`,`float64`,`decimal`,`bigdecimal`,`biginteger`,`number`],string:[`string`,`str`,`charsequence`,`char`,`character`],boolean:[`boolean`,`bool`],date:[`date`,`localdate`,`localdatetime`,`datetime`,`instant`,`zoneddatetime`,`offsetdatetime`,`time`,`localtime`,`timestamp`],duration:[`duration`,`timespan`],list:[`list`,`arraylist`,`linkedlist`,`array`,`collection`,`set`,`hashset`,`iterable`,`sequence`]},concepts:[{name:`email`,role:`content`,words:[`email`,`mail`,`e mail`],family:`string`,unit:null},{name:`identifier`,role:`attribute`,words:[`identifier`,`key`,`number`,`code`,`uuid`,`guid`],family:null,unit:null},{name:`flag`,role:`marker`,words:[`flag`,`is`,`has`,`can`,`should`,`was`,`will`,`does`],family:`boolean`,unit:null},{name:`percent`,role:`content`,words:[`percent`,`percentage`],family:`number`,unit:`%`},{name:`rate`,role:`content`,words:[`rate`,`factor`,`ratio`],family:`number`,unit:null},{name:`timeout`,role:`content`,words:[`timeout`,`expiry`,`expiration`,`ttl`],family:`duration`,unit:null},{name:`duration`,role:`content`,words:[`duration`,`period`,`elapsed`,`span`],family:`duration`,unit:null},{name:`count`,role:`content`,words:[`count`,`quantity`,`tally`],family:`number`,unit:null},{name:`amount`,role:`content`,words:[`amount`,`total`,`sum`,`price`,`cost`,`fee`],family:`number`,unit:null},{name:`date`,role:`content`,words:[`date`,`day`],family:`date`,unit:null},{name:`name`,role:`content`,words:[`name`,`title`,`label`],family:`string`,unit:null},{name:`address`,role:`content`,words:[`address`],family:`string`,unit:null},{name:`phone`,role:`content`,words:[`phone`,`telephone`,`mobile`],family:`string`,unit:null},{name:`status`,role:`content`,words:[`status`,`state`],family:`string`,unit:null},{name:`url`,role:`content`,words:[`url`,`link`,`uri`,`href`],family:`string`,unit:null},{name:`description`,role:`content`,words:[`description`,`summary`],family:`string`,unit:null}]},ll=[`content`,`attribute`,`marker`],ul=[`number`,`string`,`boolean`,`date`,`duration`,`list`],dl=1,fl=/^[\p{Ll}\p{Lo}\p{N}]+(?: [\p{Ll}\p{Lo}\p{N}]+)*$/u,pl=/^[\p{Ll}\p{Lo}\p{N}]+$/u,ml=class LexiconError extends Error{problems;constructor(e){super(JSON.stringify(e)),this.name=LexiconError.name,this.problems=e}},hl=e(e=>typeof e==`object`&&!!e&&!Array.isArray(e),`isRecord`),isRole=e=>ll.includes(e),isFamily=e=>ul.includes(e),isWord=e=>typeof e==`string`&&pl.test(e),phraseKeyOf=e=>e.map(e=>stemOf(e)).join(` `);function stopWordsOf(e,t){let n=new Set;return Array.isArray(e)?(e.forEach((e,r)=>{let i=`stopWords[${r}]`;isWord(e)?n.has(e)?t.push({code:`repeated`,path:i,value:e}):n.add(e):t.push({code:`notWord`,path:i,value:e})}),n):(t.push({code:`notList`,path:`stopWords`}),n)}function abbreviationsOf(e,t){let n=new Map;if(!hl(e))return t.push({code:`notObject`,path:`abbreviations`}),n;for(let[r,i]of Object.entries(e)){let e=`abbreviations.${r}`;isWord(r)?Array.isArray(i)?i.length===0?t.push({code:`emptyList`,path:e}):i.every(isWord)?n.set(r,i):t.push({code:`notWord`,path:e,value:i}):t.push({code:`notList`,path:e}):t.push({code:`notWord`,path:`abbreviations`,value:r})}return n}function typeNamesOf(e,t){let n=new Map;if(!hl(e))return t.push({code:`notObject`,path:`families`}),n;for(let[r,i]of Object.entries(e)){let e=`families.${r}`;isFamily(r)?Array.isArray(i)?i.forEach((i,a)=>{let o=`${e}[${a}]`;isWord(i)?n.has(i)?t.push({code:n.get(i)===r?`repeated`:`owned`,path:o,value:i,other:n.get(i)}):n.set(i,r):t.push({code:`notWord`,path:o,value:i})}):t.push({code:`notList`,path:e}):t.push({code:`unknownFamily`,path:e,value:r})}return n}function wordsOf$3(e,t,n){return Array.isArray(e)?e.length===0?(n.push({code:`emptyList`,path:t}),[]):e.flatMap((e,r)=>typeof e==`string`&&fl.test(e)?[e]:(n.push({code:`notPhrase`,path:`${t}[${r}]`,value:e}),[])):(n.push({code:`notList`,path:t}),[])}e(wordsOf$3,`wordsOf`);function conceptOf(e,t,n){let r=`concepts[${t}]`;if(!hl(e))return n.push({code:`notObject`,path:r}),null;let i=typeof e.name==`string`&&fl.test(e.name)?e.name:null;i===null&&n.push({code:`notPhrase`,path:`${r}.name`,value:e.name});let a=isRole(e.role)?e.role:null;a===null&&n.push({code:`unknownRole`,path:`${r}.role`,value:e.role});let o=wordsOf$3(e.words,`${r}.words`,n);i!==null&&!o.includes(i)&&n.push({code:`nameNotAmongWords`,path:r,value:i});let s=e.family===null||e.family===void 0?null:e.family;s!==null&&!isFamily(s)&&n.push({code:`unknownFamily`,path:`${r}.family`,value:s});let c=e.unit===null||e.unit===void 0?null:e.unit;return c!==null&&(typeof c!=`string`||c.trim()===``)&&n.push({code:`notText`,path:`${r}.unit`,value:c}),i===null||a===null||s!==null&&!isFamily(s)||c!==null&&typeof c!=`string`?null:{name:i,role:a,words:o,family:s,unit:c}}function conceptsOf(e,t){let n=new Map,r=new Map;return Array.isArray(e)?(e.forEach((e,i)=>{let a=conceptOf(e,i,t);a&&(n.has(a.name)&&t.push({code:`repeated`,path:`concepts[${i}]`,value:a.name}),n.set(a.name,a),a.words.forEach((e,n)=>{let o=phraseKeyOf(e.split(` `)),s=r.get(o);s&&s.name!==a.name?t.push({code:`owned`,path:`concepts[${i}].words[${n}]`,value:e,other:s.name}):r.set(o,a)}))}),{concepts:n,phrases:r}):(t.push({code:`notList`,path:`concepts`}),{concepts:n,phrases:r})}function loadLexicon(e){if(!hl(e))throw new ml([{code:`notObject`,path:`$`}]);let t=[];e.version!==dl&&t.push({code:`version`,path:`version`,value:e.version});let n=stopWordsOf(e.stopWords,t),r=abbreviationsOf(e.abbreviations,t),i=typeNamesOf(e.families,t),{concepts:a,phrases:o}=conceptsOf(e.concepts,t);if(t.length>0)throw new ml(t);return{stopWords:n,abbreviations:r,typeNames:i,concepts:a,phrases:o,longestPhrase:Math.max(1,...[...o.keys()].map(e=>e.split(` `).length))}}function familyOf(e,t){if(e===null)return null;let n=e.trim().toLowerCase();return n===``?null:n.endsWith(`[]`)?`list`:t.typeNames.get(n.replace(/<.*$/s,``).trim())??null}var gl=loadLexicon(cl),_l=/^([A-Za-z_]\w*)(?:\.[A-Za-z_]\w*|\[\s*\d+\s*\])*$/,vl=/^[$#]\{([\s\S]*)\}$/,yl=[`camunda`,`operaton`];function localName(e){return typeof e==`string`?(e.split(`:`).pop()??``).toLowerCase():``}function text(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function feelBody(e){return e!==null&&e.startsWith(`=`)?text(e.slice(1)):null}function juelBody(e){let t=e===null?null:vl.exec(e.trim());return t?text(t[1]):null}function variableOf(e){let t=e===null?null:_l.exec(e);return t?t[1]:null}function mapping(e,t,n,r,i=variableOf(r)){return{elementId:e,direction:t,target:n,expression:r,variable:i}}function resultVariableOf(e){for(let t of yl){let n=e?.get?.(`${t}:resultVariable`)??e?.$attrs?.[`${t}:resultVariable`];if(text(n)!==null)return text(n)}return null}function extensionMappings(e,t){switch(localName(t?.$type)){case`iomapping`:return[...(t.inputParameters??[]).map(t=>mapping(e,`input`,text(t.target),feelBody(text(t.source)))),...(t.outputParameters??[]).map(t=>mapping(e,`output`,text(t.target),feelBody(text(t.source)),null))];case`inputoutput`:return[...(t.inputParameters??[]).map(t=>mapping(e,`input`,text(t.name),juelBody(text(t.value)))),...(t.outputParameters??[]).map(t=>mapping(e,`output`,text(t.name),juelBody(text(t.value)),null))];case`connector`:return t.inputOutput?extensionMappings(e,t.inputOutput):[];case`in`:{let n=text(t.source);return[mapping(e,`input`,text(t.target),n??juelBody(text(t.sourceExpression)))]}case`out`:return[mapping(e,`output`,text(t.target),text(t.source),null)];case`script`:case`calleddecision`:return text(t.resultVariable)===null?[]:[mapping(e,`result`,text(t.resultVariable),null)];default:return[]}}function elementMappings(e){let t=String(e.id),n=resultVariableOf(e);return[...(e.extensionElements?.values??[]).flatMap(e=>extensionMappings(t,e)),...n===null?[]:[mapping(t,`result`,n,null)]]}function visit(e,t){e?.id&&(t.push(...elementMappings(e)),(e.flowElements??[]).forEach(e=>visit(e,t)))}function mappingsOf(e){let t=[];return(e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`).forEach(e=>(e.flowElements??[]).forEach(e=>visit(e,t))),t}var bl=/\p{Lu}+(?=\p{Lu}\p{Ll})|\p{Lu}?[\p{Ll}\p{M}]+|\p{Lu}+|\p{N}+|[\p{Lo}\p{Lm}\p{M}]+/gu,xl=/\[\s*\d+\s*\]/g,Sl=/^\p{N}+$/u;function segmentsOf(e){return e.replace(xl,`.`).split(`.`).filter(e=>e.length>0)}function wordsOf$2(e){return[...e.matchAll(bl)].map(e=>e[0].toLowerCase())}e(wordsOf$2,`wordsOf`);function nameWordsOf(e){return segmentsOf(e).flatMap(wordsOf$2)}function expandedWords(e,t){return e.flatMap(e=>t.stopWords.has(e)?[]:[...t.abbreviations.get(e)??[e]])}function conceptAt(e,t,n){for(let r=Math.min(n.longestPhrase,e.length-t);r>=1;--r){let i=n.phrases.get(phraseKeyOf(e.slice(t,t+r)));if(i)return{concept:i,length:r}}return null}function unitsOfWords(e,t,n){let r=[],i=0;for(;i<e.length;){let a=conceptAt(e,i,n);if(a)r.push({key:a.concept.name,text:e.slice(i,i+a.length).join(` `),role:a.concept.role,segment:t}),i+=a.length;else{let n=e[i];r.push({key:stemOf(n),text:n,role:Sl.test(n)?`attribute`:`content`,segment:t}),i+=1}}return r}function unitsOf(e,t){return segmentsOf(e).flatMap((e,n)=>unitsOfWords(expandedWords(wordsOf$2(e),t),n,t))}var Cl={names:0,content:0,last:0};function factsOf$1(e,t){let n=unitsOf(e,t),r=n.filter(e=>e.role===`content`);return{keys:[...new Set(n.map(e=>e.key))],contentKeys:[...new Set(r.map(e=>e.key))],last:r.at(-1)?.key??null,weight:0}}e(factsOf$1,`factsOf`);var Vocabulary=class{lexicon;sources=new Map;sourceWeights=new Map;holders=new Map;facts=new Map;statistics=new Map;mass=new Map;total=0;constructor(e=gl){this.lexicon=e}get size(){return this.facts.size}replaceSource(e,t){let n=this.sources.get(e)??new Set,r=new Set(t);for(let t of n)r.has(t)||this.release(t,e);for(let t of r)n.has(t)||this.retain(t,e);r.size===0?this.sources.delete(e):this.sources.set(e,r)}removeSource(e){this.replaceSource(e,[])}setSourceWeight(e,t){if(!Number.isFinite(t)||t<0)throw RangeError(`sourceWeight:${t}`);this.sourceWeights.set(e,t);for(let t of this.sources.get(e)??[])this.refresh(t)}statisticsOf(e){return{...this.statistics.get(e)??Cl}}weight(e){return 1+Math.log((this.total+1)/((this.mass.get(e)??0)+1))}headness(e){let{content:t,last:n}=this.statisticsOf(e);return(n+1)/(t+2)}retain(e,t){let n=this.holders.get(e)??new Set;n.add(t),this.holders.set(e,n),this.facts.has(e)||this.enter(e),this.refresh(e)}release(e,t){let n=this.holders.get(e);n?.delete(t),n?.size===0?(this.holders.delete(e),this.leave(e)):this.refresh(e)}enter(e){let t=factsOf$1(e,this.lexicon);this.facts.set(e,t),t.keys.forEach(e=>this.bump(e,`names`,1)),t.contentKeys.forEach(e=>this.bump(e,`content`,1)),t.last!==null&&this.bump(t.last,`last`,1)}leave(e){let t=this.facts.get(e);t&&(this.reweigh(t,0),t.keys.forEach(e=>this.bump(e,`names`,-1)),t.contentKeys.forEach(e=>this.bump(e,`content`,-1)),t.last!==null&&this.bump(t.last,`last`,-1),this.facts.delete(e))}refresh(e){let t=this.facts.get(e);t&&this.reweigh(t,this.heaviestOf(e))}heaviestOf(e){return[...this.holders.get(e)??[]].reduce((e,t)=>Math.max(e,this.sourceWeights.get(t)??1),0)}reweigh(e,t){let n=t-e.weight;n!==0&&(e.weight=t,this.total+=n,e.keys.forEach(e=>this.mass.set(e,(this.mass.get(e)??0)+n)))}bump(e,t,n){let r=this.statistics.get(e)??{...Cl};r[t]+=n,this.statistics.set(e,r)}},wl=.25,Tl=.05;function headOf$1(e,t){let n=e.filter(e=>e.role===`content`);if(n.length===0)return{keys:[],state:`none`};let r=n[n.length-1].key,[i,a]=[...new Set(n.map(e=>e.key))].map(e=>({key:e,score:t.headness(e)+(e===r?wl:0)})).sort((e,t)=>t.score-e.score);return a&&i.score-a.score<Tl?{keys:[i.key,a.key],state:`ambiguous`}:{keys:[i.key],state:`decided`}}e(headOf$1,`headOf`);function analyse(e,t){let n=unitsOf(e,t.lexicon);return{name:e,units:n,head:headOf$1(n,t)}}function rolesOf(e){return e.units.map(t=>({key:t.key,text:t.text,segment:t.segment,role:roleOf(t,e.head)}))}function roleOf(e,t){return e.role===`marker`?`marker`:e.role===`attribute`?`attribute`:t.keys.includes(e.key)?`head`:`qualifier`}var El=.1,Dl=4;function matchesOf$1(e,t){let n=Math.max(0,Math.floor(Math.max(e.length,t.length)/2)-1),r=Array.from({length:e.length},()=>!1),i=Array.from({length:t.length},()=>!1),a=0;for(let o=0;o<e.length;o+=1){let s=Math.min(o+n+1,t.length);for(let c=Math.max(0,o-n);c<s;c+=1)if(!i[c]&&e[o]===t[c]){r[o]=!0,i[c]=!0,a+=1;break}}return{aMatched:r,bMatched:i,count:a}}e(matchesOf$1,`matchesOf`);function transpositionsOf(e,t,n,r){let i=0,a=0;for(let o=0;o<e.length;o+=1)if(n[o]){for(;!r[a];)a+=1;e[o]!==t[a]&&(i+=1),a+=1}return i/2}function jaroWinkler$1(e,t){if(e===t)return 1;if(e.length===0||t.length===0)return 0;let{aMatched:n,bMatched:r,count:i}=matchesOf$1(e,t);if(i===0)return 0;let a=(i/e.length+i/t.length+(i-transpositionsOf(e,t,n,r))/i)/3,o=0;for(;o<Dl&&e[o]!==void 0&&e[o]===t[o];)o+=1;return a+o*El*(1-a)}e(jaroWinkler$1,`jaroWinkler`);var Ol={score:.5,margin:.1},kl={head:1,qualifier:1,attribute:.5,marker:.25},Al={same:1,ambiguous:.9,none:.8,different:.4},jl=.9,Ml=5;function wordsOf$1(e,t){let n=new Map;for(let r of rolesOf(e))n.has(r.key)||n.set(r.key,{key:r.key,text:r.text,spelling:r.text.toLowerCase(),role:r.role,weight:t.weight(r.key)*kl[r.role]});return n}e(wordsOf$1,`wordsOf`);var totalOf=e=>[...e.values()].reduce((e,t)=>e+t.weight,0),normOf=e=>Math.sqrt([...e.values()].reduce((e,t)=>e+t.weight*t.weight,0));function matchTextOf(e){let t=(e.owners??[]).filter(t=>e.name.length>t.length+1&&e.name.startsWith(`${t}_`)).sort((e,t)=>t.length-e.length)[0];return t===void 0?e.name:e.name.slice(t.length+1)}var Nl=/\d/,Pl=.4;function mayBeSimilar(e,t){let n=Math.min(e.length,t.length),r=(n/e.length+n/t.length+1)/3;return r+Pl*(1-r)>=jl}function spellingSimilarity(e,t){if(Nl.test(e.spelling)||Nl.test(t.spelling)||!mayBeSimilar(e.spelling,t.spelling))return 0;let n=jaroWinkler$1(e.spelling,t.spelling);return n>=jl?n:0}function softSimilarity(e,t,n){if(t===0||n.norm===0)return 0;let r=0;for(let t of e.values()){let e=0;for(let r of n.words.values()){let n=t.key===r.key?1:spellingSimilarity(t,r);e=Math.max(e,n*r.weight)}r+=t.weight*e}return Math.min(1,r/(t*n.norm))}function agreementOf(e,t){if(e.state===`none`||t.state===`none`)return`none`;let n=e.keys.some(e=>t.keys.includes(e));return e.state===`decided`&&t.state===`decided`?n?`same`:`different`:n?`ambiguous`:`different`}function conceptFamily(e,t){for(let n of e.units){let e=t.concepts.get(n.key)?.family;if(e)return e}return null}function expectedTypeOf(e,t,n){let r=familyOf(e.expectedType??null,n);if(r)return{family:r,from:`context`};let i=conceptFamily(t,n);return{family:i,from:i?`concept`:null}}function explain(e,t,n,r,i){let a=[],o=[],s=new Set;for(let n of e.values()){let e=t.get(n.key),i={key:e?.key??n.key,text:n.text,role:n.role,weight:n.weight,similarity:e?.similarity??0};e&&r.words.has(e.key)?(a.push(i),s.add(e.key)):o.push(i)}return{shared:a,onlyQuery:o,onlyCandidate:[...r.words.values()].filter(e=>!s.has(e.key)).map(e=>({key:e.key,text:e.text,role:e.role,weight:e.weight,similarity:1})),head:{query:n.head.keys,candidate:r.analysis.head.keys,agreement:agreementOf(n.head,r.analysis.head)},type:{expected:i.family,from:i.from,actual:r.family,fit:i.family!==null&&i.family===r.family?`fits`:`unknown`}}}function insertTop(e,t){let n=e.length;for(;n>0&&(e[n-1].score<t.score||e[n-1].score===t.score&&e[n-1].index>t.index);)--n;n>=Ml||(e.splice(n,0,t),e.length>Ml&&e.pop())}function preferSpelling(e,t,n){let r=e[0],i=e.findIndex(e=>e.candidate.name===t&&r.score-e.score<n);return!r||i<=0?[...e]:[e[i],...e.slice(0,i),...e.slice(i+1)]}function verdictOf(e,t,n){let[r,i]=e;if(!r)return{confident:!1,reason:`none`};if(r.score<n.score)return{confident:!1,reason:`weak`};let a=r.candidate.name===t&&i?.text!==t;return i&&r.score-i.score<n.margin&&!a?{confident:!1,reason:`tie`}:{confident:!0,reason:`confident`}}var CandidateIndex=class{vocabulary;entries;postings=new Map;postingWeights=new Map;spellings=new Map;shared;totals;constructor(e,t){this.vocabulary=t,this.entries=e.map(e=>{let n=matchTextOf(e),r=analyse(n,t),i=wordsOf$1(r,t);return{candidate:e,text:n,words:i,total:totalOf(i),norm:normOf(i),analysis:r,family:familyOf(e.type,t.lexicon)}}),this.entries.forEach((e,t)=>{for(let n of e.words.values()){let e=this.postings.get(n.key),r=this.postingWeights.get(n.key);e&&r?(e.push(t),r.push(n.weight)):(this.postings.set(n.key,[t]),this.postingWeights.set(n.key,[n.weight])),(n.role===`head`||n.role===`qualifier`)&&this.spellings.set(n.text,n.key)}}),this.shared=new Float64Array(this.entries.length),this.totals=Float64Array.from(this.entries,e=>e.total)}answer(e,t={}){let n=analyse(e,this.vocabulary),r=wordsOf$1(n,this.vocabulary),i=totalOf(r),a=normOf(r),o=t.scoring??`jaccard`,s=expectedTypeOf(t,n,this.vocabulary.lexicon),c=this.resolve(r),l=this.creditOf(r,c),u=[];for(let[e,t]of l){let n=this.postings.get(e)??[],r=this.postingWeights.get(e)??[];for(let e=0;e<n.length;e+=1){let i=n[e];this.shared[i]===0&&u.push(i),this.shared[i]+=Math.min(t,r[e])}}let d={...n,head:{...n.head,keys:n.head.keys.map(e=>c.get(e)?.key??e)}},f=[],p={type:0,scope:0};for(let e of u){let n=this.entries[e],c=this.shared[e];if(this.shared[e]=0,t.reachable&&!t.reachable.has(n.candidate.id))p.scope+=1;else if(s.family!==null&&n.family!==null&&s.family!==n.family)p.type+=1;else{let t=o===`jaccard`?c/(i+this.totals[e]-c):softSimilarity(r,a,n),s=f[4];(f.length<Ml||t>s.score||t===s.score&&e<s.index)&&insertTop(f,{index:e,score:t*Al[agreementOf(d.head,n.analysis.head)]})}}let m=t.thresholds??Ol,h=preferSpelling(f.map(({index:e,score:t})=>{let n=this.entries[e];return{candidate:n.candidate,text:n.text,score:t,explanation:explain(r,c,d,n,s)}}),e,m.margin),g=verdictOf(h,e,m);return{query:n,best:h[0]??null,ranked:h,confident:g.confident,reason:g.reason,excluded:p}}creditOf(e,t){let n=new Map;for(let r of e.values()){let e=t.get(r.key);e&&n.set(e.key,Math.max(n.get(e.key)??0,r.weight*e.similarity))}return n}resolve(e){let t=new Map;for(let n of e.values())if(this.postings.has(n.key))t.set(n.key,{key:n.key,similarity:1});else if(n.role===`head`||n.role===`qualifier`){let e=this.nearestSpelling(n.text);e&&t.set(n.key,e)}return t}nearestSpelling(e){let t=null;for(let[n,r]of this.spellings){let i=jaroWinkler$1(e,n);i>=jl&&(t===null||i>t.similarity)&&(t={key:r,similarity:i})}return t}};function match(e,t,n){return new CandidateIndex(t,n.vocabulary).answer(e,n)}var Fl=[`kindIdentity`,`kindConvert`,`kindWholeMinorUnits`,`kindIsoDuration`,`kindDurationText`,`kindConstant`,`kindNumberFromText`,`kindTextFromValue`,`kindDurationFromText`,`sourceUnitExplicit`,`targetUnitExplicit`,`targetUnitAtHead`,`logFactor`,`dimensionKnown`,`nameOverlap`,`constantInDiagram`,`constantInProject`,`typeMatch`,`typeUnknown`,`resultSane`,`projectFrequency`];function featureValues(e={}){return Object.fromEntries(Fl.map(t=>[t,e[t]??0]))}var Il={version:1,dimensions:{ratio:{base:`ratio`,assumed:`ratio`,hints:[`rate`,`ratio`,`factor`,`proportion`],range:[0,1],integral:!1,iso:!1},duration:{base:`second`,assumed:null,hints:[`timeout`,`duration`,`time`,`period`,`delay`,`interval`,`elapsed`,`ttl`,`expiry`,`expiration`],range:[0,31536e3],integral:!1,iso:!0},data:{base:`byte`,assumed:null,hints:[],range:null,integral:!1,iso:!1},money:{base:`dollar`,assumed:null,hints:[],range:null,integral:!0,iso:!1}},units:[{name:`ratio`,dimension:`ratio`,per:1,words:[`fraction`],sample:.25},{name:`percent`,dimension:`ratio`,per:.01,words:[`percent`,`percentage`,`pct`],sample:25},{name:`basisPoint`,dimension:`ratio`,per:1e-4,words:[`basis point`,`bps`],sample:150},{name:`second`,dimension:`duration`,per:1,words:[`second`,`seconds`,`sec`,`secs`],iso:{prefix:`PT`,designator:`S`},sample:30},{name:`millisecond`,dimension:`duration`,per:.001,words:[`millisecond`,`milliseconds`,`ms`,`msec`,`msecs`],sample:1500},{name:`minute`,dimension:`duration`,per:60,words:[`minute`,`minutes`,`mins`],iso:{prefix:`PT`,designator:`M`},sample:5},{name:`hour`,dimension:`duration`,per:3600,words:[`hour`,`hours`,`hr`,`hrs`],iso:{prefix:`PT`,designator:`H`},sample:2},{name:`byte`,dimension:`data`,per:1,words:[`byte`,`bytes`],sample:512},{name:`kilobyte`,dimension:`data`,per:1e3,words:[`kilobyte`,`kilobytes`],sample:4},{name:`megabyte`,dimension:`data`,per:1e6,words:[`megabyte`,`megabytes`],sample:8},{name:`gigabyte`,dimension:`data`,per:1e9,words:[`gigabyte`,`gigabytes`],sample:2},{name:`dollar`,dimension:`money`,per:1,words:[`dollar`,`dollars`],sample:20},{name:`cent`,dimension:`money`,per:.01,words:[`cent`,`cents`],sample:250}]},Ll=1,Rl=/^[\p{Ll}\p{Lo}\p{N}]+(?: [\p{Ll}\p{Lo}\p{N}]+)*$/u,zl=/^[a-z][A-Za-z]*$/,Bl=[`P`,`PT`],Vl=/^[YMWDHS]$/,Hl=class UnitError extends Error{problems;constructor(e){super(JSON.stringify(e)),this.name=UnitError.name,this.problems=e}},isRecord=e=>typeof e==`object`&&!!e&&!Array.isArray(e),isPhrase=e=>typeof e==`string`&&Rl.test(e),isFinitePositive=e=>typeof e==`number`&&Number.isFinite(e)&&e>0,keySequence=e=>e.join(` `),stemsOf=e=>e.split(` `).map(e=>stemOf(e)),keysOf=(e,t)=>unitsOf(e,t).map(e=>e.key);function phrasesOf(e,t,n){return Array.isArray(e)?e.flatMap((e,r)=>isPhrase(e)?[e]:(n.push({code:`notPhrase`,path:`${t}[${r}]`,value:e}),[])):(n.push({code:`notList`,path:t}),[])}function isoOf(e,t,n){if(e==null)return null;if(!isRecord(e))return n.push({code:`notIso`,path:t,value:e}),null;let r=typeof e.prefix==`string`&&Bl.includes(e.prefix),i=typeof e.designator==`string`&&Vl.test(e.designator);return r||n.push({code:`notIso`,path:`${t}.prefix`,value:e.prefix}),i||n.push({code:`notIso`,path:`${t}.designator`,value:e.designator}),r&&i?{prefix:e.prefix,designator:e.designator}:null}function unitOf(e,t,n,r){let i=`units[${t}]`;if(!isRecord(e))return r.push({code:`notObject`,path:i}),null;let a=typeof e.name==`string`&&zl.test(e.name)?e.name:null;a===null&&r.push({code:`notName`,path:`${i}.name`,value:e.name});let o=typeof e.dimension==`string`&&n.has(e.dimension)?e.dimension:null;o===null&&r.push({code:`unknownDimension`,path:`${i}.dimension`,value:e.dimension}),isFinitePositive(e.per)||r.push({code:`notPositive`,path:`${i}.per`,value:e.per});let s=phrasesOf(e.words,`${i}.words`,r);Array.isArray(e.words)&&s.length===0&&r.push({code:`emptyList`,path:`${i}.words`});let c=isoOf(e.iso,`${i}.iso`,r);return isFinitePositive(e.sample)||r.push({code:`notPositive`,path:`${i}.sample`,value:e.sample}),a===null||o===null||!isFinitePositive(e.per)||!isFinitePositive(e.sample)?null:{name:a,dimension:o,per:e.per,words:s,iso:c,sample:e.sample}}function unitsByName(e,t){let n=new Map;return e.forEach((e,r)=>{n.has(e.name)?t.push({code:`repeated`,path:`units[${r}].name`,value:e.name}):n.set(e.name,e)}),n}function wordsOf(e,t,n){let r=new Map;return e.forEach(e=>{e.words.forEach(i=>{let a=keySequence(keysOf(i,t)),o=a===keySequence(stemsOf(i)),s=a===keySequence(stemsOf(e.name));if(!o&&!s){n.push({code:`shadowed`,path:`units.${e.name}.words`,value:i,other:a});return}let c=r.get(a);c&&c!==e?n.push({code:`owned`,path:`units.${e.name}.words`,value:i,other:c.name}):r.set(a,e)})}),r}function claimHints(e,t,n,r,i){t.forEach(t=>{let a=keySequence(keysOf(t,n)),o=r.get(a);o&&o!==e?i.push({code:`owned`,path:`dimensions.${e}.hints`,value:t,other:o}):r.set(a,e)})}function rangeOf(e,t,n){return e==null?null:Array.isArray(e)&&e.length===2&&e.every(e=>typeof e==`number`&&Number.isFinite(e))&&e[0]<=e[1]?[e[0],e[1]]:(n.push({code:`notRange`,path:t,value:e}),null)}function unitReference(e,t,n,r,i){if(e==null)return null;let a=typeof e==`string`?r.get(e):void 0;return a?a.dimension===t?a:(i.push({code:`dimensionMismatch`,path:n,value:e}),null):(i.push({code:`unknownUnit`,path:n,value:e}),null)}function dimensionOf(e,t,n,r,i,a){let o=`dimensions.${e}`;if(!isRecord(t))return a.push({code:`notObject`,path:o}),null;let s=unitReference(t.base,e,`${o}.base`,n,a);s&&s.per!==1&&a.push({code:`notBase`,path:`${o}.base`,value:s.name}),unitReference(t.assumed,e,`${o}.assumed`,n,a);let c=rangeOf(t.range,`${o}.range`,a);typeof t.integral!=`boolean`&&a.push({code:`notBoolean`,path:`${o}.integral`,value:t.integral}),typeof t.iso!=`boolean`&&a.push({code:`notBoolean`,path:`${o}.iso`,value:t.iso});let l=phrasesOf(t.hints,`${o}.hints`,a);return claimHints(e,l,r,i,a),typeof t.base==`string`?{name:e,base:t.base,assumed:typeof t.assumed==`string`?t.assumed:null,hints:l,range:c,integral:t.integral===!0,iso:t.iso===!0}:null}function longestOf(e){return Math.max(1,...[...e].map(e=>e.split(` `).length))}function loadUnits(e,t){if(!isRecord(e))throw new Hl([{code:`notObject`,path:`$`}]);let n=[];e.version!==Ll&&n.push({code:`version`,path:`version`,value:e.version}),isRecord(e.dimensions)||n.push({code:`notObject`,path:`dimensions`}),Array.isArray(e.units)||n.push({code:`notList`,path:`units`});let r=new Set(isRecord(e.dimensions)?Object.keys(e.dimensions):[]),i=(Array.isArray(e.units)?e.units.map((e,t)=>unitOf(e,t,r,n)):[]).filter(e=>e!==null),a=unitsByName(i,n),o=wordsOf(i,gl,n),s=new Map,c=new Map;if(isRecord(e.dimensions))for(let[r,i]of Object.entries(e.dimensions)){let e=dimensionOf(r,i,a,t,s,n);e&&c.set(r,e)}if(n.length>0)throw new Hl(n);return{dimensions:c,units:a,words:o,hints:s,longestWord:longestOf(o.keys()),longestHint:longestOf(s.keys())}}var Ul=loadUnits(Il,gl);function keysBySegment(e,t){let n=new Map;for(let r of unitsOf(e,t))n.set(r.segment,[...n.get(r.segment)??[],r.key]);return[...n.keys()].sort((e,t)=>e-t).map(e=>n.get(e)??[])}function matchesOf(e,t){let n=[],r=0;for(;r<e.length;){let i=longestMatchAt(e,r,t);i?(n.push(i),r=i.end+1):r+=1}return n}function longestMatchAt(e,t,n){for(let r=Math.min(n.longestWord,e.length-t);r>=1;--r){let i=n.words.get(keySequence(e.slice(t,t+r)));if(i)return{unit:i,start:t,end:t+r-1}}return null}function hintAtHead(e,t){for(let n=Math.min(t.longestHint,e.length);n>=1;--n){let r=t.hints.get(keySequence(e.slice(e.length-n)));if(r)return r}return null}function distinctUnits(e){return[...new Map(e.map(e=>[e.unit.name,e.unit])).values()]}function explicitReading(e,t,n,r){return{unit:e,unitExplicit:!0,unitAtHead:t,dimension:e.dimension,head:n,words:r}}function hintedReading(e,t,n,r){let i=t.dimensions.get(e)?.assumed;return{unit:i?t.units.get(i)??null:null,unitExplicit:!1,unitAtHead:!1,dimension:e,head:n,words:r}}function readName(e,t,n){let r=keysBySegment(e,n),i=r.at(-1)??[],a=i.at(-1)??null,o=matchesOf(i,t),s=new Set(o.flatMap(e=>Array.from({length:e.end-e.start+1},(t,n)=>e.start+n))),c=[...r.slice(0,-1).flat(),...i.filter((e,t)=>!s.has(t))],l=o.find(e=>e.end===i.length-1);if(l)return explicitReading(l.unit,!0,a,c);let u=hintAtHead(i,t),d=distinctUnits(o.filter(e=>u===null||e.unit.dimension===u));return d.length===1?explicitReading(d[0],!1,a,c):u===null?{unit:null,unitExplicit:!1,unitAtHead:!1,dimension:null,head:a,words:c}:hintedReading(u,t,a,c)}var Wl={identity:`kindIdentity`,convert:`kindConvert`,wholeMinorUnits:`kindWholeMinorUnits`,isoDuration:`kindIsoDuration`,durationText:`kindDurationText`,constant:`kindConstant`,numberFromText:`kindNumberFromText`,textFromValue:`kindTextFromValue`,durationFromText:`kindDurationFromText`},Gl=/^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/,Kl=/^P(?!$)(?:\d+(?:\.\d+)?[YMWD])*(?:T(?=\d)(?:\d+(?:\.\d+)?[HMS])+)?$/;function isIsoDuration(e){return Kl.test(e)}function feelNameOf(e){return Gl.test(e)?e:e.trim()===``||e.includes("`")?null:`\`${e}\``}var ql=e(e=>Number(e.toPrecision(12)),`roundedOf`);function scaled(e,t){if(t===1)return e;let n=ql(t);if(Number.isInteger(n))return`${e} * ${n}`;let r=ql(1/t);return Number.isInteger(r)?`${e} / ${r}`:`${e} * ${n}`}function overlapOf(e,t){let n=new Set(e),r=new Set(t),i=new Set([...n,...r]);return i.size===0?0:[...n].filter(e=>r.has(e)).length/i.size}function accepts(e,t){return e===null||t===null||e===t||e===`string`&&(t===`duration`||t===`date`)}function transformOf(e,t){let n=t.factor??null,r=t.constant??null,i=featureValues({[Wl[t.kind]]:1,sourceUnitExplicit:e.source.unitExplicit&&e.source.unit!==null?1:0,targetUnitExplicit:e.target.unitExplicit&&e.target.unit!==null?1:0,targetUnitAtHead:+!!e.target.unitAtHead,logFactor:n===null?0:ql(Math.log10(n)),dimensionKnown:e.target.dimension===null?0:1,nameOverlap:e.overlap,constantInDiagram:+(r?.origin===`diagram`),constantInProject:+(r?.origin===`project`)});return{kind:t.kind,expression:t.expression,resultFamily:t.resultFamily,from:t.from?.name??null,to:t.to?.name??null,factor:n,constant:r?.text??null,constantOrigin:r?.origin??null,features:i}}function identityOf(e){return transformOf(e,{kind:`identity`,expression:e.sourceName,resultFamily:e.sourceFamily})}function convertsOf(e){let{source:t,target:n,sourceName:r,sourceFamily:i,targetFamily:a,table:o}=e;if(t.unit===null||n.unit===null||t.unit.name===n.unit.name||t.unit.dimension!==n.unit.dimension||i!==null&&i!==`number`||!accepts(`number`,a))return[];let s=t.unit.per/n.unit.per,c=scaled(r,s),l=transformOf(e,{kind:`convert`,expression:c,resultFamily:`number`,from:t.unit,to:n.unit,factor:s});return o.dimensions.get(n.unit.dimension)?.integral===!0?[l,transformOf(e,{kind:`wholeMinorUnits`,expression:`decimal(${c}, 0)`,resultFamily:`number`,from:t.unit,to:n.unit,factor:s})]:[l]}function isIsoDimension(e,t){return e!==null&&t.dimensions.get(e)?.iso===!0}function isoDurationsOf(e){let{source:t,target:n,sourceName:r,targetFamily:i,table:a}=e;if(t.unit===null||!isIsoDimension(t.unit.dimension,a)||n.dimension!==t.unit.dimension||!accepts(`string`,i))return[];let o=a.units.get(a.dimensions.get(t.unit.dimension)?.base??``),s=t.unit.iso??o?.iso??null;if(s===null||o===void 0)return[];let c=t.unit.iso===null?t.unit.per/o.per:1;return[transformOf(e,{kind:`isoDuration`,expression:[JSON.stringify(s.prefix),`string(${scaled(r,c)})`,JSON.stringify(s.designator)].join(` + `),resultFamily:`string`,from:t.unit,to:o,factor:c})]}function typedTextsOf(e){let{sourceName:t,sourceFamily:n,targetFamily:r}=e,i=[];return n===`string`&&r===`number`&&i.push(transformOf(e,{kind:`numberFromText`,expression:`number(${t})`,resultFamily:`number`})),n!==null&&[`number`,`boolean`,`date`].includes(n)&&r===`string`&&i.push(transformOf(e,{kind:`textFromValue`,expression:`string(${t})`,resultFamily:`string`})),n===`duration`&&r===`string`&&i.push(transformOf(e,{kind:`durationText`,expression:`string(${t})`,resultFamily:`string`})),n===`string`&&r===`duration`&&i.push(transformOf(e,{kind:`durationFromText`,expression:`duration(${t})`,resultFamily:`duration`})),i}function constantsOf(e,t){return!isIsoDimension(e.target.dimension,e.table)||!accepts(`string`,e.targetFamily)?[]:[...new Map(t.filter(e=>isIsoDuration(e.text)).map(e=>[`${e.origin} ${e.text}`,e])).values()].map(t=>transformOf(e,{kind:`constant`,expression:JSON.stringify(t.text),resultFamily:`string`,constant:t}))}function transformsFor(e,t=Ul,n=gl){let r=feelNameOf(e.source.name);if(r===null)return[];let i=readName(e.source.name,t,n),a=readName(e.target.name,t,n),o={source:i,target:a,sourceName:r,sourceFamily:familyOf(e.source.type,n),targetFamily:familyOf(e.target.type,n),overlap:overlapOf(i.words,a.words),table:t};return[identityOf(o),...convertsOf(o),...isoDurationsOf(o),...typedTextsOf(o),...constantsOf(o,e.constants)]}var compact=e=>e.replace(/\s+/g,``);function historyOf(e,t=Ul,n=gl){let headOf=e=>readName(e,t,n).head,keyOf=(e,t,n)=>[e.kind,e.from,e.to,headOf(t),headOf(n)].join(`|`),r=new Map;for(let i of e){let e=compact(i.expression),a=transformsFor({source:{name:i.source,type:null},target:{name:i.target,type:null},constants:[]},t,n).find(t=>compact(t.expression)===e);if(a===void 0)continue;let o=keyOf(a,i.source,i.target);r.set(o,(r.get(o)??0)+1)}return{countOf:(e,t,n)=>r.get(keyOf(e,t,n))??0}}var roundedOf=e=>Number(e.toPrecision(12));function variablesOf(e,t){return e.split(`.`).reduceRight((e,t)=>({[t]:e}),t)}function typeMatches(e,t){if(t===null)return null;switch(t){case`number`:return typeof e==`number`&&Number.isFinite(e);case`string`:case`date`:return typeof e==`string`;case`duration`:return typeof e==`string`&&isIsoDuration(e);case`boolean`:return typeof e==`boolean`;case`list`:return Array.isArray(e)}}function saneOf(e,t,n){let r=t.to===null?void 0:n.units.get(t.to);if(r===void 0||typeof e!=`number`)return 1;let i=n.dimensions.get(r.dimension)?.range??null;return i===null?+(e>=0):+(e>=i[0]/r.per&&e<=i[1]/r.per)}function plausibleSource(e,t,n){if(e.from===null||typeof t.sample!=`number`)return!0;let r=n.units.get(e.from),i=r===void 0?null:n.dimensions.get(r.dimension)?.range??null;if(r===void 0||i===null)return!0;let a=t.sample*r.per;return a>=i[0]&&a<=i[1]}function dryRun(e,t,n,r){let i=e.kind===`constant`?{}:variablesOf(t.name,t.sample),a=xn(e.expression,i);if(a.status!==`value`||a.warnings.length>0)return null;let o=typeMatches(a.value,n);return o===!1?null:{result:a.value,features:{...e.features,typeMatch:+(o===!0),typeUnknown:+(o===null),resultSane:saneOf(a.value,e,r)}}}function candidatesOf(e,t=Ul,n=gl){let r=familyOf(e.target.type,n),i=new Set;return e.sources.flatMap(a=>transformsFor({source:a,target:e.target,constants:e.constants},t,n).flatMap(n=>{if(i.has(n.expression)||n.kind!==`constant`&&a.sample===void 0||!plausibleSource(n,a,t))return[];i.add(n.expression);let o=dryRun(n,a,r,t);if(o===null)return[];let s=e.history.countOf(n,a.name,e.target.name);return[{value:n.expression,origin:`transform`,source:a.name,features:{...o.features,projectFrequency:roundedOf(Math.log1p(s))},transform:n,result:o.result}]}))}var Jl=new Set([`convert`,`wholeMinorUnits`]);function typicalSampleOf(e,t=Ul,n=gl){return readName(e,t,n).unit?.sample}function numericOf(e,t,n){if(!Jl.has(e))return!1;let r=t.dimension!==null&&n.dimensions.get(t.dimension)?.integral===!0;return e===`wholeMinorUnits`?r:!r}function admits(e,t,n,r){let{kind:i}=e.transform;if(i===`identity`||e.features.resultSane!==1)return!1;let a=readName(e.source,n,r);return a.dimension===null||a.dimension!==t.dimension?!1:numericOf(i,t,n)?!0:!t.unitExplicit&&!Jl.has(i)}function recogniseExpression(e,t=Ul,n=gl){if(e.target.name.trim()===``)return null;let r=readName(e.target.name,t,n),i=new Map;for(let a of e.sources)for(let o of candidatesOf({...e,sources:[a]},t,n))admits(o,r,t,n)&&!i.has(o.value)&&i.set(o.value,o);return i.size===1?[...i.values()][0]:null}function recognitionOf(e){let{transform:t}=e;return{source:e.source,kind:t.kind,from:t.from,to:t.to,factor:t.factor,constant:t.constant,constantOrigin:t.constantOrigin}}function timerTextsIn(e,t){for(let n of e?.eventDefinitions??[]){if(n?.$type!==`bpmn:TimerEventDefinition`)continue;let e=typeof n.timeDuration?.body==`string`?n.timeDuration.body.trim():``;isIsoDuration(e)&&t.push(e)}(e?.flowElements??[]).forEach(e=>timerTextsIn(e,t))}function timerTextsOf(e){let t=[];return(e?.rootElements??[]).filter(e=>e.$type===`bpmn:Process`).forEach(e=>timerTextsIn(e,t)),t}function labelKeyOf(e){return nameWordsOf(e).join(` `)}function peerOutputsOf(e){return e.flatMap(e=>{let t=new Map;return e.mappings.filter(e=>e.direction!==`input`&&e.target!==null).forEach(e=>t.set(e.elementId,[...t.get(e.elementId)??[],e.target])),[...t].map(([t,n])=>({diagram:e.path,elementId:t,label:e.elementNames.get(t)??``,outputs:n}))})}var Yl=new Set([`input`,`loop element`]);function decisionOutputsOf(e){return new Map([...e].map(e=>[e.id,[...e.outputs]]))}function taskTypeOutputsOf(e){let t=new Map;for(let n of e){let e=t.get(n.workerKey)??new Map;e.set(n.diagram,new Set([...e.get(n.diagram)??[],...n.outputs])),t.set(n.workerKey,e)}return new Map([...t].map(([e,t])=>[e,[...new Set([...t.values()].flatMap(e=>[...e]))]]))}function scopeOf(e,t,n,r){return Ct({model:{variables:[...r]},order:e.order,types:[...t.types],inputs:[...t.inputs??[]]},n,{wholeProcess:!0}).variables}function writersOf(e){return[...new Set(e.writers.map(e=>e.elementId))]}function collect$2(e){let t=new Map;for(let[n,r,i,a]of e){let e=t.get(n)??{type:null,owners:new Set,origins:new Set};t.set(n,{type:e.type??r,owners:new Set([...e.owners,...i]),origins:new Set([...e.origins,a])})}return[...t].map(([e,{type:t,owners:n,origins:r}])=>({id:e,name:e,type:t,owners:[...n],origins:[...r]}))}e(collect$2,`collect`);function inputSourcePool(e,t,n,r){let i=scopeOf(e,t,n,e.variables.filter(e=>e.elementId!==n||e.where!==`input`)).map(e=>[e.name,e.type,writersOf(e),`scope`]),a=r===void 0||r===``?[]:[[r,null,[],`identity`]];return collect$2([...i,...a,...readInProject(t)])}function readInProject(e){return[...(e.reads??new Map).keys()].map(e=>[e,null,[],`readInProject`])}function outputNamePool(e,t,n,r){let i=new Set(scopeOf(e,t,n,e.variables).map(e=>e.name)),a=e.variables.filter(e=>e.writes&&e.elementId===n&&e.where===`script`).map(e=>[e.name,null,[n],`script`]),o=r.contractWrites.map(e=>[e,null,[n],`contract`]),s=e.decisionUses.filter(e=>e.elementId===n).flatMap(e=>t.decisionOutputs.get(e.decisionId)??[]).map(e=>[e,null,[],`decision`]),c=e.variables.filter(t=>!t.writes&&t.where!==`output`&&t.elementId!==n&&Rn(e.order,n,t.elementId)&&!i.has(t.name)).map(e=>[e.name,null,[],`downstream`]),l=[...new Set((r.workerKeys??[]).flatMap(e=>t.taskTypeOutputs?.get(e)??[]))].map(e=>[e,null,[],`taskType`]),u=e.variables.filter(e=>e.writes&&e.elementId!==n&&!Yl.has(e.where)).map(e=>[e.name,null,[],`sibling`]),d=labelKeyOf(r.label??``),f=d===``?[]:(t.peers??[]).filter(e=>labelKeyOf(e.label)===d).flatMap(e=>e.outputs).map(e=>[e,null,[],`peerLabel`]),p=(r.composed??[]).map(e=>[e,null,[],`composed`]),m=[...c,...l,...u,...f];return collect$2([...o,...a,...s,...m,...p,...readInProject(t)])}function capitalisationOf(e){let t=e.replace(/[^\p{L}]/gu,``);if(t===``||t===t.toLowerCase())return`lower`;if(t===t.toUpperCase())return`upper`;let n=t.charAt(0),r=t.slice(1);return n===n.toUpperCase()&&r===r.toLowerCase()?`capital`:`mixed`}function signatureOf(e){let t=[...e.matchAll(bl)];if(t.length===0)return null;let n=capitalisationOf(t[0][0]);if(t.length===1)return{separator:``,first:n,rest:null};let r=t[0].index+t[0][0].length;return{separator:e.slice(r,t[1].index),first:n,rest:capitalisationOf(t[1][0])}}function signatureKey(e){return`${e.separator}|${e.first}|${e.rest??`null`}`}function compareText$2(e,t){return e<t?-1:+(e>t)}e(compareText$2,`compareText`);function styleDistributionOf(e){let t=new Map,n=0;for(let r of e){let e=signatureOf(r);if(e===null||e.rest===null)continue;n+=1;let i=signatureKey(e),a=t.get(i);t.set(i,{signature:e,count:(a?.count??0)+1})}return[...t].sort(([e,t],[n,r])=>r.count-t.count||compareText$2(e,n)).map(([,e])=>({signature:e.signature,share:e.count/n}))}function firstCapitalisationOf(e){let t=new Map,n=0;for(let r of e){let e=signatureOf(r);e!==null&&(n+=1,t.set(e.first,(t.get(e.first)??0)+1))}if(n===0)return null;let[r,i]=[...t].sort(([e,t],[n,r])=>r-t||compareText$2(e,n))[0];return{capitalisation:r,share:i/n}}function renderWord(e,t){return t===`upper`?e.toUpperCase():t===`capital`?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e.toLowerCase()}function renderName(e,t){return e.map((e,n)=>renderWord(e,n===0?t.first:t.rest??`lower`)).join(t.separator)}var Xl=1,Zl=1e-12,Ql=.5,$l=4,eu=3;function normal(e){return e.toLowerCase()}function uniqueOf(e){return[...new Set(e.map(normal))]}function countIn(e,t){return e!==void 0&&Object.hasOwn(e,t)?e[t]:0}function compareText$1(e,t){return e<t?-1:+(e>t)}e(compareText$1,`compareText`);function tokenPosteriorOf(e,t){let n=Object.keys(e.names),r=new Map;if(n.length===0)return r;let i=uniqueOf(t),a=Math.max(1,Object.keys(e.labels).length),o=n.reduce((t,n)=>t+e.names[n],0),s=new Map;for(let t of n){let r=e.names[t],c=Math.log((r+Xl)/(o+Xl*n.length));for(let n of i){let i=(countIn(Object.hasOwn(e.joint,n)?e.joint[n]:void 0,t)+Xl)/(r+Xl*a),o=(countIn(e.labels,n)+Xl)/(e.pairs+Xl*a);c+=Math.log(i)-Math.log(o)}s.set(t,c)}let c=Math.max(...s.values()),l=0;for(let[e,t]of s){let n=Math.exp(t-c);r.set(e,n),l+=n}for(let[e,t]of r)r.set(e,t/l);return r}function associationOf(e,t,n){if(n.length===0)return 0;let r=tokenPosteriorOf(e,t),i=n.map(e=>Math.log(Math.max(r.get(normal(e))??0,Zl)));return Math.exp(i.reduce((e,t)=>e+t,0)/i.length)}function meanPositionOf(e,t){let n=Object.hasOwn(e.position,t)?e.position[t]:void 0;return n===void 0?Ql:n.sum/n.count}function subsetsOf(e,t){let n=[],grow=(r,i)=>{if(i.length>0&&n.push([...i]),i.length!==t)for(let t=r;t<e.length;t+=1)i.push(e[t]),grow(t+1,i),i.pop()};return grow(0,[]),n}function composeNames(e,t,n,r={}){let i=r.maxTokens??eu,a=r.pool??$l,o=firstCapitalisationOf(n);if(o===null||t.length===0)return[];let[s]=styleDistributionOf(n);return subsetsOf([...tokenPosteriorOf(e,t)].sort(([e,t],[n,r])=>r-t||compareText$1(e,n)).slice(0,a).map(([e])=>e),i).flatMap(n=>{let r=[...n].sort((t,n)=>meanPositionOf(e,t)-meanPositionOf(e,n)||compareText$1(t,n)),i=associationOf(e,t,r);return r.length===1?[{value:renderName(r,{separator:``,first:o.capitalisation,rest:null}),tokens:r,association:i,styleShare:o.share}]:s===void 0?[]:[{value:renderName(r,s.signature),tokens:r,association:i,styleShare:s.share}]})}var tu={weightedOverlap:`share of the weight of the words the query and the candidate have in common, over the weight of the words either has; a word weighs by how rarely the project uses it`,softTfidf:`the matcher's soft TF-IDF similarity of the two names: a word that nearly matches another word of the other name counts as a match, weighted as the overlap is`,headEqual:`1 when the query and the candidate name the same head concept, else 0`,tailEqual:`1 when the last content word of the two names is the same concept, else 0`,jaroWinkler:`Jaro-Winkler similarity of the two names lower-cased and stripped of separators`,trigramCosine:`cosine of the character trigram counts of the two names stripped of separators`,lengthRatio:`the shorter over the longer length of the two names stripped of separators`,nameLength:`the length of the candidate name stripped of separators, over 32 and capped at 1`,casingAgrees:`1 when the query and the candidate are written in the same casing style (snake, kebab, camel, pascal, lower, upper, other), else 0`,ownerStripped:`1 when an element id prefix that owns the candidate was removed before matching, else 0`,typeKnown:`1 when the candidate has a known type, else 0`,typeNumber:`1 when the candidate type belongs to the number family of the lexicon, else 0`,readsInProject:`how often the project reads the candidate name outside its own writes, as n over n plus one`,siblingOverlap:`the largest weighted overlap of the candidate's words with the name of each field the same element already gave a name to, earlier in the document, over the weight of the words either has; 0 when there is none`,slotPosition:`the position of the field among the element's fields of the same kind, earlier fields first, over the number of such fields`,slotCount:`the number of the element's fields of the same kind, over eight and capped at 1`,originContract:`1 when the candidate is written by the element's own worker code`,originScript:`1 when the candidate is written by the element's own script body`,originDecision:`1 when the candidate is an output column of a decision the element calls`,originDownstream:`1 when a later element reads the candidate and nothing before this element writes it`,originScope:`1 when the candidate is in scope at the element: written by an element upstream on every path`,originTaskType:`1 when the same task or job type writes the candidate in another diagram of the project`,labelAssociation:`how well the name model's words for the element's label go with the candidate's words: the geometric mean over the candidate's words of the probability the name model gives each word for that label, between 0 and 1; 0 without a name model or a label`},nu=[`weightedOverlap`,`softTfidf`,`headEqual`,`tailEqual`,`jaroWinkler`,`trigramCosine`,`lengthRatio`,`nameLength`,`casingAgrees`,`ownerStripped`,`typeKnown`,`typeNumber`,`readsInProject`,`siblingOverlap`,`slotPosition`,`slotCount`,`originContract`,`originScript`,`originDecision`,`originDownstream`,`originScope`,`originTaskType`,`labelAssociation`],ru=tu;nu.map(e=>({name:e,definition:ru[e]}));var iu=[`contract`,`script`,`decision`,`downstream`,`scope`,`taskType`],au={contract:`originContract`,script:`originScript`,decision:`originDecision`,downstream:`originDownstream`,scope:`originScope`,taskType:`originTaskType`},ou={reads:new Map,siblings:[],position:0,count:0},su=32,cu=8;function casingOf(e){return e.includes(`_`)?`snake`:e.includes(`-`)?`kebab`:/^[A-Za-z0-9]+$/.test(e)?e===e.toLowerCase()?`lower`:e===e.toUpperCase()?`upper`:/^[A-Z]/.test(e)?`pascal`:`camel`:`other`}var lu=/[^\p{L}\p{N}]+/gu;function normalForm(e){return e.toLowerCase().replace(lu,``)}function trigramCounts(e){let t=new Map,n=e.length<3?[e]:Array.from({length:e.length-2},(t,n)=>e.slice(n,n+3));for(let e of n)t.set(e,(t.get(e)??0)+1);return t}var uu=0xe8d4a51000;function rounded(e){return Math.round(e*uu)/uu}function trigramCosine(e,t){if(e===``||t===``)return 0;let n=trigramCounts(e),r=trigramCounts(t),i=0;for(let[e,t]of n)i+=t*(r.get(e)??0);let norm=e=>Math.sqrt([...e.values()].reduce((e,t)=>e+t*t,0));return rounded(i/(norm(n)*norm(r)))}function weightedOverlap(e,t,n){let r=new Set(e),i=new Set(t),weigh=e=>[...e].reduce((e,t)=>e+n.weight(t),0),a=weigh(new Set([...r,...i]));return a===0?0:weigh([...r].filter(e=>i.has(e)))/a}function lastContentKey(e){let t=e.filter(e=>e.role===`content`);return t.length===0?null:t[t.length-1].key}function labelAssociationOf(e,t){if(e.nameModel===void 0||e.label===void 0)return 0;let n=[...nameWordsOf(e.label),...e.workerWords??[]];return n.length===0?0:rounded(associationOf(e.nameModel,n,nameWordsOf(t)))}function siblingOverlapOf(e,t,n){if(t.siblings.length===0)return 0;let r=analyse(e,n).units.map(e=>e.key),i=t.siblings.map(e=>weightedOverlap(r,analyse(e,n).units.map(e=>e.key),n));return rounded(Math.max(...i))}function softTfidf(e,t,n){return rounded(match(e,[t],{vocabulary:n,scoring:`soft`}).ranked[0]?.score??0)}function featuresOf(e,t,n,r=ou){let i=matchTextOf(t),a=analyse(e,n),o=analyse(i,n),s=normalForm(e),c=normalForm(i),l=Math.max(s.length,c.length),u=lastContentKey(a.units),d=lastContentKey(o.units),f=r.reads.get(t.name)??0,p={weightedOverlap:rounded(weightedOverlap(a.units.map(e=>e.key),o.units.map(e=>e.key),n)),softTfidf:softTfidf(e,t,n),headEqual:+!!a.head.keys.some(e=>o.head.keys.includes(e)),tailEqual:+(u!==null&&u===d),jaroWinkler:s===``||c===``?0:rounded(jaroWinkler$1(s,c)),trigramCosine:trigramCosine(s,c),lengthRatio:l===0?0:rounded(Math.min(s.length,c.length)/l),nameLength:rounded(Math.min(1,c.length/su)),casingAgrees:+(casingOf(e)===casingOf(i)),ownerStripped:i===t.name?0:1,typeKnown:t.type===null?0:1,typeNumber:+(familyOf(t.type,n.lexicon)===`number`),readsInProject:rounded(f/(f+1)),siblingOverlap:siblingOverlapOf(i,r,n),slotPosition:r.count===0?0:rounded(r.position/r.count),slotCount:rounded(Math.min(r.count,cu)/cu),originContract:0,originScript:0,originDecision:0,originDownstream:0,originScope:0,originTaskType:0,labelAssociation:labelAssociationOf(r,i)};for(let e of t.origins??[])iu.includes(e)&&(p[au[e]]=1);return p}function workerWordsOf(e){return e.flatMap(e=>nameWordsOf(e.slice(e.indexOf(`:`)+1).split(`.`).pop()??``))}function labelWordsOf(e,t){return[...nameWordsOf(e),...workerWordsOf(t)]}var du=[`contract`,`script`,`decision`];function originOf(e){return e.some(e=>du.includes(e))?`fact`:e.length>0&&e.every(e=>e===`composed`)?`composed`:`pool`}function readsElsewhereOf(e,t,n){let r=new Map(t.reads);return e.variables.filter(e=>e.elementId===n&&!e.writes&&e.where!==`output`).forEach(e=>{let t=(r.get(e.name)??0)-1;t>0?r.set(e.name,t):r.delete(e.name)}),r}function poolProjectOf(e,t,n){return{types:[...t.types],inputs:t.inputs,decisionOutputs:t.decisionOutputs,taskTypeOutputs:taskTypeOutputsOf(t.taskOutputs.filter(t=>t.diagram!==e.path)),peers:(t.peers??[]).filter(t=>t.diagram!==e.path),reads:readsElsewhereOf(e,t,n)}}function nameOf$8(e,t){return e.elementNames.get(t)??``}e(nameOf$8,`nameOf`);function workerKeysOf(e,t){return e.workerKeys.get(t)??[]}function composedOf(e,t,n){if(t.nameModel===void 0)return[];let r=labelWordsOf(nameOf$8(e,n),workerKeysOf(e,n));if(r.length===0)return[];let i=(t.names??[]).filter(t=>t.diagram!==e.path||t.elementId!==n).map(e=>e.name);return composeNames(t.nameModel,r,i).map(e=>e.value)}function queryOf(e,t,n){return e===`output-name`?nameOf$8(t,n.elementId):n.field}function poolOf(e,t,n,r){let i=t,a=poolProjectOf(t,n,r.elementId);return e===`output-name`?outputNamePool(i,a,r.elementId,{contractWrites:t.codeWrites.get(r.elementId)??[],workerKeys:t.workerKeys.get(r.elementId)??[],label:nameOf$8(t,r.elementId),composed:composedOf(t,n,r.elementId)}):inputSourcePool(i,a,r.elementId,e===`input-source`?r.field:void 0)}function nameOfSlot(e,t){return t?e.target===null?[]:[e.target]:e.variable===null?[]:[e.variable]}function slotOf(e,t){let n=t.task===`output-name`,r=e.mappings.filter(e=>e.elementId===t.elementId&&e.direction!==`input`===n&&e.target!==null),i=r.findIndex(e=>e.target===t.field);return{given:(i<0?r:r.slice(0,i)).flatMap(e=>nameOfSlot(e,n)),position:i<0?r.length:i,count:i<0?r.length+1:r.length}}function requestPoolOf(e,t,n){let r=poolOf(n.task,e,t,n);if(n.task===`expression`)return r;let i=new Set(slotOf(e,n).given);return r.filter(e=>!i.has(e.name))}function contextOf$1(e,t,n){let r=slotOf(e,n);return{reads:readsElsewhereOf(e,t,n.elementId),siblings:r.given,position:r.position,count:r.count,label:nameOf$8(e,n.elementId),workerWords:workerWordsOf(workerKeysOf(e,n.elementId)),nameModel:t.nameModel}}e(contextOf$1,`contextOf`);function sourceOf$1(e,t,n,r){return{task:e,candidates(i){let a=queryOf(e,t,i);if(a===``)return[];let o=contextOf$1(t,n,i);return requestPoolOf(t,n,i).map(e=>({value:e.name,origin:originOf(e.origins??[]),features:featuresOf(a,e,r,o)}))}}}e(sourceOf$1,`sourceOf`);var fu=[`output-name`,`input-source`,`expression`];function candidateSourcesOf(e,t,n){return fu.map(r=>sourceOf$1(r,e,t,n))}var pu=8,mu=e(e=>e.filter(e=>typeof e==`string`&&e!==``),`present`);function namesOf$1(e,t){return[...mu(t.map(e=>e.name)),...mu(e.workers.map(e=>e.value)),...mu(e.processes.map(e=>e.id)),...mu(e.calls.map(e=>e.calledProcessId)),...mu(e.decisions.map(e=>e.id)),...mu(e.decisionUses.map(e=>e.decisionId))]}e(namesOf$1,`namesOf`);function codeUseOf(e){return{name:e.name,writes:e.writes,elementId:e.elementId,where:e.where,type:e.type??null}}function codeWritesOf(e){let t=new Map;for(let n of e)n.writes&&t.set(n.elementId,[...t.get(n.elementId)??[],n.name]);return t}function workerKeysByElement(e){let t=new Map;for(let n of e.workers)t.set(n.elementId,[...t.get(n.elementId)??[],`${n.kind}:${n.value}`]);return t}function diagramOf$1(e,t,n){let r=new Set(t.model.workers.map(e=>e.elementId)),i=(n?.variables??[]).filter(e=>r.has(e.elementId)).map(codeUseOf),a=[...t.model.variables,...i];return{path:e,kind:t.kind,model:t.model,order:t.order,mappings:t.mappings,elementNames:new Map(t.model.elements.filter(e=>e.name?.trim()).map(e=>[e.id,e.name])),variables:a,decisionUses:t.model.decisionUses,codeWrites:codeWritesOf(i),workerKeys:workerKeysByElement(t.model),names:namesOf$1(t.model,a),timers:t.timers}}e(diagramOf$1,`diagramOf`);function taskEntriesOf(e){return e.mappings.filter(e=>e.direction!==`input`&&e.target!==null).flatMap(t=>(e.workerKeys.get(t.elementId)??[]).map(n=>({diagram:e.path,elementId:t.elementId,workerKey:n,outputs:[t.target]})))}function readsOf(e){let t=new Map;for(let n of e)for(let e of n.variables)!e.writes&&e.where!==`output`&&t.set(e.name,(t.get(e.name)??0)+1);return t}function byPath(e,t){return e.path<t.path?-1:+(e.path>t.path)}function uniqueFiles(e,t){let n=new Map;for(let r of e.filter(e=>Bn(e.path)===`bpmn`||Bn(e.path)===`dmn`).sort(byPath))n.has(r.text)&&r.path!==t||n.set(r.text,r);return[...n.values()].sort(byPath)}async function parseFile(e){let t=Bn(e.path);if(t!==`bpmn`&&t!==`dmn`)return null;try{let n=t===`bpmn`?await On(e.text):null;return t===`bpmn`&&n===null?null:{kind:t,model:await Q(e.path,e.text),order:n?Mn(n):new Map,mappings:n?mappingsOf(n):[],timers:n?timerTextsOf(n):[]}}catch{return null}}function vocabularyOf(e){let t=new Vocabulary(gl);return e.forEach(e=>t.replaceSource(e.path,e.names)),t}var SuggestionContextBuilder=class{cache=new Map;async build(e,t=null,n={}){let r=uniqueFiles(e,n.focus),i=new Set(r.map(e=>e.path));for(let e of[...this.cache.keys()])i.has(e)||this.cache.delete(e);let a=[],o=Date.now();for(let e of r){let t=await this.parse(e);t!==null&&a.push({path:e.path,file:t}),n.pause&&Date.now()-o>=pu&&(await n.pause(),o=Date.now())}let s=a.map(({path:e,file:n})=>diagramOf$1(e,n,t)),c=s.filter(e=>e.kind===`bpmn`);return{diagrams:s,project:{types:t?.types??[],...t?.variableChecks?{inputs:t.variableChecks.inputs}:{},decisionOutputs:decisionOutputsOf(s.flatMap(e=>e.model.decisions)),taskOutputs:c.flatMap(taskEntriesOf),peers:peerOutputsOf(c.map(e=>({path:e.path,elementNames:e.elementNames,mappings:e.mappings}))),names:c.flatMap(e=>e.variables.map(t=>({name:t.name,diagram:e.path,elementId:t.elementId}))),reads:readsOf(s),timers:c.flatMap(e=>e.timers.map(t=>({diagram:e.path,text:t})))},vocabulary:vocabularyOf(s)}}async parse(e){let t=this.cache.get(e.path);if(t!==void 0&&t.text===e.text)return t.parsed;let n=await parseFile(e);return this.cache.set(e.path,{text:e.text,parsed:n}),n}};function ownMappingsOf(e,t){if(t.field===``)return[];let n=t.task!==`output-name`;return e.mappings.filter(e=>e.elementId===t.elementId&&e.target===t.field&&e.direction===`input`===n)}function spentOf(e){let t=e.direction===`input`?Tn(e.expression??``):[];return[...new Set([...e.variable===null?[]:[e.variable],...t,...e.target===null?[]:[e.target]])]}function requestSpentOf(e,t){return[...new Set(ownMappingsOf(e,t).flatMap(spentOf))]}function inRequestScope(e,t,n,r,i){let a=e.diagrams.find(e=>e.path===t);if(a===void 0)throw RangeError(`focus:${t}`);e.vocabulary.replaceSource(t,withoutOccurrences(a.names,requestSpentOf(a,n)));try{return i({diagram:a,project:{...e.project,nameModel:r},vocabulary:e.vocabulary})}finally{e.vocabulary.replaceSource(t,a.names)}}function nameVerdictOf(e,t){let n=queryOf(t.task,e.diagram,t);if(n===``)return{confident:!1,reason:`none`};let r=match(n,requestPoolOf(e.diagram,e.project,t),{vocabulary:e.vocabulary});return{confident:r.confident,reason:r.reason}}function candidatesOfRequest(e,t){return candidateSourcesOf(e.diagram,e.project,e.vocabulary).find(e=>e.task===t.task)?.candidates(t)??[]}function expressionContextOf(e,t){let n=requestPoolOf(e.diagram,e.project,t).filter(e=>e.origins?.includes(`scope`)).map(e=>({name:e.name,type:e.type,sample:typicalSampleOf(e.name)})),r=(e.project.timers??[]).map(t=>({text:t.text,origin:t.diagram===e.diagram.path?`diagram`:`project`}));return{sources:n,target:{name:t.field,type:null},constants:r,history:historyOf([])}}function withoutOccurrences(e,t){let n=new Map;return e.forEach(e=>n.set(e,(n.get(e)??0)+1)),t.forEach(e=>n.set(e,(n.get(e)??0)-1)),[...n].filter(([,e])=>e>0).map(([e])=>e)}function cyrb53(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}function schemaHashOf(e){return cyrb53(e.join(`
|
|
11
|
+
`)).toString(16).padStart(14,`0`)}var RankerModelError=class extends Error{problems;constructor(e){super(e.map(e=>`${e.path}:${e.code}`).join(`, `)),this.name=new.target.name,this.problems=e}};function fail(e,t){throw new RankerModelError([{path:e,code:t}])}function recordOf$1(e,t){return(typeof e!=`object`||!e||Array.isArray(e))&&fail(t,`not-an-object`),e}e(recordOf$1,`recordOf`);function listOf$1(e,t){return Array.isArray(e)||fail(t,`not-a-list`),e}e(listOf$1,`listOf`);function numberOf(e,t){return typeof e==`number`&&Number.isFinite(e)||fail(t,`not-a-number`),e}function integerOf(e,t,n,r){let i=numberOf(e,t);return(!Number.isInteger(i)||i<n||i>r)&&fail(t,`not-an-index`),i}function numbersOf(e,t,n){let r=listOf$1(e,t);return r.length!==n&&fail(t,`wrong-length`),r.map((e,n)=>numberOf(e,`${t}[${n}]`))}function parseScorer(e,t,n){let r=recordOf$1(e,n);if(r.family===`logistic`)return{family:`logistic`,mean:numbersOf(r.mean,`${n}.mean`,t),scale:numbersOf(r.scale,`${n}.scale`,t),low:numbersOf(r.low,`${n}.low`,t),high:numbersOf(r.high,`${n}.high`,t),weights:numbersOf(r.weights,`${n}.weights`,t)};r.family!==`trees`&&fail(n,`unknown-family`);let i=listOf$1(r.trees,`${n}.trees`).map((e,r)=>{let i=listOf$1(recordOf$1(e,`${n}.trees[${r}]`).nodes,`${n}.trees[${r}].nodes`);return{nodes:i.map((e,a)=>{let o=recordOf$1(e,`${n}.trees[${r}].nodes[${a}]`),s=o.feature===-1;return{feature:s?-1:integerOf(o.feature,`${n}.feature`,0,t-1),threshold:numberOf(o.threshold,`${n}.threshold`),left:s?-1:integerOf(o.left,`${n}.left`,0,i.length-1),right:s?-1:integerOf(o.right,`${n}.right`,0,i.length-1),value:numberOf(o.value,`${n}.value`)}})}});return{family:`trees`,base:numberOf(r.base,`${n}.base`),trees:i}}function parseCalibration(e,t){let n=recordOf$1(e,t);if(n.kind===`platt`)return{kind:`platt`,slope:numberOf(n.slope,`${t}.slope`),intercept:numberOf(n.intercept,`${t}.intercept`)};n.kind!==`isotonic`&&fail(t,`unknown-kind`);let r=listOf$1(n.upTo,`${t}.upTo`).map((e,n)=>numberOf(e,`${t}.upTo[${n}]`)),i=numbersOf(n.value,`${t}.value`,r.length);return r.some((e,t)=>t>0&&e<r[t-1])&&fail(`${t}.upTo`,`out-of-order`),{kind:`isotonic`,upTo:r,value:i}}var hu=[`probability`,`margin`,`precision`,`lowerBound`,`coverage`,`shown`,`items`,`repositories`];function parseThreshold(e,t){if(e===null)return null;let n=recordOf$1(e,t);return Object.fromEntries(hu.map(e=>[e,numberOf(n[e],`${t}.${e}`)]))}function parseOutOfFold(e,t){let n=recordOf$1(e,t);n.family!==`logistic`&&n.family!==`trees`&&fail(`${t}.family`,`unknown-family`);let r=recordOf$1(n.logLossByFamily,`${t}.logLossByFamily`),i={};for(let e of[`logistic`,`trees`])r[e]!==void 0&&(i[e]=numberOf(r[e],`${t}.logLossByFamily.${e}`));return{family:n.family,items:numberOf(n.items,`${t}.items`),candidates:numberOf(n.candidates,`${t}.candidates`),logLoss:numberOf(n.logLoss,`${t}.logLoss`),brier:numberOf(n.brier,`${t}.brier`),logLossByFamily:i}}function parseSettings(e,t){let n=recordOf$1(e,t),optional=(e,n)=>e===null?null:numberOf(e,`${t}.${n}`);return{penalty:optional(n.penalty,`penalty`),rounds:optional(n.rounds,`rounds`)}}function parseTask(e,t,n){let r=recordOf$1(e,n);return{scorer:parseScorer(r.scorer,t,`${n}.scorer`),calibration:parseCalibration(r.calibration,`${n}.calibration`),threshold:parseThreshold(r.threshold,`${n}.threshold`),settings:parseSettings(r.settings,`${n}.settings`),outOfFold:parseOutOfFold(r.outOfFold,`${n}.outOfFold`)}}function parseRankerModel(e){let t=recordOf$1(e,`file`);t.format!==1&&fail(`format`,`unsupported-format`);let n=listOf$1(t.features,`features`).map((e,t)=>(typeof e!=`string`&&fail(`features[${t}]`,`not-a-name`),e));t.schemaHash!==schemaHashOf(n)&&fail(`schema`,`schema-mismatch`);let r=recordOf$1(t.tasks,`tasks`),i=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,parseTask(t,n.length,`tasks.${e}`)])),a={format:1,features:n,schemaHash:schemaHashOf(n),provenance:recordOf$1(t.provenance,`provenance`),tasks:i};return t.names===void 0?a:{...a,names:recordOf$1(t.names,`names`)}}var gu=parseRankerModel({format:1,features:[`casingAgrees`,`headEqual`,`jaroWinkler`,`labelAssociation`,`lengthRatio`,`nameLength`,`originContract`,`originDecision`,`originDownstream`,`originScope`,`originScript`,`originTaskType`,`ownerStripped`,`readsInProject`,`siblingOverlap`,`slotCount`,`slotPosition`,`softTfidf`,`tailEqual`,`trigramCosine`,`typeKnown`,`typeNumber`,`weightedOverlap`],schemaHash:`1bf62edc3e6ada`,provenance:JSON.parse(`{"trainer":"suggestions-ranker/3","repositories":68,"items":1293,"candidates":73932,"folds":4,"families":["logistic","trees"],"repositoryCap":0.15,"penalties":[0.0001,0.001,0.01,0.1,1,10],"rounds":[25,50,100],"innerFolds":3,"directions":{"weightedOverlap":1,"softTfidf":1,"headEqual":1,"tailEqual":1,"jaroWinkler":1,"trigramCosine":1,"lengthRatio":1,"casingAgrees":1,"readsInProject":1,"originContract":1,"originScript":1,"originDecision":1,"originDownstream":1,"originScope":1,"originTaskType":1,"labelAssociation":1},"dataset":{"name":"ranking-dev-capped.jsonl","hash":"294c2721cd91caf3339f21eebb3cc05b084aba2f1d53fc84d40eee29c80775c9"},"date":"2026-10-15","shipping":{"rule":{"minimumShown":30,"minimumRepositories":5,"maximumRepositoryShare":0.3,"minimumLowerBound":0.5,"baselines":["current-matcher","same-last-word"],"margins":[0,0.01,0.02,0.05,0.1,0.15,0.2,0.3],"bootstrap":{"draws":2000,"seed":20261015,"level":0.95}},"scores":"a2dde04e0b1f3f998b08c2572f6024dbc5059ce5c4353980653ddacce66e20c9","tasks":{"expression":{"items":40,"repositories":15,"baselines":[{"source":"current-matcher","shown":5,"correct":0},{"source":"same-last-word","shown":10,"correct":0}],"candidate":null,"nested":{"reading":{"shown":0,"correct":0,"precision":null,"macro":null,"repositories":0,"largestShare":0,"interval":{"low":0,"high":1}},"cuts":[{"group":"DigiBP/digibp-camunda-examples","cut":null,"shown":0,"correct":0},{"group":"al66/imicros-core","cut":null,"shown":0,"correct":0},{"group":"aleksander-dytko/camunda-ai-agent-testing","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/bpmn-driven-testing","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-7-to-8-migration","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/pdf-merge-split-connector","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda7-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda8-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-consulting/camunda-7-code-examples","cut":null,"shown":0,"correct":0},{"group":"d-velop/example-bpmn-processes","cut":null,"shown":0,"correct":0},{"group":"holunda-io/bpm-ai-connectors-camunda-8","cut":null,"shown":0,"correct":0},{"group":"operaton/operaton","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2025-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2026-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"upgradingdave/camunda-deep-dives","cut":null,"shown":0,"correct":0}]},"shipped":false,"inSample":null},"input-source":{"items":431,"repositories":42,"baselines":[{"source":"current-matcher","shown":394,"correct":180},{"source":"same-last-word","shown":308,"correct":134}],"candidate":null,"nested":{"reading":{"shown":0,"correct":0,"precision":null,"macro":null,"repositories":0,"largestShare":0,"interval":{"low":0,"high":1}},"cuts":[{"group":"BPMNscript/bpmnscript","cut":null,"shown":0,"correct":0},{"group":"EximeeBPMS/eximeebpms-examples","cut":null,"shown":0,"correct":0},{"group":"Grom33/micronaut-zeebe","cut":null,"shown":0,"correct":0},{"group":"Miragon/consulting","cut":null,"shown":0,"correct":0},{"group":"NicolasCola7/MSA-Project","cut":null,"shown":0,"correct":0},{"group":"OrqueIO/OrqueIO","cut":null,"shown":0,"correct":0},{"group":"UST-QuAntiL/QuantME-UseCases","cut":null,"shown":0,"correct":0},{"group":"al66/imicros-core","cut":null,"shown":0,"correct":0},{"group":"aleksander-dytko/camunda-ai-agent-testing","cut":null,"shown":0,"correct":0},{"group":"bcgov/digital-journeys","cut":null,"shown":0,"correct":0},{"group":"berndruecker/flowing-retail","cut":null,"shown":0,"correct":0},{"group":"btrajkovski/camunda-example","cut":null,"shown":0,"correct":0},{"group":"camunda-academy/c8-custom-outbound-connectors-lab","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/Camunda-7-User-and-Tenant-Creator","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/bpmn-driven-testing","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-7-to-8-migration","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/pdf-merge-split-connector","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/process-orchestration-for-santa","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/pyzeebe","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda7-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/vanillabp-camunda8-adapter","cut":null,"shown":0,"correct":0},{"group":"camunda-community-hub/zeebe-cherry-runtime","cut":null,"shown":0,"correct":0},{"group":"camunda-consulting/bpmn-cmmn-example","cut":null,"shown":0,"correct":0},{"group":"camunda-consulting/camunda-7-code-examples","cut":null,"shown":0,"correct":0},{"group":"camunda/camunda-bpm-examples","cut":null,"shown":0,"correct":0},{"group":"camunda/camunda-bpm-platform","cut":null,"shown":0,"correct":0},{"group":"camunda/zeebe-chaos","cut":null,"shown":0,"correct":0},{"group":"ganeshkumargunaseelan-web/camunda-fnol-automation","cut":null,"shown":0,"correct":0},{"group":"holunda-io/bpm-ai-connectors-camunda-8","cut":null,"shown":0,"correct":0},{"group":"holunda-io/c7","cut":null,"shown":0,"correct":0},{"group":"operaton/operaton","cut":null,"shown":0,"correct":0},{"group":"operaton/operaton-examples","cut":null,"shown":0,"correct":0},{"group":"paed01/bpmn-engine","cut":null,"shown":0,"correct":0},{"group":"quarkiverse/quarkus-camunda","cut":null,"shown":0,"correct":0},{"group":"renatoctorres/template-spring-kotlin-camunda-8","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2025-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"saig0/ccon-2026-cpt-demo","cut":null,"shown":0,"correct":0},{"group":"thanhtai9606/camunda-sample","cut":null,"shown":0,"correct":0},{"group":"upgradingdave/camunda-deep-dives","cut":null,"shown":0,"correct":0},{"group":"viadee/c8-kubeflow-outbound-connector","cut":null,"shown":0,"correct":0},{"group":"viadee/vPAV","cut":null,"shown":0,"correct":0},{"group":"wkspower/wks-platform","cut":null,"shown":0,"correct":0}]},"shipped":false,"inSample":null},"output-name":{"items":822,"repositories":60,"baselines":[{"source":"current-matcher","shown":66,"correct":30},{"source":"same-last-word","shown":87,"correct":29}],"candidate":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5405405405405406,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"nested":{"reading":{"shown":121,"correct":91,"precision":0.7520661157024794,"macro":0.5662393162393162,"repositories":26,"largestShare":0.33884297520661155,"interval":{"low":0.4915254237288136,"high":0.8926829268292683}},"cuts":[{"group":"313hemant313/camunda-order-workflow","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7247706422018348,"lowerBound":0.5274725274725275,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":2},{"group":"BPMNscript/bpmnscript","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.719626168224299,"lowerBound":0.5205479452054794,"coverage":0.13017031630170317,"shown":107,"items":822,"repositories":26},"shown":4,"correct":4},{"group":"DigiBP/digibp-camunda-classroom","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7431192660550459,"lowerBound":0.5531914893617021,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":0},{"group":"DigiBP/digibp-camunda-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"DigiBP/digibp-saentis","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"EximeeBPMS/eximeebpms-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"Grom33/micronaut-zeebe","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5376344086021505,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"Miragon/consulting","cut":{"probability":0.26854415173172386,"margin":0.2,"precision":0.7247706422018348,"lowerBound":0.5263157894736842,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"OrqueIO/OrqueIO","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7142857142857143,"lowerBound":0.5,"coverage":0.12773722627737227,"shown":105,"items":822,"repositories":26},"shown":6,"correct":6},{"group":"Tinkoff/camunda-delegator-lib","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5333333333333333,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"UST-QuAntiL/QuantME-UseCases","cut":null,"shown":0,"correct":0},{"group":"al66/imicros-core","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7425742574257426,"lowerBound":0.524390243902439,"coverage":0.12287104622871046,"shown":101,"items":822,"repositories":26},"shown":10,"correct":6},{"group":"aleksander-dytko/camunda-ai-agent-testing","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7452830188679245,"lowerBound":0.546875,"coverage":0.12895377128953772,"shown":106,"items":822,"repositories":26},"shown":5,"correct":2},{"group":"audit-kwazar-0/camunda8-tutorial","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5393258426966292,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"bcgov/digital-journeys","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5393258426966292,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"berndruecker/camunda-csharp-showcase","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5393258426966292,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"berndruecker/customer-onboarding-camunda-8-springboot-extended","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5362318840579711,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"berndruecker/trip-booking-saga-serverless","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5421686746987951,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"bpm-crafters/process-engine-worker","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5421686746987951,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"btrajkovski/camunda-example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5492957746478874,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"camunda-community-hub/Make-Rest-Calls-From-Camunda-7-Example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-7-to-8-migration","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/camunda-8-benchmark","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/pdf-merge-split-connector","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5357142857142857,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/process-orchestration-for-santa","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7247706422018348,"lowerBound":0.5142857142857142,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":2},{"group":"camunda-community-hub/pyzeebe","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5277777777777778,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-community-hub/zeebe-cherry-runtime","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7314814814814815,"lowerBound":0.5256410256410257,"coverage":0.13138686131386862,"shown":108,"items":822,"repositories":26},"shown":3,"correct":2},{"group":"camunda-consulting/bpmn-cmmn-example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5319148936170213,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"camunda-consulting/camunda-7-code-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7142857142857143,"lowerBound":0.5,"coverage":0.12773722627737227,"shown":105,"items":822,"repositories":26},"shown":6,"correct":6},{"group":"camunda/camunda-bpm-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5441176470588235,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"camunda/camunda-bpm-platform","cut":null,"shown":0,"correct":0},{"group":"camunda/zeebe-chaos","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7570093457943925,"lowerBound":0.5733333333333334,"coverage":0.13017031630170317,"shown":107,"items":822,"repositories":26},"shown":4,"correct":0},{"group":"d-velop/example-bpmn-processes","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5338983050847458,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"datakurre/operaton-python","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7339449541284404,"lowerBound":0.5344827586206896,"coverage":0.13260340632603407,"shown":109,"items":822,"repositories":26},"shown":2,"correct":1},{"group":"emaarco/easy-zeebe","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5333333333333333,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"envite-consulting/camunda-carbon-reductor","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.75,"lowerBound":0.5679012345679012,"coverage":0.13138686131386862,"shown":108,"items":822,"repositories":26},"shown":3,"correct":0},{"group":"ganeshkumargunaseelan-web/camunda-fnol-automation","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.75,"lowerBound":0.5679012345679012,"coverage":0.13138686131386862,"shown":108,"items":822,"repositories":26},"shown":3,"correct":0},{"group":"gerdreiss/learning-camunda","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"holunda-io/bpm-ai-connectors-camunda-8","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"holunda-io/c7","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"jhmfreitas/Enterprise-Integration","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"kwazar-0/credit-scoring-camunda","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"nhomble/zeebe-mock","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5324675324675324,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"operaton/operaton","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7156862745098039,"lowerBound":0.5079365079365079,"coverage":0.12408759124087591,"shown":102,"items":822,"repositories":26},"shown":9,"correct":8},{"group":"operaton/operaton-examples","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7352941176470589,"lowerBound":0.5245901639344263,"coverage":0.12408759124087591,"shown":102,"items":822,"repositories":26},"shown":9,"correct":6},{"group":"paed01/bpmn-engine","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5360824742268041,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"philips-labs/workflow-capability","cut":{"probability":0.22685999372172555,"margin":0.2,"precision":0.6666666666666666,"lowerBound":0.5,"coverage":0.10948905109489052,"shown":90,"items":822,"repositories":27},"shown":41,"correct":41},{"group":"quarkiverse/quarkus-camunda","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"renatoctorres/template-spring-kotlin-camunda-8","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"rob2universe/camunda-http-connector-example","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"saig0/ccon-2025-cpt-demo","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5267857142857143,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"saig0/ccon-2026-cpt-demo","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5333333333333333,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"saig0/exploding-bpmn","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5230769230769231,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"salaboy/zeebe-knative-worker","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.527027027027027,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"thanhtai9606/camunda-sample","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5344827586206896,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"tobiasschaefer/token-run","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5268817204301075,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"underwaise/underwaise","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7363636363636363,"lowerBound":0.5346534653465347,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":0},{"group":"upgradingdave/camunda-deep-dives","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5222222222222223,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1},{"group":"viadee/vPAV","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5285714285714286,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"shown":0,"correct":0},{"group":"wkspower/wks-platform","cut":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7272727272727273,"lowerBound":0.5238095238095238,"coverage":0.13381995133819952,"shown":110,"items":822,"repositories":26},"shown":1,"correct":1}]},"shipped":true,"inSample":{"shown":49,"correct":38}}}}}`),tasks:JSON.parse(`{"expression":{"scorer":{"family":"trees","base":8.267391142697759e-17,"trees":[{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":6.054748532776218e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.06583617921402614},{"feature":2,"threshold":0.778858274079,"left":3,"right":4,"value":-0.11569260454933475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.14505626899592075},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0354333114455719},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04482598165819095},{"feature":4,"threshold":0.36181818181799996,"left":7,"right":8,"value":0.15548814253039592},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04482598165819095},{"feature":2,"threshold":0.4217083842085,"left":9,"right":10,"value":0.1655928888008516},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10520943522952128},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.17664202177712054}]},{"nodes":[{"feature":13,"threshold":0.775,"left":1,"right":6,"value":1.3675614541016841e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0698626923210247},{"feature":15,"threshold":0.1875,"left":3,"right":4,"value":-0.12746093242423598},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.054298717143490695},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1757514101236366},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01886349813725459},{"feature":5,"threshold":0.265625,"left":7,"right":10,"value":0.10758968859552354},{"feature":2,"threshold":0.4217083842085,"left":8,"right":9,"value":0.12565277920678625},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01886349813725459},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1415106043801704},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01886349813725459}]},{"nodes":[{"feature":13,"threshold":0.775,"left":1,"right":6,"value":2.6678986267644406e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.05907722684967324},{"feature":15,"threshold":0.1875,"left":3,"right":4,"value":-0.11214268697277222},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.047914698852020314},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15772415972746953},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016313289268731587},{"feature":5,"threshold":0.265625,"left":7,"right":10,"value":0.09170380538713935},{"feature":2,"threshold":0.4217083842085,"left":8,"right":9,"value":0.10943073451045149},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016313289268731587},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12462324990754528},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016313289268731587}]},{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":-1.9957523359099204e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.04082737410409882},{"feature":2,"threshold":0.778858274079,"left":3,"right":4,"value":-0.07975970864516202},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10381973675560248},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.024539512073525938},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030680684498110143},{"feature":4,"threshold":0.36181818181799996,"left":7,"right":8,"value":0.10218874310031348},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030680684498110143},{"feature":2,"threshold":0.4217083842085,"left":9,"right":10,"value":0.11197622455332142},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07132845452571578},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12206891202133635}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.5304991228069454e-17},{"feature":4,"threshold":0.36181818181799996,"left":2,"right":5,"value":0.02201516311973511},{"feature":0,"threshold":0.5,"left":3,"right":4,"value":-0.11645900804470605},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15062138238689649},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03781835649527586},{"feature":13,"threshold":0.8660714285715,"left":6,"right":7,"value":0.040822295054154085},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0074224687419105935},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10437987365058682},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15814875613306975}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":2.9713529139169335e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":0.020245446120921686},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.000767123217373158},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07132841413775429},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06226693259546233},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12530098840829848},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.14918929510261905}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":2.101799823062333e-17},{"feature":4,"threshold":0.377976190476,"left":2,"right":5,"value":0.01865213521714104},{"feature":3,"threshold":0.005051149207,"left":3,"right":4,"value":-0.09172183717314492},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12408202610081552},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02724380556307886},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":0.03723422604698675},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07874625396740045},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.006093636046154119},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1417327320946171}]},{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":2.2653924992795168e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.02993021298783017},{"feature":15,"threshold":0.1875,"left":3,"right":4,"value":-0.06011255211849803},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.017802174267668083},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11815682325242334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024508203583161865},{"feature":4,"threshold":0.43650793650749997,"left":7,"right":8,"value":0.07894662015414874},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024508203583161865},{"feature":16,"threshold":0.1,"left":9,"right":10,"value":0.09602576639614435},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06026698498965309},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10827630608251607}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.531232261210572e-17},{"feature":4,"threshold":0.377976190476,"left":2,"right":5,"value":0.01723180551446997},{"feature":3,"threshold":0.005051149207,"left":3,"right":4,"value":-0.08141142524122971},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11281192364734388},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.024043980740193444},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":0.03332346376084276},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06989269817244774},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.003509841254715202},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13471208598072895}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.5350447175324978e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":0.015804674645728895},{"feature":15,"threshold":0.5,"left":3,"right":4,"value":-0.008895403589325659},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024449305451237125},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10785874649579599},{"feature":4,"threshold":0.43650793650749997,"left":6,"right":7,"value":0.07477816147795889},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.032941378944316306},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08848925850799229},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1299383699196339}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-7.62735239830658e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":0.014691018998753459},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.0015406719132875434},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.051442384665431586},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048756955361077894},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09905458263544137},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12569485003652645}]},{"nodes":[{"feature":4,"threshold":0.40833333333349997,"left":1,"right":6,"value":2.887248966101442e-17},{"feature":3,"threshold":0.005051149207,"left":2,"right":5,"value":-0.08562601051969777},{"feature":16,"threshold":0.5357142857145001,"left":3,"right":4,"value":-0.11538940890535457},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13167120311982822},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07417344491158707},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.032957480917819436},{"feature":5,"threshold":0.171875,"left":7,"right":10,"value":0.019711048684059342},{"feature":13,"threshold":0.775,"left":8,"right":9,"value":0.06466927233863475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03811298848449726},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08867955642349613},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":-0.018757446235743495},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.032957480917819436},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0468794069550239}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-3.9665361177041975e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":0.013133214419439546},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.000993804844724828},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04430525196605736},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04469808115754506},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09038996715981995},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12094989182359579}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-3.332227901328767e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.012240524634110184},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.003385423756669881},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05308662869789155},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04807112460445418},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.08396437359540133},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1346048497361991},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0560226277788786},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1188773445206888}]},{"nodes":[{"feature":4,"threshold":0.40833333333349997,"left":1,"right":8,"value":-1.796310785975084e-17},{"feature":16,"threshold":0.242857142857,"left":2,"right":5,"value":-0.07729526442572342},{"feature":0,"threshold":0.5,"left":3,"right":4,"value":-0.11720474628736498},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1323451263582729},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0693243516524631},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":-0.030270303298066438},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10132375277057437},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030270303298066438},{"feature":5,"threshold":0.171875,"left":9,"right":12,"value":0.01675465782959051},{"feature":13,"threshold":0.8819444444444999,"left":10,"right":11,"value":0.05838619491686077},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04199509775809052},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0905658651370276},{"feature":3,"threshold":9.03e-10,"left":13,"right":14,"value":-0.018115611114124307},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030270303298066438},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04185951312224993}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.0367271421787465e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.010647511430556006},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.00045977713154789733},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.034379494512112856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04022416912960887},{"feature":3,"threshold":7.66205e-8,"left":6,"right":7,"value":0.10378019308498627},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0023736092422712296},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.13853291702390733},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11322148032931197}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":8.176193639454762e-18},{"feature":13,"threshold":0.775,"left":2,"right":5,"value":-0.014198463901135045},{"feature":5,"threshold":0.328125,"left":3,"right":4,"value":-0.048995727264441624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10468660658213186},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00916319343044962},{"feature":2,"threshold":0.4217083842085,"left":6,"right":7,"value":0.03066934040354251},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00916319343044962},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035001205265726636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08420087443259025}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.254476324009266e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.010032795120815816},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.005018971445616344},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03305454799811655},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05246008688037741},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.0733077865255627},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1143826918147528},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.047351415474944876},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11097838860695249}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":1.6825903510808226e-18},{"feature":13,"threshold":0.775,"left":2,"right":5,"value":-0.012670389081347154},{"feature":5,"threshold":0.265625,"left":3,"right":4,"value":-0.04512064048290898},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11104739965453288},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.008547768137605232},{"feature":2,"threshold":0.4217083842085,"left":6,"right":7,"value":0.028025104207698655},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.008547768137605232},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03225080150879153},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07717199209892983}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":4.928145208017401e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.009252307899984784},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":-0.0013074138243490225},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08174942901298127},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01485716709192777},{"feature":3,"threshold":7.66205e-8,"left":6,"right":7,"value":0.08954473335637386},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0017372372118366346},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11884099037489862},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10805172411673623}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":5.1234748455884885e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.008294670709749933},{"feature":13,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.021978575029050904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05197194083346945},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013861961765050937},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04970249855915278},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10769966782805394}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.3025608921142894e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.008363888630456406},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.006505824472621011},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04542122230022665},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030748918316639447},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.06739300560222952},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1033535916946698},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04234009238684914},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1060668373554648}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":-9.401821304366014e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0076601843249156495},{"feature":13,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.021175817218263903},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04891016286634864},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013137290834476139},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04745039888721618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10256098209934528}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-8.707954538058852e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0075251593656691295},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":-0.0035602741070779316},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07778220734902049},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011421565641899948},{"feature":3,"threshold":7.66205e-8,"left":6,"right":7,"value":0.08704510351359313},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005552805654992489},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11184433137674121},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10362313679421278}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-2.816032515302123e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.006861850378826058},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":-0.0035129260831480106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07341963810657187},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010334451062259071},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.08088228183533573},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09262949511097848},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06696586847104628},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10202711441734842}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":-3.6402816817745574e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.007181822354263997},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.019068832243241737},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06302285323127103},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013111908915986696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04529265007521513},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09776712250469878}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-2.6129870467424935e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.006313217530095516},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12694737200811035},{"feature":5,"threshold":0.359375,"left":4,"right":5,"value":0.011664828917454809},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.002356988135305538},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07412492527564264},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1005450383188943}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-3.405870151876631e-17},{"feature":13,"threshold":0.8819444444444999,"left":2,"right":5,"value":-0.006649181452248857},{"feature":9,"threshold":0.5,"left":3,"right":4,"value":-0.023866049044128868},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04216727662709658},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009482853352228383},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.04283175574858622},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009482853352228383},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0429456991932576},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09254057983876851}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":2.27220128479038e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.005768119125221676},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12430492058593008},{"feature":5,"threshold":0.359375,"left":4,"right":5,"value":0.010690002464547781},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0014756274962359507},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0709977977851654},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0990057323737948}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-2.4710415128353123e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.006159065948404231},{"feature":9,"threshold":0.5,"left":3,"right":4,"value":-0.02378921519463273},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04331944430282169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005564784632747122},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.0349187844601268},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005564784632747122},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.040750256004473684},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08765957795735174}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.2232772740696998e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.005294934322101872},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.00793612905124165},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02472667752326324},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.045208736277297046},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.0539022885086116},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08877816943346989},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.046781393520270415},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09759411478213223}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":6.007735837985458e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1233250697778158},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.004360168330280591},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.03517634918183817},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1145745099787465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.045168704579628675},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.015060993006501528},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1242088288780902},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015566155255083442}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":-2.5218491858271316e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12007573030737287},{"feature":9,"threshold":0.5,"left":3,"right":6,"value":0.004043512703427689},{"feature":2,"threshold":0.317385620915,"left":4,"right":5,"value":-0.005345727700294244},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08974683937884624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005683614886607962},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06114779465177972}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":2.350308171000531e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.00575801808649618},{"feature":5,"threshold":0.328125,"left":3,"right":4,"value":-0.022540577429660424},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05118449482000351},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005105103932639696},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.032750785294939196},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005105103932639696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.038635364753095175},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08302874759268526}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.6722222018675842e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.005110242250038952},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.003981743192506485},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015276966577183257},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06308517424309677},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.06205088834155437},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08578880112775267},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009659390734301818},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09578127903219996}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":4.441675595006774e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.004658764751228656},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11677343806895715},{"feature":5,"threshold":0.359375,"left":4,"right":5,"value":0.008716264000980944},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0006964304692797908},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.057319065959824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.094237788551945}]},{"nodes":[{"feature":22,"threshold":0.1774227797055,"left":1,"right":6,"value":2.6451444519886713e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.005495894871829305},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.015679012865945863},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05860981783916267},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010801321684859849},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03728165623566556},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08005920734316185}]},{"nodes":[{"feature":4,"threshold":0.377976190476,"left":1,"right":8,"value":1.3551581134217446e-18},{"feature":15,"threshold":0.5,"left":2,"right":5,"value":-0.05195473263097747},{"feature":0,"threshold":0.5,"left":3,"right":4,"value":-0.09078541623235462},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1124436026063837},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.038251487431714415},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":-0.022047387435305623},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06726109586631192},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022047387435305623},{"feature":5,"threshold":0.171875,"left":9,"right":12,"value":0.007859957760365986},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.033876417140003764},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01871008346291222},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0528894911138984},{"feature":3,"threshold":9.03e-10,"left":13,"right":14,"value":-0.01151668585289412},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022047387435305623},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030983712012719274}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-1.0273263359363686e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.005246314539651562},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.02112762420332635},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0054163566847451015},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1028554824744995},{"feature":16,"threshold":0.1,"left":6,"right":7,"value":0.03033857606891261},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00460547593279334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035733791599523286},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0767138977386981}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-3.427726097279986e-17},{"feature":5,"threshold":0.328125,"left":2,"right":5,"value":0.004311223589209733},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.007321239146424005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.038835970732579786},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.020366431895433555},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.04329628954332143},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07301248320483021},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04364499463744836},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0923807447885269}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-9.921719785543194e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.008253646456768507},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.08774829079161311},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12155446463283347},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04263302697643593},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.002482236838741146},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.023104171320871978},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.019831747300230452},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.047917141057229766}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-1.559553501292488e-17},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.005287168006369891},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.026928646631776222},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1452994935192141},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011184945516796219},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.01560971379652624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07459849513968515},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03535078411954087},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0759887362454565}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.756588757959594e-19},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0039487660903079844},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.004093155627539711},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023333854292769952},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02869427055860061},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.050733385264937696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.059707668639745526},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05899801099597535},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08993204747831685}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":6.486048504563046e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10750455536747859},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.0032828898049980237},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.031063961116678918},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0986545522087217},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03980056195833159},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.01368646098503703},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1156644589740321},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012268162169664894}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":6,"value":-6.734138574111558e-18},{"feature":5,"threshold":0.109375,"left":2,"right":3,"value":0.0037770475519204555},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10418048855589526},{"feature":5,"threshold":0.171875,"left":4,"right":5,"value":0.007048445319118653},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.028907667503884696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.007170840729706096},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08861096980774764}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":1.2470499439856705e-17},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.007444451828059348},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.08184526840919303},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11624858582437728},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03982890931579126},{"feature":13,"threshold":0.8660714285715,"left":6,"right":7,"value":0.002187449777610497},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014473276437613702},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01769025516114712},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04282496215035289}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":2.4807484333942544e-17},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.004651894589806949},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.017914720337117118},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.004079338450100427},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09951965694169668},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.02487470358190456},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03255541282927463},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0034799916223936175},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0697627202483552}]},{"nodes":[{"feature":4,"threshold":0.8397435897434999,"left":1,"right":8,"value":1.5755276018977344e-17},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.007552318043939079},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":0.018074676399926368},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1124819876424738},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018074676399926368},{"feature":3,"threshold":9.395250000000001e-8,"left":6,"right":7,"value":-0.02867629584398463},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09686857487352572},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01550609574497734},{"feature":15,"threshold":0.1875,"left":9,"right":12,"value":0.04370167084379251},{"feature":3,"threshold":9.03e-10,"left":10,"right":11,"value":0.07924627546249458},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018074676399926368},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10462119700937478},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018074676399926368}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-1.54834764076083e-17},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.004472160971890671},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.027215749505527756},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13600645681777254},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009336799395438189},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.016087101164666055},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06184763112464491},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03162159060588459},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06771534218365803}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-5.522712623745842e-19},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.003482317537257222},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.005382410628850098},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015974890797185},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.051118914161371126},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.05010104985245875},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05691288928902876},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04968253045484382},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08539825979539128}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":5.883184703947521e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.007624634378507376},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.07902048134873046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11325758238173754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03882757649160573},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.0013653283655190931},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.016874970265860583},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009477887925885244},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04137457491022707}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-2.3776675255736462e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0032441073963956134},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.005030409389972363},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015078182351416891},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04828319187255609},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.04625327572589169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06144533523620324},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0006885274988083345},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08360105828185854}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":6,"value":-2.399349244878928e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.004232225342600378},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.012413207963401106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05280695962771514},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00886352975428899},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03014026747197909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06451276028655481}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-3.15062570816179e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.003026851770665257},{"feature":5,"threshold":0.171875,"left":3,"right":4,"value":-0.004658074507893083},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.019431640690382244},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.025764542049665686},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.04250254485229999},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04915912581440204},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04963036183393196},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08183316343428375}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":-2.1715386448701265e-17},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0948707309409283},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.002739257016191031},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.025922919794962796},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0859402033035092},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03367371736565405},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.01105002677793437},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10757007064965154},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010338046793873432}]},{"nodes":[{"feature":4,"threshold":0.8397435897434999,"left":1,"right":8,"value":-1.7044713404786746e-17},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.0065214241611356825},{"feature":4,"threshold":0.43650793650749997,"left":3,"right":4,"value":0.015452813149234367},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10098705310547632},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015452813149234367},{"feature":3,"threshold":9.395250000000001e-8,"left":6,"right":7,"value":-0.027017820308762226},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08817180320155954},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009114764003300158},{"feature":15,"threshold":0.1875,"left":9,"right":12,"value":0.03742705045960475},{"feature":3,"threshold":9.03e-10,"left":10,"right":11,"value":0.07212728291022169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015452813149234367},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09350398352552775},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015452813149234367}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-8.14426772444846e-19},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.003989201307942102},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.016061687426902053},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00286281271597068},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09655230034787332},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.022337931738541626},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02884486212673708},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.003138122155819765},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.061678925561415715}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":4.930988972290541e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.006599729786984483},{"feature":2,"threshold":0.4536287299445,"left":3,"right":4,"value":-0.03410311680354008},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11350472637653929},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00011725442701311862},{"feature":3,"threshold":9.03e-10,"left":6,"right":7,"value":0.014438426636173896},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10091136247519505},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014438426636173896},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035476583059332344}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-7.566811035557406e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.002872408258180647},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.005239412280029054},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.015624703548585389},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.044826033549406855},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.04135660488283376},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.054784372582948986},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00009808941983554898},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07851915997563072}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":8,"value":-3.984727385730123e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.0039043457407027964},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.0224223092399169},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1229243070546199},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01008492186690493},{"feature":3,"threshold":0.005930202625,"left":6,"right":7,"value":0.011843106958506357},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.004088924513079856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02812127995537429},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06014690565145145}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":8.831360934527712e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.0064938072390250574},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.07055729856408881},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03481915616337397},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10423086460231086},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.0009189862373410317},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013841155171846269},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009320781341330416},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.034176117582716874}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.32987921377419e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0026960367101936233},{"feature":3,"threshold":0.005930202625,"left":3,"right":4,"value":-0.00495117913188698},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01414539328565023},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.040972044052130764},{"feature":15,"threshold":0.75,"left":6,"right":7,"value":0.03823432491066972},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04340169815060646},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.041887459579241004},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07636118949875924}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":6.3175456849469176e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.003656953212194826},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.014930641133971951},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0030092495940377863},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09380781520171522},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.020681257037553413},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02638136948029259},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0028753079517907336},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05641969217277959}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":9.008433670321698e-18},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08327810558034962},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.002418042485550141},{"feature":4,"threshold":0.43650793650749997,"left":4,"right":5,"value":0.024007125645083057},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07214374243498946},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030437079878695445},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.009792573114199375},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10282844542980399},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008308663441077294}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":3.805442811305386e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0025906892582509295},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.004833103023579699},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014645912949949859},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04223716822291243},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.03586992325567945},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048206980001537295},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0018946235819143863},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07446369492000901}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":-2.89570696290555e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.003674172140321676},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.01099250892057766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05003023915658046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00751820017127826},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02602890926313418},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.055731990666589154}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-4.111848153354052e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":5,"value":-0.003426244285540965},{"feature":15,"threshold":0.75,"left":3,"right":4,"value":-0.014364222107252175},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0030247617328909844},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09237992743527039},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.020175115379358316},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.024703417200071},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00290544663605323},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.052833078685682835}]},{"nodes":[{"feature":5,"threshold":0.109375,"left":1,"right":2,"value":-1.115844327715153e-17},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07911509467566216},{"feature":5,"threshold":0.171875,"left":3,"right":6,"value":0.0022672913055511337},{"feature":2,"threshold":0.604107142857,"left":4,"right":5,"value":0.023713852565107704},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012860888917949974},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08380522124821531},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.00963352229372703},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0994483367659489},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006413084203068575}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.1996780925827457e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.002494710223264306},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.0047450109749157445},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014267859683670931},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04024764050375848},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.033723947683226375},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04619571604273703},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.00368645990209291},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07244530012679266}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-3.8201939615613955e-18},{"feature":4,"threshold":0.377976190476,"left":2,"right":5,"value":-0.0061714560121515485},{"feature":3,"threshold":0.005051149207,"left":3,"right":4,"value":-0.06171115472652066},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09560549673298185},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030161664629052235},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.0013878254684159238},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026171518035010184},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012556582726226572},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03128462146460438}]},{"nodes":[{"feature":13,"threshold":0.8660714285715,"left":1,"right":6,"value":1.0018747018744608e-17},{"feature":15,"threshold":0.75,"left":2,"right":5,"value":-0.008712388332220296},{"feature":5,"threshold":0.140625,"left":3,"right":4,"value":0.0018316876450361912},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08573260910192622},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005715854216064819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09098803962043317},{"feature":5,"threshold":0.140625,"left":7,"right":8,"value":0.020144096764349462},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06539846670562789},{"feature":5,"threshold":0.234375,"left":9,"right":10,"value":0.005715854216064819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005715854216064819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04628447629725126}]},{"nodes":[{"feature":2,"threshold":0.778858274079,"left":1,"right":6,"value":1.17673211999304e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0034518682139321045},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.009909868999841979},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0493820860148749},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007004691259228417},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023919251518298813},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05129037125053093}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":6.33383421783981e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.0173615272116098},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0824861405679741},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.027937315563662236},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.003160055889468608},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03748714932789992},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.009778354626605918},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.09537508951646817},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10277105827330527},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.033331170007570264},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":0.004186278611745333},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05459085821819368},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017722501148695887}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":1.2096768229221714e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.002409187068312851},{"feature":13,"threshold":0.775,"left":3,"right":4,"value":-0.005034152111967342},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.024927383112201766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014883962513969297},{"feature":15,"threshold":0.1875,"left":6,"right":7,"value":0.03245358188534128},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.043311356076348714},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.001173921821751427},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06976203566437202}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":6,"value":1.4109270157969207e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.003364585159796306},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.009873325058498725},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.046093794890263766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006876269983398044},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023625865025294814},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.050616315210385655}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":8.557186261881517e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.017635165775452648},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07944331023277638},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.027519156263797792},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0025379573483543597},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0364005319255018},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.009972990261554966},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.09263269121339085},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09969763662864671},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03237876254198541},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":0.0027058060914608487},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.051166744462804475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014924477064909883}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-2.578438577662298e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.01675317000535929},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0769122038514431},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.025964342430428236},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.003161963590045354},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03463442580446993},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.00951069870490593},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.0903182648086374},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09689445075047554},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.028677076011367614},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":0.002288823652980513},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.013038641666624249},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04023416286143663}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":-9.304603924314294e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.003278634715368778},{"feature":4,"threshold":0.5683229813665001,"left":3,"right":4,"value":-0.010884190272006353},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03865302316888919},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012923660907595001},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.02242535141704674},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.022917066034392787},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06630054925940114},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04911276678415485}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":1.6232984263506177e-17},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.016302397001596407},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07379096151325627},{"feature":15,"threshold":0.3125,"left":4,"right":5,"value":0.024757951961782806},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0035662372435479326},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03305172397187652},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.009328030290707242},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.08783499634968255},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09494431827147884},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02886333140435478},{"feature":3,"threshold":9.03e-10,"left":11,"right":12,"value":0.0016744473091128643},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04698578092322431},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012618366378627413}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":1.6735724835095066e-17},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.0031485568033019873},{"feature":4,"threshold":0.5683229813665001,"left":3,"right":4,"value":-0.010614811088787856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03585584919448514},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011104027816035705},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.021705784323871574},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.022168990506016055},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06434804475108286},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04748653781533366}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":5.145062008479144e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.015734270199378533},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.004458655579155277},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10073634434718014},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02923353577967172},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08416831397064913},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.00904491210107204},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.08550543411218292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09213049313194399},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02529569963125628},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":0.0012768902982304652},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.013645987827684714},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03886929075472165}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-8.038236018113453e-19},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.01545384359761547},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0688965411479687},{"feature":16,"threshold":0.5357142857145001,"left":4,"right":5,"value":0.02302079023086808},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02824708469200886},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.020035964931746465},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008877565365968437},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.08304781051151076},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08999259788042464},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.023827588684830026},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":0.0007360102583719563},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.012812664250775586},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03514530200535713}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":9.895265792166276e-18},{"feature":15,"threshold":0.3125,"left":2,"right":5,"value":-0.00524737348056456},{"feature":3,"threshold":9.03e-10,"left":3,"right":4,"value":0.01035278746041293},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.037980645220400566},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01035278746041293},{"feature":13,"threshold":0.8166666666665,"left":6,"right":7,"value":-0.027342734927182158},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10000199401578147},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01035278746041293},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.025952948401391136}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":7.960031071772683e-19},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.006574076571013674},{"feature":2,"threshold":0.6131883394385,"left":3,"right":4,"value":0.014505501675267452},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0035593722053460976},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08078204838563069},{"feature":3,"threshold":0.005930202625,"left":6,"right":7,"value":-0.024793520798867815},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05590834903448107},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.061074161170862465},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.021516762842710948},{"feature":16,"threshold":0.46428571428550003,"left":10,"right":11,"value":0.033017812869242075},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.021627508543673943},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07313468620339944},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06223294896826392}]},{"nodes":[{"feature":5,"threshold":0.390625,"left":1,"right":8,"value":-1.2403535582713082e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":0.0020338383181124414},{"feature":4,"threshold":0.8397435897434999,"left":3,"right":4,"value":-0.006061564874971136},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01567065977135991},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03658390254861139},{"feature":16,"threshold":0.46428571428550003,"left":6,"right":7,"value":0.030485186486573664},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01971873374545705},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06824294069952153},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06081097556425724}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":3.778219921260663e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.014673746521918786},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.0042885940331298025},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09661497502815336},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.027200271494730068},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07840653166034023},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008491234649883102},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.07920696306021319},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08661216047997287},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0207273833517679},{"feature":4,"threshold":0.8397435897434999,"left":11,"right":12,"value":0.0001692261242986526},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.011531905617912508},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03745750669556632}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-2.5685134638232312e-18},{"feature":4,"threshold":0.43650793650749997,"left":2,"right":3,"value":0.014708059428255713},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06342009367971733},{"feature":16,"threshold":0.5357142857145001,"left":4,"right":5,"value":0.021596117848586067},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.026825954646608127},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.019319259411466394},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008472901242117567},{"feature":15,"threshold":0.9375,"left":8,"right":9,"value":-0.07652491349774794},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08436052780302726},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.018967442762906742},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":-0.0004145550632518106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.012597044708891936},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.030925236453306405}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":-1.2311346465547566e-17},{"feature":5,"threshold":0.265625,"left":2,"right":5,"value":-0.006310275814543323},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":0.005082643815017221},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026115926058933647},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.021544865648046578},{"feature":4,"threshold":0.8397435897434999,"left":6,"right":7,"value":-0.04118554570014258},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1151358425695027},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05508905533117019},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.020041220710164877},{"feature":15,"threshold":0.75,"left":10,"right":11,"value":0.030061604076159668},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.034051272897768735},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.032827290887207775},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05825568157856551}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":4.012076570487409e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.005601534867613283},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.06838042115218407},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03360203821874975},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09639769618888143},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.001176344714684547},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010843361647291671},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.009693142812499542},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.027288258162197262}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":7.393129091300645e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.013954674494160697},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.004095409178376075},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0932542342109269},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.025290759350931277},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07453684386033367},{"feature":5,"threshold":0.234375,"left":7,"right":10,"value":-0.008127485293581368},{"feature":2,"threshold":0.6131883394385,"left":8,"right":9,"value":-0.07448891022702457},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08119747777005228},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01770710743989013},{"feature":13,"threshold":0.8166666666665,"left":11,"right":12,"value":-0.0005067613277426546},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.012119030152196739},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.029550241800021027}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":6.580043923307925e-19},{"feature":15,"threshold":0.3125,"left":2,"right":5,"value":-0.004900634025368914},{"feature":3,"threshold":9.03e-10,"left":3,"right":4,"value":0.009489012122432939},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03433777283999386},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009489012122432939},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":-0.02646877306435624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009489012122432939},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06793658062867855},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02387865827023492}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":1.1730213898776507e-18},{"feature":5,"threshold":0.265625,"left":2,"right":5,"value":-0.00630978551013654},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":0.004639861427958263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026991851830757287},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.020829114477187195},{"feature":4,"threshold":0.8397435897434999,"left":6,"right":7,"value":-0.03999130327959927},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11240244438925835},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05138396273545662},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.019180455671766267},{"feature":15,"threshold":0.1875,"left":10,"right":11,"value":0.028353655276762632},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03767924226857067},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0017553092438237945},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.055211220425563604}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-2.223136644076449e-18},{"feature":2,"threshold":0.317385620915,"left":2,"right":5,"value":-0.0048735919208117845},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":-0.06571697563661788},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0321140303517747},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09288689231578812},{"feature":5,"threshold":0.140625,"left":6,"right":7,"value":0.001488914933068451},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009423870172035248},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.008644452025214402},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.023721332264882208}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":1.8592405844657973e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.00260152484350587},{"feature":13,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.010422565455193796},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.028653150013908713},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.015127165734591053},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.01862194417774754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01862194417774754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05172876890154754},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03984541319900117}]},{"nodes":[{"feature":9,"threshold":0.5,"left":1,"right":8,"value":-1.3190259535196778e-17},{"feature":15,"threshold":0.3125,"left":2,"right":5,"value":-0.004500940116456366},{"feature":3,"threshold":9.03e-10,"left":3,"right":4,"value":0.008679328094494176},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.031669933615484494},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008679328094494176},{"feature":13,"threshold":0.8166666666665,"left":6,"right":7,"value":-0.025770747166799127},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09654824999522611},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008679328094494176},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.021859596305444772}]},{"nodes":[{"feature":19,"threshold":0.268063016521,"left":1,"right":8,"value":9.793409648455251e-18},{"feature":5,"threshold":0.359375,"left":2,"right":5,"value":-0.0025924237492034527},{"feature":4,"threshold":0.5683229813665001,"left":3,"right":4,"value":-0.010591548634280946},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.031889669717421014},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00860223848739979},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.018142550626816904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.018142550626816904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05000807402923766},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.038877525002837365}]},{"nodes":[{"feature":5,"threshold":0.171875,"left":1,"right":6,"value":-3.0631333672392573e-18},{"feature":2,"threshold":0.6131883394385,"left":2,"right":5,"value":0.013215467856163815},{"feature":15,"threshold":0.3125,"left":3,"right":4,"value":0.0032625085403549903},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08823495111556927},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02295949356022317},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0716400636843455},{"feature":5,"threshold":0.234375,"left":7,"right":8,"value":-0.007505041526423566},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07296390012882194},{"feature":13,"threshold":0.8166666666665,"left":9,"right":10,"value":-0.0001828353972245942},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.011434984767951344},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02907149647413524}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":-1.6106327170087874e-17},{"feature":5,"threshold":0.171875,"left":2,"right":5,"value":-0.005874911856877598},{"feature":2,"threshold":0.6131883394385,"left":3,"right":4,"value":0.013062147409138775},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0038776127828684935},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06793973229324955},{"feature":4,"threshold":0.6583333333335,"left":6,"right":7,"value":-0.022857401634520817},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0696311556288577},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02246611437760143},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.017114978960182107},{"feature":16,"threshold":0.46428571428550003,"left":10,"right":11,"value":0.02480690703647862},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.014777746296911776},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06055618281240788},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04979917801302956}]},{"nodes":[{"feature":5,"threshold":0.140625,"left":1,"right":4,"value":-7.60998558639253e-18},{"feature":13,"threshold":0.8660714285715,"left":2,"right":3,"value":0.021315487021910228},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07386786471212098},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05595100636990367},{"feature":15,"threshold":0.75,"left":5,"right":8,"value":-0.004843733260483547},{"feature":5,"threshold":0.171875,"left":6,"right":7,"value":0.005185210941132804},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03173703700217261},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.002276719635252489},{"feature":16,"threshold":0.3095238095235,"left":9,"right":10,"value":-0.08125419309322028},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007251716865175263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0897658217530174}]},{"nodes":[{"feature":5,"threshold":0.359375,"left":1,"right":8,"value":-1.8493174869161057e-18},{"feature":5,"threshold":0.265625,"left":2,"right":5,"value":-0.005410409044915361},{"feature":16,"threshold":0.6857142857145,"left":3,"right":4,"value":0.00447969172993312},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010172728703770938},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07467155480958397},{"feature":4,"threshold":0.8397435897434999,"left":6,"right":7,"value":-0.035826188401027255},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10603203562192541},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048431150264877425},{"feature":5,"threshold":0.390625,"left":9,"right":12,"value":0.015384200817071376},{"feature":16,"threshold":0.46428571428550003,"left":10,"right":11,"value":0.022696312233700305},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.012928876707718282},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05790164023880395},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04849481329272294}]}]},"calibration":{"kind":"platt","slope":0.48424623386605475,"intercept":-3.0319726248304417},"threshold":null,"settings":{"penalty":null,"rounds":100},"outOfFold":{"family":"trees","items":40,"candidates":1719,"logLoss":0.09486333238440686,"brier":0.019533147095566483,"logLossByFamily":{"logistic":0.09863631107918631,"trees":0.09486333238440686}}},"input-source":{"scorer":{"family":"trees","base":7.831547644445928e-17,"trees":[{"nodes":[{"feature":19,"threshold":0.169436203034,"left":1,"right":8,"value":-1.0780745884619585e-19},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.15460697598546427},{"feature":16,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.17172222183577732},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.17880239742685133},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08085549249629684},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.01001123684318364},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01001123684318364},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05384532969745492},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.1746294496718049},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.08484592112238286},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01001123684318364},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09979135126881741},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.19113427048999249},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.19167563943075475},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1491116369599885}]},{"nodes":[{"feature":19,"threshold":0.169436203034,"left":1,"right":8,"value":-4.85587520984096e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.1303576495268854},{"feature":16,"threshold":0.8660714285715,"left":3,"right":4,"value":-0.1456751418787052},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15186295913450717},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.06851304672561578},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.008649048427473618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008649048427473618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04347699136450328},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.14765574638185003},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.07054118898685005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008649048427473618},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0842821189286796},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.16209280479558322},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.16257889881148352},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12475710697854842}]},{"nodes":[{"feature":19,"threshold":0.169436203034,"left":1,"right":8,"value":1.1842336287528805e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.11431971927546214},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.1288727477536778},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09305805781207979},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.15314249105970112},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.008031246559214292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008031246559214292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03555625409604088},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.1303822123939178},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.059760653949999215},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008031246559214292},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07276555763284874},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.14418534306234318},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1446671051384541},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10802439088712841}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":9.554628007480614e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.10350520946037783},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.11803504307997668},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08274886667748536},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.14318125538289636},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.006986354647379046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006986354647379046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.055524344216298815},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.11747791875511998},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.049976446179492894},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006986354647379046},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07579198807706128},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.1321029568160594},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.13260795526017277},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09530487709486485}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-1.9448891084969235e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.09435225803791963},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.10893442281269106},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07423802365436148},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13502612781240755},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.006931569104348091},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006931569104348091},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.051001426854171486},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.10821539624662285},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.04332596709491544},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006931569104348091},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06776436539751056},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.12327189121664434},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.12381537565847328},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08505480482617318}]},{"nodes":[{"feature":19,"threshold":0.21789460376199998,"left":1,"right":8,"value":1.592565230618096e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.08344253979956051},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.09727951320002112},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10706750625774333},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.043263637853850595},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.01075223749231994},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01075223749231994},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.018545890707993895},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.1049470147841874},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.04590925938472554},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.01075223749231994},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06050735253350854},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.11653204512046367},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11712631163713871},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08122065225259405}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-2.4394977589412006e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.0805167358423442},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.09555648189834882},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.058833272976699574},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12602803550982658},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.007136926415691802},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007136926415691802},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.014248980385869648},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.09479058867373859},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.03489978726702065},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007136926415691802},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05792119207580962},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.11097099488785944},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.11162820887281517},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07293539107744006}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-1.0343237035268499e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.07470512741355712},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.09010385405344216},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05345328420509021},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12284063106221528},{"feature":5,"threshold":0.390625,"left":6,"right":7,"value":0.0072538365784615005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0072538365784615005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04142500873749033},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08921280057046825},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.03051011089011765},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0072538365784615005},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05270573181503074},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.10637457306744812},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.1071015675103681},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0684423419787816}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":1.2041479835670403e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.06941995961204475},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.08518968986115684},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.04867140609505756},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.12044364752691453},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.007359098091719585},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007359098091719585},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.00017889380090389101},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08413815579548865},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.026695012828057824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007359098091719585},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04817192560064584},{"feature":5,"threshold":0.234375,"left":13,"right":14,"value":0.10232106689503269},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10976106296534233},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09653494445643039}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":-3.1079713595345424e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.06119287531327261},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.07587412624547824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08823482536091506},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03208332228901445},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.011707481667449334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011707481667449334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0002033715138268818},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08460783864817943},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.030594551537215936},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011707481667449334},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03886083814822438},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.09833790058264454},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06446622605993028},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09918347160895975}]},{"nodes":[{"feature":19,"threshold":0.26211694486299997,"left":1,"right":8,"value":8.775499439810098e-19},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.055381095853080924},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.07004938211435034},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08232312362356198},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02807182679732972},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.0139057285196909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0139057285196909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.004831219077902861},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.08319255289246141},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.03231397753472206},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0139057285196909},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048197402883896956},{"feature":5,"threshold":0.609375,"left":13,"right":14,"value":0.09511822425760819},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09615784298985174},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.06371610089616457}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":1.3956193838813968e-17},{"feature":3,"threshold":0.0280301717035,"left":2,"right":5,"value":-0.05302025715400758},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.06293262946157983},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0762889081819918},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.025506374982662696},{"feature":13,"threshold":0.9354166666665,"left":6,"right":7,"value":0.011919879496269874},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.025506374982662696},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011919879496269874},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.07686001614651798},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.02873682583043314},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011919879496269874},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03676897563542946},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.0912175159488966},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.059977170889665025},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09218575513274047}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-3.601928272560399e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.052497895623926684},{"feature":5,"threshold":0.234375,"left":3,"right":4,"value":-0.0694212052678669},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.030752675229962608},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1170194984529424},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.007915854807941679},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007915854807941679},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0050535740390539865},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.06832960523982035},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.02265681797347663},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007915854807941679},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04241292908924117},{"feature":5,"threshold":0.234375,"left":13,"right":14,"value":0.0880726682529463},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09944006542585697},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07955605795458681}]},{"nodes":[{"feature":19,"threshold":0.26211694486299997,"left":1,"right":8,"value":1.251072957773217e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.04388690561882429},{"feature":4,"threshold":0.925824175824,"left":3,"right":4,"value":-0.05908445409819525},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07268111097893508},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022639895044473893},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.013804664009247465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013804664009247465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007945917690254371},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.07149623363731468},{"feature":5,"threshold":0.296875,"left":10,"right":11,"value":0.025566371017747908},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.013804664009247465},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04174126086460784},{"feature":5,"threshold":0.234375,"left":13,"right":14,"value":0.08482931507288226},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.09712731599300656},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07580543082385428}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":4.95689935366754e-18},{"feature":3,"threshold":0.0280301717035,"left":2,"right":5,"value":-0.04250633744279276},{"feature":4,"threshold":0.4522727272725,"left":3,"right":4,"value":-0.05270026016069192},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1088233275929871},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.028356758285660918},{"feature":13,"threshold":0.9354166666665,"left":6,"right":7,"value":0.011787867607813564},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.020456196276439426},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011787867607813564},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.06608207265841962},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.025327122092522983},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011787867607813564},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.033096207332437566},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.08103052424097637},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05317882316674923},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08218811185524913}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-6.029210774917518e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.04253109984827941},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.002754627159572981},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.05825843894185624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007826972611252033},{"feature":9,"threshold":0.5,"left":6,"right":7,"value":-0.09188313009496572},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11531237472840664},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007826972611252033},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.0581850450707903},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.019976441392505206},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007826972611252033},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0389498595821466},{"feature":13,"threshold":0.5833333333335,"left":13,"right":14,"value":0.0780986312889409},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.05770099985731293},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0860892269660773}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":1.547024923368333e-17},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.03651450867020329},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.05218439036010314},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.08947084769259946},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02046289403146489},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.011258602297173358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011258602297173358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005540672883930337},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.0590317132645516},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.02188500598433167},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.011258602297173358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.029569300055672983},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.07426753914735},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.048076272565840836},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07557707912564429}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":1.73558908058518e-17},{"feature":4,"threshold":0.3858560794045,"left":2,"right":5,"value":-0.03371588399841035},{"feature":2,"threshold":0.6184900284904999,"left":3,"right":4,"value":-0.10702736004740294},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13153456182629472},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.059927172624780485},{"feature":5,"threshold":0.109375,"left":6,"right":7,"value":-0.01282698520216085},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010948010558777178},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.02548618966774841},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.05561190511596467},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.020644921651094057},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.010948010558777178},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02825840948621754},{"feature":19,"threshold":0.4341034208905,"left":13,"right":14,"value":0.07077210175503133},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.045708511703062636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.0721682806414327}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":-3.645284829661969e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.03411426507031998},{"feature":3,"threshold":0.0016261749559999998,"left":3,"right":4,"value":0.003973653565746738},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.03277896993496387},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007262539835014636},{"feature":9,"threshold":0.5,"left":6,"right":7,"value":-0.08662987655466796},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.11320419315823603},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007262539835014636},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.0486393447403442},{"feature":16,"threshold":0.3095238095235,"left":10,"right":11,"value":0.017127706440967134},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007262539835014636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.035468348404097634},{"feature":13,"threshold":0.5833333333335,"left":13,"right":14,"value":0.06780084598684856},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.04246427621390772},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07830397109451814}]},{"nodes":[{"feature":2,"threshold":0.6075138641315001,"left":1,"right":8,"value":-3.160238337768306e-19},{"feature":3,"threshold":0.0016261749559999998,"left":2,"right":5,"value":-0.030803106808330677},{"feature":4,"threshold":0.4522727272725,"left":3,"right":4,"value":-0.05344229448737467},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.13073256739071462},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022455731756504813},{"feature":5,"threshold":0.203125,"left":6,"right":7,"value":0.008530830974365716},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008530830974365716},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.022455731756504813},{"feature":16,"threshold":0.8660714285715,"left":9,"right":12,"value":0.04786476875706043},{"feature":5,"threshold":0.234375,"left":10,"right":11,"value":0.04989843978556624},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08265533332602493},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.037365430841839985},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008530830974365716}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":8.88609351168923e-18},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.02796621440722163},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.04374526776062328},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0840178216120276},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.017078715062126187},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.009587837636370904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009587837636370904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.008360727501054209},{"feature":22,"threshold":0.3825512718035,"left":9,"right":12,"value":0.04714188967996492},{"feature":15,"threshold":0.3125,"left":10,"right":11,"value":0.016877102794628666},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.009587837636370904},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02431287249155885},{"feature":13,"threshold":0.5833333333335,"left":13,"right":14,"value":0.061855801881400566},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03936645233801441},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07359886267784085}]},{"nodes":[{"feature":4,"threshold":0.925824175824,"left":1,"right":8,"value":6.953399707924746e-18},{"feature":13,"threshold":0.7083333333335,"left":2,"right":5,"value":-0.02144631478610524},{"feature":9,"threshold":0.5,"left":3,"right":4,"value":-0.07355179597465444},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.09757271772650343},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.027989764750283128},{"feature":5,"threshold":0.234375,"left":6,"right":7,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.027989764750283128},{"feature":15,"threshold":0.9375,"left":9,"right":12,"value":0.05659084773425724},{"feature":15,"threshold":0.1875,"left":10,"right":11,"value":0.06185320677514233},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.10674449614439895},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.040566349727421076},{"feature":19,"threshold":0.1149012219665,"left":13,"right":14,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017572266474087453},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.017572266474087453}]},{"nodes":[{"feature":19,"threshold":0.1349081768465,"left":1,"right":8,"value":5.664660599132904e-18},{"feature":5,"threshold":0.234375,"left":2,"right":5,"value":-0.027443484684707156},{"feature":3,"threshold":0.0016261749559999998,"left":3,"right":4,"value":0.005983868726240609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.026602838092548927},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005983868726240609},{"feature":9,"threshold":0.5,"left":6,"right":7,"value":-0.07951825103803888},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.10898794283720187},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005983868726240609},{"feature":13,"threshold":0.5833333333335,"left":9,"right":12,"value":0.0394112221371886},{"feature":17,"threshold":0.3093924705815,"left":10,"right":11,"value":0.005983868726240609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.005983868726240609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.02936476785621949},{"feature":5,"threshold":0.359375,"left":13,"right":14,"value":0.05274566698619824},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.07277055184521795},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03484536165125058}]},{"nodes":[{"feature":2,"threshold":0.6075138641315001,"left":1,"right":8,"value":9.963129683306329e-18},{"feature":3,"threshold":0.0016261749559999998,"left":2,"right":5,"value":-0.02495773724554704},{"feature":4,"threshold":0.4522727272725,"left":3,"right":4,"value":-0.04573029136491204},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.1251709437956636},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01933312058798866},{"feature":5,"threshold":0.203125,"left":6,"right":7,"value":0.007064050188934263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007064050188934263},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.01933312058798866},{"feature":16,"threshold":0.8660714285715,"left":9,"right":12,"value":0.039085837623417066},{"feature":9,"threshold":0.5,"left":10,"right":11,"value":0.0413945526776358},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.028956109322950487},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08087121814943898},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007064050188934263}]},{"nodes":[{"feature":17,"threshold":0.061730965748,"left":1,"right":8,"value":5.853984456956939e-19},{"feature":9,"threshold":0.5,"left":2,"right":5,"value":-0.02274761406970018},{"feature":13,"threshold":0.7083333333335,"left":3,"right":4,"value":-0.0382324647602609},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.07862213639481601},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":-0.0152209367758111},{"feature":15,"threshold":0.4375,"left":6,"right":7,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.006729806164542074},{"feature":13,"threshold":0.5833333333335,"left":9,"right":12,"value":0.038328796486981814},{"feature":17,"threshold":0.3093924705815,"left":10,"right":11,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.007790591208638694},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.028431695032844137},{"feature":5,"threshold":0.265625,"left":13,"right":14,"value":0.05116744557079153},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.08166084903256131},{"feature":-1,"threshold":0,"left":-1,"right":-1,"value":0.03652624362659878}]}]},"calibration":{"kind":"platt","slope":1.3211409713762825,"intercept":-3.4121855818618347},"threshold":null,"settings":{"penalty":null,"rounds":25},"outOfFold":{"family":"trees","items":431,"candidates":23264,"logLoss":0.06456785575616061,"brier":0.013875264770263514,"logLossByFamily":{"logistic":0.13112689565596358,"trees":0.06456785575616061}}},"output-name":{"scorer":{"family":"logistic","mean":[0.0743978856540339,0.0336777752441727,0.4473489964593778,0.01470191654729164,0.5355106720807403,0.31553735954370443,0.0019074907609095755,0.0047444661039151926,0.033203108081068786,0,0.0003783930021527455,0.002051488466000604,0,0.4924459604591684,0.01064700229745052,0.2464091152693806,0.11981252584152502,0.01892592752540986,0.031523845847303174,0.027923006402410536,0,0,0.015352749019805129],"scale":[0.2624173017623382,0.18039839993404905,0.1768399778996851,0.0445136325986074,0.2511887822050353,0.1840609670020574,0.04363315528251818,0.06871649107239591,0.17916657527238694,1,0.01944864573404781,0.045246876810172955,1,0.32238547867494854,0.06616622008178241,0.1911604529185433,0.22486729220249935,0.08964454829466348,0.17472862670524686,0.0982913682235243,1,1,0.0682925110554829],"low":[0,0,0,1e-12,0.028571428571,0.03125,0,0,0,0,0,0,0,0,0,0.125,0,0,0,0,0,0,0],"high":[1,1,1,0.975888117264,1,1,1,1,1,0,1,1,0,0.981818181818,1,1,0.909090909091,1,1,1,0,0,1],"weights":[0.11907875604722326,0,0.1474407024856209,0.3415792012435416,0.20407281952755676,0.005808708017096443,0.01053093769199893,0.23195946661939548,0.39082601324337957,0,0.04647254399397004,0.12700835273331454,0,0,0.27927564496064045,0,0,0.10593804530131139,0,0.19557073998965827,0,0,0.22179797378576555]},"calibration":{"kind":"isotonic","upTo":[-3.292136180509086,-1.7812810407887976,-1.6669991659586119,-1.1889805028850784,-0.591131057933556,0.6509952543674626,1.3691053793069483,1.5627248086624541,1.6938035274743588,1.7255019474015354,2.334752234795677,2.3423983455931703,2.4046003618281224,2.6114818776608324,3.516985924104054,3.8383767729563467,5.3737931332977436,6.163306273881128,9.574545213064651,9.840431853201935,13.110287836210674,21.66372976774619],"value":[0.0007686483318311906,0.0012291243384544082,0.0016413311228310615,0.0031017840016388833,0.0038735620762267017,0.0047847029450589105,0.005175641311193911,0.00805627836158294,0.014916637056021212,0.01497940342199425,0.035056000611347574,0.03533585140163959,0.044293831058438086,0.05918495419244809,0.07021614588677301,0.18470897869207456,0.19653934715267668,0.23828702659004244,0.3362777425339646,0.4014469442924164,0.4835396029929583,0.9554223676429341]},"threshold":{"probability":0.26076506858541226,"margin":0.2,"precision":0.7297297297297297,"lowerBound":0.5405405405405406,"coverage":0.13503649635036497,"shown":111,"items":822,"repositories":27},"settings":{"penalty":0.1,"rounds":null},"outOfFold":{"family":"logistic","items":822,"candidates":48949,"logLoss":0.061909306087470396,"brier":0.014635305838926192,"logLossByFamily":{"logistic":0.061909306087470396,"trees":0.06732329839347435}}}}`),names:JSON.parse(`{"format":1,"pairs":884,"labels":{"0":6,"1":27,"2":1,"3":2,"15":1,"123":1,"12345":2,"123456":4,"neuantrags":3,"prüfung":3,"get":15,"account":4,"number":1,"check":87,"file":9,"size":19,"notwendige":1,"kompetenz":1,"bestimmen":5,"mitarbeiter":3,"erfahrung":1,"des":1,"mitarbeiters":1,"score":10,"eignung":1,"determine":26,"required":2,"skills":1,"employee":2,"suitability":1,"eployee":1,"underwriter":1,"underwriting":3,"unique":1,"rsp":2,"id":2,"against":1,"selected":1,"mandatory":1,"field":2,"values":2,"separate":1,"valid":1,"and":2,"faild":1,"claims":1,"length":1,"assign":21,"user":17,"decide":9,"on":9,"viral":1,"rating":1,"benefits":5,"handle":2,"request":4,"approver":18,"group":19,"generate":38,"data":7,"application":4,"automatically":3,"document":1,"test":6,"example":1,"dish":1,"beverages":1,"order":19,"discount":4,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"review":14,"invoice":13,"verify":3,"risks":3,"create":2,"complex":1,"object":1,"load":25,"generic":2,"config":2,"evaluate":34,"answers":1,"error":19,"handling":1,"initiated":1,"calculate":10,"orderitem":1,"price":5,"sum":1,"item":2,"fraud":5,"increase":1,"counter":2,"init":2,"northern":1,"teams":4,"southern":1,"other":1,"task":23,"assignment":4,"eval":2,"expression":1,"language":1,"global":7,"europe":1,"asia":1,"usa":1,"dokument":1,"eingegangen":1,"antrag":6,"automatisch":6,"prüfen":8,"pmml":4,"automatic":2,"approval":4,"dmn":8,"approve":2,"expense":1,"sparql":1,"say":2,"hello":6,"helloword":1,"extract":1,"pdf":9,"c":16,"function":5,"merge":1,"water":1,"mark":1,"images":2,"to":7,"ping":4,"worker":17,"connector":5,"pingconnector":1,"cmis":3,"storage":3,"files":8,"from":8,"disk":8,"folder":1,"temp":1,"json":9,"add":1,"top":1,"watermark":1,"input":8,"wait":1,"for":3,"service":4,"world":3,"call":24,"sync":2,"rest":2,"via":2,"post":1,"convert":7,"if":3,"date":5,"is":3,"holiday":3,"replace":12,"oracle":12,"execute":44,"circuit":55,"mitigate":15,"readout":15,"quantum":20,"delegate":16,"errors":3,"combine":3,"results":30,"cut":6,"circuits":39,"initialize":15,"optimizer":22,"parameters":7,"warm":8,"start":13,"algorithm":8,"distance":2,"graph":2,"locations":2,"m":1,"run":86,"portfolio":1,"optimization":1,"ai":2,"agent":5,"agenticai":17,"aiagent":17,"job":14,"foo":2,"send":15,"with":4,"stuffdoer":9,"activity":8,"process":4,"i":12,"external":2,"topic":2,"validate":4,"notify":1,"customer":9,"credit":19,"fetch":3,"exchange":1,"rate":3,"amount":1,"routing":4,"background":2,"assess":6,"risk":10,"query":1,"recruiter":2,"calendar":1,"draft":3,"invitation":1,"email":15,"summary":1,"rejection":1,"grant":1,"system":1,"access":3,"set":7,"high":1,"priority":2,"settlement":2,"some":2,"community":2,"profil":2,"popularity":1,"risiko":2,"details":1,"status":2,"a":9,"b":5,"rule":9,"evaluation":8,"policy":1,"guardrail":1,"assessment":1,"provided":2,"action":6,"timeout":4,"chaos":11,"experiment":7,"failed":8,"after":3,"hours":2,"experiments":4,"invalid":3,"expiry":1,"tweet":1,"business":1,"charge":18,"card":24,"accounts":2,"weather":4,"forecast":4,"soap":4,"script":1,"form":2,"检查是否通过":1,"mail":7,"complete":1,"prepare":2,"message":8,"pong":2,"new":7,"spot":3,"signal":1,"trade":1,"activty":1,"output":2,"serve":3,"customers":3,"metrics":1,"poll":1,"pizza":1,"orders":1,"grade":3,"retrieve":5,"payment":7,"ship":1,"goods":2,"notification":2,"adapter":9,"method":1,"result":2,"store":1,"receive":4,"echo":4,"do":4,"stuff":2,"book":4,"the":13,"carrier":1,"country":1,"supplier":1,"arrange":1,"an":1,"site":1,"audit":2,"bodywork":1,"mechanical":1,"damage":2,"repair":1,"submitted":1,"receipts":1,"daily":1,"allowance":2,"claim":10,"currency":1,"pay":2,"reimbursement":2,"label":1,"each":1,"parcel":1,"normal":1,"cheack":1,"coagulation":1,"time":3,"since":2,"blood":2,"loss":2,"level":2,"physiological":20,"measurements":20,"infection":18,"soberity":20,"camunda":11,"sign":1,"into":1,"google":1,"retry":4,"scope":1,"url":5,"encode":4,"token":2,"authorize":1,"attempt":1,"authorization":1,"code":4,"callback":1,"scopes":1,"sample":1,"received":12,"by":2,"sales":2,"department":1,"head":1,"of":2,"choose":2,"distributor":1,"value":1,"items":2,"delivery":1,"satisfaction":3,"survey":3,"confirm":3,"created":2,"construct":8,"supervisor":2,"submitter":2,"colleague":2,"direct":2,"reports":2,"variables":4,"template":1,"ticket":4,"reserved":3,"out":3,"cloudevents":3,"async":1,"void":1,"throw":1,"warn":4,"again":1,"notice":3,"about":5,"loaded":3,"blacklisting":1,"removal":1,"creation":1,"membership":14,"requested":10,"маршрут":1,"по":1,"сумме":1,"tree":1,"my":3,"saved":1,"master":2,"placed":1,"checked":1,"render":2,"body":1,"subject":1,"templates":2,"comfirmation":1,"support":2,"case":2,"owner":1,"homework":2,"made":1,"it":1,"played":2,"nope":7,"turn":1,"select":4,"play":4,"scoring":1,"rules":1,"carbon":12,"reductor":12,"character":1,"enter":2,"wishlist":2,"hotel":1,"http":10,"car":1,"flight":1,"incident":1,"team":1,"product":3,"catalog":1,"search":1,"knowledge":1,"base":1,"reply":1,"chat":1,"conversation":5,"human":2,"escalation":1,"minutes":1,"working":1,"upload":2,"demo":1,"kotlin":1,"simple":2,"params":2,"in":1,"java":1,"optional":1,"superflux":1,"calculation":1,"ask":1,"kyc":11,"screening":12,"agentcost":14,"capture":14,"identity":1,"screen":3,"sanctions":3,"pep":3,"additional":1,"information":1,"submit":1,"edd":3,"judge":3,"onboarding":1,"authority":1,"detection":3,"sla":1,"duration":1,"injury":1,"severity":1,"whether":1,"configurable":3,"validations":3,"general":1,"decision":1},"names":{"1":96,"2":29,"3":13,"completed":3,"case":6,"instance":4,"id":48,"account":1,"number":1,"file":2,"size":1,"ok":1,"skills":2,"selected":5,"employee":8,"experience":1,"score":10,"underwriter":1,"approved":4,"underwriting":2,"result":67,"check":4,"unique":1,"rsp":2,"against":1,"mandatory":1,"fields":1,"claims":1,"field":1,"length":1,"user":6,"name":14,"viral":1,"room":1,"upgrade":1,"free":1,"drinks":1,"breakfast":1,"email":8,"benefits":1,"async":1,"approver":18,"groups":19,"data":6,"risk":20,"dm":1,"nresult":1,"document":4,"dmn":2,"dish":1,"beverages":1,"discount":3,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"clarified":12,"assessment":6,"complex":1,"value":16,"general":2,"config":2,"json":3,"is":71,"included":1,"failing":1,"task":13,"complete":2,"price":6,"fraud":5,"counter":2,"chosen":3,"team":4,"assignee":1,"candidate":2,"users":1,"mypath":2,"the":1,"answer":2,"status":17,"transfer":4,"expense":4,"risikobewertung":2,"risks":2,"risikopruefung":2,"business":3,"decision":17,"output":10,"automatic":3,"approval":3,"mapping":4,"message":11,"welcome":1,"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":3,"pdf":5,"list":1,"images":1,"time":7,"stamp":1,"ping":1,"jvm":1,"parameters":1,"cherry":9,"icon":1,"mime":1,"type":1,"in":7,"folder":1,"temp":1,"source":1,"destination":1,"greeting":2,"response":29,"xml":5,"holiday":3,"sub":48,"process":56,"circuit":66,"quantum":12,"programming":12,"language":12,"execution":18,"service":13,"mitigated":3,"counts":15,"cutting":3,"meta":3,"circuits":3,"meas":9,"qubits":19,"depth":19,"transpiled":9,"untranspiled":10,"num":10,"iterations":14,"converged":7,"obj":10,"evaluated":9,"costs":9,"max":5,"cut":5,"plot":9,"tsp":1,"ws":19,"bitstring":4,"optimizer":1,"init":1,"distance":1,"matrix":2,"duration":1,"probability":4,"distribution":4,"visualization":3,"agent":8,"error":3,"var":81,"out":7,"target":10,"order":19,"variable":32,"i":12,"foo":3,"valid":8,"customer":11,"notified":1,"loan":1,"exchange":1,"rate":2,"converted":1,"amount":3,"routing":3,"background":1,"rationale":2,"fit":1,"interview":1,"slot":1,"invitation":1,"recruiter":1,"summary":2,"rejection":3,"access":3,"granted":1,"required":1,"ignored":1,"claim":1,"level":2,"health":1,"percentage":1,"code":14,"popular":1,"repo":1,"my":8,"date":3,"long":1,"string":1,"boolean":1,"enum":1,"item":1,"a":4,"b":4,"rule":8,"reason":5,"policy":1,"successful":6,"run":2,"timeout":1,"test":14,"report":13,"failure":6,"messages":5,"experiment":3,"start":2,"end":2,"count":3,"credit":2,"card":1,"accounts":2,"forecast":2,"temperature":2,"percent":1,"passed":1,"arbval":1,"from":2,"received":3,"me":1,"took":2,"condition":3,"spot":2,"body":2,"basis":1,"of":5,"main":2,"parameter":2,"some":2,"mails":1,"final":1,"grade":3,"execute":1,"first":1,"last":3,"sheet":1,"url":4,"tracking":1,"supplier":1,"audit":2,"verdict":2,"bodywork":1,"mechanics":1,"repair":1,"cost":1,"review":3,"note":1,"daily":1,"allowance":1,"euro":1,"payout":1,"receipt":1,"payment":7,"reference":1,"parcel":1,"label":1,"normal":1,"medicine":1,"since":2,"blood":2,"loss":2,"suspected":20,"infection":18,"large":18,"sober":20,"gcp":1,"authorization":1,"token":3,"auth":4,"retries":4,"remaining":2,"refresh":2,"state":1,"callback":2,"microsoft":1,"authorize":1,"request":3,"azure":3,"encoded":2,"scopes":1,"send":2,"address":2,"e":1,"mail":2,"mobile":1,"phone":1,"accepted":3,"distributor":1,"items":1,"meal":1,"invoice":2,"deadline":2,"survey":1,"link":1,"template":1,"tickets":3,"throw":1,"membership":7,"has":7,"empty":7,"spots":7,"route":2,"notification":1,"path":1,"group":1,"stuff":1,"success":4,"subject":1,"templates":1,"sent":3,"failed":1,"resolved":1,"owner":1,"guess":1,"played":5,"nope":3,"cards":6,"correlation":2,"key":2,"noped":1,"player":1,"turn":2,"round":2,"action":1,"players":1,"discard":1,"pile":1,"tier":3,"delayed":4,"mapped":6,"by":2,"original":2,"carbon":8,"actual":2,"saved":2,"reduced":2,"character":1,"wishlist":1,"child":1,"support":4,"tool":16,"call":16,"conversation":4,"context":1,"delegate":1,"java":1,"screening":2,"identity":1,"verified":2,"sanctions":2,"match":4,"pep":2,"employment":1,"kyc":3,"recommendation":1,"raw":4,"judge":2,"reasoning":1,"onboarding":1,"indicators":1,"requires":1,"sla":1,"injury":1,"damage":1,"settlement":1,"processing":1},"joint":{"0":{"i":6},"1":{"agent":4,"result":4,"variable":1,"message":1,"arbval":1,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":2,"match":4,"pep":2,"risk":5,"tier":2,"score":2,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"tool":3,"call":3,"raw":4,"judge":2,"decision":1,"reasoning":1,"assessment":1},"2":{"condition":1},"3":{"test":1,"report":1,"failure":1,"messages":1,"successful":1,"experiment":1},"15":{"customer":1,"support":1,"agent":1},"123":{"iterations":1},"12345":{"iterations":2},"123456":{"iterations":4},"neuantrags":{"completed":3,"case":3,"instance":3,"id":3},"prüfung":{"completed":3,"case":3,"instance":3,"id":3},"get":{"account":1,"number":1,"health":1,"percentage":1,"status":2,"code":2,"accounts":2,"forecast":2,"temperature":2,"body":1,"spot":1,"price":1,"time":1,"since":1,"blood":1,"loss":1,"azure":1,"access":1,"token":1,"tool":1,"call":1,"result":1},"account":{"account":1,"number":1,"ws":3,"response":3},"number":{"account":1,"number":1},"check":{"file":1,"size":1,"ok":1,"result":6,"check":4,"unique":1,"rsp":2,"id":5,"against":1,"selected":1,"mandatory":1,"fields":1,"field":1,"length":1,"risk":7,"dm":1,"nresult":1,"assessment":2,"is":67,"holiday":3,"background":1,"rationale":1,"normal":1,"suspected":20,"infection":18,"large":18,"sober":20,"accepted":3,"valid":3,"order":1,"payment":3,"fraud":3,"score":1,"indicators":1,"requires":1,"review":1},"file":{"file":2,"size":1,"ok":1,"cherry":8,"icon":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"size":{"file":1,"size":1,"ok":1,"infection":18,"is":18,"large":18},"notwendige":{"skills":1},"kompetenz":{"skills":1},"bestimmen":{"skills":1,"selected":2,"employee":4,"experience":1,"score":1},"mitarbeiter":{"selected":2,"employee":3,"score":1},"erfahrung":{"employee":1,"experience":1},"des":{"employee":1,"experience":1},"mitarbeiters":{"employee":1,"experience":1},"score":{"employee":2,"score":7,"fraud":2,"fit":1,"assessment":1,"risk":3,"tool":1,"call":1,"result":2,"tier":1,"raw":2},"eignung":{"employee":1,"score":1},"determine":{"skills":1,"selected":2,"employee":2,"underwriter":1,"room":1,"upgrade":1,"free":1,"drinks":1,"breakfast":1,"email":1,"benefits":1,"dish":1,"beverages":1,"discount":1,"assignee":1,"candidate":2,"users":1,"groups":1,"dmn":1,"result":3,"automatic":2,"approval":2,"mapping":2,"routing":3,"claim":1,"decision":4,"templates":1,"onboarding":1,"review":1},"required":{"skills":1,"review":1,"decision":1},"skills":{"skills":1},"employee":{"employee":2,"score":1,"selected":1},"suitability":{"employee":1,"score":1},"eployee":{"selected":1,"employee":1},"underwriter":{"underwriter":1},"underwriting":{"approved":1,"underwriting":2,"case":1,"instance":1,"id":1,"decision":1,"result":1},"unique":{"result":1,"check":1,"unique":1,"rsp":1,"id":1},"rsp":{"result":2,"check":2,"unique":1,"rsp":2,"id":2,"against":1,"selected":1},"id":{"result":2,"check":2,"unique":1,"rsp":2,"id":2,"against":1,"selected":1},"against":{"result":1,"check":1,"rsp":1,"id":1,"against":1,"selected":1},"selected":{"result":1,"check":1,"rsp":1,"id":1,"against":1,"selected":1},"mandatory":{"result":1,"check":1,"mandatory":1,"fields":1},"field":{"result":2,"check":2,"mandatory":1,"fields":1,"field":1,"length":1},"values":{"result":1,"check":1,"mandatory":1,"fields":1,"is":1,"normal":1},"separate":{"claims":1},"valid":{"claims":1},"and":{"claims":1,"tool":1,"call":1,"result":1},"faild":{"claims":1},"claims":{"claims":1},"length":{"result":1,"check":1,"field":1,"length":1},"assign":{"user":2,"name":2,"approver":18,"groups":18,"team":1},"user":{"user":2,"name":2,"my":5,"date":1,"long":1,"string":1,"boolean":1,"enum":1,"ws":7,"response":7,"request":1,"tool":1,"call":1,"result":1,"conversation":1},"decide":{"viral":1,"score":1,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"approval":1,"required":1,"popular":1,"repo":1,"automatic":1,"processing":1},"on":{"viral":1,"score":1,"decade":1,"video":1,"game":1,"band":1,"movie":1,"suitable":1,"consultants":1,"approval":1,"required":1,"popular":1,"repo":1,"audit":1,"verdict":1},"viral":{"viral":1,"score":1},"rating":{"viral":1,"score":1},"benefits":{"room":1,"upgrade":1,"free":1,"drinks":1,"breakfast":1,"email":1,"benefits":1},"handle":{"async":1,"user":1,"id":1,"tool":1,"call":1,"result":1},"request":{"async":1,"user":1,"id":1,"document":1,"payment":1,"received":1,"tool":1,"call":1,"result":1},"approver":{"approver":18,"groups":18},"group":{"approver":18,"groups":18,"group":1},"generate":{"data":2,"circuit":33,"depth":10,"untranspiled":10,"num":10,"qubits":10,"distance":1,"matrix":2,"duration":1,"visualization":3,"result":1,"test":1},"data":{"data":2,"process":1,"variable":1,"response":1,"first":1,"name":2,"last":1,"sheet":1,"url":1,"tool":1,"call":1,"result":1},"application":{"risk":2,"dm":1,"nresult":1,"fit":1,"score":1,"assessment":2,"result":1},"automatically":{"risk":2,"dm":1,"nresult":1,"assessment":1,"result":1,"automatic":1,"processing":1},"document":{"document":1},"test":{"2":1,"dmn":1,"result":2,"output":1,"name":2,"of":2,"variable":2,"in":2,"main":2,"process":2,"message":1,"out":1},"example":{"dmn":1,"result":1},"dish":{"dish":1},"beverages":{"beverages":1},"order":{"discount":1,"complete":1,"price":1,"approved":1,"order":6,"valid":4,"repair":1,"cost":1,"risk":1,"customer":3,"name":1,"address":1,"e":1,"mail":1,"mobile":1,"phone":1,"is":2,"id":1,"path":1,"tool":1,"call":1,"result":1},"discount":{"discount":3,"percent":1,"result":2,"tool":1,"call":1},"decade":{"decade":1},"video":{"video":1,"game":1},"game":{"video":1,"game":1},"band":{"band":1},"movie":{"movie":1},"suitable":{"suitable":1,"consultants":1},"consultants":{"suitable":1,"consultants":1},"review":{"clarified":10,"status":1,"transfer":1,"expense":1,"approved":1,"review":2,"note":1,"decision":1},"invoice":{"clarified":12,"invoice":1,"id":1},"verify":{"clarified":2,"tool":1,"call":1,"result":1},"risks":{"risk":3,"assessment":1,"result":1},"create":{"complex":1,"value":1,"resolved":1},"complex":{"complex":1,"value":1},"object":{"complex":1,"value":1},"load":{"1":12,"general":2,"config":2,"json":3,"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"source":1,"pdf":1,"document":1,"service":12,"task":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":5,"ws":1,"response":1,"tool":2,"call":2},"generic":{"general":2,"config":2,"json":1},"config":{"general":2,"config":2,"json":1},"evaluate":{"is":1,"included":1,"obj":10,"value":10,"evaluated":9,"costs":9,"max":5,"cut":5,"plot":9,"tsp":1,"loan":1,"decision":1,"discount":2,"percent":1,"result":2,"final":1,"grade":1,"risk":1,"level":1},"answers":{"is":1,"included":1},"error":{"2":3,"3":12,"failing":1,"task":1,"sub":15,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"error":2,"var":2,"variable":3,"customer":1,"support":1,"agent":1},"handling":{"failing":1,"task":1},"initiated":{"failing":1,"task":1},"calculate":{"complete":1,"price":1,"fraud":2,"score":3,"value":1,"of":1,"items":1,"tool":2,"call":2,"result":3,"risk":2,"tier":1,"raw":2,"sla":1,"decision":2,"settlement":1},"orderitem":{"complete":1,"price":1},"price":{"complete":2,"price":5,"spot":2},"sum":{"complete":1,"price":1},"item":{"complete":1,"price":1,"item":1,"response":1},"fraud":{"fraud":5,"score":3,"result":1,"indicators":1,"requires":1,"review":1},"increase":{"counter":1},"counter":{"counter":2},"init":{"counter":1,"time":1,"since":1,"blood":1,"loss":1},"northern":{"chosen":1,"team":1},"teams":{"chosen":3,"team":3,"send":1,"message":1},"southern":{"chosen":1,"team":1},"other":{"chosen":1,"team":1},"task":{"1":1,"2":1,"assignee":1,"candidate":2,"users":1,"groups":1,"dmn":1,"result":2,"error":2,"var":2,"foo":2,"my":5,"date":1,"long":1,"string":1,"boolean":1,"enum":1,"out":2,"variable":1,"message":3,"arbval":1,"took":2,"condition":3},"assignment":{"assignee":1,"candidate":2,"users":1,"groups":1,"dmn":1,"result":1},"eval":{"mypath":2},"expression":{"the":1,"answer":1},"language":{"the":1,"answer":1},"global":{"status":3,"transfer":3,"expense":3,"employee":1,"name":1,"deadline":2,"date":1,"time":1,"survey":1,"link":1},"europe":{"status":1,"transfer":1,"expense":1},"asia":{"status":1,"transfer":1,"expense":1},"usa":{"status":1,"transfer":1,"expense":1},"dokument":{"document":1},"eingegangen":{"document":1},"antrag":{"risikobewertung":2,"risks":2,"risikopruefung":2},"automatisch":{"risikobewertung":2,"risks":2,"risikopruefung":2},"prüfen":{"risikobewertung":2,"risks":2,"risikopruefung":2,"risk":2},"pmml":{"business":2,"decision":2,"output":1,"approved":1},"automatic":{"automatic":2,"approval":2,"mapping":2},"approval":{"automatic":2,"approval":3,"mapping":2,"required":1,"service":1,"route":1},"dmn":{"automatic":2,"approval":2,"mapping":2,"risk":2,"level":1,"decision":1,"result":1,"policy":1,"credit":1,"route":2,"service":1,"tier":1},"approve":{"approved":1,"price":1},"expense":{"approved":1},"sparql":{"business":1,"decision":1},"say":{"message":2,"welcome":1},"hello":{"message":2,"welcome":1,"greeting":2,"basis":1,"result":1},"helloword":{"message":1,"welcome":1},"extract":{"doc":1,"extracted":1},"pdf":{"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":1,"pdf":5,"list":1,"images":1,"cherry":2,"source":1,"document":2,"destination":1},"c":{"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":1,"pdf":3,"list":1,"images":1,"time":1,"stamp":1,"ping":1,"jvm":1,"parameters":1,"cherry":9,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"document":2,"destination":1},"function":{"doc":4,"extracted":1,"merged":1,"watermark":1,"image":1,"to":1,"pdf":1,"list":1,"images":1},"merge":{"doc":1,"merged":1},"water":{"doc":1,"watermark":1},"mark":{"doc":1,"watermark":1},"images":{"doc":1,"image":1,"to":1,"pdf":1,"list":1,"images":1},"to":{"doc":1,"image":1,"to":1,"pdf":1,"list":1,"images":1,"allowance":1,"in":1,"euro":1,"request":1,"id":1,"team":1,"tool":1,"call":1,"result":1,"automatic":1,"processing":1},"ping":{"time":1,"stamp":1,"ping":1,"jvm":1,"parameters":1,"from":1,"to":1},"worker":{"time":1,"stamp":1,"ping":1,"agent":4,"out":1,"result":2,"throw":1,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1},"connector":{"1":2,"jvm":1,"parameters":1,"email":1,"response":1,"out":2},"pingconnector":{"jvm":1,"parameters":1},"cmis":{"cherry":3,"icon":1,"file":1,"name":1,"mime":1,"type":1},"storage":{"cherry":3,"icon":1,"file":1,"name":1,"mime":1,"type":1},"files":{"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"from":{"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"disk":{"cherry":8,"icon":1,"file":1,"name":1,"mime":1,"type":1,"in":4,"folder":1,"temp":1,"json":2,"source":1,"pdf":1,"document":1},"folder":{"cherry":1,"in":1,"folder":1},"temp":{"cherry":1,"in":1,"temp":1},"json":{"cherry":2,"in":2,"json":2,"tool":3,"call":3,"result":3,"sanctions":1,"match":2,"raw":4,"pep":1,"risk":2,"tier":1,"score":1},"add":{"cherry":1,"destination":1,"pdf":1,"document":1},"top":{"cherry":1,"destination":1,"pdf":1,"document":1},"watermark":{"cherry":1,"destination":1,"pdf":1,"document":1},"input":{"2":1,"cherry":1,"destination":1,"pdf":1,"document":1,"xml":5,"output":5,"name":2,"of":2,"variable":2,"in":2,"main":2,"process":2},"wait":{"greeting":1},"for":{"greeting":1,"distance":1,"matrix":2,"duration":1},"service":{"greeting":2,"result":1,"variable":1,"condition":1},"world":{"greeting":2,"result":1},"call":{"2":6,"3":1,"greeting":1,"email":1,"target":9,"order":9,"id":9,"sub":9,"variable":10,"test":1,"out":1,"my":1,"output":1,"var":1,"execute":1,"result":1,"data":1},"sync":{"greeting":1,"throw":1,"result":1},"rest":{"email":1,"response":1},"via":{"email":1,"response":1},"post":{"response":1},"convert":{"xml":5,"output":5,"converted":1,"amount":1,"allowance":1,"in":1,"euro":1},"if":{"is":3,"holiday":3},"date":{"is":3,"holiday":3,"credit":1,"card":1,"error":1,"message":1,"tool":1,"call":1,"result":1},"is":{"is":3,"holiday":3},"holiday":{"is":3,"holiday":3},"replace":{"1":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3},"oracle":{"1":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3},"execute":{"2":12,"sub":12,"process":12,"circuit":15,"id":3,"quantum":3,"programming":3,"language":3,"execution":7,"result":4,"counts":9,"meas":9,"qubits":9,"depth":9,"transpiled":9,"probability":4,"distribution":4,"decision":1},"circuit":{"1":12,"2":12,"sub":12,"process":12,"circuit":21,"id":6,"quantum":6,"programming":6,"language":6,"execution":10,"result":6,"service":12,"task":12,"counts":9,"meas":9,"qubits":9,"depth":9,"transpiled":9,"probability":4,"distribution":4},"mitigate":{"3":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"mitigated":3,"counts":3},"readout":{"3":12,"sub":12,"process":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"mitigated":3,"counts":3},"quantum":{"1":12,"service":12,"task":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":3,"ws":8,"bitstring":4,"value":4},"delegate":{"1":12,"service":12,"task":12,"circuit":6,"id":3,"quantum":3,"programming":3,"language":3,"execution":3,"result":6,"daily":1,"rate":1,"test":1,"delegate":1,"mapping":2,"java":1},"errors":{"mitigated":3,"counts":3},"combine":{"counts":3},"results":{"counts":3,"obj":9,"value":9,"evaluated":9,"costs":9,"max":5,"cut":5,"plot":9,"tsp":1},"cut":{"cutting":3,"meta":3,"data":3,"sub":3,"circuits":3},"circuits":{"cutting":3,"meta":3,"data":3,"sub":3,"circuits":3,"circuit":33,"depth":10,"untranspiled":10,"num":10,"qubits":10,"visualization":3},"initialize":{"iterations":7,"converged":7,"optimizer":1,"init":1},"optimizer":{"iterations":14,"converged":7,"optimizer":1,"init":1},"parameters":{"iterations":7},"warm":{"ws":8,"bitstring":4,"value":4},"start":{"ws":8,"bitstring":4,"value":4,"send":1,"message":1,"order":1,"id":1,"customer":1,"name":1,"meal":1,"turn":1,"of":1,"round":1},"algorithm":{"ws":8,"bitstring":4,"value":4},"distance":{"distance":1,"matrix":2,"duration":1},"graph":{"distance":1,"matrix":2,"duration":1},"locations":{"distance":1,"matrix":2,"duration":1},"m":{"obj":1,"value":1},"run":{"1":69,"2":9,"agent":1,"var":78,"background":1,"risk":1,"rationale":1,"successful":2,"run":1,"timeout":1,"experiment":1,"test":2,"report":2,"start":1,"time":1,"failure":1,"messages":1},"portfolio":{"agent":1},"optimization":{"agent":1},"ai":{"agent":2},"agent":{"agent":4,"customer":2,"support":2,"conversation":1},"agenticai":{"agent":4,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"aiagent":{"agent":4,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"job":{"agent":4,"customer":1,"support":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1},"foo":{"error":2,"var":2},"send":{"1":2,"out":2,"message":2,"id":2,"status":2,"code":2,"ws":2,"response":2,"send":1,"mail":1,"result":3,"success":1,"sent":3,"conversation":1,"tool":2,"call":2,"email":2},"with":{"1":2,"out":2,"start":1,"date":1,"execute":1,"result":1,"variable":1,"data":1},"stuffdoer":{"target":9,"order":9,"id":9},"activity":{"2":3,"sub":6,"variable":6,"test":1,"out":1,"my":1,"output":1},"process":{"2":3,"sub":3,"variable":3,"automatic":1,"processing":1},"i":{"i":12},"external":{"foo":2},"topic":{"foo":2},"validate":{"order":1,"valid":1,"status":2,"a":1,"response":2,"b":1,"state":1},"notify":{"customer":1,"notified":1},"customer":{"customer":4,"notified":1,"process":1,"variable":1,"response":1,"first":1,"name":3,"last":1,"sheet":1,"url":1,"id":1,"support":1,"agent":1,"tool":1,"call":1,"result":1},"credit":{"loan":1,"decision":1,"approved":1,"process":10,"variable":10,"response":10,"status":7,"code":7},"fetch":{"exchange":1,"rate":1,"item":1,"response":2,"process":1,"variable":1},"exchange":{"exchange":1,"rate":1},"rate":{"exchange":1,"rate":2,"daily":1,"risk":1},"amount":{"converted":1,"amount":1},"routing":{"routing":3,"result":1,"service":1,"route":1,"decision":1},"background":{"background":1,"risk":1,"rationale":1},"assess":{"decision":1,"risk":1,"level":1,"bodywork":1,"report":1,"character":1,"injury":1,"assessment":2,"damage":1},"risk":{"decision":1,"risk":8,"level":2,"score":2,"result":2,"tool":1,"call":1,"tier":1,"raw":2},"query":{"interview":1,"slot":1},"recruiter":{"interview":1,"slot":1,"recruiter":1,"summary":1,"email":1},"calendar":{"interview":1,"slot":1},"draft":{"invitation":1,"email":3,"recruiter":1,"summary":1,"rejection":1},"invitation":{"invitation":1,"email":1},"email":{"invitation":1,"email":5,"recruiter":1,"summary":1,"rejection":1,"result":10,"template":1,"tool":2,"call":2,"sent":2},"summary":{"recruiter":1,"summary":1,"email":1},"rejection":{"rejection":1,"email":1},"grant":{"access":1,"granted":1},"system":{"access":1,"granted":1},"access":{"access":3,"granted":1,"microsoft":1,"token":2,"url":1,"azure":1},"set":{"ignored":1,"microsoft":1,"access":1,"token":1,"url":2,"authorize":1,"employee":1,"name":1,"deadline":2,"date":1,"time":1,"survey":1,"link":1},"high":{"ignored":1},"priority":{"ignored":1,"result":1,"test":1},"settlement":{"claim":1,"decision":2,"settlement":1},"some":{"decision":1,"result":1,"some":1,"stuff":1},"community":{"health":1,"percentage":1,"status":1,"code":1},"profil":{"health":1,"percentage":1,"status":1,"code":1},"popularity":{"popular":1,"repo":1},"risiko":{"risk":2},"details":{"item":1,"response":1},"status":{"status":2,"a":1,"response":2,"b":1},"a":{"status":1,"a":2,"response":1,"rule":4,"result":2,"name":1,"reason":1,"played":2,"nope":1,"cards":2,"players":1,"discard":1,"pile":1,"last":1},"b":{"status":1,"b":2,"response":1,"rule":4,"result":2,"name":1,"reason":1},"rule":{"rule":8,"result":4,"name":2,"reason":2,"a":1,"b":1,"approved":1},"evaluation":{"rule":8,"result":4,"name":2,"reason":2,"a":1,"b":1},"policy":{"policy":1},"guardrail":{"policy":1},"assessment":{"risk":1},"provided":{"successful":1,"run":1,"timeout":1},"action":{"successful":1,"run":1,"timeout":1,"cards":2,"last":1,"played":1,"action":1,"turn":1,"of":1,"round":1},"timeout":{"test":2,"report":2,"failure":2,"messages":2,"successful":2,"run":1,"experiment":1},"chaos":{"test":9,"report":9,"failure":4,"messages":3,"successful":2,"experiment":2,"start":1,"time":3,"end":2,"result":2,"count":1},"experiment":{"test":5,"report":5,"failure":3,"messages":2,"successful":2,"experiment":2,"count":1,"result":1,"end":1,"time":1},"failed":{"test":5,"report":5,"failure":3,"messages":2,"successful":1,"experiment":1,"count":1,"result":1,"end":1,"time":1,"payment":2,"failed":1,"reason":1,"amount":1},"after":{"test":1,"report":1,"failure":1,"messages":1,"successful":1,"experiment":1,"customer":1,"support":1,"agent":1},"hours":{"test":1,"report":1,"failure":1,"messages":1,"successful":1,"experiment":1},"experiments":{"test":4,"report":4,"start":1,"time":2,"failure":1,"messages":1,"end":1,"result":1},"invalid":{"credit":1,"card":1,"error":1,"message":1,"rejection":2,"reason":2},"expiry":{"credit":1,"card":1,"error":1,"message":1},"tweet":{"approved":1},"business":{"approved":1},"charge":{"approved":1,"process":10,"variable":10,"response":10,"status":7,"code":7},"card":{"approved":1,"process":10,"variable":10,"response":10,"status":7,"code":7,"played":3,"nope":2,"cards":3,"correlation":1,"key":1,"players":1,"discard":1,"pile":1,"last":1},"accounts":{"accounts":2},"weather":{"forecast":2,"temperature":2},"forecast":{"forecast":2,"temperature":2},"soap":{"forecast":2,"temperature":2},"script":{"message":1},"form":{"start":1,"date":1,"user":1,"id":1},"检查是否通过":{"passed":1},"mail":{"message":2,"id":2,"ws":2,"response":2,"send":1,"mail":1,"result":1,"success":1,"sent":1},"complete":{"message":1},"prepare":{"to":1,"value":1,"of":1,"items":1},"message":{"to":1,"received":1,"notification":1,"message":1,"conversation":2,"tool":2,"call":2,"result":2},"pong":{"received":1,"from":1,"me":1},"new":{"spot":1,"price":2,"conversation":2,"id":1,"user":2,"name":1,"request":1,"agent":1,"context":1},"spot":{"spot":2,"price":3},"signal":{"price":1},"trade":{"amount":1},"activty":{"3":1,"var":1},"output":{"2":1,"name":2,"of":2,"variable":2,"in":2,"main":2,"process":2},"serve":{"my":2,"output":2,"parameter":2,"some":1,"out":1,"variable":1,"target":1},"customers":{"my":2,"output":2,"parameter":2,"some":1,"out":1,"variable":1,"target":1},"metrics":{"message":1},"poll":{"mails":1},"pizza":{"mails":1},"orders":{"mails":1},"grade":{"final":1,"grade":3,"supplier":1,"mechanics":1},"retrieve":{"process":1,"variable":1,"response":1,"first":1,"name":2,"last":1,"sheet":1,"url":1,"request":1,"id":1},"payment":{"process":1,"variable":1,"response":1,"payment":3,"received":1,"valid":1,"invoice":1,"id":1,"is":1,"accepted":1,"failed":1,"reason":1,"amount":1},"ship":{"process":1,"variable":1,"response":1},"goods":{"process":2,"variable":2,"response":2},"notification":{"status":2,"code":2},"adapter":{"process":6,"variable":6,"response":6,"status":3,"code":3},"method":{"execute":1,"result":1,"variable":1,"data":1},"result":{"execute":1,"result":2,"variable":1,"data":1,"tool":1,"call":1},"store":{"process":1,"variable":1,"response":1},"receive":{"process":4,"variable":4,"a":2,"b":2},"echo":{"process":4,"variable":4,"a":2,"b":2},"do":{"foo":1,"some":1,"stuff":1,"guess":1,"answer":1},"stuff":{"foo":1,"some":1,"stuff":1},"book":{"tracking":1,"code":1,"success":3},"the":{"tracking":1,"code":1,"risk":2,"score":1,"supplier":1,"grade":2,"bodywork":1,"report":1,"mechanics":1,"repair":1,"cost":1,"review":1,"note":1,"daily":1,"rate":1,"allowance":1,"in":1,"euro":1,"audit":1,"verdict":1,"payout":1,"receipt":1,"payment":1,"reference":1},"carrier":{"tracking":1,"code":1},"country":{"risk":1,"score":1},"supplier":{"supplier":1,"grade":1},"arrange":{"audit":1,"verdict":1},"an":{"audit":1,"verdict":1},"site":{"audit":1,"verdict":1},"audit":{"audit":2,"verdict":2},"bodywork":{"bodywork":1,"report":1},"mechanical":{"mechanics":1,"grade":1},"damage":{"mechanics":1,"grade":1,"damage":1,"assessment":1},"repair":{"repair":1,"cost":1},"submitted":{"review":1,"note":1},"receipts":{"review":1,"note":1},"daily":{"daily":1,"rate":1},"allowance":{"daily":1,"rate":1,"allowance":1,"in":1,"euro":1},"claim":{"allowance":1,"in":1,"euro":1,"audit":1,"verdict":1,"has":7,"empty":7,"spots":7,"routing":1,"decision":1},"currency":{"allowance":1,"in":1,"euro":1},"pay":{"payout":1,"receipt":1,"payment":1,"reference":1},"reimbursement":{"payout":1,"receipt":1,"payment":1,"reference":1},"label":{"parcel":1,"label":1},"each":{"parcel":1,"label":1},"parcel":{"parcel":1,"label":1},"normal":{"is":1,"normal":1},"cheack":{"medicine":1},"coagulation":{"medicine":1},"time":{"time":2,"since":2,"blood":2,"loss":2,"tool":1,"call":1,"result":1},"since":{"time":2,"since":2,"blood":2,"loss":2},"blood":{"time":2,"since":2,"blood":2,"loss":2},"loss":{"time":2,"since":2,"blood":2,"loss":2},"level":{"risk":1,"damage":1,"assessment":1},"physiological":{"is":20,"suspected":20},"measurements":{"is":20,"suspected":20},"infection":{"infection":18,"is":18,"large":18},"soberity":{"is":20,"sober":20},"camunda":{"user":1,"id":1,"success":3,"tool":3,"call":3,"result":3,"sanctions":1,"match":2,"raw":4,"pep":1,"risk":2,"tier":1,"score":1},"sign":{"gcp":1,"authorization":1,"token":1},"into":{"gcp":1,"authorization":1,"token":1},"google":{"gcp":1,"authorization":1,"token":1},"retry":{"auth":2,"retries":4,"count":2,"remaining":2,"refresh":2},"scope":{"state":1},"url":{"result":1,"auth":2,"code":2,"callback":2,"microsoft":1,"access":1,"token":1,"url":3,"authorize":1,"azure":1,"encoded":1},"encode":{"result":1,"auth":2,"code":2,"callback":2,"azure":2,"encoded":2,"url":1,"scopes":1},"token":{"microsoft":1,"access":2,"token":2,"url":1,"azure":1},"authorize":{"authorize":1,"url":1},"attempt":{"request":1,"id":1},"authorization":{"request":1,"id":1},"code":{"request":1,"id":1,"received":1,"notification":1,"message":1},"callback":{"azure":1,"encoded":1,"auth":1,"code":1,"callback":1,"url":1},"scopes":{"azure":1,"encoded":1,"scopes":1},"sample":{"send":1,"message":1},"received":{"customer":3,"name":1,"address":1,"order":2,"e":1,"mail":1,"mobile":1,"phone":1,"id":2,"invoice":1,"received":1,"notification":1,"message":1,"tool":1,"call":1,"result":1,"conversation":1},"by":{"is":2,"accepted":2},"sales":{"is":2,"accepted":2},"department":{"is":1,"accepted":1},"head":{"is":1,"accepted":1},"of":{"is":1,"accepted":1,"value":1,"of":1,"items":1},"choose":{"distributor":1,"case":1,"owner":1,"email":1},"distributor":{"distributor":1},"value":{"value":1,"of":1,"items":1},"items":{"value":1,"of":1,"items":1,"tool":1,"call":1,"result":1},"delivery":{"value":1,"of":1,"items":1},"satisfaction":{"order":1,"id":1,"customer":1,"name":1,"meal":1},"survey":{"order":1,"id":1,"customer":1,"name":1,"meal":1},"confirm":{"valid":1,"ws":2,"response":2},"created":{"invoice":1,"id":1,"group":1},"construct":{"result":8},"supervisor":{"result":2},"submitter":{"result":2},"colleague":{"result":2},"direct":{"result":2},"reports":{"result":2},"variables":{"employee":1,"name":1,"deadline":2,"date":1,"time":1,"survey":1,"link":1},"template":{"template":1},"ticket":{"tickets":3,"resolved":1},"reserved":{"tickets":3},"out":{"payment":3,"id":3},"cloudevents":{"payment":3,"id":3},"async":{"out":1,"result":1},"void":{"out":1,"result":1},"throw":{"throw":1,"result":1},"warn":{"ws":4,"response":4},"again":{"ws":1,"response":1},"notice":{"ws":3,"response":3},"about":{"ws":5,"response":5},"loaded":{"ws":3,"response":3},"blacklisting":{"ws":1,"response":1},"removal":{"ws":1,"response":1},"creation":{"ws":1,"response":1},"membership":{"membership":7,"id":7,"has":7,"empty":7,"spots":7},"requested":{"membership":7,"id":8,"customer":2,"name":1,"request":1},"маршрут":{"credit":1,"route":1},"по":{"credit":1,"route":1},"сумме":{"credit":1,"route":1},"tree":{"service":1,"route":1},"my":{"received":1,"notification":1,"message":1},"saved":{"path":1},"master":{"customer":2,"id":1,"name":1},"placed":{"order":1},"checked":{"order":1},"render":{"body":1,"subject":1},"body":{"body":1},"subject":{"subject":1},"templates":{"result":1,"templates":1},"comfirmation":{"request":1},"support":{"resolved":1,"customer":1,"support":1,"agent":1},"case":{"case":2,"owner":1,"email":1,"successful":1},"owner":{"case":1,"owner":1,"email":1},"homework":{"guess":1,"answer":1},"made":{"test":1},"it":{"test":1},"played":{"played":1,"nope":1,"cards":1,"correlation":1,"key":1},"nope":{"noped":1,"player":1,"played":3,"nope":2,"cards":3,"correlation":1,"key":1,"players":1,"discard":1,"pile":1,"last":1},"turn":{"turn":1,"of":1,"round":1},"select":{"cards":2,"last":1,"played":1,"action":1,"turn":1,"of":1,"round":1},"play":{"played":2,"nope":1,"cards":2,"players":1,"discard":1,"pile":1,"last":1},"scoring":{"risk":1,"tier":1},"rules":{"risk":1,"tier":1},"carbon":{"execution":2,"delayed":4,"mapped":6,"by":2,"original":2,"carbon":8,"actual":2,"saved":2,"reduced":2},"reductor":{"execution":2,"delayed":4,"mapped":6,"by":2,"original":2,"carbon":8,"actual":2,"saved":2,"reduced":2},"character":{"character":1},"enter":{"wishlist":1,"child":1},"wishlist":{"wishlist":1,"child":1},"hotel":{"success":1},"http":{"success":3,"tool":3,"call":3,"result":3,"sanctions":1,"match":2,"raw":4,"pep":1,"risk":2,"tier":1,"score":1},"car":{"success":1},"flight":{"success":1},"incident":{"team":1},"team":{"team":1},"product":{"tool":2,"call":2,"result":3,"test":1},"catalog":{"tool":1,"call":1,"result":1},"search":{"tool":1,"call":1,"result":1},"knowledge":{"tool":1,"call":1,"result":1},"base":{"tool":1,"call":1,"result":1},"reply":{"conversation":1},"chat":{"conversation":1},"conversation":{"conversation":2,"id":1,"user":2,"name":1,"request":1,"agent":1,"context":1},"human":{"customer":1,"support":1,"agent":1,"tool":1,"call":1,"result":1},"escalation":{"customer":1,"support":1,"agent":1},"minutes":{"customer":1,"support":1,"agent":1},"working":{"case":1,"successful":1},"upload":{"pdf":2},"demo":{"result":1,"test":1},"kotlin":{"delegate":1,"result":1,"mapping":1},"simple":{"delegate":1,"result":2,"mapping":2,"java":1},"params":{"delegate":1,"result":2,"mapping":2,"java":1},"in":{"java":1,"result":1,"mapping":1},"java":{"java":1,"result":1,"mapping":1},"optional":{"java":1,"result":1,"mapping":1},"superflux":{"tool":1,"call":1,"result":1},"calculation":{"tool":1,"call":1,"result":1},"ask":{"tool":1,"call":1,"result":1},"kyc":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1},"screening":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":2,"tier":1,"score":1,"address":1,"employment":1,"kyc":2,"recommendation":1,"rationale":1,"tool":1,"call":1,"result":1},"agentcost":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"capture":{"agent":1,"screening":2,"report":1,"summary":1,"identity":1,"verified":2,"sanctions":1,"match":2,"pep":1,"risk":3,"tier":1,"score":1,"address":1,"employment":1,"kyc":3,"recommendation":1,"rationale":1,"judge":2,"decision":1,"reasoning":1,"assessment":1},"identity":{"tool":1,"call":1,"result":1},"screen":{"tool":1,"call":1,"result":1,"sanctions":1,"match":2,"raw":2,"pep":1},"sanctions":{"tool":1,"call":1,"result":1,"sanctions":1,"match":2,"raw":2,"pep":1},"pep":{"tool":1,"call":1,"result":1,"sanctions":1,"match":2,"raw":2,"pep":1},"additional":{"tool":1,"call":1,"result":1},"information":{"tool":1,"call":1,"result":1},"submit":{"tool":1,"call":1,"result":1},"edd":{"judge":2,"decision":1,"reasoning":1,"kyc":1,"risk":1,"assessment":1},"judge":{"judge":2,"decision":1,"reasoning":1,"kyc":1,"risk":1,"assessment":1},"onboarding":{"onboarding":1,"decision":1},"authority":{"onboarding":1,"decision":1},"detection":{"fraud":3,"score":1,"indicators":1,"requires":1,"review":1},"sla":{"sla":1,"decision":1},"duration":{"sla":1,"decision":1},"injury":{"injury":1,"assessment":1},"severity":{"injury":1,"assessment":1},"whether":{"automatic":1,"processing":1},"configurable":{"is":3,"order":3,"valid":3,"decision":3},"validations":{"is":3,"order":3,"valid":3,"decision":3},"general":{"is":1,"order":1,"valid":1,"decision":1},"decision":{"underwriting":1,"decision":1,"result":1}},"position":{"1":{"sum":84,"count":96},"2":{"sum":23,"count":29},"3":{"sum":7,"count":13},"completed":{"sum":0,"count":3},"case":{"sum":1.3333333333333333,"count":6},"instance":{"sum":2.6666666666666665,"count":4},"id":{"sum":47.6,"count":48},"account":{"sum":0,"count":1},"number":{"sum":1,"count":1},"file":{"sum":0.5,"count":2},"size":{"sum":0.5,"count":1},"ok":{"sum":1,"count":1},"skills":{"sum":1,"count":2},"selected":{"sum":1,"count":5},"employee":{"sum":4,"count":8},"experience":{"sum":1,"count":1},"score":{"sum":9,"count":10},"underwriter":{"sum":0.5,"count":1},"approved":{"sum":2,"count":4},"underwriting":{"sum":0,"count":2},"result":{"sum":53.33333333333333,"count":67},"check":{"sum":1.1166666666666667,"count":4},"unique":{"sum":0.5,"count":1},"rsp":{"sum":1.15,"count":2},"against":{"sum":0.8,"count":1},"mandatory":{"sum":0.6666666666666666,"count":1},"fields":{"sum":1,"count":1},"claims":{"sum":0.5,"count":1},"field":{"sum":0.6666666666666666,"count":1},"length":{"sum":1,"count":1},"user":{"sum":0.5,"count":6},"name":{"sum":12,"count":14},"viral":{"sum":0,"count":1},"room":{"sum":0,"count":1},"upgrade":{"sum":1,"count":1},"free":{"sum":0,"count":1},"drinks":{"sum":1,"count":1},"breakfast":{"sum":0.5,"count":1},"email":{"sum":5.75,"count":8},"benefits":{"sum":0.5,"count":1},"async":{"sum":0,"count":1},"approver":{"sum":0,"count":18},"groups":{"sum":19,"count":19},"data":{"sum":5,"count":6},"risk":{"sum":5,"count":20},"dm":{"sum":0.5,"count":1},"nresult":{"sum":1,"count":1},"document":{"sum":3,"count":4},"dmn":{"sum":0,"count":2},"dish":{"sum":0.5,"count":1},"beverages":{"sum":0.5,"count":1},"discount":{"sum":0.5,"count":3},"decade":{"sum":0.5,"count":1},"video":{"sum":0,"count":1},"game":{"sum":1,"count":1},"band":{"sum":0.5,"count":1},"movie":{"sum":0.5,"count":1},"suitable":{"sum":0,"count":1},"consultants":{"sum":1,"count":1},"clarified":{"sum":6,"count":12},"assessment":{"sum":4.5,"count":6},"complex":{"sum":0,"count":1},"value":{"sum":15,"count":16},"general":{"sum":0,"count":2},"config":{"sum":1.5,"count":2},"json":{"sum":3,"count":3},"is":{"sum":9,"count":71},"included":{"sum":1,"count":1},"failing":{"sum":0,"count":1},"task":{"sum":4,"count":13},"complete":{"sum":0,"count":2},"price":{"sum":5,"count":6},"fraud":{"sum":0,"count":5},"counter":{"sum":1,"count":2},"chosen":{"sum":0,"count":3},"team":{"sum":3.5,"count":4},"assignee":{"sum":0.5,"count":1},"candidate":{"sum":0,"count":2},"users":{"sum":1,"count":1},"mypath":{"sum":1,"count":2},"the":{"sum":0,"count":1},"answer":{"sum":1.5,"count":2},"status":{"sum":0,"count":17},"transfer":{"sum":2,"count":4},"expense":{"sum":4,"count":4},"risikobewertung":{"sum":1,"count":2},"risks":{"sum":1,"count":2},"risikopruefung":{"sum":1,"count":2},"business":{"sum":0,"count":3},"decision":{"sum":15,"count":17},"output":{"sum":8,"count":10},"automatic":{"sum":0,"count":3},"approval":{"sum":1,"count":3},"mapping":{"sum":4,"count":4},"message":{"sum":5,"count":11},"welcome":{"sum":1,"count":1},"doc":{"sum":0,"count":4},"extracted":{"sum":1,"count":1},"merged":{"sum":1,"count":1},"watermark":{"sum":1,"count":1},"image":{"sum":0.3333333333333333,"count":1},"to":{"sum":1.6666666666666665,"count":3},"pdf":{"sum":3.333333333333333,"count":5},"list":{"sum":0,"count":1},"images":{"sum":1,"count":1},"time":{"sum":4,"count":7},"stamp":{"sum":0.5,"count":1},"ping":{"sum":1,"count":1},"jvm":{"sum":0,"count":1},"parameters":{"sum":1,"count":1},"cherry":{"sum":0,"count":9},"icon":{"sum":1,"count":1},"mime":{"sum":0.5,"count":1},"type":{"sum":1,"count":1},"in":{"sum":3.6,"count":7},"folder":{"sum":1,"count":1},"temp":{"sum":1,"count":1},"source":{"sum":0.3333333333333333,"count":1},"destination":{"sum":0.3333333333333333,"count":1},"greeting":{"sum":1,"count":2},"response":{"sum":28.5,"count":29},"xml":{"sum":0,"count":5},"holiday":{"sum":3,"count":3},"sub":{"sum":0,"count":48},"process":{"sum":10.833333333333334,"count":56},"circuit":{"sum":26,"count":66},"quantum":{"sum":9,"count":12},"programming":{"sum":9,"count":12},"language":{"sum":12,"count":12},"execution":{"sum":9,"count":18},"service":{"sum":0,"count":13},"mitigated":{"sum":0,"count":3},"counts":{"sum":9,"count":15},"cutting":{"sum":0,"count":3},"meta":{"sum":1.5,"count":3},"circuits":{"sum":3,"count":3},"meas":{"sum":0,"count":9},"qubits":{"sum":19,"count":19},"depth":{"sum":9.5,"count":19},"transpiled":{"sum":9,"count":9},"untranspiled":{"sum":10,"count":10},"num":{"sum":5,"count":10},"iterations":{"sum":7,"count":14},"converged":{"sum":3.5,"count":7},"obj":{"sum":0,"count":10},"evaluated":{"sum":0,"count":9},"costs":{"sum":9,"count":9},"max":{"sum":0,"count":5},"cut":{"sum":2.5,"count":5},"plot":{"sum":7.5,"count":9},"tsp":{"sum":0,"count":1},"ws":{"sum":0,"count":19},"bitstring":{"sum":4,"count":4},"optimizer":{"sum":0,"count":1},"init":{"sum":1,"count":1},"distance":{"sum":0,"count":1},"matrix":{"sum":2,"count":2},"duration":{"sum":0,"count":1},"probability":{"sum":2,"count":4},"distribution":{"sum":4,"count":4},"visualization":{"sum":3,"count":3},"agent":{"sum":5.5,"count":8},"error":{"sum":0.6666666666666666,"count":3},"var":{"sum":2,"count":81},"out":{"sum":2.3333333333333335,"count":7},"target":{"sum":1,"count":10},"order":{"sum":7.499999999999999,"count":19},"variable":{"sum":19.066666666666666,"count":32},"i":{"sum":6,"count":12},"foo":{"sum":1.5,"count":3},"valid":{"sum":6.000000000000001,"count":8},"customer":{"sum":0,"count":11},"notified":{"sum":1,"count":1},"loan":{"sum":0,"count":1},"exchange":{"sum":0,"count":1},"rate":{"sum":2,"count":2},"converted":{"sum":0,"count":1},"amount":{"sum":2.5,"count":3},"routing":{"sum":0.5,"count":3},"background":{"sum":0,"count":1},"rationale":{"sum":1.5,"count":2},"fit":{"sum":0,"count":1},"interview":{"sum":0,"count":1},"slot":{"sum":1,"count":1},"invitation":{"sum":0,"count":1},"recruiter":{"sum":0,"count":1},"summary":{"sum":1.5,"count":2},"rejection":{"sum":0,"count":3},"access":{"sum":0.8333333333333333,"count":3},"granted":{"sum":1,"count":1},"required":{"sum":1,"count":1},"ignored":{"sum":0.5,"count":1},"claim":{"sum":0,"count":1},"level":{"sum":1.5,"count":2},"health":{"sum":0,"count":1},"percentage":{"sum":1,"count":1},"code":{"sum":13.1,"count":14},"popular":{"sum":0,"count":1},"repo":{"sum":1,"count":1},"my":{"sum":0,"count":8},"date":{"sum":3,"count":3},"long":{"sum":1,"count":1},"string":{"sum":1,"count":1},"boolean":{"sum":1,"count":1},"enum":{"sum":1,"count":1},"item":{"sum":0,"count":1},"a":{"sum":3,"count":4},"b":{"sum":3,"count":4},"rule":{"sum":0,"count":8},"reason":{"sum":5,"count":5},"policy":{"sum":0.5,"count":1},"successful":{"sum":1,"count":6},"run":{"sum":2,"count":2},"timeout":{"sum":0.5,"count":1},"test":{"sum":1.5,"count":14},"report":{"sum":5.666666666666667,"count":13},"failure":{"sum":3.9999999999999996,"count":6},"messages":{"sum":5,"count":5},"experiment":{"sum":3,"count":3},"start":{"sum":0.6666666666666666,"count":2},"end":{"sum":1.3333333333333333,"count":2},"count":{"sum":3,"count":3},"credit":{"sum":0,"count":2},"card":{"sum":0.3333333333333333,"count":1},"accounts":{"sum":1,"count":2},"forecast":{"sum":1,"count":2},"temperature":{"sum":1,"count":2},"percent":{"sum":1,"count":1},"passed":{"sum":0.5,"count":1},"arbval":{"sum":0.5,"count":1},"from":{"sum":1.5,"count":2},"received":{"sum":1.5,"count":3},"me":{"sum":0.5,"count":1},"took":{"sum":0,"count":2},"condition":{"sum":1.5,"count":3},"spot":{"sum":0,"count":2},"body":{"sum":1,"count":2},"basis":{"sum":0.5,"count":1},"of":{"sum":1.8666666666666667,"count":5},"main":{"sum":1.4666666666666668,"count":2},"parameter":{"sum":2,"count":2},"some":{"sum":0,"count":2},"mails":{"sum":0.5,"count":1},"final":{"sum":0,"count":1},"grade":{"sum":3,"count":3},"execute":{"sum":0,"count":1},"first":{"sum":0,"count":1},"last":{"sum":0,"count":3},"sheet":{"sum":0,"count":1},"url":{"sum":4,"count":4},"tracking":{"sum":0,"count":1},"supplier":{"sum":0,"count":1},"audit":{"sum":0,"count":2},"verdict":{"sum":2,"count":2},"bodywork":{"sum":0,"count":1},"mechanics":{"sum":0,"count":1},"repair":{"sum":0,"count":1},"cost":{"sum":1,"count":1},"review":{"sum":1,"count":3},"note":{"sum":1,"count":1},"daily":{"sum":0,"count":1},"allowance":{"sum":0,"count":1},"euro":{"sum":1,"count":1},"payout":{"sum":0,"count":1},"receipt":{"sum":1,"count":1},"payment":{"sum":0,"count":7},"reference":{"sum":1,"count":1},"parcel":{"sum":0,"count":1},"label":{"sum":1,"count":1},"normal":{"sum":1,"count":1},"medicine":{"sum":0.5,"count":1},"since":{"sum":0.6666666666666666,"count":2},"blood":{"sum":1.3333333333333333,"count":2},"loss":{"sum":2,"count":2},"suspected":{"sum":20,"count":20},"infection":{"sum":0,"count":18},"large":{"sum":18,"count":18},"sober":{"sum":20,"count":20},"gcp":{"sum":0,"count":1},"authorization":{"sum":0.5,"count":1},"token":{"sum":2.6666666666666665,"count":3},"auth":{"sum":0.4,"count":4},"retries":{"sum":2,"count":4},"remaining":{"sum":2,"count":2},"refresh":{"sum":0,"count":2},"state":{"sum":0.5,"count":1},"callback":{"sum":1.8,"count":2},"microsoft":{"sum":0,"count":1},"authorize":{"sum":0,"count":1},"request":{"sum":1.5,"count":3},"azure":{"sum":0,"count":3},"encoded":{"sum":0.7,"count":2},"scopes":{"sum":1,"count":1},"send":{"sum":0,"count":2},"address":{"sum":0.5,"count":2},"e":{"sum":0.5,"count":1},"mail":{"sum":1.5,"count":2},"mobile":{"sum":0.5,"count":1},"phone":{"sum":1,"count":1},"accepted":{"sum":3,"count":3},"distributor":{"sum":0.5,"count":1},"items":{"sum":1,"count":1},"meal":{"sum":0.5,"count":1},"invoice":{"sum":0,"count":2},"deadline":{"sum":0,"count":2},"survey":{"sum":0,"count":1},"link":{"sum":1,"count":1},"template":{"sum":0.5,"count":1},"tickets":{"sum":1.5,"count":3},"throw":{"sum":0,"count":1},"membership":{"sum":0,"count":7},"has":{"sum":0,"count":7},"empty":{"sum":3.5,"count":7},"spots":{"sum":7,"count":7},"route":{"sum":2,"count":2},"notification":{"sum":0.5,"count":1},"path":{"sum":0.5,"count":1},"group":{"sum":0.5,"count":1},"stuff":{"sum":1,"count":1},"success":{"sum":2,"count":4},"subject":{"sum":0.5,"count":1},"templates":{"sum":0.5,"count":1},"sent":{"sum":2.5,"count":3},"failed":{"sum":0.5,"count":1},"resolved":{"sum":0.5,"count":1},"owner":{"sum":0.5,"count":1},"guess":{"sum":0.5,"count":1},"played":{"sum":1,"count":5},"nope":{"sum":1.5,"count":3},"cards":{"sum":5.5,"count":6},"correlation":{"sum":0,"count":2},"key":{"sum":2,"count":2},"noped":{"sum":0,"count":1},"player":{"sum":1,"count":1},"turn":{"sum":0,"count":2},"round":{"sum":2,"count":2},"action":{"sum":0.5,"count":1},"players":{"sum":0.5,"count":1},"discard":{"sum":0,"count":1},"pile":{"sum":1,"count":1},"tier":{"sum":2.5,"count":3},"delayed":{"sum":1.5,"count":4},"mapped":{"sum":6,"count":6},"by":{"sum":1.5,"count":2},"original":{"sum":0,"count":2},"carbon":{"sum":6,"count":8},"actual":{"sum":0,"count":2},"saved":{"sum":0,"count":2},"reduced":{"sum":0,"count":2},"character":{"sum":0.5,"count":1},"wishlist":{"sum":0.5,"count":1},"child":{"sum":0.5,"count":1},"support":{"sum":2,"count":4},"tool":{"sum":0,"count":16},"call":{"sum":7.75,"count":16},"conversation":{"sum":1.5,"count":4},"context":{"sum":1,"count":1},"delegate":{"sum":0,"count":1},"java":{"sum":0,"count":1},"screening":{"sum":0,"count":2},"identity":{"sum":0,"count":1},"verified":{"sum":2,"count":2},"sanctions":{"sum":0,"count":2},"match":{"sum":3,"count":4},"pep":{"sum":0,"count":2},"employment":{"sum":0.5,"count":1},"kyc":{"sum":0,"count":3},"recommendation":{"sum":1,"count":1},"raw":{"sum":4,"count":4},"judge":{"sum":0,"count":2},"reasoning":{"sum":1,"count":1},"onboarding":{"sum":0,"count":1},"indicators":{"sum":1,"count":1},"requires":{"sum":0.5,"count":1},"sla":{"sum":0,"count":1},"injury":{"sum":0,"count":1},"damage":{"sum":0,"count":1},"settlement":{"sum":0,"count":1},"processing":{"sum":1,"count":1}}}`)});function sigmoid(e){return e>=0?1/(1+Math.exp(-e)):Math.exp(e)/(1+Math.exp(e))}function probabilityOf(e,t){if(e.kind===`platt`)return sigmoid(e.slope*t+e.intercept);if(e.upTo.length===0)return 0;let n=0,r=e.upTo.length-1;for(;n<r;){let i=n+r>>1;t<=e.upTo[i]?r=i:n=i+1}return e.value[n]}function vectorOf(e,t){return t.map(t=>{let n=e[t];if(typeof n!=`number`||!Number.isFinite(n))throw Error(`feature ${t} is missing or not a finite number`);return n})}function scoreLogistic(e,t){return contributionsLogistic(e,t).reduce((e,t)=>e+t,0)}function contributionsLogistic(e,t){return e.weights.map((n,r)=>n*(Math.min(e.high[r],Math.max(e.low[r],t[r]))-e.mean[r])/e.scale[r])}var _u=-1;function leafOf(e,t){let n=e.nodes[0];for(;n.feature!==_u;)n=e.nodes[t[n.feature]<=n.threshold?n.left:n.right];return n}function scoreTrees(e,t){return e.trees.reduce((e,n)=>e+leafOf(n,t).value,0)}function contributionsTrees(e,t){let n=Array(t.length).fill(0);for(let r of e.trees){let e=r.nodes[0];for(;e.feature!==_u;){let i=r.nodes[t[e.feature]<=e.threshold?e.left:e.right];n[e.feature]+=i.value-e.value,e=i}}return n}function scoreOf(e,t){return e.family===`logistic`?scoreLogistic(e,t):scoreTrees(e,t)}function contributionsOf(e,t){return e.family===`logistic`?contributionsLogistic(e,t):contributionsTrees(e,t)}function compareText(e,t){return e<t?-1:+(e>t)}function reasonsOf(e,t,n){return contributionsOf(t,n).map((t,n)=>({feature:e.features[n],contribution:t})).filter(e=>e.contribution!==0).sort((e,t)=>Math.abs(t.contribution)-Math.abs(e.contribution)||compareText(e.feature,t.feature)).slice(0,3)}function decide(e,t,n){if(n===null||e.length===0)return null;let[r,i]=e.map((e,t)=>t).sort((n,r)=>e[r]-e[n]||compareText(t[n],t[r])),a=e[r]-(i===void 0?0:e[i]);return a<=0||e[r]<n.probability||a<n.margin?null:r}function scoredOf(e,t,n){let r=n.map(t=>vectorOf(t.features,e.features));return{taskModel:t,rows:r,probabilities:r.map(e=>probabilityOf(t.calibration,scoreOf(t.scorer,e)))}}function rankTask(e,t,n){let r=e.tasks[t];if(r===void 0||r.threshold===null||n.length===0)return[];let i=scoredOf(e,r,n),a=decide(i.probabilities,n.map(e=>e.value),r.threshold);return a===null?[]:[suggestionAt(e,t,n,i,a)]}function suggestionAt(e,t,n,r,i){return{task:t,value:n[i].value,origin:n[i].origin,probability:r.probabilities[i],reasons:reasonsOf(e,r.taskModel.scorer,r.rows[i])}}function rankingOf(e,t,n){let r=e.tasks[t];if(r===void 0||n.length===0)return[];let i=scoredOf(e,r,n);return n.map((e,t)=>t).sort((e,t)=>i.probabilities[t]-i.probabilities[e]||compareText(n[e].value,n[t].value)).map(r=>suggestionAt(e,t,n,i,r))}function rankerOf(e){return{rank:(t,n)=>rankTask(e,t,n)}}var vu={suggest:()=>[],ranking:()=>[],verdict:()=>({confident:!1,reason:`none`})};function suggestionProviderOf(e,t,n){if(!e.diagrams.some(e=>e.path===t))return vu;let r=rankerOf(n),i=new Map,candidatesOf=r=>{let a=JSON.stringify([r.task,r.elementId,r.field]),o=i.get(a);if(o!==void 0)return o;let s=inRequestScope(e,t,r,n.names,e=>candidatesOfRequest(e,r));return i.set(a,s),s},expressionOf=r=>r.field.trim()===``?[]:inRequestScope(e,t,r,n.names,e=>{let t=recogniseExpression(expressionContextOf(e,r));return t===null?[]:[{task:`expression`,value:t.value,origin:`transform`,probability:null,reasons:[],recognition:recognitionOf(t)}]}),a=new Map,verdictOf=r=>{if(r.task===`expression`)return null;let i=JSON.stringify([r.task,r.elementId,r.field]),o=a.get(i);if(o!==void 0)return o;let s=inRequestScope(e,t,r,n.names,e=>nameVerdictOf(e,r));return a.set(i,s),s};return{suggest:e=>e.task===`expression`?expressionOf(e):r.rank(e.task,candidatesOf(e)),ranking:e=>e.task===`expression`?expressionOf(e):rankingOf(n,e.task,candidatesOf(e)),verdict:verdictOf}}var yu=new SuggestionContextBuilder;function yieldToInput(){return new Promise(e=>setTimeout(e,0))}function shownWhenConfident(e){let shown=t=>{let n=e.verdict(t);return n===null||n.confident};return{suggest:t=>shown(t)?e.suggest(t):[],ranking:t=>shown(t)?e.ranking(t):[],verdict:t=>e.verdict(t)}}async function projectSuggestionsOf(e,t,n){return shownWhenConfident(suggestionProviderOf(await yu.build(e,t,{pause:yieldToInput,focus:n}),n,gu))}function useSuggestionProvider(e){f(()=>{if(e===null)return;let t=!0;return projectSuggestionsOf(e.texts,e.workers,e.focus).then(e=>{t&&P(e)}).catch(e=>console.error(`Penstock could not build the suggestions of the project:`,e)),()=>{t=!1}},[e]),f(()=>()=>P(null),[])}function publishProjectVariables(e){e.dataset.projectVariables=we().join(` `)}function popupIsOpen(e){try{return e.get(`feelPopup`)?.isOpen?.()===!0}catch{return!1}}function PropertiesPanel({selectedElementId:e,modeler:t,containerId:r=`js-properties-panel`,isPanelCollapsed:i=!1,reveal:a=null,onRevealed:c}){let l=s(!1),d=s(null),[p,m]=n(``);return useFieldSuggestions(d,e??null,m),f(()=>{if(t){try{let e=t.get(`propertiesPanel`);if(!e)return;if(i)l.current&&e.detach&&(e.detach(),l.current=!1);else if(!l.current&&e.attachTo){let t=d.current;t&&(e.attachTo(t),l.current=!0,publishProjectVariables(t))}}catch(e){console.error(`Error handling properties panel attach/detach:`,e)}return()=>{try{if(l.current){let e=t?.get?.(`propertiesPanel`);e?.detach&&e.detach(),l.current=!1}}catch(e){console.error(`Error detaching properties panel on unmount:`,e)}}}},[t,i,r]),f(()=>{let e=d.current;if(!t||!e)return;let n=t.get?.(`eventBus`),r=!1,busy=()=>e.contains(document.activeElement)||popupIsOpen(t),refresh=()=>{if(r&&!busy()){r=!1;try{let n=t.get(`propertiesPanel`);if(!l.current||!n?.detach||!n.attachTo)return;n.detach(),n.attachTo(e),publishProjectVariables(e)}catch(e){console.error(`Error refreshing the properties panel after the project variables changed:`,e)}}},later=()=>setTimeout(refresh,0);n?.on?.(`propertiesPanelPopup.close`,later),e.addEventListener(`focusout`,later);let i=Rt(()=>{r=!0,refresh()});return()=>{i(),e.removeEventListener(`focusout`,later),n?.off?.(`propertiesPanelPopup.close`,later)}},[t]),f(()=>{if(t&&!i)try{let e=t.get(`propertiesPanel`);e&&e._update&&l.current&&e._update()}catch(e){console.error(`Error updating properties panel:`,e)}},[t,e,i]),f(()=>{let e=d.current;if(!a?.length||!e)return;let attempt=()=>focusEntry(e,a)?(c?.(),!0):!1;if(attempt()||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{attempt()&&t.disconnect()});return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()},[a,c]),u(o,{children:[u(`div`,{id:r,ref:d,className:`properties-panel-wrapper`,style:{display:i?`none`:`block`}}),u(`p`,{class:`suggestion-announce`,role:`status`,"aria-live":`polite`,children:p})]})}var bu={top:3,right:3},xu={top:-12,right:-6};function badgePosition(e){let t=e?.businessObject?.$type??``;return/Task$|SubProcess$|CallActivity$|Transaction$/.test(t)?bu:xu}var Su={top:-12,left:-6};function stepPosition(e){let t=e?.businessObject?.$type??``;return/Task$|SubProcess$|CallActivity$|Transaction$/.test(t)?Su:xu}var Cu=[`marker-start`,`marker-end`];function endPainter(e){let t=(e??``).replace(/[^a-zA-Z0-9_-]/g,``)||`tag`,n=[],clear=()=>{n.forEach(({path:e,property:t,before:n})=>{try{n?e.style?.setProperty(t,n):e.style?.removeProperty(t)}catch{}}),n=[];try{document.querySelectorAll(`marker[data-${t}]`).forEach(e=>e.remove())}catch{}},paint=(e,r,i)=>{try{if(!e||typeof e.getGraphics!=`function`)return;let a=e.getGraphics(r),o=a?.ownerSVGElement;if(!a||!o)return;a.querySelectorAll(`.djs-visual > path, .djs-visual > polyline`).forEach(e=>{Cu.forEach(r=>{try{let a=e.style;if(!a)return;let s=a.getPropertyValue(r),c=/url\(["']?#([^"')]+)["']?\)/.exec(s),l=c?o.querySelector(`marker[id="${CSS.escape(c[1])}"]`):null;if(!l)return;let u=l.cloneNode(!0);u.id=`${c[1]}-${t}`,u.setAttribute(`data-${t}`,``),u.querySelectorAll(`path, circle, polyline`).forEach(e=>{let t=e,n=t.style?.getPropertyValue(`fill`);t.style?.setProperty(`stroke`,i),n&&n!==`none`&&n!==`transparent`&&t.style?.setProperty(`fill`,i)}),l.parentNode?.appendChild(u),a.setProperty(r,`url("#${u.id}")`),n.push({path:e,property:r,before:s})}catch{}})})}catch{}};return{paint,clear}}var wu=`penstock-run`,Tu={COMPLETED:`penstock-run-completed`,ACTIVE:`penstock-run-active`,FAILED:`penstock-run-failed`,TERMINATED:`penstock-run-terminated`},Eu=`penstock-run-selected`,Du=`penstock-run-flow`,Ou=[...Object.values(Tu),Eu,Du],ku=endPainter(`penstock-run`),Au=[];function clearPath(e){if(e){try{let t=e.get(`canvas`);t&&Au.forEach(e=>Ou.forEach(n=>{try{t.removeMarker(e,n)}catch{}}))}catch{}Au=[];try{ku.clear()}catch{}try{e.get(`overlays`)?.remove?.({type:wu})}catch{}}}function showPath(e,t,n){if(clearPath(e),e&&Array.isArray(t))try{let r=e.get(`elementRegistry`),i=e.get(`canvas`),a=e.get(`overlays`);if(!r||!i||!a)return;for(let e of t){if(!e?.elementId)continue;let t=null;try{t=r.get(e.elementId)}catch{}if(!t)continue;let n=Tu[e.state];if(n)try{i.addMarker(e.elementId,n),Au.push(e.elementId)}catch{}if(e.mocked)try{let n=document.createElement(`span`);n.className=`penstock-run-badge`,n.textContent=`Mocked`,n.title=Y(`app.runs.theScenarioAnsweredThisStep`),a.add(e.elementId,wu,{position:badgePosition(t),html:n})}catch{}}let o=[];try{let e=r.filter(e=>e&&(e.type===`bpmn:SequenceFlow`||e.type===`bpmn:MessageFlow`)&&e.source?.id&&e.target?.id)??[];for(let t of e)o.push({id:t.id,sourceId:t.source.id,targetId:t.target.id,message:t.type===`bpmn:MessageFlow`,joins:t.target.type===`bpmn:ParallelGateway`||t.target.type===`bpmn:InclusiveGateway`})}catch{}try{takenFlows(t.filter(e=>{if(!e?.elementId)return!1;try{return!!r.get(e.elementId)}catch{return!1}}),o).forEach(e=>{try{i.addMarker(e,Du),Au.push(e),ku.paint(i,e,`var(--theme-success)`)}catch{}})}catch{}if(n&&r.get(n))try{i.addMarker(n,Eu),Au.push(n)}catch{}}catch{}}var ju=`penstock-scenario-hover`,Mu=`penstock-review-open`,Nu=112,Pu=32;function leftCover(e){let t=e?.get?.(`canvas`)?.getContainer?.();return!t||typeof t.getBoundingClientRect!=`function`?0:mr(t.getBoundingClientRect(),pr(t).map(e=>e.getBoundingClientRect())).left}function viewOf(e){try{let t=e?.get?.(`canvas`)?.viewbox?.();if(t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height))return{x:t.x,y:t.y,width:t.width,height:t.height}}catch{}return{x:0,y:0,width:800,height:600}}function boxOf(e,t){try{let n=e?.get?.(`elementRegistry`)?.get?.(t);return n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.width)&&Number.isFinite(n.height)?{x:n.x,y:n.y,width:n.width,height:n.height}:null}catch{return null}}function glide(e,t){try{let n=e?.get?.(`canvas`);if(!n)return;if(V()){n.viewbox?.(t);return}let r=viewOf(e),i=performance.now(),a=Math.max(1,x(`--motion-base`)),step=e=>{try{let o=Math.min(1,(e-i)/a),s=1-(1-o)**3;n.viewbox?.({x:r.x+(t.x-r.x)*s,y:r.y+(t.y-r.y)*s,width:r.width,height:r.height}),o<1&&requestAnimationFrame(step)}catch{}};requestAnimationFrame(step)}catch{}}function preview(e,t,n,r){try{let i=e?.get?.(`canvas`),a=e?.get?.(`elementRegistry`);if(!i||!a)return;if(n&&a.get?.(n))try{i.removeMarker?.(n,ju)}catch{}if(!t||!a.get?.(t))return;try{i.addMarker?.(t,ju)}catch{}let o=boxOf(e,t),s=viewOf(e),c=i.zoom?.()||1;o&&needsPan(s,o,1)&&glide(e,panTarget(s,o,{left:leftCover(e)/c,right:r/c}))}catch{}}function pin(e,t,n){try{let r=boxOf(e,t);if(!r)return;let i=e?.get?.(`canvas`);if(!i)return;let a=viewOf(e),o=i.zoom?.()||1,s={left:leftCover(e)/o,right:n/o};needsPan({x:a.x+s.left,y:a.y,width:Math.max(1,a.width-s.left-s.right),height:a.height},r,.6)&&glide(e,panTarget(a,r,s))}catch{}}function refit(e,t){try{let n=Number.isFinite(t)?t:0,r=e?.get?.(`canvas`);if(!r)return;r.resized?.();let i=e?.get?.(`elementRegistry`);if(!i)return;let a=i.filter?.(e=>e&&!e.waypoints&&e.parent)??[];if(a.length===0)return;let o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e of a){let t=Number.isFinite(e?.x)?e.x:0,n=Number.isFinite(e?.y)?e.y:0,r=Number.isFinite(e?.width)?e.width:0,i=Number.isFinite(e?.height)?e.height:0;t<o&&(o=t),n<s&&(s=n),t+r>c&&(c=t+r),n+i>l&&(l=n+i)}if(!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(c)||!Number.isFinite(l))return;let u=r.viewbox?.()?.outer;if(!u||!(u.width>0)||!(u.height>0))return;let d=Math.max(Nu,leftCover(e))+Pu,f=u.width-n-d-Pu,p=c-o,m=l-s;if(!(p>0)||!(m>0))return;let h=Math.min(1,f/p,(u.height-64)/m);if(!(h>0))return;r.viewbox?.({x:o-d/h,y:(s+l)/2-u.height/(2*h),width:u.width/h,height:u.height/h})}catch{}}function markReviewOpen(e,t){try{e?.get?.(`canvas`)?.getContainer?.()?.classList?.toggle?.(Mu,t)}catch{}}var Fu=`penstock-scenario`,Iu=`penstock-scenario-on`,Lu=`penstock-scenario-flow`,Ru=`penstock-scenario-unreached`,zu=`penstock-scenario-diff`,Bu=`penstock-scenario-selected`,Vu=[Iu,Lu,Ru,zu,Bu],Hu=endPainter(`penstock-scenario`),Uu=[];function clearScenarioOverlay(e){if(e){try{let t=e.get(`canvas`);t&&Uu.forEach(e=>Vu.forEach(n=>{try{t.removeMarker(e,n)}catch{}}))}catch{}Uu=[];try{Hu.clear()}catch{}try{e.get(`overlays`)?.remove?.({type:Fu})}catch{}}}function showScenarioOverlay(e,t){if(clearScenarioOverlay(e),e&&t)try{let n=e.get(`elementRegistry`),r=e.get(`canvas`),i=e.get(`overlays`);if(!n||!r||!i)return;let mark=(e,t)=>{try{return n.get(e)?(r.addMarker(e,t),Uu.push(e),!0):!1}catch{return!1}};if((t.unreachedFlows??[]).forEach(e=>mark(e,Ru)),(t.unreachedEnds??[]).forEach(e=>mark(e,Ru)),t.path){for(let e of t.path.flowIds??[])try{mark(e,Lu)&&Hu.paint(r,e,`var(--theme-accent-primary)`)}catch{}for(let e of t.path.elementIds??[])try{let r=n.get(e);if(!r)continue;mark(e,Iu);let a=document.createElement(`span`),o=t.path.numbers?.get(e);a.className=`penstock-scenario-badge${t.differences?.has(e)?` is-different`:``}`,a.textContent=numberLabel(o),a.title=Y(`app.runs.stepBadge`,{number:numberLabel(o),name:t.names?.get(e)??e}),i.add(e,Fu,{position:stepPosition(r),html:a})}catch{}}t.differences?.forEach((e,t)=>mark(t,zu)),t.selected&&mark(t.selected,Bu)}catch{}}var Wu=new Map;async function loadScenarioTargets(){try{let e=G(),t=await e.getProjectFiles().catch(()=>null);return!t||!Array.isArray(t.files)?{tables:new Map,forms:new Map,duplicates:[]}:await collectTargets(t.files,t=>e.readFileIfPresent(t).catch(()=>null),Wu)}catch{return{tables:new Map,forms:new Map,duplicates:[]}}}function setFlowCondition(e,t,n,r){try{let i=e?.get?.(`elementRegistry`)?.get?.(t);if(!i||!i.businessObject)return!1;let a=writeCondition(n,r);if(sameCondition(i.businessObject.conditionExpression?.body,a))return!1;let o=e.get?.(`moddle`),s=a&&o?o.create(`bpmn:FormalExpression`,{body:a}):void 0,c=e.get?.(`modeling`);return c?(c.updateProperties(i,{conditionExpression:s}),!0):!1}catch{return!1}}var Gu={tables:new Map,forms:new Map,duplicates:[]},Ku=120;function useScenarioReview({active:e,mode:t,runs:i,getModeler:a,feelByDefault:o}){let[c,u]=n(null),[d,p]=n(Gu),[m,h]=n(null),[g,_]=n({}),[v,y]=n([]),[b,x]=n([]),[S,C]=n(null),[w,T]=n(!1),[E,O]=n(!0),k=s(0),A=e?a():null;f(()=>{t===`generate`&&(_({}),y([]),x([])),C(null)},[t]),f(()=>{if(e){try{loadScenarioTargets().then(p,()=>p(Gu))}catch{p(Gu)}try{G().getLicense().then(e=>O(D(e)),()=>O(!1)).catch(()=>O(!1))}catch{O(!1)}}},[e]),f(()=>{if(!A)return;let e=0,t,read=()=>{let t=e+=1;try{let n=A.saveXML?.({format:!0});n&&typeof n.then==`function`&&n.then(async({xml:n})=>{try{let r=await On(n);if(t!==e)return;u(r),h(r?null:Y(`app.runs.unreadable`))}catch{t===e&&h(Y(`app.runs.unreadable`))}}).catch(()=>t===e&&h(Y(`app.runs.unreadable`)))}catch{t===e&&h(Y(`app.runs.unreadable`))}},later=()=>{clearTimeout(t),t=setTimeout(read,Ku)};read();try{A.on?.(`commandStack.changed`,later),A.on?.(`import.done`,later)}catch{}return()=>{e+=1,clearTimeout(t);try{A.off?.(`commandStack.changed`,later),A.off?.(`import.done`,later)}catch{}}},[A]);let j=l(()=>c?contextOf$2(c,d.tables):null,[c,d]),M=l(()=>j?reviewOf(j,{mode:t,existing:i.cases,edits:g,unticked:v,added:b}):{items:[],capped:!1},[j,t,i.cases,g,v,b]),N=M.items,P=N.find(e=>e.id===S)??N[0]??null,F=l(()=>j?reviewCoverage(j.definitions,N):null,[j,N]),I=l(()=>j?conditionVariables(j.index):[],[j]),L=l(()=>j?[...new Set([...I,...Un(j.definitions).uses.map(e=>e.name)])]:[],[j,I]),R=l(()=>j?Gr(j.definitions).map(e=>({id:e,starts:Yr(j.definitions,e)})):[],[j]),z=l(()=>j&&P?.planned&&i.trace&&i.last===P.name?comparePlan(j,P.planned.scenario,P.steps,i.trace):null,[j,P,i.trace,i.last]),B=r(e=>C(e),[]),V=r(e=>y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]),H=r((e,t)=>{_(n=>({...n,[e]:t(n[e]??{})}))},[]),U=r((e,t)=>{let n=t.trim();_(t=>({...t,[e]:{...t[e]??{},name:n===``?void 0:n}}))},[]),W=r(e=>{k.current+=1;let t=`${Date.now().toString(36)}${k.current}`;return x(n=>[...n,{...e,id:t}]),C(`added:${t}`),`added:${t}`},[]),ee=r(e=>{x(t=>t.filter(t=>`added:${t.id}`!==e)),C(null)},[]),K=j?conditionStyleOf(j.index,o?`feel`:`juel`):`feel`,te=r((e,t)=>j?conditionEditProblem(j.index,e,t,K):null,[j,K]),ne=r((e,t)=>!A||!j?null:conditionEditProblem(j.index,e,t,K)||(setFlowCondition(A,e,t,K),null),[A,j,K]),re=r(async()=>{let e=toWrite(N);if(e.length===0)return!1;T(!0);try{return await i.writeScenarios(e)}catch(e){let t=i.file?.split(/[\\/]/).pop()??Y(`app.runs.theScenarioFile`);try{G().notifyUser(Y(`app.runs.unableToWrite`,{name:t,error:ri(e)}),!0).catch?.(()=>{})}catch{}return!1}finally{T(!1)}},[N,i]),ie=l(()=>N.filter(e=>e.edited&&e.origin===`file`),[N]),ae=r(async()=>{if(ie.length!==0){T(!0);try{await i.replaceScenarios(ie.map(e=>e.testCase))&&_({})}catch(e){let t=i.file?.split(/[\\/]/).pop()??Y(`app.runs.theScenarioFile`);try{G().notifyUser(Y(`app.runs.unableToWrite`,{name:t,error:ri(e)}),!0).catch?.(()=>{})}catch{}}finally{T(!1)}}},[ie,i]),oe=r(()=>{P&&(P.origin===`file`&&!P.edited?i.run([P.name]):i.runCase(P.testCase))},[P,i]),se=r(()=>{_({}),y([]),x([]),C(null)},[]);return{mode:t,ready:!!j,problem:m,items:N,capped:M.capped,selected:P,coverage:F,actual:z,context:j,targets:d,suggestions:I,conditionNames:L,conditionStyle:K,processes:R,licensed:E,ticked:N.filter(e=>e.ticked).length,dirty:ie,select:B,toggle:V,edit:H,rename:U,add:W,remove:ee,conditionProblem:te,setCondition:ne,creating:w,create:re,save:ae,run:oe,reset:se}}var qu=a(null);function useScenarios(){let e=i(qu);if(!e)throw Error(`the scenarios tab needs its provider`);return e}function ScenariosProvider({file:e,runs:t,getModeler:i,feelByDefault:a,enabled:o,sidebar:c,onOpenWorker:d,onNavigate:p,onRunWithInput:m,onOpenRun:h,children:g}){let[_,v]=n({active:!1,view:`root`,mode:`file`}),[y,b]=n(null),[x,S]=n(!1),[C,w]=n(null),[T,E]=n(null),[D,O]=n(null),[k,A]=n(null),[j,M]=n(null),N=s(null),P=useScenarioReview({active:_.active||_.view!==`root`,mode:_.mode,runs:t,getModeler:i,feelByDefault:a}),F=_.active&&c.visible?i():null,I=P.selected,L=_.view!==`root`,R=r((e,t,n)=>{v(r=>r.active===e&&r.view===t&&r.mode===n?r:{active:e,view:t,mode:n})},[]);f(()=>{b(null),S(!1)},[I?.id]);let z=l(()=>I&&y?stepsFor(I.steps,y)[0]??-1:-1,[I,y]),B=l(()=>L?_.view===`add`&&j?scenarioPath(j.scenario):I&&!I.unplannable?I.path:null:null,[L,_.view,j,I]),V=l(()=>new Map((I?.steps??[]).map(e=>[e.elementId,e.name])),[I]);f(()=>{if(F)return showScenarioOverlay(F,{path:B,unreachedFlows:L?P.coverage?.unreachedFlows??[]:[],unreachedEnds:L?P.coverage?.unreachedEnds??[]:[],differences:P.actual?.byElement??null,selected:y,names:V}),()=>clearScenarioOverlay(F)},[F,B,L,P.coverage,P.actual,y,V]),f(()=>{let e=i();if(e)return markReviewOpen(e,!!F&&L),()=>markReviewOpen(e,!1)},[F,L]),f(()=>{if(!F||!L)return;let e,fit=()=>{clearTimeout(e),e=setTimeout(()=>refit(F,c.covered),100)};fit(),window.addEventListener(`resize`,fit);let t=F.get(`canvas`).getContainer(),n=new ResizeObserver(fit);return t&&n.observe(t),()=>{clearTimeout(e),n.disconnect(),window.removeEventListener(`resize`,fit)}},[F,L,c.covered,c.width,P.ready]),f(()=>{if(!F||!I)return;let onSelect=({newSelection:e})=>{let t=e[0];t&&L&&(stepsFor(I.steps,t.id).length===0?S(!0):(S(!1),b(t.id),requestAnimationFrame(()=>document.querySelector(`.penstock-review__step[data-element="${CSS.escape(t.id)}"]`)?.scrollIntoView({block:`nearest`}))))};return F.on(`selection.changed`,onSelect),()=>F.off(`selection.changed`,onSelect)},[F,I,L]);let H=r(e=>{b(e.elementId),S(!1);let t=i();t?.get(`elementRegistry`).get(e.elementId)&&(pin(t,e.elementId,c.covered),t.get(`selection`).select(t.get(`elementRegistry`).get(e.elementId)))},[i,c.covered]),U=r(e=>{let t=i();t&&(preview(t,e?.elementId??null,N.current,c.covered),N.current=e?.elementId??null)},[i,c.covered]);f(()=>()=>{let e=i();e&&N.current&&preview(e,null,N.current,0)},[i]);let W=r(e=>{if(!I)return;let t=I.steps[moveStep(z,I.steps.length,e)];t&&H(t)},[I,z,H]),G=l(()=>({file:e,runs:t,review:P,enabled:o,view:_.view,setPresence:R,focus:y,stepAt:z,pinStep:H,hoverStep:U,stepBy:W,offPath:x,ruleStep:C,showRule:w,formStep:T,showForm:E,timerStep:D,showTimer:O,mockWorkerStep:k,showMockWorker:A,preview:M,onOpenWorker:d,onNavigate:p,onRunWithInput:m,onOpenRun:h}),[e,t,P,o,_.view,R,y,z,H,U,W,x,C,T,D,k,d,p,m,h]);return u(qu.Provider,{value:G,children:g})}var Ju=160,Yu=280,Xu=60;function nameOf$7(e,t){try{return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}catch{return t}}e(nameOf$7,`nameOf`);function shown$4(e){try{let t=JSON.stringify(e)??String(e);return t.length>Xu?`${t.slice(0,59)}…`:t}catch{return String(e)}}e(shown$4,`shown`);function valueTitle(e,t){try{return`${JSON.stringify(e,null,2)}\n\n${Y(`app.runs.source.${t}`)}`}catch{return`${String(e)}\n\n${Y(`app.runs.source.${t}`)}`}}function Values({values:e,changed:t,plain:n}){return!Array.isArray(e)||e.length===0?u(`span`,{class:`penstock-runs__none`,children:`–`}):u(`ul`,{class:`penstock-runs__values`,children:e.map(e=>u(`li`,{title:valueTitle(e.value,e.source),children:[u(`span`,{class:`penstock-runs__name`,children:e.name}),t&&`before`in e&&u(`span`,{class:`penstock-runs__before`,children:[shown$4(e.before),` → `]}),u(`span`,{class:`penstock-runs__value`,children:shown$4(e.value)}),!n&&e.source!==`history`&&u(`span`,{class:`penstock-runs__tag`,children:e.source})]},e.name))})}function WaitingCard({wait:e,modeler:t,onAnswer:r,onStop:i}){let[a,s]=n(`{}`),[c,l]=n(``),[d,p]=n(null);f(()=>{s(`{}`),l(``),p(null)},[e]);let variables=()=>{try{let e=JSON.parse(a||`{}`);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`an object`);return p(null),e}catch{return p(Y(`app.runs.variablesAreAJsonObject`)),null}},answer=e=>{let t=variables();if(t){if(e===`error`){if(!c.trim()){p(Y(`app.runs.errorNeedsItsCode`));return}r({kind:e,errorCode:c.trim(),variables:t})}else r({kind:e,variables:t})}},m=nameOf$7(t,e.elementId),h=e.kind===`job`?Y(`app.runs.theJob`,{job:e.jobType}):e.kind===`userTask`?Y(`app.runs.theUserTask`):e.kind===`message`?Y(`app.runs.theMessage`,{message:e.name}):Y(`app.runs.theSignal`,{signal:e.name});return u(`div`,{class:`penstock-runs__waiting`,role:`group`,"aria-label":Y(`app.runs.theRunWaits`),children:[u(`div`,{class:`penstock-runs__waiting-title`,children:Y(`app.runs.waitingAtFor`,{where:m,what:h})}),e.kind===`job`&&Object.keys(e.variables).length>0&&u(`div`,{class:`penstock-runs__waiting-received`,children:[u(`span`,{class:`penstock-runs__label`,children:Y(`app.runs.received`)}),u(Values,{plain:!0,values:Object.entries(e.variables).map(([e,t])=>({name:e,value:t,source:`mock`}))})]}),u(`label`,{class:`penstock-runs__label`,for:`penstock-runs-variables`,children:Y(`app.runs.variablesToSend`)}),u(`textarea`,{id:`penstock-runs-variables`,class:`penstock-runs__json`,rows:2,value:a,onInput:e=>s(e.target.value)}),d&&u(`p`,{class:`error-message`,children:d}),u(`div`,{class:`penstock-runs__actions`,children:[e.kind===`message`?u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>answer(`correlate`),children:Y(`app.runs.correlate`)}):u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>answer(`complete`),children:Y(e.kind===`signal`?`app.runs.broadcast`:`app.runs.complete`)}),e.kind===`job`&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>answer(`error`),children:Y(`app.runs.throwError`)}),u(`input`,{class:`penstock-runs__code penstock-runs__code--inline`,placeholder:Y(`app.runs.withErrorCode`),value:c,onInput:e=>l(e.target.value),"aria-label":Y(`app.runs.errorCode`)})]}),u(`span`,{class:`penstock-runs__spacer`}),u(`button`,{type:`button`,class:`ui-button`,onClick:i,children:Y(`app.runs.stop`)})]})]})}function stateWord(e){return Y(`app.runs.state.${e.toLowerCase()}`)}function RunsPanel({isOpen:e,runs:t,getModeler:r,onClose:i,onRunWithInput:a,onOpenRun:c,onSaveAdHoc:l}){let d=useScenarios().view!==`root`,p=e?r():null,[m,h]=n(Yu),g=s(null),_=t.trace?t.trace.steps.map(e=>({elementId:e.elementId,state:e.state,mocked:e.mocked,startedAt:e.startedAt,endedAt:e.endedAt})):t.steps;if(f(()=>{if(p)return showPath(p,_,t.selected),()=>clearPath(p)},[p,t.trace,t.steps,t.selected]),f(()=>{(r()?.get(`canvas`))?.resized()},[e,m]),!e)return null;let beginResize=e=>{g.current={start:e.clientY,height:m};let move=e=>{if(!g.current)return;let t=Math.max(Ju,window.innerHeight-200);h(Math.min(t,Math.max(Ju,g.current.height+g.current.start-e.clientY)))},end=()=>{g.current=null,window.removeEventListener(`pointermove`,move),window.removeEventListener(`pointerup`,end)};window.addEventListener(`pointermove`,move),window.addEventListener(`pointerup`,end)},selectStep=e=>{t.select(e);try{let t=p?.get?.(`elementRegistry`)?.get?.(e);if(!t)return;p.get(`canvas`)?.scrollToElement?.(t,{top:140,right:440,bottom:400,left:140}),p.get(`selection`)?.select?.(t)}catch{}},onKey=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),selectStep(e))},v=t.file?.split(/[\\/]/).pop()??null,y=t.target?t.target.profile??t.target.url??Y(`app.live.theEngine`):null,b=t.trace?.steps??null,x=t.last&&!t.running?t.results.get(t.last)??null:null,S=t.adHoc&&!t.running&&t.adHoc.trace&&x?.outcome!==`skipped`;return u(`section`,{class:`penstock-runs`,style:{height:`${m}px`},"aria-label":Y(`app.runs.runOutput`),children:[u(`div`,{class:`penstock-runs__resize`,onPointerDown:beginResize,role:`separator`,"aria-orientation":`horizontal`,"aria-label":Y(`app.runs.resizeTheRunsPanel`)}),u(`header`,{class:`penstock-runs__bar`,children:[u(`span`,{class:`penstock-runs__title`,children:Y(`app.runs.runOutput`)}),u(`span`,{class:`penstock-runs__where`,children:[[v,y].filter(Boolean).join(` · `),d?`${v||y?` · `:``}${Y(`app.runs.aScenarioIsOpen`)}`:``]}),u(`span`,{class:`penstock-runs__controls`,children:[t.running?u(`button`,{type:`button`,class:`ui-button`,onClick:t.stop,children:Y(`app.runs.stop`)}):u(o,{children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>t.run(),disabled:t.cases.length===0||!t.target,children:Y(`app.runs.runAll`)}),a&&u(`button`,{type:`button`,class:`ui-button`,onClick:a,children:Y(`app.runs.runWithInputMore`)}),c&&u(`button`,{type:`button`,class:`ui-button`,onClick:c,children:Y(`app.runs.openRunMore`)}),S&&l&&u(`button`,{type:`button`,class:`ui-button`,onClick:l,children:Y(`app.runs.saveAsScenarioMore`)})]}),u(`button`,{type:`button`,class:`ui-button`,onClick:i,children:Y(`app.runs.close`)})]})]}),u(`div`,{class:`penstock-runs__body`,children:u(`div`,{class:`penstock-runs__detail`,children:[!t.target&&u(`p`,{class:`penstock-runs__note`,children:Y(`app.runs.runAllIsOff`,{reason:t.notice??Y(`app.runs.noEngineToRunOn`)})}),t.cases.length===0&&t.target&&u(`p`,{class:`penstock-runs__note`,children:Y(`app.runs.noScenariosToRunYet`)}),t.notice&&u(`p`,{class:`penstock-runs__note`,children:t.notice}),x&&u(`p`,{class:`penstock-runs__outcome penstock-runs__outcome--${x.outcome}`,children:[t.last,`: `,x.outcome,x.message?` - ${x.message}`:``]}),t.waiting&&u(WaitingCard,{wait:t.waiting,modeler:p,onAnswer:t.answer,onStop:t.stop}),t.running&&!b&&u(`ul`,{class:`penstock-runs__list`,children:t.steps.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`penstock-runs__row`,onClick:()=>selectStep(e.elementId),children:[u(`span`,{class:`penstock-runs__step`,children:nameOf$7(p,e.elementId)}),u(`span`,{class:`penstock-runs__state`,children:stateWord(e.state)}),e.mocked&&u(`span`,{class:`penstock-runs__tag penstock-runs__tag--mocked`,children:Y(`app.runs.mocked`)})]})},e.elementId))}),b&&u(`table`,{class:`penstock-runs__table`,children:[u(`thead`,{children:u(`tr`,{children:[u(`th`,{children:Y(`app.runs.step`)}),u(`th`,{children:Y(`app.runs.stateColumn`)}),u(`th`,{children:Y(`app.runs.in`)}),u(`th`,{children:Y(`app.runs.out`)}),u(`th`,{children:Y(`app.runs.changed`)})]})}),u(`tbody`,{children:b.map(e=>u(`tr`,{class:t.selected===e.elementId?`penstock-runs__selected`:void 0,tabIndex:0,"aria-selected":t.selected===e.elementId,onClick:()=>selectStep(e.elementId),onKeyDown:onKey(e.elementId),children:[u(`td`,{children:[u(`span`,{class:`penstock-runs__step`,children:nameOf$7(p,e.elementId)}),e.mocked&&u(`span`,{class:`penstock-runs__tag penstock-runs__tag--mocked`,title:Y(`app.runs.theScenarioAnsweredThisStep`),children:Y(`app.runs.mocked`)})]}),u(`td`,{class:`penstock-runs__state penstock-runs__state--${e.state.toLowerCase()}`,children:stateWord(e.state)}),u(`td`,{children:u(Values,{values:e.in})}),u(`td`,{children:u(Values,{values:e.out})}),u(`td`,{children:u(Values,{values:e.changed,changed:!0})})]},`${e.elementId}:${e.startedAt}`))})]}),t.log.length>0&&u(`div`,{class:`penstock-runs__log`,children:[u(`h3`,{class:`penstock-runs__heading`,children:Y(`app.runs.log`)}),t.log.map((e,t)=>u(`p`,{class:e.error?`penstock-runs__line penstock-runs__line--error`:`penstock-runs__line`,children:e.text},`${t}:${e.text}`))]}),t.kept&&u(`p`,{class:`penstock-runs__note`,children:Y(`app.runs.theTraceIsKeptIn`,{path:$n(t.kept)})})]})})]})}function indexOf$2(e,t,n){let r=0;return e.testCases.findIndex(e=>e?.name===t&&(r+=1,r===n))}e(indexOf$2,`indexOf`);function nameProblem(e,t,n){let r=n.trim();return r===``?Y(`app.testCases.edit.nameEmpty`):r!==t&&e.testCases.some(e=>e?.name===r)?Y(`app.testCases.edit.nameTaken`,{name:r}):null}function renameTestCase(e,t,n,r){let i=indexOf$2(e,t,n);if(i<0)return{problem:Y(`app.testCases.edit.notFound`,{name:t})};let a=r.trim(),o=nameProblem(e,t,a);return o?{problem:o}:a===t?{file:e}:{file:{...e,testCases:e.testCases.map((e,t)=>t===i?{...e,name:a}:e)}}}function copyNameOf(e,t){let n=new Set(e.testCases.map(e=>e?.name)),r=Y(`app.testCases.edit.copyName`,{name:t});for(let e=2;n.has(r);e+=1)r=Y(`app.testCases.edit.copyNumbered`,{name:t,number:e});return r}function duplicateTestCase(e,t,n){let r=indexOf$2(e,t,n);if(r<0)return{problem:Y(`app.testCases.edit.notFound`,{name:t})};let i=copyNameOf(e,t),a={...e.testCases[r],name:i},o=[...e.testCases.slice(0,r+1),a,...e.testCases.slice(r+1)];return{file:{...e,testCases:o},name:i}}function deleteTestCase(e,t,n){let r=indexOf$2(e,t,n);return r<0?{problem:Y(`app.testCases.edit.notFound`,{name:t})}:{file:{...e,testCases:e.testCases.filter((e,t)=>t!==r)}}}function useRuns(e,t,i,a=!0){let[o,c]=n(null),[l,u]=n([]),[d,p]=n([]),[m,h]=n(null),[g,_]=n(null),[v,y]=n(new Map),[b,x]=n(null),[S,C]=n(null),[w,T]=n(null),[E,D]=n([]),[O,k]=n([]),[A,j]=n(null),[M,N]=n(null),[P,F]=n(null),[I,L]=n(null),R=s(null),z=s({run:``,session:Gn()}),B=s(null),V=s(!1),H=s(i);H.current=i;let U=s(!0),W=s(null);f(()=>(U.current=!0,()=>{U.current=!1,R.current?.abort(),R.current=null}),[]);let ee=r(()=>{t&&H.current().then(e=>Qr(t,e)).then(({file:e,parsed:t})=>{U.current&&(c(e),u(t.file?.testCases??[]),p(t.problems))}).catch(e=>{U.current&&p([ri(e)])})},[t]),K=r(()=>{if(!t)return;ee();let showTargetNotice=e=>{W.current=e,_(e)};li(t).then(e=>{if(U.current){if(h(e),e){let e=W.current;W.current=null,e!==null&&_(t=>t===e?null:t)}else return $r(t).then(e=>{U.current&&showTargetNotice(e)})}}).catch(e=>{U.current&&showTargetNotice(ri(e))})},[t]);f(()=>{e&&a&&K()},[e,a,K]);let te=r(e=>{e.kind===`step`&&D(t=>{let n=t.filter(t=>t.elementId!==e.elementId);return n.push({elementId:e.elementId,state:e.state,mocked:e.mocked}),n}),e.kind===`log`&&k(t=>[...t,{at:new Date().toISOString(),text:e.text,...e.error?{error:!0}:{}}])},[]),ne=r(async(e,n,r,i)=>{let a=await H.current();if(!t||!a)return!1;let o=await ni(t,a),s=new AbortController;R.current=s,x(e.name),C(e.name),n||L(null),T(null),D([]),k([]),F(null),N(null),z.current.run!==r&&(z.current={run:r,session:Gn()});let{result:c,kept:l}=await dr(e,{engine:oi(i,t),resources:o,runId:r,builds:ii(i),key:ei(i),session:z.current.session,signal:s.signal,emit:te,note:e=>k(t=>[...t,{at:new Date().toISOString(),text:e}]),keep:ti,onWait:n?e=>new Promise(t=>{B.current=t,j(e)}):void 0});return U.current?(B.current=null,j(null),T(c.trace),y(t=>new Map(t).set(e.name,{outcome:c.outcome,...c.message?{message:c.message}:{}})),F(l),n&&L({testCase:e,recorded:c.recorded,trace:c.trace}),!s.signal.aborted):!1},[t,te]),re=r(async()=>{let e=await li(t);if(!U.current)return null;if(h(e),!e){let e=await $r(t);return U.current&&_(e),null}if(!await ai())return null;let n=await Xr(e);return U.current&&_(n),n?null:e},[t]),ie=r((e,t)=>{V.current||e.length===0||(V.current=!0,(async()=>{try{let n=await re();if(!n||!U.current)return;let r=Kn(new Date);for(let i of e)if(!U.current||!await ne(i,t,r,n))break}catch(e){U.current&&_(ri(e))}finally{U.current&&x(null),R.current=null,V.current=!1}})())},[re,ne]),ae=r(e=>{ie(e?l.filter(t=>e.includes(t.name)):l,e?.length===1)},[l,ie]),oe=r(e=>ie([e],!0),[ie]),se=r(()=>{R.current?.abort(),B.current?.({kind:`stop`})},[]);f(()=>(window.addEventListener(`pagehide`,se),()=>window.removeEventListener(`pagehide`,se)),[se]),f(()=>{e||se()},[e,se]);let ce=r(e=>{let t=B.current;B.current=null,j(null),t?.(e)},[]),q=r(async e=>{try{let n=await li(t);if(!U.current)return;if(h(n),!n){let e=await $r(t);U.current&&_(e);return}let r=G(),i=await qn(n.engine,e=>r.askEngine(n.profile,e,t??void 0),e,{runId:`existing`});if(!U.current)return;T(i),C(null),L(null),D([]),k(i.log),F(null),N(null),_(null)}catch(e){U.current&&_(ri(e))}},[t]),le=r(async e=>{try{let t=await G().readFile(e);if(!U.current)return;let n=JSON.parse(t);T(n),D([]),k(n.log),F(e),N(null),_(null)}catch(e){U.current&&_(ri(e))}},[]),ue=r(async e=>{if(!o)return!1;let t=G(),n=o.split(/[\\/]/).pop()??o,r=gi(await si(o),[e]);if(`problem`in r)throw Error(`${n}: ${r.problem}`);if(r.kept.length>0)throw Error(Y(`app.runs.nameTaken`,{name:n,scenario:e.name}));return await t.saveFile(o,yi(r.file)),ee(),!0},[o,ee]),de=r(async e=>{if(!o)return!1;try{let t=G(),n=gi(await si(o),e);if(`problem`in n)return U.current&&_(`${o.split(/[\\/]/).pop()}: ${n.problem}`),!1;n.added.length>0&&await t.saveFile(o,yi(n.file));let r=e.filter(e=>n.added.includes(e.name)&&e.description?.startsWith(Y(`app.runs.toFillIn`))).length;return U.current&&_([Y(`app.runs.notice.added`,{count:n.added.length}),r?Y(`app.runs.notice.toFillIn`,{count:r}):null,n.kept.length?Y(`app.runs.notice.kept`,{count:n.kept.length}):null].filter(Boolean).join(`, `)),ee(),!0}catch(e){return U.current&&_(ri(e)),!1}},[o,ee]),fe=r(async e=>{if(!o||e.length===0)return!1;try{if(!await ai())return!1;let t=G(),n=bi(await si(o)??``);if(!n.file)return U.current&&_(Y(`app.runs.notice.leftAsIs`,{file:o.split(/[\\/]/).pop()??o,problems:n.problems.join(`; `)})),!1;let r=n.file;for(let t of e)r=vi(r,t);return await t.saveFile(o,yi(r)),U.current&&_(Y(`app.runs.notice.saved`,{count:e.length})),ee(),!0}catch(e){return U.current&&_(ri(e)),!1}},[o,ee]),pe=r(async()=>ai(),[]),me=r(async e=>{if(!o||!await ai())return null;let t=o.split(/[\\/]/).pop()??o,n=bi(await si(o)??``);if(!n.file)return U.current&&_(Y(`app.runs.notice.leftAsIs`,{file:t,problems:n.problems.join(`; `)})),null;let r=e(n.file);return`problem`in r||r.file!==n.file&&(await G().saveFile(o,yi(r.file)),ee()),r},[o,ee]);return{file:o,cases:l,problems:d,target:m,notice:g,results:v,running:b,last:S,trace:w,steps:E,log:O,waiting:A,selected:M,kept:P,adHoc:I,writeScenarios:de,replaceScenarios:fe,renameScenario:r(async(e,t,n)=>{let r=await me(r=>renameTestCase(r,e,t,n));if(!r)return null;if(`problem`in r)return r;let i=n.trim();return U.current&&i!==e&&_(Y(`app.runs.notice.renamedTo`,{name:i})),{name:i}},[me]),duplicateScenario:r(async(e,t)=>{let n=await me(n=>duplicateTestCase(n,e,t));return n?`problem`in n?n:(U.current&&_(Y(`app.runs.notice.duplicated`,{name:n.name})),{name:n.name}):null},[me]),deleteScenario:r(async(e,t)=>{let n=await me(n=>deleteTestCase(n,e,t));return n?`problem`in n?n:(U.current&&_(Y(`app.runs.notice.deleted`,{name:e})),{name:e}):null},[me]),run:ae,runCase:e=>ie([e],!0),runAdHoc:oe,stop:se,answer:ce,openInstance:q,openTrace:le,select:N,save:ue,generate:pe,reload:K}}function runDialogSize(e){return Number.isFinite(e)&&e>0?`medium`:`small`}function objectOf$2(e){if(typeof e!=`string`)return null;try{let t=JSON.parse(e.trim()||`{}`);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}catch{return null}}e(objectOf$2,`objectOf`);function runInputErrors(e){let t={};if(!e||typeof e!=`object`)return t.process=Y(`app.runs.theDiagramHasNoExecutable`),t;objectOf$2(e.start)||(t.start=Y(`app.runs.theStartVariablesShouldBe`));let n=Array.isArray(e.waiting)?e.waiting:[],r=e.rows&&typeof e.rows==`object`?e.rows:{};for(let e of n){if(!e||typeof e!=`object`||!e.id)continue;let n=r[e.id];n&&((n.kind===`complete`||n.kind===`error`||n.kind===`fail`)&&!objectOf$2(n.variables)?t[`step:${e.id}`]=Y(`app.runs.theVariablesSendsShouldBe`,{name:e.name}):n.kind===`error`&&!(typeof n.errorCode==`string`&&n.errorCode.trim())?t[`step:${e.id}`]=Y(`app.runs.enterTheErrorCodeShould`,{name:e.name}):n.kind===`fail`&&(!Number.isInteger(Number(n.times))||Number(n.times)<1)&&(t[`step:${e.id}`]=Y(`app.runs.shouldFailAWholeNumberOfTimes`,{name:e.name})))}return e.processId||(t.process=Y(`app.runs.theDiagramHasNoExecutable`)),t}var Zu=[`ask`,`complete`,`error`,`fail`,`real`],Qu=[`fire`,`real`];function startVariables(e){let t={};for(let n of e){let e=n.split(`.`),r=t;e.slice(0,-1).forEach(e=>{(typeof r[e]!=`object`||r[e]===null)&&(r[e]={}),r=r[e]}),e[e.length-1]in r||(r[e[e.length-1]]=null)}return t}function time(){return new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function RunDialog({diagramPath:e,xml:t,onClose:r,onRun:i}){let[a,o]=n([]),[s,c]=n(``),[l,d]=n(new Map),[p,m]=n([]),[h,g]=n({}),[_,v]=n(`{}`),y=fn();f(()=>{let n=!1;return(async()=>{let r=await t();if(!r||n)return;let i=await On(r),a=Fi(i),s=await Q(e,r),l=s.processes.filter(e=>e.executable).map(e=>e.id),u=[...new Set(s.variables.filter(e=>!e.writes).map(e=>e.name))].sort();if(n)return;d(a),o(l),c(l[0]??``);let f=waitingSteps(a);m(f),g(Object.fromEntries(f.map(e=>[e.id,{kind:e.kind===`timer`?`fire`:`ask`,variables:`{}`,errorCode:``,times:`1`}]))),v(JSON.stringify(startVariables(u),null,2))})(),()=>{n=!0}},[e,t]);let change=(e,t)=>g(n=>({...n,[e]:{...n[e],...t}})),b=runInputErrors({processId:s,start:_,rows:h,waiting:p}),submit=()=>{if(y.submit(),Object.keys(b).length>0){requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());return}let e=objectOf$2(_),t=new Map;for(let e of p){let n=h[e.id];if(!n)continue;let r=objectOf$2(n.variables),i=Number(n.times);n.kind===`complete`?t.set(e.id,{kind:`complete`,variables:r}):n.kind===`error`?t.set(e.id,{kind:`error`,errorCode:n.errorCode.trim(),variables:r}):n.kind===`fail`?t.set(e.id,{kind:`fail`,times:i,variables:r}):t.set(e.id,{kind:n.kind})}i(adHocTestCase(s,e,t,l,Y(`app.runs.adHocRun`,{time:time()})))},x=p.map(e=>b[`step:${e.id}`]).filter(e=>!!e);return u(dn,{title:Y(`app.runs.runWithInput`),size:runDialogSize(p.length),onClose:r,footer:u(ln,{actions:[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:r},{id:`run`,label:Y(`app.runs.run`),role:`primary`,onClick:submit}]}),children:[a.length>1&&u(X,{label:Y(`app.runs.process`),children:e=>u(`select`,{...e,value:s,onChange:e=>c(e.target.value),children:a.map(e=>u(`option`,{value:e,children:e},e))})}),y.submitted&&b.process&&u(cn,{children:b.process}),u(X,{label:Y(`app.runs.startVariables`),error:y.errorOf(`start`,b.start??null),children:e=>u(`textarea`,{...e,rows:6,value:_,onInput:e=>v(e.target.value),onBlur:()=>y.touch(`start`)})}),p.length>0&&u(X,{label:Y(`app.runs.steps`),group:`group`,hint:Y(`app.runs.userTasksAndMessagesAsk`),children:e=>u(`div`,{...e,class:`penstock-run-dialog__steps`,children:[p.map(e=>{let t=h[e.id];if(!t)return null;let n=e.kind===`timer`?Qu:Zu,r=e.kind===`timer`?`timer`:`job`,i=t.kind===`complete`||t.kind===`error`||t.kind===`fail`,a=y.submitted&&!!b[`step:${e.id}`];return u(`div`,{class:`penstock-run-dialog__step`,children:[u(`span`,{class:`penstock-run-dialog__name`,title:e.jobType??e.id,children:e.name}),u(`select`,{class:`ui-input`,value:t.kind,"aria-label":Y(`app.runs.whatDoes`,{name:e.name}),onChange:t=>change(e.id,{kind:t.target.value}),children:n.map(e=>u(`option`,{value:e,children:Y(`app.runs.choice.${r}.${e}`)},e))}),t.kind===`error`&&u(`input`,{class:`ui-input`,placeholder:Y(`app.runs.errorCode`),"aria-label":Y(`app.runs.errorCode`),"aria-invalid":a||void 0,value:t.errorCode,onInput:t=>change(e.id,{errorCode:t.target.value})}),t.kind===`fail`&&u(`input`,{class:`ui-input penstock-run-dialog__times`,type:`number`,min:1,value:t.times,"aria-invalid":a||void 0,onInput:t=>change(e.id,{times:t.target.value}),"aria-label":Y(`app.runs.timesToFail`)}),i&&u(`input`,{class:`ui-input`,placeholder:Mi(`{"approved": true}`),value:t.variables,"aria-invalid":a||void 0,onInput:t=>change(e.id,{variables:t.target.value}),"aria-label":Y(`app.runs.variablesSends`,{name:e.name})})]},e.id)}),y.submitted&&x.map(e=>u(cn,{children:e},e))]})})]})}function shown$3(e){let t=JSON.stringify(e)??String(e);return t.length>40?`${t.slice(0,39)}…`:t}e(shown$3,`shown`);function SaveRunDialog({run:e,file:t,onClose:r,onSave:i}){let a=e.trace?writtenVariables(e.trace):[],[o,s]=n(e.testCase.name),[c,l]=n(new Set(a.map(e=>e.name))),[d,f]=n(!1),[p,m]=n(null),h=fn(),toggle=e=>l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),g=o.trim()?null:Y(`app.runs.enterANameForThe`),save=async()=>{if(h.submit(),g)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{f(!0),m(null);try{let t=a.map(e=>e.name).filter(e=>c.has(e));await i(recordedTestCase(e,o.trim(),t,new Date))?r():m(Y(`app.runs.unableToSaveTheScenario`))}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}};return u(dn,{title:Y(`app.runs.saveAsScenario`),size:`medium`,onClose:r,onSubmit:()=>void save(),footer:u(ln,{actions:[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:r,disabled:d},{id:`save`,label:Y(`app.common.save`),role:`primary`,onClick:()=>void save(),busy:d}]}),children:[u(X,{label:Y(`app.runs.name`),hint:t?Y(`app.runs.theScenarioStartsTheProcessInto`,{file:t.split(/[\\/]/).pop()}):Y(`app.runs.theScenarioStartsTheProcess`),error:h.errorOf(`name`,g),children:e=>u(`input`,{...e,value:o,onInput:e=>s(e.target.value),onBlur:()=>h.touch(`name`)})}),a.length>0&&u(X,{label:Y(`app.runs.checkAtTheEnd`),group:`group`,children:e=>u(`div`,{...e,class:`ui-choice-group`,children:a.map(e=>u(`label`,{class:`ui-choice`,children:[u(`input`,{type:`checkbox`,checked:c.has(e.name),onChange:()=>toggle(e.name)}),u(`span`,{children:[e.name,` = `,shown$3(e.value)]})]},e.name))})}),p&&u(cn,{children:p})]})}function OpenRunDialog({onClose:e,onOpen:t}){let[r,i]=n(``),[a,o]=n(!1),[s,c]=n(null),[l,d]=n(!1),f=r.trim()?null:Y(`app.runs.enterTheKeyOrId`),p=Pi({fields:1,missingRequired:+!!f}),open=async()=>{if(d(!0),c(null),f)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{o(!0);try{await t(r.trim()),e()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}};return u(dn,{title:Y(`app.runs.openRun`),size:`small`,backdrop:`close`,onClose:e,onSubmit:()=>void open(),footer:u(ln,{actions:[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:e,disabled:a},{id:`open`,label:Y(`app.common.open`),role:`primary`,onClick:()=>void open(),busy:a,disabled:p}]}),children:u(X,{label:Y(`app.runs.processInstance`),hint:Y(`app.runs.theKeyOfACamunda`),error:s??(l?f:null),children:e=>u(`input`,{...e,value:r,placeholder:Mi(`2251799813685249`),onInput:e=>i(e.target.value)})})})}function caseTitle(e,t){return t&&t!==e?`${e}\n${t}`:e}var draftOf=e=>e.map(e=>({name:e.name,text:Ir(e.value)}));function ValueRows({slot:e,suggestions:t=[],readOnly:r=!1,onUnlock:i,onChange:a}){let[o,c]=n(()=>draftOf(e.rows)),l=s(null),d=JSON.stringify(e.rows);f(()=>{let t=d===l.current;l.current=null,t||c(draftOf(e.rows))},[d]);let commit=e=>{c(e);let t=e.filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:kr(e.text)}));l.current=JSON.stringify(t),a(t)},change=(e,t)=>c(n=>n.map((n,r)=>r===e?{...n,...t}:n)),p=t.filter(e=>!o.some(t=>t.name===e)),m=`penstock-suggest-${e.role}-${e.elementId}`;return u(`div`,{class:`penstock-review__values`,children:[u(`span`,{class:`penstock-review__label`,children:e.title}),o.length===0&&u(`p`,{class:`penstock-review__hint`,children:e.empty}),o.map((e,t)=>u(`div`,{class:`penstock-review__row`,children:[u(`input`,{class:`penstock-review__input penstock-review__input--name`,"aria-label":Y(`app.runs.variableName`),list:m,value:e.name,readOnly:r,onInput:e=>change(t,{name:e.target.value}),onBlur:()=>commit(o),onKeyDown:e=>e.key===`Enter`&&commit(o)}),u(`input`,{class:`penstock-review__input penstock-review__input--value`,"aria-label":Y(`app.runs.valueOf`,{name:e.name||Y(`app.runs.theVariable`)}),value:e.text,readOnly:r,onInput:e=>change(t,{text:e.target.value}),onBlur:()=>commit(o),onKeyDown:e=>e.key===`Enter`&&commit(o)}),u(`button`,{type:`button`,class:`penstock-review__icon`,disabled:r,"aria-label":Y(`app.runs.removeVariable`,{name:e.name||Y(`app.runs.theVariable`)}),title:Y(`app.common.remove`),onClick:()=>commit(o.filter((e,n)=>n!==t)),children:u(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:u(`path`,{d:`M4 4l8 8M12 4l-8 8`,fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})})]},t)),r&&u(`div`,{class:`penstock-review__actions`,children:[u(`span`,{class:`penstock-review__hint`,children:Y(`app.runs.readOnlyEditingIsPro`)}),i&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:i,children:Y(`app.runs.buyOrSignIn`)})]}),u(`div`,{class:`penstock-review__adders`,hidden:r,children:[u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>c(e=>[...e,{name:``,text:``}]),children:Y(`app.runs.addAValue`)}),p.slice(0,4).map(e=>u(`button`,{type:`button`,class:`penstock-review__link`,title:Y(`app.runs.addWhichAGatewayCondition`,{name:e}),onClick:()=>c(t=>[...t,{name:e,text:``}]),children:[`+ `,e]},e))]}),u(`datalist`,{id:m,children:t.map(e=>u(`option`,{value:e},e))})]})}function AddScenarioForm({context:e,suggestions:t,processes:r,onPreview:i,onAdd:a,onCancel:o}){let[s,c]=n(``),[d,p]=n([]),[m,h]=n(r.length===1?r[0].id:void 0),[g,_]=n(void 0),v=l(()=>valuesOfRows(d),[d]),y=r.find(e=>e.id===m)?.starts??[],b=l(()=>resolveValues(e,s,v,{process:m,startId:g}),[e,s,v,m,g]),x=`planned`in b?b.planned:null;f(()=>(i(x),()=>i(null)),[x]);let S={role:`start`,elementId:`add`,title:Y(`app.runs.startVariables`),rows:d,empty:t.length>0?Y(`app.runs.chooseTheValuesThatTake`,{names:t.join(`, `)}):Y(`app.runs.addTheVariablesTheScenario`)};return u(`section`,{class:`penstock-review__add`,"aria-label":Y(`app.runs.addAScenarioWithChosen`),children:[u(X,{label:Y(`app.runs.name`),optional:!0,layout:`top`,hint:Y(`app.runs.leaveItEmptyToName`),children:e=>u(`input`,{...e,value:s,onInput:e=>c(e.target.value)})}),r.length>1&&u(X,{label:Y(`app.runs.process`),layout:`top`,children:e=>u(`select`,{...e,value:m??``,onChange:e=>{h(e.target.value||void 0),_(void 0)},children:[u(`option`,{value:``,children:Y(`app.runs.chooseAProcess`)}),r.map(e=>u(`option`,{value:e.id,children:e.id},e.id))]})}),y.length>1&&u(X,{label:Y(`app.runs.startsAt`),layout:`top`,children:e=>u(`select`,{...e,value:g??``,onChange:e=>_(e.target.value||void 0),children:[u(`option`,{value:``,children:Y(`app.runs.thePlainStartEvent`)}),y.map(e=>u(`option`,{value:e.id,children:[e.name||e.id,e.plain?``:Y(`app.runs.startedByAnEvent`)]},e.id))]})}),u(ValueRows,{slot:S,suggestions:t,onChange:p}),u(`p`,{class:`penstock-review__text`,children:x?Y(`app.runs.theseValuesTake`,{scenario:_r(x.scenario)}):`problem`in b?b.problem:``}),x&&x.notes.map(e=>u(`p`,{class:`penstock-review__issue is-stuck`,children:e},e)),u(`div`,{class:`penstock-review__actions`,children:u(pn,{actions:[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:o},{id:`add`,label:Y(`app.runs.addScenario`),role:`primary`,onClick:()=>a({name:s,values:v,process:m,startId:g}),disabled:!x}]})})]})}var $u=300;function toVariables(e){return e.map(e=>({name:e}))}function singleLine(){return rn.transactionFilter.of(e=>{if(!e.docChanged)return e;let t=e.newDoc.sliceString(0);return t.includes(`
|
|
12
|
+
`)?[{changes:{from:0,to:e.startState.doc.length,insert:t.replace(/\n/g,` `)},userEvent:e.annotation(nn.userEvent)}]:e})}function FeelEditor({id:e,label:t,value:n,onChange:r,onBlur:i,onSubmit:a,variables:o=[],placeholder:c=``,readOnly:l=!1,autoFocus:d=!1,error:p=null,class:m}){let h=s(null),g=s(null),_=s(n),v=s(n),y=s(null),b=s({onChange:r,onBlur:i,onSubmit:a,variables:o,placeholder:c});b.current={onChange:r,onBlur:i,onSubmit:a,variables:o,placeholder:c};let x=`${e}-error`,flush=()=>{y.current!==null&&(clearTimeout(y.current),y.current=null),_.current!==v.current&&(v.current=_.current,b.current.onChange(_.current))};f(()=>{let n=h.current;if(!n)return;let r=new zi({container:n,value:_.current,readOnly:l,placeholder:b.current.placeholder,variables:toVariables(b.current.variables),contentAttributes:{id:e,"aria-label":t},extensions:[Ii(),singleLine(),an.high(en.of([{key:`Enter`,run:e=>(Xt(e.state)===`active`||(flush(),b.current.onSubmit?.(_.current)),!0)}])),Qt.domEventHandlers({blur:()=>(flush(),b.current.onBlur?.(_.current),!1)})],onChange:e=>{_.current=e,y.current!==null&&clearTimeout(y.current),y.current=setTimeout(flush,$u)}});return g.current=r,d&&r.focus(),()=>{flush();let e=n.querySelector(`.cm-editor`);e&&Qt.findFromDOM(e)?.destroy(),g.current=null}},[l]),f(()=>{v.current=n,n!==_.current&&(y.current!==null&&(clearTimeout(y.current),y.current=null),_.current=n,g.current?.setValue(n))},[n]);let S=o.join(`
|
|
13
|
+
`);return f(()=>{g.current?.setVariables(toVariables(b.current.variables))},[S]),f(()=>{g.current?.setPlaceholder(c)},[c]),f(()=>{let e=h.current?.querySelector(`.cm-content`);e&&(p?(e.setAttribute(`aria-describedby`,x),e.setAttribute(`aria-invalid`,`true`)):(e.removeAttribute(`aria-describedby`),e.removeAttribute(`aria-invalid`)))},[p,l]),u(`div`,{class:`feel-editor${l?` is-readonly`:``}${p?` has-error`:``}${m?` ${m}`:``}`,children:[u(`div`,{ref:h,class:`feel-editor__box type-input`}),p&&u(cn,{id:x,children:p})]})}function liveHint(e,t,n){if(e.isDefault)return e.hint;let r=evaluateCondition(t,n);if(t.trim()===``)return Y(`app.runs.noConditionAlwaysTaken`);if(!r.readable)return Y(`app.runs.penstockCannotCheckThisExpression`);let i=r.used.map(e=>`${e.name} = ${Vr(e.value)}`).join(`, `);return r.result===null?Y(`app.runs.chooseVariablesSoThat`,{text:r.text}):Y(`app.runs.trueOrFalseForTheValues`,{result:r.result?Y(`app.runs.true`):Y(`app.runs.false`),used:i?` (${i})`:``})}function shownText(e,t){return e===`feel`?t.replace(/^\s*=\s*/,``):t}function unreadable$1(e,t,n){return!e.isDefault&&t.trim()!==``&&!evaluateCondition(t,n).readable}e(unreadable$1,`unreadable`);function ConditionEditor({branches:e,scope:t,style:r,variables:i,onCommit:a,problem:o}){let[s,c]=n({}),[l,d]=n({}),p=JSON.stringify(e.map(e=>[e.flowId,e.condition]));f(()=>{c({}),d({})},[p]);let commit=(e,t)=>{let n=a(e,t);d(t=>({...t,[e]:n??``}))},m=[...new Set([...Object.keys(t),...i])];return u(`div`,{class:`penstock-review__conditions`,children:[u(`span`,{class:`penstock-review__label`,children:Y(`app.runs.conditionsOnTheWayOut`)}),e.map(e=>{let n=s[e.flowId]??shownText(r,e.condition),i=l[e.flowId]||o(e.flowId,n),a=r===`feel`&&unreadable$1(e,n,t);return u(`div`,{class:`penstock-review__branch`,children:[u(`span`,{class:`penstock-review__dot${e.planned?` is-planned`:``}`,title:e.planned?Y(`app.runs.theWayThisScenarioTakes`):Y(`app.runs.notTakenByThisScenario`)}),u(`span`,{class:`penstock-review__branch-name`,title:e.name,children:e.name}),r===`feel`?u(FeelEditor,{id:`penstock-review-condition-${e.flowId}`,class:`penstock-review__condition`,label:Y(`app.runs.conditionOf`,{name:e.name}),placeholder:e.isDefault?Y(`app.runs.defaultFlowNoCondition`):Mi(`amount > 100`),value:n,variables:m,readOnly:e.isDefault,error:i||(a?Y(`app.runs.penstockCannotCheckThisExpression`):null),onChange:t=>c(n=>({...n,[e.flowId]:t})),onBlur:t=>t!==shownText(r,e.condition)&&commit(e.flowId,t),onSubmit:t=>commit(e.flowId,t)}):u(`input`,{class:`penstock-review__input penstock-review__input--condition`,"aria-label":Y(`app.runs.conditionOf`,{name:e.name}),placeholder:e.isDefault?Y(`app.runs.defaultFlowNoCondition`):Mi(`amount > 100`),value:n,disabled:e.isDefault,onInput:t=>c(n=>({...n,[e.flowId]:t.target.value})),onBlur:()=>s[e.flowId]!==void 0&&commit(e.flowId,n),onKeyDown:t=>t.key===`Enter`&&commit(e.flowId,n)}),!(r===`feel`&&a)&&u(`span`,{class:`penstock-review__hint penstock-review__branch-hint`,children:liveHint(e,n,t)}),r!==`feel`&&i&&u(`span`,{class:`penstock-review__issue is-mismatch penstock-review__branch-hint`,children:i})]},e.flowId)}),u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.aChangeIsMadeInThe`)})]})}function moveFocus(e,t,n){let r=e.currentTarget;if(e.target!==r)return;if(e.key===`Enter`||e.key===` `){e.preventDefault(),t.pin(n);return}let i=e.key===`ArrowDown`?r.nextElementSibling:e.key===`ArrowUp`?r.previousElementSibling:null;i instanceof HTMLElement&&(e.preventDefault(),i.focus(),i.click())}function ReviewStep({step:e,selected:t,differences:r,suggestions:i,conditionNames:a,conditionStyle:o,readOnly:s,onUnlock:c,actions:l}){let[d,f]=n(!1),p=e.issues.some(e=>e.kind===`mismatch`)||r.some(e=>e.kind===`branch`),m=e.branches&&(d||p);return u(`li`,{class:`penstock-review__step${t?` is-selected`:``}${r.length>0?` is-different`:``}`,"data-element":e.elementId,tabIndex:0,"aria-current":t?`step`:void 0,style:{marginLeft:`${e.depth*12}px`},onClick:()=>l.pin(e),onMouseEnter:()=>l.hover(e),onMouseLeave:()=>l.hover(null),onFocus:()=>l.hover(e),onBlur:()=>l.hover(null),onKeyDown:t=>moveFocus(t,l,e),children:[u(`div`,{class:`penstock-review__step-head`,children:[u(`span`,{class:`penstock-review__number`,children:e.number}),u(`span`,{class:`penstock-review__step-name`,title:e.name,children:e.name}),u(`span`,{class:`penstock-review__kind`,children:Y(`app.runs.kind.${e.kind}`)})]}),u(`p`,{class:`penstock-review__text`,children:e.text}),e.issues.map(e=>u(`p`,{class:`penstock-review__issue is-${e.kind}`,children:e.text},e.text)),r.map(e=>u(`p`,{class:`penstock-review__difference`,children:e.text},`${e.kind}:${e.text}`)),u(`div`,{onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[e.values&&u(ValueRows,{slot:e.values,suggestions:e.values.role===`start`?i:[],readOnly:s,onUnlock:c,onChange:t=>l.changeRows(e,t)}),e.branches&&m&&u(ConditionEditor,{branches:e.branches,scope:e.scope,style:o,variables:a,onCommit:l.setCondition,problem:l.conditionProblem}),u(`div`,{class:`penstock-review__actions`,children:[e.branches&&!p&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>f(e=>!e),children:Y(d?`app.runs.hideTheConditions`:`app.runs.fixTheConditions`)}),e.links.worker&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>l.openWorker(e),children:Y(`app.runs.goToTheWorker`)}),e.links.decision&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`rule`,onClick:()=>l.openRule(e),children:Y(`app.runs.showTheDecisionRule`)}),e.links.decision&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>l.openDecision(e),children:Y(`app.runs.openTheDecision`)}),e.links.form&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`form`,onClick:()=>l.openForm(e),children:Y(`app.runs.fillTheForm`)}),e.links.form&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>l.revealForm?l.revealForm(e):l.openForm(e),children:Y(`app.runs.goToTheForm`)}),e.kind===`timer`&&l.openTimer&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`timer`,onClick:()=>l.openTimer(e),children:Y(`app.runs.answerTimer`)}),e.kind===`worker`&&l.openMockWorker&&u(`button`,{type:`button`,class:`penstock-review__link`,"data-opens":`mock-worker`,onClick:()=>l.openMockWorker(e),children:Y(`app.runs.mockWorker`)})]})]})]})}function RuleView({step:e,review:t,onOpen:n}){let r=e.links.decision,i=r?t.targets.tables.get(r.id):void 0;if(!i)return u(`p`,{class:`penstock-review__hint penstock-review__pad`,children:Y(`app.runs.decisionTableNotInProject`,{id:r?.id??``})});let a=Ar(i,e.scope);return u(`div`,{class:`penstock-review__rule`,children:[u(`p`,{class:`penstock-review__text`,children:a.why}),a.problems.map(e=>u(`p`,{class:`penstock-review__issue is-mismatch`,children:e},e)),u(`div`,{class:`penstock-review__table-wrap`,children:u(`table`,{class:`penstock-review__table`,children:[u(`thead`,{children:u(`tr`,{children:[u(`th`,{scope:`col`,children:`#`}),i.inputs.map(e=>u(`th`,{scope:`col`,children:e.label},e.expression)),i.outputs.map(e=>u(`th`,{scope:`col`,children:e.name},e.name))]})}),u(`tbody`,{children:i.rules.map((e,t)=>u(`tr`,{class:a.rules.includes(t+1)?`is-match`:void 0,"aria-current":a.rules.includes(t+1)?`true`:void 0,children:[u(`td`,{children:t+1}),e.inputs.map((e,t)=>u(`td`,{children:e||`-`},t)),e.outputs.map((e,t)=>u(`td`,{children:e},t))]},e.id))})]})}),u(`div`,{class:`penstock-review__actions`,children:u(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>n(e),children:Y(`app.runs.openTheDecisionIn`,{file:i.file?i.file.split(/[\\/]/).pop()??``:Y(`app.runs.itsFile`)})})})]})}function LazyFormStepView(e){let[t,r]=n(null);return f(()=>{let e=!1;return Vi(()=>import(`./FormStepView-CbHb32_8.js`).then(t=>{e||r(()=>t.FormStepView)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url).catch(e=>console.error(`The form view did not load:`,e)),()=>{e=!0}},[]),t?u(t,{...e}):null}function TimerStepView({step:e,review:t,onFire:r,onRemove:i,onComplete:a}){let o=t.selected?.testCase,s=t.context?.index.steps.get(e.elementId)??{id:e.elementId,type:e.kind,event:e.kind===`timer`?`timer`:void 0,timer:e.timer},c=(o&&s?timerDuration(o,s):void 0)??s.timer??`PT1S`,l=o&&s?firesTimer(o,s):!1,[d,f]=n(c),p=isDuration(d)?null:Y(`app.runs.timerDurationProblem`);return u(`div`,{class:`penstock-review__form-wrap`,children:[u(`div`,{class:`penstock-review__body penstock-review__pad`,children:[u(`label`,{class:`ui-label`,htmlFor:`timer-duration-input`,children:Y(`app.runs.advanceTimeBy`)}),u(`input`,{id:`timer-duration-input`,type:`text`,class:`ui-input`,value:d,"aria-invalid":p?`true`:void 0,onInput:e=>f(e.target.value)}),p&&u(`span`,{class:`penstock-review__issue is-mismatch`,children:p}),l&&u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.timerFired`)})]}),u(`div`,{class:`penstock-review__footer penstock-review__pad`,children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:p!==null,onClick:()=>{r?.(d.trim()),a?.()},children:Y(`app.runs.fireTimer`)}),l&&i&&u(`button`,{type:`button`,class:`ui-button ui-button--secondary`,onClick:i,children:Y(`app.runs.removeTimerAnswer`)})]})]})}function MockWorkerStepView({step:e,review:t,runs:r,onMock:i,onRemove:a,onComplete:o}){let s=t.selected?.testCase,c=t.context?.index.steps.get(e.elementId)??{id:e.elementId,type:e.kind,job:e.links.worker},l=s&&c?workerMockOf(s,c):void 0,[d,f]=n(l?.kind??`complete`),[p,m]=n(JSON.stringify(l?.variables??{},null,2)),[h,g]=n(l?.errorCode??``),[_,v]=n(l?.errorMessage??``),[y,b]=n(null),x=r.waiting&&r.waiting.kind===`job`&&r.waiting.elementId===e.elementId,handleSave=()=>{b(null);let e;if(d===`complete`||d===`error`&&p.trim())try{let t=JSON.parse(p);if(typeof t!=`object`||!t||Array.isArray(t)){b(Y(`app.runs.invalidJson`));return}e=t}catch{b(Y(`app.runs.invalidJson`));return}if(d===`complete`)i?.({kind:`complete`,variables:e}),x&&o?.(e??{});else if(d===`error`){let t={kind:`error`,errorCode:h.trim()||`error`,errorMessage:_.trim()||void 0,variables:e};i?.(t)}else{let e={kind:`fail`,errorMessage:_.trim()||void 0};i?.(e)}};return u(`div`,{class:`penstock-review__form-wrap`,children:[u(`div`,{class:`penstock-review__body penstock-review__pad`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-outcome-select`,children:Y(`app.runs.workerOutcome`)}),u(`select`,{id:`mock-worker-outcome-select`,class:`ui-select`,value:d,onChange:e=>f(e.target.value),children:[u(`option`,{value:`complete`,children:Y(`app.runs.completeJob`)}),u(`option`,{value:`error`,children:Y(`app.runs.throwBpmnError`)}),u(`option`,{value:`fail`,children:Y(`app.runs.failJob`)})]}),d===`complete`&&u(`div`,{class:`penstock-review__field-group`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-variables-input`,children:Y(`app.runs.workerVariables`)}),u(`textarea`,{id:`mock-worker-variables-input`,class:`ui-textarea`,rows:4,value:p,onInput:e=>m(e.target.value)})]}),d===`error`&&u(`div`,{class:`penstock-review__field-group`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-error-code-input`,children:Y(`app.runs.errorCode`)}),u(`input`,{id:`mock-worker-error-code-input`,type:`text`,class:`ui-input`,value:h,onInput:e=>g(e.target.value)}),u(`label`,{class:`ui-label`,htmlFor:`mock-worker-error-message-input`,children:Y(`app.runs.errorMessage`)}),u(`input`,{id:`mock-worker-error-message-input`,type:`text`,class:`ui-input`,value:_,onInput:e=>v(e.target.value)})]}),d===`fail`&&u(`div`,{class:`penstock-review__field-group`,children:[u(`label`,{class:`ui-label`,htmlFor:`mock-worker-fail-message-input`,children:Y(`app.runs.errorMessage`)}),u(`input`,{id:`mock-worker-fail-message-input`,type:`text`,class:`ui-input`,value:_,onInput:e=>v(e.target.value)})]}),y&&u(`p`,{class:`penstock-review__issue is-mismatch`,children:y})]}),u(`div`,{class:`penstock-review__footer penstock-review__pad`,children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:handleSave,children:Y(`app.runs.saveMock`)}),l&&a&&u(`button`,{type:`button`,class:`ui-button ui-button--secondary`,onClick:a,children:Y(`app.runs.removeMock`)})]})]})}function occurrenceOf(e){let t=/#(\d+)$/.exec(e);return t?Number(t[1]):1}function topOf(e){let t=e[e.length-1]?.key;return t===`generate`||t===`scenario`||t===`add`||t===`rule`||t===`form`||t===`timer`||t===`mock-worker`?t:`root`}function problemsWord(e){return Y(`app.runs.problemCount`,{count:e})}function ScenarioList({items:e,mode:t,selectedId:n,results:r,running:i,onSelect:a,onOpen:o,onToggle:c,onMenu:l,label:d}){let f=s(null),p=n&&e.some(e=>e.id===n)?n:e[0]?.id??null,move=e=>{a(e),requestAnimationFrame(()=>{try{let t=typeof CSS<`u`&&CSS.escape?CSS.escape(`scenario-option-${e}`):`scenario-option-${e}`;f.current?.querySelector(`[id="${t}"]`)?.scrollIntoView({block:`nearest`})}catch{}})},onKey=n=>{let r=e.findIndex(e=>e.id===p);if(n.key===`ArrowDown`&&r<e.length-1)move(e[r+1].id);else if(n.key===`ArrowUp`&&r>0)move(e[r-1].id);else if(n.key===`Home`&&e.length>0)move(e[0].id);else if(n.key===`End`&&e.length>0)move(e[e.length-1].id);else if(n.key===`Enter`&&r>=0)o(e[r]);else if(n.key===` `&&t===`generate`&&r>=0&&!e[r].inFile&&!e[r].unplannable)c(e[r].id);else if(l&&r>=0&&(n.key===`ContextMenu`||n.key===`F10`&&n.shiftKey)){let t=document.getElementById(`scenario-option-${e[r].id}`),n=t?.getBoundingClientRect();l(e[r],{x:n?n.left+8:0,y:n?n.bottom:0},t??null)}else return;n.preventDefault()};return u(`ul`,{class:`penstock-review__list`,role:`listbox`,tabIndex:0,"aria-label":d,"aria-activedescendant":p?`scenario-option-${p}`:void 0,ref:f,onKeyDown:onKey,children:e.map(e=>{let n=r.get(e.name),s=i===e.name?`running`:n?.outcome??`none`;return u(`li`,{id:`scenario-option-${e.id}`,role:`option`,"aria-selected":e.id===p,"data-opens":`scenario`,class:`penstock-review__item${e.id===p?` is-selected`:``}`,title:caseTitle(e.name,n?.message??e.testCase.description),onClick:()=>a(e.id),onDblClick:()=>o(e),onContextMenu:t=>{l&&(t.preventDefault(),a(e.id),l(e,{x:t.clientX,y:t.clientY},t.currentTarget))},children:[t===`generate`?u(`input`,{type:`checkbox`,class:`penstock-review__check`,tabIndex:-1,checked:e.ticked,disabled:e.inFile||!!e.unplannable,"aria-label":Y(`app.runs.include`,{name:e.name}),onClick:e=>e.stopPropagation(),onChange:()=>c(e.id)}):u(`span`,{class:`penstock-runs__dot penstock-runs__dot--${s}`,"aria-label":s}),u(`span`,{class:`penstock-review__item-main`,children:[u(`span`,{class:`penstock-review__item-name`,children:e.name}),e.unplannable&&u(`span`,{class:`penstock-review__item-note is-problem`,children:e.unplannable}),e.origin!==`generated`&&_i(e.testCase)&&!e.unplannable&&u(`span`,{class:`penstock-review__item-note`,children:Y(`app.runs.penstockOnlyCamundaProcessTestWould`)}),e.inFile&&u(`span`,{class:`penstock-review__item-note`,children:Y(`app.runs.alreadyInTheFileKeptAs`)})]}),e.origin===`added`&&u(`span`,{class:`penstock-review__tag`,children:Y(`app.runs.added`)}),e.problems>0&&u(`span`,{class:`penstock-review__tag is-problem`,title:problemsWord(e.problems),"aria-label":problemsWord(e.problems),children:e.problems})]},e.id)})})}function ScenariosTab({active:e,views:t,push:r,back:i,reset:a}){let c=useScenarios(),{runs:d,review:p,enabled:m}=c,h=topOf(t),g=t.some(e=>e.key===`generate`)?`generate`:`file`,[v,b]=n(`steps`),x=s(null),S=s(h),[C,w]=n(null),[T,E]=n(null);f(()=>{c.setPresence(e,h,g)},[e,h,g]),f(()=>{if(e&&S.current!==h){let e=S.current;if(S.current=h,t.length<depthOf(e)){requestAnimationFrame(()=>{try{let t=document.querySelector(`[data-opens="${e}"]`);(t?.closest(`[role="listbox"]`)??t)?.focus()}catch{}});return}requestAnimationFrame(()=>{try{x.current?.querySelector(`[tabindex="0"], input, button`)?.focus()}catch{}})}},[e,h]),f(()=>b(`steps`),[p.selected?.id]);let D=p.selected,O=p.context,k=l(()=>({pin:c.pinStep,hover:c.hoverStep,changeRows:(e,t)=>{if(!D||!p.context)return;let n=e.values?.role??`returns`;p.edit(D.id,r=>editsForRows(D.baseCase,p.context.index.steps,r,{role:n,elementId:e.elementId,rows:t}))},setCondition:p.setCondition,conditionProblem:p.conditionProblem,openWorker:e=>{let t=p.context?.index.steps.get(e.elementId);t?.delegateClass?c.onNavigate(t.delegateClass,`JAVA_CLASS`):t?.delegateBean?c.onNavigate(t.delegateBean,`BEAN`):c.onOpenWorker(e.elementId)},openRule:e=>{c.showRule(e),r({key:`rule`,title:e.links.decision?.name??Y(`app.runs.decisionRule`)})},openDecision:e=>{let t=e.links.decision,n=t?.file??p.targets.tables.get(t?.id??``)?.file;try{n?G().revealElement(n,t?.id).catch?.(()=>{}):G().notifyUser(Y(`app.runs.noDecisionTableWithId`,{id:t?.id??``}),!0).catch?.(()=>{})}catch{}},openForm:e=>{c.showForm(e),r({key:`form`,title:e.name||Y(`app.runs.fillTheForm`)})},revealForm:e=>{let t=e.links.form??``,n=p.targets.forms.get(t);try{n?G().revealElement(n).catch?.(()=>{}):G().notifyUser(Y(`app.runs.noFormWithTheId`,{id:t}),!0).catch?.(()=>{})}catch{}},openTimer:e=>{c.showTimer(e),r({key:`timer`,title:e.name||Y(`app.runs.answerTimer`)})},openMockWorker:e=>{c.showMockWorker(e),r({key:`mock-worker`,title:e.name||Y(`app.runs.mockWorker`)})}}),[c,p,D,r]);f(()=>{if(!d.waiting||d.waiting.kind!==`userTask`)return;let e=d.waiting.elementId,t=D??p.items.find(e=>e.name===d.running);if(!t)return;let n=t.steps.find(t=>t.elementId===e);n?.links.form&&(h!==`form`||c.formStep?.elementId!==n.elementId)&&(D?.id!==t.id&&p.select(t.id),c.showForm(n),r({key:`form`,title:n.name||Y(`app.runs.fillTheForm`)}))},[d.waiting,D,p.items,d.running,h,c.formStep,r,p]);let A=y(c.file);if(f(()=>{let e=c.file;if(e===null||A===null||!p.ready||d.file===null)return;if(t.length>0){a();return}if(p.mode!==`file`)return;let n=_(e),i=n===null?void 0:p.items.find(e=>e.origin===`file`&&e.name===n);i&&(p.select(i.id),r({key:`scenario`,title:i.name}))},[c.file,A,p.ready,p.mode,p.items,p.select,d.file,t.length,a,r]),!m)return u(Z,{title:Y(`app.runs.scenariosNeedAnEngine`),hint:Y(`app.runs.scenariosRunACamunda7`),guide:`scenarios`});let j=d.file?.split(/[\\/]/).pop()??null,M=d.target?null:d.notice??Y(`app.runs.runningNeedsAnEngineSet`),N=d.running?Y(`app.runs.stop`):Y(`app.runs.run`),open=e=>{p.select(e.id),r({key:`scenario`,title:e.name})},reportFailure=e=>{G().notifyUser(e,!0).catch?.(()=>{})},renameItem=async(e,t)=>{try{let n=await d.renameScenario(e.name,occurrenceOf(e.id),t);return n&&`name`in n&&p.select(`file:${n.name}`),n&&`problem`in n?n.problem:null}catch(e){return reportFailure(ri(e)),null}},duplicateItem=async e=>{try{let t=await d.duplicateScenario(e.name,occurrenceOf(e.id));t&&`name`in t?p.select(`file:${t.name}`):t&&`problem`in t&&reportFailure(t.problem)}catch(e){reportFailure(ri(e))}},deleteItem=async e=>{let t=d.file?.split(/[\\/]/).pop()??``,n=!1;try{n=await G().confirmWithUser({title:Y(`app.runs.deleteScenarioTitle`,{name:e.name}),text:Y(`app.runs.deleteScenarioText`,{name:e.name,file:t}),accept:Y(`app.runs.deleteScenario`),decline:Y(`app.common.cancel`),warning:!0})}catch{return}if(n)try{let t=await d.deleteScenario(e.name,occurrenceOf(e.id));if(t&&`problem`in t){reportFailure(t.problem);return}h===`scenario`&&i()}catch(e){reportFailure(ri(e))}},startRename=e=>{(h!==`scenario`||D?.id!==e.id)&&open(e),E(e.id)},menuItems=e=>[{id:`rename`,label:Y(`app.runs.rename`),run:()=>startRename(e)},{id:`duplicate`,label:Y(`app.runs.duplicate`),run:()=>void duplicateItem(e)},{id:`delete`,label:Y(`app.runs.deleteScenario`),danger:!0,separated:!0,run:()=>void deleteItem(e)}],openMenu=(e,t,n)=>w({item:e,at:t,returnTo:n}),P=u(o,{children:u(`button`,{type:`button`,class:`ui-button`,disabled:!d.running&&(!D||!!D.unplannable||!d.target),onClick:d.running?d.stop:p.run,children:N})}),renderView=()=>{if(h===`timer`&&c.timerStep){let e=c.timerStep;return u(`div`,{class:`penstock-review`,ref:x,children:u(`div`,{class:`penstock-review__scroll`,children:u(TimerStepView,{step:e,review:p,runs:d,onFire:t=>{D&&p.edit(D.id,n=>({...n,mocks:{...n.mocks,[e.elementId]:{kind:`timer`,duration:t}}}))},onRemove:()=>{D&&p.edit(D.id,t=>({...t,mocks:{...t.mocks,[e.elementId]:null}}))}})})})}if(h===`mock-worker`&&c.mockWorkerStep){let e=c.mockWorkerStep;return u(`div`,{class:`penstock-review`,ref:x,children:u(`div`,{class:`penstock-review__scroll`,children:u(MockWorkerStepView,{step:e,review:p,runs:d,onMock:t=>{D&&p.edit(D.id,n=>({...n,mocks:{...n.mocks,[e.elementId]:t}}))},onRemove:()=>{D&&p.edit(D.id,t=>({...t,mocks:{...t.mocks,[e.elementId]:null}}))},onComplete:e=>d.answer({kind:`complete`,variables:e})})})})}if(h===`form`&&c.formStep){let e=c.formStep;return u(`div`,{class:`penstock-review`,ref:x,children:u(`div`,{class:`penstock-review__scroll`,children:u(LazyFormStepView,{step:e,review:p,runs:d,onChange:t=>k.changeRows(e,t),onComplete:e=>d.answer({kind:`complete`,variables:e}),onRevealFile:k.revealForm})})})}if(h===`rule`&&c.ruleStep)return u(`div`,{class:`penstock-review`,ref:x,children:u(`div`,{class:`penstock-review__scroll`,children:u(RuleView,{step:c.ruleStep,review:p,onOpen:k.openDecision})})});if(h===`add`&&O)return u(`div`,{class:`penstock-review`,ref:x,children:u(`div`,{class:`penstock-review__scroll`,children:u(AddScenarioForm,{context:O,suggestions:p.suggestions,processes:p.processes,onPreview:c.preview,onAdd:e=>{p.add(e),i()},onCancel:i})})});if(h===`scenario`&&D){let e=p.licensed,unlock=()=>void ai();return u(`div`,{class:`penstock-review`,ref:x,children:[u(`div`,{class:`penstock-review__fixed`,children:[M&&!d.running&&u(`p`,{class:`penstock-review__hint`,children:M}),u(`div`,{class:`penstock-review__tabs`,role:`tablist`,"aria-label":Y(`app.runs.view`),children:[u(`button`,{type:`button`,role:`tab`,"aria-selected":v===`steps`,class:`penstock-review__tab${v===`steps`?` is-active`:``}`,onClick:()=>b(`steps`),children:Y(`app.runs.steps`)}),u(`button`,{type:`button`,role:`tab`,"aria-selected":v===`text`,class:`penstock-review__tab${v===`text`?` is-active`:``}`,onClick:()=>b(`text`),children:Y(`app.runs.text`)})]}),D.notes.map(e=>u(`p`,{class:`penstock-review__issue is-mismatch`,children:e},e)),p.actual&&u(`p`,{class:`penstock-review__result${p.actual.matches?` is-same`:` is-different`}`,children:p.actual.matches?Y(`app.runs.theRunMatches`,{against:p.actual.against}):Y(`app.runs.theRunDiffersFrom`,{against:p.actual.against,count:p.actual.differences.length})}),c.offPath&&u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.notOnThisScenariosPath`)})]}),u(`div`,{class:`penstock-review__scroll`,children:D.unplannable?u(`p`,{class:`penstock-review__issue is-mismatch`,children:D.unplannable}):v===`steps`?u(`ol`,{class:`penstock-review__steps`,children:D.steps.map(t=>u(ReviewStep,{step:t,selected:c.focus===t.elementId,differences:p.actual?.byElement.get(t.elementId)??[],suggestions:p.suggestions,conditionNames:p.conditionNames,conditionStyle:p.conditionStyle,readOnly:!e,onUnlock:unlock,actions:k},`${t.number}:${t.elementId}`))}):u(`pre`,{class:`penstock-review__json`,"aria-label":Y(`app.runs.theScenarioAsItIs`),children:(()=>{try{return JSON.stringify(D.testCase,null,2)}catch{return String(D.testCase)}})()})}),u(`div`,{class:`penstock-review__footer`,children:[P,g===`file`&&u(`span`,{class:`penstock-review__extras`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:p.dirty.length===0||p.creating,onClick:()=>void p.save().catch(()=>{}),children:Y(`app.runs.saveChanges`)})})]})]})}let e=p.coverage?coverageLine(p.coverage,p.capped):null,t=p.items.filter(e=>e.unplannable).length;return h===`generate`?u(`div`,{class:`penstock-review`,ref:x,children:[u(`div`,{class:`penstock-review__fixed`,children:[u(`p`,{class:`penstock-review__count`,children:[Y(`app.runs.toCreate`,{ticked:p.ticked,items:p.items.length}),t>0?Y(`app.runs.cannotBePlanned`,{count:t}):``]}),p.capped&&u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.moreWaysThanShown`,{count:64})}),e&&u(`p`,{class:`penstock-review__coverage`,children:e})]}),u(`div`,{class:`penstock-review__scroll`,children:[p.problem&&u(`p`,{class:`penstock-review__issue is-mismatch`,children:p.problem}),!p.ready&&!p.problem&&u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.planningTheScenarios`)}),p.ready&&p.items.length===0&&u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.noWayThroughAProcess`)}),u(ScenarioList,{items:p.items,mode:`generate`,selectedId:D?.id??null,results:d.results,running:d.running,onSelect:p.select,onOpen:open,onToggle:p.toggle,label:Y(`app.runs.scenariosToCreate`)}),p.targets.duplicates.map(e=>u(`p`,{class:`penstock-review__hint`,children:e},e))]}),u(`div`,{class:`penstock-review__footer`,children:[u(`button`,{type:`button`,class:`ui-button`,"data-opens":`add`,disabled:!O,onClick:()=>r({key:`add`,title:Y(`app.runs.addScenario`)}),children:Y(`app.runs.addScenario`)}),u(`span`,{class:`penstock-review__extras`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:p.ticked===0||p.creating,onClick:()=>void p.create().then(e=>{e&&(p.reset(),a())}).catch(()=>{}),children:Y(`app.runs.createScenarios`)})})]})]}):u(`div`,{class:`penstock-review`,ref:x,children:[u(`div`,{class:`penstock-review__fixed`,children:[u(`div`,{class:`penstock-review__toolbar`,children:[u(`span`,{class:`penstock-review__file`,title:d.file??void 0,children:j??Y(`app.runs.noScenarioFile`)}),u(`span`,{class:`penstock-review__row-actions`,children:[!(p.ready&&p.items.length===0&&d.problems.length===0)&&u(`button`,{type:`button`,class:`ui-button`,"data-opens":`generate`,disabled:!!d.running,onClick:()=>void d.generate().then(e=>e&&r({key:`generate`,title:Y(`app.runs.reviewScenarios`)})).catch(()=>{}),children:Y(`app.runs.generate`)}),d.running?u(`button`,{type:`button`,class:`ui-button`,onClick:d.stop,children:Y(`app.runs.stop`)}):u(`button`,{type:`button`,class:`ui-button`,disabled:d.cases.length===0||!d.target,onClick:()=>d.run(),children:Y(`app.runs.runAll`)})]})]}),M&&u(`p`,{class:`penstock-review__hint`,children:M}),d.problems.map(e=>u(`p`,{class:`penstock-review__issue is-mismatch`,children:e},e)),d.notice&&d.target&&u(`p`,{class:`penstock-review__hint`,children:d.notice})]}),u(`div`,{class:`penstock-review__scroll`,children:[p.ready&&p.items.length===0&&d.problems.length===0&&u(Z,{title:Y(`app.runs.noScenariosAdded`),hint:Y(`app.runs.noScenariosHint`),guide:`scenarios`,actions:[{label:Y(`app.runs.generateThemFromTheDiagram`),run:()=>void d.generate().then(e=>e&&r({key:`generate`,title:Y(`app.runs.reviewScenarios`)})).catch(()=>{})}]}),!p.ready&&d.cases.length>0&&u(`p`,{class:`penstock-review__hint`,children:Y(`app.runs.planningTheScenarios`)}),p.items.length>0&&u(ScenarioList,{items:p.items,mode:`file`,selectedId:D?.id??null,results:d.results,running:d.running,onSelect:p.select,onOpen:open,onToggle:p.toggle,onMenu:openMenu,label:Y(`app.runs.scenariosIn`,{file:j??Y(`app.runs.theFile`)})})]}),u(`div`,{class:`penstock-review__footer`,children:[p.items.length>0&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button`,disabled:!D,onClick:()=>D&&open(D),children:Y(`app.runs.openScenario`)}),P]}),u(`span`,{class:`penstock-review__extras`,children:[c.onRunWithInput&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:c.onRunWithInput,children:Y(`app.runs.runWithInputMore`)}),c.onOpenRun&&u(`button`,{type:`button`,class:`penstock-review__link`,onClick:c.onOpenRun,children:Y(`app.runs.openARunMore`)})]})]})]})},F=h===`scenario`&&D&&g===`generate`&&!D.inFile&&!D.unplannable?D:null,L=h===`scenario`&&D&&g===`file`&&D.origin===`file`?D:null,R=h===`scenario`&&D?D.name:t[t.length-1]?.title??``,z=t.length>0?u(le,{title:R,backLabel:Y(`app.runs.backTo`,{value:t.length>1?t[t.length-2].title:Y(`app.common.scenarios`)}),onBack:()=>{h===`form`&&c.showForm(null),h===`rule`&&c.showRule(null),i()},editable:F?{label:Y(`app.runs.nameOfTheScenario`),onCommit:e=>(p.rename(F.id,e),null)}:L?{label:Y(`app.runs.nameOfTheScenario`),onCommit:e=>renameItem(L,e),start:T===L.id,onStarted:()=>E(null)}:void 0,trailing:F?u(`label`,{class:`penstock-review__include`,title:Y(`app.runs.writeThisScenarioToThe`),children:[u(`input`,{type:`checkbox`,"aria-label":Y(`app.runs.createThisScenario`),checked:F.ticked,onChange:()=>p.toggle(F.id)}),u(`span`,{children:Y(`app.runs.create`)})]}):L?u(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":Y(`app.runs.scenarioActions`),title:Y(`app.runs.scenarioActions`),"aria-haspopup":`menu`,"aria-expanded":C!==null,onClick:e=>{let t=e.currentTarget,n=t.getBoundingClientRect();openMenu(L,{x:n.left,y:n.bottom+4},t)},children:u(I,{name:`more`})}):void 0}):null;return u(o,{children:[z,renderView(),C&&u(un,{label:Y(`app.runs.scenarioActions`),at:C.at,items:menuItems(C.item),onClose:()=>w(null),returnFocusTo:C.returnTo})]})}function depthOf(e){return e===`root`?0:e===`generate`?1:e===`scenario`?2:3}function ScenariosBar({views:e}){let t=useScenarios(),n=t.review.selected,r=topOf(e)===`scenario`&&n&&!n.unplannable;return u(o,{children:r?u(o,{children:[u(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":Y(`app.runs.previousStep`),onClick:()=>t.stepBy(-1),children:`‹`}),u(`span`,{class:`sidebar-bar__title`,title:n.name,children:barText(t.stepAt,n.steps.length)}),u(`button`,{type:`button`,class:`sidebar__icon`,"aria-label":Y(`app.runs.nextStep`),onClick:()=>t.stepBy(1),children:`›`})]}):u(`span`,{class:`sidebar-bar__title`,children:Y(`app.runs.scenarios`)})})}function policyTag(e){let t=j(e);return t===null?[]:[Y(`app.policy.findingTag`,{name:t})]}function RuleHelp({family:e,name:t}){let n=Hi(e,t);return n?u(`div`,{class:`diagram-check__help`,children:[u(`p`,{class:`diagram-check__help-line`,children:[u(`span`,{class:`diagram-check__help-label`,children:Y(`app.diagramCheck.why`)}),Wi(e,t)]}),u(`p`,{class:`diagram-check__help-line`,children:[u(`span`,{class:`diagram-check__help-label`,children:Y(`app.diagramCheck.fix`)}),Gi(e,t)]}),u(`a`,{class:`diagram-check__help-link`,href:Ui(n.id),target:`_blank`,rel:`noopener noreferrer`,children:n.id})]}):null}var ed={error:0,warning:1,info:2};function worstFirst(e){return[...e].sort((e,t)=>ed[e.severity]-ed[t.severity])}function migrationSections(e){return[{title:Y(`app.migration.needsWork`),findings:worstFirst(e.filter(e=>e.conversion===`manual`)),collapsed:!1},{title:Y(`app.migration.reviewAfterConverting`),findings:worstFirst(e.filter(e=>e.conversion===`review`)),collapsed:!1},{title:Y(`app.migration.convertUnchanged`),findings:e.filter(e=>e.conversion===`automatic`),collapsed:!0}].filter(e=>e.findings.length>0)}function migrationTally(e){return{toDo:e.filter(e=>e.conversion===`manual`).length,toCheck:e.filter(e=>e.conversion===`review`).length,converts:e.filter(e=>e.conversion===`automatic`).length}}function migrationTallyText(e){return[e.toDo>0?Y(`app.migration.tally.toDo`,{count:e.toDo}):null,e.toCheck>0?Y(`app.migration.tally.toCheck`,{count:e.toCheck}):null,e.converts>0?Y(`app.migration.tally.converts`,{count:e.converts}):null].filter(Boolean).join(`, `)}async function projectForms(){try{let e=G(),t=await e.getProjectFiles(),n=(Array.isArray(t?.files)?t.files:[]).filter(e=>e&&typeof e.path==`string`&&/\.form$/i.test(e.path)),r=await Promise.all(n.map(async t=>({path:t.path,text:await e.readFile(t.path).catch(()=>``)})));return rr(r)}catch{return new Map}}var td=600;function useMigration(e,t,i){let[a,o]=n({findings:null,failure:null}),c=s(null),l=s(!0);f(()=>(l.current=!0,()=>{l.current=!1}),[]);let u=r(async()=>{try{let e=typeof i==`function`?await i().catch(()=>void 0):void 0;if(!l.current)return;if(!e){o({findings:[],failure:null});return}c.current??=await projectForms();let t=await ar(e,{forms:c.current}).catch(()=>({ok:!1,failure:Y(`app.migration.theDiagramCouldNotBe`)}));if(!l.current)return;let n=Array.isArray(t?.findings)?t.findings:[];o({findings:t?.ok&&t?.source?n:[],failure:t?.ok?null:t?.failure??Y(`app.migration.theDiagramCouldNotBe`)})}catch(e){l.current&&o({findings:null,failure:e instanceof Error?e.message:String(e)})}},[i]);return f(()=>{if(!e)return;c.current=null,u();let n;try{n=typeof t==`function`?t()?.get?.(`eventBus`):void 0}catch{}if(!n)return;let r,handler=()=>{r&&clearTimeout(r),r=setTimeout(()=>void u(),td)};try{n.on?.(`commandStack.changed`,handler),n.on?.(`import.done`,handler)}catch{}return()=>{r&&clearTimeout(r);try{n?.off?.(`commandStack.changed`,handler),n?.off?.(`import.done`,handler)}catch{}}},[e,u,t]),a}async function convertOpenDiagram(e,t){try{let n=G(),{path:r,xml:i}=e;if(!r||!i){try{await n.notifyUser(Y(`app.migration.saveTheDiagramFirstOnly`),!0)}catch{}return`nothing`}let a=lr(n,async()=>{try{return(await n.getProjectFiles())?.root??``}catch{return``}}),o=await projectForms();return await cr(a,{path:r,text:i,forms:o},t)}catch{return`nothing`}}function namesOf(e,t){let n=e?.get?.(`elementRegistry`);return(t??[]).map(e=>{let t=n?.get?.(e);return t?.businessObject?.name?.replace(/\s+/g,` `).trim()||(t?.type?Ji(t.type):e)})}function DefectRow({defect:e,rowKey:t,check:n,severity:r}){let i=n.selected===t;return u(`li`,{children:[u(`button`,{type:`button`,class:i?`diagram-check__row has-severity is-selected`:`diagram-check__row has-severity`,onClick:()=>n.pickDefect(e,t),onMouseEnter:()=>n.peek(e),onMouseLeave:()=>n.peek(null),onFocus:()=>n.peek(e),onBlur:()=>n.peek(null),title:e.detail,children:[u(ce,{severity:r}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:e.title}),u(`span`,{class:`diagram-check__row-where`,children:e.where})]})]}),i&&u(RuleHelp,{family:`drawing`,name:e.kind})]})}function FindingsList({check:e}){let[t,r]=n(!1),[i,a]=n(!1),s=e?.flow??[],c=e?.flowUnlocked??!1,l=e?.defects??{error:[],readability:[]},d=e?.rules??[],f=e?.rulesFailure??null,p=e?.codeFindings??[],m=e?.namespaceFinding??null,h=e?.migration??null,g=e?.selected??null,_=e?.getModeler?.()??null,rowClass=e=>g===e?`diagram-check__row has-severity is-selected`:`diagram-check__row has-severity`;return u(o,{children:[c&&s.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.howItRuns`)}),u(`ul`,{class:`diagram-check__list`,children:s.map((t,n)=>u(`li`,{children:[u(`button`,{type:`button`,class:rowClass(`flow-${n}`),onClick:()=>e.pickFlow(t,`flow-${n}`),title:t.detail,children:[u(ce,{severity:`error`}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.detail}),t.trace.length>0&&u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:Y(`app.rules.web.path`,{path:namesOf(_,t.trace).join(` → `)})})]})]}),g===`flow-${n}`&&u(RuleHelp,{family:`flow`,name:t.kind})]},`flow-${n}`))})]}),!c&&e.flowCount>0&&u(`section`,{class:`diagram-check__group`,children:u(`button`,{type:`button`,class:`diagram-check__row diagram-check__upsell`,onClick:e.onUnlockFlow,children:[u(`span`,{class:`diagram-check__row-title`,children:Y(`app.rules.web.flowAnalysisFound`,{count:e.flowCount})}),` `,u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:Y(`app.rules.web.flowAnalysisHint`)})]})}),l.error.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.drawing`)}),u(`ul`,{class:`diagram-check__list`,children:l.error.map((t,n)=>u(DefectRow,{defect:t,rowKey:`error-${n}`,check:e,severity:`error`},`error-${n}`))})]}),m&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.engine`)}),u(`ul`,{class:`diagram-check__list`,children:u(`li`,{children:u(`div`,{class:`diagram-check__row has-severity diagram-check__row--fix`,children:[u(ce,{severity:`error`}),u(`div`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:m.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:m.message})]}),u(`button`,{type:`button`,class:`ui-button`,onClick:m.fix,children:Y(`app.diagramCheck.fix`)})]})})})]}),p.some(e=>e.kind!==`template-rejected`&&e.kind!==`connection`&&e.kind!==`agent`)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.code`)}),u(`ul`,{class:`diagram-check__list`,children:p.map((t,n)=>t.kind===`template-rejected`||t.kind===`connection`||t.kind===`agent`?null:u(`li`,{children:u(`button`,{type:`button`,class:rowClass(`code-${n}`),onClick:()=>e.pickCode(t,`code-${n}`),children:[u(ce,{severity:t.severity}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.where})]})]})},`code-${n}`))})]}),p.some(e=>e.kind===`connection`)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.connections`)}),u(`ul`,{class:`diagram-check__list`,children:p.map((t,n)=>t.kind===`connection`?u(`li`,{children:u(`button`,{type:`button`,class:rowClass(`code-${n}`),onClick:()=>e.pickCode(t,`code-${n}`),children:[u(ce,{severity:t.severity}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.where})]})]})},`connection-${n}`):null)})]}),p.some(e=>e.kind===`agent`)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.agents`)}),u(`ul`,{class:`diagram-check__list`,children:p.map((t,n)=>t.kind===`agent`?u(`li`,{children:u(`button`,{type:`button`,class:rowClass(`code-${n}`),onClick:()=>e.pickCode(t,`code-${n}`),children:[u(ce,{severity:t.severity}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.where})]})]})},`agent-${n}`):null)})]}),p.some(e=>e.kind===`template-rejected`)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.templates`)}),u(`ul`,{class:`diagram-check__list`,children:p.map((e,t)=>e.kind===`template-rejected`?u(`li`,{children:u(`div`,{class:`diagram-check__row has-severity`,children:[u(ce,{severity:e.severity}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:e.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:e.where})]})]})},`template-${t}`):null)})]}),(d.length>0||f)&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.diagramCheck.rules`)}),f&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__note`,children:Y(`app.rules.web.rulesCouldNotRun`,{failure:f})}),u(`ul`,{class:`diagram-check__list`,children:d.map((t,n)=>u(`li`,{children:[u(`button`,{type:`button`,class:rowClass(`rule-${n}`),onClick:()=>e.pickRule(t,`rule-${n}`),title:t.rule,children:[u(ce,{severity:t.severity===`error`?`error`:`warning`}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:t.message}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:[...namesOf(_,t.elements),t.rule,...policyTag(t.rule)].join(` · `)})]})]}),g===`rule-${n}`&&u(RuleHelp,{family:t.rule.startsWith(`compat/`)?`compat`:t.rule.startsWith(`engine/`)?`engine`:`bpmnlint`,name:t.rule})]},`rule-${n}`))})]}),h&&u(`section`,{class:`diagram-check__group diagram-check__migration`,children:[u(`div`,{class:`diagram-check__migration-bar`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.rules.web.migrateToCamunda8`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:h.onConvert,title:Y(`app.diagramCheck.showTheDiagramConvertedFor`,{target:h.target}),children:Y(`app.diagramCheck.convert`)})]}),h.failure&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__note`,children:h.failure}),h.findings&&h.findings.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.rules.web.nothingToConvert`)}),h.findings&&h.findings.length>0&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__note`,children:migrationTallyText(migrationTally(h.findings))}),migrationSections(h.findings??[]).map(t=>u(`div`,{children:[t.collapsed?u(`button`,{type:`button`,class:`diagram-check__heading diagram-check__toggle`,onClick:()=>a(e=>!e),"aria-expanded":i,children:[t.title,` (`,t.findings.length,`)`]}):u(`h4`,{class:`diagram-check__heading`,children:[t.title,` (`,t.findings.length,`)`]}),(!t.collapsed||i)&&u(`ul`,{class:`diagram-check__list`,children:t.findings.map((n,r)=>u(`li`,{children:u(`button`,{type:`button`,class:rowClass(`migration-${t.title}-${r}`),onClick:()=>e.pickElements(n.elements,`migration-${t.title}-${r}`),title:n.detail,children:[u(ce,{severity:`warning`}),u(`span`,{class:`diagram-check__row-text`,children:[u(`span`,{class:`diagram-check__row-title`,children:n.title}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:[n.where,`. `,n.action]})]})]})},`${t.title}-${r}`))})]},t.title))]}),l.readability.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`button`,{type:`button`,class:`diagram-check__heading diagram-check__toggle`,onClick:()=>r(e=>!e),"aria-expanded":t,children:Y(`app.rules.web.readability`,{number:l.readability.length})}),t&&u(`ul`,{class:`diagram-check__list`,children:l.readability.map((t,n)=>u(DefectRow,{defect:t,rowKey:`readability-${n}`,check:e,severity:`warning`},`readability-${n}`))})]})]})}function ProblemsTab({check:e,clientFacts:t}){let{counts:n}=e,r=L(),i=!e.clean||e.migration!==null||n.readability>0;return u(`div`,{class:`problems`,children:[u(`header`,{class:`problems__bar`,children:[u(`span`,{class:`problems__count`,children:e.enabled&&e.checked>0&&i?Wt(n,e.rulesFailure):``}),u(`button`,{type:`button`,class:`ui-button`,onClick:e.run,title:Y(`app.common.checkAgain`),children:Y(`app.common.recheck`)}),r&&u(`span`,{class:`diagram-check__policy`,children:r})]}),(!e.enabled||e.checked===0)&&u(Z,{title:Y(`app.problems.waiting`),hint:Y(`app.diagramCheck.theCheckStartsOnIts`),guide:`problems`}),e.enabled&&e.checked>0&&!i&&(Ue(t)?u(et,{facts:t}):u(Z,{title:Y(`app.diagramCheck.noProblemsFound`),hint:Y(`app.diagramCheck.nothingToReportAcrossElements`,{checked:e.checked}),guide:`problems`})),u(FindingsList,{check:e})]})}var nd={"agents/tool-without-description":/(^|\/)agent-tool-documentation$/};function withoutShadowed(e,t){return e.filter(e=>{let n=e.rule===void 0?void 0:nd[e.rule];return!n||!t.some(t=>n.test(t.rule)&&t.elements.some(t=>e.elements.includes(t)))})}var rd=`diagram-check-trace`,id=`diagram-check-migration`,ad=[],od={defects:[],errors:0,readability:0,checkedElements:0};function flowProblemsOf(e){let t=e?.getDefinitions?.();if(!t)return[];try{return Jr(t).problems}catch(e){return console.error(`Flow analysis failed:`,e),[]}}function useDiagramCheck({enabled:e,getModeler:t,flowUnlocked:i,onUnlockFlow:a,loadRules:o,codeFindings:c=ad,namespaceFinding:u=null,migration:d=null,onReveal:p}){let[m,h]=n(od),[g,_]=n([]),[v,y]=n([]),[b,x]=n(null),[S,C]=n(null),w=s(!0),T=r(()=>{let e=t(),n=checkDiagram(e);clearMarker(e,Nc),n.defects.filter(e=>e.severity===`error`).forEach(t=>markElements(e,t.elements,Nc));let r=flowProblemsOf(e);i&&r.forEach(t=>markElements(e,t.elements,Nc)),h(n),_(r);let a=e?.getDefinitions?.();a&&o(a).then(e=>st(a,e)).then(t=>{w.current&&(t.filter(e=>e.severity===`error`).forEach(t=>markElements(e,t.elements,Nc)),y(t),x(null))}).catch(e=>{w.current&&(y([]),x(e instanceof Error?e.message:String(e)))})},[t,i,o]);f(()=>{if(w.current=!0,!e)return;T();let n=t()?.get(`eventBus`);if(!n)return;let r,handler=()=>{r&&clearTimeout(r),r=setTimeout(T,400)};return n.on(`elements.changed`,handler),n.on(`import.done`,handler),()=>{w.current=!1,r&&clearTimeout(r),n.off(`elements.changed`,handler),n.off(`import.done`,handler);let e=t();e&&[Nc,Pc,Fc,rd,id].forEach(t=>clearMarker(e,t))}},[e,T,t]),f(()=>{let n=t();if(clearMarker(n,id),e&&d?.findings)return migrationSections(d.findings).filter(e=>!e.collapsed).forEach(e=>e.findings.forEach(e=>markElements(n,e.elements,id))),()=>clearMarker(t(),id)},[e,d?.findings,t]);let E=l(()=>Ht(v,m.defects),[v,m.defects]),D=l(()=>withoutShadowed(c,E),[c,E]),O=l(()=>{let bySeverity=e=>m.defects.filter(t=>t.severity===e);return{error:bySeverity(`error`),readability:bySeverity(`readability`)}},[m]),k=r((e,n)=>{C(n),focusDefect(t(),e.elements)},[t]),A=r((e,n)=>{C(n);let r=t();clearMarker(r,rd),markElements(r,e.trace,rd),focusDefect(r,[...new Set([...e.trace,...e.elements])])},[t]),j=r((e,n)=>{C(n),focusDefect(t(),e.elements),p?.(e.rule,e.elements)},[t,p]),M=r((e,n)=>{C(n),focusDefect(t(),e.elements),p?.(e.kind,e.elements)},[t,p]),N=r((e,n)=>{C(n),focusDefect(t(),e)},[t]),P=r((e,n)=>{C(n),focusDefect(t(),e.elements),e.rule&&p?.(e.rule,e.elements)},[t,p]),F=r(e=>{let n=t();clearMarker(n,Fc),e&&markElements(n,e.elements,Fc)},[t]),I=g.filter(e=>e.kind!==`TOO-COMPLEX`).length,L=E.filter(e=>e.severity===`error`).length,R=Je({defects:m.errors,ruleErrors:L,ruleWarnings:E.length-L,flowCount:I,flowUnlocked:i,code:D,namespace:!!u,readability:m.readability}),z=R.errors===0&&R.warnings===0&&!b&&(I===0||!i)&&!u,B=l(()=>Oe([O.error.map(e=>({severity:`error`,title:e.title,where:e.where,elements:e.elements})),i?g.filter(e=>e.kind!==`TOO-COMPLEX`).map(e=>({severity:`error`,title:e.title,where:e.detail,elements:e.elements})):[],u?[{severity:`error`,title:u.title,where:u.message,elements:[]}]:[],D.map(e=>({severity:e.severity,title:e.title,where:e.where,elements:e.elements,rule:e.kind})),E.map(e=>({severity:e.severity===`error`?`error`:`warning`,title:e.message,where:[...namesOf(t(),e.elements),...policyTag(e.rule)].join(` · `),elements:e.elements,rule:e.rule}))],3),[O,g,i,u,D,E,t]);return{enabled:e,checked:m.checkedElements,defects:O,flow:g,flowCount:I,flowUnlocked:i,onUnlockFlow:a,rules:E,rulesFailure:b,codeFindings:D,namespaceFinding:u,migration:d,counts:R,clean:z,card:B,selected:S,run:T,getModeler:t,pickDefect:k,pickFlow:A,pickRule:j,pickCode:M,pickElements:N,pickSummary:P,peek:F}}var sd={"camunda-7":`Camunda 7`,"camunda-8":`Camunda 8`,operaton:`Operaton`,"cib-seven":`CIB seven`,flowable:`Flowable`,activiti:`Activiti`};function isLocal(e){if(!e)return!1;try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`[::1]`}catch{return!1}}function engineLabel(e,t,n){let r=e?e.toLowerCase().replace(/_/g,`-`):null,i=r?sd[r]??e:null,a=i?isLocal(n)?Y(`app.live.localEngine`,{engine:i}):i:null;return t&&a?t===r?a:`${t} (${a})`:t??a??Y(`app.live.theEngine`)}function versionText(e){let t=(e??[]).filter(e=>e?.deployed&&e?.version!==null&&e?.version!==void 0);return t.map(e=>t.length===1?Y(`app.live.processVersion`,{version:e.version}):Y(`app.live.namedProcessVersion`,{process:e.processId,version:e.version}))}function groupIncidents(e){let t=new Map;return(e??[]).forEach(e=>{if(!e)return;let n=e.elementId??``,r=e.message??``,i=e.type??``,a=e.instance??``,o=e.id,s=`${n}\u0000${r||i}`,c=t.get(s);if(c)c.count+=1,c.instance||=a,!c.id&&o&&(c.id=o);else{let e={elementId:n,message:r,type:i,count:1,instance:a};o&&(e.id=o),t.set(s,e)}}),[...t.values()]}function incidentLine(e){let t=e?.message||e?.type||``,n=e?.count??1;return n===1?t:Y(`app.live.incidentsOn`,{count:n,what:t})}function problemText$1(e){return e instanceof Error?e.message:String(e)}e(problemText$1,`problemText`);function silent(){return{result:null,warnings:[],secret:!1,secrets:[],problem:null,why:null}}function resultText(e){if(!e)return``;if(e.problem)return e.problem;let t;try{t=e.result===null?`null`:typeof e.result==`string`?e.result:JSON.stringify(e.result)}catch{t=String(e.result)}return e.secret?Y(`app.live.secretNotResolved`,{value:t}):t}function useLiveTrial(e,t,i,a){let[o,c]=n([]),[u,d]=n(null),[p,m]=n(!1),[h,g]=n(null),[_,v]=n(new Map),[y,b]=n(null),[x,S]=n(null),[C,w]=n(null),[T,E]=n(!1),[D,O]=n(null),[k,A]=n(null),[j,M]=n(!1),[N,P]=n([]),[F,I]=n([]),L=s(0),R=e?.ask,z=e?.engineKind,B=(e?.state?.processes??[]).find(e=>e?.deployed&&e?.key)??null,V=B?.key??null,H=z===`CAMUNDA_7`?B?.processId??null:V,U=l(()=>{try{return z?wn(z):null}catch{return null}},[z]);f(()=>{if(!a||!R||!z||!H){c([]),d(null);return}let e=!1;return m(!0),Sn(z,H,R).then(t=>{e||(c(t),d(null))}).catch(t=>{e||(c([]),d(problemText$1(t)))}).finally(()=>!e&&m(!1)),()=>{e=!0}},[R,a,z,H]),f(()=>{let read=()=>{try{let e=t?.getDefinitions?.();P(e?Vn(e):[]),I(e?Un(e).uses:[])}catch{P([]),I([])}};read();try{t?.on?.(`commandStack.changed`,read)}catch{}return()=>{try{t?.off?.(`commandStack.changed`,read)}catch{}}},[t]);let W=l(()=>{try{return((i?t?.get?.(`elementRegistry`)?.get?.(i):null)?.outgoing??[]).map(e=>String(e?.id??``)).filter(Boolean)}catch{return[]}},[t,i]),G=r(e=>{L.current+=1,E(!1),g(t=>t===e?null:e),v(new Map),S(null),w(null)},[]),ee=r(async()=>{if(!R||!z||!h)return;let e=L.current+=1,mineStill=()=>L.current===e;E(!0);try{let e=await bn(z,h,R);if(!mineStill())return;S(e),w(null)}catch(e){if(!mineStill())return;S(null),w(problemText$1(e))}finally{mineStill()&&E(!1)}},[R,z,h]),K=r(async e=>{if(!R||!z||!h)return;let t=L.current+=1,mineStill=()=>L.current===t;b(e);try{let t=await bn(z,h,R);if(!mineStill())return;S(t),w(null);let n=await Cn(z,e,t,R);if(!mineStill())return;v(t=>new Map(t).set(e,{outcome:n,variables:null}))}catch(t){if(!mineStill())return;v(n=>new Map(n).set(e,{outcome:{...silent(),problem:problemText$1(t)},variables:null}))}finally{mineStill()&&b(null)}},[R,z,h]),te=r(async()=>{if(R&&z&&V&&U?.names){M(!0),A(null);try{O(await yn(z,V,R))}catch(e){O(null),A(problemText$1(e))}finally{M(!1)}}},[R,z,V,U?.names]);return f(()=>{Dt({instance:h,kind:z,ask:R,trying:y,run:K,results:new Map([..._].map(([e,t])=>[e,t.outcome]))})},[R,h,z,_,y,K]),{instances:o,instancesProblem:u,askingInstances:p,instance:h,pick:G,pickable:!!(a&&R&&V),selected:i,selectedExpressions:i?N.filter(e=>e.elementId===i||W.includes(e.elementId)):[],uses:F,results:_,trying:y,tryOn:K,variables:x,variablesProblem:C,readingVariables:T,readVariables:ee,contract:D?.names&&!D.problem?(()=>{try{return compareVariables(F,D.names)}catch{return null}})():null,namesProblem:D?.problem??k,namesWhy:D?.why??null,askingNames:j,readNames:te,support:U}}var cd={instance:null},ld=new Set;function monitorPick(){return cd}function publishMonitorPick(e){cd={instance:e},ld.forEach(e=>e(cd))}function watchMonitorPick(e){return ld.add(e),()=>{ld.delete(e)}}function useHistory(e,t){let[i,a]=n([]),[o,s]=n(!1),[c,l]=n(null),[u,d]=n(null),[p,m]=n(null),[h,g]=n(!1),_=e?.ask,v=e?.engineKind,y=(e?.state?.processes??[]).find(e=>e.deployed&&e.key),b=r(async()=>{if(!_||!v||!y)a([]);else{s(!0),l(null);try{let e=v===`CAMUNDA_8`?y.key??y.processId:y.processId,t=await readFinishedInstances(v,e,10,_);a(t)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}},[_,v,y]);f(()=>{b()},[b]);let x=r(async e=>{if(_&&v&&t){if(u===e)d(null),m(null),clearPath(t),publishMonitorPick(null);else{d(e),publishMonitorPick(e),g(!0);try{let n=await readInstancePath(v,e,_);m(n),showPath(t,n.steps,null)}catch(e){l(e instanceof Error?e.message:String(e))}finally{g(!1)}}}},[_,v,t,u]);return f(()=>()=>{t&&clearPath(t)},[t]),{instances:i,asking:o,problem:c,selected:u,path:p,loadingPath:h,pick:x,refresh:b}}function formatDuration(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.round(e)}ms`;if(e<59950)return`${(e/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);if(t<3600)return`${Math.floor(t/60)}m ${t%60}s`;let n=Math.round(e/6e4);if(n<1440)return`${Math.floor(n/60)}h ${n%60}m`;let r=Math.round(e/36e5);return`${Math.floor(r/24)}d ${r%24}h`}function startText(e){try{return JSON.stringify(e.variables,null,2)??`{}`}catch{return`{}`}}function WhatIfDialog({bridge:e,source:t,step:r,onStarted:i,onClose:a}){let[o,c]=n(()=>startText(r)),[d,p]=n(null),[m,h]=n(null),[g,_]=n(!1),[v,y]=n(null),[b,x]=n(null),S=s(!0);f(()=>(S.current=!0,li(t.diagramPath,t.profile,e).then(async n=>{S.current&&(n?p(n):h(await $r(t.diagramPath,t.profile,e)||Y(`app.incident.dialog.noEngine`)))}),()=>{S.current=!1}),[]);let C=l(()=>d?planWhatIf({engine:t.kind,processId:t.processId,elementId:r.elementId,variablesText:o,target:d,elements:t.elements}):null,[d,o,t,r]),start=async()=>{if(!g&&C&&C.ok&&d){_(!0),y(null);try{let n=!1;try{n=await e.requestFeature(U.REPLAY)}catch{}if(!n)return;let r=await Xr(d,void 0,e);if(r){S.current&&y(r);return}let a=await startWhatIf(t.kind,C.plan,t.ask(t.profile,t.diagramPath));if(!S.current)return;a.ok?(x(a.instance),i(a.instance)):y(a.reason)}catch(e){S.current&&y(e instanceof Error?e.message:String(e))}finally{S.current&&_(!1)}}},w=b===null?[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:a,disabled:g},{id:`start`,label:Y(`app.replay.whatIf.start`),role:`primary`,disabled:g||!C||!C.ok,onClick:()=>void start()}]:[{id:`close`,label:Y(`app.common.close`),role:`primary`,onClick:a}];return u(dn,{title:Y(`app.replay.whatIf.title`),size:`medium`,initialFocus:`first`,backdrop:`keep`,onClose:()=>!g&&a(),footer:u(ln,{actions:w}),children:u(`div`,{class:`replay-whatif`,children:[u(`p`,{class:`type-body`,children:Y(`app.replay.whatIf.intro`,{element:r.elementId})}),m!==null&&u(`p`,{class:`type-help`,role:`alert`,children:m}),r.secrets.length>0&&u(`p`,{class:`type-help`,role:`status`,children:Y(`app.replay.whatIf.secrets`,{names:r.secrets.join(`, `)})}),t.kind===`CAMUNDA_8`&&u(`p`,{class:`type-help`,children:Y(`app.replay.whatIf.latestVersion`)}),u(X,{label:Y(`app.replay.whatIf.variables`),hint:Y(`app.replay.whatIf.variablesHint`),children:e=>u(`textarea`,{...e,class:`ui-input replay-whatif__variables`,rows:10,spellcheck:!1,value:o,disabled:b!==null,onInput:e=>c(e.target.value)})}),C&&!C.ok&&u(`p`,{class:`type-help`,role:`alert`,"data-testid":`whatif-refusal`,children:C.reason}),C&&C.ok&&b===null&&u(`p`,{class:`type-body`,role:`status`,"data-testid":`whatif-plan`,children:Y(`app.replay.whatIf.plan`,{process:C.plan.processId,element:C.plan.elementId,target:d?.url??``,count:C.plan.names.length})}),v!==null&&u(`p`,{class:`type-help`,role:`alert`,children:v}),b!==null&&u(`p`,{class:`type-body`,role:`status`,"data-testid":`whatif-started`,children:Y(`app.replay.whatIf.started`,{instance:b})})]})})}async function unlocked$1(){try{return await G().requestFeature(U.REPLAY)}catch{return!1}}e(unlocked$1,`unlocked`);function useReplay(e,t,i,a={}){let[o,c]=n(`idle`),[l,u]=n(null),[d,p]=n(null),[m,h]=n(0),g=s(0),_=e?.ask,v=e?.engineKind,y=r(()=>{g.current+=1,u(null),p(null),h(0),c(`idle`)},[]),b=s(i);f(()=>{b.current!==i&&(b.current=i,y())},[i,y]);let x=r(async()=>{if(!_||!v||!i)return;let e=g.current+=1;c(`loading`),p(null);try{if(!await(a.unlock??unlocked$1)()){g.current===e&&c(`idle`);return}let t=await readReplay(v,i,_);if(g.current!==e)return;if(!t.ok){u(null),p(t.reason),c(`problem`);return}u(t.replay),h(0),c(`ready`)}catch(t){if(g.current!==e)return;u(null),p(t instanceof Error?t.message:String(t)),c(`problem`)}},[_,v,i,a.unlock]),S=l?.steps[m]??null;f(()=>{if(l&&S){showPath(t,l.steps.slice(0,m+1).map(e=>({elementId:e.elementId,state:e.state,mocked:!1,startedAt:e.startedAt,endedAt:e.endedAt})),S.elementId);try{focusDefect(t,[S.elementId])}catch{}}},[l,S,m,t]),f(()=>()=>{g.current+=1,clearPath(t)},[t]);let C=r(e=>{l&&h(Math.min(l.steps.length-1,Math.max(0,Math.trunc(e))))},[l]);return{status:o,replay:l,problem:d,index:m,current:S,open:x,close:y,go:r(e=>C(m+e),[C,m]),select:C}}var ud=160;function nameOf$6(e,t){try{let n=e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name;return typeof n==`string`&&n.trim()!==``?n.trim().slice(0,80):t}catch{return t}}e(nameOf$6,`nameOf`);function shown$2(e){let t;try{t=typeof e==`string`?e:JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>ud?`${t.slice(0,157)}...`:t}e(shown$2,`shown`);function idsOn$1(e){let t=new Set;try{e?.get?.(`elementRegistry`)?.forEach?.(e=>{e?.id&&!e.waypoints&&!e.labelTarget&&t.add(String(e.id))})}catch{}return t}e(idsOn$1,`idsOn`);function Variables$1({step:e,replay:t}){let n=Object.keys(e.variables);return u(`div`,{class:`replay__variables`,children:[u(`h4`,{class:`type-section-heading`,children:t.source===`history`?Y(`app.replay.variablesThen`):Y(`app.replay.variablesNow`)}),t.source===`current`&&u(`p`,{class:`diagram-check__note`,children:Y(`app.replay.currentNote`)}),e.cut&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.replay.cut`)}),n.length===0&&!e.cut&&u(`p`,{class:`diagram-check__note`,children:Y(`app.replay.noVariables`)}),n.length>0&&u(`table`,{class:`replay__table`,"aria-label":Y(`app.replay.variablesTable`),children:u(`tbody`,{children:n.map(t=>u(`tr`,{class:e.changed.includes(t)?`is-changed`:void 0,children:[u(`th`,{scope:`row`,children:t}),u(`td`,{children:shown$2(e.variables[t])}),e.changed.includes(t)&&u(`td`,{class:`type-help`,children:Y(`app.replay.changedHere`)})]},t))})})]})}e(Variables$1,`Variables`);function ReplayPanel({live:e,modeler:t,instance:r,bridge:i,diagramPath:a,options:o,onClosed:s}){let c=useReplay(e,t,r,o),[l,d]=n(!1),[f,p]=n(null),m=(e?.state?.processes??[]).find(e=>e.deployed);if(c.status===`idle`||c.status===`loading`)return u(`div`,{class:`replay`,"data-testid":`replay`,children:u(`button`,{type:`button`,class:`ui-button`,disabled:c.status===`loading`,onClick:()=>void c.open(),children:c.status===`loading`?Y(`app.replay.loading`):Y(`app.replay.open`)})});let{replay:h,current:g}=c,close=()=>{c.close(),s?.()};if(c.status===`problem`||!h||!g)return u(`div`,{class:`replay`,"data-testid":`replay`,children:[u(`p`,{class:`diagram-check__note diagram-check__note--error`,role:`alert`,children:c.problem}),u(`button`,{type:`button`,class:`ui-button`,onClick:close,children:Y(`app.common.close`)})]});let _=e.engineKind&&m?{kind:e.engineKind,profile:e.engine?.profile??null,processId:m.processId,diagramPath:a,elements:idsOn$1(t),ask:(e,t)=>n=>i.askEngine(e,n,t??void 0,!0)}:null;return u(`div`,{class:`replay`,"data-testid":`replay`,children:[u(`header`,{class:`replay__bar`,children:[u(`button`,{type:`button`,class:`ui-button`,disabled:c.index===0,onClick:()=>c.go(-1),children:Y(`app.replay.previous`)}),u(`span`,{class:`type-body`,role:`status`,children:Y(`app.replay.position`,{number:c.index+1,total:h.steps.length})}),u(`button`,{type:`button`,class:`ui-button`,disabled:c.index>=h.steps.length-1,onClick:()=>c.go(1),children:Y(`app.replay.next`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:close,children:Y(`app.common.close`)})]}),h.truncated&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.replay.truncated`,{limit:h.steps.length})}),u(`p`,{class:`type-body replay__what`,children:[nameOf$6(t,g.elementId),` · `,Y(`app.replay.states.${g.state}`),g.durationMs===null?``:` · ${formatDuration(g.durationMs)}`]}),u(`ol`,{class:`replay__steps`,"aria-label":Y(`app.replay.steps`),children:h.steps.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row${e.index===c.index?` is-selected`:``}`,"aria-pressed":e.index===c.index,onClick:()=>c.select(e.index),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$6(t,e.elementId)}),u(`span`,{class:`diagram-check__row-where`,children:Y(`app.replay.states.${e.state}`)})]})},e.index))}),u(Variables$1,{step:g,replay:h}),h.incidents.length>0&&u(`ul`,{class:`diagram-check__note diagram-check__note--error`,"aria-label":Y(`app.replay.incidents`),children:h.incidents.map(e=>u(`li`,{children:[e.elementId,`: `,e.message]},`${e.elementId}:${e.message}`))}),u(`div`,{class:`replay__actions`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:_===null,title:Y(`app.replay.whatIf.tooltip`),onClick:()=>d(!0),children:Y(`app.replay.whatIf.open`)})}),f!==null&&u(`p`,{class:`diagram-check__note`,role:`status`,children:Y(`app.replay.whatIf.started`,{instance:f})}),l&&_&&u(WhatIfDialog,{bridge:i,source:_,step:g,onStarted:t=>{p(t),e.refresh()},onClose:()=>d(!1)})]})}function bridgeOf(){try{return G()}catch{return null}}function diagramOf(e){try{return e.getBpmnFilePath()}catch{return null}}function at$1(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}e(at$1,`at`);function HistorySection({live:e,modeler:t}){let n=(e.state?.processes??[]).find(e=>e.deployed&&e.key),r=useHistory(e,t),i=r.selected?bridgeOf():null;return n?u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.history`)}),r.asking&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.askingHistory`)}),r.problem&&u(`p`,{class:`diagram-check__note`,children:r.problem}),!r.asking&&!r.problem&&r.instances.length===0&&u(Z,{title:Y(`app.live.noFinishedInstances`),hint:Y(`app.live.noFinishedInstancesHint`)}),r.instances.length>0&&u(`ul`,{class:`diagram-check__list`,children:r.instances.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row${e.id===r.selected?` is-selected`:``}`,"aria-pressed":e.id===r.selected,onClick:()=>r.pick(e.id),children:[u(`span`,{class:`diagram-check__row-title`,children:e.businessKey??e.id}),u(`span`,{class:`diagram-check__row-where`,children:[e.businessKey?`${e.id} · `:``,at$1(e.startTime),` – `,at$1(e.endTime),` · `,formatDuration(e.durationMs),` · `,e.state.toLowerCase()]})]})},e.id))}),r.selected&&i&&u(ReplayPanel,{live:e,modeler:t,instance:r.selected,bridge:i,diagramPath:diagramOf(i),onClosed:()=>r.path&&showPath(t,r.path.steps,null)})]}):u(o,{})}var dd=`penstock-heat`,fd=`penstock-heat-`,pd=new WeakMap;function badgeText(e,t){return t===`count`?String(e.visits):t===`duration`?e.p95Ms===null?``:formatDuration(e.p95Ms):`${Math.round(e.failureRate*100)}%`}function titleOf$1(e){return Y(`app.heatmap.element.title`,{visits:e.visits,average:e.avgMs===null?Y(`app.heatmap.none`):formatDuration(e.avgMs),p95:e.p95Ms===null?Y(`app.heatmap.none`):formatDuration(e.p95Ms),incidents:e.incidents,canceled:e.canceled,rate:Math.round(e.failureRate*100)})}e(titleOf$1,`titleOf`);function clearHeat(e){if(!e||typeof e!=`object`)return;let t=pd.get(e)??[];pd.delete(e);try{let n=e.get(`canvas`);for(let e of t)for(let t=1;t<=4;t+=1)try{n?.removeMarker(e,`${fd}${t}`)}catch{}}catch{}try{e.get(`overlays`)?.remove?.({type:dd})}catch{}}function paintHeat(e,t,n){if(clearHeat(e),!e||typeof e!=`object`)return 0;let r,i,a;try{r=e.get(`canvas`),i=e.get(`elementRegistry`),a=e.get(`overlays`)}catch{return 0}if(!r||!i||!a)return 0;let o=levels$1(t,n),s=[];for(let e of t){let t=o.get(e.elementId);if(t===void 0)continue;let c=null;try{c=i.get(e.elementId)}catch{}if(c&&!c.waypoints)try{r.addMarker(e.elementId,`${fd}${t}`),s.push(e.elementId);let i=badgeText(e,n);if(i===``)continue;let o=document.createElement(`span`);o.className=`penstock-heat-badge penstock-heat-badge--${t}`,o.textContent=i,o.title=titleOf$1(e),a.add(e.elementId,dd,{position:badgePosition(c),html:o})}catch{}}return pd.set(e,s),s.length}async function unlocked(){try{return await G().requestFeature(U.HEATMAP)}catch{return!1}}function idsOn(e){let t=new Set;try{e?.get?.(`elementRegistry`)?.forEach?.(e=>{e?.id&&!e.waypoints&&!e.labelTarget&&t.add(String(e.id))})}catch{}return t}function useHeatmap(e,t,i={}){let[a,o]=n(`7d`),[c,u]=n(`duration`),[d,p]=n(null),[m,h]=n(`idle`),[g,_]=n(null),[v,y]=n(null),[b,x]=n(0),S=s(0),C=l(()=>(e?.state?.processes??[]).filter(e=>e.deployed).map(e=>e.processId),[e?.state]),w=d!==null&&C.includes(d)?d:C[0]??null,T=e?.ask,E=e?.engineKind,D=l(()=>g?idsOn(t):new Set,[g,t]),O=r(()=>{S.current+=1,clearHeat(t),_(null),y(null),x(0),h(`idle`)},[t]),k=r(async()=>{if(!T||!E||w===null)return;let e=S.current+=1;h(`loading`),y(null);try{if(!await(i.unlock??unlocked)()){S.current===e&&h(g?`ready`:`idle`);return}let n=await readHeatmap(E,w,a,T,i.now?.()??Date.now());if(S.current!==e)return;if(!n.ok){clearHeat(t),_(null),x(0),y(n.reason),h(`problem`);return}_(n.heatmap),h(`ready`)}catch(n){if(S.current!==e)return;clearHeat(t),_(null),x(0),y(n instanceof Error?n.message:String(n)),h(`problem`)}},[T,E,w,a,t,g,i.unlock,i.now]);f(()=>{g&&x(paintHeat(t,g.elements,c))},[g,c,t]),f(()=>()=>{S.current+=1,clearHeat(t)},[t]),f(()=>{O()},[w,O]);let A=r(e=>{try{focusDefect(t,[e])}catch{}},[t]);return{processes:C,processId:w,setProcessId:p,period:a,setPeriod:o,metric:c,setMetric:u,status:m,heatmap:g,problem:v,painted:b,slow:l(()=>g?slowest(g.elements,D):[],[g,D]),failing:l(()=>g?mostFailing(g.elements,D):[],[g,D]),load:k,clear:O,select:A}}var md=[`duration`,`count`,`failure`];function nameOf$5(e,t){try{let n=e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name;return typeof n==`string`&&n.trim()!==``?n.trim().slice(0,80):t}catch{return t}}e(nameOf$5,`nameOf`);function Row({element:e,detail:t,modeler:n,view:r}){return u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>r.select(e.elementId),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$5(n,e.elementId)}),u(`span`,{class:`diagram-check__row-where`,children:t})]})})}function HeatmapSection({live:e,modeler:t,options:n}){let r=useHeatmap(e,t,n);if(r.processes.length===0||!e?.ask)return u(o,{});let i=r.status===`loading`,a=r.heatmap;return u(`section`,{class:`diagram-check__group heatmap`,"data-testid":`heatmap`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.heatmap.heading`)}),u(`p`,{class:`diagram-check__note`,children:Y(`app.heatmap.intro`)}),u(`div`,{class:`heatmap__controls`,children:[r.processes.length>1&&u(`label`,{class:`heatmap__field`,children:[u(`span`,{class:`type-help`,children:Y(`app.heatmap.process`)}),u(`select`,{value:r.processId??``,onChange:e=>r.setProcessId(e.target.value),children:r.processes.map(e=>u(`option`,{value:e,children:e},e))})]}),u(`label`,{class:`heatmap__field`,children:[u(`span`,{class:`type-help`,children:Y(`app.heatmap.period`)}),u(`select`,{value:r.period,onChange:e=>{let t=e.target.value;isPeriod(t)&&r.setPeriod(t)},children:To.map(e=>u(`option`,{value:e,children:Y(`app.heatmap.periods.${e}`)},e))})]}),u(`label`,{class:`heatmap__field`,children:[u(`span`,{class:`type-help`,children:Y(`app.heatmap.metric`)}),u(`select`,{value:r.metric,onChange:e=>{let t=e.target.value;md.includes(t)&&r.setMetric(t)},children:md.map(e=>u(`option`,{value:e,children:Y(`app.heatmap.metrics.${e}`)},e))})]}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:i,onClick:()=>void r.load(),children:Y(i?`app.heatmap.loading`:a?`app.heatmap.reload`:`app.heatmap.show`)}),a&&u(`button`,{type:`button`,class:`ui-button`,disabled:i,onClick:r.clear,children:Y(`app.heatmap.hide`)})]}),r.problem!==null&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,role:`alert`,children:r.problem}),a&&u(`div`,{class:`heatmap__result`,role:`status`,children:[u(`p`,{class:`diagram-check__note`,children:Y(`app.heatmap.summary`,{rows:a.rows,painted:r.painted,period:Y(`app.heatmap.periods.${a.period}`)})}),a.versions>1&&u(`p`,{class:`diagram-check__note`,children:Y(`app.heatmap.versions`,{count:a.versions})}),a.truncated&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.heatmap.truncated`)}),a.rows===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.heatmap.empty`)}),r.slow.length>0&&u(o,{children:[u(`h4`,{class:`type-section-heading`,children:Y(`app.heatmap.slowest`)}),u(`ul`,{class:`diagram-check__list`,"aria-label":Y(`app.heatmap.slowest`),children:r.slow.map(e=>u(Row,{element:e,modeler:t,view:r,detail:Y(`app.heatmap.slowDetail`,{p95:formatDuration(e.p95Ms??0),average:formatDuration(e.avgMs??0),visits:e.visits})},e.elementId))})]}),r.failing.length>0&&u(o,{children:[u(`h4`,{class:`type-section-heading`,children:Y(`app.heatmap.failing`)}),u(`ul`,{class:`diagram-check__list`,"aria-label":Y(`app.heatmap.failing`),children:r.failing.map(e=>u(Row,{element:e,modeler:t,view:r,detail:Y(`app.heatmap.failDetail`,{rate:Math.round(e.failureRate*100),incidents:e.incidents,canceled:e.canceled,visits:e.visits})},e.elementId))})]})]})]})}function defaultProcessId(e,t){let n=t.state?.processes?.find(e=>e.deployed&&e.processId)?.processId??t.state?.processes?.[0]?.processId;if(n)return n;try{let t=e?.get?.(`canvas`)?.getRootElement?.()?.businessObject;if(t?.processRef?.id)return t.processRef.id;if(t?.$type===`bpmn:Process`&&t.id)return t.id;let n=e?.get?.(`elementRegistry`);if(n?.getAll){let e=n.getAll().find(e=>e?.type===`bpmn:Process`);if(e?.businessObject?.id)return e.businessObject.id}}catch{}return``}function StartInstance({live:e,modeler:t,onStarted:i}){let a=s(null),[c,l]=n(!1),[d,p]=n(``),[m,h]=n(`{}`),[g,_]=n(!1),[v,y]=n(null),b=w();f(()=>{c&&!d&&p(defaultProcessId(t,e))},[c,t,e,d]),f(()=>{if(!b)return;let handleTrigger=()=>{l(!0),y(null)};return window.addEventListener(`penstock:start-instance`,handleTrigger),()=>window.removeEventListener(`penstock:start-instance`,handleTrigger)},[b]);let x=va(m),S=x.ok?null:x.error,C=r(async()=>{if(!g&&d.trim()&&x.ok&&e.ask){_(!0),y(null);try{let t=e.engineKind??`CAMUNDA_8`,n=fa(t,d.trim(),x.variables,e.tenantId),r=await e.ask(n),a=_a(t,r);await e.refresh(),l(!1),i?.(a)}catch(e){let t=e instanceof Error?e.message:String(e);y(t)}finally{_(!1)}}},[g,d,x,e,i]),handleKeyDown=e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),C())};return u(o,{children:[u(`button`,{ref:a,type:`button`,class:`ui-button`,onClick:()=>{l(e=>!e),y(null)},title:Y(`app.live.startInstanceTooltip`),children:Y(`app.live.startInstanceEllipsis`)}),c&&u(mn,{anchor:a.current,label:Y(`app.live.startInstance`),onClose:()=>l(!1),width:352,class:`start-instance-popover`,children:[u(`h3`,{class:`ui-popover__title`,children:Y(`app.live.startInstance`)}),u(X,{label:Y(`app.live.processDefinition`),layout:`top`,children:e=>u(`input`,{...e,type:`text`,class:`ui-input`,value:d,onInput:e=>p(e.target.value)})}),u(X,{label:Y(`app.live.variablesJson`),hint:Y(`app.live.variablesHelp`),error:S,layout:`top`,children:e=>u(`textarea`,{...e,class:`ui-input`,value:m,onInput:e=>h(e.target.value),onKeyDown:handleKeyDown,rows:5})}),v&&u(`p`,{class:`ui-field__error`,children:v}),u(`div`,{class:`ui-popover__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,disabled:g,onClick:()=>l(!1),children:Y(`app.common.cancel`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:g||!d.trim()||!x.ok||!e.ask,onClick:()=>void C(),children:Y(g?`app.live.startingInstance`:`app.live.startInstance`)})]})]})]})}function useLiveUserTasks(e,t,i){let[a,o]=n([]),[c,l]=n(null),[u,d]=n(null),[p,m]=n(!1),[h,g]=n(null),[_,v]=n(!1),[y,b]=n(null),x=s(0),S=a.find(e=>e.id===c)??null,C=r(async()=>{let n=x.current+=1,isCurrent=()=>x.current===n;if(!e||!t)o([]),l(null),d(null),g(null);else{m(!0),g(null);try{let n=await t(listUserTasksCall(e,i??void 0));if(!isCurrent())return;let r=parseUserTasks(e,n);o(r),l(e=>e&&r.some(t=>t.id===e)?e:r[0]?.id??null)}catch(e){if(!isCurrent())return;o([]),l(null),g(e instanceof Error?e.message:Y(`app.live.unableToLoadTasks`))}finally{isCurrent()&&m(!1)}}},[e,t,i]);return f(()=>{C()},[C]),f(()=>{let n=!1;if(!e||!t||!S)d(null);else return(async()=>{try{if(e===`CAMUNDA_8`){let r=await t(readUserTaskCall(e,S.id));if(n)return;let i=parseUserTask(e,r);d({formKey:i?.formKey??S.formKey??null,schema:null});return}let r=await t(readTaskDeployedFormCall(S.id)).catch(()=>null);if(n)return;if(r&&r.status>=200&&r.status<300){let e=parseDeployedForm(r);if(e){d({formKey:S.formKey??`deployed_${S.id}`,schema:e});return}}let i=await t(readTaskFormKeyCall(S.id)).catch(()=>null);if(n)return;let a=i?parseTaskFormKey(i):null;d({formKey:a??S.formKey??null,schema:null})}catch{n||d({formKey:S.formKey??null,schema:null})}})(),()=>{n=!0}},[e,t,S?.id]),{tasks:a,selectedTaskId:c,selectedTask:S,details:u,loading:p,problem:h,completing:_,completingProblem:y,selectTask:l,completeTask:r(async n=>{if(!e||!t||!S)return!1;v(!0),b(null);try{let r=parseTaskCompletion(await t(completeUserTaskCall(e,S.id,n)));return r.ok?(await C(),!0):(b(r.problem??Y(`app.live.unableToCompleteTask`)),!1)}catch(e){return b(e instanceof Error?e.message:Y(`app.live.unableToCompleteTask`)),!1}finally{v(!1)}},[e,t,S,C]),refresh:C}}function LiveUserTasks({live:e,instanceId:t,modeler:r}){let[i,a]=n(null);f(()=>{let e=!1;return Vi(()=>import(`./FormStepView-CbHb32_8.js`).then(t=>{e||a(()=>t.FormStepView)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url),()=>{e=!0}},[]);let{tasks:s,selectedTaskId:c,selectedTask:d,details:p,problem:m,completing:h,completingProblem:g,selectTask:_,completeTask:v}=useLiveUserTasks(e.engineKind,e.ask,t),y=l(()=>{try{let e=r?.get?.(`canvas`)?.getRootElement?.(),t=e?.businessObject?.$parent??e?.businessObject??r?._definitions;return p?.schema&&p.formKey?{rootElements:[...t?.rootElements??[],{extensionElements:{values:[{$type:`UserTaskForm`,id:p.formKey,body:JSON.stringify(p.schema)}]}}]}:t}catch{return null}},[r,p?.schema,p?.formKey]),b=l(()=>({targets:{forms:new Map},context:{definitions:y}}),[y]),x=l(()=>({waiting:d?{kind:`userTask`,elementId:d.elementId,name:d.name??d.elementId}:null}),[d]),S=l(()=>d?{elementId:d.elementId,type:`bpmn:UserTask`,kind:`user`,name:d.name??d.elementId,number:1,text:d.name??d.elementId,issues:[],links:{form:p?.formKey??d.formKey??void 0},values:{role:`returns`,title:``,empty:``,rows:[]}}:null,[d,p?.formKey]);return!e.engineKind||!e.ask?u(o,{}):u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.userTasks`)}),m&&u(`p`,{class:`diagram-check__note`,children:m}),!m&&s.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.noUserTasksWaiting`)}),s.length>0&&u(`ul`,{class:`diagram-check__list`,children:s.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row${e.id===c?` is-selected`:``}`,"aria-pressed":e.id===c,onClick:()=>_(e.id),children:[u(`span`,{class:`diagram-check__row-title`,children:e.name??e.elementId}),u(`span`,{class:`diagram-check__row-where`,children:[e.id,e.assignee?` · ${e.assignee}`:``]})]})},e.id))}),d&&S&&(p?.formKey||p?.schema)&&i&&u(`div`,{class:`penstock-live-task-form`,children:u(i,{step:S,review:b,runs:x,onChange:()=>{},onComplete:e=>void v(e)})}),d&&!p?.formKey&&!p?.schema&&u(`div`,{class:`penstock-review__footer penstock-review__pad`,children:u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:h,onClick:()=>void v({}),children:Y(h?`app.live.completing`:`app.runs.complete`)})}),g&&u(`div`,{class:`penstock-review__pad`,children:u(cn,{children:g})})]})}function incidentKey(e){return e.id??e.instance}async function readDraft(e,t){let n=await readEvidence(e.kind,incidentKey(t),e.ask);if(!n.ok)return{ok:!1,reason:n.reason};let r=await e.xml();if(!r)return{ok:!1,reason:Y(`app.incident.dialog.noDiagram`)};let i=Fi(await On(r));return{ok:!0,drafted:{evidence:n.evidence,draft:buildScenario(n.evidence,i),file:xi(e.diagramPath)}}}async function saveScenario(e,t){let n=t.file.split(/[\\/]/).pop()??t.file,r=gi(await e.bridge.readFileIfPresent(t.file),[t.draft.testCase]);return`problem`in r?{problem:`${n}: ${r.problem}`}:r.added.length===0?{saved:!1,file:t.file}:(await e.bridge.saveFile(t.file,yi(r.file)),{saved:!0,file:t.file})}function context(e,t,n,r){return{engine:n,resources:t,runId:Kn(new Date),builds:r,stepTimeoutMs:e.stepTimeoutMs??15e3,...e.pollMs===void 0?{}:{pollMs:e.pollMs},...e.sleep?{sleep:e.sleep}:{},...e.now?{now:e.now}:{}}}async function prepared(e,t,n=`manual`){let r=await li(e.diagramPath,e.profile,e.bridge);if(!r)return{ok:!1,reason:await $r(e.diagramPath,e.profile,e.bridge)||Y(`app.incident.dialog.noEngine`)};if(n===`auto`&&!ci(r))return{ok:!1,reason:Y(`app.incident.fix.notTestEngine`)};let i=await Xr(r,void 0,e.bridge);return i?{ok:!1,reason:i}:{ok:!0,run:context(e,await ni(e.diagramPath,t,e.bridge),oi(r,e.diagramPath,e.bridge),ii(r))}}async function runScenario(e,t){let n=await e.xml();if(!n)return{ok:!1,reason:Y(`app.incident.dialog.noDiagram`)};let r=await prepared(e,n);return r.ok?{ok:!0,reproduction:await reproduceIncident(t,r.run)}:r}function verifierOf(e,t,n){let r=t.evidence.incident.elementId;return{file:n||e.diagramPath,element:r,async run(n,i){let a=await prepared(e,n,i);if(!a.ok)return{state:`unavailable`,element:r,reason:a.reason};let o=await verifyFix(t.draft.testCase,a.run);return o.verdict===`passes`?{state:`passes`,element:r}:o.verdict===`fails`?{state:`fails`,element:r,reason:o.message}:{state:`unavailable`,element:r,reason:o.message??``}}}}function promptOf(e,t){return fixPrompt({file:e.diagramPath.split(/[\\/]/).pop()??e.diagramPath,evidence:t.evidence,testCase:t.draft.testCase,notes:t.draft.notes})}var hd=20;async function targetOf(e){let t=await e.bridge.getDeployTargets(e.diagramPath),n=e.profile??t?.active??null,r=(t?.targets??[]).find(e=>(e?.profile??null)===n);return!r?.ready||!r.deployment||!Ci(String(r.engine))?null:r}function loopEffects(e){let{flow:t,drafted:n}=e,r=null,names=async e=>(await ni(t.diagramPath,e,t.bridge)).map(e=>({name:e.name,content:e.content})),i=t.diagramPath.split(/[\\/]/).pop()??t.diagramPath;return{async reproduce(){let e=await t.bridge.readFileIfPresent(t.diagramPath)??await t.xml();if(!e)return{verdict:`unavailable`,message:Y(`app.incident.dialog.noDiagram`)};let r=await runScenario({...t,xml:async()=>e},n.draft.testCase);return r.ok?r.reproduction.verdict===`reproduced`?{verdict:`reproduced`,message:``}:{verdict:r.reproduction.verdict===`skipped`?`unavailable`:`notReproduced`,message:r.reproduction.message??``}:{verdict:`unavailable`,message:r.reason}},async readFix(){let e=await t.xml();if(!e)return{ok:!1,reason:Y(`app.incident.dialog.noDiagram`)};let n=await t.bridge.readFileIfPresent(t.diagramPath);return n!==null&&n===e?{ok:!1,reason:Y(`app.incidentLoop.fix.noChange`,{file:i})}:{ok:!0,xml:e,label:i}},async applyFix(){},async restoreFix(){},async verify(r){let i=await verifierOf(t,n,e.file).run(r,`manual`);return i.state===`passes`?{verdict:`passes`,message:``}:i.state===`fails`?{verdict:`fails`,message:i.reason??``}:{verdict:`unavailable`,message:i.state===`unavailable`?i.reason:``}},async deploy(n,r){let i=await targetOf(t);if(!i||!i.deployment)return{state:`failed`,message:Y(`app.incident.dialog.noEngine`)};let a=await names(r);if(a.length===0)return{state:`failed`,message:Y(`app.incident.dialog.noDiagram`)};let o=await ye({engine:i.engine,ask:e=>t.bridge.askEngine(i.profile??null,e,t.diagramPath),tenantId:i.deployment.tenantId??null,files:a.map(e=>({path:e.name,text:e.content}))});if(o.send.length===0)return{state:`unchanged`,message:Y(`app.incidentLoop.deploy.nothing`)};let s=i.url??i.profile??`default`,c=o.send.slice(0,hd).join(`, `);if(n)return{state:`wouldSend`,message:Y(`app.incidentLoop.deploy.would`,{files:c,target:s})};let l=fe(i);if(l!==null&&!await e.confirm({title:Y(`app.incidentLoop.protected.title`),text:Y(`app.promotion.deploy.protectedNothingSent`,{name:l})+` `+Y(`app.incidentLoop.protected.text`,{name:l}),accept:Y(`app.incidentLoop.protected.accept`),warning:!0}))return{state:`refused`,message:Y(`app.promotion.deploy.protectedNothingSent`,{name:l})};let u=await R(i,a.filter(e=>o.send.includes(e.name)),t.diagramPath,void 0,t.bridge);return u.ok?{state:`sent`,message:Y(`app.incidentLoop.deploy.sent`,{files:c,target:s})}:{state:`failed`,message:u.message}},async retry(e){if(!r){let e=await planRetry(t.kind,n.evidence.incident,t.ask);if(!e.ok)return{state:`failed`,message:e.reason};r=e.plan}if(e)return{state:`wouldDo`,message:Y(`app.incidentLoop.retry.would`,{what:r.what})};let i=await runRetry(r,t.ask);return i.ok?{state:`done`,message:i.message}:{state:`failed`,message:i.reason}},async confirm(t,n){return t===`fix`||e.confirm({title:Y(`app.incidentLoop.steps.${t}`),text:n,accept:Y(t===`deploy`?`app.incidentLoop.deploy.accept`:`app.incidentLoop.retry.accept`),warning:!0})}}}function fresh$1(){return Object.fromEntries(Lo.map(e=>[e,{step:e,state:`pending`,text:``}]))}e(fresh$1,`fresh`);function LoopPanel({bridge:e,host:t}){let[r,i]=n(fresh$1),[a,o]=n(null),[c,l]=n(null),[d,p]=n(!1),m=s(!0),h=s(null);f(()=>(m.current=!0,()=>{m.current=!1,h.current?.abort()}),[]);let start=async n=>{if(!d){p(!0),o(null),l(null),i(fresh$1());try{let r=!1;try{r=await e.requestFeature(U.INCIDENT_LOOP)}catch{}if(!r)return;let a=new AbortController;h.current=a;let s=await runLoop(loopEffects({...t,confirm:t=>e.confirmWithUser({...t,decline:Y(`app.common.cancel`)})}),{apply:n,signal:a.signal,onLine:e=>{m.current&&i(t=>({...t,[e.step]:e}))}});m.current&&o(s)}catch(e){m.current&&l(e instanceof Error?e.message:String(e))}finally{h.current=null,m.current&&p(!1)}}};return u(`div`,{class:`incident-loop`,"data-testid":`incident-loop`,children:[u(`h3`,{class:`type-section-heading`,children:Y(`app.incidentLoop.title`)}),u(`p`,{class:`type-help`,children:Y(`app.incidentLoop.intro`)}),u(`ol`,{class:`incident-loop__steps`,"aria-label":Y(`app.incidentLoop.title`),children:Lo.map(e=>u(`li`,{class:`incident-loop__step incident-loop__step--${r[e].state}`,"data-step":e,"data-state":r[e].state,children:[u(`span`,{class:`type-body incident-loop__name`,children:Y(`app.incidentLoop.steps.${e}`)}),u(`span`,{class:`type-help incident-loop__state`,children:Y(`app.incidentLoop.states.${r[e].state}`)}),r[e].text!==``&&u(`span`,{class:`type-help incident-loop__text`,children:r[e].text})]},e))}),c!==null&&u(`p`,{class:`type-help`,role:`alert`,children:c}),a&&u(`p`,{class:`type-body`,role:`status`,"data-testid":`incident-loop-result`,children:a.ok?a.apply?Y(`app.incidentLoop.result.done`):Y(`app.incidentLoop.result.rehearsed`):Y(`app.incidentLoop.result.stopped`,{step:Y(`app.incidentLoop.steps.${a.stoppedAt??`verify`}`)})}),u(`div`,{class:`incident-loop__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,disabled:d,onClick:()=>void start(!1),children:Y(`app.incidentLoop.rehearse`)}),u(`button`,{type:`button`,class:`ui-button`,disabled:d,onClick:()=>void start(!0),children:Y(`app.incidentLoop.run`)}),d&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>h.current?.abort(),children:Y(`app.common.cancel`)})]})]})}function IncidentDialog({bridge:e,source:t,incident:r,assistant:i,onClose:a,timing:c}){let[l,d]=n(null),[p,m]=n(null),[h,g]=n(null),[_,v]=n(null),[y,b]=n(!1),[x,S]=n(!1),[C,w]=n(null),T=s(!0),D={bridge:e,ask:t.ask,kind:t.kind,profile:t.profile,diagramPath:t.diagramPath,xml:t.xml,...c};f(()=>(T.current=!0,readDraft(D,r).then(e=>{T.current&&(e.ok?d(e.drafted):m(e.reason))},e=>T.current&&m(e instanceof Error?e.message:String(e))),()=>{T.current=!1}),[]);let unlocked=async()=>{try{return await e.requestFeature(U.INCIDENT_SCENARIO)}catch{return!1}},guarded=async(e,t)=>{if(l&&!C){w(e),m(null);try{if(!await unlocked())return;await t()}catch(e){T.current&&m(e instanceof Error?e.message:String(e))}finally{T.current&&w(null)}}},save=async()=>{let e=await saveScenario(D,l);return`problem`in e?(m(e.problem),!1):(g(e.saved?Y(`app.incident.dialog.saved`,{file:e.file}):Y(`app.incident.dialog.alreadySaved`,{file:e.file})),!0)},saveAndRun=()=>guarded(`run`,async()=>{if(!h&&!await save())return;let e=await runScenario(D,l.draft.testCase);T.current&&(e.ok?e.reproduction.verdict===`reproduced`?v({kind:`reproduced`}):e.reproduction.verdict===`skipped`?v({kind:`notRun`,reason:e.reproduction.message??``}):v({kind:`notReproduced`,reason:e.reproduction.message??``}):v({kind:`notRun`,reason:e.reason}))}),proposeFix=()=>guarded(`fix`,async()=>{if(!i)return;let n=l,a=verifierOf(D,n,t.file),o=await i.send({onChat:e=>E(a,e),editor:t.editor,text:promptOf(D,n),context:{file:t.diagramPath,elementIds:[r.elementId]},authorize:()=>e.requestFeature(U.AI_CHAT)});T.current&&(o===`sent`||o===`queued`?b(!0):o===`failed`&&m(Y(`app.incident.dialog.chatFailed`)))}),O=_?.kind===`reproduced`,k=[{id:`cancel`,label:Y(y||h?`app.common.close`:`app.common.cancel`),role:`cancel`,onClick:a},...l&&h===null&&!O&&!y?[{id:`save`,label:Y(`app.incident.dialog.save`),role:`secondary`,disabled:C!==null,onClick:()=>void guarded(`save`,async()=>void await save())}]:[],...l&&!y&&!x?[{id:`loop`,label:Y(`app.incidentLoop.open`),role:`secondary`,disabled:C!==null,onClick:()=>S(!0)}]:[],...l&&!y?[O?{id:`fix`,label:Y(`app.incident.dialog.proposeFix`),role:`primary`,disabled:C!==null||i===null,title:i===null?Y(`app.incident.dialog.noChat`):void 0,onClick:()=>void proposeFix()}:{id:`run`,label:Y(h===null?`app.incident.dialog.saveAndRun`:`app.incident.dialog.run`),role:`primary`,disabled:C!==null,onClick:()=>void saveAndRun()}]:[]];return u(dn,{title:Y(`app.incident.dialog.title`),size:`medium`,initialFocus:`first`,backdrop:`keep`,onClose:a,footer:u(ln,{actions:k}),children:u(`div`,{class:`incident-dialog`,children:[u(`p`,{class:`type-help`,children:Y(`app.incident.dialog.intro`)}),!l&&p===null&&u(`p`,{class:`type-body`,role:`status`,children:Y(`app.incident.dialog.reading`)}),p!==null&&u(`p`,{class:`incident-dialog__problem type-help`,role:`alert`,children:p}),l&&u(o,{children:[u(`p`,{class:`type-body incident-dialog__what`,role:`status`,children:Y(`app.cli.incident.found`,{type:l.evidence.incident.type||Y(`app.incident.noType`),element:l.evidence.incident.elementId,process:l.evidence.incident.processId,instance:l.evidence.incident.instance})}),u(`p`,{class:`type-help incident-dialog__message`,children:l.evidence.incident.message}),u(`h3`,{class:`type-section-heading`,children:Y(`app.incident.dialog.steps`)}),u(`ol`,{class:`incident-dialog__steps`,"aria-label":Y(`app.incident.dialog.steps`),children:scenarioSteps(l.draft.testCase).map(e=>u(`li`,{class:`type-body`,children:e},e))}),l.draft.notes.length>0&&u(`ul`,{class:`incident-dialog__notes type-help`,"aria-label":Y(`app.incident.dialog.notes`),children:l.draft.notes.map(e=>u(`li`,{children:e},e))}),h!==null&&u(`p`,{class:`incident-dialog__saved type-help`,role:`status`,children:h}),_&&u(`p`,{class:`incident-dialog__verdict incident-dialog__verdict--${_.kind} type-body`,role:`status`,"data-testid":`incident-verdict`,children:_.kind===`reproduced`?Y(`app.cli.incident.reproduced`):_.kind===`notReproduced`?Y(`app.cli.incident.notReproduced`,{reason:_.reason}):Y(`app.cli.incident.notRun`,{reason:_.reason})}),x&&u(LoopPanel,{bridge:e,host:{flow:D,drafted:l,file:t.file}}),y&&u(`p`,{class:`incident-dialog__sent type-body`,role:`status`,children:Y(`app.incident.dialog.sent`)})]})]})})}function useAssistantStore(){let[e]=n(()=>xa());return e}function isUserTaskElement(e,t){if(!t)return!1;try{let n=e?.get?.(`elementRegistry`)?.get?.(t);return n?.type===`bpmn:UserTask`||n?.businessObject?.$type===`bpmn:UserTask`}catch{return!1}}function nameOf$4(e,t){try{return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}catch{return t}}e(nameOf$4,`nameOf`);function safeFocus(e,t){try{focusDefect(e,t)}catch{}}function shown$1(e){if(e==null)return`null`;if(typeof e==`string`)return e;let t;try{t=JSON.stringify(e)}catch{t=String(e)}return t.length>120?`${t.slice(0,117)}...`:t}e(shown$1,`shown`);function at(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function InstanceSection({live:e,trial:t,where:n,onOpenTasklist:r,cancellingId:i,cancelErrors:a,onCancelInstance:s}){let c=(e.state?.processes??[]).find(e=>e.deployed&&e.key);return c?u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.instance`)}),t.askingInstances&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.askingWhichInstancesRun`,{where:n,process:c.processId})}),t.instancesProblem&&u(`p`,{class:`diagram-check__note`,children:t.instancesProblem}),!t.askingInstances&&!t.instancesProblem&&t.instances.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.noInstanceRunning`,{process:c.processId,where:n})}),t.instances.length>0&&u(`ul`,{class:`diagram-check__list`,children:t.instances.map(n=>{let o=tasklistUrl(e.engine?.kind,e.engine?.url,{instanceId:n.key});return u(`li`,{children:[u(`div`,{class:`penstock-live-row`,children:[u(`button`,{type:`button`,class:`diagram-check__row${n.key===t.instance?` is-selected`:``}`,"aria-pressed":n.key===t.instance,onClick:()=>t.pick(n.key),children:[u(`span`,{class:`diagram-check__row-title`,children:n.businessKey??n.key}),u(`span`,{class:`diagram-check__row-where`,children:[n.businessKey?`${n.key} · `:``,at(n.started),` `,n.state?.toLowerCase?.()??``]})]}),o&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>r(o),title:Y(`app.live.openInTasklist`),children:Y(`app.live.openInTasklist`)}),t.pickable&&u(`button`,{type:`button`,class:`ui-button`,disabled:i===n.key,onClick:()=>s(n.key),title:Y(`app.live.cancelInstance`),children:i===n.key?Y(`app.live.cancelling`):Y(`app.live.cancelInstance`)})]}),a[n.key]&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.live.unableToCancelInstance`,{reason:a[n.key]})})]},n.key)})})]}):u(o,{})}function TrialSection({trial:e,modeler:t,selected:n}){let r=e.selectedExpressions,i=e.support;return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.tryOnInstance`)}),i?.evaluation&&r.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.selectATaskToTryOn`,{instance:e.instance})}),i?.evaluation&&r.length>0&&u(`ul`,{class:`diagram-check__list`,children:r.map(t=>{let n=e.results.get(t.expression);return u(`li`,{children:[u(`div`,{class:`penstock-live-row`,children:[u(`span`,{class:`penstock-live-expr`,title:`${t.label} - ${t.where}`,children:t.expression}),u(`button`,{type:`button`,class:`ui-button`,disabled:e.trying!==null,onClick:()=>void e.tryOn(t.expression),children:e.trying===t.expression?Y(`app.live.trying`):Y(`app.live.try`)})]}),n&&u(`p`,{class:`penstock-live-outcome`,children:resultText(n.outcome)}),n?.outcome.warnings.map(e=>u(`p`,{class:`penstock-live-outcome penstock-live-outcome--warning`,children:e},e))]},`${t.elementId}:${t.expression}`)})}),i&&!i.evaluation&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.sevenCannotEvaluateHere`)}),e.variables&&u(`ul`,{class:`diagram-check__list`,children:Object.entries(e.variables).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>u(`li`,{class:`penstock-live-variable`,children:[u(`span`,{class:`penstock-live-name`,children:e}),u(`span`,{class:`penstock-live-value`,title:shown$1(t),children:shown$1(t)})]},e))}),u(`div`,{class:`monitor__block`,children:[u(`button`,{type:`button`,class:`ui-button`,disabled:e.readingVariables,onClick:()=>void e.readVariables(),children:e.readingVariables?Y(`app.live.reading`):Y(`app.live.readTheVariables`)}),n&&u(`button`,{type:`button`,class:`diagram-check__link`,title:Y(`app.live.showOnTheDiagram`,{selected:nameOf$4(t,n)}),onClick:()=>safeFocus(t,[n]),children:Y(`app.live.select`,{name:nameOf$4(t,n)})})]}),e.variablesProblem&&u(`p`,{class:`diagram-check__note`,children:e.variablesProblem})]})}function ContractSection({trial:e,modeler:t}){let n=e.contract;return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.variables`)}),n&&n.neverSet.length===0&&n.unused.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.theModelAndTheEngineAgree`)}),n&&n.neverSet.length>0&&u(o,{children:[u(`p`,{class:`monitor__label`,children:Y(`app.live.neverSetInProduction`)}),u(`ul`,{class:`diagram-check__list`,children:n.neverSet.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>safeFocus(t,[e.elements[0].elementId]),children:[u(`span`,{class:`diagram-check__row-title`,children:e.name}),u(`span`,{class:`diagram-check__row-where`,children:e.elements.map(e=>`${nameOf$4(t,e.elementId)} · ${e.where}`).join(`, `)})]})},e.name))})]}),n&&n.unused.length>0&&u(o,{children:[u(`p`,{class:`monitor__label`,children:Y(`app.live.unusedInTheModel`)}),u(`p`,{class:`diagram-check__note`,children:Y(`app.live.theEngineHasSeenThese`)}),u(`ul`,{class:`monitor__names`,children:n.unused.map(e=>u(`li`,{class:`monitor__name`,children:e.name},e.name))})]}),!n&&u(`div`,{class:`monitor__block`,children:u(`button`,{type:`button`,class:`ui-button`,disabled:e.askingNames,onClick:()=>void e.readNames(),children:e.askingNames?Y(`app.live.asking`):Y(`app.live.compareWithWhatTheEngine`)})}),e.namesProblem&&u(`p`,{class:`diagram-check__note`,children:e.namesProblem}),e.namesWhy&&!e.namesProblem&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.thisNeedsCamunda`,{version:e.namesWhy})})]})}function MonitorTab({live:e,trial:t,modeler:r,hasImplementation:i,onOpenImplementation:a,onConnect:o,onOpenTasklist:s,onStartInstance:c,scenario:l}){let d=useAssistantStore(),[f,p]=n(null),[m,h]=n(null),[g,_]=n({}),[v,y]=n(null),[b,x]=n({}),[S,C]=n(null),[w,T]=n(``),[E,D]=n(``),[O,k]=n(``),[A,j]=n(null),[M,N]=n(!1),[P,F]=n(null),[I,L]=n(``),[R,z]=n(``),[B,V]=n(null),[H,U]=n(!1),W=e.state,ee=e.engine?engineLabel(e.engine.kind,e.engine.profile,e.engine.url):null,K=(W?.processes??[]).filter(e=>!e.deployed),te=versionText(W?.processes??[]),ne=groupIncidents(W?.incidents??[]),re=(W?.processes??[]).flatMap(e=>{let t=e?.elements;return!t||typeof t[Symbol.iterator]!=`function`?[]:[...t].filter(([,e])=>e&&Number(e.waiting)>Number(e.incidents)).map(([e,t])=>({id:e,count:Number(t.waiting)-Number(t.incidents)}))}),ie=s??(e=>{try{G().openExternalLink(e)}catch{}}),ae=tasklistUrl(e.engine?.kind,e.engine?.url),handleCancelInstance=async t=>{if(e.ask&&e.engineKind&&await G().confirmWithUser({title:Y(`app.live.cancelInstanceTitle`),text:Y(`app.live.cancelInstanceConfirm`,{instance:t}),accept:Y(`app.live.cancelInstance`),decline:Y(`app.common.cancel`),warning:!0})){y(t);try{let n=cancelInstanceCall(e.engineKind,t),r=parseEngineAnswer(await e.ask(n));r.ok?(x(e=>{let n={...e};return delete n[t],n}),e.refresh()):x(e=>({...e,[t]:r.problem??String(r.status)}))}catch(e){x(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}finally{y(null)}}},handleRetryIncident=async t=>{if(e.ask&&e.engineKind===`CAMUNDA_8`){h(t);try{let n=retryIncidentCall(t),r=parseEngineAnswer(await e.ask(n));r.ok?(_(e=>{let n={...e};return delete n[t],n}),e.refresh()):_(e=>({...e,[t]:r.problem??String(r.status)}))}catch(e){_(n=>({...n,[t]:e instanceof Error?e.message:String(e)}))}finally{h(null)}}},handleSendMessage=async()=>{if(!e.ask||!e.engineKind||!w.trim())return;let t;if(O.trim())try{t=JSON.parse(O)}catch(e){j(e instanceof Error?e.message:String(e));return}N(!0);try{let n=publishMessageCall(e.engineKind,{name:w.trim(),correlationKey:E.trim()||void 0,variables:t,tenantId:e.tenantId}),r=parseEngineAnswer(await e.ask(n));r.ok?(C(null),T(``),D(``),k(``),j(null),e.refresh()):j(r.problem??String(r.status))}catch(e){j(e instanceof Error?e.message:String(e))}finally{N(!1)}},handleBroadcastSignal=async()=>{if(!e.ask||!e.engineKind||!I.trim())return;let t;if(R.trim())try{t=JSON.parse(R)}catch(e){V(e instanceof Error?e.message:String(e));return}U(!0);try{let n=broadcastSignalCall(e.engineKind,{name:I.trim(),variables:t,tenantId:e.tenantId}),r=parseEngineAnswer(await e.ask(n));r.ok?(F(null),L(``),z(``),V(null),e.refresh()):V(r.problem??String(r.status))}catch(e){V(e instanceof Error?e.message:String(e))}finally{U(!1)}};if(!e.engine)return e.asking?u(Z,{title:Y(`app.live.askingTheEngine`),hint:Y(`app.live.readingWhichInstancesOfThis`)}):u(Z,{title:Y(`app.live.noEngineConnected`),hint:Y(`app.live.setUpADeploymentProfile`),guide:`monitor`,actions:[{label:Y(`app.deploy.setUpConnection`),run:o}]});let oe=W&&!W.problem&&ne.length===0&&re.length===0&&K.length===0;return u(`div`,{class:`monitor`,children:[u(`header`,{class:`problems__bar problems__bar--wrap`,children:[u(`span`,{class:`problems__count`,children:W&&!W.problem?[ee,...te].join(` · `):ee}),u(StartInstance,{live:e,modeler:r,onStarted:c}),t.pickable&&u(`button`,{id:`monitor-send-message`,type:`button`,class:`ui-button`,onClick:e=>{C(S?null:e.currentTarget),F(null)},title:Y(`app.live.sendMessage`),children:Y(`app.live.sendMessage`)}),t.pickable&&u(`button`,{id:`monitor-broadcast-signal`,type:`button`,class:`ui-button`,onClick:e=>{F(P?null:e.currentTarget),C(null)},title:Y(`app.live.broadcastSignal`),children:Y(`app.live.broadcastSignal`)}),ae&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>ie(ae),title:Y(`app.live.openInTasklist`),children:Y(`app.live.openInTasklist`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:e.refresh,disabled:e.asking,title:Y(`app.live.askTheEngineAgain`),children:e.asking?Y(`app.live.asking`):Y(`app.live.refresh`)})]}),W?.problem&&u(Z,{title:Y(`app.live.theEngineCouldNotBe`),hint:W.problem,actions:[{label:Y(`app.live.refresh`),run:e.refresh}]}),!W&&u(Z,{title:Y(`app.live.askingTheEngine`),hint:Y(`app.live.readingWhichInstancesOfThis`)}),K.map(e=>u(Z,{title:Y(`app.live.isNotDeployed`,{processId:e.processId}),hint:Y(`app.live.itIsNotOnYet`,{where:ee})},e.processId)),oe&&u(Z,{title:Y(`app.live.noInstanceIsRunning`),hint:Y(`app.live.nothingIsWaitingOrHas`,{where:ee}),guide:`monitor`}),ne.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.incidents`)}),u(`ul`,{class:`diagram-check__list`,children:ne.map(n=>{let o=n.id??n.instance;return u(`li`,{children:[u(`div`,{class:`penstock-live-row`,children:[u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>safeFocus(r,[n.elementId]),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$4(r,n.elementId)}),u(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,title:n.message,children:incidentLine(n)})]}),o&&e.engineKind===`CAMUNDA_8`&&t.pickable&&u(`button`,{type:`button`,class:`ui-button`,disabled:m===o,onClick:()=>void handleRetryIncident(o),title:Y(`app.live.retryIncident`),children:Y(m===o?`app.live.retrying`:`app.live.retry`)}),n.instance&&t.pickable&&u(`button`,{type:`button`,class:`ui-button`,disabled:v===n.instance,onClick:()=>void handleCancelInstance(n.instance),title:Y(`app.live.cancelInstance`),children:v===n.instance?Y(`app.live.cancelling`):Y(`app.live.cancelInstance`)}),n.instance&&t.pickable&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>t.pick(n.instance),title:Y(`app.live.useThisInstanceForAn`),children:Y(`app.live.use`)}),l&&e.ask&&e.engineKind&&o&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>p(n),title:Y(`app.incident.reproduceHint`),children:Y(`app.incident.reproduce`)}),i(n.elementId)&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>a(n.elementId),title:Y(`app.live.openTheCodeThatRuns`),children:Y(`app.code.goToCode`)})]}),o&&g[o]&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.live.unableToRetryIncident`,{reason:g[o]})}),n.instance&&b[n.instance]&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.live.unableToCancelInstance`,{reason:b[n.instance]})})]},`${n.elementId}:${n.message}`)})})]}),re.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.live.waiting`)}),u(`ul`,{class:`diagram-check__list`,children:re.map(t=>{let n=isUserTaskElement(r,t.id)?tasklistUrl(e.engine?.kind,e.engine?.url,{elementId:t.id}):null;return u(`li`,{class:n?`penstock-live-row`:void 0,children:[u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>safeFocus(r,[t.id]),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$4(r,t.id)}),u(`span`,{class:`diagram-check__row-where`,children:Y(`app.live.instancesHere`,{count:t.count})})]}),n&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>ie(n),title:Y(`app.live.openInTasklist`),children:Y(`app.live.openInTasklist`)})]},t.id)})})]}),u(InstanceSection,{live:e,trial:t,where:ee,onOpenTasklist:ie,cancellingId:v,cancelErrors:b,onCancelInstance:handleCancelInstance}),t.instance&&u(LiveUserTasks,{live:e,instanceId:t.instance,modeler:r}),t.instance&&u(TrialSection,{trial:t,modeler:r,selected:t.selected}),t.support?.names&&u(ContractSection,{trial:t,modeler:r}),u(HistorySection,{live:e,modeler:r}),u(HeatmapSection,{live:e,modeler:r}),S&&u(mn,{anchor:S,label:Y(`app.live.sendMessage`),onClose:()=>C(null),width:320,children:[u(`h3`,{class:`ui-popover__title`,children:Y(`app.live.sendMessage`)}),u(X,{label:Y(`app.live.messageName`),children:e=>u(`input`,{...e,type:`text`,value:w,onInput:e=>T(e.target.value)})}),u(X,{label:Y(`app.live.correlationKey`),children:e=>u(`input`,{...e,type:`text`,value:E,onInput:e=>D(e.target.value)})}),u(X,{label:Y(`app.live.variablesJson`),children:e=>u(`input`,{...e,type:`text`,value:O,onInput:e=>k(e.target.value)})}),A&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.live.unableToSendMessage`,{reason:A})}),u(`div`,{class:`ui-popover__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>C(null),children:Y(`app.common.cancel`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:!w.trim()||M,onClick:()=>void handleSendMessage(),children:Y(M?`app.live.sending`:`app.live.send`)})]})]}),P&&u(mn,{anchor:P,label:Y(`app.live.broadcastSignal`),onClose:()=>F(null),width:320,children:[u(`h3`,{class:`ui-popover__title`,children:Y(`app.live.broadcastSignal`)}),u(X,{label:Y(`app.live.signalName`),children:e=>u(`input`,{...e,type:`text`,value:I,onInput:e=>L(e.target.value)})}),u(X,{label:Y(`app.live.variablesJson`),children:e=>u(`input`,{...e,type:`text`,value:R,onInput:e=>z(e.target.value)})}),B&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.live.unableToBroadcastSignal`,{reason:B})}),u(`div`,{class:`ui-popover__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>F(null),children:Y(`app.common.cancel`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:!I.trim()||H,onClick:()=>void handleBroadcastSignal(),children:Y(H?`app.live.broadcasting`:`app.live.broadcast`)})]})]}),f&&l&&e.ask&&e.engineKind&&u(IncidentDialog,{bridge:G(),source:{ask:e.ask,kind:e.engineKind,profile:e.engine.profile,diagramPath:l.diagramPath,file:l.file,xml:l.xml,editor:l.editor},incident:f,assistant:d,onClose:()=>p(null)}),e.at&&e.engine.url&&u(`p`,{class:`diagram-check__note`,children:Y(`app.live.urlAt`,{url:e.engine.url,when:e.at})})]})}function useLive(e,t){let[i,a]=n(null),[o,c]=n(null),[l,u]=n(null),[d,p]=n(null),[m,h]=n(null),[g,_]=n(!1),[v,y]=n(null),b=s(0);f(()=>()=>{b.current+=1},[]);let x=r(()=>{let e=b.current+=1,mineStill=()=>b.current===e,n;try{n=G()}catch(e){mineStill()&&(a({processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}),_(!1));return}_(!0);try{Promise.resolve(n?.getDeployTargets?.()).then(async e=>{if(!mineStill())return;let r=(Array.isArray(e?.targets)?e.targets:[]).find(t=>(t?.profile??null)===(e?.active??null));if(!r?.ready||!Ci(String(r.engine))){c(null),u(null),p(null),a(null);return}let i=r.profile??null,asker=e=>typeof n?.askEngine==`function`?n.askEngine(i,e):Promise.reject(Error(`no askEngine`));c({profile:i,url:r.url??null,kind:String(r.engine)}),u(r.engine),h(r.deployment?.tenantId||null),p(()=>asker);let o=[];try{o=typeof t==`function`?t():[]}catch{o=[]}let s=await readLive(r.engine,o,asker);mineStill()&&(a(s),y(new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})))}).catch(e=>{mineStill()&&(c(null),u(null),p(null),a({processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}))}).finally(()=>mineStill()&&_(!1))}catch(e){mineStill()&&(c(null),u(null),p(null),a({processes:[],incidents:[],problem:e instanceof Error?e.message:String(e)}),_(!1))}},[t]);return f(()=>{e&&x()},[e,x]),{state:i,engine:o,engineKind:l,tenantId:m,ask:d,asking:g,at:v,refresh:x}}var gd=`penstock-live`;function clearBadges$1(e){try{e?.get?.(`overlays`)?.remove?.({type:gd})}catch{}}e(clearBadges$1,`clearBadges`);function showBadges$1(e,t){if(clearBadges$1(e),!e||!t)return;let n,r;try{n=e.get(`elementRegistry`),r=e.get(`overlays`)}catch{return}n&&r&&(t.state?.processes??[]).forEach(e=>{let t=e?.elements;t&&typeof t.forEach==`function`&&t.forEach((e,t)=>{try{if(!n.get(t)||!e)return;let i=Number(e.waiting)||0,a=Number(e.incidents)||0;if(i===0&&a===0)return;let o=document.createElement(`div`);if(o.className=`penstock-live-badges`,i>a){let e=document.createElement(`span`);e.className=`penstock-live-badge`,e.textContent=String(i-a),e.title=Y(`app.live.waitingHere`,{waiting:i-a}),o.appendChild(e)}if(a>0){let e=document.createElement(`span`);e.className=`penstock-live-badge penstock-live-badge--incident`,e.textContent=String(a),e.title=Y(`app.live.incidentsBadge`,{count:a}),o.appendChild(e)}r.add(t,gd,{position:badgePosition(n.get(t)),html:o})}catch{}})})}e(showBadges$1,`showBadges`);function useLiveBadges(e,t,n){f(()=>{if(n&&e)return showBadges$1(e,t),()=>clearBadges$1(e)},[e,t?.state,n])}function textOf$1(e){try{return JSON.stringify(e)??`null`}catch{return String(e)}}e(textOf$1,`textOf`);function rowsOf(e){return Object.entries(e).map(([e,t])=>({name:e,text:textOf$1(t),fixed:!0}))}function collect$1(e){let t={},n={};return e.forEach((e,r)=>{let i=e.name.trim();if(i!==``)try{Object.defineProperty(t,i,{value:JSON.parse(e.text),enumerable:!0,writable:!0,configurable:!0})}catch{n[r]=Y(`app.processDebug.invalidValue`,{name:i})}}),{variables:t,errors:n}}e(collect$1,`collect`);function focus(e,t){try{focusDefect(e,[t])}catch{}}function Variables({debug:e,rows:t,setRows:n,errors:r}){return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.processDebug.variables`)}),u(`p`,{class:`type-help`,children:Y(`app.processDebug.variablesHint`)}),t.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.processDebug.noVariables`)}),u(`ul`,{class:`process-debug__variables`,children:t.map((e,i)=>u(`li`,{class:`process-debug__variable`,children:[u(`input`,{type:`text`,class:`ui-input process-debug__name`,"aria-label":Y(`app.processDebug.variableName`),value:e.name,readOnly:e.fixed,placeholder:Y(`app.processDebug.variableName`),onInput:e=>n(t.map((t,n)=>n===i?{...t,name:e.target.value}:t))}),u(`input`,{type:`text`,class:`ui-input process-debug__value`,"aria-label":Y(`app.processDebug.variableValue`,{name:e.name}),"aria-invalid":r[i]?!0:void 0,value:e.text,placeholder:Y(`app.processDebug.variableValueHint`),onInput:e=>n(t.map((t,n)=>n===i?{...t,text:e.target.value}:t))}),r[i]&&u(`p`,{class:`ui-field__error process-debug__error`,children:r[i]})]},i))}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>n([...t,{name:``,text:``,fixed:!1}]),children:Y(`app.processDebug.addVariable`)}),e.problem&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:e.problem})]})}function Breakpoints({debug:e,modeler:t}){return u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.processDebug.breakpoints`)}),e.breakpoints.length===0&&u(`p`,{class:`diagram-check__note`,children:Y(`app.processDebug.noBreakpoints`)}),u(`ul`,{class:`diagram-check__list`,children:e.breakpoints.map(n=>u(`li`,{class:`penstock-live-row`,children:[u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>focus(t,n),children:[u(`span`,{class:`diagram-check__row-title`,children:e.nameOf(n)}),u(`span`,{class:`diagram-check__row-where`,children:n})]}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.toggle(n),"aria-label":Y(`app.processDebug.removeBreakpoint`,{element:e.nameOf(n)}),children:Y(`app.processDebug.remove`)})]},n))}),u(`button`,{type:`button`,class:`ui-button`,disabled:!e.canToggle,onClick:e.toggleSelected,children:Y(`app.processDebug.toggleOnSelection`)})]})}function Cleanup({debug:e}){let t=e.snapshot;return!t||t.cleanup===`none`?null:t.cleanup===`pending`?u(`p`,{class:`diagram-check__note`,children:Y(`app.processDebug.cleanupPending`)}):t.cleanup===`done`?u(`p`,{class:`diagram-check__note`,children:Y(`app.processDebug.cleanupDone`,{copy:t.debugProcessId??``})}):u(`section`,{class:`diagram-check__group`,role:`alert`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.processDebug.cleanupFailed`)}),u(`ul`,{class:`diagram-check__list`,children:t.cleanupProblems.map(e=>u(`li`,{class:`diagram-check__note diagram-check__note--error`,children:e},e))}),t.leftover&&u(`p`,{class:`diagram-check__note`,children:Y(`app.processDebug.leftOnTheEngine`,{deployment:t.leftover.deployment})}),u(`button`,{type:`button`,class:`ui-button`,onClick:e.retryCleanup,children:Y(`app.processDebug.tryAgain`)})]})}function DebugTab({debug:e,modeler:t,onConnect:r}){let i=e.snapshot,a=i?.phase??`idle`,s=a===`paused`,[c,l]=n([]),[d,p]=n({});if(f(()=>{l(rowsOf(i?.phase===`paused`?i.variables:{})),p({})},[i?.phase===`paused`?i.variables:null,i?.element]),!e.target)return e.checking?u(Z,{title:Y(`app.live.askingTheEngine`),hint:Y(`app.processDebug.checkingTheEngine`)}):u(Z,{title:Y(`app.processDebug.noEngine`),hint:e.targetProblem||Y(`app.processDebug.noEngineHint`),actions:[{label:Y(`app.deploy.setUpConnection`),run:r}]});let proceed=t=>{let{variables:n,errors:r}=collect$1(c);p(r),Object.keys(r).length>0||(t?e.stepOver(n):e.resume(n))},m=a===`deploying`||a===`running`||s,h=e.target.url??e.target.profile??``,g=i?.element??null;return u(`div`,{class:`monitor process-debug`,children:[u(`header`,{class:`problems__bar`,children:[u(`span`,{class:`problems__count`,children:[Y(`app.processDebug.state.${a}`),h?` · ${h}`:``]}),!m&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:e.starting||e.processId===``||e.variablesError!==null,onClick:()=>e.start(!1),children:e.starting?Y(`app.processDebug.starting`):Y(`app.processDebug.start`)}),u(`button`,{type:`button`,class:`ui-button`,disabled:e.starting||e.processId===``||e.variablesError!==null,onClick:()=>e.start(!0),children:Y(`app.processDebug.startAndStep`)})]}),s&&u(o,{children:[u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>proceed(!1),children:Y(`app.processDebug.continue`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>proceed(!0),children:Y(`app.processDebug.step`)})]}),m&&u(`button`,{type:`button`,class:`ui-button`,onClick:e.stop,children:Y(`app.processDebug.stop`)})]}),u(`p`,{class:`type-help process-debug__note`,children:Y(`app.processDebug.copyNote`,{copy:e.copyId||Y(`app.processDebug.copyIdFallback`)})}),a===`idle`&&u(Z,{title:Y(`app.processDebug.emptyTitle`),hint:Y(`app.processDebug.emptyHint`)}),s&&g&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:i?.atBreakpoint?Y(`app.processDebug.pausedAtBreakpoint`):Y(`app.processDebug.pausedAtStep`)}),u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>focus(t,g),children:[u(`span`,{class:`diagram-check__row-title`,children:e.nameOf(g)}),u(`span`,{class:`diagram-check__row-where`,children:g})]})]}),(a===`running`||a===`deploying`)&&u(`p`,{class:`diagram-check__note`,role:`status`,children:a===`deploying`?Y(`app.processDebug.deploying`):i?.waiting?Y(`app.processDebug.waiting`):Y(`app.processDebug.runningNote`,{count:i?.visited??0})}),(a===`finished`||a===`failed`||a===`stopped`)&&i?.message&&u(`p`,{class:`diagram-check__note${a===`failed`?` diagram-check__note--error`:``}`,role:a===`failed`?`alert`:`status`,children:i.message}),s&&u(Variables,{debug:e,rows:c,setRows:l,errors:d}),!m&&u(`section`,{class:`diagram-check__group`,children:[e.processIds.length>1&&u(X,{label:Y(`app.processDebug.process`),layout:`top`,children:t=>u(`select`,{...t,value:e.processId,onChange:t=>e.setProcessId(t.target.value),children:e.processIds.map(e=>u(`option`,{value:e,children:e},e))})}),e.processIds.length===0&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:Y(`app.processDebug.problem.noProcess`)}),u(X,{label:Y(`app.processDebug.startVariables`),hint:Y(`app.processDebug.startVariablesHint`),error:e.variablesError,layout:`top`,children:t=>u(`textarea`,{...t,rows:4,value:e.variablesText,onInput:t=>e.setVariablesText(t.target.value)})}),e.problem&&e.variablesError===null&&u(`p`,{class:`diagram-check__note diagram-check__note--error`,children:e.problem})]}),u(Breakpoints,{debug:e,modeler:t}),u(Cleanup,{debug:e})]})}var _d=`penstock-covered`,vd=`penstock-not-covered`;function union(e){return{elements:new Set(e.flatMap(e=>[...e.elements])),flows:new Set(e.flatMap(e=>[...e.flows]))}}function processOf(e){let t=e?.$parent;for(;t;){if(t.$instanceOf?.(`bpmn:Process`))return t.id;t=t.$parent}return null}function processIdsOf$1(e){return(e?.getDefinitions?.()?.rootElements??[]).filter(e=>e.$instanceOf?.(`bpmn:Process`)).map(e=>e.id)}e(processIdsOf$1,`processIdsOf`);function executableProcessIds(e){return e.filter(e=>e.isExecutable!==!1).map(e=>e.id)}function executableProcessIdsOf(e){let t=e?.getDefinitions?.();return executableProcessIds((t?.rootElements??[]).filter(e=>e.$instanceOf?.(`bpmn:Process`)))}function reachOf(e,t){let n=t.flatMap(t=>{let n=e?.reach.get(t);return n?[n]:[]});if(n.length===0)return null;let r=[...new Set(n.flatMap(e=>[...e.tests.keys()]))].sort();return{processIds:n.map(e=>e.processId),all:union(n.map(e=>e.all)),tests:r.map(e=>({name:e,reach:union(n.flatMap(t=>{let n=t.tests.get(e);return n?[n]:[]}))}))}}function countable$1(e,t){let n=e?.get?.(`elementRegistry`);return n?n.filter(e=>{let n=e.businessObject;return e.labelTarget||!n||e.type===`label`||!n.$instanceOf?.(`bpmn:FlowNode`)&&n.$type!==`bpmn:SequenceFlow`?!1:t.includes(processOf(n)??``)}):[]}e(countable$1,`countable`);function isReached(e,t){return e.businessObject.$type===`bpmn:SequenceFlow`?t.flows.has(e.id):t.elements.has(e.id)}function tally(e,t,n){let r=countable$1(e,t),i=r.filter(e=>isReached(e,n)),a=r.filter(e=>!isReached(e,n)&&e.businessObject.$type!==`bpmn:SequenceFlow`);return{covered:i.length,total:r.length,missed:a}}function clearCoverage(e){if(e)try{let t=e.get(`canvas`),n=e.get(`elementRegistry`);if(!t||!n)return;n.forEach(e=>{t.removeMarker(e,_d),t.removeMarker(e,vd)})}catch(e){console.error(`Could not clear the coverage markers:`,e)}}function showCoverage(e,t,n){if(e){clearCoverage(e);try{let r=e.get(`canvas`);if(!r)return;countable$1(e,t).forEach(e=>{r.addMarker(e,isReached(e,n)?_d:vd)})}catch(e){console.error(`Could not show the coverage:`,e)}}}function percent(e){return e.total?`${Math.round(e.covered/e.total*100)}%`:`0%`}function when(e){return e?new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):null}function nameOf$3(e){return e.businessObject?.name?.trim()||e.id}e(nameOf$3,`nameOf`);function CoveragePanel({isOpen:e,onClose:t,getModeler:r,coverage:i}){let[a,o]=n(null),[s,c]=n(0),d=e?r():null;f(()=>{if(!e||!d)return;let t=d.get(`eventBus`),changed=()=>c(e=>e+1);return t.on(`commandStack.changed`,changed),t.on(`import.done`,changed),()=>{t.off(`commandStack.changed`,changed),t.off(`import.done`,changed)}},[e,d]);let p=l(()=>{if(!d)return null;let e=reachOf(i,processIdsOf$1(d));if(!e)return null;let t=e.tests.find(e=>e.name===a)?.reach??e.all;return{diagram:e,reached:t,total:tally(d,e.processIds,e.all),shown:tally(d,e.processIds,t),tests:e.tests.map(t=>({name:t.name,tally:tally(d,e.processIds,t.reach)}))}},[d,i,a,s]);if(f(()=>{if(d)return p?showCoverage(d,p.diagram.processIds,p.reached):clearCoverage(d),()=>clearCoverage(d)},[d,p]),f(()=>{a&&p&&!p.tests.some(e=>e.name===a)&&o(null)},[a,p]),!e)return null;let m=when(i?.updatedAt),h=[i?.reports?.join(`, `),m].filter(Boolean).join(` · `);return u(`aside`,{class:`diagram-check`,"aria-label":Y(`app.coverage.testCoverage`),children:[u(`header`,{class:`diagram-check__bar`,children:[u(`span`,{class:`diagram-check__title`,children:Y(`app.coverage.coverage`)}),p&&u(`span`,{class:`diagram-check__counts`,children:u(`span`,{class:`diagram-check__tally`,children:[percent(p.shown),` · `,Y(`app.coverage.coveredOf`,{covered:p.shown.covered,total:p.shown.total})]})}),u(`button`,{type:`button`,class:`ui-button`,onClick:t,title:Y(`app.coverage.closeCoverage`),children:Y(`app.common.close`)})]}),u(`div`,{class:`diagram-check__body`,children:[!p&&u(`p`,{class:`diagram-check__clean`,children:Y(`app.coverage.noTestReportCoversThis`)}),p&&p.tests.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.coverage.tests`)}),u(`ul`,{class:`diagram-check__list`,children:[u(`li`,{children:u(`button`,{type:`button`,class:a===null?`diagram-check__row is-selected`:`diagram-check__row`,onClick:()=>o(null),children:[u(`span`,{class:`diagram-check__row-title`,children:Y(`app.coverage.allTests`)}),u(`span`,{class:`diagram-check__row-where`,children:[percent(p.total),` · `,Y(`app.coverage.testCount`,{count:p.tests.length})]})]})}),p.tests.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:a===e.name?`diagram-check__row is-selected`:`diagram-check__row`,onClick:()=>o(e.name),title:Y(`app.coverage.showTheWayThisTest`),children:[u(`span`,{class:`diagram-check__row-title`,children:e.name}),u(`span`,{class:`diagram-check__row-where`,children:[percent(e.tally),` · `,Y(`app.coverage.coveredOf`,{covered:e.tally.covered,total:e.tally.total})]})]})},e.name))]})]}),p&&p.shown.missed.length>0&&u(`section`,{class:`diagram-check__group`,children:[u(`h3`,{class:`diagram-check__heading`,children:Y(`app.coverage.notReached`)}),u(`ul`,{class:`diagram-check__list`,children:p.shown.missed.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>focusDefect(d,[e.id]),children:[u(`span`,{class:`diagram-check__row-title`,children:nameOf$3(e)}),u(`span`,{class:`diagram-check__row-where`,children:e.businessObject.$type.replace(`bpmn:`,``)})]})},e.id))})]}),p&&h&&u(`p`,{class:`diagram-check__row-where diagram-check__row-where--wrap diagram-check__source`,children:h})]})]})}var yd=`penstock.debug.breakpoints`,bd=500;function read(e){try{let t=JSON.parse(e.getItem(`penstock.debug.breakpoints`)??`{}`);if(!t||typeof t!=`object`||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t))Array.isArray(r)&&Object.defineProperty(n,e,{value:r.filter(e=>typeof e==`string`),enumerable:!0,writable:!0,configurable:!0});return n}catch{return{}}}function loadBreakpoints(e,t){if(t===``)return[];let n=read(e);return Object.hasOwn(n,t)?n[t]:[]}function saveBreakpoints(e,t,n){if(t===``)return;let r=read(e);delete r[t];let i=Object.entries(r).slice(-199),a=Object.fromEntries(i);n.length>0&&Object.defineProperty(a,t,{value:n.slice(0,bd),enumerable:!0,writable:!0,configurable:!0});try{e.setItem(yd,JSON.stringify(a))}catch{}}function toggled(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function only(e,t){return e.filter(t)}var xd=`penstock-breakpoint`,Sd=`penstock-process-debug`,Cd=`penstock-debug-current`;function escape$1(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]??e)}e(escape$1,`escape`);function nameOf$2(e,t){try{return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}catch{return t}}e(nameOf$2,`nameOf`);function exists(e,t){try{return!!e?.get?.(`elementRegistry`)?.get?.(t)}catch{return!1}}function showBreakpoints(e,t,n){try{let r=e?.get?.(`overlays`),i=e?.get?.(`elementRegistry`);if(!r||!i)return;r.remove({type:xd});for(let a of t){if(!i.get(a))continue;let t=document.createElement(`button`);t.type=`button`,t.className=`penstock-breakpoint`,t.title=Y(`app.processDebug.breakpointDot`,{element:nameOf$2(e,a)}),t.setAttribute(`aria-label`,t.title),t.addEventListener(`click`,e=>{e.stopPropagation(),n(a)}),r.add(a,xd,{position:{top:-6,left:-6},html:t})}}catch(e){console.error(`Could not show the breakpoints:`,e)}}function clearBreakpoints(e){try{e?.get?.(`overlays`)?.remove?.({type:xd})}catch{}}function showPaused(e,t){if(clearPaused(e),t)try{let n=e?.get?.(`canvas`),r=e?.get?.(`elementRegistry`),i=e?.get?.(`overlays`),a=r?.get?.(t);if(!n||!i||!a)return;n.addMarker(a,Cd),i.add(a,Sd,{position:{top:-28,left:0},html:`<div class="penstock-debug-badge">${escape$1(Y(`app.debug.pausedHere`))}</div>`}),n.scrollToElement?.(a,{top:160,bottom:160,left:160,right:160})}catch(e){console.error(`Could not show where the debugger paused:`,e)}}function clearPaused(e){try{let t=e?.get?.(`canvas`);e?.get?.(`overlays`)?.remove?.({type:Sd}),e?.get?.(`elementRegistry`)?.forEach?.(e=>t?.removeMarker?.(e,Cd))}catch{}}var wd=`penstock.debug.builds`;function selectionCanBreak(e,t){if(!t)return!1;try{return canHaveBreakpoint(e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject)}catch{return!1}}function processIdsOf(e){try{return e?executableProcessIdsOf(e):[]}catch{return[]}}function useProcessDebug({active:e,modeler:t,selectedElementId:i,diagramPath:a,exportXml:o}){let c=a??``,[u,d]=n(null),[p,m]=n(``),[h,g]=n(!1),[_,v]=n(()=>loadBreakpoints(localStorage,c)),[y,b]=n(``),[x,S]=n(`{}`),[C,w]=n(null),[T,E]=n(!1),[D,O]=n(null),k=l(()=>new DebugSessions,[]),A=s(void 0),j=s(null),M=s(_);M.current=_;let N=l(()=>processIdsOf(t),[t,e,C?.phase]),P=N.includes(y)?y:N[0]??``;f(()=>{v(loadBreakpoints(localStorage,c))},[c]),f(()=>{if(!e)return;let t=!0;return g(!0),(async()=>{let e=await li(a),n=e?``:await $r(a);t&&(d(e),m(n),g(!1))})(),()=>{t=!1}},[e,a]);let F=u?ei(u):``;f(()=>{if(!e||!u)return;let t=G(),n=ui(localStorage,wd,ei(u));n.list().then(e=>{if(e.length!==0)return sweepDebugLeftovers({engine:u.engine,call:e=>t.askEngine(u.profile,e,a??void 0,!0),sleep:e=>$o.sleep(e)},n,Date.now())}).catch(()=>void 0)},[e,F]);let I=r(e=>{v(t=>{let n=t.filter(t=>t!==e);return saveBreakpoints(localStorage,c,n),A.current?.setBreakpoints(n),n})},[c]),L=r(e=>{v(t=>{let n=toggled(t,e);return saveBreakpoints(localStorage,c,n),A.current?.setBreakpoints(n),n})},[c]),R=r(()=>{i&&selectionCanBreak(t,i)&&L(i)},[t,i,L]);f(()=>{if(!t)return;let draw=()=>showBreakpoints(t,_,I);draw();let e=t.get?.(`eventBus`,!1);return e?.on?.(`import.done`,draw),()=>{e?.off?.(`import.done`,draw),clearBreakpoints(t)}},[t,_,I]);let z=C?.phase===`paused`?C.element:null;f(()=>{if(t)return showPaused(t,z),()=>clearPaused(t)},[t,z]);let B=r(e=>{j.current?.(),A.current=e,w(e.snapshot),j.current=e.subscribe(w)},[]),V=r(e=>{if(T||!u||P===``)return;let n=va(x);n.ok?(O(null),E(!0),(async()=>{try{if(!await ai())return;let r=debugProcessId(P),i=await Xr(u,{title:Y(`app.processDebug.confirm.title`),text:Y(`app.processDebug.confirm.text`,{copy:r,url:u.url??``}),accept:Y(`app.processDebug.confirm.accept`)});if(i){O(i);return}let s=await o();if(!s){O(Y(`app.processDebug.problem.unreadable`));return}let c=G(),l=only(M.current,e=>exists(t,e)),d=await k.begin({engine:u.engine,ask:e=>c.askEngine(u.profile,e,a??void 0,!0),xml:s,processId:P,breakpoints:l,variables:n.variables,mode:e?`step`:`continue`,ledger:ui(localStorage,wd,ei(u))});B(d),await d.start()}catch(e){O(e instanceof Error?e.message:String(e))}finally{E(!1)}})()):O(n.error)},[T,u,P,x,o,t,k,a,B]),H=r(e=>{A.current?.continue(e)},[]),U=r(e=>{A.current?.step(e)},[]),W=r(()=>{A.current?.stop()},[]),ee=r(()=>{A.current?.retryCleanup()},[]);f(()=>{let closing=()=>{k.disposeAll()};return window.addEventListener(`pagehide`,closing),()=>{window.removeEventListener(`pagehide`,closing),j.current?.(),closing()}},[k]);let K=va(x),te=r(e=>nameOf$2(t,e),[t]);return{target:u,targetProblem:p,checking:h,processIds:N,processId:P,setProcessId:b,copyId:P===``?``:debugProcessId(P),variablesText:x,setVariablesText:S,variablesError:K.ok?null:K.error,breakpoints:_,selected:i??null,canToggle:selectionCanBreak(t,i),toggle:L,toggleSelected:R,snapshot:C,starting:T,problem:D,start:V,resume:H,stepOver:U,stop:W,retryCleanup:ee,nameOf:te}}function parseTime(e){return typeof e==`number`?Number.isFinite(e)?e:NaN:typeof e!=`string`||e===``?NaN:Date.parse(e.replace(/([+-]\d\d)(\d\d)$/,`$1:$2`))}function candidateOf(e,t){if(typeof e?.elementId!=`string`||e.elementId===``)return null;let n=parseTime(e.start);if(Number.isNaN(n))return null;let r=parseTime(e.end),i=Number.isNaN(r)?null:r,a=e.state,o=!1;return i!==null&&i<n&&(i=n,o=!0),i!==null&&a===`ACTIVE`&&(a=`COMPLETED`,o=!0),i===null&&(a===`COMPLETED`||a===`TERMINATED`)&&(i=n,o=!0),{sequence:t,elementId:e.elementId,elementType:e.elementType??``,instance:e.instance?String(e.instance):null,parent:e.parent?String(e.parent):null,start:n,end:i,state:a,incident:e.incident?String(e.incident):null,changed:[...new Set(e.changed??[])],mocked:e.mocked===!0,repaired:o}}function keyOf$2(e){return e.instance===null?`e:${e.elementId}|${e.start}|${e.end??``}`:`i:${e.instance}`}e(keyOf$2,`keyOf`);function fuller(e,t){let n=e.end===null&&t.end!==null?t:e,r=n===e?t:e;return{...n,incident:n.incident??r.incident,changed:[...new Set([...n.changed,...r.changed])],mocked:n.mocked||r.mocked,parent:n.parent??r.parent,sequence:Math.min(n.sequence,r.sequence)}}function deduplicated(e){let t=new Map,n=0;for(let r of e){let e=keyOf$2(r),i=t.get(e);i?(t.set(e,fuller(i,r)),n+=1):t.set(e,r)}return{kept:[...t.values()],merged:n}}var Td=0,Ed=1;function momentsOf(e){let t=[];for(let n of e)t.push({moment:{time:n.start,kind:`start`,event:n.index},bucket:Ed}),n.end!==null&&t.push({moment:{time:n.end,kind:`end`,event:n.index},bucket:n.instant?Ed:Td});let order=e=>e.kind===`start`?0:1;t.sort((e,t)=>e.moment.time-t.moment.time||e.bucket-t.bucket||e.moment.event-t.moment.event||order(e.moment)-order(t.moment));let n=Array(e.length).fill(-1),r=Array(e.length).fill(-1);return{moments:t.map(({moment:e},t)=>(e.kind===`start`?n[e.event]=t:r[e.event]=t,e)),startMoment:n,endMoment:r}}function beatsOf(e){let t=[];e.forEach((e,n)=>{e.kind===`start`&&t.push({applied:n+1,time:e.time,event:e.event})});let n=t[t.length-1];return n&&n.applied<e.length&&t.push({applied:e.length,time:e[e.length-1].time,event:null}),t}function runState(e,t){if(e.length===0)return t??`ACTIVE`;let n=e.filter(e=>e.end===null);return n.some(e=>e.state===`FAILED`)?`FAILED`:n.length>0?`ACTIVE`:t??(e.some(e=>e.state===`FAILED`)?`FAILED`:`COMPLETED`)}function iso(e){return new Date(e).toISOString()}function depthsOf(e){for(let t of e){let n=0,r=t.parent,i=new Set([t.index]);for(;r!==null&&!i.has(r);)i.add(r),n+=1,r=e[r].parent;t.depth=n}}function buildTimeline(e,t={}){let n=Array.isArray(e?.events)?e.events:[],r=[],i=0;n.forEach((e,t)=>{let n=candidateOf(e,t);n?r.push(n):i+=1});let{kept:a,merged:o}=deduplicated(r);a.sort((e,t)=>e.start-t.start||e.sequence-t.sequence);let s=new Map,c=new Map,l=a.map((e,t)=>{let n=(c.get(e.elementId)??0)+1;c.set(e.elementId,n);let r=e.instance??`${e.elementId}#${n}`;return s.set(r,t),{index:t,id:r,elementId:e.elementId,elementType:e.elementType,instance:r,parent:null,depth:0,visit:n,start:e.start,end:e.end,state:e.state,incident:e.incident,changed:e.changed,mocked:e.mocked,instant:e.end!==null&&e.end===e.start,repaired:e.repaired,via:[]}});a.forEach((e,t)=>{if(e.parent===null)return;let n=s.get(e.parent);n!==void 0&&n!==t&&(l[t].parent=n)}),depthsOf(l);let{moments:u,startMoment:d,endMoment:f}=momentsOf(l);if(t.flows&&t.flows.length>0&&l.length>0){let e=l.map(e=>({elementId:e.elementId,state:e.state,startedAt:iso(e.start),endedAt:e.end===null?null:iso(e.end)}));for(let n of handovers(e,[...t.flows]))l[n.arrival].via.push({flow:n.flow.id,from:n.from})}let p=1/0,m=-1/0;for(let e of l){e.start<p&&(p=e.start);let t=e.end??e.start;t>m&&(m=t)}let h=typeof e?.now==`number`&&Number.isFinite(e.now)?e.now:null;return l.length===0?(p=h??0,m=h??0):h!==null&&l.some(e=>e.end===null)&&h>m&&(m=h),{source:e?.source??`instance`,run:e?.run??``,state:runState(l,e?.state),events:l,moments:u,beats:beatsOf(u),startMoment:d,endMoment:f,origin:p,horizon:m,dropped:i,merged:o}}function clampCursor(e,t){return Number.isFinite(t)?Math.min(e.moments.length,Math.max(0,Math.trunc(t))):0}function cursorTime(e,t){let n=clampCursor(e,t);return n===0?null:e.moments[n-1].time}function nextCursor(e,t){let n=clampCursor(e,t),{beats:r}=e,i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e].applied>n?a=e:i=e+1}return i<r.length?r[i].applied:n}function previousCursor(e,t){let n=clampCursor(e,t),{beats:r}=e,i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e].applied>=n?a=e:i=e+1}return i>0?r[i-1].applied:0}function stepCursor(e,t,n){let r=clampCursor(e,t),i=Number.isFinite(n)?Math.trunc(n):0;for(let t=0;t<Math.abs(i);t+=1){let t=i>0?nextCursor(e,r):previousCursor(e,r);if(t===r)break;r=t}return r}function cursorOfEvent(e,t){let n=e.startMoment[t];return n===void 0||n<0?0:n+1}function visitCursor(e,t,n,r){let i=clampCursor(e,n),{beats:a,events:o}=e;if(r===1){for(let e of a)if(e.applied>i&&e.event!==null&&o[e.event].elementId===t)return e.applied;return null}for(let e=a.length-1;e>=0;--e){let n=a[e];if(n.applied<i&&n.event!==null&&o[n.event].elementId===t)return n.applied}return null}function toneOf(e){return e.tokens>0?e.openFailed>0?`failed`:`active`:e.outcome===`failed`?`failed`:e.outcome===`terminated`?`terminated`:e.visits>0?`done`:`idle`}function snapshotAt(e,t){let n=clampCursor(e,t),{events:r,moments:i}=e,a=new Uint8Array(r.length).fill(0),o=new Map;for(let e=0;e<n;e+=1){let t=i[e],n=r[t.event],s=o.get(n.elementId);s||(s={tokens:0,openFailed:0,outcome:null,visits:0},o.set(n.elementId,s)),t.kind===`start`?(a[n.index]=1,s.tokens+=1,s.visits+=1,n.state===`FAILED`&&n.end===null&&(s.openFailed+=1)):(a[n.index]=2,--s.tokens,s.outcome=n.state===`FAILED`?`failed`:n.state===`TERMINATED`?`terminated`:`done`)}let s=[],c=new Set;for(let e of r)a[e.index]===1&&(s.push(e.index),e.parent!==null&&c.add(e.parent));let l=s.filter(e=>c.has(e)),u=new Map;for(let[e,t]of o)u.set(e,{elementId:e,tone:toneOf(t),tokens:t.tokens,visits:t.visits});let d=[];for(let e of r)if(a[e.index]===0)for(let t of e.via)t.from!==null&&a[t.from]===2&&d.push({flow:t.flow,from:t.from,to:e.index});return{cursor:n,time:cursorTime(e,n),phase:a,tokens:s,containers:l,elements:u,inTransit:d}}function arrivalsOf(e,t){let n=clampCursor(e,t);if(n===0)return null;let r=e.moments[n-1];return r.kind===`start`?{event:r.event,arrivals:e.events[r.event].via}:null}function durationOf(e,t){return Math.max(0,(t.end??e.horizon)-t.start)}function coverageOf(e,t){let n=new Map;for(let t of e.events)n.set(t.elementId,(n.get(t.elementId)??0)+1);let r=new Map;for(let e of t){if(r.has(e))continue;let t=n.get(e)??0;r.set(e,{elementId:e,visits:t,covered:t>0})}let i=[...r.values()].filter(e=>!e.covered).map(e=>e.elementId),a=r.size,o=a-i.length;return{elements:r,covered:o,total:a,ratio:a===0?0:o/a,uncovered:i}}function lanesOf(e,t=[]){let n=new Map,r=[],i=new Map;for(let t of e.events){let a=n.get(t.elementId);a||(a={elementId:t.elementId,elementType:t.elementType,depth:t.depth,events:[],maxEnd:[],first:t.start,visits:0},n.set(t.elementId,a),r.push(a),i.set(a,t.parent===null?null:e.events[t.parent].elementId)),a.events.push(t.index),a.visits+=1;let o=t.end??e.horizon;a.maxEnd.push(Math.max(o,a.maxEnd[a.maxEnd.length-1]??o))}let a=new Map;for(let e of r){let t=i.get(e)??null,r=t!==null&&n.has(t)&&t!==e.elementId?t:null,o=a.get(r);o?o.push(e):a.set(r,[e])}let o=[],s=new Set,place=(e,t)=>{if(!s.has(e)){s.add(e),e.depth=t,o.push(e);for(let n of a.get(e.elementId)??[])place(n,t+1)}};for(let e of a.get(null)??[])place(e,0);for(let e of r)place(e,0);for(let e of t){if(n.has(e))continue;let t={elementId:e,elementType:``,depth:0,events:[],maxEnd:[],first:1/0,visits:0};n.set(e,t),o.push(t)}return o}function instantsOf(e){let t=new Set([e.origin,e.horizon]);for(let n of e.moments)t.add(n.time);return[...t].sort((e,t)=>e-t)}function foldedGaps(e,t,n){let r=new Set,i=e.slice(1).map((t,n)=>({index:n+1,span:t-e[n]})).sort((e,t)=>t.span-e.span),a=i.reduce((e,t)=>e+t.span,0);for(let e of i){let i=a-e.span;if(e.span<=t||i<=0||e.span<=n*i)break;r.add(e.index),a-=e.span}return r}function timeScale(e,t={}){let n=Math.max(1,t.idle??2e3),r=Math.max(0,Math.min(n,t.kept??400)),i=[],a=0,push=(e,t,n)=>{let o=n?r:t-e;i.push({from:e,to:t,x0:a,x1:a+o,collapsed:n}),a+=o},o=instantsOf(e),s=foldedGaps(o,n,t.ratio??8);if(o.length<2||o[0]===o[o.length-1])push(e.origin,e.origin,!1);else for(let e=1;e<o.length;e+=1){let t=o[e-1],n=o[e],r=i[i.length-1],c=s.has(e);r&&!c&&!r.collapsed?(r.to=n,r.x1+=n-t,a+=n-t):push(t,n,c)}let c=a,xOf=e=>{if(!(e>i[0].from))return 0;let t=0,n=i.length;for(;t<n;){let r=t+n>>1;i[r].from<=e?t=r+1:n=r}let r=i[t-1];if(e>=r.to)return r.x1;let a=r.to-r.from;return a===0?r.x0:r.x0+(e-r.from)/a*(r.x1-r.x0)},timeOf=e=>{if(!(e>0))return i[0].from;if(e>=c)return i[i.length-1].to;let t=0,n=i.length;for(;t<n;){let r=t+n>>1;i[r].x0<=e?t=r+1:n=r}let r=i[t-1],a=r.x1-r.x0;return a===0?r.from:r.from+(e-r.x0)/a*(r.to-r.from)};return{segments:i,width:c,xOf,timeOf}}var Dd=[1,2,5,10,20,50,100,200,500,1e3,2e3,5e3,1e4,15e3,3e4,6e4,12e4,3e5,6e5,18e5,36e5,72e5,216e5,432e5,864e5];function niceStep(e){let t=Dd.find(t=>t>=e);if(t!==void 0)return t;let n=Dd[Dd.length-1];return Math.ceil(e/n)*n}function ticksOf(e,t,n,r=72){if(!(n>0))return[];let i=niceStep(r/n),a=[];for(let o of e.segments){if(o.collapsed||o.to<=o.from)continue;let s=Math.ceil((o.from-t)/i)*i;for(let c=s;t+c<=o.to;c+=i){let i=e.xOf(t+c),o=a[a.length-1];o&&(i-o.x)*n<r*.75||a.push({x:i,elapsed:c})}}return a}function gapsOf(e){return e.segments.filter(e=>e.collapsed).map(e=>({x0:e.x0,x1:e.x1,span:e.to-e.from}))}function layoutOf(e,t,n){let r=new Float64Array(e.events.length),i=new Float64Array(e.events.length);for(let n of e.events)r[n.index]=t.xOf(n.start),i[n.index]=t.xOf(n.end??e.horizon);return{scale:t,start:r,end:i,reach:n.map(e=>{let t=new Float64Array(e.events.length),n=-1/0;return e.events.forEach((e,r)=>{n=Math.max(n,i[e]),t[r]=n}),t})}}function visibleBars(e,t,n,r,i,a){let o=t.events,s=e.reach[n];if(!o||o.length===0||!s)return[];let c=0,l=o.length;for(;c<l;){let e=c+l>>1;s[e]>=r?l=e:c=e+1}let u=[],d=null,flush=()=>{d&&u.push(d),d=null};for(let t=c;t<o.length;t+=1){let n=o[t],s=e.start[n];if(s>i)break;let c=e.end[n];if(!(c<r)){if(c-s>=a*2)flush(),u.push({event:n,x0:s,x1:c,merged:1});else if(d!==null&&s-d.x1<=a){let e=d;e.x1=Math.max(e.x1,c),e.merged+=1}else flush(),d={event:n,x0:s,x1:c,merged:1}}}return flush(),u}var Od=/#multiInstanceBody$/;function isBody(e){return Od.test(e.elementId)||e.elementType===`MULTI_INSTANCE_BODY`||e.elementType===`multiInstanceBody`}function isProcess(e){return e.elementType===`PROCESS`||e.elementType===`process`}function eventsOfTrace(e){let t=new Map;for(let n of e.incidents??[])t.has(n.elementId)||t.set(n.elementId,n.message);return(Array.isArray(e.steps)?e.steps:[]).filter(e=>!isBody(e)&&!isProcess(e)).map(e=>({elementId:e.elementId,elementType:e.elementType,...e.instance?{instance:e.instance}:{},...e.parent?{parent:e.parent}:{},start:e.startedAt,end:e.endedAt,state:e.state,incident:e.state===`FAILED`?t.get(e.elementId)??null:null,changed:(e.changed??[]).map(e=>e.name),mocked:e.mocked}))}function timelineOfTrace(e,t,n={}){return buildTimeline({source:t,run:e.instance,events:eventsOfTrace(e),state:e.state,...n.now===void 0?{}:{now:n.now}},n.flows?{flows:n.flows}:{})}function formatClock(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hourCycle:`h23`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3})}function formatElapsed(e,t){if(t>=1e3||!Number.isFinite(e)||e<0)return formatDuration(e);let n=t<10?3:t<100?2:1,r=Math.floor(e/6e4),i=(e%6e4/1e3).toFixed(n);return`${r>0?`${r}m `:``}${i}s`}var kd=64,Ad=3,jd=256,Md=[{id:`status`,label:()=>Y(`app.timeline.channelStatus`)},{id:`duration`,label:()=>Y(`app.timeline.channelDuration`)},{id:`coverage`,label:()=>Y(`app.timeline.channelCoverage`)}],Nd={COMPLETED:!0,ACTIVE:!0,FAILED:!0,TERMINATED:!0};function stateLabel(e){return Y(e===`COMPLETED`?`app.timeline.stateCompleted`:e===`FAILED`?`app.timeline.stateFailed`:e===`TERMINATED`?`app.timeline.stateTerminated`:`app.timeline.stateActive`)}function heat(e,t){return t>0?Math.round(65+35*Math.sqrt(Math.min(1,Math.max(0,e/t)))):40}function Segmented({label:e,value:t,options:n,onPick:r}){return u(`div`,{class:`timeline__segmented`,role:`group`,"aria-label":e,children:n.map(e=>u(`button`,{type:`button`,class:`timeline__segment type-help`,"aria-pressed":e.id===t,onClick:()=>r(e.id),children:e.label},e.id))})}function Tool({icon:e,label:t,onClick:n,pressed:r,disabled:i}){return u(`button`,{type:`button`,class:`timeline__tool type-help`,"aria-label":t,title:t,"aria-pressed":r,disabled:i,onClick:n,children:u(B,{name:e,className:`timeline__icon`})})}function Header({model:e,zoom:t}){let n=e.timeline,r=e.status===`ready`&&n!==null,i=n?n.beats.length:0,a=r&&e.snapshot?.time!=null?e.snapshot.time-n.origin:0,s=r?n.horizon-n.origin:0;return u(`header`,{class:`timeline__bar`,children:[u(`h2`,{class:`timeline__title type-section-heading`,children:Y(`app.timeline.title`)}),r&&u(o,{children:[u(`div`,{class:`timeline__transport`,role:`group`,"aria-label":Y(`app.timeline.region`),children:[u(Tool,{icon:`skip-back`,label:Y(`app.timeline.toStart`),onClick:e.toStart,disabled:e.cursor===0}),u(Tool,{icon:`step-back`,label:Y(`app.timeline.previousStep`),onClick:()=>e.step(-1),disabled:e.cursor===0}),u(Tool,{icon:e.playing?`pause`:`token-simulation`,label:Y(`app.timeline.play`),pressed:e.playing,onClick:e.togglePlay}),u(Tool,{icon:`step-forward`,label:Y(`app.timeline.nextStep`),onClick:()=>e.step(1),disabled:e.cursor>=n.moments.length}),u(Tool,{icon:`skip-forward`,label:Y(`app.timeline.toEnd`),onClick:e.toEnd,disabled:e.cursor>=n.moments.length}),u(`button`,{type:`button`,class:`timeline__speed type-help`,"aria-label":Y(`app.timeline.speed`,{speed:`${e.speed}x`}),title:Y(`app.timeline.speed`,{speed:`${e.speed}x`}),onClick:e.cycleSpeed,children:[e.speed,`x`]})]}),u(`span`,{class:`timeline__readout`,"aria-hidden":`true`,children:[formatDuration(a),` / `,formatDuration(s),` · `,Math.min(i,beatNumber(n,e.cursor)),`/`,i]})]}),u(`span`,{class:`timeline__grow`}),r&&e.sources.instance&&e.sources.scenario&&u(Segmented,{label:Y(`app.timeline.source`),value:e.source,options:[{id:`instance`,label:Y(`app.timeline.sourceInstance`)},{id:`scenario`,label:Y(`app.timeline.sourceScenario`)}],onPick:e.setSource}),r&&u(Segmented,{label:Y(`app.timeline.channel`),value:e.channel,options:Md.map(e=>({id:e.id,label:e.label()})),onPick:e.setChannel}),r&&u(o,{children:[u(Tool,{icon:`zoom-out`,label:Y(`app.timeline.zoomOut`),onClick:t.out}),u(Tool,{icon:`zoom-in`,label:Y(`app.timeline.zoomIn`),onClick:t.in}),u(Tool,{icon:`fit`,label:Y(`app.timeline.fit`),onClick:t.fit})]}),e.sources.instance&&e.source===`instance`&&u(Tool,{icon:`refresh`,label:Y(`app.timeline.refresh`),onClick:e.refresh,disabled:e.refreshing}),u(Tool,{icon:`close`,label:Y(`app.timeline.close`),onClick:e.close})]})}function beatNumber(e,t){let n=0;for(let r of e.beats)if(r.applied<=t)n+=1;else break;return n}function Detail({model:e}){let t=e.timeline,n=e.selectedEvent===null?null:t.events[e.selectedEvent];if(!n)return u(`footer`,{class:`timeline__detail`,children:[u(`span`,{class:`timeline__info`,children:Y(`app.timeline.detailNone`)}),legend(e)]});let r=e.stepOf(n.index),i=e.names.get(n.elementId)??n.elementId,a=r?.changed??[];return u(`footer`,{class:`timeline__detail`,children:[u(`div`,{class:`timeline__info`,children:[u(`div`,{class:`timeline__facts`,children:[u(`span`,{class:`timeline__fact-name`,children:i}),u(`span`,{class:`timeline__fact`,"data-state":n.state,children:stateLabel(n.state)}),u(`span`,{class:`timeline__fact`,children:[Y(`app.timeline.detailVisit`),` `,n.visit]}),u(`span`,{class:`timeline__fact`,children:[Y(`app.timeline.detailStarted`),` `,formatClock(n.start)]}),n.end!==null&&u(`span`,{class:`timeline__fact`,children:[Y(`app.timeline.detailEnded`),` `,formatClock(n.end)]}),u(`span`,{class:`timeline__fact`,children:[Y(`app.timeline.detailDuration`),` `,formatDuration(durationOf(t,n))]}),u(`span`,{class:`timeline__fact timeline__fact--id`,children:[Y(`app.timeline.detailInstance`),` `,n.instance]}),n.mocked&&u(`span`,{class:`timeline__fact`,children:Y(`app.timeline.detailMocked`)}),n.incident&&u(`span`,{class:`timeline__fact timeline__fact--error`,children:[Y(`app.timeline.detailIncident`),`: `,n.incident]})]}),a.length>0&&u(`div`,{class:`timeline__changed`,children:[u(`span`,{class:`timeline__changed-label`,children:Y(`app.timeline.detailChanged`)}),a.map(e=>u(`span`,{class:`timeline__chip`,title:shown(e.value),children:[e.name,e.before===void 0?`: ${shown(e.value)}`:`: ${shown(e.before)} → ${shown(e.value)}`]},e.name))]})]}),legend(e)]})}function shown(e){let t;try{t=typeof e==`string`?e:JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60?`${t.slice(0,57)}...`:t}function legend(e){let t=e.timeline;if(e.channel===`status`)return u(`ul`,{class:`timeline__legend`,children:Object.keys(Nd).map(e=>u(`li`,{class:`timeline__legend-item`,children:[u(`i`,{class:`timeline__swatch`,"data-state":e}),stateLabel(e)]},e))});if(e.channel===`duration`){let e=Math.max(0,...t.events.map(e=>durationOf(t,e)));return u(`p`,{class:`timeline__legend`,children:[u(`i`,{class:`timeline__ramp`}),`0 – `,formatDuration(e)]})}let n=coverageOf(t,e.elementIds);return u(`p`,{class:`timeline__legend`,children:Y(`app.timeline.coverageSummary`,{covered:n.covered,total:n.total})})}function TimelineStrip({model:e}){let t=s(null),[i,a]=n({left:0,top:0,width:800,height:200}),[o,c]=n(1),[p,m]=n(0),h=s(0),g=r(e=>{h.current=e,m(e)},[]),_=e.timeline,v=e.status===`ready`&&_!==null&&e.snapshot!==null,y=r(()=>{let e=t.current;e&&a({left:e.scrollLeft,top:e.scrollTop,width:e.clientWidth,height:e.clientHeight})},[]);d(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(y);return n.observe(e),y(),()=>n.disconnect()},[y,v]);let b=l(()=>_?timeScale(_):null,[_]),x=Math.max(1,i.width-176-kd),S=b&&b.width>0?x/b.width:1,C=S*o,w=l(()=>_&&b?layoutOf(_,b,e.lanes):null,[_,b,e.lanes]),T=176+(b?b.width*C:0)+kd,E=28+e.lanes.length*24,D=l(()=>_&&b?ticksOf(b,_.origin,C):[],[_,b,C]),O=l(()=>b?gapsOf(b):[],[b]),k=niceStep(72/C),A=l(()=>D.filter(e=>O.every(t=>!(e.x*C>t.x0*C-56&&e.x*C<t.x1*C))),[D,O,C]),j=l(()=>_?Math.max(0,..._.events.map(e=>durationOf(_,e))):0,[_]),M=l(()=>Math.max(1,...e.lanes.map(e=>e.visits)),[e.lanes]);f(()=>{c(1),g(0)},[_]),f(()=>{let t=e.selectedElementId?e.lanes.findIndex(t=>t.elementId===e.selectedElementId):-1;t>=0&&g(t)},[e.selectedElementId,e.lanes]);let N=e.snapshot&&e.snapshot.time!==null&&b?176+b.xOf(e.snapshot.time)*C:176;f(()=>{let n=t.current;n&&e.playing&&(N<n.scrollLeft+176||N>n.scrollLeft+i.width-8)&&(n.scrollLeft=Math.max(0,N-176-x/3))},[e.playing,N,i.width,x]);let P=r(e=>{let n=t.current;if(!n)return;let r=28+e*24;r<n.scrollTop+28?n.scrollTop=Math.max(0,r-28):r+24>n.scrollTop+n.clientHeight&&(n.scrollTop=r+24-n.clientHeight)},[]),F=r(e=>{let n=t.current,r=n&&b?(n.scrollLeft+176+x/2-176)/C:0;c(t=>{let i=Math.min(jd,Math.max(1,t*e));return requestAnimationFrame(()=>{n&&(n.scrollLeft=Math.max(0,r*S*i-x/2))}),i})},[b,x,C,S]),I=l(()=>({in:()=>F(2),out:()=>F(.5),fit:()=>{c(1),t.current&&(t.current.scrollLeft=0)}}),[F]),L=r(n=>{let r=t.current;if(!r||!_||!b)return;let i=r.getBoundingClientRect(),a=(n.clientX-i.left+r.scrollLeft-176)/C;e.seek(cursorAt(_,b.timeOf(Math.max(0,a))))},[_,b,C,e.seek]),R=s(!1),onPointerDown=e=>{let n=e.target;if(e.button!==0||n.closest(`.timeline__bar-item, .timeline__label`))return;let r=t.current;if(!r)return;let i=r.getBoundingClientRect();e.clientX-i.left<176||(R.current=!0,r.setPointerCapture?.(e.pointerId),r.focus(),L(e))},onPointerMove=e=>{R.current&&L(e)},onPointerUp=e=>{R.current=!1,t.current?.releasePointerCapture?.(e.pointerId)},onKeyDown=t=>{if(!_)return;let n=t.key,move=t=>{let n=Math.min(e.lanes.length-1,Math.max(0,t));g(n),P(n);let r=e.lanes[n];r&&e.selectElement(r.elementId)};if(n===`ArrowRight`||n===`ArrowLeft`){t.preventDefault();let r=n===`ArrowRight`?1:-1;if(t.shiftKey){let t=e.lanes[h.current];t&&e.visit(t.elementId,r)}else e.step(r)}else if((n===`ArrowDown`||n===`ArrowUp`)&&t.shiftKey)t.preventDefault(),move(h.current+(n===`ArrowDown`?1:-1));else if(n===`Home`)t.preventDefault(),e.toStart();else if(n===`End`)t.preventDefault(),e.toEnd();else if(n===` `)t.preventDefault(),e.togglePlay();else if(n===`+`||n===`=`)t.preventDefault(),I.in();else if(n===`-`)t.preventDefault(),I.out();else if(n===`0`)t.preventDefault(),I.fit();else if(n===`Enter`){let n=e.lanes[h.current];n&&(t.preventDefault(),e.selectElement(n.elementId))}},onWheel=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),F(e.deltaY<0?1.25:.8))},z=s(null),onGripDown=t=>{z.current={y:t.clientY,height:e.height},t.currentTarget.setPointerCapture?.(t.pointerId)},onGripMove=t=>{z.current&&e.setHeight(z.current.height+(z.current.y-t.clientY))},onGripUp=e=>{z.current=null,e.currentTarget.releasePointerCapture?.(e.pointerId)},onGripKey=t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e.setHeight(e.height+(t.key===`ArrowUp`?24:-24)))};if(!e.open)return null;let B=u(`div`,{class:`timeline__grip`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":Y(`app.timeline.resize`),"aria-valuenow":e.height,tabIndex:0,onPointerDown:onGripDown,onPointerMove:onGripMove,onPointerUp:onGripUp,onKeyDown:onGripKey});if(!v||!_||!b||!w||!e.snapshot){let t=emptyOf(e);return u(`section`,{class:`timeline type-help`,"aria-label":Y(`app.timeline.region`),style:{height:`${Math.min(e.height,240)}px`},children:[u(Header,{model:e,zoom:I}),u(`div`,{class:`timeline__empty`,children:u(Z,{title:t.title,hint:t.hint})}),B]})}let V=Math.max(0,Math.floor((i.top-28)/24)-2),H=Math.min(e.lanes.length-1,Math.ceil((i.top+i.height)/24)+2),U=i.left/C,W=(i.left+i.width-176)/C,G=1/C,ee=[];for(let n=V;n<=H;n+=1){let r=e.lanes[n];if(!r)continue;let i=visibleBars(w,r,n,U,W,G),a=e.names.get(r.elementId)??r.elementId,o=e.snapshot.elements.get(r.elementId);ee.push(u(`div`,{class:`timeline__row${n===p?` is-focused`:``}${r.elementId===e.selectedElementId?` is-selected`:``}${r.events.length===0?` is-unreached`:``}`,style:{top:`${28+n*24}px`,width:`${T}px`},"data-tone":o?.tone??`idle`,children:[u(`button`,{type:`button`,class:`timeline__label type-help`,style:{paddingLeft:`${12+r.depth*12}px`},tabIndex:-1,title:r.events.length===0?`${a} · ${Y(`app.timeline.unvisited`)}`:a,"aria-label":Y(`app.timeline.lane`,{name:a,count:r.visits}),onClick:()=>{g(n),e.selectElement(r.elementId),t.current?.focus()},children:[u(`i`,{class:`timeline__lane-dot`,"data-tone":o?.tone??`idle`}),u(`span`,{class:`timeline__label-text`,children:a}),r.visits>1&&u(`span`,{class:`timeline__count`,children:r.visits})]}),i.map(n=>{let i=_.events[n.event],o=Math.max(n.x1-n.x0,0)*C,s=n.merged>1,c=e.snapshot.phase[i.index]===0,l={left:`${176+n.x0*C}px`,width:`${Math.max(Ad,o)}px`};e.channel===`duration`&&(l[`--heat`]=String(heat(durationOf(_,i),j))),e.channel===`coverage`&&(l[`--heat`]=String(heat(r.visits,M)));let d=s?Y(`app.timeline.merged`,{count:n.merged}):Y(`app.timeline.bar`,{name:a,visit:i.visit,state:stateLabel(i.state),duration:formatDuration(durationOf(_,i))});return u(`button`,{type:`button`,tabIndex:-1,class:`timeline__bar-item${i.instant&&!s?` is-instant`:``}${s?` is-merged`:``}${c?` is-future`:``}${e.selectedEvent===i.index?` is-selected`:``}${i.incident?` has-incident`:``}${i.changed.length>0?` has-changes`:``}`,style:l,"data-channel":e.channel,"data-state":i.state,title:d,"aria-label":d,onClick:()=>{e.selectEvent(n.event),t.current?.focus()}},`${n.event}:${n.merged}`)})]},r.elementId))}let K=beatNumber(_,e.cursor),te=e.snapshot.time===null?null:_.events[eventAt(_,e.cursor)],ne=K===0?Y(`app.timeline.beforeStart`):te?Y(`app.timeline.stepAt`,{step:K,total:_.beats.length,name:e.names.get(te.elementId)??te.elementId}):Y(`app.timeline.step`,{step:K,total:_.beats.length});return u(`section`,{class:`timeline type-help`,"aria-label":Y(`app.timeline.region`),style:{height:`${e.height}px`},children:[u(Header,{model:e,zoom:I}),u(`div`,{ref:t,class:`timeline__scroller`,role:`group`,"aria-label":Y(`app.timeline.region`),"aria-describedby":`timeline-keys`,tabIndex:0,onScroll:y,onPointerDown,onPointerMove,onPointerUp,onPointerCancel:onPointerUp,onKeyDown,onWheel,children:u(`div`,{class:`timeline__content`,style:{width:`${T}px`,height:`${E}px`},children:[u(`div`,{class:`timeline__ruler`,style:{width:`${T}px`},children:[u(`span`,{class:`timeline__corner`}),A.map(e=>u(`span`,{class:`timeline__tick`,style:{left:`${176+e.x*C}px`},children:formatElapsed(e.elapsed,k)},e.elapsed)),O.map(e=>{let t=(e.x1-e.x0)*C>=140,n=Y(`app.timeline.folded`,{span:formatDuration(e.span)});return u(`span`,{class:`timeline__gap-label`,title:n,style:{left:`${176+e.x0*C}px`,width:`${(e.x1-e.x0)*C}px`},children:t?n:formatDuration(e.span)},e.x0)})]}),O.map(e=>u(`i`,{class:`timeline__gap`,style:{left:`${176+e.x0*C}px`,width:`${(e.x1-e.x0)*C}px`,height:`${E-28}px`}},e.x0)),ee,u(`div`,{class:`timeline__playhead`,"aria-hidden":`true`,style:{left:`${N}px`,height:`${E}px`}})]})}),u(Detail,{model:e}),u(`span`,{id:`timeline-keys`,class:`timeline__sr`,children:Y(`app.timeline.keysHint`)}),u(`div`,{class:`timeline__sr`,role:`status`,"aria-live":e.playing?`off`:`polite`,children:ne}),B]})}function cursorAt(e,t){let n=0,r=e.moments.length;for(;n<r;){let i=n+r>>1;e.moments[i].time<=t?n=i+1:r=i}return n}function eventAt(e,t){for(let n=Math.min(t,e.moments.length)-1;n>=0;--n)if(e.moments[n].kind===`start`)return e.moments[n].event;return 0}function emptyOf(e){return e.status===`loading`?{title:Y(`app.timeline.loadingTitle`),hint:Y(`app.timeline.loadingHint`)}:e.status===`problem`?{title:Y(`app.timeline.problem`,{reason:e.problem??``}),hint:Y(`app.timeline.emptyHint`)}:e.status===`noSteps`?{title:Y(`app.timeline.noStepsTitle`),hint:Y(`app.timeline.noStepsHint`)}:{title:Y(`app.timeline.emptyTitle`),hint:Y(`app.timeline.emptyHint`)}}var Pd=`penstock-timeline`,Fd=`http://www.w3.org/2000/svg`,Id=new WeakMap;function stateOf(e){let t=Id.get(e);return t||(t={markers:new Map,tokens:new Map,layer:null,travelling:[]},Id.set(e,t)),t}function services(e){try{let t=e?.get?.(`canvas`),n=e?.get?.(`elementRegistry`);return t&&n?{canvas:t,registry:n}:null}catch{return null}}function layerOf(e,t){if(t.layer?.isConnected)return t.layer;try{let n=e.getLayer?.(Pd,600)?.node??e.getLayer?.(Pd,600);t.layer=n instanceof Element?n:null}catch{t.layer=null}return t.layer}var Ld={active:`penstock-run-active`,done:`penstock-run-completed`,failed:`penstock-run-failed`,terminated:`penstock-run-terminated`};function desiredMarkers(e,t){let n=new Map;for(let e of t.elements.values()){let t=Ld[e.tone];t&&n.set(e.elementId,t)}for(let r of e.events)if(t.phase[r.index]!==0)for(let e of r.via)n.set(e.flow,`penstock-run-flow`);for(let e of t.inTransit)n.set(e.flow,`penstock-run-flow`);return n}function applyMarkers(e,t,n,r){for(let[t,i]of n.markers)if(r.get(t)!==i){try{e.removeMarker(t,i)}catch{}n.markers.delete(t)}for(let[i,a]of r){if(n.markers.get(i)===a)continue;let r=null;try{r=t.get(i)}catch{}if(r)try{e.addMarker(i,a),n.markers.set(i,a)}catch{}}}function svg(e,t){let n=document.createElementNS(Fd,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,String(r));return n}function drawTokens(e,t,n,r,i){let a=new Map,o=new Set(i.containers);for(let e of i.tokens){let t=r.events[e].elementId,n=a.get(t)??{count:0,container:!0};n.count+=1,o.has(e)||(n.container=!1),a.set(t,n)}for(let[e,n]of t.tokens){let r=a.get(e);r&&n.dataset?.count===String(r.count)&&n.dataset?.container===String(r.container)||(n.remove(),t.tokens.delete(e))}for(let[r,i]of a){if(t.tokens.has(r))continue;let a=null;try{a=e.get(r)}catch{}if(!a||!Number.isFinite(a.x))continue;let o=svg(`g`,{transform:`translate(${a.x+(Number.isFinite(a.width)?a.width:0)-8} ${a.y+8})`});o.dataset.count=String(i.count),o.dataset.container=String(i.container);let s=svg(`g`,{class:`penstock-timeline-token${i.container?` is-container`:``}`});if(s.appendChild(svg(`circle`,{r:7})),i.count>1){let e=svg(`text`,{class:`type-badge`,"text-anchor":`middle`,y:3.5});e.textContent=String(i.count),s.appendChild(e)}o.appendChild(s),n.appendChild(o),t.tokens.set(r,o)}}function waypointsOf(e){return(Array.isArray(e?.waypoints)?e.waypoints:[]).filter(e=>Number.isFinite(e?.x)&&Number.isFinite(e?.y)).map(e=>({x:e.x,y:e.y}))}function pointAlong(e,t){if(e.length===0)return{x:0,y:0};if(e.length===1||t<=0)return e[0];let n=e.slice(1).map((t,n)=>Math.hypot(t.x-e[n].x,t.y-e[n].y)),r=n.reduce((e,t)=>e+t,0);if(r===0||t>=1)return e[e.length-1];let i=t*r;for(let t=0;t<n.length;t+=1){if(i<=n[t]||t===n.length-1){let r=n[t]===0?0:i/n[t];return{x:e[t].x+(e[t+1].x-e[t].x)*r,y:e[t].y+(e[t+1].y-e[t].y)*r}}i-=n[t]}return e[e.length-1]}function travel(e,t,n,r,i){let a=x(`--motion-slow`)/Math.max(1,i);for(let i of r){let r=null;try{r=e.get(i)}catch{}let o=waypointsOf(r);if(o.length<2)continue;let s=svg(`circle`,{class:`penstock-timeline-runner`,r:5,cx:o[0].x,cy:o[0].y});n.appendChild(s);let c=performance.now(),l=0,u={cancel:()=>{cancelAnimationFrame(l),s.remove()}},step=e=>{let t=Math.min(1,(e-c)/a),n=1-(1-t)**3,r=pointAlong(o,n);s.setAttribute(`cx`,String(r.x)),s.setAttribute(`cy`,String(r.y)),t<1?l=requestAnimationFrame(step):u.cancel()};l=requestAnimationFrame(step),t.travelling.push(u)}}function paintTimeline(e,t,n,r={}){let i=services(e);if(!i)return;let a=stateOf(e);a.travelling.forEach(e=>e.cancel()),a.travelling=[],applyMarkers(i.canvas,i.registry,a,desiredMarkers(t,n));let o=layerOf(i.canvas,a);o&&(drawTokens(i.registry,a,o,t,n),r.flowsToRun&&r.flowsToRun.length>0&&!V()&&travel(i.registry,a,o,r.flowsToRun,r.speed??1))}function clearTimeline(e){let t=services(e),n=Id.get(e);if(n){if(n.travelling.forEach(e=>e.cancel()),n.travelling=[],t)for(let[e,r]of n.markers)try{t.canvas.removeMarker(e,r)}catch{}n.markers.clear(),n.tokens.forEach(e=>e.remove()),n.tokens.clear()}}var Rd=[1,2,4];function problemText(e){return e instanceof Error?e.message:String(e)}function flowsOf(e){try{return((e?.get?.(`elementRegistry`))?.filter?.(e=>e?.type===`bpmn:SequenceFlow`&&e.source?.id&&e.target?.id)??[]).map(e=>({id:e.id,sourceId:e.source.id,targetId:e.target.id,message:!1,joins:e.target.type===`bpmn:ParallelGateway`||e.target.type===`bpmn:InclusiveGateway`}))}catch{return[]}}function flowNodesOf(e){let t=new Map,n=[];try{(e?.get?.(`elementRegistry`))?.forEach?.(e=>{if(!e?.id||e.waypoints||e.labelTarget||!Sa(e.businessObject))return;let r=typeof e.businessObject?.name==`string`?e.businessObject.name.replace(/\s+/g,` `).trim():``;r&&t.set(e.id,r),n.push({id:e.id,x:Number.isFinite(e.x)?e.x:0,y:Number.isFinite(e.y)?e.y:0})})}catch{}return n.sort((e,t)=>e.x-t.x||e.y-t.y),{ids:n.map(e=>e.id),names:t}}function useTimeline({open:e,setOpen:t,live:i,trial:a,runs:o,modeler:c,selectedElementId:u}){let[d,p]=n(()=>monitorPick().instance),[m,h]=n(()=>monitorPick().instance?`finished`:`running`),[g,_]=n(null),[v,y]=n(!1),[b,S]=n(null),[C,w]=n(0),[T,E]=n(`instance`),[D,O]=n(0),[k,A]=n(!1),[j,M]=n(0),[N,P]=n(`status`),[F,I]=n(null),[L,R]=n(280),[z,B]=n(0),H=s(0),U=s(!1);f(()=>{a.instance&&h(`running`)},[a.instance]),f(()=>{let follow=({instance:e})=>{p(e),e&&h(`finished`)};return follow(monitorPick()),watchMonitorPick(follow)},[]);let W=m===`running`?a.instance??d:d??a.instance;f(()=>{W&&E(`instance`)},[W]),f(()=>{o.trace&&E(`scenario`)},[o.trace]);let G=i.ask,ee=i.engineKind,K=i.at;f(()=>{if(!e||!W||!G||!ee)return;let t=H.current+=1;return y(!0),S(null),qn(ee,G,W,{runId:`timeline`}).then(e=>{H.current===t&&_({id:W,trace:e,at:Date.now()})}).catch(e=>{H.current===t&&(_(null),S(problemText(e)))}).finally(()=>{H.current===t&&y(!1)}),()=>{H.current+=1}},[e,W,G,ee,K,C]);let te=g&&W&&g.id===W?g:null,ne=l(()=>({instance:W!==null,scenario:o.trace!==null}),[W,o.trace]),re=ne[T]?T:ne[T===`instance`?`scenario`:`instance`]?T===`instance`?`scenario`:`instance`:T,ie=re===`instance`?te?.trace??null:o.trace,ae=re===`instance`&&te&&(ie?.state===`ACTIVE`||ie?.state===`FAILED`)?te.at:void 0,oe=l(()=>e?flowNodesOf(c):{ids:[],names:new Map},[e,c,z,ie]),se=l(()=>e?flowsOf(c):[],[e,c,z,ie]),ce=l(()=>{if(!e||!ie)return{timeline:null,failure:null};try{return{timeline:timelineOfTrace(ie,re,{flows:se,...ae===void 0?{}:{now:ae}}),failure:null}}catch(e){return{timeline:null,failure:problemText(e)}}},[e,ie,re,se,ae]),q=ce.timeline;f(()=>{O(q?q.moments.length:0),A(!1),I(null),U.current=!1},[q]);let le=l(()=>q?snapshotAt(q,D):null,[q,D]),ue=l(()=>q?lanesOf(q,N===`coverage`?oe.ids:[]):[],[q,N,oe]);f(()=>{let e=c?.get?.(`eventBus`,!1);if(!e)return;let imported=()=>{clearTimeline(c),B(e=>e+1)};return e.on(`import.done`,imported),()=>e.off(`import.done`,imported)},[c]),f(()=>{if(!c)return;if(!e||!q||!le){clearTimeline(c);return}let t=U.current?arrivalsOf(q,D)?.arrivals.map(e=>e.flow)??[]:[];U.current=!1,paintTimeline(c,q,le,{flowsToRun:t,speed:Rd[j]})},[c,e,q,le,D,j,z]),f(()=>()=>clearTimeline(c),[c]);let de=q?q.moments.length:0;f(()=>{if(!k||!q)return;if(D>=de||V()){O(de),A(!1);return}let e=setTimeout(()=>{U.current=!0,O(e=>nextCursor(q,e))},x(`--motion-beat`)/Rd[j]);return()=>clearTimeout(e)},[k,D,de,q,j]),f(()=>{try{c?.get?.(`canvas`)?.resized?.()}catch{}},[c,e,L]);let fe=r(e=>{q&&(A(!1),O(Math.min(q.moments.length,Math.max(0,Math.trunc(e)))))},[q]),pe=r(e=>{q&&(A(!1),U.current=e===1,O(t=>stepCursor(q,t,e)))},[q]),me=r(e=>{try{focusDefect(c,[e])}catch{}},[c]),he=r((e,t)=>{if(!q)return;let n=visitCursor(q,e,D,t);n!==null&&(A(!1),O(n))},[q,D]),ge=r(e=>{q?.events[e]&&(A(!1),I(e),O(cursorOfEvent(q,e)),me(q.events[e].elementId))},[q,me]),_e=l(()=>{let e=new Map;for(let t of ie?.steps??[])t.instance&&e.set(`${t.elementId}|i:${t.instance}`,t),e.set(`${t.elementId}|t:${parseTime(t.startedAt)}`,t);return e},[ie]),ve=r(e=>{let t=q?.events[e];return t?_e.get(`${t.elementId}|i:${t.instance}`)??_e.get(`${t.elementId}|t:${t.start}`)??null:null},[q,_e]),ye=r(()=>t(!e),[e,t]),be=r(()=>t(!1),[t]),xe=r(()=>{q&&(k?A(!1):(D>=q.moments.length&&O(0),A(!0)))},[q,k,D]);return{open:e,toggle:ye,close:be,status:!ne.instance&&!ne.scenario?`empty`:re===`instance`&&!te?b?`problem`:G?`loading`:`empty`:ce.failure?`problem`:q?q.events.length===0?`noSteps`:`ready`:`loading`,problem:ce.failure??b,source:re,sources:ne,setSource:E,label:q?.run??``,timeline:q,lanes:ue,elementIds:oe.ids,names:oe.names,cursor:D,snapshot:le,seek:fe,step:pe,visit:he,toStart:r(()=>fe(0),[fe]),toEnd:r(()=>fe(de),[fe,de]),playing:k,togglePlay:xe,speed:Rd[j],cycleSpeed:r(()=>M(e=>(e+1)%Rd.length),[]),channel:N,setChannel:P,selectedEvent:F,selectEvent:ge,selectElement:me,stepOf:ve,selectedElementId:u,refresh:r(()=>w(e=>e+1),[]),refreshing:v,height:L,setHeight:r(e=>R(Math.min(720,Math.max(160,Math.round(e)))),[])}}function withoutAbsenceClaims(e,t){return!t||t.files===0||t.status===`ready`?e:e.map(e=>({...e,missingImplementation:!1,neverThrown:!1,unsetReads:[],unfetched:[],unread:[],lateReads:[],unknownFields:[],unknownNames:[]}))}function codeSections(e,t){return e?[`implementations`,`tests`,`usages`].filter(t=>(e[t]?.length??0)>0).map(n=>{let r=e[n]??[];return{key:n,title:Y(`app.code.section.${n}`),links:r,shown:r.slice(0,t),more:Math.max(0,r.length-t)}}):[]}function codeWarnings(e){if(!e)return[];let t=e.unsetReads??[],n=e.unfetched??[];return[...e.missingImplementation?[Y(`app.code.warn.missingImplementation`)]:[],...e.neverThrown?[Y(`app.code.warn.neverThrown`)]:[],...t.map(e=>e.closest?Y(`app.code.warn.unsetTypo`,{name:e.name,closest:e.closest}):Y(`app.code.warn.unset`,{name:e.name})),...n.map(e=>e.closest?Y(`app.code.warn.unfetchedClosest`,{closest:e.closest,name:e.name}):Y(`app.code.warn.unfetched`,{name:e.name})),...(e.unread??[]).map(e=>Y(`app.code.warn.unread`,{name:e})),...(e.lateReads??[]).map(e=>Y(`app.code.warn.lateRead`,{name:e})),...(e.near??[]).map(e=>e.caseOnly?Y(`app.code.warn.nearCase`,{name:e.name,near:e.near}):Y(`app.code.warn.near`,{name:e.name,near:e.near})),...(e.implicit??[]).map(e=>Y(`app.code.warn.implicit`,{method:e.method})),...(e.mappingOrder??[]).map(e=>Y(`app.code.warn.mappingOrder`,{path:e.path,target:e.target})),...e.lostUpdate?[Y(`app.code.warn.lostUpdate`,{name:e.lostUpdate})]:[]]}var zd=5;function LinkRow({link:e,title:t,code:n}){return u(`li`,{children:u(`button`,{type:`button`,class:`code-tab__link`,title:e.declaration??e.label,onClick:()=>n.openLink(e,t),children:[u(`span`,{class:`code-tab__label`,children:e.label}),e.declaration&&e.declaration!==e.label&&u(`span`,{class:`code-tab__declaration`,children:e.declaration})]})})}function CodeTab({code:e,selectedElementId:t,views:n,push:r}){if(!t)return u(Z,{title:Y(`app.code.selectATaskToSee`),hint:Y(`app.code.theWorkersClassesBeansAnd`),guide:`code`});let i=e.found(t),a=i?.title??e.nameOf(t),o=i?codeSections(i,zd):[],s=codeWarnings(e.entry(t)),c=n[n.length-1];if(c){let t=o.find(e=>e.key===c.key);return u(`div`,{class:`code-tab`,children:[u(`h3`,{class:`code-tab__heading`,children:t?.title??c.title}),u(`ul`,{class:`code-tab__list`,children:(t?.links??[]).map(t=>u(LinkRow,{link:t,title:a,code:e},`${t.label}${t.declaration??``}`))})]})}return!i||o.length===0&&s.length===0?u(`div`,{class:`code-tab`,children:[u(`h2`,{class:`code-tab__title`,children:a}),Ue(e.clientFacts)?u(et,{facts:e.clientFacts}):u(Z,{title:Y(`app.code.noCodeFoundForThis`),guide:`code`,hint:e.hasProject?e.licensed?Y(`app.code.nothingInTheProjectRuns`):Y(`app.code.followingAStepToThe`):Y(`app.code.theProjectHasNotBeen`),actions:e.hasProject?[{label:Y(`app.code.findUsages`),run:()=>e.findUsages(t)}]:[]})]}):u(`div`,{class:`code-tab`,children:[u(`div`,{class:`code-tab__head`,children:[u(`h2`,{class:`code-tab__title`,title:a,children:a}),u(`div`,{class:`code-tab__actions`,children:[i.implementations.length>0&&u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>e.openImplementation(t),children:Y(`app.code.goToCode`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.findUsages(t),children:Y(`app.code.findUsages`)})]})]}),o.length===0&&u(et,{facts:e.clientFacts}),s.map(e=>u(`p`,{class:`code-tab__warning`,children:e},e)),o.map(n=>u(`section`,{class:`code-tab__section`,children:[u(`h3`,{class:`code-tab__heading`,children:[n.title,` (`,n.links.length,`)`]}),u(`ul`,{class:`code-tab__list`,children:n.shown.map(t=>u(LinkRow,{link:t,title:a,code:e},`${t.label}${t.declaration??``}`))}),n.more>0&&u(`button`,{type:`button`,class:`code-tab__more`,onClick:()=>r({key:n.key,title:`${n.title} - ${a}`}),children:Y(`app.code.showAllCount`,{count:n.links.length})}),n.key===`tests`&&e.runTests&&u(`div`,{class:`code-tab__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.runTests?.(t,!1),children:Y(`app.code.runTests`)}),u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.runTests?.(t,!0),children:Y(`app.code.debugTests`)})]}),n.key===`tests`&&!e.runTests&&u(`p`,{class:`code-tab__note type-help`,children:Y(`app.webHost.testsNeedTheIde`)})]},n.key))]})}var Bd=`properties-panel.multi-command-executor`;function author(){return Xe(window.appConfig)}function whenOf(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function run(e,t){if(e?.execute&&Array.isArray(t)&&t.length)try{e.execute(Bd,t)}catch{}}function Comment({element:e,comment:t,commandStack:r,bpmnFactory:i}){let a=Ne(t,author()),[s,c]=n(null),l={};try{l=(e?Da(e):null)??{}}catch{}let d=t.resolved===!0;return u(`li`,{class:`penstock-comment${d?` is-resolved`:``}`,children:[u(`div`,{class:`penstock-comment__head`,children:[u(`span`,{class:`penstock-comment__author`,children:t.author||Y(`app.comments.anonymous`)}),u(`span`,{class:`penstock-comment__date`,children:whenOf(t.date)}),d&&u(`span`,{class:`penstock-comment__state`,children:Y(`app.comments.resolvedState`)})]}),s===null?u(`p`,{class:`penstock-comment__text`,children:t.text}):u(`textarea`,{class:`ui-input penstock-comment__editor`,"aria-label":Y(`app.comments.comment`),value:s,onInput:e=>c(e.target.value)}),u(`div`,{class:`penstock-comment__actions`,children:[a&&(s===null?u(`button`,{type:`button`,class:`ui-button ui-button--quiet`,onClick:()=>c(t.text??``),children:Y(`app.comments.edit`)}):u(o,{children:[u(`button`,{type:`button`,class:`ui-button ui-button--quiet ui-button--primary`,onClick:()=>{run(r,$e(e,l,i,t,s.trim())),c(null)},children:Y(`app.comments.save`)}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet`,onClick:()=>c(null),children:Y(`app.comments.cancel`)})]})),u(`button`,{type:`button`,class:`ui-button ui-button--quiet`,onClick:()=>run(r,Ie(e,l,i,t,!d)),children:Y(d?`app.comments.reopen`:`app.comments.resolve`)}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ui-button--danger`,onClick:()=>run(r,Mt(e,l,i,t)),children:Y(`app.comments.delete`)})]})]})}function CommentAddField({element:e,commandStack:t,bpmnFactory:r}){let[i,a]=n(``),o={};try{o=(e?Da(e):null)??{}}catch{}let s=author();return u(`div`,{class:`penstock-comment-add`,children:[u(`label`,{class:`penstock-comment-add__label`,for:`penstock-comment-new`,children:Y(`app.comments.addAComment`)}),u(`textarea`,{id:`penstock-comment-new`,class:`ui-input penstock-comment-add__text`,placeholder:Y(`app.comments.sayWhatThisElementIs`),value:i,onInput:e=>a(e.target.value)}),u(`div`,{class:`penstock-comment-add__row`,children:[s&&u(`span`,{class:`penstock-comment-add__author`,children:Y(`app.comments.signedBy`,{name:s})}),u(`button`,{type:`button`,class:`ui-button ui-button--primary penstock-comment-add__submit`,disabled:!i.trim(),onClick:()=>{run(t,Ee(e,o,r,{author:s,text:i.trim()},new Date)),a(``)},children:Y(`app.comments.addComment`)})]})]})}function CommentThread({element:e,comments:t,empty:n,commandStack:r,bpmnFactory:i}){return t.length===0?u(`p`,{class:`penstock-comments__empty`,children:n}):u(`ul`,{class:`penstock-comments__list`,children:t.map((t,n)=>u(Comment,{element:e,comment:t,commandStack:r,bpmnFactory:i},t.id??n))})}function CommentList({element:e,id:t,commandStack:n,bpmnFactory:r}){let i=[];try{let t=e?Da(e):null;i=Ye(t)}catch{i=[]}return u(`div`,{class:`penstock-comments`,id:t,children:[i.length===0?u(Z,{title:Y(`app.comments.noCommentsYet`),hint:Y(`app.comments.writeTheFirstOneBelow`)}):u(CommentThread,{element:e,comments:i,empty:``,commandStack:n,bpmnFactory:r}),u(CommentAddField,{element:e,commandStack:n,bpmnFactory:r})]})}var Vd=[`selection.changed`,`commandStack.changed`,`import.done`];function service(e,t){try{return e?.get?.(t)??null}catch{return null}}function shapesOf(e){let t=service(e,`elementRegistry`),n=[];try{t?.forEach(e=>{e&&n.push(e)})}catch{return n}return n}function selectedIdOf(e){try{let[t]=service(e,`selection`)?.get?.()??[];return t?.id?t===service(e,`canvas`)?.getRootElement?.()?void 0:t.id:void 0}catch{return}}function openTotalOf(e){return Le(shapesOf(e))}function useOpenCommentCount(e){let[t,r]=n(0);return d(()=>{if(!e){r(0);return}let t=service(e,`eventBus`),read=()=>{try{r(openTotalOf(e))}catch{r(0)}};if(read(),t)return t.on(Vd,read),()=>{try{t.off(Vd,read)}catch{}}},[e]),t}function useComments(e){let[,t]=n(0);d(()=>{if(!e)return;let n=service(e,`eventBus`);if(!n)return;let bump=()=>t(e=>e+1);return n.on(Vd,bump),()=>{try{n.off(Vd,bump)}catch{}}},[e]);let r=l(()=>({commandStack:service(e,`commandStack`)??{execute:()=>void 0},bpmnFactory:service(e,`bpmnFactory`)??{create:e=>({$type:e})}}),[e]),i=e?shapesOf(e):[],element=e=>i.find(t=>t.id===e)??null;return{ready:!!e,total:Le(i),elements:Pe(i),selected:selectedIdOf(e),services:r,element,label:e=>Ze(element(e)),reveal:t=>{if(e&&t)try{revealElement(e,t)}catch{}}}}function openCommentsTab(e){return t=>{try{e?.select?.(`comments`),t&&e?.reveal?.(t)}catch{}}}function whereText(e){let t=e.resolved.length;return e.open.length?t?Y(`app.comments.openAndResolved`,{open:e.open.length,resolved:t}):Y(`app.comments.openCount`,{count:e.open.length}):Y(`app.comments.resolvedCount`,{count:t})}function resolvedTotal(e){return e.reduce((e,t)=>e+t.resolved.length,0)}function countText(e){return Y(`app.comments.openCommentCount`,{count:e})}function Thread({shape:e,comments:t,empty:n,services:r}){return u(CommentThread,{element:e,comments:t,empty:n,commandStack:r.commandStack,bpmnFactory:r.bpmnFactory})}function ElementGroup({comments:e,entry:t,showResolved:n,onOpen:r}){return u(`section`,{class:`comments-tab__group`,children:[u(`button`,{type:`button`,class:`diagram-check__row comments-tab__element`,title:Y(`app.comments.showOnTheDiagram`,{label:t.label}),onClick:()=>r(t.id),children:[u(`span`,{class:`diagram-check__row-title`,children:t.label}),u(`span`,{class:`diagram-check__row-where`,children:whereText(t)})]}),u(Thread,{shape:e.element(t.id),comments:n?[...t.open,...t.resolved]:t.open,empty:Y(`app.comments.noOpenComments`),services:e.services})]})}function DiagramList({comments:e,showResolved:t,toggleResolved:n,onOpen:r}){let i=resolvedTotal(e.elements);return u(`div`,{class:`comments-tab`,children:[u(`header`,{class:`problems__bar comments-tab__bar`,children:[u(`span`,{class:`problems__count`,children:e.total?countText(e.total):``}),i>0&&u(`button`,{type:`button`,class:`ui-button`,"aria-pressed":t,onClick:n,children:t?Y(`app.comments.hideResolved`):Y(`app.comments.showResolved`,{resolved:i})})]}),e.elements.length===0?u(Z,{title:Y(`app.comments.noCommentsYet`),hint:Y(`app.comments.selectAnElementAndAdd`),guide:`comments`}):e.elements.map(n=>u(ElementGroup,{comments:e,entry:n,showResolved:t,onOpen:r},n.id))]})}function ElementThread({comments:e,id:t}){let n=e.element(t);return n?Qe(n.businessObject)?u(`div`,{class:`comments-tab`,children:u(CommentList,{id:`js-comments`,element:n,commandStack:e.services.commandStack,bpmnFactory:e.services.bpmnFactory})}):u(Z,{title:Y(`app.comments.thisElementCannotTakeComments`),hint:Y(`app.comments.aCommentBelongsToAn`),guide:`comments`}):u(Z,{title:Y(`app.comments.thisElementIsNoLonger`),hint:Y(`app.comments.everyElementThatStillHas`)})}function CommentsTab({modeler:e,views:t,push:r,reset:i}){let a=useComments(e),[o,c]=n(!1),l=s(t);l.current=t;let d=t[t.length-1]?.key??``;return f(()=>{let e=l.current[l.current.length-1]?.key;if(a.selected){if(e===a.selected)return;i(),r({key:a.selected,title:a.label(a.selected)})}else e&&i()},[a.selected]),a.ready?d?u(ElementThread,{comments:a,id:d}):u(DiagramList,{comments:a,showResolved:o,toggleResolved:()=>c(e=>!e),onOpen:a.reveal}):u(Z,{title:Y(`app.comments.waitingForADiagram`),hint:Y(`app.comments.everyOpenCommentInThe`),guide:`comments`})}var Hd=new Map;function LazyTabBody({active:e,load:t,body:r}){let[i,a]=n(()=>Hd.get(t)??null);return f(()=>{if(!e||i)return;let n=!1;return t().then(e=>{Hd.set(t,e),n||a(()=>e)}).catch(e=>console.error(`The tab did not load:`,e)),()=>{n=!0}},[e,i,t]),i?u(i,{...r}):u(`div`,{role:`status`,"aria-busy":e})}var Ud=a(null),Wd=Ud.Provider;function facts(){let e=i(Ud);if(!e)throw Error(`the editor tabs need their facts`);return e}function PropertiesTab({active:e}){let{selectedElementId:t,modeler:n,reveal:r}=facts();return u(`div`,{class:`sidebar-properties`,children:u(PropertiesPanel,{selectedElementId:t,modeler:n,containerId:`js-properties-panel`,isPanelCollapsed:!e,reveal:r?.entries??null,onRevealed:r?.onRevealed??(()=>{})})})}function ProblemsPanel(){let{check:e,clientFacts:t}=facts();return u(ProblemsTab,{check:e,clientFacts:t})}function MonitorPanel(){let{live:e,trial:t,modeler:n,monitor:r}=facts();return u(MonitorTab,{live:e,trial:t,modeler:n,hasImplementation:r?.hasImplementation??(()=>!1),onOpenImplementation:r?.onOpenImplementation??(()=>{}),onConnect:r?.onConnect??(()=>{}),scenario:r?.scenario??null})}function DebugPanel(){let{debug:e,modeler:t,onConnectEngine:n}=facts();return u(DebugTab,{debug:e,modeler:t,onConnect:n??(()=>{})})}function TimelineSlot(){return u(TimelineStrip,{model:facts().timeline})}function CodePanel({views:e,push:t}){let{code:n,selectedElementId:r}=facts();return u(CodeTab,{code:n,selectedElementId:r,views:e,push:t})}var loadAgentsTab=()=>Vi(()=>import(`./AgentsTab-D6LbK6sG.js`).then(e=>e.AgentsTab),__vite__mapDeps([22,1,2,7,8,20,16,13,21,15,23,24,10,9,5,25,26,27,28,29,18,30,31,32,33,4,34,35,36,37,17,38,39,40]),import.meta.url);function AgentsPanel({active:e}){let{modeler:t,selectedElementId:n,agents:r}=facts();return u(LazyTabBody,{active:e,load:loadAgentsTab,body:{modeler:t,selectedElementId:n,facts:r??null}})}function CommentsPanel({views:e,push:t,reset:n}){return u(CommentsTab,{modeler:facts().modeler,views:e,push:t,reset:n})}var Gd=O([{id:`properties`,icon:`properties`,component:PropertiesTab},M,{id:`problems`,icon:`problems`,component:ProblemsPanel,padded:!0},{id:`scenarios`,icon:`scenarios`,component:ScenariosTab,bar:ScenariosBar,ownHeader:!0},{id:`comments`,icon:`comments`,component:CommentsPanel,padded:!0},{id:`code`,icon:`code`,component:CodePanel,padded:!0},{id:`aiagents`,icon:`aiagents`,component:AgentsPanel,padded:!0},{id:`monitor`,icon:`monitor`,component:MonitorPanel,padded:!0},{id:`debug`,icon:`debug`,component:DebugPanel,padded:!0}]),Kd=`penstock-debug-current`,qd=`penstock-debug-active`,Jd=`penstock-debug`;function escape(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]??e)}function clearDebugPosition(e){if(e)try{let t=e.get(`canvas`),n=e.get(`elementRegistry`),r=e.get(`overlays`);if(!t||!n)return;n.forEach(e=>{t.removeMarker(e,Kd),t.removeMarker(e,qd)}),r?.remove?.({type:Jd})}catch(e){console.error(`Could not clear the debug position:`,e)}}function showDebugPosition(e,t){if(clearDebugPosition(e),e&&t)try{let n=e.get(`canvas`),r=e.get(`elementRegistry`),i=e.get(`overlays`);if(!n||!r||!i)return;(t.active??[]).filter(e=>r.get(e)).forEach(e=>n.addMarker(e,qd));let a=(t.current??[]).map(e=>r.get(e)).filter(Boolean),o=escape([t.source,t.instance&&Y(`app.debug.instanceOf`,{id:t.instance})].filter(Boolean).join(` · `)),s=escape(Y(`app.debug.pausedHere`));a.forEach(e=>{n.addMarker(e,Kd),i.add(e,Jd,{position:{top:-28,left:0},html:`<div class="penstock-debug-badge" title="${o}">${s}</div>`})});let c=a[0];if(!c)return;let l=n.findRoot?.(c);l&&l!==n.getRootElement?.()&&n.setRootElement?.(l),n.scrollToElement?.(c,{top:160,bottom:160,left:160,right:160})}catch(e){console.error(`Could not show the debug position:`,e)}}function attachScriptTabs(e,t){let n=e.get(`eventBus`),r=new Map,i=[],reportChanges=()=>{i.forEach(n=>{let i=it(n),a=yt(e,n);a!==void 0&&r.get(i)!==a&&(r.set(i,a),t.reportScriptSlot(n,a).catch(e=>{console.error(`Penstock could not report a script to its tab:`,e)}))})};return n.on(`commandStack.changed`,reportChanges),{setOpen(e){i=e;let t=new Set(e.map(it));[...r.keys()].filter(e=>!t.has(e)).forEach(e=>r.delete(e)),Pt(e),reportChanges()},applyHostWrite(t,n){let i=yt(e,t);return i!==void 0&&(r.set(it(t),n),i===n||kt(e,t,n))},history(t){e.get(`commandStack`)[t]()},dispose(){n.off(`commandStack.changed`,reportChanges),i=[],r.clear(),Pt([])}}}var Yd=function(e){return e.SVG=`SVG`,e.PNG=`PNG`,e.PDF=`PDF`,e}({}),Xd=[W.LIGHT,W.DARK,W.DRACULA],Zd={[W.LIGHT]:`app.export.themeLight`,[W.DARK]:`app.export.themeDark`,[W.DRACULA]:`app.export.themeDracula`},Qd=Xd.map(e=>({value:e,key:Zd[e]}));function exportThemeOf(e){return Xd.find(t=>t===e)??null}var $d=[{value:null,key:`app.export.schemaDefault`},{value:`SKETCHY`,key:`app.export.schemaSketchy`}],ef=[{value:Yd.SVG,label:`SVG`},{value:Yd.PNG,label:`PNG`},{value:Yd.PDF,label:`PDF`}],tf={[W.LIGHT]:Ri.light.defaultFillColor,[W.DARK]:Ri.dark.defaultFillColor,[W.DRACULA]:Ri.dracula.defaultFillColor},nf={[W.LIGHT]:Ri.light.defaultStrokeColor,[W.DARK]:Ri.dark.defaultStrokeColor,[W.DRACULA]:Ri.dracula.defaultStrokeColor},rf={theme:W.LIGHT,useBackground:!0};function base64Of(e){let t=e.indexOf(`,`);return t>=0?e.slice(t+1):e}async function copyPicture(e,t){if(!e?.svg)return!1;try{let n=t.backgroundOf(e.theme),r=e.useBackground?t.withBackground(e.svg,n):e.svg,i=await t.toPng(r,e.useBackground?n:`transparent`);return await t.save(base64Of(i))}catch(e){return console.error(e),!1}}function previewModelerRun(){let e=null,t=!1,own=n=>t?(n.destroy(),!1):(e=n,!0),release=()=>{t=!0,e?.destroy(),e=null};return{own,cancelled:()=>t,release}}var af=16,sf=`var(--theme-border-light)`,cf=`var(--theme-bg-primary)`;function transparencyChecker(){let e=af/2;return{backgroundColor:cf,backgroundImage:`linear-gradient(45deg,${sf} 25%,transparent 25%),linear-gradient(-45deg,${sf} 25%,transparent 25%),linear-gradient(45deg,transparent 75%,${sf} 75%),linear-gradient(-45deg,transparent 75%,${sf} 75%)`,backgroundSize:`${af}px ${af}px`,backgroundPosition:`0 0,0 ${e}px,${e}px -${e}px,-${e}px 0px`}}function colorOf(e,t,n){let r=Xd.find(e=>e===t);return r?e[r]:n}function getThemeBackgroundColor(e){return colorOf(tf,e,`#ffffff`)}function getThemeStrokeColor(e){return colorOf(nf,e,`#000000`)}function hideGridPatterns(e){e?.querySelector(`defs`)?.querySelectorAll(`pattern`).forEach(e=>{e.style.display=`none`})}function applyStylesToMarkers(e,t){let n=e.querySelector(`svg[width="100%"][height="100%"]`);if(!n)return;let r=document.createElement(`style`);r.textContent=`
|
|
14
|
+
svg marker path,
|
|
15
|
+
svg marker polygon,
|
|
16
|
+
svg marker circle {
|
|
17
|
+
fill: ${t} !important;
|
|
18
|
+
stroke: ${t} !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
svg g[class*="djs-connection"] path,
|
|
22
|
+
svg g[class*="djs-connection"] polyline,
|
|
23
|
+
svg g[class*="djs-connection"] line {
|
|
24
|
+
stroke: ${t} !important;
|
|
25
|
+
}
|
|
26
|
+
`,e.appendChild(r),n.querySelectorAll(`marker`).forEach(e=>{e.querySelectorAll(`path, polygon, circle`).forEach(e=>{let n=e;n.style.setProperty(`fill`,t,`important`),n.style.setProperty(`stroke`,t,`important`),n.setAttribute(`fill`,t),n.setAttribute(`stroke`,t)})}),n.querySelectorAll(`g[class*="djs-connection"]`).forEach(e=>{e.querySelectorAll(`path, polyline, line`).forEach(e=>{let n=e;n.style.setProperty(`stroke`,t,`important`),n.setAttribute(`stroke`,t)})})}function findCollapsedSubProcesses(e){let t=new DOMParser().parseFromString(e,`text/xml`),n=[],findSubProcessesRecursive=(e,r=[])=>{let i=e.getAttribute(`id`),a=e.getAttribute(`name`)||i||Y(`app.export.unnamedSubprocess`),o=t.querySelector(`BPMNShape[bpmnElement="${i}"]`)?.getAttribute(`isExpanded`);if(i&&(!o||o===`false`)){let e=r.length>0?`${r.join(` > `)} > ${a}`:a;n.push({id:i,name:e})}e.querySelectorAll(`:scope > subProcess`).forEach(e=>{findSubProcessesRecursive(e,[...r,a])})};return t.querySelectorAll(`process > subProcess`).forEach(e=>findSubProcessesRecursive(e)),n}function createSubProcessXml(e,t){let n=new DOMParser().parseFromString(e,`text/xml`),r=n.querySelector(`subProcess[id="${t}"]`);if(!r)return e;let i=n.createElementNS(r.namespaceURI,`process`);i.setAttribute(`id`,`Process_SubProcess_Export`),i.setAttribute(`isExecutable`,`false`),Array.from(r.children).forEach(e=>{let t=e.tagName.toLowerCase();!t.includes(`incoming`)&&!t.includes(`outgoing`)&&i.appendChild(e.cloneNode(!0))});let a=n.querySelector(`definitions`);if(!a)return e;let o=a.querySelector(`process`);o&&a.replaceChild(i,o);let s=`http://www.omg.org/spec/BPMN/20100524/DI`,c=`http://www.omg.org/spec/DD/20100524/DI`,l=n.createElementNS(s,`bpmndi:BPMNDiagram`);l.setAttribute(`id`,`BPMNDiagram_SubProcess`);let u=n.createElementNS(s,`bpmndi:BPMNPlane`);u.setAttribute(`id`,`BPMNPlane_SubProcess`),u.setAttribute(`bpmnElement`,`Process_SubProcess_Export`);let d=n.querySelector(`BPMNPlane[bpmnElement="${t}"], bpmndi\\:BPMNPlane[bpmnElement="${t}"]`);if(d)Array.from(d.children).forEach(e=>{u.appendChild(e.cloneNode(!0))});else{let e=collectAllElementIds(r),t=new Map,i=100,a=100;e.forEach(e=>{let o=r.querySelector(`[id="${e}"]`);if(!o)return;let c=o.tagName.toLowerCase();if(c.includes(`flow`))return;let l=n.createElementNS(s,`bpmndi:BPMNShape`);l.setAttribute(`id`,`BPMNShape_${e}`),l.setAttribute(`bpmnElement`,e);let d=n.createElementNS(`http://www.omg.org/spec/DD/20100524/DC`,`dc:Bounds`),f=100,p=80;c.includes(`task`)||c.includes(`activity`)?(f=100,p=80):c.includes(`gateway`)?(f=50,p=50):c.includes(`event`)&&(f=36,p=36),d.setAttribute(`x`,i.toString()),d.setAttribute(`y`,a.toString()),d.setAttribute(`width`,f.toString()),d.setAttribute(`height`,p.toString()),t.set(e,{x:i,y:a,width:f,height:p}),i+=150,i>800&&(i=100,a+=150),l.appendChild(d),u.appendChild(l)}),e.forEach(e=>{let i=r.querySelector(`[id="${e}"]`);if(i&&i.tagName.toLowerCase().includes(`flow`)){let r=n.createElementNS(s,`bpmndi:BPMNEdge`);r.setAttribute(`id`,`BPMNEdge_${e}`),r.setAttribute(`bpmnElement`,e);let a=i.getAttribute(`sourceRef`),o=i.getAttribute(`targetRef`);if(a&&o){let e=t.get(a),i=t.get(o);if(e&&i){let t=n.createElementNS(c,`di:waypoint`);t.setAttribute(`x`,(e.x+e.width/2).toString()),t.setAttribute(`y`,(e.y+e.height/2).toString());let a=n.createElementNS(c,`di:waypoint`);a.setAttribute(`x`,(i.x+i.width/2).toString()),a.setAttribute(`y`,(i.y+i.height/2).toString()),r.appendChild(t),r.appendChild(a),u.appendChild(r)}}}})}function collectAllElementIds(e){let t=new Set,n=e.getAttribute(`id`);return n&&t.add(n),Array.from(e.children).forEach(e=>{collectAllElementIds(e).forEach(e=>t.add(e))}),t}return l.appendChild(u),a.querySelectorAll(`BPMNDiagram, bpmndi\\:BPMNDiagram`).forEach(e=>{a.removeChild(e)}),a.appendChild(l),new XMLSerializer().serializeToString(n)}function ExportDialog({isOpen:e,onClose:t,onExport:r,onCopy:i,bpmnXml:a,apiClient:o,isCamunda8:c,isCamunda7:l}){let d=sn(),[p,m]=n(rf.theme),[h,g]=n(``),[_,v]=n(Yd.SVG),[y,b]=n(rf.useBackground),[x,S]=n(!1),[C,w]=n(`main`),[E,D]=n([]),[O,k]=n(!1),A=s(null),j=s(null);f(()=>{if(e){m(rf.theme),g(``),v(Yd.SVG),b(rf.useBackground),w(`main`);let e=findCollapsedSubProcesses(a);D(e),x||S(!0)}else!e&&x&&S(!1)},[e]),f(()=>{if(!e||!A.current||!a)return;let t=null,n=previewModelerRun(),initializePreview=async()=>{let e=A.current;e.innerHTML=``,e.className=`export-preview-container`,e.style.cssText=``;let r=document.createElement(`div`);r.style.width=`100%`,r.style.height=`100%`,e.appendChild(r);let i={container:r,width:`100%`,height:`100%`},s=[];h===`SKETCHY`?(s.push(dt),i.textRenderer=Li):i.textRenderer=Bi;let u=p.toLowerCase();Ri[u]?i.bpmnRenderer=Ri[u]:console.warn(`Theme not found in themeConfig:`,u,`Available:`,Object.keys(Ri));let f=C===`main`?a:createSubProcessXml(a,C);if(c?(s.push(Tt),t=new pt({...i,additionalModules:s,taskResizingEnabled:!0})):t=l?new jt({...i,additionalModules:s}):new je({...i,additionalModules:s}),!t)console.error(`Failed to create modeler instance`);else if(n.own(t))try{if(await t.importXML(f),n.cancelled())return;try{let e=await o.bpmn.getConfig();if(n.cancelled())return;let r=vt(T(e?.elementTemplatesContent),ki(e?.engine)?.family??null).loadable;if(r.length>0){let e=t.get(`elementTemplates`);e&&e.set(r)}}catch(e){console.warn(`Element templates not loaded:`,e)}let i=t.get(`canvas`);i.zoom(`fit-viewport`,`auto`);let a=i.zoom();a<1&&i.zoom(a*.92,`auto`),t.get(`eventBus`).on([`element.click`,`element.dblclick`,`element.mousedown`,`element.hover`,`shape.move.start`,`connection.move.start`,`resize.start`,`canvas.viewbox.changing`],1e4,()=>!1);let s=e.querySelector(`.djs-context-pad`);s&&(s.style.display=`none`);let c=e.querySelector(`.djs-palette`);c&&(c.style.display=`none`);let l=e.querySelector(`svg[width="100%"][height="100%"]`),u=e.querySelector(`.djs-container`),d=getThemeStrokeColor(p);if(e.style.pointerEvents=`none`,r.style.pointerEvents=`none`,u&&(u.style.pointerEvents=`none`),y){let t=getThemeBackgroundColor(p);e.style.backgroundColor=t,e.style.backgroundImage=`none`,r.style.backgroundColor=t,r.style.backgroundImage=`none`,u&&(u.style.backgroundColor=t,u.style.backgroundImage=`none`),l&&(l.style.setProperty(`background-color`,t,`important`),l.style.setProperty(`background-image`,`none`,`important`))}else{let t=transparencyChecker();[e,r].forEach(e=>Object.assign(e.style,t)),u&&Object.assign(u.style,t),l&&(l.style.setProperty(`background-color`,`transparent`,`important`),l.style.setProperty(`background-image`,`none`,`important`))}if(hideGridPatterns(l),applyStylesToMarkers(e,d),l&&h!==`SKETCHY`&&l.querySelectorAll(`text`).forEach(e=>{e.style.setProperty(`font-family`,`Arial, sans-serif`,`important`)}),n.cancelled())return;j.current=t}catch(e){console.error(`Failed to import BPMN for preview:`,e),console.error(`Error details:`,e.message,e.stack),console.error(`XML length:`,f?.length),console.error(`Config:`,i),$.error(d(`app.export.previewFailed`))}};return initializePreview(),()=>{n.release(),j.current===t&&(j.current=null)}},[e,a,p,h,y,C,c,l,o]);let handleCopy=async()=>{if(!O&&j.current){k(!0);try{let{svg:e}=await j.current.saveSVG();await i({theme:p,schema:h===``?null:h,format:_,useBackground:y,selectedDiagram:C,bpmnXml:``,svg:e})&&t()}catch(e){console.error(`Copy failed:`,e),$.error(d(`app.export.copyFailed`))}finally{k(!1)}}},handleExport=async()=>{if(!O){if(!j.current)$.error(d(`app.export.notLoaded`));else{k(!0);try{let{svg:e}=await j.current.saveSVG();await r({theme:p,schema:h===``?null:h,format:_,useBackground:y,selectedDiagram:C,bpmnXml:``,svg:e}),t()}catch(e){console.error(`Export failed:`,e)}finally{k(!1)}}}};return e?u(dn,{title:d(`app.export.title`),size:`large`,body:`split`,backdrop:`close`,labels:`top`,onClose:t,onSubmit:handleExport,footer:u(ln,{actions:[{id:`cancel`,label:d(`app.export.cancel`),role:`cancel`,onClick:t},{id:`copy`,label:d(`app.export.copy`),role:`secondary`,onClick:handleCopy,disabled:O,title:d(`app.export.copyTitle`)},{id:`save`,label:d(O?`app.export.exporting`:`app.export.export`),role:`primary`,onClick:handleExport,disabled:O}]}),children:[u(`div`,{className:`export-preview-container`,ref:A}),u(`div`,{className:`export-sidebar`,children:u(`div`,{className:`export-controls`,children:[E.length>0&&u(X,{label:d(`app.export.diagram`),children:e=>u(`select`,{...e,value:C,onChange:e=>w(e.target.value),children:[u(`option`,{value:`main`,children:d(`app.export.mainDiagram`)}),E.map(e=>u(`option`,{value:e.id,children:e.name},e.id))]})}),u(X,{label:d(`app.export.theme`),children:e=>u(`select`,{...e,value:p,onChange:e=>{let t=exportThemeOf(e.target.value);t&&m(t)},children:Qd.map(e=>u(`option`,{value:e.value,children:d(e.key)},e.value))})}),u(X,{label:d(`app.export.schema`),children:e=>u(`select`,{...e,value:h,onChange:e=>g(e.target.value),children:$d.map(e=>u(`option`,{value:e.value??``,children:d(e.key)},e.value??`default`))})}),u(X,{label:d(`app.export.format`),children:e=>u(`select`,{...e,value:_,onChange:e=>v(e.target.value),children:ef.map(e=>u(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))})}),u(`label`,{className:`ui-choice`,children:[u(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked)}),u(`span`,{children:d(`app.export.background`)})]})]})})]}):null}var lf=Ti(`camunda-7`),uf=Ti(`operaton`),df=[[wi[`camunda-7`].bpmn,wi.operaton.bpmn],[wi[`camunda-7`].dmn,wi.operaton.dmn]],ff=`${Ai(`operaton`)}.`,pf=[...new Set(Di.map(e=>`${Ai(e)}.`))],mf=new RegExp(String.raw`(<${lf}:[^>]*[^/]>)([^<]*)(</${lf}:)`,`g`),hf=new RegExp(String.raw`(^</?|\s)${lf}:(?=[A-Za-z])`,`g`),gf=RegExp(`xmlns:${lf}=`,`g`);function movedPackages(e){return pf.reduce((e,t)=>e.split(t).join(ff),e)}function toOperaton(e){return df.some(([t])=>e.includes(`xmlns:${lf}="${t}"`))?df.reduce((e,[t,n])=>e.split(t).join(n),e.replace(mf,(e,t,n,r)=>`${t}${movedPackages(n)}${r}`)).replace(/<[^>]*>/g,e=>movedPackages(e).replace(hf,`$1${uf}:`).replace(gf,`xmlns:${uf}=`)):e}var _f={error:`<path d="M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5" />`,warning:`<path d="M8 3.5v6M8 12v.5" />`,readability:`<circle cx="8" cy="8" r="1" fill="currentColor" />`,success:`<path d="M3.5 8.5 6.5 11.5 12.5 4.5" />`};function pillOf(e){return e?.querySelector(`.bjsl-button`)??null}function glyph(e){let t=document.createElement(`span`);return t.className=`icon`,t.innerHTML=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${_f[e]}</svg>`,t}function countOf(e,t){let n=document.createElement(`span`);n.className=`bjsl-count bjsl-count-${e}`,n.append(glyph(e));let r=document.createElement(`span`);return r.textContent=String(t),n.append(r),n}function paintPill(e,t,n){if(!e)return;let r=Ke(t,n),i=[];t.errors>0&&i.push(countOf(`error`,t.errors)),t.warnings>0&&i.push(countOf(`warning`,t.warnings)),t.readability>0&&i.push(countOf(`readability`,t.readability));let a=t.errors+t.warnings+t.readability>0;i.length===0&&i.push(glyph(`success`)),e.replaceChildren(...i);let o=Y(a?`app.lint.showWhereTheyAreOn`:`app.lint.nothingToShowOnThe`);e.setAttribute(`aria-label`,`${r.replace(/\.$/,``)}. ${o}`),e.setAttribute(`title`,`${r.replace(/\.$/,``)}. ${o}`);let s=t.errors>0?`error`:t.warnings>0||n?`warning`:`success`;[`error`,`warning`,`success`,`inactive`].forEach(t=>e.classList.toggle(`bjsl-button-${t}`,t===s))}function segments(e){return e.replace(/\\/g,`/`).split(`/`).filter(Boolean)}function isFoundByFolder(e,t){let n=segments(e);if(n.length<3)return!1;let r=n.slice(0,-1);if(r[r.length-1]!==`element-templates`||r[r.length-2]!==`.camunda`)return!1;let i=r.slice(0,-2),a=segments(t).slice(0,-1);return i.length<=a.length&&i.every((e,t)=>e===a[t])}var vf=null;function connectorsPrimitive(){let e=null;try{e=G()}catch{e=null}return e?(vf?.bridge!==e&&(vf={bridge:e,primitive:{fetch:t=>typeof e?.fetchConnectorUrl==`function`?e.fetchConnectorUrl(t):Promise.reject(Error(`fetchConnectorUrl not supported`)),file:(t,n,r,i)=>typeof e?.connectorFile==`function`?e.connectorFile(t,n,r,i):Promise.reject(Error(`connectorFile not supported`))}}),vf.primitive):{fetch:()=>Promise.reject(Error(`PlatformBridge is not initialized`)),file:()=>Promise.reject(Error(`PlatformBridge is not initialized`))}}function useTemplatesCatalog(){let[e,t]=n({catalog:null,isLoading:!1,error:null,nextAttempt:null}),i=s(!0);f(()=>(i.current=!0,()=>{i.current=!1}),[]);let a=r(async e=>{i.current&&t(e=>({...e,isLoading:!0}));try{let n=await getCatalog(connectorsPrimitive(),{forceRefresh:e});if(!i.current)return;t({catalog:n?.catalog??null,isLoading:!1,error:n?.error??null,nextAttempt:n?.nextAttempt??null})}catch(e){if(!i.current)return;t(t=>({...t,isLoading:!1,error:e instanceof Error?e.message:Y(`app.marketplace.theConnectorTemplatesCouldNot`)}))}},[]),o=r(async e=>{let t=await loadTemplate(connectorsPrimitive(),e),n=e?.name??`template`;if(!t)throw Error(`The downloaded file for ${n} is missing; check for updates to download it again`);return t},[]);return{...e,load:a,templateOf:o}}function elementTypeOf(e){return e.elementType??e.appliesTo[0]??``}function elementTypeLabel(e){if(!e)return Y(`app.marketplace.anyElement`);let t=e.replace(/^bpmn:/,``),n=`app.element.kind.${t[0].toLowerCase()}${t.slice(1)}`,r=Y(n);if(r!==n)return r.charAt(0).toUpperCase()+r.slice(1);let i=t.replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase();return i.charAt(0).toUpperCase()+i.slice(1)}function engineRequirement(e){return e.engines.camunda??null}function isCompatible(e,t){let n=engineRequirement(e);return!t||!n||satisfiesEngine(n,t)!==!1}function count(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].map(([e,t])=>({value:e,count:t})).sort((e,t)=>t.count-e.count||e.value.localeCompare(t.value))}function facetsOf(e){let t=count(e.map(e=>e.category).filter(e=>e!==null));return{elementTypes:count(e.map(elementTypeOf)),categories:t.length>1?t:[]}}function matchesQuery(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.description??``,e.id,e.category??``,...e.keywords].some(e=>e.toLowerCase().includes(n))}function variantOf(e){let t=e.elementType;return typeof t==`string`?t:t&&typeof t==`object`&&typeof t.value==`string`?t.value:Array.isArray(e.appliesTo)?e.appliesTo.join(`|`):``}function isAmbiguous(e,t){return t.some(t=>t.id===e.id&&variantOf(t)!==variantOf(e))}function fileNameOf(e,t){let n=t&&e.elementType?`-${e.elementType.replace(/^bpmn:/,``)}`:``,r=e.version===null?``:`-v${e.version}`;return`${e.id}${n}${r}.json`.replace(/[^A-Za-z0-9._-]+/g,`-`)}function isInstalled(e,t,n){return t.some(t=>typeof t==`string`?t.split(/[\\/]/).pop()===n:t.id===e.id&&(t.version??null)===e.version&&variantOf(t)===variantOf(e))}function visibleTemplates(e,t,n,r){return e.filter(e=>matchesQuery(e,t.query)&&(t.elementType===null||elementTypeOf(e)===t.elementType)&&(t.category===null||e.category===t.category)&&(!t.installedOnly||r(e))&&(t.showIncompatible||isCompatible(e,n))).sort((e,t)=>Number(e.deprecated)-Number(t.deprecated))}var yf=new Set([`a`,`b`,`i`,`em`,`strong`,`p`,`br`,`ul`,`ol`,`li`,`code`,`pre`,`span`]),bf=new Set([`script`,`style`,`iframe`,`object`,`embed`,`noscript`]),xf=/^(?:https?:|mailto:)/i;function childrenOf(e,t=0){return!e||!e.childNodes||t>20?[]:Array.from(e.childNodes).map(e=>toChild(e,t+1)).filter(e=>e!==null)}function toChild(e,n){if(!e)return null;let r=e.nodeType;if(r===3)return e.textContent??``;if(r!==1)return null;let i=e,a=(i.tagName??``).toLowerCase();if(!a||bf.has(a))return null;if(!yf.has(a))return childrenOf(i,n);if(a===`a`){let e=i.getAttribute?.(`href`)??``;return xf.test(e.trim())?t(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`},childrenOf(i,n)):childrenOf(i,n)}return t(a,null,childrenOf(i,n))}function RichText({html:e}){if(!e)return t(`span`,null);if(typeof DOMParser>`u`)return t(`span`,null,e);try{let n=new DOMParser().parseFromString(e,`text/html`);return t(`span`,null,childrenOf(n.body))}catch{return t(`span`,null,e)}}function typeLabel(e){let t=`app.marketplace.type.${e}`,n=Y(t);return n===t?e:n}function installLabel(e,t){return e?`app.marketplace.installing`:t?`app.marketplace.installed`:`app.marketplace.install`}function asProperties(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.type==`string`):[]}function asGroups(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`):[]}function PropertyItem({property:e}){let t=Array.isArray(e.choices)?e.choices:[];return u(`div`,{className:`template-detail-property`,children:[u(`div`,{className:`template-detail-property-header`,children:[u(`span`,{className:`template-detail-property-label`,children:[e.label||e.id||Y(`app.marketplace.unnamed`),e.constraints?.notEmpty===!0&&u(`span`,{className:`template-detail-required`,children:`*`})]}),u(`span`,{className:`template-detail-property-type`,children:typeLabel(e.type)})]}),typeof e.description==`string`&&u(`p`,{className:`template-detail-property-description`,children:u(RichText,{html:e.description})}),u(`div`,{className:`template-detail-property-meta`,children:[u(`span`,{className:`template-detail-binding`,children:[e.binding?.type,e.binding?.name&&u(`code`,{className:`template-detail-binding-name`,children:e.binding.name})]}),e.feel&&u(`span`,{className:`template-detail-feel`,children:Y(`app.marketplace.feelIs`,{feel:e.feel})})]}),t.length>0&&u(`div`,{className:`template-detail-choices`,children:[u(`span`,{className:`template-detail-choices-label`,children:Y(`app.marketplace.options`)}),u(`ul`,{className:`template-detail-choices-list`,children:[t.slice(0,5).map((e,t)=>u(`li`,{children:String(e.name)},t)),t.length>5&&u(`li`,{className:`template-detail-choices-more`,children:Y(`app.common.more`,{number:t.length-5})})]})]}),e.value!==void 0&&e.type!==`Hidden`&&u(`div`,{className:`template-detail-default`,children:[u(`span`,{children:Y(`app.marketplace.default`)}),u(`code`,{children:String(e.value)})]})]})}function TemplateDetail({summary:e,engineVersion:t,onBack:r,onInstall:i,isInstalling:a,isInstalled:s,templateOf:c}){let[l,d]=n(null),[p,m]=n(null),[h,g]=n(new Set);f(()=>{d(null),m(null);let t=!1;return c(e).then(e=>{t||(d(e),g(new Set(asGroups(e.groups).slice(0,3).map(e=>e.id))))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,c]);let toggle=e=>g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),_=asProperties(l?.properties).filter(e=>e.type!==`Hidden`),v=[...asGroups(l?.groups),{id:`_ungrouped`,label:Y(`app.marketplace.otherProperties`)}],y=new Set(v.map(e=>e.id)),groupOf=e=>e.group&&y.has(e.group)?e.group:`_ungrouped`,b=engineRequirement(e),x=isCompatible(e,t);return u(`div`,{className:`template-detail`,children:[u(`div`,{className:`template-detail-header`,children:[u(`button`,{type:`button`,className:`sidebar__icon template-detail-back`,"aria-label":Y(`app.marketplace.backToTheTemplates`),title:Y(`app.marketplace.backToTheTemplates`),onClick:r,children:u(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:u(`path`,{d:`M10 3.5L5.5 8l4.5 4.5`})})}),u(`div`,{className:`template-detail-header-info`,children:[u(`h3`,{className:`template-detail-title`,children:e.name}),e.version!==null&&u(`span`,{className:`template-detail-version`,children:[`v`,e.version]})]}),u(`button`,{type:`button`,className:`ui-button ${s?``:`ui-button--primary`}`,onClick:()=>i(e),disabled:s||a,children:Y(installLabel(a,s))})]}),u(`div`,{className:`template-detail-body`,children:[p&&u(`div`,{className:`template-detail-error`,children:u(`span`,{children:p})}),!p&&!l&&u(`div`,{className:`template-detail-loading`,children:[u(`div`,{className:`marketplace-spinner`}),u(`span`,{children:Y(`app.marketplace.loadingTemplateDetails`)})]}),l&&u(o,{children:[u(`section`,{className:`template-detail-section`,children:[u(`h3`,{className:`template-detail-section-title`,children:Y(`app.marketplace.overview`)}),e.deprecated&&u(`p`,{className:`template-detail-deprecated`,children:[Y(`app.marketplace.deprecated`),e.deprecatedMessage?`: ${e.deprecatedMessage}`:``]}),e.description&&u(`p`,{className:`template-detail-description`,children:u(RichText,{html:e.description})}),u(`div`,{className:`template-detail-meta-grid`,children:[u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:Y(`app.marketplace.elementType`)}),u(`span`,{className:`template-detail-meta-value`,children:elementTypeLabel(elementTypeOf(e))})]}),u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:Y(`app.marketplace.appliesTo`)}),u(`span`,{className:`template-detail-meta-value`,children:(Array.isArray(e?.appliesTo)?e.appliesTo:[]).map(elementTypeLabel).join(`, `)})]}),b&&u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:Y(`app.marketplace.engine`)}),u(`span`,{className:`template-detail-meta-value`,children:[`Camunda `,b,!x&&t&&Y(`app.marketplace.thisDiagramTargets`,{version:t})]})]}),u(`div`,{className:`template-detail-meta-item`,children:[u(`span`,{className:`template-detail-meta-label`,children:Y(`app.marketplace.properties`)}),u(`span`,{className:`template-detail-meta-value`,children:Y(`app.marketplace.configurable`,{number:_.length})})]})]}),e.documentationRef&&u(`a`,{href:e.documentationRef,target:`_blank`,rel:`noopener noreferrer`,className:`template-detail-docs-link`,children:Y(`app.marketplace.viewDocumentation`)})]}),u(`section`,{className:`template-detail-section`,children:[u(`h3`,{className:`template-detail-section-title`,children:Y(`app.marketplace.configurationProperties`)}),u(`div`,{className:`template-detail-groups`,children:v.map(e=>{let t=_.filter(t=>groupOf(t)===e.id);if(t.length===0)return null;let n=h.has(e.id);return u(`div`,{className:`template-detail-group`,children:[u(`button`,{className:`template-detail-group-header ${n?`expanded`:``}`,onClick:()=>toggle(e.id),children:[u(`span`,{className:`template-detail-group-title`,children:[e.label,u(`span`,{className:`template-detail-group-count`,children:[`(`,t.length,`)`]})]}),u(`svg`,{className:`template-detail-group-chevron`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:u(`path`,{d:`M4 6l4 4 4-4`})})]}),n&&u(`div`,{className:`template-detail-group-content`,children:t.map((e,t)=>u(PropertyItem,{property:e},e.id??t))})]},e.id)})})]})]})]})]})}var Sf=864e5;function startOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function clockTime(e){return e.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function formatRelativeTime(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=Math.round((startOfDay(n)-startOfDay(t))/Sf);return r===0?n.getTime()>t.getTime()?Y(`app.marketplace.todayAt`,{time:clockTime(n)}):Y(`app.marketplace.today`):r===1?Y(`app.marketplace.tomorrowAt`,{time:clockTime(n)}):r===-1?Y(`app.marketplace.yesterday`):r<-1&&r>-7?Y(`app.marketplace.daysAgo`,{count:-r}):n.toLocaleDateString()}var Cf={query:``,elementType:null,category:null,installedOnly:!1,showIncompatible:!1};function TemplateIcon({summary:e}){if(e?.icon&&typeof e.icon==`string`&&e.icon.startsWith(`data:image/`))return u(`img`,{src:e.icon,alt:``,className:`marketplace-card-icon-img`});let t=(e?.name??``).trim().charAt(0).toUpperCase()||`?`;return u(`span`,{className:`marketplace-card-letter`,children:t})}function TemplateCard({summary:e,compatible:t,installed:n,installing:r,onInstall:i,onDetails:a}){let o=engineRequirement(e);return u(`div`,{className:`marketplace-compact-card ${t?``:`marketplace-compact-card--incompatible`}`,children:[u(`div`,{className:`marketplace-card-icon`,children:u(TemplateIcon,{summary:e})}),u(`div`,{className:`marketplace-card-content`,children:[u(`div`,{className:`marketplace-card-header`,children:u(`h3`,{className:`marketplace-card-name`,title:e.name,children:e.name})}),e.description&&u(`p`,{className:`marketplace-card-description`,children:e.description}),u(`div`,{className:`marketplace-card-meta`,children:[u(`span`,{className:`marketplace-card-badge`,children:elementTypeLabel(elementTypeOf(e))}),e.version!==null&&u(`span`,{className:`marketplace-card-badge`,children:[`v`,e.version]}),o&&u(`span`,{className:`marketplace-card-badge ${t?``:`marketplace-card-badge--warning`}`,title:t?void 0:Y(`app.marketplace.needsANewerCamundaEngine`),children:[`Camunda `,o]}),e.deprecated&&u(`span`,{className:`marketplace-card-badge marketplace-card-badge--warning`,title:e.deprecatedMessage??void 0,children:Y(`app.marketplace.deprecated`)})]}),u(`div`,{className:`marketplace-card-actions`,children:[u(`button`,{className:`marketplace-card-details`,onClick:()=>a(e),children:Y(`app.marketplace.details`)}),u(`button`,{className:`marketplace-card-install ${n?`installed`:``}`,onClick:()=>i(e),disabled:n||r,children:Y(r?`app.marketplace.installing`:n?`app.marketplace.installed`:`app.marketplace.install`)})]})]})]})}function FacetList({title:e,facets:t,selected:n,label:r,onSelect:i,total:a}){return t.length===0?null:u(`div`,{className:`marketplace-sidebar-section`,children:[u(`h4`,{className:`marketplace-sidebar-title`,children:e}),u(`nav`,{className:`marketplace-sidebar-nav`,children:[u(`button`,{className:`marketplace-sidebar-item ${n===null?`active`:``}`,onClick:()=>i(null),children:[u(`span`,{className:`marketplace-sidebar-item-name`,children:Y(`app.marketplace.all`)}),u(`span`,{className:`marketplace-sidebar-item-count`,children:a})]}),t.map(e=>u(`button`,{className:`marketplace-sidebar-item ${n===e.value?`active`:``}`,onClick:()=>i(e.value),children:[u(`span`,{className:`marketplace-sidebar-item-name`,children:r(e.value)}),u(`span`,{className:`marketplace-sidebar-item-count`,children:e.count})]},e.value))]})]})}function TemplatesMarketplace({isOpen:e,onClose:t,apiClient:i,installedTemplates:a,engineVersion:c,onTemplateInstalled:d}){let{catalog:p,isLoading:m,error:h,nextAttempt:g,load:_,templateOf:v}=useTemplatesCatalog(),[y,b]=n(Cf),[x,S]=n(null),[C,w]=n(null),T=s(!1);f(()=>{e?T.current||(T.current=!0,_(!1)):(T.current=!1,w(null))},[e,_]);let E=p?.newest??[],D=l(()=>{let e=new Map;for(let t of E)e.set(t.key,fileNameOf(t,isAmbiguous(t,E)));return e},[E]),O=r(e=>isInstalled(e,a,D.get(e.key)??fileNameOf(e,!1)),[a,D]),k=l(()=>E.filter(e=>isCompatible(e,c)).length,[E,c]),A=E.length-k,j=l(()=>y.showIncompatible?E:E.filter(e=>isCompatible(e,c)),[E,c,y.showIncompatible]),M=l(()=>facetsOf(j),[j]),N=l(()=>visibleTemplates(E,y,c,O),[E,y,c,O]),update=e=>b(t=>({...t,...e})),P=r(async e=>{S(e.key);try{let t=await i.bpmn.getConfig().catch(()=>null),n=JSON.stringify(await v(e),null,2),r=await i.file.chooseFile(`json`,{title:Y(`app.marketplace.saveElementTemplate`,{name:e.name}),description:Y(`app.marketplace.selectLocationToSaveThe`),mode:`save`,defaultFileName:D.get(e.key)??fileNameOf(e,!1),defaultDirectory:t?.elementTemplatesFolder??void 0});if(!r)return;await i.file.saveFile(r,n);let a=t?.bpmnFilePath??``;d(r,n),a&&!isFoundByFolder(r,a)?$.info(Y(`app.marketplace.templateSavedPenstockFindsTemplates`,{name:e.name})):$.success(Y(`app.marketplace.templateInstalled`,{name:e.name})),w(null)}catch(e){console.error(`Installing the template failed:`,e),$.error(Y(`app.marketplace.unableToInstallTheTemplate`,{failure:e instanceof Error?e.message:String(e)}))}finally{S(null)}},[i,D,d,v]);if(!e)return null;let F=y.query.trim()!==``||y.elementType!==null||y.category!==null||y.installedOnly;return u(dn,{title:Y(`app.marketplace.connectorTemplates`),size:`xlarge`,body:`split`,backdrop:`close`,onClose:()=>C?w(null):t(),class:`marketplace-dialog`,children:u(`div`,{className:`marketplace-main`,children:[u(`aside`,{className:`marketplace-sidebar`,children:[u(`div`,{className:`marketplace-sidebar-search`,children:u(`input`,{type:`text`,placeholder:Y(`app.common.search`),"aria-label":Y(`app.marketplace.searchTemplatesByNameDescription`),value:y.query,onInput:e=>update({query:e.target.value}),className:`marketplace-sidebar-input`})}),u(`div`,{className:`marketplace-sidebar-installed-filter`,children:[u(`button`,{className:`marketplace-installed-checkbox ${y.installedOnly?`active`:``}`,onClick:()=>update({installedOnly:!y.installedOnly}),children:u(`span`,{className:`marketplace-installed-checkbox-label`,children:Y(`app.marketplace.installedOnly`)})}),c&&A>0&&u(`button`,{className:`marketplace-installed-checkbox ${y.showIncompatible?`active`:``}`,onClick:()=>update({showIncompatible:!y.showIncompatible}),title:Y(`app.marketplace.thisDiagramTargetsCamunda`,{engineVersion:c}),children:u(`span`,{className:`marketplace-installed-checkbox-label`,children:Y(`app.marketplace.showForNewerEngines`,{number:A})})})]}),u(FacetList,{title:Y(`app.marketplace.elementType`),facets:M.elementTypes,selected:y.elementType,label:elementTypeLabel,onSelect:e=>update({elementType:e}),total:j.length}),u(FacetList,{title:Y(`app.marketplace.category`),facets:M.categories,selected:y.category,label:e=>e,onSelect:e=>update({category:e}),total:j.length})]}),u(`main`,{className:`marketplace-content`,children:[C&&u(TemplateDetail,{summary:C,engineVersion:c,onBack:()=>w(null),onInstall:e=>void P(e),isInstalling:x===C.key,isInstalled:O(C),templateOf:v}),!C&&p&&u(`div`,{className:`marketplace-source`,children:[Y(`app.marketplace.camundaConnectors`,{ref:p.ref}),p.checkedAt?Y(`app.marketplace.checked`,{when:formatRelativeTime(p.checkedAt)}):``,u(`button`,{onClick:()=>void _(!0),disabled:m,children:Y(`app.marketplace.checkForUpdates`)})]}),!C&&p&&h&&!m&&u(`div`,{className:`marketplace-warning`,children:u(`span`,{children:Y(`app.marketplace.couldNotCheckForANewerRelease`,{error:h})})}),!C&&!p&&h&&!m&&u(`div`,{className:`marketplace-error`,children:[u(`span`,{children:[Y(`app.marketplace.couldNotDownloadConnectors`,{error:h}),g?Y(`app.marketplace.triedAgainAfter`,{when:formatRelativeTime(g)}):``]}),u(`button`,{onClick:()=>void _(!0),children:Y(`app.common.retry`)})]}),!C&&m&&u(`div`,{className:`marketplace-loading`,children:[u(`div`,{className:`marketplace-spinner`}),u(`span`,{children:Y(p?`app.marketplace.checkingForANewerRelease`:`app.marketplace.downloadingTheConnectorTemplatesFrom`)})]}),!C&&p&&!m&&N.length===0&&u(`div`,{className:`marketplace-empty`,children:[u(`span`,{children:Y(F?`app.marketplace.noTemplateMatchesTheFilters`:`app.marketplace.noTemplateFitsThisDiagram`)}),F&&u(`button`,{className:`marketplace-empty-action`,onClick:()=>b(Cf),children:Y(`app.marketplace.clearFilters`)})]}),!C&&p&&!m&&N.length>0&&u(o,{children:[u(`div`,{className:`marketplace-results-header`,children:u(`span`,{className:`marketplace-results-count`,children:[Y(`app.marketplace.templateCount`,{count:N.length}),c&&!y.showIncompatible?Y(`app.marketplace.forCamunda`,{version:c}):``]})}),u(`div`,{className:`marketplace-cards-grid`,children:N.map(e=>u(TemplateCard,{summary:e,compatible:isCompatible(e,c),installed:O(e),installing:x===e.key,onInstall:e=>void P(e),onDetails:w},e.key))})]})]})]})})}var wf=`penstock-missing-template`,Tf=[[`zeebe:modelerTemplate`,`zeebe:modelerTemplateVersion`],[`camunda:modelerTemplate`,`camunda:modelerTemplateVersion`]],Ef=new WeakMap;function keyOf$1(e){return`${e.id}@${e.version??`_`}`}e(keyOf$1,`keyOf`);function distinct(e){return[...new Map(e.map(e=>[keyOf$1(e),e])).values()]}function attribute(e,t){return e?.get?.(t)??e?.$attrs?.[t]}function engineVersionOf(e){let t=e?.getDefinitions?.();if(!t)return null;let n=attribute(t,`modeler:executionPlatform`),r=attribute(t,`modeler:executionPlatformVersion`);return typeof r!=`string`||!/^\d+\.\d+/.test(r)||typeof n==`string`&&n!==`Camunda Cloud`?null:r}function referencesOf$1(e){let t=new Map,n=new Set;for(let r of e.get(`elementRegistry`).getAll()){let e=r.businessObject;if(e&&!n.has(e)&&r.type!==`label`){n.add(e);for(let[n,i]of Tf){let a=attribute(e,n);if(typeof a!=`string`||!a)continue;let o=attribute(e,i),s=typeof o==`number`?o:typeof o==`string`?Number(o):NaN,c=Number.isInteger(s)?s:null,l=String(e.$type),u=`${a}@${c??`_`}#${l}`,d=t.get(u)??{id:a,version:c,elementType:l,elementIds:[],zeebe:n.startsWith(`zeebe:`)};d.elementIds.push(r.id),t.set(u,d)}}}return[...t.values()]}e(referencesOf$1,`referencesOf`);function cachedTemplatesOf(e){return e&&typeof e==`object`?Ef.get(e)??[]:[]}function clearBadges(e){e.get(`overlays`,!1)?.remove({type:wf})}function showBadges(e,t,n){let r=e.get(`overlays`,!1),i=e.get(`elementRegistry`);if(r)for(let e of t)for(let t of e.elementIds){if(!i.get(t))continue;let a=document.createElement(`div`);a.className=`penstock-missing-template`;let o=document.createElement(`span`),s=e.version===null?``:` version ${e.version}`;o.textContent=Y(`app.marketplace.templateNotDownloaded`),a.title=Y(`app.marketplace.isNotInTheProject`,{id:e.id,version:s});let c=document.createElement(`button`);c.type=`button`,c.textContent=Y(`app.marketplace.download`),c.addEventListener(`click`,e=>{e.stopPropagation(),c.disabled=!0,n()}),a.append(o,c),r.add(t,wf,{position:{top:-28,left:0},html:a})}}async function applyCachedTemplates(e,t){let n=e?.get?.(`elementTemplates`,!1);if(!n)return{added:0,missing:[]};clearBadges(e);let r=referencesOf$1(e).filter(e=>!n.get(e.id,e.version??void 0));if(r.length===0)return{added:0,missing:[]};let{templates:i,missing:a}=await resolveTemplates(connectorsPrimitive(),r);if(i.length>0){let t=new Set(n.getAll().map(keyOf$1)),r=i.filter(e=>!t.has(keyOf$1(e)));n.set([...n.getAll(),...r]),Ef.set(e,distinct([...cachedTemplatesOf(e),...i]))}let o=r.filter(e=>e.zeebe&&a.some(t=>t.id===e.id&&t.version===e.version&&t.elementType===e.elementType));return showBadges(e,o,()=>{getCatalog(connectorsPrimitive(),{forceRefresh:!0}).then(({catalog:n,error:r})=>{if(!n)throw Error(r??`The connector templates could not be downloaded`);return applyCachedTemplates(e,t)}).then(e=>{e.missing.length>0&&t(Y(`app.marketplace.notAmongConnectors`,{ids:e.missing.map(e=>e.id).join(`, `)}))}).catch(n=>{t(n instanceof Error?n.message:String(n)),applyCachedTemplates(e,t)})}),{added:i.length,missing:o}}var Df=function(e){return e.CAMUNDA_8=`CAMUNDA_8`,e.CAMUNDA_7=`CAMUNDA_7`,e.OPERATON=`OPERATON`,e.CIB_SEVEN=`CIB_SEVEN`,e.FLOWABLE=`FLOWABLE`,e.ACTIVITI=`ACTIVITI`,e.CLASSIC_BPMN=`CLASSIC_BPMN`,e}({}),Of=function(e){return e.NONE=`NONE`,e.GROOVY=`GROOVY`,e.JAVASCRIPT=`JAVASCRIPT`,e}({}),kf=[{engine:Df.CAMUNDA_8,label:`Camunda 8`},{engine:Df.OPERATON,label:`Operaton`},{engine:Df.CIB_SEVEN,label:`CIB seven`},{engine:Df.CAMUNDA_7,label:`Camunda 7`},{engine:Df.FLOWABLE,label:`Flowable`},{engine:Df.ACTIVITI,label:`Activiti`},{engine:Df.CLASSIC_BPMN,label:`Classic BPMN`}];function EngineQuestion({apiClient:e,onChosen:t}){let[r,i]=n(!1),a=s(!0);f(()=>(a.current=!0,()=>{a.current=!1}),[]);let choose=async n=>{i(!0);try{let r={engine:n,scriptType:Of.NONE,elementTemplates:[]};await e?.bpmn?.saveProjectConfig(r),t(n)}catch(e){$.error(Y(`app.engineQuestion.theEngineCouldNotBe`,{error:e instanceof Error?e.message:String(e)}))}finally{a.current&&i(!1)}};return u(`div`,{class:`engine-question`,children:u(`div`,{class:`engine-question__card`,children:[u(Z,{title:Y(`app.engineQuestion.whichEngineRunsThisDiagram`),hint:Y(`app.engineQuestion.itDecidesThePaletteAnd`)}),u(`div`,{class:`engine-question__choices`,children:kf.map(e=>u(`button`,{type:`button`,class:`ui-button`,disabled:r,onClick:()=>choose(e.engine),children:e.label},e.engine))})]})})}async function bpmnViewer(e){let{default:t}=await Vi(async()=>{let{default:e}=await import(`./Viewer-BcpDlvg_.js`).then(e=>e.n);return{default:e}},__vite__mapDeps([41,1,4,5,29,18]),import.meta.url);return new t({container:e})}function offScreen(){let e=document.createElement(`div`);return e.style.cssText=`position:fixed;left:-10000px;top:0;width:1200px;height:800px`,document.body.appendChild(e),e}async function drawingResult(e,t=bpmnViewer){let n=offScreen(),r=null;try{return r=await t(n),await r.importXML(e),checkDiagram(r)}finally{r?.destroy(),n.remove()}}var defaultDrawing=async e=>drawingResult(e);function of(e,t,n,r,i,a,o){return{family:e,rule:t,severity:n??`warning`,title:r,message:i,elements:a,...o?{where:o}:{}}}function severityOf$1(e,t){return Hi(e,t)?.severity===`error`?`error`:`warning`}e(severityOf$1,`severityOf`);function unreadable(e,t,n){let r=e.trim()===``;return of(`file`,`file-unreadable`,`error`,Y(r?`app.findings.theFileIsEmpty`:`app.findings.theFileCannotBeRead`),r?Y(`app.findings.nothingInIt`):Y(`app.findings.notValid`,{what:t,reason:n?Y(`app.findings.because`,{reason:n}):Y(`app.findings.soItCannotBeOpened`)}),[])}async function bpmn(e,t,n){let r=await On(e);if(!r)return[unreadable(e,`BPMN XML`,null)];let i=await n(e),a=i.defects.map(e=>of(`drawing`,e.kind,severityOf$1(`drawing`,e.kind),Ki(`drawing`,e.kind),e.detail,e.elements,e.where)),o=t(r);if(!o)return a;let s=(await st(r,o)).map(e=>{let t=Jt(e.rule);return of(t,t===`bpmnlint`?`bpmnlint/${e.rule}`:e.rule,e.severity,Ki(t,e.rule),e.message,e.elements)});return a.push(...Ht(s,i.defects)),a}async function dmn(e){let{rootElement:t}=await Na(e);return Tr(t).map(e=>of(`table`,e.kind,severityOf$1(`table`,e.kind),e.title,e.detail,[]))}function form(e){return Fa(JSON.parse(e)).map(e=>of(`form`,e.kind,severityOf$1(`form`,e.kind),e.title,e.detail,e.ids))}async function findingsOf$1(e,t,n,r=defaultDrawing){let i=Bn(e);if(!i)return[];let a=Ln(e);try{return i===`bpmn`?await bpmn(t,n??(()=>null),r):i===`dmn`?await dmn(t):form(t)}catch(e){return[unreadable(t,a,ja(Pa(e)))]}}e(findingsOf$1,`findingsOf`);var Af=`patch.bpmn`;function fingerprint(e){return`${e.rule}|${[...e.elements].sort().join(`,`)}|${e.message}`}function fresh(e,t){let n=new Map;for(let t of e)n.set(fingerprint(t),(n.get(fingerprint(t))??0)+1);let r=[];for(let e of t){let t=fingerprint(e),i=n.get(t)??0;i>0?n.set(t,i-1):r.push(e)}return{added:r,resolved:[...n.values()].reduce((e,t)=>e+t,0)}}function referencesOf(e){switch(e.op){case`add`:return[e.after];case`connect`:return[e.from,e.to];default:return[e.id]}}function statusOf$1(e){return e.some(e=>e.severity===`error`)?`error`:e.length>0?`warning`:`ok`}e(statusOf$1,`statusOf`);function applicable(e,t){let n=t.filter(e=>!e.error).map(e=>e.index);return{patch:{...e,operations:n.map(t=>e.operations[t])},indexes:n}}async function checkPatch(e,t,n){let r=await ka(e,t,n),i=r,a=t.operations.map((e,t)=>t);if(!r.ok&&r.steps.length>0){let o=applicable(t,r.steps);a=o.indexes,i=o.indexes.length>0?await ka(e,o.patch,n):{ok:!0,xml:e,steps:[]}}let o=r.steps.map(e=>({index:e.index,status:e.error?`error`:`ok`,...e.error?{error:e.error}:{},...e.skipped?{skipped:!0}:{},findings:[]}));if(!i.ok||!i.xml||a.length===0)return{ok:r.ok,steps:o,effects:r.steps,patchFindings:[],resolved:0,xml:r.xml};let[s,c]=await Promise.all([findingsOf$1(Af,e,n.setup,n.drawing),findingsOf$1(Af,i.xml,n.setup,n.drawing)]),{added:l,resolved:u}=fresh(s,c),d=i.steps.map((e,n)=>{let r=a[n],i=t.operations[r];return{original:r,touched:new Set(e.touched),referenced:new Set(referencesOf(i))}}),f=[];for(let e of l){let t=d.filter(t=>e.elements.some(e=>t.touched.has(e))),n=t.length>0?t:d.filter(t=>e.elements.some(e=>t.referenced.has(e)));if(n.length===0)f.push(e);else for(let t of n)o[t.original].findings.push(e)}for(let e of o)e.error||(e.status=statusOf$1(e.findings));return{ok:r.ok,steps:o,effects:r.steps,patchFindings:f,resolved:u,xml:r.xml}}function isDraft(e){return Object.hasOwn(e,`patch`)}var InMemoryProposalSource=class{listeners=new Set;counter=0;clock;name;constructor(e={}){this.clock=e.clock??Date.now,this.name=e.name??`memory`}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}propose(e){let t=isDraft(e)?e:{patch:e};this.counter+=1;let n={id:`proposal-${this.counter}`,patch:{...t.patch,operations:[...t.patch.operations]},source:t.source??this.name,createdAt:this.clock(),...t.title??t.patch.title?{title:t.title??t.patch.title}:{}};for(let e of[...this.listeners])e(n);return n}},jf=new InMemoryProposalSource({name:`editor`});function Glyph({path:e}){return u(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:u(`path`,{d:e})})}var Mf=`M3.5 8.5l3 3 6-7`,Nf=`M4 4l8 8M12 4l-8 8`,Pf=`M10 3.5L5.5 8l4.5 4.5`,Ff=`M6 3.5L10.5 8 6 12.5`;function useReviewState(e){let[t,r]=n(e.getState());return f(()=>(r(e.getState()),e.subscribe(r)),[e]),t}function statusOf(e){return xt(e)?`error`:e.check.status}function statusWord(e){return xt(e)?Y(`app.ghost.status.blocked`):e.check.status===`error`?Y(`app.ghost.status.error`):e.check.status===`warning`?Y(`app.ghost.status.warning`):Y(`app.ghost.status.ok`)}function StatusGlyph({status:e}){return e===`ok`?u(`span`,{class:`ghost-bar__status-glyph ghost-bar__status-glyph--ok`,"aria-hidden":`true`,children:u(Glyph,{path:Mf})}):u(ce,{severity:e})}function typingTarget(e){let t=e;return!t||!t.tagName?!1:t.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName)}function GhostReviewBar({review:e,hidden:t=!1}){let r=useReviewState(e),[i,a]=n(!1),[c,l]=n(!1),[d,p]=n(``),m=s(null),h=r.phase===`review`&&!t;if(f(()=>{if(!h)return;let listen=t=>{if(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey||typingTarget(t.target))return;let n=!!m.current?.contains(t.target),r=t.key;r===`j`||r===`J`||n&&(r===`ArrowDown`||r===`ArrowRight`)?(t.preventDefault(),e.next()):(r===`k`||r===`K`||n&&(r===`ArrowUp`||r===`ArrowLeft`))&&(t.preventDefault(),e.previous())};return document.addEventListener(`keydown`,listen),()=>document.removeEventListener(`keydown`,listen)},[h,e]),f(()=>p(``),[r.focus,r.proposalId]),r.phase===`idle`||t)return null;let g=Te(r),_=r.items[r.focus],v=u(`div`,{class:`ghost-bar__announce`,role:`status`,children:r.announcement});if(r.phase===`checking`)return u(`aside`,{class:`ghost-bar`,ref:m,"aria-label":Y(`app.ghost.region`),children:[u(`p`,{class:`ghost-bar__line type-body`,children:Y(`app.ghost.checking`)}),v]});if(r.phase===`done`){let t=e.checkpoints.latest();return u(`aside`,{class:`ghost-bar`,ref:m,"aria-label":Y(`app.ghost.region`),children:[u(`header`,{class:`ghost-bar__head`,children:[u(`h2`,{class:`ghost-bar__title type-dialog-title`,children:r.title??Y(`app.ghost.title`)}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,onClick:()=>e.dismiss(),title:Y(`app.ghost.close`),"aria-label":Y(`app.ghost.close`),children:u(Glyph,{path:Nf})})]}),u(`p`,{class:`ghost-bar__line type-body`,children:Y(`app.ghost.reviewed`,g)}),t&&u(`details`,{class:`ghost-bar__limits`,children:[u(`summary`,{class:`type-help`,children:Y(`app.ghost.checkpoint.heading`)}),u(`p`,{class:`type-help`,children:Y(`app.ghost.checkpoint.kept`)}),u(`ul`,{class:`type-help`,children:t.limits.map(e=>u(`li`,{children:e},e))})]}),v]})}let send=()=>{_&&e.comment(_.index,d)&&p(``)};return u(`aside`,{class:`ghost-bar`,ref:m,"aria-label":Y(`app.ghost.region`),"data-testid":`ghost-bar`,children:[u(`header`,{class:`ghost-bar__head`,children:[u(`h2`,{class:`ghost-bar__title type-dialog-title`,children:r.title??Y(`app.ghost.title`)}),u(`span`,{class:`ghost-bar__summary type-help`,children:Y(`app.ghost.summary`,{pending:g.pending,total:g.total})}),g.attention>0&&u(`span`,{class:`ghost-bar__attention type-badge`,children:Y(`app.ghost.attention`,{count:g.attention})}),r.queued>0&&u(`span`,{class:`ghost-bar__summary type-help`,children:Y(`app.ghost.queued`,{count:r.queued})}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,"aria-expanded":!c,onClick:()=>l(!c),title:Y(c?`app.ghost.expand`:`app.ghost.collapse`),"aria-label":Y(c?`app.ghost.expand`:`app.ghost.collapse`),children:u(Glyph,{path:c?`M4 6.5l4 4 4-4`:`M4 9.5l4-4 4 4`})})]}),c?v:u(o,{children:[u(`div`,{class:`ghost-bar__actions`,children:[u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,onClick:()=>e.previous(),title:Y(`app.ghost.previous`),"aria-label":Y(`app.ghost.previous`),children:u(Glyph,{path:Pf})}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__icon`,onClick:()=>e.next(),title:Y(`app.ghost.next`),"aria-label":Y(`app.ghost.next`),children:u(Glyph,{path:Ff})}),u(`span`,{class:`ghost-bar__spacer`}),u(`button`,{type:`button`,class:`ui-button`,"data-safe":r.whole?`true`:void 0,onClick:()=>e.rejectAll(),children:r.whole?Y(`app.ghost.rejectChange`):Y(`app.ghost.rejectAll`)}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>void e.acceptAll(),children:r.whole?Y(`app.ghost.acceptChange`):Y(`app.ghost.acceptAll`)})]}),r.whole&&u(`p`,{class:`ghost-bar__line type-help`,children:Y(`app.ghost.wholeHint`)}),r.whole&&u(C,{proposal:r.proposalId}),_&&u(`section`,{class:`ghost-bar__current`,"aria-label":_.label,children:[u(`div`,{class:`ghost-bar__row`,children:[u(`span`,{class:`ghost-bar__chip ghost-bar__chip--${_.kind} type-badge`,children:_.chip}),u(`span`,{class:`ghost-bar__label type-body`,children:_.label}),u(`span`,{class:`ghost-bar__status-word ghost-bar__status-word--${statusOf(_)} type-help`,children:[u(StatusGlyph,{status:statusOf(_)}),statusWord(_)]})]}),(_.check.error||_.check.messages.length>0)&&u(`ul`,{class:`ghost-bar__messages type-help`,children:(_.check.error?[_.check.error]:_.check.messages).map(e=>u(`li`,{children:e},e))}),!r.whole&&u(`div`,{class:`ghost-bar__actions`,children:[u(`button`,{type:`button`,class:`ui-button`,onClick:()=>e.reject(_.index),children:[u(Glyph,{path:Nf}),Y(`app.ghost.reject`)]}),u(`button`,{type:`button`,class:`ui-button ui-button--primary`,disabled:xt(_),onClick:()=>void e.accept(_.index),children:[u(Glyph,{path:Mf}),Y(`app.ghost.accept`)]})]}),u(`div`,{class:`ghost-bar__comment`,children:[u(`input`,{class:`ui-input type-input`,type:`text`,value:d,"aria-label":Y(`app.ghost.comment`),onInput:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),send())}}),u(`button`,{type:`button`,class:`ui-button`,disabled:!d.trim(),onClick:send,children:Y(`app.ghost.sendComment`)})]})]}),u(`button`,{type:`button`,class:`ui-button ui-button--quiet ghost-bar__toggle`,"aria-expanded":i,onClick:()=>a(!i),children:Y(i?`app.ghost.hideAll`:`app.ghost.showAll`)}),i&&u(`ul`,{class:`ghost-bar__list`,children:r.items.map(t=>u(`li`,{children:u(`button`,{type:`button`,class:`ghost-bar__item type-body`,"aria-current":t.index===r.focus?`true`:void 0,"data-decision":t.decision,onClick:()=>e.focus(t.index),children:[u(`span`,{class:`ghost-bar__chip ghost-bar__chip--${t.kind} type-badge`,children:t.chip}),u(`span`,{class:`ghost-bar__label`,children:t.label}),t.decision===`pending`?u(StatusGlyph,{status:statusOf(t)}):u(`span`,{class:`type-help`,children:t.decision===`accepted`?Y(`app.ghost.decided.accepted`):Y(`app.ghost.decided.rejected`)})]})},t.index))}),r.patchFindings.length>0&&u(`div`,{class:`ghost-bar__loose`,children:[u(`h3`,{class:`type-section-heading`,children:Y(`app.ghost.patchFindings`)}),u(`ul`,{class:`type-help`,children:r.patchFindings.map(e=>u(`li`,{children:e},e))})]}),v]})]})}var If=20;function limitsOfUndo(){return[Y(`app.ghost.checkpoint.limit.comments`),Y(`app.ghost.checkpoint.limit.otherFiles`),Y(`app.ghost.checkpoint.limit.deployed`),Y(`app.ghost.checkpoint.limit.memory`)]}var CheckpointLog=class{entries=[];counter=0;clock;constructor(e=Date.now){this.clock=e}record(e,t){this.counter+=1;let n={id:this.counter,takenAt:this.clock(),xml:e,labels:t.labels,limits:limitsOfUndo(),...t.title?{title:t.title}:{}};return this.entries.push(n),this.entries.length>If&&this.entries.shift(),n}list(){return[...this.entries]}latest(){return this.entries[this.entries.length-1]}clear(){this.entries.length=0}};function checkResultOf(e){let t=[...e.steps.flatMap(e=>e.findings),...e.patchFindings];return{errors:t.filter(e=>e.severity===`error`).length,warnings:t.filter(e=>e.severity!==`error`).length,resolved:e.resolved}}function alignEffects(e,t){let n=new Map(t.nodes.map(e=>[e.id,e])),between=(e,n)=>t.flows.find(t=>t.source===e&&t.target===n);return e.map(e=>{let t=e.operation;if(e.error)return e;if(t.op===`add`){let r=e.added[0]&&n.get(e.added[0].id),i=e.addedFlows[0]&&between(t.after,e.added[0].id);return{...e,added:e.added.map(e=>r?.bounds&&e.id===r.id?{...e,bounds:r.bounds}:e),addedFlows:e.addedFlows.map(e=>i?.waypoints?{...e,waypoints:i.waypoints}:e)}}if(t.op===`connect`){let n=between(t.from,t.to);return n?.waypoints?{...e,addedFlows:e.addedFlows.map(e=>({...e,waypoints:n.waypoints}))}:e}return t.op===`move`?{...e,moved:e.moved.map(e=>({...e,to:n.get(e.id)?.bounds??e.to}))}:e})}function alignCheck(e,t){return t?{...e,effects:alignEffects(e.effects,t)}:e}var GhostReview=class{state=Ae;listeners=new Set;queue=[];chain=Promise.resolve();options;checkpoints;detach=null;disposed=!1;applying=!1;covered=!1;whole=null;groups=[];onStack=()=>this.followUndo();constructor(e){this.options=e,this.checkpoints=e.checkpoints??new CheckpointLog,this.layer?.onPick(e=>this.focus(e)),e.modeler.get(`eventBus`,!1)?.on(`commandStack.changed`,this.onStack)}topAction(){let e=this.options.modeler.get(`commandStack`,!1);return e?._stack?.[e._stackIdx]?.id}liveActions(){let e=this.options.modeler.get(`commandStack`,!1),t=e?._stack??[];return new Set(t.slice(0,(e?._stackIdx??-1)+1).map(e=>e.id))}followUndo(){if(this.applying||this.disposed||this.groups.length===0||this.state.phase===`idle`)return;let e=this.liveActions(),t=[],n=[];for(let r of this.groups){let i=r.id!==void 0&&e.has(r.id);i!==r.live&&(r.live=i,(i?n:t).push(...r.indexes))}if(t.length===0&&n.length===0)return;let r=this.state.items.map(e=>t.includes(e.index)&&e.decision===`accepted`?{...e,decision:`pending`}:n.includes(e.index)&&e.decision===`pending`?{...e,decision:`accepted`}:e),i=r.find(e=>t.includes(e.index)),a=i?Y(`app.ghost.undone`,{label:i.label}):this.state.announcement,o=r.some(e=>e.decision===`pending`);this.set({...this.state,items:r,phase:o?`review`:this.state.phase,focus:i?i.index:this.state.focus,announcement:a}),this.refresh()}get layer(){return this.options.modeler.get(`ghostLayer`,!1)}get applier(){return this.options.modeler.get(`patchApplier`)}getState=()=>this.state;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});connect(e){this.detach?.(),this.detach=e.subscribe(e=>this.propose(e))}dispose(){this.disposed=!0,this.options.modeler.get(`eventBus`,!1)?.off(`commandStack.changed`,this.onStack),this.detach?.(),this.layer?.clear(),this.listeners.clear()}set(e){this.state={...e,queued:this.queue.length},this.layer?.show(this.state.phase===`review`?this.state.items:[],this.state.focus);for(let e of[...this.listeners])e(this.state)}announce(e){this.set({...this.state,announcement:e})}enqueue(e){let t=this.chain.then(e,e);return this.chain=t.catch(()=>void 0),t}describe=e=>{let t=this.options.modeler.get(`elementRegistry`,!1)?.get(e);return t?.businessObject?{type:t.businessObject.$type,name:t.businessObject.name}:void 0};propose(e){return this.disposed?Promise.resolve():this.state.phase===`review`||this.state.phase===`checking`?(this.queue.push(e),this.set(this.state),Promise.resolve()):this.start(e)}start(e){return this.enqueue(async()=>{let t=e;this.groups=[],this.whole=t.whole??null,this.set({...Ae,phase:`checking`,proposalId:e.id,title:e.title,source:e.source,whole:!!t.whole,announcement:Y(`app.ghost.checking`)});let n;try{let r=(await this.options.modeler.saveXML({format:!1})).xml??``;n=alignCheck(await this.options.check(r,e.patch),t.after)}catch(t){if(console.error(`The proposed change could not be checked:`,t),!this.disposed&&this.state.proposalId===e.id){this.whole=null,this.set({...Ae});let e=this.queue.shift();e&&this.start(e)}return}if(this.disposed||this.state.proposalId!==e.id)return;t.checked?.(checkResultOf(n));let r=Fe(e.id,e.patch,n,this.describe,{title:e.title,source:e.source});this.set({...r,whole:!!t.whole,patchFindings:[...r.patchFindings,...t.notes??[]],announcement:Y(`app.ghost.proposed`,{count:r.items.length})});let i=r.items[r.focus];this.covered?this.layer?.revealAll():i&&this.layer?.reveal(i.index),r.phase===`done`&&this.finish()})}finish(){this.set({...this.state,phase:`done`})}dismiss(){if(this.state.phase!==`done`)return;this.groups=[],this.whole=null,this.set({...Ae});let e=this.queue.shift();e&&this.start(e)}withdraw(e){let t=this.queue.findIndex(t=>t.id===e);if(t>=0){this.queue.splice(t,1),this.set(this.state);return}if(this.state.proposalId!==e||this.state.phase===`idle`)return;this.groups=[],this.whole=null,this.set({...Ae});let n=this.queue.shift();n&&this.start(n)}decideWhole(e){let t=this.whole;if(!t||this.state.phase!==`review`)return!1;this.whole=null;let n=this.state.items.map(t=>({...t,decision:e?`accepted`:`rejected`}));this.set({...this.state,items:n,phase:`done`,announcement:Y(e?`app.ghost.wholeAccepted`:`app.ghost.wholeRejected`)});try{e?t.accept():t.reject()}catch(e){console.error(`The decision could not be passed on:`,e)}return this.dismiss(),!0}fit(){this.state.phase===`review`&&this.layer?.revealAll()}setCover(e){let t=e!==null&&!this.covered;this.covered=e!==null,this.layer?.setCover(e??qe),t&&this.state.phase===`review`&&this.layer?.revealAll()}focus(e){if(this.state.phase!==`review`)return;let t=ze(this.state,e);this.set({...t,announcement:this.positionOf(t)}),this.layer?.reveal(e)}next(){this.move(1)}previous(){this.move(-1)}move(e){if(this.state.phase!==`review`)return;let t=Re(this.state,e);this.set({...t,announcement:this.positionOf(t)}),this.layer?.reveal(t.focus)}positionOf(e){let t=e.items[e.focus];if(!t)return``;let n=Be(e);return Y(`app.ghost.position`,{position:n.findIndex(e=>e.index===t.index)+1,count:n.length,label:t.label})}reject(e){if(this.state.phase!==`review`)return;if(this.whole){this.decideWhole(!1);return}let t=this.state.items[e];if(!t||t.decision!==`pending`)return;let n=Me(this.state,e),r=bt(this.state,n,`rejected`);this.set({...r,announcement:this.afterDecision(`rejected`,t,r,n.length)}),this.settle()}rejectAll(){if(this.state.phase!==`review`)return;if(this.whole){this.decideWhole(!1);return}let e=Be(this.state),t=bt(this.state,e.map(e=>e.index),`rejected`);this.set({...t,announcement:Y(`app.ghost.allRejected`,{count:e.length})}),this.settle()}accept(e){return this.enqueue(async()=>{if(this.state.phase!==`review`)return!1;if(this.whole)return this.decideWhole(!0);let t=this.state.items[e];if(!t||t.decision!==`pending`)return!1;let n=ke(this.state,e);if(n.length>0){let e=n[0];return this.announce(Y(`app.ghost.cannotAccept`,{label:e.label,reason:e.check.error??Y(`app.ghost.alreadyRejected`)})),!1}return this.apply(He(this.state,e),(e,n)=>this.afterDecision(`accepted`,t,e,n.length))})}acceptAll(){return this.enqueue(async()=>{if(this.state.phase!==`review`)return!1;if(this.whole)return this.decideWhole(!0);let e=Ve(this.state).filter(e=>ke(this.state,e.index).length===0).map(e=>e.index);return e.length===0?(this.announce(Y(`app.ghost.nothingToAccept`)),!1):this.apply(e,(e,t)=>Y(`app.ghost.allAccepted`,{count:t.length,left:Te(e).pending}))})}afterDecision(e,t,n,r){let i=Te(n).pending,a={label:t.label,extra:Math.max(0,r-1),left:i},o=Y(e===`accepted`?`app.ghost.accepted`:`app.ghost.rejected`,a);return i===0?`${o} ${Y(`app.ghost.reviewed`,Te(n))}`:o}async apply(e,t){let n=this.state,r=(await this.options.modeler.saveXML({format:!1})).xml??``,i=e.map(e=>n.items[e].operation),a=await ka(r,{operations:i},{engine:this.options.engine,conventions:this.options.conventions});if(!a.ok){let t=a.steps.find(e=>e.error),r=t?n.items[e[t.index]]:void 0,i=n.items.map(t=>{let n=e.indexOf(t.index),r=n>=0?a.steps[n]?.error:void 0;return r?{...t,check:{...t.check,status:`error`,error:r}}:t});return this.set({...n,items:i,announcement:Y(`app.ghost.noLongerApplies`,{label:r?.label??``,reason:t?.error??``})}),!1}this.checkpoints.record(r,{title:n.title,labels:e.map(e=>n.items[e].label)}),this.applying=!0;try{this.applier.apply(a.steps,this.options.engine)}finally{this.applying=!1}this.groups.push({id:this.topAction(),indexes:e,live:!0});let o=bt(n,e,`accepted`);return this.set({...o,announcement:t(o,e)}),await this.refresh(),this.settle(),!0}async refresh(){let e=Be(this.state);if(e.length===0)return;let t=(await this.options.modeler.saveXML({format:!1})).xml??``,n=await ka(t,{operations:e.map(e=>e.operation)},{engine:this.options.engine,conventions:this.options.conventions});if(this.disposed)return;let r=new Map(e.map((e,t)=>[e.index,n.steps[t]])),i=this.state.items.map(e=>{let t=r.get(e.index);return t&&!t.error?{...e,effect:{...t,index:e.index}}:e});this.set({...this.state,items:i})}settle(){this.state.phase===`review`&&Be(this.state).length===0&&this.finish()}comment(e,t){let n=this.state.items[e],r=t.trim();if(!n||!r)return!1;let i=n.elementIds[0];return i?(this.options.onComment?.(i,r),this.set({...this.state,comments:[...this.state.comments,{index:e,elementId:i,text:r}],announcement:Y(`app.ghost.commentSent`,{label:n.label})}),!0):!1}};async function lintSetup(){try{return await loadLintSetup()}catch(e){return console.error(`The lint rules could not be loaded for the proposed change:`,e),null}}async function loadLintSetup(){let e=G(),t=await e.getConfig().catch(()=>null),n=t?.bpmnLint,r;r=n?.clientBundlePath?await ht(await e.readFile(n.clientBundlePath)):_t(n?.configPath?await e.readFileIfPresent(n.configPath):null);let i=t?.engine??null;return e=>nt(r,i,e)}function appConfig$1(){return window.appConfig??{}}e(appConfig$1,`appConfig`);function GhostEdits({modeler:e,onComment:t,source:r}){let i=l(()=>{let n=Ei(appConfig$1().engine)??`classic`,check=async(e,t)=>checkPatch(e,t,{engine:n,conventions:appConfig$1().conventions,setup:await lintSetup()});return new GhostReview({modeler:e,engine:n,conventions:appConfig$1().conventions,check,onComment:t})},[e]);f(()=>{i.connect(r??jf);let e=r?.onWithdraw(e=>i.withdraw(e));return()=>{e?.(),i.dispose()}},[i,r]),f(()=>r?.onFit?.(()=>i.fit()),[i,r]);let[a,o]=n(!1);return f(()=>{if(!r?.cover||!r.onCover){o(!1);return}let sync=()=>{let e=r.cover?.()??null;i.setCover(e),o(e!==null)};return sync(),r.onCover(sync)},[i,r]),u(GhostReviewBar,{review:i,hidden:a})}var Lf={gamma:4,groups:[`names`],levels:[`prior`,`project`,`neighbours`,`diagram`],calibration:[{upTo:.20502661667383773,correct:0,items:1},{upTo:.20503593959809777,correct:0,items:2},{upTo:.2051396623696803,correct:0,items:2},{upTo:.20685343859276628,correct:0,items:1},{upTo:.20764293812329382,correct:0,items:1},{upTo:.23137758393153432,correct:0,items:1},{upTo:.23526325069863852,correct:0,items:2},{upTo:.2361123923193512,correct:0,items:1},{upTo:.2393894788897236,correct:0,items:1},{upTo:.24055023077290497,correct:0,items:2},{upTo:.24215284160598688,correct:0,items:1},{upTo:.24290698022247126,correct:0,items:1},{upTo:.24293189890513545,correct:0,items:1},{upTo:.2432316346671474,correct:0,items:1},{upTo:.2462620533829887,correct:0,items:1},{upTo:.26034295976888244,correct:1,items:9},{upTo:.310298727460059,correct:48,items:163},{upTo:.35600916811348643,correct:70,items:224},{upTo:.3722818153298981,correct:28,items:76},{upTo:.39098825316866137,correct:117,items:296},{upTo:.6362539934065248,correct:433,items:999},{upTo:.6473699585251257,correct:16,items:32},{upTo:.6703068366818717,correct:53,items:78},{upTo:.6817805460582353,correct:22,items:32},{upTo:.7101738761030508,correct:52,items:72},{upTo:.8081468235776214,correct:147,items:201},{upTo:.8775787807683855,correct:90,items:118},{upTo:.8812946040140366,correct:4,items:5},{upTo:.903654407119196,correct:27,items:33},{upTo:.9576711258349487,correct:133,items:139},{upTo:.994982571647006,correct:98,items:100},{upTo:.9950301228039035,correct:3,items:3},{upTo:.9950453350125541,correct:1,items:1},{upTo:.9950457310291629,correct:1,items:1},{upTo:.995072821538367,correct:19,items:19},{upTo:.9953489604857675,correct:1,items:1},{upTo:.9953494542644095,correct:1,items:1},{upTo:.9956271672056477,correct:6,items:6},{upTo:.9956706465585562,correct:1,items:1},{upTo:.9956729666015965,correct:2,items:2},{upTo:.9961237674173211,correct:19,items:19},{upTo:.99818291713241,correct:1,items:1},{upTo:.9981832060885054,correct:2,items:2},{upTo:.998183384010037,correct:1,items:1},{upTo:.9982333916565098,correct:1,items:1},{upTo:.9982336725860469,correct:2,items:2},{upTo:.9982338455653138,correct:1,items:1},{upTo:.9996260994174716,correct:5,items:5},{upTo:.9998526618952058,correct:3,items:3},{upTo:.9999127822367043,correct:2,items:2},{upTo:.9999372835797259,correct:1,items:1},{upTo:.9999412312976551,correct:1,items:1}]},Rf={unigram:{exclusiveGateway:375,serviceTask:485,endEvent:662,businessRuleTask:60,callActivity:91,userTask:481,subProcess:31,receiveTask:26,scriptTask:47,"intermediateCatchEvent:timer":35,sendTask:51,parallelGateway:85,"endEvent:terminate":3,eventBasedGateway:15,"intermediateCatchEvent:message":38,intermediateThrowEvent:22,task:56,"intermediateThrowEvent:message":11,"endEvent:signal":6,"intermediateCatchEvent:signal":5,inclusiveGateway:29,"endEvent:message":14,"intermediateCatchEvent:conditional":14,manualTask:16,"endEvent:cancel":1,transaction:1,"intermediateThrowEvent:signal":5,"endEvent:compensation":2,"intermediateThrowEvent:escalation":2,"intermediateThrowEvent:compensation":1},afterType:{startEvent:{exclusiveGateway:28,userTask:163,endEvent:27,serviceTask:162,receiveTask:4,businessRuleTask:25,parallelGateway:21,task:16,scriptTask:17,intermediateThrowEvent:5,"intermediateCatchEvent:signal":4,subProcess:14,inclusiveGateway:3,"endEvent:message":1,"intermediateCatchEvent:message":1,sendTask:11,manualTask:2,callActivity:12,"intermediateCatchEvent:timer":1,"intermediateCatchEvent:conditional":2,eventBasedGateway:1,"intermediateThrowEvent:signal":2,"intermediateThrowEvent:message":1},exclusiveGateway:{serviceTask:144,endEvent:91,callActivity:45,scriptTask:13,userTask:102,sendTask:10,exclusiveGateway:49,parallelGateway:8,intermediateThrowEvent:14,task:11,"intermediateThrowEvent:message":4,"endEvent:signal":4,"intermediateCatchEvent:timer":3,eventBasedGateway:1,"endEvent:compensation":1,"intermediateThrowEvent:escalation":1,inclusiveGateway:1,manualTask:2,businessRuleTask:5,"intermediateCatchEvent:message":1,"endEvent:message":5},boundaryEvent:{endEvent:30,userTask:28,sendTask:2,serviceTask:11,"endEvent:cancel":1,task:3,callActivity:1,exclusiveGateway:2,"endEvent:compensation":1,intermediateThrowEvent:1,scriptTask:1,subProcess:2,"intermediateThrowEvent:escalation":1},serviceTask:{serviceTask:72,businessRuleTask:10,endEvent:170,receiveTask:5,userTask:34,callActivity:7,exclusiveGateway:93,parallelGateway:14,"intermediateCatchEvent:timer":12,sendTask:12,subProcess:2,"intermediateCatchEvent:message":4,scriptTask:1,inclusiveGateway:13,eventBasedGateway:1,"endEvent:message":1,"intermediateCatchEvent:conditional":1,"intermediateThrowEvent:message":2},businessRuleTask:{callActivity:4,subProcess:2,serviceTask:6,exclusiveGateway:20,businessRuleTask:5,endEvent:3,scriptTask:1,userTask:16,parallelGateway:3},callActivity:{exclusiveGateway:38,userTask:8,endEvent:20,serviceTask:5,callActivity:6,parallelGateway:10},userTask:{exclusiveGateway:107,endEvent:169,serviceTask:39,"intermediateCatchEvent:timer":4,parallelGateway:20,"endEvent:terminate":2,sendTask:9,userTask:41,businessRuleTask:10,transaction:1,"intermediateCatchEvent:message":4,"intermediateThrowEvent:signal":3,receiveTask:3,callActivity:5,scriptTask:2,inclusiveGateway:7,intermediateThrowEvent:2,"intermediateCatchEvent:conditional":1,manualTask:12,"endEvent:message":4},subProcess:{exclusiveGateway:6,scriptTask:1,serviceTask:3,endEvent:15,parallelGateway:2,inclusiveGateway:2,subProcess:1},receiveTask:{userTask:9,exclusiveGateway:2,callActivity:1,parallelGateway:2,endEvent:9,serviceTask:1},scriptTask:{endEvent:24,userTask:5,"intermediateCatchEvent:timer":4,exclusiveGateway:6,sendTask:4,scriptTask:1,inclusiveGateway:3},intermediateCatchEvent:{exclusiveGateway:9,serviceTask:14,userTask:16,task:6,endEvent:27,scriptTask:7,"intermediateThrowEvent:message":4,"endEvent:message":1,eventBasedGateway:1,"intermediateThrowEvent:compensation":1,"intermediateCatchEvent:signal":1,parallelGateway:2},sendTask:{receiveTask:7,endEvent:20,eventBasedGateway:6,scriptTask:2,sendTask:1,"intermediateCatchEvent:message":8,userTask:2,parallelGateway:2},parallelGateway:{serviceTask:17,userTask:36,exclusiveGateway:3,businessRuleTask:5,endEvent:9,sendTask:2,"intermediateCatchEvent:message":3,task:1,subProcess:3,receiveTask:1,callActivity:10},eventBasedGateway:{"intermediateCatchEvent:message":11,"intermediateCatchEvent:timer":8,"intermediateCatchEvent:conditional":9},intermediateThrowEvent:{userTask:11,receiveTask:4,endEvent:13,exclusiveGateway:3,serviceTask:3,"intermediateCatchEvent:conditional":1,"intermediateCatchEvent:message":3,eventBasedGateway:2,"endEvent:signal":2,parallelGateway:1,"endEvent:message":1},task:{task:18,endEvent:16,exclusiveGateway:8,"intermediateCatchEvent:message":3,eventBasedGateway:3,"endEvent:terminate":1,"endEvent:message":1},inclusiveGateway:{serviceTask:8,endEvent:3,"intermediateCatchEvent:timer":3,scriptTask:1,receiveTask:2,subProcess:7,task:1,userTask:9,exclusiveGateway:1},manualTask:{endEvent:16},transaction:{userTask:1}}},zf=class PriorError extends Error{problems;constructor(e){super(`not-a-prior`),this.name=PriorError.name,this.problems=e}};function objectOf$1(e,t,n){return typeof e!=`object`||!e||Array.isArray(e)?(n.push({code:`not-an-object`,path:t,value:e}),{}):e}e(objectOf$1,`objectOf`);function countsOf$1(e,t,n){let r={};for(let[i,a]of Object.entries(objectOf$1(e,t,n)))typeof a==`number`&&Number.isInteger(a)&&a>=0?r[i]=a:n.push({code:`not-a-count`,path:`${t}.${i}`,value:a});return r}e(countsOf$1,`countsOf`);function loadPrior(e){let t=[],n=objectOf$1(e,`prior`,t),r=countsOf$1(n.unigram,`unigram`,t),i={};for(let[e,r]of Object.entries(objectOf$1(n.afterType,`afterType`,t)))i[e]=countsOf$1(r,`afterType.${e}`,t);if(t.length>0)throw new zf(t);return{unigram:r,afterType:i}}function sumOf(e){return Object.values(e).reduce((e,t)=>e+t,0)}function evidenceOf(e){let totalOf=(t,n)=>t===0?sumOf(e.unigram):t===1?sumOf(e.afterType[n.type]??{}):0,countOf=(t,n,r)=>t===0?e.unigram[r]??0:t===1?e.afterType[n.type]?.[r]??0:0;return{total:totalOf,count:countOf}}var accuracyOf=e=>e.correct/e.items;function curveOf(e){return t=>e.length===0?0:accuracyOf(e.find(e=>t<=e.upTo)??e[e.length-1])}var Bf=[`timer`,`message`,`error`,`signal`,`conditional`,`escalation`,`link`,`compensation`,`terminate`,`cancel`],Vf=[`task`,`serviceTask`,`userTask`,`scriptTask`,`businessRuleTask`,`sendTask`,`receiveTask`,`manualTask`,`callActivity`,`subProcess`,`adHocSubProcess`,`transaction`],Hf=[`exclusiveGateway`,`parallelGateway`,`inclusiveGateway`,`eventBasedGateway`,`complexGateway`],Uf=[`startEvent`,`endEvent`,`intermediateCatchEvent`,`intermediateThrowEvent`];function symbolOfKind(e,t){return t===null?e:`${e}:${t}`}var Wf=new Set(Hf);function isGatewayType(e){return Wf.has(e)}var Gf=[...Vf,...Hf,...Uf.flatMap(e=>[e,...Bf.map(t=>symbolOfKind(e,t))])],Kf=[`definition`,`ids`,`names`,`mappings`,`script`,`position`,`layout`,`style`];new Set(Kf);var qf=[{below:0,token:`back`},{below:40,token:`tight`},{below:120,token:`normal`},{below:1/0,token:`wide`}],Jf={flows:new Set,nodes:new Set};function headOf(e){return e===null?null:unitsOf(e,gl).filter(e=>e.role===`content`).at(-1)?.key??null}function listBy(e,t,n){let r=new Map;for(let i of e){let e=t(i),a=n(i);e!==void 0&&a!==null&&r.set(e,[...r.get(e)??[],a])}return r}function mappingTokens(e){return listBy(e.mappings,e=>e.elementId,e=>{let t=headOf(e.target);return t===null?null:`${e.direction===`input`?`in`:`out`}:${t}`})}function idTokens(e){let t=e.model;return listBy([...t.workers.map(e=>({id:e.elementId,token:`${e.kind}:${e.value}`})),...t.calls.map(e=>({id:e.elementId,token:`CALL:${e.calledProcessId}`})),...t.decisionUses.map(e=>({id:e.elementId,token:`DECISION:${e.decisionId}`})),...t.formUses.map(e=>({id:e.elementId,token:`FORM:${e.formId}`})),...t.messageUses.map(e=>({id:e.elementId,token:`MESSAGE:${e.messageId}`})),...t.errors.map(e=>({id:e.elementId,token:`ERROR:${e.code??``}`}))],e=>e.id,e=>e.token)}function scriptTokens(e){let t=listBy(e.model.variables,e=>e.elementId,e=>e.name),n=listBy(e.model.variables.filter(e=>e.where===`condition`),e=>e.elementId,e=>e.name),r=new Map;for(let i of e.graph.nodes.values()){let e=[...t.get(i.id)??[],...i.incoming.flatMap(e=>n.get(e)??[])],a=[...new Set(e.map(e=>headOf(e)).filter(e=>e!==null))].sort();a.length>0&&r.set(i.id,a)}return r}function indexOf$1(e){let t=new Map;for(let n of e.graph.nodes.values())n.host!==null&&t.set(n.host,[...t.get(n.host)??[],n]);return{graph:e.graph,flows:new Map(e.graph.flows.map(e=>[e.id,e])),ids:idTokens(e),mappingHeads:mappingTokens(e),scriptHeads:scriptTokens(e),hosted:t}}e(indexOf$1,`indexOf`);function viewOfFlow(e,t){let n=e.flows.get(t);if(n===void 0)return Jf;let r=e.graph.nodes.get(n.target),i=[...r?.incoming??[],...r?.outgoing??[]];return{flows:new Set([t,...i]),nodes:new Set([n.target])}}function visibleFlows(e,t,n){return t.map(t=>e.flows.get(t)).filter(t=>t!==void 0&&e.graph.nodes.has(t.source)&&e.graph.nodes.has(t.target)&&!n.flows.has(t.id)&&!n.nodes.has(t.source)&&!n.nodes.has(t.target))}function visibleIncoming(e,t,n){return visibleFlows(e,e.graph.nodes.get(t)?.incoming??[],n)}function visibleOutgoing(e,t,n){return visibleFlows(e,e.graph.nodes.get(t)?.outgoing??[],n)}function degreeOf(e){return e>=2?`2+`:String(e)}function gapTokenOf(e){return(qf.find(t=>e<t.below)??qf[qf.length-1]).token}function directionOf(e){let t=e[0],n=e[e.length-1];return Math.abs(n.x-t.x)>=Math.abs(n.y-t.y)?`horizontal`:`vertical`}function gapOf$1(e,t,n){return n===`horizontal`?t.x-(e.x+e.width):t.y-(e.y+e.height)}e(gapOf$1,`gapOf`);function layoutTokens(e,t,n){let r=visibleIncoming(e,t.id,n)[0],i=r===void 0?void 0:e.graph.waypoints.get(r.id);if(r===void 0||i===void 0||i.length<2)return[];let a=directionOf(i),o=e.graph.bounds.get(r.source),s=e.graph.bounds.get(t.id),c=o&&s?[`gap:${gapTokenOf(gapOf$1(o,s,a))}`]:[];return[`dir:${a}`,...c]}function branchTokens(e,t){if(t===void 0)return[];let n=e.graph.nodes.get(t.source);return n?.type===`boundaryEvent`?[`from:boundary`]:n===void 0||!isGatewayType(n.type)?[]:t.condition===null?[t.isDefault?`branch:default`:`branch:plain`]:[`branch:conditional`]}function positionTokens(e,t,n){let r=visibleIncoming(e,t.id,n),i=visibleOutgoing(e,t.id,n),a=(e.hosted.get(t.id)??[]).filter(e=>!n.nodes.has(e.id)).map(e=>`hosts:${e.definition??`other`}`);return[`in${degreeOf(r.length)}`,`out${degreeOf(i.length)}`,...t.scope===null?[]:[`scope:inside`],...branchTokens(e,r[0]),...new Set(a)]}function recordOf(e,t,n){let r=e.graph.nodes.get(t);if(r===void 0)throw Error(`no node ${t} in the diagram`);let i=headOf(r.name);return{type:r.type,tokens:new Map([[`definition`,r.definition===null?[]:[r.definition]],[`ids`,e.ids.get(t)??[]],[`names`,i===null?[]:[i]],[`mappings`,e.mappingHeads.get(t)??[]],[`script`,e.scriptHeads.get(t)??[]],[`position`,positionTokens(e,r,n)],[`layout`,layoutTokens(e,r,n)],[`style`,r.fill===null?[]:[`fill:${r.fill}`]]])}}function keyOf(e,t){let n=Kf.filter(e=>t.has(e)).map(t=>`${t}=${(e.tokens.get(t)??[]).join(`,`)}`);return JSON.stringify([e.type,...n])}function pathOf(e,t,n){let r=[t];for(;;){let t=r[r.length-1],i=visibleIncoming(e,t,n);if(i.length===0)return{nodes:r,headless:!0};if(r.length===3)return{nodes:r,headless:!1};let a=i[0].source;if(r.includes(a))return{nodes:r,headless:!1};r.push(a)}}function contextOf(e,t,n,r){let i=e.graph.nodes.get(t);if(i===void 0)throw Error(`no node ${t} in the diagram`);let a=pathOf(e,t,n).nodes.map(t=>keyOf(recordOf(e,t,n),r)),o=Array.from({length:4},(e,t)=>t<=a.length?JSON.stringify(a.slice(0,t)):null);return{type:i.type,keys:o}}function symbolOf(e){return symbolOfKind(e.type,e.definition)}var Yf=[`prior`,`project`,`neighbours`,`diagram`],Xf=.7,Zf=class DecisionError extends Error{problems;constructor(e){super(`not-a-decision`),this.name=DecisionError.name,this.problems=e}};function objectOf(e,t,n){return typeof e!=`object`||!e||Array.isArray(e)?(n.push({code:`not-an-object`,path:t,value:e}),{}):e}function listOf(e,t,n,r,i){return Array.isArray(e)?e.flatMap((e,a)=>typeof e==`string`&&n.includes(e)?[e]:(i.push({code:r,path:`${t}[${a}]`,value:e}),[])):(i.push({code:`not-an-object`,path:t,value:e}),[])}function blocksOf(e,t,n){return Array.isArray(e)?e.flatMap((e,r)=>{let{upTo:i,correct:a,items:o}=objectOf(e,`${t}[${r}]`,n);return typeof i==`number`&&typeof a==`number`&&typeof o==`number`&&o>0&&a>=0&&a<=o?[{upTo:i,correct:a,items:o}]:(n.push({code:`not-a-block`,path:`${t}[${r}]`,value:e}),[])}):(n.push({code:`not-an-object`,path:t,value:e}),[])}function decisionOf(e){let t=[],n=objectOf(e,`decision`,t),r=n.gamma;typeof r==`number`&&r>0||t.push({code:`not-a-number`,path:`decision.gamma`,value:r});let i=listOf(n.groups,`decision.groups`,Kf,`unknown-group`,t),a=listOf(n.levels,`decision.levels`,Yf,`unknown-level`,t),o=blocksOf(n.calibration,`decision.calibration`,t);if(t.length>0)throw new Zf(t);return{gamma:r,groups:i,levels:a,calibration:o}}function modelOf$1(e,t){return{gamma:e.gamma,groups:new Set(e.groups),levels:Yf.filter(t=>e.levels.includes(t)),prior:t,calibrate:curveOf(e.calibration)}}e(modelOf$1,`modelOf`);function bundledModel(){return modelOf$1(decisionOf(Lf),evidenceOf(loadPrior(Rf)))}var Qf=[`calls`,`decision`,`form`,`message`,`error`,`job-type`,`folder`],messageNameOf=(e,t)=>e.messages.find(e=>e.id===t)?.name??null,present=e=>e.filter(e=>typeof e==`string`&&e!==``),$f=[{kind:`calls`,defined:e=>present(e.processes.map(e=>e.id)),used:e=>present(e.calls.map(e=>e.calledProcessId))},{kind:`decision`,defined:e=>present(e.decisions.map(e=>e.id)),used:e=>present(e.decisionUses.map(e=>e.decisionId))},{kind:`form`,defined:e=>present([e.formId]),used:e=>present(e.formUses.map(e=>e.formId))},{kind:`message`,defined:e=>present(e.messages.map(e=>e.name)),used:e=>present(e.messageUses.map(t=>messageNameOf(e,t.messageId)))},{kind:`error`,defined:()=>[],used:e=>present(e.errors.map(e=>e.code))},{kind:`job-type`,defined:()=>[],used:e=>present(e.workers.filter(e=>e.kind===`JOB_TYPE`).map(e=>e.value))}];function folderOf$1(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?``:e.slice(0,t)}e(folderOf$1,`folderOf`);var Links=class{pairs=new Map;link(e,t,n){e!==t&&(this.add(e,t,n),this.add(t,e,n))}neighbours(e){return new Set(this.pairs.get(e)?.keys()??[])}kindsBetween(e,t){let n=this.pairs.get(e)?.get(t);return n?Qf.filter(e=>n.has(e)):[]}add(e,t,n){let r=this.pairs.get(e)??new Map,i=r.get(t)??new Set;i.add(n),r.set(t,i),this.pairs.set(e,r)}};function indexOf(e,t){let n=new Map;for(let r of e)for(let e of t(r)){let t=n.get(e)??new Set;t.add(r.path),n.set(e,t)}return n}function unionOf(...e){let t=new Map;for(let n of e)for(let[e,r]of n)t.set(e,new Set([...t.get(e)??[],...r]));return t}function linkEveryKey(e,t,n){for(let r of n.values()){let n=[...r];n.forEach((r,i)=>n.slice(i+1).forEach(n=>e.link(r,n,t)))}}function relationsOf(e){let t=new Links;for(let n of $f){let r=indexOf(e,e=>n.defined(e.model)),i=indexOf(e,e=>n.used(e.model));linkEveryKey(t,n.kind,unionOf(r,i))}return linkEveryKey(t,`folder`,indexOf(e,e=>[folderOf$1(e.path)])),{neighbours:e=>t.neighbours(e),linksBetween:(e,n)=>t.kindsBetween(e,n)}}var Counts=class{rows=Array.from({length:4},()=>new Map);totals=Array.from({length:4},()=>new Map);add(e,t,n=1){e.keys.forEach((e,r)=>{if(e===null)return;let i=this.rows[r].get(e)??new Map;i.set(t,(i.get(t)??0)+n),this.rows[r].set(e,i),this.totals[r].set(e,(this.totals[r].get(e)??0)+n)})}addAll(e,t=1){e.rows.forEach((n,r)=>{n.forEach((n,i)=>{let a=this.rows[r].get(i)??new Map;n.forEach((e,n)=>a.set(n,(a.get(n)??0)+t*e)),this.rows[r].set(i,a),this.totals[r].set(i,(this.totals[r].get(i)??0)+t*(e.totals[r].get(i)??0))})})}total(e,t){let n=t.keys[e];return n===null?0:this.totals[e].get(n)??0}count(e,t,n){let r=t.keys[e];return r===null?0:this.rows[e].get(r)?.get(n)??0}};function combined(e,t=1){let n=new Counts;return e.forEach(e=>n.addAll(e,t)),n}function distributionOf(e,t,n,r){let i=n.map(()=>1/n.length);for(let a=0;a<=3;a+=1)for(let o of t){let t=o.total(a,e);if(t<=0)continue;let s=t+r;n.forEach((t,n)=>{i[n]=(o.count(a,e,t)+r*i[n])/s})}return new Map(n.map((e,t)=>[e,i[t]]))}function countsOf(e,t){let n=new Counts;return e.forEach(e=>n.add(t(e),e.symbol)),n}function nameKeyOf(e,t){let n=e.keys[1];return n===null?null:JSON.stringify([n,t])}var NameCounts=class{rows=new Map;add(e,t,n){let r=nameKeyOf(e,t);if(r===null)return;let i=this.rows.get(r)??new Map;i.set(n,(i.get(n)??0)+1),this.rows.set(r,i)}addAll(e){e.rows.forEach((e,t)=>{let n=this.rows.get(t)??new Map;e.forEach((e,t)=>n.set(t,(n.get(t)??0)+e)),this.rows.set(t,n)})}rowOf(e,t){let n=nameKeyOf(e,t);return(n===null?void 0:this.rows.get(n))??new Map}};function tallyOf$1(e){let t=new NameCounts;return e.forEach(e=>{e.name!==null&&t.add(e.context,e.symbol,e.name)}),{symbols:countsOf(e,e=>e.context),names:t}}e(tallyOf$1,`tallyOf`);function combinedTally(e){let t=new NameCounts;return e.forEach(e=>t.addAll(e.names)),{symbols:combined(e.map(e=>e.symbols)),names:t}}var ep={"bpmn:TimerEventDefinition":`timer`,"bpmn:MessageEventDefinition":`message`,"bpmn:ErrorEventDefinition":`error`,"bpmn:SignalEventDefinition":`signal`,"bpmn:ConditionalEventDefinition":`conditional`,"bpmn:EscalationEventDefinition":`escalation`,"bpmn:LinkEventDefinition":`link`,"bpmn:CompensateEventDefinition":`compensation`,"bpmn:TerminateEventDefinition":`terminate`,"bpmn:CancelEventDefinition":`cancel`};function localNameOf(e){let t=e.split(`:`).pop()??e;return t.charAt(0).toLowerCase()+t.slice(1)}function textOf(e){let t=e?.trim()??``;return t===``?null:t}function definitionOf(e){for(let t of e.eventDefinitions??[]){let e=ep[t.$type];if(e!==void 0)return e}return null}function collect(e,t,n,r,i){for(let a of r)a.$instanceOf(`bpmn:SequenceFlow`)?t.push(a):a.$instanceOf(`bpmn:FlowNode`)&&a.id&&(e.push({element:a,processId:n,scope:i}),collect(e,t,n,a.flowElements??[],a.id))}function flowIdsBy(e,t){let n=new Map;for(let r of e){let e=t(r);e!==void 0&&r.id!==void 0&&n.set(e,[...n.get(e)??[],r.id])}return n}function geometryOf(e){let t=new Map,n=new Map,r=new Map;for(let i of e.diagrams??[])for(let e of i.plane?.planeElement??[]){let i=e.bpmnElement?.id;i!==void 0&&(e.bounds&&t.set(i,{x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height}),e.waypoint&&n.set(i,e.waypoint.map(e=>({x:e.x,y:e.y}))),typeof e.fill==`string`&&e.fill!==``&&r.set(i,e.fill))}return{bounds:t,waypoints:n,fills:r}}function flowGraphOf(e){let t=e,n=[],r=[];for(let e of(t.rootElements??[]).filter(e=>e.$type===`bpmn:Process`))collect(n,r,e.id??``,e.flowElements??[],null);let i=flowIdsBy(r,e=>e.sourceRef?.id),a=flowIdsBy(r,e=>e.targetRef?.id),{bounds:o,waypoints:s,fills:c}=geometryOf(t),l=new Map;for(let{element:e,processId:t,scope:r}of n){let n=e.id;l.set(n,{id:n,processId:t,type:localNameOf(e.$type),definition:definitionOf(e),name:textOf(e.name),host:e.attachedToRef?.id??null,scope:r,defaultFlow:e.default?.id??null,fill:c.get(n)??null,incoming:a.get(n)??[],outgoing:i.get(n)??[]})}return{nodes:l,flows:r.map(e=>{let t=e.sourceRef?.id??``;return{id:e.id??``,source:t,target:e.targetRef?.id??``,name:textOf(e.name),condition:textOf(e.conditionExpression?.body),isDefault:l.get(t)?.defaultFlow===e.id}}),bounds:o,waypoints:s}}async function diagramFactsOf(e,t){let n=await On(t);return n?{path:e,graph:flowGraphOf(n),model:await Q(e,t),mappings:mappingsOf(n)}:null}function observationsOf(e,t){return e.graph.flows.flatMap(n=>{let r=e.graph.nodes.get(n.source),i=e.graph.nodes.get(n.target);return r===void 0||i===void 0||i.host!==null?[]:[{flow:n.id,source:n.source,target:n.target,symbol:symbolOf(i),name:i.name,context:contextOf(e,n.source,viewOfFlow(e,n.id),t)}]})}function labelOf(e,t){let n=e.nodes.get(t);return n===void 0?``:[n.type,n.definition??``,n.name??``].join(`|`)}function copyKeyOf(e){let t=[...e.nodes.values()].map(t=>labelOf(e,t.id)).sort(),n=e.flows.map(t=>`${labelOf(e,t.source)}>${labelOf(e,t.target)}|${t.name??``}`).sort();return JSON.stringify([t,n])}var tp=1e3,np=2166136261,rp=16777619;function textHashOf(e){let t=np;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,rp)>>>0;return t.toString(16).padStart(8,`0`)}function sourceOf(e,t){return{path:e,hash:textHashOf(t),text:t}}async function summarise(e,t){if(!e.path.endsWith(`.bpmn`))return{path:e.path,copyKey:``,model:await Q(e.path,e.text),tally:tallyOf$1([])};let n=await diagramFactsOf(e.path,e.text);return n===null?null:{path:e.path,copyKey:copyKeyOf(n.graph),model:n.model,tally:tallyOf$1(observationsOf(indexOf$1(n),t))}}var NextBlockLibrary=class{groups;summaries=new Map;constructor(e){this.groups=e}async summaryOf(e){let t=JSON.stringify([e.path,e.hash]);if(this.summaries.has(t))return this.summaries.get(t)??null;let n=await summarise(e,this.groups);return this.summaries.set(t,n),this.summaries.size>tp&&this.summaries.delete(this.summaries.keys().next().value),n}async evidenceFor(e,t){let n=[];for(let r of t){if(r.path===e.path)continue;let t=await this.summaryOf(r);t!==null&&t.copyKey!==e.copyKey&&n.push(t)}let r=relationsOf([e,...n].map(({path:e,model:t})=>({path:e,model:t}))).neighbours(e.path);return{diagram:e.tally,neighbours:combinedTally(n.filter(e=>r.has(e.path)).map(e=>e.tally)),project:combinedTally(n.map(e=>e.tally))}}},ip=`endEvent`;function nearestSplitTypeBehind(e,t,n){let r=new Set([t]),i=t;for(;;){let t=visibleIncoming(e,i,n)[0];if(t===void 0||r.has(t.source))return null;r.add(t.source),i=t.source;let a=e.graph.nodes.get(i);if(a!==void 0&&isGatewayType(a.type)&&a.outgoing.length>=2)return a.type}}function deadEndBranchOf(e,t,n){let r=e.graph.nodes.get(t);if(r===void 0||r.type===ip||visibleOutgoing(e,t,n).length>0)return null;let i=nearestSplitTypeBehind(e,t,n);return{symbols:i===null?[ip]:[ip,i],rule:`dead-end-branch`}}var ap=3;function rankOf(e){return[...e].map(([e,t])=>({symbol:e,probability:t})).sort((e,t)=>t.probability-e.probability||(e.symbol<t.symbol?-1:+(e.symbol>t.symbol)))}function explanationOf(e,t){for(let n=3;n>=0;--n){let r=t.filter(t=>t.evidence.total(n,e)>0).map(e=>e.name);if(r.length>0)return{order:n,levels:r}}return{order:0,levels:[]}}function suggestionOf(e,t,n,r,i){let a=rankOf(distributionOf(e,t.map(e=>e.evidence),n,r)),o=a[0];if(o===void 0)return null;let s=i.calibrate(o.probability);return s<i.threshold?null:{symbol:o.symbol,confidence:s,alternatives:a.slice(0,ap),evidence:explanationOf(e,t)}}var op=2,sp=.6,isElementKind=e=>Object.hasOwn(Oa,e),isEventKind=e=>Object.hasOwn(Aa,e);function kebabOf(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function patchKindOf(e){let[t,n]=e.split(`:`),r=kebabOf(t);return isElementKind(r)?n===void 0?{element:r}:isEventKind(n)?{element:r,event:n}:null:null}function tallyOf(e,t){return e===`prior`?null:t[e]}function nameOf$1(e,t,n){let r=new Map;for(let i of n)for(let[n,a]of i.names.rowOf(e,t))r.set(n,(r.get(n)??0)+a);let i=[...r].sort((e,t)=>t[1]-e[1]||(e[0]<t[0]?-1:+(e[0]>t[0]))),[a,o]=i;if(a===void 0)return null;let s=i.reduce((e,[,t])=>e+t,0);return s<op||a[1]/s<sp||o!==void 0&&o[1]===a[1]?null:a[0]}e(nameOf$1,`nameOf`);function answerOf(e,t,n,r){if(deadEndBranchOf(e,t,Jf)===null)return null;let i=contextOf(e,t,Jf,r.groups),a=suggestionOf(i,r.levels.map(e=>({name:e,evidence:e===`prior`?r.prior:n[e].symbols})),Gf,r.gamma,{calibrate:r.calibrate,threshold:Xf});if(a===null)return null;let o=patchKindOf(a.symbol);if(o===null)return null;let s=r.levels.flatMap(e=>tallyOf(e,n)??[]);return{symbol:a.symbol,kind:o,name:nameOf$1(i,a.symbol,s),confidence:a.confidence,evidence:a.evidence}}function patchOf(e,t){return{operations:[{op:`add`,element:e.kind.element,after:t,...e.kind.event===void 0?{}:{event:e.kind.event},...e.name===null?{}:{name:e.name}}]}}function gapOf(e){let t=e.graph.flows.flatMap(t=>{let n=e.graph.bounds.get(t.source),r=e.graph.bounds.get(t.target);if(n===void 0||r===void 0)return[];let i=r.x-(n.x+n.width);return i>0?[i]:[]}).sort((e,t)=>e-t);return t.length===0?50:t[Math.floor(t.length/2)]}async function suggestNext(e,t,n){let r=await diagramFactsOf(n.path,n.xml);if(r===null)return null;let i=indexOf$1(r),a={path:n.path,copyKey:copyKeyOf(r.graph),model:r.model,tally:tallyOf$1(observationsOf(i,t.groups))},o=answerOf(i,n.nodeId,await e.evidenceFor(a,n.others),t);if(o===null)return null;let s=patchOf(o,n.nodeId),c=await ka(n.xml,s,{engine:n.engine,conventions:n.conventions,gap:Math.max(gapOf(i),n.minimumGap??0)});return c.ok?{answer:o,patch:s,steps:c.steps}:null}var NextBlockSession=class{hooks;schedule;dismissed=new Set;candidate=null;cancelPause=null;shown=null;generation=0;enabled=!0;constructor(e,t){this.hooks=e,this.schedule=t}select(e,t){this.disturb(),this.enabled&&e!==null&&t&&!this.dismissed.has(e)&&(this.candidate=e,this.cancelPause=this.schedule(()=>this.ask(),700))}disturb(){this.cancelPause?.(),this.cancelPause=null,this.candidate=null,this.generation+=1,this.shown!==null&&(this.shown=null,this.hooks.hide())}setEnabled(e){this.enabled=e,e||this.disturb()}isShown(){return this.shown!==null}shownNode(){return this.shown?.nodeId??null}accept(){if(this.shown===null)return null;let{suggestion:e}=this.shown;return this.shown=null,this.candidate=null,this.generation+=1,this.hooks.hide(),e}dismiss(){if(this.shown===null)return null;let{nodeId:e}=this.shown;return this.dismissed.add(e),this.shown=null,this.candidate=null,this.generation+=1,this.hooks.hide(),e}ask(){this.cancelPause=null;let e=this.candidate;if(e===null)return;let t=this.generation+=1;this.hooks.request(e,n=>this.answer(t,e,n))}answer(e,t,n){e===this.generation&&t===this.candidate&&n!==null&&(this.shown={nodeId:t,suggestion:n},this.hooks.show(t,n))}},cp=[`Shift`,`Control`,`Alt`,`Meta`,`AltGraph`,`CapsLock`],lp=`.bio-properties-panel`,up=16;function deadEndOf(e){let t=e?.businessObject;return!!e&&e.waypoints===void 0&&e.labelTarget===void 0&&t?.$instanceOf?.(`bpmn:FlowNode`)===!0&&t.$instanceOf(`bpmn:EndEvent`)!==!0&&(e.outgoing??[]).length===0}function withoutModifier(e){return!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey}function inPropertiesPanel(){return!!document.activeElement?.closest?.(lp)}var NextBlockController=class{options;library;model=bundledModel();session;bindings=[];dragging=!1;container;constructor(e){this.options=e,this.library=new NextBlockLibrary(this.model.groups),this.session=new NextBlockSession({request:(e,t)=>{this.suggest(e).then(t)},show:(e,t)=>{this.layer.show(t),this.options.announce(Y(`app.nextBlock.status.suggested`,{type:Ut(t)}))},hide:()=>this.layer.hide()},(e,t)=>{let n=window.setTimeout(e,t);return()=>window.clearTimeout(n)}),this.bind(`selection.changed`,this.reselect),this.bind(`elements.changed`,this.reselect),this.bind(`drag.start`,this.dragStart),this.bind(`drag.cleanup`,this.dragEnd),this.bind(`canvas.viewbox.changed`,this.disturb),this.container=this.options.modeler.get(`canvas`).getContainer(),document.addEventListener(`keydown`,this.onKeyDown)}setEnabled(e){this.session.setEnabled(e)}dispose(){for(let[e,t]of this.bindings.splice(0))this.eventBus.off(e,t);document.removeEventListener(`keydown`,this.onKeyDown),this.session.setEnabled(!1)}get eventBus(){return this.options.modeler.get(`eventBus`)}get layer(){return this.options.modeler.get(`nextBlockLayer`)}get registry(){return this.options.modeler.get(`elementRegistry`)}bind(e,t,n){this.bindings.push([e,t]),n===void 0?this.eventBus.on(e,t):this.eventBus.on(e,n,t)}disturb=()=>{this.session.disturb()};dragStart=()=>{this.dragging=!0,this.session.disturb()};dragEnd=()=>{this.dragging=!1,this.reselect()};reselect=()=>{if(this.dragging)return;let e=this.options.modeler.get(`selection`).get(),t=e.length===1?this.registry.get(e[0].id):void 0;this.session.select(t?.id??null,deadEndOf(t))};onKeyDown=e=>{let t=Ia(e.target);this.session.isShown()&&!t&&e.key===`Tab`&&withoutModifier(e)&&this.onCanvas(e.target)?(e.preventDefault(),this.accept()):this.session.isShown()&&!t&&e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this.dismiss()):cp.includes(e.key)||this.session.disturb()};onCanvas(e){return e instanceof Node&&!!this.container?.contains(e)}accept(){let e=this.session.accept();if(e!==null)try{let t=this.options.modeler.get(`patchApplier`).apply(e.steps,this.options.engine()),n=t[0]?this.registry.get(t[0]):void 0;n&&this.options.modeler.get(`selection`).select(n),this.options.announce(Y(`app.nextBlock.status.added`,{type:Ut(e)}))}catch(e){console.error(`The next block suggestion could not be added:`,e)}}dismiss(){this.session.dismiss()!==null&&this.options.announce(Y(`app.nextBlock.status.dismissed`))}padClearance(e){let t=this.container?.querySelector(`.djs-context-pad.open`),n=this.registry.get(e);if(!this.container||!t||!n)return 0;let{scale:r,x:i}=this.options.modeler.get(`canvas`).viewbox(),a=(t.getBoundingClientRect().right-this.container.getBoundingClientRect().left)/r+i;return Math.max(0,a+up/r-(n.x+n.width))}async suggest(e){if(this.dragging||Ia(document.activeElement)||inPropertiesPanel())return null;let t=this.padClearance(e);try{let{xml:n}=await this.options.modeler.saveXML({format:!1});if(!n)return null;let r=this.options.path(),i=await this.options.sources.near(r);return await suggestNext(this.library,this.model,{path:r,xml:n,nodeId:e,others:i,engine:this.options.engine(),conventions:this.options.conventions(),minimumGap:t})}catch(e){return console.error(`The next block suggestion failed:`,e),null}}},folderOf=e=>e.replace(/[\\/][^\\/]*$/,``),turn=()=>new Promise(e=>setTimeout(e,0)),ProjectSources=class{bridge;reads=new Map;constructor(e){this.bridge=e}async near(e){let t=await this.list(),n=folderOf(e),r=[...t.filter(e=>folderOf(e.path)===n),...t.filter(e=>folderOf(e.path)!==n)].slice(0,400),i=new Set(r.map(e=>e.path));for(let e of[...this.reads.keys()])i.has(e)||this.reads.delete(e);let a=[];for(let e of r){let t=await this.sourceOf(e.path,e.stamp);t!==null&&a.push(t)}return a}async list(){try{let e=await this.bridge.getProjectFiles();return Array.isArray(e?.files)?e.files.map(e=>({path:e.path,stamp:e.stamp})):[]}catch{return[]}}async sourceOf(e,t){let n=this.reads.get(e);if(n!==void 0&&n.stamp===t)return n.source;await turn();let r=await this.bridge.readFile(e).catch(()=>null),i=r!==null&&r.length<=1e6?sourceOf(e,r):null;return this.reads.set(e,{stamp:t,source:i}),i}};function appConfig(){return window.appConfig??{}}function NextBlockSuggestions({modeler:e}){let[t,r]=n(``),i=l(()=>new NextBlockController({modeler:e,sources:new ProjectSources(G()),path:()=>appConfig().bpmnFilePath??``,engine:()=>Ei(appConfig().engine)??`classic`,conventions:()=>appConfig().conventions,announce:r}),[e]);return f(()=>{i.setEnabled(F());let e=vn(()=>i.setEnabled(F()));return()=>{e(),i.dispose()}},[i]),u(`div`,{class:`next-block-announce`,role:`status`,"aria-live":`polite`,children:t})}function useTokenSimulation(e){let[t,i]=n({isRunning:!1,isPaused:!1,tokens:[]}),[a,o]=n(null),[c,l]=n(!1),u=s(null),d=s(new Map);f(()=>{if(i({isRunning:!1,isPaused:!1,tokens:[],currentElement:void 0}),!e)l(!1);else{try{let t=e.get?.(`toggleMode`);if(t){if(u.current=t,l(!0),o(null),typeof t.init==`function`)try{t.init()}catch(e){console.warn(`Failed to initialize token simulation:`,e)}let n=e.get?.(`eventBus`),onToggleModeChange=e=>{i(t=>({...t,isRunning:e.active??t.isRunning,isPaused:!1}))};n&&typeof n.on==`function`&&(n.on(`tokenSimulation.toggleMode`,onToggleModeChange),d.current.set(`tokenSimulation.toggleMode`,onToggleModeChange))}else l(!1)}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),l(!1)}return()=>{if(e){let t=e.get?.(`eventBus`);t&&typeof t.off==`function`&&(d.current.forEach((e,n)=>{t.off(n,e)}),d.current.clear())}if(u.current&&typeof u.current.toggleMode==`function`)try{u.current.toggleMode(!1)}catch(e){console.warn(`Failed to deactivate token simulation:`,e)}}}},[e]);let p=r(()=>{try{let e=u.current;if(!e)return;typeof e.toggleMode==`function`&&e.toggleMode(!0),i(e=>({...e,isRunning:!0,isPaused:!1}))}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to play token simulation:`,e)}},[]),m=r(()=>{try{let e=u.current;if(!e||!t.isRunning)return;typeof e.pause==`function`&&e.pause(),i(e=>({...e,isPaused:!0,isRunning:!1}))}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to pause token simulation:`,e)}},[t.isRunning]),h=r(()=>{try{let e=u.current;if(!e)return;typeof e.toggleMode==`function`&&e.toggleMode(!1),i({isRunning:!1,isPaused:!1,tokens:[]})}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to stop token simulation:`,e)}},[]),g=r(()=>{try{let e=u.current;if(!e)return;typeof e.reset==`function`&&e.reset(),i({isRunning:!1,isPaused:!1,tokens:[],currentElement:void 0})}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to reset token simulation:`,e)}},[]),_=r(()=>{try{let e=u.current;if(!e)return;typeof e.step==`function`&&e.step()}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to step token simulation:`,e)}},[]),v=r(()=>{try{h(),g(),p()}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to restart token simulation:`,e)}},[h,g,p]),y=r(e=>{try{let t=u.current;if(!t||typeof t.setTokens!=`function`)return;t.setTokens(e),i(t=>({...t,tokens:e}))}catch(e){let t=e instanceof Error?e:Error(String(e));o(t),console.error(`Failed to set tokens:`,e)}},[]),b=r(()=>{try{let e=u.current;return!e||typeof e.getTokens!=`function`?t.tokens:e.getTokens()}catch(e){return console.error(`Failed to get tokens:`,e),t.tokens}},[t.tokens]);return{state:t,controls:{play:p,pause:m,stop:h,reset:g,step:_,restart:v},error:a,isSupported:c,setTokens:y,getTokens:b}}function useMinimap(e,t={}){let[i,a]=n({isOpen:t.open??!1,isVisible:!1,isSupported:!1,currentScale:1}),[o,c]=n(null),l=s(null),u=s(new Map),d=s(null),p=s(null);f(()=>{if(!e)a(e=>({...e,isSupported:!1,isVisible:!1}));else{try{let n=e.get?.(`minimap`),r=hr(t.container||`.minimap-container`);if(!n){a(e=>({...e,isSupported:!1}));return}if(l.current=n,d.current=r,c(null),a(e=>({...e,isSupported:!0,isVisible:!0})),t&&typeof n.setOptions==`function`&&n.setOptions(t),typeof n.isOpen==`function`){let e=n.isOpen();a(t=>({...t,isOpen:e}))}let onViewportChange=e=>{a(t=>({...t,viewport:e.viewport,currentScale:e.scale}))},onToggle=e=>{a(t=>({...t,isOpen:e.open}))},i=e.get?.(`eventBus`);typeof i?.on==`function`&&(i.on(`minimap.viewport.changed`,onViewportChange),i.on(`minimap.toggle`,onToggle),u.current.set(`minimap.viewport.changed`,onViewportChange),u.current.set(`minimap.toggle`,onToggle),p.current=i)}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),a(e=>({...e,isSupported:!1}))}return()=>{if(p.current&&typeof p.current.off==`function`&&(u.current.forEach((e,t)=>{p.current?.off?.(t,e)}),u.current.clear()),p.current=null,l.current&&typeof l.current.destroy==`function`)try{l.current.destroy()}catch(e){console.warn(`Failed to destroy minimap:`,e)}l.current=null,d.current=null}}},[e,t.container]);let m=r(()=>{try{let e=l.current;if(!e)return;typeof e.open==`function`?e.open():typeof e.toggle==`function`&&e.toggle(!0)}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to open minimap:`,e)}},[]),h=r(()=>{try{let e=l.current;if(!e)return;typeof e.close==`function`?e.close():typeof e.toggle==`function`&&e.toggle(!1)}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to close minimap:`,e)}},[]);return{state:i,open:m,close:h,toggle:r(()=>{try{let e=l.current;if(!e)return;typeof e.toggle==`function`?e.toggle():i.isOpen?h():m()}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to toggle minimap:`,e)}},[i.isOpen,m,h]),setOptions:r(e=>{try{let t=l.current;if(!t||typeof t.setOptions!=`function`)return;t.setOptions(e),a(t=>({...t,isOpen:e.open??t.isOpen}))}catch(e){let t=e instanceof Error?e:Error(String(e));c(t),console.error(`Failed to set minimap options:`,e)}},[]),error:o}}var dp={async applyLayout(e){try{let{graphAwareLayoutService:t}=await Vi(async()=>{let{graphAwareLayoutService:e}=await import(`./GraphAwareLayoutService-C5N8K9dm.js`);return{graphAwareLayoutService:e}},__vite__mapDeps([42,1,7,8,43]),import.meta.url);return await t.applyLayout(e)}catch(e){return{success:!1,error:e}}}},fp=new Set([`bpmn:Process`,`bpmn:Collaboration`]);function laidOutMessage(e){return Y(`app.autoLayout.laidOut`,{count:e})}function countLaidOut(e){return(e??[]).filter(e=>e&&e.type!==`label`&&!e.labelTarget&&!fp.has(e.type??``)).length}function watchNextEdit(e,t){return e?.on?.(`commandStack.changed`,t),()=>e?.off?.(`commandStack.changed`,t)}async function layOut(e,t){let n=await t(e);return n.success?{ok:!0,count:countLaidOut(e.get(`elementRegistry`).getAll())}:{ok:!1,error:n.error}}async function layOutAndFit(e,t,n){let r=await layOut(e,t);return r.ok&&n(),r}async function layOutInMemory(e,t,n){return e.quietly(async()=>{let r=await layOutAndFit(t,n,()=>e.fitToScreen());return t.get(`commandStack`).clear(),r})}function LayoutBar({count:e,onUndo:t,onClose:n}){return u(`aside`,{class:`layout-bar`,role:`status`,"aria-label":Y(`app.autoLayout.autoLayout`),children:[u(`span`,{class:`layout-bar__message`,children:laidOutMessage(e)}),u(`button`,{type:`button`,class:`ui-button`,onClick:t,children:Y(`app.common.undo`)}),u(`button`,{type:`button`,class:`layout-bar__close`,onClick:n,title:Y(`app.common.close`),"aria-label":Y(`app.common.close`),children:u(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:u(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}async function openDrawnFile(e,t,n,r){let i=null;try{i=await n.getLicense()}catch{i=null}if(!D(i))return`placed`;let a=await layOutInMemory(e,t,r);return a.ok?`laid-out`:(console.error(`Auto-layout error:`,a.error),`placed`)}function addBackgroundToSvg(e,t){let n=e.match(/viewBox="([^"]+)"/),r=e.match(/<svg[^>]*>/);if(!n||!r||r.index===void 0)return e;let i=n[1].trim().split(/[\s,]+/).map(Number);if(i.length<4||i.some(e=>!Number.isFinite(e)))return e;let[a,o,s,c]=i,l=r.index+r[0].length,u=`<rect x="${a}" y="${o}" width="${s}" height="${c}" fill="${t}"/>`;return e.slice(0,l)+u+e.slice(l)}var pp={edgePixels:8192,maxScale:2},mp={edgePixels:3300,maxScale:1/0};async function convertSvgToPng(e,t,n=pp){return new Promise((r,i)=>{let a=e.match(/viewBox="([^"]+)"/);if(!a){i(Error(`Could not find viewBox in SVG`));return}let o=a[1].trim().split(/[\s,]+/).map(Number);if(o.length<4||o.some(e=>!Number.isFinite(e))){i(Error(`Could not find valid viewBox in SVG`));return}let[s,c,l,u]=o;if(l<=0||u<=0){i(Error(`Invalid SVG viewBox dimensions`));return}let d=Math.min(n.maxScale,n.edgePixels/Math.max(l,u,1)),f=document.createElement(`canvas`);f.width=l*d,f.height=u*d;let p=f.getContext(`2d`);if(!p){i(Error(`Could not get canvas context`));return}p.scale(d,d),t!==`transparent`&&(p.fillStyle=t,p.fillRect(0,0,l,u));let m=new Image,h=``,release=()=>{h&&URL.revokeObjectURL(h)};m.onload=()=>{release(),p.drawImage(m,0,0,l,u),r(f.toDataURL(`image/png`))},m.onerror=e=>{release(),i(Error(`Unable to load the SVG image: `+e))};let g=new Blob([e],{type:`image/svg+xml;charset=utf-8`});h=URL.createObjectURL(g),m.src=h})}async function createPdfFromPages(e){if(e.length===0)throw Error(`No pages to create PDF`);let t=e[0],n=(Number.isFinite(t.width)&&t.width>0?t.width:1)/(Number.isFinite(t.height)&&t.height>0?t.height:1),{jsPDF:r}=await Vi(async()=>{let{jsPDF:e}=await import(`./jspdf.es.min-C0L4zezU.js`);return{jsPDF:e}},__vite__mapDeps([44,1,45,2,7,8,46,15,14,16,17,18,19,13,28,29,5,30,34,37,36,38,39,40,21,47,48,20,49,50,51,52,53,54,55,56,6,9,10,41,4,57,25,26,58,59,60,24,61,62,63,64,65,66,67,68,69,32,33,70,71,72,73,74]),import.meta.url),i=new r({orientation:n>1?`landscape`:`portrait`,unit:`mm`,format:`a4`,compress:!0}),a=i.internal.pageSize.getWidth(),o=i.internal.pageSize.getHeight();for(let t=0;t<e.length;t++){let n=e[t];if(!n)continue;t>0&&i.addPage(),i.setFontSize(14),i.setTextColor(50,50,50),i.text(n.name,10,15),i.setDrawColor(200,200,200),i.line(10,18,a-10,18);let r=Math.max(1,a-20),s=Math.max(1,o-15-20),c=Number.isFinite(n.width)&&n.width>0?n.width:1,l=Number.isFinite(n.height)&&n.height>0?n.height:1,u=r,d=l/c*u;d>s&&(d=s,u=c/l*d);let f=10+(r-u)/2;i.addImage(n.png,`PNG`,f,25,u,d)}return i.output(`dataurlstring`)}var hp=[`unmapped`,`assumed`,`lost`];function ImportReportDialog({outcome:e,onClose:t,onSave:n}){if(!e)return null;let{result:r}=e,i=groupedNotes({notes:r.ok?r.report.notes:r.notes}),a=r.ok&&!e.savedTo&&n!==void 0,o=hp.every(e=>i[e].length===0);return u(dn,{title:a?Y(`app.importDiagram.previewTitle`):r.ok?Y(`app.importDiagram.diagramImported`):Y(`app.importDiagram.thisFileCouldNotBe`),size:`medium`,initialFocus:`title`,backdrop:`close`,onClose:t,footer:u(ln,{actions:a?[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:t},{id:`save`,label:Y(`app.importDiagram.saveAs`),role:`primary`,onClick:n}]:[{id:`close`,label:Y(`app.common.close`),role:`primary`,onClick:t}]}),children:u(`div`,{className:`import-report__body`,children:[u(`p`,{className:r.ok?`import-report__lead`:`import-report__lead import-report__lead--failed`,children:r.ok?summaryLine(r.report):r.message}),a&&u(`p`,{className:`import-report__why`,children:Y(`app.importDiagram.previewLead`)}),r.ok&&e.savedTo&&u(`p`,{className:`import-report__saved`,children:Y(`app.importDiagram.savedAs`,{path:folderAndName(e.savedTo)})}),r.ok&&o&&u(`p`,{className:`import-report__clean`,children:Y(`app.importDiagram.everythingInTheFileWas`)}),hp.map(e=>i[e].length===0?null:u(`section`,{className:`import-report__group import-report__group--${e}`,children:[u(`h3`,{children:noteHeading(e,i[e].length)}),u(`p`,{className:`import-report__why`,children:Y(`app.importDiagram.why.${e}`)}),u(`ul`,{children:i[e].map((e,t)=>u(`li`,{children:e},t))})]},e)),r.ok&&u(`p`,{className:`import-report__why`,children:Y(`app.importDiagram.connectorsKeepTheRoute`)})]})})}function ImportSourceDialog({open:e,onChoose:t,onClose:r}){let[i,a]=n(``),[o,s]=n(`camunda7`);if(!e)return null;let c=isImportSource(i)?i:void 0,choose=()=>t({...c?{from:c}:{},...c===`flowable`?{target:o===`camunda8`?`camunda8`:`camunda7`}:{}});return u(dn,{title:Y(`app.importDiagram.fromAnotherTool`),size:`medium`,initialFocus:`title`,backdrop:`close`,onClose:r,onSubmit:choose,footer:u(ln,{actions:[{id:`cancel`,label:Y(`app.common.cancel`),role:`cancel`,onClick:r},{id:`choose`,label:Y(`app.importDiagram.chooseFile`),role:`primary`,onClick:choose}]}),children:u(`div`,{class:`import-source`,children:[u(X,{label:Y(`app.importDiagram.sourceLabel`),hint:Y(`app.importDiagram.sourceHint`),children:e=>u(`select`,{...e,value:i,onChange:e=>a(e.target.value),children:[u(`option`,{value:``,children:Y(`app.importDiagram.sourceAuto`)}),mc.map(e=>u(`option`,{value:e,children:hc[e]},e))]})}),c===`flowable`&&u(X,{label:Y(`app.importDiagram.targetLabel`),children:e=>u(`select`,{...e,value:o,onChange:e=>s(e.target.value),children:qs.map(e=>u(`option`,{value:e,children:flowableTargetName(e)},e))})})]})})}function failure(e,t,n=[]){return{source:e,result:{ok:!1,message:t instanceof Error?t.message:String(t),notes:n}}}async function previewImport(e,t={}){let n=null;try{n=await e.chooseFile(``,{title:Y(`app.importDiagram.importDiagram`),description:Y(`app.importDiagram.aDrawIoVisioSignavio`),mode:`open`,selectFiles:!0,selectFolders:!1,multiSelect:!1})}catch{return null}if(!n)return null;let r=n.split(/[\\/]/).pop()??n,i;try{i=await e.readFileBytes(n)}catch(e){return failure(r,e)}try{return{source:r,result:importDiagram({name:r,data:i},t)}}catch(e){return failure(r,e)}}async function saveImport(e,t){if(!t.result.ok)return t;let n=null;try{n=await e.chooseFile(`bpmn`,{title:Y(`app.importDiagram.saveTheImportedDiagram`),description:Y(`app.importDiagram.theBpmn20File`),mode:`save`,defaultFileName:importedFileName(t.source)})}catch{return null}if(!n)return null;try{return await e.saveFile(n,t.result.bpmn),{...t,savedTo:n}}catch(e){return failure(t.source,e,t.result.report.notes??[])}}async function openImported(e,t){if(t?.savedTo&&typeof e?.revealElement==`function`)try{await e.revealElement(t.savedTo)}catch{}}function useCodeBridgeState(){let[e,t]=n(Vt());return f(()=>(t(Vt()),De(()=>t(Vt()))),[]),e}var gp=360,_p=8,vp=new Map;function snippetOf(e){let t=`${e.file}:${e.line}`,n=vp.get(t);return n||(n=Vt().actions?.snippet(e).catch(()=>null)??Promise.resolve(null),vp.set(t,n),n.then(e=>{e===null&&vp.get(t)===n&&vp.delete(t)})),n}function forgetSnippets(){vp.clear()}function Snippet({anchor:e}){let[t,r]=n(void 0);return f(()=>{let t=!0;return r(void 0),snippetOf(e).then(e=>{t&&r(e)}),()=>{t=!1}},[e.file,e.line]),t===void 0?u(`p`,{class:`code-card__note type-help`,children:Y(`app.codeBridge.snippetLoading`)}):!t||t.length===0?u(`p`,{class:`code-card__note type-help`,children:Y(`app.codeBridge.snippetUnavailable`)}):u(`pre`,{class:`code-card__code type-code`,"aria-label":tt(e),children:t.slice(0,_p).map((t,n)=>u(`div`,{class:`code-card__line`,children:[u(`span`,{class:`code-card__number`,children:e.line+n}),t]},n))})}function Places({binding:e,onOpen:t}){if(e.anchors.length===0)return null;let n=e.anchors.slice(0,5);return u(`ul`,{class:`code-card__places`,children:[n.map(e=>u(`li`,{children:u(`button`,{type:`button`,class:`code-card__place type-link`,onClick:()=>t(e),children:[u(`span`,{class:`code-card__where`,children:J(e.kind,tt(e))}),e.symbol&&e.kind!==`PROCESS`&&e.kind!==`DECISION`&&u(`span`,{class:`code-card__symbol type-help`,children:e.symbol})]})},`${e.file}:${e.line}`)),e.anchors.length>n.length&&u(`li`,{class:`code-card__note type-help`,children:Y(`app.codeBridge.moreCount`,{count:e.anchors.length-n.length})})]})}function CodeCardBody({status:e}){let t=Vt().actions,n=ut(e),r=e.state===`bound`?e.anchors.find(e=>e.kind!==`PROCESS`&&e.kind!==`DECISION`):void 0,i=t?.stubFor(e)??null,open=e=>{t?.open(e),Ft()};return u(`div`,{class:`code-card`,children:[u(`div`,{class:`code-card__head`,children:[u(`span`,{class:`code-card__state type-section-heading code-card__state--${e.state}`,children:wt(e)}),u(`span`,{class:`code-card__name type-dialog-title`,title:e.label,children:e.label})]}),e.bindings.filter(e=>e.state!==`notApplicable`).map(e=>u(`section`,{class:`code-card__binding`,children:[u(`div`,{class:`code-card__kind type-help`,children:[u(`span`,{children:zt(e.kind)}),u(`code`,{class:`code-card__value type-body`,children:e.value})]}),St(e).map(e=>u(`p`,{class:`code-card__note type-help`,children:e},e)),u(Places,{binding:e,onOpen:open})]},`${e.kind}:${e.value}:${e.listener??``}`)),r&&u(Snippet,{anchor:r}),(e.tests.length>0||e.reached!==null||e.paused)&&u(`ul`,{class:`code-card__facts type-help`,children:[e.tests.length>0&&u(`li`,{children:Y(`app.codeBridge.tests`,{count:e.tests.length})}),e.reached===!0&&u(`li`,{children:Y(`app.codeBridge.reached`)}),e.reached===!1&&u(`li`,{children:Y(`app.codeBridge.notReached`)}),e.paused&&u(`li`,{children:Y(`app.codeBridge.paused`)})]}),(n?.anchors[0]||i)&&u(`div`,{class:`code-card__actions`,children:[i&&u(`button`,{type:`button`,class:`ui-button`,onClick:()=>{t?.createStub(e),Ft()},children:Y(`app.codeBridge.createStub`)}),n?.anchors[0]&&u(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>open(n.anchors[0]),children:J(n.anchors[0].kind,``)})]})]})}function HoverCard({anchor:e,status:t}){let r=s(null),[i,a]=n(null);return d(()=>{let place=()=>{let t=r.current;if(!t)return;let n=e.getBoundingClientRect(),i=Ni({left:n.left,top:n.top,width:n.width,height:n.height},{width:gp,height:t.offsetHeight},{width:window.innerWidth||1024,height:window.innerHeight||768});a({top:i.top,left:i.left})};return place(),window.addEventListener(`resize`,place),()=>window.removeEventListener(`resize`,place)},[e,t]),u(`div`,{ref:r,class:`ui-popover code-card-popover`,role:`dialog`,"aria-label":Y(`app.codeBridge.cardLabel`,{element:t.label}),style:{width:`${gp}px`,top:`${i?.top??0}px`,left:`${i?.left??0}px`,visibility:i?`visible`:`hidden`},onPointerEnter:Ot,onPointerLeave:ct,children:u(CodeCardBody,{status:t})})}function CodeBridgeLayer(){let e=useCodeBridgeState(),t=e.card,n=t?e.statuses.get(t.elementId):void 0,r=t?.pinned===!0;return f(()=>{if(!r)return;let e=window.requestAnimationFrame(()=>{let e=document.querySelector(`.code-card-popover`);e&&!e.contains(document.activeElement)&&e.querySelector(`button`)?.focus()});return()=>window.cancelAnimationFrame(e)},[r,t?.elementId]),!t||!n?null:t.pinned?u(mn,{anchor:t.anchor,label:Y(`app.codeBridge.cardLabel`,{element:n.label}),width:gp,onClose:Ft,class:`code-card-popover`,children:u(CodeCardBody,{status:n})}):u(HoverCard,{anchor:t.anchor,status:n})}async function workerForTemplate(e,t,n,r=`8.8`){if(!await e.unlock())return`locked`;let i=(await loadTemplates(await e.store())).get(t);if(!i)return await e.notify(Y(`app.project.theElementTemplateIsNot`,{id:t}),!0),`nothing`;let a=workerFromTemplate(i.template,n,r),o=(await e.root()).replace(/[\\/]+$/,``),s=(await e.diagrams()).map(e=>e.replaceAll(`\\`,`/`).slice(0,Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`)))).find(e=>e===o||e.startsWith(`${o}/`)),c=s===o?``:s?s.slice(o.length+1):`workers`,l=c?`${c}/${a.fileName}`:a.fileName;try{await e.create(o,l,a.content)}catch(t){return await e.notify(Y(`app.project.theJobWorkerWasNot`,{failure:t instanceof Error?t.message:String(t)}),!0),`refused`}return await e.notify(Y(`app.project.wasWrittenForInMove`,{fileName:a.fileName,name:i.template.name,inside:c})),await e.open(`${o}/${l}`),`written`}function templateHost(e,t,n){return{unlock:()=>e.requestFeature(U.CODE_LINKS),root:t,notify:(t,n)=>e.notifyUser(t,n),open:t=>e.openAsText(t),create:(t,n,r)=>e.createProjectFiles(t,[{path:n,content:r}]),contracts:n,diagrams:async()=>(await e.getProjectFiles()).files.map(e=>e.path),store:async()=>{let n=(await t()).replace(/[\\/]+$/,``);return{root:t,list:async()=>((await e.getProjectFiles()).templates??[]).map(e=>e.path.replaceAll(`\\`,`/`).replace(`${n}/`,``)),read:t=>e.readFileIfPresent(`${n}/${t}`),write:(t,r)=>e.saveFile(`${n}/${t}`,r)}}}}var yp=8;function templatesOf(e){return e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`)}function setPausedElements(e){Gt(new Set(e))}function useCodeBridge({project:e,active:t,installedTemplates:n}){let r=G(),i=hi(r,`codeBridge`)&&typeof r.findCodeStatus==`function`,a=l(()=>e?It(e.model):[],[e?.model]),o=l(()=>JSON.stringify(a),[a]),c=s({project:e,installedTemplates:n});c.current={project:e,installedTemplates:n};let u=e?.code??null;f(()=>{if(i)return ot({open:e=>{let t=G();(e.kind===`PROCESS`||e.kind===`DECISION`?t.revealElement(e.file):t.openAsText(e.file,e.line)).catch(e=>console.error(`Could not open the code:`,e))},stubFor:e=>{let t=mt(e,templatesOf(c.current.installedTemplates));return t?{templateId:t.id,language:gt(c.current.project?.sources??[])}:null},createStub:e=>{let t=mt(e,templatesOf(c.current.installedTemplates));if(!t)return;let n=G(),root=async()=>(await n.getProjectFiles()).root??``,contracts=async()=>c.current.project?.contracts??[];workerForTemplate(templateHost(n,root,contracts),t.id,gt(c.current.project?.sources??[])).catch(e=>console.error(`Could not create the worker:`,e))},snippet:async e=>{let t=await G().readCodeSnippet?.(e.file,e.line,yp);return t?t.lines:null}}),()=>{ot(null),qt()}},[i]),f(()=>{if(!i||!t||!e)return;let n=!0,r=G().getBpmnFilePath()??``;return forgetSnippets(),G().findCodeStatus?.(r,a).then(t=>{if(!n)return;let r=At(e.coverage);Ge(t.licensed?lt(t.statuses,{reached:r,paused:Vt().paused}):[])}).catch(()=>{n&&Ge([])}),()=>{n=!1}},[i,t,o,u,e?.coverage])}var bp=[`missing-implementation`,`variable-typo`,`near-name`,`worker-fetch`,`mapping-order`,`template-drift`,`template-rejected`];function severityOf(e){return bp.includes(e)?`error`:`warning`}function list(e,t){return e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`}function countable(e){let t=e?.businessObject;return!!t&&(t.$instanceOf?.(`bpmn:FlowNode`)||t.$type===`bpmn:SequenceFlow`)}function isError(e,t){return(e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.eventDefinitions??[]).some(e=>e.$type===`bpmn:ErrorEventDefinition`)}function nameOf(e,t){return e?.get?.(`elementRegistry`)?.get?.(t)?.businessObject?.name?.trim()||t}function labels(e){return[...new Set(e.map(e=>e.label))]}function insightOf(e,t,n){return e?withoutAbsenceClaims(diagramInsight({model:e.model,files:e.files,targets:e.targets,code:e.code,workers:e.workers,codeNames:e.codeNames,order:Mn(t??null),definitions:t,codeLinks:n,variables:e.workers?.variableChecks?{mode:e.workers.variableChecks.check,inputs:e.workers.variableChecks.inputs,entitled:e.workers.variableChecks.entitled}:void 0}),e.clientFacts):[]}function factsOf(e,t,n,r,i){let a=[],o=r?.coverage??null,s=n.find(e=>e.elementId===t);if(s){let n=labels(s.implementations??[]),r=labels(s.tests??[]),i=isError(e,t);n.length>0?a.push({label:Y(i?`app.code.fact.thrownBy`:`app.code.fact.runsIn`),value:list(n,2)}):s.missingImplementation?a.push({label:Y(`app.code.fact.runsIn`),value:Y(`app.code.fact.nothingInCode`),warning:!0}):s.neverThrown&&a.push({label:Y(`app.code.fact.thrownBy`),value:Y(`app.code.fact.nothingInCode`),warning:!0}),r.length>0&&a.push({label:Y(`app.code.fact.tests`),value:`${r.length} · ${list(r,2)}`}),(s.usages??[]).length>0&&a.push({label:Y(`app.code.fact.inCode`),value:Y(`app.code.fact.places`,{count:(s.usages??[]).length})})}let c=e?.getDefinitions?.(),l=Un(c).uses.filter(e=>e.elementId===t),u=[...new Set(l.filter(e=>e.writes).map(e=>e.name))],d=[...new Set(l.filter(e=>!e.writes).map(e=>e.name))];u.length>0&&a.push({label:Y(`app.code.fact.sets`),value:list(u,5)}),d.length>0&&a.push({label:Y(`app.code.fact.reads`),value:list(d,5)}),s&&((s.unfetched??[]).forEach(e=>a.push({label:e.name,value:e.closest?Y(`app.code.fact.notFetchedClosest`,{closest:e.closest}):Y(`app.code.fact.notFetched`),warning:!0})),(s.unread??[]).forEach(e=>a.push({label:e,value:Y(`app.code.fact.unread`),warning:!0})),(s.lateReads??[]).forEach(e=>a.push({label:e,value:Y(`app.code.fact.lateRead`),warning:!0})),(s.near??[]).forEach(e=>a.push({label:e.name,value:e.caseOnly?Y(`app.code.fact.nearCase`,{near:e.near}):Y(`app.code.fact.near`,{near:e.near}),warning:!0})),(s.implicit??[]).forEach(e=>a.push({label:e.jobType,value:Y(`app.code.fact.implicit`,{method:e.method}),warning:!0})),(s.mappingOrder??[]).forEach(e=>a.push({label:e.path,value:Y(`app.code.fact.mappingOrder`,{target:e.target}),warning:!0})),s.lostUpdate&&a.push({label:s.lostUpdate,value:Y(`app.code.fact.lostUpdate`),warning:!0}),(s.unsetReads??[]).forEach(e=>a.push({label:e.name,value:e.closest?Y(`app.code.fact.neverSetClosest`,{closest:e.closest}):Y(`app.code.fact.neverSet`),warning:!0})));let f=e?.get?.(`elementRegistry`)?.get?.(t),p=countable(f)?reachOf(o,processIdsOf$1(e)):null;if(p){let e=p.all.elements.has(t)||p.all.flows.has(t),n=p.tests.filter(e=>e.reach.elements.has(t)||e.reach.flows.has(t)).length,r=e?p.tests.length>0?Y(`app.code.fact.reachedBy`,{tests:n,total:p.tests.length}):Y(`app.code.fact.reached`):Y(`app.code.fact.noTestReaches`);a.push({label:Y(`app.code.fact.coverage`),value:r,warning:!e})}let m=liveOf(i?.state??null,t);if(m&&(m.waiting>0||m.incidents>0)){let e=i?.engine?.profile??Y(`app.code.fact.theEngine`),t=[Y(`app.code.fact.here`,{count:m.waiting}),m.incidents>0&&Y(`app.code.fact.withIncident`,{count:m.incidents})].filter(Boolean).join(` · `);a.push({label:Y(`app.code.fact.on`,{where:e}),value:t,warning:m.incidents>0})}return a}function findingsOf(e,t){return e?t.flatMap(t=>{let n=nameOf(e,t.elementId),r=t.missingImplementation?[{title:Y(`app.code.finding.missingImplementation`,{name:n}),where:Y(`app.code.finding.missingImplementationWhere`),elements:[t.elementId],kind:`missing-implementation`,severity:`error`}]:t.neverThrown?[{title:Y(`app.code.finding.neverThrown`,{name:n}),where:Y(`app.code.finding.neverThrownWhere`),elements:[t.elementId],kind:`never-thrown`,severity:`error`}]:[],i=(t.unsetReads??[]).filter(e=>e.closest).map(e=>({title:Y(`app.code.finding.typo`,{name:e.name,closest:e.closest}),where:n,elements:[t.elementId],kind:`variable-typo`,severity:`error`})),a=(t.unfetched??[]).map(e=>({title:Y(`app.code.finding.unfetched`,{name:e.name}),where:e.closest?Y(`app.code.finding.unfetchedClosestWhere`,{closest:e.closest,name:e.name}):Y(`app.code.finding.unfetchedWhere`),elements:[t.elementId],kind:`worker-fetch`,severity:severityOf(`worker-fetch`)})),o=(t.unread??[]).map(e=>({title:Y(`app.code.finding.unread`,{name:e}),where:Y(`app.code.finding.unreadWhere`),elements:[t.elementId],kind:`writer-unread`,severity:severityOf(`writer-unread`)})),s=(t.lateReads??[]).map(e=>({title:Y(`app.code.finding.lateRead`,{name:e}),where:Y(`app.code.finding.lateReadWhere`),elements:[t.elementId],kind:`late-read`,severity:severityOf(`late-read`)})),c=(t.near??[]).map(e=>({title:e.caseOnly?Y(`app.code.finding.nearCase`,{name:e.name,near:e.near}):Y(`app.code.finding.near`,{name:e.name,near:e.near}),where:Y(`app.code.finding.nearWhere`,{kind:Y(`app.code.kind.${e.kind}`)}),elements:[t.elementId],kind:`near-name`,severity:severityOf(`near-name`)})),l=(t.implicit??[]).map(e=>({title:Y(`app.code.finding.implicit`,{method:e.method}),where:Y(`app.code.finding.implicitWhere`),elements:[t.elementId],kind:`implicit-job-type`,severity:severityOf(`implicit-job-type`)})),u=(t.mappingOrder??[]).map(e=>({title:Y(`app.code.finding.mappingOrder`,{path:e.path,target:e.target}),where:Y(`app.code.finding.mappingOrderWhere`),elements:[t.elementId],kind:`mapping-order`,severity:severityOf(`mapping-order`)})),d=t.lostUpdate?[{title:Y(`app.code.finding.lostUpdate`,{name:t.lostUpdate}),where:Y(`app.code.finding.lostUpdateWhere`),elements:[t.elementId],kind:`lost-update`,severity:severityOf(`lost-update`)}]:[],f=(t.unknownFields??[]).map(e=>({title:fieldFindingTitle(e),where:fieldFindingWhere(e),elements:[t.elementId],kind:`variable-field`,severity:severityOf(`variable-field`)})),p=(t.unknownNames??[]).map(e=>({title:nameFindingTitle(e),where:nameFindingWhere(),elements:[t.elementId],kind:`variable-unknown`,severity:severityOf(`variable-unknown`)}));return[...r,...i,...a,...o,...s,...c,...l,...u,...d,...f,...p]}):[]}function boundTo(e){let t=e.elementType??{};return t[`zeebe:taskDefinition`]??t[`camunda:topic`]??null}function templateFindings(e,t,n,r){return n.length===0||r.length===0?[]:r.flatMap(e=>{let r=boundTo(e),i=n.find(e=>e.value===r);if(!r||!i)return[];let a=Qa(e,i);if(!a)return[];let o=t.workers.filter(e=>e.value===r).map(e=>e.elementId);return o.length===0?[]:[{title:Y(`app.code.finding.templateDrift`,{name:e.name||r,drift:eo(a)}),where:`${r} · ${i.file}`,elements:[...new Set(o)],kind:`template-drift`,severity:severityOf(`template-drift`)}]})}var xp=`diagram.bpmn`,Sp=/agenticai|aiAgent|toolContainer/;async function mcpClientsOf(e){let{connectionsOf:t}=await Vi(async()=>{let{connectionsOf:e}=await import(`./data-CdiToGOq.js`).then(e=>e.r);return{connectionsOf:e}},__vite__mapDeps([35,1,31,32,28,29,5,18,30,33,7,8,4,34,13]),import.meta.url),n=t(e,{environment:null,against:null,matrix:!1}).report.rows.filter(e=>e.kind===`mcp-client`);return Object.fromEntries(n.map(e=>[e.name,e.status]))}var Cp=300,wp=null;function codeFor(e,t){let n=e.map(Qn).sort().join(`
|
|
27
|
+
`);return(wp?.key!==n||wp.version!==t)&&(wp={key:n,version:t,code:no.code(e)}),wp.code}async function load(e,t){let n=G().getBpmnFilePath()??``,r=await no.read(),i=e??r.diagrams.find(e=>e.path===n)?.text??``,a=await Q(n||xp,i),o=await no.workerVariables(),s=await no.snapshot(r.diagrams.map(e=>e.path===n?{path:n,text:i}:e),o),c=Fn(a,o),l=new Map;[...or(s.files,s.targets),...c.elements.flatMap(e=>Jn(c,e.id))].forEach(e=>l.set(Qn(e),e));let u=await codeFor([...l.values()],t);return{model:c,files:s.files,targets:s.targets,code:u,coverage:r.reports.length>0?projectCoverage(r.root,r.reports):null,workers:o,codeNames:u?.names??{},sources:r.sources.map(e=>({file:e.path})),contracts:u?.structure?.workers??[],clientFacts:u?.clientFacts??o?.clientFacts,connections:n?(await Vi(async()=>{let{findingsFor:e}=await import(`./data-CdiToGOq.js`).then(e=>e.r);return{findingsFor:e}},__vite__mapDeps([35,1,31,32,28,29,5,18,30,33,7,8,4,34,13]),import.meta.url)).findingsFor({...r,diagrams:r.diagrams.map(e=>e.path===n?{...e,text:i}:e)},n):[],mcpClients:n&&Sp.test(i)?await mcpClientsOf({...r,diagrams:r.diagrams.map(e=>e.path===n?{...e,text:i}:e)}):{},suggestions:{texts:[...r.diagrams.filter(e=>e.path!==n).map(e=>({path:e.path,text:e.text})),{path:n||xp,text:i}],workers:o,focus:n||xp}}}function useProject(e){let[t,r]=n(null),[i,a]=n(0),o=w();return f(()=>{if(!o)return;let e=window,changed=()=>a(e=>e+1);return e.codeChanged=changed,e.coverageChanged=changed,()=>{e.codeChanged===changed&&(e.codeChanged=void 0),e.coverageChanged===changed&&(e.coverageChanged=void 0)}},[o]),f(()=>{if(!o)return;let t=!0,run=()=>{document.visibilityState===`visible`&&load(e,i).then(e=>{t&&(r(e),codeLinksReloaded())}).catch(e=>console.error(`Penstock could not read the project:`,e))},n=window.setTimeout(run,Cp),visible=()=>{document.visibilityState===`visible`&&run()};return document.addEventListener(`visibilitychange`,visible),()=>{t=!1,window.clearTimeout(n),document.removeEventListener(`visibilitychange`,visible)}},[e,i,o]),t}function connectionCodeFindings(e){return e.map(e=>({title:ro(e),where:io(e)??`${Ki(`connections`,e.rule)} · ${e.file.split(`/`).pop()}:${e.line}`,elements:e.elementId?[e.elementId]:[],kind:`connection`,severity:e.severity}))}function agentsFindingsOf(e,t){return e?ao(e,t?{mcpStatus:t}:{}):[]}function agentCodeFindings(e){return e.map(e=>({title:so(e),where:Ki(`agents`,e.rule),elements:[e.elementId],kind:`agent`,severity:e.severity,rule:`agents/${e.rule}`}))}var Tp=300;function modelOf(e){let t=e?.getDefinitions?.();if(!t)return null;try{return oo(t)}catch(e){return console.error(`The AI agents could not be read:`,e),null}}function useAgentsModel(e){let[t,r]=n(()=>modelOf(e));return f(()=>{r(modelOf(e));let t=e?.get?.(`eventBus`);if(!t)return;let n,again=()=>{n&&clearTimeout(n),n=setTimeout(()=>r(modelOf(e)),Tp)};return t.on(`elements.changed`,again),t.on(`import.done`,again),()=>{n&&clearTimeout(n),t.off(`elements.changed`,again),t.off(`import.done`,again)}},[e]),t}function useAgentFindings(e,t){return l(()=>agentsFindingsOf(e,t),[e,t])}function objectsOf(e){return e.filter(e=>typeof e==`object`&&!!e)}function templateRejectionsOf(e,t,n){let r=vt(objectsOf(t),n),i=r.unloadable.map(({template:e,reasons:t})=>({...Nt(e),reasons:t})),a=e?.get?.(`templateRejections`,!1)?.rejected(r.loadable)??[];return[...i,...a].map(({name:e,id:t,reasons:n})=>({name:e,id:t,reasons:n}))}function templateRejectionFindings(e,t,n){return templateRejectionsOf(e,t,n).map(e=>({title:e.id?Y(`app.templates.rejected.line`,{name:e.name,id:e.id,reason:e.reasons.join(`; `)}):Y(`app.templates.rejected.anonymous`,{reason:e.reasons.join(`; `)}),where:e.id,elements:[],kind:`template-rejected`,severity:`error`}))}var Ep=[{id:`palette`,target:`.djs-palette`},{id:`properties`,target:`#js-properties-panel`},{id:`check`,target:`button#diagram-check`},{id:`tool-window`},{id:`deploy`,target:`button#deploy`},{id:`more`,target:`button#toolbar-more`}];function titleOf(e){return Y(`app.tour.${e.id}.title`)}function bodyOf(e,t,n=!1){let r=Y(n?`app.tour.profileChoice`:`app.tour.singleProfile`);return Y(`app.tour.${e.id}.body`,{shortcut:t,profiles:r}).replace(/\s+/g,` `).trim()}function stepsPresent(e){return Ep.filter(t=>!t.target||e(t.target))}function tourDue(e){return e.available&&e.tourSeen!==!0}var Dp=16,Op=8,kp={width:320,height:168};function cardSize(e){return{width:kp.width,height:e!==null&&e>0?Math.ceil(e):kp.height}}function placeCard(e,t,n){let clamp=(e,t,n)=>Math.max(Dp,Math.min(e,n-t-Dp));if(!e)return{left:Dp,top:n.height-t.height-Dp};let r=e.height>e.width,i=e.left+e.width/2<n.width/4&&r,a=e.left+e.width/2>n.width*3/4&&r,o=i?e.left+e.width+Op:a?e.left-t.width-Op:e.left+e.width/2-t.width/2,s=i||a?e.top:e.top+e.height+Op;return{left:clamp(o,t.width,n.width),top:clamp(s,t.height,n.height)}}function useTour(e){let[t,r]=n(!1);f(()=>{if(!e||!tourDue({available:hn(),tourSeen:gn().tourSeen}))return;let t=window.setTimeout(()=>r(!0),400);return()=>window.clearTimeout(t)},[e]);let close=()=>{r(!1);try{gn().tourSeen!==!0&&_n({tourSeen:!0})}catch{}};return{open:t,close,show:()=>r(!0)}}function rectOf(e){if(!e?.target)return null;try{let t=document.querySelector(e.target)?.getBoundingClientRect();return t?{left:t.left,top:t.top,width:t.width,height:t.height}:null}catch{return null}}function Tour({open:e,onClose:t,profiles:r=1}){let[i,a]=n([]),[c,l]=n(0),[p,m]=n(null),[,h]=n(0),g=s(null),_=s(null);d(()=>{e&&(a(stepsPresent(e=>{try{return document.querySelector(e)!==null}catch{return!1}})),l(0))},[e]),d(()=>{if(e)try{let e=_.current?.getBoundingClientRect();m(e&&e.height>0?e.height:null)}catch{m(null)}},[e,c,i]),f(()=>{if(!e)return;let again=()=>h(e=>e+1),keys=e=>{e.key===`Escape`&&t()};return window.addEventListener(`resize`,again),document.addEventListener(`keydown`,keys),()=>{window.removeEventListener(`resize`,again),document.removeEventListener(`keydown`,keys)}},[e,t]),f(()=>{e&&!document.activeElement?.closest(`input, textarea, [contenteditable="true"]`)&&g.current?.focus()},[e,c,i]);let v=i[c];if(!e||!v)return null;let y=rectOf(v),b=cardSize(p),{left:x,top:S}=placeCard(y,b,{width:typeof window<`u`&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:1024,height:typeof window<`u`&&Number.isFinite(window.innerHeight)&&window.innerHeight>0?window.innerHeight:768}),C=c===i.length-1;return u(o,{children:[y&&u(`div`,{className:`editor-tour__spot`,style:{left:y.left-2,top:y.top-2,width:y.width+4,height:y.height+4}}),u(`div`,{className:`editor-tour`,ref:_,role:`dialog`,"aria-label":Y(`app.tour.label`),style:{left:x,top:S,width:b.width},children:[u(`span`,{className:`editor-tour__count`,children:Y(`app.tour.step`,{index:c+1,total:i.length})}),u(`h2`,{className:`editor-tour__title`,children:titleOf(v)}),u(`p`,{className:`editor-tour__body`,children:bodyOf(v,lo(co.shortcut,se())??``,r>1)}),u(`div`,{className:`editor-tour__actions`,children:[u(`button`,{type:`button`,className:`ui-button`,onClick:t,children:Y(`app.tour.skip`)}),u(`span`,{className:`editor-tour__gap`}),c>0&&u(`button`,{type:`button`,className:`ui-button`,onClick:()=>l(c-1),children:Y(`app.common.back`)}),u(`button`,{type:`button`,className:`ui-button ui-button--primary`,ref:g,onClick:()=>C?t():l(c+1),children:Y(C?`app.tour.done`:`app.tour.next`)})]})]})]})}function App({initialXml:e,apiClient:t,eventBus:i,file:a,scriptHost:o}){let c=h({kind:`bpmn`,file:a,fallbackName:`diagram.bpmn`}),d=c.canvas,p=w(),[_,y]=n({xml:e,selectedElementId:void 0,isExportDialogOpen:!1,isDiagramCheckOpen:!1,isMigrationOpen:!1,isCoverageOpen:!1,isRunsOpen:!1,isMarketplaceOpen:!1,currentBpmnXml:``,modeler:null,installedTemplates:[],isCamunda8:!1,isCamunda7:!1,isOperaton:!1,isCibSeven:!1,isFlowable:!1,isActiviti:!1,lintSource:null,isEngineConfigured:!1,isConfigLoading:!0,configLoadFailed:!1}),b=s(null),x=pe(Gd.map(e=>e.id),`bpmn`),S=m(c.key,x.shownTab),C=v(),[E,D]=n(!1),O=_.modeler,A=_.isCamunda8?`camunda-8`:_.isOperaton?`operaton`:_.isCibSeven?`cib-seven`:_.isCamunda7?`camunda-7`:_.isFlowable?`flowable`:_.isActiviti?`activiti`:`classic`,j=r(async e=>{let n=_.lintSource,r=n?.clientBundlePath?await ht(await t.file.readFile(n.clientBundlePath)):_t(n?.configPath?await t.file.readFile(n.configPath):null);return nt({...r,config:k(r.config)},A,e)},[_.lintSource,t,A]);f(()=>{if(!O)return;let e=!1,apply=()=>{let t=O.getDefinitions?.();j(t).then(t=>{if(e)return;let n=O.get(`linting`,!1);n&&(Kt(n),n.setLinterConfig(t))}).catch(e=>console.error(`Failed to load the bpmnlint rules:`,e))};apply();let t=window;p&&(t.lintRulesChanged=apply);let n=O.get(`eventBus`,!1);return n?.on(`import.done`,apply),()=>{e=!0,n?.off(`import.done`,apply),t.lintRulesChanged===apply&&delete t.lintRulesChanged}},[O,j,p]);let P=useTokenSimulation(O),F=useMinimap(O),I=r(e=>{y(t=>({...t,...e}))},[]);f(()=>{if(O)return Ga(O,G())},[O]);let L=r(async()=>{I({isConfigLoading:!0,configLoadFailed:!1});try{let e=await t.bpmn.getConfig();if(!e){I({isConfigLoading:!1,configLoadFailed:!0});return}let n=!!e.engine,r=ki(e.engine),i=r?.family===`camunda-8`,a=r?.family===`camunda-7`,o=r?.key===`operaton`,s=r?.key===`cib-seven`,c=r?.key===`flowable`,l=r?.key===`activiti`,u=e.elementTemplates||[],d=e.elementTemplatesContent||[],f=Array.isArray(d)?d:[],p=[...u,...f];I({isCamunda8:!!i,isCamunda7:!!a,isOperaton:!!o,isCibSeven:!!s,isFlowable:c,isActiviti:l,lintSource:e.bpmnLint??null,installedTemplates:p,isEngineConfigured:n,isConfigLoading:!1,configLoadFailed:!1})}catch{I({isConfigLoading:!1,configLoadFailed:!0})}},[t,I]);f(()=>{L()},[L]);let R=l(()=>Ua({save:e=>t.bpmn.saveBpmnXml(e),onFailure:e=>{console.error(`Failed to save BPMN:`,e),$.error(mi(e)?Y(`app.editor.saveRefused`,{reason:e.message}):Y(`app.editor.saveFailed`))}}),[t]);f(()=>t.bridge.onDocumentChanged?.(e=>{R.reloaded(e),b.current?b.current?.reloadXml(e).then(()=>I({xml:e,currentBpmnXml:e})).catch(e=>{console.error(`Failed to reload the diagram from its file:`,e),$.error(Y(`app.editor.reloadFailed`))}):(I({xml:e,currentBpmnXml:e}),re(e===``?Ma():null))}),[I,R,t]);let[z,B]=n(null),V=r(e=>{B(null),I({xml:e,currentBpmnXml:e}),R.edited(e)},[I,R]),H=r(e=>{I({selectedElementId:e??void 0}),i.emit(`element.selected`,{id:e})},[I,i]),W=s(null),K=s(null);f(()=>()=>{K.current?.(),W.current?.dispose()},[]);let te=r(()=>{let e=b.current?.getModeler()??null;if(I({modeler:e}),!e)return;d?.attach(e);let n=window;K.current?.(),W.current?.dispose();let r=attachScriptTabs(e,o??t.bridge);W.current=r,K.current=o?.connect(r)??null,n.scriptTabsChanged=e=>r.setOpen(e),n.scriptSlotChanged=(e,t)=>r.applyHostWrite(e,t),n.pendingScriptTabs&&=(r.setOpen(n.pendingScriptTabs),void 0),n.revealElement=t=>{let n=revealElement(e,t);return n&&H(t),n},n.showDebugPosition=t=>{setPausedElements(t.current??[]),showDebugPosition(e,t)},n.clearDebugPosition=()=>{setPausedElements([]),clearDebugPosition(e)},n.pendingDebug&&=(showDebugPosition(e,n.pendingDebug),void 0),typeof n.pendingReveal==`string`&&(n.revealElement(n.pendingReveal),n.pendingReveal=void 0)},[I,H,d,t]);f(()=>()=>d?.detach(),[d]),f(()=>{let e=_.modeler;if(e)return t.bridge.onRevealElement?.(t=>{let n=revealElement(e,t);return n&&H(t),n})},[_.modeler,t,H]);let[ne,re]=n(()=>e===``?Ma():null),ie=r(e=>{console.error(`Canvas import error:`,e),re(Pa(e))},[]),ae=r(()=>{let e=G().getBpmnFilePath();e&&G().openAsText(e,ne?.line??void 0)},[ne]),oe=r(e=>{console.error(`Canvas error:`,e),$.error(Y(`app.editor.loadFailed`,{message:e?.message??String(e)}))},[]),se=r(()=>P.state.isRunning?($.info(Y(`app.editor.stopSimulation`)),!0):!1,[P.state.isRunning]),ce=r(()=>{if(se())return;let e=G();e.undo?e.undo().catch(e=>console.error(`Failed to undo:`,e)):b.current?.undo()},[se]),le=r(()=>{if(se())return;let e=G();e.redo?e.redo().catch(e=>console.error(`Failed to redo:`,e)):b.current?.redo()},[se]),de=r(()=>{se()||b.current?.copy()},[se]),fe=r(()=>{se()||b.current?.paste()},[se]),ve=r(()=>{se()||Pr(O)},[O,se]),ye=r(()=>Lr(O),[O]),be=r(()=>{if(O&&!se())try{let e=O.get(`selection`),t=O.get(`modeling`);if(!e||!t)return;let n=e.get();n.length>0&&t.removeElements(n)}catch(e){console.error(`Error deleting elements:`,e),$.error(Y(`app.editor.deleteFailed`))}},[O,se]),xe=r(()=>{window.location.reload()},[]),Se=r(e=>{let t=window.appConfig;t&&(t.engine=e);let n=ki(e);D(!0),I({isEngineConfigured:!0,isCamunda8:n?.family===`camunda-8`,isCamunda7:n?.family===`camunda-7`,isOperaton:n?.key===`operaton`,isCibSeven:n?.key===`cib-seven`,isFlowable:n?.key===`flowable`,isActiviti:n?.key===`activiti`})},[I]),[Ce,we]=n(Yt.rendering()===`sketchy`),[Te,Ee]=n(Yt.commentBadges());f(()=>{(_.modeler?.get?.(`commentBadges`,!1))?.refresh?.()},[Te]);let[De,Oe]=n(Yt.codeBadges());f(()=>{(_.modeler?.get?.(`codeBadges`,!1))?.refresh?.()},[De]);let ke=useTour(_.modeler!==null),Ae=Wa({ready:_.modeler!==null,suspended:ke.open}),je=ge(x.toggle),Me=useOpenCommentCount(O);f(()=>(We(openCommentsTab({select:x.select,reveal:e=>{O&&revealElement(O,e)}})),()=>We(()=>void 0)),[x.select,O]);let Ne=r(async()=>{try{let e=await b.current?.exportXml();e&&I({currentBpmnXml:e,isExportDialogOpen:!0})}catch(e){console.error(`Error opening export dialog:`,e),$.error(Y(`app.editor.exportOpenFailed`))}},[I]),Pe=r(async()=>{try{let e=await b.current?.exportXml();e&&await Va(`bpmn`,e,G().getBpmnFilePath())}catch(e){$.error(Y(`app.share.couldNotShareThisDiagram`,{failure:e instanceof Error?e.message:String(e)}))}},[]),[Fe,Ie]=n(null),[Le,Re]=n(!1),ze=r(()=>{Re(!0)},[]),Be=r(async e=>{Re(!1);try{Ie(await previewImport(G(),e))}catch(e){$.error(Y(`app.editor.importFailed`,{message:e instanceof Error?e.message:String(e)}))}},[]),Ve=r(async()=>{if(Fe)try{let e=await saveImport(G(),Fe);e&&Ie(e)}catch(e){$.error(Y(`app.editor.importFailed`,{message:e instanceof Error?e.message:String(e)}))}},[Fe]),He=r(()=>{I({isExportDialogOpen:!1})},[I]),Ue=x.state.tab===`problems`&&!x.state.hidden,Ge=x.state.tab===`monitor`&&!x.state.hidden,Ke=x.state.tab===`debug`&&!x.state.hidden,qe=Ue||_.isDiagramCheckOpen,Je=_.isDiagramCheckOpen&&!Ue,Ye=r(()=>{_.isMigrationOpen&&Ue?I({isMigrationOpen:!1}):(x.select(`problems`),y(e=>({...e,isMigrationOpen:!0,isCoverageOpen:!1})))},[_.isMigrationOpen,Ue,x.select,I]),Xe=r(()=>{_.isDiagramCheckOpen||Ue?(I({isDiagramCheckOpen:!1,isMigrationOpen:!1}),Ue&&x.select(`properties`)):y(e=>({...e,isDiagramCheckOpen:!0,isCoverageOpen:!1}))},[_.isDiagramCheckOpen,Ue,x.select,I]),Ze=r(()=>{I({isDiagramCheckOpen:!1})},[I]),Qe=r(()=>{y(e=>({...e,isCoverageOpen:!e.isCoverageOpen,isDiagramCheckOpen:!1,isRunsOpen:!1}))},[]),$e=r(()=>x.select(`scenarios`),[x.select]);f(()=>a?g(a,$e):void 0,[a,$e]),f(()=>{if(!p)return;let e=window;return e.openScenarios=$e,e.pendingScenarios&&(e.pendingScenarios=void 0,$e()),()=>{e.openScenarios===$e&&(e.openScenarios=void 0)}},[$e,p]);let et=r(()=>x.select(`problems`),[x.select]),tt=r(()=>x.select(Ge?`properties`:`monitor`),[Ge,x.select]),it=r(()=>x.select(Ke?`properties`:`debug`),[Ke,x.select]),ot=r(()=>{I({isRunsOpen:!1})},[I]),st=r(()=>{I({isCoverageOpen:!1})},[I]),[ct,lt]=n(null),ut=r(()=>lt(null),[]),dt=r(e=>{x.select(`properties`);let t=entriesFor(e);t.length>0&<(t)},[x.select]),J=useProject(_.xml);useSuggestionProvider(J?.suggestions??null);let pt=J?.coverage??null;f(()=>ft(J?.targets??[]),[J]);let mt=r(()=>b.current?.getModeler()??null,[]),gt=r(async(e,t)=>{try{await G().navigateToClass(e,t)||$.error(Y(`app.editor.noMatch`,{reference:e}))}catch{$.error(Y(`app.editor.noMatch`,{reference:e}))}},[]),yt=r(e=>J?elementInsight(J,e):null,[J]),bt=s(null),xt=hi(t.bridge,`ideTests`),St=r(async(e,t)=>{let n=yt(e);if(!n||n.tests.length===0){if(await explainedCodeLinks(()=>{bt.current={kind:`tests`,elementId:e,debug:t}}))return;$.info(Y(`app.editor.noTest`,{name:n?.title??e}))}else try{await G().runTestHandles(n.tests.map(e=>e.handle),n.title,t)}catch(e){$.error(e instanceof Error?e.message:String(e))}},[yt]),Ct=r(async e=>{let t=yt(e),n=t?[...t.implementations,...t.tests,...t.usages]:[];if(!t||n.length===0){if(await explainedCodeLinks(()=>{bt.current={kind:`usages`,elementId:e,debug:!1}}))return;$.info(Y(`app.editor.noUsage`,{name:t?.title??e}))}else try{await G().openCode(n.map(e=>e.handle),t.title,!0)}catch(e){$.error(e instanceof Error?e.message:String(e))}},[yt]),wt=r(async e=>{let t=yt(e);if(t&&t.implementations.length!==0)try{await G().openCode(t.implementations.map(e=>e.handle),t.title)}catch(e){$.error(e instanceof Error?e.message:String(e))}},[yt]),Tt=r(async e=>{let t=yt(e);if(!t||t.implementations.length===0){if(await explainedCodeLinks(()=>{bt.current={kind:`worker`,elementId:e,debug:!1}}))return;$.info(Y(`app.editor.noWorker`,{name:t?.title??e}))}else try{await G().openCode(t.implementations.map(e=>e.handle),t.title)}catch(e){$.error(e instanceof Error?e.message:String(e))}},[yt]);f(()=>{let e=bt.current;e&&(bt.current=null,C.refresh(),e.kind===`worker`?Tt(e.elementId):e.kind===`usages`?Ct(e.elementId):St(e.elementId,e.debug))});let Dt=r(()=>b.current?.getModeler()?executableProcessIdsOf(b.current.getModeler()):[],[]),[Ot,kt]=n(!1),At=useLive(Ge||Ot,Dt),jt=useLiveTrial(At,O,_.selectedElementId,Ge);useLiveBadges(O,At,Ge);let Mt=window.appConfig?.bpmnFilePath??null,Nt=r(async()=>await b.current?.exportXml()??_.currentBpmnXml??void 0,[_.currentBpmnXml]),Pt=useProcessDebug({active:Ke,modeler:O,selectedElementId:_.selectedElementId,diagramPath:Mt,exportXml:Nt}),Ft=x.state.tab===`scenarios`&&!x.state.hidden,It=useRuns(_.isRunsOpen||Ft,Mt,Nt,O!==null),Rt=l(()=>{if(It.cases.length===0||It.results.size===0)return;let e=0;for(let t of It.results.values())t.outcome===`passed`&&(e+=1);return{passed:e,all:It.cases.length}},[It.cases,It.results]),zt=l(()=>{if(!At.state)return;let e=0;for(let t of At.state.processes)for(let n of t.elements.values())e+=n.waiting;return e>0?e:void 0},[At.state]),Bt=useTimeline({open:Ot,setOpen:kt,live:At,trial:jt,runs:It,modeler:O,selectedElementId:_.selectedElementId});f(()=>G().onRunTrace?.(e=>{$e(),It.openTrace(e).catch(e=>{console.error(`Failed to read the trace of a run:`,e),$.error(Y(`app.editor.traceFailed`))})}),[$e,It.openTrace]);let[Vt,Ht]=n(null),Ut=r(()=>Ht(null),[]),Gt=r(async()=>{let e=_.selectedElementId,t=await Nt(),n=e&&t?await On(t):null;if(!e||!n)return;let r=taskTestPlan(n,{element:e});`problem`in r?$.error(r.problem):($e(),It.runAdHoc(r.testCase))},[_.selectedElementId,Nt,$e,It.runAdHoc]),qt=It.select;f(()=>{_.isRunsOpen&&qt(_.selectedElementId??null)},[_.isRunsOpen,_.selectedElementId,qt]);let Jt=It.running;f(()=>{Jt&&y(e=>e.isRunsOpen?e:{...e,isRunsOpen:!0,isCoverageOpen:!1})},[Jt]);let Xt=_.isMigrationOpen&&qe&&_.isCamunda7,Zt=useMigration(Xt,mt,Nt),Qt=s(null);f(()=>{let e=new AbortController;return Qt.current=e,()=>{e.abort(),Qt.current===e&&(Qt.current=null)}},[]);let $t=r(async()=>{try{await convertOpenDiagram({path:Mt,xml:await Nt()},Qt.current?.signal)}catch(e){$.error(e instanceof Error?e.message:String(e))}},[Mt,Nt]);useCodeBridge({project:J,active:p,installedTemplates:_.installedTemplates});let en=C.flags.flow,tn=C.flags.code,nn=l(()=>insightOf(J,O?.getDefinitions?.(),tn),[J,O,tn]),rn=r(e=>O?factsOf(O,e,nn,J,At):[],[O,nn,J,At]),an=r(e=>(yt(e)?.implementations.length??0)>0,[yt]),on=l(()=>({hasProject:J!==null,licensed:tn,nameOf:e=>O?.get(`elementRegistry`).get(e)?.businessObject?.name?.trim()||e,found:e=>yt(e),clientFacts:J?.clientFacts,entry:e=>nn.find(t=>t.elementId===e),openLink:async(e,t)=>{try{await G().openCode([e.handle],t)}catch(e){$.error(e instanceof Error?e.message:String(e))}},openImplementation:e=>void Tt(e),findUsages:e=>void Ct(e),runTests:xt?(e,t)=>void St(e,t):void 0}),[J,O,yt,nn,Tt,Ct,St,xt]),sn=useAgentsModel(O),X=l(()=>J?e=>J.mcpClients[e]??`unverifiable`:null,[J]),cn=useAgentFindings(sn,X),ln=_.isCamunda8?`camunda-8`:_.isCamunda7?`camunda-7`:null,un=l(()=>[...tn&&O&&J?[...findingsOf(O,nn),...templateFindings(O,J.model,J.contracts,_.installedTemplates)]:findingsOf(O,nn),...templateRejectionFindings(O,_.installedTemplates,ln),...connectionCodeFindings((J?.connections??[]).filter(e=>!(e.rule===`mcp-client-undefined`&&cn.some(t=>t.rule===`mcp-client-no-config`&&t.elementId===e.elementId)))),...agentCodeFindings(cn)],[tn,O,J,nn,_.installedTemplates,ln,cn]),dn=r(async()=>{if(O)try{if(!await G().confirmWithUser({title:Y(`app.editor.convertTitle`),text:Y(`app.editor.convertText`),accept:Y(`app.editor.convert`),decline:Y(`app.common.cancel`),warning:!1}))return;let{xml:e}=await O.saveXML({format:!0}),t=toOperaton(e);await O.importXML(t),await G().saveBpmnXml(t)}catch(e){$.error(e instanceof Error?e.message:String(e))}},[O]),fn=l(()=>{if(!O)return null;let e=_.xml;return _.isOperaton&&e&&e.includes(`xmlns:camunda="http://camunda.org/schema/1.0/bpmn"`)?{title:Y(`app.editor.namespaceTitle`),message:Y(`app.editor.namespaceMessage`),fix:dn}:null},[O,_.isOperaton,_.xml,dn]),pn=r(()=>{I({isMarketplaceOpen:!0})},[I]),Z=r(()=>{I({isMarketplaceOpen:!1})},[I]);f(()=>{if(!O)return;let e=O.get(`eventBus`),apply=()=>{applyCachedTemplates(O,e=>$.error(e)).catch(e=>console.error(`Failed to load the cached connector templates:`,e))};return apply(),e.on(`import.done`,apply),()=>e.off(`import.done`,apply)},[O]);let mn=r(async(e,n)=>{try{let e=await t.bpmn.getConfig(),r=e?.elementTemplates||[],i=e?.elementTemplatesContent||[],a=[...r,...Array.isArray(i)?i:[]];if(_.modeler)try{let t=JSON.parse(n),r=_.modeler.get(`elementTemplates`);if(r&&typeof r.set==`function`){let n=T(i),a=Array.isArray(t)?t:[t],o=vt([...n,...a],ki(e?.engine)?.family??null).loadable,s=_.modeler.get(`elementTemplatesLoader`,!1);s?.setTemplates?s.setTemplates([...o,...cachedTemplatesOf(_.modeler)]):r.set([...o,...cachedTemplatesOf(_.modeler)])}}catch(e){console.error(`[App] Failed to apply template to modeler:`,e)}I({installedTemplates:a})}catch(e){console.error(`Failed to refresh installed templates:`,e)}},[t,I,_.modeler]),hn=r(async e=>{try{let{format:t,svg:n,theme:r,useBackground:i}=e;if(!n)return;t===`SVG`?await exportAsSvg(n,i,r):t===`PNG`?await exportAsPng(n,i,r):t===`PDF`&&await exportAsPdf(n,i,r),$.success(Y(`app.editor.exported`,{format:t}))}catch(e){console.error(`Export failed:`,e),$.error(Y(`app.editor.exportFailed`,{message:e instanceof Error?e.message:Y(`app.editor.unknownError`)}))}},[]),exportAsSvg=async(e,n,r)=>{let i=e;n&&(i=addBackgroundToSvg(e,getThemeBackgroundColor(r))),await t.file.exportSvg(i)},exportAsPng=async(e,n,r)=>{let i=e;n&&(i=addBackgroundToSvg(e,getThemeBackgroundColor(r)));let a=await convertSvgToPng(i,n?getThemeBackgroundColor(r):`transparent`),o=await(await fetch(a)).blob();await t.file.exportPng(o)},exportAsPdf=async(e,n,r)=>{let i=e;n&&(i=addBackgroundToSvg(e,getThemeBackgroundColor(r)));let a=await convertSvgToPng(i,n?getThemeBackgroundColor(r):`#ffffff`,mp),o=(i.match(/viewBox="([^"]+)"/)?.[1]||`0 0 800 600`).split(` `).map(Number),s=await createPdfFromPages([{name:`BPMN Diagram`,png:a,width:o[2]??800,height:o[3]??600}]),c=await(await fetch(s)).blob();await t.file.exportPdf(c)},gn=r(()=>{P.isSupported?P.state.isRunning?P.controls.stop():P.controls.play():console.warn(`Token simulation is not supported`)},[P]),_n=r(()=>{F.toggle()},[F]),vn=r(async e=>{try{let t=await copyPicture(e,{backgroundOf:getThemeBackgroundColor,withBackground:addBackgroundToSvg,toPng:convertSvgToPng,save:e=>G().saveClipboardImage(e)});return $.info(Y(t?`app.editor.copiedImage`:`app.editor.copyImageFailed`)),t}catch(e){return console.error(`Failed to copy the diagram as an image:`,e),$.info(Y(`app.editor.copyImageFailed`)),!1}},[]),[yn,bn]=n(!1),xn=r(()=>{let e=_.modeler?.get(`transactionBoundaries`,!1);e&&bn(e.toggle())},[_.modeler]),Sn=r((e,t)=>Ca(e,t,Sa),[]),Cn=r(Ea,[]),wn=zr({viewer:O,origin:_.selectedElementId,traceable:Sn,read:Cn,paint:Ta,supportsMessages:!0});f(()=>(rt(e=>{let t=(O?.get?.(`elementRegistry`,!1))?.get?.(e.id);t&&(O?.get?.(`selection`,!1)?.select?.(t),e.id&&wn.traceFrom(e.id))}),()=>rt(()=>void 0)),[O,wn.traceFrom]);let Tn=r(()=>{C.unlock(U.FLOW_ANALYSIS)},[C.unlock]),[En,Dn]=n(null),kn=r(()=>Dn(null),[]);f(()=>{let e=O?.get(`eventBus`,!1);if(En&&e)return watchNextEdit(e,kn)},[En,O,kn]);let An=r(async()=>{if(!se())try{let e=b.current?.getModeler();if(!e||!await C.unlock(U.AUTO_LAYOUT))return;let t=await layOut(e,e=>dp.applyLayout(e));if(!t.ok){console.error(`Auto-layout error:`,t.error),$.error(t.error?.message||Y(`app.editor.layoutFailed`));return}Dn({count:t.count})}catch(e){console.error(`Auto-layout error:`,e),$.error(Y(`app.editor.layoutFailed`))}},[se,C.unlock]),jn=r(async()=>{let e=b.current,t=e?.getModeler();e&&t&&B(await openDrawnFile(e,t,G(),e=>dp.applyLayout(e)))},[]),Q=useDiagramCheck({enabled:!!O,getModeler:mt,flowUnlocked:en,onUnlockFlow:Tn,loadRules:j,codeFindings:un,namespaceFinding:fn,migration:Xt?{...Zt,onConvert:$t,target:`8.8`}:null,onReveal:dt}),Mn=_e((window.appConfig?.bpmnFilePath??`process.bpmn`).split(/[\\/]/).pop()??`process.bpmn`,async()=>await b.current?.exportXml()??_.currentBpmnXml??void 0),Nn=l(()=>!!O&&!!reachOf(pt,processIdsOf$1(O)),[pt,O,_.xml]),Pn=_.isEngineConfigured||E,Fn=At.engine?.profile??Mn.targets?.active??null,In=At.engine?.url??Mn.targets?.targets?.find(e=>(e.profile??null)===Fn)?.url??null,Ln=tasklistUrl(At.engine?.kind??Mn.targets?.targets?.find(e=>(e.profile??null)===Fn)?.engine??null,In),Rn={camunda7:_.isCamunda7,camunda8:_.isCamunda8,convertible:_.isCamunda7&&!_.isOperaton,drawn:_.modeler!==null,breakpointable:Pt.canToggle,coverageShown:Nn,open:{check:_.isDiagramCheckOpen||Ue,simulation:P.state.isRunning,coverage:_.isCoverageOpen,monitor:Ge,timeline:Ot,debug:Ke,scenarios:Ft,migration:_.isMigrationOpen&&Ue,sidebar:!x.state.hidden,minimap:F.state.isOpen,boundaries:yn,sketchy:Ce,commentBadges:Te,codeBadges:De,trace:wn.tracing,traceable:wn.traceable},deploy:he(Mn),chat:S,commands:{chat:()=>x.pressTab(M.id),undo:ce,redo:le,autoLayout:An,openProblems:Xe,toggleSimulation:gn,toggleCoverage:Qe,openMonitor:tt,toggleTimeline:Bt.toggle,openDebug:it,toggleBreakpoint:Pt.toggleSelected,openScenarios:$e,toggleMigration:Ye,convertToOperaton:dn,toggleSidebar:je,focusCanvas:N,fit:()=>b.current?.fitToScreen(),zoomIn:()=>b.current?.zoomIn(),zoomOut:()=>b.current?.zoomOut(),toggleBoundaries:xn,toggleMinimap:_n,toggleTrace:wn.toggle,copy:de,paste:fe,exportDialog:Ne,importDiagram:ze,share:Pe,templates:pn,toggleSketchy:()=>{let e=Ce?`default`:`sketchy`;Yt.setRendering(e),we(!Ce),_.modeler?.get?.(`sketchyRendering`,!1)?.set(e)},toggleCommentBadges:()=>{Yt.setCommentBadges(!Te),Ee(!Te)},toggleCodeBadges:()=>{Yt.setCodeBadges(!De),Oe(!De)},tour:ke.show,compareWithHead:hi(t.bridge,`compare`)&&t.bridge.openComparison?()=>{let e=t.bridge.getBpmnFilePath();e&&t.bridge.openComparison?.(e)}:void 0,showLicence:t.bridge.showLicence?()=>void t.bridge.showLicence?.():void 0,createEvidencePack:za(t.bridge),openRefactor:Ha(t.bridge),chooseTheme:hi(t.bridge,`editorTheme`)?ee:void 0,openTasklist:Ln?()=>{G().openExternalLink(Ln)}:void 0,testTask:(_.isCamunda7||_.isCamunda8)&&Mt&&_.selectedElementId?()=>{Gt()}:void 0,startInstance:At.engine?()=>{x.select(`monitor`),window.dispatchEvent(new CustomEvent(`penstock:start-instance`))}:void 0}},zn=q(yc,Rn),Bn=me(zn);f(()=>{let handler=()=>b.current?.getModeler()?.get(`diagramTheme`,!1)?.refresh();return window.addEventListener(`bpmn-theme-changed`,handler),()=>window.removeEventListener(`bpmn-theme-changed`,handler)},[]);let Vn=r(e=>{let t=e.closest(`.resource-editor`)?.querySelector(`#js-properties-panel`);return Et({container:e,propertiesPanelContainer:t??`#js-properties-panel`})},[]);f(()=>{let e=O?.get?.(`eventBus`,!1),write=()=>paintPill(pillOf(O?.get?.(`canvas`,!1)?.getContainer?.()),Q.counts,Q.rulesFailure);return e?.on(`linting.completed`,write),write(),()=>e?.off(`linting.completed`,write)},[O,Q.counts.errors,Q.counts.warnings,Q.counts.readability,Q.rulesFailure]);let Hn=s(Xe);Hn.current=Xe,f(()=>{let e=O?.get?.(`canvas`,!1)?.getContainer?.();if(!e)return;let press=e=>{e.target instanceof Element&&e.target.closest(`.bjsl-button`)&&(e.stopPropagation(),Hn.current())};return e.addEventListener(`click`,press,!0),()=>e.removeEventListener(`click`,press,!0)},[O]),f(()=>{pillOf(O?.get?.(`canvas`,!1)?.getContainer?.())?.setAttribute(`aria-expanded`,String(Je))},[O,Je]);let Un=Je?{title:Y(`app.editor.checkTitle`),tally:Q.checked>0?Wt(Q.counts,Q.rulesFailure):Y(`app.problems.waiting`),isError:Q.counts.errors>0,clean:Q.checked>0&&!Q.rulesFailure&&Q.counts.errors+Q.counts.warnings+Q.counts.readability===0?Y(`app.diagramCheck.nothingToReportAcrossElements`,{checked:Q.checked}):void 0,findings:Q.card.rows.map(e=>({title:e.title,detail:e.where,severity:e.severity})),moreCount:Q.card.more,onRecheck:Q.run,onClose:Ze,onShowAll:et,onPick:e=>Q.pickSummary(Q.card.rows[e],`card-${e}`)}:void 0,Wn=wn.tracing&&wn.reading?{label:wn.reading.label,before:wn.reading.before,after:wn.reading.after,followMessages:wn.followMessages,showMessages:wn.supportsMessages,onFollowMessages:wn.setFollowMessages,onClose:wn.close}:void 0,Gn=Pn?u(`div`,{class:`bpmn-editor__stage`,children:[u(Lt,{ref:b,xml:_.xml,onXmlChange:V,onElementSelect:H,onReady:te,onError:oe,onImportError:ie,modelerFactory:Vn,onDrawnWithoutLayout:jn,onReload:xe,onUndo:ce,onRedo:le,onCopy:de,onPaste:fe,onDelete:be,onExport:Ne,onAutoLayout:An,onToggleTokenSimulation:gn,onToggleMinimap:_n,onTogglePropertiesPanel:je,onNavigateToClass:gt,onFindCodeUsages:Ct,onRunTests:xt?St:void 0,onOpenImplementation:wt,factsOf:rn,hasImplementation:an}),En&&u(LayoutBar,{count:En.count,onUndo:ce,onClose:kn}),O&&u(GhostEdits,{modeler:O,source:d?.feed,onComment:d?.onComment}),O&&u(NextBlockSuggestions,{modeler:O}),u(Tour,{open:ke.open,onClose:ke.close,profiles:Mn.targets?.targets.length??1}),u(ImportSourceDialog,{open:Le,onChoose:e=>void Be(e),onClose:()=>Re(!1)}),u(ImportReportDialog,{outcome:Fe,onSave:()=>void Ve(),onClose:()=>{let e=Fe;Ie(null),openImported(G(),e)}}),u(CoveragePanel,{isOpen:_.isCoverageOpen,onClose:st,getModeler:mt,coverage:pt})]}):u(`div`,{class:`bpmn-editor__stage`,children:u(EngineQuestion,{apiClient:t,onChosen:Se})});return _.isConfigLoading?u(ThemeProvider,{children:u(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100vh`},children:Y(`app.editor.loading`)})}):_.configLoadFailed?u(ThemeProvider,{children:u(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,height:`100vh`,gap:`16px`},children:[u(`div`,{children:Y(`app.editor.configFailed`)}),u(`button`,{onClick:L,children:Y(`app.common.retry`)})]})}):ne?u(ThemeProvider,{children:u(`div`,{class:`resource-editor bpmn-editor`,children:u(Ra,{problem:ne,onOpenText:ae,onReload:xe})})}):u(ThemeProvider,{children:u(ScenariosProvider,{file:a??null,runs:It,getModeler:mt,feelByDefault:!_.isCamunda7&&!_.isFlowable&&!_.isActiviti,enabled:_.isCamunda7||_.isCamunda8,sidebar:{visible:!x.state.hidden,width:x.width,covered:x.drawer&&!x.state.collapsed?x.width:0},onOpenWorker:Tt,onNavigate:gt,onRunWithInput:Mt?()=>Ht(`input`):void 0,onOpenRun:()=>Ht(`open`),children:u(Wd,{value:{selectedElementId:_.selectedElementId,modeler:O,check:Q,live:At,trial:jt,debug:Pt,timeline:Bt,onConnectEngine:()=>Mn.edit(Mn.targets?.active??null),monitor:{hasImplementation:an,onOpenImplementation:wt,onConnect:()=>Mn.edit(Mn.targets?.active??null),scenario:Mt?{diagramPath:Mt,file:a,xml:Nt,editor:c.key}:null},code:on,agents:{diagramPath:Mt,xml:Nt,model:sn,status:X,findings:cn},clientFacts:J?.clientFacts,reveal:{entries:ct,onRevealed:ut}},children:u(ue,{className:`bpmn-editor`,toolbarItems:Bn,tabs:Gd,sidebar:x,edit:{undo:ce,redo:le,cut:ve,copy:de,paste:fe,selectAll:ye},badges:{problems:Q.checked>0&&Q.counts.errors+Q.counts.warnings||void 0,comments:Me||void 0},notice:z?{text:Y(z===`laid-out`?`app.editor.noLayout.laidOut`:`app.editor.noLayout.placed`),action:z===`placed`?{label:Y(`app.actions.auto-layout.title`),run:()=>{B(null),An()}}:void 0,dismiss:()=>B(null)}:Ae,check:Un,statusShown:Ue,trace:Wn,timeline:u(TimelineSlot,{}),assistant:c,counts:{scenarios:Rt,waiting:zt},deploy:{deploy:Mn,engine:_.isOperaton?`operaton`:_.isCibSeven?`cib-seven`:_.isCamunda8?`camunda-8`:`camunda-7`},shortcuts:{editor:`bpmn`,mode:`canvas`,actions:zn},children:[Gn,u(CodeBridgeLayer,{}),u(RunsPanel,{isOpen:_.isRunsOpen,runs:It,getModeler:mt,onClose:ot,onRunWithInput:Mt?()=>Ht(`input`):void 0,onOpenRun:()=>Ht(`open`),onSaveAdHoc:()=>Ht(`save`)}),u(ExportDialog,{isOpen:_.isExportDialogOpen,onClose:He,onExport:hn,onCopy:vn,bpmnXml:_.currentBpmnXml,apiClient:t,isCamunda8:_.isCamunda8,isCamunda7:_.isCamunda7}),Vt===`input`&&Mt&&u(RunDialog,{diagramPath:Mt,xml:Nt,onClose:Ut,onRun:e=>{Ht(null),It.runAdHoc(e)}}),Vt===`save`&&It.adHoc&&u(SaveRunDialog,{run:It.adHoc,file:It.file,onClose:Ut,onSave:It.save}),Vt===`open`&&u(OpenRunDialog,{onClose:Ut,onOpen:It.openInstance}),u(TemplatesMarketplace,{isOpen:_.isMarketplaceOpen,onClose:Z,apiClient:t,installedTemplates:_.installedTemplates,engineVersion:_.isMarketplaceOpen?engineVersionOf(_.modeler):null,onTemplateInstalled:mn})]})})})})}var SimpleEventBus=class{listeners=new Map;on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>this.off(e,t)}once(e,t){let wrappedHandler=async n=>{await t(n),this.off(e,wrappedHandler)};return this.on(e,wrappedHandler)}off(e,t){let n=this.listeners.get(e);if(n){let e=n.indexOf(t);e>-1&&n.splice(e,1)}}emit(e,t){let n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`Error in event handler for ${e}:`,t)}})}clear(){this.listeners.clear()}};function BpmnDocument({handle:e}){let t=l(()=>new wa(ve(G(),e)),[e]),n=l(()=>new SimpleEventBus,[]),r=s(e.initialText);return u(App,{initialXml:r.current,apiClient:t,eventBus:n,file:e.rel,scriptHost:e.scriptTabs})}export{BpmnDocument,revealElement as t};
|