@air-jam/sdk 0.9.3 → 1.0.0-beta.2
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.
- package/README.md +168 -205
- package/dist/actions-D4eh6Xaa.d.cts +72 -0
- package/dist/actions-D4eh6Xaa.d.ts +72 -0
- package/dist/{agent-contract-CD2QnbBJ.d.cts → agent-contract-BMvCMvhE.d.ts} +3 -19
- package/dist/{agent-contract-CD2QnbBJ.d.ts → agent-contract-DtYf3ici.d.cts} +3 -19
- package/dist/agent-tooling.cjs +135 -46
- package/dist/agent-tooling.cjs.map +1 -1
- package/dist/agent-tooling.d.cts +96 -5
- package/dist/agent-tooling.d.ts +96 -5
- package/dist/agent-tooling.js +15 -14
- package/dist/agent-tooling.js.map +1 -1
- package/dist/{use-air-jam-host-COLy8t4s.d.ts → air-jam-context-B1fQvyYY.d.ts} +121 -114
- package/dist/{use-air-jam-host-DM-ybB3C.d.cts → air-jam-context-BKg_ujpd.d.cts} +121 -114
- package/dist/arcade/bridge/controller.cjs +873 -603
- package/dist/arcade/bridge/controller.cjs.map +1 -1
- package/dist/arcade/bridge/controller.d.cts +28 -76
- package/dist/arcade/bridge/controller.d.ts +28 -76
- package/dist/arcade/bridge/controller.js +27 -28
- package/dist/arcade/bridge/controller.js.map +1 -1
- package/dist/arcade/bridge/host.cjs +1017 -252
- package/dist/arcade/bridge/host.cjs.map +1 -1
- package/dist/arcade/bridge/host.d.cts +6 -72
- package/dist/arcade/bridge/host.d.ts +6 -72
- package/dist/arcade/bridge/host.js +19 -22
- package/dist/arcade/bridge/host.js.map +1 -1
- package/dist/arcade/bridge/iframe.cjs +3 -31
- package/dist/arcade/bridge/iframe.cjs.map +1 -1
- package/dist/arcade/bridge/iframe.d.cts +4 -46
- package/dist/arcade/bridge/iframe.d.ts +4 -46
- package/dist/arcade/bridge/iframe.js +6 -18
- package/dist/arcade/bridge/iframe.js.map +1 -1
- package/dist/arcade/host.cjs +0 -502
- package/dist/arcade/host.cjs.map +1 -1
- package/dist/arcade/host.d.cts +1 -19
- package/dist/arcade/host.d.ts +1 -19
- package/dist/arcade/host.js +0 -14
- package/dist/arcade/host.js.map +1 -1
- package/dist/arcade/runtime.cjs +10373 -4688
- package/dist/arcade/runtime.cjs.map +1 -1
- package/dist/arcade/runtime.d.cts +45 -13
- package/dist/arcade/runtime.d.ts +45 -13
- package/dist/arcade/runtime.js +37 -24
- package/dist/arcade/runtime.js.map +1 -1
- package/dist/arcade/surface.cjs +3 -35
- package/dist/arcade/surface.cjs.map +1 -1
- package/dist/arcade/surface.d.cts +14 -2
- package/dist/arcade/surface.d.ts +14 -2
- package/dist/arcade/surface.js +7 -13
- package/dist/arcade/surface.js.map +1 -1
- package/dist/arcade/url.cjs +45 -283
- package/dist/arcade/url.cjs.map +1 -1
- package/dist/arcade/url.d.cts +3 -56
- package/dist/arcade/url.d.ts +3 -56
- package/dist/arcade/url.js +33 -16
- package/dist/arcade/url.js.map +1 -1
- package/dist/chunk-24NZZOIO.js +700 -0
- package/dist/chunk-24NZZOIO.js.map +1 -0
- package/dist/chunk-27QLKLZL.js +469 -0
- package/dist/chunk-27QLKLZL.js.map +1 -0
- package/dist/{chunk-UWJOIVON.js → chunk-2H2FGF3H.js} +3 -6
- package/dist/chunk-2H2FGF3H.js.map +1 -0
- package/dist/chunk-3LDQCQL2.js +307 -0
- package/dist/chunk-3LDQCQL2.js.map +1 -0
- package/dist/chunk-3M7656SU.js +389 -0
- package/dist/chunk-3M7656SU.js.map +1 -0
- package/dist/{chunk-K4OZ54UD.js → chunk-5CRZFIN6.js} +2 -55
- package/dist/chunk-5CRZFIN6.js.map +1 -0
- package/dist/chunk-5L3O3G5K.js +802 -0
- package/dist/chunk-5L3O3G5K.js.map +1 -0
- package/dist/{chunk-O6X7FJ6N.js → chunk-6PLOJMJD.js} +619 -643
- package/dist/chunk-6PLOJMJD.js.map +1 -0
- package/dist/{chunk-EVZJA6RN.js → chunk-6ZJUA63D.js} +183 -2
- package/dist/chunk-6ZJUA63D.js.map +1 -0
- package/dist/chunk-A6EOGRRG.js +49 -0
- package/dist/chunk-A6EOGRRG.js.map +1 -0
- package/dist/chunk-AXG6FA2H.js +366 -0
- package/dist/chunk-AXG6FA2H.js.map +1 -0
- package/dist/chunk-BEM77SVQ.js +57 -0
- package/dist/chunk-BEM77SVQ.js.map +1 -0
- package/dist/chunk-BQHGPXXN.js +1995 -0
- package/dist/chunk-BQHGPXXN.js.map +1 -0
- package/dist/chunk-C5722GTG.js +176 -0
- package/dist/chunk-C5722GTG.js.map +1 -0
- package/dist/{chunk-CV3PBXPT.js → chunk-C5GS2GMK.js} +99 -105
- package/dist/chunk-C5GS2GMK.js.map +1 -0
- package/dist/chunk-CDL7LYZH.js +19 -0
- package/dist/chunk-CDL7LYZH.js.map +1 -0
- package/dist/{chunk-PSUYTD2L.js → chunk-DA3TE4OP.js} +1 -1
- package/dist/chunk-DA3TE4OP.js.map +1 -0
- package/dist/chunk-DBF7NJ3S.js +72 -0
- package/dist/chunk-DBF7NJ3S.js.map +1 -0
- package/dist/chunk-DRBPVG47.js +89 -0
- package/dist/chunk-DRBPVG47.js.map +1 -0
- package/dist/chunk-FCG42U7D.js +131 -0
- package/dist/chunk-FCG42U7D.js.map +1 -0
- package/dist/chunk-FJ4J2BEC.js +26 -0
- package/dist/chunk-FJ4J2BEC.js.map +1 -0
- package/dist/chunk-H4DEVMTO.js +221 -0
- package/dist/chunk-H4DEVMTO.js.map +1 -0
- package/dist/chunk-ISQZ7F3N.js +83 -0
- package/dist/chunk-ISQZ7F3N.js.map +1 -0
- package/dist/{chunk-IG6GZZSS.js → chunk-JCGTL77W.js} +1 -1
- package/dist/chunk-JCGTL77W.js.map +1 -0
- package/dist/chunk-JJVCBUYM.js +98 -0
- package/dist/chunk-JJVCBUYM.js.map +1 -0
- package/dist/chunk-K6BJJJJM.js +138 -0
- package/dist/chunk-K6BJJJJM.js.map +1 -0
- package/dist/{chunk-MIMPMB7O.js → chunk-KGY4PV2A.js} +24 -3
- package/dist/chunk-KGY4PV2A.js.map +1 -0
- package/dist/chunk-KKRLHT2M.js +2477 -0
- package/dist/chunk-KKRLHT2M.js.map +1 -0
- package/dist/chunk-KSYN4I5Y.js +50 -0
- package/dist/chunk-KSYN4I5Y.js.map +1 -0
- package/dist/chunk-KUGROY5S.js +265 -0
- package/dist/chunk-KUGROY5S.js.map +1 -0
- package/dist/chunk-LX6CTPDW.js +16 -0
- package/dist/chunk-LX6CTPDW.js.map +1 -0
- package/dist/{chunk-BE6Z4SIT.js → chunk-M5553I2G.js} +2 -11
- package/dist/chunk-M5553I2G.js.map +1 -0
- package/dist/{chunk-X24K52DG.js → chunk-MD25536W.js} +1 -1
- package/dist/chunk-MD25536W.js.map +1 -0
- package/dist/{chunk-3USU7GY2.js → chunk-MJAWAHLT.js} +1 -1
- package/dist/chunk-MJAWAHLT.js.map +1 -0
- package/dist/chunk-NBA7UIWG.js +921 -0
- package/dist/chunk-NBA7UIWG.js.map +1 -0
- package/dist/chunk-OAXCFPZ7.js +14 -0
- package/dist/chunk-OAXCFPZ7.js.map +1 -0
- package/dist/{chunk-D4VDEVTZ.js → chunk-QHBRHYMV.js} +18 -17
- package/dist/chunk-QHBRHYMV.js.map +1 -0
- package/dist/chunk-QTNYGAZ7.js +45 -0
- package/dist/chunk-QTNYGAZ7.js.map +1 -0
- package/dist/chunk-UC24OG4X.js +129 -0
- package/dist/chunk-UC24OG4X.js.map +1 -0
- package/dist/chunk-VN2PX2I3.js +188 -0
- package/dist/chunk-VN2PX2I3.js.map +1 -0
- package/dist/chunk-WAFGYJZN.js +1513 -0
- package/dist/chunk-WAFGYJZN.js.map +1 -0
- package/dist/chunk-WGHNGQUS.js +78 -0
- package/dist/chunk-WGHNGQUS.js.map +1 -0
- package/dist/{chunk-X35LLCWV.js → chunk-X5HZBQ6K.js} +6 -8
- package/dist/chunk-X5HZBQ6K.js.map +1 -0
- package/dist/chunk-XLY44PXZ.js +46 -0
- package/dist/chunk-XLY44PXZ.js.map +1 -0
- package/dist/chunk-YXHAWWVU.js +7 -0
- package/dist/chunk-YXHAWWVU.js.map +1 -0
- package/dist/connection-store-CqW-E7ma.d.cts +41 -0
- package/dist/connection-store-ffHWMrMe.d.ts +41 -0
- package/dist/control-Bv8dWjyp.d.ts +1400 -0
- package/dist/control-CNzybWMd.d.cts +1400 -0
- package/dist/controller-ClW0R8mZ.d.cts +26 -0
- package/dist/controller-DRKCa7uQ.d.ts +26 -0
- package/dist/controller-agent-vOiuK7T6.d.cts +130 -0
- package/dist/controller-agent-vOiuK7T6.d.ts +130 -0
- package/dist/controller-bridge.cjs +992 -0
- package/dist/controller-bridge.cjs.map +1 -0
- package/dist/controller-bridge.d.cts +52 -0
- package/dist/controller-bridge.d.ts +52 -0
- package/dist/controller-bridge.js +23 -0
- package/dist/controller-bridge.js.map +1 -0
- package/dist/controller-capture-2GKKGHJ2.js +8 -0
- package/dist/controller-capture-2GKKGHJ2.js.map +1 -0
- package/dist/controller-press-EWWIMVXP.js +231 -0
- package/dist/controller-press-EWWIMVXP.js.map +1 -0
- package/dist/core-BAO0pHrJ.d.cts +15 -0
- package/dist/core-BAO0pHrJ.d.ts +15 -0
- package/dist/core.cjs +5956 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +250 -0
- package/dist/core.d.ts +250 -0
- package/dist/core.js +910 -0
- package/dist/core.js.map +1 -0
- package/dist/dev-events-BffobOfb.d.ts +31 -0
- package/dist/dev-events-Ct7QEgKb.d.cts +31 -0
- package/dist/dev-log-events-B1_B3guZ.d.cts +47 -0
- package/dist/dev-log-events-B1_B3guZ.d.ts +47 -0
- package/dist/frames-D-xKuODS.d.cts +686 -0
- package/dist/frames-D-xKuODS.d.ts +686 -0
- package/dist/game-5n-dh5np.d.cts +77 -0
- package/dist/game-RYb97BN8.d.ts +77 -0
- package/dist/host-runtime-BRtUidEJ.d.cts +399 -0
- package/dist/host-runtime-RrO4pCXI.d.ts +399 -0
- package/dist/index.cjs +11571 -7554
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -358
- package/dist/index.d.ts +100 -358
- package/dist/index.js +414 -1903
- package/dist/index.js.map +1 -1
- package/dist/input-D7FNeehb.d.cts +92 -0
- package/dist/input-D7FNeehb.d.ts +92 -0
- package/dist/input-bindings-686sTen7.d.ts +129 -0
- package/dist/input-bindings-BRac-P0e.d.cts +129 -0
- package/dist/leased-control-BEg4JuXA.d.cts +158 -0
- package/dist/leased-control-BEg4JuXA.d.ts +158 -0
- package/dist/metadata.cjs +3 -9
- package/dist/metadata.cjs.map +1 -1
- package/dist/metadata.d.cts +6 -16
- package/dist/metadata.d.ts +6 -16
- package/dist/metadata.js +8 -76
- package/dist/metadata.js.map +1 -1
- package/dist/phone-room-session-Byomkt92.d.cts +439 -0
- package/dist/phone-room-session-D9C8cSxS.d.ts +439 -0
- package/dist/platform-machine.cjs +133 -3
- package/dist/platform-machine.cjs.map +1 -1
- package/dist/platform-machine.d.cts +525 -27
- package/dist/platform-machine.d.ts +525 -27
- package/dist/platform-machine.js +119 -4
- package/dist/platform-machine.js.map +1 -1
- package/dist/{platform-settings-DUWs4JTy.d.cts → platform-settings-Yb0fQ1dl.d.cts} +1 -3
- package/dist/{platform-settings-DUWs4JTy.d.ts → platform-settings-Yb0fQ1dl.d.ts} +1 -3
- package/dist/prefabs.cjs +134 -3
- package/dist/prefabs.cjs.map +1 -1
- package/dist/prefabs.d.cts +23 -47
- package/dist/prefabs.d.ts +23 -47
- package/dist/prefabs.js +23 -4
- package/dist/prefabs.js.map +1 -1
- package/dist/preview.cjs +2199 -767
- package/dist/preview.cjs.map +1 -1
- package/dist/preview.d.cts +193 -38
- package/dist/preview.d.ts +193 -38
- package/dist/preview.js +478 -254
- package/dist/preview.js.map +1 -1
- package/dist/protocol.cjs +585 -391
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +13 -117
- package/dist/protocol.d.ts +13 -117
- package/dist/protocol.js +43 -80
- package/dist/protocol.js.map +1 -1
- package/dist/release.cjs.map +1 -1
- package/dist/release.d.cts +2 -2
- package/dist/release.d.ts +2 -2
- package/dist/release.js +1 -1
- package/dist/release.js.map +1 -1
- package/dist/replay-input-log-D0NpnA3P.d.ts +31 -0
- package/dist/replay-input-log-bg0g-PCz.d.cts +31 -0
- package/dist/room-protocol.cjs +794 -0
- package/dist/room-protocol.cjs.map +1 -0
- package/dist/room-protocol.d.cts +63 -0
- package/dist/room-protocol.d.ts +63 -0
- package/dist/room-protocol.js +143 -0
- package/dist/room-protocol.js.map +1 -0
- package/dist/room-session.cjs +2336 -0
- package/dist/room-session.cjs.map +1 -0
- package/dist/room-session.d.cts +77 -0
- package/dist/room-session.d.ts +77 -0
- package/dist/room-session.js +103 -0
- package/dist/room-session.js.map +1 -0
- package/dist/runtime/prefab-inspection-bridge.cjs +207 -0
- package/dist/runtime/prefab-inspection-bridge.cjs.map +1 -0
- package/dist/runtime/prefab-inspection-bridge.d.cts +156 -0
- package/dist/runtime/prefab-inspection-bridge.d.ts +156 -0
- package/dist/runtime/prefab-inspection-bridge.js +22 -0
- package/dist/runtime/prefab-inspection-bridge.js.map +1 -0
- package/dist/runtime-control.cjs +2133 -8
- package/dist/runtime-control.cjs.map +1 -1
- package/dist/runtime-control.d.cts +980 -12
- package/dist/runtime-control.d.ts +980 -12
- package/dist/runtime-control.js +264 -4
- package/dist/runtime-control.js.map +1 -1
- package/dist/runtime-inspection.cjs +1222 -558
- package/dist/runtime-inspection.cjs.map +1 -1
- package/dist/runtime-inspection.d.cts +530 -22
- package/dist/runtime-inspection.d.ts +530 -22
- package/dist/runtime-inspection.js +21 -22
- package/dist/runtime-inspection.js.map +1 -1
- package/dist/runtime-reporting-K_ZXpubu.d.cts +43 -0
- package/dist/runtime-reporting-K_ZXpubu.d.ts +43 -0
- package/dist/runtime-topology.cjs +2 -5
- package/dist/runtime-topology.cjs.map +1 -1
- package/dist/runtime-topology.d.cts +1 -1
- package/dist/runtime-topology.d.ts +1 -1
- package/dist/runtime-topology.js +1 -1
- package/dist/runtime-topology.js.map +1 -1
- package/dist/scoped-connector-DEOZvCCG.d.cts +66 -0
- package/dist/scoped-connector-nTHACYTl.d.ts +66 -0
- package/dist/sdk-channels-S6j6AH8v.d.cts +103 -0
- package/dist/sdk-channels-S6j6AH8v.d.ts +103 -0
- package/dist/simulation-DL9j-ghn.d.ts +782 -0
- package/dist/simulation-HmgsvF5H.d.cts +782 -0
- package/dist/{standard-match-phase-BzSgBYFg.d.ts → standard-match-phase-D4N-AU0d.d.cts} +3 -13
- package/dist/{standard-match-phase-CvJUW8Oe.d.cts → standard-match-phase-abt8ZjCh.d.ts} +3 -13
- package/dist/transport-CWF29jU6.d.cts +173 -0
- package/dist/transport-CWF29jU6.d.ts +173 -0
- package/dist/types-p28maMEo.d.cts +102 -0
- package/dist/types-p28maMEo.d.ts +102 -0
- package/dist/ui.cjs +2167 -892
- package/dist/ui.cjs.map +1 -1
- package/dist/ui.d.cts +75 -17
- package/dist/ui.d.ts +75 -17
- package/dist/ui.js +554 -393
- package/dist/ui.js.map +1 -1
- package/package.json +38 -21
- package/src/agent/agent-action.ts +0 -39
- package/src/agent/agent-contract-conformance.ts +8 -1
- package/src/agent/agent-contract.ts +2 -4
- package/src/agent/agent-evaluator.ts +95 -0
- package/src/agent/capture-canvas.ts +79 -0
- package/src/agent/host-canvas-capture.ts +189 -0
- package/src/agent-tooling.ts +5 -20
- package/src/arcade/bridge/controller.ts +8 -11
- package/src/arcade/bridge/host.ts +6 -11
- package/src/arcade/bridge/iframe.ts +1 -50
- package/src/arcade/host.ts +0 -1
- package/src/arcade/surface.ts +5 -1
- package/src/arcade/url.ts +2 -9
- package/src/audio/audio-manager.ts +23 -47
- package/src/audio/hooks.tsx +59 -72
- package/src/components/controller-player-name-field.tsx +2 -2
- package/src/components/controller-primary-action.tsx +1 -1
- package/src/components/controls.tsx +398 -0
- package/src/components/gamepad-layout.tsx +69 -0
- package/src/components/join-url-controls.tsx +5 -1
- package/src/components/lifecycle-action-group.tsx +1 -1
- package/src/components/player-avatar.tsx +50 -3
- package/src/components/room-qr-code.tsx +36 -77
- package/src/components/stage-capture-surface.tsx +91 -0
- package/src/components/surface-viewport.tsx +16 -3
- package/src/components/ui/button.tsx +1 -1
- package/src/constants.ts +0 -15
- package/src/context/air-jam-context.tsx +56 -187
- package/src/context/session-providers.tsx +13 -10
- package/src/controller-bridge.ts +7 -0
- package/src/core/assets.ts +48 -0
- package/src/core/config.ts +70 -0
- package/src/core/connection-store.ts +77 -0
- package/src/core/controller-input.ts +147 -0
- package/src/core/controller-runtime.ts +427 -0
- package/src/core/dev-events.ts +18 -0
- package/src/core/environment.ts +132 -0
- package/src/core/game-description.ts +44 -0
- package/src/core/game.ts +130 -0
- package/src/core/host-input.ts +207 -0
- package/src/core/host-runtime.ts +988 -0
- package/src/core/hosted-rooms.ts +65 -0
- package/src/core/input-bindings.ts +180 -0
- package/src/core/input-log.ts +144 -0
- package/src/core/input.ts +228 -0
- package/src/core/local-input.ts +319 -0
- package/src/core/replay-input-log.ts +298 -0
- package/src/core/replicated-store.ts +1178 -0
- package/src/core/room-action-ack.ts +43 -0
- package/src/core/settings.ts +202 -0
- package/src/core/simulation.ts +307 -0
- package/src/core/theme.ts +33 -0
- package/src/core.ts +167 -0
- package/src/dev/browser-log-sink.ts +35 -12
- package/src/diagnostics.ts +5 -6
- package/src/hooks/internal/use-controller-runtime-api.ts +58 -925
- package/src/hooks/internal/use-host-runtime-api.ts +98 -1270
- package/src/hooks/internal/use-runtime-inspection-contract.ts +14 -2
- package/src/hooks/use-air-jam-controller.ts +32 -53
- package/src/hooks/use-air-jam-host.ts +59 -100
- package/src/hooks/use-air-jam-settings.ts +27 -0
- package/src/hooks/use-controller-toasts.ts +16 -19
- package/src/hooks/use-host-agent-capture.ts +31 -0
- package/src/hooks/use-lifecycle-action-group-model.ts +1 -1
- package/src/hooks/use-send-signal.ts +23 -156
- package/src/hooks/use-simulation.ts +83 -0
- package/src/index.ts +24 -85
- package/src/lifecycle/index.ts +0 -4
- package/src/lifecycle/standard-match-phase.ts +1 -22
- package/src/metadata/manifest.ts +8 -19
- package/src/metadata.ts +1 -1
- package/src/platform-machine.ts +127 -3
- package/src/prefabs/types.ts +91 -20
- package/src/prefabs/view.ts +82 -0
- package/src/prefabs.ts +19 -0
- package/src/preview/host-workspace.tsx +4 -9
- package/src/preview/identity.ts +31 -23
- package/src/preview/layout.ts +5 -1
- package/src/preview/manager.ts +205 -78
- package/src/preview/messages.ts +47 -0
- package/src/preview/ownership.ts +6 -1
- package/src/preview/url.ts +46 -23
- package/src/preview/window.tsx +26 -69
- package/src/preview/workspace-local-seats.ts +166 -0
- package/src/preview/workspace.tsx +89 -37
- package/src/preview.ts +27 -15
- package/src/protocol/actions.ts +58 -0
- package/src/protocol/arcade-platform-actions.ts +2 -16
- package/src/protocol/controller.ts +14 -174
- package/src/protocol/core.ts +8 -15
- package/src/protocol/dev-log-events.ts +5 -81
- package/src/protocol/leased-control.ts +177 -0
- package/src/protocol/room/addressing.ts +35 -0
- package/src/protocol/room/close-codes.ts +33 -0
- package/src/protocol/room/frames.ts +343 -0
- package/src/protocol/room/input-codec.ts +182 -0
- package/src/protocol/room/limits.ts +58 -0
- package/src/protocol/room/patch.ts +135 -0
- package/src/protocol/room/sdk-channels.ts +81 -0
- package/src/protocol/room/seat-id.ts +31 -0
- package/src/protocol/room/transport.ts +63 -0
- package/src/protocol/room/weight.ts +58 -0
- package/src/protocol/runtime-reporting.ts +56 -10
- package/src/protocol.ts +2 -7
- package/src/qrcode.d.ts +3 -13
- package/src/room-protocol.ts +10 -0
- package/src/room-session/browser-wake-events.ts +14 -0
- package/src/room-session/channel-state.ts +293 -0
- package/src/room-session/clock.ts +24 -0
- package/src/room-session/host-room-session.ts +379 -0
- package/src/room-session/input-lane.ts +125 -0
- package/src/room-session/listeners.ts +22 -0
- package/src/room-session/loopback-link.ts +58 -0
- package/src/room-session/phone-room-session.ts +368 -0
- package/src/room-session/port-link.ts +116 -0
- package/src/room-session/room-key.ts +9 -0
- package/src/room-session/roster.ts +23 -0
- package/src/room-session/scoped-connector.ts +577 -0
- package/src/room-session/session-link.ts +306 -0
- package/src/room-session/web-socket-link.ts +57 -0
- package/src/room-session.ts +12 -0
- package/src/runtime/air-jam-config.ts +49 -37
- package/src/runtime/air-jam-error-boundary.tsx +9 -3
- package/src/runtime/arcade-runtime-url.ts +8 -9
- package/src/runtime/browser-controller-environment.ts +116 -0
- package/src/runtime/browser-host-environment.ts +137 -0
- package/src/runtime/browser-replay.ts +211 -0
- package/src/runtime/browser-room.ts +41 -0
- package/src/runtime/connected-runtime-error-boundary.tsx +35 -8
- package/src/runtime/contracts/agent-control.ts +195 -0
- package/src/runtime/contracts/clip.ts +169 -0
- package/src/runtime/contracts/control.ts +653 -16
- package/src/runtime/contracts/controller-agent.ts +130 -0
- package/src/runtime/contracts/input-log.ts +38 -0
- package/src/runtime/contracts/inspection.ts +25 -22
- package/src/runtime/contracts/observation.ts +186 -0
- package/src/runtime/contracts/runtime-identity.ts +43 -0
- package/src/runtime/contracts/timeline.ts +59 -0
- package/src/runtime/controller-agent-bridge.ts +152 -0
- package/src/runtime/controller-bridge-context.ts +29 -0
- package/src/runtime/controller-capture.ts +50 -0
- package/src/runtime/controller-identity.ts +53 -142
- package/src/runtime/controller-presentation.ts +47 -17
- package/src/runtime/controller-press.ts +271 -0
- package/src/runtime/create-air-jam-app.tsx +103 -74
- package/src/runtime/dev-runtime-events.ts +6 -18
- package/src/runtime/embedded-parent.ts +22 -0
- package/src/runtime/embedded-runtime-adapters.ts +10 -9
- package/src/runtime/host-agent-bridge.ts +127 -0
- package/src/runtime/host-capture-boundary.tsx +92 -0
- package/src/runtime/host-capture-context.ts +7 -0
- package/src/runtime/host-clip-reader.ts +93 -0
- package/src/runtime/host-clip-recorder.ts +342 -0
- package/src/runtime/host-input-log-reader.ts +120 -0
- package/src/runtime/host-observation.ts +207 -0
- package/src/runtime/host-pace.ts +36 -0
- package/src/runtime/host-runtime-fault.ts +51 -0
- package/src/runtime/host-timeline.ts +152 -0
- package/src/runtime/local-players.tsx +96 -0
- package/src/runtime/local-seats.ts +612 -0
- package/src/runtime/participant-control.ts +162 -0
- package/src/runtime/prefab-inspection-bridge.ts +174 -0
- package/src/runtime/prefab-inspection-clock.ts +12 -0
- package/src/runtime/prefab-inspection-context.ts +20 -0
- package/src/runtime/prefab-inspection-runtime.tsx +328 -0
- package/src/runtime/preview-inspection-bridge.ts +130 -0
- package/src/runtime/replay-runtime.tsx +101 -0
- package/src/runtime/room-bridge.ts +110 -0
- package/src/runtime/runtime-owner-contexts.tsx +9 -0
- package/src/runtime/runtime-session-params.ts +20 -23
- package/src/runtime/session-runtimes.tsx +231 -64
- package/src/runtime/stage-capture.ts +25 -0
- package/src/runtime-control.ts +41 -0
- package/src/runtime-inspection.ts +14 -7
- package/src/runtime-topology.ts +7 -8
- package/src/settings/platform-settings-runtime.tsx +47 -2
- package/src/settings/platform-settings.ts +0 -65
- package/src/store/use-air-jam-store.ts +73 -0
- package/src/ui.ts +3 -3
- package/src/utils/is-rpc-serializable.ts +11 -19
- package/src/utils/url-builder.ts +0 -7
- package/dist/air-jam-context-BlLPvCup.d.cts +0 -175
- package/dist/air-jam-context-DTsxF-tP.d.ts +0 -175
- package/dist/arcade/bridge.cjs +0 -1087
- package/dist/arcade/bridge.cjs.map +0 -1
- package/dist/arcade/bridge.d.cts +0 -11
- package/dist/arcade/bridge.d.ts +0 -11
- package/dist/arcade/bridge.js +0 -78
- package/dist/arcade/bridge.js.map +0 -1
- package/dist/arcade-runtime-url-BW-MUAOY.d.cts +0 -28
- package/dist/arcade-runtime-url-l8qj01Pg.d.ts +0 -28
- package/dist/arcade.cjs +0 -1767
- package/dist/arcade.cjs.map +0 -1
- package/dist/arcade.d.cts +0 -18
- package/dist/arcade.d.ts +0 -18
- package/dist/arcade.js +0 -129
- package/dist/arcade.js.map +0 -1
- package/dist/chunk-2SZ2YYGJ.js +0 -280
- package/dist/chunk-2SZ2YYGJ.js.map +0 -1
- package/dist/chunk-32RSSFSF.js +0 -214
- package/dist/chunk-32RSSFSF.js.map +0 -1
- package/dist/chunk-3USU7GY2.js.map +0 -1
- package/dist/chunk-3YMUAKPU.js +0 -10
- package/dist/chunk-3YMUAKPU.js.map +0 -1
- package/dist/chunk-56DM2KEW.js +0 -14
- package/dist/chunk-56DM2KEW.js.map +0 -1
- package/dist/chunk-BE6Z4SIT.js.map +0 -1
- package/dist/chunk-CM53YLT5.js +0 -59
- package/dist/chunk-CM53YLT5.js.map +0 -1
- package/dist/chunk-CV3PBXPT.js.map +0 -1
- package/dist/chunk-D4VDEVTZ.js.map +0 -1
- package/dist/chunk-EVZJA6RN.js.map +0 -1
- package/dist/chunk-FUA6EMSJ.js +0 -90
- package/dist/chunk-FUA6EMSJ.js.map +0 -1
- package/dist/chunk-GMLU7RI5.js +0 -70
- package/dist/chunk-GMLU7RI5.js.map +0 -1
- package/dist/chunk-IG6GZZSS.js.map +0 -1
- package/dist/chunk-IKKDONQL.js +0 -1
- package/dist/chunk-IKKDONQL.js.map +0 -1
- package/dist/chunk-ITMQSBTH.js +0 -26
- package/dist/chunk-ITMQSBTH.js.map +0 -1
- package/dist/chunk-J5MCII33.js +0 -620
- package/dist/chunk-J5MCII33.js.map +0 -1
- package/dist/chunk-JTF47B56.js +0 -1
- package/dist/chunk-JTF47B56.js.map +0 -1
- package/dist/chunk-K4OZ54UD.js.map +0 -1
- package/dist/chunk-LIHEEAVE.js +0 -191
- package/dist/chunk-LIHEEAVE.js.map +0 -1
- package/dist/chunk-LIXPF4P6.js +0 -22
- package/dist/chunk-LIXPF4P6.js.map +0 -1
- package/dist/chunk-MIMPMB7O.js.map +0 -1
- package/dist/chunk-MPDMJIX5.js +0 -1
- package/dist/chunk-MPDMJIX5.js.map +0 -1
- package/dist/chunk-O6X7FJ6N.js.map +0 -1
- package/dist/chunk-PSUYTD2L.js.map +0 -1
- package/dist/chunk-QO4KFUEI.js +0 -32
- package/dist/chunk-QO4KFUEI.js.map +0 -1
- package/dist/chunk-QTLYZADF.js +0 -125
- package/dist/chunk-QTLYZADF.js.map +0 -1
- package/dist/chunk-TGRTEWYV.js +0 -195
- package/dist/chunk-TGRTEWYV.js.map +0 -1
- package/dist/chunk-TTQDHKXL.js +0 -3017
- package/dist/chunk-TTQDHKXL.js.map +0 -1
- package/dist/chunk-UCPY7UJC.js +0 -8
- package/dist/chunk-UCPY7UJC.js.map +0 -1
- package/dist/chunk-UPV6YWT5.js +0 -43
- package/dist/chunk-UPV6YWT5.js.map +0 -1
- package/dist/chunk-UWJOIVON.js.map +0 -1
- package/dist/chunk-W2VK36RO.js +0 -11
- package/dist/chunk-W2VK36RO.js.map +0 -1
- package/dist/chunk-X24K52DG.js.map +0 -1
- package/dist/chunk-X35LLCWV.js.map +0 -1
- package/dist/chunk-YXHH3MQT.js +0 -230
- package/dist/chunk-YXHH3MQT.js.map +0 -1
- package/dist/controller-PZEM_1cH.d.ts +0 -176
- package/dist/controller-vj82tKm4.d.cts +0 -176
- package/dist/dev-log-events-BCJKmygo.d.cts +0 -120
- package/dist/dev-log-events-BCJKmygo.d.ts +0 -120
- package/dist/handshake-CC_LrK5g.d.cts +0 -31
- package/dist/handshake-CC_LrK5g.d.ts +0 -31
- package/dist/host-B9pRy0Aa.d.cts +0 -122
- package/dist/host-DylGsX7p.d.ts +0 -122
- package/dist/notices-C4bao3oi.d.ts +0 -38
- package/dist/notices-DNdOjwtj.d.cts +0 -38
- package/dist/realtime-client-Cu8yVJFw.d.cts +0 -15
- package/dist/realtime-client-Cu8yVJFw.d.ts +0 -15
- package/dist/runtime-reporting-pe-eryVz.d.cts +0 -27
- package/dist/runtime-reporting-pe-eryVz.d.ts +0 -27
- package/dist/signals-ZHftIKuc.d.cts +0 -33
- package/dist/signals-ZHftIKuc.d.ts +0 -33
- package/dist/sync-xtPfWhif.d.cts +0 -81
- package/dist/sync-xtPfWhif.d.ts +0 -81
- package/src/arcade/bridge.ts +0 -3
- package/src/arcade.ts +0 -4
- package/src/context/socket-manager.ts +0 -72
- package/src/events.ts +0 -119
- package/src/hooks/use-connection-status.ts +0 -8
- package/src/hooks/use-controller-tick.ts +0 -65
- package/src/hooks/use-get-input.ts +0 -100
- package/src/hooks/use-host-arcade-restore.ts +0 -35
- package/src/hooks/use-host-tick.ts +0 -171
- package/src/hooks/use-input-writer.ts +0 -83
- package/src/hooks/use-players.ts +0 -12
- package/src/internal/input-manager.ts +0 -356
- package/src/protocol/errors.ts +0 -21
- package/src/protocol/host-grant.ts +0 -103
- package/src/protocol/host.ts +0 -150
- package/src/protocol/notices.ts +0 -43
- package/src/protocol/signals.ts +0 -38
- package/src/protocol/socket-events.ts +0 -152
- package/src/protocol/sync.ts +0 -105
- package/src/runtime/admission-retry.ts +0 -62
- package/src/runtime/bridge-envelope-args.ts +0 -21
- package/src/runtime/controller-bridge.ts +0 -439
- package/src/runtime/controller-realtime-client.ts +0 -552
- package/src/runtime/host-bridge.ts +0 -380
- package/src/runtime/host-realtime-client.ts +0 -550
- package/src/runtime/realtime-client.ts +0 -20
- package/src/runtime/validate-arcade-bridge-attach.ts +0 -14
- package/src/state/connection-store.ts +0 -159
- package/src/store/create-air-jam-store.ts +0 -1193
- package/src/store/index.ts +0 -1
- package/src/utils/ids.ts +0 -58
package/dist/ui.cjs
CHANGED
|
@@ -31,10 +31,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var ui_exports = {};
|
|
32
32
|
__export(ui_exports, {
|
|
33
33
|
AIRJAM_DEFAULT_AVATAR_SEEDS: () => AIRJAM_DEFAULT_AVATAR_SEEDS,
|
|
34
|
+
AxisButton: () => AxisButton,
|
|
34
35
|
Button: () => Button,
|
|
35
36
|
ConnectionStatusPill: () => ConnectionStatusPill,
|
|
37
|
+
ControlButton: () => ControlButton,
|
|
36
38
|
ControllerPlayerNameField: () => ControllerPlayerNameField,
|
|
37
39
|
ControllerPrimaryAction: () => ControllerPrimaryAction,
|
|
40
|
+
GamepadLayout: () => GamepadLayout,
|
|
38
41
|
HostMuteButton: () => HostMuteButton,
|
|
39
42
|
JoinQrOverlay: () => JoinQrOverlay,
|
|
40
43
|
JoinUrlActionButtons: () => JoinUrlActionButtons,
|
|
@@ -46,12 +49,10 @@ __export(ui_exports, {
|
|
|
46
49
|
RoomQrCode: () => RoomQrCode,
|
|
47
50
|
RuntimeShellHeader: () => RuntimeShellHeader,
|
|
48
51
|
Slider: () => Slider,
|
|
52
|
+
Stick: () => Stick,
|
|
49
53
|
SurfaceViewport: () => SurfaceViewport,
|
|
50
54
|
VolumeControls: () => VolumeControls,
|
|
51
|
-
buttonVariants: () => buttonVariants,
|
|
52
55
|
getDiceBearAdventurerNeutralUrl: () => getDiceBearAdventurerNeutralUrl,
|
|
53
|
-
getPlayerAvatarImageUrl: () => getPlayerAvatarImageUrl,
|
|
54
|
-
resolvePlayerAvatarSeed: () => resolvePlayerAvatarSeed,
|
|
55
56
|
useControllerLifecycleIntents: () => useControllerLifecycleIntents,
|
|
56
57
|
useControllerLifecyclePermissions: () => useControllerLifecyclePermissions,
|
|
57
58
|
useControllerShellStatus: () => useControllerShellStatus,
|
|
@@ -122,14 +123,17 @@ var import_react5 = require("react");
|
|
|
122
123
|
|
|
123
124
|
// src/hooks/use-air-jam-controller.ts
|
|
124
125
|
var import_react4 = require("react");
|
|
125
|
-
var
|
|
126
|
+
var import_zustand2 = require("zustand");
|
|
126
127
|
var import_shallow2 = require("zustand/react/shallow");
|
|
127
128
|
|
|
128
129
|
// src/context/air-jam-context.tsx
|
|
129
130
|
var import_react = require("react");
|
|
130
|
-
var
|
|
131
|
+
var import_zustand = require("zustand");
|
|
131
132
|
var import_shallow = require("zustand/react/shallow");
|
|
132
133
|
|
|
134
|
+
// src/core/connection-store.ts
|
|
135
|
+
var import_vanilla = require("zustand/vanilla");
|
|
136
|
+
|
|
133
137
|
// src/diagnostics.ts
|
|
134
138
|
var listeners = /* @__PURE__ */ new Set();
|
|
135
139
|
var lastEmissionByKey = /* @__PURE__ */ new Map();
|
|
@@ -186,20 +190,47 @@ var createAirJamDiagnosticError = (code, message, details) => {
|
|
|
186
190
|
return error;
|
|
187
191
|
};
|
|
188
192
|
|
|
189
|
-
// src/protocol/
|
|
193
|
+
// src/protocol/actions.ts
|
|
190
194
|
var import_zod = require("zod");
|
|
191
|
-
var
|
|
195
|
+
var airJamActionPayloadSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.unknown());
|
|
196
|
+
var airJamActionAcceptedSchema = import_zod.z.object({
|
|
197
|
+
ok: import_zod.z.literal(true),
|
|
198
|
+
status: import_zod.z.literal("accepted"),
|
|
199
|
+
source: import_zod.z.enum(["client", "host"]),
|
|
200
|
+
result: import_zod.z.unknown().optional()
|
|
201
|
+
});
|
|
202
|
+
var airJamActionRejectedSchema = import_zod.z.object({
|
|
203
|
+
ok: import_zod.z.literal(false),
|
|
204
|
+
status: import_zod.z.literal("rejected"),
|
|
205
|
+
source: import_zod.z.enum(["client", "server", "host"]),
|
|
206
|
+
reason: import_zod.z.string(),
|
|
207
|
+
message: import_zod.z.string(),
|
|
208
|
+
details: airJamActionPayloadSchema.optional()
|
|
209
|
+
});
|
|
210
|
+
var airJamActionUnconfirmedSchema = import_zod.z.object({
|
|
211
|
+
ok: import_zod.z.literal(false),
|
|
212
|
+
status: import_zod.z.literal("unconfirmed"),
|
|
213
|
+
source: import_zod.z.literal("client")
|
|
214
|
+
});
|
|
215
|
+
var airJamActionInvocationResultSchema = import_zod.z.discriminatedUnion(
|
|
216
|
+
"status",
|
|
217
|
+
[
|
|
218
|
+
airJamActionAcceptedSchema,
|
|
219
|
+
airJamActionRejectedSchema,
|
|
220
|
+
airJamActionUnconfirmedSchema
|
|
221
|
+
]
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
// src/protocol/arcade-platform-actions.ts
|
|
225
|
+
var import_zod2 = require("zod");
|
|
226
|
+
var arcadeBrowserConfirmPayloadSchema = import_zod2.z.object({ epoch: import_zod2.z.number().int().positive().safe() }).strict();
|
|
192
227
|
var arcadeBrowserNavigatePayloadSchema = arcadeBrowserConfirmPayloadSchema.extend({
|
|
193
|
-
direction:
|
|
228
|
+
direction: import_zod2.z.enum(["up", "down", "left", "right"])
|
|
194
229
|
});
|
|
195
230
|
|
|
196
231
|
// src/protocol/controller.ts
|
|
197
232
|
var import_zod3 = require("zod");
|
|
198
233
|
|
|
199
|
-
// src/protocol/core.ts
|
|
200
|
-
var import_zod2 = require("zod");
|
|
201
|
-
var roomCodeSchema = import_zod2.z.string().trim().min(4).max(8).regex(/^[A-Z0-9]+$/, { message: "room code must contain only A-Z or 0-9" });
|
|
202
|
-
|
|
203
234
|
// src/settings/platform-settings.ts
|
|
204
235
|
var DEFAULT_PLATFORM_SETTINGS = {
|
|
205
236
|
audio: {
|
|
@@ -229,76 +260,26 @@ var getEffectiveAudioVolume = (settings, category) => {
|
|
|
229
260
|
};
|
|
230
261
|
|
|
231
262
|
// src/protocol/controller.ts
|
|
232
|
-
var
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var controllerOrientationSchema = import_zod3.z.enum(["portrait", "landscape"]);
|
|
238
|
-
var controllerSourceSchema = import_zod3.z.enum(["phone", "preview", "virtual"]);
|
|
239
|
-
var controllerStateSchema = import_zod3.z.object({
|
|
240
|
-
roomId: roomCodeSchema,
|
|
241
|
-
state: import_zod3.z.object({
|
|
242
|
-
orientation: controllerOrientationSchema.optional(),
|
|
243
|
-
message: import_zod3.z.string().optional(),
|
|
244
|
-
roomSettings: import_zod3.z.object({
|
|
245
|
-
audio: import_zod3.z.object({
|
|
246
|
-
masterVolume: import_zod3.z.number().min(0).max(1),
|
|
247
|
-
musicVolume: import_zod3.z.number().min(0).max(1),
|
|
248
|
-
sfxVolume: import_zod3.z.number().min(0).max(1)
|
|
249
|
-
}),
|
|
250
|
-
previewControllers: import_zod3.z.object({
|
|
251
|
-
activeOpacity: import_zod3.z.number().min(0).max(1)
|
|
252
|
-
})
|
|
253
|
-
}).optional(),
|
|
254
|
-
runtimeState: import_zod3.z.enum(["paused", "playing"]).optional(),
|
|
255
|
-
stateVersion: import_zod3.z.number().int().nonnegative().optional()
|
|
256
|
-
})
|
|
257
|
-
});
|
|
258
|
-
var controllerJoinSchema = import_zod3.z.object({
|
|
259
|
-
roomId: roomCodeSchema,
|
|
260
|
-
controllerId: import_zod3.z.string().min(3),
|
|
261
|
-
/**
|
|
262
|
-
* Local device/source hint, never authority to resume a controller slot.
|
|
263
|
-
*/
|
|
264
|
-
deviceId: import_zod3.z.string().min(8).max(128).optional(),
|
|
265
|
-
nickname: import_zod3.z.string().trim().min(1).max(24).optional(),
|
|
266
|
-
/** Preset avatar key (platform-defined); optional at join. */
|
|
267
|
-
avatarId: import_zod3.z.string().trim().min(1).max(48).optional(),
|
|
268
|
-
capabilityToken: import_zod3.z.string().min(1).optional(),
|
|
269
|
-
/** Private server-issued proof required to resume an existing controller. */
|
|
270
|
-
resumeCapabilityToken: import_zod3.z.string().min(1).max(128).optional()
|
|
271
|
-
});
|
|
272
|
-
var controllerLeaveSchema = import_zod3.z.object({
|
|
273
|
-
roomId: roomCodeSchema,
|
|
274
|
-
controllerId: import_zod3.z.string().min(3)
|
|
275
|
-
});
|
|
276
|
-
var controllerSystemSchema = import_zod3.z.object({
|
|
277
|
-
roomId: roomCodeSchema,
|
|
278
|
-
command: import_zod3.z.enum(["exit", "pause", "resume"])
|
|
263
|
+
var playerProfileSchema = import_zod3.z.object({
|
|
264
|
+
id: import_zod3.z.string(),
|
|
265
|
+
label: import_zod3.z.string(),
|
|
266
|
+
color: import_zod3.z.string().optional(),
|
|
267
|
+
avatarId: import_zod3.z.string().optional()
|
|
279
268
|
});
|
|
280
269
|
var playerProfilePatchSchema = import_zod3.z.object({
|
|
281
270
|
label: import_zod3.z.string().trim().min(1).max(24).optional(),
|
|
282
271
|
avatarId: import_zod3.z.string().trim().min(1).max(48).optional()
|
|
283
272
|
}).strict();
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
"system",
|
|
294
|
-
"play_sound",
|
|
295
|
-
"action_rpc"
|
|
273
|
+
|
|
274
|
+
// src/protocol/core.ts
|
|
275
|
+
var import_zod4 = require("zod");
|
|
276
|
+
var connectionStatusSchema = import_zod4.z.enum([
|
|
277
|
+
"idle",
|
|
278
|
+
"connecting",
|
|
279
|
+
"connected",
|
|
280
|
+
"disconnected",
|
|
281
|
+
"reconnecting"
|
|
296
282
|
]);
|
|
297
|
-
var controllerPrivilegedCapabilitySchema = import_zod3.z.object({
|
|
298
|
-
token: import_zod3.z.string().min(1),
|
|
299
|
-
expiresAt: import_zod3.z.number().int().positive(),
|
|
300
|
-
grants: import_zod3.z.array(controllerPrivilegedGrantSchema).min(1)
|
|
301
|
-
});
|
|
302
283
|
|
|
303
284
|
// src/protocol/dev-log-events.ts
|
|
304
285
|
var AIRJAM_DEV_LOG_EVENTS = {
|
|
@@ -306,18 +287,9 @@ var AIRJAM_DEV_LOG_EVENTS = {
|
|
|
306
287
|
started: "server.started",
|
|
307
288
|
startupFailed: "server.startup.failed"
|
|
308
289
|
},
|
|
309
|
-
socket: {
|
|
310
|
-
connected: "socket.connected",
|
|
311
|
-
disconnected: "socket.disconnected"
|
|
312
|
-
},
|
|
313
290
|
auth: {
|
|
314
291
|
modeDisabled: "auth.mode.disabled",
|
|
315
|
-
modeMasterKey: "auth.mode.master_key"
|
|
316
|
-
modeDatabaseAndHostGrant: "auth.mode.database_and_host_grant",
|
|
317
|
-
modeDatabase: "auth.mode.database",
|
|
318
|
-
backendMissing: "auth.backend.missing",
|
|
319
|
-
appIdLastUsedAtUpdateFailed: "auth.app_id_last_used_at_update.failed",
|
|
320
|
-
appIdVerificationDatabaseError: "auth.app_id_verification.database_error"
|
|
292
|
+
modeMasterKey: "auth.mode.master_key"
|
|
321
293
|
},
|
|
322
294
|
browser: {
|
|
323
295
|
logSessionStarted: "browser.log_session.started",
|
|
@@ -333,82 +305,18 @@ var AIRJAM_DEV_LOG_EVENTS = {
|
|
|
333
305
|
providerUnmounted: "runtime.provider.unmounted",
|
|
334
306
|
windowBeforeUnload: "runtime.window.beforeunload",
|
|
335
307
|
windowPageHide: "runtime.window.pagehide",
|
|
336
|
-
|
|
337
|
-
socketDisconnected: "runtime.socket.disconnected",
|
|
338
|
-
socketConnectError: "runtime.socket.connect_error",
|
|
339
|
-
hostCreateRoomRequested: "runtime.host.create_room.requested",
|
|
340
|
-
hostReconnectRequested: "runtime.host.reconnect.requested",
|
|
341
|
-
hostReconnectRetryScheduled: "runtime.host.reconnect.retry_scheduled",
|
|
308
|
+
roomStatus: "runtime.room.status",
|
|
342
309
|
hostResetRoomRequested: "runtime.host.reset_room.requested",
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
310
|
+
clipCaptureFailed: "runtime.host.clip_capture_failed",
|
|
311
|
+
hostFrameFault: "runtime.host.frame_fault",
|
|
312
|
+
errorReport: "runtime.error_report",
|
|
346
313
|
phaseTransition: "runtime.phase.transition",
|
|
347
|
-
stateVersionReceived: "runtime.state_version.received",
|
|
348
|
-
invariantViolation: "runtime.invariant.violation",
|
|
349
314
|
embeddedBridgeRequested: "runtime.embedded_bridge.requested",
|
|
350
|
-
embeddedBridgeAttached: "runtime.embedded_bridge.attached",
|
|
351
315
|
embeddedBridgeRejected: "runtime.embedded_bridge.rejected",
|
|
352
|
-
embeddedBridgeClosed: "runtime.embedded_bridge.closed",
|
|
353
316
|
browserLogSinkFailure: "runtime.browser_log_sink.failure"
|
|
354
317
|
},
|
|
355
318
|
host: {
|
|
356
|
-
|
|
357
|
-
bootstrapVerified: "host.bootstrap.verified",
|
|
358
|
-
bootstrapRejected: "host.bootstrap.rejected",
|
|
359
|
-
disconnectPendingRoomClose: "host.disconnect.pending_room_close",
|
|
360
|
-
disconnectRoomClosed: "host.disconnect.room_closed",
|
|
361
|
-
createRoomAccepted: "host.create_room.accepted",
|
|
362
|
-
createRoomRejected: "host.create_room.rejected",
|
|
363
|
-
reconnectAccepted: "host.reconnect.accepted",
|
|
364
|
-
reconnectRejected: "host.reconnect.rejected",
|
|
365
|
-
resetRoomAccepted: "host.reset_room.accepted",
|
|
366
|
-
resetRoomRejected: "host.reset_room.rejected",
|
|
367
|
-
systemAccepted: "host.system.accepted",
|
|
368
|
-
systemRejected: "host.system.rejected",
|
|
369
|
-
stateRejected: "host.state.rejected",
|
|
370
|
-
signalRejected: "host.signal.rejected",
|
|
371
|
-
playSoundRejected: "host.play_sound.rejected",
|
|
372
|
-
stateBroadcastSummary: "host.state_broadcast.summary",
|
|
373
|
-
reconnectStateReconcile: "host.reconnect.state_reconcile",
|
|
374
|
-
stateSyncSummary: "host.state_sync.summary",
|
|
375
|
-
stateSyncRejected: "host.state_sync.rejected"
|
|
376
|
-
},
|
|
377
|
-
controller: {
|
|
378
|
-
joinAccepted: "controller.join.accepted",
|
|
379
|
-
joinRejected: "controller.join.rejected",
|
|
380
|
-
resumeAccepted: "controller.resume.accepted",
|
|
381
|
-
disconnectPendingResume: "controller.disconnect.pending_resume",
|
|
382
|
-
disconnectLeaseExpired: "controller.disconnect.lease_expired",
|
|
383
|
-
disconnectApplied: "controller.disconnect.applied",
|
|
384
|
-
profileUpdateAccepted: "controller.profile_update.accepted",
|
|
385
|
-
profileUpdateRejected: "controller.profile_update.rejected",
|
|
386
|
-
leaveAccepted: "controller.leave.accepted",
|
|
387
|
-
leaveRejected: "controller.leave.rejected",
|
|
388
|
-
inputSummary: "controller.input.summary",
|
|
389
|
-
inputDroppedSummary: "controller.input_dropped.summary",
|
|
390
|
-
inputRejected: "controller.input.rejected",
|
|
391
|
-
systemAccepted: "controller.system.accepted",
|
|
392
|
-
systemRejected: "controller.system.rejected",
|
|
393
|
-
playSoundRejected: "controller.play_sound.rejected",
|
|
394
|
-
actionRpcSummary: "controller.action_rpc.summary",
|
|
395
|
-
actionRpcRejected: "controller.action_rpc.rejected"
|
|
396
|
-
},
|
|
397
|
-
system: {
|
|
398
|
-
launchGameAccepted: "system.launch_game.accepted",
|
|
399
|
-
launchGameRejected: "system.launch_game.rejected",
|
|
400
|
-
closeGameAccepted: "system.close_game.accepted",
|
|
401
|
-
closeGameRejected: "system.close_game.rejected"
|
|
402
|
-
},
|
|
403
|
-
childHost: {
|
|
404
|
-
joinAccepted: "child_host.join.accepted",
|
|
405
|
-
joinRejected: "child_host.join.rejected",
|
|
406
|
-
disconnectPendingSystemFocus: "child_host.disconnect.pending_system_focus",
|
|
407
|
-
disconnectSystemFocusRestored: "child_host.disconnect.system_focus_restored"
|
|
408
|
-
},
|
|
409
|
-
embeddedGame: {
|
|
410
|
-
activateAccepted: "embedded_game.activate.accepted",
|
|
411
|
-
activateRejected: "embedded_game.activate.rejected"
|
|
319
|
+
stateRestoreDiscarded: "host.state_restore.discarded"
|
|
412
320
|
}
|
|
413
321
|
};
|
|
414
322
|
var AIRJAM_BROWSER_LOG_EVENT_BY_SOURCE = {
|
|
@@ -419,109 +327,499 @@ var AIRJAM_BROWSER_LOG_EVENT_BY_SOURCE = {
|
|
|
419
327
|
runtime: AIRJAM_DEV_LOG_EVENTS.browser.runtime
|
|
420
328
|
};
|
|
421
329
|
|
|
422
|
-
// src/protocol/
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
330
|
+
// src/protocol/leased-control.ts
|
|
331
|
+
var import_zod11 = require("zod");
|
|
332
|
+
|
|
333
|
+
// src/protocol/room/addressing.ts
|
|
334
|
+
var import_zod5 = require("zod");
|
|
335
|
+
var roomCodeSchema = import_zod5.z.string().regex(/^[A-Z0-9]{4,8}$/);
|
|
336
|
+
|
|
337
|
+
// src/protocol/room/frames.ts
|
|
338
|
+
var import_zod8 = require("zod");
|
|
339
|
+
|
|
340
|
+
// src/protocol/room/limits.ts
|
|
341
|
+
var import_zod6 = require("zod");
|
|
342
|
+
var MAXIMUM_ROOM_SEATS = 16;
|
|
343
|
+
var count = import_zod6.z.number().int().positive();
|
|
344
|
+
var duration = import_zod6.z.number().int().nonnegative();
|
|
345
|
+
var roomLimitsShape = {
|
|
346
|
+
seats: count.max(MAXIMUM_ROOM_SEATS),
|
|
347
|
+
channels: count,
|
|
348
|
+
/** How often a phone may send its controls; phones coalesce to it. */
|
|
349
|
+
inputIntervalMs: count,
|
|
350
|
+
/** One phone's whole control state; a host input record states its length in one byte. */
|
|
351
|
+
inputBytes: count.max(255),
|
|
352
|
+
inputsPerSecond: count,
|
|
353
|
+
/** The most a channel's document, or any one state frame, may weigh. */
|
|
354
|
+
stateBytes: count,
|
|
355
|
+
statesPerSecond: count,
|
|
356
|
+
/** The most any other text frame may weigh. */
|
|
357
|
+
frameBytes: count,
|
|
358
|
+
/** Text frames other than state, per connection. */
|
|
359
|
+
framesPerSecond: count,
|
|
360
|
+
/** Frames that do not parse, within one second, before the connection is closed. */
|
|
361
|
+
strikesPerSecond: count,
|
|
362
|
+
seatHoldMs: duration,
|
|
363
|
+
/** How long the room waits for its host, as it opens and after the host's connection ends. */
|
|
364
|
+
hostGraceMs: count,
|
|
365
|
+
maximumAgeMs: count
|
|
366
|
+
};
|
|
367
|
+
var roomLimitsSchema = import_zod6.z.strictObject(roomLimitsShape);
|
|
368
|
+
var roomLimitsWireSchema = import_zod6.z.object(roomLimitsShape);
|
|
369
|
+
var DEFAULT_ROOM_LIMITS = Object.freeze({
|
|
370
|
+
seats: MAXIMUM_ROOM_SEATS,
|
|
371
|
+
channels: 8,
|
|
372
|
+
inputIntervalMs: 16,
|
|
373
|
+
inputBytes: 64,
|
|
374
|
+
inputsPerSecond: 120,
|
|
375
|
+
stateBytes: 65536,
|
|
376
|
+
statesPerSecond: 60,
|
|
377
|
+
frameBytes: 8192,
|
|
378
|
+
framesPerSecond: 60,
|
|
379
|
+
strikesPerSecond: 64,
|
|
380
|
+
seatHoldMs: 12e4,
|
|
381
|
+
hostGraceMs: 6e4,
|
|
382
|
+
maximumAgeMs: 24 * 60 * 60 * 1e3
|
|
428
383
|
});
|
|
429
|
-
|
|
430
|
-
|
|
384
|
+
|
|
385
|
+
// src/protocol/room/patch.ts
|
|
386
|
+
var isPlainObject = (value) => {
|
|
387
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
388
|
+
return false;
|
|
389
|
+
const prototype = Object.getPrototypeOf(value);
|
|
390
|
+
return prototype === Object.prototype || prototype === null;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// src/protocol/room/seat-id.ts
|
|
394
|
+
var import_zod7 = require("zod");
|
|
395
|
+
var seatIdSchema = import_zod7.z.string().regex(/^p[1-9][0-9]{0,4}$/);
|
|
396
|
+
|
|
397
|
+
// src/protocol/room/frames.ts
|
|
398
|
+
var MAXIMUM_FRAME_DEPTH = 32;
|
|
399
|
+
var keySchema = import_zod8.z.string().min(16).max(128);
|
|
400
|
+
var instanceSchema = import_zod8.z.string().min(1).max(64);
|
|
401
|
+
var channelSchema = import_zod8.z.string().min(1).max(128);
|
|
402
|
+
var revisionSchema = import_zod8.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
403
|
+
var requestIdSchema = import_zod8.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
404
|
+
var featuresSchema = import_zod8.z.array(import_zod8.z.string().min(1).max(64)).max(32);
|
|
405
|
+
var documentSchema = import_zod8.z.custom(isPlainObject, {
|
|
406
|
+
message: "A state document is a plain JSON object."
|
|
431
407
|
});
|
|
432
|
-
var
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
408
|
+
var pathSchema = import_zod8.z.array(import_zod8.z.string()).min(1).max(32);
|
|
409
|
+
var seatKindSchema = import_zod8.z.enum(["phone", "preview", "agent"]);
|
|
410
|
+
var seatProfileSchema = import_zod8.z.object({
|
|
411
|
+
label: import_zod8.z.string().trim().min(1).max(24).optional(),
|
|
412
|
+
avatarId: import_zod8.z.string().trim().min(1).max(48).optional(),
|
|
413
|
+
/** Shown instead of the label while a local seat plays through this phone. */
|
|
414
|
+
localSeatLabel: import_zod8.z.string().trim().min(1).max(32).optional()
|
|
436
415
|
});
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
|
|
416
|
+
var helloFields = {
|
|
417
|
+
type: import_zod8.z.literal("hello"),
|
|
418
|
+
key: keySchema,
|
|
419
|
+
instance: instanceSchema.optional(),
|
|
420
|
+
sdk: import_zod8.z.string().min(1).max(64),
|
|
421
|
+
features: featuresSchema.optional()
|
|
422
|
+
};
|
|
423
|
+
var hostHelloSchema = import_zod8.z.object({
|
|
424
|
+
...helloFields,
|
|
425
|
+
/** Opaque to the room; the gate reads it before the room opens. */
|
|
426
|
+
credential: import_zod8.z.string().min(1).max(8192).optional(),
|
|
427
|
+
/** How many players the game takes; the room admits no more. */
|
|
428
|
+
seats: import_zod8.z.number().int().min(1).max(MAXIMUM_ROOM_SEATS)
|
|
440
429
|
});
|
|
441
|
-
var
|
|
442
|
-
|
|
443
|
-
|
|
430
|
+
var phoneHelloSchema = import_zod8.z.object({
|
|
431
|
+
...helloFields,
|
|
432
|
+
kind: seatKindSchema,
|
|
433
|
+
profile: seatProfileSchema.optional(),
|
|
434
|
+
/**
|
|
435
|
+
* The page this phone runs in, the same across its reconnects. A seat
|
|
436
|
+
* resumed from another page (a reload, or another tab taking it over)
|
|
437
|
+
* starts its controls afresh, so the host takes a new input baseline.
|
|
438
|
+
*/
|
|
439
|
+
page: import_zod8.z.string().min(1).max(64).optional()
|
|
444
440
|
});
|
|
445
|
-
var
|
|
446
|
-
|
|
447
|
-
|
|
441
|
+
var statePatchFields = {
|
|
442
|
+
type: import_zod8.z.literal("state"),
|
|
443
|
+
channel: channelSchema,
|
|
444
|
+
revision: revisionSchema,
|
|
445
|
+
base: revisionSchema,
|
|
446
|
+
set: import_zod8.z.array(import_zod8.z.tuple([pathSchema, import_zod8.z.unknown()])).default([]),
|
|
447
|
+
unset: import_zod8.z.array(pathSchema).default([])
|
|
448
|
+
};
|
|
449
|
+
var stateDocumentFields = {
|
|
450
|
+
type: import_zod8.z.literal("state"),
|
|
451
|
+
channel: channelSchema,
|
|
452
|
+
revision: revisionSchema,
|
|
453
|
+
document: documentSchema
|
|
454
|
+
};
|
|
455
|
+
var hostStateFrameSchema = import_zod8.z.union([
|
|
456
|
+
import_zod8.z.object({
|
|
457
|
+
...stateDocumentFields,
|
|
458
|
+
/** The store's shape, so a reloading host knows whether to take its state back. */
|
|
459
|
+
fingerprint: import_zod8.z.string().min(1).max(256).optional(),
|
|
460
|
+
/** A top-level field keyed by seat whose entries only their own seat sees. */
|
|
461
|
+
private: import_zod8.z.string().min(1).max(128).optional()
|
|
462
|
+
}),
|
|
463
|
+
import_zod8.z.object(statePatchFields).refine(
|
|
464
|
+
(frame) => frame.revision > frame.base,
|
|
465
|
+
"A patch produces a later revision than its base."
|
|
466
|
+
)
|
|
467
|
+
]);
|
|
468
|
+
var hostToRoomFrameSchemas = {
|
|
469
|
+
state: hostStateFrameSchema,
|
|
470
|
+
response: import_zod8.z.object({
|
|
471
|
+
type: import_zod8.z.literal("response"),
|
|
472
|
+
seat: seatIdSchema,
|
|
473
|
+
id: requestIdSchema,
|
|
474
|
+
result: import_zod8.z.unknown().optional()
|
|
475
|
+
}),
|
|
476
|
+
signal: import_zod8.z.object({
|
|
477
|
+
type: import_zod8.z.literal("signal"),
|
|
478
|
+
seat: seatIdSchema.optional(),
|
|
479
|
+
kind: import_zod8.z.string().min(1).max(64),
|
|
480
|
+
payload: import_zod8.z.unknown().optional()
|
|
481
|
+
}),
|
|
482
|
+
room: import_zod8.z.object({
|
|
483
|
+
type: import_zod8.z.literal("room"),
|
|
484
|
+
seats: import_zod8.z.number().int().min(1).max(MAXIMUM_ROOM_SEATS).optional(),
|
|
485
|
+
locked: import_zod8.z.boolean().optional()
|
|
486
|
+
}),
|
|
487
|
+
remove: import_zod8.z.object({ type: import_zod8.z.literal("remove"), seat: seatIdSchema }),
|
|
488
|
+
drop: import_zod8.z.object({ type: import_zod8.z.literal("drop"), channel: channelSchema }),
|
|
489
|
+
activity: import_zod8.z.object({
|
|
490
|
+
type: import_zod8.z.literal("activity"),
|
|
491
|
+
activity: import_zod8.z.string().min(1).max(128).nullable()
|
|
492
|
+
}),
|
|
493
|
+
end: import_zod8.z.object({ type: import_zod8.z.literal("end") })
|
|
494
|
+
};
|
|
495
|
+
var phoneToRoomFrameSchemas = {
|
|
496
|
+
request: import_zod8.z.object({
|
|
497
|
+
type: import_zod8.z.literal("request"),
|
|
498
|
+
id: requestIdSchema,
|
|
499
|
+
channel: channelSchema,
|
|
500
|
+
name: import_zod8.z.string().min(1).max(128),
|
|
501
|
+
payload: import_zod8.z.unknown().optional()
|
|
502
|
+
}),
|
|
503
|
+
profile: import_zod8.z.object({
|
|
504
|
+
type: import_zod8.z.literal("profile"),
|
|
505
|
+
label: seatProfileSchema.shape.label,
|
|
506
|
+
avatarId: seatProfileSchema.shape.avatarId
|
|
507
|
+
}).refine(
|
|
508
|
+
(frame) => frame.label !== void 0 || frame.avatarId !== void 0,
|
|
509
|
+
"A profile change names a label or an avatar."
|
|
510
|
+
),
|
|
511
|
+
leave: import_zod8.z.object({ type: import_zod8.z.literal("leave") }),
|
|
512
|
+
/** This seat's controls start again from zero, as a newly loaded controller frame's do. */
|
|
513
|
+
baseline: import_zod8.z.object({ type: import_zod8.z.literal("baseline") })
|
|
514
|
+
};
|
|
515
|
+
var seatViewSchema = import_zod8.z.object({
|
|
516
|
+
id: seatIdSchema,
|
|
517
|
+
label: import_zod8.z.string(),
|
|
518
|
+
color: import_zod8.z.string(),
|
|
519
|
+
avatarId: import_zod8.z.string().optional(),
|
|
520
|
+
kind: seatKindSchema,
|
|
521
|
+
connected: import_zod8.z.boolean()
|
|
448
522
|
});
|
|
449
|
-
var
|
|
450
|
-
|
|
523
|
+
var channelCopySchema = import_zod8.z.object({
|
|
524
|
+
channel: channelSchema,
|
|
525
|
+
revision: revisionSchema,
|
|
526
|
+
document: documentSchema,
|
|
527
|
+
fingerprint: import_zod8.z.string().optional(),
|
|
528
|
+
private: import_zod8.z.string().optional()
|
|
451
529
|
});
|
|
452
|
-
var
|
|
453
|
-
|
|
454
|
-
|
|
530
|
+
var welcomeFields = {
|
|
531
|
+
type: import_zod8.z.literal("welcome"),
|
|
532
|
+
code: import_zod8.z.string(),
|
|
533
|
+
instance: instanceSchema,
|
|
534
|
+
seats: import_zod8.z.array(seatViewSchema),
|
|
535
|
+
channels: import_zod8.z.array(channelCopySchema),
|
|
536
|
+
limits: roomLimitsWireSchema,
|
|
537
|
+
features: featuresSchema
|
|
538
|
+
};
|
|
539
|
+
var roomStateFrameSchema = import_zod8.z.union([
|
|
540
|
+
import_zod8.z.object(stateDocumentFields),
|
|
541
|
+
import_zod8.z.object(statePatchFields)
|
|
542
|
+
]);
|
|
543
|
+
var roomToHostFrameSchemas = {
|
|
544
|
+
welcome: import_zod8.z.object({
|
|
545
|
+
...welcomeFields,
|
|
546
|
+
/** Seats the room admits, and whether it admits new players at all. */
|
|
547
|
+
seatsWanted: import_zod8.z.number().int().min(1).max(MAXIMUM_ROOM_SEATS),
|
|
548
|
+
locked: import_zod8.z.boolean(),
|
|
549
|
+
activity: import_zod8.z.string().nullable()
|
|
550
|
+
}),
|
|
551
|
+
wait: import_zod8.z.object({
|
|
552
|
+
type: import_zod8.z.literal("wait"),
|
|
553
|
+
position: import_zod8.z.number().int().positive()
|
|
554
|
+
}),
|
|
555
|
+
seat: import_zod8.z.object({
|
|
556
|
+
type: import_zod8.z.literal("seat"),
|
|
557
|
+
seat: seatViewSchema,
|
|
558
|
+
/** The seat's controls restart from a new page: decode them afresh. */
|
|
559
|
+
inputBaseline: import_zod8.z.literal(true).optional()
|
|
560
|
+
}),
|
|
561
|
+
left: import_zod8.z.object({ type: import_zod8.z.literal("left"), seat: seatIdSchema }),
|
|
562
|
+
need: import_zod8.z.object({ type: import_zod8.z.literal("need"), channel: channelSchema }),
|
|
563
|
+
request: import_zod8.z.object({
|
|
564
|
+
type: import_zod8.z.literal("request"),
|
|
565
|
+
seat: seatIdSchema,
|
|
566
|
+
id: requestIdSchema,
|
|
567
|
+
channel: channelSchema,
|
|
568
|
+
name: import_zod8.z.string(),
|
|
569
|
+
payload: import_zod8.z.unknown().optional()
|
|
570
|
+
})
|
|
571
|
+
};
|
|
572
|
+
var roomToPhoneFrameSchemas = {
|
|
573
|
+
welcome: import_zod8.z.object({
|
|
574
|
+
...welcomeFields,
|
|
575
|
+
seat: seatIdSchema,
|
|
576
|
+
host: import_zod8.z.boolean()
|
|
577
|
+
}),
|
|
578
|
+
seat: roomToHostFrameSchemas.seat,
|
|
579
|
+
left: roomToHostFrameSchemas.left,
|
|
580
|
+
host: import_zod8.z.object({ type: import_zod8.z.literal("host"), present: import_zod8.z.boolean() }),
|
|
581
|
+
state: roomStateFrameSchema,
|
|
582
|
+
drop: hostToRoomFrameSchemas.drop,
|
|
583
|
+
// The refusal comes first: a result may be absent, so the other branch
|
|
584
|
+
// would accept a refusal and strip what it says.
|
|
585
|
+
response: import_zod8.z.union([
|
|
586
|
+
import_zod8.z.object({
|
|
587
|
+
type: import_zod8.z.literal("response"),
|
|
588
|
+
id: requestIdSchema,
|
|
589
|
+
/** The room answered itself because no host could. */
|
|
590
|
+
refused: import_zod8.z.literal("host-away")
|
|
591
|
+
}),
|
|
592
|
+
import_zod8.z.object({
|
|
593
|
+
type: import_zod8.z.literal("response"),
|
|
594
|
+
id: requestIdSchema,
|
|
595
|
+
result: import_zod8.z.unknown().optional()
|
|
596
|
+
})
|
|
597
|
+
]),
|
|
598
|
+
signal: import_zod8.z.object({
|
|
599
|
+
type: import_zod8.z.literal("signal"),
|
|
600
|
+
kind: import_zod8.z.string(),
|
|
601
|
+
payload: import_zod8.z.unknown().optional()
|
|
602
|
+
})
|
|
603
|
+
};
|
|
604
|
+
var nestsWithin = (value, depth) => {
|
|
605
|
+
if (typeof value !== "object" || value === null) return true;
|
|
606
|
+
if (depth === 0) return false;
|
|
607
|
+
for (const child of Object.values(value))
|
|
608
|
+
if (!nestsWithin(child, depth - 1)) return false;
|
|
609
|
+
return true;
|
|
610
|
+
};
|
|
611
|
+
var TOO_DEEP = /* @__PURE__ */ Symbol("too deep");
|
|
612
|
+
var parseJson = (text) => {
|
|
613
|
+
let value;
|
|
614
|
+
try {
|
|
615
|
+
value = JSON.parse(text);
|
|
616
|
+
} catch {
|
|
617
|
+
return void 0;
|
|
618
|
+
}
|
|
619
|
+
return nestsWithin(value, MAXIMUM_FRAME_DEPTH) ? value : TOO_DEEP;
|
|
620
|
+
};
|
|
621
|
+
var readType = (value) => isPlainObject(value) && typeof value.type === "string" ? value.type : null;
|
|
622
|
+
var createFrameParser = (schemas) => (text) => {
|
|
623
|
+
const value = parseJson(text);
|
|
624
|
+
if (value === TOO_DEEP) return { status: "too-deep" };
|
|
625
|
+
const type = readType(value);
|
|
626
|
+
if (type === null) return { status: "invalid" };
|
|
627
|
+
if (!Object.hasOwn(schemas, type)) return { status: "unknown" };
|
|
628
|
+
const parsed = schemas[type].safeParse(value);
|
|
629
|
+
return parsed.success ? { status: "frame", frame: parsed.data } : { status: "invalid" };
|
|
630
|
+
};
|
|
631
|
+
var parseHostToRoomFrame = createFrameParser(hostToRoomFrameSchemas);
|
|
632
|
+
var parsePhoneToRoomFrame = createFrameParser(phoneToRoomFrameSchemas);
|
|
633
|
+
var parseRoomToHostFrame = createFrameParser(roomToHostFrameSchemas);
|
|
634
|
+
var parseRoomToPhoneFrame = createFrameParser(roomToPhoneFrameSchemas);
|
|
635
|
+
var createHelloParser = (schema) => (text) => {
|
|
636
|
+
const parsed = schema.safeParse(parseJson(text));
|
|
637
|
+
return parsed.success ? parsed.data : null;
|
|
638
|
+
};
|
|
639
|
+
var parseHostHello = createHelloParser(hostHelloSchema);
|
|
640
|
+
var parsePhoneHello = createHelloParser(phoneHelloSchema);
|
|
641
|
+
|
|
642
|
+
// src/protocol/room/sdk-channels.ts
|
|
643
|
+
var import_zod9 = require("zod");
|
|
644
|
+
var runtimeStateSchema = import_zod9.z.enum(["paused", "playing"]);
|
|
645
|
+
var controllerOrientationSchema = import_zod9.z.enum(["portrait", "landscape"]);
|
|
646
|
+
var presentationDocumentSchema = import_zod9.z.object({
|
|
647
|
+
runtimeState: runtimeStateSchema,
|
|
648
|
+
orientation: controllerOrientationSchema
|
|
455
649
|
});
|
|
456
|
-
var
|
|
457
|
-
|
|
650
|
+
var presentationRequestSchema = import_zod9.z.enum(["pause", "resume"]);
|
|
651
|
+
var hapticSignalPayloadSchema = import_zod9.z.object({
|
|
652
|
+
pattern: import_zod9.z.enum(["light", "medium", "heavy", "success", "failure", "custom"]),
|
|
653
|
+
sequence: import_zod9.z.union([import_zod9.z.number().nonnegative(), import_zod9.z.array(import_zod9.z.number().nonnegative())]).optional()
|
|
458
654
|
});
|
|
459
|
-
var
|
|
460
|
-
|
|
461
|
-
|
|
655
|
+
var toastSignalPayloadSchema = import_zod9.z.object({
|
|
656
|
+
message: import_zod9.z.string(),
|
|
657
|
+
color: import_zod9.z.string().optional(),
|
|
658
|
+
duration: import_zod9.z.number().nonnegative().optional()
|
|
659
|
+
});
|
|
660
|
+
var soundSignalPayloadSchema = import_zod9.z.object({
|
|
661
|
+
soundId: import_zod9.z.string().min(1),
|
|
662
|
+
volume: import_zod9.z.number().min(0).max(1).optional(),
|
|
663
|
+
loop: import_zod9.z.boolean().optional()
|
|
462
664
|
});
|
|
463
665
|
|
|
464
|
-
// src/
|
|
465
|
-
var
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
666
|
+
// src/runtime/contracts/runtime-identity.ts
|
|
667
|
+
var import_zod10 = require("zod");
|
|
668
|
+
var hostRuntimeIdentitySchema = import_zod10.z.object({
|
|
669
|
+
documentId: import_zod10.z.string().min(1).max(128),
|
|
670
|
+
roomId: roomCodeSchema,
|
|
671
|
+
contractId: import_zod10.z.string().min(1),
|
|
672
|
+
runtimeId: import_zod10.z.string().min(1)
|
|
673
|
+
});
|
|
674
|
+
var hostObservationIdentitySchema = hostRuntimeIdentitySchema.extend({
|
|
675
|
+
surfaceId: import_zod10.z.string().min(1).nullable(),
|
|
676
|
+
participantId: import_zod10.z.string().min(1).nullable().default(null)
|
|
677
|
+
});
|
|
678
|
+
var identityKeys = hostObservationIdentitySchema.keyof().options;
|
|
470
679
|
|
|
471
|
-
// src/protocol/
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
680
|
+
// src/protocol/leased-control.ts
|
|
681
|
+
var jsonValueSchema = import_zod11.z.unknown().refine(
|
|
682
|
+
(input) => {
|
|
683
|
+
const pending = [
|
|
684
|
+
{ value: input, depth: 0 }
|
|
685
|
+
];
|
|
686
|
+
for (const current of pending) {
|
|
687
|
+
if (current.depth > 32) return false;
|
|
688
|
+
if (current.value && typeof current.value === "object") {
|
|
689
|
+
for (const value of Object.values(current.value)) {
|
|
690
|
+
if (pending.length >= 4096) return false;
|
|
691
|
+
pending.push({ value, depth: current.depth + 1 });
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return true;
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
error: "Participant JSON exceeds its depth or node budget.",
|
|
699
|
+
abort: true
|
|
700
|
+
}
|
|
701
|
+
).pipe(import_zod11.z.json());
|
|
702
|
+
var PARTICIPANT_INPUT_SCHEMA_BYTES = 32e3;
|
|
703
|
+
var participantInputSchemaDescriptionSchema = import_zod11.z.discriminatedUnion(
|
|
704
|
+
"status",
|
|
705
|
+
[
|
|
706
|
+
import_zod11.z.object({
|
|
707
|
+
status: import_zod11.z.literal("available"),
|
|
708
|
+
schema: import_zod11.z.record(import_zod11.z.string(), jsonValueSchema).refine(
|
|
709
|
+
(schema) => new TextEncoder().encode(JSON.stringify(schema)).byteLength <= PARTICIPANT_INPUT_SCHEMA_BYTES,
|
|
710
|
+
"Input JSON Schema exceeds its byte budget."
|
|
711
|
+
)
|
|
712
|
+
}).strict(),
|
|
713
|
+
import_zod11.z.object({
|
|
714
|
+
status: import_zod11.z.literal("unavailable"),
|
|
715
|
+
reason: import_zod11.z.enum(["not-configured", "not-representable"])
|
|
716
|
+
}).strict()
|
|
717
|
+
]
|
|
718
|
+
);
|
|
719
|
+
var leaseSequenceSchema = import_zod11.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
720
|
+
var deadlineMs = import_zod11.z.number().nonnegative().max(Number.MAX_SAFE_INTEGER).describe(
|
|
721
|
+
"Admission deadline in the observed host's monotonic clock. Derive it from observation.clock.startedAtMs; never use the caller's clock."
|
|
722
|
+
);
|
|
723
|
+
var participantInputOperationSchema = import_zod11.z.object({
|
|
724
|
+
kind: import_zod11.z.literal("input"),
|
|
725
|
+
deadlineMs,
|
|
726
|
+
input: import_zod11.z.record(import_zod11.z.string(), jsonValueSchema),
|
|
727
|
+
ttlMs: import_zod11.z.number().int().min(50).max(2e3)
|
|
484
728
|
}).strict();
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
reportId: import_zod6.z.string().uuid(),
|
|
492
|
-
roomId: roomCodeSchema,
|
|
493
|
-
role: import_zod6.z.enum(["host", "controller"]),
|
|
494
|
-
code: import_zod6.z.literal("AJ_RUNTIME_RENDER_CRASH"),
|
|
495
|
-
errorName: import_zod6.z.string().trim().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9._-]*$/u),
|
|
496
|
-
digest: import_zod6.z.string().regex(/^[a-f0-9]{8}$/u),
|
|
497
|
-
occurredAt: import_zod6.z.string().datetime()
|
|
729
|
+
var participantReleaseOperationSchema = import_zod11.z.object({ kind: import_zod11.z.literal("release") }).strict();
|
|
730
|
+
var participantActionOperationSchema = import_zod11.z.object({
|
|
731
|
+
kind: import_zod11.z.literal("action"),
|
|
732
|
+
deadlineMs,
|
|
733
|
+
actionId: import_zod11.z.string().min(1).max(128),
|
|
734
|
+
input: jsonValueSchema.optional()
|
|
498
735
|
}).strict();
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
storeDomain: import_zod7.z.string().trim().min(1).max(128)
|
|
736
|
+
var operationSchema = import_zod11.z.discriminatedUnion("kind", [
|
|
737
|
+
participantInputOperationSchema,
|
|
738
|
+
participantReleaseOperationSchema,
|
|
739
|
+
participantActionOperationSchema
|
|
740
|
+
]);
|
|
741
|
+
var leasedControlRequestSchema = import_zod11.z.object({
|
|
742
|
+
lease: import_zod11.z.object({ id: import_zod11.z.uuid(), sequence: leaseSequenceSchema }).strict(),
|
|
743
|
+
expected: hostObservationIdentitySchema.strict(),
|
|
744
|
+
operation: operationSchema
|
|
509
745
|
}).strict();
|
|
510
|
-
var
|
|
746
|
+
var controllerLeasedControlSchema = leasedControlRequestSchema.extend({
|
|
511
747
|
roomId: roomCodeSchema,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
var
|
|
748
|
+
controllerId: import_zod11.z.string().min(1).max(128)
|
|
749
|
+
}).strict().refine(
|
|
750
|
+
(value) => value.roomId === value.expected.roomId,
|
|
751
|
+
"Participant control must target the observed room."
|
|
752
|
+
);
|
|
753
|
+
var controllerLeasedControlAckSchema = import_zod11.z.discriminatedUnion("status", [
|
|
754
|
+
import_zod11.z.object({
|
|
755
|
+
status: import_zod11.z.literal("applied"),
|
|
756
|
+
leaseId: import_zod11.z.uuid(),
|
|
757
|
+
sequence: leaseSequenceSchema,
|
|
758
|
+
replayed: import_zod11.z.boolean(),
|
|
759
|
+
operation: import_zod11.z.discriminatedUnion("kind", [
|
|
760
|
+
import_zod11.z.object({ kind: import_zod11.z.literal("input") }).strict(),
|
|
761
|
+
import_zod11.z.object({ kind: import_zod11.z.literal("release") }).strict(),
|
|
762
|
+
import_zod11.z.object({
|
|
763
|
+
kind: import_zod11.z.literal("action"),
|
|
764
|
+
result: airJamActionInvocationResultSchema
|
|
765
|
+
}).strict()
|
|
766
|
+
])
|
|
767
|
+
}).strict(),
|
|
768
|
+
import_zod11.z.object({
|
|
769
|
+
status: import_zod11.z.literal("rejected"),
|
|
770
|
+
reason: import_zod11.z.enum([
|
|
771
|
+
"invalid_request",
|
|
772
|
+
"rate_limited",
|
|
773
|
+
"invalid_input",
|
|
774
|
+
"invalid_action",
|
|
775
|
+
"invalid_action_lane",
|
|
776
|
+
"room_not_found",
|
|
777
|
+
"unauthorized",
|
|
778
|
+
"active_host_missing",
|
|
779
|
+
"busy",
|
|
780
|
+
"stale_identity",
|
|
781
|
+
"stale_decision",
|
|
782
|
+
"invalid_deadline",
|
|
783
|
+
"lease_conflict",
|
|
784
|
+
"stale_sequence",
|
|
785
|
+
"sequence_conflict",
|
|
786
|
+
"unsupported"
|
|
787
|
+
])
|
|
788
|
+
}).strict(),
|
|
789
|
+
import_zod11.z.object({
|
|
790
|
+
status: import_zod11.z.literal("unconfirmed"),
|
|
791
|
+
reason: import_zod11.z.enum([
|
|
792
|
+
"host_ack_unavailable",
|
|
793
|
+
"transport_ack_unavailable",
|
|
794
|
+
"runtime_replaced",
|
|
795
|
+
"invalid_acknowledgement",
|
|
796
|
+
"runtime_unavailable"
|
|
797
|
+
])
|
|
798
|
+
}).strict()
|
|
799
|
+
]);
|
|
800
|
+
|
|
801
|
+
// src/protocol/runtime-reporting.ts
|
|
802
|
+
var import_zod12 = require("zod");
|
|
803
|
+
var AIRJAM_RUNTIME_ERROR_REPORT_CONTRACT_VERSION = 2;
|
|
804
|
+
var runtimeErrorReportSchema = import_zod12.z.object({
|
|
805
|
+
contractVersion: import_zod12.z.literal(AIRJAM_RUNTIME_ERROR_REPORT_CONTRACT_VERSION),
|
|
806
|
+
reportId: import_zod12.z.uuid(),
|
|
518
807
|
roomId: roomCodeSchema,
|
|
519
|
-
|
|
520
|
-
|
|
808
|
+
instance: import_zod12.z.string().min(1).max(64),
|
|
809
|
+
role: import_zod12.z.enum(["host", "controller"]),
|
|
810
|
+
seat: seatIdSchema.optional(),
|
|
811
|
+
code: import_zod12.z.literal("AJ_RUNTIME_RENDER_CRASH"),
|
|
812
|
+
errorName: import_zod12.z.string().trim().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9._-]*$/u),
|
|
813
|
+
digest: import_zod12.z.string().regex(/^[a-f0-9]{8}$/u),
|
|
814
|
+
occurredAt: import_zod12.z.iso.datetime()
|
|
521
815
|
}).strict();
|
|
522
816
|
|
|
817
|
+
// src/protocol/signed-envelope.ts
|
|
818
|
+
var encoder = new TextEncoder();
|
|
819
|
+
var decoder = new TextDecoder();
|
|
820
|
+
|
|
523
821
|
// src/protocol/url-policy.ts
|
|
524
|
-
var
|
|
822
|
+
var import_zod13 = require("zod");
|
|
525
823
|
var ALLOWED_RUNTIME_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
526
824
|
var parseRuntimeUrl = (value) => {
|
|
527
825
|
try {
|
|
@@ -537,7 +835,11 @@ var parseRuntimeUrl = (value) => {
|
|
|
537
835
|
return null;
|
|
538
836
|
}
|
|
539
837
|
};
|
|
540
|
-
var
|
|
838
|
+
var normalizeRuntimeUrl = (value) => {
|
|
839
|
+
const parsed = parseRuntimeUrl(value);
|
|
840
|
+
return parsed ? parsed.toString() : null;
|
|
841
|
+
};
|
|
842
|
+
var runtimeUrlSchema = import_zod13.z.string().trim().min(1).refine((value) => parseRuntimeUrl(value) !== null, {
|
|
541
843
|
message: "URL must be a valid http(s) URL without embedded credentials."
|
|
542
844
|
});
|
|
543
845
|
|
|
@@ -785,11 +1087,681 @@ var parseRuntimeTopologyFromSearchParams = (params) => {
|
|
|
785
1087
|
});
|
|
786
1088
|
};
|
|
787
1089
|
|
|
788
|
-
// src/
|
|
789
|
-
|
|
1090
|
+
// src/runtime/embedded-parent.ts
|
|
1091
|
+
function embeddedRuntimeParent(topology) {
|
|
1092
|
+
if (typeof window === "undefined" || window.parent === window || !topology.embedded)
|
|
1093
|
+
return null;
|
|
1094
|
+
if (!topology.embedParentOrigin)
|
|
1095
|
+
throw new Error("An embedded runtime requires its declared parent origin.");
|
|
1096
|
+
return {
|
|
1097
|
+
window: window.parent,
|
|
1098
|
+
origin: new URL(topology.embedParentOrigin).origin
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// src/core/hosted-rooms.ts
|
|
1103
|
+
var AIR_JAM_HOSTED_ENVIRONMENTS = [
|
|
1104
|
+
{
|
|
1105
|
+
name: "production",
|
|
1106
|
+
roomsOrigin: "https://rooms.airjam.io",
|
|
1107
|
+
platformOrigin: "https://airjam.io"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
name: "beta",
|
|
1111
|
+
roomsOrigin: "https://rooms.beta.airjam.io",
|
|
1112
|
+
platformOrigin: "https://beta.airjam.io"
|
|
1113
|
+
}
|
|
1114
|
+
];
|
|
1115
|
+
var AIR_JAM_HOSTED_ROOMS_ORIGIN = AIR_JAM_HOSTED_ENVIRONMENTS[0].roomsOrigin;
|
|
1116
|
+
|
|
1117
|
+
// src/runtime/browser-replay.ts
|
|
1118
|
+
var import_zod24 = require("zod");
|
|
1119
|
+
|
|
1120
|
+
// src/core/input-log.ts
|
|
1121
|
+
var import_zod15 = require("zod");
|
|
1122
|
+
|
|
1123
|
+
// src/core/settings.ts
|
|
1124
|
+
var import_zod14 = require("zod");
|
|
1125
|
+
var common = {
|
|
1126
|
+
live: import_zod14.z.boolean().default(false),
|
|
1127
|
+
description: import_zod14.z.string().min(1).optional()
|
|
1128
|
+
};
|
|
1129
|
+
var numberSettingSchema = import_zod14.z.object({
|
|
1130
|
+
kind: import_zod14.z.literal("number"),
|
|
1131
|
+
default: import_zod14.z.number().finite(),
|
|
1132
|
+
min: import_zod14.z.number().finite(),
|
|
1133
|
+
max: import_zod14.z.number().finite(),
|
|
1134
|
+
step: import_zod14.z.number().finite().positive().optional(),
|
|
1135
|
+
...common
|
|
1136
|
+
}).strict();
|
|
1137
|
+
var booleanSettingSchema = import_zod14.z.object({
|
|
1138
|
+
kind: import_zod14.z.literal("boolean"),
|
|
1139
|
+
default: import_zod14.z.boolean(),
|
|
1140
|
+
...common
|
|
1141
|
+
}).strict();
|
|
1142
|
+
var choiceSettingSchema = import_zod14.z.object({
|
|
1143
|
+
kind: import_zod14.z.literal("choice"),
|
|
1144
|
+
options: import_zod14.z.array(import_zod14.z.string().min(1)).nonempty(),
|
|
1145
|
+
default: import_zod14.z.string(),
|
|
1146
|
+
...common
|
|
1147
|
+
}).strict();
|
|
1148
|
+
var airJamSettingSchema = import_zod14.z.discriminatedUnion("kind", [
|
|
1149
|
+
numberSettingSchema,
|
|
1150
|
+
booleanSettingSchema,
|
|
1151
|
+
choiceSettingSchema
|
|
1152
|
+
]);
|
|
1153
|
+
var airJamSettingsValuesSchema = import_zod14.z.record(
|
|
1154
|
+
import_zod14.z.string(),
|
|
1155
|
+
import_zod14.z.union([import_zod14.z.number().finite(), import_zod14.z.boolean(), import_zod14.z.string()])
|
|
1156
|
+
);
|
|
1157
|
+
|
|
1158
|
+
// src/core/input-log.ts
|
|
1159
|
+
var AIR_JAM_INPUT_LOG_EVENTS = [
|
|
1160
|
+
"seat",
|
|
1161
|
+
"left",
|
|
1162
|
+
"input",
|
|
1163
|
+
"runtime",
|
|
1164
|
+
"action",
|
|
1165
|
+
"settings"
|
|
1166
|
+
];
|
|
1167
|
+
var inputLogEntrySchema = import_zod15.z.object({
|
|
1168
|
+
/** The step the event reached the game before. */
|
|
1169
|
+
tick: import_zod15.z.number().int().positive(),
|
|
1170
|
+
event: import_zod15.z.enum(AIR_JAM_INPUT_LOG_EVENTS),
|
|
1171
|
+
payload: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.unknown())
|
|
1172
|
+
}).strict();
|
|
1173
|
+
var airJamInputLogSchema = import_zod15.z.object({
|
|
1174
|
+
version: import_zod15.z.literal(3),
|
|
1175
|
+
settings: airJamSettingsValuesSchema,
|
|
1176
|
+
seed: import_zod15.z.number().int().min(0).max(4294967295),
|
|
1177
|
+
stepMs: import_zod15.z.number().positive(),
|
|
1178
|
+
/** Steps the recorded host took. */
|
|
1179
|
+
ticks: import_zod15.z.number().int().nonnegative(),
|
|
1180
|
+
/** The store domain of stores that declare none, so actions find their store again. */
|
|
1181
|
+
storeDomain: import_zod15.z.string().min(1),
|
|
1182
|
+
entries: import_zod15.z.array(inputLogEntrySchema)
|
|
1183
|
+
}).strict();
|
|
1184
|
+
var AIR_JAM_INPUT_LOG_MAX_GAME_MS = 30 * 60 * 1e3;
|
|
1185
|
+
var AIR_JAM_INPUT_LOG_MAX_ENTRY_BYTES = 16 * 1024 * 1024;
|
|
1186
|
+
|
|
1187
|
+
// src/core/replay-input-log.ts
|
|
1188
|
+
var import_zod23 = require("zod");
|
|
1189
|
+
|
|
1190
|
+
// src/runtime/contracts/control.ts
|
|
1191
|
+
var import_nanoid2 = require("nanoid");
|
|
1192
|
+
var import_zod22 = require("zod");
|
|
1193
|
+
|
|
1194
|
+
// src/agent/agent-evaluator.ts
|
|
1195
|
+
var import_zod16 = require("zod");
|
|
1196
|
+
|
|
1197
|
+
// src/utils/is-rpc-serializable.ts
|
|
1198
|
+
var isRpcSerializable = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
1199
|
+
if (value === null || value === void 0) {
|
|
1200
|
+
return true;
|
|
1201
|
+
}
|
|
1202
|
+
const valueType = typeof value;
|
|
1203
|
+
if (valueType === "string" || valueType === "boolean") {
|
|
1204
|
+
return true;
|
|
1205
|
+
}
|
|
1206
|
+
if (valueType === "number") {
|
|
1207
|
+
return Number.isFinite(value);
|
|
1208
|
+
}
|
|
1209
|
+
if (valueType === "function" || valueType === "symbol" || valueType === "bigint") {
|
|
1210
|
+
return false;
|
|
1211
|
+
}
|
|
1212
|
+
if (valueType !== "object") {
|
|
1213
|
+
return false;
|
|
1214
|
+
}
|
|
1215
|
+
const objectValue = value;
|
|
1216
|
+
if (seen.has(objectValue)) {
|
|
1217
|
+
return false;
|
|
1218
|
+
}
|
|
1219
|
+
seen.add(objectValue);
|
|
1220
|
+
try {
|
|
1221
|
+
if (objectValue instanceof Date) return true;
|
|
1222
|
+
if (Array.isArray(objectValue))
|
|
1223
|
+
return objectValue.every((entry) => isRpcSerializable(entry, seen));
|
|
1224
|
+
const prototype = Object.getPrototypeOf(objectValue);
|
|
1225
|
+
if (prototype !== Object.prototype && prototype !== null) return false;
|
|
1226
|
+
return Object.values(objectValue).every(
|
|
1227
|
+
(entry) => isRpcSerializable(entry, seen)
|
|
1228
|
+
);
|
|
1229
|
+
} finally {
|
|
1230
|
+
seen.delete(objectValue);
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
// src/agent/agent-evaluator.ts
|
|
1235
|
+
var agentActionDescriptorSchema = import_zod16.z.object({
|
|
1236
|
+
actionId: import_zod16.z.string().min(1),
|
|
1237
|
+
target: import_zod16.z.object({
|
|
1238
|
+
kind: import_zod16.z.enum(["participant", "host"]),
|
|
1239
|
+
actionName: import_zod16.z.string().min(1),
|
|
1240
|
+
storeDomain: import_zod16.z.string().min(1)
|
|
1241
|
+
}),
|
|
1242
|
+
description: import_zod16.z.string().nullable(),
|
|
1243
|
+
availability: import_zod16.z.string().nullable(),
|
|
1244
|
+
payload: import_zod16.z.object({
|
|
1245
|
+
kind: import_zod16.z.enum(["none", "boolean", "number", "string", "enum", "json"]),
|
|
1246
|
+
description: import_zod16.z.string().nullable(),
|
|
1247
|
+
allowedValues: import_zod16.z.array(import_zod16.z.string()).optional()
|
|
1248
|
+
}),
|
|
1249
|
+
resultDescription: import_zod16.z.string().nullable()
|
|
1250
|
+
});
|
|
1251
|
+
var agentContractDescriptionSchema = import_zod16.z.object({
|
|
1252
|
+
snapshotStoreDomains: import_zod16.z.array(import_zod16.z.string().min(1)),
|
|
1253
|
+
snapshotDescription: import_zod16.z.string().nullable(),
|
|
1254
|
+
actions: import_zod16.z.array(agentActionDescriptorSchema)
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
// src/runtime/host-observation.ts
|
|
1258
|
+
var import_nanoid = require("nanoid");
|
|
1259
|
+
|
|
1260
|
+
// src/runtime/contracts/observation.ts
|
|
1261
|
+
var import_zod17 = require("zod");
|
|
1262
|
+
var HOST_OBSERVATION_IMAGE_BYTES = 64e4;
|
|
1263
|
+
var jsonObject = import_zod17.z.record(import_zod17.z.string(), import_zod17.z.unknown()).refine(
|
|
1264
|
+
(value) => isRpcSerializable(value) && new TextEncoder().encode(JSON.stringify(value)).byteLength <= 128e3,
|
|
1265
|
+
{
|
|
1266
|
+
message: "Observations require serializable JSON within the 128 KB state budget."
|
|
1267
|
+
}
|
|
1268
|
+
);
|
|
1269
|
+
var hostObservationRequestSchema = import_zod17.z.object({
|
|
1270
|
+
roomId: roomCodeSchema,
|
|
1271
|
+
controllerId: import_zod17.z.string().min(1).max(128).nullable(),
|
|
1272
|
+
scope: import_zod17.z.enum(["player", "diagnostic"]),
|
|
1273
|
+
includeImage: import_zod17.z.boolean(),
|
|
1274
|
+
expected: hostObservationIdentitySchema.optional()
|
|
1275
|
+
}).strict();
|
|
1276
|
+
var hostObservationImageSchema = import_zod17.z.object({
|
|
1277
|
+
mimeType: import_zod17.z.enum(["image/jpeg", "image/png", "image/webp"]),
|
|
1278
|
+
data: import_zod17.z.string().min(4).max(Math.ceil(HOST_OBSERVATION_IMAGE_BYTES / 3) * 4).regex(/^[A-Za-z0-9+/]*={0,2}$/).refine(
|
|
1279
|
+
(value) => value.length % 4 === 0 && value.length / 4 * 3 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0) <= HOST_OBSERVATION_IMAGE_BYTES,
|
|
1280
|
+
"Observation image exceeds its byte budget or is invalid base64."
|
|
1281
|
+
),
|
|
1282
|
+
width: import_zod17.z.number().int().positive().max(4096),
|
|
1283
|
+
height: import_zod17.z.number().int().positive().max(4096),
|
|
1284
|
+
coverage: import_zod17.z.enum(["render-surface", "host-document", "controller-view"])
|
|
1285
|
+
}).strict();
|
|
1286
|
+
var storeRevision = import_zod17.z.object({
|
|
1287
|
+
storeDomain: import_zod17.z.string().min(1),
|
|
1288
|
+
revision: import_zod17.z.number().int().nonnegative()
|
|
1289
|
+
});
|
|
1290
|
+
var hostRuntimeFaultSchema = import_zod17.z.object({
|
|
1291
|
+
name: import_zod17.z.string().max(128),
|
|
1292
|
+
message: import_zod17.z.string().max(2048),
|
|
1293
|
+
source: import_zod17.z.object({
|
|
1294
|
+
file: import_zod17.z.string().max(2048),
|
|
1295
|
+
line: import_zod17.z.number().int().positive(),
|
|
1296
|
+
column: import_zod17.z.number().int().positive()
|
|
1297
|
+
}).strict().nullable(),
|
|
1298
|
+
stack: import_zod17.z.string().max(8192)
|
|
1299
|
+
}).strict();
|
|
1300
|
+
var hostObservationPresentationSchema = import_zod17.z.object({
|
|
1301
|
+
runtimeState: runtimeStateSchema,
|
|
1302
|
+
connectionStatus: connectionStatusSchema,
|
|
1303
|
+
fault: hostRuntimeFaultSchema.nullable().optional()
|
|
1304
|
+
}).strict();
|
|
1305
|
+
var hostObservationClockSchema = import_zod17.z.object({
|
|
1306
|
+
startedAtMs: import_zod17.z.number().nonnegative(),
|
|
1307
|
+
finishedAtMs: import_zod17.z.number().nonnegative()
|
|
1308
|
+
}).strict().refine(
|
|
1309
|
+
(value) => value.finishedAtMs >= value.startedAtMs,
|
|
1310
|
+
"The host clock must advance monotonically."
|
|
1311
|
+
);
|
|
1312
|
+
var hostObservationSchema = import_zod17.z.object({
|
|
1313
|
+
version: import_zod17.z.literal(1),
|
|
1314
|
+
id: import_zod17.z.string().min(1),
|
|
1315
|
+
identity: hostObservationIdentitySchema,
|
|
1316
|
+
sequence: import_zod17.z.number().int().positive(),
|
|
1317
|
+
scope: import_zod17.z.enum(["player", "diagnostic"]),
|
|
1318
|
+
controllerId: import_zod17.z.string().nullable(),
|
|
1319
|
+
host: import_zod17.z.object({
|
|
1320
|
+
before: hostObservationPresentationSchema.nullable(),
|
|
1321
|
+
after: hostObservationPresentationSchema.nullable()
|
|
1322
|
+
}).optional(),
|
|
1323
|
+
actions: import_zod17.z.array(agentActionDescriptorSchema).optional(),
|
|
1324
|
+
capabilities: import_zod17.z.object({
|
|
1325
|
+
participantControl: import_zod17.z.object({
|
|
1326
|
+
input: import_zod17.z.literal(1).optional(),
|
|
1327
|
+
inputSchema: participantInputSchemaDescriptionSchema.optional(),
|
|
1328
|
+
actions: import_zod17.z.literal(1).optional()
|
|
1329
|
+
}).optional()
|
|
1330
|
+
}).optional(),
|
|
1331
|
+
capturedAt: import_zod17.z.iso.datetime(),
|
|
1332
|
+
clock: hostObservationClockSchema.optional(),
|
|
1333
|
+
/** The page's slowest fixed-step simulation against real time, since it started. */
|
|
1334
|
+
pace: import_zod17.z.object({
|
|
1335
|
+
frames: import_zod17.z.number().int().nonnegative(),
|
|
1336
|
+
wallMs: import_zod17.z.number().nonnegative(),
|
|
1337
|
+
simulatedMs: import_zod17.z.number().nonnegative()
|
|
1338
|
+
}).strict().optional(),
|
|
1339
|
+
durationMs: import_zod17.z.number().nonnegative(),
|
|
1340
|
+
snapshot: jsonObject,
|
|
1341
|
+
runtime: jsonObject.nullable(),
|
|
1342
|
+
ticks: import_zod17.z.object({
|
|
1343
|
+
before: import_zod17.z.number().int().nonnegative().nullable(),
|
|
1344
|
+
after: import_zod17.z.number().int().nonnegative().nullable()
|
|
1345
|
+
}),
|
|
1346
|
+
stores: import_zod17.z.object({
|
|
1347
|
+
before: import_zod17.z.array(storeRevision),
|
|
1348
|
+
after: import_zod17.z.array(storeRevision)
|
|
1349
|
+
}),
|
|
1350
|
+
visual: import_zod17.z.discriminatedUnion("status", [
|
|
1351
|
+
import_zod17.z.object({
|
|
1352
|
+
status: import_zod17.z.literal("captured"),
|
|
1353
|
+
image: hostObservationImageSchema
|
|
1354
|
+
}),
|
|
1355
|
+
import_zod17.z.object({
|
|
1356
|
+
status: import_zod17.z.literal("unavailable"),
|
|
1357
|
+
reason: import_zod17.z.enum([
|
|
1358
|
+
"not-requested",
|
|
1359
|
+
"unsupported",
|
|
1360
|
+
"surface-unavailable",
|
|
1361
|
+
"timeout"
|
|
1362
|
+
]),
|
|
1363
|
+
detail: import_zod17.z.string().max(1024).optional()
|
|
1364
|
+
})
|
|
1365
|
+
])
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
// src/runtime/contracts/agent-control.ts
|
|
1369
|
+
var import_zod21 = require("zod");
|
|
1370
|
+
|
|
1371
|
+
// src/runtime/contracts/clip.ts
|
|
1372
|
+
var import_zod18 = require("zod");
|
|
1373
|
+
var CLIP_MIN_FRAME_INTERVAL_MS = 33;
|
|
1374
|
+
var clipFrameIntervalSchema = import_zod18.z.number().int().min(CLIP_MIN_FRAME_INTERVAL_MS);
|
|
1375
|
+
var CLIP_MAX_DURATION_MS = 15e3;
|
|
1376
|
+
var CLIP_MAX_FRAMES = Math.ceil(
|
|
1377
|
+
CLIP_MAX_DURATION_MS / CLIP_MIN_FRAME_INTERVAL_MS
|
|
1378
|
+
);
|
|
1379
|
+
var CLIP_MAX_BYTES = 4 * 1024 * 1024;
|
|
1380
|
+
var CLIP_FRAME_MAX_BYTES = 160 * 1024;
|
|
1381
|
+
var CLIP_PAGE_BASE64_CHARS = 768 * 1024;
|
|
1382
|
+
var CLIP_RECORDING_LIFETIME_MS = 6e5;
|
|
1383
|
+
var CLIP_VIDEO_MAX_BYTES = 32 * 1024 * 1024;
|
|
1384
|
+
var clipNotCapturedReasonSchema = import_zod18.z.enum([
|
|
1385
|
+
"busy",
|
|
1386
|
+
"unsupported",
|
|
1387
|
+
"surface-unavailable",
|
|
1388
|
+
"capture-failed",
|
|
1389
|
+
"runtime-replaced",
|
|
1390
|
+
"host-unavailable",
|
|
1391
|
+
"headless"
|
|
1392
|
+
]);
|
|
1393
|
+
var clipImageBytes = (data) => data.length / 4 * 3 - (data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0);
|
|
1394
|
+
var clipFrameSchema = import_zod18.z.object({
|
|
1395
|
+
index: import_zod18.z.number().int().nonnegative(),
|
|
1396
|
+
atMs: import_zod18.z.number().nonnegative().max(CLIP_RECORDING_LIFETIME_MS),
|
|
1397
|
+
width: import_zod18.z.number().int().positive().max(1280),
|
|
1398
|
+
height: import_zod18.z.number().int().positive().max(1280),
|
|
1399
|
+
mimeType: import_zod18.z.literal("image/jpeg"),
|
|
1400
|
+
data: import_zod18.z.string().min(4).max(Math.ceil(CLIP_FRAME_MAX_BYTES / 3) * 4).regex(/^[A-Za-z0-9+/]*={0,2}$/).refine(
|
|
1401
|
+
(data) => data.length % 4 === 0 && clipImageBytes(data) <= CLIP_FRAME_MAX_BYTES,
|
|
1402
|
+
"Clip frame exceeds its byte budget or is invalid base64."
|
|
1403
|
+
)
|
|
1404
|
+
}).strict();
|
|
1405
|
+
var clipMetadata = {
|
|
1406
|
+
clipId: import_zod18.z.string().min(1).max(128),
|
|
1407
|
+
identity: hostObservationIdentitySchema,
|
|
1408
|
+
startedAt: import_zod18.z.iso.datetime(),
|
|
1409
|
+
frameIntervalMs: clipFrameIntervalSchema,
|
|
1410
|
+
// Offsets and duration refer to the original recording, even after old frames drop.
|
|
1411
|
+
durationMs: import_zod18.z.number().nonnegative().max(CLIP_RECORDING_LIFETIME_MS),
|
|
1412
|
+
droppedFrames: import_zod18.z.number().int().nonnegative(),
|
|
1413
|
+
skippedFrames: import_zod18.z.number().int().nonnegative()
|
|
1414
|
+
};
|
|
1415
|
+
var clipArtifactSchema = import_zod18.z.object({
|
|
1416
|
+
version: import_zod18.z.literal(1),
|
|
1417
|
+
...clipMetadata,
|
|
1418
|
+
frames: import_zod18.z.array(clipFrameSchema).min(1).max(CLIP_MAX_FRAMES)
|
|
1419
|
+
}).strict().superRefine((clip, ctx) => {
|
|
1420
|
+
const frames = clip.frames;
|
|
1421
|
+
if (frames.length > Math.ceil(CLIP_MAX_DURATION_MS / clip.frameIntervalMs))
|
|
1422
|
+
ctx.addIssue({
|
|
1423
|
+
code: "custom",
|
|
1424
|
+
message: "Clip exceeds its cadence frame budget."
|
|
1425
|
+
});
|
|
1426
|
+
if (frames.reduce((sum, frame) => sum + clipImageBytes(frame.data), 0) > CLIP_MAX_BYTES)
|
|
1427
|
+
ctx.addIssue({
|
|
1428
|
+
code: "custom",
|
|
1429
|
+
message: "Clip exceeds its image byte budget."
|
|
1430
|
+
});
|
|
1431
|
+
if (frames.some(
|
|
1432
|
+
(frame, i) => frame.atMs > clip.durationMs || frame.atMs < clip.durationMs - CLIP_MAX_DURATION_MS || i > 0 && (frame.atMs <= frames[i - 1].atMs || frame.index !== frames[i - 1].index + 1)
|
|
1433
|
+
))
|
|
1434
|
+
ctx.addIssue({
|
|
1435
|
+
code: "custom",
|
|
1436
|
+
message: "Clip frames must be ordered within the kept time window."
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
var clipNativeCaptureSchema = import_zod18.z.object({
|
|
1440
|
+
drawsAttempted: import_zod18.z.number().int().nonnegative(),
|
|
1441
|
+
drawsMade: import_zod18.z.number().int().nonnegative()
|
|
1442
|
+
}).strict();
|
|
1443
|
+
var clipVideoPageSchema = import_zod18.z.object({
|
|
1444
|
+
mimeType: import_zod18.z.string().min(1).max(128),
|
|
1445
|
+
width: import_zod18.z.number().int().positive().max(1280),
|
|
1446
|
+
height: import_zod18.z.number().int().positive().max(1280),
|
|
1447
|
+
chunks: import_zod18.z.array(
|
|
1448
|
+
import_zod18.z.string().min(4).max(CLIP_PAGE_BASE64_CHARS).regex(
|
|
1449
|
+
/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
|
|
1450
|
+
)
|
|
1451
|
+
).max(1),
|
|
1452
|
+
nextChunk: import_zod18.z.number().int().nonnegative().nullable()
|
|
1453
|
+
}).strict();
|
|
1454
|
+
var clipReadSchema = import_zod18.z.object({
|
|
1455
|
+
...clipMetadata,
|
|
1456
|
+
state: import_zod18.z.enum(["recording", "stopped"]),
|
|
1457
|
+
// Native encoded frames are counted after stop by the video consumer.
|
|
1458
|
+
nativeCapture: clipNativeCaptureSchema.optional(),
|
|
1459
|
+
droppedFrames: clipMetadata.droppedFrames.nullable(),
|
|
1460
|
+
skippedFrames: clipMetadata.skippedFrames.nullable(),
|
|
1461
|
+
frameCount: import_zod18.z.number().int().nonnegative().max(Math.ceil(CLIP_RECORDING_LIFETIME_MS / CLIP_MIN_FRAME_INTERVAL_MS)).nullable(),
|
|
1462
|
+
notCaptured: clipNotCapturedReasonSchema.nullable(),
|
|
1463
|
+
frames: import_zod18.z.array(clipFrameSchema).max(CLIP_MAX_FRAMES).refine(
|
|
1464
|
+
(frames) => frames.reduce((sum, frame) => sum + frame.data.length, 0) <= CLIP_PAGE_BASE64_CHARS,
|
|
1465
|
+
"Clip page exceeds its transfer budget."
|
|
1466
|
+
),
|
|
1467
|
+
nextFrame: import_zod18.z.number().int().nonnegative().nullable(),
|
|
1468
|
+
video: clipVideoPageSchema.optional()
|
|
1469
|
+
}).strict();
|
|
1470
|
+
|
|
1471
|
+
// src/runtime/contracts/input-log.ts
|
|
1472
|
+
var import_zod19 = require("zod");
|
|
1473
|
+
var INPUT_LOG_PAGE_BYTES = 512 * 1024;
|
|
1474
|
+
var inputLogCutSchema = import_zod19.z.object({
|
|
1475
|
+
ticks: import_zod19.z.number().int().nonnegative(),
|
|
1476
|
+
entryCount: import_zod19.z.number().int().nonnegative()
|
|
1477
|
+
}).strict();
|
|
1478
|
+
var hostInputLogPageSchema = import_zod19.z.object({
|
|
1479
|
+
identity: hostObservationIdentitySchema,
|
|
1480
|
+
observation: hostObservationSchema.optional(),
|
|
1481
|
+
header: airJamInputLogSchema.omit({ entries: true }),
|
|
1482
|
+
entryCount: import_zod19.z.number().int().nonnegative(),
|
|
1483
|
+
full: import_zod19.z.boolean(),
|
|
1484
|
+
entries: airJamInputLogSchema.shape.entries,
|
|
1485
|
+
nextEntry: import_zod19.z.number().int().nonnegative().nullable()
|
|
1486
|
+
}).strict();
|
|
1487
|
+
var inputLogNotReplayableReasonSchema = import_zod19.z.enum([
|
|
1488
|
+
"no-simulation",
|
|
1489
|
+
"loading",
|
|
1490
|
+
"runtime-replaced",
|
|
1491
|
+
"host-unavailable"
|
|
1492
|
+
]);
|
|
1493
|
+
|
|
1494
|
+
// src/runtime/contracts/timeline.ts
|
|
1495
|
+
var import_zod20 = require("zod");
|
|
1496
|
+
var facts = {
|
|
1497
|
+
id: import_zod20.z.string().min(1),
|
|
1498
|
+
tick: import_zod20.z.number().int().nonnegative(),
|
|
1499
|
+
/** Epoch milliseconds, unlike the simulation's game clock. */
|
|
1500
|
+
at: import_zod20.z.number().nonnegative()
|
|
1501
|
+
};
|
|
1502
|
+
var hostTimelineEntrySchema = import_zod20.z.discriminatedUnion("kind", [
|
|
1503
|
+
import_zod20.z.object({
|
|
1504
|
+
...facts,
|
|
1505
|
+
kind: import_zod20.z.enum(["join", "drop", "leave", "name"]),
|
|
1506
|
+
controllerId: import_zod20.z.string(),
|
|
1507
|
+
name: import_zod20.z.string().optional(),
|
|
1508
|
+
previousName: import_zod20.z.string().optional()
|
|
1509
|
+
}),
|
|
1510
|
+
import_zod20.z.object({
|
|
1511
|
+
...facts,
|
|
1512
|
+
kind: import_zod20.z.literal("state"),
|
|
1513
|
+
state: import_zod20.z.enum(["paused", "playing"])
|
|
1514
|
+
}),
|
|
1515
|
+
import_zod20.z.object({
|
|
1516
|
+
...facts,
|
|
1517
|
+
kind: import_zod20.z.literal("settings"),
|
|
1518
|
+
values: airJamSettingsValuesSchema,
|
|
1519
|
+
previousValues: airJamSettingsValuesSchema
|
|
1520
|
+
}),
|
|
1521
|
+
import_zod20.z.object({
|
|
1522
|
+
...facts,
|
|
1523
|
+
kind: import_zod20.z.literal("moment"),
|
|
1524
|
+
text: import_zod20.z.string().min(1).max(240)
|
|
1525
|
+
})
|
|
1526
|
+
]);
|
|
1527
|
+
var hostTimelinePaceSchema = import_zod20.z.object({
|
|
1528
|
+
/** End of the five-second sampling window, in epoch milliseconds. */
|
|
1529
|
+
at: import_zod20.z.number().nonnegative(),
|
|
1530
|
+
fps: import_zod20.z.number().nonnegative(),
|
|
1531
|
+
speed: import_zod20.z.number().nonnegative()
|
|
1532
|
+
});
|
|
1533
|
+
var hostTimelineSchema = import_zod20.z.discriminatedUnion("status", [
|
|
1534
|
+
import_zod20.z.object({
|
|
1535
|
+
status: import_zod20.z.literal("available"),
|
|
1536
|
+
identity: hostObservationIdentitySchema,
|
|
1537
|
+
startedAt: import_zod20.z.number().nonnegative(),
|
|
1538
|
+
stepMs: import_zod20.z.number().positive(),
|
|
1539
|
+
entries: import_zod20.z.array(hostTimelineEntrySchema),
|
|
1540
|
+
pace: import_zod20.z.array(hostTimelinePaceSchema).max(360)
|
|
1541
|
+
}),
|
|
1542
|
+
import_zod20.z.object({
|
|
1543
|
+
status: import_zod20.z.literal("unavailable"),
|
|
1544
|
+
identity: hostObservationIdentitySchema,
|
|
1545
|
+
reason: import_zod20.z.enum(["no-simulation", "simulation-loading"])
|
|
1546
|
+
})
|
|
1547
|
+
]);
|
|
1548
|
+
|
|
1549
|
+
// src/runtime/contracts/agent-control.ts
|
|
1550
|
+
var identity = import_zod21.z.object({
|
|
1551
|
+
roomId: roomCodeSchema,
|
|
1552
|
+
controllerId: import_zod21.z.string().min(1)
|
|
1553
|
+
});
|
|
1554
|
+
var actionRequest = identity.extend({
|
|
1555
|
+
contractId: import_zod21.z.string().min(1),
|
|
1556
|
+
runtimeId: import_zod21.z.string().min(1),
|
|
1557
|
+
actionId: import_zod21.z.string().min(1),
|
|
1558
|
+
payload: import_zod21.z.unknown().refine(
|
|
1559
|
+
(value) => isRpcSerializable(value),
|
|
1560
|
+
"Agent input must be serializable JSON data."
|
|
1561
|
+
).optional()
|
|
1562
|
+
});
|
|
1563
|
+
var hostAgentRequestSchema = import_zod21.z.discriminatedUnion("operation", [
|
|
1564
|
+
/** The room's instance and every seat in it, with what kind of device holds each. */
|
|
1565
|
+
import_zod21.z.object({ operation: import_zod21.z.literal("seats"), roomId: roomCodeSchema }).strict(),
|
|
1566
|
+
import_zod21.z.object({ operation: import_zod21.z.literal("timeline-read"), roomId: roomCodeSchema }).strict(),
|
|
1567
|
+
import_zod21.z.object({
|
|
1568
|
+
operation: import_zod21.z.literal("input-log-read"),
|
|
1569
|
+
roomId: roomCodeSchema,
|
|
1570
|
+
runtimeId: import_zod21.z.string().min(1),
|
|
1571
|
+
cut: inputLogCutSchema.nullable(),
|
|
1572
|
+
observe: hostObservationRequestSchema.pick({ controllerId: true, scope: true }).optional(),
|
|
1573
|
+
fromEntry: import_zod21.z.number().int().nonnegative()
|
|
1574
|
+
}).strict(),
|
|
1575
|
+
hostObservationRequestSchema.extend({ operation: import_zod21.z.literal("observe") }).strict(),
|
|
1576
|
+
identity.extend({
|
|
1577
|
+
operation: import_zod21.z.literal("read"),
|
|
1578
|
+
controllerId: import_zod21.z.string().min(1).nullable()
|
|
1579
|
+
}).strict(),
|
|
1580
|
+
import_zod21.z.object({
|
|
1581
|
+
operation: import_zod21.z.literal("settings-read"),
|
|
1582
|
+
roomId: roomCodeSchema,
|
|
1583
|
+
runtimeId: import_zod21.z.string().min(1)
|
|
1584
|
+
}).strict(),
|
|
1585
|
+
import_zod21.z.object({
|
|
1586
|
+
operation: import_zod21.z.literal("settings-update"),
|
|
1587
|
+
roomId: roomCodeSchema,
|
|
1588
|
+
runtimeId: import_zod21.z.string().min(1),
|
|
1589
|
+
patch: airJamSettingsValuesSchema,
|
|
1590
|
+
expectedRevision: import_zod21.z.number().int().nonnegative()
|
|
1591
|
+
}).strict(),
|
|
1592
|
+
actionRequest.extend({ operation: import_zod21.z.literal("resolve") }).strict(),
|
|
1593
|
+
actionRequest.extend({ operation: import_zod21.z.literal("invoke-host") }).strict(),
|
|
1594
|
+
import_zod21.z.object({
|
|
1595
|
+
operation: import_zod21.z.literal("clip-start"),
|
|
1596
|
+
delivery: import_zod21.z.enum(["pages", "video"]).optional(),
|
|
1597
|
+
frameIntervalMs: clipFrameIntervalSchema.optional(),
|
|
1598
|
+
roomId: roomCodeSchema,
|
|
1599
|
+
runtimeId: import_zod21.z.string().min(1),
|
|
1600
|
+
clipId: import_zod21.z.string().min(1).max(128)
|
|
1601
|
+
}).strict(),
|
|
1602
|
+
import_zod21.z.object({
|
|
1603
|
+
operation: import_zod21.z.literal("clip-read"),
|
|
1604
|
+
roomId: roomCodeSchema,
|
|
1605
|
+
clipId: import_zod21.z.string().min(1).max(128),
|
|
1606
|
+
stop: import_zod21.z.boolean(),
|
|
1607
|
+
fromChunk: import_zod21.z.number().int().nonnegative().optional(),
|
|
1608
|
+
fromFrame: import_zod21.z.number().int().nonnegative()
|
|
1609
|
+
}).strict()
|
|
1610
|
+
]);
|
|
1611
|
+
var hostAgentSnapshotSchema = agentContractDescriptionSchema.extend({
|
|
1612
|
+
contractId: import_zod21.z.string().min(1),
|
|
1613
|
+
runtimeId: import_zod21.z.string().min(1),
|
|
1614
|
+
snapshot: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.unknown()),
|
|
1615
|
+
rawStores: import_zod21.z.array(
|
|
1616
|
+
import_zod21.z.object({
|
|
1617
|
+
storeDomain: import_zod21.z.string().min(1),
|
|
1618
|
+
data: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.unknown()),
|
|
1619
|
+
revision: import_zod21.z.number().int().nonnegative(),
|
|
1620
|
+
updatedAt: import_zod21.z.string()
|
|
1621
|
+
})
|
|
1622
|
+
),
|
|
1623
|
+
storeDomainBindings: import_zod21.z.array(
|
|
1624
|
+
import_zod21.z.object({
|
|
1625
|
+
contractStoreDomain: import_zod21.z.string(),
|
|
1626
|
+
runtimeStoreDomain: import_zod21.z.string()
|
|
1627
|
+
})
|
|
1628
|
+
)
|
|
1629
|
+
});
|
|
1630
|
+
var hostAgentResponseSchema = import_zod21.z.discriminatedUnion("operation", [
|
|
1631
|
+
import_zod21.z.object({
|
|
1632
|
+
operation: import_zod21.z.literal("seats"),
|
|
1633
|
+
instance: import_zod21.z.string().min(1),
|
|
1634
|
+
seats: import_zod21.z.array(seatViewSchema)
|
|
1635
|
+
}).strict(),
|
|
1636
|
+
import_zod21.z.object({
|
|
1637
|
+
operation: import_zod21.z.literal("timeline-read"),
|
|
1638
|
+
timeline: hostTimelineSchema
|
|
1639
|
+
}).strict(),
|
|
1640
|
+
import_zod21.z.object({
|
|
1641
|
+
operation: import_zod21.z.literal("input-log-read"),
|
|
1642
|
+
page: hostInputLogPageSchema
|
|
1643
|
+
}).strict(),
|
|
1644
|
+
import_zod21.z.object({
|
|
1645
|
+
operation: import_zod21.z.literal("clip-start"),
|
|
1646
|
+
clipId: import_zod21.z.string().min(1).max(128),
|
|
1647
|
+
startedAt: import_zod21.z.iso.datetime()
|
|
1648
|
+
}).strict(),
|
|
1649
|
+
import_zod21.z.object({ operation: import_zod21.z.literal("clip-read"), clip: clipReadSchema }).strict(),
|
|
1650
|
+
import_zod21.z.object({
|
|
1651
|
+
operation: import_zod21.z.enum(["settings-read", "settings-update"]),
|
|
1652
|
+
values: airJamSettingsValuesSchema,
|
|
1653
|
+
revision: import_zod21.z.number().int().nonnegative()
|
|
1654
|
+
}),
|
|
1655
|
+
import_zod21.z.object({
|
|
1656
|
+
operation: import_zod21.z.literal("observe"),
|
|
1657
|
+
observation: hostObservationSchema
|
|
1658
|
+
}),
|
|
1659
|
+
import_zod21.z.object({
|
|
1660
|
+
operation: import_zod21.z.literal("read"),
|
|
1661
|
+
snapshot: hostAgentSnapshotSchema.nullable()
|
|
1662
|
+
}),
|
|
1663
|
+
import_zod21.z.object({
|
|
1664
|
+
operation: import_zod21.z.enum(["resolve", "invoke-host"]),
|
|
1665
|
+
target: import_zod21.z.object({
|
|
1666
|
+
kind: import_zod21.z.enum(["participant", "host"]),
|
|
1667
|
+
actionName: import_zod21.z.string(),
|
|
1668
|
+
storeDomain: import_zod21.z.string()
|
|
1669
|
+
}),
|
|
1670
|
+
payload: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.unknown()).optional(),
|
|
1671
|
+
acknowledgement: airJamActionInvocationResultSchema.optional()
|
|
1672
|
+
})
|
|
1673
|
+
]);
|
|
1674
|
+
var hostAgentRequestMessageSchema = import_zod21.z.object({
|
|
1675
|
+
type: import_zod21.z.literal("AIRJAM_HOST_AGENT"),
|
|
1676
|
+
requestId: import_zod21.z.string().min(1).max(128),
|
|
1677
|
+
request: hostAgentRequestSchema
|
|
1678
|
+
}).strict();
|
|
1679
|
+
var hostAgentResultMessageSchema = import_zod21.z.object({
|
|
1680
|
+
type: import_zod21.z.literal("AIRJAM_HOST_AGENT_RESULT"),
|
|
1681
|
+
requestId: hostAgentRequestMessageSchema.shape.requestId,
|
|
1682
|
+
result: import_zod21.z.discriminatedUnion("ok", [
|
|
1683
|
+
import_zod21.z.object({ ok: import_zod21.z.literal(true), response: hostAgentResponseSchema }),
|
|
1684
|
+
import_zod21.z.object({ ok: import_zod21.z.literal(false), error: import_zod21.z.string().min(1).max(1024) })
|
|
1685
|
+
])
|
|
1686
|
+
}).strict();
|
|
1687
|
+
|
|
1688
|
+
// src/runtime/contracts/control.ts
|
|
1689
|
+
var hostRuntimeActionRequestSchema = import_zod22.z.object({
|
|
1690
|
+
roomId: roomCodeSchema,
|
|
1691
|
+
storeDomain: import_zod22.z.string().trim().min(1).max(128),
|
|
1692
|
+
actionName: import_zod22.z.string().trim().min(1).max(128),
|
|
1693
|
+
payload: import_zod22.z.record(import_zod22.z.string(), import_zod22.z.unknown()).optional()
|
|
1694
|
+
}).strict();
|
|
1695
|
+
var hostStateEpochSchema = import_zod22.z.object({
|
|
1696
|
+
storeDomain: import_zod22.z.string().min(1).max(128),
|
|
1697
|
+
epoch: import_zod22.z.string().min(1).max(128)
|
|
1698
|
+
});
|
|
1699
|
+
|
|
1700
|
+
// src/core/replay-input-log.ts
|
|
1701
|
+
var settingsLogEventSchema = import_zod23.z.object({
|
|
1702
|
+
patch: airJamSettingsValuesSchema,
|
|
1703
|
+
revision: import_zod23.z.number().int().positive()
|
|
1704
|
+
}).strict();
|
|
1705
|
+
var seatLogEventSchema = import_zod23.z.object({ seat: seatViewSchema });
|
|
1706
|
+
var leftLogEventSchema = import_zod23.z.object({ seat: import_zod23.z.string() });
|
|
1707
|
+
var inputLogEventSchema = import_zod23.z.object({
|
|
1708
|
+
seat: import_zod23.z.string(),
|
|
1709
|
+
input: import_zod23.z.record(import_zod23.z.string(), import_zod23.z.unknown())
|
|
1710
|
+
});
|
|
1711
|
+
var runtimeLogEventSchema = import_zod23.z.object({ runtimeState: runtimeStateSchema });
|
|
1712
|
+
var actionLogEventSchema = import_zod23.z.object({
|
|
1713
|
+
actionName: import_zod23.z.string(),
|
|
1714
|
+
payload: import_zod23.z.unknown().optional(),
|
|
1715
|
+
storeDomain: import_zod23.z.string(),
|
|
1716
|
+
actor: import_zod23.z.object({
|
|
1717
|
+
id: import_zod23.z.string(),
|
|
1718
|
+
role: import_zod23.z.enum(["host", "controller"])
|
|
1719
|
+
})
|
|
1720
|
+
});
|
|
790
1721
|
|
|
791
|
-
// src/
|
|
792
|
-
var
|
|
1722
|
+
// src/runtime/browser-replay.ts
|
|
1723
|
+
var whole = import_zod24.z.number().int().nonnegative();
|
|
1724
|
+
var replayAdvanceSchema = import_zod24.z.union([
|
|
1725
|
+
import_zod24.z.object({ steps: whole }).strict(),
|
|
1726
|
+
import_zod24.z.object({ ms: import_zod24.z.number().finite().nonnegative() }).strict(),
|
|
1727
|
+
import_zod24.z.object({ toTick: whole }).strict()
|
|
1728
|
+
]);
|
|
1729
|
+
var replayRequestSchema = import_zod24.z.discriminatedUnion("operation", [
|
|
1730
|
+
import_zod24.z.object({
|
|
1731
|
+
operation: import_zod24.z.literal("open"),
|
|
1732
|
+
log: airJamInputLogSchema,
|
|
1733
|
+
observe: hostObservationRequestSchema.pick({ scope: true, controllerId: true }).optional()
|
|
1734
|
+
}).strict(),
|
|
1735
|
+
import_zod24.z.object({ operation: import_zod24.z.literal("advance"), by: replayAdvanceSchema }).strict(),
|
|
1736
|
+
import_zod24.z.object({
|
|
1737
|
+
operation: import_zod24.z.literal("read"),
|
|
1738
|
+
/** Capture the paused frame on this explicit read; open and advance omit images. */
|
|
1739
|
+
includeImage: import_zod24.z.boolean().optional()
|
|
1740
|
+
}).strict()
|
|
1741
|
+
]);
|
|
1742
|
+
var replayReadSchema = import_zod24.z.object({
|
|
1743
|
+
tick: whole,
|
|
1744
|
+
ticks: whole,
|
|
1745
|
+
done: import_zod24.z.boolean(),
|
|
1746
|
+
stepMs: import_zod24.z.number().positive(),
|
|
1747
|
+
observation: hostObservationSchema
|
|
1748
|
+
}).strict();
|
|
1749
|
+
var replayRequestMessageSchema = import_zod24.z.object({
|
|
1750
|
+
type: import_zod24.z.literal("AIRJAM_REPLAY"),
|
|
1751
|
+
requestId: import_zod24.z.string().min(1),
|
|
1752
|
+
request: replayRequestSchema
|
|
1753
|
+
}).strict();
|
|
1754
|
+
var replayMessageSchema = import_zod24.z.discriminatedUnion("type", [
|
|
1755
|
+
import_zod24.z.object({ type: import_zod24.z.literal("AIRJAM_REPLAY_READY") }).strict(),
|
|
1756
|
+
import_zod24.z.object({
|
|
1757
|
+
type: import_zod24.z.literal("AIRJAM_REPLAY_RESULT"),
|
|
1758
|
+
requestId: import_zod24.z.string().min(1),
|
|
1759
|
+
result: import_zod24.z.discriminatedUnion("ok", [
|
|
1760
|
+
import_zod24.z.object({ ok: import_zod24.z.literal(true), response: replayReadSchema }).strict(),
|
|
1761
|
+
import_zod24.z.object({ ok: import_zod24.z.literal(false), error: import_zod24.z.string() }).strict()
|
|
1762
|
+
])
|
|
1763
|
+
}).strict()
|
|
1764
|
+
]);
|
|
793
1765
|
|
|
794
1766
|
// src/context/air-jam-context.tsx
|
|
795
1767
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -831,8 +1803,10 @@ var useAssertSessionScope = (expectedScope, hookName) => {
|
|
|
831
1803
|
|
|
832
1804
|
// src/runtime/runtime-owner-contexts.tsx
|
|
833
1805
|
var import_react3 = require("react");
|
|
1806
|
+
var fixedControllerOrientationContext = (0, import_react3.createContext)(void 0);
|
|
834
1807
|
var hostRuntimeContext = (0, import_react3.createContext)(null);
|
|
835
1808
|
var controllerRuntimeContext = (0, import_react3.createContext)(null);
|
|
1809
|
+
var declaredStoresContext = (0, import_react3.createContext)(null);
|
|
836
1810
|
|
|
837
1811
|
// src/hooks/use-air-jam-controller.ts
|
|
838
1812
|
var toControllerState = (state) => {
|
|
@@ -844,8 +1818,6 @@ var toControllerState = (state) => {
|
|
|
844
1818
|
lastError: state.lastError,
|
|
845
1819
|
runtimeState: state.runtimeState,
|
|
846
1820
|
controllerOrientation: state.controllerOrientation,
|
|
847
|
-
stateMessage: state.stateMessage,
|
|
848
|
-
roomSettings: state.roomSettings,
|
|
849
1821
|
players: state.players,
|
|
850
1822
|
selfPlayer
|
|
851
1823
|
};
|
|
@@ -853,7 +1825,7 @@ var toControllerState = (state) => {
|
|
|
853
1825
|
function useAirJamController(selector) {
|
|
854
1826
|
useAssertSessionScope("controller", "useAirJamController");
|
|
855
1827
|
const { store } = useAirJamContext();
|
|
856
|
-
const selectedState = (0,
|
|
1828
|
+
const selectedState = (0, import_zustand2.useStore)(
|
|
857
1829
|
store,
|
|
858
1830
|
(0, import_shallow2.useShallow)((state) => {
|
|
859
1831
|
const controllerState = toControllerState(state);
|
|
@@ -1059,7 +2031,7 @@ var ControllerPrimaryAction = ({
|
|
|
1059
2031
|
children: [
|
|
1060
2032
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "min-w-0", children: [
|
|
1061
2033
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "truncate text-base font-black tracking-[0.12em] uppercase sm:text-lg", children: label }),
|
|
1062
|
-
helper ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mt-1 text-sm/5 font-medium tracking-normal normal-case opacity-80", children: helper }) : null
|
|
2034
|
+
helper ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mt-1 text-sm/5 font-medium tracking-normal whitespace-normal normal-case opacity-80", children: helper }) : null
|
|
1063
2035
|
] }),
|
|
1064
2036
|
icon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "ml-4 flex shrink-0 items-center justify-center", children: icon }) : null
|
|
1065
2037
|
]
|
|
@@ -1067,19 +2039,335 @@ var ControllerPrimaryAction = ({
|
|
|
1067
2039
|
) });
|
|
1068
2040
|
};
|
|
1069
2041
|
|
|
1070
|
-
// src/components/
|
|
1071
|
-
var
|
|
2042
|
+
// src/components/controls.tsx
|
|
2043
|
+
var import_react6 = require("react");
|
|
1072
2044
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
2045
|
+
var useControllerInput = () => {
|
|
2046
|
+
const runtime = (0, import_react6.useContext)(
|
|
2047
|
+
controllerRuntimeContext
|
|
2048
|
+
);
|
|
2049
|
+
if (!runtime?.input)
|
|
2050
|
+
throw createAirJamDiagnosticError(
|
|
2051
|
+
"AJ_INPUT_NOT_DECLARED",
|
|
2052
|
+
"Phone controls send declared controls. Declare them with defineAirJamGame({ input }) and render controls inside <airjam.Controller>."
|
|
2053
|
+
);
|
|
2054
|
+
return runtime.input;
|
|
2055
|
+
};
|
|
2056
|
+
var capturePointer = (event) => {
|
|
2057
|
+
try {
|
|
2058
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
2059
|
+
} catch {
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
var isPressKey = (event) => event.key === " " || event.key === "Enter";
|
|
2063
|
+
var usePress = (start, disabled, onActiveChange) => {
|
|
2064
|
+
const release = (0, import_react6.useRef)(null);
|
|
2065
|
+
const pointer = (0, import_react6.useRef)(null);
|
|
2066
|
+
const [active, setActive] = (0, import_react6.useState)(false);
|
|
2067
|
+
const onActiveChangeRef = (0, import_react6.useRef)(onActiveChange);
|
|
2068
|
+
(0, import_react6.useEffect)(() => {
|
|
2069
|
+
onActiveChangeRef.current = onActiveChange;
|
|
2070
|
+
});
|
|
2071
|
+
const begin = (0, import_react6.useCallback)(() => {
|
|
2072
|
+
if (release.current) return false;
|
|
2073
|
+
release.current = start();
|
|
2074
|
+
setActive(true);
|
|
2075
|
+
onActiveChangeRef.current?.(true);
|
|
2076
|
+
return true;
|
|
2077
|
+
}, [start]);
|
|
2078
|
+
const end = (0, import_react6.useCallback)(() => {
|
|
2079
|
+
pointer.current = null;
|
|
2080
|
+
if (!release.current) return;
|
|
2081
|
+
release.current();
|
|
2082
|
+
release.current = null;
|
|
2083
|
+
setActive(false);
|
|
2084
|
+
onActiveChangeRef.current?.(false);
|
|
2085
|
+
}, []);
|
|
2086
|
+
(0, import_react6.useEffect)(() => {
|
|
2087
|
+
if (disabled) end();
|
|
2088
|
+
}, [disabled, end]);
|
|
2089
|
+
(0, import_react6.useEffect)(() => end, [end]);
|
|
2090
|
+
const endPointer = (event) => {
|
|
2091
|
+
if (event.pointerId === pointer.current) end();
|
|
2092
|
+
};
|
|
2093
|
+
return {
|
|
2094
|
+
active,
|
|
2095
|
+
handlers: {
|
|
2096
|
+
onPointerDown: (event) => {
|
|
2097
|
+
if (disabled || event.button !== 0 || !begin()) return;
|
|
2098
|
+
event.preventDefault();
|
|
2099
|
+
pointer.current = event.pointerId;
|
|
2100
|
+
capturePointer(event);
|
|
2101
|
+
},
|
|
2102
|
+
onPointerUp: endPointer,
|
|
2103
|
+
onPointerCancel: endPointer,
|
|
2104
|
+
onLostPointerCapture: endPointer,
|
|
2105
|
+
onKeyDown: (event) => {
|
|
2106
|
+
if (disabled || !isPressKey(event)) return;
|
|
2107
|
+
event.preventDefault();
|
|
2108
|
+
if (!event.repeat) begin();
|
|
2109
|
+
},
|
|
2110
|
+
onKeyUp: (event) => {
|
|
2111
|
+
if (!isPressKey(event)) return;
|
|
2112
|
+
event.preventDefault();
|
|
2113
|
+
end();
|
|
2114
|
+
},
|
|
2115
|
+
// Focus leaving ends a key hold; a finger still down keeps its press.
|
|
2116
|
+
onBlur: () => {
|
|
2117
|
+
if (pointer.current === null) end();
|
|
2118
|
+
},
|
|
2119
|
+
onContextMenu: (event) => event.preventDefault()
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
};
|
|
2123
|
+
var ControlButton = ({
|
|
2124
|
+
control,
|
|
2125
|
+
disabled = false,
|
|
2126
|
+
onActiveChange,
|
|
2127
|
+
className,
|
|
2128
|
+
...props
|
|
2129
|
+
}) => {
|
|
2130
|
+
const input = useControllerInput();
|
|
2131
|
+
const press = (0, import_react6.useCallback)(
|
|
2132
|
+
() => input.press(control.name),
|
|
2133
|
+
[input, control.name]
|
|
2134
|
+
);
|
|
2135
|
+
const { active, handlers } = usePress(press, disabled, onActiveChange);
|
|
2136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2137
|
+
"button",
|
|
2138
|
+
{
|
|
2139
|
+
type: "button",
|
|
2140
|
+
...props,
|
|
2141
|
+
...handlers,
|
|
2142
|
+
disabled,
|
|
2143
|
+
"data-active": active,
|
|
2144
|
+
className: cn("touch-none select-none", className)
|
|
2145
|
+
}
|
|
2146
|
+
);
|
|
2147
|
+
};
|
|
2148
|
+
var AxisButton = ({
|
|
2149
|
+
control,
|
|
2150
|
+
value,
|
|
2151
|
+
disabled = false,
|
|
2152
|
+
onActiveChange,
|
|
2153
|
+
className,
|
|
2154
|
+
...props
|
|
2155
|
+
}) => {
|
|
2156
|
+
const input = useControllerInput();
|
|
2157
|
+
const hold = (0, import_react6.useCallback)(
|
|
2158
|
+
() => input.hold(control.name, value),
|
|
2159
|
+
[input, control.name, value]
|
|
2160
|
+
);
|
|
2161
|
+
const { active, handlers } = usePress(hold, disabled, onActiveChange);
|
|
2162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2163
|
+
"button",
|
|
2164
|
+
{
|
|
2165
|
+
type: "button",
|
|
2166
|
+
...props,
|
|
2167
|
+
...handlers,
|
|
2168
|
+
disabled,
|
|
2169
|
+
"data-active": active,
|
|
2170
|
+
className: cn("touch-none select-none", className)
|
|
2171
|
+
}
|
|
2172
|
+
);
|
|
2173
|
+
};
|
|
2174
|
+
var centre = (element) => {
|
|
2175
|
+
const rect = element?.getBoundingClientRect();
|
|
2176
|
+
return rect ? { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 } : null;
|
|
2177
|
+
};
|
|
2178
|
+
var resolveStickPoint = (point, origin, right, bottom) => {
|
|
2179
|
+
const xAxis = { x: right.x - origin.x, y: right.y - origin.y };
|
|
2180
|
+
const yAxis = { x: bottom.x - origin.x, y: bottom.y - origin.y };
|
|
2181
|
+
const determinant = xAxis.x * yAxis.y - xAxis.y * yAxis.x;
|
|
2182
|
+
if (!Number.isFinite(determinant) || Math.abs(determinant) < 1e-3)
|
|
2183
|
+
return { x: 0, y: 0 };
|
|
2184
|
+
const offset = { x: point.x - origin.x, y: point.y - origin.y };
|
|
2185
|
+
const across = (offset.x * yAxis.y - offset.y * yAxis.x) / determinant;
|
|
2186
|
+
const down = (xAxis.x * offset.y - xAxis.y * offset.x) / determinant;
|
|
2187
|
+
return { x: 2 * across - 1, y: 2 * down - 1 };
|
|
2188
|
+
};
|
|
2189
|
+
var shapeStick = (vector, directions, deadzone) => {
|
|
2190
|
+
const length = Math.hypot(vector.x, vector.y);
|
|
2191
|
+
if (length <= deadzone) return { x: 0, y: 0 };
|
|
2192
|
+
if (directions === "4-way")
|
|
2193
|
+
return Math.abs(vector.x) > Math.abs(vector.y) ? { x: Math.sign(vector.x), y: 0 } : { x: 0, y: Math.sign(vector.y) };
|
|
2194
|
+
return length > 1 ? { x: vector.x / length, y: vector.y / length } : vector;
|
|
2195
|
+
};
|
|
2196
|
+
var CENTRE = { x: 0, y: 0 };
|
|
2197
|
+
var Stick = ({
|
|
2198
|
+
control,
|
|
2199
|
+
directions = "any",
|
|
2200
|
+
deadzone = 0,
|
|
2201
|
+
disabled = false,
|
|
2202
|
+
knobClassName,
|
|
2203
|
+
knob,
|
|
2204
|
+
children,
|
|
2205
|
+
onActiveChange,
|
|
2206
|
+
className,
|
|
2207
|
+
...props
|
|
2208
|
+
}) => {
|
|
2209
|
+
const fixedOrientation = (0, import_react6.useContext)(fixedControllerOrientationContext);
|
|
2210
|
+
if (fixedOrientation === null)
|
|
2211
|
+
throw new Error(
|
|
2212
|
+
"Stick requires joystick input: declare 'joystick' in inputModalities in airjam.config."
|
|
2213
|
+
);
|
|
2214
|
+
const input = useControllerInput();
|
|
2215
|
+
const origin = (0, import_react6.useRef)(null);
|
|
2216
|
+
const right = (0, import_react6.useRef)(null);
|
|
2217
|
+
const bottom = (0, import_react6.useRef)(null);
|
|
2218
|
+
const pointer = (0, import_react6.useRef)(null);
|
|
2219
|
+
const [active, setActive] = (0, import_react6.useState)(false);
|
|
2220
|
+
const subscribe = (0, import_react6.useCallback)(
|
|
2221
|
+
(listener) => input.subscribe(listener),
|
|
2222
|
+
[input]
|
|
2223
|
+
);
|
|
2224
|
+
const value = (0, import_react6.useSyncExternalStore)(
|
|
2225
|
+
subscribe,
|
|
2226
|
+
() => input.value(control.name),
|
|
2227
|
+
() => CENTRE
|
|
2228
|
+
);
|
|
2229
|
+
const setActiveState = (next) => {
|
|
2230
|
+
setActive(next);
|
|
2231
|
+
onActiveChange?.(next);
|
|
2232
|
+
};
|
|
2233
|
+
const follow = (event) => {
|
|
2234
|
+
const corners = [origin, right, bottom].map(
|
|
2235
|
+
({ current }) => centre(current)
|
|
2236
|
+
);
|
|
2237
|
+
const [topLeft, topRight, bottomLeft] = corners;
|
|
2238
|
+
if (!topLeft || !topRight || !bottomLeft) return;
|
|
2239
|
+
input.set(
|
|
2240
|
+
control.name,
|
|
2241
|
+
shapeStick(
|
|
2242
|
+
resolveStickPoint(
|
|
2243
|
+
{ x: event.clientX, y: event.clientY },
|
|
2244
|
+
topLeft,
|
|
2245
|
+
topRight,
|
|
2246
|
+
bottomLeft
|
|
2247
|
+
),
|
|
2248
|
+
directions,
|
|
2249
|
+
deadzone
|
|
2250
|
+
)
|
|
2251
|
+
);
|
|
2252
|
+
};
|
|
2253
|
+
const end = (event) => {
|
|
2254
|
+
if (event.pointerId !== pointer.current) return;
|
|
2255
|
+
pointer.current = null;
|
|
2256
|
+
input.set(control.name, CENTRE);
|
|
2257
|
+
setActiveState(false);
|
|
2258
|
+
};
|
|
2259
|
+
(0, import_react6.useEffect)(() => {
|
|
2260
|
+
if (!disabled || pointer.current === null) return;
|
|
2261
|
+
pointer.current = null;
|
|
2262
|
+
input.set(control.name, CENTRE);
|
|
2263
|
+
setActive(false);
|
|
2264
|
+
}, [disabled, input, control.name]);
|
|
2265
|
+
const marker = "pointer-events-none absolute size-0";
|
|
2266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2267
|
+
"div",
|
|
2268
|
+
{
|
|
2269
|
+
role: "application",
|
|
2270
|
+
"aria-label": "Joystick",
|
|
2271
|
+
...props,
|
|
2272
|
+
"data-active": active,
|
|
2273
|
+
className: cn("relative touch-none select-none", className),
|
|
2274
|
+
onPointerDown: (event) => {
|
|
2275
|
+
if (disabled || pointer.current !== null || event.button !== 0) return;
|
|
2276
|
+
event.preventDefault();
|
|
2277
|
+
pointer.current = event.pointerId;
|
|
2278
|
+
capturePointer(event);
|
|
2279
|
+
setActiveState(true);
|
|
2280
|
+
follow(event);
|
|
2281
|
+
},
|
|
2282
|
+
onPointerMove: (event) => {
|
|
2283
|
+
if (event.pointerId === pointer.current) follow(event);
|
|
2284
|
+
},
|
|
2285
|
+
onPointerUp: end,
|
|
2286
|
+
onPointerCancel: end,
|
|
2287
|
+
onLostPointerCapture: end,
|
|
2288
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
2289
|
+
children: [
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref: origin, className: cn(marker, "top-0 left-0") }),
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref: right, className: cn(marker, "top-0 left-full") }),
|
|
2292
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref: bottom, className: cn(marker, "top-full left-0") }),
|
|
2293
|
+
typeof children === "function" ? children({ value, active }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2294
|
+
children,
|
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2296
|
+
"span",
|
|
2297
|
+
{
|
|
2298
|
+
className: cn(
|
|
2299
|
+
"pointer-events-none absolute top-1/2 left-1/2 flex size-1/3 items-center justify-center rounded-full bg-current/30",
|
|
2300
|
+
!active && "transition-transform duration-150 ease-out",
|
|
2301
|
+
knobClassName
|
|
2302
|
+
),
|
|
2303
|
+
style: {
|
|
2304
|
+
transform: `translate(calc(-50% + ${value.x * 100}%), calc(-50% + ${value.y * 100}%))`
|
|
2305
|
+
},
|
|
2306
|
+
children: knob
|
|
2307
|
+
}
|
|
2308
|
+
)
|
|
2309
|
+
] })
|
|
2310
|
+
]
|
|
2311
|
+
}
|
|
2312
|
+
);
|
|
2313
|
+
};
|
|
2314
|
+
|
|
2315
|
+
// src/components/gamepad-layout.tsx
|
|
2316
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2317
|
+
var layoutStyle = {
|
|
2318
|
+
containerType: "size",
|
|
2319
|
+
"--airjam-thumb-size": "min(62cqh, 27cqw)",
|
|
2320
|
+
"--airjam-thumb-margin": "min(10cqh, 5cqw)"
|
|
2321
|
+
};
|
|
2322
|
+
var zoneStyle = {
|
|
2323
|
+
width: "calc(var(--airjam-thumb-size) + 2 * var(--airjam-thumb-margin))"
|
|
2324
|
+
};
|
|
2325
|
+
var slotStyle = {
|
|
2326
|
+
width: "var(--airjam-thumb-size)",
|
|
2327
|
+
height: "var(--airjam-thumb-size)"
|
|
2328
|
+
};
|
|
2329
|
+
var ThumbZone = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2330
|
+
"div",
|
|
2331
|
+
{
|
|
2332
|
+
className: "flex h-full flex-none items-center justify-center",
|
|
2333
|
+
style: zoneStyle,
|
|
2334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "grid *:size-full", style: slotStyle, children })
|
|
2335
|
+
}
|
|
2336
|
+
);
|
|
2337
|
+
var GamepadLayout = ({
|
|
2338
|
+
left,
|
|
2339
|
+
right,
|
|
2340
|
+
center,
|
|
2341
|
+
className,
|
|
2342
|
+
style,
|
|
2343
|
+
...props
|
|
2344
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2345
|
+
"div",
|
|
2346
|
+
{
|
|
2347
|
+
...props,
|
|
2348
|
+
className: cn("flex h-full w-full items-center", className),
|
|
2349
|
+
style: { ...layoutStyle, ...style },
|
|
2350
|
+
children: [
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThumbZone, { children: left }),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex h-full min-w-0 flex-1 flex-col items-center justify-center gap-2 text-center", children: center }),
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThumbZone, { children: right })
|
|
2354
|
+
]
|
|
2355
|
+
}
|
|
2356
|
+
);
|
|
2357
|
+
|
|
2358
|
+
// src/components/host-mute-button.tsx
|
|
2359
|
+
var import_lucide_react = require("lucide-react");
|
|
2360
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2361
|
+
function HostMuteButton({
|
|
2362
|
+
muted,
|
|
2363
|
+
onToggle,
|
|
2364
|
+
className,
|
|
1077
2365
|
labelClassName,
|
|
1078
2366
|
mutedLabel = "Unmute",
|
|
1079
2367
|
unmutedLabel = "Mute"
|
|
1080
2368
|
}) {
|
|
1081
2369
|
const label = muted ? mutedLabel : unmutedLabel;
|
|
1082
|
-
return /* @__PURE__ */ (0,
|
|
2370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1083
2371
|
Button,
|
|
1084
2372
|
{
|
|
1085
2373
|
type: "button",
|
|
@@ -1094,8 +2382,8 @@ function HostMuteButton({
|
|
|
1094
2382
|
className
|
|
1095
2383
|
),
|
|
1096
2384
|
children: [
|
|
1097
|
-
muted ? /* @__PURE__ */ (0,
|
|
1098
|
-
/* @__PURE__ */ (0,
|
|
2385
|
+
muted ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.VolumeX, { className: "size-4" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Volume2, { className: "size-4" }),
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1099
2387
|
"span",
|
|
1100
2388
|
{
|
|
1101
2389
|
className: cn(
|
|
@@ -1111,13 +2399,13 @@ function HostMuteButton({
|
|
|
1111
2399
|
}
|
|
1112
2400
|
|
|
1113
2401
|
// src/components/join-qr-overlay.tsx
|
|
1114
|
-
var
|
|
2402
|
+
var import_react8 = require("react");
|
|
1115
2403
|
var import_react_dom = require("react-dom");
|
|
1116
2404
|
|
|
1117
2405
|
// src/components/room-qr-code.tsx
|
|
1118
2406
|
var import_qrcode = require("qrcode");
|
|
1119
|
-
var
|
|
1120
|
-
var
|
|
2407
|
+
var import_react7 = require("react");
|
|
2408
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1121
2409
|
var RoomQrCode = ({
|
|
1122
2410
|
value,
|
|
1123
2411
|
size = 180,
|
|
@@ -1130,58 +2418,24 @@ var RoomQrCode = ({
|
|
|
1130
2418
|
alt = "Room join QR code"
|
|
1131
2419
|
}) => {
|
|
1132
2420
|
const trimmed = value.trim();
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
void (0, import_qrcode.toDataURL)(trimmed, {
|
|
1145
|
-
width: size,
|
|
1146
|
-
margin: padding,
|
|
1147
|
-
errorCorrectionLevel,
|
|
1148
|
-
color: {
|
|
1149
|
-
dark: foregroundColor,
|
|
1150
|
-
light: backgroundColor
|
|
1151
|
-
}
|
|
1152
|
-
}).then((nextUrl) => {
|
|
1153
|
-
if (!cancelled) {
|
|
1154
|
-
setQrState({
|
|
1155
|
-
key: qrKey,
|
|
1156
|
-
dataUrl: nextUrl,
|
|
1157
|
-
error: false
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
}).catch(() => {
|
|
1161
|
-
if (!cancelled) {
|
|
1162
|
-
setQrState({
|
|
1163
|
-
key: qrKey,
|
|
1164
|
-
dataUrl: null,
|
|
1165
|
-
error: true
|
|
1166
|
-
});
|
|
2421
|
+
const qr = (0, import_react7.useMemo)(() => {
|
|
2422
|
+
if (!trimmed) return null;
|
|
2423
|
+
try {
|
|
2424
|
+
const { modules } = (0, import_qrcode.create)(trimmed, { errorCorrectionLevel });
|
|
2425
|
+
let path = "";
|
|
2426
|
+
for (let row = 0; row < modules.size; row += 1) {
|
|
2427
|
+
for (let column = 0; column < modules.size; column += 1) {
|
|
2428
|
+
if (modules.data[row * modules.size + column]) {
|
|
2429
|
+
path += `M${column},${row}h1v1h-1z`;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
1167
2432
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1172
|
-
}, [
|
|
1173
|
-
|
|
1174
|
-
errorCorrectionLevel,
|
|
1175
|
-
foregroundColor,
|
|
1176
|
-
padding,
|
|
1177
|
-
size,
|
|
1178
|
-
qrKey,
|
|
1179
|
-
trimmed
|
|
1180
|
-
]);
|
|
1181
|
-
const imageSrc = trimmed && qrState.key === qrKey && qrState.dataUrl ? qrState.dataUrl : null;
|
|
1182
|
-
const isLoading = !!trimmed && qrState.key !== qrKey;
|
|
1183
|
-
const isUnavailable = !trimmed || qrState.key === qrKey && qrState.error;
|
|
1184
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2433
|
+
return { path, size: modules.size };
|
|
2434
|
+
} catch {
|
|
2435
|
+
return null;
|
|
2436
|
+
}
|
|
2437
|
+
}, [trimmed, errorCorrectionLevel]);
|
|
2438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1185
2439
|
"div",
|
|
1186
2440
|
{
|
|
1187
2441
|
className,
|
|
@@ -1192,19 +2446,31 @@ var RoomQrCode = ({
|
|
|
1192
2446
|
},
|
|
1193
2447
|
"aria-live": "polite",
|
|
1194
2448
|
"aria-label": alt,
|
|
1195
|
-
children:
|
|
1196
|
-
"
|
|
2449
|
+
children: qr ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2450
|
+
"svg",
|
|
1197
2451
|
{
|
|
1198
|
-
|
|
1199
|
-
alt,
|
|
2452
|
+
role: "img",
|
|
2453
|
+
"aria-label": alt,
|
|
1200
2454
|
width: size,
|
|
1201
2455
|
height: size,
|
|
1202
|
-
|
|
2456
|
+
viewBox: `${-padding} ${-padding} ${qr.size + padding * 2} ${qr.size + padding * 2}`,
|
|
2457
|
+
shapeRendering: "crispEdges",
|
|
2458
|
+
className: "h-full w-full rounded-md",
|
|
2459
|
+
children: [
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2461
|
+
"rect",
|
|
2462
|
+
{
|
|
2463
|
+
x: -padding,
|
|
2464
|
+
y: -padding,
|
|
2465
|
+
width: qr.size + padding * 2,
|
|
2466
|
+
height: qr.size + padding * 2,
|
|
2467
|
+
fill: backgroundColor
|
|
2468
|
+
}
|
|
2469
|
+
),
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: qr.path, fill: foregroundColor })
|
|
2471
|
+
]
|
|
1203
2472
|
}
|
|
1204
|
-
) :
|
|
1205
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "h-5 w-5 animate-spin rounded-full border-2 border-white/20 border-t-white/80" }),
|
|
1206
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Generating QR\u2026" })
|
|
1207
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex h-full w-full items-center justify-center rounded-md bg-black/15 text-xs text-white/70", children: isUnavailable ? "QR unavailable" : "Generating QR\u2026" })
|
|
2473
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex h-full w-full items-center justify-center rounded-md bg-black/15 text-xs text-white/70", children: "QR unavailable" })
|
|
1208
2474
|
}
|
|
1209
2475
|
);
|
|
1210
2476
|
};
|
|
@@ -1217,7 +2483,7 @@ var shellFieldClassName = "h-11 min-w-0 w-full rounded-2xl border border-white/1
|
|
|
1217
2483
|
var shellUtilityButtonClassName = "rounded-2xl border-white/12 bg-white/[0.045] text-white/88 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] hover:bg-white/[0.085] hover:text-white disabled:border-white/8 disabled:bg-white/[0.03] disabled:text-white/35";
|
|
1218
2484
|
|
|
1219
2485
|
// src/components/join-qr-overlay.tsx
|
|
1220
|
-
var
|
|
2486
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1221
2487
|
var JoinQrOverlay = ({
|
|
1222
2488
|
open,
|
|
1223
2489
|
value,
|
|
@@ -1243,8 +2509,8 @@ var JoinQrOverlay = ({
|
|
|
1243
2509
|
const joinUrlValue = value?.trim() ?? "";
|
|
1244
2510
|
const effectiveStatus = status === "ready" && joinUrlValue.length === 0 ? "unavailable" : status;
|
|
1245
2511
|
const overlaySize = `min(72vw, ${size}px)`;
|
|
1246
|
-
const [entered, setEntered] = (0,
|
|
1247
|
-
(0,
|
|
2512
|
+
const [entered, setEntered] = (0, import_react8.useState)(false);
|
|
2513
|
+
(0, import_react8.useEffect)(() => {
|
|
1248
2514
|
if (!open || typeof window === "undefined") {
|
|
1249
2515
|
return;
|
|
1250
2516
|
}
|
|
@@ -1258,7 +2524,7 @@ var JoinQrOverlay = ({
|
|
|
1258
2524
|
window.removeEventListener("keydown", handleKeyDown);
|
|
1259
2525
|
};
|
|
1260
2526
|
}, [onClose, open]);
|
|
1261
|
-
(0,
|
|
2527
|
+
(0, import_react8.useEffect)(() => {
|
|
1262
2528
|
if (!open || typeof window === "undefined") {
|
|
1263
2529
|
setEntered(false);
|
|
1264
2530
|
return;
|
|
@@ -1277,7 +2543,7 @@ var JoinQrOverlay = ({
|
|
|
1277
2543
|
const handlePanelClick = (event) => {
|
|
1278
2544
|
event.stopPropagation();
|
|
1279
2545
|
};
|
|
1280
|
-
const dialog = /* @__PURE__ */ (0,
|
|
2546
|
+
const dialog = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1281
2547
|
"div",
|
|
1282
2548
|
{
|
|
1283
2549
|
role: "dialog",
|
|
@@ -1289,7 +2555,7 @@ var JoinQrOverlay = ({
|
|
|
1289
2555
|
className
|
|
1290
2556
|
),
|
|
1291
2557
|
onClick: onClose,
|
|
1292
|
-
children: /* @__PURE__ */ (0,
|
|
2558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1293
2559
|
"div",
|
|
1294
2560
|
{
|
|
1295
2561
|
className: cn(
|
|
@@ -1299,11 +2565,11 @@ var JoinQrOverlay = ({
|
|
|
1299
2565
|
),
|
|
1300
2566
|
onClick: handlePanelClick,
|
|
1301
2567
|
children: [
|
|
1302
|
-
/* @__PURE__ */ (0,
|
|
1303
|
-
/* @__PURE__ */ (0,
|
|
1304
|
-
roomId ? /* @__PURE__ */ (0,
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-1", children: [
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-[11px] tracking-[0.18em] text-slate-400 uppercase", children: roomLabel }),
|
|
2570
|
+
roomId ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-2xl font-semibold tracking-tight text-white tabular-nums", children: roomId }) : null
|
|
1305
2571
|
] }),
|
|
1306
|
-
effectiveStatus === "loading" ? /* @__PURE__ */ (0,
|
|
2572
|
+
effectiveStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1307
2573
|
"div",
|
|
1308
2574
|
{
|
|
1309
2575
|
className: cn(
|
|
@@ -1316,11 +2582,11 @@ var JoinQrOverlay = ({
|
|
|
1316
2582
|
aspectRatio: "1 / 1"
|
|
1317
2583
|
},
|
|
1318
2584
|
children: [
|
|
1319
|
-
/* @__PURE__ */ (0,
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "h-8 w-8 animate-spin rounded-full border-2 border-white/15 border-t-white/85" }),
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: loadingLabel })
|
|
1321
2587
|
]
|
|
1322
2588
|
}
|
|
1323
|
-
) : effectiveStatus === "ready" ? /* @__PURE__ */ (0,
|
|
2589
|
+
) : effectiveStatus === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1324
2590
|
RoomQrCode,
|
|
1325
2591
|
{
|
|
1326
2592
|
value: joinUrlValue,
|
|
@@ -1339,7 +2605,7 @@ var JoinQrOverlay = ({
|
|
|
1339
2605
|
},
|
|
1340
2606
|
alt: qrAlt ?? (roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller")
|
|
1341
2607
|
}
|
|
1342
|
-
) : /* @__PURE__ */ (0,
|
|
2608
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1343
2609
|
"div",
|
|
1344
2610
|
{
|
|
1345
2611
|
className: cn(
|
|
@@ -1354,7 +2620,7 @@ var JoinQrOverlay = ({
|
|
|
1354
2620
|
children: unavailableLabel
|
|
1355
2621
|
}
|
|
1356
2622
|
),
|
|
1357
|
-
/* @__PURE__ */ (0,
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1358
2624
|
"p",
|
|
1359
2625
|
{
|
|
1360
2626
|
className: cn(
|
|
@@ -1364,7 +2630,7 @@ var JoinQrOverlay = ({
|
|
|
1364
2630
|
children: description
|
|
1365
2631
|
}
|
|
1366
2632
|
),
|
|
1367
|
-
showCloseButton ? /* @__PURE__ */ (0,
|
|
2633
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1368
2634
|
Button,
|
|
1369
2635
|
{
|
|
1370
2636
|
type: "button",
|
|
@@ -1391,7 +2657,7 @@ var JoinQrOverlay = ({
|
|
|
1391
2657
|
|
|
1392
2658
|
// src/components/join-url-action-buttons.tsx
|
|
1393
2659
|
var import_lucide_react2 = require("lucide-react");
|
|
1394
|
-
var
|
|
2660
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1395
2661
|
var JoinUrlActionButtons = ({
|
|
1396
2662
|
hasValue,
|
|
1397
2663
|
copied = false,
|
|
@@ -1403,7 +2669,7 @@ var JoinUrlActionButtons = ({
|
|
|
1403
2669
|
buttonClassName
|
|
1404
2670
|
}) => {
|
|
1405
2671
|
const showsQrButton = typeof onToggleQr === "function";
|
|
1406
|
-
return /* @__PURE__ */ (0,
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1407
2673
|
"div",
|
|
1408
2674
|
{
|
|
1409
2675
|
className: cn(
|
|
@@ -1412,7 +2678,7 @@ var JoinUrlActionButtons = ({
|
|
|
1412
2678
|
className
|
|
1413
2679
|
),
|
|
1414
2680
|
children: [
|
|
1415
|
-
/* @__PURE__ */ (0,
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1416
2682
|
Button,
|
|
1417
2683
|
{
|
|
1418
2684
|
type: "button",
|
|
@@ -1427,12 +2693,12 @@ var JoinUrlActionButtons = ({
|
|
|
1427
2693
|
buttonClassName
|
|
1428
2694
|
),
|
|
1429
2695
|
children: [
|
|
1430
|
-
copied ? /* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
2696
|
+
copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.Check, { className: "h-4 w-4", "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.Copy, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate", children: copied ? "Copied" : "Copy" })
|
|
1432
2698
|
]
|
|
1433
2699
|
}
|
|
1434
2700
|
),
|
|
1435
|
-
/* @__PURE__ */ (0,
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1436
2702
|
Button,
|
|
1437
2703
|
{
|
|
1438
2704
|
type: "button",
|
|
@@ -1447,12 +2713,12 @@ var JoinUrlActionButtons = ({
|
|
|
1447
2713
|
buttonClassName
|
|
1448
2714
|
),
|
|
1449
2715
|
children: [
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.ExternalLink, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate", children: "New tab" })
|
|
1452
2718
|
]
|
|
1453
2719
|
}
|
|
1454
2720
|
),
|
|
1455
|
-
showsQrButton ? /* @__PURE__ */ (0,
|
|
2721
|
+
showsQrButton ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1456
2722
|
Button,
|
|
1457
2723
|
{
|
|
1458
2724
|
type: "button",
|
|
@@ -1468,8 +2734,8 @@ var JoinUrlActionButtons = ({
|
|
|
1468
2734
|
buttonClassName
|
|
1469
2735
|
),
|
|
1470
2736
|
children: [
|
|
1471
|
-
/* @__PURE__ */ (0,
|
|
1472
|
-
/* @__PURE__ */ (0,
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.QrCode, { className: "h-4 w-4", "aria-hidden": true }),
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "truncate", children: qrVisible ? "Hide QR" : "QR code" })
|
|
1473
2739
|
]
|
|
1474
2740
|
}
|
|
1475
2741
|
) : null
|
|
@@ -1478,9 +2744,128 @@ var JoinUrlActionButtons = ({
|
|
|
1478
2744
|
);
|
|
1479
2745
|
};
|
|
1480
2746
|
|
|
2747
|
+
// src/runtime/controller-bridge-context.ts
|
|
2748
|
+
var import_zod26 = require("zod");
|
|
2749
|
+
|
|
2750
|
+
// src/runtime/arcade-surface-identity.ts
|
|
2751
|
+
var import_zod25 = require("zod");
|
|
2752
|
+
var arcadeSurfaceRuntimeIdentitySchema = import_zod25.z.object({
|
|
2753
|
+
epoch: import_zod25.z.number().int().nonnegative(),
|
|
2754
|
+
kind: import_zod25.z.enum(["browser", "game"]),
|
|
2755
|
+
gameId: import_zod25.z.string().nullable()
|
|
2756
|
+
}).strict();
|
|
2757
|
+
|
|
2758
|
+
// src/runtime/controller-bridge-context.ts
|
|
2759
|
+
var controllerBridgeContextSchema = import_zod26.z.union([
|
|
2760
|
+
import_zod26.z.object({ arcadeSurface: arcadeSurfaceRuntimeIdentitySchema }).strict(),
|
|
2761
|
+
import_zod26.z.object({ harnessSessionId: import_zod26.z.uuid() }).strict()
|
|
2762
|
+
]);
|
|
2763
|
+
function controllerBridgeContext(context) {
|
|
2764
|
+
return "arcadeSurface" in context ? { arcadeSurface: context.arcadeSurface } : { harnessSessionId: context.harnessSessionId };
|
|
2765
|
+
}
|
|
2766
|
+
function withControllerBridgeContext(shape) {
|
|
2767
|
+
return import_zod26.z.union([
|
|
2768
|
+
import_zod26.z.object({ ...shape, arcadeSurface: arcadeSurfaceRuntimeIdentitySchema }).strict(),
|
|
2769
|
+
import_zod26.z.object({ ...shape, harnessSessionId: import_zod26.z.uuid() }).strict()
|
|
2770
|
+
]);
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
// src/runtime/arcade-runtime-url.ts
|
|
2774
|
+
var parseOptionalArcadeSurfaceFromSearchParams = (params) => {
|
|
2775
|
+
const epochStr = params.get("aj_arcade_epoch");
|
|
2776
|
+
const kind = params.get("aj_arcade_kind");
|
|
2777
|
+
if (epochStr === null || kind !== "browser" && kind !== "game") {
|
|
2778
|
+
return void 0;
|
|
2779
|
+
}
|
|
2780
|
+
const epoch = Number(epochStr);
|
|
2781
|
+
if (!Number.isFinite(epoch) || epoch < 0 || !Number.isInteger(epoch)) {
|
|
2782
|
+
return void 0;
|
|
2783
|
+
}
|
|
2784
|
+
const gameIdRaw = params.get("aj_arcade_game_id");
|
|
2785
|
+
const gameId = kind === "browser" ? null : gameIdRaw && gameIdRaw.length > 0 ? gameIdRaw : null;
|
|
2786
|
+
return { epoch, kind, gameId };
|
|
2787
|
+
};
|
|
2788
|
+
|
|
2789
|
+
// src/runtime/runtime-session-params.ts
|
|
2790
|
+
var readChildHostRuntimeParams = () => {
|
|
2791
|
+
if (typeof window === "undefined") {
|
|
2792
|
+
return null;
|
|
2793
|
+
}
|
|
2794
|
+
const params = new URLSearchParams(window.location.search);
|
|
2795
|
+
const room = params.get("aj_room");
|
|
2796
|
+
if (!room) {
|
|
2797
|
+
return null;
|
|
2798
|
+
}
|
|
2799
|
+
const joinUrl = params.get("aj_join_url");
|
|
2800
|
+
const normalizedJoinUrl = joinUrl ? normalizeRuntimeUrl(joinUrl) : null;
|
|
2801
|
+
const topology = parseRuntimeTopologyFromSearchParams(params);
|
|
2802
|
+
if (!topology) {
|
|
2803
|
+
return null;
|
|
2804
|
+
}
|
|
2805
|
+
const arcadeSurface = parseOptionalArcadeSurfaceFromSearchParams(params);
|
|
2806
|
+
if (!arcadeSurface) {
|
|
2807
|
+
return null;
|
|
2808
|
+
}
|
|
2809
|
+
return {
|
|
2810
|
+
room,
|
|
2811
|
+
joinUrl: normalizedJoinUrl ?? void 0,
|
|
2812
|
+
topology,
|
|
2813
|
+
arcadeSurface
|
|
2814
|
+
};
|
|
2815
|
+
};
|
|
2816
|
+
var readEmbeddedControllerRuntimeParams = () => {
|
|
2817
|
+
if (typeof window === "undefined") {
|
|
2818
|
+
return null;
|
|
2819
|
+
}
|
|
2820
|
+
const params = new URLSearchParams(window.location.search);
|
|
2821
|
+
const room = params.get("aj_room");
|
|
2822
|
+
if (!room) {
|
|
2823
|
+
return null;
|
|
2824
|
+
}
|
|
2825
|
+
const topology = parseRuntimeTopologyFromSearchParams(params);
|
|
2826
|
+
if (!topology) {
|
|
2827
|
+
return null;
|
|
2828
|
+
}
|
|
2829
|
+
const harnessContext = params.has("aj_harness_session") ? controllerBridgeContextSchema.parse({
|
|
2830
|
+
harnessSessionId: params.get("aj_harness_session")
|
|
2831
|
+
}) : null;
|
|
2832
|
+
const context = controllerBridgeContextSchema.safeParse(
|
|
2833
|
+
harnessContext ? harnessContext : { arcadeSurface: parseOptionalArcadeSurfaceFromSearchParams(params) }
|
|
2834
|
+
);
|
|
2835
|
+
if (!context.success) {
|
|
2836
|
+
return null;
|
|
2837
|
+
}
|
|
2838
|
+
const rawLabel = params.get("aj_player_label")?.trim();
|
|
2839
|
+
const rawAvatarId = params.get("aj_player_avatar")?.trim();
|
|
2840
|
+
const playerProfile = rawLabel || rawAvatarId ? {
|
|
2841
|
+
...rawLabel ? { label: rawLabel } : {},
|
|
2842
|
+
...rawAvatarId ? { avatarId: rawAvatarId } : {}
|
|
2843
|
+
} : void 0;
|
|
2844
|
+
return {
|
|
2845
|
+
room,
|
|
2846
|
+
topology,
|
|
2847
|
+
...context.data,
|
|
2848
|
+
...playerProfile ? { playerProfile } : {}
|
|
2849
|
+
};
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
// src/runtime/embedded-runtime-adapters.ts
|
|
2853
|
+
var readEmbeddedHostChildSession = () => {
|
|
2854
|
+
const raw = readChildHostRuntimeParams();
|
|
2855
|
+
if (!raw) {
|
|
2856
|
+
return null;
|
|
2857
|
+
}
|
|
2858
|
+
return {
|
|
2859
|
+
roomId: roomCodeSchema.parse(raw.room.toUpperCase()),
|
|
2860
|
+
joinUrl: raw.joinUrl,
|
|
2861
|
+
topology: raw.topology,
|
|
2862
|
+
arcadeSurface: raw.arcadeSurface
|
|
2863
|
+
};
|
|
2864
|
+
};
|
|
2865
|
+
|
|
1481
2866
|
// src/components/join-url-field.tsx
|
|
1482
|
-
var
|
|
1483
|
-
var
|
|
2867
|
+
var import_react9 = require("react");
|
|
2868
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1484
2869
|
var JoinUrlField = ({
|
|
1485
2870
|
value,
|
|
1486
2871
|
label = "Controller link",
|
|
@@ -1491,11 +2876,11 @@ var JoinUrlField = ({
|
|
|
1491
2876
|
inputName = "airjam-controller-link"
|
|
1492
2877
|
}) => {
|
|
1493
2878
|
const hasValue = Boolean(value && value.trim().length > 0);
|
|
1494
|
-
const generatedInputId = (0,
|
|
2879
|
+
const generatedInputId = (0, import_react9.useId)();
|
|
1495
2880
|
const resolvedInputId = inputId ?? generatedInputId;
|
|
1496
|
-
return /* @__PURE__ */ (0,
|
|
1497
|
-
/* @__PURE__ */ (0,
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
2881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("space-y-2.5", className), children: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: shellLabelClassName, htmlFor: resolvedInputId, children: label }),
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1499
2884
|
"input",
|
|
1500
2885
|
{
|
|
1501
2886
|
id: resolvedInputId,
|
|
@@ -1508,12 +2893,12 @@ var JoinUrlField = ({
|
|
|
1508
2893
|
className: cn(shellFieldClassName, inputClassName)
|
|
1509
2894
|
}
|
|
1510
2895
|
),
|
|
1511
|
-
helperText ? /* @__PURE__ */ (0,
|
|
2896
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: shellHelperTextClassName, children: helperText }) : null
|
|
1512
2897
|
] });
|
|
1513
2898
|
};
|
|
1514
2899
|
|
|
1515
2900
|
// src/components/join-url-controls.tsx
|
|
1516
|
-
var
|
|
2901
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1517
2902
|
var JoinUrlControls = ({
|
|
1518
2903
|
value,
|
|
1519
2904
|
label = "Controller link",
|
|
@@ -1527,9 +2912,10 @@ var JoinUrlControls = ({
|
|
|
1527
2912
|
inputClassName,
|
|
1528
2913
|
buttonClassName
|
|
1529
2914
|
}) => {
|
|
2915
|
+
if (readEmbeddedHostChildSession()) return null;
|
|
1530
2916
|
const hasValue = Boolean(value && value.trim().length > 0);
|
|
1531
|
-
return /* @__PURE__ */ (0,
|
|
1532
|
-
/* @__PURE__ */ (0,
|
|
2917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("w-full space-y-3", className), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1533
2919
|
JoinUrlField,
|
|
1534
2920
|
{
|
|
1535
2921
|
value,
|
|
@@ -1539,7 +2925,7 @@ var JoinUrlControls = ({
|
|
|
1539
2925
|
inputClassName
|
|
1540
2926
|
}
|
|
1541
2927
|
),
|
|
1542
|
-
/* @__PURE__ */ (0,
|
|
2928
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1543
2929
|
JoinUrlActionButtons,
|
|
1544
2930
|
{
|
|
1545
2931
|
hasValue,
|
|
@@ -1615,7 +3001,7 @@ var useLifecycleActionGroupModel = ({
|
|
|
1615
3001
|
};
|
|
1616
3002
|
|
|
1617
3003
|
// src/components/lifecycle-action-group.tsx
|
|
1618
|
-
var
|
|
3004
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1619
3005
|
var LifecycleActionGroup = ({
|
|
1620
3006
|
phase,
|
|
1621
3007
|
runtimeState,
|
|
@@ -1651,23 +3037,23 @@ var LifecycleActionGroup = ({
|
|
|
1651
3037
|
const renderIcon = (kind, label) => {
|
|
1652
3038
|
switch (kind) {
|
|
1653
3039
|
case "start":
|
|
1654
|
-
return /* @__PURE__ */ (0,
|
|
3040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Play, { "aria-hidden": true, className: "size-4.5" });
|
|
1655
3041
|
case "pause-toggle":
|
|
1656
|
-
return label.toLowerCase() === "resume" ? /* @__PURE__ */ (0,
|
|
3042
|
+
return label.toLowerCase() === "resume" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Play, { "aria-hidden": true, className: "size-4.5" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Pause, { "aria-hidden": true, className: "size-4.5" });
|
|
1657
3043
|
case "restart":
|
|
1658
|
-
return /* @__PURE__ */ (0,
|
|
3044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.RotateCcw, { "aria-hidden": true, className: "size-4.5" });
|
|
1659
3045
|
case "back-to-lobby":
|
|
1660
|
-
return /* @__PURE__ */ (0,
|
|
3046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.House, { "aria-hidden": true, className: "size-4.5" });
|
|
1661
3047
|
}
|
|
1662
3048
|
};
|
|
1663
|
-
return /* @__PURE__ */ (0,
|
|
3049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1664
3050
|
"div",
|
|
1665
3051
|
{
|
|
1666
3052
|
className: cn(
|
|
1667
3053
|
"flex min-w-0 flex-nowrap items-center justify-end gap-1.5 overflow-x-auto",
|
|
1668
3054
|
className
|
|
1669
3055
|
),
|
|
1670
|
-
children: actions.map((action) => /* @__PURE__ */ (0,
|
|
3056
|
+
children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1671
3057
|
Button,
|
|
1672
3058
|
{
|
|
1673
3059
|
type: "button",
|
|
@@ -1691,6 +3077,7 @@ var LifecycleActionGroup = ({
|
|
|
1691
3077
|
|
|
1692
3078
|
// src/components/player-avatar.tsx
|
|
1693
3079
|
var import_lucide_react4 = require("lucide-react");
|
|
3080
|
+
var import_react10 = require("react");
|
|
1694
3081
|
|
|
1695
3082
|
// src/utils/player-avatar-url.ts
|
|
1696
3083
|
var DIEBEAR_ADVENTURER_NEUTRAL_SVG_BASE = "https://api.dicebear.com/9.x/adventurer-neutral/svg";
|
|
@@ -1722,7 +3109,7 @@ var getDiceBearAdventurerNeutralUrl = (seed) => `${DIEBEAR_ADVENTURER_NEUTRAL_SV
|
|
|
1722
3109
|
var getPlayerAvatarImageUrl = (player) => getDiceBearAdventurerNeutralUrl(resolvePlayerAvatarSeed(player));
|
|
1723
3110
|
|
|
1724
3111
|
// src/components/player-avatar.tsx
|
|
1725
|
-
var
|
|
3112
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1726
3113
|
var hexToRgba = (hex, opacity) => {
|
|
1727
3114
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1728
3115
|
if (!result) return `rgba(0, 0, 0, ${opacity})`;
|
|
@@ -1737,6 +3124,7 @@ var PlayerAvatar = ({
|
|
|
1737
3124
|
size = "md",
|
|
1738
3125
|
className = ""
|
|
1739
3126
|
}) => {
|
|
3127
|
+
const [failedSrc, setFailedSrc] = (0, import_react10.useState)(null);
|
|
1740
3128
|
const accentColor = player.color || "hsl(var(--border))";
|
|
1741
3129
|
const sizeClasses = {
|
|
1742
3130
|
sm: "h-9 w-9 border-2",
|
|
@@ -1759,7 +3147,7 @@ var PlayerAvatar = ({
|
|
|
1759
3147
|
className
|
|
1760
3148
|
);
|
|
1761
3149
|
if (isBot) {
|
|
1762
|
-
return /* @__PURE__ */ (0,
|
|
3150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1763
3151
|
"div",
|
|
1764
3152
|
{
|
|
1765
3153
|
role: "img",
|
|
@@ -1773,479 +3161,147 @@ var PlayerAvatar = ({
|
|
|
1773
3161
|
color: accentColor,
|
|
1774
3162
|
boxShadow: shadowStyles[size]
|
|
1775
3163
|
},
|
|
1776
|
-
children: /* @__PURE__ */ (0,
|
|
3164
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Bot, { "aria-hidden": "true", className: iconSizeClasses[size] })
|
|
1777
3165
|
}
|
|
1778
3166
|
);
|
|
1779
3167
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
alt: player.label,
|
|
1785
|
-
className: cn("bg-secondary/30", shellClassName),
|
|
1786
|
-
style: {
|
|
1787
|
-
borderColor: accentColor,
|
|
1788
|
-
boxShadow: shadowStyles[size]
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
);
|
|
1792
|
-
};
|
|
1793
|
-
|
|
1794
|
-
// src/components/player-avatar-strip.tsx
|
|
1795
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1796
|
-
var overflowSizeClasses = {
|
|
1797
|
-
sm: "h-9 w-9 min-h-9 min-w-9 text-[0.625rem]",
|
|
1798
|
-
md: "h-12 w-12 min-h-12 min-w-12 text-[11px]",
|
|
1799
|
-
lg: "h-16 w-16 min-h-16 min-w-16 text-xs"
|
|
1800
|
-
};
|
|
1801
|
-
var PlayerAvatarStrip = ({
|
|
1802
|
-
players,
|
|
1803
|
-
maxVisible = 4,
|
|
1804
|
-
size = "sm",
|
|
1805
|
-
className,
|
|
1806
|
-
avatarClassName = "",
|
|
1807
|
-
overflowBadgeClassName = ""
|
|
1808
|
-
}) => {
|
|
1809
|
-
const visible = players.slice(0, maxVisible);
|
|
1810
|
-
const overflow = Math.max(0, players.length - maxVisible);
|
|
1811
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex items-center -space-x-2", className), children: [
|
|
1812
|
-
visible.map((player) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1813
|
-
PlayerAvatar,
|
|
1814
|
-
{
|
|
1815
|
-
player,
|
|
1816
|
-
size,
|
|
1817
|
-
className: avatarClassName
|
|
1818
|
-
},
|
|
1819
|
-
player.id
|
|
1820
|
-
)),
|
|
1821
|
-
overflow > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3168
|
+
const src = getPlayerAvatarImageUrl(player);
|
|
3169
|
+
if (failedSrc === src) {
|
|
3170
|
+
const initials = playerInitials(player.label);
|
|
3171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1822
3172
|
"div",
|
|
1823
3173
|
{
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
// src/components/runtime-shell-header.tsx
|
|
1840
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1841
|
-
var RuntimeShellHeader = ({
|
|
1842
|
-
connectionStatus,
|
|
1843
|
-
leftSlot,
|
|
1844
|
-
rightSlot,
|
|
1845
|
-
className
|
|
1846
|
-
}) => {
|
|
1847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1848
|
-
"header",
|
|
1849
|
-
{
|
|
1850
|
-
className: cn(
|
|
1851
|
-
"flex min-h-16 items-center gap-2.5 px-3 py-2.5 sm:px-4",
|
|
1852
|
-
shellHeaderClassName,
|
|
1853
|
-
className
|
|
1854
|
-
),
|
|
1855
|
-
children: [
|
|
1856
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "min-w-0 flex-1", children: leftSlot }),
|
|
1857
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex shrink-0 items-center gap-2.5", children: [
|
|
1858
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ConnectionStatusPill, { status: connectionStatus }),
|
|
1859
|
-
rightSlot ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-end", children: rightSlot }) : null
|
|
1860
|
-
] })
|
|
1861
|
-
]
|
|
1862
|
-
}
|
|
1863
|
-
);
|
|
1864
|
-
};
|
|
1865
|
-
|
|
1866
|
-
// src/components/surface-viewport.tsx
|
|
1867
|
-
var import_react9 = require("react");
|
|
1868
|
-
|
|
1869
|
-
// src/runtime/controller-bridge.ts
|
|
1870
|
-
var import_zod13 = require("zod");
|
|
1871
|
-
|
|
1872
|
-
// src/contracts/v2/bridge.ts
|
|
1873
|
-
var import_zod9 = require("zod");
|
|
1874
|
-
var roomCodeSchema2 = import_zod9.z.string().trim().min(4).max(8).regex(/^[A-Z0-9]+$/, {
|
|
1875
|
-
message: "room code must contain only A-Z or 0-9"
|
|
1876
|
-
});
|
|
1877
|
-
var runtimeStateSchema = import_zod9.z.enum(["paused", "playing"]);
|
|
1878
|
-
var playerProfileSchema = import_zod9.z.object({
|
|
1879
|
-
id: import_zod9.z.string().min(1),
|
|
1880
|
-
label: import_zod9.z.string().min(1),
|
|
1881
|
-
color: import_zod9.z.string().optional(),
|
|
1882
|
-
avatarId: import_zod9.z.string().optional()
|
|
1883
|
-
}).strict();
|
|
1884
|
-
var inputFrameEntrySchema = import_zod9.z.object({
|
|
1885
|
-
controllerId: import_zod9.z.string().min(1),
|
|
1886
|
-
input: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown())
|
|
1887
|
-
}).strict();
|
|
1888
|
-
var V2_BRIDGE_PARENT_TO_GAME_TYPES = [
|
|
1889
|
-
"BOOTSTRAP",
|
|
1890
|
-
"PLAYERS_UPDATE",
|
|
1891
|
-
"RUNTIME_STATE_UPDATE",
|
|
1892
|
-
"INPUT_FRAME",
|
|
1893
|
-
"PAUSE",
|
|
1894
|
-
"RESUME",
|
|
1895
|
-
"SHUTDOWN"
|
|
1896
|
-
];
|
|
1897
|
-
var V2_BRIDGE_GAME_TO_PARENT_TYPES = [
|
|
1898
|
-
"READY",
|
|
1899
|
-
"STATE_PATCH",
|
|
1900
|
-
"SIGNAL",
|
|
1901
|
-
"ERROR",
|
|
1902
|
-
"METRICS"
|
|
1903
|
-
];
|
|
1904
|
-
var allMessageTypes = [
|
|
1905
|
-
...V2_BRIDGE_PARENT_TO_GAME_TYPES,
|
|
1906
|
-
...V2_BRIDGE_GAME_TO_PARENT_TYPES
|
|
1907
|
-
];
|
|
1908
|
-
var knownBridgeMessageTypeSet = new Set(allMessageTypes);
|
|
1909
|
-
var bootstrapMessageSchema = import_zod9.z.object({
|
|
1910
|
-
type: import_zod9.z.literal("BOOTSTRAP"),
|
|
1911
|
-
payload: import_zod9.z.object({
|
|
1912
|
-
roomId: roomCodeSchema2,
|
|
1913
|
-
players: import_zod9.z.array(playerProfileSchema),
|
|
1914
|
-
state: import_zod9.z.object({
|
|
1915
|
-
runtimeState: runtimeStateSchema,
|
|
1916
|
-
message: import_zod9.z.string().optional()
|
|
1917
|
-
}).strict(),
|
|
1918
|
-
capabilities: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.boolean()).default({})
|
|
1919
|
-
}).strict()
|
|
1920
|
-
}).strict();
|
|
1921
|
-
var playersUpdateMessageSchema = import_zod9.z.object({
|
|
1922
|
-
type: import_zod9.z.literal("PLAYERS_UPDATE"),
|
|
1923
|
-
payload: import_zod9.z.object({
|
|
1924
|
-
players: import_zod9.z.array(playerProfileSchema)
|
|
1925
|
-
}).strict()
|
|
1926
|
-
}).strict();
|
|
1927
|
-
var runtimeStateUpdateMessageSchema = import_zod9.z.object({
|
|
1928
|
-
type: import_zod9.z.literal("RUNTIME_STATE_UPDATE"),
|
|
1929
|
-
payload: import_zod9.z.object({
|
|
1930
|
-
runtimeState: runtimeStateSchema,
|
|
1931
|
-
message: import_zod9.z.string().optional()
|
|
1932
|
-
}).strict()
|
|
1933
|
-
}).strict();
|
|
1934
|
-
var inputFrameMessageSchema = import_zod9.z.object({
|
|
1935
|
-
type: import_zod9.z.literal("INPUT_FRAME"),
|
|
1936
|
-
payload: import_zod9.z.object({
|
|
1937
|
-
frameId: import_zod9.z.number().int().nonnegative(),
|
|
1938
|
-
inputs: import_zod9.z.array(inputFrameEntrySchema)
|
|
1939
|
-
}).strict()
|
|
1940
|
-
}).strict();
|
|
1941
|
-
var pauseMessageSchema = import_zod9.z.object({
|
|
1942
|
-
type: import_zod9.z.literal("PAUSE"),
|
|
1943
|
-
payload: import_zod9.z.object({
|
|
1944
|
-
reason: import_zod9.z.string().optional()
|
|
1945
|
-
}).strict()
|
|
1946
|
-
}).strict();
|
|
1947
|
-
var resumeMessageSchema = import_zod9.z.object({
|
|
1948
|
-
type: import_zod9.z.literal("RESUME"),
|
|
1949
|
-
payload: import_zod9.z.object({}).strict()
|
|
1950
|
-
}).strict();
|
|
1951
|
-
var shutdownMessageSchema = import_zod9.z.object({
|
|
1952
|
-
type: import_zod9.z.literal("SHUTDOWN"),
|
|
1953
|
-
payload: import_zod9.z.object({
|
|
1954
|
-
reason: import_zod9.z.string().min(1)
|
|
1955
|
-
}).strict()
|
|
1956
|
-
}).strict();
|
|
1957
|
-
var readyMessageSchema = import_zod9.z.object({
|
|
1958
|
-
type: import_zod9.z.literal("READY"),
|
|
1959
|
-
payload: import_zod9.z.object({
|
|
1960
|
-
readyAtMs: import_zod9.z.number().int().nonnegative()
|
|
1961
|
-
}).strict()
|
|
1962
|
-
}).strict();
|
|
1963
|
-
var statePatchMessageSchema = import_zod9.z.object({
|
|
1964
|
-
type: import_zod9.z.literal("STATE_PATCH"),
|
|
1965
|
-
payload: import_zod9.z.object({
|
|
1966
|
-
patch: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown())
|
|
1967
|
-
}).strict()
|
|
1968
|
-
}).strict();
|
|
1969
|
-
var signalMessageSchema = import_zod9.z.object({
|
|
1970
|
-
type: import_zod9.z.literal("SIGNAL"),
|
|
1971
|
-
payload: import_zod9.z.object({
|
|
1972
|
-
signalType: import_zod9.z.string().min(1),
|
|
1973
|
-
targetId: import_zod9.z.string().min(1).optional(),
|
|
1974
|
-
data: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown())
|
|
1975
|
-
}).strict()
|
|
1976
|
-
}).strict();
|
|
1977
|
-
var errorMessageSchema = import_zod9.z.object({
|
|
1978
|
-
type: import_zod9.z.literal("ERROR"),
|
|
1979
|
-
payload: import_zod9.z.object({
|
|
1980
|
-
code: import_zod9.z.string().min(1),
|
|
1981
|
-
message: import_zod9.z.string().min(1),
|
|
1982
|
-
details: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown()).optional()
|
|
1983
|
-
}).strict()
|
|
1984
|
-
}).strict();
|
|
1985
|
-
var metricsMessageSchema = import_zod9.z.object({
|
|
1986
|
-
type: import_zod9.z.literal("METRICS"),
|
|
1987
|
-
payload: import_zod9.z.object({
|
|
1988
|
-
values: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.number())
|
|
1989
|
-
}).strict()
|
|
1990
|
-
}).strict();
|
|
1991
|
-
var v2BridgeParentToGameMessageSchema = import_zod9.z.union([
|
|
1992
|
-
bootstrapMessageSchema,
|
|
1993
|
-
playersUpdateMessageSchema,
|
|
1994
|
-
runtimeStateUpdateMessageSchema,
|
|
1995
|
-
inputFrameMessageSchema,
|
|
1996
|
-
pauseMessageSchema,
|
|
1997
|
-
resumeMessageSchema,
|
|
1998
|
-
shutdownMessageSchema
|
|
1999
|
-
]);
|
|
2000
|
-
var v2BridgeGameToParentMessageSchema = import_zod9.z.union([
|
|
2001
|
-
readyMessageSchema,
|
|
2002
|
-
statePatchMessageSchema,
|
|
2003
|
-
signalMessageSchema,
|
|
2004
|
-
errorMessageSchema,
|
|
2005
|
-
metricsMessageSchema
|
|
2006
|
-
]);
|
|
2007
|
-
var v2BridgeMessageSchema = import_zod9.z.union([
|
|
2008
|
-
v2BridgeParentToGameMessageSchema,
|
|
2009
|
-
v2BridgeGameToParentMessageSchema
|
|
2010
|
-
]);
|
|
2011
|
-
|
|
2012
|
-
// src/contracts/v2/handshake.ts
|
|
2013
|
-
var import_zod10 = require("zod");
|
|
2014
|
-
var AIR_JAM_PROTOCOL_V2 = "2";
|
|
2015
|
-
var semanticVersionPattern = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
2016
|
-
var v2ProtocolVersionSchema = import_zod10.z.literal(AIR_JAM_PROTOCOL_V2);
|
|
2017
|
-
var runtimeKindSchema = import_zod10.z.enum([
|
|
2018
|
-
"standalone-host",
|
|
2019
|
-
"standalone-controller",
|
|
2020
|
-
"arcade-runtime",
|
|
2021
|
-
"arcade-game-iframe",
|
|
2022
|
-
"arcade-host-runtime",
|
|
2023
|
-
"arcade-host-iframe",
|
|
2024
|
-
"arcade-controller-runtime",
|
|
2025
|
-
"arcade-controller-iframe"
|
|
2026
|
-
]);
|
|
2027
|
-
var capabilityFlagsSchema = import_zod10.z.record(import_zod10.z.string(), import_zod10.z.boolean());
|
|
2028
|
-
var sdkVersionSchema = import_zod10.z.string().regex(
|
|
2029
|
-
semanticVersionPattern,
|
|
2030
|
-
"sdkVersion must use semantic version format (for example 1.2.3)"
|
|
2031
|
-
);
|
|
2032
|
-
var v2HandshakeSchema = import_zod10.z.object({
|
|
2033
|
-
protocolVersion: v2ProtocolVersionSchema,
|
|
2034
|
-
sdkVersion: sdkVersionSchema,
|
|
2035
|
-
runtimeKind: runtimeKindSchema,
|
|
2036
|
-
capabilityFlags: capabilityFlagsSchema.default({})
|
|
2037
|
-
}).strict();
|
|
2038
|
-
|
|
2039
|
-
// src/runtime/arcade-surface-identity.ts
|
|
2040
|
-
var import_zod11 = require("zod");
|
|
2041
|
-
var arcadeSurfaceRuntimeIdentitySchema = import_zod11.z.object({
|
|
2042
|
-
epoch: import_zod11.z.number().int().nonnegative(),
|
|
2043
|
-
kind: import_zod11.z.enum(["browser", "game"]),
|
|
2044
|
-
gameId: import_zod11.z.string().nullable()
|
|
2045
|
-
}).strict();
|
|
2046
|
-
|
|
2047
|
-
// src/runtime/iframe-bridge.ts
|
|
2048
|
-
var import_zod12 = require("zod");
|
|
2049
|
-
var AIRJAM_BRIDGE_INIT = "AIRJAM_BRIDGE_INIT";
|
|
2050
|
-
var AIRJAM_SETTINGS_SYNC = "AIRJAM_SETTINGS_SYNC";
|
|
2051
|
-
var AIRJAM_SETTINGS_READY = "AIRJAM_SETTINGS_READY";
|
|
2052
|
-
var airJamSettingsSyncSchema = import_zod12.z.object({
|
|
2053
|
-
type: import_zod12.z.literal(AIRJAM_SETTINGS_SYNC),
|
|
2054
|
-
payload: import_zod12.z.object({
|
|
2055
|
-
settings: import_zod12.z.object({
|
|
2056
|
-
audio: import_zod12.z.object({
|
|
2057
|
-
masterVolume: import_zod12.z.number(),
|
|
2058
|
-
musicVolume: import_zod12.z.number(),
|
|
2059
|
-
sfxVolume: import_zod12.z.number()
|
|
2060
|
-
}).strict(),
|
|
2061
|
-
accessibility: import_zod12.z.object({
|
|
2062
|
-
reducedMotion: import_zod12.z.boolean(),
|
|
2063
|
-
highContrast: import_zod12.z.boolean()
|
|
2064
|
-
}).strict(),
|
|
2065
|
-
feedback: import_zod12.z.object({
|
|
2066
|
-
hapticsEnabled: import_zod12.z.boolean()
|
|
2067
|
-
}).strict(),
|
|
2068
|
-
previewControllers: import_zod12.z.object({
|
|
2069
|
-
activeOpacity: import_zod12.z.number()
|
|
2070
|
-
}).strict()
|
|
2071
|
-
}).strict()
|
|
2072
|
-
}).strict()
|
|
2073
|
-
}).strict();
|
|
2074
|
-
var airJamBridgeInitSchema = import_zod12.z.object({
|
|
2075
|
-
type: import_zod12.z.literal(AIRJAM_BRIDGE_INIT),
|
|
2076
|
-
payload: import_zod12.z.object({
|
|
2077
|
-
handshake: v2HandshakeSchema
|
|
2078
|
-
}).strict()
|
|
2079
|
-
}).strict();
|
|
2080
|
-
var airJamSettingsReadySchema = import_zod12.z.object({
|
|
2081
|
-
type: import_zod12.z.literal(AIRJAM_SETTINGS_READY),
|
|
2082
|
-
payload: import_zod12.z.object({
|
|
2083
|
-
ready: import_zod12.z.literal(true)
|
|
2084
|
-
}).strict()
|
|
2085
|
-
}).strict();
|
|
2086
|
-
|
|
2087
|
-
// src/runtime/controller-bridge.ts
|
|
2088
|
-
var AIRJAM_CONTROLLER_BRIDGE_REQUEST = "AIRJAM_CONTROLLER_BRIDGE_REQUEST";
|
|
2089
|
-
var AIRJAM_CONTROLLER_BRIDGE_ATTACH = "AIRJAM_CONTROLLER_BRIDGE_ATTACH";
|
|
2090
|
-
var AIRJAM_CONTROLLER_BRIDGE_EVENT = "AIRJAM_CONTROLLER_BRIDGE_EVENT";
|
|
2091
|
-
var AIRJAM_CONTROLLER_BRIDGE_EMIT = "AIRJAM_CONTROLLER_BRIDGE_EMIT";
|
|
2092
|
-
var AIRJAM_CONTROLLER_BRIDGE_CLOSE = "AIRJAM_CONTROLLER_BRIDGE_CLOSE";
|
|
2093
|
-
var AIRJAM_CONTROLLER_PRESENTATION_SYNC = "AIRJAM_CONTROLLER_PRESENTATION_SYNC";
|
|
2094
|
-
var AIRJAM_CONTROLLER_BRIDGE_RESPONSE = "AIRJAM_CONTROLLER_BRIDGE_RESPONSE";
|
|
2095
|
-
var controllerBridgeClientEvents = [
|
|
2096
|
-
"controller:input",
|
|
2097
|
-
"controller:action_rpc",
|
|
2098
|
-
"controller:state_sync_request",
|
|
2099
|
-
"controller:system",
|
|
2100
|
-
"controller:play_sound",
|
|
2101
|
-
"controller:updatePlayerProfile"
|
|
2102
|
-
];
|
|
2103
|
-
var controllerBridgeServerEvents = [
|
|
2104
|
-
"connect",
|
|
2105
|
-
"disconnect",
|
|
2106
|
-
"server:welcome",
|
|
2107
|
-
"server:controllerJoined",
|
|
2108
|
-
"server:controllerLeft",
|
|
2109
|
-
"server:state",
|
|
2110
|
-
"server:hostLeft",
|
|
2111
|
-
"server:error",
|
|
2112
|
-
"server:signal",
|
|
2113
|
-
"server:playSound",
|
|
2114
|
-
"server:playerUpdated",
|
|
2115
|
-
"airjam:state_sync"
|
|
2116
|
-
];
|
|
2117
|
-
var bridgeRequestSchema = import_zod13.z.object({
|
|
2118
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_BRIDGE_REQUEST),
|
|
2119
|
-
payload: import_zod13.z.object({
|
|
2120
|
-
handshake: v2HandshakeSchema,
|
|
2121
|
-
roomId: import_zod13.z.string().min(1),
|
|
2122
|
-
controllerId: import_zod13.z.string().min(1),
|
|
2123
|
-
arcadeSurface: arcadeSurfaceRuntimeIdentitySchema
|
|
2124
|
-
}).strict()
|
|
2125
|
-
}).strict();
|
|
2126
|
-
var bridgeAttachSchema = import_zod13.z.object({
|
|
2127
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_BRIDGE_ATTACH),
|
|
2128
|
-
payload: import_zod13.z.object({
|
|
2129
|
-
handshake: v2HandshakeSchema,
|
|
2130
|
-
snapshot: import_zod13.z.object({
|
|
2131
|
-
roomId: import_zod13.z.string().min(1),
|
|
2132
|
-
controllerId: import_zod13.z.string().min(1),
|
|
2133
|
-
connected: import_zod13.z.boolean(),
|
|
2134
|
-
socketId: import_zod13.z.string().optional(),
|
|
2135
|
-
player: import_zod13.z.unknown().optional(),
|
|
2136
|
-
players: import_zod13.z.array(import_zod13.z.unknown()).optional(),
|
|
2137
|
-
state: import_zod13.z.unknown().optional(),
|
|
2138
|
-
arcadeSurface: arcadeSurfaceRuntimeIdentitySchema
|
|
2139
|
-
}).strict()
|
|
2140
|
-
}).strict()
|
|
2141
|
-
}).strict();
|
|
2142
|
-
var bridgeEventSchema = import_zod13.z.object({
|
|
2143
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_BRIDGE_EVENT),
|
|
2144
|
-
payload: import_zod13.z.object({
|
|
2145
|
-
event: import_zod13.z.enum(controllerBridgeServerEvents),
|
|
2146
|
-
args: import_zod13.z.array(import_zod13.z.unknown()),
|
|
2147
|
-
requestId: import_zod13.z.string().min(1).optional()
|
|
2148
|
-
}).strict()
|
|
2149
|
-
}).strict();
|
|
2150
|
-
var bridgeEmitSchema = import_zod13.z.object({
|
|
2151
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_BRIDGE_EMIT),
|
|
2152
|
-
payload: import_zod13.z.object({
|
|
2153
|
-
event: import_zod13.z.enum(controllerBridgeClientEvents),
|
|
2154
|
-
args: import_zod13.z.array(import_zod13.z.unknown()),
|
|
2155
|
-
requestId: import_zod13.z.string().min(1).optional()
|
|
2156
|
-
}).strict()
|
|
2157
|
-
}).strict();
|
|
2158
|
-
var bridgeResponseSchema = import_zod13.z.object({
|
|
2159
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_BRIDGE_RESPONSE),
|
|
2160
|
-
payload: import_zod13.z.object({
|
|
2161
|
-
requestId: import_zod13.z.string().min(1),
|
|
2162
|
-
ack: import_zod13.z.unknown()
|
|
2163
|
-
}).strict()
|
|
2164
|
-
}).strict();
|
|
2165
|
-
var bridgeCloseSchema = import_zod13.z.object({
|
|
2166
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_BRIDGE_CLOSE),
|
|
2167
|
-
payload: import_zod13.z.object({
|
|
2168
|
-
reason: import_zod13.z.string().optional()
|
|
2169
|
-
}).strict()
|
|
2170
|
-
}).strict();
|
|
2171
|
-
var presentationSyncSchema = import_zod13.z.object({
|
|
2172
|
-
type: import_zod13.z.literal(AIRJAM_CONTROLLER_PRESENTATION_SYNC),
|
|
2173
|
-
payload: import_zod13.z.object({
|
|
2174
|
-
orientation: controllerOrientationSchema,
|
|
2175
|
-
arcadeSurface: arcadeSurfaceRuntimeIdentitySchema
|
|
2176
|
-
}).strict()
|
|
2177
|
-
}).strict();
|
|
2178
|
-
var createControllerPresentationSyncMessage = (payload) => ({
|
|
2179
|
-
type: AIRJAM_CONTROLLER_PRESENTATION_SYNC,
|
|
2180
|
-
payload
|
|
2181
|
-
});
|
|
2182
|
-
|
|
2183
|
-
// src/runtime/arcade-runtime-url.ts
|
|
2184
|
-
var parseOptionalArcadeSurfaceFromSearchParams = (params) => {
|
|
2185
|
-
const epochStr = params.get("aj_arcade_epoch");
|
|
2186
|
-
const kind = params.get("aj_arcade_kind");
|
|
2187
|
-
if (epochStr === null || kind !== "browser" && kind !== "game") {
|
|
2188
|
-
return void 0;
|
|
2189
|
-
}
|
|
2190
|
-
const epoch = Number(epochStr);
|
|
2191
|
-
if (!Number.isFinite(epoch) || epoch < 0 || !Number.isInteger(epoch)) {
|
|
2192
|
-
return void 0;
|
|
3174
|
+
role: "img",
|
|
3175
|
+
"aria-label": player.label,
|
|
3176
|
+
className: cn(
|
|
3177
|
+
"bg-secondary/40 flex items-center justify-center font-semibold uppercase",
|
|
3178
|
+
initialsSizeClasses[size],
|
|
3179
|
+
shellClassName
|
|
3180
|
+
),
|
|
3181
|
+
style: {
|
|
3182
|
+
borderColor: accentColor,
|
|
3183
|
+
color: accentColor,
|
|
3184
|
+
boxShadow: shadowStyles[size]
|
|
3185
|
+
},
|
|
3186
|
+
children: initials ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: initials }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.UserRound, { "aria-hidden": "true", className: iconSizeClasses[size] })
|
|
3187
|
+
}
|
|
3188
|
+
);
|
|
2193
3189
|
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
3190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3191
|
+
"img",
|
|
3192
|
+
{
|
|
3193
|
+
src,
|
|
3194
|
+
alt: player.label,
|
|
3195
|
+
onError: () => setFailedSrc(src),
|
|
3196
|
+
className: cn("bg-secondary/30", shellClassName),
|
|
3197
|
+
style: {
|
|
3198
|
+
borderColor: accentColor,
|
|
3199
|
+
boxShadow: shadowStyles[size]
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
);
|
|
3203
|
+
};
|
|
3204
|
+
var initialsSizeClasses = {
|
|
3205
|
+
sm: "text-xs",
|
|
3206
|
+
md: "text-sm",
|
|
3207
|
+
lg: "text-base"
|
|
2197
3208
|
};
|
|
3209
|
+
var playerInitials = (label) => label.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((word) => Array.from(word)[0] ?? "").join("");
|
|
2198
3210
|
|
|
2199
|
-
// src/
|
|
2200
|
-
var
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
3211
|
+
// src/components/player-avatar-strip.tsx
|
|
3212
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3213
|
+
var overflowSizeClasses = {
|
|
3214
|
+
sm: "h-9 w-9 min-h-9 min-w-9 text-[0.625rem]",
|
|
3215
|
+
md: "h-12 w-12 min-h-12 min-w-12 text-[11px]",
|
|
3216
|
+
lg: "h-16 w-16 min-h-16 min-w-16 text-xs"
|
|
3217
|
+
};
|
|
3218
|
+
var PlayerAvatarStrip = ({
|
|
3219
|
+
players,
|
|
3220
|
+
maxVisible = 4,
|
|
3221
|
+
size = "sm",
|
|
3222
|
+
className,
|
|
3223
|
+
avatarClassName = "",
|
|
3224
|
+
overflowBadgeClassName = ""
|
|
3225
|
+
}) => {
|
|
3226
|
+
const visible = players.slice(0, maxVisible);
|
|
3227
|
+
const overflow = Math.max(0, players.length - maxVisible);
|
|
3228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("flex items-center -space-x-2", className), children: [
|
|
3229
|
+
visible.map((player) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3230
|
+
PlayerAvatar,
|
|
3231
|
+
{
|
|
3232
|
+
player,
|
|
3233
|
+
size,
|
|
3234
|
+
className: avatarClassName
|
|
3235
|
+
},
|
|
3236
|
+
player.id
|
|
3237
|
+
)),
|
|
3238
|
+
overflow > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3239
|
+
"div",
|
|
3240
|
+
{
|
|
3241
|
+
className: cn(
|
|
3242
|
+
"bg-secondary/50 text-foreground flex shrink-0 items-center justify-center rounded-full border-2 border-[hsl(var(--border))] font-semibold tabular-nums shadow-sm",
|
|
3243
|
+
overflowSizeClasses[size],
|
|
3244
|
+
overflowBadgeClassName
|
|
3245
|
+
),
|
|
3246
|
+
"aria-label": `${overflow} more players`,
|
|
3247
|
+
children: [
|
|
3248
|
+
"+",
|
|
3249
|
+
overflow
|
|
3250
|
+
]
|
|
3251
|
+
}
|
|
3252
|
+
)
|
|
3253
|
+
] });
|
|
3254
|
+
};
|
|
3255
|
+
|
|
3256
|
+
// src/components/runtime-shell-header.tsx
|
|
3257
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3258
|
+
var RuntimeShellHeader = ({
|
|
3259
|
+
connectionStatus,
|
|
3260
|
+
leftSlot,
|
|
3261
|
+
rightSlot,
|
|
3262
|
+
className
|
|
3263
|
+
}) => {
|
|
3264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3265
|
+
"header",
|
|
3266
|
+
{
|
|
3267
|
+
className: cn(
|
|
3268
|
+
"flex min-h-16 items-center gap-2.5 px-3 py-2.5 sm:px-4",
|
|
3269
|
+
shellHeaderClassName,
|
|
3270
|
+
className
|
|
3271
|
+
),
|
|
3272
|
+
children: [
|
|
3273
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "min-w-0 flex-1", children: leftSlot }),
|
|
3274
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex shrink-0 items-center gap-2.5", children: [
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ConnectionStatusPill, { status: connectionStatus }),
|
|
3276
|
+
rightSlot ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex items-center justify-end", children: rightSlot }) : null
|
|
3277
|
+
] })
|
|
3278
|
+
]
|
|
3279
|
+
}
|
|
3280
|
+
);
|
|
2231
3281
|
};
|
|
2232
3282
|
|
|
3283
|
+
// src/components/surface-viewport.tsx
|
|
3284
|
+
var import_react11 = require("react");
|
|
3285
|
+
|
|
2233
3286
|
// src/runtime/controller-presentation.ts
|
|
3287
|
+
var import_zod27 = require("zod");
|
|
3288
|
+
var AIRJAM_CONTROLLER_PRESENTATION_SYNC = "AIRJAM_CONTROLLER_PRESENTATION_SYNC";
|
|
3289
|
+
var presentationSyncSchema = import_zod27.z.object({
|
|
3290
|
+
type: import_zod27.z.literal(AIRJAM_CONTROLLER_PRESENTATION_SYNC),
|
|
3291
|
+
payload: withControllerBridgeContext({
|
|
3292
|
+
orientation: controllerOrientationSchema
|
|
3293
|
+
})
|
|
3294
|
+
}).strict();
|
|
2234
3295
|
var publishEmbeddedControllerPresentation = (orientation) => {
|
|
2235
|
-
if (typeof window === "undefined" || window.parent === window) {
|
|
2236
|
-
return;
|
|
2237
|
-
}
|
|
2238
3296
|
const runtimeParams = readEmbeddedControllerRuntimeParams();
|
|
2239
|
-
if (!runtimeParams)
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
runtimeParams.topology.embedParentOrigin ?? "*"
|
|
2248
|
-
);
|
|
3297
|
+
if (!runtimeParams) return;
|
|
3298
|
+
const parent = embeddedRuntimeParent(runtimeParams.topology);
|
|
3299
|
+
if (!parent) return;
|
|
3300
|
+
const message = {
|
|
3301
|
+
type: AIRJAM_CONTROLLER_PRESENTATION_SYNC,
|
|
3302
|
+
payload: { orientation, ...controllerBridgeContext(runtimeParams) }
|
|
3303
|
+
};
|
|
3304
|
+
parent.window.postMessage(message, parent.origin);
|
|
2249
3305
|
};
|
|
2250
3306
|
|
|
2251
3307
|
// src/components/surface-orientation-layout.ts
|
|
@@ -2472,7 +3528,7 @@ var createSurfaceViewportScaleStyle = ({
|
|
|
2472
3528
|
};
|
|
2473
3529
|
|
|
2474
3530
|
// src/components/surface-viewport.tsx
|
|
2475
|
-
var
|
|
3531
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2476
3532
|
var readLayoutViewportSize = () => {
|
|
2477
3533
|
if (typeof window === "undefined") {
|
|
2478
3534
|
return { width: 0, height: 0 };
|
|
@@ -2545,7 +3601,7 @@ var getOrientation = ({
|
|
|
2545
3601
|
};
|
|
2546
3602
|
var SurfaceViewport = ({
|
|
2547
3603
|
children,
|
|
2548
|
-
orientation,
|
|
3604
|
+
orientation: requestedOrientation,
|
|
2549
3605
|
lockOnGesture = true,
|
|
2550
3606
|
className,
|
|
2551
3607
|
contentClassName,
|
|
@@ -2556,10 +3612,17 @@ var SurfaceViewport = ({
|
|
|
2556
3612
|
minScale,
|
|
2557
3613
|
maxScale
|
|
2558
3614
|
}) => {
|
|
2559
|
-
const [viewport, setViewport] = (0, import_react9.useState)(null);
|
|
2560
|
-
const viewportRef = (0, import_react9.useRef)(null);
|
|
2561
3615
|
const sessionScope = useSessionScope();
|
|
2562
|
-
(0,
|
|
3616
|
+
const declaredOrientation = (0, import_react11.useContext)(fixedControllerOrientationContext);
|
|
3617
|
+
const fixedOrientation = sessionScope === "controller" ? declaredOrientation : null;
|
|
3618
|
+
if (fixedOrientation && requestedOrientation && requestedOrientation !== fixedOrientation)
|
|
3619
|
+
throw new Error(
|
|
3620
|
+
"SurfaceViewport orientation conflicts with inputModalities: ['joystick'] in airjam.config: joystick games always use landscape; omit orientation."
|
|
3621
|
+
);
|
|
3622
|
+
const orientation = fixedOrientation ?? requestedOrientation;
|
|
3623
|
+
const [viewport, setViewport] = (0, import_react11.useState)(null);
|
|
3624
|
+
const viewportRef = (0, import_react11.useRef)(null);
|
|
3625
|
+
(0, import_react11.useEffect)(() => {
|
|
2563
3626
|
if (typeof window === "undefined") {
|
|
2564
3627
|
return;
|
|
2565
3628
|
}
|
|
@@ -2581,7 +3644,7 @@ var SurfaceViewport = ({
|
|
|
2581
3644
|
window.removeEventListener("orientationchange", updateViewport);
|
|
2582
3645
|
};
|
|
2583
3646
|
}, []);
|
|
2584
|
-
(0,
|
|
3647
|
+
(0, import_react11.useEffect)(() => {
|
|
2585
3648
|
if (typeof window === "undefined" || !orientation || !lockOnGesture) {
|
|
2586
3649
|
return;
|
|
2587
3650
|
}
|
|
@@ -2605,7 +3668,7 @@ var SurfaceViewport = ({
|
|
|
2605
3668
|
window.removeEventListener("pointerdown", onFirstGesture, true);
|
|
2606
3669
|
};
|
|
2607
3670
|
}, [orientation, lockOnGesture]);
|
|
2608
|
-
(0,
|
|
3671
|
+
(0, import_react11.useEffect)(() => {
|
|
2609
3672
|
if (!orientation || sessionScope !== "controller") {
|
|
2610
3673
|
return;
|
|
2611
3674
|
}
|
|
@@ -2614,11 +3677,11 @@ var SurfaceViewport = ({
|
|
|
2614
3677
|
const currentOrientation = viewport ? getOrientation(viewport) : "portrait";
|
|
2615
3678
|
const effectiveOrientation = orientation ?? currentOrientation;
|
|
2616
3679
|
const needsRotation = orientation ? currentOrientation !== orientation : false;
|
|
2617
|
-
const shellStyle = (0,
|
|
3680
|
+
const shellStyle = (0, import_react11.useMemo)(
|
|
2618
3681
|
() => orientation ? resolveForcedOrientationFrameStyle(orientation, needsRotation) : resolveForcedOrientationFrameStyle(effectiveOrientation, false),
|
|
2619
3682
|
[effectiveOrientation, needsRotation, orientation]
|
|
2620
3683
|
);
|
|
2621
|
-
const availableSize = (0,
|
|
3684
|
+
const availableSize = (0, import_react11.useMemo)(
|
|
2622
3685
|
() => resolveSurfaceViewportAvailableSize({
|
|
2623
3686
|
safeViewportWidth: viewport?.width ?? 0,
|
|
2624
3687
|
safeViewportHeight: viewport?.height ?? 0,
|
|
@@ -2627,7 +3690,7 @@ var SurfaceViewport = ({
|
|
|
2627
3690
|
}),
|
|
2628
3691
|
[needsRotation, orientation, viewport]
|
|
2629
3692
|
);
|
|
2630
|
-
const referenceSize = (0,
|
|
3693
|
+
const referenceSize = (0, import_react11.useMemo)(
|
|
2631
3694
|
() => resolveSurfaceViewportReferenceSize({
|
|
2632
3695
|
sessionScope,
|
|
2633
3696
|
designWidth,
|
|
@@ -2645,7 +3708,7 @@ var SurfaceViewport = ({
|
|
|
2645
3708
|
sessionScope
|
|
2646
3709
|
]
|
|
2647
3710
|
);
|
|
2648
|
-
const scale = (0,
|
|
3711
|
+
const scale = (0, import_react11.useMemo)(() => {
|
|
2649
3712
|
const scaleMode = sessionScope === "controller" ? effectiveOrientation === "portrait" ? "width" : "height" : "fit";
|
|
2650
3713
|
return resolveSurfaceViewportScale({
|
|
2651
3714
|
availableWidth: availableSize.width,
|
|
@@ -2668,7 +3731,7 @@ var SurfaceViewport = ({
|
|
|
2668
3731
|
sessionScope,
|
|
2669
3732
|
uiScaleMultiplier
|
|
2670
3733
|
]);
|
|
2671
|
-
return /* @__PURE__ */ (0,
|
|
3734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2672
3735
|
"div",
|
|
2673
3736
|
{
|
|
2674
3737
|
className: cn("fixed inset-0 overflow-hidden", className),
|
|
@@ -2676,7 +3739,7 @@ var SurfaceViewport = ({
|
|
|
2676
3739
|
...createSurfaceViewportOuterStyle(),
|
|
2677
3740
|
...style
|
|
2678
3741
|
},
|
|
2679
|
-
children: /* @__PURE__ */ (0,
|
|
3742
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: shellStyle, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2680
3743
|
"div",
|
|
2681
3744
|
{
|
|
2682
3745
|
className: cn("h-full w-full overflow-hidden", contentClassName),
|
|
@@ -2686,7 +3749,7 @@ var SurfaceViewport = ({
|
|
|
2686
3749
|
referenceWidth: referenceSize.width,
|
|
2687
3750
|
referenceHeight: referenceSize.height
|
|
2688
3751
|
}),
|
|
2689
|
-
children: /* @__PURE__ */ (0,
|
|
3752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-full w-full", "data-airjam-surface-root": "true", children })
|
|
2690
3753
|
}
|
|
2691
3754
|
) })
|
|
2692
3755
|
}
|
|
@@ -2696,7 +3759,7 @@ var SurfaceViewport = ({
|
|
|
2696
3759
|
// src/components/ui/slider.tsx
|
|
2697
3760
|
var SliderPrimitive = __toESM(require("@radix-ui/react-slider"), 1);
|
|
2698
3761
|
var React = __toESM(require("react"), 1);
|
|
2699
|
-
var
|
|
3762
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2700
3763
|
function Slider({
|
|
2701
3764
|
className,
|
|
2702
3765
|
defaultValue,
|
|
@@ -2709,7 +3772,7 @@ function Slider({
|
|
|
2709
3772
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
2710
3773
|
[value, defaultValue, min, max]
|
|
2711
3774
|
);
|
|
2712
|
-
return /* @__PURE__ */ (0,
|
|
3775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2713
3776
|
SliderPrimitive.Root,
|
|
2714
3777
|
{
|
|
2715
3778
|
"data-slot": "slider",
|
|
@@ -2723,14 +3786,14 @@ function Slider({
|
|
|
2723
3786
|
),
|
|
2724
3787
|
...props,
|
|
2725
3788
|
children: [
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
3789
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2727
3790
|
SliderPrimitive.Track,
|
|
2728
3791
|
{
|
|
2729
3792
|
"data-slot": "slider-track",
|
|
2730
3793
|
className: cn(
|
|
2731
3794
|
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
2732
3795
|
),
|
|
2733
|
-
children: /* @__PURE__ */ (0,
|
|
3796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2734
3797
|
SliderPrimitive.Range,
|
|
2735
3798
|
{
|
|
2736
3799
|
"data-slot": "slider-range",
|
|
@@ -2741,7 +3804,7 @@ function Slider({
|
|
|
2741
3804
|
)
|
|
2742
3805
|
}
|
|
2743
3806
|
),
|
|
2744
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
3807
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2745
3808
|
SliderPrimitive.Thumb,
|
|
2746
3809
|
{
|
|
2747
3810
|
"data-slot": "slider-thumb",
|
|
@@ -2758,9 +3821,220 @@ function Slider({
|
|
|
2758
3821
|
var import_lucide_react5 = require("lucide-react");
|
|
2759
3822
|
|
|
2760
3823
|
// src/settings/platform-settings-runtime.tsx
|
|
2761
|
-
var
|
|
2762
|
-
|
|
2763
|
-
|
|
3824
|
+
var import_react12 = require("react");
|
|
3825
|
+
|
|
3826
|
+
// src/runtime/iframe-bridge.ts
|
|
3827
|
+
var import_zod30 = require("zod");
|
|
3828
|
+
|
|
3829
|
+
// src/contracts/v2/bridge.ts
|
|
3830
|
+
var import_zod28 = require("zod");
|
|
3831
|
+
var roomCodeSchema2 = import_zod28.z.string().trim().min(4).max(8).regex(/^[A-Z0-9]+$/, {
|
|
3832
|
+
message: "room code must contain only A-Z or 0-9"
|
|
3833
|
+
});
|
|
3834
|
+
var runtimeStateSchema2 = import_zod28.z.enum(["paused", "playing"]);
|
|
3835
|
+
var playerProfileSchema2 = import_zod28.z.object({
|
|
3836
|
+
id: import_zod28.z.string().min(1),
|
|
3837
|
+
label: import_zod28.z.string().min(1),
|
|
3838
|
+
color: import_zod28.z.string().optional(),
|
|
3839
|
+
avatarId: import_zod28.z.string().optional()
|
|
3840
|
+
}).strict();
|
|
3841
|
+
var inputFrameEntrySchema = import_zod28.z.object({
|
|
3842
|
+
controllerId: import_zod28.z.string().min(1),
|
|
3843
|
+
input: import_zod28.z.record(import_zod28.z.string(), import_zod28.z.unknown())
|
|
3844
|
+
}).strict();
|
|
3845
|
+
var V2_BRIDGE_PARENT_TO_GAME_TYPES = [
|
|
3846
|
+
"BOOTSTRAP",
|
|
3847
|
+
"PLAYERS_UPDATE",
|
|
3848
|
+
"RUNTIME_STATE_UPDATE",
|
|
3849
|
+
"INPUT_FRAME",
|
|
3850
|
+
"PAUSE",
|
|
3851
|
+
"RESUME",
|
|
3852
|
+
"SHUTDOWN"
|
|
3853
|
+
];
|
|
3854
|
+
var V2_BRIDGE_GAME_TO_PARENT_TYPES = [
|
|
3855
|
+
"READY",
|
|
3856
|
+
"STATE_PATCH",
|
|
3857
|
+
"SIGNAL",
|
|
3858
|
+
"ERROR",
|
|
3859
|
+
"METRICS"
|
|
3860
|
+
];
|
|
3861
|
+
var allMessageTypes = [
|
|
3862
|
+
...V2_BRIDGE_PARENT_TO_GAME_TYPES,
|
|
3863
|
+
...V2_BRIDGE_GAME_TO_PARENT_TYPES
|
|
3864
|
+
];
|
|
3865
|
+
var knownBridgeMessageTypeSet = new Set(allMessageTypes);
|
|
3866
|
+
var bootstrapMessageSchema = import_zod28.z.object({
|
|
3867
|
+
type: import_zod28.z.literal("BOOTSTRAP"),
|
|
3868
|
+
payload: import_zod28.z.object({
|
|
3869
|
+
roomId: roomCodeSchema2,
|
|
3870
|
+
players: import_zod28.z.array(playerProfileSchema2),
|
|
3871
|
+
state: import_zod28.z.object({
|
|
3872
|
+
runtimeState: runtimeStateSchema2,
|
|
3873
|
+
message: import_zod28.z.string().optional()
|
|
3874
|
+
}).strict(),
|
|
3875
|
+
capabilities: import_zod28.z.record(import_zod28.z.string(), import_zod28.z.boolean()).default({})
|
|
3876
|
+
}).strict()
|
|
3877
|
+
}).strict();
|
|
3878
|
+
var playersUpdateMessageSchema = import_zod28.z.object({
|
|
3879
|
+
type: import_zod28.z.literal("PLAYERS_UPDATE"),
|
|
3880
|
+
payload: import_zod28.z.object({
|
|
3881
|
+
players: import_zod28.z.array(playerProfileSchema2)
|
|
3882
|
+
}).strict()
|
|
3883
|
+
}).strict();
|
|
3884
|
+
var runtimeStateUpdateMessageSchema = import_zod28.z.object({
|
|
3885
|
+
type: import_zod28.z.literal("RUNTIME_STATE_UPDATE"),
|
|
3886
|
+
payload: import_zod28.z.object({
|
|
3887
|
+
runtimeState: runtimeStateSchema2,
|
|
3888
|
+
message: import_zod28.z.string().optional()
|
|
3889
|
+
}).strict()
|
|
3890
|
+
}).strict();
|
|
3891
|
+
var inputFrameMessageSchema = import_zod28.z.object({
|
|
3892
|
+
type: import_zod28.z.literal("INPUT_FRAME"),
|
|
3893
|
+
payload: import_zod28.z.object({
|
|
3894
|
+
frameId: import_zod28.z.number().int().nonnegative(),
|
|
3895
|
+
inputs: import_zod28.z.array(inputFrameEntrySchema)
|
|
3896
|
+
}).strict()
|
|
3897
|
+
}).strict();
|
|
3898
|
+
var pauseMessageSchema = import_zod28.z.object({
|
|
3899
|
+
type: import_zod28.z.literal("PAUSE"),
|
|
3900
|
+
payload: import_zod28.z.object({
|
|
3901
|
+
reason: import_zod28.z.string().optional()
|
|
3902
|
+
}).strict()
|
|
3903
|
+
}).strict();
|
|
3904
|
+
var resumeMessageSchema = import_zod28.z.object({
|
|
3905
|
+
type: import_zod28.z.literal("RESUME"),
|
|
3906
|
+
payload: import_zod28.z.object({}).strict()
|
|
3907
|
+
}).strict();
|
|
3908
|
+
var shutdownMessageSchema = import_zod28.z.object({
|
|
3909
|
+
type: import_zod28.z.literal("SHUTDOWN"),
|
|
3910
|
+
payload: import_zod28.z.object({
|
|
3911
|
+
reason: import_zod28.z.string().min(1)
|
|
3912
|
+
}).strict()
|
|
3913
|
+
}).strict();
|
|
3914
|
+
var readyMessageSchema = import_zod28.z.object({
|
|
3915
|
+
type: import_zod28.z.literal("READY"),
|
|
3916
|
+
payload: import_zod28.z.object({
|
|
3917
|
+
readyAtMs: import_zod28.z.number().int().nonnegative()
|
|
3918
|
+
}).strict()
|
|
3919
|
+
}).strict();
|
|
3920
|
+
var statePatchMessageSchema = import_zod28.z.object({
|
|
3921
|
+
type: import_zod28.z.literal("STATE_PATCH"),
|
|
3922
|
+
payload: import_zod28.z.object({
|
|
3923
|
+
patch: import_zod28.z.record(import_zod28.z.string(), import_zod28.z.unknown())
|
|
3924
|
+
}).strict()
|
|
3925
|
+
}).strict();
|
|
3926
|
+
var signalMessageSchema = import_zod28.z.object({
|
|
3927
|
+
type: import_zod28.z.literal("SIGNAL"),
|
|
3928
|
+
payload: import_zod28.z.object({
|
|
3929
|
+
signalType: import_zod28.z.string().min(1),
|
|
3930
|
+
targetId: import_zod28.z.string().min(1).optional(),
|
|
3931
|
+
data: import_zod28.z.record(import_zod28.z.string(), import_zod28.z.unknown())
|
|
3932
|
+
}).strict()
|
|
3933
|
+
}).strict();
|
|
3934
|
+
var errorMessageSchema = import_zod28.z.object({
|
|
3935
|
+
type: import_zod28.z.literal("ERROR"),
|
|
3936
|
+
payload: import_zod28.z.object({
|
|
3937
|
+
code: import_zod28.z.string().min(1),
|
|
3938
|
+
message: import_zod28.z.string().min(1),
|
|
3939
|
+
details: import_zod28.z.record(import_zod28.z.string(), import_zod28.z.unknown()).optional()
|
|
3940
|
+
}).strict()
|
|
3941
|
+
}).strict();
|
|
3942
|
+
var metricsMessageSchema = import_zod28.z.object({
|
|
3943
|
+
type: import_zod28.z.literal("METRICS"),
|
|
3944
|
+
payload: import_zod28.z.object({
|
|
3945
|
+
values: import_zod28.z.record(import_zod28.z.string(), import_zod28.z.number())
|
|
3946
|
+
}).strict()
|
|
3947
|
+
}).strict();
|
|
3948
|
+
var v2BridgeParentToGameMessageSchema = import_zod28.z.union([
|
|
3949
|
+
bootstrapMessageSchema,
|
|
3950
|
+
playersUpdateMessageSchema,
|
|
3951
|
+
runtimeStateUpdateMessageSchema,
|
|
3952
|
+
inputFrameMessageSchema,
|
|
3953
|
+
pauseMessageSchema,
|
|
3954
|
+
resumeMessageSchema,
|
|
3955
|
+
shutdownMessageSchema
|
|
3956
|
+
]);
|
|
3957
|
+
var v2BridgeGameToParentMessageSchema = import_zod28.z.union([
|
|
3958
|
+
readyMessageSchema,
|
|
3959
|
+
statePatchMessageSchema,
|
|
3960
|
+
signalMessageSchema,
|
|
3961
|
+
errorMessageSchema,
|
|
3962
|
+
metricsMessageSchema
|
|
3963
|
+
]);
|
|
3964
|
+
var v2BridgeMessageSchema = import_zod28.z.union([
|
|
3965
|
+
v2BridgeParentToGameMessageSchema,
|
|
3966
|
+
v2BridgeGameToParentMessageSchema
|
|
3967
|
+
]);
|
|
3968
|
+
|
|
3969
|
+
// src/contracts/v2/handshake.ts
|
|
3970
|
+
var import_zod29 = require("zod");
|
|
3971
|
+
var AIR_JAM_PROTOCOL_V2 = "2";
|
|
3972
|
+
var semanticVersionPattern = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
3973
|
+
var v2ProtocolVersionSchema = import_zod29.z.literal(AIR_JAM_PROTOCOL_V2);
|
|
3974
|
+
var runtimeKindSchema = import_zod29.z.enum([
|
|
3975
|
+
"standalone-host",
|
|
3976
|
+
"standalone-controller",
|
|
3977
|
+
"arcade-runtime",
|
|
3978
|
+
"arcade-game-iframe",
|
|
3979
|
+
"arcade-host-runtime",
|
|
3980
|
+
"arcade-host-iframe",
|
|
3981
|
+
"arcade-controller-runtime",
|
|
3982
|
+
"arcade-controller-iframe"
|
|
3983
|
+
]);
|
|
3984
|
+
var capabilityFlagsSchema = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.boolean());
|
|
3985
|
+
var sdkVersionSchema = import_zod29.z.string().regex(
|
|
3986
|
+
semanticVersionPattern,
|
|
3987
|
+
"sdkVersion must use semantic version format (for example 1.2.3)"
|
|
3988
|
+
);
|
|
3989
|
+
var v2HandshakeSchema = import_zod29.z.object({
|
|
3990
|
+
protocolVersion: v2ProtocolVersionSchema,
|
|
3991
|
+
sdkVersion: sdkVersionSchema,
|
|
3992
|
+
runtimeKind: runtimeKindSchema,
|
|
3993
|
+
capabilityFlags: capabilityFlagsSchema.default({})
|
|
3994
|
+
}).strict();
|
|
3995
|
+
|
|
3996
|
+
// src/runtime/iframe-bridge.ts
|
|
3997
|
+
var AIRJAM_BRIDGE_INIT = "AIRJAM_BRIDGE_INIT";
|
|
3998
|
+
var AIRJAM_SETTINGS_SYNC = "AIRJAM_SETTINGS_SYNC";
|
|
3999
|
+
var AIRJAM_SETTINGS_READY = "AIRJAM_SETTINGS_READY";
|
|
4000
|
+
var airJamSettingsSyncSchema = import_zod30.z.object({
|
|
4001
|
+
type: import_zod30.z.literal(AIRJAM_SETTINGS_SYNC),
|
|
4002
|
+
payload: import_zod30.z.object({
|
|
4003
|
+
settings: import_zod30.z.object({
|
|
4004
|
+
audio: import_zod30.z.object({
|
|
4005
|
+
masterVolume: import_zod30.z.number(),
|
|
4006
|
+
musicVolume: import_zod30.z.number(),
|
|
4007
|
+
sfxVolume: import_zod30.z.number()
|
|
4008
|
+
}).strict(),
|
|
4009
|
+
accessibility: import_zod30.z.object({
|
|
4010
|
+
reducedMotion: import_zod30.z.boolean(),
|
|
4011
|
+
highContrast: import_zod30.z.boolean()
|
|
4012
|
+
}).strict(),
|
|
4013
|
+
feedback: import_zod30.z.object({
|
|
4014
|
+
hapticsEnabled: import_zod30.z.boolean()
|
|
4015
|
+
}).strict(),
|
|
4016
|
+
previewControllers: import_zod30.z.object({
|
|
4017
|
+
activeOpacity: import_zod30.z.number()
|
|
4018
|
+
}).strict()
|
|
4019
|
+
}).strict()
|
|
4020
|
+
}).strict()
|
|
4021
|
+
}).strict();
|
|
4022
|
+
var airJamBridgeInitSchema = import_zod30.z.object({
|
|
4023
|
+
type: import_zod30.z.literal(AIRJAM_BRIDGE_INIT),
|
|
4024
|
+
payload: import_zod30.z.object({
|
|
4025
|
+
handshake: v2HandshakeSchema
|
|
4026
|
+
}).strict()
|
|
4027
|
+
}).strict();
|
|
4028
|
+
var airJamSettingsReadySchema = import_zod30.z.object({
|
|
4029
|
+
type: import_zod30.z.literal(AIRJAM_SETTINGS_READY),
|
|
4030
|
+
payload: import_zod30.z.object({
|
|
4031
|
+
ready: import_zod30.z.literal(true)
|
|
4032
|
+
}).strict()
|
|
4033
|
+
}).strict();
|
|
4034
|
+
|
|
4035
|
+
// src/settings/platform-settings-runtime.tsx
|
|
4036
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4037
|
+
var platformSettingsContext = (0, import_react12.createContext)(null);
|
|
2764
4038
|
var createDefaultContextValue = () => ({
|
|
2765
4039
|
mode: "default",
|
|
2766
4040
|
status: "ready",
|
|
@@ -2777,10 +4051,10 @@ var createDefaultContextValue = () => ({
|
|
|
2777
4051
|
}
|
|
2778
4052
|
});
|
|
2779
4053
|
function usePlatformAudioSettings() {
|
|
2780
|
-
const context = (0,
|
|
4054
|
+
const context = (0, import_react12.useContext)(platformSettingsContext) ?? createDefaultContextValue();
|
|
2781
4055
|
const { audio } = context.settings;
|
|
2782
4056
|
const isReadOnly = context.mode !== "owner";
|
|
2783
|
-
const setAudioSetting = (0,
|
|
4057
|
+
const setAudioSetting = (0, import_react12.useCallback)(
|
|
2784
4058
|
(patch) => {
|
|
2785
4059
|
if (context.mode !== "owner") {
|
|
2786
4060
|
throw new Error(
|
|
@@ -2802,12 +4076,12 @@ function usePlatformAudioSettings() {
|
|
|
2802
4076
|
}
|
|
2803
4077
|
|
|
2804
4078
|
// src/components/volume-controls.tsx
|
|
2805
|
-
var
|
|
4079
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2806
4080
|
function VolumeControls(props) {
|
|
2807
4081
|
if (props.values) {
|
|
2808
|
-
return /* @__PURE__ */ (0,
|
|
4082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ControlledVolumeControls, { ...props });
|
|
2809
4083
|
}
|
|
2810
|
-
return /* @__PURE__ */ (0,
|
|
4084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OwnedVolumeControls, { ...props });
|
|
2811
4085
|
}
|
|
2812
4086
|
function OwnedVolumeControls({ className, compact }) {
|
|
2813
4087
|
const {
|
|
@@ -2818,7 +4092,7 @@ function OwnedVolumeControls({ className, compact }) {
|
|
|
2818
4092
|
setMusicVolume,
|
|
2819
4093
|
setSfxVolume
|
|
2820
4094
|
} = usePlatformAudioSettings();
|
|
2821
|
-
return /* @__PURE__ */ (0,
|
|
4095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2822
4096
|
ControlledVolumeControls,
|
|
2823
4097
|
{
|
|
2824
4098
|
className,
|
|
@@ -2844,20 +4118,20 @@ function ControlledVolumeControls({
|
|
|
2844
4118
|
throw new Error("ControlledVolumeControls requires values");
|
|
2845
4119
|
}
|
|
2846
4120
|
const { masterVolume, musicVolume, sfxVolume } = values;
|
|
2847
|
-
return /* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2849
|
-
/* @__PURE__ */ (0,
|
|
2850
|
-
/* @__PURE__ */ (0,
|
|
4121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("flex flex-col gap-3", compact && "gap-1", className), children: [
|
|
4122
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.Volume2, { className: "text-muted-foreground h-4 w-4" }),
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-sm font-medium", children: "Volume" })
|
|
2851
4125
|
] }),
|
|
2852
|
-
/* @__PURE__ */ (0,
|
|
2853
|
-
/* @__PURE__ */ (0,
|
|
2854
|
-
/* @__PURE__ */ (0,
|
|
2855
|
-
/* @__PURE__ */ (0,
|
|
4126
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1.5", children: [
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4128
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground text-xs", children: "Master" }),
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
2856
4130
|
Math.round(masterVolume * 100),
|
|
2857
4131
|
"%"
|
|
2858
4132
|
] })
|
|
2859
4133
|
] }),
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
4134
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2861
4135
|
Slider,
|
|
2862
4136
|
{
|
|
2863
4137
|
"data-testid": "platform-settings-master-volume",
|
|
@@ -2872,18 +4146,18 @@ function ControlledVolumeControls({
|
|
|
2872
4146
|
}
|
|
2873
4147
|
)
|
|
2874
4148
|
] }),
|
|
2875
|
-
/* @__PURE__ */ (0,
|
|
2876
|
-
/* @__PURE__ */ (0,
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
4149
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1.5", children: [
|
|
4150
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.Music, { className: "text-muted-foreground h-3 w-3" }),
|
|
4153
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground text-xs", children: "Music" })
|
|
2880
4154
|
] }),
|
|
2881
|
-
/* @__PURE__ */ (0,
|
|
4155
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
2882
4156
|
Math.round(musicVolume * 100),
|
|
2883
4157
|
"%"
|
|
2884
4158
|
] })
|
|
2885
4159
|
] }),
|
|
2886
|
-
/* @__PURE__ */ (0,
|
|
4160
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2887
4161
|
Slider,
|
|
2888
4162
|
{
|
|
2889
4163
|
"data-testid": "platform-settings-music-volume",
|
|
@@ -2898,18 +4172,18 @@ function ControlledVolumeControls({
|
|
|
2898
4172
|
}
|
|
2899
4173
|
)
|
|
2900
4174
|
] }),
|
|
2901
|
-
/* @__PURE__ */ (0,
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
2905
|
-
/* @__PURE__ */ (0,
|
|
4175
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1.5", children: [
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4177
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.Headphones, { className: "text-muted-foreground h-3 w-3" }),
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "text-muted-foreground text-xs", children: "SFX" })
|
|
2906
4180
|
] }),
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
4181
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
2908
4182
|
Math.round(sfxVolume * 100),
|
|
2909
4183
|
"%"
|
|
2910
4184
|
] })
|
|
2911
4185
|
] }),
|
|
2912
|
-
/* @__PURE__ */ (0,
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2913
4187
|
Slider,
|
|
2914
4188
|
{
|
|
2915
4189
|
"data-testid": "platform-settings-sfx-volume",
|
|
@@ -2985,7 +4259,7 @@ var useControllerShellStatus = ({
|
|
|
2985
4259
|
};
|
|
2986
4260
|
|
|
2987
4261
|
// src/hooks/use-host-join-controls.ts
|
|
2988
|
-
var
|
|
4262
|
+
var import_react13 = require("react");
|
|
2989
4263
|
var copyTextToClipboard = async (text) => {
|
|
2990
4264
|
if (!text) {
|
|
2991
4265
|
return false;
|
|
@@ -3020,17 +4294,17 @@ var useHostJoinControls = ({
|
|
|
3020
4294
|
onStartMatch,
|
|
3021
4295
|
copiedDurationMs = 1800
|
|
3022
4296
|
}) => {
|
|
3023
|
-
const [copied, setCopied] = (0,
|
|
3024
|
-
const [joinQrVisible, setJoinQrVisible] = (0,
|
|
3025
|
-
const resetTimerRef = (0,
|
|
3026
|
-
const joinUrlValue = (0,
|
|
4297
|
+
const [copied, setCopied] = (0, import_react13.useState)(false);
|
|
4298
|
+
const [joinQrVisible, setJoinQrVisible] = (0, import_react13.useState)(false);
|
|
4299
|
+
const resetTimerRef = (0, import_react13.useRef)(null);
|
|
4300
|
+
const joinUrlValue = (0, import_react13.useMemo)(() => joinUrl ?? "", [joinUrl]);
|
|
3027
4301
|
const hasJoinUrl = joinUrlValue.length > 0;
|
|
3028
|
-
(0,
|
|
4302
|
+
(0, import_react13.useEffect)(() => {
|
|
3029
4303
|
if (!hasJoinUrl) {
|
|
3030
4304
|
setJoinQrVisible(false);
|
|
3031
4305
|
}
|
|
3032
4306
|
}, [hasJoinUrl]);
|
|
3033
|
-
const handleCopy = (0,
|
|
4307
|
+
const handleCopy = (0, import_react13.useCallback)(async () => {
|
|
3034
4308
|
if (!joinUrlValue) {
|
|
3035
4309
|
return;
|
|
3036
4310
|
}
|
|
@@ -3047,28 +4321,28 @@ var useHostJoinControls = ({
|
|
|
3047
4321
|
resetTimerRef.current = null;
|
|
3048
4322
|
}, copiedDurationMs);
|
|
3049
4323
|
}, [copiedDurationMs, joinUrlValue]);
|
|
3050
|
-
const handleOpen = (0,
|
|
4324
|
+
const handleOpen = (0, import_react13.useCallback)(() => {
|
|
3051
4325
|
if (!joinUrlValue || typeof window === "undefined") {
|
|
3052
4326
|
return;
|
|
3053
4327
|
}
|
|
3054
4328
|
window.open(joinUrlValue, "_blank", "noopener,noreferrer");
|
|
3055
4329
|
}, [joinUrlValue]);
|
|
3056
|
-
const showJoinQr = (0,
|
|
4330
|
+
const showJoinQr = (0, import_react13.useCallback)(() => {
|
|
3057
4331
|
if (!hasJoinUrl) {
|
|
3058
4332
|
return;
|
|
3059
4333
|
}
|
|
3060
4334
|
setJoinQrVisible(true);
|
|
3061
4335
|
}, [hasJoinUrl]);
|
|
3062
|
-
const hideJoinQr = (0,
|
|
4336
|
+
const hideJoinQr = (0, import_react13.useCallback)(() => {
|
|
3063
4337
|
setJoinQrVisible(false);
|
|
3064
4338
|
}, []);
|
|
3065
|
-
const toggleJoinQr = (0,
|
|
4339
|
+
const toggleJoinQr = (0, import_react13.useCallback)(() => {
|
|
3066
4340
|
if (!hasJoinUrl) {
|
|
3067
4341
|
return;
|
|
3068
4342
|
}
|
|
3069
4343
|
setJoinQrVisible((current) => !current);
|
|
3070
4344
|
}, [hasJoinUrl]);
|
|
3071
|
-
const handleStart = (0,
|
|
4345
|
+
const handleStart = (0, import_react13.useCallback)(() => {
|
|
3072
4346
|
if (!canStartMatch) {
|
|
3073
4347
|
return;
|
|
3074
4348
|
}
|
|
@@ -3091,10 +4365,13 @@ var useHostJoinControls = ({
|
|
|
3091
4365
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3092
4366
|
0 && (module.exports = {
|
|
3093
4367
|
AIRJAM_DEFAULT_AVATAR_SEEDS,
|
|
4368
|
+
AxisButton,
|
|
3094
4369
|
Button,
|
|
3095
4370
|
ConnectionStatusPill,
|
|
4371
|
+
ControlButton,
|
|
3096
4372
|
ControllerPlayerNameField,
|
|
3097
4373
|
ControllerPrimaryAction,
|
|
4374
|
+
GamepadLayout,
|
|
3098
4375
|
HostMuteButton,
|
|
3099
4376
|
JoinQrOverlay,
|
|
3100
4377
|
JoinUrlActionButtons,
|
|
@@ -3106,12 +4383,10 @@ var useHostJoinControls = ({
|
|
|
3106
4383
|
RoomQrCode,
|
|
3107
4384
|
RuntimeShellHeader,
|
|
3108
4385
|
Slider,
|
|
4386
|
+
Stick,
|
|
3109
4387
|
SurfaceViewport,
|
|
3110
4388
|
VolumeControls,
|
|
3111
|
-
buttonVariants,
|
|
3112
4389
|
getDiceBearAdventurerNeutralUrl,
|
|
3113
|
-
getPlayerAvatarImageUrl,
|
|
3114
|
-
resolvePlayerAvatarSeed,
|
|
3115
4390
|
useControllerLifecycleIntents,
|
|
3116
4391
|
useControllerLifecyclePermissions,
|
|
3117
4392
|
useControllerShellStatus,
|