@acorex-platform/module-workplacesafety-management-client 0.0.38 → 0.0.46
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/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C3a08xjg.mjs} +79 -32
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-C3a08xjg.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs +22 -72
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs +20 -6
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs +1516 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs +82 -12
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs +82 -12
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs +39 -6
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs +20 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs +19 -5
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs +82 -12
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-C46YEBVd.mjs} +21 -21
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-C46YEBVd.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-oylKTsgJ.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-oylKTsgJ.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-DHm1nRwW.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-DHm1nRwW.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DH-hPuAD.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DH-hPuAD.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-g4AT_IiT.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-g4AT_IiT.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-BwNlWbnC.mjs} +18 -72
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-BwNlWbnC.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-Cogwbd1P.mjs} +17 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-Cogwbd1P.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-0xqGaPnk.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-0xqGaPnk.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-risk-management.integration-CUZIl8zt.mjs +7 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-risk-management.integration-CUZIl8zt.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-activity.entity-CZCYupQT.mjs +324 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-activity.entity-CZCYupQT.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-D0fzHV_L.mjs} +62 -10
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-D0fzHV_L.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BpziBgGf.mjs} +17 -3
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BpziBgGf.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-D8wL0ned.mjs} +17 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-D8wL0ned.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-DrqQDYn9.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-DrqQDYn9.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-DaRnWCin.mjs} +36 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-DaRnWCin.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-Coj5Rzry.mjs} +17 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-Coj5Rzry.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-BU5roQ5-.mjs} +16 -2
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-BU5roQ5-.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-DijGV30H.mjs} +17 -3
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-DijGV30H.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs +144 -168
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs +165 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-fill-safety-plan.command-lJl0qpvT.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs +240 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-hydrate-safety-plan-activity-sections-TrVl3-T6.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs → acorex-platform-module-workplacesafety-management-client-index-CInaiEjw.mjs} +130 -398
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-CInaiEjw.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs +136 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-load-safety-plan-preview-structure-Ce67NSIZ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs +102 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-DJqqiYlD.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs +33 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-fill-values.util-RLOdySf7.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs} +252 -72
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-B9lElhxc.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs +185 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-C0SEJsVM.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs → acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs} +30 -94
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-D0aRQHWk.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -1
- package/package.json +6 -6
- package/types/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-activity.d.ts +5 -0
- package/types/acorex-platform-module-workplacesafety-management-client-contracts.d.ts +133 -157
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs +0 -542
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs +0 -405
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs +0 -254
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs +0 -36
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs +0 -204
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs.map +0 -1
- package/types/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.d.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-workplacesafety-management-client-contracts.mjs","sources":["../../../../libs/modules/workplacesafety-management/contracts/src/ghs-symbol-options.ts","../../../../libs/modules/workplacesafety-management/contracts/src/permission.keys.ts","../../../../libs/modules/workplacesafety-management/contracts/src/commands.keys.ts","../../../../libs/modules/workplacesafety-management/contracts/src/menu.keys.ts","../../../../libs/modules/workplacesafety-management/contracts/src/root-config.ts","../../../../libs/modules/workplacesafety-management/contracts/src/hazard-ppe-rule.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/hazard-ppe-rule-requirement-type-options.ts","../../../../libs/modules/workplacesafety-management/contracts/src/risk-management.integration.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-template-type-options.ts","../../../../libs/modules/workplacesafety-management/contracts/src/section-type-entity-map.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-unique-type.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-structure.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-dependency.ts","../../../../libs/modules/workplacesafety-management/contracts/src/SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-builder.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-work-steps.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/work-step-type-ids.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/control-hierarchy-levels/control-hierarchy-levels.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/control-measure/control-measure.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/hazard-register/hazard-register.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/hazard-risk/hazard-risk.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/ppe-item/ppe-item.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan/safety-plan.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-section/safety-plan-section.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-type/safety-plan-type.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-type-section/safety-plan-type-section.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-template/safety-template.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/section-type/section-type.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/work-step-type/work-step-type.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-work-step/safety-plan-work-step.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/index.ts","../../../../libs/modules/workplacesafety-management/contracts/src/acorex-platform-module-workplacesafety-management-client-contracts.ts"],"sourcesContent":["//#region ---- GHS symbol options ----\n\n/** Asset base path for GHS pictograms (served from demo app assets). */\nconst GHS_IMAGE_BASE = '/assets/workplacesafety-management/ghs';\n\nexport const WORKPLACE_SAFETY_GHS_SYMBOL_OPTIONS = [\n {\n id: 'GHS01',\n title: 'GHS01 — Exploding bomb',\n description: 'Explosion, blast or projection hazard.',\n imageUrl: `${GHS_IMAGE_BASE}/explos.gif`,\n },\n {\n id: 'GHS02',\n title: 'GHS02 — Flame',\n description: 'Flammable liquids, solids and gases; including self-reactive substances.',\n imageUrl: `${GHS_IMAGE_BASE}/flamme.gif`,\n },\n {\n id: 'GHS03',\n title: 'GHS03 — Flame over circle',\n description: 'Oxidising liquids, solids and gases; may cause or intensify fire.',\n imageUrl: `${GHS_IMAGE_BASE}/rondflam.gif`,\n },\n {\n id: 'GHS04',\n title: 'GHS04 — Gas cylinder',\n description: 'Gases under pressure.',\n imageUrl: `${GHS_IMAGE_BASE}/bottle.gif`,\n },\n {\n id: 'GHS05',\n title: 'GHS05 — Skull and crossbones',\n description: 'Fatal or toxic if swallowed, inhaled or in contact with skin.',\n imageUrl: `${GHS_IMAGE_BASE}/skull.gif`,\n },\n {\n id: 'GHS06',\n title: 'GHS06 — Exclamation mark',\n description: 'Low level toxicity; irritant or harmful to health.',\n imageUrl: `${GHS_IMAGE_BASE}/exclam.gif`,\n },\n {\n id: 'GHS07',\n title: 'GHS07 — Corrosion',\n description: 'Corrosive chemicals; may cause severe skin and eye damage.',\n imageUrl: `${GHS_IMAGE_BASE}/acid_red.gif`,\n },\n {\n id: 'GHS08',\n title: 'GHS08 — Health hazard',\n description: 'Chronic health hazards; carcinogenicity, mutagenicity, reproductive toxicity.',\n imageUrl: `${GHS_IMAGE_BASE}/silhouete.gif`,\n },\n {\n id: 'GHS09',\n title: 'GHS09 — Environment',\n description: 'Hazardous to aquatic life and the environment.',\n imageUrl: `${GHS_IMAGE_BASE}/Aquatic-pollut-red.gif`,\n },\n] as const;\n\nexport type WorkplaceSafetyGhsSymbolId = (typeof WORKPLACE_SAFETY_GHS_SYMBOL_OPTIONS)[number]['id'];\n\n//#endregion\n","/**\n * Safety & Risk capabilities used by this module.\n * Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).\n */\nexport const AXPSafetyRiskPermissionKeys = {\n Access: 'SafetyRisk:Permission:Access',\n MaintainSafety: 'SafetyRisk:Permission:MaintainSafety',\n MaintainRisk: 'SafetyRisk:Permission:MaintainRisk',\n MaintainHealth: 'SafetyRisk:Permission:MaintainHealth',\n MaintainAssessments: 'SafetyRisk:Permission:MaintainAssessments',\n Setup: 'SafetyRisk:Permission:Setup',\n} as const;\n\n/**\n * @deprecated Prefer {@link AXPSafetyRiskPermissionKeys}.\n * Legacy nested shape kept so existing imports compile during migration.\n */\nexport const AXMWorkplaceSafetyManagementPermissionKeys = {\n WorkplaceSafetyManagement: {\n Management: AXPSafetyRiskPermissionKeys.Access,\n Hazard: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n HazardRegister: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n PpeItem: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n HazardPpeRule: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n HazardRisk: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n ControlHierarchyLevels: {\n Management: AXPSafetyRiskPermissionKeys.Setup,\n },\n ControlMeasure: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n SafetyPlan: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n SafetyPlanType: {\n Management: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Management',\n View: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.View',\n Create: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Create',\n Update: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Update',\n Delete: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Delete',\n },\n SafetyPlanTypeSection: {\n Management: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Management',\n View: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.View',\n Create: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Create',\n Update: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Update',\n Delete: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Delete',\n },\n SectionType: {\n Management: AXPSafetyRiskPermissionKeys.Setup,\n View: AXPSafetyRiskPermissionKeys.Setup,\n Create: AXPSafetyRiskPermissionKeys.Setup,\n Update: AXPSafetyRiskPermissionKeys.Setup,\n Delete: AXPSafetyRiskPermissionKeys.Setup,\n },\n SafetyPlanSection: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n },\n} as const;\n","//#region ---- Command keys ----\n\nexport const AXMWorkplaceSafetyManagementCommandKeys = {\n SafetyPlan: {\n Preview: 'WorkplaceSafetyManagement.SafetyPlan:Preview',\n Publish: 'WorkplaceSafetyManagement.SafetyPlan:Publish',\n ChangeType: 'WorkplaceSafetyManagement.SafetyPlan:ChangeType',\n },\n} as const;\n\n//#endregion\n","//#region ---- Menu keys ----\n\nexport const AXMWorkplaceSafetyManagementMenuKeys = {\n Root: 'WorkplaceSafetyManagement:Menu',\n SafetyPlans: 'WorkplaceSafetyManagement:Menu:SafetyPlans',\n SafetyPlanSections: 'WorkplaceSafetyManagement:Menu:SafetyPlanSections',\n SectionTypes: 'WorkplaceSafetyManagement:Menu:SectionTypes',\n WorkStepTypes: 'WorkplaceSafetyManagement:Menu:WorkStepTypes',\n SafetyPlanTypes: 'WorkplaceSafetyManagement:Menu:SafetyPlanTypes',\n SafetyPlanTypeSections: 'WorkplaceSafetyManagement:Menu:SafetyPlanTypeSections',\n Configuration: 'WorkplaceSafetyManagement:Menu:Configuration',\n} as const;\n\n//#endregion\n","const config = {\n i18n: 'workplacesafety-management',\n module: 'WorkplaceSafetyManagement',\n} as const;\n\nexport const RootConfig = {\n config,\n module: {\n name: config.module,\n title: `@${config.i18n}:module.title`,\n icon: 'fa-light fa-building-shield',\n },\n entities: {\n hazard: {\n name: 'Hazard',\n source: `${config.module}.Hazard`,\n title: `@${config.i18n}:hazards.entities.hazard.title`,\n titlePlural: `@${config.i18n}:hazards.entities.hazard.plural`,\n icon: 'fa-light fa-triangle-exclamation',\n },\n hazardRegister: {\n name: 'HazardRegister',\n source: `${config.module}.HazardRegister`,\n title: `@${config.i18n}:hazard-registers.entities.hazard-register.title`,\n titlePlural: `@${config.i18n}:hazard-registers.entities.hazard-register.plural`,\n icon: 'fa-light fa-clipboard-list',\n },\n ppeItem: {\n name: 'PpeItem',\n source: `${config.module}.PpeItem`,\n title: `@${config.i18n}:ppe-items.entities.ppe-item.title`,\n titlePlural: `@${config.i18n}:ppe-items.entities.ppe-item.plural`,\n icon: 'fa-light fa-helmet-safety',\n },\n hazardPpeRule: {\n name: 'HazardPpeRule',\n source: `${config.module}.HazardPpeRule`,\n title: `@${config.i18n}:hazard-ppe-rules.entities.hazard-ppe-rule.title`,\n titlePlural: `@${config.i18n}:hazard-ppe-rules.entities.hazard-ppe-rule.plural`,\n icon: 'fa-light fa-user-helmet-safety',\n },\n hazardRisk: {\n name: 'HazardRisk',\n source: `${config.module}.HazardRisk`,\n title: `@${config.i18n}:hazard-risks.entities.hazard-risk.title`,\n titlePlural: `@${config.i18n}:hazard-risks.entities.hazard-risk.plural`,\n icon: 'fa-light fa-shield-exclamation',\n },\n controlHierarchyLevels: {\n name: 'ControlHierarchyLevels',\n source: `${config.module}.ControlHierarchyLevels`,\n title: `@${config.i18n}:control-measure-types.entities.control-measure-type.title`,\n titlePlural: `@${config.i18n}:control-measure-types.entities.control-measure-type.plural`,\n icon: 'fa-light fa-layer-group',\n },\n controlMeasure: {\n name: 'ControlMeasure',\n source: `${config.module}.ControlMeasure`,\n title: `@${config.i18n}:control-measures.entities.control-measure.title`,\n titlePlural: `@${config.i18n}:control-measures.entities.control-measure.plural`,\n icon: 'fa-light fa-shield-check',\n },\n safetyPlan: {\n name: 'SafetyPlan',\n source: `${config.module}.SafetyPlan`,\n title: `@${config.i18n}:safety-plans.entities.safety-plan.title`,\n titlePlural: `@${config.i18n}:safety-plans.entities.safety-plan.plural`,\n icon: 'fa-light fa-file-shield',\n },\n safetyPlanType: {\n name: 'SafetyPlanType',\n source: `${config.module}.SafetyPlanType`,\n title: `@${config.i18n}:safety-plan-types.entities.safety-plan-type.title`,\n titlePlural: `@${config.i18n}:safety-plan-types.entities.safety-plan-type.plural`,\n icon: 'fa-light fa-file-lines',\n },\n safetyPlanTypeSection: {\n name: 'SafetyPlanTypeSection',\n source: `${config.module}.SafetyPlanTypeSection`,\n title: `@${config.i18n}:safety-plan-type-sections.entities.safety-plan-type-section.title`,\n titlePlural: `@${config.i18n}:safety-plan-type-sections.entities.safety-plan-type-section.plural`,\n icon: 'fa-light fa-list-ol',\n },\n sectionType: {\n name: 'SectionType',\n source: `${config.module}.SectionType`,\n title: `@${config.i18n}:section-types.entities.section-type.title`,\n titlePlural: `@${config.i18n}:section-types.entities.section-type.plural`,\n icon: 'fa-light fa-list-tree',\n },\n safetyTemplate: {\n name: 'SafetyTemplate',\n source: `${config.module}.SafetyTemplate`,\n title: `@${config.i18n}:safety-templates.entities.safety-template.title`,\n titlePlural: `@${config.i18n}:safety-templates.entities.safety-template.plural`,\n icon: 'fa-light fa-file-lines',\n },\n safetyPlanSection: {\n name: 'SafetyPlanSection',\n source: `${config.module}.SafetyPlanSection`,\n title: `@${config.i18n}:safety-plan-sections.entities.safety-plan-section.title`,\n titlePlural: `@${config.i18n}:safety-plan-sections.entities.safety-plan-section.plural`,\n icon: 'fa-light fa-list-ol',\n },\n workStepType: {\n name: 'WorkStepType',\n source: `${config.module}.WorkStepType`,\n title: `@${config.i18n}:work-step-types.entities.work-step-type.title`,\n titlePlural: `@${config.i18n}:work-step-types.entities.work-step-type.plural`,\n icon: 'fa-light fa-list-tree',\n },\n safetyPlanWorkStep: {\n name: 'SafetyPlanWorkStep',\n source: `${config.module}.SafetyPlanWorkStep`,\n title: `@${config.i18n}:safety-plan-work-steps.entities.safety-plan-work-step.title`,\n titlePlural: `@${config.i18n}:safety-plan-work-steps.entities.safety-plan-work-step.plural`,\n icon: 'fa-light fa-list-check',\n },\n },\n queries: {\n dashboard: {\n openHazardsKpi: `${config.module}:Dashboard:OpenHazardsKpi`,\n highRisksKpi: `${config.module}:Dashboard:HighRisksKpi`,\n activeSafetyPlansKpi: `${config.module}:Dashboard:ActiveSafetyPlansKpi`,\n take5ChecklistsKpi: `${config.module}:Dashboard:Take5ChecklistsKpi`,\n take5CompletedKpi: `${config.module}:Dashboard:Take5CompletedKpi`,\n hazardsByCategoryDonut: `${config.module}:Dashboard:HazardsByCategoryDonut`,\n risksByRatingBar: `${config.module}:Dashboard:RisksByRatingBar`,\n plansByTypeBar: `${config.module}:Dashboard:PlansByTypeBar`,\n hazardsByStatusBar: `${config.module}:Dashboard:HazardsByStatusBar`,\n ppeCoverageDonut: `${config.module}:Dashboard:PpeCoverageDonut`,\n },\n },\n};\n","import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Enums ----\n\nexport enum AXMHazardPpeRuleRequirementType {\n Required = 'required',\n Recommended = 'recommended',\n Conditional = 'conditional',\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementHazardPpeRuleEntityModel extends AXPEntityModel<string> {\n code: string;\n hazardId: string;\n hazard?: { id: string; title?: string; code?: string };\n ppeItemId: string;\n ppeItem?: { id: string; title?: string; code?: string };\n requirementType: AXMHazardPpeRuleRequirementType;\n conditionNote?: string;\n usageInstruction?: string;\n sortOrder?: number;\n status?: AXPSystemStatusType.Active | AXPSystemStatusType.Inactive;\n}\n\n//#endregion\n","//#region ---- Hazard PPE requirement type options ----\n\nimport { AXMHazardPpeRuleRequirementType } from './hazard-ppe-rule.types';\n\nexport const WORKPLACE_SAFETY_HAZARD_PPE_RULE_REQUIREMENT_TYPE_OPTIONS = [\n {\n id: AXMHazardPpeRuleRequirementType.Required,\n title: '@workplacesafety-management:hazard-ppe-rules.entities.hazard-ppe-rule.fields.requirement-type.options.required',\n },\n {\n id: AXMHazardPpeRuleRequirementType.Recommended,\n title: '@workplacesafety-management:hazard-ppe-rules.entities.hazard-ppe-rule.fields.requirement-type.options.recommended',\n },\n {\n id: AXMHazardPpeRuleRequirementType.Conditional,\n title: '@workplacesafety-management:hazard-ppe-rules.entities.hazard-ppe-rule.fields.requirement-type.options.conditional',\n },\n] as const;\n\n//#endregion\n","/** Risk rating entity key in the risk-management module. */\nexport const RISK_MANAGEMENT_RISK_RATING_ENTITY = 'RiskManagement.RiskRating';\n\n/** Risk matrix cell entity key in the risk-management module. */\nexport const RISK_MANAGEMENT_RISK_MATRIX_CELL_ENTITY = 'RiskManagement.RiskMatrixCell';\n\n/** Hazard catalog scope for risk matrix lookup filtering. */\nexport const RISK_MANAGEMENT_HAZARD_CATALOG_SCOPE = 'risk-management.hazard';\n","//#region ---- Safety template type options ----\n\ntype AXMSafetyTemplateType = 'SWMS' | 'JSA' | 'Forms' | 'Permits' | 'Plans';\n\nexport const WORKPLACE_SAFETY_TEMPLATE_TYPE_OPTIONS: ReadonlyArray<{\n id: AXMSafetyTemplateType;\n title: string;\n}> = [\n {\n id: 'SWMS',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.swms',\n },\n {\n id: 'JSA',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.jsa',\n },\n {\n id: 'Forms',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.forms',\n },\n {\n id: 'Permits',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.permits',\n },\n {\n id: 'Plans',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.plans',\n },\n] as const;\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type {\n AXMSectionTypeCode,\n AXMSectionTypeSnapshot,\n} from './entities/section-type/section-type.types';\n\nimport { RootConfig } from './root-config';\n\n//#endregion\n\n//#region ---- Built-in section type IDs ----\n\n/** Stable IDs for seeded built-in section types (shared by server mocks and client lookups). */\n\nexport const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS = {\n hazard: 'c1d2e3f4-a5b6-4789-c001-000000000001',\n\n hazardRisk: 'c1d2e3f4-a5b6-4789-c001-000000000002',\n\n ppe: 'c1d2e3f4-a5b6-4789-c001-000000000003',\n\n control: 'c1d2e3f4-a5b6-4789-c001-000000000004',\n\n hierarchyLevel: 'c1d2e3f4-a5b6-4789-c001-000000000005',\n\n custom: 'c1d2e3f4-a5b6-4789-c001-000000000006',\n\n ppeHazards: 'c1d2e3f4-a5b6-4789-c001-000000000007',\n\n riskMatrix: 'c1d2e3f4-a5b6-4789-c001-000000000008',\n\n hazardRiskPpe: 'c1d2e3f4-a5b6-4789-c001-000000000009',\n\n stepTable: 'c1d2e3f4-a5b6-4789-c001-00000000000a',\n} as const;\n\nexport interface AXMBuiltInSectionTypeMeta {\n sectionTypeKey: AXMSectionTypeCode;\n\n itemEntityName?: string;\n\n /** When true, a safety plan may include this section type more than once. */\n isRepeatable?: boolean;\n}\n\nconst moduleName = RootConfig.module.name;\n\n/** Maps section type codes to the entity that supplies selectable items. */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE: Readonly<\n Record<AXMSectionTypeCode, string | undefined>\n> = {\n Hazard: `${moduleName}.${RootConfig.entities.hazard.name}`,\n\n HazardRisk: `${moduleName}.${RootConfig.entities.hazardRisk.name}`,\n\n Ppe: `${moduleName}.${RootConfig.entities.ppeItem.name}`,\n\n PpeHazards: `${moduleName}.${RootConfig.entities.hazardPpeRule.name}`,\n\n HazardRiskPpe: undefined,\n\n Control: `${moduleName}.${RootConfig.entities.controlMeasure.name}`,\n\n HierarchyLevel: `${moduleName}.${RootConfig.entities.controlHierarchyLevels.name}`,\n\n RiskMatrix: 'RiskManagement.RiskMatrixCell',\n\n Custom: undefined,\n\n /** Host section for SafetyPlanWorkStep rows (managed by the section builder, not a catalog picker). */\n StepTable: undefined,\n};\n\n/** Built-in section types resolved by stable section type id. */\n\nexport const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID: Readonly<\n Record<string, AXMBuiltInSectionTypeMeta>\n> = {\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazard]: {\n sectionTypeKey: 'Hazard',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Hazard,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRisk]: {\n sectionTypeKey: 'HazardRisk',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HazardRisk,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppe]: {\n sectionTypeKey: 'Ppe',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Ppe,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards]: {\n sectionTypeKey: 'PpeHazards',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.PpeHazards,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe]: {\n sectionTypeKey: 'HazardRiskPpe',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HazardRiskPpe,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.control]: {\n sectionTypeKey: 'Control',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Control,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hierarchyLevel]: {\n sectionTypeKey: 'HierarchyLevel',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HierarchyLevel,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix]: {\n sectionTypeKey: 'RiskMatrix',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.RiskMatrix,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.custom]: {\n sectionTypeKey: 'Custom',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Custom,\n\n isRepeatable: true,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.stepTable]: {\n sectionTypeKey: 'StepTable',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.StepTable,\n\n isRepeatable: true,\n },\n};\n\n/** Default entity so the lookup widget mounts before a section type is chosen. */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK = `${moduleName}.${RootConfig.entities.hazard.name}`;\n\n//#endregion\n\n//#region ---- Snapshot helpers ----\n\nexport function resolveSectionTypeKey(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): AXMSectionTypeCode | undefined {\n const fromSnapshot = snapshot?.sectionTypeKey;\n\n if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {\n return fromSnapshot as AXMSectionTypeCode;\n }\n\n if (!sectionTypeId) {\n return undefined;\n }\n\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]\n ?.sectionTypeKey;\n}\n\nexport function resolveSectionItemEntityName(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): string | undefined {\n const fromSnapshot = snapshot?.itemEntityName;\n\n if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {\n return fromSnapshot;\n }\n\n if (!sectionTypeId) {\n return undefined;\n }\n\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]\n ?.itemEntityName;\n}\n\n/** Adds runtime lookup metadata (`sectionTypeKey`, `itemEntityName`) from built-in id map. */\n\nexport function enrichSectionTypeSnapshot(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): AXMSectionTypeSnapshot | undefined {\n if (!sectionTypeId) {\n return snapshot;\n }\n\n return {\n ...snapshot,\n\n id: sectionTypeId,\n\n sectionTypeKey: resolveSectionTypeKey(sectionTypeId, snapshot),\n\n itemEntityName: resolveSectionItemEntityName(sectionTypeId, snapshot),\n\n isRepeatable:\n snapshot?.isRepeatable ??\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]?.isRepeatable,\n };\n}\n\n//#endregion\n\n//#region ---- Dynamic entity expressions ----\n\nfunction buildSectionTypeEntityExpressionById(\n sectionTypeIdPath: string,\n): string {\n const parts = Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID)\n\n .filter(([, meta]) => meta.itemEntityName)\n\n .map(\n ([id, meta]) =>\n `context.eval('${sectionTypeIdPath}') === '${id}' ? '${meta.itemEntityName}'`,\n );\n\n return `{{ ${parts.join(' : ')} : '${WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK}' }}`;\n}\n\nfunction buildSectionTypeEntityExpressionWithSnapshotFallback(\n sectionTypeIdPath: string,\n itemEntityNamePath: string,\n): string {\n const byId = buildSectionTypeEntityExpressionById(sectionTypeIdPath).slice(3, -2);\n return `{{ context.eval('${itemEntityNamePath}') || (${byId}) }}`;\n}\n\n/**\n * For repeater / nested FormField widgets — `>` walks up to the row where `sectionType` is exposed.\n */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION =\n buildSectionTypeEntityExpressionWithSnapshotFallback(\n '>sectionType.id',\n\n '>sectionType.itemEntityName',\n );\n\n/**\n * For flat dialog / dynamic forms — sibling fields share the same context (no parent path).\n */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION_SIBLING =\n buildSectionTypeEntityExpressionWithSnapshotFallback(\n 'sectionType.id',\n 'sectionType.itemEntityName',\n );\n\n//#endregion\n","/**\n * Shared helpers for Safety Plan Section type identity (repeatable vs one-off).\n * Leaf module — imports only other contract leaves (no client/server layers).\n */\n\nimport { WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID } from './section-type-entity-map';\n\n//#region ---- Helpers ----\n\nfunction resolveRefId(raw: unknown): string {\n if (typeof raw === 'string' && raw.trim().length > 0) {\n return raw.trim();\n }\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n return String(raw);\n }\n if (raw && typeof raw === 'object') {\n const id = (raw as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return '';\n}\n\n/**\n * True when this section type may appear more than once in a Safety Plan.\n * Checks (in order): snapshot flag, explicit allow-list, built-in section type meta.\n */\nexport function isSafetyPlanSectionTypeRepeatable(\n sectionTypeId: string,\n options?: {\n repeatableSectionTypeIds?: readonly string[];\n sectionType?: { isRepeatable?: boolean };\n },\n): boolean {\n const id = resolveRefId(sectionTypeId);\n if (!id) {\n return false;\n }\n if (options?.sectionType?.isRepeatable === true) {\n return true;\n }\n const allowList = new Set(\n (options?.repeatableSectionTypeIds ?? []).map((entry) => resolveRefId(entry)).filter(Boolean),\n );\n if (allowList.has(id)) {\n return true;\n }\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[id]?.isRepeatable === true;\n}\n\n/** Built-in section type ids that are always treated as repeatable. */\nexport function collectBuiltInRepeatableSectionTypeIds(): string[] {\n return Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID)\n .filter(([, meta]) => meta.isRepeatable === true)\n .map(([id]) => id);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { createRandomUuid } from '@acorex-platform/framework-shared/core';\nimport type {\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport type {\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel,\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel,\n} from './entities/safety-plan-type-section/safety-plan-type-section.types';\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport { WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID } from './section-type-entity-map';\nimport { isSafetyPlanSectionTypeRepeatable } from './safety-plan-section-unique-type.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface AXMSafetyPlanSectionStructureItem {\n id: string;\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n title: string;\n description?: string;\n /** Links the plan section back to the type template it was created from. */\n sourceSafetyPlanTypeSectionId?: string;\n /** Display / persistence order (1-based). */\n sortOrder: number;\n /** True when sourced from an `isDefault` type section — must remain on the plan. */\n required?: boolean;\n items: Array<{\n id: string;\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n }>;\n safetyPlanId?: string;\n code?: string;\n}\n\nexport interface AXMSafetyPlanSectionStructureValue {\n sections: AXMSafetyPlanSectionStructureItem[];\n}\n\nexport interface AXMSafetyPlanSectionStructureValidationContext {\n /** Section type ids allowed for this plan type (from its type-section config). */\n allowedSectionTypeIds: readonly string[];\n /** Source type-section ids that must remain present. */\n requiredSourceTypeSectionIds: readonly string[];\n /** Section type ids that may appear more than once on a plan. */\n repeatableSectionTypeIds?: readonly string[];\n}\n\nexport type AXMSafetyPlanSectionStructureValidationIssueCode =\n | 'REQUIRED_SECTION_MISSING'\n | 'SECTION_TYPE_NOT_ALLOWED'\n | 'INVALID_TYPE_SECTION_TEMPLATE'\n | 'INVALID_SORT_ORDER';\n\nexport interface AXMSafetyPlanSectionStructureValidationIssue {\n code: AXMSafetyPlanSectionStructureValidationIssueCode;\n messageKey: string;\n details?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Display helpers ----\n\n/** Coerces a stored string or locale map into a single display string. */\nexport function asSafetyPlanDisplayText(value: unknown): string {\n if (typeof value === 'string') {\n return value.trim();\n }\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const rec = value as Record<string, unknown>;\n for (const locale of ['en-US', 'en-AU', 'en', 'fa-IR']) {\n const part = rec[locale];\n if (typeof part === 'string' && part.trim()) {\n return part.trim();\n }\n }\n for (const part of Object.values(rec)) {\n if (typeof part === 'string' && part.trim()) {\n return part.trim();\n }\n }\n }\n return '';\n}\n\nexport function buildSectionTypeRelationSnapshot(\n sectionTypeId: string,\n snapshot?: {\n title?: unknown;\n code?: unknown;\n description?: unknown;\n isRepeatable?: unknown;\n } | null,\n): AXMSectionTypeSnapshot {\n const title = asSafetyPlanDisplayText(snapshot?.title);\n const code = asSafetyPlanDisplayText(snapshot?.code);\n const description = asSafetyPlanDisplayText(snapshot?.description);\n return {\n id: sectionTypeId,\n ...(title ? { title } : {}),\n ...(code ? { code } : {}),\n ...(description ? { description } : {}),\n ...(snapshot?.isRepeatable === true ? { isRepeatable: true } : {}),\n };\n}\n\nfunction resolveSectionTypeTitle(\n sectionTypeId: string,\n sectionType?: { title?: unknown; code?: unknown } | null,\n): string {\n const title = asSafetyPlanDisplayText(sectionType?.title);\n if (title) {\n return title;\n }\n const code = asSafetyPlanDisplayText(sectionType?.code);\n if (code) {\n return code;\n }\n const builtIn = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]?.sectionTypeKey;\n if (builtIn) {\n return builtIn;\n }\n return sectionTypeId;\n}\n\n/**\n * Title persisted on SafetyPlanSection. Never stores a bare UUID — the UI translate\n * pipe treats unknown keys as empty, which made seeded section headers blank.\n */\nexport function resolveSafetyPlanSectionPersistedTitle(\n sectionTitle: unknown,\n sectionTypeId: string,\n snapshot?: { title?: unknown; code?: unknown } | null,\n): string {\n const explicit = asSafetyPlanDisplayText(sectionTitle);\n if (explicit && explicit !== sectionTypeId) {\n return explicit;\n }\n const fromType = resolveSectionTypeTitle(sectionTypeId, snapshot);\n if (fromType && fromType !== sectionTypeId) {\n return fromType;\n }\n return 'Section';\n}\n\n//#endregion\n\n//#region ---- Ref helpers ----\n\n/** True when a type-section row is marked as the plan-type default template. */\nexport function isSafetyPlanTypeSectionDefault(row: { isDefault?: unknown } | null | undefined): boolean {\n const value = row?.isDefault;\n return value === true || value === 1 || value === 'true';\n}\n\n/**\n * Returns the default Safety Plan Type Section (structure) for a plan type.\n * Prefers `isDefault: true`; otherwise the first active row by sortOrder/title.\n */\nexport function resolveDefaultSafetyPlanTypeSection(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel | null {\n const active = typeSections\n .filter((row) => row && row.isArchived !== true)\n .slice()\n .sort(\n (a, b) =>\n (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.title ?? '').localeCompare(String(b.title ?? '')),\n );\n if (!active.length) {\n return null;\n }\n return active.find((row) => isSafetyPlanTypeSectionDefault(row)) ?? active[0] ?? null;\n}\n\n/**\n * Narrows type-section rows to the selected structure when `structureId` is set.\n * Falls back to all active rows (caller / build still applies isDefault rules).\n */\nexport function pickSafetyPlanTypeSectionsForStructure(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n structureId?: string | null,\n): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[] {\n const active = typeSections.filter((row) => row && row.isArchived !== true);\n const id = typeof structureId === 'string' ? structureId.trim() : '';\n if (!id) {\n return active;\n }\n const selected = active.filter((row) => resolveEntityRefId(row.id) === id);\n return selected.length ? selected : active;\n}\n\n/** Extracts a stable entity id from a raw lookup / context value. */\nexport function resolveEntityRefId(raw: unknown): string | null {\n if (typeof raw === 'string' && raw.trim().length > 0) {\n return raw.trim();\n }\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n return String(raw);\n }\n if (raw && typeof raw === 'object') {\n const id = (raw as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return null;\n}\n\nfunction resolveSectionTypeId(\n typeRow: AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel | null | undefined,\n): string {\n if (!typeRow) {\n return '';\n }\n return (\n resolveEntityRefId(typeRow.sectionTypeId) ??\n resolveEntityRefId(typeRow.sectionType) ??\n resolveEntityRefId(typeRow.sectionType?.id) ??\n ''\n );\n}\n\n//#endregion\n\n//#region ---- Build from type sections ----\n\nlet structureIdSeq = 0;\nfunction nextStructureId(prefix: string): string {\n structureIdSeq += 1;\n const rand = createRandomUuid();\n return prefix ? `${prefix}-${rand}` : rand;\n}\n\n/**\n * Builds an empty editable section structure from SafetyPlanTypeSection rows for one plan type.\n *\n * Uses `isDefault` rows when present; otherwise falls back to all active rows for that type\n * (so a mis-flagged template still produces a structure). One plan section per `sectionTypeIds`\n * entry, titled from the Section Type, ordered by type-section `sortOrder` then repeater order.\n */\nexport function buildSectionStructureFromTypeSections(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n options?: { createId?: () => string },\n): AXMSafetyPlanSectionStructureValue {\n const createId = options?.createId ?? (() => nextStructureId(''));\n const active = typeSections\n .filter((row) => row && row.isArchived !== true)\n .slice()\n .sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.title ?? '').localeCompare(String(b.title ?? '')));\n\n const defaults = active.filter((row) => isSafetyPlanTypeSectionDefault(row));\n const sourceRows = defaults.length > 0 ? defaults : active;\n\n const sections: AXMSafetyPlanSectionStructureItem[] = [];\n const seenSourceTypePairs = new Set<string>();\n let sortOrder = 1;\n\n for (const typeSection of sourceRows) {\n const typeRows = Array.isArray(typeSection.sectionTypeIds) ? typeSection.sectionTypeIds : [];\n if (!typeRows.length) {\n continue;\n }\n\n for (const typeRow of typeRows) {\n const sectionTypeId = resolveSectionTypeId(typeRow);\n if (!sectionTypeId) {\n continue;\n }\n\n // One plan section per (type-section source, section type) — prevents\n // accidental double expansion when the same type is listed twice.\n const sourceId = typeof typeSection.id === 'string' ? typeSection.id : '';\n const pairKey = sourceId ? `${sourceId}|${sectionTypeId}` : sectionTypeId;\n if (seenSourceTypePairs.has(pairKey)) {\n continue;\n }\n seenSourceTypePairs.add(pairKey);\n\n const sectionType = buildSectionTypeRelationSnapshot(sectionTypeId, typeRow.sectionType);\n const sectionId = createId();\n sections.push({\n id: sectionId,\n sectionTypeId,\n sectionType,\n title: resolveSafetyPlanSectionPersistedTitle(undefined, sectionTypeId, sectionType),\n description: asSafetyPlanDisplayText(sectionType.description),\n sourceSafetyPlanTypeSectionId: typeSection.id,\n sortOrder: sortOrder++,\n required: isSafetyPlanTypeSectionDefault(typeSection) || defaults.length === 0,\n items: [\n {\n id: `${sectionId}__item_1`,\n itemIds: [],\n items: [],\n },\n ],\n });\n }\n }\n\n return { sections };\n}\n\n/**\n * Removes accidental ghost rows from double materialization of the same type-section\n * source. Distinct sections of the same type are kept. Reassigns contiguous 1-based\n * `sortOrder` to preserve display order.\n */\nexport function dedupeSafetyPlanSectionStructure<\n T extends AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue,\n>(\n structure: T,\n _options?: { repeatableSectionTypeIds?: readonly string[] },\n): T {\n type Section = AXMSafetyPlanSectionStructureItem | AXMSafetyPlanSectionBuilderSectionValue;\n\n const sections: readonly Section[] = Array.isArray(structure?.sections)\n ? (structure.sections as readonly Section[])\n : [];\n const seenSourceTypePairs = new Set<string>();\n const deduped: Section[] = [];\n\n for (const section of sections) {\n const sectionTypeId = resolveEntityRefId(section.sectionTypeId) ?? String(section.sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n continue;\n }\n\n const sourceId = String(section.sourceSafetyPlanTypeSectionId ?? '').trim();\n const sourcePairKey = sourceId ? `${sourceId}|${sectionTypeId}` : '';\n\n // Same type-section source + section type must never appear twice (double materialization).\n if (sourcePairKey && seenSourceTypePairs.has(sourcePairKey)) {\n continue;\n }\n\n if (sourcePairKey) {\n seenSourceTypePairs.add(sourcePairKey);\n }\n deduped.push(section);\n }\n\n return {\n ...structure,\n sections: deduped.map((section, index) => ({\n ...section,\n sortOrder: index + 1,\n })),\n } as T;\n}\n\nexport function collectAllowedSectionTypeIds(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n): string[] {\n const ids = new Set<string>();\n for (const typeSection of typeSections) {\n if (typeSection.isArchived === true) {\n continue;\n }\n for (const row of typeSection.sectionTypeIds ?? []) {\n const id = resolveSectionTypeId(row);\n if (id) {\n ids.add(id);\n }\n }\n }\n return [...ids];\n}\n\nexport function collectRequiredSourceTypeSectionIds(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n options?: { structureId?: string | null },\n): string[] {\n const structureId =\n typeof options?.structureId === 'string' && options.structureId.trim()\n ? options.structureId.trim()\n : '';\n if (structureId) {\n const selected = typeSections.find(\n (row) => row.isArchived !== true && resolveEntityRefId(row.id) === structureId,\n );\n return selected?.id && typeof selected.id === 'string' ? [selected.id] : [structureId];\n }\n\n return typeSections\n .filter((row) => row.isArchived !== true && isSafetyPlanTypeSectionDefault(row))\n .map((row) => row.id)\n .filter((id): id is string => typeof id === 'string' && id.length > 0);\n}\n\n/**\n * Validates that a plan-type section template does not list the same\n * non-repeatable section type more than once (across rows and within a single row's repeater).\n */\nexport function validateSafetyPlanTypeSectionTemplate(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n repeatableSectionTypeIds: readonly string[] = [],\n): AXMSafetyPlanSectionStructureValidationIssue[] {\n const seen = new Map<string, { title: string; sourceSafetyPlanTypeSectionId?: string }>();\n const issues: AXMSafetyPlanSectionStructureValidationIssue[] = [];\n\n for (const typeSection of typeSections) {\n if (typeSection.isArchived === true) {\n continue;\n }\n for (const row of typeSection.sectionTypeIds ?? []) {\n const sectionTypeId = resolveSectionTypeId(row);\n if (\n !sectionTypeId ||\n isSafetyPlanSectionTypeRepeatable(sectionTypeId, {\n repeatableSectionTypeIds,\n sectionType: row.sectionType as { isRepeatable?: boolean } | undefined,\n })\n ) {\n continue;\n }\n const sectionTypeTitle = resolveSafetyPlanSectionPersistedTitle(\n undefined,\n sectionTypeId,\n row.sectionType,\n );\n if (seen.has(sectionTypeId)) {\n issues.push({\n code: 'INVALID_TYPE_SECTION_TEMPLATE',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.invalid-type-template-duplicate',\n details: {\n sectionTypeId,\n sectionTypeTitle,\n sourceSafetyPlanTypeSectionId: typeSection.id,\n previousSourceSafetyPlanTypeSectionId: seen.get(sectionTypeId)?.sourceSafetyPlanTypeSectionId,\n },\n });\n continue;\n }\n seen.set(sectionTypeId, {\n title: sectionTypeTitle,\n sourceSafetyPlanTypeSectionId: typeSection.id,\n });\n }\n }\n\n return issues;\n}\n\n//#endregion\n\n//#region ---- Validation ----\n\nexport function validateSafetyPlanSectionStructure(\n structure: AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue | null | undefined,\n context: AXMSafetyPlanSectionStructureValidationContext,\n): AXMSafetyPlanSectionStructureValidationIssue[] {\n const sections = Array.isArray(structure?.sections) ? structure!.sections : [];\n const issues: AXMSafetyPlanSectionStructureValidationIssue[] = [];\n\n const presentSourceIds = new Set(\n sections\n .map((s) => (s as AXMSafetyPlanSectionStructureItem).sourceSafetyPlanTypeSectionId)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n );\n\n for (const requiredSourceId of context.requiredSourceTypeSectionIds) {\n if (!presentSourceIds.has(requiredSourceId)) {\n issues.push({\n code: 'REQUIRED_SECTION_MISSING',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.required-section-missing',\n details: { sourceSafetyPlanTypeSectionId: requiredSourceId },\n });\n }\n }\n\n const allowed = new Set(context.allowedSectionTypeIds);\n\n const sortOrders: number[] = [];\n for (const section of sections) {\n const sectionTypeId =\n resolveEntityRefId((section as { sectionTypeId?: unknown }).sectionTypeId) ??\n String((section as { sectionTypeId?: string }).sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n continue;\n }\n\n const sectionType = (section as { sectionType?: { title?: string; code?: string; isRepeatable?: boolean } })\n .sectionType;\n const sectionTypeTitle = resolveSafetyPlanSectionPersistedTitle(\n undefined,\n sectionTypeId,\n sectionType,\n );\n\n if (allowed.size > 0 && !allowed.has(sectionTypeId)) {\n issues.push({\n code: 'SECTION_TYPE_NOT_ALLOWED',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.section-type-not-allowed',\n details: { sectionTypeId, sectionTypeTitle, sectionId: (section as { id?: string }).id },\n });\n }\n\n const sortOrder = (section as AXMSafetyPlanSectionStructureItem).sortOrder;\n if (typeof sortOrder === 'number' && Number.isFinite(sortOrder)) {\n sortOrders.push(sortOrder);\n }\n }\n\n if (sortOrders.length !== sections.length) {\n issues.push({\n code: 'INVALID_SORT_ORDER',\n messageKey: '@workplacesafety-management:safety-plans.messages.section-structure.invalid-sort-order',\n });\n } else {\n const unique = new Set(sortOrders);\n if (unique.size !== sortOrders.length) {\n issues.push({\n code: 'INVALID_SORT_ORDER',\n messageKey: '@workplacesafety-management:safety-plans.messages.section-structure.invalid-sort-order',\n details: { reason: 'duplicate' },\n });\n }\n }\n\n return issues;\n}\n\nexport function toBuilderValueFromStructure(\n structure: AXMSafetyPlanSectionStructureValue,\n): AXMSafetyPlanSectionBuilderValue {\n return {\n sections: structure.sections.map((section) => ({\n id: section.id,\n sectionTypeId: section.sectionTypeId,\n sectionType: section.sectionType,\n title: section.title,\n description: section.description ?? '',\n safetyPlanId: section.safetyPlanId,\n code: section.code,\n sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,\n sortOrder: section.sortOrder,\n required: section.required,\n items: section.items.map((item) => ({\n id: item.id,\n itemIds: [...(item.itemIds ?? [])],\n items: item.items ? [...item.items] : [],\n })),\n })),\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXMSectionTypeCode, AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type {\n AXMSafetyPlanSectionBuilderItemValue,\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport {\n resolveSectionItemEntityName,\n resolveSectionTypeKey,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS,\n} from './section-type-entity-map';\nimport { asSafetyPlanDisplayText } from './safety-plan-section-structure.util';\n\n//#endregion\n\n//#region ---- Dependency config ----\n\n/** Parent section type whose selected item IDs constrain the child lookup. */\nexport interface AXMSectionTypeParentFilterDependency {\n kind: 'parentFilter';\n parentSectionTypeKey: AXMSectionTypeCode;\n /** Field on the child lookup entity used for filtering (e.g. `hazardId`). */\n filterField: string;\n}\n\n/** Child lookup is filtered by IDs derived from parent entity records (e.g. `riskMatrixId` on HazardRisk). */\nexport interface AXMSectionTypeDerivedFilterDependency {\n kind: 'derivedFromParent';\n parentSectionTypeKey: AXMSectionTypeCode;\n /** Field path on the parent entity record used to resolve filter values. */\n resolveField: 'riskMatrixId';\n /** Field on the child lookup entity (typically `id`). */\n filterField: string;\n}\n\nexport type AXMSectionTypeDependency =\n | AXMSectionTypeParentFilterDependency\n | AXMSectionTypeDerivedFilterDependency;\n\n/** Declarative section-type dependencies resolved from prior sections in plan order. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES: Partial<\n Record<AXMSectionTypeCode, AXMSectionTypeDependency>\n> = {\n HazardRisk: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'Hazard',\n filterField: 'hazardId',\n },\n PpeHazards: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'Hazard',\n filterField: 'hazardId',\n },\n HazardRiskPpe: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'HazardRisk',\n filterField: 'hazardRiskId',\n },\n RiskMatrix: {\n kind: 'derivedFromParent',\n parentSectionTypeKey: 'HazardRisk',\n resolveField: 'riskMatrixId',\n filterField: 'id',\n },\n};\n\n/** Section types cleared when upstream hazard selections change. */\nexport const WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD: readonly AXMSectionTypeCode[] = [\n 'HazardRisk',\n 'PpeHazards',\n 'HazardRiskPpe',\n 'RiskMatrix',\n];\n\n/** Section types cleared when upstream hazard-risk selections change. */\nexport const WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK: readonly AXMSectionTypeCode[] = [\n 'HazardRiskPpe',\n 'RiskMatrix',\n];\n\nexport type AXMHazardRiskRecordLoader = (hazardRiskIds: string[]) => Promise<Record<string, unknown>[]>;\n\n//#endregion\n\n//#region ---- Lookup helpers ----\n\nexport const PARENT_HAZARD_IDS_CONTEXT_KEY = 'parentHazardIds';\n\nexport const PARENT_HAZARD_RISK_IDS_CONTEXT_KEY = 'parentHazardRiskIds';\n\n/** Expose paths when a section type is selected (shared by entity repeater and builder dialog). */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE = [\n { source: 'id', target: 'sectionType.id' },\n { source: 'title', target: 'sectionType.title' },\n { source: 'code', target: 'sectionType.code' },\n { source: 'description', target: 'sectionType.description' },\n { source: 'isRepeatable', target: 'sectionType.isRepeatable' },\n];\n\n/** Auto-fill section description when section type is selected. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS = [\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action:\n \"{{ const items = widget.output('selectedItems'); const selectedDescription = Array.isArray(items) ? items[0]?.description : undefined; const d = selectedDescription || context.eval('sectionType.description') || ''; context.set('sectionTypeDescription', d); const descriptionWidget = widget.find('sectionTypeDescription'); if (descriptionWidget) { descriptionWidget.setValue(d); } }}\",\n },\n {\n event: \"{{ events.context('sectionType.description') }}\",\n action:\n \"{{ const d = context.eval('sectionType.description') || ''; context.set('sectionTypeDescription', d); const descriptionWidget = widget.find('sectionTypeDescription'); if (descriptionWidget) { descriptionWidget.setValue(d); } }}\",\n },\n];\n\n/** Auto-fill section title when section type is selected. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS = [\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action:\n \"{{ const items = widget.output('selectedItems'); const selectedTitle = Array.isArray(items) ? items[0]?.title : undefined; const t = selectedTitle || context.eval('sectionType.title') || ''; if (t) { context.set('title', t); const titleWidget = widget.find('title'); if (titleWidget) { titleWidget.setValue(t); } } }}\",\n },\n {\n event: \"{{ events.context('sectionType.title') }}\",\n action:\n \"{{ const t = context.eval('sectionType.title') || ''; if (t) { context.set('title', t); const titleWidget = widget.find('title'); if (titleWidget) { titleWidget.setValue(t); } } }}\",\n },\n];\n\n/** Shared lookup widget options for section type pickers (builder dialog and entity forms). */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS: Record<string, unknown> = {\n look: 'select',\n allowSearch: true,\n textField: 'code',\n textTemplate: '{code} — {description}',\n valueField: 'id',\n columns: ['code', 'title', 'description'],\n expose: WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE,\n triggers: [\n ...WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS,\n ...WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS,\n ],\n};\n\n//#endregion\n\n//#region ---- Resolver API ----\n\nexport function getSectionTypeDependency(\n sectionTypeKey: string | undefined,\n): AXMSectionTypeDependency | undefined {\n if (!sectionTypeKey) {\n return undefined;\n }\n return WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES[sectionTypeKey as AXMSectionTypeCode];\n}\n\nexport function sectionTypeKeyFromSection(\n section: Pick<AXMSafetyPlanSectionBuilderSectionValue, 'sectionType' | 'sectionTypeId'>,\n): AXMSectionTypeCode | undefined {\n const sectionTypeId = section.sectionTypeId || section.sectionType?.id;\n const key = resolveSectionTypeKey(sectionTypeId, section.sectionType);\n return key;\n}\n\nfunction collectSectionItemIds(\n section: AXMSafetyPlanSectionBuilderSectionValue | undefined,\n sectionTypeKey: AXMSectionTypeCode,\n): string[] {\n if (!section?.items?.length || sectionTypeKeyFromSection(section) !== sectionTypeKey) {\n return [];\n }\n const ids = new Set<string>();\n for (const item of section.items) {\n for (const id of item.itemIds ?? []) {\n if (typeof id === 'string' && id.length > 0) {\n ids.add(id);\n }\n }\n }\n return [...ids];\n}\n\n/** Collects item IDs from sections up to `sectionIndex` whose type matches `parentSectionTypeKey`. */\nexport function resolveParentItemIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode,\n): string[] {\n const ids = new Set<string>();\n const lastIndex = Math.min(sectionIndex, sections.length - 1);\n for (let index = 0; index <= lastIndex; index += 1) {\n collectSectionItemIds(sections[index], parentSectionTypeKey).forEach((id) => ids.add(id));\n }\n return [...ids];\n}\n\n/** Collects hazard IDs from earlier sections and Hazard rows in the current section. */\nexport function resolveParentHazardIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode = 'Hazard',\n): string[] {\n return resolveParentItemIds(sections, sectionIndex, parentSectionTypeKey);\n}\n\n/** Collects hazard-risk IDs from prior HazardRisk sections up to `sectionIndex`. */\nexport function resolveParentHazardRiskIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n): string[] {\n return resolveParentItemIds(sections, sectionIndex, 'HazardRisk');\n}\n\nfunction parentItemSignature(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode,\n): string {\n return resolveParentItemIds(sections, sectionIndex, parentSectionTypeKey).sort().join('|');\n}\n\nfunction shouldClearSectionOnParentChange(\n section: AXMSafetyPlanSectionBuilderSectionValue,\n sectionIndex: number,\n changeIndex: number,\n parentTypeKey: AXMSectionTypeCode,\n downstreamTypes: readonly AXMSectionTypeCode[],\n): boolean {\n if (sectionIndex < changeIndex) {\n return false;\n }\n const sectionKey = sectionTypeKeyFromSection(section);\n if (!sectionKey || !downstreamTypes.includes(sectionKey)) {\n return false;\n }\n if (sectionIndex === changeIndex && sectionKey === parentTypeKey) {\n return false;\n }\n return section.items.some((item) => (item.itemIds?.length ?? 0) > 0);\n}\n\nfunction clearSectionItems(\n section: AXMSafetyPlanSectionBuilderSectionValue,\n): AXMSafetyPlanSectionBuilderSectionValue {\n return {\n ...section,\n items: section.items.map((item) => ({ ...item, itemIds: [], items: [] })),\n };\n}\n\n/**\n * When upstream hazard or hazard-risk selections change, clears item rows in later dependent sections.\n */\nexport function clearDependentItemsOnParentChange(\n previous: AXMSafetyPlanSectionBuilderValue,\n next: AXMSafetyPlanSectionBuilderValue,\n): AXMSafetyPlanSectionBuilderValue {\n if (!next.sections.length) {\n return next;\n }\n\n let changeIndex = next.sections.length;\n let hazardChanged = false;\n let hazardRiskChanged = false;\n\n for (let index = 0; index < next.sections.length; index += 1) {\n const prevHazardSig = parentItemSignature(previous.sections, index, 'Hazard');\n const nextHazardSig = parentItemSignature(next.sections, index, 'Hazard');\n if (prevHazardSig !== nextHazardSig) {\n changeIndex = Math.min(changeIndex, index);\n hazardChanged = true;\n }\n\n const prevRiskSig = parentItemSignature(previous.sections, index, 'HazardRisk');\n const nextRiskSig = parentItemSignature(next.sections, index, 'HazardRisk');\n if (prevRiskSig !== nextRiskSig) {\n changeIndex = Math.min(changeIndex, index);\n hazardRiskChanged = true;\n }\n }\n\n if (changeIndex === next.sections.length) {\n return next;\n }\n\n return {\n sections: next.sections.map((section, sectionIndex) => {\n const clearFromHazard =\n hazardChanged &&\n shouldClearSectionOnParentChange(\n section,\n sectionIndex,\n changeIndex,\n 'Hazard',\n WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD,\n );\n const clearFromHazardRisk =\n hazardRiskChanged &&\n shouldClearSectionOnParentChange(\n section,\n sectionIndex,\n changeIndex,\n 'HazardRisk',\n WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK,\n );\n\n if (!clearFromHazard && !clearFromHazardRisk) {\n return section;\n }\n return clearSectionItems(section);\n }),\n };\n}\n\nexport function extractRiskMatrixIdsFromHazardRisks(records: Record<string, unknown>[]): string[] {\n const ids = new Set<string>();\n for (const record of records) {\n const id = record['riskMatrixId'];\n if (typeof id === 'string' && id.length > 0) {\n ids.add(id);\n }\n }\n return [...ids];\n}\n\nfunction buildInFilter(field: string, values: string[]): Record<string, unknown> | null {\n const unique = [...new Set(values.filter((id) => id.length > 0))];\n if (!unique.length) {\n return null;\n }\n return {\n field,\n operator: { type: 'in' },\n value: unique,\n };\n}\n\n/** Filter that matches no records when parent context exists but derived IDs are empty. */\nfunction buildEmptyResultFilter(field: string): Record<string, unknown> {\n return {\n field,\n operator: { type: 'in' },\n value: ['00000000-0000-0000-0000-000000000000'],\n };\n}\n\nexport function resolveSafetyPlanSectionItemFilter(\n sectionTypeId: string,\n parentHazardIds: string[],\n parentHazardRiskIds: string[] = [],\n): Record<string, unknown> | null {\n const sectionTypeKey = resolveSectionTypeKey(sectionTypeId);\n const dependency = getSectionTypeDependency(sectionTypeKey);\n if (!dependency || dependency.kind !== 'parentFilter') {\n return null;\n }\n\n const parentIds =\n dependency.parentSectionTypeKey === 'Hazard' ? parentHazardIds : parentHazardRiskIds;\n if (!parentIds.length) {\n return null;\n }\n\n return buildInFilter(dependency.filterField, parentIds);\n}\n\nexport async function resolveSafetyPlanSectionItemFilterAsync(\n sectionTypeId: string,\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n loadHazardRisks: AXMHazardRiskRecordLoader,\n): Promise<Record<string, unknown> | null> {\n const sectionTypeKey = resolveSectionTypeKey(sectionTypeId);\n const dependency = getSectionTypeDependency(sectionTypeKey);\n if (!dependency) {\n return null;\n }\n\n if (dependency.kind === 'parentFilter') {\n const parentIds = resolveParentItemIds(sections, sectionIndex, dependency.parentSectionTypeKey);\n if (!parentIds.length) {\n return null;\n }\n return buildInFilter(dependency.filterField, parentIds);\n }\n\n const parentIds = resolveParentItemIds(sections, sectionIndex, dependency.parentSectionTypeKey);\n if (!parentIds.length) {\n return null;\n }\n\n const records = await loadHazardRisks(parentIds);\n const derivedIds = extractRiskMatrixIdsFromHazardRisks(records);\n\n if (!derivedIds.length) {\n return buildEmptyResultFilter(dependency.filterField);\n }\n\n return buildInFilter(dependency.filterField, derivedIds);\n}\n\nconst defaultItemIdsPlaceholderKey =\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.item-ids.placeholder';\n\n/** Clears item selection when section type changes in item dialog context. */\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: \"{{ widget.setValue([]); context.set('items', []); }}\",\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: \"{{ widget.setValue([]); context.set('items', []); }}\",\n },\n];\n\n/**\n * Reloads lookup data after section type is resolved (`sectionType.id`, `itemEntityName`).\n */\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionType.itemEntityName') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: '{{ widget.refresh(); }}',\n },\n];\n\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS = [\n ...WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS,\n ...WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS,\n];\n\nfunction isPpeRuleSectionType(sectionTypeId: string): boolean {\n return (\n sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards ||\n sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe\n );\n}\n\nfunction buildSectionTypeItemTextFieldExpression(sectionTypeIdPath: string): string {\n const ppeHazardsId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const hazardRiskPpeId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n return `{{ [ '${ppeHazardsId}', '${hazardRiskPpeId}' ].includes(context.eval('${sectionTypeIdPath}')) ? 'ppeItem.title' : 'title' }}`;\n}\n\nfunction buildSectionTypeItemColumnsExpression(sectionTypeIdPath: string): string {\n const ppeHazardsId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const hazardRiskPpeId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n const riskMatrixId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix;\n return `{{ context.eval('${sectionTypeIdPath}') === '${riskMatrixId}' ? ['code', 'title', 'matrix'] : [ '${ppeHazardsId}', '${hazardRiskPpeId}' ].includes(context.eval('${sectionTypeIdPath}')) ? ['code', 'ppeItem.title', 'requirementType'] : ['code', 'title'] }}`;\n}\n\nfunction buildSectionTypeDependentParentFilter(\n sectionTypeIdPath: string,\n parentIdsContextKey: string,\n parentSectionTypeKey: AXMSectionTypeCode,\n): Record<string, unknown> {\n const dependentSectionTypeIds = (\n Object.entries(WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES) as Array<\n [AXMSectionTypeCode, AXMSectionTypeDependency]\n >\n )\n .filter(([, config]) => config.kind === 'parentFilter' && config.parentSectionTypeKey === parentSectionTypeKey)\n .map(([key]) => {\n const id = Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID).find(\n ([, meta]) => meta.sectionTypeKey === key,\n )?.[0];\n return id ? `'${id}'` : undefined;\n })\n .filter((id): id is string => Boolean(id))\n .join(',');\n\n return {\n field: parentSectionTypeKey === 'Hazard' ? 'hazardId' : 'hazardRiskId',\n operator: { type: 'in' },\n value: `{{ [${dependentSectionTypeIds}].includes(context.eval('${sectionTypeIdPath}')) ? ((context.eval('${parentIdsContextKey}') || []).length ? context.eval('${parentIdsContextKey}') : undefined) : undefined }}`,\n };\n}\n\nfunction buildSectionTypeDependentHazardFilter(\n sectionTypeIdPath: string,\n parentHazardIdsContextKey: string,\n): Record<string, unknown> {\n return buildSectionTypeDependentParentFilter(sectionTypeIdPath, parentHazardIdsContextKey, 'Hazard');\n}\n\nconst sectionItemLookupExpose = [\n { source: 'id', target: 'items.{id}' },\n { source: 'title', target: 'items.{title}' },\n { source: 'code', target: 'items.{code}' },\n { source: 'ppeItem.id', target: 'items.{id}' },\n { source: 'ppeItem.title', target: 'items.{title}' },\n { source: 'ppeItem.code', target: 'items.{code}' },\n];\n\n/** Shared item lookup options for builder item dialog (`sectionType.*` in dialog context). */\nexport function buildSafetyPlanSectionItemLookupOptions(\n entityExpression: string,\n options?: {\n /** Context path to section type id, e.g. `sectionType.id`. */\n sectionTypeIdPath?: string;\n /** Dialog context key for upstream hazard IDs (read at runtime; do not embed IDs in options). */\n parentHazardIdsContextKey?: string;\n /** Dialog context key for upstream hazard-risk IDs. */\n parentHazardRiskIdsContextKey?: string;\n defaultPlaceholderKey?: string;\n },\n): Record<string, unknown> {\n const sectionTypeIdPath = options?.sectionTypeIdPath ?? 'sectionType.id';\n const lookup: Record<string, unknown> = {\n entity: entityExpression,\n look: 'lookup',\n multiple: true,\n allowSearch: true,\n textField: buildSectionTypeItemTextFieldExpression(sectionTypeIdPath),\n columns: buildSectionTypeItemColumnsExpression(sectionTypeIdPath),\n placeholder: options?.defaultPlaceholderKey ?? defaultItemIdsPlaceholderKey,\n expose: sectionItemLookupExpose,\n triggers: WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS,\n };\n\n const filters: Record<string, unknown>[] = [];\n if (options?.parentHazardIdsContextKey) {\n filters.push(\n buildSectionTypeDependentHazardFilter(sectionTypeIdPath, options.parentHazardIdsContextKey),\n );\n }\n if (options?.parentHazardRiskIdsContextKey) {\n filters.push(\n buildSectionTypeDependentParentFilter(\n sectionTypeIdPath,\n options.parentHazardRiskIdsContextKey,\n 'HazardRisk',\n ),\n );\n }\n if (filters.length === 1) {\n lookup['filter'] = filters[0];\n } else if (filters.length > 1) {\n lookup['filter'] = { logic: 'and', filters };\n }\n\n return lookup;\n}\n\n/** Lookup options with entity data-selector popup UI (`look: 'lookup'`). */\nexport function buildSafetyPlanSectionItemSelectorOptions(\n entityExpression: string,\n options?: Parameters<typeof buildSafetyPlanSectionItemLookupOptions>[1],\n): Record<string, unknown> {\n return {\n ...buildSafetyPlanSectionItemLookupOptions(entityExpression, options),\n look: 'lookup',\n };\n}\n\n/** Selector column: string names are visible; `{ visible: false }` is queried for widget context only. */\nexport type AXMSafetyPlanSectionItemColumn = string | { name: string; visible?: boolean };\n\nexport function resolveSafetyPlanSectionItemColumns(sectionTypeId: string): AXMSafetyPlanSectionItemColumn[] {\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards) {\n return ['code', 'ppeItem.title', 'requirementType'];\n }\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe) {\n return ['code', 'hazardRisk.title', 'ppeItem.title', 'requirementType'];\n }\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix) {\n return [\n 'code',\n 'title',\n 'matrix',\n { name: 'likelihoodIds', visible: false },\n { name: 'severityIds', visible: false },\n { name: 'likelihoodId', visible: false },\n { name: 'severityId', visible: false },\n { name: 'matrixOrientation', visible: false },\n ];\n }\n return ['code', 'title'];\n}\n\nexport function resolveSafetyPlanSectionItemEntityKey(\n sectionTypeId: string,\n sectionType?: AXMSectionTypeSnapshot,\n): string | undefined {\n return resolveSectionItemEntityName(sectionTypeId, sectionType);\n}\n\nexport function mapSafetyPlanSectionSelectedItems(\n sectionTypeId: string,\n selectedItems: Array<Record<string, unknown>>,\n): Array<{ id: string; title?: string; code?: string }> {\n const isPpeHazards = sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const isHazardRiskPpe = sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n\n return selectedItems\n .map((item) => {\n if (isPpeHazards || isHazardRiskPpe) {\n const ppeItem = item['ppeItem'] as Record<string, unknown> | undefined;\n const id = String(ppeItem?.['id'] ?? item['id'] ?? '');\n return {\n id,\n title: asSafetyPlanDisplayText(ppeItem?.['title']) || undefined,\n code: asSafetyPlanDisplayText(ppeItem?.['code']) || undefined,\n };\n }\n return {\n id: String(item['id'] ?? ''),\n title: asSafetyPlanDisplayText(item['title']) || undefined,\n code: asSafetyPlanDisplayText(item['code']) || undefined,\n };\n })\n .filter((item) => item.id.length > 0);\n}\n\nexport function dedupeSafetyPlanSectionItemSelection(\n item: AXMSafetyPlanSectionBuilderItemValue,\n): AXMSafetyPlanSectionBuilderItemValue {\n const seen = new Set<string>();\n const itemIds: string[] = [];\n const items: NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']> = [];\n\n for (let index = 0; index < (item.itemIds?.length ?? 0); index += 1) {\n const id = item.itemIds?.[index];\n if (typeof id !== 'string' || !id || seen.has(id)) {\n continue;\n }\n seen.add(id);\n itemIds.push(id);\n const snapshot =\n item.items?.find((entry) => entry?.id === id) ??\n (item.items?.[index]?.id === id || !item.items?.[index]?.id ? item.items?.[index] : undefined);\n items.push({\n id,\n title: asSafetyPlanDisplayText(snapshot?.title) || undefined,\n code: asSafetyPlanDisplayText(snapshot?.code) || undefined,\n });\n }\n\n return { ...item, itemIds, items };\n}\n\nexport function isPpeRuleSectionTypeId(sectionTypeId: string): boolean {\n return isPpeRuleSectionType(sectionTypeId);\n}\n\n//#endregion\n","/** Component key for the safety plan Sections page tab. Register via AXP_PAGE_COMPONENT_PROVIDER. */\nexport const SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY = 'safety-plan-sections-page';\n","//#region ---- Safety plan section builder value types ----\n\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type { AXMStepTableCellValue } from './entities/safety-plan-work-step/safety-plan-work-step.types';\nimport type { AXMStepTableColumnDef, AXMWorkStepTypeSnapshot } from './entities/work-step-type/work-step-type.types';\nimport type { AXMSafetyPlanSectionWidgetOptions } from './entities/safety-plan-section/safety-plan-section.types';\n\n/** One Step Table body row in the section builder. */\nexport interface AXMSafetyPlanStepTableRowBuilderPayload {\n cells: AXMStepTableCellValue[];\n /** Persisted business code when loaded from storage. */\n code?: string;\n sortOrder?: number;\n title?: string;\n}\n\nexport interface AXMSafetyPlanSectionBuilderItemValue {\n id: string;\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n /** Step Table body row (one SafetyPlanWorkStep entity). */\n stepTableRow?: AXMSafetyPlanStepTableRowBuilderPayload;\n}\n\nexport interface AXMSafetyPlanSectionBuilderSectionValue {\n id: string;\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n title: string;\n description?: string;\n safetyPlanId?: string;\n /** Persisted business code (`SPS-{seq:4}`) when loaded from storage. */\n code?: string;\n /** Originating SafetyPlanTypeSection id (independent copy after save). */\n sourceSafetyPlanTypeSectionId?: string;\n /** Display / persistence order. */\n sortOrder?: number;\n /** When true, section came from a default type template and must remain. */\n required?: boolean;\n /**\n * Step Table only — selected Work Step (WorkStepType) that defines columns.\n * Required before rows can be added.\n */\n workStepTypeId?: string;\n workStepType?: AXMWorkStepTypeSnapshot;\n /** Columns loaded from the selected Work Step configuration. */\n columns?: AXMStepTableColumnDef[];\n /** Widget display options (PPE layout, control-hierarchy view). */\n widgetOptions?: AXMSafetyPlanSectionWidgetOptions;\n items: AXMSafetyPlanSectionBuilderItemValue[];\n}\n\nexport interface AXMSafetyPlanSectionBuilderValue {\n sections: AXMSafetyPlanSectionBuilderSectionValue[];\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { createRandomUuid } from '@acorex-platform/framework-shared/core';\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type {\n AXMStepTableCellValue,\n AXMStepTableRow,\n AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel,\n} from './entities/safety-plan-work-step/safety-plan-work-step.types';\nimport type {\n AXMStepTableColumnDef,\n AXMWorkplaceSafetyManagementWorkStepTypeEntityModel,\n} from './entities/work-step-type/work-step-type.types';\nimport {\n enrichSectionTypeSnapshot,\n resolveSectionItemEntityName,\n resolveSectionTypeKey,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS,\n} from './section-type-entity-map';\n\n//#endregion\n\n//#region ---- Local helpers ----\n\nfunction nextId(): string {\n return createRandomUuid();\n}\n\nfunction resolveRefId(value: unknown): string {\n if (typeof value === 'string') {\n return value.trim();\n }\n if (value != null && typeof value === 'object' && 'id' in value) {\n const id = (value as { id?: unknown }).id;\n return typeof id === 'string' ? id.trim() : '';\n }\n return '';\n}\n\n//#endregion\n\n//#region ---- Detection ----\n\n/** True when the section type is the Step Table host for SafetyPlanWorkStep rows. */\nexport function isStepTableSectionType(\n sectionTypeId: string | undefined,\n snapshot?: AXMSectionTypeSnapshot,\n): boolean {\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.stepTable) {\n return true;\n }\n return resolveSectionTypeKey(sectionTypeId, snapshot) === 'StepTable';\n}\n\n//#endregion\n\n//#region ---- Column helpers ----\n\n/** Stable key used on cells for this column (`sectionTypeId`). */\nexport function stepTableColumnKey(column: AXMStepTableColumnDef): string {\n return resolveRefId(column.sectionTypeId) || resolveRefId(column.sectionType);\n}\n\nexport function stepTableColumnTitle(column: AXMStepTableColumnDef): string {\n const explicit = typeof column.title === 'string' ? column.title.trim() : '';\n if (explicit) {\n return explicit;\n }\n const fromType =\n (typeof column.sectionType?.title === 'string' && column.sectionType.title.trim()) ||\n (typeof column.sectionType?.code === 'string' && column.sectionType.code.trim()) ||\n '';\n return fromType || 'Column';\n}\n\n/** Resolves the catalog entity for a column from its SectionType mapping. */\nexport function resolveStepTableColumnLookupEntity(\n column: AXMStepTableColumnDef,\n): string | undefined {\n const sectionTypeId = stepTableColumnKey(column);\n return resolveSectionItemEntityName(\n sectionTypeId,\n enrichSectionTypeSnapshot(sectionTypeId, column.sectionType),\n );\n}\n\n/** Multi-select when the mapped section type typically holds many items. */\nexport function isStepTableColumnMultiLookup(column: AXMStepTableColumnDef): boolean {\n const key = resolveSectionTypeKey(\n stepTableColumnKey(column),\n enrichSectionTypeSnapshot(stepTableColumnKey(column), column.sectionType),\n );\n return key === 'Control' || key === 'Ppe' || key === 'PpeHazards' || key === 'HazardRiskPpe';\n}\n\nexport function sortStepTableColumns(columns: readonly AXMStepTableColumnDef[]): AXMStepTableColumnDef[] {\n return [...columns].sort(\n (a, b) =>\n (a.sortOrder ?? 0) - (b.sortOrder ?? 0) ||\n stepTableColumnKey(a).localeCompare(stepTableColumnKey(b)),\n );\n}\n\nexport function createEmptyStepTableRow(\n columns: readonly AXMStepTableColumnDef[],\n sortOrder = 1,\n): AXMStepTableRow {\n const ordered = sortStepTableColumns(columns);\n return {\n id: nextId(),\n sortOrder,\n cells: ordered.map((column) => createEmptyStepTableCell(stepTableColumnKey(column))),\n };\n}\n\nexport function createEmptyStepTableCell(columnKey: string): AXMStepTableCellValue {\n return { columnKey, refIds: [], refs: [] };\n}\n\n/** Builds a new work-step payload from a WorkStepType (columns snapshot + one empty row). */\nexport function buildWorkStepContentFromType(\n type: Pick<AXMWorkplaceSafetyManagementWorkStepTypeEntityModel, 'columns'>,\n): { columns: AXMStepTableColumnDef[]; rows: AXMStepTableRow[] } {\n const columns = normalizeStepTableColumns(type.columns ?? []);\n return {\n columns,\n rows: columns.length > 0 ? [createEmptyStepTableRow(columns, 1)] : [],\n };\n}\n\nexport function normalizeStepTableColumns(\n columns: readonly AXMStepTableColumnDef[] | null | undefined,\n): AXMStepTableColumnDef[] {\n if (!Array.isArray(columns)) {\n return [];\n }\n return sortStepTableColumns(\n columns\n .filter((column) => column != null && typeof column === 'object')\n .map((column, index) => {\n const sectionTypeId =\n resolveRefId(column.sectionTypeId) || resolveRefId(column.sectionType);\n const sectionType = enrichSectionTypeSnapshot(sectionTypeId, column.sectionType);\n const title =\n typeof column.title === 'string' && column.title.trim()\n ? column.title.trim()\n : sectionType?.title;\n return {\n sectionTypeId,\n sectionType,\n title,\n sortOrder: typeof column.sortOrder === 'number' ? column.sortOrder : index + 1,\n required: column.required === true,\n };\n })\n .filter((column) => column.sectionTypeId.length > 0),\n );\n}\n\nexport function normalizeStepTableRows(\n rows: readonly AXMStepTableRow[] | null | undefined,\n columns: readonly AXMStepTableColumnDef[],\n): AXMStepTableRow[] {\n if (!Array.isArray(rows)) {\n return [];\n }\n const columnKeys = new Set(columns.map((column) => stepTableColumnKey(column)).filter(Boolean));\n return [...rows]\n .filter((row) => row != null && typeof row === 'object')\n .map((row, index) => {\n const id = typeof row.id === 'string' && row.id.trim() ? row.id.trim() : nextId();\n const cellsByKey = new Map<string, AXMStepTableCellValue>();\n for (const cell of Array.isArray(row.cells) ? row.cells : []) {\n if (!cell || typeof cell !== 'object' || typeof cell.columnKey !== 'string') {\n continue;\n }\n cellsByKey.set(cell.columnKey, {\n columnKey: cell.columnKey,\n textValue: typeof cell.textValue === 'string' ? cell.textValue : undefined,\n numberValue: typeof cell.numberValue === 'number' ? cell.numberValue : undefined,\n refIds: Array.isArray(cell.refIds)\n ? cell.refIds.filter((id: unknown): id is string => typeof id === 'string' && id.length > 0)\n : [],\n refs: Array.isArray(cell.refs)\n ? cell.refs\n .filter(\n (ref: unknown): ref is { id: string; title?: string; code?: string } =>\n ref != null &&\n typeof ref === 'object' &&\n typeof (ref as { id?: unknown }).id === 'string',\n )\n .map((ref: { id: string; title?: string; code?: string }) => ({\n id: ref.id,\n title: typeof ref.title === 'string' ? ref.title : undefined,\n code: typeof ref.code === 'string' ? ref.code : undefined,\n }))\n : [],\n });\n }\n const cells = columns.map((column) => {\n const key = stepTableColumnKey(column);\n return cellsByKey.get(key) ?? createEmptyStepTableCell(key);\n });\n for (const [key, cell] of cellsByKey) {\n if (!columnKeys.has(key)) {\n cells.push(cell);\n }\n }\n return {\n id,\n sortOrder: typeof row.sortOrder === 'number' ? row.sortOrder : index + 1,\n cells,\n };\n })\n .sort((a, b) => a.sortOrder - b.sortOrder);\n}\n\nexport function toWorkStepBuilderPayload(\n entity: AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel,\n): {\n id: string;\n code?: string;\n workStepTypeId: string;\n workStepType?: { id: string; title?: string; code?: string };\n title?: string;\n columns: AXMStepTableColumnDef[];\n cells: AXMStepTableCellValue[];\n sortOrder?: number;\n} {\n const columns = normalizeStepTableColumns(entity.columns);\n return {\n id: entity.id,\n code: entity.code,\n workStepTypeId: entity.workStepTypeId,\n workStepType: entity.workStepType,\n title: entity.title,\n columns,\n cells: normalizeStepTableRows(\n [{ id: entity.id, sortOrder: entity.sortOrder ?? 1, cells: entity.cells ?? [] }],\n columns,\n )[0]?.cells ?? entity.cells ?? [],\n sortOrder: entity.sortOrder,\n };\n}\n\n//#endregion\n","//#region ---- Built-in work step type IDs ----\n\n/** Stable IDs for seeded Work Step Types (shared by server mocks and client). */\nexport const WORKPLACE_SAFETY_BUILT_IN_WORK_STEP_TYPE_IDS = {\n generalTask: 'c1d2e5f4-a5b6-4789-d001-000000000001',\n sitePreparation: 'c1d2e5f4-a5b6-4789-d001-000000000002',\n performWork: 'c1d2e5f4-a5b6-4789-d001-000000000003',\n} as const;\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPCategoryListItem, AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Item model ----\n\nexport interface AXMControlHierarchyLevelItemModel {\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n /** Display color for hierarchy diagram visualizations. */\n color?: string;\n /**\n * Optional explicit row order. When omitted, repeater array index defines order\n * (`AXPRepeaterWidgetEditComponent` + `allowReorder`).\n */\n order?: number;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementControlHierarchyLevelsEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `control-hierarchy-levels-code` (`CHL-{seq:4}`). */\n code: string;\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n /** Hierarchy level items managed via repeater. */\n itemIds?: AXMControlHierarchyLevelItemModel[];\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementControlMeasureEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `control-measure-code` (`CM-{seq:4}`). */\n code: string;\n title: AXPMultiLanguageString;\n instruction?: AXPMultiLanguageString;\n status?: string;\n}\n\n//#endregion\n","import { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Enums ----\n\nexport enum AXMHazardRegisterContextType {\n Asset = 'asset',\n Site = 'site',\n WorkOrder = 'work-order',\n Project = 'project',\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementHazardRegisterEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `hazard-register-code` (`HR-{date:YYYY}-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n /** Hazard category id (`WorkplaceSafetyManagement.HazardCategory`). */\n registerType: string;\n registerTypeCategory?: { id: string; title?: string; code?: string };\n hazardId: string;\n hazard?: { id: string; title?: string; code?: string };\n /** Merged hazard + category metadata field values keyed by field name. */\n metaDataForm?: Record<string, unknown>;\n contextType: AXMHazardRegisterContextType;\n contextId: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementHazardRiskEntityModel extends AXPEntityModel<string> {\n code: string;\n hazardId: string;\n hazard?: { id: string; title?: string; code?: string };\n riskMatrixId: string;\n riskMatrix?: { id: string; title?: string; code?: string };\n title: string;\n description?: string;\n defaultInitialRiskRatingId?: string;\n defaultInitialRiskRating?: { id: string; title?: string; code?: string };\n defaultResidualRiskRatingId?: string;\n defaultResidualRiskRating?: { id: string; title?: string; code?: string };\n status?: AXPSystemStatusType.Active | AXPSystemStatusType.Inactive;\n}\n\n//#endregion\n","import { AXPCategoryListItem, AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementPpeItemEntityModel extends AXPEntityModel<string> {\n code: string;\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n categoryIds?: string[];\n categories?: AXPCategoryListItem[];\n serialNumber?: string;\n icon?: string;\n status?: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\nimport type { AXMSafetyPlanSectionBuilderValue } from '../../safety-plan-section-builder.types';\nimport type { AXMSafetyPlanSectionStructureValue } from '../../safety-plan-section-structure.util';\n\n//#endregion\n\n//#region ---- Status ----\n\nexport type AXMSafetyPlanStatus =\n | AXPSystemStatusType.Draft\n | AXPSystemStatusType.Published\n | AXPSystemStatusType.Archived;\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-code` (`SP-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n safetyPlanTypeId: string;\n safetyPlanType?: { id: string; title?: string; code?: string };\n /**\n * Selected Safety Plan Type Section (named structure) for this plan.\n * Filtered by {@link safetyPlanTypeId}; defaults to the type's `isDefault` structure.\n */\n structureId?: string;\n structure?: { id: string; title?: string };\n status?: AXMSafetyPlanStatus;\n /** When true, a published plan can be cloned into a new draft plan. */\n allowClone?: boolean;\n publishedAt?: string;\n publishedById?: string;\n publishedBy?: { id: string; displayName?: string };\n /**\n * Form-only editable section structure loaded from the selected plan type defaults\n * (create) or from saved SafetyPlanSection rows (edit). Not persisted on the plan document.\n */\n sectionStructure?: AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue;\n /** @deprecated Prefer {@link sectionStructure}; kept for wizard page field compatibility. */\n sections?: AXMSafetyPlanSectionBuilderValue;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMSectionTypeSnapshot } from '../section-type/section-type.types';\n\n//#endregion\n\n//#region ---- Item model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n /**\n * Step Table only — selected Work Step (WorkStepType) that defines table columns.\n * Persisted on the section items slot alongside row entity ids.\n */\n workStepTypeId?: string;\n workStepType?: { id: string; title?: string; code?: string };\n itemIds?: string[];\n items?: { id: string; title?: string; code?: string }[];\n}\n\n//#endregion\n\n//#region ---- Widget options ----\n\n/** Display options for section widgets (PPE layout, control-hierarchy viewType). Item ids stay on `items`. */\nexport interface AXMSafetyPlanSectionWidgetOptions {\n layout?: unknown;\n viewType?: unknown;\n showTitle?: boolean;\n showViewTypeSelector?: boolean;\n [key: string]: unknown;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-section-code` (`SPS-{seq:4}`). */\n code: string;\n safetyPlanId: string;\n safetyPlan?: { id: string; title?: string; code?: string };\n title: string;\n description?: string;\n /** Section line items managed via repeater (embedded value objects). */\n items: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n /**\n * SafetyPlanTypeSection this row was created from.\n * Stored as a snapshot link only — later type-section edits do not affect this plan.\n */\n sourceSafetyPlanTypeSectionId?: string;\n /** List / display order within the plan. */\n sortOrder?: number;\n /** Widget display options (PPE layout, control-hierarchy view). Not used for Risk Matrix. */\n widgetOptions?: AXMSafetyPlanSectionWidgetOptions;\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanTypeEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-type-code` (`SPT-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n /** Managed by the archive plugin (`isArchived`). Active when false. */\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMSectionTypeSnapshot } from '../section-type/section-type.types';\n\n//#endregion\n\n//#region ---- Section type repeater row ----\n\n/** Section type row managed via repeater on Safety Plan Type Section. */\nexport interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel extends AXPEntityModel<string> {\n safetyPlanTypeId: string;\n safetyPlanType?: { id: string; title?: string; code?: string };\n /** Display title for this section configuration. */\n title: string;\n /**\n * Section types managed via repeater (`allowReorder`).\n * Each row holds a `sectionTypeId` LookupBox selection.\n */\n sectionTypeIds?: AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel[];\n /** List sort order only (hidden / not edited in create-update UI). */\n sortOrder?: number;\n isDefault?: boolean;\n /** Managed by the archive plugin (`isArchived`). Active when false. */\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Template type ----\n\nexport type AXMSafetyTemplateType = 'SWMS' | 'JSA' | 'Forms' | 'Permits' | 'Plans';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyTemplateEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-template-code` (`ST-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n templateType: AXMSafetyTemplateType;\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n sectionIds: string[];\n /** Expanded from `sectionIds` (multi-lookup join alias). */\n sectionsList?: { id: string; title: string; code?: string }[];\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Section type keys ----\n\n/** Stable semantic keys for built-in section types (used by dependencies and lookups). */\nexport type AXMSectionTypeCode =\n | 'Hazard'\n | 'HazardRisk'\n | 'Ppe'\n | 'PpeHazards'\n | 'HazardRiskPpe'\n | 'Control'\n | 'HierarchyLevel'\n | 'RiskMatrix'\n | 'Custom'\n | 'StepTable';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSectionTypeEntityModel extends AXPEntityModel<string> {\n /** Business code (seeded built-ins use the title with spaces removed; new rows use `section-type-code`). */\n code: string;\n title: string;\n description?: string;\n /**\n * When false (default), a safety plan may include this section type at most once.\n * Custom / free-form types may set true to allow duplicates.\n */\n isRepeatable?: boolean;\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n}\n\n/** Embedded section type snapshot on safety plan section items. */\nexport interface AXMSectionTypeSnapshot {\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sectionTypeKey?: string;\n itemEntityName?: string;\n /** When true, a safety plan may include this section type more than once. */\n isRepeatable?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMSectionTypeSnapshot } from '../section-type/section-type.types';\n\n//#endregion\n\n//#region ---- Column schema ----\n\n/**\n * Column definition shared by WorkStepType (template) and SafetyPlanWorkStep (snapshot).\n * Each column is backed by a SectionType (lookup options + item entity mapping).\n */\nexport interface AXMStepTableColumnDef {\n /** Selected SectionType id — stable cell key for this column. */\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n /** Optional display override; defaults to section type title. */\n title?: string;\n sortOrder: number;\n required?: boolean;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementWorkStepTypeEntityModel extends AXPEntityModel<string> {\n code: string;\n title: string;\n description?: string;\n /** Default column schema copied onto new SafetyPlanWorkStep rows. */\n columns: AXMStepTableColumnDef[];\n isArchived?: boolean;\n}\n\nexport interface AXMWorkStepTypeSnapshot {\n id: string;\n title?: string;\n code?: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMStepTableColumnDef, AXMWorkStepTypeSnapshot } from '../work-step-type/work-step-type.types';\n\n//#endregion\n\n//#region ---- Table cell model ----\n\nexport interface AXMStepTableCellRef {\n id: string;\n title?: string;\n code?: string;\n}\n\n/** One cell value keyed by column (`sectionTypeId`). */\nexport interface AXMStepTableCellValue {\n columnKey: string;\n textValue?: string;\n numberValue?: number;\n refIds?: string[];\n refs?: AXMStepTableCellRef[];\n}\n\n/** @deprecated Prefer cells on SafetyPlanWorkStep row entity — kept for transitional builders. */\nexport interface AXMStepTableRow {\n id: string;\n sortOrder: number;\n cells: AXMStepTableCellValue[];\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\n/**\n * One Step Table data row under a SafetyPlanSection.\n * Column schema comes from the section’s selected Work Step (WorkStepType).\n */\nexport interface AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-work-step-code` (`SPWS-{seq:4}`). */\n code: string;\n safetyPlanId: string;\n safetyPlan?: { id: string; title?: string; code?: string };\n /** Parent SafetyPlanSection of type Step Table. */\n safetyPlanSectionId: string;\n safetyPlanSection?: { id: string; title?: string; code?: string };\n /** Selected Work Step (WorkStepType) for this section’s table. */\n workStepTypeId: string;\n workStepType?: AXMWorkStepTypeSnapshot;\n /** Optional display label (defaults to row order / first cell). */\n title?: string;\n /** Optional column snapshot at save time (display / history). */\n columns?: AXMStepTableColumnDef[];\n /** Cell values for this single table row. */\n cells: AXMStepTableCellValue[];\n sortOrder?: number;\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Contracts barrel ----\n\nexport * from './ghs-symbol-options';\n\nexport * from './permission.keys';\n\nexport * from './commands.keys';\n\nexport * from './menu.keys';\n\nexport * from './root-config';\n\nexport * from './hazard-ppe-rule.types';\n\nexport * from './hazard-ppe-rule-requirement-type-options';\n\nexport * from './risk-management.integration';\n\nexport * from './safety-template-type-options';\n\nexport * from './section-type-entity-map';\n\nexport * from './safety-plan-section-dependency';\n\nexport * from './SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY';\n\nexport * from './safety-plan-section-builder.types';\n\nexport * from './safety-plan-section-structure.util';\nexport * from './safety-plan-section-unique-type.util';\nexport * from './safety-plan-work-steps.util';\nexport * from './work-step-type-ids';\n\n//#endregion\n\nexport * from './entities';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["resolveRefId"],"mappings":";;AAAA;AAEA;AACA,MAAM,cAAc,GAAG,wCAAwC;AAExD,MAAM,mCAAmC,GAAG;AACjD,IAAA;AACE,QAAA,EAAE,EAAE,OAAO;AACX,QAAA,KAAK,EAAE,wBAAwB;AAC/B,QAAA,WAAW,EAAE,wCAAwC;QACrD,QAAQ,EAAE,CAAA,EAAG,cAAc,CAAA,WAAA,CAAa;AACzC,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,OAAO;AACX,QAAA,KAAK,EAAE,eAAe;AACtB,QAAA,WAAW,EAAE,0EAA0E;QACvF,QAAQ,EAAE,CAAA,EAAG,cAAc,CAAA,WAAA,CAAa;AACzC,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,OAAO;AACX,QAAA,KAAK,EAAE,2BAA2B;AAClC,QAAA,WAAW,EAAE,mEAAmE;QAChF,QAAQ,EAAE,CAAA,EAAG,cAAc,CAAA,aAAA,CAAe;AAC3C,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,OAAO;AACX,QAAA,KAAK,EAAE,sBAAsB;AAC7B,QAAA,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,CAAA,EAAG,cAAc,CAAA,WAAA,CAAa;AACzC,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,OAAO;AACX,QAAA,KAAK,EAAE,8BAA8B;AACrC,QAAA,WAAW,EAAE,+DAA+D;QAC5E,QAAQ,EAAE,CAAA,EAAG,cAAc,CAAA,UAAA,CAAY;AACx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;;AClBA;AAiDA;;ACjDA;AA6DA;;AC7DA;AAiBA;;ACjBA;AAoCA;;ACpCA;AA2BA;;AC3BA;AAmDA;;ACnDA;AA0CA;;AC1CA;AA4DA;;AC5DA;;ACAA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-workplacesafety-management-client-contracts.mjs","sources":["../../../../libs/modules/workplacesafety-management/contracts/src/ghs-symbol-options.ts","../../../../libs/modules/workplacesafety-management/contracts/src/permission.keys.ts","../../../../libs/modules/workplacesafety-management/contracts/src/commands.keys.ts","../../../../libs/modules/workplacesafety-management/contracts/src/menu.keys.ts","../../../../libs/modules/workplacesafety-management/contracts/src/root-config.ts","../../../../libs/modules/workplacesafety-management/contracts/src/manifest.ts","../../../../libs/modules/workplacesafety-management/contracts/src/hazard-ppe-rule.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/hazard-ppe-rule-requirement-type-options.ts","../../../../libs/modules/workplacesafety-management/contracts/src/risk-management.integration.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-template-type-options.ts","../../../../libs/modules/workplacesafety-management/contracts/src/section-type-entity-map.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-unique-type.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-structure.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-dependency.ts","../../../../libs/modules/workplacesafety-management/contracts/src/SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-section-builder.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-activity-sections.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-work-steps.util.ts","../../../../libs/modules/workplacesafety-management/contracts/src/work-step-type-ids.ts","../../../../libs/modules/workplacesafety-management/contracts/src/safety-plan-activity-ids.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/control-hierarchy-levels/control-hierarchy-levels.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/control-measure/control-measure.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/hazard-register/hazard-register.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/hazard-risk/hazard-risk.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/ppe-item/ppe-item.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan/safety-plan.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-section/safety-plan-section.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-type/safety-plan-type.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-type-section/safety-plan-type-section.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-template/safety-template.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/section-type/section-type.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/work-step-type/work-step-type.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/entities/safety-plan-activity/safety-plan-activity.types.ts","../../../../libs/modules/workplacesafety-management/contracts/src/index.ts","../../../../libs/modules/workplacesafety-management/contracts/src/acorex-platform-module-workplacesafety-management-client-contracts.ts"],"sourcesContent":["//#region ---- GHS symbol options ----\n\n/** Asset base path for GHS pictograms (served from demo app assets). */\nconst GHS_IMAGE_BASE = '/assets/workplacesafety-management/ghs';\n\nexport const WORKPLACE_SAFETY_GHS_SYMBOL_OPTIONS = [\n {\n id: 'GHS01',\n title: 'GHS01 — Exploding bomb',\n description: 'Explosion, blast or projection hazard.',\n imageUrl: `${GHS_IMAGE_BASE}/explos.gif`,\n },\n {\n id: 'GHS02',\n title: 'GHS02 — Flame',\n description: 'Flammable liquids, solids and gases; including self-reactive substances.',\n imageUrl: `${GHS_IMAGE_BASE}/flamme.gif`,\n },\n {\n id: 'GHS03',\n title: 'GHS03 — Flame over circle',\n description: 'Oxidising liquids, solids and gases; may cause or intensify fire.',\n imageUrl: `${GHS_IMAGE_BASE}/rondflam.gif`,\n },\n {\n id: 'GHS04',\n title: 'GHS04 — Gas cylinder',\n description: 'Gases under pressure.',\n imageUrl: `${GHS_IMAGE_BASE}/bottle.gif`,\n },\n {\n id: 'GHS05',\n title: 'GHS05 — Skull and crossbones',\n description: 'Fatal or toxic if swallowed, inhaled or in contact with skin.',\n imageUrl: `${GHS_IMAGE_BASE}/skull.gif`,\n },\n {\n id: 'GHS06',\n title: 'GHS06 — Exclamation mark',\n description: 'Low level toxicity; irritant or harmful to health.',\n imageUrl: `${GHS_IMAGE_BASE}/exclam.gif`,\n },\n {\n id: 'GHS07',\n title: 'GHS07 — Corrosion',\n description: 'Corrosive chemicals; may cause severe skin and eye damage.',\n imageUrl: `${GHS_IMAGE_BASE}/acid_red.gif`,\n },\n {\n id: 'GHS08',\n title: 'GHS08 — Health hazard',\n description: 'Chronic health hazards; carcinogenicity, mutagenicity, reproductive toxicity.',\n imageUrl: `${GHS_IMAGE_BASE}/silhouete.gif`,\n },\n {\n id: 'GHS09',\n title: 'GHS09 — Environment',\n description: 'Hazardous to aquatic life and the environment.',\n imageUrl: `${GHS_IMAGE_BASE}/Aquatic-pollut-red.gif`,\n },\n] as const;\n\nexport type WorkplaceSafetyGhsSymbolId = (typeof WORKPLACE_SAFETY_GHS_SYMBOL_OPTIONS)[number]['id'];\n\n//#endregion\n","/**\n * Safety & Risk capabilities used by this module.\n * Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).\n */\nexport const AXPSafetyRiskPermissionKeys = {\n Access: 'SafetyRisk:Permission:Access',\n MaintainSafety: 'SafetyRisk:Permission:MaintainSafety',\n MaintainRisk: 'SafetyRisk:Permission:MaintainRisk',\n MaintainHealth: 'SafetyRisk:Permission:MaintainHealth',\n MaintainAssessments: 'SafetyRisk:Permission:MaintainAssessments',\n Setup: 'SafetyRisk:Permission:Setup',\n} as const;\n\n/**\n * @deprecated Prefer {@link AXPSafetyRiskPermissionKeys}.\n * Legacy nested shape kept so existing imports compile during migration.\n */\nexport const AXMWorkplaceSafetyManagementPermissionKeys = {\n WorkplaceSafetyManagement: {\n Management: AXPSafetyRiskPermissionKeys.Access,\n Hazard: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n HazardRegister: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n PpeItem: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n HazardPpeRule: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n HazardRisk: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n ControlHierarchyLevels: {\n Management: AXPSafetyRiskPermissionKeys.Setup,\n },\n ControlMeasure: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n SafetyPlan: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n SafetyPlanType: {\n Management: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Management',\n View: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.View',\n Create: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Create',\n Update: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Update',\n Delete: 'WorkplaceSafetyManagement:Permission:SafetyPlanType.Delete',\n },\n SafetyPlanTypeSection: {\n Management: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Management',\n View: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.View',\n Create: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Create',\n Update: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Update',\n Delete: 'WorkplaceSafetyManagement:Permission:SafetyPlanTypeSection.Delete',\n },\n SectionType: {\n Management: AXPSafetyRiskPermissionKeys.Setup,\n View: AXPSafetyRiskPermissionKeys.Setup,\n Create: AXPSafetyRiskPermissionKeys.Setup,\n Update: AXPSafetyRiskPermissionKeys.Setup,\n Delete: AXPSafetyRiskPermissionKeys.Setup,\n },\n SafetyPlanActivity: {\n Management: AXPSafetyRiskPermissionKeys.Setup,\n View: AXPSafetyRiskPermissionKeys.Setup,\n Create: AXPSafetyRiskPermissionKeys.Setup,\n Update: AXPSafetyRiskPermissionKeys.Setup,\n Delete: AXPSafetyRiskPermissionKeys.Setup,\n },\n SafetyPlanSection: {\n Management: AXPSafetyRiskPermissionKeys.MaintainSafety,\n View: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Create: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Update: AXPSafetyRiskPermissionKeys.MaintainSafety,\n Delete: AXPSafetyRiskPermissionKeys.MaintainSafety,\n },\n },\n} as const;\n","//#region ---- Command keys ----\n\nexport const AXMWorkplaceSafetyManagementCommandKeys = {\n SafetyPlan: {\n Preview: 'WorkplaceSafetyManagement.SafetyPlan:Preview',\n Fill: 'WorkplaceSafetyManagement.SafetyPlan:Fill',\n Publish: 'WorkplaceSafetyManagement.SafetyPlan:Publish',\n ChangeType: 'WorkplaceSafetyManagement.SafetyPlan:ChangeType',\n },\n} as const;\n\n//#endregion\n","//#region ---- Menu keys ----\n\nexport const AXMWorkplaceSafetyManagementMenuKeys = {\n Root: 'WorkplaceSafetyManagement:Menu',\n SafetyPlans: 'WorkplaceSafetyManagement:Menu:SafetyPlans',\n SafetyPlanSections: 'WorkplaceSafetyManagement:Menu:SafetyPlanSections',\n SectionTypes: 'WorkplaceSafetyManagement:Menu:SectionTypes',\n WorkStepTypes: 'WorkplaceSafetyManagement:Menu:WorkStepTypes',\n SafetyPlanActivities: 'WorkplaceSafetyManagement:Menu:SafetyPlanActivities',\n SafetyPlanTypes: 'WorkplaceSafetyManagement:Menu:SafetyPlanTypes',\n SafetyPlanTypeSections: 'WorkplaceSafetyManagement:Menu:SafetyPlanTypeSections',\n Configuration: 'WorkplaceSafetyManagement:Menu:Configuration',\n} as const;\n\n//#endregion\n","const config = {\n i18n: 'workplacesafety-management',\n module: 'WorkplaceSafetyManagement',\n} as const;\n\nexport const RootConfig = {\n config,\n module: {\n name: config.module,\n title: `@${config.i18n}:module.title`,\n icon: 'fa-light fa-building-shield',\n },\n entities: {\n hazard: {\n name: 'Hazard',\n source: `${config.module}.Hazard`,\n title: `@${config.i18n}:hazards.entities.hazard.title`,\n titlePlural: `@${config.i18n}:hazards.entities.hazard.plural`,\n icon: 'fa-light fa-triangle-exclamation',\n },\n hazardRegister: {\n name: 'HazardRegister',\n source: `${config.module}.HazardRegister`,\n title: `@${config.i18n}:hazard-registers.entities.hazard-register.title`,\n titlePlural: `@${config.i18n}:hazard-registers.entities.hazard-register.plural`,\n icon: 'fa-light fa-clipboard-list',\n },\n ppeItem: {\n name: 'PpeItem',\n source: `${config.module}.PpeItem`,\n title: `@${config.i18n}:ppe-items.entities.ppe-item.title`,\n titlePlural: `@${config.i18n}:ppe-items.entities.ppe-item.plural`,\n icon: 'fa-light fa-helmet-safety',\n },\n hazardPpeRule: {\n name: 'HazardPpeRule',\n source: `${config.module}.HazardPpeRule`,\n title: `@${config.i18n}:hazard-ppe-rules.entities.hazard-ppe-rule.title`,\n titlePlural: `@${config.i18n}:hazard-ppe-rules.entities.hazard-ppe-rule.plural`,\n icon: 'fa-light fa-user-helmet-safety',\n },\n hazardRisk: {\n name: 'HazardRisk',\n source: `${config.module}.HazardRisk`,\n title: `@${config.i18n}:hazard-risks.entities.hazard-risk.title`,\n titlePlural: `@${config.i18n}:hazard-risks.entities.hazard-risk.plural`,\n icon: 'fa-light fa-shield-exclamation',\n },\n controlHierarchyLevels: {\n name: 'ControlHierarchyLevels',\n source: `${config.module}.ControlHierarchyLevels`,\n title: `@${config.i18n}:control-measure-types.entities.control-measure-type.title`,\n titlePlural: `@${config.i18n}:control-measure-types.entities.control-measure-type.plural`,\n icon: 'fa-light fa-layer-group',\n },\n controlMeasure: {\n name: 'ControlMeasure',\n source: `${config.module}.ControlMeasure`,\n title: `@${config.i18n}:control-measures.entities.control-measure.title`,\n titlePlural: `@${config.i18n}:control-measures.entities.control-measure.plural`,\n icon: 'fa-light fa-shield-check',\n },\n safetyPlan: {\n name: 'SafetyPlan',\n source: `${config.module}.SafetyPlan`,\n title: `@${config.i18n}:safety-plans.entities.safety-plan.title`,\n titlePlural: `@${config.i18n}:safety-plans.entities.safety-plan.plural`,\n icon: 'fa-light fa-file-shield',\n },\n safetyPlanType: {\n name: 'SafetyPlanType',\n source: `${config.module}.SafetyPlanType`,\n title: `@${config.i18n}:safety-plan-types.entities.safety-plan-type.title`,\n titlePlural: `@${config.i18n}:safety-plan-types.entities.safety-plan-type.plural`,\n icon: 'fa-light fa-file-lines',\n },\n safetyPlanTypeSection: {\n name: 'SafetyPlanTypeSection',\n source: `${config.module}.SafetyPlanTypeSection`,\n title: `@${config.i18n}:safety-plan-type-sections.entities.safety-plan-type-section.title`,\n titlePlural: `@${config.i18n}:safety-plan-type-sections.entities.safety-plan-type-section.plural`,\n icon: 'fa-light fa-list-ol',\n },\n sectionType: {\n name: 'SectionType',\n source: `${config.module}.SectionType`,\n title: `@${config.i18n}:section-types.entities.section-type.title`,\n titlePlural: `@${config.i18n}:section-types.entities.section-type.plural`,\n icon: 'fa-light fa-list-tree',\n },\n safetyTemplate: {\n name: 'SafetyTemplate',\n source: `${config.module}.SafetyTemplate`,\n title: `@${config.i18n}:safety-templates.entities.safety-template.title`,\n titlePlural: `@${config.i18n}:safety-templates.entities.safety-template.plural`,\n icon: 'fa-light fa-file-lines',\n },\n safetyPlanSection: {\n name: 'SafetyPlanSection',\n source: `${config.module}.SafetyPlanSection`,\n title: `@${config.i18n}:safety-plan-sections.entities.safety-plan-section.title`,\n titlePlural: `@${config.i18n}:safety-plan-sections.entities.safety-plan-section.plural`,\n icon: 'fa-light fa-list-ol',\n },\n workStepType: {\n name: 'WorkStepType',\n source: `${config.module}.WorkStepType`,\n title: `@${config.i18n}:work-step-types.entities.work-step-type.title`,\n titlePlural: `@${config.i18n}:work-step-types.entities.work-step-type.plural`,\n icon: 'fa-light fa-list-tree',\n },\n safetyPlanActivity: {\n name: 'SafetyPlanActivity',\n source: `${config.module}.SafetyPlanActivity`,\n title: `@${config.i18n}:safety-plan-activities.entities.safety-plan-activity.title`,\n titlePlural: `@${config.i18n}:safety-plan-activities.entities.safety-plan-activity.plural`,\n icon: 'fa-light fa-list-check',\n },\n },\n queries: {\n dashboard: {\n openHazardsKpi: `${config.module}:Dashboard:OpenHazardsKpi`,\n highRisksKpi: `${config.module}:Dashboard:HighRisksKpi`,\n activeSafetyPlansKpi: `${config.module}:Dashboard:ActiveSafetyPlansKpi`,\n take5ChecklistsKpi: `${config.module}:Dashboard:Take5ChecklistsKpi`,\n take5CompletedKpi: `${config.module}:Dashboard:Take5CompletedKpi`,\n hazardsByCategoryDonut: `${config.module}:Dashboard:HazardsByCategoryDonut`,\n risksByRatingBar: `${config.module}:Dashboard:RisksByRatingBar`,\n plansByTypeBar: `${config.module}:Dashboard:PlansByTypeBar`,\n hazardsByStatusBar: `${config.module}:Dashboard:HazardsByStatusBar`,\n ppeCoverageDonut: `${config.module}:Dashboard:PpeCoverageDonut`,\n },\n },\n};\n","\nimport { AXPModuleManifest } from '@acorex-platform/framework-shared/core';\nimport { RootConfig } from './root-config';\n\nexport const WorkplaceSafetyManagementManifest: AXPModuleManifest = {\n name: RootConfig.module.name,\n version: '1.0.0',\n title: RootConfig.module.title,\n icon: RootConfig.module.icon,\n i18n: RootConfig.config.i18n,\n type: 'domain',\n domain: 'workplace-safety',\n};\n","import { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Enums ----\n\nexport enum AXMHazardPpeRuleRequirementType {\n Required = 'required',\n Recommended = 'recommended',\n Conditional = 'conditional',\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementHazardPpeRuleEntityModel extends AXPEntityModel<string> {\n code: string;\n hazardId: string;\n hazard?: { id: string; title?: string; code?: string };\n ppeItemId: string;\n ppeItem?: { id: string; title?: string; code?: string };\n requirementType: AXMHazardPpeRuleRequirementType;\n conditionNote?: string;\n usageInstruction?: string;\n sortOrder?: number;\n status?: AXPSystemStatusType.Active | AXPSystemStatusType.Inactive;\n}\n\n//#endregion\n","//#region ---- Hazard PPE requirement type options ----\n\nimport { AXMHazardPpeRuleRequirementType } from './hazard-ppe-rule.types';\n\nexport const WORKPLACE_SAFETY_HAZARD_PPE_RULE_REQUIREMENT_TYPE_OPTIONS = [\n {\n id: AXMHazardPpeRuleRequirementType.Required,\n title: '@workplacesafety-management:hazard-ppe-rules.entities.hazard-ppe-rule.fields.requirement-type.options.required',\n },\n {\n id: AXMHazardPpeRuleRequirementType.Recommended,\n title: '@workplacesafety-management:hazard-ppe-rules.entities.hazard-ppe-rule.fields.requirement-type.options.recommended',\n },\n {\n id: AXMHazardPpeRuleRequirementType.Conditional,\n title: '@workplacesafety-management:hazard-ppe-rules.entities.hazard-ppe-rule.fields.requirement-type.options.conditional',\n },\n] as const;\n\n//#endregion\n","/** Risk matrix entity key in the risk-management module. */\nexport const RISK_MANAGEMENT_RISK_MATRIX_ENTITY = 'RiskManagement.RiskMatrix';\n\n/** Hazard catalog scope for risk matrix lookup filtering. */\nexport const RISK_MANAGEMENT_HAZARD_CATALOG_SCOPE = 'risk-management.hazard';\n","//#region ---- Safety template type options ----\n\ntype AXMSafetyTemplateType = 'SWMS' | 'JSA' | 'Forms' | 'Permits' | 'Plans';\n\nexport const WORKPLACE_SAFETY_TEMPLATE_TYPE_OPTIONS: ReadonlyArray<{\n id: AXMSafetyTemplateType;\n title: string;\n}> = [\n {\n id: 'SWMS',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.swms',\n },\n {\n id: 'JSA',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.jsa',\n },\n {\n id: 'Forms',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.forms',\n },\n {\n id: 'Permits',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.permits',\n },\n {\n id: 'Plans',\n title: '@workplacesafety-management:safety-templates.entities.safety-template.fields.template-type.options.plans',\n },\n] as const;\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type {\n AXMSectionTypeCode,\n AXMSectionTypeSnapshot,\n} from './entities/section-type/section-type.types';\n\nimport { RISK_MANAGEMENT_RISK_MATRIX_ENTITY } from './risk-management.integration';\nimport { RootConfig } from './root-config';\n\n//#endregion\n\n//#region ---- Built-in section type IDs ----\n\n/** Stable IDs for seeded built-in section types (shared by server mocks and client lookups). */\n\nexport const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS = {\n hazard: 'c1d2e3f4-a5b6-4789-c001-000000000001',\n\n hazardRisk: 'c1d2e3f4-a5b6-4789-c001-000000000002',\n\n ppe: 'c1d2e3f4-a5b6-4789-c001-000000000003',\n\n control: 'c1d2e3f4-a5b6-4789-c001-000000000004',\n\n hierarchyLevel: 'c1d2e3f4-a5b6-4789-c001-000000000005',\n\n custom: 'c1d2e3f4-a5b6-4789-c001-000000000006',\n\n ppeHazards: 'c1d2e3f4-a5b6-4789-c001-000000000007',\n\n riskMatrix: 'c1d2e3f4-a5b6-4789-c001-000000000008',\n\n hazardRiskPpe: 'c1d2e3f4-a5b6-4789-c001-000000000009',\n\n activity: 'c1d2e3f4-a5b6-4789-c001-00000000000a',\n} as const;\n\nexport interface AXMBuiltInSectionTypeMeta {\n sectionTypeKey: AXMSectionTypeCode;\n\n itemEntityName?: string;\n\n /** When true, a safety plan may include this section type more than once. */\n isRepeatable?: boolean;\n}\n\nconst moduleName = RootConfig.module.name;\n\n/** Maps section type codes to the entity that supplies selectable items. */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE: Readonly<\n Record<AXMSectionTypeCode, string | undefined>\n> = {\n Hazard: `${moduleName}.${RootConfig.entities.hazard.name}`,\n\n HazardRisk: `${moduleName}.${RootConfig.entities.hazardRisk.name}`,\n\n Ppe: `${moduleName}.${RootConfig.entities.ppeItem.name}`,\n\n PpeHazards: `${moduleName}.${RootConfig.entities.hazardPpeRule.name}`,\n\n HazardRiskPpe: undefined,\n\n Control: `${moduleName}.${RootConfig.entities.controlMeasure.name}`,\n\n HierarchyLevel: `${moduleName}.${RootConfig.entities.controlHierarchyLevels.name}`,\n\n RiskMatrix: RISK_MANAGEMENT_RISK_MATRIX_ENTITY,\n\n Custom: undefined,\n\n /** Host section for Activity rows (managed by the section builder, not a catalog picker). */\n Activity: undefined,\n};\n\n/** Built-in section types resolved by stable section type id. */\n\nexport const WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID: Readonly<\n Record<string, AXMBuiltInSectionTypeMeta>\n> = {\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazard]: {\n sectionTypeKey: 'Hazard',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Hazard,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRisk]: {\n sectionTypeKey: 'HazardRisk',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HazardRisk,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppe]: {\n sectionTypeKey: 'Ppe',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Ppe,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards]: {\n sectionTypeKey: 'PpeHazards',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.PpeHazards,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe]: {\n sectionTypeKey: 'HazardRiskPpe',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HazardRiskPpe,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.control]: {\n sectionTypeKey: 'Control',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Control,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hierarchyLevel]: {\n sectionTypeKey: 'HierarchyLevel',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.HierarchyLevel,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix]: {\n sectionTypeKey: 'RiskMatrix',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.RiskMatrix,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.custom]: {\n sectionTypeKey: 'Custom',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Custom,\n\n isRepeatable: true,\n },\n\n [WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.activity]: {\n sectionTypeKey: 'Activity',\n\n itemEntityName: WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE.Activity,\n\n isRepeatable: true,\n },\n};\n\n/** Default entity so the lookup widget mounts before a section type is chosen. */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK = `${moduleName}.${RootConfig.entities.hazard.name}`;\n\n//#endregion\n\n//#region ---- Snapshot helpers ----\n\nexport function resolveSectionTypeKey(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): AXMSectionTypeCode | undefined {\n const fromSnapshot = snapshot?.sectionTypeKey;\n\n if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {\n return fromSnapshot as AXMSectionTypeCode;\n }\n\n if (!sectionTypeId) {\n return undefined;\n }\n\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]\n ?.sectionTypeKey;\n}\n\n/**\n * Human-readable titles for built-in section type keys (matches seeded SectionType titles).\n * Used when snapshots lack `title` (common after id-only enrichment).\n */\nconst SECTION_TYPE_KEY_DISPLAY_TITLES: Readonly<Record<AXMSectionTypeCode, string>> = {\n Hazard: 'Hazard',\n HazardRisk: 'Hazard Risk',\n Ppe: 'PPE',\n PpeHazards: 'Hazard PPE Items',\n HazardRiskPpe: 'Hazard Risk PPE',\n Control: 'Control',\n HierarchyLevel: 'Hierarchy Level',\n RiskMatrix: 'Risk Matrix',\n Custom: 'Custom',\n Activity: 'Activity',\n};\n\n/** Formats a section type key for display (e.g. `HierarchyLevel` → `Hierarchy Level`). */\nexport function formatSectionTypeKeyAsTitle(key: string | undefined | null): string {\n if (!key) {\n return '';\n }\n const known = SECTION_TYPE_KEY_DISPLAY_TITLES[key as AXMSectionTypeCode];\n if (known) {\n return known;\n }\n return key.replace(/([a-z\\d])([A-Z])/g, '$1 $2').trim();\n}\n\n/**\n * Resolves a section type label for UI/preview: snapshot title → key display title → spaced code.\n */\nexport function resolveSectionTypeDisplayTitle(\n sectionTypeId?: string,\n snapshot?: AXMSectionTypeSnapshot | null,\n): string {\n if (typeof snapshot?.title === 'string' && snapshot.title.trim()) {\n return snapshot.title.trim();\n }\n const key = resolveSectionTypeKey(sectionTypeId, snapshot ?? undefined);\n const fromKey = formatSectionTypeKeyAsTitle(key);\n if (fromKey) {\n return fromKey;\n }\n if (typeof snapshot?.code === 'string' && snapshot.code.trim()) {\n return formatSectionTypeKeyAsTitle(snapshot.code.trim()) || snapshot.code.trim();\n }\n return '';\n}\n\nexport function resolveSectionItemEntityName(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): string | undefined {\n const fromSnapshot = snapshot?.itemEntityName;\n\n if (typeof fromSnapshot === 'string' && fromSnapshot.length > 0) {\n return fromSnapshot;\n }\n\n if (!sectionTypeId) {\n return undefined;\n }\n\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]\n ?.itemEntityName;\n}\n\n/** Adds runtime lookup metadata (`sectionTypeKey`, `itemEntityName`) from built-in id map. */\n\nexport function enrichSectionTypeSnapshot(\n sectionTypeId: string | undefined,\n\n snapshot?: AXMSectionTypeSnapshot,\n): AXMSectionTypeSnapshot | undefined {\n if (!sectionTypeId) {\n return snapshot;\n }\n\n return {\n ...snapshot,\n\n id: sectionTypeId,\n\n sectionTypeKey: resolveSectionTypeKey(sectionTypeId, snapshot),\n\n itemEntityName: resolveSectionItemEntityName(sectionTypeId, snapshot),\n\n isRepeatable:\n snapshot?.isRepeatable ??\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]?.isRepeatable,\n };\n}\n\n//#endregion\n\n//#region ---- Dynamic entity expressions ----\n\nfunction buildSectionTypeEntityExpressionById(\n sectionTypeIdPath: string,\n): string {\n const parts = Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID)\n\n .filter(([, meta]) => meta.itemEntityName)\n\n .map(\n ([id, meta]) =>\n `context.eval('${sectionTypeIdPath}') === '${id}' ? '${meta.itemEntityName}'`,\n );\n\n return `{{ ${parts.join(' : ')} : '${WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK}' }}`;\n}\n\nfunction buildSectionTypeEntityExpressionWithSnapshotFallback(\n sectionTypeIdPath: string,\n itemEntityNamePath: string,\n): string {\n const byId = buildSectionTypeEntityExpressionById(sectionTypeIdPath).slice(3, -2);\n return `{{ context.eval('${itemEntityNamePath}') || (${byId}) }}`;\n}\n\n/**\n * For repeater / nested FormField widgets — `>` walks up to the row where `sectionType` is exposed.\n */\n\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION =\n buildSectionTypeEntityExpressionWithSnapshotFallback(\n '>sectionType.id',\n\n '>sectionType.itemEntityName',\n );\n\n/**\n * Entity expression keyed by the bound `sectionTypeId` field (repeater-safe).\n * Prefer this when expose snapshots may not live on the same path the lookup evaluates.\n */\nexport function buildWorkplaceSafetySectionTypeEntityExpression(sectionTypeIdPath: string): string {\n return buildSectionTypeEntityExpressionById(sectionTypeIdPath);\n}\n\n/**\n * For flat dialog / dynamic forms — sibling fields share the same context (no parent path).\n */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION_SIBLING =\n buildSectionTypeEntityExpressionWithSnapshotFallback(\n 'sectionType.id',\n 'sectionType.itemEntityName',\n );\n\n//#endregion\n","/**\n * Shared helpers for Safety Plan Section type identity (repeatable vs one-off).\n * Leaf module — imports only other contract leaves (no client/server layers).\n */\n\nimport { WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID } from './section-type-entity-map';\n\n//#region ---- Helpers ----\n\nfunction resolveRefId(raw: unknown): string {\n if (typeof raw === 'string' && raw.trim().length > 0) {\n return raw.trim();\n }\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n return String(raw);\n }\n if (raw && typeof raw === 'object') {\n const id = (raw as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return '';\n}\n\n/**\n * True when this section type may appear more than once in a Safety Plan.\n * Checks (in order): snapshot flag, explicit allow-list, built-in section type meta.\n */\nexport function isSafetyPlanSectionTypeRepeatable(\n sectionTypeId: string,\n options?: {\n repeatableSectionTypeIds?: readonly string[];\n sectionType?: { isRepeatable?: boolean };\n },\n): boolean {\n const id = resolveRefId(sectionTypeId);\n if (!id) {\n return false;\n }\n if (options?.sectionType?.isRepeatable === true) {\n return true;\n }\n const allowList = new Set(\n (options?.repeatableSectionTypeIds ?? []).map((entry) => resolveRefId(entry)).filter(Boolean),\n );\n if (allowList.has(id)) {\n return true;\n }\n return WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[id]?.isRepeatable === true;\n}\n\n/** Built-in section type ids that are always treated as repeatable. */\nexport function collectBuiltInRepeatableSectionTypeIds(): string[] {\n return Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID)\n .filter(([, meta]) => meta.isRepeatable === true)\n .map(([id]) => id);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { createRandomUuid } from '@acorex-platform/framework-shared/core';\nimport type {\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport type {\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel,\n AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel,\n} from './entities/safety-plan-type-section/safety-plan-type-section.types';\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport { WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID } from './section-type-entity-map';\nimport { isSafetyPlanSectionTypeRepeatable } from './safety-plan-section-unique-type.util';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface AXMSafetyPlanSectionStructureItem {\n id: string;\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n title: string;\n description?: string;\n /** Links the plan section back to the type template it was created from. */\n sourceSafetyPlanTypeSectionId?: string;\n /** Display / persistence order (1-based). */\n sortOrder: number;\n /** True when sourced from an `isDefault` type section — must remain on the plan. */\n required?: boolean;\n items: Array<{\n id: string;\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n }>;\n safetyPlanId?: string;\n code?: string;\n}\n\nexport interface AXMSafetyPlanSectionStructureValue {\n sections: AXMSafetyPlanSectionStructureItem[];\n}\n\nexport interface AXMSafetyPlanSectionStructureValidationContext {\n /** Section type ids allowed for this plan type (from its type-section config). */\n allowedSectionTypeIds: readonly string[];\n /** Source type-section ids that must remain present. */\n requiredSourceTypeSectionIds: readonly string[];\n /** Section type ids that may appear more than once on a plan. */\n repeatableSectionTypeIds?: readonly string[];\n}\n\nexport type AXMSafetyPlanSectionStructureValidationIssueCode =\n | 'REQUIRED_SECTION_MISSING'\n | 'SECTION_TYPE_NOT_ALLOWED'\n | 'INVALID_TYPE_SECTION_TEMPLATE'\n | 'INVALID_SORT_ORDER';\n\nexport interface AXMSafetyPlanSectionStructureValidationIssue {\n code: AXMSafetyPlanSectionStructureValidationIssueCode;\n messageKey: string;\n details?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Display helpers ----\n\n/** Coerces a stored string or locale map into a single display string. */\nexport function asSafetyPlanDisplayText(value: unknown): string {\n if (typeof value === 'string') {\n return value.trim();\n }\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const rec = value as Record<string, unknown>;\n for (const locale of ['en-US', 'en-AU', 'en', 'fa-IR']) {\n const part = rec[locale];\n if (typeof part === 'string' && part.trim()) {\n return part.trim();\n }\n }\n for (const part of Object.values(rec)) {\n if (typeof part === 'string' && part.trim()) {\n return part.trim();\n }\n }\n }\n return '';\n}\n\nexport function buildSectionTypeRelationSnapshot(\n sectionTypeId: string,\n snapshot?: {\n title?: unknown;\n code?: unknown;\n description?: unknown;\n isRepeatable?: unknown;\n } | null,\n): AXMSectionTypeSnapshot {\n const title = asSafetyPlanDisplayText(snapshot?.title);\n const code = asSafetyPlanDisplayText(snapshot?.code);\n const description = asSafetyPlanDisplayText(snapshot?.description);\n return {\n id: sectionTypeId,\n ...(title ? { title } : {}),\n ...(code ? { code } : {}),\n ...(description ? { description } : {}),\n ...(snapshot?.isRepeatable === true ? { isRepeatable: true } : {}),\n };\n}\n\nfunction resolveSectionTypeTitle(\n sectionTypeId: string,\n sectionType?: { title?: unknown; code?: unknown } | null,\n): string {\n const title = asSafetyPlanDisplayText(sectionType?.title);\n if (title) {\n return title;\n }\n const code = asSafetyPlanDisplayText(sectionType?.code);\n if (code) {\n return code;\n }\n const builtIn = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID[sectionTypeId]?.sectionTypeKey;\n if (builtIn) {\n return builtIn;\n }\n return sectionTypeId;\n}\n\n/**\n * Title persisted on SafetyPlanSection. Never stores a bare UUID — the UI translate\n * pipe treats unknown keys as empty, which made seeded section headers blank.\n */\nexport function resolveSafetyPlanSectionPersistedTitle(\n sectionTitle: unknown,\n sectionTypeId: string,\n snapshot?: { title?: unknown; code?: unknown } | null,\n): string {\n const explicit = asSafetyPlanDisplayText(sectionTitle);\n if (explicit && explicit !== sectionTypeId) {\n return explicit;\n }\n const fromType = resolveSectionTypeTitle(sectionTypeId, snapshot);\n if (fromType && fromType !== sectionTypeId) {\n return fromType;\n }\n return 'Section';\n}\n\n//#endregion\n\n//#region ---- Ref helpers ----\n\n/** True when a type-section row is marked as the plan-type default template. */\nexport function isSafetyPlanTypeSectionDefault(row: { isDefault?: unknown } | null | undefined): boolean {\n const value = row?.isDefault;\n return value === true || value === 1 || value === 'true';\n}\n\n/**\n * Returns the default Safety Plan Type Section (structure) for a plan type.\n * Prefers `isDefault: true`; otherwise the first active row by sortOrder/title.\n */\nexport function resolveDefaultSafetyPlanTypeSection(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel | null {\n const active = typeSections\n .filter((row) => row && row.isArchived !== true)\n .slice()\n .sort(\n (a, b) =>\n (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.title ?? '').localeCompare(String(b.title ?? '')),\n );\n if (!active.length) {\n return null;\n }\n return active.find((row) => isSafetyPlanTypeSectionDefault(row)) ?? active[0] ?? null;\n}\n\n/**\n * Narrows type-section rows to the selected structure when `structureId` is set.\n * Falls back to all active rows (caller / build still applies isDefault rules).\n */\nexport function pickSafetyPlanTypeSectionsForStructure(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n structureId?: string | null,\n): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[] {\n const active = typeSections.filter((row) => row && row.isArchived !== true);\n const id = typeof structureId === 'string' ? structureId.trim() : '';\n if (!id) {\n return active;\n }\n const selected = active.filter((row) => resolveEntityRefId(row.id) === id);\n return selected.length ? selected : active;\n}\n\n/** Extracts a stable entity id from a raw lookup / context value. */\nexport function resolveEntityRefId(raw: unknown): string | null {\n if (typeof raw === 'string' && raw.trim().length > 0) {\n return raw.trim();\n }\n if (typeof raw === 'number' && Number.isFinite(raw)) {\n return String(raw);\n }\n if (raw && typeof raw === 'object') {\n const id = (raw as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return null;\n}\n\nfunction resolveSectionTypeId(\n typeRow: AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel | null | undefined,\n): string {\n if (!typeRow) {\n return '';\n }\n return (\n resolveEntityRefId(typeRow.sectionTypeId) ??\n resolveEntityRefId(typeRow.sectionType) ??\n resolveEntityRefId(typeRow.sectionType?.id) ??\n ''\n );\n}\n\n//#endregion\n\n//#region ---- Build from type sections ----\n\nlet structureIdSeq = 0;\nfunction nextStructureId(prefix: string): string {\n structureIdSeq += 1;\n const rand = createRandomUuid();\n return prefix ? `${prefix}-${rand}` : rand;\n}\n\n/**\n * Builds an empty editable section structure from SafetyPlanTypeSection rows for one plan type.\n *\n * Uses `isDefault` rows when present; otherwise falls back to all active rows for that type\n * (so a mis-flagged template still produces a structure). One plan section per `sectionTypeIds`\n * entry, titled from the Section Type, ordered by type-section `sortOrder` then repeater order.\n */\nexport function buildSectionStructureFromTypeSections(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n options?: { createId?: () => string },\n): AXMSafetyPlanSectionStructureValue {\n const createId = options?.createId ?? (() => nextStructureId(''));\n const active = typeSections\n .filter((row) => row && row.isArchived !== true)\n .slice()\n .sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.title ?? '').localeCompare(String(b.title ?? '')));\n\n const defaults = active.filter((row) => isSafetyPlanTypeSectionDefault(row));\n const sourceRows = defaults.length > 0 ? defaults : active;\n\n const sections: AXMSafetyPlanSectionStructureItem[] = [];\n const seenSourceTypePairs = new Set<string>();\n let sortOrder = 1;\n\n for (const typeSection of sourceRows) {\n const typeRows = Array.isArray(typeSection.sectionTypeIds) ? typeSection.sectionTypeIds : [];\n if (!typeRows.length) {\n continue;\n }\n\n for (const typeRow of typeRows) {\n const sectionTypeId = resolveSectionTypeId(typeRow);\n if (!sectionTypeId) {\n continue;\n }\n\n // One plan section per (type-section source, section type) — prevents\n // accidental double expansion when the same type is listed twice.\n const sourceId = typeof typeSection.id === 'string' ? typeSection.id : '';\n const pairKey = sourceId ? `${sourceId}|${sectionTypeId}` : sectionTypeId;\n if (seenSourceTypePairs.has(pairKey)) {\n continue;\n }\n seenSourceTypePairs.add(pairKey);\n\n const sectionType = buildSectionTypeRelationSnapshot(sectionTypeId, typeRow.sectionType);\n const sectionId = createId();\n sections.push({\n id: sectionId,\n sectionTypeId,\n sectionType,\n title: resolveSafetyPlanSectionPersistedTitle(undefined, sectionTypeId, sectionType),\n description: asSafetyPlanDisplayText(sectionType.description),\n sourceSafetyPlanTypeSectionId: typeSection.id,\n sortOrder: sortOrder++,\n required: isSafetyPlanTypeSectionDefault(typeSection) || defaults.length === 0,\n items: [\n {\n id: `${sectionId}__item_1`,\n itemIds: [],\n items: [],\n },\n ],\n });\n }\n }\n\n return { sections };\n}\n\n/**\n * Removes accidental ghost rows from double materialization of the same type-section\n * source. Distinct sections of the same type are kept. Reassigns contiguous 1-based\n * `sortOrder` to preserve display order.\n */\nexport function dedupeSafetyPlanSectionStructure<\n T extends AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue,\n>(\n structure: T,\n _options?: { repeatableSectionTypeIds?: readonly string[] },\n): T {\n type Section = AXMSafetyPlanSectionStructureItem | AXMSafetyPlanSectionBuilderSectionValue;\n\n const sections: readonly Section[] = Array.isArray(structure?.sections)\n ? (structure.sections as readonly Section[])\n : [];\n const seenSourceTypePairs = new Set<string>();\n const deduped: Section[] = [];\n\n for (const section of sections) {\n const sectionTypeId = resolveEntityRefId(section.sectionTypeId) ?? String(section.sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n continue;\n }\n\n const sourceId = String(section.sourceSafetyPlanTypeSectionId ?? '').trim();\n const sourcePairKey = sourceId ? `${sourceId}|${sectionTypeId}` : '';\n\n // Same type-section source + section type must never appear twice (double materialization).\n if (sourcePairKey && seenSourceTypePairs.has(sourcePairKey)) {\n continue;\n }\n\n if (sourcePairKey) {\n seenSourceTypePairs.add(sourcePairKey);\n }\n deduped.push(section);\n }\n\n return {\n ...structure,\n sections: deduped.map((section, index) => ({\n ...section,\n sortOrder: index + 1,\n })),\n } as T;\n}\n\nexport function collectAllowedSectionTypeIds(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n): string[] {\n const ids = new Set<string>();\n for (const typeSection of typeSections) {\n if (typeSection.isArchived === true) {\n continue;\n }\n for (const row of typeSection.sectionTypeIds ?? []) {\n const id = resolveSectionTypeId(row);\n if (id) {\n ids.add(id);\n }\n }\n }\n return [...ids];\n}\n\nexport function collectRequiredSourceTypeSectionIds(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n options?: { structureId?: string | null },\n): string[] {\n const structureId =\n typeof options?.structureId === 'string' && options.structureId.trim()\n ? options.structureId.trim()\n : '';\n if (structureId) {\n const selected = typeSections.find(\n (row) => row.isArchived !== true && resolveEntityRefId(row.id) === structureId,\n );\n return selected?.id && typeof selected.id === 'string' ? [selected.id] : [structureId];\n }\n\n return typeSections\n .filter((row) => row.isArchived !== true && isSafetyPlanTypeSectionDefault(row))\n .map((row) => row.id)\n .filter((id): id is string => typeof id === 'string' && id.length > 0);\n}\n\n/**\n * Validates that a plan-type section template does not list the same\n * non-repeatable section type more than once (across rows and within a single row's repeater).\n */\nexport function validateSafetyPlanTypeSectionTemplate(\n typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[],\n repeatableSectionTypeIds: readonly string[] = [],\n): AXMSafetyPlanSectionStructureValidationIssue[] {\n const seen = new Map<string, { title: string; sourceSafetyPlanTypeSectionId?: string }>();\n const issues: AXMSafetyPlanSectionStructureValidationIssue[] = [];\n\n for (const typeSection of typeSections) {\n if (typeSection.isArchived === true) {\n continue;\n }\n for (const row of typeSection.sectionTypeIds ?? []) {\n const sectionTypeId = resolveSectionTypeId(row);\n if (\n !sectionTypeId ||\n isSafetyPlanSectionTypeRepeatable(sectionTypeId, {\n repeatableSectionTypeIds,\n sectionType: row.sectionType as { isRepeatable?: boolean } | undefined,\n })\n ) {\n continue;\n }\n const sectionTypeTitle = resolveSafetyPlanSectionPersistedTitle(\n undefined,\n sectionTypeId,\n row.sectionType,\n );\n if (seen.has(sectionTypeId)) {\n issues.push({\n code: 'INVALID_TYPE_SECTION_TEMPLATE',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.invalid-type-template-duplicate',\n details: {\n sectionTypeId,\n sectionTypeTitle,\n sourceSafetyPlanTypeSectionId: typeSection.id,\n previousSourceSafetyPlanTypeSectionId: seen.get(sectionTypeId)?.sourceSafetyPlanTypeSectionId,\n },\n });\n continue;\n }\n seen.set(sectionTypeId, {\n title: sectionTypeTitle,\n sourceSafetyPlanTypeSectionId: typeSection.id,\n });\n }\n }\n\n return issues;\n}\n\n//#endregion\n\n//#region ---- Validation ----\n\nexport function validateSafetyPlanSectionStructure(\n structure: AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue | null | undefined,\n context: AXMSafetyPlanSectionStructureValidationContext,\n): AXMSafetyPlanSectionStructureValidationIssue[] {\n const sections = Array.isArray(structure?.sections) ? structure!.sections : [];\n const issues: AXMSafetyPlanSectionStructureValidationIssue[] = [];\n\n const presentSourceIds = new Set(\n sections\n .map((s) => (s as AXMSafetyPlanSectionStructureItem).sourceSafetyPlanTypeSectionId)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n );\n\n for (const requiredSourceId of context.requiredSourceTypeSectionIds) {\n if (!presentSourceIds.has(requiredSourceId)) {\n issues.push({\n code: 'REQUIRED_SECTION_MISSING',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.required-section-missing',\n details: { sourceSafetyPlanTypeSectionId: requiredSourceId },\n });\n }\n }\n\n const allowed = new Set(context.allowedSectionTypeIds);\n\n const sortOrders: number[] = [];\n for (const section of sections) {\n const sectionTypeId =\n resolveEntityRefId((section as { sectionTypeId?: unknown }).sectionTypeId) ??\n String((section as { sectionTypeId?: string }).sectionTypeId ?? '').trim();\n if (!sectionTypeId) {\n continue;\n }\n\n const sectionType = (section as { sectionType?: { title?: string; code?: string; isRepeatable?: boolean } })\n .sectionType;\n const sectionTypeTitle = resolveSafetyPlanSectionPersistedTitle(\n undefined,\n sectionTypeId,\n sectionType,\n );\n\n if (allowed.size > 0 && !allowed.has(sectionTypeId)) {\n issues.push({\n code: 'SECTION_TYPE_NOT_ALLOWED',\n messageKey:\n '@workplacesafety-management:safety-plans.messages.section-structure.section-type-not-allowed',\n details: { sectionTypeId, sectionTypeTitle, sectionId: (section as { id?: string }).id },\n });\n }\n\n const sortOrder = (section as AXMSafetyPlanSectionStructureItem).sortOrder;\n if (typeof sortOrder === 'number' && Number.isFinite(sortOrder)) {\n sortOrders.push(sortOrder);\n }\n }\n\n if (sortOrders.length !== sections.length) {\n issues.push({\n code: 'INVALID_SORT_ORDER',\n messageKey: '@workplacesafety-management:safety-plans.messages.section-structure.invalid-sort-order',\n });\n } else {\n const unique = new Set(sortOrders);\n if (unique.size !== sortOrders.length) {\n issues.push({\n code: 'INVALID_SORT_ORDER',\n messageKey: '@workplacesafety-management:safety-plans.messages.section-structure.invalid-sort-order',\n details: { reason: 'duplicate' },\n });\n }\n }\n\n return issues;\n}\n\nexport function toBuilderValueFromStructure(\n structure: AXMSafetyPlanSectionStructureValue,\n): AXMSafetyPlanSectionBuilderValue {\n return {\n sections: structure.sections.map((section) => ({\n id: section.id,\n sectionTypeId: section.sectionTypeId,\n sectionType: section.sectionType,\n title: section.title,\n description: section.description ?? '',\n safetyPlanId: section.safetyPlanId,\n code: section.code,\n sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,\n sortOrder: section.sortOrder,\n required: section.required,\n items: section.items.map((item) => ({\n id: item.id,\n itemIds: [...(item.itemIds ?? [])],\n items: item.items ? [...item.items] : [],\n })),\n })),\n };\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXMSectionTypeCode, AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type {\n AXMSafetyPlanSectionBuilderItemValue,\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n} from './safety-plan-section-builder.types';\nimport {\n resolveSectionItemEntityName,\n resolveSectionTypeKey,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS,\n} from './section-type-entity-map';\nimport { asSafetyPlanDisplayText } from './safety-plan-section-structure.util';\n\n//#endregion\n\n//#region ---- Dependency config ----\n\n/** Parent section type whose selected item IDs constrain the child lookup. */\nexport interface AXMSectionTypeParentFilterDependency {\n kind: 'parentFilter';\n parentSectionTypeKey: AXMSectionTypeCode;\n /** Field on the child lookup entity used for filtering (e.g. `hazardId`). */\n filterField: string;\n}\n\n/** Child lookup is filtered by IDs derived from parent entity records (e.g. `riskMatrixId` on HazardRisk). */\nexport interface AXMSectionTypeDerivedFilterDependency {\n kind: 'derivedFromParent';\n parentSectionTypeKey: AXMSectionTypeCode;\n /** Field path on the parent entity record used to resolve filter values. */\n resolveField: 'riskMatrixId';\n /** Field on the child lookup entity (typically `id`). */\n filterField: string;\n}\n\nexport type AXMSectionTypeDependency =\n | AXMSectionTypeParentFilterDependency\n | AXMSectionTypeDerivedFilterDependency;\n\n/** Declarative section-type dependencies resolved from prior sections in plan order. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES: Partial<\n Record<AXMSectionTypeCode, AXMSectionTypeDependency>\n> = {\n HazardRisk: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'Hazard',\n filterField: 'hazardId',\n },\n PpeHazards: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'Hazard',\n filterField: 'hazardId',\n },\n HazardRiskPpe: {\n kind: 'parentFilter',\n parentSectionTypeKey: 'HazardRisk',\n filterField: 'hazardRiskId',\n },\n RiskMatrix: {\n kind: 'derivedFromParent',\n parentSectionTypeKey: 'HazardRisk',\n resolveField: 'riskMatrixId',\n filterField: 'id',\n },\n};\n\n/** Section types cleared when upstream hazard selections change. */\nexport const WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD: readonly AXMSectionTypeCode[] = [\n 'HazardRisk',\n 'PpeHazards',\n 'HazardRiskPpe',\n 'RiskMatrix',\n];\n\n/** Section types cleared when upstream hazard-risk selections change. */\nexport const WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK: readonly AXMSectionTypeCode[] = [\n 'HazardRiskPpe',\n 'RiskMatrix',\n];\n\nexport type AXMHazardRiskRecordLoader = (hazardRiskIds: string[]) => Promise<Record<string, unknown>[]>;\n\n//#endregion\n\n//#region ---- Lookup helpers ----\n\nexport const PARENT_HAZARD_IDS_CONTEXT_KEY = 'parentHazardIds';\n\nexport const PARENT_HAZARD_RISK_IDS_CONTEXT_KEY = 'parentHazardRiskIds';\n\n/** Expose paths when a section type is selected (shared by entity repeater and builder dialog). */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE = [\n { source: 'id', target: 'sectionType.id' },\n { source: 'title', target: 'sectionType.title' },\n { source: 'code', target: 'sectionType.code' },\n { source: 'description', target: 'sectionType.description' },\n { source: 'isRepeatable', target: 'sectionType.isRepeatable' },\n];\n\n/** Auto-fill section description when section type is selected. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS = [\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action:\n \"{{ const items = widget.output('selectedItems'); const selectedDescription = Array.isArray(items) ? items[0]?.description : undefined; const d = selectedDescription || context.eval('sectionType.description') || ''; context.set('sectionTypeDescription', d); const descriptionWidget = widget.find('sectionTypeDescription'); if (descriptionWidget) { descriptionWidget.setValue(d); } }}\",\n },\n {\n event: \"{{ events.context('sectionType.description') }}\",\n action:\n \"{{ const d = context.eval('sectionType.description') || ''; context.set('sectionTypeDescription', d); const descriptionWidget = widget.find('sectionTypeDescription'); if (descriptionWidget) { descriptionWidget.setValue(d); } }}\",\n },\n];\n\n/** Auto-fill section title when section type is selected. */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS = [\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action:\n \"{{ const items = widget.output('selectedItems'); const selectedTitle = Array.isArray(items) ? items[0]?.title : undefined; const t = selectedTitle || context.eval('sectionType.title') || ''; if (t) { context.set('title', t); const titleWidget = widget.find('title'); if (titleWidget) { titleWidget.setValue(t); } } }}\",\n },\n {\n event: \"{{ events.context('sectionType.title') }}\",\n action:\n \"{{ const t = context.eval('sectionType.title') || ''; if (t) { context.set('title', t); const titleWidget = widget.find('title'); if (titleWidget) { titleWidget.setValue(t); } } }}\",\n },\n];\n\n/** Shared lookup widget options for section type pickers (builder dialog and entity forms). */\nexport const WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS: Record<string, unknown> = {\n look: 'select',\n allowSearch: true,\n textField: 'code',\n textTemplate: '{code} — {description}',\n valueField: 'id',\n columns: ['code', 'title', 'description'],\n expose: WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE,\n triggers: [\n ...WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS,\n ...WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS,\n ],\n};\n\n//#endregion\n\n//#region ---- Resolver API ----\n\nexport function getSectionTypeDependency(\n sectionTypeKey: string | undefined,\n): AXMSectionTypeDependency | undefined {\n if (!sectionTypeKey) {\n return undefined;\n }\n return WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES[sectionTypeKey as AXMSectionTypeCode];\n}\n\nexport function sectionTypeKeyFromSection(\n section: Pick<AXMSafetyPlanSectionBuilderSectionValue, 'sectionType' | 'sectionTypeId'>,\n): AXMSectionTypeCode | undefined {\n const sectionTypeId = section.sectionTypeId || section.sectionType?.id;\n const key = resolveSectionTypeKey(sectionTypeId, section.sectionType);\n return key;\n}\n\nfunction collectSectionItemIds(\n section: AXMSafetyPlanSectionBuilderSectionValue | undefined,\n sectionTypeKey: AXMSectionTypeCode,\n): string[] {\n if (!section?.items?.length || sectionTypeKeyFromSection(section) !== sectionTypeKey) {\n return [];\n }\n const ids = new Set<string>();\n for (const item of section.items) {\n for (const id of item.itemIds ?? []) {\n if (typeof id === 'string' && id.length > 0) {\n ids.add(id);\n }\n }\n }\n return [...ids];\n}\n\n/** Collects item IDs from sections up to `sectionIndex` whose type matches `parentSectionTypeKey`. */\nexport function resolveParentItemIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode,\n): string[] {\n const ids = new Set<string>();\n const lastIndex = Math.min(sectionIndex, sections.length - 1);\n for (let index = 0; index <= lastIndex; index += 1) {\n collectSectionItemIds(sections[index], parentSectionTypeKey).forEach((id) => ids.add(id));\n }\n return [...ids];\n}\n\n/** Collects hazard IDs from earlier sections and Hazard rows in the current section. */\nexport function resolveParentHazardIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode = 'Hazard',\n): string[] {\n return resolveParentItemIds(sections, sectionIndex, parentSectionTypeKey);\n}\n\n/** Collects hazard-risk IDs from prior HazardRisk sections up to `sectionIndex`. */\nexport function resolveParentHazardRiskIds(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n): string[] {\n return resolveParentItemIds(sections, sectionIndex, 'HazardRisk');\n}\n\nfunction parentItemSignature(\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n parentSectionTypeKey: AXMSectionTypeCode,\n): string {\n return resolveParentItemIds(sections, sectionIndex, parentSectionTypeKey).sort().join('|');\n}\n\nfunction shouldClearSectionOnParentChange(\n section: AXMSafetyPlanSectionBuilderSectionValue,\n sectionIndex: number,\n changeIndex: number,\n parentTypeKey: AXMSectionTypeCode,\n downstreamTypes: readonly AXMSectionTypeCode[],\n): boolean {\n if (sectionIndex < changeIndex) {\n return false;\n }\n const sectionKey = sectionTypeKeyFromSection(section);\n if (!sectionKey || !downstreamTypes.includes(sectionKey)) {\n return false;\n }\n if (sectionIndex === changeIndex && sectionKey === parentTypeKey) {\n return false;\n }\n return section.items.some((item) => (item.itemIds?.length ?? 0) > 0);\n}\n\nfunction clearSectionItems(\n section: AXMSafetyPlanSectionBuilderSectionValue,\n): AXMSafetyPlanSectionBuilderSectionValue {\n return {\n ...section,\n items: section.items.map((item) => ({ ...item, itemIds: [], items: [] })),\n };\n}\n\n/**\n * When upstream hazard or hazard-risk selections change, clears item rows in later dependent sections.\n */\nexport function clearDependentItemsOnParentChange(\n previous: AXMSafetyPlanSectionBuilderValue,\n next: AXMSafetyPlanSectionBuilderValue,\n): AXMSafetyPlanSectionBuilderValue {\n if (!next.sections.length) {\n return next;\n }\n\n let changeIndex = next.sections.length;\n let hazardChanged = false;\n let hazardRiskChanged = false;\n\n for (let index = 0; index < next.sections.length; index += 1) {\n const prevHazardSig = parentItemSignature(previous.sections, index, 'Hazard');\n const nextHazardSig = parentItemSignature(next.sections, index, 'Hazard');\n if (prevHazardSig !== nextHazardSig) {\n changeIndex = Math.min(changeIndex, index);\n hazardChanged = true;\n }\n\n const prevRiskSig = parentItemSignature(previous.sections, index, 'HazardRisk');\n const nextRiskSig = parentItemSignature(next.sections, index, 'HazardRisk');\n if (prevRiskSig !== nextRiskSig) {\n changeIndex = Math.min(changeIndex, index);\n hazardRiskChanged = true;\n }\n }\n\n if (changeIndex === next.sections.length) {\n return next;\n }\n\n return {\n sections: next.sections.map((section, sectionIndex) => {\n const clearFromHazard =\n hazardChanged &&\n shouldClearSectionOnParentChange(\n section,\n sectionIndex,\n changeIndex,\n 'Hazard',\n WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD,\n );\n const clearFromHazardRisk =\n hazardRiskChanged &&\n shouldClearSectionOnParentChange(\n section,\n sectionIndex,\n changeIndex,\n 'HazardRisk',\n WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK,\n );\n\n if (!clearFromHazard && !clearFromHazardRisk) {\n return section;\n }\n return clearSectionItems(section);\n }),\n };\n}\n\nexport function extractRiskMatrixIdsFromHazardRisks(records: Record<string, unknown>[]): string[] {\n const ids = new Set<string>();\n for (const record of records) {\n const id = record['riskMatrixId'];\n if (typeof id === 'string' && id.length > 0) {\n ids.add(id);\n }\n }\n return [...ids];\n}\n\nfunction buildInFilter(field: string, values: string[]): Record<string, unknown> | null {\n const unique = [...new Set(values.filter((id) => id.length > 0))];\n if (!unique.length) {\n return null;\n }\n return {\n field,\n operator: { type: 'in' },\n value: unique,\n };\n}\n\n/** Filter that matches no records when parent context exists but derived IDs are empty. */\nfunction buildEmptyResultFilter(field: string): Record<string, unknown> {\n return {\n field,\n operator: { type: 'in' },\n value: ['00000000-0000-0000-0000-000000000000'],\n };\n}\n\nexport function resolveSafetyPlanSectionItemFilter(\n sectionTypeId: string,\n parentHazardIds: string[],\n parentHazardRiskIds: string[] = [],\n): Record<string, unknown> | null {\n const sectionTypeKey = resolveSectionTypeKey(sectionTypeId);\n const dependency = getSectionTypeDependency(sectionTypeKey);\n if (!dependency || dependency.kind !== 'parentFilter') {\n return null;\n }\n\n const parentIds =\n dependency.parentSectionTypeKey === 'Hazard' ? parentHazardIds : parentHazardRiskIds;\n if (!parentIds.length) {\n return null;\n }\n\n return buildInFilter(dependency.filterField, parentIds);\n}\n\nexport async function resolveSafetyPlanSectionItemFilterAsync(\n sectionTypeId: string,\n sections: AXMSafetyPlanSectionBuilderSectionValue[],\n sectionIndex: number,\n loadHazardRisks: AXMHazardRiskRecordLoader,\n): Promise<Record<string, unknown> | null> {\n const sectionTypeKey = resolveSectionTypeKey(sectionTypeId);\n const dependency = getSectionTypeDependency(sectionTypeKey);\n if (!dependency) {\n return null;\n }\n\n if (dependency.kind === 'parentFilter') {\n const parentIds = resolveParentItemIds(sections, sectionIndex, dependency.parentSectionTypeKey);\n if (!parentIds.length) {\n return null;\n }\n return buildInFilter(dependency.filterField, parentIds);\n }\n\n const parentIds = resolveParentItemIds(sections, sectionIndex, dependency.parentSectionTypeKey);\n if (!parentIds.length) {\n return null;\n }\n\n const records = await loadHazardRisks(parentIds);\n const derivedIds = extractRiskMatrixIdsFromHazardRisks(records);\n\n if (!derivedIds.length) {\n return buildEmptyResultFilter(dependency.filterField);\n }\n\n return buildInFilter(dependency.filterField, derivedIds);\n}\n\nconst defaultItemIdsPlaceholderKey =\n '@workplacesafety-management:safety-plan-sections.entities.safety-plan-section.fields.item-ids.placeholder';\n\n/** Clears item selection when section type changes in item dialog context. */\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: \"{{ widget.setValue([]); context.set('items', []); }}\",\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: \"{{ widget.setValue([]); context.set('items', []); }}\",\n },\n];\n\n/**\n * Reloads lookup data after section type is resolved (`sectionType.id`, `itemEntityName`).\n */\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS = [\n {\n event: \"{{ events.context('sectionType.id') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionType.itemEntityName') }}\",\n action: '{{ widget.refresh(); }}',\n },\n {\n event: \"{{ events.context('sectionTypeId') }}\",\n action: '{{ widget.refresh(); }}',\n },\n];\n\nexport const WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS = [\n ...WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS,\n ...WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS,\n];\n\nfunction isPpeRuleSectionType(sectionTypeId: string): boolean {\n return (\n sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards ||\n sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe\n );\n}\n\nfunction buildSectionTypeItemTextFieldExpression(sectionTypeIdPath: string): string {\n const ppeHazardsId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const hazardRiskPpeId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n return `{{ [ '${ppeHazardsId}', '${hazardRiskPpeId}' ].includes(context.eval('${sectionTypeIdPath}')) ? 'ppeItem.title' : 'title' }}`;\n}\n\nfunction buildSectionTypeItemColumnsExpression(sectionTypeIdPath: string): string {\n const ppeHazardsId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const hazardRiskPpeId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n const riskMatrixId = WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix;\n return `{{ context.eval('${sectionTypeIdPath}') === '${riskMatrixId}' ? ['code', 'title', 'matrix'] : [ '${ppeHazardsId}', '${hazardRiskPpeId}' ].includes(context.eval('${sectionTypeIdPath}')) ? ['code', 'ppeItem.title', 'requirementType'] : ['code', 'title'] }}`;\n}\n\nfunction buildSectionTypeDependentParentFilter(\n sectionTypeIdPath: string,\n parentIdsContextKey: string,\n parentSectionTypeKey: AXMSectionTypeCode,\n): Record<string, unknown> {\n const dependentSectionTypeIds = (\n Object.entries(WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES) as Array<\n [AXMSectionTypeCode, AXMSectionTypeDependency]\n >\n )\n .filter(([, config]) => config.kind === 'parentFilter' && config.parentSectionTypeKey === parentSectionTypeKey)\n .map(([key]) => {\n const id = Object.entries(WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID).find(\n ([, meta]) => meta.sectionTypeKey === key,\n )?.[0];\n return id ? `'${id}'` : undefined;\n })\n .filter((id): id is string => Boolean(id))\n .join(',');\n\n return {\n field: parentSectionTypeKey === 'Hazard' ? 'hazardId' : 'hazardRiskId',\n operator: { type: 'in' },\n value: `{{ [${dependentSectionTypeIds}].includes(context.eval('${sectionTypeIdPath}')) ? ((context.eval('${parentIdsContextKey}') || []).length ? context.eval('${parentIdsContextKey}') : undefined) : undefined }}`,\n };\n}\n\nfunction buildSectionTypeDependentHazardFilter(\n sectionTypeIdPath: string,\n parentHazardIdsContextKey: string,\n): Record<string, unknown> {\n return buildSectionTypeDependentParentFilter(sectionTypeIdPath, parentHazardIdsContextKey, 'Hazard');\n}\n\nconst sectionItemLookupExpose = [\n { source: 'id', target: 'items.{id}' },\n { source: 'title', target: 'items.{title}' },\n { source: 'code', target: 'items.{code}' },\n { source: 'ppeItem.id', target: 'items.{id}' },\n { source: 'ppeItem.title', target: 'items.{title}' },\n { source: 'ppeItem.code', target: 'items.{code}' },\n];\n\n/** Shared item lookup options for builder item dialog (`sectionType.*` in dialog context). */\nexport function buildSafetyPlanSectionItemLookupOptions(\n entityExpression: string,\n options?: {\n /** Context path to section type id, e.g. `sectionType.id`. */\n sectionTypeIdPath?: string;\n /** Dialog context key for upstream hazard IDs (read at runtime; do not embed IDs in options). */\n parentHazardIdsContextKey?: string;\n /** Dialog context key for upstream hazard-risk IDs. */\n parentHazardRiskIdsContextKey?: string;\n defaultPlaceholderKey?: string;\n },\n): Record<string, unknown> {\n const sectionTypeIdPath = options?.sectionTypeIdPath ?? 'sectionType.id';\n const lookup: Record<string, unknown> = {\n entity: entityExpression,\n look: 'lookup',\n multiple: true,\n allowSearch: true,\n textField: buildSectionTypeItemTextFieldExpression(sectionTypeIdPath),\n columns: buildSectionTypeItemColumnsExpression(sectionTypeIdPath),\n placeholder: options?.defaultPlaceholderKey ?? defaultItemIdsPlaceholderKey,\n expose: sectionItemLookupExpose,\n triggers: WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS,\n };\n\n const filters: Record<string, unknown>[] = [];\n if (options?.parentHazardIdsContextKey) {\n filters.push(\n buildSectionTypeDependentHazardFilter(sectionTypeIdPath, options.parentHazardIdsContextKey),\n );\n }\n if (options?.parentHazardRiskIdsContextKey) {\n filters.push(\n buildSectionTypeDependentParentFilter(\n sectionTypeIdPath,\n options.parentHazardRiskIdsContextKey,\n 'HazardRisk',\n ),\n );\n }\n if (filters.length === 1) {\n lookup['filter'] = filters[0];\n } else if (filters.length > 1) {\n lookup['filter'] = { logic: 'and', filters };\n }\n\n return lookup;\n}\n\n/** Lookup options with entity data-selector popup UI (`look: 'lookup'`). */\nexport function buildSafetyPlanSectionItemSelectorOptions(\n entityExpression: string,\n options?: Parameters<typeof buildSafetyPlanSectionItemLookupOptions>[1],\n): Record<string, unknown> {\n return {\n ...buildSafetyPlanSectionItemLookupOptions(entityExpression, options),\n look: 'lookup',\n };\n}\n\n/** Selector column: string names are visible; `{ visible: false }` is queried for widget context only. */\nexport type AXMSafetyPlanSectionItemColumn = string | { name: string; visible?: boolean };\n\nexport function resolveSafetyPlanSectionItemColumns(sectionTypeId: string): AXMSafetyPlanSectionItemColumn[] {\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards) {\n return ['code', 'ppeItem.title', 'requirementType'];\n }\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe) {\n return ['code', 'hazardRisk.title', 'ppeItem.title', 'requirementType'];\n }\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.riskMatrix) {\n return [\n 'code',\n 'title',\n 'matrix',\n { name: 'likelihoodIds', visible: false },\n { name: 'severityIds', visible: false },\n { name: 'likelihoodId', visible: false },\n { name: 'severityId', visible: false },\n { name: 'matrixOrientation', visible: false },\n ];\n }\n return ['code', 'title'];\n}\n\nexport function resolveSafetyPlanSectionItemEntityKey(\n sectionTypeId: string,\n sectionType?: AXMSectionTypeSnapshot,\n): string | undefined {\n return resolveSectionItemEntityName(sectionTypeId, sectionType);\n}\n\nexport function mapSafetyPlanSectionSelectedItems(\n sectionTypeId: string,\n selectedItems: Array<Record<string, unknown>>,\n): Array<{ id: string; title?: string; code?: string }> {\n const isPpeHazards = sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.ppeHazards;\n const isHazardRiskPpe = sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.hazardRiskPpe;\n\n return selectedItems\n .map((item) => {\n if (isPpeHazards || isHazardRiskPpe) {\n const ppeItem = item['ppeItem'] as Record<string, unknown> | undefined;\n const id = String(ppeItem?.['id'] ?? item['id'] ?? '');\n return {\n id,\n title: asSafetyPlanDisplayText(ppeItem?.['title']) || undefined,\n code: asSafetyPlanDisplayText(ppeItem?.['code']) || undefined,\n };\n }\n return {\n id: String(item['id'] ?? ''),\n title: asSafetyPlanDisplayText(item['title']) || undefined,\n code: asSafetyPlanDisplayText(item['code']) || undefined,\n };\n })\n .filter((item) => item.id.length > 0);\n}\n\nexport function dedupeSafetyPlanSectionItemSelection(\n item: AXMSafetyPlanSectionBuilderItemValue,\n): AXMSafetyPlanSectionBuilderItemValue {\n const seen = new Set<string>();\n const itemIds: string[] = [];\n const items: NonNullable<AXMSafetyPlanSectionBuilderItemValue['items']> = [];\n\n for (let index = 0; index < (item.itemIds?.length ?? 0); index += 1) {\n const id = item.itemIds?.[index];\n if (typeof id !== 'string' || !id || seen.has(id)) {\n continue;\n }\n seen.add(id);\n itemIds.push(id);\n const snapshot =\n item.items?.find((entry) => entry?.id === id) ??\n (item.items?.[index]?.id === id || !item.items?.[index]?.id ? item.items?.[index] : undefined);\n items.push({\n id,\n title: asSafetyPlanDisplayText(snapshot?.title) || undefined,\n code: asSafetyPlanDisplayText(snapshot?.code) || undefined,\n });\n }\n\n return { ...item, itemIds, items };\n}\n\nexport function isPpeRuleSectionTypeId(sectionTypeId: string): boolean {\n return isPpeRuleSectionType(sectionTypeId);\n}\n\n//#endregion\n","/** Component key for the safety plan Sections page tab. Register via AXP_PAGE_COMPONENT_PROVIDER. */\nexport const SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY = 'safety-plan-sections-page';\n","//#region ---- Safety plan section builder value types ----\n\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type { AXMSafetyPlanActivitySnapshot } from './entities/safety-plan-activity/safety-plan-activity.types';\nimport type { AXMSafetyPlanSectionWidgetOptions } from './entities/safety-plan-section/safety-plan-section.types';\n\n/** One predefined section line from {@link AXMWorkplaceSafetyManagementSafetyPlanActivityEntityModel.items}. */\nexport interface AXMSafetyPlanActivitySectionSnapshot {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n itemIds?: string[];\n items?: { id: string; title?: string; code?: string }[];\n sortOrder?: number;\n title?: string;\n}\n\n/** One Activity section body row in the section builder. */\nexport interface AXMSafetyPlanActivityRowBuilderPayload {\n /** Persisted business code when loaded from storage. */\n code?: string;\n sortOrder?: number;\n title?: string;\n /** Copied from SafetyPlanActivity.description when the row is an activity. */\n description?: string;\n /**\n * Sections configured on the SafetyPlanActivity catalog row (`items`).\n * Hydrated for edit/preview; not required on every persisted plan section item.\n */\n sections?: AXMSafetyPlanActivitySectionSnapshot[];\n}\n\nexport interface AXMSafetyPlanSectionBuilderItemValue {\n id: string;\n itemIds: string[];\n items?: { id: string; title?: string; code?: string }[];\n /** Activity section body row (embedded on the section item). */\n activityRow?: AXMSafetyPlanActivityRowBuilderPayload;\n}\n\nexport interface AXMSafetyPlanSectionBuilderSectionValue {\n id: string;\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n title: string;\n description?: string;\n safetyPlanId?: string;\n /** Persisted business code (`SPS-{seq:4}`) when loaded from storage. */\n code?: string;\n /** Originating SafetyPlanTypeSection id (independent copy after save). */\n sourceSafetyPlanTypeSectionId?: string;\n /** Display / persistence order. */\n sortOrder?: number;\n /** When true, section came from a default type template and must remain. */\n required?: boolean;\n /** Activity section only — selected SafetyPlanActivity for this section. */\n safetyPlanActivityId?: string;\n safetyPlanActivity?: AXMSafetyPlanActivitySnapshot;\n /** Widget display options (PPE layout, control-hierarchy view). */\n widgetOptions?: AXMSafetyPlanSectionWidgetOptions;\n items: AXMSafetyPlanSectionBuilderItemValue[];\n}\n\nexport interface AXMSafetyPlanSectionBuilderValue {\n sections: AXMSafetyPlanSectionBuilderSectionValue[];\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport type { AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel } from './entities/safety-plan-section/safety-plan-section.types';\nimport type { AXMSafetyPlanActivitySectionSnapshot } from './safety-plan-section-builder.types';\nimport { enrichSectionTypeSnapshot, resolveSectionTypeDisplayTitle } from './section-type-entity-map';\nimport { asSafetyPlanDisplayText } from './safety-plan-section-structure.util';\n\n//#endregion\n\n//#region ---- Mapping ----\n\n/**\n * Maps SafetyPlanActivity.`items` (section type + catalog item ids) into preview/builder snapshots.\n */\nexport function mapSafetyPlanActivityItemsToSectionSnapshots(\n items: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[] | null | undefined,\n): AXMSafetyPlanActivitySectionSnapshot[] {\n if (!Array.isArray(items) || items.length === 0) {\n return [];\n }\n\n return items\n .map((item, index): AXMSafetyPlanActivitySectionSnapshot | null => {\n const sectionTypeId = String(item.sectionTypeId ?? item.sectionType?.id ?? '').trim();\n if (!sectionTypeId) {\n return null;\n }\n const sectionType = enrichSectionTypeSnapshot(\n sectionTypeId,\n item.sectionType as AXMSectionTypeSnapshot | undefined,\n );\n const itemIds = Array.isArray(item.itemIds)\n ? item.itemIds.filter((id): id is string => typeof id === 'string' && id.length > 0)\n : [];\n const snapshots = Array.isArray(item.items) ? item.items : [];\n return {\n sectionTypeId,\n sectionType,\n itemIds,\n items: itemIds.map((id, itemIndex) => {\n const existing = snapshots.find((entry) => entry.id === id) ?? snapshots[itemIndex];\n return {\n id,\n title: asSafetyPlanDisplayText(existing?.title) || undefined,\n code: asSafetyPlanDisplayText(existing?.code) || undefined,\n };\n }),\n sortOrder: typeof item.sortOrder === 'number' ? item.sortOrder : index + 1,\n title:\n (typeof item.title === 'string' && item.title.trim()) ||\n asSafetyPlanDisplayText(sectionType?.title) ||\n resolveSectionTypeDisplayTitle(sectionTypeId, sectionType) ||\n undefined,\n };\n })\n .filter((entry): entry is AXMSafetyPlanActivitySectionSnapshot => entry != null);\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXMSectionTypeSnapshot } from './entities/section-type/section-type.types';\nimport {\n resolveSectionTypeKey,\n WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS,\n} from './section-type-entity-map';\n\n//#endregion\n\n//#region ---- Detection ----\n\n/** True when the section type is the Activity host for embedded activity rows. */\nexport function isActivitySectionType(\n sectionTypeId: string | undefined,\n snapshot?: AXMSectionTypeSnapshot,\n): boolean {\n if (sectionTypeId === WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS.activity) {\n return true;\n }\n const key = resolveSectionTypeKey(sectionTypeId, snapshot);\n // Accept legacy `StepTable` key from older section snapshots.\n return key === 'Activity' || (key as string | undefined) === 'StepTable';\n}\n\n//#endregion\n","//#region ---- Built-in work step type IDs ----\n\n/** Stable IDs for seeded Work Step Types (shared by server mocks and client). */\nexport const WORKPLACE_SAFETY_BUILT_IN_WORK_STEP_TYPE_IDS = {\n generalTask: 'c1d2e5f4-a5b6-4789-d001-000000000001',\n sitePreparation: 'c1d2e5f4-a5b6-4789-d001-000000000002',\n performWork: 'c1d2e5f4-a5b6-4789-d001-000000000003',\n} as const;\n\n//#endregion\n","//#region ---- Built-in safety plan activity IDs ----\n\n/** Stable IDs for seeded Safety Plan Activities (shared by server mocks and client). */\nexport const WORKPLACE_SAFETY_BUILT_IN_SAFETY_PLAN_ACTIVITY_IDS = {\n plantInspection: 'c1d2e6f4-a5b6-4789-e001-000000000001',\n excavationWorks: 'c1d2e6f4-a5b6-4789-e001-000000000002',\n cableInstallation: 'c1d2e6f4-a5b6-4789-e001-000000000003',\n hydroExcavation: 'c1d2e6f4-a5b6-4789-e001-000000000004',\n backfilling: 'c1d2e6f4-a5b6-4789-e001-000000000005',\n workingAtHeight: 'c1d2e6f4-a5b6-4789-e001-000000000006',\n} as const;\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPCategoryListItem, AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Item model ----\n\nexport interface AXMControlHierarchyLevelItemModel {\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n /** Display color for hierarchy diagram visualizations. */\n color?: string;\n /**\n * Optional explicit row order. When omitted, repeater array index defines order\n * (`AXPRepeaterWidgetEditComponent` + `allowReorder`).\n */\n order?: number;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementControlHierarchyLevelsEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `control-hierarchy-levels-code` (`CHL-{seq:4}`). */\n code: string;\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n /** Hierarchy level items managed via repeater. */\n itemIds?: AXMControlHierarchyLevelItemModel[];\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport type { AXPFileListItem, AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementControlMeasureEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `control-measure-code` (`CM-{seq:4}`). */\n code: string;\n title: AXPMultiLanguageString;\n instruction?: AXPMultiLanguageString;\n status?: string;\n /** Populated by the attachments plugin (`field: attachments`). */\n attachments?: AXPFileListItem[];\n}\n\n//#endregion\n","import { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Enums ----\n\nexport enum AXMHazardRegisterContextType {\n Asset = 'asset',\n Site = 'site',\n WorkOrder = 'work-order',\n Project = 'project',\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementHazardRegisterEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `hazard-register-code` (`HR-{date:YYYY}-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n /** Hazard category id (`WorkplaceSafetyManagement.HazardCategory`). */\n registerType: string;\n registerTypeCategory?: { id: string; title?: string; code?: string };\n hazardId: string;\n hazard?: { id: string; title?: string; code?: string };\n /** Merged hazard + category metadata field values keyed by field name. */\n metaDataForm?: Record<string, unknown>;\n contextType: AXMHazardRegisterContextType;\n contextId: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementHazardRiskEntityModel extends AXPEntityModel<string> {\n code: string;\n hazardId: string;\n hazard?: { id: string; title?: string; code?: string };\n riskMatrixId: string;\n riskMatrix?: { id: string; title?: string; code?: string };\n title: string;\n description?: string;\n status?: AXPSystemStatusType.Active | AXPSystemStatusType.Inactive;\n}\n\n//#endregion\n","import { AXPCategoryListItem, AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementPpeItemEntityModel extends AXPEntityModel<string> {\n code: string;\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n categoryIds?: string[];\n categories?: AXPCategoryListItem[];\n serialNumber?: string;\n icon?: string;\n status?: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPSystemStatusType } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\nimport type { AXMSafetyPlanSectionBuilderValue } from '../../safety-plan-section-builder.types';\nimport type { AXMSafetyPlanSectionStructureValue } from '../../safety-plan-section-structure.util';\n\n//#endregion\n\n//#region ---- Status ----\n\nexport type AXMSafetyPlanStatus =\n | AXPSystemStatusType.Draft\n | AXPSystemStatusType.Published\n | AXPSystemStatusType.Archived;\n\n//#endregion\n\n//#region ---- Entity model ----\n\n/** Section id → widget value (PPE id[], text, or a later widget value). */\nexport type AXMSafetyPlanFillValues = Record<string, unknown>;\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-code` (`SP-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n safetyPlanTypeId: string;\n safetyPlanType?: { id: string; title?: string; code?: string };\n /**\n * Selected Safety Plan Type Section (named structure) for this plan.\n * Filtered by {@link safetyPlanTypeId}; defaults to the type's `isDefault` structure.\n */\n structureId?: string;\n structure?: { id: string; title?: string };\n status?: AXMSafetyPlanStatus;\n /** When true, a published plan can be cloned into a new draft plan. */\n allowClone?: boolean;\n publishedAt?: string;\n publishedById?: string;\n publishedBy?: { id: string; displayName?: string };\n /**\n * Form-only editable section structure loaded from the selected plan type defaults\n * (create) or from saved SafetyPlanSection rows (edit). Not persisted on the plan document.\n */\n sectionStructure?: AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue;\n /** @deprecated Prefer {@link sectionStructure}; kept for wizard page field compatibility. */\n sections?: AXMSafetyPlanSectionBuilderValue;\n /**\n * Workflow edits on a cloned job plan, keyed by SafetyPlanSection id.\n * Catalog `itemIds` stay on the section. Absent on published source plans.\n */\n fillValues?: AXMSafetyPlanFillValues;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMSectionTypeSnapshot } from '../section-type/section-type.types';\n\n//#endregion\n\n//#region ---- Item model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n itemIds?: string[];\n items?: { id: string; title?: string; code?: string }[];\n sortOrder?: number;\n title?: string;\n code?: string;\n /** Copied from SafetyPlanActivity.description for Activity section rows. */\n description?: string;\n}\n\n//#endregion\n\n//#region ---- Widget options ----\n\n/** Display options for section widgets (PPE layout, control-hierarchy viewType). Item ids stay on `items`. */\nexport interface AXMSafetyPlanSectionWidgetOptions {\n layout?: unknown;\n viewType?: unknown;\n showTitle?: boolean;\n showViewTypeSelector?: boolean;\n [key: string]: unknown;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-section-code` (`SPS-{seq:4}`). */\n code: string;\n safetyPlanId: string;\n safetyPlan?: { id: string; title?: string; code?: string };\n title: string;\n description?: string;\n /** Section line items managed via repeater (embedded value objects). */\n items: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n /**\n * SafetyPlanTypeSection this row was created from.\n * Stored as a snapshot link only — later type-section edits do not affect this plan.\n */\n sourceSafetyPlanTypeSectionId?: string;\n /** List / display order within the plan. */\n sortOrder?: number;\n /** Widget display options (PPE layout, control-hierarchy view). Not used for Risk Matrix. */\n widgetOptions?: AXMSafetyPlanSectionWidgetOptions;\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanTypeEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-type-code` (`SPT-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n /** Managed by the archive plugin (`isArchived`). Active when false. */\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMSectionTypeSnapshot } from '../section-type/section-type.types';\n\n//#endregion\n\n//#region ---- Section type repeater row ----\n\n/** Section type row managed via repeater on Safety Plan Type Section. */\nexport interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel {\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel extends AXPEntityModel<string> {\n safetyPlanTypeId: string;\n safetyPlanType?: { id: string; title?: string; code?: string };\n /** Display title for this section configuration. */\n title: string;\n /**\n * Section types managed via repeater (`allowReorder`).\n * Each row holds a `sectionTypeId` LookupBox selection.\n */\n sectionTypeIds?: AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel[];\n /** List sort order only (hidden / not edited in create-update UI). */\n sortOrder?: number;\n isDefault?: boolean;\n /** Managed by the archive plugin (`isArchived`). Active when false. */\n isArchived?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Template type ----\n\nexport type AXMSafetyTemplateType = 'SWMS' | 'JSA' | 'Forms' | 'Permits' | 'Plans';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyTemplateEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-template-code` (`ST-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n templateType: AXMSafetyTemplateType;\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n sectionIds: string[];\n /** Expanded from `sectionIds` (multi-lookup join alias). */\n sectionsList?: { id: string; title: string; code?: string }[];\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#endregion\n\n//#region ---- Section type keys ----\n\n/** Stable semantic keys for built-in section types (used by dependencies and lookups). */\nexport type AXMSectionTypeCode =\n | 'Hazard'\n | 'HazardRisk'\n | 'Ppe'\n | 'PpeHazards'\n | 'HazardRiskPpe'\n | 'Control'\n | 'HierarchyLevel'\n | 'RiskMatrix'\n | 'Custom'\n | 'Activity';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSectionTypeEntityModel extends AXPEntityModel<string> {\n /** Business code (seeded built-ins use the title with spaces removed; new rows use `section-type-code`). */\n code: string;\n title: string;\n description?: string;\n /**\n * When false (default), a safety plan may include this section type at most once.\n * Custom / free-form types may set true to allow duplicates.\n */\n isRepeatable?: boolean;\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n}\n\n/** Embedded section type snapshot on safety plan section items. */\nexport interface AXMSectionTypeSnapshot {\n id: string;\n title?: string;\n code?: string;\n description?: string;\n sectionTypeKey?: string;\n itemEntityName?: string;\n /** When true, a safety plan may include this section type more than once. */\n isRepeatable?: boolean;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMSectionTypeSnapshot } from '../section-type/section-type.types';\n\n//#endregion\n\n//#region ---- Column schema ----\n\n/**\n * Column definition shared by WorkStepType (template) and embedded Activity rows.\n * Each column is backed by a SectionType (lookup options + item entity mapping).\n */\nexport interface AXMActivityColumnDef {\n /** Selected SectionType id — stable cell key for this column. */\n sectionTypeId: string;\n sectionType?: AXMSectionTypeSnapshot;\n /** Optional display override; defaults to section type title. */\n title?: string;\n sortOrder: number;\n required?: boolean;\n}\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementWorkStepTypeEntityModel extends AXPEntityModel<string> {\n code: string;\n title: string;\n description?: string;\n /** Default column schema copied onto new Activity sections. */\n columns: AXMActivityColumnDef[];\n isArchived?: boolean;\n}\n\nexport interface AXMWorkStepTypeSnapshot {\n id: string;\n title?: string;\n code?: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type { AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel } from '../safety-plan-section/safety-plan-section.types';\n\n//#endregion\n\n//#region ---- Entity model ----\n\nexport interface AXMWorkplaceSafetyManagementSafetyPlanActivityEntityModel extends AXPEntityModel<string> {\n /** Business code from identifier rule `safety-plan-activity-code` (`SPA-{seq:4}`). */\n code: string;\n title: string;\n description?: string;\n /**\n * Section line items — same shape + repeater widget as {@link AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel.items}.\n */\n items: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];\n /** Managed by the archive plugin (`isArchived`). */\n isArchived?: boolean;\n}\n\nexport interface AXMSafetyPlanActivitySnapshot {\n id: string;\n title?: string;\n code?: string;\n}\n\n//#endregion\n","//#region ---- Contracts barrel ----\n\nexport * from './ghs-symbol-options';\n\nexport * from './permission.keys';\n\nexport * from './commands.keys';\n\nexport * from './menu.keys';\n\nexport * from './root-config';\nexport * from './manifest';\n\nexport * from './hazard-ppe-rule.types';\n\nexport * from './hazard-ppe-rule-requirement-type-options';\n\nexport * from './risk-management.integration';\n\nexport * from './safety-template-type-options';\n\nexport * from './section-type-entity-map';\n\nexport * from './safety-plan-section-dependency';\n\nexport * from './SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY';\n\nexport * from './safety-plan-section-builder.types';\nexport * from './safety-plan-activity-sections.util';\nexport * from './safety-plan-section-structure.util';\nexport * from './safety-plan-section-unique-type.util';\nexport * from './safety-plan-work-steps.util';\nexport * from './work-step-type-ids';\nexport * from './safety-plan-activity-ids';\n\n//#endregion\n\nexport * from './entities';\n","/**\n * Generated bundle index. Do not edit.\n */\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