@widgetic/workflows 0.1.1 → 0.2.0

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.
Files changed (140) hide show
  1. package/README.md +107 -46
  2. package/dist/api/apiContext.d.ts +4 -0
  3. package/dist/api/apiContext.js +17 -0
  4. package/dist/api/types.d.ts +168 -0
  5. package/dist/api/types.js +3 -0
  6. package/dist/api/workflowsApi.d.ts +109 -0
  7. package/dist/api/workflowsApi.js +657 -0
  8. package/dist/components/Workflows.svelte +41 -17
  9. package/dist/components/WorkflowsEmptyState.svelte +16 -5
  10. package/dist/components/WorkflowsEmptyState.svelte.d.ts +5 -16
  11. package/dist/components/WorkflowsHeader.svelte +2 -2
  12. package/dist/components/WorkflowsWorkspace.svelte +87 -0
  13. package/dist/components/WorkflowsWorkspace.svelte.d.ts +14 -0
  14. package/dist/components/canvas/AddBlockMenu.svelte +101 -0
  15. package/dist/components/canvas/AddBlockMenu.svelte.d.ts +5 -0
  16. package/dist/components/canvas/CanvasToolbar.svelte +95 -0
  17. package/dist/components/canvas/CanvasToolbar.svelte.d.ts +9 -0
  18. package/dist/components/canvas/CompositionNodeView.svelte +125 -0
  19. package/dist/components/canvas/CompositionNodeView.svelte.d.ts +5 -0
  20. package/dist/components/canvas/ConditionNodeView.svelte +95 -0
  21. package/dist/components/canvas/ConditionNodeView.svelte.d.ts +5 -0
  22. package/dist/components/canvas/HandlePoint.svelte +32 -0
  23. package/dist/components/canvas/HandlePoint.svelte.d.ts +14 -0
  24. package/dist/components/canvas/TriggerNodeView.svelte +75 -0
  25. package/dist/components/canvas/TriggerNodeView.svelte.d.ts +5 -0
  26. package/dist/components/canvas/WorkflowCanvas.svelte +380 -0
  27. package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +25 -0
  28. package/dist/components/canvas/WorkflowEdgeView.svelte +58 -0
  29. package/dist/components/canvas/WorkflowEdgeView.svelte.d.ts +4 -0
  30. package/dist/components/editor/EditorBanners.svelte +143 -0
  31. package/dist/components/editor/EditorBanners.svelte.d.ts +7 -0
  32. package/dist/components/editor/EditorCanvasArea.svelte +85 -0
  33. package/dist/components/editor/EditorCanvasArea.svelte.d.ts +3 -0
  34. package/dist/components/editor/EditorTabs.svelte +81 -0
  35. package/dist/components/editor/EditorTabs.svelte.d.ts +7 -0
  36. package/dist/components/editor/EditorTopBar.svelte +132 -0
  37. package/dist/components/editor/EditorTopBar.svelte.d.ts +9 -0
  38. package/dist/components/editor/RunsTab.svelte +256 -0
  39. package/dist/components/editor/RunsTab.svelte.d.ts +3 -0
  40. package/dist/components/editor/SettingsTab.svelte +180 -0
  41. package/dist/components/editor/SettingsTab.svelte.d.ts +7 -0
  42. package/dist/components/editor/WorkflowEditor.svelte +185 -0
  43. package/dist/components/editor/WorkflowEditor.svelte.d.ts +15 -0
  44. package/dist/components/index.d.ts +0 -2
  45. package/dist/components/index.js +0 -2
  46. package/dist/components/list/CreateWorkflowDialog.svelte +89 -0
  47. package/dist/components/list/CreateWorkflowDialog.svelte.d.ts +9 -0
  48. package/dist/components/list/WorkflowList.svelte +204 -0
  49. package/dist/components/list/WorkflowList.svelte.d.ts +12 -0
  50. package/dist/components/list/WorkflowRow.svelte +191 -0
  51. package/dist/components/list/WorkflowRow.svelte.d.ts +10 -0
  52. package/dist/components/panel/BlockProblems.svelte +47 -0
  53. package/dist/components/panel/BlockProblems.svelte.d.ts +6 -0
  54. package/dist/components/panel/CompositionForm.svelte +127 -0
  55. package/dist/components/panel/CompositionForm.svelte.d.ts +7 -0
  56. package/dist/components/panel/CompositionPicker.svelte +179 -0
  57. package/dist/components/panel/CompositionPicker.svelte.d.ts +14 -0
  58. package/dist/components/panel/ConditionForm.svelte +105 -0
  59. package/dist/components/panel/ConditionForm.svelte.d.ts +7 -0
  60. package/dist/components/panel/EventValueRow.svelte +85 -0
  61. package/dist/components/panel/EventValueRow.svelte.d.ts +12 -0
  62. package/dist/components/panel/NextStepSelect.svelte +70 -0
  63. package/dist/components/panel/NextStepSelect.svelte.d.ts +12 -0
  64. package/dist/components/panel/ProblemsList.svelte +101 -0
  65. package/dist/components/panel/ProblemsList.svelte.d.ts +3 -0
  66. package/dist/components/panel/RuleCard.svelte +191 -0
  67. package/dist/components/panel/RuleCard.svelte.d.ts +13 -0
  68. package/dist/components/panel/SidePanel.svelte +82 -0
  69. package/dist/components/panel/SidePanel.svelte.d.ts +3 -0
  70. package/dist/components/panel/TestRow.svelte +150 -0
  71. package/dist/components/panel/TestRow.svelte.d.ts +15 -0
  72. package/dist/components/panel/TestRunPanel.svelte +85 -0
  73. package/dist/components/panel/TestRunPanel.svelte.d.ts +3 -0
  74. package/dist/components/panel/TestTriggerCard.svelte +121 -0
  75. package/dist/components/panel/TestTriggerCard.svelte.d.ts +7 -0
  76. package/dist/components/panel/TriggerForm.svelte +385 -0
  77. package/dist/components/panel/TriggerForm.svelte.d.ts +7 -0
  78. package/dist/components/panel/VersionHistory.svelte +123 -0
  79. package/dist/components/panel/VersionHistory.svelte.d.ts +3 -0
  80. package/dist/components/ui/ActionButton.svelte +85 -0
  81. package/dist/components/ui/ActionButton.svelte.d.ts +27 -0
  82. package/dist/components/ui/ConfirmDialog.svelte +52 -0
  83. package/dist/components/ui/ConfirmDialog.svelte.d.ts +16 -0
  84. package/dist/components/ui/Icon.svelte +32 -0
  85. package/dist/components/ui/Icon.svelte.d.ts +9 -0
  86. package/dist/components/ui/Menu.svelte +211 -0
  87. package/dist/components/ui/Menu.svelte.d.ts +21 -0
  88. package/dist/components/ui/Modal.svelte +129 -0
  89. package/dist/components/ui/Modal.svelte.d.ts +13 -0
  90. package/dist/components/ui/Notice.svelte +36 -0
  91. package/dist/components/ui/Notice.svelte.d.ts +11 -0
  92. package/dist/components/ui/SelectField.svelte +74 -0
  93. package/dist/components/ui/SelectField.svelte.d.ts +16 -0
  94. package/dist/components/ui/StatusBadge.svelte +41 -0
  95. package/dist/components/ui/StatusBadge.svelte.d.ts +9 -0
  96. package/dist/components/ui/TextField.svelte +97 -0
  97. package/dist/components/ui/TextField.svelte.d.ts +29 -0
  98. package/dist/components/ui/icons.d.ts +34 -0
  99. package/dist/components/ui/icons.js +54 -0
  100. package/dist/components/ui/types.d.ts +26 -0
  101. package/dist/components/ui/types.js +1 -0
  102. package/dist/editor/apiErrorText.d.ts +10 -0
  103. package/dist/editor/apiErrorText.js +53 -0
  104. package/dist/editor/autosave.d.ts +47 -0
  105. package/dist/editor/autosave.js +119 -0
  106. package/dist/editor/blockLabels.d.ts +91 -0
  107. package/dist/editor/blockLabels.js +196 -0
  108. package/dist/editor/canvasContext.d.ts +52 -0
  109. package/dist/editor/canvasContext.js +37 -0
  110. package/dist/editor/canvasWords.d.ts +24 -0
  111. package/dist/editor/canvasWords.js +40 -0
  112. package/dist/editor/capabilityModel.d.ts +46 -0
  113. package/dist/editor/capabilityModel.js +113 -0
  114. package/dist/editor/editorState.svelte.d.ts +220 -0
  115. package/dist/editor/editorState.svelte.js +713 -0
  116. package/dist/editor/flowAdapter.d.ts +59 -0
  117. package/dist/editor/flowAdapter.js +166 -0
  118. package/dist/editor/formatCount.d.ts +5 -0
  119. package/dist/editor/formatCount.js +15 -0
  120. package/dist/editor/graphDiff.d.ts +27 -0
  121. package/dist/editor/graphDiff.js +64 -0
  122. package/dist/editor/graphModel.d.ts +154 -0
  123. package/dist/editor/graphModel.js +457 -0
  124. package/dist/editor/issueText.d.ts +64 -0
  125. package/dist/editor/issueText.js +101 -0
  126. package/dist/editor/listState.svelte.d.ts +82 -0
  127. package/dist/editor/listState.svelte.js +250 -0
  128. package/dist/editor/statsRange.d.ts +26 -0
  129. package/dist/editor/statsRange.js +41 -0
  130. package/dist/editor/testRun.d.ts +36 -0
  131. package/dist/editor/testRun.js +74 -0
  132. package/dist/editor/zonedTime.d.ts +20 -0
  133. package/dist/editor/zonedTime.js +134 -0
  134. package/dist/i18n/language.d.ts +3 -3
  135. package/dist/i18n/messages.d.ts +396 -4
  136. package/dist/i18n/messages.js +421 -8
  137. package/dist/index.d.ts +2 -1
  138. package/dist/index.js +1 -1
  139. package/dist/types/index.d.ts +31 -3
  140. package/package.json +5 -1
@@ -0,0 +1,220 @@
1
+ import type { FieldValue, ValidationIssue, WorkflowGraph, WorkflowNode } from '@widgetic/workflows-engine';
2
+ import { type WorkflowsApi } from '../api/workflowsApi.js';
3
+ import type { CompositionOption, WorkflowDetail, WorkflowStateAction, WorkflowVersion, WorkflowVersionDetail } from '../api/types.js';
4
+ import type { WorkflowsMessageKey } from '../i18n/messages.js';
5
+ import type { WorkflowsError } from '../types/index.js';
6
+ import { type SaveState } from './autosave.js';
7
+ import { type BlockRequest } from './graphModel.js';
8
+ import { type TestRunState } from './testRun.js';
9
+ /** The tabs of an open workflow. */
10
+ export type EditorTab = 'editor' | 'runs' | 'settings';
11
+ /** What the side panel shows next to the canvas. */
12
+ export type PanelMode = 'selection' | 'history' | 'test';
13
+ /** Something the person is waiting for. */
14
+ export type BusyKind = 'publishing' | 'discarding' | 'restoring' | 'changingState' | 'duplicating' | 'deleting';
15
+ /** A line the editor says about what just happened: a message of the catalog, so the screen says it in the page's language. */
16
+ export interface EditorNotice {
17
+ tone: 'info' | 'problem';
18
+ messageKey: WorkflowsMessageKey;
19
+ values?: Record<string, string | number>;
20
+ }
21
+ /** What the editor needs from the screen that owns the canvas. The canvas fills it in when it is on the screen. */
22
+ export interface CanvasHandle {
23
+ /** Makes the canvas show this workflow, as one step that one undo takes back. */
24
+ applyGraph(next: WorkflowGraph): void;
25
+ /** Replaces everything on the canvas (a reload, a restore); nothing to undo afterwards. */
26
+ loadGraph(graph: WorkflowGraph): void;
27
+ selectNodes(nodeIds: readonly string[]): void;
28
+ fitView(): void;
29
+ zoomIn(): void;
30
+ zoomOut(): void;
31
+ undo(): void;
32
+ redo(): void;
33
+ readonly canUndo: boolean;
34
+ readonly canRedo: boolean;
35
+ }
36
+ /** What the editor is given when it is made. */
37
+ export interface WorkflowEditorOptions {
38
+ api: WorkflowsApi;
39
+ workflowId: string;
40
+ /** Tells the page about a failure (`onError` of the screen). */
41
+ reportError: (error: WorkflowsError) => void;
42
+ /** The person asked to leave this workflow (it was deleted, or they pressed Back). */
43
+ leave: () => void;
44
+ /** Another workflow was made (a duplicate) and the person should see it. */
45
+ openWorkflow: (workflowId: string) => void;
46
+ /** For tests. */
47
+ random?: () => number;
48
+ /** For tests: how long a success notice stays. */
49
+ noticeMilliseconds?: number;
50
+ /** For tests: the delay before a change is saved. */
51
+ saveDelayMilliseconds?: number;
52
+ }
53
+ /**
54
+ * Everything the open workflow is: what the server says about it, the draft the person is changing, the compositions that
55
+ * can be used, what the draft is missing, where saving stands, and the small things the person is in the middle of
56
+ * (what is selected, which panel is open, a test visitor).
57
+ *
58
+ * The draft lives in two places on purpose. The canvas holds the blocks while they are dragged and drawn; this holds the
59
+ * same workflow as the engine's plain graph, which is what is validated, saved and published. They are kept the same in one
60
+ * direction each way: a change on the canvas arrives here through `acceptCanvasGraph`, and a change made in the side panel
61
+ * or the Add block menu goes through `commit`, which tells the canvas, whose own change then arrives here. Nothing else
62
+ * writes `graph`.
63
+ *
64
+ * What it never does: decide a rule of the workflow (the engine does), word a sentence (the catalog does), or draw.
65
+ */
66
+ export declare class WorkflowEditorState {
67
+ readonly workflowId: string;
68
+ workflow: WorkflowDetail | null;
69
+ loadState: "loading" | "ready" | "failed";
70
+ loadFailure: "workflows.region.label" | "workflows.header.title" | "workflows.header.subtitle" | "workflows.common.cancel" | "workflows.common.close" | "workflows.common.dismiss" | "workflows.common.loading" | "workflows.empty.title" | "workflows.empty.hint" | "workflows.error.title" | "workflows.error.hint" | "workflows.error.retry" | "workflows.error.generic" | "workflows.error.network" | "workflows.error.timeout" | "workflows.error.server" | "workflows.error.sessionEnded" | "workflows.error.planRestricted" | "workflows.error.notFound" | "workflows.error.revisionChanged" | "workflows.error.archived" | "workflows.error.nothingToPublish" | "workflows.error.nothingToDiscard" | "workflows.error.everPublished" | "workflows.error.wrongState" | "workflows.error.tooManyWorkflows" | "workflows.error.publishBlocked" | "workflows.error.invalidGraph" | "workflows.error.tooManyRequests" | "workflows.list.label" | "workflows.list.newWorkflow" | "workflows.list.searchLabel" | "workflows.list.searchPlaceholder" | "workflows.list.filterLabel" | "workflows.list.filterActive" | "workflows.list.filterAll" | "workflows.list.sortLabel" | "workflows.list.sortCreated" | "workflows.list.sortPublished" | "workflows.list.sortRuns" | "workflows.list.sortName" | "workflows.list.sortAscending" | "workflows.list.sortDescending" | "workflows.list.columnName" | "workflows.list.columnStatus" | "workflows.list.columnRuns" | "workflows.list.columnPublished" | "workflows.list.columnCreated" | "workflows.list.compositionsCount" | "workflows.list.runsCount" | "workflows.list.publishedOn" | "workflows.list.neverPublished" | "workflows.list.never" | "workflows.list.open" | "workflows.list.rowMenu" | "workflows.list.showMore" | "workflows.list.noMatches" | "workflows.list.duplicated" | "workflows.list.deleted" | "workflows.create.title" | "workflows.create.nameLabel" | "workflows.create.namePlaceholder" | "workflows.create.compositionLabel" | "workflows.create.compositionHelp" | "workflows.create.create" | "workflows.create.creating" | "workflows.status.draft" | "workflows.status.live" | "workflows.status.paused" | "workflows.status.archived" | "workflows.status.unpublishedChanges" | "workflows.top.back" | "workflows.top.nameLabel" | "workflows.top.testRun" | "workflows.top.history" | "workflows.top.embedCode" | "workflows.top.publish" | "workflows.top.publishChanges" | "workflows.top.publishing" | "workflows.save.saved" | "workflows.save.saving" | "workflows.save.pending" | "workflows.save.failed" | "workflows.save.conflict" | "workflows.tabs.label" | "workflows.tabs.editor" | "workflows.tabs.runs" | "workflows.tabs.settings" | "workflows.banner.unpublishedChanges" | "workflows.banner.publishChanges" | "workflows.banner.discard" | "workflows.banner.discardTitle" | "workflows.banner.discardMessage" | "workflows.banner.neverPublished" | "workflows.banner.paused" | "workflows.banner.archived" | "workflows.banner.conflict" | "workflows.banner.reload" | "workflows.banner.touchOnly" | "workflows.editor.published" | "workflows.editor.discarded" | "workflows.editor.restored" | "workflows.editor.reloaded" | "workflows.editor.paused" | "workflows.editor.resumed" | "workflows.editor.archived" | "workflows.editor.unarchived" | "workflows.editor.saveFirst" | "workflows.editor.fixProblems" | "workflows.editor.blockLimit" | "workflows.publish.firstTitle" | "workflows.publish.firstMessage" | "workflows.publish.changesTitle" | "workflows.publish.changesMessage" | "workflows.leave.title" | "workflows.leave.message" | "workflows.leave.confirm" | "workflows.canvas.label" | "workflows.canvas.pointIn" | "workflows.canvas.pointOut" | "workflows.toolbar.label" | "workflows.toolbar.addBlock" | "workflows.toolbar.undo" | "workflows.toolbar.redo" | "workflows.toolbar.zoomIn" | "workflows.toolbar.zoomOut" | "workflows.toolbar.fit" | "workflows.addBlock.composition" | "workflows.addBlock.helpComposition" | "workflows.addBlock.condition" | "workflows.addBlock.helpCondition" | "workflows.addBlock.triggerHeading" | "workflows.addBlock.helpInput" | "workflows.addBlock.helpAction" | "workflows.addBlock.helpPageEvent" | "workflows.addBlock.helpScheduled" | "workflows.block.startsHere" | "workflows.block.trigger" | "workflows.block.condition" | "workflows.block.unknown" | "workflows.block.compositionNotChosen" | "workflows.block.compositionLoading" | "workflows.block.compositionUnavailable" | "workflows.block.notPublished" | "workflows.block.numbered" | "workflows.block.problems" | "workflows.panel.label" | "workflows.panel.overviewHeading" | "workflows.panel.overviewHelp" | "workflows.panel.problemsHeading" | "workflows.panel.problemsLabel" | "workflows.panel.noProblems" | "workflows.panel.manyBlocksSelected" | "workflows.panel.connectionSelected" | "workflows.panel.removeBlock" | "workflows.panel.removeBlocks" | "workflows.panel.removeConnection" | "workflows.composition.heading" | "workflows.composition.help" | "workflows.composition.searchLabel" | "workflows.composition.searchPlaceholder" | "workflows.composition.none" | "workflows.composition.alreadyUsed" | "workflows.composition.isStart" | "workflows.composition.makeStart" | "workflows.composition.capabilitiesHeading" | "workflows.composition.capabilityInput" | "workflows.composition.capabilityAction" | "workflows.composition.capabilityWebsites" | "workflows.composition.inputTables" | "workflows.composition.actionCount" | "workflows.trigger.heading" | "workflows.trigger.help" | "workflows.trigger.kindLabel" | "workflows.trigger.kindInput" | "workflows.trigger.kindAction" | "workflows.trigger.kindPageEvent" | "workflows.trigger.kindScheduled" | "workflows.trigger.unavailable" | "workflows.trigger.tableLabel" | "workflows.trigger.tableHelp" | "workflows.trigger.actionLabel" | "workflows.trigger.actionHelp" | "workflows.trigger.chooseOne" | "workflows.trigger.notFound" | "workflows.trigger.readableValues" | "workflows.trigger.noReadableValues" | "workflows.trigger.nextLabel" | "workflows.trigger.nextHelp" | "workflows.trigger.nextNone" | "workflows.trigger.summaryInput" | "workflows.trigger.summaryAction" | "workflows.trigger.summaryPageEvent" | "workflows.trigger.summaryAt" | "workflows.trigger.summaryUnfinished" | "workflows.reason.widgetKeepsNoData" | "workflows.reason.widgetReportsNoActions" | "workflows.reason.widgetNotPublished" | "workflows.schedule.modeLabel" | "workflows.schedule.modeAfter" | "workflows.schedule.modeAt" | "workflows.schedule.afterHelp" | "workflows.schedule.amountLabel" | "workflows.schedule.unitLabel" | "workflows.schedule.unitSeconds" | "workflows.schedule.unitMinutes" | "workflows.schedule.unitHours" | "workflows.schedule.unitDays" | "workflows.schedule.unitWeeks" | "workflows.schedule.waitSeconds" | "workflows.schedule.waitMinutes" | "workflows.schedule.waitHours" | "workflows.schedule.waitDays" | "workflows.schedule.waitWeeks" | "workflows.schedule.momentLabel" | "workflows.schedule.momentHelp" | "workflows.schedule.invalidMoment" | "workflows.event.nameLabel" | "workflows.event.namePlaceholder" | "workflows.event.nameHelp" | "workflows.event.nameInvalid" | "workflows.event.howToSend" | "workflows.event.valuesHeading" | "workflows.event.valuesHelp" | "workflows.event.addValue" | "workflows.event.valueName" | "workflows.event.valueNamePlaceholder" | "workflows.event.valueNameInvalid" | "workflows.event.valueType" | "workflows.event.removeValue" | "workflows.fieldType.text" | "workflows.fieldType.number" | "workflows.fieldType.boolean" | "workflows.value.yes" | "workflows.value.no" | "workflows.condition.heading" | "workflows.condition.help" | "workflows.condition.noTrigger" | "workflows.condition.noValues" | "workflows.condition.addRule" | "workflows.condition.ruleLimit" | "workflows.condition.defaultName" | "workflows.condition.defaultLabel" | "workflows.condition.defaultStay" | "workflows.condition.defaultHelp" | "workflows.condition.defaultHint" | "workflows.condition.defaultStays" | "workflows.rule.defaultName" | "workflows.rule.nameLabel" | "workflows.rule.moveUp" | "workflows.rule.moveDown" | "workflows.rule.remove" | "workflows.rule.matchLabel" | "workflows.rule.matchAll" | "workflows.rule.matchAny" | "workflows.rule.noTests" | "workflows.rule.addTest" | "workflows.rule.testLimit" | "workflows.rule.thenGoTo" | "workflows.rule.testWithValue" | "workflows.rule.testWithoutValue" | "workflows.rule.testAndMore" | "workflows.test.field" | "workflows.test.operator" | "workflows.test.value" | "workflows.test.valuePlaceholder" | "workflows.test.remove" | "workflows.operator.is" | "workflows.operator.isNot" | "workflows.operator.contains" | "workflows.operator.doesNotContain" | "workflows.operator.startsWith" | "workflows.operator.endsWith" | "workflows.operator.greaterThan" | "workflows.operator.atLeast" | "workflows.operator.lessThan" | "workflows.operator.atMost" | "workflows.operator.isEmpty" | "workflows.operator.isNotEmpty" | "workflows.test.heading" | "workflows.test.help" | "workflows.test.close" | "workflows.test.start" | "workflows.test.restart" | "workflows.test.ended" | "workflows.test.noStart" | "workflows.test.noTriggers" | "workflows.test.visitorIsOn" | "workflows.test.fire" | "workflows.test.resultMoved" | "workflows.test.resultStayed" | "workflows.test.resultIgnored" | "workflows.history.heading" | "workflows.history.help" | "workflows.history.close" | "workflows.history.none" | "workflows.history.failed" | "workflows.history.version" | "workflows.history.live" | "workflows.history.by" | "workflows.history.view" | "workflows.history.viewing" | "workflows.history.backToDraft" | "workflows.history.restore" | "workflows.history.restoreTitle" | "workflows.history.restoreMessage" | "workflows.runs.help" | "workflows.runs.rangeLabel" | "workflows.runs.lastDays" | "workflows.runs.versionLabel" | "workflows.runs.allVersions" | "workflows.runs.versionLive" | "workflows.runs.started" | "workflows.runs.entered" | "workflows.runs.fired" | "workflows.runs.failed" | "workflows.runs.none" | "workflows.runs.neverPublished" | "workflows.settings.zoneHeading" | "workflows.settings.zoneLabel" | "workflows.settings.zoneHelp" | "workflows.settings.embedHeading" | "workflows.settings.embedHelp" | "workflows.settings.stateHeading" | "workflows.settings.pause" | "workflows.settings.pauseHelp" | "workflows.settings.resume" | "workflows.settings.resumeHelp" | "workflows.settings.archive" | "workflows.settings.archiveHelp" | "workflows.settings.archiveTitle" | "workflows.settings.archiveMessage" | "workflows.settings.unarchive" | "workflows.settings.unarchiveHelp" | "workflows.settings.duplicate" | "workflows.settings.duplicateHelp" | "workflows.settings.delete" | "workflows.settings.deleteHelp" | "workflows.settings.deleteBlocked" | "workflows.settings.deleteTitle" | "workflows.settings.deleteMessage" | "workflows.issue.unknown" | "workflows.issue.malformed" | "workflows.issue.schemaVersion" | "workflows.issue.graphTooLarge" | "workflows.issue.unknownNodeType" | "workflows.issue.unknownTriggerKind" | "workflows.issue.badId" | "workflows.issue.duplicateId" | "workflows.issue.tooManyBlocks" | "workflows.issue.tooManyEdges" | "workflows.issue.noComposition" | "workflows.issue.noStart" | "workflows.issue.manyStarts" | "workflows.issue.compositionMissingId" | "workflows.issue.duplicateComposition" | "workflows.issue.compositionNotAvailable" | "workflows.issue.compositionWebsiteMismatch" | "workflows.issue.unreachableBlock" | "workflows.issue.edgeUnknownNode" | "workflows.issue.edgeBadPort" | "workflows.issue.edgeInvalidConnection" | "workflows.issue.portManyTargets" | "workflows.issue.cycle" | "workflows.issue.triggerNoSource" | "workflows.issue.triggerManySources" | "workflows.issue.triggerNoTarget" | "workflows.issue.triggerConfigIncomplete" | "workflows.issue.triggerNeedsTable" | "workflows.issue.triggerNeedsAction" | "workflows.issue.triggerNeedsName" | "workflows.issue.scheduleInvalid" | "workflows.issue.eventValueInvalid" | "workflows.issue.eventTooManyValues" | "workflows.issue.triggerCapabilityMissing" | "workflows.issue.triggerInputMissing" | "workflows.issue.triggerActionMissing" | "workflows.issue.conditionNoSource" | "workflows.issue.conditionManySources" | "workflows.issue.conditionNoCases" | "workflows.issue.conditionTooManyCases" | "workflows.issue.caseBadId" | "workflows.issue.caseDuplicateId" | "workflows.issue.caseNoTests" | "workflows.issue.caseTooManyTests" | "workflows.issue.caseNoTarget" | "workflows.issue.testBadField" | "workflows.issue.testBadOperator" | "workflows.issue.testMissingValue" | "workflows.issue.fieldUnknown" | null;
71
+ /** The compositions the workflow uses, as the API describes them. `null`: not there for this person. */
72
+ options: Readonly<Record<string, CompositionOption | null | undefined>>;
73
+ optionsReady: boolean;
74
+ graph: WorkflowGraph;
75
+ name: string;
76
+ timezone: string;
77
+ /** Bumped when the whole draft is replaced from outside (a reload, a restore), so the canvas starts again from it. */
78
+ draftEpoch: number;
79
+ saveState: SaveState;
80
+ saveFailure: "workflows.region.label" | "workflows.header.title" | "workflows.header.subtitle" | "workflows.common.cancel" | "workflows.common.close" | "workflows.common.dismiss" | "workflows.common.loading" | "workflows.empty.title" | "workflows.empty.hint" | "workflows.error.title" | "workflows.error.hint" | "workflows.error.retry" | "workflows.error.generic" | "workflows.error.network" | "workflows.error.timeout" | "workflows.error.server" | "workflows.error.sessionEnded" | "workflows.error.planRestricted" | "workflows.error.notFound" | "workflows.error.revisionChanged" | "workflows.error.archived" | "workflows.error.nothingToPublish" | "workflows.error.nothingToDiscard" | "workflows.error.everPublished" | "workflows.error.wrongState" | "workflows.error.tooManyWorkflows" | "workflows.error.publishBlocked" | "workflows.error.invalidGraph" | "workflows.error.tooManyRequests" | "workflows.list.label" | "workflows.list.newWorkflow" | "workflows.list.searchLabel" | "workflows.list.searchPlaceholder" | "workflows.list.filterLabel" | "workflows.list.filterActive" | "workflows.list.filterAll" | "workflows.list.sortLabel" | "workflows.list.sortCreated" | "workflows.list.sortPublished" | "workflows.list.sortRuns" | "workflows.list.sortName" | "workflows.list.sortAscending" | "workflows.list.sortDescending" | "workflows.list.columnName" | "workflows.list.columnStatus" | "workflows.list.columnRuns" | "workflows.list.columnPublished" | "workflows.list.columnCreated" | "workflows.list.compositionsCount" | "workflows.list.runsCount" | "workflows.list.publishedOn" | "workflows.list.neverPublished" | "workflows.list.never" | "workflows.list.open" | "workflows.list.rowMenu" | "workflows.list.showMore" | "workflows.list.noMatches" | "workflows.list.duplicated" | "workflows.list.deleted" | "workflows.create.title" | "workflows.create.nameLabel" | "workflows.create.namePlaceholder" | "workflows.create.compositionLabel" | "workflows.create.compositionHelp" | "workflows.create.create" | "workflows.create.creating" | "workflows.status.draft" | "workflows.status.live" | "workflows.status.paused" | "workflows.status.archived" | "workflows.status.unpublishedChanges" | "workflows.top.back" | "workflows.top.nameLabel" | "workflows.top.testRun" | "workflows.top.history" | "workflows.top.embedCode" | "workflows.top.publish" | "workflows.top.publishChanges" | "workflows.top.publishing" | "workflows.save.saved" | "workflows.save.saving" | "workflows.save.pending" | "workflows.save.failed" | "workflows.save.conflict" | "workflows.tabs.label" | "workflows.tabs.editor" | "workflows.tabs.runs" | "workflows.tabs.settings" | "workflows.banner.unpublishedChanges" | "workflows.banner.publishChanges" | "workflows.banner.discard" | "workflows.banner.discardTitle" | "workflows.banner.discardMessage" | "workflows.banner.neverPublished" | "workflows.banner.paused" | "workflows.banner.archived" | "workflows.banner.conflict" | "workflows.banner.reload" | "workflows.banner.touchOnly" | "workflows.editor.published" | "workflows.editor.discarded" | "workflows.editor.restored" | "workflows.editor.reloaded" | "workflows.editor.paused" | "workflows.editor.resumed" | "workflows.editor.archived" | "workflows.editor.unarchived" | "workflows.editor.saveFirst" | "workflows.editor.fixProblems" | "workflows.editor.blockLimit" | "workflows.publish.firstTitle" | "workflows.publish.firstMessage" | "workflows.publish.changesTitle" | "workflows.publish.changesMessage" | "workflows.leave.title" | "workflows.leave.message" | "workflows.leave.confirm" | "workflows.canvas.label" | "workflows.canvas.pointIn" | "workflows.canvas.pointOut" | "workflows.toolbar.label" | "workflows.toolbar.addBlock" | "workflows.toolbar.undo" | "workflows.toolbar.redo" | "workflows.toolbar.zoomIn" | "workflows.toolbar.zoomOut" | "workflows.toolbar.fit" | "workflows.addBlock.composition" | "workflows.addBlock.helpComposition" | "workflows.addBlock.condition" | "workflows.addBlock.helpCondition" | "workflows.addBlock.triggerHeading" | "workflows.addBlock.helpInput" | "workflows.addBlock.helpAction" | "workflows.addBlock.helpPageEvent" | "workflows.addBlock.helpScheduled" | "workflows.block.startsHere" | "workflows.block.trigger" | "workflows.block.condition" | "workflows.block.unknown" | "workflows.block.compositionNotChosen" | "workflows.block.compositionLoading" | "workflows.block.compositionUnavailable" | "workflows.block.notPublished" | "workflows.block.numbered" | "workflows.block.problems" | "workflows.panel.label" | "workflows.panel.overviewHeading" | "workflows.panel.overviewHelp" | "workflows.panel.problemsHeading" | "workflows.panel.problemsLabel" | "workflows.panel.noProblems" | "workflows.panel.manyBlocksSelected" | "workflows.panel.connectionSelected" | "workflows.panel.removeBlock" | "workflows.panel.removeBlocks" | "workflows.panel.removeConnection" | "workflows.composition.heading" | "workflows.composition.help" | "workflows.composition.searchLabel" | "workflows.composition.searchPlaceholder" | "workflows.composition.none" | "workflows.composition.alreadyUsed" | "workflows.composition.isStart" | "workflows.composition.makeStart" | "workflows.composition.capabilitiesHeading" | "workflows.composition.capabilityInput" | "workflows.composition.capabilityAction" | "workflows.composition.capabilityWebsites" | "workflows.composition.inputTables" | "workflows.composition.actionCount" | "workflows.trigger.heading" | "workflows.trigger.help" | "workflows.trigger.kindLabel" | "workflows.trigger.kindInput" | "workflows.trigger.kindAction" | "workflows.trigger.kindPageEvent" | "workflows.trigger.kindScheduled" | "workflows.trigger.unavailable" | "workflows.trigger.tableLabel" | "workflows.trigger.tableHelp" | "workflows.trigger.actionLabel" | "workflows.trigger.actionHelp" | "workflows.trigger.chooseOne" | "workflows.trigger.notFound" | "workflows.trigger.readableValues" | "workflows.trigger.noReadableValues" | "workflows.trigger.nextLabel" | "workflows.trigger.nextHelp" | "workflows.trigger.nextNone" | "workflows.trigger.summaryInput" | "workflows.trigger.summaryAction" | "workflows.trigger.summaryPageEvent" | "workflows.trigger.summaryAt" | "workflows.trigger.summaryUnfinished" | "workflows.reason.widgetKeepsNoData" | "workflows.reason.widgetReportsNoActions" | "workflows.reason.widgetNotPublished" | "workflows.schedule.modeLabel" | "workflows.schedule.modeAfter" | "workflows.schedule.modeAt" | "workflows.schedule.afterHelp" | "workflows.schedule.amountLabel" | "workflows.schedule.unitLabel" | "workflows.schedule.unitSeconds" | "workflows.schedule.unitMinutes" | "workflows.schedule.unitHours" | "workflows.schedule.unitDays" | "workflows.schedule.unitWeeks" | "workflows.schedule.waitSeconds" | "workflows.schedule.waitMinutes" | "workflows.schedule.waitHours" | "workflows.schedule.waitDays" | "workflows.schedule.waitWeeks" | "workflows.schedule.momentLabel" | "workflows.schedule.momentHelp" | "workflows.schedule.invalidMoment" | "workflows.event.nameLabel" | "workflows.event.namePlaceholder" | "workflows.event.nameHelp" | "workflows.event.nameInvalid" | "workflows.event.howToSend" | "workflows.event.valuesHeading" | "workflows.event.valuesHelp" | "workflows.event.addValue" | "workflows.event.valueName" | "workflows.event.valueNamePlaceholder" | "workflows.event.valueNameInvalid" | "workflows.event.valueType" | "workflows.event.removeValue" | "workflows.fieldType.text" | "workflows.fieldType.number" | "workflows.fieldType.boolean" | "workflows.value.yes" | "workflows.value.no" | "workflows.condition.heading" | "workflows.condition.help" | "workflows.condition.noTrigger" | "workflows.condition.noValues" | "workflows.condition.addRule" | "workflows.condition.ruleLimit" | "workflows.condition.defaultName" | "workflows.condition.defaultLabel" | "workflows.condition.defaultStay" | "workflows.condition.defaultHelp" | "workflows.condition.defaultHint" | "workflows.condition.defaultStays" | "workflows.rule.defaultName" | "workflows.rule.nameLabel" | "workflows.rule.moveUp" | "workflows.rule.moveDown" | "workflows.rule.remove" | "workflows.rule.matchLabel" | "workflows.rule.matchAll" | "workflows.rule.matchAny" | "workflows.rule.noTests" | "workflows.rule.addTest" | "workflows.rule.testLimit" | "workflows.rule.thenGoTo" | "workflows.rule.testWithValue" | "workflows.rule.testWithoutValue" | "workflows.rule.testAndMore" | "workflows.test.field" | "workflows.test.operator" | "workflows.test.value" | "workflows.test.valuePlaceholder" | "workflows.test.remove" | "workflows.operator.is" | "workflows.operator.isNot" | "workflows.operator.contains" | "workflows.operator.doesNotContain" | "workflows.operator.startsWith" | "workflows.operator.endsWith" | "workflows.operator.greaterThan" | "workflows.operator.atLeast" | "workflows.operator.lessThan" | "workflows.operator.atMost" | "workflows.operator.isEmpty" | "workflows.operator.isNotEmpty" | "workflows.test.heading" | "workflows.test.help" | "workflows.test.close" | "workflows.test.start" | "workflows.test.restart" | "workflows.test.ended" | "workflows.test.noStart" | "workflows.test.noTriggers" | "workflows.test.visitorIsOn" | "workflows.test.fire" | "workflows.test.resultMoved" | "workflows.test.resultStayed" | "workflows.test.resultIgnored" | "workflows.history.heading" | "workflows.history.help" | "workflows.history.close" | "workflows.history.none" | "workflows.history.failed" | "workflows.history.version" | "workflows.history.live" | "workflows.history.by" | "workflows.history.view" | "workflows.history.viewing" | "workflows.history.backToDraft" | "workflows.history.restore" | "workflows.history.restoreTitle" | "workflows.history.restoreMessage" | "workflows.runs.help" | "workflows.runs.rangeLabel" | "workflows.runs.lastDays" | "workflows.runs.versionLabel" | "workflows.runs.allVersions" | "workflows.runs.versionLive" | "workflows.runs.started" | "workflows.runs.entered" | "workflows.runs.fired" | "workflows.runs.failed" | "workflows.runs.none" | "workflows.runs.neverPublished" | "workflows.settings.zoneHeading" | "workflows.settings.zoneLabel" | "workflows.settings.zoneHelp" | "workflows.settings.embedHeading" | "workflows.settings.embedHelp" | "workflows.settings.stateHeading" | "workflows.settings.pause" | "workflows.settings.pauseHelp" | "workflows.settings.resume" | "workflows.settings.resumeHelp" | "workflows.settings.archive" | "workflows.settings.archiveHelp" | "workflows.settings.archiveTitle" | "workflows.settings.archiveMessage" | "workflows.settings.unarchive" | "workflows.settings.unarchiveHelp" | "workflows.settings.duplicate" | "workflows.settings.duplicateHelp" | "workflows.settings.delete" | "workflows.settings.deleteHelp" | "workflows.settings.deleteBlocked" | "workflows.settings.deleteTitle" | "workflows.settings.deleteMessage" | "workflows.issue.unknown" | "workflows.issue.malformed" | "workflows.issue.schemaVersion" | "workflows.issue.graphTooLarge" | "workflows.issue.unknownNodeType" | "workflows.issue.unknownTriggerKind" | "workflows.issue.badId" | "workflows.issue.duplicateId" | "workflows.issue.tooManyBlocks" | "workflows.issue.tooManyEdges" | "workflows.issue.noComposition" | "workflows.issue.noStart" | "workflows.issue.manyStarts" | "workflows.issue.compositionMissingId" | "workflows.issue.duplicateComposition" | "workflows.issue.compositionNotAvailable" | "workflows.issue.compositionWebsiteMismatch" | "workflows.issue.unreachableBlock" | "workflows.issue.edgeUnknownNode" | "workflows.issue.edgeBadPort" | "workflows.issue.edgeInvalidConnection" | "workflows.issue.portManyTargets" | "workflows.issue.cycle" | "workflows.issue.triggerNoSource" | "workflows.issue.triggerManySources" | "workflows.issue.triggerNoTarget" | "workflows.issue.triggerConfigIncomplete" | "workflows.issue.triggerNeedsTable" | "workflows.issue.triggerNeedsAction" | "workflows.issue.triggerNeedsName" | "workflows.issue.scheduleInvalid" | "workflows.issue.eventValueInvalid" | "workflows.issue.eventTooManyValues" | "workflows.issue.triggerCapabilityMissing" | "workflows.issue.triggerInputMissing" | "workflows.issue.triggerActionMissing" | "workflows.issue.conditionNoSource" | "workflows.issue.conditionManySources" | "workflows.issue.conditionNoCases" | "workflows.issue.conditionTooManyCases" | "workflows.issue.caseBadId" | "workflows.issue.caseDuplicateId" | "workflows.issue.caseNoTests" | "workflows.issue.caseTooManyTests" | "workflows.issue.caseNoTarget" | "workflows.issue.testBadField" | "workflows.issue.testBadOperator" | "workflows.issue.testMissingValue" | "workflows.issue.fieldUnknown" | null;
81
+ tab: EditorTab;
82
+ panel: PanelMode;
83
+ selectedNodeIds: readonly string[];
84
+ selectedEdgeIds: readonly string[];
85
+ busy: BusyKind | null;
86
+ notice: EditorNotice | null;
87
+ /** What a refused publish said was wrong (the server checks again with what it knows), until the next change. */
88
+ refusedIssues: readonly ValidationIssue[];
89
+ /** What the touch of a screen allows: with no pointer to draw lines with, the canvas only shows. */
90
+ canvasTouchOnly: boolean;
91
+ /** Set when a publish was tried while the draft has problems: the blocks with problems are outlined until it is published. */
92
+ problemsRevealed: boolean;
93
+ versions: readonly WorkflowVersion[] | null;
94
+ versionsState: "loading" | "failed" | "idle";
95
+ /** A published version being looked at, read-only. */
96
+ viewing: WorkflowVersionDetail | null;
97
+ testRun: TestRunState | null;
98
+ /** The canvas, while one is on the screen (a pointer that changes when the canvas comes and goes). */
99
+ canvas: CanvasHandle | null;
100
+ private revision;
101
+ private lastSaved;
102
+ private readonly saver;
103
+ private readonly api;
104
+ private readonly reportError;
105
+ private readonly leave;
106
+ private readonly openWorkflow;
107
+ private readonly random;
108
+ private readonly noticeMilliseconds;
109
+ private noticeTimer;
110
+ private loadController;
111
+ private disposed;
112
+ constructor(options: WorkflowEditorOptions);
113
+ /** What the engine finds missing in the draft, with what it knows about the compositions once that has arrived. */
114
+ issues: ValidationIssue[];
115
+ /** The problems drawn on the canvas: those of the draft, so none while a published version is being looked at. */
116
+ issuesOnCanvas: import("./flowAdapter.js").IssuesOnCanvas;
117
+ /** Errors stop a publish; warnings are advice. */
118
+ hasPublishBlockers: boolean;
119
+ status: import("../api/types.js").WorkflowStatus;
120
+ /** Archived workflows are only looked at; so is a version, and so is a canvas on a touch screen. */
121
+ isReadOnly: boolean;
122
+ canEditCanvas: boolean;
123
+ hasChangesToPublish: boolean;
124
+ /** Publish can be tried: there is something to publish and nothing else in the way. The problems found are told on the try. */
125
+ canTryPublish: boolean;
126
+ /** Publish will go through, as far as this screen can tell (the server checks again). */
127
+ canPublish: boolean;
128
+ selectedNode: WorkflowNode | null;
129
+ startNodeId: string | null;
130
+ compositionIds: string[];
131
+ /** The ids of the blocks a test visitor has passed, and where they are now, for the marks on the canvas. */
132
+ testPassedIds: Set<string>;
133
+ testTakenEdgeIds: Set<string>;
134
+ /** Reads the workflow and the compositions it uses. Safe to call again: it starts over from the server. */
135
+ load(): Promise<void>;
136
+ /** Stops everything that is waiting: timers, saves, requests. Called when the editor is taken off the screen. */
137
+ dispose(): void;
138
+ /** Sends what is waiting before the screen is left. Resolves to where saving stands. */
139
+ flushSaves(): Promise<SaveState>;
140
+ /** Leaves the workflow: what is waiting is sent first, then everything that was running is stopped. */
141
+ finish(): Promise<SaveState>;
142
+ /** Takes what the server holds as the draft, replacing what is on the screen. */
143
+ private adoptServerDraft;
144
+ /** Throws away what is unsaved on this screen and reads the draft again (after somebody else changed it). */
145
+ reloadDraft(): Promise<void>;
146
+ /** Reads what the API says about these compositions; the ones it does not know come back as `null`. */
147
+ private readCompositionOptions;
148
+ /** Remembers compositions the person picked from the list, so the blocks that show them have their names at once. */
149
+ rememberCompositions(items: readonly CompositionOption[]): void;
150
+ /** Asks the API for compositions that the draft uses and this screen has not read yet (after a restore, say). */
151
+ private refreshMissingCompositions;
152
+ /**
153
+ * A change that happened on the canvas (a block dragged, a line drawn, a block deleted): the draft follows it. Answers
154
+ * the draft as it is kept, which can differ from what the canvas held (the first composition left became the start), so
155
+ * that the canvas can take it over.
156
+ */
157
+ acceptCanvasGraph(fromCanvas: WorkflowGraph): WorkflowGraph;
158
+ /**
159
+ * A change made from the side panel or a menu. The canvas applies it (so it can be undone) and tells this state back,
160
+ * the same way a drag does. Without a canvas on the screen the draft changes directly.
161
+ */
162
+ commit(next: WorkflowGraph): void;
163
+ /** What follows any change of the draft: a published check is stale, a test visitor may be somewhere that is gone, saving is due. */
164
+ private afterDraftChanged;
165
+ /** Replaces one block (the side panel changed it). */
166
+ replaceBlock(node: WorkflowNode): void;
167
+ /** Draws a connection from a place of a block to another block, or takes it away (`targetNodeId` null). One line per place. */
168
+ connect(sourceNodeId: string, sourcePort: string, targetNodeId: string | null): void;
169
+ /** Adds a block after the selected one (or where there is room) and selects it. Resolves to why nothing was added, if so. */
170
+ addBlock(request: BlockRequest): 'too_many_blocks' | null;
171
+ /** Takes the selected blocks and lines off the draft. */
172
+ removeSelected(): void;
173
+ removeBlock(nodeId: string): void;
174
+ /** Makes a composition the first one visitors see. */
175
+ makeStart(nodeId: string): void;
176
+ /** The selection of the canvas, as the canvas reports it. */
177
+ followSelection(nodeIds: readonly string[], edgeIds: readonly string[]): void;
178
+ setName(name: string): void;
179
+ setTimezone(timezone: string): void;
180
+ /** What would go to the server now, or `null` when the server already has it. */
181
+ private readSaveSnapshot;
182
+ private toSaveInput;
183
+ private applySaved;
184
+ private followSaveState;
185
+ /** Tries a failed save again (the person pressed "Try again"). */
186
+ retrySave(): void;
187
+ /** Runs one thing the person waits for. Nothing else that changes the workflow runs meanwhile. */
188
+ private runBusy;
189
+ /** Makes the draft the next version visitors get. */
190
+ publish(): Promise<boolean>;
191
+ /** Puts the draft back to what is live. */
192
+ discardChanges(): Promise<boolean>;
193
+ loadVersions(): Promise<void>;
194
+ openHistory(): void;
195
+ closeHistory(): void;
196
+ /** Shows a published version read-only on the canvas. */
197
+ viewVersion(versionId: string): Promise<void>;
198
+ /** Goes back from a version to the draft. */
199
+ leaveVersion(): void;
200
+ /** Copies the version into the draft (the draft it replaces stays recoverable only through undo, so the screen asks first). */
201
+ restoreViewedVersion(): Promise<boolean>;
202
+ /** Reads what the API says about the compositions of a graph (a version, say) that this screen has not read yet. */
203
+ ensureOptionsFor(graph: WorkflowGraph): Promise<void>;
204
+ changeState(action: WorkflowStateAction): Promise<boolean>;
205
+ duplicate(): Promise<void>;
206
+ deleteWorkflow(): Promise<void>;
207
+ openTestRun(): void;
208
+ closeTestRun(): void;
209
+ restartTestRun(): void;
210
+ /** The test visitor does one thing: a trigger of the composition they are on fires, carrying these values. */
211
+ fireTrigger(triggerId: string, values: Record<string, FieldValue>): void;
212
+ showNotice(tone: EditorNotice['tone'], messageKey: WorkflowsMessageKey, values?: Record<string, string | number>): void;
213
+ dismissNotice(): void;
214
+ private showFailureNotice;
215
+ /** Says a failure once in the console and tells the page. */
216
+ private noteFailure;
217
+ }
218
+ export declare function provideEditorState(state: WorkflowEditorState): WorkflowEditorState;
219
+ /** Called by a part of the editor while it is created. The editor is always there for those parts: this throws if it is not. */
220
+ export declare function useEditorState(): WorkflowEditorState;