Procházet zdrojové kódy

Merge pull request #2325 from open-webui/pyscript

feat: python code execution
Timothy Jaeryang Baek před 11 měsíci
rodič
revize
4950feded4
67 změnil soubory, kde provedl 1947 přidání a 11 odebrání
  1. 12 0
      backend/main.py
  2. 146 2
      package-lock.json
  3. 3 0
      package.json
  4. 8 0
      pyscript-mv.sh
  5. 20 0
      src/Untitled-1.js
  6. 9 0
      src/app.html
  7. 1 0
      src/lib/components/chat/MessageInput.svelte
  8. 205 4
      src/lib/components/chat/Messages/CodeBlock.svelte
  9. 2 0
      src/lib/components/chat/Messages/Placeholder.svelte
  10. 7 1
      src/lib/components/chat/Messages/ProfileImage.svelte
  11. 1 0
      src/lib/components/chat/Messages/ResponseMessage.svelte
  12. 1 0
      src/lib/components/layout/Sidebar.svelte
  13. 1 1
      src/routes/+layout.svelte
  14. 6 1
      src/routes/auth/+page.svelte
  15. 0 0
      static/pyodide/pyodide-lock.json
  16. 8 0
      static/pyodide/pyodide.asm.js
  17. binární
      static/pyodide/pyodide.asm.wasm
  18. 1476 0
      static/pyodide/pyodide.d.ts
  19. 0 0
      static/pyodide/pyodide.js
  20. 3 0
      static/pyodide/pyodide.js.map
  21. 0 0
      static/pyodide/pyodide.mjs
  22. 3 0
      static/pyodide/pyodide.mjs.map
  23. binární
      static/pyodide/python_stdlib.zip
  24. 0 0
      static/pyscript/codemirror-Dr2Hgejs.js
  25. 0 0
      static/pyscript/codemirror-Dr2Hgejs.js.map
  26. 0 0
      static/pyscript/codemirror_commands-MgxtVkrD.js
  27. 0 0
      static/pyscript/codemirror_commands-MgxtVkrD.js.map
  28. 0 0
      static/pyscript/codemirror_lang-python-Cxoc-ydj.js
  29. 0 0
      static/pyscript/codemirror_lang-python-Cxoc-ydj.js.map
  30. 0 0
      static/pyscript/codemirror_language-_XiX6II0.js
  31. 0 0
      static/pyscript/codemirror_language-_XiX6II0.js.map
  32. 0 0
      static/pyscript/codemirror_state-BKbyfKsm.js
  33. 0 0
      static/pyscript/codemirror_state-BKbyfKsm.js.map
  34. 0 0
      static/pyscript/codemirror_view-C0PMO2z_.js
  35. 0 0
      static/pyscript/codemirror_view-C0PMO2z_.js.map
  36. 0 0
      static/pyscript/core-CPpjJT4b.js
  37. 0 0
      static/pyscript/core-CPpjJT4b.js.map
  38. 1 0
      static/pyscript/core.css
  39. 2 0
      static/pyscript/core.js
  40. 1 0
      static/pyscript/core.js.map
  41. 2 0
      static/pyscript/deprecations-manager-CQ0oxKrq.js
  42. 1 0
      static/pyscript/deprecations-manager-CQ0oxKrq.js.map
  43. 2 0
      static/pyscript/error-BfnovtqK.js
  44. 0 0
      static/pyscript/error-BfnovtqK.js.map
  45. 0 0
      static/pyscript/index-CTWZX_TW.js
  46. 0 0
      static/pyscript/index-CTWZX_TW.js.map
  47. 0 0
      static/pyscript/py-editor-CmqzUo2Z.js
  48. 0 0
      static/pyscript/py-editor-CmqzUo2Z.js.map
  49. 0 0
      static/pyscript/py-terminal-CgcHH2nx.js
  50. 0 0
      static/pyscript/py-terminal-CgcHH2nx.js.map
  51. 0 0
      static/pyscript/toml-CvAfdf9_.js
  52. 0 0
      static/pyscript/toml-CvAfdf9_.js.map
  53. 3 0
      static/pyscript/toml-DiUM0_qs.js
  54. 0 0
      static/pyscript/toml-DiUM0_qs.js.map
  55. 0 0
      static/pyscript/xterm-DqawCVsv.js
  56. 0 0
      static/pyscript/xterm-DqawCVsv.js.map
  57. 0 0
      static/pyscript/xterm-readline-D247p8vq.js
  58. 0 0
      static/pyscript/xterm-readline-D247p8vq.js.map
  59. 6 0
      static/pyscript/xterm.css
  60. 2 0
      static/pyscript/xterm_addon-fit--gyF3PcZ.js
  61. 0 0
      static/pyscript/xterm_addon-fit--gyF3PcZ.js.map
  62. 0 0
      static/pyscript/xterm_addon-web-links-Cnej-nJ6.js
  63. 0 0
      static/pyscript/xterm_addon-web-links-Cnej-nJ6.js.map
  64. 0 0
      static/pyscript/zip-D2yvzXKD.js
  65. 0 0
      static/pyscript/zip-D2yvzXKD.js.map
  66. 0 1
      svelte.config.js
  67. 15 1
      vite.config.ts

+ 12 - 0
backend/main.py

@@ -117,6 +117,18 @@ app.state.config.WEBHOOK_URL = WEBHOOK_URL
 origins = ["*"]
 
 
+# Custom middleware to add security headers
+class SecurityHeadersMiddleware(BaseHTTPMiddleware):
+    async def dispatch(self, request: Request, call_next):
+        response: Response = await call_next(request)
+        response.headers["Cross-Origin-Opener-Policy"] = "same-origin"
+        response.headers["Cross-Origin-Embedder-Policy"] = "require-corp"
+        return response
+
+
+app.add_middleware(SecurityHeadersMiddleware)
+
+
 class RAGMiddleware(BaseHTTPMiddleware):
     async def dispatch(self, request: Request, call_next):
         return_citations = False

+ 146 - 2
package-lock.json

@@ -8,6 +8,8 @@
 			"name": "open-webui",
 			"version": "0.1.124",
 			"dependencies": {
+				"@micropython/micropython-webassembly-pyscript": "^1.22.0-369",
+				"@pyscript/core": "^0.4.32",
 				"@sveltejs/adapter-node": "^1.3.1",
 				"async": "^3.2.5",
 				"bits-ui": "^0.19.7",
@@ -22,6 +24,7 @@
 				"js-sha256": "^0.10.1",
 				"katex": "^0.16.9",
 				"marked": "^9.1.0",
+				"pyodide": "^0.25.1",
 				"svelte-sonner": "^0.3.19",
 				"tippy.js": "^6.3.7",
 				"uuid": "^9.0.1"
@@ -831,6 +834,11 @@
 				"svelte": ">=3 <5"
 			}
 		},
+		"node_modules/@micropython/micropython-webassembly-pyscript": {
+			"version": "1.22.0-369",
+			"resolved": "https://registry.npmjs.org/@micropython/micropython-webassembly-pyscript/-/micropython-webassembly-pyscript-1.22.0-369.tgz",
+			"integrity": "sha512-+wqB6Va0rJtWXUmkthPVIEh1+Xh9Q+eJlBKWgYjjSe/FaRYo9z9U7CbvLaJNOJrb5R9dCTI6P9Ij4BrBxnwyVQ=="
+		},
 		"node_modules/@nodelib/fs.scandir": {
 			"version": "2.1.5",
 			"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -890,6 +898,19 @@
 				"url": "https://opencollective.com/popperjs"
 			}
 		},
+		"node_modules/@pyscript/core": {
+			"version": "0.4.32",
+			"resolved": "https://registry.npmjs.org/@pyscript/core/-/core-0.4.32.tgz",
+			"integrity": "sha512-WQATzPp1ggf871+PukCmTypzScXkEB1EWD/vg5GNxpM96N6rDPqQ13msuA5XvwU01ZVhL8HHSFDLk4IfaXNGWg==",
+			"dependencies": {
+				"@ungap/with-resolvers": "^0.1.0",
+				"basic-devtools": "^0.1.6",
+				"polyscript": "^0.12.8",
+				"sticky-module": "^0.1.1",
+				"to-json-callback": "^0.1.1",
+				"type-checked-collections": "^0.1.7"
+			}
+		},
 		"node_modules/@rollup/plugin-commonjs": {
 			"version": "25.0.7",
 			"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz",
@@ -1605,8 +1626,12 @@
 		"node_modules/@ungap/structured-clone": {
 			"version": "1.2.0",
 			"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
-			"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
-			"dev": true
+			"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="
+		},
+		"node_modules/@ungap/with-resolvers": {
+			"version": "0.1.0",
+			"resolved": "https://registry.npmjs.org/@ungap/with-resolvers/-/with-resolvers-0.1.0.tgz",
+			"integrity": "sha512-g7f0IkJdPW2xhY7H4iE72DAsIyfuwEFc6JWc2tYFwKDMWWAF699vGjrM348cwQuOXgHpe1gWFe+Eiyjx/ewvvw=="
 		},
 		"node_modules/@vitest/expect": {
 			"version": "1.6.0",
@@ -1713,6 +1738,11 @@
 				"@types/estree": "^1.0.0"
 			}
 		},
+		"node_modules/@webreflection/fetch": {
+			"version": "0.1.5",
+			"resolved": "https://registry.npmjs.org/@webreflection/fetch/-/fetch-0.1.5.tgz",
+			"integrity": "sha512-zCcqCJoNLvdeF41asAK71XPlwSPieeRDsE09albBunJEksuYPYNillKNQjf8p5BqSoTKTuKrW3lUm3MNodUC4g=="
+		},
 		"node_modules/acorn": {
 			"version": "8.11.3",
 			"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
@@ -2027,6 +2057,11 @@
 			"dev": true,
 			"optional": true
 		},
+		"node_modules/base-64": {
+			"version": "1.0.0",
+			"resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz",
+			"integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
+		},
 		"node_modules/base64-js": {
 			"version": "1.5.1",
 			"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -2047,6 +2082,11 @@
 				}
 			]
 		},
+		"node_modules/basic-devtools": {
+			"version": "0.1.6",
+			"resolved": "https://registry.npmjs.org/basic-devtools/-/basic-devtools-0.1.6.tgz",
+			"integrity": "sha512-g9zJ63GmdUesS3/Fwv0B5SYX6nR56TQXmGr+wE5PRTNCnGQMYWhUx/nZB/mMWnQJVLPPAp89oxDNlasdtNkW5Q=="
+		},
 		"node_modules/bcrypt-pbkdf": {
 			"version": "1.0.2",
 			"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
@@ -2661,6 +2701,28 @@
 				"@types/estree": "^1.0.0"
 			}
 		},
+		"node_modules/codedent": {
+			"version": "0.1.2",
+			"resolved": "https://registry.npmjs.org/codedent/-/codedent-0.1.2.tgz",
+			"integrity": "sha512-qEqzcy5viM3UoCN0jYHZeXZoyd4NZQzYFg0kOBj8O1CgoGG9WYYTF+VeQRsN0OSKFjF3G1u4WDUOtOsWEx6N2w==",
+			"dependencies": {
+				"plain-tag": "^0.1.3"
+			}
+		},
+		"node_modules/coincident": {
+			"version": "1.2.3",
+			"resolved": "https://registry.npmjs.org/coincident/-/coincident-1.2.3.tgz",
+			"integrity": "sha512-Uxz3BMTWIslzeWjuQnizGWVg0j6khbvHUQ8+5BdM7WuJEm4ALXwq3wluYoB+uF68uPBz/oUOeJnYURKyfjexlA==",
+			"dependencies": {
+				"@ungap/structured-clone": "^1.2.0",
+				"@ungap/with-resolvers": "^0.1.0",
+				"gc-hook": "^0.3.1",
+				"proxy-target": "^3.0.2"
+			},
+			"optionalDependencies": {
+				"ws": "^8.16.0"
+			}
+		},
 		"node_modules/color-convert": {
 			"version": "2.0.1",
 			"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -4001,6 +4063,11 @@
 				"url": "https://github.com/sponsors/ljharb"
 			}
 		},
+		"node_modules/gc-hook": {
+			"version": "0.3.1",
+			"resolved": "https://registry.npmjs.org/gc-hook/-/gc-hook-0.3.1.tgz",
+			"integrity": "sha512-E5M+O/h2o7eZzGhzRZGex6hbB3k4NWqO0eA+OzLRLXxhdbYPajZnynPwAtphnh+cRHPwsj5Z80dqZlfI4eK55A=="
+		},
 		"node_modules/get-func-name": {
 			"version": "2.0.2",
 			"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz",
@@ -4328,6 +4395,11 @@
 				"node": ">=12.0.0"
 			}
 		},
+		"node_modules/html-escaper": {
+			"version": "3.0.3",
+			"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
+			"integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="
+		},
 		"node_modules/htmlparser2": {
 			"version": "8.0.2",
 			"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
@@ -5838,6 +5910,29 @@
 				"pathe": "^1.1.2"
 			}
 		},
+		"node_modules/plain-tag": {
+			"version": "0.1.3",
+			"resolved": "https://registry.npmjs.org/plain-tag/-/plain-tag-0.1.3.tgz",
+			"integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA=="
+		},
+		"node_modules/polyscript": {
+			"version": "0.12.8",
+			"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.12.8.tgz",
+			"integrity": "sha512-kcG3W9jU/s1sYjWOTAa2jAh5D2jm3zJRi+glSTsC+lA3D1b/Sd67pEIGpyL9bWNKYSimqAx4se6jAhQjJZ7+jQ==",
+			"dependencies": {
+				"@ungap/structured-clone": "^1.2.0",
+				"@ungap/with-resolvers": "^0.1.0",
+				"@webreflection/fetch": "^0.1.5",
+				"basic-devtools": "^0.1.6",
+				"codedent": "^0.1.2",
+				"coincident": "^1.2.3",
+				"gc-hook": "^0.3.1",
+				"html-escaper": "^3.0.3",
+				"proxy-target": "^3.0.2",
+				"sticky-module": "^0.1.1",
+				"to-json-callback": "^0.1.1"
+			}
+		},
 		"node_modules/postcss": {
 			"version": "8.4.38",
 			"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz",
@@ -6151,6 +6246,11 @@
 			"integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==",
 			"dev": true
 		},
+		"node_modules/proxy-target": {
+			"version": "3.0.2",
+			"resolved": "https://registry.npmjs.org/proxy-target/-/proxy-target-3.0.2.tgz",
+			"integrity": "sha512-FFE1XNwXX/FNC3/P8HiKaJSy/Qk68RitG/QEcLy/bVnTAPlgTAWPZKh0pARLAnpfXQPKyalBhk009NRTgsk8vQ=="
+		},
 		"node_modules/psl": {
 			"version": "1.9.0",
 			"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
@@ -6176,6 +6276,15 @@
 				"node": ">=6"
 			}
 		},
+		"node_modules/pyodide": {
+			"version": "0.25.1",
+			"resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.25.1.tgz",
+			"integrity": "sha512-y0nJ/fLA3bxD2iZRzvVTbP2O+wp4Ewm2wThfV4HF0BytQ6hsoqTJFLNY4usLOcCVBrK8TTWqFqrmsVPzHe4rsw==",
+			"dependencies": {
+				"base-64": "^1.0.0",
+				"ws": "^8.5.0"
+			}
+		},
 		"node_modules/qs": {
 			"version": "6.10.4",
 			"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz",
@@ -6858,6 +6967,11 @@
 			"integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==",
 			"dev": true
 		},
+		"node_modules/sticky-module": {
+			"version": "0.1.1",
+			"resolved": "https://registry.npmjs.org/sticky-module/-/sticky-module-0.1.1.tgz",
+			"integrity": "sha512-IuYgnyIMUx/m6rtu14l/LR2MaqOLtpXcWkxPmtPsiScRHEo+S4Tojk+DWFHOncSdFX/OsoLOM4+T92yOmI1AMw=="
+		},
 		"node_modules/stream-composer": {
 			"version": "1.0.2",
 			"resolved": "https://registry.npmjs.org/stream-composer/-/stream-composer-1.0.2.tgz",
@@ -7520,6 +7634,11 @@
 				"node": ">=14.14"
 			}
 		},
+		"node_modules/to-json-callback": {
+			"version": "0.1.1",
+			"resolved": "https://registry.npmjs.org/to-json-callback/-/to-json-callback-0.1.1.tgz",
+			"integrity": "sha512-BzOeinTT3NjE+FJ2iCvWB8HvyuyBzoH3WlSnJ+AYVC4tlePyZWSYdkQIFOARWiq0t35/XhmI0uQsFiUsRksRqg=="
+		},
 		"node_modules/to-regex-range": {
 			"version": "5.0.1",
 			"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -7629,6 +7748,11 @@
 				"node": ">= 0.8.0"
 			}
 		},
+		"node_modules/type-checked-collections": {
+			"version": "0.1.7",
+			"resolved": "https://registry.npmjs.org/type-checked-collections/-/type-checked-collections-0.1.7.tgz",
+			"integrity": "sha512-fLIydlJy7IG9XL4wjRwEcKhxx/ekLXiWiMvcGo01cOMF+TN+5ZqajM1mRNRz2bNNi1bzou2yofhjZEQi7kgl9A=="
+		},
 		"node_modules/type-detect": {
 			"version": "4.0.8",
 			"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
@@ -8883,6 +9007,26 @@
 			"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
 			"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
 		},
+		"node_modules/ws": {
+			"version": "8.17.0",
+			"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz",
+			"integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==",
+			"engines": {
+				"node": ">=10.0.0"
+			},
+			"peerDependencies": {
+				"bufferutil": "^4.0.1",
+				"utf-8-validate": ">=5.0.2"
+			},
+			"peerDependenciesMeta": {
+				"bufferutil": {
+					"optional": true
+				},
+				"utf-8-validate": {
+					"optional": true
+				}
+			}
+		},
 		"node_modules/xtend": {
 			"version": "4.0.2",
 			"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

+ 3 - 0
package.json

@@ -47,6 +47,8 @@
 	},
 	"type": "module",
 	"dependencies": {
+		"@micropython/micropython-webassembly-pyscript": "^1.22.0-369",
+		"@pyscript/core": "^0.4.32",
 		"@sveltejs/adapter-node": "^1.3.1",
 		"async": "^3.2.5",
 		"bits-ui": "^0.19.7",
@@ -61,6 +63,7 @@
 		"js-sha256": "^0.10.1",
 		"katex": "^0.16.9",
 		"marked": "^9.1.0",
+		"pyodide": "^0.25.1",
 		"svelte-sonner": "^0.3.19",
 		"tippy.js": "^6.3.7",
 		"uuid": "^9.0.1"

+ 8 - 0
pyscript-mv.sh

@@ -0,0 +1,8 @@
+cp -R ./node_modules/@pyscript/core/dist ./static/pyscript
+
+# mkdir -p ./static/micropython
+# cp -R ./node_modules/@micropython/micropython-webassembly-pyscript/micropython.* ./static/micropython
+
+mkdir -p ./static/pyodide
+cp ./node_modules/pyodide/pyodide* ./static/pyodide/
+cp ./node_modules/pyodide/python_stdlib.zip ./static/pyodide/

+ 20 - 0
src/Untitled-1.js

@@ -0,0 +1,20 @@
+function execute(id, text) {
+	// pyscript
+	let div = document.createElement('div');
+	let html = `
+            <py-script type="mpy">
+${text}
+            </py-script>
+            `;
+	div.innerHTML = html;
+	const pyScript = div.firstElementChild;
+	try {
+		document.body.appendChild(pyScript);
+		setTimeout(() => {
+			document.body.removeChild(pyScript);
+		}, 0);
+	} catch (error) {
+		console.error('Python error:');
+		console.error(error);
+	}
+}

+ 9 - 0
src/app.html

@@ -12,6 +12,10 @@
 			title="Open WebUI"
 			href="/opensearch.xml"
 		/>
+
+		<script type="module" src="/pyscript/core.js"></script>
+		<link rel="stylesheet" href="/pyscript/core.css" />
+
 		<script>
 			// On page load or when changing themes, best to add inline in `head` to avoid FOUC
 			(() => {
@@ -54,6 +58,11 @@
 		%sveltekit.head%
 	</head>
 	<body data-sveltekit-preload-data="hover">
+		<py-config> interpreter = "/pyodide/pyodide.mjs" </py-config>
+
+		<script type="py">
+			print('pyscript:loaded')
+		</script>
 		<div style="display: contents">%sveltekit.body%</div>
 
 		<div

+ 1 - 0
src/lib/components/chat/MessageInput.svelte

@@ -506,6 +506,7 @@
 						>
 							<div class="flex items-center gap-2 text-sm dark:text-gray-500">
 								<img
+									crossorigin="anonymous"
 									alt="model profile"
 									class="size-5 max-w-[28px] object-cover rounded-full"
 									src={$modelfiles.find((modelfile) => modelfile.tagName === selectedModel.id)

+ 205 - 4
src/lib/components/chat/Messages/CodeBlock.svelte

@@ -2,10 +2,14 @@
 	import { copyToClipboard } from '$lib/utils';
 	import hljs from 'highlight.js';
 	import 'highlight.js/styles/github-dark.min.css';
+	import { tick } from 'svelte';
+
+	export let id = '';
 
 	export let lang = '';
 	export let code = '';
 
+	let executed = false;
 	let copied = false;
 
 	const copyCode = async () => {
@@ -17,6 +21,184 @@
 		}, 1000);
 	};
 
+	const checkPythonCode = (str) => {
+		// Check if the string contains typical Python keywords, syntax, or functions
+		const pythonKeywords = [
+			'def',
+			'class',
+			'import',
+			'from',
+			'if',
+			'else',
+			'elif',
+			'for',
+			'while',
+			'try',
+			'except',
+			'finally',
+			'return',
+			'yield',
+			'lambda',
+			'assert',
+			'pass',
+			'break',
+			'continue',
+			'global',
+			'nonlocal',
+			'del',
+			'True',
+			'False',
+			'None',
+			'and',
+			'or',
+			'not',
+			'in',
+			'is',
+			'as',
+			'with'
+		];
+
+		for (let keyword of pythonKeywords) {
+			if (str.includes(keyword)) {
+				return true;
+			}
+		}
+
+		// Check if the string contains typical Python syntax characters
+		const pythonSyntax = [
+			'def ',
+			'class ',
+			'import ',
+			'from ',
+			'if ',
+			'else:',
+			'elif ',
+			'for ',
+			'while ',
+			'try:',
+			'except:',
+			'finally:',
+			'return ',
+			'yield ',
+			'lambda ',
+			'assert ',
+			'pass',
+			'break',
+			'continue',
+			'global ',
+			'nonlocal ',
+			'del ',
+			'True',
+			'False',
+			'None',
+			' and ',
+			' or ',
+			' not ',
+			' in ',
+			' is ',
+			' as ',
+			' with ',
+			':',
+			'=',
+			'==',
+			'!=',
+			'>',
+			'<',
+			'>=',
+			'<=',
+			'+',
+			'-',
+			'*',
+			'/',
+			'%',
+			'**',
+			'//',
+			'(',
+			')',
+			'[',
+			']',
+			'{',
+			'}'
+		];
+
+		for (let syntax of pythonSyntax) {
+			if (str.includes(syntax)) {
+				return true;
+			}
+		}
+
+		// If none of the above conditions met, it's probably not Python code
+		return false;
+	};
+
+	const executePython = async (text) => {
+		executed = true;
+
+		await tick();
+		const outputDiv = document.getElementById(`code-output-${id}`);
+
+		if (outputDiv) {
+			outputDiv.innerText = 'Running...';
+		}
+
+		text = text
+			.split('\n')
+			.map((line, index) => (index === 0 ? line : '    ' + line))
+			.join('\n');
+
+		// pyscript
+		let div = document.createElement('div');
+		let html = `
+<py-script type="py" worker>
+import js
+import sys
+import io
+
+# Create a StringIO object to capture the output
+output_capture = io.StringIO()
+
+# Save the current standard output
+original_stdout = sys.stdout
+
+# Replace the standard output with the StringIO object
+sys.stdout = output_capture
+
+try:
+    ${text}
+except Exception as e:
+    # Capture any errors and write them to the output capture
+    print(f"Error: {e}", file=output_capture)
+
+# Restore the original standard output
+sys.stdout = original_stdout
+
+# Retrieve the captured output
+captured_output = "[NO OUTPUT]"
+captured_output = output_capture.getvalue()
+
+# Print the captured output
+print(captured_output)
+
+def display_message():
+    output_div = js.document.getElementById("code-output-${id}")
+    output_div.innerText = captured_output
+
+display_message()
+</py-script>`;
+
+		div.innerHTML = html;
+		const pyScript = div.firstElementChild;
+		try {
+			document.body.appendChild(pyScript);
+			setTimeout(() => {
+				document.body.removeChild(pyScript);
+			}, 0);
+		} catch (error) {
+			console.error('Python error:');
+			console.error(error);
+		}
+	};
+
 	$: highlightedCode = code ? hljs.highlightAuto(code, hljs.getLanguage(lang)?.aliases).value : '';
 </script>
 
@@ -26,15 +208,34 @@
 			class="flex justify-between bg-[#202123] text-white text-xs px-4 pt-1 pb-0.5 rounded-t-lg overflow-x-auto"
 		>
 			<div class="p-1">{@html lang}</div>
-			<button class="copy-code-button bg-none border-none p-1" on:click={copyCode}
-				>{copied ? 'Copied' : 'Copy Code'}</button
-			>
+
+			<div class="flex items-center">
+				{#if lang === 'python' || checkPythonCode(code)}
+					<button
+						class="copy-code-button bg-none border-none p-1"
+						on:click={() => {
+							executePython(code);
+						}}>Run</button
+					>
+				{/if}
+				<button class="copy-code-button bg-none border-none p-1" on:click={copyCode}
+					>{copied ? 'Copied' : 'Copy Code'}</button
+				>
+			</div>
 		</div>
 
 		<pre
 			class=" hljs p-4 px-5 overflow-x-auto"
-			style="border-top-left-radius: 0px; border-top-right-radius: 0px;"><code
+			style="border-top-left-radius: 0px; border-top-right-radius: 0px; {executed &&
+				'border-bottom-left-radius: 0px; border-bottom-right-radius: 0px;'}"><code
 				class="language-{lang} rounded-t-none whitespace-pre">{@html highlightedCode || code}</code
 			></pre>
+
+		{#if executed}
+			<div class="bg-[#202123] text-white px-4 py-4 rounded-b-lg">
+				<div class=" text-gray-500 text-xs mb-1">STDOUT/STDERR</div>
+				<div id="code-output-{id}" class="text-sm" />
+			</div>
+		{/if}
 	</div>
 {/if}

+ 2 - 0
src/lib/components/chat/Messages/Placeholder.svelte

@@ -43,6 +43,7 @@
 					>
 						{#if model in modelfiles}
 							<img
+								crossorigin="anonymous"
 								src={modelfiles[model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
 								alt="modelfile"
 								class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
@@ -50,6 +51,7 @@
 							/>
 						{:else}
 							<img
+								crossorigin="anonymous"
 								src={$i18n.language === 'dg-DG'
 									? `/doge.png`
 									: `${WEBUI_BASE_URL}/static/favicon.png`}

+ 7 - 1
src/lib/components/chat/Messages/ProfileImage.svelte

@@ -3,5 +3,11 @@
 </script>
 
 <div class=" mr-3">
-	<img {src} class=" w-8 object-cover rounded-full" alt="profile" draggable="false" />
+	<img
+		crossorigin="anonymous"
+		{src}
+		class=" w-8 object-cover rounded-full"
+		alt="profile"
+		draggable="false"
+	/>
 </div>

+ 1 - 0
src/lib/components/chat/Messages/ResponseMessage.svelte

@@ -437,6 +437,7 @@
 								{#each tokens as token}
 									{#if token.type === 'code'}
 										<CodeBlock
+											id={message.id}
 											lang={token.lang}
 											code={revertSanitizedResponseContent(token.text)}
 										/>

+ 1 - 0
src/lib/components/layout/Sidebar.svelte

@@ -248,6 +248,7 @@
 			>
 				<div class="self-center mx-1.5">
 					<img
+						crossorigin="anonymous"
 						src="{WEBUI_BASE_URL}/static/favicon.png"
 						class=" size-6 -translate-x-1.5 rounded-full"
 						alt="logo"

+ 1 - 1
src/routes/+layout.svelte

@@ -89,7 +89,7 @@
 
 <svelte:head>
 	<title>{$WEBUI_NAME}</title>
-	<link rel="icon" href="{WEBUI_BASE_URL}/static/favicon.png" />
+	<link crossorigin="anonymous" rel="icon" href="{WEBUI_BASE_URL}/static/favicon.png" />
 
 	<!-- rosepine themes have been disabled as it's not up to date with our latest version. -->
 	<!-- feel free to make a PR to fix if anyone wants to see it return -->

+ 6 - 1
src/routes/auth/+page.svelte

@@ -76,7 +76,12 @@
 	<div class="fixed m-10 z-50">
 		<div class="flex space-x-2">
 			<div class=" self-center">
-				<img src="{WEBUI_BASE_URL}/static/favicon.png" class=" w-8 rounded-full" alt="logo" />
+				<img
+					crossorigin="anonymous"
+					src="{WEBUI_BASE_URL}/static/favicon.png"
+					class=" w-8 rounded-full"
+					alt="logo"
+				/>
 			</div>
 		</div>
 	</div>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyodide/pyodide-lock.json


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 8 - 0
static/pyodide/pyodide.asm.js


binární
static/pyodide/pyodide.asm.wasm


+ 1476 - 0
static/pyodide/pyodide.d.ts

@@ -0,0 +1,1476 @@
+// Generated by dts-bundle-generator v8.1.1
+
+/**
+ *
+ * The Pyodide version.
+ *
+ * The version here is a Python version, following :pep:`440`. This is different
+ * from the version in ``package.json`` which follows the node package manager
+ * version convention.
+ */
+export declare const version: string;
+/** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */
+interface PyProxy {
+	[x: string]: any;
+}
+declare class PyProxy {
+	/** @private */
+	$$flags: number;
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+	/**
+	 * @hideconstructor
+	 */
+	constructor();
+	/** @hidden */
+	get [Symbol.toStringTag](): string;
+	/**
+	 * The name of the type of the object.
+	 *
+	 * Usually the value is ``"module.name"`` but for builtins or
+	 * interpreter-defined types it is just ``"name"``. As pseudocode this is:
+	 *
+	 * .. code-block:: python
+	 *
+	 *    ty = type(x)
+	 *    if ty.__module__ == 'builtins' or ty.__module__ == "__main__":
+	 *        return ty.__name__
+	 *    else:
+	 *        ty.__module__ + "." + ty.__name__
+	 *
+	 */
+	get type(): string;
+	/**
+	 * Returns `str(o)` (unless `pyproxyToStringRepr: true` was passed to
+	 * :js:func:`loadPyodide` in which case it will return `repr(o)`)
+	 */
+	toString(): string;
+	/**
+	 * Destroy the :js:class:`~pyodide.ffi.PyProxy`. This will release the memory. Any further attempt
+	 * to use the object will raise an error.
+	 *
+	 * In a browser supporting :js:data:`FinalizationRegistry`, Pyodide will
+	 * automatically destroy the :js:class:`~pyodide.ffi.PyProxy` when it is garbage collected, however
+	 * there is no guarantee that the finalizer will be run in a timely manner so
+	 * it is better to destroy the proxy explicitly.
+	 *
+	 * @param options
+	 * @param options.message The error message to print if use is attempted after
+	 *        destroying. Defaults to "Object has already been destroyed".
+	 *
+	 */
+	destroy(options?: {
+		message?: string;
+		destroyRoundtrip?: boolean;
+	}): void;
+	/**
+	 * Make a new :js:class:`~pyodide.ffi.PyProxy` pointing to the same Python object.
+	 * Useful if the :js:class:`~pyodide.ffi.PyProxy` is destroyed somewhere else.
+	 */
+	copy(): PyProxy;
+	/**
+	 * Converts the :js:class:`~pyodide.ffi.PyProxy` into a JavaScript object as best as possible. By
+	 * default does a deep conversion, if a shallow conversion is desired, you can
+	 * use ``proxy.toJs({depth : 1})``. See :ref:`Explicit Conversion of PyProxy
+	 * <type-translations-pyproxy-to-js>` for more info.
+	 * @param options
+	 * @return The JavaScript object resulting from the conversion.
+	 */
+	toJs({ depth, pyproxies, create_pyproxies, dict_converter, default_converter, }?: {
+		/** How many layers deep to perform the conversion. Defaults to infinite */
+		depth?: number;
+		/**
+		 * If provided, :js:meth:`toJs` will store all PyProxies created in this
+		 * list. This allows you to easily destroy all the PyProxies by iterating
+		 * the list without having to recurse over the generated structure. The most
+		 * common use case is to create a new empty list, pass the list as
+		 * ``pyproxies``, and then later iterate over ``pyproxies`` to destroy all of
+		 * created proxies.
+		 */
+		pyproxies?: PyProxy[];
+		/**
+		 * If false, :js:meth:`toJs` will throw a
+		 * :py:exc:`~pyodide.ffi.ConversionError` rather than producing a
+		 * :js:class:`~pyodide.ffi.PyProxy`.
+		 */
+		create_pyproxies?: boolean;
+		/**
+		 * A function to be called on an iterable of pairs ``[key, value]``. Convert
+		 * this iterable of pairs to the desired output. For instance,
+		 * :js:func:`Object.fromEntries` would convert the dict to an object,
+		 * :js:func:`Array.from` converts it to an :js:class:`Array` of pairs, and
+		 * ``(it) => new Map(it)`` converts it to a :js:class:`Map` (which is the
+		 * default behavior).
+		 */
+		dict_converter?: (array: Iterable<[
+			key: string,
+			value: any
+		]>) => any;
+		/**
+		 * Optional argument to convert objects with no default conversion. See the
+		 * documentation of :meth:`~pyodide.ffi.to_js`.
+		 */
+		default_converter?: (obj: PyProxy, convert: (obj: PyProxy) => any, cacheConversion: (obj: PyProxy, result: any) => void) => any;
+	}): any;
+}
+declare class PyProxyWithLength extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyProxyWithLength } from "pyodide/ffi"` instead */
+interface PyProxyWithLength extends PyLengthMethods {
+}
+declare class PyLengthMethods {
+	/**
+	 * The length of the object.
+	 */
+	get length(): number;
+}
+declare class PyProxyWithGet extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyProxyWithGet } from "pyodide/ffi"` instead */
+interface PyProxyWithGet extends PyGetItemMethods {
+}
+declare class PyGetItemMethods {
+	/**
+	 * This translates to the Python code ``obj[key]``.
+	 *
+	 * @param key The key to look up.
+	 * @returns The corresponding value.
+	 */
+	get(key: any): any;
+}
+declare class PyProxyWithSet extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyProxyWithSet } from "pyodide/ffi"` instead */
+interface PyProxyWithSet extends PySetItemMethods {
+}
+declare class PySetItemMethods {
+	/**
+	 * This translates to the Python code ``obj[key] = value``.
+	 *
+	 * @param key The key to set.
+	 * @param value The value to set it to.
+	 */
+	set(key: any, value: any): void;
+	/**
+	 * This translates to the Python code ``del obj[key]``.
+	 *
+	 * @param key The key to delete.
+	 */
+	delete(key: any): void;
+}
+declare class PyProxyWithHas extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyProxyWithHas } from "pyodide/ffi"` instead */
+interface PyProxyWithHas extends PyContainsMethods {
+}
+declare class PyContainsMethods {
+	/**
+	 * This translates to the Python code ``key in obj``.
+	 *
+	 * @param key The key to check for.
+	 * @returns Is ``key`` present?
+	 */
+	has(key: any): boolean;
+}
+declare class PyIterable extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyIterable } from "pyodide/ffi"` instead */
+interface PyIterable extends PyIterableMethods {
+}
+declare class PyIterableMethods {
+	/**
+	 * This translates to the Python code ``iter(obj)``. Return an iterator
+	 * associated to the proxy. See the documentation for
+	 * :js:data:`Symbol.iterator`.
+	 *
+	 * This will be used implicitly by ``for(let x of proxy){}``.
+	 */
+	[Symbol.iterator](): Iterator<any, any, any>;
+}
+declare class PyAsyncIterable extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyAsyncIterable } from "pyodide/ffi"` instead */
+interface PyAsyncIterable extends PyAsyncIterableMethods {
+}
+declare class PyAsyncIterableMethods {
+	/**
+	 * This translates to the Python code ``aiter(obj)``. Return an async iterator
+	 * associated to the proxy. See the documentation for :js:data:`Symbol.asyncIterator`.
+	 *
+	 * This will be used implicitly by ``for(await let x of proxy){}``.
+	 */
+	[Symbol.asyncIterator](): AsyncIterator<any, any, any>;
+}
+declare class PyIterator extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyIterator } from "pyodide/ffi"` instead */
+interface PyIterator extends PyIteratorMethods {
+}
+declare class PyIteratorMethods {
+	/** @private */
+	[Symbol.iterator](): this;
+	/**
+	 * This translates to the Python code ``next(obj)``. Returns the next value of
+	 * the generator. See the documentation for :js:meth:`Generator.next` The
+	 * argument will be sent to the Python generator.
+	 *
+	 * This will be used implicitly by ``for(let x of proxy){}``.
+	 *
+	 * @param any The value to send to the generator. The value will be assigned
+	 * as a result of a yield expression.
+	 * @returns An Object with two properties: ``done`` and ``value``. When the
+	 * generator yields ``some_value``, ``next`` returns ``{done : false, value :
+	 * some_value}``. When the generator raises a :py:exc:`StopIteration`
+	 * exception, ``next`` returns ``{done : true, value : result_value}``.
+	 */
+	next(arg?: any): IteratorResult<any, any>;
+}
+declare class PyGenerator extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyGenerator } from "pyodide/ffi"` instead */
+interface PyGenerator extends PyGeneratorMethods {
+}
+declare class PyGeneratorMethods {
+	/**
+	 * Throws an exception into the Generator.
+	 *
+	 * See the documentation for :js:meth:`Generator.throw`.
+	 *
+	 * @param exception Error The error to throw into the generator. Must be an
+	 * instanceof ``Error``.
+	 * @returns An Object with two properties: ``done`` and ``value``. When the
+	 * generator yields ``some_value``, ``return`` returns ``{done : false, value
+	 * : some_value}``. When the generator raises a
+	 * ``StopIteration(result_value)`` exception, ``return`` returns ``{done :
+	 * true, value : result_value}``.
+	 */
+	throw(exc: any): IteratorResult<any, any>;
+	/**
+	 * Throws a :py:exc:`GeneratorExit` into the generator and if the
+	 * :py:exc:`GeneratorExit` is not caught returns the argument value ``{done:
+	 * true, value: v}``. If the generator catches the :py:exc:`GeneratorExit` and
+	 * returns or yields another value the next value of the generator this is
+	 * returned in the normal way. If it throws some error other than
+	 * :py:exc:`GeneratorExit` or :py:exc:`StopIteration`, that error is propagated. See
+	 * the documentation for :js:meth:`Generator.return`.
+	 *
+	 * @param any The value to return from the generator.
+	 * @returns An Object with two properties: ``done`` and ``value``. When the
+	 * generator yields ``some_value``, ``return`` returns ``{done : false, value
+	 * : some_value}``. When the generator raises a
+	 * ``StopIteration(result_value)`` exception, ``return`` returns ``{done :
+	 * true, value : result_value}``.
+	 */
+	return(v: any): IteratorResult<any, any>;
+}
+declare class PyAsyncIterator extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyAsyncIterator } from "pyodide/ffi"` instead */
+interface PyAsyncIterator extends PyAsyncIteratorMethods {
+}
+declare class PyAsyncIteratorMethods {
+	/** @private */
+	[Symbol.asyncIterator](): this;
+	/**
+	 * This translates to the Python code ``anext(obj)``. Returns the next value
+	 * of the asynchronous iterator. The argument will be sent to the Python
+	 * iterator (if it's a generator for instance).
+	 *
+	 * This will be used implicitly by ``for(let x of proxy){}``.
+	 *
+	 * @param any The value to send to a generator. The value will be assigned as
+	 * a result of a yield expression.
+	 * @returns An Object with two properties: ``done`` and ``value``. When the
+	 * iterator yields ``some_value``, ``next`` returns ``{done : false, value :
+	 * some_value}``. When the giterator is done, ``next`` returns
+	 * ``{done : true }``.
+	 */
+	next(arg?: any): Promise<IteratorResult<any, any>>;
+}
+declare class PyAsyncGenerator extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyAsyncGenerator } from "pyodide/ffi"` instead */
+interface PyAsyncGenerator extends PyAsyncGeneratorMethods {
+}
+declare class PyAsyncGeneratorMethods {
+	/**
+	 * Throws an exception into the Generator.
+	 *
+	 * See the documentation for :js:meth:`AsyncGenerator.throw`.
+	 *
+	 * @param exception Error The error to throw into the generator. Must be an
+	 * instanceof ``Error``.
+	 * @returns An Object with two properties: ``done`` and ``value``. When the
+	 * generator yields ``some_value``, ``return`` returns ``{done : false, value
+	 * : some_value}``. When the generator raises a
+	 * ``StopIteration(result_value)`` exception, ``return`` returns ``{done :
+	 * true, value : result_value}``.
+	 */
+	throw(exc: any): Promise<IteratorResult<any, any>>;
+	/**
+	 * Throws a :py:exc:`GeneratorExit` into the generator and if the
+	 * :py:exc:`GeneratorExit` is not caught returns the argument value ``{done:
+	 * true, value: v}``. If the generator catches the :py:exc:`GeneratorExit` and
+	 * returns or yields another value the next value of the generator this is
+	 * returned in the normal way. If it throws some error other than
+	 * :py:exc:`GeneratorExit` or :py:exc:`StopAsyncIteration`, that error is
+	 * propagated. See the documentation for :js:meth:`AsyncGenerator.throw`
+	 *
+	 * @param any The value to return from the generator.
+	 * @returns An Object with two properties: ``done`` and ``value``. When the
+	 * generator yields ``some_value``, ``return`` returns ``{done : false, value
+	 * : some_value}``. When the generator raises a :py:exc:`StopAsyncIteration`
+	 * exception, ``return`` returns ``{done : true, value : result_value}``.
+	 */
+	return(v: any): Promise<IteratorResult<any, any>>;
+}
+declare class PySequence extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PySequence } from "pyodide/ffi"` instead */
+interface PySequence extends PySequenceMethods {
+}
+declare class PySequenceMethods {
+	/** @hidden */
+	get [Symbol.isConcatSpreadable](): boolean;
+	/**
+	 * See :js:meth:`Array.join`. The :js:meth:`Array.join` method creates and
+	 * returns a new string by concatenating all of the elements in the
+	 * :py:class:`~collections.abc.Sequence`.
+	 *
+	 * @param separator A string to separate each pair of adjacent elements of the
+	 * Sequence.
+	 *
+	 * @returns  A string with all Sequence elements joined.
+	 */
+	join(separator?: string): string;
+	/**
+	 * See :js:meth:`Array.slice`. The :js:meth:`Array.slice` method returns a
+	 * shallow copy of a portion of a :py:class:`~collections.abc.Sequence` into a
+	 * new array object selected from ``start`` to ``stop`` (`stop` not included)
+	 * @param start Zero-based index at which to start extraction. Negative index
+	 * counts back from the end of the Sequence.
+	 * @param stop Zero-based index at which to end extraction. Negative index
+	 * counts back from the end of the Sequence.
+	 * @returns A new array containing the extracted elements.
+	 */
+	slice(start?: number, stop?: number): any;
+	/**
+	 * See :js:meth:`Array.lastIndexOf`. Returns the last index at which a given
+	 * element can be found in the Sequence, or -1 if it is not present.
+	 * @param elt Element to locate in the Sequence.
+	 * @param fromIndex Zero-based index at which to start searching backwards,
+	 * converted to an integer. Negative index counts back from the end of the
+	 * Sequence.
+	 * @returns The last index of the element in the Sequence; -1 if not found.
+	 */
+	lastIndexOf(elt: any, fromIndex?: number): number;
+	/**
+	 * See :js:meth:`Array.indexOf`. Returns the first index at which a given
+	 * element can be found in the Sequence, or -1 if it is not present.
+	 * @param elt Element to locate in the Sequence.
+	 * @param fromIndex Zero-based index at which to start searching, converted to
+	 * an integer. Negative index counts back from the end of the Sequence.
+	 * @returns The first index of the element in the Sequence; -1 if not found.
+	 */
+	indexOf(elt: any, fromIndex?: number): number;
+	/**
+	 * See :js:meth:`Array.forEach`. Executes a provided function once for each
+	 * ``Sequence`` element.
+	 * @param callbackfn A function to execute for each element in the ``Sequence``. Its
+	 * return value is discarded.
+	 * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
+	 */
+	forEach(callbackfn: (elt: any) => void, thisArg?: any): void;
+	/**
+	 * See :js:meth:`Array.map`. Creates a new array populated with the results of
+	 * calling a provided function on every element in the calling ``Sequence``.
+	 * @param callbackfn A function to execute for each element in the ``Sequence``. Its
+	 * return value is added as a single element in the new array.
+	 * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
+	 */
+	map<U>(callbackfn: (elt: any, index: number, array: any) => U, thisArg?: any): U[];
+	/**
+	 * See :js:meth:`Array.filter`. Creates a shallow copy of a portion of a given
+	 * ``Sequence``, filtered down to just the elements from the given array that pass
+	 * the test implemented by the provided function.
+	 * @param callbackfn A function to execute for each element in the array. It
+	 * should return a truthy value to keep the element in the resulting array,
+	 * and a falsy value otherwise.
+	 * @param thisArg A value to use as ``this`` when executing ``predicate``.
+	 */
+	filter(predicate: (elt: any, index: number, array: any) => boolean, thisArg?: any): any[];
+	/**
+	 * See :js:meth:`Array.some`. Tests whether at least one element in the
+	 * ``Sequence`` passes the test implemented by the provided function.
+	 * @param callbackfn A function to execute for each element in the
+	 * ``Sequence``. It should return a truthy value to indicate the element
+	 * passes the test, and a falsy value otherwise.
+	 * @param thisArg A value to use as ``this`` when executing ``predicate``.
+	 */
+	some(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean;
+	/**
+	 * See :js:meth:`Array.every`. Tests whether every element in the ``Sequence``
+	 * passes the test implemented by the provided function.
+	 * @param callbackfn A function to execute for each element in the
+	 * ``Sequence``. It should return a truthy value to indicate the element
+	 * passes the test, and a falsy value otherwise.
+	 * @param thisArg A value to use as ``this`` when executing ``predicate``.
+	 */
+	every(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean;
+	/**
+	 * See :js:meth:`Array.reduce`. Executes a user-supplied "reducer" callback
+	 * function on each element of the Sequence, in order, passing in the return
+	 * value from the calculation on the preceding element. The final result of
+	 * running the reducer across all elements of the Sequence is a single value.
+	 * @param callbackfn A function to execute for each element in the ``Sequence``. Its
+	 * return value is discarded.
+	 * @param thisArg A value to use as ``this`` when executing ``callbackfn``.
+	 */
+	reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any) => any, initialValue?: any): any;
+	/**
+	 * See :js:meth:`Array.reduceRight`. Applies a function against an accumulator
+	 * and each value of the Sequence (from right to left) to reduce it to a
+	 * single value.
+	 * @param callbackfn A function to execute for each element in the Sequence.
+	 * Its return value is discarded.
+	 * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
+	 */
+	reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any) => any, initialValue: any): any;
+	/**
+	 * See :js:meth:`Array.at`. Takes an integer value and returns the item at
+	 * that index.
+	 * @param index Zero-based index of the Sequence element to be returned,
+	 * converted to an integer. Negative index counts back from the end of the
+	 * Sequence.
+	 * @returns The element in the Sequence matching the given index.
+	 */
+	at(index: number): any;
+	/**
+	 * The :js:meth:`Array.concat` method is used to merge two or more arrays.
+	 * This method does not change the existing arrays, but instead returns a new
+	 * array.
+	 * @param rest Arrays and/or values to concatenate into a new array.
+	 * @returns A new Array instance.
+	 */
+	concat(...rest: ConcatArray<any>[]): any[];
+	/**
+	 * The  :js:meth:`Array.includes` method determines whether a Sequence
+	 * includes a certain value among its entries, returning true or false as
+	 * appropriate.
+	 * @param elt
+	 * @returns
+	 */
+	includes(elt: any): any;
+	/**
+	 * The :js:meth:`Array.entries` method returns a new iterator object that
+	 * contains the key/value pairs for each index in the ``Sequence``.
+	 * @returns A new iterator object.
+	 */
+	entries(): IterableIterator<[
+		number,
+		any
+	]>;
+	/**
+	 * The :js:meth:`Array.keys` method returns a new iterator object that
+	 * contains the keys for each index in the ``Sequence``.
+	 * @returns A new iterator object.
+	 */
+	keys(): IterableIterator<number>;
+	/**
+	 * The :js:meth:`Array.values` method returns a new iterator object that
+	 * contains the values for each index in the ``Sequence``.
+	 * @returns A new iterator object.
+	 */
+	values(): IterableIterator<any>;
+	/**
+	 * The :js:meth:`Array.find` method returns the first element in the provided
+	 * array that satisfies the provided testing function.
+	 * @param predicate A function to execute for each element in the
+	 * ``Sequence``. It should return a truthy value to indicate a matching
+	 * element has been found, and a falsy value otherwise.
+	 * @param thisArg A value to use as ``this`` when executing ``predicate``.
+	 * @returns The first element in the ``Sequence`` that satisfies the provided
+	 * testing function.
+	 */
+	find(predicate: (value: any, index: number, obj: any[]) => any, thisArg?: any): any;
+	/**
+	 * The :js:meth:`Array.findIndex` method returns the index of the first
+	 * element in the provided array that satisfies the provided testing function.
+	 * @param predicate A function to execute for each element in the
+	 * ``Sequence``. It should return a truthy value to indicate a matching
+	 * element has been found, and a falsy value otherwise.
+	 * @param thisArg A value to use as ``this`` when executing ``predicate``.
+	 * @returns The index of the first element in the ``Sequence`` that satisfies
+	 * the provided testing function.
+	 */
+	findIndex(predicate: (value: any, index: number, obj: any[]) => any, thisArg?: any): number;
+}
+declare class PyMutableSequence extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyMutableSequence } from "pyodide/ffi"` instead */
+interface PyMutableSequence extends PyMutableSequenceMethods {
+}
+declare class PyMutableSequenceMethods {
+	/**
+	 * The :js:meth:`Array.reverse` method reverses a :js:class:`PyMutableSequence` in
+	 * place.
+	 * @returns A reference to the same :js:class:`PyMutableSequence`
+	 */
+	reverse(): PyMutableSequence;
+	/**
+	 * The :js:meth:`Array.sort` method sorts the elements of a
+	 * :js:class:`PyMutableSequence` in place.
+	 * @param compareFn A function that defines the sort order.
+	 * @returns A reference to the same :js:class:`PyMutableSequence`
+	 */
+	sort(compareFn?: (a: any, b: any) => number): PyMutableSequence;
+	/**
+	 * The :js:meth:`Array.splice` method changes the contents of a
+	 * :js:class:`PyMutableSequence` by removing or replacing existing elements and/or
+	 * adding new elements in place.
+	 * @param start Zero-based index at which to start changing the
+	 * :js:class:`PyMutableSequence`.
+	 * @param deleteCount An integer indicating the number of elements in the
+	 * :js:class:`PyMutableSequence` to remove from ``start``.
+	 * @param items The elements to add to the :js:class:`PyMutableSequence`, beginning from
+	 * ``start``.
+	 * @returns An array containing the deleted elements.
+	 */
+	splice(start: number, deleteCount?: number, ...items: any[]): any[];
+	/**
+	 * The :js:meth:`Array.push` method adds the specified elements to the end of
+	 * a :js:class:`PyMutableSequence`.
+	 * @param elts The element(s) to add to the end of the :js:class:`PyMutableSequence`.
+	 * @returns The new length property of the object upon which the method was
+	 * called.
+	 */
+	push(...elts: any[]): any;
+	/**
+	 * The :js:meth:`Array.pop` method removes the last element from a
+	 * :js:class:`PyMutableSequence`.
+	 * @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
+	 * :js:class:`PyMutableSequence` is empty.
+	 */
+	pop(): any;
+	/**
+	 * The :js:meth:`Array.shift` method removes the first element from a
+	 * :js:class:`PyMutableSequence`.
+	 * @returns The removed element from the :js:class:`PyMutableSequence`; undefined if the
+	 * :js:class:`PyMutableSequence` is empty.
+	 */
+	shift(): any;
+	/**
+	 * The :js:meth:`Array.unshift` method adds the specified elements to the
+	 * beginning of a :js:class:`PyMutableSequence`.
+	 * @param elts The elements to add to the front of the :js:class:`PyMutableSequence`.
+	 * @returns The new length of the :js:class:`PyMutableSequence`.
+	 */
+	unshift(...elts: any[]): any;
+	/**
+	 * The :js:meth:`Array.copyWithin` method shallow copies part of a
+	 * :js:class:`PyMutableSequence` to another location in the same :js:class:`PyMutableSequence`
+	 * without modifying its length.
+	 * @param target Zero-based index at which to copy the sequence to.
+	 * @param start Zero-based index at which to start copying elements from.
+	 * @param end Zero-based index at which to end copying elements from.
+	 * @returns The modified :js:class:`PyMutableSequence`.
+	 */
+	copyWithin(target: number, start?: number, end?: number): any;
+	/**
+	 * The :js:meth:`Array.fill` method changes all elements in an array to a
+	 * static value, from a start index to an end index.
+	 * @param value Value to fill the array with.
+	 * @param start Zero-based index at which to start filling. Default 0.
+	 * @param end Zero-based index at which to end filling. Default
+	 * ``list.length``.
+	 * @returns
+	 */
+	fill(value: any, start?: number, end?: number): any;
+}
+declare class PyAwaitable extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyAwaitable } from "pyodide/ffi"` instead */
+interface PyAwaitable extends Promise<any> {
+}
+declare class PyCallable extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyCallable;
+}
+/** @deprecated Use `import type { PyCallable } from "pyodide/ffi"` instead */
+interface PyCallable extends PyCallableMethods {
+	(...args: any[]): any;
+}
+declare class PyCallableMethods {
+	/**
+	 * The ``apply()`` method calls the specified function with a given this
+	 * value, and arguments provided as an array (or an array-like object). Like
+	 * :js:meth:`Function.apply`.
+	 *
+	 * @param thisArg The ``this`` argument. Has no effect unless the
+	 * :js:class:`~pyodide.ffi.PyCallable` has :js:meth:`captureThis` set. If
+	 * :js:meth:`captureThis` is set, it will be passed as the first argument to
+	 * the Python function.
+	 * @param jsargs The array of arguments
+	 * @returns The result from the function call.
+	 */
+	apply(thisArg: any, jsargs: any): any;
+	/**
+	 * Calls the function with a given this value and arguments provided
+	 * individually. See :js:meth:`Function.call`.
+	 *
+	 * @param thisArg The ``this`` argument. Has no effect unless the
+	 * :js:class:`~pyodide.ffi.PyCallable` has :js:meth:`captureThis` set. If
+	 * :js:meth:`captureThis` is set, it will be passed as the first argument to
+	 * the Python function.
+	 * @param jsargs The arguments
+	 * @returns The result from the function call.
+	 */
+	call(thisArg: any, ...jsargs: any): any;
+	/**
+	 * Call the function with key word arguments. The last argument must be an
+	 * object with the keyword arguments.
+	 */
+	callKwargs(...jsargs: any): any;
+	/**
+	 * Call the function with stack switching enabled. Functions called this way
+	 * can use
+	 * :py:meth:`PyodideFuture.syncify() <pyodide.webloop.PyodideFuture.syncify>`
+	 * to block until a :py:class:`~asyncio.Future` or :js:class:`Promise` is
+	 * resolved. Only works in runtimes with JS Promise integration.
+	 *
+	 * .. admonition:: Experimental
+	 *    :class: warning
+	 *
+	 *    This feature is not yet stable.
+	 *
+	 * @experimental
+	 */
+	callSyncifying(...jsargs: any): Promise<any>;
+	/**
+	 * Call the function with stack switching enabled. The last argument must be
+	 * an object with the keyword arguments. Functions called this way can use
+	 * :py:meth:`PyodideFuture.syncify() <pyodide.webloop.PyodideFuture.syncify>`
+	 * to block until a :py:class:`~asyncio.Future` or :js:class:`Promise` is
+	 * resolved. Only works in runtimes with JS Promise integration.
+	 *
+	 * .. admonition:: Experimental
+	 *    :class: warning
+	 *
+	 *    This feature is not yet stable.
+	 *
+	 * @experimental
+	 */
+	callSyncifyingKwargs(...jsargs: any): Promise<any>;
+	/**
+	 * The ``bind()`` method creates a new function that, when called, has its
+	 * ``this`` keyword set to the provided value, with a given sequence of
+	 * arguments preceding any provided when the new function is called. See
+	 * :js:meth:`Function.bind`.
+	 *
+	 * If the :js:class:`~pyodide.ffi.PyCallable` does not have
+	 * :js:meth:`captureThis` set, the ``this`` parameter will be discarded. If it
+	 * does have :js:meth:`captureThis` set, ``thisArg`` will be set to the first
+	 * argument of the Python function. The returned proxy and the original proxy
+	 * have the same lifetime so destroying either destroys both.
+	 *
+	 * @param thisArg The value to be passed as the ``this`` parameter to the
+	 * target function ``func`` when the bound function is called.
+	 * @param jsargs Extra arguments to prepend to arguments provided to the bound
+	 * function when invoking ``func``.
+	 * @returns
+	 */
+	bind(thisArg: any, ...jsargs: any): PyProxy;
+	/**
+	 * Returns a :js:class:`~pyodide.ffi.PyProxy` that passes ``this`` as the first argument to the
+	 * Python function. The returned :js:class:`~pyodide.ffi.PyProxy` has the internal ``captureThis``
+	 * property set.
+	 *
+	 * It can then be used as a method on a JavaScript object. The returned proxy
+	 * and the original proxy have the same lifetime so destroying either destroys
+	 * both.
+	 *
+	 * For example:
+	 *
+	 * .. code-block:: pyodide
+	 *
+	 *    let obj = { a : 7 };
+	 *    pyodide.runPython(`
+	 *      def f(self):
+	 *        return self.a
+	 *    `);
+	 *    // Without captureThis, it doesn't work to use f as a method for obj:
+	 *    obj.f = pyodide.globals.get("f");
+	 *    obj.f(); // raises "TypeError: f() missing 1 required positional argument: 'self'"
+	 *    // With captureThis, it works fine:
+	 *    obj.f = pyodide.globals.get("f").captureThis();
+	 *    obj.f(); // returns 7
+	 *
+	 * @returns The resulting :js:class:`~pyodide.ffi.PyProxy`. It has the same lifetime as the
+	 * original :js:class:`~pyodide.ffi.PyProxy` but passes ``this`` to the wrapped function.
+	 *
+	 */
+	captureThis(): PyProxy;
+}
+declare class PyBuffer extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyBuffer;
+}
+/** @deprecated Use `import type { PyBuffer } from "pyodide/ffi"` instead */
+interface PyBuffer extends PyBufferMethods {
+}
+declare class PyBufferMethods {
+	/**
+	 * Get a view of the buffer data which is usable from JavaScript. No copy is
+	 * ever performed.
+	 *
+	 * We do not support suboffsets, if the buffer requires suboffsets we will
+	 * throw an error. JavaScript nd array libraries can't handle suboffsets
+	 * anyways. In this case, you should use the :js:meth:`~PyProxy.toJs` api or
+	 * copy the buffer to one that doesn't use suboffsets (using e.g.,
+	 * :py:func:`numpy.ascontiguousarray`).
+	 *
+	 * If the buffer stores big endian data or half floats, this function will
+	 * fail without an explicit type argument. For big endian data you can use
+	 * :js:meth:`~PyProxy.toJs`. :js:class:`DataView` has support for big endian
+	 * data, so you might want to pass ``'dataview'`` as the type argument in that
+	 * case.
+	 *
+	 * @param type The type of the :js:attr:`~pyodide.ffi.PyBufferView.data` field
+	 * in the output. Should be one of: ``"i8"``, ``"u8"``, ``"u8clamped"``,
+	 * ``"i16"``, ``"u16"``, ``"i32"``, ``"u32"``, ``"i32"``, ``"u32"``,
+	 * ``"i64"``, ``"u64"``, ``"f32"``, ``"f64``, or ``"dataview"``. This argument
+	 * is optional, if absent :js:meth:`~pyodide.ffi.PyBuffer.getBuffer` will try
+	 * to determine the appropriate output type based on the buffer format string
+	 * (see :std:ref:`struct-format-strings`).
+	 */
+	getBuffer(type?: string): PyBufferView;
+}
+declare class PyDict extends PyProxy {
+	/** @private */
+	static [Symbol.hasInstance](obj: any): obj is PyProxy;
+}
+/** @deprecated Use `import type { PyDict } from "pyodide/ffi"` instead */
+interface PyDict extends PyProxyWithGet, PyProxyWithSet, PyProxyWithHas, PyProxyWithLength, PyIterable {
+}
+/** @deprecated Use `import type { PyBufferView } from "pyodide/ffi"` instead */
+declare class PyBufferView {
+	/**
+	 * The offset of the first entry of the array. For instance if our array
+	 * is 3d, then you will find ``array[0,0,0]`` at
+	 * ``pybuf.data[pybuf.offset]``
+	 */
+	offset: number;
+	/**
+	 * If the data is read only, you should not modify it. There is no way for us
+	 * to enforce this, but it may cause very weird behavior. See
+	 * :py:attr:`memoryview.readonly`.
+	 */
+	readonly: boolean;
+	/**
+	 * The format string for the buffer. See :ref:`struct-format-strings`
+	 * and :py:attr:`memoryview.format`.
+	 */
+	format: string;
+	/**
+	 * How large is each entry in bytes? See :py:attr:`memoryview.itemsize`.
+	 */
+	itemsize: number;
+	/**
+	 * The number of dimensions of the buffer. If ``ndim`` is 0, the buffer
+	 * represents a single scalar or struct. Otherwise, it represents an
+	 * array. See :py:attr:`memoryview.ndim`.
+	 */
+	ndim: number;
+	/**
+	 * The total number of bytes the buffer takes up. This is equal to
+	 * :js:attr:`buff.data.byteLength <TypedArray.byteLength>`. See :py:attr:`memoryview.nbytes`.
+	 */
+	nbytes: number;
+	/**
+	 * The shape of the buffer, that is how long it is in each dimension.
+	 * The length will be equal to ``ndim``. For instance, a 2x3x4 array
+	 * would have shape ``[2, 3, 4]``. See :py:attr:`memoryview.shape`.
+	 */
+	shape: number[];
+	/**
+	 * An array of of length ``ndim`` giving the number of elements to skip
+	 * to get to a new element in each dimension. See the example definition
+	 * of a ``multiIndexToIndex`` function above. See :py:attr:`memoryview.strides`.
+	 */
+	strides: number[];
+	/**
+	 * The actual data. A typed array of an appropriate size backed by a segment
+	 * of the WASM memory.
+	 *
+	 * The ``type`` argument of :js:meth:`~pyodide.ffi.PyBuffer.getBuffer` determines
+	 * which sort of :js:class:`TypedArray` or :js:class:`DataView` to return. By
+	 * default :js:meth:`~pyodide.ffi.PyBuffer.getBuffer` will look at the format string
+	 * to determine the most appropriate option. Most often the result is a
+	 * :js:class:`Uint8Array`.
+	 *
+	 * .. admonition:: Contiguity
+	 *    :class: warning
+	 *
+	 *    If the buffer is not contiguous, the :js:attr:`~PyBufferView.readonly`
+	 *    TypedArray will contain data that is not part of the buffer. Modifying
+	 *    this data leads to undefined behavior.
+	 *
+	 * .. admonition:: Read only buffers
+	 *    :class: warning
+	 *
+	 *    If :js:attr:`buffer.readonly <PyBufferView.readonly>` is ``true``, you
+	 *    should not modify the buffer. Modifying a read only buffer leads to
+	 *    undefined behavior.
+	 *
+	 */
+	data: TypedArray;
+	/**
+	 * Is it C contiguous? See :py:attr:`memoryview.c_contiguous`.
+	 */
+	c_contiguous: boolean;
+	/**
+	 * Is it Fortran contiguous? See :py:attr:`memoryview.f_contiguous`.
+	 */
+	f_contiguous: boolean;
+	_released: boolean;
+	_view_ptr: number;
+	/** @private */
+	constructor();
+	/**
+	 * Release the buffer. This allows the memory to be reclaimed.
+	 */
+	release(): void;
+}
+type InFuncType = () => null | undefined | string | ArrayBuffer | Uint8Array | number;
+declare function setStdin(options?: {
+	stdin?: InFuncType;
+	read?: (buffer: Uint8Array) => number;
+	error?: boolean;
+	isatty?: boolean;
+	autoEOF?: boolean;
+}): void;
+declare function setStdout(options?: {
+	batched?: (output: string) => void;
+	raw?: (charCode: number) => void;
+	write?: (buffer: Uint8Array) => number;
+	isatty?: boolean;
+}): void;
+declare function setStderr(options?: {
+	batched?: (output: string) => void;
+	raw?: (charCode: number) => void;
+	write?: (buffer: Uint8Array) => number;
+	isatty?: boolean;
+}): void;
+type PackageType = "package" | "cpython_module" | "shared_library" | "static_library";
+export type PackageData = {
+	name: string;
+	version: string;
+	fileName: string;
+	/** @experimental */
+	packageType: PackageType;
+};
+declare function loadPackage(names: string | PyProxy | Array<string>, options?: {
+	messageCallback?: (message: string) => void;
+	errorCallback?: (message: string) => void;
+	checkIntegrity?: boolean;
+}): Promise<Array<PackageData>>;
+/** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
+export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
+interface CanvasInterface {
+	setCanvas2D(canvas: HTMLCanvasElement): void;
+	getCanvas2D(): HTMLCanvasElement | undefined;
+	setCanvas3D(canvas: HTMLCanvasElement): void;
+	getCanvas3D(): HTMLCanvasElement | undefined;
+}
+declare class PythonError extends Error {
+	/**
+	 * The address of the error we are wrapping. We may later compare this
+	 * against sys.last_value.
+	 * WARNING: we don't own a reference to this pointer, dereferencing it
+	 * may be a use-after-free error!
+	 * @private
+	 */
+	__error_address: number;
+	/**
+	 * The name of the Python error class, e.g, :py:exc:`RuntimeError` or
+	 * :py:exc:`KeyError`.
+	 */
+	type: string;
+	constructor(type: string, message: string, error_address: number);
+}
+type NativeFS = {
+	syncfs: () => Promise<void>;
+};
+declare class PyodideAPI {
+	/** @hidden */
+	static version: string;
+	/** @hidden */
+	static loadPackage: typeof loadPackage;
+	/** @hidden */
+	static loadedPackages: {
+		[key: string]: string;
+	};
+	/** @hidden */
+	static ffi: {
+		PyProxy: typeof PyProxy;
+		PyProxyWithLength: typeof PyProxyWithLength;
+		PyProxyWithGet: typeof PyProxyWithGet;
+		PyProxyWithSet: typeof PyProxyWithSet;
+		PyProxyWithHas: typeof PyProxyWithHas;
+		PyDict: typeof PyDict;
+		PyIterable: typeof PyIterable;
+		PyAsyncIterable: typeof PyAsyncIterable;
+		PyIterator: typeof PyIterator;
+		PyAsyncIterator: typeof PyAsyncIterator;
+		PyGenerator: typeof PyGenerator;
+		PyAsyncGenerator: typeof PyAsyncGenerator;
+		PyAwaitable: typeof PyAwaitable;
+		PyCallable: typeof PyCallable;
+		PyBuffer: typeof PyBuffer;
+		PyBufferView: typeof PyBufferView;
+		PythonError: typeof PythonError;
+		PySequence: typeof PySequence;
+		PyMutableSequence: typeof PyMutableSequence;
+	};
+	/** @hidden */
+	static setStdin: typeof setStdin;
+	/** @hidden */
+	static setStdout: typeof setStdout;
+	/** @hidden */
+	static setStderr: typeof setStderr;
+	/**
+	 *
+	 * An alias to the global Python namespace.
+	 *
+	 * For example, to access a variable called ``foo`` in the Python global
+	 * scope, use ``pyodide.globals.get("foo")``
+	 */
+	static globals: PyProxy;
+	/**
+	 * An alias to the `Emscripten File System API
+	 * <https://emscripten.org/docs/api_reference/Filesystem-API.html>`_.
+	 *
+	 * This provides a wide range of POSIX-`like` file/device operations, including
+	 * `mount
+	 * <https://emscripten.org/docs/api_reference/Filesystem-API.html#FS.mount>`_
+	 * which can be used to extend the in-memory filesystem with features like `persistence
+	 * <https://emscripten.org/docs/api_reference/Filesystem-API.html#persistent-data>`_.
+	 *
+	 * While all the file systems implementations are enabled, only the default
+	 * ``MEMFS`` is guaranteed to work in all runtime settings. The implementations
+	 * are available as members of ``FS.filesystems``:
+	 * ``IDBFS``, ``NODEFS``, ``PROXYFS``, ``WORKERFS``.
+	 */
+	static FS: any;
+	/**
+	 * An alias to the `Emscripten Path API
+	 * <https://github.com/emscripten-core/emscripten/blob/main/src/library_path.js>`_.
+	 *
+	 * This provides a variety of operations for working with file system paths, such as
+	 * ``dirname``, ``normalize``, and ``splitPath``.
+	 */
+	static PATH: any;
+	/**
+	 * See :ref:`js-api-pyodide-canvas`.
+	 * @hidetype
+	 */
+	static canvas: CanvasInterface;
+	/**
+	 * A map from posix error names to error codes.
+	 */
+	static ERRNO_CODES: {
+		[code: string]: number;
+	};
+	/**
+	 * An alias to the Python :ref:`pyodide <python-api>` package.
+	 *
+	 * You can use this to call functions defined in the Pyodide Python package
+	 * from JavaScript.
+	 */
+	static pyodide_py: PyProxy;
+	/**
+	 * Inspect a Python code chunk and use :js:func:`pyodide.loadPackage` to install
+	 * any known packages that the code chunk imports. Uses the Python API
+	 * :func:`pyodide.code.find\_imports` to inspect the code.
+	 *
+	 * For example, given the following code as input
+	 *
+	 * .. code-block:: python
+	 *
+	 *    import numpy as np
+	 *    x = np.array([1, 2, 3])
+	 *
+	 * :js:func:`loadPackagesFromImports` will call
+	 * ``pyodide.loadPackage(['numpy'])``.
+	 *
+	 * @param code The code to inspect.
+	 * @param options Options passed to :js:func:`pyodide.loadPackage`.
+	 * @param options.messageCallback A callback, called with progress messages
+	 *    (optional)
+	 * @param options.errorCallback A callback, called with error/warning messages
+	 *    (optional)
+	 * @param options.checkIntegrity If true, check the integrity of the downloaded
+	 *    packages (default: true)
+	 * @async
+	 */
+	static loadPackagesFromImports(code: string, options?: {
+		messageCallback?: (message: string) => void;
+		errorCallback?: (message: string) => void;
+		checkIntegrity?: boolean;
+	}): Promise<Array<PackageData>>;
+	/**
+	 * Runs a string of Python code from JavaScript, using :py:func:`~pyodide.code.eval_code`
+	 * to evaluate the code. If the last statement in the Python code is an
+	 * expression (and the code doesn't end with a semicolon), the value of the
+	 * expression is returned.
+	 *
+	 * @param code The Python code to run
+	 * @param options
+	 * @param options.globals An optional Python dictionary to use as the globals.
+	 *        Defaults to :js:attr:`pyodide.globals`.
+	 * @param options.locals An optional Python dictionary to use as the locals.
+	 *        Defaults to the same as ``globals``.
+	 * @param options.filename An optional string to use as the file name.
+	 *        Defaults to ``"<exec>"``. If a custom file name is given, the
+	 *        traceback for any exception that is thrown will show source lines
+	 *        (unless the given file name starts with ``<`` and ends with ``>``).
+	 * @returns The result of the Python code translated to JavaScript. See the
+	 *          documentation for :py:func:`~pyodide.code.eval_code` for more info.
+	 * @example
+	 * async function main(){
+	 *   const pyodide = await loadPyodide();
+	 *   console.log(pyodide.runPython("1 + 2"));
+	 *   // 3
+	 *
+	 *   const globals = pyodide.toPy({ x: 3 });
+	 *   console.log(pyodide.runPython("x + 1", { globals }));
+	 *   // 4
+	 *
+	 *   const locals = pyodide.toPy({ arr: [1, 2, 3] });
+	 *   console.log(pyodide.runPython("sum(arr)", { locals }));
+	 *   // 6
+	 * }
+	 * main();
+	 */
+	static runPython(code: string, options?: {
+		globals?: PyProxy;
+		locals?: PyProxy;
+		filename?: string;
+	}): any;
+	/**
+	 * Run a Python code string with top level await using
+	 * :py:func:`~pyodide.code.eval_code_async` to evaluate the code. Returns a promise which
+	 * resolves when execution completes. If the last statement in the Python code
+	 * is an expression (and the code doesn't end with a semicolon), the returned
+	 * promise will resolve to the value of this expression.
+	 *
+	 * For example:
+	 *
+	 * .. code-block:: pyodide
+	 *
+	 *    let result = await pyodide.runPythonAsync(`
+	 *        from js import fetch
+	 *        response = await fetch("./pyodide-lock.json")
+	 *        packages = await response.json()
+	 *        # If final statement is an expression, its value is returned to JavaScript
+	 *        len(packages.packages.object_keys())
+	 *    `);
+	 *    console.log(result); // 79
+	 *
+	 * .. admonition:: Python imports
+	 *    :class: warning
+	 *
+	 *    Since pyodide 0.18.0, you must call :js:func:`loadPackagesFromImports` to
+	 *    import any python packages referenced via ``import`` statements in your
+	 *    code. This function will no longer do it for you.
+	 *
+	 * @param code The Python code to run
+	 * @param options
+	 * @param options.globals An optional Python dictionary to use as the globals.
+	 * Defaults to :js:attr:`pyodide.globals`.
+	 * @param options.locals An optional Python dictionary to use as the locals.
+	 *        Defaults to the same as ``globals``.
+	 * @param options.filename An optional string to use as the file name.
+	 *        Defaults to ``"<exec>"``. If a custom file name is given, the
+	 *        traceback for any exception that is thrown will show source lines
+	 *        (unless the given file name starts with ``<`` and ends with ``>``).
+	 * @returns The result of the Python code translated to JavaScript.
+	 * @async
+	 */
+	static runPythonAsync(code: string, options?: {
+		globals?: PyProxy;
+		locals?: PyProxy;
+		filename?: string;
+	}): Promise<any>;
+	/**
+	 * Runs a Python code string like :js:func:`pyodide.runPython` but with stack
+	 * switching enabled. Code executed in this way can use
+	 * :py:meth:`PyodideFuture.syncify() <pyodide.webloop.PyodideFuture.syncify>`
+	 * to block until a :py:class:`~asyncio.Future` or :js:class:`Promise` is
+	 * resolved. Only works in runtimes with JS Promise Integration enabled.
+	 *
+	 * .. admonition:: Experimental
+	 *    :class: warning
+	 *
+	 *    This feature is not yet stable.
+	 *
+	 * @experimental
+	 * @param code The Python code to run
+	 * @param options
+	 * @param options.globals An optional Python dictionary to use as the globals.
+	 * Defaults to :js:attr:`pyodide.globals`.
+	 * @param options.locals An optional Python dictionary to use as the locals.
+	 *        Defaults to the same as ``globals``.
+	 * @param options.filename An optional string to use as the file name.
+	 *        Defaults to ``"<exec>"``. If a custom file name is given, the
+	 *        traceback for any exception that is thrown will show source lines
+	 *        (unless the given file name starts with ``<`` and ends with ``>``).
+	 * @returns The result of the Python code translated to JavaScript.
+	 */
+	static runPythonSyncifying(code: string, options?: {
+		globals?: PyProxy;
+		locals?: PyProxy;
+		filename?: string;
+	}): Promise<any>;
+	/**
+	 * Registers the JavaScript object ``module`` as a JavaScript module named
+	 * ``name``. This module can then be imported from Python using the standard
+	 * Python import system. If another module by the same name has already been
+	 * imported, this won't have much effect unless you also delete the imported
+	 * module from :py:data:`sys.modules`. This calls
+	 * :func:`~pyodide.ffi.register_js_module`.
+	 *
+	 * Any attributes of the JavaScript objects which are themselves objects will
+	 * be treated as submodules:
+	 * ```pyodide
+	 * pyodide.registerJsModule("mymodule", { submodule: { value: 7 } });
+	 * pyodide.runPython(`
+	 *     from mymodule.submodule import value
+	 *     assert value == 7
+	 * `);
+	 * ```
+	 * If you wish to prevent this, try the following instead:
+	 * ```pyodide
+	 * const sys = pyodide.pyimport("sys");
+	 * sys.modules.set("mymodule", { obj: { value: 7 } });
+	 * pyodide.runPython(`
+	 *     from mymodule import obj
+	 *     assert obj.value == 7
+	 *     # attempting to treat obj as a submodule raises ModuleNotFoundError:
+	 *     # "No module named 'mymodule.obj'; 'mymodule' is not a package"
+	 *     from mymodule.obj import value
+	 * `);
+	 * ```
+	 *
+	 * @param name Name of the JavaScript module to add
+	 * @param module JavaScript object backing the module
+	 */
+	static registerJsModule(name: string, module: object): void;
+	/**
+	 * Unregisters a JavaScript module with given name that has been previously
+	 * registered with :js:func:`pyodide.registerJsModule` or
+	 * :func:`~pyodide.ffi.register_js_module`. If a JavaScript module with that
+	 * name does not already exist, will throw an error. Note that if the module has
+	 * already been imported, this won't have much effect unless you also delete the
+	 * imported module from :py:data:`sys.modules`. This calls
+	 * :func:`~pyodide.ffi.unregister_js_module`.
+	 *
+	 * @param name Name of the JavaScript module to remove
+	 */
+	static unregisterJsModule(name: string): void;
+	/**
+	 * Convert a JavaScript object to a Python object as best as possible.
+	 *
+	 * This is similar to :py:meth:`~pyodide.ffi.JsProxy.to_py` but for use from
+	 * JavaScript. If the object is immutable or a :js:class:`~pyodide.ffi.PyProxy`,
+	 * it will be returned unchanged. If the object cannot be converted into Python,
+	 * it will be returned unchanged.
+	 *
+	 * See :ref:`type-translations-jsproxy-to-py` for more information.
+	 *
+	 * @param obj The object to convert.
+	 * @param options
+	 * @returns The object converted to Python.
+	 */
+	static toPy(obj: any, { depth, defaultConverter, }?: {
+		/**
+		 *  Optional argument to limit the depth of the conversion.
+		 */
+		depth: number;
+		/**
+		 * Optional argument to convert objects with no default conversion. See the
+		 * documentation of :py:meth:`~pyodide.ffi.JsProxy.to_py`.
+		 */
+		defaultConverter?: (value: any, converter: (value: any) => any, cacheConversion: (input: any, output: any) => void) => any;
+	}): any;
+	/**
+	 * Imports a module and returns it.
+	 *
+	 * .. admonition:: Warning
+	 *    :class: warning
+	 *
+	 *    This function has a completely different behavior than the old removed pyimport function!
+	 *
+	 *    ``pyimport`` is roughly equivalent to:
+	 *
+	 *    .. code-block:: js
+	 *
+	 *      pyodide.runPython(`import ${pkgname}; ${pkgname}`);
+	 *
+	 *    except that the global namespace will not change.
+	 *
+	 *    Example:
+	 *
+	 *    .. code-block:: js
+	 *
+	 *      let sysmodule = pyodide.pyimport("sys");
+	 *      let recursionLimit = sysmodule.getrecursionlimit();
+	 *
+	 * @param mod_name The name of the module to import
+	 * @returns A PyProxy for the imported module
+	 */
+	static pyimport(mod_name: string): PyProxy;
+	/**
+	 * Unpack an archive into a target directory.
+	 *
+	 * @param buffer The archive as an :js:class:`ArrayBuffer` or :js:class:`TypedArray`.
+	 * @param format The format of the archive. Should be one of the formats
+	 * recognized by :py:func:`shutil.unpack_archive`. By default the options are
+	 * ``'bztar'``, ``'gztar'``, ``'tar'``, ``'zip'``, and ``'wheel'``. Several
+	 * synonyms are accepted for each format, e.g., for ``'gztar'`` any of
+	 * ``'.gztar'``, ``'.tar.gz'``, ``'.tgz'``, ``'tar.gz'`` or ``'tgz'`` are
+	 * considered to be
+	 * synonyms.
+	 *
+	 * @param options
+	 * @param options.extractDir The directory to unpack the archive into. Defaults
+	 * to the working directory.
+	 */
+	static unpackArchive(buffer: TypedArray | ArrayBuffer, format: string, options?: {
+		extractDir?: string;
+	}): void;
+	/**
+	 * Mounts a :js:class:`FileSystemDirectoryHandle` into the target directory.
+	 *
+	 * @param path The absolute path in the Emscripten file system to mount the
+	 * native directory. If the directory does not exist, it will be created. If it
+	 * does exist, it must be empty.
+	 * @param fileSystemHandle A handle returned by :js:func:`navigator.storage.getDirectory() <getDirectory>`
+	 * or :js:func:`window.showDirectoryPicker() <showDirectoryPicker>`.
+	 */
+	static mountNativeFS(path: string, fileSystemHandle: FileSystemDirectoryHandle): Promise<NativeFS>;
+	/**
+	 * Tell Pyodide about Comlink.
+	 * Necessary to enable importing Comlink proxies into Python.
+	 */
+	static registerComlink(Comlink: any): void;
+	/**
+	 * Sets the interrupt buffer to be ``interrupt_buffer``. This is only useful
+	 * when Pyodide is used in a webworker. The buffer should be a
+	 * :js:class:`SharedArrayBuffer` shared with the main browser thread (or another
+	 * worker). In that case, signal ``signum`` may be sent by writing ``signum``
+	 * into the interrupt buffer. If ``signum`` does not satisfy 0 < ``signum`` < 65
+	 * it will be silently ignored.
+	 *
+	 * You can disable interrupts by calling ``setInterruptBuffer(undefined)``.
+	 *
+	 * If you wish to trigger a :py:exc:`KeyboardInterrupt`, write ``SIGINT`` (a 2)
+	 * into the interrupt buffer.
+	 *
+	 * By default ``SIGINT`` raises a :py:exc:`KeyboardInterrupt` and all other signals
+	 * are ignored. You can install custom signal handlers with the signal module.
+	 * Even signals that normally have special meaning and can't be overridden like
+	 * ``SIGKILL`` and ``SIGSEGV`` are ignored by default and can be used for any
+	 * purpose you like.
+	 */
+	static setInterruptBuffer(interrupt_buffer: TypedArray): void;
+	/**
+	 * Throws a :py:exc:`KeyboardInterrupt` error if a :py:exc:`KeyboardInterrupt` has
+	 * been requested via the interrupt buffer.
+	 *
+	 * This can be used to enable keyboard interrupts during execution of JavaScript
+	 * code, just as :c:func:`PyErr_CheckSignals` is used to enable keyboard interrupts
+	 * during execution of C code.
+	 */
+	static checkInterrupt(): void;
+	/**
+	 * Turn on or off debug mode. In debug mode, some error messages are improved
+	 * at a performance cost.
+	 * @param debug If true, turn debug mode on. If false, turn debug mode off.
+	 * @returns The old value of the debug flag.
+	 */
+	static setDebug(debug: boolean): boolean;
+}
+/** @hidetype */
+export type PyodideInterface = typeof PyodideAPI;
+/**
+ * See documentation for loadPyodide.
+ * @private
+ */
+type ConfigType = {
+	indexURL: string;
+	packageCacheDir: string;
+	lockFileURL: string;
+	fullStdLib?: boolean;
+	stdLibURL?: string;
+	stdin?: () => string;
+	stdout?: (msg: string) => void;
+	stderr?: (msg: string) => void;
+	jsglobals?: object;
+	args: string[];
+	_node_mounts: string[];
+	env: {
+		[key: string]: string;
+	};
+	packages: string[];
+};
+/**
+ * Load the main Pyodide wasm module and initialize it.
+ *
+ * @returns The :ref:`js-api-pyodide` module.
+ * @memberof globalThis
+ * @async
+ * @example
+ * async function main() {
+ *   const pyodide = await loadPyodide({
+ *     fullStdLib: true,
+ *     stdout: (msg) => console.log(`Pyodide: ${msg}`),
+ *   });
+ *   console.log("Loaded Pyodide");
+ * }
+ * main();
+ */
+export declare function loadPyodide(options?: {
+	/**
+	 * The URL from which Pyodide will load the main Pyodide runtime and
+	 * packages. It is recommended that you leave this unchanged, providing an
+	 * incorrect value can cause broken behavior.
+	 *
+	 * Default: The url that Pyodide is loaded from with the file name
+	 * (``pyodide.js`` or ``pyodide.mjs``) removed.
+	 */
+	indexURL?: string;
+	/**
+	 * The file path where packages will be cached in node. If a package
+	 * exists in ``packageCacheDir`` it is loaded from there, otherwise it is
+	 * downloaded from the JsDelivr CDN and then cached into ``packageCacheDir``.
+	 * Only applies when running in node; ignored in browsers.
+	 *
+	 * Default: same as indexURL
+	 */
+	packageCacheDir?: string;
+	/**
+	 * The URL from which Pyodide will load the Pyodide ``pyodide-lock.json`` lock
+	 * file. You can produce custom lock files with :py:func:`micropip.freeze`.
+	 * Default: ```${indexURL}/pyodide-lock.json```
+	 */
+	lockFileURL?: string;
+	/**
+	 * Load the full Python standard library. Setting this to false excludes
+	 * unvendored modules from the standard library.
+	 * Default: ``false``
+	 */
+	fullStdLib?: boolean;
+	/**
+	 * The URL from which to load the standard library ``python_stdlib.zip``
+	 * file. This URL includes the most of the Python standard library. Some
+	 * stdlib modules were unvendored, and can be loaded separately
+	 * with ``fullStdLib: true`` option or by their package name.
+	 * Default: ```${indexURL}/python_stdlib.zip```
+	 */
+	stdLibURL?: string;
+	/**
+	 * Override the standard input callback. Should ask the user for one line of
+	 * input. The :js:func:`pyodide.setStdin` function is more flexible and
+	 * should be preferred.
+	 */
+	stdin?: () => string;
+	/**
+	 * Override the standard output callback. The :js:func:`pyodide.setStdout`
+	 * function is more flexible and should be preferred in most cases, but
+	 * depending on the ``args`` passed to ``loadPyodide``, Pyodide may write to
+	 * stdout on startup, which can only be controlled by passing a custom
+	 * ``stdout`` function.
+	 */
+	stdout?: (msg: string) => void;
+	/**
+	 * Override the standard error output callback. The
+	 * :js:func:`pyodide.setStderr` function is more flexible and should be
+	 * preferred in most cases, but depending on the ``args`` passed to
+	 * ``loadPyodide``, Pyodide may write to stdout on startup, which can only
+	 * be controlled by passing a custom ``stdout`` function.
+	 */
+	stderr?: (msg: string) => void;
+	/**
+	 * The object that Pyodide will use for the ``js`` module.
+	 * Default: ``globalThis``
+	 */
+	jsglobals?: object;
+	/**
+	 * Command line arguments to pass to Python on startup. See `Python command
+	 * line interface options
+	 * <https://docs.python.org/3.10/using/cmdline.html#interface-options>`_ for
+	 * more details. Default: ``[]``
+	 */
+	args?: string[];
+	/**
+	 * Environment variables to pass to Python. This can be accessed inside of
+	 * Python at runtime via :py:data:`os.environ`. Certain environment variables change
+	 * the way that Python loads:
+	 * https://docs.python.org/3.10/using/cmdline.html#environment-variables
+	 * Default: ``{}``.
+	 * If ``env.HOME`` is undefined, it will be set to a default value of
+	 * ``"/home/pyodide"``
+	 */
+	env?: {
+		[key: string]: string;
+	};
+	/**
+	 * A list of packages to load as Pyodide is initializing.
+	 *
+	 * This is the same as loading the packages with
+	 * :js:func:`pyodide.loadPackage` after Pyodide is loaded except using the
+	 * ``packages`` option is more efficient because the packages are downloaded
+	 * while Pyodide bootstraps itself.
+	 */
+	packages?: string[];
+	/**
+	 * Opt into the old behavior where PyProxy.toString calls `repr` and not
+	 * `str`.
+	 * @deprecated
+	 */
+	pyproxyToStringRepr?: boolean;
+	/**
+	 * @ignore
+	 */
+	_node_mounts?: string[];
+}): Promise<PyodideInterface>;
+
+export type {};
+export type {};

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyodide/pyodide.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 3 - 0
static/pyodide/pyodide.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyodide/pyodide.mjs


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 3 - 0
static/pyodide/pyodide.mjs.map


binární
static/pyodide/python_stdlib.zip


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror-Dr2Hgejs.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror-Dr2Hgejs.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_commands-MgxtVkrD.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_commands-MgxtVkrD.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_lang-python-Cxoc-ydj.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_lang-python-Cxoc-ydj.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_language-_XiX6II0.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_language-_XiX6II0.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_state-BKbyfKsm.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_state-BKbyfKsm.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_view-C0PMO2z_.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/codemirror_view-C0PMO2z_.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/core-CPpjJT4b.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/core-CPpjJT4b.js.map


+ 1 - 0
static/pyscript/core.css

@@ -0,0 +1 @@
+mpy-config,mpy-script,py-config,py-script{display:none}.mpy-editor-box,.py-editor-box{padding:.5rem}.mpy-editor-input,.py-editor-input{position:relative}.mpy-editor-box:before,.py-editor-box:before{content:attr(data-env);display:block;font-size:x-small;text-align:end}.mpy-editor-output,.py-editor-output{white-space:pre}.mpy-editor-run-button,.py-editor-run-button{bottom:.5rem;opacity:0;position:absolute;right:.5rem;transition:opacity .25s;z-index:1}.mpy-editor-box:hover .mpy-editor-run-button,.mpy-editor-run-button:disabled,.mpy-editor-run-button:focus,.py-editor-box:hover .py-editor-run-button,.py-editor-run-button:disabled,.py-editor-run-button:focus{opacity:1}

+ 2 - 0
static/pyscript/core.js

@@ -0,0 +1,2 @@
+export{g as MPWorker,f as PyWorker,T as TYPES,h as config,e as hooks,o as offline_interpreter,b as optional,s as stdlib,i as whenDefined}from"./core-CPpjJT4b.js";
+//# sourceMappingURL=core.js.map

+ 1 - 0
static/pyscript/core.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"core.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}

+ 2 - 0
static/pyscript/deprecations-manager-CQ0oxKrq.js

@@ -0,0 +1,2 @@
+import{e}from"./core-CPpjJT4b.js";import{notify as o}from"./error-BfnovtqK.js";function r(){const e=document.querySelectorAll("script");for(const o of e)s(o.src)}function s(e){/\/pyscript\.net\/latest/.test(e)&&o("Loading scripts from latest is deprecated and will be removed soon. Please use a specific version instead.")}e.main.onReady.add(r),e.main.onWorker.add(r);
+//# sourceMappingURL=deprecations-manager-CQ0oxKrq.js.map

+ 1 - 0
static/pyscript/deprecations-manager-CQ0oxKrq.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"deprecations-manager-CQ0oxKrq.js","sources":["../src/plugins/deprecations-manager.js"],"sourcesContent":["// PyScript Derepcations Plugin\nimport { hooks } from \"../core.js\";\nimport { notify } from \"./error.js\";\n\n// react lazily on PyScript bootstrap\nhooks.main.onReady.add(checkDeprecations);\nhooks.main.onWorker.add(checkDeprecations);\n\n/**\n * Check that there are no scripts loading from pyscript.net/latest\n */\nfunction checkDeprecations() {\n    const scripts = document.querySelectorAll(\"script\");\n    for (const script of scripts) checkLoadingScriptsFromLatest(script.src);\n}\n\n/**\n * Check if src being loaded from pyscript.net/latest and display a notification if true\n * * @param {string} src\n */\nfunction checkLoadingScriptsFromLatest(src) {\n    if (/\\/pyscript\\.net\\/latest/.test(src)) {\n        notify(\n            \"Loading scripts from latest is deprecated and will be removed soon. Please use a specific version instead.\",\n        );\n    }\n}\n"],"names":["checkDeprecations","scripts","document","querySelectorAll","script","checkLoadingScriptsFromLatest","src","test","notify","hooks","main","onReady","add","onWorker"],"mappings":"+EAWA,SAASA,IACL,MAAMC,EAAUC,SAASC,iBAAiB,UAC1C,IAAK,MAAMC,KAAUH,EAASI,EAA8BD,EAAOE,IACvE,CAMA,SAASD,EAA8BC,GAC/B,0BAA0BC,KAAKD,IAC/BE,EACI,6GAGZ,CArBAC,EAAMC,KAAKC,QAAQC,IAAIZ,GACvBS,EAAMC,KAAKG,SAASD,IAAIZ"}

+ 2 - 0
static/pyscript/error-BfnovtqK.js

@@ -0,0 +1,2 @@
+import{e}from"./core-CPpjJT4b.js";function n(e){const n=document.createElement("div");n.className="py-error",n.textContent=e,n.style.cssText="\n    border: 1px solid red;\n    background: #ffdddd;\n    color: black;\n    font-family: courier, monospace;\n    white-space: pre;\n    overflow-x: auto;\n    padding: 8px;\n    margin-top: 8px;\n  ",document.body.append(n)}e.main.onReady.add((function o(r){e.main.onReady.delete(o);const{stderr:t}=r.io;r.io.stderr=(e,...o)=>(n(e.message||e),t(e,...o)),addEventListener("error",(({message:e})=>{e.startsWith("Uncaught PythonError")&&n(e)}))}));export{n as notify};
+//# sourceMappingURL=error-BfnovtqK.js.map

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/error-BfnovtqK.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/index-CTWZX_TW.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/index-CTWZX_TW.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/py-editor-CmqzUo2Z.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/py-editor-CmqzUo2Z.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/py-terminal-CgcHH2nx.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/py-terminal-CgcHH2nx.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/toml-CvAfdf9_.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/toml-CvAfdf9_.js.map


+ 3 - 0
static/pyscript/toml-DiUM0_qs.js

@@ -0,0 +1,3 @@
+/*! (c) Andrea Giammarchi - ISC */
+const{isArray:e}=Array,{parse:r}=JSON,s=(e,{s:r})=>e.replace(/"s(\d+)"/g,((e,s)=>r[s])),t=(e,s)=>r(e.replace(/(\S+?)\s*=/g,'"$1":'),((e,r)=>"string"==typeof r?s[r[0]][r.slice(1)]:r)),p=(r,t,p,l)=>{for(let n=0,{length:a}=r,c=a-1;n<a;n++){const a=s(r[n],t);p=p[a]||(p[a]=l&&n===c?[]:{}),e(p)&&(n!==c&&p.length||p.push({}),p=p.at(-1))}return p},l=e=>{const[r,l]=((e,r,s)=>[e.replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,(e=>`"s${r.push(e.slice(1,-1))-1}"`)).replace(/\d{2,}([:-]\d{2}){2}([ T:-][\dZ:-]+)?/g,(e=>`"d${s.push(new Date(e))-1}"`)).replace(/,\s*[\r\n]+/g,", ").replace(/\[\s*[\r\n]+/g,"[").replace(/[\r\n]+\s*]/g,"]"),{s:r,d:s}])(e,[],[]),n={};let a=n;for(let e of r.split(/[\r\n]+/))if((e=e.trim())&&!e.startsWith("#"))if(/^(\[+)(.*?)\]+/.test(e))a=p(RegExp.$2.trim().split("."),l,n,"["!==RegExp.$1);else if(/^(\S+?)\s*=([^#]+)/.test(e)){const{$1:e,$2:r}=RegExp;a[s(e,l)]=t(r.trim(),l)}return n};export{l as parse};
+//# sourceMappingURL=toml-DiUM0_qs.js.map

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/toml-DiUM0_qs.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm-DqawCVsv.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm-DqawCVsv.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm-readline-D247p8vq.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm-readline-D247p8vq.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 6 - 0
static/pyscript/xterm.css


+ 2 - 0
static/pyscript/xterm_addon-fit--gyF3PcZ.js

@@ -0,0 +1,2 @@
+var e,t,r={exports:{}},s=r.exports=(e=t={},Object.defineProperty(e,"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l=i-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=o-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}},t),i=r.exports.FitAddon,o=r.exports.__esModule;export{i as FitAddon,o as __esModule,s as default};
+//# sourceMappingURL=xterm_addon-fit--gyF3PcZ.js.map

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm_addon-fit--gyF3PcZ.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm_addon-web-links-Cnej-nJ6.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/xterm_addon-web-links-Cnej-nJ6.js.map


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/zip-D2yvzXKD.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
static/pyscript/zip-D2yvzXKD.js.map


+ 0 - 1
svelte.config.js

@@ -6,7 +6,6 @@ const config = {
 	// Consult https://kit.svelte.dev/docs/integrations#preprocessors
 	// for more information about preprocessors
 	preprocess: vitePreprocess(),
-
 	kit: {
 		// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
 		// If your environment is not supported or you settled on a specific environment, switch out the adapter.

+ 15 - 1
vite.config.ts

@@ -1,8 +1,22 @@
 import { sveltekit } from '@sveltejs/kit/vite';
 import { defineConfig } from 'vite';
 
+/** @type {import('vite').Plugin} */
+const viteServerConfig = {
+	name: 'log-request-middleware',
+	configureServer(server) {
+		server.middlewares.use((req, res, next) => {
+			res.setHeader('Access-Control-Allow-Origin', '*');
+			res.setHeader('Access-Control-Allow-Methods', 'GET');
+			res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
+			res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
+			next();
+		});
+	}
+};
+
 export default defineConfig({
-	plugins: [sveltekit()],
+	plugins: [sveltekit(), viteServerConfig],
 	define: {
 		APP_VERSION: JSON.stringify(process.env.npm_package_version)
 	}

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů