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