@elaraai/e3-ui 1.0.86 → 1.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/bind/data-indexed.d.ts +159 -0
- package/dist/src/bind/data-indexed.d.ts.map +1 -0
- package/dist/src/bind/data-indexed.js +105 -0
- package/dist/src/bind/data-indexed.js.map +1 -0
- package/dist/src/bind/data.d.ts +5 -3
- package/dist/src/bind/data.d.ts.map +1 -1
- package/dist/src/bind/data.js +6 -0
- package/dist/src/bind/data.js.map +1 -1
- package/dist/src/bind/record.d.ts +34 -23
- package/dist/src/bind/record.d.ts.map +1 -1
- package/dist/src/bind/record.js +46 -19
- package/dist/src/bind/record.js.map +1 -1
- package/dist/src/calendar/index.d.ts +2923 -0
- package/dist/src/calendar/index.d.ts.map +1 -0
- package/dist/src/calendar/index.js +135 -0
- package/dist/src/calendar/index.js.map +1 -0
- package/dist/src/decision/queue.d.ts +3 -3
- package/dist/src/decision/queue.d.ts.map +1 -1
- package/dist/src/decision/queue.js +2 -2
- package/dist/src/decision/queue.js.map +1 -1
- package/dist/src/decision/types.d.ts +4 -0
- package/dist/src/decision/types.d.ts.map +1 -1
- package/dist/src/decision/types.js +4 -0
- package/dist/src/decision/types.js.map +1 -1
- package/dist/src/flowchart/canvas.d.ts +114 -0
- package/dist/src/flowchart/canvas.d.ts.map +1 -0
- package/dist/src/flowchart/canvas.js +84 -0
- package/dist/src/flowchart/canvas.js.map +1 -0
- package/dist/src/flowchart/flowchart.d.ts +79 -0
- package/dist/src/flowchart/flowchart.d.ts.map +1 -0
- package/dist/src/flowchart/flowchart.js +9 -0
- package/dist/src/flowchart/flowchart.js.map +1 -0
- package/dist/src/flowchart/index.d.ts +305 -0
- package/dist/src/flowchart/index.d.ts.map +1 -0
- package/dist/src/flowchart/index.js +267 -0
- package/dist/src/flowchart/index.js.map +1 -0
- package/dist/src/flowchart/library.d.ts +720 -0
- package/dist/src/flowchart/library.d.ts.map +1 -0
- package/dist/src/flowchart/library.js +611 -0
- package/dist/src/flowchart/library.js.map +1 -0
- package/dist/src/flowchart/over.d.ts +234 -0
- package/dist/src/flowchart/over.d.ts.map +1 -0
- package/dist/src/flowchart/over.js +220 -0
- package/dist/src/flowchart/over.js.map +1 -0
- package/dist/src/flowchart/patch.d.ts +64 -0
- package/dist/src/flowchart/patch.d.ts.map +1 -0
- package/dist/src/flowchart/patch.js +67 -0
- package/dist/src/flowchart/patch.js.map +1 -0
- package/dist/src/flowchart/payload.d.ts +8220 -0
- package/dist/src/flowchart/payload.d.ts.map +1 -0
- package/dist/src/flowchart/payload.js +521 -0
- package/dist/src/flowchart/payload.js.map +1 -0
- package/dist/src/flowchart/types.d.ts +393 -0
- package/dist/src/flowchart/types.d.ts.map +1 -0
- package/dist/src/flowchart/types.js +216 -0
- package/dist/src/flowchart/types.js.map +1 -0
- package/dist/src/flowchart/values.d.ts +267 -0
- package/dist/src/flowchart/values.d.ts.map +1 -0
- package/dist/src/flowchart/values.js +216 -0
- package/dist/src/flowchart/values.js.map +1 -0
- package/dist/src/flowchart/window.d.ts +521 -0
- package/dist/src/flowchart/window.d.ts.map +1 -0
- package/dist/src/flowchart/window.js +69 -0
- package/dist/src/flowchart/window.js.map +1 -0
- package/dist/src/index.d.ts +25 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +35 -3
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +72 -3
- package/dist/src/internal.js.map +1 -1
- package/dist/src/plan/assemble.d.ts +2224 -0
- package/dist/src/plan/assemble.d.ts.map +1 -0
- package/dist/src/plan/assemble.js +210 -0
- package/dist/src/plan/assemble.js.map +1 -0
- package/dist/src/plan/builders.d.ts +790 -0
- package/dist/src/plan/builders.d.ts.map +1 -0
- package/dist/src/plan/builders.js +749 -0
- package/dist/src/plan/builders.js.map +1 -0
- package/dist/src/plan/event-rows.d.ts +2565 -0
- package/dist/src/plan/event-rows.d.ts.map +1 -0
- package/dist/src/plan/event-rows.js +689 -0
- package/dist/src/plan/event-rows.js.map +1 -0
- package/dist/src/plan/factories.d.ts +458 -0
- package/dist/src/plan/factories.d.ts.map +1 -0
- package/dist/src/plan/factories.js +484 -0
- package/dist/src/plan/factories.js.map +1 -0
- package/dist/src/plan/index.d.ts +672 -0
- package/dist/src/plan/index.d.ts.map +1 -0
- package/dist/src/plan/index.js +532 -0
- package/dist/src/plan/index.js.map +1 -0
- package/dist/src/plan/ir.d.ts +2594 -0
- package/dist/src/plan/ir.d.ts.map +1 -0
- package/dist/src/plan/ir.js +78 -0
- package/dist/src/plan/ir.js.map +1 -0
- package/dist/src/plan/library.d.ts +772 -0
- package/dist/src/plan/library.d.ts.map +1 -0
- package/dist/src/plan/library.js +424 -0
- package/dist/src/plan/library.js.map +1 -0
- package/dist/src/plan/ordered-source.d.ts +27 -0
- package/dist/src/plan/ordered-source.d.ts.map +1 -0
- package/dist/src/plan/ordered-source.js +48 -0
- package/dist/src/plan/ordered-source.js.map +1 -0
- package/dist/src/plan/over.d.ts +247 -0
- package/dist/src/plan/over.d.ts.map +1 -0
- package/dist/src/plan/over.js +266 -0
- package/dist/src/plan/over.js.map +1 -0
- package/dist/src/plan/pick.d.ts +78 -0
- package/dist/src/plan/pick.d.ts.map +1 -0
- package/dist/src/plan/pick.js +146 -0
- package/dist/src/plan/pick.js.map +1 -0
- package/dist/src/plan/plan.d.ts +11611 -0
- package/dist/src/plan/plan.d.ts.map +1 -0
- package/dist/src/plan/plan.js +428 -0
- package/dist/src/plan/plan.js.map +1 -0
- package/dist/src/plan/refs.d.ts +218 -0
- package/dist/src/plan/refs.d.ts.map +1 -0
- package/dist/src/plan/refs.js +226 -0
- package/dist/src/plan/refs.js.map +1 -0
- package/dist/src/plan/root.d.ts +290 -0
- package/dist/src/plan/root.d.ts.map +1 -0
- package/dist/src/plan/root.js +463 -0
- package/dist/src/plan/root.js.map +1 -0
- package/dist/src/plan/series.d.ts +13554 -0
- package/dist/src/plan/series.d.ts.map +1 -0
- package/dist/src/plan/series.js +1921 -0
- package/dist/src/plan/series.js.map +1 -0
- package/dist/src/plan/types.d.ts +12400 -0
- package/dist/src/plan/types.d.ts.map +1 -0
- package/dist/src/plan/types.js +1335 -0
- package/dist/src/plan/types.js.map +1 -0
- package/dist/src/roster/coverage.d.ts +240 -0
- package/dist/src/roster/coverage.d.ts.map +1 -0
- package/dist/src/roster/coverage.js +109 -0
- package/dist/src/roster/coverage.js.map +1 -0
- package/dist/src/roster/index.d.ts +4028 -0
- package/dist/src/roster/index.d.ts.map +1 -0
- package/dist/src/roster/index.js +115 -0
- package/dist/src/roster/index.js.map +1 -0
- package/dist/src/roster/library.d.ts +106 -0
- package/dist/src/roster/library.d.ts.map +1 -0
- package/dist/src/roster/library.js +78 -0
- package/dist/src/roster/library.js.map +1 -0
- package/dist/src/roster/people.d.ts +50 -0
- package/dist/src/roster/people.d.ts.map +1 -0
- package/dist/src/roster/people.js +32 -0
- package/dist/src/roster/people.js.map +1 -0
- package/dist/src/roster/rules.d.ts +275 -0
- package/dist/src/roster/rules.d.ts.map +1 -0
- package/dist/src/roster/rules.js +162 -0
- package/dist/src/roster/rules.js.map +1 -0
- package/dist/src/roster/types.d.ts +672 -0
- package/dist/src/roster/types.d.ts.map +1 -0
- package/dist/src/roster/types.js +248 -0
- package/dist/src/roster/types.js.map +1 -0
- package/dist/src/roster/visibility.d.ts +66 -0
- package/dist/src/roster/visibility.d.ts.map +1 -0
- package/dist/src/roster/visibility.js +25 -0
- package/dist/src/roster/visibility.js.map +1 -0
- package/dist/src/schedule/days.d.ts +54 -0
- package/dist/src/schedule/days.d.ts.map +1 -0
- package/dist/src/schedule/days.js +68 -0
- package/dist/src/schedule/days.js.map +1 -0
- package/dist/src/schedule/events.d.ts +433 -0
- package/dist/src/schedule/events.d.ts.map +1 -0
- package/dist/src/schedule/events.js +851 -0
- package/dist/src/schedule/events.js.map +1 -0
- package/dist/src/schedule/index.d.ts +150 -0
- package/dist/src/schedule/index.d.ts.map +1 -0
- package/dist/src/schedule/index.js +132 -0
- package/dist/src/schedule/index.js.map +1 -0
- package/dist/src/schedule/library.d.ts +70 -0
- package/dist/src/schedule/library.d.ts.map +1 -0
- package/dist/src/schedule/library.js +102 -0
- package/dist/src/schedule/library.js.map +1 -0
- package/dist/src/schedule/patch.d.ts +74 -0
- package/dist/src/schedule/patch.d.ts.map +1 -0
- package/dist/src/schedule/patch.js +68 -0
- package/dist/src/schedule/patch.js.map +1 -0
- package/dist/src/schedule/record-window.d.ts +189 -0
- package/dist/src/schedule/record-window.d.ts.map +1 -0
- package/dist/src/schedule/record-window.js +95 -0
- package/dist/src/schedule/record-window.js.map +1 -0
- package/dist/src/schedule/resources.d.ts +165 -0
- package/dist/src/schedule/resources.d.ts.map +1 -0
- package/dist/src/schedule/resources.js +234 -0
- package/dist/src/schedule/resources.js.map +1 -0
- package/dist/src/schedule/templates.d.ts +47 -0
- package/dist/src/schedule/templates.d.ts.map +1 -0
- package/dist/src/schedule/templates.js +61 -0
- package/dist/src/schedule/templates.js.map +1 -0
- package/dist/src/schedule/types.d.ts +1677 -0
- package/dist/src/schedule/types.d.ts.map +1 -0
- package/dist/src/schedule/types.js +374 -0
- package/dist/src/schedule/types.js.map +1 -0
- package/dist/src/schedule/window.d.ts +154 -0
- package/dist/src/schedule/window.d.ts.map +1 -0
- package/dist/src/schedule/window.js +363 -0
- package/dist/src/schedule/window.js.map +1 -0
- package/dist/src/sheet/bridge.d.ts +385 -0
- package/dist/src/sheet/bridge.d.ts.map +1 -0
- package/dist/src/sheet/bridge.js +809 -0
- package/dist/src/sheet/bridge.js.map +1 -0
- package/dist/src/sheet/columns.d.ts +410 -0
- package/dist/src/sheet/columns.d.ts.map +1 -0
- package/dist/src/sheet/columns.js +99 -0
- package/dist/src/sheet/columns.js.map +1 -0
- package/dist/src/sheet/context-bridge.d.ts +48 -0
- package/dist/src/sheet/context-bridge.d.ts.map +1 -0
- package/dist/src/sheet/context-bridge.js +216 -0
- package/dist/src/sheet/context-bridge.js.map +1 -0
- package/dist/src/sheet/draft-bridge.d.ts +37 -0
- package/dist/src/sheet/draft-bridge.d.ts.map +1 -0
- package/dist/src/sheet/draft-bridge.js +153 -0
- package/dist/src/sheet/draft-bridge.js.map +1 -0
- package/dist/src/sheet/drafts.d.ts +14 -0
- package/dist/src/sheet/drafts.d.ts.map +1 -0
- package/dist/src/sheet/drafts.js +14 -0
- package/dist/src/sheet/drafts.js.map +1 -0
- package/dist/src/sheet/editing-bridge.d.ts +40 -0
- package/dist/src/sheet/editing-bridge.d.ts.map +1 -0
- package/dist/src/sheet/editing-bridge.js +231 -0
- package/dist/src/sheet/editing-bridge.js.map +1 -0
- package/dist/src/sheet/editing-types.d.ts +268 -0
- package/dist/src/sheet/editing-types.d.ts.map +1 -0
- package/dist/src/sheet/editing-types.js +34 -0
- package/dist/src/sheet/editing-types.js.map +1 -0
- package/dist/src/sheet/edits.d.ts +37 -0
- package/dist/src/sheet/edits.d.ts.map +1 -0
- package/dist/src/sheet/edits.js +31 -0
- package/dist/src/sheet/edits.js.map +1 -0
- package/dist/src/sheet/fields.d.ts +693 -0
- package/dist/src/sheet/fields.d.ts.map +1 -0
- package/dist/src/sheet/fields.js +280 -0
- package/dist/src/sheet/fields.js.map +1 -0
- package/dist/src/sheet/group.d.ts +165 -0
- package/dist/src/sheet/group.d.ts.map +1 -0
- package/dist/src/sheet/group.js +52 -0
- package/dist/src/sheet/group.js.map +1 -0
- package/dist/src/sheet/index.d.ts +542 -0
- package/dist/src/sheet/index.d.ts.map +1 -0
- package/dist/src/sheet/index.js +387 -0
- package/dist/src/sheet/index.js.map +1 -0
- package/dist/src/sheet/library.d.ts +284 -0
- package/dist/src/sheet/library.d.ts.map +1 -0
- package/dist/src/sheet/library.js +259 -0
- package/dist/src/sheet/library.js.map +1 -0
- package/dist/src/sheet/link.d.ts +398 -0
- package/dist/src/sheet/link.d.ts.map +1 -0
- package/dist/src/sheet/link.js +228 -0
- package/dist/src/sheet/link.js.map +1 -0
- package/dist/src/sheet/record.d.ts +75 -0
- package/dist/src/sheet/record.d.ts.map +1 -0
- package/dist/src/sheet/record.js +128 -0
- package/dist/src/sheet/record.js.map +1 -0
- package/dist/src/sheet/registers.d.ts +681 -0
- package/dist/src/sheet/registers.d.ts.map +1 -0
- package/dist/src/sheet/registers.js +671 -0
- package/dist/src/sheet/registers.js.map +1 -0
- package/dist/src/sheet/root.d.ts +329 -0
- package/dist/src/sheet/root.d.ts.map +1 -0
- package/dist/src/sheet/root.js +511 -0
- package/dist/src/sheet/root.js.map +1 -0
- package/dist/src/sheet/seed-bridge.d.ts +14 -0
- package/dist/src/sheet/seed-bridge.d.ts.map +1 -0
- package/dist/src/sheet/seed-bridge.js +51 -0
- package/dist/src/sheet/seed-bridge.js.map +1 -0
- package/dist/src/sheet/sheet.d.ts +11819 -0
- package/dist/src/sheet/sheet.d.ts.map +1 -0
- package/dist/src/sheet/sheet.js +236 -0
- package/dist/src/sheet/sheet.js.map +1 -0
- package/dist/src/sheet/sub-rows.d.ts +299 -0
- package/dist/src/sheet/sub-rows.d.ts.map +1 -0
- package/dist/src/sheet/sub-rows.js +272 -0
- package/dist/src/sheet/sub-rows.js.map +1 -0
- package/dist/src/sheet/templates.d.ts +161 -0
- package/dist/src/sheet/templates.d.ts.map +1 -0
- package/dist/src/sheet/templates.js +122 -0
- package/dist/src/sheet/templates.js.map +1 -0
- package/dist/src/sheet/transactions.d.ts +76 -0
- package/dist/src/sheet/transactions.d.ts.map +1 -0
- package/dist/src/sheet/transactions.js +40 -0
- package/dist/src/sheet/transactions.js.map +1 -0
- package/dist/src/sheet/types.d.ts +15226 -0
- package/dist/src/sheet/types.d.ts.map +1 -0
- package/dist/src/sheet/types.js +1070 -0
- package/dist/src/sheet/types.js.map +1 -0
- package/dist/src/sheet/views.d.ts +29 -0
- package/dist/src/sheet/views.d.ts.map +1 -0
- package/dist/src/sheet/views.js +43 -0
- package/dist/src/sheet/views.js.map +1 -0
- package/dist/src/studio/component.d.ts.map +1 -1
- package/dist/src/studio/component.js +11 -8
- package/dist/src/studio/component.js.map +1 -1
- package/dist/src/utils/derive.d.ts +134 -8
- package/dist/src/utils/derive.d.ts.map +1 -1
- package/dist/src/utils/derive.js +409 -7
- package/dist/src/utils/derive.js.map +1 -1
- package/dist/src/utils/ordered-source.d.ts +38 -0
- package/dist/src/utils/ordered-source.d.ts.map +1 -0
- package/dist/src/utils/ordered-source.js +45 -0
- package/dist/src/utils/ordered-source.js.map +1 -0
- package/dist/src/utils/row-inspector.d.ts +36 -0
- package/dist/src/utils/row-inspector.d.ts.map +1 -0
- package/dist/src/utils/row-inspector.js +49 -0
- package/dist/src/utils/row-inspector.js.map +1 -0
- package/dist/test/bind/data/data.examples.d.ts +21 -19
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +122 -122
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts.map +1 -1
- package/dist/test/bind/record/record.examples.js +9 -9
- package/dist/test/bind/record/record.examples.js.map +1 -1
- package/dist/test/calendar/calendar-records.examples.d.ts +228 -0
- package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar-records.examples.js +91 -0
- package/dist/test/calendar/calendar-records.examples.js.map +1 -0
- package/dist/test/calendar/calendar.examples.d.ts +776 -0
- package/dist/test/calendar/calendar.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar.examples.js +336 -0
- package/dist/test/calendar/calendar.examples.js.map +1 -0
- package/dist/test/decision/journal.examples.d.ts +28 -28
- package/dist/test/decision/journal.examples.d.ts.map +1 -1
- package/dist/test/decision/journal.examples.js +4 -4
- package/dist/test/decision/journal.examples.js.map +1 -1
- package/dist/test/decision/queue.examples.d.ts.map +1 -1
- package/dist/test/decision/queue.examples.js +5 -7
- package/dist/test/decision/queue.examples.js.map +1 -1
- package/dist/test/flowchart/flowchart.examples.d.ts +3713 -0
- package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -0
- package/dist/test/flowchart/flowchart.examples.js +465 -0
- package/dist/test/flowchart/flowchart.examples.js.map +1 -0
- package/dist/test/plan/plan-events.examples.d.ts +3666 -0
- package/dist/test/plan/plan-events.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-events.examples.js +773 -0
- package/dist/test/plan/plan-events.examples.js.map +1 -0
- package/dist/test/plan/plan-records.examples.d.ts +3 -0
- package/dist/test/plan/plan-records.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-records.examples.js +45 -0
- package/dist/test/plan/plan-records.examples.js.map +1 -0
- package/dist/test/plan/plan-windows.examples.d.ts +588 -0
- package/dist/test/plan/plan-windows.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-windows.examples.js +170 -0
- package/dist/test/plan/plan-windows.examples.js.map +1 -0
- package/dist/test/plan/plan.examples.d.ts +8095 -0
- package/dist/test/plan/plan.examples.d.ts.map +1 -0
- package/dist/test/plan/plan.examples.js +2500 -0
- package/dist/test/plan/plan.examples.js.map +1 -0
- package/dist/test/roster/domain.examples.d.ts +367 -0
- package/dist/test/roster/domain.examples.d.ts.map +1 -0
- package/dist/test/roster/domain.examples.js +72 -0
- package/dist/test/roster/domain.examples.js.map +1 -0
- package/dist/test/roster/roster-records.examples.d.ts +729 -0
- package/dist/test/roster/roster-records.examples.d.ts.map +1 -0
- package/dist/test/roster/roster-records.examples.js +86 -0
- package/dist/test/roster/roster-records.examples.js.map +1 -0
- package/dist/test/roster/roster.examples.d.ts +750 -0
- package/dist/test/roster/roster.examples.d.ts.map +1 -0
- package/dist/test/roster/roster.examples.js +198 -0
- package/dist/test/roster/roster.examples.js.map +1 -0
- package/dist/test/roster/warehouse.d.ts +87 -0
- package/dist/test/roster/warehouse.d.ts.map +1 -0
- package/dist/test/roster/warehouse.js +883 -0
- package/dist/test/roster/warehouse.js.map +1 -0
- package/dist/test/sheet/sheet-link.examples.d.ts +7 -0
- package/dist/test/sheet/sheet-link.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-link.examples.js +41 -0
- package/dist/test/sheet/sheet-link.examples.js.map +1 -0
- package/dist/test/sheet/sheet-records.examples.d.ts +421 -0
- package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-records.examples.js +79 -0
- package/dist/test/sheet/sheet-records.examples.js.map +1 -0
- package/dist/test/sheet/sheet-transactions.examples.d.ts +7 -0
- package/dist/test/sheet/sheet-transactions.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet-transactions.examples.js +58 -0
- package/dist/test/sheet/sheet-transactions.examples.js.map +1 -0
- package/dist/test/sheet/sheet.examples.d.ts +5562 -0
- package/dist/test/sheet/sheet.examples.d.ts.map +1 -0
- package/dist/test/sheet/sheet.examples.js +1178 -0
- package/dist/test/sheet/sheet.examples.js.map +1 -0
- package/dist/test/studio/studio.examples.d.ts.map +1 -1
- package/dist/test/studio/studio.examples.js +11 -11
- package/dist/test/studio/studio.examples.js.map +1 -1
- package/package.json +12 -9
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Flowchart.over(states, { … })` (#1244, `Flowchart Builder Spec.md` §3.4,
|
|
7
|
+
* §4.3): one flow built from an app's own tables — its states, its
|
|
8
|
+
* transitions, its lanes and its decisions — through the row mappers the
|
|
9
|
+
* flowchart took its tables with before it held flows. A flow computed from
|
|
10
|
+
* the app's data — transitions mined from scans, narrowed by a slice — is
|
|
11
|
+
* shown this way, as `<Flowchart data={Flowchart.over(…)}>`, as `Plan.over`
|
|
12
|
+
* lays rows out over a dataset.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import { ArrayType, DateTimeType, IntegerType, OptionType, StringType, StructType, type ExprType, type FloatType, type SubtypeExprOrValue, type TypeOf } from "@elaraai/east";
|
|
17
|
+
import { FlowchartFlowType, FlowchartLaneType, FlowchartLinkKindType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType } from "./types.js";
|
|
18
|
+
import type { FlowchartLinkKindLiteral } from "./values.js";
|
|
19
|
+
/**
|
|
20
|
+
* The struct element type of a `SubtypeExprOrValue<ArrayType<StructType>>`.
|
|
21
|
+
*/
|
|
22
|
+
export type RowElement<T extends SubtypeExprOrValue<ArrayType<StructType>>> = TypeOf<T> extends ArrayType<infer S> ? (S extends StructType ? S : never) : never;
|
|
23
|
+
/**
|
|
24
|
+
* Fields the `state` mapper returns — one state node, before defaults.
|
|
25
|
+
*/
|
|
26
|
+
export interface FlowchartStateFields {
|
|
27
|
+
/** Short mono code — the node identity ("IND"). */
|
|
28
|
+
key: SubtypeExprOrValue<StringType>;
|
|
29
|
+
/** Optional display label under the code. */
|
|
30
|
+
label?: SubtypeExprOrValue<StringType>;
|
|
31
|
+
/** The lane (ordered phase) this state belongs to. */
|
|
32
|
+
lane: SubtypeExprOrValue<StringType>;
|
|
33
|
+
/** Optional state-class member count → the ×N badge (an Option so per-row absence is expressible). */
|
|
34
|
+
members?: SubtypeExprOrValue<OptionType<IntegerType>>;
|
|
35
|
+
/** Optional free-text notes surfaced on hover / inspector. */
|
|
36
|
+
notes?: SubtypeExprOrValue<StringType>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Evidence fields the `link` mapper may return — all optional, per-row
|
|
40
|
+
* absence via each field's Option.
|
|
41
|
+
*/
|
|
42
|
+
export interface FlowchartEvidenceFields {
|
|
43
|
+
/** Total measured volume behind the arrow (drives stroke weight + badge). */
|
|
44
|
+
volume?: SubtypeExprOrValue<OptionType<FloatType>>;
|
|
45
|
+
/** Event count behind the arrow (e.g. cage moves). */
|
|
46
|
+
count?: SubtypeExprOrValue<OptionType<IntegerType>>;
|
|
47
|
+
/** When the evidence was measured. */
|
|
48
|
+
measuredAt?: SubtypeExprOrValue<OptionType<DateTimeType>>;
|
|
49
|
+
/** Volume unit suffix for badges ("parcels"). */
|
|
50
|
+
unit?: SubtypeExprOrValue<StringType>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Fields the `link` mapper returns — one transition, before defaults.
|
|
54
|
+
*/
|
|
55
|
+
export interface FlowchartLinkFields {
|
|
56
|
+
/** Optional stable identity (selection / delete events); default derived from endpoints. */
|
|
57
|
+
key?: SubtypeExprOrValue<StringType>;
|
|
58
|
+
/** Source state key. */
|
|
59
|
+
from: SubtypeExprOrValue<StringType>;
|
|
60
|
+
/** Target state key. */
|
|
61
|
+
to: SubtypeExprOrValue<StringType>;
|
|
62
|
+
/** Optional kind — "planned" (default, solid) | "observed" (dashed). */
|
|
63
|
+
kind?: SubtypeExprOrValue<FlowchartLinkKindType> | FlowchartLinkKindLiteral;
|
|
64
|
+
/** Optional decision trigger key (0..1 per link) → the lettered diamond. */
|
|
65
|
+
trigger?: SubtypeExprOrValue<OptionType<StringType>>;
|
|
66
|
+
/** Optional imported evidence (weight, badges, provenance). */
|
|
67
|
+
evidence?: FlowchartEvidenceFields;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Fields the `lane` mapper returns — one ordered phase band.
|
|
71
|
+
*/
|
|
72
|
+
export interface FlowchartLaneFields {
|
|
73
|
+
/** Lane identity referenced by states. */
|
|
74
|
+
key: SubtypeExprOrValue<StringType>;
|
|
75
|
+
/** Optional band header label (defaults to the key, uppercased). */
|
|
76
|
+
label?: SubtypeExprOrValue<StringType>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Fields the `trigger` mapper returns — one decision trigger.
|
|
80
|
+
*/
|
|
81
|
+
export interface FlowchartTriggerFields {
|
|
82
|
+
/** Trigger identity referenced by links. */
|
|
83
|
+
key: SubtypeExprOrValue<StringType>;
|
|
84
|
+
/** Decision name ("route"). */
|
|
85
|
+
label: SubtypeExprOrValue<StringType>;
|
|
86
|
+
/** Optional diamond letter (default: first letter of the label). */
|
|
87
|
+
letter?: SubtypeExprOrValue<StringType>;
|
|
88
|
+
/** Optional owning role / system ("sort-planner"). */
|
|
89
|
+
owner?: SubtypeExprOrValue<StringType>;
|
|
90
|
+
/** Optional state keys queued at the decision. */
|
|
91
|
+
queue?: SubtypeExprOrValue<ArrayType<StringType>>;
|
|
92
|
+
/** Optional outcome summary line ("CH* (×14 chutes)"). */
|
|
93
|
+
outcomes?: SubtypeExprOrValue<StringType>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A literal lanes input — plain `{ key, label? }` entries in band order.
|
|
97
|
+
*/
|
|
98
|
+
export type FlowchartLaneLiteral = {
|
|
99
|
+
key: string;
|
|
100
|
+
label?: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The tables beside the states `Flowchart.over` builds a flow from, and the
|
|
104
|
+
* row mappers that read them.
|
|
105
|
+
*
|
|
106
|
+
* @typeParam S - The states-table row struct
|
|
107
|
+
* @typeParam L - The links-table row struct
|
|
108
|
+
* @typeParam N - The lanes-table row struct
|
|
109
|
+
* @typeParam T - The triggers-table row struct
|
|
110
|
+
*/
|
|
111
|
+
export interface FlowchartTables<S extends StructType = StructType, L extends StructType = StructType, N extends StructType = StructType, T extends StructType = StructType> {
|
|
112
|
+
/** Row mapper from a state row to node fields — omit when rows are already `Flowchart.Types.State`. */
|
|
113
|
+
state?: (row: ExprType<S>) => FlowchartStateFields | ExprType<FlowchartStateType>;
|
|
114
|
+
/** Row mapper from a link row to transition fields — omit when rows are already `Flowchart.Types.Link`. */
|
|
115
|
+
link?: (row: ExprType<L>) => FlowchartLinkFields | ExprType<FlowchartLinkType>;
|
|
116
|
+
/** Row mapper from a lane row to band fields — omit for literal `{ key, label? }` arrays or `Flowchart.Types.Lane` rows. */
|
|
117
|
+
lane?: (row: ExprType<N>) => FlowchartLaneFields | ExprType<FlowchartLaneType>;
|
|
118
|
+
/** Optional decision-trigger rows; links reference them by key. */
|
|
119
|
+
triggers?: SubtypeExprOrValue<ArrayType<StructType>>;
|
|
120
|
+
/** Row mapper from a trigger row — omit when rows are already `Flowchart.Types.Trigger`. */
|
|
121
|
+
trigger?: (row: ExprType<T>) => FlowchartTriggerFields | ExprType<FlowchartTriggerType>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Builds one flow from an app's own tables — its states, its transitions, its
|
|
125
|
+
* lanes and, optionally, its decisions — each read through its row mapper, or
|
|
126
|
+
* taken as it is when its rows are already the flowchart's own type.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* The flow has no `description`. Show it with
|
|
130
|
+
* `<Flowchart data={Flowchart.over(…)}>`, read only, or with the host's
|
|
131
|
+
* `onApply`; narrow it with a slice by feeding the transitions through
|
|
132
|
+
* `Slice.rows`, and give the flowchart that `slice`.
|
|
133
|
+
*
|
|
134
|
+
* @typeParam S - The states-table input
|
|
135
|
+
* @typeParam L - The links-table input
|
|
136
|
+
* @typeParam N - The lanes-table input
|
|
137
|
+
* @typeParam T - The triggers-table input
|
|
138
|
+
* @param states - The state rows
|
|
139
|
+
* @param tables - The `links` and `lanes` tables (required), the `triggers`
|
|
140
|
+
* table, and each table's row mapper: `state`, `link`, `lane`, `trigger`
|
|
141
|
+
* ({@link FlowchartTables})
|
|
142
|
+
* @returns An East expression of `Flowchart.Types.Flow`
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* // .tsx file with the `@jsxImportSource @elaraai/e3-ui` pragma
|
|
147
|
+
* import { ArrayType, DateTimeType, East, FloatType, IntegerType, OptionType, StringType, StructType, none, some, variant } from "@elaraai/east";
|
|
148
|
+
* import { Box, Reactive, Slice, UIComponentType } from "@elaraai/east-ui";
|
|
149
|
+
* import { Data, Flowchart } from "@elaraai/e3-ui";
|
|
150
|
+
* import e3 from "@elaraai/e3";
|
|
151
|
+
*
|
|
152
|
+
* export const DepotState = StructType({ code: StringType, name: StringType, phase: StringType, slots: OptionType(IntegerType) });
|
|
153
|
+
* export const depotStates = e3.input("flowchart_depot_states", ArrayType(DepotState), variant("value", [
|
|
154
|
+
* { code: "ARV", name: "Arrived", phase: "intake", slots: none },
|
|
155
|
+
* { code: "SCN", name: "Scanned", phase: "intake", slots: none },
|
|
156
|
+
* { code: "IND", name: "Inducting", phase: "induct", slots: none },
|
|
157
|
+
* { code: "LBL", name: "Labelled", phase: "induct", slots: none },
|
|
158
|
+
* { code: "CH*", name: "Sort chutes (class)", phase: "sort", slots: some(14n) },
|
|
159
|
+
* { code: "SRD", name: "Sorted", phase: "sort", slots: none },
|
|
160
|
+
* { code: "HLD", name: "Held", phase: "hold", slots: none },
|
|
161
|
+
* { code: "CLR", name: "Cleared", phase: "hold", slots: none },
|
|
162
|
+
* { code: "LDD", name: "Loaded", phase: "dispatch", slots: none },
|
|
163
|
+
* { code: "DSP", name: "Dispatched", phase: "dispatch", slots: none },
|
|
164
|
+
* ]));
|
|
165
|
+
* export const ScanTransition = StructType({
|
|
166
|
+
* id: StringType, src: StringType, dst: StringType, kind: Flowchart.Types.Kind,
|
|
167
|
+
* trigger: OptionType(StringType), parcels: OptionType(FloatType), n: OptionType(IntegerType),
|
|
168
|
+
* at: DateTimeType, service: StringType, units: ArrayType(StringType),
|
|
169
|
+
* });
|
|
170
|
+
* export const scanTransitions = e3.input("flowchart_depot_scans", ArrayType(ScanTransition), variant("value", [
|
|
171
|
+
* { id: "l1", src: "ARV", dst: "SCN", kind: variant("planned", null), trigger: none, parcels: some(18460.0), n: some(412n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
|
|
172
|
+
* { id: "l2", src: "SCN", dst: "IND", kind: variant("planned", null), trigger: none, parcels: some(7720.0), n: some(171n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
|
|
173
|
+
* { id: "l3", src: "IND", dst: "IND", kind: variant("planned", null), trigger: none, parcels: none, n: some(2n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
|
|
174
|
+
* { id: "l4", src: "IND", dst: "CH*", kind: variant("planned", null), trigger: some("route"), parcels: some(17350.0), n: some(386n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C", "T"] },
|
|
175
|
+
* { id: "l5", src: "CH*", dst: "SRD", kind: variant("planned", null), trigger: none, parcels: some(17210.0), n: some(383n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
|
|
176
|
+
* { id: "l6", src: "SRD", dst: "HLD", kind: variant("observed", null), trigger: none, parcels: some(1080.0), n: some(24n), at: new Date("2026-06-30T00:00:00Z"), service: "express", units: ["T"] },
|
|
177
|
+
* { id: "l7", src: "HLD", dst: "CLR", kind: variant("planned", null), trigger: some("customs"), parcels: some(8350.0), n: some(186n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
|
|
178
|
+
* { id: "l8", src: "CLR", dst: "LDD", kind: variant("planned", null), trigger: none, parcels: some(8240.0), n: some(183n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
|
|
179
|
+
* { id: "l9", src: "LDD", dst: "DSP", kind: variant("planned", null), trigger: none, parcels: some(8160.0), n: some(181n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
|
|
180
|
+
* { id: "l10", src: "DSP", dst: "DLV", kind: variant("planned", null), trigger: none, parcels: none, n: none, at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
|
|
181
|
+
* ]));
|
|
182
|
+
* export const DepotDecision = StructType({ id: StringType, name: StringType, who: StringType });
|
|
183
|
+
* export const depotDecisions = e3.input("flowchart_depot_decisions", ArrayType(DepotDecision), variant("value", [
|
|
184
|
+
* { id: "route", name: "route", who: "sort-planner" },
|
|
185
|
+
* { id: "customs", name: "customs", who: "customs-desk" },
|
|
186
|
+
* ]));
|
|
187
|
+
*
|
|
188
|
+
* const flowchart = East.function([], UIComponentType, (_$) => (
|
|
189
|
+
* <Reactive>{$ => {
|
|
190
|
+
* const states = $.let(Data.bind(depotStates));
|
|
191
|
+
* const scans = $.let(Data.bind(scanTransitions));
|
|
192
|
+
* const decisions = $.let(Data.bind(depotDecisions));
|
|
193
|
+
* const slice = $.let(Slice.bind("flowchart-depot", scans.read(), {
|
|
194
|
+
* fields: {
|
|
195
|
+
* service: { label: "Service" },
|
|
196
|
+
* src: { label: "From" },
|
|
197
|
+
* dst: { label: "To" },
|
|
198
|
+
* },
|
|
199
|
+
* search: ["src", "dst"],
|
|
200
|
+
* }));
|
|
201
|
+
* return (
|
|
202
|
+
* <Box height="600px">
|
|
203
|
+
* <Flowchart
|
|
204
|
+
* data={Flowchart.over(states.read(), {
|
|
205
|
+
* state: s => ({ key: s.code, label: s.name, lane: s.phase, members: s.slots }),
|
|
206
|
+
* links: Slice.rows(slice),
|
|
207
|
+
* link: l => ({
|
|
208
|
+
* key: l.id, from: l.src, to: l.dst, kind: l.kind, trigger: l.trigger,
|
|
209
|
+
* evidence: { volume: l.parcels, count: l.n, measuredAt: some(l.at), unit: "parcels" },
|
|
210
|
+
* }),
|
|
211
|
+
* lanes: [
|
|
212
|
+
* { key: "intake", label: "Intake" }, { key: "induct", label: "Induct" },
|
|
213
|
+
* { key: "sort", label: "Sort" }, { key: "hold", label: "Hold" },
|
|
214
|
+
* { key: "dispatch", label: "Dispatch" },
|
|
215
|
+
* ],
|
|
216
|
+
* triggers: decisions.read(),
|
|
217
|
+
* trigger: t => ({ key: t.id, label: t.name, owner: t.who }),
|
|
218
|
+
* })}
|
|
219
|
+
* slice={slice} affordances={["filter", "search"]}
|
|
220
|
+
* freshness={{ label: "evidence-2026.06", date: new Date("2026-06-30T00:00:00Z") }}
|
|
221
|
+
* name="scans"
|
|
222
|
+
* />
|
|
223
|
+
* </Box>
|
|
224
|
+
* );
|
|
225
|
+
* }}</Reactive>
|
|
226
|
+
* ));
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export declare function flowchartOver<S extends SubtypeExprOrValue<ArrayType<StructType>>, L extends SubtypeExprOrValue<ArrayType<StructType>>, N extends SubtypeExprOrValue<ArrayType<StructType>> = [], T extends SubtypeExprOrValue<ArrayType<StructType>> = []>(states: S, tables: FlowchartTables<RowElement<S>, RowElement<L>, RowElement<N>, RowElement<T>> & {
|
|
230
|
+
links: L;
|
|
231
|
+
lanes: N | readonly FlowchartLaneLiteral[];
|
|
232
|
+
triggers?: T;
|
|
233
|
+
}): ExprType<FlowchartFlowType>;
|
|
234
|
+
//# sourceMappingURL=over.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"over.d.ts","sourceRoot":"","sources":["../../../src/flowchart/over.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EAGZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EAIV,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,MAAM,EACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAEH,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,kBAAkB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IACtE,MAAM,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,UAAU,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAMtF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,mDAAmD;IACnD,GAAG,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACpC,6CAA6C;IAC7C,KAAK,CAAC,EAAE,kBAAkB,CAAC,UAAU,CA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
+
* `Flowchart.over(states, { … })` (#1244, `Flowchart Builder Spec.md` §3.4,
|
|
7
|
+
* §4.3): one flow built from an app's own tables — its states, its
|
|
8
|
+
* transitions, its lanes and its decisions — through the row mappers the
|
|
9
|
+
* flowchart took its tables with before it held flows. A flow computed from
|
|
10
|
+
* the app's data — transitions mined from scans, narrowed by a slice — is
|
|
11
|
+
* shown this way, as `<Flowchart data={Flowchart.over(…)}>`, as `Plan.over`
|
|
12
|
+
* lays rows out over a dataset.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import { ArrayType, DateTimeType, East, Expr, IntegerType, OptionType, StringType, StructType, none, some, variant, } from "@elaraai/east";
|
|
17
|
+
import { mapRows } from "@elaraai/east-ui/internal";
|
|
18
|
+
import { FlowchartEvidenceType, FlowchartFlowType, FlowchartLaneType, FlowchartLinkKindType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType, } from "./types.js";
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Flowchart.over
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/** Resolves a kind literal / value into the option envelope. */
|
|
23
|
+
function kindOption(kind) {
|
|
24
|
+
if (kind === undefined)
|
|
25
|
+
return East.value(none, OptionType(FlowchartLinkKindType));
|
|
26
|
+
if (typeof kind === "string")
|
|
27
|
+
return East.value(some(variant(kind, null)), OptionType(FlowchartLinkKindType));
|
|
28
|
+
return East.value(some(kind), OptionType(FlowchartLinkKindType));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds one flow from an app's own tables — its states, its transitions, its
|
|
32
|
+
* lanes and, optionally, its decisions — each read through its row mapper, or
|
|
33
|
+
* taken as it is when its rows are already the flowchart's own type.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* The flow has no `description`. Show it with
|
|
37
|
+
* `<Flowchart data={Flowchart.over(…)}>`, read only, or with the host's
|
|
38
|
+
* `onApply`; narrow it with a slice by feeding the transitions through
|
|
39
|
+
* `Slice.rows`, and give the flowchart that `slice`.
|
|
40
|
+
*
|
|
41
|
+
* @typeParam S - The states-table input
|
|
42
|
+
* @typeParam L - The links-table input
|
|
43
|
+
* @typeParam N - The lanes-table input
|
|
44
|
+
* @typeParam T - The triggers-table input
|
|
45
|
+
* @param states - The state rows
|
|
46
|
+
* @param tables - The `links` and `lanes` tables (required), the `triggers`
|
|
47
|
+
* table, and each table's row mapper: `state`, `link`, `lane`, `trigger`
|
|
48
|
+
* ({@link FlowchartTables})
|
|
49
|
+
* @returns An East expression of `Flowchart.Types.Flow`
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* // .tsx file with the `@jsxImportSource @elaraai/e3-ui` pragma
|
|
54
|
+
* import { ArrayType, DateTimeType, East, FloatType, IntegerType, OptionType, StringType, StructType, none, some, variant } from "@elaraai/east";
|
|
55
|
+
* import { Box, Reactive, Slice, UIComponentType } from "@elaraai/east-ui";
|
|
56
|
+
* import { Data, Flowchart } from "@elaraai/e3-ui";
|
|
57
|
+
* import e3 from "@elaraai/e3";
|
|
58
|
+
*
|
|
59
|
+
* export const DepotState = StructType({ code: StringType, name: StringType, phase: StringType, slots: OptionType(IntegerType) });
|
|
60
|
+
* export const depotStates = e3.input("flowchart_depot_states", ArrayType(DepotState), variant("value", [
|
|
61
|
+
* { code: "ARV", name: "Arrived", phase: "intake", slots: none },
|
|
62
|
+
* { code: "SCN", name: "Scanned", phase: "intake", slots: none },
|
|
63
|
+
* { code: "IND", name: "Inducting", phase: "induct", slots: none },
|
|
64
|
+
* { code: "LBL", name: "Labelled", phase: "induct", slots: none },
|
|
65
|
+
* { code: "CH*", name: "Sort chutes (class)", phase: "sort", slots: some(14n) },
|
|
66
|
+
* { code: "SRD", name: "Sorted", phase: "sort", slots: none },
|
|
67
|
+
* { code: "HLD", name: "Held", phase: "hold", slots: none },
|
|
68
|
+
* { code: "CLR", name: "Cleared", phase: "hold", slots: none },
|
|
69
|
+
* { code: "LDD", name: "Loaded", phase: "dispatch", slots: none },
|
|
70
|
+
* { code: "DSP", name: "Dispatched", phase: "dispatch", slots: none },
|
|
71
|
+
* ]));
|
|
72
|
+
* export const ScanTransition = StructType({
|
|
73
|
+
* id: StringType, src: StringType, dst: StringType, kind: Flowchart.Types.Kind,
|
|
74
|
+
* trigger: OptionType(StringType), parcels: OptionType(FloatType), n: OptionType(IntegerType),
|
|
75
|
+
* at: DateTimeType, service: StringType, units: ArrayType(StringType),
|
|
76
|
+
* });
|
|
77
|
+
* export const scanTransitions = e3.input("flowchart_depot_scans", ArrayType(ScanTransition), variant("value", [
|
|
78
|
+
* { id: "l1", src: "ARV", dst: "SCN", kind: variant("planned", null), trigger: none, parcels: some(18460.0), n: some(412n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
|
|
79
|
+
* { id: "l2", src: "SCN", dst: "IND", kind: variant("planned", null), trigger: none, parcels: some(7720.0), n: some(171n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
|
|
80
|
+
* { id: "l3", src: "IND", dst: "IND", kind: variant("planned", null), trigger: none, parcels: none, n: some(2n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
|
|
81
|
+
* { id: "l4", src: "IND", dst: "CH*", kind: variant("planned", null), trigger: some("route"), parcels: some(17350.0), n: some(386n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C", "T"] },
|
|
82
|
+
* { id: "l5", src: "CH*", dst: "SRD", kind: variant("planned", null), trigger: none, parcels: some(17210.0), n: some(383n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
|
|
83
|
+
* { id: "l6", src: "SRD", dst: "HLD", kind: variant("observed", null), trigger: none, parcels: some(1080.0), n: some(24n), at: new Date("2026-06-30T00:00:00Z"), service: "express", units: ["T"] },
|
|
84
|
+
* { id: "l7", src: "HLD", dst: "CLR", kind: variant("planned", null), trigger: some("customs"), parcels: some(8350.0), n: some(186n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
|
|
85
|
+
* { id: "l8", src: "CLR", dst: "LDD", kind: variant("planned", null), trigger: none, parcels: some(8240.0), n: some(183n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
|
|
86
|
+
* { id: "l9", src: "LDD", dst: "DSP", kind: variant("planned", null), trigger: none, parcels: some(8160.0), n: some(181n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
|
|
87
|
+
* { id: "l10", src: "DSP", dst: "DLV", kind: variant("planned", null), trigger: none, parcels: none, n: none, at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
|
|
88
|
+
* ]));
|
|
89
|
+
* export const DepotDecision = StructType({ id: StringType, name: StringType, who: StringType });
|
|
90
|
+
* export const depotDecisions = e3.input("flowchart_depot_decisions", ArrayType(DepotDecision), variant("value", [
|
|
91
|
+
* { id: "route", name: "route", who: "sort-planner" },
|
|
92
|
+
* { id: "customs", name: "customs", who: "customs-desk" },
|
|
93
|
+
* ]));
|
|
94
|
+
*
|
|
95
|
+
* const flowchart = East.function([], UIComponentType, (_$) => (
|
|
96
|
+
* <Reactive>{$ => {
|
|
97
|
+
* const states = $.let(Data.bind(depotStates));
|
|
98
|
+
* const scans = $.let(Data.bind(scanTransitions));
|
|
99
|
+
* const decisions = $.let(Data.bind(depotDecisions));
|
|
100
|
+
* const slice = $.let(Slice.bind("flowchart-depot", scans.read(), {
|
|
101
|
+
* fields: {
|
|
102
|
+
* service: { label: "Service" },
|
|
103
|
+
* src: { label: "From" },
|
|
104
|
+
* dst: { label: "To" },
|
|
105
|
+
* },
|
|
106
|
+
* search: ["src", "dst"],
|
|
107
|
+
* }));
|
|
108
|
+
* return (
|
|
109
|
+
* <Box height="600px">
|
|
110
|
+
* <Flowchart
|
|
111
|
+
* data={Flowchart.over(states.read(), {
|
|
112
|
+
* state: s => ({ key: s.code, label: s.name, lane: s.phase, members: s.slots }),
|
|
113
|
+
* links: Slice.rows(slice),
|
|
114
|
+
* link: l => ({
|
|
115
|
+
* key: l.id, from: l.src, to: l.dst, kind: l.kind, trigger: l.trigger,
|
|
116
|
+
* evidence: { volume: l.parcels, count: l.n, measuredAt: some(l.at), unit: "parcels" },
|
|
117
|
+
* }),
|
|
118
|
+
* lanes: [
|
|
119
|
+
* { key: "intake", label: "Intake" }, { key: "induct", label: "Induct" },
|
|
120
|
+
* { key: "sort", label: "Sort" }, { key: "hold", label: "Hold" },
|
|
121
|
+
* { key: "dispatch", label: "Dispatch" },
|
|
122
|
+
* ],
|
|
123
|
+
* triggers: decisions.read(),
|
|
124
|
+
* trigger: t => ({ key: t.id, label: t.name, owner: t.who }),
|
|
125
|
+
* })}
|
|
126
|
+
* slice={slice} affordances={["filter", "search"]}
|
|
127
|
+
* freshness={{ label: "evidence-2026.06", date: new Date("2026-06-30T00:00:00Z") }}
|
|
128
|
+
* name="scans"
|
|
129
|
+
* />
|
|
130
|
+
* </Box>
|
|
131
|
+
* );
|
|
132
|
+
* }}</Reactive>
|
|
133
|
+
* ));
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export function flowchartOver(states, tables) {
|
|
137
|
+
const config = tables;
|
|
138
|
+
const stateMapper = config.state;
|
|
139
|
+
const resolvedStates = stateMapper === undefined
|
|
140
|
+
? East.value(states, ArrayType(FlowchartStateType))
|
|
141
|
+
: mapRows(East.value(states), FlowchartStateType, (row) => {
|
|
142
|
+
const r = stateMapper(row);
|
|
143
|
+
if (r instanceof Expr)
|
|
144
|
+
return East.value(r, FlowchartStateType);
|
|
145
|
+
return East.value({
|
|
146
|
+
key: r.key,
|
|
147
|
+
label: r.label !== undefined ? some(r.label) : none,
|
|
148
|
+
lane: r.lane,
|
|
149
|
+
members: r.members !== undefined ? r.members : none,
|
|
150
|
+
notes: r.notes !== undefined ? some(r.notes) : none,
|
|
151
|
+
}, FlowchartStateType);
|
|
152
|
+
});
|
|
153
|
+
const linkMapper = config.link;
|
|
154
|
+
const resolvedLinks = linkMapper === undefined
|
|
155
|
+
? East.value(config.links, ArrayType(FlowchartLinkType))
|
|
156
|
+
: mapRows(East.value(config.links), FlowchartLinkType, (row) => {
|
|
157
|
+
const r = linkMapper(row);
|
|
158
|
+
if (r instanceof Expr)
|
|
159
|
+
return East.value(r, FlowchartLinkType);
|
|
160
|
+
return East.value({
|
|
161
|
+
key: r.key !== undefined ? some(r.key) : none,
|
|
162
|
+
from: r.from,
|
|
163
|
+
to: r.to,
|
|
164
|
+
kind: kindOption(r.kind),
|
|
165
|
+
trigger: r.trigger !== undefined ? r.trigger : none,
|
|
166
|
+
evidence: r.evidence !== undefined
|
|
167
|
+
? some(East.value({
|
|
168
|
+
volume: r.evidence.volume !== undefined ? r.evidence.volume : none,
|
|
169
|
+
count: r.evidence.count !== undefined ? r.evidence.count : none,
|
|
170
|
+
measuredAt: r.evidence.measuredAt !== undefined ? r.evidence.measuredAt : none,
|
|
171
|
+
unit: r.evidence.unit !== undefined ? some(r.evidence.unit) : none,
|
|
172
|
+
}, FlowchartEvidenceType))
|
|
173
|
+
: none,
|
|
174
|
+
}, FlowchartLinkType);
|
|
175
|
+
});
|
|
176
|
+
const laneMapper = config.lane;
|
|
177
|
+
const lanes = config.lanes;
|
|
178
|
+
const resolvedLanes = laneMapper !== undefined
|
|
179
|
+
? mapRows(East.value(lanes), FlowchartLaneType, (row) => {
|
|
180
|
+
const r = laneMapper(row);
|
|
181
|
+
if (r instanceof Expr)
|
|
182
|
+
return East.value(r, FlowchartLaneType);
|
|
183
|
+
return East.value({
|
|
184
|
+
key: r.key,
|
|
185
|
+
label: r.label !== undefined ? some(r.label) : none,
|
|
186
|
+
}, FlowchartLaneType);
|
|
187
|
+
})
|
|
188
|
+
: Array.isArray(lanes)
|
|
189
|
+
? East.value(lanes.map(l => ({
|
|
190
|
+
key: l.key,
|
|
191
|
+
label: l.label !== undefined ? some(l.label) : none,
|
|
192
|
+
})), ArrayType(FlowchartLaneType))
|
|
193
|
+
: East.value(lanes, ArrayType(FlowchartLaneType));
|
|
194
|
+
const triggerMapper = config.trigger;
|
|
195
|
+
const resolvedTriggers = config.triggers === undefined
|
|
196
|
+
? East.value([], ArrayType(FlowchartTriggerType))
|
|
197
|
+
: triggerMapper === undefined
|
|
198
|
+
? East.value(config.triggers, ArrayType(FlowchartTriggerType))
|
|
199
|
+
: mapRows(East.value(config.triggers), FlowchartTriggerType, (row) => {
|
|
200
|
+
const r = triggerMapper(row);
|
|
201
|
+
if (r instanceof Expr)
|
|
202
|
+
return East.value(r, FlowchartTriggerType);
|
|
203
|
+
return East.value({
|
|
204
|
+
key: r.key,
|
|
205
|
+
label: r.label,
|
|
206
|
+
letter: r.letter !== undefined ? some(r.letter) : none,
|
|
207
|
+
owner: r.owner !== undefined ? some(r.owner) : none,
|
|
208
|
+
queue: r.queue !== undefined ? some(East.value(r.queue, ArrayType(StringType))) : none,
|
|
209
|
+
outcomes: r.outcomes !== undefined ? some(r.outcomes) : none,
|
|
210
|
+
}, FlowchartTriggerType);
|
|
211
|
+
});
|
|
212
|
+
return East.value({
|
|
213
|
+
description: none,
|
|
214
|
+
lanes: resolvedLanes,
|
|
215
|
+
states: resolvedStates,
|
|
216
|
+
links: resolvedLinks,
|
|
217
|
+
triggers: resolvedTriggers,
|
|
218
|
+
}, FlowchartFlowType);
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=over.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"over.js","sourceRoot":"","sources":["../../../src/flowchart/over.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,OAAO,GAKV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EACH,qBAAqB,EACrB,iBA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 -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Flowchart.patch(T, { … })` (#1244, `Flowchart Builder Spec.md` §4.3): a
|
|
7
|
+
* patch over one of a flow's rows — a state, a transition, a lane or a
|
|
8
|
+
* decision — every field an `Option`, the fields it leaves out `none`. It is
|
|
9
|
+
* the row patch `Sheet.patch` and `Schedule.patch` build: a library card's
|
|
10
|
+
* `drop` returns one, the fields a card sets where it lands, and the patch's
|
|
11
|
+
* type names the row it lands on.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import { type ExprType } from "@elaraai/east";
|
|
16
|
+
import { type SchedulePatchInput, type SchedulePatchOf } from "../schedule/patch.js";
|
|
17
|
+
import { FlowchartLaneType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType } from "./types.js";
|
|
18
|
+
/** A flow's row types: a state, a transition, a lane and a decision — what `Flowchart.patch` patches. */
|
|
19
|
+
export type FlowchartRowType = FlowchartStateType | FlowchartLinkType | FlowchartLaneType | FlowchartTriggerType;
|
|
20
|
+
/**
|
|
21
|
+
* The TS type of `Flowchart.Types.Patch(R)`: every field of the row as an `Option`.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam R - The row type
|
|
24
|
+
*/
|
|
25
|
+
export type FlowchartPatchOf<R extends FlowchartRowType> = SchedulePatchOf<R>;
|
|
26
|
+
/**
|
|
27
|
+
* The literal-record input of `Flowchart.patch(R, …)`: every field of the row
|
|
28
|
+
* optional, each a literal or an expression of the field's type; a field left
|
|
29
|
+
* out is `none`.
|
|
30
|
+
*
|
|
31
|
+
* @typeParam R - The row type
|
|
32
|
+
*/
|
|
33
|
+
export type FlowchartPatchInput<R extends FlowchartRowType> = SchedulePatchInput<R>;
|
|
34
|
+
/**
|
|
35
|
+
* `Flowchart.Types.Patch(R)`: a patch over one of a flow's rows — every field
|
|
36
|
+
* of the row as an `Option`, `none` leaving the row's field as it is.
|
|
37
|
+
*
|
|
38
|
+
* @typeParam R - The row type
|
|
39
|
+
* @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
|
|
40
|
+
* @returns The patch type
|
|
41
|
+
* @throws {Error} When the type is none of a flow's rows
|
|
42
|
+
*/
|
|
43
|
+
export declare function FlowchartPatchTypeFor<R extends FlowchartRowType>(rowType: R): FlowchartPatchOf<R>;
|
|
44
|
+
/**
|
|
45
|
+
* Builds a patch over one of a flow's rows — `Flowchart.patch(R, { … })`: the
|
|
46
|
+
* fields it sets, every other field `none`. A library card's `drop` returns
|
|
47
|
+
* one: what a state template seeds the state it adds with, what a transition
|
|
48
|
+
* template sets on the transition it lands on, and what an author's card sets
|
|
49
|
+
* on the row its patch's type names.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* It is the row patch `Sheet.patch` builds, over a flow's own rows. A field
|
|
53
|
+
* that is an `Option` takes an `Option`: `label: some("Sorted")` sets a
|
|
54
|
+
* state's label, `label: none` clears it, and leaving `label` out leaves it as
|
|
55
|
+
* it is.
|
|
56
|
+
*
|
|
57
|
+
* @typeParam R - The row type
|
|
58
|
+
* @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
|
|
59
|
+
* @param record - The fields to set, each a literal or an expression of the field's type
|
|
60
|
+
* @returns An expression of `Flowchart.Types.Patch(R)`
|
|
61
|
+
* @throws {Error} When the type is none of a flow's rows
|
|
62
|
+
*/
|
|
63
|
+
export declare function flowchartPatch<R extends FlowchartRowType>(rowType: R, record: FlowchartPatchInput<R>): ExprType<FlowchartPatchOf<R>>;
|
|
64
|
+
//# sourceMappingURL=patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/flowchart/patch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAyC,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAuC,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE5G,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAEjH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,gBAAgB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAiBpF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAGjG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAGpI"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Flowchart.patch(T, { … })` (#1244, `Flowchart Builder Spec.md` §4.3): a
|
|
7
|
+
* patch over one of a flow's rows — a state, a transition, a lane or a
|
|
8
|
+
* decision — every field an `Option`, the fields it leaves out `none`. It is
|
|
9
|
+
* the row patch `Sheet.patch` and `Schedule.patch` build: a library card's
|
|
10
|
+
* `drop` returns one, the fields a card sets where it lands, and the patch's
|
|
11
|
+
* type names the row it lands on.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import { isTypeEqual, printType } from "@elaraai/east";
|
|
16
|
+
import { SchedulePatchTypeFor, schedulePatch } from "../schedule/patch.js";
|
|
17
|
+
import { FlowchartLaneType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType } from "./types.js";
|
|
18
|
+
/** The row types a patch is over, each with the name a refusal gives it. */
|
|
19
|
+
const ROWS = [
|
|
20
|
+
[FlowchartStateType, "State"],
|
|
21
|
+
[FlowchartLinkType, "Link"],
|
|
22
|
+
[FlowchartLaneType, "Lane"],
|
|
23
|
+
[FlowchartTriggerType, "Trigger"],
|
|
24
|
+
];
|
|
25
|
+
/** Refuses a type that is none of a flow's rows, naming where it was given. */
|
|
26
|
+
function checkRow(rowType, where) {
|
|
27
|
+
if (!ROWS.some(([row]) => isTypeEqual(row, rowType))) {
|
|
28
|
+
throw new Error(`${where}: patches one of a flow's rows — Flowchart.Types.${ROWS.map(([, name]) => name).join(", Flowchart.Types.")} — and this is ${printType(rowType)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `Flowchart.Types.Patch(R)`: a patch over one of a flow's rows — every field
|
|
33
|
+
* of the row as an `Option`, `none` leaving the row's field as it is.
|
|
34
|
+
*
|
|
35
|
+
* @typeParam R - The row type
|
|
36
|
+
* @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
|
|
37
|
+
* @returns The patch type
|
|
38
|
+
* @throws {Error} When the type is none of a flow's rows
|
|
39
|
+
*/
|
|
40
|
+
export function FlowchartPatchTypeFor(rowType) {
|
|
41
|
+
checkRow(rowType, "Flowchart.Types.Patch");
|
|
42
|
+
return SchedulePatchTypeFor(rowType);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Builds a patch over one of a flow's rows — `Flowchart.patch(R, { … })`: the
|
|
46
|
+
* fields it sets, every other field `none`. A library card's `drop` returns
|
|
47
|
+
* one: what a state template seeds the state it adds with, what a transition
|
|
48
|
+
* template sets on the transition it lands on, and what an author's card sets
|
|
49
|
+
* on the row its patch's type names.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* It is the row patch `Sheet.patch` builds, over a flow's own rows. A field
|
|
53
|
+
* that is an `Option` takes an `Option`: `label: some("Sorted")` sets a
|
|
54
|
+
* state's label, `label: none` clears it, and leaving `label` out leaves it as
|
|
55
|
+
* it is.
|
|
56
|
+
*
|
|
57
|
+
* @typeParam R - The row type
|
|
58
|
+
* @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
|
|
59
|
+
* @param record - The fields to set, each a literal or an expression of the field's type
|
|
60
|
+
* @returns An expression of `Flowchart.Types.Patch(R)`
|
|
61
|
+
* @throws {Error} When the type is none of a flow's rows
|
|
62
|
+
*/
|
|
63
|
+
export function flowchartPatch(rowType, record) {
|
|
64
|
+
checkRow(rowType, "Flowchart.patch");
|
|
65
|
+
return schedulePatch(rowType, record);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/flowchart/patch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAgC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAiD,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAqB5G,4EAA4E;AAC5E,MAAM,IAAI,GAA6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