@dreamboard-games/sdk 0.5.0-alpha.2 → 0.5.0-alpha.4

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 (151) hide show
  1. package/README.md +186 -45
  2. package/dist/board-target-B0QG6OYx.d.ts +8 -0
  3. package/dist/chunk-3JXUL4VN.js +139 -0
  4. package/dist/chunk-3JXUL4VN.js.map +1 -0
  5. package/dist/{chunk-S2JEDVWH.js → chunk-C77SYIVT.js} +6102 -6505
  6. package/dist/chunk-C77SYIVT.js.map +1 -0
  7. package/dist/chunk-DMFVAZI2.js +16 -0
  8. package/dist/chunk-DMFVAZI2.js.map +1 -0
  9. package/dist/chunk-OOFMBCFF.js +1338 -0
  10. package/dist/chunk-OOFMBCFF.js.map +1 -0
  11. package/dist/chunk-UG2Q4NLG.js +590 -0
  12. package/dist/chunk-UG2Q4NLG.js.map +1 -0
  13. package/dist/chunk-XU6WJW6K.js +847 -0
  14. package/dist/chunk-XU6WJW6K.js.map +1 -0
  15. package/dist/diagnostics-B8d5aLad.d.ts +65 -0
  16. package/dist/extract-gVKcB8Og.d.ts +4736 -0
  17. package/dist/index.d.ts +3782 -1
  18. package/dist/index.js +1096 -6
  19. package/dist/index.js.map +1 -1
  20. package/dist/model-vdpLHrxh.d.ts +432 -0
  21. package/dist/react.d.ts +60 -0
  22. package/dist/react.js +208 -0
  23. package/dist/react.js.map +1 -0
  24. package/dist/reducer.d.ts +1244 -78
  25. package/dist/reducer.js +4204 -121
  26. package/dist/reducer.js.map +1 -1
  27. package/dist/testing.d.ts +520 -564
  28. package/dist/testing.js +2451 -915
  29. package/dist/testing.js.map +1 -1
  30. package/dist/types-Bj5ZLTUV.d.ts +114 -0
  31. package/package.json +40 -142
  32. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  33. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  34. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  35. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  36. package/dist/browser-interaction.d.ts +0 -910
  37. package/dist/browser-interaction.js +0 -119
  38. package/dist/browser-interaction.js.map +0 -1
  39. package/dist/chunk-32PFKDV7.js +0 -11705
  40. package/dist/chunk-32PFKDV7.js.map +0 -1
  41. package/dist/chunk-3BAD4VC2.js +0 -263
  42. package/dist/chunk-3BAD4VC2.js.map +0 -1
  43. package/dist/chunk-3SKDNDPG.js +0 -104
  44. package/dist/chunk-3SKDNDPG.js.map +0 -1
  45. package/dist/chunk-5YV2WHJ4.js +0 -25
  46. package/dist/chunk-5YV2WHJ4.js.map +0 -1
  47. package/dist/chunk-ANRB4XKA.js +0 -90
  48. package/dist/chunk-ANRB4XKA.js.map +0 -1
  49. package/dist/chunk-BI4G3PM2.js +0 -1864
  50. package/dist/chunk-BI4G3PM2.js.map +0 -1
  51. package/dist/chunk-EVCLTY4Q.js +0 -935
  52. package/dist/chunk-EVCLTY4Q.js.map +0 -1
  53. package/dist/chunk-GDPKTBUR.js +0 -564
  54. package/dist/chunk-GDPKTBUR.js.map +0 -1
  55. package/dist/chunk-H6VDGFL5.js +0 -2903
  56. package/dist/chunk-H6VDGFL5.js.map +0 -1
  57. package/dist/chunk-LR3ZTWQF.js +0 -5960
  58. package/dist/chunk-LR3ZTWQF.js.map +0 -1
  59. package/dist/chunk-PF7L4BMG.js +0 -117
  60. package/dist/chunk-PF7L4BMG.js.map +0 -1
  61. package/dist/chunk-PN5O6GG2.js +0 -32
  62. package/dist/chunk-PN5O6GG2.js.map +0 -1
  63. package/dist/chunk-PZ5AY32C.js +0 -10
  64. package/dist/chunk-PZ5AY32C.js.map +0 -1
  65. package/dist/chunk-S2JEDVWH.js.map +0 -1
  66. package/dist/chunk-T3ZKNUZ7.js +0 -1
  67. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  68. package/dist/chunk-UGH54WZ2.js +0 -223
  69. package/dist/chunk-UGH54WZ2.js.map +0 -1
  70. package/dist/chunk-VCDWP5VL.js +0 -746
  71. package/dist/chunk-VCDWP5VL.js.map +0 -1
  72. package/dist/chunk-VDXOF4FW.js +0 -69
  73. package/dist/chunk-VDXOF4FW.js.map +0 -1
  74. package/dist/chunk-WHR5UW3F.js +0 -1988
  75. package/dist/chunk-WHR5UW3F.js.map +0 -1
  76. package/dist/chunk-Y75CFE77.js +0 -17
  77. package/dist/chunk-Y75CFE77.js.map +0 -1
  78. package/dist/chunk-Z7QCREWI.js +0 -3435
  79. package/dist/chunk-Z7QCREWI.js.map +0 -1
  80. package/dist/chunk-ZZGN2ATS.js +0 -1941
  81. package/dist/chunk-ZZGN2ATS.js.map +0 -1
  82. package/dist/components-gAbIz7hK.d.ts +0 -1284
  83. package/dist/definitions-BgmV_GhC.d.ts +0 -300
  84. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  85. package/dist/digest.d.ts +0 -8
  86. package/dist/game-CsZScpcn.d.ts +0 -763
  87. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  88. package/dist/index-CcT9Q7N7.d.ts +0 -193
  89. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  90. package/dist/package-set.d.ts +0 -13
  91. package/dist/package-set.js +0 -12
  92. package/dist/package-set.js.map +0 -1
  93. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  94. package/dist/plugin-runtime-contract.d.ts +0 -17
  95. package/dist/plugin-runtime-contract.js +0 -92
  96. package/dist/plugin-runtime-contract.js.map +0 -1
  97. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  98. package/dist/protocol-dYgafTYY.d.ts +0 -314
  99. package/dist/reducer/advanced.d.ts +0 -82
  100. package/dist/reducer/advanced.js +0 -51
  101. package/dist/reducer/advanced.js.map +0 -1
  102. package/dist/reducer-contract.d.ts +0 -11
  103. package/dist/reducer-contract.js +0 -16
  104. package/dist/reducer-contract.js.map +0 -1
  105. package/dist/reference-games/index.d.ts +0 -31
  106. package/dist/reference-games/index.js +0 -48
  107. package/dist/reference-games/index.js.map +0 -1
  108. package/dist/runtime/primitives.d.ts +0 -250
  109. package/dist/runtime/primitives.js +0 -189
  110. package/dist/runtime/primitives.js.map +0 -1
  111. package/dist/runtime/runtime-api.d.ts +0 -2
  112. package/dist/runtime/runtime-api.js +0 -1
  113. package/dist/runtime/runtime-api.js.map +0 -1
  114. package/dist/runtime/workspace-contract.d.ts +0 -392
  115. package/dist/runtime/workspace-contract.js +0 -28
  116. package/dist/runtime/workspace-contract.js.map +0 -1
  117. package/dist/runtime-RJ5orDJU.d.ts +0 -1699
  118. package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
  119. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  120. package/dist/runtime.d.ts +0 -83
  121. package/dist/runtime.js +0 -242
  122. package/dist/runtime.js.map +0 -1
  123. package/dist/schema.d.ts +0 -379
  124. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  125. package/dist/testing-compiler.d.ts +0 -37
  126. package/dist/testing-compiler.js +0 -272
  127. package/dist/testing-compiler.js.map +0 -1
  128. package/dist/testing-runtime.d.ts +0 -119
  129. package/dist/testing-runtime.js +0 -212
  130. package/dist/testing-runtime.js.map +0 -1
  131. package/dist/types-DJj5MJkl.d.ts +0 -256
  132. package/dist/types-DR7DoB1x.d.ts +0 -28
  133. package/dist/types-JWCYHmu7.d.ts +0 -122
  134. package/dist/types.d.ts +0 -1958
  135. package/dist/types.js +0 -14
  136. package/dist/types.js.map +0 -1
  137. package/dist/ui/components.d.ts +0 -17
  138. package/dist/ui/components.js +0 -216
  139. package/dist/ui/components.js.map +0 -1
  140. package/dist/ui/defaults.d.ts +0 -19
  141. package/dist/ui/defaults.js +0 -104
  142. package/dist/ui/defaults.js.map +0 -1
  143. package/dist/ui/player-state.d.ts +0 -2
  144. package/dist/ui/player-state.js +0 -1
  145. package/dist/ui/player-state.js.map +0 -1
  146. package/dist/ui/plugin-styles.css +0 -2
  147. package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
  148. package/dist/ui.d.ts +0 -317
  149. package/dist/ui.js +0 -277
  150. package/dist/ui.js.map +0 -1
  151. package/dist/views-BpuWcOyN.d.ts +0 -1641
@@ -1,746 +0,0 @@
1
- // ../plugin-runtime-contract/dist/chunk-XS3PILAY.js
2
- import { sha256 } from "@noble/hashes/sha2.js";
3
- import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
4
- function canonicalizePluginRuntimeJson(value) {
5
- assertRuntimeJson(value);
6
- return canonicalizeJson(value);
7
- }
8
- function encodeCanonicalPluginRuntimeJson(value) {
9
- return JSON.stringify(canonicalizePluginRuntimeJson(value));
10
- }
11
- function digestPluginRuntimeJson(value) {
12
- return `sha256:${sha256Hex(encodeCanonicalPluginRuntimeJson(value))}`;
13
- }
14
- function canonicalizeJson(value) {
15
- if (value === null || typeof value === "boolean" || typeof value === "string") {
16
- return value;
17
- }
18
- if (typeof value === "number") {
19
- if (!Number.isFinite(value)) {
20
- throw new Error("canonical JSON contains a non-finite number");
21
- }
22
- return value;
23
- }
24
- if (Array.isArray(value)) {
25
- return value.map((item) => canonicalizeJson(item));
26
- }
27
- return Object.fromEntries(
28
- Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, item]) => [key, canonicalizeJson(item)])
29
- );
30
- }
31
- function assertRuntimeJson(value) {
32
- if (value === null || typeof value === "boolean" || typeof value === "string") {
33
- return;
34
- }
35
- if (typeof value === "number") {
36
- if (!Number.isFinite(value)) {
37
- throw new Error("runtime JSON contains a non-finite number");
38
- }
39
- return;
40
- }
41
- if (Array.isArray(value)) {
42
- value.forEach(assertRuntimeJson);
43
- return;
44
- }
45
- if (typeof value === "object") {
46
- Object.values(value).forEach((item) => {
47
- if (item !== void 0) {
48
- assertRuntimeJson(item);
49
- }
50
- });
51
- return;
52
- }
53
- throw new Error(`runtime JSON contains unsupported ${typeof value} value`);
54
- }
55
- function sha256Hex(input) {
56
- return bytesToHex(sha256(utf8ToBytes(input)));
57
- }
58
- function computePluginActionSetVersion(input) {
59
- return digestPluginRuntimeJson({
60
- digestVersion: "plugin-action-set@4",
61
- version: input.version,
62
- availableInteractions: input.availableInteractions
63
- });
64
- }
65
- function digestPluginGameplayFrame(frame) {
66
- return digestPluginRuntimeJson({
67
- digestVersion: "plugin-gameplay-frame@4",
68
- frame
69
- });
70
- }
71
- function digestPluginCommandRequest(command) {
72
- return digestPluginRuntimeJson({
73
- digestVersion: "plugin-command-request@4",
74
- command
75
- });
76
- }
77
-
78
- // ../plugin-runtime-contract/dist/chunk-MLKGABMK.js
79
- var __defProp = Object.defineProperty;
80
- var __export = (target, all) => {
81
- for (var name in all)
82
- __defProp(target, name, { get: all[name], enumerable: true });
83
- };
84
-
85
- // ../plugin-runtime-contract/dist/chunk-DXIML3DB.js
86
- import { z } from "zod";
87
- import { z as z2 } from "zod";
88
- var zod_exports = {};
89
- __export(zod_exports, {
90
- BoardStaticProjectionSchema: () => BoardStaticProjectionSchema,
91
- ContinuationMapSchema: () => ContinuationMapSchema,
92
- ContinuationTokenSchema: () => ContinuationTokenSchema,
93
- DispatchRequestSchema: () => DispatchRequestSchema,
94
- DispatchResultAcceptSchema: () => DispatchResultAcceptSchema,
95
- DispatchResultRejectSchema: () => DispatchResultRejectSchema,
96
- DispatchResultSchema: () => DispatchResultSchema,
97
- DispatchTraceAcceptedClientInputSchema: () => DispatchTraceAcceptedClientInputSchema,
98
- DispatchTraceAppliedEffectSchema: () => DispatchTraceAppliedEffectSchema,
99
- DispatchTraceRngConsumptionSchema: () => DispatchTraceRngConsumptionSchema,
100
- DispatchTraceSchema: () => DispatchTraceSchema,
101
- EffectIdSchema: () => EffectIdSchema,
102
- EffectRollDieSchema: () => EffectRollDieSchema,
103
- EffectSchema: () => EffectSchema,
104
- EffectShufflePlayerZoneSchema: () => EffectShufflePlayerZoneSchema,
105
- EffectShuffleSharedZoneSchema: () => EffectShuffleSharedZoneSchema,
106
- EffectTransitionSchema: () => EffectTransitionSchema,
107
- GameEventDetailSchema: () => GameEventDetailSchema,
108
- GameEventSchema: () => GameEventSchema,
109
- GameGuidanceProjectionSchema: () => GameGuidanceProjectionSchema,
110
- GameInputInteractionSchema: () => GameInputInteractionSchema,
111
- GameInputSchema: () => GameInputSchema,
112
- GameOutcomeReasonSchema: () => GameOutcomeReasonSchema,
113
- GameOutcomeSchema: () => GameOutcomeSchema,
114
- InitializePhaseRequestSchema: () => InitializePhaseRequestSchema,
115
- InitializeRequestSchema: () => InitializeRequestSchema,
116
- InitializeResultSchema: () => InitializeResultSchema,
117
- JsonValueSchema: () => JsonValueSchema,
118
- OutcomeResultSchema: () => OutcomeResultSchema,
119
- OutcomeScoreComponentSchema: () => OutcomeScoreComponentSchema,
120
- OutcomeStandingSchema: () => OutcomeStandingSchema,
121
- OutcomeTieBreakSchema: () => OutcomeTieBreakSchema,
122
- ProjectRequestSchema: () => ProjectRequestSchema,
123
- ProjectionTimingMetadataSchema: () => ProjectionTimingMetadataSchema,
124
- ReduceRequestSchema: () => ReduceRequestSchema,
125
- ReduceResultAcceptSchema: () => ReduceResultAcceptSchema,
126
- ReduceResultRejectSchema: () => ReduceResultRejectSchema,
127
- ReduceResultSchema: () => ReduceResultSchema,
128
- ReducerContractVersionSchema: () => ReducerContractVersionSchema,
129
- ReducerDomainStateSchema: () => ReducerDomainStateSchema,
130
- ReducerFlowStateSchema: () => ReducerFlowStateSchema,
131
- ReducerInputValidationResultSchema: () => ReducerInputValidationResultSchema,
132
- ReducerRuntimeLogEntryAcceptedClientInputSchema: () => ReducerRuntimeLogEntryAcceptedClientInputSchema,
133
- ReducerRuntimeLogEntryAppliedEffectSchema: () => ReducerRuntimeLogEntryAppliedEffectSchema,
134
- ReducerRuntimeLogEntryRngConsumptionSchema: () => ReducerRuntimeLogEntryRngConsumptionSchema,
135
- ReducerRuntimeLogEntrySchema: () => ReducerRuntimeLogEntrySchema,
136
- ReducerRuntimeLogEntryStateCommitSchema: () => ReducerRuntimeLogEntryStateCommitSchema,
137
- ReducerRuntimeStateSchema: () => ReducerRuntimeStateSchema,
138
- ReducerSessionMetaSchema: () => ReducerSessionMetaSchema,
139
- ReducerSessionStateSchema: () => ReducerSessionStateSchema,
140
- ReducerSetupSelectionSchema: () => ReducerSetupSelectionSchema,
141
- RngDrawSchema: () => RngDrawSchema,
142
- RngOperationParameterSchema: () => RngOperationParameterSchema,
143
- RngOperationSchema: () => RngOperationSchema,
144
- RngStateSchema: () => RngStateSchema,
145
- RuntimeSimultaneousCurrentSchema: () => RuntimeSimultaneousCurrentSchema,
146
- RuntimeSimultaneousStateSchema: () => RuntimeSimultaneousStateSchema,
147
- RuntimeSimultaneousSubmissionSchema: () => RuntimeSimultaneousSubmissionSchema,
148
- SchedulerContinuationDependencySchema: () => SchedulerContinuationDependencySchema,
149
- SchedulerFlowAuthorityProjectionSchema: () => SchedulerFlowAuthorityProjectionSchema,
150
- SeatProjectionBundleSchema: () => SeatProjectionBundleSchema,
151
- SeatProjectionSchema: () => SeatProjectionSchema,
152
- SetupGuidanceStepSchema: () => SetupGuidanceStepSchema,
153
- SimultaneousPhaseProjectionSchema: () => SimultaneousPhaseProjectionSchema,
154
- SystemActionEventSchema: () => SystemActionEventSchema,
155
- TransitionRecordSchema: () => TransitionRecordSchema,
156
- ValidateInputRequestSchema: () => ValidateInputRequestSchema
157
- });
158
- var ReducerContractVersionSchema = z.string().regex(new RegExp("^[0-9]+\\.[0-9]+\\.[0-9]+$"));
159
- var EffectIdSchema = z.string().min(1);
160
- var JsonValueSchemaInternal;
161
- JsonValueSchemaInternal = z.lazy(() => z.union([z.record(z.string(), JsonValueSchemaInternal), z.array(JsonValueSchemaInternal), z.string(), z.number(), z.boolean(), z.null()]));
162
- var JsonValueSchema = JsonValueSchemaInternal;
163
- var ContinuationTokenSchema = z.object({ "id": z.string().min(1), "data": JsonValueSchema }).strict();
164
- var ContinuationMapSchema = z.record(z.string(), ContinuationTokenSchema);
165
- var ReducerSetupSelectionSchema = z.object({ "profileId": z.string().min(1), "optionValues": z.record(z.string(), z.union([z.string(), z.null()])) }).strict();
166
- var RngOperationParameterSchema = z.union([z.string(), z.number().finite(), z.boolean()]);
167
- var RngOperationSchema = z.object({ "kind": z.string().min(1), "parameters": z.record(z.string(), RngOperationParameterSchema) }).strict();
168
- var RngDrawSchema = z.object({ "index": z.number().int().gte(0), "cursorBefore": z.number().int().gte(0), "cursorAfter": z.number().int().gte(0), "operation": RngOperationSchema }).strict();
169
- var RngStateSchema = z.object({ "seed": z.union([z.number().refine(Number.isInteger, { message: "Expected integer" }), z.null()]), "cursor": z.number().int(), "trace": z.array(z.string()), "draws": z.array(RngDrawSchema).optional() }).strict();
170
- var ReducerFlowStateSchema = z.object({ "currentPhase": z.string().min(1), "turn": z.number().int(), "round": z.number().int(), "activePlayers": z.array(z.string().min(1)) }).strict();
171
- var RuntimeSimultaneousSubmissionSchema = z.object({ "interactionId": z.string().min(1), "params": JsonValueSchema }).strict();
172
- var RuntimeSimultaneousCurrentSchema = z.object({ "phaseName": z.string().min(1), "actors": z.array(z.string().min(1)), "submissions": z.record(z.string(), RuntimeSimultaneousSubmissionSchema) }).strict();
173
- var RuntimeSimultaneousStateSchema = z.object({ "current": z.union([RuntimeSimultaneousCurrentSchema, z.null()]) }).strict();
174
- var TransitionRecordSchema = z.object({ "from": z.string().min(1), "to": z.string().min(1) }).strict();
175
- var ReducerRuntimeStateSchema = z.object({ "rng": RngStateSchema, "setup": z.union([ReducerSetupSelectionSchema, z.null()]), "simultaneous": RuntimeSimultaneousStateSchema, "lastTransition": z.union([TransitionRecordSchema, z.null()]) }).strict();
176
- var ReducerDomainStateSchema = z.object({ "table": JsonValueSchema, "publicState": JsonValueSchema, "privateState": z.record(z.string(), JsonValueSchema), "hiddenState": JsonValueSchema, "flow": ReducerFlowStateSchema, "phase": JsonValueSchema }).strict();
177
- var ReducerSessionMetaSchema = z.object({ "contractFingerprint": z.string().regex(new RegExp("^cfp[0-9]+:[a-f0-9]{16}$")) }).strict();
178
- var ReducerSessionStateSchema = z.object({ "meta": ReducerSessionMetaSchema.optional(), "domain": ReducerDomainStateSchema, "runtime": ReducerRuntimeStateSchema }).strict();
179
- var GameInputInteractionSchema = z.object({ "kind": z.literal("interaction"), "playerId": z.string().min(1), "interactionId": z.string().min(1), "params": JsonValueSchema }).strict();
180
- var GameInputSchema = z.discriminatedUnion("kind", [GameInputInteractionSchema]);
181
- var EffectTransitionSchema = z.object({ "effectId": EffectIdSchema, "type": z.literal("transition"), "to": z.string().min(1) }).strict();
182
- var EffectRollDieSchema = z.object({ "effectId": EffectIdSchema, "type": z.literal("rollDie"), "dieId": z.string().min(1) }).strict();
183
- var EffectShuffleSharedZoneSchema = z.object({ "effectId": EffectIdSchema, "type": z.literal("shuffleSharedZone"), "zoneId": z.string().min(1) }).strict();
184
- var EffectShufflePlayerZoneSchema = z.object({ "effectId": EffectIdSchema, "type": z.literal("shufflePlayerZone"), "zoneId": z.string().min(1), "playerId": z.string().min(1) }).strict();
185
- var EffectSchema = z.discriminatedUnion("type", [EffectTransitionSchema, EffectRollDieSchema, EffectShuffleSharedZoneSchema, EffectShufflePlayerZoneSchema]);
186
- var ReducerInputValidationResultSchema = z.object({ "valid": z.boolean(), "errorCode": z.string().optional(), "message": z.string().optional() }).strict();
187
- var GameOutcomeReasonSchema = z.object({ "code": z.string().min(1), "message": z.string().min(1).optional() }).strict();
188
- var OutcomeResultSchema = z.enum(["win", "draw", "loss", "eliminated"]);
189
- var OutcomeScoreComponentSchema = z.object({ "id": z.string().min(1), "label": z.string().min(1), "value": z.number().finite() }).strict();
190
- var OutcomeTieBreakSchema = z.object({ "id": z.string().min(1), "label": z.string().min(1), "value": z.union([z.number().finite(), z.string()]) }).strict();
191
- var OutcomeStandingSchema = z.object({ "playerId": z.string().min(1), "rank": z.number().int().gte(1), "result": OutcomeResultSchema, "score": z.number().finite().optional(), "scoreBreakdown": z.array(OutcomeScoreComponentSchema).optional(), "tieBreaks": z.array(OutcomeTieBreakSchema).optional() }).strict();
192
- var GameOutcomeSchema = z.object({ "reason": GameOutcomeReasonSchema, "standings": z.array(OutcomeStandingSchema).min(1) }).strict();
193
- var GameEventDetailSchema = z.object({ "label": z.string().min(1), "value": z.union([z.string(), z.number().finite(), z.boolean()]) }).strict();
194
- var SystemActionEventSchema = z.object({ "kind": z.literal("systemAction"), "procedureId": z.string().min(1), "title": z.string().min(1), "summary": z.string().min(1).optional(), "details": z.array(GameEventDetailSchema).max(16).optional() }).strict();
195
- var GameEventSchema = z.discriminatedUnion("kind", [SystemActionEventSchema]);
196
- var InitializeResultSchema = z.object({ "state": ReducerSessionStateSchema, "terminal": GameOutcomeSchema.optional(), "events": z.array(GameEventSchema).optional() }).strict();
197
- var InitializeRequestSchema = z.object({ "table": JsonValueSchema, "playerIds": z.array(z.string().min(1)), "rngSeed": z.union([z.number().refine(Number.isInteger, { message: "Expected integer" }), z.null()]).optional(), "setup": z.union([ReducerSetupSelectionSchema, z.null()]).optional() }).strict();
198
- var InitializePhaseRequestSchema = z.object({ "state": ReducerSessionStateSchema, "to": z.string().min(1) }).strict();
199
- var ValidateInputRequestSchema = z.object({ "state": ReducerSessionStateSchema, "input": GameInputSchema }).strict();
200
- var ReduceRequestSchema = z.object({ "state": ReducerSessionStateSchema, "input": GameInputSchema }).strict();
201
- var DispatchRequestSchema = z.object({ "state": ReducerSessionStateSchema, "input": GameInputSchema }).strict();
202
- var ReduceResultRejectSchema = z.object({ "kind": z.literal("reject"), "errorCode": z.string().min(1), "message": z.string().optional() }).strict();
203
- var ReduceResultAcceptSchema = z.object({ "kind": z.literal("accept"), "state": ReducerSessionStateSchema, "terminal": GameOutcomeSchema.optional(), "effects": z.array(EffectSchema), "continuations": ContinuationMapSchema, "events": z.array(GameEventSchema).max(32) }).strict();
204
- var ReduceResultSchema = z.discriminatedUnion("kind", [ReduceResultRejectSchema, ReduceResultAcceptSchema]);
205
- var DispatchTraceAcceptedClientInputSchema = z.object({ "kind": z.literal("acceptedClientInput"), "input": GameInputSchema }).strict();
206
- var DispatchTraceAppliedEffectSchema = z.object({ "kind": z.literal("appliedEffect"), "effect": EffectSchema, "continuation": ContinuationTokenSchema.optional() }).strict();
207
- var DispatchTraceRngConsumptionSchema = z.object({ "kind": z.literal("rngConsumption"), "version": z.literal(2), "operation": z.string().min(1), "drawIndex": z.number().int().gte(0), "traceEntry": z.string() }).strict();
208
- var DispatchTraceSchema = z.discriminatedUnion("kind", [DispatchTraceAcceptedClientInputSchema, DispatchTraceAppliedEffectSchema, DispatchTraceRngConsumptionSchema]);
209
- var DispatchResultRejectSchema = z.object({ "kind": z.literal("reject"), "errorCode": z.string().min(1), "message": z.string().optional() }).strict();
210
- var DispatchResultAcceptSchema = z.object({ "kind": z.literal("accept"), "state": ReducerSessionStateSchema, "terminal": GameOutcomeSchema.optional(), "trace": z.array(DispatchTraceSchema), "events": z.array(GameEventSchema).max(32) }).strict();
211
- var DispatchResultSchema = z.discriminatedUnion("kind", [DispatchResultRejectSchema, DispatchResultAcceptSchema]);
212
- var ReducerRuntimeLogEntryAcceptedClientInputSchema = z.object({ "kind": z.literal("acceptedClientInput"), "version": z.number().int(), "input": GameInputSchema }).strict();
213
- var ReducerRuntimeLogEntryAppliedEffectSchema = z.object({ "kind": z.literal("appliedEffect"), "version": z.number().int(), "effect": EffectSchema, "continuation": z.union([ContinuationTokenSchema, z.null()]) }).strict();
214
- var ReducerRuntimeLogEntryRngConsumptionSchema = z.object({ "kind": z.literal("rngConsumption"), "version": z.number().int(), "operation": z.string().min(1), "drawIndex": z.number().int().gte(0).optional(), "traceEntry": z.string() }).strict();
215
- var ReducerRuntimeLogEntryStateCommitSchema = z.object({ "kind": z.literal("stateCommit"), "version": z.number().int(), "state": ReducerSessionStateSchema }).strict();
216
- var ReducerRuntimeLogEntrySchema = z.discriminatedUnion("kind", [ReducerRuntimeLogEntryAcceptedClientInputSchema, ReducerRuntimeLogEntryAppliedEffectSchema, ReducerRuntimeLogEntryRngConsumptionSchema, ReducerRuntimeLogEntryStateCommitSchema]);
217
- var SeatProjectionSchema = z.object({ "view": JsonValueSchema.optional(), "availableInteractionRefs": JsonValueSchema.optional(), "zones": JsonValueSchema.optional() }).strict();
218
- var SimultaneousPhaseProjectionSchema = z.object({ "phaseName": z.string().min(1), "interactionId": z.string().min(1), "actorIds": z.array(z.string().min(1)), "sealedPlayerIds": z.array(z.string().min(1)), "pendingPlayerIds": z.array(z.string().min(1)) }).strict();
219
- var SchedulerContinuationDependencySchema = z.object({ "waiterPlayerId": z.string().min(1), "blockerPlayerIds": z.array(z.string().min(1)) }).strict();
220
- var SchedulerFlowAuthorityProjectionSchema = z.object({ "version": z.literal(1), "activePlayerIds": z.array(z.string().min(1)), "pendingPlayerIds": z.array(z.string().min(1)), "continuationDependencies": z.array(SchedulerContinuationDependencySchema) }).strict();
221
- var SetupGuidanceStepSchema = z.object({ "id": z.string().min(1), "label": z.string().min(1), "description": z.string().optional() }).strict();
222
- var GameGuidanceProjectionSchema = z.object({ "phase": z.object({ "id": z.string().min(1), "label": z.string().min(1), "summary": z.string().optional(), "objective": z.string().optional() }).strict(), "setup": z.object({ "profileId": z.string().min(1), "name": z.string().min(1), "summary": z.string().optional(), "steps": z.array(SetupGuidanceStepSchema) }).strict().optional() }).strict();
223
- var ProjectionTimingMetadataSchema = z.object({ "resolveAvailableInteractionsMs": z.number().finite().gte(0), "resolveViewMs": z.number().finite().gte(0), "resolveZoneHandlesMs": z.number().finite().gte(0), "descriptorHashMs": z.number().finite().gte(0) }).strict();
224
- var SeatProjectionBundleSchema = z.object({ "currentStage": z.union([z.string().min(1), z.null()]).optional(), "stageSeats": z.array(z.string().min(1)).optional(), "simultaneousPhase": z.union([SimultaneousPhaseProjectionSchema, z.null()]).optional(), "schedulerFlow": SchedulerFlowAuthorityProjectionSchema.optional(), "guidance": z.union([GameGuidanceProjectionSchema, z.null()]).optional(), "sharedView": JsonValueSchema.optional(), "interactionsByRef": JsonValueSchema.optional(), "seats": z.record(z.string(), SeatProjectionSchema), "timing": ProjectionTimingMetadataSchema.optional() }).strict();
225
- var ProjectRequestSchema = z.object({ "state": ReducerSessionStateSchema, "playerIds": z.array(z.string().min(1)) }).strict();
226
- var BoardStaticProjectionSchema = z.object({ "view": JsonValueSchema, "hash": z.string().min(1), "manifestVersion": z.string() }).strict();
227
- var DREAMBOARD_PLUGIN_PROTOCOL = "dreamboard-plugin";
228
- var DREAMBOARD_PLUGIN_PROTOCOL_VERSION = 4;
229
- var RuntimeJsonSchema = z2.lazy(
230
- () => z2.union([
231
- z2.null(),
232
- z2.boolean(),
233
- z2.number().finite(),
234
- z2.string(),
235
- z2.array(RuntimeJsonSchema),
236
- z2.record(z2.string(), RuntimeJsonSchema)
237
- ])
238
- );
239
- var BoardStaticProjectionSchema2 = z2.object({
240
- view: RuntimeJsonSchema,
241
- hash: z2.string().optional(),
242
- manifestVersion: z2.string().optional()
243
- }).strict();
244
- var SetupGuidanceStepSchema2 = zod_exports.SetupGuidanceStepSchema;
245
- var GameGuidanceProjectionSchema2 = zod_exports.GameGuidanceProjectionSchema;
246
- var GameEventDetailSchema2 = zod_exports.GameEventDetailSchema;
247
- var SystemActionEventSchema2 = zod_exports.SystemActionEventSchema;
248
- var GameEventSchema2 = zod_exports.GameEventSchema;
249
- var SeatProjectionBundleSchema2 = z2.object({
250
- currentStage: z2.string().nullable().optional(),
251
- stageSeats: z2.array(z2.string()).optional(),
252
- simultaneousPhase: z2.unknown().nullable().optional(),
253
- schedulerFlow: z2.object({
254
- version: z2.literal(1),
255
- activePlayerIds: z2.array(z2.string()),
256
- pendingPlayerIds: z2.array(z2.string()),
257
- continuationDependencies: z2.array(
258
- z2.object({
259
- waiterPlayerId: z2.string(),
260
- blockerPlayerIds: z2.array(z2.string())
261
- }).strict()
262
- )
263
- }).strict().optional(),
264
- guidance: GameGuidanceProjectionSchema2.nullable().optional(),
265
- sharedView: z2.unknown().optional(),
266
- interactionsByRef: z2.record(z2.string(), z2.unknown()).optional(),
267
- seats: z2.record(
268
- z2.string(),
269
- z2.object({
270
- view: z2.unknown().optional(),
271
- availableInteractionRefs: z2.array(z2.string()).optional(),
272
- zones: z2.unknown().optional()
273
- }).strict()
274
- )
275
- }).strict();
276
- var PlayerIdSchema = z2.string().min(1);
277
- var PluginPlayerSummarySchema = z2.object({
278
- playerId: PlayerIdSchema,
279
- displayName: z2.string(),
280
- color: z2.string().optional()
281
- }).strict();
282
- var PluginSessionDescriptorSchema = z2.object({
283
- sessionId: z2.string().min(1),
284
- players: z2.array(PluginPlayerSummarySchema)
285
- }).strict();
286
- var InteractionCommitPolicySchema = z2.discriminatedUnion("mode", [
287
- z2.object({ mode: z2.literal("manual") }).strict(),
288
- z2.object({ mode: z2.literal("autoWhenReady") }).strict()
289
- ]);
290
- var InputSelectionSchema = z2.discriminatedUnion("mode", [
291
- z2.object({ mode: z2.literal("single") }).strict(),
292
- z2.object({
293
- mode: z2.literal("many"),
294
- min: z2.number().int(),
295
- max: z2.number().int().optional(),
296
- distinct: z2.boolean().optional()
297
- }).strict()
298
- ]);
299
- var InputDomainDependencyCaseSchema = z2.lazy(
300
- () => z2.object({
301
- when: z2.record(z2.string(), z2.string()),
302
- domain: InputDomainSchema
303
- }).strict()
304
- );
305
- var InputDomainDependenciesSchema = z2.discriminatedUnion("mode", [
306
- z2.object({
307
- mode: z2.literal("eager"),
308
- dependentCases: z2.array(InputDomainDependencyCaseSchema)
309
- }).strict(),
310
- z2.object({
311
- mode: z2.literal("lazy"),
312
- dependsOn: z2.array(z2.string()),
313
- resolver: z2.object({
314
- interactionKey: z2.string().optional(),
315
- inputKey: z2.string()
316
- }).strict()
317
- }).strict()
318
- ]);
319
- var InputDomainSchema = z2.object({
320
- type: z2.string(),
321
- selection: InputSelectionSchema.optional(),
322
- dependencies: InputDomainDependenciesSchema.optional()
323
- }).catchall(RuntimeJsonSchema);
324
- var InteractionChoiceOptionSchema = z2.object({
325
- value: z2.string().nullable(),
326
- label: z2.string(),
327
- icon: z2.string().optional(),
328
- badge: z2.string().optional(),
329
- description: z2.string().optional(),
330
- disabled: z2.boolean().optional(),
331
- disabledReason: z2.string().optional()
332
- }).strict();
333
- var InteractionInputDescriptorSchema = z2.object({
334
- key: z2.string().min(1),
335
- kind: z2.string().min(1),
336
- domain: InputDomainSchema,
337
- defaultValue: RuntimeJsonSchema.optional()
338
- }).strict();
339
- var InteractionAvailabilitySchema = z2.discriminatedUnion("status", [
340
- z2.object({ status: z2.literal("available") }).strict(),
341
- z2.object({ status: z2.literal("notYourTurn"), reason: z2.string() }).strict(),
342
- z2.object({
343
- status: z2.literal("insufficientResources"),
344
- reason: z2.string(),
345
- missingResources: z2.record(z2.string(), z2.number().finite())
346
- }).strict(),
347
- z2.object({
348
- status: z2.literal("blocked"),
349
- reason: z2.string(),
350
- code: z2.string().optional()
351
- }).strict()
352
- ]);
353
- var InteractionBaseSchema = z2.object({
354
- phaseName: z2.string().min(1),
355
- interactionKey: z2.string().min(1),
356
- interactionId: z2.string().min(1),
357
- label: z2.string().min(1),
358
- help: z2.string().optional(),
359
- zoneId: z2.string().optional(),
360
- zoneIds: z2.array(z2.string()).optional(),
361
- commit: InteractionCommitPolicySchema,
362
- descriptorDigest: z2.string().optional(),
363
- actorSeat: z2.number().int().optional(),
364
- draftDigest: z2.string().optional(),
365
- inputs: z2.array(InteractionInputDescriptorSchema),
366
- cost: z2.record(z2.string(), RuntimeJsonSchema).optional(),
367
- currentResources: z2.record(z2.string(), RuntimeJsonSchema).optional(),
368
- availability: InteractionAvailabilitySchema,
369
- reasons: z2.array(
370
- z2.object({
371
- ruleId: z2.string(),
372
- errorCode: z2.string()
373
- }).strict()
374
- ).optional()
375
- }).strict();
376
- var InteractionContextSchema = z2.object({
377
- to: z2.string().min(1),
378
- title: z2.string().optional(),
379
- payload: z2.record(z2.string(), RuntimeJsonSchema).optional(),
380
- options: z2.array(
381
- z2.object({
382
- id: z2.string(),
383
- label: z2.string().optional()
384
- }).strict()
385
- ).optional()
386
- }).strict();
387
- var InteractionDescriptorSchema = z2.discriminatedUnion("kind", [
388
- InteractionBaseSchema.extend({ kind: z2.literal("action") }).strict(),
389
- InteractionBaseSchema.extend({
390
- kind: z2.literal("prompt"),
391
- context: InteractionContextSchema
392
- }).strict()
393
- ]);
394
- var ZoneHandlesSnapshotSchema = z2.object({
395
- cardIds: z2.array(z2.string()),
396
- cardViewsById: z2.record(z2.string(), z2.string()),
397
- playableByCardId: z2.record(
398
- z2.string(),
399
- z2.array(InteractionDescriptorSchema)
400
- )
401
- }).strict();
402
- var SimultaneousPhaseSnapshotSchema = z2.object({
403
- phaseName: z2.string().min(1),
404
- interactionId: z2.string().min(1),
405
- actorIds: z2.array(PlayerIdSchema),
406
- sealedPlayerIds: z2.array(PlayerIdSchema),
407
- pendingPlayerIds: z2.array(PlayerIdSchema)
408
- }).strict();
409
- var GameplayBasisSchema = z2.object({
410
- version: z2.number().int().nonnegative(),
411
- actionSetVersion: z2.string().min(1),
412
- perspectivePlayerId: PlayerIdSchema
413
- }).strict();
414
- var GameOutcomeSchema2 = z2.object({
415
- reason: z2.object({
416
- code: z2.string().min(1),
417
- message: z2.string().optional()
418
- }).strict(),
419
- standings: z2.array(
420
- z2.object({
421
- playerId: PlayerIdSchema,
422
- rank: z2.number().int().positive(),
423
- result: z2.enum(["win", "draw", "loss", "eliminated"]),
424
- score: z2.number().finite().optional(),
425
- scoreBreakdown: z2.array(
426
- z2.object({
427
- id: z2.string().min(1),
428
- label: z2.string().min(1),
429
- value: z2.number().finite()
430
- }).strict()
431
- ).optional(),
432
- tieBreaks: z2.array(
433
- z2.object({
434
- id: z2.string().min(1),
435
- label: z2.string().min(1),
436
- value: z2.union([z2.number().finite(), z2.string()])
437
- }).strict()
438
- ).optional()
439
- }).strict()
440
- )
441
- }).strict();
442
- var PluginGameplayFrameSchema = z2.object({
443
- basis: GameplayBasisSchema,
444
- view: RuntimeJsonSchema.nullable(),
445
- flow: z2.object({
446
- currentPhase: z2.string().nullable(),
447
- currentStage: z2.string().nullable(),
448
- activePlayers: z2.array(PlayerIdSchema),
449
- simultaneousPhase: SimultaneousPhaseSnapshotSchema.nullable()
450
- }).strict(),
451
- availableInteractions: z2.array(InteractionDescriptorSchema),
452
- guidance: GameGuidanceProjectionSchema2.nullable().optional(),
453
- zones: z2.record(z2.string(), ZoneHandlesSnapshotSchema)
454
- }).strict();
455
- var InteractionResultSchema = z2.discriminatedUnion("accepted", [
456
- z2.object({
457
- type: z2.literal("interaction.result"),
458
- clientActionId: z2.string().min(1),
459
- accepted: z2.literal(true)
460
- }).strict(),
461
- z2.object({
462
- type: z2.literal("interaction.result"),
463
- clientActionId: z2.string().min(1),
464
- accepted: z2.literal(false),
465
- errorCode: z2.string().min(1),
466
- message: z2.string().optional()
467
- }).strict()
468
- ]);
469
- var SubmitInteractionCommandSchema = z2.object({
470
- type: z2.literal("interaction.submit"),
471
- clientActionId: z2.string().min(1),
472
- basis: GameplayBasisSchema,
473
- interactionId: z2.string().min(1),
474
- params: RuntimeJsonSchema
475
- }).strict();
476
- var HostToPluginPayloadSchema = z2.discriminatedUnion("type", [
477
- z2.object({
478
- type: z2.literal("runtime.init"),
479
- session: PluginSessionDescriptorSchema
480
- }).strict(),
481
- z2.object({
482
- type: z2.literal("gameplay.frame"),
483
- frame: PluginGameplayFrameSchema
484
- }).strict(),
485
- InteractionResultSchema
486
- ]);
487
- var PluginToHostPayloadSchema = z2.discriminatedUnion("type", [
488
- z2.object({ type: z2.literal("runtime.ready") }).strict(),
489
- z2.object({
490
- type: z2.literal("runtime.ack"),
491
- sequence: z2.number().int().nonnegative(),
492
- clientReceivedAtMs: z2.number().finite().optional(),
493
- clientRenderedAtMs: z2.number().finite().optional()
494
- }).strict(),
495
- SubmitInteractionCommandSchema,
496
- z2.object({
497
- type: z2.literal("runtime.error"),
498
- message: z2.string(),
499
- code: z2.string().optional()
500
- }).strict()
501
- ]);
502
- function createPluginProtocolEnvelopeSchema(payloadSchema) {
503
- return z2.object({
504
- protocol: z2.literal(DREAMBOARD_PLUGIN_PROTOCOL),
505
- version: z2.literal(DREAMBOARD_PLUGIN_PROTOCOL_VERSION),
506
- channelId: z2.string().min(1),
507
- sequence: z2.number().int().nonnegative(),
508
- payload: payloadSchema
509
- }).strict();
510
- }
511
- var HostToPluginEnvelopeSchema = createPluginProtocolEnvelopeSchema(
512
- HostToPluginPayloadSchema
513
- );
514
- var PluginToHostEnvelopeSchema = createPluginProtocolEnvelopeSchema(
515
- PluginToHostPayloadSchema
516
- );
517
- var PluginProtocolFrameSchema = z2.object({
518
- id: z2.string().min(1),
519
- frame: PluginGameplayFrameSchema,
520
- projectionDigest: z2.string().regex(/^sha256:[a-f0-9]{64}$/)
521
- }).strict();
522
- var PluginProtocolStepSchema = z2.discriminatedUnion("kind", [
523
- z2.object({
524
- id: z2.string().min(1),
525
- kind: z2.literal("host.frame"),
526
- frameId: z2.string().min(1)
527
- }).strict(),
528
- z2.object({
529
- id: z2.string().min(1),
530
- kind: z2.literal("client.submit"),
531
- fromFrameId: z2.string().min(1),
532
- requestDigest: z2.string().regex(/^sha256:[a-f0-9]{64}$/),
533
- response: InteractionResultSchema
534
- }).strict()
535
- ]);
536
- var PluginProtocolTapeSchema = z2.object({
537
- session: PluginSessionDescriptorSchema,
538
- frames: z2.array(PluginProtocolFrameSchema),
539
- steps: z2.array(PluginProtocolStepSchema)
540
- }).strict();
541
- function parsePluginSessionDescriptor(value) {
542
- return PluginSessionDescriptorSchema.parse(value);
543
- }
544
- function parsePluginGameplayFrame(value) {
545
- return PluginGameplayFrameSchema.parse(value);
546
- }
547
- function parseHostToPluginEnvelope(value) {
548
- return HostToPluginEnvelopeSchema.parse(value);
549
- }
550
- function parsePluginToHostEnvelope(value) {
551
- return PluginToHostEnvelopeSchema.parse(value);
552
- }
553
-
554
- // ../plugin-runtime-contract/dist/index.js
555
- function materializePluginGameplayFrame(input) {
556
- const dynamicProjection = SeatProjectionBundleSchema2.parse(
557
- canonicalizeReducerProjection(input.dynamicProjection)
558
- );
559
- const staticProjection = input.staticProjection == null ? null : BoardStaticProjectionSchema2.parse(
560
- canonicalizeReducerProjection(input.staticProjection)
561
- );
562
- const registry = parseInteractionRegistry(
563
- dynamicProjection.interactionsByRef
564
- );
565
- const seat = dynamicProjection.seats[input.perspectivePlayerId] ?? null;
566
- const availableInteractions = seat == null ? [] : hydrateInteractionRefs(
567
- registry,
568
- seat.availableInteractionRefs,
569
- "availableInteractionRefs"
570
- );
571
- const zones = seat?.zones == null ? {} : hydrateZones(registry, seat.zones, "zones");
572
- const frame = {
573
- basis: {
574
- version: input.version,
575
- actionSetVersion: input.actionSetVersion,
576
- perspectivePlayerId: input.perspectivePlayerId
577
- },
578
- view: materializeView(staticProjection, dynamicProjection, seat?.view),
579
- flow: {
580
- currentPhase: input.currentPhase,
581
- currentStage: dynamicProjection.currentStage ?? null,
582
- activePlayers: [...input.activePlayers],
583
- simultaneousPhase: dynamicProjection.simultaneousPhase ?? null
584
- },
585
- availableInteractions,
586
- guidance: dynamicProjection.guidance ?? null,
587
- zones
588
- };
589
- return PluginGameplayFrameSchema.parse(frame);
590
- }
591
- function materializeView(staticProjection, dynamicProjection, seatView) {
592
- const parts = [
593
- staticProjection?.view,
594
- dynamicProjection.sharedView,
595
- seatView
596
- ].filter((part) => part !== void 0 && part !== null);
597
- if (parts.length === 0) return null;
598
- if (parts.every(isRecord)) {
599
- return Object.assign({}, ...parts);
600
- }
601
- return seatView ?? dynamicProjection.sharedView ?? staticProjection?.view ?? null;
602
- }
603
- function canonicalizeReducerProjection(value) {
604
- return canonicalizePluginRuntimeJson(value);
605
- }
606
- function parseInteractionRegistry(value) {
607
- if (value == null) return {};
608
- if (!isRecord(value)) {
609
- throw new Error("Seat projection interactionsByRef must be an object.");
610
- }
611
- return Object.fromEntries(
612
- Object.entries(value).map(([ref, descriptor]) => [
613
- ref,
614
- InteractionDescriptorSchema.parse(descriptor)
615
- ])
616
- );
617
- }
618
- function hydrateZones(registry, value, path) {
619
- if (!isRecord(value)) {
620
- throw new Error(`Seat projection ${path} must be an object.`);
621
- }
622
- return Object.fromEntries(
623
- Object.entries(value).map(([zoneId, zoneValue]) => [
624
- zoneId,
625
- hydrateZone(registry, zoneValue, `${path}.${zoneId}`)
626
- ])
627
- );
628
- }
629
- function hydrateZone(registry, value, path) {
630
- if (!isRecord(value)) {
631
- throw new Error(`Seat projection ${path} must be an object.`);
632
- }
633
- const cardIds = arrayOfStrings(value.cardIds, `${path}.cardIds`);
634
- const cardViewsById = stringRecord(
635
- value.cardViewsById,
636
- `${path}.cardViewsById`
637
- );
638
- if (!isRecord(value.playableByCardId)) {
639
- throw new Error(
640
- `Seat projection ${path}.playableByCardId must be an object.`
641
- );
642
- }
643
- const playableByCardId = Object.fromEntries(
644
- Object.entries(value.playableByCardId).map(([cardId, refs]) => [
645
- cardId,
646
- hydrateInteractionRefs(
647
- registry,
648
- refs,
649
- `${path}.playableByCardId.${cardId}`
650
- )
651
- ])
652
- );
653
- return ZoneHandlesSnapshotSchema.parse({
654
- cardIds,
655
- cardViewsById,
656
- playableByCardId
657
- });
658
- }
659
- function hydrateInteractionRefs(registry, value, path) {
660
- if (!Array.isArray(value)) {
661
- throw new Error(`Seat projection ${path} must be an array of refs.`);
662
- }
663
- return value.map((ref, index) => {
664
- if (typeof ref !== "string") {
665
- throw new Error(
666
- `Seat projection ${path}[${index}] must be a ref string.`
667
- );
668
- }
669
- const descriptor = registry[ref];
670
- if (!descriptor) {
671
- throw new Error(
672
- `Seat projection ${path}[${index}] references '${ref}', which is missing from interactionsByRef.`
673
- );
674
- }
675
- return descriptor;
676
- });
677
- }
678
- function arrayOfStrings(value, path) {
679
- if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
680
- throw new Error(`Seat projection ${path} must be an array of strings.`);
681
- }
682
- return value;
683
- }
684
- function stringRecord(value, path) {
685
- if (!isRecord(value)) {
686
- throw new Error(`Seat projection ${path} must be an object.`);
687
- }
688
- const result = {};
689
- for (const [key, item] of Object.entries(value)) {
690
- if (typeof item !== "string") {
691
- throw new Error(`Seat projection ${path}.${key} must be a string.`);
692
- }
693
- result[key] = item;
694
- }
695
- return result;
696
- }
697
- function isRecord(value) {
698
- return value !== null && typeof value === "object" && !Array.isArray(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
699
- }
700
-
701
- export {
702
- canonicalizePluginRuntimeJson,
703
- encodeCanonicalPluginRuntimeJson,
704
- digestPluginRuntimeJson,
705
- computePluginActionSetVersion,
706
- digestPluginGameplayFrame,
707
- digestPluginCommandRequest,
708
- DREAMBOARD_PLUGIN_PROTOCOL,
709
- DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
710
- RuntimeJsonSchema,
711
- BoardStaticProjectionSchema2,
712
- GameEventDetailSchema2,
713
- SystemActionEventSchema2,
714
- GameEventSchema2,
715
- SeatProjectionBundleSchema2,
716
- PluginPlayerSummarySchema,
717
- PluginSessionDescriptorSchema,
718
- InteractionCommitPolicySchema,
719
- InputDomainDependenciesSchema,
720
- InputDomainSchema,
721
- InteractionInputDescriptorSchema,
722
- InteractionAvailabilitySchema,
723
- InteractionContextSchema,
724
- InteractionDescriptorSchema,
725
- ZoneHandlesSnapshotSchema,
726
- SimultaneousPhaseSnapshotSchema,
727
- GameplayBasisSchema,
728
- GameOutcomeSchema2,
729
- PluginGameplayFrameSchema,
730
- InteractionResultSchema,
731
- SubmitInteractionCommandSchema,
732
- HostToPluginPayloadSchema,
733
- PluginToHostPayloadSchema,
734
- createPluginProtocolEnvelopeSchema,
735
- HostToPluginEnvelopeSchema,
736
- PluginToHostEnvelopeSchema,
737
- PluginProtocolFrameSchema,
738
- PluginProtocolStepSchema,
739
- PluginProtocolTapeSchema,
740
- parsePluginSessionDescriptor,
741
- parsePluginGameplayFrame,
742
- parseHostToPluginEnvelope,
743
- parsePluginToHostEnvelope,
744
- materializePluginGameplayFrame
745
- };
746
- //# sourceMappingURL=chunk-VCDWP5VL.js.map