chesspal 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +99 -2
  2. package/dist/cli/chat-hook.d.ts +2 -0
  3. package/dist/cli/chat-hook.js +33 -0
  4. package/dist/cli/cli.d.ts +2 -0
  5. package/dist/cli/cli.js +28 -0
  6. package/dist/cli/command-line.d.ts +7 -0
  7. package/dist/cli/command-line.js +177 -0
  8. package/dist/commands/agents.d.ts +26 -0
  9. package/dist/commands/agents.js +72 -0
  10. package/dist/commands/ai-move.d.ts +28 -0
  11. package/dist/commands/ai-move.js +85 -0
  12. package/dist/commands/ai-say.d.ts +22 -0
  13. package/dist/commands/ai-say.js +58 -0
  14. package/dist/commands/analyse-game.d.ts +65 -0
  15. package/dist/commands/analyse-game.js +265 -0
  16. package/dist/commands/annotate-game.d.ts +39 -0
  17. package/dist/commands/annotate-game.js +131 -0
  18. package/dist/commands/answer-lines.d.ts +28 -0
  19. package/dist/commands/answer-lines.js +144 -0
  20. package/dist/commands/clock.d.ts +15 -0
  21. package/dist/commands/clock.js +45 -0
  22. package/dist/commands/coach.d.ts +45 -0
  23. package/dist/commands/coach.js +344 -0
  24. package/dist/commands/context.d.ts +67 -0
  25. package/dist/commands/context.js +37 -0
  26. package/dist/commands/delete-game.d.ts +7 -0
  27. package/dist/commands/delete-game.js +30 -0
  28. package/dist/commands/delete-review.d.ts +8 -0
  29. package/dist/commands/delete-review.js +34 -0
  30. package/dist/commands/draw-offer.d.ts +10 -0
  31. package/dist/commands/draw-offer.js +43 -0
  32. package/dist/commands/drawings.d.ts +13 -0
  33. package/dist/commands/drawings.js +25 -0
  34. package/dist/commands/end-game.d.ts +23 -0
  35. package/dist/commands/end-game.js +67 -0
  36. package/dist/commands/export-game.d.ts +14 -0
  37. package/dist/commands/export-game.js +27 -0
  38. package/dist/commands/game-summary.d.ts +78 -0
  39. package/dist/commands/game-summary.js +102 -0
  40. package/dist/commands/index.d.ts +18 -0
  41. package/dist/commands/index.js +64 -0
  42. package/dist/commands/init.d.ts +15 -0
  43. package/dist/commands/init.js +73 -0
  44. package/dist/commands/lead-input.d.ts +8 -0
  45. package/dist/commands/lead-input.js +21 -0
  46. package/dist/commands/levels.d.ts +9 -0
  47. package/dist/commands/levels.js +25 -0
  48. package/dist/commands/look.d.ts +31 -0
  49. package/dist/commands/look.js +64 -0
  50. package/dist/commands/new-game.d.ts +68 -0
  51. package/dist/commands/new-game.js +218 -0
  52. package/dist/commands/opening-book.d.ts +13 -0
  53. package/dist/commands/opening-book.js +84 -0
  54. package/dist/commands/page-link.d.ts +11 -0
  55. package/dist/commands/page-link.js +28 -0
  56. package/dist/commands/past-games.d.ts +11 -0
  57. package/dist/commands/past-games.js +47 -0
  58. package/dist/commands/play-move.d.ts +37 -0
  59. package/dist/commands/play-move.js +94 -0
  60. package/dist/commands/player-move.d.ts +13 -0
  61. package/dist/commands/player-move.js +51 -0
  62. package/dist/commands/player-say.d.ts +5 -0
  63. package/dist/commands/player-say.js +16 -0
  64. package/dist/commands/ponder.d.ts +52 -0
  65. package/dist/commands/ponder.js +179 -0
  66. package/dist/commands/position.d.ts +14 -0
  67. package/dist/commands/position.js +130 -0
  68. package/dist/commands/profiles.d.ts +69 -0
  69. package/dist/commands/profiles.js +163 -0
  70. package/dist/commands/registry.d.ts +59 -0
  71. package/dist/commands/registry.js +62 -0
  72. package/dist/commands/say.d.ts +16 -0
  73. package/dist/commands/say.js +84 -0
  74. package/dist/commands/speech.d.ts +8 -0
  75. package/dist/commands/speech.js +20 -0
  76. package/dist/commands/status.d.ts +35 -0
  77. package/dist/commands/status.js +128 -0
  78. package/dist/commands/study-games.d.ts +5 -0
  79. package/dist/commands/study-games.js +40 -0
  80. package/dist/commands/study.d.ts +38 -0
  81. package/dist/commands/study.js +106 -0
  82. package/dist/commands/view.d.ts +14 -0
  83. package/dist/commands/view.js +125 -0
  84. package/dist/core/board-text.d.ts +7 -0
  85. package/dist/core/board-text.js +18 -0
  86. package/dist/core/book.json +1 -0
  87. package/dist/core/clock.d.ts +45 -0
  88. package/dist/core/clock.js +109 -0
  89. package/dist/core/facts.d.ts +55 -0
  90. package/dist/core/facts.js +175 -0
  91. package/dist/core/game.d.ts +95 -0
  92. package/dist/core/game.js +352 -0
  93. package/dist/core/illegal.d.ts +19 -0
  94. package/dist/core/illegal.js +141 -0
  95. package/dist/core/index.d.ts +20 -0
  96. package/dist/core/index.js +12 -0
  97. package/dist/core/lead.d.ts +15 -0
  98. package/dist/core/lead.js +40 -0
  99. package/dist/core/levels.d.ts +20 -0
  100. package/dist/core/levels.js +33 -0
  101. package/dist/core/material.d.ts +9 -0
  102. package/dist/core/material.js +12 -0
  103. package/dist/core/moods.d.ts +21 -0
  104. package/dist/core/moods.js +45 -0
  105. package/dist/core/openings.d.ts +35 -0
  106. package/dist/core/openings.js +98 -0
  107. package/dist/core/openings.json +1 -0
  108. package/dist/core/pgn.d.ts +10 -0
  109. package/dist/core/pgn.js +213 -0
  110. package/dist/core/profile.d.ts +117 -0
  111. package/dist/core/profile.js +232 -0
  112. package/dist/core/record.d.ts +21 -0
  113. package/dist/core/record.js +25 -0
  114. package/dist/core/review.d.ts +80 -0
  115. package/dist/core/review.js +146 -0
  116. package/dist/games/ai-model.d.ts +5 -0
  117. package/dist/games/ai-model.js +15 -0
  118. package/dist/games/analysis.d.ts +12 -0
  119. package/dist/games/analysis.js +26 -0
  120. package/dist/games/archive.d.ts +63 -0
  121. package/dist/games/archive.js +242 -0
  122. package/dist/games/chat-start.d.ts +16 -0
  123. package/dist/games/chat-start.js +26 -0
  124. package/dist/games/coach.d.ts +57 -0
  125. package/dist/games/coach.js +144 -0
  126. package/dist/games/current-game.d.ts +56 -0
  127. package/dist/games/current-game.js +134 -0
  128. package/dist/games/files.d.ts +9 -0
  129. package/dist/games/files.js +53 -0
  130. package/dist/games/index.d.ts +11 -0
  131. package/dist/games/index.js +12 -0
  132. package/dist/games/plans.d.ts +9 -0
  133. package/dist/games/plans.js +23 -0
  134. package/dist/games/table-talk.d.ts +12 -0
  135. package/dist/games/table-talk.js +25 -0
  136. package/dist/games/talk.d.ts +36 -0
  137. package/dist/games/talk.js +131 -0
  138. package/dist/games/thoughts.d.ts +15 -0
  139. package/dist/games/thoughts.js +60 -0
  140. package/dist/home/data-folder.d.ts +12 -0
  141. package/dist/home/data-folder.js +55 -0
  142. package/dist/home/index.d.ts +2 -0
  143. package/dist/home/index.js +3 -0
  144. package/dist/home/open-folder.d.ts +2 -0
  145. package/dist/home/open-folder.js +14 -0
  146. package/dist/host-files/agents.d.ts +20 -0
  147. package/dist/host-files/agents.js +53 -0
  148. package/dist/host-files/host-files.d.ts +15 -0
  149. package/dist/host-files/host-files.js +182 -0
  150. package/dist/host-files/index.d.ts +2 -0
  151. package/dist/host-files/index.js +3 -0
  152. package/dist/index.d.ts +2 -0
  153. package/dist/index.js +3 -0
  154. package/dist/page/app/anchor.js +88 -0
  155. package/dist/page/app/app.js +458 -0
  156. package/dist/page/app/keys.js +94 -0
  157. package/dist/page/app/phase.js +30 -0
  158. package/dist/page/app/served.js +73 -0
  159. package/dist/page/avatars/avatars.js +19 -0
  160. package/dist/page/avatars/beanie.webp +0 -0
  161. package/dist/page/avatars/beard.webp +0 -0
  162. package/dist/page/avatars/bun.webp +0 -0
  163. package/dist/page/avatars/cat.webp +0 -0
  164. package/dist/page/avatars/curls.webp +0 -0
  165. package/dist/page/avatars/glasses.webp +0 -0
  166. package/dist/page/avatars/moustache.webp +0 -0
  167. package/dist/page/avatars/owl.webp +0 -0
  168. package/dist/page/avatars/short-hair.webp +0 -0
  169. package/dist/page/avatars/silver-bob.webp +0 -0
  170. package/dist/page/avatars/thought.js +10 -0
  171. package/dist/page/avatars/torretta.js +38 -0
  172. package/dist/page/base.css +160 -0
  173. package/dist/page/board/board.css +959 -0
  174. package/dist/page/board/board.js +125 -0
  175. package/dist/page/board/explain.js +58 -0
  176. package/dist/page/board/marks.js +160 -0
  177. package/dist/page/board/motion.js +71 -0
  178. package/dist/page/board/pointer.js +239 -0
  179. package/dist/page/board/squares.js +26 -0
  180. package/dist/page/dialogs/analyses.js +195 -0
  181. package/dist/page/dialogs/dialog.js +26 -0
  182. package/dist/page/dialogs/dialogs.css +1228 -0
  183. package/dist/page/dialogs/new-game.js +42 -0
  184. package/dist/page/dialogs/profiles.js +152 -0
  185. package/dist/page/dialogs/search.js +31 -0
  186. package/dist/page/dialogs/settings.js +42 -0
  187. package/dist/page/dialogs/studied.js +39 -0
  188. package/dist/page/dialogs/study.js +51 -0
  189. package/dist/page/game/badges.js +50 -0
  190. package/dist/page/game/browse.js +17 -0
  191. package/dist/page/game/card-fold.js +40 -0
  192. package/dist/page/game/column.js +51 -0
  193. package/dist/page/game/ending.js +73 -0
  194. package/dist/page/game/game.css +577 -0
  195. package/dist/page/game/move-list.js +72 -0
  196. package/dist/page/game/opening-book.js +14 -0
  197. package/dist/page/game/plies.js +82 -0
  198. package/dist/page/game/result-tile.js +14 -0
  199. package/dist/page/helps/helps.css +689 -0
  200. package/dist/page/helps/helps.js +220 -0
  201. package/dist/page/helps/view.js +127 -0
  202. package/dist/page/layout/fold-tab.js +11 -0
  203. package/dist/page/layout/folds.js +43 -0
  204. package/dist/page/layout/header.js +28 -0
  205. package/dist/page/layout/layout.css +834 -0
  206. package/dist/page/lead/lead.js +82 -0
  207. package/dist/page/lead/view.js +38 -0
  208. package/dist/page/main.js +8 -0
  209. package/dist/page/pieces/CREDITS.md +19 -0
  210. package/dist/page/pieces/capablanca-small.svg +20 -0
  211. package/dist/page/pieces/capablanca.svg +22 -0
  212. package/dist/page/pieces/nitida-small.svg +20 -0
  213. package/dist/page/pieces/nitida.svg +21 -0
  214. package/dist/page/pieces/pieces.js +28 -0
  215. package/dist/page/pieces/torretta-small.svg +20 -0
  216. package/dist/page/pieces/torretta.svg +21 -0
  217. package/dist/page/players/card.js +56 -0
  218. package/dist/page/players/clock-time.js +12 -0
  219. package/dist/page/players/model-name.js +20 -0
  220. package/dist/page/profile/profile.js +99 -0
  221. package/dist/page/profile/settings.js +77 -0
  222. package/dist/page/sounds/capture.ogg +0 -0
  223. package/dist/page/sounds/check.ogg +0 -0
  224. package/dist/page/sounds/draw.ogg +0 -0
  225. package/dist/page/sounds/flag.ogg +0 -0
  226. package/dist/page/sounds/mate.ogg +0 -0
  227. package/dist/page/sounds/move.ogg +0 -0
  228. package/dist/page/sounds/offer.ogg +0 -0
  229. package/dist/page/sounds/resign.ogg +0 -0
  230. package/dist/page/sounds/sounds.js +105 -0
  231. package/dist/page/style.css +9 -0
  232. package/dist/page/talk/talk.css +958 -0
  233. package/dist/page/talk/talk.js +165 -0
  234. package/dist/page/talk/voice.js +38 -0
  235. package/dist/page/text.js +711 -0
  236. package/dist/page/theme.css +292 -0
  237. package/dist/profiles/avatar.d.ts +23 -0
  238. package/dist/profiles/avatar.js +84 -0
  239. package/dist/profiles/front-matter.d.ts +9 -0
  240. package/dist/profiles/front-matter.js +33 -0
  241. package/dist/profiles/index.d.ts +3 -0
  242. package/dist/profiles/index.js +5 -0
  243. package/dist/profiles/profiles.d.ts +69 -0
  244. package/dist/profiles/profiles.js +254 -0
  245. package/dist/profiles/settings.d.ts +12 -0
  246. package/dist/profiles/settings.js +46 -0
  247. package/dist/server/bell.d.ts +68 -0
  248. package/dist/server/bell.js +225 -0
  249. package/dist/server/caller.d.ts +21 -0
  250. package/dist/server/caller.js +132 -0
  251. package/dist/server/mcp.d.ts +13 -0
  252. package/dist/server/mcp.js +207 -0
  253. package/dist/server/page/analyses.d.ts +23 -0
  254. package/dist/server/page/analyses.js +65 -0
  255. package/dist/server/page/files.d.ts +5 -0
  256. package/dist/server/page/files.js +92 -0
  257. package/dist/server/page/game.d.ts +6 -0
  258. package/dist/server/page/game.js +381 -0
  259. package/dist/server/page/http.d.ts +29 -0
  260. package/dist/server/page/http.js +68 -0
  261. package/dist/server/page/page.d.ts +41 -0
  262. package/dist/server/page/page.js +229 -0
  263. package/dist/server/page/profiles.d.ts +19 -0
  264. package/dist/server/page/profiles.js +215 -0
  265. package/dist/version.d.ts +2 -0
  266. package/dist/version.js +3 -0
  267. package/instructions/analysis.md +4 -0
  268. package/instructions/analyst-agent.md +8 -0
  269. package/instructions/analyst.md +4 -0
  270. package/instructions/coach.md +11 -0
  271. package/instructions/opponent.md +15 -0
  272. package/instructions/ponder.md +9 -0
  273. package/package.json +66 -5
@@ -0,0 +1,77 @@
1
+ // The player's settings on the page (D-56): the look, the game's aids and the language, kept in the profile in use and remembered by this browser.
2
+ /** The piece sets, all Chesspal's own, whose colours the player picks; a set no longer here falls back to the first (D-94). */
3
+ export const pieceSets = ["nitida", "torretta", "capablanca"];
4
+ /** The choices of each look, by the ids the style sheet knows; the first is the default. */
5
+ export const looks = {
6
+ board: ["azzurro", "verde", "noce", "ardesia", "grigio", "lavanda", "ciliegio", "menta", "carta"],
7
+ pieces: ["classico", "avorio", "notte", "bordeaux"],
8
+ marks: ["arancione", "rosso", "blu", "verde"],
9
+ };
10
+ /** The settings this browser remembers, each one it does not know taking its default; the theme and the sounds chosen before the panel come along. */
11
+ export function loadSettings() {
12
+ const saved = read(remembered);
13
+ const oldTheme = read("chesspal-theme");
14
+ return settingsFrom(saved === null ? {} : parsed(saved), { theme: oldTheme === "light" || oldTheme === "dark" ? oldTheme : "system", sound: read("chesspal-sound") !== "off" });
15
+ }
16
+ /** Settings from what was kept, by this browser or in the profile: each one not known takes its default. */
17
+ export function settingsFrom(value, defaults = { theme: "system", sound: true }) {
18
+ const stored = typeof value === "object" && value !== null ? value : {};
19
+ return {
20
+ theme: oneOf(stored.theme, ["system", "light", "dark"], defaults.theme),
21
+ board: oneOf(stored.board, looks.board, looks.board[0]),
22
+ set: oneOf(stored.set, pieceSets, pieceSets[0]),
23
+ pieces: oneOf(stored.pieces, looks.pieces, looks.pieces[0]),
24
+ marks: oneOf(stored.marks, looks.marks, looks.marks[0]),
25
+ dots: typeof stored.dots === "boolean" ? stored.dots : true,
26
+ squareNames: typeof stored.squareNames === "boolean" ? stored.squareNames : false,
27
+ explain: typeof stored.explain === "boolean" ? stored.explain : true,
28
+ book: typeof stored.book === "boolean" ? stored.book : true,
29
+ helps: typeof stored.helps === "boolean" ? stored.helps : false,
30
+ sound: typeof stored.sound === "boolean" ? stored.sound : defaults.sound,
31
+ voice: typeof stored.voice === "boolean" ? stored.voice : false,
32
+ language: oneOf(stored.language, ["auto", "it", "en"], "auto"),
33
+ };
34
+ }
35
+ /** Remembers the settings in this browser. */
36
+ export function saveSettings(settings) {
37
+ try {
38
+ localStorage.setItem(remembered, JSON.stringify(settings));
39
+ }
40
+ catch {
41
+ // The choices last as long as the page.
42
+ }
43
+ }
44
+ /** Shows the settings' look on the page: the theme, the board's skin, the pieces' set and colours and the marks' colour, as attributes the style sheet reads. */
45
+ export function showSettings(settings) {
46
+ const root = document.documentElement.dataset;
47
+ root.theme = settings.theme === "system" ? (matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") : settings.theme;
48
+ root.board = settings.board;
49
+ root.set = settings.set;
50
+ root.pieces = settings.pieces;
51
+ root.marks = settings.marks;
52
+ }
53
+ /** The languages the page speaks in, by the setting: the browser's, or the one chosen. */
54
+ export function languagesOf(settings) {
55
+ return settings.language === "auto" ? navigator.languages : [settings.language];
56
+ }
57
+ const remembered = "chesspal-settings";
58
+ function read(key) {
59
+ try {
60
+ return localStorage.getItem(key);
61
+ }
62
+ catch {
63
+ return null;
64
+ }
65
+ }
66
+ function parsed(saved) {
67
+ try {
68
+ const value = JSON.parse(saved);
69
+ return typeof value === "object" && value !== null ? value : {};
70
+ }
71
+ catch {
72
+ return {};
73
+ }
74
+ }
75
+ function oneOf(value, choices, fallback) {
76
+ return choices.find((choice) => choice === value) ?? fallback;
77
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,105 @@
1
+ const folder = "/page/sounds/";
2
+ /** The sound of the game's last move, from how the board stands after it; none before the first move. */
3
+ export function soundOf(game) {
4
+ const last = game.lastMove;
5
+ const { outcome } = game;
6
+ if (last === undefined) {
7
+ return undefined;
8
+ }
9
+ if (outcome.over) {
10
+ return outcome.ending === "checkmate" ? "mate" : "draw";
11
+ }
12
+ return game.position.check ? "check" : last.san.includes("x") ? "capture" : "move";
13
+ }
14
+ /** The sound of a game ended without a move: a resignation, a flag fallen, a draw agreed; none for the ends that come with a move. */
15
+ export function endSoundOf(how) {
16
+ return how === "resignation" ? "resign" : how === "time" ? "flag" : how === "agreement" ? "draw" : undefined;
17
+ }
18
+ /** Lets the page play sounds: loads the recordings, and since a browser plays none before the player has touched the page, the first touch wakes them. */
19
+ export function wakeSounds() {
20
+ loadRecordings();
21
+ addEventListener("pointerdown", () => void audio()?.resume(), { once: true });
22
+ }
23
+ /** Plays a sound: its recordings together, else its tone; a browser without Web Audio plays none. */
24
+ export function playSound(sound) {
25
+ const context = audio();
26
+ if (context === undefined) {
27
+ return;
28
+ }
29
+ const recorded = layers[sound].flatMap((layer) => recordings.get(layer) ?? []);
30
+ if (recorded.length < layers[sound].length) {
31
+ playTone(context, sound);
32
+ return;
33
+ }
34
+ for (const recording of recorded) {
35
+ const source = new AudioBufferSourceNode(context, { buffer: recording });
36
+ source.connect(context.destination);
37
+ source.start();
38
+ }
39
+ }
40
+ /** Fetches and decodes the recordings, offline so that the page wakes no sound before a touch; one that fails leaves its tone. */
41
+ function loadRecordings() {
42
+ let decoder;
43
+ try {
44
+ decoder = new OfflineAudioContext({ length: 1, sampleRate: 48000 });
45
+ }
46
+ catch {
47
+ return;
48
+ }
49
+ for (const sound of Object.keys(tones)) {
50
+ void fetch(`${folder}${sound}.ogg`)
51
+ .then((response) => response.ok ? response.arrayBuffer() : Promise.reject(new Error(`No ${sound}.ogg.`)))
52
+ .then((bytes) => decoder.decodeAudioData(bytes))
53
+ .then((buffer) => recordings.set(sound, buffer), () => undefined);
54
+ }
55
+ }
56
+ function playTone(context, sound) {
57
+ for (const { frequency, at, length, wave, volume } of tones[sound]) {
58
+ const oscillator = new OscillatorNode(context, { type: wave, frequency });
59
+ const gain = new GainNode(context, { gain: 0 });
60
+ const start = context.currentTime + at;
61
+ // A quick attack and a fall, as a struck note has.
62
+ gain.gain.linearRampToValueAtTime(volume, start + 0.005);
63
+ gain.gain.exponentialRampToValueAtTime(0.0001, start + length);
64
+ oscillator.connect(gain).connect(context.destination);
65
+ oscillator.start(start);
66
+ oscillator.stop(start + length);
67
+ }
68
+ }
69
+ // A wooden knock for a piece set down, two for a capture, a call for a check, a chord for a mate, a falling pair for a draw, three falling notes for a
70
+ // resignation, a timer's beeps for a flag, a rising pair for a draw offered.
71
+ const tones = {
72
+ move: [{ frequency: 190, at: 0, length: 0.08, wave: "triangle", volume: 0.5 }, { frequency: 1200, at: 0, length: 0.02, wave: "sine", volume: 0.12 }],
73
+ capture: [{ frequency: 170, at: 0, length: 0.08, wave: "triangle", volume: 0.5 }, { frequency: 240, at: 0.06, length: 0.1, wave: "triangle", volume: 0.45 }],
74
+ check: [{ frequency: 660, at: 0, length: 0.14, wave: "sine", volume: 0.25 }, { frequency: 880, at: 0.11, length: 0.2, wave: "sine", volume: 0.25 }],
75
+ mate: [523, 659, 784, 1047].map((frequency, index) => ({ frequency, at: index * 0.06, length: 0.9, wave: "sine", volume: 0.18 })),
76
+ draw: [{ frequency: 440, at: 0, length: 0.3, wave: "sine", volume: 0.2 }, { frequency: 349, at: 0.22, length: 0.45, wave: "sine", volume: 0.2 }],
77
+ resign: [523, 392, 262].map((frequency, index) => ({ frequency, at: index * 0.11, length: index === 2 ? 0.5 : 0.25, wave: "triangle", volume: 0.25 })),
78
+ flag: [
79
+ ...[0, 0.11, 0.22].map((at) => ({ frequency: 988, at, length: 0.07, wave: "square", volume: 0.06 })),
80
+ { frequency: 440, at: 0.36, length: 0.4, wave: "triangle", volume: 0.25 },
81
+ ],
82
+ offer: [{ frequency: 659, at: 0, length: 0.45, wave: "sine", volume: 0.2 }, { frequency: 880, at: 0.16, length: 0.5, wave: "sine", volume: 0.2 }],
83
+ };
84
+ /** The recordings each sound plays at once. */
85
+ const layers = {
86
+ move: ["move"],
87
+ capture: ["move", "capture"],
88
+ check: ["move", "check"],
89
+ mate: ["move", "mate"],
90
+ draw: ["draw"],
91
+ resign: ["resign"],
92
+ flag: ["flag"],
93
+ offer: ["offer"],
94
+ };
95
+ const recordings = new Map();
96
+ let shared;
97
+ function audio() {
98
+ try {
99
+ shared ??= new AudioContext();
100
+ return shared;
101
+ }
102
+ catch {
103
+ return undefined;
104
+ }
105
+ }
@@ -0,0 +1,9 @@
1
+ /* The page's style, a sheet for each of its parts, in the order of the cascade */
2
+ @import "theme.css";
3
+ @import "base.css";
4
+ @import "layout/layout.css";
5
+ @import "board/board.css";
6
+ @import "talk/talk.css";
7
+ @import "game/game.css";
8
+ @import "helps/helps.css";
9
+ @import "dialogs/dialogs.css";