@puzzmo/sdk 1.0.63 → 1.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-350yNsax.cjs +1 -0
- package/dist/createSimulator-Ce3StrQI.cjs +1930 -0
- package/dist/createSimulator-Ce3StrQI.cjs.map +1 -0
- package/dist/{createSimulator-DqxQK61P.js → createSimulator-DUZOd1Hx.js} +1970 -453
- package/dist/createSimulator-DUZOd1Hx.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/inputs/index.cjs +1 -1
- package/dist/inputs/index.cjs.map +1 -1
- package/dist/inputs/index.js +1 -1
- package/dist/{lua-QeU9Rzet.cjs → lua-CclI-QKD.cjs} +1 -1
- package/dist/{lua-QeU9Rzet.cjs.map → lua-CclI-QKD.cjs.map} +1 -1
- package/dist/pico8/index.cjs +1 -1
- package/dist/pico8/index.js +2 -2
- package/dist/simulator/checklistProgress.d.ts +13 -2
- package/dist/simulator/checklistProgress.d.ts.map +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.js +1 -1
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.js +1 -1
- package/dist/simulator/views/ChecklistView.d.ts.map +1 -1
- package/dist/vite.cjs +5 -5
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +3 -3
- package/package.json +1 -1
- package/dist/createSimulator-CJ8LJCe4.cjs +0 -1925
- package/dist/createSimulator-CJ8LJCe4.cjs.map +0 -1
- package/dist/createSimulator-DqxQK61P.js.map +0 -1
- /package/dist/{asyncToGenerator-BotOOyB7.js → asyncToGenerator-DSd3oTwb.js} +0 -0
- /package/dist/{asyncToGenerator-DIL7svO7.cjs → asyncToGenerator-Tjg_Hpik.cjs} +0 -0
- /package/dist/{objectSpread2-BQwrzeNG.js → objectSpread2-BJrS9rM5.js} +0 -0
- /package/dist/{objectSpread2-CCAs_T0X.cjs → objectSpread2-BU9HzoRm.cjs} +0 -0
- /package/dist/{objectWithoutProperties-Bjd1IAMi.js → objectWithoutProperties-54Cbyogk.js} +0 -0
- /package/dist/{objectWithoutProperties-Ee8z5QMa.cjs → objectWithoutProperties-CL_8JSCP.cjs} +0 -0
|
@@ -0,0 +1,1930 @@
|
|
|
1
|
+
const e=require(`./chunk-350yNsax.cjs`),t=require(`./objectSpread2-BU9HzoRm.cjs`),n=require(`./asyncToGenerator-Tjg_Hpik.cjs`),r=[{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 i={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`},a=`simulator-override:`;function o(e){return`${a}${e}:${(window.location.pathname||`/`).replace(/\/index\.html$/,``).replace(/\/+$/,``)||`/`}`}function s(e){try{return localStorage.getItem(o(e))}catch(e){return null}}function c(e,t){try{return localStorage.setItem(o(e),t),!0}catch(e){return!1}}function l(e){try{localStorage.removeItem(o(e))}catch(e){}}function u(){l(`puzzle`),l(`input`)}function d(){let e=localStorage.getItem(i.hostContext);if(!e)return null;try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch(e){}return null}function f(e){localStorage.setItem(i.hostContext,JSON.stringify(e))}function p(){localStorage.removeItem(i.hostContext)}function m(){return localStorage.getItem(i.keyboardDocked)===`true`}function h(e){localStorage.setItem(i.keyboardDocked,String(e))}function g(){let e=localStorage.getItem(i.gameSettings);if(!e)return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch(e){}return{}}function _(){let e=localStorage.getItem(i.theme);if(e){let t=r.find(t=>t.name===e);if(t)return t}return r[0]}function v(e){var t;let n=localStorage.getItem(i.tab);return n&&e.includes(n)?n:(t=e[0])==null?`ctrl`:t}function y(e){let t=localStorage.getItem(i.collapsed);return t===null?e:t===`true`}function b(){let e=localStorage.getItem(i.renderHost);return e&&[`game`,`app`,`opengraph`].includes(e)?e:`game`}function x(){return localStorage.getItem(i.previewKind)===`text`?`text`:`image`}function S(){let e=localStorage.getItem(i.renderContext);if(e&&[`preview`,`share`,`completed`,`timeline`].includes(e))return e}function ee(e,t,n){var r,a,o;let c=localStorage.getItem(i.fixtureCategory),l=localStorage.getItem(i.fixturePuzzle),u=d(),f=s(`puzzle`),p=s(`input`);return{hostContext:(r=u==null?e.hostContext:u)==null?[{type:`app`,layout:`desktop`,host:null}]:r,hostContextIsOverridden:u!==null,isCollapsed:y((a=e.collapsed)==null?!0:a),isPaused:!1,hasStarted:!1,activeTab:v(n),puzzleData:f,originalPuzzle:f==null?``:f,currentInputStr:p==null?``:p,appliedPuzzleOverride:f,appliedInputOverride:p,completionData:null,selectedTheme:_(),selectedCategory:c&&t.includes(c)?c:(o=t[0])==null?null:o,selectedPuzzle:l==null?null:l,renderHost:b(),renderContext:S(),previewKind:x(),gameSettings:g(),keyboardDocked:m(),settingsComponents:null}}function C(e){localStorage.setItem(i.gameSettings,JSON.stringify(e))}function w(){localStorage.removeItem(i.gameSettings)}function te(e){localStorage.setItem(i.collapsed,String(e))}function ne(e){localStorage.setItem(i.tab,e)}function T(e){localStorage.setItem(i.theme,e)}function E(e){localStorage.setItem(i.fixtureCategory,e)}function D(e){localStorage.setItem(i.fixturePuzzle,e)}function O(){localStorage.removeItem(i.fixturePuzzle)}function k(e){e?localStorage.setItem(i.renderHost,e):localStorage.removeItem(i.renderHost)}function A(e){localStorage.setItem(i.previewKind,e)}function j(e){e?localStorage.setItem(i.renderContext,e):localStorage.removeItem(i.renderContext)}function re(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 M(e,t,n){console.log(`Simulator sending:`,e,t),n==null||n.log(e,t,`out`),window.postMessage({type:e,data:t},`*`)}function N(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 ie(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 P(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 F(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 I(e,t,n){var r,i;return!t||!n||(r=(i=e.get(t))==null?void 0:i.get(n))==null?null:r}const ae=`puzzmo-simulator-dev-only-do-not-ship`;function oe(){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=P(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=F(n,e.fixtures,e.state.selectedCategory,e.state.selectedPuzzle);let r=I(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&&E(e.state.selectedCategory),e.state.selectedPuzzle&&D(e.state.selectedPuzzle)),t.addEventListener(`change`,()=>{console.log(`Simulator: Category changed, reloading...`,t.value),u(),E(t.value),O(),window.location.reload()}),n.addEventListener(`change`,()=>{console.log(`Simulator: Puzzle changed, reloading...`,n.value),u(),D(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 L(e){var t;if(typeof e!=`string`)return e;let n=(t=R(e))==null?{width:800,height:800}:t;return{svg:e,width:n.width,height:n.height}}function R(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 z=`simulator-saved-states`;function B(){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 V(e,t){let n=B();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 L(n.fn(i,t,a)).svg}catch(e){return``}}var H=[];function U(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 se(){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`?ue(n):t===`history`?W(n):t===`saves`&&G(n)})});let i=n.getElement(`#simulator-puzzle`),a=n.getElement(`#simulator-input`),o=n.getElement(`#simulator-puzzle-reset`),s=n.getElement(`#simulator-puzzle-apply`),u=n.getElement(`#simulator-input-reset`),d=n.getElement(`#simulator-input-apply`);setTimeout(()=>{i&&n.state.originalPuzzle&&document.activeElement!==i&&(i.value=n.state.originalPuzzle,e=n.state.originalPuzzle,U(i)),a&&n.state.currentInputStr&&document.activeElement!==a&&(a.value=n.state.currentInputStr,t=n.state.currentInputStr,U(a)),de(n)},0),i==null||i.addEventListener(`input`,()=>{U(i);let t=i.value!==e;s&&(s.disabled=!t)}),a==null||a.addEventListener(`input`,()=>{U(a);let e=a.value!==t;d&&(d.disabled=!e)}),o==null||o.addEventListener(`click`,()=>{if(n.state.appliedPuzzleOverride!==null){l(`puzzle`),n.updateStatus(`Restoring fixture puzzle...`,`waiting`),window.location.reload();return}i&&(i.value=n.state.originalPuzzle,e=n.state.originalPuzzle,U(i),s&&(s.disabled=!0))}),s==null||s.addEventListener(`click`,()=>{if(i){if(!c(`puzzle`,i.value)){n.updateStatus(`Could not store puzzle — storage unavailable`,`paused`);return}l(`input`),s.disabled=!0,n.updateStatus(`Applying puzzle...`,`waiting`),window.location.reload()}}),u==null||u.addEventListener(`click`,()=>{if(n.state.appliedInputOverride!==null){l(`input`),n.updateStatus(`Clearing input...`,`waiting`),window.location.reload();return}a&&(a.value=t,U(a),d&&(d.disabled=!0))}),d==null||d.addEventListener(`click`,()=>{if(a){if(!c(`input`,a.value)){n.updateStatus(`Could not store input — storage unavailable`,`paused`);return}d.disabled=!0,n.updateStatus(`Applying input...`,`waiting`),window.location.reload()}});let f=n.getElement(`#simulator-history-clear`);f==null||f.addEventListener(`click`,()=>{H=[],W(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=ce(),t={name:p.value.trim(),puzzleStr:n.state.originalPuzzle,inputStr:n.state.currentInputStr,timestamp:Date.now()};e.push(t),localStorage.setItem(z,JSON.stringify(e)),p.value=``,G(n)}),G(n)},onActivate(n){e=n.state.originalPuzzle,t=n.state.currentInputStr,ue(n),W(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,H.length===0||H[H.length-1].value!==c){H.push({value:c,timestamp:Date.now()}),H.length>100&&(H=H.slice(-100));let e=r.getElement(`#data-subtab-history`);e!=null&&e.classList.contains(`active`)&&W(r)}o&&document.activeElement!==o&&(o.value!==c&&(o.value=c,U(o)),t=c,s&&(s.disabled=!0))}}}}function ce(){try{let e=localStorage.getItem(z);return e?JSON.parse(e):[]}catch(e){return[]}}function W(e){let t=e.getElement(`#simulator-history-list`);if(t){if(t.style.setProperty(`--history-thumb-bg`,e.state.selectedTheme.a_bg),H.length===0){t.innerHTML=`<div class="simulator-empty">No history yet</div>`;return}t.innerHTML=[...H].reverse().map((t,n)=>{let r=H.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">${V(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">${le(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=H[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,U(n)),i&&(i.disabled=!1),e.updateStatus(`Input restored — press Apply to load it`,`ready`)}})})}}function G(e){let t=e.getElement(`#simulator-saves-list`);if(!t)return;let n=ce();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">${le(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(!c(`puzzle`,r.puzzleStr)||!c(`input`,r.inputStr)){u(),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(z,JSON.stringify(i)),G(e)})})}function le(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function ue(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,U(t),r&&(r.disabled=!0)),n&&(n.value=e.state.currentInputStr,U(n),i&&(i.disabled=!0)),de(e)}function de(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 fe(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function pe(){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">${fe(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 me(){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 he(){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 ge=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=O(`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 ee=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;function C(e){return e&&y(e.length)&&ee.test(s.call(e))}function w(e){return s.call(e)===`[object ArrayBuffer]`}function te(e,t){var r=[],a=[];if(t){if(C(t)||w(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 ne(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 T(){return Object.create(null)}function E(e){var t=[];return JSON.stringify(e,function(e,n){if(n=ne(e,n),g(n)){if(t.indexOf(n)>=0)return`...`;t.push(n)}return n})}function D(e){return typeof e==`function`?e.toString().replace(/ \{[\s\S]*$/,``):m(e)?`undefined`:typeof e==`string`?e:E(e)}function O(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?D(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(D(r[c]));return new t(a)}}var k=O(`$parse`);function A(e){return e+``}var j=T();d(`+ - * / % === !== == != < > <= >= && || ?? ! = | ?`.split(` `),function(e){j[e]=!0});var re={n:`
|
|
165
|
+
`,f:`\f`,r:`\r`,t:` `,v:`\v`,"'":`'`,'"':`"`};function M(e){this.options=e||{}}M.prototype={constructor:M,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=j[t],a=j[n],o=j[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,k(`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 M(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=re[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 N(e,t){this.lexer=e,this.options=t}N.Program=`Program`,N.ExpressionStatement=`ExpressionStatement`,N.AssignmentExpression=`AssignmentExpression`,N.ConditionalExpression=`ConditionalExpression`,N.LogicalExpression=`LogicalExpression`,N.BinaryExpression=`BinaryExpression`,N.UnaryExpression=`UnaryExpression`,N.CallExpression=`CallExpression`,N.MemberExpression=`MemberExpression`,N.Identifier=`Identifier`,N.Literal=`Literal`,N.ArrayExpression=`ArrayExpression`,N.Property=`Property`,N.ObjectExpression=`ObjectExpression`,N.ThisExpression=`ThisExpression`,N.LocalsExpression=`LocalsExpression`,N.NGValueParameter=`NGValueParameter`,N.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:N.Program,body:e}},expressionStatement:function(){return{type:N.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(!oe(e))throw k(`lval`,`Trying to assign a value to a non l-value`);e={type:N.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:N.ConditionalExpression,test:e,alternate:t,consequent:n}):e},nullishCoalescing:function(){for(var e=this.logicalOR();this.expect(`??`);)e={type:N.LogicalExpression,operator:`??`,left:e,right:this.logicalOR()};return e},logicalOR:function(){for(var e=this.logicalAND();this.expect(`||`);)e={type:N.LogicalExpression,operator:`||`,left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect(`&&`);)e={type:N.LogicalExpression,operator:`&&`,left:e,right:this.equality()};return e},equality:function(){for(var e=this.relational(),t;t=this.expect(`==`,`!=`,`===`,`!==`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.relational()};return e},relational:function(){for(var e=this.additive(),t;t=this.expect(`<`,`>`,`<=`,`>=`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.additive()};return e},additive:function(){for(var e=this.multiplicative(),t;t=this.expect(`+`,`-`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.multiplicative()};return e},multiplicative:function(){for(var e=this.unary(),t;t=this.expect(`*`,`/`,`%`);)e={type:N.BinaryExpression,operator:t.text,left:e,right:this.unary()};return e},unary:function(){var e;return(e=this.expect(`+`,`-`,`!`))?{type:N.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=te(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:N.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:N.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(`)`)):t.text===`[`?(e={type:N.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume(`]`)):t.text===`.`?e={type:N.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError(`IMPOSSIBLE`);return e},filter:function(e){for(var t=[e],n={type:N.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:N.Identifier,name:e.text}},constant:function(){return{type:N.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:N.ArrayExpression,elements:e}},object:function(){var e=[],t;if(this.peekToken().text!==`}`)do{if(this.peek(`}`))break;t={type:N.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:N.ObjectExpression,properties:e}},throwError:function(e,t){throw k(`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 k(`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 k(`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 ie(e,t){return e===void 0?t:e}function P(e,t){return e===void 0?t:t===void 0?e:e+t}function F(e,t){var n=e(t);if(!n)throw Error(`Filter '`+t+`' is not defined`);return!n.$stateful}function I(e,t){var n,r,i;switch(e.type){case N.Program:n=!0,d(e.body,function(e){I(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case N.Literal:e.constant=!0,e.toWatch=[];break;case N.UnaryExpression:I(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case N.BinaryExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case N.LogicalExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case N.ConditionalExpression:I(e.test,t),I(e.alternate,t),I(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case N.Identifier:e.constant=!1,e.toWatch=[e];break;case N.MemberExpression:I(e.object,t),e.computed&&I(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case N.CallExpression:i=e.filter?F(t,e.callee.name):!1,n=i,r=[],d(e.arguments,function(e){I(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=i?r:[e];break;case N.AssignmentExpression:I(e.left,t),I(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case N.ArrayExpression:n=!0,r=[],d(e.elements,function(e){I(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=r;break;case N.ObjectExpression:n=!0,r=[],d(e.properties,function(e){I(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 N.ThisExpression:e.constant=!1,e.toWatch=[];break;case N.LocalsExpression:e.constant=!1,e.toWatch=[];break}}function ae(e){if(e.length===1){var t=e[0].expression,n=t.toWatch;return n.length===1&&n[0]===t?void 0:n}}function oe(e){return e.type===N.Identifier||e.type===N.MemberExpression}function L(e){if(e.body.length===1&&oe(e.body[0].expression))return{type:N.AssignmentExpression,left:e.body[0].expression,right:{type:N.NGValueParameter},operator:`=`}}function R(e){return e.body.length===0||e.body.length===1&&(e.body[0].expression.type===N.Literal||e.body[0].expression.type===N.ArrayExpression||e.body[0].expression.type===N.ObjectExpression)}function z(e){return e.constant}function B(e,t){this.astBuilder=e,this.$filter=t}B.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:[]},I(n,t.$filter);var r=``,i;if(this.stage=`assign`,i=L(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=ae(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,A,ie,P),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=R(n),u.constant=z(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 N.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 N.Literal:u=this.escape(e.value),this.assign(t,u),r(t||u);break;case N.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 N.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 N.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 N.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 N.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 N.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===N.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!==N.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 N.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 N.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 N.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 N.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===N.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===N.Identifier?t.key.name:``+t.key.value)+`:`+e)})}),u=`{`+l.join(`,`)+`}`,this.assign(t,u)),r(t||u);break;case N.ThisExpression:this.assign(t,`s`),r(t||`s`);break;case N.LocalsExpression:this.assign(t,`l`),r(t||`l`);break;case N.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 k(`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 V(e,t){this.astBuilder=e,this.$filter=t}V.prototype={compile:function(e){var t=this,n=this.astBuilder.ast(e);I(n,t.$filter);var r,i;(r=L(n))&&(i=this.recurse(r));var o=ae(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=R(n),u.constant=z(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 N.Literal:return this.value(e.value,t);case N.UnaryExpression:return i=this.recurse(e.argument),this[`unary`+e.operator](i,t);case N.BinaryExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case N.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this[`binary`+e.operator](r,i,t);case N.ConditionalExpression:return this[`ternary?:`](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case N.Identifier:return a.identifier(e.name,t,n);case N.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 N.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 N.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 N.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 N.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===N.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 N.ThisExpression:return function(e){return t?{value:e}:e};case N.LocalsExpression:return function(e,n){return t?{value:n}:n};case N.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=P(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=A(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 H=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 N(e,n),this.ast.selfReferential={$locals:{type:N.LocalsExpression}},n.handleThis&&(this.ast.selfReferential.this={type:N.ThisExpression}),this.astCompiler=n.csp?new V(this.ast,t):new B(this.ast,t)};H.prototype={constructor:H,parse:function(e){return this.astCompiler.compile(e)}},e.Lexer=M,e.Parser=H})),_e=e.t((e=>{var t=ge(),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 ve=(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}},ye=e=>{let t={};for(let n of e)n.value!==void 0&&(t[Se(n.id)]=n.value);return t},be=(e,t)=>{try{if(e.filterExp&&!(0,_e.compile)(e.filterExp)(t)||!e.incrementExp)return{complete:!1,value:0};let n=(0,_e.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}}},xe=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=be(t[i],n),!(!a.complete||r===`checkpoint`&&!t[i].liveUpdate));i++);return{index:i,head:i<t.length?a:void 0}};var Se=e=>e.replace(/-./g,e=>e[1].toUpperCase());function Ce(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="${K(f)}">
|
|
170
|
+
<div class="checklist-row">
|
|
171
|
+
<span class="checklist-tick">${o===`done`?`■`:`□`}</span>
|
|
172
|
+
<span class="checklist-title">${K((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="${K(s)}">?</button>`:``}
|
|
175
|
+
</div>
|
|
176
|
+
${o===`active`&&t.subtitle?`<div class="checklist-subtitle">${K(t.subtitle)}</div>`:``}
|
|
177
|
+
${l&&c?`<pre class="checklist-expand">${K(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="${K(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: ${K(a)}</div>`:``}
|
|
189
|
+
${f?`<div class="checklist-error">${K(f)}</div>`:``}
|
|
190
|
+
${o.map(e=>`<div class="checklist-error">${K(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=ve(r,s),f=ye(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=xe({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 K=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`);function we(){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 Te(){let e=globalThis.getShareString;return typeof e==`function`?e:null}function Ee(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function De(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Oe(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ke=`
|
|
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
|
+
) => ({ str: \`\${title}: ...\` })</pre>
|
|
203
|
+
</div>
|
|
204
|
+
`;function Ae(){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,A(n),c(),s(),e.updateThumbnail())})}),n&&(e.state.renderHost||(e.state.renderHost=`game`,k(e.state.renderHost)),n.value=e.state.renderHost||`game`,n.addEventListener(`change`,()=>{e.state.renderHost=n.value,k(e.state.renderHost),s(),e.updateThumbnail()})),r&&(e.state.renderContext||(e.state.renderContext=`preview`,j(e.state.renderContext)),r.value=e.state.renderContext||`preview`,r.addEventListener(`change`,()=>{e.state.renderContext=r.value,j(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=Te();if(!s){t&&(t.innerHTML=ke),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,Oe(n),{puzzleString:(a=e.state.puzzleData)==null?``:a,dateKey:De(),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}">${Ee(l)}</pre>`)}catch(e){console.error(`Simulator: Share string error`,e),t&&(t.innerHTML=`<span class="simulator-empty">Error: ${e}</span>`)}return}let s=we();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}=L(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>`)}}}}function je(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 Me(){return{id:`theme`,label:`Theme`,render(){return`
|
|
238
|
+
<div class="theme-view-container">
|
|
239
|
+
<div class="theme-header">
|
|
240
|
+
<span class="simulator-label">Select Theme</span>
|
|
241
|
+
</div>
|
|
242
|
+
<div id="simulator-themes" class="simulator-themes"></div>
|
|
243
|
+
</div>
|
|
244
|
+
`},bind(e){let t=e.getElement(`#simulator-themes`);t&&r.forEach(n=>{let r=document.createElement(`div`);r.className=`simulator-theme-item${n.name===e.state.selectedTheme.name?` selected`:``}`,r.innerHTML=`
|
|
245
|
+
${je(n)}
|
|
246
|
+
<div class="simulator-theme-name">${n.name}</div>
|
|
247
|
+
<div class="simulator-theme-type">${n.type}</div>
|
|
248
|
+
`,r.addEventListener(`click`,()=>{console.log(`Simulator: Theme changed, reloading...`,n.name),T(n.name),window.location.reload()}),t.appendChild(r)})}}}var Ne=[{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 Pe(e=[]){let t=[...Ne,...e];return{id:`host`,label:`Host`,render(){return`
|
|
249
|
+
<style>
|
|
250
|
+
#simulator-tab-host .host-note { opacity: 0.5; font-size: 10px; margin: 4px 0 8px; }
|
|
251
|
+
#simulator-tab-host .host-error { color: #f66; font-size: 11px; margin-top: 6px; white-space: pre-wrap; }
|
|
252
|
+
#simulator-tab-host .host-actions { display: flex; gap: 6px; margin-top: 8px; }
|
|
253
|
+
#simulator-tab-host .simulator-textarea { min-height: 140px; font-family: monospace; }
|
|
254
|
+
</style>
|
|
255
|
+
<div class="simulator-section">
|
|
256
|
+
<div class="simulator-section-title">Host Context</div>
|
|
257
|
+
<div class="host-note" id="host-source"></div>
|
|
258
|
+
<select class="simulator-select" id="host-presets">
|
|
259
|
+
<option value="">Preset…</option>
|
|
260
|
+
${t.map((e,t)=>`<option value="${t}">${Fe(e.name)}</option>`).join(``)}
|
|
261
|
+
</select>
|
|
262
|
+
<textarea class="simulator-textarea" id="host-json" spellcheck="false"></textarea>
|
|
263
|
+
<div class="host-actions">
|
|
264
|
+
<button class="simulator-btn primary" id="host-apply">Apply & Restart</button>
|
|
265
|
+
<button class="simulator-btn subtle" id="host-reset">Reset</button>
|
|
266
|
+
</div>
|
|
267
|
+
<div class="host-error" id="host-error"></div>
|
|
268
|
+
</div>
|
|
269
|
+
`},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),f(e),window.location.reload()}),(r=e.getElement(`#host-reset`))==null||r.addEventListener(`click`,()=>{p(),window.location.reload()}))}}}function Fe(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}var Ie=`puzzmo_sim_api_mode`,Le=`http://localhost:8911`,Re=`https://api.puzzmo.com`,q=()=>localStorage.getItem(Ie)===`dev`?`dev`:`prod`,ze=e=>{localStorage.setItem(Ie,e)},J=null,Be=function(){var e=n.t(function*(){if(J!==null)return J;try{let e=new AbortController,t=setTimeout(()=>e.abort(),1e3),n=yield fetch(`${Le}/healthz`,{signal:e.signal});return clearTimeout(t),J=n.ok,J}catch(e){return J=!1,!1}});return function(){return e.apply(this,arguments)}}(),Ve=()=>({apiURL:q()===`dev`?Le:Re,clientID:`protosdk:oauthclient`,redirectUri:`${window.location.origin}/oauth/callback`}),He=()=>{let e=new Uint8Array(32);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)},Ue=`puzzmo_sim_oauth_token`,We=`puzzmo_sim_oauth_refresh_token`,Ge=e=>localStorage.setItem(Ue,e),Ke=e=>localStorage.setItem(We,e),qe=()=>{let e=localStorage.getItem(Ue);return e&&`${e.substring(0,20)}`,e},Je=()=>localStorage.getItem(We),Ye=()=>{localStorage.removeItem(Ue),localStorage.removeItem(We)},Xe=()=>{let e=Ve(),t=He();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()},Ze=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}},Qe=function(){var e=n.t(function*(){let e=Je();if(!e)return!1;let t=Ve();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;Ge(a);let o=i.refresh_token||i.refreshToken;return o&&Ke(o),!0}catch(e){return!1}});return function(){return e.apply(this,arguments)}}(),$e=function(){var e=n.t(function*(e,t){let n=Ve(),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=Ve(),r=qe();if(!r)throw Error(`Not authenticated`);if(Ze(r))if(yield Qe()){if(r=qe(),!r)throw Error(`Token refresh succeeded but no token available`)}else throw Ye(),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)}}(),tt=e=>{try{let t=e.split(`.`);return t.length,t.length===3?JSON.parse(atob(t[1])):null}catch(e){return null}};function nt(){let e=!1;return{id:`auth`,label:`Auth`,render(){let e=qe(),t=!!e,n=q(),r=n===`dev`?Le:Re,i=`<button class="simulator-btn tiny" id="auth-dev-toggle" style="display: none;">${n===`dev`?`Using Dev`:`Dev`}</button>`;if(t){let t=tt(e),n=t!=null&&t.exp?new Date(t.exp*1e3).toLocaleString():`Unknown`,a=!!Je(),o=a?tt(Je()):null,s=o!=null&&o.exp?new Date(o.exp*1e3).toLocaleString():null;return`
|
|
270
|
+
<div class="simulator-section">
|
|
271
|
+
<div class="simulator-section-title auth-title-row">
|
|
272
|
+
<span>Puzzmo Authentication</span>
|
|
273
|
+
${i}
|
|
274
|
+
<button class="simulator-btn danger tiny" id="auth-logout">Logout</button>
|
|
275
|
+
</div>
|
|
276
|
+
<div id="auth-status" class="auth-status authenticated">
|
|
277
|
+
<span class="indicator ready"></span>
|
|
278
|
+
<span>Authenticated</span>
|
|
279
|
+
</div>
|
|
280
|
+
<div id="auth-user-info" class="auth-user-info">
|
|
281
|
+
<div>User ID: <code>${(t==null?void 0:t.userID)||(t==null?void 0:t.sub)||`Unknown`}</code></div>
|
|
282
|
+
<div>API: <code>${r}</code></div>
|
|
283
|
+
<div>Access expires: <code>${n}</code></div>
|
|
284
|
+
${a?`<div>Refresh expires: <code>${s||`Unknown`}</code></div>`:`<div class="auth-warning">No refresh token</div>`}
|
|
285
|
+
</div>
|
|
286
|
+
${a?`<button class="simulator-btn secondary tiny" id="auth-refresh">Refresh Now</button>`:``}
|
|
287
|
+
</div>
|
|
288
|
+
<div class="simulator-section">
|
|
289
|
+
<div class="simulator-section-title">Test API Request</div>
|
|
290
|
+
<div class="simulator-row">
|
|
291
|
+
<button class="simulator-btn primary" id="auth-test-api">Fetch Current User</button>
|
|
292
|
+
</div>
|
|
293
|
+
<div id="auth-api-result" class="auth-api-result"></div>
|
|
294
|
+
</div>
|
|
295
|
+
`}return`
|
|
296
|
+
<div class="simulator-section">
|
|
297
|
+
<div class="simulator-section-title auth-title-row">
|
|
298
|
+
<span>Puzzmo Authentication</span>
|
|
299
|
+
${i}
|
|
300
|
+
</div>
|
|
301
|
+
<div id="auth-status" class="auth-status">
|
|
302
|
+
<span class="indicator waiting"></span>
|
|
303
|
+
<span>Not authenticated</span>
|
|
304
|
+
</div>
|
|
305
|
+
<p class="auth-description">
|
|
306
|
+
Login with your Puzzmo account to make authenticated API requests.
|
|
307
|
+
${n===`dev`?`<br><strong>Using local dev server:</strong> ${Le}`:``}
|
|
308
|
+
</p>
|
|
309
|
+
<div class="simulator-row">
|
|
310
|
+
<button class="simulator-btn primary" id="auth-login">Login with Puzzmo</button>
|
|
311
|
+
</div>
|
|
312
|
+
<div id="auth-error" class="auth-error"></div>
|
|
313
|
+
</div>
|
|
314
|
+
`},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?J&&c&&(c.style.display=``,q()===`dev`&&c.classList.add(`active`)):(e=!0,Be().then(e=>{e&&c&&(c.style.display=``,q()===`dev`&&c.classList.add(`active`))})),c==null||c.addEventListener(`click`,()=>{ze(q()===`dev`?`prod`:`dev`),Ye(),window.location.reload()}),r==null||r.addEventListener(`click`,()=>{Xe()}),i==null||i.addEventListener(`click`,()=>{Ye(),window.location.reload()}),a==null||a.addEventListener(`click`,n.t(function*(){a.disabled=!0,a.textContent=`Refreshing...`,(yield Qe())?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(`
|
|
315
|
+
query {
|
|
316
|
+
currentUser {
|
|
317
|
+
id
|
|
318
|
+
username
|
|
319
|
+
usernameID
|
|
320
|
+
name
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
`);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 $e(n,r);if(window.history.replaceState({},``,window.location.pathname),i){let e=i.access_token||i.accessToken;if(e){Ge(e);let t=i.refresh_token||i.refreshToken;t&&Ke(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 rt=`puzzmo_sim_api_mode`,it=`http://localhost:8911`,at=`https://api.puzzmo.com`,ot=`puzzmo_sim_oauth_token`,st=`puzzmo_sim_oauth_refresh_token`,ct=()=>localStorage.getItem(rt)===`dev`?`dev`:`prod`,lt=()=>localStorage.getItem(ot),ut=()=>localStorage.getItem(st),dt=e=>localStorage.setItem(ot,e),ft=e=>localStorage.setItem(st,e),pt=()=>{localStorage.removeItem(ot),localStorage.removeItem(st)},mt=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}},ht=function(){var e=n.t(function*(){let e=ut();if(!e)return!1;let t=ct()===`dev`?it:at;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;dt(a);let o=i.refresh_token||i.refreshToken;return o&&ft(o),!0}catch(e){return!1}});return function(){return e.apply(this,arguments)}}(),gt=function(){var e=n.t(function*(e,t={}){let n=ct()===`dev`?it:at,r=lt();if(!r)throw Error(`Not authenticated`);if(mt(r))if(yield ht()){if(r=lt(),!r)throw Error(`Token refresh succeeded but no token available`)}else throw pt(),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)}}(),_t=`
|
|
324
|
+
query GameFeaturesQuery($slug: ID!) {
|
|
325
|
+
game(id: $slug) {
|
|
326
|
+
id
|
|
327
|
+
slug
|
|
328
|
+
displayName
|
|
329
|
+
featuresArr
|
|
330
|
+
gameFeatures {
|
|
331
|
+
slug
|
|
332
|
+
title
|
|
333
|
+
features {
|
|
334
|
+
featureID
|
|
335
|
+
title
|
|
336
|
+
isEnabled
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
`,vt=`
|
|
342
|
+
mutation ToggleFeatureMutation($gameSlug: ID!, $input: UpdateGameInput!) {
|
|
343
|
+
updateGame(id: $gameSlug, input: $input) {
|
|
344
|
+
id
|
|
345
|
+
featuresArr
|
|
346
|
+
gameFeatures {
|
|
347
|
+
slug
|
|
348
|
+
title
|
|
349
|
+
features {
|
|
350
|
+
featureID
|
|
351
|
+
title
|
|
352
|
+
isEnabled
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
`,yt=(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 bt=()=>!!lt();function xt(){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 gt(_t,{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=yt(e.featuresArr,n);try{var i;let n=yield gt(vt,{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`
|
|
358
|
+
<div class="feature-item ${t}" data-feature-id="${e.featureID}">
|
|
359
|
+
<span class="feature-status">${n}</span>
|
|
360
|
+
<span class="feature-title">${e.title}</span>
|
|
361
|
+
</div>
|
|
362
|
+
`}).join(``);return`
|
|
363
|
+
<div class="feature-group">
|
|
364
|
+
<div class="feature-group-title">${e.title}</div>
|
|
365
|
+
<div class="feature-group-items">${t}</div>
|
|
366
|
+
</div>
|
|
367
|
+
`}).join(``);return`
|
|
368
|
+
<div class="features-game-name">${e.displayName}</div>
|
|
369
|
+
${t}
|
|
370
|
+
`};return{id:`features`,label:`Features`,render(){return bt()?`
|
|
371
|
+
<div class="features-view-container">
|
|
372
|
+
<div class="simulator-section">
|
|
373
|
+
<div class="simulator-section-title">Game Features</div>
|
|
374
|
+
<div class="features-slug-input">
|
|
375
|
+
<input type="text" class="simulator-input" id="features-game-slug" placeholder="Game slug (e.g. crossword)" />
|
|
376
|
+
<button class="simulator-btn primary" id="features-load-btn">Load</button>
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
<div class="simulator-divider"></div>
|
|
380
|
+
<div id="features-content" class="features-content">
|
|
381
|
+
${s()}
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
`:`
|
|
385
|
+
<div class="features-view-container">
|
|
386
|
+
<div class="simulator-section">
|
|
387
|
+
<div class="simulator-section-title">Game Features</div>
|
|
388
|
+
<div class="features-auth-required">
|
|
389
|
+
<p>You must be logged in to view and edit game features.</p>
|
|
390
|
+
<p>Go to the <strong>Auth</strong> tab to log in with your Puzzmo account.</p>
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
`},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,bt()&&!e&&d(t.gameSlug)),u()},onActivate(e){let t=e.getElement(`#simulator-tab-features`);t&&(t.innerHTML=this.render(),this.bind(e))}}}var St=200,Ct=24;const Y=St+Ct;var wt=6,Tt=2.5,Et=100,Dt=(e,t)=>e?`14.7%`:t?`17.85%`:`9.75%`,X=(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})`},Ot=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`),kt=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);function At(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=`
|
|
395
|
+
html.sim-kbd-docked #simulator {
|
|
396
|
+
bottom: ${Y+4}px;
|
|
397
|
+
}
|
|
398
|
+
`;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% - ${Y}px)`,e.style.maxHeight=`calc(100% - ${Y}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 ${X(t.fg,.25)}`:a?`2px solid ${X(t.fg,.75)}`:`1px solid ${X(t.fg,.4)}`}`,Z((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:${X(t.fg,n.disabled.includes(e)?.3:.65)}`,n.highlight.includes(e)?``:Z(n.keyStyles),Z((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:${Dt(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="${Ot(e)}" style="${s}">
|
|
399
|
+
<div class="sim-docked-kbd-key-inner" style="${c}"><div style="${l}">${kt(i)}</div></div>
|
|
400
|
+
</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:${X(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},ee=e=>{y=S(e),a==null||a.setPointerCapture(e.pointerId)},C=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,_>=wt&&Date.now()-v>=Et&&(m=!0,b(!0))),m&&g&&(h=[h[0]+(e.clientX-g.clientX)*Tt,h[1]+(e.clientY-g.clientY)*Tt]),g={clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId},m&&n(`KEYBOARD_CURSOR_CHANGE`,{position:h}))},w=e=>{m?n(`KEYBOARD_CURSOR_END`,{}):y&&S(e)===y&&n(`KEYBOARD_KEY_PRESS`,{key:y}),x()},te=()=>{a||!i||(a=document.createElement(`div`),a.id=`sim-docked-kbd`,a.style.cssText=[`position:fixed`,`left:0`,`right:0`,`bottom:0`,`height:${Y}px`,`box-sizing:border-box`,`padding-top:8px`,`padding-bottom:${Ct}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 ${X(t.fg,.2)}`].join(`;`),a.innerHTML=p(i),a.addEventListener(`pointerdown`,ee),a.addEventListener(`pointermove`,C),a.addEventListener(`pointerup`,w),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())},ne=()=>{a&&(a.remove(),a=null,document.documentElement.classList.remove(`sim-kbd-docked`),c==null||c(),x())},T=()=>{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))})},E=()=>{if(!r||!i)return ne();if(!a)return te();a.innerHTML=p(i),b(m)};return{setEnabled(e){r=e,E()},setConfig(e){let t=a&&e&&i&&jt(e)===jt(i);i=e,t?T():E()}}}var jt=e=>JSON.stringify([e.layout,e.symbols,e.highlight,e.disabled,e.xl,e.l,e.flexGrowSymbols,e.rowPositioning,e.keyStyles]);const Z=e=>Object.entries(e==null?{}:e).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${Ot(String(t))}`).join(`;`);var Mt=(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=Z((i=t.individualKeyStyles)==null||(i=i[e])==null?void 0:i.background),m=Z((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>`},Nt=e=>`<div class="sim-kb">${e.layout.filter(e=>e!=null).map(t=>`<div class="sim-kb-row">${[...t].map(t=>Mt(t,e)).join(``)}</div>`).join(``)}</div>`;function Pt(){let e=null,t=null,n=t=>e?t?`<div class="sim-kb-empty">Shown under the game at production size, taking ${Y}px off the bottom.<br>Uncheck to preview the layout here instead.</div>`:Nt(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`
|
|
401
|
+
<div class="keyboard-view-container">
|
|
402
|
+
<div class="simulator-field">
|
|
403
|
+
<label class="sim-settings-row">
|
|
404
|
+
<input type="checkbox" id="sim-kb-dock" />
|
|
405
|
+
<span class="simulator-label">Show keyboard under game</span>
|
|
406
|
+
</label>
|
|
407
|
+
</div>
|
|
408
|
+
<div id="sim-kb-content">
|
|
409
|
+
${n(!1)}
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
`},bind(e){t!=null||(t=At({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,h(n.checked),t==null||t.setEnabled(n.checked),r(e)})),Ft(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),Ft(e))}}function Ft(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 It(){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=>Lt(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=>{C(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;w(),e.state.gameSettings=zt((t=e.state.settingsComponents)==null?[]:t),r(e),n(e)}))};return{id:`settings`,label:`Set`,render(){return`
|
|
413
|
+
<div class="settings-view-container">
|
|
414
|
+
<div id="sim-settings-content"></div>
|
|
415
|
+
</div>
|
|
416
|
+
`},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),C(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),C(i.state.gameSettings),n(i))}}}function Lt(e,t){switch(e.type){case`title`:return`<div class="sim-settings-heading">${Q(e.value)}</div>`;case`subtitle`:return`<div class="sim-settings-subheading">${Q(e.value)}</div>`;case`paragraph`:return`<p class="sim-settings-paragraph">${Q(e.value)}</p>`;case`separator`:return`<div class="simulator-divider"></div>`;case`split`:return`<div class="sim-settings-split">${e.content.map(e=>Lt(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">${Q(e.subtitle)}</div>`:``;return`
|
|
417
|
+
<div class="simulator-field">
|
|
418
|
+
<label class="sim-settings-row">
|
|
419
|
+
<input type="checkbox" data-setting="${e.name}" ${r} />
|
|
420
|
+
<span class="simulator-label">${Q(e.title)}</span>
|
|
421
|
+
</label>
|
|
422
|
+
${i}
|
|
423
|
+
</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="${Q(t)}" ${t===n?`selected`:``}>${Q((i=e.displays[r])==null?t:i)}</option>`}).join(``);return`
|
|
424
|
+
<div class="simulator-field">
|
|
425
|
+
${Rt(e)}
|
|
426
|
+
<select class="simulator-select" data-setting="${e.name}">${i}</select>
|
|
427
|
+
</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`
|
|
428
|
+
<label class="sim-settings-row">
|
|
429
|
+
<input type="checkbox" data-setting="${e.name}" data-setting-type="multiselect" data-multiselect="${e.name}" value="${Q(t)}" ${r.includes(t)?`checked`:``} />
|
|
430
|
+
<span class="simulator-label">${Q((i=e.displays[n])==null?t:i)}</span>
|
|
431
|
+
</label>`}).join(``);return`
|
|
432
|
+
<div class="simulator-field">
|
|
433
|
+
${Rt(e)}
|
|
434
|
+
${a}
|
|
435
|
+
</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`
|
|
436
|
+
<div class="simulator-field">
|
|
437
|
+
${Rt(e)}
|
|
438
|
+
<select class="simulator-select" data-setting="${e.name}" data-setting-type="number">${r}</select>
|
|
439
|
+
</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}">${Q(n)}</textarea>`:`<input class="simulator-input" type="text" data-setting="${e.name}" value="${Q(n)}" />`;return`
|
|
440
|
+
<div class="simulator-field">
|
|
441
|
+
${Rt(e)}
|
|
442
|
+
${r}
|
|
443
|
+
</div>`}default:return`<div class="sim-settings-unsupported">Unsupported component type: ${Q(e.type)}</div>`}}function Rt(e){let t=e.subtitle?`<div class="sim-settings-subtitle">${Q(e.subtitle)}</div>`:``;return`<span class="simulator-label">${Q(e.title)}</span>${t}`}function zt(e){let t={};for(let n of e)n.type===`split`?Object.assign(t,zt(n.content)):`name`in n&&(t[n.name]=n.defaultValue);return t}function Q(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function Bt(){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">${Ht(e.id)}</span>${e.haptic?`<span class="sound-haptic">${Ht(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`
|
|
444
|
+
<style>
|
|
445
|
+
#simulator-tab-sound .sound-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-family: monospace; font-size: 11px; }
|
|
446
|
+
#simulator-tab-sound .sound-id { color: var(--accent, #6cf); }
|
|
447
|
+
#simulator-tab-sound .sound-haptic { opacity: 0.7; }
|
|
448
|
+
#simulator-tab-sound .sound-time { opacity: 0.5; }
|
|
449
|
+
#simulator-tab-sound .sound-empty { opacity: 0.5; font-size: 11px; padding: 4px 0; }
|
|
450
|
+
#simulator-tab-sound .sound-controls { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
|
|
451
|
+
#simulator-tab-sound .sound-toggle { font-size: 11px; display: flex; align-items: center; gap: 4px; }
|
|
452
|
+
</style>
|
|
453
|
+
<div class="simulator-section">
|
|
454
|
+
<div class="simulator-section-title">Cues</div>
|
|
455
|
+
<div class="sound-controls">
|
|
456
|
+
<label class="sound-toggle"><input type="checkbox" id="sound-enabled" ${t?`checked`:``} /> Sound enabled</label>
|
|
457
|
+
<button class="simulator-btn" id="sound-clear">Clear</button>
|
|
458
|
+
</div>
|
|
459
|
+
<div id="sound-events">${n()}</div>
|
|
460
|
+
</div>
|
|
461
|
+
`},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:Vt()}),e.length>100&&e.pop(),r(a))}}}function Vt(){return new Date().toLocaleTimeString(`en-US`,{hour12:!1,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Ht(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}var $=null;function Ut(){return typeof window>`u`?!1:new URLSearchParams(window.location.search).has(`developer`)}var Wt={updateFixtures:()=>{},sendToGame:()=>{},loadPuzzle:function(){var e=n.t(function*(){return null});return function(){return e.apply(this,arguments)}}()};function Gt(e={}){var r,i,a,o,s;if(Ut())return console.log(`[Simulator] developer=true in URL — running inside the Puzzmo app, skipping simulator boot`),Wt;if(console.log(`[Simulator] createSimulator called with config:`,{slug:e.slug,hasFixtures:!!e.fixtures}),$)return e.fixtures&&(console.log(`[Simulator] Instance already exists, updating fixtures`),$.updateFixtures(e.fixtures)),$;let c=(r=e.autoStart)==null?!0:r,l=e.fixtures?ie(e.fixtures):null,u=l?Array.from(l.keys()).sort():[],d=pe(),f=Ae(),p=[oe(),se(),d,me(),he(),Ce((i=(a=e.integrations)==null?void 0:a.checklists)==null?[]:i),f,Me(),Pe(e.hostContextPresets),nt(),xt(),Pt(),It(),Bt(),...(o=e.views)==null?[]:o],m=p.map(e=>e.id),h=ee(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=ae,_.innerHTML=`
|
|
462
|
+
<style>
|
|
463
|
+
:root {
|
|
464
|
+
--sim-bg: #1a1a2e;
|
|
465
|
+
--sim-bg-alt: #16213e;
|
|
466
|
+
--sim-panel: #0f0f1a;
|
|
467
|
+
--sim-border: #3a3a5c;
|
|
468
|
+
--sim-border-light: #5a5a8c;
|
|
469
|
+
--sim-accent: #ffd700;
|
|
470
|
+
--sim-accent-hover: #ffed4a;
|
|
471
|
+
--sim-text: #e8e8e8;
|
|
472
|
+
--sim-text-dim: #888899;
|
|
473
|
+
--sim-success: #4ade80;
|
|
474
|
+
--sim-error: #f87171;
|
|
475
|
+
--sim-warning: #fbbf24;
|
|
476
|
+
--sim-blue: #60a5fa;
|
|
477
|
+
}
|
|
478
|
+
#simulator {
|
|
479
|
+
position: fixed;
|
|
480
|
+
bottom: 4px;
|
|
481
|
+
left: 4px;
|
|
482
|
+
z-index: 999999;
|
|
483
|
+
font: 11px/1.4 "Menlo", "Monaco", "Consolas", monospace;
|
|
484
|
+
user-select: none;
|
|
485
|
+
}
|
|
486
|
+
#simulator-panel {
|
|
487
|
+
background: var(--sim-panel);
|
|
488
|
+
border: 2px solid var(--sim-border);
|
|
489
|
+
border-radius: 4px;
|
|
490
|
+
color: var(--sim-text);
|
|
491
|
+
width: 420px;
|
|
492
|
+
max-width: calc(100vw - 8px);
|
|
493
|
+
box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
|
|
494
|
+
}
|
|
495
|
+
#simulator-panel.collapsed {
|
|
496
|
+
width: auto;
|
|
497
|
+
}
|
|
498
|
+
#simulator-header {
|
|
499
|
+
display: flex;
|
|
500
|
+
align-items: center;
|
|
501
|
+
padding: 4px 8px;
|
|
502
|
+
background: var(--sim-bg);
|
|
503
|
+
border-bottom: 2px solid var(--sim-border);
|
|
504
|
+
gap: 0;
|
|
505
|
+
}
|
|
506
|
+
#simulator-panel.collapsed #simulator-header {
|
|
507
|
+
border-bottom: none;
|
|
508
|
+
cursor: pointer;
|
|
509
|
+
}
|
|
510
|
+
#simulator-panel.collapsed #simulator-header:hover {
|
|
511
|
+
background: var(--sim-bg-alt);
|
|
512
|
+
}
|
|
513
|
+
.header-sep {
|
|
514
|
+
color: var(--sim-border-light);
|
|
515
|
+
margin: 0 8px;
|
|
516
|
+
opacity: 0.6;
|
|
517
|
+
}
|
|
518
|
+
.header-spacer {
|
|
519
|
+
flex: 1;
|
|
520
|
+
}
|
|
521
|
+
#simulator-title {
|
|
522
|
+
color: var(--sim-accent);
|
|
523
|
+
text-transform: uppercase;
|
|
524
|
+
letter-spacing: 1px;
|
|
525
|
+
font-size: 10px;
|
|
526
|
+
font-weight: bold;
|
|
527
|
+
}
|
|
528
|
+
#simulator-header-controls {
|
|
529
|
+
display: flex;
|
|
530
|
+
gap: 2px;
|
|
531
|
+
}
|
|
532
|
+
.header-icon-btn {
|
|
533
|
+
width: 20px;
|
|
534
|
+
height: 20px;
|
|
535
|
+
display: flex;
|
|
536
|
+
align-items: center;
|
|
537
|
+
justify-content: center;
|
|
538
|
+
background: transparent;
|
|
539
|
+
border: none;
|
|
540
|
+
border-radius: 2px;
|
|
541
|
+
color: var(--sim-text);
|
|
542
|
+
cursor: pointer;
|
|
543
|
+
padding: 0;
|
|
544
|
+
}
|
|
545
|
+
.header-icon-btn:hover:not(:disabled) {
|
|
546
|
+
background: var(--sim-border);
|
|
547
|
+
color: var(--sim-accent);
|
|
548
|
+
}
|
|
549
|
+
.header-icon-btn:disabled {
|
|
550
|
+
opacity: 0.3;
|
|
551
|
+
cursor: not-allowed;
|
|
552
|
+
}
|
|
553
|
+
.header-icon-btn.active {
|
|
554
|
+
background: var(--sim-accent);
|
|
555
|
+
color: var(--sim-panel);
|
|
556
|
+
}
|
|
557
|
+
#simulator-header-status {
|
|
558
|
+
display: flex;
|
|
559
|
+
align-items: center;
|
|
560
|
+
gap: 4px;
|
|
561
|
+
font-size: 9px;
|
|
562
|
+
color: var(--sim-text-dim);
|
|
563
|
+
}
|
|
564
|
+
#simulator-header-indicator {
|
|
565
|
+
width: 6px;
|
|
566
|
+
height: 6px;
|
|
567
|
+
border-radius: 50%;
|
|
568
|
+
background: var(--sim-text-dim);
|
|
569
|
+
flex-shrink: 0;
|
|
570
|
+
}
|
|
571
|
+
#simulator-header-indicator.ready {
|
|
572
|
+
background: var(--sim-success);
|
|
573
|
+
box-shadow: 0 0 4px var(--sim-success);
|
|
574
|
+
}
|
|
575
|
+
#simulator-header-indicator.waiting {
|
|
576
|
+
background: var(--sim-warning);
|
|
577
|
+
box-shadow: 0 0 4px var(--sim-warning);
|
|
578
|
+
}
|
|
579
|
+
#simulator-header-indicator.paused {
|
|
580
|
+
background: var(--sim-error);
|
|
581
|
+
box-shadow: 0 0 4px var(--sim-error);
|
|
582
|
+
}
|
|
583
|
+
#simulator-header-indicator.complete {
|
|
584
|
+
background: transparent;
|
|
585
|
+
box-shadow: none;
|
|
586
|
+
color: var(--sim-success);
|
|
587
|
+
width: auto;
|
|
588
|
+
height: auto;
|
|
589
|
+
font-size: 11px;
|
|
590
|
+
line-height: 1;
|
|
591
|
+
font-weight: bold;
|
|
592
|
+
}
|
|
593
|
+
#simulator-timer {
|
|
594
|
+
font-size: 11px;
|
|
595
|
+
color: var(--sim-text);
|
|
596
|
+
font-family: "Menlo", monospace;
|
|
597
|
+
font-weight: bold;
|
|
598
|
+
font-variant-numeric: tabular-nums;
|
|
599
|
+
min-width: 38px;
|
|
600
|
+
}
|
|
601
|
+
#simulator-timer .penalty {
|
|
602
|
+
color: var(--sim-error);
|
|
603
|
+
margin-left: 2px;
|
|
604
|
+
}
|
|
605
|
+
/* Collapsed state - show minimal bar */
|
|
606
|
+
#simulator-panel.collapsed .header-sep,
|
|
607
|
+
#simulator-panel.collapsed #simulator-header-controls,
|
|
608
|
+
#simulator-panel.collapsed #simulator-header-status,
|
|
609
|
+
#simulator-panel.collapsed #simulator-header-settings,
|
|
610
|
+
#simulator-panel.collapsed #simulator-toggle {
|
|
611
|
+
display: none;
|
|
612
|
+
}
|
|
613
|
+
#simulator-panel.collapsed #simulator-title {
|
|
614
|
+
cursor: pointer;
|
|
615
|
+
}
|
|
616
|
+
#simulator-panel.collapsed #simulator-timer {
|
|
617
|
+
margin-left: 8px;
|
|
618
|
+
}
|
|
619
|
+
#simulator-body {
|
|
620
|
+
display: flex;
|
|
621
|
+
flex-direction: row;
|
|
622
|
+
}
|
|
623
|
+
#simulator-panel.collapsed #simulator-body {
|
|
624
|
+
display: none;
|
|
625
|
+
}
|
|
626
|
+
#simulator-tabs {
|
|
627
|
+
display: flex;
|
|
628
|
+
flex-direction: column;
|
|
629
|
+
background: var(--sim-bg);
|
|
630
|
+
padding: 4px;
|
|
631
|
+
gap: 2px;
|
|
632
|
+
border-right: 2px solid var(--sim-border);
|
|
633
|
+
}
|
|
634
|
+
.simulator-tab {
|
|
635
|
+
padding: 2px 3px;
|
|
636
|
+
background: var(--sim-bg-alt);
|
|
637
|
+
border: 2px solid var(--sim-border);
|
|
638
|
+
border-radius: 2px;
|
|
639
|
+
color: var(--sim-text-dim);
|
|
640
|
+
cursor: pointer;
|
|
641
|
+
font: inherit;
|
|
642
|
+
text-transform: uppercase;
|
|
643
|
+
font-size: 9px;
|
|
644
|
+
font-weight: bold;
|
|
645
|
+
letter-spacing: 0.5px;
|
|
646
|
+
min-height: 0;
|
|
647
|
+
}
|
|
648
|
+
.simulator-tab:hover {
|
|
649
|
+
color: var(--sim-text);
|
|
650
|
+
background: var(--sim-border);
|
|
651
|
+
}
|
|
652
|
+
.simulator-tab.active {
|
|
653
|
+
color: var(--sim-panel);
|
|
654
|
+
background: var(--sim-accent);
|
|
655
|
+
border-color: var(--sim-accent);
|
|
656
|
+
}
|
|
657
|
+
.simulator-tab {
|
|
658
|
+
position: relative;
|
|
659
|
+
}
|
|
660
|
+
.simulator-tab-badge {
|
|
661
|
+
position: absolute;
|
|
662
|
+
top: -4px;
|
|
663
|
+
right: -4px;
|
|
664
|
+
min-width: 14px;
|
|
665
|
+
height: 14px;
|
|
666
|
+
padding: 0 3px;
|
|
667
|
+
background: var(--sim-blue);
|
|
668
|
+
color: #fff;
|
|
669
|
+
font-size: 8px;
|
|
670
|
+
font-weight: bold;
|
|
671
|
+
border-radius: 7px;
|
|
672
|
+
display: flex;
|
|
673
|
+
align-items: center;
|
|
674
|
+
justify-content: center;
|
|
675
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.3);
|
|
676
|
+
line-height: 1;
|
|
677
|
+
text-align: center;
|
|
678
|
+
box-sizing: border-box;
|
|
679
|
+
}
|
|
680
|
+
.simulator-tab-badge:empty {
|
|
681
|
+
display: none;
|
|
682
|
+
}
|
|
683
|
+
#simulator-content {
|
|
684
|
+
padding: 6px;
|
|
685
|
+
background: var(--sim-panel);
|
|
686
|
+
height: 500px;
|
|
687
|
+
flex: 1;
|
|
688
|
+
overflow-y: auto;
|
|
689
|
+
}
|
|
690
|
+
#simulator-content.hidden {
|
|
691
|
+
display: none;
|
|
692
|
+
}
|
|
693
|
+
#simulator-content::-webkit-scrollbar {
|
|
694
|
+
width: 8px;
|
|
695
|
+
}
|
|
696
|
+
#simulator-content::-webkit-scrollbar-track {
|
|
697
|
+
background: var(--sim-bg);
|
|
698
|
+
}
|
|
699
|
+
#simulator-content::-webkit-scrollbar-thumb {
|
|
700
|
+
background: var(--sim-border);
|
|
701
|
+
border-radius: 2px;
|
|
702
|
+
}
|
|
703
|
+
.simulator-btn {
|
|
704
|
+
padding: 4px 8px;
|
|
705
|
+
background: var(--sim-bg-alt);
|
|
706
|
+
border: 2px solid var(--sim-border);
|
|
707
|
+
border-radius: 2px;
|
|
708
|
+
color: var(--sim-text);
|
|
709
|
+
font: inherit;
|
|
710
|
+
font-size: 10px;
|
|
711
|
+
font-weight: bold;
|
|
712
|
+
text-transform: uppercase;
|
|
713
|
+
letter-spacing: 1px;
|
|
714
|
+
cursor: pointer;
|
|
715
|
+
}
|
|
716
|
+
.simulator-btn:hover {
|
|
717
|
+
background: var(--sim-border);
|
|
718
|
+
border-color: var(--sim-border-light);
|
|
719
|
+
}
|
|
720
|
+
.simulator-btn:active {
|
|
721
|
+
transform: translate(1px, 1px);
|
|
722
|
+
}
|
|
723
|
+
.simulator-btn.primary {
|
|
724
|
+
background: var(--sim-accent);
|
|
725
|
+
border-color: var(--sim-accent);
|
|
726
|
+
color: var(--sim-panel);
|
|
727
|
+
}
|
|
728
|
+
.simulator-btn.primary:hover {
|
|
729
|
+
background: var(--sim-accent-hover);
|
|
730
|
+
border-color: var(--sim-accent-hover);
|
|
731
|
+
}
|
|
732
|
+
.simulator-btn.danger {
|
|
733
|
+
background: var(--sim-error);
|
|
734
|
+
border-color: var(--sim-error);
|
|
735
|
+
color: #fff;
|
|
736
|
+
}
|
|
737
|
+
.simulator-btn.danger:hover {
|
|
738
|
+
background: #ef4444;
|
|
739
|
+
border-color: #ef4444;
|
|
740
|
+
}
|
|
741
|
+
.simulator-btn:disabled {
|
|
742
|
+
opacity: 0.4;
|
|
743
|
+
cursor: not-allowed;
|
|
744
|
+
transform: none;
|
|
745
|
+
}
|
|
746
|
+
.simulator-btn.subtle {
|
|
747
|
+
background: transparent;
|
|
748
|
+
border-color: transparent;
|
|
749
|
+
color: var(--sim-text-dim);
|
|
750
|
+
}
|
|
751
|
+
.simulator-btn.subtle:hover:not(:disabled) {
|
|
752
|
+
background: var(--sim-bg-alt);
|
|
753
|
+
border-color: var(--sim-border);
|
|
754
|
+
color: var(--sim-text);
|
|
755
|
+
}
|
|
756
|
+
#simulator-status {
|
|
757
|
+
font-size: 10px;
|
|
758
|
+
color: var(--sim-text-dim);
|
|
759
|
+
padding: 4px 0 6px;
|
|
760
|
+
display: flex;
|
|
761
|
+
align-items: center;
|
|
762
|
+
gap: 6px;
|
|
763
|
+
}
|
|
764
|
+
#simulator-status .indicator {
|
|
765
|
+
width: 8px;
|
|
766
|
+
height: 8px;
|
|
767
|
+
border-radius: 2px;
|
|
768
|
+
background: var(--sim-text-dim);
|
|
769
|
+
}
|
|
770
|
+
#simulator-status .indicator.ready {
|
|
771
|
+
background: var(--sim-success);
|
|
772
|
+
box-shadow: 0 0 6px var(--sim-success);
|
|
773
|
+
}
|
|
774
|
+
#simulator-status .indicator.waiting {
|
|
775
|
+
background: var(--sim-warning);
|
|
776
|
+
box-shadow: 0 0 6px var(--sim-warning);
|
|
777
|
+
}
|
|
778
|
+
#simulator-status .indicator.paused {
|
|
779
|
+
background: var(--sim-error);
|
|
780
|
+
box-shadow: 0 0 6px var(--sim-error);
|
|
781
|
+
}
|
|
782
|
+
#simulator-status .indicator.complete {
|
|
783
|
+
background: transparent;
|
|
784
|
+
box-shadow: none;
|
|
785
|
+
color: var(--sim-success);
|
|
786
|
+
width: auto;
|
|
787
|
+
height: auto;
|
|
788
|
+
font-size: 12px;
|
|
789
|
+
line-height: 1;
|
|
790
|
+
font-weight: bold;
|
|
791
|
+
}
|
|
792
|
+
.simulator-row {
|
|
793
|
+
display: flex;
|
|
794
|
+
gap: 4px;
|
|
795
|
+
margin-top: 4px;
|
|
796
|
+
}
|
|
797
|
+
.simulator-row .simulator-btn {
|
|
798
|
+
flex: 1;
|
|
799
|
+
}
|
|
800
|
+
.simulator-divider {
|
|
801
|
+
height: 2px;
|
|
802
|
+
background: var(--sim-border);
|
|
803
|
+
margin: 8px 0;
|
|
804
|
+
}
|
|
805
|
+
.simulator-field {
|
|
806
|
+
margin-bottom: 6px;
|
|
807
|
+
}
|
|
808
|
+
.simulator-select {
|
|
809
|
+
width: 100%;
|
|
810
|
+
padding: 4px 6px;
|
|
811
|
+
background: var(--sim-bg);
|
|
812
|
+
border: 2px solid var(--sim-border);
|
|
813
|
+
border-radius: 2px;
|
|
814
|
+
color: var(--sim-text);
|
|
815
|
+
font: inherit;
|
|
816
|
+
font-size: 10px;
|
|
817
|
+
cursor: pointer;
|
|
818
|
+
}
|
|
819
|
+
.simulator-select:focus {
|
|
820
|
+
outline: none;
|
|
821
|
+
border-color: var(--sim-accent);
|
|
822
|
+
}
|
|
823
|
+
.simulator-select option {
|
|
824
|
+
background: var(--sim-bg);
|
|
825
|
+
color: var(--sim-text);
|
|
826
|
+
}
|
|
827
|
+
.simulator-fixtures {
|
|
828
|
+
margin-bottom: 8px;
|
|
829
|
+
padding-bottom: 8px;
|
|
830
|
+
border-bottom: 2px solid var(--sim-border);
|
|
831
|
+
}
|
|
832
|
+
.simulator-label {
|
|
833
|
+
display: block;
|
|
834
|
+
color: var(--sim-accent);
|
|
835
|
+
text-transform: uppercase;
|
|
836
|
+
font-size: 9px;
|
|
837
|
+
font-weight: bold;
|
|
838
|
+
letter-spacing: 1px;
|
|
839
|
+
margin-bottom: 4px;
|
|
840
|
+
}
|
|
841
|
+
.simulator-override-tag {
|
|
842
|
+
display: inline-block;
|
|
843
|
+
margin-left: 6px;
|
|
844
|
+
padding: 0 4px;
|
|
845
|
+
border-radius: 2px;
|
|
846
|
+
background: var(--sim-accent);
|
|
847
|
+
color: var(--sim-bg);
|
|
848
|
+
font-size: 8px;
|
|
849
|
+
letter-spacing: 0.5px;
|
|
850
|
+
}
|
|
851
|
+
.simulator-override-tag[hidden] {
|
|
852
|
+
display: none;
|
|
853
|
+
}
|
|
854
|
+
.simulator-textarea {
|
|
855
|
+
width: 100%;
|
|
856
|
+
min-height: 40px;
|
|
857
|
+
background: var(--sim-bg);
|
|
858
|
+
border: 2px solid var(--sim-border);
|
|
859
|
+
border-radius: 2px;
|
|
860
|
+
color: var(--sim-text);
|
|
861
|
+
font: 10px/1.4 "Menlo", monospace;
|
|
862
|
+
padding: 4px;
|
|
863
|
+
resize: none;
|
|
864
|
+
box-sizing: border-box;
|
|
865
|
+
overflow-y: auto;
|
|
866
|
+
}
|
|
867
|
+
.simulator-textarea.auto-resize {
|
|
868
|
+
resize: none;
|
|
869
|
+
overflow-y: auto;
|
|
870
|
+
}
|
|
871
|
+
.simulator-textarea:focus {
|
|
872
|
+
outline: none;
|
|
873
|
+
border-color: var(--sim-accent);
|
|
874
|
+
}
|
|
875
|
+
.simulator-input {
|
|
876
|
+
width: 100%;
|
|
877
|
+
background: var(--sim-bg);
|
|
878
|
+
border: 2px solid var(--sim-border);
|
|
879
|
+
border-radius: 2px;
|
|
880
|
+
color: var(--sim-text);
|
|
881
|
+
font: 10px/1.4 "Menlo", monospace;
|
|
882
|
+
padding: 4px 6px;
|
|
883
|
+
box-sizing: border-box;
|
|
884
|
+
}
|
|
885
|
+
.simulator-input:focus {
|
|
886
|
+
outline: none;
|
|
887
|
+
border-color: var(--sim-accent);
|
|
888
|
+
}
|
|
889
|
+
.simulator-input::placeholder {
|
|
890
|
+
color: var(--sim-text-dim);
|
|
891
|
+
}
|
|
892
|
+
.simulator-tab-content {
|
|
893
|
+
display: none;
|
|
894
|
+
}
|
|
895
|
+
.simulator-tab-content.active {
|
|
896
|
+
display: block;
|
|
897
|
+
}
|
|
898
|
+
.msgs-view-container {
|
|
899
|
+
display: flex;
|
|
900
|
+
flex-direction: column;
|
|
901
|
+
height: 100%;
|
|
902
|
+
overflow: hidden;
|
|
903
|
+
}
|
|
904
|
+
.msgs-header {
|
|
905
|
+
display: flex;
|
|
906
|
+
justify-content: space-between;
|
|
907
|
+
align-items: center;
|
|
908
|
+
margin-bottom: 6px;
|
|
909
|
+
flex-shrink: 0;
|
|
910
|
+
}
|
|
911
|
+
#simulator-msgs-log {
|
|
912
|
+
display: flex;
|
|
913
|
+
flex-direction: column;
|
|
914
|
+
gap: 2px;
|
|
915
|
+
flex: 1;
|
|
916
|
+
overflow-y: auto;
|
|
917
|
+
}
|
|
918
|
+
.simulator-msg {
|
|
919
|
+
padding: 3px 4px;
|
|
920
|
+
background: var(--sim-bg);
|
|
921
|
+
border: 1px solid var(--sim-border);
|
|
922
|
+
border-radius: 2px;
|
|
923
|
+
font-size: 10px;
|
|
924
|
+
}
|
|
925
|
+
.simulator-msg.out {
|
|
926
|
+
border-left: 2px solid var(--sim-accent);
|
|
927
|
+
}
|
|
928
|
+
.simulator-msg.in {
|
|
929
|
+
border-left: 2px solid var(--sim-blue);
|
|
930
|
+
}
|
|
931
|
+
.simulator-msg-header {
|
|
932
|
+
display: flex;
|
|
933
|
+
justify-content: space-between;
|
|
934
|
+
align-items: center;
|
|
935
|
+
margin-bottom: 2px;
|
|
936
|
+
}
|
|
937
|
+
.simulator-msg-type {
|
|
938
|
+
font-weight: bold;
|
|
939
|
+
color: var(--sim-text);
|
|
940
|
+
}
|
|
941
|
+
.simulator-msg.out .simulator-msg-type {
|
|
942
|
+
color: var(--sim-accent);
|
|
943
|
+
}
|
|
944
|
+
.simulator-msg.in .simulator-msg-type {
|
|
945
|
+
color: var(--sim-blue);
|
|
946
|
+
}
|
|
947
|
+
.simulator-msg-time {
|
|
948
|
+
color: var(--sim-text-dim);
|
|
949
|
+
font-size: 9px;
|
|
950
|
+
}
|
|
951
|
+
.simulator-msg-data {
|
|
952
|
+
color: var(--sim-text-dim);
|
|
953
|
+
font-size: 9px;
|
|
954
|
+
white-space: pre-wrap;
|
|
955
|
+
word-break: break-all;
|
|
956
|
+
max-height: 60px;
|
|
957
|
+
overflow: hidden;
|
|
958
|
+
cursor: pointer;
|
|
959
|
+
border-radius: 2px;
|
|
960
|
+
padding: 2px 4px;
|
|
961
|
+
background: var(--sim-bg-alt);
|
|
962
|
+
}
|
|
963
|
+
.simulator-msg-data:hover {
|
|
964
|
+
background: var(--sim-border);
|
|
965
|
+
}
|
|
966
|
+
.simulator-msg.expanded {
|
|
967
|
+
flex: 1;
|
|
968
|
+
display: flex;
|
|
969
|
+
flex-direction: column;
|
|
970
|
+
}
|
|
971
|
+
.simulator-msg.expanded .simulator-msg-data {
|
|
972
|
+
max-height: none;
|
|
973
|
+
flex: 1;
|
|
974
|
+
overflow-y: auto;
|
|
975
|
+
}
|
|
976
|
+
.simulator-empty {
|
|
977
|
+
color: var(--sim-text-dim);
|
|
978
|
+
font-size: 10px;
|
|
979
|
+
text-align: center;
|
|
980
|
+
padding: 20px;
|
|
981
|
+
}
|
|
982
|
+
.simulator-share-preview {
|
|
983
|
+
margin: 0;
|
|
984
|
+
padding: 8px;
|
|
985
|
+
text-align: left;
|
|
986
|
+
font-size: 13px;
|
|
987
|
+
line-height: 1.45;
|
|
988
|
+
white-space: pre-wrap;
|
|
989
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
990
|
+
}
|
|
991
|
+
.simulator-segmented {
|
|
992
|
+
display: flex;
|
|
993
|
+
gap: 2px;
|
|
994
|
+
padding: 2px;
|
|
995
|
+
background: var(--sim-bg);
|
|
996
|
+
border: 2px solid var(--sim-border);
|
|
997
|
+
border-radius: 2px;
|
|
998
|
+
margin-bottom: 6px;
|
|
999
|
+
}
|
|
1000
|
+
.simulator-segmented-btn {
|
|
1001
|
+
flex: 1;
|
|
1002
|
+
padding: 4px 8px;
|
|
1003
|
+
background: transparent;
|
|
1004
|
+
border: 0;
|
|
1005
|
+
border-radius: 2px;
|
|
1006
|
+
color: var(--sim-text-dim);
|
|
1007
|
+
font: inherit;
|
|
1008
|
+
font-size: 10px;
|
|
1009
|
+
font-weight: bold;
|
|
1010
|
+
text-transform: uppercase;
|
|
1011
|
+
letter-spacing: 1px;
|
|
1012
|
+
cursor: pointer;
|
|
1013
|
+
}
|
|
1014
|
+
.simulator-segmented-btn:hover:not(.active) {
|
|
1015
|
+
color: var(--sim-text);
|
|
1016
|
+
}
|
|
1017
|
+
.simulator-segmented-btn.active {
|
|
1018
|
+
background: var(--sim-border);
|
|
1019
|
+
color: var(--sim-text);
|
|
1020
|
+
}
|
|
1021
|
+
.simulator-share-missing {
|
|
1022
|
+
color: var(--sim-text-dim);
|
|
1023
|
+
font-size: 11px;
|
|
1024
|
+
padding: 12px;
|
|
1025
|
+
line-height: 1.4;
|
|
1026
|
+
}
|
|
1027
|
+
.simulator-share-missing p {
|
|
1028
|
+
margin: 0 0 6px;
|
|
1029
|
+
}
|
|
1030
|
+
.simulator-share-missing code {
|
|
1031
|
+
color: var(--sim-text);
|
|
1032
|
+
background: var(--sim-bg);
|
|
1033
|
+
padding: 1px 4px;
|
|
1034
|
+
border-radius: 2px;
|
|
1035
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
1036
|
+
}
|
|
1037
|
+
.simulator-share-missing pre {
|
|
1038
|
+
margin: 6px 0 0;
|
|
1039
|
+
padding: 8px;
|
|
1040
|
+
background: var(--sim-bg);
|
|
1041
|
+
border: 1px solid var(--sim-border);
|
|
1042
|
+
border-radius: 2px;
|
|
1043
|
+
color: var(--sim-text);
|
|
1044
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
1045
|
+
font-size: 10.5px;
|
|
1046
|
+
line-height: 1.45;
|
|
1047
|
+
white-space: pre-wrap;
|
|
1048
|
+
overflow-x: auto;
|
|
1049
|
+
}
|
|
1050
|
+
.simulator-value {
|
|
1051
|
+
color: var(--sim-text);
|
|
1052
|
+
font-size: 10px;
|
|
1053
|
+
padding: 4px;
|
|
1054
|
+
background: var(--sim-bg);
|
|
1055
|
+
border: 1px solid var(--sim-border);
|
|
1056
|
+
border-radius: 2px;
|
|
1057
|
+
}
|
|
1058
|
+
.simulator-deeds {
|
|
1059
|
+
display: flex;
|
|
1060
|
+
flex-direction: column;
|
|
1061
|
+
gap: 2px;
|
|
1062
|
+
}
|
|
1063
|
+
.simulator-deed {
|
|
1064
|
+
display: flex;
|
|
1065
|
+
justify-content: space-between;
|
|
1066
|
+
padding: 3px 4px;
|
|
1067
|
+
background: var(--sim-bg);
|
|
1068
|
+
border: 1px solid var(--sim-border);
|
|
1069
|
+
border-radius: 2px;
|
|
1070
|
+
font-size: 10px;
|
|
1071
|
+
}
|
|
1072
|
+
.simulator-deed-name {
|
|
1073
|
+
color: var(--sim-text);
|
|
1074
|
+
}
|
|
1075
|
+
.simulator-deed-value {
|
|
1076
|
+
color: var(--sim-accent);
|
|
1077
|
+
font-weight: bold;
|
|
1078
|
+
}
|
|
1079
|
+
.thumb-view-container {
|
|
1080
|
+
display: flex;
|
|
1081
|
+
flex-direction: column;
|
|
1082
|
+
height: 100%;
|
|
1083
|
+
overflow: hidden;
|
|
1084
|
+
}
|
|
1085
|
+
.thumb-header {
|
|
1086
|
+
display: flex;
|
|
1087
|
+
justify-content: space-between;
|
|
1088
|
+
align-items: center;
|
|
1089
|
+
margin-bottom: 6px;
|
|
1090
|
+
flex-shrink: 0;
|
|
1091
|
+
}
|
|
1092
|
+
#simulator-thumb-preview {
|
|
1093
|
+
background: var(--sim-thumb-bg, transparent);
|
|
1094
|
+
border: 2px solid var(--sim-border);
|
|
1095
|
+
border-radius: 2px;
|
|
1096
|
+
padding: 8px;
|
|
1097
|
+
display: flex;
|
|
1098
|
+
align-items: center;
|
|
1099
|
+
justify-content: center;
|
|
1100
|
+
aspect-ratio: 1;
|
|
1101
|
+
width: 100%;
|
|
1102
|
+
box-sizing: border-box;
|
|
1103
|
+
}
|
|
1104
|
+
#simulator-thumb-preview svg {
|
|
1105
|
+
width: 100%;
|
|
1106
|
+
height: 100%;
|
|
1107
|
+
max-width: 100%;
|
|
1108
|
+
max-height: 100%;
|
|
1109
|
+
}
|
|
1110
|
+
#simulator-thumb-fn {
|
|
1111
|
+
font-size: 10px;
|
|
1112
|
+
color: var(--sim-text-dim);
|
|
1113
|
+
margin-top: 4px;
|
|
1114
|
+
}
|
|
1115
|
+
.theme-view-container {
|
|
1116
|
+
display: flex;
|
|
1117
|
+
flex-direction: column;
|
|
1118
|
+
height: 100%;
|
|
1119
|
+
overflow: hidden;
|
|
1120
|
+
}
|
|
1121
|
+
.theme-header {
|
|
1122
|
+
display: flex;
|
|
1123
|
+
justify-content: space-between;
|
|
1124
|
+
align-items: center;
|
|
1125
|
+
margin-bottom: 6px;
|
|
1126
|
+
flex-shrink: 0;
|
|
1127
|
+
}
|
|
1128
|
+
.simulator-themes {
|
|
1129
|
+
display: flex;
|
|
1130
|
+
flex-direction: column;
|
|
1131
|
+
gap: 4px;
|
|
1132
|
+
flex: 1;
|
|
1133
|
+
overflow-y: auto;
|
|
1134
|
+
}
|
|
1135
|
+
.simulator-theme-item {
|
|
1136
|
+
display: flex;
|
|
1137
|
+
align-items: center;
|
|
1138
|
+
gap: 8px;
|
|
1139
|
+
padding: 4px;
|
|
1140
|
+
background: var(--sim-bg);
|
|
1141
|
+
border: 2px solid var(--sim-border);
|
|
1142
|
+
border-radius: 2px;
|
|
1143
|
+
cursor: pointer;
|
|
1144
|
+
}
|
|
1145
|
+
.simulator-theme-item:hover {
|
|
1146
|
+
border-color: var(--sim-border-light);
|
|
1147
|
+
}
|
|
1148
|
+
.simulator-theme-item.selected {
|
|
1149
|
+
border-color: var(--sim-accent);
|
|
1150
|
+
background: var(--sim-bg-alt);
|
|
1151
|
+
}
|
|
1152
|
+
.simulator-theme-preview {
|
|
1153
|
+
width: 48px;
|
|
1154
|
+
height: 32px;
|
|
1155
|
+
display: grid;
|
|
1156
|
+
grid-template-columns: repeat(3, 1fr);
|
|
1157
|
+
grid-template-rows: repeat(2, 1fr);
|
|
1158
|
+
gap: 1px;
|
|
1159
|
+
border-radius: 2px;
|
|
1160
|
+
overflow: hidden;
|
|
1161
|
+
flex-shrink: 0;
|
|
1162
|
+
}
|
|
1163
|
+
.simulator-theme-preview-cell {
|
|
1164
|
+
width: 100%;
|
|
1165
|
+
height: 100%;
|
|
1166
|
+
}
|
|
1167
|
+
.simulator-theme-name {
|
|
1168
|
+
font-size: 10px;
|
|
1169
|
+
color: var(--sim-text);
|
|
1170
|
+
flex: 1;
|
|
1171
|
+
}
|
|
1172
|
+
.simulator-theme-type {
|
|
1173
|
+
font-size: 9px;
|
|
1174
|
+
color: var(--sim-text-dim);
|
|
1175
|
+
text-transform: uppercase;
|
|
1176
|
+
}
|
|
1177
|
+
/* Auth tab styles */
|
|
1178
|
+
.simulator-section {
|
|
1179
|
+
margin-bottom: 12px;
|
|
1180
|
+
}
|
|
1181
|
+
.simulator-section-title {
|
|
1182
|
+
color: var(--sim-accent);
|
|
1183
|
+
text-transform: uppercase;
|
|
1184
|
+
font-size: 10px;
|
|
1185
|
+
font-weight: bold;
|
|
1186
|
+
letter-spacing: 1px;
|
|
1187
|
+
margin-bottom: 6px;
|
|
1188
|
+
padding-bottom: 4px;
|
|
1189
|
+
border-bottom: 1px solid var(--sim-border);
|
|
1190
|
+
}
|
|
1191
|
+
.auth-header-row {
|
|
1192
|
+
display: flex;
|
|
1193
|
+
align-items: center;
|
|
1194
|
+
justify-content: space-between;
|
|
1195
|
+
margin-bottom: 6px;
|
|
1196
|
+
}
|
|
1197
|
+
.auth-status {
|
|
1198
|
+
display: flex;
|
|
1199
|
+
align-items: center;
|
|
1200
|
+
gap: 6px;
|
|
1201
|
+
font-size: 10px;
|
|
1202
|
+
color: var(--sim-text-dim);
|
|
1203
|
+
padding: 4px 0;
|
|
1204
|
+
}
|
|
1205
|
+
.auth-status.authenticated {
|
|
1206
|
+
color: var(--sim-success);
|
|
1207
|
+
}
|
|
1208
|
+
.simulator-btn.small {
|
|
1209
|
+
padding: 2px 6px;
|
|
1210
|
+
font-size: 9px;
|
|
1211
|
+
}
|
|
1212
|
+
.simulator-btn.tiny {
|
|
1213
|
+
padding: 3px 2px;
|
|
1214
|
+
font-size: 8px;
|
|
1215
|
+
border-width: 1px;
|
|
1216
|
+
line-height: 1;
|
|
1217
|
+
min-height: 0;
|
|
1218
|
+
height: auto;
|
|
1219
|
+
}
|
|
1220
|
+
.auth-title-row {
|
|
1221
|
+
display: flex;
|
|
1222
|
+
align-items: center;
|
|
1223
|
+
gap: 6px;
|
|
1224
|
+
}
|
|
1225
|
+
.auth-title-row > span:first-child {
|
|
1226
|
+
flex: 1;
|
|
1227
|
+
}
|
|
1228
|
+
.auth-title-row .simulator-btn.active {
|
|
1229
|
+
background: var(--sim-accent);
|
|
1230
|
+
color: black;
|
|
1231
|
+
}
|
|
1232
|
+
.auth-description {
|
|
1233
|
+
font-size: 10px;
|
|
1234
|
+
color: var(--sim-text-dim);
|
|
1235
|
+
margin: 6px 0;
|
|
1236
|
+
line-height: 1.4;
|
|
1237
|
+
}
|
|
1238
|
+
.auth-user-info {
|
|
1239
|
+
font-size: 10px;
|
|
1240
|
+
color: var(--sim-text-dim);
|
|
1241
|
+
padding: 6px;
|
|
1242
|
+
background: var(--sim-bg);
|
|
1243
|
+
border: 1px solid var(--sim-border);
|
|
1244
|
+
border-radius: 2px;
|
|
1245
|
+
margin-bottom: 8px;
|
|
1246
|
+
}
|
|
1247
|
+
.auth-user-info div {
|
|
1248
|
+
margin-bottom: 4px;
|
|
1249
|
+
}
|
|
1250
|
+
.auth-user-info div:last-child {
|
|
1251
|
+
margin-bottom: 0;
|
|
1252
|
+
}
|
|
1253
|
+
.auth-user-info code {
|
|
1254
|
+
color: var(--sim-text);
|
|
1255
|
+
background: var(--sim-bg-alt);
|
|
1256
|
+
padding: 1px 4px;
|
|
1257
|
+
border-radius: 2px;
|
|
1258
|
+
}
|
|
1259
|
+
.auth-warning {
|
|
1260
|
+
color: var(--sim-warning);
|
|
1261
|
+
font-style: italic;
|
|
1262
|
+
}
|
|
1263
|
+
.auth-error {
|
|
1264
|
+
margin-top: 8px;
|
|
1265
|
+
}
|
|
1266
|
+
.auth-error .error,
|
|
1267
|
+
.auth-api-result .error {
|
|
1268
|
+
color: var(--sim-error);
|
|
1269
|
+
font-size: 10px;
|
|
1270
|
+
padding: 6px;
|
|
1271
|
+
background: rgba(248, 113, 113, 0.1);
|
|
1272
|
+
border: 1px solid var(--sim-error);
|
|
1273
|
+
border-radius: 2px;
|
|
1274
|
+
}
|
|
1275
|
+
.auth-api-result {
|
|
1276
|
+
margin-top: 8px;
|
|
1277
|
+
}
|
|
1278
|
+
.auth-api-result pre {
|
|
1279
|
+
font-size: 9px;
|
|
1280
|
+
color: var(--sim-text);
|
|
1281
|
+
background: var(--sim-bg);
|
|
1282
|
+
border: 1px solid var(--sim-border);
|
|
1283
|
+
border-radius: 2px;
|
|
1284
|
+
padding: 6px;
|
|
1285
|
+
margin: 0;
|
|
1286
|
+
white-space: pre-wrap;
|
|
1287
|
+
word-break: break-all;
|
|
1288
|
+
max-height: 150px;
|
|
1289
|
+
overflow-y: auto;
|
|
1290
|
+
}
|
|
1291
|
+
.auth-api-result .loading {
|
|
1292
|
+
font-size: 10px;
|
|
1293
|
+
color: var(--sim-text-dim);
|
|
1294
|
+
padding: 6px;
|
|
1295
|
+
background: var(--sim-bg);
|
|
1296
|
+
border: 1px solid var(--sim-border);
|
|
1297
|
+
border-radius: 2px;
|
|
1298
|
+
}
|
|
1299
|
+
/* Data view styles */
|
|
1300
|
+
.data-view-container {
|
|
1301
|
+
display: flex;
|
|
1302
|
+
flex-direction: column;
|
|
1303
|
+
height: 100%;
|
|
1304
|
+
overflow: hidden;
|
|
1305
|
+
}
|
|
1306
|
+
.data-subtabs {
|
|
1307
|
+
display: flex;
|
|
1308
|
+
gap: 2px;
|
|
1309
|
+
margin-bottom: 8px;
|
|
1310
|
+
flex-shrink: 0;
|
|
1311
|
+
}
|
|
1312
|
+
.data-subtab {
|
|
1313
|
+
padding: 4px 10px;
|
|
1314
|
+
background: var(--sim-bg-alt);
|
|
1315
|
+
border: 1px solid var(--sim-border);
|
|
1316
|
+
border-radius: 2px;
|
|
1317
|
+
color: var(--sim-text-dim);
|
|
1318
|
+
cursor: pointer;
|
|
1319
|
+
font: inherit;
|
|
1320
|
+
font-size: 9px;
|
|
1321
|
+
font-weight: bold;
|
|
1322
|
+
text-transform: uppercase;
|
|
1323
|
+
letter-spacing: 0.5px;
|
|
1324
|
+
}
|
|
1325
|
+
.data-subtab:hover {
|
|
1326
|
+
color: var(--sim-text);
|
|
1327
|
+
background: var(--sim-border);
|
|
1328
|
+
}
|
|
1329
|
+
.data-subtab.active {
|
|
1330
|
+
color: var(--sim-panel);
|
|
1331
|
+
background: var(--sim-accent);
|
|
1332
|
+
border-color: var(--sim-accent);
|
|
1333
|
+
}
|
|
1334
|
+
.data-subtab-content {
|
|
1335
|
+
display: none;
|
|
1336
|
+
flex: 1;
|
|
1337
|
+
overflow-y: auto;
|
|
1338
|
+
overflow-x: hidden;
|
|
1339
|
+
}
|
|
1340
|
+
.data-subtab-content.active {
|
|
1341
|
+
display: flex;
|
|
1342
|
+
flex-direction: column;
|
|
1343
|
+
}
|
|
1344
|
+
/* History tab styles */
|
|
1345
|
+
.history-header {
|
|
1346
|
+
display: flex;
|
|
1347
|
+
justify-content: space-between;
|
|
1348
|
+
align-items: center;
|
|
1349
|
+
margin-bottom: 6px;
|
|
1350
|
+
flex-shrink: 0;
|
|
1351
|
+
}
|
|
1352
|
+
.history-list {
|
|
1353
|
+
display: flex;
|
|
1354
|
+
flex-direction: column;
|
|
1355
|
+
gap: 4px;
|
|
1356
|
+
flex: 1;
|
|
1357
|
+
overflow-y: auto;
|
|
1358
|
+
}
|
|
1359
|
+
.history-item {
|
|
1360
|
+
padding: 6px;
|
|
1361
|
+
background: var(--sim-bg);
|
|
1362
|
+
border: 1px solid var(--sim-border);
|
|
1363
|
+
border-radius: 2px;
|
|
1364
|
+
display: flex;
|
|
1365
|
+
flex-direction: row;
|
|
1366
|
+
gap: 8px;
|
|
1367
|
+
}
|
|
1368
|
+
.history-item:hover {
|
|
1369
|
+
border-color: var(--sim-border-light);
|
|
1370
|
+
}
|
|
1371
|
+
.history-item-thumb {
|
|
1372
|
+
width: 80px;
|
|
1373
|
+
height: 80px;
|
|
1374
|
+
flex-shrink: 0;
|
|
1375
|
+
background: var(--history-thumb-bg, var(--sim-bg-alt));
|
|
1376
|
+
border: 1px solid var(--sim-border);
|
|
1377
|
+
border-radius: 2px;
|
|
1378
|
+
display: flex;
|
|
1379
|
+
align-items: center;
|
|
1380
|
+
justify-content: center;
|
|
1381
|
+
overflow: hidden;
|
|
1382
|
+
}
|
|
1383
|
+
.history-item-thumb svg {
|
|
1384
|
+
width: 100%;
|
|
1385
|
+
height: 100%;
|
|
1386
|
+
}
|
|
1387
|
+
.history-item-thumb:empty {
|
|
1388
|
+
display: none;
|
|
1389
|
+
}
|
|
1390
|
+
.history-item-content {
|
|
1391
|
+
flex: 1;
|
|
1392
|
+
min-width: 0;
|
|
1393
|
+
display: flex;
|
|
1394
|
+
flex-direction: column;
|
|
1395
|
+
gap: 4px;
|
|
1396
|
+
}
|
|
1397
|
+
.history-item-header {
|
|
1398
|
+
display: flex;
|
|
1399
|
+
align-items: center;
|
|
1400
|
+
gap: 6px;
|
|
1401
|
+
}
|
|
1402
|
+
.history-item-num {
|
|
1403
|
+
color: var(--sim-accent);
|
|
1404
|
+
font-weight: bold;
|
|
1405
|
+
font-size: 9px;
|
|
1406
|
+
}
|
|
1407
|
+
.history-item-time {
|
|
1408
|
+
color: var(--sim-text-dim);
|
|
1409
|
+
font-size: 9px;
|
|
1410
|
+
flex: 1;
|
|
1411
|
+
}
|
|
1412
|
+
.history-item-preview {
|
|
1413
|
+
font-size: 9px;
|
|
1414
|
+
color: var(--sim-text);
|
|
1415
|
+
word-break: break-all;
|
|
1416
|
+
line-height: 1.3;
|
|
1417
|
+
background: var(--sim-bg-alt);
|
|
1418
|
+
padding: 3px 4px;
|
|
1419
|
+
border-radius: 2px;
|
|
1420
|
+
flex: 1;
|
|
1421
|
+
overflow: hidden;
|
|
1422
|
+
}
|
|
1423
|
+
/* Saves tab styles */
|
|
1424
|
+
.save-new {
|
|
1425
|
+
display: flex;
|
|
1426
|
+
gap: 4px;
|
|
1427
|
+
margin-bottom: 8px;
|
|
1428
|
+
flex-shrink: 0;
|
|
1429
|
+
}
|
|
1430
|
+
.save-new .simulator-input {
|
|
1431
|
+
flex: 1;
|
|
1432
|
+
}
|
|
1433
|
+
.saves-list {
|
|
1434
|
+
display: flex;
|
|
1435
|
+
flex-direction: column;
|
|
1436
|
+
gap: 4px;
|
|
1437
|
+
flex: 1;
|
|
1438
|
+
overflow-y: auto;
|
|
1439
|
+
}
|
|
1440
|
+
.save-item {
|
|
1441
|
+
padding: 6px;
|
|
1442
|
+
background: var(--sim-bg);
|
|
1443
|
+
border: 1px solid var(--sim-border);
|
|
1444
|
+
border-radius: 2px;
|
|
1445
|
+
}
|
|
1446
|
+
.save-item:hover {
|
|
1447
|
+
border-color: var(--sim-border-light);
|
|
1448
|
+
}
|
|
1449
|
+
.save-item-header {
|
|
1450
|
+
display: flex;
|
|
1451
|
+
justify-content: space-between;
|
|
1452
|
+
align-items: center;
|
|
1453
|
+
margin-bottom: 4px;
|
|
1454
|
+
}
|
|
1455
|
+
.save-item-name {
|
|
1456
|
+
color: var(--sim-text);
|
|
1457
|
+
font-weight: bold;
|
|
1458
|
+
font-size: 10px;
|
|
1459
|
+
}
|
|
1460
|
+
.save-item-time {
|
|
1461
|
+
color: var(--sim-text-dim);
|
|
1462
|
+
font-size: 9px;
|
|
1463
|
+
}
|
|
1464
|
+
.save-item-actions {
|
|
1465
|
+
display: flex;
|
|
1466
|
+
gap: 4px;
|
|
1467
|
+
}
|
|
1468
|
+
/* Features view styles */
|
|
1469
|
+
.features-view-container {
|
|
1470
|
+
display: flex;
|
|
1471
|
+
flex-direction: column;
|
|
1472
|
+
height: 100%;
|
|
1473
|
+
overflow: hidden;
|
|
1474
|
+
}
|
|
1475
|
+
.features-slug-input {
|
|
1476
|
+
display: flex;
|
|
1477
|
+
gap: 4px;
|
|
1478
|
+
margin-bottom: 8px;
|
|
1479
|
+
}
|
|
1480
|
+
.features-slug-input .simulator-input {
|
|
1481
|
+
flex: 1;
|
|
1482
|
+
}
|
|
1483
|
+
.features-content {
|
|
1484
|
+
flex: 1;
|
|
1485
|
+
overflow-y: auto;
|
|
1486
|
+
}
|
|
1487
|
+
.features-loading {
|
|
1488
|
+
color: var(--sim-text-dim);
|
|
1489
|
+
font-size: 10px;
|
|
1490
|
+
text-align: center;
|
|
1491
|
+
padding: 20px;
|
|
1492
|
+
}
|
|
1493
|
+
.features-error {
|
|
1494
|
+
color: var(--sim-error);
|
|
1495
|
+
font-size: 10px;
|
|
1496
|
+
padding: 8px;
|
|
1497
|
+
background: rgba(248, 113, 113, 0.1);
|
|
1498
|
+
border: 1px solid var(--sim-error);
|
|
1499
|
+
border-radius: 2px;
|
|
1500
|
+
}
|
|
1501
|
+
.features-empty {
|
|
1502
|
+
color: var(--sim-text-dim);
|
|
1503
|
+
font-size: 10px;
|
|
1504
|
+
text-align: center;
|
|
1505
|
+
padding: 20px;
|
|
1506
|
+
}
|
|
1507
|
+
.features-auth-required {
|
|
1508
|
+
color: var(--sim-text-dim);
|
|
1509
|
+
font-size: 10px;
|
|
1510
|
+
padding: 12px;
|
|
1511
|
+
background: var(--sim-bg);
|
|
1512
|
+
border: 1px solid var(--sim-border);
|
|
1513
|
+
border-radius: 2px;
|
|
1514
|
+
line-height: 1.5;
|
|
1515
|
+
}
|
|
1516
|
+
.features-auth-required p {
|
|
1517
|
+
margin: 0 0 8px 0;
|
|
1518
|
+
}
|
|
1519
|
+
.features-auth-required p:last-child {
|
|
1520
|
+
margin-bottom: 0;
|
|
1521
|
+
}
|
|
1522
|
+
.features-game-name {
|
|
1523
|
+
color: var(--sim-accent);
|
|
1524
|
+
font-size: 11px;
|
|
1525
|
+
font-weight: bold;
|
|
1526
|
+
margin-bottom: 8px;
|
|
1527
|
+
padding-bottom: 4px;
|
|
1528
|
+
border-bottom: 1px solid var(--sim-border);
|
|
1529
|
+
}
|
|
1530
|
+
.feature-group {
|
|
1531
|
+
margin-bottom: 12px;
|
|
1532
|
+
}
|
|
1533
|
+
.feature-group-title {
|
|
1534
|
+
color: var(--sim-text);
|
|
1535
|
+
font-size: 10px;
|
|
1536
|
+
font-weight: bold;
|
|
1537
|
+
text-transform: uppercase;
|
|
1538
|
+
letter-spacing: 0.5px;
|
|
1539
|
+
margin-bottom: 6px;
|
|
1540
|
+
padding-bottom: 2px;
|
|
1541
|
+
border-bottom: 1px solid var(--sim-border);
|
|
1542
|
+
}
|
|
1543
|
+
.feature-group-items {
|
|
1544
|
+
display: flex;
|
|
1545
|
+
flex-direction: column;
|
|
1546
|
+
gap: 2px;
|
|
1547
|
+
}
|
|
1548
|
+
.feature-item {
|
|
1549
|
+
display: flex;
|
|
1550
|
+
align-items: center;
|
|
1551
|
+
gap: 8px;
|
|
1552
|
+
padding: 4px 6px;
|
|
1553
|
+
background: var(--sim-bg);
|
|
1554
|
+
border: 1px solid var(--sim-border);
|
|
1555
|
+
border-radius: 2px;
|
|
1556
|
+
cursor: pointer;
|
|
1557
|
+
transition: all 0.15s ease;
|
|
1558
|
+
}
|
|
1559
|
+
.feature-item:hover {
|
|
1560
|
+
border-color: var(--sim-border-light);
|
|
1561
|
+
background: var(--sim-bg-alt);
|
|
1562
|
+
}
|
|
1563
|
+
.feature-item.updating {
|
|
1564
|
+
opacity: 0.5;
|
|
1565
|
+
pointer-events: none;
|
|
1566
|
+
}
|
|
1567
|
+
.feature-status {
|
|
1568
|
+
font-size: 14px;
|
|
1569
|
+
width: 18px;
|
|
1570
|
+
text-align: center;
|
|
1571
|
+
flex-shrink: 0;
|
|
1572
|
+
}
|
|
1573
|
+
.feature-item.enabled .feature-status {
|
|
1574
|
+
color: var(--sim-success);
|
|
1575
|
+
}
|
|
1576
|
+
.feature-item.disabled .feature-status {
|
|
1577
|
+
color: var(--sim-error);
|
|
1578
|
+
opacity: 0.5;
|
|
1579
|
+
}
|
|
1580
|
+
.feature-title {
|
|
1581
|
+
font-size: 10px;
|
|
1582
|
+
color: var(--sim-text);
|
|
1583
|
+
flex: 1;
|
|
1584
|
+
}
|
|
1585
|
+
.feature-item.disabled .feature-title {
|
|
1586
|
+
color: var(--sim-text-dim);
|
|
1587
|
+
}
|
|
1588
|
+
/* Checkpoints view styles */
|
|
1589
|
+
.checkpoints-view-container {
|
|
1590
|
+
display: flex;
|
|
1591
|
+
flex-direction: column;
|
|
1592
|
+
height: 100%;
|
|
1593
|
+
overflow: hidden;
|
|
1594
|
+
}
|
|
1595
|
+
.checkpoints-header {
|
|
1596
|
+
display: flex;
|
|
1597
|
+
justify-content: space-between;
|
|
1598
|
+
align-items: center;
|
|
1599
|
+
margin-bottom: 6px;
|
|
1600
|
+
flex-shrink: 0;
|
|
1601
|
+
}
|
|
1602
|
+
.checkpoints-list {
|
|
1603
|
+
display: flex;
|
|
1604
|
+
flex-direction: column;
|
|
1605
|
+
gap: 4px;
|
|
1606
|
+
flex: 1;
|
|
1607
|
+
overflow-y: auto;
|
|
1608
|
+
}
|
|
1609
|
+
.checkpoint-item {
|
|
1610
|
+
padding: 6px;
|
|
1611
|
+
background: var(--sim-bg);
|
|
1612
|
+
border: 1px solid var(--sim-border);
|
|
1613
|
+
border-left: 3px solid var(--sim-accent);
|
|
1614
|
+
border-radius: 2px;
|
|
1615
|
+
}
|
|
1616
|
+
.checkpoint-item:hover {
|
|
1617
|
+
border-color: var(--sim-border-light);
|
|
1618
|
+
border-left-color: var(--sim-accent);
|
|
1619
|
+
}
|
|
1620
|
+
.checkpoint-header {
|
|
1621
|
+
display: flex;
|
|
1622
|
+
justify-content: space-between;
|
|
1623
|
+
align-items: center;
|
|
1624
|
+
}
|
|
1625
|
+
.checkpoint-item .simulator-deeds {
|
|
1626
|
+
margin-top: 4px;
|
|
1627
|
+
}
|
|
1628
|
+
.checkpoint-name {
|
|
1629
|
+
color: var(--sim-accent);
|
|
1630
|
+
font-weight: bold;
|
|
1631
|
+
font-size: 10px;
|
|
1632
|
+
}
|
|
1633
|
+
.checkpoint-time {
|
|
1634
|
+
color: var(--sim-text-dim);
|
|
1635
|
+
font-size: 9px;
|
|
1636
|
+
}
|
|
1637
|
+
/* Checklist view styles */
|
|
1638
|
+
.checklist-view-container {
|
|
1639
|
+
display: flex;
|
|
1640
|
+
flex-direction: column;
|
|
1641
|
+
gap: 10px;
|
|
1642
|
+
overflow-y: auto;
|
|
1643
|
+
}
|
|
1644
|
+
.checklist-header {
|
|
1645
|
+
display: flex;
|
|
1646
|
+
align-items: center;
|
|
1647
|
+
gap: 6px;
|
|
1648
|
+
padding-bottom: 4px;
|
|
1649
|
+
margin-bottom: 4px;
|
|
1650
|
+
border-bottom: 1px solid var(--sim-border);
|
|
1651
|
+
}
|
|
1652
|
+
.checklist-progress {
|
|
1653
|
+
flex: 1;
|
|
1654
|
+
color: var(--sim-text-dim);
|
|
1655
|
+
font-size: 10px;
|
|
1656
|
+
}
|
|
1657
|
+
.checklist-progress.complete {
|
|
1658
|
+
color: var(--sim-success);
|
|
1659
|
+
}
|
|
1660
|
+
.checklist-items {
|
|
1661
|
+
display: flex;
|
|
1662
|
+
flex-direction: column;
|
|
1663
|
+
gap: 1px;
|
|
1664
|
+
}
|
|
1665
|
+
.checklist-item {
|
|
1666
|
+
padding: 3px 6px;
|
|
1667
|
+
border-left: 3px solid transparent;
|
|
1668
|
+
}
|
|
1669
|
+
.checklist-item.done {
|
|
1670
|
+
opacity: 0.5;
|
|
1671
|
+
}
|
|
1672
|
+
.checklist-item.upcoming {
|
|
1673
|
+
opacity: 0.35;
|
|
1674
|
+
}
|
|
1675
|
+
.checklist-item.active {
|
|
1676
|
+
border-left-color: var(--sim-accent);
|
|
1677
|
+
background: var(--sim-bg);
|
|
1678
|
+
}
|
|
1679
|
+
.checklist-row {
|
|
1680
|
+
display: flex;
|
|
1681
|
+
align-items: center;
|
|
1682
|
+
gap: 6px;
|
|
1683
|
+
}
|
|
1684
|
+
.checklist-tick {
|
|
1685
|
+
color: var(--sim-text-dim);
|
|
1686
|
+
}
|
|
1687
|
+
.checklist-item.done .checklist-tick {
|
|
1688
|
+
color: var(--sim-success);
|
|
1689
|
+
}
|
|
1690
|
+
.checklist-title {
|
|
1691
|
+
flex: 1;
|
|
1692
|
+
color: var(--sim-text);
|
|
1693
|
+
}
|
|
1694
|
+
.checklist-item.active .checklist-title {
|
|
1695
|
+
color: var(--sim-accent);
|
|
1696
|
+
font-weight: bold;
|
|
1697
|
+
}
|
|
1698
|
+
.checklist-count {
|
|
1699
|
+
color: var(--sim-text-dim);
|
|
1700
|
+
font-size: 10px;
|
|
1701
|
+
}
|
|
1702
|
+
.checklist-help {
|
|
1703
|
+
width: 14px;
|
|
1704
|
+
height: 14px;
|
|
1705
|
+
padding: 0;
|
|
1706
|
+
border: 1px solid var(--sim-border-light);
|
|
1707
|
+
border-radius: 50%;
|
|
1708
|
+
background: transparent;
|
|
1709
|
+
color: var(--sim-text-dim);
|
|
1710
|
+
font: inherit;
|
|
1711
|
+
font-size: 9px;
|
|
1712
|
+
line-height: 12px;
|
|
1713
|
+
cursor: pointer;
|
|
1714
|
+
}
|
|
1715
|
+
.checklist-help:hover, .checklist-help.open {
|
|
1716
|
+
color: var(--sim-accent);
|
|
1717
|
+
border-color: var(--sim-accent);
|
|
1718
|
+
}
|
|
1719
|
+
.checklist-subtitle {
|
|
1720
|
+
margin: 2px 0 0 15px;
|
|
1721
|
+
color: var(--sim-text-dim);
|
|
1722
|
+
font-size: 10px;
|
|
1723
|
+
}
|
|
1724
|
+
.checklist-expand {
|
|
1725
|
+
margin: 4px 0 0 15px;
|
|
1726
|
+
padding: 4px 6px;
|
|
1727
|
+
background: var(--sim-panel);
|
|
1728
|
+
border: 1px solid var(--sim-border);
|
|
1729
|
+
border-radius: 2px;
|
|
1730
|
+
color: var(--sim-text);
|
|
1731
|
+
font: inherit;
|
|
1732
|
+
font-size: 10px;
|
|
1733
|
+
white-space: pre-wrap;
|
|
1734
|
+
text-align: left;
|
|
1735
|
+
user-select: text;
|
|
1736
|
+
}
|
|
1737
|
+
.checklist-divider {
|
|
1738
|
+
display: flex;
|
|
1739
|
+
align-items: center;
|
|
1740
|
+
gap: 6px;
|
|
1741
|
+
margin: 3px 0;
|
|
1742
|
+
color: var(--sim-text-dim);
|
|
1743
|
+
font-size: 9px;
|
|
1744
|
+
}
|
|
1745
|
+
.checklist-divider::before, .checklist-divider::after {
|
|
1746
|
+
content: "";
|
|
1747
|
+
flex: 1;
|
|
1748
|
+
border-top: 1px dashed var(--sim-border-light);
|
|
1749
|
+
}
|
|
1750
|
+
.checklist-footer {
|
|
1751
|
+
margin-top: 4px;
|
|
1752
|
+
color: var(--sim-text-dim);
|
|
1753
|
+
font-size: 9px;
|
|
1754
|
+
}
|
|
1755
|
+
.checklist-error {
|
|
1756
|
+
color: var(--sim-error);
|
|
1757
|
+
font-size: 9px;
|
|
1758
|
+
}
|
|
1759
|
+
/* Keyboard view styles */
|
|
1760
|
+
.keyboard-view-container {
|
|
1761
|
+
padding: 4px;
|
|
1762
|
+
}
|
|
1763
|
+
.sim-kb-empty {
|
|
1764
|
+
color: var(--sim-text-dim);
|
|
1765
|
+
text-align: center;
|
|
1766
|
+
padding: 16px 8px;
|
|
1767
|
+
font-size: 10px;
|
|
1768
|
+
line-height: 1.6;
|
|
1769
|
+
}
|
|
1770
|
+
.sim-kb-empty code {
|
|
1771
|
+
background: var(--sim-bg);
|
|
1772
|
+
padding: 1px 4px;
|
|
1773
|
+
border-radius: 2px;
|
|
1774
|
+
font-size: 10px;
|
|
1775
|
+
}
|
|
1776
|
+
.sim-kb {
|
|
1777
|
+
display: flex;
|
|
1778
|
+
flex-direction: column;
|
|
1779
|
+
gap: 4px;
|
|
1780
|
+
}
|
|
1781
|
+
.sim-kb-row {
|
|
1782
|
+
display: flex;
|
|
1783
|
+
justify-content: center;
|
|
1784
|
+
gap: 3px;
|
|
1785
|
+
}
|
|
1786
|
+
.sim-kb-key {
|
|
1787
|
+
min-width: 28px;
|
|
1788
|
+
height: 30px;
|
|
1789
|
+
padding: 0 4px;
|
|
1790
|
+
border: 1px solid var(--sim-border);
|
|
1791
|
+
border-radius: 3px;
|
|
1792
|
+
background: var(--sim-bg);
|
|
1793
|
+
color: var(--sim-text);
|
|
1794
|
+
font: inherit;
|
|
1795
|
+
font-size: 11px;
|
|
1796
|
+
text-transform: uppercase;
|
|
1797
|
+
cursor: pointer;
|
|
1798
|
+
display: flex;
|
|
1799
|
+
align-items: center;
|
|
1800
|
+
justify-content: center;
|
|
1801
|
+
}
|
|
1802
|
+
.sim-kb-key:hover {
|
|
1803
|
+
background: var(--sim-bg-alt);
|
|
1804
|
+
border-color: var(--sim-border-light);
|
|
1805
|
+
}
|
|
1806
|
+
.sim-kb-key:active {
|
|
1807
|
+
background: var(--sim-accent);
|
|
1808
|
+
color: var(--sim-panel);
|
|
1809
|
+
}
|
|
1810
|
+
.sim-kb-key.highlight {
|
|
1811
|
+
background: var(--sim-bg-alt);
|
|
1812
|
+
border-color: var(--sim-accent);
|
|
1813
|
+
color: var(--sim-accent);
|
|
1814
|
+
font-size: 9px;
|
|
1815
|
+
}
|
|
1816
|
+
.sim-kb-key.highlight:active {
|
|
1817
|
+
background: var(--sim-accent);
|
|
1818
|
+
color: var(--sim-panel);
|
|
1819
|
+
}
|
|
1820
|
+
.sim-kb-key.l {
|
|
1821
|
+
min-width: 40px;
|
|
1822
|
+
}
|
|
1823
|
+
.sim-kb-key.xl {
|
|
1824
|
+
min-width: 52px;
|
|
1825
|
+
}
|
|
1826
|
+
.sim-kb-key.grow {
|
|
1827
|
+
flex: 1;
|
|
1828
|
+
}
|
|
1829
|
+
.sim-kb-key.disabled {
|
|
1830
|
+
opacity: 0.3;
|
|
1831
|
+
cursor: default;
|
|
1832
|
+
}
|
|
1833
|
+
/* Settings view styles */
|
|
1834
|
+
.settings-view-container {
|
|
1835
|
+
display: flex;
|
|
1836
|
+
flex-direction: column;
|
|
1837
|
+
height: 100%;
|
|
1838
|
+
overflow-y: auto;
|
|
1839
|
+
}
|
|
1840
|
+
.sim-settings-empty {
|
|
1841
|
+
color: var(--sim-text-dim);
|
|
1842
|
+
font-size: 10px;
|
|
1843
|
+
text-align: center;
|
|
1844
|
+
padding: 20px;
|
|
1845
|
+
line-height: 1.5;
|
|
1846
|
+
}
|
|
1847
|
+
.sim-settings-heading {
|
|
1848
|
+
color: var(--sim-text);
|
|
1849
|
+
font-size: 11px;
|
|
1850
|
+
font-weight: bold;
|
|
1851
|
+
text-transform: uppercase;
|
|
1852
|
+
letter-spacing: 1px;
|
|
1853
|
+
margin: 6px 0 4px;
|
|
1854
|
+
}
|
|
1855
|
+
.sim-settings-subheading {
|
|
1856
|
+
color: var(--sim-text);
|
|
1857
|
+
font-size: 10px;
|
|
1858
|
+
font-weight: bold;
|
|
1859
|
+
margin: 4px 0 2px;
|
|
1860
|
+
}
|
|
1861
|
+
.sim-settings-paragraph {
|
|
1862
|
+
color: var(--sim-text-dim);
|
|
1863
|
+
font-size: 10px;
|
|
1864
|
+
margin: 2px 0 6px;
|
|
1865
|
+
line-height: 1.4;
|
|
1866
|
+
}
|
|
1867
|
+
.sim-settings-subtitle {
|
|
1868
|
+
color: var(--sim-text-dim);
|
|
1869
|
+
font-size: 9px;
|
|
1870
|
+
margin: -2px 0 3px;
|
|
1871
|
+
line-height: 1.3;
|
|
1872
|
+
}
|
|
1873
|
+
.sim-settings-row {
|
|
1874
|
+
display: flex;
|
|
1875
|
+
align-items: baseline;
|
|
1876
|
+
gap: 6px;
|
|
1877
|
+
cursor: pointer;
|
|
1878
|
+
}
|
|
1879
|
+
.sim-settings-row .simulator-label {
|
|
1880
|
+
margin-bottom: 0;
|
|
1881
|
+
}
|
|
1882
|
+
.sim-settings-split {
|
|
1883
|
+
display: flex;
|
|
1884
|
+
gap: 8px;
|
|
1885
|
+
}
|
|
1886
|
+
.sim-settings-split > * {
|
|
1887
|
+
flex: 1;
|
|
1888
|
+
}
|
|
1889
|
+
.sim-settings-unsupported {
|
|
1890
|
+
color: var(--sim-text-dim);
|
|
1891
|
+
font-size: 9px;
|
|
1892
|
+
font-style: italic;
|
|
1893
|
+
margin: 4px 0;
|
|
1894
|
+
}
|
|
1895
|
+
.sim-settings-actions {
|
|
1896
|
+
margin-top: 8px;
|
|
1897
|
+
padding-top: 8px;
|
|
1898
|
+
border-top: 2px solid var(--sim-border);
|
|
1899
|
+
}
|
|
1900
|
+
</style>
|
|
1901
|
+
<div id="simulator-panel" class="${h.isCollapsed?`collapsed`:``}">
|
|
1902
|
+
<div id="simulator-header">
|
|
1903
|
+
<span id="simulator-title">PUZZMO SIMULATOR</span>
|
|
1904
|
+
<span class="header-sep">|</span>
|
|
1905
|
+
<div id="simulator-timer">--:--</div>
|
|
1906
|
+
<span class="header-sep">|</span>
|
|
1907
|
+
<div id="simulator-header-controls">
|
|
1908
|
+
<button id="simulator-header-pause" class="header-icon-btn" title="Pause" disabled>${g.pause}</button>
|
|
1909
|
+
<button id="simulator-header-retry" class="header-icon-btn" title="Retry" disabled>${g.retry}</button>
|
|
1910
|
+
</div>
|
|
1911
|
+
<span class="header-sep">|</span>
|
|
1912
|
+
<div id="simulator-header-status">
|
|
1913
|
+
<span id="simulator-header-indicator" class="waiting"></span>
|
|
1914
|
+
<span id="simulator-header-status-text">Waiting...</span>
|
|
1915
|
+
</div>
|
|
1916
|
+
<span class="header-spacer"></span>
|
|
1917
|
+
<button id="simulator-header-settings" class="header-icon-btn" title="Settings">${g.cog}</button>
|
|
1918
|
+
<button id="simulator-toggle" class="header-icon-btn" title="Minimize">${g.minimize}</button>
|
|
1919
|
+
</div>
|
|
1920
|
+
<div id="simulator-body">
|
|
1921
|
+
<div id="simulator-tabs">
|
|
1922
|
+
${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(``)}
|
|
1923
|
+
</div>
|
|
1924
|
+
<div id="simulator-content" class="hidden">
|
|
1925
|
+
${p.map(e=>`<div id="simulator-tab-${e.id}" class="simulator-tab-content">${e.render()}</div>`).join(``)}
|
|
1926
|
+
</div>
|
|
1927
|
+
</div>
|
|
1928
|
+
</div>
|
|
1929
|
+
`,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`),O=_.querySelector(`#simulator-content`),k=e=>_.querySelector(e),A=e=>{S.innerHTML=e?g.play:g.pause,S.title=e?`Resume`:`Pause`},j=(e,t)=>{let n=k(`#simulator-status .text`),r=k(`#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},P=(e,t)=>{t&&t!==`0`?E.innerHTML=`${e}<span class="penalty">+${t}</span>`:E.textContent=e},F=e=>{var t;h.activeTab=e,O.classList.remove(`hidden`),ne(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,H)},I=e=>{h.isCollapsed=e,v.classList.toggle(`collapsed`,e),te(e),e?(O.classList.add(`hidden`),D.querySelectorAll(`.simulator-tab`).forEach(e=>e.classList.remove(`active`))):F(h.activeTab)},L=()=>{f.updatePreview(H)},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=k(`#simulator-puzzle`);return o&&(o.value=h.originalPuzzle),h.activeTab===`thumb`&&L(),h.puzzleData});return function(){return e.apply(this,arguments)}}(),z=re(e=>{d.addLogEntry(e,H)}),B=(e,t)=>{M(e,t,z)},V=(e,t)=>{let n=_.querySelector(`[data-badge="${e}"]`);n&&(n.textContent=t&&t>0?String(t):``)},H={state:h,getElement:k,sendToGame:B,logMessage:z.log,loadPuzzle:R,updateStatus:j,updateTimer:P,setCollapsed:I,switchTab:F,updateThumbnail:L,updateBadge:V,fixtures:l,fixtureCategories:u,gameSlug:(s=e.slug)==null?null:s};console.log(`[Simulator] Context created with gameSlug:`,H.gameSlug),p.forEach(e=>e.bind(H)),D.querySelectorAll(`.simulator-tab`).forEach(e=>{e.addEventListener(`click`,()=>{let t=e.getAttribute(`data-tab`);F(t),V(t,0)})}),T.addEventListener(`click`,e=>{e.stopPropagation(),I(!0)}),S.addEventListener(`click`,e=>{e.stopPropagation(),h.isPaused?(B(`RESUME_GAME`,{}),h.isPaused=!1,A(!1),j(`Running`,`ready`)):(B(`PAUSE_GAME`,{}),h.isPaused=!0,A(!0),j(`Paused`,`paused`));let t=k(`#simulator-pause`);t&&(t.textContent=h.isPaused?`Resume`:`Pause`)}),C.addEventListener(`click`,e=>{e.stopPropagation(),B(`RETRY_PUZZLE`,{}),h.hasStarted=!1,h.isPaused=!1,A(!1),S.disabled=!0,j(`Ready to retry`,`ready`);let t=k(`#simulator-pause`),n=k(`#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 U=new URLSearchParams(window.location.search);(U.has(`code`)||U.has(`error`))&&(I(!1),F(`auth`));let ce=e=>{let t={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},n={id:`simulator-puzzle`,name:`Proto Jig Puzzle`,puzzle:e,mostRecentDaily:null};return{userState:{gameSettings:{"proto-game":h.gameSettings},id:`simulator-user`,ownerID:`simulator-owner`},currentUser:{id:`simulator-user`,name:`Simulator`,username:`simulator`,usernameID:`0000`,type:`User`,roles:``},game:Kt,session:{gameplay:t,puzzle:n},theme:h.selectedTheme,hostContext:h.hostContext,appRuntimeContract:`1.0`}},W=function(){var e=n.t(function*(e){j(`Loading puzzle...`,`waiting`);try{let n=t.t(t.t({},ce(yield R())),{},{appRuntimeContract:e});j(`Sending READY_DATA...`,`waiting`),B(`READY_DATA`,n),j(`Waiting for game to load...`,`waiting`)}catch(e){j(`Error: ${e}`,`paused`)}});return function(t){return e.apply(this,arguments)}}(),G=()=>{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,H)}),c&&!h.hasStarted&&setTimeout(()=>{let e=k(`#simulator-start`);e==null||e.click(),S.disabled=!1,h.hasStarted=!0,j(`Running`,`ready`)},100)};return N((e,t)=>{var n,r;if(e===`READY`){console.log(`Simulator: Received READY from game`),W((t==null?void 0:t.runtimeContract)===`1.1`?`1.1`:`1.0`);return}if(e===`READY_GAME_LOADED`){G();return}if(e===`TIMER_TICK`){if(t!=null&&t.display){let[e,n]=t.display;P(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,H)});let i=(n=t==null||(r=t.input)==null?void 0:r.boardState)==null?t==null?void 0:t.boardState:n;e===`UPLOAD_NEW_GAME_STATE`&&i&&(h.currentInputStr=i,h.activeTab===`thumb`&&L(),console.log(`Simulator: Game state uploaded`,t)),e===`GAME_COMPLETED`&&(console.log(`Simulator: Game completed!`,t),S.disabled=!0,h.hasStarted=!1,j(`Completed!`,`complete`))},z),console.log(`Simulator initialized`),$={updateFixtures:e=>{l=ie(e),u=Array.from(l.keys()).sort(),H.fixtures=l,H.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(H),console.log(`Simulator: Fixtures updated`,{categories:u,selectedCategory:h.selectedCategory})},sendToGame:B,loadPuzzle:R},$}var Kt={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 Bt}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Gt}});
|
|
1930
|
+
//# sourceMappingURL=createSimulator-Ce3StrQI.cjs.map
|