@puzzmo/sdk 1.0.81 → 1.0.82

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 (148) hide show
  1. package/dist/analytics.d.ts.map +1 -1
  2. package/dist/bootstrapPayload.d.ts.map +1 -1
  3. package/dist/bootstrapPayload.spec.d.ts.map +1 -1
  4. package/dist/bundles.cjs +1 -1
  5. package/dist/bundles.cjs.map +1 -1
  6. package/dist/bundles.d.ts +10 -2
  7. package/dist/bundles.d.ts.map +1 -1
  8. package/dist/bundles.js +2 -2
  9. package/dist/bundles.js.map +1 -1
  10. package/dist/contracts.d.ts.map +1 -1
  11. package/dist/createSimulator-CIE72Xs2.cjs +2233 -0
  12. package/dist/createSimulator-CIE72Xs2.cjs.map +1 -0
  13. package/dist/{createSimulator-2M7vXzRZ.js → createSimulator-Dz1KYZ25.js} +1579 -596
  14. package/dist/createSimulator-Dz1KYZ25.js.map +1 -0
  15. package/dist/easing.d.ts +6 -0
  16. package/dist/easing.d.ts.map +1 -0
  17. package/dist/editor.d.ts +25 -3
  18. package/dist/editor.d.ts.map +1 -1
  19. package/dist/fontFiles.gen.d.ts.map +1 -1
  20. package/dist/fonts-CP_kAAac.js +83 -0
  21. package/dist/fonts-CP_kAAac.js.map +1 -0
  22. package/dist/fonts-CS5qdLf3.cjs +3 -0
  23. package/dist/fonts-CS5qdLf3.cjs.map +1 -0
  24. package/dist/fonts.cjs +1 -3
  25. package/dist/fonts.d.ts +2 -0
  26. package/dist/fonts.d.ts.map +1 -1
  27. package/dist/fonts.js +2 -83
  28. package/dist/gameTracker.d.ts.map +1 -1
  29. package/dist/global.d.ts.map +1 -1
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.global.js.map +1 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/inputs/decoder.d.ts.map +1 -1
  36. package/dist/inputs/encoder.d.ts.map +1 -1
  37. package/dist/inputs/encodings.d.ts.map +1 -1
  38. package/dist/inputs/index.d.ts.map +1 -1
  39. package/dist/inputs/inputStringEncoder.spec.d.ts.map +1 -1
  40. package/dist/inputs/migration.d.ts.map +1 -1
  41. package/dist/inputs/types.d.ts.map +1 -1
  42. package/dist/keyboard.d.ts.map +1 -1
  43. package/dist/keyboard.spec.d.ts.map +1 -1
  44. package/dist/{lua-DKb2Tu2V.js → lua-B8exrfmB.js} +1 -1
  45. package/dist/{lua-DKb2Tu2V.js.map → lua-B8exrfmB.js.map} +1 -1
  46. package/dist/{lua-CclI-QKD.cjs → lua-C5r7UXeR.cjs} +1 -1
  47. package/dist/{lua-CclI-QKD.cjs.map → lua-C5r7UXeR.cjs.map} +1 -1
  48. package/dist/pico8/channel.d.ts.map +1 -1
  49. package/dist/pico8/index.cjs +1 -1
  50. package/dist/pico8/index.d.ts.map +1 -1
  51. package/dist/pico8/index.js +1 -1
  52. package/dist/pico8/lua.d.ts.map +1 -1
  53. package/dist/pico8/palette.d.ts.map +1 -1
  54. package/dist/pico8/pico8.spec.d.ts.map +1 -1
  55. package/dist/pico8/protocol.d.ts.map +1 -1
  56. package/dist/pico8/vitePlugin.d.ts.map +1 -1
  57. package/dist/plugins.d.ts.map +1 -1
  58. package/dist/plugins.spec.d.ts.map +1 -1
  59. package/dist/sdk.d.ts.map +1 -1
  60. package/dist/sdk.gameCompleted.spec.d.ts.map +1 -1
  61. package/dist/sdk.gameReady.spec.d.ts.map +1 -1
  62. package/dist/sdk.pause.spec.d.ts.map +1 -1
  63. package/dist/sdk.session.spec.d.ts.map +1 -1
  64. package/dist/settings.spec.d.ts.map +1 -1
  65. package/dist/simulator/checklistProgress.d.ts.map +1 -1
  66. package/dist/simulator/checklistProgress.spec.d.ts.map +1 -1
  67. package/dist/simulator/createSimulator.d.ts.map +1 -1
  68. package/dist/simulator/dockedKeyboard.d.ts.map +1 -1
  69. package/dist/simulator/fixtures.d.ts.map +1 -1
  70. package/dist/simulator/index.cjs +1 -1
  71. package/dist/simulator/index.d.ts.map +1 -1
  72. package/dist/simulator/index.js +2 -1
  73. package/dist/simulator/marker.d.ts.map +1 -1
  74. package/dist/simulator/messaging.d.ts.map +1 -1
  75. package/dist/simulator/normalizeThumbnail.d.ts.map +1 -1
  76. package/dist/simulator/pmmgOverlay.d.ts +36 -0
  77. package/dist/simulator/pmmgOverlay.d.ts.map +1 -0
  78. package/dist/simulator/pmmgOverlay.spec.d.ts +2 -0
  79. package/dist/simulator/pmmgOverlay.spec.d.ts.map +1 -0
  80. package/dist/simulator/pmmgRenderer.d.ts +86 -0
  81. package/dist/simulator/pmmgRenderer.d.ts.map +1 -0
  82. package/dist/simulator/pmmgRenderer.spec.d.ts +2 -0
  83. package/dist/simulator/pmmgRenderer.spec.d.ts.map +1 -0
  84. package/dist/simulator/standalone.cjs +1 -1
  85. package/dist/simulator/standalone.cjs.map +1 -1
  86. package/dist/simulator/standalone.d.ts.map +1 -1
  87. package/dist/simulator/standalone.js +2 -1
  88. package/dist/simulator/standalone.js.map +1 -1
  89. package/dist/simulator/state.d.ts +19 -0
  90. package/dist/simulator/state.d.ts.map +1 -1
  91. package/dist/simulator/state.spec.d.ts.map +1 -1
  92. package/dist/simulator/styles.d.ts +1 -1
  93. package/dist/simulator/styles.d.ts.map +1 -1
  94. package/dist/simulator/types.d.ts +5 -0
  95. package/dist/simulator/types.d.ts.map +1 -1
  96. package/dist/simulator/views/AuthView.d.ts.map +1 -1
  97. package/dist/simulator/views/ChecklistView.d.ts.map +1 -1
  98. package/dist/simulator/views/CheckpointsView.d.ts.map +1 -1
  99. package/dist/simulator/views/CtrlView.d.ts.map +1 -1
  100. package/dist/simulator/views/DataView.d.ts.map +1 -1
  101. package/dist/simulator/views/DoneView.d.ts.map +1 -1
  102. package/dist/simulator/views/FeaturesView.d.ts.map +1 -1
  103. package/dist/simulator/views/HostView.d.ts.map +1 -1
  104. package/dist/simulator/views/KeyboardView.d.ts.map +1 -1
  105. package/dist/simulator/views/MsgsView.d.ts.map +1 -1
  106. package/dist/simulator/views/PmmgView.d.ts +7 -0
  107. package/dist/simulator/views/PmmgView.d.ts.map +1 -0
  108. package/dist/simulator/views/SettingsView.d.ts.map +1 -1
  109. package/dist/simulator/views/SoundView.d.ts.map +1 -1
  110. package/dist/simulator/views/ThemeView.d.ts.map +1 -1
  111. package/dist/simulator/views/ThumbView.d.ts.map +1 -1
  112. package/dist/simulator/views/index.d.ts +1 -0
  113. package/dist/simulator/views/index.d.ts.map +1 -1
  114. package/dist/svgJSX.d.ts.map +1 -1
  115. package/dist/tableBoard-B0I9wVQq.js +635 -0
  116. package/dist/tableBoard-B0I9wVQq.js.map +1 -0
  117. package/dist/tableBoard-CLDBwRYs.cjs +2 -0
  118. package/dist/tableBoard-CLDBwRYs.cjs.map +1 -0
  119. package/dist/tableBoard.cjs +1 -0
  120. package/dist/tableBoard.d.ts +138 -0
  121. package/dist/tableBoard.d.ts.map +1 -0
  122. package/dist/tableBoard.js +2 -0
  123. package/dist/tableBoardScene.d.ts +21 -0
  124. package/dist/tableBoardScene.d.ts.map +1 -0
  125. package/dist/themes.d.ts +16 -16
  126. package/dist/themes.d.ts.map +1 -1
  127. package/dist/types.d.ts +161 -0
  128. package/dist/types.d.ts.map +1 -1
  129. package/dist/vite.cjs +3 -3
  130. package/dist/vite.cjs.map +1 -1
  131. package/dist/vite.d.ts +20 -0
  132. package/dist/vite.d.ts.map +1 -1
  133. package/dist/vite.js +72 -16
  134. package/dist/vite.js.map +1 -1
  135. package/package.json +5 -5
  136. package/dist/createSimulator-2M7vXzRZ.js.map +0 -1
  137. package/dist/createSimulator-B4QlohUV.cjs +0 -1930
  138. package/dist/createSimulator-B4QlohUV.cjs.map +0 -1
  139. package/dist/fonts.cjs.map +0 -1
  140. package/dist/fonts.js.map +0 -1
  141. package/dist/thumbnailMotion.cjs +0 -5
  142. package/dist/thumbnailMotion.cjs.map +0 -1
  143. package/dist/thumbnailMotion.d.ts +0 -119
  144. package/dist/thumbnailMotion.d.ts.map +0 -1
  145. package/dist/thumbnailMotion.js +0 -480
  146. package/dist/thumbnailMotion.js.map +0 -1
  147. package/dist/thumbnailMotion.spec.d.ts +0 -2
  148. package/dist/thumbnailMotion.spec.d.ts.map +0 -1
@@ -0,0 +1,2233 @@
1
+ const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`),n=require(`./asyncToGenerator-Tjg_Hpik.cjs`),r=require(`./tableBoard-CLDBwRYs.cjs`),i=require(`./fonts-CS5qdLf3.cjs`),a=[{name:`Puzzmo (light)`,type:`light`,key:`#FFAAAC`,keyFG:`#000000`,keyStrong:`#F7868B`,keyLight:`#FFD2D3`,g_key:`#FFAAAC`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#98B389`,alt2:`#FAC16C`,alt3:`#D298FF`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#FFFFFF`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#F2F2F2`,a_bgAlt:`#ECECEC`,a_puzmo:`#FFC000`,a_headerText:`#000000`,a_table:`#F9F9F9`,a_tableAlt:`#F6F4F4`,a_inlineTag:`#D9D9D9`,a_anchor:`#1F97EE`,a_infoBG:`#FFFFFF`},{name:`Puzzmo (dark)`,type:`dark`,key:`#FFAAAC`,keyFG:`#000000`,keyStrong:`#F7868B`,keyLight:`#FFD2D3`,g_key:`#FFAAAC`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,subBrand:`#FFC000`,subBrandFG:`#000000`,alt1:`#98B389`,alt2:`#FAC16C`,alt3:`#D298FF`,error:`#FF3C3C`,fg:`#ECECEC`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#374351`,g_bgAlt:`#333D49`,g_bgDark:`#2C2F33`,g_textDark:`#F2F2F2`,g_textLight:`#20180E`,g_blank:`#000000`,g_unsolved:`#747474`,g_outline:`#646464`,a_bg:`#141620`,a_bgAlt:`#202433`,a_puzmo:`#FFC000`,a_headerText:`#A1BAD4`,a_table:`#303246`,a_tableAlt:`#393b52`,a_inlineTag:`#ECECEC`,a_anchor:`#1F97EE`,a_infoBG:`#282C3A`},{name:`Foshay`,type:`light`,key:`#98B389`,keyFG:`#313540`,keyStrong:`#87BD69`,keyLight:`#809B77`,g_key:`#98B389`,player:`#3EC0E5`,subBrand:`#FFC000`,subBrandFG:`#000000`,playerFG:`#292B35`,playerLight:`#A8B5D6`,alt1:`#D87DA4`,alt2:`#E3A54F`,alt3:`#D298FF`,error:`#FF3C3C`,fg:`#292B35`,alwaysDark:`#292B35`,alwaysLight:`#D1DBF2`,g_bg:`#949EBA`,g_bgAlt:`#8891AB`,g_bgDark:`#7B839B`,g_textDark:`#292B35`,g_textLight:`#FFFFFF`,g_blank:`#292B35`,g_unsolved:`#B6B7BA`,g_outline:`#676F83`,a_bg:`#828CA3`,a_bgAlt:`#7F889F`,a_puzmo:`#FFC000`,a_headerText:`#292B35`,a_table:`#7A8399`,a_tableAlt:`#767E94`,a_inlineTag:`#ECECEC`,a_anchor:`#56C9E9`,a_infoBG:`#767F95`},{name:`Bright white`,type:`light`,key:`#67ced2`,keyFG:`#000000`,keyStrong:`#26a0a5`,keyLight:`#ade6e9`,g_key:`#67ced2`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#d26767`,alt2:`#fac16c`,alt3:`#7580bd`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#111111`,alwaysLight:`#FFFFFF`,g_bg:`#f6f6f6`,g_bgAlt:`#F4F4F4`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FFFFFF`,a_bgAlt:`#f8fbfc`,a_puzmo:`#FFC000`,a_headerText:`#000000`,a_table:`#EDEDED`,a_tableAlt:`#DBDBDB`,a_inlineTag:`#D9D9D9`,a_anchor:`#1F97EE`,a_infoBG:`#f6f6f6`},{name:`Submersible`,type:`dark`,key:`#CD6DC6`,keyFG:`#031698`,keyStrong:`#FF7ABC`,keyLight:`#B467CB`,g_key:`#CD6DC6`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#4AB1D1`,playerFG:`#071D47`,playerLight:`#3C99D7`,alt1:`#8BA964`,alt2:`#C69A58`,alt3:`#7644B5`,fg:`#FFEBFF`,error:`#FF3C3C`,alwaysDark:`#031698`,alwaysLight:`#FFEBFF`,g_bg:`#043BED`,g_bgAlt:`#0A31CC`,g_bgDark:`#0E2DA8`,g_textDark:`#031698`,g_textLight:`#FFEBFF`,g_blank:`#031698`,g_unsolved:`#3662F1`,g_outline:`#031698`,a_bg:`#043BED`,a_bgAlt:`#0A31CC`,a_puzmo:`#FFC000`,a_headerText:`#FFEBFF`,a_table:`#043BED`,a_tableAlt:`#0A31CC`,a_inlineTag:`#FF7ABC`,a_anchor:`#FF7ABC`,a_infoBG:`#0A31CC`},{name:`Hot Dog (beta)`,type:`light`,key:`#FFFF00`,keyFG:`#000000`,keyStrong:`#FFE600`,keyLight:`#FFEC44`,g_key:`#FFFF00`,subBrand:`#FFC000`,subBrandFG:`#000000`,player:`#FF7A00`,playerFG:`#000000`,playerLight:`#FFA450`,alt1:`#3ABC5E`,alt2:`#5C3ABC`,alt3:`#BC3AAF`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#FFFFFF`,g_bg:`#EBFF00`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FF0000`,a_bgAlt:`#E50000`,a_puzmo:`#FFC000`,a_headerText:`#FFFFFF`,a_table:`#E50000`,a_tableAlt:`#FF2525`,a_inlineTag:`#000000`,a_anchor:`#000000`,a_infoBG:`#C6C6C6`},{name:`Outlook Hayesy`,type:`light`,key:`#DAB98C`,keyFG:`#000000`,keyStrong:`#B99368`,keyLight:`#DAB98C`,subBrand:`#FFC000`,subBrandFG:`#000000`,g_key:`#DAB98C`,player:`#5DBAFC`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#5EC386`,alt2:`#5E93C3`,alt3:`#C35E5E`,fg:`#000000`,error:`#FF3C3C`,alwaysDark:`#5E390F`,alwaysLight:`#FFF3E4`,g_bg:`#FFFFFF`,g_bgAlt:`#EBEBEB`,g_bgDark:`#D6D6D6`,g_textDark:`#1B1B28`,g_textLight:`#FFFFFF`,g_blank:`#000000`,g_unsolved:`#C2C2C2`,g_outline:`#1B1D29`,a_bg:`#FEF5E8`,a_bgAlt:`#ffffff`,a_puzmo:`#FAC7CE`,a_headerText:`#000000`,a_table:`#FAE8D3`,a_tableAlt:`#EED7BC`,a_inlineTag:`#D9D9D9`,a_anchor:`#B99368`,a_infoBG:`#FFFFFF`},{name:`Console (beta)`,type:`dark`,key:`#957df9`,keyFG:`#000000`,keyStrong:`#590FF5`,keyLight:`#590FF5`,subBrand:`#FFC000`,subBrandFG:`#000000`,g_key:`#FFFF00`,player:`#ffffff`,playerFG:`#000000`,playerLight:`#9EDDFF`,alt1:`#590ff5`,alt2:`#00e200`,alt3:`#ff8a02`,fg:`#00e200`,error:`#FF3C3C`,alwaysDark:`#1B1D29`,alwaysLight:`#00e200`,g_bg:`#101428`,g_bgAlt:`#101428`,g_bgDark:`#00e200`,g_textDark:`#00e200`,g_textLight:`#590ff5`,g_blank:`#00e200`,g_unsolved:`#0000ff`,g_outline:`#00e200`,a_bg:`#000000`,a_bgAlt:`#112211`,a_puzmo:`#ffffff`,a_headerText:`#00e200`,a_table:`#000000`,a_tableAlt:`#002200`,a_inlineTag:`#D9D9D9`,a_anchor:`#957df9`,a_infoBG:`#001900`}];var o={collapsed:`simulator-collapsed`,tab:`simulator-tab`,theme:`simulator-theme`,fixtureCategory:`simulator-fixture-category`,fixturePuzzle:`simulator-fixture-puzzle`,renderHost:`simulator-render-host`,renderContext:`simulator-render-context`,previewKind:`simulator-preview-kind`,gameSettings:`simulator-game-settings`,hostContext:`simulator-host-context`,keyboardDocked:`simulator-keyboard-docked`,pmmg:`simulator-pmmg`},s=`simulator-override:`;function c(e){return`${s}${e}:${(window.location.pathname||`/`).replace(/\/index\.html$/,``).replace(/\/+$/,``)||`/`}`}function l(e){try{return localStorage.getItem(c(e))}catch(e){return null}}function u(e,t){try{return localStorage.setItem(c(e),t),!0}catch(e){return!1}}function d(e){try{localStorage.removeItem(c(e))}catch(e){}}function f(){d(`puzzle`),d(`input`)}function p(){let e=localStorage.getItem(o.hostContext);if(!e)return null;try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch(e){}return null}function m(e){localStorage.setItem(o.hostContext,JSON.stringify(e))}function h(){localStorage.removeItem(o.hostContext)}function g(){return localStorage.getItem(o.keyboardDocked)===`true`}function _(e){localStorage.setItem(o.keyboardDocked,String(e))}var v={subtab:`layout`,follow:!0,bounds:!0,grid:!1,boxes:!1,anchors:!1,keys:!1,backdrop:`checker`,fidelity:`high`,backgroundStyle:`theme`};function y(){let e=t.t({},v);try{var n;let t=JSON.parse((n=localStorage.getItem(o.pmmg))==null?`{}`:n);[`layout`,`sprites`,`scene`].includes(t.subtab)&&(e.subtab=t.subtab),[`checker`,`theme`,`black`,`white`].includes(t.backdrop)&&(e.backdrop=t.backdrop),[`high`,`low`].includes(t.fidelity)&&(e.fidelity=t.fidelity),[`theme`,`dark`,`light`].includes(t.backgroundStyle)&&(e.backgroundStyle=t.backgroundStyle);for(let n of[`follow`,`bounds`,`grid`,`boxes`,`anchors`,`keys`])typeof t[n]==`boolean`&&(e[n]=t[n])}catch(e){}return e}function b(e){localStorage.setItem(o.pmmg,JSON.stringify(e))}function x(){let e=localStorage.getItem(o.gameSettings);if(!e)return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch(e){}return{}}function S(){let e=localStorage.getItem(o.theme);if(e){let t=a.find(t=>t.name===e);if(t)return t}return a[0]}function C(e){var t;let n=localStorage.getItem(o.tab);return n&&e.includes(n)?n:(t=e[0])==null?`ctrl`:t}function w(e){let t=localStorage.getItem(o.collapsed);return t===null?e:t===`true`}function T(){let e=localStorage.getItem(o.renderHost);return e&&[`game`,`app`,`opengraph`].includes(e)?e:`game`}function E(){return localStorage.getItem(o.previewKind)===`text`?`text`:`image`}function D(){let e=localStorage.getItem(o.renderContext);if(e&&[`preview`,`share`,`completed`,`timeline`].includes(e))return e}function O(e,t,n){var r,i,a;let s=localStorage.getItem(o.fixtureCategory),c=localStorage.getItem(o.fixturePuzzle),u=p(),d=l(`puzzle`),f=l(`input`);return{hostContext:(r=u==null?e.hostContext:u)==null?[{type:`app`,layout:`desktop`,host:null}]:r,hostContextIsOverridden:u!==null,isCollapsed:w((i=e.collapsed)==null?!0:i),isPaused:!1,hasStarted:!1,activeTab:C(n),puzzleData:d,originalPuzzle:d==null?``:d,currentInputStr:f==null?``:f,userStorage:null,appliedPuzzleOverride:d,appliedInputOverride:f,completionData:null,selectedTheme:S(),selectedCategory:s&&t.includes(s)?s:(a=t[0])==null?null:a,selectedPuzzle:c==null?null:c,renderHost:T(),renderContext:D(),previewKind:E(),gameSettings:x(),keyboardDocked:g(),settingsComponents:null}}function k(e){localStorage.setItem(o.gameSettings,JSON.stringify(e))}function A(){localStorage.removeItem(o.gameSettings)}function j(e){localStorage.setItem(o.collapsed,String(e))}function M(e){localStorage.setItem(o.tab,e)}function N(e){localStorage.setItem(o.theme,e)}function P(e){localStorage.setItem(o.fixtureCategory,e)}function ee(e){localStorage.setItem(o.fixturePuzzle,e)}function F(){localStorage.removeItem(o.fixturePuzzle)}function I(e){e?localStorage.setItem(o.renderHost,e):localStorage.removeItem(o.renderHost)}function L(e){localStorage.setItem(o.previewKind,e)}function R(e){e?localStorage.setItem(o.renderContext,e):localStorage.removeItem(o.renderContext)}function te(e){let t=[];return{log(n,r,i){let a={type:n,data:r,time:new Date().toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),direction:i};t.push(a),t.length>100&&t.shift(),e==null||e(a)},clear(){t.length=0},getLog(){return t}}}function z(e,t,n){console.log(`Simulator sending:`,e,t),n==null||n.log(e,t,`out`),window.postMessage({type:e,data:t},`*`)}function ne(e,t){let n=n=>{var r,i,a;if(!(!(n==null||(r=n.data)==null)&&r.type))return;let o=n.data.type,s=(i=(a=n.data.data)==null?n.data.json:a)==null?{}:i;[`TIMER_TICK`,`TIMER_SYNC`].includes(o)||t==null||t.log(o,s,`in`),e(o,s)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function B(e){let t=new Map;console.log(`Simulator: Parsing fixtures`,Object.keys(e));for(let[o,s]of Object.entries(e)){var n,r,i,a;let e=o.split(`/`),c=(n=(r=e.pop())==null?void 0:r.replace(/\.[^.]+$/,``))==null?``:n,l=(i=e.pop())==null?`default`:i;t.has(l)||t.set(l,new Map);let u=(a=s.default)==null?s:a;t.get(l).set(c,u)}return t.forEach((e,n)=>{let r=new Map(Array.from(e.entries()).sort((e,t)=>{var n,r,i,a;return parseInt((n=(r=e[0].match(/\d+/))==null?void 0:r[0])==null?`0`:n)-parseInt((i=(a=t[0].match(/\d+/))==null?void 0:a[0])==null?`0`:i)}));t.set(n,r)}),t}function V(e,t){return e.length===0?``:`
2
+ <div class="simulator-fixtures">
3
+ <div class="simulator-field">
4
+ <label class="simulator-label">Category</label>
5
+ <select class="simulator-select" id="simulator-fixture-category">
6
+ ${e.map(e=>`<option value="${e}" ${e===t?`selected`:``}>${e}</option>`).join(``)}
7
+ </select>
8
+ </div>
9
+ <div class="simulator-field">
10
+ <label class="simulator-label">Puzzle</label>
11
+ <select class="simulator-select" id="simulator-fixture-puzzle"></select>
12
+ </div>
13
+ </div>
14
+ `}function H(e,t,n,r){let i=t.get(n);if(!i)return null;let a=Array.from(i.keys()),o=r;if(!r||!i.has(r)){var s;o=(s=a[0])==null?null:s}return e.innerHTML=a.map(e=>`<option value="${e}" ${e===o?`selected`:``}>${e}</option>`).join(``),o}function re(e,t,n){var r,i;return!t||!n||(r=(i=e.get(t))==null?void 0:i.get(n))==null?null:r}const ie=`puzzmo-simulator-dev-only-do-not-ship`;function ae(){return{id:`ctrl`,label:`Ctrl`,render(){return`
15
+ <div id="simulator-fixtures-container"></div>
16
+ <div id="simulator-status">
17
+ <span class="indicator waiting"></span>
18
+ <span class="text">Waiting for READY...</span>
19
+ </div>
20
+ <div class="simulator-row">
21
+ <button class="simulator-btn primary" id="simulator-start" disabled>Start</button>
22
+ <button class="simulator-btn" id="simulator-pause" disabled>Pause</button>
23
+ </div>
24
+ <div class="simulator-row">
25
+ <button class="simulator-btn danger" id="simulator-retry" disabled>Retry</button>
26
+ </div>
27
+ `},bind(e){let t=e.getElement(`#simulator-start`),n=e.getElement(`#simulator-pause`),r=e.getElement(`#simulator-retry`),i=e.getElement(`#simulator-fixtures-container`);if(console.log(`Simulator: CtrlView.bind called`,{hasFixtures:!!e.fixtures,categories:e.fixtureCategories,selectedCategory:e.state.selectedCategory,selectedPuzzle:e.state.selectedPuzzle}),e.fixtures&&e.fixtureCategories.length>0&&i){i.innerHTML=V(e.fixtureCategories,e.state.selectedCategory);let t=e.getElement(`#simulator-fixture-category`),n=e.getElement(`#simulator-fixture-puzzle`);if(t&&n&&e.state.selectedCategory){e.state.selectedPuzzle=H(n,e.fixtures,e.state.selectedCategory,e.state.selectedPuzzle);let r=re(e.fixtures,e.state.selectedCategory,e.state.selectedPuzzle);console.log(`Simulator: Loading fixture puzzle`,{category:e.state.selectedCategory,puzzle:e.state.selectedPuzzle,hasPuzzleData:!!r}),r&&(e.state.appliedPuzzleOverride===null&&(e.state.puzzleData=r,e.state.originalPuzzle=r),e.state.selectedCategory&&P(e.state.selectedCategory),e.state.selectedPuzzle&&ee(e.state.selectedPuzzle)),t.addEventListener(`change`,()=>{console.log(`Simulator: Category changed, reloading...`,t.value),f(),P(t.value),F(),window.location.reload()}),n.addEventListener(`change`,()=>{console.log(`Simulator: Puzzle changed, reloading...`,n.value),f(),ee(n.value),window.location.reload()})}}t==null||t.addEventListener(`click`,()=>{e.state.isPaused?(e.sendToGame(`RESUME_GAME`,{}),e.state.isPaused=!1,n&&(n.textContent=`Pause`),e.updateStatus(`Running`,`ready`)):(e.sendToGame(`START_GAME`,void 0),e.state.hasStarted=!0,n&&(n.disabled=!1),t&&(t.textContent=`Resume`),e.updateStatus(`Running`,`ready`))}),n==null||n.addEventListener(`click`,()=>{e.state.isPaused?(e.sendToGame(`RESUME_GAME`,{}),e.state.isPaused=!1,n.textContent=`Pause`,e.updateStatus(`Running`,`ready`)):(e.sendToGame(`PAUSE_GAME`,{}),e.state.isPaused=!0,n.textContent=`Resume`,e.updateStatus(`Paused`,`paused`))}),r==null||r.addEventListener(`click`,()=>{e.sendToGame(`RETRY_PUZZLE`,{}),e.state.hasStarted=!1,e.state.isPaused=!1,n&&(n.disabled=!0,n.textContent=`Pause`),t&&(t.textContent=`Start`),e.updateStatus(`Ready to retry`,`ready`)})},onMessage(e,t,n){let r=n.getElement(`#simulator-start`),i=n.getElement(`#simulator-pause`),a=n.getElement(`#simulator-retry`);e===`READY_GAME_LOADED`&&(r&&(r.disabled=!1),a&&(a.disabled=!1),n.updateStatus(`Ready`,`ready`)),e===`GAME_COMPLETED`&&(n.state.hasStarted=!1,i&&(i.disabled=!0),r&&(r.disabled=!0),n.updateStatus(`Completed!`,`complete`))}}}function U(e){var t;if(typeof e!=`string`)return e;let n=(t=W(e))==null?{width:800,height:800}:t;return{svg:e,width:n.width,height:n.height}}function W(e){var t,n,r,i;let a=e.indexOf(`<svg`);if(a===-1)return;let o=e.indexOf(`>`,a),s=o===-1?e.slice(a):e.slice(a,o+1),c=/viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(s);if(c){let e=parseFloat(c[1]),t=parseFloat(c[2]);if(e>0&&t>0)return{width:e,height:t}}let l=parseFloat((t=(n=/\bwidth\s*=\s*["']\s*([\d.]+)(?:px)?\s*["']/i.exec(s))==null?void 0:n[1])==null?``:t),u=parseFloat((r=(i=/\bheight\s*=\s*["']\s*([\d.]+)(?:px)?\s*["']/i.exec(s))==null?void 0:i[1])==null?``:r);if(l>0&&u>0)return{width:l,height:u}}var oe=`simulator-saved-states`;function se(){let e=globalThis;for(let t of Object.keys(e))if(t.endsWith(`Thumbnail`)&&typeof e[t]==`function`)return{name:t,fn:e[t]};return null}function ce(e,t){let n=se();if(!n)return``;try{var r;let i=(r=e.state.puzzleData)==null?``:r,a={viewerIsOwner:!0,theme:e.state.selectedTheme,strict:!0,renderHost:`game`};return U(n.fn(i,t,a)).svg}catch(e){return``}}var G=[];function K(e,t=8){let n=14*t+8+4;e.style.height=`auto`;let r=Math.min(Math.max(e.scrollHeight,40),n);e.style.height=`${r}px`}function le(){let e=``,t=``;return{id:`data`,label:`Data`,render(){return`
28
+ <div class="data-view-container">
29
+ <div class="data-subtabs">
30
+ <button class="data-subtab active" data-subtab="edit">Edit</button>
31
+ <button class="data-subtab" data-subtab="history">History</button>
32
+ <button class="data-subtab" data-subtab="saves">Saves</button>
33
+ </div>
34
+
35
+ <div class="data-subtab-content active" id="data-subtab-edit">
36
+ <div class="simulator-field">
37
+ <label class="simulator-label">
38
+ Puzzle String<span class="simulator-override-tag" id="simulator-puzzle-override-tag" hidden>applied</span>
39
+ </label>
40
+ <textarea class="simulator-textarea auto-resize" id="simulator-puzzle" placeholder="Loading..."></textarea>
41
+ <div class="simulator-row">
42
+ <button class="simulator-btn subtle" id="simulator-puzzle-reset">Reset</button>
43
+ <button class="simulator-btn primary" id="simulator-puzzle-apply" disabled>Apply</button>
44
+ </div>
45
+ </div>
46
+ <div class="simulator-divider"></div>
47
+ <div class="simulator-field">
48
+ <label class="simulator-label">
49
+ Input String<span class="simulator-override-tag" id="simulator-input-override-tag" hidden>applied</span>
50
+ </label>
51
+ <textarea class="simulator-textarea auto-resize" id="simulator-input" placeholder="No input yet..."></textarea>
52
+ <div class="simulator-row">
53
+ <button class="simulator-btn subtle" id="simulator-input-reset">Reset</button>
54
+ <button class="simulator-btn primary" id="simulator-input-apply" disabled>Apply</button>
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="data-subtab-content" id="data-subtab-history">
60
+ <div class="history-header">
61
+ <span class="simulator-label">Input String Timeline</span>
62
+ <button class="simulator-btn tiny" id="simulator-history-clear">Clear</button>
63
+ </div>
64
+ <div class="history-list" id="simulator-history-list">
65
+ <div class="simulator-empty">No history yet</div>
66
+ </div>
67
+ </div>
68
+
69
+ <div class="data-subtab-content" id="data-subtab-saves">
70
+ <div class="save-new">
71
+ <input type="text" class="simulator-input" id="simulator-save-name" placeholder="Save name..." />
72
+ <button class="simulator-btn primary" id="simulator-save-btn">Save</button>
73
+ </div>
74
+ <div class="simulator-divider"></div>
75
+ <div class="saves-list" id="simulator-saves-list">
76
+ <div class="simulator-empty">No saved states</div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ `},bind(n){let r=n.getElement(`.data-subtabs`);r==null||r.querySelectorAll(`.data-subtab`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-subtab`);if(!t)return;r.querySelectorAll(`.data-subtab`).forEach(e=>e.classList.remove(`active`)),e.classList.add(`active`);let i=n.getElement(`.data-view-container`);i==null||i.querySelectorAll(`.data-subtab-content`).forEach(e=>{e.classList.toggle(`active`,e.id===`data-subtab-${t}`)}),t===`edit`?me(n):t===`history`?de(n):t===`saves`&&fe(n)})});let i=n.getElement(`#simulator-puzzle`),a=n.getElement(`#simulator-input`),o=n.getElement(`#simulator-puzzle-reset`),s=n.getElement(`#simulator-puzzle-apply`),c=n.getElement(`#simulator-input-reset`),l=n.getElement(`#simulator-input-apply`);setTimeout(()=>{i&&n.state.originalPuzzle&&document.activeElement!==i&&(i.value=n.state.originalPuzzle,e=n.state.originalPuzzle,K(i)),a&&n.state.currentInputStr&&document.activeElement!==a&&(a.value=n.state.currentInputStr,t=n.state.currentInputStr,K(a)),he(n)},0),i==null||i.addEventListener(`input`,()=>{K(i);let t=i.value!==e;s&&(s.disabled=!t)}),a==null||a.addEventListener(`input`,()=>{K(a);let e=a.value!==t;l&&(l.disabled=!e)}),o==null||o.addEventListener(`click`,()=>{if(n.state.appliedPuzzleOverride!==null){d(`puzzle`),n.updateStatus(`Restoring fixture puzzle...`,`waiting`),window.location.reload();return}i&&(i.value=n.state.originalPuzzle,e=n.state.originalPuzzle,K(i),s&&(s.disabled=!0))}),s==null||s.addEventListener(`click`,()=>{if(i){if(!u(`puzzle`,i.value)){n.updateStatus(`Could not store puzzle — storage unavailable`,`paused`);return}d(`input`),s.disabled=!0,n.updateStatus(`Applying puzzle...`,`waiting`),window.location.reload()}}),c==null||c.addEventListener(`click`,()=>{if(n.state.appliedInputOverride!==null){d(`input`),n.updateStatus(`Clearing input...`,`waiting`),window.location.reload();return}a&&(a.value=t,K(a),l&&(l.disabled=!0))}),l==null||l.addEventListener(`click`,()=>{if(a){if(!u(`input`,a.value)){n.updateStatus(`Could not store input — storage unavailable`,`paused`);return}l.disabled=!0,n.updateStatus(`Applying input...`,`waiting`),window.location.reload()}});let f=n.getElement(`#simulator-history-clear`);f==null||f.addEventListener(`click`,()=>{G=[],de(n)});let p=n.getElement(`#simulator-save-name`),m=n.getElement(`#simulator-save-btn`);m==null||m.addEventListener(`click`,()=>{if(!p||!p.value.trim())return;let e=ue(),t={name:p.value.trim(),puzzleStr:n.state.originalPuzzle,inputStr:n.state.currentInputStr,timestamp:Date.now()};e.push(t),localStorage.setItem(oe,JSON.stringify(e)),p.value=``,fe(n)}),fe(n)},onActivate(n){e=n.state.originalPuzzle,t=n.state.currentInputStr,me(n),de(n)},onMessage(e,n,r){var i,a;let o=r.getElement(`#simulator-input`),s=r.getElement(`#simulator-input-apply`),c=(i=n==null||(a=n.input)==null?void 0:a.boardState)==null?n==null?void 0:n.boardState:i;if(e===`UPLOAD_NEW_GAME_STATE`&&c){if(r.state.currentInputStr=c,G.length===0||G[G.length-1].value!==c){G.push({value:c,timestamp:Date.now()}),G.length>100&&(G=G.slice(-100));let e=r.getElement(`#data-subtab-history`);e!=null&&e.classList.contains(`active`)&&de(r)}o&&document.activeElement!==o&&(o.value!==c&&(o.value=c,K(o)),t=c,s&&(s.disabled=!0))}}}}function ue(){try{let e=localStorage.getItem(oe);return e?JSON.parse(e):[]}catch(e){return[]}}function de(e){let t=e.getElement(`#simulator-history-list`);if(t){if(t.style.setProperty(`--history-thumb-bg`,e.state.selectedTheme.a_bg),G.length===0){t.innerHTML=`<div class="simulator-empty">No history yet</div>`;return}t.innerHTML=[...G].reverse().map((t,n)=>{let r=G.length-1-n,i=new Date(t.timestamp).toLocaleTimeString(),a=t.value.length>60?t.value.slice(0,60)+`...`:t.value;return`
81
+ <div class="history-item" data-history-idx="${r}">
82
+ <div class="history-item-thumb">${ce(e,t.value)}</div>
83
+ <div class="history-item-content">
84
+ <div class="history-item-header">
85
+ <span class="history-item-num">#${r+1}</span>
86
+ <span class="history-item-time">${i}</span>
87
+ <button class="simulator-btn tiny history-restore-btn" data-history-idx="${r}">Restore</button>
88
+ </div>
89
+ <div class="history-item-preview">${pe(a)}</div>
90
+ </div>
91
+ </div>
92
+ `}).join(``),t.querySelectorAll(`.history-restore-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let n=parseInt(t.target.getAttribute(`data-history-idx`)||`0`),r=G[n];if(r){let t=e.getElement(`.data-subtab[data-subtab="edit"]`);t==null||t.click();let n=e.getElement(`#simulator-input`),i=e.getElement(`#simulator-input-apply`);n&&(n.value=r.value,K(n)),i&&(i.disabled=!1),e.updateStatus(`Input restored — press Apply to load it`,`ready`)}})})}}function fe(e){let t=e.getElement(`#simulator-saves-list`);if(!t)return;let n=ue();if(n.length===0){t.innerHTML=`<div class="simulator-empty">No saved states</div>`;return}t.innerHTML=[...n].reverse().map((e,t)=>{let r=n.length-1-t,i=new Date(e.timestamp).toLocaleDateString(),a=new Date(e.timestamp).toLocaleTimeString();return`
93
+ <div class="save-item">
94
+ <div class="save-item-header">
95
+ <span class="save-item-name">${pe(e.name)}</span>
96
+ <span class="save-item-time">${i} ${a}</span>
97
+ </div>
98
+ <div class="save-item-actions">
99
+ <button class="simulator-btn tiny save-load-btn" data-save-idx="${r}">Load</button>
100
+ <button class="simulator-btn tiny danger save-delete-btn" data-save-idx="${r}">Delete</button>
101
+ </div>
102
+ </div>
103
+ `}).join(``),t.querySelectorAll(`.save-load-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let r=n[parseInt(t.target.getAttribute(`data-save-idx`)||`0`)];if(r){if(!u(`puzzle`,r.puzzleStr)||!u(`input`,r.inputStr)){f(),e.updateStatus(`Could not load "${r.name}" — storage unavailable`,`paused`);return}e.updateStatus(`Loading: ${r.name}`,`waiting`),window.location.reload()}})}),t.querySelectorAll(`.save-delete-btn`).forEach(t=>{t.addEventListener(`click`,t=>{let r=parseInt(t.target.getAttribute(`data-save-idx`)||`0`),i=n.filter((e,t)=>t!==r);localStorage.setItem(oe,JSON.stringify(i)),fe(e)})})}function pe(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function me(e){let t=e.getElement(`#simulator-puzzle`),n=e.getElement(`#simulator-input`),r=e.getElement(`#simulator-puzzle-apply`),i=e.getElement(`#simulator-input-apply`);t&&e.state.originalPuzzle&&(t.value=e.state.originalPuzzle,K(t),r&&(r.disabled=!0)),n&&(n.value=e.state.currentInputStr,K(n),i&&(i.disabled=!0)),he(e)}function he(e){let t=e.getElement(`#simulator-puzzle-override-tag`),n=e.getElement(`#simulator-input-override-tag`);t&&(t.hidden=e.state.appliedPuzzleOverride===null),n&&(n.hidden=e.state.appliedInputOverride===null)}function ge(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function _e(){let e=0;return{id:`msgs`,label:`Msgs`,render(){return`
104
+ <div class="msgs-view-container">
105
+ <div class="msgs-header">
106
+ <span class="simulator-label">Message Log</span>
107
+ <button class="simulator-btn tiny" id="simulator-msgs-clear">Clear</button>
108
+ </div>
109
+ <div id="simulator-msgs-log"></div>
110
+ </div>
111
+ `},bind(t){let n=t.getElement(`#simulator-msgs-clear`);n==null||n.addEventListener(`click`,()=>{let n=t.getElement(`#simulator-msgs-log`);n&&(n.innerHTML=``),e=0,t.updateBadge(`msgs`,0)})},addLogEntry(t,n){let r=n.getElement(`#simulator-msgs-log`);if(!r)return;e++,n.updateBadge(`msgs`,e);let i=document.createElement(`div`);i.className=`simulator-msg ${t.direction}`;let a=t.data===void 0?``:JSON.stringify(t.data,null,2);i.innerHTML=`
112
+ <div class="simulator-msg-header">
113
+ <span class="simulator-msg-type">${t.direction===`out`?`→`:`←`} ${t.type}</span>
114
+ <span class="simulator-msg-time">${t.time}</span>
115
+ </div>
116
+ ${a?`<div class="simulator-msg-data">${ge(a)}</div>`:``}
117
+ `;let o=i.querySelector(`.simulator-msg-data`);for(o&&o.addEventListener(`click`,()=>{r.querySelectorAll(`.simulator-msg.expanded`).forEach(e=>{e!==i&&e.classList.remove(`expanded`)}),i.classList.toggle(`expanded`)}),r.insertBefore(i,r.firstChild);r.children.length>50;)r.removeChild(r.lastChild)}}}function ve(){return{id:`done`,label:`Done`,render(){return`
118
+ <div id="simulator-done-empty" class="simulator-empty">Game not completed yet</div>
119
+ <div id="simulator-done-content" style="display:none;">
120
+ <div class="simulator-field">
121
+ <label class="simulator-label">Completion Text</label>
122
+ <div id="simulator-done-text" class="simulator-value"></div>
123
+ </div>
124
+ <div class="simulator-divider"></div>
125
+ <div class="simulator-field">
126
+ <label class="simulator-label">Board State</label>
127
+ <textarea class="simulator-textarea" id="simulator-done-input" rows="2" readonly></textarea>
128
+ </div>
129
+ <div class="simulator-divider"></div>
130
+ <div class="simulator-field">
131
+ <label class="simulator-label">Deeds</label>
132
+ <div id="simulator-done-deeds" class="simulator-deeds"></div>
133
+ </div>
134
+ <div class="simulator-divider"></div>
135
+ <div class="simulator-field">
136
+ <label class="simulator-label">Raw Data</label>
137
+ <textarea class="simulator-textarea" id="simulator-done-raw" rows="4" readonly></textarea>
138
+ </div>
139
+ </div>
140
+ `},bind(e){},onMessage(e,t,n){var r,i;if(e===`SHOW_GAME_COMPLETE_SCREEN`){n.setCollapsed(!1),n.switchTab(`done`);return}if(e!==`GAME_COMPLETED`)return;n.state.completionData=t;let a=n.getElement(`#simulator-done-empty`),o=n.getElement(`#simulator-done-content`),s=n.getElement(`#simulator-done-text`),c=n.getElement(`#simulator-done-input`),l=n.getElement(`#simulator-done-deeds`),u=n.getElement(`#simulator-done-raw`);a&&(a.style.display=`none`),o&&(o.style.display=`block`);let d=((r=t.input)==null?void 0:r.completionText)||t.completionText||`(no completion text)`;s&&(s.textContent=d);let f=((i=t.input)==null?void 0:i.boardState)||t.boardState||n.state.currentInputStr||``;if(c&&(c.value=f),l){var p;l.innerHTML=``;let e=((p=t.config)==null?void 0:p.deeds)||t.deeds;e&&Array.isArray(e)?e.forEach(e=>{let t=document.createElement(`div`);t.className=`simulator-deed`,t.innerHTML=`
141
+ <span class="simulator-deed-name">${e.id}</span>
142
+ <span class="simulator-deed-value">${e.value}</span>
143
+ `,l.appendChild(t)}):l.innerHTML=`<div class="simulator-empty">No deeds</div>`}u&&(u.value=JSON.stringify(t,null,2))}}}function ye(){let e=[],t=()=>new Date().toLocaleTimeString(`en-US`,{hour12:!1}),n=e=>{let{checkpointName:t,augConfig:n,time:r}=e,i=n==null?void 0:n.deeds;return`
144
+ <div class="checkpoint-item">
145
+ <div class="checkpoint-header">
146
+ <span class="checkpoint-name">${t}</span>
147
+ <span class="checkpoint-time">${r}</span>
148
+ </div>
149
+ ${i&&i.length>0?`<div class="simulator-deeds">
150
+ ${i.map(e=>`<div class="simulator-deed"><span class="simulator-deed-name">${e.id}</span><span class="simulator-deed-value">${e.value}</span></div>`).join(``)}
151
+ </div>`:``}
152
+ </div>
153
+ `},r=()=>e.length===0?`<div class="simulator-empty">No checkpoints received yet</div>`:e.map(e=>n(e)).join(``);return{id:`checkpoints`,label:`Chkpt`,render(){return`
154
+ <div class="checkpoints-view-container">
155
+ <div class="checkpoints-header">
156
+ <span class="simulator-label">Checkpoints</span>
157
+ <button class="simulator-btn subtle small" id="simulator-checkpoints-clear">Clear</button>
158
+ </div>
159
+ <div id="simulator-checkpoints-list" class="checkpoints-list">
160
+ ${r()}
161
+ </div>
162
+ </div>
163
+ `},bind(t){let n=t.getElement(`#simulator-checkpoints-clear`),i=t.getElement(`#simulator-checkpoints-list`);n==null||n.addEventListener(`click`,()=>{e=[],i&&(i.innerHTML=r()),t.updateBadge(`checkpoints`,0)})},onMessage(n,i,a){if(n!==`HIT_CHECKPOINT`)return;let o={checkpointName:i.checkpointName,augConfig:i.augConfig,time:t()};e.push(o),a.updateBadge(`checkpoints`,e.length);let s=a.getElement(`#simulator-checkpoints-list`);s&&(s.innerHTML=r(),s.scrollTop=s.scrollHeight)}}}var be=e.t((e=>{var t={document:{}},n=Object.prototype.hasOwnProperty,r=function(e){return v(e)?e.toLowerCase():e},i=Array.isArray;function a(e){var t=Function.prototype.constructor;delete Function.prototype.constructor;var n=e();return Function.prototype.constructor=t,n}var o,s=Object.prototype.toString,c=Object.getPrototypeOf,l=j(`ng`);function u(e){if(e==null||x(e))return!1;if(i(e)||v(e)||o&&e instanceof o)return!0;var t=`length`in Object(e)&&e.length;return y(t)&&(t>=0&&(t-1 in e||e instanceof Array)||typeof e.item==`function`)}function d(e,t,r){var a,o;if(e)if(b(e))for(a in e)a!==`prototype`&&a!==`length`&&a!==`name`&&e.hasOwnProperty(a)&&t.call(r,e[a],a,e);else if(i(e)||u(e)){var s=typeof e!=`object`;for(a=0,o=e.length;a<o;a++)(s||a in e)&&t.call(r,e[a],a,e)}else if(e.forEach&&e.forEach!==d)e.forEach(t,r,e);else if(_(e))for(a in e)t.call(r,e[a],a,e);else if(typeof e.hasOwnProperty==`function`)for(a in e)e.hasOwnProperty(a)&&t.call(r,e[a],a,e);else for(a in e)n.call(e,a)&&t.call(r,e[a],a,e);return e}function f(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function p(){}function m(e){return e===void 0}function h(e){return e!==void 0}function g(e){return typeof e==`object`&&!!e}function _(e){return typeof e==`object`&&!!e&&!c(e)}function v(e){return typeof e==`string`}function y(e){return typeof e==`number`}function b(e){return typeof e==`function`}function x(e){return e&&e.window===e}function S(e){return e&&e.$evalAsync&&e.$watch}var C=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;function w(e){return e&&y(e.length)&&C.test(s.call(e))}function T(e){return s.call(e)===`[object ArrayBuffer]`}function E(e,t){var r=[],a=[];if(t){if(w(t)||T(t))throw l(`cpta`,`Can't copy! TypedArray destination cannot be mutated.`);if(e===t)throw l(`cpi`,`Can't copy! Source and destination are identical.`);return i(t)?t.length=0:d(t,function(e,n){n!==`$$hashKey`&&delete t[n]}),r.push(e),a.push(t),o(e,t)}return u(e);function o(e,t){var r=t.$$hashKey,a;if(i(e))for(var o=0,s=e.length;o<s;o++)t.push(u(e[o]));else if(_(e))for(a in e)t[a]=u(e[a]);else if(e&&typeof e.hasOwnProperty==`function`)for(a in e)e.hasOwnProperty(a)&&(t[a]=u(e[a]));else for(a in e)n.call(e,a)&&(t[a]=u(e[a]));return f(t,r),t}function u(e){if(!g(e))return e;var t=r.indexOf(e);if(t!==-1)return a[t];if(x(e)||S(e))throw l(`cpws`,`Can't copy! Making copies of Window or Scope instances is not supported.`);var n=!1,s=p(e);return s===void 0&&(s=i(e)?[]:Object.create(c(e)),n=!0),r.push(e),a.push(s),n?o(e,s):s}function p(e){switch(s.call(e)){case`[object Int8Array]`:case`[object Int16Array]`:case`[object Int32Array]`:case`[object Float32Array]`:case`[object Float64Array]`:case`[object Uint8Array]`:case`[object Uint8ClampedArray]`:case`[object Uint16Array]`:case`[object Uint32Array]`:return new e.constructor(u(e.buffer),e.byteOffset,e.length);case`[object ArrayBuffer]`:if(!e.slice){var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e.slice(0);case`[object Boolean]`:case`[object Number]`:case`[object String]`:case`[object Date]`:return new e.constructor(e.valueOf());case`[object RegExp]`:var n=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]);return n.lastIndex=e.lastIndex,n;case`[object Blob]`:return new e.constructor([e],{type:e.type})}if(b(e.cloneNode))return e.cloneNode(!0)}}function D(e,n){var r=n;return typeof e==`string`&&e.charAt(0)===`$`&&e.charAt(1)===`$`?r=void 0:x(n)?r=`$WINDOW`:n&&t.document===n?r=`$DOCUMENT`:S(n)&&(r=`$SCOPE`),r}function O(){return Object.create(null)}function k(e){var t=[];return JSON.stringify(e,function(e,n){if(n=D(e,n),g(n)){if(t.indexOf(n)>=0)return`...`;t.push(n)}return n})}function A(e){return typeof e==`function`?e.toString().replace(/ \{[\s\S]*$/,``):m(e)?`undefined`:typeof e==`string`?e:k(e)}function j(e,t){return t=t||Error,function(){var n=2,r=arguments,i=r[0],a=`[`+(e?e+`:`:``)+i+`] `,o=r[1],s,c;for(a+=o.replace(/\{\d+\}/g,function(e){var t=+e.slice(1,-1)+n;return t<r.length?A(r[t]):e}),a+=`
164
+ http://errors.angularjs.org/"NG_VERSION_FULL"/`+(e?e+`/`:``)+i,c=n,s=`?`;c<r.length;c++,s=`&`)a+=s+`p`+(c-n)+`=`+encodeURIComponent(A(r[c]));return new t(a)}}var M=j(`$parse`);function N(e){return e+``}var P=O();d(`+ - * / % === !== == != < > <= >= && || ?? ! = | ?`.split(` `),function(e){P[e]=!0});var ee={n:`
165
+ `,f:`\f`,r:`\r`,t:` `,v:`\v`,"'":`'`,'"':`"`};function F(e){this.options=e||{}}F.prototype={constructor:F,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index<this.text.length;){var t=this.text.charAt(this.index);if(t===`"`||t===`'`||t==="`")this.readString(t);else if(this.isNumber(t)||t===`.`&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdentifierStart(this.peekMultichar()))this.readIdent();else if(this.is(t,`(){}[].,;:`))this.tokens.push({index:this.index,text:t}),this.index++;else if(this.isWhitespace(t))this.index++;else{var n=t+this.peek(),r=n+this.peek(2),i=P[t],a=P[n],o=P[r];if(i||a||o){var s=o?r:a?n:t;this.tokens.push({index:this.index,text:s,operator:!0}),this.index+=s.length}else this.throwError(`Unexpected next character `,this.index,this.index+1)}}return this.tokens},is:function(e,t){return t.indexOf(e)!==-1},peek:function(e){var t=e||1;return this.index+t<this.text.length?this.text.charAt(this.index+t):!1},isNumber:function(e){return e>=`0`&&e<=`9`&&typeof e==`string`},isWhitespace:function(e){return e===` `||e===`\r`||e===` `||e===`
166
+ `||e===`\v`||e===`\xA0`},isIdentifierStart:function(e){return this.options.isIdentifierStart?this.options.isIdentifierStart(e,this.codePointAt(e)):this.isValidIdentifierStart(e)},isValidIdentifierStart:function(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`||e===`$`},isIdentifierContinue:function(e){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(e,this.codePointAt(e)):this.isValidIdentifierContinue(e)},isValidIdentifierContinue:function(e,t){return this.isValidIdentifierStart(e,t)||this.isNumber(e)},codePointAt:function(e){return e.length===1?e.charCodeAt(0):(e.charCodeAt(0)<<10)+e.charCodeAt(1)-56613888},peekMultichar:function(){var e=this.text.charAt(this.index),t=this.peek();if(!t)return e;var n=e.charCodeAt(0),r=t.charCodeAt(0);return n>=55296&&n<=56319&&r>=56320&&r<=57343?e+t:e},isExpOperator:function(e){return e===`-`||e===`+`||this.isNumber(e)},throwError:function(e,t,n){throw n=n||this.index,M(`lexerr`,`Lexer Error: {0} at column{1} in expression [{2}].`,e,h(t)?`s `+t+`-`+this.index+` [`+this.text.substring(t,n)+`]`:` `+n,this.text)},readNumber:function(){for(var e=``,t=this.index;this.index<this.text.length;){var n=r(this.text.charAt(this.index));if(n===`.`||this.isNumber(n))e+=n;else{var i=this.peek();if(n===`e`&&this.isExpOperator(i))e+=n;else if(this.isExpOperator(n)&&i&&this.isNumber(i)&&e.charAt(e.length-1)===`e`)e+=n;else if(this.isExpOperator(n)&&(!i||!this.isNumber(i))&&e.charAt(e.length-1)===`e`)this.throwError(`Invalid exponent`);else break}this.index++}this.tokens.push({index:t,text:e,constant:!0,value:Number(e)})},readIdent:function(){var e=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var t=this.peekMultichar();if(!this.isIdentifierContinue(t))break;this.index+=t.length}this.tokens.push({index:e,text:this.text.slice(e,this.index),identifier:!0})},readString:function(e){var t=this.index;this.index++;for(var n=``,r=e,i=e==="`",a=!1;this.index<this.text.length;){var o=this.text.charAt(this.index);if(i&&o===`$`&&this.text.charAt(this.index+1)===`{`){this.tokens.push({index:t,text:r,constant:!0,value:n});var s=this.text.indexOf(`}`,this.index),c=this.text.substr(this.index+2,s-this.index-2);this.tokens.push({index:this.index,text:`+`,operator:!0});for(var l=new F(this.options).lex(c),u=0,d=l.length;u<d;u++)this.tokens.push(l[u]);this.tokens.push({index:this.index,text:`+`,operator:!0}),this.index=s,this.readString("`");return}if(r+=o,a){if(o===`u`){var f=this.text.substring(this.index+1,this.index+5);f.match(/[\da-f]{4}/i)||this.throwError(`Invalid unicode escape [\\u`+f+`]`),this.index+=4,n+=String.fromCharCode(parseInt(f,16))}else{var p=ee[o];n+=p||o}a=!1}else if(o===`\\`)a=!0;else if(o===e){this.index++,this.tokens.push({index:t,text:r,constant:!0,value:n});return}else n+=o;this.index++}this.throwError(`Unterminated quote`,t)}};function I(e,t){this.lexer=e,this.options=t}I.Program=`Program`,I.ExpressionStatement=`ExpressionStatement`,I.AssignmentExpression=`AssignmentExpression`,I.ConditionalExpression=`ConditionalExpression`,I.LogicalExpression=`LogicalExpression`,I.BinaryExpression=`BinaryExpression`,I.UnaryExpression=`UnaryExpression`,I.CallExpression=`CallExpression`,I.MemberExpression=`MemberExpression`,I.Identifier=`Identifier`,I.Literal=`Literal`,I.ArrayExpression=`ArrayExpression`,I.Property=`Property`,I.ObjectExpression=`ObjectExpression`,I.ThisExpression=`ThisExpression`,I.LocalsExpression=`LocalsExpression`,I.NGValueParameter=`NGValueParameter`,I.prototype={ast:function(e){this.text=e,this.tokens=this.lexer.lex(e);var t=this.program();return this.tokens.length!==0&&this.throwError(`is an unexpected token`,this.tokens[0]),t},program:function(){for(var e=[];;)if(this.tokens.length>0&&!this.peek(`}`,`)`,`;`,`]`)&&e.push(this.expressionStatement()),!this.expect(`;`))return{type:I.Program,body:e}},expressionStatement:function(){return{type:I.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e=this.expression();this.expect(`|`);)e=this.filter(e);return e},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();if(this.expect(`=`)){if(!B(e))throw M(`lval`,`Trying to assign a value to a non l-value`);e={type:I.AssignmentExpression,left:e,right:this.assignment(),operator:`=`}}return e},ternary:function(){var e=this.nullishCoalescing(),t,n;return this.expect(`?`)&&(t=this.expression(),this.consume(`:`))?(n=this.expression(),{type:I.ConditionalExpression,test:e,alternate:t,consequent:n}):e},nullishCoalescing:function(){for(var e=this.logicalOR();this.expect(`??`);)e={type:I.LogicalExpression,operator:`??`,left:e,right:this.logicalOR()};return e},logicalOR:function(){for(var e=this.logicalAND();this.expect(`||`);)e={type:I.LogicalExpression,operator:`||`,left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect(`&&`);)e={type:I.LogicalExpression,operator:`&&`,left:e,right:this.equality()};return e},equality:function(){for(var e=this.relational(),t;t=this.expect(`==`,`!=`,`===`,`!==`);)e={type:I.BinaryExpression,operator:t.text,left:e,right:this.relational()};return e},relational:function(){for(var e=this.additive(),t;t=this.expect(`<`,`>`,`<=`,`>=`);)e={type:I.BinaryExpression,operator:t.text,left:e,right:this.additive()};return e},additive:function(){for(var e=this.multiplicative(),t;t=this.expect(`+`,`-`);)e={type:I.BinaryExpression,operator:t.text,left:e,right:this.multiplicative()};return e},multiplicative:function(){for(var e=this.unary(),t;t=this.expect(`*`,`/`,`%`);)e={type:I.BinaryExpression,operator:t.text,left:e,right:this.unary()};return e},unary:function(){var e;return(e=this.expect(`+`,`-`,`!`))?{type:I.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect(`(`)?(e=this.filterChain(),this.consume(`)`)):this.expect(`[`)?e=this.arrayDeclaration():this.expect(`{`)?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=E(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:I.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError(`not a primary expression`,this.peek());for(var t;t=this.expect(`(`,`[`,`.`);)t.text===`(`?(e={type:I.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(`)`)):t.text===`[`?(e={type:I.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume(`]`)):t.text===`.`?e={type:I.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError(`IMPOSSIBLE`);return e},filter:function(e){for(var t=[e],n={type:I.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(`:`);)t.push(this.expression());return n},parseArguments:function(){var e=[];if(this.peekToken().text!==`)`)do e.push(this.filterChain());while(this.expect(`,`));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError(`is not a valid identifier`,e),{type:I.Identifier,name:e.text}},constant:function(){return{type:I.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if(this.peekToken().text!==`]`)do{if(this.peek(`]`))break;e.push(this.expression())}while(this.expect(`,`));return this.consume(`]`),{type:I.ArrayExpression,elements:e}},object:function(){var e=[],t;if(this.peekToken().text!==`}`)do{if(this.peek(`}`))break;t={type:I.Property,kind:`init`},this.peek().constant?(t.key=this.constant(),t.computed=!1,this.consume(`:`),t.value=this.expression()):this.peek().identifier?(t.key=this.identifier(),t.computed=!1,this.peek(`:`)?(this.consume(`:`),t.value=this.expression()):t.value=t.key):this.peek(`[`)?(this.consume(`[`),t.key=this.expression(),this.consume(`]`),t.computed=!0,this.consume(`:`),t.value=this.expression()):this.throwError(`invalid key`,this.peek()),e.push(t)}while(this.expect(`,`));return this.consume(`}`),{type:I.ObjectExpression,properties:e}},throwError:function(e,t){throw M(`syntax`,`Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].`,t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(this.tokens.length===0)throw M(`ueoe`,`Unexpected end of expression: {0}`,this.text);var t=this.expect(e);return t||this.throwError(`is unexpected, expecting [`+e+`]`,this.peek()),t},peekToken:function(){if(this.tokens.length===0)throw M(`ueoe`,`Unexpected end of expression: {0}`,this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var a=this.tokens[e],o=a.text;if(o===t||o===n||o===r||o===i||!t&&!n&&!r&&!i)return a}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return i?(this.tokens.shift(),i):!1}};function L(e,t){return e===void 0?t:e}function R(e,t){return e===void 0?t:t===void 0?e:e+t}function te(e,t){var n=e(t);if(!n)throw Error(`Filter '`+t+`' is not defined`);return!n.$stateful}function z(e,t){var n,r,i;switch(e.type){case I.Program:n=!0,d(e.body,function(e){z(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case I.Literal:e.constant=!0,e.toWatch=[];break;case I.UnaryExpression:z(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case I.BinaryExpression:z(e.left,t),z(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case I.LogicalExpression:z(e.left,t),z(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case I.ConditionalExpression:z(e.test,t),z(e.alternate,t),z(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case I.Identifier:e.constant=!1,e.toWatch=[e];break;case I.MemberExpression:z(e.object,t),e.computed&&z(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case I.CallExpression:i=e.filter?te(t,e.callee.name):!1,n=i,r=[],d(e.arguments,function(e){z(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=i?r:[e];break;case I.AssignmentExpression:z(e.left,t),z(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case I.ArrayExpression:n=!0,r=[],d(e.elements,function(e){z(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=r;break;case I.ObjectExpression:n=!0,r=[],d(e.properties,function(e){z(e.value,t),n=n&&e.value.constant&&!e.computed,e.value.constant||r.push.apply(r,e.value.toWatch)}),e.constant=n,e.toWatch=r;break;case I.ThisExpression:e.constant=!1,e.toWatch=[];break;case I.LocalsExpression:e.constant=!1,e.toWatch=[];break}}function ne(e){if(e.length===1){var t=e[0].expression,n=t.toWatch;return n.length===1&&n[0]===t?void 0:n}}function B(e){return e.type===I.Identifier||e.type===I.MemberExpression}function V(e){if(e.body.length===1&&B(e.body[0].expression))return{type:I.AssignmentExpression,left:e.body[0].expression,right:{type:I.NGValueParameter},operator:`=`}}function H(e){return e.body.length===0||e.body.length===1&&(e.body[0].expression.type===I.Literal||e.body[0].expression.type===I.ArrayExpression||e.body[0].expression.type===I.ObjectExpression)}function re(e){return e.constant}function ie(e,t){this.astBuilder=e,this.$filter=t}ie.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},z(n,t.$filter);var r=``,i;if(this.stage=`assign`,i=V(n)){this.state.computing=`assign`;var o=this.nextId();this.recurse(i,o),this.return_(o),r=`fn.assign=`+this.generateFunction(`assign`,`s,v,l`)}var s=ne(n.body);t.stage=`inputs`,d(s,function(e,n){var r=`fn`+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push(r),e.watchId=n}),this.state.computing=`fn`,this.stage=`main`,this.recurse(n);var c=`"`+this.USE+` `+this.STRICT+`";
167
+ `+this.filterPrefix()+`var fn=`+this.generateFunction(`fn`,`s,l,a,i`)+r+this.watchFns()+`return fn;`,l=Function(`$filter`,`getStringValue`,`ifDefined`,`plus`,c)(this.$filter,N,L,R),u=function(e,t,n,r){return a(function(){return l(e,t,n,r)})};return u.assign=function(e,t,n){return a(function(){return l.assign(e,t,n)})},u.inputs=l.inputs,this.state=this.stage=void 0,u.ast=n,u.literal=H(n),u.constant=re(n),u},USE:`use`,STRICT:`strict`,watchFns:function(){var e=[],t=this.state.inputs,n=this;return d(t,function(t){e.push(`var `+t+`=`+n.generateFunction(t,`s`))}),t.length&&e.push(`fn.inputs=[`+t.join(`,`)+`];`),e.join(``)},generateFunction:function(e,t){return`function(`+t+`){`+this.varsPrefix(e)+this.body(e)+`};`},filterPrefix:function(){var e=[],t=this;return d(this.state.filters,function(n,r){e.push(n+`=$filter(`+t.escape(r)+`)`)}),e.length?`var `+e.join(`,`)+`;`:``},varsPrefix:function(e){return this.state[e].vars.length?`var `+this.state[e].vars.join(`,`)+`;`:``},body:function(e){return this.state[e].body.join(``)},recurse:function(e,t,n,r,i,a){var o,s,c=this,l,u,f;if(r=r||p,!a&&h(e.watchId)){t=t||this.nextId(),this.if_(`i`,this.lazyAssign(t,this.unsafeComputedMember(`i`,e.watchId)),this.lazyRecurse(e,t,n,r,i,!0));return}switch(e.type){case I.Program:d(e.body,function(t,n){c.recurse(t.expression,void 0,void 0,function(e){s=e}),n===e.body.length-1?c.return_(s):c.current().body.push(s,`;`)});break;case I.Literal:u=this.escape(e.value),this.assign(t,u),r(t||u);break;case I.UnaryExpression:this.recurse(e.argument,void 0,void 0,function(e){s=e}),u=e.operator+`(`+this.ifDefined(s,0)+`)`,this.assign(t,u),r(u);break;case I.BinaryExpression:this.recurse(e.left,void 0,void 0,function(e){o=e}),this.recurse(e.right,void 0,void 0,function(e){s=e}),u=e.operator===`+`?this.plus(o,s):e.operator===`-`?this.ifDefined(o,0)+e.operator+this.ifDefined(s,0):`(`+o+`)`+e.operator+`(`+s+`)`,this.assign(t,u),r(u);break;case I.LogicalExpression:t=t||this.nextId(),c.recurse(e.left,t),e.operator===`??`?c.if_(c.or_(c.isNull(t),`typeof `+t+` === 'undefined'`),c.lazyRecurse(e.right,t)):c.if_(e.operator===`&&`?t:c.not(t),c.lazyRecurse(e.right,t)),r(t);break;case I.ConditionalExpression:t=t||this.nextId(),c.recurse(e.test,t),c.if_(t,c.lazyRecurse(e.alternate,t),c.lazyRecurse(e.consequent,t)),r(t);break;case I.Identifier:t=t||this.nextId();var m=c.current().inAssignment;n&&(m?n.context=this.assign(this.nextId(),`s`):n.context=c.stage===`inputs`?`s`:this.assign(this.nextId(),this.getHasOwnProperty(`l`,e.name)+`?l:s`),n.computed=!1,n.name=e.name),c.if_(c.stage===`inputs`||c.not(c.getHasOwnProperty(`l`,e.name)),function(){c.if_(c.stage===`inputs`||`s`,function(){var n=c.nextId();c.assign(n,c.nonComputedMember(`s`,e.name)),c.if_(c.or_(c.isNull(n),c.hasOwnProperty_(`s`,e.name)),function(){i&&i!==1?(c.if_(c.isNull(n),c.lazyAssign(c.nonComputedMember(`s`,e.name),`{}`)),c.assign(t,c.nonComputedMember(`s`,e.name))):c.assign(t,n)})})},t&&function(){c.if_(c.hasOwnProperty_(`l`,e.name),c.lazyAssign(t,c.nonComputedMember(`l`,e.name)))}),r(t);break;case I.MemberExpression:o=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),c.recurse(e.object,o,void 0,function(){var a=null,l=c.current().inAssignment;e.computed?(s=c.nextId(),a=l||c.state.computing===`assign`?c.unsafeComputedMember(o,s):c.computedMember(o,s)):(a=l||c.state.computing===`assign`?c.unsafeNonComputedMember(o,e.property.name):c.nonComputedMember(o,e.property.name),s=e.property.name),e.computed&&e.property.type===I.Literal&&c.recurse(e.property,s),c.if_(c.and_(c.notNull(o),c.or_(c.isNull(a),c.hasOwnProperty_(o,s,e.computed))),function(){e.computed?(e.property.type!==I.Literal&&c.recurse(e.property,s),i&&i!==1&&c.if_(c.not(a),c.lazyAssign(a,`{}`)),c.assign(t,a),n&&(n.computed=!0,n.name=s)):(i&&i!==1&&c.if_(c.isNull(a),c.lazyAssign(a,`{}`)),c.assign(t,a),n&&(n.computed=!1,n.name=e.property.name))},function(){c.assign(t,`undefined`)}),r(t)},!!i);break;case I.CallExpression:t=t||this.nextId(),e.filter?(s=c.filter(e.callee.name),l=[],d(e.arguments,function(e){var t=c.nextId();c.recurse(e,t),l.push(t)}),u=s+`.call(`+s+`,`+l.join(`,`)+`)`,c.assign(t,u),r(t)):(s=c.nextId(),o={},l=[],c.recurse(e.callee,s,o,function(){c.if_(c.notNull(s),function(){d(e.arguments,function(t){c.recurse(t,e.constant?void 0:c.nextId(),void 0,function(e){l.push(e)})}),u=o.name?`(`+c.member(o.context,o.name,o.computed)+` === null ? null : `+c.unsafeMember(o.context,o.name,o.computed)+`.call(`+[o.context].concat(l).join(`,`)+`))`:s+`(`+l.join(`,`)+`)`,c.assign(t,u)},function(){c.assign(t,`undefined`)}),r(t)}));break;case I.AssignmentExpression:s=this.nextId(),o={},c.current().inAssignment=!0,this.recurse(e.left,void 0,o,function(){c.if_(c.and_(c.notNull(o.context),c.or_(c.hasOwnProperty_(o.context,o.name),c.isNull(c.member(o.context,o.name,o.computed)))),function(){c.recurse(e.right,s),u=c.member(o.context,o.name,o.computed)+e.operator+s,c.assign(t,u),r(t||u)}),c.current().inAssignment=!1,c.recurse(e.right,s),c.current().inAssignment=!0},1),c.current().inAssignment=!1;break;case I.ArrayExpression:l=[],d(e.elements,function(t){c.recurse(t,e.constant?void 0:c.nextId(),void 0,function(e){l.push(e)})}),u=`[`+l.join(`,`)+`]`,this.assign(t,u),r(t||u);break;case I.ObjectExpression:l=[],f=!1,d(e.properties,function(e){e.computed&&(f=!0)}),f?(t=t||this.nextId(),this.assign(t,`{}`),d(e.properties,function(e){e.computed?(o=c.nextId(),c.recurse(e.key,o)):o=e.key.type===I.Identifier?e.key.name:``+e.key.value,s=c.nextId(),c.recurse(e.value,s),c.assign(c.unsafeMember(t,o,e.computed),s)})):(d(e.properties,function(t){c.recurse(t.value,e.constant?void 0:c.nextId(),void 0,function(e){l.push(c.escape(t.key.type===I.Identifier?t.key.name:``+t.key.value)+`:`+e)})}),u=`{`+l.join(`,`)+`}`,this.assign(t,u)),r(t||u);break;case I.ThisExpression:this.assign(t,`s`),r(t||`s`);break;case I.LocalsExpression:this.assign(t,`l`),r(t||`l`);break;case I.NGValueParameter:this.assign(t,`v`),r(t||`v`);break}},getHasOwnProperty:function(e,t){var n=e+`.`+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+`&&(`+this.escape(t)+` in `+e+`)`)),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,`=`,t,`;`),e},filter:function(e){return n.call(this.state.filters,e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return`ifDefined(`+e+`,`+this.escape(t)+`)`},plus:function(e,t){return`plus(`+e+`,`+t+`)`},return_:function(e){this.current().body.push(`return `,e,`;`)},if_:function(e,t,n){if(e===!0)t();else{var r=this.current().body;r.push(`if(`,e,`){`),t(),r.push(`}`),n&&(r.push(`else{`),n(),r.push(`}`))}},or_:function(e,t){return`(`+e+`) || (`+t+`)`},hasOwnProperty_:function(e,t,n){return n?`(Object.prototype.hasOwnProperty.call(`+e+`,`+t+`))`:`(Object.prototype.hasOwnProperty.call(`+e+`,'`+t+`'))`},and_:function(e,t){return`(`+e+`) && (`+t+`)`},not:function(e){return`!(`+e+`)`},isNull:function(e){return e+`==null`},notNull:function(e){return e+`!=null`},nonComputedMember:function(e,t){var n=/^[$_a-zA-Z][$_a-zA-Z0-9]*$/,r=/[^$_a-zA-Z0-9]/g,i=``;return n.test(t)?i=e+`.`+t:(t=t.replace(r,this.stringEscapeFn),i=e+`["`+t+`"]`),i},unsafeComputedMember:function(e,t){return e+`[`+t+`]`},unsafeNonComputedMember:function(e,t){return this.nonComputedMember(e,t)},computedMember:function(e,t){return this.state.computing===`assign`?this.unsafeComputedMember(e,t):`(`+e+`.hasOwnProperty(`+t+`) ? `+e+`[`+t+`] : undefined)`},unsafeMember:function(e,t,n){return n?this.unsafeComputedMember(e,t):this.unsafeNonComputedMember(e,t)},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,`getStringValue(`+e+`)`)},lazyRecurse:function(e,t,n,r,i,a){var o=this;return function(){o.recurse(e,t,n,r,i,a)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return`\\u`+(`0000`+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(v(e))return`'`+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+`'`;if(y(e))return e.toString();if(e===!0)return`true`;if(e===!1)return`false`;if(e===null)return`null`;if(e===void 0)return`undefined`;throw M(`esc`,`IMPOSSIBLE`)},nextId:function(e,t){var n=`v`+ this.state.nextId++;return e||this.current().vars.push(n+(t?`=`+t:``)),n},current:function(){return this.state[this.state.computing]}};function ae(e,t){this.astBuilder=e,this.$filter=t}ae.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);z(n,t.$filter);var r,i;(r=V(n))&&(i=this.recurse(r));var o=ne(n.body),s;o&&(s=[],d(o,function(e,n){var r=t.recurse(e);e.input=r,s.push(r),e.watchId=n}));var c=[];d(n.body,function(e){c.push(t.recurse(e.expression))});var l=n.body.length===0?p:n.body.length===1?c[0]:function(e,t){var n;return d(c,function(r){n=r(e,t)}),n};i&&(l.assign=function(e,t,n){return i(e,n,t)});var u=function(e,t){return a(function(){return l(e,t)})};return u.assign=function(e,t,n){return a(function(){return l.assign(e,t,n)})},s&&(u.inputs=s),u.ast=n,u.literal=H(n),u.constant=re(n),u},recurse:function(e,t,n){var r,i,a=this,o;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case I.Literal:return this.value(e.value,t);case I.UnaryExpression:return i=this.recurse(e.argument),this[`unary`+e.operator](i,t);case I.BinaryExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case I.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case I.ConditionalExpression:return this[`ternary?:`](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case I.Identifier:return a.identifier(e.name,t,n);case I.MemberExpression:return r=this.recurse(e.object,!1,!!n),e.computed||(i=e.property.name),e.computed&&(i=this.recurse(e.property)),e.computed?this.computedMember(r,i,t,n):this.nonComputedMember(r,i,t,n);case I.CallExpression:return o=[],d(e.arguments,function(e){o.push(a.recurse(e))}),e.filter&&(i=this.$filter(e.callee.name)),e.filter||(i=this.recurse(e.callee,!0)),e.filter?function(e,n,r,a){for(var s=[],c=0;c<o.length;++c)s.push(o[c](e,n,r,a));var l=i.apply(void 0,s,a);return t?{context:void 0,name:void 0,value:l}:l}:function(e,n,r,a){var s=i(e,n,r,a),c;if(s.value!=null){for(var l=[],u=0;u<o.length;++u)l.push(o[u](e,n,r,a));c=s.value.apply(s.context,l)}return t?{value:c}:c};case I.AssignmentExpression:return r=this.recurse(e.left,!0,1),i=this.recurse(e.right),function(e,n,a,o){var s=r(e,!1,a,o),c=i(e,n,a,o);return s.context[s.name]=c,t?{value:c}:c};case I.ArrayExpression:return o=[],d(e.elements,function(e){o.push(a.recurse(e))}),function(e,n,r,i){for(var a=[],s=0;s<o.length;++s)a.push(o[s](e,n,r,i));return t?{value:a}:a};case I.ObjectExpression:return o=[],d(e.properties,function(e){e.computed?o.push({key:a.recurse(e.key),computed:!0,value:a.recurse(e.value)}):o.push({key:e.key.type===I.Identifier?e.key.name:``+e.key.value,computed:!1,value:a.recurse(e.value)})}),function(e,n,r,i){for(var a={},s=0;s<o.length;++s)o[s].computed?a[o[s].key(e,n,r,i)]=o[s].value(e,n,r,i):a[o[s].key]=o[s].value(e,n,r,i);return t?{value:a}:a};case I.ThisExpression:return function(e){return t?{value:e}:e};case I.LocalsExpression:return function(e,n){return t?{value:n}:n};case I.NGValueParameter:return function(e,n,r){return t?{value:r}:r}}},"unary+":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=h(o)?+o:0,t?{value:o}:o}},"unary-":function(e,t){return function(n,r,i,a){var o=e(n,r,i,a);return o=h(o)?-o:-0,t?{value:o}:o}},"unary!":function(e,t){return function(n,r,i,a){var o=!e(n,r,i,a);return t?{value:o}:o}},"binary+":function(e,t,n){return function(r,i,a,o){var s=R(e(r,i,a,o),t(r,i,a,o));return n?{value:s}:s}},"binary-":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=t(r,i,a,o),l=(h(s)?s:0)-(h(c)?c:0);return n?{value:l}:l}},"binary*":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)*t(r,i,a,o);return n?{value:s}:s}},"binary/":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)/t(r,i,a,o);return n?{value:s}:s}},"binary%":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)%t(r,i,a,o);return n?{value:s}:s}},"binary===":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)===t(r,i,a,o);return n?{value:s}:s}},"binary!==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!==t(r,i,a,o);return n?{value:s}:s}},"binary==":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)==t(r,i,a,o);return n?{value:s}:s}},"binary!=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)!=t(r,i,a,o);return n?{value:s}:s}},"binary<":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<t(r,i,a,o);return n?{value:s}:s}},"binary>":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>t(r,i,a,o);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)<=t(r,i,a,o);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)>=t(r,i,a,o);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)&&t(r,i,a,o);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o)||t(r,i,a,o);return n?{value:s}:s}},"binary??":function(e,t,n){return function(r,i,a,o){var s=e(r,i,a,o),c=s!=null&&s!==void 0?s:t(r,i,a,o);return n?{value:c}:c}},"ternary?:":function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s)?t(i,a,o,s):n(i,a,o,s);return r?{value:c}:c}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,r){return function(i,a){var o=a&&e in a?a:i;r&&r!==1&&o&&o[e]==null&&(o[e]={});var s;return o&&n.call(o,e)&&(s=o?o[e]:void 0),t?{context:o,name:e,value:s}:s}},computedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s),l,u;return c!=null&&(l=t(i,a,o,s),l=N(l),r&&r!==1&&c&&!c[l]&&(c[l]={}),Object.prototype.hasOwnProperty.call(c,l)&&(u=c[l])),n?{context:c,name:l,value:u}:u}},nonComputedMember:function(e,t,n,r){return function(i,a,o,s){var c=e(i,a,o,s);r&&r!==1&&c&&c[t]==null&&(c[t]={});var l=void 0;return c!=null&&Object.prototype.hasOwnProperty.call(c,t)&&(l=c[t]),n?{context:c,name:t,value:l}:l}},inputs:function(e,t){return function(n,r,i,a){return a?a[t]:e(n,r,i)}}};var U=function(e,t,n){this.lexer=e,this.$filter=t,n=n||{},n.handleThis=n.handleThis==null?!0:n.handleThis,this.options=n,this.ast=new I(e,n),this.ast.selfReferential={$locals:{type:I.LocalsExpression}},n.handleThis&&(this.ast.selfReferential.this={type:I.ThisExpression}),this.astCompiler=n.csp?new ae(this.ast,t):new ie(this.ast,t)};U.prototype={constructor:U,parse:function(e){return this.astCompiler.compile(e)}},e.Lexer=F,e.Parser=U})),xe=e.t((e=>{var t=be(),n={},r=t.Lexer,i=t.Parser;function a(e){return e=e||{},e.filters&&(e.cache=e.cache||{}),e.cache=e.cache||s.cache,e.filters=e.filters||n,e}function o(e){return{handleThis:e.handleThis==null?!0:e.handleThis,csp:e.csp==null?!1:e.csp,literals:e.literals==null?{true:!0,false:!1,null:null,undefined:void 0}:e.literals}}function s(e,t){if(typeof e!=`string`)throw TypeError(`src must be a string, instead saw '`+typeof e+`'`);t=a(t);var n=t,s=o(t),c=new i(new r(n),function(e){return t.filters[e]},s);if(!t.cache)return c.parse(e);delete t.src;var l=JSON.stringify(Object.assign({src:e},t)),u=t.cache[l];return u||(u=t.cache[l]=c.parse(e)),u}s.cache=Object.create(null),e.compile=s}))();const Se=(e,t)=>{let n=[];e!==void 0&&!Array.isArray(e)&&n.push(`deeds is not an array, the host ignores it`);let r=[];for(let[i,a]of(Array.isArray(e)?e:[]).entries()){if(a==null||typeof a.id!=`string`){n.push(`deed ${i} has no string id, the host drops it`);continue}if(t===`checkpoint`){r.push({id:a.id,value:a.value});continue}a.value===void 0||a.value===null||r.push({id:a.id,value:typeof a.value==`number`?Math.floor(a.value):a.value,persist:a.persist===!0})}if(t===`checkpoint`)return{deeds:r,warnings:n};let i=r.filter(e=>e.persist),a=r.filter(e=>!e.persist),o=i.splice(3);return o.length&&n.push(`only 3 persisted deeds are kept, dropped: ${o.map(e=>e.id).join(`, `)}`),{deeds:[...i,...a].map(({id:e,value:t})=>({id:e,value:t})),warnings:n}},Ce=e=>{let t={};for(let n of e)n.value!==void 0&&(t[Ee(n.id)]=n.value);return t},we=(e,t)=>{try{if(e.filterExp&&!(0,xe.compile)(e.filterExp)(t)||!e.incrementExp)return{complete:!1,value:0};let n=(0,xe.compile)(e.incrementExp)(t);if(typeof n==`boolean`&&(n=n?1:0),n===void 0&&(n=0),typeof n!=`number`||isNaN(n))throw Error(`incrementExp must return a number, undefined or boolean, got ${n}`);let r=Math.floor(n);return{complete:r>=(e.targetCount||1),value:r}}catch(e){return{complete:!1,value:0,error:e.message}}},Te=e=>{let{items:t,scope:n,mode:r}=e,i=Math.min(Math.max(e.index,0),t.length),a;for(;i<t.length&&(a=we(t[i],n),!(!a.complete||r===`checkpoint`&&!t[i].liveUpdate));i++);return{index:i,head:i<t.length?a:void 0}};var Ee=e=>e.replace(/-./g,e=>e[1].toUpperCase());function De(e){let t=new Map,n=new Set,r=null,i=0,a,o=[],s=e=>{var t;return`simulator-checklist:${(t=r)==null?`game`:t}:${e}`},c=e=>{try{let t=Number(localStorage.getItem(s(e.stableID)))||0;return Math.min(Math.max(t,0),e.items.length)}catch(e){return 0}},l=(e,t)=>{try{t===0?localStorage.removeItem(s(e)):localStorage.setItem(s(e),String(t))}catch(e){}},u=(e,t,r,i)=>{var a;let o=r<i.index?`done`:r===i.index?`active`:`upcoming`,s=`${e.stableID}:${r}`,c=n.has(s),l=!!t.expandMD&&o!==`done`,u=t.targetCount||1,d=o===`active`&&i.head?`${Math.min(i.head.value,u)}/${u}`:``,f=[t.incrementExp&&`increment: ${t.incrementExp}`,t.filterExp&&`filter: ${t.filterExp}`,`target: ${u}`,t.liveUpdate?`liveUpdate: checkpoints + completion`:`completion only`].filter(Boolean).join(`
168
+ `);return`${e.instructionsVisibleFromItemIndex===r&&r>0?`<div class="checklist-divider"><span>full instructions unlock</span></div>`:``}
169
+ <div class="checklist-item ${o}" title="${q(f)}">
170
+ <div class="checklist-row">
171
+ <span class="checklist-tick">${o===`done`?`■`:`□`}</span>
172
+ <span class="checklist-title">${q((a=t.title)==null?`Step ${r+1}`:a)}</span>
173
+ ${d?`<span class="checklist-count">${d}</span>`:``}
174
+ ${l?`<button class="checklist-help${c?` open`:``}" data-help="${q(s)}">?</button>`:``}
175
+ </div>
176
+ ${o===`active`&&t.subtitle?`<div class="checklist-subtitle">${q(t.subtitle)}</div>`:``}
177
+ ${l&&c?`<pre class="checklist-expand">${q(t.expandMD)}</pre>`:``}
178
+ </div>`},d=e=>{var n,r,i,s;let c=(n=t.get(e.stableID))==null?{index:0}:n,l=e.items.length,d=c.index,f=((r=c.head)==null?void 0:r.error)&&`${(i=(s=e.items[c.index])==null?void 0:s.title)==null?`Step ${c.index+1}`:i}: ${c.head.error}`;return`
179
+ <div class="checklist-section">
180
+ <div class="checklist-header">
181
+ <span class="simulator-label">Checklist</span>
182
+ <span class="checklist-progress${d===l?` complete`:``}">${d}/${l}</span>
183
+ <button class="simulator-btn subtle small" data-reset="${q(e.stableID)}">Reset</button>
184
+ </div>
185
+ <div class="checklist-items">
186
+ ${e.items.map((t,n)=>u(e,t,n,c)).join(``)}
187
+ </div>
188
+ ${a?`<div class="checklist-footer">last eval: ${q(a)}</div>`:``}
189
+ ${f?`<div class="checklist-error">${q(f)}</div>`:``}
190
+ ${o.map(e=>`<div class="checklist-error">${q(e)}</div>`).join(``)}
191
+ </div>`},f=()=>e.length===0?`<div class="simulator-empty">No checklists in puzzmo.json → integrations.checklists
192
+ <pre class="checklist-expand">"checklists": [{
193
+ "stableID": "my-game:tutorial",
194
+ "type": "tutorial",
195
+ "items": [{ "title": "Make a move", "incrementExp": "moves", "liveUpdate": true }]
196
+ }]</pre></div>`:e.map(d).join(``),p=e=>{let t=e.getElement(`#simulator-checklist-list`);t&&(t.innerHTML=f())},m=(n,r,s,c)=>{let u=0,d=Se(r,s),f=Ce(d.deeds);a=c,o=d.warnings;for(let n of e){var m,h;let e=(m=(h=t.get(n.stableID))==null?void 0:h.index)==null?0:m,r=Te({items:n.items,index:e,scope:f,mode:s});u+=r.index-e,t.set(n.stableID,r),r.index!==e&&l(n.stableID,r.index)}u>0&&(i+=u,n.updateBadge(`checklist`,i)),p(n)};return{id:`checklist`,label:`Cklst`,render(){return`<div id="simulator-checklist-list" class="checklist-view-container">${f()}</div>`},bind(s){var u;r=s.gameSlug;for(let n of e)t.set(n.stableID,{index:c(n)});p(s),(u=s.getElement(`#simulator-checklist-list`))==null||u.addEventListener(`click`,e=>{var r,c;let u=e.target,d=(r=u.closest(`[data-reset]`))==null?void 0:r.dataset.reset,f=(c=u.closest(`[data-help]`))==null?void 0:c.dataset.help;if(d)t.set(d,{index:0}),l(d,0),a=void 0,o=[],i=0,s.updateBadge(`checklist`,0);else if(f)n.has(f)?n.delete(f):n.add(f);else return;p(s)})},onActivate(){i=0},onMessage(e,t,n){var r,i,a;e===`HIT_CHECKPOINT`?m(n,t==null||(r=t.augConfig)==null?void 0:r.deeds,`checkpoint`,`checkpoint "${(i=t==null?void 0:t.checkpointName)==null?`?`:i}"`):e===`GAME_COMPLETED`&&m(n,t==null||(a=t.config)==null?void 0:a.deeds,`completion`,`completion`)}}}var q=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`);function Oe(){let e=globalThis;for(let t of Object.keys(e))if(t.endsWith(`Thumbnail`)&&typeof e[t]==`function`)return{name:t,fn:e[t]};return null}function ke(){let e=globalThis.getShareString;return typeof e==`function`?e:null}function Ae(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function je(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ne=`
197
+ <div class="simulator-share-missing">
198
+ <p>The app bundle doesn't export <code>getShareString</code>.</p>
199
+ <p>Add it to your app bundle to preview share strings here:</p>
200
+ <pre>export const getShareString: AppBundle["getShareString"] = (
201
+ inputStr, title, { puzzleString, dateKey, gameplaySlug },
202
+ ) =&gt; ({ str: \`\${title}: ...\` })</pre>
203
+ </div>
204
+ `;function Pe(){return{id:`thumb`,label:`Thumb`,render(){return`
205
+ <div class="thumb-view-container">
206
+ <div class="thumb-header">
207
+ <span class="simulator-label">Preview</span>
208
+ <button class="simulator-btn tiny" id="simulator-thumb-refresh">Refresh</button>
209
+ </div>
210
+ <div class="simulator-segmented" id="simulator-preview-kind" role="tablist">
211
+ <button class="simulator-segmented-btn" data-preview-kind="image" type="button" role="tab">Image</button>
212
+ <button class="simulator-segmented-btn" data-preview-kind="text" type="button" role="tab">Text</button>
213
+ </div>
214
+ <div id="simulator-thumb-preview">
215
+ <span class="simulator-empty">No thumbnail function found</span>
216
+ </div>
217
+ <div id="simulator-thumb-fn"></div>
218
+ <div class="simulator-divider"></div>
219
+ <div class="simulator-field" id="simulator-render-host-field">
220
+ <label class="simulator-label">Render Host</label>
221
+ <select class="simulator-select" id="simulator-render-host-select">
222
+ <option value="game">game</option>
223
+ <option value="app">app</option>
224
+ <option value="opengraph">opengraph</option>
225
+ </select>
226
+ </div>
227
+ <div class="simulator-field" id="simulator-render-context-field" style="display: none;">
228
+ <label class="simulator-label">Render Context</label>
229
+ <select class="simulator-select" id="simulator-render-context-select">
230
+ <option value="preview">preview</option>
231
+ <option value="share">share</option>
232
+ <option value="completed">completed</option>
233
+ <option value="timeline">timeline</option>
234
+ </select>
235
+ </div>
236
+ </div>
237
+ `},bind(e){let t=e.getElement(`#simulator-thumb-refresh`);t==null||t.addEventListener(`click`,()=>e.updateThumbnail());let n=e.getElement(`#simulator-render-host-select`),r=e.getElement(`#simulator-render-context-select`),i=e.getElement(`#simulator-render-host-field`),a=e.getElement(`#simulator-render-context-field`),o=e.getElement(`#simulator-preview-kind`),s=()=>{let t=e.state.previewKind!==`text`;i&&(i.style.display=t?`block`:`none`),a&&(a.style.display=t&&e.state.renderHost===`opengraph`?`block`:`none`)},c=()=>{o==null||o.querySelectorAll(`.simulator-segmented-btn`).forEach(t=>{let n=t.dataset.previewKind;t.classList.toggle(`active`,n===e.state.previewKind),t.setAttribute(`aria-selected`,n===e.state.previewKind?`true`:`false`)})};o==null||o.querySelectorAll(`.simulator-segmented-btn`).forEach(t=>{t.addEventListener(`click`,()=>{let n=t.dataset.previewKind;!n||n===e.state.previewKind||(e.state.previewKind=n,L(n),c(),s(),e.updateThumbnail())})}),n&&(e.state.renderHost||(e.state.renderHost=`game`,I(e.state.renderHost)),n.value=e.state.renderHost||`game`,n.addEventListener(`change`,()=>{e.state.renderHost=n.value,I(e.state.renderHost),s(),e.updateThumbnail()})),r&&(e.state.renderContext||(e.state.renderContext=`preview`,R(e.state.renderContext)),r.value=e.state.renderContext||`preview`,r.addEventListener(`change`,()=>{e.state.renderContext=r.value,R(e.state.renderContext),e.updateThumbnail()})),c(),s()},onActivate(e){setTimeout(()=>e.updateThumbnail(),0)},updatePreview:e=>{let t=e.getElement(`#simulator-thumb-preview`),n=e.getElement(`#simulator-thumb-fn`);if(t==null||t.style.setProperty(`--sim-thumb-bg`,e.state.selectedTheme.g_bg),e.state.previewKind===`text`){let s=ke();if(!s){t&&(t.innerHTML=Ne),n&&(n.textContent=``);return}n&&(n.textContent=`Using: getShareString()`);try{var r,i,a,o;let n=(r=e.gameSlug)==null?`game`:r,c=s((i=e.state.currentInputStr)==null?``:i,Me(n),{puzzleString:(a=e.state.puzzleData)==null?``:a,dateKey:je(),gameplaySlug:`simulator:${n}`}),l=(o=c==null?void 0:c.str)==null?``:o;t&&(t.innerHTML=`<pre class="simulator-share-preview" style="color: ${e.state.selectedTheme.fg}">${Ae(l)}</pre>`)}catch(e){console.error(`Simulator: Share string error`,e),t&&(t.innerHTML=`<span class="simulator-empty">Error: ${e}</span>`)}return}let s=Oe();if(!s){t&&(t.innerHTML=`<span class="simulator-empty">No thumbnail function found</span>`),n&&(n.textContent=``);return}n&&(n.textContent=`Using: ${s.name}()`);try{var c;let n=(c=e.state.puzzleData)==null?``:c,r={viewerIsOwner:!0,theme:e.state.selectedTheme,strict:!0,renderHost:e.state.renderHost,renderContext:e.state.renderContext},{svg:i}=U(s.fn(n,e.state.currentInputStr,r));t&&(t.innerHTML=i)}catch(e){console.error(`Simulator: Thumbnail error`,e),t&&(t.innerHTML=`<span class="simulator-empty">Error: ${e}</span>`)}}}}var J={bounds:`#ffd700`,grid:`rgba(96, 165, 250, 0.35)`,box:`rgba(34, 211, 238, 0.85)`,exiting:`#f87171`,hovered:`#ffd700`,highlighted:`#f472b6`,anchor:`#f472b6`,group:`#a78bfa`,label:`#e8e8e8`,labelBackground:`rgba(15, 15, 26, 0.8)`};const Fe=(e,t)=>{let{ctx:n,scale:r,scene:i,nodes:a}=e,o=t.devicePixelRatio,s=([e,t])=>[e*r,t*r];if(n.save(),n.lineWidth=o,t.grid&&i.grid&&i.width/i.grid+i.height/i.grid<=400){n.strokeStyle=J.grid,n.beginPath();for(let e=i.grid;e<i.width;e+=i.grid){let t=Math.round(e*r)+o/2;n.moveTo(t,0),n.lineTo(t,i.height*r)}for(let e=i.grid;e<i.height;e+=i.grid){let t=Math.round(e*r)+o/2;n.moveTo(0,t),n.lineTo(i.width*r,t)}n.stroke()}t.bounds&&(n.strokeStyle=J.bounds,n.setLineDash([4*o,3*o]),n.strokeRect(o/2,o/2,i.width*r-o,i.height*r-o),n.setLineDash([]));for(let e of a){let r=e.sprite?t.boxOf(e.sprite):void 0,i=e.key===t.hovered,a=!!e.sprite&&e.sprite===t.highlighted;if(r&&(t.boxes||i||a)){let t=Ie(e.matrix,r).map(s);n.strokeStyle=i?J.hovered:a?J.highlighted:e.exiting?J.exiting:J.box,n.lineWidth=(i||a?2:1)*o,n.setLineDash(e.alpha<=0?[3*o,3*o]:[]),n.beginPath(),t.forEach(([e,t],r)=>r?n.lineTo(e,t):n.moveTo(e,t)),n.closePath(),n.stroke(),n.setLineDash([]),n.lineWidth=o}if(t.anchors){let[t,i]=s(Re(e.matrix,[0,0]));r?(n.fillStyle=J.anchor,n.fillRect(t-1.5*o,i-1.5*o,3*o,3*o)):(n.strokeStyle=J.group,n.beginPath(),n.moveTo(t,i-4*o),n.lineTo(t+4*o,i),n.lineTo(t,i+4*o),n.lineTo(t-4*o,i),n.closePath(),n.stroke())}}if(t.keys){n.font=`${9*o}px Menlo, Monaco, monospace`,n.textBaseline=`top`;for(let e of a){let r=e.sprite?t.boxOf(e.sprite):void 0,[i,a]=r?Be(Ie(e.matrix,r).map(s)):s(Re(e.matrix,[0,0])),c=n.measureText(e.key).width;n.fillStyle=J.labelBackground,n.fillRect(i,a,c+4*o,11*o),n.fillStyle=J.label,n.fillText(e.key,i+2*o,a+o)}}n.restore()},Ie=(e,t)=>{let[n,r]=t.anchor;return[[-n,-r],[t.width-n,-r],[t.width-n,t.height-r],[-n,t.height-r]].map(t=>Re(e,t))},Le=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(!i.sprite||i.alpha<=0)continue;let a=n(i.sprite),o=a&&ze(i.matrix,t);if(!a||!o)continue;let s=o[0]+a.anchor[0],c=o[1]+a.anchor[1];if(s>=0&&c>=0&&s<=a.width&&c<=a.height)return i}return null};var Re=(e,[t,n])=>[e[0]*t+e[2]*n+e[4],e[1]*t+e[3]*n+e[5]],ze=(e,[t,n])=>{let r=e[0]*e[3]-e[1]*e[2];if(Math.abs(r)<1e-12)return null;let i=t-e[4],a=n-e[5];return[(e[3]*i-e[2]*a)/r,(-e[1]*i+e[0]*a)/r]},Be=e=>[Math.min(...e.map(e=>e[0])),Math.min(...e.map(e=>e[1]))];const Ve=(e,i={})=>{var a,o;let s=(a=i.rasterise)==null?Ge:a,c=(o=i.fontFaces)==null?``:o,l=new Map,u=new Map,d=new Set,f=0,p=!1,m=null,h=e=>{g.warnings.includes(e)||g.warnings.push(e)},g={render:function(){var i=n.t(function*(n){let i=n.pixelsPerUnit,a={render:++f,update:n,renderMs:0,spritesMs:0,made:[]};g.latest=a;let o=`render`;try{var _,v;p&&u.clear(),p=!1;let f=(_=u.get(i))==null?u.set(i,new Set).get(i):_,g=(v=l.get(i))==null?l.set(i,new Map).get(i):v,b=new Map,x=[],S=[],C=[],w=(e,t,n)=>{var r;let a=`${i}|${e}`,o=g.get(e),s=(r=b.get(e))==null?o&&{box:o,svg:o.svg}:r;if(!s||d.has(a))return;d.add(a);let c;try{c=qe(t)}catch(e){return}c.width===s.box.width&&c.height===s.box.height&&c.anchor[0]===s.box.anchor[0]&&c.anchor[1]===s.box.anchor[1]?n!==void 0&&s.svg!==void 0&&n!==s.svg&&h(`"${e}" was made again with different SVG. Puzzmo keeps the first, so put what differs into the ID`):h(`"${e}" was made again with a different box. Puzzmo keeps the first, so put what differs into the ID`)},T={has:e=>f.has(e)||b.has(e),draw(e,n,r){if(T.has(e))return w(e,n);let o=qe(n);m!=null||(m=new OffscreenCanvas(1,1)),m.width=Math.max(1,Math.ceil(o.width*i)),m.height=Math.max(1,Math.ceil(o.height*i));let s=m.getContext(`2d`);s.setTransform(i,0,0,i,0,0),r(s),b.set(e,{box:o}),x.push(t.t(t.t({id:e,kind:`draw`,bitmap:m.transferToImageBitmap()},o),{},{pixelsPerUnit:i,render:a.render}))},svg(e,t,n,r){if(T.has(e))return w(e,t,String(n));let i=qe(t),a=r?String(r):``,o=C.indexOf(a);o<0&&(o=C.push(a)-1),b.set(e,{box:i,svg:String(n)}),S.push({id:e,box:i,svg:String(n),defs:o})}},E=performance.now(),D=e.render(n,T);if(a.renderMs=performance.now()-E,D&&typeof D.then==`function`)throw Error(`render returned a Promise. Puzzmo's sandbox doesn't wait for one, so build the scene and return it`);for(let e of b.keys())f.add(e);try{D=structuredClone(D)}catch(e){throw Error(`The scene can't leave the sandbox: ${Ye(e)}`)}a.raw=D,o=`sprites`;let O=performance.now(),k=S.length?yield s(S,C,i,c):[];a.spritesMs=performance.now()-O;for(let{id:e,bitmap:n}of k){let r=S.find(t=>t.id===e);x.push(t.t(t.t({id:e,kind:`svg`,bitmap:n},r.box),{},{svg:r.svg,pixelsPerUnit:i,render:a.render}))}for(let e of x){var y;(y=g.get(e.id))==null||y.bitmap.close(),g.set(e.id,e)}a.made=x.map(e=>e.id),o=`scene`;let A=r.a(D),j=[...r.i(A)].filter(e=>!g.has(e));if(j.length)throw Error(`The scene names sprites it never made: ${j.slice(0,5).join(`, `)}`);return a.scene=A,A}catch(e){throw p=!0,a.error={phase:o,message:Ye(e),stack:e instanceof Error?e.stack:void 0},e}finally{var b;(b=g.onRender)==null||b.call(g,a)}});return function(e){return i.apply(this,arguments)}}(),sprite:(e,t)=>{var n;return(n=l.get(t))==null?void 0:n.get(e)},spritesAt:e=>{var t,n;return[...(t=(n=l.get(e))==null?void 0:n.values())==null?[]:t]},anySprite:e=>{let t;for(let n of l.values()){let r=n.get(e);r&&(!t||r.render>t.render)&&(t=r)}return t},resolutions:()=>[...l.keys()],warnings:[],latest:null,clear(){for(let e of l.values())for(let t of e.values())t.bitmap.close();l.clear(),u.clear(),d.clear(),g.warnings.length=0}};return g},He=function(){var e=n.t(function*(e){let t=[],n=[],r=Array.isArray(e)?e.filter(e=>typeof e==`string`):[];for(let e of r){if(!i.r.includes(e)){t.push(`fonts names "${e}", which isn't a Puzzmo font, so the table won't load it`);continue}try{let t=yield fetch(i.i(e));if(!t.ok)throw Error(`the CDN answered ${t.status}`);let r=yield t.arrayBuffer();document.fonts.add(yield new FontFace(e,r.slice(0)).load()),n.push(`@font-face{font-family:"${e.replace(/["\\]/g,``)}";src:url(data:font/woff2;base64,${Je(r)})}`)}catch(n){t.push(`The font ${e} didn't load: ${Ye(n)}`)}}return{fontFaces:n.join(``),warnings:t}});return function(t){return e.apply(this,arguments)}}();var Ue=64,We=4096;const Ge=function(){var e=n.t(function*(e,t,n,r){var i;let a=[],o=new Map;for(let t of e)o.set(t.defs,[...(i=o.get(t.defs))==null?[]:i,t]);for(let[e,i]of o)for(let o=0;o<i.length;o+=Ue){let s=i.slice(o,o+Ue);try{a.push(...yield Ke(s,t[e],n,r))}catch(i){let a=[];for(let i of s)yield Ke([i],t[e],n,r).catch(()=>a.push(i.id));let o=a.length?`${a.slice(0,5).join(`, `)} won't decode`:Ye(i);throw Error(`An SVG sprite couldn't be drawn: ${o}`)}}return a});return function(t,n,r,i){return e.apply(this,arguments)}}();var Ke=function(){var e=n.t(function*(e,t,n,r){let i=0,a=0,o=0,s=1,c=e.map(e=>{let t=Math.max(1,Math.ceil(e.box.width*n)),r=Math.max(1,Math.ceil(e.box.height*n));i>0&&i+t>We&&(i=0,a+=o+1,o=0);let c={sprite:e,x:i,y:a,w:t,h:r};return i+=t+1,s=Math.max(s,i),o=Math.max(o,r),c}),l=a+o,u=c.map(({sprite:e,x:t,y:n,w:r,h:i})=>`<svg x="${t}" y="${n}" width="${r}" height="${i}" viewBox="0 0 ${e.box.width} ${e.box.height}" preserveAspectRatio="none" overflow="hidden">${e.svg}</svg>`).join(``),d=`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${s}" height="${l}" viewBox="0 0 ${s} ${l}"><style>${r}</style>${t}${u}</svg>`,f=URL.createObjectURL(new Blob([d],{type:`image/svg+xml`}));try{let e=new Image;e.src=f,yield e.decode();let t=[];for(let n of c)t.push({id:n.sprite.id,bitmap:yield createImageBitmap(e,n.x,n.y,n.w,n.h)});return t}finally{URL.revokeObjectURL(f)}});return function(t,n,r,i){return e.apply(this,arguments)}}(),qe=e=>{let t=e,n=Number(t==null?void 0:t.width),r=Number(t==null?void 0:t.height);if(!(n>0&&r>0&&n<1e4&&r<1e4))throw Error(`A sprite's box must have a positive width and height, got ${JSON.stringify(e)}`);return{width:n,height:r,anchor:Array.isArray(t.anchor)?[Number(t.anchor[0]),Number(t.anchor[1])]:[n/2,r/2]}},Je=e=>{let t=new Uint8Array(e),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)},Ye=e=>e instanceof Error?e.message:String(e),Xe=[[`bounds`,`Bounds`,`The scene's width and height`],[`grid`,`Grid`,`Lines every grid step, for a scene that sets grid`],[`boxes`,`Boxes`,`Each sprite's box, as it's turned and scaled`],[`anchors`,`Anchors`,`Each node's anchor; hollow for a node with no sprite`],[`keys`,`Keys`,`Each node's key`]],Ze={render:`render threw`,sprites:`A sprite couldn't be made`,scene:`Puzzmo would refuse this scene`};function Qe(e){let t=y(),i,a=null,o=!1,s=null,c=null,l,u=[],d=[],f=null,p=!1,m=null,h=null,g=null,_=`session`,v=null,x=[],S=!1,C=e=>i.getElement(`#sim-pmmg-${e}`),w=()=>({bounds:t.bounds,grid:t.grid,boxes:t.boxes,anchors:t.anchors,keys:t.keys,boxOf:e=>c==null?void 0:c.anySprite(e),hovered:h,highlighted:g,devicePixelRatio:window.devicePixelRatio||1}),T=()=>({fidelity:t.fidelity,backgroundStyle:t.backgroundStyle===`theme`?void 0:t.backgroundStyle}),E=()=>{if(x.length)return x[x.length-1];let e=i.state.puzzleData;return e===null?null:{puzzle:e,input:i.state.currentInputStr}},D=function(){var t=n.t(function*(){s=null,o=!0,N();try{var t;let n=yield e(),r=(t=n==null?void 0:n.default)==null?n:t,i=r==null?void 0:r.table;if(!i||typeof i.render!=`function`){s=`The pmmg bundle has no table capability: export default createPmmgBundle({ table: { contract: 1, render } })`;return}l=i.contract,u=Array.isArray(i.fonts)?i.fonts.filter(e=>typeof e==`string`):[];let a=yield He(i.fonts);d=a.warnings,l!==1&&d.push(`contract is ${JSON.stringify(l)}, and Puzzmo knows contract 1`),c=Ve(i,{fontFaces:a.fontFaces}),c.onRender=()=>N()}catch(e){s=`The pmmg bundle didn't load: ${tt(e)}`,a=null}finally{o=!1}});return function(){return t.apply(this,arguments)}}(),O=function(){var e=n.t(function*(){var e;yield(e=a)==null?a=D():e,c&&!f?k(!1):S&&t.follow&&A(),N()});return function(){return e.apply(this,arguments)}}(),k=e=>{let t=E(),n=C(`canvas`),a=C(`stage`);if(!c||!t||!n||!a)return N();f==null||f.dispose(),p=!1,m=null,h=null;let o=new r.t(n,c,`simulator`,()=>{f===o&&(p=!0,N())});f=o,o.onDrawn=e=>{f===o&&(m=e,Fe(e,w()))},o.resize(a.clientWidth,a.clientHeight),o.setLook(T()),o.setTheme(i.state.selectedTheme);let s=e?x[x.length-2]:void 0;s&&o.update(s),o.update(t),S=!1,N()},A=()=>{let e=E();f&&e&&f.update(e),S=!1},j=e=>{let n=x[x.length-1];if(n&&n.puzzle===e.puzzle&&n.input===e.input)return;x.push(e),x.length>2&&x.shift();let r=i.state.activeTab===`pmmg`;r&&c&&!f?k(!1):t.follow&&r&&f?f.update(e):t.follow&&(S=!0),M()},M=()=>{let e=C(`replay`);e&&(e.disabled=!c||x.length<2)},N=()=>{if(!i)return;P(),M(),ee(),F();let e=C(`sprite-count`),n=c==null?void 0:c.latest;e&&(e.textContent=n?` ${c.spritesAt(n.update.pixelsPerUnit).length}`:``),t.subtab===`sprites`&&I(),t.subtab===`scene`&&ne()},P=()=>{let e=C(`status`);if(!e)return;if(s)return void(e.innerHTML=`<span class="pmmg-error">${X(s)}</span>`);if(!c)return void(e.textContent=o?`Loading the pmmg bundle…`:`Open this tab to load the pmmg bundle`);let t=_===`table`?`Drawing what neighbours see: the game's UPDATE_TABLE_GAME_STATE`:`Drawing the session's puzzle and saves, as the game hasn't sent UPDATE_TABLE_GAME_STATE (sdk.table.updateGameState)`,n=E()?``:`<div class="pmmg-dim">Waiting for the game's first state</div>`;e.innerHTML=`
238
+ <div>table · contract ${X(String(l))} · fonts: ${X(u.join(`, `)||`none`)}</div>
239
+ <div class="pmmg-dim">${X(t)}</div>${n}`},ee=()=>{var e,t;let n=C(`stats`),r=c==null?void 0:c.latest;if(!n)return;if(!r)return void(n.textContent=``);let i=r.scene,a=[i&&[`${Y(i.width)}×${Y(i.height)} units`,`${i.nodes.length} nodes`,`${(e=(t=i.effects)==null?void 0:t.length)==null?0:e} effects`,i.grid&&`grid ${Y(i.grid)}`],[`render #${r.render}: ${Y(r.renderMs)} ms`,r.spritesMs&&`${Y(r.spritesMs)} ms of SVG`,`made ${r.made.length}`,`${Y(r.update.pixelsPerUnit)} px/unit`,r.update.skipped&&`${r.update.skipped} skipped`]].filter(e=>!!e).map(e=>e.filter(Boolean).join(` · `)).map(e=>`<div>${X(e)}</div>`);matchMedia(`(prefers-reduced-motion: reduce)`).matches&&a.push(`<div class="pmmg-dim">Reduced motion is on, so changes show at once, as they do at the table</div>`),n.innerHTML=a.join(``)},F=()=>{var e;let t=C(`problems`);if(!t)return;let n=c==null?void 0:c.latest,r=[];if(n!=null&&n.error){let e=n.error.stack&&n.error.stack!==n.error.message?n.error.stack:``;r.push(`<div class="pmmg-problem error"><b>${Ze[n.error.phase]}</b> ${X(n.error.message)}
240
+ ${e?`<details><summary>Stack</summary><pre class="pmmg-json">${X(e)}</pre></details>`:``}</div>`)}p&&r.push(`<div class="pmmg-problem error">The board stopped, as a neighbour's does after its renders fail. Redraw to start again.</div>`);for(let t of[...d,...(e=c==null?void 0:c.warnings)==null?[]:e])r.push(`<div class="pmmg-problem warn">${X(t)}</div>`);c&&r.push(`<div class="pmmg-problem note">The bundle runs in this page here. At the table it runs in a worker with no DOM and no network, so anything that reaches for window, document or fetch only works here.</div>`),t.innerHTML=r.join(``)},I=()=>{var e,t;let n=C(`sprites`),i=C(`sprite-summary`);if(!n||!i)return;let a=c==null?void 0:c.latest;if(!c||!a){n.replaceChildren(),i.textContent=c?`Nothing rendered yet`:``,R([]);return}let o=a.update.pixelsPerUnit,s=c.spritesAt(o).sort((e,t)=>e.id.localeCompare(t.id)),l=a.scene?r.i(a.scene):null,u=((e=(t=C(`filter`))==null?void 0:t.value)==null?``:e).trim().toLowerCase(),d=u?s.filter(e=>e.id.toLowerCase().includes(u)):s,f=l?s.filter(e=>!l.has(e.id)).length:0,p=c.resolutions().filter(e=>e!==o);i.textContent=[`${s.length} at ${Y(o)} px/unit`,f&&`${f} not in this scene`,p.length&&`also made at ${p.map(Y).join(`, `)}`,u&&`${d.length} match`].filter(Boolean).join(` · `),n.replaceChildren(...d.map(e=>L(e,l))),R(s)},L=(e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`pmmg-sprite${t&&!t.has(e.id)?` unused`:``}${e.id===g?` selected`:``}`,n.title=`${e.id}\n${Y(e.width)}×${Y(e.height)} units, ${e.kind}${t&&!t.has(e.id)?`, not in this scene`:``}`;let r=document.createElement(`span`);r.className=`pmmg-sprite-picture`,r.append($e(e,72,64));let i=document.createElement(`span`);i.className=`pmmg-sprite-id`,i.textContent=e.id;let a=document.createElement(`span`);return a.className=`pmmg-sprite-meta`,a.textContent=`${Y(e.width)}×${Y(e.height)} ${e.kind}`,n.append(r,i,a),n.addEventListener(`click`,()=>z(g===e.id?null:e.id)),n},R=e=>{var t,n;let r=C(`detail`);if(!r)return;let i=g?e.find(e=>e.id===g):void 0;if(!i)return void(r.innerHTML=``);let a=te(i.id);r.innerHTML=`
241
+ <div class="pmmg-detail">
242
+ <div class="pmmg-detail-head">
243
+ <span class="pmmg-detail-id">${X(i.id)}</span>
244
+ <button class="simulator-btn tiny" type="button" data-pmmg-deselect>Close</button>
245
+ </div>
246
+ <div class="pmmg-detail-picture"></div>
247
+ <dl class="pmmg-facts">
248
+ <dt>Kind</dt><dd>${i.kind===`svg`?`SVG markup`:`Drawn on a canvas`}</dd>
249
+ <dt>Box</dt><dd>${Y(i.width)}×${Y(i.height)} units, anchor ${Y(i.anchor[0])}, ${Y(i.anchor[1])}</dd>
250
+ <dt>Pixels</dt><dd>${i.bitmap.width}×${i.bitmap.height} at ${Y(i.pixelsPerUnit)} px/unit</dd>
251
+ <dt>Made</dt><dd>render #${i.render}</dd>
252
+ <dt>Used by</dt><dd>${a.length?X(a.slice(0,24).join(`, `)+(a.length>24?`, and ${a.length-24} more`:``)):`nothing in this scene`}</dd>
253
+ </dl>
254
+ ${i.svg?`<details><summary>SVG, ${i.svg.length.toLocaleString()} characters</summary><pre class="pmmg-json">${X(i.svg)}</pre></details>`:``}
255
+ </div>`,(t=r.querySelector(`.pmmg-detail-picture`))==null||t.append($e(i,300,160)),(n=r.querySelector(`[data-pmmg-deselect]`))==null||n.addEventListener(`click`,()=>z(null))},te=e=>{var t,n;let r=c==null||(t=c.latest)==null?void 0:t.scene;if(!r)return[];let i=t=>[t.enter,t.exit].some(t=>t==null?void 0:t.keyframes.some(t=>t.sprite===e)),a=r.nodes.filter(t=>t.sprite===e||i(t)).map(e=>e.key),o=((n=r.effects)==null?[]:n).filter(t=>t.keyframes.some(t=>t.sprite===e)).map(e=>`${e.key} (effect)`);return[...a,...o]},z=e=>{g=e,t.subtab===`sprites`&&I(),f==null||f.redraw()},ne=()=>{var e;let t=C(`update`),n=C(`scene`),r=c==null?void 0:c.latest;if(!(!t||!n)){if(!r){t.textContent=``,n.textContent=c?`Nothing rendered yet`:``;return}t.textContent=[`render #${r.render}`,`puzzle ${r.update.puzzle.length.toLocaleString()} chars`,`input ${r.update.input.length.toLocaleString()} chars`,r.update.previous?`animating from the board before`:`first draw`,`${r.update.skipped} skipped`,`${r.update.fidelity} fidelity on ${r.update.backgroundStyle}`,r.scene?`as Puzzmo keeps it`:`as returned, since Puzzmo refused it`].join(` · `),n.textContent=et((e=r.scene)==null?r.raw:e)}},B=()=>{let e=C(`root`);e==null||e.querySelectorAll(`[data-pmmg-subtab]`).forEach(e=>{e.classList.toggle(`active`,e.dataset.pmmgSubtab===t.subtab)}),e==null||e.querySelectorAll(`[data-pmmg-pane]`).forEach(e=>{e.classList.toggle(`active`,e.dataset.pmmgPane===t.subtab)}),N()},V=e=>{let t=C(`canvas`);if(!t||!m)return null;let n=t.getBoundingClientRect();if(!n.width)return null;let r=t.width/n.width;return[(e.clientX-n.left)*r/m.scale,(e.clientY-n.top)*r/m.scale]},H=e=>{var t;let n=C(`hover`);if(!n)return;let r=e&&m?Le(m.nodes,e,e=>c==null?void 0:c.anySprite(e)):null,i=r?m.scene.nodes.find(e=>e.key===r.key):void 0,a=(t=r==null?void 0:r.key)==null?null:t;if(a!==h&&(h=a,f==null||f.redraw()),!e)return void(n.textContent=`Hover the board to see a node, click one to pick its sprite`);if(!r)return void(n.textContent=`${Y(e[0])}, ${Y(e[1])}`);n.textContent=[r.key,r.sprite,i&&`at ${Y(i.x)}, ${Y(i.y)}`,(i==null?void 0:i.rotation)&&`${Y(i.rotation)}°`,(i==null?void 0:i.scale)&&`scale ${i.scale.map(Y).join(`, `)}`,(i==null?void 0:i.opacity)!==void 0&&`opacity ${Y(i.opacity)}`,(i==null?void 0:i.tint)&&`tint ${i.tint}`,(i==null?void 0:i.brightness)!==void 0&&`brightness ${Y(i.brightness)}`,(i==null?void 0:i.blend)&&i.blend!==`normal`&&i.blend,(i==null?void 0:i.parent)&&`in ${i.parent}`,r.exiting&&`exiting`].filter(Boolean).join(` · `)};return{id:`pmmg`,label:`Pmmg`,render(){return`
256
+ <div class="pmmg-view pmmg-backdrop-${t.backdrop}" id="sim-pmmg-root">
257
+ <div class="pmmg-status" id="sim-pmmg-status">Open this tab to load the pmmg bundle</div>
258
+ <div class="data-subtabs">
259
+ <button class="data-subtab" type="button" data-pmmg-subtab="layout">Layout</button>
260
+ <button class="data-subtab" type="button" data-pmmg-subtab="sprites">Sprites<span id="sim-pmmg-sprite-count"></span></button>
261
+ <button class="data-subtab" type="button" data-pmmg-subtab="scene">Scene</button>
262
+ </div>
263
+ <div class="pmmg-pane" data-pmmg-pane="layout">
264
+ <div class="pmmg-actions">
265
+ <button class="simulator-btn tiny" type="button" id="sim-pmmg-replay" title="Draws the move before the last, then animates into the last" disabled>Replay last move</button>
266
+ <button class="simulator-btn tiny" type="button" id="sim-pmmg-redraw" title="A new board, showing the latest move">Redraw</button>
267
+ <label class="pmmg-check" title="Each new move animates in, as a neighbour's board would"><input type="checkbox" data-pmmg-pref="follow" /> Follow game</label>
268
+ </div>
269
+ <div class="pmmg-actions">
270
+ <label class="pmmg-check" title="High for a neighbour beside the player, low for a board seen in passing, like an ambient table or the lobby's">
271
+ Fidelity
272
+ <select class="simulator-select" id="sim-pmmg-fidelity">
273
+ <option value="high">High</option>
274
+ <option value="low">Low</option>
275
+ </select>
276
+ </label>
277
+ <label class="pmmg-check" title="Whether what's behind the board is dark or light: Puzzmo uses the game's felt when it has a scheme, and the theme's otherwise">
278
+ Background
279
+ <select class="simulator-select" id="sim-pmmg-background-style">
280
+ <option value="theme">Theme's</option>
281
+ <option value="dark">Dark</option>
282
+ <option value="light">Light</option>
283
+ </select>
284
+ </label>
285
+ </div>
286
+ <div class="pmmg-stage" id="sim-pmmg-stage"><canvas class="pmmg-backdrop" id="sim-pmmg-canvas"></canvas></div>
287
+ <div class="pmmg-hover" id="sim-pmmg-hover">Hover the board to see a node, click one to pick its sprite</div>
288
+ <div class="pmmg-toggles">
289
+ ${Xe.map(([e,t,n])=>`<label class="pmmg-check" title="${n}"><input type="checkbox" data-pmmg-pref="${e}" /> ${t}</label>`).join(``)}
290
+ <select class="simulator-select pmmg-backdrop-select" id="sim-pmmg-backdrop" title="What's behind the board">
291
+ <option value="checker">Checker</option>
292
+ <option value="theme">Theme bg</option>
293
+ <option value="black">Black</option>
294
+ <option value="white">White</option>
295
+ </select>
296
+ </div>
297
+ <div class="pmmg-stats" id="sim-pmmg-stats"></div>
298
+ <div class="pmmg-problems" id="sim-pmmg-problems"></div>
299
+ </div>
300
+ <div class="pmmg-pane" data-pmmg-pane="sprites">
301
+ <div class="pmmg-actions">
302
+ <input class="simulator-input" id="sim-pmmg-filter" placeholder="Filter by ID" />
303
+ <button class="simulator-btn tiny" type="button" id="sim-pmmg-clear" title="Forgets every sprite, as a new table would, and draws again">Clear sprites</button>
304
+ </div>
305
+ <div class="pmmg-stats" id="sim-pmmg-sprite-summary"></div>
306
+ <div id="sim-pmmg-detail"></div>
307
+ <div class="pmmg-sprites" id="sim-pmmg-sprites"></div>
308
+ </div>
309
+ <div class="pmmg-pane" data-pmmg-pane="scene">
310
+ <div class="pmmg-stats" id="sim-pmmg-update"></div>
311
+ <pre class="pmmg-json" id="sim-pmmg-scene"></pre>
312
+ </div>
313
+ </div>
314
+ `},bind(e){var n,r,a,o;i=e;let s=C(`root`);if(!s)return;s.style.setProperty(`--pmmg-theme-bg`,i.state.selectedTheme.g_bg),s.querySelectorAll(`[data-pmmg-subtab]`).forEach(e=>{e.addEventListener(`click`,()=>{t.subtab=e.dataset.pmmgSubtab,b(t),B()})}),s.querySelectorAll(`[data-pmmg-pref]`).forEach(e=>{let n=e.dataset.pmmgPref;e.checked=t[n],e.addEventListener(`change`,()=>{t[n]=e.checked,b(t),n===`follow`&&e.checked&&A(),f==null||f.redraw()})});let l=C(`backdrop`);l&&(l.value=t.backdrop,l.addEventListener(`change`,()=>{t.backdrop=l.value,b(t),s.className=`pmmg-view pmmg-backdrop-${t.backdrop}`}));let u=C(`fidelity`);u&&(u.value=t.fidelity,u.addEventListener(`change`,()=>{t.fidelity=u.value,b(t),f==null||f.setLook(T())}));let d=C(`background-style`);d&&(d.options[0].textContent=`Theme's (${i.state.selectedTheme.type})`,d.value=t.backgroundStyle,d.addEventListener(`change`,()=>{t.backgroundStyle=d.value,b(t),f==null||f.setLook(T())})),(n=C(`replay`))==null||n.addEventListener(`click`,()=>k(!0)),(r=C(`redraw`))==null||r.addEventListener(`click`,()=>k(!1)),(a=C(`clear`))==null||a.addEventListener(`click`,()=>{c==null||c.clear(),k(!1)}),(o=C(`filter`))==null||o.addEventListener(`input`,()=>I());let p=C(`canvas`);p==null||p.addEventListener(`mousemove`,e=>H(V(e))),p==null||p.addEventListener(`mouseleave`,()=>H(null)),p==null||p.addEventListener(`click`,e=>{let t=V(e),n=t&&m?Le(m.nodes,t,e=>c==null?void 0:c.anySprite(e)):null;n!=null&&n.sprite&&z(g===n.sprite?null:n.sprite)});let h=C(`stage`);h&&new ResizeObserver(([e])=>f==null?void 0:f.resize(e.contentRect.width,e.contentRect.height)).observe(h),B()},onActivate(){O()},onMessage(e,t,n){if(e===`UPDATE_TABLE_GAME_STATE`&&typeof(t==null?void 0:t.inputString)==`string`){var r;typeof t.puzzleString==`string`&&(v=t.puzzleString);let e=(r=v)==null?n.state.puzzleData:r;if(e===null)return;_!==`table`&&(_=`table`,x.length=0),j({puzzle:e,input:t.inputString})}else if(e===`UPLOAD_NEW_GAME_STATE`&&_===`session`){var i,a;let e=(i=t==null||(a=t.input)==null?void 0:a.boardState)==null?t==null?void 0:t.boardState:i,r=n.state.puzzleData;typeof e==`string`&&r!==null&&j({puzzle:r,input:e})}else e===`READY_GAME_LOADED`&&n.state.activeTab===`pmmg`&&O()}}}var $e=(e,t,n)=>{let r=window.devicePixelRatio||1,{bitmap:i}=e,a=Math.min(t/(i.width/r),n/(i.height/r),8),o=Math.max(1,i.width/r*a),s=Math.max(1,i.height/r*a),c=document.createElement(`canvas`);c.className=`pmmg-backdrop`,c.width=Math.max(1,Math.round(o*r)),c.height=Math.max(1,Math.round(s*r)),c.style.width=`${o}px`,c.style.height=`${s}px`;let l=c.getContext(`2d`);if(!l)return c;l.imageSmoothingEnabled=a<1;try{l.drawImage(i,0,0,c.width,c.height)}catch(e){}let u=e.anchor[0]/e.width*c.width,d=e.anchor[1]/e.height*c.height,f=4*r;return l.strokeStyle=`#f472b6`,l.lineWidth=r,l.beginPath(),l.moveTo(u-f,d),l.lineTo(u+f,d),l.moveTo(u,d-f),l.lineTo(u,d+f),l.stroke(),c},Y=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),et=e=>{try{var t;return(t=JSON.stringify(e,null,2))==null?String(e):t}catch(t){return String(e)}},X=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),tt=e=>e instanceof Error?e.message:String(e);function nt(e){let t=[e.key,e.subBrand,e.player,e.alt1,e.alt2,e.alt3].map(e=>`<div class="simulator-theme-preview-cell" style="background: ${e}"></div>`).join(``);return`<div class="simulator-theme-preview" style="background: ${e.g_bg}">${t}</div>`}function rt(){return{id:`theme`,label:`Theme`,render(){return`
315
+ <div class="theme-view-container">
316
+ <div class="theme-header">
317
+ <span class="simulator-label">Select Theme</span>
318
+ </div>
319
+ <div id="simulator-themes" class="simulator-themes"></div>
320
+ </div>
321
+ `},bind(e){let t=e.getElement(`#simulator-themes`);t&&a.forEach(n=>{let r=document.createElement(`div`);r.className=`simulator-theme-item${n.name===e.state.selectedTheme.name?` selected`:``}`,r.innerHTML=`
322
+ ${nt(n)}
323
+ <div class="simulator-theme-name">${n.name}</div>
324
+ <div class="simulator-theme-type">${n.type}</div>
325
+ `,r.addEventListener(`click`,()=>{console.log(`Simulator: Theme changed, reloading...`,n.name),N(n.name),window.location.reload()}),t.appendChild(r)})}}}var it=[{name:`app (desktop)`,context:[{type:`app`,layout:`desktop`,host:null}]},{name:`app (mobile)`,context:[{type:`app`,layout:`mobile`,host:null}]},{name:`app (ios)`,context:[{type:`app`,layout:`mobile`,host:`ios-app`}]},{name:`embed`,context:[{type:`embed`}]},{name:`embed (no UI)`,context:[{type:`embed`,noUI:!0}]},{name:`sandbox`,context:[{type:`sandbox`}]}];function at(e=[]){let t=[...it,...e];return{id:`host`,label:`Host`,render(){return`
326
+ <style>
327
+ #simulator-tab-host .host-note { opacity: 0.5; font-size: 10px; margin: 4px 0 8px; }
328
+ #simulator-tab-host .host-error { color: #f66; font-size: 11px; margin-top: 6px; white-space: pre-wrap; }
329
+ #simulator-tab-host .host-actions { display: flex; gap: 6px; margin-top: 8px; }
330
+ #simulator-tab-host .simulator-textarea { min-height: 140px; font-family: monospace; }
331
+ </style>
332
+ <div class="simulator-section">
333
+ <div class="simulator-section-title">Host Context</div>
334
+ <div class="host-note" id="host-source"></div>
335
+ <select class="simulator-select" id="host-presets">
336
+ <option value="">Preset…</option>
337
+ ${t.map((e,t)=>`<option value="${t}">${ot(e.name)}</option>`).join(``)}
338
+ </select>
339
+ <textarea class="simulator-textarea" id="host-json" spellcheck="false"></textarea>
340
+ <div class="host-actions">
341
+ <button class="simulator-btn primary" id="host-apply">Apply &amp; Restart</button>
342
+ <button class="simulator-btn subtle" id="host-reset">Reset</button>
343
+ </div>
344
+ <div class="host-error" id="host-error"></div>
345
+ </div>
346
+ `},bind(e){var n,r;let i=e.getElement(`#host-json`),a=e.getElement(`#host-presets`),o=e.getElement(`#host-error`),s=e.getElement(`#host-source`);!i||!a||!o||!s||(i.value=JSON.stringify(e.state.hostContext,null,2),s.textContent=e.state.hostContextIsOverridden?`Using this tab's override. Changes apply on restart.`:`Using the vite config / default context. Changes apply on restart.`,a.addEventListener(`change`,()=>{let e=t[Number(a.value)];e&&(i.value=JSON.stringify(e.context,null,2))}),(n=e.getElement(`#host-apply`))==null||n.addEventListener(`click`,()=>{let e;try{e=JSON.parse(i.value)}catch(e){o.textContent=`Invalid JSON: ${e.message}`;return}if(!Array.isArray(e)||!e.every(e=>e&&typeof e==`object`&&typeof e.type==`string`)){o.textContent=`hostContext must be an array of { type: string, ... } objects`;return}console.log(`Simulator: hostContext changed, reloading...`,e),m(e),window.location.reload()}),(r=e.getElement(`#host-reset`))==null||r.addEventListener(`click`,()=>{h(),window.location.reload()}))}}}function ot(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}var st=`puzzmo_sim_api_mode`,ct=`http://localhost:8911`,lt=`https://api.puzzmo.com`,ut=()=>localStorage.getItem(st)===`dev`?`dev`:`prod`,dt=e=>{localStorage.setItem(st,e)},Z=null,ft=function(){var e=n.t(function*(){if(Z!==null)return Z;try{let e=new AbortController,t=setTimeout(()=>e.abort(),1e3),n=yield fetch(`${ct}/healthz`,{signal:e.signal});return clearTimeout(t),Z=n.ok,Z}catch(e){return Z=!1,!1}});return function(){return e.apply(this,arguments)}}(),pt=()=>({apiURL:ut()===`dev`?ct:lt,clientID:`protosdk:oauthclient`,redirectUri:`${window.location.origin}/oauth/callback`}),mt=()=>{let e=new Uint8Array(32);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)},ht=`puzzmo_sim_oauth_token`,gt=`puzzmo_sim_oauth_refresh_token`,_t=e=>localStorage.setItem(ht,e),vt=e=>localStorage.setItem(gt,e),yt=()=>{let e=localStorage.getItem(ht);return e&&`${e.substring(0,20)}`,e},bt=()=>localStorage.getItem(gt),xt=()=>{localStorage.removeItem(ht),localStorage.removeItem(gt)},St=()=>{let e=pt(),t=mt();sessionStorage.setItem(`oauth_state`,t),sessionStorage.setItem(`oauth_return_url`,window.location.href);let n=new URL(`${e.apiURL}/oauth/auth`);n.searchParams.set(`client_id`,e.clientID),n.searchParams.set(`response_type`,`code`),n.searchParams.set(`redirect_uri`,e.redirectUri),n.searchParams.set(`state`,t),window.location.href=n.toString()},Ct=e=>{try{let t=e.split(`.`);if(t.length!==3)return!0;let n=JSON.parse(atob(t[1])).exp;return n?Date.now()>=n*1e3-300*1e3:!0}catch(e){return!0}},wt=function(){var e=n.t(function*(){let e=bt();if(!e)return!1;let t=pt();try{let n=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:t.clientID}),r=yield fetch(`${t.apiURL}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n.toString()});if(!r.ok)return r.statusText,!1;let i=yield r.json(),a=i.access_token||i.accessToken;if(!a)return!1;_t(a);let o=i.refresh_token||i.refreshToken;return o&&vt(o),!0}catch(e){return!1}});return function(){return e.apply(this,arguments)}}(),Tt=function(){var e=n.t(function*(e,t){let n=pt(),r=sessionStorage.getItem(`oauth_state`);if(!r||r!==t)return null;sessionStorage.removeItem(`oauth_state`);try{let t=new URLSearchParams({grant_type:`authorization_code`,code:e,client_id:n.clientID,redirect_uri:n.redirectUri}),r=yield fetch(`${n.apiURL}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t.toString()});return r.ok?yield r.json():(r.statusText,null)}catch(e){return null}});return function(t,n){return e.apply(this,arguments)}}(),Et=function(){var e=n.t(function*(e,t={}){let n=pt(),r=yt();if(!r)throw Error(`Not authenticated`);if(Ct(r))if(yield wt()){if(r=yt(),!r)throw Error(`Token refresh succeeded but no token available`)}else throw xt(),Error(`Session expired. Please log in again.`);let i=yield fetch(`${n.apiURL}/graphql`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,"auth-provider":`custom`},body:JSON.stringify({query:e,variables:t})});if(!i.ok)throw Error(`API request failed: ${i.statusText}`);return i.json()});return function(t){return e.apply(this,arguments)}}(),Dt=e=>{try{let t=e.split(`.`);return t.length,t.length===3?JSON.parse(atob(t[1])):null}catch(e){return null}};function Ot(){let e=!1;return{id:`auth`,label:`Auth`,render(){let e=yt(),t=!!e,n=ut(),r=n===`dev`?ct:lt,i=`<button class="simulator-btn tiny" id="auth-dev-toggle" style="display: none;">${n===`dev`?`Using Dev`:`Dev`}</button>`;if(t){let t=Dt(e),n=t!=null&&t.exp?new Date(t.exp*1e3).toLocaleString():`Unknown`,a=!!bt(),o=a?Dt(bt()):null,s=o!=null&&o.exp?new Date(o.exp*1e3).toLocaleString():null;return`
347
+ <div class="simulator-section">
348
+ <div class="simulator-section-title auth-title-row">
349
+ <span>Puzzmo Authentication</span>
350
+ ${i}
351
+ <button class="simulator-btn danger tiny" id="auth-logout">Logout</button>
352
+ </div>
353
+ <div id="auth-status" class="auth-status authenticated">
354
+ <span class="indicator ready"></span>
355
+ <span>Authenticated</span>
356
+ </div>
357
+ <div id="auth-user-info" class="auth-user-info">
358
+ <div>User ID: <code>${(t==null?void 0:t.userID)||(t==null?void 0:t.sub)||`Unknown`}</code></div>
359
+ <div>API: <code>${r}</code></div>
360
+ <div>Access expires: <code>${n}</code></div>
361
+ ${a?`<div>Refresh expires: <code>${s||`Unknown`}</code></div>`:`<div class="auth-warning">No refresh token</div>`}
362
+ </div>
363
+ ${a?`<button class="simulator-btn secondary tiny" id="auth-refresh">Refresh Now</button>`:``}
364
+ </div>
365
+ <div class="simulator-section">
366
+ <div class="simulator-section-title">Test API Request</div>
367
+ <div class="simulator-row">
368
+ <button class="simulator-btn primary" id="auth-test-api">Fetch Current User</button>
369
+ </div>
370
+ <div id="auth-api-result" class="auth-api-result"></div>
371
+ </div>
372
+ `}return`
373
+ <div class="simulator-section">
374
+ <div class="simulator-section-title auth-title-row">
375
+ <span>Puzzmo Authentication</span>
376
+ ${i}
377
+ </div>
378
+ <div id="auth-status" class="auth-status">
379
+ <span class="indicator waiting"></span>
380
+ <span>Not authenticated</span>
381
+ </div>
382
+ <p class="auth-description">
383
+ Login with your Puzzmo account to make authenticated API requests.
384
+ ${n===`dev`?`<br><strong>Using local dev server:</strong> ${ct}`:``}
385
+ </p>
386
+ <div class="simulator-row">
387
+ <button class="simulator-btn primary" id="auth-login">Login with Puzzmo</button>
388
+ </div>
389
+ <div id="auth-error" class="auth-error"></div>
390
+ </div>
391
+ `},bind(t){let r=t.getElement(`#auth-login`),i=t.getElement(`#auth-logout`),a=t.getElement(`#auth-refresh`),o=t.getElement(`#auth-test-api`),s=t.getElement(`#auth-api-result`),c=t.getElement(`#auth-dev-toggle`);e?Z&&c&&(c.style.display=``,ut()===`dev`&&c.classList.add(`active`)):(e=!0,ft().then(e=>{e&&c&&(c.style.display=``,ut()===`dev`&&c.classList.add(`active`))})),c==null||c.addEventListener(`click`,()=>{dt(ut()===`dev`?`prod`:`dev`),xt(),window.location.reload()}),r==null||r.addEventListener(`click`,()=>{St()}),i==null||i.addEventListener(`click`,()=>{xt(),window.location.reload()}),a==null||a.addEventListener(`click`,n.t(function*(){a.disabled=!0,a.textContent=`Refreshing...`,(yield wt())?window.location.reload():(a.textContent=`Refresh Failed`,a.disabled=!1)})),o==null||o.addEventListener(`click`,n.t(function*(){if(s){s.innerHTML=`<div class="loading">Loading...</div>`;try{let t=yield Et(`
392
+ query {
393
+ currentUser {
394
+ id
395
+ username
396
+ usernameID
397
+ name
398
+ }
399
+ }
400
+ `);if(t.errors){var e;s.innerHTML=`<div class="error">Error: ${((e=t.errors[0])==null?void 0:e.message)||`Unknown error`}</div>`}else s.innerHTML=`<pre>${JSON.stringify(t.data,null,2)}</pre>`}catch(e){s.innerHTML=`<div class="error">Error: ${e instanceof Error?e.message:`Unknown error`}</div>`}}}))},onActivate(e){return n.t(function*(){let t=new URLSearchParams(window.location.search),n=t.get(`code`),r=t.get(`state`),i=t.get(`error`);if(i){let t=e.getElement(`#auth-error`);t&&(t.innerHTML=`<div class="error">OAuth error: ${i}</div>`),window.history.replaceState({},``,window.location.pathname);return}if(n&&r){let t=e.getElement(`#auth-status`);t&&(t.innerHTML=`<span class="indicator waiting"></span><span>Exchanging code...</span>`);let i=yield Tt(n,r);if(window.history.replaceState({},``,window.location.pathname),i){let e=i.access_token||i.accessToken;if(e){_t(e);let t=i.refresh_token||i.refreshToken;t&&vt(t)}window.location.reload()}else{let t=e.getElement(`#auth-error`);t&&(t.innerHTML=`<div class="error">Failed to exchange code for token</div>`)}}})()}}}var kt=`puzzmo_sim_api_mode`,At=`http://localhost:8911`,jt=`https://api.puzzmo.com`,Mt=`puzzmo_sim_oauth_token`,Nt=`puzzmo_sim_oauth_refresh_token`,Pt=()=>localStorage.getItem(kt)===`dev`?`dev`:`prod`,Ft=()=>localStorage.getItem(Mt),It=()=>localStorage.getItem(Nt),Lt=e=>localStorage.setItem(Mt,e),Rt=e=>localStorage.setItem(Nt,e),zt=()=>{localStorage.removeItem(Mt),localStorage.removeItem(Nt)},Bt=e=>{try{let t=e.split(`.`);if(t.length!==3)return!0;let n=JSON.parse(atob(t[1])).exp;return n?Date.now()>=n*1e3-300*1e3:!0}catch(e){return!0}},Vt=function(){var e=n.t(function*(){let e=It();if(!e)return!1;let t=Pt()===`dev`?At:jt;try{let n=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:`protosdk:oauthclient`}),r=yield fetch(`${t}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n.toString()});if(!r.ok)return!1;let i=yield r.json(),a=i.access_token||i.accessToken;if(!a)return!1;Lt(a);let o=i.refresh_token||i.refreshToken;return o&&Rt(o),!0}catch(e){return!1}});return function(){return e.apply(this,arguments)}}(),Ht=function(){var e=n.t(function*(e,t={}){let n=Pt()===`dev`?At:jt,r=Ft();if(!r)throw Error(`Not authenticated`);if(Bt(r))if(yield Vt()){if(r=Ft(),!r)throw Error(`Token refresh succeeded but no token available`)}else throw zt(),Error(`Session expired. Please log in again.`);let i=yield fetch(`${n}/graphql`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,"auth-provider":`custom`},body:JSON.stringify({query:e,variables:t})});if(!i.ok)throw Error(`API request failed: ${i.statusText}`);return i.json()});return function(t){return e.apply(this,arguments)}}(),Ut=`
401
+ query GameFeaturesQuery($slug: ID!) {
402
+ game(id: $slug) {
403
+ id
404
+ slug
405
+ displayName
406
+ featuresArr
407
+ gameFeatures {
408
+ slug
409
+ title
410
+ features {
411
+ featureID
412
+ title
413
+ isEnabled
414
+ }
415
+ }
416
+ }
417
+ }
418
+ `,Wt=`
419
+ mutation ToggleFeatureMutation($gameSlug: ID!, $input: UpdateGameInput!) {
420
+ updateGame(id: $gameSlug, input: $input) {
421
+ id
422
+ featuresArr
423
+ gameFeatures {
424
+ slug
425
+ title
426
+ features {
427
+ featureID
428
+ title
429
+ isEnabled
430
+ }
431
+ }
432
+ }
433
+ }
434
+ `,Gt=(e,t)=>{let n=t-1,r=Math.floor(n/31),i=n%31,a=[...e];for(;a.length<=r;)a.push(0);return a[r]=a[r]^1<<i,a};const Kt=()=>!!Ft();function qt(){let e=null,r=!1,i=null,a=function(){var t=n.t(function*(t){r=!0,i=null;try{var n;let r=yield Ht(Ut,{slug:t});if(r.errors){var a;i=((a=r.errors[0])==null?void 0:a.message)||`Unknown error`,e=null}else (n=r.data)!=null&&n.game?e=r.data.game:(i=`Game not found`,e=null)}catch(t){i=t instanceof Error?t.message:`Unknown error`,e=null}finally{r=!1}});return function(e){return t.apply(this,arguments)}}(),o=function(){var r=n.t(function*(n){if(!e)return;let r=Gt(e.featuresArr,n);try{var i;let n=yield Ht(Wt,{gameSlug:e.slug,input:{featuresArr:r}});if(n.errors){var a;console.error(`Failed to toggle feature:`,(a=n.errors[0])==null?void 0:a.message)}else (i=n.data)!=null&&i.updateGame&&(e=t.t(t.t({},e),{},{featuresArr:n.data.updateGame.featuresArr,gameFeatures:n.data.updateGame.gameFeatures}))}catch(e){console.error(`Failed to toggle feature:`,e)}});return function(e){return r.apply(this,arguments)}}(),s=()=>{if(r)return`<div class="features-loading">Loading features...</div>`;if(i)return`<div class="features-error">${i}</div>`;if(!e)return`<div class="features-empty">Enter your game slug above to load features</div>`;let t=e.gameFeatures.map(e=>{let t=e.features.map(e=>{let t=e.isEnabled?`enabled`:`disabled`,n=e.isEnabled?`✓`:`✗`;return`
435
+ <div class="feature-item ${t}" data-feature-id="${e.featureID}">
436
+ <span class="feature-status">${n}</span>
437
+ <span class="feature-title">${e.title}</span>
438
+ </div>
439
+ `}).join(``);return`
440
+ <div class="feature-group">
441
+ <div class="feature-group-title">${e.title}</div>
442
+ <div class="feature-group-items">${t}</div>
443
+ </div>
444
+ `}).join(``);return`
445
+ <div class="features-game-name">${e.displayName}</div>
446
+ ${t}
447
+ `};return{id:`features`,label:`Features`,render(){return Kt()?`
448
+ <div class="features-view-container">
449
+ <div class="simulator-section">
450
+ <div class="simulator-section-title">Game Features</div>
451
+ <div class="features-slug-input">
452
+ <input type="text" class="simulator-input" id="features-game-slug" placeholder="Game slug (e.g. crossword)" />
453
+ <button class="simulator-btn primary" id="features-load-btn">Load</button>
454
+ </div>
455
+ </div>
456
+ <div class="simulator-divider"></div>
457
+ <div id="features-content" class="features-content">
458
+ ${s()}
459
+ </div>
460
+ </div>
461
+ `:`
462
+ <div class="features-view-container">
463
+ <div class="simulator-section">
464
+ <div class="simulator-section-title">Game Features</div>
465
+ <div class="features-auth-required">
466
+ <p>You must be logged in to view and edit game features.</p>
467
+ <p>Go to the <strong>Auth</strong> tab to log in with your Puzzmo account.</p>
468
+ </div>
469
+ </div>
470
+ </div>
471
+ `},bind(t){let r=t.getElement(`#features-load-btn`),i=t.getElement(`#features-game-slug`),c=t.getElement(`#features-content`),l=()=>{c&&(c.innerHTML=s(),u())},u=()=>{var e;let r=(e=t.getElement(`#features-content`))==null?void 0:e.querySelectorAll(`.feature-item`);r==null||r.forEach(e=>{e.addEventListener(`click`,n.t(function*(){let t=parseInt(e.getAttribute(`data-feature-id`)||`0`);t>0&&(e.classList.add(`updating`),yield o(t),l())}))})},d=function(){var e=n.t(function*(e){e&&(r&&(r.disabled=!0,r.textContent=`Loading...`),yield a(e),l(),r&&(r.disabled=!1,r.textContent=`Load`))});return function(t){return e.apply(this,arguments)}}();r==null||r.addEventListener(`click`,n.t(function*(){let e=i==null?void 0:i.value.trim();e&&(yield d(e))})),i==null||i.addEventListener(`keypress`,e=>{e.key===`Enter`&&(r==null||r.click())}),console.log(`[FeaturesView] bind called, ctx.gameSlug:`,t.gameSlug,`slugInput:`,i),t.gameSlug&&i&&(i.value=t.gameSlug,Kt()&&!e&&d(t.gameSlug)),u()},onActivate(e){let t=e.getElement(`#simulator-tab-features`);t&&(t.innerHTML=this.render(),this.bind(e))}}}var Jt=200,Yt=24;const Xt=Jt+Yt;var Zt=6,Qt=2.5,$t=100,en=(e,t)=>e?`14.7%`:t?`17.85%`:`9.75%`,Q=(e,t)=>{let n=e.replace(`#`,``),r=n.length===3?[...n].map(e=>e+e).join(``):n,i=parseInt(r,16);return r.length!==6||Number.isNaN(i)?e:`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`},tn=e=>e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),nn=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);function rn(e){let{theme:t,sendToGame:n}=e,r=!1,i=null,a=null,o=document.createElement(`style`);o.id=`sim-docked-kbd-page-style`,o.textContent=`
472
+ html.sim-kbd-docked #simulator {
473
+ bottom: ${Xt+4}px;
474
+ }
475
+ `;let s=()=>{var e;return(e=document.getElementById(`root`))==null?document.body.firstElementChild:e},c=null,l=()=>{let e=s();if(!e||c)return;let{height:t,maxHeight:n,position:r}=e.style;c=()=>{e.style.height=t,e.style.maxHeight=n,e.style.position=r,c=null},e.style.height=`calc(100% - ${Xt}px)`,e.style.maxHeight=`calc(100% - ${Xt}px)`,getComputedStyle(e).position===`static`&&(e.style.position=`relative`)},u=(e,n)=>{var r;let i=n.disabled.includes(e),a=n.highlight.includes(e);return[`display:flex`,`align-items:center`,`justify-content:center`,`width:100%`,`height:100%`,`box-sizing:border-box`,`border-radius:3px`,`overflow:hidden`,`background:transparent`,`pointer-events:none`,`border:${i?`1px dashed ${Q(t.fg,.25)}`:a?`2px solid ${Q(t.fg,.75)}`:`1px solid ${Q(t.fg,.4)}`}`,on((r=n.individualKeyStyles)==null||(r=r[e])==null?void 0:r.background)].filter(Boolean).join(`;`)},d=(e,n)=>{var r;return[`font:11px/1 Menlo, Monaco, Consolas, monospace`,`letter-spacing:0.5px`,`text-transform:uppercase`,`white-space:nowrap`,`color:${Q(t.fg,n.disabled.includes(e)?.3:.65)}`,n.highlight.includes(e)?``:on(n.keyStyles),on((r=n.individualKeyStyles)==null||(r=r[e])==null?void 0:r.text)].filter(Boolean).join(`;`)},f=(e,t)=>{var n,r;let i=(n=t.symbols[e])==null?e:n,a=t.disabled.includes(e),o=(r=t.flexGrowSymbols)==null?void 0:r.includes(e),s=[`width:${en(t.l.includes(e),t.xl.includes(e))}`,`flex:${o?`1 0 auto`:`0 1 auto`}`,`height:100%`,`display:flex`,`align-items:center`,`justify-content:center`,`padding:0 3px 12px`,`position:relative`,a?`pointer-events:none`:``].filter(Boolean).join(`;`),c=u(e,t),l=d(e,t);return`<div class="sim-docked-kbd-key" data-key="${tn(e)}" style="${s}">
476
+ <div class="sim-docked-kbd-key-inner" style="${c}"><div style="${l}">${nn(i)}</div></div>
477
+ </div>`},p=e=>{let n=e.layout.filter(e=>!!e),r=`calc(100% / ${n.length})`;return`${n.map((t,n)=>{var i,a;return`<div style="${`height:${r};display:flex;flex-direction:row;align-items:center;justify-content:${(i=(a=e.rowPositioning)==null?void 0:a[n])==null?`center`:i}`}">${[...t].map(t=>f(t,e)).join(``)}</div>`}).join(``)}${`<div id="sim-docked-kbd-cursor" style="position:absolute;inset:0;z-index:1;background:${Q(t.fg,.12)};opacity:0;transition:opacity 0.1s ease-in-out;pointer-events:none"></div>`}`},m=!1,h=[0,0],g=null,_=0,v=null,y=null,b=e=>{let t=a==null?void 0:a.querySelector(`#sim-docked-kbd-cursor`);t&&(t.style.opacity=e?`0.5`:`0`)},x=()=>{m=!1,h=[0,0],g=null,_=0,v=null,y=null,b(!1)},S=e=>{var t,n;return(t=(n=document.elementFromPoint(e.clientX,e.clientY))==null||(n=n.closest(`.sim-docked-kbd-key`))==null?void 0:n.getAttribute(`data-key`))==null?null:t},C=e=>{y=S(e),a==null||a.setPointerCapture(e.pointerId)},w=e=>{!(i!=null&&i.supportsDragCursor)||!y||g&&g.clientX===e.clientX&&g.clientY===e.clientY||(g&&g.pointerId!==e.pointerId&&(_=0,v=null),v||(v=Date.now()),m||(_+=1,_>=Zt&&Date.now()-v>=$t&&(m=!0,b(!0))),m&&g&&(h=[h[0]+(e.clientX-g.clientX)*Qt,h[1]+(e.clientY-g.clientY)*Qt]),g={clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId},m&&n(`KEYBOARD_CURSOR_CHANGE`,{position:h}))},T=e=>{m?n(`KEYBOARD_CURSOR_END`,{}):y&&S(e)===y&&n(`KEYBOARD_KEY_PRESS`,{key:y}),x()},E=()=>{a||!i||(a=document.createElement(`div`),a.id=`sim-docked-kbd`,a.style.cssText=[`position:fixed`,`left:0`,`right:0`,`bottom:0`,`height:${Xt}px`,`box-sizing:border-box`,`padding-top:8px`,`padding-bottom:${Yt}px`,`display:flex`,`flex-direction:column`,`z-index:999998`,`touch-action:none`,`user-select:none`,`-webkit-user-select:none`,`background:${t.a_bg}`,`border-top:1px solid ${Q(t.fg,.2)}`].join(`;`),a.innerHTML=p(i),a.addEventListener(`pointerdown`,C),a.addEventListener(`pointermove`,w),a.addEventListener(`pointerup`,T),a.addEventListener(`pointercancel`,()=>x()),a.addEventListener(`contextmenu`,e=>e.preventDefault()),document.body.appendChild(a),o.isConnected||document.head.appendChild(o),document.documentElement.classList.add(`sim-kbd-docked`),l())},D=()=>{a&&(a.remove(),a=null,document.documentElement.classList.remove(`sim-kbd-docked`),c==null||c(),x())},O=()=>{let e=i;!a||!e||a.querySelectorAll(`.sim-docked-kbd-key`).forEach(t=>{let n=t.getAttribute(`data-key`),r=t.firstElementChild,i=r==null?void 0:r.firstElementChild;!n||!r||!i||(r.style.cssText=u(n,e),i.style.cssText=d(n,e))})},k=()=>{if(!r||!i)return D();if(!a)return E();a.innerHTML=p(i),b(m)};return{setEnabled(e){r=e,k()},setConfig(e){let t=a&&e&&i&&an(e)===an(i);i=e,t?O():k()}}}var an=e=>JSON.stringify([e.layout,e.symbols,e.highlight,e.disabled,e.xl,e.l,e.flexGrowSymbols,e.rowPositioning,e.keyStyles]);const on=e=>Object.entries(e==null?{}:e).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${tn(String(t))}`).join(`;`);var sn=(e,t)=>{var n,r,i,a;let o=(n=t.symbols[e])==null?e:n,s=t.disabled.includes(e),c=t.highlight.includes(e),l=t.xl.includes(e),u=t.l.includes(e),d=(r=t.flexGrowSymbols)==null?void 0:r.includes(e),f=[`sim-kb-key`,s?`disabled`:``,c?`highlight`:``,l?`xl`:``,u?`l`:``,d?`grow`:``].filter(Boolean).join(` `),p=on((i=t.individualKeyStyles)==null||(i=i[e])==null?void 0:i.background),m=on((a=t.individualKeyStyles)==null||(a=a[e])==null?void 0:a.text);return`<button class="${f}" data-key="${e}" style="${p}" ${s?`disabled`:``}><span style="${m}">${o}</span></button>`},cn=e=>`<div class="sim-kb">${e.layout.filter(e=>e!=null).map(t=>`<div class="sim-kb-row">${[...t].map(t=>sn(t,e)).join(``)}</div>`).join(``)}</div>`;function ln(){let e=null,t=null,n=t=>e?t?`<div class="sim-kb-empty">Shown under the game at production size, taking ${Xt}px off the bottom.<br>Uncheck to preview the layout here instead.</div>`:cn(e):`<div class="sim-kb-empty">No keyboard config received from game yet.<br>The game calls <code>sdk.keyboard.show(config)</code> to display a keyboard.</div>`;return{id:`kbd`,label:`Kbd`,render(){return`
478
+ <div class="keyboard-view-container">
479
+ <div class="simulator-field">
480
+ <label class="sim-settings-row">
481
+ <input type="checkbox" id="sim-kb-dock" />
482
+ <span class="simulator-label">Show keyboard under game</span>
483
+ </label>
484
+ </div>
485
+ <div id="sim-kb-content">
486
+ ${n(!1)}
487
+ </div>
488
+ </div>
489
+ `},bind(e){t!=null||(t=rn({theme:e.state.selectedTheme,sendToGame:e.sendToGame})),t.setEnabled(e.state.keyboardDocked);let n=e.getElement(`#sim-kb-dock`);n&&(n.checked=e.state.keyboardDocked,n.addEventListener(`change`,()=>{e.state.keyboardDocked=n.checked,_(n.checked),t==null||t.setEnabled(n.checked),r(e)})),un(e)},onMessage(n,i,a){var o;n===`KEYBOARD_UPDATE_CONFIG`&&(e=!(!(i==null||(o=i.layout)==null)&&o.length)||i.layout.every(e=>!e)?null:i,t==null||t.setConfig(e),r(a))}};function r(e){let t=e.getElement(`#sim-kb-content`);t&&(t.innerHTML=n(e.state.keyboardDocked),un(e))}}function un(e){var t;let n=(t=e.getElement(`#sim-kb-content`))==null?void 0:t.querySelectorAll(`.sim-kb-key`);n==null||n.forEach(t=>{t.addEventListener(`click`,()=>{let n=t.getAttribute(`data-key`);n&&e.sendToGame(`KEYBOARD_KEY_PRESS`,{key:n})})})}function dn(){let e=e=>{let t=e.state.settingsComponents;return!t||t.length===0?`<div class="sim-settings-empty">No settings registered by the game yet.<br>The game calls <code>sdk.settings.initialize(components)</code> to describe its settings UI.</div>`:`<div class="sim-settings-form">${t.map(t=>fn(t,e.state.gameSettings)).join(``)}</div><div class="sim-settings-actions"><button class="simulator-btn tiny" id="sim-settings-reset">Reset to defaults</button></div>`},n=t=>{let n=t.getElement(`#sim-settings-content`);n&&(n.innerHTML=e(t),i(t))},r=e=>{k(e.state.gameSettings),e.sendToGame(`SETTINGS_UPDATE`,e.state.gameSettings)},i=e=>{var i;let a=e.getElement(`#sim-settings-content`);a&&(a.querySelectorAll(`[data-setting]`).forEach(n=>{let i=n.getAttribute(`data-setting`),o=n.getAttribute(`data-setting-type`);n.addEventListener(`change`,()=>{let s;if(o===`multiselect`){let e=a.querySelectorAll(`input[data-multiselect="${i}"]`);s=Array.from(e).filter(e=>e.checked).map(e=>e.value)}else s=n instanceof HTMLInputElement&&n.type===`checkbox`?n.checked:o===`number`?Number(n.value):n.value;e.state.gameSettings=t.t(t.t({},e.state.gameSettings),{},{[i]:s}),r(e)})}),(i=a.querySelector(`#sim-settings-reset`))==null||i.addEventListener(`click`,()=>{var t;A(),e.state.gameSettings=mn((t=e.state.settingsComponents)==null?[]:t),r(e),n(e)}))};return{id:`settings`,label:`Set`,render(){return`
490
+ <div class="settings-view-container">
491
+ <div id="sim-settings-content"></div>
492
+ </div>
493
+ `},bind(e){n(e)},onMessage(e,r,i){if(e===`INITIALIZE_SETTINGS`){var a;i.state.settingsComponents=(a=r==null?void 0:r.components)==null?[]:a,i.state.gameSettings=t.t(t.t({},r==null?void 0:r.settings),i.state.gameSettings),k(i.state.gameSettings),n(i);return}e===`UPDATE_SETTINGS_FROM_EMBED`&&(i.state.gameSettings=t.t(t.t({},i.state.gameSettings),r==null?void 0:r.settings),k(i.state.gameSettings),n(i))}}}function fn(e,t){if(e.hidden)return``;switch(e.type){case`title`:return`<div class="sim-settings-heading">${$(e.value)}</div>`;case`subtitle`:return`<div class="sim-settings-subheading">${$(e.value)}</div>`;case`paragraph`:return`<p class="sim-settings-paragraph">${$(e.value)}</p>`;case`separator`:return`<div class="simulator-divider"></div>`;case`split`:return`<div class="sim-settings-split">${e.content.map(e=>fn(e,t)).join(``)}</div>`;case`boolean`:{var n;let r=((n=t[e.name])==null?e.defaultValue:n)?`checked`:``,i=e.subtitle?`<div class="sim-settings-subtitle">${$(e.subtitle)}</div>`:``;return`
494
+ <div class="simulator-field">
495
+ <label class="sim-settings-row">
496
+ <input type="checkbox" data-setting="${e.name}" ${r} />
497
+ <span class="simulator-label">${$(e.title)}</span>
498
+ </label>
499
+ ${i}
500
+ </div>`}case`enum`:{var r;let n=(r=t[e.name])==null?e.defaultValue:r,i=e.values.map((t,r)=>{var i;return`<option value="${$(t)}" ${t===n?`selected`:``}>${$((i=e.displays[r])==null?t:i)}</option>`}).join(``);return`
501
+ <div class="simulator-field">
502
+ ${pn(e)}
503
+ <select class="simulator-select" data-setting="${e.name}">${i}</select>
504
+ </div>`}case`multiselect`:{var i;let n=(i=t[e.name])==null?e.defaultValue:i,r=Array.isArray(n)?n:[],a=e.values.map((t,n)=>{var i;return`
505
+ <label class="sim-settings-row">
506
+ <input type="checkbox" data-setting="${e.name}" data-setting-type="multiselect" data-multiselect="${e.name}" value="${$(t)}" ${r.includes(t)?`checked`:``} />
507
+ <span class="simulator-label">${$((i=e.displays[n])==null?t:i)}</span>
508
+ </label>`}).join(``);return`
509
+ <div class="simulator-field">
510
+ ${pn(e)}
511
+ ${a}
512
+ </div>`}case`number`:{var a;let n=(a=t[e.name])==null?e.defaultValue:a,r=e.values.map(e=>`<option value="${e}" ${e===n?`selected`:``}>${e}</option>`).join(``);return`
513
+ <div class="simulator-field">
514
+ ${pn(e)}
515
+ <select class="simulator-select" data-setting="${e.name}" data-setting-type="number">${r}</select>
516
+ </div>`}case`text`:{var o,s;let n=String((o=(s=t[e.name])==null?e.defaultValue:s)==null?``:o),r=e.textarea?`<textarea class="simulator-textarea" data-setting="${e.name}">${$(n)}</textarea>`:`<input class="simulator-input" type="text" data-setting="${e.name}" value="${$(n)}" />`;return`
517
+ <div class="simulator-field">
518
+ ${pn(e)}
519
+ ${r}
520
+ </div>`}default:return`<div class="sim-settings-unsupported">Unsupported component type: ${$(e.type)}</div>`}}function pn(e){let t=e.subtitle?`<div class="sim-settings-subtitle">${$(e.subtitle)}</div>`:``;return`<span class="simulator-label">${$(e.title)}</span>${t}`}function mn(e){let t={};for(let n of e)n.type===`split`?Object.assign(t,mn(n.content)):`name`in n&&(t[n.name]=n.defaultValue);return t}function $(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function hn(){let e=[],t=!0,n=()=>e.length===0?`<div class="sound-empty">No cues yet. Play the game to hear from it.</div>`:e.map(e=>`<div class="sound-row"><span class="sound-id">${_n(e.id)}</span>${e.haptic?`<span class="sound-haptic">${_n(e.haptic)}</span>`:``}<span class="sound-time">${e.time}</span></div>`).join(``),r=t=>{let r=t.getElement(`#sound-events`);r&&(r.innerHTML=n()),t.updateBadge(`sound`,e.length)};return{id:`sound`,label:`Sound`,render(){return`
521
+ <style>
522
+ #simulator-tab-sound .sound-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-family: monospace; font-size: 11px; }
523
+ #simulator-tab-sound .sound-id { color: var(--accent, #6cf); }
524
+ #simulator-tab-sound .sound-haptic { opacity: 0.7; }
525
+ #simulator-tab-sound .sound-time { opacity: 0.5; }
526
+ #simulator-tab-sound .sound-empty { opacity: 0.5; font-size: 11px; padding: 4px 0; }
527
+ #simulator-tab-sound .sound-controls { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
528
+ #simulator-tab-sound .sound-toggle { font-size: 11px; display: flex; align-items: center; gap: 4px; }
529
+ </style>
530
+ <div class="simulator-section">
531
+ <div class="simulator-section-title">Cues</div>
532
+ <div class="sound-controls">
533
+ <label class="sound-toggle"><input type="checkbox" id="sound-enabled" ${t?`checked`:``} /> Sound enabled</label>
534
+ <button class="simulator-btn" id="sound-clear">Clear</button>
535
+ </div>
536
+ <div id="sound-events">${n()}</div>
537
+ </div>
538
+ `},bind(n){let i=n.getElement(`#sound-clear`);i==null||i.addEventListener(`click`,()=>{e.length=0,r(n)});let a=n.getElement(`#sound-enabled`);a==null||a.addEventListener(`change`,()=>{t=!!a.checked,n.sendToGame(`SOUND_ENABLED`,{enabled:t})}),n.sendToGame(`SOUND_ENABLED`,{enabled:t})},onMessage(n,i,a){var o;if(n===`READY_GAME_LOADED`){a.sendToGame(`SOUND_ENABLED`,{enabled:t});return}n===`SENSORY_EVENT`&&(e.unshift({id:(o=i==null?void 0:i.id)==null?JSON.stringify(i):o,haptic:i==null?void 0:i.haptic,time:gn()}),e.length>100&&e.pop(),r(a))}}}function gn(){return new Date().toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function _n(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}var vn=null;function yn(){return typeof window>`u`?!1:new URLSearchParams(window.location.search).has(`developer`)}var bn={updateFixtures:()=>{},sendToGame:()=>{},loadPuzzle:function(){var e=n.t(function*(){return null});return function(){return e.apply(this,arguments)}}()};function xn(e={}){var r,i,a,o,s;if(yn())return console.log(`[Simulator] developer=true in URL — running inside the Puzzmo app, skipping simulator boot`),bn;if(console.log(`[Simulator] createSimulator called with config:`,{slug:e.slug,hasFixtures:!!e.fixtures}),vn)return e.fixtures&&(console.log(`[Simulator] Instance already exists, updating fixtures`),vn.updateFixtures(e.fixtures)),vn;let c=(r=e.autoStart)==null?!0:r,l=e.fixtures?B(e.fixtures):null,u=l?Array.from(l.keys()).sort():[],d=_e(),f=Pe(),p=[ae(),le(),d,ve(),ye(),De((i=(a=e.integrations)==null?void 0:a.checklists)==null?[]:i),f,...e.pmmgBundle?[Qe(e.pmmgBundle)]:[],rt(),at(e.hostContextPresets),Ot(),qt(),ln(),dn(),hn(),...(o=e.views)==null?[]:o],m=p.map(e=>e.id),h=O(e,u,m),g={pause:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><rect x="1" y="1" width="3" height="8"/><rect x="6" y="1" width="3" height="8"/></svg>`,play:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><polygon points="2,1 9,5 2,9"/></svg>`,retry:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><path d="M5 1C2.8 1 1 2.8 1 5s1.8 4 4 4c1.8 0 3.3-1.2 3.8-2.8H7.5c-.4.9-1.3 1.5-2.5 1.5-1.5 0-2.7-1.2-2.7-2.7S3.5 2.3 5 2.3c.7 0 1.4.3 1.9.8L5.5 4.5H9V1L7.6 2.4C6.9 1.5 5.9 1 5 1z"/></svg>`,cog:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><path d="M9.5 5.8l-.8-.5c0-.2.1-.5.1-.8s0-.5-.1-.8l.8-.5c.1-.1.2-.2.1-.4l-.8-1.4c-.1-.1-.2-.2-.4-.1l-1 .3c-.3-.3-.7-.5-1.1-.6L6.1.2C6.1.1 6 0 5.8 0H4.2c-.2 0-.3.1-.3.2l-.2 1c-.4.1-.7.3-1.1.6l-1-.3c-.2 0-.3 0-.4.1l-.8 1.4c-.1.2 0 .3.1.4l.8.5c0 .2-.1.5-.1.8s0 .5.1.8l-.8.5c-.1.1-.2.2-.1.4l.8 1.4c.1.1.2.2.4.1l1-.3c.3.3.7.5 1.1.6l.2 1c0 .1.1.2.3.2h1.6c.2 0 .3-.1.3-.2l.2-1c.4-.1.7-.3 1.1-.6l1 .3c.2 0 .3 0 .4-.1l.8-1.4c.1-.2 0-.3-.1-.4zM5 6.5c-.8 0-1.5-.7-1.5-1.5S4.2 3.5 5 3.5 6.5 4.2 6.5 5 5.8 6.5 5 6.5z"/></svg>`,minimize:`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor"><rect x="1" y="4" width="8" height="2"/></svg>`,expand:`<svg width="8" height="8" viewBox="0 0 8 8" fill="currentColor"><polygon points="1,1 7,4 1,7"/></svg>`},_=document.createElement(`div`);_.id=`simulator`,_.dataset.puzzmoBuild=ie,_.innerHTML=`
539
+ <style>
540
+ :root {
541
+ --sim-bg: #1a1a2e;
542
+ --sim-bg-alt: #16213e;
543
+ --sim-panel: #0f0f1a;
544
+ --sim-border: #3a3a5c;
545
+ --sim-border-light: #5a5a8c;
546
+ --sim-accent: #ffd700;
547
+ --sim-accent-hover: #ffed4a;
548
+ --sim-text: #e8e8e8;
549
+ --sim-text-dim: #888899;
550
+ --sim-success: #4ade80;
551
+ --sim-error: #f87171;
552
+ --sim-warning: #fbbf24;
553
+ --sim-blue: #60a5fa;
554
+ }
555
+ #simulator {
556
+ position: fixed;
557
+ bottom: 4px;
558
+ left: 4px;
559
+ z-index: 999999;
560
+ font: 11px/1.4 "Menlo", "Monaco", "Consolas", monospace;
561
+ user-select: none;
562
+ }
563
+ #simulator-panel {
564
+ background: var(--sim-panel);
565
+ border: 2px solid var(--sim-border);
566
+ border-radius: 4px;
567
+ color: var(--sim-text);
568
+ width: 420px;
569
+ max-width: calc(100vw - 8px);
570
+ box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
571
+ }
572
+ #simulator-panel.collapsed {
573
+ width: auto;
574
+ }
575
+ #simulator-header {
576
+ display: flex;
577
+ align-items: center;
578
+ padding: 4px 8px;
579
+ background: var(--sim-bg);
580
+ border-bottom: 2px solid var(--sim-border);
581
+ gap: 0;
582
+ }
583
+ #simulator-panel.collapsed #simulator-header {
584
+ border-bottom: none;
585
+ cursor: pointer;
586
+ }
587
+ #simulator-panel.collapsed #simulator-header:hover {
588
+ background: var(--sim-bg-alt);
589
+ }
590
+ .header-sep {
591
+ color: var(--sim-border-light);
592
+ margin: 0 8px;
593
+ opacity: 0.6;
594
+ }
595
+ .header-spacer {
596
+ flex: 1;
597
+ }
598
+ #simulator-title {
599
+ color: var(--sim-accent);
600
+ text-transform: uppercase;
601
+ letter-spacing: 1px;
602
+ font-size: 10px;
603
+ font-weight: bold;
604
+ }
605
+ #simulator-header-controls {
606
+ display: flex;
607
+ gap: 2px;
608
+ }
609
+ .header-icon-btn {
610
+ width: 20px;
611
+ height: 20px;
612
+ display: flex;
613
+ align-items: center;
614
+ justify-content: center;
615
+ background: transparent;
616
+ border: none;
617
+ border-radius: 2px;
618
+ color: var(--sim-text);
619
+ cursor: pointer;
620
+ padding: 0;
621
+ }
622
+ .header-icon-btn:hover:not(:disabled) {
623
+ background: var(--sim-border);
624
+ color: var(--sim-accent);
625
+ }
626
+ .header-icon-btn:disabled {
627
+ opacity: 0.3;
628
+ cursor: not-allowed;
629
+ }
630
+ .header-icon-btn.active {
631
+ background: var(--sim-accent);
632
+ color: var(--sim-panel);
633
+ }
634
+ #simulator-header-status {
635
+ display: flex;
636
+ align-items: center;
637
+ gap: 4px;
638
+ font-size: 9px;
639
+ color: var(--sim-text-dim);
640
+ }
641
+ #simulator-header-indicator {
642
+ width: 6px;
643
+ height: 6px;
644
+ border-radius: 50%;
645
+ background: var(--sim-text-dim);
646
+ flex-shrink: 0;
647
+ }
648
+ #simulator-header-indicator.ready {
649
+ background: var(--sim-success);
650
+ box-shadow: 0 0 4px var(--sim-success);
651
+ }
652
+ #simulator-header-indicator.waiting {
653
+ background: var(--sim-warning);
654
+ box-shadow: 0 0 4px var(--sim-warning);
655
+ }
656
+ #simulator-header-indicator.paused {
657
+ background: var(--sim-error);
658
+ box-shadow: 0 0 4px var(--sim-error);
659
+ }
660
+ #simulator-header-indicator.complete {
661
+ background: transparent;
662
+ box-shadow: none;
663
+ color: var(--sim-success);
664
+ width: auto;
665
+ height: auto;
666
+ font-size: 11px;
667
+ line-height: 1;
668
+ font-weight: bold;
669
+ }
670
+ #simulator-timer {
671
+ font-size: 11px;
672
+ color: var(--sim-text);
673
+ font-family: "Menlo", monospace;
674
+ font-weight: bold;
675
+ font-variant-numeric: tabular-nums;
676
+ min-width: 38px;
677
+ }
678
+ #simulator-timer .penalty {
679
+ color: var(--sim-error);
680
+ margin-left: 2px;
681
+ }
682
+ /* Collapsed state - show minimal bar */
683
+ #simulator-panel.collapsed .header-sep,
684
+ #simulator-panel.collapsed #simulator-header-controls,
685
+ #simulator-panel.collapsed #simulator-header-status,
686
+ #simulator-panel.collapsed #simulator-header-settings,
687
+ #simulator-panel.collapsed #simulator-toggle {
688
+ display: none;
689
+ }
690
+ #simulator-panel.collapsed #simulator-title {
691
+ cursor: pointer;
692
+ }
693
+ #simulator-panel.collapsed #simulator-timer {
694
+ margin-left: 8px;
695
+ }
696
+ #simulator-body {
697
+ display: flex;
698
+ flex-direction: row;
699
+ }
700
+ #simulator-panel.collapsed #simulator-body {
701
+ display: none;
702
+ }
703
+ #simulator-tabs {
704
+ display: flex;
705
+ flex-direction: column;
706
+ background: var(--sim-bg);
707
+ padding: 4px;
708
+ gap: 2px;
709
+ border-right: 2px solid var(--sim-border);
710
+ }
711
+ .simulator-tab {
712
+ padding: 2px 3px;
713
+ background: var(--sim-bg-alt);
714
+ border: 2px solid var(--sim-border);
715
+ border-radius: 2px;
716
+ color: var(--sim-text-dim);
717
+ cursor: pointer;
718
+ font: inherit;
719
+ text-transform: uppercase;
720
+ font-size: 9px;
721
+ font-weight: bold;
722
+ letter-spacing: 0.5px;
723
+ min-height: 0;
724
+ }
725
+ .simulator-tab:hover {
726
+ color: var(--sim-text);
727
+ background: var(--sim-border);
728
+ }
729
+ .simulator-tab.active {
730
+ color: var(--sim-panel);
731
+ background: var(--sim-accent);
732
+ border-color: var(--sim-accent);
733
+ }
734
+ .simulator-tab {
735
+ position: relative;
736
+ }
737
+ .simulator-tab-badge {
738
+ position: absolute;
739
+ top: -4px;
740
+ right: -4px;
741
+ min-width: 14px;
742
+ height: 14px;
743
+ padding: 0 3px;
744
+ background: var(--sim-blue);
745
+ color: #fff;
746
+ font-size: 8px;
747
+ font-weight: bold;
748
+ border-radius: 7px;
749
+ display: flex;
750
+ align-items: center;
751
+ justify-content: center;
752
+ box-shadow: 0 1px 2px rgba(0,0,0,0.3);
753
+ line-height: 1;
754
+ text-align: center;
755
+ box-sizing: border-box;
756
+ }
757
+ .simulator-tab-badge:empty {
758
+ display: none;
759
+ }
760
+ #simulator-content {
761
+ padding: 6px;
762
+ background: var(--sim-panel);
763
+ height: 500px;
764
+ flex: 1;
765
+ overflow-y: auto;
766
+ }
767
+ #simulator-content.hidden {
768
+ display: none;
769
+ }
770
+ #simulator-content::-webkit-scrollbar {
771
+ width: 8px;
772
+ }
773
+ #simulator-content::-webkit-scrollbar-track {
774
+ background: var(--sim-bg);
775
+ }
776
+ #simulator-content::-webkit-scrollbar-thumb {
777
+ background: var(--sim-border);
778
+ border-radius: 2px;
779
+ }
780
+ .simulator-btn {
781
+ padding: 4px 8px;
782
+ background: var(--sim-bg-alt);
783
+ border: 2px solid var(--sim-border);
784
+ border-radius: 2px;
785
+ color: var(--sim-text);
786
+ font: inherit;
787
+ font-size: 10px;
788
+ font-weight: bold;
789
+ text-transform: uppercase;
790
+ letter-spacing: 1px;
791
+ cursor: pointer;
792
+ }
793
+ .simulator-btn:hover {
794
+ background: var(--sim-border);
795
+ border-color: var(--sim-border-light);
796
+ }
797
+ .simulator-btn:active {
798
+ transform: translate(1px, 1px);
799
+ }
800
+ .simulator-btn.primary {
801
+ background: var(--sim-accent);
802
+ border-color: var(--sim-accent);
803
+ color: var(--sim-panel);
804
+ }
805
+ .simulator-btn.primary:hover {
806
+ background: var(--sim-accent-hover);
807
+ border-color: var(--sim-accent-hover);
808
+ }
809
+ .simulator-btn.danger {
810
+ background: var(--sim-error);
811
+ border-color: var(--sim-error);
812
+ color: #fff;
813
+ }
814
+ .simulator-btn.danger:hover {
815
+ background: #ef4444;
816
+ border-color: #ef4444;
817
+ }
818
+ .simulator-btn:disabled {
819
+ opacity: 0.4;
820
+ cursor: not-allowed;
821
+ transform: none;
822
+ }
823
+ .simulator-btn.subtle {
824
+ background: transparent;
825
+ border-color: transparent;
826
+ color: var(--sim-text-dim);
827
+ }
828
+ .simulator-btn.subtle:hover:not(:disabled) {
829
+ background: var(--sim-bg-alt);
830
+ border-color: var(--sim-border);
831
+ color: var(--sim-text);
832
+ }
833
+ #simulator-status {
834
+ font-size: 10px;
835
+ color: var(--sim-text-dim);
836
+ padding: 4px 0 6px;
837
+ display: flex;
838
+ align-items: center;
839
+ gap: 6px;
840
+ }
841
+ #simulator-status .indicator {
842
+ width: 8px;
843
+ height: 8px;
844
+ border-radius: 2px;
845
+ background: var(--sim-text-dim);
846
+ }
847
+ #simulator-status .indicator.ready {
848
+ background: var(--sim-success);
849
+ box-shadow: 0 0 6px var(--sim-success);
850
+ }
851
+ #simulator-status .indicator.waiting {
852
+ background: var(--sim-warning);
853
+ box-shadow: 0 0 6px var(--sim-warning);
854
+ }
855
+ #simulator-status .indicator.paused {
856
+ background: var(--sim-error);
857
+ box-shadow: 0 0 6px var(--sim-error);
858
+ }
859
+ #simulator-status .indicator.complete {
860
+ background: transparent;
861
+ box-shadow: none;
862
+ color: var(--sim-success);
863
+ width: auto;
864
+ height: auto;
865
+ font-size: 12px;
866
+ line-height: 1;
867
+ font-weight: bold;
868
+ }
869
+ .simulator-row {
870
+ display: flex;
871
+ gap: 4px;
872
+ margin-top: 4px;
873
+ }
874
+ .simulator-row .simulator-btn {
875
+ flex: 1;
876
+ }
877
+ .simulator-divider {
878
+ height: 2px;
879
+ background: var(--sim-border);
880
+ margin: 8px 0;
881
+ }
882
+ .simulator-field {
883
+ margin-bottom: 6px;
884
+ }
885
+ .simulator-select {
886
+ width: 100%;
887
+ padding: 4px 6px;
888
+ background: var(--sim-bg);
889
+ border: 2px solid var(--sim-border);
890
+ border-radius: 2px;
891
+ color: var(--sim-text);
892
+ font: inherit;
893
+ font-size: 10px;
894
+ cursor: pointer;
895
+ }
896
+ .simulator-select:focus {
897
+ outline: none;
898
+ border-color: var(--sim-accent);
899
+ }
900
+ .simulator-select option {
901
+ background: var(--sim-bg);
902
+ color: var(--sim-text);
903
+ }
904
+ .simulator-fixtures {
905
+ margin-bottom: 8px;
906
+ padding-bottom: 8px;
907
+ border-bottom: 2px solid var(--sim-border);
908
+ }
909
+ .simulator-label {
910
+ display: block;
911
+ color: var(--sim-accent);
912
+ text-transform: uppercase;
913
+ font-size: 9px;
914
+ font-weight: bold;
915
+ letter-spacing: 1px;
916
+ margin-bottom: 4px;
917
+ }
918
+ .simulator-override-tag {
919
+ display: inline-block;
920
+ margin-left: 6px;
921
+ padding: 0 4px;
922
+ border-radius: 2px;
923
+ background: var(--sim-accent);
924
+ color: var(--sim-bg);
925
+ font-size: 8px;
926
+ letter-spacing: 0.5px;
927
+ }
928
+ .simulator-override-tag[hidden] {
929
+ display: none;
930
+ }
931
+ .simulator-textarea {
932
+ width: 100%;
933
+ min-height: 40px;
934
+ background: var(--sim-bg);
935
+ border: 2px solid var(--sim-border);
936
+ border-radius: 2px;
937
+ color: var(--sim-text);
938
+ font: 10px/1.4 "Menlo", monospace;
939
+ padding: 4px;
940
+ resize: none;
941
+ box-sizing: border-box;
942
+ overflow-y: auto;
943
+ }
944
+ .simulator-textarea.auto-resize {
945
+ resize: none;
946
+ overflow-y: auto;
947
+ }
948
+ .simulator-textarea:focus {
949
+ outline: none;
950
+ border-color: var(--sim-accent);
951
+ }
952
+ .simulator-input {
953
+ width: 100%;
954
+ background: var(--sim-bg);
955
+ border: 2px solid var(--sim-border);
956
+ border-radius: 2px;
957
+ color: var(--sim-text);
958
+ font: 10px/1.4 "Menlo", monospace;
959
+ padding: 4px 6px;
960
+ box-sizing: border-box;
961
+ }
962
+ .simulator-input:focus {
963
+ outline: none;
964
+ border-color: var(--sim-accent);
965
+ }
966
+ .simulator-input::placeholder {
967
+ color: var(--sim-text-dim);
968
+ }
969
+ .simulator-tab-content {
970
+ display: none;
971
+ }
972
+ .simulator-tab-content.active {
973
+ display: block;
974
+ }
975
+ .msgs-view-container {
976
+ display: flex;
977
+ flex-direction: column;
978
+ height: 100%;
979
+ overflow: hidden;
980
+ }
981
+ .msgs-header {
982
+ display: flex;
983
+ justify-content: space-between;
984
+ align-items: center;
985
+ margin-bottom: 6px;
986
+ flex-shrink: 0;
987
+ }
988
+ #simulator-msgs-log {
989
+ display: flex;
990
+ flex-direction: column;
991
+ gap: 2px;
992
+ flex: 1;
993
+ overflow-y: auto;
994
+ }
995
+ .simulator-msg {
996
+ padding: 3px 4px;
997
+ background: var(--sim-bg);
998
+ border: 1px solid var(--sim-border);
999
+ border-radius: 2px;
1000
+ font-size: 10px;
1001
+ }
1002
+ .simulator-msg.out {
1003
+ border-left: 2px solid var(--sim-accent);
1004
+ }
1005
+ .simulator-msg.in {
1006
+ border-left: 2px solid var(--sim-blue);
1007
+ }
1008
+ .simulator-msg-header {
1009
+ display: flex;
1010
+ justify-content: space-between;
1011
+ align-items: center;
1012
+ margin-bottom: 2px;
1013
+ }
1014
+ .simulator-msg-type {
1015
+ font-weight: bold;
1016
+ color: var(--sim-text);
1017
+ }
1018
+ .simulator-msg.out .simulator-msg-type {
1019
+ color: var(--sim-accent);
1020
+ }
1021
+ .simulator-msg.in .simulator-msg-type {
1022
+ color: var(--sim-blue);
1023
+ }
1024
+ .simulator-msg-time {
1025
+ color: var(--sim-text-dim);
1026
+ font-size: 9px;
1027
+ }
1028
+ .simulator-msg-data {
1029
+ color: var(--sim-text-dim);
1030
+ font-size: 9px;
1031
+ white-space: pre-wrap;
1032
+ word-break: break-all;
1033
+ max-height: 60px;
1034
+ overflow: hidden;
1035
+ cursor: pointer;
1036
+ border-radius: 2px;
1037
+ padding: 2px 4px;
1038
+ background: var(--sim-bg-alt);
1039
+ }
1040
+ .simulator-msg-data:hover {
1041
+ background: var(--sim-border);
1042
+ }
1043
+ .simulator-msg.expanded {
1044
+ flex: 1;
1045
+ display: flex;
1046
+ flex-direction: column;
1047
+ }
1048
+ .simulator-msg.expanded .simulator-msg-data {
1049
+ max-height: none;
1050
+ flex: 1;
1051
+ overflow-y: auto;
1052
+ }
1053
+ .simulator-empty {
1054
+ color: var(--sim-text-dim);
1055
+ font-size: 10px;
1056
+ text-align: center;
1057
+ padding: 20px;
1058
+ }
1059
+ .simulator-share-preview {
1060
+ margin: 0;
1061
+ padding: 8px;
1062
+ text-align: left;
1063
+ font-size: 13px;
1064
+ line-height: 1.45;
1065
+ white-space: pre-wrap;
1066
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1067
+ }
1068
+ .simulator-segmented {
1069
+ display: flex;
1070
+ gap: 2px;
1071
+ padding: 2px;
1072
+ background: var(--sim-bg);
1073
+ border: 2px solid var(--sim-border);
1074
+ border-radius: 2px;
1075
+ margin-bottom: 6px;
1076
+ }
1077
+ .simulator-segmented-btn {
1078
+ flex: 1;
1079
+ padding: 4px 8px;
1080
+ background: transparent;
1081
+ border: 0;
1082
+ border-radius: 2px;
1083
+ color: var(--sim-text-dim);
1084
+ font: inherit;
1085
+ font-size: 10px;
1086
+ font-weight: bold;
1087
+ text-transform: uppercase;
1088
+ letter-spacing: 1px;
1089
+ cursor: pointer;
1090
+ }
1091
+ .simulator-segmented-btn:hover:not(.active) {
1092
+ color: var(--sim-text);
1093
+ }
1094
+ .simulator-segmented-btn.active {
1095
+ background: var(--sim-border);
1096
+ color: var(--sim-text);
1097
+ }
1098
+ .simulator-share-missing {
1099
+ color: var(--sim-text-dim);
1100
+ font-size: 11px;
1101
+ padding: 12px;
1102
+ line-height: 1.4;
1103
+ }
1104
+ .simulator-share-missing p {
1105
+ margin: 0 0 6px;
1106
+ }
1107
+ .simulator-share-missing code {
1108
+ color: var(--sim-text);
1109
+ background: var(--sim-bg);
1110
+ padding: 1px 4px;
1111
+ border-radius: 2px;
1112
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1113
+ }
1114
+ .simulator-share-missing pre {
1115
+ margin: 6px 0 0;
1116
+ padding: 8px;
1117
+ background: var(--sim-bg);
1118
+ border: 1px solid var(--sim-border);
1119
+ border-radius: 2px;
1120
+ color: var(--sim-text);
1121
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
1122
+ font-size: 10.5px;
1123
+ line-height: 1.45;
1124
+ white-space: pre-wrap;
1125
+ overflow-x: auto;
1126
+ }
1127
+ .simulator-value {
1128
+ color: var(--sim-text);
1129
+ font-size: 10px;
1130
+ padding: 4px;
1131
+ background: var(--sim-bg);
1132
+ border: 1px solid var(--sim-border);
1133
+ border-radius: 2px;
1134
+ }
1135
+ .simulator-deeds {
1136
+ display: flex;
1137
+ flex-direction: column;
1138
+ gap: 2px;
1139
+ }
1140
+ .simulator-deed {
1141
+ display: flex;
1142
+ justify-content: space-between;
1143
+ padding: 3px 4px;
1144
+ background: var(--sim-bg);
1145
+ border: 1px solid var(--sim-border);
1146
+ border-radius: 2px;
1147
+ font-size: 10px;
1148
+ }
1149
+ .simulator-deed-name {
1150
+ color: var(--sim-text);
1151
+ }
1152
+ .simulator-deed-value {
1153
+ color: var(--sim-accent);
1154
+ font-weight: bold;
1155
+ }
1156
+ .thumb-view-container {
1157
+ display: flex;
1158
+ flex-direction: column;
1159
+ height: 100%;
1160
+ overflow: hidden;
1161
+ }
1162
+ .thumb-header {
1163
+ display: flex;
1164
+ justify-content: space-between;
1165
+ align-items: center;
1166
+ margin-bottom: 6px;
1167
+ flex-shrink: 0;
1168
+ }
1169
+ #simulator-thumb-preview {
1170
+ background: var(--sim-thumb-bg, transparent);
1171
+ border: 2px solid var(--sim-border);
1172
+ border-radius: 2px;
1173
+ padding: 8px;
1174
+ display: flex;
1175
+ align-items: center;
1176
+ justify-content: center;
1177
+ aspect-ratio: 1;
1178
+ width: 100%;
1179
+ box-sizing: border-box;
1180
+ }
1181
+ #simulator-thumb-preview svg {
1182
+ width: 100%;
1183
+ height: 100%;
1184
+ max-width: 100%;
1185
+ max-height: 100%;
1186
+ }
1187
+ #simulator-thumb-fn {
1188
+ font-size: 10px;
1189
+ color: var(--sim-text-dim);
1190
+ margin-top: 4px;
1191
+ }
1192
+ .theme-view-container {
1193
+ display: flex;
1194
+ flex-direction: column;
1195
+ height: 100%;
1196
+ overflow: hidden;
1197
+ }
1198
+ .theme-header {
1199
+ display: flex;
1200
+ justify-content: space-between;
1201
+ align-items: center;
1202
+ margin-bottom: 6px;
1203
+ flex-shrink: 0;
1204
+ }
1205
+ .simulator-themes {
1206
+ display: flex;
1207
+ flex-direction: column;
1208
+ gap: 4px;
1209
+ flex: 1;
1210
+ overflow-y: auto;
1211
+ }
1212
+ .simulator-theme-item {
1213
+ display: flex;
1214
+ align-items: center;
1215
+ gap: 8px;
1216
+ padding: 4px;
1217
+ background: var(--sim-bg);
1218
+ border: 2px solid var(--sim-border);
1219
+ border-radius: 2px;
1220
+ cursor: pointer;
1221
+ }
1222
+ .simulator-theme-item:hover {
1223
+ border-color: var(--sim-border-light);
1224
+ }
1225
+ .simulator-theme-item.selected {
1226
+ border-color: var(--sim-accent);
1227
+ background: var(--sim-bg-alt);
1228
+ }
1229
+ .simulator-theme-preview {
1230
+ width: 48px;
1231
+ height: 32px;
1232
+ display: grid;
1233
+ grid-template-columns: repeat(3, 1fr);
1234
+ grid-template-rows: repeat(2, 1fr);
1235
+ gap: 1px;
1236
+ border-radius: 2px;
1237
+ overflow: hidden;
1238
+ flex-shrink: 0;
1239
+ }
1240
+ .simulator-theme-preview-cell {
1241
+ width: 100%;
1242
+ height: 100%;
1243
+ }
1244
+ .simulator-theme-name {
1245
+ font-size: 10px;
1246
+ color: var(--sim-text);
1247
+ flex: 1;
1248
+ }
1249
+ .simulator-theme-type {
1250
+ font-size: 9px;
1251
+ color: var(--sim-text-dim);
1252
+ text-transform: uppercase;
1253
+ }
1254
+ /* Auth tab styles */
1255
+ .simulator-section {
1256
+ margin-bottom: 12px;
1257
+ }
1258
+ .simulator-section-title {
1259
+ color: var(--sim-accent);
1260
+ text-transform: uppercase;
1261
+ font-size: 10px;
1262
+ font-weight: bold;
1263
+ letter-spacing: 1px;
1264
+ margin-bottom: 6px;
1265
+ padding-bottom: 4px;
1266
+ border-bottom: 1px solid var(--sim-border);
1267
+ }
1268
+ .auth-header-row {
1269
+ display: flex;
1270
+ align-items: center;
1271
+ justify-content: space-between;
1272
+ margin-bottom: 6px;
1273
+ }
1274
+ .auth-status {
1275
+ display: flex;
1276
+ align-items: center;
1277
+ gap: 6px;
1278
+ font-size: 10px;
1279
+ color: var(--sim-text-dim);
1280
+ padding: 4px 0;
1281
+ }
1282
+ .auth-status.authenticated {
1283
+ color: var(--sim-success);
1284
+ }
1285
+ .simulator-btn.small {
1286
+ padding: 2px 6px;
1287
+ font-size: 9px;
1288
+ }
1289
+ .simulator-btn.tiny {
1290
+ padding: 3px 2px;
1291
+ font-size: 8px;
1292
+ border-width: 1px;
1293
+ line-height: 1;
1294
+ min-height: 0;
1295
+ height: auto;
1296
+ }
1297
+ .auth-title-row {
1298
+ display: flex;
1299
+ align-items: center;
1300
+ gap: 6px;
1301
+ }
1302
+ .auth-title-row > span:first-child {
1303
+ flex: 1;
1304
+ }
1305
+ .auth-title-row .simulator-btn.active {
1306
+ background: var(--sim-accent);
1307
+ color: black;
1308
+ }
1309
+ .auth-description {
1310
+ font-size: 10px;
1311
+ color: var(--sim-text-dim);
1312
+ margin: 6px 0;
1313
+ line-height: 1.4;
1314
+ }
1315
+ .auth-user-info {
1316
+ font-size: 10px;
1317
+ color: var(--sim-text-dim);
1318
+ padding: 6px;
1319
+ background: var(--sim-bg);
1320
+ border: 1px solid var(--sim-border);
1321
+ border-radius: 2px;
1322
+ margin-bottom: 8px;
1323
+ }
1324
+ .auth-user-info div {
1325
+ margin-bottom: 4px;
1326
+ }
1327
+ .auth-user-info div:last-child {
1328
+ margin-bottom: 0;
1329
+ }
1330
+ .auth-user-info code {
1331
+ color: var(--sim-text);
1332
+ background: var(--sim-bg-alt);
1333
+ padding: 1px 4px;
1334
+ border-radius: 2px;
1335
+ }
1336
+ .auth-warning {
1337
+ color: var(--sim-warning);
1338
+ font-style: italic;
1339
+ }
1340
+ .auth-error {
1341
+ margin-top: 8px;
1342
+ }
1343
+ .auth-error .error,
1344
+ .auth-api-result .error {
1345
+ color: var(--sim-error);
1346
+ font-size: 10px;
1347
+ padding: 6px;
1348
+ background: rgba(248, 113, 113, 0.1);
1349
+ border: 1px solid var(--sim-error);
1350
+ border-radius: 2px;
1351
+ }
1352
+ .auth-api-result {
1353
+ margin-top: 8px;
1354
+ }
1355
+ .auth-api-result pre {
1356
+ font-size: 9px;
1357
+ color: var(--sim-text);
1358
+ background: var(--sim-bg);
1359
+ border: 1px solid var(--sim-border);
1360
+ border-radius: 2px;
1361
+ padding: 6px;
1362
+ margin: 0;
1363
+ white-space: pre-wrap;
1364
+ word-break: break-all;
1365
+ max-height: 150px;
1366
+ overflow-y: auto;
1367
+ }
1368
+ .auth-api-result .loading {
1369
+ font-size: 10px;
1370
+ color: var(--sim-text-dim);
1371
+ padding: 6px;
1372
+ background: var(--sim-bg);
1373
+ border: 1px solid var(--sim-border);
1374
+ border-radius: 2px;
1375
+ }
1376
+ /* Data view styles */
1377
+ .data-view-container {
1378
+ display: flex;
1379
+ flex-direction: column;
1380
+ height: 100%;
1381
+ overflow: hidden;
1382
+ }
1383
+ .data-subtabs {
1384
+ display: flex;
1385
+ gap: 2px;
1386
+ margin-bottom: 8px;
1387
+ flex-shrink: 0;
1388
+ }
1389
+ .data-subtab {
1390
+ padding: 4px 10px;
1391
+ background: var(--sim-bg-alt);
1392
+ border: 1px solid var(--sim-border);
1393
+ border-radius: 2px;
1394
+ color: var(--sim-text-dim);
1395
+ cursor: pointer;
1396
+ font: inherit;
1397
+ font-size: 9px;
1398
+ font-weight: bold;
1399
+ text-transform: uppercase;
1400
+ letter-spacing: 0.5px;
1401
+ }
1402
+ .data-subtab:hover {
1403
+ color: var(--sim-text);
1404
+ background: var(--sim-border);
1405
+ }
1406
+ .data-subtab.active {
1407
+ color: var(--sim-panel);
1408
+ background: var(--sim-accent);
1409
+ border-color: var(--sim-accent);
1410
+ }
1411
+ .data-subtab-content {
1412
+ display: none;
1413
+ flex: 1;
1414
+ overflow-y: auto;
1415
+ overflow-x: hidden;
1416
+ }
1417
+ .data-subtab-content.active {
1418
+ display: flex;
1419
+ flex-direction: column;
1420
+ }
1421
+ /* History tab styles */
1422
+ .history-header {
1423
+ display: flex;
1424
+ justify-content: space-between;
1425
+ align-items: center;
1426
+ margin-bottom: 6px;
1427
+ flex-shrink: 0;
1428
+ }
1429
+ .history-list {
1430
+ display: flex;
1431
+ flex-direction: column;
1432
+ gap: 4px;
1433
+ flex: 1;
1434
+ overflow-y: auto;
1435
+ }
1436
+ .history-item {
1437
+ padding: 6px;
1438
+ background: var(--sim-bg);
1439
+ border: 1px solid var(--sim-border);
1440
+ border-radius: 2px;
1441
+ display: flex;
1442
+ flex-direction: row;
1443
+ gap: 8px;
1444
+ }
1445
+ .history-item:hover {
1446
+ border-color: var(--sim-border-light);
1447
+ }
1448
+ .history-item-thumb {
1449
+ width: 80px;
1450
+ height: 80px;
1451
+ flex-shrink: 0;
1452
+ background: var(--history-thumb-bg, var(--sim-bg-alt));
1453
+ border: 1px solid var(--sim-border);
1454
+ border-radius: 2px;
1455
+ display: flex;
1456
+ align-items: center;
1457
+ justify-content: center;
1458
+ overflow: hidden;
1459
+ }
1460
+ .history-item-thumb svg {
1461
+ width: 100%;
1462
+ height: 100%;
1463
+ }
1464
+ .history-item-thumb:empty {
1465
+ display: none;
1466
+ }
1467
+ .history-item-content {
1468
+ flex: 1;
1469
+ min-width: 0;
1470
+ display: flex;
1471
+ flex-direction: column;
1472
+ gap: 4px;
1473
+ }
1474
+ .history-item-header {
1475
+ display: flex;
1476
+ align-items: center;
1477
+ gap: 6px;
1478
+ }
1479
+ .history-item-num {
1480
+ color: var(--sim-accent);
1481
+ font-weight: bold;
1482
+ font-size: 9px;
1483
+ }
1484
+ .history-item-time {
1485
+ color: var(--sim-text-dim);
1486
+ font-size: 9px;
1487
+ flex: 1;
1488
+ }
1489
+ .history-item-preview {
1490
+ font-size: 9px;
1491
+ color: var(--sim-text);
1492
+ word-break: break-all;
1493
+ line-height: 1.3;
1494
+ background: var(--sim-bg-alt);
1495
+ padding: 3px 4px;
1496
+ border-radius: 2px;
1497
+ flex: 1;
1498
+ overflow: hidden;
1499
+ }
1500
+ /* Saves tab styles */
1501
+ .save-new {
1502
+ display: flex;
1503
+ gap: 4px;
1504
+ margin-bottom: 8px;
1505
+ flex-shrink: 0;
1506
+ }
1507
+ .save-new .simulator-input {
1508
+ flex: 1;
1509
+ }
1510
+ .saves-list {
1511
+ display: flex;
1512
+ flex-direction: column;
1513
+ gap: 4px;
1514
+ flex: 1;
1515
+ overflow-y: auto;
1516
+ }
1517
+ .save-item {
1518
+ padding: 6px;
1519
+ background: var(--sim-bg);
1520
+ border: 1px solid var(--sim-border);
1521
+ border-radius: 2px;
1522
+ }
1523
+ .save-item:hover {
1524
+ border-color: var(--sim-border-light);
1525
+ }
1526
+ .save-item-header {
1527
+ display: flex;
1528
+ justify-content: space-between;
1529
+ align-items: center;
1530
+ margin-bottom: 4px;
1531
+ }
1532
+ .save-item-name {
1533
+ color: var(--sim-text);
1534
+ font-weight: bold;
1535
+ font-size: 10px;
1536
+ }
1537
+ .save-item-time {
1538
+ color: var(--sim-text-dim);
1539
+ font-size: 9px;
1540
+ }
1541
+ .save-item-actions {
1542
+ display: flex;
1543
+ gap: 4px;
1544
+ }
1545
+ /* Features view styles */
1546
+ .features-view-container {
1547
+ display: flex;
1548
+ flex-direction: column;
1549
+ height: 100%;
1550
+ overflow: hidden;
1551
+ }
1552
+ .features-slug-input {
1553
+ display: flex;
1554
+ gap: 4px;
1555
+ margin-bottom: 8px;
1556
+ }
1557
+ .features-slug-input .simulator-input {
1558
+ flex: 1;
1559
+ }
1560
+ .features-content {
1561
+ flex: 1;
1562
+ overflow-y: auto;
1563
+ }
1564
+ .features-loading {
1565
+ color: var(--sim-text-dim);
1566
+ font-size: 10px;
1567
+ text-align: center;
1568
+ padding: 20px;
1569
+ }
1570
+ .features-error {
1571
+ color: var(--sim-error);
1572
+ font-size: 10px;
1573
+ padding: 8px;
1574
+ background: rgba(248, 113, 113, 0.1);
1575
+ border: 1px solid var(--sim-error);
1576
+ border-radius: 2px;
1577
+ }
1578
+ .features-empty {
1579
+ color: var(--sim-text-dim);
1580
+ font-size: 10px;
1581
+ text-align: center;
1582
+ padding: 20px;
1583
+ }
1584
+ .features-auth-required {
1585
+ color: var(--sim-text-dim);
1586
+ font-size: 10px;
1587
+ padding: 12px;
1588
+ background: var(--sim-bg);
1589
+ border: 1px solid var(--sim-border);
1590
+ border-radius: 2px;
1591
+ line-height: 1.5;
1592
+ }
1593
+ .features-auth-required p {
1594
+ margin: 0 0 8px 0;
1595
+ }
1596
+ .features-auth-required p:last-child {
1597
+ margin-bottom: 0;
1598
+ }
1599
+ .features-game-name {
1600
+ color: var(--sim-accent);
1601
+ font-size: 11px;
1602
+ font-weight: bold;
1603
+ margin-bottom: 8px;
1604
+ padding-bottom: 4px;
1605
+ border-bottom: 1px solid var(--sim-border);
1606
+ }
1607
+ .feature-group {
1608
+ margin-bottom: 12px;
1609
+ }
1610
+ .feature-group-title {
1611
+ color: var(--sim-text);
1612
+ font-size: 10px;
1613
+ font-weight: bold;
1614
+ text-transform: uppercase;
1615
+ letter-spacing: 0.5px;
1616
+ margin-bottom: 6px;
1617
+ padding-bottom: 2px;
1618
+ border-bottom: 1px solid var(--sim-border);
1619
+ }
1620
+ .feature-group-items {
1621
+ display: flex;
1622
+ flex-direction: column;
1623
+ gap: 2px;
1624
+ }
1625
+ .feature-item {
1626
+ display: flex;
1627
+ align-items: center;
1628
+ gap: 8px;
1629
+ padding: 4px 6px;
1630
+ background: var(--sim-bg);
1631
+ border: 1px solid var(--sim-border);
1632
+ border-radius: 2px;
1633
+ cursor: pointer;
1634
+ transition: all 0.15s ease;
1635
+ }
1636
+ .feature-item:hover {
1637
+ border-color: var(--sim-border-light);
1638
+ background: var(--sim-bg-alt);
1639
+ }
1640
+ .feature-item.updating {
1641
+ opacity: 0.5;
1642
+ pointer-events: none;
1643
+ }
1644
+ .feature-status {
1645
+ font-size: 14px;
1646
+ width: 18px;
1647
+ text-align: center;
1648
+ flex-shrink: 0;
1649
+ }
1650
+ .feature-item.enabled .feature-status {
1651
+ color: var(--sim-success);
1652
+ }
1653
+ .feature-item.disabled .feature-status {
1654
+ color: var(--sim-error);
1655
+ opacity: 0.5;
1656
+ }
1657
+ .feature-title {
1658
+ font-size: 10px;
1659
+ color: var(--sim-text);
1660
+ flex: 1;
1661
+ }
1662
+ .feature-item.disabled .feature-title {
1663
+ color: var(--sim-text-dim);
1664
+ }
1665
+ /* Checkpoints view styles */
1666
+ .checkpoints-view-container {
1667
+ display: flex;
1668
+ flex-direction: column;
1669
+ height: 100%;
1670
+ overflow: hidden;
1671
+ }
1672
+ .checkpoints-header {
1673
+ display: flex;
1674
+ justify-content: space-between;
1675
+ align-items: center;
1676
+ margin-bottom: 6px;
1677
+ flex-shrink: 0;
1678
+ }
1679
+ .checkpoints-list {
1680
+ display: flex;
1681
+ flex-direction: column;
1682
+ gap: 4px;
1683
+ flex: 1;
1684
+ overflow-y: auto;
1685
+ }
1686
+ .checkpoint-item {
1687
+ padding: 6px;
1688
+ background: var(--sim-bg);
1689
+ border: 1px solid var(--sim-border);
1690
+ border-left: 3px solid var(--sim-accent);
1691
+ border-radius: 2px;
1692
+ }
1693
+ .checkpoint-item:hover {
1694
+ border-color: var(--sim-border-light);
1695
+ border-left-color: var(--sim-accent);
1696
+ }
1697
+ .checkpoint-header {
1698
+ display: flex;
1699
+ justify-content: space-between;
1700
+ align-items: center;
1701
+ }
1702
+ .checkpoint-item .simulator-deeds {
1703
+ margin-top: 4px;
1704
+ }
1705
+ .checkpoint-name {
1706
+ color: var(--sim-accent);
1707
+ font-weight: bold;
1708
+ font-size: 10px;
1709
+ }
1710
+ .checkpoint-time {
1711
+ color: var(--sim-text-dim);
1712
+ font-size: 9px;
1713
+ }
1714
+ /* Checklist view styles */
1715
+ .checklist-view-container {
1716
+ display: flex;
1717
+ flex-direction: column;
1718
+ gap: 10px;
1719
+ overflow-y: auto;
1720
+ }
1721
+ .checklist-header {
1722
+ display: flex;
1723
+ align-items: center;
1724
+ gap: 6px;
1725
+ padding-bottom: 4px;
1726
+ margin-bottom: 4px;
1727
+ border-bottom: 1px solid var(--sim-border);
1728
+ }
1729
+ .checklist-progress {
1730
+ flex: 1;
1731
+ color: var(--sim-text-dim);
1732
+ font-size: 10px;
1733
+ }
1734
+ .checklist-progress.complete {
1735
+ color: var(--sim-success);
1736
+ }
1737
+ .checklist-items {
1738
+ display: flex;
1739
+ flex-direction: column;
1740
+ gap: 1px;
1741
+ }
1742
+ .checklist-item {
1743
+ padding: 3px 6px;
1744
+ border-left: 3px solid transparent;
1745
+ }
1746
+ .checklist-item.done {
1747
+ opacity: 0.5;
1748
+ }
1749
+ .checklist-item.upcoming {
1750
+ opacity: 0.35;
1751
+ }
1752
+ .checklist-item.active {
1753
+ border-left-color: var(--sim-accent);
1754
+ background: var(--sim-bg);
1755
+ }
1756
+ .checklist-row {
1757
+ display: flex;
1758
+ align-items: center;
1759
+ gap: 6px;
1760
+ }
1761
+ .checklist-tick {
1762
+ color: var(--sim-text-dim);
1763
+ }
1764
+ .checklist-item.done .checklist-tick {
1765
+ color: var(--sim-success);
1766
+ }
1767
+ .checklist-title {
1768
+ flex: 1;
1769
+ color: var(--sim-text);
1770
+ }
1771
+ .checklist-item.active .checklist-title {
1772
+ color: var(--sim-accent);
1773
+ font-weight: bold;
1774
+ }
1775
+ .checklist-count {
1776
+ color: var(--sim-text-dim);
1777
+ font-size: 10px;
1778
+ }
1779
+ .checklist-help {
1780
+ width: 14px;
1781
+ height: 14px;
1782
+ padding: 0;
1783
+ border: 1px solid var(--sim-border-light);
1784
+ border-radius: 50%;
1785
+ background: transparent;
1786
+ color: var(--sim-text-dim);
1787
+ font: inherit;
1788
+ font-size: 9px;
1789
+ line-height: 12px;
1790
+ cursor: pointer;
1791
+ }
1792
+ .checklist-help:hover, .checklist-help.open {
1793
+ color: var(--sim-accent);
1794
+ border-color: var(--sim-accent);
1795
+ }
1796
+ .checklist-subtitle {
1797
+ margin: 2px 0 0 15px;
1798
+ color: var(--sim-text-dim);
1799
+ font-size: 10px;
1800
+ }
1801
+ .checklist-expand {
1802
+ margin: 4px 0 0 15px;
1803
+ padding: 4px 6px;
1804
+ background: var(--sim-panel);
1805
+ border: 1px solid var(--sim-border);
1806
+ border-radius: 2px;
1807
+ color: var(--sim-text);
1808
+ font: inherit;
1809
+ font-size: 10px;
1810
+ white-space: pre-wrap;
1811
+ text-align: left;
1812
+ user-select: text;
1813
+ }
1814
+ .checklist-divider {
1815
+ display: flex;
1816
+ align-items: center;
1817
+ gap: 6px;
1818
+ margin: 3px 0;
1819
+ color: var(--sim-text-dim);
1820
+ font-size: 9px;
1821
+ }
1822
+ .checklist-divider::before, .checklist-divider::after {
1823
+ content: "";
1824
+ flex: 1;
1825
+ border-top: 1px dashed var(--sim-border-light);
1826
+ }
1827
+ .checklist-footer {
1828
+ margin-top: 4px;
1829
+ color: var(--sim-text-dim);
1830
+ font-size: 9px;
1831
+ }
1832
+ .checklist-error {
1833
+ color: var(--sim-error);
1834
+ font-size: 9px;
1835
+ }
1836
+ /* Keyboard view styles */
1837
+ .keyboard-view-container {
1838
+ padding: 4px;
1839
+ }
1840
+ .sim-kb-empty {
1841
+ color: var(--sim-text-dim);
1842
+ text-align: center;
1843
+ padding: 16px 8px;
1844
+ font-size: 10px;
1845
+ line-height: 1.6;
1846
+ }
1847
+ .sim-kb-empty code {
1848
+ background: var(--sim-bg);
1849
+ padding: 1px 4px;
1850
+ border-radius: 2px;
1851
+ font-size: 10px;
1852
+ }
1853
+ .sim-kb {
1854
+ display: flex;
1855
+ flex-direction: column;
1856
+ gap: 4px;
1857
+ }
1858
+ .sim-kb-row {
1859
+ display: flex;
1860
+ justify-content: center;
1861
+ gap: 3px;
1862
+ }
1863
+ .sim-kb-key {
1864
+ min-width: 28px;
1865
+ height: 30px;
1866
+ padding: 0 4px;
1867
+ border: 1px solid var(--sim-border);
1868
+ border-radius: 3px;
1869
+ background: var(--sim-bg);
1870
+ color: var(--sim-text);
1871
+ font: inherit;
1872
+ font-size: 11px;
1873
+ text-transform: uppercase;
1874
+ cursor: pointer;
1875
+ display: flex;
1876
+ align-items: center;
1877
+ justify-content: center;
1878
+ }
1879
+ .sim-kb-key:hover {
1880
+ background: var(--sim-bg-alt);
1881
+ border-color: var(--sim-border-light);
1882
+ }
1883
+ .sim-kb-key:active {
1884
+ background: var(--sim-accent);
1885
+ color: var(--sim-panel);
1886
+ }
1887
+ .sim-kb-key.highlight {
1888
+ background: var(--sim-bg-alt);
1889
+ border-color: var(--sim-accent);
1890
+ color: var(--sim-accent);
1891
+ font-size: 9px;
1892
+ }
1893
+ .sim-kb-key.highlight:active {
1894
+ background: var(--sim-accent);
1895
+ color: var(--sim-panel);
1896
+ }
1897
+ .sim-kb-key.l {
1898
+ min-width: 40px;
1899
+ }
1900
+ .sim-kb-key.xl {
1901
+ min-width: 52px;
1902
+ }
1903
+ .sim-kb-key.grow {
1904
+ flex: 1;
1905
+ }
1906
+ .sim-kb-key.disabled {
1907
+ opacity: 0.3;
1908
+ cursor: default;
1909
+ }
1910
+ /* Settings view styles */
1911
+ .settings-view-container {
1912
+ display: flex;
1913
+ flex-direction: column;
1914
+ height: 100%;
1915
+ overflow-y: auto;
1916
+ }
1917
+ .sim-settings-empty {
1918
+ color: var(--sim-text-dim);
1919
+ font-size: 10px;
1920
+ text-align: center;
1921
+ padding: 20px;
1922
+ line-height: 1.5;
1923
+ }
1924
+ .sim-settings-heading {
1925
+ color: var(--sim-text);
1926
+ font-size: 11px;
1927
+ font-weight: bold;
1928
+ text-transform: uppercase;
1929
+ letter-spacing: 1px;
1930
+ margin: 6px 0 4px;
1931
+ }
1932
+ .sim-settings-subheading {
1933
+ color: var(--sim-text);
1934
+ font-size: 10px;
1935
+ font-weight: bold;
1936
+ margin: 4px 0 2px;
1937
+ }
1938
+ .sim-settings-paragraph {
1939
+ color: var(--sim-text-dim);
1940
+ font-size: 10px;
1941
+ margin: 2px 0 6px;
1942
+ line-height: 1.4;
1943
+ }
1944
+ .sim-settings-subtitle {
1945
+ color: var(--sim-text-dim);
1946
+ font-size: 9px;
1947
+ margin: -2px 0 3px;
1948
+ line-height: 1.3;
1949
+ }
1950
+ .sim-settings-row {
1951
+ display: flex;
1952
+ align-items: baseline;
1953
+ gap: 6px;
1954
+ cursor: pointer;
1955
+ }
1956
+ .sim-settings-row .simulator-label {
1957
+ margin-bottom: 0;
1958
+ }
1959
+ .sim-settings-split {
1960
+ display: flex;
1961
+ gap: 8px;
1962
+ }
1963
+ .sim-settings-split > * {
1964
+ flex: 1;
1965
+ }
1966
+ .sim-settings-unsupported {
1967
+ color: var(--sim-text-dim);
1968
+ font-size: 9px;
1969
+ font-style: italic;
1970
+ margin: 4px 0;
1971
+ }
1972
+ .sim-settings-actions {
1973
+ margin-top: 8px;
1974
+ padding-top: 8px;
1975
+ border-top: 2px solid var(--sim-border);
1976
+ }
1977
+ /* Pmmg tab */
1978
+ .pmmg-view {
1979
+ display: flex;
1980
+ flex-direction: column;
1981
+ gap: 6px;
1982
+ }
1983
+ .pmmg-status {
1984
+ font-size: 10px;
1985
+ color: var(--sim-text);
1986
+ }
1987
+ .pmmg-dim {
1988
+ color: var(--sim-text-dim);
1989
+ }
1990
+ .pmmg-error {
1991
+ color: var(--sim-error);
1992
+ }
1993
+ .pmmg-view .data-subtabs {
1994
+ margin-bottom: 0;
1995
+ }
1996
+ .pmmg-pane {
1997
+ display: none;
1998
+ flex-direction: column;
1999
+ gap: 6px;
2000
+ }
2001
+ .pmmg-pane.active {
2002
+ display: flex;
2003
+ }
2004
+ .pmmg-actions {
2005
+ display: flex;
2006
+ align-items: center;
2007
+ gap: 6px;
2008
+ }
2009
+ .pmmg-actions .simulator-btn.tiny {
2010
+ padding: 4px 6px;
2011
+ }
2012
+ .pmmg-actions .simulator-input {
2013
+ flex: 1;
2014
+ }
2015
+ .pmmg-check {
2016
+ display: inline-flex;
2017
+ align-items: center;
2018
+ gap: 3px;
2019
+ font-size: 10px;
2020
+ color: var(--sim-text);
2021
+ cursor: pointer;
2022
+ white-space: nowrap;
2023
+ }
2024
+ .pmmg-check input {
2025
+ margin: 0;
2026
+ }
2027
+ .pmmg-stage {
2028
+ display: flex;
2029
+ justify-content: center;
2030
+ align-items: flex-start;
2031
+ width: 100%;
2032
+ height: 300px;
2033
+ border: 2px solid var(--sim-border);
2034
+ border-radius: 2px;
2035
+ box-sizing: border-box;
2036
+ background: var(--sim-bg);
2037
+ }
2038
+ .pmmg-stage canvas {
2039
+ display: block;
2040
+ cursor: crosshair;
2041
+ }
2042
+ .pmmg-backdrop-checker .pmmg-backdrop {
2043
+ background-color: #2a2a40;
2044
+ background-image: linear-gradient(45deg, #34344e 25%, transparent 25%), linear-gradient(-45deg, #34344e 25%, transparent 25%),
2045
+ linear-gradient(45deg, transparent 75%, #34344e 75%), linear-gradient(-45deg, transparent 75%, #34344e 75%);
2046
+ background-size: 12px 12px;
2047
+ background-position: 0 0, 0 6px, 6px -6px, -6px 0;
2048
+ }
2049
+ .pmmg-backdrop-theme .pmmg-backdrop {
2050
+ background: var(--pmmg-theme-bg, #fff);
2051
+ }
2052
+ .pmmg-backdrop-black .pmmg-backdrop {
2053
+ background: #000;
2054
+ }
2055
+ .pmmg-backdrop-white .pmmg-backdrop {
2056
+ background: #fff;
2057
+ }
2058
+ .pmmg-hover {
2059
+ min-height: 14px;
2060
+ font-size: 10px;
2061
+ color: var(--sim-text-dim);
2062
+ overflow-wrap: anywhere;
2063
+ }
2064
+ .pmmg-toggles {
2065
+ display: flex;
2066
+ flex-wrap: wrap;
2067
+ align-items: center;
2068
+ gap: 4px 8px;
2069
+ }
2070
+ .pmmg-backdrop-select {
2071
+ width: auto;
2072
+ margin-left: auto;
2073
+ padding: 2px 4px;
2074
+ }
2075
+ .pmmg-stats {
2076
+ font-size: 10px;
2077
+ color: var(--sim-text);
2078
+ }
2079
+ .pmmg-problems {
2080
+ display: flex;
2081
+ flex-direction: column;
2082
+ gap: 4px;
2083
+ }
2084
+ .pmmg-problem {
2085
+ padding: 4px 6px;
2086
+ border: 1px solid var(--sim-border);
2087
+ border-left-width: 3px;
2088
+ border-radius: 2px;
2089
+ font-size: 10px;
2090
+ overflow-wrap: anywhere;
2091
+ }
2092
+ .pmmg-problem.error {
2093
+ border-left-color: var(--sim-error);
2094
+ color: var(--sim-error);
2095
+ }
2096
+ .pmmg-problem.warn {
2097
+ border-left-color: var(--sim-warning);
2098
+ color: var(--sim-warning);
2099
+ }
2100
+ .pmmg-problem.note {
2101
+ color: var(--sim-text-dim);
2102
+ }
2103
+ .pmmg-problem details {
2104
+ margin-top: 4px;
2105
+ color: var(--sim-text-dim);
2106
+ }
2107
+ .pmmg-json {
2108
+ margin: 0;
2109
+ padding: 6px;
2110
+ background: var(--sim-bg);
2111
+ border: 1px solid var(--sim-border);
2112
+ border-radius: 2px;
2113
+ color: var(--sim-text);
2114
+ font: 10px/1.4 "Menlo", monospace;
2115
+ white-space: pre-wrap;
2116
+ overflow-wrap: anywhere;
2117
+ user-select: text;
2118
+ max-height: 360px;
2119
+ overflow: auto;
2120
+ }
2121
+ .pmmg-sprites {
2122
+ display: grid;
2123
+ grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
2124
+ gap: 4px;
2125
+ }
2126
+ .pmmg-sprite {
2127
+ display: flex;
2128
+ flex-direction: column;
2129
+ align-items: stretch;
2130
+ gap: 2px;
2131
+ padding: 4px;
2132
+ min-width: 0;
2133
+ background: var(--sim-bg);
2134
+ border: 1px solid var(--sim-border);
2135
+ border-radius: 2px;
2136
+ color: var(--sim-text);
2137
+ font: inherit;
2138
+ text-align: left;
2139
+ cursor: pointer;
2140
+ }
2141
+ .pmmg-sprite:hover {
2142
+ border-color: var(--sim-border-light);
2143
+ }
2144
+ .pmmg-sprite.selected {
2145
+ border-color: #f472b6;
2146
+ }
2147
+ .pmmg-sprite.unused {
2148
+ opacity: 0.5;
2149
+ }
2150
+ .pmmg-sprite-picture {
2151
+ display: flex;
2152
+ align-items: center;
2153
+ justify-content: center;
2154
+ height: 64px;
2155
+ }
2156
+ .pmmg-sprite-id {
2157
+ font-size: 9px;
2158
+ overflow: hidden;
2159
+ text-overflow: ellipsis;
2160
+ white-space: nowrap;
2161
+ }
2162
+ .pmmg-sprite-meta {
2163
+ font-size: 8px;
2164
+ color: var(--sim-text-dim);
2165
+ }
2166
+ .pmmg-detail {
2167
+ display: flex;
2168
+ flex-direction: column;
2169
+ gap: 6px;
2170
+ padding: 6px;
2171
+ border: 1px solid #f472b6;
2172
+ border-radius: 2px;
2173
+ }
2174
+ .pmmg-detail-head {
2175
+ display: flex;
2176
+ align-items: center;
2177
+ justify-content: space-between;
2178
+ gap: 6px;
2179
+ }
2180
+ .pmmg-detail-id {
2181
+ font-weight: bold;
2182
+ overflow-wrap: anywhere;
2183
+ user-select: text;
2184
+ }
2185
+ .pmmg-detail-picture {
2186
+ display: flex;
2187
+ justify-content: center;
2188
+ }
2189
+ .pmmg-facts {
2190
+ display: grid;
2191
+ grid-template-columns: auto 1fr;
2192
+ gap: 2px 8px;
2193
+ margin: 0;
2194
+ font-size: 10px;
2195
+ }
2196
+ .pmmg-facts dt {
2197
+ color: var(--sim-text-dim);
2198
+ }
2199
+ .pmmg-facts dd {
2200
+ margin: 0;
2201
+ overflow-wrap: anywhere;
2202
+ }
2203
+ </style>
2204
+ <div id="simulator-panel" class="${h.isCollapsed?`collapsed`:``}">
2205
+ <div id="simulator-header">
2206
+ <span id="simulator-title">PUZZMO SIMULATOR</span>
2207
+ <span class="header-sep">|</span>
2208
+ <div id="simulator-timer">--:--</div>
2209
+ <span class="header-sep">|</span>
2210
+ <div id="simulator-header-controls">
2211
+ <button id="simulator-header-pause" class="header-icon-btn" title="Pause" disabled>${g.pause}</button>
2212
+ <button id="simulator-header-retry" class="header-icon-btn" title="Retry" disabled>${g.retry}</button>
2213
+ </div>
2214
+ <span class="header-sep">|</span>
2215
+ <div id="simulator-header-status">
2216
+ <span id="simulator-header-indicator" class="waiting"></span>
2217
+ <span id="simulator-header-status-text">Waiting...</span>
2218
+ </div>
2219
+ <span class="header-spacer"></span>
2220
+ <button id="simulator-header-settings" class="header-icon-btn" title="Settings">${g.cog}</button>
2221
+ <button id="simulator-toggle" class="header-icon-btn" title="Minimize">${g.minimize}</button>
2222
+ </div>
2223
+ <div id="simulator-body">
2224
+ <div id="simulator-tabs">
2225
+ ${p.filter(e=>e.id!==`auth`).map(e=>`<button class="simulator-tab" data-tab="${e.id}">${e.label}<span class="simulator-tab-badge" data-badge="${e.id}"></span></button>`).join(``)}
2226
+ </div>
2227
+ <div id="simulator-content" class="hidden">
2228
+ ${p.map(e=>`<div id="simulator-tab-${e.id}" class="simulator-tab-content">${e.render()}</div>`).join(``)}
2229
+ </div>
2230
+ </div>
2231
+ </div>
2232
+ `,document.body.appendChild(_);let v=_.querySelector(`#simulator-panel`),y=_.querySelector(`#simulator-header`),b=_.querySelector(`#simulator-header-indicator`),x=_.querySelector(`#simulator-header-status-text`),S=_.querySelector(`#simulator-header-pause`),C=_.querySelector(`#simulator-header-retry`),w=_.querySelector(`#simulator-header-settings`),T=_.querySelector(`#simulator-toggle`),E=_.querySelector(`#simulator-timer`),D=_.querySelector(`#simulator-tabs`),k=_.querySelector(`#simulator-content`),A=e=>_.querySelector(e),N=e=>{S.innerHTML=e?g.play:g.pause,S.title=e?`Resume`:`Pause`},P=(e,t)=>{let n=A(`#simulator-status .text`),r=A(`#simulator-status .indicator`),i=t===`complete`?`✓`:``;n&&(n.textContent=e),r&&(r.className=`indicator ${t}`,r.textContent=i),b.className=t,b.textContent=i,x.textContent=e},ee=(e,t)=>{t&&t!==`0`?E.innerHTML=`${e}<span class="penalty">+${t}</span>`:E.textContent=e},F=e=>{var t;h.activeTab=e,k.classList.remove(`hidden`),M(e),D.querySelectorAll(`.simulator-tab`).forEach(t=>{t.classList.toggle(`active`,t.getAttribute(`data-tab`)===e)}),_.querySelectorAll(`.simulator-tab-content`).forEach(t=>{t.classList.toggle(`active`,t.id===`simulator-tab-${e}`)}),w.classList.toggle(`active`,e===`auth`);let n=p.find(t=>t.id===e);n==null||(t=n.onActivate)==null||t.call(n,W)},I=e=>{h.isCollapsed=e,v.classList.toggle(`collapsed`,e),j(e),e?(k.classList.add(`hidden`),D.querySelectorAll(`.simulator-tab`).forEach(e=>e.classList.remove(`active`))):F(h.activeTab)},L=()=>{f.updatePreview(W)},R=function(){var e=n.t(function*(){var e,t;if(h.appliedPuzzleOverride!==null)return h.appliedPuzzleOverride;if(h.puzzleData)return h.puzzleData;if(!l||l.size===0)throw Error(`No fixtures configured. Add puzzle fixture files (.json or .toml) to a fixtures directory and pass fixturesGlob to the simulator.`);let n=(e=h.selectedCategory)==null?u[0]:e,r=n?l.get(n):void 0;if(!r||r.size===0)throw Error(`No puzzles found in fixture category "${n}"`);let i=(t=h.selectedPuzzle)==null?r.keys().next().value:t,a=i?r.get(i):void 0;if(!a)throw Error(`Puzzle "${i}" not found in category "${n}"`);h.puzzleData=a,console.log(`Simulator: Puzzle loaded from fixtures`,{category:n,puzzle:i}),h.originalPuzzle=a;let o=A(`#simulator-puzzle`);return o&&(o.value=h.originalPuzzle),h.activeTab===`thumb`&&L(),h.puzzleData});return function(){return e.apply(this,arguments)}}(),V=te(e=>{d.addLogEntry(e,W)}),H=(e,t)=>{z(e,t,V)},re=e=>{var t;let n=(t=e.buckets)!=null&&t.length?e.buckets:u,r=n.find(e=>{var t;return!(!(l==null||(t=l.get(e))==null)&&t.size)});if(r!==void 0||!n.length)return{nonce:e.nonce,error:`No fixtures in "${r==null?``:r}" to stand in for a pool`,failed:!0};let i=n.flatMap(e=>[...l.get(e).keys()].map(t=>`fixtures/${e}/${t}`)),a=i.filter(t=>{var n;return!((n=e.exclude)!=null&&n.includes(t))}),o=a.length?a:i,s=o[Math.floor(Math.random()*o.length)],[,c,...d]=s.split(`/`);return{nonce:e.nonce,puzzle:{key:s,puzzle:l.get(c).get(d.join(`/`))}}},U=(e,t)=>{let n=_.querySelector(`[data-badge="${e}"]`);n&&(n.textContent=t&&t>0?String(t):``)},W={state:h,getElement:A,sendToGame:H,logMessage:V.log,loadPuzzle:R,updateStatus:P,updateTimer:ee,setCollapsed:I,switchTab:F,updateThumbnail:L,updateBadge:U,fixtures:l,fixtureCategories:u,gameSlug:(s=e.slug)==null?null:s};console.log(`[Simulator] Context created with gameSlug:`,W.gameSlug),p.forEach(e=>e.bind(W)),D.querySelectorAll(`.simulator-tab`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-tab`);F(t),U(t,0)})}),T.addEventListener(`click`,e=>{e.stopPropagation(),I(!0)}),S.addEventListener(`click`,e=>{e.stopPropagation(),h.isPaused?(H(`RESUME_GAME`,{}),h.isPaused=!1,N(!1),P(`Running`,`ready`)):(H(`PAUSE_GAME`,{}),h.isPaused=!0,N(!0),P(`Paused`,`paused`));let t=A(`#simulator-pause`);t&&(t.textContent=h.isPaused?`Resume`:`Pause`)}),C.addEventListener(`click`,e=>{e.stopPropagation(),H(`RETRY_PUZZLE`,{}),h.hasStarted=!1,h.isPaused=!1,N(!1),S.disabled=!0,P(`Ready to retry`,`ready`);let t=A(`#simulator-pause`),n=A(`#simulator-start`);t&&(t.disabled=!0,t.textContent=`Pause`),n&&(n.textContent=`Start`)}),w.addEventListener(`click`,e=>{e.stopPropagation(),h.isCollapsed&&I(!1),F(`auth`)}),y.addEventListener(`click`,e=>{h.isCollapsed&&e.target!==T&&I(!1)}),h.isCollapsed||F(h.activeTab);let oe=new URLSearchParams(window.location.search);(oe.has(`code`)||oe.has(`error`))&&(I(!1),F(`auth`));let se=n=>{let r=e.slug?t.t(t.t({},Sn),{},{slug:e.slug,stableSlug:e.slug}):Sn,i={additionalTimeAddedSecs:0,boardState:h.currentInputStr,combinedTimeSecs:0,completed:!1,createdAt:new Date().toISOString(),elapsedTimeSecs:0,id:`simulator-gameplay-${Date.now()}`,ownerID:`simulator-owner`,pointsAwarded:0,slug:`simulator-game`,viewerOwnsPuzzle:!0},a=n===null?void 0:{gameplay:i,puzzle:{id:`simulator-puzzle`,name:`Proto Jig Puzzle`,puzzle:n,mostRecentDaily:null}};return{userState:{gameSettings:{[r.slug]:h.gameSettings},id:`simulator-user`,ownerID:`simulator-owner`},currentUser:{id:`simulator-user`,name:`Simulator`,username:`simulator`,usernameID:`0000`,type:`User`,roles:``},game:r,session:a,viewerStorage:h.userStorage,theme:h.selectedTheme,hostContext:h.hostContext,appRuntimeContract:`1.0`}},ce=[`1.0`,`1.1`],G=function(){var r=n.t(function*(n){let r=e.session!==!1||n===`1.0`;r?e.session===!1&&console.warn("Simulator: `session: false` needs a game built on an SDK speaking runtime contract 1.1 or later"):console.log(`Simulator: Sending READY_DATA without a session`),P(r?`Loading puzzle...`:`Sending READY_DATA...`,`waiting`);try{let e=t.t(t.t({},se(r?yield R():null)),{},{appRuntimeContract:n});P(`Sending READY_DATA...`,`waiting`),H(`READY_DATA`,e),P(`Waiting for game to load...`,`waiting`)}catch(e){P(`Error: ${e}`,`paused`)}});return function(e){return r.apply(this,arguments)}}(),K=()=>{console.log(`Simulator: Game loaded, ready to start`),C.disabled=!1,p.forEach(e=>{var t;return(t=e.onMessage)==null?void 0:t.call(e,`READY_GAME_LOADED`,void 0,W)}),c&&!h.hasStarted&&setTimeout(()=>{let e=A(`#simulator-start`);e==null||e.click(),S.disabled=!1,h.hasStarted=!0,P(`Running`,`ready`)},100)};return ne((e,t)=>{var n,r;if(e===`READY`){console.log(`Simulator: Received READY from game`),G(ce.includes(t==null?void 0:t.runtimeContract)?t.runtimeContract:`1.0`);return}if(e===`READY_GAME_LOADED`){K();return}if(e===`TIMER_TICK`){if(t!=null&&t.display){let[e,n]=t.display;ee(e,n)}return}if(e===`TIMER_SYNC`)return;if(e===`SIDEBAR_UPDATE`){console.log(`Simulator: Sidebar update`,t);return}p.forEach(n=>{var r;return(r=n.onMessage)==null?void 0:r.call(n,e,t,W)});let i=(n=t==null||(r=t.input)==null?void 0:r.boardState)==null?t==null?void 0:t.boardState:n;if(e===`UPLOAD_NEW_GAME_STATE`&&i&&(h.currentInputStr=i,h.activeTab===`thumb`&&L(),console.log(`Simulator: Game state uploaded`,t)),e===`COMPLETE_REPEATABLE_RUN`&&console.log(`Simulator: Repeatable run completed`,t),e===`START_REPEATABLE_ROUND`&&console.log(`Simulator: Repeatable round started`,t),e===`RESUME_REPEATABLE_ROUND`&&console.log(`Simulator: Repeatable round resumed`,t),e===`UPDATE_TABLE_GAME_STATE`&&console.log(`Simulator: Table game state`,t),e===`REQUEST_PUZZLE`){H(`PUZZLE_DATA`,re(t));return}if(e===`UPDATE_GAME_USER_STATE`&&typeof(t==null?void 0:t.state)==`string`){var a;h.userStorage={state:t.state,stateVersion:(a=t.stateVersion)==null?1:a},console.log(`Simulator: Game user storage updated`,t)}e===`GAME_COMPLETED`&&(console.log(`Simulator: Game completed!`,t),S.disabled=!0,h.hasStarted=!1,P(`Completed!`,`complete`))},V),console.log(`Simulator initialized`),vn={updateFixtures:e=>{l=B(e),u=Array.from(l.keys()).sort(),W.fixtures=l,W.fixtureCategories=u;let t=localStorage.getItem(`simulator-fixture-category`);if(!h.selectedCategory||!u.includes(h.selectedCategory)){var n;h.selectedCategory=t&&u.includes(t)?t:(n=u[0])==null?null:n}let r=p.find(e=>e.id===`ctrl`);r==null||r.bind(W),console.log(`Simulator: Fixtures updated`,{categories:u,selectedCategory:h.selectedCategory})},sendToGame:H,loadPuzzle:R},vn}var Sn={id:`simulator-game`,slug:`proto-game`,stableSlug:`proto-game`,displayName:`Proto Game`,version:{id:`simulator-version`,label:null,featuresArr:[0],flagsArr:[0],runtime:{id:`simulator-runtime`,version:null}}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return hn}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return xn}});
2233
+ //# sourceMappingURL=createSimulator-CIE72Xs2.cjs.map