@almadar/std 16.253.0 → 16.255.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 (456) hide show
  1. package/behaviors/lolo/agent/atoms/std-agent-pool.lolo +355 -0
  2. package/behaviors/lolo/agent/evals/eval-agent-builder.lolo +159 -0
  3. package/behaviors/lolo/agent/organisms/std-agent-builder.lolo +321 -26
  4. package/behaviors/lolo-behavior-contracts.json +1 -1
  5. package/behaviors/registry/agent/atoms/std-agent-context.orb +1 -1
  6. package/behaviors/registry/agent/atoms/std-agent-memory.orb +1 -1
  7. package/behaviors/registry/agent/atoms/std-agent-planner.orb +1 -1
  8. package/behaviors/registry/agent/atoms/std-agent-pool.orb +1 -0
  9. package/behaviors/registry/agent/atoms/std-agent-proposal.orb +1 -1
  10. package/behaviors/registry/agent/atoms/std-agent-session.orb +1 -1
  11. package/behaviors/registry/agent/atoms/std-agent-suggestions.orb +1 -1
  12. package/behaviors/registry/agent/atoms/std-agent-tool-call.orb +1 -1
  13. package/behaviors/registry/agent/atoms/std-agent-tool-loop.orb +1 -1
  14. package/behaviors/registry/agent/atoms/std-agent-trace.orb +1 -1
  15. package/behaviors/registry/agent/evals/eval-agent-builder.orb +1 -0
  16. package/behaviors/registry/agent/organisms/std-agent-assistant.orb +1 -1
  17. package/behaviors/registry/agent/organisms/std-agent-builder.orb +1 -1
  18. package/behaviors/registry/infra/atoms/std-analytics.orb +1 -1
  19. package/behaviors/registry/infra/atoms/std-approval-gate.orb +1 -1
  20. package/behaviors/registry/infra/atoms/std-audit-capture.orb +1 -1
  21. package/behaviors/registry/infra/atoms/std-cache-aside.orb +1 -1
  22. package/behaviors/registry/infra/atoms/std-calendar-sync.orb +1 -1
  23. package/behaviors/registry/infra/atoms/std-cascade-on-delete.orb +1 -1
  24. package/behaviors/registry/infra/atoms/std-circuit-breaker.orb +1 -1
  25. package/behaviors/registry/infra/atoms/std-cross-reference.orb +1 -1
  26. package/behaviors/registry/infra/atoms/std-data-erasure.orb +1 -1
  27. package/behaviors/registry/infra/atoms/std-data-import.orb +1 -1
  28. package/behaviors/registry/infra/atoms/std-global-search.orb +1 -1
  29. package/behaviors/registry/infra/atoms/std-knowledge-loop.orb +1 -1
  30. package/behaviors/registry/infra/atoms/std-lifecycle.orb +1 -1
  31. package/behaviors/registry/infra/atoms/std-migration-job.orb +1 -1
  32. package/behaviors/registry/infra/atoms/std-mod-queue.orb +1 -1
  33. package/behaviors/registry/infra/atoms/std-notification-center.orb +1 -1
  34. package/behaviors/registry/infra/atoms/std-notification-preferences.orb +1 -1
  35. package/behaviors/registry/infra/atoms/std-notify-on-event.orb +1 -1
  36. package/behaviors/registry/infra/atoms/std-page-search.orb +1 -1
  37. package/behaviors/registry/infra/atoms/std-page-watch.orb +1 -1
  38. package/behaviors/registry/infra/atoms/std-permission-matrix.orb +1 -1
  39. package/behaviors/registry/infra/atoms/std-rate-limiter.orb +1 -1
  40. package/behaviors/registry/infra/atoms/std-reminder-scheduler.orb +1 -1
  41. package/behaviors/registry/infra/atoms/std-review-cycle.orb +1 -1
  42. package/behaviors/registry/infra/atoms/std-row-access-control.orb +1 -1
  43. package/behaviors/registry/infra/atoms/std-status-lifecycle.orb +1 -1
  44. package/behaviors/registry/infra/organisms/std-status-lifecycle-control.orb +1 -1
  45. package/behaviors/registry/ml/atoms/std-data-collector.orb +1 -1
  46. package/behaviors/registry/ml/atoms/std-graph-builder.orb +1 -1
  47. package/behaviors/registry/ml/atoms/std-ml-classify.orb +1 -1
  48. package/behaviors/registry/ml/atoms/std-ml-exact-check.orb +1 -1
  49. package/behaviors/registry/ml/atoms/std-ml-infer.orb +1 -1
  50. package/behaviors/registry/ml/atoms/std-ml-label-capture.orb +1 -1
  51. package/behaviors/registry/ml/atoms/std-ml-lookup.orb +1 -1
  52. package/behaviors/registry/ml/atoms/std-ml-posterior.orb +1 -1
  53. package/behaviors/registry/ml/atoms/std-ml-similarity.orb +1 -1
  54. package/behaviors/registry/ml/atoms/std-tokenizer.orb +1 -1
  55. package/behaviors/registry/ml/atoms/std-weight-validator.orb +1 -1
  56. package/behaviors/registry/ml/organisms/std-escalating-decision.orb +1 -1
  57. package/behaviors/registry/ml/organisms/std-knowledge-tracing.orb +1 -1
  58. package/behaviors/registry/ui/avl/atoms/std-avl-cosmic-zoom.orb +1 -1
  59. package/behaviors/registry/ui/avl/atoms/ui-avl-glyph.orb +1 -1
  60. package/behaviors/registry/ui/avl/atoms/ui-avl-state-machine.orb +1 -1
  61. package/behaviors/registry/ui/avl/atoms/ui-avl-transition-detail.orb +1 -1
  62. package/behaviors/registry/ui/avl/atoms/ui-avl-transition-explainer.orb +1 -1
  63. package/behaviors/registry/ui/avl/atoms/ui-behavior-view.orb +1 -1
  64. package/behaviors/registry/ui/avl/atoms/ui-module-card.orb +1 -1
  65. package/behaviors/registry/ui/avl/organisms/ui-flow-canvas.orb +1 -1
  66. package/behaviors/registry/ui/avl/organisms/ui-layers-panel.orb +1 -1
  67. package/behaviors/registry/ui/avl/organisms/ui-orb-inspector.orb +1 -1
  68. package/behaviors/registry/ui/core/atoms/std-app-layout.orb +1 -1
  69. package/behaviors/registry/ui/core/atoms/std-app-search.orb +1 -1
  70. package/behaviors/registry/ui/core/atoms/std-behavior-catalog.orb +1 -1
  71. package/behaviors/registry/ui/core/atoms/std-behavior-tour.orb +1 -1
  72. package/behaviors/registry/ui/core/atoms/std-billable-hour.orb +1 -1
  73. package/behaviors/registry/ui/core/atoms/std-board.orb +1 -1
  74. package/behaviors/registry/ui/core/atoms/std-book-reader.orb +1 -1
  75. package/behaviors/registry/ui/core/atoms/std-browse.orb +1 -1
  76. package/behaviors/registry/ui/core/atoms/std-calendar.orb +1 -1
  77. package/behaviors/registry/ui/core/atoms/std-card-grid.orb +1 -1
  78. package/behaviors/registry/ui/core/atoms/std-confirmation.orb +1 -1
  79. package/behaviors/registry/ui/core/atoms/std-dashboard-grid-embedded.orb +1 -1
  80. package/behaviors/registry/ui/core/atoms/std-date-range.orb +1 -1
  81. package/behaviors/registry/ui/core/atoms/std-doc-page.orb +1 -1
  82. package/behaviors/registry/ui/core/atoms/std-esign-flow.orb +1 -1
  83. package/behaviors/registry/ui/core/atoms/std-esign-request.orb +1 -1
  84. package/behaviors/registry/ui/core/atoms/std-event-log.orb +1 -1
  85. package/behaviors/registry/ui/core/atoms/std-export.orb +1 -1
  86. package/behaviors/registry/ui/core/atoms/std-file-store.orb +1 -1
  87. package/behaviors/registry/ui/core/atoms/std-filter.orb +1 -1
  88. package/behaviors/registry/ui/core/atoms/std-form-advanced.orb +1 -1
  89. package/behaviors/registry/ui/core/atoms/std-gallery.orb +1 -1
  90. package/behaviors/registry/ui/core/atoms/std-gantt-schedule.orb +1 -1
  91. package/behaviors/registry/ui/core/atoms/std-geosearch.orb +1 -1
  92. package/behaviors/registry/ui/core/atoms/std-graphs.orb +1 -1
  93. package/behaviors/registry/ui/core/atoms/std-hero.orb +1 -1
  94. package/behaviors/registry/ui/core/atoms/std-home.orb +1 -1
  95. package/behaviors/registry/ui/core/atoms/std-image-upload-multi.orb +1 -1
  96. package/behaviors/registry/ui/core/atoms/std-import.orb +1 -1
  97. package/behaviors/registry/ui/core/atoms/std-language-picker.orb +1 -1
  98. package/behaviors/registry/ui/core/atoms/std-media-section.orb +1 -1
  99. package/behaviors/registry/ui/core/atoms/std-modal-editor.orb +1 -1
  100. package/behaviors/registry/ui/core/atoms/std-modal.orb +1 -1
  101. package/behaviors/registry/ui/core/atoms/std-multi-party-flow.orb +1 -1
  102. package/behaviors/registry/ui/core/atoms/std-notification-panel.orb +1 -1
  103. package/behaviors/registry/ui/core/atoms/std-panel-launcher.orb +1 -1
  104. package/behaviors/registry/ui/core/atoms/std-pricing.orb +1 -1
  105. package/behaviors/registry/ui/core/atoms/std-proof.orb +1 -1
  106. package/behaviors/registry/ui/core/atoms/std-prose.orb +1 -1
  107. package/behaviors/registry/ui/core/atoms/std-rating-review.orb +1 -1
  108. package/behaviors/registry/ui/core/atoms/std-record-detail.orb +1 -1
  109. package/behaviors/registry/ui/core/atoms/std-recurrence.orb +1 -1
  110. package/behaviors/registry/ui/core/atoms/std-related.orb +1 -1
  111. package/behaviors/registry/ui/core/atoms/std-role-gate.orb +1 -1
  112. package/behaviors/registry/ui/core/atoms/std-saved-search.orb +1 -1
  113. package/behaviors/registry/ui/core/atoms/std-scatter.orb +1 -1
  114. package/behaviors/registry/ui/core/atoms/std-scoped-list.orb +1 -1
  115. package/behaviors/registry/ui/core/atoms/std-search.orb +1 -1
  116. package/behaviors/registry/ui/core/atoms/std-selection.orb +1 -1
  117. package/behaviors/registry/ui/core/atoms/std-site-footer.orb +1 -1
  118. package/behaviors/registry/ui/core/atoms/std-site-header.orb +1 -1
  119. package/behaviors/registry/ui/core/atoms/std-slide-deck.orb +1 -1
  120. package/behaviors/registry/ui/core/atoms/std-stat-band.orb +1 -1
  121. package/behaviors/registry/ui/core/atoms/std-stats.orb +1 -1
  122. package/behaviors/registry/ui/core/atoms/std-step-flow.orb +1 -1
  123. package/behaviors/registry/ui/core/atoms/std-steps.orb +1 -1
  124. package/behaviors/registry/ui/core/atoms/std-tabs.orb +1 -1
  125. package/behaviors/registry/ui/core/atoms/std-tag-strip.orb +1 -1
  126. package/behaviors/registry/ui/core/atoms/std-tag-taxonomy.orb +1 -1
  127. package/behaviors/registry/ui/core/atoms/std-thread.orb +1 -1
  128. package/behaviors/registry/ui/core/atoms/std-tree.orb +1 -1
  129. package/behaviors/registry/ui/core/atoms/std-version-history.orb +1 -1
  130. package/behaviors/registry/ui/core/atoms/std-wizard.orb +1 -1
  131. package/behaviors/registry/ui/core/atoms/std-workspace-layout.orb +1 -1
  132. package/behaviors/registry/ui/core/atoms/ui-animated-graphic.orb +1 -1
  133. package/behaviors/registry/ui/core/atoms/ui-animated-reveal.orb +1 -1
  134. package/behaviors/registry/ui/core/atoms/ui-aside.orb +1 -1
  135. package/behaviors/registry/ui/core/atoms/ui-atlas-image.orb +1 -1
  136. package/behaviors/registry/ui/core/atoms/ui-atlas-panel.orb +1 -1
  137. package/behaviors/registry/ui/core/atoms/ui-avatar.orb +1 -1
  138. package/behaviors/registry/ui/core/atoms/ui-badge.orb +1 -1
  139. package/behaviors/registry/ui/core/atoms/ui-box.orb +1 -1
  140. package/behaviors/registry/ui/core/atoms/ui-button.orb +1 -1
  141. package/behaviors/registry/ui/core/atoms/ui-card.orb +1 -1
  142. package/behaviors/registry/ui/core/atoms/ui-center.orb +1 -1
  143. package/behaviors/registry/ui/core/atoms/ui-checkbox.orb +1 -1
  144. package/behaviors/registry/ui/core/atoms/ui-conditional-wrapper.orb +1 -1
  145. package/behaviors/registry/ui/core/atoms/ui-confetti-effect.orb +1 -1
  146. package/behaviors/registry/ui/core/atoms/ui-day-cell.orb +1 -1
  147. package/behaviors/registry/ui/core/atoms/ui-dialog.orb +1 -1
  148. package/behaviors/registry/ui/core/atoms/ui-divider.orb +1 -1
  149. package/behaviors/registry/ui/core/atoms/ui-filter-pill.orb +1 -1
  150. package/behaviors/registry/ui/core/atoms/ui-flip-container.orb +1 -1
  151. package/behaviors/registry/ui/core/atoms/ui-game-icon.orb +1 -1
  152. package/behaviors/registry/ui/core/atoms/ui-hstack.orb +1 -1
  153. package/behaviors/registry/ui/core/atoms/ui-icon.orb +1 -1
  154. package/behaviors/registry/ui/core/atoms/ui-image.orb +1 -1
  155. package/behaviors/registry/ui/core/atoms/ui-infinite-scroll-sentinel.orb +1 -1
  156. package/behaviors/registry/ui/core/atoms/ui-input.orb +1 -1
  157. package/behaviors/registry/ui/core/atoms/ui-label.orb +1 -1
  158. package/behaviors/registry/ui/core/atoms/ui-law-reference-tooltip.orb +1 -1
  159. package/behaviors/registry/ui/core/atoms/ui-overlay.orb +1 -1
  160. package/behaviors/registry/ui/core/atoms/ui-pattern-tile.orb +1 -1
  161. package/behaviors/registry/ui/core/atoms/ui-presence.orb +1 -1
  162. package/behaviors/registry/ui/core/atoms/ui-progress-bar.orb +1 -1
  163. package/behaviors/registry/ui/core/atoms/ui-radio.orb +1 -1
  164. package/behaviors/registry/ui/core/atoms/ui-range-slider.orb +1 -1
  165. package/behaviors/registry/ui/core/atoms/ui-section-header.orb +1 -1
  166. package/behaviors/registry/ui/core/atoms/ui-select.orb +1 -1
  167. package/behaviors/registry/ui/core/atoms/ui-spacer.orb +1 -1
  168. package/behaviors/registry/ui/core/atoms/ui-sparkline.orb +1 -1
  169. package/behaviors/registry/ui/core/atoms/ui-spinner.orb +1 -1
  170. package/behaviors/registry/ui/core/atoms/ui-stack.orb +1 -1
  171. package/behaviors/registry/ui/core/atoms/ui-status-dot.orb +1 -1
  172. package/behaviors/registry/ui/core/atoms/ui-svg-branch.orb +1 -1
  173. package/behaviors/registry/ui/core/atoms/ui-svg-connection.orb +1 -1
  174. package/behaviors/registry/ui/core/atoms/ui-svg-flow.orb +1 -1
  175. package/behaviors/registry/ui/core/atoms/ui-svg-grid.orb +1 -1
  176. package/behaviors/registry/ui/core/atoms/ui-svg-lobe.orb +1 -1
  177. package/behaviors/registry/ui/core/atoms/ui-svg-mesh.orb +1 -1
  178. package/behaviors/registry/ui/core/atoms/ui-svg-morph.orb +1 -1
  179. package/behaviors/registry/ui/core/atoms/ui-svg-node.orb +1 -1
  180. package/behaviors/registry/ui/core/atoms/ui-svg-pulse.orb +1 -1
  181. package/behaviors/registry/ui/core/atoms/ui-svg-ring.orb +1 -1
  182. package/behaviors/registry/ui/core/atoms/ui-svg-shield.orb +1 -1
  183. package/behaviors/registry/ui/core/atoms/ui-svg-stack.orb +1 -1
  184. package/behaviors/registry/ui/core/atoms/ui-switch.orb +1 -1
  185. package/behaviors/registry/ui/core/atoms/ui-text-highlight.orb +1 -1
  186. package/behaviors/registry/ui/core/atoms/ui-textarea.orb +1 -1
  187. package/behaviors/registry/ui/core/atoms/ui-theme-toggle.orb +1 -1
  188. package/behaviors/registry/ui/core/atoms/ui-time-slot-cell.orb +1 -1
  189. package/behaviors/registry/ui/core/atoms/ui-trend-indicator.orb +1 -1
  190. package/behaviors/registry/ui/core/atoms/ui-typewriter-text.orb +1 -1
  191. package/behaviors/registry/ui/core/atoms/ui-typography.orb +1 -1
  192. package/behaviors/registry/ui/core/atoms/ui-video-embed.orb +1 -1
  193. package/behaviors/registry/ui/core/atoms/ui-vstack.orb +1 -1
  194. package/behaviors/registry/ui/core/molecules/std-stat-rows.orb +1 -1
  195. package/behaviors/registry/ui/core/molecules/ui-accordion.orb +1 -1
  196. package/behaviors/registry/ui/core/molecules/ui-activation-block.orb +1 -1
  197. package/behaviors/registry/ui/core/molecules/ui-activity-rail.orb +1 -1
  198. package/behaviors/registry/ui/core/molecules/ui-agent-activity-feed.orb +1 -1
  199. package/behaviors/registry/ui/core/molecules/ui-agent-activity-row.orb +1 -1
  200. package/behaviors/registry/ui/core/molecules/ui-agent-chat-feed.orb +1 -1
  201. package/behaviors/registry/ui/core/molecules/ui-alert.orb +1 -1
  202. package/behaviors/registry/ui/core/molecules/ui-animated-counter.orb +1 -1
  203. package/behaviors/registry/ui/core/molecules/ui-bloom-quiz-block.orb +1 -1
  204. package/behaviors/registry/ui/core/molecules/ui-branching-logic-builder.orb +1 -1
  205. package/behaviors/registry/ui/core/molecules/ui-breadcrumb.orb +1 -1
  206. package/behaviors/registry/ui/core/molecules/ui-calendar-grid.orb +1 -1
  207. package/behaviors/registry/ui/core/molecules/ui-carousel.orb +1 -1
  208. package/behaviors/registry/ui/core/molecules/ui-change-list.orb +1 -1
  209. package/behaviors/registry/ui/core/molecules/ui-chart-legend.orb +1 -1
  210. package/behaviors/registry/ui/core/molecules/ui-chart.orb +1 -1
  211. package/behaviors/registry/ui/core/molecules/ui-code-block.orb +1 -1
  212. package/behaviors/registry/ui/core/molecules/ui-command-palette.orb +1 -1
  213. package/behaviors/registry/ui/core/molecules/ui-commit-row.orb +1 -1
  214. package/behaviors/registry/ui/core/molecules/ui-confirm-dialog.orb +1 -1
  215. package/behaviors/registry/ui/core/molecules/ui-connection-block.orb +1 -1
  216. package/behaviors/registry/ui/core/molecules/ui-container.orb +1 -1
  217. package/behaviors/registry/ui/core/molecules/ui-content-renderer.orb +1 -1
  218. package/behaviors/registry/ui/core/molecules/ui-data-grid.orb +1 -1
  219. package/behaviors/registry/ui/core/molecules/ui-data-list.orb +1 -1
  220. package/behaviors/registry/ui/core/molecules/ui-date-range-picker.orb +1 -1
  221. package/behaviors/registry/ui/core/molecules/ui-date-range-selector.orb +1 -1
  222. package/behaviors/registry/ui/core/molecules/ui-doc-breadcrumb.orb +1 -1
  223. package/behaviors/registry/ui/core/molecules/ui-doc-pagination.orb +1 -1
  224. package/behaviors/registry/ui/core/molecules/ui-doc-search.orb +1 -1
  225. package/behaviors/registry/ui/core/molecules/ui-doc-sidebar.orb +1 -1
  226. package/behaviors/registry/ui/core/molecules/ui-doc-toc.orb +1 -1
  227. package/behaviors/registry/ui/core/molecules/ui-document-details.orb +1 -1
  228. package/behaviors/registry/ui/core/molecules/ui-document-panel.orb +1 -1
  229. package/behaviors/registry/ui/core/molecules/ui-document-viewer.orb +1 -1
  230. package/behaviors/registry/ui/core/molecules/ui-drawer.orb +1 -1
  231. package/behaviors/registry/ui/core/molecules/ui-edge-decoration.orb +1 -1
  232. package/behaviors/registry/ui/core/molecules/ui-emoji-picker.orb +1 -1
  233. package/behaviors/registry/ui/core/molecules/ui-empty-state.orb +1 -1
  234. package/behaviors/registry/ui/core/molecules/ui-error-boundary.orb +1 -1
  235. package/behaviors/registry/ui/core/molecules/ui-error-state.orb +1 -1
  236. package/behaviors/registry/ui/core/molecules/ui-feature-card.orb +1 -1
  237. package/behaviors/registry/ui/core/molecules/ui-feature-grid.orb +1 -1
  238. package/behaviors/registry/ui/core/molecules/ui-file-tree.orb +1 -1
  239. package/behaviors/registry/ui/core/molecules/ui-filter-group.orb +1 -1
  240. package/behaviors/registry/ui/core/molecules/ui-flex.orb +1 -1
  241. package/behaviors/registry/ui/core/molecules/ui-flip-card.orb +1 -1
  242. package/behaviors/registry/ui/core/molecules/ui-floating-action-button.orb +1 -1
  243. package/behaviors/registry/ui/core/molecules/ui-floating-toolbar.orb +1 -1
  244. package/behaviors/registry/ui/core/molecules/ui-form-actions.orb +1 -1
  245. package/behaviors/registry/ui/core/molecules/ui-form-field.orb +1 -1
  246. package/behaviors/registry/ui/core/molecules/ui-form-layout.orb +1 -1
  247. package/behaviors/registry/ui/core/molecules/ui-form-section-header.orb +1 -1
  248. package/behaviors/registry/ui/core/molecules/ui-fx-overlay.orb +1 -1
  249. package/behaviors/registry/ui/core/molecules/ui-gantt.orb +1 -1
  250. package/behaviors/registry/ui/core/molecules/ui-geometric-pattern.orb +1 -1
  251. package/behaviors/registry/ui/core/molecules/ui-gradient-divider.orb +1 -1
  252. package/behaviors/registry/ui/core/molecules/ui-graph-canvas.orb +1 -1
  253. package/behaviors/registry/ui/core/molecules/ui-graph-view.orb +1 -1
  254. package/behaviors/registry/ui/core/molecules/ui-grid.orb +1 -1
  255. package/behaviors/registry/ui/core/molecules/ui-header.orb +1 -1
  256. package/behaviors/registry/ui/core/molecules/ui-icon-button.orb +1 -1
  257. package/behaviors/registry/ui/core/molecules/ui-import-preview-tree.orb +1 -1
  258. package/behaviors/registry/ui/core/molecules/ui-import-progress.orb +1 -1
  259. package/behaviors/registry/ui/core/molecules/ui-import-source-picker.orb +1 -1
  260. package/behaviors/registry/ui/core/molecules/ui-input-group.orb +1 -1
  261. package/behaviors/registry/ui/core/molecules/ui-jazari-state-machine.orb +1 -1
  262. package/behaviors/registry/ui/core/molecules/ui-lightbox.orb +1 -1
  263. package/behaviors/registry/ui/core/molecules/ui-likert-scale.orb +1 -1
  264. package/behaviors/registry/ui/core/molecules/ui-line-chart.orb +1 -1
  265. package/behaviors/registry/ui/core/molecules/ui-loading-state.orb +1 -1
  266. package/behaviors/registry/ui/core/molecules/ui-map-view.orb +1 -1
  267. package/behaviors/registry/ui/core/molecules/ui-markdown-content.orb +1 -1
  268. package/behaviors/registry/ui/core/molecules/ui-matrix-question.orb +1 -1
  269. package/behaviors/registry/ui/core/molecules/ui-menu.orb +1 -1
  270. package/behaviors/registry/ui/core/molecules/ui-meter.orb +1 -1
  271. package/behaviors/registry/ui/core/molecules/ui-modal.orb +1 -1
  272. package/behaviors/registry/ui/core/molecules/ui-navigation.orb +1 -1
  273. package/behaviors/registry/ui/core/molecules/ui-notification.orb +1 -1
  274. package/behaviors/registry/ui/core/molecules/ui-number-stepper.orb +1 -1
  275. package/behaviors/registry/ui/core/molecules/ui-option-constraint-group.orb +1 -1
  276. package/behaviors/registry/ui/core/molecules/ui-orbital-visualization.orb +1 -1
  277. package/behaviors/registry/ui/core/molecules/ui-page-header.orb +1 -1
  278. package/behaviors/registry/ui/core/molecules/ui-page-transition.orb +1 -1
  279. package/behaviors/registry/ui/core/molecules/ui-pagination.orb +1 -1
  280. package/behaviors/registry/ui/core/molecules/ui-popover.orb +1 -1
  281. package/behaviors/registry/ui/core/molecules/ui-positioned-canvas.orb +1 -1
  282. package/behaviors/registry/ui/core/molecules/ui-progress-dots.orb +1 -1
  283. package/behaviors/registry/ui/core/molecules/ui-pull-to-refresh.orb +1 -1
  284. package/behaviors/registry/ui/core/molecules/ui-qr-scanner.orb +1 -1
  285. package/behaviors/registry/ui/core/molecules/ui-quiz-block.orb +1 -1
  286. package/behaviors/registry/ui/core/molecules/ui-reflection-block.orb +1 -1
  287. package/behaviors/registry/ui/core/molecules/ui-relation-select.orb +1 -1
  288. package/behaviors/registry/ui/core/molecules/ui-repeatable-form-section.orb +1 -1
  289. package/behaviors/registry/ui/core/molecules/ui-reply-tree.orb +1 -1
  290. package/behaviors/registry/ui/core/molecules/ui-rich-text-editor.orb +1 -1
  291. package/behaviors/registry/ui/core/molecules/ui-scaled-diagram.orb +1 -1
  292. package/behaviors/registry/ui/core/molecules/ui-search-input.orb +1 -1
  293. package/behaviors/registry/ui/core/molecules/ui-section.orb +1 -1
  294. package/behaviors/registry/ui/core/molecules/ui-side-panel.orb +1 -1
  295. package/behaviors/registry/ui/core/molecules/ui-sidebar.orb +1 -1
  296. package/behaviors/registry/ui/core/molecules/ui-signature-pad.orb +1 -1
  297. package/behaviors/registry/ui/core/molecules/ui-simple-grid.orb +1 -1
  298. package/behaviors/registry/ui/core/molecules/ui-skeleton.orb +1 -1
  299. package/behaviors/registry/ui/core/molecules/ui-social-proof.orb +1 -1
  300. package/behaviors/registry/ui/core/molecules/ui-sortable-list.orb +1 -1
  301. package/behaviors/registry/ui/core/molecules/ui-split.orb +1 -1
  302. package/behaviors/registry/ui/core/molecules/ui-star-rating.orb +1 -1
  303. package/behaviors/registry/ui/core/molecules/ui-stat-display.orb +1 -1
  304. package/behaviors/registry/ui/core/molecules/ui-swipeable-row.orb +1 -1
  305. package/behaviors/registry/ui/core/molecules/ui-table-view.orb +1 -1
  306. package/behaviors/registry/ui/core/molecules/ui-tabs.orb +1 -1
  307. package/behaviors/registry/ui/core/molecules/ui-tag-input.orb +1 -1
  308. package/behaviors/registry/ui/core/molecules/ui-tooltip.orb +1 -1
  309. package/behaviors/registry/ui/core/molecules/ui-top-nav-item.orb +1 -1
  310. package/behaviors/registry/ui/core/molecules/ui-upload-drop-zone.orb +1 -1
  311. package/behaviors/registry/ui/core/molecules/ui-version-diff.orb +1 -1
  312. package/behaviors/registry/ui/core/molecules/ui-violation-alert.orb +1 -1
  313. package/behaviors/registry/ui/core/molecules/ui-vote-stack.orb +1 -1
  314. package/behaviors/registry/ui/core/molecules/ui-wizard-container.orb +1 -1
  315. package/behaviors/registry/ui/core/molecules/ui-wizard-navigation.orb +1 -1
  316. package/behaviors/registry/ui/core/molecules/ui-wizard-progress.orb +1 -1
  317. package/behaviors/registry/ui/core/organisms/ui-chat-bar.orb +1 -1
  318. package/behaviors/registry/ui/core/organisms/ui-code-runner-panel.orb +1 -1
  319. package/behaviors/registry/ui/core/organisms/ui-dashboard-grid.orb +1 -1
  320. package/behaviors/registry/ui/core/organisms/ui-detail-panel.orb +1 -1
  321. package/behaviors/registry/ui/core/organisms/ui-dock-layout.orb +1 -1
  322. package/behaviors/registry/ui/core/organisms/ui-drawer-slot.orb +1 -1
  323. package/behaviors/registry/ui/core/organisms/ui-form-section.orb +1 -1
  324. package/behaviors/registry/ui/core/organisms/ui-form.orb +1 -1
  325. package/behaviors/registry/ui/core/organisms/ui-master-detail-layout.orb +1 -1
  326. package/behaviors/registry/ui/core/organisms/ui-media-gallery.orb +1 -1
  327. package/behaviors/registry/ui/core/organisms/ui-modal-slot.orb +1 -1
  328. package/behaviors/registry/ui/core/organisms/ui-runtime-debugger.orb +1 -1
  329. package/behaviors/registry/ui/core/organisms/ui-segment-renderer.orb +1 -1
  330. package/behaviors/registry/ui/core/organisms/ui-split-pane.orb +1 -1
  331. package/behaviors/registry/ui/core/organisms/ui-stat-card.orb +1 -1
  332. package/behaviors/registry/ui/core/organisms/ui-state-machine-view.orb +1 -1
  333. package/behaviors/registry/ui/core/organisms/ui-subagent-trace-panel.orb +1 -1
  334. package/behaviors/registry/ui/core/organisms/ui-tabbed-container.orb +1 -1
  335. package/behaviors/registry/ui/core/organisms/ui-timeline.orb +1 -1
  336. package/behaviors/registry/ui/core/organisms/ui-toast-slot.orb +1 -1
  337. package/behaviors/registry/ui/core/templates/ui-auth-layout.orb +1 -1
  338. package/behaviors/registry/ui/core/templates/ui-counter-template.orb +1 -1
  339. package/behaviors/registry/ui/core/templates/ui-dashboard-layout.orb +1 -1
  340. package/behaviors/registry/ui/core/templates/ui-generic-app-template.orb +1 -1
  341. package/behaviors/registry/ui/game/atoms/std-arcade-play.orb +1 -1
  342. package/behaviors/registry/ui/game/atoms/std-area-fill.orb +1 -1
  343. package/behaviors/registry/ui/game/atoms/std-audio-cue.orb +1 -1
  344. package/behaviors/registry/ui/game/atoms/std-camera-rig.orb +1 -1
  345. package/behaviors/registry/ui/game/atoms/std-chase-ai.orb +1 -1
  346. package/behaviors/registry/ui/game/atoms/std-choice-gate.orb +1 -1
  347. package/behaviors/registry/ui/game/atoms/std-coef-pad.orb +1 -1
  348. package/behaviors/registry/ui/game/atoms/std-curve-fog.orb +1 -1
  349. package/behaviors/registry/ui/game/atoms/std-dungeon-combat.orb +1 -1
  350. package/behaviors/registry/ui/game/atoms/std-fx-narrative.orb +1 -1
  351. package/behaviors/registry/ui/game/atoms/std-fx-particles.orb +1 -1
  352. package/behaviors/registry/ui/game/atoms/std-fx-trail.orb +1 -1
  353. package/behaviors/registry/ui/game/atoms/std-gate-lock.orb +1 -1
  354. package/behaviors/registry/ui/game/atoms/std-gather.orb +1 -1
  355. package/behaviors/registry/ui/game/atoms/std-gold.orb +1 -1
  356. package/behaviors/registry/ui/game/atoms/std-grid-tactics.orb +1 -1
  357. package/behaviors/registry/ui/game/atoms/std-hero-nav.orb +1 -1
  358. package/behaviors/registry/ui/game/atoms/std-lives.orb +1 -1
  359. package/behaviors/registry/ui/game/atoms/std-loop-lock.orb +1 -1
  360. package/behaviors/registry/ui/game/atoms/std-motion-body.orb +1 -1
  361. package/behaviors/registry/ui/game/atoms/std-objective-reach.orb +1 -1
  362. package/behaviors/registry/ui/game/atoms/std-pad-lock.orb +1 -1
  363. package/behaviors/registry/ui/game/atoms/std-patience.orb +1 -1
  364. package/behaviors/registry/ui/game/atoms/std-patrol-hazard.orb +1 -1
  365. package/behaviors/registry/ui/game/atoms/std-pickup.orb +1 -1
  366. package/behaviors/registry/ui/game/atoms/std-platformer-body.orb +1 -1
  367. package/behaviors/registry/ui/game/atoms/std-production.orb +1 -1
  368. package/behaviors/registry/ui/game/atoms/std-score.orb +1 -1
  369. package/behaviors/registry/ui/game/atoms/std-tutorial-autodemo.orb +1 -1
  370. package/behaviors/registry/ui/game/atoms/std-tutorial-overlay.orb +1 -1
  371. package/behaviors/registry/ui/game/atoms/std-velocity-gate.orb +1 -1
  372. package/behaviors/registry/ui/game/atoms/std-xp.orb +1 -1
  373. package/behaviors/registry/ui/game/atoms/std-zone-card.orb +1 -1
  374. package/behaviors/registry/ui/game/atoms/ui-action-palette.orb +1 -1
  375. package/behaviors/registry/ui/game/atoms/ui-action-tile.orb +1 -1
  376. package/behaviors/registry/ui/game/atoms/ui-canvas-2d.orb +1 -1
  377. package/behaviors/registry/ui/game/atoms/ui-canvas.orb +1 -1
  378. package/behaviors/registry/ui/game/atoms/ui-choice-button.orb +1 -1
  379. package/behaviors/registry/ui/game/atoms/ui-control-button.orb +1 -1
  380. package/behaviors/registry/ui/game/atoms/ui-control-grid.orb +1 -1
  381. package/behaviors/registry/ui/game/atoms/ui-dialogue-bubble.orb +1 -1
  382. package/behaviors/registry/ui/game/atoms/ui-draw-fx-layer.orb +1 -1
  383. package/behaviors/registry/ui/game/atoms/ui-draw-group.orb +1 -1
  384. package/behaviors/registry/ui/game/atoms/ui-draw-mesh.orb +1 -1
  385. package/behaviors/registry/ui/game/atoms/ui-draw-shape-layer.orb +1 -1
  386. package/behaviors/registry/ui/game/atoms/ui-draw-shape.orb +1 -1
  387. package/behaviors/registry/ui/game/atoms/ui-draw-skinned-mesh.orb +1 -1
  388. package/behaviors/registry/ui/game/atoms/ui-draw-sprite-layer.orb +1 -1
  389. package/behaviors/registry/ui/game/atoms/ui-draw-sprite.orb +1 -1
  390. package/behaviors/registry/ui/game/atoms/ui-draw-text-layer.orb +1 -1
  391. package/behaviors/registry/ui/game/atoms/ui-draw-text.orb +1 -1
  392. package/behaviors/registry/ui/game/atoms/ui-game-audio-cue.orb +1 -1
  393. package/behaviors/registry/ui/game/atoms/ui-game-audio-toggle.orb +1 -1
  394. package/behaviors/registry/ui/game/atoms/ui-game-hud.orb +1 -1
  395. package/behaviors/registry/ui/game/atoms/ui-game-menu.orb +1 -1
  396. package/behaviors/registry/ui/game/atoms/ui-health-bar.orb +1 -1
  397. package/behaviors/registry/ui/game/atoms/ui-score-display.orb +1 -1
  398. package/behaviors/registry/ui/game/atoms/ui-sequence-bar.orb +1 -1
  399. package/behaviors/registry/ui/game/atoms/ui-stat-badge.orb +1 -1
  400. package/behaviors/registry/ui/game/atoms/ui-state-graph.orb +1 -1
  401. package/behaviors/registry/ui/game/atoms/ui-state-json-view.orb +1 -1
  402. package/behaviors/registry/ui/game/atoms/ui-timer-display.orb +1 -1
  403. package/behaviors/registry/ui/game/atoms/ui-trait-slot.orb +1 -1
  404. package/behaviors/registry/ui/game/organisms/std-arcade-board-3d.orb +1 -1
  405. package/behaviors/registry/ui/game/organisms/std-crew-board-2d.orb +1 -1
  406. package/behaviors/registry/ui/game/organisms/std-dungeon-board-2d.orb +1 -1
  407. package/behaviors/registry/ui/game/organisms/std-market-board-3d.orb +1 -1
  408. package/behaviors/registry/ui/game/organisms/std-objective-board-3d.orb +1 -1
  409. package/behaviors/registry/ui/game/organisms/std-platformer-board-2d.orb +1 -1
  410. package/behaviors/registry/ui/game/organisms/std-platformer-puzzle.orb +1 -1
  411. package/behaviors/registry/ui/game/organisms/std-survival-board-3d.orb +1 -1
  412. package/behaviors/registry/ui/game/organisms/std-tactics-board-2d.orb +1 -1
  413. package/behaviors/registry/ui/game/organisms/std-tactics-board-3d.orb +1 -1
  414. package/behaviors/registry/ui/game/organisms/std-worldmap-board-2d.orb +1 -1
  415. package/behaviors/registry/ui/game/templates/ui-game-shell.orb +1 -1
  416. package/behaviors/registry/ui/learning/atoms/std-learn-arrangement.orb +1 -1
  417. package/behaviors/registry/ui/learning/atoms/std-learn-classify.orb +1 -1
  418. package/behaviors/registry/ui/learning/atoms/std-learn-compare.orb +1 -1
  419. package/behaviors/registry/ui/learning/atoms/std-learn-coupled-sim.orb +1 -1
  420. package/behaviors/registry/ui/learning/atoms/std-learn-derivation.orb +1 -1
  421. package/behaviors/registry/ui/learning/atoms/std-learn-diagram.orb +1 -1
  422. package/behaviors/registry/ui/learning/atoms/std-learn-doser.orb +1 -1
  423. package/behaviors/registry/ui/learning/atoms/std-learn-estimate.orb +1 -1
  424. package/behaviors/registry/ui/learning/atoms/std-learn-fx-cues.orb +1 -1
  425. package/behaviors/registry/ui/learning/atoms/std-learn-generate.orb +1 -1
  426. package/behaviors/registry/ui/learning/atoms/std-learn-goal-seek.orb +1 -1
  427. package/behaviors/registry/ui/learning/atoms/std-learn-grid-sim.orb +1 -1
  428. package/behaviors/registry/ui/learning/atoms/std-learn-hotspot.orb +1 -1
  429. package/behaviors/registry/ui/learning/atoms/std-learn-live-sim.orb +1 -1
  430. package/behaviors/registry/ui/learning/atoms/std-learn-measure.orb +1 -1
  431. package/behaviors/registry/ui/learning/atoms/std-learn-param-explorer.orb +1 -1
  432. package/behaviors/registry/ui/learning/atoms/std-learn-perturb.orb +1 -1
  433. package/behaviors/registry/ui/learning/atoms/std-learn-predict.orb +1 -1
  434. package/behaviors/registry/ui/learning/atoms/std-learn-sample-accumulator.orb +1 -1
  435. package/behaviors/registry/ui/learning/atoms/std-learn-sandbox.orb +1 -1
  436. package/behaviors/registry/ui/learning/atoms/std-learn-scatter-fit.orb +1 -1
  437. package/behaviors/registry/ui/learning/atoms/std-learn-scenario.orb +1 -1
  438. package/behaviors/registry/ui/learning/atoms/std-learn-sim-3d.orb +1 -1
  439. package/behaviors/registry/ui/learning/atoms/std-learn-slope-probe.orb +1 -1
  440. package/behaviors/registry/ui/learning/atoms/std-learn-speed-drill.orb +1 -1
  441. package/behaviors/registry/ui/learning/atoms/std-learn-stepper.orb +1 -1
  442. package/behaviors/registry/ui/learning/atoms/std-learn-tour-3d.orb +1 -1
  443. package/behaviors/registry/ui/learning/atoms/std-learn-trace-player.orb +1 -1
  444. package/behaviors/registry/ui/learning/atoms/std-learn-transport.orb +1 -1
  445. package/behaviors/registry/ui/learning/atoms/std-learn-tree.orb +1 -1
  446. package/behaviors/registry/ui/learning/atoms/ui-algo-graph-canvas.orb +1 -1
  447. package/behaviors/registry/ui/learning/atoms/ui-algorithm-canvas.orb +1 -1
  448. package/behaviors/registry/ui/learning/atoms/ui-biology-canvas.orb +1 -1
  449. package/behaviors/registry/ui/learning/atoms/ui-chemistry-canvas.orb +1 -1
  450. package/behaviors/registry/ui/learning/atoms/ui-learning-canvas.orb +1 -1
  451. package/behaviors/registry/ui/learning/atoms/ui-math-canvas.orb +1 -1
  452. package/behaviors/registry/ui/learning/atoms/ui-physics-canvas.orb +1 -1
  453. package/dist/behaviors-embeddings.hash.json +2 -2
  454. package/dist/behaviors-embeddings.json +1 -1
  455. package/dist/knob-embeddings.hash.json +2 -2
  456. package/package.json +2 -2
@@ -1 +1 @@
1
- {"name":"std-learn-scatter-fit","version":"1.0.0","description":"Generic scatter-plot fitting instrument — points on a math-canvas (config-declared axis ranges/labels/colors) with a live least-squares refit: slope, intercept, r, and R² recompute as points are added (button or auto-add tick, up to maxPoints) or dragged. An optional guess-then-reveal mode lets the learner drag slope/intercept sliders to propose a line, scored against the fit until Reveal Fit; dashed residual segments and the r/R² readout are config-toggleable. Run/Pause drives a fixed-interval auto-add tick, Reset reseeds from the configured point roster. SCATTER_FIT_UPDATED broadcasts the fit after every learner action, tick, or reset. Every button label, caption, curve label/color, and narration phrase is config-declared so the same mechanism serves any scatter-fit domain (correlation, physics data fitting, trend lines, and beyond) on a math-canvas. Standalone by default; behind a lab router set matchMode and it renders only when MODE_SELECTED matches.","orbitals":[{"name":"LearnScatterFitOrbital","id":"orb_5CMDCNQS9RWMW6D75TQ206HSWY","entity":{"name":"LearnScatterFitScene","id":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4","persistence":"runtime","fields":[{"name":"id","type":"string","required":true},{"name":"active","type":"boolean","default":false},{"name":"title","type":"string"},{"name":"initialPoints","type":"array","items":{"type":"object","properties":{"id":{"name":"id","type":"string","required":false},"y":{"name":"y","type":"number","required":true},"label":{"name":"label","type":"string","required":false},"x":{"name":"x","type":"number","required":true},"color":{"name":"color","type":"string","required":false},"radius":{"name":"radius","type":"number","required":false}}}},{"name":"points","type":"array","items":{"type":"object","properties":{"color":{"name":"color","type":"string","required":false},"radius":{"name":"radius","type":"number","required":false},"label":{"name":"label","type":"string","required":false},"y":{"name":"y","type":"number","required":true},"x":{"name":"x","type":"number","required":true},"id":{"name":"id","type":"string","required":false}}}},{"name":"slope","type":"number"},{"name":"intercept","type":"number"},{"name":"r","type":"number"},{"name":"rSquared","type":"number"},{"name":"guessSlope","type":"number"},{"name":"guessIntercept","type":"number"},{"name":"guessScore","type":"number"},{"name":"revealed","type":"boolean","default":false},{"name":"running","type":"boolean","default":false},{"name":"done","type":"boolean","default":false},{"name":"curves","type":"array","items":{"type":"object","properties":{"samples":{"name":"samples","type":"array","required":false,"items":{"type":"object","properties":{"x":{"name":"x","type":"number","required":true},"y":{"name":"y","type":"number","required":true}}}},"color":{"name":"color","type":"string","required":false},"dash":{"name":"dash","type":"string","required":false,"values":["dashed","dotted"]},"label":{"name":"label","type":"string","required":false}}}},{"name":"narration","type":"string"}]},"traits":[{"name":"LearnScatterFitSim","id":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG","entityRebindable":true,"entityContract":{"requires":[],"provides":["active","curves","done","guessIntercept","guessScore","guessSlope","initialPoints","intercept","narration","points","r","rSquared","revealed","running","slope","title"]},"effectRow":[{"kind":"emit","resource":"LEARN_ROUND_COMPLETE"},{"kind":"emit","resource":"LEARN_ROUND_COMPLETE","site":"tick"},{"kind":"emit","resource":"LEARN_SCATTER_FIT_UPDATED"},{"kind":"emit","resource":"LEARN_SCATTER_FIT_UPDATED","site":"tick"},{"kind":"render-ui","resource":"main"},{"kind":"render-ui","resource":"main","site":"tick"},{"kind":"set","resource":"@entity.active"},{"kind":"set","resource":"@entity.curves"},{"kind":"set","resource":"@entity.curves","site":"tick"},{"kind":"set","resource":"@entity.done"},{"kind":"set","resource":"@entity.done","site":"tick"},{"kind":"set","resource":"@entity.guessIntercept"},{"kind":"set","resource":"@entity.guessScore"},{"kind":"set","resource":"@entity.guessSlope"},{"kind":"set","resource":"@entity.initialPoints"},{"kind":"set","resource":"@entity.intercept"},{"kind":"set","resource":"@entity.intercept","site":"tick"},{"kind":"set","resource":"@entity.narration"},{"kind":"set","resource":"@entity.narration","site":"tick"},{"kind":"set","resource":"@entity.points"},{"kind":"set","resource":"@entity.points","site":"tick"},{"kind":"set","resource":"@entity.r"},{"kind":"set","resource":"@entity.r","site":"tick"},{"kind":"set","resource":"@entity.rSquared"},{"kind":"set","resource":"@entity.rSquared","site":"tick"},{"kind":"set","resource":"@entity.revealed"},{"kind":"set","resource":"@entity.running"},{"kind":"set","resource":"@entity.slope"},{"kind":"set","resource":"@entity.slope","site":"tick"},{"kind":"set","resource":"@entity.title"},{"kind":"ticks","site":"tick"}],"category":"interaction","linkedEntity":"LearnScatterFitScene","linkedEntityId":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4","entityRefIds":{"LearnScatterFitScene":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4"},"emits":[{"event":"LEARN_SCATTER_FIT_UPDATED","eventId":"evt_513TD473KDHSPR73Q8FX603SDZ","description":"The least-squares fit and narration after each learner action, auto-add tick, or reset — a composed listener (readout, grader) can subscribe; a harmless no-op when the atom runs standalone.","synonyms":"fit update, line of best fit, slope, intercept, correlation, r squared","tier":"domain","scope":"external","payloadSchema":[{"name":"slope","type":"number"},{"name":"intercept","type":"number"},{"name":"r","type":"number"},{"name":"rSquared","type":"number"},{"name":"pointCount","type":"number"},{"name":"narration","type":"string"}]},{"event":"LEARN_ROUND_COMPLETE","eventId":"evt_NMA9F4RMJ0A908D4JFBY1BDET6","description":"Fired once when the point that reaches maxPoints lands and the round latches done — the standard learning completion broadcast a celebration/progression sibling (fx cues, badges) rides.","synonyms":"round complete, finished, done, completion, max points","tier":"domain","scope":"external","payloadSchema":[{"name":"score","type":"number"},{"name":"total","type":"number"}]}],"stateMachine":{"states":[{"name":"idle","isInitial":true}],"events":[{"key":"INIT","id":"evt_GC32MHMNFQAQVKGEE4YVJE8P78","name":"Initialize"},{"key":"MODE_SELECTED","id":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","name":"Mode Selected","description":"Lab router broadcast naming the active mode; this instrument renders when the mode equals matchMode, otherwise renders null.","tier":"domain","payloadSchema":[{"name":"mode","type":"string"}],"listened":true},{"key":"ROSTER_LOADED","id":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","name":"Roster Loaded","description":"Runtime content feed, honoured only when rosterSource is event — mode names the instrument it is for (the matchMode it carries, blank when standalone) and initialPoints is the starting point set; a matching instrument re-initialises from it exactly as INIT does from config, any other instrument hides.","tier":"domain","payloadSchema":[{"name":"mode","type":"string","required":true},{"name":"initialPoints","type":"[object]","required":true,"properties":[{"name":"id","type":"string"},{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true},{"name":"label","type":"string"},{"name":"color","type":"string"},{"name":"radius","type":"number"}]}],"listened":true},{"key":"ADD_POINT","id":"evt_SB9J48G73V3HXMEZZTM15ZT86S","name":"Add Point"},{"key":"DRAG_POINT","id":"evt_01A681GMQRABW88H4T0M7RBM7G","name":"Drag Point","description":"A scatter point was dragged — id names the point, x/y its new coordinates (clamped to the axis ranges); the fit recomputes live.","tier":"domain","payloadSchema":[{"name":"id","type":"string"},{"name":"x","type":"number"},{"name":"y","type":"number"}],"listened":true},{"key":"GUESS_LINE","id":"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1","name":"Guess Line","description":"Learner dragged a guess-the-line slider — param is slope or intercept; the guess is scored against the least-squares fit.","tier":"domain","payloadSchema":[{"name":"param","type":"string"},{"name":"value","type":"number"}],"listened":true},{"key":"REVEAL_FIT","id":"evt_1269DY7VJ2XS149WV3WCSGH92R","name":"Reveal Fit"},{"key":"TOGGLE_RUN","id":"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX","name":"Toggle Run"},{"key":"RESET","id":"evt_EW78H7MR0RC0CAPP5KB491RPCA","name":"Reset"},{"key":"LEARN_SCATTER_FIT_UPDATED","id":"evt_513TD473KDHSPR73Q8FX603SDZ","name":"Learn Scatter Fit Updated","description":"The least-squares fit and narration after each learner action, auto-add tick, or reset — a composed listener (readout, grader) can subscribe; a harmless no-op when the atom runs standalone.","synonyms":"fit update, line of best fit, slope, intercept, correlation, r squared","tier":"domain","payloadSchema":[{"name":"slope","type":"number"},{"name":"intercept","type":"number"},{"name":"r","type":"number"},{"name":"rSquared","type":"number"},{"name":"pointCount","type":"number"},{"name":"narration","type":"string"}]},{"key":"LEARN_ROUND_COMPLETE","id":"evt_NMA9F4RMJ0A908D4JFBY1BDET6","name":"Learn Round Complete","description":"Fired once when the point that reaches maxPoints lands and the round latches done — the standard learning completion broadcast a celebration/progression sibling (fx cues, badges) rides.","synonyms":"round complete, finished, done, completion, max points","tier":"domain","payloadSchema":[{"name":"score","type":"number"},{"name":"total","type":"number"}]}],"transitions":[{"from":"idle","to":"idle","event":"INIT","eventId":"evt_GC32MHMNFQAQVKGEE4YVJE8P78","guard":["and",["==","@config.matchMode",""],["==","@config.rosterSource","config"]],"effects":[["set","@entity.initialPoints","@config.initialPoints"],["set","@entity.active",true],["set","@entity.title","@config.title"],["set","@entity.points","@config.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@config.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"MODE_SELECTED","eventId":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","guard":["and",["not",["==","@config.matchMode",""]],["not",["==","@payload.mode","@config.matchMode"]]],"effects":[["set","@entity.active",false],["set","@entity.running",false],["render-ui","main",null]]},{"from":"idle","to":"idle","event":"MODE_SELECTED","eventId":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","guard":["and",["==","@payload.mode","@config.matchMode"],["==","@config.rosterSource","config"]],"effects":[["set","@entity.initialPoints","@config.initialPoints"],["set","@entity.active",true],["set","@entity.title","@config.title"],["set","@entity.points","@config.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@config.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"ROSTER_LOADED","eventId":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","guard":["and",["==","@config.rosterSource","event"],["==","@payload.mode","@config.matchMode"]],"effects":[["set","@entity.initialPoints","@payload.initialPoints"],["set","@entity.active",true],["set","@entity.title","@config.title"],["set","@entity.points","@payload.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@payload.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"ROSTER_LOADED","eventId":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","guard":["and",["==","@config.rosterSource","event"],["not",["==","@payload.mode","@config.matchMode"]]],"effects":[["set","@entity.active",false],["set","@entity.running",false],["render-ui","main",null]]},{"from":"idle","to":"idle","event":"ADD_POINT","eventId":"evt_SB9J48G73V3HXMEZZTM15ZT86S","guard":["and","@entity.active",["not","@entity.done"]],"effects":[["let",[["marginX",["*",["-","@config.axisXMax","@config.axisXMin"],"@config.pointMarginPct"]],["usableX",["-",["-","@config.axisXMax","@config.axisXMin"],["*","@marginX",2]]],["marginY",["*",["-","@config.axisYMax","@config.axisYMin"],"@config.pointMarginPct"]],["usableY",["-",["-","@config.axisYMax","@config.axisYMin"],["*","@marginY",2]]],["newPoint",{"id":["str/concat","p",["array/len","@entity.points"]],"x":["math/round",["+","@config.axisXMin",["+","@marginX",["*",["math/random"],"@usableX"]]]],"y":["math/round",["+","@config.axisYMin",["+","@marginY",["*",["math/random"],"@usableY"]]]],"label":"","color":"@config.newPointColor","radius":"@config.newPointRadius"}],["pts",["array/append","@entity.points","@newPoint"]],["n",["array/len","@pts"]],["meanX",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"]],["meanY",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]],["baseCurves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]],["nowDone",[">=","@n","@config.maxPoints"]]],["do",["set","@entity.points","@pts"],["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.curves",["array/concat","@baseCurves","@residualCurves"]],["set","@entity.done","@nowDone"],["set","@entity.narration",["str/concat","@config.narrationAddedTemplate"," ",["str/concat","","@n"]," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]],["if","@nowDone","@config.narrationMaxReachedSuffix",""]]],["if","@nowDone",["emit","LEARN_ROUND_COMPLETE",{"score":"@n","total":"@config.maxPoints"}],null]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"DRAG_POINT","eventId":"evt_01A681GMQRABW88H4T0M7RBM7G","guard":["==","@entity.active",true],"effects":[["let",[["pts",["array/map","@entity.points",["fn","p",["if",["==",["object/get","@p","id"],"@payload.id"],["object/merge","@p",{"x":["math/clamp","@payload.x","@config.axisXMin","@config.axisXMax"],"y":["math/clamp","@payload.y","@config.axisYMin","@config.axisYMax"]}],"@p"]]]],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]],["baseCurves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]]],["do",["set","@entity.points","@pts"],["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.curves",["array/concat","@baseCurves","@residualCurves"]],["set","@entity.narration",["str/concat","@config.narrationMovedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"GUESS_LINE","eventId":"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1","guard":["==","@entity.active",true],"effects":[["let",[["gSlope",["if",["==","@payload.param","slope"],"@payload.value","@entity.guessSlope"]],["gIntercept",["if",["==","@payload.param","intercept"],"@payload.value","@entity.guessIntercept"]],["pts","@entity.points"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["ssFit",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["e",["-",["object/get","@p","y"],["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]]]],["+","@acc",["*","@e","@e"]]]]]],["ssGuess",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["e",["-",["object/get","@p","y"],["+",["*","@gSlope",["object/get","@p","x"]],"@gIntercept"]]]],["+","@acc",["*","@e","@e"]]]]]],["newScore",["if",[">","@ssGuess",0],["math/round",["math/clamp",["*",100,["/","@ssFit","@ssGuess"]],0,100]],100]],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@gIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@gSlope","@config.axisXMax"],"@gIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}]],["do",["set","@entity.guessSlope","@gSlope"],["set","@entity.guessIntercept","@gIntercept"],["set","@entity.guessScore","@newScore"],["set","@entity.curves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]],["set","@entity.narration",["str/concat","@config.narrationGuessUpdatedTemplate"," ",["str/concat","","@newScore"],"%"]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"REVEAL_FIT","eventId":"evt_1269DY7VJ2XS149WV3WCSGH92R","guard":["==","@entity.active",true],"effects":[["set","@entity.revealed",true],["let",[["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.intercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.slope","@config.axisXMax"],"@entity.intercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}]],["do",["set","@entity.curves",["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]],["set","@entity.narration",["str/concat","@config.narrationFitRevealedTemplate"," — r = ",["str/concat","",["math/round","@entity.r",3]],", R² = ",["str/concat","",["math/round","@entity.rSquared",3]]," — guess score ",["str/concat","","@entity.guessScore"],"%"]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"TOGGLE_RUN","eventId":"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX","guard":["==","@entity.active",true],"effects":[["set","@entity.running",["not","@entity.running"]],["set","@entity.narration",["if","@entity.running","@config.narrationAutoAddingTemplate","@config.narrationPausedTemplate"]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"RESET","eventId":"evt_EW78H7MR0RC0CAPP5KB491RPCA","guard":["==","@entity.active",true],"effects":[["set","@entity.points","@entity.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@entity.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]}]},"ticks":[{"name":"scatterFitTick","interval":600,"guard":["and","@entity.active",["and","@entity.running",["not","@entity.done"]]],"effects":[["let",[["marginX",["*",["-","@config.axisXMax","@config.axisXMin"],"@config.pointMarginPct"]],["usableX",["-",["-","@config.axisXMax","@config.axisXMin"],["*","@marginX",2]]],["marginY",["*",["-","@config.axisYMax","@config.axisYMin"],"@config.pointMarginPct"]],["usableY",["-",["-","@config.axisYMax","@config.axisYMin"],["*","@marginY",2]]],["newPoint",{"id":["str/concat","p",["array/len","@entity.points"]],"x":["math/round",["+","@config.axisXMin",["+","@marginX",["*",["math/random"],"@usableX"]]]],"y":["math/round",["+","@config.axisYMin",["+","@marginY",["*",["math/random"],"@usableY"]]]],"label":"","color":"@config.newPointColor","radius":"@config.newPointRadius"}],["pts",["array/append","@entity.points","@newPoint"]],["n",["array/len","@pts"]],["meanX",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"]],["meanY",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]],["baseCurves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]],["nowDone",[">=","@n","@config.maxPoints"]]],["do",["set","@entity.points","@pts"],["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.curves",["array/concat","@baseCurves","@residualCurves"]],["set","@entity.done","@nowDone"],["set","@entity.narration",["str/concat","@config.narrationAddedTemplate"," ",["str/concat","","@n"]," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]],["if","@nowDone","@config.narrationMaxReachedSuffix",""]]],["if","@nowDone",["emit","LEARN_ROUND_COMPLETE",{"score":"@n","total":"@config.maxPoints"}],null]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]}],"config":{"narrationMovedTemplate":{"type":"string","default":"point moved","label":"Moved Narration Template","description":"Narration phrase after a point is dragged, assembled as \"<template> — r = .., R² = ..\".","tier":"domain"},"axisYMin":{"type":"number","default":0,"label":"Y Axis Min","description":"Lower bound of the canvas y axis; also the floor curve samples clamp to and the low end of the guess-intercept slider default range.","tier":"domain"},"axisXMin":{"type":"number","default":0,"label":"X Axis Min","description":"Lower bound of the canvas x axis, in data coordinates.","tier":"domain"},"revealLabel":{"type":"string","default":"Reveal Fit","label":"Reveal Fit Button Label","tier":"presentation"},"guessInterceptStep":{"type":"number","default":1,"label":"Guess Intercept Step","tier":"domain"},"initialPoints":{"type":"[LearnScatterFitPoint]","default":[{"id":"p0","x":15,"y":25,"label":"","color":"ink","radius":5},{"id":"p1","x":32,"y":40,"label":"","color":"ink","radius":5},{"id":"p2","x":48,"y":44,"label":"","color":"ink","radius":5},{"id":"p3","x":63,"y":62,"label":"","color":"ink","radius":5},{"id":"p4","x":80,"y":70,"label":"","color":"ink","radius":5}],"label":"Initial Points","description":"Scatter points the canvas starts with, in axis data coordinates; Reset reseeds from this roster.","synonyms":"seed points, dataset, scatter data, sample","tier":"domain","items":{"type":"object","properties":{"radius":{"name":"radius","type":"number","required":false},"id":{"name":"id","type":"string","required":false},"label":{"name":"label","type":"string","required":false},"y":{"name":"y","type":"number","required":true},"x":{"name":"x","type":"number","required":true},"color":{"name":"color","type":"string","required":false}}}},"rosterSource":{"type":"string","default":"config","label":"Roster Source","description":"Where the roster comes from: config reads initialPoints knob at INIT; event waits for ROSTER_LOADED and takes the roster from its payload.","tier":"domain","values":["config","event"]},"showR":{"type":"boolean","default":true,"label":"Show r and R²","description":"Show the correlation coefficient r and coefficient of determination R² under the canvas.","synonyms":"correlation coefficient, r squared, goodness of fit","tier":"domain"},"showResiduals":{"type":"boolean","default":true,"label":"Show Residuals","description":"Draw a dashed segment from each point to the fit line — the errors least squares minimizes.","synonyms":"residuals, errors, deviations","tier":"domain"},"summary":{"type":"string","default":"","label":"Concept","description":"One line under the title saying what the learner is looking at (keep it under ~65 characters). Empty shows no line.","tier":"presentation"},"width":{"type":"number","default":600,"label":"Width","description":"Canvas width in pixels.","tier":"presentation"},"pauseLabel":{"type":"string","default":"Pause","label":"Pause Button Label","tier":"presentation"},"guessColor":{"type":"string","default":"series-3","label":"Guess Curve Color","tier":"presentation"},"narrationFitRevealedTemplate":{"type":"string","default":"fit revealed","label":"Fit Revealed Narration Template","description":"Narration phrase after Reveal Fit, assembled as \"<template> — r = .., R² = .. — guess score <score>%\".","tier":"domain"},"autoRun":{"type":"boolean","default":false,"label":"Auto Run","description":"When true, INIT/MODE_SELECTED start the tick auto-adding points up to Max Points; toggle live with the Run/Pause button.","tier":"domain"},"height":{"type":"number","default":400,"label":"Height","description":"Canvas height in pixels.","tier":"presentation"},"narrationMaxReachedSuffix":{"type":"string","default":" — max points reached","label":"Max Reached Narration Suffix","description":"Suffix appended to the added-point narration once maxPoints is hit.","tier":"domain"},"showGrid":{"type":"boolean","default":true,"label":"Show Grid","tier":"presentation"},"narrationPausedTemplate":{"type":"string","default":"Paused — add manually with Add Point.","label":"Paused Narration","description":"Narration shown after Pause is pressed.","tier":"domain"},"showTickLabels":{"type":"boolean","default":true,"label":"Show Tick Labels","tier":"presentation"},"guessSlopeStep":{"type":"number","default":0.05,"label":"Guess Slope Step","tier":"domain"},"newPointRadius":{"type":"number","default":5,"label":"New Point Radius","tier":"presentation"},"axisXMax":{"type":"number","default":100,"label":"X Axis Max","description":"Upper bound of the canvas x axis, in data coordinates; also the x endpoint the fit/guess lines are drawn to.","tier":"domain"},"runLabel":{"type":"string","default":"Run","label":"Run Button Label","tier":"presentation"},"fitColor":{"type":"string","default":"series-2","label":"Fit Curve Color","tier":"presentation"},"newPointColor":{"type":"string","default":"ink","label":"New Point Color","description":"Fill color assigned to points created by Add Point or the auto-add tick.","tier":"presentation"},"title":{"type":"string","default":"Scatter Fit","label":"Title","description":"Title shown above the canvas.","tier":"presentation"},"guessSlopeMax":{"type":"number","default":3,"label":"Guess Slope Max","description":"Upper bound of the guess-slope slider.","tier":"domain"},"pointMarginPct":{"type":"number","default":0.05,"label":"Point Margin Percent","description":"Fraction of each axis span kept clear at both ends when Add Point/the tick place a new random point, so new points never land flush against the axis edge.","tier":"domain"},"gridStep":{"type":"number","default":20,"label":"Grid Step","description":"Spacing between canvas gridlines, in data coordinates.","tier":"presentation"},"guessInterceptMin":{"type":"number","default":0,"label":"Guess Intercept Min","description":"Lower bound of the guess-intercept slider; typically set to axisYMin.","tier":"domain"},"showAxes":{"type":"boolean","default":true,"label":"Show Axes","tier":"presentation"},"narrationGuessUpdatedTemplate":{"type":"string","default":"guess updated — score","label":"Guess Updated Narration Template","description":"Narration phrase after a guess slider moves, assembled as \"<template> <score>%\".","tier":"domain"},"animate":{"type":"boolean","default":false,"label":"Animate","description":"Enable continuous redraw loop.","tier":"presentation"},"axisYMax":{"type":"number","default":100,"label":"Y Axis Max","description":"Upper bound of the canvas y axis; also the ceiling curve samples clamp to and the high end of the guess-intercept slider default range.","tier":"domain"},"guessInterceptMax":{"type":"number","default":100,"label":"Guess Intercept Max","description":"Upper bound of the guess-intercept slider; typically set to axisYMax.","tier":"domain"},"residualColor":{"type":"string","default":"guide","label":"Residual Color","tier":"presentation"},"narrationAutoAddingTemplate":{"type":"string","default":"Auto-adding — tick adds a new point.","label":"Auto-Adding Narration","description":"Narration shown after Run is pressed.","tier":"domain"},"fitLabel":{"type":"string","default":"fit","label":"Fit Curve Label","description":"Legend label for the computed least-squares fit line.","tier":"presentation"},"guessSlopeMin":{"type":"number","default":-3,"label":"Guess Slope Min","description":"Lower bound of the guess-slope slider.","tier":"domain"},"guessSlopeCaption":{"type":"string","default":"Guess slope: ","label":"Guess Slope Caption","description":"Text prefixed to the current guess-slope value above its slider.","tier":"presentation"},"guessMode":{"type":"boolean","default":true,"label":"Guess Mode","description":"When true the learner's guessed line is shown instead of the fit until Reveal Fit, and the guess is scored against least squares.","synonyms":"guess the line, prediction, estimate the fit","tier":"domain"},"guessInterceptCaption":{"type":"string","default":"Guess intercept: ","label":"Guess Intercept Caption","description":"Text prefixed to the current guess-intercept value above its slider.","tier":"presentation"},"resetLabel":{"type":"string","default":"Reset","label":"Reset Button Label","tier":"presentation"},"matchMode":{"type":"string","default":"","label":"Match Mode","description":"When composed behind a lab router, the MODE_SELECTED mode value this instrument responds to. Empty string means standalone — render immediately on INIT, or on ROSTER_LOADED when rosterSource is event.","tier":"presentation"},"maxPoints":{"type":"number","default":20,"label":"Max Points","description":"Cap on accumulated scatter points; Add Point and the auto-run tick stop once reached, until Reset.","tier":"domain"},"addPointLabel":{"type":"string","default":"Add Point","label":"Add Point Button Label","tier":"presentation"},"residualDash":{"type":"string","default":"dashed","label":"Residual Dash Style","tier":"presentation","values":["dashed","dotted"]},"interactive":{"type":"boolean","default":true,"label":"Interactive","description":"Enable pointer interaction on the canvas — required for dragging points.","tier":"presentation"},"narrationLoadedTemplate":{"type":"string","default":"point(s) loaded","label":"Loaded Narration Template","description":"Narration phrase after INIT/MODE_SELECTED/Reset load the seed points, assembled as \"<n> <template> — r = .., R² = ..\".","tier":"domain"},"guessLabel":{"type":"string","default":"your guess","label":"Guess Curve Label","description":"Legend label for the learner's proposed line, shown while guessMode is on and the fit isn't yet revealed.","tier":"presentation"},"narrationAddedTemplate":{"type":"string","default":"point added","label":"Added Narration Template","description":"Narration phrase after a point is added (button or tick), assembled as \"<template> <n> — r = .., R² = ..\".","tier":"domain"}},"scope":"instance"}],"pages":[{"name":"LearnScatterFitPage","id":"pag_VDC2Q8XY3AZ1NFD3HB9CAATDP6","path":"/learn-scatter-fit","traits":[{"ref":"LearnScatterFitSim","refId":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"}]}],"types":{"LearnScatterFitCurve":[{"name":"label","type":"string"},{"name":"color","type":"string"},{"name":"dash","type":"string","values":["dashed","dotted"]},{"name":"samples","type":"[object]","properties":[{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true}]}],"LearnScatterFitCurvePoint":[{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true}],"LearnScatterFitPoint":[{"name":"id","type":"string"},{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true},{"name":"label","type":"string"},{"name":"color","type":"string"},{"name":"radius","type":"number"}]}}],"schemaVersion":1,"ledger":{"schemaVersion":1,"entries":{"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4":{"id":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4","kind":"entity","bakedName":"LearnScatterFitScene","curName":"LearnScatterFitScene","renames":[],"owner":"workspace"},"evt_01A681GMQRABW88H4T0M7RBM7G":{"id":"evt_01A681GMQRABW88H4T0M7RBM7G","kind":"event","bakedName":"DRAG_POINT","curName":"DRAG_POINT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_0E6288DK36SHKDFA3YZVGGN1ZA":{"id":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","kind":"event","bakedName":"ROSTER_LOADED","curName":"ROSTER_LOADED","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_1269DY7VJ2XS149WV3WCSGH92R":{"id":"evt_1269DY7VJ2XS149WV3WCSGH92R","kind":"event","bakedName":"REVEAL_FIT","curName":"REVEAL_FIT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_513TD473KDHSPR73Q8FX603SDZ":{"id":"evt_513TD473KDHSPR73Q8FX603SDZ","kind":"event","bakedName":"LEARN_SCATTER_FIT_UPDATED","curName":"LEARN_SCATTER_FIT_UPDATED","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_EW78H7MR0RC0CAPP5KB491RPCA":{"id":"evt_EW78H7MR0RC0CAPP5KB491RPCA","kind":"event","bakedName":"RESET","curName":"RESET","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_GC32MHMNFQAQVKGEE4YVJE8P78":{"id":"evt_GC32MHMNFQAQVKGEE4YVJE8P78","kind":"event","bakedName":"INIT","curName":"INIT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX":{"id":"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX","kind":"event","bakedName":"TOGGLE_RUN","curName":"TOGGLE_RUN","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_NMA9F4RMJ0A908D4JFBY1BDET6":{"id":"evt_NMA9F4RMJ0A908D4JFBY1BDET6","kind":"event","bakedName":"LEARN_ROUND_COMPLETE","curName":"LEARN_ROUND_COMPLETE","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V":{"id":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","kind":"event","bakedName":"MODE_SELECTED","curName":"MODE_SELECTED","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1":{"id":"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1","kind":"event","bakedName":"GUESS_LINE","curName":"GUESS_LINE","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_SB9J48G73V3HXMEZZTM15ZT86S":{"id":"evt_SB9J48G73V3HXMEZZTM15ZT86S","kind":"event","bakedName":"ADD_POINT","curName":"ADD_POINT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"orb_5CMDCNQS9RWMW6D75TQ206HSWY":{"id":"orb_5CMDCNQS9RWMW6D75TQ206HSWY","kind":"orbital","bakedName":"LearnScatterFitOrbital","curName":"LearnScatterFitOrbital","renames":[],"owner":"workspace"},"pag_VDC2Q8XY3AZ1NFD3HB9CAATDP6":{"id":"pag_VDC2Q8XY3AZ1NFD3HB9CAATDP6","kind":"page","bakedName":"LearnScatterFitPage","curName":"LearnScatterFitPage","renames":[],"owner":"workspace"},"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG":{"id":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG","kind":"trait","bakedName":"LearnScatterFitSim","curName":"LearnScatterFitSim","renames":[],"owner":"workspace"}}}}
1
+ {"name":"std-learn-scatter-fit","version":"1.0.0","description":"Generic scatter-plot fitting instrument — points on a math-canvas (config-declared axis ranges/labels/colors) with a live least-squares refit: slope, intercept, r, and R² recompute as points are added (button or auto-add tick, up to maxPoints) or dragged. An optional guess-then-reveal mode lets the learner drag slope/intercept sliders to propose a line, scored against the fit until Reveal Fit; dashed residual segments and the r/R² readout are config-toggleable. Run/Pause drives a fixed-interval auto-add tick, Reset reseeds from the configured point roster. SCATTER_FIT_UPDATED broadcasts the fit after every learner action, tick, or reset. Every button label, caption, curve label/color, and narration phrase is config-declared so the same mechanism serves any scatter-fit domain (correlation, physics data fitting, trend lines, and beyond) on a math-canvas. Standalone by default; behind a lab router set matchMode and it renders only when MODE_SELECTED matches.","orbitals":[{"name":"LearnScatterFitOrbital","id":"orb_5CMDCNQS9RWMW6D75TQ206HSWY","entity":{"name":"LearnScatterFitScene","id":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4","persistence":"runtime","fields":[{"name":"id","type":"string","required":true},{"name":"active","type":"boolean","default":false},{"name":"title","type":"string"},{"name":"initialPoints","type":"array","items":{"type":"object","properties":{"x":{"name":"x","type":"number","required":true},"id":{"name":"id","type":"string","required":false},"color":{"name":"color","type":"string","required":false},"y":{"name":"y","type":"number","required":true},"radius":{"name":"radius","type":"number","required":false},"label":{"name":"label","type":"string","required":false}}}},{"name":"points","type":"array","items":{"type":"object","properties":{"radius":{"name":"radius","type":"number","required":false},"x":{"name":"x","type":"number","required":true},"label":{"name":"label","type":"string","required":false},"y":{"name":"y","type":"number","required":true},"id":{"name":"id","type":"string","required":false},"color":{"name":"color","type":"string","required":false}}}},{"name":"slope","type":"number"},{"name":"intercept","type":"number"},{"name":"r","type":"number"},{"name":"rSquared","type":"number"},{"name":"guessSlope","type":"number"},{"name":"guessIntercept","type":"number"},{"name":"guessScore","type":"number"},{"name":"revealed","type":"boolean","default":false},{"name":"running","type":"boolean","default":false},{"name":"done","type":"boolean","default":false},{"name":"curves","type":"array","items":{"type":"object","properties":{"color":{"name":"color","type":"string","required":false},"samples":{"name":"samples","type":"array","required":false,"items":{"type":"object","properties":{"x":{"name":"x","type":"number","required":true},"y":{"name":"y","type":"number","required":true}}}},"dash":{"name":"dash","type":"string","required":false,"values":["dashed","dotted"]},"label":{"name":"label","type":"string","required":false}}}},{"name":"narration","type":"string"}]},"traits":[{"name":"LearnScatterFitSim","id":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG","entityRebindable":true,"entityContract":{"requires":[],"provides":["active","curves","done","guessIntercept","guessScore","guessSlope","initialPoints","intercept","narration","points","r","rSquared","revealed","running","slope","title"]},"effectRow":[{"kind":"emit","resource":"LEARN_ROUND_COMPLETE"},{"kind":"emit","resource":"LEARN_ROUND_COMPLETE","site":"tick"},{"kind":"emit","resource":"LEARN_SCATTER_FIT_UPDATED"},{"kind":"emit","resource":"LEARN_SCATTER_FIT_UPDATED","site":"tick"},{"kind":"render-ui","resource":"main"},{"kind":"render-ui","resource":"main","site":"tick"},{"kind":"set","resource":"@entity.active"},{"kind":"set","resource":"@entity.curves"},{"kind":"set","resource":"@entity.curves","site":"tick"},{"kind":"set","resource":"@entity.done"},{"kind":"set","resource":"@entity.done","site":"tick"},{"kind":"set","resource":"@entity.guessIntercept"},{"kind":"set","resource":"@entity.guessScore"},{"kind":"set","resource":"@entity.guessSlope"},{"kind":"set","resource":"@entity.initialPoints"},{"kind":"set","resource":"@entity.intercept"},{"kind":"set","resource":"@entity.intercept","site":"tick"},{"kind":"set","resource":"@entity.narration"},{"kind":"set","resource":"@entity.narration","site":"tick"},{"kind":"set","resource":"@entity.points"},{"kind":"set","resource":"@entity.points","site":"tick"},{"kind":"set","resource":"@entity.r"},{"kind":"set","resource":"@entity.r","site":"tick"},{"kind":"set","resource":"@entity.rSquared"},{"kind":"set","resource":"@entity.rSquared","site":"tick"},{"kind":"set","resource":"@entity.revealed"},{"kind":"set","resource":"@entity.running"},{"kind":"set","resource":"@entity.slope"},{"kind":"set","resource":"@entity.slope","site":"tick"},{"kind":"set","resource":"@entity.title"},{"kind":"ticks","site":"tick"}],"category":"interaction","linkedEntity":"LearnScatterFitScene","linkedEntityId":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4","entityRefIds":{"LearnScatterFitScene":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4"},"emits":[{"event":"LEARN_SCATTER_FIT_UPDATED","eventId":"evt_513TD473KDHSPR73Q8FX603SDZ","description":"The least-squares fit and narration after each learner action, auto-add tick, or reset — a composed listener (readout, grader) can subscribe; a harmless no-op when the atom runs standalone.","synonyms":"fit update, line of best fit, slope, intercept, correlation, r squared","tier":"domain","scope":"external","payloadSchema":[{"name":"slope","type":"number"},{"name":"intercept","type":"number"},{"name":"r","type":"number"},{"name":"rSquared","type":"number"},{"name":"pointCount","type":"number"},{"name":"narration","type":"string"}]},{"event":"LEARN_ROUND_COMPLETE","eventId":"evt_NMA9F4RMJ0A908D4JFBY1BDET6","description":"Fired once when the point that reaches maxPoints lands and the round latches done — the standard learning completion broadcast a celebration/progression sibling (fx cues, badges) rides.","synonyms":"round complete, finished, done, completion, max points","tier":"domain","scope":"external","payloadSchema":[{"name":"score","type":"number"},{"name":"total","type":"number"}]}],"stateMachine":{"states":[{"name":"idle","isInitial":true}],"events":[{"key":"INIT","id":"evt_GC32MHMNFQAQVKGEE4YVJE8P78","name":"Initialize"},{"key":"MODE_SELECTED","id":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","name":"Mode Selected","description":"Lab router broadcast naming the active mode; this instrument renders when the mode equals matchMode, otherwise renders null.","tier":"domain","payloadSchema":[{"name":"mode","type":"string"}],"listened":true},{"key":"ROSTER_LOADED","id":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","name":"Roster Loaded","description":"Runtime content feed, honoured only when rosterSource is event — mode names the instrument it is for (the matchMode it carries, blank when standalone) and initialPoints is the starting point set; a matching instrument re-initialises from it exactly as INIT does from config, any other instrument hides.","tier":"domain","payloadSchema":[{"name":"mode","type":"string","required":true},{"name":"initialPoints","type":"[object]","required":true,"properties":[{"name":"id","type":"string"},{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true},{"name":"label","type":"string"},{"name":"color","type":"string"},{"name":"radius","type":"number"}]}],"listened":true},{"key":"ADD_POINT","id":"evt_SB9J48G73V3HXMEZZTM15ZT86S","name":"Add Point"},{"key":"DRAG_POINT","id":"evt_01A681GMQRABW88H4T0M7RBM7G","name":"Drag Point","description":"A scatter point was dragged — id names the point, x/y its new coordinates (clamped to the axis ranges); the fit recomputes live.","tier":"domain","payloadSchema":[{"name":"id","type":"string"},{"name":"x","type":"number"},{"name":"y","type":"number"}],"listened":true},{"key":"GUESS_LINE","id":"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1","name":"Guess Line","description":"Learner dragged a guess-the-line slider — param is slope or intercept; the guess is scored against the least-squares fit.","tier":"domain","payloadSchema":[{"name":"param","type":"string"},{"name":"value","type":"number"}],"listened":true},{"key":"REVEAL_FIT","id":"evt_1269DY7VJ2XS149WV3WCSGH92R","name":"Reveal Fit"},{"key":"TOGGLE_RUN","id":"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX","name":"Toggle Run"},{"key":"RESET","id":"evt_EW78H7MR0RC0CAPP5KB491RPCA","name":"Reset"},{"key":"LEARN_SCATTER_FIT_UPDATED","id":"evt_513TD473KDHSPR73Q8FX603SDZ","name":"Learn Scatter Fit Updated","description":"The least-squares fit and narration after each learner action, auto-add tick, or reset — a composed listener (readout, grader) can subscribe; a harmless no-op when the atom runs standalone.","synonyms":"fit update, line of best fit, slope, intercept, correlation, r squared","tier":"domain","payloadSchema":[{"name":"slope","type":"number"},{"name":"intercept","type":"number"},{"name":"r","type":"number"},{"name":"rSquared","type":"number"},{"name":"pointCount","type":"number"},{"name":"narration","type":"string"}]},{"key":"LEARN_ROUND_COMPLETE","id":"evt_NMA9F4RMJ0A908D4JFBY1BDET6","name":"Learn Round Complete","description":"Fired once when the point that reaches maxPoints lands and the round latches done — the standard learning completion broadcast a celebration/progression sibling (fx cues, badges) rides.","synonyms":"round complete, finished, done, completion, max points","tier":"domain","payloadSchema":[{"name":"score","type":"number"},{"name":"total","type":"number"}]}],"transitions":[{"from":"idle","to":"idle","event":"INIT","eventId":"evt_GC32MHMNFQAQVKGEE4YVJE8P78","guard":["and",["==","@config.matchMode",""],["==","@config.rosterSource","config"]],"effects":[["set","@entity.initialPoints","@config.initialPoints"],["set","@entity.active",true],["set","@entity.title","@config.title"],["set","@entity.points","@config.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@config.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"MODE_SELECTED","eventId":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","guard":["and",["not",["==","@config.matchMode",""]],["not",["==","@payload.mode","@config.matchMode"]]],"effects":[["set","@entity.active",false],["set","@entity.running",false],["render-ui","main",null]]},{"from":"idle","to":"idle","event":"MODE_SELECTED","eventId":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","guard":["and",["==","@payload.mode","@config.matchMode"],["==","@config.rosterSource","config"]],"effects":[["set","@entity.initialPoints","@config.initialPoints"],["set","@entity.active",true],["set","@entity.title","@config.title"],["set","@entity.points","@config.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@config.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"ROSTER_LOADED","eventId":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","guard":["and",["==","@config.rosterSource","event"],["==","@payload.mode","@config.matchMode"]],"effects":[["set","@entity.initialPoints","@payload.initialPoints"],["set","@entity.active",true],["set","@entity.title","@config.title"],["set","@entity.points","@payload.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@payload.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"ROSTER_LOADED","eventId":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","guard":["and",["==","@config.rosterSource","event"],["not",["==","@payload.mode","@config.matchMode"]]],"effects":[["set","@entity.active",false],["set","@entity.running",false],["render-ui","main",null]]},{"from":"idle","to":"idle","event":"ADD_POINT","eventId":"evt_SB9J48G73V3HXMEZZTM15ZT86S","guard":["and","@entity.active",["not","@entity.done"]],"effects":[["let",[["marginX",["*",["-","@config.axisXMax","@config.axisXMin"],"@config.pointMarginPct"]],["usableX",["-",["-","@config.axisXMax","@config.axisXMin"],["*","@marginX",2]]],["marginY",["*",["-","@config.axisYMax","@config.axisYMin"],"@config.pointMarginPct"]],["usableY",["-",["-","@config.axisYMax","@config.axisYMin"],["*","@marginY",2]]],["newPoint",{"id":["str/concat","p",["array/len","@entity.points"]],"x":["math/round",["+","@config.axisXMin",["+","@marginX",["*",["math/random"],"@usableX"]]]],"y":["math/round",["+","@config.axisYMin",["+","@marginY",["*",["math/random"],"@usableY"]]]],"label":"","color":"@config.newPointColor","radius":"@config.newPointRadius"}],["pts",["array/append","@entity.points","@newPoint"]],["n",["array/len","@pts"]],["meanX",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"]],["meanY",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]],["baseCurves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]],["nowDone",[">=","@n","@config.maxPoints"]]],["do",["set","@entity.points","@pts"],["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.curves",["array/concat","@baseCurves","@residualCurves"]],["set","@entity.done","@nowDone"],["set","@entity.narration",["str/concat","@config.narrationAddedTemplate"," ",["str/concat","","@n"]," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]],["if","@nowDone","@config.narrationMaxReachedSuffix",""]]],["if","@nowDone",["emit","LEARN_ROUND_COMPLETE",{"score":"@n","total":"@config.maxPoints"}],null]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"DRAG_POINT","eventId":"evt_01A681GMQRABW88H4T0M7RBM7G","guard":["==","@entity.active",true],"effects":[["let",[["pts",["array/map","@entity.points",["fn","p",["if",["==",["object/get","@p","id"],"@payload.id"],["object/merge","@p",{"x":["math/clamp","@payload.x","@config.axisXMin","@config.axisXMax"],"y":["math/clamp","@payload.y","@config.axisYMin","@config.axisYMax"]}],"@p"]]]],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]],["baseCurves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]]],["do",["set","@entity.points","@pts"],["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.curves",["array/concat","@baseCurves","@residualCurves"]],["set","@entity.narration",["str/concat","@config.narrationMovedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"GUESS_LINE","eventId":"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1","guard":["==","@entity.active",true],"effects":[["let",[["gSlope",["if",["==","@payload.param","slope"],"@payload.value","@entity.guessSlope"]],["gIntercept",["if",["==","@payload.param","intercept"],"@payload.value","@entity.guessIntercept"]],["pts","@entity.points"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["ssFit",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["e",["-",["object/get","@p","y"],["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]]]],["+","@acc",["*","@e","@e"]]]]]],["ssGuess",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["e",["-",["object/get","@p","y"],["+",["*","@gSlope",["object/get","@p","x"]],"@gIntercept"]]]],["+","@acc",["*","@e","@e"]]]]]],["newScore",["if",[">","@ssGuess",0],["math/round",["math/clamp",["*",100,["/","@ssFit","@ssGuess"]],0,100]],100]],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@gIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@gSlope","@config.axisXMax"],"@gIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}]],["do",["set","@entity.guessSlope","@gSlope"],["set","@entity.guessIntercept","@gIntercept"],["set","@entity.guessScore","@newScore"],["set","@entity.curves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]],["set","@entity.narration",["str/concat","@config.narrationGuessUpdatedTemplate"," ",["str/concat","","@newScore"],"%"]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"REVEAL_FIT","eventId":"evt_1269DY7VJ2XS149WV3WCSGH92R","guard":["==","@entity.active",true],"effects":[["set","@entity.revealed",true],["let",[["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.intercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.slope","@config.axisXMax"],"@entity.intercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}]],["do",["set","@entity.curves",["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]],["set","@entity.narration",["str/concat","@config.narrationFitRevealedTemplate"," — r = ",["str/concat","",["math/round","@entity.r",3]],", R² = ",["str/concat","",["math/round","@entity.rSquared",3]]," — guess score ",["str/concat","","@entity.guessScore"],"%"]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"TOGGLE_RUN","eventId":"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX","guard":["==","@entity.active",true],"effects":[["set","@entity.running",["not","@entity.running"]],["set","@entity.narration",["if","@entity.running","@config.narrationAutoAddingTemplate","@config.narrationPausedTemplate"]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]},{"from":"idle","to":"idle","event":"RESET","eventId":"evt_EW78H7MR0RC0CAPP5KB491RPCA","guard":["==","@entity.active",true],"effects":[["set","@entity.points","@entity.initialPoints"],["set","@entity.guessSlope",0],["set","@entity.guessIntercept",["/",["+","@config.axisYMin","@config.axisYMax"],2]],["set","@entity.revealed",false],["set","@entity.running","@config.autoRun"],["let",[["pts","@entity.initialPoints"],["n",["array/len","@pts"]],["meanX",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"],0]],["meanY",["if",[">","@n",0],["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"],0]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]]],["do",["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.guessScore",0],["set","@entity.curves",["array/concat",["array/append",[],"@fitCurve"],"@residualCurves"]],["set","@entity.done",[">=","@n","@config.maxPoints"]],["set","@entity.narration",["str/concat",["str/concat","","@n"]," ","@config.narrationLoadedTemplate"," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]]]]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]}]},"ticks":[{"name":"scatterFitTick","interval":600,"guard":["and","@entity.active",["and","@entity.running",["not","@entity.done"]]],"effects":[["let",[["marginX",["*",["-","@config.axisXMax","@config.axisXMin"],"@config.pointMarginPct"]],["usableX",["-",["-","@config.axisXMax","@config.axisXMin"],["*","@marginX",2]]],["marginY",["*",["-","@config.axisYMax","@config.axisYMin"],"@config.pointMarginPct"]],["usableY",["-",["-","@config.axisYMax","@config.axisYMin"],["*","@marginY",2]]],["newPoint",{"id":["str/concat","p",["array/len","@entity.points"]],"x":["math/round",["+","@config.axisXMin",["+","@marginX",["*",["math/random"],"@usableX"]]]],"y":["math/round",["+","@config.axisYMin",["+","@marginY",["*",["math/random"],"@usableY"]]]],"label":"","color":"@config.newPointColor","radius":"@config.newPointRadius"}],["pts",["array/append","@entity.points","@newPoint"]],["n",["array/len","@pts"]],["meanX",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","x"]]]],"@n"]],["meanY",["/",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["object/get","@p","y"]]]],"@n"]],["sxx",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dx",["-",["object/get","@p","x"],"@meanX"]]],["+","@acc",["*","@dx","@dx"]]]]]],["syy",["array/reduce","@pts",0,["fn",["acc","p"],["let",[["dy",["-",["object/get","@p","y"],"@meanY"]]],["+","@acc",["*","@dy","@dy"]]]]]],["sxy",["array/reduce","@pts",0,["fn",["acc","p"],["+","@acc",["*",["-",["object/get","@p","x"],"@meanX"],["-",["object/get","@p","y"],"@meanY"]]]]]],["newSlope",["if",[">","@sxx",0],["/","@sxy","@sxx"],0]],["newIntercept",["-","@meanY",["*","@newSlope","@meanX"]]],["newR",["if",["and",[">","@sxx",0],[">","@syy",0]],["/","@sxy",["math/sqrt",["*","@sxx","@syy"]]],0]],["fitCurve",{"label":"@config.fitLabel","color":"@config.fitColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@newIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@newSlope","@config.axisXMax"],"@newIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["guessCurve",{"label":"@config.guessLabel","color":"@config.guessColor","samples":[{"x":"@config.axisXMin","y":["math/clamp","@entity.guessIntercept","@config.axisYMin","@config.axisYMax"]},{"x":"@config.axisXMax","y":["math/clamp",["+",["*","@entity.guessSlope","@config.axisXMax"],"@entity.guessIntercept"],"@config.axisYMin","@config.axisYMax"]}]}],["residualCurves",["if","@config.showResiduals",["array/map","@pts",["fn","p",{"label":"","color":"@config.residualColor","dash":"@config.residualDash","samples":[{"x":["object/get","@p","x"],"y":["object/get","@p","y"]},{"x":["object/get","@p","x"],"y":["+",["*","@newSlope",["object/get","@p","x"]],"@newIntercept"]}]}]],[]]],["baseCurves",["if",["and","@config.guessMode",["not","@entity.revealed"]],["array/append",[],"@guessCurve"],["if","@config.guessMode",["array/append",["array/append",[],"@guessCurve"],"@fitCurve"],["array/append",[],"@fitCurve"]]]],["nowDone",[">=","@n","@config.maxPoints"]]],["do",["set","@entity.points","@pts"],["set","@entity.slope","@newSlope"],["set","@entity.intercept","@newIntercept"],["set","@entity.r","@newR"],["set","@entity.rSquared",["*","@newR","@newR"]],["set","@entity.curves",["array/concat","@baseCurves","@residualCurves"]],["set","@entity.done","@nowDone"],["set","@entity.narration",["str/concat","@config.narrationAddedTemplate"," ",["str/concat","","@n"]," — r = ",["str/concat","",["math/round","@newR",3]],", R² = ",["str/concat","",["math/round",["*","@newR","@newR"],3]],["if","@nowDone","@config.narrationMaxReachedSuffix",""]]],["if","@nowDone",["emit","LEARN_ROUND_COMPLETE",{"score":"@n","total":"@config.maxPoints"}],null]]],["render-ui","main",{"type":"box","padding":"md","children":[{"type":"stack","direction":"vertical","gap":"md","children":[{"type":"stack","direction":"horizontal","justify":"between","align":"start","gap":"md","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"h4","content":"@entity.title"},["if",["==","@config.summary",""],null,{"type":"typography","variant":"body2","color":"muted","content":"@config.summary"}]]},{"type":"badge","label":["if","@entity.revealed","Revealed",["if","@entity.done","Max points",["if","@entity.running","Adding points",["if","@config.guessMode","Guessing","Fitted"]]]],"variant":["if","@entity.revealed","success",["if","@entity.done","neutral",["if","@entity.running","primary","neutral"]]]}]},{"type":"stack","direction":"horizontal","align":"center","gap":"sm","wrap":true,"children":[{"type":"button","action":"ADD_POINT","label":"@config.addPointLabel","icon":"plus","variant":"primary","disabled":"@entity.done"},{"type":"button","action":"REVEAL_FIT","label":"@config.revealLabel","icon":"eye","variant":"secondary"},["if","@entity.running",{"type":"button","action":"TOGGLE_RUN","label":"@config.pauseLabel","icon":"pause","variant":"secondary","aria-pressed":"true"},{"type":"button","action":"TOGGLE_RUN","label":"@config.runLabel","icon":"play","variant":"secondary","aria-pressed":"false","disabled":"@entity.done"}],{"type":"button","action":"RESET","label":"@config.resetLabel","icon":"rotate-ccw","variant":"ghost"},{"type":"typography","variant":"caption","color":"muted","content":["str/concat",["str/concat","",["array/len","@entity.points"]],["str/concat"," of ",["str/concat","","@config.maxPoints"]]]}]},{"type":"math-canvas","keyMap":{"Space":"TOGGLE_RUN","ArrowRight":"ADD_POINT","KeyR":"RESET"},"width":"@config.width","height":"@config.height","xMin":"@config.axisXMin","xMax":"@config.axisXMax","yMin":"@config.axisYMin","yMax":"@config.axisYMax","showAxes":"@config.showAxes","showGrid":"@config.showGrid","gridStep":"@config.gridStep","showTickLabels":"@config.showTickLabels","curves":"@entity.curves","points":"@entity.points","vectors":[],"interactive":"@config.interactive","animate":"@config.animate"},{"type":"stack","direction":"vertical","gap":"sm","children":[{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessSlopeCaption",["math/round","@entity.guessSlope",2]]},{"type":"range-slider","min":"@config.guessSlopeMin","max":"@config.guessSlopeMax","step":"@config.guessSlopeStep","value":"@entity.guessSlope","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"slope"}}]},{"type":"stack","direction":"vertical","gap":"xs","children":[{"type":"typography","variant":"caption","content":["str/concat","@config.guessInterceptCaption",["math/round","@entity.guessIntercept",1]]},{"type":"range-slider","min":"@config.guessInterceptMin","max":"@config.guessInterceptMax","step":"@config.guessInterceptStep","value":"@entity.guessIntercept","showTooltip":true,"action":"GUESS_LINE","actionPayload":{"param":"intercept"}}]}]},{"type":"typography","variant":"caption","color":"muted","content":["if","@config.showR",["str/concat","r = ",["math/round","@entity.r",3]," — R² = ",["math/round","@entity.rSquared",3]," — guess score ","@entity.guessScore","%"],""]},{"type":"typography","variant":"body","content":"@entity.narration"}]}]}],["emit","LEARN_SCATTER_FIT_UPDATED",{"slope":"@entity.slope","intercept":"@entity.intercept","r":"@entity.r","rSquared":"@entity.rSquared","pointCount":["array/len","@entity.points"],"narration":"@entity.narration"}]]}],"config":{"title":{"type":"string","default":"Scatter Fit","label":"Title","description":"Title shown above the canvas.","tier":"presentation"},"gridStep":{"type":"number","default":20,"label":"Grid Step","description":"Spacing between canvas gridlines, in data coordinates.","tier":"presentation"},"revealLabel":{"type":"string","default":"Reveal Fit","label":"Reveal Fit Button Label","tier":"presentation"},"residualColor":{"type":"string","default":"guide","label":"Residual Color","tier":"presentation"},"narrationFitRevealedTemplate":{"type":"string","default":"fit revealed","label":"Fit Revealed Narration Template","description":"Narration phrase after Reveal Fit, assembled as \"<template> — r = .., R² = .. — guess score <score>%\".","tier":"domain"},"width":{"type":"number","default":600,"label":"Width","description":"Canvas width in pixels.","tier":"presentation"},"runLabel":{"type":"string","default":"Run","label":"Run Button Label","tier":"presentation"},"guessSlopeMax":{"type":"number","default":3,"label":"Guess Slope Max","description":"Upper bound of the guess-slope slider.","tier":"domain"},"narrationMaxReachedSuffix":{"type":"string","default":" — max points reached","label":"Max Reached Narration Suffix","description":"Suffix appended to the added-point narration once maxPoints is hit.","tier":"domain"},"matchMode":{"type":"string","default":"","label":"Match Mode","description":"When composed behind a lab router, the MODE_SELECTED mode value this instrument responds to. Empty string means standalone — render immediately on INIT, or on ROSTER_LOADED when rosterSource is event.","tier":"presentation"},"guessSlopeMin":{"type":"number","default":-3,"label":"Guess Slope Min","description":"Lower bound of the guess-slope slider.","tier":"domain"},"summary":{"type":"string","default":"","label":"Concept","description":"One line under the title saying what the learner is looking at (keep it under ~65 characters). Empty shows no line.","tier":"presentation"},"guessInterceptStep":{"type":"number","default":1,"label":"Guess Intercept Step","tier":"domain"},"height":{"type":"number","default":400,"label":"Height","description":"Canvas height in pixels.","tier":"presentation"},"newPointRadius":{"type":"number","default":5,"label":"New Point Radius","tier":"presentation"},"fitLabel":{"type":"string","default":"fit","label":"Fit Curve Label","description":"Legend label for the computed least-squares fit line.","tier":"presentation"},"guessSlopeCaption":{"type":"string","default":"Guess slope: ","label":"Guess Slope Caption","description":"Text prefixed to the current guess-slope value above its slider.","tier":"presentation"},"pauseLabel":{"type":"string","default":"Pause","label":"Pause Button Label","tier":"presentation"},"showAxes":{"type":"boolean","default":true,"label":"Show Axes","tier":"presentation"},"narrationGuessUpdatedTemplate":{"type":"string","default":"guess updated — score","label":"Guess Updated Narration Template","description":"Narration phrase after a guess slider moves, assembled as \"<template> <score>%\".","tier":"domain"},"axisXMin":{"type":"number","default":0,"label":"X Axis Min","description":"Lower bound of the canvas x axis, in data coordinates.","tier":"domain"},"guessInterceptCaption":{"type":"string","default":"Guess intercept: ","label":"Guess Intercept Caption","description":"Text prefixed to the current guess-intercept value above its slider.","tier":"presentation"},"narrationAutoAddingTemplate":{"type":"string","default":"Auto-adding — tick adds a new point.","label":"Auto-Adding Narration","description":"Narration shown after Run is pressed.","tier":"domain"},"rosterSource":{"type":"string","default":"config","label":"Roster Source","description":"Where the roster comes from: config reads initialPoints knob at INIT; event waits for ROSTER_LOADED and takes the roster from its payload.","tier":"domain","values":["config","event"]},"narrationAddedTemplate":{"type":"string","default":"point added","label":"Added Narration Template","description":"Narration phrase after a point is added (button or tick), assembled as \"<template> <n> — r = .., R² = ..\".","tier":"domain"},"pointMarginPct":{"type":"number","default":0.05,"label":"Point Margin Percent","description":"Fraction of each axis span kept clear at both ends when Add Point/the tick place a new random point, so new points never land flush against the axis edge.","tier":"domain"},"autoRun":{"type":"boolean","default":false,"label":"Auto Run","description":"When true, INIT/MODE_SELECTED start the tick auto-adding points up to Max Points; toggle live with the Run/Pause button.","tier":"domain"},"narrationLoadedTemplate":{"type":"string","default":"point(s) loaded","label":"Loaded Narration Template","description":"Narration phrase after INIT/MODE_SELECTED/Reset load the seed points, assembled as \"<n> <template> — r = .., R² = ..\".","tier":"domain"},"addPointLabel":{"type":"string","default":"Add Point","label":"Add Point Button Label","tier":"presentation"},"showGrid":{"type":"boolean","default":true,"label":"Show Grid","tier":"presentation"},"newPointColor":{"type":"string","default":"ink","label":"New Point Color","description":"Fill color assigned to points created by Add Point or the auto-add tick.","tier":"presentation"},"fitColor":{"type":"string","default":"series-2","label":"Fit Curve Color","tier":"presentation"},"interactive":{"type":"boolean","default":true,"label":"Interactive","description":"Enable pointer interaction on the canvas — required for dragging points.","tier":"presentation"},"guessColor":{"type":"string","default":"series-3","label":"Guess Curve Color","tier":"presentation"},"guessInterceptMin":{"type":"number","default":0,"label":"Guess Intercept Min","description":"Lower bound of the guess-intercept slider; typically set to axisYMin.","tier":"domain"},"axisYMax":{"type":"number","default":100,"label":"Y Axis Max","description":"Upper bound of the canvas y axis; also the ceiling curve samples clamp to and the high end of the guess-intercept slider default range.","tier":"domain"},"narrationPausedTemplate":{"type":"string","default":"Paused — add manually with Add Point.","label":"Paused Narration","description":"Narration shown after Pause is pressed.","tier":"domain"},"axisYMin":{"type":"number","default":0,"label":"Y Axis Min","description":"Lower bound of the canvas y axis; also the floor curve samples clamp to and the low end of the guess-intercept slider default range.","tier":"domain"},"narrationMovedTemplate":{"type":"string","default":"point moved","label":"Moved Narration Template","description":"Narration phrase after a point is dragged, assembled as \"<template> — r = .., R² = ..\".","tier":"domain"},"showTickLabels":{"type":"boolean","default":true,"label":"Show Tick Labels","tier":"presentation"},"guessSlopeStep":{"type":"number","default":0.05,"label":"Guess Slope Step","tier":"domain"},"guessInterceptMax":{"type":"number","default":100,"label":"Guess Intercept Max","description":"Upper bound of the guess-intercept slider; typically set to axisYMax.","tier":"domain"},"maxPoints":{"type":"number","default":20,"label":"Max Points","description":"Cap on accumulated scatter points; Add Point and the auto-run tick stop once reached, until Reset.","tier":"domain"},"resetLabel":{"type":"string","default":"Reset","label":"Reset Button Label","tier":"presentation"},"residualDash":{"type":"string","default":"dashed","label":"Residual Dash Style","tier":"presentation","values":["dashed","dotted"]},"guessLabel":{"type":"string","default":"your guess","label":"Guess Curve Label","description":"Legend label for the learner's proposed line, shown while guessMode is on and the fit isn't yet revealed.","tier":"presentation"},"animate":{"type":"boolean","default":false,"label":"Animate","description":"Enable continuous redraw loop.","tier":"presentation"},"initialPoints":{"type":"[LearnScatterFitPoint]","default":[{"id":"p0","x":15,"y":25,"label":"","color":"ink","radius":5},{"id":"p1","x":32,"y":40,"label":"","color":"ink","radius":5},{"id":"p2","x":48,"y":44,"label":"","color":"ink","radius":5},{"id":"p3","x":63,"y":62,"label":"","color":"ink","radius":5},{"id":"p4","x":80,"y":70,"label":"","color":"ink","radius":5}],"label":"Initial Points","description":"Scatter points the canvas starts with, in axis data coordinates; Reset reseeds from this roster.","synonyms":"seed points, dataset, scatter data, sample","tier":"domain","items":{"type":"object","properties":{"id":{"name":"id","type":"string","required":false},"x":{"name":"x","type":"number","required":true},"y":{"name":"y","type":"number","required":true},"color":{"name":"color","type":"string","required":false},"label":{"name":"label","type":"string","required":false},"radius":{"name":"radius","type":"number","required":false}}}},"showResiduals":{"type":"boolean","default":true,"label":"Show Residuals","description":"Draw a dashed segment from each point to the fit line — the errors least squares minimizes.","synonyms":"residuals, errors, deviations","tier":"domain"},"axisXMax":{"type":"number","default":100,"label":"X Axis Max","description":"Upper bound of the canvas x axis, in data coordinates; also the x endpoint the fit/guess lines are drawn to.","tier":"domain"},"guessMode":{"type":"boolean","default":true,"label":"Guess Mode","description":"When true the learner's guessed line is shown instead of the fit until Reveal Fit, and the guess is scored against least squares.","synonyms":"guess the line, prediction, estimate the fit","tier":"domain"},"showR":{"type":"boolean","default":true,"label":"Show r and R²","description":"Show the correlation coefficient r and coefficient of determination R² under the canvas.","synonyms":"correlation coefficient, r squared, goodness of fit","tier":"domain"}},"scope":"instance"}],"pages":[{"name":"LearnScatterFitPage","id":"pag_VDC2Q8XY3AZ1NFD3HB9CAATDP6","path":"/learn-scatter-fit","traits":[{"ref":"LearnScatterFitSim","refId":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"}]}],"types":{"LearnScatterFitCurve":[{"name":"label","type":"string"},{"name":"color","type":"string"},{"name":"dash","type":"string","values":["dashed","dotted"]},{"name":"samples","type":"[object]","properties":[{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true}]}],"LearnScatterFitCurvePoint":[{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true}],"LearnScatterFitPoint":[{"name":"id","type":"string"},{"name":"x","type":"number","required":true},{"name":"y","type":"number","required":true},{"name":"label","type":"string"},{"name":"color","type":"string"},{"name":"radius","type":"number"}]}}],"schemaVersion":1,"ledger":{"schemaVersion":1,"entries":{"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4":{"id":"ent_1NY81T1ZFTZQXDW6NE2R1V3BR4","kind":"entity","bakedName":"LearnScatterFitScene","curName":"LearnScatterFitScene","renames":[],"owner":"workspace"},"evt_01A681GMQRABW88H4T0M7RBM7G":{"id":"evt_01A681GMQRABW88H4T0M7RBM7G","kind":"event","bakedName":"DRAG_POINT","curName":"DRAG_POINT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_0E6288DK36SHKDFA3YZVGGN1ZA":{"id":"evt_0E6288DK36SHKDFA3YZVGGN1ZA","kind":"event","bakedName":"ROSTER_LOADED","curName":"ROSTER_LOADED","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_1269DY7VJ2XS149WV3WCSGH92R":{"id":"evt_1269DY7VJ2XS149WV3WCSGH92R","kind":"event","bakedName":"REVEAL_FIT","curName":"REVEAL_FIT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_513TD473KDHSPR73Q8FX603SDZ":{"id":"evt_513TD473KDHSPR73Q8FX603SDZ","kind":"event","bakedName":"LEARN_SCATTER_FIT_UPDATED","curName":"LEARN_SCATTER_FIT_UPDATED","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_EW78H7MR0RC0CAPP5KB491RPCA":{"id":"evt_EW78H7MR0RC0CAPP5KB491RPCA","kind":"event","bakedName":"RESET","curName":"RESET","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_GC32MHMNFQAQVKGEE4YVJE8P78":{"id":"evt_GC32MHMNFQAQVKGEE4YVJE8P78","kind":"event","bakedName":"INIT","curName":"INIT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX":{"id":"evt_MR2MWZ0PGRB8CEEPD3KE7E22TX","kind":"event","bakedName":"TOGGLE_RUN","curName":"TOGGLE_RUN","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_NMA9F4RMJ0A908D4JFBY1BDET6":{"id":"evt_NMA9F4RMJ0A908D4JFBY1BDET6","kind":"event","bakedName":"LEARN_ROUND_COMPLETE","curName":"LEARN_ROUND_COMPLETE","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V":{"id":"evt_Q4FW0WSBEYNQF72KJ9V0T1KH9V","kind":"event","bakedName":"MODE_SELECTED","curName":"MODE_SELECTED","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1":{"id":"evt_R9DJ3BK0GSG8CVW1SCZ6MPR3B1","kind":"event","bakedName":"GUESS_LINE","curName":"GUESS_LINE","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"evt_SB9J48G73V3HXMEZZTM15ZT86S":{"id":"evt_SB9J48G73V3HXMEZZTM15ZT86S","kind":"event","bakedName":"ADD_POINT","curName":"ADD_POINT","renames":[],"owner":"workspace","parent":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG"},"orb_5CMDCNQS9RWMW6D75TQ206HSWY":{"id":"orb_5CMDCNQS9RWMW6D75TQ206HSWY","kind":"orbital","bakedName":"LearnScatterFitOrbital","curName":"LearnScatterFitOrbital","renames":[],"owner":"workspace"},"pag_VDC2Q8XY3AZ1NFD3HB9CAATDP6":{"id":"pag_VDC2Q8XY3AZ1NFD3HB9CAATDP6","kind":"page","bakedName":"LearnScatterFitPage","curName":"LearnScatterFitPage","renames":[],"owner":"workspace"},"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG":{"id":"trt_EDS1ZGWZSBFWNWK7K2PCMTAGRG","kind":"trait","bakedName":"LearnScatterFitSim","curName":"LearnScatterFitSim","renames":[],"owner":"workspace"}}}}