@thestatic-tv/dcl-sdk 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ async function request(url, options = {}) {
17
17
  }
18
18
 
19
19
  // src/StaticTVClient.ts
20
- import { signedFetch as signedFetch3 } from "~system/SignedFetch";
20
+ import { signedFetch as signedFetch4 } from "~system/SignedFetch";
21
21
 
22
22
  // src/modules/guide.ts
23
23
  var GuideModule = class {
@@ -209,7 +209,83 @@ function dclClearTimeout(timeoutId) {
209
209
  // src/utils/bounds.ts
210
210
  import { engine as engine2, Transform } from "@dcl/sdk/ecs";
211
211
  import { getSceneInformation } from "~system/Runtime";
212
+
213
+ // src/utils/walls.ts
212
214
  var PARCEL_SIZE = 16;
215
+ var EDGE_STRIP = 1;
216
+ var WALL_TOP_MAX = 32;
217
+ function heightLimit(parcels) {
218
+ return Math.log2(parcels + 1) * 20;
219
+ }
220
+ function wallTop(parcels) {
221
+ return Math.min(WALL_TOP_MAX, heightLimit(parcels) - 4);
222
+ }
223
+ function parcelRects(parcels, base) {
224
+ const parse = (p) => {
225
+ const parts = String(p).split(",");
226
+ if (parts.length !== 2) return null;
227
+ const [x, z] = parts.map((n) => parseInt(n, 10));
228
+ return Number.isFinite(x) && Number.isFinite(z) ? { x, z } : null;
229
+ };
230
+ const coords = parcels.map(parse).filter((c) => c !== null);
231
+ const origin = base && parse(base) || coords[0];
232
+ if (!origin) return [];
233
+ return coords.map((c) => {
234
+ const minX = (c.x - origin.x) * PARCEL_SIZE;
235
+ const minZ = (c.z - origin.z) * PARCEL_SIZE;
236
+ return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
237
+ });
238
+ }
239
+ function outerSides(rect, rects) {
240
+ const at = (minX, minZ) => rects.some((r) => r.minX === minX && r.minZ === minZ);
241
+ const sides = [];
242
+ if (!at(rect.minX - PARCEL_SIZE, rect.minZ)) sides.push("west");
243
+ if (!at(rect.minX + PARCEL_SIZE, rect.minZ)) sides.push("east");
244
+ if (!at(rect.minX, rect.minZ - PARCEL_SIZE)) sides.push("south");
245
+ if (!at(rect.minX, rect.minZ + PARCEL_SIZE)) sides.push("north");
246
+ return sides;
247
+ }
248
+ function wallBoxes(rects, strip = EDGE_STRIP, top = wallTop(rects.length)) {
249
+ return rects.map((r) => {
250
+ const outer = outerSides(r, rects);
251
+ return {
252
+ minX: r.minX + (outer.includes("west") ? strip : 0),
253
+ maxX: r.maxX - (outer.includes("east") ? strip : 0),
254
+ minZ: r.minZ + (outer.includes("south") ? strip : 0),
255
+ maxZ: r.maxZ - (outer.includes("north") ? strip : 0),
256
+ top
257
+ };
258
+ });
259
+ }
260
+ function inParcels(p, rects) {
261
+ return rects.some((r) => p.x >= r.minX && p.x <= r.maxX && p.z >= r.minZ && p.z <= r.maxZ);
262
+ }
263
+ function insideWalls(p, boxes) {
264
+ return boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ && p.y < b.top);
265
+ }
266
+ var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
267
+ function ejectPoint(boxes, rects, from) {
268
+ const IN = 0.5;
269
+ const p = from || { x: 0, y: 0, z: 0 };
270
+ let best = null;
271
+ let bestDistance = Infinity;
272
+ rects.forEach((rect, i) => {
273
+ const b = boxes[i];
274
+ if (!b) return;
275
+ const along = (lo, hi, v) => clamp(v, lo + IN, hi - IN);
276
+ for (const side of outerSides(rect, rects)) {
277
+ const point = side === "west" ? { x: b.minX + IN, z: along(b.minZ, b.maxZ, p.z) } : side === "east" ? { x: b.maxX - IN, z: along(b.minZ, b.maxZ, p.z) } : side === "south" ? { x: along(b.minX, b.maxX, p.x), z: b.minZ + IN } : { x: along(b.minX, b.maxX, p.x), z: b.maxZ - IN };
278
+ const distance = Math.hypot(point.x - p.x, point.z - p.z);
279
+ if (distance < bestDistance) {
280
+ bestDistance = distance;
281
+ best = { x: point.x, y: b.top + 1, z: point.z };
282
+ }
283
+ }
284
+ });
285
+ return best;
286
+ }
287
+
288
+ // src/utils/bounds.ts
213
289
  var cachedBounds = null;
214
290
  var cachedParcelRects = [];
215
291
  var boundsInitialized = false;
@@ -252,11 +328,7 @@ async function getSceneBounds() {
252
328
  boundsError = true;
253
329
  return null;
254
330
  }
255
- cachedParcelRects = coords.map((c) => {
256
- const minX = (c.x - base.x) * PARCEL_SIZE;
257
- const minZ = (c.z - base.z) * PARCEL_SIZE;
258
- return { minX, maxX: minX + PARCEL_SIZE, minZ, maxZ: minZ + PARCEL_SIZE };
259
- });
331
+ cachedParcelRects = parcelRects(parcels, baseParcel);
260
332
  const worldMinX = Math.min(...coords.map((c) => c.x));
261
333
  const worldMaxX = Math.max(...coords.map((c) => c.x));
262
334
  const worldMinZ = Math.min(...coords.map((c) => c.z));
@@ -292,6 +364,9 @@ function isPlayerInBounds(_bounds) {
292
364
  return false;
293
365
  }
294
366
  }
367
+ function getParcelRects() {
368
+ return cachedParcelRects.map((r) => ({ ...r }));
369
+ }
295
370
  function getPlayerPosition() {
296
371
  try {
297
372
  const transform = Transform.getOrNull(engine2.PlayerEntity);
@@ -434,7 +509,7 @@ var SessionModule = class {
434
509
  this._tier = normalizeTier(response.sdkType);
435
510
  this.startHeartbeat();
436
511
  this.client.log(`Session started: ${this.sessionId}, tier: ${this._tier}`);
437
- this.client._enableFeaturesForTier(this._tier, this._keyId);
512
+ this.client._enableFeaturesForTier(this._tier, this._keyId, this._tier === "pro" && response.venue === true);
438
513
  return this.sessionId;
439
514
  }
440
515
  this.client._settleFeaturesAsFree();
@@ -693,10 +768,280 @@ var InteractionsModule = class {
693
768
  }
694
769
  };
695
770
 
771
+ // src/modules/frames.ts
772
+ import { signedFetch } from "~system/SignedFetch";
773
+ import { openExternalUrl } from "~system/RestrictedActions";
774
+ var FRAMES_MAX = 64;
775
+ var REFRESH_JITTER_MS = 3e3;
776
+ var DEFAULT_VERSION = "default";
777
+ var IMAGE_MAX = 1e3;
778
+ var TEXT_MAX = 120;
779
+ var LINK_MAX = 1e3;
780
+ var VERSION_MAX = 40;
781
+ var HTTPS = /^https:/i;
782
+ function isSceneFrame(value) {
783
+ if (!value || typeof value !== "object") return false;
784
+ const f = value;
785
+ if (typeof f.id !== "string" || typeof f.label !== "string" || typeof f.onContent !== "function") return false;
786
+ const d = f.default;
787
+ if (d === void 0 || d === null) return true;
788
+ if (typeof d !== "object") return false;
789
+ const { image, text, link } = d;
790
+ return typeof image === "string" && (text === void 0 || typeof text === "string") && (link === void 0 || typeof link === "string");
791
+ }
792
+ function defaultContent(frame) {
793
+ const d = frame.default;
794
+ if (!d) return null;
795
+ return { image: d.image, text: d.text || "", link: d.link || "", version: DEFAULT_VERSION };
796
+ }
797
+ function savedContent(value) {
798
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
799
+ const v = value;
800
+ const image = v.image;
801
+ const text = v.text === void 0 || v.text === null ? "" : v.text;
802
+ const link = v.link === void 0 || v.link === null ? "" : v.link;
803
+ const version = v.version;
804
+ if (typeof image !== "string" || image.length > IMAGE_MAX || !HTTPS.test(image)) return null;
805
+ if (typeof text !== "string" || text.length > TEXT_MAX) return null;
806
+ if (typeof link !== "string" || link.length > LINK_MAX || link !== "" && !HTTPS.test(link)) return null;
807
+ if (typeof version !== "string" || version === "" || version.length > VERSION_MAX) return null;
808
+ return { image, text, link, version };
809
+ }
810
+ function sameContent(a, b) {
811
+ return b !== null && a.image === b.image && a.text === b.text && a.link === b.link && a.version === b.version;
812
+ }
813
+ function errorOf(body) {
814
+ try {
815
+ const data = body ? JSON.parse(body) : null;
816
+ return data && typeof data.error === "string" ? data.error : "";
817
+ } catch {
818
+ return "";
819
+ }
820
+ }
821
+ var FramesModule = class {
822
+ constructor(host) {
823
+ this.entries = /* @__PURE__ */ new Map();
824
+ /** Venue is known: the reads, the upload and the clicks may go */
825
+ this.enabled = false;
826
+ /** This copy's admin check succeeded: the declaration may be uploaded */
827
+ this.adminOk = false;
828
+ this.uploaded = false;
829
+ this.loadReadStarted = false;
830
+ /** The last good read's `frames` object (saved content by frame id), or null until a read succeeds */
831
+ this.answer = null;
832
+ /** Reads are numbered as they start; an answer older than the one shown is dropped */
833
+ this.readSeq = 0;
834
+ this.shownSeq = 0;
835
+ /** A framesRefresh is waiting out its jitter: another inside the wait shares its read */
836
+ this.refreshWaiting = false;
837
+ this.host = host;
838
+ }
839
+ /** The declared frames' ids, in the order they were first registered */
840
+ get ids() {
841
+ return [...this.entries.keys()];
842
+ }
843
+ /** True once Venue is known for this scene */
844
+ get isEnabled() {
845
+ return this.enabled;
846
+ }
847
+ /**
848
+ * Declare frames: kept until Venue is known; after, a frame registered now gets what the last read gave at once,
849
+ * and the load read and the upload that waited on frames go now (each still once a load)
850
+ */
851
+ register(frames) {
852
+ if (!Array.isArray(frames)) {
853
+ this.host.log("registerFrames skipped - not a list of frames");
854
+ return;
855
+ }
856
+ for (const frame of frames) {
857
+ if (!isSceneFrame(frame)) {
858
+ this.host.log("Frame skipped - not a SceneFrame:", frame);
859
+ continue;
860
+ }
861
+ if (!this.entries.has(frame.id) && this.entries.size >= FRAMES_MAX) {
862
+ this.host.warn(`Frame ${frame.id} skipped - at most ${FRAMES_MAX} frames a scene`);
863
+ continue;
864
+ }
865
+ this.entries.set(frame.id, { frame, shown: null });
866
+ }
867
+ this.host.log("Registered frames:", this.ids);
868
+ if (!this.enabled) return;
869
+ this.apply();
870
+ this.loadRead();
871
+ this.upload().catch(() => {
872
+ });
873
+ }
874
+ /** Venue is known (the client calls this once the session confirms it): the load read, and the upload if it waited */
875
+ enable() {
876
+ if (this.enabled) return;
877
+ this.enabled = true;
878
+ this.loadRead();
879
+ this.upload().catch(() => {
880
+ });
881
+ }
882
+ /** This copy's admin check succeeded (the admin panel calls this): the declaration goes up once Venue is known */
883
+ adminCheckSucceeded() {
884
+ this.adminOk = true;
885
+ this.upload().catch(() => {
886
+ });
887
+ }
888
+ /**
889
+ * A queued framesRefresh (the scene's page saved or reset a frame): read again after a random wait of up to
890
+ * REFRESH_JITTER_MS. Refreshes that arrive inside the wait share its read.
891
+ */
892
+ refresh() {
893
+ if (!this.enabled || this.entries.size === 0 || this.refreshWaiting) return;
894
+ this.refreshWaiting = true;
895
+ const wait = Math.floor(Math.random() * REFRESH_JITTER_MS);
896
+ this.host.log(`Frames refresh in ${wait} ms`);
897
+ dclSetTimeout(() => {
898
+ this.refreshWaiting = false;
899
+ this.loadReadStarted = true;
900
+ this.read().catch(() => {
901
+ });
902
+ }, wait);
903
+ }
904
+ /**
905
+ * A visitor clicked a frame. The link opens when it is an https: one: the shown content's, else the frame's default's
906
+ * - so a scene without Venue (or before its read lands), which shows its own defaults, has no dead frames. The click is
907
+ * posted signed under the shown version (fire and forget; a failure is logged, never shown) only with Venue and
908
+ * something shown. An id not declared opens nothing and posts nothing.
909
+ */
910
+ open(id) {
911
+ const entry = typeof id === "string" ? this.entries.get(id) : void 0;
912
+ if (!entry) {
913
+ this.host.log("openFrame: no frame declared with this id:", id);
914
+ return;
915
+ }
916
+ const shown = entry.shown;
917
+ if (this.enabled && shown) this.postClick(entry.frame.id, shown.version).catch(() => {
918
+ });
919
+ else this.host.log("openFrame: no click counted - no Venue, or the frame shows nothing yet:", id);
920
+ const link = shown ? shown.link : entry.frame.default?.link || "";
921
+ if (link !== "" && HTTPS.test(link)) {
922
+ try {
923
+ Promise.resolve(openExternalUrl({ url: link })).catch((err) => this.host.log("Frame link not opened:", err));
924
+ } catch (err) {
925
+ this.host.log("Frame link not opened:", err);
926
+ }
927
+ }
928
+ }
929
+ /** The routes' base for this scene: the scene id encoded, as any value in a url path is */
930
+ sceneUrl() {
931
+ const sceneId = this.host.getSceneId();
932
+ if (!sceneId) return null;
933
+ return `${this.host.getBaseUrl()}/scene/${encodeURIComponent(sceneId)}`;
934
+ }
935
+ /** The read at load: once, when Venue is known and a frame is declared */
936
+ loadRead() {
937
+ if (this.loadReadStarted || !this.enabled || this.entries.size === 0) return;
938
+ this.loadReadStarted = true;
939
+ this.read().catch(() => {
940
+ });
941
+ }
942
+ /** Read the saved content and show it; a failed read keeps what was shown */
943
+ async read() {
944
+ const base = this.sceneUrl();
945
+ if (!base) {
946
+ this.host.log("Frames: no scene id - nothing read");
947
+ return;
948
+ }
949
+ const seq = ++this.readSeq;
950
+ let frames;
951
+ try {
952
+ const res = await fetch(`${base}/frames`);
953
+ if (!res.ok) {
954
+ this.host.log("Frames read refused:", res.status);
955
+ return;
956
+ }
957
+ const data = await res.json();
958
+ const raw = data && typeof data === "object" ? data.frames : void 0;
959
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
960
+ this.host.log("Frames read: the answer holds no frames");
961
+ return;
962
+ }
963
+ frames = raw;
964
+ } catch (err) {
965
+ this.host.log("Frames read error:", err);
966
+ return;
967
+ }
968
+ if (seq < this.shownSeq) return;
969
+ this.shownSeq = seq;
970
+ this.answer = frames;
971
+ this.apply();
972
+ }
973
+ /** A frame's content from the last good read: its saved content when usable, else its default, else null */
974
+ contentFor(frame) {
975
+ const answer = this.answer;
976
+ if (answer && Object.prototype.hasOwnProperty.call(answer, frame.id)) {
977
+ const saved = savedContent(answer[frame.id]);
978
+ if (saved) return saved;
979
+ this.host.log("Frames: saved content not usable, ignored:", frame.id);
980
+ }
981
+ return defaultContent(frame);
982
+ }
983
+ /** Each declared frame's content handed to its onContent when it differs from what the frame shows */
984
+ apply() {
985
+ if (!this.enabled || this.answer === null) return;
986
+ for (const entry of [...this.entries.values()]) {
987
+ const content = this.contentFor(entry.frame);
988
+ if (!content || sameContent(content, entry.shown)) continue;
989
+ try {
990
+ entry.frame.onContent({ ...content });
991
+ entry.shown = content;
992
+ } catch (err) {
993
+ this.host.error(`Frame ${entry.frame.id}: onContent failed`, err);
994
+ }
995
+ }
996
+ }
997
+ /** The declaration - ids, labels, defaults, never the handlers - once a load, in its own request to the config route */
998
+ async upload() {
999
+ if (this.uploaded || !this.enabled || !this.adminOk || this.entries.size === 0) return;
1000
+ const base = this.sceneUrl();
1001
+ if (!base) return;
1002
+ this.uploaded = true;
1003
+ const frames = [...this.entries.values()].map(({ frame }) => {
1004
+ const d = frame.default;
1005
+ return {
1006
+ id: frame.id,
1007
+ label: frame.label,
1008
+ ...d ? { default: { image: d.image, text: d.text || "", link: d.link || "" } } : {}
1009
+ };
1010
+ });
1011
+ try {
1012
+ const res = await signedFetch({
1013
+ url: `${base}/config`,
1014
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frames }) }
1015
+ });
1016
+ if (res.ok) {
1017
+ this.host.log("Frames declared:", frames.map((f) => f.id));
1018
+ return;
1019
+ }
1020
+ this.host.log("Frames declaration refused:", res.status, errorOf(res.body));
1021
+ } catch (err) {
1022
+ this.host.log("Frames declaration error:", err);
1023
+ }
1024
+ }
1025
+ /** The click, signed: thestatic.tv counts it under the frame's shown version (one a wallet a frame a 10 s) */
1026
+ async postClick(id, version) {
1027
+ const base = this.sceneUrl();
1028
+ if (!base) return;
1029
+ try {
1030
+ const res = await signedFetch({
1031
+ url: `${base}/frames/click`,
1032
+ init: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ frame: id, version }) }
1033
+ });
1034
+ if (!res.ok) this.host.log("Frame click refused:", id, res.status, errorOf(res.body));
1035
+ } catch (err) {
1036
+ this.host.log("Frame click error:", id, err);
1037
+ }
1038
+ }
1039
+ };
1040
+
696
1041
  // src/ui/guide-ui.tsx
697
1042
  import ReactEcs2, { UiEntity as UiEntity2, Input as Input2, Label as Label2 } from "@dcl/sdk/react-ecs";
698
1043
  import { Color4 as Color43 } from "@dcl/sdk/math";
699
- import { openExternalUrl } from "~system/RestrictedActions";
1044
+ import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
700
1045
 
701
1046
  // src/ui/theme.ts
702
1047
  import { Color4 } from "@dcl/sdk/math";
@@ -965,6 +1310,7 @@ var GuideUIModule = class {
965
1310
  * Always renders toggle button, plus panel when visible
966
1311
  */
967
1312
  this.getComponent = () => {
1313
+ if (this.client.isVisitorBlocked) return null;
968
1314
  const windowW = UI_DIMENSIONS.guide.width;
969
1315
  const windowH = UI_DIMENSIONS.guide.height;
970
1316
  return ReactEcs2.createElement(UiEntity2, {
@@ -1186,7 +1532,7 @@ var GuideUIModule = class {
1186
1532
  handleChannelClick(video) {
1187
1533
  const baseUrl = this.getBaseUrl();
1188
1534
  const channelUrl = `${baseUrl}/${video.channelId || video.id}`;
1189
- openExternalUrl({ url: channelUrl });
1535
+ openExternalUrl2({ url: channelUrl });
1190
1536
  }
1191
1537
  renderLeftPanel() {
1192
1538
  const sidebarW = this.s(UI_DIMENSIONS.guide.sidebar.width);
@@ -1728,12 +2074,13 @@ var GuideUIModule = class {
1728
2074
  // src/ui/chat-ui.tsx
1729
2075
  import ReactEcs3, { UiEntity as UiEntity3, Label as Label3, Input as Input3, Button as Button2 } from "@dcl/sdk/react-ecs";
1730
2076
  import { Color4 as Color44 } from "@dcl/sdk/math";
1731
- import { signedFetch } from "~system/SignedFetch";
2077
+ import { signedFetch as signedFetch2 } from "~system/SignedFetch";
1732
2078
  import { getPlayer } from "@dcl/sdk/players";
1733
- import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
2079
+ import { openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
1734
2080
  var POLL_INTERVAL_ACTIVE = 5e3;
1735
2081
  var POLL_INTERVAL_PASSIVE = 3e4;
1736
2082
  var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
2083
+ var HISTORY_ERROR_ID = "sys-history-error";
1737
2084
  var ChatUIModule = class {
1738
2085
  constructor(client, config = {}) {
1739
2086
  // Visibility state
@@ -1757,6 +2104,8 @@ var ChatUIModule = class {
1757
2104
  this.systemMessages = [];
1758
2105
  this.inputText = "";
1759
2106
  this.chatScrollOffset = 0;
2107
+ // The last history read's failure, shown as the messages' last line until a read succeeds (2026-11-17)
2108
+ this.historyError = "";
1760
2109
  // UI preferences
1761
2110
  this.position = "right";
1762
2111
  // Timers
@@ -1771,6 +2120,7 @@ var ChatUIModule = class {
1771
2120
  * Always renders toggle button, plus panel when visible
1772
2121
  */
1773
2122
  this.getComponent = () => {
2123
+ if (this.client.isVisitorBlocked) return null;
1774
2124
  const scaledTheme = scaleChatTheme(DEFAULT_CHAT_THEME, this.client.uiScale);
1775
2125
  const positionStyle = this.getPositionStyle();
1776
2126
  return ReactEcs3.createElement(UiEntity3, {
@@ -1911,7 +2261,7 @@ var ChatUIModule = class {
1911
2261
  this.isSigningIn = true;
1912
2262
  try {
1913
2263
  const baseUrl = this.getBaseUrl();
1914
- const response = await signedFetch({
2264
+ const response = await signedFetch2({
1915
2265
  url: `${baseUrl}/api/auth/dcl`,
1916
2266
  init: {
1917
2267
  method: "POST",
@@ -1963,8 +2313,13 @@ var ChatUIModule = class {
1963
2313
  async fetchMessages() {
1964
2314
  try {
1965
2315
  const baseUrl = this.getBaseUrl();
1966
- const response = await fetch(`${baseUrl}/api/chat/history?channelId=${this.currentChannelId}`);
2316
+ const response = await fetch(`${baseUrl}/api/chat/history?channelId=${encodeURIComponent(this.currentChannelId)}`);
2317
+ if (!response.ok) {
2318
+ this.historyError = `CHAT HISTORY UNAVAILABLE (${response.status})`;
2319
+ return;
2320
+ }
1967
2321
  const data = await response.json();
2322
+ this.historyError = "";
1968
2323
  if (data.messages) {
1969
2324
  const twentyFourHoursAgo = Date.now() - 24 * 60 * 60 * 1e3;
1970
2325
  const recentMsgs = data.messages.filter(
@@ -1992,6 +2347,7 @@ var ChatUIModule = class {
1992
2347
  this.realMessages = sortedMsgs;
1993
2348
  }
1994
2349
  } catch (e) {
2350
+ this.historyError = "CHAT HISTORY UNAVAILABLE";
1995
2351
  }
1996
2352
  }
1997
2353
  async handleSend() {
@@ -2007,7 +2363,7 @@ var ChatUIModule = class {
2007
2363
  this.inputText = "";
2008
2364
  try {
2009
2365
  const baseUrl = this.getBaseUrl();
2010
- const response = await signedFetch({
2366
+ const response = await signedFetch2({
2011
2367
  url: `${baseUrl}/api/chat/send`,
2012
2368
  init: {
2013
2369
  method: "POST",
@@ -2050,6 +2406,7 @@ var ChatUIModule = class {
2050
2406
  switchChannel(channelId) {
2051
2407
  this.currentChannelId = channelId;
2052
2408
  this.realMessages = [];
2409
+ this.historyError = "";
2053
2410
  this.showChannelDropdown = false;
2054
2411
  this.chatScrollOffset = 0;
2055
2412
  this.channelPage = 0;
@@ -2164,6 +2521,16 @@ var ChatUIModule = class {
2164
2521
  }
2165
2522
  renderMessagesArea(theme) {
2166
2523
  const allMessages = [...this.systemMessages, ...this.realMessages];
2524
+ if (this.historyError) {
2525
+ allMessages.push({
2526
+ id: HISTORY_ERROR_ID,
2527
+ username: "SYSTEM",
2528
+ text: this.historyError,
2529
+ uid: "system",
2530
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2531
+ isSystem: true
2532
+ });
2533
+ }
2167
2534
  const totalMessages = allMessages.length;
2168
2535
  const maxOffset = Math.max(0, totalMessages - UI_DIMENSIONS.chat.messagesPerPage);
2169
2536
  if (this.chatScrollOffset > maxOffset) this.chatScrollOffset = maxOffset;
@@ -2250,7 +2617,12 @@ var ChatUIModule = class {
2250
2617
  return ReactEcs3.createElement(UiEntity3, {
2251
2618
  key: msg.id,
2252
2619
  uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
2253
- uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
2620
+ uiText: {
2621
+ value: msg.text,
2622
+ fontSize: theme.systemMessage,
2623
+ color: msg.id === HISTORY_ERROR_ID ? THEME.colors.yellow : THEME.colors.green,
2624
+ textAlign: "middle-left"
2625
+ }
2254
2626
  });
2255
2627
  }
2256
2628
  renderChatMessage(msg, theme) {
@@ -2365,7 +2737,7 @@ var ChatUIModule = class {
2365
2737
  uiBackground: { color: THEME.colors.cyan },
2366
2738
  color: Color44.Black(),
2367
2739
  onMouseDown: () => {
2368
- openExternalUrl2({ url: `${baseUrl}/apply` });
2740
+ openExternalUrl3({ url: `${baseUrl}/login` });
2369
2741
  }
2370
2742
  })
2371
2743
  ]
@@ -2537,11 +2909,11 @@ var ChatUIModule = class {
2537
2909
  };
2538
2910
 
2539
2911
  // src/ui/admin-panel-ui.tsx
2540
- import ReactEcs5, { UiEntity as UiEntity5, Button as Button3, Label as Label5, Input as Input4 } from "@dcl/sdk/react-ecs";
2541
- import { Color4 as Color45, Vector3 } from "@dcl/sdk/math";
2912
+ import ReactEcs6, { UiEntity as UiEntity6, Button as Button4, Label as Label6, Input as Input4 } from "@dcl/sdk/react-ecs";
2913
+ import { Color4 as Color46 } from "@dcl/sdk/math";
2542
2914
  import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
2543
- import { movePlayerTo, openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
2544
- import { signedFetch as signedFetch2 } from "~system/SignedFetch";
2915
+ import { openExternalUrl as openExternalUrl5 } from "~system/RestrictedActions";
2916
+ import { signedFetch as signedFetch3 } from "~system/SignedFetch";
2545
2917
 
2546
2918
  // src/ui/ui-renderer.tsx
2547
2919
  import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
@@ -2649,6 +3021,7 @@ function createStaticUI(client) {
2649
3021
  initNotificationSystem();
2650
3022
  return function StaticUI() {
2651
3023
  const currentScale = client.uiScale;
3024
+ const blocked = client.isVisitorBlocked;
2652
3025
  const guideComponent = client.guideUI?.getComponent() ?? null;
2653
3026
  const chatComponent = client.chatUI?.getComponent() ?? null;
2654
3027
  const adminComponent = client.adminPanel?.getComponent() ?? null;
@@ -2664,7 +3037,7 @@ function createStaticUI(client) {
2664
3037
  alignItems: "center"
2665
3038
  }
2666
3039
  },
2667
- /* @__PURE__ */ ReactEcs4.createElement(NotificationBanner, null),
3040
+ blocked ? null : /* @__PURE__ */ ReactEcs4.createElement(NotificationBanner, null),
2668
3041
  guideComponent,
2669
3042
  chatComponent,
2670
3043
  adminComponent
@@ -2676,8 +3049,387 @@ function setupStaticUI(client) {
2676
3049
  ReactEcsRenderer.setUiRenderer(StaticUI);
2677
3050
  }
2678
3051
 
3052
+ // src/ui/blocked-notice.tsx
3053
+ import ReactEcs5, { UiEntity as UiEntity5, Label as Label5, Button as Button3 } from "@dcl/sdk/react-ecs";
3054
+ import { Color4 as Color45 } from "@dcl/sdk/math";
3055
+ import { openExternalUrl as openExternalUrl4 } from "~system/RestrictedActions";
3056
+ var DEFAULT_SITE_URL = "https://thestatic.tv";
3057
+ function blockedNoticeLines(standing, kickLeftMs) {
3058
+ if (standing === "banned") {
3059
+ return ["BANNED FROM THIS SCENE", "The scene's moderators banned", "this wallet."];
3060
+ }
3061
+ if (standing === "kicked") {
3062
+ const minutes = Math.max(1, Math.ceil(kickLeftMs / 6e4));
3063
+ return ["REMOVED FROM THIS SCENE", "A moderator cleared the scene.", `You can come back in ${minutes} min.`];
3064
+ }
3065
+ if (standing === "private") {
3066
+ return ["PRIVATE EVENT", "Open to TheStatic.tv citizens right now."];
3067
+ }
3068
+ return [];
3069
+ }
3070
+ function blockedNoticeAction(standing, siteUrl = DEFAULT_SITE_URL) {
3071
+ if (standing === "private") return { label: "BECOME A CITIZEN", url: `${siteUrl}/login` };
3072
+ return null;
3073
+ }
3074
+ function BlockedNotice(props) {
3075
+ const lines = blockedNoticeLines(props.standing, props.kickLeftMs);
3076
+ if (lines.length === 0) return null;
3077
+ const s = (v) => Math.round(v * props.scale);
3078
+ const [title, ...body] = lines;
3079
+ const action = blockedNoticeAction(props.standing, props.siteUrl || DEFAULT_SITE_URL);
3080
+ return /* @__PURE__ */ ReactEcs5.createElement(
3081
+ UiEntity5,
3082
+ {
3083
+ uiTransform: {
3084
+ width: "100%",
3085
+ height: "100%",
3086
+ positionType: "absolute",
3087
+ justifyContent: "center",
3088
+ alignItems: "center"
3089
+ }
3090
+ },
3091
+ /* @__PURE__ */ ReactEcs5.createElement(
3092
+ UiEntity5,
3093
+ {
3094
+ uiTransform: { width: s(460), flexDirection: "column", alignItems: "center", padding: s(20) },
3095
+ uiBackground: { color: Color45.create(0.05, 0.05, 0.08, 0.95) }
3096
+ },
3097
+ /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: title, fontSize: s(22), color: Color45.create(0.9, 0.2, 0.2, 1), uiTransform: { height: s(34) } }),
3098
+ body.map((line, i) => /* @__PURE__ */ ReactEcs5.createElement(Label5, { key: `blocked-line-${i}`, value: line, fontSize: s(16), color: Color45.White(), uiTransform: { height: s(26) } })),
3099
+ action && /* @__PURE__ */ ReactEcs5.createElement(
3100
+ Button3,
3101
+ {
3102
+ uiTransform: { width: s(220), height: s(36), margin: { top: s(12) } },
3103
+ uiBackground: { color: Color45.create(0, 0.8, 0.8, 1) },
3104
+ value: action.label,
3105
+ fontSize: s(16),
3106
+ color: Color45.Black(),
3107
+ onMouseDown: () => {
3108
+ openExternalUrl4({ url: action.url });
3109
+ }
3110
+ }
3111
+ )
3112
+ )
3113
+ );
3114
+ }
3115
+
3116
+ // src/utils/player-wait.ts
3117
+ var PLAYER_WAIT_STEP_MS = 1e3;
3118
+ var PLAYER_WAIT_MAX_MS = 30 * 1e3;
3119
+ var isGuest = (player) => player.isGuest === true;
3120
+ var PlayerWait = class {
3121
+ constructor(deps) {
3122
+ this.timerId = null;
3123
+ this.reads = 0;
3124
+ /** This wait has checked a guest reading already */
3125
+ this.guestChecked = false;
3126
+ this.deps = deps;
3127
+ }
3128
+ get stepMs() {
3129
+ return this.deps.stepMs ?? PLAYER_WAIT_STEP_MS;
3130
+ }
3131
+ get maxMs() {
3132
+ return this.deps.maxMs ?? PLAYER_WAIT_MAX_MS;
3133
+ }
3134
+ /** True while a wait is reading the player */
3135
+ get waiting() {
3136
+ return this.timerId !== null;
3137
+ }
3138
+ /**
3139
+ * The check with the player now, or - with no player yet - a wait that runs it once one appears. A guest reading is
3140
+ * checked now and the wait goes on for a non-guest one. Resolves when the check is done, or at once when there is
3141
+ * none to run.
3142
+ */
3143
+ async run() {
3144
+ const player = this.read();
3145
+ if (player && !isGuest(player)) {
3146
+ this.stop();
3147
+ await this.deps.check(player);
3148
+ return;
3149
+ }
3150
+ if (player) {
3151
+ this.start("A guest reading - checked now; waiting for a non-guest one");
3152
+ this.guestChecked = true;
3153
+ await this.deps.check(player);
3154
+ return;
3155
+ }
3156
+ this.start("No player data yet - waiting for one");
3157
+ }
3158
+ /** A wait, unless one is running (one at a time) */
3159
+ start(msg) {
3160
+ if (this.timerId !== null) return;
3161
+ this.reads = 0;
3162
+ this.guestChecked = false;
3163
+ this.deps.log?.(msg);
3164
+ this.timerId = this.deps.setInterval(() => this.tick(), this.stepMs);
3165
+ }
3166
+ tick() {
3167
+ this.reads++;
3168
+ const player = this.read();
3169
+ if (player && !isGuest(player)) {
3170
+ this.stop();
3171
+ this.deps.log?.(`Player resolved after ${this.reads} read(s)`);
3172
+ this.deps.check(player).catch(() => {
3173
+ });
3174
+ return;
3175
+ }
3176
+ if (player && !this.guestChecked) {
3177
+ this.guestChecked = true;
3178
+ this.deps.log?.(`A guest reading after ${this.reads} read(s) - checked now; still waiting for a non-guest one`);
3179
+ this.deps.check(player).catch(() => {
3180
+ });
3181
+ }
3182
+ if (this.reads * this.stepMs >= this.maxMs) {
3183
+ this.stop();
3184
+ this.deps.log?.(`No non-guest player after ${this.maxMs / 1e3} s - no further check`);
3185
+ }
3186
+ }
3187
+ stop() {
3188
+ if (this.timerId === null) return;
3189
+ this.deps.clearInterval(this.timerId);
3190
+ this.timerId = null;
3191
+ }
3192
+ read() {
3193
+ try {
3194
+ const player = this.deps.getPlayer();
3195
+ return player && player.userId ? player : null;
3196
+ } catch {
3197
+ return null;
3198
+ }
3199
+ }
3200
+ };
3201
+
3202
+ // src/modules/moderation.ts
3203
+ import { engine as engine4, Transform as Transform2, MeshCollider, ColliderLayer } from "@dcl/sdk/ecs";
3204
+ import { Vector3 } from "@dcl/sdk/math";
3205
+ import { movePlayerTo } from "~system/RestrictedActions";
3206
+ var KICK_MS = 2 * 60 * 1e3;
3207
+ var REREAD_MS = 60 * 1e3;
3208
+ var READ_GAP_MS = 5e3;
3209
+ var HINT_SPREAD_MS = 3e3;
3210
+ var CITIZEN_WAIT_MS = 1e4;
3211
+ var CHECK_EVERY_S = 1;
3212
+ function namesMe(wallet, mine) {
3213
+ if (typeof wallet !== "string" || wallet === "") return false;
3214
+ if (typeof mine !== "string" || mine === "") return false;
3215
+ return wallet.toLowerCase() === mine.toLowerCase();
3216
+ }
3217
+ var ModerationModule = class {
3218
+ constructor(deps) {
3219
+ this.banned = false;
3220
+ this.kickedUntil = 0;
3221
+ this.canModerate = false;
3222
+ // Private mode (2026-11-19): the last answer's word on this visitor, its isCitizen and when it came, a hint's read
3223
+ // waiting its random spread, and the callers of checkCitizen() waiting on the next read
3224
+ this.privateBlocked = false;
3225
+ this.citizen = false;
3226
+ this.citizenAnsweredAt = null;
3227
+ this.hintDueAt = null;
3228
+ this.readWaiters = [];
3229
+ this.rects = [];
3230
+ this.boxes = [];
3231
+ this.wallEntities = [];
3232
+ this.lastBlocked = false;
3233
+ this.lastStanding = "clear";
3234
+ this.lastReadAt = Number.NEGATIVE_INFINITY;
3235
+ this.readInFlight = false;
3236
+ this.readPending = false;
3237
+ this.wasInScene = null;
3238
+ this.sinceCheck = 0;
3239
+ this.started = false;
3240
+ /** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor inside a wall moved above it */
3241
+ this.system = (dt) => {
3242
+ if (this.hintDueAt !== null && this.now() >= this.hintDueAt) {
3243
+ this.hintDueAt = null;
3244
+ this.requestRead();
3245
+ }
3246
+ if (this.readWaiters.length > 0) {
3247
+ const t = this.now();
3248
+ const expired = this.readWaiters.filter((w) => t >= w.deadline);
3249
+ if (expired.length > 0) {
3250
+ this.readWaiters = this.readWaiters.filter((w) => t < w.deadline);
3251
+ for (const w of expired) w.resolve();
3252
+ }
3253
+ }
3254
+ this.sinceCheck += dt;
3255
+ if (this.sinceCheck < CHECK_EVERY_S) return;
3256
+ this.sinceCheck = 0;
3257
+ const now = this.now();
3258
+ if (this.kickedUntil > 0 && now >= this.kickedUntil) {
3259
+ this.kickedUntil = 0;
3260
+ this.sync();
3261
+ }
3262
+ const me = getPlayerPosition();
3263
+ const inScene = me !== null && this.rects.length > 0 && inParcels(me, this.rects);
3264
+ if (inScene && this.wasInScene === false) this.readPending = true;
3265
+ if (inScene && now - this.lastReadAt >= REREAD_MS) this.readPending = true;
3266
+ this.wasInScene = inScene;
3267
+ this.tryRead();
3268
+ if (me && this.blocked && insideWalls(me, this.boxes)) {
3269
+ const to = ejectPoint(this.boxes, this.rects, me);
3270
+ if (to) {
3271
+ this.log("Blocked and inside the walls - moving above them", to);
3272
+ Promise.resolve(movePlayerTo({ newRelativePosition: Vector3.create(to.x, to.y, to.z) })).catch(() => {
3273
+ });
3274
+ }
3275
+ }
3276
+ };
3277
+ this.deps = deps;
3278
+ }
3279
+ now() {
3280
+ return this.deps.now ? this.deps.now() : Date.now();
3281
+ }
3282
+ log(msg, ...args) {
3283
+ this.deps.log?.(msg, ...args);
3284
+ }
3285
+ /** Reads the scene's parcels and starts the checks (once) */
3286
+ async start() {
3287
+ if (this.started) return;
3288
+ this.started = true;
3289
+ engine4.addSystem(this.system);
3290
+ try {
3291
+ await getSceneBounds();
3292
+ this.rects = getParcelRects();
3293
+ this.boxes = wallBoxes(this.rects);
3294
+ } catch {
3295
+ }
3296
+ this.sync();
3297
+ }
3298
+ /** banned, kicked (KICK ALL, until it lapses), private (the scene's private mode) or clear - in that precedence */
3299
+ get standing() {
3300
+ if (this.banned) return "banned";
3301
+ if (this.kickedUntil > 0 && this.now() < this.kickedUntil) return "kicked";
3302
+ if (this.privateBlocked) return "private";
3303
+ return "clear";
3304
+ }
3305
+ /** The last answer's isCitizen (2026-11-19): false before one, and from a server that does not answer it */
3306
+ get isCitizen() {
3307
+ return this.citizen;
3308
+ }
3309
+ /**
3310
+ * Whether this visitor is a TheStatic.tv citizen (2026-11-19): the last answer when it is under READ_GAP_MS old, else
3311
+ * the answer of the next read - started now, or the one in flight - through the same gate as every other read. A
3312
+ * read that fails answers what the last one said (false before any), and so does one that has not settled within
3313
+ * CITIZEN_WAIT_MS (the module's system ends that wait).
3314
+ */
3315
+ async checkCitizen() {
3316
+ if (this.citizenAnsweredAt !== null && this.now() - this.citizenAnsweredAt < READ_GAP_MS) return this.citizen;
3317
+ await new Promise((resolve) => {
3318
+ this.readWaiters.push({ resolve, deadline: this.now() + CITIZEN_WAIT_MS });
3319
+ if (!this.readInFlight) this.requestRead();
3320
+ });
3321
+ return this.citizen;
3322
+ }
3323
+ get blocked() {
3324
+ return this.standing !== "clear";
3325
+ }
3326
+ /** How long a kick has left, in ms (0 when not kicked) */
3327
+ get kickLeftMs() {
3328
+ return this.standing === "kicked" ? Math.max(0, this.kickedUntil - this.now()) : 0;
3329
+ }
3330
+ /**
3331
+ * admin-check's answer: the ban list's word on this visitor, whether they moderate the scene, and (2026-11-19) the
3332
+ * private mode's word and whether they are a citizen. Only the boolean true counts, so an answer without the new
3333
+ * fields reads as open and not a citizen. One who can moderate is never walled by private mode here, whatever the
3334
+ * answer says (the server admits them; this keeps a wrong answer from locking an admin out).
3335
+ */
3336
+ applyStanding(answer) {
3337
+ this.banned = answer.isBanned === true;
3338
+ this.canModerate = answer.canModerate === true;
3339
+ this.privateBlocked = answer.privateBlocked === true && !this.canModerate;
3340
+ this.citizen = answer.isCitizen === true;
3341
+ this.citizenAnsweredAt = this.now();
3342
+ this.lastReadAt = Math.max(this.lastReadAt, this.now());
3343
+ this.sync();
3344
+ }
3345
+ /**
3346
+ * A command from the scene's queue (the poll every visitor runs). Returns true for the three this module takes.
3347
+ * kickBanned names a wallet: the named visitor re-reads their standing, every other visitor does nothing.
3348
+ * privateMode (2026-11-19) is a hint for every visitor: its payload is not read - a re-read after a random wait of up
3349
+ * to HINT_SPREAD_MS, joined by any hint that comes while it waits, and still gated by one read in flight and
3350
+ * READ_GAP_MS, so no number of hints makes this copy read faster than that.
3351
+ */
3352
+ handleCommand(type, payload) {
3353
+ if (type === "privateMode") {
3354
+ if (this.hintDueAt === null) {
3355
+ const r = this.deps.random ? this.deps.random() : Math.random();
3356
+ const wait = Number.isFinite(r) ? Math.min(Math.max(r, 0), 1) * HINT_SPREAD_MS : 0;
3357
+ this.hintDueAt = this.now() + wait;
3358
+ this.log(`Private mode changed - reading my standing in ${Math.round(wait)} ms`);
3359
+ }
3360
+ return true;
3361
+ }
3362
+ if (type === "kickBanned") {
3363
+ if (namesMe(payload?.wallet, this.deps.myWallet())) {
3364
+ this.log("A kick names me - reading my standing");
3365
+ this.requestRead();
3366
+ }
3367
+ return true;
3368
+ }
3369
+ if (type === "kickAll") {
3370
+ if (!this.canModerate) {
3371
+ this.kickedUntil = this.now() + KICK_MS;
3372
+ this.sync();
3373
+ }
3374
+ return true;
3375
+ }
3376
+ return false;
3377
+ }
3378
+ /** Ask for a fresh standing read: at once when the gate allows, else as soon as it does */
3379
+ requestRead() {
3380
+ this.readPending = true;
3381
+ this.tryRead();
3382
+ }
3383
+ tryRead() {
3384
+ if (!this.readPending || this.readInFlight) return;
3385
+ const now = this.now();
3386
+ if (now - this.lastReadAt < READ_GAP_MS) return;
3387
+ this.readPending = false;
3388
+ this.readInFlight = true;
3389
+ this.lastReadAt = now;
3390
+ this.deps.reread().catch(() => {
3391
+ }).finally(() => {
3392
+ this.readInFlight = false;
3393
+ const waiters = this.readWaiters;
3394
+ this.readWaiters = [];
3395
+ for (const w of waiters) w.resolve();
3396
+ });
3397
+ }
3398
+ /** The walls follow blocked; the scene hears of a change */
3399
+ sync() {
3400
+ const standing = this.standing;
3401
+ const blocked = standing !== "clear";
3402
+ if (blocked && this.wallEntities.length === 0) this.raiseWalls();
3403
+ if (!blocked && this.wallEntities.length > 0) this.lowerWalls();
3404
+ if (blocked !== this.lastBlocked || standing !== this.lastStanding) {
3405
+ this.lastBlocked = blocked;
3406
+ this.lastStanding = standing;
3407
+ this.log(`Standing: ${standing}`);
3408
+ this.deps.onChange?.(blocked, standing);
3409
+ }
3410
+ }
3411
+ raiseWalls() {
3412
+ for (const b of this.boxes) {
3413
+ const wall = engine4.addEntity();
3414
+ Transform2.create(wall, {
3415
+ position: Vector3.create((b.minX + b.maxX) / 2, b.top / 2, (b.minZ + b.maxZ) / 2),
3416
+ scale: Vector3.create(b.maxX - b.minX, b.top, b.maxZ - b.minZ)
3417
+ });
3418
+ MeshCollider.setBox(wall, ColliderLayer.CL_PHYSICS);
3419
+ this.wallEntities.push(wall);
3420
+ }
3421
+ }
3422
+ lowerWalls() {
3423
+ for (const wall of this.wallEntities) engine4.removeEntity(wall);
3424
+ this.wallEntities = [];
3425
+ }
3426
+ /** The walls this copy has up (one per parcel while blocked) */
3427
+ get wallCount() {
3428
+ return this.wallEntities.length;
3429
+ }
3430
+ };
3431
+
2679
3432
  // src/ui/admin-panel-ui.tsx
2680
- var BAN_KICK_POSITION = Vector3.create(16, -50, 16);
2681
3433
  var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
2682
3434
  function figuresOf(value) {
2683
3435
  const figures = value?.figures;
@@ -2710,22 +3462,23 @@ function channelDeleteLines(look, changed) {
2710
3462
  lines.push("Stream history is kept");
2711
3463
  return lines;
2712
3464
  }
3465
+ var SEEN_COMMAND_IDS_MAX = 200;
2713
3466
  var C2 = {
2714
- bg: Color45.create(0.08, 0.08, 0.12, 0.98),
2715
- header: Color45.create(0.9, 0.15, 0.15, 1),
2716
- tabActive: Color45.create(0, 0.7, 0.7, 1),
2717
- tabInactive: Color45.create(0.15, 0.15, 0.2, 1),
2718
- section: Color45.create(0.12, 0.12, 0.18, 1),
2719
- btn: Color45.create(0.2, 0.2, 0.28, 1),
2720
- cyan: Color45.create(0, 0.8, 0.8, 1),
2721
- magenta: Color45.create(0.85, 0.2, 0.55, 1),
2722
- yellow: Color45.create(0.95, 0.75, 0.1, 1),
2723
- green: Color45.create(0.2, 0.75, 0.3, 1),
2724
- red: Color45.create(0.85, 0.2, 0.2, 1),
2725
- purple: Color45.create(0.6, 0.3, 0.85, 1),
2726
- orange: Color45.create(0.95, 0.5, 0.15, 1),
2727
- text: Color45.White(),
2728
- textDim: Color45.create(0.6, 0.6, 0.7, 1)
3467
+ bg: Color46.create(0.08, 0.08, 0.12, 0.98),
3468
+ header: Color46.create(0.9, 0.15, 0.15, 1),
3469
+ tabActive: Color46.create(0, 0.7, 0.7, 1),
3470
+ tabInactive: Color46.create(0.15, 0.15, 0.2, 1),
3471
+ section: Color46.create(0.12, 0.12, 0.18, 1),
3472
+ btn: Color46.create(0.2, 0.2, 0.28, 1),
3473
+ cyan: Color46.create(0, 0.8, 0.8, 1),
3474
+ magenta: Color46.create(0.85, 0.2, 0.55, 1),
3475
+ yellow: Color46.create(0.95, 0.75, 0.1, 1),
3476
+ green: Color46.create(0.2, 0.75, 0.3, 1),
3477
+ red: Color46.create(0.85, 0.2, 0.2, 1),
3478
+ purple: Color46.create(0.6, 0.3, 0.85, 1),
3479
+ orange: Color46.create(0.95, 0.5, 0.15, 1),
3480
+ text: Color46.White(),
3481
+ textDim: Color46.create(0.6, 0.6, 0.7, 1)
2729
3482
  };
2730
3483
  var AdminPanelUIModule = class {
2731
3484
  // UI scaling - uses shared client.uiScale
@@ -2767,34 +3520,90 @@ var AdminPanelUIModule = class {
2767
3520
  this.broadcastText = "";
2768
3521
  this.modStatus = "";
2769
3522
  this.modsFetched = false;
3523
+ // What the last kick sent from the Mod tab came to (2026-11-17): KICK ALL and the ban's kick are queued on
3524
+ // thestatic.tv, where every visitor's copy reads them
3525
+ this.kickStatus = "";
3526
+ // The Video and Broadcast buttons go through the same queue since 2026-11-18 (until then they reached the presser's
3527
+ // copy alone): what the last send from each came to, one line a section
3528
+ this.videoStatus = "";
3529
+ this.broadcastStatus = "";
3530
+ /** The url the screen last played - the scene's current one from the video state at load, or the last play here - which PLAYBACK Play sends */
3531
+ this.currentVideoUrl = null;
3532
+ // Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
3533
+ // status line, and the once-a-load gates for the declaration's upload and the saved state's read
3534
+ this.controls = [];
3535
+ this.currentOption = {};
3536
+ this.controlStatus = "";
3537
+ this.controlsUploaded = false;
3538
+ this.stateRead = false;
3539
+ /** init has read the video state: the saved control state may be read now (a persist control registered later reads then) */
3540
+ this.loadReadsDone = false;
3541
+ // The command poll (2026-11-18): the server's cursor, sent back as since once known, and the ids seen - the last
3542
+ // SEEN_COMMAND_IDS_MAX, this copy's own sends among them - so no command runs twice here
3543
+ this.commandCursor = null;
3544
+ this.seenCommandIds = /* @__PURE__ */ new Set();
3545
+ this.seenCommandOrder = [];
3546
+ this.controlLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3547
+ this.controlStatus = line;
3548
+ } };
3549
+ this.videoLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3550
+ this.videoStatus = line;
3551
+ } };
3552
+ this.broadcastLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3553
+ this.broadcastStatus = line;
3554
+ } };
3555
+ // Private mode (2026-11-19, Venue): the switch's state from the last read (null until an answer carries it), and the
3556
+ // MOD tab's line for the switch
3557
+ this.privateModeOn = null;
3558
+ this.privateStatus = "";
3559
+ this.privateLine = { sent: "Sent to everyone", notSent: "Not sent", show: (line) => {
3560
+ this.privateStatus = line;
3561
+ } };
2770
3562
  // --- UI Components ---
2771
- this.SectionHead = ({ label, color }) => /* @__PURE__ */ ReactEcs5.createElement(
2772
- UiEntity5,
3563
+ this.SectionHead = ({ label, color }) => /* @__PURE__ */ ReactEcs6.createElement(
3564
+ UiEntity6,
2773
3565
  {
2774
3566
  uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.sectionHeadHeight), margin: { bottom: 8 }, padding: { left: 10 }, alignItems: "center" },
2775
- uiBackground: { color: Color45.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
3567
+ uiBackground: { color: Color46.create(color.r * 0.3, color.g * 0.3, color.b * 0.3, 0.5) }
2776
3568
  },
2777
- /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: label, fontSize: this.theme.sectionHead, color })
3569
+ /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: label, fontSize: this.theme.sectionHead, color })
2778
3570
  );
2779
- this.TabBtn = ({ label, tab }) => /* @__PURE__ */ ReactEcs5.createElement(
2780
- Button3,
3571
+ this.TabBtn = ({ label, tab }) => /* @__PURE__ */ ReactEcs6.createElement(
3572
+ Button4,
2781
3573
  {
2782
3574
  uiTransform: { flexGrow: 1, height: this.s(UI_DIMENSIONS.admin.tabHeight), justifyContent: "center", alignItems: "center" },
2783
3575
  uiBackground: { color: this.activeTab === tab ? C2.tabActive : C2.tabInactive },
2784
3576
  value: label,
2785
3577
  fontSize: this.theme.tabButton,
2786
- color: this.activeTab === tab ? Color45.Black() : C2.text,
3578
+ color: this.activeTab === tab ? Color46.Black() : C2.text,
2787
3579
  textAlign: "middle-center",
2788
3580
  onMouseDown: () => this.setActiveTab(tab)
2789
3581
  }
2790
3582
  );
3583
+ /**
3584
+ * The CONTROLS tab (2026-11-18): a section per registered control, a button per option, OFF when the control has one,
3585
+ * the current option highlighted, and one status line for the last press. Listed first in the tab bar, only when
3586
+ * controls are registered, for the same admins the VIDEO tab is.
3587
+ */
3588
+ this.ControlsTab = () => {
3589
+ const t = this.theme;
3590
+ return /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.controls.map((control) => /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { key: `control-${control.id}`, uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: control.label, color: C2.cyan }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, control.options.map((option) => this.controlButton(control, option.id, option.label)), control.off === true && this.controlButton(control, "off", "OFF")))), this.controlStatus && /* @__PURE__ */ ReactEcs6.createElement(
3591
+ Label6,
3592
+ {
3593
+ value: this.controlStatus,
3594
+ fontSize: t.status,
3595
+ color: this.controlStatus.startsWith("Not sent") ? C2.red : C2.green,
3596
+ uiTransform: { height: this.s(18) }
3597
+ }
3598
+ ));
3599
+ };
2791
3600
  this.VideoTab = () => {
2792
3601
  if (!this.streamFetched) {
2793
3602
  this.fetchStreamData();
2794
3603
  }
2795
3604
  const t = this.theme;
2796
- return /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2797
- Button3,
3605
+ return /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, !this.streamData?.hasChannel && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "LIVE STREAM", color: C2.btn }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "No streaming channel linked", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { bottom: 8 } } }), this.isOwner && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3606
+ Button4,
2798
3607
  {
2799
3608
  uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2800
3609
  uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
@@ -2803,8 +3612,8 @@ var AdminPanelUIModule = class {
2803
3612
  color: C2.text,
2804
3613
  onMouseDown: () => this.claimTrial()
2805
3614
  }
2806
- ), this.trialClaimError && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs5.createElement(
2807
- Button3,
3615
+ ), this.trialClaimError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs6.createElement(
3616
+ Button4,
2808
3617
  {
2809
3618
  uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
2810
3619
  uiBackground: { color: this.channelCreating ? C2.btn : C2.cyan },
@@ -2813,47 +3622,47 @@ var AdminPanelUIModule = class {
2813
3622
  color: C2.text,
2814
3623
  onMouseDown: () => this.createChannel()
2815
3624
  }
2816
- ), this.channelCreateError && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Relay tier \u2022 $25/mo \u2022 8 hours streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })))), this.streamData?.hasChannel && this.isOwner && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2817
- Label5,
3625
+ ), this.channelCreateError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.channelCreateError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Relay tier \u2022 $25/mo \u2022 8 hours streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })))), this.streamData?.hasChannel && this.isOwner && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: this.streamData.isLive ? "LIVE STREAM" : "STREAM SETTINGS", color: this.streamData.isLive ? C2.red : C2.yellow }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 8 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3626
+ Label6,
2818
3627
  {
2819
3628
  value: this.streamData.isLive ? `LIVE \u2022 ${this.streamData.currentViewers || 0} viewers` : "OFFLINE",
2820
3629
  fontSize: t.label,
2821
3630
  color: this.streamData.isLive ? C2.red : C2.textDim
2822
3631
  }
2823
- ), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ ReactEcs5.createElement(
2824
- Label5,
3632
+ ), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: ` \u2022 ${this.streamData.tier?.toUpperCase() || "RELAY"}`, fontSize: t.labelSmall, color: C2.cyan }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: ` \u2022 ${this.streamData.sparksBalance || 0} Sparks`, fontSize: t.labelSmall, color: C2.textDim })), /* @__PURE__ */ ReactEcs6.createElement(
3633
+ Label6,
2825
3634
  {
2826
3635
  value: `Channel: ${this.streamData.channelName || this.streamData.channelId}`,
2827
3636
  fontSize: t.labelSmall,
2828
3637
  color: C2.textDim,
2829
3638
  uiTransform: { margin: { bottom: 10 } }
2830
3639
  }
2831
- ), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs5.createElement(
2832
- Label5,
3640
+ ), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "RTMP Server:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3641
+ Label6,
2833
3642
  {
2834
3643
  value: this.streamData.rtmpUrl || "Loading...",
2835
3644
  fontSize: t.label,
2836
3645
  color: this.streamData.rtmpUrl ? C2.text : C2.textDim,
2837
3646
  uiTransform: { margin: { left: 6 } }
2838
3647
  }
2839
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs5.createElement(
2840
- Label5,
3648
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream Key:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3649
+ Label6,
2841
3650
  {
2842
3651
  value: this.streamData.streamKey || "Loading...",
2843
3652
  fontSize: t.label,
2844
3653
  color: this.streamData.streamKey ? C2.cyan : C2.textDim,
2845
3654
  uiTransform: { margin: { left: 6 } }
2846
3655
  }
2847
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs5.createElement(
2848
- Label5,
3656
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3657
+ Label6,
2849
3658
  {
2850
3659
  value: this.streamData.hlsUrl || "Not available",
2851
3660
  fontSize: t.label,
2852
3661
  color: this.streamData.hlsUrl ? C2.green : C2.textDim,
2853
3662
  uiTransform: { margin: { left: 6 } }
2854
3663
  }
2855
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ ReactEcs5.createElement(
2856
- Button3,
3664
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ ReactEcs6.createElement(
3665
+ Button4,
2857
3666
  {
2858
3667
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2859
3668
  uiBackground: { color: this.streamControlling ? C2.btn : C2.green },
@@ -2862,8 +3671,8 @@ var AdminPanelUIModule = class {
2862
3671
  color: C2.text,
2863
3672
  onMouseDown: () => this.startStream()
2864
3673
  }
2865
- ), this.streamData.isLive && /* @__PURE__ */ ReactEcs5.createElement(
2866
- Button3,
3674
+ ), this.streamData.isLive && /* @__PURE__ */ ReactEcs6.createElement(
3675
+ Button4,
2867
3676
  {
2868
3677
  uiTransform: { width: this.s(110), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2869
3678
  uiBackground: { color: this.streamControlling ? C2.btn : C2.red },
@@ -2872,18 +3681,18 @@ var AdminPanelUIModule = class {
2872
3681
  color: C2.text,
2873
3682
  onMouseDown: () => this.stopStream()
2874
3683
  }
2875
- ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ ReactEcs5.createElement(
2876
- Button3,
3684
+ ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ ReactEcs6.createElement(
3685
+ Button4,
2877
3686
  {
2878
3687
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2879
3688
  uiBackground: { color: C2.cyan },
2880
3689
  value: "Play on Screen",
2881
3690
  fontSize: t.buttonSmall,
2882
3691
  color: C2.text,
2883
- onMouseDown: () => this.config.onVideoPlay?.(this.streamData.hlsUrl)
3692
+ onMouseDown: () => this.playStreamOnScreen(this.streamData.hlsUrl)
2884
3693
  }
2885
- )), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2886
- Button3,
3694
+ )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3695
+ Button4,
2887
3696
  {
2888
3697
  uiTransform: { width: this.s(80), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2889
3698
  uiBackground: { color: C2.btn },
@@ -2892,8 +3701,8 @@ var AdminPanelUIModule = class {
2892
3701
  color: C2.text,
2893
3702
  onMouseDown: () => this.refreshStreamStatus()
2894
3703
  }
2895
- ), /* @__PURE__ */ ReactEcs5.createElement(
2896
- Button3,
3704
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3705
+ Button4,
2897
3706
  {
2898
3707
  uiTransform: { width: this.s(95), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2899
3708
  uiBackground: { color: this.keyRotating ? C2.btn : C2.yellow },
@@ -2902,8 +3711,8 @@ var AdminPanelUIModule = class {
2902
3711
  color: C2.text,
2903
3712
  onMouseDown: () => this.rotateStreamKey()
2904
3713
  }
2905
- ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ ReactEcs5.createElement(
2906
- Button3,
3714
+ ), !this.streamData.isLive && !this.channelDeleteLook && /* @__PURE__ */ ReactEcs6.createElement(
3715
+ Button4,
2907
3716
  {
2908
3717
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2909
3718
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2912,8 +3721,8 @@ var AdminPanelUIModule = class {
2912
3721
  color: C2.text,
2913
3722
  onMouseDown: () => this.deleteChannel()
2914
3723
  }
2915
- )), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ ReactEcs5.createElement(Label5, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2916
- Button3,
3724
+ )), !this.streamData.isLive && this.channelDeleteLook && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 }, padding: 6 }, uiBackground: { color: C2.section } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "DELETE THIS CHANNEL?", fontSize: t.labelSmall, color: C2.red, uiTransform: { height: this.s(18) } }), channelDeleteLines(this.channelDeleteLook, this.channelDeleteChanged).map((line, i) => /* @__PURE__ */ ReactEcs6.createElement(Label6, { key: `delete-line-${i}`, value: line, fontSize: t.status, color: line.startsWith("WHAT") ? C2.yellow : C2.text, uiTransform: { height: this.s(18) } })), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", margin: { top: 4 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3725
+ Button4,
2917
3726
  {
2918
3727
  uiTransform: { width: this.s(120), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2919
3728
  uiBackground: { color: this.channelDeleting ? C2.btn : C2.red },
@@ -2922,8 +3731,8 @@ var AdminPanelUIModule = class {
2922
3731
  color: C2.text,
2923
3732
  onMouseDown: () => this.confirmDeleteChannel()
2924
3733
  }
2925
- ), /* @__PURE__ */ ReactEcs5.createElement(
2926
- Button3,
3734
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3735
+ Button4,
2927
3736
  {
2928
3737
  uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2929
3738
  uiBackground: { color: C2.btn },
@@ -2932,11 +3741,11 @@ var AdminPanelUIModule = class {
2932
3741
  color: C2.text,
2933
3742
  onMouseDown: () => this.cancelDeleteChannel()
2934
3743
  }
2935
- ))), this.streamControlStatus === "started" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3744
+ ))), this.streamControlStatus === "started" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream started - begin broadcasting in OBS", fontSize: t.status, color: C2.green }), this.streamControlStatus === "stopped" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream stopped", fontSize: t.status, color: C2.textDim }), this.keyRotateStatus === "success" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Key rotated! Update OBS", fontSize: t.status, color: C2.green }), this.keyRotateStatus === "error" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Failed to rotate key", fontSize: t.status, color: C2.red }), this.channelDeleteError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.channelDeleteError, fontSize: t.status, color: C2.red }), this.streamControlStatus === "error" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Stream control failed", fontSize: t.status, color: C2.red })), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PLAY NOW", color: C2.orange }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
2936
3745
  Input4,
2937
3746
  {
2938
3747
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
2939
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3748
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
2940
3749
  placeholder: "Video URL...",
2941
3750
  placeholderColor: C2.textDim,
2942
3751
  color: C2.text,
@@ -2946,20 +3755,18 @@ var AdminPanelUIModule = class {
2946
3755
  this.customVideoUrl = val;
2947
3756
  }
2948
3757
  }
2949
- ), /* @__PURE__ */ ReactEcs5.createElement(
2950
- Button3,
3758
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3759
+ Button4,
2951
3760
  {
2952
3761
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
2953
3762
  uiBackground: { color: C2.green },
2954
3763
  value: "Play",
2955
3764
  fontSize: t.button,
2956
3765
  color: C2.text,
2957
- onMouseDown: () => {
2958
- if (this.customVideoUrl) this.config.onVideoPlay?.(this.customVideoUrl);
2959
- }
3766
+ onMouseDown: () => this.playNow()
2960
3767
  }
2961
- ), /* @__PURE__ */ ReactEcs5.createElement(
2962
- Button3,
3768
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3769
+ Button4,
2963
3770
  {
2964
3771
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 6 } },
2965
3772
  uiBackground: { color: C2.btn },
@@ -2970,55 +3777,82 @@ var AdminPanelUIModule = class {
2970
3777
  this.customVideoUrl = "";
2971
3778
  }
2972
3779
  }
2973
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
2974
- Button3,
3780
+ )), this.videoStatus && /* @__PURE__ */ ReactEcs6.createElement(
3781
+ Label6,
3782
+ {
3783
+ value: this.videoStatus,
3784
+ fontSize: t.status,
3785
+ color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
3786
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3787
+ }
3788
+ ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3789
+ Button4,
2975
3790
  {
2976
3791
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2977
3792
  uiBackground: { color: C2.green },
2978
3793
  value: "Play",
2979
3794
  fontSize: t.button,
2980
3795
  color: C2.text,
2981
- onMouseDown: () => this.config.onCommand?.("videoPlay", { playing: true })
3796
+ onMouseDown: () => this.playbackPlay()
2982
3797
  }
2983
- ), /* @__PURE__ */ ReactEcs5.createElement(
2984
- Button3,
3798
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3799
+ Button4,
2985
3800
  {
2986
3801
  uiTransform: { width: this.s(75), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2987
3802
  uiBackground: { color: C2.red },
2988
3803
  value: "Stop",
2989
3804
  fontSize: t.button,
2990
3805
  color: C2.text,
2991
- onMouseDown: () => this.config.onVideoStop?.()
3806
+ onMouseDown: () => this.playbackStop()
2992
3807
  }
2993
- ), /* @__PURE__ */ ReactEcs5.createElement(
2994
- Button3,
3808
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3809
+ Button4,
2995
3810
  {
2996
3811
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
2997
3812
  uiBackground: { color: C2.btn },
2998
3813
  value: "Reset Default",
2999
3814
  fontSize: t.buttonSmall,
3000
3815
  color: C2.text,
3001
- onMouseDown: () => this.config.onCommand?.("videoClear", {})
3816
+ onMouseDown: () => this.resetDefault()
3002
3817
  }
3003
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(Button3, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 1", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot1") }), /* @__PURE__ */ ReactEcs5.createElement(Button3, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 2", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot2") }), /* @__PURE__ */ ReactEcs5.createElement(Button3, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 3", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot3") }), /* @__PURE__ */ ReactEcs5.createElement(Button3, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 4", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot4") }), /* @__PURE__ */ ReactEcs5.createElement(Button3, { uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 }, uiBackground: { color: C2.cyan }, value: "Play 5", fontSize: t.button, color: C2.text, onMouseDown: () => this.playSlot("slot5") })), /* @__PURE__ */ ReactEcs5.createElement(
3004
- Button3,
3818
+ )), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "VIDEO SLOTS", color: C2.cyan }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 10 } } }, ["slot1", "slot2", "slot3", "slot4", "slot5"].map((slot, i) => /* @__PURE__ */ ReactEcs6.createElement(
3819
+ Button4,
3820
+ {
3821
+ key: `play-${slot}`,
3822
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3823
+ uiBackground: { color: C2.cyan },
3824
+ value: `Play ${i + 1}`,
3825
+ fontSize: t.button,
3826
+ color: C2.text,
3827
+ onMouseDown: () => this.pressSlot(slot)
3828
+ }
3829
+ ))), /* @__PURE__ */ ReactEcs6.createElement(
3830
+ Button4,
3005
3831
  {
3006
3832
  uiTransform: { height: this.s(24) },
3007
- uiBackground: { color: Color45.create(0, 0, 0, 0) },
3833
+ uiBackground: { color: Color46.create(0, 0, 0, 0) },
3008
3834
  value: "Edit slots at thestatic.tv",
3009
3835
  fontSize: t.labelSmall,
3010
3836
  color: C2.cyan,
3011
- onMouseDown: () => openExternalUrl3({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3837
+ onMouseDown: () => openExternalUrl5({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3012
3838
  }
3013
3839
  ));
3014
3840
  };
3015
3841
  this.ModTab = () => {
3016
3842
  const t = this.theme;
3017
- return /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "Error - check input", fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3843
+ return /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", width: "100%", padding: 10 } }, this.modStatus === "loading" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Loading...", fontSize: t.status, color: C2.yellow }), this.modStatus === "saved" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Saved!", fontSize: t.status, color: C2.green }), this.modStatus === "error" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "Error - check input", fontSize: t.status, color: C2.red }), this.kickStatus && /* @__PURE__ */ ReactEcs6.createElement(
3844
+ Label6,
3845
+ {
3846
+ value: this.kickStatus,
3847
+ fontSize: t.status,
3848
+ color: this.kickStatus.startsWith("Kick not sent") ? C2.red : C2.green,
3849
+ uiTransform: { height: this.s(18) }
3850
+ }
3851
+ ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "BROADCAST", color: C2.orange }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3018
3852
  Input4,
3019
3853
  {
3020
3854
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3021
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3855
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
3022
3856
  placeholder: "Message to all players...",
3023
3857
  placeholderColor: C2.textDim,
3024
3858
  color: C2.text,
@@ -3028,8 +3862,8 @@ var AdminPanelUIModule = class {
3028
3862
  this.broadcastText = val;
3029
3863
  }
3030
3864
  }
3031
- ), /* @__PURE__ */ ReactEcs5.createElement(
3032
- Button3,
3865
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3866
+ Button4,
3033
3867
  {
3034
3868
  uiTransform: { width: this.s(65), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3035
3869
  uiBackground: { color: C2.orange },
@@ -3038,27 +3872,51 @@ var AdminPanelUIModule = class {
3038
3872
  color: C2.text,
3039
3873
  onMouseDown: () => this.sendBroadcast()
3040
3874
  }
3041
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3042
- Button3,
3875
+ )), this.broadcastStatus && /* @__PURE__ */ ReactEcs6.createElement(
3876
+ Label6,
3877
+ {
3878
+ value: this.broadcastStatus,
3879
+ fontSize: t.status,
3880
+ color: this.broadcastStatus.startsWith("Not sent") ? C2.red : C2.green,
3881
+ uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3882
+ }
3883
+ ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "CHAOS MODE", color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3884
+ Button4,
3043
3885
  {
3044
3886
  uiTransform: { width: this.s(130), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: 4 },
3045
3887
  uiBackground: { color: C2.red },
3046
3888
  value: "KICK ALL",
3047
3889
  fontSize: t.button,
3048
3890
  color: C2.text,
3049
- onMouseDown: () => {
3050
- this.log("KICK ALL clicked");
3051
- this.config.onCommand?.("kickAll", {});
3052
- }
3891
+ onMouseDown: () => this.kickAll()
3053
3892
  }
3054
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ ReactEcs5.createElement(
3055
- UiEntity5,
3893
+ )), this.venue && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PRIVATE MODE", color: C2.yellow }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "While ON, only citizens get in", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { height: this.s(18), margin: { bottom: 4 } } }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap" } }, [true, false].map((on) => /* @__PURE__ */ ReactEcs6.createElement(
3894
+ Button4,
3895
+ {
3896
+ key: `private-${on ? "on" : "off"}`,
3897
+ uiTransform: { width: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
3898
+ uiBackground: { color: this.privateModeOn === on ? C2.yellow : C2.btn },
3899
+ value: on ? "ON" : "OFF",
3900
+ fontSize: t.buttonSmall,
3901
+ color: this.privateModeOn === on ? Color46.Black() : C2.text,
3902
+ onMouseDown: () => this.setPrivateMode(on)
3903
+ }
3904
+ ))), this.privateStatus && /* @__PURE__ */ ReactEcs6.createElement(
3905
+ Label6,
3906
+ {
3907
+ value: this.privateStatus,
3908
+ fontSize: t.status,
3909
+ color: this.privateStatus.startsWith("Not sent") ? C2.red : C2.green,
3910
+ uiTransform: { height: this.s(18) }
3911
+ }
3912
+ )), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "SCENE ADMINS", color: C2.purple }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.sceneAdmins.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "No scene admins", fontSize: t.labelSmall, color: C2.textDim }), this.sceneAdmins.map((wallet, i) => /* @__PURE__ */ ReactEcs6.createElement(
3913
+ UiEntity6,
3056
3914
  {
3057
3915
  key: `admin-${i}`,
3058
3916
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3059
3917
  },
3060
- /* @__PURE__ */ ReactEcs5.createElement(
3061
- Label5,
3918
+ /* @__PURE__ */ ReactEcs6.createElement(
3919
+ Label6,
3062
3920
  {
3063
3921
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3064
3922
  fontSize: t.label,
@@ -3066,8 +3924,8 @@ var AdminPanelUIModule = class {
3066
3924
  uiTransform: { width: this.s(130) }
3067
3925
  }
3068
3926
  ),
3069
- /* @__PURE__ */ ReactEcs5.createElement(
3070
- Button3,
3927
+ /* @__PURE__ */ ReactEcs6.createElement(
3928
+ Button4,
3071
3929
  {
3072
3930
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3073
3931
  uiBackground: { color: C2.btn },
@@ -3077,11 +3935,11 @@ var AdminPanelUIModule = class {
3077
3935
  onMouseDown: () => this.removeSceneAdmin(wallet)
3078
3936
  }
3079
3937
  )
3080
- ))), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3938
+ ))), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3081
3939
  Input4,
3082
3940
  {
3083
3941
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3084
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3942
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
3085
3943
  placeholder: "0x... add admin",
3086
3944
  placeholderColor: C2.textDim,
3087
3945
  color: C2.text,
@@ -3091,8 +3949,8 @@ var AdminPanelUIModule = class {
3091
3949
  this.newAdminWallet = val;
3092
3950
  }
3093
3951
  }
3094
- ), /* @__PURE__ */ ReactEcs5.createElement(
3095
- Button3,
3952
+ ), /* @__PURE__ */ ReactEcs6.createElement(
3953
+ Button4,
3096
3954
  {
3097
3955
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3098
3956
  uiBackground: { color: C2.purple },
@@ -3103,14 +3961,14 @@ var AdminPanelUIModule = class {
3103
3961
  if (this.newAdminWallet) this.addSceneAdmin(this.newAdminWallet);
3104
3962
  }
3105
3963
  }
3106
- )), /* @__PURE__ */ ReactEcs5.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ ReactEcs5.createElement(
3107
- UiEntity5,
3964
+ )), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "BANNED WALLETS", color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 6 } } }, this.bannedWallets.length === 0 && this.modStatus !== "loading" && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "No banned wallets", fontSize: t.labelSmall, color: C2.textDim }), this.bannedWallets.map((wallet, i) => /* @__PURE__ */ ReactEcs6.createElement(
3965
+ UiEntity6,
3108
3966
  {
3109
3967
  key: `ban-${i}`,
3110
3968
  uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 5 }, width: "100%" }
3111
3969
  },
3112
- /* @__PURE__ */ ReactEcs5.createElement(
3113
- Label5,
3970
+ /* @__PURE__ */ ReactEcs6.createElement(
3971
+ Label6,
3114
3972
  {
3115
3973
  value: `${wallet.slice(0, 6)}...${wallet.slice(-4)}`,
3116
3974
  fontSize: t.label,
@@ -3118,8 +3976,8 @@ var AdminPanelUIModule = class {
3118
3976
  uiTransform: { width: this.s(130) }
3119
3977
  }
3120
3978
  ),
3121
- /* @__PURE__ */ ReactEcs5.createElement(
3122
- Button3,
3979
+ /* @__PURE__ */ ReactEcs6.createElement(
3980
+ Button4,
3123
3981
  {
3124
3982
  uiTransform: { width: this.s(70), height: this.s(28), margin: { left: 8 } },
3125
3983
  uiBackground: { color: C2.green },
@@ -3129,11 +3987,11 @@ var AdminPanelUIModule = class {
3129
3987
  onMouseDown: () => this.unbanWallet(wallet)
3130
3988
  }
3131
3989
  )
3132
- ))), /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs5.createElement(
3990
+ ))), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", alignItems: "center", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3133
3991
  Input4,
3134
3992
  {
3135
3993
  uiTransform: { width: this.s(230), height: this.s(UI_DIMENSIONS.admin.inputHeight) },
3136
- uiBackground: { color: Color45.create(0.15, 0.15, 0.2, 1) },
3994
+ uiBackground: { color: Color46.create(0.15, 0.15, 0.2, 1) },
3137
3995
  placeholder: "0x... ban wallet",
3138
3996
  placeholderColor: C2.textDim,
3139
3997
  color: C2.text,
@@ -3143,8 +4001,8 @@ var AdminPanelUIModule = class {
3143
4001
  this.newBanWallet = val;
3144
4002
  }
3145
4003
  }
3146
- ), /* @__PURE__ */ ReactEcs5.createElement(
3147
- Button3,
4004
+ ), /* @__PURE__ */ ReactEcs6.createElement(
4005
+ Button4,
3148
4006
  {
3149
4007
  uiTransform: { width: this.s(60), height: this.s(UI_DIMENSIONS.admin.inputHeight), margin: { left: 8 } },
3150
4008
  uiBackground: { color: C2.red },
@@ -3155,15 +4013,15 @@ var AdminPanelUIModule = class {
3155
4013
  if (this.newBanWallet) this.banWallet(this.newBanWallet);
3156
4014
  }
3157
4015
  }
3158
- )), /* @__PURE__ */ ReactEcs5.createElement(
3159
- Button3,
4016
+ )), /* @__PURE__ */ ReactEcs6.createElement(
4017
+ Button4,
3160
4018
  {
3161
4019
  uiTransform: { height: this.s(24) },
3162
- uiBackground: { color: Color45.create(0, 0, 0, 0) },
4020
+ uiBackground: { color: Color46.create(0, 0, 0, 0) },
3163
4021
  value: "Manage at thestatic.tv",
3164
4022
  fontSize: t.labelSmall,
3165
4023
  color: C2.cyan,
3166
- onMouseDown: () => openExternalUrl3({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4024
+ onMouseDown: () => openExternalUrl5({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3167
4025
  }
3168
4026
  ));
3169
4027
  };
@@ -3172,11 +4030,24 @@ var AdminPanelUIModule = class {
3172
4030
  * Always renders notification (scaled), admin panel only for admins
3173
4031
  */
3174
4032
  this.getComponent = () => {
4033
+ if (this.moderation.blocked) {
4034
+ return BlockedNotice({
4035
+ standing: this.moderation.standing,
4036
+ kickLeftMs: this.moderation.kickLeftMs,
4037
+ scale: this.client.uiScale,
4038
+ // thestatic.tv's own origin, for a private event's BECOME A CITIZEN (2026-11-19): the API base less its path, as
4039
+ // the chat's REGISTER IDENTITY derives its /login
4040
+ siteUrl: this.baseUrl.replace("/api/v1/dcl", "")
4041
+ });
4042
+ }
3175
4043
  if (!this.isAdmin) {
3176
4044
  return this.renderScaledNotification();
3177
4045
  }
3178
4046
  const t = this.theme;
3179
4047
  const tabs = [];
4048
+ if (this.venue && this.controls.length > 0) {
4049
+ tabs.push({ label: "CONTROLS", id: "controls" });
4050
+ }
3180
4051
  if (this.config.sceneTabs && this.config.sceneTabs.length > 0) {
3181
4052
  this.config.sceneTabs.forEach((tab) => tabs.push({ label: tab.label, id: tab.id }));
3182
4053
  }
@@ -3189,8 +4060,8 @@ var AdminPanelUIModule = class {
3189
4060
  if (!tabs.find((tab) => tab.id === this.activeTab) && tabs.length > 0) {
3190
4061
  this.activeTab = tabs[0].id;
3191
4062
  }
3192
- return /* @__PURE__ */ ReactEcs5.createElement(
3193
- UiEntity5,
4063
+ return /* @__PURE__ */ ReactEcs6.createElement(
4064
+ UiEntity6,
3194
4065
  {
3195
4066
  uiTransform: {
3196
4067
  width: "100%",
@@ -3199,16 +4070,16 @@ var AdminPanelUIModule = class {
3199
4070
  }
3200
4071
  },
3201
4072
  this.renderScaledNotification(),
3202
- /* @__PURE__ */ ReactEcs5.createElement(
3203
- UiEntity5,
4073
+ /* @__PURE__ */ ReactEcs6.createElement(
4074
+ UiEntity6,
3204
4075
  {
3205
4076
  uiTransform: {
3206
4077
  position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
3207
4078
  positionType: "absolute"
3208
4079
  }
3209
4080
  },
3210
- /* @__PURE__ */ ReactEcs5.createElement(
3211
- Button3,
4081
+ /* @__PURE__ */ ReactEcs6.createElement(
4082
+ Button4,
3212
4083
  {
3213
4084
  uiTransform: { width: this.s(100), height: this.s(45) },
3214
4085
  uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
@@ -3219,8 +4090,8 @@ var AdminPanelUIModule = class {
3219
4090
  }
3220
4091
  )
3221
4092
  ),
3222
- this.panelOpen && /* @__PURE__ */ ReactEcs5.createElement(
3223
- UiEntity5,
4093
+ this.panelOpen && /* @__PURE__ */ ReactEcs6.createElement(
4094
+ UiEntity6,
3224
4095
  {
3225
4096
  key: `admin-panel-${this.client.uiScale}`,
3226
4097
  uiTransform: {
@@ -3233,8 +4104,8 @@ var AdminPanelUIModule = class {
3233
4104
  },
3234
4105
  uiBackground: { color: C2.bg }
3235
4106
  },
3236
- /* @__PURE__ */ ReactEcs5.createElement(
3237
- UiEntity5,
4107
+ /* @__PURE__ */ ReactEcs6.createElement(
4108
+ UiEntity6,
3238
4109
  {
3239
4110
  uiTransform: {
3240
4111
  width: "100%",
@@ -3246,12 +4117,12 @@ var AdminPanelUIModule = class {
3246
4117
  },
3247
4118
  uiBackground: { color: C2.header }
3248
4119
  },
3249
- /* @__PURE__ */ ReactEcs5.createElement(Label5, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
3250
- /* @__PURE__ */ ReactEcs5.createElement(
3251
- Button3,
4120
+ /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.config.title || "ADMIN PANEL", fontSize: t.header, color: C2.text }),
4121
+ /* @__PURE__ */ ReactEcs6.createElement(
4122
+ Button4,
3252
4123
  {
3253
4124
  uiTransform: { width: this.s(28), height: this.s(28) },
3254
- uiBackground: { color: Color45.create(0, 0, 0, 0.3) },
4125
+ uiBackground: { color: Color46.create(0, 0, 0, 0.3) },
3255
4126
  value: "X",
3256
4127
  fontSize: t.header,
3257
4128
  color: THEME.colors.red,
@@ -3259,9 +4130,9 @@ var AdminPanelUIModule = class {
3259
4130
  }
3260
4131
  )
3261
4132
  ),
3262
- /* @__PURE__ */ ReactEcs5.createElement(UiEntity5, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ ReactEcs5.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
3263
- /* @__PURE__ */ ReactEcs5.createElement(
3264
- UiEntity5,
4133
+ /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { width: "100%", height: this.s(UI_DIMENSIONS.admin.tabHeight), flexDirection: "row" } }, tabs.map((tab) => /* @__PURE__ */ ReactEcs6.createElement(this.TabBtn, { label: tab.label, tab: tab.id }))),
4134
+ /* @__PURE__ */ ReactEcs6.createElement(
4135
+ UiEntity6,
3265
4136
  {
3266
4137
  uiTransform: {
3267
4138
  width: "100%",
@@ -3270,12 +4141,13 @@ var AdminPanelUIModule = class {
3270
4141
  flexDirection: "column"
3271
4142
  }
3272
4143
  },
3273
- this.activeTab === "video" && /* @__PURE__ */ ReactEcs5.createElement(this.VideoTab, null),
3274
- this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ ReactEcs5.createElement(this.ModTab, null),
4144
+ this.activeTab === "controls" && this.venue && this.controls.length > 0 && /* @__PURE__ */ ReactEcs6.createElement(this.ControlsTab, null),
4145
+ this.activeTab === "video" && /* @__PURE__ */ ReactEcs6.createElement(this.VideoTab, null),
4146
+ this.activeTab === "mod" && this.isOwner && /* @__PURE__ */ ReactEcs6.createElement(this.ModTab, null),
3275
4147
  this.config.sceneTabs?.map((tab) => this.activeTab === tab.id && tab.render())
3276
4148
  ),
3277
- /* @__PURE__ */ ReactEcs5.createElement(
3278
- UiEntity5,
4149
+ /* @__PURE__ */ ReactEcs6.createElement(
4150
+ UiEntity6,
3279
4151
  {
3280
4152
  uiTransform: {
3281
4153
  width: "100%",
@@ -3285,15 +4157,15 @@ var AdminPanelUIModule = class {
3285
4157
  },
3286
4158
  uiBackground: { color: C2.section }
3287
4159
  },
3288
- /* @__PURE__ */ ReactEcs5.createElement(
3289
- Button3,
4160
+ /* @__PURE__ */ ReactEcs6.createElement(
4161
+ Button4,
3290
4162
  {
3291
4163
  uiTransform: { height: this.s(24) },
3292
- uiBackground: { color: Color45.create(0, 0, 0, 0) },
4164
+ uiBackground: { color: Color46.create(0, 0, 0, 0) },
3293
4165
  value: `thestatic.tv/scene/${this.config.sceneId}`,
3294
4166
  fontSize: t.labelSmall,
3295
4167
  color: C2.cyan,
3296
- onMouseDown: () => openExternalUrl3({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
4168
+ onMouseDown: () => openExternalUrl5({ url: this.config.footerLink || `https://thestatic.tv/scene/${this.config.sceneId}` })
3297
4169
  }
3298
4170
  )
3299
4171
  )
@@ -3314,14 +4186,41 @@ var AdminPanelUIModule = class {
3314
4186
  // Ensure sceneId is set
3315
4187
  };
3316
4188
  this.baseUrl = client.getBaseUrl();
4189
+ this.moderation = new ModerationModule({
4190
+ reread: () => this.checkAdminStatus(),
4191
+ myWallet: () => this.myWallet(),
4192
+ onChange: (blocked, standing) => this.onStandingChange(blocked, standing),
4193
+ log: (msg, ...args) => this.log(msg, ...args)
4194
+ });
4195
+ this.adminWait = new PlayerWait({
4196
+ getPlayer: () => getPlayer2(),
4197
+ setInterval: dclSetInterval,
4198
+ clearInterval: dclClearInterval,
4199
+ check: (player) => this.checkAdminFor(player),
4200
+ log: (msg) => this.log(msg)
4201
+ });
3317
4202
  if (config.headerColor) {
3318
- C2.header = Color45.create(
4203
+ C2.header = Color46.create(
3319
4204
  config.headerColor.r,
3320
4205
  config.headerColor.g,
3321
4206
  config.headerColor.b,
3322
4207
  config.headerColor.a
3323
4208
  );
3324
4209
  }
4210
+ if (config.controls && config.controls.length > 0) this.registerControls(config.controls);
4211
+ }
4212
+ kickLine(sent) {
4213
+ return { sent, notSent: "Kick not sent", show: (line) => {
4214
+ this.kickStatus = line;
4215
+ } };
4216
+ }
4217
+ /**
4218
+ * The Venue tier (2026-11-19): scene controls and private mode are Venue's, so the CONTROLS tab, the declaration's
4219
+ * upload, a press, the saved state's read, a queued control's run and the private-mode switch all need it. The
4220
+ * client knows it from the session start, before this panel exists.
4221
+ */
4222
+ get venue() {
4223
+ return this.client.hasVenueFeatures === true;
3325
4224
  }
3326
4225
  log(msg, ...args) {
3327
4226
  if (this.config.debug) {
@@ -3340,26 +4239,36 @@ var AdminPanelUIModule = class {
3340
4239
  * Initialize the admin panel - checks admin status and fetches video state
3341
4240
  */
3342
4241
  async init() {
4242
+ this.moderation.start().catch(() => {
4243
+ });
3343
4244
  await this.checkAdminStatus();
3344
4245
  await this.fetchVideoState();
3345
4246
  this.autoPlayDefault();
4247
+ this.loadReadsDone = true;
4248
+ await this.readSavedState();
3346
4249
  this.startCommandPolling();
3347
4250
  this.log("Initialized");
3348
4251
  }
3349
4252
  /**
3350
- * Check if current player is an admin for this scene
4253
+ * Check if current player is an admin for this scene. With no player yet it waits for one on the SDK's timer and
4254
+ * checks then (utils/player-wait.ts): one wait at a time, ended quietly after 30 s with no wallet. A guest reading
4255
+ * (isGuest true) is checked at once and the wait goes on for a non-guest reading, checked once more if one comes
4256
+ * within the 30 s. Resolves when the check is done, or at once when there is none to run.
3351
4257
  */
3352
4258
  async checkAdminStatus() {
3353
- const player = getPlayer2();
3354
- if (!player?.userId) {
3355
- this.log("No player data yet");
3356
- return;
3357
- }
4259
+ await this.adminWait.run();
4260
+ }
4261
+ /** The admin check proper, for a player the explorer has resolved */
4262
+ async checkAdminFor(player) {
3358
4263
  this.playerWallet = player.userId;
3359
4264
  if (this.config.forceAdmin) {
3360
4265
  this.isAdmin = true;
3361
4266
  this.isOwner = true;
4267
+ this.moderation.applyStanding({ isBanned: false, canModerate: true });
3362
4268
  this.log("Admin status FORCED (forceAdmin: true)");
4269
+ this.uploadControls().catch(() => {
4270
+ });
4271
+ this.client.frames?.adminCheckSucceeded();
3363
4272
  return;
3364
4273
  }
3365
4274
  try {
@@ -3370,17 +4279,54 @@ var AdminPanelUIModule = class {
3370
4279
  const data = await res.json();
3371
4280
  this.isAdmin = data.showButton ?? data.hasAccess;
3372
4281
  this.isOwner = data.isOwner || data.isSceneAdmin;
3373
- if (data.isBanned) {
4282
+ const wasBanned = this.moderation.standing === "banned";
4283
+ if (typeof data.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
4284
+ this.moderation.applyStanding({
4285
+ isBanned: data.isBanned === true,
4286
+ canModerate: data.showButton === true || data.hasAccess === true,
4287
+ privateBlocked: data.privateBlocked === true,
4288
+ isCitizen: data.isCitizen === true
4289
+ });
4290
+ if (data.isBanned === true && !wasBanned) {
3374
4291
  this.config.onBroadcast?.("You have been banned from this scene.");
3375
- this.banKickPlayer();
3376
- this.log("Player is banned - kicking");
4292
+ this.log("Player is banned - blocked");
3377
4293
  }
3378
4294
  this.log("Admin status:", this.isAdmin, "Owner:", this.isOwner);
4295
+ if (this.isAdmin) this.uploadControls().catch(() => {
4296
+ });
4297
+ if (this.isAdmin) this.client.frames?.adminCheckSucceeded();
3379
4298
  }
3380
4299
  } catch (err) {
3381
4300
  this.log("Admin check error:", err);
3382
4301
  }
3383
4302
  }
4303
+ /** My wallet, lowercased: admin-check's player, else the explorer's */
4304
+ myWallet() {
4305
+ let wallet = this.playerWallet;
4306
+ if (!wallet) {
4307
+ try {
4308
+ wallet = getPlayer2()?.userId || "";
4309
+ } catch {
4310
+ wallet = "";
4311
+ }
4312
+ }
4313
+ return wallet ? wallet.toLowerCase() : null;
4314
+ }
4315
+ /** Blocked turned on or off: the panel closes, and the client stops what it plays and tells the scene */
4316
+ onStandingChange(blocked, standing) {
4317
+ if (blocked) this.hide();
4318
+ this.client._onBlockedChange?.(blocked, standing);
4319
+ }
4320
+ /** True while this visitor is banned or kicked (2026-11-17) */
4321
+ get isVisitorBlocked() {
4322
+ return this.moderation.blocked;
4323
+ }
4324
+ /** A url the scene's queue or the slots would play - nothing while this visitor is blocked */
4325
+ playUrl(url) {
4326
+ if (this.moderation.blocked) return;
4327
+ this.currentVideoUrl = url;
4328
+ this.config.onVideoPlay?.(url);
4329
+ }
3384
4330
  /**
3385
4331
  * Toggle the admin panel open/closed
3386
4332
  */
@@ -3432,6 +4378,128 @@ var AdminPanelUIModule = class {
3432
4378
  this.config.sceneTabs.push(tab);
3433
4379
  this.log("Registered scene tab:", tab.label);
3434
4380
  }
4381
+ // --- Scene controls (2026-11-18; Venue since 2026-11-19, Pro until then) ---
4382
+ /**
4383
+ * Register scene controls: the CONTROLS tab draws them, a press reaches every visitor's copy through the scene's
4384
+ * queue, and the declaration goes to the scene's record once an admin's check has succeeded. The same as the config's
4385
+ * `controls`; a control registered again by id replaces the earlier one. Only the shape is checked here - thestatic.tv
4386
+ * checks the ids, labels and bounds when the declaration is uploaded, and every press against it.
4387
+ */
4388
+ registerControls(controls) {
4389
+ for (const control of controls) {
4390
+ if (!control || typeof control.id !== "string" || !Array.isArray(control.options) || typeof control.onChange !== "function") {
4391
+ this.log("Scene control skipped - not a SceneControl:", control);
4392
+ continue;
4393
+ }
4394
+ const at = this.controls.findIndex((c) => c.id === control.id);
4395
+ if (at >= 0) this.controls[at] = control;
4396
+ else this.controls.push(control);
4397
+ }
4398
+ this.log("Registered scene controls:", this.controls.map((c) => c.id));
4399
+ this.readSavedState().catch(() => {
4400
+ });
4401
+ this.uploadControls().catch(() => {
4402
+ });
4403
+ }
4404
+ /** True when `option` is one of the control's, or 'off' on a control that has OFF */
4405
+ isControlOption(control, option) {
4406
+ if (option === "off") return control.off === true;
4407
+ return control.options.some((o) => o.id === option);
4408
+ }
4409
+ /** A queued sceneControl's registered control and valid option, or null for anything else */
4410
+ controlCommand(payload) {
4411
+ const p = payload;
4412
+ if (!p || typeof p.control !== "string" || typeof p.option !== "string") return null;
4413
+ const control = this.controls.find((c) => c.id === p.control);
4414
+ if (!control || !this.isControlOption(control, p.option)) return null;
4415
+ return { control, option: p.option };
4416
+ }
4417
+ /** Run a control's option on this copy and mark it current; a handler that throws is logged and breaks nothing else */
4418
+ applyControl(control, option) {
4419
+ this.currentOption[control.id] = option;
4420
+ try {
4421
+ control.onChange(option);
4422
+ } catch (err) {
4423
+ this.log("Control handler failed:", control.id, option, err);
4424
+ }
4425
+ }
4426
+ /** A press in the CONTROLS tab: this copy runs it at once, then everyone's through the queue (Venue, 2026-11-19) */
4427
+ async pressControl(control, option) {
4428
+ if (!this.venue) return;
4429
+ this.applyControl(control, option);
4430
+ await this.sendSceneCommand("sceneControl", { control: control.id, option }, this.controlLine);
4431
+ }
4432
+ /**
4433
+ * The saved option of every persist control, read once a load from the scene's public state route - after the admin
4434
+ * check and the video state, before the poll starts - and run on this copy, so a late arrival sees what the last
4435
+ * press set. A saved option that is not one of the control's is ignored, as is a failed read; a control with no saved
4436
+ * option keeps the scene's own default.
4437
+ */
4438
+ async readSavedState() {
4439
+ if (this.stateRead || !this.loadReadsDone || !this.venue) return;
4440
+ const persisted = this.controls.filter((c) => c.persist === true);
4441
+ if (persisted.length === 0) return;
4442
+ this.stateRead = true;
4443
+ try {
4444
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/state`);
4445
+ if (!res.ok) {
4446
+ this.log("Scene state read refused:", res.status);
4447
+ return;
4448
+ }
4449
+ const data = await res.json();
4450
+ const state = data && typeof data.state === "object" && data.state !== null ? data.state : {};
4451
+ for (const control of persisted) {
4452
+ const saved = state[control.id];
4453
+ if (typeof saved === "string" && this.isControlOption(control, saved)) {
4454
+ this.log("Saved control option:", control.id, saved);
4455
+ this.applyControl(control, saved);
4456
+ }
4457
+ }
4458
+ } catch (err) {
4459
+ this.log("Scene state read error:", err);
4460
+ }
4461
+ }
4462
+ /**
4463
+ * The declaration - each control's id, label, options, off and persist, never its handler - posted once a load to the
4464
+ * scene's record on thestatic.tv, from a copy whose admin check succeeded, so the scene's page draws the same buttons.
4465
+ * thestatic.tv checks the shape and bounds and writes only a declaration that differs. A refusal is logged, never
4466
+ * shown to the visitor, and not retried in this load.
4467
+ */
4468
+ async uploadControls() {
4469
+ if (this.controlsUploaded || !this.isAdmin || !this.venue || this.controls.length === 0) return;
4470
+ this.controlsUploaded = true;
4471
+ const controls = this.controls.map((c) => ({
4472
+ id: c.id,
4473
+ label: c.label,
4474
+ options: c.options.map((o) => ({ id: o.id, label: o.label })),
4475
+ off: c.off === true,
4476
+ persist: c.persist === true
4477
+ }));
4478
+ try {
4479
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/config`, {
4480
+ method: "POST",
4481
+ headers: { "Content-Type": "application/json" },
4482
+ body: JSON.stringify({ controls })
4483
+ });
4484
+ if (res.ok) {
4485
+ this.log("Scene controls declared:", controls.map((c) => c.id));
4486
+ return;
4487
+ }
4488
+ const data = await res.json().catch(() => ({}));
4489
+ this.log("Scene controls declaration refused:", res.status, data.error);
4490
+ } catch (err) {
4491
+ this.log("Scene controls declaration error:", err);
4492
+ }
4493
+ }
4494
+ /** Remember a command id the poll has run or this copy has sent, forgetting the oldest past SEEN_COMMAND_IDS_MAX */
4495
+ markCommandSeen(id) {
4496
+ if (this.seenCommandIds.has(id)) return;
4497
+ this.seenCommandIds.add(id);
4498
+ this.seenCommandOrder.push(id);
4499
+ while (this.seenCommandOrder.length > SEEN_COMMAND_IDS_MAX) {
4500
+ this.seenCommandIds.delete(this.seenCommandOrder.shift());
4501
+ }
4502
+ }
3435
4503
  // --- Stream Polling ---
3436
4504
  startStreamPolling() {
3437
4505
  if (this.pollIntervalId !== null) return;
@@ -3472,52 +4540,91 @@ var AdminPanelUIModule = class {
3472
4540
  * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
3473
4541
  */
3474
4542
  async signedRequest(url, init = {}) {
3475
- const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
4543
+ const res = await signedFetch3({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
3476
4544
  return {
3477
4545
  ok: res.ok,
3478
4546
  status: res.status,
3479
4547
  json: async () => res.body ? JSON.parse(res.body) : {}
3480
4548
  };
3481
4549
  }
4550
+ /**
4551
+ * Every visitor's copy reads the scene's queue (a public GET, every 5 s). Since 2026-11-18 the poll sends the server's
4552
+ * cursor back as `since` once it has one - the first poll has none, so the 30-second replay on load stays, which the
4553
+ * kicks rely on - and tells commands apart by id: a bounded set of the last SEEN_COMMAND_IDS_MAX, this copy's own
4554
+ * sends among them (a press is not run twice here), so two commands in one millisecond both run. A command with no id
4555
+ * falls back to the timestamp rule every command used until then, and a server that answers no cursor (production
4556
+ * before 2026-11-18) gets no since and is read as before.
4557
+ */
3482
4558
  async pollCommands() {
3483
4559
  try {
3484
- const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands`);
4560
+ const since = this.commandCursor !== null ? `?since=${this.commandCursor}` : "";
4561
+ const res = await fetch(`${this.baseUrl}/scene/${this.config.sceneId}/commands${since}`);
3485
4562
  if (!res.ok) return;
3486
4563
  const data = await res.json();
3487
4564
  const commands = data.commands || [];
4565
+ if (typeof data.cursor === "number") this.commandCursor = data.cursor;
3488
4566
  for (const cmd of commands) {
3489
- if (cmd.timestamp <= this.lastCommandTimestamp) continue;
3490
- this.lastCommandTimestamp = cmd.timestamp;
3491
- if (cmd.type === "broadcast" && cmd.payload?.text) {
3492
- const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
3493
- this.log("Received broadcast:", msg);
3494
- this.config.onBroadcast?.(msg);
3495
- } else if (cmd.type === "clearBroadcast") {
3496
- this.log("Received clearBroadcast");
3497
- hideNotification();
3498
- } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
3499
- this.log("Received video play:", cmd.type, cmd.payload.url);
3500
- this.config.onVideoPlay?.(cmd.payload.url);
3501
- } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
3502
- this.log("Received video stop/clear:", cmd.type);
3503
- this.config.onVideoStop?.();
3504
- } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
3505
- const slotId = cmd.payload.slot;
3506
- if (cmd.payload.url) {
3507
- this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
3508
- this.config.onVideoPlay?.(cmd.payload.url);
3509
- } else {
3510
- this.log("Received videoPlaySlot:", slotId);
3511
- this.playSlot(slotId);
3512
- }
3513
- } else if (this.config.onCommand) {
3514
- this.log("Received command:", cmd.type, cmd.payload);
3515
- this.config.onCommand(cmd.type, cmd.payload);
4567
+ if (typeof cmd.id === "string" && cmd.id !== "") {
4568
+ if (this.seenCommandIds.has(cmd.id)) continue;
4569
+ this.markCommandSeen(cmd.id);
4570
+ if (typeof cmd.timestamp === "number" && cmd.timestamp > this.lastCommandTimestamp) this.lastCommandTimestamp = cmd.timestamp;
4571
+ } else {
4572
+ if (cmd.timestamp <= this.lastCommandTimestamp) continue;
4573
+ this.lastCommandTimestamp = cmd.timestamp;
4574
+ }
4575
+ try {
4576
+ this.runCommand(cmd);
4577
+ } catch (err) {
4578
+ this.log("Command handler failed:", cmd.type, err);
3516
4579
  }
3517
4580
  }
3518
4581
  } catch (err) {
3519
4582
  }
3520
4583
  }
4584
+ /** One queued command on this copy: the SDK's own types here, a registered control's option, else the scene's onCommand */
4585
+ runCommand(cmd) {
4586
+ const control = cmd.type === "sceneControl" && this.venue ? this.controlCommand(cmd.payload) : null;
4587
+ if (cmd.type === "broadcast" && cmd.payload?.text) {
4588
+ const msg = cmd.payload.from ? `${cmd.payload.from}: ${cmd.payload.text}` : cmd.payload.text;
4589
+ this.log("Received broadcast:", msg);
4590
+ this.config.onBroadcast?.(msg);
4591
+ } else if (cmd.type === "clearBroadcast") {
4592
+ this.log("Received clearBroadcast");
4593
+ hideNotification();
4594
+ } else if (cmd.type === "kickBanned" || cmd.type === "kickAll") {
4595
+ this.log("Received kick:", cmd.type, cmd.payload);
4596
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4597
+ this.config.onCommand?.(cmd.type, cmd.payload);
4598
+ } else if (cmd.type === "privateMode" && this.venue) {
4599
+ this.log("Received privateMode - re-reading my standing");
4600
+ this.moderation.handleCommand(cmd.type, cmd.payload);
4601
+ } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
4602
+ this.log("Received video play:", cmd.type, cmd.payload.url);
4603
+ this.playUrl(cmd.payload.url);
4604
+ } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
4605
+ this.log("Received video stop/clear:", cmd.type);
4606
+ if (cmd.type === "videoClear") this.currentVideoUrl = null;
4607
+ this.config.onVideoStop?.();
4608
+ } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
4609
+ const slotId = cmd.payload.slot;
4610
+ if (cmd.payload.url) {
4611
+ this.log("Received videoPlaySlot with URL:", slotId, cmd.payload.url);
4612
+ this.playUrl(cmd.payload.url);
4613
+ } else {
4614
+ this.log("Received videoPlaySlot:", slotId);
4615
+ this.playSlot(slotId);
4616
+ }
4617
+ } else if (cmd.type === "framesRefresh") {
4618
+ this.log("Received framesRefresh");
4619
+ this.client.frames?.refresh();
4620
+ } else if (control) {
4621
+ this.log("Received scene control:", control.control.id, control.option);
4622
+ this.applyControl(control.control, control.option);
4623
+ } else if (this.config.onCommand) {
4624
+ this.log("Received command:", cmd.type, cmd.payload);
4625
+ this.config.onCommand(cmd.type, cmd.payload);
4626
+ }
4627
+ }
3521
4628
  // --- Stream API Calls ---
3522
4629
  async fetchStreamData() {
3523
4630
  if (this.streamFetched || !this.playerWallet) return;
@@ -3559,6 +4666,7 @@ var AdminPanelUIModule = class {
3559
4666
  defaultSlot: data.defaultSlot || null,
3560
4667
  videoSlots: data.videoSlots || {}
3561
4668
  };
4669
+ if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
3562
4670
  this.videoStateFetched = true;
3563
4671
  this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
3564
4672
  }
@@ -3573,7 +4681,7 @@ var AdminPanelUIModule = class {
3573
4681
  const slot = this.videoState?.videoSlots?.[slotId];
3574
4682
  if (slot?.url) {
3575
4683
  this.log("Playing slot:", slotId, slot.url);
3576
- this.config.onVideoPlay?.(slot.url);
4684
+ this.playUrl(slot.url);
3577
4685
  } else {
3578
4686
  this.log("Slot has no URL:", slotId);
3579
4687
  this.config.onVideoSlotPlay?.(slotId);
@@ -3588,7 +4696,7 @@ var AdminPanelUIModule = class {
3588
4696
  const slot = this.videoState.videoSlots?.[defaultSlot];
3589
4697
  if (slot?.url) {
3590
4698
  this.log("Auto-playing default slot:", defaultSlot);
3591
- this.config.onVideoPlay?.(slot.url);
4699
+ this.playUrl(slot.url);
3592
4700
  }
3593
4701
  }
3594
4702
  async createChannel() {
@@ -3940,6 +5048,7 @@ var AdminPanelUIModule = class {
3940
5048
  this.modStatus = "saved";
3941
5049
  this.log("Banned wallet:", normalized);
3942
5050
  this.config.onCommand?.("kickBanned", { wallet: normalized });
5051
+ await this.sendSceneCommand("kickBanned", { wallet: normalized }, this.kickLine("Banned and kicked"));
3943
5052
  } else {
3944
5053
  this.modStatus = "error";
3945
5054
  }
@@ -3974,15 +5083,142 @@ var AdminPanelUIModule = class {
3974
5083
  this.log("Unban error:", err);
3975
5084
  }
3976
5085
  }
3977
- banKickPlayer() {
3978
- movePlayerTo({ newRelativePosition: BAN_KICK_POSITION });
3979
- this.log("Player ban-kicked");
5086
+ /**
5087
+ * Queue a command on thestatic.tv for every visitor's copy of the scene (2026-11-17): a signed POST to the scene's
5088
+ * commands route, which takes it from the scene's owner, an admin or an authorized user at the scene's registered
5089
+ * location, and which every copy's poll reads within its 30-second window. The one sender for the kicks, the scene
5090
+ * controls and, since 2026-11-18, the Video and Broadcast buttons; each shows what it came to on its section's own
5091
+ * line. The command id the server answers goes into the seen set, so this copy's poll does not run its own press a
5092
+ * second time. Returns that id (empty when the answer carries none), or null when the command was not sent.
5093
+ */
5094
+ async sendSceneCommand(type, payload, line) {
5095
+ const data = await this.sendSigned("commands", { type, payload }, line);
5096
+ if (data === null) return null;
5097
+ const id = typeof data.commandId === "string" ? data.commandId : "";
5098
+ if (id !== "") this.markCommandSeen(id);
5099
+ return id;
3980
5100
  }
5101
+ /**
5102
+ * The one signed sender's POST (2026-11-18; since 2026-11-19 private mode's switch goes through it too, to its own
5103
+ * route): signed as the presser to one of the scene's routes on thestatic.tv, which decides whether the presser may;
5104
+ * what it came to shown on the section's line in a control's four words. Returns the answer, or null when not sent.
5105
+ */
5106
+ async sendSigned(route, body, line) {
5107
+ try {
5108
+ const res = await this.signedRequest(`${this.baseUrl}/scene/${this.config.sceneId}/${route}`, {
5109
+ method: "POST",
5110
+ headers: { "Content-Type": "application/json" },
5111
+ body: JSON.stringify(body)
5112
+ });
5113
+ const parsed = await res.json().catch(() => ({}));
5114
+ const data = parsed && typeof parsed === "object" ? parsed : {};
5115
+ if (res.ok) {
5116
+ line.show(line.sent);
5117
+ return data;
5118
+ }
5119
+ line.show(res.status === 401 || res.status === 403 ? `${line.notSent}: no access` : `${line.notSent}: HTTP ${res.status}`);
5120
+ this.log("Refused:", route, body.type ?? "", res.status, data.error);
5121
+ } catch (err) {
5122
+ line.show(`${line.notSent}: network error`);
5123
+ this.log("Send error:", route, err);
5124
+ }
5125
+ return null;
5126
+ }
5127
+ /**
5128
+ * PRIVATE MODE ON / OFF (2026-11-19, Venue; thestatic-hq docs/MERGE-CONTRACT-2026-11-19.md section 2): `{ on }` to
5129
+ * the scene's private route through the one signed sender. thestatic.tv decides who may switch it (its scene access
5130
+ * check) and queues `privateMode` for every copy, this one included, which re-reads its standing on it. The state
5131
+ * shown follows the server's answer, never the press.
5132
+ */
5133
+ async setPrivateMode(on) {
5134
+ if (!this.venue) return;
5135
+ const data = await this.sendSigned("private", { on }, this.privateLine);
5136
+ if (typeof data?.privateMode?.on === "boolean") this.privateModeOn = data.privateMode.on;
5137
+ }
5138
+ /** KICK ALL: every visitor who cannot moderate the scene is moved out and kept out for a while (2026-11-17) */
5139
+ async kickAll() {
5140
+ this.log("KICK ALL clicked");
5141
+ this.config.onCommand?.("kickAll", {});
5142
+ await this.sendSceneCommand("kickAll", {}, this.kickLine("KICK ALL sent"));
5143
+ }
5144
+ /**
5145
+ * BROADCAST (2026-11-18): queued for every visitor, as the scene's page on thestatic.tv sends it - `from` the presser's
5146
+ * display name, ADMIN when the explorer has none (the page's own default) - and shown here at once as everyone sees
5147
+ * it, `from: text`. Until then the in-world Send reached the presser's copy alone.
5148
+ */
3981
5149
  sendBroadcast() {
3982
- if (!this.broadcastText.trim()) return;
3983
- this.config.onBroadcast?.(this.broadcastText.trim());
5150
+ const text = this.broadcastText.trim();
5151
+ if (!text) return;
5152
+ const from = this.myName();
5153
+ this.config.onBroadcast?.(`${from}: ${text}`);
3984
5154
  this.broadcastText = "";
3985
5155
  this.log("Broadcast sent");
5156
+ this.sendSceneCommand("broadcast", { text, from }, this.broadcastLine).catch(() => {
5157
+ });
5158
+ }
5159
+ /** The presser's display name for a broadcast's from, ADMIN when the explorer has none; within the route's 100 */
5160
+ myName() {
5161
+ try {
5162
+ const name = getPlayer2()?.name;
5163
+ if (typeof name === "string" && name.trim() !== "") return name.trim().slice(0, 100);
5164
+ } catch {
5165
+ }
5166
+ return "ADMIN";
5167
+ }
5168
+ // --- The Video tab's buttons (2026-11-18): each does here at once what it did, then queues the same for everyone ---
5169
+ /** PLAY NOW: the typed url plays here and is queued as videoSetUrl, which thestatic.tv keeps for later arrivals */
5170
+ playNow() {
5171
+ const url = this.customVideoUrl.trim();
5172
+ if (!url) return;
5173
+ this.playUrl(url);
5174
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5175
+ });
5176
+ }
5177
+ /** Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it) */
5178
+ playStreamOnScreen(url) {
5179
+ this.playUrl(url);
5180
+ this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5181
+ });
5182
+ }
5183
+ /** Play 1-5: the slot plays here (its url from the video state) and is queued as videoPlaySlot; the server resolves its url for everyone */
5184
+ pressSlot(slotId) {
5185
+ this.playSlot(slotId);
5186
+ this.sendSceneCommand("videoPlaySlot", { slot: slotId }, this.videoLine).catch(() => {
5187
+ });
5188
+ }
5189
+ /**
5190
+ * PLAYBACK Play: the current video - the one the screen last played here, or the scene's current url from the video
5191
+ * state at load - plays again here and is queued as videoPlay with its url; with none known nothing is sent and the
5192
+ * line says so. onCommand gets ('videoPlay', { playing: true }) as it did before, for a scene that reads it.
5193
+ */
5194
+ playbackPlay() {
5195
+ this.config.onCommand?.("videoPlay", { playing: true });
5196
+ const url = this.currentVideoUrl;
5197
+ if (!url) {
5198
+ this.videoStatus = "Not sent: no video";
5199
+ return;
5200
+ }
5201
+ this.playUrl(url);
5202
+ this.sendSceneCommand("videoPlay", { url }, this.videoLine).catch(() => {
5203
+ });
5204
+ }
5205
+ /** Stop: the screen stops here and videoStop is queued for everyone */
5206
+ playbackStop() {
5207
+ this.config.onVideoStop?.();
5208
+ this.sendSceneCommand("videoStop", {}, this.videoLine).catch(() => {
5209
+ });
5210
+ }
5211
+ /**
5212
+ * Reset Default: the screen goes back to its default here - what every copy does on a queued videoClear - and
5213
+ * videoClear is queued, which also clears the scene's kept url on thestatic.tv. onCommand gets ('videoClear', {}) as
5214
+ * it did before.
5215
+ */
5216
+ resetDefault() {
5217
+ this.config.onCommand?.("videoClear", {});
5218
+ this.currentVideoUrl = null;
5219
+ this.config.onVideoStop?.();
5220
+ this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
5221
+ });
3986
5222
  }
3987
5223
  setActiveTab(tab) {
3988
5224
  const previousTab = this.activeTab;
@@ -3996,6 +5232,22 @@ var AdminPanelUIModule = class {
3996
5232
  this.stopStreamPolling();
3997
5233
  }
3998
5234
  }
5235
+ /** A control's button (2026-11-18): the option's label, highlighted while that option is current on this copy */
5236
+ controlButton(control, option, label) {
5237
+ const current = this.currentOption[control.id] === option;
5238
+ return /* @__PURE__ */ ReactEcs6.createElement(
5239
+ Button4,
5240
+ {
5241
+ key: `control-${control.id}-${option}`,
5242
+ uiTransform: { minWidth: this.s(70), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4, padding: { left: 10, right: 10 } },
5243
+ uiBackground: { color: current ? C2.cyan : C2.btn },
5244
+ value: label,
5245
+ fontSize: this.theme.buttonSmall,
5246
+ color: current ? Color46.Black() : C2.text,
5247
+ onMouseDown: () => this.pressControl(control, option)
5248
+ }
5249
+ );
5250
+ }
3999
5251
  /**
4000
5252
  * Render a scaled notification banner
4001
5253
  * Uses same layout as NotificationBanner but with scaled font size
@@ -4006,8 +5258,8 @@ var AdminPanelUIModule = class {
4006
5258
  if (!state.visible) return null;
4007
5259
  const N2 = UI_DIMENSIONS.notification;
4008
5260
  const colors = THEME.colors;
4009
- return /* @__PURE__ */ ReactEcs5.createElement(
4010
- UiEntity5,
5261
+ return /* @__PURE__ */ ReactEcs6.createElement(
5262
+ UiEntity6,
4011
5263
  {
4012
5264
  uiTransform: {
4013
5265
  positionType: "absolute",
@@ -4017,8 +5269,8 @@ var AdminPanelUIModule = class {
4017
5269
  alignItems: "center"
4018
5270
  }
4019
5271
  },
4020
- /* @__PURE__ */ ReactEcs5.createElement(
4021
- UiEntity5,
5272
+ /* @__PURE__ */ ReactEcs6.createElement(
5273
+ UiEntity6,
4022
5274
  {
4023
5275
  uiTransform: {
4024
5276
  minWidth: this.s(200),
@@ -4030,15 +5282,15 @@ var AdminPanelUIModule = class {
4030
5282
  },
4031
5283
  uiBackground: { color: colors.panel }
4032
5284
  },
4033
- /* @__PURE__ */ ReactEcs5.createElement(
4034
- UiEntity5,
5285
+ /* @__PURE__ */ ReactEcs6.createElement(
5286
+ UiEntity6,
4035
5287
  {
4036
5288
  uiTransform: { width: N2.borderWidth, height: "100%" },
4037
5289
  uiBackground: { color: colors.cyan }
4038
5290
  }
4039
5291
  ),
4040
- /* @__PURE__ */ ReactEcs5.createElement(
4041
- UiEntity5,
5292
+ /* @__PURE__ */ ReactEcs6.createElement(
5293
+ UiEntity6,
4042
5294
  {
4043
5295
  uiTransform: {
4044
5296
  flexGrow: 1,
@@ -4048,8 +5300,8 @@ var AdminPanelUIModule = class {
4048
5300
  alignItems: "center"
4049
5301
  }
4050
5302
  },
4051
- /* @__PURE__ */ ReactEcs5.createElement(
4052
- Label5,
5303
+ /* @__PURE__ */ ReactEcs6.createElement(
5304
+ Label6,
4053
5305
  {
4054
5306
  value: state.text,
4055
5307
  fontSize: this.s(N2.fontSize),
@@ -4058,8 +5310,8 @@ var AdminPanelUIModule = class {
4058
5310
  }
4059
5311
  )
4060
5312
  ),
4061
- /* @__PURE__ */ ReactEcs5.createElement(
4062
- UiEntity5,
5313
+ /* @__PURE__ */ ReactEcs6.createElement(
5314
+ UiEntity6,
4063
5315
  {
4064
5316
  uiTransform: { width: 5, height: 5, margin: { right: 10 } },
4065
5317
  uiBackground: { color: colors.cyan }
@@ -4113,9 +5365,13 @@ var StaticTVClient = class {
4113
5365
  this._keyId = null;
4114
5366
  this._disabled = false;
4115
5367
  this._tier = "free";
5368
+ /** Venue (2026-11-19): the server's flag beside a Pro tier; the event features need it */
5369
+ this._venue = false;
4116
5370
  this._standardFeaturesEnabled = false;
4117
5371
  this._proFeaturesEnabled = false;
4118
5372
  this._pendingProConfig = null;
5373
+ /** Controls registered before the admin panel exists (the tier not yet confirmed) - handed to it at init (2026-11-18) */
5374
+ this._pendingControls = [];
4119
5375
  this._featuresResolved = false;
4120
5376
  /** Guide module - fetch channel lineup (standard/pro tier) */
4121
5377
  this.guide = null;
@@ -4159,6 +5415,8 @@ var StaticTVClient = class {
4159
5415
  };
4160
5416
  this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
4161
5417
  this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
5418
+ this.frames = new FramesModule(this);
5419
+ if (config.frames) this.frames.register(config.frames);
4162
5420
  if (!config.apiKey) {
4163
5421
  this._disabled = true;
4164
5422
  this._keyType = null;
@@ -4289,7 +5547,7 @@ var StaticTVClient = class {
4289
5547
  * @internal
4290
5548
  */
4291
5549
  async signedRequest(endpoint, init = {}) {
4292
- const response = await signedFetch3({
5550
+ const response = await signedFetch4({
4293
5551
  url: `${this.apiUrl}${endpoint}`,
4294
5552
  init: {
4295
5553
  method: init.method || "POST",
@@ -4349,6 +5607,7 @@ var StaticTVClient = class {
4349
5607
  * @param url Video URL to play
4350
5608
  */
4351
5609
  playVideo(url) {
5610
+ if (this.isVisitorBlocked) return;
4352
5611
  const screen = this.config.videoScreen;
4353
5612
  if (screen !== void 0) {
4354
5613
  this.log(`Playing video: ${url}`);
@@ -4406,6 +5665,7 @@ var StaticTVClient = class {
4406
5665
  _playVideoInternal(url, isFallback = false, isLiveStream = false) {
4407
5666
  const screen = this.config.videoScreen;
4408
5667
  if (screen === void 0) return;
5668
+ if (this.isVisitorBlocked) return;
4409
5669
  this._clearVerificationTimeout();
4410
5670
  this._streamVerified = false;
4411
5671
  if (VideoPlayer.has(screen)) {
@@ -4529,6 +5789,7 @@ var StaticTVClient = class {
4529
5789
  */
4530
5790
  _handleGuideVideoSelect(video) {
4531
5791
  if (!video.src) return;
5792
+ if (this.isVisitorBlocked) return;
4532
5793
  this._pendingVideoData = video;
4533
5794
  const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
4534
5795
  this._playVideoWithVerification(video, isLiveStream);
@@ -4605,6 +5866,74 @@ var StaticTVClient = class {
4605
5866
  this.log(`Stream confirmed playing: ${this._pendingVideoData.name}`);
4606
5867
  }
4607
5868
  }
5869
+ /**
5870
+ * True while this visitor is banned from the scene or kicked out of it (Pro tier, 2026-11-17), or kept out by its
5871
+ * private mode (Venue, 2026-11-19): the SDK keeps them out of the scene's parcels, shows them only the notice and
5872
+ * plays them no video. A scene with its own media (a radio, its own screen) checks this, or passes
5873
+ * `onBlockedChange`, and stops it.
5874
+ */
5875
+ get isVisitorBlocked() {
5876
+ return this.adminPanel?.isVisitorBlocked ?? false;
5877
+ }
5878
+ /**
5879
+ * This visitor's standing: 'banned', 'kicked', 'private' (2026-11-19) or 'clear', in that precedence (always 'clear'
5880
+ * without the Pro tier's admin panel)
5881
+ */
5882
+ get visitorStanding() {
5883
+ return this.adminPanel?.moderation.standing ?? "clear";
5884
+ }
5885
+ /**
5886
+ * True when the last standing read said this visitor is a TheStatic.tv citizen - their wallet linked to an account
5887
+ * (2026-11-19). False before a read, from a server that does not answer it, and without the Pro tier's admin panel.
5888
+ * For a fresh answer, `checkCitizen()`.
5889
+ */
5890
+ get visitorIsCitizen() {
5891
+ return this.adminPanel?.moderation.isCitizen ?? false;
5892
+ }
5893
+ /**
5894
+ * Whether this visitor is a TheStatic.tv citizen, fresh (2026-11-19): a read of the scene's admin-check through the
5895
+ * moderation module - the last answer when it is under 5 s old, else the next read, gated as every standing read
5896
+ * is. False without the Pro tier's admin panel, and when no read has answered. A scene's citizens-only door asks
5897
+ * this instead of calling a route of its own; thestatic.tv answers it from the signed request, so a scene cannot
5898
+ * claim a citizen.
5899
+ */
5900
+ async checkCitizen() {
5901
+ if (!this.adminPanel) return false;
5902
+ try {
5903
+ return await this.adminPanel.moderation.checkCitizen();
5904
+ } catch {
5905
+ return false;
5906
+ }
5907
+ }
5908
+ /**
5909
+ * The admin panel's moderation reports blocked on or off (2026-11-17): the panels close, the SDK's own video
5910
+ * stops (and its fallback loop comes back once clear), the watch heartbeat stops, and the scene hears of it.
5911
+ * @internal
5912
+ */
5913
+ _onBlockedChange(blocked, standing) {
5914
+ const screen = this.config.videoScreen;
5915
+ if (blocked) {
5916
+ this.guideUI?.hide();
5917
+ this.chatUI?.hide();
5918
+ this.heartbeat?.stopWatching();
5919
+ this._pendingVideoData = null;
5920
+ this._clearVerificationTimeout();
5921
+ if (screen !== void 0 && VideoPlayer.has(screen)) {
5922
+ VideoPlayer.getMutable(screen).playing = false;
5923
+ }
5924
+ this._currentVideoUrl = "";
5925
+ } else if (screen !== void 0) {
5926
+ const fallbackUrl = this.config.fallbackVideoUrl !== void 0 ? this.config.fallbackVideoUrl : DEFAULT_FALLBACK_VIDEO;
5927
+ if (fallbackUrl !== "") this._playVideoInternal(fallbackUrl, true);
5928
+ }
5929
+ if (this.config.onBlockedChange) {
5930
+ try {
5931
+ this.config.onBlockedChange(blocked, standing);
5932
+ } catch (err) {
5933
+ this.error("onBlockedChange failed", err);
5934
+ }
5935
+ }
5936
+ }
4608
5937
  /**
4609
5938
  * Internal handler for broadcast messages
4610
5939
  * @internal
@@ -4663,8 +5992,15 @@ var StaticTVClient = class {
4663
5992
  onBroadcast: (text) => this._handleBroadcast(text),
4664
5993
  onCommand: this.config.onCommand || this._pendingProConfig?.onCommand,
4665
5994
  // Merge other settings from enableProFeatures if provided
4666
- ...this._pendingProConfig
5995
+ ...this._pendingProConfig,
5996
+ // The scene's controls (2026-11-18): the constructor's, enableProFeatures()'s, and any registered before now
5997
+ controls: [
5998
+ ...this.config.controls || [],
5999
+ ...this._pendingProConfig?.controls || [],
6000
+ ...this._pendingControls
6001
+ ]
4667
6002
  };
6003
+ this._pendingControls = [];
4668
6004
  this.adminPanel = new AdminPanelUIModule(this, adminConfig);
4669
6005
  this._proFeaturesEnabled = true;
4670
6006
  this.adminPanel.init().catch((err) => {
@@ -4708,8 +6044,9 @@ var StaticTVClient = class {
4708
6044
  getSceneId() {
4709
6045
  return this._pendingProConfig?.sceneId || this.config.sceneId || this._keyId || void 0;
4710
6046
  }
4711
- _enableFeaturesForTier(tier, keyId) {
6047
+ _enableFeaturesForTier(tier, keyId, venue = false) {
4712
6048
  this._tier = tier;
6049
+ this._venue = tier === "pro" && venue === true;
4713
6050
  if (keyId) {
4714
6051
  this._keyId = keyId;
4715
6052
  }
@@ -4724,6 +6061,7 @@ var StaticTVClient = class {
4724
6061
  this.log("Pro tier detected but no video config - call enableProFeatures() or set videoScreen to enable admin panel");
4725
6062
  }
4726
6063
  }
6064
+ if (this._venue) this.frames.enable();
4727
6065
  this._resolveFeaturesReady(tier);
4728
6066
  }
4729
6067
  /**
@@ -4751,6 +6089,13 @@ var StaticTVClient = class {
4751
6089
  get hasProFeatures() {
4752
6090
  return this._proFeaturesEnabled;
4753
6091
  }
6092
+ /**
6093
+ * True when the server confirmed the Venue tier (2026-11-19): Pro plus the event features - scene
6094
+ * controls, frames, private mode. `tier` stays 'pro' for a Venue scene, so a scene's own Pro checks hold.
6095
+ */
6096
+ get hasVenueFeatures() {
6097
+ return this._venue;
6098
+ }
4754
6099
  /**
4755
6100
  * @deprecated Use `tier` instead
4756
6101
  */
@@ -4820,6 +6165,57 @@ var StaticTVClient = class {
4820
6165
  }
4821
6166
  this.adminPanel.registerSceneTab(tab);
4822
6167
  }
6168
+ /**
6169
+ * Register scene controls for the Admin Panel's CONTROLS tab and the scene's page on thestatic.tv (2026-11-18;
6170
+ * the Venue tier since 2026-11-19, Pro until then) - the same as passing `controls` in the config. Before the panel
6171
+ * exists (the tier not yet confirmed) they are kept and handed to it at init; after, they join the tab at once. On a
6172
+ * Pro scene without Venue they are kept and never drawn, uploaded or run. See `SceneControl`.
6173
+ *
6174
+ * @example
6175
+ * ```typescript
6176
+ * staticTV.registerControls([{
6177
+ * id: 'digifog', label: 'DigiFog', off: true, persist: true,
6178
+ * options: [{ id: 'stars', label: 'Stars' }, { id: 'pulse', label: 'Pulse' }],
6179
+ * onChange: (option) => fog.play(option)
6180
+ * }])
6181
+ * ```
6182
+ */
6183
+ registerControls(controls) {
6184
+ if (!this.adminPanel) {
6185
+ this._pendingControls.push(...controls);
6186
+ this.log(`Scene controls registered (${controls.length}) - the admin panel takes them when the Pro tier is confirmed`);
6187
+ return;
6188
+ }
6189
+ this.adminPanel.registerControls(controls);
6190
+ }
6191
+ /**
6192
+ * Register picture frames (Venue tier, 2026-11-19) - the same as passing `frames` in the config. Kept whatever the
6193
+ * tier (without Venue `openFrame` still opens a default's link); once Venue is known, a frame registered now gets the
6194
+ * content the last read gave at once. A frame registered again by id
6195
+ * replaces the earlier one; at most 64. Only the shape is checked here - thestatic.tv checks the ids, labels and URLs
6196
+ * when the declaration is uploaded. See `SceneFrame`.
6197
+ *
6198
+ * @example
6199
+ * ```typescript
6200
+ * staticTV.registerFrames([{
6201
+ * id: 'f00', label: 'Ground floor, west wall',
6202
+ * default: { image: 'https://example.com/poster.png' },
6203
+ * onContent: (c) => showPicture(frameEntity, c.image, c.text)
6204
+ * }])
6205
+ * ```
6206
+ */
6207
+ registerFrames(frames) {
6208
+ this.frames.register(frames);
6209
+ }
6210
+ /**
6211
+ * A visitor clicked a frame (2026-11-19): the link opens when it is an https: one - the content's, else the frame's
6212
+ * default's, so a frame works before Venue is on - and, with Venue, the click is counted on thestatic.tv under the
6213
+ * picture the frame shows (signed, fire and forget). Call it from the frame's own pointer handler. Nothing happens
6214
+ * for an id the scene did not declare.
6215
+ */
6216
+ openFrame(id) {
6217
+ this.frames.open(id);
6218
+ }
4823
6219
  /**
4824
6220
  * Close Admin/Guide panels (they share the same screen space)
4825
6221
  * Chat is independent and stays open.
@@ -4891,16 +6287,19 @@ var StaticTVClient = class {
4891
6287
  export {
4892
6288
  AdminPanelUIModule,
4893
6289
  ChatUIModule,
6290
+ FramesModule,
4894
6291
  GuideModule,
4895
6292
  GuideUIModule,
4896
6293
  HeartbeatModule,
4897
6294
  InteractionsModule,
4898
6295
  KEY_TYPE_CHANNEL,
4899
6296
  KEY_TYPE_SCENE,
6297
+ ModerationModule,
4900
6298
  NotificationBanner,
4901
6299
  SessionModule,
4902
6300
  StaticTVClient,
4903
6301
  fetchUserData,
6302
+ getParcelRects,
4904
6303
  getPlayerDisplayName,
4905
6304
  getPlayerPosition,
4906
6305
  getPlayerWallet,