@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.1-dev.1

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 (289) hide show
  1. package/MIGRATION.md +129 -1
  2. package/README.md +97 -164
  3. package/dist/crowdy-client.d.ts +12 -31
  4. package/dist/crowdy-client.d.ts.map +1 -1
  5. package/dist/crowdy-client.js +15 -37
  6. package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
  7. package/dist/crowdy-dsh/bridge.js +3 -6
  8. package/dist/crowdy-studio/controller.d.ts +34 -59
  9. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  10. package/dist/crowdy-studio/controller.js +96 -225
  11. package/dist/crowdy-studio/diagnostics.d.ts +3 -12
  12. package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
  13. package/dist/crowdy-studio/dom-shell.d.ts +2 -4
  14. package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
  15. package/dist/crowdy-studio/dom-shell.js +16 -49
  16. package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
  17. package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
  18. package/dist/crowdy-studio/embed/panel.d.ts +3 -13
  19. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  20. package/dist/crowdy-studio/embed/panel.js +3 -6
  21. package/dist/crowdy-studio/index.d.ts +1 -3
  22. package/dist/crowdy-studio/index.d.ts.map +1 -1
  23. package/dist/crowdy-studio/index.js +0 -2
  24. package/dist/crowdy-studio/models.d.ts +3 -4
  25. package/dist/crowdy-studio/models.d.ts.map +1 -1
  26. package/dist/crowdy-studio/starter-projects.d.ts +8 -12
  27. package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
  28. package/dist/crowdy-studio/starter-projects.js +12 -103
  29. package/dist/domains/appAccess.d.ts +14 -1
  30. package/dist/domains/appAccess.d.ts.map +1 -1
  31. package/dist/domains/appAccess.js +37 -1
  32. package/dist/domains/apps.d.ts +1 -10
  33. package/dist/domains/apps.d.ts.map +1 -1
  34. package/dist/domains/apps.js +1 -16
  35. package/dist/domains/host.d.ts +3 -3
  36. package/dist/domains/host.js +3 -3
  37. package/dist/domains/hosting.d.ts +0 -6
  38. package/dist/domains/hosting.d.ts.map +1 -1
  39. package/dist/domains/hosting.js +1 -16
  40. package/dist/domains/marketplace.d.ts +9 -70
  41. package/dist/domains/marketplace.d.ts.map +1 -1
  42. package/dist/domains/marketplace.js +9 -120
  43. package/dist/domains/organizations.d.ts +1 -9
  44. package/dist/domains/organizations.d.ts.map +1 -1
  45. package/dist/domains/organizations.js +1 -15
  46. package/dist/domains/payments.d.ts +5 -48
  47. package/dist/domains/payments.d.ts.map +1 -1
  48. package/dist/domains/payments.js +5 -57
  49. package/dist/domains/playerWallet.d.ts +6 -12
  50. package/dist/domains/playerWallet.d.ts.map +1 -1
  51. package/dist/domains/playerWallet.js +6 -21
  52. package/dist/domains/quotas.d.ts +20 -7
  53. package/dist/domains/quotas.d.ts.map +1 -1
  54. package/dist/domains/quotas.js +15 -6
  55. package/dist/domains/users.d.ts +7 -74
  56. package/dist/domains/users.d.ts.map +1 -1
  57. package/dist/domains/users.js +7 -105
  58. package/dist/errors.d.ts +7 -13
  59. package/dist/errors.d.ts.map +1 -1
  60. package/dist/errors.js +6 -10
  61. package/dist/generated/graphql.d.ts +955 -8272
  62. package/dist/generated/graphql.d.ts.map +1 -1
  63. package/dist/generated/graphql.js +5 -329
  64. package/dist/grid-mods/exec-client-halves.d.ts +19 -3
  65. package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
  66. package/dist/grid-mods/exec-client-halves.js +17 -2
  67. package/dist/grid-mods/grid-host-calls.d.ts +29 -17
  68. package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
  69. package/dist/grid-mods/grid-host-calls.js +40 -46
  70. package/dist/grid-mods/mod-runtime.d.ts +18 -11
  71. package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
  72. package/dist/grid-mods/mod-runtime.js +4 -2
  73. package/dist/grid-scope.d.ts +0 -189
  74. package/dist/grid-scope.d.ts.map +1 -1
  75. package/dist/grid-scope.js +0 -70
  76. package/dist/index.d.ts +12 -18
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +10 -16
  79. package/dist/kit/actions.d.ts +5 -9
  80. package/dist/kit/actions.d.ts.map +1 -1
  81. package/dist/kit/actions.js +5 -9
  82. package/dist/kit/index.d.ts +2 -33
  83. package/dist/kit/index.d.ts.map +1 -1
  84. package/dist/kit/index.js +1 -32
  85. package/dist/kit/kit.d.ts +8 -208
  86. package/dist/kit/kit.d.ts.map +1 -1
  87. package/dist/kit/kit.js +5 -163
  88. package/dist/kit/social.d.ts +1 -3
  89. package/dist/kit/social.d.ts.map +1 -1
  90. package/dist/kit/social.js +1 -3
  91. package/dist/kit/wire.d.ts +16 -5
  92. package/dist/kit/wire.d.ts.map +1 -1
  93. package/dist/kit/wire.js +19 -5
  94. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  95. package/dist/live-coding/assets/manifest.json +1 -1
  96. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  97. package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
  98. package/dist/live-coding/rust-analysis.d.ts.map +1 -1
  99. package/dist/live-coding/rust-analysis.js +30 -34
  100. package/dist/player-runtime/client-host-calls.d.ts +8 -0
  101. package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
  102. package/dist/player-runtime/client-host-calls.js +28 -0
  103. package/dist/player-runtime/glue-runtime.d.ts +24 -20
  104. package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
  105. package/dist/player-runtime/glue-runtime.js +26 -55
  106. package/dist/player-runtime/glue-sab.d.ts +2 -2
  107. package/dist/player-runtime/glue-sab.js +2 -2
  108. package/dist/player-runtime/player-code-broker.d.ts +70 -43
  109. package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
  110. package/dist/player-runtime/player-code-broker.js +159 -64
  111. package/dist/player-runtime/player-glue-worker.d.ts +8 -9
  112. package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
  113. package/dist/player-runtime/player-glue-worker.js +26 -11
  114. package/dist/stores/inbox.d.ts +1 -1
  115. package/dist/stores/inbox.d.ts.map +1 -1
  116. package/dist/stores/index.d.ts +0 -11
  117. package/dist/stores/index.d.ts.map +1 -1
  118. package/dist/stores/index.js +0 -4
  119. package/dist/stores/session.d.ts +0 -2
  120. package/dist/stores/session.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
  123. package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
  124. package/dist/crowdy-studio/model-lint-log.js +0 -93
  125. package/dist/crowdy-studio/model-lint.d.ts +0 -61
  126. package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
  127. package/dist/crowdy-studio/model-lint.js +0 -45
  128. package/dist/domains/compute.d.ts +0 -208
  129. package/dist/domains/compute.d.ts.map +0 -1
  130. package/dist/domains/compute.js +0 -274
  131. package/dist/domains/controlPlane.d.ts +0 -38
  132. package/dist/domains/controlPlane.d.ts.map +0 -1
  133. package/dist/domains/controlPlane.js +0 -43
  134. package/dist/domains/gameModel.d.ts +0 -1174
  135. package/dist/domains/gameModel.d.ts.map +0 -1
  136. package/dist/domains/gameModel.js +0 -1333
  137. package/dist/domains/playerCompute.d.ts +0 -91
  138. package/dist/domains/playerCompute.d.ts.map +0 -1
  139. package/dist/domains/playerCompute.js +0 -136
  140. package/dist/domains/playerModel.d.ts +0 -20
  141. package/dist/domains/playerModel.d.ts.map +0 -1
  142. package/dist/domains/playerModel.js +0 -54
  143. package/dist/kit/abilities.d.ts +0 -66
  144. package/dist/kit/abilities.d.ts.map +0 -1
  145. package/dist/kit/abilities.js +0 -71
  146. package/dist/kit/blueprints/combat.d.ts +0 -81
  147. package/dist/kit/blueprints/combat.d.ts.map +0 -1
  148. package/dist/kit/blueprints/combat.js +0 -357
  149. package/dist/kit/blueprints/core.d.ts +0 -222
  150. package/dist/kit/blueprints/core.d.ts.map +0 -1
  151. package/dist/kit/blueprints/core.js +0 -185
  152. package/dist/kit/blueprints/decks.d.ts +0 -50
  153. package/dist/kit/blueprints/decks.d.ts.map +0 -1
  154. package/dist/kit/blueprints/decks.js +0 -163
  155. package/dist/kit/blueprints/economy.d.ts +0 -88
  156. package/dist/kit/blueprints/economy.d.ts.map +0 -1
  157. package/dist/kit/blueprints/economy.js +0 -533
  158. package/dist/kit/blueprints/guild.d.ts +0 -51
  159. package/dist/kit/blueprints/guild.d.ts.map +0 -1
  160. package/dist/kit/blueprints/guild.js +0 -50
  161. package/dist/kit/blueprints/index.d.ts +0 -23
  162. package/dist/kit/blueprints/index.d.ts.map +0 -1
  163. package/dist/kit/blueprints/index.js +0 -22
  164. package/dist/kit/blueprints/inventory.d.ts +0 -84
  165. package/dist/kit/blueprints/inventory.d.ts.map +0 -1
  166. package/dist/kit/blueprints/inventory.js +0 -257
  167. package/dist/kit/blueprints/leaderboards.d.ts +0 -49
  168. package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
  169. package/dist/kit/blueprints/leaderboards.js +0 -126
  170. package/dist/kit/blueprints/liveops.d.ts +0 -42
  171. package/dist/kit/blueprints/liveops.d.ts.map +0 -1
  172. package/dist/kit/blueprints/liveops.js +0 -170
  173. package/dist/kit/blueprints/locks.d.ts +0 -82
  174. package/dist/kit/blueprints/locks.d.ts.map +0 -1
  175. package/dist/kit/blueprints/locks.js +0 -155
  176. package/dist/kit/blueprints/loot.d.ts +0 -90
  177. package/dist/kit/blueprints/loot.d.ts.map +0 -1
  178. package/dist/kit/blueprints/loot.js +0 -229
  179. package/dist/kit/blueprints/matches.d.ts +0 -84
  180. package/dist/kit/blueprints/matches.d.ts.map +0 -1
  181. package/dist/kit/blueprints/matches.js +0 -349
  182. package/dist/kit/blueprints/moderation.d.ts +0 -32
  183. package/dist/kit/blueprints/moderation.d.ts.map +0 -1
  184. package/dist/kit/blueprints/moderation.js +0 -140
  185. package/dist/kit/blueprints/npcs.d.ts +0 -78
  186. package/dist/kit/blueprints/npcs.d.ts.map +0 -1
  187. package/dist/kit/blueprints/npcs.js +0 -125
  188. package/dist/kit/blueprints/plots.d.ts +0 -63
  189. package/dist/kit/blueprints/plots.d.ts.map +0 -1
  190. package/dist/kit/blueprints/plots.js +0 -151
  191. package/dist/kit/blueprints/progression.d.ts +0 -68
  192. package/dist/kit/blueprints/progression.d.ts.map +0 -1
  193. package/dist/kit/blueprints/progression.js +0 -324
  194. package/dist/kit/blueprints/quests.d.ts +0 -72
  195. package/dist/kit/blueprints/quests.d.ts.map +0 -1
  196. package/dist/kit/blueprints/quests.js +0 -285
  197. package/dist/kit/blueprints/worldsim.d.ts +0 -91
  198. package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
  199. package/dist/kit/blueprints/worldsim.js +0 -468
  200. package/dist/kit/combat.d.ts +0 -141
  201. package/dist/kit/combat.d.ts.map +0 -1
  202. package/dist/kit/combat.js +0 -196
  203. package/dist/kit/decks.d.ts +0 -157
  204. package/dist/kit/decks.d.ts.map +0 -1
  205. package/dist/kit/decks.js +0 -186
  206. package/dist/kit/director.d.ts +0 -88
  207. package/dist/kit/director.d.ts.map +0 -1
  208. package/dist/kit/director.js +0 -86
  209. package/dist/kit/economy.d.ts +0 -289
  210. package/dist/kit/economy.d.ts.map +0 -1
  211. package/dist/kit/economy.js +0 -427
  212. package/dist/kit/engine.d.ts +0 -48
  213. package/dist/kit/engine.d.ts.map +0 -1
  214. package/dist/kit/engine.js +0 -113
  215. package/dist/kit/features.d.ts +0 -60
  216. package/dist/kit/features.d.ts.map +0 -1
  217. package/dist/kit/features.js +0 -65
  218. package/dist/kit/instances.d.ts +0 -52
  219. package/dist/kit/instances.d.ts.map +0 -1
  220. package/dist/kit/instances.js +0 -60
  221. package/dist/kit/inventory.d.ts +0 -129
  222. package/dist/kit/inventory.d.ts.map +0 -1
  223. package/dist/kit/inventory.js +0 -200
  224. package/dist/kit/leaderboards.d.ts +0 -86
  225. package/dist/kit/leaderboards.d.ts.map +0 -1
  226. package/dist/kit/leaderboards.js +0 -133
  227. package/dist/kit/liveops.d.ts +0 -112
  228. package/dist/kit/liveops.d.ts.map +0 -1
  229. package/dist/kit/liveops.js +0 -183
  230. package/dist/kit/loot.d.ts +0 -128
  231. package/dist/kit/loot.d.ts.map +0 -1
  232. package/dist/kit/loot.js +0 -160
  233. package/dist/kit/matches.d.ts +0 -301
  234. package/dist/kit/matches.d.ts.map +0 -1
  235. package/dist/kit/matches.js +0 -458
  236. package/dist/kit/matchmaking.d.ts +0 -57
  237. package/dist/kit/matchmaking.d.ts.map +0 -1
  238. package/dist/kit/matchmaking.js +0 -59
  239. package/dist/kit/minigames.d.ts +0 -30
  240. package/dist/kit/minigames.d.ts.map +0 -1
  241. package/dist/kit/minigames.js +0 -38
  242. package/dist/kit/mobs.d.ts +0 -90
  243. package/dist/kit/mobs.d.ts.map +0 -1
  244. package/dist/kit/mobs.js +0 -98
  245. package/dist/kit/moderation.d.ts +0 -73
  246. package/dist/kit/moderation.d.ts.map +0 -1
  247. package/dist/kit/moderation.js +0 -103
  248. package/dist/kit/movement.d.ts +0 -78
  249. package/dist/kit/movement.d.ts.map +0 -1
  250. package/dist/kit/movement.js +0 -103
  251. package/dist/kit/notifications.d.ts +0 -45
  252. package/dist/kit/notifications.d.ts.map +0 -1
  253. package/dist/kit/notifications.js +0 -67
  254. package/dist/kit/npcs.d.ts +0 -226
  255. package/dist/kit/npcs.d.ts.map +0 -1
  256. package/dist/kit/npcs.js +0 -141
  257. package/dist/kit/objects.d.ts +0 -116
  258. package/dist/kit/objects.d.ts.map +0 -1
  259. package/dist/kit/objects.js +0 -119
  260. package/dist/kit/pets.d.ts +0 -85
  261. package/dist/kit/pets.d.ts.map +0 -1
  262. package/dist/kit/pets.js +0 -96
  263. package/dist/kit/plots.d.ts +0 -85
  264. package/dist/kit/plots.d.ts.map +0 -1
  265. package/dist/kit/plots.js +0 -113
  266. package/dist/kit/progression.d.ts +0 -181
  267. package/dist/kit/progression.d.ts.map +0 -1
  268. package/dist/kit/progression.js +0 -265
  269. package/dist/kit/quests.d.ts +0 -171
  270. package/dist/kit/quests.d.ts.map +0 -1
  271. package/dist/kit/quests.js +0 -237
  272. package/dist/kit/racing.d.ts +0 -85
  273. package/dist/kit/racing.d.ts.map +0 -1
  274. package/dist/kit/racing.js +0 -99
  275. package/dist/kit/shared.d.ts +0 -73
  276. package/dist/kit/shared.d.ts.map +0 -1
  277. package/dist/kit/shared.js +0 -101
  278. package/dist/kit/telemetry.d.ts +0 -66
  279. package/dist/kit/telemetry.d.ts.map +0 -1
  280. package/dist/kit/telemetry.js +0 -133
  281. package/dist/kit/territory.d.ts +0 -97
  282. package/dist/kit/territory.d.ts.map +0 -1
  283. package/dist/kit/territory.js +0 -114
  284. package/dist/kit/worldsim.d.ts +0 -263
  285. package/dist/kit/worldsim.d.ts.map +0 -1
  286. package/dist/kit/worldsim.js +0 -268
  287. package/dist/stores/model.d.ts +0 -81
  288. package/dist/stores/model.d.ts.map +0 -1
  289. package/dist/stores/model.js +0 -163
@@ -1,65 +0,0 @@
1
- import { featureGate } from './blueprints/index.js';
2
- /**
3
- * Runtime **monetization** helpers — the app feature/tier surface in shop
4
- * terms. Features are string keys (`'vip'`, `'land_owner'`, `'battle_pass'`)
5
- * defined per app and granted to **access tiers** (the management-side
6
- * `appAccess` tiers players buy/hold); any model function whose policy
7
- * carries a `tier_feature` leaf then admits only players on a granted tier.
8
- *
9
- * Gate blueprint functions by composing {@link gate} (=`featureGate`) into a
10
- * builder's `*policyExtra` option, e.g.
11
- * `plotBlueprint({ buyPolicyExtra: kit.features.gate('land_owner') })`.
12
- *
13
- * All methods require the app-admin `manage_apps` permission.
14
- *
15
- * Obtained via `client.kit(appId).features`.
16
- */
17
- export class FeaturesKit {
18
- constructor(appId, gameModel) {
19
- this.appId = appId;
20
- this.gameModel = gameModel;
21
- }
22
- /** Define (or re-describe) a feature key for the app. */
23
- async define(featureKey, description) {
24
- return this.gameModel.defineFeature({
25
- appId: this.appId,
26
- featureKey,
27
- ...(description !== undefined ? { description } : {}),
28
- });
29
- }
30
- /** List the app's defined feature keys. */
31
- async list() {
32
- return this.gameModel.features({ appId: this.appId });
33
- }
34
- /** Grant a feature to an access tier (its holders pass `tier_feature` checks). */
35
- async grantToTier(tierId, featureKey) {
36
- return this.gameModel.grantTierFeature({
37
- appId: this.appId,
38
- tierId,
39
- featureKey,
40
- });
41
- }
42
- /** Revoke a feature from an access tier. */
43
- async revokeFromTier(tierId, featureKey) {
44
- return this.gameModel.revokeTierFeature({
45
- appId: this.appId,
46
- tierId,
47
- featureKey,
48
- });
49
- }
50
- /** List tier→feature grants (optionally for one tier). */
51
- async tierFeatures(tierId) {
52
- return this.gameModel.tierFeatures({
53
- appId: this.appId,
54
- ...(tierId !== undefined ? { tierId } : {}),
55
- });
56
- }
57
- /**
58
- * A `tier_feature` policy leaf for `feature` — pass it to any blueprint
59
- * builder's `*policyExtra` option to monetization-gate that function.
60
- * (Also exported standalone as `featureGate`.)
61
- */
62
- gate(feature) {
63
- return featureGate(feature);
64
- }
65
- }
@@ -1,52 +0,0 @@
1
- import type { Scalars } from '../generated/graphql.js';
2
- import type { EngineDetector } from './engine.js';
3
- /** Options for {@link InstancesKit}. */
4
- export interface InstancesKitOptions {
5
- /** The instance-engine module name. Defaults to `'instance-engine'`. */
6
- moduleName?: string;
7
- }
8
- /** A parsed instance (private world slice). */
9
- export interface KitInstance {
10
- instanceId: string;
11
- name: string;
12
- creator: string;
13
- members: string[];
14
- /** Decimal string (u64 seeds exceed JS safe integers). */
15
- seed: string;
16
- status: string;
17
- outcome: string;
18
- sessionId: string;
19
- containerId: string;
20
- /** Reserved chunk-volume corner [x, y, z]. */
21
- chunkBase: [number, number, number];
22
- volumeChunks: number;
23
- }
24
- /**
25
- * Runtime helpers for the instance-engine (Wave 2): private world slices
26
- * with lifecycle (open/join/complete), per-run seeds for deterministic
27
- * procedural content, and reserved disjoint chunk volumes. v1 spatial
28
- * isolation is by-convention (disjoint volumes + distance-scoped emits).
29
- *
30
- * Obtained via `client.kit(appId).instances`.
31
- */
32
- export declare class InstancesKit {
33
- private readonly engines;
34
- private readonly moduleName;
35
- constructor(_appId: Scalars['BigInt']['input'], engines: EngineDetector, options?: InstancesKitOptions);
36
- /** Is the instance engine deployed + enabled (cached per session)? */
37
- engineAvailable(): Promise<boolean>;
38
- /** Open a new instance (caller becomes creator + first member). */
39
- open(input?: {
40
- name?: string;
41
- seed?: string;
42
- sessionId?: string;
43
- }): Promise<KitInstance>;
44
- /** Join an open instance. */
45
- join(instanceId: string): Promise<KitInstance>;
46
- /** Complete an instance (member-only; announces `instance_completed`). */
47
- complete(instanceId: string, outcome?: string): Promise<KitInstance>;
48
- /** One instance's state (or the engine's totals without an id). */
49
- state(instanceId?: string): Promise<KitInstance | Record<string, unknown>>;
50
- private invoke;
51
- }
52
- //# sourceMappingURL=instances.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/kit/instances.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAEtE,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,+CAA+C;AAC/C,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,CAAC;CACtB;AAsBD;;;;;;;GAOG;AACH,qBAAa,YAAY;IAKrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAGlC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjB,OAAO,EAAE,cAAc,EACxC,OAAO,GAAE,mBAAwB;IAKnC,sEAAsE;IACtE,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC,mEAAmE;IAC7D,IAAI,CAAC,KAAK,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAKlG,6BAA6B;IACvB,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAKpD,0EAA0E;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAK1E,mEAAmE;IAC7D,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAKlE,MAAM;CAUrB"}
@@ -1,60 +0,0 @@
1
- function toInstance(body) {
2
- return {
3
- instanceId: String(body.instanceId ?? ''),
4
- name: String(body.name ?? ''),
5
- creator: String(body.creator ?? ''),
6
- members: Array.isArray(body.members) ? body.members.map(String) : [],
7
- seed: String(body.seed ?? '0'),
8
- status: String(body.status ?? ''),
9
- outcome: String(body.outcome ?? ''),
10
- sessionId: String(body.sessionId ?? ''),
11
- containerId: String(body.containerId ?? ''),
12
- chunkBase: (Array.isArray(body.chunkBase) ? body.chunkBase : [0, 0, 0]).map(Number),
13
- volumeChunks: Number(body.volumeChunks ?? 0),
14
- };
15
- }
16
- /**
17
- * Runtime helpers for the instance-engine (Wave 2): private world slices
18
- * with lifecycle (open/join/complete), per-run seeds for deterministic
19
- * procedural content, and reserved disjoint chunk volumes. v1 spatial
20
- * isolation is by-convention (disjoint volumes + distance-scoped emits).
21
- *
22
- * Obtained via `client.kit(appId).instances`.
23
- */
24
- export class InstancesKit {
25
- constructor(_appId, engines, options = {}) {
26
- this.engines = engines;
27
- this.moduleName = options.moduleName ?? 'instance-engine';
28
- }
29
- /** Is the instance engine deployed + enabled (cached per session)? */
30
- engineAvailable() {
31
- return this.engines.has(this.moduleName);
32
- }
33
- /** Open a new instance (caller becomes creator + first member). */
34
- async open(input = {}) {
35
- const result = await this.invoke('open', input);
36
- return toInstance(result.body);
37
- }
38
- /** Join an open instance. */
39
- async join(instanceId) {
40
- const result = await this.invoke('join', { instanceId });
41
- return toInstance(result.body);
42
- }
43
- /** Complete an instance (member-only; announces `instance_completed`). */
44
- async complete(instanceId, outcome) {
45
- const result = await this.invoke('complete', { instanceId, outcome });
46
- return toInstance(result.body);
47
- }
48
- /** One instance's state (or the engine's totals without an id). */
49
- async state(instanceId) {
50
- const result = await this.invoke('state', instanceId ? { instanceId } : {});
51
- return instanceId ? toInstance(result.body) : result.body;
52
- }
53
- async invoke(exportName, params) {
54
- const result = await this.engines.invoke(this.moduleName, exportName, params);
55
- if (!result.success) {
56
- throw new Error(`instances.${exportName} failed: ${result.reason ?? 'unknown'}`);
57
- }
58
- return result;
59
- }
60
- }
@@ -1,129 +0,0 @@
1
- import type { GameModelAPI } from '../domains/gameModel.js';
2
- import type { Scalars } from '../generated/graphql.js';
3
- import { type KitOwnerIdKind } from './blueprints/index.js';
4
- import { type KitInvokeResult } from './shared.js';
5
- /** Options for {@link InventoryKit}. Must match the deployed blueprint's options. */
6
- export interface InventoryKitOptions {
7
- /** The `typePrefix` the inventory blueprint was deployed with. */
8
- typePrefix?: string;
9
- /** Must match inventoryBlueprint.ownerIdKind. Defaults to `int`. */
10
- ownerIdKind?: KitOwnerIdKind;
11
- }
12
- /** A parsed view of one item stack. */
13
- export interface KitItemStack {
14
- containerId: string;
15
- displayName: string;
16
- ownerUserId: string | null;
17
- itemId: string;
18
- quantity: number;
19
- slot: number;
20
- }
21
- /**
22
- * Runtime helpers for the {@link inventoryBlueprint} conventions: find or
23
- * create the player's inventory, list stacks, and mutate them through the
24
- * owner-gated model functions. All state lives server-side; every mutation is
25
- * authority-checked and atomic.
26
- *
27
- * Obtained via `client.kit(appId).inventory`.
28
- */
29
- export declare class InventoryKit {
30
- private readonly appId;
31
- private readonly gameModel;
32
- private readonly names;
33
- private readonly typePrefix;
34
- private readonly ownerIdKind;
35
- constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, options?: InventoryKitOptions);
36
- /**
37
- * Find the caller's inventory container, creating it when absent. The
38
- * server assigns ownership to the caller (the type is member-instantiable
39
- * and `ownerUserId` is omitted on create).
40
- *
41
- * @param ownerUserId - The calling player's user id (a decimal string, e.g.
42
- * from `client.users.me()`), used to recognize an existing inventory.
43
- */
44
- ensure(ownerUserId: Scalars['BigInt']['input'], options?: {
45
- displayName?: string;
46
- sessionId?: string;
47
- }): Promise<{
48
- __typename?: "GmContainer";
49
- containerId: string;
50
- appId: string;
51
- sessionId: string | null;
52
- typeName: string;
53
- displayName: string;
54
- description: string | null;
55
- ownerUserId: string | null;
56
- metadataJson: string;
57
- }>;
58
- /**
59
- * List a player's item stacks with parsed properties (`itemId`, `quantity`,
60
- * `slot`). Fetches each stack's visible state in parallel.
61
- */
62
- stacks(ownerUserId: Scalars['BigInt']['input']): Promise<KitItemStack[]>;
63
- /**
64
- * Create a new stack owned by the caller (server-assigned ownership).
65
- * Use {@link grant} afterwards for authority-checked increments; the initial
66
- * quantity here is a seed value on a container the caller owns anyway.
67
- *
68
- * Pass `ownerUserId` (the caller's own user id) to also set the
69
- * `owner_user_id` mirror property that cross-container guards (economy
70
- * trades / market listings) verify.
71
- */
72
- createStack(input: {
73
- itemId: string;
74
- quantity?: number;
75
- slot?: number;
76
- displayName?: string;
77
- sessionId?: string;
78
- ownerUserId?: Scalars['BigInt']['input'];
79
- }): Promise<{
80
- __typename?: "GmContainer";
81
- containerId: string;
82
- appId: string;
83
- sessionId: string | null;
84
- typeName: string;
85
- displayName: string;
86
- description: string | null;
87
- ownerUserId: string | null;
88
- metadataJson: string;
89
- }>;
90
- /** Add items to a stack the caller owns. Resolves with the new quantity. */
91
- grant(stackId: string, amount: number): Promise<KitInvokeResult<number>>;
92
- /**
93
- * Spend items from a stack the caller owns. The server refuses to overdraw
94
- * (`success: false`, nothing written). Resolves with the new quantity.
95
- */
96
- consume(stackId: string, amount: number): Promise<KitInvokeResult<number>>;
97
- /** Move a stack to another slot. Resolves with the new (clamped) slot. */
98
- move(stackId: string, toSlot: number): Promise<KitInvokeResult<number>>;
99
- /**
100
- * Atomically move items between two stacks of the same item type — both
101
- * writes commit or neither does. The caller must own the source stack.
102
- * Resolves with the source stack's remaining quantity.
103
- */
104
- transfer(fromStackId: string, toStackId: string, amount: number): Promise<KitInvokeResult<number>>;
105
- /**
106
- * Atomically craft a recipe generated by inventoryBlueprint: every input
107
- * decrement and the output grant commit together. A failed guard writes
108
- * nothing. `inputStackIds` must follow the recipe input order.
109
- */
110
- craft(inventoryId: string, recipeId: string, inputStackIds: string[], outputStackId: string): Promise<KitInvokeResult<number>>;
111
- /** Atomically execute a generated item-for-item barter offer. */
112
- barter(inventoryId: string, barterId: string, payStackId: string, receiveStackId: string): Promise<KitInvokeResult<number>>;
113
- /**
114
- * Record that a stack belongs to an inventory with an
115
- * `inventory_contains` edge, so {@link contents} can read the whole bag in
116
- * one traversal.
117
- */
118
- linkStack(inventoryId: string, stackId: string): Promise<{
119
- __typename?: "GmEdge";
120
- edgeId: string;
121
- fromContainerId: string;
122
- toContainerId: string;
123
- relationshipType: string;
124
- weight: number | null;
125
- }>;
126
- /** Read every stack linked to an inventory (via `inventory_contains` edges). */
127
- contents(inventoryId: string): Promise<KitItemStack[]>;
128
- }
129
- //# sourceMappingURL=inventory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inventory.d.ts","sourceRoot":"","sources":["../../src/kit/inventory.ts"],"names":[],"mappings":"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"}
@@ -1,200 +0,0 @@
1
- import { inventoryBarterFunctionName, inventoryCraftFunctionName, inventoryNames, } from './blueprints/index.js';
2
- import { kitContainerProperties, kitInvoke, } from './shared.js';
3
- /**
4
- * Runtime helpers for the {@link inventoryBlueprint} conventions: find or
5
- * create the player's inventory, list stacks, and mutate them through the
6
- * owner-gated model functions. All state lives server-side; every mutation is
7
- * authority-checked and atomic.
8
- *
9
- * Obtained via `client.kit(appId).inventory`.
10
- */
11
- export class InventoryKit {
12
- constructor(appId, gameModel, options = {}) {
13
- this.appId = appId;
14
- this.gameModel = gameModel;
15
- this.typePrefix = options.typePrefix ?? '';
16
- this.ownerIdKind = options.ownerIdKind ?? 'int';
17
- this.names = inventoryNames(this.typePrefix);
18
- }
19
- /**
20
- * Find the caller's inventory container, creating it when absent. The
21
- * server assigns ownership to the caller (the type is member-instantiable
22
- * and `ownerUserId` is omitted on create).
23
- *
24
- * @param ownerUserId - The calling player's user id (a decimal string, e.g.
25
- * from `client.users.me()`), used to recognize an existing inventory.
26
- */
27
- async ensure(ownerUserId, options = {}) {
28
- const existing = await this.gameModel.containers({
29
- appId: this.appId,
30
- typeName: this.names.inventoryType,
31
- ...(options.sessionId !== undefined ? { sessionId: options.sessionId } : {}),
32
- });
33
- const mine = existing.find((c) => c.ownerUserId != null && String(c.ownerUserId) === String(ownerUserId));
34
- if (mine)
35
- return mine;
36
- return this.gameModel.createContainer({
37
- appId: this.appId,
38
- typeName: this.names.inventoryType,
39
- displayName: options.displayName ?? `Inventory ${ownerUserId}`,
40
- ...(options.sessionId !== undefined ? { sessionId: options.sessionId } : {}),
41
- });
42
- }
43
- /**
44
- * List a player's item stacks with parsed properties (`itemId`, `quantity`,
45
- * `slot`). Fetches each stack's visible state in parallel.
46
- */
47
- async stacks(ownerUserId) {
48
- const containers = await this.gameModel.containers({
49
- appId: this.appId,
50
- typeName: this.names.stackType,
51
- });
52
- const mine = containers.filter((c) => c.ownerUserId != null && String(c.ownerUserId) === String(ownerUserId));
53
- return Promise.all(mine.map(async (c) => {
54
- const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
55
- return {
56
- containerId: c.containerId,
57
- displayName: c.displayName,
58
- ownerUserId: c.ownerUserId != null ? String(c.ownerUserId) : null,
59
- itemId: String(props.item_id ?? ''),
60
- quantity: Number(props.quantity ?? 0),
61
- slot: Number(props.slot ?? 0),
62
- };
63
- }));
64
- }
65
- /**
66
- * Create a new stack owned by the caller (server-assigned ownership).
67
- * Use {@link grant} afterwards for authority-checked increments; the initial
68
- * quantity here is a seed value on a container the caller owns anyway.
69
- *
70
- * Pass `ownerUserId` (the caller's own user id) to also set the
71
- * `owner_user_id` mirror property that cross-container guards (economy
72
- * trades / market listings) verify.
73
- */
74
- async createStack(input) {
75
- return this.gameModel.createContainer({
76
- appId: this.appId,
77
- typeName: this.names.stackType,
78
- displayName: input.displayName ?? `Stack ${input.itemId}`,
79
- ...(input.sessionId !== undefined ? { sessionId: input.sessionId } : {}),
80
- properties: [
81
- { key: 'item_id', valueType: 'string', valueJson: JSON.stringify(input.itemId) },
82
- { key: 'quantity', valueType: 'int', valueJson: String(input.quantity ?? 0) },
83
- { key: 'slot', valueType: 'int', valueJson: String(input.slot ?? 0) },
84
- ...(input.ownerUserId !== undefined
85
- ? [
86
- {
87
- key: 'owner_user_id',
88
- valueType: this.ownerIdKind,
89
- valueJson: this.ownerIdKind === 'string'
90
- ? JSON.stringify(String(input.ownerUserId))
91
- : String(input.ownerUserId),
92
- },
93
- ]
94
- : []),
95
- ],
96
- });
97
- }
98
- /** Add items to a stack the caller owns. Resolves with the new quantity. */
99
- async grant(stackId, amount) {
100
- return kitInvoke(this.gameModel, {
101
- appId: String(this.appId),
102
- functionName: this.names.grantFn,
103
- selfContainerId: stackId,
104
- params: { amount },
105
- });
106
- }
107
- /**
108
- * Spend items from a stack the caller owns. The server refuses to overdraw
109
- * (`success: false`, nothing written). Resolves with the new quantity.
110
- */
111
- async consume(stackId, amount) {
112
- return kitInvoke(this.gameModel, {
113
- appId: String(this.appId),
114
- functionName: this.names.consumeFn,
115
- selfContainerId: stackId,
116
- params: { amount },
117
- });
118
- }
119
- /** Move a stack to another slot. Resolves with the new (clamped) slot. */
120
- async move(stackId, toSlot) {
121
- return kitInvoke(this.gameModel, {
122
- appId: String(this.appId),
123
- functionName: this.names.moveFn,
124
- selfContainerId: stackId,
125
- params: { to_slot: toSlot },
126
- });
127
- }
128
- /**
129
- * Atomically move items between two stacks of the same item type — both
130
- * writes commit or neither does. The caller must own the source stack.
131
- * Resolves with the source stack's remaining quantity.
132
- */
133
- async transfer(fromStackId, toStackId, amount) {
134
- return kitInvoke(this.gameModel, {
135
- appId: String(this.appId),
136
- functionName: this.names.transferFn,
137
- selfContainerId: fromStackId,
138
- params: { to_id: toStackId, amount },
139
- });
140
- }
141
- /**
142
- * Atomically craft a recipe generated by inventoryBlueprint: every input
143
- * decrement and the output grant commit together. A failed guard writes
144
- * nothing. `inputStackIds` must follow the recipe input order.
145
- */
146
- async craft(inventoryId, recipeId, inputStackIds, outputStackId) {
147
- return kitInvoke(this.gameModel, {
148
- appId: String(this.appId),
149
- functionName: inventoryCraftFunctionName(recipeId, this.typePrefix),
150
- selfContainerId: inventoryId,
151
- params: {
152
- ...Object.fromEntries(inputStackIds.map((id, index) => [`input_${index}_id`, id])),
153
- output_id: outputStackId,
154
- },
155
- });
156
- }
157
- /** Atomically execute a generated item-for-item barter offer. */
158
- async barter(inventoryId, barterId, payStackId, receiveStackId) {
159
- return kitInvoke(this.gameModel, {
160
- appId: String(this.appId),
161
- functionName: inventoryBarterFunctionName(barterId, this.typePrefix),
162
- selfContainerId: inventoryId,
163
- params: { pay_id: payStackId, receive_id: receiveStackId },
164
- });
165
- }
166
- /**
167
- * Record that a stack belongs to an inventory with an
168
- * `inventory_contains` edge, so {@link contents} can read the whole bag in
169
- * one traversal.
170
- */
171
- async linkStack(inventoryId, stackId) {
172
- return this.gameModel.addEdge({
173
- appId: this.appId,
174
- fromContainerId: inventoryId,
175
- toContainerId: stackId,
176
- relationshipType: this.names.containsEdge,
177
- });
178
- }
179
- /** Read every stack linked to an inventory (via `inventory_contains` edges). */
180
- async contents(inventoryId) {
181
- const result = await this.gameModel.traverse({
182
- appId: this.appId,
183
- rootId: inventoryId,
184
- relationshipType: this.names.containsEdge,
185
- depth: 1,
186
- });
187
- const stacks = result.nodes.filter((n) => n.typeName === this.names.stackType);
188
- return Promise.all(stacks.map(async (c) => {
189
- const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
190
- return {
191
- containerId: c.containerId,
192
- displayName: c.displayName,
193
- ownerUserId: c.ownerUserId != null ? String(c.ownerUserId) : null,
194
- itemId: String(props.item_id ?? ''),
195
- quantity: Number(props.quantity ?? 0),
196
- slot: Number(props.slot ?? 0),
197
- };
198
- }));
199
- }
200
- }
@@ -1,86 +0,0 @@
1
- import type { GameModelAPI } from '../domains/gameModel.js';
2
- import type { EngineDetector } from './engine.js';
3
- import type { Scalars } from '../generated/graphql.js';
4
- import { type KitInvokeResult } from './shared.js';
5
- /** Options for {@link LeaderboardsKit}. Must match the deployed blueprint. */
6
- export interface LeaderboardsKitOptions {
7
- /** The board engine module for server-computed rankings. Defaults to `'board-engine'`. */
8
- engineModuleName?: string;
9
- /** The `typePrefix` the leaderboards blueprint was deployed with. */
10
- typePrefix?: string;
11
- }
12
- /** A parsed view of one leaderboard entry. */
13
- export interface KitLeaderboardEntry {
14
- containerId: string;
15
- displayName: string;
16
- ownerUserId: string | null;
17
- boardId: string;
18
- score: number;
19
- season: number;
20
- /** 1-based position AFTER client-side sorting (not the stamped `rank` property). */
21
- position: number;
22
- }
23
- /**
24
- * Runtime helpers for the {@link leaderboardsBlueprint} conventions: ensure
25
- * per-player entries, submit scores (trusted — host by default), and rank.
26
- * There is no server-side ORDER BY on container lists, so reads fetch a
27
- * board's entries and sort client-side — fine for the few hundred entries a
28
- * per-app board holds.
29
- *
30
- * Obtained via `client.kit(appId).leaderboards`.
31
- */
32
- export declare class LeaderboardsKit {
33
- private readonly appId;
34
- private readonly gameModel;
35
- private readonly engines?;
36
- private readonly names;
37
- constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, options?: LeaderboardsKitOptions, engines?: EngineDetector | undefined);
38
- private readonly engineModuleName;
39
- /**
40
- * Is a board compute engine deployed + enabled (cached per session)? When
41
- * true, rankings are computed SERVER-side (tie-aware ranks, percentiles,
42
- * pages) instead of the blueprint's client-sorted reads.
43
- */
44
- engineAvailable(): Promise<boolean>;
45
- /** A server-ranked page (rank/percentile computed module-side). */
46
- engineTop(boardId: string, page?: number, perPage?: number): Promise<Record<string, unknown>>;
47
- /** Your (or a subject's) server-computed ranked row. */
48
- engineRankOf(boardId: string, subjectId?: string): Promise<Record<string, unknown>>;
49
- /** Submit YOUR OWN score (personal-best semantics) to an engine board. */
50
- engineSubmitSelf(boardId: string, score: number): Promise<Record<string, unknown>>;
51
- /** Frozen season snapshots (top rows per rolled season). */
52
- engineSeasons(boardId: string): Promise<Record<string, unknown>>;
53
- private engineInvoke;
54
- /** Find-or-create a player's entry on a board. */
55
- ensureEntry(ownerUserId: Scalars['BigInt']['input'], boardId: string, options?: {
56
- displayName?: string;
57
- }): Promise<{
58
- __typename?: "GmContainer";
59
- containerId: string;
60
- appId: string;
61
- sessionId: string | null;
62
- typeName: string;
63
- displayName: string;
64
- description: string | null;
65
- ownerUserId: string | null;
66
- metadataJson: string;
67
- }>;
68
- /**
69
- * Submit a score — a **trusted** call (host by default per the blueprint's
70
- * `submitAuthority`). Resolves with the entry's (possibly kept-best)
71
- * score.
72
- */
73
- submit(entryId: string, points: number): Promise<KitInvokeResult<number>>;
74
- /** All entries of one board, sorted best-first with 1-based positions. */
75
- board(boardId: string): Promise<KitLeaderboardEntry[]>;
76
- /** The top `n` of a board (client-side ranking). */
77
- top(boardId: string, n?: number): Promise<KitLeaderboardEntry[]>;
78
- /**
79
- * The entries around one player on a board (`radius` above and below),
80
- * for "your neighborhood" widgets.
81
- */
82
- around(boardId: string, userId: Scalars['BigInt']['input'], radius?: number): Promise<KitLeaderboardEntry[]>;
83
- /** The board's current season (max season across its entries; 1 when empty). */
84
- season(boardId: string): Promise<number>;
85
- }
86
- //# sourceMappingURL=leaderboards.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leaderboards.d.ts","sourceRoot":"","sources":["../../src/kit/leaderboards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB;IACrC,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAIxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAN3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;gBAGvB,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjC,SAAS,EAAE,YAAY,EACxC,OAAO,GAAE,sBAA2B,EACnB,OAAO,CAAC,EAAE,cAAc,YAAA;IAM3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAI1C;;;;OAIG;IACH,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAKnC,mEAAmE;IAC7D,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAI,EAAE,OAAO,SAAK;IAIvD,wDAAwD;IAClD,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAItD,0EAA0E;IACpE,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIrD,4DAA4D;IACtD,aAAa,CAAC,OAAO,EAAE,MAAM;YAIrB,YAAY;IAW1B,kDAAkD;IAC5C,WAAW,CACf,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACvC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAO;;;;;;;;;;;IAqBxC;;;;OAIG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAS/E,0EAA0E;IACpE,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA6B5D,oDAAoD;IAC9C,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,SAAK,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIlE;;;OAGG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAClC,MAAM,SAAI,GACT,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAOjC,gFAAgF;IAC1E,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAI/C"}