code-playpad 0.14.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +88 -7
  2. package/dist/THIRD-PARTY-NOTICES.txt +25 -0
  3. package/dist/{boot-DW1YzgCY.js → boot-BjUY1Ie7.js} +1 -1
  4. package/dist/cdn.js +2 -2
  5. package/dist/clike-C2M2Cbvf.js +6 -0
  6. package/dist/{compiler-D7kIFltD.js → compiler-UMrA2h8r.js} +1 -1
  7. package/dist/compiler-cache-XwslsU5H.js +6 -0
  8. package/dist/compiler-license-manifest.json +11 -8
  9. package/dist/config-3Z6xX6Jr.js +6 -0
  10. package/dist/cpp-BxFy0NSM.js +6 -0
  11. package/dist/cpp-CDeK5gz8.js +1 -0
  12. package/dist/csharp-ByGGaB0V.js +6 -0
  13. package/dist/csharp-D2mcw4Xx.js +1 -0
  14. package/dist/{element-BuS9dUwa.js → element-Biju-4SA.js} +3 -3
  15. package/dist/element.js +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/{java-DjuG1fCk.js → java-2z8CcJaR.js} +1 -1
  19. package/dist/{java-DkfYRvpA.js → java-cevrzY6x.js} +1 -1
  20. package/dist/{javascript-BSjoEAXh.js → javascript-DZlNZDDe.js} +1 -1
  21. package/dist/{javascript-BBiCDtZ3.js → javascript-kqyWH6DS.js} +1 -1
  22. package/dist/{next-9Fyfv6iD.js → next-CKL809hs.js} +1 -1
  23. package/dist/{next-CO6N0Gb9.js → next-Cb5W_u4U.js} +1 -1
  24. package/dist/next-vendor.generated-CZBsaQeS.js +6 -0
  25. package/dist/{pyodide-QurAOd7j.js → pyodide-C5KhmXre.js} +1 -1
  26. package/dist/{pyodide-ZBchw4qA.js → pyodide-DJAtHIb8.js} +1 -1
  27. package/dist/{react-DgCTfCMl.js → react-BKPRfjtf.js} +1 -1
  28. package/dist/{react-DI6SODv8.js → react-SfE82Kr_.js} +1 -1
  29. package/dist/react.js +1 -1
  30. package/dist/runtime/config.d.ts +12 -0
  31. package/dist/runtime/csharp/cache.d.ts +2 -0
  32. package/dist/runtime/csharp/project.d.ts +5 -0
  33. package/dist/runtime/csharp/worker.d.ts +1 -0
  34. package/dist/runtime/csharp-worker.generated.d.ts +1 -0
  35. package/dist/runtime/csharp.d.ts +2 -0
  36. package/dist/runtime/next-vendor.generated.d.ts +2 -2
  37. package/dist/runtime/worker-runtime.d.ts +8 -0
  38. package/dist/standalone.js +10 -10
  39. package/dist/worker-runtime-Ub9rvLo_.js +9 -0
  40. package/dist/worker-runtime-dxTpNm5e.js +4 -0
  41. package/package.json +9 -3
  42. package/dist/config-DB58UVsk.js +0 -6
  43. package/dist/cpp-Bhr_Zgfk.js +0 -6
  44. package/dist/cpp-C8YnpTSR.js +0 -1
  45. package/dist/next-vendor.generated-DcyCefTD.js +0 -6
  46. package/dist/worker-runtime-Dd2eBtq3.js +0 -4
  47. package/dist/worker-runtime-DvpugeXD.js +0 -9
@@ -3,7 +3,7 @@
3
3
  * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
4
  * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
5
  */
6
- import{s as e}from"./config-DB58UVsk.js";import{t}from"./worker-runtime-DvpugeXD.js";var n=`let pyodide=null,stdinLines=[],stdinExhausted=!1,currentId=null,interactive=!1,inputWaitMs=0,nextRequest=1;const pendingLines=new Map,MOUNT="/home/pyodide/playground";let written=new Set,internals=null;const REFRESH=["import importlib, os, sys","MOUNT = "+JSON.stringify(MOUNT),"os.makedirs(MOUNT, exist_ok=True)","sys.path.insert(0, MOUNT) if MOUNT not in sys.path else None","os.chdir(MOUNT)","for _name, _mod in list(sys.modules.items()):",' _file = getattr(_mod, "__file__", None) or ""',' _paths = list(getattr(_mod, "__path__", None) or [])'," if _file.startswith(MOUNT) or any(str(p).startswith(MOUNT) for p in _paths):"," del sys.modules[_name]","importlib.invalidate_caches()"].join(\`
6
+ import{l as e}from"./config-3Z6xX6Jr.js";import{t}from"./worker-runtime-Ub9rvLo_.js";var n=`let pyodide=null,stdinLines=[],stdinExhausted=!1,currentId=null,interactive=!1,inputWaitMs=0,nextRequest=1;const pendingLines=new Map,MOUNT="/home/pyodide/playground";let written=new Set,internals=null;const REFRESH=["import importlib, os, sys","MOUNT = "+JSON.stringify(MOUNT),"os.makedirs(MOUNT, exist_ok=True)","sys.path.insert(0, MOUNT) if MOUNT not in sys.path else None","os.chdir(MOUNT)","for _name, _mod in list(sys.modules.items()):",' _file = getattr(_mod, "__file__", None) or ""',' _paths = list(getattr(_mod, "__path__", None) or [])'," if _file.startswith(MOUNT) or any(str(p).startswith(MOUNT) for p in _paths):"," del sys.modules[_name]","importlib.invalidate_caches()"].join(\`
7
7
  \`);function flushStreams(){try{pyodide.runPython(\`import sys
8
8
  sys.stdout.flush()
9
9
  sys.stderr.flush()\`,{globals:internals})}catch{}flushOutput()}const INPUT_OVERRIDE=["import builtins, sys, js","from pyodide.ffi import run_sync","",'def _pg_input(prompt=""):',' if prompt != "":'," sys.stdout.write(str(prompt))"," sys.stdout.flush()"," line = run_sync(js._pgReadLine())"," # Pyodide maps JS null to its own JsNull singleton, not None, so test"," # for what we want rather than for the several ways EOF can arrive."," if not isinstance(line, str):",' raise EOFError("EOF when reading a line")'," return line","",'_pg_input.__name__ = "input"','_pg_input.__qualname__ = "input"',"_pg_input.__doc__ = builtins.input.__doc__","builtins.input = _pg_input"].join(\`
@@ -1,4 +1,4 @@
1
- import{s as e}from"./config-DB58UVsk.js";import{t}from"./worker-runtime-Dd2eBtq3.js";var n=`let pyodide=null,stdinLines=[],stdinExhausted=!1,currentId=null,interactive=!1,inputWaitMs=0,nextRequest=1;const pendingLines=new Map,MOUNT="/home/pyodide/playground";let written=new Set,internals=null;const REFRESH=["import importlib, os, sys","MOUNT = "+JSON.stringify(MOUNT),"os.makedirs(MOUNT, exist_ok=True)","sys.path.insert(0, MOUNT) if MOUNT not in sys.path else None","os.chdir(MOUNT)","for _name, _mod in list(sys.modules.items()):",' _file = getattr(_mod, "__file__", None) or ""',' _paths = list(getattr(_mod, "__path__", None) or [])'," if _file.startswith(MOUNT) or any(str(p).startswith(MOUNT) for p in _paths):"," del sys.modules[_name]","importlib.invalidate_caches()"].join(\`
1
+ import{l as e}from"./config-3Z6xX6Jr.js";import{t}from"./worker-runtime-dxTpNm5e.js";var n=`let pyodide=null,stdinLines=[],stdinExhausted=!1,currentId=null,interactive=!1,inputWaitMs=0,nextRequest=1;const pendingLines=new Map,MOUNT="/home/pyodide/playground";let written=new Set,internals=null;const REFRESH=["import importlib, os, sys","MOUNT = "+JSON.stringify(MOUNT),"os.makedirs(MOUNT, exist_ok=True)","sys.path.insert(0, MOUNT) if MOUNT not in sys.path else None","os.chdir(MOUNT)","for _name, _mod in list(sys.modules.items()):",' _file = getattr(_mod, "__file__", None) or ""',' _paths = list(getattr(_mod, "__path__", None) or [])'," if _file.startswith(MOUNT) or any(str(p).startswith(MOUNT) for p in _paths):"," del sys.modules[_name]","importlib.invalidate_caches()"].join(\`
2
2
  \`);function flushStreams(){try{pyodide.runPython(\`import sys
3
3
  sys.stdout.flush()
4
4
  sys.stderr.flush()\`,{globals:internals})}catch{}flushOutput()}const INPUT_OVERRIDE=["import builtins, sys, js","from pyodide.ffi import run_sync","",'def _pg_input(prompt=""):',' if prompt != "":'," sys.stdout.write(str(prompt))"," sys.stdout.flush()"," line = run_sync(js._pgReadLine())"," # Pyodide maps JS null to its own JsNull singleton, not None, so test"," # for what we want rather than for the several ways EOF can arrive."," if not isinstance(line, str):",' raise EOFError("EOF when reading a line")'," return line","",'_pg_input.__name__ = "input"','_pg_input.__qualname__ = "input"',"_pg_input.__doc__ = builtins.input.__doc__","builtins.input = _pg_input"].join(\`
@@ -3,4 +3,4 @@
3
3
  * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
4
  * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
5
  */
6
- import{t as e}from"./react-version.generated-BNNJmf7J.js";import{c as t}from"./config-DB58UVsk.js";import{n,t as r}from"./boot-nmFndPHW.js";var i=[`src/main.jsx`,`src/main.js`],a=`<!doctype html><html lang="en"><head><meta charset="utf-8"></head><body><div id="root"></div></body></html>`;function o(e){return/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}function s(e,n,s){let{CompileError:c,compileProject:l,resolveImport:u}=s,d=n.endsWith(`.html`)?n:`index.html`,f=Object.hasOwn(e,d),p=new DOMParser().parseFromString(f?e[d]:a,`text/html`),m=[];if(f){let t=[...p.querySelectorAll(`script[src], link[rel="stylesheet"][href]`)],n=[];for(let r of t){let t=r.tagName===`SCRIPT`,i=r.getAttribute(t?`src`:`href`);if(o(i))throw new c(d,`This project can't load "${i}". The preview can only use the project's own files.`);let a=u(e,d,i);if(!a)throw new c(d,`The file "${i}" does not exist.`);(t?n:m).push(a),r.remove()}if(!n.length)throw new c(d,`Add <script type="module" src="/src/main.jsx"><\/script> so the app has an entry file.`);m.push(...n)}else{let t=n.endsWith(`.html`)?void 0:Object.hasOwn(e,n)?n:i.find(t=>Object.hasOwn(e,t));if(!t)throw new c(`index.html`,`This project has no entry file. Add src/main.jsx.`);m.push(t)}let h=l(e,m),{nonce:g,runtimeURL:_}=t(),v=p.createElement(`meta`);v.httpEquiv=`Content-Security-Policy`,v.content=`default-src 'none'; script-src 'unsafe-inline'${_?` ${_}`:``}; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`;let y=p.createElement(`script`);return g&&y.setAttribute(`nonce`,g),y.textContent=r,p.head.prepend(v,y),{html:`<!doctype html>${p.documentElement.outerHTML}`,modules:h,entries:m}}var c=new class{id=`react`;label=`React ${e}`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`./dist-BwlTZqCY.js`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{let e=import(`./compiler-A2mqXrqO.js`),n=t().runtimeURL?null:import(`./react-vendor.generated-DMxIoCMn.js`);this.#t=(await n)?.REACT_VENDOR_SOURCE??null,this.#e=await e}catch(e){throw this.#n=null,Error(`The React runtime could not be loaded. Check your connection and reload the page. (${e.message})`)}})(),this.#n}run(e,r={}){let i=r.preview;if(!i)return Promise.reject(/* @__PURE__ */ Error(`React needs a <code-playpad> widget to render in.`));this.dispose(i.host);let a,o=r.files??{},s=new Promise((e,r)=>{let o=t().runtimeURL;a=new n(i,{...o?{runtimeURL:o}:{vendor:this.#t},nonce:t().nonce},e,r)});return this.#r.set(i.host,a),this.#i.set(s,a),this.#a(a,o,r.entry??`index.html`),s}async#a(e,t,n){try{await this.load();let r=this.#e,i;try{i=s(t,n,r)}catch(t){if(t instanceof r.CompileError){e.fail(t.reason,{file:t.file,...t.line?{line:t.line}:{},...t.column?{column:t.column}:{}},t.hint),e.showCompileBanner(t.hint);return}throw t}e.payload.modules=i.modules,e.payload.entries=i.entries,e.open(i.html)}catch(t){e.fail(t.message)}}stop(e){e&&this.#i.get(e)?.dispose(!0)}hasLivePreview(e){return this.#r.get(e)?.live??!1}dispose(e){this.#r.get(e)?.dispose(!0),this.#r.delete(e)}};export{c as reactRuntime};
6
+ import{t as e}from"./react-version.generated-BNNJmf7J.js";import{u as t}from"./config-3Z6xX6Jr.js";import{n,t as r}from"./boot-nmFndPHW.js";var i=[`src/main.jsx`,`src/main.js`],a=`<!doctype html><html lang="en"><head><meta charset="utf-8"></head><body><div id="root"></div></body></html>`;function o(e){return/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}function s(e,n,s){let{CompileError:c,compileProject:l,resolveImport:u}=s,d=n.endsWith(`.html`)?n:`index.html`,f=Object.hasOwn(e,d),p=new DOMParser().parseFromString(f?e[d]:a,`text/html`),m=[];if(f){let t=[...p.querySelectorAll(`script[src], link[rel="stylesheet"][href]`)],n=[];for(let r of t){let t=r.tagName===`SCRIPT`,i=r.getAttribute(t?`src`:`href`);if(o(i))throw new c(d,`This project can't load "${i}". The preview can only use the project's own files.`);let a=u(e,d,i);if(!a)throw new c(d,`The file "${i}" does not exist.`);(t?n:m).push(a),r.remove()}if(!n.length)throw new c(d,`Add <script type="module" src="/src/main.jsx"><\/script> so the app has an entry file.`);m.push(...n)}else{let t=n.endsWith(`.html`)?void 0:Object.hasOwn(e,n)?n:i.find(t=>Object.hasOwn(e,t));if(!t)throw new c(`index.html`,`This project has no entry file. Add src/main.jsx.`);m.push(t)}let h=l(e,m),{nonce:g,runtimeURL:_}=t(),v=p.createElement(`meta`);v.httpEquiv=`Content-Security-Policy`,v.content=`default-src 'none'; script-src 'unsafe-inline'${_?` ${_}`:``}; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`;let y=p.createElement(`script`);return g&&y.setAttribute(`nonce`,g),y.textContent=r,p.head.prepend(v,y),{html:`<!doctype html>${p.documentElement.outerHTML}`,modules:h,entries:m}}var c=new class{id=`react`;label=`React ${e}`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`./dist-BwlTZqCY.js`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{let e=import(`./compiler-A2mqXrqO.js`),n=t().runtimeURL?null:import(`./react-vendor.generated-DMxIoCMn.js`);this.#t=(await n)?.REACT_VENDOR_SOURCE??null,this.#e=await e}catch(e){throw this.#n=null,Error(`The React runtime could not be loaded. Check your connection and reload the page. (${e.message})`)}})(),this.#n}run(e,r={}){let i=r.preview;if(!i)return Promise.reject(/* @__PURE__ */ Error(`React needs a <code-playpad> widget to render in.`));this.dispose(i.host);let a,o=r.files??{},s=new Promise((e,r)=>{let o=t().runtimeURL;a=new n(i,{...o?{runtimeURL:o}:{vendor:this.#t},nonce:t().nonce},e,r)});return this.#r.set(i.host,a),this.#i.set(s,a),this.#a(a,o,r.entry??`index.html`),s}async#a(e,t,n){try{await this.load();let r=this.#e,i;try{i=s(t,n,r)}catch(t){if(t instanceof r.CompileError){e.fail(t.reason,{file:t.file,...t.line?{line:t.line}:{},...t.column?{column:t.column}:{}},t.hint),e.showCompileBanner(t.hint);return}throw t}e.payload.modules=i.modules,e.payload.entries=i.entries,e.open(i.html)}catch(t){e.fail(t.message)}}stop(e){e&&this.#i.get(e)?.dispose(!0)}hasLivePreview(e){return this.#r.get(e)?.live??!1}dispose(e){this.#r.get(e)?.dispose(!0),this.#r.delete(e)}};export{c as reactRuntime};
@@ -1 +1 @@
1
- import{t as e}from"./react-version.generated-BNNJmf7J.js";import{c as t}from"./config-DB58UVsk.js";import{n,t as r}from"./boot-DW1YzgCY.js";var i=[`src/main.jsx`,`src/main.js`],a=`<!doctype html><html lang="en"><head><meta charset="utf-8"></head><body><div id="root"></div></body></html>`;function o(e){return/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}function s(e,n,s){let{CompileError:c,compileProject:l,resolveImport:u}=s,d=n.endsWith(`.html`)?n:`index.html`,f=Object.hasOwn(e,d),p=new DOMParser().parseFromString(f?e[d]:a,`text/html`),m=[];if(f){let t=[...p.querySelectorAll(`script[src], link[rel="stylesheet"][href]`)],n=[];for(let r of t){let t=r.tagName===`SCRIPT`,i=r.getAttribute(t?`src`:`href`);if(o(i))throw new c(d,`This project can't load "${i}". The preview can only use the project's own files.`);let a=u(e,d,i);if(!a)throw new c(d,`The file "${i}" does not exist.`);(t?n:m).push(a),r.remove()}if(!n.length)throw new c(d,`Add <script type="module" src="/src/main.jsx"><\/script> so the app has an entry file.`);m.push(...n)}else{let t=n.endsWith(`.html`)?void 0:Object.hasOwn(e,n)?n:i.find(t=>Object.hasOwn(e,t));if(!t)throw new c(`index.html`,`This project has no entry file. Add src/main.jsx.`);m.push(t)}let h=l(e,m),{nonce:g,runtimeURL:_}=t(),v=p.createElement(`meta`);v.httpEquiv=`Content-Security-Policy`,v.content=`default-src 'none'; script-src 'unsafe-inline'${_?` ${_}`:``}; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`;let y=p.createElement(`script`);return g&&y.setAttribute(`nonce`,g),y.textContent=r,p.head.prepend(v,y),{html:`<!doctype html>${p.documentElement.outerHTML}`,modules:h,entries:m}}var c=new class{id=`react`;label=`React ${e}`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`@codemirror/lang-javascript`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{let e=import(`./compiler-A2mqXrqO.js`),n=t().runtimeURL?null:import(`./react-vendor.generated-DMxIoCMn.js`);this.#t=(await n)?.REACT_VENDOR_SOURCE??null,this.#e=await e}catch(e){throw this.#n=null,Error(`The React runtime could not be loaded. Check your connection and reload the page. (${e.message})`)}})(),this.#n}run(e,r={}){let i=r.preview;if(!i)return Promise.reject(/* @__PURE__ */ Error(`React needs a <code-playpad> widget to render in.`));this.dispose(i.host);let a,o=r.files??{},s=new Promise((e,r)=>{let o=t().runtimeURL;a=new n(i,{...o?{runtimeURL:o}:{vendor:this.#t},nonce:t().nonce},e,r)});return this.#r.set(i.host,a),this.#i.set(s,a),this.#a(a,o,r.entry??`index.html`),s}async#a(e,t,n){try{await this.load();let r=this.#e,i;try{i=s(t,n,r)}catch(t){if(t instanceof r.CompileError){e.fail(t.reason,{file:t.file,...t.line?{line:t.line}:{},...t.column?{column:t.column}:{}},t.hint),e.showCompileBanner(t.hint);return}throw t}e.payload.modules=i.modules,e.payload.entries=i.entries,e.open(i.html)}catch(t){e.fail(t.message)}}stop(e){e&&this.#i.get(e)?.dispose(!0)}hasLivePreview(e){return this.#r.get(e)?.live??!1}dispose(e){this.#r.get(e)?.dispose(!0),this.#r.delete(e)}};export{c as reactRuntime};
1
+ import{t as e}from"./react-version.generated-BNNJmf7J.js";import{u as t}from"./config-3Z6xX6Jr.js";import{n,t as r}from"./boot-BjUY1Ie7.js";var i=[`src/main.jsx`,`src/main.js`],a=`<!doctype html><html lang="en"><head><meta charset="utf-8"></head><body><div id="root"></div></body></html>`;function o(e){return/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}function s(e,n,s){let{CompileError:c,compileProject:l,resolveImport:u}=s,d=n.endsWith(`.html`)?n:`index.html`,f=Object.hasOwn(e,d),p=new DOMParser().parseFromString(f?e[d]:a,`text/html`),m=[];if(f){let t=[...p.querySelectorAll(`script[src], link[rel="stylesheet"][href]`)],n=[];for(let r of t){let t=r.tagName===`SCRIPT`,i=r.getAttribute(t?`src`:`href`);if(o(i))throw new c(d,`This project can't load "${i}". The preview can only use the project's own files.`);let a=u(e,d,i);if(!a)throw new c(d,`The file "${i}" does not exist.`);(t?n:m).push(a),r.remove()}if(!n.length)throw new c(d,`Add <script type="module" src="/src/main.jsx"><\/script> so the app has an entry file.`);m.push(...n)}else{let t=n.endsWith(`.html`)?void 0:Object.hasOwn(e,n)?n:i.find(t=>Object.hasOwn(e,t));if(!t)throw new c(`index.html`,`This project has no entry file. Add src/main.jsx.`);m.push(t)}let h=l(e,m),{nonce:g,runtimeURL:_}=t(),v=p.createElement(`meta`);v.httpEquiv=`Content-Security-Policy`,v.content=`default-src 'none'; script-src 'unsafe-inline'${_?` ${_}`:``}; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`;let y=p.createElement(`script`);return g&&y.setAttribute(`nonce`,g),y.textContent=r,p.head.prepend(v,y),{html:`<!doctype html>${p.documentElement.outerHTML}`,modules:h,entries:m}}var c=new class{id=`react`;label=`React ${e}`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`@codemirror/lang-javascript`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{let e=import(`./compiler-A2mqXrqO.js`),n=t().runtimeURL?null:import(`./react-vendor.generated-DMxIoCMn.js`);this.#t=(await n)?.REACT_VENDOR_SOURCE??null,this.#e=await e}catch(e){throw this.#n=null,Error(`The React runtime could not be loaded. Check your connection and reload the page. (${e.message})`)}})(),this.#n}run(e,r={}){let i=r.preview;if(!i)return Promise.reject(/* @__PURE__ */ Error(`React needs a <code-playpad> widget to render in.`));this.dispose(i.host);let a,o=r.files??{},s=new Promise((e,r)=>{let o=t().runtimeURL;a=new n(i,{...o?{runtimeURL:o}:{vendor:this.#t},nonce:t().nonce},e,r)});return this.#r.set(i.host,a),this.#i.set(s,a),this.#a(a,o,r.entry??`index.html`),s}async#a(e,t,n){try{await this.load();let r=this.#e,i;try{i=s(t,n,r)}catch(t){if(t instanceof r.CompileError){e.fail(t.reason,{file:t.file,...t.line?{line:t.line}:{},...t.column?{column:t.column}:{}},t.hint),e.showCompileBanner(t.hint);return}throw t}e.payload.modules=i.modules,e.payload.entries=i.entries,e.open(i.html)}catch(t){e.fail(t.message)}}stop(e){e&&this.#i.get(e)?.dispose(!0)}hasLivePreview(e){return this.#r.get(e)?.live??!1}dispose(e){this.#r.get(e)?.dispose(!0),this.#r.delete(e)}};export{c as reactRuntime};
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{n as e}from"./element-BuS9dUwa.js";import{useEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";e();function i({code:e=``,files:i,entry:a,stdin:o,language:s=`python`,height:c,minHeight:l,maxHeight:u,previewHeight:d,treeWidth:f,fileView:p,openFile:m,theme:h=`auto`,themeControls:g=!0,readOnly:_,autoRun:v,persist:y,practice:b,className:x,style:S,onReady:C,onRun:w,onOutput:T,onError:E}){let D=n(null),O=n({onReady:C,onRun:w,onOutput:T,onError:E});O.current={onReady:C,onRun:w,onOutput:T,onError:E},t(()=>{let e=D.current;if(!e)return;let t=(t,n)=>{let r=e=>n(O.current)?.(e.detail);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},n=[t(`py-ready`,e=>e.onReady),t(`py-run`,e=>e.onRun),t(`py-output`,e=>e.onOutput),t(`py-error`,e=>e.onError)];return()=>n.forEach(e=>e())},[]);let k=i?JSON.stringify(i):null;t(()=>{let t=D.current;t&&(k?t.files=JSON.parse(k):e!==t.code&&(t.code=e))},[e,k]),t(()=>{D.current&&o!==void 0&&(D.current.stdin=o)},[o]);let A=b?JSON.stringify(b):null;return t(()=>{D.current&&(D.current.practice=A?JSON.parse(A):null)},[A]),/* @__PURE__ */ r(`code-playpad`,{ref:D,language:s,theme:h,"theme-controls":g?void 0:`off`,class:x,style:S,...c===void 0?{}:{height:String(c)},...l===void 0?{}:{"min-height":String(l)},...u===void 0?{}:{"max-height":String(u)},...d===void 0?{}:{"preview-height":String(d)},...f===void 0?{}:{"tree-width":String(f)},...p?{"file-view":p}:{},...m?{"open-file":m}:{},..._?{readonly:``}:{},...v?{autorun:``}:{},...y?{persist:y}:{},...a?{entry:a}:{},children:i?null:e})}export{i as CodePlayPad,i as default};
1
+ import{n as e}from"./element-Biju-4SA.js";import{useEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";e();function i({code:e=``,files:i,entry:a,stdin:o,language:s=`python`,height:c,minHeight:l,maxHeight:u,previewHeight:d,treeWidth:f,fileView:p,openFile:m,theme:h=`auto`,themeControls:g=!0,readOnly:_,autoRun:v,persist:y,practice:b,className:x,style:S,onReady:C,onRun:w,onOutput:T,onError:E}){let D=n(null),O=n({onReady:C,onRun:w,onOutput:T,onError:E});O.current={onReady:C,onRun:w,onOutput:T,onError:E},t(()=>{let e=D.current;if(!e)return;let t=(t,n)=>{let r=e=>n(O.current)?.(e.detail);return e.addEventListener(t,r),()=>e.removeEventListener(t,r)},n=[t(`py-ready`,e=>e.onReady),t(`py-run`,e=>e.onRun),t(`py-output`,e=>e.onOutput),t(`py-error`,e=>e.onError)];return()=>n.forEach(e=>e())},[]);let k=i?JSON.stringify(i):null;t(()=>{let t=D.current;t&&(k?t.files=JSON.parse(k):e!==t.code&&(t.code=e))},[e,k]),t(()=>{D.current&&o!==void 0&&(D.current.stdin=o)},[o]);let A=b?JSON.stringify(b):null;return t(()=>{D.current&&(D.current.practice=A?JSON.parse(A):null)},[A]),/* @__PURE__ */ r(`code-playpad`,{ref:D,language:s,theme:h,"theme-controls":g?void 0:`off`,class:x,style:S,...c===void 0?{}:{height:String(c)},...l===void 0?{}:{"min-height":String(l)},...u===void 0?{}:{"max-height":String(u)},...d===void 0?{}:{"preview-height":String(d)},...f===void 0?{}:{"tree-width":String(f)},...p?{"file-view":p}:{},...m?{"open-file":m}:{},..._?{readonly:``}:{},...v?{autorun:``}:{},...y?{persist:y}:{},...a?{entry:a}:{},children:i?null:e})}export{i as CodePlayPad,i as default};
@@ -43,6 +43,18 @@ export declare function configureCpp(options: {
43
43
  timeoutMs?: number;
44
44
  }): void;
45
45
  export declare function getCppConfig(): Readonly<typeof cppConfig>;
46
+ /** External compiler assets, loaded on the first C# Run only. Pinned, and every
47
+ * file is still checked by SHA-256. */
48
+ export declare const CSHARP_TOOLCHAIN_URL = "https://cdn.jsdelivr.net/npm/@code-playpad/csharp-toolchain@0.1.0/dist/";
49
+ declare let csharpConfig: {
50
+ indexURL?: string;
51
+ timeoutMs: number;
52
+ };
53
+ export declare function configureCSharp(options: {
54
+ indexURL?: string;
55
+ timeoutMs?: number;
56
+ }): void;
57
+ export declare function getCSharpConfig(): Readonly<typeof csharpConfig>;
46
58
  export { REACT_VERSION };
47
59
  /** React previews need no configuration. `runtimeURL` loads React in the frame
48
60
  * from a URL of your own (`dist/react-runtime-<version>.js`) instead of sending
@@ -0,0 +1,2 @@
1
+ /** Apart from compiler-cache.ts, so the generated C/C++ worker stays byte-identical. */
2
+ export declare const CSHARP_CACHE = "code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1";
@@ -0,0 +1,5 @@
1
+ import type { Files } from '../../types.js';
2
+ export declare function csharpProject(code: string, files: Files | undefined, entry: string | undefined): {
3
+ names: string[];
4
+ sources: string[];
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const CSHARP_WORKER_SOURCE = "\"use strict\";(()=>{var E=\"code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1\";async function T(e,s,b,f,n){let d=new URL(e,b).href,o;try{o=await caches.open(f)}catch{}let c;try{c=await o?.match(d)}catch{}let h=async r=>{if(!r.ok)throw new Error(`Toolchain download failed: ${e} (HTTP ${r.status}). Check the asset URL and retry.`);let l=r.body?.getReader();if(!l)return r.arrayBuffer();let C=[],i=0,u=0;for(;;){let m=await l.read();if(m.done)break;if(i+=m.value.length,i>s.bytes)throw await l.cancel(),new Error(`Unexpected toolchain size: ${e}.`);C.push(m.value),performance.now()-u>100&&(n(`${c?\"Reading cached\":\"Downloading\"} ${e}: ${(i/1e6).toFixed(1)} / ${(s.bytes/1e6).toFixed(1)} MB (decoded)`),u=performance.now())}let p=new Uint8Array(i),S=0;for(let m of C)p.set(m,S),S+=m.length;return p.buffer},y=async r=>r.byteLength===s.bytes&&[...new Uint8Array(await crypto.subtle.digest(\"SHA-256\",r))].map(l=>l.toString(16).padStart(2,\"0\")).join(\"\")===s.sha256;if(c){try{let r=await h(c);if(await y(r))return r}catch{}try{await o?.delete(d)}catch{}c=void 0}let w=await h(await fetch(d));if(!await y(w))throw new Error(`Toolchain integrity check failed: ${e}. Use the pinned toolchain assets.`);try{await o?.put(d,new Response(w))}catch{}return w}var P={id:\"code-playpad-csharp-roslyn-5.0.0-dotnet-10.0.14-r1\",assets:{\"_framework/Microsoft.CSharp.45w5ndn4gy.wasm\":{bytes:301333,sha256:\"0893b8a6e6506cb2dbfa2dd01ac779d4616d013a2fac80e8cc15a64cdf526f0c\"},\"_framework/Microsoft.CodeAnalysis.CSharp.df8hfd5o8z.wasm\":{bytes:6828825,sha256:\"17a863076b8e6cdfad78e7e9b739ea6940939880f2916523aaa19e7a2b3b463c\"},\"_framework/Microsoft.CodeAnalysis.erp1n29u9n.wasm\":{bytes:3048217,sha256:\"56f8336593d9e41ee553106871e5aa82aadac0ab3f04496c8d1bbe601f619089\"},\"_framework/Microsoft.VisualBasic.6b1p6yq8b3.wasm\":{bytes:6933,sha256:\"1eff194716c295748d936659cab92e84a0d13515c34c2f05838c910f0fb9e2d5\"},\"_framework/Microsoft.VisualBasic.Core.4day4tivbb.wasm\":{bytes:418581,sha256:\"f860e30addf5a3562ba06fd93984663df5ca52ba9feadf1edc88e249fcb05c5d\"},\"_framework/Microsoft.Win32.Primitives.4bv2m8ah4f.wasm\":{bytes:5397,sha256:\"00e133d3bcca6baa47c8389b471441c9d4b89bcea2a308b5b779a70e714e2894\"},\"_framework/Microsoft.Win32.Registry.o7q57g4y3v.wasm\":{bytes:22805,sha256:\"0c854e9283334e2be8c837a9e95040ab6a649b45cb0078e0b19f1cd215604788\"},\"_framework/Playpad.CSharp.bc2sx86ihs.wasm\":{bytes:19733,sha256:\"25449d8432b31e70aa0109d2244595d3f1becb0493d3b9b9aa21f91a13fbc11f\"},\"_framework/System.AppContext.7pfnw66j8s.wasm\":{bytes:4885,sha256:\"3bc775156968db8b138e70f0d6cf919e8eceda801518dc4395a6c1b7029a76a2\"},\"_framework/System.Buffers.n9eydi1g7o.wasm\":{bytes:4885,sha256:\"bb413f159d106aa82005001b72d3dbe21702fe5b0729dfb0ad411e3b9ae14933\"},\"_framework/System.Collections.Concurrent.j651l47s89.wasm\":{bytes:78613,sha256:\"85fa85329f2778f2d7feeabe96e17150c2529cdee2671227f6adca55511e85ba\"},\"_framework/System.Collections.Immutable.5srny90eq0.wasm\":{bytes:240917,sha256:\"659249897525dbdd045be0c365aa78670911e71f082962fab29cb3d92f659523\"},\"_framework/System.Collections.NonGeneric.0gs0za6wta.wasm\":{bytes:37653,sha256:\"005b930e461f6d5f28714586e73c030a2d0d7705b93ff701e96465dcec8626de\"},\"_framework/System.Collections.Specialized.0lamnc2eez.wasm\":{bytes:37653,sha256:\"14a6ecd2d98964854df3c84e5d28c9e370f8511d88e17e19894bdd5487074534\"},\"_framework/System.Collections.zkl9zn110m.wasm\":{bytes:102677,sha256:\"7d1b8e3fb815980cc84b2d67b6894fa6bf936064cb4c0639547f214d3337826e\"},\"_framework/System.ComponentModel.2dg08nsbgq.wasm\":{bytes:5909,sha256:\"2a69c31d5b96be96e2dbd84b2eb722f33401245e3c3c18b449fa49d6b35b516c\"},\"_framework/System.ComponentModel.Annotations.qqu4bynrpj.wasm\":{bytes:92437,sha256:\"5ea898870e6d334ac03751ca45e941bdc786959862a4604c0b7925ae22365c1c\"},\"_framework/System.ComponentModel.DataAnnotations.6ljk5kma3w.wasm\":{bytes:6421,sha256:\"2a75102b3e594a3a5aec02c737c07bb07d67b31d84584a84dc93bd8fceaa44f7\"},\"_framework/System.ComponentModel.EventBasedAsync.0necwturs4.wasm\":{bytes:16149,sha256:\"1c2972979910342271b8e94c4455ff86593b6b428dbe29283927fc5038739df9\"},\"_framework/System.ComponentModel.Primitives.ex1da4zowy.wasm\":{bytes:32021,sha256:\"feaafe39e5531ccded6bd652b0ecbd1ddc7a3600e3ee89091411dbb113ae6489\"},\"_framework/System.ComponentModel.TypeConverter.t0513robn6.wasm\":{bytes:306453,sha256:\"53c1eda4d6b514c881cee8f6c7023ca6aa25304c2560c2a27357d5912b7e9efa\"},\"_framework/System.Configuration.11exwmwngo.wasm\":{bytes:8981,sha256:\"45bdaf5a151f8d873e4f3d63924b0b8e4711aa8e53a1a6b49bbaf8722ca07851\"},\"_framework/System.Console.4o049fyksq.wasm\":{bytes:43797,sha256:\"9cbe95b0e710127a9dc6fb016d89e3198bf5602e8767b4fe3318de77cc2e4184\"},\"_framework/System.Core.2bi377k7h6.wasm\":{bytes:13077,sha256:\"6e627a49290c7337183d58c756ca20ee0c6aef3716c73f748a1f2a040ec13f12\"},\"_framework/System.Data.Common.zrj82y4hfd.wasm\":{bytes:1007893,sha256:\"1fa0c46a27e2d1eb30b6ece5431b62a99eb0d3dbfff0ab3b0160d202b1283e62\"},\"_framework/System.Data.DataSetExtensions.ndyqwckzh5.wasm\":{bytes:5397,sha256:\"8b005ca671c5224a36cc8fcaee97ebd9fc9c8b44a4f431211c0e279b67605ef4\"},\"_framework/System.Data.cbzplu1klk.wasm\":{bytes:15125,sha256:\"08fc7cad424adfa678e5e03e1561fe679db996e8a887b14de7893786bdcfc11c\"},\"_framework/System.Diagnostics.Contracts.xbykr1nyue.wasm\":{bytes:5909,sha256:\"33867da04cc7cd4d8de2f10f0490f5488a8c8b83928597d906e86aae59e96c24\"},\"_framework/System.Diagnostics.Debug.faxnhsagf6.wasm\":{bytes:5397,sha256:\"b9b6df298d8fc68baec7ecf30ef40095a0810b44033dc2285e6e4d94eacac0cb\"},\"_framework/System.Diagnostics.DiagnosticSource.o8neuaehsr.wasm\":{bytes:192277,sha256:\"d82c2d87d4b05f79cded591ec897e75aef9fd5c93a5ec034bb76b8c67c211dd8\"},\"_framework/System.Diagnostics.FileVersionInfo.3veftfofsy.wasm\":{bytes:12565,sha256:\"ff1105930376d41151ef2e5c3d79cdb7002dfb3f7923bb3bf5caf3c33e301ce3\"},\"_framework/System.Diagnostics.Process.m02d4wsk19.wasm\":{bytes:46357,sha256:\"8af0d33b005cf399b2d983101aabd789b759fce6d53724ab17e4257df275f357\"},\"_framework/System.Diagnostics.StackTrace.3n0s7h4d43.wasm\":{bytes:15637,sha256:\"c1428e9f1dd799329b94b73a3a739c726195e78c7e499a7f9fa76abc9711a153\"},\"_framework/System.Diagnostics.TextWriterTraceListener.eytcvy9k8s.wasm\":{bytes:21269,sha256:\"a6f9c9665c871e8702c313c72aff56d8678fa2aeef5d58bdbd22895b5d7bb0cc\"},\"_framework/System.Diagnostics.Tools.fj2fven09q.wasm\":{bytes:4885,sha256:\"655eda3c94089e2fd9a0eda837027d39fdc8782124027f1ecb5e1627306f3ab2\"},\"_framework/System.Diagnostics.TraceSource.zdzes0xpw3.wasm\":{bytes:48405,sha256:\"596906ce63f2a87afc7c0c93ce63b8edd564dbab4cf44cba12e1e1de57cd3989\"},\"_framework/System.Diagnostics.Tracing.p8zfsagsem.wasm\":{bytes:5909,sha256:\"29645956735e67930940e0068fdf939e7724ac191aec9af9fc7fad2a5c478b4e\"},\"_framework/System.Drawing.Primitives.qihgks5s1u.wasm\":{bytes:54549,sha256:\"4e6f66a93b0178adcba6b52555fe1665e5d5c9f295ede78bb1f88a8ce7cd1730\"},\"_framework/System.Drawing.yh4pswp3to.wasm\":{bytes:10005,sha256:\"064f946cd835b5c06b88b5e8d3baafa1b65212fea3f741846530b9c15e8397a8\"},\"_framework/System.Dynamic.Runtime.qf4wa78w3a.wasm\":{bytes:5909,sha256:\"76243dbb12aaf714360cd6bb1adff3eac41d019028d45706f9a877fa0b8b4933\"},\"_framework/System.Formats.Asn1.ei47lr61p0.wasm\":{bytes:86805,sha256:\"963360faa396a0ac4f0ee1fb6a4de8195c8abc8722cfcb5e3f34c8f8cfa2cc44\"},\"_framework/System.Formats.Tar.jt7yo4wxzn.wasm\":{bytes:28949,sha256:\"e9bb9ece17de3bb99b99f9e27d9be6ea25feb824606217a81a581a3defd799e3\"},\"_framework/System.Globalization.Calendars.vfqjdvj4bj.wasm\":{bytes:5397,sha256:\"9b458344e441af8a342d90d9756002bd53d3ca81fd2ecec1d9956c09ab738761\"},\"_framework/System.Globalization.Extensions.fb3tp0zu2j.wasm\":{bytes:4885,sha256:\"0b1f2e8dd68f450050c6ea5d933b06ffc0133120dff33a87b5ccf1e523439be2\"},\"_framework/System.Globalization.jpj90sbpo9.wasm\":{bytes:5397,sha256:\"07ac16899c10c3af6fb0bb4cd1ca976ddf3fe82165fb06b74bb034cab14a0bad\"},\"_framework/System.IO.Compression.Brotli.fpnvzsxpvo.wasm\":{bytes:18197,sha256:\"c3cc052fa471c3f25016b7eee90ab7eb3793995aea8f08ba93e3b6d85c9ba0b7\"},\"_framework/System.IO.Compression.FileSystem.tk5twcs8br.wasm\":{bytes:4885,sha256:\"7d51272f3b3ec7a32ef1b73e693fc90753705665cc50f98a56a3e7f60970cd31\"},\"_framework/System.IO.Compression.ZipFile.f6odqd84z5.wasm\":{bytes:43285,sha256:\"59161959d34a7935b83bc858b589d34cc17ade5912137658ee3d7ca1ec4b090c\"},\"_framework/System.IO.Compression.zo5nnp1cfl.wasm\":{bytes:157461,sha256:\"6df8da5437998a60f5afd17b4c0b7145d94171dd2b0dd1bed6ef0d762074062d\"},\"_framework/System.IO.FileSystem.4xxxdm8fc4.wasm\":{bytes:5397,sha256:\"f8ae1910ff477fbb38b7a1a689ddb555d5ab9f7b5ec59e183fb7c7aebacbe077\"},\"_framework/System.IO.FileSystem.AccessControl.3nsp4r0ce1.wasm\":{bytes:21781,sha256:\"3f2d25968e0dad93040716ef7d97382bd6a5517bd0e3c6d707fa520df255d627\"},\"_framework/System.IO.FileSystem.DriveInfo.2dz9a3mpco.wasm\":{bytes:13589,sha256:\"46f152531a56b5a1234b905b5460060a3a76c74a94f575e6444848bb7d15a0fc\"},\"_framework/System.IO.FileSystem.Primitives.ts09gphu65.wasm\":{bytes:4885,sha256:\"b3efcf0755c59862ad4893ad4b668d5dab114f3561ae632d1ea7479e65c22180\"},\"_framework/System.IO.FileSystem.Watcher.zra8jhxo53.wasm\":{bytes:22805,sha256:\"8fcf89a027896f110eefc2e1e76a86bd91f6537a748afdc2ecc7fbd00d1110a1\"},\"_framework/System.IO.IsolatedStorage.czh3ilflkw.wasm\":{bytes:24853,sha256:\"388c1f0e6894454587ae794e210a93feaa23c8932064b68ad76e660a2b3d4fb1\"},\"_framework/System.IO.MemoryMappedFiles.f0h74bif4r.wasm\":{bytes:39701,sha256:\"dfc14559b3102cdd3d1155ec7cc198999db5b31439aafcd1775dffa39015d0a7\"},\"_framework/System.IO.Pipelines.eqtd8a5j6e.wasm\":{bytes:67861,sha256:\"3aa8165bec8d2b718d927cf0ba7ba9fb2e301544164d62202a578d3e3010d850\"},\"_framework/System.IO.Pipes.AccessControl.cz75e7snno.wasm\":{bytes:13077,sha256:\"a881296c9ae2cefe4f57c030f0cd13a0384ae7a82519dd0063d62feab0877a2b\"},\"_framework/System.IO.Pipes.amk3gre8pn.wasm\":{bytes:32021,sha256:\"22c795928e765dae50c2632f264efde23032c0225fcff6acb4aa075855543436\"},\"_framework/System.IO.UnmanagedMemoryStream.pjda8c8goj.wasm\":{bytes:5397,sha256:\"159b449cef234de1150ea545ce482dadadcffb47cccc4e60038840eb1be87a4c\"},\"_framework/System.IO.hvb68vhf4w.wasm\":{bytes:5397,sha256:\"63ca4a239901c3ba9517ab48c5c70e2b2f2f983b8f5c96c6215ffb74efb90d42\"},\"_framework/System.Linq.AsyncEnumerable.p5kf8px69a.wasm\":{bytes:446229,sha256:\"cdaf09cf14de62c8172a64d1f1fd540b050edf1a751873b575f1c6dab92f171d\"},\"_framework/System.Linq.Expressions.rrm2f8e4yg.wasm\":{bytes:565013,sha256:\"c74ef523be9ae6830a76be0baf9a9a508ce7ca31ac5876bb80dc7d1d777b5cab\"},\"_framework/System.Linq.Parallel.2c1yb2s745.wasm\":{bytes:212757,sha256:\"be110713a9092c3594d36dc664441be579d17fbe9b0be0a1bd289bd4fca58ee9\"},\"_framework/System.Linq.Queryable.trhrf5j8ds.wasm\":{bytes:68373,sha256:\"b965d6be5e8744b201ab8142f11c57aaf0a95081020880c1ec709fb9654c338c\"},\"_framework/System.Linq.gvekllsg4c.wasm\":{bytes:190741,sha256:\"4cf1e524ac3f80887e4c7d723c29f54b676ad76325c8472ecbbd064652881d57\"},\"_framework/System.Memory.rvge25ilzk.wasm\":{bytes:45333,sha256:\"09ddaf85e36c7c13ef4d7e32cc5436cfec4984e1c26c989072e499ddde8ae062\"},\"_framework/System.Net.Http.8ubauysc2i.wasm\":{bytes:286485,sha256:\"903f936e8d7a67798c76e85d53838ac80c88b1ef3d45ec53ff2ac95a8bbc4c2b\"},\"_framework/System.Net.Http.Json.cnwprpsgic.wasm\":{bytes:45845,sha256:\"8830cced672b10f509c317186768b69245fbc9c3695eb870b9a81e31a1dfa086\"},\"_framework/System.Net.HttpListener.ij8kltpk25.wasm\":{bytes:45845,sha256:\"c23e07ce4477568bf5687cc8f81f2eb9ce806667398756ab96507671f83a3594\"},\"_framework/System.Net.Mail.z8qhziwoem.wasm\":{bytes:94997,sha256:\"ddd584fafc23dc46fd5eca406b6f0edb6fc2af837280fd50b276327c867a41ee\"},\"_framework/System.Net.NameResolution.ncmdi0kq9p.wasm\":{bytes:14101,sha256:\"993b5c9ce17363348c5d77766b5ef8ba7cd9e9bf8490f54bf295d600c0318f5d\"},\"_framework/System.Net.NetworkInformation.es6jl8uhrp.wasm\":{bytes:32021,sha256:\"e2e10d93298c3e8ba16fc2acfebc314c9e32ad07d28b99a491ad1f215795f216\"},\"_framework/System.Net.Ping.leo6kko976.wasm\":{bytes:17685,sha256:\"0de562db7b1035f071863450f7e875892b1705ba696cc11ee3593dda48894fc9\"},\"_framework/System.Net.Primitives.yzzu57r5h4.wasm\":{bytes:97045,sha256:\"bea2dfad62c29bbf61a9b34552bb6b28356cc6ce36c56e96c058639c3ee2a3fc\"},\"_framework/System.Net.Quic.t4x9xorc7c.wasm\":{bytes:28949,sha256:\"031f5366680b6a4b90cf8ed2ced5d135391b1942a1423e991ebeddfd7b47940a\"},\"_framework/System.Net.Requests.hvrao969rw.wasm\":{bytes:55573,sha256:\"9d27640110c78c3c04da4f2f070589ff6857804316f91765cc59d305e45ae9dc\"},\"_framework/System.Net.Security.z570hyrh50.wasm\":{bytes:104213,sha256:\"b972545804845422c6b90682ef9585ff07ca24394bc4abcafaa8aab8841476ff\"},\"_framework/System.Net.ServerSentEvents.b3gkat9xqz.wasm\":{bytes:30485,sha256:\"89c3d8604b565dd8b5ac18dcd39b73f311c81e20b8d5cdbd3c3a704c958515f3\"},\"_framework/System.Net.ServicePoint.k1tgr3lkj6.wasm\":{bytes:4885,sha256:\"082ef4faa63db1a669223b6b892729a426f1017c61a8140167d9a935f65cabd5\"},\"_framework/System.Net.Sockets.fgcxent7fc.wasm\":{bytes:64277,sha256:\"b1284556b3eeceed8cee152f19f6a6b32c7d35ab031f64a4b96968cbef84ff90\"},\"_framework/System.Net.WebClient.kpwi6t40sc.wasm\":{bytes:45845,sha256:\"18108441da8fd4dc43cd29a42d491c27e23961e0188714ce41deffa5e113b034\"},\"_framework/System.Net.WebHeaderCollection.fnxrdiu9j1.wasm\":{bytes:22805,sha256:\"1bb8ab08176b1d4878d9d5732629e730cd863d2e0e458de1914cd71aafcc7a86\"},\"_framework/System.Net.WebProxy.wtgabypaqs.wasm\":{bytes:11541,sha256:\"4cc9d37b00460499d38df4cc1bb4a9408fa0996e9cdef5244ad645b550cd87b2\"},\"_framework/System.Net.WebSockets.4zomq83cjx.wasm\":{bytes:99093,sha256:\"102e21acf0257c9bd1115dd74f36f0cf1844ea1872ecf3e78f4af2d9038878c9\"},\"_framework/System.Net.WebSockets.Client.l4ui9wgjyz.wasm\":{bytes:42261,sha256:\"fbade9ba11569ee8ead57e48bfad3419d4b5800f2a0503de1ea87ddbab5e78d6\"},\"_framework/System.Net.plchg2cs85.wasm\":{bytes:6933,sha256:\"f38d34d3e084c72fda1c6182f4fd11644d922dfa7b4efdb83809b6bb6eba4879\"},\"_framework/System.Numerics.7xa3ygjnjn.wasm\":{bytes:4885,sha256:\"f513f73d4658cd05b3d587d5dc634450d3d2811ca92b12e0065d111f0fb7fe08\"},\"_framework/System.Numerics.Vectors.2neq4xg5b1.wasm\":{bytes:5397,sha256:\"624bf089833a6c91bd2c0e83cf58f9db9b8e702dcc8c9e2b389610f8f3ad9924\"},\"_framework/System.ObjectModel.0us7g9291u.wasm\":{bytes:30997,sha256:\"b8c1e66933e2073d4d95b7971ce949d2aee7caacd85a222261200d12368e6305\"},\"_framework/System.Private.CoreLib.7henw1oe7e.wasm\":{bytes:4870425,sha256:\"0b6d3f3864053400013921497367c1f9806b10baa069e9e80ea2ba7ff1943d20\"},\"_framework/System.Private.DataContractSerialization.45rz0h7hbh.wasm\":{bytes:849173,sha256:\"2808c98580c4009f7850dde898e1f8d81a15e427ddeb122033384dd48a0c1252\"},\"_framework/System.Private.Uri.c0pesqh6or.wasm\":{bytes:95509,sha256:\"e4b56986f49b6104f86884d59fd3a4eff4e525fdd2d1f83baee01b752efa337e\"},\"_framework/System.Private.Xml.Linq.91dmao781k.wasm\":{bytes:143637,sha256:\"7d05fc1b72e4d16c33f13e7cfd85a6f5a92f5c2ca343c8f78d4425d2afa50d0a\"},\"_framework/System.Private.Xml.ihpa1sp5u8.wasm\":{bytes:3096857,sha256:\"86009953171be26f62eab577e33c3502d82ddc74a9d6f27c6b4d07ea6300e498\"},\"_framework/System.Reflection.DispatchProxy.dotf7d6gov.wasm\":{bytes:27925,sha256:\"03a1a48a2b900d219650d22288cb1ebb62feb218fef7788daa6aead0e237f14d\"},\"_framework/System.Reflection.Emit.ILGeneration.0x2k63jlqj.wasm\":{bytes:5397,sha256:\"c46d97174687a1f77ef95a0c085d632881c1f315d7141b985a673662131235e0\"},\"_framework/System.Reflection.Emit.Lightweight.5yjn7ykajf.wasm\":{bytes:5397,sha256:\"bdb328f85330a0991ea097895f5f233c7c185bcc54d115f9f4deb7c02fa7ce83\"},\"_framework/System.Reflection.Emit.ynxp91g9b8.wasm\":{bytes:123157,sha256:\"52fc8f0a51bcc2c5da80be2148b8391dc1665768e3aa6e04a0a0a7a2aeee52c8\"},\"_framework/System.Reflection.Extensions.0ouvp5b0xg.wasm\":{bytes:4885,sha256:\"00b61c99e5b7930e88707c4614942c0f69e91bd0acadd0e728d3e219f1137a53\"},\"_framework/System.Reflection.Metadata.vkm0bf1n4h.wasm\":{bytes:493333,sha256:\"b136c7933bc62da5e4f3e34ad6fea876f5cc7a7e47d35e7b7c64055927fc68f6\"},\"_framework/System.Reflection.Primitives.cnvk9lkykl.wasm\":{bytes:5397,sha256:\"c84511d42d21a09fd8818bb0ee4d4423584f19dd9a58a98a8d8631c0435336bb\"},\"_framework/System.Reflection.TypeExtensions.jnvi38irak.wasm\":{bytes:14101,sha256:\"bf533973a0a50cba610aac73875d9f8627c173b463311d060f79ea4922a9d64e\"},\"_framework/System.Reflection.qdi0svky7b.wasm\":{bytes:5909,sha256:\"0e958c24d437bc1b1e321617c69dda15aba94d0e13b741c39a514108dab87958\"},\"_framework/System.Resources.Reader.tkyk3pewoj.wasm\":{bytes:4885,sha256:\"f34cfbeb3f39e7bfa7d0d892e3fdcfeda727e269b2a622d74ca455d41ad740b3\"},\"_framework/System.Resources.ResourceManager.mxgnwpq6s6.wasm\":{bytes:5397,sha256:\"7af92fba46216d614859a6466c6a013e936a510d492affb6ee74179d23620998\"},\"_framework/System.Resources.Writer.u12ln0bq25.wasm\":{bytes:16661,sha256:\"a2a46ada8be5659c787b4da0494298da0ffc2467a0b02a7eab604dca5c532866\"},\"_framework/System.Runtime.CompilerServices.Unsafe.mvjra26big.wasm\":{bytes:4885,sha256:\"624f428a1c8ffd524aa47ced54090373d0f389162b6dfb00689343f2a3ac5803\"},\"_framework/System.Runtime.CompilerServices.VisualC.0zws5y4za8.wasm\":{bytes:6933,sha256:\"ec82d7e3669ba41156f4d70d94bf30c47dd28829cf5de4591f18bce80943d1a0\"},\"_framework/System.Runtime.Extensions.53v9tmujmf.wasm\":{bytes:7445,sha256:\"5f05d3f29944d5adc9a644a37e1818edc5cb9f4450fe1ed88b600b0d84bda226\"},\"_framework/System.Runtime.Handles.dtp1f2k1pr.wasm\":{bytes:5397,sha256:\"f16fe73e38bb80ab6b26486ad193d8766254138bac0524f2861959c7834cbee1\"},\"_framework/System.Runtime.InteropServices.JavaScript.b9bqw25qxw.wasm\":{bytes:79637,sha256:\"810c9571d56aae8aabdccec828936d48cb8664b4e2e923d3c49f5c288234a26c\"},\"_framework/System.Runtime.InteropServices.RuntimeInformation.5dmsm0qrdq.wasm\":{bytes:5397,sha256:\"c7696a8781fbc588fa126969f0a8b0703c3df1181e9e723631d5a7816636c406\"},\"_framework/System.Runtime.InteropServices.zc5o5oswy7.wasm\":{bytes:54549,sha256:\"dd89331d3297a0c4a5aac4e6ed289c59d6c8858f7f85d55a46fb0d80c69ca429\"},\"_framework/System.Runtime.Intrinsics.uupmanm0z1.wasm\":{bytes:6933,sha256:\"6692c7b97d8261781b893a91a9bed12a8da493d0ad20d6e2e941ab4b052c6218\"},\"_framework/System.Runtime.Loader.bmhnwgr24i.wasm\":{bytes:5397,sha256:\"0db7813efcf24740ffc3121704940e5b39bac5745b05c3cbd23a71bbc13d7800\"},\"_framework/System.Runtime.Numerics.hnmfmtcdek.wasm\":{bytes:134933,sha256:\"937500e9e310341dabaee15f5c1f39eccc0214d055b846951547ed19f635659d\"},\"_framework/System.Runtime.Serialization.890gxgs7km.wasm\":{bytes:6933,sha256:\"b41917f9c13f891781b2babb541b8d01f8394a51f2e9323922eb94a2816a2d5d\"},\"_framework/System.Runtime.Serialization.Formatters.k6qqn2m2yp.wasm\":{bytes:55573,sha256:\"f4592c11ffc0e2a191254f637a0d117e1a09f8d1ff5a1065e5c175310183097b\"},\"_framework/System.Runtime.Serialization.Json.rmpm3bs9gf.wasm\":{bytes:5397,sha256:\"bde54b4f956372ced92d5efee2c37314343968505e7146ab269a2e3771a7b38d\"},\"_framework/System.Runtime.Serialization.Primitives.rhltpkb1qn.wasm\":{bytes:13077,sha256:\"0f8b94ee594a9fcc5c8506072e13a7d50735d02df44adf5e34a533e3e38d9a9b\"},\"_framework/System.Runtime.Serialization.Xml.2qu958brox.wasm\":{bytes:6421,sha256:\"36472147c1166a70a5722cf793fa9abbe1bab93527241979607865df0a2f58be\"},\"_framework/System.Runtime.q3byyncrvz.wasm\":{bytes:34581,sha256:\"4af52a715b0a80fca05f4fe3d35e0882a47699e2cc64a8d6dfdb5fbfc5bddedd\"},\"_framework/System.Security.AccessControl.frpe4iqtxg.wasm\":{bytes:47893,sha256:\"eb65f6286a07968d12c0b8e5330b6c9dfa314dd224e877a0c4aea82e78028785\"},\"_framework/System.Security.Claims.1iu8vf654n.wasm\":{bytes:44821,sha256:\"97f82dc8889938fdcce4e09bea257e9c1b49d991d9458836879150444e5b8b70\"},\"_framework/System.Security.Cryptography.Algorithms.667n7jcyg1.wasm\":{bytes:6933,sha256:\"f2a8e4d45f9f2967b51b58bb85319e8852d3a333dbaf9cd2386ca4b00652e373\"},\"_framework/System.Security.Cryptography.Cng.bd7h0b8iov.wasm\":{bytes:5909,sha256:\"8f4b9ed85aec8a2564ebe8d7d8a4d1150bb46f2aea851733c26166faddb90fd7\"},\"_framework/System.Security.Cryptography.Csp.z1odikd5x2.wasm\":{bytes:5909,sha256:\"f912404d06760570df5a52dd7b64e8af3125dd6f452bd8938faec529f3e02366\"},\"_framework/System.Security.Cryptography.Encoding.o0gt2d4ysx.wasm\":{bytes:5397,sha256:\"a8b33cdbba50e569c52acb0fe72e17ad4e278c1209bcc338d41025e38071bc63\"},\"_framework/System.Security.Cryptography.OpenSsl.90bbqu9909.wasm\":{bytes:5397,sha256:\"87916287aef8bdf7bb1fb87fdf1e64dc8b715228c129319cc41b17e64dc5b13e\"},\"_framework/System.Security.Cryptography.Primitives.wc69ogz8hc.wasm\":{bytes:5397,sha256:\"90efa59ad8a365908c18aff92e86336eb346914ede31bc51e3008aa394c66acd\"},\"_framework/System.Security.Cryptography.X509Certificates.zdajb5d4ry.wasm\":{bytes:6421,sha256:\"a95583972db3c698e929f1e9d0bfd5268c20247b39ffebe0e435ced691e01069\"},\"_framework/System.Security.Cryptography.isqs0vklct.wasm\":{bytes:643861,sha256:\"5e2d390cae360df7f1a224f866cd4648f896a02bdd8dc8b6dd97f4036a3434a6\"},\"_framework/System.Security.Principal.8kc2gzptia.wasm\":{bytes:4885,sha256:\"18f86f82bdc342716c4f4d1ce95cef59f29516c18f4b107e20e4fb2283bf3ca3\"},\"_framework/System.Security.Principal.Windows.lvinz1flf3.wasm\":{bytes:27413,sha256:\"af696bc41c787f9d87ae55b4bc5799b1e384083d610340774246b5283f2b5f76\"},\"_framework/System.Security.SecureString.287gima5tn.wasm\":{bytes:5397,sha256:\"92d299c328a15eb44a972aaa0142d628d9b35c1a555d5e6b296d14fcf1f31736\"},\"_framework/System.Security.zwe9caa7de.wasm\":{bytes:7957,sha256:\"c3076430d76f8d122b73973756f5c601c96444d2e303834fbda2151aa3fb117c\"},\"_framework/System.ServiceModel.Web.eh14pbj71g.wasm\":{bytes:6421,sha256:\"7e6a649d68f4543fefcd8add264555779efc37b5986ec96106f1598703eaa247\"},\"_framework/System.ServiceProcess.thnl06mz62.wasm\":{bytes:5397,sha256:\"cf9d149513509280a136812038d16f8421e5ced70788b6c9595170242d702530\"},\"_framework/System.Text.Encoding.CodePages.r4fb0qucdq.wasm\":{bytes:732437,sha256:\"a556ef19b61455e586137ff454f3120091897dcc43a44c19a71d7ef489a3ddfc\"},\"_framework/System.Text.Encoding.Extensions.qyio04sfs3.wasm\":{bytes:5397,sha256:\"fe7930a6f00825e1c4a3f32e0e3bd42117377db151afc127110c70fbb701366a\"},\"_framework/System.Text.Encoding.x8frxl6434.wasm\":{bytes:5397,sha256:\"f11aa7fbf9e9a4f86b0a34a5478e6553d314461dcbe69fc8097adf1f9d69808b\"},\"_framework/System.Text.Encodings.Web.i5h886ktzy.wasm\":{bytes:55573,sha256:\"2a97377ae59b872eb3d69f1eb9555ba512f577708f951f7a2ef8040292911df0\"},\"_framework/System.Text.Json.rfs8iutklf.wasm\":{bytes:638741,sha256:\"f79b95a0e74fb4fb30fb90a704078e0b910c6d9d08cd9a7ab7a589b8fdcc24ef\"},\"_framework/System.Text.RegularExpressions.3wwgc8ow33.wasm\":{bytes:374549,sha256:\"8336c54d5413476b6125468549c98d35c0a9e5bd0db682b3795a7351d38e7b4c\"},\"_framework/System.Threading.5z3yk0hlih.wasm\":{bytes:34581,sha256:\"a12c2a6463d08e453a9e0dc72152b68692c5e6b2f5d69d8700f0c0bd2c4ba90a\"},\"_framework/System.Threading.AccessControl.3jdprnrbz3.wasm\":{bytes:23317,sha256:\"41c872fb18d50bc6d15f2f2c79ca48e825b0de88f0959f1356b02d2df31dc28e\"},\"_framework/System.Threading.Channels.u6jwukaw3f.wasm\":{bytes:56085,sha256:\"2677baa60a9cc551734e24a4eb400413c2157d310d8eae8c666a9f428e14df75\"},\"_framework/System.Threading.Overlapped.906hny6ev5.wasm\":{bytes:5397,sha256:\"57a8b7621e425edb8bc3c1114daed57774c1dfc75975a3aa12a0e4cfd1e3612b\"},\"_framework/System.Threading.Tasks.Dataflow.yxumrwtpb9.wasm\":{bytes:175381,sha256:\"da2eef656f41a87395f3f24935b557e4b054d994e220ae70401a820712cd440f\"},\"_framework/System.Threading.Tasks.Extensions.c9qgjzqtfp.wasm\":{bytes:5397,sha256:\"f027df139487b8613d3b6e1271a920c441ff5d7fcae2bc774009b50a3f703a30\"},\"_framework/System.Threading.Tasks.Parallel.984t0vlw0h.wasm\":{bytes:50965,sha256:\"a9e66658c76d0aa175b202b59391a313ed841a8ca09fbe80ef88962090b72b6e\"},\"_framework/System.Threading.Tasks.e8zo3kytn9.wasm\":{bytes:6421,sha256:\"a224a48edb58b9d097a72b83d5804930357555dee3f8be811827482e827ac544\"},\"_framework/System.Threading.Thread.0kl8n21ama.wasm\":{bytes:5397,sha256:\"206e44a32770dab61b10150554dd82dc69e29779609405d2a79da858f1ec5ff1\"},\"_framework/System.Threading.ThreadPool.uis7d1kkur.wasm\":{bytes:5397,sha256:\"da628e4a405d14fcf624643d3b9c632d47e4f478b30a21680c142901aec3bfe7\"},\"_framework/System.Threading.Timer.d0q7n4qone.wasm\":{bytes:4885,sha256:\"93d9959881dd75ace8b74ecf1307fa1c8bf210bd384e44feb84d203502a23486\"},\"_framework/System.Transactions.1rh8d3l1yg.wasm\":{bytes:6421,sha256:\"ddb4bf21d75f14d92cddd44d6d5abb88fc2f6dbabd24e4f692ce8a24c42ba5af\"},\"_framework/System.Transactions.Local.88eb0ckc89.wasm\":{bytes:165653,sha256:\"c80cdc0b7339172c58d06b47543bacf5ead18c6fbc50f483e6eee1973eb4102b\"},\"_framework/System.ValueTuple.dz9n78v09g.wasm\":{bytes:5397,sha256:\"490935cf3415a01a302a6caf3e404a0c8591bc6a5ad039e1ad4c892cee66edda\"},\"_framework/System.Web.HttpUtility.zkk9vwuwmx.wasm\":{bytes:19733,sha256:\"73afab7ffbcfa6e1479aa8ad626e3470e3346a80a2e7574d766e41c61e9df242\"},\"_framework/System.Web.cpb2jt6aj4.wasm\":{bytes:4885,sha256:\"c00e79f45b25abca38109c095dfa83a4616f107129ce05badc98ef08ea0ab819\"},\"_framework/System.Windows.z1cdp2137j.wasm\":{bytes:5397,sha256:\"474f8c034c878c2877fd38bfcc81a7ca91ec14f465067924def2447f3a0ceb1f\"},\"_framework/System.Xml.Linq.zfqbqkhg85.wasm\":{bytes:5397,sha256:\"616bc8b437b614c7e754c5ab40ea583b2075fbefd75684218446ce675a330615\"},\"_framework/System.Xml.ReaderWriter.j5zd7b3r9j.wasm\":{bytes:11541,sha256:\"375655970f08782d60c0b7e660a2ed18b100632cd0beccf6072f453461b33537\"},\"_framework/System.Xml.Serialization.g3ffx007q0.wasm\":{bytes:5909,sha256:\"d48409f2e83289d8a283e0dac4e15f6daaba7d0d9f1ef0ed0632479fcb670fea\"},\"_framework/System.Xml.XDocument.d9vqmjsh7t.wasm\":{bytes:5397,sha256:\"c12264747d6099b7063ae2ecc540848a570d33620fdf5f4815d34ded85c9bc8f\"},\"_framework/System.Xml.XPath.XDocument.ikh0avvfe3.wasm\":{bytes:5909,sha256:\"0ed162b5f6ceb1cae414c70bb8cdd960c5f77b1a39b4a9ab87b7703d92c5bce5\"},\"_framework/System.Xml.XPath.j7e58ql0yh.wasm\":{bytes:5397,sha256:\"d128d847ee39abbfee50d6e837d5dc953df248de890c894d92c15186f159092d\"},\"_framework/System.Xml.XmlDocument.2laigo0hd6.wasm\":{bytes:5397,sha256:\"16b6cd94446e868c5e744b876de60222eb25d1485c9f628fd03e64957d7b8cb0\"},\"_framework/System.Xml.XmlSerializer.o9fse2o32f.wasm\":{bytes:7445,sha256:\"4c9262e9ed66c40706ed51ea1dc312138035b44519f57ef97a94a4f323d192f7\"},\"_framework/System.Xml.ukjc8es4qk.wasm\":{bytes:13077,sha256:\"1eae6308964b64da01c885edee4c9af89173ec21ef4f99b71fd5350d8000a1ad\"},\"_framework/System.a2ormnao9q.wasm\":{bytes:39701,sha256:\"6e1ba6200e75ccd9b5be39467babe2d28067106bdd6ff0a1f292a2411177e27a\"},\"_framework/WindowsBase.pulybckt2x.wasm\":{bytes:5909,sha256:\"21be528b1fb2c3451736fb9a49f1f8063a164c6e4d089aec470d1d670ecc6340\"},\"_framework/dotnet.js\":{bytes:80782,sha256:\"0c8a1d506ef027d577f0efd776a42cc6639514b2cf1e90eaca8c18d18fae9c5f\"},\"_framework/dotnet.native.a6k1euv12n.wasm\":{bytes:3001771,sha256:\"62521652bab002242e009341397f999bdc2958bfac177278e3d885abb247a2e4\"},\"_framework/dotnet.native.bjoj0wmylw.js\":{bytes:145050,sha256:\"099d0855990b4c8bde7bb9f5c95bce8ad94958d763fd88da160a4c82588833ae\"},\"_framework/dotnet.runtime.5nc8i5dl74.js\":{bytes:198480,sha256:\"ff774183db23d722c3de1d0f0cc1e73545d6b3fdb35b020c133a26d57cf7438d\"},\"_framework/mscorlib.79r0fdidgd.wasm\":{bytes:49429,sha256:\"0553f8bd2703ce8aeebac01fc6c0d8fa7cf720fa64911da16e2a0efc9b988f12\"},\"_framework/netstandard.f948f8b5mo.wasm\":{bytes:90389,sha256:\"6db9b1e3952428d5958c52e5b36212b0bef4a1c4013fd49d3f5073c39133efcd\"},\"refs.pack\":{bytes:6046672,sha256:\"60252255312e28c33fa2bcde9646c7d92c6b2e7c2fb078a813b57de3146d8bed\"}}};function j(e){if(!e||e.startsWith(\"/\")||/[\\\\\\x00-\\x1f:]/.test(e)||e.split(\"/\").some(s=>!s||s===\".\"||s===\"..\"))throw new Error(`Invalid project path: ${JSON.stringify(e)}. Use relative paths without . or ...`);return e}function N(e,s,b){let f=j(b??\"Program.cs\"),n=s?{...s}:{[f]:e};if(!Object.hasOwn(n,f))throw new Error(`Entry file ${f} does not exist.`);let d=Object.keys(n).map(j).sort(),o=d.find(c=>!c.endsWith(\".cs\"));if(o)throw new Error(`C# projects can only contain .cs files for now: ${o}.`);if(d.length>32)throw new Error(\"Project limit: 32 source files.\");if(Object.values(n).reduce((c,h)=>c+new TextEncoder().encode(h).length,0)>2e6)throw new Error(\"Project exceeds the 2 MB source limit.\");return{names:d,sources:d.map(c=>n[c])}}var D=\"Roslyn 5.0.0 / .NET 10.0.14 r1\",$=3,X=2e3,U=1e6,A=P.assets,W={wasm:\"application/wasm\",js:\"text/javascript\"},g=e=>globalThis.postMessage(e),v=(e,s,b)=>g({type:\"progress\",id:e,phase:s,message:b}),M=e=>`${e.file}(${e.line},${e.column}): ${e.severity} ${e.id}: ${e.message}`,z;async function F(e){let s=performance.now(),b=f=>g({id:e.id,durationMs:performance.now()-s,...f});try{let f=N(e.code,e.files,e.entry),n=0,d=async a=>{let t=A[a];if(!t)throw new Error(`Not a pinned C# compiler file: ${a}.`);let k=await T(a,t,z,E,()=>{});return v(e.id,\"downloading\",`Loading the C# compiler: ${++n} files\\u2026`),k},o=async a=>{let t=new TextDecoder().decode(await d(a)).replaceAll(\"import.meta.url\",JSON.stringify(new URL(a,z).href));return URL.createObjectURL(new Blob([t],{type:\"text/javascript\"}))};v(e.id,\"downloading\",\"Loading the C# compiler\\u2026\");let{dotnet:c}=await import(await o(\"_framework/dotnet.js\")),h=new Map;await Promise.all(Object.keys(A).filter(a=>/^_framework\\/dotnet\\.[^/]*\\.js$/.test(a)).map(async a=>{h.set(a,await o(a))}));let y=[],w=0,r=!1,l=a=>{a.trim()&&(y.length<$?y.push(a.slice(0,X)):w++)},i=await(typeof c.withModuleConfig==\"function\"?c.withModuleConfig({printErr:l}):c).withResourceLoader((a,t)=>{let k=\"_framework/\"+t;if(a===\"dotnetjs\"||a.startsWith(\"js-module\")){let x=h.get(k);if(!x)throw new Error(`Not a pinned C# compiler script: ${t}.`);return x}return d(k).then(x=>new Response(x,{headers:{\"Content-Type\":W[t.slice(t.lastIndexOf(\".\")+1)]??\"application/octet-stream\"}}))}).create(),u=0,p=!1;i.setModuleImports(\"playpad\",{write:(a,t)=>{if(!p){if(u+=t.length,u>U){p=!0,b({type:\"error\",message:\"Output limit exceeded (1 MB).\"});return}g({type:a?\"stderr\":\"stdout\",id:e.id,text:t})}},managedExit:()=>{r=!0}});let{Compiler:S}=await i.getAssemblyExports(i.getConfig().mainAssemblyName);S.LoadReferences(new Uint8Array(await d(\"refs.pack\"))),v(e.id,\"compiling\",\"Compiling\\u2026\");let m=JSON.parse(S.Compile(f.names,f.sources)),R=()=>i.Module?.HEAPU8?.length??0,O=R(),I=m.diagnostics.filter(a=>a.severity===\"error\");if(!m.ok){b({type:\"error\",message:I.map(M).join(`\n`)||\"Compilation failed.\"});return}let q=m.diagnostics.filter(a=>a.origin===\"user\").map(M);q.length&&g({type:\"stderr\",id:e.id,text:q.join(`\n`)+`\n`}),v(e.id,\"running\",\"Running\\u2026\"),y=[],w=0;let _;try{_=await S.Run(e.stdin??\"\")}catch(a){let t=a.status;if(typeof t!=\"number\")throw a;if(!r){let k=y.length?[...y]:[\"The .NET runtime ended the program unexpectedly.\"];w&&k.push(`(${w} more runtime lines not shown)`),b({type:\"error\",message:k.join(`\n`)});return}_=t}if(p)return;b(_!==0?{type:\"error\",message:`Program exited with status ${_}.`}:{type:\"result\",memory:{compilerBytes:O,programBytes:R()}})}catch(f){b({type:\"error\",message:f instanceof Error?f.message:String(f)})}}globalThis.addEventListener(\"message\",({data:e})=>{e.type===\"init\"?(z=e.toolchainURL,g({type:\"ready\",version:D,interactiveStdin:!1})):e.type===\"run\"&&F(e)});})();\n";
@@ -0,0 +1,2 @@
1
+ import type { Runtime } from '../types.js';
2
+ export declare const csharpRuntime: Runtime;
@@ -1,10 +1,10 @@
1
1
  export declare const NEXT_SERVER_STAMP: {
2
2
  readonly react: "19.2.8";
3
- readonly sha256: "edf0a1c7f0b89207cedfcc97d70ce7690dd7b74b2759fe40d09962aa1217d306";
3
+ readonly sha256: "3dfd92fe246013cecc531f772833e7450f564f8f025a5ed0a220bedf5d33197e";
4
4
  };
5
5
  export declare const NEXT_CLIENT_STAMP: {
6
6
  readonly react: "19.2.8";
7
- readonly sha256: "9fa987a50b2071a7767c37ae9d15f0e621a5d115de640ba782e7a7f77095aa3d";
7
+ readonly sha256: "e8642d911af2320b6fa37d610efee411270d90a1e2e83190f154d9dd1ed691ed";
8
8
  };
9
9
  export declare const NEXT_SERVER_SOURCE: string;
10
10
  export declare const NEXT_CLIENT_SOURCE: string;
@@ -66,6 +66,14 @@ export declare abstract class WorkerRuntime {
66
66
  #private;
67
67
  /** Worker source for this language. */
68
68
  protected abstract get source(): string;
69
+ /**
70
+ * End the worker after every run, so no run can see another's state. The next
71
+ * job boots a new one. Booting must not download anything, or a Stop during
72
+ * the download could not be told apart from a slow boot.
73
+ */
74
+ protected get recycleAfterRun(): boolean;
75
+ /** How long a boot may take before it fails, for runtimes that recycle. */
76
+ protected get startTimeoutMs(): number | undefined;
69
77
  /** Extra fields for the init message (e.g. where to fetch a runtime from). */
70
78
  protected initPayload(): Record<string, unknown>;
71
79
  /**
@@ -3,7 +3,7 @@
3
3
  * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
4
  * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
5
  */
6
- import{n as e,t}from"./types-CfcYqU2K.js";import{t as n}from"./hints-DpBIeoeG.js";import{t as r}from"./react-version.generated-BNNJmf7J.js";import{a as i,i as a,n as o,r as s,t as c,u as l}from"./config-DB58UVsk.js";var u=[{id:`default-dark`,label:`One Dark`,mode:`dark`},{id:`monokai`,label:`Monokai`,mode:`dark`,colors:{bg:`#272822`,fg:`#f8f8f2`,muted:`#b4b19c`,surface:`#1e1f1a`,border:`#49483e`,accent:`#a6e22e`,accentFg:`#1e1f1a`,danger:`#ff6188`,ok:`#a6e22e`,selection:`#49483e`,activeLine:`#3e3d3266`,comment:`#a09b80`,keyword:`#ff5c94`,string:`#e6db74`,number:`#ae81ff`,fn:`#a6e22e`,type:`#66d9ef`,variable:`#f8f8f2`}},{id:`dracula`,label:`Dracula`,mode:`dark`,colors:{bg:`#282a36`,fg:`#f8f8f2`,muted:`#b6bcd6`,surface:`#21222c`,border:`#44475a`,accent:`#bd93f9`,accentFg:`#21222c`,danger:`#ff5555`,ok:`#50fa7b`,selection:`#44475a`,activeLine:`#44475a55`,comment:`#9aa5ce`,keyword:`#ff79c6`,string:`#f1fa8c`,number:`#bd93f9`,fn:`#50fa7b`,type:`#8be9fd`,variable:`#f8f8f2`}},{id:`nord`,label:`Nord`,mode:`dark`,colors:{bg:`#2e3440`,fg:`#d8dee9`,muted:`#b0b9c9`,surface:`#272c36`,border:`#434c5e`,accent:`#88c0d0`,accentFg:`#272c36`,danger:`#e08a91`,ok:`#a3be8c`,selection:`#434c5e`,activeLine:`#3b425266`,comment:`#a0abbf`,keyword:`#81a1c1`,string:`#a3be8c`,number:`#bd98b6`,fn:`#88c0d0`,type:`#8fbcbb`,variable:`#d8dee9`}},{id:`solarized-dark`,label:`Solarized Dark`,mode:`dark`,colors:{bg:`#002b36`,fg:`#c5d3d3`,muted:`#9fb0b0`,surface:`#00222b`,border:`#17505e`,accent:`#2aa198`,accentFg:`#00222b`,danger:`#f0746f`,ok:`#a3b300`,selection:`#17505e`,activeLine:`#073642aa`,comment:`#8fa3a8`,keyword:`#a3b300`,string:`#2aa198`,number:`#e87f7c`,fn:`#4ba3e3`,type:`#d6a100`,variable:`#c5d3d3`}},{id:`default-light`,label:`Default Light`,mode:`light`},{id:`github-light`,label:`GitHub Light`,mode:`light`,colors:{bg:`#ffffff`,fg:`#24292f`,muted:`#59636e`,surface:`#f6f8fa`,border:`#d1d9e0`,accent:`#0969da`,accentFg:`#ffffff`,danger:`#cf222e`,ok:`#1a7f37`,selection:`#b6d7ff`,activeLine:`#eaeef266`,comment:`#59636e`,keyword:`#cf222e`,string:`#0a3069`,number:`#0550ae`,fn:`#8250df`,type:`#953800`,variable:`#24292f`}},{id:`solarized-light`,label:`Solarized Light`,mode:`light`,colors:{bg:`#fdf6e3`,fg:`#47565c`,muted:`#566569`,surface:`#eee8d5`,border:`#d6cfb8`,accent:`#1f6fa8`,accentFg:`#ffffff`,danger:`#c0302c`,ok:`#5f6f00`,selection:`#e3dcc4`,activeLine:`#eee8d588`,comment:`#5c6c70`,keyword:`#5f6f00`,string:`#1a7a73`,number:`#c0302c`,fn:`#1f6fa8`,type:`#8f6a00`,variable:`#47565c`}}],d=`code-playpad:theme`,f=`playpad-theme-change`,p={mode:null,light:`default-light`,dark:`default-dark`},m=null,h=!1;function g(e,t){return u.some(n=>n.id===e&&n.mode===t)?e:p[t]}function _(){let e=m;if(!e)try{e=JSON.parse(localStorage.getItem(d)??`null`)}catch{}return{mode:e?.mode===`light`||e?.mode===`dark`?e.mode:null,light:g(e?.light,`light`),dark:g(e?.dark,`dark`)}}function v(e){let t={..._(),...e};t.light=g(t.light,`light`),t.dark=g(t.dark,`dark`);try{localStorage.setItem(d,JSON.stringify(t)),m=null}catch{m=t}return window.dispatchEvent(new CustomEvent(f,{detail:t})),t}function y(e){h||(h=!0,window.addEventListener(`storage`,e=>{(e.key===d||e.key===null)&&window.dispatchEvent(new CustomEvent(f,{detail:_()}))}));let t=t=>e(t.detail);return window.addEventListener(f,t),()=>window.removeEventListener(f,t)}function b(){return u.flatMap(({id:e,mode:t,colors:n})=>n?[`:host([data-editor-theme="${e}"]) {
6
+ import{n as e,t}from"./types-CfcYqU2K.js";import{t as n}from"./hints-DpBIeoeG.js";import{t as r}from"./react-version.generated-BNNJmf7J.js";import{a as i,f as a,i as o,n as s,o as c,r as l,t as u}from"./config-3Z6xX6Jr.js";var d=[{id:`default-dark`,label:`One Dark`,mode:`dark`},{id:`monokai`,label:`Monokai`,mode:`dark`,colors:{bg:`#272822`,fg:`#f8f8f2`,muted:`#b4b19c`,surface:`#1e1f1a`,border:`#49483e`,accent:`#a6e22e`,accentFg:`#1e1f1a`,danger:`#ff6188`,ok:`#a6e22e`,selection:`#49483e`,activeLine:`#3e3d3266`,comment:`#a09b80`,keyword:`#ff5c94`,string:`#e6db74`,number:`#ae81ff`,fn:`#a6e22e`,type:`#66d9ef`,variable:`#f8f8f2`}},{id:`dracula`,label:`Dracula`,mode:`dark`,colors:{bg:`#282a36`,fg:`#f8f8f2`,muted:`#b6bcd6`,surface:`#21222c`,border:`#44475a`,accent:`#bd93f9`,accentFg:`#21222c`,danger:`#ff5555`,ok:`#50fa7b`,selection:`#44475a`,activeLine:`#44475a55`,comment:`#9aa5ce`,keyword:`#ff79c6`,string:`#f1fa8c`,number:`#bd93f9`,fn:`#50fa7b`,type:`#8be9fd`,variable:`#f8f8f2`}},{id:`nord`,label:`Nord`,mode:`dark`,colors:{bg:`#2e3440`,fg:`#d8dee9`,muted:`#b0b9c9`,surface:`#272c36`,border:`#434c5e`,accent:`#88c0d0`,accentFg:`#272c36`,danger:`#e08a91`,ok:`#a3be8c`,selection:`#434c5e`,activeLine:`#3b425266`,comment:`#a0abbf`,keyword:`#81a1c1`,string:`#a3be8c`,number:`#bd98b6`,fn:`#88c0d0`,type:`#8fbcbb`,variable:`#d8dee9`}},{id:`solarized-dark`,label:`Solarized Dark`,mode:`dark`,colors:{bg:`#002b36`,fg:`#c5d3d3`,muted:`#9fb0b0`,surface:`#00222b`,border:`#17505e`,accent:`#2aa198`,accentFg:`#00222b`,danger:`#f0746f`,ok:`#a3b300`,selection:`#17505e`,activeLine:`#073642aa`,comment:`#8fa3a8`,keyword:`#a3b300`,string:`#2aa198`,number:`#e87f7c`,fn:`#4ba3e3`,type:`#d6a100`,variable:`#c5d3d3`}},{id:`default-light`,label:`Default Light`,mode:`light`},{id:`github-light`,label:`GitHub Light`,mode:`light`,colors:{bg:`#ffffff`,fg:`#24292f`,muted:`#59636e`,surface:`#f6f8fa`,border:`#d1d9e0`,accent:`#0969da`,accentFg:`#ffffff`,danger:`#cf222e`,ok:`#1a7f37`,selection:`#b6d7ff`,activeLine:`#eaeef266`,comment:`#59636e`,keyword:`#cf222e`,string:`#0a3069`,number:`#0550ae`,fn:`#8250df`,type:`#953800`,variable:`#24292f`}},{id:`solarized-light`,label:`Solarized Light`,mode:`light`,colors:{bg:`#fdf6e3`,fg:`#47565c`,muted:`#566569`,surface:`#eee8d5`,border:`#d6cfb8`,accent:`#1f6fa8`,accentFg:`#ffffff`,danger:`#c0302c`,ok:`#5f6f00`,selection:`#e3dcc4`,activeLine:`#eee8d588`,comment:`#5c6c70`,keyword:`#5f6f00`,string:`#1a7a73`,number:`#c0302c`,fn:`#1f6fa8`,type:`#8f6a00`,variable:`#47565c`}}],f=`code-playpad:theme`,p=`playpad-theme-change`,m={mode:null,light:`default-light`,dark:`default-dark`},h=null,g=!1;function _(e,t){return d.some(n=>n.id===e&&n.mode===t)?e:m[t]}function v(){let e=h;if(!e)try{e=JSON.parse(localStorage.getItem(f)??`null`)}catch{}return{mode:e?.mode===`light`||e?.mode===`dark`?e.mode:null,light:_(e?.light,`light`),dark:_(e?.dark,`dark`)}}function y(e){let t={...v(),...e};t.light=_(t.light,`light`),t.dark=_(t.dark,`dark`);try{localStorage.setItem(f,JSON.stringify(t)),h=null}catch{h=t}return window.dispatchEvent(new CustomEvent(p,{detail:t})),t}function b(e){g||(g=!0,window.addEventListener(`storage`,e=>{(e.key===f||e.key===null)&&window.dispatchEvent(new CustomEvent(p,{detail:v()}))}));let t=t=>e(t.detail);return window.addEventListener(p,t),()=>window.removeEventListener(p,t)}function x(){return d.flatMap(({id:e,mode:t,colors:n})=>n?[`:host([data-editor-theme="${e}"]) {
7
7
  --cp-bg: ${n.bg};
8
8
  --cp-fg: ${n.fg};
9
9
  --cp-muted: ${n.muted};
@@ -15,7 +15,7 @@ import{n as e,t}from"./types-CfcYqU2K.js";import{t as n}from"./hints-DpBIeoeG.js
15
15
  --cp-ok: ${n.ok};
16
16
  color-scheme: ${t};
17
17
  }`]:[]).join(`
18
- `)}async function x(e){try{return await E(e)}catch(t){return console.warn(`[code-playpad] CodeMirror unavailable, using plain textarea:`,t),D(e)}}var S=/* @__PURE__ */ new Map,C=/* @__PURE__ */ new Set,w=!1;function T(){w||(w=!0,queueMicrotask(()=>{w=!1;for(let e of C){let t=[...e.adoptedStyleSheets];e.adoptedStyleSheets=[],e.adoptedStyleSheets=t}}))}async function E(e){let[t,n,r,i,a,o,s]=await Promise.all([import(`./dist-D4P7t1AU.js`).then(e=>e.s),import(`./dist-CjnVq6q1.js`).then(e=>e.x),import(`./dist-g8djAEMH.js`),import(`./dist-CTLX4tws.js`),import(`./dist-_fde-E8H.js`).then(e=>e.n),import(`./dist-DHeVjdBc.js`),import(`./dist-IFh_mUXG.js`).then(e=>e.t)]),{EditorView:c,keymap:l,lineNumbers:d,highlightActiveLine:f,highlightActiveLineGutter:p,highlightSpecialChars:m,drawSelection:h,rectangularSelection:g,crosshairCursor:_}=t,{EditorState:v,Compartment:y}=n,{defaultKeymap:b,history:x,historyKeymap:w,indentWithTab:E}=r,{syntaxHighlighting:D,defaultHighlightStyle:O,HighlightStyle:k,indentOnInput:A,bracketMatching:j,foldGutter:M,foldKeymap:N}=i,{autocompletion:P,closeBrackets:F,closeBracketsKeymap:I,completionKeymap:L}=a,R=new y,z=new y,B=new y,V=S.get(`default-light`)??[c.theme({"&":{color:`#1f2328`,backgroundColor:`#ffffff`},".cm-gutters":{backgroundColor:`#f6f8fa`,color:`#8b949e`,border:`none`},".cm-activeLine":{backgroundColor:`#f6f8fa88`},".cm-activeLineGutter":{backgroundColor:`#eaeef2`},".cm-cursor":{borderLeftColor:`#1f2328`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`#cfe3ff`}}),D(O,{fallback:!0})];S.set(`default-light`,V);let{tags:H}=s,U=(e,t)=>[c.theme({"&":{color:e.fg,backgroundColor:e.bg},".cm-content":{caretColor:e.fg},".cm-gutters":{backgroundColor:e.surface,color:e.muted,border:`none`},".cm-activeLine":{backgroundColor:e.activeLine},".cm-activeLineGutter":{backgroundColor:e.selection},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.fg},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-tooltip":{backgroundColor:e.surface,color:e.fg,border:`1px solid ${e.border}`},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:e.selection,color:e.fg}},{dark:t}),D(k.define([{tag:[H.comment,H.meta],color:e.comment,fontStyle:`italic`},{tag:[H.keyword,H.operatorKeyword,H.modifier],color:e.keyword},{tag:[H.string,H.special(H.string),H.regexp],color:e.string},{tag:[H.number,H.bool,H.null,H.atom],color:e.number},{tag:[H.function(H.variableName),H.function(H.propertyName),H.definition(H.function(H.variableName))],color:e.fn},{tag:[H.typeName,H.className,H.namespace,H.tagName],color:e.type},{tag:[H.variableName,H.propertyName,H.attributeName],color:e.variable},{tag:H.invalid,color:e.keyword,textDecoration:`underline`}]))],W=(e,t)=>{let n=u.find(e=>e.id===t);if(!n?.colors)return e?o.oneDark:V;let r=S.get(n.id);return r||(r=U(n.colors,n.mode===`dark`),S.set(n.id,r)),r},G=l.of([{key:`Mod-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)},{key:`Shift-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)}]),K=e.dark,q=e.themeId,J=e.readOnly,Y=e.language??[],X=t=>v.create({doc:t,extensions:[d(),p(),m(),x(),M(),h(),v.allowMultipleSelections.of(!0),A(),j(),F(),P(),g(),_(),f(),G,l.of([...I,...b,...w,...N,...L,E]),c.lineWrapping,B.of(Y),R.of(W(K,q)),z.of(v.readOnly.of(J)),c.updateListener.of(t=>{t.startState.facet(c.styleModule)!==t.state.facet(c.styleModule)&&T(),t.docChanged&&e.onChange?.(t.state.doc.toString())})]}),Z=new c({parent:e.parent,state:X(e.doc)});C.add(Z.root),T();let Q=/* @__PURE__ */ new Map,$=e.name??``;return{fallback:!1,getCode:()=>Z.state.doc.toString(),setCode(e){Z.dispatch({changes:{from:0,to:Z.state.doc.length,insert:e}})},openFile(e,t){if(e===$)return;Q.set($,Z.state);let n=Q.get(e);Z.setState(n??X(t)),$=e,n&&Z.dispatch({effects:[R.reconfigure(W(K,q)),z.reconfigure(v.readOnly.of(J)),B.reconfigure(Y)]}),T()},fileCode(e,t){if(e===$)return Z.state.doc.toString();let n=Q.get(e);return n?n.doc.toString():t},forgetFiles(e){for(let t of[...Q.keys()])e.includes(t)||Q.delete(t)},setTheme(e,t){K=e,q=t,Z.dispatch({effects:R.reconfigure(W(K,q))})},setReadOnly(e){J=e,Z.dispatch({effects:z.reconfigure(v.readOnly.of(J))})},setLanguage(e){Y=e,Z.dispatch({effects:B.reconfigure(Y)})},focus:()=>Z.focus(),destroy(){C.delete(Z.root),Z.destroy()}}}function D(e){let t=document.createElement(`textarea`);t.className=`cp-fallback-editor`,t.spellcheck=!1,t.value=e.doc,t.readOnly=e.readOnly,t.addEventListener(`input`,()=>e.onChange?.(t.value)),t.addEventListener(`keydown`,t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),e.onRun?.())}),e.parent.appendChild(t);let n=/* @__PURE__ */ new Map,r=e.name??``;return{fallback:!0,getCode:()=>t.value,setCode:e=>{t.value=e},openFile(e,i){e!==r&&(n.set(r,t.value),t.value=n.get(e)??i,r=e)},fileCode(e,i){return e===r?t.value:n.get(e)??i},forgetFiles(e){for(let t of[...n.keys()])e.includes(t)||n.delete(t)},setTheme:()=>{},setReadOnly:e=>{t.readOnly=e},setLanguage:()=>{},focus:()=>t.focus(),destroy:()=>t.remove()}}var O=/* @__PURE__ */ new Map,k=/* @__PURE__ */ new Map;function A(e,t){O.set(e,t)}function j(){return[...O.keys()]}function M(e){let t=k.get(e);if(t)return t;let n=O.get(e);if(!n)return Promise.reject(/* @__PURE__ */ Error(`Unknown runtime "${e}". Registered: ${j().join(`, `)||`none`}`));let r=n().catch(t=>{throw k.delete(e),t});return k.set(e,r),r}A(`python`,()=>import(`./pyodide-QurAOd7j.js`).then(e=>e.pythonRuntime)),A(`javascript`,()=>import(`./javascript-BBiCDtZ3.js`).then(e=>e.javascriptRuntime)),A(`typescript`,()=>import(`./javascript-BBiCDtZ3.js`).then(e=>e.typescriptRuntime)),A(`java`,()=>import(`./java-DjuG1fCk.js`).then(e=>e.javaRuntime)),A(`c`,()=>import(`./cpp-Bhr_Zgfk.js`).then(e=>e.cRuntime)),A(`cpp`,()=>import(`./cpp-Bhr_Zgfk.js`).then(e=>e.cppRuntime)),A(`react`,()=>import(`./react-DgCTfCMl.js`).then(e=>e.reactRuntime)),A(`next`,()=>import(`./next-CO6N0Gb9.js`).then(e=>e.nextRuntime));var N=String.raw`
18
+ `)}async function S(e){try{return await D(e)}catch(t){return console.warn(`[code-playpad] CodeMirror unavailable, using plain textarea:`,t),O(e)}}var C=/* @__PURE__ */ new Map,w=/* @__PURE__ */ new Set,T=!1;function E(){T||(T=!0,queueMicrotask(()=>{T=!1;for(let e of w){let t=[...e.adoptedStyleSheets];e.adoptedStyleSheets=[],e.adoptedStyleSheets=t}}))}async function D(e){let[t,n,r,i,a,o,s]=await Promise.all([import(`./dist-D4P7t1AU.js`).then(e=>e.s),import(`./dist-CjnVq6q1.js`).then(e=>e.x),import(`./dist-g8djAEMH.js`),import(`./dist-CTLX4tws.js`),import(`./dist-_fde-E8H.js`).then(e=>e.n),import(`./dist-DHeVjdBc.js`),import(`./dist-IFh_mUXG.js`).then(e=>e.t)]),{EditorView:c,keymap:l,lineNumbers:u,highlightActiveLine:f,highlightActiveLineGutter:p,highlightSpecialChars:m,drawSelection:h,rectangularSelection:g,crosshairCursor:_}=t,{EditorState:v,Compartment:y}=n,{defaultKeymap:b,history:x,historyKeymap:S,indentWithTab:T}=r,{syntaxHighlighting:D,defaultHighlightStyle:O,HighlightStyle:k,indentOnInput:A,bracketMatching:j,foldGutter:M,foldKeymap:N}=i,{autocompletion:P,closeBrackets:F,closeBracketsKeymap:I,completionKeymap:ee}=a,L=new y,R=new y,z=new y,B=C.get(`default-light`)??[c.theme({"&":{color:`#1f2328`,backgroundColor:`#ffffff`},".cm-gutters":{backgroundColor:`#f6f8fa`,color:`#8b949e`,border:`none`},".cm-activeLine":{backgroundColor:`#f6f8fa88`},".cm-activeLineGutter":{backgroundColor:`#eaeef2`},".cm-cursor":{borderLeftColor:`#1f2328`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`#cfe3ff`}}),D(O,{fallback:!0})];C.set(`default-light`,B);let{tags:V}=s,H=(e,t)=>[c.theme({"&":{color:e.fg,backgroundColor:e.bg},".cm-content":{caretColor:e.fg},".cm-gutters":{backgroundColor:e.surface,color:e.muted,border:`none`},".cm-activeLine":{backgroundColor:e.activeLine},".cm-activeLineGutter":{backgroundColor:e.selection},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.fg},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e.selection},".cm-tooltip":{backgroundColor:e.surface,color:e.fg,border:`1px solid ${e.border}`},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:e.selection,color:e.fg}},{dark:t}),D(k.define([{tag:[V.comment,V.meta],color:e.comment,fontStyle:`italic`},{tag:[V.keyword,V.operatorKeyword,V.modifier],color:e.keyword},{tag:[V.string,V.special(V.string),V.regexp],color:e.string},{tag:[V.number,V.bool,V.null,V.atom],color:e.number},{tag:[V.function(V.variableName),V.function(V.propertyName),V.definition(V.function(V.variableName))],color:e.fn},{tag:[V.typeName,V.className,V.namespace,V.tagName],color:e.type},{tag:[V.variableName,V.propertyName,V.attributeName],color:e.variable},{tag:V.invalid,color:e.keyword,textDecoration:`underline`}]))],U=(e,t)=>{let n=d.find(e=>e.id===t);if(!n?.colors)return e?o.oneDark:B;let r=C.get(n.id);return r||(r=H(n.colors,n.mode===`dark`),C.set(n.id,r)),r},W=l.of([{key:`Mod-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)},{key:`Shift-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)}]),G=e.dark,K=e.themeId,q=e.readOnly,J=e.language??[],Y=t=>v.create({doc:t,extensions:[u(),p(),m(),x(),M(),h(),v.allowMultipleSelections.of(!0),A(),j(),F(),P(),g(),_(),f(),W,l.of([...I,...b,...S,...N,...ee,T]),c.lineWrapping,z.of(J),L.of(U(G,K)),R.of(v.readOnly.of(q)),c.updateListener.of(t=>{t.startState.facet(c.styleModule)!==t.state.facet(c.styleModule)&&E(),t.docChanged&&e.onChange?.(t.state.doc.toString())})]}),X=new c({parent:e.parent,state:Y(e.doc)});w.add(X.root),E();let Z=/* @__PURE__ */ new Map,Q=e.name??``;return{fallback:!1,getCode:()=>X.state.doc.toString(),setCode(e){X.dispatch({changes:{from:0,to:X.state.doc.length,insert:e}})},openFile(e,t){if(e===Q)return;Z.set(Q,X.state);let n=Z.get(e);X.setState(n??Y(t)),Q=e,n&&X.dispatch({effects:[L.reconfigure(U(G,K)),R.reconfigure(v.readOnly.of(q)),z.reconfigure(J)]}),E()},fileCode(e,t){if(e===Q)return X.state.doc.toString();let n=Z.get(e);return n?n.doc.toString():t},forgetFiles(e){for(let t of[...Z.keys()])e.includes(t)||Z.delete(t)},setTheme(e,t){G=e,K=t,X.dispatch({effects:L.reconfigure(U(G,K))})},setReadOnly(e){q=e,X.dispatch({effects:R.reconfigure(v.readOnly.of(q))})},setLanguage(e){J=e,X.dispatch({effects:z.reconfigure(J)})},focus:()=>X.focus(),destroy(){w.delete(X.root),X.destroy()}}}function O(e){let t=document.createElement(`textarea`);t.className=`cp-fallback-editor`,t.spellcheck=!1,t.value=e.doc,t.readOnly=e.readOnly,t.addEventListener(`input`,()=>e.onChange?.(t.value)),t.addEventListener(`keydown`,t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),e.onRun?.())}),e.parent.appendChild(t);let n=/* @__PURE__ */ new Map,r=e.name??``;return{fallback:!0,getCode:()=>t.value,setCode:e=>{t.value=e},openFile(e,i){e!==r&&(n.set(r,t.value),t.value=n.get(e)??i,r=e)},fileCode(e,i){return e===r?t.value:n.get(e)??i},forgetFiles(e){for(let t of[...n.keys()])e.includes(t)||n.delete(t)},setTheme:()=>{},setReadOnly:e=>{t.readOnly=e},setLanguage:()=>{},focus:()=>t.focus(),destroy:()=>t.remove()}}var k=/* @__PURE__ */ new Map,A=/* @__PURE__ */ new Map;function j(e,t){k.set(e,t)}function M(){return[...k.keys()]}function N(e){let t=A.get(e);if(t)return t;let n=k.get(e);if(!n)return Promise.reject(/* @__PURE__ */ Error(`Unknown runtime "${e}". Registered: ${M().join(`, `)||`none`}`));let r=n().catch(t=>{throw A.delete(e),t});return A.set(e,r),r}j(`python`,()=>import(`./pyodide-C5KhmXre.js`).then(e=>e.pythonRuntime)),j(`javascript`,()=>import(`./javascript-kqyWH6DS.js`).then(e=>e.javascriptRuntime)),j(`typescript`,()=>import(`./javascript-kqyWH6DS.js`).then(e=>e.typescriptRuntime)),j(`java`,()=>import(`./java-2z8CcJaR.js`).then(e=>e.javaRuntime)),j(`c`,()=>import(`./cpp-BxFy0NSM.js`).then(e=>e.cRuntime)),j(`cpp`,()=>import(`./cpp-BxFy0NSM.js`).then(e=>e.cppRuntime)),j(`csharp`,()=>import(`./csharp-ByGGaB0V.js`).then(e=>e.csharpRuntime)),j(`cs`,()=>import(`./csharp-ByGGaB0V.js`).then(e=>e.csharpRuntime)),j(`react`,()=>import(`./react-BKPRfjtf.js`).then(e=>e.reactRuntime)),j(`next`,()=>import(`./next-Cb5W_u4U.js`).then(e=>e.nextRuntime));var P=String.raw`
19
19
  :host {
20
20
  --cp-bg: #ffffff;
21
21
  --cp-fg: #1f2328;
@@ -50,7 +50,7 @@ import{n as e,t}from"./types-CfcYqU2K.js";import{t as n}from"./hints-DpBIeoeG.js
50
50
  color-scheme: dark;
51
51
  }
52
52
 
53
- ${b()}
53
+ ${x()}
54
54
 
55
55
  * { box-sizing: border-box; }
56
56
 
@@ -566,13 +566,13 @@ table.cp-table th { background: var(--cp-bg); }
566
566
  @media (prefers-reduced-motion: reduce) {
567
567
  .cp-progress { animation: none; background-position: 0 0; background-size: 100% 100%; opacity: 0.4; }
568
568
  }
569
- `,P=e=>()=>import(`./dist-BwlTZqCY.js`).then(t=>t.javascript(e)),F={py:()=>import(`./dist-CRXZcpYD.js`).then(e=>e.python()),pyi:()=>import(`./dist-CRXZcpYD.js`).then(e=>e.python()),js:P({}),mjs:P({}),cjs:P({}),jsx:P({jsx:!0}),ts:P({typescript:!0}),mts:P({typescript:!0}),cts:P({typescript:!0}),tsx:P({typescript:!0,jsx:!0}),json:()=>import(`./dist-BDifu2bQ.js`).then(e=>e.json()),css:()=>import(`./dist-UbI3_a5S.js`).then(e=>e.css()),html:()=>import(`./dist-C41hAfPr.js`).then(e=>e.html()),c:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),h:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),cpp:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),cc:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),cxx:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),hpp:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),hxx:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),java:()=>import(`./dist-ixcYRC9x.js`).then(e=>e.java())};async function I(e,t){let n=e.includes(`.`)?e.slice(e.lastIndexOf(`.`)+1).toLowerCase():``,r=(t===`react`||t===`next`)&&n===`js`?F.jsx:F[n];return r?r().catch(()=>null):null}var L=`code-playpad`,R=1,z=`snippets`,B=`progress`,V=null;function H(){return typeof indexedDB>`u`?Promise.reject(/* @__PURE__ */ Error(`IndexedDB unavailable`)):(V||=new Promise((e,t)=>{let n=indexedDB.open(L,R);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(z)||e.createObjectStore(z),e.objectStoreNames.contains(B)||e.createObjectStore(B,{keyPath:`id`})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}).catch(e=>{throw V=null,e}),V)}function U(e,t,n){return H().then(r=>new Promise((i,a)=>{let o=n(r.transaction(e,t).objectStore(e));o.onsuccess=()=>i(o.result),o.onerror=()=>a(o.error)}))}function W(e,t){return U(z,`readwrite`,n=>n.put(t,e)).then(()=>void 0)}function G(e){return U(z,`readonly`,t=>t.get(e)).then(e=>e??null)}function K(e){return U(z,`readwrite`,t=>t.delete(e)).then(()=>void 0)}function q(e,t={}){let n={completed:!0,...t,id:e,updatedAt:Date.now()};return U(B,`readwrite`,e=>e.put(n)).then(()=>n)}function J(e){return U(B,`readonly`,t=>t.get(e)).then(e=>e??null)}function Y(){return U(B,`readonly`,e=>e.getAll())}var X=`code-playpad`;function Z(e){let t=e.replace(/\t/g,` `).split(`
569
+ `,F=e=>()=>import(`./dist-BwlTZqCY.js`).then(t=>t.javascript(e)),I={py:()=>import(`./dist-CRXZcpYD.js`).then(e=>e.python()),pyi:()=>import(`./dist-CRXZcpYD.js`).then(e=>e.python()),js:F({}),mjs:F({}),cjs:F({}),jsx:F({jsx:!0}),ts:F({typescript:!0}),mts:F({typescript:!0}),cts:F({typescript:!0}),tsx:F({typescript:!0,jsx:!0}),json:()=>import(`./dist-BDifu2bQ.js`).then(e=>e.json()),css:()=>import(`./dist-UbI3_a5S.js`).then(e=>e.css()),html:()=>import(`./dist-C41hAfPr.js`).then(e=>e.html()),c:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),h:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),cpp:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),cc:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),cxx:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),hpp:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),hxx:()=>import(`./dist-3xj9-ylK.js`).then(e=>e.cpp()),java:()=>import(`./dist-ixcYRC9x.js`).then(e=>e.java()),cs:()=>Promise.all([import(`./dist-CTLX4tws.js`),import(`./clike-C2M2Cbvf.js`)]).then(([e,t])=>e.StreamLanguage.define(t.csharp))};async function ee(e,t){let n=e.includes(`.`)?e.slice(e.lastIndexOf(`.`)+1).toLowerCase():``,r=(t===`react`||t===`next`)&&n===`js`?I.jsx:I[n];return r?r().catch(()=>null):null}var L=`code-playpad`,R=1,z=`snippets`,B=`progress`,V=null;function H(){return typeof indexedDB>`u`?Promise.reject(/* @__PURE__ */ Error(`IndexedDB unavailable`)):(V||=new Promise((e,t)=>{let n=indexedDB.open(L,R);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(z)||e.createObjectStore(z),e.objectStoreNames.contains(B)||e.createObjectStore(B,{keyPath:`id`})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}).catch(e=>{throw V=null,e}),V)}function U(e,t,n){return H().then(r=>new Promise((i,a)=>{let o=n(r.transaction(e,t).objectStore(e));o.onsuccess=()=>i(o.result),o.onerror=()=>a(o.error)}))}function W(e,t){return U(z,`readwrite`,n=>n.put(t,e)).then(()=>void 0)}function G(e){return U(z,`readonly`,t=>t.get(e)).then(e=>e??null)}function K(e){return U(z,`readwrite`,t=>t.delete(e)).then(()=>void 0)}function q(e,t={}){let n={completed:!0,...t,id:e,updatedAt:Date.now()};return U(B,`readwrite`,e=>e.put(n)).then(()=>n)}function J(e){return U(B,`readonly`,t=>t.get(e)).then(e=>e??null)}function Y(){return U(B,`readonly`,e=>e.getAll())}var X=`code-playpad`;function Z(e){let t=e.replace(/\t/g,` `).split(`
570
570
  `);for(;t.length&&t[0].trim()===``;)t.shift();for(;t.length&&t[t.length-1].trim()===``;)t.pop();let n=t.filter(e=>e.trim()!==``).reduce((e,t)=>Math.min(e,t.match(/^ */)[0].length),1/0);return(n===1/0?t:t.map(e=>e.slice(n))).join(`
571
- `)}var Q=2e5,$=`playpad-file`,ee={python:`main.py`,javascript:`main.js`,typescript:`main.ts`,java:`Main.java`,c:`main.c`,cpp:`main.cpp`,react:`src/main.jsx`,next:`app/page.jsx`};function te(e){return ee[e]??`main.txt`}var ne=e=>e.tagName===`SCRIPT`&&e.getAttribute(`type`)===`text/plain`;function re(e){return[...e.children].filter(e=>e.tagName.toLowerCase()===$&&[...e.children].some(e=>!ne(e))).map(e=>e.getAttribute(`name`)??``)}function ie(e,t){let n={};for(let t of e.children){if(t.tagName.toLowerCase()!==$)continue;let e=t.getAttribute(`name`),r=[...t.children].find(ne);e&&(n[e]=Z((r??t).textContent??``))}if(Object.keys(n).length)return n;let r=[...e.childNodes].filter(e=>e.nodeType!==Node.ELEMENT_NODE||e.tagName.toLowerCase()!==$),i=r.some(e=>e.nodeType===Node.ELEMENT_NODE),a=Z(r.filter(e=>!(i&&e.nodeType===Node.TEXT_NODE&&!(e.textContent??``).trim())).map(e=>e.textContent??``).join(``));return{[t]:a}}function ae(e,t){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t;return Object.keys(e).length?e:null}}catch{}return e?{[t]:e}:null}var oe=typeof HTMLElement>`u`?class{}:HTMLElement,se=class extends oe{static get observedAttributes(){return[`language`,`height`,`min-height`,`max-height`,`preview-height`,`tree-width`,`file-view`,`open-file`,`theme`,`theme-controls`,`readonly`,`autorun`,`stdin`,`persist`,`entry`,`practice`]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u=null;#d=null;#f=null;#p=null;#m={};#h={};#g=`main.py`;#_=null;#v;#y=!1;#b=null;#x=!1;#S=!1;#C=null;#w=null;#T=null;#E=()=>this.#fe();#D=null;#O=null;#k=!0;#A=[];#j=null;#M=null;#N=null;#P=0;#F=!1;#I=null;#L;#R;#z=null;#B=[];#V=/* @__PURE__ */ new Set;#H=null;#U=null;#W=null;constructor(){super(),this.#e=this.attachShadow({mode:`open`})}get code(){return this.#u?this.#u.getCode():this.#m[this.#g]??``}set code(e){this.#m[this.#g]=e,this.#Z()}get practice(){if(this.#I)return this.#I;let e=this.getAttribute(`practice`);if(!e)return null;try{return JSON.parse(e)}catch{return null}}set practice(e){this.#I=e}get files(){return this.#re()}set files(e){let t=Object.keys(e);if(!t.length)return;let n=Object.keys(this.#h);n.length===1&&!this.#h[n[0]]&&(this.#h={...e}),this.#m={...e},this.#B=[],t.includes(this.#g)||(this.#g=this.#te()),this.#u?.forgetFiles([]),this.#Z(),this.#ie(),this.#X()}get entry(){return this.#te()}set entry(e){this.setAttribute(`entry`,e)}openFile(e){if(e in this.#m){this.#u&&(this.#m[this.#g]=this.#u.getCode(),this.#u.openFile(e,this.#m[e]??``)),this.#g=e;for(let t=e.indexOf(`/`);t!==-1;t=e.indexOf(`/`,t+1))this.#V.delete(e.slice(0,t));this.#ie(),this.#X()}}get stdin(){return this.#l?this.#l.value:``}set stdin(e){this.#l&&(this.#l.value=e,this.#c.hidden=!1)}get language(){return this.getAttribute(`language`)||`python`}set language(e){this.setAttribute(`language`,e)}getCode(){return this.code}getFiles(){return this.#re()}reset(){this.#m={...this.#h},this.#g=this.#te(),this.#u?.forgetFiles([]),this.#Z(),this.#ie(),this.#he(),this.#s.hidden=!0,this.#se(),this.#z=null,this.#ce(),this.#me(this.#f?.ready?`${this.#f.label} ready`:``,`idle`)}async run(){if(this.#H)return this.#H.widget.run();if(this.#y)return;await this.#d;let e=this.#re(),r=this.getAttribute(`entry`);if(r&&!(r in e))return this.#$(r,e);this.#Q=!1;let i=this.#te(),a=e[i]??``;this.#y=!0,this.#x=!1,this.#n.disabled=!0,this.#r.hidden=!1,this.#he(),this.#s.hidden=!1;let o=this.practice;this.hasAttribute(`practice`)&&!o&&this.#ge(`The practice attribute is not valid JSON.
571
+ `)}var Q=2e5,$=`playpad-file`,te={python:`main.py`,javascript:`main.js`,typescript:`main.ts`,java:`Main.java`,c:`main.c`,cpp:`main.cpp`,csharp:`Program.cs`,cs:`Program.cs`,react:`src/main.jsx`,next:`app/page.jsx`};function ne(e){return te[e]??`main.txt`}var re=e=>e.tagName===`SCRIPT`&&e.getAttribute(`type`)===`text/plain`;function ie(e){return[...e.children].filter(e=>e.tagName.toLowerCase()===$&&[...e.children].some(e=>!re(e))).map(e=>e.getAttribute(`name`)??``)}function ae(e,t){let n={};for(let t of e.children){if(t.tagName.toLowerCase()!==$)continue;let e=t.getAttribute(`name`),r=[...t.children].find(re);e&&(n[e]=Z((r??t).textContent??``))}if(Object.keys(n).length)return n;let r=[...e.childNodes].filter(e=>e.nodeType!==Node.ELEMENT_NODE||e.tagName.toLowerCase()!==$),i=r.some(e=>e.nodeType===Node.ELEMENT_NODE),a=Z(r.filter(e=>!(i&&e.nodeType===Node.TEXT_NODE&&!(e.textContent??``).trim())).map(e=>e.textContent??``).join(``));return{[t]:a}}function oe(e,t){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t;return Object.keys(e).length?e:null}}catch{}return e?{[t]:e}:null}var se=typeof HTMLElement>`u`?class{}:HTMLElement,ce=class extends se{static get observedAttributes(){return[`language`,`height`,`min-height`,`max-height`,`preview-height`,`tree-width`,`file-view`,`open-file`,`theme`,`theme-controls`,`readonly`,`autorun`,`stdin`,`persist`,`entry`,`practice`]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u=null;#d=null;#f=null;#p=null;#m={};#h={};#g=`main.py`;#_=null;#v;#y=!1;#b=null;#x=!1;#S=!1;#C=null;#w=null;#T=null;#E=()=>this.#fe();#D=null;#O=null;#k=!0;#A=[];#j=null;#M=null;#N=null;#P=0;#F=!1;#I=null;#L;#R;#z=null;#B=[];#V=/* @__PURE__ */ new Set;#H=null;#U=null;#W=null;constructor(){super(),this.#e=this.attachShadow({mode:`open`})}get code(){return this.#u?this.#u.getCode():this.#m[this.#g]??``}set code(e){this.#m[this.#g]=e,this.#Z()}get practice(){if(this.#I)return this.#I;let e=this.getAttribute(`practice`);if(!e)return null;try{return JSON.parse(e)}catch{return null}}set practice(e){this.#I=e}get files(){return this.#re()}set files(e){let t=Object.keys(e);if(!t.length)return;let n=Object.keys(this.#h);n.length===1&&!this.#h[n[0]]&&(this.#h={...e}),this.#m={...e},this.#B=[],t.includes(this.#g)||(this.#g=this.#te()),this.#u?.forgetFiles([]),this.#Z(),this.#ie(),this.#X()}get entry(){return this.#te()}set entry(e){this.setAttribute(`entry`,e)}openFile(e){if(e in this.#m){this.#u&&(this.#m[this.#g]=this.#u.getCode(),this.#u.openFile(e,this.#m[e]??``)),this.#g=e;for(let t=e.indexOf(`/`);t!==-1;t=e.indexOf(`/`,t+1))this.#V.delete(e.slice(0,t));this.#ie(),this.#X()}}get stdin(){return this.#l?this.#l.value:``}set stdin(e){this.#l&&(this.#l.value=e,this.#c.hidden=!1)}get language(){return this.getAttribute(`language`)||`python`}set language(e){this.setAttribute(`language`,e)}getCode(){return this.code}getFiles(){return this.#re()}reset(){this.#m={...this.#h},this.#g=this.#te(),this.#u?.forgetFiles([]),this.#Z(),this.#ie(),this.#he(),this.#s.hidden=!0,this.#se(),this.#z=null,this.#ce(),this.#me(this.#f?.ready?`${this.#f.label} ready`:``,`idle`)}async run(){if(this.#H)return this.#H.widget.run();if(this.#y)return;await this.#d;let e=this.#re(),r=this.getAttribute(`entry`);if(r&&!(r in e))return this.#$(r,e);this.#Q=!1;let i=this.#te(),a=e[i]??``;this.#y=!0,this.#x=!1,this.#n.disabled=!0,this.#r.hidden=!1,this.#he(),this.#s.hidden=!1;let o=this.practice;this.hasAttribute(`practice`)&&!o&&this.#ge(`The practice attribute is not valid JSON.
572
572
  `,`cp-err`),this.#oe()&&(this.#z=e,this.#ce(),this.#B.length&&this.#ge(`${this.#B.join(`, `)}: HTML tags in this file's markup were read as elements, so its code is incomplete. Write < as &lt;, or put the code in <script type="text/plain">. A <script> left unescaped runs on the host page.\n`,`cp-err`)),this.#Se(`py-run`,{code:a,entry:i,files:e,language:this.language,...o?{practice:o}:{}});try{let r=await this.#Y();if(this.#x)throw new t;if(o&&!r.supportsPractice)throw Error(`Practice mode is not available for ${r.label}.`);this.#me(`Queued…`,`busy`),this.#o.hidden=!1;let s=r.run(a,{stdin:this.#l.value,files:e,entry:i,onStart:()=>this.#me(`Running…`,`busy`),onProgress:e=>this.#me(e.message,`busy`),onStdout:e=>this.#ge(e),onStderr:e=>this.#ge(e,`cp-err`),onEcho:e=>this.#ge(e,`cp-in`),onStdinRequest:()=>this.#ve(),...o?{practice:o}:{},...this.#oe()?{preview:{host:this.#L,onStart:()=>this.#me(`Running…`,`busy`),onConsole:(e,t)=>{this.#ge(`${t}\n`,e===`error`?`cp-err`:e===`warn`?`cp-warn`:void 0),this.#Ce(`playpad-console`,{level:e,text:t,language:this.language})},onRender:e=>this.#Ce(`playpad-render`,{rootText:e,language:this.language}),onError:e=>{this.#me(`Error`,`error`),this.#Se(`py-error`,{...e,language:this.language})}}}:{}});this.#b={runtime:r,run:s};let c=await s;if(c.table&&this.#xe(c.table),c.value!==void 0&&this.#ge(`${c.value}\n`,`cp-value`),c.hint&&this.#be(c.hint,n.has(c)),c.failed=r.statusDecidesFailure?c.failed===!0:!!c.stderr,c.failed)this.#me(`Error · ${c.durationMs} ms`,`error`),this.#Se(`py-error`,{message:c.problem?.message??c.stderr??``,hint:c.hint,language:this.language,...c.problem??{}});else if(c.cases){let e=c.cases.filter(e=>e.expected!==void 0).length,t=c.passed===e;this.#me(e?`${c.passed} of ${e} passed · ${c.durationMs} ms`:`Done in ${c.durationMs} ms`,t?`ok`:`error`)}else this.#me(`Done in ${c.durationMs} ms`,`ok`);return this.#Se(`py-output`,{...c,language:this.language}),c}catch(e){if(e instanceof t)this.#ge(`
573
573
  [stopped]
574
574
  `,`cp-err`),this.#me(`Stopped`,`error`);else{let t=e instanceof Error?e.message:String(e);this.#ge(t+`
575
- `,`cp-err`),this.#me(`Failed to start`,`error`),this.#Se(`py-error`,{message:t,language:this.language})}return}finally{this.#b=null,this.#ye(null),this.#_e(),this.#y=!1,this.#n.disabled=!1,this.#r.hidden=!(this.#oe()&&this.#f?.hasLivePreview?.(this.#L)),this.#o.hidden=!0}}stop(){this.#H?this.#H.widget.stop():this.#b?this.#b.runtime.stop?.(this.#b.run):this.#y?this.#x=!0:this.#oe()&&this.#f?.hasLivePreview?.(this.#L)&&(this.#se(),this.#r.hidden=!0,this.#me(`Stopped`,`idle`))}openWindow(){if(this.#H)return this.#H.window.focus(),!0;if(this.#U)return!1;let e=window.open(``,`_blank`,`popup,width=1280,height=800`);if(!e)return this.#me(`The browser blocked the new window`,`error`),!1;let t=this.#re(),n=this.#g,r=document.createElement(this.localName);for(let e of[`language`,`entry`,`file-view`,`preview-height`,`tree-width`,`theme`,`theme-controls`,`readonly`,`stdin`]){let t=this.getAttribute(e);t!==null&&r.setAttribute(e,t)}r.setAttribute(`data-window`,``),r.#U=this,r.#W={...this.#h},r.#_=t,this.#se(),this.#r.hidden=!0,e.document.title=`Code playground`,e.document.documentElement.style.height=`100%`,e.document.body.style.cssText=`margin:0;height:100%`,e.document.body.append(r);let i=()=>this.closeWindow();return window.addEventListener(`pagehide`,i),this.#H={window:e,widget:r,onLeave:i,timer:setInterval(()=>{e.closed&&this.closeWindow()},300)},this.#e.querySelector(`.cp-root`)?.classList.add(`cp-popped`),r.#d?.then(()=>(r.openFile(n),r.run())),!0}closeWindow(){let e=this.#H;if(!e)return;this.#H=null,clearInterval(e.timer),window.removeEventListener(`pagehide`,e.onLeave);let{widget:t}=e,n=t.#re(),r=t.#g;t.#se(),t.remove(),e.window.closed||e.window.close(),this.#e.querySelector(`.cp-root`)?.classList.remove(`cp-popped`),this.files=n,this.openFile(r),this.#me(``,`idle`)}prewarm(){return this.#Y()}connectedCallback(){this.#F?(this.#fe(),this.#J()):!this.textContent?.trim()&&document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.#G(),{once:!0}):this.#G()}disconnectedCallback(){this.#C?.disconnect(),this.#C=null,this.#w?.removeEventListener(`change`,this.#E),this.#w=null,this.#T?.disconnect(),this.#T=null,this.#D?.(),this.#D=null,this.#O&&clearTimeout(this.#O),this.#ye(null),setTimeout(()=>{this.isConnected||(this.closeWindow(),this.#se(),this.#u&&(this.#_=this.#re(),this.#u.destroy(),this.#u=null,this.#d=null,this.#F=!1))},0)}attributeChangedCallback(e,t,n){if(this.#F)switch(e){case`theme`:case`theme-controls`:this.#fe();break;case`height`:case`min-height`:case`max-height`:case`preview-height`:case`tree-width`:this.#pe();break;case`readonly`:this.#u?.setReadOnly(n!==null);break;case`stdin`:this.#c.hidden=n===null&&!this.#l.value;break;case`entry`:case`file-view`:this.#ie();break;case`language`:this.#se(),this.#e.querySelector(`.cp-root`)?.classList.toggle(`cp-has-preview`,this.#oe()),this.#f=null,this.#p=null,this.#S=!1,this.#Y().catch(()=>{})}}#G(){this.#F=!0,this.#h=this.#W??ie(this,this.#ee()),this.#B=this.#oe()?re(this):[],this.#m=this.#_??{...this.#h},this.#g=this.#ne(),this.#K(),this.#fe(),this.#pe();let e=this.getAttribute(`persist`);this.#d=(async()=>{if(e&&this.#_==null){let t=await G(e).catch(()=>null),n=t==null?null:ae(t,this.#ee());if(n){let e={},t=Object.keys(this.#h),r=Object.keys(n);for(let r of t)e[r]=n[r]??this.#h[r];t.length===1&&r.length===1&&!(t[0]in n)&&(e[t[0]]=n[r[0]]),this.#m=e,this.#g=this.#ne()}}this.#ie();let t=await M(this.language).catch(()=>null),n=t?await t.editorLanguage().catch(()=>null):null;this.#u=await x({parent:this.#t,doc:this.#m[this.#g]??``,name:this.#g,dark:this.#ue(),themeId:this.#de(),readOnly:this.hasAttribute(`readonly`),language:n,onRun:()=>void this.run(),onChange:e=>this.#le(e)}),this.#_=null,this.#fe(),this.#X()})(),this.#J()}#K(){let e=document.createElement(`style`);e.textContent=N;let t=document.createElement(`div`);t.className=this.#oe()?`cp-root cp-has-preview`:`cp-root`,t.innerHTML=`
575
+ `,`cp-err`),this.#me(`Failed to start`,`error`),this.#Se(`py-error`,{message:t,language:this.language})}return}finally{this.#b=null,this.#ye(null),this.#_e(),this.#y=!1,this.#n.disabled=!1,this.#r.hidden=!(this.#oe()&&this.#f?.hasLivePreview?.(this.#L)),this.#o.hidden=!0}}stop(){this.#H?this.#H.widget.stop():this.#b?this.#b.runtime.stop?.(this.#b.run):this.#y?this.#x=!0:this.#oe()&&this.#f?.hasLivePreview?.(this.#L)&&(this.#se(),this.#r.hidden=!0,this.#me(`Stopped`,`idle`))}openWindow(){if(this.#H)return this.#H.window.focus(),!0;if(this.#U)return!1;let e=window.open(``,`_blank`,`popup,width=1280,height=800`);if(!e)return this.#me(`The browser blocked the new window`,`error`),!1;let t=this.#re(),n=this.#g,r=document.createElement(this.localName);for(let e of[`language`,`entry`,`file-view`,`preview-height`,`tree-width`,`theme`,`theme-controls`,`readonly`,`stdin`]){let t=this.getAttribute(e);t!==null&&r.setAttribute(e,t)}r.setAttribute(`data-window`,``),r.#U=this,r.#W={...this.#h},r.#_=t,this.#se(),this.#r.hidden=!0,e.document.title=`Code playground`,e.document.documentElement.style.height=`100%`,e.document.body.style.cssText=`margin:0;height:100%`,e.document.body.append(r);let i=()=>this.closeWindow();return window.addEventListener(`pagehide`,i),this.#H={window:e,widget:r,onLeave:i,timer:setInterval(()=>{e.closed&&this.closeWindow()},300)},this.#e.querySelector(`.cp-root`)?.classList.add(`cp-popped`),r.#d?.then(()=>(r.openFile(n),r.run())),!0}closeWindow(){let e=this.#H;if(!e)return;this.#H=null,clearInterval(e.timer),window.removeEventListener(`pagehide`,e.onLeave);let{widget:t}=e,n=t.#re(),r=t.#g;t.#se(),t.remove(),e.window.closed||e.window.close(),this.#e.querySelector(`.cp-root`)?.classList.remove(`cp-popped`),this.files=n,this.openFile(r),this.#me(``,`idle`)}prewarm(){return this.#Y()}connectedCallback(){this.#F?(this.#fe(),this.#J()):!this.textContent?.trim()&&document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.#G(),{once:!0}):this.#G()}disconnectedCallback(){this.#C?.disconnect(),this.#C=null,this.#w?.removeEventListener(`change`,this.#E),this.#w=null,this.#T?.disconnect(),this.#T=null,this.#D?.(),this.#D=null,this.#O&&clearTimeout(this.#O),this.#ye(null),setTimeout(()=>{this.isConnected||(this.closeWindow(),this.#se(),this.#u&&(this.#_=this.#re(),this.#u.destroy(),this.#u=null,this.#d=null,this.#F=!1))},0)}attributeChangedCallback(e,t,n){if(this.#F)switch(e){case`theme`:case`theme-controls`:this.#fe();break;case`height`:case`min-height`:case`max-height`:case`preview-height`:case`tree-width`:this.#pe();break;case`readonly`:this.#u?.setReadOnly(n!==null);break;case`stdin`:this.#c.hidden=n===null&&!this.#l.value;break;case`entry`:case`file-view`:this.#ie();break;case`language`:this.#se(),this.#e.querySelector(`.cp-root`)?.classList.toggle(`cp-has-preview`,this.#oe()),this.#f=null,this.#p=null,this.#S=!1,this.#Y().catch(()=>{})}}#G(){this.#F=!0,this.#h=this.#W??ae(this,this.#ee()),this.#B=this.#oe()?ie(this):[],this.#m=this.#_??{...this.#h},this.#g=this.#ne(),this.#K(),this.#fe(),this.#pe();let e=this.getAttribute(`persist`);this.#d=(async()=>{if(e&&this.#_==null){let t=await G(e).catch(()=>null),n=t==null?null:oe(t,this.#ee());if(n){let e={},t=Object.keys(this.#h),r=Object.keys(n);for(let r of t)e[r]=n[r]??this.#h[r];t.length===1&&r.length===1&&!(t[0]in n)&&(e[t[0]]=n[r[0]]),this.#m=e,this.#g=this.#ne()}}this.#ie();let t=await N(this.language).catch(()=>null),n=t?await t.editorLanguage().catch(()=>null):null;this.#u=await S({parent:this.#t,doc:this.#m[this.#g]??``,name:this.#g,dark:this.#ue(),themeId:this.#de(),readOnly:this.hasAttribute(`readonly`),language:n,onRun:()=>void this.run(),onChange:e=>this.#le(e)}),this.#_=null,this.#fe(),this.#X()})(),this.#J()}#K(){let e=document.createElement(`style`);e.textContent=P;let t=document.createElement(`div`);t.className=this.#oe()?`cp-root cp-has-preview`:`cp-root`,t.innerHTML=`
576
576
  <div class="cp-toolbar">
577
577
  <button class="cp-primary" part="run-button" data-action="run">Run</button>
578
578
  <button class="cp-danger" part="stop-button" data-action="stop" hidden>Stop</button>
@@ -585,7 +585,7 @@ table.cp-table th { background: var(--cp-bg); }
585
585
  <label part="editor-theme-picker" class="cp-theme-picker" title="Editor theme">
586
586
  <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.4 0 2-.9 2-1.8 0-1.2-1-1.7-1-2.7 0-1 .8-1.5 1.8-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8z"/><circle cx="7.5" cy="11.5" r="1"/><circle cx="10.5" cy="7.5" r="1"/><circle cx="15.5" cy="7.5" r="1"/></svg>
587
587
  <select aria-label="Editor theme">
588
- ${[`dark`,`light`].map(e=>`<optgroup label="${e===`dark`?`Dark`:`Light`}">${u.filter(t=>t.mode===e).map(e=>`<option value="${e.id}">${e.label}</option>`).join(``)}</optgroup>`).join(``)}
588
+ ${[`dark`,`light`].map(e=>`<optgroup label="${e===`dark`?`Dark`:`Light`}">${d.filter(t=>t.mode===e).map(e=>`<option value="${e.id}">${e.label}</option>`).join(``)}</optgroup>`).join(``)}
589
589
  </select>
590
590
  </label>
591
591
  <button part="window-button" class="cp-icon-button cp-window-button" data-action="window" aria-label="Open in window" title="Open in a separate window you can resize">
@@ -616,10 +616,10 @@ table.cp-table th { background: var(--cp-bg); }
616
616
  <div class="cp-split cp-split-console" role="separator" tabindex="0" aria-orientation="horizontal" aria-label="Resize the preview and the console"></div>
617
617
  <pre class="cp-output" part="output" hidden></pre>
618
618
  </div>
619
- </div>`,this.#e.replaceChildren(e,t),this.#n=t.querySelector(`[data-action="run"]`),this.#r=t.querySelector(`[data-action="stop"]`),this.#i=t.querySelector(`[data-action="reset"]`),this.#a=t.querySelector(`.cp-status`),this.#o=t.querySelector(`.cp-progress`),this.#v=t.querySelector(`.cp-tabs`),this.#t=t.querySelector(`.cp-editor`),this.#c=t.querySelector(`.cp-stdin`),this.#l=t.querySelector(`.cp-stdin textarea`),this.#s=t.querySelector(`.cp-output`),this.#L=t.querySelector(`.cp-preview`),this.#R=t.querySelector(`.cp-edited-note`),this.#oe()||t.querySelector(`.cp-source`).after(this.#s),this.#c.hidden=!this.hasAttribute(`stdin`),this.#l.addEventListener(`input`,()=>this.#c.classList.remove(`cp-attention`)),this.#v.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button[data-file]`);n&&this.openFile(n.getAttribute(`data-file`));let r=t.closest(`button[data-folder]`)?.dataset.folder;r!==void 0&&(this.#V.delete(r)||this.#V.add(r),this.#ie())}),this.#n.addEventListener(`click`,()=>void this.run()),this.#r.addEventListener(`click`,()=>this.stop()),this.#i.addEventListener(`click`,()=>this.reset()),t.querySelector(`[data-action="theme"]`).addEventListener(`click`,()=>{v({mode:this.#ue()?`light`:`dark`})}),t.querySelector(`.cp-theme-picker select`).addEventListener(`change`,e=>{let t=e.target.value,n=u.find(e=>e.id===t)?.mode;n&&v({mode:n,[n]:t})}),t.querySelector(`[data-action="window"]`).addEventListener(`click`,()=>this.openWindow()),t.querySelector(`[data-action="show-window"]`).addEventListener(`click`,()=>this.openWindow()),t.querySelector(`[data-action="close-window"]`).addEventListener(`click`,()=>this.closeWindow()),this.#q(t);let n=()=>void this.#Y().catch(()=>{});this.#t.addEventListener(`pointerdown`,n,{once:!0}),this.#t.addEventListener(`focusin`,n,{once:!0})}#q(e){let t=e.querySelector(`.cp-body`),n=e.querySelector(`.cp-source`),r=e.querySelector(`.cp-preview`),i=e.querySelector(`.cp-preview-pane`),a=this.#v,o=(e,t,n)=>Math.round(Math.max(t,Math.min(e,Math.max(t,n)))),s=(t,n)=>e.style.setProperty(t,`${n}px`),c=(t,n,r,i,a)=>{let o=()=>t.setAttribute(`aria-orientation`,n()===`x`?`vertical`:`horizontal`);t.addEventListener(`pointerdown`,a=>{a.preventDefault();let o=n()===`x`,s=o?a.clientX:a.clientY,c=r();t.setPointerCapture(a.pointerId),e.classList.add(`cp-dragging`,o?`cp-dragging-x`:`cp-dragging-y`);let l=e=>i(c+(o?e.clientX:e.clientY)-s),u=()=>{e.classList.remove(`cp-dragging`,`cp-dragging-x`,`cp-dragging-y`),t.removeEventListener(`pointermove`,l),t.removeEventListener(`pointerup`,u),t.removeEventListener(`pointercancel`,u)};t.addEventListener(`pointermove`,l),t.addEventListener(`pointerup`,u),t.addEventListener(`pointercancel`,u)}),t.addEventListener(`keydown`,e=>{let t={ArrowLeft:-24,ArrowUp:-24,ArrowRight:24,ArrowDown:24}[e.key];t&&(e.preventDefault(),i(r()+t))}),t.addEventListener(`dblclick`,a),t.addEventListener(`focus`,o),t.addEventListener(`pointerenter`,o)},l=()=>getComputedStyle(t).flexDirection===`row`&&getComputedStyle(t).display===`flex`;c(e.querySelector(`.cp-split-tree`),()=>`x`,()=>a.getBoundingClientRect().width,e=>s(`--cp-tree-width`,o(e,90,n.getBoundingClientRect().width-160)),()=>e.style.removeProperty(`--cp-tree-width`)),c(e.querySelector(`.cp-split-main`),()=>l()?`x`:`y`,()=>l()?n.getBoundingClientRect().width:this.#t.getBoundingClientRect().height,n=>{l()?s(`--cp-source-width`,o(n,200,t.getBoundingClientRect().width-200)):(s(`--cp-editor-height`,o(n,80,this.#U?t.getBoundingClientRect().height-100:2e3)),e.classList.add(`cp-editor-sized`))},()=>{e.style.removeProperty(`--cp-source-width`),e.style.removeProperty(`--cp-editor-height`),e.classList.remove(`cp-editor-sized`)}),c(e.querySelector(`.cp-split-console`),()=>`y`,()=>r.getBoundingClientRect().height,e=>s(`--cp-preview-height`,o(e,60,l()||this.#U?i.getBoundingClientRect().height-40:2e3)),()=>e.style.removeProperty(`--cp-preview-height`))}#J(){this.#U||this.#C||typeof IntersectionObserver>`u`||(this.#C=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this.#C?.disconnect(),this.#C=null,this.#Y().then(()=>{this.hasAttribute(`autorun`)&&this.run()}).catch(()=>{}))},{rootMargin:`300px`}),this.#C.observe(this))}#Y(){return this.#p||=(async()=>{let e=await M(this.language);this.#f=e,!e.ready&&!this.#Q&&(this.#o.hidden=!1,this.#me(`Loading ${e.label}…`,`busy`));try{await e.load(e=>{!this.#y&&!this.#Q&&this.#me(e.message,e.phase===`ready`?`ok`:`busy`)})}catch(e){this.#p=null,this.#me(`Runtime unavailable`,`error`);let t=e instanceof Error?e.message:String(e);throw this.#ge(t+`
620
- `,`cp-err`),this.#s.hidden=!1,e}finally{this.#o.hidden=!0}return this.#X(),this.#S||(this.#S=!0,this.#Q||this.#me(`${e.label} ready`,`ok`),this.#Se(`py-ready`,{language:e.id,label:e.label})),e})(),this.#p}async#X(){if(!this.#u)return;let e=this.#g,t=await I(e,this.language);if(t){this.#g===e&&this.#u?.setLanguage(t);return}let n=e.includes(`.`)?null:await(this.#f??await M(this.language).catch(()=>null))?.editorLanguage().catch(()=>null);this.#g===e&&this.#u?.setLanguage(n??[])}#Z(){this.#u?this.#u.setCode(this.#m[this.#g]??``):this.#d?.then(()=>{this.#u?.setCode(this.#m[this.#g]??``),this.#ie()})}#Q=!1;#$(e,t){let n=Object.keys(t),r=`This widget's entry is "${e}", but it has no file of that name${n.length?` (its files: ${n.join(`, `)})`:``}. Set entry to one of its files.\n`;this.#he(),this.#s.hidden=!1,this.#ge(r,`cp-err`),this.#Q=!0,this.#me(`Error · entry not found`,`error`);let i={stdout:``,stderr:r,durationMs:0,failed:!0};return this.#Se(`py-error`,{message:r,language:this.language}),this.#Se(`py-output`,{...i,language:this.language}),i}#ee(){return this.getAttribute(`entry`)||te(this.language)}#te(){let e=Object.keys(this.#m),t=this.getAttribute(`entry`);if(t&&e.includes(t))return t;let n=this.#oe()&&e.includes(`index.html`)?`index.html`:te(this.language);return e.includes(n)?n:e[0]??n}#ne(){let e=this.getAttribute(`open-file`);return e&&e in this.#m?e:this.#te()}#re(){if(this.#H)return this.#H.widget.#re();let e={...this.#m};if(this.#u)for(let t of Object.keys(e))e[t]=this.#u.fileCode(t,e[t]);return e}#ie(){let e=Object.keys(this.#m);this.#v.hidden=e.length<2;let t=!this.#v.hidden&&this.getAttribute(`file-view`)===`tree`;if(this.#v.classList.toggle(`cp-tree`,t),this.#e.querySelector(`.cp-root`)?.classList.toggle(`cp-has-tree`,t),this.#v.hidden){this.#v.replaceChildren();return}if(t){this.#ae(e),this.#ce();return}let n=this.#te();this.#v.replaceChildren(...e.map(e=>{let t=document.createElement(`button`);t.dataset.file=e;let r=e.lastIndexOf(`/`)+1;if(r){let n=document.createElement(`span`);n.className=`cp-tab-folder`,n.textContent=e.slice(0,r),t.setAttribute(`aria-label`,e),t.append(n)}return t.append(e.slice(r)),t.setAttribute(`aria-pressed`,String(e===this.#g)),e===n&&(t.classList.add(`cp-entry`),t.title=`entry point — this is the file Run executes`),t})),this.#ce()}#ae(e){let t=this.#te(),n=[],r=(i,a)=>{let o=e.filter(e=>e.startsWith(i)).map(e=>e.slice(i.length)),s=[...new Set(o.filter(e=>e.includes(`/`)).map(e=>e.slice(0,e.indexOf(`/`))))].sort();for(let e of s){let t=i+e,o=!this.#V.has(t),s=document.createElement(`button`);s.className=`cp-tree-folder`,s.dataset.folder=t,s.textContent=e,s.setAttribute(`aria-expanded`,String(o)),s.style.setProperty(`--cp-depth`,String(a)),n.push(s),o&&r(`${t}/`,a+1)}for(let e of o.filter(e=>!e.includes(`/`)).sort()){let r=i+e,o=document.createElement(`button`);o.dataset.file=r,o.textContent=e,o.setAttribute(`aria-label`,r),o.setAttribute(`aria-pressed`,String(r===this.#g)),o.style.setProperty(`--cp-depth`,String(a)),r===t&&(o.classList.add(`cp-entry`),o.title=`entry point — this is the file Run executes`),n.push(o)}};r(``,0),this.#v.replaceChildren(...n)}#oe(){return this.language===`react`||this.language===`next`}#se(){this.#L&&(this.#f?.dispose?.(this.#L),this.#L.replaceChildren())}#ce(){if(!this.#oe())return;let e=this.#re();for(let t of this.#v.querySelectorAll(`button[data-file]`)){let n=t.dataset.file;t.classList.toggle(`cp-edited`,e[n]!==this.#h[n])}let t=this.#z;this.#R.hidden=!t||Object.keys(e).every(n=>e[n]===t[n])}#le(e){this.#m[this.#g]=e,this.#ce();let t=this.getAttribute(`persist`);if(!t)return;this.#O&&clearTimeout(this.#O);let n=JSON.stringify(this.#re());this.#O=setTimeout(()=>void W(t,n).catch(()=>{}),400)}#ue(){let e=this.getAttribute(`theme`)??`auto`;if(e===`dark`)return!0;if(e===`light`)return!1;let t=_().mode;if(t)return t===`dark`;let n=typeof document>`u`?``:getComputedStyle(document.documentElement).colorScheme,r=n.includes(`dark`);return r===n.includes(`light`)?!!this.#w?.matches:r}#de(){return _()[this.#ue()?`dark`:`light`]}#fe(){this.#D??=y(this.#E),!this.#w&&typeof matchMedia==`function`&&(this.#w=matchMedia(`(prefers-color-scheme: dark)`),this.#w.addEventListener(`change`,this.#E)),!this.#T&&typeof MutationObserver==`function`&&typeof document<`u`&&(this.#T=new MutationObserver(this.#E),this.#T.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`,`data-theme`,`data-color-scheme`,`color-scheme`]}));let e=this.#ue(),t=this.#de();this.setAttribute(`data-resolved-theme`,e?`dark`:`light`),this.setAttribute(`data-editor-theme`,t),this.#u?.setTheme(e,t);let n=this.getAttribute(`theme`),r=n===`light`||n===`dark`||this.getAttribute(`theme-controls`)===`off`,i=this.#e.querySelector(`[data-action="theme"]`),a=this.#e.querySelector(`.cp-theme-picker`);if(i&&a){let n=e?`Switch to the light theme`:`Switch to the dark theme`;i.hidden=a.hidden=r,i.title=n,i.setAttribute(`aria-label`,n),a.querySelector(`select`).value=t}}#pe(){for(let[e,t]of[[`height`,`--cp-height`],[`min-height`,`--cp-min-height`],[`max-height`,`--cp-max-height`],[`preview-height`,`--cp-preview-height`]]){let n=this.getAttribute(e);n===null||n===``?this.style.removeProperty(t):this.style.setProperty(t,/^\d+$/.test(n)?`${n}px`:n)}let e=this.getAttribute(`tree-width`)?.trim();e?/^(\d+(px)?|\d+(\.\d+)?%)$/.test(e)?this.style.setProperty(`--cp-tree-width`,/\d$/.test(e)?`${e}px`:e):(this.style.removeProperty(`--cp-tree-width`),console.warn(`code-playpad: tree-width="${e}" is not a size. Use a percentage like "20%" or pixels like "240".`)):this.style.removeProperty(`--cp-tree-width`)}#me(e,t){this.#a.textContent=e,this.#a.dataset.state=t}#he(){this.#N&&clearTimeout(this.#N),this.#N=null,this.#A=[],this.#P=0,this.#s.replaceChildren(),this.#k=!0}#ge(e,t){if(!e)return;let n=t===`cp-err`&&!this.#k?`\n${e}`:e;this.#k=n.endsWith(`
619
+ </div>`,this.#e.replaceChildren(e,t),this.#n=t.querySelector(`[data-action="run"]`),this.#r=t.querySelector(`[data-action="stop"]`),this.#i=t.querySelector(`[data-action="reset"]`),this.#a=t.querySelector(`.cp-status`),this.#o=t.querySelector(`.cp-progress`),this.#v=t.querySelector(`.cp-tabs`),this.#t=t.querySelector(`.cp-editor`),this.#c=t.querySelector(`.cp-stdin`),this.#l=t.querySelector(`.cp-stdin textarea`),this.#s=t.querySelector(`.cp-output`),this.#L=t.querySelector(`.cp-preview`),this.#R=t.querySelector(`.cp-edited-note`),this.#oe()||t.querySelector(`.cp-source`).after(this.#s),this.#c.hidden=!this.hasAttribute(`stdin`),this.#l.addEventListener(`input`,()=>this.#c.classList.remove(`cp-attention`)),this.#v.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button[data-file]`);n&&this.openFile(n.getAttribute(`data-file`));let r=t.closest(`button[data-folder]`)?.dataset.folder;r!==void 0&&(this.#V.delete(r)||this.#V.add(r),this.#ie())}),this.#n.addEventListener(`click`,()=>void this.run()),this.#r.addEventListener(`click`,()=>this.stop()),this.#i.addEventListener(`click`,()=>this.reset()),t.querySelector(`[data-action="theme"]`).addEventListener(`click`,()=>{y({mode:this.#ue()?`light`:`dark`})}),t.querySelector(`.cp-theme-picker select`).addEventListener(`change`,e=>{let t=e.target.value,n=d.find(e=>e.id===t)?.mode;n&&y({mode:n,[n]:t})}),t.querySelector(`[data-action="window"]`).addEventListener(`click`,()=>this.openWindow()),t.querySelector(`[data-action="show-window"]`).addEventListener(`click`,()=>this.openWindow()),t.querySelector(`[data-action="close-window"]`).addEventListener(`click`,()=>this.closeWindow()),this.#q(t);let n=()=>void this.#Y().catch(()=>{});this.#t.addEventListener(`pointerdown`,n,{once:!0}),this.#t.addEventListener(`focusin`,n,{once:!0})}#q(e){let t=e.querySelector(`.cp-body`),n=e.querySelector(`.cp-source`),r=e.querySelector(`.cp-preview`),i=e.querySelector(`.cp-preview-pane`),a=this.#v,o=(e,t,n)=>Math.round(Math.max(t,Math.min(e,Math.max(t,n)))),s=(t,n)=>e.style.setProperty(t,`${n}px`),c=(t,n,r,i,a)=>{let o=()=>t.setAttribute(`aria-orientation`,n()===`x`?`vertical`:`horizontal`);t.addEventListener(`pointerdown`,a=>{a.preventDefault();let o=n()===`x`,s=o?a.clientX:a.clientY,c=r();t.setPointerCapture(a.pointerId),e.classList.add(`cp-dragging`,o?`cp-dragging-x`:`cp-dragging-y`);let l=e=>i(c+(o?e.clientX:e.clientY)-s),u=()=>{e.classList.remove(`cp-dragging`,`cp-dragging-x`,`cp-dragging-y`),t.removeEventListener(`pointermove`,l),t.removeEventListener(`pointerup`,u),t.removeEventListener(`pointercancel`,u)};t.addEventListener(`pointermove`,l),t.addEventListener(`pointerup`,u),t.addEventListener(`pointercancel`,u)}),t.addEventListener(`keydown`,e=>{let t={ArrowLeft:-24,ArrowUp:-24,ArrowRight:24,ArrowDown:24}[e.key];t&&(e.preventDefault(),i(r()+t))}),t.addEventListener(`dblclick`,a),t.addEventListener(`focus`,o),t.addEventListener(`pointerenter`,o)},l=()=>getComputedStyle(t).flexDirection===`row`&&getComputedStyle(t).display===`flex`;c(e.querySelector(`.cp-split-tree`),()=>`x`,()=>a.getBoundingClientRect().width,e=>s(`--cp-tree-width`,o(e,90,n.getBoundingClientRect().width-160)),()=>e.style.removeProperty(`--cp-tree-width`)),c(e.querySelector(`.cp-split-main`),()=>l()?`x`:`y`,()=>l()?n.getBoundingClientRect().width:this.#t.getBoundingClientRect().height,n=>{l()?s(`--cp-source-width`,o(n,200,t.getBoundingClientRect().width-200)):(s(`--cp-editor-height`,o(n,80,this.#U?t.getBoundingClientRect().height-100:2e3)),e.classList.add(`cp-editor-sized`))},()=>{e.style.removeProperty(`--cp-source-width`),e.style.removeProperty(`--cp-editor-height`),e.classList.remove(`cp-editor-sized`)}),c(e.querySelector(`.cp-split-console`),()=>`y`,()=>r.getBoundingClientRect().height,e=>s(`--cp-preview-height`,o(e,60,l()||this.#U?i.getBoundingClientRect().height-40:2e3)),()=>e.style.removeProperty(`--cp-preview-height`))}#J(){this.#U||this.#C||typeof IntersectionObserver>`u`||(this.#C=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this.#C?.disconnect(),this.#C=null,this.#Y().then(()=>{this.hasAttribute(`autorun`)&&this.run()}).catch(()=>{}))},{rootMargin:`300px`}),this.#C.observe(this))}#Y(){return this.#p||=(async()=>{let e=await N(this.language);this.#f=e,!e.ready&&!this.#Q&&(this.#o.hidden=!1,this.#me(`Loading ${e.label}…`,`busy`));try{await e.load(e=>{!this.#y&&!this.#Q&&this.#me(e.message,e.phase===`ready`?`ok`:`busy`)})}catch(e){this.#p=null,this.#me(`Runtime unavailable`,`error`);let t=e instanceof Error?e.message:String(e);throw this.#ge(t+`
620
+ `,`cp-err`),this.#s.hidden=!1,e}finally{this.#o.hidden=!0}return this.#X(),this.#S||(this.#S=!0,this.#Q||this.#me(`${e.label} ready`,`ok`),this.#Se(`py-ready`,{language:e.id,label:e.label})),e})(),this.#p}async#X(){if(!this.#u)return;let e=this.#g,t=await ee(e,this.language);if(t){this.#g===e&&this.#u?.setLanguage(t);return}let n=e.includes(`.`)?null:await(this.#f??await N(this.language).catch(()=>null))?.editorLanguage().catch(()=>null);this.#g===e&&this.#u?.setLanguage(n??[])}#Z(){this.#u?this.#u.setCode(this.#m[this.#g]??``):this.#d?.then(()=>{this.#u?.setCode(this.#m[this.#g]??``),this.#ie()})}#Q=!1;#$(e,t){let n=Object.keys(t),r=`This widget's entry is "${e}", but it has no file of that name${n.length?` (its files: ${n.join(`, `)})`:``}. Set entry to one of its files.\n`;this.#he(),this.#s.hidden=!1,this.#ge(r,`cp-err`),this.#Q=!0,this.#me(`Error · entry not found`,`error`);let i={stdout:``,stderr:r,durationMs:0,failed:!0};return this.#Se(`py-error`,{message:r,language:this.language}),this.#Se(`py-output`,{...i,language:this.language}),i}#ee(){return this.getAttribute(`entry`)||ne(this.language)}#te(){let e=Object.keys(this.#m),t=this.getAttribute(`entry`);if(t&&e.includes(t))return t;let n=this.#oe()&&e.includes(`index.html`)?`index.html`:ne(this.language);return e.includes(n)?n:e[0]??n}#ne(){let e=this.getAttribute(`open-file`);return e&&e in this.#m?e:this.#te()}#re(){if(this.#H)return this.#H.widget.#re();let e={...this.#m};if(this.#u)for(let t of Object.keys(e))e[t]=this.#u.fileCode(t,e[t]);return e}#ie(){let e=Object.keys(this.#m);this.#v.hidden=e.length<2;let t=!this.#v.hidden&&this.getAttribute(`file-view`)===`tree`;if(this.#v.classList.toggle(`cp-tree`,t),this.#e.querySelector(`.cp-root`)?.classList.toggle(`cp-has-tree`,t),this.#v.hidden){this.#v.replaceChildren();return}if(t){this.#ae(e),this.#ce();return}let n=this.#te();this.#v.replaceChildren(...e.map(e=>{let t=document.createElement(`button`);t.dataset.file=e;let r=e.lastIndexOf(`/`)+1;if(r){let n=document.createElement(`span`);n.className=`cp-tab-folder`,n.textContent=e.slice(0,r),t.setAttribute(`aria-label`,e),t.append(n)}return t.append(e.slice(r)),t.setAttribute(`aria-pressed`,String(e===this.#g)),e===n&&(t.classList.add(`cp-entry`),t.title=`entry point — this is the file Run executes`),t})),this.#ce()}#ae(e){let t=this.#te(),n=[],r=(i,a)=>{let o=e.filter(e=>e.startsWith(i)).map(e=>e.slice(i.length)),s=[...new Set(o.filter(e=>e.includes(`/`)).map(e=>e.slice(0,e.indexOf(`/`))))].sort();for(let e of s){let t=i+e,o=!this.#V.has(t),s=document.createElement(`button`);s.className=`cp-tree-folder`,s.dataset.folder=t,s.textContent=e,s.setAttribute(`aria-expanded`,String(o)),s.style.setProperty(`--cp-depth`,String(a)),n.push(s),o&&r(`${t}/`,a+1)}for(let e of o.filter(e=>!e.includes(`/`)).sort()){let r=i+e,o=document.createElement(`button`);o.dataset.file=r,o.textContent=e,o.setAttribute(`aria-label`,r),o.setAttribute(`aria-pressed`,String(r===this.#g)),o.style.setProperty(`--cp-depth`,String(a)),r===t&&(o.classList.add(`cp-entry`),o.title=`entry point — this is the file Run executes`),n.push(o)}};r(``,0),this.#v.replaceChildren(...n)}#oe(){return this.language===`react`||this.language===`next`}#se(){this.#L&&(this.#f?.dispose?.(this.#L),this.#L.replaceChildren())}#ce(){if(!this.#oe())return;let e=this.#re();for(let t of this.#v.querySelectorAll(`button[data-file]`)){let n=t.dataset.file;t.classList.toggle(`cp-edited`,e[n]!==this.#h[n])}let t=this.#z;this.#R.hidden=!t||Object.keys(e).every(n=>e[n]===t[n])}#le(e){this.#m[this.#g]=e,this.#ce();let t=this.getAttribute(`persist`);if(!t)return;this.#O&&clearTimeout(this.#O);let n=JSON.stringify(this.#re());this.#O=setTimeout(()=>void W(t,n).catch(()=>{}),400)}#ue(){let e=this.getAttribute(`theme`)??`auto`;if(e===`dark`)return!0;if(e===`light`)return!1;let t=v().mode;if(t)return t===`dark`;let n=typeof document>`u`?``:getComputedStyle(document.documentElement).colorScheme,r=n.includes(`dark`);return r===n.includes(`light`)?!!this.#w?.matches:r}#de(){return v()[this.#ue()?`dark`:`light`]}#fe(){this.#D??=b(this.#E),!this.#w&&typeof matchMedia==`function`&&(this.#w=matchMedia(`(prefers-color-scheme: dark)`),this.#w.addEventListener(`change`,this.#E)),!this.#T&&typeof MutationObserver==`function`&&typeof document<`u`&&(this.#T=new MutationObserver(this.#E),this.#T.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`,`data-theme`,`data-color-scheme`,`color-scheme`]}));let e=this.#ue(),t=this.#de();this.setAttribute(`data-resolved-theme`,e?`dark`:`light`),this.setAttribute(`data-editor-theme`,t),this.#u?.setTheme(e,t);let n=this.getAttribute(`theme`),r=n===`light`||n===`dark`||this.getAttribute(`theme-controls`)===`off`,i=this.#e.querySelector(`[data-action="theme"]`),a=this.#e.querySelector(`.cp-theme-picker`);if(i&&a){let n=e?`Switch to the light theme`:`Switch to the dark theme`;i.hidden=a.hidden=r,i.title=n,i.setAttribute(`aria-label`,n),a.querySelector(`select`).value=t}}#pe(){for(let[e,t]of[[`height`,`--cp-height`],[`min-height`,`--cp-min-height`],[`max-height`,`--cp-max-height`],[`preview-height`,`--cp-preview-height`]]){let n=this.getAttribute(e);n===null||n===``?this.style.removeProperty(t):this.style.setProperty(t,/^\d+$/.test(n)?`${n}px`:n)}let e=this.getAttribute(`tree-width`)?.trim();e?/^(\d+(px)?|\d+(\.\d+)?%)$/.test(e)?this.style.setProperty(`--cp-tree-width`,/\d$/.test(e)?`${e}px`:e):(this.style.removeProperty(`--cp-tree-width`),console.warn(`code-playpad: tree-width="${e}" is not a size. Use a percentage like "20%" or pixels like "240".`)):this.style.removeProperty(`--cp-tree-width`)}#me(e,t){this.#a.textContent=e,this.#a.dataset.state=t}#he(){this.#N&&clearTimeout(this.#N),this.#N=null,this.#A=[],this.#P=0,this.#s.replaceChildren(),this.#k=!0}#ge(e,t){if(!e)return;let n=t===`cp-err`&&!this.#k?`\n${e}`:e;this.#k=n.endsWith(`
621
621
  `),this.#A.push({text:n,className:t}),this.#N??=setTimeout(()=>this.#_e(),16)}#_e(){if(this.#N&&clearTimeout(this.#N),this.#N=null,!this.#A.length)return;let e=this.#A;this.#A=[];let t=document.createDocumentFragment(),n=``,r,i=()=>{if(!n)return;let e=document.createElement(`span`);r&&(e.className=r),e.textContent=n,t.appendChild(e),n=``};for(let t of e){if(this.#P>=Q)break;let e=t.text;this.#P+e.length>Q&&(e=e.slice(0,Q-this.#P)+`
622
622
  … output truncated for display — the full text is in the playpad-output event
623
623
  `),this.#P+=t.text.length,r!==t.className&&(i(),r=t.className),n+=e}i(),this.#s.hidden=!1;let a=this.#s.querySelector(`.cp-prompt`);a?this.#s.insertBefore(t,a):this.#s.appendChild(t),this.#s.scrollTop=this.#s.scrollHeight}#ve(){return this.#_e(),this.#ye(null),new Promise(e=>{let t=document.createElement(`form`);t.className=`cp-prompt`;let n=document.createElement(`input`);n.type=`text`,n.setAttribute(`aria-label`,`Program input — press Enter to send`),n.autocapitalize=`off`,n.autocomplete=`off`,n.spellcheck=!1;let r=document.createElement(`button`);r.type=`submit`,r.className=`cp-send`,r.textContent=`⏎`,r.title=`Send this line (Enter)`;let i=document.createElement(`button`);i.type=`button`,i.className=`cp-eof`,i.textContent=`EOF`,i.title=`End of input (Ctrl-D) — makes input() raise EOFError`;let a=n=>{this.#j===e&&(this.#j=null,this.#M=null,t.remove(),n===null?this.#ge(`
624
624
  `,`cp-in`):this.#ge(n+`
625
- `,`cp-in`),this.#_e(),e(n))};t.addEventListener(`submit`,e=>{e.preventDefault(),a(n.value)}),i.addEventListener(`click`,()=>a(null)),n.addEventListener(`keydown`,e=>{(e.key===`Escape`||e.key===`d`&&e.ctrlKey)&&(e.preventDefault(),a(null))}),t.append(n,r,i),this.#s.hidden=!1,this.#s.appendChild(t),this.#s.scrollTop=this.#s.scrollHeight,this.#j=e,this.#M=a,n.focus({preventScroll:!0})})}#ye(e){this.#M?.(e),this.#M=null,this.#j=null}#be(e,t){this.#_e();let n=document.createElement(`div`);n.className=`cp-hint`,n.textContent=e,this.#s.hidden=!1,this.#s.appendChild(n),this.#s.scrollTop=this.#s.scrollHeight,t&&(this.#c.hidden=!1,this.#c.classList.add(`cp-attention`))}#xe(e){this.#_e();let t=document.createElement(`table`);t.className=`cp-table`;let n=t.createTHead().insertRow();for(let t of e.columns){let e=document.createElement(`th`);e.textContent=t,n.appendChild(e)}let r=t.createTBody();for(let t of e.rows){let e=r.insertRow();for(let n of t)e.insertCell().textContent=n==null?``:String(n)}this.#s.hidden=!1,this.#s.appendChild(t)}#Se(e,t){this.#Ce(e,t),this.#Ce(`playpad-${e.slice(3)}`,t)}#Ce(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0})),this.#U?.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};function ce(e=X){typeof window<`u`&&typeof customElements<`u`&&(customElements.get(e)||customElements.define(e,se))}ce();export{se as CodePlayPadElement,u as EDITOR_THEMES,c as PYODIDE_VERSION,r as REACT_VERSION,t as RunStopped,e as WorkerUnavailable,Y as allProgress,K as clearSnippet,o as configureCpp,s as configurePython,a as configureReact,i as configureTypeScript,x as createEditor,ce as defineCodePlayPad,J as getProgress,M as getRuntime,_ as getThemePreference,j as listRuntimes,G as loadSnippet,y as onThemePreferenceChange,l as pyodideAssetUrls,A as registerRuntime,W as saveSnippet,q as setProgress,v as setThemePreference};
625
+ `,`cp-in`),this.#_e(),e(n))};t.addEventListener(`submit`,e=>{e.preventDefault(),a(n.value)}),i.addEventListener(`click`,()=>a(null)),n.addEventListener(`keydown`,e=>{(e.key===`Escape`||e.key===`d`&&e.ctrlKey)&&(e.preventDefault(),a(null))}),t.append(n,r,i),this.#s.hidden=!1,this.#s.appendChild(t),this.#s.scrollTop=this.#s.scrollHeight,this.#j=e,this.#M=a,n.focus({preventScroll:!0})})}#ye(e){this.#M?.(e),this.#M=null,this.#j=null}#be(e,t){this.#_e();let n=document.createElement(`div`);n.className=`cp-hint`,n.textContent=e,this.#s.hidden=!1,this.#s.appendChild(n),this.#s.scrollTop=this.#s.scrollHeight,t&&(this.#c.hidden=!1,this.#c.classList.add(`cp-attention`))}#xe(e){this.#_e();let t=document.createElement(`table`);t.className=`cp-table`;let n=t.createTHead().insertRow();for(let t of e.columns){let e=document.createElement(`th`);e.textContent=t,n.appendChild(e)}let r=t.createTBody();for(let t of e.rows){let e=r.insertRow();for(let n of t)e.insertCell().textContent=n==null?``:String(n)}this.#s.hidden=!1,this.#s.appendChild(t)}#Se(e,t){this.#Ce(e,t),this.#Ce(`playpad-${e.slice(3)}`,t)}#Ce(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0})),this.#U?.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};function le(e=X){typeof window<`u`&&typeof customElements<`u`&&(customElements.get(e)||customElements.define(e,ce))}le();export{ce as CodePlayPadElement,d as EDITOR_THEMES,u as PYODIDE_VERSION,r as REACT_VERSION,t as RunStopped,e as WorkerUnavailable,Y as allProgress,K as clearSnippet,s as configureCSharp,l as configureCpp,o as configurePython,i as configureReact,c as configureTypeScript,S as createEditor,le as defineCodePlayPad,J as getProgress,N as getRuntime,v as getThemePreference,M as listRuntimes,G as loadSnippet,b as onThemePreferenceChange,a as pyodideAssetUrls,j as registerRuntime,W as saveSnippet,q as setProgress,y as setThemePreference};
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * code-playpad — MIT © 2026 Seung Hun Lee
3
+ * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
+ * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
+ */
6
+ import{n as e,t}from"./types-CfcYqU2K.js";import{t as n}from"./hints-DpBIeoeG.js";var r=1,i=class{#e=null;#t=null;#n=`module`;#r=null;#i=null;#a=!1;#o=!1;#s=``;#c=/* @__PURE__ */ new Set;#l=[];#u=null;#d=!1;get recycleAfterRun(){return!1}get startTimeoutMs(){}initPayload(){return{}}loadModule(e){return Promise.reject(/* @__PURE__ */ Error(`no module named ${e}`))}get ready(){return this.#a}get interactiveStdin(){return this.#o}get version(){return this.#s}load(t){t&&this.#c.add(t);let n=()=>{t&&this.#c.delete(t)};if(!this.#r){let t=new Promise((t,n)=>{this.#i={resolve:t,reject:n};let r;try{if(typeof Worker>`u`)throw Error(`Worker constructor missing`);let e=new Blob([this.source],{type:`text/javascript`});this.#t=URL.createObjectURL(e),r=new Worker(this.#t,{type:this.#n})}catch(t){this.#i=null,n(new e(`Could not start a Web Worker: ${t.message}`));return}this.#e=r;let i=this.startTimeoutMs,a=i===void 0?void 0:setTimeout(()=>{this.#e!==r||this.#a||(this.#m(),n(/* @__PURE__ */ Error(`The ${this.label} worker did not start within ${i} ms.`)))},i);r.onmessage=e=>{if(this.#e!==r)return;let i=e.data;i.type===`ready`?(this.#s=i.version,this.#o=i.interactiveStdin===!0,this.#a=!0,this.#i=null,clearTimeout(a),this.#h({phase:`ready`,message:`${this.label} ready`}),t()):i.type===`fatal`&&!this.#a?(clearTimeout(a),this.#p(i.message,t,n)):this.#g(i)},r.onerror=e=>{if(this.#e!==r)return;let i=e.message||`Worker failed to start`;clearTimeout(a),this.#a?this.#u&&this.#y(this.#u,Error(i)):this.#p(i,t,n)},r.postMessage({type:`init`,...this.initPayload()})});this.#r=t,t.catch(()=>{this.#r===t&&(this.#r=null)})}return this.#r.then(n,e=>{throw n(),e})}run(e,t={}){let n,i,a=new Promise((e,t)=>{n=e,i=t}),o,s=new Promise(e=>{o=e}),c={id:r++,code:e,options:t,stdout:``,stderr:``,resolve:n,reject:i,promise:a,started:!1,settled:!1,done:s,markDone:()=>{clearTimeout(c.timer),c.settled=!0,o()}};return this.#l.push(c),this.#b(),a}stop(e){if(e){let n=this.#l.findIndex(t=>t.promise===e);if(n!==-1){this.#y(this.#l.splice(n,1)[0],new t);return}let r=this.#u;if(!r||r.promise!==e||r.settled)return;if(!r.started){this.#y(r,new t),this.recycleAfterRun&&this.#f();return}}this.#f()}#f(){let e=this.#e!==null,n=this.#i;if(this.#m(),this.#u&&this.#y(this.#u,new t),e&&(n||!this.recycleAfterRun)){let e=this.load();n&&e.then(n.resolve,n.reject),e.catch(()=>{})}}#p(e,t,n){this.#m(),this.#n===`module`?(this.#n=`classic`,this.load().then(t,n)):n(Error(e))}#m(){this.#e?.terminate(),this.#e=null,this.#t&&=(URL.revokeObjectURL(this.#t),null),this.#r=null,this.#i=null,this.#a=!1}#h(e){for(let t of this.#c)t(e)}#g(e){if(e.type===`progress`){this.#h({phase:e.phase,message:e.message}),this.#u&&e.id===this.#u.id&&!this.#u.settled&&this.#u.options.onProgress?.({phase:e.phase,message:e.message});return}let t=this.#u;if(t&&`id`in e&&e.id===t.id)switch(e.type){case`stdout`:t.stdout+=e.text,t.options.onStdout?.(e.text);break;case`echo`:t.options.onEcho?.(e.text);break;case`stdin-request`:this.#v(t,e.request);break;case`module-request`:this.#_(t,e.name);break;case`stderr`:t.stderr+=e.text,t.options.onStderr?.(e.text);break;case`result`:t.resolve({stdout:t.stdout,stderr:t.stderr||void 0,value:e.value,durationMs:Math.round(e.durationMs),failed:!1,...e.memory?{memory:e.memory}:{},...e.cases?{cases:e.cases,passed:e.passed,total:e.total}:{}}),t.markDone();break;case`error`:case`fatal`:{let r=(t.stderr&&!t.stderr.endsWith(`
7
+ `)?`
8
+ `:``)+e.message+`
9
+ `;t.stderr+=r,t.options.onStderr?.(r);let i={stdout:t.stdout,stderr:t.stderr,hint:`hint`in e?e.hint:void 0,durationMs:Math.round(`durationMs`in e?e.durationMs:0),failed:!0,...`cases`in e&&e.cases?{cases:e.cases,passed:0,total:e.cases.length}:{}};`hintAbout`in e&&e.hintAbout===`stdin`&&n.add(i),t.resolve(i),t.markDone();break}}}#_(e,t){let n=this.#e,r=r=>{this.#e===n&&this.#u===e&&n?.postMessage({type:`module`,name:t,...r})};this.loadModule(t).then(e=>r({code:e}),e=>r({error:e instanceof Error?e.message:String(e)}))}#v(e,t){let n=this.#e,r=r=>{this.#e===n&&this.#u===e&&n?.postMessage({type:`stdin-response`,request:t,text:r})},i=e.options.onStdinRequest;i?i().then(r,()=>r(null)):r(null)}#y(e,t){e.reject(t),e.markDone()}async#b(){if(!this.#d){this.#d=!0;try{for(;this.#l.length;){let e=this.#l.shift();this.#u=e;let t=null;try{if(this.recycleAfterRun?await Promise.race([this.load(),e.done]):await this.load(),e.settled)continue;e.started=!0,e.options.onStart?.(),e.options.timeoutMs&&Number.isFinite(e.options.timeoutMs)&&e.options.timeoutMs>0&&(e.timer=setTimeout(()=>{this.#u!==e||e.settled||(this.#g({type:`error`,id:e.id,message:`Run exceeded its wall-clock time limit.`,durationMs:e.options.timeoutMs}),this.#m())},e.options.timeoutMs)),t=this.#e,this.#e.postMessage({type:`run`,id:e.id,code:e.code,stdin:e.options.stdin,files:e.options.files,entry:e.options.entry,...e.options.compilerLanguage?{compilerLanguage:e.options.compilerLanguage}:{},...e.options.practice?{practice:e.options.practice}:{}}),await e.done}catch(t){this.#y(e,t)}finally{this.#u=null,this.recycleAfterRun&&t&&this.#e===t&&this.#m()}}}finally{this.#d=!1}}}};export{i as t};
@@ -0,0 +1,4 @@
1
+ import{d as e,l as t,u as n}from"./element-Biju-4SA.js";var r=1,i=class{#e=null;#t=null;#n=`module`;#r=null;#i=null;#a=!1;#o=!1;#s=``;#c=/* @__PURE__ */ new Set;#l=[];#u=null;#d=!1;get recycleAfterRun(){return!1}get startTimeoutMs(){}initPayload(){return{}}loadModule(e){return Promise.reject(/* @__PURE__ */ Error(`no module named ${e}`))}get ready(){return this.#a}get interactiveStdin(){return this.#o}get version(){return this.#s}load(t){t&&this.#c.add(t);let n=()=>{t&&this.#c.delete(t)};if(!this.#r){let t=new Promise((t,n)=>{this.#i={resolve:t,reject:n};let r;try{if(typeof Worker>`u`)throw Error(`Worker constructor missing`);let e=new Blob([this.source],{type:`text/javascript`});this.#t=URL.createObjectURL(e),r=new Worker(this.#t,{type:this.#n})}catch(t){this.#i=null,n(new e(`Could not start a Web Worker: ${t.message}`));return}this.#e=r;let i=this.startTimeoutMs,a=i===void 0?void 0:setTimeout(()=>{this.#e!==r||this.#a||(this.#m(),n(/* @__PURE__ */ Error(`The ${this.label} worker did not start within ${i} ms.`)))},i);r.onmessage=e=>{if(this.#e!==r)return;let i=e.data;i.type===`ready`?(this.#s=i.version,this.#o=i.interactiveStdin===!0,this.#a=!0,this.#i=null,clearTimeout(a),this.#h({phase:`ready`,message:`${this.label} ready`}),t()):i.type===`fatal`&&!this.#a?(clearTimeout(a),this.#p(i.message,t,n)):this.#g(i)},r.onerror=e=>{if(this.#e!==r)return;let i=e.message||`Worker failed to start`;clearTimeout(a),this.#a?this.#u&&this.#y(this.#u,Error(i)):this.#p(i,t,n)},r.postMessage({type:`init`,...this.initPayload()})});this.#r=t,t.catch(()=>{this.#r===t&&(this.#r=null)})}return this.#r.then(n,e=>{throw n(),e})}run(e,t={}){let n,i,a=new Promise((e,t)=>{n=e,i=t}),o,s=new Promise(e=>{o=e}),c={id:r++,code:e,options:t,stdout:``,stderr:``,resolve:n,reject:i,promise:a,started:!1,settled:!1,done:s,markDone:()=>{clearTimeout(c.timer),c.settled=!0,o()}};return this.#l.push(c),this.#b(),a}stop(e){if(e){let t=this.#l.findIndex(t=>t.promise===e);if(t!==-1){this.#y(this.#l.splice(t,1)[0],new n);return}let r=this.#u;if(!r||r.promise!==e||r.settled)return;if(!r.started){this.#y(r,new n),this.recycleAfterRun&&this.#f();return}}this.#f()}#f(){let e=this.#e!==null,t=this.#i;if(this.#m(),this.#u&&this.#y(this.#u,new n),e&&(t||!this.recycleAfterRun)){let e=this.load();t&&e.then(t.resolve,t.reject),e.catch(()=>{})}}#p(e,t,n){this.#m(),this.#n===`module`?(this.#n=`classic`,this.load().then(t,n)):n(Error(e))}#m(){this.#e?.terminate(),this.#e=null,this.#t&&=(URL.revokeObjectURL(this.#t),null),this.#r=null,this.#i=null,this.#a=!1}#h(e){for(let t of this.#c)t(e)}#g(e){if(e.type===`progress`){this.#h({phase:e.phase,message:e.message}),this.#u&&e.id===this.#u.id&&!this.#u.settled&&this.#u.options.onProgress?.({phase:e.phase,message:e.message});return}let n=this.#u;if(n&&`id`in e&&e.id===n.id)switch(e.type){case`stdout`:n.stdout+=e.text,n.options.onStdout?.(e.text);break;case`echo`:n.options.onEcho?.(e.text);break;case`stdin-request`:this.#v(n,e.request);break;case`module-request`:this.#_(n,e.name);break;case`stderr`:n.stderr+=e.text,n.options.onStderr?.(e.text);break;case`result`:n.resolve({stdout:n.stdout,stderr:n.stderr||void 0,value:e.value,durationMs:Math.round(e.durationMs),failed:!1,...e.memory?{memory:e.memory}:{},...e.cases?{cases:e.cases,passed:e.passed,total:e.total}:{}}),n.markDone();break;case`error`:case`fatal`:{let r=(n.stderr&&!n.stderr.endsWith(`
2
+ `)?`
3
+ `:``)+e.message+`
4
+ `;n.stderr+=r,n.options.onStderr?.(r);let i={stdout:n.stdout,stderr:n.stderr,hint:`hint`in e?e.hint:void 0,durationMs:Math.round(`durationMs`in e?e.durationMs:0),failed:!0,...`cases`in e&&e.cases?{cases:e.cases,passed:0,total:e.cases.length}:{}};`hintAbout`in e&&e.hintAbout===`stdin`&&t.add(i),n.resolve(i),n.markDone();break}}}#_(e,t){let n=this.#e,r=r=>{this.#e===n&&this.#u===e&&n?.postMessage({type:`module`,name:t,...r})};this.loadModule(t).then(e=>r({code:e}),e=>r({error:e instanceof Error?e.message:String(e)}))}#v(e,t){let n=this.#e,r=r=>{this.#e===n&&this.#u===e&&n?.postMessage({type:`stdin-response`,request:t,text:r})},i=e.options.onStdinRequest;i?i().then(r,()=>r(null)):r(null)}#y(e,t){e.reject(t),e.markDone()}async#b(){if(!this.#d){this.#d=!0;try{for(;this.#l.length;){let e=this.#l.shift();this.#u=e;let t=null;try{if(this.recycleAfterRun?await Promise.race([this.load(),e.done]):await this.load(),e.settled)continue;e.started=!0,e.options.onStart?.(),e.options.timeoutMs&&Number.isFinite(e.options.timeoutMs)&&e.options.timeoutMs>0&&(e.timer=setTimeout(()=>{this.#u!==e||e.settled||(this.#g({type:`error`,id:e.id,message:`Run exceeded its wall-clock time limit.`,durationMs:e.options.timeoutMs}),this.#m())},e.options.timeoutMs)),t=this.#e,this.#e.postMessage({type:`run`,id:e.id,code:e.code,stdin:e.options.stdin,files:e.options.files,entry:e.options.entry,...e.options.compilerLanguage?{compilerLanguage:e.options.compilerLanguage}:{},...e.options.practice?{practice:e.options.practice}:{}}),await e.done}catch(t){this.#y(e,t)}finally{this.#u=null,this.recycleAfterRun&&t&&this.#e===t&&this.#m()}}}finally{this.#d=!1}}}};export{i as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-playpad",
3
- "version": "0.14.1",
3
+ "version": "0.16.0",
4
4
  "description": "Embeddable browser code playground: a CodeMirror editor that runs Python, JavaScript, TypeScript, a subset of Java, experimental C/C++ and multi-file React in the browser. No backend. One shared worker per page, blocking input(), multi-file projects, lazy per-language loading.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "scripts": {
35
35
  "dev": "vite --config vite.demo.config.ts",
36
36
  "dev:phone": "vite --config vite.demo.config.ts --mode phone",
37
- "build": "node scripts/sync-cpp.mjs --check && vite build && vite build --config vite.standalone.config.ts && tsc -p tsconfig.build.json && node scripts/check-dist.mjs",
37
+ "build": "node scripts/sync-cpp.mjs --check && node scripts/sync-csharp.mjs --check && vite build && vite build --config vite.standalone.config.ts && tsc -p tsconfig.build.json && node scripts/check-dist.mjs",
38
38
  "build:demo": "npm run build && vite build --config vite.demo.config.ts",
39
39
  "preview:demo": "vite preview --config vite.demo.config.ts",
40
40
  "typecheck": "tsc --noEmit",
@@ -43,6 +43,7 @@
43
43
  "sync:sucrase": "node scripts/sync-sucrase.mjs",
44
44
  "test": "node --test --test-reporter=spec \"tests/*.test.mjs\"",
45
45
  "sync:cpp": "node scripts/sync-cpp.mjs",
46
+ "sync:csharp": "node scripts/sync-csharp.mjs",
46
47
  "check:compiler-licenses": "node scripts/check-compiler-licenses.mjs",
47
48
  "sync:react": "node scripts/sync-react.mjs",
48
49
  "sync:next": "node scripts/sync-next.mjs",
@@ -64,7 +65,8 @@
64
65
  "@codemirror/theme-one-dark": "^6",
65
66
  "@codemirror/view": "^6",
66
67
  "@lezer/highlight": "^1",
67
- "react": ">=18"
68
+ "react": ">=18",
69
+ "@codemirror/legacy-modes": "^6"
68
70
  },
69
71
  "peerDependenciesMeta": {
70
72
  "react": {
@@ -90,6 +92,9 @@
90
92
  },
91
93
  "@codemirror/lang-html": {
92
94
  "optional": true
95
+ },
96
+ "@codemirror/legacy-modes": {
97
+ "optional": true
93
98
  }
94
99
  },
95
100
  "devDependencies": {
@@ -104,6 +109,7 @@
104
109
  "@codemirror/lang-json": "^6.0.2",
105
110
  "@codemirror/lang-python": "^6.2.1",
106
111
  "@codemirror/language": "^6.12.4",
112
+ "@codemirror/legacy-modes": "^6.5.5",
107
113
  "@codemirror/state": "^6.7.1",
108
114
  "@codemirror/theme-one-dark": "^6.1.3",
109
115
  "@codemirror/view": "^6.43.9",
@@ -1,6 +0,0 @@
1
- /*!
2
- * code-playpad — MIT © 2026 Seung Hun Lee
3
- * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
- * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
- */
6
- var e=`314.0.5`,t=`https://cdn.jsdelivr.net/pyodide/v${e}/full/`,n=null;function r(e){t=e.indexURL.endsWith(`/`)?e.indexURL:e.indexURL+`/`}function i(e){n=e.sucraseURL}function a(){return t}function o(){return n}function s(){return[{url:t+`pyodide.js`,as:`script`},{url:t+`pyodide.asm.wasm`,as:`fetch`},{url:t+`python_stdlib.zip`,as:`fetch`}]}var c={indexURL:`https://cdn.jsdelivr.net/npm/@code-playpad/cpp-toolchain@1.0.0/dist/`,timeoutMs:12e4};function l(e){let t={...c};if(e.indexURL!==void 0){let n=new URL(e.indexURL);if(![`https:`,`http:`].includes(n.protocol))throw Error(`C/C++ asset URL must use HTTP or HTTPS.`);t.indexURL=n.href.endsWith(`/`)?n.href:n.href+`/`}if(e.timeoutMs!==void 0){if(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0)throw Error(`timeoutMs must be a positive finite number.`);t.timeoutMs=e.timeoutMs}c=t}function u(){return{...c}}var d=null,f=null;function p(e){if(e.runtimeURL!==void 0){let t=new URL(e.runtimeURL,typeof location>`u`?void 0:location.href);if(![`https:`,`http:`].includes(t.protocol))throw Error(`The React runtime URL must use HTTP or HTTPS.`);if(/[;,\s]/.test(t.href))throw Error(`The React runtime URL cannot contain ";" or ",": it goes in a Content-Security-Policy.`);d=t.href}e.nonce!==void 0&&(f=e.nonce)}function m(){let e=typeof document>`u`?null:document.querySelector(`script[nonce]`)?.nonce||null;return{runtimeURL:d,nonce:f??e}}export{i as a,m as c,p as i,o as l,l as n,u as o,r,a as s,e as t,s as u};