base-screen 0.2.0 → 0.4.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 (518) hide show
  1. package/README.md +3 -12
  2. package/dist/_internal/contracts/document/blueprint-capabilities.d.ts +9 -1
  3. package/dist/_internal/contracts/document/blueprint-capabilities.js +16 -0
  4. package/dist/_internal/contracts/document/blueprint-graph.d.ts +68 -0
  5. package/dist/_internal/contracts/document/blueprint-graph.js +424 -0
  6. package/dist/_internal/contracts/document/blueprint-strict.d.ts +3 -1
  7. package/dist/_internal/contracts/document/blueprint-strict.js +77 -91
  8. package/dist/_internal/contracts/document/component-states.d.ts +54 -0
  9. package/dist/_internal/contracts/document/component-states.js +171 -0
  10. package/dist/_internal/contracts/document/json-schema.js +49 -17
  11. package/dist/_internal/contracts/document/limits.d.ts +40 -8
  12. package/dist/_internal/contracts/document/limits.js +40 -8
  13. package/dist/_internal/contracts/document/parse-parts.d.ts +12 -0
  14. package/dist/_internal/contracts/document/parse-parts.js +56 -0
  15. package/dist/_internal/contracts/document/parse.js +1 -1
  16. package/dist/_internal/contracts/document/references.js +108 -41
  17. package/dist/_internal/contracts/document/schema.d.ts +532 -186
  18. package/dist/_internal/contracts/document/schema.js +235 -96
  19. package/dist/_internal/contracts/document/sub-canvas.d.ts +27 -0
  20. package/dist/_internal/contracts/document/sub-canvas.js +38 -0
  21. package/dist/_internal/contracts/document/theme.d.ts +22 -0
  22. package/dist/_internal/contracts/document/theme.js +65 -0
  23. package/dist/_internal/contracts/document/validate-blueprint.d.ts +7 -0
  24. package/dist/_internal/contracts/document/validate-blueprint.js +223 -25
  25. package/dist/_internal/contracts/document/validate-component.d.ts +2 -0
  26. package/dist/_internal/contracts/document/validate-component.js +111 -54
  27. package/dist/_internal/contracts/document/validate-data-source.js +84 -9
  28. package/dist/_internal/contracts/document/validate-sub-canvas.d.ts +9 -0
  29. package/dist/_internal/contracts/document/validate-sub-canvas.js +92 -0
  30. package/dist/_internal/contracts/document/validate-theme.d.ts +4 -0
  31. package/dist/_internal/contracts/document/validate-theme.js +20 -0
  32. package/dist/_internal/contracts/document/validate-value-ref.js +6 -1
  33. package/dist/_internal/contracts/document/validate.js +19 -2
  34. package/dist/_internal/contracts/index.d.ts +11 -4
  35. package/dist/_internal/contracts/index.js +8 -2
  36. package/dist/_internal/contracts/migration/blueprint-graph-migration.d.ts +21 -0
  37. package/dist/_internal/contracts/migration/blueprint-graph-migration.js +328 -0
  38. package/dist/_internal/contracts/migration/migrate-document.d.ts +2 -1
  39. package/dist/_internal/contracts/migration/migrate-document.js +11 -3
  40. package/dist/_internal/contracts/push/delivery.d.ts +16 -0
  41. package/dist/_internal/contracts/push/delivery.js +70 -0
  42. package/dist/_internal/contracts/push/level-scale.d.ts +7 -0
  43. package/dist/_internal/contracts/push/level-scale.js +91 -0
  44. package/dist/_internal/contracts/screen-document.schema.json +1071 -386
  45. package/dist/_internal/contracts/types/diagnostics.d.ts +1 -1
  46. package/dist/_internal/contracts/types/document.d.ts +280 -77
  47. package/dist/_internal/contracts/types/execution.d.ts +12 -2
  48. package/dist/_internal/contracts/types/execution.js +0 -5
  49. package/dist/_internal/contracts/types/host.d.ts +35 -1
  50. package/dist/_internal/contracts/types/host.js +7 -1
  51. package/dist/_internal/contracts/types/push.d.ts +86 -0
  52. package/dist/_internal/contracts/types/push.js +1 -0
  53. package/dist/_internal/contracts/types/variable.d.ts +5 -0
  54. package/dist/_internal/contracts/variable/parse.js +30 -1
  55. package/dist/_internal/core/blueprint/runtime-compile.d.ts +4 -0
  56. package/dist/_internal/core/blueprint/runtime-compile.js +45 -21
  57. package/dist/_internal/core/blueprint/runtime-dispatch.js +270 -156
  58. package/dist/_internal/core/blueprint/runtime-simulate.d.ts +57 -0
  59. package/dist/_internal/core/blueprint/runtime-simulate.js +177 -0
  60. package/dist/_internal/core/blueprint/runtime-types.d.ts +112 -6
  61. package/dist/_internal/core/blueprint/runtime.d.ts +2 -1
  62. package/dist/_internal/core/blueprint/runtime.js +1 -0
  63. package/dist/_internal/core/commands/apply-collection-commands.d.ts +32 -0
  64. package/dist/_internal/core/commands/apply-collection-commands.js +174 -0
  65. package/dist/_internal/core/commands/apply-component-commands.d.ts +5 -0
  66. package/dist/_internal/core/commands/apply-component-commands.js +74 -2
  67. package/dist/_internal/core/commands/apply.js +76 -3
  68. package/dist/_internal/core/commands/parse-command.js +24 -0
  69. package/dist/_internal/core/commands/types.d.ts +56 -3
  70. package/dist/_internal/core/data/data-candidates.d.ts +38 -0
  71. package/dist/_internal/core/data/data-candidates.js +186 -0
  72. package/dist/_internal/core/data/dataset-profile.d.ts +71 -0
  73. package/dist/_internal/core/data/dataset-profile.js +170 -0
  74. package/dist/_internal/core/data/sample-values.d.ts +25 -0
  75. package/dist/_internal/core/data/sample-values.js +45 -0
  76. package/dist/_internal/core/diff/screen-diff.js +7 -1
  77. package/dist/_internal/core/index.d.ts +7 -1
  78. package/dist/_internal/core/index.js +7 -1
  79. package/dist/_internal/core/state/state-preset.d.ts +32 -0
  80. package/dist/_internal/core/state/state-preset.js +37 -0
  81. package/dist/_internal/core/validation/layout-audit.d.ts +17 -0
  82. package/dist/_internal/core/validation/layout-audit.js +228 -0
  83. package/dist/_internal/core/validation/legibility.d.ts +9 -0
  84. package/dist/_internal/core/validation/legibility.js +33 -0
  85. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge-helpers.d.ts +1 -1
  86. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge.d.ts +11 -1
  87. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-panels-controller.d.ts +18 -4
  88. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-timer-scheduler.d.ts +21 -0
  89. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-panel.d.ts +8 -1
  90. package/dist/_internal/engine/browser/controllers/dataset/designer-data-source-authoring.d.ts +25 -1
  91. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-controller-context.d.ts +6 -2
  92. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +14 -1
  93. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-surface-controller.d.ts +14 -0
  94. package/dist/_internal/engine/browser/controllers/dataset/designer-update-policy-authoring.d.ts +52 -0
  95. package/dist/_internal/engine/browser/controllers/designer-artboard-controller.d.ts +80 -0
  96. package/dist/_internal/engine/browser/controllers/designer-canvas-runtime-controller.d.ts +21 -3
  97. package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +29 -0
  98. package/dist/_internal/engine/browser/controllers/designer-command-palette-controller.d.ts +2 -0
  99. package/dist/_internal/engine/browser/controllers/designer-notification-controller.d.ts +7 -0
  100. package/dist/_internal/engine/browser/controllers/designer-page-preview-controller.d.ts +34 -0
  101. package/dist/_internal/engine/browser/controllers/designer-popup-preview-controller.d.ts +40 -0
  102. package/dist/_internal/engine/browser/controllers/designer-preview-controller.d.ts +1 -3
  103. package/dist/_internal/engine/browser/controllers/designer-reference-layer-controller.d.ts +45 -0
  104. package/dist/_internal/engine/browser/controllers/designer-viewport-controller.d.ts +10 -0
  105. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-callbacks.d.ts +5 -1
  106. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-controller.d.ts +2 -0
  107. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-environment.d.ts +18 -7
  108. package/dist/_internal/engine/browser/controllers/gesture/designer-group-editing-controller.d.ts +8 -1
  109. package/dist/_internal/engine/browser/controllers/layers/designer-layers-controller.d.ts +11 -0
  110. package/dist/_internal/engine/browser/controllers/panel/designer-component-states-controller.d.ts +26 -0
  111. package/dist/_internal/engine/browser/controllers/panel/designer-inspector-focus.d.ts +30 -0
  112. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller-callbacks.d.ts +23 -6
  113. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller.d.ts +2 -2
  114. package/dist/_internal/engine/browser/controllers/panel/designer-panel-material-controller.d.ts +4 -0
  115. package/dist/_internal/engine/browser/controllers/panel/designer-panel-property-controller.d.ts +2 -0
  116. package/dist/_internal/engine/browser/controllers/workbench/designer-snap-controller.d.ts +5 -1
  117. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +7 -1
  118. package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-inspector-configuration.d.ts +12 -0
  119. package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-library-dom.d.ts +18 -2
  120. package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +22 -5
  121. package/dist/_internal/engine/browser/dom/color/designer-color-palette-dom.d.ts +1 -0
  122. package/dist/_internal/engine/browser/dom/color/designer-color-palette-theme.d.ts +10 -0
  123. package/dist/_internal/engine/browser/dom/color/designer-color-palette-types.d.ts +13 -0
  124. package/dist/_internal/engine/browser/dom/color/designer-color-theme-slots.d.ts +10 -0
  125. package/dist/_internal/engine/browser/dom/dataset/designer-data-section-diff.d.ts +4 -6
  126. package/dist/_internal/engine/browser/dom/dataset/designer-dataset-types.d.ts +17 -6
  127. package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-control-dom.d.ts +17 -1
  128. package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-model.d.ts +2 -0
  129. package/dist/_internal/engine/browser/dom/designer-field-primitives.d.ts +43 -1
  130. package/dist/_internal/engine/browser/dom/designer-icons.d.ts +2 -0
  131. package/dist/_internal/engine/browser/dom/designer-select-dom.d.ts +2 -0
  132. package/dist/_internal/engine/browser/dom/designer-ui-primitives.d.ts +5 -0
  133. package/dist/_internal/engine/browser/dom/layers/designer-layers-model.d.ts +28 -0
  134. package/dist/_internal/engine/browser/dom/material-library/designer-material-library-dom.d.ts +18 -2
  135. package/dist/_internal/engine/browser/dom/material-library/designer-material-library-group-view.d.ts +1 -0
  136. package/dist/_internal/engine/browser/dom/menu/designer-menu-model.d.ts +4 -2
  137. package/dist/_internal/engine/browser/dom/panel/designer-canvas-properties-dom.d.ts +10 -2
  138. package/dist/_internal/engine/browser/dom/panel/designer-canvas-transactions.d.ts +5 -1
  139. package/dist/_internal/engine/browser/dom/panel/designer-chrome-primitives.d.ts +12 -0
  140. package/dist/_internal/engine/browser/dom/panel/designer-color-group-dom.d.ts +45 -0
  141. package/dist/_internal/engine/browser/dom/panel/designer-component-properties-dom.d.ts +4 -3
  142. package/dist/_internal/engine/browser/dom/panel/designer-component-states-dom.d.ts +22 -0
  143. package/dist/_internal/engine/browser/dom/panel/designer-panel-primitives.d.ts +18 -2
  144. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-types.d.ts +2 -0
  145. package/dist/_internal/engine/browser/dom/workspace/designer-workspace-template.d.ts +13 -0
  146. package/dist/_internal/engine/browser/dom/workspace/designer-workspace.d.ts +2 -1
  147. package/dist/_internal/engine/browser/viewport/designer-canvas-aids-types.d.ts +10 -4
  148. package/dist/_internal/engine/browser/viewport/designer-canvas-aids.d.ts +17 -5
  149. package/dist/_internal/engine/browser/viewport/designer-canvas-coordinates.d.ts +7 -0
  150. package/dist/_internal/engine/browser/viewport/designer-canvas-measurements.d.ts +8 -9
  151. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-alignment-index.d.ts +27 -0
  152. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-geometry.d.ts +13 -2
  153. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-preview.d.ts +1 -1
  154. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-spacing.d.ts +12 -0
  155. package/dist/_internal/engine/browser/viewport/designer-guide-overlay-nodes.d.ts +4 -0
  156. package/dist/_internal/engine/browser/viewport/designer-snap-tuning.d.ts +14 -0
  157. package/dist/_internal/engine/common/observability/designer-metrics.d.ts +1 -1
  158. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-geometry.d.ts +12 -0
  159. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-graph.d.ts +203 -0
  160. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model-types.d.ts +6 -2
  161. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model.d.ts +58 -7
  162. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-protocol-types.d.ts +131 -51
  163. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-value-sources.d.ts +7 -3
  164. package/dist/_internal/engine/common/operations/catalog/designer-catalog-refresh.d.ts +13 -1
  165. package/dist/_internal/engine/common/operations/change/designer-change-events.d.ts +2 -0
  166. package/dist/_internal/engine/common/operations/change/designer-change-proposal.d.ts +35 -2
  167. package/dist/_internal/engine/common/operations/designer-operation-registry.d.ts +5 -1
  168. package/dist/_internal/engine/common/operations/designer-variable-operations.d.ts +8 -0
  169. package/dist/_internal/engine/common/operations/display/designer-target-display.d.ts +2 -2
  170. package/dist/_internal/engine/common/operations/element/designer-element-operation-types.d.ts +8 -0
  171. package/dist/_internal/engine/common/operations/host-resource/host-resource-authoring.d.ts +1 -1
  172. package/dist/_internal/engine/common/operations/material-component/material-component-fragment-extract.d.ts +34 -0
  173. package/dist/_internal/engine/common/operations/material-component/material-component-fragment.d.ts +24 -41
  174. package/dist/_internal/engine/common/operations/material-component/material-component.d.ts +1 -1
  175. package/dist/_internal/engine/common/operations/material-library/material-library-fragments.d.ts +46 -0
  176. package/dist/_internal/engine/common/operations/material-library/material-library-grouping.d.ts +11 -0
  177. package/dist/_internal/engine/common/operations/selection/designer-group.d.ts +16 -4
  178. package/dist/_internal/engine/common/operations/selection/designer-multi-selection-operations.d.ts +4 -3
  179. package/dist/_internal/engine/common/operations/selection/designer-selection-actions.d.ts +6 -0
  180. package/dist/_internal/engine/common/operations/selection/designer-selection.d.ts +8 -0
  181. package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +67 -0
  182. package/dist/_internal/engine/common/operations/style/designer-material-appearance.d.ts +30 -0
  183. package/dist/_internal/engine/common/session/designer-artboard.d.ts +40 -0
  184. package/dist/_internal/engine/common/session/designer-session.d.ts +21 -0
  185. package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +169 -0
  186. package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +464 -90
  187. package/dist/_internal/engine/designer-blueprint-workbench-panel-BWSglfAb.js +2792 -0
  188. package/dist/_internal/engine/{designer-dataset-controller-CPytVNBK.js → designer-dataset-controller-DdbY4ILC.js} +1919 -1604
  189. package/dist/_internal/engine/designer-element/api/designer-element-catalog.d.ts +4 -3
  190. package/dist/_internal/engine/designer-element/api/designer-element-change.d.ts +24 -0
  191. package/dist/_internal/engine/designer-element/api/designer-element-configuration-types.d.ts +11 -8
  192. package/dist/_internal/engine/designer-element/api/designer-element-fragment-save.d.ts +16 -0
  193. package/dist/_internal/engine/designer-element/api/designer-element-host-properties.d.ts +0 -5
  194. package/dist/_internal/engine/designer-element/api/designer-element-insert-component-fragment.d.ts +9 -2
  195. package/dist/_internal/engine/designer-element/api/designer-element-material-library-fragments.d.ts +17 -0
  196. package/dist/_internal/engine/designer-element/api/designer-element-project.d.ts +0 -1
  197. package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +36 -24
  198. package/dist/_internal/engine/designer-element/designer-element-public-api.d.ts +7 -6
  199. package/dist/_internal/engine/designer-element/runtime/designer-element-guards.d.ts +0 -2
  200. package/dist/_internal/engine/designer-element/runtime/designer-element-host.d.ts +6 -7
  201. package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +12 -2
  202. package/dist/_internal/engine/designer-element/runtime/designer-element-runtime.d.ts +19 -15
  203. package/dist/_internal/engine/designer-element/runtime/designer-element-sample-data.d.ts +23 -0
  204. package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +29 -10
  205. package/dist/_internal/engine/{designer-ui-primitives-CH4RNiMa.js → designer-field-primitives-Crn464Qg.js} +919 -348
  206. package/dist/_internal/engine/designer-left-panel-groups-dom-DFdLWxxY.js +1282 -0
  207. package/dist/_internal/engine/host-resource-selection-CWrPLVOc.js +2482 -0
  208. package/dist/_internal/engine/host-tokens.css +12 -12
  209. package/dist/_internal/engine/index.js +9202 -6279
  210. package/dist/_internal/host-kit/index.d.ts +3 -0
  211. package/dist/_internal/host-kit/index.js +3 -0
  212. package/dist/_internal/host-kit/intent/index.d.ts +16 -0
  213. package/dist/_internal/host-kit/intent/index.js +13 -0
  214. package/dist/_internal/host-kit/intent/intent-behavior.d.ts +59 -0
  215. package/dist/_internal/host-kit/intent/intent-behavior.js +812 -0
  216. package/dist/_internal/host-kit/intent/intent-block.d.ts +59 -0
  217. package/dist/_internal/host-kit/intent/intent-block.js +359 -0
  218. package/dist/_internal/host-kit/intent/intent-catalog.d.ts +105 -0
  219. package/dist/_internal/host-kit/intent/intent-catalog.js +60 -0
  220. package/dist/_internal/host-kit/intent/intent-compile-types.d.ts +222 -0
  221. package/dist/_internal/host-kit/intent/intent-compile-types.js +10 -0
  222. package/dist/_internal/host-kit/intent/intent-compile.d.ts +35 -0
  223. package/dist/_internal/host-kit/intent/intent-compile.js +465 -0
  224. package/dist/_internal/host-kit/intent/intent-data-check.d.ts +50 -0
  225. package/dist/_internal/host-kit/intent/intent-data-check.js +163 -0
  226. package/dist/_internal/host-kit/intent/intent-data-context.d.ts +53 -0
  227. package/dist/_internal/host-kit/intent/intent-data-context.js +200 -0
  228. package/dist/_internal/host-kit/intent/intent-dataset.d.ts +52 -0
  229. package/dist/_internal/host-kit/intent/intent-dataset.js +125 -0
  230. package/dist/_internal/host-kit/intent/intent-format.d.ts +33 -0
  231. package/dist/_internal/host-kit/intent/intent-format.js +94 -0
  232. package/dist/_internal/host-kit/intent/intent-kpi-bind.d.ts +29 -0
  233. package/dist/_internal/host-kit/intent/intent-kpi-bind.js +59 -0
  234. package/dist/_internal/host-kit/intent/intent-layout.d.ts +102 -0
  235. package/dist/_internal/host-kit/intent/intent-layout.js +264 -0
  236. package/dist/_internal/host-kit/intent/intent-parse.d.ts +39 -0
  237. package/dist/_internal/host-kit/intent/intent-parse.js +930 -0
  238. package/dist/_internal/host-kit/intent/intent-prepare.d.ts +52 -0
  239. package/dist/_internal/host-kit/intent/intent-prepare.js +104 -0
  240. package/dist/_internal/host-kit/intent/intent-session.d.ts +202 -0
  241. package/dist/_internal/host-kit/intent/intent-session.js +1001 -0
  242. package/dist/_internal/host-kit/intent/intent-stream.d.ts +28 -0
  243. package/dist/_internal/host-kit/intent/intent-stream.js +183 -0
  244. package/dist/_internal/host-kit/intent/intent-style.d.ts +37 -0
  245. package/dist/_internal/host-kit/intent/intent-style.js +77 -0
  246. package/dist/_internal/host-kit/intent/intent-types.d.ts +234 -0
  247. package/dist/_internal/host-kit/intent/intent-types.js +10 -0
  248. package/dist/_internal/host-kit/push-result.d.ts +5 -0
  249. package/dist/_internal/host-kit/push-result.js +8 -0
  250. package/dist/_internal/host-kit/sse-subscribe.d.ts +59 -0
  251. package/dist/_internal/host-kit/sse-subscribe.js +253 -0
  252. package/dist/_internal/host-kit/subscription-hub.d.ts +41 -0
  253. package/dist/_internal/host-kit/subscription-hub.js +179 -0
  254. package/dist/_internal/material/base-material.d.ts +1 -0
  255. package/dist/_internal/material/chart.d.ts +4 -0
  256. package/dist/_internal/material/chart.js +123 -58
  257. package/dist/_internal/material/container.js +19 -33
  258. package/dist/_internal/material/{base-material-BArgjOeL.js → editor-descriptor-DJZYygOa.js} +49 -20
  259. package/dist/_internal/material/editor-descriptor.d.ts +18 -0
  260. package/dist/_internal/material/image.js +30 -34
  261. package/dist/_internal/material/rule.js +29 -42
  262. package/dist/_internal/material/shapes.js +57 -74
  263. package/dist/_internal/material/table.d.ts +4 -0
  264. package/dist/_internal/material/table.js +149 -71
  265. package/dist/_internal/material/text.js +40 -68
  266. package/dist/_internal/plugin-core/contracts.d.ts +38 -49
  267. package/dist/_internal/plugin-core/contribution-kind.js +47 -2
  268. package/dist/_internal/plugin-core/editor/editor-ai-description.d.ts +3 -0
  269. package/dist/_internal/plugin-core/editor/editor-ai-description.js +124 -0
  270. package/dist/_internal/plugin-core/editor/editor-descriptor-conditions.js +5 -0
  271. package/dist/_internal/plugin-core/editor/editor-descriptor-inference.d.ts +32 -0
  272. package/dist/_internal/plugin-core/editor/editor-descriptor-inference.js +83 -0
  273. package/dist/_internal/plugin-core/editor/editor-descriptor-items.d.ts +6 -0
  274. package/dist/_internal/plugin-core/editor/editor-descriptor-items.js +41 -12
  275. package/dist/_internal/plugin-core/editor/editor-descriptor-model.d.ts +24 -1
  276. package/dist/_internal/plugin-core/editor/editor-descriptor-model.js +6 -1
  277. package/dist/_internal/plugin-core/editor/editor-descriptor-schema.js +21 -0
  278. package/dist/_internal/plugin-core/editor/editor-descriptor-sections.js +5 -7
  279. package/dist/_internal/plugin-core/editor/editor-descriptor.d.ts +1 -0
  280. package/dist/_internal/plugin-core/editor/editor-descriptor.js +55 -2
  281. package/dist/_internal/plugin-core/fragment/fragment.d.ts +96 -0
  282. package/dist/_internal/plugin-core/fragment/fragment.js +535 -0
  283. package/dist/_internal/plugin-core/index.d.ts +7 -4
  284. package/dist/_internal/plugin-core/index.js +5 -2
  285. package/dist/_internal/plugin-core/material/material-manifest.js +14 -2
  286. package/dist/_internal/plugin-core/material/material-schema.d.ts +9 -0
  287. package/dist/_internal/plugin-core/material/material-schema.js +31 -1
  288. package/dist/_internal/plugin-core/material/material-theme.d.ts +25 -0
  289. package/dist/_internal/plugin-core/material/material-theme.js +77 -0
  290. package/dist/_internal/plugin-core/material/material-validation-constants.js +2 -0
  291. package/dist/_internal/plugin-core/material/material.d.ts +1 -1
  292. package/dist/_internal/plugin-core/material/material.js +1 -1
  293. package/dist/_internal/plugin-manager/contribution-kind-plan.d.ts +2 -1
  294. package/dist/_internal/plugin-manager/contribution-kind-plan.js +6 -0
  295. package/dist/_internal/plugin-manager/contributions.js +10 -0
  296. package/dist/_internal/plugin-sdk/authoring-finding.d.ts +19 -0
  297. package/dist/_internal/plugin-sdk/authoring-finding.js +12 -0
  298. package/dist/_internal/plugin-sdk/fragment-audit.d.ts +14 -0
  299. package/dist/_internal/plugin-sdk/fragment-audit.js +170 -0
  300. package/dist/_internal/plugin-sdk/fragment-definition.d.ts +11 -0
  301. package/dist/_internal/plugin-sdk/fragment-definition.js +16 -0
  302. package/dist/_internal/plugin-sdk/index.d.ts +15 -0
  303. package/dist/_internal/plugin-sdk/index.js +15 -0
  304. package/dist/_internal/plugin-sdk/material-config-groups.d.ts +44 -0
  305. package/dist/_internal/plugin-sdk/material-config-groups.js +80 -0
  306. package/dist/_internal/plugin-sdk/material-editor-audit.d.ts +24 -0
  307. package/dist/_internal/plugin-sdk/material-editor-audit.js +160 -0
  308. package/dist/_internal/plugin-sdk/material-isolated-csp.d.ts +38 -0
  309. package/dist/_internal/plugin-sdk/material-isolated-csp.js +67 -0
  310. package/dist/_internal/plugin-sdk/material-isolated-runtime.d.ts +22 -0
  311. package/dist/_internal/plugin-sdk/material-isolated-runtime.js +262 -0
  312. package/dist/_internal/plugin-sdk/material-isolated.d.ts +94 -0
  313. package/dist/_internal/plugin-sdk/material-isolated.js +1024 -0
  314. package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +77 -0
  315. package/dist/_internal/plugin-sdk/material-rendered-element.js +229 -0
  316. package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +24 -0
  317. package/dist/_internal/plugin-sdk/material-spec-audit.js +204 -0
  318. package/dist/_internal/plugin-sdk/material-spec.d.ts +134 -0
  319. package/dist/_internal/plugin-sdk/material-spec.js +710 -0
  320. package/dist/_internal/plugin-sdk/material-style-keys.d.ts +17 -0
  321. package/dist/_internal/plugin-sdk/material-style-keys.js +82 -0
  322. package/dist/_internal/plugin-sdk/material-template-audit.d.ts +12 -0
  323. package/dist/_internal/plugin-sdk/material-template-audit.js +302 -0
  324. package/dist/_internal/plugin-sdk/material-template-expression.d.ts +98 -0
  325. package/dist/_internal/plugin-sdk/material-template-expression.js +549 -0
  326. package/dist/_internal/plugin-sdk/material-template-render.d.ts +32 -0
  327. package/dist/_internal/plugin-sdk/material-template-render.js +579 -0
  328. package/dist/_internal/plugin-sdk/material-template.d.ts +185 -0
  329. package/dist/_internal/plugin-sdk/material-template.js +879 -0
  330. package/dist/_internal/renderer/index.d.ts +2 -0
  331. package/dist/_internal/renderer/index.js +1745 -616
  332. package/dist/_internal/renderer/renderer/renderer-component-states.d.ts +34 -0
  333. package/dist/_internal/renderer/renderer/renderer-effective-style.d.ts +12 -6
  334. package/dist/_internal/renderer/renderer/renderer-material-dom.d.ts +19 -3
  335. package/dist/_internal/renderer/renderer/renderer-mounted-material.d.ts +11 -10
  336. package/dist/_internal/renderer/renderer/renderer-state.d.ts +17 -1
  337. package/dist/_internal/renderer/renderer/renderer-theme.d.ts +11 -0
  338. package/dist/_internal/renderer/renderer/renderer-types.d.ts +15 -5
  339. package/dist/_internal/renderer/renderer/renderer.d.ts +30 -9
  340. package/dist/_internal/renderer/resource/data-source-runtime.d.ts +25 -2
  341. package/dist/_internal/renderer/resource/push-window.d.ts +43 -0
  342. package/dist/_internal/renderer/resource/source-query-port.d.ts +8 -1
  343. package/dist/_internal/renderer/sub-canvas-layer.d.ts +83 -0
  344. package/dist/_internal/renderer/viewer/viewer-blueprint-timer-scheduler.d.ts +23 -0
  345. package/dist/_internal/renderer/viewer/viewer-configuration-guards.d.ts +0 -1
  346. package/dist/_internal/renderer/viewer/viewer-configuration.d.ts +6 -3
  347. package/dist/_internal/renderer/viewer/viewer-stale-style.d.ts +3 -0
  348. package/dist/_internal/renderer/viewer/viewer-variable-controller.d.ts +2 -0
  349. package/dist/_internal/renderer/viewer/viewer.d.ts +18 -7
  350. package/dist/_internal/sdk/auto-register.js +7 -7
  351. package/dist/_internal/sdk/designer-auto-register.js +3 -3
  352. package/dist/_internal/sdk/designer.d.ts +1 -1
  353. package/dist/_internal/sdk/designer.js +8 -8
  354. package/dist/_internal/sdk/host-tokens.css +12 -12
  355. package/dist/_internal/sdk/index.d.ts +1 -1
  356. package/dist/_internal/sdk/index.js +6 -6
  357. package/dist/auto-register.js +11 -11
  358. package/dist/auto-register.js.map +1 -1
  359. package/dist/contracts.js +73 -43
  360. package/dist/contracts.js.map +1 -1
  361. package/dist/contrast-DRPezUIl.js +131 -0
  362. package/dist/contrast-DRPezUIl.js.map +1 -0
  363. package/dist/core.js +169 -21
  364. package/dist/core.js.map +1 -1
  365. package/dist/{data-contracts-BFld0hw_.js → data-contracts-CnnB5KC9.js} +2 -2
  366. package/dist/{data-contracts-BFld0hw_.js.map → data-contracts-CnnB5KC9.js.map} +1 -1
  367. package/dist/dataset-port-D993nOlT.js +182 -0
  368. package/dist/dataset-port-D993nOlT.js.map +1 -0
  369. package/dist/dataset-profile-Dk6xdtsM.js +261 -0
  370. package/dist/dataset-profile-Dk6xdtsM.js.map +1 -0
  371. package/dist/{designer-Byw45cUM.js → designer-CFOvOmLn.js} +3 -3
  372. package/dist/designer-CFOvOmLn.js.map +1 -0
  373. package/dist/designer-auto-register.js +6 -6
  374. package/dist/designer-auto-register.js.map +1 -1
  375. package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js +2773 -0
  376. package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js.map +1 -0
  377. package/dist/{designer-dataset-controller-CPytVNBK-DWL3SRTP.js → designer-dataset-controller-DdbY4ILC-CMdGdGbr.js} +1471 -1158
  378. package/dist/designer-dataset-controller-DdbY4ILC-CMdGdGbr.js.map +1 -0
  379. package/dist/{designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js → designer-field-primitives-Crn464Qg-Bi7q8s5J.js} +914 -345
  380. package/dist/designer-field-primitives-Crn464Qg-Bi7q8s5J.js.map +1 -0
  381. package/dist/designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js +1265 -0
  382. package/dist/designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js.map +1 -0
  383. package/dist/designer.js +5 -5
  384. package/dist/dist-B2bW2Tru.js +3305 -0
  385. package/dist/dist-B2bW2Tru.js.map +1 -0
  386. package/dist/{dist-BHTClwId.js → dist-CHK9BTXX.js} +9148 -6234
  387. package/dist/dist-CHK9BTXX.js.map +1 -0
  388. package/dist/engine.js +5 -4
  389. package/dist/fragment-B-oP0Fru.js +393 -0
  390. package/dist/fragment-B-oP0Fru.js.map +1 -0
  391. package/dist/host-kit.js +4172 -102
  392. package/dist/host-kit.js.map +1 -1
  393. package/dist/{host-resource-selection-5Cf_gclK-Sv4Z8UXS.js → host-resource-selection-CWrPLVOc-DPDq3jau.js} +1233 -937
  394. package/dist/host-resource-selection-CWrPLVOc-DPDq3jau.js.map +1 -0
  395. package/dist/host-tokens.css +12 -12
  396. package/dist/index.js +10 -10
  397. package/dist/legibility-CS28ivEz.js +12 -0
  398. package/dist/legibility-CS28ivEz.js.map +1 -0
  399. package/dist/level-scale-CwHqFEVd.js +139 -0
  400. package/dist/level-scale-CwHqFEVd.js.map +1 -0
  401. package/dist/{manager-B2CZ2b5I.js → manager-CeB4Jnr9.js} +20 -10
  402. package/dist/manager-CeB4Jnr9.js.map +1 -0
  403. package/dist/material-DeVkzSoT.js +12 -0
  404. package/dist/{material-BPlvEmDi.js.map → material-DeVkzSoT.js.map} +1 -1
  405. package/dist/material-auto-register.js +6 -6
  406. package/dist/material-auto-register.js.map +1 -1
  407. package/dist/{material-definition-B9xCZcD-.js → material-definition-BeW34dJr.js} +2 -2
  408. package/dist/{material-definition-B9xCZcD-.js.map → material-definition-BeW34dJr.js.map} +1 -1
  409. package/dist/{material-manifest-bsGl6vZZ.js → material-manifest-B1XatGPx.js} +222 -137
  410. package/dist/material-manifest-B1XatGPx.js.map +1 -0
  411. package/dist/material-schema-CLoDx-Tl.js +203 -0
  412. package/dist/material-schema-CLoDx-Tl.js.map +1 -0
  413. package/dist/{editor-descriptor-schema-Be30Wv8w.js → material-theme-C91eus78.js} +90 -28
  414. package/dist/material-theme-C91eus78.js.map +1 -0
  415. package/dist/material-validation-utils-ku_6Xxk2.js +125 -0
  416. package/dist/material-validation-utils-ku_6Xxk2.js.map +1 -0
  417. package/dist/material.js +3 -3
  418. package/dist/migrate-document-BM888PtC.js +768 -0
  419. package/dist/migrate-document-BM888PtC.js.map +1 -0
  420. package/dist/parse-Ji7kE9ZT.js +2313 -0
  421. package/dist/parse-Ji7kE9ZT.js.map +1 -0
  422. package/dist/{parse-B0hwp_yj.js → parse-aZat9tAS.js} +69 -61
  423. package/dist/{parse-B0hwp_yj.js.map → parse-aZat9tAS.js.map} +1 -1
  424. package/dist/parse-parts-qzl4suzk.js +42 -0
  425. package/dist/parse-parts-qzl4suzk.js.map +1 -0
  426. package/dist/{plugin-B9Xxtw7G.js → plugin-CstHQ5ws.js} +140 -94
  427. package/dist/plugin-CstHQ5ws.js.map +1 -0
  428. package/dist/plugin-core.js +93 -8
  429. package/dist/plugin-core.js.map +1 -0
  430. package/dist/plugin-manager.js +1 -1
  431. package/dist/plugin-package-DWifuHi1.js +4206 -0
  432. package/dist/plugin-package-DWifuHi1.js.map +1 -0
  433. package/dist/{plugin-registration-BjS_CXJU.js → plugin-registration-DTwBvnHX.js} +4 -4
  434. package/dist/{plugin-registration-BjS_CXJU.js.map → plugin-registration-DTwBvnHX.js.map} +1 -1
  435. package/dist/plugin-sdk.js +6 -6
  436. package/dist/{plugins-B9bwk-t6.js → plugins-QDL0yIql.js} +2 -2
  437. package/dist/{plugins-B9bwk-t6.js.map → plugins-QDL0yIql.js.map} +1 -1
  438. package/dist/plugins.js +8 -8
  439. package/dist/renderer.js +1 -1
  440. package/dist/runtime-dispatch-C0gyIrTv.js +479 -0
  441. package/dist/runtime-dispatch-C0gyIrTv.js.map +1 -0
  442. package/dist/runtime-simulate-aSYO9yDX.js +147 -0
  443. package/dist/runtime-simulate-aSYO9yDX.js.map +1 -0
  444. package/dist/{src-Bm7u11mN-BMeb9fvV.js → src-Bm7u11mN-Bi1hDVkh.js} +30 -30
  445. package/dist/{src-Bm7u11mN-BMeb9fvV.js.map → src-Bm7u11mN-Bi1hDVkh.js.map} +1 -1
  446. package/dist/state-preset-DtpygJOH.js +22 -0
  447. package/dist/state-preset-DtpygJOH.js.map +1 -0
  448. package/dist/{text-BVzTcUas.js → text-BSTz0pFQ.js} +454 -360
  449. package/dist/text-BSTz0pFQ.js.map +1 -0
  450. package/dist/theme-CcBXf4Ay.js +48 -0
  451. package/dist/theme-CcBXf4Ay.js.map +1 -0
  452. package/dist/{value-ref-y4_YKUP5.js → value-ref-XkLuckGV.js} +2 -2
  453. package/dist/{value-ref-y4_YKUP5.js.map → value-ref-XkLuckGV.js.map} +1 -1
  454. package/dist/{viewer-CrJupI8I-DZZfdHXr.js → viewer-CrJupI8I-BJiz1cvW.js} +5 -5
  455. package/dist/{viewer-CrJupI8I-DZZfdHXr.js.map → viewer-CrJupI8I-BJiz1cvW.js.map} +1 -1
  456. package/dist/viewer-auto-register.js +2 -2
  457. package/dist/viewer.js +2 -2
  458. package/dist/viewport-BNIRWjiT.js +1207 -0
  459. package/dist/viewport-BNIRWjiT.js.map +1 -0
  460. package/package.json +12 -12
  461. package/dist/_internal/contracts/document/blueprint-relations.d.ts +0 -16
  462. package/dist/_internal/contracts/document/blueprint-relations.js +0 -196
  463. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-panel-mutations.d.ts +0 -5
  464. package/dist/_internal/engine/browser/controllers/designer-guard-controller.d.ts +0 -27
  465. package/dist/_internal/engine/browser/controllers/designer-scene-controller.d.ts +0 -47
  466. package/dist/_internal/engine/browser/controllers/panel/designer-style-rules-controller.d.ts +0 -12
  467. package/dist/_internal/engine/browser/dom/guard/designer-contrast-measure.d.ts +0 -24
  468. package/dist/_internal/engine/browser/dom/guard/designer-guard-dom.d.ts +0 -15
  469. package/dist/_internal/engine/browser/dom/workspace/designer-canvas-hint-dom.d.ts +0 -6
  470. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-index.d.ts +0 -9
  471. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-connection.d.ts +0 -14
  472. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-mutation-helpers.d.ts +0 -20
  473. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-mutations.d.ts +0 -15
  474. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-node-ids.d.ts +0 -12
  475. package/dist/_internal/engine/common/operations/designer-name-validation.d.ts +0 -2
  476. package/dist/_internal/engine/common/operations/scene/designer-scene.d.ts +0 -55
  477. package/dist/_internal/engine/common/operations/style/designer-host-conditional-style.d.ts +0 -21
  478. package/dist/_internal/engine/common/operations/style/designer-style-rules.d.ts +0 -25
  479. package/dist/_internal/engine/common/validation/designer-guard.d.ts +0 -49
  480. package/dist/_internal/engine/designer-blueprint-workbench-panel-C2MoZwKA.js +0 -3548
  481. package/dist/_internal/engine/designer-element/api/designer-element-guard.d.ts +0 -13
  482. package/dist/_internal/engine/designer-element/api/designer-element-scene.d.ts +0 -14
  483. package/dist/_internal/engine/designer-left-panel-groups-dom-WMsH33zw.js +0 -573
  484. package/dist/_internal/engine/host-resource-selection-5Cf_gclK.js +0 -2188
  485. package/dist/_internal/renderer/style-rules.d.ts +0 -9
  486. package/dist/contrast-CZFqj1I5.js +0 -1050
  487. package/dist/contrast-CZFqj1I5.js.map +0 -1
  488. package/dist/dataset-port-CUsMmX2x.js +0 -65
  489. package/dist/dataset-port-CUsMmX2x.js.map +0 -1
  490. package/dist/designer-Byw45cUM.js.map +0 -1
  491. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js +0 -3517
  492. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js.map +0 -1
  493. package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js.map +0 -1
  494. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js +0 -557
  495. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js.map +0 -1
  496. package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js.map +0 -1
  497. package/dist/dist-BHTClwId.js.map +0 -1
  498. package/dist/dist-DfAV2jGI.js +0 -2185
  499. package/dist/dist-DfAV2jGI.js.map +0 -1
  500. package/dist/editor-descriptor-schema-Be30Wv8w.js.map +0 -1
  501. package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js.map +0 -1
  502. package/dist/manager-B2CZ2b5I.js.map +0 -1
  503. package/dist/material-BPlvEmDi.js +0 -12
  504. package/dist/material-manifest-bsGl6vZZ.js.map +0 -1
  505. package/dist/material-schema-CtxTkCP2.js +0 -267
  506. package/dist/material-schema-CtxTkCP2.js.map +0 -1
  507. package/dist/migrate-document-BJUN7NPv.js +0 -436
  508. package/dist/migrate-document-BJUN7NPv.js.map +0 -1
  509. package/dist/parse-BQw3u9_4.js +0 -1126
  510. package/dist/parse-BQw3u9_4.js.map +0 -1
  511. package/dist/plugin-B9Xxtw7G.js.map +0 -1
  512. package/dist/plugin-package-BT-pCoTt.js +0 -174
  513. package/dist/plugin-package-BT-pCoTt.js.map +0 -1
  514. package/dist/runtime-dispatch-Dt9fhcI5.js +0 -360
  515. package/dist/runtime-dispatch-Dt9fhcI5.js.map +0 -1
  516. package/dist/schema-C38FI_z2.js +0 -541
  517. package/dist/schema-C38FI_z2.js.map +0 -1
  518. package/dist/text-BVzTcUas.js.map +0 -1
@@ -1,57 +1,57 @@
1
- import { MAX_DATA_SOURCE_VALUE_BYTES as e, evaluateScreenDatasetParameters as t, isScreenHostDatasetPort as n, normalizeScreenMaterialError as r, parseScreenDatasetDefinition as i, parseScreenDocument as a, parseScreenJsonValue as o, parseScreenTabularDataset as s, readScreenComponentDataBinding as c, readScreenComponentValueRef as l, readScreenDocumentDataSources as u, readScreenVariableRecord as d, screenDataSourceOrder as f, screenJsonEquals as p, sortScreenDiagnostics as m } from "@base-screen/contracts";
2
- import { collectScreenValueRefDependencies as h, compileScreenBlueprint as g, dispatchScreenBlueprintEvent as _, evaluateScreenValueRef as v, getPainterOrder as ee, validateScreenDataBinding as te } from "@base-screen/core";
3
- import { diffBaseScreenMaterialCatalogs as ne, parseBaseScreenMaterialEventDetail as y, screenValueRefAccepted as b, validateBaseScreenMaterialProps as x, validateBaseScreenMaterialStyle as S } from "@base-screen/plugin-core";
1
+ import { DEFAULT_PUSH_RETAIN_ROWS as e, DEFAULT_SCREEN_COMPONENT_STATE_ID as t, MAX_DATA_SOURCE_VALUE_BYTES as n, evaluateScreenDatasetParameters as r, isScreenHostDatasetPort as i, isScreenThemeRefSyntax as a, listScreenComponentStateDependencies as o, normalizeScreenMaterialError as s, parseScreenDatasetDefinition as c, parseScreenDocument as l, parseScreenJsonValue as u, parseScreenTabularDataset as d, readScreenComponentDataBinding as f, readScreenComponentValueRef as p, readScreenDocumentDataSources as m, readScreenThemeColor as h, readScreenThemeRef as g, readScreenVariableRecord as _, resolveScreenComponentState as ee, resolveScreenPopupPosition as te, resolveScreenStartPageId as ne, screenDataSourceOrder as re, sortScreenDiagnostics as ie } from "@base-screen/contracts";
2
+ import { collectScreenValueRefDependencies as v, compileScreenBlueprint as ae, dispatchScreenBlueprintEvent as oe, evaluateScreenValueRef as se, getPainterOrder as ce, validateScreenDataBinding as le } from "@base-screen/core";
3
+ import { diffBaseScreenMaterialCatalogs as ue, parseBaseScreenMaterialEventDetail as de, screenValueRefAccepted as fe, validateBaseScreenMaterialProps as y, validateBaseScreenMaterialStyle as pe } from "@base-screen/plugin-core";
4
4
  //#region src/canvas-background.ts
5
- function re(e, t) {
5
+ function b(e, t) {
6
6
  let n = t.background;
7
7
  e.style.backgroundColor = n?.type === "solid" ? n.color : t.backgroundColor;
8
8
  let r = [], i = [];
9
- t.backgroundImage !== void 0 && (r.push(`url("${ae(t.backgroundImage)}")`), i.push(t.backgroundImageFit === "contain" ? "contain" : "cover"));
10
- let a = n === void 0 ? void 0 : ie(n);
9
+ t.backgroundImage !== void 0 && (r.push(`url("${he(t.backgroundImage)}")`), i.push(t.backgroundImageFit === "contain" ? "contain" : "cover"));
10
+ let a = n === void 0 ? void 0 : me(n);
11
11
  if (a !== void 0 && (r.push(a), i.push("100% 100%")), r.length === 0) {
12
12
  e.style.backgroundImage = "", e.style.backgroundSize = "", e.style.backgroundPosition = "", e.style.backgroundRepeat = "";
13
13
  return;
14
14
  }
15
15
  e.style.backgroundImage = r.join(", "), e.style.backgroundSize = i.join(", "), e.style.backgroundPosition = r.map(() => "center").join(", "), e.style.backgroundRepeat = r.map(() => "no-repeat").join(", ");
16
16
  }
17
- function ie(e) {
17
+ function me(e) {
18
18
  if (e.type === "solid") return;
19
19
  let t = e.stops.map((e) => `${e.color} ${e.position}%`).join(", ");
20
20
  return e.type === "linear-gradient" ? `linear-gradient(${e.angle}deg, ${t})` : `radial-gradient(circle at ${e.position.x}% ${e.position.y}%, ${t})`;
21
21
  }
22
- function ae(e) {
22
+ function he(e) {
23
23
  return e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
24
24
  }
25
25
  //#endregion
26
26
  //#region src/canonical-json.ts
27
- function C(e) {
27
+ function x(e) {
28
28
  if (e === null) return "null";
29
29
  if (typeof e == "boolean") return e ? "true" : "false";
30
30
  if (typeof e == "number" || typeof e == "string") return JSON.stringify(e);
31
- if (Array.isArray(e)) return `[${e.map((e) => C(e)).join(",")}]`;
31
+ if (Array.isArray(e)) return `[${e.map((e) => x(e)).join(",")}]`;
32
32
  let t = e;
33
- return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${C(t[e])}`).join(",")}}`;
33
+ return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${x(t[e])}`).join(",")}}`;
34
34
  }
35
35
  //#endregion
36
36
  //#region src/resource/resource-state.ts
37
- function oe() {
37
+ function ge() {
38
38
  return {
39
39
  projectionKey: void 0,
40
40
  dataState: { status: "idle" }
41
41
  };
42
42
  }
43
- function se(e) {
44
- return C(e);
43
+ function _e(e) {
44
+ return x(e);
45
45
  }
46
46
  //#endregion
47
47
  //#region src/renderer/renderer-diagnostics.ts
48
- function w(e, t) {
48
+ function S(e, t) {
49
49
  return e.map((e) => ({
50
50
  ...e,
51
51
  path: [...t, ...e.path]
52
52
  }));
53
53
  }
54
- function T(e, t, n) {
54
+ function C(e, t, n) {
55
55
  return {
56
56
  severity: "error",
57
57
  code: e,
@@ -59,13 +59,13 @@ function T(e, t, n) {
59
59
  message: n
60
60
  };
61
61
  }
62
- function E(e, t, n) {
62
+ function w(e, t, n) {
63
63
  return {
64
64
  ok: !1,
65
- diagnostics: [T(e, t, n)]
65
+ diagnostics: [C(e, t, n)]
66
66
  };
67
67
  }
68
- function D(e, t) {
68
+ function T(e, t) {
69
69
  return {
70
70
  severity: "error",
71
71
  code: "PLUGIN_CORE_RENDER_FAILED",
@@ -73,18 +73,18 @@ function D(e, t) {
73
73
  message: t
74
74
  };
75
75
  }
76
- function ce(e) {
77
- return m(e);
76
+ function ve(e) {
77
+ return ie(e);
78
78
  }
79
79
  //#endregion
80
80
  //#region src/renderer/renderer-data-source.ts
81
- function le(e, t, n, r, i) {
81
+ function ye(e, t, n, r, i) {
82
82
  if (n === null) return {
83
83
  status: "ready",
84
84
  value: t
85
85
  };
86
- let a = s(t);
87
- return a.ok ? k(e, a.value, n, r, i, {
86
+ let a = d(t);
87
+ return a.ok ? D(e, a.value, n, r, i, {
88
88
  bindingCode: "Host dataset binding is invalid.",
89
89
  adapterCode: "Host dataset adapter failed."
90
90
  }) : {
@@ -93,17 +93,17 @@ function le(e, t, n, r, i) {
93
93
  message: "Host dataset is invalid."
94
94
  };
95
95
  }
96
- function O(e, t, n) {
96
+ function E(e, t, n) {
97
97
  if (e.manifest.staticData?.kind !== "tabular") return {
98
98
  status: "ready",
99
99
  value: t
100
100
  };
101
- let r = s(t);
101
+ let r = d(t);
102
102
  return r.ok ? n === null ? {
103
103
  status: "error",
104
104
  code: "HOST_DATASET_BINDING_INVALID",
105
105
  message: "Static dataset binding is invalid."
106
- } : k(e, r.value, n, void 0, void 0, {
106
+ } : D(e, r.value, n, void 0, void 0, {
107
107
  bindingCode: "Static dataset binding is invalid.",
108
108
  adapterCode: "Static dataset adapter failed."
109
109
  }) : {
@@ -112,30 +112,30 @@ function O(e, t, n) {
112
112
  message: "Static dataset is invalid."
113
113
  };
114
114
  }
115
- function k(e, t, n, r, i, a) {
116
- let s = e.manifest.dataBinding, c = e.tabularDataAdapter;
117
- if (s === void 0 || c === void 0) return {
115
+ function D(e, t, n, r, i, a) {
116
+ let o = e.manifest.dataBinding, s = e.tabularDataAdapter;
117
+ if (o === void 0 || s === void 0) return {
118
118
  status: "error",
119
119
  code: "HOST_DATASET_BINDING_INVALID",
120
120
  message: a.bindingCode
121
121
  };
122
- let l = te(n, t.fields, s.roles);
123
- if (!l.ok) return {
122
+ let c = le(n, t.fields, o.roles);
123
+ if (!c.ok) return {
124
124
  status: "error",
125
125
  code: "HOST_DATASET_BINDING_INVALID",
126
126
  message: a.bindingCode
127
127
  };
128
128
  try {
129
- let e = c.adapt({
129
+ let e = s.adapt({
130
130
  dataset: t,
131
- fields: l.value.fields
131
+ fields: c.value.fields
132
132
  });
133
133
  if (!e.ok) return {
134
134
  status: "error",
135
135
  code: "HOST_DATASET_ADAPTER_FAILED",
136
136
  message: a.adapterCode
137
137
  };
138
- let n = o(e.value, { maxBytes: 1048576 });
138
+ let n = u(e.value, { maxBytes: 1048576 });
139
139
  return n.ok ? {
140
140
  status: "ready",
141
141
  value: n.value
@@ -145,7 +145,7 @@ function k(e, t, n, r, i, a) {
145
145
  message: a.adapterCode
146
146
  };
147
147
  } catch {
148
- return r !== void 0 && i?.(T("PLUGIN_CORE_RENDER_FAILED", [
148
+ return r !== void 0 && i?.(C("PLUGIN_CORE_RENDER_FAILED", [
149
149
  "components",
150
150
  r,
151
151
  "dataBinding"
@@ -157,67 +157,114 @@ function k(e, t, n, r, i, a) {
157
157
  }
158
158
  }
159
159
  //#endregion
160
+ //#region src/renderer/renderer-theme.ts
161
+ function O(e, t) {
162
+ let n, r = [];
163
+ for (let [i, o] of Object.entries(e)) {
164
+ if (typeof o != "string" || !a(o)) continue;
165
+ let s = g(o), c = s === void 0 ? void 0 : h(t, s);
166
+ if (c === void 0) {
167
+ r.push(i);
168
+ continue;
169
+ }
170
+ n ??= { ...e }, n[i] = c;
171
+ }
172
+ return {
173
+ style: n ?? e,
174
+ unresolved: r
175
+ };
176
+ }
177
+ //#endregion
160
178
  //#region src/renderer/renderer-candidates.ts
161
- function A(e, t, n, r, i, a, o, s = "fail") {
179
+ function be(e, t, n, r, i, a, o, s = "fail") {
162
180
  let c = [], l = [], u = /* @__PURE__ */ new Map();
163
181
  for (let s = 0; s < e.components.length; s++) {
164
182
  let d = e.components[s], f = t.get(d.type);
165
183
  if (f === void 0) {
166
- l.push(T("PLUGIN_CORE_IDENTITY_INVALID", [
184
+ l.push(C("PLUGIN_CORE_IDENTITY_INVALID", [
167
185
  "components",
168
186
  s,
169
187
  "type"
170
188
  ], "Component material is not enabled in this catalog."));
171
189
  continue;
172
190
  }
173
- let p = o.entries.get(d), m, h;
174
- if (p !== void 0 && p.entry === f) m = p.props, h = p.style, u.set(d, p);
191
+ let p = o.entries.get(d), m, h, g;
192
+ if (p !== void 0 && p.entry === f && p.theme === e.theme) m = p.props, h = p.style, g = p.stateStyles, u.set(d, p);
175
193
  else {
176
- let e = x(d.props, f.manifest.propsSchema);
177
- if (!e.ok) {
178
- l.push(...w(e.diagnostics, [
194
+ let t = y(d.props, f.manifest.propsSchema);
195
+ if (!t.ok) {
196
+ l.push(...S(t.diagnostics, [
179
197
  "components",
180
198
  s,
181
199
  "props"
182
200
  ]));
183
201
  continue;
184
202
  }
185
- let t = S(d.style, f.manifest.styleSchema);
186
- if (!t.ok) {
187
- l.push(...w(t.diagnostics, [
203
+ let n = pe(d.style, f.manifest.styleSchema);
204
+ if (!n.ok) {
205
+ l.push(...S(n.diagnostics, [
188
206
  "components",
189
207
  s,
190
208
  "style"
191
209
  ]));
192
210
  continue;
193
211
  }
194
- let n = d.styleRules ?? [], r = !0;
195
- for (let e = 0; e < n.length; e++) {
196
- let i = S({
197
- ...t.value,
198
- ...n[e].style
212
+ let r = O(n.value, e.theme);
213
+ if (r.unresolved.length > 0) {
214
+ l.push(...r.unresolved.map((e) => C("DOCUMENT_FIELD_INVALID", [
215
+ "components",
216
+ s,
217
+ "style",
218
+ e
219
+ ], "Theme reference cannot be resolved against the document palette.")));
220
+ continue;
221
+ }
222
+ let i = d.states?.items ?? [], a = /* @__PURE__ */ new Map(), o = !0;
223
+ for (let t = 0; t < i.length; t++) {
224
+ let n = i[t];
225
+ if (Object.keys(n.style).length === 0) continue;
226
+ let c = O(n.style, e.theme);
227
+ if (c.unresolved.length > 0) {
228
+ l.push(...c.unresolved.map((e) => C("DOCUMENT_FIELD_INVALID", [
229
+ "components",
230
+ s,
231
+ "states",
232
+ "items",
233
+ t,
234
+ "style",
235
+ e
236
+ ], "Theme reference cannot be resolved against the document palette."))), o = !1;
237
+ break;
238
+ }
239
+ let u = pe({
240
+ ...r.style,
241
+ ...c.style
199
242
  }, f.manifest.styleSchema);
200
- if (!i.ok) {
201
- l.push(...w(i.diagnostics, [
243
+ if (!u.ok) {
244
+ l.push(...S(u.diagnostics, [
202
245
  "components",
203
246
  s,
204
- "styleRules",
205
- e,
247
+ "states",
248
+ "items",
249
+ t,
206
250
  "style"
207
- ])), r = !1;
251
+ ])), o = !1;
208
252
  break;
209
253
  }
254
+ a.set(n.id, u.value);
210
255
  }
211
- if (!r) continue;
212
- m = e.value, h = t.value, u.set(d, {
256
+ if (!o) continue;
257
+ m = t.value, h = r.style, g = a, u.set(d, {
213
258
  entry: f,
259
+ theme: e.theme,
214
260
  props: m,
215
- style: h
261
+ style: h,
262
+ stateStyles: a
216
263
  });
217
264
  }
218
- let g = j(a, d, f, i, ["components", s]);
219
- if ("diagnostic" in g) {
220
- l.push(g.diagnostic);
265
+ let _ = xe(a, d, f, i, ["components", s]);
266
+ if ("diagnostic" in _) {
267
+ l.push(_.diagnostic);
221
268
  continue;
222
269
  }
223
270
  c.push({
@@ -233,10 +280,11 @@ function A(e, t, n, r, i, a, o, s = "fail") {
233
280
  width: d.size.width,
234
281
  height: d.size.height
235
282
  },
236
- dataState: g.dataState
283
+ dataState: _.dataState
237
284
  },
238
- dataSource: g.dataSource,
239
- dataEpoch: g.epoch
285
+ dataSource: _.dataSource,
286
+ dataEpoch: _.epoch,
287
+ stateStyles: g
240
288
  });
241
289
  }
242
290
  if (o.entries = u, l.length === 0) return {
@@ -244,7 +292,7 @@ function A(e, t, n, r, i, a, o, s = "fail") {
244
292
  value: c,
245
293
  diagnostics: []
246
294
  };
247
- let d = ce(l);
295
+ let d = ve(l);
248
296
  return s === "skip" ? {
249
297
  ok: !0,
250
298
  value: c,
@@ -254,25 +302,25 @@ function A(e, t, n, r, i, a, o, s = "fail") {
254
302
  diagnostics: d
255
303
  };
256
304
  }
257
- function j(e, t, n, r, i, a) {
258
- let o = l(t), s = c(t);
305
+ function xe(e, t, n, r, i, a) {
306
+ let o = p(t), s = f(t);
259
307
  if (o === null) return s !== null || n.manifest.defaultData === void 0 ? {
260
308
  dataState: { status: "idle" },
261
309
  dataSource: void 0,
262
310
  epoch: void 0
263
311
  } : {
264
- dataState: O(n, n.manifest.defaultData, n.manifest.staticData?.kind === "tabular" ? n.manifest.staticData.defaultBinding : null),
312
+ dataState: E(n, n.manifest.defaultData, n.manifest.staticData?.kind === "tabular" ? n.manifest.staticData.defaultBinding : null),
265
313
  dataSource: void 0,
266
314
  epoch: void 0
267
315
  };
268
- let u = o.kind === "data-source-field" ? e.read(o.dataSourceId) : void 0, d = u?.source;
269
- if (!b(n.manifest.dataCapabilities, o, d)) return { diagnostic: T("PLUGIN_CORE_MANIFEST_FIELD_INVALID", [...i, "dataValue"], "Material does not accept the configured data source.") };
316
+ let c = o.kind === "data-source-field" ? e.read(o.dataSourceId) : void 0, l = c?.source;
317
+ if (!fe(n.manifest.dataCapabilities, o, l)) return { diagnostic: C("PLUGIN_CORE_MANIFEST_FIELD_INVALID", [...i, "dataValue"], "Material does not accept the configured data source.") };
270
318
  if (o.kind !== "data-source-field") return {
271
- dataState: M(e.evaluate(o), n, s),
319
+ dataState: k(e.evaluate(o), n, s),
272
320
  dataSource: void 0,
273
321
  epoch: e.variablesKey
274
322
  };
275
- if (d === void 0 || u === void 0) return {
323
+ if (l === void 0 || c === void 0) return {
276
324
  dataState: {
277
325
  status: "error",
278
326
  code: "HOST_RESOURCE_UNAVAILABLE",
@@ -281,11 +329,11 @@ function j(e, t, n, r, i, a) {
281
329
  dataSource: void 0,
282
330
  epoch: void 0
283
331
  };
284
- let f = ue(d.kind === "host-resource" ? d.resourceType : void 0, r, i);
285
- if (f !== void 0) return { diagnostic: f };
286
- let p = {
332
+ let u = Se(l.kind === "host-resource" ? l.resourceType : void 0, r, i);
333
+ if (u !== void 0) return { diagnostic: u };
334
+ let d = {
287
335
  dataSourceId: o.dataSourceId,
288
- projectionKey: se(s)
336
+ projectionKey: _e(s)
289
337
  };
290
338
  if (s !== null && (n.manifest.dataBinding === void 0 || n.tabularDataAdapter === void 0)) return {
291
339
  dataState: {
@@ -293,30 +341,43 @@ function j(e, t, n, r, i, a) {
293
341
  code: "HOST_DATASET_BINDING_INVALID",
294
342
  message: "Host dataset binding is invalid."
295
343
  },
296
- dataSource: p,
297
- epoch: u.dataState
344
+ dataSource: d,
345
+ epoch: c.dataState
298
346
  };
299
- if (u.dataState.status === "error") return {
300
- dataState: u.dataState,
301
- dataSource: p,
302
- epoch: u.dataState
347
+ if (c.dataState.status === "error") return {
348
+ dataState: c.dataState,
349
+ dataSource: d,
350
+ epoch: c.dataState
303
351
  };
304
352
  let m = e.evaluate(o);
305
- return u.dataState.status === "ready" && m.kind === "value" ? m.value === void 0 ? {
306
- dataState: { status: "idle" },
307
- dataSource: p,
308
- epoch: u.dataState
309
- } : {
310
- dataState: le(n, m.value, s, t.id, a),
311
- dataSource: p,
312
- epoch: u.dataState
313
- } : {
314
- dataState: M(m, n, s),
315
- dataSource: p,
316
- epoch: u.dataState
353
+ if (c.dataState.status === "ready") {
354
+ if (m.kind !== "value") return {
355
+ dataState: k(m, n, s),
356
+ dataSource: d,
357
+ epoch: c.dataState
358
+ };
359
+ if (m.value === void 0) return {
360
+ dataState: { status: "idle" },
361
+ dataSource: d,
362
+ epoch: c.dataState
363
+ };
364
+ let e = ye(n, m.value, s, t.id, a);
365
+ return {
366
+ dataState: c.dataState.stale === !0 && e.status === "ready" ? {
367
+ ...e,
368
+ stale: !0
369
+ } : e,
370
+ dataSource: d,
371
+ epoch: c.dataState
372
+ };
373
+ }
374
+ return {
375
+ dataState: k(m, n, s),
376
+ dataSource: d,
377
+ epoch: c.dataState
317
378
  };
318
379
  }
319
- function M(e, t, n) {
380
+ function k(e, t, n) {
320
381
  switch (e.kind) {
321
382
  case "pending": return { status: "loading" };
322
383
  case "failed": return e.reason === "variable-missing" ? {
@@ -332,172 +393,178 @@ function M(e, t, n) {
332
393
  code: "HOST_RESOURCE_FAILED",
333
394
  message: "Host resource request failed."
334
395
  };
335
- default: return e.value === void 0 ? { status: "idle" } : O(t, e.value, n);
396
+ default: return e.value === void 0 ? { status: "idle" } : E(t, e.value, n);
336
397
  }
337
398
  }
338
- function ue(e, t, n) {
339
- if (e !== void 0 && t !== void 0 && t.getResourceType(e) === void 0) return T("PLUGIN_CORE_CONTRIBUTION_UNKNOWN", [
399
+ function Se(e, t, n) {
400
+ if (e !== void 0 && t !== void 0 && t.getResourceType(e) === void 0) return C("PLUGIN_CORE_CONTRIBUTION_UNKNOWN", [
340
401
  ...n,
341
402
  "dataSource",
342
403
  "resourceType"
343
404
  ], "Host resource type is not enabled by an active plugin contribution.");
344
405
  }
345
406
  //#endregion
346
- //#region src/style-rules.ts
347
- function de(e, t) {
348
- if (e === void 0 || e.length === 0 || t.status !== "ready") return;
349
- let n;
350
- for (let r of e) fe(r, t.value) && (n = {
351
- ...n ?? {},
352
- ...r.style
353
- });
354
- return n;
355
- }
356
- function fe(e, t) {
357
- let n = pe(t, e.when.path);
358
- if (e.when.operator === "exists") return n.ok;
359
- if (!n.ok) return !1;
360
- let r = n.value, i = e.when.value;
361
- switch (e.when.operator) {
362
- case "eq": return p(r, i);
363
- case "neq": return !p(r, i);
364
- case "gt":
365
- case "gte":
366
- case "lt":
367
- case "lte": return !N(r) || !N(i) ? !1 : e.when.operator === "gt" ? r > i : e.when.operator === "gte" ? r >= i : e.when.operator === "lt" ? r < i : r <= i;
368
- case "contains": return typeof r == "string" ? typeof i == "string" && r.includes(i) : Array.isArray(r) && r.some((e) => p(e, i));
369
- default: return !1;
370
- }
371
- }
372
- function pe(e, t) {
373
- let n = e;
374
- for (let e of t) {
375
- if (typeof n != "object" || !n) return { ok: !1 };
376
- if (Array.isArray(n)) {
377
- if (!/^\d+$/.test(e)) return { ok: !1 };
378
- let t = Number(e);
379
- if (!Number.isSafeInteger(t) || t >= n.length) return { ok: !1 };
380
- n = n[t];
381
- continue;
382
- }
383
- if (!Object.prototype.hasOwnProperty.call(n, e)) return { ok: !1 };
384
- n = n[e];
385
- }
386
- return {
387
- ok: !0,
388
- value: n
389
- };
390
- }
391
- function N(e) {
392
- return typeof e == "number" && Number.isFinite(e);
393
- }
394
- //#endregion
395
407
  //#region src/renderer/renderer-effective-style.ts
396
- function P(e, t, n) {
397
- let r = de(t.component.styleRules, n), i = r === void 0 ? t.model.style : {
398
- ...t.model.style,
399
- ...r
400
- }, a = e.options.conditionalStylePort;
401
- if (a !== void 0) {
402
- let r = me(e, a, t.component.id, n);
403
- if (r !== void 0) {
404
- let n = S({
405
- ...i,
406
- ...r
407
- }, t.entry.manifest.styleSchema);
408
- if (n.ok) i = n.value;
409
- else for (let r of w(n.diagnostics, [
410
- "components",
411
- t.component.id,
412
- "conditionalStyle"
413
- ])) e.options.onDiagnostic?.(r);
414
- }
415
- }
408
+ function Ce(e, t, n, r) {
409
+ let i = e.componentStates.resolve(e, t, n);
410
+ e.componentStates.commit(e, t.component.id, i);
411
+ let a = t.stateStyles.get(i) ?? t.model.style;
416
412
  return {
417
413
  ...t.model,
418
414
  dataState: n,
419
- style: i
415
+ style: a
420
416
  };
421
417
  }
422
- function me(e, t, n, r) {
423
- try {
424
- return t.resolve({
425
- componentId: n,
426
- dataState: r
427
- });
428
- } catch {
429
- e.options.onDiagnostic?.(T("PLUGIN_CORE_RENDER_FAILED", [
430
- "components",
431
- n,
432
- "conditionalStyle"
433
- ], "Conditional style port resolve raised an exception."));
434
- return;
435
- }
418
+ function A(e, t, n) {
419
+ let r = new Map(n.components.map((e) => [e.id, e])), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = (n) => {
420
+ let s = i.get(n.id);
421
+ if (s !== void 0) return s;
422
+ if (a.has(n.id)) return 1;
423
+ a.add(n.id);
424
+ let c = t.get(n.id), l = Te(c === void 0 ? n.style : we(e, c, c.model.dataState)), u = n.parentId === null ? void 0 : r.get(n.parentId), d = u === void 0 ? 1 : o(u);
425
+ a.delete(n.id);
426
+ let f = l * d;
427
+ return i.set(n.id, f), f;
428
+ };
429
+ for (let e of n.components) o(e);
430
+ return i;
431
+ }
432
+ function we(e, t, n) {
433
+ let r = e.componentStates.resolve(e, t, n);
434
+ return t.stateStyles.get(r) ?? t.model.style;
435
+ }
436
+ function Te(e) {
437
+ let t = e.opacity;
438
+ return typeof t == "number" && Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 1;
436
439
  }
437
440
  //#endregion
438
441
  //#region src/renderer/renderer-material-dom.ts
439
- function F(e, t, n, r, i) {
440
- I(e, t, n, i), e.model = n, L(e, r);
441
- }
442
- function I(e, t, n, r) {
443
- let i = t.position, a = e.style;
444
- a.position !== "absolute" && (a.position = "absolute");
445
- let o = `${i.x}px`;
446
- a.left !== o && (a.left = o);
447
- let s = `${i.y}px`;
448
- a.top !== s && (a.top = s);
449
- let c = `${t.size.width}px`;
450
- a.width !== "max-content" && a.width !== c && (a.width = c);
451
- let l = `${t.size.height}px`;
452
- a.height !== l && (a.height = l);
453
- let u = String(r);
454
- a.zIndex !== u && (a.zIndex = u), e.dataset.baseScreenComponentId !== t.id && (e.dataset.baseScreenComponentId = t.id), a.transformOrigin !== "center" && (a.transformOrigin = "center");
455
- let d = `rotate(${t.rotation}deg)`, f = n.style.flipX === !0 ? -1 : 1, p = n.style.flipY === !0 ? -1 : 1, m = f === 1 && p === 1 ? d : `${d} scale(${f}, ${p})`;
456
- a.transform !== m && (a.transform = m);
457
- let h = typeof n.style.opacity == "number" && Number.isFinite(n.style.opacity) ? String(Math.min(1, Math.max(0, n.style.opacity))) : "";
458
- a.opacity !== h && (a.opacity = h);
459
- }
460
- function L(e, t) {
442
+ function j(e, t, n, r, i, a) {
443
+ M(e, t, n, i, a), e.model = n, F(e, r);
444
+ }
445
+ function M(e, t, n, r, i) {
446
+ let a = t.position, o = e.style;
447
+ o.position !== "absolute" && (o.position = "absolute");
448
+ let s = `${a.x}px`;
449
+ o.left !== s && (o.left = s);
450
+ let c = `${a.y}px`;
451
+ o.top !== c && (o.top = c);
452
+ let l = `${t.size.width}px`;
453
+ o.width !== "max-content" && o.width !== l && (o.width = l);
454
+ let u = `${t.size.height}px`;
455
+ o.height !== u && (o.height = u);
456
+ let d = String(r);
457
+ o.zIndex !== d && (o.zIndex = d), e.dataset.baseScreenComponentId !== t.id && (e.dataset.baseScreenComponentId = t.id), o.transformOrigin !== "center" && (o.transformOrigin = "center");
458
+ let f = `rotate(${t.rotation}deg)`, p = n.style.flipX === !0 ? -1 : 1, m = n.style.flipY === !0 ? -1 : 1, h = p === 1 && m === 1 ? f : `${f} scale(${p}, ${m})`;
459
+ o.transform !== h && (o.transform = h), N(e, i), Ee(e, n), P(e, n);
460
+ }
461
+ function N(e, t) {
462
+ let n = Number.isFinite(t) ? String(Math.min(1, Math.max(0, t))) : "1";
463
+ e.style.opacity !== n && (e.style.opacity = n);
464
+ }
465
+ function P(e, t) {
466
+ t.dataState.status === "ready" && t.dataState.stale === !0 ? e.dataset.baseScreenDataStale !== "true" && (e.dataset.baseScreenDataStale = "true") : e.dataset.baseScreenDataStale !== void 0 && delete e.dataset.baseScreenDataStale;
467
+ }
468
+ function Ee(e, t) {
469
+ let n = e.style, r = t.style.passThrough === !0 && (t.mode !== "design" || t.interactive) ? "none" : "";
470
+ n.pointerEvents !== r && (n.pointerEvents = r);
471
+ let i = t.style.hoverPointer === !0 ? "pointer" : "";
472
+ n.cursor !== i && (n.cursor = i);
473
+ let a = t.style.clip === !0 ? "inset(0)" : "";
474
+ n.clipPath !== a && (n.clipPath = a);
475
+ let o = typeof t.style.blend == "string" && t.style.blend !== "normal" ? t.style.blend : "";
476
+ n.mixBlendMode !== o && (n.mixBlendMode = o);
477
+ let s = Oe(t.style);
478
+ n.filter !== s && (n.filter = s);
479
+ }
480
+ var De = [
481
+ [
482
+ "filterBlur",
483
+ "blur",
484
+ "px"
485
+ ],
486
+ [
487
+ "filterBrightness",
488
+ "brightness",
489
+ "%"
490
+ ],
491
+ [
492
+ "filterContrast",
493
+ "contrast",
494
+ "%"
495
+ ],
496
+ [
497
+ "filterSaturate",
498
+ "saturate",
499
+ "%"
500
+ ],
501
+ [
502
+ "filterHueRotate",
503
+ "hue-rotate",
504
+ "deg"
505
+ ]
506
+ ];
507
+ function Oe(e) {
508
+ let t = [];
509
+ for (let [n, r, i] of De) {
510
+ let a = e[n];
511
+ typeof a == "number" && Number.isFinite(a) && t.push(`${r}(${a}${i})`);
512
+ }
513
+ return t.join(" ");
514
+ }
515
+ function F(e, t) {
461
516
  let n = t ? "none" : "block";
462
517
  e.style.display !== n && (e.style.display = n);
463
518
  }
464
519
  //#endregion
465
520
  //#region src/renderer/renderer-mounted-material.ts
466
- function R(e, t, n, r) {
521
+ function ke(e, t, n, r, i, a) {
467
522
  n.stackOrder = r, n.projection.projectionKey = t.dataSource?.projectionKey, n.projection.dataState = t.model.dataState;
468
- let i = B(e, t, r);
469
- if (n.applied !== void 0 && n.appliedModel !== void 0 && he(n.applied, i)) {
470
- I(n.element, t.component, n.appliedModel, r), L(n.element, e.visibility.isHidden(t.component.id));
523
+ let o = L(e, t, r, i);
524
+ if (n.applied !== void 0 && n.appliedModel !== void 0 && (R(n.applied, o) || Ae(n.applied, o))) {
525
+ M(n.element, t.component, n.appliedModel, r, a), F(n.element, o.hidden);
471
526
  return;
472
527
  }
473
- z(e, t, n, r);
528
+ I(e, t, n, r, i, a);
474
529
  }
475
- function z(e, t, n, r) {
476
- let i = P(e, t, t.model.dataState);
477
- F(n.element, t.component, i, e.visibility.isHidden(t.component.id), r), n.applied = B(e, t, r), n.appliedModel = i;
530
+ function I(e, t, n, r, i, a) {
531
+ let o = Ce(e, t, t.model.dataState, i);
532
+ j(n.element, t.component, o, e.visibility.isHidden(t.component.id), r, a), n.applied = L(e, t, r, i), n.appliedModel = o;
478
533
  }
479
- function B(e, t, n) {
534
+ function L(e, t, n, r) {
480
535
  return {
481
- component: t.component,
536
+ component: e.componentSources.get(t.component) ?? t.component,
482
537
  entry: t.entry,
483
538
  interactive: t.model.interactive,
484
539
  stackOrder: n,
485
540
  hidden: e.visibility.isHidden(t.component.id),
486
- dataEpoch: t.dataEpoch
541
+ dataEpoch: t.dataEpoch,
542
+ theme: r.theme,
543
+ stateId: e.componentStates.resolve(e, t, t.model.dataState)
487
544
  };
488
545
  }
489
- function he(e, t) {
490
- return e.component === t.component && e.entry === t.entry && e.interactive === t.interactive && e.stackOrder === t.stackOrder && e.hidden === t.hidden && e.dataEpoch === t.dataEpoch;
546
+ function R(e, t) {
547
+ return e.component === t.component && e.entry === t.entry && e.interactive === t.interactive && e.stackOrder === t.stackOrder && e.hidden === t.hidden && e.dataEpoch === t.dataEpoch && e.theme === t.theme && e.stateId === t.stateId;
491
548
  }
492
- function ge(e, t, n) {
493
- let r = P(e, t, t.model.dataState);
494
- n.element.model = r, n.appliedModel = r;
549
+ function Ae(e, t) {
550
+ return !e.hidden && t.hidden && je(e.component, t.component) && R(e, {
551
+ ...t,
552
+ component: e.component,
553
+ hidden: !1
554
+ });
495
555
  }
496
- function _e(e, t, n) {
556
+ function je(e, t) {
557
+ if (e === t) return !0;
558
+ let n = e, r = t, i = Object.keys(n);
559
+ if (i.length !== Object.keys(r).length) return !1;
560
+ for (let e of i) if (e !== "status" && (!(e in r) || n[e] !== r[e])) return !1;
561
+ return !0;
562
+ }
563
+ function Me(e, t, n) {
497
564
  if (n.bubbles !== !0 || n.composed !== !0 || n.type !== "base-screen-material-event") return;
498
565
  let r = e.candidates.get(t.component.id) ?? t;
499
566
  if (r.model.interactive !== !0) return;
500
- let i = y(n.detail);
567
+ let i = de(n.detail);
501
568
  if (!(!i.ok || !r.entry.manifest.events.includes(i.value.name))) {
502
569
  n.stopPropagation();
503
570
  try {
@@ -519,7 +586,7 @@ function _e(e, t, n) {
519
586
  }
520
587
  //#endregion
521
588
  //#region src/blueprint-visibility.ts
522
- var ve = class {
589
+ var Ne = class {
523
590
  root;
524
591
  #e = /* @__PURE__ */ new Map();
525
592
  #t = /* @__PURE__ */ new Map();
@@ -600,7 +667,7 @@ var ve = class {
600
667
  ...d ? { translate: "0 12px" } : {}
601
668
  }], p = t.animate(f, {
602
669
  duration: r.durationMs,
603
- easing: ye(r.easing),
670
+ easing: Pe(r.easing),
604
671
  fill: "none"
605
672
  });
606
673
  this.#n.set(e, p), p.finished.then(() => {
@@ -608,16 +675,82 @@ var ve = class {
608
675
  }).catch(() => void 0);
609
676
  }
610
677
  };
611
- function ye(e) {
678
+ function Pe(e) {
612
679
  return e === "ease-in-out-quad" ? "cubic-bezier(0.455, 0.03, 0.515, 0.955)" : e === "ease-in-out-expo" ? "cubic-bezier(1, 0, 0, 1)" : "linear";
613
680
  }
614
681
  //#endregion
682
+ //#region src/resource/push-window.ts
683
+ function z(e) {
684
+ if (typeof e != "object" || !e || Array.isArray(e)) return;
685
+ let { epoch: t, revision: n } = e;
686
+ if (typeof t == "string" && t.length !== 0 && !(typeof n != "number" || !Number.isSafeInteger(n) || n < 0)) return {
687
+ epoch: t,
688
+ revision: n
689
+ };
690
+ }
691
+ function B(e, t, n) {
692
+ return e === void 0 || t === void 0 ? "accept" : n === "snapshot" ? t.epoch === e.epoch && t.revision <= e.revision ? "duplicate" : "accept" : t.epoch === e.epoch ? t.revision <= e.revision ? "duplicate" : t.revision > e.revision + 1 ? "gap" : "accept" : "gap";
693
+ }
694
+ function V(e) {
695
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
696
+ let { fields: t, rows: n } = e;
697
+ return Array.isArray(t) && t.every((e) => H(e) && typeof e.id == "string") && Array.isArray(n) && n.every(H);
698
+ }
699
+ function Fe(e, t) {
700
+ if (!Array.isArray(e)) return !1;
701
+ let n = new Set(t.fields.map((e) => e.id));
702
+ return e.every((e) => H(e) && Object.keys(e).every((e) => n.has(e)));
703
+ }
704
+ function Ie(e) {
705
+ if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
706
+ if (typeof e == "string" && e.length > 0) {
707
+ let t = Date.parse(e);
708
+ return Number.isNaN(t) ? void 0 : t;
709
+ }
710
+ }
711
+ function Le(t, n) {
712
+ let r = t, i = !1;
713
+ if (n?.seconds !== void 0 && n.timeField !== void 0) {
714
+ let e = n.timeField, t = r.map((t) => Ie(t[e])), a = -Infinity;
715
+ for (let e of t) e === void 0 ? i = !0 : e > a && (a = e);
716
+ if (a !== -Infinity) {
717
+ let e = a - n.seconds * 1e3;
718
+ r = r.filter((n, r) => {
719
+ let i = t[r];
720
+ return i === void 0 || i >= e;
721
+ });
722
+ }
723
+ }
724
+ let a = n?.rows ?? e;
725
+ return r.length > a && (r = r.slice(r.length - a)), {
726
+ rows: r,
727
+ unparseableTime: i
728
+ };
729
+ }
730
+ function Re(e, t) {
731
+ let n = e;
732
+ for (; n.rows.length > 0 && ze(JSON.stringify(n), t);) {
733
+ let e = Math.max(1, Math.ceil(n.rows.length / 10));
734
+ n = {
735
+ ...n,
736
+ rows: n.rows.slice(e)
737
+ };
738
+ }
739
+ return n;
740
+ }
741
+ function ze(e, t) {
742
+ return e.length * 3 <= t ? !1 : new TextEncoder().encode(e).length > t;
743
+ }
744
+ function H(e) {
745
+ return typeof e == "object" && !!e && !Array.isArray(e);
746
+ }
747
+ //#endregion
615
748
  //#region src/resource/source-query-port.ts
616
- var be = "#source-dataset", xe = "#source-resource", Se = "#source";
617
- function Ce(e) {
618
- return e.kind === "dataset" ? be : e.kind === "host-resource" ? xe : Se;
749
+ var Be = "#source-dataset", Ve = "#source-resource", He = "#source";
750
+ function Ue(e) {
751
+ return e.kind === "dataset" ? Be : e.kind === "host-resource" ? Ve : He;
619
752
  }
620
- var we = class {
753
+ var We = class {
621
754
  resources;
622
755
  datasets;
623
756
  hostCatalog;
@@ -636,6 +769,35 @@ var we = class {
636
769
  default: return this.hostCatalog !== void 0;
637
770
  }
638
771
  }
772
+ acceptsPush(e) {
773
+ switch (e.kind) {
774
+ case "host-resource": return typeof this.resources?.subscribe == "function";
775
+ case "host-catalog": return typeof this.hostCatalog?.subscribe == "function";
776
+ default: return !1;
777
+ }
778
+ }
779
+ subscribe(e, t, n) {
780
+ switch (e.source.kind) {
781
+ case "host-resource": {
782
+ let r = this.resources?.subscribe;
783
+ return r === void 0 ? U() : r.call(this.resources, {
784
+ dataSourceId: e.dataSourceId,
785
+ resourceType: e.source.resourceType,
786
+ resourceId: e.source.resourceId,
787
+ params: e.params
788
+ }, t, n);
789
+ }
790
+ case "host-catalog": {
791
+ let r = this.hostCatalog?.subscribe;
792
+ return r === void 0 ? U() : r.call(this.hostCatalog, {
793
+ sourceId: e.source.sourceId,
794
+ params: e.params,
795
+ purpose: "runtime"
796
+ }, t, n);
797
+ }
798
+ default: return U();
799
+ }
800
+ }
639
801
  query(e, t) {
640
802
  switch (e.source.kind) {
641
803
  case "dataset": return this.queryDataset(e, e.source.datasetId, t);
@@ -644,51 +806,51 @@ var we = class {
644
806
  resourceType: e.source.resourceType,
645
807
  resourceId: e.source.resourceId,
646
808
  params: e.params
647
- }, t) ?? Promise.resolve(V());
809
+ }, t) ?? Promise.resolve(U());
648
810
  default: return this.hostCatalog?.resolve({
649
811
  sourceId: e.source.sourceId,
650
812
  params: e.params,
651
813
  purpose: "runtime",
652
814
  signal: t.signal
653
- }) ?? Promise.resolve(V());
815
+ }) ?? Promise.resolve(U());
654
816
  }
655
817
  }
656
- async queryDataset(e, n, r) {
657
- if (this.datasets === void 0) return V();
658
- let a = this.#t, o = () => !r.signal.aborted && a === this.#t;
659
- if (!o()) return U();
660
- let c = this.#e.get(n);
661
- if (c === void 0) {
818
+ async queryDataset(e, t, n) {
819
+ if (this.datasets === void 0) return U();
820
+ let i = this.#t, a = () => !n.signal.aborted && i === this.#t;
821
+ if (!a()) return G();
822
+ let o = this.#e.get(t);
823
+ if (o === void 0) {
662
824
  let e = await this.datasets.describe({
663
- datasetId: n,
664
- signal: r.signal
825
+ datasetId: t,
826
+ signal: n.signal
665
827
  });
666
- if (!o()) return U();
828
+ if (!a()) return G();
667
829
  if (!e.ok) return e;
668
- let t = i(e.value);
669
- if (!t.ok) return t;
670
- if (t.value.datasetId !== n) return H();
671
- c = t.value, this.#e.size >= 32 && this.#e.delete(this.#e.keys().next().value), this.#e.set(n, c);
830
+ let r = c(e.value);
831
+ if (!r.ok) return r;
832
+ if (r.value.datasetId !== t) return W();
833
+ o = r.value, this.#e.size >= 32 && this.#e.delete(this.#e.keys().next().value), this.#e.set(t, o);
672
834
  }
673
- let l = t(c.parameters, e.params);
674
- if (!l.ok) return l;
675
- if (!o()) return U();
676
- let u = await this.datasets.query({
677
- datasetId: n,
835
+ let s = r(o.parameters, e.params);
836
+ if (!s.ok) return s;
837
+ if (!a()) return G();
838
+ let l = await this.datasets.query({
839
+ datasetId: t,
678
840
  dataSourceId: e.dataSourceId,
679
- params: l.value
680
- }, r);
681
- if (!o()) return U();
682
- if (!u.ok) return u;
683
- let d = s(u.value);
684
- return d.ok ? C(d.value.fields) === C(c.fields) ? {
841
+ params: s.value
842
+ }, n);
843
+ if (!a()) return G();
844
+ if (!l.ok) return l;
845
+ let u = d(l.value);
846
+ return u.ok ? x(u.value.fields) === x(o.fields) ? {
685
847
  ok: !0,
686
- value: d.value,
848
+ value: u.value,
687
849
  diagnostics: []
688
- } : H() : d;
850
+ } : W() : u;
689
851
  }
690
852
  };
691
- function V() {
853
+ function U() {
692
854
  return {
693
855
  ok: !1,
694
856
  diagnostics: [{
@@ -699,7 +861,7 @@ function V() {
699
861
  }]
700
862
  };
701
863
  }
702
- function H() {
864
+ function W() {
703
865
  return {
704
866
  ok: !1,
705
867
  diagnostics: [{
@@ -710,7 +872,7 @@ function H() {
710
872
  }]
711
873
  };
712
874
  }
713
- function U() {
875
+ function G() {
714
876
  return {
715
877
  ok: !1,
716
878
  diagnostics: []
@@ -718,37 +880,45 @@ function U() {
718
880
  }
719
881
  //#endregion
720
882
  //#region src/resource/data-source-runtime.ts
721
- var Te = class {
883
+ var Ge = /* @__PURE__ */ new Set([
884
+ "connecting",
885
+ "open",
886
+ "reconnecting",
887
+ "suspended",
888
+ "failed"
889
+ ]), Ke = class {
722
890
  options;
723
891
  #e = /* @__PURE__ */ new Map();
724
892
  #t;
725
- #n = {};
726
- #r = C({});
893
+ #n = 0;
894
+ #r;
895
+ #i = {};
896
+ #a = x({});
727
897
  constructor(e) {
728
- this.options = e;
898
+ this.options = e, this.#t = e.clock ?? Xe();
729
899
  }
730
900
  get variablesKey() {
731
- return this.#r;
901
+ return this.#a;
732
902
  }
733
903
  ensure(e, t, n, r = {}) {
734
- this.#t = e, t !== this.#n && (this.#n = t, this.#r = C(t));
904
+ this.#r = e, t !== this.#i && (this.#i = t, this.#a = x(t));
735
905
  let i = {
736
906
  variableValues: t,
737
907
  dataSourceValues: /* @__PURE__ */ new Map(),
738
908
  dataSourceErrors: /* @__PURE__ */ new Map()
739
- }, a = Ee(e);
909
+ }, a = qe(e);
740
910
  for (let e of a) {
741
- let t = this.#i(e.id);
742
- t.source = e.source, this.#a(t, e, i, n, r.startOnly);
911
+ let t = this.#o(e.id);
912
+ t.source = e.source, this.#s(t, e, i, n, r.startOnly);
743
913
  }
744
914
  let o = new Set(a.map((e) => e.id));
745
- for (let [e, t] of this.#e) o.has(e) || (this.#l(t), this.#e.delete(e));
915
+ for (let [e, t] of this.#e) o.has(e) || (this.#f(t), this.#e.delete(e));
746
916
  }
747
917
  reportProjection(e, t, n) {
748
918
  let r = this.#e.get(e);
749
919
  if (r === void 0) return;
750
- let i = W(n);
751
- this.#u(r, "adapted", {
920
+ let i = K(n);
921
+ this.#p(r, "adapted", {
752
922
  startedAt: r.startedAt,
753
923
  ...i
754
924
  }, t);
@@ -763,34 +933,44 @@ var Te = class {
763
933
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
764
934
  if (e.kind === "data-source-field") {
765
935
  let r = this.#e.get(e.dataSourceId);
766
- r?.dataState.status === "ready" && r.rawValue !== void 0 ? t.set(e.dataSourceId, r.rawValue) : r?.dataState.status === "error" && n.set(e.dataSourceId, r.rawError ?? G("Host data source failed."));
936
+ r?.dataState.status === "ready" && r.rawValue !== void 0 ? t.set(e.dataSourceId, r.rawValue) : r?.dataState.status === "error" && n.set(e.dataSourceId, r.rawError ?? q("Host data source failed."));
767
937
  }
768
938
  let r = {
769
- variableValues: this.#n,
939
+ variableValues: this.#i,
770
940
  dataSourceValues: t,
771
941
  dataSourceErrors: n
772
942
  };
773
- return v(e, r);
943
+ return se(e, r);
774
944
  }
775
945
  refresh(e, t) {
776
946
  let n = e === void 0 ? [...this.#e.keys()] : this.#e.has(e) ? [e] : [], r = [];
777
947
  for (let e of n) {
778
948
  let n = this.#e.get(e);
779
- n.requestKey !== void 0 && (n.requestSlotId === void 0 || this.options.coordinator?.isPending(n.requestSlotId) !== !0) && (this.#l(n), this.#s(n, t ?? {
780
- trigger: "manual",
781
- traceId: ""
782
- }), r.push(e));
949
+ if (n.requestKey !== void 0) {
950
+ if (n.pushPolicy !== void 0) {
951
+ if (n.push === void 0 && n.dataState.status === "loading") continue;
952
+ this.#f(n), n.dataState.status === "error" && (n.dataState = { status: "loading" }), this.#g(n, n.pushPolicy, t ?? {
953
+ trigger: "manual",
954
+ traceId: ""
955
+ }), r.push(e);
956
+ continue;
957
+ }
958
+ (n.requestSlotId === void 0 || this.options.coordinator?.isPending(n.requestSlotId) !== !0) && (this.#f(n), this.#l(n, t ?? {
959
+ trigger: "manual",
960
+ traceId: ""
961
+ }), r.push(e));
962
+ }
783
963
  }
784
964
  return r;
785
965
  }
786
966
  suspend() {
787
- for (let e of this.#e.values()) this.#l(e), e.dataState = { status: "loading" }, e.rawValue = void 0, e.rawError = void 0, this.options.onChanged(e.dataSourceId);
967
+ for (let e of this.#e.values()) this.#f(e), e.dataState = { status: "loading" }, e.rawValue = void 0, e.rawError = void 0, this.options.onChanged(e.dataSourceId);
788
968
  }
789
969
  clear() {
790
- for (let e of this.#e.values()) this.#l(e);
791
- this.#e.clear(), this.#t = void 0, this.#n = {}, this.#r = C({});
970
+ for (let e of this.#e.values()) this.#f(e);
971
+ this.#e.clear(), this.#r = void 0, this.#i = {}, this.#a = x({});
792
972
  }
793
- #i(e) {
973
+ #o(e) {
794
974
  let t = this.#e.get(e);
795
975
  if (t !== void 0) return t;
796
976
  let n = {
@@ -805,48 +985,58 @@ var Te = class {
805
985
  params: {},
806
986
  requestId: void 0,
807
987
  executionContext: void 0,
808
- startedAt: void 0
988
+ startedAt: void 0,
989
+ connection: void 0,
990
+ pushPolicyKey: void 0,
991
+ pushPolicy: void 0,
992
+ push: void 0
809
993
  };
810
994
  return this.#e.set(e, n), n;
811
995
  }
812
- #a(e, t, n, r, i) {
813
- let a = this.#o(t.params, n);
996
+ #s(e, t, n, r, i) {
997
+ let a = this.#c(t.params, n);
814
998
  if (a.kind === "pending") {
815
999
  e.dataState = { status: "loading" };
816
1000
  return;
817
1001
  }
818
1002
  if (a.kind === "failed") {
819
- this.#c(e, a.diagnostic), n.dataSourceErrors.set(e.dataSourceId, a.diagnostic);
1003
+ this.#d(e, a.diagnostic), n.dataSourceErrors.set(e.dataSourceId, a.diagnostic);
1004
+ return;
1005
+ }
1006
+ let o = Je(e.dataSourceId, t.source, a.params);
1007
+ e.requestKey !== o && (this.#f(e), e.requestKey = o, e.params = a.params, e.dataState = { status: "loading" }, e.rawValue = void 0, e.rawError = void 0);
1008
+ let s = this.#m(t), c = s === void 0 ? void 0 : x(s);
1009
+ if (e.pushPolicyKey !== c && (this.#f(e), e.pushPolicyKey = c, e.pushPolicy = s, e.dataState = { status: "loading" }, e.rawValue = void 0, e.rawError = void 0), s !== void 0) {
1010
+ this.#h(e, s, n, r, i);
820
1011
  return;
821
1012
  }
822
- let o = De(e.dataSourceId, t.source, a.params);
823
- if (e.requestKey !== o && (this.#l(e), e.requestKey = o, e.params = a.params, e.dataState = { status: "loading" }, e.rawValue = void 0, e.rawError = void 0), e.requestSlotId === void 0) {
1013
+ if (e.requestSlotId === void 0) {
824
1014
  if (e.dataState.status === "ready") {
825
1015
  e.rawValue !== void 0 && n.dataSourceValues.set(e.dataSourceId, e.rawValue);
826
1016
  return;
827
1017
  }
828
1018
  if (e.dataState.status === "error") {
829
- n.dataSourceErrors.set(e.dataSourceId, e.rawError ?? G("Host data source failed."));
1019
+ n.dataSourceErrors.set(e.dataSourceId, e.rawError ?? q("Host data source failed."));
830
1020
  return;
831
1021
  }
832
- i !== void 0 && !i.has(e.dataSourceId) || this.#s(e, r);
1022
+ i !== void 0 && !i.has(e.dataSourceId) || this.#l(e, r);
833
1023
  }
834
1024
  }
835
- #o(e, t) {
1025
+ #c(e, t) {
836
1026
  let n = {}, r = !1;
837
1027
  for (let [i, a] of Object.entries(e)) {
838
- let e = v(a, t);
1028
+ let e = se(a, t);
839
1029
  if (e.kind === "pending") {
840
1030
  r = !0;
841
1031
  continue;
842
1032
  }
843
1033
  if (e.kind === "failed") return {
844
1034
  kind: "failed",
845
- diagnostic: G(e.reason === "variable-missing" ? "Data source parameter references a variable without a value." : "Data source parameter is invalid.")
1035
+ diagnostic: q(e.reason === "variable-missing" ? "Data source parameter references a variable without a value." : "Data source parameter is invalid.")
846
1036
  };
847
1037
  if (e.value === void 0) return {
848
1038
  kind: "failed",
849
- diagnostic: G("Data source parameter resolved to no value.")
1039
+ diagnostic: q("Data source parameter resolved to no value.")
850
1040
  };
851
1041
  n[i] = e.value;
852
1042
  }
@@ -855,109 +1045,121 @@ var Te = class {
855
1045
  params: n
856
1046
  };
857
1047
  }
858
- #s(t, n) {
859
- let i = t.source;
860
- if (i === void 0 || t.requestKey === void 0 || this.options.isSuspended()) return;
861
- if (!this.options.sourcePort.accepts(i)) {
862
- this.#c(t, {
1048
+ #l(e, t) {
1049
+ let r = e.source;
1050
+ if (r === void 0 || e.requestKey === void 0 || this.options.isSuspended()) return;
1051
+ if (!this.options.sourcePort.accepts(r)) {
1052
+ this.#d(e, {
863
1053
  severity: "error",
864
1054
  code: "HOST_RESOURCE_UNAVAILABLE",
865
1055
  path: [],
866
1056
  message: "Host resource port is unavailable."
867
- }, { emitStarted: !0 }), this.options.onChanged(t.dataSourceId);
1057
+ }, { emitStarted: !0 }), this.options.onChanged(e.dataSourceId);
868
1058
  return;
869
1059
  }
870
- let a = this.options.validateParams?.(i, t.params);
871
- if (a !== void 0) {
872
- this.#c(t, a, { emitStarted: !1 }), this.options.onChanged(t.dataSourceId);
1060
+ let i = this.options.validateParams?.(r, e.params);
1061
+ if (i !== void 0) {
1062
+ this.#d(e, i, { emitStarted: !1 }), this.options.onChanged(e.dataSourceId);
873
1063
  return;
874
1064
  }
875
- let s = this.options.coordinator;
876
- if (s === void 0) {
877
- this.options.onChanged(t.dataSourceId);
1065
+ let a = this.options.coordinator;
1066
+ if (a === void 0) {
1067
+ this.options.onChanged(e.dataSourceId);
878
1068
  return;
879
1069
  }
880
- let c = ++t.generation, l = this.options.createExecutionContext(n, t.dataSourceId), u = Date.now(), d = `${t.dataSourceId}:${t.requestKey}:${c}`;
881
- t.executionContext = l, t.startedAt = u, t.requestId = d;
882
- let { resolution: f, slotId: p } = s.request(t.requestKey, Ce(i), t.dataSourceId, {
883
- dataSourceId: t.dataSourceId,
884
- source: i,
885
- params: t.params
886
- }, l);
887
- t.requestSlotId = p, this.#u(t, "started", { startedAt: u }), f.then((n) => {
888
- if (this.#e.get(t.dataSourceId) !== t || t.generation !== c || t.requestSlotId !== p) return;
889
- if (t.requestSlotId = void 0, n.kind === "timeout") {
890
- this.#c(t, {
1070
+ let o = ++e.generation, c = this.options.createExecutionContext(t, e.dataSourceId), l = Date.now(), d = `${e.dataSourceId}:${e.requestKey}:${o}`;
1071
+ e.executionContext = c, e.startedAt = l, e.requestId = d;
1072
+ let { resolution: f, slotId: p } = a.request(e.requestKey, Ue(r), e.dataSourceId, {
1073
+ dataSourceId: e.dataSourceId,
1074
+ source: r,
1075
+ params: e.params
1076
+ }, c);
1077
+ e.requestSlotId = p, this.#p(e, "started", { startedAt: l }), f.then((t) => {
1078
+ if (this.#e.get(e.dataSourceId) !== e || e.generation !== o || e.requestSlotId !== p) return;
1079
+ if (e.requestSlotId = void 0, t.kind !== "ok" && this.#u(e)) {
1080
+ this.#p(e, t.kind === "timeout" ? "timed-out" : "failed", {
1081
+ startedAt: l,
1082
+ code: t.kind === "timeout" ? "HOST_RESOURCE_TIMEOUT" : s(t.diagnostics.diagnostics[0] ?? q()).code
1083
+ });
1084
+ return;
1085
+ }
1086
+ if (t.kind === "timeout") {
1087
+ this.#d(e, {
891
1088
  severity: "error",
892
1089
  code: "HOST_RESOURCE_TIMEOUT",
893
1090
  path: [],
894
1091
  message: "Host data source request timed out."
895
- }, { emitStarted: !1 }), this.#u(t, "timed-out", {
896
- startedAt: u,
1092
+ }, { emitStarted: !1 }), this.#p(e, "timed-out", {
1093
+ startedAt: l,
897
1094
  code: "HOST_RESOURCE_TIMEOUT"
898
- }), this.options.onChanged(t.dataSourceId);
1095
+ }), this.options.onChanged(e.dataSourceId);
899
1096
  return;
900
1097
  }
901
- if (n.kind === "failure") {
902
- let e = n.diagnostics.diagnostics[0], i = e === void 0 ? G() : e;
903
- this.#c(t, i, { emitStarted: !1 }), this.#u(t, "failed", {
904
- startedAt: u,
905
- code: r(i).code
906
- }), this.options.onChanged(t.dataSourceId);
1098
+ if (t.kind === "failure") {
1099
+ let n = t.diagnostics.diagnostics[0], r = n === void 0 ? q() : n;
1100
+ this.#d(e, r, { emitStarted: !1 }), this.#p(e, "failed", {
1101
+ startedAt: l,
1102
+ code: s(r).code
1103
+ }), this.options.onChanged(e.dataSourceId);
907
1104
  return;
908
1105
  }
909
- let i = o(n.value, { maxBytes: e });
910
- if (!i.ok) {
911
- let e = {
1106
+ let r = u(t.value, { maxBytes: n });
1107
+ if (!r.ok) {
1108
+ let t = {
912
1109
  severity: "error",
913
1110
  code: "HOST_RESOURCE_INVALID",
914
1111
  path: [],
915
1112
  message: "Host data source returned invalid JSON."
916
1113
  };
917
- this.#c(t, e, { emitStarted: !1 }), this.#u(t, "failed", {
918
- startedAt: u,
919
- code: e.code
920
- }), this.options.onChanged(t.dataSourceId);
1114
+ this.#d(e, t, { emitStarted: !1 }), this.#p(e, "failed", {
1115
+ startedAt: l,
1116
+ code: t.code
1117
+ }), this.options.onChanged(e.dataSourceId);
921
1118
  return;
922
1119
  }
923
- t.dataState = {
1120
+ e.push === void 0 ? (e.dataState = {
924
1121
  status: "ready",
925
- value: i.value
926
- }, t.rawValue = i.value, t.rawError = void 0;
927
- let a = W(i.value);
928
- this.#u(t, "succeeded", {
929
- startedAt: u,
930
- ...a
931
- }), this.options.onChanged(t.dataSourceId);
1122
+ value: r.value
1123
+ }, e.rawValue = r.value, e.rawError = void 0) : this.#S(e, e.push, r.value);
1124
+ let i = K(e.rawValue);
1125
+ this.#p(e, "succeeded", {
1126
+ startedAt: l,
1127
+ ...i
1128
+ }), this.options.onChanged(e.dataSourceId);
932
1129
  });
933
1130
  }
934
- #c(e, t, n = { emitStarted: !1 }) {
1131
+ #u(e) {
1132
+ let t = e.push;
1133
+ return t === void 0 || t.mode !== "subscribed" || e.dataState.status !== "ready" || e.rawValue === void 0 ? !1 : (t.inactive = !0, this.#M(e), !0);
1134
+ }
1135
+ #d(e, t, n = { emitStarted: !1 }) {
935
1136
  e.generation++, e.requestSlotId = void 0, e.rawValue = void 0, e.rawError = t;
936
- let i = r(t);
1137
+ let r = s(t);
937
1138
  e.dataState = {
938
1139
  status: "error",
939
- code: i.code,
940
- message: i.message
941
- }, n.emitStarted && this.#u(e, "started", { startedAt: void 0 }), this.#u(e, "failed", {
1140
+ code: r.code,
1141
+ message: r.message
1142
+ }, n.emitStarted && this.#p(e, "started", { startedAt: void 0 }), this.#p(e, "failed", {
942
1143
  startedAt: void 0,
943
- code: i.code
1144
+ code: r.code
944
1145
  });
945
1146
  }
946
- #l(e) {
1147
+ #f(e) {
1148
+ this.#O(e);
947
1149
  let t = e.requestSlotId;
948
- e.generation++, e.requestSlotId = void 0, t !== void 0 && (this.options.coordinator?.release(t, e.dataSourceId), this.#u(e, "aborted", { startedAt: void 0 })), e.requestId = void 0;
1150
+ e.generation++, e.requestSlotId = void 0, t !== void 0 && (this.options.coordinator?.release(t, e.dataSourceId), this.#p(e, "aborted", { startedAt: void 0 })), e.requestId = void 0;
949
1151
  }
950
- #u(e, t, n, r) {
1152
+ #p(e, t, n, r) {
951
1153
  let i = e.source;
952
1154
  if (i === void 0) return;
953
- let a = Oe(i), o = e.executionContext ?? this.options.createExecutionContext({
1155
+ let a = Ye(i), o = e.executionContext ?? this.options.createExecutionContext({
954
1156
  trigger: "manual",
955
1157
  traceId: ""
956
1158
  }, e.dataSourceId);
957
1159
  this.options.emit({
958
1160
  type: t,
959
1161
  dataSourceId: e.dataSourceId,
960
- componentId: r ?? this.#d(e.dataSourceId),
1162
+ componentId: r ?? this.#P(e.dataSourceId),
961
1163
  resourceType: a.resourceType,
962
1164
  resourceId: a.resourceId,
963
1165
  requestId: e.requestId,
@@ -965,31 +1167,312 @@ var Te = class {
965
1167
  startedAt: n.startedAt,
966
1168
  ...n.fieldCount === void 0 ? {} : { fieldCount: n.fieldCount },
967
1169
  ...n.rowCount === void 0 ? {} : { rowCount: n.rowCount },
968
- ...n.code === void 0 ? {} : { code: n.code }
1170
+ ...n.code === void 0 ? {} : { code: n.code },
1171
+ ...n.cursor === void 0 ? {} : { cursor: n.cursor },
1172
+ ...n.connection === void 0 ? {} : { connection: n.connection }
969
1173
  });
970
1174
  }
971
- #d(e) {
972
- let t = this.#t?.components ?? [];
1175
+ #m(e) {
1176
+ let t = e.updatePolicy;
1177
+ if (t?.mode === "push" && this.options.push?.enabled === !0 && e.source.kind !== "url-query") return t;
1178
+ }
1179
+ #h(e, t, n, r, i) {
1180
+ if (e.push === void 0 && e.requestSlotId === void 0 && e.dataState.status === "loading") {
1181
+ if (i !== void 0 && !i.has(e.dataSourceId)) return;
1182
+ this.#g(e, t, r);
1183
+ }
1184
+ e.dataState.status === "ready" && e.rawValue !== void 0 ? n.dataSourceValues.set(e.dataSourceId, e.rawValue) : e.dataState.status === "error" && n.dataSourceErrors.set(e.dataSourceId, e.rawError ?? q("Host data source failed."));
1185
+ }
1186
+ #g(e, t, n) {
1187
+ let r = e.source, i = this.options.push;
1188
+ if (r === void 0 || e.requestKey === void 0 || i === void 0 || this.options.isSuspended()) return;
1189
+ let a = i.delivery(r), o = t.fallbackIntervalSeconds === void 0 ? void 0 : t.fallbackIntervalSeconds * 1e3;
1190
+ if (!(a !== void 0 && this.options.sourcePort.acceptsPush(r))) {
1191
+ if (o === void 0) {
1192
+ this.#d(e, J("Host data source does not support push."), { emitStarted: !0 }), this.options.onChanged(e.dataSourceId);
1193
+ return;
1194
+ }
1195
+ i.onWarning?.({
1196
+ severity: "warning",
1197
+ code: "HOST_RESOURCE_UNAVAILABLE",
1198
+ path: [],
1199
+ message: "Host data source does not support push; falling back to polling."
1200
+ });
1201
+ let r = this.#_("fallback-only", t, void 0, o);
1202
+ e.push = r, this.#l(e, n), this.#D(e, r);
1203
+ return;
1204
+ }
1205
+ let s = this.options.validateParams?.(r, e.params);
1206
+ if (s !== void 0) {
1207
+ this.#d(e, s, { emitStarted: !1 }), this.options.onChanged(e.dataSourceId);
1208
+ return;
1209
+ }
1210
+ let c = new AbortController(), l = this.#_("subscribed", t, a, o, c);
1211
+ e.push = l, e.connection = "connecting";
1212
+ let u = this.#t.now(), d = this.options.createExecutionContext(n, e.dataSourceId);
1213
+ e.executionContext = d, e.startedAt = u, e.requestId = `${e.dataSourceId}:${e.requestKey}:push:${l.id}`;
1214
+ let f;
1215
+ try {
1216
+ f = this.options.sourcePort.subscribe({
1217
+ dataSourceId: e.dataSourceId,
1218
+ source: r,
1219
+ params: e.params
1220
+ }, { push: (t) => this.#v(e, l, t) }, {
1221
+ signal: c.signal,
1222
+ context: d,
1223
+ ...t.retain === void 0 ? {} : { retain: t.retain }
1224
+ });
1225
+ } catch {
1226
+ f = {
1227
+ ok: !1,
1228
+ diagnostics: [q("Host subscription failed.")]
1229
+ };
1230
+ }
1231
+ if (e.push === l) {
1232
+ if (!f.ok) {
1233
+ this.#O(e, !1), this.#d(e, f.diagnostics[0] ?? q("Host subscription failed."), { emitStarted: !0 }), this.options.onChanged(e.dataSourceId);
1234
+ return;
1235
+ }
1236
+ this.#p(e, "subscribed", { startedAt: u }), l.snapshotReceived || (l.cancelSnapshotTimer = this.#t.setTimeout(() => this.#T(e, l), i.snapshotTimeoutMs ?? 15e3)), this.#E(e, l);
1237
+ }
1238
+ }
1239
+ #_(e, t, n, r, i) {
1240
+ let a = n?.inactivityTimeoutSeconds;
1241
+ return {
1242
+ id: ++this.#n,
1243
+ mode: e,
1244
+ controller: i,
1245
+ retain: t.retain,
1246
+ append: n?.append === !0,
1247
+ inactivityMs: a === void 0 ? void 0 : a * 1e3,
1248
+ fallbackMs: r,
1249
+ cursor: void 0,
1250
+ snapshotReceived: !1,
1251
+ resyncing: !1,
1252
+ inactive: !1,
1253
+ stopped: !1,
1254
+ warnedTimeField: !1,
1255
+ frameEvents: 0,
1256
+ cancelFrame: void 0,
1257
+ cancelSnapshotTimer: void 0,
1258
+ cancelInactivityTimer: void 0,
1259
+ cancelFallbackTimer: void 0
1260
+ };
1261
+ }
1262
+ #v(e, t, n) {
1263
+ if (!(t.stopped || e.push !== t) && this.#e.get(e.dataSourceId) === e && !(typeof n != "object" || !n)) {
1264
+ switch (t.inactive = !1, this.#E(e, t), n.type) {
1265
+ case "heartbeat": break;
1266
+ case "status":
1267
+ if (this.#y(e, t, n.status, n.diagnostic), e.push !== t) return;
1268
+ break;
1269
+ case "snapshot":
1270
+ if (this.#b(e, t, n.value, n.cursor), e.push !== t) return;
1271
+ break;
1272
+ case "append":
1273
+ if (this.#x(e, t, n.rows, n.cursor), e.push !== t) return;
1274
+ break;
1275
+ case "invalidate":
1276
+ (e.requestSlotId === void 0 || this.options.coordinator?.isPending(e.requestSlotId) !== !0) && this.#l(e, {
1277
+ trigger: "push",
1278
+ traceId: ""
1279
+ });
1280
+ break;
1281
+ default: return;
1282
+ }
1283
+ this.#M(e);
1284
+ }
1285
+ }
1286
+ #y(e, t, n, r) {
1287
+ if (typeof n != "string" || !Ge.has(n)) return;
1288
+ let i = n;
1289
+ if (i !== e.connection) {
1290
+ if (e.connection = i, this.#p(e, "connection", {
1291
+ startedAt: e.startedAt,
1292
+ connection: i
1293
+ }), i === "failed") {
1294
+ this.#O(e), this.#d(e, r ?? J("Host data source connection failed.")), this.options.onChanged(e.dataSourceId);
1295
+ return;
1296
+ }
1297
+ i === "suspended" ? (t.fallbackMs !== void 0 && this.#D(e, t), e.dataState.status !== "ready" && this.#j(e, J("Host data source is offline."))) : i === "open" && (t.cancelFallbackTimer?.(), t.cancelFallbackTimer = void 0), this.#N(e);
1298
+ }
1299
+ }
1300
+ #b(e, t, r, i) {
1301
+ let a = z(i);
1302
+ if (B(t.cursor, a, "snapshot") === "duplicate") return;
1303
+ let o = u(r, { maxBytes: n });
1304
+ if (!o.ok) {
1305
+ this.#w(e, "Host push snapshot is invalid JSON.");
1306
+ return;
1307
+ }
1308
+ t.cursor = a, t.snapshotReceived = !0, t.cancelSnapshotTimer?.(), t.cancelSnapshotTimer = void 0, t.resyncing &&= !1, this.#A(e, this.#C(e, t, o.value)), this.#N(e);
1309
+ }
1310
+ #x(e, t, r, i) {
1311
+ if (!t.snapshotReceived || t.resyncing) return;
1312
+ if (!t.append) {
1313
+ this.#w(e, "Host pushed append without declaring append delivery.");
1314
+ return;
1315
+ }
1316
+ let a = e.rawValue;
1317
+ if (!V(a)) {
1318
+ this.#w(e, "Host pushed append for a non-tabular value.");
1319
+ return;
1320
+ }
1321
+ let o = z(i), s = B(t.cursor, o, "append");
1322
+ if (s === "duplicate") return;
1323
+ if (s === "gap") {
1324
+ t.resyncing = !0, this.#p(e, "resync", {
1325
+ startedAt: e.startedAt,
1326
+ ...t.cursor === void 0 ? {} : { cursor: t.cursor }
1327
+ }), this.#N(e);
1328
+ return;
1329
+ }
1330
+ let c = u(r, { maxBytes: n });
1331
+ if (!c.ok || !Fe(c.value, a)) {
1332
+ this.#w(e, "Host pushed rows that do not match the dataset fields.");
1333
+ return;
1334
+ }
1335
+ o !== void 0 && (t.cursor = o);
1336
+ let l = {
1337
+ ...a,
1338
+ rows: [...a.rows, ...c.value]
1339
+ };
1340
+ this.#A(e, this.#C(e, t, l)), this.#N(e);
1341
+ }
1342
+ #S(e, t, n) {
1343
+ t.cursor = void 0, t.snapshotReceived = !0, t.resyncing = !1, t.cancelSnapshotTimer?.(), t.cancelSnapshotTimer = void 0, this.#A(e, this.#C(e, t, n));
1344
+ }
1345
+ #C(e, t, n) {
1346
+ if (!V(n) || !t.append && t.retain === void 0) return n;
1347
+ let r = Le(n.rows, t.retain);
1348
+ return r.unparseableTime && !t.warnedTimeField && (t.warnedTimeField = !0, this.options.push?.onWarning?.({
1349
+ severity: "warning",
1350
+ code: "HOST_RESOURCE_INVALID",
1351
+ path: [
1352
+ "dataSources",
1353
+ e.dataSourceId,
1354
+ "updatePolicy",
1355
+ "retain",
1356
+ "timeField"
1357
+ ],
1358
+ message: "Push retain timeField is missing or unparseable on some rows; trimming by rows only."
1359
+ })), r.rows === n.rows ? n : {
1360
+ ...n,
1361
+ rows: r.rows
1362
+ };
1363
+ }
1364
+ #w(e, t) {
1365
+ this.#O(e), this.#d(e, {
1366
+ severity: "error",
1367
+ code: "HOST_RESOURCE_INVALID",
1368
+ path: [],
1369
+ message: t
1370
+ }), this.options.onChanged(e.dataSourceId);
1371
+ }
1372
+ #T(e, t) {
1373
+ if (t.cancelSnapshotTimer = void 0, !(t.stopped || e.push !== t || t.snapshotReceived)) {
1374
+ if (e.dataState.status === "ready") {
1375
+ t.inactive = !0, this.#M(e);
1376
+ return;
1377
+ }
1378
+ this.#O(e), this.#d(e, {
1379
+ severity: "error",
1380
+ code: "HOST_RESOURCE_TIMEOUT",
1381
+ path: [],
1382
+ message: "Host data source did not deliver a snapshot in time."
1383
+ }), this.#p(e, "timed-out", {
1384
+ startedAt: e.startedAt,
1385
+ code: "HOST_RESOURCE_TIMEOUT"
1386
+ }), this.options.onChanged(e.dataSourceId);
1387
+ }
1388
+ }
1389
+ #E(e, t) {
1390
+ t.inactivityMs === void 0 || t.stopped || (t.cancelInactivityTimer?.(), t.cancelInactivityTimer = this.#t.setTimeout(() => {
1391
+ t.cancelInactivityTimer = void 0, !(t.stopped || e.push !== t) && (t.inactive = !0, this.#M(e));
1392
+ }, t.inactivityMs));
1393
+ }
1394
+ #D(e, t) {
1395
+ t.fallbackMs !== void 0 && t.cancelFallbackTimer === void 0 && (t.cancelFallbackTimer = this.#t.setTimeout(() => {
1396
+ t.cancelFallbackTimer = void 0, !(t.stopped || e.push !== t) && (t.mode !== "subscribed" || e.connection === "suspended") && ((e.requestSlotId === void 0 || this.options.coordinator?.isPending(e.requestSlotId) !== !0) && this.#l(e, {
1397
+ trigger: "polling",
1398
+ traceId: ""
1399
+ }), this.#D(e, t));
1400
+ }, t.fallbackMs));
1401
+ }
1402
+ #O(e, t = !0) {
1403
+ let n = e.push;
1404
+ n !== void 0 && (n.stopped = !0, n.controller?.abort(), n.cancelFrame?.(), n.cancelSnapshotTimer?.(), n.cancelInactivityTimer?.(), n.cancelFallbackTimer?.(), e.push = void 0, e.connection = void 0, t && n.mode === "subscribed" && this.#p(e, "unsubscribed", { startedAt: e.startedAt }));
1405
+ }
1406
+ #k(e) {
1407
+ let t = e.push;
1408
+ return t === void 0 || t.mode !== "subscribed" ? !1 : e.connection === "reconnecting" || e.connection === "suspended" || t.resyncing || t.inactive;
1409
+ }
1410
+ #A(e, t) {
1411
+ e.rawValue = t, e.rawError = void 0, e.dataState = this.#k(e) ? {
1412
+ status: "ready",
1413
+ value: t,
1414
+ stale: !0
1415
+ } : {
1416
+ status: "ready",
1417
+ value: t
1418
+ };
1419
+ }
1420
+ #j(e, t) {
1421
+ e.rawValue = void 0, e.rawError = t;
1422
+ let n = s(t);
1423
+ e.dataState = {
1424
+ status: "error",
1425
+ code: n.code,
1426
+ message: n.message
1427
+ };
1428
+ }
1429
+ #M(e) {
1430
+ if (e.dataState.status !== "ready" || e.rawValue === void 0) return;
1431
+ let t = this.#k(e);
1432
+ e.dataState.stale === !0 !== t && (this.#A(e, e.rawValue), this.#N(e));
1433
+ }
1434
+ #N(e) {
1435
+ let t = e.push;
1436
+ if (t === void 0) {
1437
+ this.options.onChanged(e.dataSourceId);
1438
+ return;
1439
+ }
1440
+ t.frameEvents++, t.cancelFrame === void 0 && (t.cancelFrame = this.#t.requestFrame(() => {
1441
+ if (t.cancelFrame = void 0, t.stopped || e.push !== t || this.#e.get(e.dataSourceId) !== e) return;
1442
+ let r = e.rawValue;
1443
+ if (e.dataState.status === "ready" && V(r)) {
1444
+ let t = Re(r, n);
1445
+ t !== r && this.#A(e, t);
1446
+ }
1447
+ t.frameEvents = 0, this.#p(e, "pushed", {
1448
+ startedAt: e.startedAt,
1449
+ ...K(e.rawValue),
1450
+ ...t.cursor === void 0 ? {} : { cursor: t.cursor }
1451
+ }), this.options.onChanged(e.dataSourceId);
1452
+ }));
1453
+ }
1454
+ #P(e) {
1455
+ let t = this.#r?.components ?? [];
973
1456
  for (let n of t) {
974
- let t = l(n);
1457
+ let t = p(n);
975
1458
  if (t?.kind === "data-source-field" && t.dataSourceId === e) return n.id;
976
1459
  }
977
1460
  return e;
978
1461
  }
979
1462
  };
980
- function Ee(e) {
981
- let t = u(e), n = new Map(t.map((e) => [e.id, e])), r = [];
982
- for (let t of f(e)) {
1463
+ function qe(e) {
1464
+ let t = m(e), n = new Map(t.map((e) => [e.id, e])), r = [];
1465
+ for (let t of re(e)) {
983
1466
  let e = n.get(t);
984
1467
  e !== void 0 && (r.push(e), n.delete(t));
985
1468
  }
986
1469
  for (let e of t) n.has(e.id) && r.push(e);
987
1470
  return r;
988
1471
  }
989
- function De(e, t, n) {
990
- return `ds:${e}:${C(t)}:${C(n)}`;
1472
+ function Je(e, t, n) {
1473
+ return `ds:${e}:${x(t)}:${x(n)}`;
991
1474
  }
992
- function Oe(e) {
1475
+ function Ye(e) {
993
1476
  switch (e.kind) {
994
1477
  case "dataset": return {
995
1478
  resourceType: "dataset",
@@ -1005,7 +1488,7 @@ function Oe(e) {
1005
1488
  };
1006
1489
  }
1007
1490
  }
1008
- function W(e) {
1491
+ function K(e) {
1009
1492
  if (e === void 0 || typeof e != "object" || !e || Array.isArray(e)) return {};
1010
1493
  let t = e.fields, n = e.rows;
1011
1494
  return {
@@ -1013,7 +1496,7 @@ function W(e) {
1013
1496
  ...Array.isArray(n) ? { rowCount: n.length } : {}
1014
1497
  };
1015
1498
  }
1016
- function G(e = "Host resource request failed.") {
1499
+ function q(e = "Host resource request failed.") {
1017
1500
  return {
1018
1501
  severity: "error",
1019
1502
  code: "HOST_RESOURCE_FAILED",
@@ -1021,9 +1504,34 @@ function G(e = "Host resource request failed.") {
1021
1504
  message: e
1022
1505
  };
1023
1506
  }
1507
+ function J(e) {
1508
+ return {
1509
+ severity: "error",
1510
+ code: "HOST_RESOURCE_UNAVAILABLE",
1511
+ path: [],
1512
+ message: e
1513
+ };
1514
+ }
1515
+ function Xe() {
1516
+ return {
1517
+ now: () => Date.now(),
1518
+ setTimeout: (e, t) => {
1519
+ let n = globalThis.setTimeout(e, t);
1520
+ return () => globalThis.clearTimeout(n);
1521
+ },
1522
+ requestFrame: (e) => {
1523
+ if (typeof globalThis.requestAnimationFrame == "function") {
1524
+ let t = globalThis.requestAnimationFrame(() => e());
1525
+ return () => globalThis.cancelAnimationFrame(t);
1526
+ }
1527
+ let t = globalThis.setTimeout(e, 16);
1528
+ return () => globalThis.clearTimeout(t);
1529
+ }
1530
+ };
1531
+ }
1024
1532
  //#endregion
1025
1533
  //#region src/resource/request-coordinator.ts
1026
- var ke = class {
1534
+ var Ze = class {
1027
1535
  resourcePort;
1028
1536
  isShareable;
1029
1537
  timeoutMs;
@@ -1113,28 +1621,465 @@ var ke = class {
1113
1621
  #r(e) {
1114
1622
  e.timer !== void 0 && clearTimeout(e.timer), e.controller.abort(), this.#e.get(e.slotId) === e && this.#e.delete(e.slotId);
1115
1623
  }
1624
+ }, Qe = 1e6, $e = 160, et = "cubic-bezier(0.2, 0, 0, 1)", tt = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]", nt = class {
1625
+ options;
1626
+ #e = /* @__PURE__ */ new Map();
1627
+ #t;
1628
+ #n = /* @__PURE__ */ new Map();
1629
+ #r = /* @__PURE__ */ new Map();
1630
+ #i = /* @__PURE__ */ new Set();
1631
+ #a = [];
1632
+ #o = {
1633
+ width: 0,
1634
+ height: 0
1635
+ };
1636
+ #s = null;
1637
+ #c = !1;
1638
+ #l = [];
1639
+ #u = [];
1640
+ #d = /* @__PURE__ */ new Map();
1641
+ #f = /* @__PURE__ */ new Map();
1642
+ #p = !1;
1643
+ #m;
1644
+ constructor(e) {
1645
+ this.options = e;
1646
+ }
1647
+ get currentPage() {
1648
+ return this.#s;
1649
+ }
1650
+ prepare(e) {
1651
+ this.#n = new Map((e.subCanvases ?? []).map((e) => [e.id, e]));
1652
+ let t = rt(e);
1653
+ if (this.#r = t.canvas, this.#i = t.belowMain, this.#a = (e.subCanvases ?? []).filter((e) => e.display === "page").map((e) => e.id), this.#o = {
1654
+ width: e.canvas.width,
1655
+ height: e.canvas.height
1656
+ }, this.#s !== null && !this.#a.includes(this.#s) && (this.#s = null, this.#c = !1), this.#s === null && this.#a.length > 0) {
1657
+ let t = this.options.initialPageId;
1658
+ this.#s = t !== void 0 && this.#a.includes(t) ? t : ne(e);
1659
+ }
1660
+ if (this.#l = this.#l.filter((e) => this.#a.includes(e)), this.options.enabled) {
1661
+ for (let [e, t] of this.#e) this.#n.get(e)?.display !== "popup" && (this.#f.get(e)?.cancel(), this.#f.delete(e), this.#d.delete(e), it(t), this.#e.delete(e));
1662
+ this.#u = this.#u.filter((e) => this.#n.get(e)?.display === "popup"), this.#y();
1663
+ for (let e of this.#n.values()) e.display === "popup" && this.#S(e);
1664
+ this.#w();
1665
+ }
1666
+ }
1667
+ visibleDocument(e) {
1668
+ if (!this.options.enabled || this.#a.length === 0) return e;
1669
+ let t = this.#m;
1670
+ if (t !== void 0 && t.source === e && t.page === this.#s) return t.value;
1671
+ let n = e.components.filter((e) => {
1672
+ let t = this.#r.get(e.id);
1673
+ return t === void 0 || this.#n.get(t)?.display === "popup" || t === this.#s;
1674
+ }), r = n.length === e.components.length ? e : {
1675
+ ...e,
1676
+ components: n
1677
+ };
1678
+ return this.#m = {
1679
+ source: e,
1680
+ page: this.#s,
1681
+ value: r
1682
+ }, r;
1683
+ }
1684
+ containerFor(e) {
1685
+ if (!this.options.enabled) return;
1686
+ let t = this.#r.get(e);
1687
+ if (t !== void 0) return this.#n.get(t)?.display === "popup" ? this.#e.get(t)?.panel : this.#t?.page;
1688
+ let n = this.#t;
1689
+ if (n !== void 0) return this.#i.has(e) ? n.below : n.main;
1690
+ }
1691
+ isOpen(e) {
1692
+ return e === this.#s || this.#u.includes(e);
1693
+ }
1694
+ announceStartPage() {
1695
+ if (this.#c || this.#s === null) return;
1696
+ this.#c = !0;
1697
+ let e = this.#s;
1698
+ this.#_({
1699
+ type: "canvas",
1700
+ canvasId: e,
1701
+ display: "page",
1702
+ open: !0,
1703
+ reason: "start"
1704
+ }), this.#_({
1705
+ type: "page-changed",
1706
+ from: null,
1707
+ to: e,
1708
+ reason: "start"
1709
+ });
1710
+ }
1711
+ apply(e) {
1712
+ for (let t of e) {
1713
+ if (t.type === "page-navigation") {
1714
+ this.navigate(t.operation, "blueprint");
1715
+ continue;
1716
+ }
1717
+ this.#n.get(t.canvasId) !== void 0 && (t.operation === "open" || t.operation !== "close" && !this.isOpen(t.canvasId) ? this.open(t.canvasId, t.payload, "blueprint") : this.close(t.canvasId, "blueprint"));
1718
+ }
1719
+ }
1720
+ open(e, t, n) {
1721
+ let r = this.#n.get(e);
1722
+ return r === void 0 ? !1 : r.display === "popup" ? this.#g(e, !0, n, t) : this.#h(e, t, n, !0);
1723
+ }
1724
+ close(e, t) {
1725
+ let n = this.#n.get(e);
1726
+ return n === void 0 ? !1 : n.display === "popup" ? this.#g(e, !1, t) : e === this.#s && this.navigate("back", t);
1727
+ }
1728
+ navigate(e, t) {
1729
+ if (e === "back") {
1730
+ let e = this.#l.pop();
1731
+ return e !== void 0 && this.#h(e, void 0, t, !1);
1732
+ }
1733
+ let n = this.#s === null ? -1 : this.#a.indexOf(this.#s), r = this.#a[e === "next" ? n + 1 : n - 1];
1734
+ return r !== void 0 && this.#h(r, void 0, t, !0);
1735
+ }
1736
+ syncInert() {
1737
+ if (!this.options.enabled) return;
1738
+ let e = this.#u.at(-1), t = e === void 0 ? void 0 : this.#e.get(e)?.layer, n = this.options.root.children;
1739
+ if (!(n === void 0 || t === void 0 && !this.#p)) {
1740
+ for (let e of Array.from(n)) {
1741
+ let n = t !== void 0 && e !== t;
1742
+ e.inert !== n && (e.inert = n);
1743
+ }
1744
+ this.#p = t !== void 0;
1745
+ }
1746
+ }
1747
+ reset() {
1748
+ for (let e of this.#f.values()) e.cancel();
1749
+ this.#f.clear(), this.#u = [], this.#d.clear(), this.#s = null, this.#c = !1, this.#l = [], this.#m = void 0;
1750
+ for (let e of this.#e.values()) e.layer.style.display = "none";
1751
+ this.syncInert();
1752
+ }
1753
+ dispose() {
1754
+ this.reset();
1755
+ for (let e of this.#e.values()) it(e);
1756
+ this.#e.clear(), this.#x();
1757
+ }
1758
+ #h(e, t, n, r) {
1759
+ if (e === this.#s || !this.#a.includes(e)) return !1;
1760
+ for (let e of [...this.#u].reverse()) this.#g(e, !1, n);
1761
+ let i = this.#s;
1762
+ return i !== null && r && this.#l.push(i), this.#s = e, this.#c = !0, this.#b(), this.options.requestRender(), i !== null && this.#_({
1763
+ type: "canvas",
1764
+ canvasId: i,
1765
+ display: "page",
1766
+ open: !1,
1767
+ reason: n
1768
+ }), this.#_({
1769
+ type: "canvas",
1770
+ canvasId: e,
1771
+ display: "page",
1772
+ open: !0,
1773
+ reason: n,
1774
+ ...t === void 0 ? {} : { payload: t }
1775
+ }), this.#_({
1776
+ type: "page-changed",
1777
+ from: i,
1778
+ to: e,
1779
+ reason: n
1780
+ }), !0;
1781
+ }
1782
+ #g(e, t, n, r) {
1783
+ if (this.#u.includes(e) === t) return !1;
1784
+ if (t) {
1785
+ let t = st(this.options.root);
1786
+ t !== null && this.#d.set(e, t), this.#u = [...this.#u, e];
1787
+ } else this.#u = this.#u.filter((t) => t !== e);
1788
+ if (this.options.enabled) {
1789
+ this.#w();
1790
+ let n = this.#e.get(e);
1791
+ n !== void 0 && (this.#T(e, n, t), t ? at(n) : this.#v(e));
1792
+ }
1793
+ return this.#_({
1794
+ type: "canvas",
1795
+ canvasId: e,
1796
+ display: "popup",
1797
+ open: t,
1798
+ reason: n,
1799
+ ...t && r !== void 0 ? { payload: r } : {}
1800
+ }), !0;
1801
+ }
1802
+ #_(e) {
1803
+ this.options.onChange?.(e);
1804
+ }
1805
+ #v(e) {
1806
+ let t = this.#d.get(e);
1807
+ this.#d.delete(e);
1808
+ let n = this.#u.at(-1), r = n === void 0 ? void 0 : this.#e.get(n);
1809
+ if (r !== void 0) {
1810
+ at(r);
1811
+ return;
1812
+ }
1813
+ t !== void 0 && t.isConnected && "focus" in t && t.focus({ preventScroll: !0 });
1814
+ }
1815
+ #y() {
1816
+ if (this.#a.length === 0) {
1817
+ this.#x();
1818
+ return;
1819
+ }
1820
+ if (this.#t === void 0) {
1821
+ let e = this.options.root.ownerDocument, t = (t, n, r) => {
1822
+ let i = e.createElement("div");
1823
+ return i.dataset.baseScreenCanvasLayer = t, i.style.position = "absolute", i.style.left = "0", i.style.top = "0", i.style.zIndex = String(n), r ? (i.style.width = "100%", i.style.height = "100%", i.style.pointerEvents = "none") : (i.style.width = "0", i.style.height = "0", i.style.overflow = "visible"), i;
1824
+ };
1825
+ this.#t = {
1826
+ background: t("page-background", 0, !0),
1827
+ below: t("below", 1, !1),
1828
+ page: t("page", 2, !1),
1829
+ main: t("main", 3, !1)
1830
+ };
1831
+ let n = this.options.root, { background: r, below: i, page: a, main: o } = this.#t;
1832
+ for (let e of [
1833
+ o,
1834
+ a,
1835
+ i,
1836
+ r
1837
+ ]) n.insertBefore(e, n.firstChild);
1838
+ }
1839
+ this.#b();
1840
+ }
1841
+ #b() {
1842
+ let e = this.#t;
1843
+ if (e === void 0) return;
1844
+ let t = this.#s === null ? void 0 : this.#n.get(this.#s);
1845
+ t?.display === "page" && (t.backgroundColor !== void 0 || t.background !== void 0) ? b(e.background, {
1846
+ width: this.#o.width,
1847
+ height: this.#o.height,
1848
+ backgroundColor: t.backgroundColor ?? "transparent",
1849
+ ...t.background === void 0 ? {} : { background: t.background }
1850
+ }) : b(e.background, {
1851
+ width: this.#o.width,
1852
+ height: this.#o.height,
1853
+ backgroundColor: "transparent"
1854
+ });
1855
+ }
1856
+ #x() {
1857
+ let e = this.#t;
1858
+ if (e !== void 0) {
1859
+ for (let t of Object.values(e)) t.remove();
1860
+ this.#t = void 0;
1861
+ }
1862
+ }
1863
+ #S(e) {
1864
+ let t = this.#e.get(e.id);
1865
+ if (t === void 0) {
1866
+ let n = this.options.root.ownerDocument, r = n.createElement("div");
1867
+ r.dataset.baseScreenPopup = e.id, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true"), r.setAttribute("tabindex", "-1"), r.style.position = "absolute", r.style.inset = "0", r.style.outline = "none", r.style.display = "none";
1868
+ let i = n.createElement("div");
1869
+ i.dataset.baseScreenPopupPanel = e.id, i.style.position = "absolute", i.style.overflow = "hidden", i.style.transformOrigin = "center", i.style.boxShadow = "0 24px 64px rgb(0 0 0 / 45%)", r.appendChild(i);
1870
+ let a = (t) => {
1871
+ if (t.target !== r) return;
1872
+ let n = this.#n.get(e.id);
1873
+ n?.display === "popup" && n.closeOnMaskClick && this.#g(e.id, !1, "mask");
1874
+ }, o = (t) => this.#C(e.id, t);
1875
+ r.addEventListener("click", a), r.addEventListener("keydown", o), this.options.root.appendChild(r), t = {
1876
+ layer: r,
1877
+ panel: i,
1878
+ onMaskClick: a,
1879
+ onKeyDown: o
1880
+ }, this.#e.set(e.id, t);
1881
+ }
1882
+ t.layer.setAttribute("aria-label", e.name), t.layer.style.background = e.maskColor;
1883
+ let n = te(this.#o, e, e.placement);
1884
+ t.panel.style.left = `${n.x}px`, t.panel.style.top = `${n.y}px`, t.panel.style.width = `${e.width}px`, t.panel.style.height = `${e.height}px`, t.panel.style.borderRadius = `${e.borderRadius}px`, b(t.panel, ct(e)), !this.#u.includes(e.id) && !this.#f.has(e.id) && (t.layer.style.display = "none");
1885
+ }
1886
+ #C(e, t) {
1887
+ if (this.#u.at(-1) !== e) return;
1888
+ let n = this.#e.get(e);
1889
+ if (n === void 0) return;
1890
+ if (t.key === "Escape") {
1891
+ let n = this.#n.get(e);
1892
+ if (n?.display !== "popup" || !n.closeOnEscape) return;
1893
+ t.preventDefault(), t.stopPropagation(), this.#g(e, !1, "escape");
1894
+ return;
1895
+ }
1896
+ if (t.key !== "Tab") return;
1897
+ let r = ot(n.panel), i = r[0], a = r.at(-1);
1898
+ if (i === void 0 || a === void 0) {
1899
+ t.preventDefault(), n.layer.focus({ preventScroll: !0 });
1900
+ return;
1901
+ }
1902
+ let o = st(this.options.root);
1903
+ t.shiftKey && (o === i || o === n.layer) ? (t.preventDefault(), a.focus({ preventScroll: !0 })) : !t.shiftKey && o === a && (t.preventDefault(), i.focus({ preventScroll: !0 }));
1904
+ }
1905
+ #w() {
1906
+ for (let [e, t] of this.#e) {
1907
+ let n = this.#u.indexOf(e);
1908
+ t.layer.style.zIndex = String(Qe + Math.max(0, n));
1909
+ }
1910
+ this.syncInert();
1911
+ }
1912
+ #T(e, t, n) {
1913
+ if (this.#f.get(e)?.cancel(), this.#f.delete(e), (this.options.root.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1) || typeof t.layer.animate != "function") {
1914
+ t.layer.style.display = n ? "block" : "none";
1915
+ return;
1916
+ }
1917
+ t.layer.style.display = "block";
1918
+ let r = t.layer.animate(n ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }], {
1919
+ duration: $e,
1920
+ easing: et,
1921
+ fill: "none"
1922
+ });
1923
+ typeof t.panel.animate == "function" && t.panel.animate(n ? [{ transform: "scale(0.96)" }, { transform: "scale(1)" }] : [{ transform: "scale(1)" }, { transform: "scale(0.96)" }], {
1924
+ duration: $e,
1925
+ easing: et,
1926
+ fill: "none"
1927
+ }), this.#f.set(e, r), r.finished.then(() => {
1928
+ this.#f.get(e) === r && (this.#f.delete(e), t.layer.style.display = this.#u.includes(e) ? "block" : "none");
1929
+ }).catch(() => void 0);
1930
+ }
1931
+ };
1932
+ function rt(e) {
1933
+ let t = new Map(e.components.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
1934
+ for (let i of e.components) {
1935
+ let e = i, a = /* @__PURE__ */ new Set();
1936
+ for (; e.parentId !== null && !a.has(e.id);) {
1937
+ a.add(e.id);
1938
+ let n = t.get(e.parentId);
1939
+ if (n === void 0) break;
1940
+ e = n;
1941
+ }
1942
+ e.parentId === null && (e.canvasId === void 0 ? e.belowSubCanvas === !0 && r.add(i.id) : n.set(i.id, e.canvasId));
1943
+ }
1944
+ return {
1945
+ canvas: n,
1946
+ belowMain: r
1947
+ };
1948
+ }
1949
+ function it(e) {
1950
+ e.layer.removeEventListener("click", e.onMaskClick), e.layer.removeEventListener("keydown", e.onKeyDown), e.layer.remove();
1951
+ }
1952
+ function at(e) {
1953
+ let t = ot(e.panel)[0] ?? e.layer;
1954
+ typeof t.focus == "function" && t.focus({ preventScroll: !0 });
1955
+ }
1956
+ function ot(e) {
1957
+ return typeof e.querySelectorAll == "function" ? Array.from(e.querySelectorAll(tt)).filter((e) => !e.hasAttribute("disabled") && e.getAttribute("aria-hidden") !== "true") : [];
1958
+ }
1959
+ function st(e) {
1960
+ let t = typeof e.getRootNode == "function" ? e.getRootNode() : void 0;
1961
+ return (t !== void 0 && "activeElement" in t ? t.activeElement : null) ?? e.ownerDocument?.activeElement ?? null;
1962
+ }
1963
+ function ct(e) {
1964
+ return {
1965
+ width: e.width,
1966
+ height: e.height,
1967
+ backgroundColor: e.backgroundColor,
1968
+ ...e.background === void 0 ? {} : { background: e.background }
1969
+ };
1970
+ }
1971
+ //#endregion
1972
+ //#region src/renderer/renderer-component-states.ts
1973
+ var lt = class {
1974
+ #e = /* @__PURE__ */ new Map();
1975
+ #t = /* @__PURE__ */ new Map();
1976
+ #n = /* @__PURE__ */ new Map();
1977
+ #r = /* @__PURE__ */ new Map();
1978
+ #i = /* @__PURE__ */ new Set();
1979
+ #a = [];
1980
+ #o = !1;
1981
+ resolve(e, n, r) {
1982
+ let i = n.component.states;
1983
+ if (i === void 0) return t;
1984
+ let a = n.component.id, o = this.#t.get(a);
1985
+ if (o !== void 0 && i.items.some((e) => e.id === o)) return o;
1986
+ let s = ee(i, {
1987
+ componentData: () => r.status === "ready" ? r.value : void 0,
1988
+ variable: (t) => Object.hasOwn(e.variables, t) ? e.variables[t] : void 0,
1989
+ dataSource: (t) => {
1990
+ let n = e.dataSources.read(t);
1991
+ return n?.dataState.status === "ready" ? n.rawValue : void 0;
1992
+ }
1993
+ });
1994
+ return s.status === "resolved" ? (this.#e.set(a, s.stateId), this.#r.set(a, s.value), s.stateId) : this.#e.get(a) ?? t;
1995
+ }
1996
+ commit(e, n, r) {
1997
+ let i = this.#n.get(n) ?? t, a = this.#n.has(n);
1998
+ this.#n.set(n, r);
1999
+ let o = this.#i.delete(n) ? "blueprint" : "judge";
2000
+ i === r && (a || r === t) || e.options.onComponentStateChange !== void 0 && (this.#a.push({
2001
+ componentId: n,
2002
+ from: i,
2003
+ to: r,
2004
+ cause: o
2005
+ }), this.#s(e));
2006
+ }
2007
+ apply(e) {
2008
+ let t = /* @__PURE__ */ new Set();
2009
+ for (let n of e) n.operation === "set" && n.stateId !== void 0 ? this.#t.set(n.componentId, n.stateId) : this.#t.delete(n.componentId), this.#i.add(n.componentId), t.add(n.componentId);
2010
+ return [...t];
2011
+ }
2012
+ read(e) {
2013
+ let t = this.#n.get(e);
2014
+ if (t === void 0) return;
2015
+ let n = this.#r.get(e);
2016
+ return n === void 0 ? { stateId: t } : {
2017
+ stateId: t,
2018
+ value: n
2019
+ };
2020
+ }
2021
+ retain(e) {
2022
+ for (let t of [
2023
+ this.#e,
2024
+ this.#t,
2025
+ this.#n,
2026
+ this.#r
2027
+ ]) for (let n of [...t.keys()]) e.has(n) || t.delete(n);
2028
+ for (let t of [...this.#i]) e.has(t) || this.#i.delete(t);
2029
+ }
2030
+ reset() {
2031
+ this.#e.clear(), this.#t.clear(), this.#n.clear(), this.#r.clear(), this.#i.clear(), this.#a = [];
2032
+ }
2033
+ #s(e) {
2034
+ this.#o || (this.#o = !0, queueMicrotask(() => {
2035
+ this.#o = !1;
2036
+ let t = this.#a;
2037
+ if (this.#a = [], !e.disposed) for (let n of t) try {
2038
+ e.options.onComponentStateChange?.(n);
2039
+ } catch {
2040
+ e.options.onDiagnostic?.({
2041
+ severity: "error",
2042
+ code: "PLUGIN_CORE_RENDER_FAILED",
2043
+ path: [
2044
+ "components",
2045
+ n.componentId,
2046
+ "states"
2047
+ ],
2048
+ message: "Host component state callback raised an exception."
2049
+ });
2050
+ }
2051
+ }));
2052
+ }
1116
2053
  };
1117
2054
  //#endregion
1118
2055
  //#region src/renderer/renderer-state.ts
1119
- function Ae(e) {
1120
- if (!Fe(e.resourceTimeoutMs ?? 15e3)) throw RangeError("resourceTimeoutMs must be an integer between 100 and 60000.");
1121
- let t = new we(e.resourcePort, e.datasetPort, e.hostCatalogPort), n, r = e.resourcePort !== void 0 || e.datasetPort !== void 0 || e.hostCatalogPort !== void 0 ? new ke({ resolve: (e, n) => t.query(e, n) }, (t) => je(t, e), e.resourceTimeoutMs ?? 15e3) : void 0, i = new Te({
2056
+ function ut(e) {
2057
+ if (!gt(e.resourceTimeoutMs ?? 15e3)) throw RangeError("resourceTimeoutMs must be an integer between 100 and 60000.");
2058
+ let t = new We(e.resourcePort, e.datasetPort, e.hostCatalogPort), n, r = e.resourcePort !== void 0 || e.datasetPort !== void 0 || e.hostCatalogPort !== void 0 ? new Ze({ resolve: (e, n) => t.query(e, n) }, (t) => dt(t, e), e.resourceTimeoutMs ?? 15e3) : void 0, i = new Ke({
1122
2059
  sourcePort: t,
1123
2060
  coordinator: r,
1124
2061
  isSuspended: () => n.dataSuspended,
1125
- createExecutionContext: (e, t) => Pe(n, t, e),
1126
- emit: (e) => Ne(n, e),
2062
+ createExecutionContext: (e, t) => ht(n, t, e),
2063
+ emit: (e) => mt(n, e),
1127
2064
  onChanged: (e) => n.onDataSourceChanged(e),
1128
- validateParams: (e, t) => Me(n, e, t)
2065
+ validateParams: (e, t) => ft(n, e, t),
2066
+ push: {
2067
+ enabled: e.mode !== "design",
2068
+ delivery: (e) => pt(n, e),
2069
+ snapshotTimeoutMs: e.resourceTimeoutMs ?? 15e3,
2070
+ onWarning: (t) => e.onDiagnostic?.(t)
2071
+ }
1129
2072
  });
1130
2073
  return n = {
1131
2074
  options: e,
1132
2075
  catalog: e.catalog,
1133
2076
  mounted: /* @__PURE__ */ new Map(),
1134
2077
  candidates: /* @__PURE__ */ new Map(),
2078
+ opacities: /* @__PURE__ */ new Map(),
1135
2079
  document: void 0,
1136
2080
  lastValidatedInput: void 0,
1137
2081
  validationCache: { entries: /* @__PURE__ */ new Map() },
2082
+ componentSources: /* @__PURE__ */ new WeakMap(),
1138
2083
  variables: {},
1139
2084
  dataSuspended: !1,
1140
2085
  disposed: !1,
@@ -1142,14 +2087,23 @@ function Ae(e) {
1142
2087
  coordinator: r,
1143
2088
  sourceQueries: t,
1144
2089
  dataSources: i,
1145
- visibility: new ve(e.root),
1146
- onDataSourceChanged: () => {}
2090
+ visibility: new Ne(e.root),
2091
+ subCanvases: new nt({
2092
+ root: e.root,
2093
+ enabled: e.mode !== "design",
2094
+ onChange: e.onCanvasChange,
2095
+ requestRender: () => n.requestRender(),
2096
+ ...e.initialPageId === void 0 ? {} : { initialPageId: e.initialPageId }
2097
+ }),
2098
+ componentStates: new lt(),
2099
+ onDataSourceChanged: () => {},
2100
+ requestRender: () => {}
1147
2101
  }, n;
1148
2102
  }
1149
- function je(e, t) {
2103
+ function dt(e, t) {
1150
2104
  return e === "#source-dataset" ? t.datasetPort?.queryScope === "dataset" : e === "#source-resource";
1151
2105
  }
1152
- function Me(e, t, n) {
2106
+ function ft(e, t, n) {
1153
2107
  if (t.kind !== "host-resource") return;
1154
2108
  let r = e.options.contributionIndex;
1155
2109
  if (r === void 0) return;
@@ -1160,14 +2114,21 @@ function Me(e, t, n) {
1160
2114
  path: [],
1161
2115
  message: "Host resource type is not enabled by an active plugin contribution."
1162
2116
  };
1163
- if (!x(n, i.configSchema).ok) return {
2117
+ if (!y(n, i.configSchema).ok) return {
1164
2118
  severity: "error",
1165
2119
  code: "HOST_RESOURCE_FAILED",
1166
2120
  path: [],
1167
2121
  message: "Host resource request failed."
1168
2122
  };
1169
2123
  }
1170
- function Ne(e, t) {
2124
+ function pt(e, t) {
2125
+ if (t.kind === "host-resource") {
2126
+ let n = e.options.contributionIndex;
2127
+ return n === void 0 ? {} : n.getResourceType(t.resourceType)?.delivery?.push;
2128
+ }
2129
+ if (t.kind === "host-catalog") return {};
2130
+ }
2131
+ function mt(e, t) {
1171
2132
  let n = e.options.observer;
1172
2133
  if (n !== void 0) try {
1173
2134
  n({
@@ -1180,11 +2141,13 @@ function Ne(e, t) {
1180
2141
  durationMs: t.startedAt === void 0 ? 0 : Date.now() - t.startedAt,
1181
2142
  ...t.fieldCount === void 0 ? {} : { fieldCount: t.fieldCount },
1182
2143
  ...t.rowCount === void 0 ? {} : { rowCount: t.rowCount },
1183
- ...t.code === void 0 ? {} : { code: t.code }
2144
+ ...t.code === void 0 ? {} : { code: t.code },
2145
+ ...t.cursor === void 0 ? {} : { cursor: t.cursor },
2146
+ ...t.connection === void 0 ? {} : { connection: t.connection }
1184
2147
  });
1185
2148
  } catch {}
1186
2149
  }
1187
- function Pe(e, t, n) {
2150
+ function ht(e, t, n) {
1188
2151
  return {
1189
2152
  instanceId: e.options.instanceId ?? "renderer",
1190
2153
  mode: e.options.executionMode ?? "viewer",
@@ -1194,107 +2157,118 @@ function Pe(e, t, n) {
1194
2157
  ...e.options.documentRevision === void 0 ? {} : { documentRevision: e.options.documentRevision }
1195
2158
  };
1196
2159
  }
1197
- function Fe(e) {
2160
+ function gt(e) {
1198
2161
  return Number.isInteger(e) && e >= 100 && e <= 6e4;
1199
2162
  }
1200
2163
  //#endregion
1201
2164
  //#region src/renderer/renderer.ts
1202
- function K(e) {
1203
- return new Ie(e);
2165
+ function _t(e) {
2166
+ return new vt(e);
1204
2167
  }
1205
- var Ie = class {
2168
+ var vt = class {
1206
2169
  #e;
1207
2170
  #t = /* @__PURE__ */ new Map();
2171
+ #n = /* @__PURE__ */ new Map();
1208
2172
  constructor(e) {
1209
- this.#e = Ae(e), this.#e.onDataSourceChanged = (e) => this.#n(e);
2173
+ this.#e = ut(e), this.#e.onDataSourceChanged = (e) => this.#a(e), this.#e.requestRender = () => {
2174
+ let e = this.#e.lastValidatedInput;
2175
+ e !== void 0 && !this.#e.disposed && this.render(e);
2176
+ };
2177
+ }
2178
+ get currentPage() {
2179
+ return this.#e.subCanvases.currentPage;
1210
2180
  }
1211
2181
  render(e, t) {
1212
- if (this.#e.disposed) return E("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.");
2182
+ if (this.#e.disposed) return w("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.");
1213
2183
  let n = e === this.#e.lastValidatedInput && this.#e.document !== void 0 ? {
1214
2184
  ok: !0,
1215
2185
  value: this.#e.document,
1216
2186
  diagnostics: []
1217
- } : a(e, this.#e.lastValidatedInput);
2187
+ } : l(e, this.#e.lastValidatedInput);
1218
2188
  if (!n.ok) return n;
1219
- let r = {
2189
+ yt(this.#e, e, n.value), this.#e.subCanvases.prepare(n.value);
2190
+ let r = this.#e.subCanvases.visibleDocument(n.value), i = {
1220
2191
  trigger: t?.trigger ?? "manual",
1221
2192
  traceId: t?.traceId ?? ""
1222
2193
  };
1223
- this.#e.dataSources.ensure(n.value, this.#e.variables, r), this.#t = q(n.value);
1224
- let i = A(n.value, this.#e.catalog, this.#e.options.mode, this.#e.interactive, this.#e.options.contributionIndex, this.#e.dataSources, this.#e.validationCache, this.#e.options.componentFailurePolicy ?? "fail");
1225
- if (!i.ok) return i;
1226
- let o = new Map(ee(n.value).map((e, t) => [e, t]));
1227
- this.#e.visibility.prepare(n.value);
1228
- let s = [...i.value].sort((e, t) => o.get(e.component.id) - o.get(t.component.id)), c = /* @__PURE__ */ new Map(), l = [];
2194
+ this.#e.dataSources.ensure(n.value, this.#e.variables, i), this.#t = St(r), this.#n = xt(r);
2195
+ let a = be(r, this.#e.catalog, this.#e.options.mode, this.#e.interactive, this.#e.options.contributionIndex, this.#e.dataSources, this.#e.validationCache, this.#e.options.componentFailurePolicy ?? "fail");
2196
+ if (!a.ok) return a;
2197
+ let o = new Map(ce(r).map((e, t) => [e, t]));
2198
+ this.#e.visibility.prepare(r);
2199
+ let s = [...a.value].sort((e, t) => o.get(e.component.id) - o.get(t.component.id));
2200
+ this.#e.opacities = A(this.#e, new Map(s.map((e) => [e.component.id, e])), n.value);
2201
+ let c = /* @__PURE__ */ new Map(), u = [];
1229
2202
  for (let e of s) {
1230
- let t = o.get(e.component.id), n = this.#e.mounted.get(e.component.id);
1231
- if (n !== void 0 && n.type === e.component.type) {
2203
+ let t = o.get(e.component.id), r = this.#e.mounted.get(e.component.id);
2204
+ if (r !== void 0 && r.type === e.component.type) {
1232
2205
  try {
1233
- R(this.#e, e, n, t);
2206
+ ke(this.#e, e, r, t, n.value, this.#e.opacities.get(e.component.id) ?? 1);
1234
2207
  } catch {
1235
- l.push(D(e, "Material model update raised an exception."));
2208
+ u.push(T(e, "Material model update raised an exception."));
1236
2209
  }
1237
- c.set(e.component.id, n);
2210
+ let i = this.#e.subCanvases.containerFor(e.component.id), a = r.element.parentElement ?? void 0, o = this.#e.options.root;
2211
+ (i === void 0 ? a !== void 0 && a !== o : a !== i) && (i ?? o).appendChild(r.element), c.set(e.component.id, r);
1238
2212
  continue;
1239
2213
  }
1240
- n !== void 0 && (n.element.removeEventListener("base-screen-material-event", n.onEvent), n.element.remove());
1241
- let r;
2214
+ r !== void 0 && (r.element.removeEventListener("base-screen-material-event", r.onEvent), r.element.remove());
2215
+ let i;
1242
2216
  try {
1243
- r = new e.entry.constructor();
2217
+ i = new e.entry.constructor();
1244
2218
  } catch {
1245
- l.push(D(e, "Material constructor raised an exception."));
2219
+ u.push(T(e, "Material constructor raised an exception."));
1246
2220
  continue;
1247
2221
  }
1248
- let i = (t) => _e(this.#e, e, t);
1249
- r.addEventListener("base-screen-material-event", i);
1250
- let a;
2222
+ let a = (t) => Me(this.#e, e, t);
2223
+ i.addEventListener("base-screen-material-event", a);
2224
+ let s;
1251
2225
  try {
1252
- a = P(this.#e, e, e.model.dataState), F(r, e.component, a, this.#e.visibility.isHidden(e.component.id), t);
2226
+ s = Ce(this.#e, e, e.model.dataState, n.value), j(i, e.component, s, this.#e.visibility.isHidden(e.component.id), t, this.#e.opacities.get(e.component.id) ?? 1);
1253
2227
  } catch {
1254
- l.push(D(e, "Material render raised an exception."));
2228
+ u.push(T(e, "Material render raised an exception."));
1255
2229
  continue;
1256
2230
  }
1257
- this.#e.options.root.appendChild(r);
1258
- let s = {
2231
+ (this.#e.subCanvases.containerFor(e.component.id) ?? this.#e.options.root).appendChild(i);
2232
+ let l = {
1259
2233
  type: e.component.type,
1260
- element: r,
1261
- onEvent: i,
1262
- projection: oe(),
2234
+ element: i,
2235
+ onEvent: a,
2236
+ projection: ge(),
1263
2237
  stackOrder: t,
1264
- applied: B(this.#e, e, t),
1265
- appliedModel: a
2238
+ applied: L(this.#e, e, t, n.value),
2239
+ appliedModel: s
1266
2240
  };
1267
- s.projection.dataState = e.model.dataState, s.projection.projectionKey = e.dataSource?.projectionKey, c.set(e.component.id, s);
2241
+ l.projection.dataState = e.model.dataState, l.projection.projectionKey = e.dataSource?.projectionKey, c.set(e.component.id, l);
1268
2242
  }
1269
2243
  for (let [e, t] of this.#e.mounted) c.has(e) || (t.element.removeEventListener("base-screen-material-event", t.onEvent), t.element.remove());
1270
- if (this.#e.options.root.style.position = "relative", this.#e.options.root.style.width = `${n.value.canvas.width}px`, this.#e.options.root.style.height = `${n.value.canvas.height}px`, this.#e.options.mode !== "design" && this.#e.options.root.style.overflow !== "hidden" && (this.#e.options.root.style.overflow = "hidden"), re(this.#e.options.root, n.value.canvas), this.#e.mounted = c, this.#e.candidates = new Map(s.map((e) => [e.component.id, e])), this.#e.document = n.value, this.#e.lastValidatedInput = e, l.length > 0) for (let e of l) this.#e.options.onDiagnostic?.(e);
2244
+ if (this.#e.options.root.style.position = "relative", this.#e.options.root.style.width = `${n.value.canvas.width}px`, this.#e.options.root.style.height = `${n.value.canvas.height}px`, this.#e.options.mode !== "design" && this.#e.options.root.style.overflow !== "hidden" && (this.#e.options.root.style.overflow = "hidden"), b(this.#e.options.root, n.value.canvas), this.#e.subCanvases.syncInert(), this.#e.mounted = c, this.#e.componentStates.retain(new Set(c.keys())), this.#e.candidates = new Map(s.map((e) => [e.component.id, e])), this.#e.document = n.value, this.#e.lastValidatedInput = e, u.length > 0) for (let e of u) this.#e.options.onDiagnostic?.(e);
1271
2245
  return {
1272
2246
  ok: !0,
1273
2247
  value: null,
1274
- diagnostics: [...i.diagnostics, ...l]
2248
+ diagnostics: [...a.diagnostics, ...u]
1275
2249
  };
1276
2250
  }
1277
2251
  setVariables(e) {
1278
- let t = o(e, { maxBytes: 2097152 });
1279
- return !t.ok || t.value === null || Array.isArray(t.value) || typeof t.value != "object" ? E("HOST_DATASET_VARIABLE_INVALID", [], "Runtime variables are invalid.") : (this.#e.variables = t.value, this.#e.dataSuspended = !1, {
2252
+ let t = u(e, { maxBytes: 2097152 });
2253
+ return !t.ok || t.value === null || Array.isArray(t.value) || typeof t.value != "object" ? w("HOST_DATASET_VARIABLE_INVALID", [], "Runtime variables are invalid.") : (this.#e.variables = t.value, this.#e.dataSuspended = !1, {
1280
2254
  ok: !0,
1281
2255
  value: null,
1282
2256
  diagnostics: []
1283
2257
  });
1284
2258
  }
1285
2259
  setInteractive(e) {
1286
- return this.#e.disposed ? E("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.") : this.#e.interactive === e || (this.#e.interactive = e, this.#e.document === void 0) ? {
2260
+ return this.#e.disposed ? w("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.") : this.#e.interactive === e || (this.#e.interactive = e, this.#e.document === void 0) ? {
1287
2261
  ok: !0,
1288
2262
  value: null,
1289
2263
  diagnostics: []
1290
2264
  } : this.render(this.#e.document);
1291
2265
  }
1292
2266
  validateCatalog(e, t) {
1293
- if (this.#e.disposed) return E("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.");
1294
- let n = a(e, this.#e.lastValidatedInput);
2267
+ if (this.#e.disposed) return w("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.");
2268
+ let n = l(e, this.#e.lastValidatedInput);
1295
2269
  if (!n.ok) return n;
1296
2270
  try {
1297
- let e = A(n.value, t, this.#e.options.mode, this.#e.interactive, this.#e.options.contributionIndex, this.#e.dataSources, { entries: /* @__PURE__ */ new Map() }, "fail");
2271
+ let e = be(n.value, t, this.#e.options.mode, this.#e.interactive, this.#e.options.contributionIndex, this.#e.dataSources, { entries: /* @__PURE__ */ new Map() }, "fail");
1298
2272
  return e.ok ? {
1299
2273
  ok: !0,
1300
2274
  value: null,
@@ -1304,17 +2278,17 @@ var Ie = class {
1304
2278
  diagnostics: e.diagnostics
1305
2279
  };
1306
2280
  } catch {
1307
- return E("PLUGIN_CORE_RENDER_FAILED", [], "Catalog validation failed.");
2281
+ return w("PLUGIN_CORE_RENDER_FAILED", [], "Catalog validation failed.");
1308
2282
  }
1309
2283
  }
1310
2284
  setCatalog(e) {
1311
- if (this.#e.disposed) return E("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.");
2285
+ if (this.#e.disposed) return w("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.");
1312
2286
  if (e === this.#e.catalog) return {
1313
2287
  ok: !0,
1314
2288
  value: null,
1315
2289
  diagnostics: []
1316
2290
  };
1317
- let t = ne(this.#e.catalog, e), n = new Set(t.implementationChanged), r = new Set(t.removed);
2291
+ let t = ue(this.#e.catalog, e), n = new Set(t.implementationChanged), r = new Set(t.removed);
1318
2292
  for (let [e, t] of this.#e.mounted) !n.has(t.type) && !r.has(t.type) || (t.element.removeEventListener("base-screen-material-event", t.onEvent), t.element.remove(), this.#e.mounted.delete(e), this.#e.candidates.delete(e));
1319
2293
  let i = new Set(t.unchanged);
1320
2294
  for (let t of this.#e.mounted.values()) {
@@ -1332,10 +2306,25 @@ var Ie = class {
1332
2306
  };
1333
2307
  }
1334
2308
  applyBlueprintVisibilityEffects(e) {
1335
- return this.#e.disposed ? E("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.") : this.#e.visibility.apply(e, this.#e.document, this.#e.mounted);
2309
+ return this.#e.disposed ? w("PLUGIN_CORE_LIFECYCLE_INVALID", [], "Renderer has been disposed.") : this.#e.visibility.apply(e, this.#e.document, this.#e.mounted);
1336
2310
  }
1337
2311
  resetBlueprintVisibility() {
1338
- this.#e.visibility.reset();
2312
+ this.#e.visibility.reset(), this.#e.subCanvases.reset();
2313
+ }
2314
+ applyBlueprintCanvasEffects(e) {
2315
+ this.#e.disposed || this.#e.subCanvases.apply(e);
2316
+ }
2317
+ openCanvas(e, t, n = "host") {
2318
+ return !this.#e.disposed && this.#e.subCanvases.open(e, t, n);
2319
+ }
2320
+ closeCanvas(e, t = "host") {
2321
+ return !this.#e.disposed && this.#e.subCanvases.close(e, t);
2322
+ }
2323
+ announceStartPage() {
2324
+ this.#e.disposed || this.#e.subCanvases.announceStartPage();
2325
+ }
2326
+ isCanvasOpen(e) {
2327
+ return this.#e.subCanvases.isOpen(e);
1339
2328
  }
1340
2329
  suspendData() {
1341
2330
  this.#e.dataSuspended = !0, this.#e.coordinator?.abortAll(), this.#e.dataSources.suspend();
@@ -1347,7 +2336,7 @@ var Ie = class {
1347
2336
  ...n.model,
1348
2337
  dataState: { status: "loading" }
1349
2338
  };
1350
- t.element.model = e, t.appliedModel = e;
2339
+ t.element.model = e, t.appliedModel = e, P(t.element, e);
1351
2340
  }
1352
2341
  }
1353
2342
  }
@@ -1362,32 +2351,25 @@ var Ie = class {
1362
2351
  }
1363
2352
  let i = this.#e.candidates.get(e);
1364
2353
  if (i === void 0) return;
1365
- let a = l(i.component);
2354
+ let a = p(i.component);
1366
2355
  a?.kind === "data-source-field" && this.#e.dataSources.refresh(a.dataSourceId, r);
1367
2356
  }
1368
- refreshConditionalStyles(e) {
1369
- if (this.#e.disposed || this.#e.options.conditionalStylePort === void 0) return;
1370
- let t = e === void 0 ? [...this.#e.mounted.keys()] : [...new Set(e)];
1371
- for (let e of t) {
1372
- let t = this.#e.candidates.get(e), n = this.#e.mounted.get(e);
1373
- if (t !== void 0 && n !== void 0) try {
1374
- ge(this.#e, t, n);
1375
- } catch {
1376
- this.#e.options.onDiagnostic?.(T("PLUGIN_CORE_RENDER_FAILED", [
1377
- "components",
1378
- e,
1379
- "conditionalStyle"
1380
- ], "Conditional style refresh failed for material."));
1381
- }
1382
- }
2357
+ resetComponentStates() {
2358
+ this.#e.componentStates.reset();
2359
+ }
2360
+ applyBlueprintStateEffects(e) {
2361
+ this.#e.disposed || e.length === 0 || this.#r(this.#e.componentStates.apply(e));
2362
+ }
2363
+ readComponentState(e) {
2364
+ if (this.#e.mounted.has(e)) return this.#e.componentStates.read(e);
1383
2365
  }
1384
2366
  prepareDataSources(e, t, n, r) {
1385
2367
  if (this.#e.disposed) return;
1386
- let i = a(e, this.#e.lastValidatedInput);
2368
+ let i = l(e, this.#e.lastValidatedInput);
1387
2369
  i.ok && (this.#e.dataSources.ensure(i.value, t, {
1388
2370
  trigger: n?.trigger ?? "manual",
1389
2371
  traceId: n?.traceId ?? ""
1390
- }, r === void 0 ? {} : { startOnly: r }), this.#t = q(i.value));
2372
+ }, r === void 0 ? {} : { startOnly: r }), this.#t = St(i.value));
1391
2373
  }
1392
2374
  refreshDataSource(e, t) {
1393
2375
  this.#e.dataSources.refresh(e, {
@@ -1407,43 +2389,86 @@ var Ie = class {
1407
2389
  return this.#e.dataSources.evaluate(e);
1408
2390
  }
1409
2391
  clear() {
1410
- this.resetBlueprintVisibility(), this.#e.coordinator?.abortAll(), this.#e.sourceQueries.clear(), this.#e.dataSources.clear(), this.#t = /* @__PURE__ */ new Map();
2392
+ this.resetBlueprintVisibility(), this.#e.coordinator?.abortAll(), this.#e.sourceQueries.clear(), this.#e.dataSources.clear(), this.#t = /* @__PURE__ */ new Map(), this.#n = /* @__PURE__ */ new Map(), this.#e.componentStates.reset();
1411
2393
  for (let e of this.#e.mounted.values()) e.element.removeEventListener("base-screen-material-event", e.onEvent), e.element.remove();
1412
2394
  this.#e.mounted.clear(), this.#e.candidates.clear(), this.#e.document = void 0, this.#e.lastValidatedInput = void 0, this.#e.validationCache.entries.clear();
1413
2395
  }
1414
2396
  dispose() {
1415
- this.#e.disposed || (this.clear(), this.#e.disposed = !0);
2397
+ this.#e.disposed || (this.clear(), this.#e.subCanvases.dispose(), this.#e.disposed = !0);
2398
+ }
2399
+ #r(e) {
2400
+ e.length > 0 && bt(this.#e, e), this.#i();
1416
2401
  }
1417
- #n(e) {
2402
+ #i() {
2403
+ let e = this.#e.document;
2404
+ if (e !== void 0) {
2405
+ this.#e.opacities = A(this.#e, this.#e.candidates, e);
2406
+ for (let [e, t] of this.#e.mounted) N(t.element, this.#e.opacities.get(e) ?? 1);
2407
+ }
2408
+ }
2409
+ #a(e) {
1418
2410
  let t = this.#e.document;
1419
- !this.#e.disposed && t !== void 0 && this.#r(e, t);
2411
+ !this.#e.disposed && t !== void 0 && (this.#o(e, t), this.#r(this.#n.get(e) ?? []));
1420
2412
  let n = this.#e.dataSources.read(e);
1421
2413
  n !== void 0 && n.dataState.status !== "loading" && this.#e.options.onDataSourceSettled?.(e);
1422
2414
  }
1423
- #r(e, t) {
2415
+ #o(e, t) {
1424
2416
  let n = new Map(t.components.map((e) => [e.id, e]));
1425
- for (let t of this.#t.get(e) ?? []) {
1426
- let r = n.get(t), i = this.#e.candidates.get(t), a = this.#e.mounted.get(t);
1427
- if (r === void 0 || i === void 0 || a === void 0) continue;
1428
- let o = j(this.#e.dataSources, r, i.entry, this.#e.options.contributionIndex, ["components", t], (e) => this.#e.options.onDiagnostic?.(e));
1429
- if ("diagnostic" in o) continue;
1430
- let s = {
1431
- ...i,
2417
+ for (let r of this.#t.get(e) ?? []) {
2418
+ let i = n.get(r), a = this.#e.candidates.get(r), o = this.#e.mounted.get(r);
2419
+ if (i === void 0 || a === void 0 || o === void 0) continue;
2420
+ let s = xe(this.#e.dataSources, i, a.entry, this.#e.options.contributionIndex, ["components", r], (e) => this.#e.options.onDiagnostic?.(e));
2421
+ if ("diagnostic" in s) continue;
2422
+ let c = {
2423
+ ...a,
1432
2424
  model: {
1433
- ...i.model,
1434
- dataState: o.dataState
2425
+ ...a.model,
2426
+ dataState: s.dataState
1435
2427
  },
1436
- dataSource: o.dataSource,
1437
- dataEpoch: o.epoch
2428
+ dataSource: s.dataSource,
2429
+ dataEpoch: s.epoch
1438
2430
  };
1439
- this.#e.candidates.set(t, s), o.dataState.status === "ready" && this.#e.dataSources.reportProjection(e, t, o.dataState.value), a.projection.dataState = o.dataState, a.projection.projectionKey = o.dataSource?.projectionKey, z(this.#e, s, a, a.stackOrder);
2431
+ this.#e.candidates.set(r, c), s.dataState.status === "ready" && this.#e.dataSources.reportProjection(e, r, s.dataState.value), o.projection.dataState = s.dataState, o.projection.projectionKey = s.dataSource?.projectionKey, I(this.#e, c, o, o.stackOrder, t, this.#e.opacities.get(r) ?? 1);
1440
2432
  }
1441
2433
  }
1442
2434
  };
1443
- function q(e) {
2435
+ function yt(e, t, n) {
2436
+ if (t === n || t.components === n.components) return;
2437
+ let r = t.components;
2438
+ if (!(!Array.isArray(r) || r.length !== n.components.length)) for (let t = 0; t < r.length; t++) {
2439
+ let i = r[t], a = n.components[t];
2440
+ i !== a && i.id === a.id && e.componentSources.set(a, i);
2441
+ }
2442
+ }
2443
+ function bt(e, t) {
2444
+ let n = e.document;
2445
+ if (n !== void 0) for (let r of t) {
2446
+ let t = e.candidates.get(r), i = e.mounted.get(r);
2447
+ if (t !== void 0 && i !== void 0) try {
2448
+ let a = L(e, t, i.stackOrder, n);
2449
+ if (i.applied !== void 0 && i.applied.stateId === a.stateId) continue;
2450
+ I(e, t, i, i.stackOrder, n, e.opacities.get(r) ?? 1);
2451
+ } catch {
2452
+ e.options.onDiagnostic?.(C("PLUGIN_CORE_RENDER_FAILED", [
2453
+ "components",
2454
+ r,
2455
+ "states"
2456
+ ], "Component state refresh failed for material."));
2457
+ }
2458
+ }
2459
+ }
2460
+ function xt(e) {
2461
+ let t = /* @__PURE__ */ new Map();
2462
+ for (let n of e.components) for (let e of o(n.states).dataSourceIds) {
2463
+ let r = t.get(e);
2464
+ r === void 0 ? t.set(e, [n.id]) : r.push(n.id);
2465
+ }
2466
+ return t;
2467
+ }
2468
+ function St(e) {
1444
2469
  let t = /* @__PURE__ */ new Map();
1445
2470
  for (let n of e.components) {
1446
- let e = l(n);
2471
+ let e = p(n);
1447
2472
  if (e?.kind !== "data-source-field") continue;
1448
2473
  let r = t.get(e.dataSourceId);
1449
2474
  r === void 0 ? t.set(e.dataSourceId, [n.id]) : r.push(n.id);
@@ -1452,9 +2477,9 @@ function q(e) {
1452
2477
  }
1453
2478
  //#endregion
1454
2479
  //#region src/viewer/viewer-blueprint-runtime.ts
1455
- function Le(e, t, n, r) {
2480
+ function Ct(e, t, n, r) {
1456
2481
  let i = [];
1457
- if (C(n) !== C(r.variables)) {
2482
+ if (x(n) !== x(r.variables)) {
1458
2483
  let n = e.setVariables(r.variables);
1459
2484
  if (n.ok) {
1460
2485
  let n = e.render(t, { trigger: "variable" });
@@ -1465,17 +2490,39 @@ function Le(e, t, n, r) {
1465
2490
  let t = e.applyBlueprintVisibilityEffects(r.visibilityEffects);
1466
2491
  t.ok || i.push(...t.diagnostics);
1467
2492
  }
1468
- return i;
2493
+ return r.stateEffects.length > 0 && e.applyBlueprintStateEffects(r.stateEffects), r.canvasEffects.length > 0 && e.applyBlueprintCanvasEffects(r.canvasEffects), i;
1469
2494
  }
1470
2495
  //#endregion
2496
+ //#region src/viewer/viewer-blueprint-timer-scheduler.ts
2497
+ var wt = class {
2498
+ options;
2499
+ #e = /* @__PURE__ */ new Map();
2500
+ constructor(e) {
2501
+ this.options = e;
2502
+ }
2503
+ sync(e) {
2504
+ let t = new Set(e.filter((e) => Number.isInteger(e) && e >= 1 && e <= 86400));
2505
+ for (let [e, n] of this.#e) t.has(e) || (this.#t(n), this.#e.delete(e));
2506
+ let n = this.options.setIntervalFn ?? ((e, t) => setInterval(e, t));
2507
+ for (let e of t) this.#e.has(e) || this.#e.set(e, n(() => this.options.dispatch(e), e * 1e3));
2508
+ }
2509
+ stop() {
2510
+ for (let e of this.#e.values()) this.#t(e);
2511
+ this.#e.clear();
2512
+ }
2513
+ #t(e) {
2514
+ (this.options.clearIntervalFn ?? ((e) => clearInterval(e)))(e);
2515
+ }
2516
+ };
2517
+ //#endregion
1471
2518
  //#region src/viewer/viewer-configuration-guards.ts
1472
- function J(e) {
2519
+ function Tt(e) {
1473
2520
  return typeof e == "object" && !!e && typeof e.get == "function" && typeof e.has == "function" && typeof e.list == "function";
1474
2521
  }
1475
- function Re(e) {
2522
+ function Et(e) {
1476
2523
  return typeof e == "object" && !!e && typeof e.resolve == "function";
1477
2524
  }
1478
- function ze(e) {
2525
+ function Dt(e) {
1479
2526
  if (typeof e != "object" || !e) return !1;
1480
2527
  let t = e;
1481
2528
  return [
@@ -1484,16 +2531,13 @@ function ze(e) {
1484
2531
  "resolve"
1485
2532
  ].every((e) => typeof t[e] == "function");
1486
2533
  }
1487
- function Be(e) {
2534
+ function Ot(e) {
1488
2535
  return typeof e == "object" && !!e && typeof e.getResourceType == "function" && typeof e.hasBlueprintCapability == "function";
1489
2536
  }
1490
- function Ve(e) {
2537
+ function kt(e) {
1491
2538
  return typeof e == "object" && !!e && typeof e.emit == "function";
1492
2539
  }
1493
- function He(e) {
1494
- return typeof e == "object" && !!e && typeof e.resolve == "function";
1495
- }
1496
- function Ue(e) {
2540
+ function At(e) {
1497
2541
  return typeof e == "object" && !!e && typeof e.execute == "function";
1498
2542
  }
1499
2543
  //#endregion
@@ -1511,11 +2555,11 @@ function Y(e) {
1511
2555
  }
1512
2556
  //#endregion
1513
2557
  //#region src/viewer/viewer-configuration.ts
1514
- function We(e) {
1515
- if (!J(e.catalog)) return Y("Viewer catalog 必须是合法的物料目录。");
1516
- if (e.datasetPort !== void 0 && !n(e.datasetPort)) return Y("Viewer dataset port must provide list, describe and query.");
2558
+ function jt(e) {
2559
+ if (!Tt(e.catalog)) return Y("Viewer catalog 必须是合法的物料目录。");
2560
+ if (e.datasetPort !== void 0 && !i(e.datasetPort)) return Y("Viewer dataset port must provide list, describe and query.");
1517
2561
  let t = e.resourceTimeoutMs ?? 15e3;
1518
- return !Number.isInteger(t) || t < 100 || t > 6e4 ? Y("resourceTimeoutMs 必须是 100..60000 的整数。") : e.resourcePort !== void 0 && !Re(e.resourcePort) ? Y("Viewer resource port 必须是含 resolve 的对象。") : e.hostCatalogPort !== void 0 && !ze(e.hostCatalogPort) ? Y("Viewer host catalog port 必须同时提供 list、describe 与 resolve。") : e.conditionalStylePort !== void 0 && !He(e.conditionalStylePort) ? Y("Viewer conditional style port 必须是含 resolve 的对象。") : e.runtimeContributions !== void 0 && !Be(e.runtimeContributions) ? Y("Viewer runtime contributions 必须是含 getResourceType 的对象。") : e.blueprintRuntimePort !== void 0 && !Ve(e.blueprintRuntimePort) ? Y("Viewer blueprint runtime port 必须是含 emit 的对象。") : e.blueprintHostActionPort !== void 0 && !Ue(e.blueprintHostActionPort) ? Y("Viewer blueprint host action port 必须是含 execute 的对象。") : {
2562
+ return !Number.isInteger(t) || t < 100 || t > 6e4 ? Y("resourceTimeoutMs 必须是 100..60000 的整数。") : e.resourcePort !== void 0 && !Et(e.resourcePort) ? Y("Viewer resource port 必须是含 resolve 的对象。") : e.hostCatalogPort !== void 0 && !Dt(e.hostCatalogPort) ? Y("Viewer host catalog port 必须同时提供 list、describe 与 resolve。") : e.runtimeContributions !== void 0 && !Ot(e.runtimeContributions) ? Y("Viewer runtime contributions 必须是含 getResourceType 的对象。") : e.blueprintRuntimePort !== void 0 && !kt(e.blueprintRuntimePort) ? Y("Viewer blueprint runtime port 必须是含 emit 的对象。") : e.blueprintHostActionPort !== void 0 && !At(e.blueprintHostActionPort) ? Y("Viewer blueprint host action port 必须是含 execute 的对象。") : e.initialPageId !== void 0 && typeof e.initialPageId != "string" ? Y("Viewer initialPageId 必须是字符串。") : {
1519
2563
  ok: !0,
1520
2564
  value: {
1521
2565
  ...e,
@@ -1526,7 +2570,7 @@ function We(e) {
1526
2570
  }
1527
2571
  //#endregion
1528
2572
  //#region src/viewer/viewer-data-source-scheduler.ts
1529
- var X = class {
2573
+ var Mt = class {
1530
2574
  host;
1531
2575
  #e = /* @__PURE__ */ new Map();
1532
2576
  #t = !1;
@@ -1535,8 +2579,8 @@ var X = class {
1535
2579
  }
1536
2580
  sync(e) {
1537
2581
  let t = /* @__PURE__ */ new Map();
1538
- for (let n of e === void 0 ? [] : u(e)) {
1539
- let e = Ge(n);
2582
+ for (let n of e === void 0 ? [] : m(e)) {
2583
+ let e = Nt(n);
1540
2584
  e !== void 0 && t.set(n.id, e);
1541
2585
  }
1542
2586
  for (let [e, n] of this.#e) t.get(e) !== n.intervalSeconds && (clearTimeout(n.timer), this.#e.delete(e));
@@ -1566,13 +2610,13 @@ var X = class {
1566
2610
  });
1567
2611
  }
1568
2612
  };
1569
- function Ge(e) {
2613
+ function Nt(e) {
1570
2614
  return e.updatePolicy?.mode === "auto" ? e.updatePolicy.intervalSeconds : void 0;
1571
2615
  }
1572
2616
  //#endregion
1573
2617
  //#region src/viewer/viewer-skeleton.ts
1574
- var Z = "data-viewer-skeleton", Ke = `
1575
- [${Z}] {
2618
+ var X = "data-viewer-skeleton", Pt = `
2619
+ [${X}] {
1576
2620
  display: block;
1577
2621
  box-sizing: border-box;
1578
2622
  width: 100%;
@@ -1591,22 +2635,29 @@ var Z = "data-viewer-skeleton", Ke = `
1591
2635
  }
1592
2636
  }
1593
2637
  @media (prefers-reduced-motion: reduce) {
1594
- [${Z}] {
2638
+ [${X}] {
1595
2639
  animation: none;
1596
2640
  }
1597
2641
  }
1598
2642
  `;
1599
- function qe(e) {
2643
+ function Ft(e) {
1600
2644
  let t = e.createElement("style");
1601
- return t.setAttribute("data-viewer-skeleton-style", "true"), t.textContent = Ke, t;
2645
+ return t.setAttribute("data-viewer-skeleton-style", "true"), t.textContent = Pt, t;
1602
2646
  }
1603
- function Je(e) {
2647
+ function It(e) {
1604
2648
  let t = e.createElement("div");
1605
- return t.setAttribute(Z, "true"), t.setAttribute("aria-hidden", "true"), t;
2649
+ return t.setAttribute(X, "true"), t.setAttribute("aria-hidden", "true"), t;
2650
+ }
2651
+ //#endregion
2652
+ //#region src/viewer/viewer-stale-style.ts
2653
+ var Lt = "\n[data-base-screen-data-stale]::after {\n content: '';\n display: var(--base-screen-stale-indicator-display, block);\n position: absolute;\n top: 4px;\n right: 4px;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--base-screen-stale-indicator-color, #f5a623);\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);\n pointer-events: none;\n z-index: 1;\n}\n", Rt = "data-viewer-stale-style";
2654
+ function zt(e) {
2655
+ let t = e.createElement("style");
2656
+ return t.setAttribute(Rt, "true"), t.textContent = Lt, t;
1606
2657
  }
1607
2658
  //#endregion
1608
2659
  //#region src/viewer/viewer-variable-controller.ts
1609
- var Ye = class {
2660
+ var Bt = class {
1610
2661
  #e;
1611
2662
  #t = /* @__PURE__ */ new Map();
1612
2663
  #n = 0;
@@ -1637,8 +2688,8 @@ var Ye = class {
1637
2688
  if (t === void 0 || n === void 0) return;
1638
2689
  let r = e.variableIds === void 0 ? void 0 : new Set(e.variableIds), i = /* @__PURE__ */ new Set();
1639
2690
  for (let e of t.variables) {
1640
- let t = d(e);
1641
- if (!(r !== void 0 && !r.has(t.id))) for (let e of h(t.value).dataSourceIds) i.add(e);
2691
+ let t = _(e);
2692
+ if (!(r !== void 0 && !r.has(t.id))) for (let e of v(t.value).dataSourceIds) i.add(e);
1642
2693
  }
1643
2694
  for (let t of i) n.refreshDataSource(t, {
1644
2695
  trigger: "variable",
@@ -1683,8 +2734,8 @@ var Ye = class {
1683
2734
  if (!t && e === void 0) {
1684
2735
  let t = this.#e.readBlueprintVariables() ?? o.initialVariables, s = /* @__PURE__ */ new Set();
1685
2736
  for (let e of a.variables) {
1686
- let t = d(e);
1687
- for (let e of h(t.value).dataSourceIds) s.add(e);
2737
+ let t = _(e);
2738
+ for (let e of v(t.value).dataSourceIds) s.add(e);
1688
2739
  }
1689
2740
  if (i.prepareDataSources(a, t, {
1690
2741
  trigger: n,
@@ -1704,7 +2755,7 @@ var Ye = class {
1704
2755
  }
1705
2756
  #u(e, t) {
1706
2757
  for (let n of e.variables) {
1707
- let e = d(n);
2758
+ let e = _(n);
1708
2759
  if (e.value.kind === "data-source-field" && !t.isDataSourceSettled(e.value.dataSourceId)) return !1;
1709
2760
  }
1710
2761
  return !0;
@@ -1729,7 +2780,7 @@ var Ye = class {
1729
2780
  this.#e.emitDiagnostics(s.diagnostics);
1730
2781
  return;
1731
2782
  }
1732
- s.diagnostics.length > 0 && this.#e.emitDiagnostics(s.diagnostics), this.#e.writeBlueprintVariables(c), a || (this.#c = !0), a && o.refreshData(t, n === "polling" ? "polling" : "manual", r);
2783
+ s.diagnostics.length > 0 && this.#e.emitDiagnostics(s.diagnostics), this.#e.writeBlueprintVariables(c), a || (this.#c = !0), a ? o.refreshData(t, n === "polling" ? "polling" : "manual", r) : this.#e.onDocumentRendered?.();
1733
2784
  } finally {
1734
2785
  this.#r = !1, this.#e.onRenderSettled?.();
1735
2786
  }
@@ -1740,7 +2791,7 @@ var Ye = class {
1740
2791
  let t = this.#e.readRenderer(), n = this.#e.readDocument(), r = this.#e.readBlueprintPlan();
1741
2792
  if (t === void 0 || n === void 0 || r === void 0) return;
1742
2793
  let i = this.#p(n, r, t), a = this.#e.readBlueprintVariables();
1743
- if (a !== void 0 && C(a) === C(i)) return;
2794
+ if (a !== void 0 && x(a) === x(i)) return;
1744
2795
  let o = ++this.#n;
1745
2796
  this.#r = !0;
1746
2797
  try {
@@ -1766,7 +2817,7 @@ var Ye = class {
1766
2817
  #p(e, t, n) {
1767
2818
  let r = this.#e.readBlueprintVariables() ?? t.initialVariables, i = {}, a = /* @__PURE__ */ new Map();
1768
2819
  for (let t of e.variables) {
1769
- let e = d(t), o = e.value;
2820
+ let e = _(t), o = e.value;
1770
2821
  if (o.kind === "inline") {
1771
2822
  i[e.id] = r[e.id] ?? o.value;
1772
2823
  continue;
@@ -1788,8 +2839,8 @@ var Ye = class {
1788
2839
  };
1789
2840
  //#endregion
1790
2841
  //#region src/viewer/viewer-variable-handles.ts
1791
- function Q(e) {
1792
- let t = d(e);
2842
+ function Z(e) {
2843
+ let t = _(e);
1793
2844
  if (t.value.kind === "data-source-field") return {
1794
2845
  ok: !1,
1795
2846
  diagnostics: [{
@@ -1800,16 +2851,16 @@ function Q(e) {
1800
2851
  }]
1801
2852
  };
1802
2853
  }
1803
- function Xe(e, t, n) {
2854
+ function Vt(e, t, n) {
1804
2855
  if (e === void 0) return n;
1805
2856
  let r;
1806
2857
  for (let i of e.variables) {
1807
- let e = d(i);
1808
- $(t[e.id], n[e.id]) || Q(i) !== void 0 && (r ??= { ...n }, r[e.id] = t[e.id] ?? null);
2858
+ let e = _(i);
2859
+ Q(t[e.id], n[e.id]) || Z(i) !== void 0 && (r ??= { ...n }, r[e.id] = t[e.id] ?? null);
1809
2860
  }
1810
2861
  return r ?? n;
1811
2862
  }
1812
- var Ze = class {
2863
+ var Ht = class {
1813
2864
  host;
1814
2865
  #e = /* @__PURE__ */ new Map();
1815
2866
  constructor(e) {
@@ -1818,7 +2869,7 @@ var Ze = class {
1818
2869
  get(e) {
1819
2870
  let t = this.host.readDocument()?.variables.find((t) => t.id === e);
1820
2871
  if (t === void 0) return;
1821
- let n = this, r = d(t);
2872
+ let n = this, r = _(t);
1822
2873
  return {
1823
2874
  id: e,
1824
2875
  get value() {
@@ -1826,7 +2877,7 @@ var Ze = class {
1826
2877
  return t === void 0 ? r.value.kind === "inline" ? r.value.value : r.initialValue : t;
1827
2878
  },
1828
2879
  set: (r) => {
1829
- let i = Q(t);
2880
+ let i = Z(t);
1830
2881
  return i === void 0 ? n.host.setValue(e, r) : i;
1831
2882
  },
1832
2883
  onChange: (t) => n.subscribe(e, t)
@@ -1836,7 +2887,7 @@ var Ze = class {
1836
2887
  this.#e.clear();
1837
2888
  }
1838
2889
  notify(e, t) {
1839
- let n = [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((n) => !$(e[n], t[n]));
2890
+ let n = [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((n) => !Q(e[n], t[n]));
1840
2891
  for (let e of n) {
1841
2892
  let n = t[e] ?? null;
1842
2893
  for (let t of this.#e.get(e) ?? []) try {
@@ -1854,12 +2905,12 @@ var Ze = class {
1854
2905
  };
1855
2906
  }
1856
2907
  };
1857
- function $(e, t) {
2908
+ function Q(e, t) {
1858
2909
  return JSON.stringify(e) === JSON.stringify(t);
1859
2910
  }
1860
2911
  //#endregion
1861
2912
  //#region src/viewer/viewer.ts
1862
- var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
2913
+ var Ut = globalThis.HTMLElement ?? class {}, Wt = class extends Ut {
1863
2914
  #e;
1864
2915
  #t;
1865
2916
  #n;
@@ -1870,45 +2921,57 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
1870
2921
  #s;
1871
2922
  #c;
1872
2923
  #l;
1873
- #u;
1874
- #d = 15e3;
2924
+ #u = 15e3;
2925
+ #d = "viewer";
1875
2926
  #f = "viewer";
1876
- #p = "viewer";
2927
+ #p;
1877
2928
  #m;
1878
2929
  #h;
1879
2930
  #g;
1880
2931
  #_;
1881
2932
  #v;
1882
2933
  #y = !1;
1883
- #b;
2934
+ #b = !1;
1884
2935
  #x;
1885
- #S = new Ze({
1886
- readDocument: () => this.#c,
1887
- readVariables: () => this.#u,
2936
+ #S = [];
2937
+ #C = [];
2938
+ #w;
2939
+ #T;
2940
+ #E;
2941
+ #D = new Ht({
2942
+ readDocument: () => this.#s,
2943
+ readVariables: () => this.#l,
1888
2944
  setValue: (e, t) => this.setVariableValue(e, t),
1889
2945
  reportListenerFailure: () => this.emitLifecycleDiagnostic("Variable change listener failed.")
1890
2946
  });
1891
- #C = new Ye({
1892
- readRenderer: () => this.#h,
1893
- readDocument: () => this.#c,
1894
- readBlueprintPlan: () => this.#l,
1895
- readBlueprintVariables: () => this.#u,
2947
+ #O = new Bt({
2948
+ readRenderer: () => this.#m,
2949
+ readDocument: () => this.#s,
2950
+ readBlueprintPlan: () => this.#c,
2951
+ readBlueprintVariables: () => this.#l,
1896
2952
  writeBlueprintVariables: (e) => {
1897
2953
  this.writeBlueprintVariables(e, !0);
1898
2954
  },
1899
2955
  emitDiagnostics: (e) => this.emitDiagnostics(e),
1900
- onRenderSettled: () => this.markRendered()
2956
+ onRenderSettled: () => this.markRendered(),
2957
+ onDocumentRendered: () => this.fireLifecycleReady()
1901
2958
  });
1902
- #w = new X({
1903
- readRenderer: () => this.#h,
1904
- readDocument: () => this.#c
2959
+ #k = new Mt({
2960
+ readRenderer: () => this.#m,
2961
+ readDocument: () => this.#s
1905
2962
  });
2963
+ #A = new wt({ dispatch: (e) => this.handleBlueprintEvent({
2964
+ type: "timer",
2965
+ name: "tick",
2966
+ intervalSeconds: e,
2967
+ payload: null
2968
+ }) });
1906
2969
  configure(e) {
1907
- if (this.#h !== void 0) return Y("Viewer 已初始化,请先 unload 再重新配置。");
1908
- let t = We(e);
2970
+ if (this.#m !== void 0) return Y("Viewer 已初始化,请先 unload 再重新配置。");
2971
+ let t = jt(e);
1909
2972
  if (!t.ok) return t;
1910
2973
  let n = t.value;
1911
- return this.#e = n.catalog, this.#t = n.resourcePort, this.#n = n.datasetPort, this.#r = n.hostCatalogPort, this.#i = n.conditionalStylePort, this.#a = n.runtimeContributions, this.#o = n.blueprintRuntimePort, this.#s = n.blueprintHostActionPort, this.#d = n.resourceTimeoutMs, this.#f = n.instanceId ?? "viewer", this.#p = n.mode ?? "viewer", this.#m = n.observer, this.#b = n.projectId, this.#x = n.documentRevision, this.initialize(), this.#C.start(void 0, !1, !0), this.#w.sync(this.#c), {
2974
+ return this.#e = n.catalog, this.#t = n.resourcePort, this.#n = n.datasetPort, this.#r = n.hostCatalogPort, this.#i = n.runtimeContributions, this.#a = n.blueprintRuntimePort, this.#o = n.blueprintHostActionPort, this.#u = n.resourceTimeoutMs, this.#d = n.instanceId ?? "viewer", this.#f = n.mode ?? "viewer", this.#p = n.observer, this.#T = n.projectId, this.#E = n.documentRevision, this.#w = n.initialPageId, this.initialize(), this.#O.start(void 0, !1, !0), this.#k.sync(this.#s), {
1912
2975
  ok: !0,
1913
2976
  value: null,
1914
2977
  diagnostics: []
@@ -1918,7 +2981,7 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
1918
2981
  return this.#e;
1919
2982
  }
1920
2983
  set catalog(e) {
1921
- if (this.#h !== void 0 && e !== this.#e) {
2984
+ if (this.#m !== void 0 && e !== this.#e) {
1922
2985
  this.emitLifecycleDiagnostic("Catalog cannot change after initialization. Call unload first.");
1923
2986
  return;
1924
2987
  }
@@ -1926,13 +2989,13 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
1926
2989
  }
1927
2990
  refreshCatalog(e) {
1928
2991
  let t = this.#e;
1929
- if (t === void 0 || !J(e)) return Y("Viewer must have a configured catalog before refreshing a valid catalog.");
2992
+ if (t === void 0 || !Tt(e)) return Y("Viewer must have a configured catalog before refreshing a valid catalog.");
1930
2993
  if (t === e) return {
1931
2994
  ok: !0,
1932
2995
  value: null,
1933
2996
  diagnostics: []
1934
2997
  };
1935
- let n = this.#h, r = this.#c;
2998
+ let n = this.#m, r = this.#s;
1936
2999
  if (n === void 0) return r === void 0 ? (this.#e = e, {
1937
3000
  ok: !0,
1938
3001
  value: null,
@@ -1942,7 +3005,7 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
1942
3005
  let t = n.validateCatalog(r, e);
1943
3006
  if (!t.ok) return t;
1944
3007
  }
1945
- let i = this.#C.hasDeferredDocument;
3008
+ let i = this.#O.hasDeferredDocument;
1946
3009
  try {
1947
3010
  let a = n.setCatalog(e);
1948
3011
  if (!a.ok) return a;
@@ -1982,21 +3045,11 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
1982
3045
  get hostCatalogPort() {
1983
3046
  return this.#r;
1984
3047
  }
1985
- get conditionalStylePort() {
1986
- return this.#i;
1987
- }
1988
- set conditionalStylePort(e) {
1989
- if (this.#h !== void 0 && e !== this.#i) {
1990
- this.emitLifecycleDiagnostic("Conditional style port cannot change after initialization. Call unload first.");
1991
- return;
1992
- }
1993
- this.#i = e;
1994
- }
1995
3048
  get resourceTimeoutMs() {
1996
- return this.#d;
3049
+ return this.#u;
1997
3050
  }
1998
3051
  set resourceTimeoutMs(e) {
1999
- if (this.#h !== void 0 && e !== this.#d) {
3052
+ if (this.#m !== void 0 && e !== this.#u) {
2000
3053
  this.emitLifecycleDiagnostic("Resource timeout cannot change after initialization. Call unload first.");
2001
3054
  return;
2002
3055
  }
@@ -2004,73 +3057,73 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
2004
3057
  this.emitLifecycleDiagnostic("Resource timeout must be an integer between 100 and 60000.");
2005
3058
  return;
2006
3059
  }
2007
- this.#d = e;
3060
+ this.#u = e;
2008
3061
  }
2009
3062
  set hostCatalogPort(e) {
2010
- if (this.#h !== void 0 && e !== this.#r) {
3063
+ if (this.#m !== void 0 && e !== this.#r) {
2011
3064
  this.emitLifecycleDiagnostic("Host catalog port cannot change after initialization. Call unload first.");
2012
3065
  return;
2013
3066
  }
2014
3067
  this.#r = e;
2015
3068
  }
2016
3069
  set runtimeContributions(e) {
2017
- if (this.#h !== void 0 && e !== this.#a) {
3070
+ if (this.#m !== void 0 && e !== this.#i) {
2018
3071
  this.emitLifecycleDiagnostic("Runtime contributions cannot change after initialization. Call unload first.");
2019
3072
  return;
2020
3073
  }
2021
- this.#a = e;
3074
+ this.#i = e;
2022
3075
  }
2023
3076
  set resourcePort(e) {
2024
- if (this.#h !== void 0 && e !== this.#t) {
3077
+ if (this.#m !== void 0 && e !== this.#t) {
2025
3078
  this.emitLifecycleDiagnostic("Resource port cannot change after initialization. Call unload first.");
2026
3079
  return;
2027
3080
  }
2028
3081
  this.#t = e;
2029
3082
  }
2030
3083
  get blueprintRuntimePort() {
2031
- return this.#o;
3084
+ return this.#a;
2032
3085
  }
2033
3086
  set blueprintRuntimePort(e) {
2034
- this.#o = e;
3087
+ this.#a = e;
2035
3088
  }
2036
3089
  get blueprintHostActionPort() {
2037
- return this.#s;
3090
+ return this.#o;
2038
3091
  }
2039
3092
  set blueprintHostActionPort(e) {
2040
- this.#s = e;
3093
+ this.#o = e;
2041
3094
  }
2042
3095
  get document() {
2043
- return this.#c;
3096
+ return this.#s;
2044
3097
  }
2045
3098
  set document(e) {
2046
- this.#C.cancel(), this.#w.suspend(), this.#h?.resetBlueprintVisibility(), this.#c = e, this.compileBlueprint(), e !== void 0 && this.ensureSkeleton(), this.initialize(), this.#C.start(void 0, !1, !0), this.#w.resume(), e === void 0 ? this.clearSkeleton() : this.#l === void 0 && this.markRendered();
3099
+ this.#O.cancel(), this.#k.suspend(), this.#m?.resetBlueprintVisibility(), this.#m?.resetComponentStates(), this.#s = e, this.#b = !1, this.compileBlueprint(), e !== void 0 && this.ensureSkeleton(), this.initialize(), this.#O.start(void 0, !1, !0), this.#k.resume(), e === void 0 ? this.clearSkeleton() : this.#c === void 0 && this.markRendered();
2047
3100
  }
2048
3101
  connectedCallback() {
2049
- this.ensureSkeleton(), this.initialize(), this.#C.start(void 0, !1, !0), this.#w.resume();
3102
+ this.ensureSkeleton(), this.initialize(), this.#O.start(void 0, !1, !0), this.#k.resume(), this.syncBlueprintTimers();
2050
3103
  }
2051
3104
  disconnectedCallback() {
2052
- this.#w.suspend(), this.#C.cancel(), this.#h?.clear();
3105
+ this.#k.suspend(), this.#O.cancel(), this.#m?.clear(), this.#A.stop();
2053
3106
  }
2054
3107
  unload() {
2055
- this.#w.dispose(), this.#C.reset(), this.#S.clear(), this.disposeRenderer(), this.#c = void 0, this.compileBlueprint(), this.#y = !1;
3108
+ this.#k.dispose(), this.#O.reset(), this.#D.clear(), this.disposeRenderer(), this.#s = void 0, this.#b = !1, this.compileBlueprint(), this.#y = !1;
2056
3109
  }
2057
3110
  refreshData(e) {
2058
- this.#C.refreshData(e);
3111
+ this.#O.refreshData(e);
2059
3112
  }
2060
3113
  refreshVariables(e) {
2061
- this.#C.refreshVariables(e);
3114
+ this.#O.refreshVariables(e);
2062
3115
  }
2063
- refreshConditionalStyles(e) {
2064
- this.#h?.refreshConditionalStyles(e);
3116
+ readComponentState(e) {
3117
+ return this.#m?.readComponentState(e)?.stateId;
2065
3118
  }
2066
3119
  getVariable(e) {
2067
- return this.#S.get(e);
3120
+ return this.#D.get(e);
2068
3121
  }
2069
3122
  initialize() {
2070
- if (!this.isConnected || this.#e === void 0 || this.#h !== void 0) return;
3123
+ if (!this.isConnected || this.#e === void 0 || this.#m !== void 0) return;
2071
3124
  let e = this.shadowRoot ?? this.attachShadow({ mode: "open" });
2072
- this.#g = this.ownerDocument.createElement("div"), e.appendChild(this.#g), this.#h = K({
2073
- root: this.#g,
3125
+ this.#h = this.ownerDocument.createElement("div"), e.appendChild(this.#h), this.#v = zt(this.ownerDocument), e.appendChild(this.#v), this.#m = _t({
3126
+ root: this.#h,
2074
3127
  catalog: this.#e,
2075
3128
  mode: "viewer",
2076
3129
  interactive: !0,
@@ -2085,42 +3138,82 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
2085
3138
  resourcePort: this.#t,
2086
3139
  ...this.#n === void 0 ? {} : { datasetPort: this.#n },
2087
3140
  ...this.#r === void 0 ? {} : { hostCatalogPort: this.#r },
2088
- onDataSourceSettled: (e) => this.#C.handleDataSourceSettled(e),
2089
- ...this.#i === void 0 ? {} : { conditionalStylePort: this.#i },
2090
- resourceTimeoutMs: this.#d,
2091
- ...this.#a === void 0 ? {} : { contributionIndex: this.#a },
2092
- ...this.#m === void 0 ? {} : { observer: this.#m },
2093
- ...this.#f === void 0 ? {} : { instanceId: this.#f },
2094
- ...this.#p === void 0 ? {} : { executionMode: this.#p },
2095
- ...this.#b === void 0 ? {} : { projectId: this.#b },
2096
- ...this.#x === void 0 ? {} : { documentRevision: this.#x }
3141
+ onDataSourceSettled: (e) => this.#O.handleDataSourceSettled(e),
3142
+ ...this.#w === void 0 ? {} : { initialPageId: this.#w },
3143
+ onCanvasChange: (e) => {
3144
+ this.dispatchEvent(new CustomEvent("base-screen-canvas-change", {
3145
+ bubbles: !0,
3146
+ composed: !0,
3147
+ detail: e
3148
+ })), this.#x === void 0 ? this.handleBlueprintEvent($(e)) : this.#S.push(e);
3149
+ },
3150
+ onComponentStateChange: (e) => {
3151
+ this.dispatchEvent(new CustomEvent("base-screen-component-state-change", {
3152
+ bubbles: !0,
3153
+ composed: !0,
3154
+ detail: e
3155
+ }));
3156
+ let t = Gt(e);
3157
+ this.#x === void 0 ? this.handleBlueprintEvent(t) : this.#C.push(t);
3158
+ },
3159
+ resourceTimeoutMs: this.#u,
3160
+ ...this.#i === void 0 ? {} : { contributionIndex: this.#i },
3161
+ ...this.#p === void 0 ? {} : { observer: this.#p },
3162
+ ...this.#d === void 0 ? {} : { instanceId: this.#d },
3163
+ ...this.#f === void 0 ? {} : { executionMode: this.#f },
3164
+ ...this.#T === void 0 ? {} : { projectId: this.#T },
3165
+ ...this.#E === void 0 ? {} : { documentRevision: this.#E }
2097
3166
  });
2098
3167
  }
2099
3168
  ensureSkeleton() {
2100
- if (this.#y || this.#_ !== void 0) return;
3169
+ if (this.#y || this.#g !== void 0) return;
2101
3170
  let e = this.shadowRoot ?? this.attachShadow({ mode: "open" });
2102
- this.#v === void 0 && (this.#v = qe(this.ownerDocument), e.appendChild(this.#v)), this.#_ = Je(this.ownerDocument), e.appendChild(this.#_), this.setAttribute("data-viewer-state", "loading"), this.setAttribute("aria-busy", "true");
3171
+ this.#_ === void 0 && (this.#_ = Ft(this.ownerDocument), e.appendChild(this.#_)), this.#g = It(this.ownerDocument), e.appendChild(this.#g), this.setAttribute("data-viewer-state", "loading"), this.setAttribute("aria-busy", "true");
2103
3172
  }
2104
3173
  markRendered() {
2105
3174
  this.#y = !0, this.clearSkeleton(), this.isConnected && (this.setAttribute("data-viewer-state", "ready"), this.removeAttribute("aria-busy"));
2106
3175
  }
2107
3176
  clearSkeleton() {
2108
- this.#_?.remove(), this.#_ = void 0, this.#v?.remove(), this.#v = void 0;
3177
+ this.#g?.remove(), this.#g = void 0, this.#_?.remove(), this.#_ = void 0;
2109
3178
  }
2110
3179
  disposeRenderer() {
2111
- this.#h?.dispose(), this.#h = void 0, this.#g?.remove(), this.#g = void 0, this.clearSkeleton();
3180
+ this.#m?.dispose(), this.#m = void 0, this.#h?.remove(), this.#h = void 0, this.#v?.remove(), this.#v = void 0, this.clearSkeleton();
2112
3181
  }
2113
3182
  compileBlueprint() {
2114
- if (this.#c === void 0) {
2115
- this.#l = void 0, this.#u = void 0;
3183
+ if (this.#s === void 0) {
3184
+ this.#c = void 0, this.#l = void 0, this.#A.stop();
2116
3185
  return;
2117
3186
  }
2118
- let e = g(this.#c, this.#a ?? { hasBlueprintCapability: () => !1 });
3187
+ let e = ae(this.#s, this.#i ?? { hasBlueprintCapability: () => !1 });
2119
3188
  if (!e.ok) {
2120
- this.#l = void 0, this.#u = void 0, this.dispatchEvent(new CustomEvent("base-screen-diagnostic", { detail: { diagnostics: e.diagnostics } }));
3189
+ this.#c = void 0, this.#l = void 0, this.#A.stop(), this.dispatchEvent(new CustomEvent("base-screen-diagnostic", { detail: { diagnostics: e.diagnostics } }));
3190
+ return;
3191
+ }
3192
+ this.#c = e.value, this.#l = e.value.initialVariables, this.syncBlueprintTimers();
3193
+ }
3194
+ syncBlueprintTimers() {
3195
+ let e = this.#c;
3196
+ if (e === void 0) {
3197
+ this.#A.stop();
2121
3198
  return;
2122
3199
  }
2123
- this.#l = e.value, this.#u = e.value.initialVariables;
3200
+ this.#A.sync(e.rules.flatMap((e) => e.trigger.type === "timer" ? [e.trigger.intervalSeconds] : []));
3201
+ }
3202
+ fireLifecycleReady() {
3203
+ this.#c === void 0 || this.#b || (this.#b = !0, this.handleBlueprintEvent({
3204
+ type: "lifecycle",
3205
+ name: "ready",
3206
+ payload: null
3207
+ }), this.#m?.announceStartPage());
3208
+ }
3209
+ get currentPage() {
3210
+ return this.#m?.currentPage ?? null;
3211
+ }
3212
+ openCanvas(e, t) {
3213
+ return t !== void 0 && !u(t).ok ? !1 : this.#m?.openCanvas(e, t, "host") ?? !1;
3214
+ }
3215
+ closeCanvas(e) {
3216
+ return this.#m?.closeCanvas(e, "host") ?? !1;
2124
3217
  }
2125
3218
  handleMaterialEvent(e) {
2126
3219
  this.handleBlueprintEvent({
@@ -2131,58 +3224,67 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
2131
3224
  });
2132
3225
  }
2133
3226
  handleBlueprintEvent(e, t = 0) {
2134
- if (this.#l === void 0 || this.#u === void 0) return;
3227
+ if (this.#c === void 0 || this.#l === void 0) return;
2135
3228
  if (t > 32) {
2136
3229
  this.emitLifecycleDiagnostic("Blueprint variable event cycle exceeded its limit.");
2137
3230
  return;
2138
3231
  }
2139
- let n = this.#u, r = _(this.#l, n, e);
3232
+ let n = this.#l, r = oe(this.#c, n, e);
2140
3233
  if (!r.ok) {
2141
3234
  this.emitLifecycleDiagnostic("Blueprint event payload is invalid.");
2142
3235
  return;
2143
3236
  }
2144
- let i = this.#h, a = this.#c, o = {
3237
+ let i = this.#x;
3238
+ this.#x = t;
3239
+ let a = this.#m, o = this.#s, s = {
2145
3240
  ...r.value,
2146
- variables: Xe(a, n, r.value.variables)
2147
- }, s = this.writeBlueprintVariables(o.variables, !1);
2148
- if (i !== void 0 && a !== void 0) {
2149
- let e = Le(i, a, n, o);
3241
+ variables: Vt(o, n, r.value.variables)
3242
+ }, c = this.writeBlueprintVariables(s.variables, !1);
3243
+ if (a !== void 0 && o !== void 0) {
3244
+ let e = Ct(a, o, n, s);
2150
3245
  e.length > 0 && this.emitDiagnostics(e);
2151
3246
  }
2152
- for (let e of r.value.hostEvents) this.#o === void 0 ? this.dispatchEvent(new CustomEvent("base-screen-blueprint-event", { detail: e })) : Promise.resolve(this.#o.emit(e)).catch(() => {
3247
+ this.#x = i;
3248
+ let l = this.#S;
3249
+ this.#S = [];
3250
+ let u = this.#C;
3251
+ this.#C = [];
3252
+ for (let e of r.value.hostEvents) this.#a === void 0 ? this.dispatchEvent(new CustomEvent("base-screen-blueprint-event", { detail: e })) : Promise.resolve(this.#a.emit(e)).catch(() => {
2153
3253
  this.emitLifecycleDiagnostic("Blueprint host event failed.");
2154
3254
  });
2155
- for (let e of r.value.hostActions) this.#s === void 0 ? this.emitLifecycleDiagnostic("Blueprint host action is unavailable.") : Promise.resolve(this.#s.execute(e)).catch(() => {
3255
+ for (let e of r.value.hostActions) this.#o === void 0 ? this.emitLifecycleDiagnostic("Blueprint host action is unavailable.") : Promise.resolve(this.#o.execute(e)).catch(() => {
2156
3256
  this.emitLifecycleDiagnostic("Blueprint host action failed.");
2157
3257
  });
2158
- for (let e of r.value.componentDataRequests) i?.refreshData(e);
2159
- r.value.variableRequests.length > 0 && this.#C.refreshVariables({ variableIds: [...new Set(r.value.variableRequests)] });
2160
- for (let e of s) this.handleBlueprintEvent({
3258
+ for (let e of r.value.componentDataRequests) a?.refreshData(e);
3259
+ r.value.variableRequests.length > 0 && this.#O.refreshVariables({ variableIds: [...new Set(r.value.variableRequests)] });
3260
+ for (let e of c) this.handleBlueprintEvent({
2161
3261
  type: "variable-event",
2162
3262
  variableId: e,
2163
3263
  name: "data-updated",
2164
3264
  payload: r.value.variables[e] ?? null
2165
3265
  }, t + 1);
3266
+ for (let e of l) this.handleBlueprintEvent($(e), t + 1);
3267
+ for (let e of u) this.handleBlueprintEvent(e, t + 1);
2166
3268
  }
2167
3269
  setVariableValue(e, t) {
2168
- let n = o(t);
3270
+ let n = u(t);
2169
3271
  if (!n.ok) return n;
2170
- let r = this.#h, i = this.#c, a = this.#u, s = i?.variables.find((t) => t.id === e);
2171
- if (r === void 0 || i === void 0 || a === void 0 || s === void 0) return Y("Viewer variable is unavailable.");
2172
- let c = Q(s);
2173
- if (c !== void 0) return c;
2174
- if ($(a[e], n.value)) return {
3272
+ let r = this.#m, i = this.#s, a = this.#l, o = i?.variables.find((t) => t.id === e);
3273
+ if (r === void 0 || i === void 0 || a === void 0 || o === void 0) return Y("Viewer variable is unavailable.");
3274
+ let s = Z(o);
3275
+ if (s !== void 0) return s;
3276
+ if (Q(a[e], n.value)) return {
2175
3277
  ok: !0,
2176
3278
  value: null,
2177
3279
  diagnostics: []
2178
3280
  };
2179
- let l = {
3281
+ let c = {
2180
3282
  ...a,
2181
3283
  [e]: n.value
2182
- }, u = r.setVariables(l);
2183
- if (!u.ok) return u;
3284
+ }, l = r.setVariables(c);
3285
+ if (!l.ok) return l;
2184
3286
  let d = r.render(i, { trigger: "variable" });
2185
- return d.ok ? (this.writeBlueprintVariables(l, !1), this.handleBlueprintEvent({
3287
+ return d.ok ? (this.writeBlueprintVariables(c, !1), this.handleBlueprintEvent({
2186
3288
  type: "variable-event",
2187
3289
  variableId: e,
2188
3290
  name: "data-updated",
@@ -2194,9 +3296,9 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
2194
3296
  }) : (r.setVariables(a), d);
2195
3297
  }
2196
3298
  writeBlueprintVariables(e, t = !1) {
2197
- let n = this.#u;
2198
- if (this.#u = e, n === void 0) return [];
2199
- let r = this.#S.notify(n, e);
3299
+ let n = this.#l;
3300
+ if (this.#l = e, n === void 0) return [];
3301
+ let r = this.#D.notify(n, e);
2200
3302
  if (t) for (let t of r) this.handleBlueprintEvent({
2201
3303
  type: "variable-event",
2202
3304
  variableId: t,
@@ -2217,7 +3319,34 @@ var Qe = globalThis.HTMLElement ?? class {}, $e = class extends Qe {
2217
3319
  }]);
2218
3320
  }
2219
3321
  };
3322
+ function $(e) {
3323
+ return e.type === "page-changed" ? {
3324
+ type: "page-changed",
3325
+ name: "page-changed",
3326
+ payload: {
3327
+ from: e.from,
3328
+ to: e.to
3329
+ }
3330
+ } : {
3331
+ type: "canvas-event",
3332
+ canvasId: e.canvasId,
3333
+ name: e.open ? "opened" : "closed",
3334
+ payload: e.open ? e.payload ?? null : null
3335
+ };
3336
+ }
3337
+ function Gt(e) {
3338
+ return {
3339
+ type: "component-state-changed",
3340
+ componentId: e.componentId,
3341
+ name: "state-changed",
3342
+ payload: {
3343
+ from: e.from,
3344
+ to: e.to,
3345
+ cause: e.cause
3346
+ }
3347
+ };
3348
+ }
2220
3349
  //#endregion
2221
- export { $e as BaseScreenViewerElement, K as createBaseScreenRenderer };
3350
+ export { Wt as BaseScreenViewerElement, _t as createBaseScreenRenderer };
2222
3351
 
2223
3352
  //# sourceMappingURL=index.js.map