base-screen 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/_internal/contracts/document/schema.d.ts +7 -0
  2. package/dist/_internal/contracts/document/schema.js +1 -1
  3. package/dist/_internal/contracts/document/validate-value-ref.js +6 -1
  4. package/dist/_internal/contracts/screen-document.schema.json +15 -3
  5. package/dist/_internal/contracts/types/diagnostics.d.ts +1 -1
  6. package/dist/_internal/contracts/types/document.d.ts +3 -1
  7. package/dist/_internal/core/blueprint/runtime-simulate.d.ts +57 -0
  8. package/dist/_internal/core/blueprint/runtime-simulate.js +177 -0
  9. package/dist/_internal/core/blueprint/runtime.d.ts +1 -0
  10. package/dist/_internal/core/blueprint/runtime.js +1 -0
  11. package/dist/_internal/core/commands/apply-collection-commands.d.ts +32 -0
  12. package/dist/_internal/core/commands/apply-collection-commands.js +174 -0
  13. package/dist/_internal/core/commands/apply.js +13 -0
  14. package/dist/_internal/core/commands/parse-command.js +12 -0
  15. package/dist/_internal/core/commands/types.d.ts +29 -1
  16. package/dist/_internal/core/data/data-candidates.d.ts +38 -0
  17. package/dist/_internal/core/data/data-candidates.js +186 -0
  18. package/dist/_internal/core/data/dataset-profile.d.ts +71 -0
  19. package/dist/_internal/core/data/dataset-profile.js +170 -0
  20. package/dist/_internal/core/data/sample-values.d.ts +25 -0
  21. package/dist/_internal/core/data/sample-values.js +45 -0
  22. package/dist/_internal/core/diff/screen-diff.js +6 -0
  23. package/dist/_internal/core/index.d.ts +7 -1
  24. package/dist/_internal/core/index.js +7 -1
  25. package/dist/_internal/core/state/state-preset.d.ts +32 -0
  26. package/dist/_internal/core/state/state-preset.js +37 -0
  27. package/dist/_internal/core/validation/layout-audit.d.ts +17 -0
  28. package/dist/_internal/core/validation/layout-audit.js +228 -0
  29. package/dist/_internal/core/validation/legibility.d.ts +9 -0
  30. package/dist/_internal/core/validation/legibility.js +33 -0
  31. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +6 -1
  32. package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +27 -0
  33. package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +21 -5
  34. package/dist/_internal/engine/browser/dom/dataset/designer-data-section-diff.d.ts +4 -6
  35. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-types.d.ts +2 -0
  36. package/dist/_internal/engine/browser/viewport/designer-canvas-aids-types.d.ts +3 -3
  37. package/dist/_internal/engine/browser/viewport/designer-canvas-aids.d.ts +5 -3
  38. package/dist/_internal/engine/browser/viewport/designer-canvas-measurements.d.ts +2 -14
  39. package/dist/_internal/engine/browser/viewport/designer-guide-overlay-nodes.d.ts +2 -0
  40. package/dist/_internal/engine/browser/viewport/designer-snap-tuning.d.ts +14 -0
  41. package/dist/_internal/engine/common/operations/change/designer-change-events.d.ts +2 -0
  42. package/dist/_internal/engine/common/operations/change/designer-change-proposal.d.ts +35 -2
  43. package/dist/_internal/engine/common/operations/display/designer-target-display.d.ts +2 -2
  44. package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +7 -2
  45. package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +42 -2
  46. package/dist/_internal/engine/{designer-blueprint-workbench-panel-CJ3iZo5v.js → designer-blueprint-workbench-panel-BWSglfAb.js} +210 -290
  47. package/dist/_internal/engine/{designer-dataset-controller-CrfOg2Ys.js → designer-dataset-controller-DdbY4ILC.js} +619 -561
  48. package/dist/_internal/engine/designer-element/api/designer-element-change.d.ts +24 -0
  49. package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +12 -0
  50. package/dist/_internal/engine/designer-element/designer-element-public-api.d.ts +2 -1
  51. package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +1 -1
  52. package/dist/_internal/engine/designer-element/runtime/designer-element-runtime.d.ts +4 -1
  53. package/dist/_internal/engine/designer-element/runtime/designer-element-sample-data.d.ts +23 -0
  54. package/dist/_internal/engine/{designer-field-primitives-KBZuWN_D.js → designer-field-primitives-Crn464Qg.js} +44 -3
  55. package/dist/_internal/engine/{designer-left-panel-groups-dom-N2OHOWjl.js → designer-left-panel-groups-dom-DFdLWxxY.js} +2 -2
  56. package/dist/_internal/engine/{host-resource-selection-xo2mLCD4.js → host-resource-selection-CWrPLVOc.js} +2 -2
  57. package/dist/_internal/engine/index.js +4742 -4360
  58. package/dist/_internal/host-kit/index.d.ts +1 -0
  59. package/dist/_internal/host-kit/index.js +1 -0
  60. package/dist/_internal/host-kit/intent/index.d.ts +16 -0
  61. package/dist/_internal/host-kit/intent/index.js +13 -0
  62. package/dist/_internal/host-kit/intent/intent-behavior.d.ts +59 -0
  63. package/dist/_internal/host-kit/intent/intent-behavior.js +812 -0
  64. package/dist/_internal/host-kit/intent/intent-block.d.ts +59 -0
  65. package/dist/_internal/host-kit/intent/intent-block.js +359 -0
  66. package/dist/_internal/host-kit/intent/intent-catalog.d.ts +105 -0
  67. package/dist/_internal/host-kit/intent/intent-catalog.js +60 -0
  68. package/dist/_internal/host-kit/intent/intent-compile-types.d.ts +222 -0
  69. package/dist/_internal/host-kit/intent/intent-compile-types.js +10 -0
  70. package/dist/_internal/host-kit/intent/intent-compile.d.ts +35 -0
  71. package/dist/_internal/host-kit/intent/intent-compile.js +465 -0
  72. package/dist/_internal/host-kit/intent/intent-data-check.d.ts +50 -0
  73. package/dist/_internal/host-kit/intent/intent-data-check.js +163 -0
  74. package/dist/_internal/host-kit/intent/intent-data-context.d.ts +53 -0
  75. package/dist/_internal/host-kit/intent/intent-data-context.js +200 -0
  76. package/dist/_internal/host-kit/intent/intent-dataset.d.ts +52 -0
  77. package/dist/_internal/host-kit/intent/intent-dataset.js +125 -0
  78. package/dist/_internal/host-kit/intent/intent-format.d.ts +33 -0
  79. package/dist/_internal/host-kit/intent/intent-format.js +94 -0
  80. package/dist/_internal/host-kit/intent/intent-kpi-bind.d.ts +29 -0
  81. package/dist/_internal/host-kit/intent/intent-kpi-bind.js +59 -0
  82. package/dist/_internal/host-kit/intent/intent-layout.d.ts +102 -0
  83. package/dist/_internal/host-kit/intent/intent-layout.js +264 -0
  84. package/dist/_internal/host-kit/intent/intent-parse.d.ts +39 -0
  85. package/dist/_internal/host-kit/intent/intent-parse.js +930 -0
  86. package/dist/_internal/host-kit/intent/intent-prepare.d.ts +52 -0
  87. package/dist/_internal/host-kit/intent/intent-prepare.js +104 -0
  88. package/dist/_internal/host-kit/intent/intent-session.d.ts +202 -0
  89. package/dist/_internal/host-kit/intent/intent-session.js +1001 -0
  90. package/dist/_internal/host-kit/intent/intent-stream.d.ts +28 -0
  91. package/dist/_internal/host-kit/intent/intent-stream.js +183 -0
  92. package/dist/_internal/host-kit/intent/intent-style.d.ts +37 -0
  93. package/dist/_internal/host-kit/intent/intent-style.js +77 -0
  94. package/dist/_internal/host-kit/intent/intent-types.d.ts +234 -0
  95. package/dist/_internal/host-kit/intent/intent-types.js +10 -0
  96. package/dist/_internal/material/chart.js +34 -12
  97. package/dist/_internal/material/table.js +52 -21
  98. package/dist/_internal/plugin-sdk/index.d.ts +6 -0
  99. package/dist/_internal/plugin-sdk/index.js +6 -0
  100. package/dist/_internal/plugin-sdk/material-isolated-csp.d.ts +38 -0
  101. package/dist/_internal/plugin-sdk/material-isolated-csp.js +67 -0
  102. package/dist/_internal/plugin-sdk/material-isolated-runtime.d.ts +22 -0
  103. package/dist/_internal/plugin-sdk/material-isolated-runtime.js +262 -0
  104. package/dist/_internal/plugin-sdk/material-isolated.d.ts +94 -0
  105. package/dist/_internal/plugin-sdk/material-isolated.js +1024 -0
  106. package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +10 -2
  107. package/dist/_internal/plugin-sdk/material-rendered-element.js +71 -7
  108. package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +2 -0
  109. package/dist/_internal/plugin-sdk/material-spec-audit.js +26 -6
  110. package/dist/_internal/plugin-sdk/material-spec.d.ts +20 -0
  111. package/dist/_internal/plugin-sdk/material-spec.js +78 -3
  112. package/dist/_internal/plugin-sdk/material-template-audit.d.ts +12 -0
  113. package/dist/_internal/plugin-sdk/material-template-audit.js +302 -0
  114. package/dist/_internal/plugin-sdk/material-template-expression.d.ts +98 -0
  115. package/dist/_internal/plugin-sdk/material-template-expression.js +549 -0
  116. package/dist/_internal/plugin-sdk/material-template-render.d.ts +32 -0
  117. package/dist/_internal/plugin-sdk/material-template-render.js +579 -0
  118. package/dist/_internal/plugin-sdk/material-template.d.ts +185 -0
  119. package/dist/_internal/plugin-sdk/material-template.js +879 -0
  120. package/dist/auto-register.js +10 -10
  121. package/dist/contracts.js +5 -5
  122. package/dist/contrast-DRPezUIl.js +131 -0
  123. package/dist/contrast-DRPezUIl.js.map +1 -0
  124. package/dist/core.js +156 -136
  125. package/dist/core.js.map +1 -1
  126. package/dist/dataset-profile-Dk6xdtsM.js +261 -0
  127. package/dist/dataset-profile-Dk6xdtsM.js.map +1 -0
  128. package/dist/{designer-3Tb0EIDV.js → designer-CFOvOmLn.js} +2 -2
  129. package/dist/{designer-3Tb0EIDV.js.map → designer-CFOvOmLn.js.map} +1 -1
  130. package/dist/designer-auto-register.js +5 -5
  131. package/dist/{designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js → designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js} +452 -531
  132. package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js.map +1 -0
  133. package/dist/{designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js → designer-dataset-controller-DdbY4ILC-CMdGdGbr.js} +862 -804
  134. package/dist/designer-dataset-controller-DdbY4ILC-CMdGdGbr.js.map +1 -0
  135. package/dist/{designer-field-primitives-KBZuWN_D-B3h4jpYe.js → designer-field-primitives-Crn464Qg-Bi7q8s5J.js} +45 -4
  136. package/dist/designer-field-primitives-Crn464Qg-Bi7q8s5J.js.map +1 -0
  137. package/dist/{designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js → designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js} +4 -4
  138. package/dist/{designer-left-panel-groups-dom-N2OHOWjl-D8CzGwbF.js.map → designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js.map} +1 -1
  139. package/dist/designer.js +5 -5
  140. package/dist/{dist-6GRboBs-.js → dist-B2bW2Tru.js} +4 -4
  141. package/dist/{dist-6GRboBs-.js.map → dist-B2bW2Tru.js.map} +1 -1
  142. package/dist/{dist-BjLjFUy1.js → dist-CHK9BTXX.js} +3833 -3453
  143. package/dist/dist-CHK9BTXX.js.map +1 -0
  144. package/dist/engine.js +5 -5
  145. package/dist/{fragment-Y6YnW6wy.js → fragment-B-oP0Fru.js} +3 -3
  146. package/dist/{fragment-Y6YnW6wy.js.map → fragment-B-oP0Fru.js.map} +1 -1
  147. package/dist/host-kit.js +3963 -187
  148. package/dist/host-kit.js.map +1 -1
  149. package/dist/{host-resource-selection-xo2mLCD4-BR5XCcim.js → host-resource-selection-CWrPLVOc-DPDq3jau.js} +5 -5
  150. package/dist/{host-resource-selection-xo2mLCD4-BR5XCcim.js.map → host-resource-selection-CWrPLVOc-DPDq3jau.js.map} +1 -1
  151. package/dist/index.js +10 -10
  152. package/dist/legibility-CS28ivEz.js +12 -0
  153. package/dist/legibility-CS28ivEz.js.map +1 -0
  154. package/dist/{level-scale-BzUjE31V.js → level-scale-CwHqFEVd.js} +2 -2
  155. package/dist/{level-scale-BzUjE31V.js.map → level-scale-CwHqFEVd.js.map} +1 -1
  156. package/dist/{manager-Ch0RTu_i.js → manager-CeB4Jnr9.js} +3 -3
  157. package/dist/{manager-Ch0RTu_i.js.map → manager-CeB4Jnr9.js.map} +1 -1
  158. package/dist/{material-UbSfiuZq.js → material-DeVkzSoT.js} +2 -2
  159. package/dist/{material-UbSfiuZq.js.map → material-DeVkzSoT.js.map} +1 -1
  160. package/dist/material-auto-register.js +1 -1
  161. package/dist/material.js +2 -2
  162. package/dist/{migrate-document-D3HhCVlZ.js → migrate-document-BM888PtC.js} +2 -2
  163. package/dist/{migrate-document-D3HhCVlZ.js.map → migrate-document-BM888PtC.js.map} +1 -1
  164. package/dist/{parse-AOTE9WnD.js → parse-Ji7kE9ZT.js} +9 -4
  165. package/dist/parse-Ji7kE9ZT.js.map +1 -0
  166. package/dist/{parse-B1OD1teS.js → parse-aZat9tAS.js} +3 -3
  167. package/dist/{parse-B1OD1teS.js.map → parse-aZat9tAS.js.map} +1 -1
  168. package/dist/{parse-parts-BNrpdG5o.js → parse-parts-qzl4suzk.js} +2 -2
  169. package/dist/{parse-parts-BNrpdG5o.js.map → parse-parts-qzl4suzk.js.map} +1 -1
  170. package/dist/{plugin-DHgh9uHh.js → plugin-CstHQ5ws.js} +4 -4
  171. package/dist/{plugin-DHgh9uHh.js.map → plugin-CstHQ5ws.js.map} +1 -1
  172. package/dist/plugin-core.js +2 -2
  173. package/dist/plugin-manager.js +1 -1
  174. package/dist/plugin-package-DWifuHi1.js +4206 -0
  175. package/dist/plugin-package-DWifuHi1.js.map +1 -0
  176. package/dist/{plugin-registration-rsmb4GvS.js → plugin-registration-DTwBvnHX.js} +2 -2
  177. package/dist/{plugin-registration-rsmb4GvS.js.map → plugin-registration-DTwBvnHX.js.map} +1 -1
  178. package/dist/plugin-sdk.js +6 -6
  179. package/dist/{plugins-DGRHgREK.js → plugins-QDL0yIql.js} +2 -2
  180. package/dist/{plugins-DGRHgREK.js.map → plugins-QDL0yIql.js.map} +1 -1
  181. package/dist/plugins.js +8 -8
  182. package/dist/renderer.js +1 -1
  183. package/dist/{runtime-dispatch-BfnRDtMe.js → runtime-dispatch-C0gyIrTv.js} +2 -2
  184. package/dist/{runtime-dispatch-BfnRDtMe.js.map → runtime-dispatch-C0gyIrTv.js.map} +1 -1
  185. package/dist/runtime-simulate-aSYO9yDX.js +147 -0
  186. package/dist/runtime-simulate-aSYO9yDX.js.map +1 -0
  187. package/dist/{src-Bm7u11mN-_0u6cMEw.js → src-Bm7u11mN-Bi1hDVkh.js} +39 -39
  188. package/dist/{src-Bm7u11mN-_0u6cMEw.js.map → src-Bm7u11mN-Bi1hDVkh.js.map} +1 -1
  189. package/dist/state-preset-DtpygJOH.js +22 -0
  190. package/dist/state-preset-DtpygJOH.js.map +1 -0
  191. package/dist/{text-BNksUr5J.js → text-BSTz0pFQ.js} +87 -34
  192. package/dist/text-BSTz0pFQ.js.map +1 -0
  193. package/dist/{value-ref-BG_MV9C-.js → value-ref-XkLuckGV.js} +2 -2
  194. package/dist/{value-ref-BG_MV9C-.js.map → value-ref-XkLuckGV.js.map} +1 -1
  195. package/dist/{viewer-CrJupI8I-D9dVcNw4.js → viewer-CrJupI8I-BJiz1cvW.js} +4 -4
  196. package/dist/{viewer-CrJupI8I-D9dVcNw4.js.map → viewer-CrJupI8I-BJiz1cvW.js.map} +1 -1
  197. package/dist/viewer-auto-register.js +2 -2
  198. package/dist/viewer.js +2 -2
  199. package/dist/{viewport-CiCKeAQH.js → viewport-BNIRWjiT.js} +354 -155
  200. package/dist/viewport-BNIRWjiT.js.map +1 -0
  201. package/package.json +12 -12
  202. package/dist/designer-blueprint-workbench-panel-CJ3iZo5v-BebifP4x.js.map +0 -1
  203. package/dist/designer-dataset-controller-CrfOg2Ys-DhKUEJJe.js.map +0 -1
  204. package/dist/designer-field-primitives-KBZuWN_D-B3h4jpYe.js.map +0 -1
  205. package/dist/dist-BjLjFUy1.js.map +0 -1
  206. package/dist/parse-AOTE9WnD.js.map +0 -1
  207. package/dist/plugin-package-Dr5ro6h6.js +0 -1221
  208. package/dist/plugin-package-Dr5ro6h6.js.map +0 -1
  209. package/dist/text-BNksUr5J.js.map +0 -1
  210. package/dist/viewport-CiCKeAQH.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-document-D3HhCVlZ.js","names":[],"sources":["../../contracts/dist/migration/blueprint-graph-migration.js","../../contracts/dist/migration/migrate-document.js"],"sourcesContent":["import { serializeCanonicalJson } from '../json/canonical.js';\nexport function migrateRelationBlueprint(input) {\n const unchanged = { input, decisions: [] };\n if (!isObject(input) || !isObject(input.blueprint))\n return unchanged;\n const blueprint = input.blueprint;\n if ('nodes' in blueprint || 'edges' in blueprint || !('relations' in blueprint)) {\n return unchanged;\n }\n if (Object.keys(blueprint).some((key) => key !== 'relations' && key !== 'layout')) {\n return unchanged;\n }\n const relations = blueprint.relations;\n if (!Array.isArray(relations))\n return unchanged;\n const nodes = [];\n const nodeIds = new Set();\n const edges = [];\n const edgeIds = new Set();\n const flowKeys = new Set();\n const semanticKeys = new Set();\n const decisions = [];\n const usedIds = new Set();\n for (const relation of relations) {\n if (isObject(relation) && typeof relation.id === 'string')\n usedIds.add(relation.id);\n }\n let conditionCounter = 0;\n let edgeCounter = 0;\n const allocate = (prefix, next) => {\n for (;;) {\n const candidate = `${prefix}-${next()}`;\n if (!usedIds.has(candidate) && !nodeIds.has(candidate)) {\n usedIds.add(candidate);\n return candidate;\n }\n }\n };\n const ensureNode = (id, node) => {\n if (!nodeIds.has(id)) {\n nodeIds.add(id);\n nodes.push(node);\n }\n return id;\n };\n const pushEdge = (edge, key, index) => {\n if (flowKeys.has(key) || semanticKeys.has(key) || edgeIds.has(edge.id)) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation duplicated an earlier relation between the same ports and was dropped.',\n });\n return false;\n }\n (edge.kind === 'semantic' ? semanticKeys : flowKeys).add(key);\n edgeIds.add(edge.id);\n edges.push(edge);\n return true;\n };\n let previousGroupKey;\n let currentCondition;\n for (let index = 0; index < relations.length; index++) {\n const relation = relations[index];\n if (!isObject(relation) || typeof relation.id !== 'string')\n return unchanged;\n if (relation.type === 'semantic') {\n // 旧派生规则跳过语义关系,不打断行为关系的分组。\n const from = componentEndpoint(relation.source);\n const to = componentEndpoint(relation.target);\n if (from === undefined || to === undefined || typeof relation.role !== 'string') {\n return unchanged;\n }\n ensureNode(from, {\n kind: 'component',\n id: from,\n componentId: componentIdOf(relation.source),\n });\n ensureNode(to, { kind: 'component', id: to, componentId: componentIdOf(relation.target) });\n const created = pushEdge({\n kind: 'semantic',\n id: relation.id,\n from: { node: from },\n to: { node: to },\n role: relation.role,\n }, `semantic\\u0000${from}\\u0000${to}`, index);\n if (created) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: 'Semantic relation became a semantic edge.',\n createdEdgeIds: [relation.id],\n });\n }\n continue;\n }\n if (relation.type !== 'behavior')\n return unchanged;\n const source = sourceEndpoint(relation.source);\n if (source === null)\n return unchanged;\n if (source === 'request-state') {\n // 旧派生规则里它自成一组:后续同源同条件的关系不与之前的组合并。\n previousGroupKey = `request-state\\u0000${index}`;\n currentCondition = undefined;\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation was triggered by variable request-state, which the runtime never emits; it was dropped.',\n });\n continue;\n }\n ensureNode(source.endpoint.nodeId, source.node);\n const target = targetEndpoint(relation.target, relation.effect);\n if (target === null)\n return unchanged;\n ensureNode(target.endpoint.nodeId, target.node);\n const condition = relation.condition;\n if (condition !== undefined && !isObject(condition))\n return unchanged;\n const capabilities = relation.requiredCapabilities;\n if (capabilities !== undefined && !Array.isArray(capabilities))\n return unchanged;\n const groupKey = `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${condition === undefined\n ? 'null'\n : serializeCanonicalJson(condition)}`;\n const createdEdgeIds = [];\n let from = source.endpoint;\n if (condition !== undefined) {\n if (previousGroupKey !== groupKey || currentCondition === undefined) {\n currentCondition = allocate('condition', () => ++conditionCounter);\n ensureNode(currentCondition, { kind: 'condition', id: currentCondition, condition });\n const judgeId = allocate('edge', () => ++edgeCounter);\n pushEdge({\n kind: 'flow',\n id: judgeId,\n from: { node: source.endpoint.nodeId, port: source.endpoint.port },\n to: { node: currentCondition, port: 'judge' },\n }, `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${currentCondition}\\u0000judge`, index);\n createdEdgeIds.push(judgeId);\n decisions.push({\n kind: 'blueprint-node',\n path: ['blueprint', 'relations', index, 'condition'],\n action: 'mapped',\n detail: `Relation condition became condition node \"${currentCondition}\".`,\n });\n }\n from = { nodeId: currentCondition, port: 'yes' };\n }\n else {\n currentCondition = undefined;\n }\n previousGroupKey = groupKey;\n const edge = {\n kind: 'flow',\n id: relation.id,\n from: { node: from.nodeId, port: from.port },\n to: { node: target.endpoint.nodeId, port: target.endpoint.port },\n ...target.fields,\n ...(capabilities === undefined ? {} : { requiredCapabilities: capabilities }),\n };\n if (pushEdge(edge, `${from.nodeId}\\u0000${from.port}\\u0000${target.endpoint.nodeId}\\u0000${target.endpoint.port}`, index)) {\n createdEdgeIds.push(relation.id);\n }\n if (createdEdgeIds.length > 0) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: condition === undefined\n ? 'Behavior relation became a flow edge.'\n : 'Conditional behavior relation became a flow edge from a condition node.',\n createdEdgeIds,\n });\n }\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isObject(layout))\n return unchanged;\n const layoutNodes = layout.nodes;\n if (layoutNodes !== undefined && !Array.isArray(layoutNodes))\n return unchanged;\n const kept = [];\n let dropped = 0;\n for (const node of layoutNodes ?? []) {\n if (!isObject(node) || typeof node.id !== 'string')\n return unchanged;\n if (nodeIds.has(node.id))\n kept.push(node);\n else\n dropped += 1;\n }\n if (dropped > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${dropped} layout position(s) for components or variables that no longer have a blueprint node.`,\n });\n }\n migratedLayout = {\n nodes: kept,\n ...(layout.viewport === undefined ? {} : { viewport: layout.viewport }),\n };\n }\n return {\n input: {\n ...input,\n blueprint: {\n nodes,\n edges,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nfunction componentIdOf(value) {\n return value.componentId;\n}\nfunction componentEndpoint(value) {\n if (!isObject(value) || value.kind !== 'component' || typeof value.componentId !== 'string') {\n return undefined;\n }\n return `component:${value.componentId}`;\n}\nfunction sourceEndpoint(source) {\n if (!isObject(source) || !isObject(source.event))\n return null;\n const eventName = source.event.eventName;\n if (source.kind === 'component' && typeof source.componentId === 'string') {\n if (typeof eventName !== 'string')\n return null;\n const id = `component:${source.componentId}`;\n return {\n endpoint: { nodeId: id, port: `event:${eventName}` },\n node: { kind: 'component', id, componentId: source.componentId },\n };\n }\n if (source.kind === 'variable' && typeof source.variableId === 'string') {\n if (eventName === 'request-state')\n return 'request-state';\n if (eventName !== 'data-updated')\n return null;\n const id = `variable:${source.variableId}`;\n return {\n endpoint: { nodeId: id, port: 'data-updated' },\n node: { kind: 'variable', id, variableId: source.variableId },\n };\n }\n if (source.kind === 'lifecycle' && eventName === 'ready') {\n return {\n endpoint: { nodeId: 'lifecycle', port: 'ready' },\n node: { kind: 'lifecycle', id: 'lifecycle' },\n };\n }\n if (source.kind === 'timer' && eventName === 'tick' && Number.isInteger(source.intervalSeconds)) {\n const id = `timer:${source.intervalSeconds}`;\n return {\n endpoint: { nodeId: id, port: 'tick' },\n node: { kind: 'timer', id, intervalSeconds: source.intervalSeconds },\n };\n }\n return null;\n}\nfunction targetEndpoint(target, effect) {\n if (!isObject(target) || !isObject(effect))\n return null;\n if (target.kind === 'component' && typeof target.componentId === 'string') {\n const id = `component:${target.componentId}`;\n const node = { kind: 'component', id, componentId: target.componentId };\n if (effect.type === 'component-visibility') {\n const operation = effect.operation;\n if (operation !== 'show' && operation !== 'hide' && operation !== 'toggle')\n return null;\n return {\n endpoint: { nodeId: id, port: operation },\n node,\n fields: effect.transition === undefined ? {} : { transition: effect.transition },\n };\n }\n if (effect.type === 'request-component-data') {\n return { endpoint: { nodeId: id, port: 'request-data' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'variable' && typeof target.variableId === 'string') {\n const id = `variable:${target.variableId}`;\n const node = { kind: 'variable', id, variableId: target.variableId };\n if (effect.type === 'set-variable' && effect.value !== undefined) {\n return { endpoint: { nodeId: id, port: 'set' }, node, fields: { value: effect.value } };\n }\n if (effect.type === 'request-variable') {\n return { endpoint: { nodeId: id, port: 'request' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'host') {\n const node = { kind: 'host', id: 'host' };\n if (effect.type === 'emit-host-event' && typeof effect.eventName === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `event:${effect.eventName}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n if (effect.type === 'host-action' && typeof effect.actionId === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `action:${effect.actionId}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n }\n return null;\n}\n//# sourceMappingURL=blueprint-graph-migration.js.map","import { parseScreenDocument } from '../document/parse.js';\nimport { migrateRelationBlueprint } from './blueprint-graph-migration.js';\nconst CREATED_ID_PREFIX = 'data-source-';\n/**\n * 把旧形态文档迁移到当前形态,返回新文档与逐条决策。\n *\n * 这是「旧 → 新」的唯一转换路径:读取适配窗口只读,从不产出可写文档。\n * 迁移是幂等的——已经写过 `dataValue` / `dataSources` / 单形态变量的文档原样返回。\n *\n * @param input 待迁移的原始文档(未校验 JSON)。\n */\nexport function migrateScreenDocument(input) {\n const legacy = preprocessLegacyBlueprint(input);\n const graph = migrateRelationBlueprint(legacy.input);\n const preprocessed = {\n input: graph.input,\n decisions: [...legacy.decisions, ...graph.decisions],\n };\n const parsed = parseScreenDocument(preprocessed.input);\n if (!parsed.ok) {\n return {\n ok: false,\n document: undefined,\n decisions: preprocessed.decisions,\n diagnostics: parsed.diagnostics,\n };\n }\n const context = {\n dataSources: [...(parsed.value.dataSources ?? [])],\n usedIds: new Set((parsed.value.dataSources ?? []).map((instance) => instance.id)),\n decisions: [],\n counter: 0,\n };\n const components = parsed.value.components.map((component, index) => migrateComponent(component, index, context));\n const variables = parsed.value.variables.map((entry, index) => migrateVariable(entry, index, context));\n const migrated = parseScreenDocument({\n canvas: parsed.value.canvas,\n components,\n dataSources: context.dataSources,\n variables,\n blueprint: parsed.value.blueprint,\n ...(parsed.value.theme === undefined ? {} : { theme: parsed.value.theme }),\n });\n const decisions = [...preprocessed.decisions, ...context.decisions];\n if (!migrated.ok) {\n return {\n ok: false,\n document: undefined,\n decisions,\n diagnostics: migrated.diagnostics,\n };\n }\n return { ok: true, document: migrated.value, decisions, diagnostics: [] };\n}\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n/**\n * 旧 `blueprint.rules` → relations 的转换路径(ADR-0091);产物随后由\n * `migrateRelationBlueprint` 转成节点图(ADR-0107),因此三种旧形态都能一次迁到当前形态。\n *\n * 只处理结构完整可识别的旧文档;任何无法安全转换的形状都原样返回,让严格解析失败关闭,\n * 不做部分迁移、不静默丢弃规则。\n */\nfunction preprocessLegacyBlueprint(input) {\n if (!isPlainObject(input) || !isPlainObject(input.blueprint)) {\n return { input, decisions: [] };\n }\n const blueprint = input.blueprint;\n if ('relations' in blueprint || !('rules' in blueprint)) {\n return { input, decisions: [] };\n }\n if (Object.keys(blueprint).some((key) => key !== 'rules' && key !== 'layout')) {\n return { input, decisions: [] };\n }\n const rules = blueprint.rules;\n if (!Array.isArray(rules) ||\n !Array.isArray(input.components) ||\n !Array.isArray(input.variables)) {\n return { input, decisions: [] };\n }\n const componentIds = new Set();\n for (const component of input.components) {\n if (!isPlainObject(component) || typeof component.id !== 'string') {\n return { input, decisions: [] };\n }\n componentIds.add(component.id);\n }\n const variableIds = new Set();\n for (const variable of input.variables) {\n if (!isPlainObject(variable) || typeof variable.id !== 'string') {\n return { input, decisions: [] };\n }\n variableIds.add(variable.id);\n }\n const decisions = [];\n const relations = [];\n let relationCounter = 0;\n const allocateRelationId = () => {\n for (;;) {\n relationCounter += 1;\n const candidate = `relation-${relationCounter}`;\n if (!relations.some((relation) => relation.id === candidate))\n return candidate;\n }\n };\n for (let index = 0; index < rules.length; index++) {\n const rule = rules[index];\n if (!isPlainObject(rule))\n return { input, decisions: [] };\n const source = legacyTriggerSource(rule.trigger);\n if (source === null)\n return { input, decisions: [] };\n const actions = rule.actions;\n if (!Array.isArray(actions))\n return { input, decisions: [] };\n const condition = rule.condition;\n if (condition !== undefined && !isPlainObject(condition))\n return { input, decisions: [] };\n const requiredCapabilities = rule.requiredCapabilities;\n if (requiredCapabilities !== undefined && !Array.isArray(requiredCapabilities)) {\n return { input, decisions: [] };\n }\n const createdRelationIds = [];\n for (const action of actions) {\n const relationId = allocateRelationId();\n const relation = legacyActionRelation(action, relationId, source, condition, requiredCapabilities);\n if (relation === null)\n return { input, decisions: [] };\n relations.push(relation);\n createdRelationIds.push(relationId);\n }\n decisions.push({\n kind: 'blueprint-relation',\n path: ['blueprint', 'rules', index],\n action: createdRelationIds.length === 0 ? 'rejected' : 'mapped',\n detail: createdRelationIds.length === 0\n ? 'Rule had no actions and was dropped; it had no runtime behavior.'\n : `Rule was split into ${createdRelationIds.length} behavior relation(s).`,\n ...(createdRelationIds.length === 0 ? {} : { createdRelationIds }),\n });\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isPlainObject(layout))\n return { input, decisions: [] };\n if (Object.keys(layout).some((key) => key !== 'nodes' && key !== 'viewport')) {\n return { input, decisions: [] };\n }\n const nodes = layout.nodes;\n if (nodes !== undefined && !Array.isArray(nodes))\n return { input, decisions: [] };\n if (layout.viewport !== undefined && !isPlainObject(layout.viewport)) {\n return { input, decisions: [] };\n }\n const keptNodes = [];\n let droppedCondition = 0;\n let droppedAction = 0;\n let droppedUnconnected = 0;\n let droppedOther = 0;\n for (const node of nodes ?? []) {\n if (!isPlainObject(node) || typeof node.id !== 'string')\n return { input, decisions: [] };\n const id = node.id;\n if (id.startsWith('component:') && componentIds.has(id.slice('component:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('variable:') && variableIds.has(id.slice('variable:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('condition:')) {\n droppedCondition += 1;\n }\n else if (id.startsWith('action:')) {\n droppedAction += 1;\n }\n else if (id.startsWith('unconnected:')) {\n droppedUnconnected += 1;\n }\n else {\n droppedOther += 1;\n }\n }\n const droppedTotal = droppedCondition + droppedAction + droppedUnconnected + droppedOther;\n if (droppedTotal > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${droppedTotal} layout position(s) with no relation-model equivalent (${droppedCondition} condition, ${droppedAction} action, ${droppedUnconnected} unconnected, ${droppedOther} stale).`,\n });\n }\n const hasViewport = layout.viewport !== undefined;\n if (keptNodes.length > 0 || hasViewport) {\n migratedLayout = {\n ...(keptNodes.length === 0 ? {} : { nodes: keptNodes }),\n ...(hasViewport ? { viewport: layout.viewport } : {}),\n };\n }\n }\n return {\n input: {\n ...input,\n blueprint: {\n relations,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction legacyTriggerSource(trigger) {\n if (!isPlainObject(trigger))\n return null;\n if (trigger.type === 'material-event' &&\n typeof trigger.componentId === 'string' &&\n typeof trigger.eventName === 'string') {\n return {\n kind: 'component',\n componentId: trigger.componentId,\n event: { type: 'material-event', eventName: trigger.eventName },\n };\n }\n if (trigger.type === 'variable-event' &&\n typeof trigger.variableId === 'string' &&\n (trigger.eventName === 'data-updated' || trigger.eventName === 'request-state')) {\n return {\n kind: 'variable',\n variableId: trigger.variableId,\n event: { type: 'variable-event', eventName: trigger.eventName },\n };\n }\n return null;\n}\nfunction legacyActionRelation(action, id, source, condition, requiredCapabilities) {\n if (!isPlainObject(action))\n return null;\n const base = {\n type: 'behavior',\n id,\n source,\n ...(condition === undefined ? {} : { condition }),\n ...(requiredCapabilities === undefined ? {} : { requiredCapabilities }),\n };\n if (action.type === 'component-visibility') {\n if (typeof action.componentId !== 'string' ||\n (action.operation !== 'show' && action.operation !== 'hide' && action.operation !== 'toggle')) {\n return null;\n }\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: {\n type: 'component-visibility',\n operation: action.operation,\n ...(action.transition === undefined ? {} : { transition: action.transition }),\n },\n };\n }\n if (action.type === 'request-component-data') {\n if (typeof action.componentId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: { type: 'request-component-data' },\n };\n }\n if (action.type === 'set-variable') {\n if (typeof action.variableId !== 'string' || action.value === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'set-variable', value: action.value },\n };\n }\n if (action.type === 'request-variable') {\n if (typeof action.variableId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'request-variable' },\n };\n }\n if (action.type === 'emit-host-event') {\n if (typeof action.eventName !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'emit-host-event', eventName: action.eventName, payload: action.payload },\n };\n }\n if (action.type === 'host-action') {\n if (typeof action.actionId !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'host-action', actionId: action.actionId, payload: action.payload },\n };\n }\n return null;\n}\n/** `data-source-<n>`:按实例创建顺序自增、与文档内既有 id 去重、不含时间戳与随机数。 */\nfunction allocateDataSourceId(context) {\n for (;;) {\n context.counter += 1;\n const candidate = `${CREATED_ID_PREFIX}${context.counter}`;\n if (!context.usedIds.has(candidate)) {\n context.usedIds.add(candidate);\n return candidate;\n }\n }\n}\nfunction migrateComponent(component, index, context) {\n if (component.dataValue !== undefined)\n return component;\n const previousSource = component.dataSource;\n if (previousSource === null) {\n return { ...component, dataValue: null };\n }\n const migrated = migrateComponentDataSource(component, previousSource, index, context);\n return migrated;\n}\nfunction migrateComponentDataSource(component, previousSource, index, context) {\n const path = ['components', index, 'dataSource'];\n const base = {\n id: component.id,\n type: component.type,\n name: component.name,\n parentId: component.parentId,\n position: component.position,\n size: component.size,\n rotation: component.rotation,\n zIndex: component.zIndex,\n status: component.status,\n props: component.props,\n style: component.style,\n // 旧字段保留为 null:当前契约仍要求该键存在,它不再是写入口。\n dataSource: null,\n ...(component.states === undefined ? {} : { states: component.states }),\n };\n switch (previousSource.type) {\n case 'static':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Static component value became an inline value reference.',\n });\n return {\n ...base,\n dataValue: { kind: 'inline', value: previousSource.value },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n case 'variable':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Variable component value became a variable value reference.',\n });\n if (previousSource.processorId !== undefined) {\n context.decisions.push({\n kind: 'component-value',\n path: [...path, 'processorId'],\n action: 'rejected',\n detail: 'A component value has no data source instance to own processorId; the field was dropped.',\n });\n }\n return {\n ...base,\n dataValue: { kind: 'variable', variableId: previousSource.variableId },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n default: {\n const dataSourceId = allocateDataSourceId(context);\n const instance = previousSource.type === 'dataset'\n ? {\n id: dataSourceId,\n name: previousSource.datasetId,\n source: { kind: 'dataset', datasetId: previousSource.datasetId },\n params: migrateComponentParams(previousSource.params, index, context),\n }\n : {\n id: dataSourceId,\n name: previousSource.resourceId,\n source: {\n kind: 'host-resource',\n resourceType: previousSource.resourceType,\n resourceId: previousSource.resourceId,\n },\n params: migrateComponentParams(previousSource.params, index, context),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: previousSource.type === 'dataset'\n ? `Dataset component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`\n : `Host resource component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n ...base,\n dataValue: { kind: 'data-source-field', dataSourceId, path: [] },\n dataBinding: previousSource.binding,\n };\n }\n }\n}\nfunction migrateComponentParams(params, componentIndex, context) {\n const migrated = {};\n for (const [name, parameter] of Object.entries(params)) {\n if (parameter.kind === 'literal') {\n migrated[name] = { kind: 'inline', value: parameter.value };\n context.decisions.push({\n kind: 'parameter',\n path: ['components', componentIndex, 'dataSource', 'params', name, 'kind'],\n action: 'renamed',\n detail: 'Literal parameter became an inline value reference.',\n });\n }\n else {\n migrated[name] = { kind: 'variable', variableId: parameter.variableId };\n }\n }\n return migrated;\n}\nfunction migrateVariable(entry, index, context) {\n if (!('type' in entry))\n return entry;\n const path = ['variables', index];\n const withDescription = entry.description === undefined ? {} : { description: entry.description };\n if (entry.type === 'static') {\n context.decisions.push({\n kind: 'variable',\n path: [...path, 'type'],\n action: 'mapped',\n detail: 'Static variable became a variable record with an inline value and controlled false.',\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'inline', value: entry.initialValue },\n controlled: false,\n };\n }\n const dataSourceId = allocateDataSourceId(context);\n const updatePolicy = entry.type === 'data-source' && entry.autoUpdate !== undefined\n ? { mode: 'auto', intervalSeconds: entry.autoUpdate.intervalSeconds }\n : { mode: 'manual' };\n const instance = {\n id: dataSourceId,\n name: entry.name,\n source: entry.type === 'url-query'\n ? { kind: 'url-query', sourceId: entry.sourceId }\n : { kind: 'host-catalog', sourceId: entry.sourceId },\n params: {},\n updatePolicy,\n ...(entry.processorId === undefined ? {} : { processorId: entry.processorId }),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'variable',\n path,\n action: 'mapped',\n detail: entry.type === 'url-query'\n ? `Url query variable became data source instance \"${dataSourceId}\"; processorId moved to the instance.`\n : `Data source variable became data source instance \"${dataSourceId}\"; autoUpdate mapped to updatePolicy and processorId moved to the instance.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'data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AE,aAAa,EAAM,YAAY;CAChG,IAAI,EAAM,SAAS,UAOf,OANA,EAAQ,UAAU,KAAK;EACnB,MAAM;EACN,MAAM,CAAC,GAAG,GAAM,MAAM;EACtB,QAAQ;EACR,QAAQ;CACZ,CAAC,GACM;EACH,IAAI,EAAM;EACV,MAAM,EAAM;EACZ,GAAG;EACH,cAAc,EAAM;EACpB,OAAO;GAAE,MAAM;GAAU,OAAO,EAAM;EAAa;EACnD,YAAY;CAChB;CAEJ,IAAM,IAAe,EAAqB,CAAO,GAC3C,IAAe,EAAM,SAAS,iBAAiB,EAAM,eAAe,KAAA,IACpE;EAAE,MAAM;EAAQ,iBAAiB,EAAM,WAAW;CAAgB,IAClE,EAAE,MAAM,SAAS,GACjB,IAAW;EACb,IAAI;EACJ,MAAM,EAAM;EACZ,QAAQ,EAAM,SAAS,cACjB;GAAE,MAAM;GAAa,UAAU,EAAM;EAAS,IAC9C;GAAE,MAAM;GAAgB,UAAU,EAAM;EAAS;EACvD,QAAQ,CAAC;EACT;EACA,GAAI,EAAM,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,EAAM,YAAY;CAChF;CAWA,OAVA,EAAQ,YAAY,KAAK,CAAQ,GACjC,EAAQ,UAAU,KAAK;EACnB,MAAM;EACN;EACA,QAAQ;EACR,QAAQ,EAAM,SAAS,cACjB,mDAAmD,EAAa,yCAChE,qDAAqD,EAAa;EACxE,qBAAqB;CACzB,CAAC,GACM;EACH,IAAI,EAAM;EACV,MAAM,EAAM;EACZ,GAAG;EACH,cAAc,EAAM;EACpB,OAAO;GAAE,MAAM;GAAqB;GAAc,MAAM,CAAC;EAAE;EAC3D,YAAY,EAAM;CACtB;AACJ"}
1
+ {"version":3,"file":"migrate-document-BM888PtC.js","names":[],"sources":["../../contracts/dist/migration/blueprint-graph-migration.js","../../contracts/dist/migration/migrate-document.js"],"sourcesContent":["import { serializeCanonicalJson } from '../json/canonical.js';\nexport function migrateRelationBlueprint(input) {\n const unchanged = { input, decisions: [] };\n if (!isObject(input) || !isObject(input.blueprint))\n return unchanged;\n const blueprint = input.blueprint;\n if ('nodes' in blueprint || 'edges' in blueprint || !('relations' in blueprint)) {\n return unchanged;\n }\n if (Object.keys(blueprint).some((key) => key !== 'relations' && key !== 'layout')) {\n return unchanged;\n }\n const relations = blueprint.relations;\n if (!Array.isArray(relations))\n return unchanged;\n const nodes = [];\n const nodeIds = new Set();\n const edges = [];\n const edgeIds = new Set();\n const flowKeys = new Set();\n const semanticKeys = new Set();\n const decisions = [];\n const usedIds = new Set();\n for (const relation of relations) {\n if (isObject(relation) && typeof relation.id === 'string')\n usedIds.add(relation.id);\n }\n let conditionCounter = 0;\n let edgeCounter = 0;\n const allocate = (prefix, next) => {\n for (;;) {\n const candidate = `${prefix}-${next()}`;\n if (!usedIds.has(candidate) && !nodeIds.has(candidate)) {\n usedIds.add(candidate);\n return candidate;\n }\n }\n };\n const ensureNode = (id, node) => {\n if (!nodeIds.has(id)) {\n nodeIds.add(id);\n nodes.push(node);\n }\n return id;\n };\n const pushEdge = (edge, key, index) => {\n if (flowKeys.has(key) || semanticKeys.has(key) || edgeIds.has(edge.id)) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation duplicated an earlier relation between the same ports and was dropped.',\n });\n return false;\n }\n (edge.kind === 'semantic' ? semanticKeys : flowKeys).add(key);\n edgeIds.add(edge.id);\n edges.push(edge);\n return true;\n };\n let previousGroupKey;\n let currentCondition;\n for (let index = 0; index < relations.length; index++) {\n const relation = relations[index];\n if (!isObject(relation) || typeof relation.id !== 'string')\n return unchanged;\n if (relation.type === 'semantic') {\n // 旧派生规则跳过语义关系,不打断行为关系的分组。\n const from = componentEndpoint(relation.source);\n const to = componentEndpoint(relation.target);\n if (from === undefined || to === undefined || typeof relation.role !== 'string') {\n return unchanged;\n }\n ensureNode(from, {\n kind: 'component',\n id: from,\n componentId: componentIdOf(relation.source),\n });\n ensureNode(to, { kind: 'component', id: to, componentId: componentIdOf(relation.target) });\n const created = pushEdge({\n kind: 'semantic',\n id: relation.id,\n from: { node: from },\n to: { node: to },\n role: relation.role,\n }, `semantic\\u0000${from}\\u0000${to}`, index);\n if (created) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: 'Semantic relation became a semantic edge.',\n createdEdgeIds: [relation.id],\n });\n }\n continue;\n }\n if (relation.type !== 'behavior')\n return unchanged;\n const source = sourceEndpoint(relation.source);\n if (source === null)\n return unchanged;\n if (source === 'request-state') {\n // 旧派生规则里它自成一组:后续同源同条件的关系不与之前的组合并。\n previousGroupKey = `request-state\\u0000${index}`;\n currentCondition = undefined;\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation was triggered by variable request-state, which the runtime never emits; it was dropped.',\n });\n continue;\n }\n ensureNode(source.endpoint.nodeId, source.node);\n const target = targetEndpoint(relation.target, relation.effect);\n if (target === null)\n return unchanged;\n ensureNode(target.endpoint.nodeId, target.node);\n const condition = relation.condition;\n if (condition !== undefined && !isObject(condition))\n return unchanged;\n const capabilities = relation.requiredCapabilities;\n if (capabilities !== undefined && !Array.isArray(capabilities))\n return unchanged;\n const groupKey = `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${condition === undefined\n ? 'null'\n : serializeCanonicalJson(condition)}`;\n const createdEdgeIds = [];\n let from = source.endpoint;\n if (condition !== undefined) {\n if (previousGroupKey !== groupKey || currentCondition === undefined) {\n currentCondition = allocate('condition', () => ++conditionCounter);\n ensureNode(currentCondition, { kind: 'condition', id: currentCondition, condition });\n const judgeId = allocate('edge', () => ++edgeCounter);\n pushEdge({\n kind: 'flow',\n id: judgeId,\n from: { node: source.endpoint.nodeId, port: source.endpoint.port },\n to: { node: currentCondition, port: 'judge' },\n }, `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${currentCondition}\\u0000judge`, index);\n createdEdgeIds.push(judgeId);\n decisions.push({\n kind: 'blueprint-node',\n path: ['blueprint', 'relations', index, 'condition'],\n action: 'mapped',\n detail: `Relation condition became condition node \"${currentCondition}\".`,\n });\n }\n from = { nodeId: currentCondition, port: 'yes' };\n }\n else {\n currentCondition = undefined;\n }\n previousGroupKey = groupKey;\n const edge = {\n kind: 'flow',\n id: relation.id,\n from: { node: from.nodeId, port: from.port },\n to: { node: target.endpoint.nodeId, port: target.endpoint.port },\n ...target.fields,\n ...(capabilities === undefined ? {} : { requiredCapabilities: capabilities }),\n };\n if (pushEdge(edge, `${from.nodeId}\\u0000${from.port}\\u0000${target.endpoint.nodeId}\\u0000${target.endpoint.port}`, index)) {\n createdEdgeIds.push(relation.id);\n }\n if (createdEdgeIds.length > 0) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: condition === undefined\n ? 'Behavior relation became a flow edge.'\n : 'Conditional behavior relation became a flow edge from a condition node.',\n createdEdgeIds,\n });\n }\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isObject(layout))\n return unchanged;\n const layoutNodes = layout.nodes;\n if (layoutNodes !== undefined && !Array.isArray(layoutNodes))\n return unchanged;\n const kept = [];\n let dropped = 0;\n for (const node of layoutNodes ?? []) {\n if (!isObject(node) || typeof node.id !== 'string')\n return unchanged;\n if (nodeIds.has(node.id))\n kept.push(node);\n else\n dropped += 1;\n }\n if (dropped > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${dropped} layout position(s) for components or variables that no longer have a blueprint node.`,\n });\n }\n migratedLayout = {\n nodes: kept,\n ...(layout.viewport === undefined ? {} : { viewport: layout.viewport }),\n };\n }\n return {\n input: {\n ...input,\n blueprint: {\n nodes,\n edges,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nfunction componentIdOf(value) {\n return value.componentId;\n}\nfunction componentEndpoint(value) {\n if (!isObject(value) || value.kind !== 'component' || typeof value.componentId !== 'string') {\n return undefined;\n }\n return `component:${value.componentId}`;\n}\nfunction sourceEndpoint(source) {\n if (!isObject(source) || !isObject(source.event))\n return null;\n const eventName = source.event.eventName;\n if (source.kind === 'component' && typeof source.componentId === 'string') {\n if (typeof eventName !== 'string')\n return null;\n const id = `component:${source.componentId}`;\n return {\n endpoint: { nodeId: id, port: `event:${eventName}` },\n node: { kind: 'component', id, componentId: source.componentId },\n };\n }\n if (source.kind === 'variable' && typeof source.variableId === 'string') {\n if (eventName === 'request-state')\n return 'request-state';\n if (eventName !== 'data-updated')\n return null;\n const id = `variable:${source.variableId}`;\n return {\n endpoint: { nodeId: id, port: 'data-updated' },\n node: { kind: 'variable', id, variableId: source.variableId },\n };\n }\n if (source.kind === 'lifecycle' && eventName === 'ready') {\n return {\n endpoint: { nodeId: 'lifecycle', port: 'ready' },\n node: { kind: 'lifecycle', id: 'lifecycle' },\n };\n }\n if (source.kind === 'timer' && eventName === 'tick' && Number.isInteger(source.intervalSeconds)) {\n const id = `timer:${source.intervalSeconds}`;\n return {\n endpoint: { nodeId: id, port: 'tick' },\n node: { kind: 'timer', id, intervalSeconds: source.intervalSeconds },\n };\n }\n return null;\n}\nfunction targetEndpoint(target, effect) {\n if (!isObject(target) || !isObject(effect))\n return null;\n if (target.kind === 'component' && typeof target.componentId === 'string') {\n const id = `component:${target.componentId}`;\n const node = { kind: 'component', id, componentId: target.componentId };\n if (effect.type === 'component-visibility') {\n const operation = effect.operation;\n if (operation !== 'show' && operation !== 'hide' && operation !== 'toggle')\n return null;\n return {\n endpoint: { nodeId: id, port: operation },\n node,\n fields: effect.transition === undefined ? {} : { transition: effect.transition },\n };\n }\n if (effect.type === 'request-component-data') {\n return { endpoint: { nodeId: id, port: 'request-data' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'variable' && typeof target.variableId === 'string') {\n const id = `variable:${target.variableId}`;\n const node = { kind: 'variable', id, variableId: target.variableId };\n if (effect.type === 'set-variable' && effect.value !== undefined) {\n return { endpoint: { nodeId: id, port: 'set' }, node, fields: { value: effect.value } };\n }\n if (effect.type === 'request-variable') {\n return { endpoint: { nodeId: id, port: 'request' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'host') {\n const node = { kind: 'host', id: 'host' };\n if (effect.type === 'emit-host-event' && typeof effect.eventName === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `event:${effect.eventName}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n if (effect.type === 'host-action' && typeof effect.actionId === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `action:${effect.actionId}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n }\n return null;\n}\n//# sourceMappingURL=blueprint-graph-migration.js.map","import { parseScreenDocument } from '../document/parse.js';\nimport { migrateRelationBlueprint } from './blueprint-graph-migration.js';\nconst CREATED_ID_PREFIX = 'data-source-';\n/**\n * 把旧形态文档迁移到当前形态,返回新文档与逐条决策。\n *\n * 这是「旧 → 新」的唯一转换路径:读取适配窗口只读,从不产出可写文档。\n * 迁移是幂等的——已经写过 `dataValue` / `dataSources` / 单形态变量的文档原样返回。\n *\n * @param input 待迁移的原始文档(未校验 JSON)。\n */\nexport function migrateScreenDocument(input) {\n const legacy = preprocessLegacyBlueprint(input);\n const graph = migrateRelationBlueprint(legacy.input);\n const preprocessed = {\n input: graph.input,\n decisions: [...legacy.decisions, ...graph.decisions],\n };\n const parsed = parseScreenDocument(preprocessed.input);\n if (!parsed.ok) {\n return {\n ok: false,\n document: undefined,\n decisions: preprocessed.decisions,\n diagnostics: parsed.diagnostics,\n };\n }\n const context = {\n dataSources: [...(parsed.value.dataSources ?? [])],\n usedIds: new Set((parsed.value.dataSources ?? []).map((instance) => instance.id)),\n decisions: [],\n counter: 0,\n };\n const components = parsed.value.components.map((component, index) => migrateComponent(component, index, context));\n const variables = parsed.value.variables.map((entry, index) => migrateVariable(entry, index, context));\n const migrated = parseScreenDocument({\n canvas: parsed.value.canvas,\n components,\n dataSources: context.dataSources,\n variables,\n blueprint: parsed.value.blueprint,\n ...(parsed.value.theme === undefined ? {} : { theme: parsed.value.theme }),\n });\n const decisions = [...preprocessed.decisions, ...context.decisions];\n if (!migrated.ok) {\n return {\n ok: false,\n document: undefined,\n decisions,\n diagnostics: migrated.diagnostics,\n };\n }\n return { ok: true, document: migrated.value, decisions, diagnostics: [] };\n}\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n/**\n * 旧 `blueprint.rules` → relations 的转换路径(ADR-0091);产物随后由\n * `migrateRelationBlueprint` 转成节点图(ADR-0107),因此三种旧形态都能一次迁到当前形态。\n *\n * 只处理结构完整可识别的旧文档;任何无法安全转换的形状都原样返回,让严格解析失败关闭,\n * 不做部分迁移、不静默丢弃规则。\n */\nfunction preprocessLegacyBlueprint(input) {\n if (!isPlainObject(input) || !isPlainObject(input.blueprint)) {\n return { input, decisions: [] };\n }\n const blueprint = input.blueprint;\n if ('relations' in blueprint || !('rules' in blueprint)) {\n return { input, decisions: [] };\n }\n if (Object.keys(blueprint).some((key) => key !== 'rules' && key !== 'layout')) {\n return { input, decisions: [] };\n }\n const rules = blueprint.rules;\n if (!Array.isArray(rules) ||\n !Array.isArray(input.components) ||\n !Array.isArray(input.variables)) {\n return { input, decisions: [] };\n }\n const componentIds = new Set();\n for (const component of input.components) {\n if (!isPlainObject(component) || typeof component.id !== 'string') {\n return { input, decisions: [] };\n }\n componentIds.add(component.id);\n }\n const variableIds = new Set();\n for (const variable of input.variables) {\n if (!isPlainObject(variable) || typeof variable.id !== 'string') {\n return { input, decisions: [] };\n }\n variableIds.add(variable.id);\n }\n const decisions = [];\n const relations = [];\n let relationCounter = 0;\n const allocateRelationId = () => {\n for (;;) {\n relationCounter += 1;\n const candidate = `relation-${relationCounter}`;\n if (!relations.some((relation) => relation.id === candidate))\n return candidate;\n }\n };\n for (let index = 0; index < rules.length; index++) {\n const rule = rules[index];\n if (!isPlainObject(rule))\n return { input, decisions: [] };\n const source = legacyTriggerSource(rule.trigger);\n if (source === null)\n return { input, decisions: [] };\n const actions = rule.actions;\n if (!Array.isArray(actions))\n return { input, decisions: [] };\n const condition = rule.condition;\n if (condition !== undefined && !isPlainObject(condition))\n return { input, decisions: [] };\n const requiredCapabilities = rule.requiredCapabilities;\n if (requiredCapabilities !== undefined && !Array.isArray(requiredCapabilities)) {\n return { input, decisions: [] };\n }\n const createdRelationIds = [];\n for (const action of actions) {\n const relationId = allocateRelationId();\n const relation = legacyActionRelation(action, relationId, source, condition, requiredCapabilities);\n if (relation === null)\n return { input, decisions: [] };\n relations.push(relation);\n createdRelationIds.push(relationId);\n }\n decisions.push({\n kind: 'blueprint-relation',\n path: ['blueprint', 'rules', index],\n action: createdRelationIds.length === 0 ? 'rejected' : 'mapped',\n detail: createdRelationIds.length === 0\n ? 'Rule had no actions and was dropped; it had no runtime behavior.'\n : `Rule was split into ${createdRelationIds.length} behavior relation(s).`,\n ...(createdRelationIds.length === 0 ? {} : { createdRelationIds }),\n });\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isPlainObject(layout))\n return { input, decisions: [] };\n if (Object.keys(layout).some((key) => key !== 'nodes' && key !== 'viewport')) {\n return { input, decisions: [] };\n }\n const nodes = layout.nodes;\n if (nodes !== undefined && !Array.isArray(nodes))\n return { input, decisions: [] };\n if (layout.viewport !== undefined && !isPlainObject(layout.viewport)) {\n return { input, decisions: [] };\n }\n const keptNodes = [];\n let droppedCondition = 0;\n let droppedAction = 0;\n let droppedUnconnected = 0;\n let droppedOther = 0;\n for (const node of nodes ?? []) {\n if (!isPlainObject(node) || typeof node.id !== 'string')\n return { input, decisions: [] };\n const id = node.id;\n if (id.startsWith('component:') && componentIds.has(id.slice('component:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('variable:') && variableIds.has(id.slice('variable:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('condition:')) {\n droppedCondition += 1;\n }\n else if (id.startsWith('action:')) {\n droppedAction += 1;\n }\n else if (id.startsWith('unconnected:')) {\n droppedUnconnected += 1;\n }\n else {\n droppedOther += 1;\n }\n }\n const droppedTotal = droppedCondition + droppedAction + droppedUnconnected + droppedOther;\n if (droppedTotal > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${droppedTotal} layout position(s) with no relation-model equivalent (${droppedCondition} condition, ${droppedAction} action, ${droppedUnconnected} unconnected, ${droppedOther} stale).`,\n });\n }\n const hasViewport = layout.viewport !== undefined;\n if (keptNodes.length > 0 || hasViewport) {\n migratedLayout = {\n ...(keptNodes.length === 0 ? {} : { nodes: keptNodes }),\n ...(hasViewport ? { viewport: layout.viewport } : {}),\n };\n }\n }\n return {\n input: {\n ...input,\n blueprint: {\n relations,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction legacyTriggerSource(trigger) {\n if (!isPlainObject(trigger))\n return null;\n if (trigger.type === 'material-event' &&\n typeof trigger.componentId === 'string' &&\n typeof trigger.eventName === 'string') {\n return {\n kind: 'component',\n componentId: trigger.componentId,\n event: { type: 'material-event', eventName: trigger.eventName },\n };\n }\n if (trigger.type === 'variable-event' &&\n typeof trigger.variableId === 'string' &&\n (trigger.eventName === 'data-updated' || trigger.eventName === 'request-state')) {\n return {\n kind: 'variable',\n variableId: trigger.variableId,\n event: { type: 'variable-event', eventName: trigger.eventName },\n };\n }\n return null;\n}\nfunction legacyActionRelation(action, id, source, condition, requiredCapabilities) {\n if (!isPlainObject(action))\n return null;\n const base = {\n type: 'behavior',\n id,\n source,\n ...(condition === undefined ? {} : { condition }),\n ...(requiredCapabilities === undefined ? {} : { requiredCapabilities }),\n };\n if (action.type === 'component-visibility') {\n if (typeof action.componentId !== 'string' ||\n (action.operation !== 'show' && action.operation !== 'hide' && action.operation !== 'toggle')) {\n return null;\n }\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: {\n type: 'component-visibility',\n operation: action.operation,\n ...(action.transition === undefined ? {} : { transition: action.transition }),\n },\n };\n }\n if (action.type === 'request-component-data') {\n if (typeof action.componentId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: { type: 'request-component-data' },\n };\n }\n if (action.type === 'set-variable') {\n if (typeof action.variableId !== 'string' || action.value === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'set-variable', value: action.value },\n };\n }\n if (action.type === 'request-variable') {\n if (typeof action.variableId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'request-variable' },\n };\n }\n if (action.type === 'emit-host-event') {\n if (typeof action.eventName !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'emit-host-event', eventName: action.eventName, payload: action.payload },\n };\n }\n if (action.type === 'host-action') {\n if (typeof action.actionId !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'host-action', actionId: action.actionId, payload: action.payload },\n };\n }\n return null;\n}\n/** `data-source-<n>`:按实例创建顺序自增、与文档内既有 id 去重、不含时间戳与随机数。 */\nfunction allocateDataSourceId(context) {\n for (;;) {\n context.counter += 1;\n const candidate = `${CREATED_ID_PREFIX}${context.counter}`;\n if (!context.usedIds.has(candidate)) {\n context.usedIds.add(candidate);\n return candidate;\n }\n }\n}\nfunction migrateComponent(component, index, context) {\n if (component.dataValue !== undefined)\n return component;\n const previousSource = component.dataSource;\n if (previousSource === null) {\n return { ...component, dataValue: null };\n }\n const migrated = migrateComponentDataSource(component, previousSource, index, context);\n return migrated;\n}\nfunction migrateComponentDataSource(component, previousSource, index, context) {\n const path = ['components', index, 'dataSource'];\n const base = {\n id: component.id,\n type: component.type,\n name: component.name,\n parentId: component.parentId,\n position: component.position,\n size: component.size,\n rotation: component.rotation,\n zIndex: component.zIndex,\n status: component.status,\n props: component.props,\n style: component.style,\n // 旧字段保留为 null:当前契约仍要求该键存在,它不再是写入口。\n dataSource: null,\n ...(component.states === undefined ? {} : { states: component.states }),\n };\n switch (previousSource.type) {\n case 'static':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Static component value became an inline value reference.',\n });\n return {\n ...base,\n dataValue: { kind: 'inline', value: previousSource.value },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n case 'variable':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Variable component value became a variable value reference.',\n });\n if (previousSource.processorId !== undefined) {\n context.decisions.push({\n kind: 'component-value',\n path: [...path, 'processorId'],\n action: 'rejected',\n detail: 'A component value has no data source instance to own processorId; the field was dropped.',\n });\n }\n return {\n ...base,\n dataValue: { kind: 'variable', variableId: previousSource.variableId },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n default: {\n const dataSourceId = allocateDataSourceId(context);\n const instance = previousSource.type === 'dataset'\n ? {\n id: dataSourceId,\n name: previousSource.datasetId,\n source: { kind: 'dataset', datasetId: previousSource.datasetId },\n params: migrateComponentParams(previousSource.params, index, context),\n }\n : {\n id: dataSourceId,\n name: previousSource.resourceId,\n source: {\n kind: 'host-resource',\n resourceType: previousSource.resourceType,\n resourceId: previousSource.resourceId,\n },\n params: migrateComponentParams(previousSource.params, index, context),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: previousSource.type === 'dataset'\n ? `Dataset component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`\n : `Host resource component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n ...base,\n dataValue: { kind: 'data-source-field', dataSourceId, path: [] },\n dataBinding: previousSource.binding,\n };\n }\n }\n}\nfunction migrateComponentParams(params, componentIndex, context) {\n const migrated = {};\n for (const [name, parameter] of Object.entries(params)) {\n if (parameter.kind === 'literal') {\n migrated[name] = { kind: 'inline', value: parameter.value };\n context.decisions.push({\n kind: 'parameter',\n path: ['components', componentIndex, 'dataSource', 'params', name, 'kind'],\n action: 'renamed',\n detail: 'Literal parameter became an inline value reference.',\n });\n }\n else {\n migrated[name] = { kind: 'variable', variableId: parameter.variableId };\n }\n }\n return migrated;\n}\nfunction migrateVariable(entry, index, context) {\n if (!('type' in entry))\n return entry;\n const path = ['variables', index];\n const withDescription = entry.description === undefined ? {} : { description: entry.description };\n if (entry.type === 'static') {\n context.decisions.push({\n kind: 'variable',\n path: [...path, 'type'],\n action: 'mapped',\n detail: 'Static variable became a variable record with an inline value and controlled false.',\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'inline', value: entry.initialValue },\n controlled: false,\n };\n }\n const dataSourceId = allocateDataSourceId(context);\n const updatePolicy = entry.type === 'data-source' && entry.autoUpdate !== undefined\n ? { mode: 'auto', intervalSeconds: entry.autoUpdate.intervalSeconds }\n : { mode: 'manual' };\n const instance = {\n id: dataSourceId,\n name: entry.name,\n source: entry.type === 'url-query'\n ? { kind: 'url-query', sourceId: entry.sourceId }\n : { kind: 'host-catalog', sourceId: entry.sourceId },\n params: {},\n updatePolicy,\n ...(entry.processorId === undefined ? {} : { processorId: entry.processorId }),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'variable',\n path,\n action: 'mapped',\n detail: entry.type === 'url-query'\n ? `Url query variable became data source instance \"${dataSourceId}\"; processorId moved to the instance.`\n : `Data source variable became data source instance \"${dataSourceId}\"; autoUpdate mapped to updatePolicy and processorId moved to the instance.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: {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AAI,EAAE,aAAa,EAAM,YAAY;CAChG,IAAI,EAAM,SAAS,UAOf,OANA,EAAQ,UAAU,KAAK;EACnB,MAAM;EACN,MAAM,CAAC,GAAG,GAAM,MAAM;EACtB,QAAQ;EACR,QAAQ;CACZ,CAAC,GACM;EACH,IAAI,EAAM;EACV,MAAM,EAAM;EACZ,GAAG;EACH,cAAc,EAAM;EACpB,OAAO;GAAE,MAAM;GAAU,OAAO,EAAM;EAAa;EACnD,YAAY;CAChB;CAEJ,IAAM,IAAe,EAAqB,CAAO,GAC3C,IAAe,EAAM,SAAS,iBAAiB,EAAM,eAAe,KAAA,IACpE;EAAE,MAAM;EAAQ,iBAAiB,EAAM,WAAW;CAAgB,IAClE,EAAE,MAAM,SAAS,GACjB,IAAW;EACb,IAAI;EACJ,MAAM,EAAM;EACZ,QAAQ,EAAM,SAAS,cACjB;GAAE,MAAM;GAAa,UAAU,EAAM;EAAS,IAC9C;GAAE,MAAM;GAAgB,UAAU,EAAM;EAAS;EACvD,QAAQ,CAAC;EACT;EACA,GAAI,EAAM,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,EAAM,YAAY;CAChF;CAWA,OAVA,EAAQ,YAAY,KAAK,CAAQ,GACjC,EAAQ,UAAU,KAAK;EACnB,MAAM;EACN;EACA,QAAQ;EACR,QAAQ,EAAM,SAAS,cACjB,mDAAmD,EAAa,yCAChE,qDAAqD,EAAa;EACxE,qBAAqB;CACzB,CAAC,GACM;EACH,IAAI,EAAM;EACV,MAAM,EAAM;EACZ,GAAG;EACH,cAAc,EAAM;EACpB,OAAO;GAAE,MAAM;GAAqB;GAAc,MAAM,CAAC;EAAE;EAC3D,YAAY,EAAM;CACtB;AACJ"}
@@ -476,7 +476,8 @@ var P = l.string().refine((e) => [...e].length <= S, { message: `Description mus
476
476
  }), R = l.strictObject({ fields: l.record(l.string().min(1).max(128), l.array(l.string().min(1).max(256)).min(1).max(256)) }), z = l.string().min(1).max(256).refine((e) => !N.test(e), { message: "Identifier must not contain control characters." }), B = l.discriminatedUnion("kind", [
477
477
  l.strictObject({
478
478
  kind: l.literal("inline"),
479
- value: l.any()
479
+ value: l.any(),
480
+ sample: l.literal(!0).optional()
480
481
  }),
481
482
  l.strictObject({
482
483
  kind: l.literal("variable"),
@@ -1609,7 +1610,11 @@ function Bn(e, t, n, r) {
1609
1610
  }
1610
1611
  //#endregion
1611
1612
  //#region ../contracts/dist/document/validate-value-ref.js
1612
- var Vn = new RegExp(O), Hn = new RegExp(A), Un = /* @__PURE__ */ new Set(["kind", "value"]), Wn = /* @__PURE__ */ new Set(["kind", "variableId"]), Gn = /* @__PURE__ */ new Set([
1613
+ var Vn = new RegExp(O), Hn = new RegExp(A), Un = /* @__PURE__ */ new Set([
1614
+ "kind",
1615
+ "value",
1616
+ "sample"
1617
+ ]), Wn = /* @__PURE__ */ new Set(["kind", "variableId"]), Gn = /* @__PURE__ */ new Set([
1613
1618
  "kind",
1614
1619
  "dataSourceId",
1615
1620
  "path"
@@ -1634,7 +1639,7 @@ function Yn(e, t, n, r, i, a, o = $) {
1634
1639
  }
1635
1640
  }
1636
1641
  function Xn(e, t, n, r, i) {
1637
- return Y(e, Un, n(t), r, i) ? "value" in e || (r.add($, n([...t, "value"]), i, "Inline value reference requires a value field."), !1) : !1;
1642
+ return Y(e, Un, n(t), r, i) ? "value" in e ? "sample" in e && e.sample !== !0 ? (r.add($, n([...t, "sample"]), i, "Inline value reference sample marker must be true when present."), !1) : !0 : (r.add($, n([...t, "value"]), i, "Inline value reference requires a value field."), !1) : !1;
1638
1643
  }
1639
1644
  function Zn(e, t, n, r, i) {
1640
1645
  return Y(e, Wn, n(t), r, i) ? typeof e.variableId != "string" || !Vn.test(e.variableId) ? (r.add($, n([...t, "variableId"]), i, "Value reference variableId must be a component-style identifier."), !1) : !0 : !1;
@@ -2305,4 +2310,4 @@ function xi(e, t) {
2305
2310
  //#endregion
2306
2311
  export { re as $, ze as A, d as At, Ke as B, st as C, h as Ct, Me as D, ye as Dt, Ie as E, me as Et, Pe as F, Ye as G, w as H, T as I, tt as J, We as K, et as L, Ue as M, p as Mt, Le as N, f as Nt, Ve as O, he as Ot, Re as P, ie as Q, Je as R, ot as S, ve as St, Fe as T, pe as Tt, Ge as U, Xe as V, Ze as W, xe as X, ge as Y, ae as Z, k as _, te as _t, Lr as a, we as at, ft as b, b as bt, Nn as c, De as ct, $t as d, de as dt, ce as et, Qt as f, y as ft, A as g, ke as gt, O as h, Oe as ht, si as i, Ce as it, Be as j, u as jt, He as k, _e as kt, on as l, v as lt, G as m, Ae as mt, vi as n, se as nt, wr as o, Te as ot, tn as p, _ as pt, Qe as q, yi as r, Se as rt, Cr as s, Ee as st, xi as t, oe as tt, an as u, fe as ut, Zt as v, g as vt, Ne as w, ee as wt, at as x, x as xt, dt as y, be as yt, qe as z };
2307
2312
 
2308
- //# sourceMappingURL=parse-AOTE9WnD.js.map
2313
+ //# sourceMappingURL=parse-Ji7kE9ZT.js.map