@officedk/pptxdk 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/LICENSE +21 -0
  2. package/dist/build-zrZuX4fK.d.ts +3 -0
  3. package/dist/build.d.ts +35 -0
  4. package/dist/build.js +128 -0
  5. package/dist/capabilities/dist/all.js +34 -0
  6. package/dist/capabilities/dist/box/box-codegen.js +84 -0
  7. package/dist/capabilities/dist/box/box-declaration.js +32 -0
  8. package/dist/capabilities/dist/box/box-elements.js +17 -0
  9. package/dist/capabilities/dist/box/box.js +142 -0
  10. package/dist/capabilities/dist/chart/chart-codegen.js +79 -0
  11. package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
  12. package/dist/capabilities/dist/chart/chart-elements.js +12 -0
  13. package/dist/capabilities/dist/chart/chart-import.js +2403 -0
  14. package/dist/capabilities/dist/chart/chart-labels.js +86 -0
  15. package/dist/capabilities/dist/chart/chart-model.js +9 -0
  16. package/dist/capabilities/dist/chart/chart-schemas.js +1088 -0
  17. package/dist/capabilities/dist/chart/chart-xml.js +788 -0
  18. package/dist/capabilities/dist/chart/chart.js +1119 -0
  19. package/dist/capabilities/dist/chart/preview/axes-and-grid.js +311 -0
  20. package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
  21. package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
  22. package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
  23. package/dist/capabilities/dist/chart/preview/index.js +192 -0
  24. package/dist/capabilities/dist/chart/preview/layout.js +592 -0
  25. package/dist/capabilities/dist/chart/preview/legend.js +273 -0
  26. package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
  27. package/dist/capabilities/dist/chart/preview/markers.js +100 -0
  28. package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
  29. package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
  30. package/dist/capabilities/dist/chart/preview/scales.js +365 -0
  31. package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
  32. package/dist/capabilities/dist/chart/preview/style.js +60 -0
  33. package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
  34. package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
  35. package/dist/capabilities/dist/chart/preview/types.js +5 -0
  36. package/dist/capabilities/dist/document.js +168 -0
  37. package/dist/capabilities/dist/font/font-embedding.js +119 -0
  38. package/dist/capabilities/dist/font/font-engine.js +834 -0
  39. package/dist/capabilities/dist/font/font-import.js +766 -0
  40. package/dist/capabilities/dist/font/font-subset.js +55 -0
  41. package/dist/capabilities/dist/font/font.js +72 -0
  42. package/dist/capabilities/dist/group/group-codegen.js +74 -0
  43. package/dist/capabilities/dist/group/group-declaration.js +41 -0
  44. package/dist/capabilities/dist/group/group-elements.js +12 -0
  45. package/dist/capabilities/dist/group/group-import.js +649 -0
  46. package/dist/capabilities/dist/group/group-xml.js +8 -0
  47. package/dist/capabilities/dist/group/group.js +260 -0
  48. package/dist/capabilities/dist/image/gif-decoder.js +244 -0
  49. package/dist/capabilities/dist/image/image-codegen.js +164 -0
  50. package/dist/capabilities/dist/image/image-declaration.js +8 -0
  51. package/dist/capabilities/dist/image/image-decode.js +244 -0
  52. package/dist/capabilities/dist/image/image-elements.js +12 -0
  53. package/dist/capabilities/dist/image/image-import.js +984 -0
  54. package/dist/capabilities/dist/image/image-schemas.js +147 -0
  55. package/dist/capabilities/dist/image/image-xml.js +12 -0
  56. package/dist/capabilities/dist/image/image.js +552 -0
  57. package/dist/capabilities/dist/line/line-codegen.js +89 -0
  58. package/dist/capabilities/dist/line/line-declaration.js +72 -0
  59. package/dist/capabilities/dist/line/line-elements.js +12 -0
  60. package/dist/capabilities/dist/line/line-import.js +504 -0
  61. package/dist/capabilities/dist/line/line-xml.js +9 -0
  62. package/dist/capabilities/dist/line/line.js +331 -0
  63. package/dist/capabilities/dist/masters/footer-placeholder.js +683 -0
  64. package/dist/capabilities/dist/masters/masters-codegen.js +69 -0
  65. package/dist/capabilities/dist/masters/masters.js +250 -0
  66. package/dist/capabilities/dist/motion/motion-api.js +757 -0
  67. package/dist/capabilities/dist/motion/motion-codegen.js +406 -0
  68. package/dist/capabilities/dist/motion/motion-elements.js +43 -0
  69. package/dist/capabilities/dist/motion/motion-import.js +1568 -0
  70. package/dist/capabilities/dist/motion/motion-plan.js +2340 -0
  71. package/dist/capabilities/dist/motion/motion-query.js +423 -0
  72. package/dist/capabilities/dist/motion/motion-schemas.js +339 -0
  73. package/dist/capabilities/dist/motion/motion.js +1617 -0
  74. package/dist/capabilities/dist/notes/notes-codegen.js +19 -0
  75. package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
  76. package/dist/capabilities/dist/notes/notes-elements.js +12 -0
  77. package/dist/capabilities/dist/notes/notes-import.js +292 -0
  78. package/dist/capabilities/dist/notes/notes-schemas.js +38 -0
  79. package/dist/capabilities/dist/notes/notes-xml.js +38 -0
  80. package/dist/capabilities/dist/notes/notes.js +194 -0
  81. package/dist/capabilities/dist/placeholder/placeholder-codegen.js +54 -0
  82. package/dist/capabilities/dist/placeholder/placeholder-elements.js +13 -0
  83. package/dist/capabilities/dist/placeholder/placeholder-schemas.js +33 -0
  84. package/dist/capabilities/dist/placeholder/placeholder.js +451 -0
  85. package/dist/capabilities/dist/shape/shape-codegen.js +236 -0
  86. package/dist/capabilities/dist/shape/shape-declaration.js +45 -0
  87. package/dist/capabilities/dist/shape/shape-elements.js +12 -0
  88. package/dist/capabilities/dist/shape/shape-import.js +628 -0
  89. package/dist/capabilities/dist/shape/shape-xml.js +6 -0
  90. package/dist/capabilities/dist/shape/shape.js +320 -0
  91. package/dist/capabilities/dist/shared/geometry.js +1681 -0
  92. package/dist/capabilities/dist/shared/identity.js +205 -0
  93. package/dist/capabilities/dist/shared/morph-api.js +11 -0
  94. package/dist/capabilities/dist/shared/placeholder-import.js +238 -0
  95. package/dist/capabilities/dist/shared/preset-definitions.js +22423 -0
  96. package/dist/capabilities/dist/shared/style-inheritance.js +161 -0
  97. package/dist/capabilities/dist/shared/text-schemas.js +241 -0
  98. package/dist/capabilities/dist/shared/text-service.js +2252 -0
  99. package/dist/capabilities/dist/shared/visual.js +1197 -0
  100. package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
  101. package/dist/capabilities/dist/slide-background/slide-background-import.js +166 -0
  102. package/dist/capabilities/dist/slide-background/slide-background-xml.js +34 -0
  103. package/dist/capabilities/dist/slide-background/slide-background.js +238 -0
  104. package/dist/capabilities/dist/table/table-codegen.js +125 -0
  105. package/dist/capabilities/dist/table/table-declaration.js +15 -0
  106. package/dist/capabilities/dist/table/table-elements.js +27 -0
  107. package/dist/capabilities/dist/table/table-import.js +606 -0
  108. package/dist/capabilities/dist/table/table-schemas.js +334 -0
  109. package/dist/capabilities/dist/table/table-xml.js +30 -0
  110. package/dist/capabilities/dist/table/table.js +739 -0
  111. package/dist/capabilities/dist/text/text-codegen.js +198 -0
  112. package/dist/capabilities/dist/text/text-declaration.js +27 -0
  113. package/dist/capabilities/dist/text/text-elements.js +54 -0
  114. package/dist/capabilities/dist/text/text-import.js +1224 -0
  115. package/dist/capabilities/dist/text/text-xml.js +9 -0
  116. package/dist/capabilities/dist/text/text.js +320 -0
  117. package/dist/capabilities/dist/transition/transition-api.js +136 -0
  118. package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
  119. package/dist/capabilities/dist/transition/transition-import.js +477 -0
  120. package/dist/capabilities/dist/transition/transition.js +260 -0
  121. package/dist/capability-BbKW9w4O.d.ts +2131 -0
  122. package/dist/cli.js +20 -0
  123. package/dist/codegen/dist/assets.js +79 -0
  124. package/dist/codegen/dist/codegen.js +691 -0
  125. package/dist/codegen/dist/identifiers.js +203 -0
  126. package/dist/codegen/dist/index.js +3 -0
  127. package/dist/codegen/dist/printer.js +143 -0
  128. package/dist/codegen/dist/types.js +77 -0
  129. package/dist/core/dist/author-ids.js +51 -0
  130. package/dist/core/dist/author-schemas.js +330 -0
  131. package/dist/core/dist/block-flex-layout.js +801 -0
  132. package/dist/core/dist/build.js +4 -0
  133. package/dist/core/dist/capability.js +15 -0
  134. package/dist/core/dist/declaration.js +16 -0
  135. package/dist/core/dist/diagnostics.js +353 -0
  136. package/dist/core/dist/document-internals.js +26 -0
  137. package/dist/core/dist/document.js +417 -0
  138. package/dist/core/dist/font-seal.js +204 -0
  139. package/dist/core/dist/geometry-schemas.js +256 -0
  140. package/dist/core/dist/grid-layout.js +449 -0
  141. package/dist/core/dist/host.js +40 -0
  142. package/dist/core/dist/index.js +15 -0
  143. package/dist/core/dist/input-values.js +61 -0
  144. package/dist/core/dist/layout-protocol.js +61 -0
  145. package/dist/core/dist/layout-schemas.js +201 -0
  146. package/dist/core/dist/layout.js +340 -0
  147. package/dist/core/dist/masters.js +194 -0
  148. package/dist/core/dist/morph.js +30 -0
  149. package/dist/core/dist/placeholders.js +275 -0
  150. package/dist/core/dist/query.js +190 -0
  151. package/dist/core/dist/resolution.js +12 -0
  152. package/dist/core/dist/resolve.js +2246 -0
  153. package/dist/core/dist/stage-options.js +300 -0
  154. package/dist/core/dist/theme.js +1023 -0
  155. package/dist/core/dist/transform-geometry.js +72 -0
  156. package/dist/document-41spD7bq.d.ts +1350 -0
  157. package/dist/emit/dist/emit.js +957 -0
  158. package/dist/emit/dist/index.js +5 -0
  159. package/dist/emit/dist/ooxml.js +661 -0
  160. package/dist/emit/dist/shape-tree.js +12 -0
  161. package/dist/import/dist/alternate-content.js +54 -0
  162. package/dist/import/dist/diagnostics.js +157 -0
  163. package/dist/import/dist/fonts.js +309 -0
  164. package/dist/import/dist/import.js +513 -0
  165. package/dist/import/dist/index.js +16 -0
  166. package/dist/import/dist/masters.js +1293 -0
  167. package/dist/import/dist/mechanism.js +10 -0
  168. package/dist/import/dist/namespaces.js +61 -0
  169. package/dist/import/dist/notes-masters.js +300 -0
  170. package/dist/import/dist/opc.js +233 -0
  171. package/dist/import/dist/resources.js +166 -0
  172. package/dist/import/dist/sections.js +139 -0
  173. package/dist/import/dist/themes.js +777 -0
  174. package/dist/import/dist/visual.js +821 -0
  175. package/dist/import/dist/xml-fragments.js +277 -0
  176. package/dist/import/dist/xml-reader.js +267 -0
  177. package/dist/index-1ag7U9Jt.d.ts +63 -0
  178. package/dist/index-BEwhk7c8.d.ts +72 -0
  179. package/dist/index-cK2KtukZ.d.ts +161 -0
  180. package/dist/index-v77CTJev.d.ts +55 -0
  181. package/dist/index.d.ts +8 -0
  182. package/dist/index.js +82 -0
  183. package/dist/node.d.ts +53 -0
  184. package/dist/node.js +225 -0
  185. package/dist/pptxdk/src/cli-commands.js +907 -0
  186. package/dist/pptxdk/src/compose.js +53 -0
  187. package/dist/pptxdk/src/slide.js +9 -0
  188. package/dist/preview/dist/index.js +342 -0
  189. package/dist/preview/dist/options.js +40 -0
  190. package/dist/preview/dist/svg-guard.js +1089 -0
  191. package/dist/preview.d.ts +12 -0
  192. package/dist/preview.js +29 -0
  193. package/dist/react/dist/append.js +66 -0
  194. package/dist/react/dist/document-adapter.js +404 -0
  195. package/dist/react/dist/elements.js +82 -0
  196. package/dist/react/dist/from-vanilla.js +57 -0
  197. package/dist/react/dist/index.js +89 -0
  198. package/dist/react/dist/mount.js +34 -0
  199. package/dist/react/dist/reconciler.js +290 -0
  200. package/dist/react.d.ts +235 -0
  201. package/dist/react.js +31 -0
  202. package/dist/transition-6n8GZxSg.d.ts +9 -0
  203. package/dist/vanilla.d.ts +4 -0
  204. package/dist/vanilla.js +15 -0
  205. package/package.json +79 -3
  206. package/README.md +0 -3
@@ -0,0 +1,757 @@
1
+ import { CapabilityError } from "../../../core/dist/diagnostics.js";
2
+ import "../../../core/dist/capability.js";
3
+ import { CommonContainer } from "../../../core/dist/document.js";
4
+ import { breatheOptionsShape, easingSchema, effectDelaySchema, effectDurationSchema, effectPresetSchema, entranceEffectShape, intervalMsSchema, maxRepeatCount, maximumTimeNodeValue, motionDirectionSchema, motionGranularitySchema, motionHexColorSchema, motionMomentOffsetSchema, motionMomentSchema, motionPropKeys, motionScopeAuthorPropKeys, motionScopeHandleSchema, motionScopeModeSchema, motionStepAuthorPropKeys, motionStepAuthorPropsSchema, ownerMotionSchema, repeatCountSchema, spinAngleSchema, spinOptionsSchema } from "./motion-schemas.js";
5
+ // ../capabilities/dist/motion/motion-api.js
6
+ /** Creates the editable orchestration scope shared by the command factory and the JSX entry. */
7
+ function createMotionScopeNode(props) {
8
+ return new CommonContainer("motion-scope", "motion-scope", props);
9
+ }
10
+ /** Creates the editable click-step container shared by the command factory and the JSX entry. */
11
+ function createMotionStepNode(props) {
12
+ return new CommonContainer("motion-step", "motion-step", props);
13
+ }
14
+ let nextMotionIdentity = 1;
15
+ function createMotionIdentity(kind) {
16
+ return `pptxdk-${kind}-${nextMotionIdentity++}`;
17
+ }
18
+ /**
19
+ * Creates a React-independent scope identity and its start/end/named moments.
20
+ *
21
+ * The returned handle keeps its identity when nodes are moved or rebuilt. React authoring keeps one
22
+ * handle per component instance and passes it to `MotionScope`, while plain authoring can create it
23
+ * directly. Cues are values derived from the same identity, not React keys or author ids.
24
+ */
25
+ function createMotionScopeHandle() {
26
+ const identity = createMotionIdentity("scope");
27
+ const moment = (point, name) => Object.freeze({
28
+ type: "motion-moment",
29
+ scope: identity,
30
+ point,
31
+ ...name === void 0 ? {} : { name }
32
+ });
33
+ return Object.freeze({
34
+ type: "motion-scope-handle",
35
+ identity,
36
+ start: moment("start"),
37
+ end: moment("end"),
38
+ cue(name) {
39
+ if (typeof name !== "string" || name.trim() === "") throw new TypeError("MotionScopeHandle.cue(name) requires a non-empty name");
40
+ return moment("named", name);
41
+ }
42
+ });
43
+ }
44
+ /** Creates the stable identity used by an automatic Step host without React. */
45
+ function createMotionStepIdentity() {
46
+ return createMotionIdentity("step");
47
+ }
48
+ /** Schedules an explicit non-negative offset after any moment handle. */
49
+ function after(timing, offsetMs) {
50
+ const offset = timing.type === "motion-offset" ? timing.offsetMs + offsetMs : offsetMs;
51
+ return Object.freeze({
52
+ type: "motion-offset",
53
+ moment: timing.type === "motion-offset" ? timing.moment : timing,
54
+ offsetMs: offset
55
+ });
56
+ }
57
+ function declaration(kind, preset, options, defaults, extra = {}) {
58
+ const easing = options.easing;
59
+ const normalizedEasing = typeof easing === "object" && easing !== null && !Array.isArray(easing) ? Object.freeze({ ...easing }) : easing;
60
+ return Object.freeze({
61
+ ...options,
62
+ type: "effect",
63
+ kind,
64
+ preset,
65
+ duration: options.duration === void 0 ? defaults.duration : options.duration,
66
+ delay: options.delay === void 0 ? 0 : options.delay,
67
+ ...extra,
68
+ ...easing === void 0 ? {} : { easing: normalizedEasing }
69
+ });
70
+ }
71
+ /** Creates instant reveal declaration (`entr#1`); no transition filter or duration. */
72
+ function appear(options = {}) {
73
+ return declaration("entrance", "appear", options, { duration: 1 });
74
+ }
75
+ /** Creates pure fade-in declaration; default duration is 500 ms. */
76
+ function fade(options = {}) {
77
+ return declaration("entrance", "fade", options, { duration: 500 });
78
+ }
79
+ /** Wipes in from specified edge; default direction is bottom. */
80
+ function wipe(options = {}) {
81
+ return declaration("entrance", "wipe", options, { duration: 500 }, { from: options.from === void 0 ? "bottom" : options.from });
82
+ }
83
+ /** Zooms in from origin and fades in. */
84
+ function zoom(options = {}) {
85
+ return declaration("entrance", "zoom", options, { duration: 500 });
86
+ }
87
+ /** Flies in from specified slide edge; default direction is bottom. */
88
+ function fly(options = {}) {
89
+ return declaration("entrance", "fly", options, { duration: 500 }, { from: options.from === void 0 ? "bottom" : options.from });
90
+ }
91
+ /** Fades in and floats up. */
92
+ function floatUp(options = {}) {
93
+ return declaration("entrance", "floatUp", options, { duration: 500 });
94
+ }
95
+ /** Fades in and floats down from above; default duration is 500 ms. */
96
+ function floatDown(options = {}) {
97
+ return declaration("entrance", "floatDown", options, { duration: 500 });
98
+ }
99
+ /** Zooms, rotates, and fades in. */
100
+ function spinIn(options = {}) {
101
+ return declaration("entrance", "spinIn", options, { duration: 500 });
102
+ }
103
+ /** Stretches from center line. */
104
+ function stretch(options = {}) {
105
+ return declaration("entrance", "stretch", options, { duration: 500 });
106
+ }
107
+ /** Creates instant hide declaration (`exit#1`); sets visibility hidden without transition duration. */
108
+ function disappear(options = {}) {
109
+ return declaration("exit", "disappear", options, { duration: 1 });
110
+ }
111
+ /** Fades out and sets visibility hidden at completion; default duration is 500 ms. */
112
+ function fadeOut(options = {}) {
113
+ return declaration("exit", "fadeOut", options, { duration: 500 });
114
+ }
115
+ /** Wipes out toward specified edge and hides at completion; default direction is bottom. */
116
+ function wipeOut(options = {}) {
117
+ return declaration("exit", "wipeOut", options, { duration: 500 }, { from: options.from === void 0 ? "bottom" : options.from });
118
+ }
119
+ /** Flies out toward specified slide edge and hides at completion; default direction is bottom. */
120
+ function flyOut(options = {}) {
121
+ return declaration("exit", "flyOut", options, { duration: 500 }, { from: options.from === void 0 ? "bottom" : options.from });
122
+ }
123
+ /** Zooms out to center, fades out, and hides at completion. */
124
+ function zoomOut(options = {}) {
125
+ return declaration("exit", "zoomOut", options, { duration: 500 });
126
+ }
127
+ /** Fades out, floats downward, and hides at completion. */
128
+ function floatOut(options = {}) {
129
+ return declaration("exit", "floatOut", options, { duration: 500 });
130
+ }
131
+ /** Spins out, shrinks, fades out, and hides at completion. */
132
+ function spinOut(options = {}) {
133
+ return declaration("exit", "spinOut", options, { duration: 500 });
134
+ }
135
+ /** Collapses toward center line and hides at completion. */
136
+ function collapse(options = {}) {
137
+ return declaration("exit", "collapse", options, { duration: 500 });
138
+ }
139
+ /** Rotates between specified `from`/`to` endpoint angles (defaulting to 360 -> 0, or 0 -> `to` when only `to` is declared), or rotates relative to initial angle using signed `by`. */
140
+ function spin(options = {}) {
141
+ const rawFrom = options.from;
142
+ const rawTo = options.to;
143
+ return declaration("emphasis", "spin", options, { duration: 1e3 }, typeof options.by === "number" ? {
144
+ ...rawFrom === void 0 ? {} : { from: rawFrom },
145
+ ...rawTo === void 0 ? {} : { to: rawTo }
146
+ } : {
147
+ from: rawFrom === void 0 ? rawTo === void 0 ? 360 : 0 : rawFrom,
148
+ ...rawTo === void 0 ? {} : { to: rawTo }
149
+ });
150
+ }
151
+ /** Changes from from to to and maintains terminal state; non-repeating, non-reversing, default duration is 500 ms. */
152
+ function fillColor(options) {
153
+ const { from, to, ...timing } = options;
154
+ return Object.freeze({
155
+ ...declaration("emphasis", "fillColor", timing, { duration: 500 }),
156
+ kind: "emphasis",
157
+ preset: "fillColor",
158
+ fromColor: from,
159
+ toColor: to
160
+ });
161
+ }
162
+ const breatheUnknownParameters = Symbol("breathe unknown parameters");
163
+ const breatheOptionNames = /* @__PURE__ */ new Set([
164
+ ...Object.keys(breatheOptionsShape),
165
+ "by",
166
+ "intervalMs"
167
+ ]);
168
+ /** Declares dark->light half-cycle of Shape fill color; native autoRev reverses it to form a full cycle. */
169
+ function breathe(options) {
170
+ const { period, delay = 0, from, to } = options;
171
+ const optionRecord = options;
172
+ const by = optionRecord["by"];
173
+ const intervalMs = optionRecord["intervalMs"];
174
+ const unknownParameters = Object.keys(optionRecord).filter((key) => !breatheOptionNames.has(key));
175
+ const rawEasing = options.easing;
176
+ const easing = isRecord(rawEasing) ? Object.freeze({ ...rawEasing }) : rawEasing;
177
+ return Object.freeze({
178
+ type: "effect",
179
+ kind: "emphasis",
180
+ preset: "breathe",
181
+ duration: period,
182
+ delay,
183
+ fromColor: from,
184
+ toColor: to,
185
+ ...easing === void 0 ? {} : { easing },
186
+ ...by === void 0 ? {} : { by },
187
+ ...intervalMs === void 0 ? {} : { intervalMs },
188
+ ...unknownParameters.length === 0 ? {} : { [breatheUnknownParameters]: unknownParameters }
189
+ });
190
+ }
191
+ /** Wraps supported effect with specified total rounds; forever applies only to breathe. */
192
+ function repeat(effect, count) {
193
+ return Object.freeze({
194
+ type: "repeated-effect",
195
+ effect,
196
+ count
197
+ });
198
+ }
199
+ /** Routes an entrance, emphasis, or exit effect declaration to the 1-based click step `n`. */
200
+ function onStep(n, effect) {
201
+ return Object.freeze({
202
+ type: "stepped-effect",
203
+ step: n,
204
+ effect
205
+ });
206
+ }
207
+ function fail(code, message) {
208
+ throw new CapabilityError(code, message);
209
+ }
210
+ /** Validates the local motion enable flag during capability parsing. */
211
+ function validateMotionFlag(value) {
212
+ if (value !== void 0 && typeof value !== "boolean") fail("invalid-motion", "motion must be a boolean");
213
+ }
214
+ function isRecord(value) {
215
+ return typeof value === "object" && value !== null && !Array.isArray(value);
216
+ }
217
+ const presetKinds = {
218
+ appear: "entrance",
219
+ fade: "entrance",
220
+ wipe: "entrance",
221
+ zoom: "entrance",
222
+ fly: "entrance",
223
+ floatUp: "entrance",
224
+ floatDown: "entrance",
225
+ spinIn: "entrance",
226
+ stretch: "entrance",
227
+ spin: "emphasis",
228
+ breathe: "emphasis",
229
+ fillColor: "emphasis",
230
+ disappear: "exit",
231
+ fadeOut: "exit",
232
+ wipeOut: "exit",
233
+ flyOut: "exit",
234
+ zoomOut: "exit",
235
+ floatOut: "exit",
236
+ spinOut: "exit",
237
+ collapse: "exit"
238
+ };
239
+ const effectKeys = Object.keys(entranceEffectShape);
240
+ const slotPropByKind = {
241
+ entrance: "enter",
242
+ emphasis: "emphasis",
243
+ exit: "exit"
244
+ };
245
+ /** Extracts recognized MotionProps fields without hardcoding a partial subset per object capability. */
246
+ function pickMotionProps(props) {
247
+ const picked = {};
248
+ for (const key of motionPropKeys) if (props[key] !== void 0) picked[key] = props[key];
249
+ return picked;
250
+ }
251
+ function normalizeColor(value, name, code = "invalid-breathe-color") {
252
+ const parsed = motionHexColorSchema.safeParse(value);
253
+ if (!parsed.success) return fail(code, `${name} must be a #RRGGBB color`);
254
+ return parsed.data;
255
+ }
256
+ /** Computes WCAG relative luminance of a normalized `#RRGGBB` color string. */
257
+ function relativeLuminance(color) {
258
+ const linear = [
259
+ 1,
260
+ 3,
261
+ 5
262
+ ].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16) / 255).map((channel) => channel <= .04045 ? channel / 12.92 : ((channel + .055) / 1.055) ** 2.4);
263
+ return .2126 * (linear[0] ?? 0) + .7152 * (linear[1] ?? 0) + .0722 * (linear[2] ?? 0);
264
+ }
265
+ function validatedEffect(value, expected) {
266
+ let repeatCount;
267
+ let repeatDeclared = false;
268
+ let effectValue = value;
269
+ if (isRecord(value) && value["type"] === "repeated-effect") {
270
+ repeatDeclared = true;
271
+ const unknownRepeatField = Object.keys(value).find((key) => key !== "type" && key !== "effect" && key !== "count");
272
+ if (unknownRepeatField !== void 0) return fail("unknown-parameter", `repeat declaration contains unimplemented parameter ${unknownRepeatField}`);
273
+ if (!isRecord(value["effect"]) || value["effect"]["type"] !== "effect") return fail("invalid-repeat", "repeat must directly wrap a single effect declaration");
274
+ repeatCount = value["count"];
275
+ effectValue = value["effect"];
276
+ }
277
+ if (!isRecord(effectValue) || effectValue["type"] !== "effect") return fail("invalid-motion", expected === "entrance" ? "enter must be an entrance effect declaration such as fade() or wipe()" : expected === "emphasis" ? "emphasis must be an emphasis effect declaration such as spin()" : "exit must be an exit effect declaration such as fadeOut() or disappear()");
278
+ const unsupportedBreatheParameters = effectValue[breatheUnknownParameters];
279
+ if (unsupportedBreatheParameters?.length) return fail("unknown-parameter", `breathe declaration contains unimplemented parameter ${unsupportedBreatheParameters[0]}`);
280
+ const unknown = Object.keys(effectValue).find((key) => !effectKeys.includes(key));
281
+ if (unknown !== void 0) return fail("unknown-parameter", `Animation effect contains unimplemented parameter ${unknown}`);
282
+ if (effectValue["kind"] !== expected) {
283
+ const actualKind = effectValue["kind"];
284
+ const targetSlot = slotPropByKind[actualKind] ?? expected;
285
+ return fail("invalid-motion", `${String(effectValue["preset"])}() is an ${String(actualKind)} effect and should be passed to ${targetSlot}`);
286
+ }
287
+ const parsedPreset = effectPresetSchema.safeParse(effectValue["preset"]);
288
+ if (!parsedPreset.success) return fail("unsupported-effect", `Unsupported animation effect ${String(effectValue["preset"])}`);
289
+ const preset = parsedPreset.data;
290
+ if (preset !== "breathe" && presetKinds[preset] !== expected) {
291
+ const actualKind = presetKinds[preset];
292
+ return fail("invalid-motion", `${preset}() is an ${actualKind} effect and should be passed to ${slotPropByKind[actualKind]}`);
293
+ }
294
+ const parsedDuration = effectDurationSchema.safeParse(effectValue["duration"]);
295
+ if (!parsedDuration.success) return fail("invalid-duration", "Animation duration must be writable as a finite positive integer in milliseconds");
296
+ const duration = parsedDuration.data;
297
+ if ((preset === "appear" || preset === "disappear") && (duration !== 1 || effectValue["easing"] !== void 0)) return fail("invalid-motion", `${preset}() is an instant effect and does not accept duration or easing`);
298
+ const parsedDelay = effectDelaySchema.safeParse(effectValue["delay"]);
299
+ if (!parsedDelay.success || !Number.isFinite(Math.round(parsedDelay.data) + Math.round(duration))) return fail("invalid-delay", "Animation delay must be writable as a finite non-negative integer in milliseconds");
300
+ const delay = parsedDelay.data;
301
+ if (preset === "breathe" && Math.round(delay) > 4294967295) return fail("invalid-delay", "breathe delay exceeds native timing value range");
302
+ const by = effectValue["by"];
303
+ const interval = effectValue["intervalMs"];
304
+ if (preset === "spin" && typeof by === "number") {
305
+ if (!spinAngleSchema.safeParse(by).success) return fail("invalid-rotation", "spin by converted value must fall within signed 32-bit angle range");
306
+ if (effectValue["from"] !== void 0 || effectValue["to"] !== void 0) return fail("invalid-motion", "spin from/to and by cannot be declared simultaneously");
307
+ } else if (by !== void 0 && !motionGranularitySchema.safeParse(by).success) return fail("invalid-motion", "by must be a supported text or chart granularity");
308
+ if (interval !== void 0 && (by !== "word" && by !== "letter" || !intervalMsSchema.safeParse(interval).success)) return fail("invalid-motion-interval", "intervalMs applies only to per-word or per-letter effects, and must be a positive integer in milliseconds");
309
+ if ((preset === "wipe" || preset === "wipeOut" || preset === "fly" || preset === "flyOut") && !motionDirectionSchema.safeParse(effectValue["from"]).success) return fail("invalid-direction", `${preset} from must be a valid direction`);
310
+ if (preset === "spin") {
311
+ const from = effectValue["from"];
312
+ const to = effectValue["to"];
313
+ if (typeof by !== "number" && !spinAngleSchema.safeParse(from).success) return fail("invalid-rotation", "spin from converted value must fall within signed 32-bit angle range");
314
+ if (typeof by !== "number" && to !== void 0 && !spinAngleSchema.safeParse(to).success) return fail("invalid-rotation", "spin to converted value must fall within signed 32-bit angle range");
315
+ }
316
+ if (preset !== "wipe" && preset !== "wipeOut" && preset !== "fly" && preset !== "flyOut" && preset !== "spin" && effectValue["from"] !== void 0) return fail("invalid-motion", `${preset} does not accept from parameter`);
317
+ if (preset !== "spin" && effectValue["to"] !== void 0) return fail("invalid-motion", `${preset} does not accept to parameter`);
318
+ const easing = effectValue["easing"];
319
+ if (easing !== void 0) {
320
+ if (!isRecord(easing)) return fail("invalid-easing", "easing must be an object");
321
+ const parsedEasing = easingSchema.safeParse(easing);
322
+ if (!parsedEasing.success) {
323
+ const issue = parsedEasing.error.issues[0];
324
+ if (issue?.code === "unrecognized_keys" && issue.keys[0] !== void 0) return fail("unknown-parameter", `easing contains unimplemented parameter ${issue.keys[0]}`);
325
+ return fail("invalid-easing", "easing accelerate and decelerate proportions must be non-negative and sum to at most 1");
326
+ }
327
+ }
328
+ let fromColor;
329
+ let toColor;
330
+ if (preset === "breathe") {
331
+ if (expected !== "emphasis") return fail("invalid-motion", "breathe() must be passed to emphasis");
332
+ if (typeof duration !== "number" || !Number.isSafeInteger(duration) || duration < 2 || duration % 2 !== 0 || duration / 2 > 4294967295) return fail("invalid-breathe-period", "breathe period must be an even integer in milliseconds greater than 1, and half-period must be writable to native duration");
333
+ fromColor = normalizeColor(effectValue["fromColor"], "breathe.from");
334
+ toColor = normalizeColor(effectValue["toColor"], "breathe.to");
335
+ if (relativeLuminance(toColor) <= relativeLuminance(fromColor)) return fail("invalid-breathe-colors", "breathe.to must be brighter than breathe.from");
336
+ } else if (preset === "fillColor") {
337
+ fromColor = normalizeColor(effectValue["fromColor"], "fillColor.from", "invalid-fill-color");
338
+ toColor = normalizeColor(effectValue["toColor"], "fillColor.to", "invalid-fill-color");
339
+ if (by !== void 0 || interval !== void 0) return fail("invalid-motion", "fillColor does not support text or chart granularity");
340
+ } else if (effectValue["fromColor"] !== void 0 || effectValue["toColor"] !== void 0) return fail("invalid-motion", `${String(preset)} does not accept breathe color parameters`);
341
+ if (repeatDeclared) {
342
+ if (preset !== "spin" && preset !== "breathe") return fail("unsupported-repeat", `${String(preset)} does not support repetition yet; currently only spin and breathe are supported`);
343
+ if (repeatCount === "forever") {
344
+ if (preset !== "breathe") return fail("unsupported-repeat", "forever currently only supports complete breathe cycles");
345
+ } else if (!repeatCountSchema.safeParse(repeatCount).success) return fail("invalid-repeat-count", `repeat count must be total rounds between 1 and ${maxRepeatCount}`);
346
+ if (typeof repeatCount === "number" && (!Number.isSafeInteger(Math.round(delay) + Math.round(duration) * repeatCount) || Math.round(delay) > 4294967295 || (preset === "breathe" ? duration / 2 : Math.round(duration)) > 4294967295 || repeatCount * 1e3 > 4294967295)) return fail("invalid-repeat-duration", "Repeated total duration must remain an exact integer in milliseconds and single round must not exceed native timing range");
347
+ if (by !== void 0 && typeof by !== "number") return fail("unsupported-repeat-combination", "Repeated effects cannot currently be combined with per-paragraph, per-word, per-letter, or chart granularity");
348
+ if (!repeatCountSchema.safeParse(repeatCount).success) return fail("invalid-repeat-count", `repeat count must be total rounds between 1 and ${maxRepeatCount}`);
349
+ }
350
+ return {
351
+ ...effectValue,
352
+ ...repeatCount === void 0 ? {} : { repeatCount },
353
+ ...fromColor === void 0 ? {} : { fromColor },
354
+ ...toColor === void 0 ? {} : { toColor }
355
+ };
356
+ }
357
+ function stepDeclarationFromProps(props) {
358
+ const number = props["n"];
359
+ if (number === void 0) {
360
+ const identity = props["stepIdentity"];
361
+ if (typeof identity !== "string" || identity === "") return fail("invalid-step", "Automatic click step lacks instance identity");
362
+ return Object.freeze({
363
+ mode: "automatic",
364
+ identity
365
+ });
366
+ }
367
+ const parsed = motionStepAuthorPropsSchema.safeParse({ n: number });
368
+ if (!parsed.success || parsed.data.n === void 0) return fail("invalid-step", "Explicit click step number must be a positive integer");
369
+ return Object.freeze({
370
+ mode: "explicit",
371
+ number: parsed.data.n
372
+ });
373
+ }
374
+ function listed(value, many) {
375
+ if (value === void 0) return [];
376
+ return many && Array.isArray(value) ? value : [value];
377
+ }
378
+ function validatedMoment(value) {
379
+ const parsed = motionMomentSchema.safeParse(value);
380
+ if (!parsed.success) {
381
+ if (!isRecord(value) || value["type"] !== "motion-moment") return fail("invalid-moment", "Moment handle must come from a motion scope handle.");
382
+ return fail("invalid-moment", "Moment handle scope, type, or name is invalid");
383
+ }
384
+ return parsed.data;
385
+ }
386
+ function validatedTiming(value) {
387
+ if (isRecord(value) && value["type"] === "motion-offset") {
388
+ const moment = validatedMoment(value["moment"]);
389
+ const parsed = motionMomentOffsetSchema.safeParse({
390
+ type: "motion-offset",
391
+ moment,
392
+ offsetMs: value["offsetMs"]
393
+ });
394
+ if (!parsed.success) return fail("invalid-delay", "Moment offset must be a finite non-negative integer in milliseconds");
395
+ return Object.freeze(parsed.data);
396
+ }
397
+ return validatedMoment(value);
398
+ }
399
+ function validatedPublisher(value) {
400
+ if (value === void 0) return void 0;
401
+ const momentValue = validatedMoment(value);
402
+ if (momentValue.point !== "named") return fail("invalid-moment", "publishStart and publishEnd require named moment handles");
403
+ return momentValue;
404
+ }
405
+ const motionScopeAllowedParameters = new Set(motionScopeAuthorPropKeys);
406
+ const motionStepAllowedParameters = /* @__PURE__ */ new Set([...motionStepAuthorPropKeys, "stepIdentity"]);
407
+ function localScopeDeclaration(props) {
408
+ const unknown = Object.keys(props).find((key) => !motionScopeAllowedParameters.has(key));
409
+ if (unknown !== void 0) return fail("unknown-parameter", `MotionScope contains unimplemented parameter ${unknown}`);
410
+ validateMotionFlag(props["motion"]);
411
+ const parsedHandle = motionScopeHandleSchema.safeParse(props["scope"]);
412
+ if (!parsedHandle.success) return fail("invalid-scope", "MotionScope requires a handle created by createMotionScopeHandle() or useMotionScope()");
413
+ const handle = parsedHandle.data;
414
+ const parsedMode = motionScopeModeSchema.safeParse(props["mode"] ?? "parallel");
415
+ if (!parsedMode.success) return fail("invalid-scope", "MotionScope mode must be parallel, sequence, or stagger");
416
+ const mode = parsedMode.data;
417
+ const parsedDelay = effectDelaySchema.safeParse(props["delay"] ?? 0);
418
+ if (!parsedDelay.success) return fail("invalid-delay", "MotionScope delay must be a finite non-negative integer in milliseconds");
419
+ const delay = parsedDelay.data;
420
+ const each = props["each"];
421
+ if (mode === "stagger" && (typeof each !== "number" || !Number.isFinite(each) || each < 0 || !Number.isSafeInteger(Math.round(each))) || mode !== "stagger" && each !== void 0) return fail("invalid-scope", "stagger requires non-negative integer each; other modes do not accept each");
422
+ const startAt = props["startAt"] === void 0 ? void 0 : validatedTiming(props["startAt"]);
423
+ const publishStart = validatedPublisher(props["publishStart"]);
424
+ const publishEnd = validatedPublisher(props["publishEnd"]);
425
+ return Object.freeze({
426
+ identity: handle.identity,
427
+ mode,
428
+ delay: Math.round(delay),
429
+ ...typeof each === "number" ? { each: Math.round(each) } : {},
430
+ ...startAt === void 0 ? {} : { startAt },
431
+ ...publishStart === void 0 ? {} : { publishStart },
432
+ ...publishEnd === void 0 ? {} : { publishEnd }
433
+ });
434
+ }
435
+ /** Compiles explicit scope host into a local declaration resolved against the current document tree. */
436
+ function motionScopeAnnotation(input) {
437
+ const scope = localScopeDeclaration(input);
438
+ return {
439
+ capability: "motion",
440
+ value: Object.freeze({
441
+ type: "scope",
442
+ scope,
443
+ enabled: input["motion"] !== false
444
+ }),
445
+ resolveContributions: resolveMotionContributions
446
+ };
447
+ }
448
+ /** Validates a Step declaration wrapper and extracts its formal click-step trigger. */
449
+ function parseStepDeclarationProps(input) {
450
+ const unknown = Object.keys(input).find((key) => !motionStepAllowedParameters.has(key));
451
+ if (unknown !== void 0) return fail("unknown-parameter", `Step contains unimplemented parameter ${unknown}`);
452
+ return stepDeclarationFromProps(input);
453
+ }
454
+ /** Validates Step wrapper parameters and emits a transparent step annotation resolved by tree order. */
455
+ function motionStepAnnotation(input) {
456
+ const step = parseStepDeclarationProps(input);
457
+ return [{
458
+ capability: "motion",
459
+ optional: true,
460
+ value: Object.freeze({
461
+ type: "step",
462
+ step
463
+ }),
464
+ resolveContributions: resolveMotionContributions
465
+ }];
466
+ }
467
+ function validatedDeclaration(value, expected) {
468
+ if (isRecord(value) && value["type"] === "stepped-effect") {
469
+ const unknownStepField = Object.keys(value).find((key) => key !== "type" && key !== "step" && key !== "effect");
470
+ if (unknownStepField !== void 0) return fail("unknown-parameter", `onStep declaration contains unimplemented parameter ${unknownStepField}`);
471
+ const parsedStep = motionStepAuthorPropsSchema.safeParse({ n: value["step"] });
472
+ if (!parsedStep.success || parsedStep.data.n === void 0) return fail("invalid-step", "onStep click step number must be a positive integer");
473
+ if (isRecord(value["effect"]) && value["effect"]["type"] === "stepped-effect") return fail("invalid-motion", "onStep cannot be nested");
474
+ return Object.freeze({
475
+ effect: validatedEffect(value["effect"], expected),
476
+ step: Object.freeze({
477
+ mode: "explicit",
478
+ number: parsedStep.data.n
479
+ })
480
+ });
481
+ }
482
+ return Object.freeze({ effect: validatedEffect(value, expected) });
483
+ }
484
+ function localMotionValue(props, target, stepOverride) {
485
+ const enter = props["enter"];
486
+ const entries = [
487
+ ...listed(enter, true).map((value) => validatedDeclaration(value, "entrance")),
488
+ ...listed(props["emphasis"], true).map((value) => validatedDeclaration(value, "emphasis")),
489
+ ...listed(props["exit"], true).map((value) => validatedDeclaration(value, "exit"))
490
+ ];
491
+ if (entries.some(({ effect: { preset } }) => preset === "breathe" && (target.kind !== "shape" || target.range !== void 0 || !target.filled))) return fail("invalid-breathe-target", "breathe() requires native Shape with solid fill; Group requires effects declared on real members separately");
492
+ if (entries.some(({ effect: { preset } }) => preset === "fillColor" && (target.kind !== "shape" || target.range !== void 0 || !target.solidFilled))) return fail("invalid-fill-color-target", "fillColor() requires native Shape with solid fill");
493
+ const startAt = props["startAt"] === void 0 ? void 0 : validatedTiming(props["startAt"]);
494
+ const publishStart = validatedPublisher(props["publishStart"]);
495
+ const publishEnd = validatedPublisher(props["publishEnd"]);
496
+ return Object.freeze({
497
+ target: Object.freeze({ ...target }),
498
+ enterDeclared: enter !== void 0,
499
+ entries: Object.freeze(entries),
500
+ ...stepOverride === void 0 ? {} : { step: stepOverride },
501
+ ...startAt === void 0 ? {} : { startAt },
502
+ ...publishStart === void 0 ? {} : { publishStart },
503
+ ...publishEnd === void 0 ? {} : { publishEnd }
504
+ });
505
+ }
506
+ /** Converts object animation declarations into local annotations consumed by motion slide capability. */
507
+ function motionAnnotations(props, target) {
508
+ validateMotionFlag(props["motion"]);
509
+ if (props["motion"] === false) return [];
510
+ const value = localMotionValue(props, target);
511
+ const hasTimingProps = value.startAt !== void 0 || value.publishStart !== void 0 || value.publishEnd !== void 0;
512
+ return [{
513
+ capability: "motion",
514
+ optional: value.entries.length === 0 && !hasTimingProps,
515
+ value,
516
+ resolveContributions: resolveMotionContributions
517
+ }];
518
+ }
519
+ /** Converts per-paragraph animation declarations on Text or Shape into local paragraph-targeted annotations. */
520
+ function motionParagraphAnnotations(paragraphMotions, baseTarget, parentProps) {
521
+ validateMotionFlag(parentProps["motion"]);
522
+ if (parentProps["motion"] === false || paragraphMotions.length === 0) return [];
523
+ const annotations = [];
524
+ for (const item of paragraphMotions) {
525
+ validateMotionFlag(item.props["motion"]);
526
+ if (item.props["motion"] === false) continue;
527
+ const value = localMotionValue(item.props, {
528
+ ...baseTarget,
529
+ range: {
530
+ type: "paragraph",
531
+ start: item.paragraphIndex,
532
+ end: item.paragraphIndex
533
+ }
534
+ }, item.step);
535
+ const hasTimingProps = value.startAt !== void 0 || value.publishStart !== void 0 || value.publishEnd !== void 0;
536
+ if (value.entries.length === 0 && !hasTimingProps) continue;
537
+ annotations.push({
538
+ capability: "motion",
539
+ optional: false,
540
+ value,
541
+ resolveContributions: resolveMotionContributions
542
+ });
543
+ }
544
+ return annotations;
545
+ }
546
+ /**
547
+ * Converts container motion scope overrides and optional native target animation declarations into
548
+ * local annotations consumed by motion slide capability without inspecting raw container props later.
549
+ */
550
+ function motionContainerAnnotations(props, target, options = {}) {
551
+ validateMotionFlag(props["motion"]);
552
+ const enabled = props["motion"] !== false;
553
+ const propagatesDefaultEnter = options.propagatesDefaultEnter === true;
554
+ const startAt = enabled && props["startAt"] !== void 0 ? validatedTiming(props["startAt"]) : void 0;
555
+ const publishStart = enabled ? validatedPublisher(props["publishStart"]) : void 0;
556
+ const publishEnd = enabled ? validatedPublisher(props["publishEnd"]) : void 0;
557
+ const hasTimingProps = startAt !== void 0 || publishStart !== void 0 || publishEnd !== void 0;
558
+ const hasExplicitMotion = enabled && (props["enter"] !== void 0 || props["emphasis"] !== void 0 || props["exit"] !== void 0 || hasTimingProps || props["motion"] === true);
559
+ const groupsAsParallelUnit = options.groupsAsParallelUnit === true && hasExplicitMotion;
560
+ let defaultEnter;
561
+ if (enabled && propagatesDefaultEnter && props["enter"] !== void 0) defaultEnter = Object.freeze(listed(props["enter"], true).map((effect) => validatedDeclaration(effect, "entrance")));
562
+ const annotations = [];
563
+ if (!enabled || defaultEnter !== void 0 || groupsAsParallelUnit || hasTimingProps) annotations.push({
564
+ capability: "motion",
565
+ optional: !hasTimingProps,
566
+ value: Object.freeze({
567
+ type: "container",
568
+ enabled,
569
+ ...defaultEnter === void 0 ? {} : { defaultEnter },
570
+ ...groupsAsParallelUnit ? { groupsAsParallelUnit: true } : {},
571
+ ...groupsAsParallelUnit ? {
572
+ ...startAt === void 0 ? {} : { startAt },
573
+ ...publishStart === void 0 ? {} : { publishStart },
574
+ ...publishEnd === void 0 ? {} : { publishEnd }
575
+ } : {}
576
+ }),
577
+ resolveContributions: resolveMotionContributions
578
+ });
579
+ if (enabled && target !== void 0) {
580
+ const targetProps = groupsAsParallelUnit ? {
581
+ ...props,
582
+ startAt: void 0,
583
+ publishStart: void 0,
584
+ publishEnd: void 0
585
+ } : props;
586
+ annotations.push(...motionAnnotations(targetProps, target));
587
+ }
588
+ return annotations;
589
+ }
590
+ function isLocalMotionValue(value) {
591
+ return isRecord(value) && isRecord(value["target"]) && typeof value["enterDeclared"] === "boolean" && Array.isArray(value["entries"]);
592
+ }
593
+ function isLocalScopeValue(value) {
594
+ return isRecord(value) && value["type"] === "scope" && isRecord(value["scope"]) && typeof value["scope"]["identity"] === "string" && typeof value["enabled"] === "boolean";
595
+ }
596
+ function isLocalStepValue(value) {
597
+ return isRecord(value) && value["type"] === "step" && isRecord(value["step"]);
598
+ }
599
+ function isLocalContainerValue(value) {
600
+ return isRecord(value) && value["type"] === "container" && typeof value["enabled"] === "boolean";
601
+ }
602
+ /**
603
+ * Resolves local motion declarations against the current declaration tree.
604
+ *
605
+ * Scope parent chains, nearest click step, inherited container default entrance, and disabled
606
+ * ancestor chains are derived from submitted capability annotations along the build's structure.
607
+ * Nothing here is stored on the editable nodes or read from raw container props, so moving or
608
+ * appending content changes the next build's choreography without stale React context.
609
+ *
610
+ * The build passes only this capability's contributions, then uses the effective result for both
611
+ * timing output and missing-capability checks.
612
+ */
613
+ function resolveMotionContributions(children, contributions) {
614
+ const byDeclaration = /* @__PURE__ */ new WeakMap();
615
+ for (const contribution of contributions) {
616
+ const declaration = contribution.declaration;
617
+ if (declaration === void 0) continue;
618
+ const existing = byDeclaration.get(declaration);
619
+ byDeclaration.set(declaration, existing === void 0 ? [contribution] : [...existing, contribution]);
620
+ }
621
+ const resolved = [];
622
+ const visit = (node, frame) => {
623
+ if (!("children" in node)) return;
624
+ const localContributions = byDeclaration.get(node) ?? [];
625
+ let childFrame = frame;
626
+ const stepContribution = localContributions.find((contribution) => isLocalStepValue(contribution.value));
627
+ const scopeContribution = localContributions.find((contribution) => isLocalScopeValue(contribution.value));
628
+ const containerContribution = localContributions.find((contribution) => isLocalContainerValue(contribution.value));
629
+ const localMotionContributions = localContributions.filter((contribution) => isLocalMotionValue(contribution.value));
630
+ if (stepContribution !== void 0) {
631
+ const localStep = stepContribution.value;
632
+ childFrame = {
633
+ ...childFrame,
634
+ step: localStep.step
635
+ };
636
+ }
637
+ if (scopeContribution !== void 0) {
638
+ const local = scopeContribution.value;
639
+ const enabled = childFrame.enabled && local.enabled;
640
+ const parent = childFrame.scopes.at(-1);
641
+ const scope = Object.freeze({
642
+ ...local.scope,
643
+ ...parent === void 0 ? {} : { parent: parent.identity },
644
+ ...childFrame.step === void 0 ? {} : { step: childFrame.step }
645
+ });
646
+ resolved.push(Object.freeze({
647
+ ...scopeContribution,
648
+ value: Object.freeze({
649
+ type: "scope",
650
+ scope
651
+ })
652
+ }));
653
+ childFrame = {
654
+ ...childFrame,
655
+ enabled,
656
+ scopes: Object.freeze([...childFrame.scopes, scope])
657
+ };
658
+ }
659
+ if (containerContribution !== void 0 || localMotionContributions.length > 0) {
660
+ const container = containerContribution?.value;
661
+ const enabled = childFrame.enabled && (container === void 0 || container.enabled);
662
+ const containerHasTiming = container?.startAt !== void 0 || container?.publishStart !== void 0 || container?.publishEnd !== void 0;
663
+ if (enabled && (containerHasTiming || container?.groupsAsParallelUnit === true && childFrame.scopes.length > 0)) {
664
+ const parent = childFrame.scopes.at(-1);
665
+ const implicitScope = Object.freeze({
666
+ identity: createMotionIdentity("scope"),
667
+ ...parent === void 0 ? {} : { parent: parent.identity },
668
+ ...childFrame.step === void 0 ? {} : { step: childFrame.step },
669
+ mode: "parallel",
670
+ delay: 0,
671
+ ...container?.startAt === void 0 ? {} : { startAt: container.startAt },
672
+ ...container?.publishStart === void 0 ? {} : { publishStart: container.publishStart },
673
+ ...container?.publishEnd === void 0 ? {} : { publishEnd: container.publishEnd },
674
+ implicit: true
675
+ });
676
+ resolved.push(Object.freeze({
677
+ ...containerContribution,
678
+ optional: !containerHasTiming,
679
+ value: Object.freeze({
680
+ type: "scope",
681
+ scope: implicitScope
682
+ })
683
+ }));
684
+ childFrame = {
685
+ ...childFrame,
686
+ scopes: Object.freeze([...childFrame.scopes, implicitScope])
687
+ };
688
+ }
689
+ if (enabled) for (const localContribution of localMotionContributions) {
690
+ const local = localContribution.value;
691
+ const isParagraphTarget = local.target.range !== void 0;
692
+ const entries = [...local.enterDeclared || isParagraphTarget ? [] : childFrame.defaultEnter ?? [], ...local.entries];
693
+ const baseStep = local.step ?? childFrame.step;
694
+ const hasLocalTiming = local.startAt !== void 0 || local.publishStart !== void 0 || local.publishEnd !== void 0;
695
+ let targetScopes = childFrame.scopes;
696
+ if (hasLocalTiming && entries.length > 0) {
697
+ const parent = childFrame.scopes.at(-1);
698
+ const implicitScope = Object.freeze({
699
+ identity: createMotionIdentity("scope"),
700
+ ...parent === void 0 ? {} : { parent: parent.identity },
701
+ ...baseStep === void 0 ? {} : { step: baseStep },
702
+ mode: "parallel",
703
+ delay: 0,
704
+ ...local.startAt === void 0 ? {} : { startAt: local.startAt },
705
+ ...local.publishStart === void 0 ? {} : { publishStart: local.publishStart },
706
+ ...local.publishEnd === void 0 ? {} : { publishEnd: local.publishEnd },
707
+ implicit: true
708
+ });
709
+ resolved.push(Object.freeze({
710
+ ...localContribution,
711
+ optional: false,
712
+ value: Object.freeze({
713
+ type: "scope",
714
+ scope: implicitScope
715
+ })
716
+ }));
717
+ targetScopes = Object.freeze([...childFrame.scopes, implicitScope]);
718
+ }
719
+ if (entries.length > 0) {
720
+ const byStepKey = /* @__PURE__ */ new Map();
721
+ for (const entry of entries) {
722
+ const effectiveStep = entry.step ?? baseStep;
723
+ const key = effectiveStep === void 0 ? "auto" : effectiveStep.mode === "automatic" ? `auto:${effectiveStep.identity}` : `explicit:${effectiveStep.number}`;
724
+ const group = byStepKey.get(key) ?? {
725
+ ...effectiveStep === void 0 ? {} : { step: effectiveStep },
726
+ effects: []
727
+ };
728
+ group.effects.push(entry.effect);
729
+ byStepKey.set(key, group);
730
+ }
731
+ for (const group of byStepKey.values()) resolved.push(Object.freeze({
732
+ ...localContribution,
733
+ optional: false,
734
+ value: Object.freeze({
735
+ target: local.target,
736
+ ...group.step === void 0 ? {} : { step: group.step },
737
+ scopes: targetScopes,
738
+ effects: Object.freeze(group.effects)
739
+ })
740
+ }));
741
+ }
742
+ }
743
+ if (container !== void 0) childFrame = {
744
+ ...childFrame,
745
+ enabled,
746
+ ...container.defaultEnter === void 0 ? {} : { defaultEnter: container.defaultEnter }
747
+ };
748
+ }
749
+ for (const child of node.children) visit(child, childFrame);
750
+ };
751
+ for (const node of children) visit(node, {
752
+ enabled: true,
753
+ scopes: []
754
+ });
755
+ return resolved;
756
+ }
757
+ export { after, appear, breathe, collapse, createMotionScopeHandle, createMotionScopeNode, createMotionStepIdentity, createMotionStepNode, disappear, fade, fadeOut, fillColor, floatDown, floatOut, floatUp, fly, flyOut, maxRepeatCount, maximumTimeNodeValue, motionAnnotations, motionContainerAnnotations, motionParagraphAnnotations, motionScopeAnnotation, motionStepAnnotation, onStep, ownerMotionSchema, parseStepDeclarationProps, pickMotionProps, relativeLuminance, repeat, resolveMotionContributions, spin, spinAngleSchema, spinIn, spinOptionsSchema, spinOut, stretch, validateMotionFlag, wipe, wipeOut, zoom, zoomOut };